Skip to main content

MoveCall

Struct MoveCall 

Source
pub struct MoveCall {
    pub package: ObjectId,
    pub module: String,
    pub function: String,
    pub type_arguments: Vec<String>,
    pub arguments: Vec<Value>,
    pub gas: Option<ObjectId>,
    pub gas_budget: u64,
}
Expand description

Description of a single Move call. The RPC server builds the TransactionData from this plus the signer address.

Fields§

§package: ObjectId

Address of the Move package (the tai package on the target network).

§module: String

Module name within the package, e.g. "launchpad".

§function: String

Function name within the module, e.g. "record_service_payment_sui".

§type_arguments: Vec<String>

Type arguments (instantiates the function’s generic parameters).

Concrete Move type strings, e.g. "0xabc::larry::LARRY".

§arguments: Vec<Value>

Positional Move arguments. Each argument is serialized as either: an object id (string), a pure number, a string, an array of pure values, etc. The RPC server resolves shared object IDs to refs.

§gas: Option<ObjectId>

Optional gas object override. None lets the RPC pick a coin from the signer’s owned coins.

§gas_budget: u64

Maximum gas in MIST.

Implementations§

Source§

impl MoveCall

Source

pub fn new( package: ObjectId, module: impl Into<String>, function: impl Into<String>, ) -> Self

Construct a Move call with the default gas budget and auto-selected gas coin.

Source

pub fn type_arg(self, t: impl Into<String>) -> Self

Append a type argument.

Source

pub fn arg(self, v: Value) -> Self

Append a positional argument.

Source

pub fn arg_object(self, id: ObjectId) -> Self

Append an object-id argument.

Source

pub fn arg_u64(self, n: u64) -> Self

Append a pure u64 argument. Sui’s unsafe_moveCall is strict about numeric arg encoding — it rejects JSON numbers (0) for u64 with "Unexpected arg Number(0) for expected type U64" and only accepts strings ("0"). Stringify always so we don’t trip on edge cases like the operator-daily-limit-of-zero in a sovereign launch.

Source

pub fn arg_addr(self, a: SuiAddress) -> Self

Append a pure address argument.

Source

pub fn arg_bool(self, b: bool) -> Self

Append a pure bool argument.

Source

pub fn arg_option_id(self, opt: Option<ObjectId>) -> Self

Append a pure Option<ID> argument.

Sui’s RPC format for Move Option arguments is an array: [] for None, [inner] for Some(inner).

Source

pub fn arg_vec_addr(self, addrs: &[SuiAddress]) -> Self

Append a pure vector<address> argument.

Source

pub fn arg_vec_id(self, ids: &[ObjectId]) -> Self

Append a pure vector<ID> argument.

Source

pub fn arg_vec_u8(self, bytes: &[u8]) -> Self

Append a pure vector<u8> argument (sent as JSON array of numbers rather than base64, which the Sui RPC also accepts and is easier to read in tx replays).

Source

pub fn arg_string(self, s: &str) -> Self

Append a pure String argument.

Source

pub fn with_gas_budget(self, gas_budget: u64) -> Self

Override the gas budget.

Trait Implementations§

Source§

impl Clone for MoveCall

Source§

fn clone(&self) -> MoveCall

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for MoveCall

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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<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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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> 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