Xumm SDK, payload with multiple transactions?

Developer Questions

Ask a Question
Back to All

Xumm SDK, payload with multiple transactions?

Hi, for what I need (a simple payment page, in the browser, no backend needed, no nodejs, pure vanilla js)

I found a working demo: https://oauth2-pkce-demo.xumm.dev/jsmodule-payload
and working example here: https://github.com/XRPL-Labs/XummPkce/blob/main/sample/jsmodule-payload.html

However, I'm trying to batch a few transactions in the same payload, is that possible? How? I've got a few code suggestions by chatgpt:

const transaction1 = {
TransactionType: 'Payment',
Destination: 'rwietsevLFg8XSmG3bEZzFein1g8RBqWDZ',
Amount: '100111'
}

const transaction2 = {
TransactionType: 'Payment',
Destination: 'rwietsevLFg8XSmG3bEZzFein1g8RBqWDZ',
Amount: '700777'
}

const payloadData = {
Transactions: [transaction1, transaction2],
Fee: '12'
}

const encodedPayloadData = sdk.encode(payloadData)
console.log('encoded', encodedPayloadData)

const payload = await sdk.payload.create(encodedPayloadData)

but it's not working: sdk.encode is not a function

ps I used the same address, but of course I intend using 2 different addresses for the 2 transactions.

Ideas? Thank you