Creating orders
Last updated
Last updated
THE FEE MODEL IS CHANGING IN THE LATEST VERSION (V3) OF THE API.
Please refer to this guide to learn more about maker taker fees when you plan your migration to the upgraded v3 endpoints.
An order is a sale listing for an asset. It contains details like price and sale period. Some applications, such as marketplaces, may want to allow users to create orders in order to sell their assets.
When an order is created, it is added to XpansionChain's global orderbook service on StarkEx. This orderbook is shared by all applications built on the XpansionChain protocol, which means that it can be accessed and displayed by any of them - allowing your order to be visible and available to be transacted with by all protocol participants.
This means that transations aren't siloed within certain applications, and has massive interoperability advantages for all assets and applications on the protocol.
📝GUIDES
Core SDK
Link SDK
In order to use the Core SDK, you need to initialize it.
Creating an order for a user requires a user's signature, so your application will need to create signers. See the guide on how to generate signers.
WHEN SETTING MAKER FEES IN THE ORDER PARAMS
You cannot set more than 3 recipients
You cannot set the same recipient more than once
The combined fee percentage can’t exceed 100%
Individual percentage fees can’t be <= 0% :::
Typescript Core SDK
📚SDK REFERENCE
createOrder
The createOrder workflow is available in the Core SDK and is used to create an order for a user. It takes the following parameters:
The parameters required to fill the UnsignedOrderRequest are:
These parameters can be set with the following code:
Note: If creating a bid, the buy token will be the ERC721 and the sell token will be ERC20 / ETH.
Kotlin (JVM) Core SDK
📚SDK REFERENCE
See params required for createOrder
Swift Core SDK
📚SDK REFERENCE
See params required for createOrder
Golang Core SDK
📚SDK REFERENCE
See params required for createOrder
💻EXAMPLE
createOrder
Typescript Core SDK
📚SDK REFERENCE
createOrder
Combining the parameters from the previous step, you can create an order. The response will contain the order ID, status and timestamp.
The following code snippet shows how to create an order with the parameters from the previous step:
Kotlin (JVM) Core SDK
📚SDK REFERENCE
createOrder
Swift Core SDK
📚SDK REFERENCE
createOrder
Golang Core SDK
📚SDK REFERENCE
See params required for CreateOrder
💻EXAMPLE
CreateOrder
Typescript Core SDK
📚SDK REFERENCE
cancelOrder
Let's say you wish to cancel the previous order. You can use the cancelOrder workflow. The response will contain the order ID and status of the order.
Kotlin (JVM) Core SDK
📚SDK REFERENCE
cancelOrder
Swift Core SDK
📚SDK REFERENCE
cancelOrder
Golang Core SDK
📚SDK REFERENCE
CancelOrder
💻EXAMPLE
CancelOrder example from our SDK repo