Skip to content

Private Node API

Place Order

The Place Order method is used to execute a transaction that places an order on a market.

This function takes parameters for wallet authentication, various order details, and optional transaction options to manage specific order types and behaviors.

Method Declaration

Python
async def place_order(
    self,
    wallet: Wallet,
    order: Order,
    tx_options: Optional[TxOptions] = None,
)
Unification Plan
  • Use a convenient Wallet and Order pair for all clients
  • TypeScript doesn't use authenticators
  • In Python we use them explicitly
  • Consider to do the same like in Rust (set it automatically)

Parameters

ParameterLocationTypeRequiredDescription
walletqueryWallettrueThe wallet to use for signing the transaction.
orderqueryOrdertrueThe order to place.
tx_optionsqueryTxOptionsfalseOptions for transaction to support authenticators.

Response

StatusMeaningSchema
200OKTxHash

Examples: Python | TypeScript | Rust

Cancel Order

The Cancel Order method terminates an existing order using the provided order_id and related parameters, such as block validity periods and transaction options. This method supports asynchronous operations for efficient order cancellation across different platforms.

Method Declaration

Python
async def cancel_order(
    self,
    wallet: Wallet,
    order_id: OrderId,
    good_til_block: int = None,
    good_til_block_time: int = None,
    tx_options: Optional[TxOptions] = None,
)
Unification Plan
  • Check the marketId is really needed (used in TypeScript)

Parameters

ParameterLocationTypeRequiredDescription
walletqueryWallettrueThe wallet to use for signing the transaction.
order_idqueryOrderIdtrueThe ID of the order to cancel.
good_til_blockqueryi32falseThe block number until which the order is valid. Defaults to None.
good_til_block_timequeryi32falseThe block time until which the order is valid. Defaults to None.
tx_optionsqueryTxOptionsfalseOptions for transaction to support authenticators.

:::

Response

StatusMeaningSchema
200[OK]TxHash

Examples: Rust

Send Token

The Send Token function is used to transfer a specified token from one blockchain address to another.

It requires details such as the wallet for signing the transaction, sender and recipient addresses, and the quantum amount or denomination of the token.

Method Declaration

Python
async def send_token(
    self,
    wallet: Wallet,
    sender: str,
    recipient: str,
    quantums: int,
    denomination: str,
)
Unification Plan
  • All the types are different, revision is needed
  • Standard types like strings are used
  • Broadcast mode?
  • Zero fee?

Parameters

ParameterLocationTypeRequiredDescription
walletqueryWallettrueThe wallet to use for signing the transaction.
senderqueryStringtrueThe sender address.
recipientqueryStringtrueThe recipient address.
quantumsqueryi32trueThe amount of quantums to send.
denominationqueryi32trueThe denomination of the token.

Response

StatusMeaningSchema
200OKTxHash

Examples: Rust

Simulate

The Simulate function allows for the pre-execution simulation of a transaction, predicting its execution cost and resource usage without committing any changes.

This method typically returns information like estimated gas fees or other transaction-related metrics to anticipate the impact of operations before they are executed on the blockchain.

Method Declaration

Python
async def simulate(self, transaction: Tx)
Unification Plan
  • Some extra parameters in TypeScript? What to do with them?

Parameters

ParameterLocationTypeRequiredDescription
transactionqueryTxtrueThe transaction to simulate.

Response

StatusMeaningSchema
200OKGasInfo

Examples: Python | TypeScript | Rust

Broadcast Transaction

The Broadcast Transaction method is used to send a transaction to the network for processing.

The key parameters include the transaction itself and the mode of broadcasting, which is optional and defaults to synchronous broadcasting mode.

Method Declaration

Python
async def broadcast(self, transaction: Tx, mode=BroadcastMode.BROADCAST_MODE_SYNC)
Unification Plan

Parameters

ParameterLocationTypeRequiredDescription
transactionqueryTxtrueThe transaction to broadcast.
modequeryBroadcastModefalseThe broadcast mode. Defaults to BroadcastMode.BROADCAST_MODE_SYNC.

:::

Response

StatusMeaningSchema
200OKTxHash

Examples: Rust