Skip to content

Commit

Permalink
chore(docs): Adjust line numbers of example code snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
nonast committed Nov 8, 2024
1 parent b3da0fb commit 1e1c0db
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ For this example, we use an `AliasOutput` to extract an `Alias` object that owns
<Tabs groupId="language">
<TabItem value="typescript" label="TypeScript">

```typescript file=<rootDir>/docs/examples/typescript/src/stardust/address-unlock-condition.ts#L44-L50
```typescript file=<rootDir>/docs/examples/typescript/src/stardust/address-unlock-condition.ts#L38-L44
```
</TabItem>
<TabItem value="rust" label="Rust">
Expand All @@ -39,7 +39,7 @@ For this example, we use an `AliasOutput` to extract an `Alias` object that owns

<Tabs groupId="language">
<TabItem value="typescript" label="TypeScript">
```typescript file=<rootDir>/docs/examples/typescript/src/stardust/address-unlock-condition.ts#L53-L70
```typescript file=<rootDir>/docs/examples/typescript/src/stardust/address-unlock-condition.ts#L46-L64
```


Expand All @@ -56,7 +56,7 @@ For this example, we use an `AliasOutput` to extract an `Alias` object that owns

<Tabs groupId="language">
<TabItem value="typescript" label="TypeScript">
```typescript file=<rootDir>/docs/examples/typescript/src/stardust/address-unlock-condition.ts#L77-L95
```typescript file=<rootDir>/docs/examples/typescript/src/stardust/address-unlock-condition.ts#L66-L84
```
</TabItem>
<TabItem value="rust" label="Rust">
Expand All @@ -71,7 +71,7 @@ For this example, we use an `AliasOutput` to extract an `Alias` object that owns

<Tabs groupId="language">
<TabItem value="typescript" label="TypeScript">
```typescript file=<rootDir>/docs/examples/typescript/src/stardust/address-unlock-condition.ts#L97-L166
```typescript file=<rootDir>/docs/examples/typescript/src/stardust/address-unlock-condition.ts#L86-L166
```
</TabItem>
<TabItem value="rust" label="Rust">
Expand Down
8 changes: 4 additions & 4 deletions docs/content/developer/stardust/claiming/alias.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ The first step is to fetch the `AliasOutput` object that needs to be claimed.
<Tabs groupId="language">
<TabItem value="typescript" label="TypeScript">

```typescript file=<rootDir>/docs/examples/typescript/src/stardust/alias-output-claim.ts#L24-L30
```typescript file=<rootDir>/docs/examples/typescript/src/stardust/alias-output-claim.ts#L24-L38
```

</TabItem>
Expand All @@ -45,7 +45,7 @@ Next, check the native tokens that might be held by this output. A [`Bag`](../..
<Tabs groupId="language">
<TabItem value="typescript" label="TypeScript">

```typescript file=<rootDir>/docs/examples/typescript/src/stardust/alias-output-claim.ts#L31-L60
```typescript file=<rootDir>/docs/examples/typescript/src/stardust/alias-output-claim.ts#L43-L62
```

</TabItem>
Expand All @@ -66,7 +66,7 @@ The main purpose of claiming is to extract the `Alias` object from the `AliasOut

<Tabs groupId="language">
<TabItem value="typescript" label="TypeScript">
```typescript file=<rootDir>/docs/examples/typescript/src/stardust/alias-output-claim.ts#L62-L110
```typescript file=<rootDir>/docs/examples/typescript/src/stardust/alias-output-claim.ts#L64-L117
```
</TabItem>
<TabItem value="rust" label="Rust">
Expand Down Expand Up @@ -108,7 +108,7 @@ Once the package is prepared, you can extract and use a Stardust `Alias` in a si

<Tabs groupId="language">
<TabItem value="typescript" label="TypeScript">
```typescript file=<rootDir>/docs/examples/typescript/src/stardust/alias-migration.ts#L75-L170
```typescript file=<rootDir>/docs/examples/typescript/src/stardust/alias-migration.ts#L72-L168
```
</TabItem>
<TabItem value="rust" label="Rust">
Expand Down
8 changes: 4 additions & 4 deletions docs/content/developer/stardust/claiming/basic.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ To begin, you need to determine if your `BasicOutput` can be unlocked. You can a
<Tabs groupId="language">
<TabItem value="typescript" label="TypeScript">

```typescript file=<rootDir>/docs/examples/typescript/src/stardust/check-basic-output-unlock-conditions.ts#L17-L47
```typescript file=<rootDir>/docs/examples/typescript/src/stardust/check-basic-output-unlock-conditions.ts#L17-L49
```

</TabItem>
Expand All @@ -46,7 +46,7 @@ The first step is to fetch the `BasicOutput` object that you intend to claim.
<Tabs groupId="language">
<TabItem value="typescript" label="TypeScript">

```typescript file=<rootDir>/docs/examples/typescript/src/stardust/basic-output-claim.ts#L25-L30
```typescript file=<rootDir>/docs/examples/typescript/src/stardust/basic-output-claim.ts#L25-L42
```

</TabItem>
Expand All @@ -70,7 +70,7 @@ these keys are strings representing the [`OTW`](../../iota-101/move-overview/one
<Tabs groupId="language">
<TabItem value="typescript" label="TypeScript">

```typescript file=<rootDir>/docs/examples/typescript/src/stardust/basic-output-claim.ts#L38-L61
```typescript file=<rootDir>/docs/examples/typescript/src/stardust/basic-output-claim.ts#L47-L66
```

</TabItem>
Expand All @@ -90,7 +90,7 @@ along with the `Bag` keys to iterate over the extracted native tokens.
<Tabs groupId="language">
<TabItem value="typescript" label="TypeScript">

```typescript file=<rootDir>/docs/examples/typescript/src/stardust/basic-output-claim.ts#L63-L105
```typescript file=<rootDir>/docs/examples/typescript/src/stardust/basic-output-claim.ts#L68-L118
```

</TabItem>
Expand Down
10 changes: 5 additions & 5 deletions docs/content/developer/stardust/claiming/foundry.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ The first step is to retrieve the `AliasOutput` object that you intend to claim.
<Tabs groupId="language">
<TabItem value="typescript" label="TypeScript">

```typescript file=<rootDir>/docs/examples/typescript/src/stardust/foundry-output-claim.ts#L33-L38
```typescript file=<rootDir>/docs/examples/typescript/src/stardust/foundry-output-claim.ts#L33-L39
```

</TabItem>
Expand All @@ -38,7 +38,7 @@ Next, use the dynamic field function with the "alias" dynamic field key filter t
<Tabs groupId="language">
<TabItem value="typescript" label="TypeScript">

```typescript file=<rootDir>/docs/examples/typescript/src/stardust/foundry-output-claim.ts#L40-L58
```typescript file=<rootDir>/docs/examples/typescript/src/stardust/foundry-output-claim.ts#L41-L59
```

</TabItem>
Expand All @@ -57,7 +57,7 @@ The `Alias` object may own various other objects (for more details, refer to the
<Tabs groupId="language">
<TabItem value="typescript" label="TypeScript">

```typescript file=<rootDir>/docs/examples/typescript/src/stardust/foundry-output-claim.ts#L60-L86
```typescript file=<rootDir>/docs/examples/typescript/src/stardust/foundry-output-claim.ts#L61-L86
```

</TabItem>
Expand All @@ -76,7 +76,7 @@ Since each native token is tied to its own package, a Foundry's native token has
<Tabs groupId="language">
<TabItem value="typescript" label="TypeScript">

```typescript file=<rootDir>/docs/examples/typescript/src/stardust/foundry-output-claim.ts#L87-L88
```typescript file=<rootDir>/docs/examples/typescript/src/stardust/foundry-output-claim.ts#L88-L91
```

</TabItem>
Expand All @@ -95,7 +95,7 @@ Finally, you should create a Programmable Transaction Block (PTB) that claims th
<Tabs groupId="language">
<TabItem value="typescript" label="TypeScript">

```typescript file=<rootDir>/docs/examples/typescript/src/stardust/foundry-output-claim.ts#L90-L132
```typescript file=<rootDir>/docs/examples/typescript/src/stardust/foundry-output-claim.ts#L93-L143
```
</TabItem>
<TabItem value="rust" label="Rust">
Expand Down
8 changes: 4 additions & 4 deletions docs/content/developer/stardust/claiming/nft.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ The first step in claiming your NFT is to retrieve the `NftOutput` object that y
<Tabs groupId="language">
<TabItem value="typescript" label="TypeScript">

```typescript file=<rootDir>/docs/examples/typescript/src/stardust/nft-output-claim.ts#L24-L35
```typescript file=<rootDir>/docs/examples/typescript/src/stardust/nft-output-claim.ts#L24-L44
```

</TabItem>
Expand All @@ -51,7 +51,7 @@ representing the [`OTW`](../../iota-101/move-overview/one-time-witness.mdx) used
<Tabs groupId="language">
<TabItem value="typescript" label="TypeScript">

```typescript file=<rootDir>/docs/examples/typescript/src/stardust/nft-output-claim.ts#L37-L64
```typescript file=<rootDir>/docs/examples/typescript/src/stardust/nft-output-claim.ts#L46-L66
```

</TabItem>
Expand All @@ -73,7 +73,7 @@ The primary goal of this process is to extract the `Nft` object from the `NftOut
<Tabs groupId="language">
<TabItem value="typescript" label="TypeScript">

```typescript file=<rootDir>/docs/examples/typescript/src/stardust/nft-output-claim.ts#L66-L113
```typescript file=<rootDir>/docs/examples/typescript/src/stardust/nft-output-claim.ts#L68-L120
```

</TabItem>
Expand Down Expand Up @@ -114,7 +114,7 @@ This method uses the metadata from the Stardust `Nft` to mint a new NFT.
<Tabs groupId="language">
<TabItem value="typescript" label="TypeScript">

```typescript file=<rootDir>/docs/examples/typescript/src/stardust/nft-migration.ts#L38-L83
```typescript file=<rootDir>/docs/examples/typescript/src/stardust/nft-migration.ts#L39-L85
```

</TabItem>
Expand Down
6 changes: 3 additions & 3 deletions docs/content/developer/stardust/claiming/self-sponsor.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Use the IOTA `coin_type` to derive the sponsor and sender addresses.
<Tabs groupId="language">
<TabItem value="typescript" label="TypeScript">

```typescript file=<rootDir>/docs/examples/typescript/src/stardust/iota-self-sponsor.ts#L19-L24
```typescript file=<rootDir>/docs/examples/typescript/src/stardust/iota-self-sponsor.ts#L19-L23
```

</TabItem>
Expand All @@ -43,7 +43,7 @@ This process is similar to the one outlined in the [Basic Output](basic.mdx) gui
<Tabs groupId="language">
<TabItem value="typescript" label="TypeScript">

```typescript file=<rootDir>/docs/examples/typescript/src/stardust/iota-self-sponsor.ts#L41-L71
```typescript file=<rootDir>/docs/examples/typescript/src/stardust/iota-self-sponsor.ts#L45-L79
```

</TabItem>
Expand All @@ -62,7 +62,7 @@ For this transaction, both the sender address (the object's owner) and the spons
<Tabs groupId="language">
<TabItem value="typescript" label="TypeScript">

```typescript file=<rootDir>/docs/examples/typescript/src/stardust/iota-self-sponsor.ts#L73-L104
```typescript file=<rootDir>/docs/examples/typescript/src/stardust/iota-self-sponsor.ts#L81-L112
```

</TabItem>
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/rust/stardust/iota-self-sponsor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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] || "";

Expand Down

0 comments on commit 1e1c0db

Please sign in to comment.