enable_erc20
The enable_erc20 method allows you to activate additional ERC20 like tokens of a EVM type platform coin. Before using this method, you first need to use the enable_eth_with_tokens method.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| ticker | string | ✓ | Ticker of the ERC20 like token coin. | |
| activation_params.required_confirmations | integer | – | value in the coins file if not set | Confirmations to wait for steps in swap. |
POST enable_erc20
{
"userpass": "RPC_UserP@SSW0RD",
"method": "enable_erc20",
"mmrpc": "2.0",
"params": {
"ticker": "BAT-ERC20",
"activation_params": {
"required_confirmations": 3
}
}
} curl --url "http://127.0.0.1:7783" --data '{
"userpass": "RPC_UserP@SSW0RD",
"method": "enable_erc20",
"mmrpc": "2.0",
"params": {
"ticker": "BAT-ERC20",
"activation_params": {
"required_confirmations": 3
}
}
}' import requests
import json
url = "http://127.0.0.1:7783"
payload = {
"userpass": "RPC_UserP@SSW0RD",
"method": "enable_erc20",
"mmrpc": "2.0",
"params": {
"ticker": "BAT-ERC20",
"activation_params": {
"required_confirmations": 3
}
}
}
response = requests.post(url, json=payload)
print(json.dumps(response.json(), indent=2)) const payload = {
"userpass": "RPC_UserP@SSW0RD",
"method": "enable_erc20",
"mmrpc": "2.0",
"params": {
"ticker": "BAT-ERC20",
"activation_params": {
"required_confirmations": 3
}
}
};
const response = await fetch("http://127.0.0.1:7783", {
method: "POST",
body: JSON.stringify(payload),
});
console.log(await response.json()); <?php
$payload = <<<'JSON'
{
"userpass": "RPC_UserP@SSW0RD",
"method": "enable_erc20",
"mmrpc": "2.0",
"params": {
"ticker": "BAT-ERC20",
"activation_params": {
"required_confirmations": 3
}
}
}
JSON;
$ch = curl_init("http://127.0.0.1:7783");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
$response = curl_exec($ch);
curl_close($ch);
echo $response; package main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
payload := []byte(`{"userpass":"RPC_UserP@SSW0RD","method":"enable_erc20","mmrpc":"2.0","params":{"ticker":"BAT-ERC20","activation_params":{"required_confirmations":3}}}`)
resp, err := http.Post("http://127.0.0.1:7783", "application/json", bytes.NewBuffer(payload))
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
} require 'net/http'
require 'json'
require 'uri'
uri = URI("http://127.0.0.1:7783")
payload = {
"userpass": "RPC_UserP@SSW0RD",
"method": "enable_erc20",
"mmrpc": "2.0",
"params": {
"ticker": "BAT-ERC20",
"activation_params": {
"required_confirmations": 3
}
}
}
response = Net::HTTP.post(uri, payload.to_json, 'Content-Type' => 'application/json')
puts JSON.pretty_generate(JSON.parse(response.body)) Response
{
"mmrpc": "2.0",
"result": {
"balances": {
"0x0d317904AF3BA3A993d557b6cba147FEA4DeB57E": {
"spendable": "0",
"unspendable": "0"
}
},
"platform_coin": "ETH",
"token_contract_address": "0x0d8775f648430679a709e98d2b0cb6250d2887ef",
"required_confirmations": 3
},
"id": null
}
Error - Platform coin is not yet activated
{
"mmrpc": "2.0",
"error": "Platform coin ETH is not activated",
"error_path": "token.lp_coins",
"error_trace": "token:126] lp_coins:2797]",
"error_type": "PlatformCoinIsNotActivated",
"error_data": "ETH",
"id": null
}
Error - Token already activated
{
"mmrpc": "2.0",
"error": "Token BAT-ERC20 is already activated",
"error_path": "token",
"error_trace": "token:119]",
"error_type": "TokenIsAlreadyActivated",
"error_data": "BAT-ERC20",
"id": null
}
Error - Token config not found in coins file
{
"mmrpc": "2.0",
"error": "Token BATT-ERC20 config is not found",
"error_path": "token.prelude",
"error_trace": "token:122] prelude:79]",
"error_type": "TokenConfigIsNotFound",
"error_data": "BATT-ERC20",
"id": null
}