Skip to content

Have assoc token creation where the mint is #18

Description

@acamill

If mint is owned by program, the account creation might make more sense to be there instead than in a local instruction.
otter-sec/anchor#790

We already mentionned it, not sure what's best

    // XXX this may make sense to be in the program 
    const ix = createAssocTokenIx(wallet, userBTCDepositoryRedeemableTokenAccount, depositoryBTC.redeemableMintPda);
    await Depository.rpc.deposit(depositAmountBTC, {
      accounts: {
        user: wallet.publicKey,
        state: depositoryBTC.statePda,
        programCoin: depositoryBTC.depositPda,
        redeemableMint: depositoryBTC.redeemableMintPda,
        userCoin: userBTCTokenAccount,
        userRedeemable: userBTCDepositoryRedeemableTokenAccount,
        systemProgram: SystemProgram.programId,
        tokenProgram: TOKEN_PROGRAM_ID,
      },
      signers: [wallet.payer],
      options: TXN_OPTS,
      instructions: [ix],
    });

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

help wantedExtra attention is needed

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions