Waves icon indicating copy to clipboard operation
Waves copied to clipboard

Help me check my transfer api

Open nmjay opened this issue 8 years ago • 2 comments

$data = array( 'assetId' => 'asset id here', 'feeAssetId' => 'asset id here', 'sender' => 'address', 'recipient' => 'addres', 'amount' => 1000000000, 'fee' => 100000, 'attachment' => '', 'timestamp' => time() * 1000 );

$curl = new Curl(); $curl->setHeader('Content-Type', 'application/json'); $curl->setHeader('api_key', 'WavesKey'); $curl->setHeader('X-Api-Key', 'WavesKey'); $curl->post('xxx.xx.xxx.xx:6869/assets/transfer', $data); Show Error 404 => Error: 400: HTTP/1.1 400 Bad Request

I use the lasted version of node.

nmjay avatar Sep 28 '18 01:09 nmjay

Hi @nmjay, what lib did you use, could you compare your json format with our docs https://docs.wavesplatform.com/en/development-and-api/waves-node-rest-api/transactions.html. May be you've missed some field.

monroid avatar Oct 02 '18 07:10 monroid

  1. Private API for transferring assets:
  • Some documentation: https://docs.wavesplatform.com/en/development-and-api/waves-node-rest-api/asset-transactions/private-functions.html#post-assetstransfer
  • Swagger https://nodes.wavesnodes.com/api-docs/index.html#!/assets/transfer - just replace https://nodes.wavesnodes.com with http://your_domain or https://your_domain depending on your situation
  1. About $data:
  • feeAssetId => …-feeAssetIdis optional and works only iffeeAssetId` is sponsored asset;
  • attachment - you can leave this field if doesn't send the payload;
  • 'timestamp' => time() * 1000 - right, the Node requires timestamp in milliseconds.
  1. $curl->post('xxx.xx.xxx.xx:6869/assets/transfer', $data):
  • Doesn't sure, this will work. If not, try to specify the protocol: $curl->post('http://
  • Does this PHP library serializes $data to JSON? If not, try json_encode($data)

vsuharnikov avatar Oct 15 '18 11:10 vsuharnikov