我正在尝试使用coinbase php api,api实现正常,我可以向money / genarete发送新地址帐户信息,所有这些都可以正常工作,但仅要求产生货币错误,下面是要求货币代码准确地添加到github上的coinbase php api文档
require_once('vendor/autoload.php');
use Coinbase\Wallet\Client;
use Coinbase\Wallet\Configuration;
use Coinbase\Wallet\Enum\CurrencyCode;
use Coinbase\Wallet\Resource\Transaction;
use Coinbase\Wallet\Value\Money;
$apiKey='xxxxx';
$apiSecret='xxxxxxxxxx';
$configuration = Configuration::apiKey($apiKey, $apiSecret);
$client = Client::create($configuration);
$transaction = Transaction::request([
'amount' => new Money(8, CurrencyCode::USD),
'description' => 'Burrito'
]);
$client->createAccountTransaction($transaction);
echo json_encode($client-decodeLastResponse());
错误是
致命错误:未捕获的TypeError:参数1传递给 Coinbase \ Wallet \ Client :: createAccountTransaction()必须是一个实例 Coinbase \ Wallet \ Resource \ Account的实例 给定的Coinbase \ Wallet \ Resource \ Transaction,称为 /home/exhakduz/api/receive.php在第24行并在 /my_path/vendor/coinbase/coinbase/src/Client.php:359堆栈 跟踪:#0 /filename.php(24): Coinbase \ Wallet \ Client-> createAccountTransaction(Object(Coinbase \ Wallet \ Resource \ Transaction))
1 {main}在第359行的/home/exhakduz/api/vendor/coinbase/coinbase/src/Client.php中抛出