stellar-api icon indicating copy to clipboard operation
stellar-api copied to clipboard

Manage Offer Cannot Set 0.29 XLM / 1 COSTUM_TOKEN

Open igun997 opened this issue 6 years ago • 3 comments

i have problem, when i place order small than 1 like 0.2 and more. Transaction Failed on debug. But if i set it to 1 or more that works, what happen

igun997 avatar Nov 22 '18 12:11 igun997

Hello, Could you submit a failing test case or some example code? If not, could you include the stack trace from the error message you're getting?

zulucrypto avatar Dec 02 '18 18:12 zulucrypto

object(ZuluCrypto\StellarSdk\Horizon\Api\PostTransactionResponse)#1120 (2) { ["result":protected]=> NULL ["rawData":protected]=> array(5) { ["type"]=> string(53) "https://stellar.org/horizon-errors/transaction_failed" ["title"]=> string(18) "Transaction Failed" ["status"]=> int(400) ["detail"]=> string(254) "The transaction failed when submitted to the stellar network. The extras.result_codes field on this response contains further details. Descriptions of each code can be found at: https://www.stellar.org/developers/learn/concepts/list-of-operations.html" ["extras"]=> array(3) { ["envelope_xdr"]=> string(296) "AAAAAGBWx7shjbaMGUKmWYFTE9CU26fo7fvr6SuuXfcb9PnzAAAAZAE+rzEAABEPAAAAAAAAAAAAAAABAAAAAAAAAAMAAAAAAAAAAUZSQVMAAAAAv9seiGU+uvrUiwQOmMXUulsVyvq7VcdWNFVlZgBMCBYAAAAAAJiWgAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAARv0+fMAAABAoWawAJ8MfdbZdl3mpL/3QpLBR+aDou865nEE8bS40r54NXd3T9x+CsAtK1VAZFF4YG05IgVWfm9V1UW/lAlrAg==" ["result_codes"]=> array(2) { ["transaction"]=> string(9) "tx_failed" ["operations"]=> array(1) { [0]=> string(12) "op_malformed" } } ["result_xdr"]=> string(44) "AAAAAAAAAGT/////AAAAAQAAAAAAAAAD/////wAAAAA=" } } }


This My Code $rs = $this->server->buildTransaction("XXXXX7GVGN") ->addOperation( new \ZuluCrypto\StellarSdk\XdrModel\Operation\ManageOfferOp( $this->counter, $this->base, 1, new \ZuluCrypto\StellarSdk\XdrModel\Price(1, 0.1) ) ) ->submit("XXXXX"); return $rs;

igun997 avatar Dec 03 '18 02:12 igun997

You're using a non-integer in new \ZuluCrypto\StellarSdk\XdrModel\Price(1, 0.1). Instead, you should adjust your numerator and denominator as follows:

new \ZuluCrypto\StellarSdk\XdrModel\Price(10, 1)

cballou avatar Dec 06 '19 01:12 cballou