diff --git a/docs/build/iota-sdk/1.0/docs/how-tos/alias/create.mdx b/docs/build/iota-sdk/1.0/docs/how-tos/alias/create.mdx new file mode 100644 index 00000000000..00c96885b2b --- /dev/null +++ b/docs/build/iota-sdk/1.0/docs/how-tos/alias/create.mdx @@ -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 + + + + +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. + +
+ +```rust reference +https://github.com/iotaledger/iota-sdk/blob/develop/sdk/examples/how_tos/alias/create.rs#L40 +``` + +
+ +3. Retry the [`Transaction`](https://docs.rs/iota-sdk/latest/iota_sdk/wallet/account/struct.Account.html#method.retry_transaction_until_included) until included. + +
+ +```rust reference +https://github.com/iotaledger/iota-sdk/blob/develop/sdk/examples/how_tos/alias/create.rs#L43-L45 +``` + +
+ +
+ + +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. + +
+ +```typescript reference +https://github.com/iotaledger/iota-sdk/blob/develop/bindings/nodejs/examples/how_tos/alias/create.ts#L53-L55 +``` + +
+ +3. Retry transaction until included [`Transaction`](../../references/nodejs/classes/Account.md#retrytransactionuntilincluded) that was sent. + +
+ +```typescript reference +https://github.com/iotaledger/iota-sdk/blob/develop/bindings/nodejs/examples/how_tos/alias/create.ts#L60 +``` + +
+ +
+ + +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. + +
+ +```python reference +https://github.com/iotaledger/iota-sdk/blob/develop/bindings/python/examples/how_tos/alias/create.py#L22 +``` + +
+ +
+
+ +### Full Example Code + + + + +```rust reference +https://github.com/iotaledger/iota-sdk/blob/develop/sdk/examples/how_tos/alias_wallet/request_funds.rs +``` + + + + +```typescript reference +https://github.com/iotaledger/iota-sdk/blob/develop/sdk/examples/how_tos/alias/create.rs +``` + + + + +```python reference +https://github.com/iotaledger/iota-sdk/blob/develop/bindings/python/examples/how_tos/alias/create.py +``` + + + + +### Expected Output + +```plaintext +Aliases BEFORE: +[ + ... +] +Sending the create-alias transaction... +Transaction sent: 0x7ce05ab09bc562c7b383067b774edd780e3a9235e9c76a5cccabdd9744b6a719 +Block included: https://explorer.shimmer.network/testnet/block/0x603c0e010b4e7665913c04729aad692a1c7557234185e98c821e1142fa49823d +Aliases AFTER: +[ + ... +] +``` diff --git a/docs/build/iota-sdk/1.0/docs/how-tos/alias/destroy.mdx b/docs/build/iota-sdk/1.0/docs/how-tos/alias/destroy.mdx new file mode 100644 index 00000000000..81caad56925 --- /dev/null +++ b/docs/build/iota-sdk/1.0/docs/how-tos/alias/destroy.mdx @@ -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 + + + + +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. + +
+ +```rust reference +https://github.com/iotaledger/iota-sdk/blob/develop/sdk/examples/how_tos/alias/destroy.rs#L44 +``` + +
+ +3. Retry the [`Transaction`](https://docs.rs/iota-sdk/latest/iota_sdk/wallet/account/struct.Account.html#method.retry_transaction_until_included) until included. + +
+ +```rust reference +https://github.com/iotaledger/iota-sdk/blob/develop/sdk/examples/how_tos/alias/destroy.rs#L47-L49 +``` + +
+ +
+ + +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. + +
+ +```typescript reference +https://github.com/iotaledger/iota-sdk/blob/develop/bindings/nodejs/examples/how_tos/alias/destroy.ts#L56-L58 +``` + +
+ +3. Retry transaction until included [`Transaction`](../../references/nodejs/classes/Account.md#retrytransactionuntilincluded) that was sent. + +
+ +```typescript reference +https://github.com/iotaledger/iota-sdk/blob/develop/bindings/nodejs/examples/how_tos/alias/destroy.ts#L63 +``` + +
+ +
+ + +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. + +
+ +```python reference +https://github.com/iotaledger/iota-sdk/blob/develop/bindings/python/examples/how_tos/alias/destroy.py#L25 +``` + +
+ +
+
+ +### Full Example Code + + + + +```rust reference +https://github.com/iotaledger/iota-sdk/blob/develop/sdk/examples/how_tos/alias_wallet/destroy.rs +``` + + + + +```typescript reference +https://github.com/iotaledger/iota-sdk/blob/develop/sdk/examples/how_tos/alias/destroy.rs +``` + + + + +```python reference +https://github.com/iotaledger/iota-sdk/blob/develop/bindings/python/examples/how_tos/alias/destroy.py +``` + + + + +### 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): + [ + ... +] +``` diff --git a/docs/build/iota-sdk/1.0/sidebars.js b/docs/build/iota-sdk/1.0/sidebars.js index a5a11822263..0972a123011 100644 --- a/docs/build/iota-sdk/1.0/sidebars.js +++ b/docs/build/iota-sdk/1.0/sidebars.js @@ -155,6 +155,16 @@ module.exports = { }, ], }, + { + type: 'category', + label: 'Alias Outputs', + items: [ + { + type: 'autogenerated', + dirName: 'how-tos/alias', + }, + ], + }, { type: 'category', label: 'Advanced Transactions',