Komodo DeFi SDK RPC Protocol v2.0
Starting with version beta-2.1.3434, the Komodo DeFi SDK supports the standardized protocol format called mmrpc 2.0
.
It includes a uniform request, successful and error response formats. At the moment, only a few RPC methods support the mmrpc 2.0
protocol.
Structure | Type | Description |
---|---|---|
mmrpc | string | the string specifying the version of the Komodo DeFi SDK RPC protocol. Must be exactly "2.0" |
userpass | string (optional) | your password for protected RPC methods. Skip this field if the specified method is public |
method | string | the name of the method to be invoked |
params | object (optional) | a structured value that holds the parameter values to be used during the invocation of the method. This field may be omitted if the method doesn't take arguments |
id | number (optional) | the identifier is established by the client. Komodo DeFi SDK will reply with the same value in the Response object if the id field is included and not NULL |
Structure | Type | Description |
---|---|---|
mmrpc | string | the string specifying the version of the Komodo DeFi SDK RPC protocol |
result | object | the value of this field is determined by the method invoked on Komodo DeFi SDK |
id | number (optional) | the identifier established by the client. The same value as in the Request if it was passed |
Structure | Type | Description |
---|---|---|
mmrpc | string | the string specifying the version of the Komodo DeFi API RPC protocol |
error | string | the common error description |
error_path | string | the error path consisting of file names separated by a dot similar to JSON path notation |
error_trace | string | the error path consisting of file and line number pairs separated by ']' |
error_type | string | the string error identifier used to determine the cause of the error |
error_data | object | an object containing the error data of the corresponding error_type |
id | number (optional) | the identifier established by the client. The same value as in the Request if it was passed |
{
"mmrpc": "2.0",
"userpass": "RPC_UserP@SSW0RD",
"method": "withdraw",
"params": {
"coin": "KMD",
"to": "RJTYiYeJ8eVvJ53n2YbrVmxWNNMVZjDGLh",
"amount": "10"
},
"id": 0
}
The folowing objects are used in the request or response of multiple Komodo DeFi SDK methods.
The available
balance is not sufficient to transfer the specified amount.
Structure | Type | Description |
---|---|---|
coin | string | the name of the coin which balance is not sufficient. This coin name may differ from the requested coin. For example, ERC20 fees are paid by ETH (gas) |
available | string (numeric) | the balance available for transfer |
required | string (numeric) | the amount required to transfer the specified amount. This amount is necessary but may not be sufficient |
{
"mmrpc": "2.0",
"error": "Not enough DOC to withdraw: available 69.75066225, required at least 1000.00001",
"error_path": "utxo_common",
"error_trace": "utxo_common:1379] utxo_common:449]",
"error_type": "NotSufficientBalance",
"error_data": {
"coin": "DOC",
"available": "69.75066225",
"required": "1000.00001"
},
"id": 0
}
The available balance is zero.
Structure | Type | Description |
---|---|---|
(none) |
The specified amount is too low. Required at least threshold
.
Structure | Type | Description |
---|---|---|
amount | string (numeric) | the amount the user was willing to transfer |
threshold | string (numeric) | the amount has not to be less than the threshold |
The specified to
address is not valid.
Structure | Type | Description |
---|---|---|
(none) | string | the error description |
The specified fee
is not valid.
Structure | Type | Description |
---|---|---|
(none) | string | the error description |
{
"mmrpc": "2.0",
"error": "Invalid fee policy: Expected 'UtxoFixed' or 'UtxoPerKbyte' fee types, found EthGas",
"error_path": "utxo_common",
"error_trace": "utxo_common:1371]",
"error_type": "InvalidFeePolicy",
"error_data": "Expected 'UtxoFixed' or 'UtxoPerKbyte' fee types, found EthGas",
"id": 0
}
{
"mmrpc": "2.0",
"error": "Invalid fee policy: Expected 'EthGas' fee type, found UtxoFixed",
"error_path": "eth",
"error_trace": "eth:535]",
"error_type": "InvalidFeePolicy",
"error_data": "Expected 'EthGas' fee type, found UtxoFixed",
"id": 0
}
The specified coin was not found or is not activated yet.
Structure | Type | Description |
---|---|---|
coin | string | the not found coin specified in the Request |
The request was failed due to a network error.
Structure | Type | Description |
---|---|---|
(none) | string | the transport error description |
The request was failed due to an Komodo DeFi API internal error.
Structure | Type | Description |
---|---|---|
(none) | string | the internal error description |
{
"mmrpc": "2.0",
"error": "TTT-SLP",
"error_path": "my_tx_history_v2.lp_coins",
"error_trace": "my_tx_history_v2:389] lp_coins:2847]",
"error_type": "CoinIsNotActive",
"error_data": "TTT-SLP",
"id": null
}
{
"mmrpc": "2.0",
"error": "TTT-SLP",
"error_path": "my_tx_history_v2",
"error_trace": "my_tx_history_v2:336]",
"error_type": "NotSupportedFor",
"error_data": "TTT-SLP",
"id": null
}
{
"mmrpc": "2.0",
"error": "Storage is not initialized for TTT-SLP",
"error_path": "my_tx_history_v2",
"error_trace": "my_tx_history_v2:343]",
"error_type": "StorageIsNotInitialized",
"error_data": "Storage is not initialized for TTT-SLP",
"id": null
}
{
"mmrpc": "2.0",
"error": "SqliteFailure(Error { code: Unknown, extended_code: 1 }, Some(\"no such column: block_height\"))",
"error_path": "my_tx_history_v2.sql_tx_history_storage",
"error_trace": "my_tx_history_v2:351] sql_tx_history_storage:472]",
"error_type": "StorageError",
"error_data": "SqliteFailure(Error { code: Unknown, extended_code: 1 }, Some(\"no such column: block_height\"))",
"id": null
}