Skip to content

Commit

Permalink
docs: add nft getters
Browse files Browse the repository at this point in the history
  • Loading branch information
wkolod committed Nov 13, 2023
1 parent 51f7936 commit 9845826
Showing 1 changed file with 80 additions and 0 deletions.
80 changes: 80 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1378,6 +1378,86 @@ const nft = await akord.nft.get(nftId);
const nftUri = nft.asset.getUri(StorageType.ARWEAVE);
// After few minutes, you should be able to view your NFT on: https://viewblock.io/arweave/tx/{nftUri}
```
</details>

#### `get(nftId, options)`

- `nftId` (`string`, required)
- `options` ([`GetOptions`][get-options], optional)
- returns `Promise<NFT>` - Promise with the nft object

<details>
<summary>example</summary>

```js
const nft = await akord.nft.get(nftId);
```
</details>

#### `listAll(vaultId, options)`

- `vaultId` (`string`, required)
- `options` ([`ListOptions`][list-options], optional)
- returns `Promise<Array<NFT>>` - Promise with all nfts within given vault

<details>
<summary>example</summary>

```js
const nfts = await akord.nft.listAll(vaultId);
```
</details>

#### `list(vaultId, options)`

- `vaultId` (`string`, required)
- `options` ([`ListOptions`][list-options], optional)
- returns `Promise<{ items, nextToken }>` - Promise with paginated nfts within given vault

<details>
<summary>example</summary>

```js
// retrieve first 100 nfts for the vault
const { items } = await akord.nft.list(vaultId);

// retrieve first 20 nfts for the vault
const { items } = await akord.nft.list(vaultId, { limit: 20 });
```
</details>

#### `getAsset(nftId)`

Get nft asset

- `nftId` (`string`, required)
- returns `Promise<{ data: ArrayBuffer } & FileVersion>` - Promise with nft asset object & data buffer

<details>
<summary>example</summary>

```js
// get nft data buffer
const { data: fileBuffer } = await akord.nft.getAsset(nftId);
```
</details>

#### `getUri(nftId, type)`

Get nft asset uri

- `nftId` (`string`, required)
- `type` ([`StorageType`][storage-type], optional) - storage type, default to arweave
- returns `Promise<string>` - Promise with nft asset uri

<details>
<summary>example</summary>

```js
// get the arweave uri for the nft asset
const arweaveUri = await akord.nft.getUri(nftId);
```
</details>

### contract

Expand Down

0 comments on commit 9845826

Please sign in to comment.