Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Have assoc token creation where the mint is #18

Open
acamill opened this issue Oct 9, 2021 · 3 comments
Open

Have assoc token creation where the mint is #18

acamill opened this issue Oct 9, 2021 · 3 comments
Assignees
Labels
help wanted Extra attention is needed

Comments

@acamill
Copy link
Member

acamill commented Oct 9, 2021

If mint is owned by program, the account creation might make more sense to be there instead than in a local instruction.
coral-xyz/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],
    });
@acamill acamill self-assigned this Oct 9, 2021
@acamill acamill added the help wanted Extra attention is needed label Oct 9, 2021
@acamill
Copy link
Member Author

acamill commented Oct 23, 2021

Associated_token coral-xyz/anchor#790

And they recently added a init_when_needed or smthg like that that can be used too

@sjillen
Copy link

sjillen commented Nov 15, 2021

That would definitely make it easier to handle at least on the frontend side of things

@acamill
Copy link
Member Author

acamill commented Nov 15, 2021

Yes but we cannot use cause that would blow the computing budget iirc? Or these ix are accounted in the whole Tx? Forgot how it works exactly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants