Introducing Scripts
A sequence of instructions. A client compiles the script and then uses the compiled script to construction a transaction. Then it adds a adds a blockhash, signs the transaction, and sends it off for processing.
This commit is contained in:
@ -143,9 +143,10 @@ pub fn process_instruction(
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use solana_budget_api::budget_transaction::BudgetTransaction;
|
||||
use solana_budget_api::budget_instruction::BudgetInstruction;
|
||||
use solana_budget_api::id;
|
||||
use solana_runtime::bank::Bank;
|
||||
use solana_runtime::bank_client::BankClient;
|
||||
use solana_sdk::genesis_block::GenesisBlock;
|
||||
use solana_sdk::signature::{Keypair, KeypairUtil};
|
||||
use solana_sdk::transaction::{InstructionError, Transaction, TransactionError};
|
||||
@ -157,41 +158,41 @@ mod test {
|
||||
(bank, mint_keypair)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_invalid_instruction() {
|
||||
let (bank, from) = create_bank(10_000);
|
||||
let blockhash = bank.last_blockhash();
|
||||
let contract = Keypair::new();
|
||||
let data = (1u8, 2u8, 3u8);
|
||||
let tx = Transaction::new_signed(&from, &[contract.pubkey()], &id(), &data, blockhash, 0);
|
||||
assert!(bank.process_transaction(&tx).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_unsigned_witness_key() {
|
||||
let (bank, from) = create_bank(10_000);
|
||||
let blockhash = bank.last_blockhash();
|
||||
let (bank, mint_keypair) = create_bank(10_000);
|
||||
let alice_client = BankClient::new(&bank, mint_keypair);
|
||||
let alice_pubkey = alice_client.pubkey();
|
||||
|
||||
// Initialize BudgetState
|
||||
let contract = Keypair::new().pubkey();
|
||||
let to = Keypair::new().pubkey();
|
||||
let budget_pubkey = Keypair::new().pubkey();
|
||||
let bob_pubkey = Keypair::new().pubkey();
|
||||
let witness = Keypair::new().pubkey();
|
||||
let tx =
|
||||
BudgetTransaction::new_when_signed(&from, &to, &contract, &witness, None, 1, blockhash);
|
||||
bank.process_transaction(&tx).unwrap();
|
||||
let script = BudgetInstruction::new_when_signed_script(
|
||||
&alice_pubkey,
|
||||
&bob_pubkey,
|
||||
&budget_pubkey,
|
||||
&witness,
|
||||
None,
|
||||
1,
|
||||
);
|
||||
alice_client.process_script(script).unwrap();
|
||||
|
||||
// Attack! Part 1: Sign a witness transaction with a random key.
|
||||
let rando = Keypair::new();
|
||||
bank.transfer(1, &from, &rando.pubkey(), blockhash).unwrap();
|
||||
let mut tx = BudgetTransaction::new_signature(&rando, &contract, &to, blockhash);
|
||||
let mallory_client = BankClient::new(&bank, Keypair::new());
|
||||
let mallory_pubkey = mallory_client.pubkey();
|
||||
alice_client.transfer(1, &mallory_pubkey).unwrap();
|
||||
let instruction =
|
||||
BudgetInstruction::new_apply_signature(&mallory_pubkey, &budget_pubkey, &bob_pubkey);
|
||||
let mut transaction = Transaction::new(vec![instruction]);
|
||||
|
||||
// Attack! Part 2: Point the instruction to the expected, but unsigned, key.
|
||||
tx.account_keys.push(from.pubkey());
|
||||
tx.instructions[0].accounts[0] = 3;
|
||||
transaction.account_keys.push(alice_pubkey);
|
||||
transaction.instructions[0].accounts[0] = 3;
|
||||
|
||||
// Ensure the transaction fails because of the unsigned key.
|
||||
assert_eq!(
|
||||
bank.process_transaction(&tx),
|
||||
mallory_client.process_transaction(transaction),
|
||||
Err(TransactionError::InstructionError(
|
||||
0,
|
||||
InstructionError::ProgramError(ProgramError::MissingRequiredSignature)
|
||||
@ -201,37 +202,44 @@ mod test {
|
||||
|
||||
#[test]
|
||||
fn test_unsigned_timestamp() {
|
||||
let (bank, from) = create_bank(10_000);
|
||||
let blockhash = bank.last_blockhash();
|
||||
let (bank, mint_keypair) = create_bank(10_000);
|
||||
let alice_client = BankClient::new(&bank, mint_keypair);
|
||||
let alice_pubkey = alice_client.pubkey();
|
||||
|
||||
// Initialize BudgetState
|
||||
let contract = Keypair::new().pubkey();
|
||||
let to = Keypair::new().pubkey();
|
||||
let budget_pubkey = Keypair::new().pubkey();
|
||||
let bob_pubkey = Keypair::new().pubkey();
|
||||
let dt = Utc::now();
|
||||
let tx = BudgetTransaction::new_on_date(
|
||||
&from,
|
||||
&to,
|
||||
&contract,
|
||||
let script = BudgetInstruction::new_on_date_script(
|
||||
&alice_pubkey,
|
||||
&bob_pubkey,
|
||||
&budget_pubkey,
|
||||
dt,
|
||||
&from.pubkey(),
|
||||
&alice_pubkey,
|
||||
None,
|
||||
1,
|
||||
blockhash,
|
||||
);
|
||||
bank.process_transaction(&tx).unwrap();
|
||||
alice_client.process_script(script).unwrap();
|
||||
|
||||
// Attack! Part 1: Sign a timestamp transaction with a random key.
|
||||
let rando = Keypair::new();
|
||||
bank.transfer(1, &from, &rando.pubkey(), blockhash).unwrap();
|
||||
let mut tx = BudgetTransaction::new_timestamp(&rando, &contract, &to, dt, blockhash);
|
||||
let mallory_client = BankClient::new(&bank, Keypair::new());
|
||||
let mallory_pubkey = mallory_client.pubkey();
|
||||
alice_client.transfer(1, &mallory_pubkey).unwrap();
|
||||
let instruction = BudgetInstruction::new_apply_timestamp(
|
||||
&mallory_pubkey,
|
||||
&budget_pubkey,
|
||||
&bob_pubkey,
|
||||
dt,
|
||||
);
|
||||
let mut transaction = Transaction::new(vec![instruction]);
|
||||
|
||||
// Attack! Part 2: Point the instruction to the expected, but unsigned, key.
|
||||
tx.account_keys.push(from.pubkey());
|
||||
tx.instructions[0].accounts[0] = 3;
|
||||
transaction.account_keys.push(alice_pubkey);
|
||||
transaction.instructions[0].accounts[0] = 3;
|
||||
|
||||
// Ensure the transaction fails because of the unsigned key.
|
||||
assert_eq!(
|
||||
bank.process_transaction(&tx),
|
||||
mallory_client.process_transaction(transaction),
|
||||
Err(TransactionError::InstructionError(
|
||||
0,
|
||||
InstructionError::ProgramError(ProgramError::MissingRequiredSignature)
|
||||
@ -241,40 +249,39 @@ mod test {
|
||||
|
||||
#[test]
|
||||
fn test_transfer_on_date() {
|
||||
let (bank, from) = create_bank(2);
|
||||
let blockhash = bank.last_blockhash();
|
||||
let contract = Keypair::new();
|
||||
let to = Keypair::new();
|
||||
let rando = Keypair::new();
|
||||
let (bank, mint_keypair) = create_bank(2);
|
||||
let alice_client = BankClient::new(&bank, mint_keypair);
|
||||
let alice_pubkey = alice_client.pubkey();
|
||||
let budget_pubkey = Keypair::new().pubkey();
|
||||
let bob_pubkey = Keypair::new().pubkey();
|
||||
let mallory_pubkey = Keypair::new().pubkey();
|
||||
let dt = Utc::now();
|
||||
let tx = BudgetTransaction::new_on_date(
|
||||
&from,
|
||||
&to.pubkey(),
|
||||
&contract.pubkey(),
|
||||
let script = BudgetInstruction::new_on_date_script(
|
||||
&alice_pubkey,
|
||||
&bob_pubkey,
|
||||
&budget_pubkey,
|
||||
dt,
|
||||
&from.pubkey(),
|
||||
&alice_pubkey,
|
||||
None,
|
||||
1,
|
||||
blockhash,
|
||||
);
|
||||
bank.process_transaction(&tx).unwrap();
|
||||
assert_eq!(bank.get_balance(&from.pubkey()), 1);
|
||||
assert_eq!(bank.get_balance(&contract.pubkey()), 1);
|
||||
alice_client.process_script(script).unwrap();
|
||||
assert_eq!(bank.get_balance(&alice_pubkey), 1);
|
||||
assert_eq!(bank.get_balance(&budget_pubkey), 1);
|
||||
|
||||
let contract_account = bank.get_account(&contract.pubkey()).unwrap();
|
||||
let contract_account = bank.get_account(&budget_pubkey).unwrap();
|
||||
let budget_state = BudgetState::deserialize(&contract_account.data).unwrap();
|
||||
assert!(budget_state.is_pending());
|
||||
|
||||
// Attack! Try to payout to a rando key
|
||||
let tx = BudgetTransaction::new_timestamp(
|
||||
&from,
|
||||
&contract.pubkey(),
|
||||
&rando.pubkey(),
|
||||
// Attack! Try to payout to mallory_pubkey
|
||||
let instruction = BudgetInstruction::new_apply_timestamp(
|
||||
&alice_pubkey,
|
||||
&budget_pubkey,
|
||||
&mallory_pubkey,
|
||||
dt,
|
||||
blockhash,
|
||||
);
|
||||
assert_eq!(
|
||||
bank.process_transaction(&tx).unwrap_err(),
|
||||
alice_client.process_script(vec![instruction]).unwrap_err(),
|
||||
TransactionError::InstructionError(
|
||||
0,
|
||||
InstructionError::ProgramError(ProgramError::CustomError(
|
||||
@ -282,77 +289,71 @@ mod test {
|
||||
))
|
||||
)
|
||||
);
|
||||
assert_eq!(bank.get_balance(&from.pubkey()), 1);
|
||||
assert_eq!(bank.get_balance(&contract.pubkey()), 1);
|
||||
assert_eq!(bank.get_balance(&to.pubkey()), 0);
|
||||
assert_eq!(bank.get_balance(&alice_pubkey), 1);
|
||||
assert_eq!(bank.get_balance(&budget_pubkey), 1);
|
||||
assert_eq!(bank.get_balance(&bob_pubkey), 0);
|
||||
|
||||
let contract_account = bank.get_account(&contract.pubkey()).unwrap();
|
||||
let contract_account = bank.get_account(&budget_pubkey).unwrap();
|
||||
let budget_state = BudgetState::deserialize(&contract_account.data).unwrap();
|
||||
assert!(budget_state.is_pending());
|
||||
|
||||
// Now, acknowledge the time in the condition occurred and
|
||||
// that pubkey's funds are now available.
|
||||
let tx = BudgetTransaction::new_timestamp(
|
||||
&from,
|
||||
&contract.pubkey(),
|
||||
&to.pubkey(),
|
||||
dt,
|
||||
blockhash,
|
||||
);
|
||||
bank.process_transaction(&tx).unwrap();
|
||||
assert_eq!(bank.get_balance(&from.pubkey()), 1);
|
||||
assert_eq!(bank.get_balance(&contract.pubkey()), 0);
|
||||
assert_eq!(bank.get_balance(&to.pubkey()), 1);
|
||||
assert_eq!(bank.get_account(&contract.pubkey()), None);
|
||||
let instruction =
|
||||
BudgetInstruction::new_apply_timestamp(&alice_pubkey, &budget_pubkey, &bob_pubkey, dt);
|
||||
alice_client.process_script(vec![instruction]).unwrap();
|
||||
assert_eq!(bank.get_balance(&alice_pubkey), 1);
|
||||
assert_eq!(bank.get_balance(&budget_pubkey), 0);
|
||||
assert_eq!(bank.get_balance(&bob_pubkey), 1);
|
||||
assert_eq!(bank.get_account(&budget_pubkey), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_cancel_transfer() {
|
||||
let (bank, from) = create_bank(3);
|
||||
let blockhash = bank.last_blockhash();
|
||||
let contract = Keypair::new();
|
||||
let to = Keypair::new();
|
||||
let (bank, mint_keypair) = create_bank(3);
|
||||
let alice_client = BankClient::new(&bank, mint_keypair);
|
||||
let alice_pubkey = alice_client.pubkey();
|
||||
let budget_pubkey = Keypair::new().pubkey();
|
||||
let bob_pubkey = Keypair::new().pubkey();
|
||||
let dt = Utc::now();
|
||||
|
||||
let tx = BudgetTransaction::new_on_date(
|
||||
&from,
|
||||
&to.pubkey(),
|
||||
&contract.pubkey(),
|
||||
let script = BudgetInstruction::new_on_date_script(
|
||||
&alice_pubkey,
|
||||
&bob_pubkey,
|
||||
&budget_pubkey,
|
||||
dt,
|
||||
&from.pubkey(),
|
||||
Some(from.pubkey()),
|
||||
&alice_pubkey,
|
||||
Some(alice_pubkey),
|
||||
1,
|
||||
blockhash,
|
||||
);
|
||||
bank.process_transaction(&tx).unwrap();
|
||||
assert_eq!(bank.get_balance(&from.pubkey()), 2);
|
||||
assert_eq!(bank.get_balance(&contract.pubkey()), 1);
|
||||
alice_client.process_script(script).unwrap();
|
||||
assert_eq!(bank.get_balance(&alice_pubkey), 2);
|
||||
assert_eq!(bank.get_balance(&budget_pubkey), 1);
|
||||
|
||||
let contract_account = bank.get_account(&contract.pubkey()).unwrap();
|
||||
let contract_account = bank.get_account(&budget_pubkey).unwrap();
|
||||
let budget_state = BudgetState::deserialize(&contract_account.data).unwrap();
|
||||
assert!(budget_state.is_pending());
|
||||
|
||||
// Attack! try to put the lamports into the wrong account with cancel
|
||||
let rando = Keypair::new();
|
||||
bank.transfer(1, &from, &rando.pubkey(), blockhash).unwrap();
|
||||
assert_eq!(bank.get_balance(&from.pubkey()), 1);
|
||||
let mallory_client = BankClient::new(&bank, Keypair::new());
|
||||
let mallory_pubkey = mallory_client.pubkey();
|
||||
alice_client.transfer(1, &mallory_pubkey).unwrap();
|
||||
assert_eq!(bank.get_balance(&alice_pubkey), 1);
|
||||
|
||||
let tx =
|
||||
BudgetTransaction::new_signature(&rando, &contract.pubkey(), &to.pubkey(), blockhash);
|
||||
// unit test hack, the `from account` is passed instead of the `to` account to avoid
|
||||
// creating more account vectors
|
||||
bank.process_transaction(&tx).unwrap();
|
||||
let instruction =
|
||||
BudgetInstruction::new_apply_signature(&mallory_pubkey, &budget_pubkey, &bob_pubkey);
|
||||
mallory_client.process_script(vec![instruction]).unwrap();
|
||||
// nothing should be changed because apply witness didn't finalize a payment
|
||||
assert_eq!(bank.get_balance(&from.pubkey()), 1);
|
||||
assert_eq!(bank.get_balance(&contract.pubkey()), 1);
|
||||
assert_eq!(bank.get_account(&to.pubkey()), None);
|
||||
assert_eq!(bank.get_balance(&alice_pubkey), 1);
|
||||
assert_eq!(bank.get_balance(&budget_pubkey), 1);
|
||||
assert_eq!(bank.get_account(&bob_pubkey), None);
|
||||
|
||||
// Now, cancel the transaction. from gets her funds back
|
||||
let tx =
|
||||
BudgetTransaction::new_signature(&from, &contract.pubkey(), &from.pubkey(), blockhash);
|
||||
bank.process_transaction(&tx).unwrap();
|
||||
assert_eq!(bank.get_balance(&from.pubkey()), 2);
|
||||
assert_eq!(bank.get_account(&contract.pubkey()), None);
|
||||
assert_eq!(bank.get_account(&to.pubkey()), None);
|
||||
// Now, cancel the transaction. mint gets her funds back
|
||||
let instruction =
|
||||
BudgetInstruction::new_apply_signature(&alice_pubkey, &budget_pubkey, &alice_pubkey);
|
||||
alice_client.process_script(vec![instruction]).unwrap();
|
||||
assert_eq!(bank.get_balance(&alice_pubkey), 2);
|
||||
assert_eq!(bank.get_account(&budget_pubkey), None);
|
||||
assert_eq!(bank.get_account(&bob_pubkey), None);
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,12 @@
|
||||
use crate::budget_expr::BudgetExpr;
|
||||
use crate::budget_expr::{BudgetExpr, Condition};
|
||||
use crate::budget_state::BudgetState;
|
||||
use crate::id;
|
||||
use bincode::serialized_size;
|
||||
use chrono::prelude::{DateTime, Utc};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
use solana_sdk::transaction::Instruction;
|
||||
use solana_sdk::system_instruction::SystemInstruction;
|
||||
use solana_sdk::transaction::{Instruction, Script};
|
||||
|
||||
/// A smart contract.
|
||||
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Clone)]
|
||||
@ -37,6 +40,80 @@ impl BudgetInstruction {
|
||||
Instruction::new(id(), &BudgetInstruction::InitializeAccount(expr), keys)
|
||||
}
|
||||
|
||||
pub fn new_initialize_account_script(
|
||||
from: &Pubkey,
|
||||
contract: &Pubkey,
|
||||
lamports: u64,
|
||||
expr: BudgetExpr,
|
||||
) -> Script {
|
||||
let space = serialized_size(&BudgetState::new(expr.clone())).unwrap();
|
||||
vec![
|
||||
SystemInstruction::new_program_account(&from, contract, lamports, space, &id()),
|
||||
Self::new_initialize_account(contract, expr),
|
||||
]
|
||||
}
|
||||
|
||||
/// Create a postdated payment script.
|
||||
pub fn new_on_date_script(
|
||||
from: &Pubkey,
|
||||
to: &Pubkey,
|
||||
contract: &Pubkey,
|
||||
dt: DateTime<Utc>,
|
||||
dt_pubkey: &Pubkey,
|
||||
cancelable: Option<Pubkey>,
|
||||
lamports: u64,
|
||||
) -> Script {
|
||||
let expr = if let Some(from) = cancelable {
|
||||
BudgetExpr::Or(
|
||||
(
|
||||
Condition::Timestamp(dt, *dt_pubkey),
|
||||
Box::new(BudgetExpr::new_payment(lamports, to)),
|
||||
),
|
||||
(
|
||||
Condition::Signature(from),
|
||||
Box::new(BudgetExpr::new_payment(lamports, &from)),
|
||||
),
|
||||
)
|
||||
} else {
|
||||
BudgetExpr::After(
|
||||
Condition::Timestamp(dt, *dt_pubkey),
|
||||
Box::new(BudgetExpr::new_payment(lamports, to)),
|
||||
)
|
||||
};
|
||||
|
||||
Self::new_initialize_account_script(from, contract, lamports, expr)
|
||||
}
|
||||
|
||||
/// Create a multisig payment script.
|
||||
pub fn new_when_signed_script(
|
||||
from: &Pubkey,
|
||||
to: &Pubkey,
|
||||
contract: &Pubkey,
|
||||
witness: &Pubkey,
|
||||
cancelable: Option<Pubkey>,
|
||||
lamports: u64,
|
||||
) -> Script {
|
||||
let expr = if let Some(from) = cancelable {
|
||||
BudgetExpr::Or(
|
||||
(
|
||||
Condition::Signature(*witness),
|
||||
Box::new(BudgetExpr::new_payment(lamports, to)),
|
||||
),
|
||||
(
|
||||
Condition::Signature(from),
|
||||
Box::new(BudgetExpr::new_payment(lamports, &from)),
|
||||
),
|
||||
)
|
||||
} else {
|
||||
BudgetExpr::After(
|
||||
Condition::Signature(*witness),
|
||||
Box::new(BudgetExpr::new_payment(lamports, to)),
|
||||
)
|
||||
};
|
||||
|
||||
Self::new_initialize_account_script(from, contract, lamports, expr)
|
||||
}
|
||||
|
||||
pub fn new_apply_timestamp(
|
||||
from: &Pubkey,
|
||||
contract: &Pubkey,
|
||||
|
@ -1,6 +1,6 @@
|
||||
//! The `budget_transaction` module provides functionality for creating Budget transactions.
|
||||
|
||||
use crate::budget_expr::{BudgetExpr, Condition};
|
||||
use crate::budget_expr::BudgetExpr;
|
||||
use crate::budget_instruction::BudgetInstruction;
|
||||
use crate::budget_state::BudgetState;
|
||||
use crate::id;
|
||||
@ -10,7 +10,7 @@ use solana_sdk::hash::Hash;
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
use solana_sdk::signature::{Keypair, KeypairUtil};
|
||||
use solana_sdk::system_instruction::SystemInstruction;
|
||||
use solana_sdk::transaction::Transaction;
|
||||
use solana_sdk::transaction::{Script, Transaction};
|
||||
|
||||
pub struct BudgetTransaction {}
|
||||
|
||||
@ -36,6 +36,18 @@ impl BudgetTransaction {
|
||||
tx
|
||||
}
|
||||
|
||||
fn new_signed(
|
||||
from_keypair: &Keypair,
|
||||
script: Script,
|
||||
recent_blockhash: Hash,
|
||||
fee: u64,
|
||||
) -> Transaction {
|
||||
let mut tx = Transaction::new(script);
|
||||
tx.fee = fee;
|
||||
tx.sign(&[from_keypair], recent_blockhash);
|
||||
tx
|
||||
}
|
||||
|
||||
/// Create and sign a new Transaction. Used for unit-testing.
|
||||
pub fn new_payment(
|
||||
from_keypair: &Keypair,
|
||||
@ -96,24 +108,16 @@ impl BudgetTransaction {
|
||||
lamports: u64,
|
||||
recent_blockhash: Hash,
|
||||
) -> Transaction {
|
||||
let expr = if let Some(from) = cancelable {
|
||||
BudgetExpr::Or(
|
||||
(
|
||||
Condition::Timestamp(dt, *dt_pubkey),
|
||||
Box::new(BudgetExpr::new_payment(lamports, to)),
|
||||
),
|
||||
(
|
||||
Condition::Signature(from),
|
||||
Box::new(BudgetExpr::new_payment(lamports, &from)),
|
||||
),
|
||||
)
|
||||
} else {
|
||||
BudgetExpr::After(
|
||||
Condition::Timestamp(dt, *dt_pubkey),
|
||||
Box::new(BudgetExpr::new_payment(lamports, to)),
|
||||
)
|
||||
};
|
||||
Self::new(from_keypair, contract, expr, lamports, recent_blockhash, 0)
|
||||
let script = BudgetInstruction::new_on_date_script(
|
||||
&from_keypair.pubkey(),
|
||||
to,
|
||||
contract,
|
||||
dt,
|
||||
dt_pubkey,
|
||||
cancelable,
|
||||
lamports,
|
||||
);
|
||||
Self::new_signed(from_keypair, script, recent_blockhash, 0)
|
||||
}
|
||||
|
||||
/// Create and sign a multisig Transaction.
|
||||
@ -126,24 +130,15 @@ impl BudgetTransaction {
|
||||
lamports: u64,
|
||||
recent_blockhash: Hash,
|
||||
) -> Transaction {
|
||||
let expr = if let Some(from) = cancelable {
|
||||
BudgetExpr::Or(
|
||||
(
|
||||
Condition::Signature(*witness),
|
||||
Box::new(BudgetExpr::new_payment(lamports, to)),
|
||||
),
|
||||
(
|
||||
Condition::Signature(from),
|
||||
Box::new(BudgetExpr::new_payment(lamports, &from)),
|
||||
),
|
||||
)
|
||||
} else {
|
||||
BudgetExpr::After(
|
||||
Condition::Signature(*witness),
|
||||
Box::new(BudgetExpr::new_payment(lamports, to)),
|
||||
)
|
||||
};
|
||||
Self::new(from_keypair, contract, expr, lamports, recent_blockhash, 0)
|
||||
let script = BudgetInstruction::new_when_signed_script(
|
||||
&from_keypair.pubkey(),
|
||||
to,
|
||||
contract,
|
||||
witness,
|
||||
cancelable,
|
||||
lamports,
|
||||
);
|
||||
Self::new_signed(from_keypair, script, recent_blockhash, 0)
|
||||
}
|
||||
|
||||
pub fn system_instruction(tx: &Transaction, index: usize) -> Option<SystemInstruction> {
|
||||
|
Reference in New Issue
Block a user