Struct PaymentStrParams

Source
pub struct PaymentStrParams<'a> { /* private fields */ }
Expand description

Container for payment-related arguments used while constructing a Deploy.

§payment_args_simple

For methods taking payment_args_simple, this parameter is the payment contract arguments, in the form <NAME:TYPE='VALUE'> or <NAME:TYPE=null>.

It can only be used with the following simple CLTypes: bool, i32, i64, u8, u32, u64, u128, u256, u512, unit, string, key, account_hash, uref, public_key and Option of each of these.

Example inputs are:

name_01:bool='false'
name_02:i32='-1'
name_03:i64='-2'
name_04:u8='3'
name_05:u32='4'
name_06:u64='5'
name_07:u128='6'
name_08:u256='7'
name_09:u512='8'
name_10:unit=''
name_11:string='a value'
key_account_name:key='account-hash-0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20'
key_hash_name:key='hash-0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20'
key_uref_name:key='uref-0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20-000'
account_hash_name:account_hash='account-hash-0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20'
uref_name:uref='uref-0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20-007'
public_key_name:public_key='0119bf44096984cdfe8541bac167dc3b96c85086aa30b6b6cb0c5c38ad703166e1'

For optional values of any these types, prefix the type with “opt_” and use the term “null” without quotes to specify a None value:

name_01:opt_bool='true'       # Some(true)
name_02:opt_bool='false'      # Some(false)
name_03:opt_bool=null         # None
name_04:opt_i32='-1'          # Some(-1)
name_05:opt_i32=null          # None
name_06:opt_unit=''           # Some(())
name_07:opt_unit=null         # None
name_08:opt_string='a value'  # Some("a value".to_string())
name_09:opt_string='null'     # Some("null".to_string())
name_10:opt_string=null       # None

To get a list of supported types, call cli::simple_args_help::supported_cl_type_list. To get this list of examples for supported types, call cli::simple_args_help::supported_cl_type_examples.

§payment_args_json

For methods taking payment_args_json, this parameter is the payment contract arguments, as a JSON-encoded Array of JSON Objects of the form:

[{"name":<String>,"type":<VALUE>,"value":<VALUE>}]

To get comprehensive information and a set of examples, call cli::json_args_help::info_and_examples.

Example inputs are:

[{"name":"a","type":"Bool","value":false}]
[{"name":"b","type":"I32","value":-1}]
[{"name":"c","type":"U64","value":1}]
[{"name":"d","type":"U512","value":"20000000000000000000"}]
[{"name":"e","type":"Unit","value":null}]
[{"name":"f","type":"String","value":"a"}]
[{"name":"g","type":"Key","value":"account-hash-201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a090807060504030201"}]
[{"name":"h","type":"URef","value":"uref-201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a090807060504030201-007"}]
[{"name":"i","type":"PublicKey","value":"017279ea868d185a40ed32ec076807c070de9c0fe986f5418c2aa71478f1e8ddf8"}]
[{"name":"j","type":{"Option":"U64"},"value":999}]        # Some(999_u64)
[{"name":"k","type":{"Option":"String"},"value":null}]    # None
[{"name":"l","type":{"List":{"Option":"U256"}},"value":[1,null,"3"]}]
[{"name":"m","type":{"List":"U8"},"value":"0102ff"}]      # for Vec<u8> only, can parse from hex string
[{"name":"n","type":{"ByteArray":3},"value":"0114ff"}]
[{"name":"o","type":{"ByteArray":3},"value":[1,20,255]}]
[{"name":"p","type":{"Result":{"ok":"Bool","err":"U8"}},"value":{"Ok":true}}]
[{"name":"q","type":{"Result":{"ok":"Bool","err":"U8"}},"value":{"Err":1}}]
[{"name":"r","type":{"Map":{"key":"U8","value":"Bool"}},"value":[{"key":1,"value":true},{"key":2,"value":false}]}]
## for Map with key as String or Number can use an Object rather than an Array:
[{"name":"s","type":{"Map":{"key":"U8","value":"Bool"}},"value":{"1":true,"2":false}}]
[{"name":"t","type":{"Tuple3":["Bool","U8","String"]},"value":[true,128,"a"]}]

§payment_args_complex

For methods taking payment_args_complex, this parameter is the payment contract arguments, in the form of a ToBytes-encoded file.


Note while multiple payment args can be specified for a single payment code instance, only one of payment_args_simple, payment_args_json or payment_args_complex may be used.

Implementations§

Source§

impl<'a> PaymentStrParams<'a>

Source

pub fn with_path( payment_path: &'a str, payment_args_simple: Vec<&'a str>, payment_args_json: &'a str, payment_args_complex: &'a str, ) -> Self

Constructs a PaymentStrParams using a payment smart contract file.

Source

pub fn with_amount(payment_amount: &'a str) -> Self

Constructs a PaymentStrParams using a payment amount.

payment_amount uses the standard-payment system contract rather than custom payment Wasm. The value is the ‘amount’ arg of the standard-payment contract.

Source

pub fn with_name( payment_name: &'a str, payment_entry_point: &'a str, payment_args_simple: Vec<&'a str>, payment_args_json: &'a str, payment_args_complex: &'a str, ) -> Self

Constructs a PaymentStrParams using a stored contract’s name.

  • payment_name is the name of the stored contract (associated with the executing account) to be called as the payment.
  • payment_entry_point is the name of the method that will be used when calling the payment contract.
  • See the struct docs for a description of payment_args_simple, payment_args_json and payment_args_complex.
Source

pub fn with_hash( payment_hash: &'a str, payment_entry_point: &'a str, payment_args_simple: Vec<&'a str>, payment_args_json: &'a str, payment_args_complex: &'a str, ) -> Self

Constructs a PaymentStrParams using a stored contract’s hex-encoded hash.

  • payment_hash is the hex-encoded hash of the stored contract to be called as the payment.
  • payment_entry_point is the name of the method that will be used when calling the payment contract.
  • See the struct docs for a description of payment_args_simple, payment_args_json and payment_args_complex.
Source

pub fn with_package_name( payment_package_name: &'a str, payment_version: &'a str, payment_entry_point: &'a str, payment_args_simple: Vec<&'a str>, payment_args_json: &'a str, payment_args_complex: &'a str, ) -> Self

Constructs a PaymentStrParams using a stored contract’s package name.

  • payment_package_name is the name of the stored package to be called as the payment.
  • payment_version is the version of the called payment contract. The latest will be used if payment_version is empty.
  • payment_entry_point is the name of the method that will be used when calling the payment contract.
  • See the struct docs for a description of payment_args_simple, payment_args_json and payment_args_complex.
Source

pub fn with_package_hash( payment_package_hash: &'a str, payment_version: &'a str, payment_entry_point: &'a str, payment_args_simple: Vec<&'a str>, payment_args_json: &'a str, payment_args_complex: &'a str, ) -> Self

Constructs a PaymentStrParams using a stored contract’s package hash.

  • payment_package_hash is the hex-encoded hash of the stored package to be called as the payment.
  • payment_version is the version of the called payment contract. The latest will be used if payment_version is empty.
  • payment_entry_point is the name of the method that will be used when calling the payment contract.
  • See the struct docs for a description of payment_args_simple, payment_args_json and payment_args_complex.

Trait Implementations§

Source§

impl<'a> Default for PaymentStrParams<'a>

Source§

fn default() -> PaymentStrParams<'a>

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for PaymentStrParams<'a>

§

impl<'a> RefUnwindSafe for PaymentStrParams<'a>

§

impl<'a> Send for PaymentStrParams<'a>

§

impl<'a> Sync for PaymentStrParams<'a>

§

impl<'a> Unpin for PaymentStrParams<'a>

§

impl<'a> UnwindSafe for PaymentStrParams<'a>

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

Source§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into a target type. Read more
Source§

impl<T> FmtForward for T

Source§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
Source§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
Source§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
Source§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
Source§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
Source§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
Source§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
Source§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pipe for T

Source§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R

Pipes a value into a function that cannot ordinarily be called in suffix position. Read more
Source§

impl<T> PipeAsRef for T

Source§

fn pipe_as_ref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where Self: AsRef<T>, T: 'a, R: 'a,

Pipes a trait borrow into a function that cannot normally be called in suffix position. Read more
Source§

fn pipe_as_mut<'a, T, R>(&'a mut self, func: impl FnOnce(&'a mut T) -> R) -> R
where Self: AsMut<T>, T: 'a, R: 'a,

Pipes a trait mutable borrow into a function that cannot normally be called in suffix position. Read more
Source§

impl<T> PipeBorrow for T

Source§

fn pipe_borrow<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where Self: Borrow<T>, T: 'a, R: 'a,

Pipes a trait borrow into a function that cannot normally be called in suffix position. Read more
Source§

fn pipe_borrow_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: BorrowMut<T>, T: 'a, R: 'a,

Pipes a trait mutable borrow into a function that cannot normally be called in suffix position. Read more
Source§

impl<T> PipeDeref for T

Source§

fn pipe_deref<'a, R>(&'a self, func: impl FnOnce(&'a Self::Target) -> R) -> R
where Self: Deref, R: 'a,

Pipes a dereference into a function that cannot normally be called in suffix position. Read more
Source§

fn pipe_deref_mut<'a, R>( &'a mut self, func: impl FnOnce(&'a mut Self::Target) -> R, ) -> R
where Self: DerefMut, R: 'a,

Pipes a mutable dereference into a function that cannot normally be called in suffix position. Read more
Source§

impl<T> PipeRef for T

Source§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Pipes a reference into a function that cannot ordinarily be called in suffix position. Read more
Source§

fn pipe_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Pipes a mutable reference into a function that cannot ordinarily be called in suffix position. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Tap for T

Source§

fn tap<F, R>(self, func: F) -> Self
where F: FnOnce(&Self) -> R,

Provides immutable access for inspection. Read more
Source§

fn tap_dbg<F, R>(self, func: F) -> Self
where F: FnOnce(&Self) -> R,

Calls tap in debug builds, and does nothing in release builds.
Source§

fn tap_mut<F, R>(self, func: F) -> Self
where F: FnOnce(&mut Self) -> R,

Provides mutable access for modification. Read more
Source§

fn tap_mut_dbg<F, R>(self, func: F) -> Self
where F: FnOnce(&mut Self) -> R,

Calls tap_mut in debug builds, and does nothing in release builds.
Source§

impl<T, U> TapAsRef<U> for T
where U: ?Sized,

Source§

fn tap_ref<F, R>(self, func: F) -> Self
where Self: AsRef<T>, F: FnOnce(&T) -> R,

Provides immutable access to the reference for inspection.
Source§

fn tap_ref_dbg<F, R>(self, func: F) -> Self
where Self: AsRef<T>, F: FnOnce(&T) -> R,

Calls tap_ref in debug builds, and does nothing in release builds.
Source§

fn tap_ref_mut<F, R>(self, func: F) -> Self
where Self: AsMut<T>, F: FnOnce(&mut T) -> R,

Provides mutable access to the reference for modification.
Source§

fn tap_ref_mut_dbg<F, R>(self, func: F) -> Self
where Self: AsMut<T>, F: FnOnce(&mut T) -> R,

Calls tap_ref_mut in debug builds, and does nothing in release builds.
Source§

impl<T, U> TapBorrow<U> for T
where U: ?Sized,

Source§

fn tap_borrow<F, R>(self, func: F) -> Self
where Self: Borrow<T>, F: FnOnce(&T) -> R,

Provides immutable access to the borrow for inspection. Read more
Source§

fn tap_borrow_dbg<F, R>(self, func: F) -> Self
where Self: Borrow<T>, F: FnOnce(&T) -> R,

Calls tap_borrow in debug builds, and does nothing in release builds.
Source§

fn tap_borrow_mut<F, R>(self, func: F) -> Self
where Self: BorrowMut<T>, F: FnOnce(&mut T) -> R,

Provides mutable access to the borrow for modification.
Source§

fn tap_borrow_mut_dbg<F, R>(self, func: F) -> Self
where Self: BorrowMut<T>, F: FnOnce(&mut T) -> R,

Calls tap_borrow_mut in debug builds, and does nothing in release builds.
Source§

impl<T> TapDeref for T

Source§

fn tap_deref<F, R>(self, func: F) -> Self
where Self: Deref, F: FnOnce(&Self::Target) -> R,

Immutably dereferences self for inspection.
Source§

fn tap_deref_dbg<F, R>(self, func: F) -> Self
where Self: Deref, F: FnOnce(&Self::Target) -> R,

Calls tap_deref in debug builds, and does nothing in release builds.
Source§

fn tap_deref_mut<F, R>(self, func: F) -> Self
where Self: DerefMut, F: FnOnce(&mut Self::Target) -> R,

Mutably dereferences self for modification.
Source§

fn tap_deref_mut_dbg<F, R>(self, func: F) -> Self
where Self: DerefMut, F: FnOnce(&mut Self::Target) -> R,

Calls tap_deref_mut in debug builds, and does nothing in release builds.
Source§

impl<T> TryConv for T

Source§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into a target type. 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<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> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T