0

I'm having issues adding multiple instructions to the builder with a loop.

for (let token of selectedTokens) {

            ...

            const burnIx = burn(umi, {
                ...assetWithProof,
                leafOwner: publicKey(walletPubKey),
            });

            builder.add(burnIx);
        }

When i log the burnIx to the console it's okay, but after the loop if i log the builder the items array is empty.

1 Answer 1

1

you need to reassign the builder. e.g. (untested)

let builder = new TransactionBuilder();
for (let token of selectedTokens) {
  const burnIx = burn(umi, {
    ...assetWithProof,
    leafOwner: publicKey(walletPubKey),
    });
  builder = builder.add(burnIx);
}
1
  • This is the solution, thanks!
    – DRUEVISUAL
    Commented Oct 15 at 10:48

Your Answer

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

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