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 40 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 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
2f1903c
Merge branch 'dev' into update/nft-methods
smk762 Oct 30, 2024
9e62008
remove nonexisting nft_taker_swap params
smk762 Oct 30, 2024
9720faa
restore taker_swap_v2_contract
smk762 Oct 30, 2024
517c793
[Bot] File and author data updated, validated and updated internal li…
smk762 Oct 30, 2024
2262176
Merge pull request #365 from KomodoPlatform/lint-fix-patches/update/n…
gcharang Oct 31, 2024
33036fd
Merge branch 'dev' into update/nft-methods
smk762 Nov 1, 2024
ec9dad6
mark param as optional, update eth activation response
smk762 Nov 14, 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
33 changes: 27 additions & 6 deletions filepathSlugs.json
Original file line number Diff line number Diff line change
Expand Up @@ -2015,6 +2015,7 @@
"coin-protocol",
"coin-protocol-data",
"evm-node",
"swap-v2-contracts",
"tokens-request",
"utxo-merge-params"
],
Expand Down Expand Up @@ -2066,12 +2067,14 @@
],
"src/pages/komodo-defi-framework/api/common_structures/nfts/index.mdx": [
"non-fungible-token-structures",
"nft-info-basic",
"nft-info",
"nft-filter",
"nft-transfer",
"nft-transfer-filter",
"nft-metadata",
"withdraw-nft-data"
"withdraw-nft-data",
"nft-provider"
],
"src/pages/komodo-defi-framework/api/common_structures/orders/index.mdx": [
"order-structures",
Expand Down Expand Up @@ -2773,14 +2776,19 @@
"response",
"request-with-get-balances-set-to-false",
"response-2",
"request-including-nft-initialization",
"response-3",
"error-responses",
"error-types",
"platform-is-already-activated-error",
"platform-config-is-not-found-error",
"coin-protocol-parse-error-error",
"unexpected-platform-protocol-error",
"token-config-is-not-found-error",
"token-protocol-parse-error-error",
"unexpected-token-protocol-error"
"unexpected-token-protocol-error",
"invalid-request-error",
"transport-error"
],
"src/pages/komodo-defi-framework/api/v20/enable_slp/index.mdx": [
"enable-slp",
Expand Down Expand Up @@ -3351,7 +3359,15 @@
"example-to-clear-binance-smart-chain-and-polygon-nft-data",
"example-to-clear-all-nft-data",
"error-responses",
"unsupported-chain-type"
"unsupported-chain-type",
"invalid-request"
],
"src/pages/komodo-defi-framework/api/v20-dev/non_fungible_tokens/enable_nft/index.mdx": [
"enable-nft",
"response",
"error-platform-coin-is-not-yet-activated",
"error-token-already-activated",
"error-token-config-not-found-in-coins-file"
],
"src/pages/komodo-defi-framework/api/v20-dev/non_fungible_tokens/get_nft_list/index.mdx": [
"get-a-list-of-nfts",
Expand Down Expand Up @@ -3379,7 +3395,8 @@
"src/pages/komodo-defi-framework/api/v20-dev/non_fungible_tokens/index.mdx": [
"non-fungible-tokens-nfts",
"nft-information-methods",
"nft-transaction-methods"
"nft-transaction-methods",
"nft-utility-methods"
],
"src/pages/komodo-defi-framework/api/v20-dev/non_fungible_tokens/query_nft_database_tables/index.mdx": [
"query-nft-database-tables",
Expand All @@ -3393,12 +3410,16 @@
"src/pages/komodo-defi-framework/api/v20-dev/non_fungible_tokens/refresh_nft_metadata/index.mdx": [
"refresh-nft-metadata",
"request-parameters",
"example"
"example",
"error-responses"
],
"src/pages/komodo-defi-framework/api/v20-dev/non_fungible_tokens/update_nft/index.mdx": [
"update-nft",
"request-parameters",
"example"
"example",
"error-types",
"token-is-already-activated",
"token-is-already-activated-2"
],
"src/pages/komodo-defi-framework/api/v20-dev/non_fungible_tokens/withdraw_nft/index.mdx": [
"withdraw-nfts",
Expand Down
2,122 changes: 1,860 additions & 262 deletions postman/collections/komodo_defi.postman_collection.json

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions src/data/sidebar.json
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,10 @@
"title": "Overview",
"href": "/komodo-defi-framework/api/v20-dev/non_fungible_tokens/"
},
{
"title": "Enable NFT",
"href": "/komodo-defi-framework/api/v20-dev/non_fungible_tokens/enable_nft/"
},
{
"title": "Clear NFT Database Tables",
"href": "/komodo-defi-framework/api/v20-dev/non_fungible_tokens/clear_nft_db/"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,26 @@ The `EvmNode` object includes the following items for a given coin or token:
```
</CollapsibleSection>

### SwapV2Contracts

The `SwapV2Contracts` object includes the following items for a given coin or token:

| Parameter | Type | Description |
| ------------------------------ | ------ | --------------------------------------------------------------------------------------------------------------------------------- |
| 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 |
| nft\_maker\_swap\_v2\_contract | string | Address for the maker's new V2 NFT swap smart contract. Must be provided if "use\_trading\_proto\_v2"is true in mm2 configuration |

<CollapsibleSection expandedText="Hide Example" collapsedText="Show Example">
```json
{
"maker_swap_v2_contract": "0x9130b257D37A52E52F21054c4DA3450c72f595CE",
"taker_swap_v2_contract": "0x9130b257D37A52E52F21054c4DA3450c72f595CE",
"nft_maker_swap_v2_contract": "0x9130b257D37A52E52F21054c4DA3450c72f595CE"
}
```
</CollapsibleSection>

### TokensRequest

The `TokensRequest` object includes the following items for a given coin or token:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ export const description = "Starting with version beta-2.1.3434, the Komodo DeFi

The following structures are used in the Komodo DeFi SDK for non-fungible tokens (NFTs).

### NftInfoBasic

The `NftInfoBasic` object includes the following items for a given token:

| Parameter | Type | Description |
| -------------- | ------ | --------------------------------------------------------------------- |
| amount | string | The amount of this NFT the user owns (used by `ERC1155`). |
| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. |
| contract\_type | string | The type of NFT contract standard. One of `ERC721` or `ERC1155`. |
| token\_address | string | The address of the NFT contract. |
| token\_id | string | The token ID of the NFT. |

### NftInfo

The `NftInfo` object includes the following items for a given token:
Expand Down Expand Up @@ -197,3 +209,26 @@ 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.komodo\_proxy | boolean | Optional. Indicates whether proxy authentication is enabled for the endpoint |

<CollapsibleSection expandedText="Hide Example" collapsedText="Show Example">
```json
{
"type": "Moralis",
"info": {
"url": "https://moralis-proxy.komodo.earth",
"komodo_proxy": true
}
}
```
</CollapsibleSection>
2 changes: 2 additions & 0 deletions src/pages/komodo-defi-framework/api/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Below is a table of the currently available legacy, v2.0 and v2.0 (Dev) methods:
| | [enable\_bch\_with\_tokens](/komodo-defi-framework/api/v20/enable_bch_with_tokens/#enable-bch-with-tokens) | |
| | [enable\_erc20](/komodo-defi-framework/api/v20/enable_erc20/#enable-erc20) | |
| | [enable\_eth\_with\_tokens](/komodo-defi-framework/api/v20/enable_eth_with_tokens/#enable-eth-with-tokens) | |
| | | [enable\_nft](/komodo-defi-framework/api/v20-dev/non_fungible_tokens/enable_nft/#enable-nft) |
| | [enable\_slp](/komodo-defi-framework/api/v20/enable_slp/#enable-slp) | |
| | [enable\_tendermint\_token](/komodo-defi-framework/api/v20/enable_tendermint_token/#enable-tendermint-token) | |
| | [enable\_tendermint\_with\_assets](/komodo-defi-framework/api/v20/enable_tendermint_with_assets/#enable-tendermint-with-assets) | |
Expand All @@ -55,6 +56,7 @@ Below is a table of the currently available legacy, v2.0 and v2.0 (Dev) methods:
| [get\_relay\_mesh](/komodo-defi-framework/api/legacy/get_relay_mesh/#get-relay-mesh) | | |
| | [get\_staking\_infos](/komodo-defi-framework/api/v20/get_staking_infos/#get-staking-infos) | |
| [get\_trade\_fee](/komodo-defi-framework/api/legacy/get_trade_fee/#get-trade-fee) | | |
| | [get\_wallet\_names](/komodo-defi-framework/api/v20/get_wallet_names/#get-wallet-names) | |
| [import\_swaps](/komodo-defi-framework/api/legacy/import_swaps/#import-swaps) | | |
| [kmd\_rewards\_info](/komodo-defi-framework/api/legacy/kmd_rewards_info/#kmd-rewards-info) | | |
| | | [lightning::nodes::add\_trusted\_node](/komodo-defi-framework/api/v20-dev/lightning/nodes/#add-trusted-node) |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const title = "Komodo DeFi Framework Method: Non Fungible Tokens";
export const description =
"This document describes the clear_nft_db method Komodo DeFi Framework provides to clear NFT data from your local database";
"This document describes the clear_nft_db method Komodo DeFi Framework provides to clear NFT data from your local database";

# Clear NFT Database {{label : 'clear_nft_db', tag : 'API-v2'}}

Expand Down Expand Up @@ -88,3 +88,17 @@ Returned when the `chains` parameter contains an unsupported network.
"id": null
}
```

#### InvalidRequest

Returned when neither the `chains` or `clear_all` parameters are present.

```json
{
"mmrpc":"2.0",
"error":"Invalid request: Nothing to clear was specified","error_path":"nft","error_trace":"nft:1512]",
"error_type":"InvalidRequest",
"error_data":"Nothing to clear was specified",
"id":null
}
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
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, if the NFT network was already activated with the [enable\_eth\_with\_tokens](/komodo-defi-framework/api/v20/enable_eth_with_tokens/) method, but without the `nft_req` parameter.

| parameter | Type | Description |
| ------------------ | ------ | ------------------------------------------------------------------------------------------------ |
| ticker | string | The ticker of the NFT network, with `NFT_` as a prefix. |
| activation\_params | object | A standard [NftProvider](/komodo-defi-framework/api/common_structures/nfts/#nft-provider) object |

<CodeGroup title="" tag="POST" label="enable_nft" mm2MethodDecorate="true">
```json
{
"userpass": "RPC_UserP@SSW0RD",
"method": "enable_nft",
"mmrpc": "2.0",
"params": {
"ticker": "NFT_MATIC",
"activation_params": {
"provider": {
"type": "Moralis",
"info": {
"url": "https://moralis-proxy.komodo.earth",
"komodo_proxy": true
}
}
}
}
}
```
</CodeGroup>

## Response

```json
{
"mmrpc": "2.0",
"result": {
"nfts": {
"0xc28a19e9a663d966cf99532bdb1229df1b0e344b,1": {
"token_address": "0xc28a19e9a663d966cf99532bdb1229df1b0e344b",
"token_id": "1",
"chain": "POLYGON",
"contract_type": "ERC1155",
"amount": "1"
},
"0xd25f13e4ba534ef625c75b84934689194b7bd59e,14": {
"token_address": "0xd25f13e4ba534ef625c75b84934689194b7bd59e",
"token_id": "14",
"chain": "POLYGON",
"contract_type": "ERC721",
"amount": "1"
}
},
"platform_coin": "MATIC"
},
"id": null
}
```

## Error - Platform coin is not yet activated

```json
{
"mmrpc": "2.0",
"error": "Platform coin MATIC is not activated",
"error_path": "token.lp_coins",
"error_trace": "token:126] lp_coins:2797]",
"error_type": "PlatformCoinIsNotActivated",
"error_data": "MATIC",
"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
@@ -1,6 +1,6 @@
export const title = "Komodo DeFi Framework Method: Non Fungible Tokens - Get NFT List";
export const description =
"This document describes all the get_nft_list method Komodo DeFi Framework provides to get a list of your wallets NFTs";
"This document describes all the get_nft_list method Komodo DeFi Framework provides to get a list of your wallets NFTs";

# Get a list of NFTs {{label : 'get_nft_list', tag : 'API-v2'}}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const title = "Komodo DeFi Framework Method: Non Fungible Tokens";
export const description =
"This document describes the get_nft_metadata method Komodo DeFi Framework provides to get metadata for your NFTs";
"This document describes the get_nft_metadata method Komodo DeFi Framework provides to get metadata for your NFTs";

# Get NFT Metadata {{label : 'get_nft_metadata', tag : 'API-v2'}}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const title = "Komodo DeFi Framework Method: Non Fungible Tokens";
export const description =
"This document describes the get_nft_transfers method Komodo DeFi Framework provides to get information about your NFT transactions";
"This document describes the get_nft_transfers method Komodo DeFi Framework provides to get information about your NFT transactions";

# Get a list of NFT transfers {{label : 'get_nft_transfers', tag : 'API-v2'}}

Expand Down
Loading
Loading