-
Notifications
You must be signed in to change notification settings - Fork 287
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added docs for alias output. [wip] output pending.
- Loading branch information
Showing
3 changed files
with
260 additions
and
0 deletions.
There are no files selected for viewing
126 changes: 126 additions & 0 deletions
126
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,126 @@ | ||
--- | ||
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. | ||
|
||
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. | ||
|
||
## 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 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. | ||
|
||
<div className={'hide-code-block-extras'}> | ||
|
||
```rust reference | ||
https://github.com/iotaledger/iota-sdk/blob/develop/sdk/examples/how_tos/alias/create.rs#L43 | ||
``` | ||
|
||
</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. | ||
|
||
<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 | ||
``` | ||
|
||
</div> | ||
|
||
3. Retry transaction until included [`Transaction`](../../references/nodejs/classes/Account/#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 | ||
``` | ||
|
||
</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. | ||
|
||
<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 | ||
... | ||
``` |
124 changes: 124 additions & 0 deletions
124
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,124 @@ | ||
--- | ||
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. | ||
|
||
## 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 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. | ||
|
||
<div className={'hide-code-block-extras'}> | ||
|
||
```rust reference | ||
https://github.com/iotaledger/iota-sdk/blob/develop/sdk/examples/how_tos/alias/destroy.rs#L47 | ||
``` | ||
|
||
</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. | ||
|
||
<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 | ||
``` | ||
|
||
</div> | ||
|
||
3. Retry transaction until included [`Transaction`](../../references/nodejs/classes/Account/#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. | ||
|
||
<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 | ||
... | ||
``` |
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