2

I want to create a transaction with a memo, but i keep getting error

this.memo.toXDRObject is not a function at TransactionBuilder.build

code:

    let fee = await get_mining_fee();

    const txOpts = {
        fee:fee,
        //memo : t.memo,
        networkPassphrase : get_stellar_network_from_env()
    }
    

    const payment = {
        destination : address,
        asset : Stellar.Asset.native(),
        amount : amount+""
    }
    console.log(payment)
    const stellar_transaction = new Stellar.TransactionBuilder(our_account , txOpts)
        .addMemo(t.memo)
        .addOperation(Stellar.Operation.payment(payment))
        .setTimeout(Stellar.TimeoutInfinite)
        .build();

        stellar_transaction.sign(Stellar.Keypair.fromSecret(get_our_xlm_private_key()));

        await StellarServer.submitTransaction(stellar_transaction);

I tried putting memo in txOpts and i get the same error. How do i add memo to transaction ocrrectly? If i omit memo field then transaction succeeds. t.memo is a string.

1 Answer 1

0
.addMemo(t.memo)

was changed to

.addMemo(StellarSdk.Memo.text(t.memo))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.