From 2df03b027d0a8a02f75cbafc6ab22a5371d6a907 Mon Sep 17 00:00:00 2001 From: Gino Date: Tue, 25 Jun 2024 11:09:15 +0100 Subject: [PATCH 1/8] feat(iota-wiki): create guide to get L2 NFTs owned by an account --- .../core-contracts/nft/get-L2-nfts.mdx | 79 +++++++++++++++++++ docs/build/isc/v1.1/sidebars.js | 5 ++ 2 files changed, 84 insertions(+) create mode 100644 docs/build/isc/v1.1/docs/how-tos/core-contracts/nft/get-L2-nfts.mdx diff --git a/docs/build/isc/v1.1/docs/how-tos/core-contracts/nft/get-L2-nfts.mdx b/docs/build/isc/v1.1/docs/how-tos/core-contracts/nft/get-L2-nfts.mdx new file mode 100644 index 00000000000..29d471e27bb --- /dev/null +++ b/docs/build/isc/v1.1/docs/how-tos/core-contracts/nft/get-L2-nfts.mdx @@ -0,0 +1,79 @@ +--- +description: How to Get the L2 NFTs owned by an account. +image: /img/logo/WASP_logo_dark.png +tags: + - EVM + - how-to + - native tokens + - L2 NFTs +--- +import GetNftMetadata from '../../../_partials/how-tos/token/_get-nft-metadata.md'; + +# Get NFTs Owned by an Account + +This guide will show you how to get the L2 NFTs owned by an account using the `getL2NFTs` function from the `ISCAccounts` magic contract. + + + +## Understanding the `getL2NFTs` Function + +The `getL2NFTs` function is a view function provided by the `ISCAccounts` interface. It takes an `ISCAgentID` as an argument and returns an array of `NFTID` objects. This function allows users to query and retrieve the list of L2 NFTs owned by a specified agent. The `ISCAgentID` represents the identifier of the agent (user or contract) whose NFTs you want to retrieve. The returned array contains the identifiers of the NFTs, which can then be used to fetch more details about each NFT if needed. + +## Why Would a User Need to retrieve owned NFTs? + +Retrieving the NFTs owned by a user can serve several purposes: + +1. **Portfolio Management:** Users can manage their digital assets effectively by viewing all their NFTs in one place. +2. **Marketplace Listing:** Users can list their NFTs on various marketplaces by verifying their ownership. +3. **Collection Display:** Users can showcase their NFT collections on social media, personal websites, or within specific applications. +4. **Trading and Transfers:** Knowing the NFTs owned helps users decide which assets to trade or transfer to other users. +5. **Application Integration:** Applications can provide customized experiences based on the NFTs a user owns, such as granting access to special content or features. + +## Prerequisites +1. **Install the ISC Magic Library:** + + Ensure you have the ISC Magic library installed in your project: + ```bash + npm install @iota/iscmagic + ``` + +2. **Import the ISC Library:** + + In your Solidity file, import the ISC Library: + ```solidity + pragma solidity >=0.8.5; + + import "@iota/iscmagic/ISC.sol"; + ``` +## Implement the `getL2NFTs` Function + +Here’s a sample implementation to retrieve L2 NFTs owned by an account: + +```solidity +function getOwnedNFTs(ISCAgentID memory agentID) public view returns (NFTID[] memory) { + // Call the getL2NFTs function from the ISCAccounts contract + NFTID[] memory ownedNFTs = ISC.accounts.getL2NFTs(agenID); + return ownedNFTs; +} +``` + +## Full Example Contract + +```solidity +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.5; + +import "@iota/iscmagic/ISC.sol"; + +contract MyNFTContract { + +function getOwnedNFTs(ISCAgentID memory agentID) public view returns (NFTID[] memory) { + // Call the getL2NFTs function from the ISCAccounts contract + NFTID[] memory ownedNFTs = ISC.accounts.getL2NFTs(agenID); + return ownedNFTs; + } +} +``` +## Conclusion + +Using the `getL2NFTs` function from the `ISCAccounts` interface provides an efficient way to retrieve and manage the Layer 2 NFTs owned by an account. By integrating this functionality into your smart contracts, you can enhance user experience by enabling features such as portfolio management, marketplace listings, collection displays, and more. With this guide, you now have the foundational knowledge to implement and utilize the `getL2NFTs` function in your own projects, allowing for seamless interaction with `ISC Magic` and its associated NFTs. \ No newline at end of file diff --git a/docs/build/isc/v1.1/sidebars.js b/docs/build/isc/v1.1/sidebars.js index 675779b89b5..89aa93d081d 100644 --- a/docs/build/isc/v1.1/sidebars.js +++ b/docs/build/isc/v1.1/sidebars.js @@ -215,6 +215,11 @@ module.exports = { label: 'Get NFT Metadata', id: 'how-tos/core-contracts/nft/get-nft-metadata', }, + { + type: 'doc', + label: 'Get NFTs Owned by an Account', + id: 'how-tos/core-contracts/nft/get-L2-nfts', + }, ], }, { From 7045c6822db27f6629bd20b56153e645b6efc7d8 Mon Sep 17 00:00:00 2001 From: Gino Date: Tue, 25 Jun 2024 11:13:51 +0100 Subject: [PATCH 2/8] feat(iota-wiki): duplicate guide on v1.3 --- .../core-contracts/nft/get-L2-nfts.mdx | 79 +++++++++++++++++++ docs/build/isc/v1.3/sidebars.js | 5 ++ 2 files changed, 84 insertions(+) create mode 100644 docs/build/isc/v1.3/docs/how-tos/core-contracts/nft/get-L2-nfts.mdx diff --git a/docs/build/isc/v1.3/docs/how-tos/core-contracts/nft/get-L2-nfts.mdx b/docs/build/isc/v1.3/docs/how-tos/core-contracts/nft/get-L2-nfts.mdx new file mode 100644 index 00000000000..29d471e27bb --- /dev/null +++ b/docs/build/isc/v1.3/docs/how-tos/core-contracts/nft/get-L2-nfts.mdx @@ -0,0 +1,79 @@ +--- +description: How to Get the L2 NFTs owned by an account. +image: /img/logo/WASP_logo_dark.png +tags: + - EVM + - how-to + - native tokens + - L2 NFTs +--- +import GetNftMetadata from '../../../_partials/how-tos/token/_get-nft-metadata.md'; + +# Get NFTs Owned by an Account + +This guide will show you how to get the L2 NFTs owned by an account using the `getL2NFTs` function from the `ISCAccounts` magic contract. + + + +## Understanding the `getL2NFTs` Function + +The `getL2NFTs` function is a view function provided by the `ISCAccounts` interface. It takes an `ISCAgentID` as an argument and returns an array of `NFTID` objects. This function allows users to query and retrieve the list of L2 NFTs owned by a specified agent. The `ISCAgentID` represents the identifier of the agent (user or contract) whose NFTs you want to retrieve. The returned array contains the identifiers of the NFTs, which can then be used to fetch more details about each NFT if needed. + +## Why Would a User Need to retrieve owned NFTs? + +Retrieving the NFTs owned by a user can serve several purposes: + +1. **Portfolio Management:** Users can manage their digital assets effectively by viewing all their NFTs in one place. +2. **Marketplace Listing:** Users can list their NFTs on various marketplaces by verifying their ownership. +3. **Collection Display:** Users can showcase their NFT collections on social media, personal websites, or within specific applications. +4. **Trading and Transfers:** Knowing the NFTs owned helps users decide which assets to trade or transfer to other users. +5. **Application Integration:** Applications can provide customized experiences based on the NFTs a user owns, such as granting access to special content or features. + +## Prerequisites +1. **Install the ISC Magic Library:** + + Ensure you have the ISC Magic library installed in your project: + ```bash + npm install @iota/iscmagic + ``` + +2. **Import the ISC Library:** + + In your Solidity file, import the ISC Library: + ```solidity + pragma solidity >=0.8.5; + + import "@iota/iscmagic/ISC.sol"; + ``` +## Implement the `getL2NFTs` Function + +Here’s a sample implementation to retrieve L2 NFTs owned by an account: + +```solidity +function getOwnedNFTs(ISCAgentID memory agentID) public view returns (NFTID[] memory) { + // Call the getL2NFTs function from the ISCAccounts contract + NFTID[] memory ownedNFTs = ISC.accounts.getL2NFTs(agenID); + return ownedNFTs; +} +``` + +## Full Example Contract + +```solidity +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.5; + +import "@iota/iscmagic/ISC.sol"; + +contract MyNFTContract { + +function getOwnedNFTs(ISCAgentID memory agentID) public view returns (NFTID[] memory) { + // Call the getL2NFTs function from the ISCAccounts contract + NFTID[] memory ownedNFTs = ISC.accounts.getL2NFTs(agenID); + return ownedNFTs; + } +} +``` +## Conclusion + +Using the `getL2NFTs` function from the `ISCAccounts` interface provides an efficient way to retrieve and manage the Layer 2 NFTs owned by an account. By integrating this functionality into your smart contracts, you can enhance user experience by enabling features such as portfolio management, marketplace listings, collection displays, and more. With this guide, you now have the foundational knowledge to implement and utilize the `getL2NFTs` function in your own projects, allowing for seamless interaction with `ISC Magic` and its associated NFTs. \ No newline at end of file diff --git a/docs/build/isc/v1.3/sidebars.js b/docs/build/isc/v1.3/sidebars.js index 675779b89b5..89aa93d081d 100644 --- a/docs/build/isc/v1.3/sidebars.js +++ b/docs/build/isc/v1.3/sidebars.js @@ -215,6 +215,11 @@ module.exports = { label: 'Get NFT Metadata', id: 'how-tos/core-contracts/nft/get-nft-metadata', }, + { + type: 'doc', + label: 'Get NFTs Owned by an Account', + id: 'how-tos/core-contracts/nft/get-L2-nfts', + }, ], }, { From 2a9b13e793db5e8b9a0b9edfee5e36468bb4ba5e Mon Sep 17 00:00:00 2001 From: Gino Date: Wed, 26 Jun 2024 10:22:30 +0100 Subject: [PATCH 3/8] feat(iota-wiki): implement review suggestions --- .../core-contracts/nft/get-L2-nfts.mdx | 40 ++++++++++++++----- .../core-contracts/nft/get-L2-nfts.mdx | 40 ++++++++++++++----- 2 files changed, 58 insertions(+), 22 deletions(-) diff --git a/docs/build/isc/v1.1/docs/how-tos/core-contracts/nft/get-L2-nfts.mdx b/docs/build/isc/v1.1/docs/how-tos/core-contracts/nft/get-L2-nfts.mdx index 29d471e27bb..1951ac3b7da 100644 --- a/docs/build/isc/v1.1/docs/how-tos/core-contracts/nft/get-L2-nfts.mdx +++ b/docs/build/isc/v1.1/docs/how-tos/core-contracts/nft/get-L2-nfts.mdx @@ -1,5 +1,5 @@ --- -description: How to Get the L2 NFTs owned by an account. +description: How to get the L2 NFTs owned by an account. image: /img/logo/WASP_logo_dark.png tags: - EVM @@ -11,7 +11,7 @@ import GetNftMetadata from '../../../_partials/how-tos/token/_get-nft-metadata.m # Get NFTs Owned by an Account -This guide will show you how to get the L2 NFTs owned by an account using the `getL2NFTs` function from the `ISCAccounts` magic contract. +This guide will show you how to get the L2 NFTs owned by an account using the [`ISCAccounts.getL2NFTs`](../../../reference/magic-contract/ISCAccounts.md#getl2nfts) function from the [`ISCAccounts.getL2NFTs`](../../../reference/magic-contract/ISCAccounts.md) [magic contract](../../../reference/magic-contract/introduction.md). @@ -19,32 +19,50 @@ This guide will show you how to get the L2 NFTs owned by an account using the `g The `getL2NFTs` function is a view function provided by the `ISCAccounts` interface. It takes an `ISCAgentID` as an argument and returns an array of `NFTID` objects. This function allows users to query and retrieve the list of L2 NFTs owned by a specified agent. The `ISCAgentID` represents the identifier of the agent (user or contract) whose NFTs you want to retrieve. The returned array contains the identifiers of the NFTs, which can then be used to fetch more details about each NFT if needed. -## Why Would a User Need to retrieve owned NFTs? +## Why Would a User Need to Retrieve Owned NFTs? Retrieving the NFTs owned by a user can serve several purposes: -1. **Portfolio Management:** Users can manage their digital assets effectively by viewing all their NFTs in one place. -2. **Marketplace Listing:** Users can list their NFTs on various marketplaces by verifying their ownership. -3. **Collection Display:** Users can showcase their NFT collections on social media, personal websites, or within specific applications. -4. **Trading and Transfers:** Knowing the NFTs owned helps users decide which assets to trade or transfer to other users. -5. **Application Integration:** Applications can provide customized experiences based on the NFTs a user owns, such as granting access to special content or features. +- ### Portfolio Management + + - Users can manage their digital assets effectively by viewing all their NFTs in one place. + +- ### Marketplace Listing + + - Users can list their NFTs on various marketplaces by verifying their ownership. + +- ### Collection Display + + - Users can showcase their NFT collections on social media, personal websites, or within specific applications. + +- ### Trading and Transfers + + - Knowing the NFTs owned helps users decide which assets to trade or transfer to other users. + +- ### Application Integration + + - Applications can provide customized experiences based on the NFTs a user owns, such as granting access to special content or features. ## Prerequisites -1. **Install the ISC Magic Library:** + +### Install the ISC Magic Library Ensure you have the ISC Magic library installed in your project: + ```bash npm install @iota/iscmagic ``` -2. **Import the ISC Library:** +### 2. Import the ISC Library In your Solidity file, import the ISC Library: + ```solidity pragma solidity >=0.8.5; import "@iota/iscmagic/ISC.sol"; ``` + ## Implement the `getL2NFTs` Function Here’s a sample implementation to retrieve L2 NFTs owned by an account: @@ -76,4 +94,4 @@ function getOwnedNFTs(ISCAgentID memory agentID) public view returns (NFTID[] me ``` ## Conclusion -Using the `getL2NFTs` function from the `ISCAccounts` interface provides an efficient way to retrieve and manage the Layer 2 NFTs owned by an account. By integrating this functionality into your smart contracts, you can enhance user experience by enabling features such as portfolio management, marketplace listings, collection displays, and more. With this guide, you now have the foundational knowledge to implement and utilize the `getL2NFTs` function in your own projects, allowing for seamless interaction with `ISC Magic` and its associated NFTs. \ No newline at end of file +Using the `getL2NFTs` function from the `ISCAccounts` interface provides an efficient way to retrieve and manage the Layer 2 NFTs owned by an account. By integrating this functionality into your smart contracts, you can enhance user experience by enabling features such as [portfolio management](#portfolio-management), [marketplace listings](#marketplace-listing), [collection displays](#collection-display), and more. With this guide, you have the foundational knowledge to implement and utilize the `getL2NFTs` function in your projects, allowing for seamless interaction with `ISC Magic` and its associated NFTs. \ No newline at end of file diff --git a/docs/build/isc/v1.3/docs/how-tos/core-contracts/nft/get-L2-nfts.mdx b/docs/build/isc/v1.3/docs/how-tos/core-contracts/nft/get-L2-nfts.mdx index 29d471e27bb..1951ac3b7da 100644 --- a/docs/build/isc/v1.3/docs/how-tos/core-contracts/nft/get-L2-nfts.mdx +++ b/docs/build/isc/v1.3/docs/how-tos/core-contracts/nft/get-L2-nfts.mdx @@ -1,5 +1,5 @@ --- -description: How to Get the L2 NFTs owned by an account. +description: How to get the L2 NFTs owned by an account. image: /img/logo/WASP_logo_dark.png tags: - EVM @@ -11,7 +11,7 @@ import GetNftMetadata from '../../../_partials/how-tos/token/_get-nft-metadata.m # Get NFTs Owned by an Account -This guide will show you how to get the L2 NFTs owned by an account using the `getL2NFTs` function from the `ISCAccounts` magic contract. +This guide will show you how to get the L2 NFTs owned by an account using the [`ISCAccounts.getL2NFTs`](../../../reference/magic-contract/ISCAccounts.md#getl2nfts) function from the [`ISCAccounts.getL2NFTs`](../../../reference/magic-contract/ISCAccounts.md) [magic contract](../../../reference/magic-contract/introduction.md). @@ -19,32 +19,50 @@ This guide will show you how to get the L2 NFTs owned by an account using the `g The `getL2NFTs` function is a view function provided by the `ISCAccounts` interface. It takes an `ISCAgentID` as an argument and returns an array of `NFTID` objects. This function allows users to query and retrieve the list of L2 NFTs owned by a specified agent. The `ISCAgentID` represents the identifier of the agent (user or contract) whose NFTs you want to retrieve. The returned array contains the identifiers of the NFTs, which can then be used to fetch more details about each NFT if needed. -## Why Would a User Need to retrieve owned NFTs? +## Why Would a User Need to Retrieve Owned NFTs? Retrieving the NFTs owned by a user can serve several purposes: -1. **Portfolio Management:** Users can manage their digital assets effectively by viewing all their NFTs in one place. -2. **Marketplace Listing:** Users can list their NFTs on various marketplaces by verifying their ownership. -3. **Collection Display:** Users can showcase their NFT collections on social media, personal websites, or within specific applications. -4. **Trading and Transfers:** Knowing the NFTs owned helps users decide which assets to trade or transfer to other users. -5. **Application Integration:** Applications can provide customized experiences based on the NFTs a user owns, such as granting access to special content or features. +- ### Portfolio Management + + - Users can manage their digital assets effectively by viewing all their NFTs in one place. + +- ### Marketplace Listing + + - Users can list their NFTs on various marketplaces by verifying their ownership. + +- ### Collection Display + + - Users can showcase their NFT collections on social media, personal websites, or within specific applications. + +- ### Trading and Transfers + + - Knowing the NFTs owned helps users decide which assets to trade or transfer to other users. + +- ### Application Integration + + - Applications can provide customized experiences based on the NFTs a user owns, such as granting access to special content or features. ## Prerequisites -1. **Install the ISC Magic Library:** + +### Install the ISC Magic Library Ensure you have the ISC Magic library installed in your project: + ```bash npm install @iota/iscmagic ``` -2. **Import the ISC Library:** +### 2. Import the ISC Library In your Solidity file, import the ISC Library: + ```solidity pragma solidity >=0.8.5; import "@iota/iscmagic/ISC.sol"; ``` + ## Implement the `getL2NFTs` Function Here’s a sample implementation to retrieve L2 NFTs owned by an account: @@ -76,4 +94,4 @@ function getOwnedNFTs(ISCAgentID memory agentID) public view returns (NFTID[] me ``` ## Conclusion -Using the `getL2NFTs` function from the `ISCAccounts` interface provides an efficient way to retrieve and manage the Layer 2 NFTs owned by an account. By integrating this functionality into your smart contracts, you can enhance user experience by enabling features such as portfolio management, marketplace listings, collection displays, and more. With this guide, you now have the foundational knowledge to implement and utilize the `getL2NFTs` function in your own projects, allowing for seamless interaction with `ISC Magic` and its associated NFTs. \ No newline at end of file +Using the `getL2NFTs` function from the `ISCAccounts` interface provides an efficient way to retrieve and manage the Layer 2 NFTs owned by an account. By integrating this functionality into your smart contracts, you can enhance user experience by enabling features such as [portfolio management](#portfolio-management), [marketplace listings](#marketplace-listing), [collection displays](#collection-display), and more. With this guide, you have the foundational knowledge to implement and utilize the `getL2NFTs` function in your projects, allowing for seamless interaction with `ISC Magic` and its associated NFTs. \ No newline at end of file From 65237fbb1c55cf3f2c3f46e056014da8e18ff54e Mon Sep 17 00:00:00 2001 From: Gino Date: Wed, 26 Jun 2024 10:54:59 +0100 Subject: [PATCH 4/8] feat(iota-wiki): use solidity version 0.8.24 --- .../isc/v1.1/docs/how-tos/core-contracts/nft/get-L2-nfts.mdx | 4 ++-- .../isc/v1.3/docs/how-tos/core-contracts/nft/get-L2-nfts.mdx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/build/isc/v1.1/docs/how-tos/core-contracts/nft/get-L2-nfts.mdx b/docs/build/isc/v1.1/docs/how-tos/core-contracts/nft/get-L2-nfts.mdx index 1951ac3b7da..51df250e822 100644 --- a/docs/build/isc/v1.1/docs/how-tos/core-contracts/nft/get-L2-nfts.mdx +++ b/docs/build/isc/v1.1/docs/how-tos/core-contracts/nft/get-L2-nfts.mdx @@ -58,7 +58,7 @@ Retrieving the NFTs owned by a user can serve several purposes: In your Solidity file, import the ISC Library: ```solidity - pragma solidity >=0.8.5; + pragma solidity >=0.8.24; import "@iota/iscmagic/ISC.sol"; ``` @@ -79,7 +79,7 @@ function getOwnedNFTs(ISCAgentID memory agentID) public view returns (NFTID[] me ```solidity // SPDX-License-Identifier: MIT -pragma solidity >=0.8.5; +pragma solidity >=0.8.24; import "@iota/iscmagic/ISC.sol"; diff --git a/docs/build/isc/v1.3/docs/how-tos/core-contracts/nft/get-L2-nfts.mdx b/docs/build/isc/v1.3/docs/how-tos/core-contracts/nft/get-L2-nfts.mdx index 1951ac3b7da..51df250e822 100644 --- a/docs/build/isc/v1.3/docs/how-tos/core-contracts/nft/get-L2-nfts.mdx +++ b/docs/build/isc/v1.3/docs/how-tos/core-contracts/nft/get-L2-nfts.mdx @@ -58,7 +58,7 @@ Retrieving the NFTs owned by a user can serve several purposes: In your Solidity file, import the ISC Library: ```solidity - pragma solidity >=0.8.5; + pragma solidity >=0.8.24; import "@iota/iscmagic/ISC.sol"; ``` @@ -79,7 +79,7 @@ function getOwnedNFTs(ISCAgentID memory agentID) public view returns (NFTID[] me ```solidity // SPDX-License-Identifier: MIT -pragma solidity >=0.8.5; +pragma solidity >=0.8.24; import "@iota/iscmagic/ISC.sol"; From 535d0d13f834d4b3aa0f3c0a415e91acef542e80 Mon Sep 17 00:00:00 2001 From: Gino Date: Fri, 28 Jun 2024 10:34:26 +0100 Subject: [PATCH 5/8] feat(wiki): fix numbering mistake --- .../isc/v1.1/docs/how-tos/core-contracts/nft/get-L2-nfts.mdx | 2 +- .../isc/v1.3/docs/how-tos/core-contracts/nft/get-L2-nfts.mdx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/build/isc/v1.1/docs/how-tos/core-contracts/nft/get-L2-nfts.mdx b/docs/build/isc/v1.1/docs/how-tos/core-contracts/nft/get-L2-nfts.mdx index 51df250e822..8b66402fa55 100644 --- a/docs/build/isc/v1.1/docs/how-tos/core-contracts/nft/get-L2-nfts.mdx +++ b/docs/build/isc/v1.1/docs/how-tos/core-contracts/nft/get-L2-nfts.mdx @@ -45,7 +45,7 @@ Retrieving the NFTs owned by a user can serve several purposes: ## Prerequisites -### Install the ISC Magic Library +### 1. Install the ISC Magic Library Ensure you have the ISC Magic library installed in your project: diff --git a/docs/build/isc/v1.3/docs/how-tos/core-contracts/nft/get-L2-nfts.mdx b/docs/build/isc/v1.3/docs/how-tos/core-contracts/nft/get-L2-nfts.mdx index 51df250e822..8b66402fa55 100644 --- a/docs/build/isc/v1.3/docs/how-tos/core-contracts/nft/get-L2-nfts.mdx +++ b/docs/build/isc/v1.3/docs/how-tos/core-contracts/nft/get-L2-nfts.mdx @@ -45,7 +45,7 @@ Retrieving the NFTs owned by a user can serve several purposes: ## Prerequisites -### Install the ISC Magic Library +### 1. Install the ISC Magic Library Ensure you have the ISC Magic library installed in your project: From 00bb64ae4fc5ee00a9426159456b4636fadfd8f0 Mon Sep 17 00:00:00 2001 From: Gino Date: Fri, 5 Jul 2024 11:26:12 +0100 Subject: [PATCH 6/8] feat(wiki): implement review suggestions --- .../isc/v1.1/docs/_admonitions/_AgentID.md | 3 + .../core-contracts/nft/get-L2-nfts.mdx | 58 +++---------------- .../isc/v1.3/docs/_admonitions/_AgentID.md | 3 + .../core-contracts/nft/get-L2-nfts.mdx | 58 +++---------------- 4 files changed, 20 insertions(+), 102 deletions(-) create mode 100644 docs/build/isc/v1.1/docs/_admonitions/_AgentID.md create mode 100644 docs/build/isc/v1.3/docs/_admonitions/_AgentID.md diff --git a/docs/build/isc/v1.1/docs/_admonitions/_AgentID.md b/docs/build/isc/v1.1/docs/_admonitions/_AgentID.md new file mode 100644 index 00000000000..ac7ffb8ffe7 --- /dev/null +++ b/docs/build/isc/v1.1/docs/_admonitions/_AgentID.md @@ -0,0 +1,3 @@ +:::Info ISC Agent ID +The `ISCAgentID` represents the identifier of the agent (user or contract) whose NFTs you want to retrieve. You can get the [`AgentID`](../../../explanations/how-accounts-work.md) from the sender by calling `ISC.sandbox.getSenderAccount()`. +::: \ No newline at end of file diff --git a/docs/build/isc/v1.1/docs/how-tos/core-contracts/nft/get-L2-nfts.mdx b/docs/build/isc/v1.1/docs/how-tos/core-contracts/nft/get-L2-nfts.mdx index 8b66402fa55..1ad194eed48 100644 --- a/docs/build/isc/v1.1/docs/how-tos/core-contracts/nft/get-L2-nfts.mdx +++ b/docs/build/isc/v1.1/docs/how-tos/core-contracts/nft/get-L2-nfts.mdx @@ -8,60 +8,19 @@ tags: - L2 NFTs --- import GetNftMetadata from '../../../_partials/how-tos/token/_get-nft-metadata.md'; +import ISCAgentID from '../../../_admonitions/_AgentID.md'; # Get NFTs Owned by an Account -This guide will show you how to get the L2 NFTs owned by an account using the [`ISCAccounts.getL2NFTs`](../../../reference/magic-contract/ISCAccounts.md#getl2nfts) function from the [`ISCAccounts.getL2NFTs`](../../../reference/magic-contract/ISCAccounts.md) [magic contract](../../../reference/magic-contract/introduction.md). - - +This guide will show you how to get the L2 NFTs owned by an account using the [`ISCAccounts.getL2NFTs`](../../../reference/magic-contract/ISCAccounts.md#getl2nfts) function from the [`ISCAccounts`](../../../reference/magic-contract/ISCAccounts.md) [magic contract](../../../reference/magic-contract/introduction.md). + ## Understanding the `getL2NFTs` Function -The `getL2NFTs` function is a view function provided by the `ISCAccounts` interface. It takes an `ISCAgentID` as an argument and returns an array of `NFTID` objects. This function allows users to query and retrieve the list of L2 NFTs owned by a specified agent. The `ISCAgentID` represents the identifier of the agent (user or contract) whose NFTs you want to retrieve. The returned array contains the identifiers of the NFTs, which can then be used to fetch more details about each NFT if needed. - -## Why Would a User Need to Retrieve Owned NFTs? - -Retrieving the NFTs owned by a user can serve several purposes: - -- ### Portfolio Management - - - Users can manage their digital assets effectively by viewing all their NFTs in one place. - -- ### Marketplace Listing - - - Users can list their NFTs on various marketplaces by verifying their ownership. - -- ### Collection Display - - - Users can showcase their NFT collections on social media, personal websites, or within specific applications. - -- ### Trading and Transfers - - - Knowing the NFTs owned helps users decide which assets to trade or transfer to other users. +The `getL2NFTs` function is a view function provided by the `ISCAccounts` interface. It takes an `ISCAgentID` as an argument and returns an array of `NFTID` objects. This function allows users to query and retrieve the list of L2 NFTs owned by a specified agent. + -- ### Application Integration - - - Applications can provide customized experiences based on the NFTs a user owns, such as granting access to special content or features. - -## Prerequisites - -### 1. Install the ISC Magic Library - - Ensure you have the ISC Magic library installed in your project: - - ```bash - npm install @iota/iscmagic - ``` - -### 2. Import the ISC Library - - In your Solidity file, import the ISC Library: - - ```solidity - pragma solidity >=0.8.24; - - import "@iota/iscmagic/ISC.sol"; - ``` +The returned array contains the identifiers of the NFTs, which can then be used to fetch more details about each NFT if needed. ## Implement the `getL2NFTs` Function @@ -91,7 +50,4 @@ function getOwnedNFTs(ISCAgentID memory agentID) public view returns (NFTID[] me return ownedNFTs; } } -``` -## Conclusion - -Using the `getL2NFTs` function from the `ISCAccounts` interface provides an efficient way to retrieve and manage the Layer 2 NFTs owned by an account. By integrating this functionality into your smart contracts, you can enhance user experience by enabling features such as [portfolio management](#portfolio-management), [marketplace listings](#marketplace-listing), [collection displays](#collection-display), and more. With this guide, you have the foundational knowledge to implement and utilize the `getL2NFTs` function in your projects, allowing for seamless interaction with `ISC Magic` and its associated NFTs. \ No newline at end of file +``` \ No newline at end of file diff --git a/docs/build/isc/v1.3/docs/_admonitions/_AgentID.md b/docs/build/isc/v1.3/docs/_admonitions/_AgentID.md new file mode 100644 index 00000000000..5ef57ce6934 --- /dev/null +++ b/docs/build/isc/v1.3/docs/_admonitions/_AgentID.md @@ -0,0 +1,3 @@ +:::info ISC Agent ID +The `ISCAgentID` represents the identifier of the agent (user or contract) whose NFTs you want to retrieve. You can get the [`AgentID`](../../../explanations/how-accounts-work.md) from the sender by calling `ISC.sandbox.getSenderAccount()`. +::: \ No newline at end of file diff --git a/docs/build/isc/v1.3/docs/how-tos/core-contracts/nft/get-L2-nfts.mdx b/docs/build/isc/v1.3/docs/how-tos/core-contracts/nft/get-L2-nfts.mdx index 8b66402fa55..1ad194eed48 100644 --- a/docs/build/isc/v1.3/docs/how-tos/core-contracts/nft/get-L2-nfts.mdx +++ b/docs/build/isc/v1.3/docs/how-tos/core-contracts/nft/get-L2-nfts.mdx @@ -8,60 +8,19 @@ tags: - L2 NFTs --- import GetNftMetadata from '../../../_partials/how-tos/token/_get-nft-metadata.md'; +import ISCAgentID from '../../../_admonitions/_AgentID.md'; # Get NFTs Owned by an Account -This guide will show you how to get the L2 NFTs owned by an account using the [`ISCAccounts.getL2NFTs`](../../../reference/magic-contract/ISCAccounts.md#getl2nfts) function from the [`ISCAccounts.getL2NFTs`](../../../reference/magic-contract/ISCAccounts.md) [magic contract](../../../reference/magic-contract/introduction.md). - - +This guide will show you how to get the L2 NFTs owned by an account using the [`ISCAccounts.getL2NFTs`](../../../reference/magic-contract/ISCAccounts.md#getl2nfts) function from the [`ISCAccounts`](../../../reference/magic-contract/ISCAccounts.md) [magic contract](../../../reference/magic-contract/introduction.md). + ## Understanding the `getL2NFTs` Function -The `getL2NFTs` function is a view function provided by the `ISCAccounts` interface. It takes an `ISCAgentID` as an argument and returns an array of `NFTID` objects. This function allows users to query and retrieve the list of L2 NFTs owned by a specified agent. The `ISCAgentID` represents the identifier of the agent (user or contract) whose NFTs you want to retrieve. The returned array contains the identifiers of the NFTs, which can then be used to fetch more details about each NFT if needed. - -## Why Would a User Need to Retrieve Owned NFTs? - -Retrieving the NFTs owned by a user can serve several purposes: - -- ### Portfolio Management - - - Users can manage their digital assets effectively by viewing all their NFTs in one place. - -- ### Marketplace Listing - - - Users can list their NFTs on various marketplaces by verifying their ownership. - -- ### Collection Display - - - Users can showcase their NFT collections on social media, personal websites, or within specific applications. - -- ### Trading and Transfers - - - Knowing the NFTs owned helps users decide which assets to trade or transfer to other users. +The `getL2NFTs` function is a view function provided by the `ISCAccounts` interface. It takes an `ISCAgentID` as an argument and returns an array of `NFTID` objects. This function allows users to query and retrieve the list of L2 NFTs owned by a specified agent. + -- ### Application Integration - - - Applications can provide customized experiences based on the NFTs a user owns, such as granting access to special content or features. - -## Prerequisites - -### 1. Install the ISC Magic Library - - Ensure you have the ISC Magic library installed in your project: - - ```bash - npm install @iota/iscmagic - ``` - -### 2. Import the ISC Library - - In your Solidity file, import the ISC Library: - - ```solidity - pragma solidity >=0.8.24; - - import "@iota/iscmagic/ISC.sol"; - ``` +The returned array contains the identifiers of the NFTs, which can then be used to fetch more details about each NFT if needed. ## Implement the `getL2NFTs` Function @@ -91,7 +50,4 @@ function getOwnedNFTs(ISCAgentID memory agentID) public view returns (NFTID[] me return ownedNFTs; } } -``` -## Conclusion - -Using the `getL2NFTs` function from the `ISCAccounts` interface provides an efficient way to retrieve and manage the Layer 2 NFTs owned by an account. By integrating this functionality into your smart contracts, you can enhance user experience by enabling features such as [portfolio management](#portfolio-management), [marketplace listings](#marketplace-listing), [collection displays](#collection-display), and more. With this guide, you have the foundational knowledge to implement and utilize the `getL2NFTs` function in your projects, allowing for seamless interaction with `ISC Magic` and its associated NFTs. \ No newline at end of file +``` \ No newline at end of file From 3a2a86aab17dfe63a8cd5de0bd235d71a76bd8e5 Mon Sep 17 00:00:00 2001 From: Gino Date: Fri, 5 Jul 2024 11:56:30 +0100 Subject: [PATCH 7/8] feat(wiki): fix admonition --- docs/build/isc/v1.1/docs/_admonitions/_AgentID.md | 2 +- docs/build/isc/v1.3/docs/_admonitions/_AgentID.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/build/isc/v1.1/docs/_admonitions/_AgentID.md b/docs/build/isc/v1.1/docs/_admonitions/_AgentID.md index ac7ffb8ffe7..7251622e68d 100644 --- a/docs/build/isc/v1.1/docs/_admonitions/_AgentID.md +++ b/docs/build/isc/v1.1/docs/_admonitions/_AgentID.md @@ -1,3 +1,3 @@ :::Info ISC Agent ID -The `ISCAgentID` represents the identifier of the agent (user or contract) whose NFTs you want to retrieve. You can get the [`AgentID`](../../../explanations/how-accounts-work.md) from the sender by calling `ISC.sandbox.getSenderAccount()`. +The `ISCAgentID` represents the identifier of the agent (user or contract) whose NFTs you want to retrieve. You can get the [`AgentID`](../explanations/how-accounts-work.md) from the sender by calling `ISC.sandbox.getSenderAccount()`. ::: \ No newline at end of file diff --git a/docs/build/isc/v1.3/docs/_admonitions/_AgentID.md b/docs/build/isc/v1.3/docs/_admonitions/_AgentID.md index 5ef57ce6934..fe3e762aa9e 100644 --- a/docs/build/isc/v1.3/docs/_admonitions/_AgentID.md +++ b/docs/build/isc/v1.3/docs/_admonitions/_AgentID.md @@ -1,3 +1,3 @@ :::info ISC Agent ID -The `ISCAgentID` represents the identifier of the agent (user or contract) whose NFTs you want to retrieve. You can get the [`AgentID`](../../../explanations/how-accounts-work.md) from the sender by calling `ISC.sandbox.getSenderAccount()`. +The `ISCAgentID` represents the identifier of the agent (user or contract) whose NFTs you want to retrieve. You can get the [`AgentID`](../explanations/how-accounts-work.md) from the sender by calling `ISC.sandbox.getSenderAccount()`. ::: \ No newline at end of file From 640d00cfb721c63717906eec95aacdec523c388a Mon Sep 17 00:00:00 2001 From: Dr-Electron Date: Fri, 5 Jul 2024 22:15:53 +0200 Subject: [PATCH 8/8] Apply suggestions from code review --- docs/build/isc/v1.1/docs/_admonitions/_AgentID.md | 4 +++- docs/build/isc/v1.3/docs/_admonitions/_AgentID.md | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/build/isc/v1.1/docs/_admonitions/_AgentID.md b/docs/build/isc/v1.1/docs/_admonitions/_AgentID.md index 7251622e68d..b3cfe6421fd 100644 --- a/docs/build/isc/v1.1/docs/_admonitions/_AgentID.md +++ b/docs/build/isc/v1.1/docs/_admonitions/_AgentID.md @@ -1,3 +1,5 @@ -:::Info ISC Agent ID +:::info ISC Agent ID + The `ISCAgentID` represents the identifier of the agent (user or contract) whose NFTs you want to retrieve. You can get the [`AgentID`](../explanations/how-accounts-work.md) from the sender by calling `ISC.sandbox.getSenderAccount()`. + ::: \ No newline at end of file diff --git a/docs/build/isc/v1.3/docs/_admonitions/_AgentID.md b/docs/build/isc/v1.3/docs/_admonitions/_AgentID.md index fe3e762aa9e..b3cfe6421fd 100644 --- a/docs/build/isc/v1.3/docs/_admonitions/_AgentID.md +++ b/docs/build/isc/v1.3/docs/_admonitions/_AgentID.md @@ -1,3 +1,5 @@ :::info ISC Agent ID + The `ISCAgentID` represents the identifier of the agent (user or contract) whose NFTs you want to retrieve. You can get the [`AgentID`](../explanations/how-accounts-work.md) from the sender by calling `ISC.sandbox.getSenderAccount()`. + ::: \ No newline at end of file