jtordgeman / transfer-hook-whale-helpers

2 stars 1 forks source link

Some hiccups following the tutorial #1

Open 0xJamesBong opened 2 weeks ago

0xJamesBong commented 2 weeks ago

I've been playing around with this repo and the transfer-hook-whale repo by following this tutorial

it seems to me that in the initialize.ts one has to replace the .accounts({...}) with .accountsPartial({...})

const initializeExtraAccountMetaListInstruction = await program.methods
    .initializeExtraAccount()
    .accountsPartial({
      mint,
      extraAccountMetaList: extraAccountMetaListPDA,
      latestWhaleAccount: whalePDA,
      systemProgram: anchor.web3.SystemProgram.programId,
      tokenProgram: TOKEN_2022_PROGRAM_ID,
      associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ID,

  }) 

But then after having moved the idl and the TransferHookWhale.tsx, when I run the command yarn run initialize, I keep running into either the following error

  Transaction failed SendTransactionError: Simulation failed. 
Message: Transaction simulation failed: This program may not be used for executing instructions. 

or this error

transactionMessage: 'Transaction simulation failed: Error processing Instruction 0: custom program error: 0xbbf',
  transactionLogs: [
    'Program 244EM5zhvzwakH6DpKVPUaWqEN7rwUeMhoyfc8UjPgFb invoke [1]',
    'Program log: Instruction: InitializeExtraAccount',
    'Program log: AnchorError caused by account: mint. Error Code: AccountOwnedByWrongProgram. Error Number: 3007. Error Message: The given account is owned by a different program than expected.',
    'Program 244EM5zhvzwakH6DpKVPUaWqEN7rwUeMhoyfc8UjPgFb consumed 6176 of 200000 compute units',
    'Program 244EM5zhvzwakH6DpKVPUaWqEN7rwUeMhoyfc8UjPgFb failed: custom program error: 0xbbf'
  ]

This happens when I try to replace the address in the Itransfer_hook_whale.json and the transfer_hook_whale.ts with the program-id or the address of the deployed contract.

I would really appreciate if I can be offered some help! Thanks so much!

gogorush commented 2 hours ago
const initializeExtraAccountMetaListInstruction = await program.methods
    .initializeExtraAccount()
    .accounts({
        payer: wallet.publicKey,
        mint,
        extraAccountMetaList: extraAccountMetaListPDA,
        latestWhaleAccount: whalePDA,
        systemProgram: anchor.web3.SystemProgram.programId,
        tokenProgram: TOKEN_2022_PROGRAM_ID,
        associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ID,
    })
    .instruction();

for the tutorial I run into problems : `TSError: ⨯ Unable to compile TypeScript: client/client.ts:44:13 - error TS2353: Object literal may only specify known properties, and 'extraAccountMetaList' does not exist in type 'ResolvedAccounts<{ name: "payer"; writable: true; signer: true; } | { name: "extraAccountMetaList"; writable: true; pda: { seeds: [{ kind: "const"; value: [101, 120, 116, 114, 97, 45, 97, 99, 99, 111, 117, ... 7 more ..., 115]; }, { ...; }]; }; } | ... 4 more ... | { ...; }>'.

44 extraAccountMetaList: extraAccountMetaListPDA,



    at createTSError (/Users/hou/Documents/workspace/rust/transfer-hook-whale/node_modules/ts-node/src/index.ts:859:12)
    at reportTSError (/Users/hou/Documents/workspace/rust/transfer-hook-whale/node_modules/ts-node/src/index.ts:863:19)
    at getOutput (/Users/hou/Documents/workspace/rust/transfer-hook-whale/node_modules/ts-node/src/index.ts:1077:36)
    at Object.compile (/Users/hou/Documents/workspace/rust/transfer-hook-whale/node_modules/ts-node/src/index.ts:1433:41)
    at Module.m._compile (/Users/hou/Documents/workspace/rust/transfer-hook-whale/node_modules/ts-node/src/index.ts:1617:30)
    at Module._extensions..js (node:internal/modules/cjs/loader:1518:10)
    at Object.require.extensions.<computed> [as .ts] (/Users/hou/Documents/workspace/rust/transfer-hook-whale/node_modules/ts-node/src/index.ts:1621:12)
    at Module.load (node:internal/modules/cjs/loader:1249:32)
    at Function.Module._load (node:internal/modules/cjs/loader:1065:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:158:12) {
  diagnosticCodes: [ 2353 ]
}`
Any ideas about it? Which is different from yours. @0xJamesBong