sendOrder
Submits a order to the node
Parameters
Parameter | Type | Description |
---|---|---|
Order | Object | An order payload that conforms to the Order enum type. See the Order Types doc for details. |
Result
The endpoint returns a NewOrderResult (a RpcResult<Object>
).
- If the order is valid, it returns an
Ok: "0x324..."
with the order hash. - If the order is invalid, it returns an
Err
with one of the error variants below.
Error Variants
Error Variant | Data | Description |
---|---|---|
BlockMissMatch | { requested: u64, current: u64, pool_info: UserOrderPoolInfo } | The block specified in the order does not match the current block context. |
OrderIsCancelled | (B256) | The order has already been cancelled. |
DuplicateNonce | (B256) | The provided nonce has already been used. |
BadBlock | (u64, u64) | Mismatch between the expected and current block numbers. |
NonEmptyHook | — | The hook data must be empty. |
InvalidToBSwap | — | The order is not valid for token swap operations. |
InvalidPartialOrder | — | The partial order parameters are invalid. |
InvalidSignature | — | The provided signature is invalid. |
InvalidPool | — | The referenced liquidity pool is invalid. |
NotEnoughGas | — | Insufficient gas for executing the order. |
DuplicateOrder | — | The order has already been submitted. |
InvalidOrderAtBlock | — | The order is not valid for the specified block. |
Unknown | (String) | An unspecified error occurred. |
Code Sample
curl "NODE_URL" -X POST -H "Content-Type: application/json" -d '
{
"jsonrpc": "2.0",
"id": 0,
"method": "angstrom_sendOrder",
"params": [
"PartialFlash": {
"ref_id": 0,
"min_amount_in": 1679691276497,
"max_amount_in": 8398456393500,
"max_extra_fee_asset0": 76143570,
"min_price": "0x99972442831653c2f9a",
"use_internal": false,
"asset_in": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"asset_out": "0x45cb6df752760cc995fe9b05c61ce6bd8776b1e7",
"recipient": "0x0000000000000000000000000000000000000000",
"hook_data": "0x",
"valid_for_block": 21946390,
"meta": {
"isEcdsa": true,
"from": "0x39f11b34e4702bcfbce388c919e7d77b45b4df94",
"signature": "0x0177fbdd742d7970f331725233ceef77cf8194995ee9a45d763c259972b936302677d5300ef47ef0120748b2711fd308fc9d59a8f9ce3876faa1955b5ed1a144b0"
}
}
]
}
'
Response Examples
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"is_success": true
"data": {
"Ok": "0x23432524512535"
},
"msg": ""
}
}
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"is_success": false,
"data": {
"Err": {
"BadBlock": {
"next_block": 51,
"requested_block" : 50
}
}
},
"msg": "
"block for flash order is not for next block. next_block: 51, requested_block: 50."
}
}
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"Err": "InvalidPool"
}
}