-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathv20-api-content.txt
14346 lines (12446 loc) · 622 KB
/
v20-api-content.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
export const title = "Komodo DeFi Framework Method: Enable BCH with Tokens";
export const description = "Using this method, you can enable BCH/tBCH along with multiple SLP tokens in a single command.";
# enable\_bch\_with\_tokens
The Komodo DeFi Framework supports Bitcoin Cash SLP tokens. Using this method, you can enable BCH/tBCH along with multiple SLP tokens in a single command.
### Request Parameters
| Parameter | Type | Description |
| ------------------------ | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ticker | string | Ticker of the platform protocol coin. Options: `BCH` or `tBCH` |
| bchd\_urls | array of strings | A list of BCHD gRPC API server URLs, used for validation of SLP token transactions. It's recommended to add as many servers as possible. The URLs list can be found at [https://bchd.fountainhead.cash/](https://bchd.fountainhead.cash/). |
| mode | object | A standard [ActivationMode](/komodo-defi-framework/api/common_structures/activation/#activation-mode) object. |
| tx\_history | boolean | If `true`, spawns a background loop to store the local cache of address(es) transactions. Defaults to `false`. |
| slp\_tokens\_requests | array of objects | A list of standard [TokensRequest](/komodo-defi-framework/api/common_structures/activation/#tokens-request) objects. |
| address\_format | object | Optional. Overwrites the address format from coins file, if set. A standard [AddressFormat](/komodo-defi-framework/api/common_structures/#address-format) object. |
| allow\_slp\_unsafe\_conf | boolean | Optional, defaults to `false`. If `true`, allows bchd\_urls to be empty. **Warning:** it is highly unsafe to do so as it may lead to invalid SLP transactions generation and tokens burning. |
| get\_balances | boolean | Optional, defaults to `true`. If `false`, coin and token balances will not be returned in the response, and the response will be returned more quickly. |
| required\_confirmations | integer | Optional, defaults to value in the coins file, or `3` if not set. Confirmations to wait for steps in swap. |
| requires\_notarization | boolean | Optional, defaults to `true`. Has no effect on BCH. |
| tx\_history | boolean | Optional, defaults to `true`. 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](/komodo-defi-framework/api/legacy/my_tx_history/#my-tx-history) method |
| utxo\_merge\_params | object | A standard [UtxoMergeParams](/komodo-defi-framework/api/common_structures/activation/#utxo-merge-params) object. Used to reduce a wallet's UTXO count in cases where it is causing significantly slower RPC responses. |
| | | |
* Go to: [https://github.com/KomodoPlatform/coins/tree/master/electrums](https://github.com/KomodoPlatform/coins/tree/master/electrums) for a full list of nodes/servers.
### Response Parameters
| Parameter | Type | Description |
| --------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| current\_block | integer | Block height of the coin being activated |
| bch\_addresses\_infos | object | A standard [AddressInfo](/komodo-defi-framework/api/common_structures/#address-info) object. Note: the structure may vary based on the value of the `get_balances` parameter. |
| slp\_addresses\_infos | object | A standard [AddressInfo](/komodo-defi-framework/api/common_structures/#address-info) object. Note: the structure may vary based on the value of the `get_balances` parameter. |
bch\_addresses\_infos and slp\_addresses\_infos are the same. This should be consolidated in the api.
### 📌 Examples
#### Request with tx\_history, cashaddress format, and automated utxo merging.
```json
{
"userpass": "RPC_UserP@SSW0RD",
"method": "enable_bch_with_tokens",
"mmrpc": "2.0",
"params": {
"ticker": "BCH",
"allow_slp_unsafe_conf": false,
"bchd_urls": [
"https://bchd.dragonhound.info"
],
"mode": {
"rpc": "Electrum",
"rpc_data": {
"servers": [
{
"url": "bch.imaginary.cash:50002",
"protocol": "SSL"
},
{
"url": "cashnode.bch.ninja:50002",
"protocol": "SSL"
},
{
"url": "electrum3.cipig.net:20055",
"protocol": "SSL"
}
]
}
},
"tx_history": true,
"slp_tokens_requests": [
{
"ticker": "ASLP-SLP",
"required_confirmations": 4
}
],
"required_confirmations": 5,
"requires_notarization": false,
"address_format": {
"format": "cashaddress",
"network": "bitcoincash"
},
"utxo_merge_params": {
"merge_at": 50,
"check_every": 10,
"max_merge_at_once": 25
}
}
}
```
#### Response
```json
{
"mmrpc": "2.0",
"result": {
"current_block": 1480481,
"bch_addresses_infos": {
"bitcoincash:qrf5vpn78s7rjexrjhlwyzzeg7gw98k7t5qx64fztj": {
"derivation_method": {
"type": "Iguana"
},
"pubkey": "036879df230663db4cd083c8eeb0f293f46abc460ad3c299b0089b72e6d472202c",
"balances": {
"spendable": "0.11398301",
"unspendable": "0.00001"
}
}
},
"slp_addresses_infos": {
"simpleledger:qrf5vpn78s7rjexrjhlwyzzeg7gw98k7t5va3wuz4v": {
"derivation_method": {
"type": "Iguana"
},
"pubkey": "036879df230663db4cd083c8eeb0f293f46abc460ad3c299b0089b72e6d472202c",
"balances": {
"ASLP": {
"spendable": "5.2974",
"unspendable": "0"
}
}
}
}
},
"id": null
}
```
#### Request with `get_balances` set to false
```json
{
"userpass": "RPC_UserP@SSW0RD",
"method": "enable_bch_with_tokens",
"mmrpc": "2.0",
"params": {
"ticker": "BCH",
"allow_slp_unsafe_conf": false,
"bchd_urls": [
"https://bchd.dragonhound.info"
],
"mode": {
"rpc": "Electrum",
"rpc_data": {
"servers": [
{
"url": "bch.imaginary.cash:50002",
"protocol": "SSL"
},
{
"url": "cashnode.bch.ninja:50002",
"protocol": "SSL"
},
{
"url": "electrum3.cipig.net:20055",
"protocol": "SSL"
}
]
}
},
"tx_history": true,
"get_balances": false,
"slp_tokens_requests": [
{
"ticker": "ASLP-SLP",
"required_confirmations": 4
}
]
}
}
```
#### Response
```json
{
"mmrpc": "2.0",
"result": {
"current_block": 791267,
"bch_addresses_infos": {
"bitcoincash:qrf5vpn78s7rjexrjhlwyzzeg7gw98k7t5qx64fztj": {
"derivation_method": {
"type": "Iguana"
},
"pubkey": "03d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc2"
}
},
"slp_addresses_infos": {
"simpleledger:qrf5vpn78s7rjexrjhlwyzzeg7gw98k7t5va3wuz4v": {
"derivation_method": {
"type": "Iguana"
},
"pubkey": "03d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc2",
"tickers": ["ASLP-SLP"]
}
}
},
"id": null
}
```
### Error Types
| 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 |
#### PlatformIsAlreadyActivated Error
In this case, you need to [disable](/komodo-defi-framework/api/legacy/disable_coin/) BCH and try again.
```json
{
"mmrpc": "2.0",
"error": "BCH",
"error_path": "platform_coin_with_tokens",
"error_trace": "platform_coin_with_tokens:281]",
"error_type": "PlatformIsAlreadyActivated",
"error_data": "BCH",
"id": null
}
```
#### PlatformConfigIsNotFound Error
```json
{
"mmrpc": "2.0",
"error": "Platform BCH-wrong config is not found",
"error_path": "platform_coin_with_tokens.prelude",
"error_trace": "platform_coin_with_tokens:286] prelude:56]",
"error_type": "PlatformConfigIsNotFound",
"error_data": "BCH-wrong",
"id": null
}
```
#### UnexpectedPlatformProtocol Error
```json
{
"mmrpc": "2.0",
"error": "Unexpected platform protocol UTXO for BTC",
"error_path": "platform_coin_with_tokens.prelude.bch_with_tokens_activation",
"error_trace": "platform_coin_with_tokens:286] prelude:67] bch_with_tokens_activation:127]",
"error_type": "UnexpectedPlatformProtocol",
"error_data": {
"ticker": "BTC",
"protocol": {
"type": "UTXO"
}
},
"id": null
}
```
#### UnexpectedTokenProtocol Error
```json
{
"mmrpc": "2.0",
"error": "Unexpected token protocol ERC20 { platform: \"ETH\", contract_address: \"0xdAC17F958D2ee523a2206206994597C13D831ec7\" } for USDT-ERC20",
"error_path": "platform_coin_with_tokens.prelude.slp_token_activation",
"error_trace": "platform_coin_with_tokens:301] platform_coin_with_tokens:114] prelude:67] slp_token_activation:47]",
"error_type": "UnexpectedTokenProtocol",
"error_data": {
"ticker": "USDT-ERC20",
"protocol": {
"type": "ERC20",
"protocol_data": {
"platform": "ETH",
"contract_address": "0xdAC17F958D2ee523a2206206994597C13D831ec7"
}
}
},
"id": null
}
```
#### PlatformCoinCreationError Error
```json
{
"mmrpc": "2.0",
"error": "Error Using empty bchd_urls is unsafe for SLP users! on platform coin BCH creation",
"error_path": "platform_coin_with_tokens.bch_with_tokens_activation",
"error_trace": "platform_coin_with_tokens:290] bch_with_tokens_activation:212]",
"error_type": "PlatformCoinCreationError",
"error_data": {
"ticker": "BCH",
"error": "Using empty bchd_urls is unsafe for SLP users!"
},
"id": null
}
```
#### PlatformCoinCreationError Error (native)
```json
{
"mmrpc": "2.0",
"error": "Error bch:633] utxo:1704] utxo:995] Error parsing the native wallet configuration '/home/user/.Bitcoin Cash Testnet/Bitcoin Cash Testnet.conf': No such file or directory (os error 2) on platform coin tBCH creation",
"error_path": "platform_coin_with_tokens.bch_with_tokens_activation",
"error_trace": "platform_coin_with_tokens:290] bch_with_tokens_activation:212]",
"error_type": "PlatformCoinCreationError",
"error_data": {
"ticker": "tBCH",
"error": "bch:633] utxo:1704] utxo:995] Error parsing the native wallet configuration '/home/user/.Bitcoin Cash Testnet/Bitcoin Cash Testnet.conf': No such file or directory (os error 2)"
},
"id": null
}
```
#### PlatformCoinCreationError Error (Electrum server not responding)
```json
{
"mmrpc": "2.0",
"error": "Error bch:633] utxo:1667] Failed to connect to at least 1 of [ElectrumRpcRequest { url: \"bch0.kister.net:5100\", protocol: TCP, disable_cert_verification: false }, ElectrumRpcRequest { url: \"testnet.imaginary.cash:5000\", protocol: TCP, disable_cert_verification: false }, ElectrumRpcRequest { url: \"blackie.c3-soft.com:6000\", protocol: TCP, disable_cert_verification: false }, ElectrumRpcRequest { url: \"tbch.loping.net:6000\", protocol: TCP, disable_cert_verification: false }, ElectrumRpcRequest { url: \"electroncash.de:5000\", protocol: TCP, disable_cert_verification: false }] in 5 seconds. on platform coin tBCH creation",
"error_path": "platform_coin_with_tokens.bch_with_tokens_activation",
"error_trace": "platform_coin_with_tokens:290] bch_with_tokens_activation:212]",
"error_type": "PlatformCoinCreationError",
"error_data": {
"ticker": "tBCH",
"error": "bch:633] utxo:1667] Failed to connect to at least 1 of [ElectrumRpcRequest { url: \"bch0.kister.net:5100\", protocol: TCP, disable_cert_verification: false }, ElectrumRpcRequest { url: \"testnet.imaginary.cash:5000\", protocol: TCP, disable_cert_verification: false }, ElectrumRpcRequest { url: \"blackie.c3-soft.com:6000\", protocol: TCP, disable_cert_verification: false }, ElectrumRpcRequest { url: \"tbch.loping.net:6000\", protocol: TCP, disable_cert_verification: false }, ElectrumRpcRequest { url: \"electroncash.de:5000\", protocol: TCP, disable_cert_verification: false }] in 5 seconds."
},
"id": null
}
```
export const title = "Komodo DeFi Framework Method: Enable ERC20";
export const description =
"The enable_erc20 method allows you to activate additional ERC20 like tokens of a EVM type platform coin.";
# 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](/komodo-defi-framework/api/v20/coin_activation/enable_eth_with_tokens/) method.
| parameter | Type | Description |
| ------------------------------------------ | ------- | -------------------------------------------------------------------------------------------------- |
| ticker | string | Ticker of the ERC20 like token coin. |
| activation\_params.required\_confirmations | integer | Optional. Confirmations to wait for steps in swap. Defaults to value in the coins file if not set. |
```json
{
"userpass": "RPC_UserP@SSW0RD",
"method": "enable_erc20",
"mmrpc": "2.0",
"params": {
"ticker": "BAT-ERC20",
"activation_params": {
"required_confirmations": 3
}
}
}
```
## Response
```json
{
"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
```json
{
"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
```json
{
"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
```json
{
"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
}
```
export const title = "Komodo DeFi Framework Method: Enable ETH with Tokens";
export const description = "The enable_eth_with_tokens method allows you to enable a platform coin like ETH along with multiple ERC20 like tokens of the platform coin chain in a single command.";
# 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.
### Request Parameters
| Parameter | Type | Description |
| --------------------------- | ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ticker | string | Ticker of the platform protocol coin. Options: `ETH`, `AVAX`, `BNB`, `FTM`, `MATIC`, `ONE`, `ETH-ARB20` |
| 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` |
| swap\_contract\_address | string | Address of etomic swap smart contract |
| fallback\_swap\_contract | string | Address of backup etomic swap smart contract. |
| nodes | array of objects | A list of standard [EvmNode](/komodo-defi-framework/api/common_structures/activation/#evm-node) objects. |
| erc20\_tokens\_requests | array of objects | A list of standard [TokensRequest](/komodo-defi-framework/api/common_structures/activation/#tokens-request) objects. |
| gas\_station\_decimals | integer | Optional, for ETH/ERC20 and other gas model chains. Defaults to `8`. 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 | string | Optional, for ETH/ERC20 and other gas model chains. Defaults to `"MeanAverageFast"`. 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 | boolean | Optional, defaults to `true`. If `false`, coin and token balances will not be returned in the response, and the response will be returned more quickly. |
| priv\_key\_policy | string | Optional, defaults to `ContextPrivKey`. value can be `ContextPrivKey`,`Trezor` when Komodo DeFi Framework is built for native platforms. value can be `ContextPrivKey`, `Trezor`, `Metamask` when the Komodo DeFi Framework is built targeting `wasm` |
| required\_confirmations | integer | Optional, defaults to `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 | Optional, defaults to `false`. If `true`, coins protected by [Komodo Platform's dPoW security](https://satindergrewal.medium.com/delayed-proof-of-work-explained-9a74250dbb86) will wait for a notarization before progressing to the next atomic swap transactions step. |
| rpc\_mode | string | Optional, defaults to `Default`. Value can be `Metamask` only when the Komodo DeFi Framework is built targeting `wasm`. |
| tx\_history | boolean | Optional, defaults to `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](/komodo-defi-framework/api/legacy/my_tx_history/#my-tx-history) method |
| nft\_req | object | Optional, encapsulates the request parameters for NFT activation, including NFT provider configuration. |
| swap\_v2\_contracts | object | Optional, must be provided if "use\_trading\_proto\_v2" is true in [your configuration](/komodo-defi-framework/setup/configure-mm2-json/). A standard [SwapV2Contracts](/komodo-defi-framework/api/common_structures/activation/#tokens-request) object. |
### Response Parameters
| Parameter | Type | Description |
| ----------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| current\_block | integer | Block height of the coin being activated |
| eth\_addresses\_infos | object | A standard [AddressInfo](/komodo-defi-framework/api/common_structures/#address-info) object. Note: the structure may vary based on the value of the `get_balances` parameter. |
| erc20\_addresses\_infos | object | A standard [AddressInfo](/komodo-defi-framework/api/common_structures/#address-info) object. Note: the structure may vary based on the value of the `get_balances` parameter. |
| nfts\_infos | list | A list of standard [NftInfoBasic](/komodo-defi-framework/api/common_structures/nfts/#nft-info) objects. |
### 📌 Examples
#### Request including optional gas station parameters
```json
{
"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": "ContextPrivKey",
"swap_contract_address": "0x24ABE4c71FC658C91313b6552cd40cD808b3Ea80",
"fallback_swap_contract": "0x8500AFc0bc5214728082163326C2FF0C73f4a871",
"nodes": [
{
"url": "https://eth1.cipig.net:18555",
"gui_auth": false
},
{
"url": "https://eth2.cipig.net:18555",
"gui_auth": false
},
{
"url": "https://eth3.cipig.net:18555",
"gui_auth": 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
}
}
```
#### Response
```json
{
"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
}
```
#### Request with `get_balances` set to false
```json
{
"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
}
}
```
#### Response
```json
{
"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
}
```
#### Request including NFT initialization
```json
{
"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
}
}
```
#### Response
```json
{
"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
}
```
### Error Responses
### Error Types
| 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 |
#### PlatformIsAlreadyActivated Error
In this case, you need to [disable](/komodo-defi-framework/api/legacy/disable_coin/) the platform coin and try again.
```json
{
"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
}
```
#### PlatformConfigIsNotFound Error
```json
{
"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
}
```
#### CoinProtocolParseError Error
```json
{
"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
}
```
#### UnexpectedPlatformProtocol Error
```json
{
"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
}
```
#### TokenConfigIsNotFound Error
```json
{
"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
}
```
#### TokenProtocolParseError Error
```json
{
"mmrpc": "2.0",
"error": "Token BUSD-ERC20 protocol parsing failed: unknown variant `TERC20`, expected one of `UTXO`, `QTUM`, `QRC20`, `ETH`, `ERC20`, `SLPTOKEN`, `BCH`, `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`, `SLPTOKEN`, `BCH`, `TENDERMINT`, `TENDERMINTTOKEN`, `LIGHTNING`, `SOLANA`, `SPLTOKEN`, `ZHTLC`"
},
"id": null
}
```
#### UnexpectedTokenProtocol Error
```json
{
"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
}
```
#### InvalidRequest Error
Returned when the `rpc_mode` parameter is set to `Metamask` but the Komodo DeFi Framework was not built targeting `wasm`.
```json
{
"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
}
```
#### Transport Error
Returned when coin nodes are unresponsive.
```json
{
"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
}
```
export const title = "Komodo DeFi Framework Method: Enable SLP";
export const description =
"The enable_slp method allows you to activate additional SLP tokens.";
# enable\_slp
The `enable_slp` method allows you to activate additional SLP tokens. Before using this method, you first need to use the [enable\_bch\_with\_tokens](/komodo-defi-framework/api/v20/coin_activation/enable_bch_with_tokens/) method.
| parameter | Type | Description |
| ------------------------------------------ | ------- | -------------------------------------------------------------------------------------------------- |
| ticker | string | Ticker of the SLP token. |
| activation\_params.required\_confirmations | integer | Optional. Confirmations to wait for steps in swap. Defaults to value in the coins file if not set. |
```json
{
"userpass": "RPC_UserP@SSW0RD",
"method": "enable_slp",
"mmrpc": "2.0",
"params": {
"ticker": "SPICE-SLP",
"activation_params": {
"required_confirmations": 3
}
}
}
```
## Response
```json
{
"mmrpc": "2.0",
"result": {
"balances": {
"simpleledger:qrf5vpn78s7rjexrjhlwyzzeg7gw98k7t5va3wuz4v": {
"spendable": "0",
"unspendable": "0"
}
},
"token_id": "7f8889682d57369ed0e32336f8b7e0ffec625a35cca183f4e81fde4e71a538a1",
"platform_coin": "BCH",
"required_confirmations": 3
},
"id": null
}
```
## Error - BCH not yet activated
```json
{
"mmrpc": "2.0",
"error": "Platform coin BCH is not activated",
"error_path": "token.lp_coins",
"error_trace": "token:102] lp_coins:1924]",
"error_type": "PlatformCoinIsNotActivated",
"error_data": "BCH",
"id": null
}
```
## Error - Token already activated
```json
{
"mmrpc": "2.0",
"error": "Token SPICE-SLP is already activated",
"error_path": "token",
"error_trace": "token:95]",
"error_type": "TokenIsAlreadyActivated",
"error_data": "SPICE-SLP",
"id": null
}
```
## Error - Token config not found in coins file
```json
{
"mmrpc": "2.0",
"error": "Token SPICE-SLP-WRONG config is not found",
"error_path": "token.prelude",