Skip to main content

order_to_derive_payload

Function order_to_derive_payload 

Source
pub fn order_to_derive_payload(
    order: &OrderAny,
    instrument: &DeriveInstrument,
    subaccount_id: u64,
    wallet: Address,
    signer: &PrivateKeySigner,
    nonce: u64,
    signature_expiry_sec: i64,
    module_address: Address,
    domain_separator: B256,
    action_typehash: B256,
    max_fee: Decimal,
    explicit_price: Option<Decimal>,
) -> Result<DeriveOrderParams>
Expand description

Builds typed params for a signed private/order request.

wallet is the owner address, signer_address the session-key address, and nonce / signature_expiry_sec come from crate::signing::nonce::NonceManager and the configured expiry policy. explicit_price overrides the limit price slot. Callers must supply it for market orders because Derive signs the worst-acceptable price into the EIP-712 trade module data.

§Errors

Returns an error when the order is not a Limit or Market order, when the instrument’s base_asset_address cannot be parsed, when decimal scaling fails, when a Market order is submitted without an explicit_price, or when EIP-712 signing fails.