deemru / WavesKit

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

Order issue returning false. #2

Closed lightwalkernet closed 5 years ago

lightwalkernet commented 5 years ago

Thank you for sharing this package.

I can seem to get the txOrder to work.

I most likely have got the sequence for transmitting an order incorrect. Can you point me in the right direction.

`require DIR . '/../vendor/autoload.php'; use deemru\WavesKit;

$wk = new WavesKit(); $wk->setPrivatekey('REDACTED_BUT_CORRECT'); $order = $wk->txOrder ('Ft8X1v1LTa1ABafufpaCWyVj8KkaxUWE6xBhW6sNFJck', 'BiHyoWW3M3AjbU1pE5t1hNrJG5KtmtFvD43UDpqRyyzh', false, 25, 100, 10 * 60 ); $signed = $wk->txSign($order); $return = $wk->txOrderBroadcast($signed); var_dump($signed); var_dump($return);`

Here is the output:

array(13) { ["version"]=> int(2) ["sender"]=> string(35) "3PGmcbDUGaTtxMSv1HsCmVSbAQkj7CagQ3a" ["senderPublicKey"]=> string(43) "8VAwR7Tpd9h189YGJQHJwWFxCGU31qvuZCAbSTY45qb" ["matcherPublicKey"]=> string(44) "7kPFrHDiGw1rCm7LPszuECwWYL3dMf6iMifLRDJQZMzy" ["assetPair"]=> array(2) { ["amountAsset"]=> string(44) "Ft8X1v1LTa1ABafufpaCWyVj8KkaxUWE6xBhW6sNFJck" ["priceAsset"]=> string(44) "BiHyoWW3M3AjbU1pE5t1hNrJG5KtmtFvD43UDpqRyyzh" } ["orderType"]=> string(3) "buy" ["amount"]=> int(25) ["price"]=> int(100) ["matcherFee"]=> int(300000) ["timestamp"]=> int(1559810103668) ["expiration"]=> int(1559810104268) ["id"]=> string(44) "C3kQxnhnbzwJwV5bLjbHMGAnUTP1hdoVhgx7SXASnReA" ["proofs"]=> array(1) { [0]=> string(87) "Nfy7Fqt2B8XiuhHhE4zs8CqhscS3C75vmpkEo4yeMxHru2vdjY5AAMHEXkrpgc3iZh6NfnPwtCQXhe3Wy1Bpbhr" } } bool(false))

deemru commented 5 years ago

You should set explicitly:

$wk->setNodeAddress( 'https://matcher.wavesplatform.com' );
lightwalkernet commented 5 years ago

Thanks. Great help. I am able to broadcast the order as I can see it in the matcher/orderbook. however the txOrderBroadcast() method return false even on a successful order.

This seems to be occurring in the fetch method here.

if( false !== $fetch ) { if( !$post ) $this->setNodeCache( $url, $fetch ); return $fetch; }

Am I missing something?

Thanks again for your help.

deemru commented 5 years ago

This seems to be occurring in the fetch method here.

if( false !== $fetch ) { if( !$post ) $this->setNodeCache( $url, $fetch ); return $fetch; }

Am I missing something?

This code cannot return false in our universe.

lightwalkernet commented 5 years ago

Sorry. Working perfectly now. Must have been my mistake. New install and all is well. Thank you for an amazing package.