Skip to content

Commit

Permalink
spl-token-cli now uses deployed spl-token 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mvines committed Aug 7, 2020
1 parent 3fed892 commit f0f0f50
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
2 changes: 1 addition & 1 deletion token-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ solana-cli-config = { version = "1.3.0" }
solana-client = { version = "1.3.0" }
solana-logger = { version = "1.3.0" }
solana-sdk = { version = "1.3.0" }
spl-token = { package = "spl-token", version = "1", path="../token" }
spl-token_1_0 = { package = "spl-token", version = "1.0", path="../deployed/token-1.0" }

# Workflow for developing against local Solana crates
#
Expand Down
33 changes: 17 additions & 16 deletions token-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ use solana_sdk::{
system_instruction,
transaction::Transaction,
};
use spl_token::{
use spl_token_1_0::{
self,
instruction::*,
native_mint,
ui_amount_to_amount,
state::{Account, Mint},
};
use std::{mem::size_of, process::exit};
Expand Down Expand Up @@ -91,10 +92,10 @@ fn command_create_token(config: &Config, decimals: u8) -> CommmandResult {
&token.pubkey(),
minimum_balance_for_rent_exemption,
size_of::<Mint>() as u64,
&spl_token::id(),
&spl_token_1_0::id(),
),
initialize_mint(
&spl_token::id(),
&spl_token_1_0::id(),
&token.pubkey(),
None,
Some(&config.owner.pubkey()),
Expand Down Expand Up @@ -132,10 +133,10 @@ fn command_create_account(config: &Config, token: Pubkey) -> CommmandResult {
&account.pubkey(),
minimum_balance_for_rent_exemption,
size_of::<Account>() as u64,
&spl_token::id(),
&spl_token_1_0::id(),
),
initialize_account(
&spl_token::id(),
&spl_token_1_0::id(),
&account.pubkey(),
&token,
&config.owner.pubkey(),
Expand Down Expand Up @@ -166,7 +167,7 @@ fn command_assign(config: &Config, account: Pubkey, new_owner: Pubkey) -> Commma

let mut transaction = Transaction::new_with_payer(
&[set_owner(
&spl_token::id(),
&spl_token_1_0::id(),
&account,
&new_owner,
&config.owner.pubkey(),
Expand Down Expand Up @@ -224,11 +225,11 @@ fn command_transfer(
exit(1)
}
};
let amount = spl_token::ui_amount_to_amount(ui_amount, decimals);
let amount = ui_amount_to_amount(ui_amount, decimals);

let mut transaction = Transaction::new_with_payer(
&[transfer(
&spl_token::id(),
&spl_token_1_0::id(),
&sender,
&recipient,
&config.owner.pubkey(),
Expand Down Expand Up @@ -264,11 +265,11 @@ fn command_burn(config: &Config, source: Pubkey, ui_amount: f64) -> CommmandResu
exit(1)
}
};
let amount = spl_token::ui_amount_to_amount(ui_amount, decimals);
let amount = ui_amount_to_amount(ui_amount, decimals);

let mut transaction = Transaction::new_with_payer(
&[burn(
&spl_token::id(),
&spl_token_1_0::id(),
&source,
&config.owner.pubkey(),
&[],
Expand Down Expand Up @@ -311,11 +312,11 @@ fn command_mint(
exit(1)
}
};
let amount = spl_token::ui_amount_to_amount(ui_amount, decimals);
let amount = ui_amount_to_amount(ui_amount, decimals);

let mut transaction = Transaction::new_with_payer(
&[mint_to(
&spl_token::id(),
&spl_token_1_0::id(),
&token,
&recipient,
&config.owner.pubkey(),
Expand Down Expand Up @@ -343,10 +344,10 @@ fn command_wrap(config: &Config, sol: f64) -> CommmandResult {
&account.pubkey(),
lamports,
size_of::<Account>() as u64,
&spl_token::id(),
&spl_token_1_0::id(),
),
initialize_account(
&spl_token::id(),
&spl_token_1_0::id(),
&account.pubkey(),
&native_mint::id(),
&config.owner.pubkey(),
Expand Down Expand Up @@ -380,7 +381,7 @@ fn command_unwrap(config: &Config, address: Pubkey) -> CommmandResult {

let mut transaction = Transaction::new_with_payer(
&[close_account(
&spl_token::id(),
&spl_token_1_0::id(),
&address,
&config.owner.pubkey(),
&config.owner.pubkey(),
Expand Down Expand Up @@ -421,7 +422,7 @@ fn command_accounts(config: &Config, token: Option<Pubkey>) -> CommmandResult {
&config.owner.pubkey(),
match token {
Some(token) => TokenAccountsFilter::Mint(token),
None => TokenAccountsFilter::ProgramId(spl_token::id()),
None => TokenAccountsFilter::ProgramId(spl_token_1_0::id()),
},
config.commitment_config,
)?
Expand Down

0 comments on commit f0f0f50

Please sign in to comment.