2
Object literal may only specify known properties and 'vestingAccount' does not exist in type 'ResolvedAccounts<{ name: "signer"; writable: true; signer: true; } | { name: "vestingAccount"; writable: true; pda: { seeds: [{ kind: "arg"; path: "companyName"; }]; }; } | { name: "mint"; } | { name: "treasuryTokenAccount"; writable: true; pda: { ...; }; } | { ...; } | { ...; } | { ...; }>'.

The fix for this is just explicitly stating the account object but curious is there is a better solution:

 const accounts = {
    vestingAccount: vestingAccountAddress,
    treasuryAccount: treasuryAccountAddress,
    mint: new PublicKey(tokenMintAddress),
    tokenProgram: token.TOKEN_PROGRAM_ID,
  };

  return program.methods
    .createVestingAccount(companyName)
    .accounts(accounts)
    .rpc();

2 Answers 2

4

A similar question and its answer can be found here: https://solana.stackexchange.com/a/14345

Tip: You can press CTRL+Space (CMD+Space in macOS), in your code editor when your cursor is inside accounts({...}) call to easily see which accounts are required.

0

What if you do:

return program.methods.createVestingAccount(companyName).accountsPartial({"your accounts"}).rpc();

accountsPartial should let you specify all the accounts, while accounts will now "complain" about the resolvable ones

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.