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

An account required by the instruction is missing #76

Open
oasisMystre opened this issue Jan 4, 2024 · 0 comments
Open

An account required by the instruction is missing #76

oasisMystre opened this issue Jan 4, 2024 · 0 comments

Comments

@oasisMystre
Copy link

SendTransactionError: failed to send transaction: Transaction simulation failed: Error processing Instruction 1: An account required by the instruction is missing
    at Connection.sendEncodedTransaction (C:\Users\DELL\code\workspace\nodejs\dinu\node_modules\.pnpm\@[email protected]\node_modules\@solana\web3.js\src\connection.ts:5922:13)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Connection.sendRawTransaction (C:\Users\DELL\code\workspace\nodejs\dinu\node_modules\.pnpm\@[email protected]\node_modules\@solana\web3.js\src\connection.ts:5881:20)
    at async Object.sendTransaction (C:\Users\DELL\code\workspace\nodejs\dinu\node_modules\.pnpm\@[email protected]_@[email protected]_@[email protected]\node_modules\@metaplex-foundation\umi-rpc-web3js\src\createWeb3JsRpc.ts:327:25)
    at async TransactionBuilder.sendAndConfirm (C:\Users\DELL\code\workspace\nodejs\dinu\node_modules\.pnpm\@[email protected]\node_modules\@metaplex-foundation\umi\src\TransactionBuilder.ts:359:23) { 
  logs: [
    'Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s invoke [1]',
    'Program log: IX: Create',
    'Program 11111111111111111111111111111111 invoke [2]',
    'Program 11111111111111111111111111111111 success',
    'Program 11111111111111111111111111111111 invoke [2]',
    'Program 11111111111111111111111111111111 success',
    'Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb invoke [2]',
    'Program log: Instruction: InitializeMintCloseAuthority',
    'Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb consumed 2504 of 380306 compute units',
    'Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb success',
    'Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb invoke [2]',
    'Program log: MetadataPointerInstruction::Initialize',
    'Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb consumed 2585 of 374917 compute units',
    'Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb success',
    'Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb invoke [2]',
    'Program log: Instruction: InitializeMint2',
    'Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb consumed 4078 of 369361 compute units',
    'Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb success',
    'Program log: Allocate space for the account',
    'Program 11111111111111111111111111111111 invoke [2]',
    'Program 11111111111111111111111111111111 success',
    'Program log: Assign the account to the owning program',
    'Program 11111111111111111111111111111111 invoke [2]',
    'Program 11111111111111111111111111111111 success',
    'Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s consumed 77939 of 400000 compute units',
    'Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s success',
    'Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s invoke [1]',
    'Program log: IX: Mint',
    'Instruction references an unknown account 3Pdu2nVsTUgFqaU8xzbDpSZUGAhzFpmwUm5MJok54mK4',
    'Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s consumed 29597 of 322061 compute units',
    'Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s failed: An account required by the instruction is 
missing'
  ]
}
import {
  mplTokenMetadata,
  TokenStandard,
  createAndMint,
  createV1,
  mintV1,
} from "@metaplex-foundation/mpl-token-metadata";

import { generateSigner, percentAmount, Umi } from "@metaplex-foundation/umi";
import { createUmi } from "@metaplex-foundation/umi-bundle-defaults";

import { Cluster, clusterApiUrl } from "@solana/web3.js";

import DinuConfig from "../dinu.json";
import { DINU_METADATA_URI, SPL_TOKEN_2022_PROGRAM_ID } from "./constants";

type CreateTokenInput = Omit<
  Parameters<typeof createAndMint>[1],
  | "mint"
  | "decimals"
  | "tokenStandard"
  | "sellerFeeBasisPoints"
  | "splTokenProgram"
>;

export default class DinuContract {
  readonly umi: Umi;

  constructor(cluster: Cluster) {
    this.umi = createUmi(clusterApiUrl(cluster)).use(mplTokenMetadata());
  }

  async createToken(input: CreateTokenInput) {
    const mint = generateSigner(this.umi);

    await createAndMint(this.umi, {
      mint,
      decimals: 6,
      authority: this.umi.identity,
      tokenOwner: this.umi.identity.publicKey,
      tokenStandard: TokenStandard.Fungible,
      sellerFeeBasisPoints: percentAmount(0),
      splTokenProgram: SPL_TOKEN_2022_PROGRAM_ID,
      ...input,
    }).sendAndConfirm(this.umi);

    return mint;
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant