Transactions

authorize-order

Authorize every economic term of a order through the account's origin.

View as Markdown

Supports direct post-quantum owners, proxies, derivatives, and multisigs. This grants relayers the complete specified trade; funds move only on execution. Cancel with the same nonce and complete order to revoke its unfilled part.

SignerOriginPalletWraps
coldkeysigned account (pallet role may apply)LimitOrdersLimitOrders.authorize_order

Parameters

ParameterTypeRequiredDescription
nonceintegeryesPermanent owner-local u64 order nonce.
orderobjectyesComplete V1 or V2 VersionedOrder, including every economic term.
order_datastringnoOptional pinned canonical VersionedOrder SCALE bytes as hex.

Address parameters (--hotkey, --coldkey, --dest, ...) accept a raw ss58 address, an address-book or proxy-book name, or a local wallet/hotkey name.

CLI

Preview with --dry-run (shows fee, effects, and policy result without submitting), then submit:

btcli tx authorize-order \
  --nonce <int> \
  --order '<json>' --dry-run
btcli tx authorize-order \
  --nonce <int> \
  --order '<json>' -w my_coldkey

Python

import bittensor as bt
from bittensor.wallet import Wallet

wallet = Wallet(name="my_coldkey", hotkey="my_hotkey")
intent = bt.AuthorizeOrder(nonce=0, order={...})

sub = bt.Subtensor()
plan = sub.plan(intent, wallet)   # fee, effects, policy — no submission
result = sub.execute(intent, wallet)
if not result.success:
    print(result.error.code, result.error.remediation)

(bt.Subtensor is also the async client — async with bt.Subtensor() as client: — see The client.) Or build the intent by op name, as an agent would:

result = sub.execute_tool("authorize_order", {...}, wallet)

On-chain implementation

LimitOrders.authorize_order — pallets/limit-orders/src/lib.rs#L773:

#[pallet::call_index(5)]
#[pallet::weight(T::WeightInfo::authorize_order())]
#[transactional]
pub fn authorize_order(
    origin: OriginFor<T>,
    order: VersionedOrder<AccountId32>,
) -> DispatchResult {
    let who = ensure_signed(origin)?;
    ensure!(order.signer() == &who, Error::<T>::Unauthorized);
    let (nonce, terms) = order
        .authorized_terms()
        .ok_or(Error::<T>::InvalidAuthorizationMode)?;
    ensure!(
        LimitOrdersEnabled::<T>::get(),
        Error::<T>::LimitOrdersDisabled
    );
    ensure!(
        T::AuthenticatedOrderSignerFilter::contains(&who),
        Error::<T>::OrderSignerFrozen
    );
    let id = Self::approve_order(&who, nonce, &terms)?;
    Self::deposit_event(Event::OrderApproved {
        order_id: id,
        signer: who,
        nonce,
    });
    Ok(())
}

Delegates to approve_order.

Every file is browsable under /code exactly as built into the runtime, or as plain text under /code/raw/<path> (index: /code/index.json).