From 1e1c0db072d5de0f125b4de3382909a54b22667e Mon Sep 17 00:00:00 2001 From: nonast <29281463+nonast@users.noreply.github.com> Date: Fri, 8 Nov 2024 13:29:04 +0800 Subject: [PATCH] chore(docs): Adjust line numbers of example code snippets --- .../stardust/claiming/address-unlock-condition.mdx | 8 ++++---- docs/content/developer/stardust/claiming/alias.mdx | 8 ++++---- docs/content/developer/stardust/claiming/basic.mdx | 8 ++++---- docs/content/developer/stardust/claiming/foundry.mdx | 10 +++++----- docs/content/developer/stardust/claiming/nft.mdx | 8 ++++---- .../developer/stardust/claiming/self-sponsor.mdx | 6 +++--- docs/examples/rust/stardust/iota-self-sponsor.rs | 4 ++-- .../typescript/src/stardust/foundry-output-claim.ts | 3 ++- 8 files changed, 28 insertions(+), 27 deletions(-) diff --git a/docs/content/developer/stardust/claiming/address-unlock-condition.mdx b/docs/content/developer/stardust/claiming/address-unlock-condition.mdx index 34dc3d81a32..a4319e0a32d 100644 --- a/docs/content/developer/stardust/claiming/address-unlock-condition.mdx +++ b/docs/content/developer/stardust/claiming/address-unlock-condition.mdx @@ -24,7 +24,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#L44-L50 +```typescript file=/docs/examples/typescript/src/stardust/address-unlock-condition.ts#L38-L44 ``` @@ -39,7 +39,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#L53-L70 +```typescript file=/docs/examples/typescript/src/stardust/address-unlock-condition.ts#L46-L64 ``` @@ -56,7 +56,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#L77-L95 +```typescript file=/docs/examples/typescript/src/stardust/address-unlock-condition.ts#L66-L84 ``` @@ -71,7 +71,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 +```typescript file=/docs/examples/typescript/src/stardust/address-unlock-condition.ts#L86-L166 ``` diff --git a/docs/content/developer/stardust/claiming/alias.mdx b/docs/content/developer/stardust/claiming/alias.mdx index 7bb4ef4ee41..6145a9e8968 100644 --- a/docs/content/developer/stardust/claiming/alias.mdx +++ b/docs/content/developer/stardust/claiming/alias.mdx @@ -25,7 +25,7 @@ The first step is to fetch the `AliasOutput` object that needs to be claimed. -```typescript file=/docs/examples/typescript/src/stardust/alias-output-claim.ts#L24-L30 +```typescript file=/docs/examples/typescript/src/stardust/alias-output-claim.ts#L24-L38 ``` @@ -45,7 +45,7 @@ Next, check the native tokens that might be held by this output. A [`Bag`](../.. -```typescript file=/docs/examples/typescript/src/stardust/alias-output-claim.ts#L31-L60 +```typescript file=/docs/examples/typescript/src/stardust/alias-output-claim.ts#L43-L62 ``` @@ -66,7 +66,7 @@ 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 +```typescript file=/docs/examples/typescript/src/stardust/alias-output-claim.ts#L64-L117 ``` @@ -108,7 +108,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 +```typescript file=/docs/examples/typescript/src/stardust/alias-migration.ts#L72-L168 ``` diff --git a/docs/content/developer/stardust/claiming/basic.mdx b/docs/content/developer/stardust/claiming/basic.mdx index ce7c950a659..c4eeb572990 100644 --- a/docs/content/developer/stardust/claiming/basic.mdx +++ b/docs/content/developer/stardust/claiming/basic.mdx @@ -23,7 +23,7 @@ To begin, you need to determine if your `BasicOutput` can be unlocked. You can a -```typescript file=/docs/examples/typescript/src/stardust/check-basic-output-unlock-conditions.ts#L17-L47 +```typescript file=/docs/examples/typescript/src/stardust/check-basic-output-unlock-conditions.ts#L17-L49 ``` @@ -46,7 +46,7 @@ The first step is to fetch the `BasicOutput` object that you intend to claim. -```typescript file=/docs/examples/typescript/src/stardust/basic-output-claim.ts#L25-L30 +```typescript file=/docs/examples/typescript/src/stardust/basic-output-claim.ts#L25-L42 ``` @@ -70,7 +70,7 @@ these keys are strings representing the [`OTW`](../../iota-101/move-overview/one -```typescript file=/docs/examples/typescript/src/stardust/basic-output-claim.ts#L38-L61 +```typescript file=/docs/examples/typescript/src/stardust/basic-output-claim.ts#L47-L66 ``` @@ -90,7 +90,7 @@ along with the `Bag` keys to iterate over the extracted native tokens. -```typescript file=/docs/examples/typescript/src/stardust/basic-output-claim.ts#L63-L105 +```typescript file=/docs/examples/typescript/src/stardust/basic-output-claim.ts#L68-L118 ``` diff --git a/docs/content/developer/stardust/claiming/foundry.mdx b/docs/content/developer/stardust/claiming/foundry.mdx index 63ad14dfe92..601caef7ca7 100644 --- a/docs/content/developer/stardust/claiming/foundry.mdx +++ b/docs/content/developer/stardust/claiming/foundry.mdx @@ -19,7 +19,7 @@ The first step is to retrieve the `AliasOutput` object that you intend to claim. -```typescript file=/docs/examples/typescript/src/stardust/foundry-output-claim.ts#L33-L38 +```typescript file=/docs/examples/typescript/src/stardust/foundry-output-claim.ts#L33-L39 ``` @@ -38,7 +38,7 @@ Next, use the dynamic field function with the "alias" dynamic field key filter t -```typescript file=/docs/examples/typescript/src/stardust/foundry-output-claim.ts#L40-L58 +```typescript file=/docs/examples/typescript/src/stardust/foundry-output-claim.ts#L41-L59 ``` @@ -57,7 +57,7 @@ The `Alias` object may own various other objects (for more details, refer to the -```typescript file=/docs/examples/typescript/src/stardust/foundry-output-claim.ts#L60-L86 +```typescript file=/docs/examples/typescript/src/stardust/foundry-output-claim.ts#L61-L86 ``` @@ -76,7 +76,7 @@ Since each native token is tied to its own package, a Foundry's native token has -```typescript file=/docs/examples/typescript/src/stardust/foundry-output-claim.ts#L87-L88 +```typescript file=/docs/examples/typescript/src/stardust/foundry-output-claim.ts#L88-L91 ``` @@ -95,7 +95,7 @@ Finally, you should create a Programmable Transaction Block (PTB) that claims th -```typescript file=/docs/examples/typescript/src/stardust/foundry-output-claim.ts#L90-L132 +```typescript file=/docs/examples/typescript/src/stardust/foundry-output-claim.ts#L93-L143 ``` diff --git a/docs/content/developer/stardust/claiming/nft.mdx b/docs/content/developer/stardust/claiming/nft.mdx index c09f8959de0..c71927bc4b9 100644 --- a/docs/content/developer/stardust/claiming/nft.mdx +++ b/docs/content/developer/stardust/claiming/nft.mdx @@ -26,7 +26,7 @@ The first step in claiming your NFT is to retrieve the `NftOutput` object that y -```typescript file=/docs/examples/typescript/src/stardust/nft-output-claim.ts#L24-L35 +```typescript file=/docs/examples/typescript/src/stardust/nft-output-claim.ts#L24-L44 ``` @@ -51,7 +51,7 @@ representing the [`OTW`](../../iota-101/move-overview/one-time-witness.mdx) used -```typescript file=/docs/examples/typescript/src/stardust/nft-output-claim.ts#L37-L64 +```typescript file=/docs/examples/typescript/src/stardust/nft-output-claim.ts#L46-L66 ``` @@ -73,7 +73,7 @@ The primary goal of this process is to extract the `Nft` object from the `NftOut -```typescript file=/docs/examples/typescript/src/stardust/nft-output-claim.ts#L66-L113 +```typescript file=/docs/examples/typescript/src/stardust/nft-output-claim.ts#L68-L120 ``` @@ -114,7 +114,7 @@ This method uses the metadata from the Stardust `Nft` to mint a new NFT. -```typescript file=/docs/examples/typescript/src/stardust/nft-migration.ts#L38-L83 +```typescript file=/docs/examples/typescript/src/stardust/nft-migration.ts#L39-L85 ``` diff --git a/docs/content/developer/stardust/claiming/self-sponsor.mdx b/docs/content/developer/stardust/claiming/self-sponsor.mdx index 0f789003186..9b29c875c8b 100644 --- a/docs/content/developer/stardust/claiming/self-sponsor.mdx +++ b/docs/content/developer/stardust/claiming/self-sponsor.mdx @@ -22,7 +22,7 @@ Use the IOTA `coin_type` to derive the sponsor and sender addresses. -```typescript file=/docs/examples/typescript/src/stardust/iota-self-sponsor.ts#L19-L24 +```typescript file=/docs/examples/typescript/src/stardust/iota-self-sponsor.ts#L19-L23 ``` @@ -43,7 +43,7 @@ This process is similar to the one outlined in the [Basic Output](basic.mdx) gui -```typescript file=/docs/examples/typescript/src/stardust/iota-self-sponsor.ts#L41-L71 +```typescript file=/docs/examples/typescript/src/stardust/iota-self-sponsor.ts#L45-L79 ``` @@ -62,7 +62,7 @@ For this transaction, both the sender address (the object's owner) and the spons -```typescript file=/docs/examples/typescript/src/stardust/iota-self-sponsor.ts#L73-L104 +```typescript file=/docs/examples/typescript/src/stardust/iota-self-sponsor.ts#L81-L112 ``` diff --git a/docs/examples/rust/stardust/iota-self-sponsor.rs b/docs/examples/rust/stardust/iota-self-sponsor.rs index 981328067c7..f2acf11c92e 100644 --- a/docs/examples/rust/stardust/iota-self-sponsor.rs +++ b/docs/examples/rust/stardust/iota-self-sponsor.rs @@ -40,7 +40,7 @@ async fn main() -> Result<(), anyhow::Error> { // Setup the temporary file based keystore let mut keystore = setup_keystore()?; - // For this example we need to derive addresses that are not at different + // For this example we need to derive addresses that are at different // indexes and coin_types, one for sponsoring with IOTA coin type and one for // claiming the Basic Output with Iota coin type. let sponsor_derivation_path = @@ -83,7 +83,7 @@ async fn main() -> Result<(), anyhow::Error> { .ok_or(anyhow!("Basic output not found"))?; let basic_output_object_ref = basic_output_object.object_ref(); - // Create a PTB to for claiming the assets of a basic output for the sender + // Create a PTB to claim the assets related to the basic output. let pt = { // Init the builder let mut builder = ProgrammableTransactionBuilder::new(); diff --git a/docs/examples/typescript/src/stardust/foundry-output-claim.ts b/docs/examples/typescript/src/stardust/foundry-output-claim.ts index 356c23ac6a9..5bbcbcffe9c 100644 --- a/docs/examples/typescript/src/stardust/foundry-output-claim.ts +++ b/docs/examples/typescript/src/stardust/foundry-output-claim.ts @@ -83,9 +83,10 @@ async function main() { throw new Error("CoinManagerTreasuryCap not found"); } + const coinManagerTreasuryCapId = coinManagerTreasuryCap.objectId; + // Extract the foundry token type from the type parameters of the coin manager // treasury cap object. - const coinManagerTreasuryCapId = coinManagerTreasuryCap.objectId; const foundryTokenTypeStructTag = coinManagerTreasuryCap.type const foundryTokenType = foundryTokenTypeStructTag?.split("<")[1].split(">")[0] || "";