deemru / WavesKit

Waves Platform Development Kit for PHP
https://packagist.org/packages/deemru/waveskit
MIT License
24 stars 8 forks source link

Problem with txTransfer #13

Closed arnezt closed 5 years ago

arnezt commented 5 years ago

Hello @deemru I have an issue when implemented txTransfer using bot. When I use the entire parameter no issue found. But when I devide the two parameters ($recipient and $amount) I get an error:

ERROR: https://nodes.wavesplatform.com (1) (failed to parse json message)

notes: $cmd_second = recipient and $cmd_third = amount are the 2 parameters input by user on Telegram bot /send 3P3gpCLtTJb63Ac94LVoUmFLMQwcyjKbfRW 100

Here is my code:

$wk = new WavesKit('W');
$wk->setPrivateKey('Csv3gBlAblablalallAlbalal');
$assetId = '42LxnagWNNeEvHNk5zhWg6WPPpgYoyxjbSAA8m28MTQb';
$feeAssetId = '8RwwkZJ373Nm6fJCgV2Lefe6FeWawUY2APujcsauUNMR';

$options = ['fee' => 1, 'feeAssetId' => $feeAssetId];
$tx = $wk->txTransfer($cmd_second, $cmd_third, $assetId, $options);
$tx = $wk->txSign($tx);
$tx = $wk->txBroadcast($tx);

if I wrote directly the parameter no error appear:

$tx = $wk->txTransfer(3P3gpCLtTJb63Ac94LVoUmFLMQwcyjKbfRW, 100, $assetId, $options);

Please help me to solve this issue. Thank you.

deemru commented 5 years ago

Check your types:

arnezt commented 5 years ago

Ok I'll try that. Thank you.

arnezt commented 5 years ago

Check your types:

* $recipient — string

* $amount — int

It works. Thank you very much sir.