- Struct
ScriptBuf
- Function
new
- Function
bytes
- Function
is_p2sh
- Function
p2sh_script_hash
- Function
is_p2pkh
- Function
p2pkh_pubkey_hash
- Function
is_witness_program
- Function
witness_program
- Function
get_address
- Function
is_op_return
use 0x1::option;
use 0x3::bitcoin_address;
use 0x4::opcode;
#[data_struct]
struct ScriptBuf has copy, drop, store
public fun new(bytes: vector<u8>): script_buf::ScriptBuf
public fun bytes(self: &script_buf::ScriptBuf): &vector<u8>
Checks if the given script is a P2SH script.
public fun is_p2sh(self: &script_buf::ScriptBuf): bool
Get the script hash from a P2SH script. This function does not check if the script is a P2SH script, the caller must do that.
public fun p2sh_script_hash(self: &script_buf::ScriptBuf): vector<u8>
Checks if the given script is a P2PKH script.
public fun is_p2pkh(self: &script_buf::ScriptBuf): bool
Get the public key hash from a P2PKH script. This function does not check if the script is a P2PKH script, the caller must do that.
public fun p2pkh_pubkey_hash(self: &script_buf::ScriptBuf): vector<u8>
public fun is_witness_program(self: &script_buf::ScriptBuf): bool
Get the witness program from a witness program script.
public fun witness_program(self: &script_buf::ScriptBuf): vector<u8>
try to get a BitcoinAddress from a ScriptBuf.
public fun get_address(s: &script_buf::ScriptBuf): option::Option<bitcoin_address::BitcoinAddress>
Checks if the given script is an OP_RETURN script.
public fun is_op_return(self: &script_buf::ScriptBuf): bool