Crates.io | multisig-lite |
lib.rs | multisig-lite |
version | 0.0.8 |
source | src |
created_at | 2023-02-01 19:43:04.652048 |
updated_at | 2023-02-13 07:29:28.830992 |
description | A native SOL multisig on-chain program |
homepage | https://github.com/keithnoguchi/multisig-lite |
repository | https://github.com/keithnoguchi/multisig-lite |
max_upload_size | |
id | 774103 |
size | 234,293 |
A native SOL multisig on-chain program for Solana Blockchain.
Currently, there are five instructions to provide the queued multisig transfer operation:
Here is how to create a new multisig account on-chain.
Please refer to the multisig_lite::multisig_lite
module level
documentation for the other instructions' example.
use std::rc::Rc;
use solana_sdk::commitment_config::CommitmentConfig;
use solana_sdk::pubkey::Pubkey;
use solana_sdk::signature::read_keypair_file;
use solana_sdk::signer::Signer;
use solana_sdk::system_program;
use anchor_client::{Client, Cluster};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let url = Cluster::Devnet;
let funder = Rc::new(read_keypair_file(
shellexpand::tilde("~/.config/solana/id.json").as_ref(),
)?);
let opts = CommitmentConfig::processed();
let pid = multisig_lite::id();
let program = Client::new_with_options(url, funder.clone(), opts).program(pid);
// Gets the PDAs.
let (state_pda, state_bump) =
Pubkey::find_program_address(&[b"state", funder.pubkey().as_ref()], &pid);
let (fund_pda, fund_bump) = Pubkey::find_program_address(&[b"fund", state_pda.as_ref()], &pid);
// Creates a multisig account.
let sig = program
.request()
.accounts(multisig_lite::accounts::Create {
funder: funder.pubkey(),
state: state_pda,
fund: fund_pda,
system_program: system_program::id(),
})
.args(multisig_lite::instruction::Create {
m: 2, // m as in m/n.
signers: vec![funder.pubkey(), Pubkey::new_unique(), Pubkey::new_unique()],
q: 10, // transfer queue limit.
_state_bump: state_bump,
fund_bump,
})
.signer(funder.as_ref())
.send()?;
Ok(())
}
You can run solana-program-test based functional tests with the standard
cargo test
command:
$ cargo test
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.