I have recently begun getting the below error when running the createMint
instruction from @solana/spl-token
. To my knowledge, I have not changed any code or dependencies that would affect this.
Example Code
import { PublicKey, Connection, Keypair } from "@solana/web3.js";
import * as spl from "@solana/spl-token";
export async function generateMint(
// I have confirmed that the authority exists and has sufficient funds (1 SOL)
authority: Keypair,
connection: Connection
): Promise<Keypair> {
const mint: Keypair = Keypair.generate();
try {
await spl.createMint(
connection,
authority,
authority.publicKey,
authority.publicKey,
MINT_DECIMALS9,
mint
);
} catch (e) {
console.trace(e)
throw e
}
return mint;
}
Error
Trace: SendTransactionError: failed to send transaction: Transaction simulation failed: Error processing Instruction 1: custom program error: 0xc
at Connection.sendEncodedTransaction (/path/to/node_modules/@solana/web3.js/src/connection.ts:5054:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at Connection.sendRawTransaction (/path/to/node_modules/@solana/web3.js/src/connection.ts:5013:20)
at Connection.sendTransaction (/path/to/node_modules/@solana/web3.js/src/connection.ts:5001:12)
at sendAndConfirmTransaction (/path/to/node_modules/@solana/web3.js/src/utils/send-and-confirm-transaction.ts:31:21) {
logs: [
'Program 11111111111111111111111111111111 invoke [1]',
'Program 11111111111111111111111111111111 success',
'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [1]',
'Program log: Error: Invalid instruction',
'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 796 of 1400000 compute units',
'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA failed: custom program error: 0xc'
]
}
Context
- OS Ubuntu 20.04.4 LTS (WSL 2)
- @project-serum/anchor: 0.25.0
- @solana/spl-token: 0.3.5
- invoking command:
anchor test
(==yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts
)