1. Getting Started
  2. Quick Start

Getting Started

Quick Start

In this page:

πŸ“¦ Build & Deploy

To build and deploy the WalletGuise program run the following.

        # Build the program
cargo build-sbf --features="bpf-entrypoint clear_instructions"

# Deploy the program
solana program deploy target/deploy/wallet_guise_program.so --program-id target/deploy/wallet_guise_program-keypair.json

      

πŸ› οΈ Usage

πŸ¦€ Rust Example

The following shows how to construct the initial transaction to signup a public key for the next payout. The submitted Pubkey will receive a small amount of SOL to cover a transaction fee. Keep tunnel the transaction through WalletGuise to always have SOL for fees.

        use wallet_guise_program::ed25519::{KeyPair, SecretKey};
use wallet_guise_client::{
    pda::get_clue_account,
    clue_utils::find_valid_keys,
};
use solana_sdk::{
    pubkey::Pubkey,
    signature::Keypair,
    message::Message,
    transaction::Transaction,
};

let clue_account = get_clue_account(owner.pubkey()); // Owner is the creator of clue account.

let valid_keys = find_valid_keys(&client, &clue_account.0);

if valid_keys.is_empty() {
    println!("No valid keys, upgrade clue account...");
    panic!();
}

let clue = valid_keys[0].1.clue;

let disposible_keypair = KeyPair::grind_from_clue(clue).unwrap();

let secret_key = SecretKey::new(disposible_keypair);
let intermediate_public_key = secret_key.public_key();

let public_key = Pubkey::new_from_array(intermediate_public_key.0);

let my_secure_keypair = Keypair::new_from_seed(/*secure_seed*/); // Use a secure Keypair generation.

let signup_instruction = signup(Pubkey::new_from_array([199; 32]), public_key);
let mut transaction_message = Message::new(&[signup_instruction], Some(&public_key));

let recent_blockhash = client
    .get_latest_blockhash()
    .expect("Failed to get blockhash");

transaction_message.recent_blockhash = recent_blockhash;

let mut signup_transaction = Transaction::new_unsigned(transaction_message);

let message_bytes = signup_transaction.message().serialize();
let intermediate_transaction_signature = secret_key.sign(message_bytes, None);
let transaction_signature = solana_sdk::signature::Signature::try_from(intermediate_transaction_signature.0.to_vec()).unwrap();
signup_transaction.signatures = vec![transaction_signature];

signup_transaction.verify().unwrap();
assert!(signup_transaction.is_signed());

      

🌐 JavaScript Example

        import { prepayTransaction } from 'wallet-guise-client';