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

fix(docs/content): Move related documentation enhancement #1864

Merged
merged 51 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
e953fba
feat(docs): Create an examples folder for Rust code (#1503)
miker83z Jul 30, 2024
f7f0c5d
fix(docs/examples): remove base_keystore example
miker83z Jul 31, 2024
d2761c5
feat(iota-sdk): added an alias output claim example (#1493)
valeriyr Jul 31, 2024
050678c
feat(iota-sdk): add basic output claim example
miker83z Jul 25, 2024
64f81c8
fix(iota-sdk): use the proper native token bag key
miker83z Jul 26, 2024
0c9a2b3
fix(iota-sdk): move basic output example in docs
miker83z Jul 30, 2024
a59d43c
fix(docs/examples): comments
miker83z Jul 30, 2024
9e8ac44
fix(docs/examples): license header
miker83z Jul 30, 2024
3e7216c
fix(docs/examples): basic output address
miker83z Jul 30, 2024
fe2f4e4
fix(docs/examples): fix clippy
miker83z Jul 30, 2024
5dc2e3b
fix(docs/examples): fix from comments
miker83z Jul 30, 2024
09e09b2
fix(docs/examples): move basic output example
miker83z Jul 31, 2024
ad781ef
fix(docs/examples): remove src folder
miker83z Jul 31, 2024
d74c9a2
Merge branch 'vm-language/stardust-models-docs' into sc-platform/feat…
miker83z Jul 31, 2024
31b1421
feat(docs/examples): nft output extraction example based on sdk (#1478)
Dkwcs Jul 31, 2024
626c5ca
Merge branch 'vm-language/stardust-models-docs' into sc-platform/feat…
miker83z Aug 1, 2024
a888b13
Merge branch 'develop' into vm-language/stardust-models-docs
miker83z Aug 1, 2024
84ad95e
feat(ci): add docs examples in rust (#1539)
miker83z Aug 1, 2024
7a5ee00
Merge branch 'vm-language/stardust-models-docs' into sc-platform/feat…
miker83z Aug 1, 2024
a6c62b2
fix(docs/examples): add license
miker83z Aug 1, 2024
6ab8f16
Merge branch 'vm-language/stardust-models-docs' into sc-platform/feat…
miker83z Aug 1, 2024
7336157
fix(docs/examples): cargo lock
miker83z Aug 1, 2024
4ccbca5
Merge branch 'vm-language/stardust-models-docs' into sc-platform/feat…
miker83z Aug 1, 2024
5e3f99b
chore(docs/examples): add clarification comment
miker83z Aug 1, 2024
257c6ed
Merge pull request #1440 from iotaledger/sc-platform/feat/stardust-pt…
miker83z Aug 2, 2024
ac12a57
feat(docs/examples): add unlock condition example based on rust sdk (…
Dkwcs Aug 5, 2024
7a2eb46
feat(docs/examples): Add foundry output claim example (#1575)
miker83z Aug 6, 2024
a292b11
feat(docs/examples): Test the positive scenarios for using an NFT obj…
Dkwcs Aug 7, 2024
3a4c943
feat(docs/stardust): Add docs for basic output claim (#1639)
miker83z Aug 8, 2024
e4dd0bd
feat(docs/content): documentation - claim NFT Output (#1654)
Dkwcs Aug 8, 2024
ed4529f
fear(docs/content) example of conversion of a stardust NFT into a cus…
Dkwcs Aug 8, 2024
86c8e3d
feat(docs): Using an Alias object test scenario (#1679)
valeriyr Aug 9, 2024
baa490c
refactor(docs/content): Split claiming docs in a tree (#1710)
miker83z Aug 9, 2024
a5f4a92
feat(docs): Alias usage documentation was added (#1723)
valeriyr Aug 12, 2024
ac7900e
feat(docs/content): docs implementation for address unlock condition …
Dkwcs Aug 13, 2024
c8bb82c
feat(docs/content): Create example doc for claiming a Foundry Output …
Dkwcs Aug 13, 2024
f53399a
Merge branch 'develop' into vm-language/stardust-models-docs
miker83z Aug 13, 2024
89c5de7
Merge branch 'develop' into vm-language/stardust-models-docs
miker83z Aug 13, 2024
2a9fb5f
fix(docs/content): enhance claiming and fix links (#1768)
miker83z Aug 13, 2024
c0d46d1
feat(docs/examples): Add self sponsor example for Shimmer assets (#1772)
miker83z Aug 14, 2024
f528ce0
feat(docs/content): Add Shimmer self-sponsorship claim docs (#1773)
miker83z Aug 14, 2024
fb392c4
fix(docs/content): improvements of docs navigation by adding links (#…
Dkwcs Aug 14, 2024
3a45555
refactor(docs/examples): Create a utility methods lib (#1821)
miker83z Aug 14, 2024
eb8e503
fix(docs/content): add links to simplify docs navigation
Dkwcs Aug 15, 2024
d61e6ee
feat(docs): Move content was fixed in the Developer/Getting Started d…
valeriyr Aug 15, 2024
a2ea132
fix(docs/context): add links, minor docs refactoring
Dkwcs Aug 15, 2024
1b0e87c
fix(docs/content): documentation code examples enhancement
Dkwcs Aug 15, 2024
30390c0
Merge branch 'develop' into vm-language/stardust-models-docs
Dkwcs Aug 16, 2024
4f6e773
Merge branch 'vm-language/stardust-models-docs' into sc-platform/seco…
thibault-martinez Aug 22, 2024
e99c49b
Merge branch 'develop' into sc-platform/second-review-Move-content
valeriyr Aug 22, 2024
6fdfc67
fix(docs): fixed tokenomics link
valeriyr Aug 22, 2024
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
283 changes: 165 additions & 118 deletions docs/content/developer/getting-started/first-app/build-test.mdx

Large diffs are not rendered by default.

42 changes: 23 additions & 19 deletions docs/content/developer/getting-started/first-app/debug.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,17 @@ Alternatively, any call to abort or assertion failure also prints the stacktrace
To see the module in action, update your `my_module` code to include debug calls. Specifically, update the `new_sword` function so that you print the value of `forge` before and after updating `swords_created`. Also, include a `print_stack_trace` so that the function looks like the following:

```move
public fun new_sword(
forge: &mut Forge,
magic: u64,
strength: u64,
ctx: &mut TxContext,
): Sword {
/// Constructor for creating swords.
public fun new_sword(forge: &mut Forge, magic: u64, strength: u64, ctx: &mut TxContext): Sword {
debug::print(forge);

// Increment the `swords_created` counter.
forge.swords_created = forge.swords_created + 1;

debug::print(forge);
debug::print_stack_trace();

// Create a sword.
Sword {
id: object::new(ctx),
magic: magic,
Expand All @@ -55,7 +56,7 @@ public fun new_sword(
To see the results, run the module's tests.

```shell
$ iota move test
$ iota move test test_sword_transactions
```

The response prints out the expected results as the test calls the `new_sword` function.
Expand All @@ -65,7 +66,6 @@ INCLUDING DEPENDENCY Iota
INCLUDING DEPENDENCY MoveStdlib
BUILDING my_first_package
Running Move unit tests
[ PASS ] 0x0::my_module::test_module_init
[debug] 0x0::my_module::Forge {
id: 0x2::object::UID {
id: 0x2::object::ID {
Expand All @@ -86,25 +86,29 @@ Call Stack:
[0] 0000000000000000000000000000000000000000000000000000000000000000::my_module::test_sword_transactions

Code:
[19] LdU64(7)
[20] MutBorrowLoc(3)
[21] Call(14)
> [22] Call(4)
[23] LdConst(1)
[24] CallGeneric(2)
[25] ImmBorrowLoc(3)
[24] LdU64(7)
[25] CopyLoc(5)
[26] Call(13)
> [27] Call(6)
[28] CopyLoc(4)
[29] CallGeneric(2)
[30] CopyLoc(5)

Locals:
[0] -
[1] { { { <OBJECT-ID-WITHOUT-0x> } }, 1 }
[2] -
[3] { 2, { 00000000000000000000000000000000000000000000000000000000000000ad, [2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 0, 0, 0 } }
[1] -
[2] 000000000000000000000000000000000000000000000000000000000000face
[3] { { { <OBJECT-ID-WITHOUT-0x> } }, 1 }
[4] 000000000000000000000000000000000000000000000000000000000000cafe
[5] (&) { 1, { 000000000000000000000000000000000000000000000000000000000000babe, [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 0, 0, 0 } }
[6] { 1, { 000000000000000000000000000000000000000000000000000000000000babe, [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 0, 0, 0 } }
[7] -


Operand Stack:

[ PASS ] 0x0::my_module::test_sword_transactions
Test result: OK. Total tests: 2; passed: 2; failed: 0
Test result: OK. Total tests: 1; passed: 1; failed: 0
```

## Related links
Expand Down
14 changes: 7 additions & 7 deletions docs/content/developer/getting-started/first-app/publish.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,19 @@ $ iota client objects
╭───────────────────────────────────────────────────────────────────────────────────────╮
│ ╭────────────┬──────────────────────────────────────────────────────────────────────╮ │
│ │ objectId │ <OBJECT-ID> │ │
│ │ version │ 10 │ │
│ │ version │ 3 │ │
│ │ digest │ <DIGEST-HASH> │ │
│ │ objectType │ <PACKAGE-ID>::my_module::Forge │ │
│ ╰────────────┴──────────────────────────────────────────────────────────────────────╯ │
│ ╭────────────┬──────────────────────────────────────────────────────────────────────╮ │
│ │ objectId │ <OBJECT-ID> │ │
│ │ version │ 10 │ │
│ │ version │ 3 │ │
│ │ digest │ <DIGEST-HASH> │ │
│ │ objectType │ 0x0000..0002::coin::Coin │ │
│ ╰────────────┴──────────────────────────────────────────────────────────────────────╯ │
│ ╭────────────┬──────────────────────────────────────────────────────────────────────╮ │
│ │ objectId │ <OBJECT-ID> │ │
│ │ version │ 10 │ │
│ │ version │ 3 │ │
│ │ digest │ <DIGEST-HASH> │ │
│ │ objectType │ 0x0000..0002::package::UpgradeCap │ │
│ ╰────────────┴──────────────────────────────────────────────────────────────────────╯ │
Expand Down Expand Up @@ -124,25 +124,25 @@ After the transaction executes, you can check the status of the `Sword` object b
╭───────────────────────────────────────────────────────────────────────────────────────╮
│ ╭────────────┬──────────────────────────────────────────────────────────────────────╮ │
│ │ objectId │ <OBJECT-ID> │ │
│ │ version │ 11 │ │
│ │ version │ 4 │ │
│ │ digest │ <DIGEST-HASH> │ │
│ │ objectType │ <PACKAGE-ID>::my_module::Forge │ │
│ ╰────────────┴──────────────────────────────────────────────────────────────────────╯ │
│ ╭────────────┬──────────────────────────────────────────────────────────────────────╮ │
│ │ objectId │ <OBJECT-ID> │ │
│ │ version │ 11 │ │
│ │ version │ 4 │ │
│ │ digest │ <DIGEST-HASH> │ │
│ │ objectType │ 0x0000..0002::coin::Coin │ │
│ ╰────────────┴──────────────────────────────────────────────────────────────────────╯ │
│ ╭────────────┬──────────────────────────────────────────────────────────────────────╮ │
│ │ objectId │ <OBJECT-ID> │ │
│ │ version │ 11 │ │
│ │ version │ 4 │ │
│ │ digest │ <DIGEST-HASH> │ │
│ │ objectType │ <PACKAGE-ID>::my_module::Sword │ │
│ ╰────────────┴──────────────────────────────────────────────────────────────────────╯ │
│ ╭────────────┬──────────────────────────────────────────────────────────────────────╮ │
│ │ objectId │ <OBJECT-ID> │ │
│ │ version │ 10 │ │
│ │ version │ 3 │ │
│ │ digest │ <DIGEST-HASH> │ │
│ │ objectType │ 0x0000..0002::package::UpgradeCap │ │
│ ╰────────────┴──────────────────────────────────────────────────────────────────────╯ │
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@ Running the previous command creates a directory with the name you provide (`my_
```move title="my_first_package/Move.toml"
[package]
name = "my_first_package"

# edition = "2024.beta " # To use the Move 2024 edition, currently in beta
edition = "2024.beta" # edition = "legacy" to use legacy (pre-2024) Move
# license = "" # e.g., "MIT", "GPL", "Apache 2.0"
# authors = ["..."] # e.g., ["Joe Smith ([email protected])", "John Snow ([email protected])"]

[dependencies]
IOTA = { git = "https://github.com/iotaledger/iota.git", subdir = "crates/iota-framework/packages/iota-framework", rev = "framework/testnet" }
Iota = { git = "https://github.com/iotaledger/iota.git", subdir = "crates/iota-framework/packages/iota-framework", rev = "framework/testnet" }

# For remote import, use the `{ git = "...", subdir = "...", rev = "..." }`.
# Revision can be a branch, a tag, and a commit hash.
Expand Down Expand Up @@ -54,7 +53,7 @@ my_first_package = "0x0"
The manifest file contents include available sections of the manifest and comments that provide additional information. In Move, you prepend the hash mark (`#`) to a line to denote a comment.

- **[package]:** Contains metadata for the package. By default, the `iota move new` command populates only the `name` value of the metadata. In this case, the example passes `my_first_package` to the command, which becomes the name of the package. You can delete the first `#` of subsequent lines of the `[package]` section to provide values for the other available metadata fields.
- **[dependencies]:** Lists the other packages that your package depends on to run. By default, the `iota move new` command lists the `IOTA` package on GitHub (Testnet version) as the lone dependency.
- **[dependencies]:** Lists the other packages that your package depends on to run. By default, the `iota move new` command lists the `Iota` package on GitHub (Testnet version) as the lone dependency.
- **[addresses]:** Declares named addresses that your package uses. By default, the section includes the package you create with the `iota move new` command and an address of `0x0`. The publish process replaces the `0x0` address with an actual on-chain address.
- **[dev-dependencies]:** Includes only comments that describe the section.
- **[dev-addresses]:** Includes only comments that describe the section.
Expand Down Expand Up @@ -88,7 +87,7 @@ Populate the `my_module.move` file with the following code:
```move
module my_first_package::my_module {

// Part 1: Struct definitions
// Part 1: Struct definitions.
public struct Sword has key, store {
id: UID,
magic: u64,
Expand All @@ -100,17 +99,17 @@ module my_first_package::my_module {
swords_created: u64,
}

// Part 2: Module initializer to be executed when this module is published
// Part 2: Module initializer to be executed when this module is published.
fun init(ctx: &mut TxContext) {
let admin = Forge {
id: object::new(ctx),
swords_created: 0,
};
// Transfer the forge object to the module/package publisher
// Transfer the forge object to the module/package publisher.
transfer::public_transfer(admin, tx_context::sender(ctx));
}

// Part 3: Accessors required to read the struct attributes
// Part 3: Accessors required to read the struct attributes.
public fun magic(self: &Sword): u64 {
self.magic
}
Expand All @@ -123,9 +122,9 @@ module my_first_package::my_module {
self.swords_created
}

// Part 4: Public/entry functions (introduced later in the tutorial)
// Part 4: Public/entry functions (introduced later in the tutorial).

// Part 5: Private functions (if any)
// Part 5: Private functions (if any).
}
```

Expand Down
2 changes: 1 addition & 1 deletion docs/content/developer/iota-101/access-time.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module example::clock {
use iota::clock::{Self, Clock};
use iota::event;

struct TimeEvent has copy, drop, store {
public struct TimeEvent has copy, drop, store {
timestamp_ms: u64
}

Expand Down
15 changes: 3 additions & 12 deletions docs/content/developer/iota-101/create-coin/create-coin.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,12 @@ Publishing a coin on IOTA is nearly as straightforward as publishing a new type.

```move
module examples::mycoin {
use std::option;
use iota::coin::{Self, Coin, TreasuryCap};
use iota::transfer;
use iota::tx_context::{Self, TxContext};
use iota::coin::{Self, TreasuryCap};

/// The type identifier of coin. The coin will have a type
/// tag of kind: `Coin<package_object::mycoin::MYCOIN>`
/// Make sure that the name of the type matches the module's name.
struct MYCOIN has drop {}
public struct MYCOIN has drop {}

/// Module initializer is called once on module publish. A treasury
/// cap is sent to the publisher, who then controls minting and burning
Expand Down Expand Up @@ -66,13 +63,7 @@ Amount: <COIN-AMOUNT>

## DenyList

The IOTA framework provides a `DenyList` singleton, shared object that the bearer of a `DenyCap` can access to specify a list of addresses that are unable to use a IOTA core type. The initial use case for `DenyList`, however, focuses on limiting access to coins of a specified type. This is useful, for example, when creating a regulated coin on IOTA that requires the ability to block certain addresses from using it as inputs to transactions. Regulated coins on IOTA satisfy any regulations that require the ability to prevent known bad actors from having access to those coins.

:::info

The `DenyList` object is a system object that has the address `0x403`. You cannot create it yourself.

:::
See [`DenyList`](../create-coin/regulated.mdx#deny-list).

## Create regulated coin

Expand Down
15 changes: 5 additions & 10 deletions docs/content/developer/iota-101/create-coin/in-game-token.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ The following example creates an in-game currency called a GEM, which represents
/// that sells swords for Gems. Gems are an in-game currency that can be bought
/// with IOTA.
module examples::sword {
use iota::tx_context::TxContext;
use iota::object::{Self, UID};

use iota::token::{Self, Token, ActionRequest};
use examples::gem::GEM;

Expand All @@ -24,7 +21,7 @@ module examples::sword {
const SWORD_PRICE: u64 = 10;

/// A game item that can be purchased with Gems.
struct Sword has key, store { id: UID }
public struct Sword has key, store { id: UID }

/// Purchase a sword with Gems.
public fun buy_sword(
Expand All @@ -44,10 +41,8 @@ module examples::gem {
use std::option::none;
use std::string::{Self, String};
use iota::iota::IOTA;
use iota::transfer;
use iota::object::{Self, UID};
use iota::balance::{Self, Balance};
use iota::tx_context::{sender, TxContext};
use iota::tx_context::sender;
use iota::coin::{Self, Coin, TreasuryCap};

use iota::token::{Self, Token, ActionRequest};
Expand All @@ -70,7 +65,7 @@ module examples::gem {

#[allow(lint(coin_field))]
/// Gems can be purchased through the `Store`.
struct GemStore has key {
public struct GemStore has key {
id: UID,
/// Profits from selling Gems.
profits: Balance<IOTA>,
Expand All @@ -79,7 +74,7 @@ module examples::gem {
}

/// The OTW to create the in-game currency.
struct GEM has drop {}
public struct GEM has drop {}

// In the module initializer we create the in-game currency and define the
// rules for different types of actions.
Expand All @@ -91,7 +86,7 @@ module examples::gem {
);

// create a `TokenPolicy` for GEMs
let (policy, cap) = token::new_policy(&treasury_cap, ctx);
let (mut policy, cap) = token::new_policy(&treasury_cap, ctx);

token::allow(&mut policy, &cap, buy_action(), ctx);
token::allow(&mut policy, &cap, token::spend_action(), ctx);
Expand Down
Loading
Loading