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:
Structure | Type | Description |
---|---|---|
format | string (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 |
network | string (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 AddressInfo
object includes the following items for a given address:
Parameter | Type | Description |
---|---|---|
balances | object | A standard balanceInfos object. Not included in responses where get_balances is false |
derivation_method | object | A standard DerivationMethod object |
pubkey | string | The public key associated with the seed used to launch AtomicDEX |
tickers | array | A 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:
Parameter | Type | Description |
---|---|---|
spendable | string (numeric) | The available amount of a coin or token which is ready to be traded or withdrawn. |
unspendable | string (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:
Parameter | Type | Description |
---|---|---|
type | string | Defines 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 NumericFormatsValue
returns a price or amount in three different formats: fraction
, rational
, and decimal
.
Parameter | Type | Description |
---|---|---|
decimal | numeric string | A decimal number as a string. |
rational | object | A standard RationalValue object. |
fraction | object | A standard FractionalValue object. |
The FeeInfo
response object includes the following items for withdraw (v2) requests:
Parameter | Type | Description |
---|---|---|
type | string | Type of transaction fee; possible values: UtxoFixed , UtxoPerKbyte , EthGas |
amount | string (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_price | string (numeric) | Used only when fee type is EthGas; sets the gas price in gwei units |
gas | number (integer) | Used only when fee type is EthGas; sets the gas limit for transaction |
Structure | Type | Description |
---|---|---|
coin | string | the fee is paid from the user's balance of this coin. This coin name may differ from the base or rel coins. For example, ERC20 fees are paid by ETH (gas) |
amount | string (numeric) | fee amount (in decimal representation) |
amount_rat | rational | fee amount (in rational representation) |
amount_fraction | fraction | fee amount (in fraction representation) |
amount_fraction | fraction | fee amount (in fraction representation) |
paid_from_trading_vol | bool | whether the fee is paid from trading volume and not use actual coin balance |
Structure | Type | Description |
---|---|---|
coin | string | the fee is paid from the user's balance of this coin. This coin name may differ from the base or rel coins. For example, ERC20 fees are paid by ETH (gas) |
amount | string (numeric) | fee amount (in decimal representation) |
amount_rat | rational | fee amount (in rational representation) |
amount_fraction | fraction | fee amount (in fraction representation) |
required_balance | string (numeric) | the required coin balance to pay the fee |
required_balance_rat | rational | required_balance in rational representation |
required_balance_fraction | fraction | required_balance in fraction representation |
The FractionalValue
object includes a numerator and denominator values for a given price or amount:
Parameter | Type | Description |
---|---|---|
numer | string (numeric) | The numerator of the fractional value. |
denom | string (numeric) | The denominator of the fractional value. |
For requests which return many results, pagination offsets may be applied. ** Use either value, not both. **
Parameter | Type | Description |
---|---|---|
PageNumber | integer | Optional, defaults to 1 . Offset for paginated results |
FromId | integer | Optional. 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