Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
182 changes: 5 additions & 177 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions p-token/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ solana-signer = "2.2.1"
solana-transaction = "2.2.3"
solana-transaction-error = "2.2.1"
solana-system-interface = { workspace = true }
spl-token = { version="^8", features=["no-entrypoint"] }
spl-token-2022 = { version="^9", features=["no-entrypoint"] }
spl-token-interface = "1"
spl-token-2022-interface = "1"

[lints]
workspace = true
19 changes: 14 additions & 5 deletions p-token/tests/amount_to_ui_amount.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@ async fn amount_to_ui_amount() {
.await
.unwrap();

let amount_to_ui_amount_ix =
spl_token::instruction::amount_to_ui_amount(&spl_token::ID, &mint, 1000).unwrap();
let amount_to_ui_amount_ix = spl_token_interface::instruction::amount_to_ui_amount(
&spl_token_interface::ID,
&mint,
1000,
)
.unwrap();

let tx = Transaction::new_signed_with_payer(
&[amount_to_ui_amount_ix],
Expand Down Expand Up @@ -70,7 +74,8 @@ fn amount_to_ui_amount_with_maximum_decimals() {
// succeed and return the correct UI amount.

let instruction =
spl_token::instruction::amount_to_ui_amount(&spl_token::ID, &mint, 20).unwrap();
spl_token_interface::instruction::amount_to_ui_amount(&spl_token_interface::ID, &mint, 20)
.unwrap();

// The expected UI amount is "0.000....002" without the trailing zeros.
let mut ui_amount = [b'0'; u8::MAX as usize + 1];
Expand Down Expand Up @@ -102,8 +107,12 @@ fn amount_to_ui_amount_with_u64_max() {
// When we convert an u64::MAX amount using the mint, the transaction should
// succeed and return the correct UI amount.

let instruction =
spl_token::instruction::amount_to_ui_amount(&spl_token::ID, &mint, u64::MAX).unwrap();
let instruction = spl_token_interface::instruction::amount_to_ui_amount(
&spl_token_interface::ID,
&mint,
u64::MAX,
)
.unwrap();

// The expected UI amount is a `u64::MAX` with 255 decimal places.
// - 2 digits for `0.`
Expand Down
6 changes: 3 additions & 3 deletions p-token/tests/approve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ async fn approve() {

let delegate = Pubkey::new_unique();

let approve_ix = spl_token::instruction::approve(
&spl_token::ID,
let approve_ix = spl_token_interface::instruction::approve(
&spl_token_interface::ID,
&account,
&delegate,
&owner.pubkey(),
Expand All @@ -77,7 +77,7 @@ async fn approve() {
assert!(account.is_some());

let account = account.unwrap();
let account = spl_token::state::Account::unpack(&account.data).unwrap();
let account = spl_token_interface::state::Account::unpack(&account.data).unwrap();

assert!(account.delegate.is_some());
assert!(account.delegate.unwrap() == delegate);
Expand Down
4 changes: 2 additions & 2 deletions p-token/tests/approve_checked.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ async fn approve_checked() {

let delegate = Pubkey::new_unique();

let approve_ix = spl_token::instruction::approve_checked(
let approve_ix = spl_token_interface::instruction::approve_checked(
&TOKEN_PROGRAM_ID,
&account,
&mint,
Expand All @@ -79,7 +79,7 @@ async fn approve_checked() {
assert!(account.is_some());

let account = account.unwrap();
let account = spl_token::state::Account::unpack(&account.data).unwrap();
let account = spl_token_interface::state::Account::unpack(&account.data).unwrap();

assert!(account.delegate.is_some());
assert!(account.delegate.unwrap() == delegate);
Expand Down
Loading