enable_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), and TRX(TRON). Additionally, it supports ERC20 tokens on the ETH chain, associated ERC20 like tokens on the rest of the EVM platform coin chains, and TRC20 tokens on TRON. Using this method, you can enable a platform coin along with multiple ERC20/TRC20 like tokens of the platform coin chain in a single command.
TRON (TRX) is currently supported in wallet-only mode. You can activate TRX and TRC20 tokens for balance queries and withdrawals, but atomic swaps are not yet available for TRON-based coins.
| Parameter* = required | Type | Description |
|---|---|---|
| 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 |
| gas_station_decimals | integerdefault: `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 | stringdefault: `"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. |
| get_balances | booleandefault: `true` | Optional. If false, coin and token balances will not be returned in the response, and the response will be returned more quickly. |
| 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. Encapsulates the request parameters for NFT activation, including NFT provider configuration. A standard NftProvider object. |
| priv_key_policy | objectdefault: `{"type": "ContextPrivKey"}` | Optional. A standard PrivKeyPolicy object. |
| required_confirmations | integerdefault: `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 | booleandefault: `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 | stringdefault: `Default` | Optional. Value can be Metamask only when the Komodo DeFi Framework is built targeting wasm. |
| swap_v2_contracts | object | Optional. Must be provided if "use_trading_proto_v2" is true in your configuration. A standard SwapV2Contracts object. |
| tx_history | booleandefault: `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 |
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.
| Parameter* = required | Type | Description |
|---|---|---|
| current_block* | integer | Block height of the coin being activated |
| erc20_addresses_infos* | object | A standard AddressInfo object. Note: the structure may vary based on the value of the get_balances parameter. |
| eth_addresses_infos* | object | A standard AddressInfo object. Note: the structure may vary based on the value of the get_balances parameter. |
| nfts_infos* | list | A list of standard NftInfoBasic objects. |
{
"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://eth3.cipig.net:18555",
"ws_url": "wss://eth3.cipig.net:38555"
},
{
"url": "https://node.komodo.earth:8080/ethereum",
"komodo_proxy": true
},
{
"url": "https://eth.drpc.org",
"ws_url": "wss://eth.drpc.org"
}
],
"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
}
}
{
"mmrpc": "2.0",
"result": {
"current_block": 20590537,
"eth_addresses_infos": {
"0x083C32B38e8050473f6999e22f670d1404235592": {
"derivation_method": {
"type": "Iguana"
},
"pubkey": "04ec603f83519cc2150bd99ed0ed6b3f7f029dedff2957cd22542e2504e3d2a7953c084f907cce2f0e26fb0cfc55e06925bf0f88a92b904224dba8ebafdf98ce7b",
"balances": {
"spendable": "0",
"unspendable": "0"
}
}
},
"erc20_addresses_infos": {
"0x083C32B38e8050473f6999e22f670d1404235592": {
"derivation_method": {
"type": "Iguana"
},
"pubkey": "04ec603f83519cc2150bd99ed0ed6b3f7f029dedff2957cd22542e2504e3d2a7953c084f907cce2f0e26fb0cfc55e06925bf0f88a92b904224dba8ebafdf98ce7b",
"balances": {
"BUSD-ERC20": {
"spendable": "0",
"unspendable": "0"
},
"MINDS-ERC20": {
"spendable": "0",
"unspendable": "0"
},
"APE-ERC20": {
"spendable": "0",
"unspendable": "0"
},
"BCH-ERC20": {
"spendable": "0",
"unspendable": "0"
}
}
}
},
"nfts_infos": {}
},
"id": null
}
{
"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://node.komodo.earth:8080/polygon",
"komodo_proxy": true
},
{
"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"
}
],
"erc20_tokens_requests": [
{
"ticker": "PGX-PLG20",
"required_confirmations": 4
},
{
"ticker": "AAVE-PLG20",
"required_confirmations": 4
}
],
"required_confirmations": 5,
"requires_notarization": false
}
}
{
"mmrpc": "2.0",
"result": {
"current_block": 60937035,
"eth_addresses_infos": {
"0x083C32B38e8050473f6999e22f670d1404235592": {
"derivation_method": {
"type": "Iguana"
},
"pubkey": "04ec603f83519cc2150bd99ed0ed6b3f7f029dedff2957cd22542e2504e3d2a7953c084f907cce2f0e26fb0cfc55e06925bf0f88a92b904224dba8ebafdf98ce7b"
}
},
"erc20_addresses_infos": {
"0x083C32B38e8050473f6999e22f670d1404235592": {
"derivation_method": {
"type": "Iguana"
},
"pubkey": "04ec603f83519cc2150bd99ed0ed6b3f7f029dedff2957cd22542e2504e3d2a7953c084f907cce2f0e26fb0cfc55e06925bf0f88a92b904224dba8ebafdf98ce7b",
"tickers": [
"PGX-PLG20",
"AAVE-PLG20"
]
}
},
"nfts_infos": {}
},
"id": null
}
TRON nodes use HTTP API endpoints (not WebSocket/gRPC). Swap contract parameters are not needed as TRON is wallet-only.
{
"userpass": "RPC_UserP@SSW0RD",
"method": "enable_eth_with_tokens",
"mmrpc": "2.0",
"params": {
"ticker": "TRX",
"mm2": 1,
"nodes": [
{
"url": "https://api.trongrid.io"
}
],
"erc20_tokens_requests": [
{
"ticker": "USDT-TRC20"
}
]
}
}
{
"mmrpc": "2.0",
"result": {
"current_block": 68000000,
"eth_addresses_infos": {
"TDcxD6E5wTzvqCJd4RfkGfw9NkCBdvYcV9": {
"derivation_method": {
"type": "Iguana"
},
"pubkey": "04d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc2a91c9ce32b6fc5489c49e33b688423b655177168afee1b128be9b2fee67e3f3b",
"balances": {
"spendable": "50.000000",
"unspendable": "0"
}
}
},
"erc20_addresses_infos": {
"TDcxD6E5wTzvqCJd4RfkGfw9NkCBdvYcV9": {
"derivation_method": {
"type": "Iguana"
},
"pubkey": "04d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc2a91c9ce32b6fc5489c49e33b688423b655177168afee1b128be9b2fee67e3f3b",
"balances": {
"USDT-TRC20": {
"spendable": "10.000000",
"unspendable": "0"
}
}
}
},
"nfts_infos": {}
},
"id": null
}
{
"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://node.komodo.earth:8080/polygon",
"komodo_proxy": true
},
{
"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"
}
],
"erc20_tokens_requests": [
{
"ticker": "PGX-PLG20",
"required_confirmations": 4
},
{
"ticker": "AAVE-PLG20",
"required_confirmations": 4
}
],
"required_confirmations": 5,
"requires_notarization": false
}
}
{
"mmrpc": "2.0",
"result": {
"current_block": 61329162,
"eth_addresses_infos": {
"0x083C32B38e8050473f6999e22f670d1404235592": {
"derivation_method": {
"type": "Iguana"
},
"pubkey": "04d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc2a91c9ce32b6fc5489c49e33b688423b655177168afee1b128be9b2fee67e3f3b"
}
},
"erc20_addresses_infos": {
"0x083C32B38e8050473f6999e22f670d1404235592": {
"derivation_method": {
"type": "Iguana"
},
"pubkey": "04d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc2a91c9ce32b6fc5489c49e33b688423b655177168afee1b128be9b2fee67e3f3b",
"tickers": [
"PGX-PLG20",
"AAVE-PLG20"
]
}
},
"nfts_infos": {
"0x73a5299824cd955af6377b56f5762dc3ca4cc078,1": {
"token_address": "0x73a5299824cd955af6377b56f5762dc3ca4cc078",
"token_id": "1",
"chain": "POLYGON",
"contract_type": "ERC721",
"amount": "1"
},
"0x3987dfed574927e7a3309758ccf949ad2403fcbb,1": {
"token_address": "0x3987dfed574927e7a3309758ccf949ad2403fcbb",
"token_id": "1",
"chain": "POLYGON",
"contract_type": "ERC1155",
"amount": "1"
}
}
},
"id": null
}
Prior to coin activation using WalletConnect, you need to establish a connection with wc_new_connection
{
"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://eth3.cipig.net:18555",
"ws_url": "wss://eth3.cipig.net:38555"
},
{
"url": "https://node.komodo.earth:8080/ethereum",
"komodo_proxy": true
},
{
"url": "https://ethereum-rpc.publicnode.com",
"ws_url": "wss://ethereum-rpc.publicnode.com"
}
],
"tx_history": true,
"erc20_tokens_requests": [
{
"ticker": "PEPE-ERC20",
"required_confirmations": 4
}
],
"required_confirmations": 5
}
}
| Structure | Type | Description |
|---|---|---|
| CoinProtocolParseError | string | Parsing the protocol of the platform coin you are trying to activate failed |
| InternalError | string | The request was failed due to an Komodo DeFi Framework API internal error |
| PlatformCoinCreationError | string | There was an error when trying to activate the platform coin |
| PlatformConfigIsNotFound | string | Config of the platform coin you are trying to activate is not found |
| PlatformIsAlreadyActivated | string | The platform coin you are trying to activate is already activated |
| PrivKeyNotAllowed | string | The privkey is not allowed |
| TokenConfigIsNotFound | string | Config of the token you are trying to activate is not found |
| TokenProtocolParseError | string | Parsing the protocol of the token you are trying to activate failed |
| Transport | string | The request was failed due to a network error |
| UnexpectedDerivationMethod | string | The derivation method used is unexpected |
| UnexpectedPlatformProtocol | string | Unexpected platform protocol found for the platform coin you are trying to activate |
| UnexpectedTokenProtocol | string | Unexpected protocol is found in the config of the token you are trying to activate |
In this case, you need to disable the platform coin and try again.
{
"mmrpc": "2.0",
"error": "ETH",
"error_path": "platform_coin_with_tokens",
"error_trace": "platform_coin_with_tokens:297]",
"error_type": "PlatformIsAlreadyActivated",
"error_data": "ETH",
"id": null
}
{
"mmrpc": "2.0",
"error": "Platform ETH config is not found",
"error_path": "platform_coin_with_tokens.prelude",
"error_trace": "platform_coin_with_tokens:302] prelude:79]",
"error_type": "PlatformConfigIsNotFound",
"error_data": "ETH",
"id": null
}
{
"mmrpc": "2.0",
"error": "Platform coin ETH protocol parsing failed: invalid type: null, expected adjacently tagged enum CoinProtocol",
"error_path": "platform_coin_with_tokens.prelude",
"error_trace": "platform_coin_with_tokens:302] prelude:82]",
"error_type": "CoinProtocolParseError",
"error_data": {
"ticker": "ETH",
"error": "invalid type: null, expected adjacently tagged enum CoinProtocol"
},
"id": null
}
{
"mmrpc": "2.0",
"error": "Unexpected platform protocol QTUM for ETH",
"error_path": "platform_coin_with_tokens.prelude.eth_with_token_activation",
"error_trace": "platform_coin_with_tokens:302] prelude:90] eth_with_token_activation:64]",
"error_type": "UnexpectedPlatformProtocol",
"error_data": { "ticker": "ETH", "protocol": { "type": "QTUM" } },
"id": null
}
{
"mmrpc": "2.0",
"error": "Token BTUSD-ERC20 config is not found",
"error_path": "platform_coin_with_tokens.prelude",
"error_trace": "platform_coin_with_tokens:314] platform_coin_with_tokens:109] prelude:79]",
"error_type": "TokenConfigIsNotFound",
"error_data": "BTUSD-ERC20",
"id": null
}
{
"mmrpc": "2.0",
"error": "Token BUSD-ERC20 protocol parsing failed: unknown variant `TERC20`, expected one of `UTXO`, `QTUM`, `QRC20`, `ETH`, `ERC20`, `TRX`, `TRC20`, `TENDERMINT`, `TENDERMINTTOKEN`, `LIGHTNING`, `SOLANA`, `SPLTOKEN`, `ZHTLC`",
"error_path": "platform_coin_with_tokens.prelude",
"error_trace": "platform_coin_with_tokens:314] platform_coin_with_tokens:109] prelude:82]",
"error_type": "TokenProtocolParseError",
"error_data": {
"ticker": "BUSD-ERC20",
"error": "unknown variant `TERC20`, expected one of `UTXO`, `QTUM`, `QRC20`, `ETH`, `ERC20`, `TRX`, `TRC20`, `TENDERMINT`, `TENDERMINTTOKEN`, `LIGHTNING`, `SOLANA`, `SPLTOKEN`, `ZHTLC`"
},
"id": null
}
{
"mmrpc": "2.0",
"error": "Unexpected token protocol QRC20 { platform: \"ETH\", contract_address: \"0x4Fabb145d64652a948d72533023f6E7A623C7C53\" } for BUSD-ERC20",
"error_path": "platform_coin_with_tokens.prelude.erc20_token_activation",
"error_trace": "platform_coin_with_tokens:314] platform_coin_with_tokens:109] prelude:90] erc20_token_activation:58]",
"error_type": "UnexpectedTokenProtocol",
"error_data": {
"ticker": "BUSD-ERC20",
"protocol": {
"type": "QRC20",
"protocol_data": {
"platform": "ETH",
"contract_address": "0x4Fabb145d64652a948d72533023f6E7A623C7C53"
}
}
},
"id": null
}
Returned when the rpc_mode parameter is set to Metamask but the Komodo DeFi Framework was not built targeting wasm.
{
"mmrpc": "2.0",
"error": "Error parsing request: unknown variant `Metamask`, expected `Default`",
"error_path": "dispatcher",
"error_trace": "dispatcher:118]",
"error_type": "InvalidRequest",
"error_data": "unknown variant `Metamask`, expected `Default`",
"id": null
}
Returned when coin nodes are unresponsive.
{
"mmrpc": "2.0",
"error": "Failed to get client version for all nodes",
"error_path": "platform_coin_with_tokens.mod",
"error_trace": "platform_coin_with_tokens:454] mod:717]",
"error_type": "Transport",
"error_data": "Failed to get client version for all nodes",
"id": null
}