Executes
Vertex Executes - Websocket and REST API
Last updated
Vertex Executes - Websocket and REST API
Last updated
All executes go through the following endpoint; the exact details of the execution are specified by the JSON payload.
Websocket: WEBSOCKET [GATEWAY_WEBSOCKET_ENDPOINT]
REST: POST [GATEWAY_REST_ENDPOINT]/execute
All executes are signed using . Each execute request contains:
A piece of structured data that includes the sender address
A signature of the hash of that structured data, signed by the sender
You can check the for some examples of how to generate these signatures.
The sender field is a solidity bytes32
. There are two components:
an address
that is a bytes20
a subaccount identifier that is a bytes12
For example, if your address was 0x7a5ec2748e9065794491a8d29dcf3f9edb8d7c43
, and you wanted to use the default subaccount identifier (i.e: the word default
) you can set sender
to 0x7a5ec2748e9065794491a8d29dcf3f9edb8d7c4364656661756c740000000000
, which sets the subaccount identifier to 64656661756c740000000000
.
For DepositCollateral
and WithdrawCollateral
, the amount specifies the physical token amount that you want to receive. i.e.
if USDC has 6 decimals, and you want to deposit or withdraw 1 USDC, you specify amount = 1e6
.
For all other transactions, amount is normalized to 18 decimals, so 1e18
== one unit of the underlying asset. For example, if you want to buy 1 wETH, regardless of the amount of decimals the wETH contract has on chain, you specify 1e18
in the amount field of the order.
All Execute
messages return the following information: