Rename Client methods to match proposed BanksClient (#10793)
This commit is contained in:
@ -110,7 +110,7 @@ mod bpf {
|
||||
AccountMeta::new(rent::id(), false),
|
||||
];
|
||||
let instruction = Instruction::new(program_id, &1u8, account_metas);
|
||||
let result = bank_client.send_instruction(&mint_keypair, instruction);
|
||||
let result = bank_client.send_and_confirm_instruction(&mint_keypair, instruction);
|
||||
if program.1 {
|
||||
assert!(result.is_ok());
|
||||
} else {
|
||||
@ -162,42 +162,42 @@ mod bpf {
|
||||
|
||||
bank.store_account(&pubkey, &account);
|
||||
let instruction = Instruction::new(program_id, &1u8, account_metas.clone());
|
||||
let result = bank_client.send_instruction(&mint_keypair, instruction);
|
||||
let result = bank_client.send_and_confirm_instruction(&mint_keypair, instruction);
|
||||
let data = bank_client.get_account_data(&pubkey).unwrap().unwrap();
|
||||
assert!(result.is_ok());
|
||||
assert_eq!(data[0], 1);
|
||||
|
||||
bank.store_account(&pubkey, &account);
|
||||
let instruction = Instruction::new(program_id, &2u8, account_metas.clone());
|
||||
let result = bank_client.send_instruction(&mint_keypair, instruction);
|
||||
let result = bank_client.send_and_confirm_instruction(&mint_keypair, instruction);
|
||||
let data = bank_client.get_account_data(&pubkey).unwrap().unwrap();
|
||||
assert!(result.is_ok());
|
||||
assert_eq!(data[0], 2);
|
||||
|
||||
bank.store_account(&pubkey, &account);
|
||||
let instruction = Instruction::new(program_id, &3u8, account_metas.clone());
|
||||
let result = bank_client.send_instruction(&mint_keypair, instruction);
|
||||
let result = bank_client.send_and_confirm_instruction(&mint_keypair, instruction);
|
||||
let data = bank_client.get_account_data(&pubkey).unwrap().unwrap();
|
||||
assert!(result.is_ok());
|
||||
assert_eq!(data[0], 3);
|
||||
|
||||
bank.store_account(&pubkey, &account);
|
||||
let instruction = Instruction::new(program_id, &4u8, account_metas.clone());
|
||||
let result = bank_client.send_instruction(&mint_keypair, instruction);
|
||||
let result = bank_client.send_and_confirm_instruction(&mint_keypair, instruction);
|
||||
let lamports = bank_client.get_balance(&pubkey).unwrap();
|
||||
assert!(result.is_ok());
|
||||
assert_eq!(lamports, 11);
|
||||
|
||||
bank.store_account(&pubkey, &account);
|
||||
let instruction = Instruction::new(program_id, &5u8, account_metas.clone());
|
||||
let result = bank_client.send_instruction(&mint_keypair, instruction);
|
||||
let result = bank_client.send_and_confirm_instruction(&mint_keypair, instruction);
|
||||
let lamports = bank_client.get_balance(&pubkey).unwrap();
|
||||
assert!(result.is_ok());
|
||||
assert_eq!(lamports, 12);
|
||||
|
||||
bank.store_account(&pubkey, &account);
|
||||
let instruction = Instruction::new(program_id, &6u8, account_metas.clone());
|
||||
let result = bank_client.send_instruction(&mint_keypair, instruction);
|
||||
let result = bank_client.send_and_confirm_instruction(&mint_keypair, instruction);
|
||||
let lamports = bank_client.get_balance(&pubkey).unwrap();
|
||||
assert!(result.is_ok());
|
||||
assert_eq!(lamports, 13);
|
||||
@ -235,32 +235,32 @@ mod bpf {
|
||||
let account_metas = vec![AccountMeta::new(mint_keypair.pubkey(), true)];
|
||||
|
||||
let instruction = Instruction::new(program_id, &1u8, account_metas.clone());
|
||||
let result = bank_client.send_instruction(&mint_keypair, instruction);
|
||||
let result = bank_client.send_and_confirm_instruction(&mint_keypair, instruction);
|
||||
assert!(result.is_ok());
|
||||
|
||||
let instruction = Instruction::new(program_id, &2u8, account_metas.clone());
|
||||
let result = bank_client.send_instruction(&mint_keypair, instruction);
|
||||
let result = bank_client.send_and_confirm_instruction(&mint_keypair, instruction);
|
||||
assert_eq!(
|
||||
result.unwrap_err().unwrap(),
|
||||
TransactionError::InstructionError(0, InstructionError::InvalidAccountData)
|
||||
);
|
||||
|
||||
let instruction = Instruction::new(program_id, &3u8, account_metas.clone());
|
||||
let result = bank_client.send_instruction(&mint_keypair, instruction);
|
||||
let result = bank_client.send_and_confirm_instruction(&mint_keypair, instruction);
|
||||
assert_eq!(
|
||||
result.unwrap_err().unwrap(),
|
||||
TransactionError::InstructionError(0, InstructionError::Custom(0))
|
||||
);
|
||||
|
||||
let instruction = Instruction::new(program_id, &4u8, account_metas.clone());
|
||||
let result = bank_client.send_instruction(&mint_keypair, instruction);
|
||||
let result = bank_client.send_and_confirm_instruction(&mint_keypair, instruction);
|
||||
assert_eq!(
|
||||
result.unwrap_err().unwrap(),
|
||||
TransactionError::InstructionError(0, InstructionError::Custom(42))
|
||||
);
|
||||
|
||||
let instruction = Instruction::new(program_id, &5u8, account_metas.clone());
|
||||
let result = bank_client.send_instruction(&mint_keypair, instruction);
|
||||
let result = bank_client.send_and_confirm_instruction(&mint_keypair, instruction);
|
||||
let result = result.unwrap_err().unwrap();
|
||||
if TransactionError::InstructionError(0, InstructionError::InvalidInstructionData)
|
||||
!= result
|
||||
@ -272,7 +272,7 @@ mod bpf {
|
||||
}
|
||||
|
||||
let instruction = Instruction::new(program_id, &6u8, account_metas.clone());
|
||||
let result = bank_client.send_instruction(&mint_keypair, instruction);
|
||||
let result = bank_client.send_and_confirm_instruction(&mint_keypair, instruction);
|
||||
let result = result.unwrap_err().unwrap();
|
||||
if TransactionError::InstructionError(0, InstructionError::InvalidInstructionData)
|
||||
!= result
|
||||
@ -284,7 +284,7 @@ mod bpf {
|
||||
}
|
||||
|
||||
let instruction = Instruction::new(program_id, &7u8, account_metas.clone());
|
||||
let result = bank_client.send_instruction(&mint_keypair, instruction);
|
||||
let result = bank_client.send_and_confirm_instruction(&mint_keypair, instruction);
|
||||
let result = result.unwrap_err().unwrap();
|
||||
if TransactionError::InstructionError(0, InstructionError::InvalidInstructionData)
|
||||
!= result
|
||||
@ -296,14 +296,14 @@ mod bpf {
|
||||
}
|
||||
|
||||
let instruction = Instruction::new(program_id, &8u8, account_metas.clone());
|
||||
let result = bank_client.send_instruction(&mint_keypair, instruction);
|
||||
let result = bank_client.send_and_confirm_instruction(&mint_keypair, instruction);
|
||||
assert_eq!(
|
||||
result.unwrap_err().unwrap(),
|
||||
TransactionError::InstructionError(0, InstructionError::InvalidInstructionData)
|
||||
);
|
||||
|
||||
let instruction = Instruction::new(program_id, &9u8, account_metas.clone());
|
||||
let result = bank_client.send_instruction(&mint_keypair, instruction);
|
||||
let result = bank_client.send_and_confirm_instruction(&mint_keypair, instruction);
|
||||
assert_eq!(
|
||||
result.unwrap_err().unwrap(),
|
||||
TransactionError::InstructionError(0, InstructionError::MaxSeedLengthExceeded)
|
||||
@ -387,7 +387,7 @@ mod bpf {
|
||||
Instruction::new(invoke_program_id, &TEST_SUCCESS, account_metas.clone());
|
||||
let message = Message::new(&[instruction], Some(&mint_pubkey));
|
||||
assert!(bank_client
|
||||
.send_message(
|
||||
.send_and_confirm_message(
|
||||
&[
|
||||
&mint_keypair,
|
||||
&argument_keypair,
|
||||
@ -408,7 +408,7 @@ mod bpf {
|
||||
let message = Message::new(&[instruction], Some(&mint_pubkey));
|
||||
assert_eq!(
|
||||
bank_client
|
||||
.send_message(
|
||||
.send_and_confirm_message(
|
||||
&[
|
||||
&mint_keypair,
|
||||
&argument_keypair,
|
||||
@ -430,7 +430,7 @@ mod bpf {
|
||||
let message = Message::new(&[instruction], Some(&mint_pubkey));
|
||||
assert_eq!(
|
||||
bank_client
|
||||
.send_message(
|
||||
.send_and_confirm_message(
|
||||
&[
|
||||
&mint_keypair,
|
||||
&argument_keypair,
|
||||
|
@ -259,7 +259,7 @@ mod tests {
|
||||
let message = Message::new(&instructions, Some(&alice_pubkey));
|
||||
assert_eq!(
|
||||
bank_client
|
||||
.send_message(&[&alice_keypair, &budget_keypair], message)
|
||||
.send_and_confirm_message(&[&alice_keypair, &budget_keypair], message)
|
||||
.unwrap_err()
|
||||
.unwrap(),
|
||||
TransactionError::InstructionError(1, InstructionError::NotEnoughAccountKeys)
|
||||
@ -278,7 +278,7 @@ mod tests {
|
||||
budget_instruction::payment(&alice_pubkey, &bob_pubkey, &budget_pubkey, 100);
|
||||
let message = Message::new(&instructions, Some(&alice_pubkey));
|
||||
bank_client
|
||||
.send_message(&[&alice_keypair, &budget_keypair], message)
|
||||
.send_and_confirm_message(&[&alice_keypair, &budget_keypair], message)
|
||||
.unwrap();
|
||||
assert_eq!(bank_client.get_balance(&bob_pubkey).unwrap(), 100);
|
||||
}
|
||||
@ -304,14 +304,14 @@ mod tests {
|
||||
);
|
||||
let message = Message::new(&instructions, Some(&alice_pubkey));
|
||||
bank_client
|
||||
.send_message(&[&alice_keypair, &budget_keypair], message)
|
||||
.send_and_confirm_message(&[&alice_keypair, &budget_keypair], message)
|
||||
.unwrap();
|
||||
|
||||
// Attack! Part 1: Sign a witness transaction with a random key.
|
||||
let mallory_keypair = Keypair::new();
|
||||
let mallory_pubkey = mallory_keypair.pubkey();
|
||||
bank_client
|
||||
.transfer(1, &alice_keypair, &mallory_pubkey)
|
||||
.transfer_and_confirm(1, &alice_keypair, &mallory_pubkey)
|
||||
.unwrap();
|
||||
let instruction =
|
||||
budget_instruction::apply_signature(&mallory_pubkey, &budget_pubkey, &bob_pubkey);
|
||||
@ -325,7 +325,7 @@ mod tests {
|
||||
// Ensure the transaction fails because of the unsigned key.
|
||||
assert_eq!(
|
||||
bank_client
|
||||
.send_message(&[&mallory_keypair], message)
|
||||
.send_and_confirm_message(&[&mallory_keypair], message)
|
||||
.unwrap_err()
|
||||
.unwrap(),
|
||||
TransactionError::InstructionError(0, InstructionError::MissingRequiredSignature)
|
||||
@ -354,14 +354,14 @@ mod tests {
|
||||
);
|
||||
let message = Message::new(&instructions, Some(&alice_pubkey));
|
||||
bank_client
|
||||
.send_message(&[&alice_keypair, &budget_keypair], message)
|
||||
.send_and_confirm_message(&[&alice_keypair, &budget_keypair], message)
|
||||
.unwrap();
|
||||
|
||||
// Attack! Part 1: Sign a timestamp transaction with a random key.
|
||||
let mallory_keypair = Keypair::new();
|
||||
let mallory_pubkey = mallory_keypair.pubkey();
|
||||
bank_client
|
||||
.transfer(1, &alice_keypair, &mallory_pubkey)
|
||||
.transfer_and_confirm(1, &alice_keypair, &mallory_pubkey)
|
||||
.unwrap();
|
||||
let instruction =
|
||||
budget_instruction::apply_timestamp(&mallory_pubkey, &budget_pubkey, &bob_pubkey, dt);
|
||||
@ -375,7 +375,7 @@ mod tests {
|
||||
// Ensure the transaction fails because of the unsigned key.
|
||||
assert_eq!(
|
||||
bank_client
|
||||
.send_message(&[&mallory_keypair], message)
|
||||
.send_and_confirm_message(&[&mallory_keypair], message)
|
||||
.unwrap_err()
|
||||
.unwrap(),
|
||||
TransactionError::InstructionError(0, InstructionError::MissingRequiredSignature)
|
||||
@ -404,7 +404,7 @@ mod tests {
|
||||
);
|
||||
let message = Message::new(&instructions, Some(&alice_pubkey));
|
||||
bank_client
|
||||
.send_message(&[&alice_keypair, &budget_keypair], message)
|
||||
.send_and_confirm_message(&[&alice_keypair, &budget_keypair], message)
|
||||
.unwrap();
|
||||
assert_eq!(bank_client.get_balance(&alice_pubkey).unwrap(), 1);
|
||||
assert_eq!(bank_client.get_balance(&budget_pubkey).unwrap(), 1);
|
||||
@ -421,7 +421,7 @@ mod tests {
|
||||
budget_instruction::apply_timestamp(&alice_pubkey, &budget_pubkey, &mallory_pubkey, dt);
|
||||
assert_eq!(
|
||||
bank_client
|
||||
.send_instruction(&alice_keypair, instruction)
|
||||
.send_and_confirm_instruction(&alice_keypair, instruction)
|
||||
.unwrap_err()
|
||||
.unwrap(),
|
||||
TransactionError::InstructionError(
|
||||
@ -445,7 +445,7 @@ mod tests {
|
||||
let instruction =
|
||||
budget_instruction::apply_timestamp(&alice_pubkey, &budget_pubkey, &bob_pubkey, dt);
|
||||
bank_client
|
||||
.send_instruction(&alice_keypair, instruction)
|
||||
.send_and_confirm_instruction(&alice_keypair, instruction)
|
||||
.unwrap();
|
||||
assert_eq!(bank_client.get_balance(&alice_pubkey).unwrap(), 1);
|
||||
assert_eq!(bank_client.get_balance(&budget_pubkey).unwrap(), 0);
|
||||
@ -474,7 +474,7 @@ mod tests {
|
||||
);
|
||||
let message = Message::new(&instructions, Some(&alice_pubkey));
|
||||
bank_client
|
||||
.send_message(&[&alice_keypair, &budget_keypair], message)
|
||||
.send_and_confirm_message(&[&alice_keypair, &budget_keypair], message)
|
||||
.unwrap();
|
||||
assert_eq!(bank_client.get_balance(&alice_pubkey).unwrap(), 2);
|
||||
assert_eq!(bank_client.get_balance(&budget_pubkey).unwrap(), 1);
|
||||
@ -490,14 +490,14 @@ mod tests {
|
||||
let mallory_keypair = Keypair::new();
|
||||
let mallory_pubkey = mallory_keypair.pubkey();
|
||||
bank_client
|
||||
.transfer(1, &alice_keypair, &mallory_pubkey)
|
||||
.transfer_and_confirm(1, &alice_keypair, &mallory_pubkey)
|
||||
.unwrap();
|
||||
assert_eq!(bank_client.get_balance(&alice_pubkey).unwrap(), 1);
|
||||
|
||||
let instruction =
|
||||
budget_instruction::apply_signature(&mallory_pubkey, &budget_pubkey, &bob_pubkey);
|
||||
bank_client
|
||||
.send_instruction(&mallory_keypair, instruction)
|
||||
.send_and_confirm_instruction(&mallory_keypair, instruction)
|
||||
.unwrap();
|
||||
// nothing should be changed because apply witness didn't finalize a payment
|
||||
assert_eq!(bank_client.get_balance(&alice_pubkey).unwrap(), 1);
|
||||
@ -508,7 +508,7 @@ mod tests {
|
||||
let instruction =
|
||||
budget_instruction::apply_signature(&alice_pubkey, &budget_pubkey, &alice_pubkey);
|
||||
bank_client
|
||||
.send_instruction(&alice_keypair, instruction)
|
||||
.send_and_confirm_instruction(&alice_keypair, instruction)
|
||||
.unwrap();
|
||||
assert_eq!(bank_client.get_balance(&alice_pubkey).unwrap(), 2);
|
||||
assert_eq!(bank_client.get_account_data(&budget_pubkey).unwrap(), None);
|
||||
@ -538,7 +538,7 @@ mod tests {
|
||||
|
||||
// Give Bob some lamports so he can sign the witness transaction.
|
||||
bank_client
|
||||
.transfer(1, &alice_keypair, &bob_pubkey)
|
||||
.transfer_and_confirm(1, &alice_keypair, &bob_pubkey)
|
||||
.unwrap();
|
||||
|
||||
let instructions = budget_instruction::when_account_data(
|
||||
@ -552,7 +552,7 @@ mod tests {
|
||||
);
|
||||
let message = Message::new(&instructions, Some(&alice_pubkey));
|
||||
bank_client
|
||||
.send_message(&[&alice_keypair, &budget_keypair], message)
|
||||
.send_and_confirm_message(&[&alice_keypair, &budget_keypair], message)
|
||||
.unwrap();
|
||||
assert_eq!(bank_client.get_balance(&alice_pubkey).unwrap(), 0);
|
||||
assert_eq!(bank_client.get_balance(&budget_pubkey).unwrap(), 41);
|
||||
@ -571,7 +571,9 @@ mod tests {
|
||||
// Anyone can sign the message, but presumably it's Bob, since he's the
|
||||
// one claiming the payout.
|
||||
let message = Message::new(&[instruction], Some(&bob_pubkey));
|
||||
bank_client.send_message(&[&bob_keypair], message).unwrap();
|
||||
bank_client
|
||||
.send_and_confirm_message(&[&bob_keypair], message)
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(bank_client.get_balance(&alice_pubkey).unwrap(), 0);
|
||||
assert_eq!(bank_client.get_balance(&budget_pubkey).unwrap(), 0);
|
||||
|
@ -586,7 +586,7 @@ mod test {
|
||||
let owner = Keypair::new();
|
||||
let bank_client = BankClient::new(bank);
|
||||
bank_client
|
||||
.transfer(42, &mint_keypair, &owner.pubkey())
|
||||
.transfer_and_confirm(42, &mint_keypair, &owner.pubkey())
|
||||
.unwrap();
|
||||
|
||||
(bank_client, owner)
|
||||
@ -604,7 +604,7 @@ mod test {
|
||||
);
|
||||
|
||||
client
|
||||
.send_message(
|
||||
.send_and_confirm_message(
|
||||
&[owner, &new],
|
||||
Message::new(&[instruction], Some(&owner.pubkey())),
|
||||
)
|
||||
@ -616,7 +616,7 @@ mod test {
|
||||
let new = create_account(&client, &owner);
|
||||
let instruction = exchange_instruction::account_request(&owner.pubkey(), &new);
|
||||
client
|
||||
.send_instruction(owner, instruction)
|
||||
.send_and_confirm_instruction(owner, instruction)
|
||||
.unwrap_or_else(|_| panic!("{}:{}", line!(), file!()));
|
||||
new
|
||||
}
|
||||
@ -630,7 +630,7 @@ mod test {
|
||||
tokens,
|
||||
);
|
||||
client
|
||||
.send_instruction(owner, instruction)
|
||||
.send_and_confirm_instruction(owner, instruction)
|
||||
.unwrap_or_else(|_| panic!("{}:{}", line!(), file!()));
|
||||
}
|
||||
|
||||
@ -658,7 +658,7 @@ mod test {
|
||||
&src,
|
||||
);
|
||||
client
|
||||
.send_instruction(owner, instruction)
|
||||
.send_and_confirm_instruction(owner, instruction)
|
||||
.unwrap_or_else(|_| panic!("{}:{}", line!(), file!()));
|
||||
(trade, src)
|
||||
}
|
||||
@ -691,7 +691,7 @@ mod test {
|
||||
let new = create_token_account(&client, &owner);
|
||||
let instruction = exchange_instruction::account_request(&owner.pubkey(), &new);
|
||||
client
|
||||
.send_instruction(&owner, instruction)
|
||||
.send_and_confirm_instruction(&owner, instruction)
|
||||
.expect_err(&format!("{}:{}", line!(), file!()));
|
||||
}
|
||||
|
||||
@ -711,7 +711,7 @@ mod test {
|
||||
42,
|
||||
);
|
||||
client
|
||||
.send_instruction(&owner, instruction)
|
||||
.send_and_confirm_instruction(&owner, instruction)
|
||||
.unwrap_or_else(|_| panic!("{}:{}", line!(), file!()));
|
||||
|
||||
let new_account_data = client.get_account_data(&new).unwrap().unwrap();
|
||||
@ -798,7 +798,7 @@ mod test {
|
||||
let instruction =
|
||||
exchange_instruction::swap_request(&owner.pubkey(), &to_trade, &from_trade, &profit);
|
||||
client
|
||||
.send_instruction(&owner, instruction)
|
||||
.send_and_confirm_instruction(&owner, instruction)
|
||||
.unwrap_or_else(|_| panic!("{}:{}", line!(), file!()));
|
||||
|
||||
let to_trade_account_data = client.get_account_data(&to_trade).unwrap().unwrap();
|
||||
@ -865,7 +865,7 @@ mod test {
|
||||
let instruction =
|
||||
exchange_instruction::swap_request(&owner.pubkey(), &to_trade, &from_trade, &profit);
|
||||
client
|
||||
.send_instruction(&owner, instruction)
|
||||
.send_and_confirm_instruction(&owner, instruction)
|
||||
.unwrap_or_else(|_| panic!("{}:{}", line!(), file!()));
|
||||
|
||||
let new = create_token_account(&client, &owner);
|
||||
@ -873,13 +873,13 @@ mod test {
|
||||
let instruction =
|
||||
exchange_instruction::transfer_request(&owner.pubkey(), &new, &to_trade, Token::B, 1);
|
||||
client
|
||||
.send_instruction(&owner, instruction)
|
||||
.send_and_confirm_instruction(&owner, instruction)
|
||||
.unwrap_or_else(|_| panic!("{}:{}", line!(), file!()));
|
||||
|
||||
let instruction =
|
||||
exchange_instruction::transfer_request(&owner.pubkey(), &new, &from_trade, Token::A, 1);
|
||||
client
|
||||
.send_instruction(&owner, instruction)
|
||||
.send_and_confirm_instruction(&owner, instruction)
|
||||
.unwrap_or_else(|_| panic!("{}:{}", line!(), file!()));
|
||||
|
||||
let new_account_data = client.get_account_data(&new).unwrap().unwrap();
|
||||
|
@ -20,7 +20,7 @@ fn test_program_native_failure() {
|
||||
let bank_client = BankClient::new(bank);
|
||||
assert_eq!(
|
||||
bank_client
|
||||
.send_instruction(&alice_keypair, instruction)
|
||||
.send_and_confirm_instruction(&alice_keypair, instruction)
|
||||
.unwrap_err()
|
||||
.unwrap(),
|
||||
TransactionError::InstructionError(0, InstructionError::Custom(0))
|
||||
|
@ -30,7 +30,7 @@ pub fn create_genesis<T: Client>(from: &Keypair, client: &T, amount: u64) -> Key
|
||||
);
|
||||
|
||||
client
|
||||
.send_message(
|
||||
.send_and_confirm_message(
|
||||
&[&from, &genesis],
|
||||
Message::new(&[instruction], Some(&from.pubkey())),
|
||||
)
|
||||
@ -38,7 +38,7 @@ pub fn create_genesis<T: Client>(from: &Keypair, client: &T, amount: u64) -> Key
|
||||
|
||||
let instruction = librapay_instruction::genesis(&genesis.pubkey(), amount);
|
||||
let message = Message::new(&[instruction], Some(&from.pubkey()));
|
||||
client.send_message(&[from, &genesis], message).unwrap();
|
||||
client.send_and_confirm_message(&[from, &genesis], message).unwrap();
|
||||
|
||||
genesis
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ mod tests {
|
||||
lamports,
|
||||
);
|
||||
let message = Message::new(&instructions, Some(&payer_keypair.pubkey()));
|
||||
bank_client.send_message(&[payer_keypair, account_keypair], message)
|
||||
bank_client.send_and_confirm_message(&[payer_keypair, account_keypair], message)
|
||||
}
|
||||
|
||||
fn send_set_owner(
|
||||
@ -110,7 +110,7 @@ mod tests {
|
||||
new_owner_pubkey,
|
||||
);
|
||||
let message = Message::new(&[instruction], Some(&payer_keypair.pubkey()));
|
||||
bank_client.send_message(&[payer_keypair, old_owner_keypair], message)
|
||||
bank_client.send_and_confirm_message(&[payer_keypair, old_owner_keypair], message)
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -184,7 +184,7 @@ mod tests {
|
||||
instructions.push(date_instruction::store(&date_pubkey, date));
|
||||
|
||||
let message = Message::new(&instructions, Some(&payer_keypair.pubkey()));
|
||||
bank_client.send_message(&[payer_keypair, date_keypair], message)
|
||||
bank_client.send_and_confirm_message(&[payer_keypair, date_keypair], message)
|
||||
}
|
||||
|
||||
fn store_date(
|
||||
@ -196,7 +196,7 @@ mod tests {
|
||||
let date_pubkey = date_keypair.pubkey();
|
||||
let instruction = date_instruction::store(&date_pubkey, date);
|
||||
let message = Message::new(&[instruction], Some(&payer_keypair.pubkey()));
|
||||
bank_client.send_message(&[payer_keypair, date_keypair], message)
|
||||
bank_client.send_and_confirm_message(&[payer_keypair, date_keypair], message)
|
||||
}
|
||||
|
||||
fn create_vest_account(
|
||||
@ -219,7 +219,7 @@ mod tests {
|
||||
lamports,
|
||||
);
|
||||
let message = Message::new(&instructions, Some(&payer_keypair.pubkey()));
|
||||
bank_client.send_message(&[payer_keypair, contract_keypair], message)
|
||||
bank_client.send_and_confirm_message(&[payer_keypair, contract_keypair], message)
|
||||
}
|
||||
|
||||
fn send_set_terminator(
|
||||
@ -230,7 +230,7 @@ mod tests {
|
||||
) -> Result<Signature> {
|
||||
let instruction =
|
||||
vest_instruction::set_terminator(&contract_pubkey, &old_keypair.pubkey(), &new_pubkey);
|
||||
bank_client.send_instruction(&old_keypair, instruction)
|
||||
bank_client.send_and_confirm_instruction(&old_keypair, instruction)
|
||||
}
|
||||
|
||||
fn send_set_payee(
|
||||
@ -241,7 +241,7 @@ mod tests {
|
||||
) -> Result<Signature> {
|
||||
let instruction =
|
||||
vest_instruction::set_payee(&contract_pubkey, &old_keypair.pubkey(), &new_pubkey);
|
||||
bank_client.send_instruction(&old_keypair, instruction)
|
||||
bank_client.send_and_confirm_instruction(&old_keypair, instruction)
|
||||
}
|
||||
|
||||
fn send_redeem_tokens(
|
||||
@ -254,7 +254,7 @@ mod tests {
|
||||
let instruction =
|
||||
vest_instruction::redeem_tokens(&contract_pubkey, &date_pubkey, &payee_pubkey);
|
||||
let message = Message::new(&[instruction], Some(&payer_keypair.pubkey()));
|
||||
bank_client.send_message(&[payer_keypair], message)
|
||||
bank_client.send_and_confirm_message(&[payer_keypair], message)
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -352,7 +352,7 @@ mod tests {
|
||||
let message = Message::new(&instructions, Some(&alice_keypair.pubkey()));
|
||||
assert_eq!(
|
||||
bank_client
|
||||
.send_message(&[&alice_keypair, &contract_keypair], message)
|
||||
.send_and_confirm_message(&[&alice_keypair, &contract_keypair], message)
|
||||
.unwrap_err()
|
||||
.unwrap(),
|
||||
TransactionError::InstructionError(1, InstructionError::NotEnoughAccountKeys)
|
||||
@ -387,7 +387,7 @@ mod tests {
|
||||
// Transfer bob a token to pay the transaction fee.
|
||||
let mallory_keypair = Keypair::new();
|
||||
bank_client
|
||||
.transfer(1, &alice_keypair, &mallory_keypair.pubkey())
|
||||
.transfer_and_confirm(1, &alice_keypair, &mallory_keypair.pubkey())
|
||||
.unwrap();
|
||||
send_set_payee(
|
||||
&bank_client,
|
||||
@ -397,9 +397,9 @@ mod tests {
|
||||
)
|
||||
.unwrap_err();
|
||||
|
||||
// Ensure bob can update which account he wants vested funds transfered to.
|
||||
// Ensure bob can update which account he wants vested funds transferred to.
|
||||
bank_client
|
||||
.transfer(1, &alice_keypair, &bob_pubkey)
|
||||
.transfer_and_confirm(1, &alice_keypair, &bob_pubkey)
|
||||
.unwrap();
|
||||
send_set_payee(
|
||||
&bank_client,
|
||||
@ -458,7 +458,7 @@ mod tests {
|
||||
// Transfer bob a token to pay the transaction fee.
|
||||
let mallory_keypair = Keypair::new();
|
||||
bank_client
|
||||
.transfer(1, &alice_keypair, &mallory_keypair.pubkey())
|
||||
.transfer_and_confirm(1, &alice_keypair, &mallory_keypair.pubkey())
|
||||
.unwrap();
|
||||
send_set_payee(
|
||||
&bank_client,
|
||||
@ -470,7 +470,7 @@ mod tests {
|
||||
|
||||
// Ensure bob can update which account he wants vested funds transferred to.
|
||||
bank_client
|
||||
.transfer(1, &alice_keypair, &bob_pubkey)
|
||||
.transfer_and_confirm(1, &alice_keypair, &bob_pubkey)
|
||||
.unwrap();
|
||||
send_set_payee(
|
||||
&bank_client,
|
||||
@ -586,7 +586,7 @@ mod tests {
|
||||
let instruction =
|
||||
vest_instruction::terminate(&contract_pubkey, &alice_pubkey, &alice_pubkey);
|
||||
bank_client
|
||||
.send_instruction(&alice_keypair, instruction)
|
||||
.send_and_confirm_instruction(&alice_keypair, instruction)
|
||||
.unwrap();
|
||||
assert_eq!(bank_client.get_balance(&alice_pubkey).unwrap(), 2);
|
||||
assert_eq!(
|
||||
@ -630,7 +630,7 @@ mod tests {
|
||||
let instruction =
|
||||
vest_instruction::terminate(&contract_pubkey, &alice_pubkey, &carol_pubkey);
|
||||
bank_client
|
||||
.send_instruction(&alice_keypair, instruction)
|
||||
.send_and_confirm_instruction(&alice_keypair, instruction)
|
||||
.unwrap();
|
||||
assert_eq!(bank_client.get_balance(&alice_pubkey).unwrap(), 1);
|
||||
assert_eq!(bank_client.get_balance(&carol_pubkey).unwrap(), 1);
|
||||
@ -675,7 +675,7 @@ mod tests {
|
||||
let instruction =
|
||||
vest_instruction::renege(&contract_pubkey, &alice_pubkey, &carol_pubkey, 1);
|
||||
bank_client
|
||||
.send_instruction(&alice_keypair, instruction)
|
||||
.send_and_confirm_instruction(&alice_keypair, instruction)
|
||||
.unwrap();
|
||||
assert_eq!(bank_client.get_balance(&alice_pubkey).unwrap(), 1);
|
||||
assert_eq!(bank_client.get_balance(&carol_pubkey).unwrap(), 1);
|
||||
|
Reference in New Issue
Block a user