On this page

latest contributor to this doc

Last Edit:

@gcharang

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 AddressInfo 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 Komodo DeFi Framework
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 NumericFormatsValue returns a price or amount in three different formats: fraction, rational, and decimal.

ParameterTypeDescription
decimalnumeric stringA decimal number as a string.
rationalobjectA standard RationalValue object.
fractionobjectA standard FractionalValue object.

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

ParameterTypeDescription
typestringType of transaction fee; possible values: UtxoFixed, UtxoPerKbyte, EthGas, Qrc20Gas, CosmosGas
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 Qrc20Gas or EthGas; sets the gas price in gwei units.
gas_pricenumber (double)Used only when fee type is CosmosGas; sets the gas price.
gasnumber (integer)Used only when fee type is EthGas; sets the gas limit for transaction
gas_limitnumber (integer)Used only when fee type is Qrc20Gas or CosmosGas; sets the gas limit for transaction

StructureTypeDescription
coinstringthe 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)
amountstring (numeric)fee amount (in decimal representation)
amount_ratrationalfee amount (in rational representation)
amount_fractionfractionfee amount (in fraction representation)
amount_fractionfractionfee amount (in fraction representation)
paid_from_trading_volboolwhether the fee is paid from trading volume and not use actual coin balance

StructureTypeDescription
coinstringthe 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)
amountstring (numeric)fee amount (in decimal representation)
amount_ratrationalfee amount (in rational representation)
amount_fractionfractionfee amount (in fraction representation)
required_balancestring (numeric)the required coin balance to pay the fee
required_balance_ratrationalrequired_balance in rational representation
required_balance_fractionfractionrequired_balance in fraction representation

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

ParameterTypeDescription
statestringcurrent state of sync; possible values: NotEnabled, NotStarted, InProgress, Error, Finished
additional_infoobjectA standard SyncStatusExtended object. Additional info that helps to track the progress; present for InProgress and Error states only.

ParameterTypeDescription
blocks_leftnumberpresent for ETH/ERC20 coins only; displays the number of blocks left to be processed for InProgress state
transactions_leftnumberpresent for UTXO coins only; displays the number of transactions left to be processed for InProgress state
codenumberdisplays the error code for Error state
messagenumberdisplays the error message for Error state

The WithdrawFee object varies depending on the coin or token type. Refer to the examples to view the object structure for each type.

ParameterTypeDescription
typestringThe fee type. Either Utxo, Tendermint, Qrc20 or Eth.
amountnumeric stringUtxo or Tendermint type only. The fee amount.
coinstringThe coin which will be used to pay the transaction fee.
gasintegerEth type only. The amount of gas to be used for the transaction.
gas_pricenumeric stringEth or Qrc20 type only. Price per unit of gas to be used for the transaction.
gas_limitnumeric stringTendermint or Qrc20 type only. Maximum gas to be used for the transaction.
miner_feenumeric stringTendermint type only. Fee to mine the transaction.
total_feenumeric stringEth type only. Gas price multiplied by gas amount.
total_gas_feenumeric stringQrc20 type only. Gas price multiplied by gas amount.