From 4ddc0c4dad83b002326295e250b81ecab3291a24 Mon Sep 17 00:00:00 2001
From: nonast <29281463+nonast@users.noreply.github.com>
Date: Wed, 30 Oct 2024 22:37:07 +0800
Subject: [PATCH] feat(docs): Add typescript sdk example snippets in docs
---
.../claiming/address-unlock-condition.mdx | 11 +++++++++--
.../developer/stardust/claiming/alias.mdx | 12 ++++++++----
.../developer/stardust/claiming/basic.mdx | 12 ++++++++----
.../developer/stardust/claiming/foundry.mdx | 16 ++++++++++------
docs/content/developer/stardust/claiming/nft.mdx | 12 ++++++++----
.../developer/stardust/claiming/self-sponsor.mdx | 9 ++++++---
6 files changed, 49 insertions(+), 23 deletions(-)
diff --git a/docs/content/developer/stardust/claiming/address-unlock-condition.mdx b/docs/content/developer/stardust/claiming/address-unlock-condition.mdx
index 1512d073821..712142d8290 100644
--- a/docs/content/developer/stardust/claiming/address-unlock-condition.mdx
+++ b/docs/content/developer/stardust/claiming/address-unlock-condition.mdx
@@ -30,6 +30,8 @@ For this example, we use an `AliasOutput` to extract an `Alias` object that owns
+```typescript file=/docs/examples/typescript/src/stardust/address-unlock-condition.ts#L44-L50
+```
@@ -43,6 +45,9 @@ For this example, we use an `AliasOutput` to extract an `Alias` object that owns
+```typescript file=/docs/examples/typescript/src/stardust/address-unlock-condition.ts#L53-L70
+```
+
@@ -57,7 +62,8 @@ For this example, we use an `AliasOutput` to extract an `Alias` object that owns
-
+```typescript file=/docs/examples/typescript/src/stardust/address-unlock-condition.ts#L77-L95
+```
@@ -71,6 +77,7 @@ For this example, we use an `AliasOutput` to extract an `Alias` object that owns
-
+```typescript file=/docs/examples/typescript/src/stardust/address-unlock-condition.ts#L97-L166
+```
diff --git a/docs/content/developer/stardust/claiming/alias.mdx b/docs/content/developer/stardust/claiming/alias.mdx
index cb0fc0c4c42..df72062f901 100644
--- a/docs/content/developer/stardust/claiming/alias.mdx
+++ b/docs/content/developer/stardust/claiming/alias.mdx
@@ -31,7 +31,8 @@ The first step is to fetch the `AliasOutput` object that needs to be claimed.
-Coming soon
+```typescript file=/docs/examples/typescript/src/stardust/alias-output-claim.ts#L24-L30
+```
@@ -50,7 +51,8 @@ Next, check the native tokens that might be held by this output. A [`Bag`](../..
-Coming soon
+```typescript file=/docs/examples/typescript/src/stardust/alias-output-claim.ts#L31-L60
+```
@@ -70,7 +72,8 @@ The main purpose of claiming is to extract the `Alias` object from the `AliasOut
-
+```typescript file=/docs/examples/typescript/src/stardust/alias-output-claim.ts#L62-L110
+```
@@ -111,6 +114,7 @@ Once the package is prepared, you can extract and use a Stardust `Alias` in a si
-
+```typescript file=/docs/examples/typescript/src/stardust/alias-migration.ts#L75-L170
+```
diff --git a/docs/content/developer/stardust/claiming/basic.mdx b/docs/content/developer/stardust/claiming/basic.mdx
index fe0fc30e00c..9e57db20c6e 100644
--- a/docs/content/developer/stardust/claiming/basic.mdx
+++ b/docs/content/developer/stardust/claiming/basic.mdx
@@ -29,7 +29,8 @@ To begin, you need to determine if your `BasicOutput` can be unlocked. You can a
-Coming soon
+```typescript file=/docs/examples/typescript/src/stardust/check-basic-output-unlock-conditions.ts#L17-L47
+```
@@ -51,7 +52,8 @@ The first step is to fetch the `BasicOutput` object that you intend to claim.
-Coming soon
+```typescript file=/docs/examples/typescript/src/stardust/basic-output-claim.ts#L25-L30
+```
@@ -74,7 +76,8 @@ these keys are strings representing the [`OTW`](../../iota-101/move-overview/one
-Coming soon
+```typescript file=/docs/examples/typescript/src/stardust/basic-output-claim.ts#L38-L61
+```
@@ -93,7 +96,8 @@ along with the `Bag` keys to iterate over the extracted native tokens.
-Coming soon
+```typescript file=/docs/examples/typescript/src/stardust/basic-output-claim.ts#L63-L105
+```
\ No newline at end of file
diff --git a/docs/content/developer/stardust/claiming/foundry.mdx b/docs/content/developer/stardust/claiming/foundry.mdx
index f6b167b6f2b..165d7f6b6b6 100644
--- a/docs/content/developer/stardust/claiming/foundry.mdx
+++ b/docs/content/developer/stardust/claiming/foundry.mdx
@@ -25,7 +25,8 @@ The first step is to retrieve the `AliasOutput` object that you intend to claim.
-Coming soon
+```typescript file=/docs/examples/typescript/src/stardust/foundry-output-claim.ts#L33-L38
+```
@@ -43,7 +44,8 @@ Next, use the dynamic field function with the "alias" dynamic field key filter t
-Coming soon
+```typescript file=/docs/examples/typescript/src/stardust/foundry-output-claim.ts#L40-L58
+```
@@ -61,7 +63,8 @@ The `Alias` object may own various other objects (for more details, refer to the
-Coming soon
+```typescript file=/docs/examples/typescript/src/stardust/foundry-output-claim.ts#L60-L86
+```
@@ -79,7 +82,8 @@ Since each native token is tied to its own package, a Foundry's native token has
-Coming soon
+```typescript file=/docs/examples/typescript/src/stardust/foundry-output-claim.ts#L87-L88
+```
@@ -97,8 +101,8 @@ Finally, you should create a Programmable Transaction Block (PTB) that claims th
-Coming soon
-
+```typescript file=/docs/examples/typescript/src/stardust/foundry-output-claim.ts#L90-L132
+```
diff --git a/docs/content/developer/stardust/claiming/nft.mdx b/docs/content/developer/stardust/claiming/nft.mdx
index 57d00f9f377..934e3220298 100644
--- a/docs/content/developer/stardust/claiming/nft.mdx
+++ b/docs/content/developer/stardust/claiming/nft.mdx
@@ -32,7 +32,8 @@ The first step in claiming your NFT is to retrieve the `NftOutput` object that y
-Coming soon
+```typescript file=/docs/examples/typescript/src/stardust/nft-output-claim.ts#L24-L35
+```
@@ -56,7 +57,8 @@ representing the [`OTW`](../../iota-101/move-overview/one-time-witness.mdx) used
-Coming soon
+```typescript file=/docs/examples/typescript/src/stardust/nft-output-claim.ts#L37-L64
+```
@@ -77,7 +79,8 @@ The primary goal of this process is to extract the `Nft` object from the `NftOut
-Coming soon
+```typescript file=/docs/examples/typescript/src/stardust/nft-output-claim.ts#L66-L113
+```
@@ -117,7 +120,8 @@ This method uses the metadata from the Stardust `Nft` to mint a new NFT.
-Coming soon
+```typescript file=/docs/examples/typescript/src/stardust/nft-migration.ts#L38-L83
+```
diff --git a/docs/content/developer/stardust/claiming/self-sponsor.mdx b/docs/content/developer/stardust/claiming/self-sponsor.mdx
index 5ae531b8866..b20bee56256 100644
--- a/docs/content/developer/stardust/claiming/self-sponsor.mdx
+++ b/docs/content/developer/stardust/claiming/self-sponsor.mdx
@@ -28,7 +28,8 @@ Use the IOTA `coin_type` to derive the sponsor and sender addresses.
-Coming soon
+```typescript file=/docs/examples/typescript/src/stardust/iota-self-sponsor.ts#L19-L24
+```
@@ -48,7 +49,8 @@ This process is similar to the one outlined in the [Basic Output](basic.mdx) gui
-Coming soon
+```typescript file=/docs/examples/typescript/src/stardust/iota-self-sponsor.ts#L41-L71
+```
@@ -66,7 +68,8 @@ For this transaction, both the sender address (the object's owner) and the spons
-Coming soon
+```typescript file=/docs/examples/typescript/src/stardust/iota-self-sponsor.ts#L73-L104
+```