One of the argument for my smart contract function is vec how do I pass this data type from my frontend using solana-web3js


1 Answer 1


you can pass them in the remaining_accounts

Remaining accounts given but not deserialized or validated. Be very careful when using this directly.


let accounts = ctx.remaining_accounts;


what you need is .remainingAccounts([])

    const tx = await program.methods
      .Initialize(new anchor.BN(10000000))
        [{ pubkey: payer.publicKey, isWritable: false, isSigner: false }],
        payer: payer.publickey,
        systemProgram: anchor.web3.SystemProgram.programId,
        tokenProgram: splToken.TOKEN_PROGRAM_ID,
    console.log('Your transaction signature', tx);

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.