solana/web3.js TransactionMessage issue with payerKey. TypeError: pubkey.toBase58 is not a function

91 views Asked by At

got a problem with this part of the code

const messageV0 = new TransactionMessage({
    payerKey: wallet.publicKey,
    recentBlockhash: latestBlockhash.blockhash,
    instructions: insts
  }).compileToV0Message([lookupTable]);

And the error is

C:\Users\path\node_modules\@solana\web3.js\src\message\compiled-keys.ts:31
      const address = pubkey.toBase58();
                             ^
TypeError: pubkey.toBase58 is not a function
    at getOrInsertDefault (C:\Users\path\node_modules\@solana\web3.js\src\message\compiled-keys.ts:31:30)
    at Function.compile (C:\Users\path\node_modules\@solana\web3.js\src\message\compiled-keys.ts:44:26)
    at Function.compile (C:\Users\path\node_modules\@solana\web3.js\src\message\v0.ts:188:39)
    at TransactionMessage.compileToV0Message (C:\Users\path\node_modules\@solana\web3.js\src\transaction\message.ts:133:22)
    at C:\Users\path\src\create.ts:185:6
    at Generator.next (<anonymous>)
    at fulfilled (C:\Users\path\src\create.ts:28:58)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)

As i understand it's saying that my payerKey is not publickey even tho it is.

I have tried to convert it to base58 and back to publicKey which didn't work, also just tried to give it the whole wallet which ofc didn't work either and I have no more ideas what to do. Before arriving here tried to google a lot but got nothing.

Also this same wallet variable is used before this many times before it reaches this point in code and no issues there but for some reason TransactionMessage has an issue with it.

0

There are 0 answers