I'm following along with this site https://www.soldev.app/course/token-swap.
However, there seems to be a version difference in the use of TokenSwap.withdrawAllTokenTypesInstruction: I'm using the latest version (0.4.0), but above site is using 0.1.3.
The difference is that the arguments for the withdrawAllTokenTypesInstruction are different, and in my version(0.4.0):
static depositAllTokenTypesInstruction(
tokenSwap: PublicKey,
authority: PublicKey,
userTransferAuthority: PublicKey,
sourceA: PublicKey,
sourceB: PublicKey,
intoA: PublicKey,
intoB: PublicKey,
poolToken: PublicKey,
poolAccount: PublicKey,
mintA: PublicKey,
mintB: PublicKey,
swapProgramId: PublicKey,
tokenProgramIdA: PublicKey,
tokenProgramIdB: PublicKey,
poolTokenProgramId: PublicKey,
poolTokenAmount: bigint,
maximumTokenA: bigint,
maximumTokenB: bigint,
)
and my guess is that the argument "poolTokenProgramId" is incorrect, I used TOKEN_PROGRAM_ID(TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA) for that argument, but I am getting an error.
What should I put as the value of poolTokenProgramId?
This is my code
const depositIx = TokenSwap.depositAllTokenTypesInstruction(
tokenSwapStateAccount,
swapAuthority,
publicKey,
kryptATA,
scroogeATA,
poolKryptAccount,
poolScroogeAccount,
poolMint,
tokenAccountPool,
kryptMint,
ScroogeCoinMint,
TOKEN_SWAP_PROGRAM_ID,
token.TOKEN_PROGRAM_ID,
token.TOKEN_PROGRAM_ID,
token.TOKEN_PROGRAM_ID,
poolTokenAmount * 10 ** poolMintInfo.decimals,
100e9,
100e9,
);
and this is error code
client.js:1 WalletSendTransactionError: failed to send transaction: Transaction simulation failed: Error processing Instruction 1: incorrect program id for instruction
at StandardWalletAdapter.sendTransaction (adapter.js:205:1)
at async eval (WalletProviderBase.js:152:1) StandardWalletAdapter {_events: Events, _eventsCount: 4, signTransaction: ƒ, signAllTransactions: ƒ, signMessage: ƒ}