Struct CallRequest

Source
pub struct CallRequest<T = CallScope, A = AuthToken> {
    pub scope: T,
    pub layer1: Layer1,
    pub api: Option<TypeName>,
    pub call: Option<CallState>,
    pub auth: A,
    pub data: Option<StrictVal>,
    pub lock: Option<Confined<Vec<u8>, amplify::::collection::confinement::TinyBlob::{constant#0}, amplify::::collection::confinement::TinyBlob::{constant#1}>>,
    pub expiry: Option<DateTime<Utc>>,
    pub endpoints: Confined<Vec<Endpoint>, 0, 10>,
    pub unknown_query: IndexMap<String, String>,
}
Expand description

Call request provides information for constructing [hypersonic::CallParams].

Request doesn’t specify the used capabilities of the contract (blockchain, if any; type of single-use seals) since each contract is strictly committed and can be used under one and just one type of capabilities.

§URI form

Call request can be represented as a URI using contract: scheme in the following format:

contract:CONTRACT-ID/API/METHOD/STATE/AUTH/DATA+STON?expiry=DATETIME&lock=BASE64&endpoints=E1,
E2#CHECK

NB: Parsing and producing URI form requires use of uri feature.

§Path

Instead of Contract ID a string query against a set of contracts can be used; for instance, describing contract capabilities.

Some path components of the URI may be skipped. In this case URI is parsed in the following way:

  • 3-component path, starting with /, provides name of the used interface standard, authentication token and state information;
  • 3-component path, not starting with /, provides contract ID and auth token, and should use a default method and name state from the contract default API;
  • 4-component path - contract ID and state name are given in addition to the auth token, a default method used from the contract default API;
  • 5-component path - all parameters except API name are given.

§Query

Supported URI query parameters are:

  • expiry: ISO-8601 datetime string;
  • lock: Base64-encoded lock script conditions;
  • endpoints: comma-separated URLs with the endpoints for uploading a resulting deeds/consignment stream.

§Fragment

Optional fragment may be present and should represent a checksum value for the URI string preceding the fragment.

Fields§

§scope: T§layer1: Layer1§api: Option<TypeName>§call: Option<CallState>§auth: A§data: Option<StrictVal>§lock: Option<Confined<Vec<u8>, amplify::::collection::confinement::TinyBlob::{constant#0}, amplify::::collection::confinement::TinyBlob::{constant#1}>>§expiry: Option<DateTime<Utc>>§endpoints: Confined<Vec<Endpoint>, 0, 10>§unknown_query: IndexMap<String, String>

Implementations§

Source§

impl<Q, A> CallRequest<CallScope<Q>, A>
where Q: Display + FromStr,

Source

pub fn unwrap_contract_with<E>( self, f: impl FnOnce(Q) -> Result<ContractId, E>, ) -> Result<CallRequest<ContractId, A>, E>

Source§

impl<T, A> CallRequest<T, A>

Source

pub fn bitcoin_mainnet( scope: T, auth: A, data: Option<StrictVal>, ) -> CallRequest<T, A>

Source

pub fn bitcoin_testnet( scope: T, auth: A, data: Option<StrictVal>, ) -> CallRequest<T, A>

Source

pub fn liquid_mainnet( scope: T, auth: A, data: Option<StrictVal>, ) -> CallRequest<T, A>

Source

pub fn liquid_testnet( scope: T, auth: A, data: Option<StrictVal>, ) -> CallRequest<T, A>

Source

pub fn new( scope: T, consensus: Consensus, testnet: bool, auth: A, data: Option<StrictVal>, ) -> CallRequest<T, A>

Source

pub fn use_api(self, api: impl Into<TypeName>) -> CallRequest<T, A>

Source

pub fn use_method(self, method: VariantName) -> CallRequest<T, A>

Source

pub fn use_state(self, state: VariantName) -> CallRequest<T, A>

Source

pub fn use_expiry(self, expiry: DateTime<Utc>) -> CallRequest<T, A>

Source

pub fn add_endpoint( self, endpoint: Endpoint, ) -> Result<CallRequest<T, A>, Error>

Trait Implementations§

Source§

impl<T, A> Clone for CallRequest<T, A>
where T: Clone, A: Clone,

Source§

fn clone(&self) -> CallRequest<T, A>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T, A> Debug for CallRequest<T, A>
where T: Debug, A: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'de, T, A> Deserialize<'de> for CallRequest<T, A>
where T: Deserialize<'de>, A: Deserialize<'de>,

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<CallRequest<T, A>, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<T, A> PartialEq for CallRequest<T, A>
where T: PartialEq, A: PartialEq,

Source§

fn eq(&self, other: &CallRequest<T, A>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T, A> Serialize for CallRequest<T, A>
where T: Serialize, A: Serialize,

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<T, A> Eq for CallRequest<T, A>
where T: Eq, A: Eq,

Source§

impl<T, A> StructuralPartialEq for CallRequest<T, A>

Auto Trait Implementations§

§

impl<T, A> Freeze for CallRequest<T, A>
where T: Freeze, A: Freeze,

§

impl<T, A> RefUnwindSafe for CallRequest<T, A>

§

impl<T, A> Send for CallRequest<T, A>
where T: Send, A: Send,

§

impl<T, A> Sync for CallRequest<T, A>
where T: Sync, A: Sync,

§

impl<T, A> Unpin for CallRequest<T, A>
where T: Unpin, A: Unpin,

§

impl<T, A> UnwindSafe for CallRequest<T, A>
where T: UnwindSafe, A: UnwindSafe,

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> 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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

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>,

Source§

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> VerifyEq for T
where T: Eq,

Source§

fn verify_eq(&self, other: &T) -> bool

Verifies commit-equivalence of two instances of the same type.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,