-
Notifications
You must be signed in to change notification settings - Fork 287
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
Alias outputs doc #1153
Changes from 22 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 dbaaac9
outputs updated
anistark c7330a4
Fix broken urls
Dr-Electron 64e9078
Update docs/build/iota-sdk/1.0.0/docs/how-tos/alias/create.mdx
anistark d18c353
Update docs/build/iota-sdk/1.0.0/docs/how-tos/alias/create.mdx
anistark b073e51
Update docs/build/iota-sdk/1.0.0/docs/how-tos/alias/create.mdx
anistark 78336e1
Update docs/build/iota-sdk/1.0.0/docs/how-tos/alias/create.mdx
anistark d9b56d4
Update docs/build/iota-sdk/1.0.0/docs/how-tos/alias/create.mdx
anistark 7dc068b
Update docs/build/iota-sdk/1.0.0/docs/how-tos/alias/destroy.mdx
anistark cd29f82
Update docs/build/iota-sdk/1.0.0/docs/how-tos/alias/destroy.mdx
anistark 38b78d8
Update docs/build/iota-sdk/1.0.0/docs/how-tos/alias/destroy.mdx
anistark 57d397a
Update docs/build/iota-sdk/1.0.0/docs/how-tos/alias/destroy.mdx
anistark 0ef14d6
Update docs/build/iota-sdk/1.0.0/docs/how-tos/alias/destroy.mdx
anistark 2a90b02
updated outputs to match all. except python
anistark 7cbc022
Merge branch 'alias-output-doc' of github.com:iotaledger/iota-wiki in…
anistark e36bd91
Transaction -> Block
anistark 0e69e84
Update docs/build/iota-sdk/1.0.0/docs/how-tos/alias/destroy.mdx
anistark 4af1213
Update docs/build/iota-sdk/1.0.0/docs/how-tos/alias/create.mdx
anistark b117cee
Update docs/build/iota-sdk/1.0.0/docs/how-tos/alias/create.mdx
anistark 336ac38
Update docs/build/iota-sdk/1.0.0/docs/how-tos/alias/create.mdx
anistark 37a39f8
Update destroy.mdx
anistark 3841c82
Merge branch 'main' into alias-output-doc
luca-moser 7c8c07e
moves files into appropriate folder
luca-moser File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
136 changes: 136 additions & 0 deletions
136
docs/build/iota-sdk/1.0.0/docs/how-tos/alias/create.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'; | ||||||
|
||||||
An [Alias Output](https://wiki.iota.org/tips/tips/TIP-0018/#alias-output) is a specific implementation of a UTXO state machine. The 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 future state transitions. | ||||||
|
||||||
An Alias Output represents an alias account in the ledger with two control levels and a permanent Alias Address. The account owns other outputs that are locked under the Alias Address. The account keeps track of state transitions (`State Index` counter) and controlled foundries (`Foundry Counter`) and anchors the layer 2 state as metadata into the UTXO ledger. | ||||||
|
||||||
## 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. | ||||||
|
||||||
<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 the [`Transaction`](https://docs.rs/iota-sdk/latest/iota_sdk/wallet/account/struct.Account.html#method.retry_transaction_until_included) until included. | ||||||
|
||||||
<div className={'hide-code-block-extras'}> | ||||||
|
||||||
```rust reference | ||||||
https://github.com/iotaledger/iota-sdk/blob/develop/sdk/examples/how_tos/alias/create.rs#L43-L45 | ||||||
``` | ||||||
|
||||||
</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, and then [send](../../references/nodejs/classes/Account.md#send) it. | ||||||
|
||||||
<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-L55 | ||||||
``` | ||||||
|
||||||
</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/create.ts#L60 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
``` | ||||||
|
||||||
</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. Prepare an Alias Output transaction by calling the [`Account.prepare_create_alias_output()`](../../references/python/iota_sdk/wallet/account.md#prepare_create_alias_output) function, and then [send](../../references/python/iota_sdk/wallet/account.md#send) it. | ||||||
|
||||||
<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: | ||||||
[ | ||||||
... | ||||||
] | ||||||
Sending the create-alias transaction... | ||||||
Transaction sent: 0x7ce05ab09bc562c7b383067b774edd780e3a9235e9c76a5cccabdd9744b6a719 | ||||||
Block included: https://explorer.shimmer.network/testnet/block/0x603c0e010b4e7665913c04729aad692a1c7557234185e98c821e1142fa49823d | ||||||
Aliases AFTER: | ||||||
[ | ||||||
... | ||||||
] | ||||||
``` |
135 changes: 135 additions & 0 deletions
135
docs/build/iota-sdk/1.0.0/docs/how-tos/alias/destroy.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
|
||
## 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. | ||
|
||
<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 the [`Transaction`](https://docs.rs/iota-sdk/latest/iota_sdk/wallet/account/struct.Account.html#method.retry_transaction_until_included) until included. | ||
|
||
<div className={'hide-code-block-extras'}> | ||
|
||
```rust reference | ||
https://github.com/iotaledger/iota-sdk/blob/develop/sdk/examples/how_tos/alias/destroy.rs#L47-L49 | ||
``` | ||
|
||
</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. Prepare the transaction to destroy an Alias Output by calling the [`Account.preparedestroyalias()`](../../references/nodejs/classes/Account.md#preparedestroyalias) function, and then [send](../../references/nodejs/classes/Account.md#send) it. | ||
|
||
<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-L58 | ||
``` | ||
|
||
</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 the transaction that will destroy the alias output by calling the [`Account.prepare_destroy_alias()`](../../references/python/iota_sdk/wallet/account.md#prepare_destroy_alias) function, and then [send](../../references/python/iota_sdk/wallet/account.md#send) it. | ||
|
||
<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): | ||
[ | ||
... | ||
] | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.