blocknet icon indicating copy to clipboard operation
blocknet copied to clipboard

Add optional UTXOs parameter

Open shrnkld opened this issue 4 years ago • 1 comments

Scenario: When dxMakePartialOrder or dxMakeOrder are called, there is currently no way to control where funds come from in the order and there is no way to prevent XBridge from autosplitting UTXOs on calls to dxMakePartialOrder.

The use_all_funds param is being added to allow for proper segregation and accounting of funds within a wallet, which in turn allows a trading bot to trade multiple pairs more conveniently.

To do:

  • [x] Add optional use_all_funds parameter to dxMakePartialOrder
  • true (default) - dxMakePartialOrder uses funds from all available addresses
  • false - dxMakePartialOrder will try to use funds only from the address specified by the maker_address parameter.

  • [x] Add optional use_all_funds parameter to dxMakeOrder
  • true (default) - dxMakeOrder uses funds from all available addresses
  • false - dxMakeOrder will try to use funds only from the address specified by the maker_address parameter.

  • [x] When a partial or exact order is created and use_all_funds = false, XBridge needs to check if there are sufficient funds in the address as follows:
  • if use_all_funds option = false, when an order is created by calling dxMakePartialOrder or dxMakeOrderand XBridge verifies there are not enough funds available in maker_address to make the order, then return the error insufficient_funds

  • [x] add optional auto_split parameter to dxMakePartialOrder
  • true (default) - funds are split into multiple UTXOs if needed before a partial order is placed
  • false - funds are not split into multiple UTXOs before a partial order is placed.

Important: no error log is needed when this parameter is set to false, and setting this parameter to false should not affect whether or not the order is successfully placed.

Goal: Prevent paying extra fees and incurring delays due to autosplitting UTXOs when using trade bots.

Ref: https://api.blocknet.co/#dxmakepartialorder

shrnkld avatar Jul 19 '21 09:07 shrnkld

Test builds: https://gitlab.com/blocknetdx/blocknet/-/pipelines/334555871

shrnkld avatar Aug 02 '21 10:08 shrnkld