-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcreate_mint.rs
More file actions
29 lines (25 loc) · 949 Bytes
/
create_mint.rs
File metadata and controls
29 lines (25 loc) · 949 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use light_client::rpc::Rpc;
use light_token_client::actions::{CreateMint, TokenMetadata};
use rust_client::setup_rpc_and_payer;
use solana_sdk::signer::Signer;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let (mut rpc, payer) = setup_rpc_and_payer().await;
let (signature, mint) = CreateMint {
decimals: 9,
freeze_authority: None,
token_metadata: Some(TokenMetadata {
name: "Example Token".to_string(),
symbol: "EXT".to_string(),
uri: "https://example.com/metadata.json".to_string(),
update_authority: Some(payer.pubkey()),
additional_metadata: Some(vec![("type".to_string(), "example".to_string())]),
}),
seed: None,
}
.execute(&mut rpc, &payer, &payer)
.await?;
let data = rpc.get_account(mint).await?;
println!("Mint: {mint} exists: {} Tx: {signature}", data.is_some());
Ok(())
}