这是我的创建、签名和发送代码
$request = clone $tx;
/// For Sample Purposes Only.
$params = array(
'includeToSignTx' => 1,
'script_type'=>'mutlisig-n-of-m',
);
$txClient = new TXClient($apiContext);
try {
// dd($tx);
$txSkeleton = $txClient->create($tx,$params);
$privateKeys = array("private key");
$txSkeleton = $txClient->sign($txSkeleton, $privateKeys);
$txSkeleton = $txClient->send($txSkeleton);
} catch (Exception $ex) {
dd("Created TX", "TXSkeleton", null, $request, $ex);
exit(1);
}
这是我得到的错误:
PrivateKeyList.php 第 54 行中的 FatalThrowableError:类型错误:传递给 BlockCypher\Crypto\PrivateKeyList::addPrivateKey() 的参数 1 必须是 BitWasp\Bitcoin\Key\PrivateKeyInterface 的实例,BitWasp\Bitcoin\Crypto\EcAdapter\Impl\ 的实例PhpEcc\Key\PrivateKey 给定,在第 43 行的 /home/pixel/Documents/tests/vendor/blockcypher/php-client/lib/BlockCypher/Crypto/PrivateKeyList.php 中调用
这是代码
public function addPrivateKey(PrivateKeyInterface $privateKey)
{
$pubKeyHex = $privateKey->getPublicKey()->getHex();
$this->privateKeys[$pubKeyHex] = $privateKey;
}