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

Alias outputs doc #1153

Merged
merged 23 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
b8a8cf0
added docs for alias output. [wip] output pending.
anistark Sep 4, 2023
dbaaac9
outputs updated
anistark Sep 4, 2023
c7330a4
Fix broken urls
Dr-Electron Sep 4, 2023
64e9078
Update docs/build/iota-sdk/1.0.0/docs/how-tos/alias/create.mdx
anistark Sep 6, 2023
d18c353
Update docs/build/iota-sdk/1.0.0/docs/how-tos/alias/create.mdx
anistark Sep 6, 2023
b073e51
Update docs/build/iota-sdk/1.0.0/docs/how-tos/alias/create.mdx
anistark Sep 6, 2023
78336e1
Update docs/build/iota-sdk/1.0.0/docs/how-tos/alias/create.mdx
anistark Sep 6, 2023
d9b56d4
Update docs/build/iota-sdk/1.0.0/docs/how-tos/alias/create.mdx
anistark Sep 6, 2023
7dc068b
Update docs/build/iota-sdk/1.0.0/docs/how-tos/alias/destroy.mdx
anistark Sep 6, 2023
cd29f82
Update docs/build/iota-sdk/1.0.0/docs/how-tos/alias/destroy.mdx
anistark Sep 6, 2023
38b78d8
Update docs/build/iota-sdk/1.0.0/docs/how-tos/alias/destroy.mdx
anistark Sep 6, 2023
57d397a
Update docs/build/iota-sdk/1.0.0/docs/how-tos/alias/destroy.mdx
anistark Sep 6, 2023
0ef14d6
Update docs/build/iota-sdk/1.0.0/docs/how-tos/alias/destroy.mdx
anistark Sep 6, 2023
2a90b02
updated outputs to match all. except python
anistark Sep 12, 2023
7cbc022
Merge branch 'alias-output-doc' of github.com:iotaledger/iota-wiki in…
anistark Sep 12, 2023
e36bd91
Transaction -> Block
anistark Sep 12, 2023
0e69e84
Update docs/build/iota-sdk/1.0.0/docs/how-tos/alias/destroy.mdx
anistark Sep 18, 2023
4af1213
Update docs/build/iota-sdk/1.0.0/docs/how-tos/alias/create.mdx
anistark Sep 18, 2023
b117cee
Update docs/build/iota-sdk/1.0.0/docs/how-tos/alias/create.mdx
anistark Sep 18, 2023
336ac38
Update docs/build/iota-sdk/1.0.0/docs/how-tos/alias/create.mdx
anistark Sep 18, 2023
37a39f8
Update destroy.mdx
anistark Sep 18, 2023
3841c82
Merge branch 'main' into alias-output-doc
luca-moser Sep 26, 2023
7c8c07e
moves files into appropriate folder
luca-moser Sep 26, 2023
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
136 changes: 136 additions & 0 deletions docs/build/iota-sdk/1.0.0/docs/how-tos/alias/create.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
---
title: Create Alias Output
description: 'How to programmatically create an alias output'
image: /img/logo/iota_mark_light.png
keywords:
- how to
- create
- alias
- output
- nodejs
- python
- rust
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

The Alias Output is a specific implementation of a UTXO state machine. Alias ID, the unique identifier of an instance of the deployed state machine, is generated deterministically by the protocol and is not allowed to change in any future state transitions.
anistark marked this conversation as resolved.
Show resolved Hide resolved

Alias Output represents an alias account in the ledger with two control levels and a permanentAlias Address. The account owns other outputs that are locked under Alias Address. The account keeps track of state transitions (`State Index` counter), controlled foundries (`Foundry Counter`) and anchors the layer 2 state as metadata into the UTXO ledger.
anistark marked this conversation as resolved.
Show resolved Hide resolved

## Example Code

<Tabs groupId="language" queryString>
<TabItem value="rust" label="Rust">

The following example will:

1. Instantiate a [`Wallet`](https://docs.rs/iota-sdk/latest/iota_sdk/wallet/core/struct.Wallet.html), get Alice's `Account` which was
[created in the first guide](../accounts-and-addresses/create-account.mdx).
2. Create an alias output transaction by calling the [`Account.create_alias_output()`](https://docs.rs/iota-sdk/latest/iota_sdk/wallet/account/struct.CreateAliasParams.html) function.
anistark marked this conversation as resolved.
Show resolved Hide resolved

<div className={'hide-code-block-extras'}>

```rust reference
https://github.com/iotaledger/iota-sdk/blob/develop/sdk/examples/how_tos/alias/create.rs#L40
```

</div>

3. Retry transaction until included [`Transaction`](https://docs.rs/iota-sdk/latest/iota_sdk/wallet/account/struct.Account.html#method.retry_transaction_until_included) that was sent.
anistark marked this conversation as resolved.
Show resolved Hide resolved

<div className={'hide-code-block-extras'}>

```rust reference
https://github.com/iotaledger/iota-sdk/blob/develop/sdk/examples/how_tos/alias/create.rs#L43
anistark marked this conversation as resolved.
Show resolved Hide resolved
```

</div>

</TabItem>
<TabItem value="typescript-node" label="Typescript (Node.js)">

The following example will:

1. Instantiate a [`Wallet`](https://docs.rs/iota-sdk/latest/iota_sdk/wallet/core/struct.Wallet.html), get Alice's `Account` which was
[created in the first guide](../accounts-and-addresses/create-account.mdx) and [sync it](../accounts-and-addresses/check-balance.mdx).
2. Create an alias output transaction by calling the [`Account.prepareCreateAliasOutput()`](../../references/nodejs/classes/Account.md#preparecreatealiasoutput) function.
anistark marked this conversation as resolved.
Show resolved Hide resolved

<div className={'hide-code-block-extras'}>

```typescript reference
https://github.com/iotaledger/iota-sdk/blob/develop/bindings/nodejs/examples/how_tos/alias/create.ts#L53
anistark marked this conversation as resolved.
Show resolved Hide resolved
```

</div>

3. Retry transaction until included [`Transaction`](../../references/nodejs/classes/Account.md#retrytransactionuntilincluded) that was sent.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
3. Retry transaction until included [`Transaction`](../../references/nodejs/classes/Account.md#retrytransactionuntilincluded) that was sent.
3. Retry the [`Transaction`](../../references/nodejs/classes/Account.md#retrytransactionuntilincluded) until included.


<div className={'hide-code-block-extras'}>

```typescript reference
https://github.com/iotaledger/iota-sdk/blob/develop/bindings/nodejs/examples/how_tos/alias/create.ts#L60
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
https://github.com/iotaledger/iota-sdk/blob/develop/bindings/nodejs/examples/how_tos/alias/create.ts#L60
https://github.com/iotaledger/iota-sdk/blob/develop/bindings/nodejs/examples/how_tos/alias/create.ts#L60-L62

```

</div>

</TabItem>
<TabItem value="python" label="Python">

1. Instantiate a [`Wallet`](https://docs.rs/iota-sdk/latest/iota_sdk/wallet/core/struct.Wallet.html), get Alice's `Account` which was
[created in the first guide](../accounts-and-addresses/create-account.mdx) and [sync it](../accounts-and-addresses/check-balance.mdx).
2. Create an alias output transaction by calling the [`Account.prepareCreateAliasOutput()`](../../references/python/iota_sdk/wallet/account.md#prepare_create_alias_output) function.
anistark marked this conversation as resolved.
Show resolved Hide resolved

<div className={'hide-code-block-extras'}>

```python reference
https://github.com/iotaledger/iota-sdk/blob/develop/bindings/python/examples/how_tos/alias/create.py#L22
```

</div>

</TabItem>
</Tabs>

### Full Example Code

<Tabs groupId="language" queryString>
<TabItem value="rust" label="Rust">

```rust reference
https://github.com/iotaledger/iota-sdk/blob/develop/sdk/examples/how_tos/alias_wallet/request_funds.rs
```

</TabItem>
<TabItem value="typescript-node" label="Typescript (Node.js)">

```typescript reference
https://github.com/iotaledger/iota-sdk/blob/develop/sdk/examples/how_tos/alias/create.rs
```

</TabItem>
<TabItem value="python" label="Python">

```python reference
https://github.com/iotaledger/iota-sdk/blob/develop/bindings/python/examples/how_tos/alias/create.py
```

</TabItem>
</Tabs>

### Expected Output

```plaintext
Aliases BEFORE (141):
[
...
]
Sending the create-alias transaction...
Transaction sent: 0x7ce05ab09bc562c7b383067b774edd780e3a9235e9c76a5cccabdd9744b6a719
Transaction included: https://explorer.shimmer.network/testnet/block/0x603c0e010b4e7665913c04729aad692a1c7557234185e98c821e1142fa49823d
Aliases AFTER (142):
[
...
]
```
135 changes: 135 additions & 0 deletions docs/build/iota-sdk/1.0.0/docs/how-tos/alias/destroy.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
---
title: Destroy Alias Output
description: 'How to programmatically destroy an alias output'
image: /img/logo/iota_mark_light.png
keywords:
- how to
- destroy
- alias
- output
- nodejs
- python
- rust
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

You can destroy an alias output by ID. If the alias still owns any outputs when you try to destroy it, you will get an error.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
You can destroy an alias output by ID. If the alias still owns any outputs when you try to destroy it, you will get an error.
You can destroy an Alias Output using its ID. You will get an error if the alias still owns any outputs when you try to destroy it.

anistark marked this conversation as resolved.
Show resolved Hide resolved

## Example Code

<Tabs groupId="language" queryString>
<TabItem value="rust" label="Rust">

The following example will:

1. Instantiate a [`Wallet`](https://docs.rs/iota-sdk/latest/iota_sdk/wallet/core/struct.Wallet.html), get Alice's `Account` which was
[created in the first guide](../accounts-and-addresses/create-account.mdx).
2. Destroy an alias output transaction by calling the [`Account.burn()`](https://docs.rs/iota-sdk/latest/iota_sdk/wallet/account/struct.Account.html#method.burn) function.
anistark marked this conversation as resolved.
Show resolved Hide resolved

<div className={'hide-code-block-extras'}>

```rust reference
https://github.com/iotaledger/iota-sdk/blob/develop/sdk/examples/how_tos/alias/destroy.rs#L44
```

</div>

3. Retry transaction until included [`Transaction`](https://docs.rs/iota-sdk/latest/iota_sdk/wallet/account/struct.Account.html#method.retry_transaction_until_included) that was sent.
anistark marked this conversation as resolved.
Show resolved Hide resolved

<div className={'hide-code-block-extras'}>

```rust reference
https://github.com/iotaledger/iota-sdk/blob/develop/sdk/examples/how_tos/alias/destroy.rs#L47
anistark marked this conversation as resolved.
Show resolved Hide resolved
```

</div>

</TabItem>
<TabItem value="typescript-node" label="Typescript (Node.js)">

The following example will:

1. Instantiate a [`Wallet`](https://docs.rs/iota-sdk/latest/iota_sdk/wallet/core/struct.Wallet.html), get Alice's `Account` which was
[created in the first guide](../accounts-and-addresses/create-account.mdx) and [sync it](../accounts-and-addresses/check-balance.mdx).
2. Destroy an alias output transaction by calling the [`Account.preparedestroyalias()`](../../references/nodejs/classes/Account.md#preparedestroyalias) function.
anistark marked this conversation as resolved.
Show resolved Hide resolved

<div className={'hide-code-block-extras'}>

```typescript reference
https://github.com/iotaledger/iota-sdk/blob/develop/bindings/nodejs/examples/how_tos/alias/destroy.ts#L56
anistark marked this conversation as resolved.
Show resolved Hide resolved
```

</div>

3. Retry transaction until included [`Transaction`](../../references/nodejs/classes/Account.md#retrytransactionuntilincluded) that was sent.

<div className={'hide-code-block-extras'}>

```typescript reference
https://github.com/iotaledger/iota-sdk/blob/develop/bindings/nodejs/examples/how_tos/alias/destroy.ts#L63
```

</div>

</TabItem>
<TabItem value="python" label="Python">

1. Instantiate a [`Wallet`](https://docs.rs/iota-sdk/latest/iota_sdk/wallet/core/struct.Wallet.html), get Alice's `Account` which was
[created in the first guide](../accounts-and-addresses/create-account.mdx) and [sync it](../accounts-and-addresses/check-balance.mdx).
2. Destroy an alias output transaction by calling the [`Account.prepare_destroy_alias()`](../../references/python/iota_sdk/wallet/account.md#prepare_destroy_alias) function.
anistark marked this conversation as resolved.
Show resolved Hide resolved

<div className={'hide-code-block-extras'}>

```python reference
https://github.com/iotaledger/iota-sdk/blob/develop/bindings/python/examples/how_tos/alias/destroy.py#L25
```

</div>

</TabItem>
</Tabs>

### Full Example Code

<Tabs groupId="language" queryString>
<TabItem value="rust" label="Rust">

```rust reference
https://github.com/iotaledger/iota-sdk/blob/develop/sdk/examples/how_tos/alias_wallet/destroy.rs
```

</TabItem>
<TabItem value="typescript-node" label="Typescript (Node.js)">

```typescript reference
https://github.com/iotaledger/iota-sdk/blob/develop/sdk/examples/how_tos/alias/destroy.rs
```

</TabItem>
<TabItem value="python" label="Python">

```python reference
https://github.com/iotaledger/iota-sdk/blob/develop/bindings/python/examples/how_tos/alias/destroy.py
```

</TabItem>
</Tabs>

### Expected Output

```plaintext
Aliases BEFORE destroying (142):
[
...
]
Sending the destroy-alias transaction...
Transaction sent: 0x829a635a7edc28bee4d4a1019b7b1f1bedec11d83c118b6f2a7904590f4bb458
Block included: https://explorer.shimmer.network/testnet/block/0xd455b8132c0b109dd0b2d1d157c6b1d7275318f69dcf56f536a7b14d9fa17bb3
Destroyed alias 0xf708a29e9619e847916de76c2e167e87a704c235dcbd7cda018865be7f561b5a
Aliases AFTER destroying (141):
[
...
]
```
10 changes: 10 additions & 0 deletions docs/build/iota-sdk/1.0.0/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,16 @@ module.exports = {
},
],
},
{
type: 'category',
label: 'Alias Outputs',
items: [
{
type: 'autogenerated',
dirName: 'how-tos/alias',
},
],
},
{
type: 'category',
label: 'Advanced Transactions',
Expand Down