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.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
erc20_tokens_requests | array of objects | ✓ | - | A list of standard TokensRequest objects. |
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. |
fallback_swap_contract | string | ✗ | - | Address of backup etomic swap smart contract. |
gas_station_decimals | integer | ✗ | 8 | For ETH/ERC20 and other gas model chains. Defines the decimals used to denominate the gas station response to gwei units. |
gas_station_policy.policy | string | ✗ | MeanAverageFast | For 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_balances | boolean | ✗ | true | If false, coin and token balances will not be returned in the response, and the response will be returned more quickly. |
mm2 | integer | ✗ | - | 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 | ✗ | - | Encapsulates the request parameters for NFT activation, including NFT provider configuration. A standard NftProvider object. |
priv_key_policy | object | ✗ | {"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_confirmations | integer | ✗ | 3 | 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 | ✗ | false | 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 | Value can be EthRpcModeEnum. |
swap_v2_contracts | object | ✗ | - | Must be provided if "use_trading_proto_v2" is true in your configuration. A standard SwapV2Contracts object. |
tx_history | boolean | ✗ | false | 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 | 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. |
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
}
}
Parameter | 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 |