On this page

latest contributor to this doc

Last Edit:

@smk762

Task: ETH/EVM Activation

API-v2task::enable_eth::init

Use this method for task managed activation of ETH/EVM coins & tokens. Refer to the task managed activation overview for activation of other coin types.

Parameter* = requiredTypeDescription
erc20_tokens_requests*
array of objects
A list of standard TokensRequest objects.
fallback_swap_contract*
string
Address of backup etomic swap smart contract.
nodes*
array of objects
A list of standard CoinNode objects.
swap_contract_address*
string
Address of etomic swap smart contract
ticker*
string
Ticker of the platform protocol coin. Options: ETH, AVAX, BNB, FTM, MATIC, ONE, ETH-ARB20
gap_limit
integer
Optional. HD wallets only. The max number of empty addresses in a row. If transactions were sent to an address outside the gap_limit, they will not be identified when scanning.
gas_station_decimals
integer
default: `8`
Optional. For ETH/ERC20 and other gas model chains. Defines the decimals used to denominate the gas station response to gwei units. For example, the ETH gas station uses 8 decimals, which means that "average": 860 is equal to 86 gwei. While the Matic gas station uses 9 decimals, so 860 would mean 860 gwei exactly.
gas_station_policy.policy
string
default: `"MeanAverageFast"`
Optional. For ETH/ERC20 and other gas model chains. Defines the method of gas price calculation from the station response. "MeanAverageFast" will use the mean between average and fast fields. "Average" will return a simple average value.
gas_station_url
string
Optional. A url for gas station api.
get_balances
boolean
default: `true`
Optional. If false, coin and token balances will not be returned in the response, and the response will be returned more quickly.
min_addresses_number
integer
Optional. HD wallets only. How many additional addreesses to generate at a minimum.
mm2
integer
Optional. Required if not set in coins file. Informs the Komodo DeFi Framework API whether or not the coin is expected to function. Accepted values are 0 or 1
nft_req
object
Optional. Non-HD only. encapsulates the request parameters for NFT activation, including NFT provider configuration.
path_to_address
object
Optional. HD wallets only. A standard AddressPath object.
priv_key_policy
string
default: `ContextPrivKey`
Optional. Value can be ContextPrivKey,Trezor when Komodo DeFi Framework is built for native platforms. value can be ContextPrivKey, Trezor, Metamask when the Komodo DeFi Framework is built targeting wasm
required_confirmations
integer
default: `3`
Optional. When the platform coin is involved, the number of confirmations for the Komodo DeFi Framework API to wait during the transaction steps of an atomic swap
requires_notarization
boolean
default: `false`
Optional. If true, coins protected by Komodo Platform's dPoW security will wait for a notarization before progressing to the next atomic swap transactions step.
rpc_mode
string
default: `Default`
Optional. Value can be Metamask only when the Komodo DeFi Framework is built targeting wasm.
scan_policy
string
Optional. HD wallets only. Whether or not to scan for new addresses. Select from do_not_scan, scan_if_new_wallet or scan. Note that scan will result in multple requests to the Komodo DeFi Framework.
swap_v2_contracts
object
Optional. Must be provided if "use_trading_proto_v2" is true in your configuration. A standard SwapV2Contracts object.
tx_history
boolean
default: `false`
Optional. If true the Komodo DeFi Framework API will preload transaction history as a background process. Must be set to true to use the my_tx_history method

ParameterTypeDescription
statusstringA short indication of how the enabling is progressing.
detailsobjectDepending on the state of enabling progress, this will contain different information as shown in the responses below.

Possible status values while activation is in progress:

  • ActivatingCoin: The first step of activation. It does not require any action from the user.
  • RequestingWalletBalance: The first step of activation, while initial balances info is being requested. It does not require any action from the user.
  • Finishing: Activation process completed
  • WaitingForTrezorToConnect: Waiting for the user to plugin a Trezor device
  • FollowHwDeviceInstructions: Waiting for the user to follow the instructions on the device

Once complete, status will be Ok, and the details object will have the following structure:

Parameter* = requiredTypeDescription
task_id*
integer
An identifying number which is used to query task status.

task::enable_eth::init

POST
task::enable_eth::init
{
  "method": "task::enable_eth::init",
  "mmrpc": "2.0",
  "params": {
    "erc20_tokens_requests": [
      {
        "required_confirmations": 4,
        "ticker": "PGX-PLG20"
      },
      {
        "required_confirmations": 4,
        "ticker": "AAVE-PLG20"
      }
    ],
    "fallback_swap_contract": "0x9130b257D37A52E52F21054c4DA3450c72f595CE",
    "gap_limit": 20,
    "gas_station_url": "https://gasstation-mainnet.matic.network/",
    "min_addresses_number": 3,
    "nodes": [
      {
        "url": "https://pol3.cipig.net:18755",
        "ws_url": "wss://pol3.cipig.net:38755"
      },
      {
        "url": "https://polygon-bor-rpc.publicnode.com",
        "ws_url": "wss://polygon-bor-rpc.publicnode.com"
      }
    ],
    "path_to_address": {
      "account_id": 0,
      "address_id": 1,
      "chain": "External"
    },
    "required_confirmations": 5,
    "scan_policy": "scan_if_new_wallet",
    "swap_contract_address": "0x9130b257D37A52E52F21054c4DA3450c72f595CE",
    "swap_v2_contracts": {
      "maker_swap_v2_contract": "0x9130b257D37A52E52F21054c4DA3450c72f595CE",
      "nft_maker_swap_v2_contract": "0x9130b257D37A52E52F21054c4DA3450c72f595CE",
      "taker_swap_v2_contract": "0x9130b257D37A52E52F21054c4DA3450c72f595CE"
    },
    "ticker": "MATIC"
  },
  "userpass": "RPC_UserP@SSW0RD"
}

{
  "mmrpc": "2.0",
  "result": {
    "task_id": 1
  },
  "id": null
}
API-v2task::enable_eth::status

After running the task::enable_eth::init method, we can query the status of activation to check its progress. The response will return the following:

  • Result of the task (success or error)
  • Progress status (what state the task is in)
  • Required user action (what user should do before the task can continue)

Parameter* = requiredTypeDescription
task_id*
integer
The identifying number returned when initiating the initialisation process.
forget_if_finished
boolean
default: `true`
Optional. If false, will return final response for completed tasks.

task::enable_eth::status

POST
task::enable_eth::status
{
  "method": "task::enable_eth::status",
  "mmrpc": "2.0",
  "params": {
    "forget_if_finished": false,
    "task_id": 1
  },
  "userpass": "RPC_UserP@SSW0RD"
}

Parameter* = requiredTypeDescription
current_block*
integer
Block height of the coin being activated
ticker*
string
Ticker of the coin being activated.
wallet_balance*
object
A standard WalletBalanceInfo object. Note: the structure may vary based on the get_balances parameter value in the activation request.
  {
  "mmrpc": "2.0",
  "result": {
      "status": "Ok",
      "details": {
          "current_block": 70970530,
          "ticker": "MATIC",
          "wallet_balance": {
              "wallet_type": "HD",
              "accounts": [
                  {
                      "account_index": 0,
                      "derivation_path": "m/44'/60'/0'",
                      "total_balance": {
                          "AAVE-PLG20": {
                              "spendable": "0.0275928341263563",
                              "unspendable": "0"
                          },
                          "PGX-PLG20": {
                              "spendable": "237.729414631067",
                              "unspendable": "0"
                          },
                          "MATIC": {
                              "spendable": "66.36490013618242918",
                              "unspendable": "0"
                          }
                      },
                      "addresses": [
                          {
                              "address": "0xC11b6070c84A1E6Fc62B2A2aCf70831545d5eDD4",
                              "derivation_path": "m/44'/60'/0'/0/0",
                              "chain": "External",
                              "balance": {
                                  "PGX-PLG20": {
                                      "spendable": "237.729414631067",
                                      "unspendable": "0"
                                  },
                                  "AAVE-PLG20": {
                                      "spendable": "0.0275928341263563",
                                      "unspendable": "0"
                                  },
                                  "MATIC": {
                                      "spendable": "65.36490013618242918",
                                      "unspendable": "0"
                                  }
                              }
                          },
                          {
                              "address": "0x1751bd0510fDAE2A4a81Ab8A3e70E59E4760eAB6",
                              "derivation_path": "m/44'/60'/0'/0/1",
                              "chain": "External",
                              "balance": {
                                  "AAVE-PLG20": {
                                      "spendable": "0",
                                      "unspendable": "0"
                                  },
                                  "PGX-PLG20": {
                                      "spendable": "0",
                                      "unspendable": "0"
                                  },
                                  "MATIC": {
                                      "spendable": "1",
                                      "unspendable": "0"
                                  }
                              }
                          },
                          {
                              "address": "0xffCF6033C31ed4beBC72f77be45d97cd8a8BABB4",
                              "derivation_path": "m/44'/60'/0'/0/2",
                              "chain": "External",
                              "balance": {
                                  "MATIC": {
                                      "spendable": "0",
                                      "unspendable": "0"
                                  },
                                  "AAVE-PLG20": {
                                      "spendable": "0",
                                      "unspendable": "0"
                                  },
                                  "PGX-PLG20": {
                                      "spendable": "0",
                                      "unspendable": "0"
                                  }
                              }
                          }
                      ]
                  }
              ]
          },
          "nfts_infos": {}
      }
  },
  "id": null
}

{
  "mmrpc": "2.0",
  "result": {
    "status": "InProgress",
    "details": "RequestingWalletBalance"
  },
  "id": null
}

ParameterTypeDescription
statusstringA short indication of how the requested process is progressing.
details.resultobjectDepending on the state of process progress, this will contain different information as detailed in the items below.
.errorstringThe ticker of the coin being activated
.error_pathstringUsed for debugging. A reference to the function in code base which returned the error
.error_tracestringUsed for debugging. A trace of lines of code which led to the returned error
.error_typestringAn enumerated error identifier to indicate the category of error
.error_datastringAdditonal context for the error type

Possible Error Cases:

  • TaskTimedOut - Timed out waiting for coin activation, connecting to the device trezor or for user to confirm pubkey)
  • CoinCreationError - Error during activation. E.g. incorrect or inactive electrum servers.
  • HwError - This is the most important error type. Unlike other error types, HwError requires the GUI / User to check the details in error_data field to know which action is required. View the HwError error type details for more info.
API-v2task::enable_eth::user_action

If the task::enable_eth::status returns UserActionRequired, we need to use the task::enable_eth::user_action method to enter our PIN

Parameter* = requiredTypeDescription
task_id*
integer
The identifying number returned when initiating the initialisation process.
user_action*
object
Object containing the params below
user_action.action_type*
string
Will be TrezorPin or TrezorPassphrase.
user_action.passphrase*
string
Your Trezor passphrase. This is the passphrase you use to unlock a hidden wallet on your Trezor device. Can be empty if you are using a non-hidden wallet.
user_action.pin*
string (number)
When the Trezor device is displaying a grid of numbers for PIN entry, this param will contain your Trezor pin, as mapped through your keyboard numpad. See the image below for more information.
Trezor Pin

Parameter* = requiredTypeDescription
result*
string
The outcome of the request.

task::enable_eth::user_action

POST
task::enable_eth::user_action
{
  "method": "task::enable_eth::user_action",
  "mmrpc": "2.0",
  "params": {
    "task_id": 0,
    "user_action": {
      "action_type": "TrezorPin",
      "pin": "862743"
    }
  },
  "userpass": "RPC_UserP@SSW0RD"
}

{
  "mmrpc": "2.0",
  "result": "success",
  "id": null
}
API-v2task::enable_eth::cancel

If you want to cancel the enabling process before it has completed, you can use this method.

Parameter* = requiredTypeDescription
task_id*
integer
The identifying number returned when initiating the enabling process.

Parameter* = requiredTypeDescription
error*
string
An error message to explain what went wrong.
error_data*
string
The input task ID which resulted in the error.
error_path*
string
An indicator of the class or function which reurned the error.
error_trace*
string
An indicator of where in the source code the error was thrown.
error_type*
string
An enumerated value for the returned error.
result*
string
Indicates task cancellation was succesful.

task::enable_eth::cancel

POST
task::enable_eth::cancel
{
  "method": "task::enable_eth::cancel",
  "mmrpc": "2.0",
  "params": {
    "task_id": 3
  },
  "userpass": "RPC_UserP@SSW0RD"
}

{
  "mmrpc": "2.0",
  "result": "success",
  "id": null
}

{
  "mmrpc": "2.0",
  "error": "Task is finished already",
  "error_path": "init_standalone_coin.manager",
  "error_trace": "init_standalone_coin:144] manager:101]",
  "error_type": "TaskFinished",
  "error_data": 0,
  "id": null
}

{
  "mmrpc": "2.0",
  "error": "No such task '1'",
  "error_path": "init_standalone_coin",
  "error_trace": "init_standalone_coin:119]",
  "error_type": "NoSuchTask",
  "error_data": 1,
  "id": null
}