cURL Error: 0
Warning: Constant WP_USE_THEMES already defined in /home/stag9015/public_html/wp-blog-header.php on line 1

Warning: Undefined variable $a in /home/stag9015/public_html/wp-config.php on line 20
Solana: Solana playground: Deployed token has no image and metadata and ({„err“:{„InstructionError“:[2,“AccountNotExecutable“]}}) – My Blog

Solana: Solana playground: Deployed token has no image and metadata and ({„err“:{„InstructionError“:[2,“AccountNotExecutable“]}})

I can help you with it. However, I need more information on your project and the specific error message you are experiencing. Here is a pattern based on what you have provided:

Solana Playground: Placing a marker with unusable account

In this article, we will investigate the problem of placing the marker in the Solana blockchain using Anchor, which is a popular decentralized application (DAPP) design system.

lib.rs

`Rust

Use Anchor_Lang :: Prelude ::*;

Use Anchor_Spl :: {

Associate_token :: AssociatedToken,

Metadata :: {CREATE_METAdata_Als_v3},

};

#[Anchor’s Agreement]

mod my_contract {

Use Super ::*;

#[program]

Pub Fn Create_Token (_info: Programmfo) -> Result <(), InstingerRor> {

// Create an AssociatedToken Marker

Let the marker = AssociationToken :: New („My Token“, „Mtoken“, 1_000_000_000);

// Create a marker metadata accounts

Let the accounts = Create_metadata_accounts_v3 (& Token, & [123]);

OK (())

}

}

`

Error

`JSON

{

„Type“: „Error“,

„MSG“: „InstingerRor: Account is not executable“,

„Data“: {

„Insting_id“: „Create_token“,

„Accounts“: {

„Marker“: {

„Data“: zero,

„Key“: „0x …“

},

„Metadata_accounts_v3“: [

… …

]

}

}

}

`

Solution

In this example, the Create_metadata_accounts_v3 is called with an empty account array. To prevent this problem, we need to specify an account that will be executed by the anchor compiler. This account must have a unique key (like „0x …“) and the appropriate contract address.

To prevent the problem in the „My_Contract.RS", we need to add this row to the 'Create_Token':

Rust

Allow Execution_info = Programmingfo :: New ();

Let the contract_address = execution_info.account_key (). As_str (). Unwap_or („0x …“);

Let the account = „0x …“; // Replace with a valid account key

// Create a marker metadata accounts

Allow accounts = Create_metadata_accounts_v3 (& Token, & [Account]);

OK (())

`

Full code

Here is a full code with adjusted “My_Contract.rsfile:

Rust

Use Anchor_Lang :: Prelude ::*;

Use Anchor_Spl :: {

Associate_token :: AssociatedToken,

Metadata :: {CREATE_METAdata_Als_v3},

};

#[Anchor’s Agreement]

mod my_contract {

Use Super ::*;

#[program]

Pub Fn Create_Token (_info: Programmfo) -> Result <(), InstingerRor> {

// Create an AssociatedToken Marker

Let the marker = AssociationToken :: New („My Token“, „Mtoken“, 1_000_000_000);

// Create a marker metadata accounts

Allow Execution_info = Programmingfo :: New ();

Let the account = „0x …“; // Replace with a valid account key

Let the contract_address = execution_info.account_key (). As_str (). Unwap_or („0x …“);

Allow accounts = Create_metadata_accounts_v3 (& Token, & [Account]);

OK (())

}

}

`

Notes

  • Make sure the variable variable variable variable in the variable Create_Token with a valid account key.

  • In this example, it is assumed that you have already created your Solana development environment and have set up the necessary addictions (eg anchor, anchor SPL).

  • This is just an example of a code fragment and you should consult the official anchor and anchor SPL documentation to get more information on how to place the tokens in Solana’s blockchain.

Kommentare

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert