Partner Integration
Partners enjoy many benefits via integrating with the Hiding Book.
The Hiding Book requires the following integration components
  • 0xv4 integration
  • Wallet providers of your choice
    • MetaMask, Ledger, etc
  • A user interface for user input
    • tokenIn, tokenOut
    • order expiration
    • price
  • A user interface for displaying orders
    • view open orders
    • cancel orders
    • view historic orders
When the User:Arrives at the Trading Interface
Make a call to the GET /info endpoint to get the information you need to initialize the trading screen. The response contains useful information like supported tokens and data needed to sign orders.
When the User Is Ready to Sign an Order
Combine the user inputted information along with the properties from the GET /info endpoint to create a valid 0xv4 order.
When You Are Ready to Submit a Signed Order
Make a call to the POST /orders endpoint to post the order to the Hiding Book for validation. The server will alert you of any errors, insufficient balances, or insufficient allowances.
When the User is to Approve Allowances
Allowances are to be made where the spender is the 0xv4 verifyingContract provided in the GET /info endpoint.
When the User Wants to View Orders
Make a call to the GET /orders endpoint to get the user's orders. Specify the user's address as the maker. From there you can display them on the screen, present state and fill % information, and give the user the option to cancel an order. The order's status corresponds with 0x's enum OrderStatus. https://0xprotocol.readthedocs.io/en/latest/basics/functions.html?highlight=fill%20state#getrfqorderinfo
When the User Wants to Cancel an Order
The user needs to sign and broadcast a cancel transaction to the blockchain. There are a variety of ways to cancel orders, including cancel one order, batch cancel many orders, etc.
Calculating an Order's Fill %
Use the order data and make a simple calculation:
fillPercentage = filledAmount_takerToken / takerAmount
Determining an Order's Status
Use the order data's status and refer to 0x's OrderStatus enum.
0xv4 Audits
0xv4 Javascript Modules
These modules can be found at https://www.npmjs.com/.
Last modified 4mo ago
Copy link