Skip to main content

TypedAction

Enum TypedAction 

Source
#[non_exhaustive]
pub enum TypedAction {
Show 41 variants SendAsset { metaflux_chain: String, source_dex: u32, destination_dex: u32, asset: u32, destination: Address, amount: String, to_perp: bool, nonce: u64, }, UsdClassTransfer { metaflux_chain: String, ntl: String, to_perp: bool, nonce: u64, }, Withdraw { metaflux_chain: String, asset: u32, amount: String, destination_chain_id: u32, use_cctp: bool, nonce: u64, }, ApproveAgent { metaflux_chain: String, agent_address: Address, agent_name: String, expires_at_ms: u64, nonce: u64, }, SetReferrer { metaflux_chain: String, referrer: Address, nonce: u64, }, ApproveBuilderFee { metaflux_chain: String, builder: Address, max_fee_bps: u16, nonce: u64, }, SetDisplayName { metaflux_chain: String, display_name: String, nonce: u64, }, SetPositionMode { metaflux_chain: String, hedge: bool, nonce: u64, }, UserPortfolioMargin { metaflux_chain: String, enroll: bool, nonce: u64, }, ConvertToMultiSigUser { metaflux_chain: String, signers: Vec<Address>, threshold: u32, nonce: u64, }, UpdateLeverage { metaflux_chain: String, asset: u32, leverage: u32, is_isolated: bool, nonce: u64, }, ClaimRewards { metaflux_chain: String, validator: Address, nonce: u64, }, LinkStakingUser { metaflux_chain: String, target: Address, nonce: u64, }, CreateVault { metaflux_chain: String, name: String, lock_period_secs: u64, kind: u8, nonce: u64, }, VaultModify { metaflux_chain: String, vault_id: u64, new_name: String, nonce: u64, }, SpotMarginClose { metaflux_chain: String, pair: u32, limit_px: u64, nonce: u64, }, SetMetaliquiditySet { metaflux_chain: String, account: Address, allowed: bool, nonce: u64, }, RegisterMetaliquidityOperator { metaflux_chain: String, vault_id: u64, operator: Address, allowed: bool, expires_at_ms: u64, nonce: u64, }, UpdateIsolatedMargin { metaflux_chain: String, asset: u32, delta: String, nonce: u64, }, TopUpIsolatedOnlyMargin { metaflux_chain: String, asset: u32, amount: String, nonce: u64, }, TokenDelegate { metaflux_chain: String, validator: Address, amount: String, is_undelegate: bool, nonce: u64, }, VaultTransfer { metaflux_chain: String, vault_id: u64, deposit: bool, amount: String, nonce: u64, }, VaultWithdraw { metaflux_chain: String, vault_id: u64, shares: String, nonce: u64, }, SpotMarginDeposit { metaflux_chain: String, pair: u32, amount: String, nonce: u64, }, SpotMarginWithdraw { metaflux_chain: String, pair: u32, amount: String, nonce: u64, }, SpotMarginOpen { metaflux_chain: String, pair: u32, size: u64, limit_px: u64, borrow: String, nonce: u64, }, EarnDeposit { metaflux_chain: String, asset: u32, amount: String, nonce: u64, }, EarnWithdraw { metaflux_chain: String, asset: u32, shares: String, nonce: u64, }, AgentSetAbstraction { metaflux_chain: String, user: Address, kind: u8, value: String, nonce: u64, }, MbWithdraw { metaflux_chain: String, chain: u8, asset: u32, amount: u64, dst_addr: String, nonce: u64, }, CoreEvmTransfer { metaflux_chain: String, amount: String, to_evm: bool, destination: Address, asset: u32, nonce: u64, }, CreateSubAccount { metaflux_chain: String, name: String, has_explicit_index: bool, explicit_index: u32, shared_stp_group: bool, nonce: u64, }, SubAccountTransfer { metaflux_chain: String, sub_index: u32, deposit: bool, amount: String, nonce: u64, }, SubAccountSpotTransfer { metaflux_chain: String, sub_index: u32, token: u32, deposit: bool, amount: String, nonce: u64, }, CDeposit { metaflux_chain: String, amount: String, nonce: u64, }, CWithdraw { metaflux_chain: String, amount: String, nonce: u64, }, UserDexAbstraction { metaflux_chain: String, enabled: bool, nonce: u64, }, UserSetAbstraction { metaflux_chain: String, kind: u8, value: String, nonce: u64, }, PriorityBid { metaflux_chain: String, asset: u32, bid_bps: u16, nonce: u64, }, CancelAllOrders { metaflux_chain: String, has_asset: bool, asset: u32, nonce: u64, }, SubmitEncryptedOrder { metaflux_chain: String, ciphertext: Vec<u8>, commitment: [u8; 32], threshold: u8, target_block: u64, reveal_deadline_ms: u64, nonce: u64, },
}
Expand description

One wallet-signed action per variant, carrying exactly its EIP-712 fields in declared (= encodeType = message) order.

These are the actions the node accepts under the typed signing scheme. Decimal magnitudes are String and hashed verbatim — set them to the canonical text you intend to send on the wire.

The leading metaflux_chain tag is filled in for you when you build a variant through crate::rest::exchange::Exchange; if you construct one directly, use metaflux_chain_tag for the target chain id.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

SendAsset

SendAsset(string metafluxChain,uint32 sourceDex,uint32 destinationDex,uint32 asset,address destination,string amount,bool toPerp,uint64 nonce)

Fields

§metaflux_chain: String

Chain tag ("Mainnet" / "Testnet" / "Devnet").

§source_dex: u32

Source dex id.

§destination_dex: u32

Destination dex id.

§asset: u32

Asset id.

§destination: Address

Recipient address.

§amount: String

Amount as a canonical decimal string.

§to_perp: bool

Move to the perp side.

§nonce: u64

Envelope nonce.

§

UsdClassTransfer

UsdClassTransfer(string metafluxChain,string ntl,bool toPerp,uint64 nonce)

Fields

§metaflux_chain: String

Chain tag.

§ntl: String

Notional as a canonical decimal string.

§to_perp: bool

Move to the perp side.

§nonce: u64

Envelope nonce.

§

Withdraw

Withdraw(string metafluxChain,uint32 asset,string amount,uint32 destinationChainId,bool useCctp,uint64 nonce)

Fields

§metaflux_chain: String

Chain tag.

§asset: u32

Asset id.

§amount: String

Amount as a canonical decimal string.

§destination_chain_id: u32

Destination EVM chain id.

§use_cctp: bool

Route via CCTP.

§nonce: u64

Envelope nonce.

§

ApproveAgent

ApproveAgent(string metafluxChain,address agentAddress,string agentName,uint64 expiresAtMs,uint64 nonce)

Fields

§metaflux_chain: String

Chain tag.

§agent_address: Address

Agent address being approved.

§agent_name: String

Human-readable agent name.

§expires_at_ms: u64

Approval expiry (ms since epoch). 0 = never expires.

§nonce: u64

Envelope nonce.

§

SetReferrer

SetReferrer(string metafluxChain,address referrer,uint64 nonce)

Fields

§metaflux_chain: String

Chain tag.

§referrer: Address

Referrer address.

§nonce: u64

Envelope nonce.

§

ApproveBuilderFee

ApproveBuilderFee(string metafluxChain,address builder,uint16 maxFeeBps,uint64 nonce)

Fields

§metaflux_chain: String

Chain tag.

§builder: Address

Builder address.

§max_fee_bps: u16

Max builder fee in basis points.

§nonce: u64

Envelope nonce.

§

SetDisplayName

SetDisplayName(string metafluxChain,string displayName,uint64 nonce)

Fields

§metaflux_chain: String

Chain tag.

§display_name: String

Display name.

§nonce: u64

Envelope nonce.

§

SetPositionMode

SetPositionMode(string metafluxChain,bool hedge,uint64 nonce)

Fields

§metaflux_chain: String

Chain tag.

§hedge: bool

Hedge mode enabled.

§nonce: u64

Envelope nonce.

§

UserPortfolioMargin

UserPortfolioMargin(string metafluxChain,bool enroll,uint64 nonce)

Fields

§metaflux_chain: String

Chain tag.

§enroll: bool

Enroll in portfolio margin.

§nonce: u64

Envelope nonce.

§

ConvertToMultiSigUser

ConvertToMultiSigUser(string metafluxChain,address[] signers,uint32 threshold,uint64 nonce)

Fields

§metaflux_chain: String

Chain tag.

§signers: Vec<Address>

Authorized signer set.

§threshold: u32

Required signatures.

§nonce: u64

Envelope nonce.

§

UpdateLeverage

UpdateLeverage(string metafluxChain,uint32 asset,uint32 leverage,bool isIsolated,uint64 nonce)

Fields

§metaflux_chain: String

Chain tag.

§asset: u32

Asset id.

§leverage: u32

Leverage multiplier.

§is_isolated: bool

Isolated (vs cross) margin.

§nonce: u64

Envelope nonce.

§

ClaimRewards

ClaimRewards(string metafluxChain,address validator,uint64 nonce). The zero address means “claim all”.

Fields

§metaflux_chain: String

Chain tag.

§validator: Address

Validator address, or Address::ZERO to claim everything.

§nonce: u64

Envelope nonce.

§

LinkStakingUser

LinkStakingUser(string metafluxChain,address target,uint64 nonce)

Fields

§metaflux_chain: String

Chain tag.

§target: Address

Linked staking target address.

§nonce: u64

Envelope nonce.

§

CreateVault

CreateVault(string metafluxChain,string name,uint64 lockPeriodSecs,uint8 kind,uint64 nonce)

Fields

§metaflux_chain: String

Chain tag.

§name: String

Vault name.

§lock_period_secs: u64

Lock period in seconds.

§kind: u8

Vault kind (0 = user, 1 = metaliquidity).

§nonce: u64

Envelope nonce.

§

VaultModify

VaultModify(string metafluxChain,uint64 vaultId,string newName,uint64 nonce)

Fields

§metaflux_chain: String

Chain tag.

§vault_id: u64

Vault id.

§new_name: String

New vault name.

§nonce: u64

Envelope nonce.

§

SpotMarginClose

SpotMarginClose(string metafluxChain,uint32 pair,uint64 limitPx,uint64 nonce)

Fields

§metaflux_chain: String

Chain tag.

§pair: u32

Spot margin pair id.

§limit_px: u64

Limit price on the 1e8 plane.

§nonce: u64

Envelope nonce.

§

SetMetaliquiditySet

SetMetaliquiditySet(string metafluxChain,address account,bool allowed,uint64 nonce)

Fields

§metaflux_chain: String

Chain tag.

§account: Address

Account address.

§allowed: bool

Whitelist allowed.

§nonce: u64

Envelope nonce.

§

RegisterMetaliquidityOperator

RegisterMetaliquidityOperator(string metafluxChain,uint64 vaultId,address operator,bool allowed,uint64 expiresAtMs,uint64 nonce)

Fields

§metaflux_chain: String

Chain tag.

§vault_id: u64

Vault id.

§operator: Address

Operator address.

§allowed: bool

Operator allowed.

§expires_at_ms: u64

Expiry timestamp in ms (0 = never expires).

§nonce: u64

Envelope nonce.

§

UpdateIsolatedMargin

UpdateIsolatedMargin(string metafluxChain,uint32 asset,string delta,uint64 nonce)

Fields

§metaflux_chain: String

Chain tag.

§asset: u32

Asset id.

§delta: String

Signed margin delta as a canonical decimal string (e.g. "-100.5").

§nonce: u64

Envelope nonce.

§

TopUpIsolatedOnlyMargin

TopUpIsolatedOnlyMargin(string metafluxChain,uint32 asset,string amount,uint64 nonce)

Fields

§metaflux_chain: String

Chain tag.

§asset: u32

Asset id.

§amount: String

Top-up amount as a canonical decimal string.

§nonce: u64

Envelope nonce.

§

TokenDelegate

TokenDelegate(string metafluxChain,address validator,string amount,bool isUndelegate,uint64 nonce)

Fields

§metaflux_chain: String

Chain tag.

§validator: Address

Validator address.

§amount: String

Stake amount as a canonical decimal string.

§is_undelegate: bool

Undelegate (vs delegate).

§nonce: u64

Envelope nonce.

§

VaultTransfer

VaultTransfer(string metafluxChain,uint64 vaultId,bool deposit,string amount,uint64 nonce)

Fields

§metaflux_chain: String

Chain tag.

§vault_id: u64

Vault id.

§deposit: bool

Deposit (vs withdraw).

§amount: String

Amount as a canonical decimal string.

§nonce: u64

Envelope nonce.

§

VaultWithdraw

VaultWithdraw(string metafluxChain,uint64 vaultId,string shares,uint64 nonce)

Fields

§metaflux_chain: String

Chain tag.

§vault_id: u64

Vault id.

§shares: String

Share count as a canonical decimal string.

§nonce: u64

Envelope nonce.

§

SpotMarginDeposit

SpotMarginDeposit(string metafluxChain,uint32 pair,string amount,uint64 nonce)

Fields

§metaflux_chain: String

Chain tag.

§pair: u32

Spot margin pair id.

§amount: String

Amount as a canonical decimal string.

§nonce: u64

Envelope nonce.

§

SpotMarginWithdraw

SpotMarginWithdraw(string metafluxChain,uint32 pair,string amount,uint64 nonce)

Fields

§metaflux_chain: String

Chain tag.

§pair: u32

Spot margin pair id.

§amount: String

Amount as a canonical decimal string.

§nonce: u64

Envelope nonce.

§

SpotMarginOpen

SpotMarginOpen(string metafluxChain,uint32 pair,uint64 size,uint64 limitPx,string borrow,uint64 nonce)

Fields

§metaflux_chain: String

Chain tag.

§pair: u32

Spot margin pair id.

§size: u64

Order size on the 1e8 plane.

§limit_px: u64

Limit price on the 1e8 plane.

§borrow: String

Borrow amount as a canonical decimal string.

§nonce: u64

Envelope nonce.

§

EarnDeposit

EarnDeposit(string metafluxChain,uint32 asset,string amount,uint64 nonce)

Fields

§metaflux_chain: String

Chain tag.

§asset: u32

Asset id.

§amount: String

Deposit amount as a canonical decimal string.

§nonce: u64

Envelope nonce.

§

EarnWithdraw

EarnWithdraw(string metafluxChain,uint32 asset,string shares,uint64 nonce)

Fields

§metaflux_chain: String

Chain tag.

§asset: u32

Asset id.

§shares: String

Share count as a canonical decimal string.

§nonce: u64

Envelope nonce.

§

AgentSetAbstraction

AgentSetAbstraction(string metafluxChain,address user,uint8 kind,string value,uint64 nonce)

Fields

§metaflux_chain: String

Chain tag.

§user: Address

User address the abstraction applies to.

§kind: u8

Abstraction kind discriminant.

§value: String

Abstraction value, hashed verbatim as an EIP-712 string.

§nonce: u64

Envelope nonce.

§

MbWithdraw

MbWithdraw(string metafluxChain,uint8 chain,uint32 asset,uint64 amount,string dstAddr,uint64 nonce)

The signed chain is the mapped uint8 (0 = Solana, 1 = Base, 2 = Arbitrum); the POST params.chain carries the string name.

Fields

§metaflux_chain: String

Chain tag.

§chain: u8

Destination chain discriminant (0 = Solana, 1 = Base, 2 = Arbitrum).

§asset: u32

Asset id.

§amount: u64

Integer amount (not a decimal string).

§dst_addr: String

Destination address string for the target chain.

§nonce: u64

Envelope nonce.

§

CoreEvmTransfer

CoreEvmTransfer(string metafluxChain,string amount,bool toEvm,address destination,uint32 asset,uint64 nonce)

Fields

§metaflux_chain: String

Chain tag.

§amount: String

Amount as a canonical decimal string (whole-token plane).

§to_evm: bool

Direction: true = Core → MetaFluxEVM.

§destination: Address

MetaFluxEVM-side recipient address.

§asset: u32

MTF asset id to move (0 = USDC). Signed so a relay cannot redirect the transfer to a different spot token.

§nonce: u64

Envelope nonce.

§

CreateSubAccount

CreateSubAccount(string metafluxChain,string name,bool hasExplicitIndex,uint32 explicitIndex,bool sharedStpGroup,uint64 nonce)

The optional explicit index flattens to a presence bool + value (0 when absent).

Fields

§metaflux_chain: String

Chain tag.

§name: String

Human-readable sub-account name.

§has_explicit_index: bool

Explicit-index presence flag.

§explicit_index: u32

Explicit sub-account index (0 when absent).

§shared_stp_group: bool

Share the parent’s STP group.

§nonce: u64

Envelope nonce.

§

SubAccountTransfer

SubAccountTransfer(string metafluxChain,uint32 subIndex,bool deposit,string amount,uint64 nonce)

Fields

§metaflux_chain: String

Chain tag.

§sub_index: u32

Sub-account index (relative to the sender).

§deposit: bool

Direction (true = parent → sub).

§amount: String

Amount as a canonical decimal string.

§nonce: u64

Envelope nonce.

§

SubAccountSpotTransfer

SubAccountSpotTransfer(string metafluxChain,uint32 subIndex,uint32 token,bool deposit,string amount,uint64 nonce)

Fields

§metaflux_chain: String

Chain tag.

§sub_index: u32

Sub-account index.

§token: u32

Token (spot asset) id.

§deposit: bool

Direction (true = parent → sub).

§amount: String

Amount as a canonical decimal string.

§nonce: u64

Envelope nonce.

§

CDeposit

CDeposit(string metafluxChain,string amount,uint64 nonce) — spot MTF → free staking pool.

Fields

§metaflux_chain: String

Chain tag.

§amount: String

Amount of MTF to move, as a canonical decimal string.

§nonce: u64

Envelope nonce.

§

CWithdraw

CWithdraw(string metafluxChain,string amount,uint64 nonce) — free staking pool → spot MTF.

Fields

§metaflux_chain: String

Chain tag.

§amount: String

Amount of MTF to move, as a canonical decimal string.

§nonce: u64

Envelope nonce.

§

UserDexAbstraction

UserDexAbstraction(string metafluxChain,bool enabled,uint64 nonce)

Fields

§metaflux_chain: String

Chain tag.

§enabled: bool

Opt-in (true) / opt-out (false).

§nonce: u64

Envelope nonce.

§

UserSetAbstraction

UserSetAbstraction(string metafluxChain,uint8 kind,string value,uint64 nonce)

Fields

§metaflux_chain: String

Chain tag.

§kind: u8

Sub-type tag.

§value: String

Setting value, hashed verbatim as a canonical decimal string.

§nonce: u64

Envelope nonce.

§

PriorityBid

PriorityBid(string metafluxChain,uint32 asset,uint16 bidBps,uint64 nonce)

Fields

§metaflux_chain: String

Chain tag.

§asset: u32

Asset this bid is bound to.

§bid_bps: u16

Bid in basis points.

§nonce: u64

Envelope nonce.

§

CancelAllOrders

CancelAllOrders(string metafluxChain,bool hasAsset,uint32 asset,uint64 nonce)

The optional asset filter flattens to a presence bool + value (0 when “all assets”).

Fields

§metaflux_chain: String

Chain tag.

§has_asset: bool

Asset-filter presence flag.

§asset: u32

Asset filter (0 when “all assets”).

§nonce: u64

Envelope nonce.

§

SubmitEncryptedOrder

SubmitEncryptedOrder(string metafluxChain,bytes ciphertext,bytes32 commitment,uint8 threshold,uint64 targetBlock,uint64 revealDeadlineMs,uint64 nonce)

ciphertext hashes as EIP-712 bytes (keccak256(raw)); commitment is a bytes32 carried verbatim into one word.

Fields

§metaflux_chain: String

Chain tag.

§ciphertext: Vec<u8>

Encrypted order ciphertext (hashed as bytes).

§commitment: [u8; 32]

keccak(plaintext‖salt) commitment (bytes32).

§threshold: u8

Threshold shares to reveal.

§target_block: u64

Block height at/after which decryption may proceed.

§reveal_deadline_ms: u64

Consensus-time (ms) reveal deadline.

§nonce: u64

Envelope nonce.

Implementations§

Source§

impl TypedAction

Source

pub fn type_hash(&self) -> [u8; 32]

typeHash = keccak256(encodeType) for this variant.

Source

pub fn hash_struct(&self) -> [u8; 32]

hashStruct(s) = keccak256(typeHash ‖ encodeData(s)).

Trait Implementations§

Source§

impl Clone for TypedAction

Source§

fn clone(&self) -> TypedAction

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 TypedAction

Source§

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

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

impl Eq for TypedAction

Source§

impl PartialEq for TypedAction

Source§

fn eq(&self, other: &TypedAction) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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 StructuralPartialEq for TypedAction

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: Sized + 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: Sized + 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<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