axelar-cgp-sui

Module axelar_gateway::bytes32

use std::ascii;
use std::bcs;
use std::option;
use std::string;
use std::vector;
use sui::address;
use sui::bcs;
use sui::hex;

Struct Bytes32

public struct Bytes32 has copy, drop, store
Fields
bytes: address

Constants

const LENGTH: u64 = 32;

Function new

Casts an address to a bytes32

public fun new(bytes: address): axelar_gateway::bytes32::Bytes32
Implementation
public fun new(bytes: address): Bytes32 {
    Bytes32 { bytes: bytes }
}

Function default

public fun default(): axelar_gateway::bytes32::Bytes32
Implementation
public fun default(): Bytes32 {
    Bytes32 { bytes: @0x0 }
}

Function from_bytes

public fun from_bytes(bytes: vector<u8>): axelar_gateway::bytes32::Bytes32
Implementation
public fun from_bytes(bytes: vector<u8>): Bytes32 {
    new(address::from_bytes(bytes))
}

Function from_address

public fun from_address(addr: address): axelar_gateway::bytes32::Bytes32
Implementation
public fun from_address(addr: address): Bytes32 {
    new(addr)
}

Function to_bytes

public fun to_bytes(self: axelar_gateway::bytes32::Bytes32): vector<u8>
Implementation
public fun to_bytes(self: Bytes32): vector<u8> {
    self.bytes.to_bytes()
}

Function length

public fun length(_self: &axelar_gateway::bytes32::Bytes32): u64
Implementation
public fun length(_self: &Bytes32): u64 {
    LENGTH
}

Function peel

public(package) fun peel(bcs: &mut sui::bcs::BCS): axelar_gateway::bytes32::Bytes32
Implementation
public(package) fun peel(bcs: &mut BCS): Bytes32 {
    new(bcs.peel_address())
}