PromiseHandler

Trait PromiseHandler 

Source
pub trait PromiseHandler {
    type ReadOnly: ReadOnlyPromiseHandler;

    // Required methods
    fn promise_results_count(&self) -> u64;
    fn promise_result(&self, index: u64) -> Option<PromiseResult>;
    unsafe fn promise_create_call(
        &mut self,
        args: &PromiseCreateArgs,
    ) -> PromiseId;
    unsafe fn promise_create_and_combine(
        &mut self,
        args: &[PromiseCreateArgs],
    ) -> PromiseId;
    unsafe fn promise_attach_callback(
        &mut self,
        base: PromiseId,
        callback: &PromiseCreateArgs,
    ) -> PromiseId;
    unsafe fn promise_create_batch(
        &mut self,
        args: &PromiseBatchAction,
    ) -> PromiseId;
    unsafe fn promise_attach_batch_callback(
        &mut self,
        base: PromiseId,
        args: &PromiseBatchAction,
    ) -> PromiseId;
    fn promise_return(&mut self, promise: PromiseId);
    fn read_only(&self) -> Self::ReadOnly;

    // Provided methods
    unsafe fn promise_create_with_callback(
        &mut self,
        args: &PromiseWithCallbackArgs,
    ) -> PromiseId { ... }
    fn promise_result_check(&self) -> Option<bool> { ... }
}

Required Associated Types§

Required Methods§

Source

fn promise_results_count(&self) -> u64

Source

fn promise_result(&self, index: u64) -> Option<PromiseResult>

Source

unsafe fn promise_create_call(&mut self, args: &PromiseCreateArgs) -> PromiseId

§Safety

Creating calls to other contracts using the Engine account is dangerous because it has special admin privileges (especially with itself), for example minting bridged tokens. Therefore, this function must be used with extreme caution to prevent security vulnerabilities. In particular, it must not be possible for users to execute arbitrary calls using the Engine.

Source

unsafe fn promise_create_and_combine( &mut self, args: &[PromiseCreateArgs], ) -> PromiseId

Combine more than one promise into one.

§Safety

Safe because of use promise_create_call function under the hood.

Source

unsafe fn promise_attach_callback( &mut self, base: PromiseId, callback: &PromiseCreateArgs, ) -> PromiseId

§Safety

See note on promise_create_call.

Source

unsafe fn promise_create_batch( &mut self, args: &PromiseBatchAction, ) -> PromiseId

§Safety

See note on promise_create_call. Promise batches in particular must be used very carefully because they can take destructive actions such as deploying new contract code or adding/removing access keys.

Source

unsafe fn promise_attach_batch_callback( &mut self, base: PromiseId, args: &PromiseBatchAction, ) -> PromiseId

§Safety

See note on promise_create_call. Promise batches in particular must be used very carefully because they can take destructive actions such as deploying new contract code or adding/removing access keys.

Source

fn promise_return(&mut self, promise: PromiseId)

Source

fn read_only(&self) -> Self::ReadOnly

Provided Methods§

Source

unsafe fn promise_create_with_callback( &mut self, args: &PromiseWithCallbackArgs, ) -> PromiseId

§Safety

See note on promise_create_call.

Source

fn promise_result_check(&self) -> Option<bool>

Returns None if there were no prior promises (i.e. the method was not called as a callback). Returns Some(true) if there was at least one promise result and all results were successful. Returns Some(false) if there was at least one failed promise result.

Implementors§