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

Update/nft methods #317

Open
wants to merge 33 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
980458d
Update index.mdx
harsenyan3 Jul 5, 2024
34924cf
Update index.mdx
harsenyan3 Jul 10, 2024
7137071
Update index.mdx
harsenyan3 Jul 10, 2024
390a850
Update index.mdx
harsenyan3 Jul 10, 2024
37fa294
Update index.mdx
harsenyan3 Jul 10, 2024
eafec11
Update index.mdx
harsenyan3 Jul 10, 2024
7b8d674
Update index.mdx
harsenyan3 Jul 10, 2024
65ee467
Update index.mdx
harsenyan3 Jul 10, 2024
ebaad1b
Create index.mdx
harsenyan3 Jul 10, 2024
36b22f2
Merge branch 'dev' into dev
harsenyan3 Jul 10, 2024
689cc92
Update index.mdx
harsenyan3 Jul 10, 2024
6e825b8
Update index.mdx
harsenyan3 Jul 10, 2024
56025b5
Update index.mdx
harsenyan3 Jul 10, 2024
6e131c5
Update index.mdx
harsenyan3 Jul 10, 2024
394bc21
Merge pull request #270 from harsenyan3/dev
smk762 Aug 23, 2024
a4b89a1
update eth enable with tokens (and nfts)
smk762 Sep 2, 2024
5701bc4
updates `clear_nft_db` method
smk762 Sep 2, 2024
95f05cc
updates `update_nft` method
smk762 Sep 2, 2024
fb9fa71
updates `enable_nft` method
smk762 Sep 2, 2024
5938680
updates common structures doc for NFT methods
smk762 Sep 2, 2024
c1e72e9
update NFT overview doc
smk762 Sep 2, 2024
33bd70c
add error resp for refresh_nft_metadata
smk762 Sep 3, 2024
5135db0
update kdf postman collection
smk762 Sep 6, 2024
5ad918a
slugs, sidebar and linting for nft updates
smk762 Sep 6, 2024
cbd3a0d
proxy_auth -> komodo_proxy
smk762 Sep 6, 2024
c94efb9
proxy\_auth -> komodo\_proxy; set as optional
smk762 Sep 6, 2024
b88d44f
add error responses for update_nft
smk762 Sep 6, 2024
cf0d0e2
liniting, add missing comma
smk762 Sep 6, 2024
be90684
add missing line breaks
smk762 Sep 6, 2024
fe2be3a
add `use_trading_proto_v2` to setup config doc
smk762 Sep 13, 2024
ac4ed00
Merge branch 'dev' into update/nft-methods
smk762 Sep 13, 2024
f5f31df
[Bot] File and author data updated, validated and updated internal li…
smk762 Sep 13, 2024
6efdc05
Merge pull request #335 from KomodoPlatform/lint-fix-patches/update/n…
gcharang Sep 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,15 @@ The `WithdrawNftData` object is used for withdrawals of NFTs on ERC721 and ERC11
Due to this difference, the `amount` and `max` fields are only used the when
the `type` value is `withdraw_erc1155`.
</Note>

### NftProvider

The `NftProvider` object is used in the 'enable_nft' RPC method. It defines the NFT providers that are avaialable and their configuration.

| Parameter | Type | Description |
| -------------- | ------- | ------------------------------------------------------ |
| type | string | Specifies the type of the provider. |
| info | object | Additional information about the provider |
| info.url | string | URL of the provider's endpoint |
| info.proxy_auth | boolean | Optional, defaults to false. Indicates whether proxy authentication is enabled for the endpoint |
laruh marked this conversation as resolved.
Show resolved Hide resolved

Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
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 | A standard [NftProvider](komodo-defi-framework/api/commonstructures/nfts/#nftprovider) object |
| proxy\_auth | boolean | Optional, defaults to false. Indicates if proxy authentication is needed when communicating with the specified NFT provider.|
laruh 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
laruh marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
}
}
```
</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
}
```

## 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). |
laruh marked this conversation as resolved.
Show resolved Hide resolved
| 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
laruh marked this conversation as resolved.
Show resolved Hide resolved
}
}
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)
laruh marked this conversation as resolved.
Show resolved Hide resolved
|
| 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
Loading