Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NFT RPC Methods Docs update #270

Merged
merged 14 commits into from
Aug 23, 2024
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
export const title = "Komodo DeFi Framework Method: Enable NFT";
export const description =
"The enable_nft method allows you to activate NFT-like tokens on the platform.";

# enable\_nft

The 'enable_nft' method activates NFT-like tokens on the platform. Before using this method, you first need to use the [enable\_eth\_with\_tokens](/komodo-defi-framework/api/v20/enable_eth_with_tokens/) method.

| parameter | Type | Description |
| ------------------------------------------ | ------- | -------------------------------------------------------------------------------------------------- |
| ticker | string | Ticker of the NFT-like token coin. |
| activation\_params | object | object encapsulating all parameters for activation. |
| activation\_params.provider | object | Defines available NFT providers and their configuration. |
harsenyan3 marked this conversation as resolved.
Show resolved Hide resolved
| proxy\_auth | object | Optional, defaults to false. Indicates if proxy authentication is needed when communicating with the specified NFT provider.|
harsenyan3 marked this conversation as resolved.
Show resolved Hide resolved

<CodeGroup title="" tag="POST" label="enable_erc20" mm2MethodDecorate="true">
```json
{
"userpass": "RPC_UserP@SSW0RD",
"method": "enable_nft",
"mmrpc": "2.0",
"params": {
"ticker": "NFT_MATIC",
"activation_params": {
"provider": {
"type": "Moralis",
"info": {
"url": "http://localhost:6150/nft-test",
"proxy_auth": true
}
}
}
}
}
```
</CodeGroup>

## Response

```json
{
"mmrpc": "2.0",
"result": {
"balances": {
"0x0d317904AF3BA3A993d557b6cba147FEA4DeB57E": {
"spendable": "0",
"unspendable": "0"
}
},
"platform_coin": "ETH",
"token_contract_address": "0x0d8775f648430679a709e98d2b0cb6250d2887ef",
"required_confirmations": 3
},
"id": null
}
```
Comment on lines +39 to +55
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀 this is wrong response for enable nft


## 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 NFT_MATIC is already activated",
"error_path": "token",
"error_trace": "token:119]",
"error_type": "TokenIsAlreadyActivated",
"error_data": "NFT_MATIC",
"id": null
}
```

## Error - Token config not found in coins file

```json
{
"mmrpc": "2.0",
"error": "Token NFT_TESTTT config is not found",
"error_path": "token.prelude",
"error_trace": "token:122] prelude:79]",
"error_type": "TokenConfigIsNotFound",
"error_data": "NFT_TESTTT",
"id": null
}
```
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ These coins can be activated using the [enable\_eth\_with\_tokens](/komodo-defi-

### Request Parameters

| Parameter | Type | Description |
| ------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| chains | array | List of networks to scan for NFTs. Options are: `POLYGON`, `FANTOM`, `ETH`, `BSC`, or `AVALANCHE`. |
| proxy\_auth | boolean | Indicates whether authentication is required for accessing the proxy URLs (true if necessary, false otherwise). |
| url | string | URL link to the [Moralis API proxy base url](https://moralis-proxy.komodo.earth) or equivalent (if proxy\_auth is set to true, will need to provide a new Komodo Proxy URL). |
| url\_antispam | string | URL link to the [Antispam API proxy base url](https://nft.antispam.dragonhound.info) or equivalent. |

| Parameter | Type | Description |
| ------------- | ------- | --------------------------------------------------------------------------------------------------------------- |
| chains | array | List of networks to scan for NFTs. Options are: `POLYGON`, `FANTOM`, `ETH`, `BSC`, or `AVALANCHE`. |
| proxy\_auth | boolean | Optional. Indicates whether authentication is required for accessing the proxy URLs (defaults to false). |
| url | string | URL link to the [Moralis API proxy base url](https://moralis-proxy.komodo.earth) or equivalent (if proxy_auth is set to true, will need to provide a new Komodo Proxy URL). |
| url\_antispam | string | URL link to the [Antispam API proxy base url](https://nft.antispam.dragonhound.info) or equivalent. |


<Note>
If there are no errors, this request will return an empty response.
Expand All @@ -42,11 +44,13 @@ These coins can be activated using the [enable\_eth\_with\_tokens](/komodo-defi-
"method": "update_nft",
"mmrpc": "2.0",
"params": {
"chains": [
"chains": [
"BSC",
"POLYGON"
],
"url": "https://moralis-proxy.komodo.earth",
"url_antispam": "https://nft.antispam.dragonhound.info",
}
"proxy_auth": false
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose you removed this brace accidentally, making the JSON invalid.
you can re check it in this site https://codebeautify.org/jsonviewer

right now "https://moralis-proxy.komodo.earth" doesnt have auth validation and rate limits, when we deploy up to date proxy layer with these changes KomodoPlatform/komodo-defi-proxy#22 on moralis-proxy.komodo.earth domain or other type, "proxy_auth": true should be added
@smk

as for now, after adding proxy Optional info, there is no need to add changes in this RPC

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Readded the brace.

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,14 @@ Additionally, it supports ERC20 tokens on the ETH chain and associated ERC20 lik
| 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 |
| maker\_swap\_v2\_contract | string | Backup address for the maker's swap smart contract |
| taker\_swap\_v2\_contract | string | Backup address for the taker's swap smart contract |
| nodes | array of objects | A list of standard [EvmNode](/komodo-defi-framework/api/common_structures/activation/#evm-node) objects. ([https://github.com/KomodoPlatform/coins/tree/master/electrums](https://github.com/KomodoPlatform/coins/tree/master/electrums)). |
| | | |

| fallback\_swap\_contract | string | Address of backup etomic swap smart contract. |
| maker\_swap\_v2\_contract | string | Address for the maker's new V2 swap smart contract. (Must be provided if "use_trading_proto_v2"is true in mm2 configuration)
|
| taker\_swap\_v2\_contract | string | Address for the taker's new V2 swap smart contract. (Must be provided if "use_trading_proto_v2"is true in mm2 configuration)
|
| 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. |
Expand All @@ -26,7 +29,8 @@ Additionally, it supports ERC20 tokens on the ETH chain and associated ERC20 lik
| 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 `Http`, value can be `Metamask` 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 |
| 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. |

### Response Parameters

Expand Down