Struct raiden_api::api::Api

source ·
pub struct Api {
    pub raiden: Arc<Raiden>,
    /* private fields */
}
Expand description

The interface which enables initiating payments and interacting with contracts.

Fields§

§raiden: Arc<Raiden>

Implementations§

source§

impl Api

source

pub fn new( raiden: Arc<Raiden>, transition_service: Arc<Transitioner>, payments_registry: Arc<RwLock<PaymentsRegistry>> ) -> Self

Creates a new instance of Api

source

pub async fn create_channel( &self, account: Account<Http>, registry_address: Address, token_address: TokenAddress, partner_address: Address, settle_timeout: Option<SettleTimeout>, reveal_timeout: Option<RevealTimeout>, retry_timeout: Option<RetryTimeout> ) -> Result<ChannelIdentifier, ApiError>

Creates a new channel with the current account being one participant.

source

pub async fn update_channel( &self, account: Account<Http>, registry_address: Address, token_address: TokenAddress, partner_address: Address, reveal_timeout: Option<RevealTimeout>, total_deposit: Option<TokenAmount>, total_withdraw: Option<TokenAmount>, state: Option<ChannelStatus>, retry_timeout: Option<RetryTimeout> ) -> Result<(), ApiError>

Updates a channel state on-chain depending on the parameters passed.

Only one optional parameter is allowed to be set in a single call to determine what the call will do.

reveal_timeout: Sets the reveal timeout of a channel. total_deposit: Deposit the defined amount into the channel. total_withdraw: Initiates a withdraw with partner. state: Alters the state of the channel. For example: closed.

source

pub async fn channel_deposit( &self, account: Account<Http>, channel_state: &ChannelState, total_deposit: TokenAmount, retry_timeout: Option<RetryTimeout> ) -> Result<(), ApiError>

source

pub async fn channel_withdraw( &self, channel_state: &ChannelState, total_withdraw: TokenAmount ) -> Result<(), ApiError>

Initiate a withdraw from channel’s balance.

source

pub async fn channel_reveal_timeout( &self, channel_state: &ChannelState, reveal_timeout: RevealTimeout ) -> Result<(), ApiError>

Set the channel’s reveal timeout.

source

pub async fn channel_close( &self, registry_address: Address, channel_state: &ChannelState ) -> Result<(), ApiError>

Close a channel.

source

pub async fn token_network_register( &self, registry_address: Address, token_address: TokenAddress ) -> Result<TokenNetworkAddress, ApiError>

Register a new token network.

source

pub async fn token_network_leave( &self, registry_address: Address, token_address: TokenAddress ) -> Result<Vec<ChannelState>, ApiError>

Leave token network by token address.

source

pub async fn channel_batch_close( &self, registry_address: Address, token_address: TokenAddress, partners: Vec<Address>, retry_timeout: Option<RetryTimeout>, coop_settle: bool ) -> Result<(), ApiError>

Batch close channels.

This will attempt to cooperatively settle a channel and then close it.

source

pub async fn batch_coop_settle( &self, channels: Vec<&ChannelState>, retry_timeout: Option<RetryTimeout> ) -> Result<Vec<ChannelState>, ApiError>

Batch cooperative settle

source

pub async fn deposit_to_udc( &self, user_deposit_address: Address, new_total_deposit: TokenAmount ) -> Result<(), ApiError>

Deposit some amount to the UserDeposit contract.

source

pub async fn plan_withdraw_from_udc( &self, user_deposit_address: Address, planned_withdraw_amount: TokenAmount ) -> Result<(), ApiError>

Register desire to withdraw from the UserDeposit contract.

The amount stated will be withdrawable after certain blocks have passed.

source

pub async fn withdraw_from_udc( &self, user_deposit_address: Address, withdraw_amount: TokenAmount ) -> Result<(), ApiError>

Actually perform the previously planned withdraw from the UserDeposit contract.

source

pub async fn initiate_payment( &self, account: Account<Http>, token_network_registry_address: TokenNetworkRegistryAddress, secret_registry_address: SecretRegistryAddress, token_address: TokenAddress, partner_address: Address, amount: TokenAmount, payment_identifier: Option<PaymentIdentifier>, secret: Option<String>, secret_hash: Option<SecretHash>, lock_timeout: Option<BlockTimeout> ) -> Result<Payment, ApiError>

Initiate a payment to partner.

source

pub async fn mint_token_for( &self, token_address: TokenAddress, to: Address, value: TokenAmount ) -> Result<TransactionHash, ApiError>

Mint a certain amount of tokens to a specific address.

Auto Trait Implementations§

§

impl Freeze for Api

§

impl !RefUnwindSafe for Api

§

impl Send for Api

§

impl Sync for Api

§

impl Unpin for Api

§

impl !UnwindSafe for Api

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Az for T

source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

source§

fn cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> CheckedAs for T

source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> OverflowingAs for T

source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> SaturatingAs for T

source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> Typeable for T
where T: Any,

source§

fn get_type(&self) -> TypeId

Get the TypeId of this object.
source§

impl<T> UnwrappedAs for T

source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> WrappingAs for T

source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.