suiet icon indicating copy to clipboard operation
suiet copied to clipboard

[WALLET.SIGN_TX_ERROR] Error: Transaction execution failed due to issues with transaction inputs, please review the errors and try again

Open CocDap opened this issue 1 year ago • 3 comments

Hi team!

Context I have successfully implemented transaction calls for each element in an array using the KeyPair Signer. You can review the working implementation in my script here: https://github.com/plats-network/SUI-hackathon/blob/feat/update-script/contracts/scripts/batch-mint.js#L20.

Issue However, I'm encountering difficulties when attempting to replicate this functionality using the Suiet Wallet Extension.

Error

Uncaught (in promise) Error: [WALLET.SIGN_TX_ERROR] Error: Transaction execution failed due to issues with transaction inputs, please review the errors and try again: Object (0x2587305d59dbcc09406e1ef0147053fff3019a64aca312108adac2913785a6d0, SequenceNumber(1115161), o#8T2opWgGi2rz3KxFKKG67f8rxTb1W1eoxFf1WUqdPAiZ) is not available for consumption, its current version: SequenceNumber(1115162)..

CocDap avatar Apr 17 '24 09:04 CocDap

Hi CocDap, thanks for reporting. The error seems at the contract level where the version of the contract object you called mismatches with the current version of the contract object, i.e. 1115161 < 1115162. It seems nothing to do with the wallet signing. Can you double check the objectId if it is the latest?

bruceeewong avatar Apr 17 '24 12:04 bruceeewong

hi @bruceeewong . thanks for replying me. Do we have any methods to run multiple transactions ( batch transaction in 1 block) in one time ?

CocDap avatar Apr 19 '24 11:04 CocDap

This is my sample code

    async function mintNft(event) {
        event.preventDefault();
        let txs = [];
        const tx = new TransactionBlock();
        tx.moveCall({
            target: `${contractAddress}::${contractModule}::${contractMethod}`,
            arguments: [
                // collection object id
                //tx.object('0x0d6422b82f418e592546019b81585963300f2f29acb86a281e5add34f3388c7d'),
                // tx.object(collectionId),
                // event_id
                tx.pure("8ba9148d4e85e4a6862e8fa613f6cf6b"),
                // name: vector<u8>,
                tx.pure("SUI Hackathon"),
                // description: vector<u8>,
                tx.pure("This is a ticket yo join SUI Hackathon"),
                // url: vector<u8>,
                tx.pure("https://picsum.photos/id/237/200/300"),
                // catogory: vector<u8>,
                tx.pure("Standard"),
                // max_supply: u64,
                tx.pure(1),
            ],
            // typeArguments: [`${contractAddress}::ticket_collection::NFTTicket`]
        });
        txs.push(tx);
        const tx2 = new TransactionBlock();
        tx2.moveCall({
            target: `${contractAddress}::${contractModule}::${contractMethod}`,
            arguments: [
                // collection object id
                //tx.object('0x0d6422b82f418e592546019b81585963300f2f29acb86a281e5add34f3388c7d'),
                // tx2.object(collectionId),
                // event_id
                tx.pure("8ba9148d4e85e4a6862e8fa613f6cf6b"),
                // name: vector<u8>,
                tx2.pure("SUI Hackathon 1"),
                // description: vector<u8>,
                tx2.pure("This is a ticket VIP yo join SUI Hackathon"),
                // url: vector<u8>,
                tx2.pure("https://picsum.photos/id/237/200/300"),
                // catogory: vector<u8>,
                tx2.pure("VIP"),
                // max_supply: u64,
                tx2.pure(1),
            ],
            // typeArguments: [`${contractAddress}::ticket_collection::NFTTicket`]
        });

        txs.push(tx2);

        for (const tx of txs) {
            const result = await wallet.signAndExecuteTransactionBlock({
                transactionBlock: tx,
                options: {
                    showObjectChanges: true,
                },
                //requestTypes:'WaitForEffectsCert'
            });

            console.log({ result });
            const ticketIds =
                result.objectChanges.filter(
                    (o) =>
                        o.type === "created" &&
                        o.objectType.includes("::ticket_collection::NFTTicket")
                ).map(item => item.objectId);
            console.log(`ticket id : ${ticketIds}`);
            await sleep(2000);
        }
        async function sleep(ms) {
            return new Promise((resolve) => setTimeout(resolve, ms));
        }

    }

It was working when I run a script . But I am unable to run when integrating with wallet

CocDap avatar Apr 19 '24 11:04 CocDap