pub trait PayloadGenerator<T: Into<TransactionRequest>> {
// Required methods
fn approve(&self, spender: Address, amount: HoprBalance) -> Result<T>;
fn transfer<C: Currency>(
&self,
destination: Address,
amount: Balance<C>,
) -> Result<T>;
fn announce(&self, announcement: AnnouncementData) -> Result<T>;
fn fund_channel(&self, dest: Address, amount: HoprBalance) -> 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§
Sourcefn approve(&self, spender: Address, amount: HoprBalance) -> Result<T>
fn approve(&self, spender: Address, amount: HoprBalance) -> Result<T>
Create an ERC20 approve transaction payload. Pre-requisite to open payment channels.
The spender
address is typically the HOPR Channels contract address.
Sourcefn transfer<C: Currency>(
&self,
destination: Address,
amount: Balance<C>,
) -> Result<T>
fn transfer<C: Currency>( &self, destination: Address, amount: Balance<C>, ) -> Result<T>
Create a ERC20 transfer transaction payload
Sourcefn announce(&self, announcement: AnnouncementData) -> Result<T>
fn announce(&self, announcement: AnnouncementData) -> Result<T>
Creates the transaction payload to announce a node on-chain.
Sourcefn fund_channel(&self, dest: Address, amount: HoprBalance) -> Result<T>
fn fund_channel(&self, dest: Address, amount: HoprBalance) -> Result<T>
Creates the transaction payload to open a payment channel
Sourcefn close_incoming_channel(&self, source: Address) -> Result<T>
fn close_incoming_channel(&self, source: Address) -> Result<T>
Creates the transaction payload to immediately close an incoming payment channel
Sourcefn initiate_outgoing_channel_closure(&self, destination: Address) -> Result<T>
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.
Sourcefn finalize_outgoing_channel_closure(&self, destination: Address) -> Result<T>
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.
Sourcefn redeem_ticket(&self, acked_ticket: RedeemableTicket) -> Result<T>
fn redeem_ticket(&self, acked_ticket: RedeemableTicket) -> Result<T>
Used to create the payload to claim incentives for relaying a mixnet packet.
Sourcefn register_safe_by_node(&self, safe_addr: Address) -> Result<T>
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
Sourcefn deregister_node_by_safe(&self) -> Result<T>
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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.