Trait SubmitAndWatch

Source
pub trait SubmitAndWatch {
    type Client: Subscribe;
    type Hash: DeserializeOwned + Decode + Encode;

    // Required methods
    fn submit_and_watch_extrinsic<'life0, 'async_trait, Address, Call, Signature, TransactionExtension>(
        &'life0 self,
        extrinsic: UncheckedExtrinsic<Address, Call, Signature, TransactionExtension>,
    ) -> Pin<Box<dyn Future<Output = Result<TransactionSubscriptionFor<Self::Client, Self::Hash>>> + 'async_trait>>
       where Address: Encode + 'async_trait,
             Call: Encode + 'async_trait,
             Signature: Encode + 'async_trait,
             TransactionExtension: Encode + 'async_trait,
             Self: 'async_trait,
             'life0: 'async_trait;
    fn submit_and_watch_opaque_extrinsic<'life0, 'life1, 'async_trait>(
        &'life0 self,
        encoded_extrinsic: &'life1 Bytes,
    ) -> Pin<Box<dyn Future<Output = Result<TransactionSubscriptionFor<Self::Client, Self::Hash>>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn submit_and_watch_extrinsic_until<'life0, 'async_trait, Address, Call, Signature, TransactionExtension>(
        &'life0 self,
        extrinsic: UncheckedExtrinsic<Address, Call, Signature, TransactionExtension>,
        watch_until: XtStatus,
    ) -> Pin<Box<dyn Future<Output = Result<ExtrinsicReport<Self::Hash>>> + 'async_trait>>
       where Address: Encode + 'async_trait,
             Call: Encode + 'async_trait,
             Signature: Encode + 'async_trait,
             TransactionExtension: Encode + 'async_trait,
             Self: 'async_trait,
             'life0: 'async_trait;
    fn submit_and_watch_opaque_extrinsic_until<'life0, 'life1, 'async_trait>(
        &'life0 self,
        encoded_extrinsic: &'life1 Bytes,
        watch_until: XtStatus,
    ) -> Pin<Box<dyn Future<Output = Result<ExtrinsicReport<Self::Hash>>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn submit_and_watch_extrinsic_until_without_events<'life0, 'async_trait, Address, Call, Signature, TransactionExtension>(
        &'life0 self,
        extrinsic: UncheckedExtrinsic<Address, Call, Signature, TransactionExtension>,
        watch_until: XtStatus,
    ) -> Pin<Box<dyn Future<Output = Result<ExtrinsicReport<Self::Hash>>> + 'async_trait>>
       where Address: Encode + 'async_trait,
             Call: Encode + 'async_trait,
             Signature: Encode + 'async_trait,
             TransactionExtension: Encode + 'async_trait,
             Self: 'async_trait,
             'life0: 'async_trait;
    fn submit_and_watch_opaque_extrinsic_until_without_events<'life0, 'life1, 'async_trait>(
        &'life0 self,
        encoded_extrinsic: &'life1 Bytes,
        watch_until: XtStatus,
    ) -> Pin<Box<dyn Future<Output = Result<ExtrinsicReport<Self::Hash>>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn populate_events<'life0, 'life1, 'async_trait>(
        &'life0 self,
        report: &'life1 mut ExtrinsicReport<Self::Hash>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}

Required Associated Types§

Required Methods§

Source

fn submit_and_watch_extrinsic<'life0, 'async_trait, Address, Call, Signature, TransactionExtension>( &'life0 self, extrinsic: UncheckedExtrinsic<Address, Call, Signature, TransactionExtension>, ) -> Pin<Box<dyn Future<Output = Result<TransactionSubscriptionFor<Self::Client, Self::Hash>>> + 'async_trait>>
where Address: Encode + 'async_trait, Call: Encode + 'async_trait, Signature: Encode + 'async_trait, TransactionExtension: Encode + 'async_trait, Self: 'async_trait, 'life0: 'async_trait,

Submit an extrinsic an return a Subscription to watch the extrinsic progress.

This method is blocking if the sync-api feature is activated

Source

fn submit_and_watch_opaque_extrinsic<'life0, 'life1, 'async_trait>( &'life0 self, encoded_extrinsic: &'life1 Bytes, ) -> Pin<Box<dyn Future<Output = Result<TransactionSubscriptionFor<Self::Client, Self::Hash>>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Submit an encoded, opaque extrinsic an return a Subscription to watch the extrinsic progress.

This method is blocking if the sync-api feature is activated

Source

fn submit_and_watch_extrinsic_until<'life0, 'async_trait, Address, Call, Signature, TransactionExtension>( &'life0 self, extrinsic: UncheckedExtrinsic<Address, Call, Signature, TransactionExtension>, watch_until: XtStatus, ) -> Pin<Box<dyn Future<Output = Result<ExtrinsicReport<Self::Hash>>> + 'async_trait>>
where Address: Encode + 'async_trait, Call: Encode + 'async_trait, Signature: Encode + 'async_trait, TransactionExtension: Encode + 'async_trait, Self: 'async_trait, 'life0: 'async_trait,

Submit an extrinsic and watch it until the desired status is reached, if no error is encountered previously.

If watched until InBlock or Finalized, this function will return an error if the extrinsic was not successfully executed. If it was successful, a report containing the following is returned:

  • extrinsic hash
  • hash of the block the extrinsic was included in
  • last known extrinsic (transaction) status
  • associated events of the extrinsic

If not watched until at least InBlock, this function will not know if the extrinsic has been executed on chain or not and will therefore not return an error if execution fails. An error will be returned if the extrinsic has failed to be sent or if it has not been included into the transaction pool of the node. If no error occurs, a report containing the following is returned:

  • extrinsic hash
  • last known extrinsic (transaction) status

This method is blocking if the sync-api feature is activated

Source

fn submit_and_watch_opaque_extrinsic_until<'life0, 'life1, 'async_trait>( &'life0 self, encoded_extrinsic: &'life1 Bytes, watch_until: XtStatus, ) -> Pin<Box<dyn Future<Output = Result<ExtrinsicReport<Self::Hash>>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Submit an encoded, opaque extrinsic until the desired status is reached, if no error is encountered previously.

If watched until InBlock or Finalized, this function will return an error if the extrinsic was not successfully executed. If it was successful, a report containing the following is returned:

  • extrinsic hash
  • hash of the block the extrinsic was included in
  • last known extrinsic (transaction) status
  • associated events of the extrinsic (only for InBlock or Finalized)

If not watched until at least InBlock, this function will not know if the extrinsic has been executed on chain or not and will therefore not return an error if execution fails.. An error will be returned, if the extrinsic has failed to be sent or if it has not been included into the transaction pool of the node. If no error occurs, a report containing the following is returned:

  • extrinsic hash
  • last known extrinsic (transaction) status

This method is blocking if the sync-api feature is activated

Source

fn submit_and_watch_extrinsic_until_without_events<'life0, 'async_trait, Address, Call, Signature, TransactionExtension>( &'life0 self, extrinsic: UncheckedExtrinsic<Address, Call, Signature, TransactionExtension>, watch_until: XtStatus, ) -> Pin<Box<dyn Future<Output = Result<ExtrinsicReport<Self::Hash>>> + 'async_trait>>
where Address: Encode + 'async_trait, Call: Encode + 'async_trait, Signature: Encode + 'async_trait, TransactionExtension: Encode + 'async_trait, Self: 'async_trait, 'life0: 'async_trait,

Submit an extrinsic and watch it until the desired status is reached, if no error is encountered previously. The events are not fetched. So no events are listed in the report. To fetch the triggered events, please use submit_and_watch_extrinsic_until. Upon success, a report containing the following information is returned:

  • extrinsic hash
  • if watched until at least InBlock: hash of the block the extrinsic was included in
  • last known extrinsic (transaction) status

This method is blocking if the sync-api feature is activated

Source

fn submit_and_watch_opaque_extrinsic_until_without_events<'life0, 'life1, 'async_trait>( &'life0 self, encoded_extrinsic: &'life1 Bytes, watch_until: XtStatus, ) -> Pin<Box<dyn Future<Output = Result<ExtrinsicReport<Self::Hash>>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Submit an encoded, opaque extrinsic and watch it until the desired status is reached, if no error is encountered previously. The events are not fetched. So no events are listed in the report. To fetch the triggered events, please use submit_and_watch_opaque_extrinsic_until. Upon success, a report containing the following information is returned:

  • extrinsic hash
  • if watched until at least InBlock: hash of the block the extrinsic was included in
  • last known extrinsic (transaction) status

This method is blocking if the sync-api feature is activated

Source

fn populate_events<'life0, 'life1, 'async_trait>( &'life0 self, report: &'life1 mut ExtrinsicReport<Self::Hash>, ) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Query the events for the specified report and attaches them to the mutable report. If the function fails events might still be added to the report.

This method is blocking if the sync-api feature is activated

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.

Implementors§

Source§

impl<T, Client> SubmitAndWatch for Api<T, Client>
where T: Config, Client: Subscribe + Request,

Source§

type Client = Client

Source§

type Hash = <T as Config>::Hash