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). 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.
| 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. |
POST
enable_eth_with_tokens{
"method": "enable_eth_with_tokens",
"mmrpc": "2.0",
"params": {
"erc20_tokens_requests": [
{
"required_confirmations": 4,
"ticker": "APE-ERC20"
},
{
"required_confirmations": 4,
"ticker": "MINDS-ERC20"
}
],
"fallback_swap_contract": "0x8500AFc0bc5214728082163326C2FF0C73f4a871",
"gas_station_decimals": 8,
"gas_station_policy": {
"policy": "MeanAverageFast"
},
"gas_station_url": "https://ethgasstation.info/json/ethgasAPI.json",
"mm2": 1,
"nodes": [
{
"url": "https://eth.drpc.org",
"ws_url": "wss://eth.drpc.org"
},
{
"url": "https://eth3.cipig.net:18555",
"ws_url": "wss://eth3.cipig.net:38555"
},
{
"url": "https://ethereum-rpc.publicnode.com",
"ws_url": "wss://ethereum-rpc.publicnode.com"
}
],
"priv_key_policy": {
"type": "ContextPrivKey"
},
"required_confirmations": 5,
"requires_notarization": false,
"swap_contract_address": "0x24ABE4c71FC658C91313b6552cd40cD808b3Ea80",
"ticker": "ETH",
"tx_history": true
},
"userpass": "RPC_UserP@SSW0RD"
}
Response (Success)
SUCCESS
{
"id": null,
"mmrpc": "2.0",
"result": {
"current_block": 23880667,
"nfts_infos": {},
"ticker": "ETH",
"wallet_balance": {
"accounts": [
{
"account_index": 0,
"addresses": [
{
"address": "0xAEeF0f62Ff189D1e4B1b62E7efF453b15d32886f",
"balance": {
"APE-ERC20": {
"spendable": "0",
"unspendable": "0"
},
"ETH": {
"spendable": "0",
"unspendable": "0"
},
"MINDS-ERC20": {
"spendable": "0",
"unspendable": "0"
}
},
"chain": "External",
"derivation_path": "m/44'/60'/0'/0/0"
}
],
"derivation_path": "m/44'/60'/0'",
"total_balance": {
"APE-ERC20": {
"spendable": "0",
"unspendable": "0"
},
"ETH": {
"spendable": "0",
"unspendable": "0"
},
"MINDS-ERC20": {
"spendable": "0",
"unspendable": "0"
}
}
}
],
"wallet_type": "HD"
}
}
}
POST
enable_eth_with_tokens{
"method": "enable_eth_with_tokens",
"mmrpc": "2.0",
"params": {
"erc20_tokens_requests": [
{
"required_confirmations": 4,
"ticker": "PGX-PLG20"
},
{
"required_confirmations": 4,
"ticker": "AAVE-PLG20"
}
],
"fallback_swap_contract": "0x9130b257D37A52E52F21054c4DA3450c72f595CE",
"gas_station_url": "https://gasstation-mainnet.matic.network/",
"get_balances": false,
"nodes": [
{
"url": "https://pol3.cipig.net:18755",
"ws_url": "wss://pol3.cipig.net:38755"
},
{
"url": "https://polygon.drpc.org",
"ws_url": "wss://polygon.drpc.org"
},
{
"url": "https://polygon.gateway.tenderly.co",
"ws_url": "wss://polygon.gateway.tenderly.co"
}
],
"required_confirmations": 5,
"requires_notarization": false,
"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",
"tx_history": false
},
"userpass": "RPC_UserP@SSW0RD"
}
Response (Success)
SUCCESS
{
"id": null,
"mmrpc": "2.0",
"result": {
"current_block": 79513888,
"nfts_infos": {},
"ticker": "MATIC",
"wallet_balance": {
"accounts": [
{
"account_index": 0,
"addresses": [
{
"address": "0xAEeF0f62Ff189D1e4B1b62E7efF453b15d32886f",
"balance": {
"AAVE-PLG20": {
"spendable": "0",
"unspendable": "0"
},
"MATIC": {
"spendable": "0",
"unspendable": "0"
},
"PGX-PLG20": {
"spendable": "0",
"unspendable": "0"
}
},
"chain": "External",
"derivation_path": "m/44'/60'/0'/0/0"
}
],
"derivation_path": "m/44'/60'/0'",
"total_balance": {
"AAVE-PLG20": {
"spendable": "0",
"unspendable": "0"
},
"MATIC": {
"spendable": "0",
"unspendable": "0"
},
"PGX-PLG20": {
"spendable": "0",
"unspendable": "0"
}
}
}
],
"wallet_type": "HD"
}
}
}
POST
enable_eth_with_tokens{
"method": "enable_eth_with_tokens",
"mmrpc": "2.0",
"params": {
"erc20_tokens_requests": [
{
"required_confirmations": 4,
"ticker": "PGX-PLG20"
},
{
"required_confirmations": 4,
"ticker": "AAVE-PLG20"
}
],
"fallback_swap_contract": "0x9130b257D37A52E52F21054c4DA3450c72f595CE",
"gas_station_url": "https://gasstation-mainnet.matic.network/",
"get_balances": false,
"nft_req": {
"provider": {
"info": {
"url": "https://moralis-proxy.komodo.earth"
},
"type": "Moralis"
}
},
"nodes": [
{
"url": "https://pol3.cipig.net:18755",
"ws_url": "wss://pol3.cipig.net:38755"
},
{
"url": "https://polygon.drpc.org",
"ws_url": "wss://polygon.drpc.org"
},
{
"url": "https://polygon.gateway.tenderly.co",
"ws_url": "wss://polygon.gateway.tenderly.co"
}
],
"required_confirmations": 5,
"requires_notarization": false,
"swap_contract_address": "0x9130b257D37A52E52F21054c4DA3450c72f595CE",
"ticker": "MATIC",
"tx_history": false
},
"userpass": "RPC_UserP@SSW0RD"
}
Response (Success)
SUCCESS
{
"id": null,
"mmrpc": "2.0",
"result": {
"current_block": 79513919,
"nfts_infos": {},
"ticker": "MATIC",
"wallet_balance": {
"accounts": [
{
"account_index": 0,
"addresses": [
{
"address": "0xAEeF0f62Ff189D1e4B1b62E7efF453b15d32886f",
"balance": {
"AAVE-PLG20": {
"spendable": "0",
"unspendable": "0"
},
"MATIC": {
"spendable": "0",
"unspendable": "0"
},
"PGX-PLG20": {
"spendable": "0",
"unspendable": "0"
}
},
"chain": "External",
"derivation_path": "m/44'/60'/0'/0/0"
}
],
"derivation_path": "m/44'/60'/0'",
"total_balance": {
"AAVE-PLG20": {
"spendable": "0",
"unspendable": "0"
},
"MATIC": {
"spendable": "0",
"unspendable": "0"
},
"PGX-PLG20": {
"spendable": "0",
"unspendable": "0"
}
}
}
],
"wallet_type": "HD"
}
}
}
Prior to coin activation using WalletConnect, you need to establish a connection with wc_new_connection
POST
enable_eth_with_tokens{
"method": "enable_eth_with_tokens",
"mmrpc": "2.0",
"params": {
"erc20_tokens_requests": [
{
"required_confirmations": 4,
"ticker": "PEPE-ERC20"
}
],
"fallback_swap_contract": "0x8500AFc0bc5214728082163326C2FF0C73f4a871",
"gas_station_decimals": 8,
"gas_station_policy": {
"policy": "MeanAverageFast"
},
"gas_station_url": "https://ethgasstation.info/json/ethgasAPI.json",
"mm2": 1,
"nodes": [
{
"url": "https://0xrpc.io/eth",
"ws_url": "wss://0xrpc.io/eth"
},
{
"url": "https://eth3.cipig.net:18555",
"ws_url": "wss://eth3.cipig.net:38555"
},
{
"url": "https://ethereum-rpc.publicnode.com",
"ws_url": "wss://ethereum-rpc.publicnode.com"
}
],
"priv_key_policy": {
"data": "3569914dd09a5cc4ac92dedab354f06ff5db17ef616233a8ba562cbea51269fd",
"type": "WalletConnect"
},
"required_confirmations": 5,
"rpc_mode": "Default",
"swap_contract_address": "0x24ABE4c71FC658C91313b6552cd40cD808b3Ea80",
"ticker": "ETH",
"tx_history": true
},
"userpass": "RPC_UserP@SSW0RD"
}
| Parameter* = required | Type | Description |
|---|---|---|
| CoinProtocolParseError | string | Optional. Parsing the protocol of the platform coin you are trying to activate failed |
| InvalidRequest | string | Optional. The request is malformed or uses an unsupported configuration for the current build |
| PlatformConfigIsNotFound | string | Optional. Config of the platform coin you are trying to activate is not found |
| PlatformIsAlreadyActivated | string | Optional. The platform coin you are trying to activate is already activated |
| TokenConfigIsNotFound | string | Optional. Config of the token you are trying to activate is not found |
| TokenProtocolParseError | string | Optional. Parsing the protocol of the token you are trying to activate failed |
| Transport | string | Optional. The request failed due to a network error (e.g., node unresponsive) |
| UnexpectedPlatformProtocol | string | Optional. Unexpected platform protocol found for the platform coin you are trying to activate |