On this page

latest contributor to this doc

Last Edit:

@smk762

Enable ETH with Tokens

API-v2enable_eth_with_tokens

The Komodo DeFi Framework supports ETH(Ethereum) and many other EVM type platform coins like AVAX(Avalanche), BNB(Binance), FTM(Fantom), MATIC(Polygon), ONE(Harmony), ETH-ARB20(Arbitrum). Additionally, it supports ERC20 tokens on the ETH chain and associated ERC20 like tokens on the rest of the platform coin chains. Using this method, you can enable a platform coin along with multiple ERC20 like tokens of the platform coin chain in a single command.

ParameterTypeRequiredDefaultDescription
erc20_tokens_requestsarray of objects-A list of standard TokensRequest objects.
nodesarray of objects-A list of standard CoinNode objects.
swap_contract_addressstring-Address of etomic swap smart contract.
tickerstring-Ticker of the platform protocol coin.
fallback_swap_contractstring-Address of backup etomic swap smart contract.
gas_station_decimalsinteger8For ETH/ERC20 and other gas model chains. Defines the decimals used to denominate the gas station response to gwei units.
gas_station_policy.policystringMeanAverageFastFor ETH/ERC20 and other gas model chains. Defines the method of gas price calculation from the station response. Value can be gas-station-policy-enum.
get_balancesbooleantrueIf false, coin and token balances will not be returned in the response, and the response will be returned more quickly.
mm2integer-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_reqobject-Encapsulates the request parameters for NFT activation, including NFT provider configuration. A standard NftProvider object.
priv_key_policyobject{"type": "ContextPrivKey"}Object specifying the policy to access a private key during activation. Must include a type field with a value from EthPrivKeyActivationPolicyEnum. If type is WalletConnect, a data field with the session topic is also required.
required_confirmationsinteger3When 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_notarizationbooleanfalseIf true, coins protected by Komodo Platform's dPoW security will wait for a notarization before progressing to the next atomic swap transactions step.
rpc_modestringDefaultValue can be EthRpcModeEnum.
swap_v2_contractsobject-Must be provided if "use_trading_proto_v2" is true in your configuration. A standard SwapV2Contracts object.
tx_historybooleanfalseIf 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.

When running in HD mode, do not use the nft_req object paramater when activating your NFT network coins. Instead, use the enable_nft method after activating.

ParameterTypeDescription
current_blockintegerBlock height of the coin being activated.
erc20_addresses_infosobjectA standard AddressInfo object. Note: the structure may vary based on the value of the get_balances parameter.
eth_addresses_infosobjectA standard AddressInfo object. Note: the structure may vary based on the value of the get_balances parameter.
nfts_infoslistA list of standard NftInfoBasic objects.

Enable ETH with Tokens (with gas station parameters)

POST
enable_eth_with_tokens
{
  "userpass": "RPC_UserP@SSW0RD",
  "method": "enable_eth_with_tokens",
  "mmrpc": "2.0",
  "params": {
    "ticker": "ETH",
    "gas_station_url": "https://ethgasstation.info/json/ethgasAPI.json",
    "gas_station_decimals": 8,
    "gas_station_policy": {
      "policy": "MeanAverageFast"
    },
    "mm2": 1,
    "priv_key_policy": {
      "type": "ContextPrivKey"
    },
    "swap_contract_address": "0x24ABE4c71FC658C91313b6552cd40cD808b3Ea80",
    "fallback_swap_contract": "0x8500AFc0bc5214728082163326C2FF0C73f4a871",
    "nodes": [
      {
        "url": "https://eth1.cipig.net:18555",
        "komodo_proxy": false
      },
      {
        "url": "https://eth2.cipig.net:18555",
        "komodo_proxy": false
      },
      {
        "url": "https://eth3.cipig.net:18555",
        "komodo_proxy": false
      }
    ],
    "tx_history": true,
    "erc20_tokens_requests": [
      {
        "ticker": "APE-ERC20",
        "required_confirmations": 4
      },
      {
        "ticker": "BCH-ERC20",
        "required_confirmations": 4
      },
      {
        "ticker": "MINDS-ERC20",
        "required_confirmations": 4
      },
      {
        "ticker": "BUSD-ERC20",
        "required_confirmations": 4
      }
    ],
    "required_confirmations": 5,
    "requires_notarization": false
  }
}

Enable ETH with Tokens (get_balances false)

POST
enable_eth_with_tokens
{
  "userpass": "RPC_UserP@SSW0RD",
  "method": "enable_eth_with_tokens",
  "mmrpc": "2.0",
  "params": {
    "ticker": "MATIC",
    "get_balances": false,
    "tx_history": false,
    "gas_station_url": "https://gasstation-mainnet.matic.network/",
    "swap_contract_address": "0x9130b257D37A52E52F21054c4DA3450c72f595CE",
    "fallback_swap_contract": "0x9130b257D37A52E52F21054c4DA3450c72f595CE",
    "swap_v2_contracts": {
      "maker_swap_v2_contract": "0x9130b257D37A52E52F21054c4DA3450c72f595CE",
      "taker_swap_v2_contract": "0x9130b257D37A52E52F21054c4DA3450c72f595CE",
      "nft_maker_swap_v2_contract": "0x9130b257D37A52E52F21054c4DA3450c72f595CE"
    },
    "nodes": [
      {
        "url": "https://polygon-rpc.com"
      },
      {
        "url": "https://node.komodo.earth:8080/polygon"
      },
      {
        "url": "https://block-proxy.komodo.earth/rpc/matic"
      }
    ],
    "erc20_tokens_requests": [
      {
        "ticker": "PGX-PLG20",
        "required_confirmations": 4
      },
      {
        "ticker": "AAVE-PLG20",
        "required_confirmations": 4
      }
    ],
    "required_confirmations": 5,
    "requires_notarization": false
  }
}

Enable ETH with Tokens and NFT initialization

POST
enable_eth_with_tokens
{
  "userpass": "RPC_UserP@SSW0RD",
  "method": "enable_eth_with_tokens",
  "mmrpc": "2.0",
  "params": {
    "ticker": "MATIC",
    "get_balances": false,
    "tx_history": false,
    "nft_req": {
      "type": "Moralis",
      "info": {
        "url": "https://moralis-proxy.komodo.earth"
      }
    },
    "gas_station_url": "https://gasstation-mainnet.matic.network/",
    "swap_contract_address": "0x9130b257D37A52E52F21054c4DA3450c72f595CE",
    "fallback_swap_contract": "0x9130b257D37A52E52F21054c4DA3450c72f595CE",
    "nodes": [
      {
        "url": "https://polygon-rpc.com"
      },
      {
        "url": "https://node.komodo.earth:8080/polygon"
      },
      {
        "url": "https://block-proxy.komodo.earth/rpc/matic"
      }
    ],
    "erc20_tokens_requests": [
      {
        "ticker": "PGX-PLG20",
        "required_confirmations": 4
      },
      {
        "ticker": "AAVE-PLG20",
        "required_confirmations": 4
      }
    ],
    "required_confirmations": 5,
    "requires_notarization": false
  }
}

Prior to coin activation using WalletConnect, you need to establish a connection with wc_new_connection

POST
enable_eth_with_tokens
{
  "userpass": "RPC_UserP@SSW0RD",
  "method": "enable_eth_with_tokens",
  "mmrpc": "2.0",
  "params": {
    "ticker": "ETH",
    "gas_station_url": "https://ethgasstation.info/json/ethgasAPI.json",
    "gas_station_decimals": 8,
    "gas_station_policy": {
      "policy": "MeanAverageFast"
    },
    "mm2": 1,
    "rpc_mode": "Default",
    "priv_key_policy": {
      "type": "WalletConnect",
      "data": "3569914dd09a5cc4ac92dedab354f06ff5db17ef616233a8ba562cbea51269fd"
    },
    "swap_contract_address": "0x24ABE4c71FC658C91313b6552cd40cD808b3Ea80",
    "fallback_swap_contract": "0x8500AFc0bc5214728082163326C2FF0C73f4a871",
    "nodes": [
      {
        "url": "https://eth1.cipig.net:18555",
        "komodo_proxy": false
      },
      {
        "url": "https://eth2.cipig.net:18555",
        "komodo_proxy": false
      },
      {
        "url": "https://eth3.cipig.net:18555",
        "komodo_proxy": false
      }
    ],
    "tx_history": true,
    "erc20_tokens_requests": [
      {
        "ticker": "PEPE-ERC20",
        "required_confirmations": 4
      }
    ],
    "required_confirmations": 5
  }
}

ParameterTypeDescription
CoinProtocolParseErrorstringParsing the protocol of the platform coin you are trying to activate failed
InternalErrorstringThe request was failed due to an Komodo DeFi Framework API internal error
PlatformCoinCreationErrorstringThere was an error when trying to activate the platform coin
PlatformConfigIsNotFoundstringConfig of the platform coin you are trying to activate is not found
PlatformIsAlreadyActivatedstringThe platform coin you are trying to activate is already activated
PrivKeyNotAllowedstringThe privkey is not allowed
TokenConfigIsNotFoundstringConfig of the token you are trying to activate is not found
TokenProtocolParseErrorstringParsing the protocol of the token you are trying to activate failed
TransportstringThe request was failed due to a network error
UnexpectedDerivationMethodstringThe derivation method used is unexpected
UnexpectedPlatformProtocolstringUnexpected platform protocol found for the platform coin you are trying to activate
UnexpectedTokenProtocolstringUnexpected protocol is found in the config of the token you are trying to activate