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

Using payment operation with other asset, informing the amout

Open RASTecnoTI opened this issue 5 years ago • 2 comments

Hi

I tested the code and worked very well.

I would like to know if is possibile create one payment using um asset instead XLM (in my case called TREEP) and inform the amout to transfer? I tested using 04-submit-transaction.php

Like this:

image

Thank you!

RASTecnoTI avatar Jul 28 '20 18:07 RASTecnoTI

I guess that is this block

// Build the payment transaction $transaction = \ZuluCrypto\StellarSdk\Server::publicNet() ->buildTransaction($sourceKeypair->getPublicKey()) ->addOperation( PaymentOp::newNativePayment($destinationAccountId, 1) ) ;

RASTecnoTI avatar Jul 28 '20 18:07 RASTecnoTI

Good afternoon, I have the same problem, how should I do to inform a payment using TREEP, I am trying as I exercise below but I return error 504 $asset = Asset::newCustomAsset('TREEP', "GAVBWV24PZ6POVQGQO5UEWGO3TO7ERYXRFFI6V5VH3BMTPDZOHVOFA3G");

            $txEnvelope = $server->buildTransaction( $origem_keypar )
                                 ->setTextMemo($data['memorando'])
                                 ->addCustomAssetPaymentOp($asset,  $valor, $destino_keypar )
                                 ->getTransactionEnvelope();

$txEnvelope->sign($origem_keypar);

        $b64Tx = base64_encode($txEnvelope->toXdr());
        
        $return = $server->submitB64Transaction($b64Tx);

AgostinhoBarbosa avatar Aug 10 '20 15:08 AgostinhoBarbosa