hopr_chain_actions::payload

Trait PayloadGenerator

Source
pub trait PayloadGenerator<T: Into<TypedTransaction>> {
    // Required methods
    fn approve(&self, spender: Address, amount: Balance) -> Result<T>;
    fn transfer(&self, destination: Address, amount: Balance) -> Result<T>;
    fn announce(&self, announcement: AnnouncementData) -> Result<T>;
    fn fund_channel(&self, dest: Address, amount: Balance) -> Result<T>;
    fn close_incoming_channel(&self, source: Address) -> Result<T>;
    fn initiate_outgoing_channel_closure(
        &self,
        destination: Address,
    ) -> Result<T>;
    fn finalize_outgoing_channel_closure(
        &self,
        destination: Address,
    ) -> Result<T>;
    fn redeem_ticket(&self, acked_ticket: RedeemableTicket) -> Result<T>;
    fn register_safe_by_node(&self, safe_addr: Address) -> Result<T>;
    fn deregister_node_by_safe(&self) -> Result<T>;
}
Expand description

Trait for various implementations of generators of common on-chain transaction payloads.

Required Methods§

Source

fn approve(&self, spender: Address, amount: Balance) -> Result<T>

Create a ERC20 approve transaction payload. Pre-requisite to open payment channels. The spender address is typically the HOPR Channels contract address.

Source

fn transfer(&self, destination: Address, amount: Balance) -> Result<T>

Create a ERC20 transfer transaction payload

Source

fn announce(&self, announcement: AnnouncementData) -> Result<T>

Creates the transaction payload to announce a node on-chain.

Source

fn fund_channel(&self, dest: Address, amount: Balance) -> Result<T>

Creates the transaction payload to open a payment channel

Source

fn close_incoming_channel(&self, source: Address) -> Result<T>

Creates the transaction payload to immediately close an incoming payment channel

Source

fn initiate_outgoing_channel_closure(&self, destination: Address) -> Result<T>

Creates the transaction payload that initiates the closure of a payment channel. Once the notice period is due, the funds can be withdrawn using a finalizeChannelClosure transaction.

Source

fn finalize_outgoing_channel_closure(&self, destination: Address) -> Result<T>

Creates a transaction payload that withdraws funds from an outgoing payment channel. This will succeed once the closure notice period is due.

Source

fn redeem_ticket(&self, acked_ticket: RedeemableTicket) -> Result<T>

Used to create the payload to claim incentives for relaying a mixnet packet.

Source

fn register_safe_by_node(&self, safe_addr: Address) -> Result<T>

Creates a transaction payload to register a Safe instance which is used to manage the node’s funds

Source

fn deregister_node_by_safe(&self) -> Result<T>

Creates a transaction payload to remove the Safe instance. Once succeeded, the funds are no longer managed by the node.

Implementors§