Skip to content

Commit

Permalink
feat(iota-wiki): implement review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
Ginowine committed Jun 26, 2024
1 parent 2eed489 commit b3636a0
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 22 deletions.
40 changes: 29 additions & 11 deletions docs/build/isc/v1.1/docs/how-tos/core-contracts/nft/get-L2-nfts.mdx
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -11,40 +11,58 @@ 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).

<GetNftMetadata />

## 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?
## 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:
Expand Down Expand Up @@ -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.
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.
40 changes: 29 additions & 11 deletions docs/build/isc/v1.3/docs/how-tos/core-contracts/nft/get-L2-nfts.mdx
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -11,40 +11,58 @@ 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).

<GetNftMetadata />

## 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?
## 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:
Expand Down Expand Up @@ -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.
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.

0 comments on commit b3636a0

Please sign in to comment.