Expand description

The handshake::nets module cotains Handshake network definitions. These are the main interface for accessing the library.

Expected user flow is to import the network and access the transaction builder through it. This gives the user immediate access to the full Handshake toolchain via a single import.

use handshakes::{HandshakeMainnet, enc::Address, types::txin::Outpoint};
use coins_core::{
    nets::Network,
    builder::TxBuilder,
    ser::ByteFormat,
};

let address = HandshakeMainnet::string_to_address("hs1qqzlmrc6phwz2drwshstcr30vuhjacv5z0u2x9l").unwrap();

let b = HandshakeMainnet::tx_builder();
b.version(2)
 .spend(Outpoint::default(), 0xaabbccdd)
 .pay(0x8888_8888_8888_8888, &address)
 .pay(0x7777_7777_7777_7777, &Address::Wsh("hs1qjhgt8dwvhwapf2a5v9865nmrrqhhqlz38w3zze".to_owned()))
 .build()
 .unwrap()
 .serialize_hex();

let script = HandshakeMainnet::decode_address(&address);
let re_encoded = HandshakeMainnet::encode_address(&script).unwrap();
assert_eq!(address, re_encoded);

Structs

A newtype for Handshake networks, parameterized by an encoder. We change the encoder to differentiate between main, test, and signet.

Type Definitions

A fully-parameterized HandshakeMainnet. This is the main interface for accessing the library.

A fully-parameterized HandshakeSignet. This is the main interface for accessing the library.

A fully-parameterized HandshakeTestnet. This is the main interface for accessing the library.