简体   繁体   English

以编程方式发送eth php

[英]Send eth programmatically php

I use https://github.com/coinbase/coinbase-php with laravel to send Eth from my wallet to wallet on other service. 我将laravel与https://github.com/coinbase/coinbase-php一起使用,将Eth从我的钱包发送到其他服务上的钱包。

I use this method: $client->createAccountTransaction($account, $transaction); 我使用这种方法: $client->createAccountTransaction($account, $transaction);

In this way: 通过这种方式:

$transaction = Transaction::send([
    'to' => new EthrereumAddress($destination_address),
    'amount'           => new Money($amount, $currency),
    'description'      => $description,
    //'fee'              => '0.0001' // only required for transactions under BTC0.0001
]);
$this->client->createAccountTransaction($account, $transaction);

But when I try to do this, I get this error: 但是,当我尝试执行此操作时,出现以下错误:

The Coinbase API only accepts transactions to an account, email, or bitcoin address Coinbase API仅接受对帐户,电子邮件或比特币地址的交易

Can someone tell me how to send eth or what is wrong ? 有人可以告诉我如何发送eth或出什么问题吗?

This was fixed in the latest 2.8.0 version. 此问题已在最新的2.8.0版本中修复。

https://github.com/coinbase/coinbase-php/releases/tag/2.8.0 https://github.com/coinbase/coinbase-php/releases/tag/2.8.0

You should use right $account for each cryptocurrency, but not just the $client->getPrimaryAccount(); 您应该为每种加密货币使用正确的$account ,而不只是$client->getPrimaryAccount();

For example: 例如:

$account = Account::reference('YOUR_ETH_ACCOUNT_ID'); 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM