token-client: clean up useless temp vecs
This commit is contained in:
parent
a5a565b56c
commit
51f5e93e4e
|
@ -542,7 +542,7 @@ where
|
|||
)?,
|
||||
];
|
||||
|
||||
self.process_ixs(&instructions, &vec![account]).await
|
||||
self.process_ixs(&instructions, &[account]).await
|
||||
}
|
||||
|
||||
/// Get the address for the associated token account.
|
||||
|
@ -616,7 +616,7 @@ where
|
|||
owner,
|
||||
)?);
|
||||
|
||||
self.process_ixs(&instructions, &vec![account]).await
|
||||
self.process_ixs(&instructions, &[account]).await
|
||||
}
|
||||
|
||||
/// Retrieve a raw account
|
||||
|
|
|
@ -159,7 +159,7 @@ async fn set_authority() {
|
|||
&alice_vault,
|
||||
&mint_authority.pubkey(),
|
||||
1,
|
||||
&vec![&mint_authority],
|
||||
&[&mint_authority],
|
||||
)
|
||||
.await
|
||||
.expect("failed to mint token");
|
||||
|
@ -188,7 +188,7 @@ async fn set_authority() {
|
|||
&alice_vault,
|
||||
&mint_authority.pubkey(),
|
||||
2,
|
||||
&vec![&mint_authority]
|
||||
&[&mint_authority]
|
||||
)
|
||||
.await
|
||||
.is_err());
|
||||
|
@ -240,7 +240,7 @@ async fn mint_to() {
|
|||
&alice_vault,
|
||||
&mint_authority.pubkey(),
|
||||
mint_amount,
|
||||
&vec![&mint_authority],
|
||||
&[&mint_authority],
|
||||
)
|
||||
.await
|
||||
.expect("failed to mint token");
|
||||
|
@ -287,7 +287,7 @@ async fn transfer() {
|
|||
&alice_vault,
|
||||
&mint_authority.pubkey(),
|
||||
mint_amount,
|
||||
&vec![&mint_authority],
|
||||
&[&mint_authority],
|
||||
)
|
||||
.await
|
||||
.expect("failed to mint token");
|
||||
|
@ -299,7 +299,7 @@ async fn transfer() {
|
|||
&bob_vault,
|
||||
&alice.pubkey(),
|
||||
transfer_amount,
|
||||
&vec![&alice],
|
||||
&[&alice],
|
||||
)
|
||||
.await
|
||||
.expect("failed to transfer");
|
||||
|
|
|
@ -36,26 +36,26 @@ async fn run_basic(context: TestContext) {
|
|||
&alice_account,
|
||||
&mint_authority.pubkey(),
|
||||
amount,
|
||||
&vec![&mint_authority],
|
||||
&[&mint_authority],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
// unchecked is ok
|
||||
token_unchecked
|
||||
.burn(&alice_account, &alice.pubkey(), 1, &vec![&alice])
|
||||
.burn(&alice_account, &alice.pubkey(), 1, &[&alice])
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
// checked is ok
|
||||
token
|
||||
.burn(&alice_account, &alice.pubkey(), 1, &vec![&alice])
|
||||
.burn(&alice_account, &alice.pubkey(), 1, &[&alice])
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
// burn too much is not ok
|
||||
let error = token
|
||||
.burn(&alice_account, &alice.pubkey(), amount, &vec![&alice])
|
||||
.burn(&alice_account, &alice.pubkey(), amount, &[&alice])
|
||||
.await
|
||||
.unwrap_err();
|
||||
assert_eq!(
|
||||
|
@ -70,7 +70,7 @@ async fn run_basic(context: TestContext) {
|
|||
|
||||
// wrong signer
|
||||
let error = token
|
||||
.burn(&alice_account, &bob.pubkey(), 1, &vec![&bob])
|
||||
.burn(&alice_account, &bob.pubkey(), 1, &[&bob])
|
||||
.await
|
||||
.unwrap_err();
|
||||
assert_eq!(
|
||||
|
@ -128,20 +128,20 @@ async fn run_self_owned(context: TestContext) {
|
|||
&alice_account,
|
||||
&mint_authority.pubkey(),
|
||||
amount,
|
||||
&vec![&mint_authority],
|
||||
&[&mint_authority],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
// unchecked is ok
|
||||
token_unchecked
|
||||
.burn(&alice_account, &alice.pubkey(), 1, &vec![&alice])
|
||||
.burn(&alice_account, &alice.pubkey(), 1, &[&alice])
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
// checked is ok
|
||||
token
|
||||
.burn(&alice_account, &alice.pubkey(), 1, &vec![&alice])
|
||||
.burn(&alice_account, &alice.pubkey(), 1, &[&alice])
|
||||
.await
|
||||
.unwrap();
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ async fn run_burn_and_close_system_or_incinerator(context: TestContext, non_owne
|
|||
&alice_account,
|
||||
&mint_authority.pubkey(),
|
||||
1,
|
||||
&vec![&mint_authority],
|
||||
&[&mint_authority],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -207,7 +207,7 @@ async fn run_burn_and_close_system_or_incinerator(context: TestContext, non_owne
|
|||
&non_owner_account,
|
||||
&alice.pubkey(),
|
||||
1,
|
||||
&vec![&alice],
|
||||
&[&alice],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -235,7 +235,7 @@ async fn run_burn_and_close_system_or_incinerator(context: TestContext, non_owne
|
|||
|
||||
// but anyone can burn it
|
||||
token
|
||||
.burn(&non_owner_account, &carlos.pubkey(), 1, &vec![&carlos])
|
||||
.burn(&non_owner_account, &carlos.pubkey(), 1, &[&carlos])
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
|
|
|
@ -182,7 +182,7 @@ impl ConfidentialTokenAccountMeta {
|
|||
&meta.token_account,
|
||||
&mint_authority.pubkey(),
|
||||
amount,
|
||||
&vec![mint_authority],
|
||||
&[mint_authority],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -494,7 +494,7 @@ async fn ct_deposit() {
|
|||
&alice_meta.token_account,
|
||||
&mint_authority.pubkey(),
|
||||
65537,
|
||||
&vec![&mint_authority],
|
||||
&[&mint_authority],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
|
|
@ -200,7 +200,7 @@ async fn end_to_end_default_account_state() {
|
|||
.set_default_account_state(
|
||||
&mint_authority.pubkey(),
|
||||
&AccountState::Uninitialized,
|
||||
&vec![&mint_authority],
|
||||
&[&mint_authority],
|
||||
)
|
||||
.await
|
||||
.unwrap_err();
|
||||
|
@ -218,7 +218,7 @@ async fn end_to_end_default_account_state() {
|
|||
.set_default_account_state(
|
||||
&freeze_authority.pubkey(),
|
||||
&AccountState::Initialized,
|
||||
&vec![&freeze_authority],
|
||||
&[&freeze_authority],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -256,7 +256,7 @@ async fn end_to_end_default_account_state() {
|
|||
.set_default_account_state(
|
||||
&mint_authority.pubkey(),
|
||||
&AccountState::Frozen,
|
||||
&vec![&mint_authority],
|
||||
&[&mint_authority],
|
||||
)
|
||||
.await
|
||||
.unwrap_err();
|
||||
|
@ -274,7 +274,7 @@ async fn end_to_end_default_account_state() {
|
|||
.set_default_account_state(
|
||||
&new_authority.pubkey(),
|
||||
&AccountState::Frozen,
|
||||
&vec![&new_authority],
|
||||
&[&new_authority],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -300,7 +300,7 @@ async fn end_to_end_default_account_state() {
|
|||
.set_default_account_state(
|
||||
&new_authority.pubkey(),
|
||||
&AccountState::Initialized,
|
||||
&vec![&new_authority],
|
||||
&[&new_authority],
|
||||
)
|
||||
.await
|
||||
.unwrap_err();
|
||||
|
|
|
@ -76,7 +76,7 @@ async fn run_basic(
|
|||
&alice_account,
|
||||
&mint_authority.pubkey(),
|
||||
amount,
|
||||
&vec![&mint_authority],
|
||||
&[&mint_authority],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -90,7 +90,7 @@ async fn run_basic(
|
|||
&bob.pubkey(),
|
||||
&alice.pubkey(),
|
||||
delegated_amount,
|
||||
&vec![&alice],
|
||||
&[&alice],
|
||||
)
|
||||
.await
|
||||
.unwrap(),
|
||||
|
@ -100,7 +100,7 @@ async fn run_basic(
|
|||
&bob.pubkey(),
|
||||
&alice.pubkey(),
|
||||
delegated_amount,
|
||||
&vec![&alice],
|
||||
&[&alice],
|
||||
)
|
||||
.await
|
||||
.unwrap(),
|
||||
|
@ -113,7 +113,7 @@ async fn run_basic(
|
|||
&bob_account,
|
||||
&bob.pubkey(),
|
||||
delegated_amount.checked_add(1).unwrap(),
|
||||
&vec![&bob],
|
||||
&[&bob],
|
||||
)
|
||||
.await
|
||||
.unwrap_err();
|
||||
|
@ -130,23 +130,23 @@ async fn run_basic(
|
|||
// transfer is ok
|
||||
if transfer_mode == TransferMode::All {
|
||||
token_unchecked
|
||||
.transfer(&alice_account, &bob_account, &bob.pubkey(), 1, &vec![&bob])
|
||||
.transfer(&alice_account, &bob_account, &bob.pubkey(), 1, &[&bob])
|
||||
.await
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
token
|
||||
.transfer(&alice_account, &bob_account, &bob.pubkey(), 1, &vec![&bob])
|
||||
.transfer(&alice_account, &bob_account, &bob.pubkey(), 1, &[&bob])
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
// burn is ok
|
||||
token_unchecked
|
||||
.burn(&alice_account, &bob.pubkey(), 1, &vec![&bob])
|
||||
.burn(&alice_account, &bob.pubkey(), 1, &[&bob])
|
||||
.await
|
||||
.unwrap();
|
||||
token
|
||||
.burn(&alice_account, &bob.pubkey(), 1, &vec![&bob])
|
||||
.burn(&alice_account, &bob.pubkey(), 1, &[&bob])
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
|
@ -158,7 +158,7 @@ async fn run_basic(
|
|||
&bob_account,
|
||||
&keypair.pubkey(),
|
||||
1,
|
||||
&vec![keypair],
|
||||
&[keypair],
|
||||
)
|
||||
.await
|
||||
.unwrap_err();
|
||||
|
@ -174,13 +174,13 @@ async fn run_basic(
|
|||
|
||||
// revoke
|
||||
token
|
||||
.revoke(&alice_account, &alice.pubkey(), &vec![&alice])
|
||||
.revoke(&alice_account, &alice.pubkey(), &[&alice])
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
// now fails
|
||||
let error = token
|
||||
.transfer(&alice_account, &bob_account, &bob.pubkey(), 2, &vec![&bob])
|
||||
.transfer(&alice_account, &bob_account, &bob.pubkey(), 2, &[&bob])
|
||||
.await
|
||||
.unwrap_err();
|
||||
assert_eq!(
|
||||
|
|
|
@ -30,22 +30,14 @@ async fn basic() {
|
|||
assert_eq!(state.base.state, AccountState::Initialized);
|
||||
|
||||
token
|
||||
.freeze(
|
||||
&account,
|
||||
&freeze_authority.pubkey(),
|
||||
&vec![&freeze_authority],
|
||||
)
|
||||
.freeze(&account, &freeze_authority.pubkey(), &[&freeze_authority])
|
||||
.await
|
||||
.unwrap();
|
||||
let state = token.get_account_info(&account).await.unwrap();
|
||||
assert_eq!(state.base.state, AccountState::Frozen);
|
||||
|
||||
token
|
||||
.thaw(
|
||||
&account,
|
||||
&freeze_authority.pubkey(),
|
||||
&vec![&freeze_authority],
|
||||
)
|
||||
.thaw(&account, &freeze_authority.pubkey(), &[&freeze_authority])
|
||||
.await
|
||||
.unwrap();
|
||||
let state = token.get_account_info(&account).await.unwrap();
|
||||
|
|
|
@ -94,11 +94,7 @@ async fn update_rate() {
|
|||
// correct
|
||||
let middle_rate = 1_000;
|
||||
token
|
||||
.update_interest_rate(
|
||||
&rate_authority.pubkey(),
|
||||
middle_rate,
|
||||
&vec![&rate_authority],
|
||||
)
|
||||
.update_interest_rate(&rate_authority.pubkey(), middle_rate, &[&rate_authority])
|
||||
.await
|
||||
.unwrap();
|
||||
let state = token.get_mint_info().await.unwrap();
|
||||
|
@ -122,7 +118,7 @@ async fn update_rate() {
|
|||
// update again, pre_update_average_rate is between the two previous
|
||||
let new_rate = 2_000;
|
||||
token
|
||||
.update_interest_rate(&rate_authority.pubkey(), new_rate, &vec![&rate_authority])
|
||||
.update_interest_rate(&rate_authority.pubkey(), new_rate, &[&rate_authority])
|
||||
.await
|
||||
.unwrap();
|
||||
let state = token.get_mint_info().await.unwrap();
|
||||
|
@ -137,7 +133,7 @@ async fn update_rate() {
|
|||
// wrong signer
|
||||
let wrong_signer = Keypair::new();
|
||||
let err = token
|
||||
.update_interest_rate(&wrong_signer.pubkey(), 0, &vec![&wrong_signer])
|
||||
.update_interest_rate(&wrong_signer.pubkey(), 0, &[&wrong_signer])
|
||||
.await
|
||||
.unwrap_err();
|
||||
assert_eq!(
|
||||
|
@ -184,11 +180,11 @@ async fn set_authority() {
|
|||
Some(new_rate_authority.pubkey()).try_into().unwrap(),
|
||||
);
|
||||
token
|
||||
.update_interest_rate(&new_rate_authority.pubkey(), 10, &vec![&new_rate_authority])
|
||||
.update_interest_rate(&new_rate_authority.pubkey(), 10, &[&new_rate_authority])
|
||||
.await
|
||||
.unwrap();
|
||||
let err = token
|
||||
.update_interest_rate(&rate_authority.pubkey(), 100, &vec![&rate_authority])
|
||||
.update_interest_rate(&rate_authority.pubkey(), 100, &[&rate_authority])
|
||||
.await
|
||||
.unwrap_err();
|
||||
assert_eq!(
|
||||
|
@ -218,7 +214,7 @@ async fn set_authority() {
|
|||
|
||||
// now all fail
|
||||
let err = token
|
||||
.update_interest_rate(&new_rate_authority.pubkey(), 50, &vec![&new_rate_authority])
|
||||
.update_interest_rate(&new_rate_authority.pubkey(), 50, &[&new_rate_authority])
|
||||
.await
|
||||
.unwrap_err();
|
||||
assert_eq!(
|
||||
|
@ -231,7 +227,7 @@ async fn set_authority() {
|
|||
)))
|
||||
);
|
||||
let err = token
|
||||
.update_interest_rate(&rate_authority.pubkey(), 5, &vec![&rate_authority])
|
||||
.update_interest_rate(&rate_authority.pubkey(), 5, &[&rate_authority])
|
||||
.await
|
||||
.unwrap_err();
|
||||
assert_eq!(
|
||||
|
|
|
@ -43,14 +43,14 @@ async fn test_memo_transfers(
|
|||
&alice_account,
|
||||
&mint_authority.pubkey(),
|
||||
4242,
|
||||
&vec![&mint_authority],
|
||||
&[&mint_authority],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
// require memo transfers into bob_account
|
||||
token
|
||||
.enable_required_transfer_memos(&bob_account, &bob.pubkey(), &vec![&bob])
|
||||
.enable_required_transfer_memos(&bob_account, &bob.pubkey(), &[&bob])
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
|
@ -60,13 +60,7 @@ async fn test_memo_transfers(
|
|||
|
||||
// attempt to transfer from alice to bob without memo
|
||||
let err = token
|
||||
.transfer(
|
||||
&alice_account,
|
||||
&bob_account,
|
||||
&alice.pubkey(),
|
||||
10,
|
||||
&vec![&alice],
|
||||
)
|
||||
.transfer(&alice_account, &bob_account, &alice.pubkey(), 10, &[&alice])
|
||||
.await
|
||||
.unwrap_err();
|
||||
assert_eq!(
|
||||
|
@ -129,13 +123,7 @@ async fn test_memo_transfers(
|
|||
// transfer with memo
|
||||
token
|
||||
.with_memo("🦖", vec![alice.pubkey()])
|
||||
.transfer(
|
||||
&alice_account,
|
||||
&bob_account,
|
||||
&alice.pubkey(),
|
||||
10,
|
||||
&vec![&alice],
|
||||
)
|
||||
.transfer(&alice_account, &bob_account, &alice.pubkey(), 10, &[&alice])
|
||||
.await
|
||||
.unwrap();
|
||||
let bob_state = token.get_account_info(&bob_account).await.unwrap();
|
||||
|
@ -170,19 +158,13 @@ async fn test_memo_transfers(
|
|||
|
||||
// stop requiring memo transfers into bob_account
|
||||
token
|
||||
.disable_required_transfer_memos(&bob_account, &bob.pubkey(), &vec![&bob])
|
||||
.disable_required_transfer_memos(&bob_account, &bob.pubkey(), &[&bob])
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
// transfer from alice to bob without memo
|
||||
token
|
||||
.transfer(
|
||||
&alice_account,
|
||||
&bob_account,
|
||||
&alice.pubkey(),
|
||||
12,
|
||||
&vec![&alice],
|
||||
)
|
||||
.transfer(&alice_account, &bob_account, &alice.pubkey(), 12, &[&alice])
|
||||
.await
|
||||
.unwrap();
|
||||
let bob_state = token.get_account_info(&bob_account).await.unwrap();
|
||||
|
@ -241,7 +223,7 @@ async fn require_memo_transfers_with_realloc() {
|
|||
&token_context.bob.pubkey(),
|
||||
&token_context.bob.pubkey(),
|
||||
&[ExtensionType::MemoTransfer],
|
||||
&vec![&token_context.bob],
|
||||
&[&token_context.bob],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
|
|
@ -258,12 +258,7 @@ async fn fail_close_with_supply() {
|
|||
.unwrap();
|
||||
let account = account.pubkey();
|
||||
token
|
||||
.mint_to(
|
||||
&account,
|
||||
&mint_authority.pubkey(),
|
||||
1,
|
||||
&vec![&mint_authority],
|
||||
)
|
||||
.mint_to(&account, &mint_authority.pubkey(), 1, &[&mint_authority])
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ async fn transfer_checked() {
|
|||
&alice_account,
|
||||
&mint_authority.pubkey(),
|
||||
test_transfer_amount,
|
||||
&vec![&mint_authority],
|
||||
&[&mint_authority],
|
||||
)
|
||||
.await
|
||||
.unwrap_err();
|
||||
|
@ -76,7 +76,7 @@ async fn transfer_checked() {
|
|||
&bob_account,
|
||||
&mint_authority.pubkey(),
|
||||
test_transfer_amount,
|
||||
&vec![&mint_authority],
|
||||
&[&mint_authority],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -88,7 +88,7 @@ async fn transfer_checked() {
|
|||
&bob_account,
|
||||
&bob.pubkey(),
|
||||
test_transfer_amount,
|
||||
&vec![&bob],
|
||||
&[&bob],
|
||||
)
|
||||
.await
|
||||
.unwrap_err();
|
||||
|
@ -110,7 +110,7 @@ async fn transfer_checked() {
|
|||
&alice_account,
|
||||
&bob.pubkey(),
|
||||
test_transfer_amount,
|
||||
&vec![&bob],
|
||||
&[&bob],
|
||||
)
|
||||
.await
|
||||
.unwrap_err();
|
||||
|
@ -189,7 +189,7 @@ async fn transfer_checked_with_fee() {
|
|||
&alice_account,
|
||||
&mint_authority.pubkey(),
|
||||
test_transfer_amount,
|
||||
&vec![&mint_authority],
|
||||
&[&mint_authority],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -201,7 +201,7 @@ async fn transfer_checked_with_fee() {
|
|||
&alice_account,
|
||||
&alice.pubkey(),
|
||||
test_transfer_amount,
|
||||
&vec![&alice],
|
||||
&[&alice],
|
||||
)
|
||||
.await
|
||||
.unwrap_err();
|
||||
|
@ -223,7 +223,7 @@ async fn transfer_checked_with_fee() {
|
|||
&bob_account,
|
||||
&alice.pubkey(),
|
||||
test_transfer_amount,
|
||||
&vec![&alice],
|
||||
&[&alice],
|
||||
)
|
||||
.await
|
||||
.unwrap_err();
|
||||
|
@ -247,7 +247,7 @@ async fn transfer_checked_with_fee() {
|
|||
&alice.pubkey(),
|
||||
test_transfer_amount,
|
||||
fee,
|
||||
&vec![&alice],
|
||||
&[&alice],
|
||||
)
|
||||
.await
|
||||
.unwrap_err();
|
||||
|
@ -271,7 +271,7 @@ async fn transfer_checked_with_fee() {
|
|||
&alice.pubkey(),
|
||||
test_transfer_amount,
|
||||
fee,
|
||||
&vec![&alice],
|
||||
&[&alice],
|
||||
)
|
||||
.await
|
||||
.unwrap_err();
|
||||
|
|
|
@ -30,7 +30,7 @@ async fn reallocate() {
|
|||
token.get_address(),
|
||||
&mint_authority.pubkey(),
|
||||
&[ExtensionType::ImmutableOwner],
|
||||
&vec![&mint_authority],
|
||||
&[&mint_authority],
|
||||
)
|
||||
.await
|
||||
.unwrap_err();
|
||||
|
@ -55,7 +55,7 @@ async fn reallocate() {
|
|||
&alice_account,
|
||||
&alice.pubkey(),
|
||||
&[ExtensionType::MintCloseAuthority],
|
||||
&vec![&alice],
|
||||
&[&alice],
|
||||
)
|
||||
.await
|
||||
.unwrap_err();
|
||||
|
@ -75,7 +75,7 @@ async fn reallocate() {
|
|||
&alice_account,
|
||||
&mint_authority.pubkey(),
|
||||
&[ExtensionType::ImmutableOwner],
|
||||
&vec![&mint_authority],
|
||||
&[&mint_authority],
|
||||
)
|
||||
.await
|
||||
.unwrap_err();
|
||||
|
@ -95,7 +95,7 @@ async fn reallocate() {
|
|||
&alice_account,
|
||||
&alice.pubkey(),
|
||||
&[ExtensionType::ImmutableOwner],
|
||||
&vec![&alice],
|
||||
&[&alice],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -112,7 +112,7 @@ async fn reallocate() {
|
|||
&alice_account,
|
||||
&alice.pubkey(),
|
||||
&[ExtensionType::ImmutableOwner],
|
||||
&vec![&alice],
|
||||
&[&alice],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -133,7 +133,7 @@ async fn reallocate() {
|
|||
ExtensionType::TransferFeeAmount,
|
||||
ExtensionType::TransferFeeAmount,
|
||||
],
|
||||
&vec![&alice],
|
||||
&[&alice],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -175,7 +175,7 @@ async fn reallocate_without_current_extension_knowledge() {
|
|||
&alice_account,
|
||||
&alice.pubkey(),
|
||||
&[ExtensionType::ImmutableOwner],
|
||||
&vec![&alice],
|
||||
&[&alice],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
|
|
@ -48,7 +48,7 @@ async fn run_basic_transfers(context: TestContext, test_mode: TestMode) {
|
|||
&alice_account,
|
||||
&mint_authority.pubkey(),
|
||||
amount,
|
||||
&vec![&mint_authority],
|
||||
&[&mint_authority],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -56,26 +56,14 @@ async fn run_basic_transfers(context: TestContext, test_mode: TestMode) {
|
|||
if test_mode == TestMode::All {
|
||||
// unchecked is ok
|
||||
token_unchecked
|
||||
.transfer(
|
||||
&alice_account,
|
||||
&bob_account,
|
||||
&alice.pubkey(),
|
||||
1,
|
||||
&vec![&alice],
|
||||
)
|
||||
.transfer(&alice_account, &bob_account, &alice.pubkey(), 1, &[&alice])
|
||||
.await
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
// checked is ok
|
||||
token
|
||||
.transfer(
|
||||
&alice_account,
|
||||
&bob_account,
|
||||
&alice.pubkey(),
|
||||
1,
|
||||
&vec![&alice],
|
||||
)
|
||||
.transfer(&alice_account, &bob_account, &alice.pubkey(), 1, &[&alice])
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
|
@ -86,7 +74,7 @@ async fn run_basic_transfers(context: TestContext, test_mode: TestMode) {
|
|||
&bob_account,
|
||||
&alice.pubkey(),
|
||||
amount,
|
||||
&vec![&alice],
|
||||
&[&alice],
|
||||
)
|
||||
.await
|
||||
.unwrap_err();
|
||||
|
@ -102,7 +90,7 @@ async fn run_basic_transfers(context: TestContext, test_mode: TestMode) {
|
|||
|
||||
// wrong signer
|
||||
let error = token
|
||||
.transfer(&alice_account, &bob_account, &bob.pubkey(), 1, &vec![&bob])
|
||||
.transfer(&alice_account, &bob_account, &bob.pubkey(), 1, &[&bob])
|
||||
.await
|
||||
.unwrap_err();
|
||||
assert_eq!(
|
||||
|
@ -161,7 +149,7 @@ async fn run_self_transfers(context: TestContext, test_mode: TestMode) {
|
|||
&alice_account,
|
||||
&mint_authority.pubkey(),
|
||||
amount,
|
||||
&vec![&mint_authority],
|
||||
&[&mint_authority],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -173,7 +161,7 @@ async fn run_self_transfers(context: TestContext, test_mode: TestMode) {
|
|||
&alice_account,
|
||||
&alice.pubkey(),
|
||||
1,
|
||||
&vec![&alice],
|
||||
&[&alice],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -184,7 +172,7 @@ async fn run_self_transfers(context: TestContext, test_mode: TestMode) {
|
|||
&alice_account,
|
||||
&alice.pubkey(),
|
||||
1,
|
||||
&vec![&alice],
|
||||
&[&alice],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -197,7 +185,7 @@ async fn run_self_transfers(context: TestContext, test_mode: TestMode) {
|
|||
&alice_account,
|
||||
&alice.pubkey(),
|
||||
amount.checked_add(1).unwrap(),
|
||||
&vec![&alice],
|
||||
&[&alice],
|
||||
)
|
||||
.await
|
||||
.unwrap_err();
|
||||
|
@ -263,7 +251,7 @@ async fn run_self_owned(context: TestContext, test_mode: TestMode) {
|
|||
&alice_account,
|
||||
&mint_authority.pubkey(),
|
||||
amount,
|
||||
&vec![&mint_authority],
|
||||
&[&mint_authority],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -271,26 +259,14 @@ async fn run_self_owned(context: TestContext, test_mode: TestMode) {
|
|||
if test_mode == TestMode::All {
|
||||
// unchecked is ok
|
||||
token_unchecked
|
||||
.transfer(
|
||||
&alice_account,
|
||||
&bob_account,
|
||||
&alice.pubkey(),
|
||||
1,
|
||||
&vec![&alice],
|
||||
)
|
||||
.transfer(&alice_account, &bob_account, &alice.pubkey(), 1, &[&alice])
|
||||
.await
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
// checked is ok
|
||||
token
|
||||
.transfer(
|
||||
&alice_account,
|
||||
&bob_account,
|
||||
&alice.pubkey(),
|
||||
1,
|
||||
&vec![&alice],
|
||||
)
|
||||
.transfer(&alice_account, &bob_account, &alice.pubkey(), 1, &[&alice])
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
|
@ -301,7 +277,7 @@ async fn run_self_owned(context: TestContext, test_mode: TestMode) {
|
|||
&alice_account,
|
||||
&alice.pubkey(),
|
||||
1,
|
||||
&vec![&alice],
|
||||
&[&alice],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -361,7 +337,7 @@ async fn transfer_with_fee_on_mint_without_fee_configured() {
|
|||
&alice_account,
|
||||
&mint_authority.pubkey(),
|
||||
amount,
|
||||
&vec![&mint_authority],
|
||||
&[&mint_authority],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -374,7 +350,7 @@ async fn transfer_with_fee_on_mint_without_fee_configured() {
|
|||
&alice.pubkey(),
|
||||
1,
|
||||
0,
|
||||
&vec![&alice],
|
||||
&[&alice],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -387,7 +363,7 @@ async fn transfer_with_fee_on_mint_without_fee_configured() {
|
|||
&alice.pubkey(),
|
||||
2,
|
||||
1,
|
||||
&vec![&alice],
|
||||
&[&alice],
|
||||
)
|
||||
.await
|
||||
.unwrap_err();
|
||||
|
|
|
@ -136,7 +136,7 @@ async fn create_mint_with_accounts(alice_amount: u64) -> TokenWithAccounts {
|
|||
&alice_account,
|
||||
&mint_authority.pubkey(),
|
||||
alice_amount,
|
||||
&vec![&mint_authority],
|
||||
&[&mint_authority],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -296,7 +296,7 @@ async fn set_fee() {
|
|||
&transfer_fee_config_authority.pubkey(),
|
||||
new_transfer_fee_basis_points,
|
||||
new_maximum_fee,
|
||||
&vec![&transfer_fee_config_authority],
|
||||
&[&transfer_fee_config_authority],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -320,7 +320,7 @@ async fn set_fee() {
|
|||
&transfer_fee_config_authority.pubkey(),
|
||||
new_transfer_fee_basis_points,
|
||||
new_maximum_fee,
|
||||
&vec![&transfer_fee_config_authority],
|
||||
&[&transfer_fee_config_authority],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -350,7 +350,7 @@ async fn set_fee() {
|
|||
&transfer_fee_config_authority.pubkey(),
|
||||
new_transfer_fee_basis_points,
|
||||
new_maximum_fee,
|
||||
&vec![&transfer_fee_config_authority],
|
||||
&[&transfer_fee_config_authority],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -381,7 +381,7 @@ async fn set_fee() {
|
|||
&transfer_fee_config_authority.pubkey(),
|
||||
new_transfer_fee_basis_points,
|
||||
new_maximum_fee,
|
||||
&vec![&transfer_fee_config_authority],
|
||||
&[&transfer_fee_config_authority],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -403,7 +403,7 @@ async fn set_fee() {
|
|||
&withdraw_withheld_authority.pubkey(),
|
||||
new_transfer_fee_basis_points,
|
||||
new_maximum_fee,
|
||||
&vec![&withdraw_withheld_authority],
|
||||
&[&withdraw_withheld_authority],
|
||||
)
|
||||
.await
|
||||
.err()
|
||||
|
@ -424,7 +424,7 @@ async fn set_fee() {
|
|||
&transfer_fee_config_authority.pubkey(),
|
||||
MAX_FEE_BASIS_POINTS + 1,
|
||||
new_maximum_fee,
|
||||
&vec![&transfer_fee_config_authority],
|
||||
&[&transfer_fee_config_authority],
|
||||
)
|
||||
.await
|
||||
.err()
|
||||
|
@ -456,7 +456,7 @@ async fn fail_unsupported_mint() {
|
|||
&mint_authority.pubkey(),
|
||||
transfer_fee_basis_points,
|
||||
maximum_fee,
|
||||
&vec![&mint_authority],
|
||||
&[&mint_authority],
|
||||
)
|
||||
.await
|
||||
.err()
|
||||
|
@ -482,7 +482,7 @@ async fn fail_unsupported_mint() {
|
|||
.withdraw_withheld_tokens_from_mint(
|
||||
&Pubkey::new_unique(),
|
||||
&mint_authority.pubkey(),
|
||||
&vec![&mint_authority],
|
||||
&[&mint_authority],
|
||||
)
|
||||
.await
|
||||
.err()
|
||||
|
@ -567,7 +567,7 @@ async fn set_transfer_fee_config_authority() {
|
|||
&transfer_fee_config_authority.pubkey(),
|
||||
transfer_fee_basis_points,
|
||||
maximum_fee,
|
||||
&vec![&transfer_fee_config_authority],
|
||||
&[&transfer_fee_config_authority],
|
||||
)
|
||||
.await
|
||||
.unwrap_err();
|
||||
|
@ -585,7 +585,7 @@ async fn set_transfer_fee_config_authority() {
|
|||
&new_authority.pubkey(),
|
||||
transfer_fee_basis_points,
|
||||
maximum_fee,
|
||||
&vec![&new_authority],
|
||||
&[&new_authority],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -635,7 +635,7 @@ async fn set_transfer_fee_config_authority() {
|
|||
&transfer_fee_config_authority.pubkey(),
|
||||
0,
|
||||
0,
|
||||
&vec![&transfer_fee_config_authority],
|
||||
&[&transfer_fee_config_authority],
|
||||
)
|
||||
.await
|
||||
.unwrap_err();
|
||||
|
@ -726,7 +726,7 @@ async fn set_withdraw_withheld_authority() {
|
|||
&account,
|
||||
&new_authority.pubkey(),
|
||||
&[&account],
|
||||
&vec![&new_authority],
|
||||
&[&new_authority],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -736,7 +736,7 @@ async fn set_withdraw_withheld_authority() {
|
|||
&account,
|
||||
&withdraw_withheld_authority.pubkey(),
|
||||
&[&account],
|
||||
&vec![&withdraw_withheld_authority],
|
||||
&[&withdraw_withheld_authority],
|
||||
)
|
||||
.await
|
||||
.unwrap_err();
|
||||
|
@ -801,7 +801,7 @@ async fn set_withdraw_withheld_authority() {
|
|||
&account,
|
||||
&withdraw_withheld_authority.pubkey(),
|
||||
&[&account],
|
||||
&vec![&withdraw_withheld_authority],
|
||||
&[&withdraw_withheld_authority],
|
||||
)
|
||||
.await
|
||||
.unwrap_err();
|
||||
|
@ -819,7 +819,7 @@ async fn set_withdraw_withheld_authority() {
|
|||
&account,
|
||||
&new_authority.pubkey(),
|
||||
&[&account],
|
||||
&vec![&new_authority],
|
||||
&[&new_authority],
|
||||
)
|
||||
.await
|
||||
.unwrap_err();
|
||||
|
@ -855,7 +855,7 @@ async fn transfer_checked() {
|
|||
&bob_account,
|
||||
&alice.pubkey(),
|
||||
maximum_fee,
|
||||
&vec![&alice],
|
||||
&[&alice],
|
||||
)
|
||||
.await
|
||||
.unwrap_err();
|
||||
|
@ -876,7 +876,7 @@ async fn transfer_checked() {
|
|||
&bob_account,
|
||||
&alice.pubkey(),
|
||||
alice_amount + 1,
|
||||
&vec![&alice],
|
||||
&[&alice],
|
||||
)
|
||||
.await
|
||||
.unwrap_err();
|
||||
|
@ -903,7 +903,7 @@ async fn transfer_checked() {
|
|||
&bob_account,
|
||||
&alice.pubkey(),
|
||||
maximum_fee,
|
||||
&vec![&alice],
|
||||
&[&alice],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -931,7 +931,7 @@ async fn transfer_checked() {
|
|||
&bob_account,
|
||||
&alice.pubkey(),
|
||||
transfer_amount,
|
||||
&vec![&alice],
|
||||
&[&alice],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -964,7 +964,7 @@ async fn transfer_checked() {
|
|||
&bob_account,
|
||||
&alice.pubkey(),
|
||||
transfer_amount,
|
||||
&vec![&alice],
|
||||
&[&alice],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -987,7 +987,7 @@ async fn transfer_checked() {
|
|||
&bob_account,
|
||||
&alice.pubkey(),
|
||||
alice_amount - 1,
|
||||
&vec![&alice],
|
||||
&[&alice],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -1005,13 +1005,7 @@ async fn transfer_checked() {
|
|||
|
||||
// final transfer, only move tokens to withheld amount, nothing received
|
||||
token
|
||||
.transfer(
|
||||
&alice_account,
|
||||
&bob_account,
|
||||
&alice.pubkey(),
|
||||
1,
|
||||
&vec![&alice],
|
||||
)
|
||||
.transfer(&alice_account, &bob_account, &alice.pubkey(), 1, &[&alice])
|
||||
.await
|
||||
.unwrap();
|
||||
withheld_amount += 1;
|
||||
|
@ -1051,7 +1045,7 @@ async fn transfer_checked_with_fee() {
|
|||
&alice.pubkey(),
|
||||
transfer_amount,
|
||||
fee,
|
||||
&vec![&alice],
|
||||
&[&alice],
|
||||
)
|
||||
.await
|
||||
.unwrap_err();
|
||||
|
@ -1077,7 +1071,7 @@ async fn transfer_checked_with_fee() {
|
|||
&alice.pubkey(),
|
||||
transfer_amount,
|
||||
fee,
|
||||
&vec![&alice],
|
||||
&[&alice],
|
||||
)
|
||||
.await
|
||||
.unwrap_err();
|
||||
|
@ -1103,7 +1097,7 @@ async fn transfer_checked_with_fee() {
|
|||
&alice.pubkey(),
|
||||
alice_amount + 1,
|
||||
fee,
|
||||
&vec![&alice],
|
||||
&[&alice],
|
||||
)
|
||||
.await
|
||||
.unwrap_err();
|
||||
|
@ -1128,7 +1122,7 @@ async fn transfer_checked_with_fee() {
|
|||
&alice.pubkey(),
|
||||
transfer_amount,
|
||||
fee,
|
||||
&vec![&alice],
|
||||
&[&alice],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -1163,7 +1157,7 @@ async fn no_fees_from_self_transfer() {
|
|||
&alice.pubkey(),
|
||||
amount,
|
||||
fee,
|
||||
&vec![&alice],
|
||||
&[&alice],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -1187,13 +1181,7 @@ async fn create_and_transfer_to_account(
|
|||
.unwrap();
|
||||
let account = account.pubkey();
|
||||
token
|
||||
.transfer(
|
||||
source,
|
||||
&account,
|
||||
&authority.pubkey(),
|
||||
amount,
|
||||
&vec![authority],
|
||||
)
|
||||
.transfer(source, &account, &authority.pubkey(), amount, &[authority])
|
||||
.await
|
||||
.unwrap();
|
||||
account
|
||||
|
@ -1335,7 +1323,7 @@ async fn max_withdraw_withheld_tokens_from_accounts() {
|
|||
&destination,
|
||||
&withdraw_withheld_authority.pubkey(),
|
||||
&accounts,
|
||||
&vec![&withdraw_withheld_authority],
|
||||
&[&withdraw_withheld_authority],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -1369,7 +1357,7 @@ async fn withdraw_withheld_tokens_from_mint() {
|
|||
.withdraw_withheld_tokens_from_mint(
|
||||
&alice_account,
|
||||
&withdraw_withheld_authority.pubkey(),
|
||||
&vec![&withdraw_withheld_authority],
|
||||
&[&withdraw_withheld_authority],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -1405,7 +1393,7 @@ async fn withdraw_withheld_tokens_from_mint() {
|
|||
.withdraw_withheld_tokens_from_mint(
|
||||
&bob_account,
|
||||
&withdraw_withheld_authority.pubkey(),
|
||||
&vec![&withdraw_withheld_authority],
|
||||
&[&withdraw_withheld_authority],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -1420,7 +1408,7 @@ async fn withdraw_withheld_tokens_from_mint() {
|
|||
|
||||
// fail wrong signer
|
||||
let error = token
|
||||
.withdraw_withheld_tokens_from_mint(&alice_account, &alice.pubkey(), &vec![&alice])
|
||||
.withdraw_withheld_tokens_from_mint(&alice_account, &alice.pubkey(), &[&alice])
|
||||
.await
|
||||
.unwrap_err();
|
||||
assert_eq!(
|
||||
|
@ -1438,18 +1426,14 @@ async fn withdraw_withheld_tokens_from_mint() {
|
|||
create_and_transfer_to_account(&token, &alice_account, &alice, &alice.pubkey(), amount)
|
||||
.await;
|
||||
token
|
||||
.freeze(
|
||||
&account,
|
||||
&freeze_authority.pubkey(),
|
||||
&vec![&freeze_authority],
|
||||
)
|
||||
.freeze(&account, &freeze_authority.pubkey(), &[&freeze_authority])
|
||||
.await
|
||||
.unwrap();
|
||||
let error = token
|
||||
.withdraw_withheld_tokens_from_mint(
|
||||
&account,
|
||||
&withdraw_withheld_authority.pubkey(),
|
||||
&vec![&withdraw_withheld_authority],
|
||||
&[&withdraw_withheld_authority],
|
||||
)
|
||||
.await
|
||||
.unwrap_err();
|
||||
|
@ -1481,7 +1465,7 @@ async fn withdraw_withheld_tokens_from_mint() {
|
|||
.withdraw_withheld_tokens_from_mint(
|
||||
&account,
|
||||
&withdraw_withheld_authority.pubkey(),
|
||||
&vec![&withdraw_withheld_authority],
|
||||
&[&withdraw_withheld_authority],
|
||||
)
|
||||
.await
|
||||
.unwrap_err();
|
||||
|
@ -1510,7 +1494,7 @@ async fn withdraw_withheld_tokens_from_mint() {
|
|||
.withdraw_withheld_tokens_from_mint(
|
||||
&account,
|
||||
&withdraw_withheld_authority.pubkey(),
|
||||
&vec![&withdraw_withheld_authority],
|
||||
&[&withdraw_withheld_authority],
|
||||
)
|
||||
.await
|
||||
.unwrap_err();
|
||||
|
@ -1545,7 +1529,7 @@ async fn withdraw_withheld_tokens_from_accounts() {
|
|||
&alice_account,
|
||||
&wrong_signer.pubkey(),
|
||||
&[],
|
||||
&vec![&wrong_signer],
|
||||
&[&wrong_signer],
|
||||
)
|
||||
.await
|
||||
.unwrap_err();
|
||||
|
@ -1565,7 +1549,7 @@ async fn withdraw_withheld_tokens_from_accounts() {
|
|||
&alice_account,
|
||||
&withdraw_withheld_authority.pubkey(),
|
||||
&[],
|
||||
&vec![&withdraw_withheld_authority],
|
||||
&[&withdraw_withheld_authority],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -1581,7 +1565,7 @@ async fn withdraw_withheld_tokens_from_accounts() {
|
|||
&account,
|
||||
&withdraw_withheld_authority.pubkey(),
|
||||
&[&account],
|
||||
&vec![&withdraw_withheld_authority],
|
||||
&[&withdraw_withheld_authority],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -1598,7 +1582,7 @@ async fn withdraw_withheld_tokens_from_accounts() {
|
|||
&alice_account,
|
||||
&withdraw_withheld_authority.pubkey(),
|
||||
&[&account],
|
||||
&vec![&withdraw_withheld_authority],
|
||||
&[&withdraw_withheld_authority],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -1635,7 +1619,7 @@ async fn withdraw_withheld_tokens_from_accounts() {
|
|||
&withdraw_account,
|
||||
&withdraw_withheld_authority.pubkey(),
|
||||
&[&account],
|
||||
&vec![&withdraw_withheld_authority],
|
||||
&[&withdraw_withheld_authority],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -1649,7 +1633,7 @@ async fn withdraw_withheld_tokens_from_accounts() {
|
|||
&account,
|
||||
&withdraw_withheld_authority.pubkey(),
|
||||
&[&withdraw_account],
|
||||
&vec![&withdraw_withheld_authority],
|
||||
&[&withdraw_withheld_authority],
|
||||
)
|
||||
.await
|
||||
.unwrap_err();
|
||||
|
@ -1689,7 +1673,7 @@ async fn fail_close_with_withheld() {
|
|||
&alice_account,
|
||||
&alice.pubkey(),
|
||||
amount - fee,
|
||||
&vec![&alice],
|
||||
&[&alice],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
|
Loading…
Reference in New Issue