latest contributor to this doc

Last Edit: @smk762 ,

Komodo DeFi SDK Common Structures

The objects are in the request or response of multiple Komodo DeFi SDK methods have been grouped into the following sections:

Structures which are used in more than one section are listed below:

StructureTypeDescription
formatstring (enum)address format to which the input address should be converted. Possible values: mixedcase for ETH/ERC20 coins; cashaddress or standard for UTXO coins; contract or wallet for QTUM/QRC20
networkstring (enum)Optional, only used for UTXO coins. Network prefix for cashaddress format. Possible values: bitcoincash for BCH mainnet; bchtest for BCH testnet; bchreg for BCH regtest

The addressInfos object includes the following items for a given address:

ParameterTypeDescription
balancesobjectA standard balanceInfos object. Not included in responses where get_balances is false
derivation_methodobjectA standard DerivationMethod object
pubkeystringThe public key associated with the seed used to launch AtomicDEX
tickersarrayA list of tokens which were successfully activated. Only included in responses where get_balances is false

The balanceInfos object includes the following items for a given coin or token:

ParameterTypeDescription
spendablestring (numeric)The available amount of a coin or token which is ready to be traded or withdrawn.
unspendablestring (numeric)The amount of a coin or token which is awaiting confirmation on the block chain for an incoming or outgoing transaction.

The DerivationMethod object includes the following items for a given coin or token:

ParameterTypeDescription
typestringDefines how keypairs will be generated. Possible values: Iguana or HDWallet

Using the same seed or private key to generate keypairs using different derivation methods will result in a different address and private key for each method.

Where the value indicates:

  • Iguana: The coin or token is was activated using Iguana derivation (default).
  • HDWallet: The coin or token is was activated using a Heirarchical Deterministic (HD) Wallet derivation path.

The FeeInfo response object includes the following items for withdraw (v2) requests:

ParameterTypeDescription
typestringType of transaction fee; possible values: UtxoFixed, UtxoPerKbyte, EthGas
amountstring (numeric)Fee amount in coin units, used only when type is UtxoFixed (fixed amount not depending on tx size) or UtxoPerKbyte (amount per Kbyte)
gas_pricestring (numeric)Used only when fee type is EthGas; sets the gas price in gwei units
gasnumber (integer)Used only when fee type is EthGas; sets the gas limit for transaction

The FractionalValue object includes a numerator and denominator values for a given price or amount:

ParameterTypeDescription
numerstring (numeric)The numerator of the fractional value.
denomstring (numeric)The denominator of the fractional value.

For requests which return many results, pagination offsets may be applied. ** Use either value, not both. **

ParameterTypeDescription
PageNumberintegerOptional, defaults to 1. Offset for paginated results
FromIdintegerOptional. Ignores any results prior to this UUID

The Komodo DeFi SDK now offers the num-rational crate feature which allows for higher precision numeric values to represent order volumes and prices in a unique format as explained below:

[
  [1, [0, 1]],
  [1, [1]]
]

In the above unique format, the first item [1,[0,1]] is the numerator and the second item [1,[1]] is the denominator.

The numerator and denominator are BigInteger numbers represented as a sign and a uint32 array (where numbers are 32-bit parts of big integer in little-endian order).

[1,[0,1]] represents +0000000000000000000000000000000010000000000000000000000000000000 = 4294967296

[-1,[1,1]] represents -1000000000000000000000000000000010000000000000000000000000000000 = -4294967297