php - 使用 coinbase php 库向外部发送比特币返回 422::Invalid amount
问题描述
我试图使用coinbase php库将 0.0001 个比特币发送到外部 BTC 地址。我有基于 CodeIgniter 的网站并生成比特币地址,检索余额工作正常。但不知何故,我似乎无法让提币工作。下面是我的代码。
$configuration = \Coinbase\Wallet\Configuration::apiKey($apiKey, $apiSecret);
$client = Coinbase\Wallet\Client::create($configuration);
$accountId = $this->getCoinbaseAccountid($coinid);
$account = $client->getAccount($accountId);
$coinsymbol = $this->CI->common_library->getCoinSymbol($coinid);//returns BTC
$withdrawAmount = new Coinbase\Wallet\Value\Money($amountTosend, $coinsymbol);
$transaction = Coinbase\Wallet\Resource\Transaction::send([
'toBitcoinAddress' => $sendtoAddress,
'amount' => $withdrawAmount,
'description' => $comment,
'fee' => '0.00005' // only required for transactions under BTC0.0001
]);
try {
$response = $client->createAccountTransaction($account, $transaction);
} catch (Coinbase\Wallet\Exception\HttpException $ex) {
$error = $ex->getResponse()->getStatusCode() . '::' . $ex->getError();
$errorcase = 1;
$this->log_ipn_results(FALSE, $error);
}
在我的日志文件中,出现以下错误。即使搜索后我仍然无法找到此错误。
422::无效金额
解决方案
最低提款金额高于0.0001 BTC。
推荐阅读
- php - 如何链接到页面的特定部分 HTML PHP
- c# - 当后端代码中的简单键值变量工作相同时,为什么要使用 redis 作为缓存层?
- google-apps-script - Google Slides Apps 脚本检索页面中的形状
- python-3.x - 在 KNeighborsClassifier 中使用自定义指标时,我不断收到“TypeError:只有整数标量数组可以转换为标量索引”
- java - JavaFX - 在使用选项卡时将 GUI 拆分为单独的类
- jquery - 通过函数调整电子窗口大小
- scheme - 匹配方案中的括号
- android - 当我使用 adb 显示 /sys/kernel/debug/tracing/available_filter_functions 时没有这样的设备
- python - 初始化以迭代抽象pyomo模型中的集合?
- angular-cli - 运行 ng serve -o 时出现错误