Having trouble adding a memo to a wallet generated on the Stellar network, encountering an XDR write error in the SDK.
Error stack trace:
TypeError: XDR Write Error: [object Object] is not a Memo
at Function.write (webpack://WalletSDK/node_modules/@stellar/js-xdr/src/union.js:85:1)
at Function.write (webpack://WalletSDK/node_modules/@stellar/js-xdr/src/struct.js:31:1)
at Function.write (webpack://WalletSDK/node_modules/@stellar/js-xdr/src/union.js:88:1)
at Function.write (webpack://WalletSDK/node_modules/@stellar/js-xdr/src/struct.js:31:1)
at Function.toXDR (webpack://WalletSDK/node_modules/@stellar/js-xdr/src/xdr-type.js:57:1)
at ChildStruct.toXDR (webpack://WalletSDK/node_modules/@stellar/js-xdr/src/xdr-type.js:12:1)
at Transaction.signatureBase (webpack://WalletSDK/node_modules/@stellar/stellar-base/lib/transaction.js:293:1)
at Transaction.hash (webpack://WalletSDK/node_modules/@stellar/stellar-base/lib/transaction_base.js:224:1)
at Transaction.sign (webpack://WalletSDK/node_modules/@stellar/stellar-base/lib/transaction_base.js:88:1)
at SigningKeypair.__webpack_modules__../src/walletSdk/Horizon/Account.ts.exports.SigningKeypair.SigningKeypair.sign (webpack://WalletSDK/src/walletSdk/Horizon/Account.ts:64:1)
Code:
const createTxn = txBuilder
.createAccount(createdAccountKeyPair)
.setMemo(new Memo(MemoText, 'test-memo'))
.build();
const signed = sponsorSigningKeyPair.sign(createTxn);
Imports used:
import { Memo, xdr, MemoText } from '@stellar/stellar-sdk';
import {
StellarConfiguration,
Wallet,
Keypair,
AccountKeypair,
IssuedAssetId,
PublicKeypair,
SigningKeypair,
NativeAssetId,
} from '@stellar/typescript-wallet-sdk';
Versions:
"@stellar/stellar-sdk": "^12.1.0",
"@stellar/typescript-wallet-sdk": "^1.7.0",
Input provided:
const createTxn = txBuilder
.createAccount(createdAccountKeyPair)
.setMemo(new Memo(MemoText, 'test-memo'))
.build();
const signed = sponsorSigningKeyPair.sign(createTxn);