Skip to main content

sendOrders

Submits orders to the node

Parameters

ParameterTypeDescription
ordersArray<Order>An array of order objects. Each order must adhere to one of the variants defined in Order Types.

Result

The endpoint returns a NewOrderResult (a RpcResult<Vec<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.

  • Valid

  • Invalid

  • TransitionedToBlock

  • Error(String) // generic

Code Sample

 curl "NODE_URL" -X POST -H "Content-Type: application/json" -d '
{
"jsonrpc": "2.0",
"id": 0,
"method": "angstrom_sendOrders",
"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"
}
}
},
{
"PartialFlash": {
"ref_id": 0,
"min_amount_in": 36585759681547,
"max_amount_in": 182928798407739,
"max_extra_fee_asset0": 36585759681547,
"min_price": "0x115f51e31954cc0000000000000",
"use_internal": false,
"asset_in": "0x45cb6df752760cc995fe9b05c61ce6bd8776b1e7",
"asset_out": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"recipient": "0x0000000000000000000000000000000000000000",
"hook_data": "0x",
"valid_for_block": 21946390,
"meta": {
"isEcdsa": true,
"from": "0x39f11b34e4702bcfbce388c919e7d77b45b4df94",
"signature": "0x009c30da5981d21825f67a4602706a19e227ac8eb2ed07852f41c06aa4c041fb1f05486237f95aa70bcafa75a15aa37fe557eebceed53bbb26fbb2324964219a98"
}
}
},
{
"PartialFlash": {
"ref_id": 0,
"min_amount_in": 191943642011194270,
"max_amount_in": 959718210055971300,
"max_extra_fee_asset0": 191943642011194270,
"min_price": "0x11651ad7f141c70000000000000",
"use_internal": false,
"asset_in": "0x45cb6df752760cc995fe9b05c61ce6bd8776b1e7",
"asset_out": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"recipient": "0x0000000000000000000000000000000000000000",
"hook_data": "0x",
"valid_for_block": 21946390,
"meta": {
"isEcdsa": true,
"from": "0x39f11b34e4702bcfbce388c919e7d77b45b4df94",
"signature": "0x0035a43bf443d79c02f322eba135a9d0ad98a380ed44479bff4397e866f08eee1b45dc0b5a397a4759481d2add3873547ef74360455a04d58e567469d80e7ead4b"
}
}
},
{
"TOB": {
"quantity_in": 7608902657663,
"quantity_out": 167369904393341980,
"max_gas_asset0": 3804451328831,
"use_internal": false,
"asset_in": "0x45cb6df752760cc995fe9b05c61ce6bd8776b1e7",
"asset_out": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"recipient": "0x0000000000000000000000000000000000000000",
"valid_for_block": 21946390,
"meta": {
"isEcdsa": true,
"from": "0x39f11b34e4702bcfbce388c919e7d77b45b4df94",
"signature": "0x01b29e55691de54bbc4f92243a2a70ef631c8c5886ef66e490303b69076c50126721b0121ca71821d42f68e22e79c41068c685d1f0b9b2298c679e2cc268e43680"
}
}
}
]
]
}
'

Response Example

{
"jsonrpc": "2.0",
"id": "0",
"result": [
{
"is_success": true,
"data": {
"Ok": "0x234234..34",
},
"msg": ""
},
{
"is_success": true,
"data": {
"Ok": "0x234234..34",
},
"msg": ""
},
{
"is_success": true,
"data": {
"Ok": "0x234234..34",
},
"msg": ""
},
{
"is_success": true,
"data": {
"Ok": "0x234234..34",
},
"msg": ""
},
{
"is_success": false,
"data": {
"Err": "InvalidPool"
},
"msg": "invalid pool"
},
{
"is_success": false
"data": {
"Err": "NonEmptyHook"
},
"msg": "currently hooks are not supported. this field should be empty bytes"
}
},
{
"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."
}
}
]
}