Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(docs/content): docs implementation for address unlock condition example #1706

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/content/developer/stardust/claiming.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Go to [Foundry Output](claiming/foundry.mdx).

### Output unlockable by an Alias/Nft Address

Go to [Output unlockable by an Alias/Nft Address](claiming/address-uc.mdx).
Go to [Output unlockable by an Alias/Nft Address](claiming/address-unlock-condition.mdx).

## Sponsoring your Shimmer claiming

Expand Down
6 changes: 0 additions & 6 deletions docs/content/developer/stardust/claiming/address-uc.mdx

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
title: Claiming an Output unlockable by an Alias/Nft Address
---

In Stardust outputs presented an Address Unlock Condition or similarly, in the case of the Alias Output, a Governor Address Unlock Condition. In the new ledger, this mechanism is represented as an address owning the associated Output object. Most of the times the address is directly managed through a keypair by a user, but sometimes this address could represent another object. In this case, that object owns the interested Output object. Coming from the Stardust migration, only `Alias` and `Nft` objects can own other Output objects.

## Claim of an Output owned by another Alias/Nft object

For this example, we're using an `AliasOutput` to extract an `Alias` object that owns an `NftOutput`.

1. The first step is to fetch the `AliasOutput` object that is needed for claiming the `NftOutput`.

<Tabs>
<TabItem value="rs" label="Rust">

```rust file=<rootDir>/docs/examples/rust/stardust/address_unlock_condition.rs#L74-L90
```

</TabItem>
<TabItem value="ts" label="TypeScript">

</TabItem>
</Tabs>

2. By using the dynamic field function with the "alias" dynamic field key filter, we gather the `Alias` object itself.

<Tabs>
<TabItem value="rs" label="Rust">

```rust file=<rootDir>/docs/examples/rust/stardust/address_unlock_condition.rs#L95-L105
```

</TabItem>
<TabItem value="ts" label="TypeScript">

</TabItem>
</Tabs>

3. Some objects are owned by the `Alias` object. In this case we filter them by type using the `NftOutput` type tag.
Applying the filter to get `NftOutput`s owned by the `Alias`.

<Tabs>
<TabItem value="rs" label="Rust">

```rust file=<rootDir>/docs/examples/rust/stardust/address_unlock_condition.rs#L109-L130
```

</TabItem>
<TabItem value="ts" label="TypeScript">

</TabItem>
</Tabs>

4. Create PTB that firstly extracts the assets from the `AliasOutput` and then it uses the extracted `Alias` to "address unlock" the `NftOutput` using the funсtion `unlock_alias_address_owned_nft`.

<Tabs>
<TabItem value="rs" label="Rust">

```rust file=<rootDir>/docs/examples/rust/stardust/address_unlock_condition.rs#L132-L241
```

</TabItem>
<TabItem value="ts" label="TypeScript">

</TabItem>
</Tabs>
2 changes: 1 addition & 1 deletion docs/content/developer/stardust/claiming/basic.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ TODO
## Claim of a Basic Output
Once a Basic Output can be unlocked the claim of its assets can start

1. The first step is to fetch the `BasicOutput` object needed to be claimed.
1. The first step is to fetch the `BasicOutput` object that needs to be claimed.

<Tabs>
<TabItem value="rs" label="Rust">
Expand Down
2 changes: 1 addition & 1 deletion docs/content/developer/stardust/claiming/nft.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Check the example above, as it works the same as the [`Basic Output`](basic.mdx)
## Claim of an Nft Output
Once an Nft Output can be unlocked the claim of its assets can start

1. The first step is to fetch the `NftOutput` object needed to be claimed.
1. The first step is to fetch the `NftOutput` object that needs to be claimed.

<Tabs>
<TabItem value="rs" label="Rust">
Expand Down
2 changes: 1 addition & 1 deletion docs/content/sidebars/developer.js
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ const developer = [
{
type: 'doc',
label: 'Output unlockable by an Alias/Nft Address',
id: 'developer/stardust/claiming/address-uc',
id: 'developer/stardust/claiming/address-unlock-condition',
},
{
type: 'doc',
Expand Down
Loading