Skip to content

Commit

Permalink
Merge pull request #2811 from build-5/update-nft-purchase-how-tos
Browse files Browse the repository at this point in the history
Update NFT purchase example
  • Loading branch information
adamunchained authored Feb 19, 2024
2 parents 84dc93b + 0b3b1b0 commit e0e3336
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
6 changes: 4 additions & 2 deletions docs/docs/how-to/nft/purchase.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ import DeepLink from '../../_admonitions/_deep_link.md'

<Tabs>
<TabItem value="otr" label="OTR">
To purchase NFT, you must call [`purchase`](../../reference-api/classes/NftOtrDataset.md#purchase) on `dataset(Dataset.NFT)`.
To purchase an NFT, you must call [`purchase`](../../reference-api/classes/NftOtrDataset.md#purchase) on `dataset(Dataset.NFT)`.
[`purchase`](../../reference-api/classes/NftOtrDataset.md#purchase) takes an object of type [`NftPurchaseTangleRequest`](../../reference-api/interfaces/NftPurchaseTangleRequest.md) as parameter.

```tsx file=../../../../packages/sdk/examples/nft/otr/purchase.ts#L4-L27
```tsx file=../../../../packages/sdk/examples/nft/otr/purchase.ts#L12-L14
```

<DeepLink/>

If you want to track the purchase you can use the [track](../track-otrs.md) how-to.
</TabItem>
<TabItem value="https" label="HTTPS">
TODO
Expand Down
20 changes: 20 additions & 0 deletions docs/docs/how-to/track-otrs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: Track OTRs
tags:
- how-to
- track
---

Sometimes you want to track your OTR for example to check if a purchase was successful.
You can do that by using the tag of the request.

To do that call [`getTag`](../reference-api/classes/DatasetClassOtr.OtrRequest.md#gettag) on `OtrRequest`.
[`getTag`](../reference-api/classes/DatasetClassOtr.OtrRequest.md#gettag) takes a firefly deeplink as parameter.

```tsx file=../../../packages/sdk/examples/nft/otr/purchase.ts#L24
```

You can use the tag to get an observable object by calling [`trackByTag`](../reference-api/classes/ProjectWrapper#trackbytag) on `ProjectWrapper`.

```tsx file=../../../packages/sdk/examples/nft/otr/purchase.ts#L25-L27
```
1 change: 1 addition & 0 deletions docs/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ const sidebars = {
{
'Token Distribution API': ['how-to/token-distribution/overview'],
},
'how-to/track-otrs',
],
},
{
Expand Down

0 comments on commit e0e3336

Please sign in to comment.