+
+ {label}
+
);
}
diff --git a/apps/explorer/src/lib/ui/utils/generateValidatorsTableColumns.tsx b/apps/explorer/src/lib/ui/utils/generateValidatorsTableColumns.tsx
index 6875e772638..e175ba717d1 100644
--- a/apps/explorer/src/lib/ui/utils/generateValidatorsTableColumns.tsx
+++ b/apps/explorer/src/lib/ui/utils/generateValidatorsTableColumns.tsx
@@ -8,6 +8,7 @@ import { type ApyByValidator, formatPercentageDisplay } from '@iota/core';
import { ampli, getValidatorMoveEvent, VALIDATOR_LOW_STAKE_GRACE_PERIOD } from '~/lib';
import { StakeColumn, ValidatorLink, ImageIcon } from '~/components';
import type { IotaEvent, IotaValidatorSummary } from '@iota/iota-sdk/dist/cjs/client';
+import clsx from 'clsx';
interface generateValidatorsTableColumnsArgs {
atRiskValidators: [string, string][];
@@ -16,9 +17,16 @@ interface generateValidatorsTableColumnsArgs {
limit?: number;
showValidatorIcon?: boolean;
includeColumns?: string[];
+ highlightValidatorName?: boolean;
}
-function ValidatorWithImage({ validator }: { validator: IotaValidatorSummary }) {
+function ValidatorWithImage({
+ validator,
+ highlightValidatorName,
+}: {
+ validator: IotaValidatorSummary;
+ highlightValidatorName?: boolean;
+}) {
return (
- {validator.name}
+
+ {validator.name}
+
}
/>
@@ -50,8 +64,20 @@ export function generateValidatorsTableColumns({
rollingAverageApys = null,
showValidatorIcon = true,
includeColumns,
+ highlightValidatorName,
}: generateValidatorsTableColumnsArgs): ColumnDef[] {
let columns: ColumnDef[] = [
+ {
+ header: '#',
+ id: 'number',
+ cell({ row }) {
+ return (
+
+ {row.index + 1}
+
+ );
+ },
+ },
{
header: 'Name',
id: 'name',
@@ -59,9 +85,22 @@ export function generateValidatorsTableColumns({
return (
{showValidatorIcon ? (
-
+
) : (
- {validator.name}
+
+
+ {validator.name}
+
+
)}
);
diff --git a/apps/explorer/src/pages/validators/Validators.tsx b/apps/explorer/src/pages/validators/Validators.tsx
index 52255bff5c2..3d2baa90aae 100644
--- a/apps/explorer/src/pages/validators/Validators.tsx
+++ b/apps/explorer/src/pages/validators/Validators.tsx
@@ -80,6 +80,18 @@ function ValidatorPageResult(): JSX.Element {
atRiskValidators: data.atRiskValidators,
validatorEvents,
rollingAverageApys: validatorsApy || null,
+ highlightValidatorName: true,
+ includeColumns: [
+ '#',
+ 'Name',
+ 'Stake',
+ 'Proposed next Epoch gas price',
+ 'APY',
+ 'Comission',
+ 'Last Epoch Rewards',
+ 'Voting Power',
+ 'Status',
+ ],
});
}, [data, validatorEvents, validatorsApy]);
diff --git a/apps/ui-kit/src/lib/components/molecules/table-cell/TableCell.tsx b/apps/ui-kit/src/lib/components/molecules/table-cell/TableCell.tsx
index 6b9d7e7a345..b12b9f83140 100644
--- a/apps/ui-kit/src/lib/components/molecules/table-cell/TableCell.tsx
+++ b/apps/ui-kit/src/lib/components/molecules/table-cell/TableCell.tsx
@@ -16,10 +16,6 @@ interface TableCellBaseProps {
* Whether the cell content should be centered.
*/
isContentCentered?: boolean;
- /**
- * Whether to not wrap the text in the cell.
- */
- noWrap?: boolean;
}
export function TableCellBase({
From 129bd743eac9a612b5165ec803b3b1a55e10e797 Mon Sep 17 00:00:00 2001
From: cpl121 <100352899+cpl121@users.noreply.github.com>
Date: Mon, 23 Sep 2024 15:40:24 +0200
Subject: [PATCH 03/11] refactor(wallet): modify version format from
`date.patch` to `x.y.z.n` (#2775)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* feat(wallet): modify the wallet version format
* refactor: update versioning logic to allow for RCs
* refactor: rename beta to rc
* refactor: improve naming
* chore: rename WALLET_BETA to WALLET_RC
* chore: update version number formatting
* chore: rename beta to rc
---------
Co-authored-by: Begoña Alvarez
---
.../configs/webpack/webpack.config.common.ts | 40 +++++++++----------
apps/wallet/package.json | 3 +-
.../src/shared/experimentation/features.ts | 2 +-
3 files changed, 22 insertions(+), 23 deletions(-)
diff --git a/apps/wallet/configs/webpack/webpack.config.common.ts b/apps/wallet/configs/webpack/webpack.config.common.ts
index d039a578a49..8ef3c5cfa15 100644
--- a/apps/wallet/configs/webpack/webpack.config.common.ts
+++ b/apps/wallet/configs/webpack/webpack.config.common.ts
@@ -16,24 +16,8 @@ import type { Configuration } from 'webpack';
import packageJson from '../../package.json';
-function generateDateVersion(patch: number) {
- const sha = gitRevSync.short();
- const date = new Date();
- const version = [
- String(date.getUTCFullYear()).slice(2),
- String(date.getUTCMonth() + 1),
- String(date.getUTCDate()),
- patch,
- ].join('.');
-
- return {
- version,
- version_name: `${version} (${sha})`,
- };
-}
-
-const WALLET_BETA = process.env.WALLET_BETA === 'true';
-const PATCH_VERSION = Number(process.env.PATCH_VERSION) || 0;
+const WALLET_RC = process.env.WALLET_RC === 'true';
+const RC_VERSION = WALLET_RC ? Number(process.env.RC_VERSION) || 0 : undefined;
const SDK_ROOT = resolve(__dirname, '..', '..', '..', '..', 'sdk');
const PROJECT_ROOT = resolve(__dirname, '..', '..');
@@ -44,12 +28,26 @@ const TS_CONFIGS_ROOT = resolve(CONFIGS_ROOT, 'ts');
const IS_DEV = process.env.NODE_ENV === 'development';
const IS_PROD = process.env.NODE_ENV === 'production';
const TS_CONFIG_FILE = resolve(TS_CONFIGS_ROOT, `tsconfig.${IS_DEV ? 'dev' : 'prod'}.json`);
-const APP_NAME = WALLET_BETA ? 'IOTA Wallet (BETA)' : IS_DEV ? 'IOTA Wallet (DEV)' : 'IOTA Wallet';
+const APP_NAME = WALLET_RC ? 'IOTA Wallet (RC)' : IS_DEV ? 'IOTA Wallet (DEV)' : 'IOTA Wallet';
dotenv.config({
path: [resolve(SDK_ROOT, '.env'), resolve(SDK_ROOT, '.env.defaults')],
});
+// From package.json: x.y.z
+// App version (production): x.y.z
+// App version (rc): x.y.z.n
+function generateVersion(n: number | undefined) {
+ const sha = gitRevSync.short();
+ const packageVersion = packageJson.version;
+ const version = n !== undefined ? `${packageVersion}.${n}` : packageVersion;
+ const improved_version = n !== undefined ? `${packageVersion}-rc.${n}` : packageVersion;
+ return {
+ version,
+ version_name: `${improved_version} (${sha})`,
+ };
+}
+
function loadTsConfig(tsConfigFilePath: string) {
return new Promise((res, rej) => {
exec(
@@ -99,7 +97,7 @@ async function generateAliasFromTs() {
const commonConfig: () => Promise = async () => {
const alias = await generateAliasFromTs();
- const walletVersionDetails = generateDateVersion(PATCH_VERSION);
+ const walletVersionDetails = generateVersion(RC_VERSION);
const sentryAuthToken = process.env.SENTRY_AUTH_TOKEN;
return {
context: SRC_ROOT,
@@ -218,7 +216,7 @@ const commonConfig: () => Promise = async () => {
'process.env.WALLET_KEYRING_PASSWORD': JSON.stringify(
IS_DEV ? 'DEV_PASS' : Buffer.from(randomBytes(64)).toString('hex'),
),
- 'process.env.WALLET_BETA': WALLET_BETA,
+ 'process.env.WALLET_RC': WALLET_RC,
'process.env.APP_NAME': JSON.stringify(APP_NAME),
'process.env.DEFAULT_NETWORK': JSON.stringify(process.env.DEFAULT_NETWORK),
'process.env.IOTA_NETWORKS': JSON.stringify(process.env.IOTA_NETWORKS),
diff --git a/apps/wallet/package.json b/apps/wallet/package.json
index 02b03ae7cb8..2a50ed39fb3 100644
--- a/apps/wallet/package.json
+++ b/apps/wallet/package.json
@@ -1,5 +1,6 @@
{
"name": "iota-wallet",
+ "version": "0.1.0",
"private": true,
"description": "A wallet for IOTA",
"main": "./dist/ui.js",
@@ -7,7 +8,7 @@
"build": "pnpm build:prod",
"build:prod": "cross-env NODE_ENV=\"production\" TS_NODE_PROJECT=\"./configs/ts/tsconfig.webpack.json\" webpack --progress",
"build:dev": "cross-env NODE_ENV=\"development\" TS_NODE_PROJECT=\"./configs/ts/tsconfig.webpack.json\" webpack --progress",
- "build:beta": "cross-env WALLET_BETA=true NODE_ENV=\"production\" TS_NODE_PROJECT=\"./configs/ts/tsconfig.webpack.json\" webpack --progress",
+ "build:rc": "cross-env WALLET_RC=true NODE_ENV=\"production\" TS_NODE_PROJECT=\"./configs/ts/tsconfig.webpack.json\" webpack --progress",
"prettier:check": "prettier -c --ignore-unknown --ignore-path=../../.prettierignore --ignore-path=.prettierignore .",
"prettier:fix": "prettier -w --ignore-unknown --ignore-path=../../.prettierignore --ignore-path=.prettierignore .",
"prettier:fix:watch": "onchange '**' -i -f add -f change -j 5 -- prettier -w --ignore-unknown --ignore-path=../../.prettierignore --ignore-path=.prettierignore {{file}}",
diff --git a/apps/wallet/src/shared/experimentation/features.ts b/apps/wallet/src/shared/experimentation/features.ts
index 1078472a2a1..22e2eaffaea 100644
--- a/apps/wallet/src/shared/experimentation/features.ts
+++ b/apps/wallet/src/shared/experimentation/features.ts
@@ -60,7 +60,7 @@ export function setAttributes(network?: { network: Network; customRpc?: string |
growthbook.setAttributes({
network: activeNetwork,
version: Browser.runtime.getManifest().version,
- beta: process.env.WALLET_BETA || false,
+ rc: process.env.WALLET_RC || false,
});
}
From 27e2f51f929128f4a5bd4b24287c20e6e36b013a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bego=C3=B1a=20=C3=81lvarez=20de=20la=20Cruz?=
Date: Mon, 23 Sep 2024 16:06:48 +0200
Subject: [PATCH 04/11] refactor: update wallet development key (#2809)
---
apps/wallet/configs/webpack/webpack.config.common.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/apps/wallet/configs/webpack/webpack.config.common.ts b/apps/wallet/configs/webpack/webpack.config.common.ts
index 8ef3c5cfa15..3645f4e838a 100644
--- a/apps/wallet/configs/webpack/webpack.config.common.ts
+++ b/apps/wallet/configs/webpack/webpack.config.common.ts
@@ -198,7 +198,7 @@ const commonConfig: () => Promise = async () => {
description: packageJson.description,
...(IS_DEV
? {
- key: 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2HTQu/66edl64fM/SKDnHJmCz9SIYqM/QK7NM3vD1LTE2UNXzHX5Clj8geuoWAYS6HE/aFcd//qPnAh8TnPgqTS3IX+IbZsY/+kcokxIEWHly3eKEHWB32tQsGdJx6tgDzx8TRkFZEcCCdE4pFqQO68W3I/+8AQPosdd5fsIoF6OGKZ/i29mpGkYJSmMroCN5zYCQqvpjTBIkiTkI9TTjxmBid77pHyG4TsHz0wda4KxHV9ZtzZQXB4vexTku/Isczdtif7pDqFEDCAqEkpiGPyKoIuqrxc75IfpzIGFsIylycBr0fZellSsl2M6FM34R99/vUrGj5iWcjNmhYvZ8QIDAQAB',
+ key: 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1uOw+go7YTI8xNuHzIQC7J7x6Jw0in2UPptgcR1c+7aA3XSb03TVZkMXSMslCB7KTpaJOOQK1urLN3/FFos55f3vXixsjHT3pVbX/FhUmBK0kLOx8kl5Ns9ywVgBJyCSEnMrR1IlbiiU8GoXH1Bzb4SxkDELSQIZRetd+zTnwsUx/74grPT4EmgVglHBBYO75iJMsiJ/F0zMEsEQ+0SDfmU0v5Qh8slzryZr+8p8Q/mpNADzwS51o74feeGC5nAM5IgX0LyjRzCLXsiEmdC57KOaCpI7yhzDjXpye374oTdZJulv/tVeA1ymLIKQM5rfyeoqnxSOMsgGsvoM60WoYQIDAQAB',
}
: undefined),
};
From 794729c2bd53f5b18d139d53581de3cddc411a02 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bego=C3=B1a=20=C3=81lvarez=20de=20la=20Cruz?=
Date: Mon, 23 Sep 2024 16:17:21 +0200
Subject: [PATCH 05/11] chore: remove identity permission from manifest (#2801)
---
apps/wallet/src/manifest/manifest.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/apps/wallet/src/manifest/manifest.json b/apps/wallet/src/manifest/manifest.json
index a3bd5bf8ec2..f43d531e439 100644
--- a/apps/wallet/src/manifest/manifest.json
+++ b/apps/wallet/src/manifest/manifest.json
@@ -6,7 +6,7 @@
"background": {
"service_worker": "background.js"
},
- "permissions": ["storage", "tabs", "alarms", "unlimitedStorage", "identity"],
+ "permissions": ["storage", "tabs", "alarms", "unlimitedStorage"],
"action": {
"default_popup": "ui.html?type=popup"
},
From edf4cf15c368c98bd77cb5d01c00def402e5c939 Mon Sep 17 00:00:00 2001
From: Dr-Electron
Date: Mon, 23 Sep 2024 21:06:07 +0200
Subject: [PATCH 06/11] feat(docs): Add reference doc for importing code with
examples (#2381)
---
.../developer/cryptography/on-chain/ecvrf.mdx | 15 +----
.../cryptography/on-chain/groth16.mdx | 18 +----
.../cryptography/on-chain/hashing.mdx | 46 +------------
.../developer/evm-to-move/creating-nft.mdx | 67 +------------------
.../developer/evm-to-move/creating-token.mdx | 31 +--------
.../developer/getting-started/build-test.mdx | 18 ++---
.../getting-started/create-a-module.mdx | 59 +++-------------
.../getting-started/create-a-package.mdx | 53 ++-------------
.../contribute/import-code-docs.mdx | 48 +++++++++++++
docs/content/sidebars/references.js | 1 +
docs/examples/move/cryptography/Move.toml | 10 +++
.../move/cryptography/sources/ecvrf.move | 13 ++++
.../move/cryptography/sources/goth16.move | 16 +++++
.../cryptography/sources/hashing_iota.move | 18 +++++
.../cryptography/sources/hashing_std.move | 18 +++++
docs/examples/move/evm-to-move/Move.toml | 10 +++
.../evm-to-move/sources/coin_manager.move | 35 ++++++++++
.../move/evm-to-move/sources/nft.move | 65 ++++++++++++++++++
.../move/evm-to-move/sources/token.move | 24 +++++++
examples/move/first_package/Move.toml | 30 ++++++++-
.../{example.move => first_package.move} | 22 +++++-
21 files changed, 335 insertions(+), 282 deletions(-)
create mode 100644 docs/content/references/contribute/import-code-docs.mdx
create mode 100644 docs/examples/move/cryptography/Move.toml
create mode 100644 docs/examples/move/cryptography/sources/ecvrf.move
create mode 100644 docs/examples/move/cryptography/sources/goth16.move
create mode 100644 docs/examples/move/cryptography/sources/hashing_iota.move
create mode 100644 docs/examples/move/cryptography/sources/hashing_std.move
create mode 100644 docs/examples/move/evm-to-move/Move.toml
create mode 100644 docs/examples/move/evm-to-move/sources/coin_manager.move
create mode 100644 docs/examples/move/evm-to-move/sources/nft.move
create mode 100644 docs/examples/move/evm-to-move/sources/token.move
rename examples/move/first_package/sources/{example.move => first_package.move} (86%)
diff --git a/docs/content/developer/cryptography/on-chain/ecvrf.mdx b/docs/content/developer/cryptography/on-chain/ecvrf.mdx
index 308dedaf339..9c11bbaf24d 100644
--- a/docs/content/developer/cryptography/on-chain/ecvrf.mdx
+++ b/docs/content/developer/cryptography/on-chain/ecvrf.mdx
@@ -46,20 +46,7 @@ Output: 2b7e45821d80567761e8bb3fc519efe5ad80cdb4423227289f960319bbcf6eea1aef30c0
You can verify the proof and output in a smart contract using `iota::ecvrf::ecvrf_verify` from the IOTA Move framework:
-```move
-module math::ecvrf_test {
- use iota::ecvrf;
- use iota::event;
-
- /// Event on whether the output is verified
- public struct VerifiedEvent has copy, drop {
- is_verified: bool,
- }
-
- public fun verify_ecvrf_output(output: vector, alpha_string: vector, public_key: vector, proof: vector) {
- event::emit(VerifiedEvent {is_verified: ecvrf::ecvrf_verify(&output, &alpha_string, &public_key, &proof)});
- }
-}
+```move file=/docs/examples/move/cryptography/sources/ecvrf.move
```
You can also use the CLI tool for verification:
diff --git a/docs/content/developer/cryptography/on-chain/groth16.mdx b/docs/content/developer/cryptography/on-chain/groth16.mdx
index caa0a19bc7b..11e70a203ea 100644
--- a/docs/content/developer/cryptography/on-chain/groth16.mdx
+++ b/docs/content/developer/cryptography/on-chain/groth16.mdx
@@ -104,21 +104,5 @@ proof.c.serialize_compressed(&mut proof_points_bytes).unwrap();
The following example smart contract prepares a verification key and verifies the corresponding proof. This example uses the BN254 elliptic curve construction, which is given as the first parameter to the `prepare_verifying_key` and `verify_groth16_proof` functions. You can use the `bls12381` function instead for BLS12-381 construction.
-```rust
-module test::groth16_test {
- use iota::groth16;
- use iota::event;
-
- /// Event on whether the proof is verified
- struct VerifiedEvent has copy, drop {
- is_verified: bool,
- }
-
- public fun verify_proof(vk: vector, public_inputs_bytes: vector, proof_points_bytes: vector) {
- let pvk = groth16::prepare_verifying_key(&groth16::bn254(), &vk);
- let public_inputs = groth16::public_proof_inputs_from_bytes(public_inputs_bytes);
- let proof_points = groth16::proof_points_from_bytes(proof_points_bytes);
- event::emit(VerifiedEvent {is_verified: groth16::verify_groth16_proof(&groth16::bn254(), &pvk, &public_inputs, &proof_points)});
- }
-}
+```move file=/docs/examples/move/cryptography/sources/goth16.move
```
diff --git a/docs/content/developer/cryptography/on-chain/hashing.mdx b/docs/content/developer/cryptography/on-chain/hashing.mdx
index ed63b7d95eb..51b22f1cef7 100644
--- a/docs/content/developer/cryptography/on-chain/hashing.mdx
+++ b/docs/content/developer/cryptography/on-chain/hashing.mdx
@@ -16,52 +16,10 @@ The IOTA Move API supports the following cryptographic hash functions:
The SHA2-256 and SHA3-256 hash functions are available in the Move Standard Library in the `std::hash` module. The following example shows how to use the SHA2-256 hash function in a smart contract:
-```move
-module test::hashing_std {
- use std::hash;
- use iota::object::{Self, UID};
- use iota::tx_context::TxContext;
- use iota::transfer;
-
- /// Object that holds the output hash value.
- public struct Output has key, store {
- id: UID,
- value: vector
- }
-
- public fun hash_data(data: vector, recipient: address, ctx: &mut TxContext) {
- let hashed = Output {
- id: object::new(ctx),
- value: hash::sha2_256(data),
- };
- // Transfer an output data object holding the hashed data to the recipient.
- transfer::public_transfer(hashed, recipient)
- }
-}
+```move file=/docs/examples/move/cryptography/sources/hashing_std.move
```
The Keccak256 and Blake2b-256 hash functions are available through the `iota::hash` module in the IOTA Move Library. An example of how to use the Keccak256 hash function in a smart contract is shown below. Notice that here, the input to the hash function is given as a reference. This is the case for both Keccak256 and Blake2b-256.
-```move
-module test::hashing_iota {
- use iota::hash;
- use iota::object::{Self, UID};
- use iota::tx_context::TxContext;
- use iota::transfer;
-
- /// Object that holds the output hash value.
- public struct Output has key, store {
- id: UID,
- value: vector
- }
-
- public fun hash_data(data: vector, recipient: address, ctx: &mut TxContext) {
- let hashed = Output {
- id: object::new(ctx),
- value: hash::keccak256(&data),
- };
- // Transfer an output data object holding the hashed data to the recipient.
- transfer::public_transfer(hashed, recipient)
- }
-}
+```move file=/docs/examples/move/cryptography/sources/hashing_iota.move
```
diff --git a/docs/content/developer/evm-to-move/creating-nft.mdx b/docs/content/developer/evm-to-move/creating-nft.mdx
index c0dd39c9fca..0ce4713f47d 100644
--- a/docs/content/developer/evm-to-move/creating-nft.mdx
+++ b/docs/content/developer/evm-to-move/creating-nft.mdx
@@ -41,72 +41,7 @@ A lot of logic here is abstracted away, but every bit of logic can be overwritte
IOTA Move is based on objects instead of a global storage like EVM. Objects in IOTA Move can be owned, non-fungible, and unique - the exact properties of an NFT! This makes creating NFTs in IOTA Move very trivial, given that everything is already an NFT by default. An example of a very simplified NFT in IOTA Move:
-```move title="examples/Examplenft.move"
-module example::examplenft {
- use std::string;
- use iota::event;
-
- /// An example NFT that can be minted by anybody
- public struct ExampleNFT has key, store {
- id: UID,
- /// Name for the token
- name: string::String,
- }
-
- // ===== Events =====
-
- public struct NFTMinted has copy, drop {
- // The Object ID of the NFT
- object_id: ID,
- // The creator of the NFT
- creator: address,
- // The name of the NFT
- name: string::String,
- }
-
- // ===== Public view functions =====
-
- /// Get the NFT's `name`
- public fun name(nft: &ExampleNFT): &string::String {
- &nft.name
- }
-
- // ===== Entrypoints =====
-
- #[allow(lint(self_transfer))]
- /// Anyone can mint a new NFT on this one
- public fun mint_to_sender(
- name: vector,
- ctx: &mut TxContext
- ) {
- let sender = tx_context::sender(ctx);
- let nft = ExampleNFT {
- id: object::new(ctx),
- name: string::utf8(name)
- };
-
- event::emit(NFTMinted {
- object_id: object::id(&nft),
- creator: sender,
- name: nft.name,
- });
-
- transfer::public_transfer(nft, sender);
- }
-
- /// Transfer `nft` to `recipient`
- public fun transfer(
- nft: ExampleNFT, recipient: address, _: &mut TxContext
- ) {
- transfer::public_transfer(nft, recipient)
- }
-
- /// Permanently delete `nft`
- public fun burn(nft: ExampleNFT, _: &mut TxContext) {
- let ExampleNFT { id, name: _} = nft;
- object::delete(id)
- }
-}
+```move file=/docs/examples/move/evm-to-move/sources/nft.move
```
This is just a simplified NFT that anyone can mint, with just a name in it as metadata. It can freely be transferred and burned, and the metadata can be directly accessed through the object from another contract. Given that this is just a normal object being created, there's little to add to this code example. It's straightforward if you know the basics of working with objects in IOTA.
diff --git a/docs/content/developer/evm-to-move/creating-token.mdx b/docs/content/developer/evm-to-move/creating-token.mdx
index f8597fd1903..10cbc9d4a19 100644
--- a/docs/content/developer/evm-to-move/creating-token.mdx
+++ b/docs/content/developer/evm-to-move/creating-token.mdx
@@ -34,33 +34,7 @@ IOTA Move takes a radically different approach regarding tokens in terms of owne
The initial creation of `Coin` takes place by minting these coins. This is usually done in a smart contract (module) in IOTA Move and looks like this:
-```move title="examples/Exampletoken.move"
-module examples::exampletoken {
- use iota::coin;
- use iota::transfer;
- use iota::tx_context::{Self, TxContext};
-
- /// One-Time-Witness of kind: `Coin`
- public struct EXAMPLETOKEN has drop {}
-
- fun init(witness: EXAMPLETOKEN, ctx: &mut TxContext) {
- let (treasurycap, metadata) = coin::create_currency(
- witness,
- 6, // decimals
- b"EXAMPLE", // symbol
- b"Example Coin", // name
- b"Just an example", // description
- option::none(), // icon URL
- ctx
- );
-
- // transfer the `TreasuryCap` to the sender, admin capabilities
- transfer::public_transfer(treasurycap, tx_context::sender(ctx));
-
- // metadata is typically frozen after creation
- transfer::public_freeze_object(metadata);
- }
-}
+```move file=/docs/examples/move/evm-to-move/sources/token.move
```
There's a lot to unpack here; let's look at it piece by piece. In IOTA Move, there is no 'compiler version' defined within the module itself, like in Solidity.
@@ -69,8 +43,7 @@ A `module` is defined (`exampletoken`) as part of the `examples` package (module
After the aliases, we see an empty struct defined:
-```move
-public struct EXAMPLETOKEN has drop {}
+```move file=/docs/examples/move/evm-to-move/sources/token.move#L5
```
This is the definition of the so-called [One-Time-Witness](../iota-101/move-overview/one-time-witness.mdx). Together with the `init` function definition, this ensures that this `Coin` will only be created once and never more on this chain.
diff --git a/docs/content/developer/getting-started/build-test.mdx b/docs/content/developer/getting-started/build-test.mdx
index 1da979c9e3f..ca5a1acf8da 100644
--- a/docs/content/developer/getting-started/build-test.mdx
+++ b/docs/content/developer/getting-started/build-test.mdx
@@ -11,7 +11,7 @@ Once you have [created a package](create-a-package.mdx) and [added a module](cre
## Building your package
-You can use the `iota move build` command to build Move packages in the working directory, `my_first_package` in this case.
+You can use the `iota move build` command to build Move packages in the working directory, `first_package` in this case.
```shell
iota move build
@@ -25,7 +25,7 @@ If your build is successful, the IOTA client will return the following:
UPDATING GIT DEPENDENCY https://github.com/iotaledger/iota.git
INCLUDING DEPENDENCY IOTA
INCLUDING DEPENDENCY MoveStdlib
-BUILDING my_first_package
+BUILDING first_package
```
## Test a Package
@@ -34,7 +34,7 @@ You can use the Move testing framework to write unit tests for your IOTA package
### Test Syntax
-You should add unit tests in their corresponding [module file](create-a-module.mdx). In Move, test functions are identified by the following:
+You should add unit tests in their corresponding [test file](create-a-module.mdx). In Move, test functions are identified by the following:
* They are [`public`](create-a-module.mdx#public-functions) functions.
* They have no parameters.
@@ -51,14 +51,14 @@ If you haven't added any tests, you should see the following output.
```shell
INCLUDING DEPENDENCY Iota
INCLUDING DEPENDENCY MoveStdlib
-BUILDING my_first_package
+BUILDING first_package
Running Move unit tests
Test result: OK. Total tests: 0; passed: 0; failed: 0
```
### Add Tests
-You can add your first unit test by copying the following public test function and adding it to the end of `my_first_module`, within the module definition.
+You can add your first unit test by copying the following public test function and adding it to `first_package_tests` file, within the `tests` directory.
```move
#[test]
@@ -120,13 +120,7 @@ The compilation error provides all the necessary information to help you [debug]
Move has many features to ensure your code is safe. In this case, the `Sword` struct represents a game asset that digitally mimics a real-world item. Much like a real sword, it cannot simply disappear. Since the `Sword` struct doesn't have the [`drop`](create-a-module.mdx#drop) ability, it has to be consumed before the function returns. However, since the `sword` mimics a real-world item, you don't want to allow it to disappear.
-Instead, you can fix the compilation error by adequately disposing of the `sword`. Add the following line to the beginning of the `test_sword_create` function to import the [`Transfer`](../../references/framework/iota-framework/transfer.mdx) module:
-
-```move
-use iota::transfer;
-```
-
-Now, you can add the following after the function's `!assert` call to transfer the `sword` to a freshly created dummy address:
+Instead, you can fix the compilation error by adequately disposing of the `sword`. Add the following after the function's `!assert` call to transfer the `sword` to a freshly created dummy address:
```move
// Create a dummy address and transfer the sword.
diff --git a/docs/content/developer/getting-started/create-a-module.mdx b/docs/content/developer/getting-started/create-a-module.mdx
index 6b3bbd3a453..9303c9fb4f8 100644
--- a/docs/content/developer/getting-started/create-a-module.mdx
+++ b/docs/content/developer/getting-started/create-a-module.mdx
@@ -5,7 +5,14 @@ tags: [move, getting-started]
# Create a Move Module
-A [package](create-a-package.mdx)'s utility is defined by its modules. A module contains the logic for your package. You can create any number of modules per package. To add a module, create a `.move` file in the `sources` directory. For this guide, create a file called `my_module.move` and add the following content:
+A [package](create-a-package.mdx)'s utility is defined by its modules. A module contains the logic for your package. You can create any number of modules per package. To add a module, create a `.move` file in the `sources` directory. For this guide, create a file called `first_package.move` and add the following content:
+
+```move
+module first_package::my_module {
+}
+```
+
+And now let's add some code:
:::tip Comments in `.move` files
@@ -14,57 +21,11 @@ In `.move` files, use double slashes (`//`) to denote a comment.
:::
-```move
-module my_first_package::my_module {
-
- // Imports
- use iota::object::{Self, UID};
- use iota::transfer;
- use iota::tx_context::{Self, TxContext};
-
- // Struct definitions
- struct Sword has key, store {
- id: UID,
- magic: u64,
- strength: u64,
- }
-
- struct Forge has key, store {
- id: UID,
- swords_created: u64,
- }
-
- // 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::public_transfer(admin, tx_context::sender(ctx));
- }
-
- // Accessors required to read the struct attributes
- public fun magic(self: &Sword): u64 {
- self.magic
- }
-
- public fun strength(self: &Sword): u64 {
- self.strength
- }
-
- public fun swords_created(self: &Forge): u64 {
- self.swords_created
- }
-
- // Public/entry functions
-
- // Private functions
-}
+```move file=/examples/move/first_package/sources/first_package.move#L7-L41
```
## Module Name
-The first line of the module defines the module's name and the package it belongs to. In this case, `my_module` belongs to [`my_first_package`](create-a-package.mdx).
+The first line of the module defines the module's name and the package it belongs to. In this case, `my_module` belongs to [`first_package`](create-a-package.mdx).
## Imports
diff --git a/docs/content/developer/getting-started/create-a-package.mdx b/docs/content/developer/getting-started/create-a-package.mdx
index 653e2ce44af..9a7001e47fc 100644
--- a/docs/content/developer/getting-started/create-a-package.mdx
+++ b/docs/content/developer/getting-started/create-a-package.mdx
@@ -14,10 +14,10 @@ issuing [transactions](../iota-101/transactions/transactions.mdx).
Use the following command to create a standard package:
```shell
-iota move new my_first_package
+iota move new first_package
```
-The command will create and populate the `my_first_package` directory with a skeleton for an IOTA Move project,
+The command will create and populate the `first_package` directory with a skeleton for an IOTA Move project,
consisting of the following files and directories:
## `Move.toml`
@@ -28,43 +28,7 @@ The `Move.toml` file is the package's manifest. It describes the package and its
In `.toml` files, use the hash mark (`#`) to denote a comment.
:::
-```toml title="my_first_package/Move.toml"
-[package]
-name = "my_first_package"
-edition = "2024.beta" # edition
-# license = "" # e.g., "MIT", "GPL", "Apache 2.0"
-# authors = ["..."] # e.g., ["Joe Smith (joesmith@noemail.com)", "John Snow (johnsnow@noemail.com)"]
-
-[dependencies]
-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.
-# MyRemotePackage = { git = "https://some.remote/host.git", subdir = "remote/path", rev = "main" }
-
-# For local dependencies use `local = path`. Path is relative to the package root
-# Iota = { local = "../path/to/iota/crates/iota-framework/packages/iota-framework" }
-
-# To resolve a version conflict and force a specific version for dependency
-# override use `override = true`
-# Override = { local = "../conflicting/version", override = true }
-
-[addresses]
-my_first_package = "0x0"
-
-# Named addresses will be accessible in Move as `@name`. They're also exported:
-# for example, `std = "0x1"` is exported by the Standard Library.
-# alice = "0xA11CE"
-
-[dev-dependencies]
-# The dev-dependencies section allows overriding dependencies for `--test` and
-# `--dev` modes. You can introduce test-only dependencies here.
-# Local = { local = "../path/to/dev-build" }
-
-[dev-addresses]
-# The dev-addresses section allows overwriting named addresses for the `--test`
-# and `--dev` modes.
-# alice = "0xB0B"
+```toml file=/examples/move/first_package/Move.toml
```
:::tip Using a local version of IOTA
@@ -87,12 +51,7 @@ of the metadata.
The `[dependencies]` section specifies the dependencies of the project. The dependency specification can be a git
repository URL or a path to the local directory.
-```rust
-# git repository
-Iota = { git = "https://github.com/iotaledger/iota.git", subdir = "crates/iota-framework/packages/iota-framework", rev = "framework/testnet" }
-
-# local directory
-MyPackage = { local = "../my-package" }
+```toml file=/examples/move/first_package/Move.toml#L10-L15
```
Packages also import addresses from other packages. For example, the `Iota` dependency adds the `std` and `iota` addresses
@@ -104,9 +63,7 @@ If you have two dependencies that use different versions of the same package, yo
the `[dependencies]` section. To do so, add the `override` field to the dependency. The version specified in
the `[dependencies]` section will be used instead of the one specified in the dependency itself.
-```rust
-[dependencies]
-Iota = { override = true, git = "https://github.com/iotaledger/iota.git", subdir = "crates/iota-framework/packages/iota-framework", rev = "framework/testnet" }
+```toml file=/examples/move/first_package/Move.toml#L17-L19
```
### Dev-dependencies
diff --git a/docs/content/references/contribute/import-code-docs.mdx b/docs/content/references/contribute/import-code-docs.mdx
new file mode 100644
index 00000000000..53e02675e11
--- /dev/null
+++ b/docs/content/references/contribute/import-code-docs.mdx
@@ -0,0 +1,48 @@
+---
+description: Import code documentation from this or any other repository.
+tags: [reference]
+---
+
+# Import Code for Documentation
+
+We import code snippets directly from the source code to ensure the documentation is always up-to-date and correct.
+To achieve this, we use two tools to either [import code from the IOTA repo](https://www.npmjs.com/package/remark-code-import) or [any other repository](https://www.npmjs.com/package/@saucelabs/theme-github-codeblock).
+
+:::info
+
+These tools only allow the import of complete files or specific lines from a file. So, if the code changes, make sure to update the lines.
+
+:::
+
+## Local Code Import
+
+We use the [`remark-code-import`](https://www.npmjs.com/package/remark-code-import) package to reference the code from the IOTA repo.
+
+:::note CI/CD
+
+If you import local code, ensure it is part of a CI/CD workflow so the code gets tested for correctness.
+
+:::
+
+### Usage
+
+Use it like a standard code block, specifying a path to the file you want to import. You can use `rootDir` as a base path to the repository.
+
+````
+```rust file=/some-path/to-rust-file.rs
+```
+````
+
+## Remote Code Import
+
+We use the [`@saucelabs/theme-github-codeblock`](https://www.npmjs.com/package/@saucelabs/theme-github-codeblock) package to reference code from any other repository.
+
+### Usage
+
+Create a code block with the keyword `reference` and add the GitHub link (with specific line numbers) to the file you want to import.
+
+````
+```rust reference
+https://github.com/some-repo/with-a-great-project/blob/some-branch/some-path/to-rust-file.rs#L7-L41
+```
+````
\ No newline at end of file
diff --git a/docs/content/sidebars/references.js b/docs/content/sidebars/references.js
index dd1d40015fd..31d0622f7e4 100644
--- a/docs/content/sidebars/references.js
+++ b/docs/content/sidebars/references.js
@@ -355,6 +355,7 @@ const references = [
'references/contribute/contribution-process',
'references/contribute/code-of-conduct',
'references/contribute/style-guide',
+ 'references/contribute/import-code-docs'
],
},
];
diff --git a/docs/examples/move/cryptography/Move.toml b/docs/examples/move/cryptography/Move.toml
new file mode 100644
index 00000000000..bb123539023
--- /dev/null
+++ b/docs/examples/move/cryptography/Move.toml
@@ -0,0 +1,10 @@
+[package]
+name = "cryptography"
+edition = "2024.beta"
+
+[dependencies]
+Iota = { local = "../../../../crates/iota-framework/packages/iota-framework" }
+Stardust = { local = "../../../../crates/iota-framework/packages/stardust" }
+
+[addresses]
+example = "0x0"
diff --git a/docs/examples/move/cryptography/sources/ecvrf.move b/docs/examples/move/cryptography/sources/ecvrf.move
new file mode 100644
index 00000000000..cc46ff5676a
--- /dev/null
+++ b/docs/examples/move/cryptography/sources/ecvrf.move
@@ -0,0 +1,13 @@
+module example::ecvrf {
+ use iota::ecvrf;
+ use iota::event;
+
+ /// Event on whether the output is verified
+ public struct VerifiedEvent has copy, drop {
+ is_verified: bool,
+ }
+
+ public fun verify_ecvrf_output(output: vector, alpha_string: vector, public_key: vector, proof: vector) {
+ event::emit(VerifiedEvent {is_verified: ecvrf::ecvrf_verify(&output, &alpha_string, &public_key, &proof)});
+ }
+}
\ No newline at end of file
diff --git a/docs/examples/move/cryptography/sources/goth16.move b/docs/examples/move/cryptography/sources/goth16.move
new file mode 100644
index 00000000000..71fa9a30d73
--- /dev/null
+++ b/docs/examples/move/cryptography/sources/goth16.move
@@ -0,0 +1,16 @@
+module example::groth16 {
+ use iota::groth16;
+ use iota::event;
+
+ /// Event on whether the proof is verified
+ public struct VerifiedEvent has copy, drop {
+ is_verified: bool,
+ }
+
+ public fun verify_proof(vk: vector, public_inputs_bytes: vector, proof_points_bytes: vector) {
+ let pvk = groth16::prepare_verifying_key(&groth16::bn254(), &vk);
+ let public_inputs = groth16::public_proof_inputs_from_bytes(public_inputs_bytes);
+ let proof_points = groth16::proof_points_from_bytes(proof_points_bytes);
+ event::emit(VerifiedEvent {is_verified: groth16::verify_groth16_proof(&groth16::bn254(), &pvk, &public_inputs, &proof_points)});
+ }
+}
\ No newline at end of file
diff --git a/docs/examples/move/cryptography/sources/hashing_iota.move b/docs/examples/move/cryptography/sources/hashing_iota.move
new file mode 100644
index 00000000000..aa414a78815
--- /dev/null
+++ b/docs/examples/move/cryptography/sources/hashing_iota.move
@@ -0,0 +1,18 @@
+module example::hashing_iota {
+ use iota::hash;
+
+ /// Object that holds the output hash value.
+ public struct Output has key, store {
+ id: UID,
+ value: vector
+ }
+
+ public fun hash_data(data: vector, recipient: address, ctx: &mut TxContext) {
+ let hashed = Output {
+ id: object::new(ctx),
+ value: hash::keccak256(&data),
+ };
+ // Transfer an output data object holding the hashed data to the recipient.
+ transfer::public_transfer(hashed, recipient)
+ }
+}
\ No newline at end of file
diff --git a/docs/examples/move/cryptography/sources/hashing_std.move b/docs/examples/move/cryptography/sources/hashing_std.move
new file mode 100644
index 00000000000..1e510a5ecb7
--- /dev/null
+++ b/docs/examples/move/cryptography/sources/hashing_std.move
@@ -0,0 +1,18 @@
+module example::hashing_std {
+ use std::hash;
+
+ /// Object that holds the output hash value.
+ public struct Output has key, store {
+ id: UID,
+ value: vector
+ }
+
+ public fun hash_data(data: vector, recipient: address, ctx: &mut TxContext) {
+ let hashed = Output {
+ id: object::new(ctx),
+ value: hash::sha2_256(data),
+ };
+ // Transfer an output data object holding the hashed data to the recipient.
+ transfer::public_transfer(hashed, recipient)
+ }
+}
\ No newline at end of file
diff --git a/docs/examples/move/evm-to-move/Move.toml b/docs/examples/move/evm-to-move/Move.toml
new file mode 100644
index 00000000000..23a76788d6a
--- /dev/null
+++ b/docs/examples/move/evm-to-move/Move.toml
@@ -0,0 +1,10 @@
+[package]
+name = "evm-to-move"
+edition = "2024.beta"
+
+[dependencies]
+Iota = { local = "../../../../crates/iota-framework/packages/iota-framework" }
+Stardust = { local = "../../../../crates/iota-framework/packages/stardust" }
+
+[addresses]
+example = "0x0"
diff --git a/docs/examples/move/evm-to-move/sources/coin_manager.move b/docs/examples/move/evm-to-move/sources/coin_manager.move
new file mode 100644
index 00000000000..8a11504e05d
--- /dev/null
+++ b/docs/examples/move/evm-to-move/sources/coin_manager.move
@@ -0,0 +1,35 @@
+module example::token {
+ use iota::coin;
+ use iota::coin_manager;
+
+ /// One-Time-Witness of kind: `Coin`
+ public struct TOKEN has drop {}
+
+ #[allow(lint(share_owned))]
+ fun init(witness: TOKEN, ctx: &mut TxContext) {
+ let (treasurycap, metadata) = coin::create_currency(
+ witness,
+ 6, // decimals
+ b"EXAMPLE", // symbol
+ b"Example Coin", // name
+ b"Just an example", // description
+ option::none(), // icon URL
+ ctx
+ );
+
+ // Creating the Manager, transferring ownership of the `TreasuryCap` to it
+ let (newtreasurycap, metacap, mut manager) = coin_manager::new(treasurycap, metadata, ctx);
+
+ // Limiting the maximum supply to `100`
+ newtreasurycap.enforce_maximum_supply(&mut manager, 100);
+
+ // Returning a new `CoinManagerTreasuryCap` to the creator of the `Coin`
+ transfer::public_transfer(newtreasurycap, ctx.sender());
+
+ // Returning a new `CoinManagerMetadataCap` to the creator of the `Coin`
+ transfer::public_transfer(metacap, ctx.sender());
+
+ // Publicly sharing the `CoinManager` object for convenient usage by anyone interested
+ transfer::public_share_object(manager);
+ }
+}
\ No newline at end of file
diff --git a/docs/examples/move/evm-to-move/sources/nft.move b/docs/examples/move/evm-to-move/sources/nft.move
new file mode 100644
index 00000000000..89a7272002f
--- /dev/null
+++ b/docs/examples/move/evm-to-move/sources/nft.move
@@ -0,0 +1,65 @@
+module example::examplenft {
+ use std::string;
+ use iota::event;
+
+ /// An example NFT that can be minted by anybody
+ public struct ExampleNFT has key, store {
+ id: UID,
+ /// Name for the token
+ name: string::String,
+ }
+
+ // ===== Events =====
+
+ public struct NFTMinted has copy, drop {
+ // The Object ID of the NFT
+ object_id: ID,
+ // The creator of the NFT
+ creator: address,
+ // The name of the NFT
+ name: string::String,
+ }
+
+ // ===== Public view functions =====
+
+ /// Get the NFT's `name`
+ public fun name(nft: &ExampleNFT): &string::String {
+ &nft.name
+ }
+
+ // ===== Entrypoints =====
+
+ #[allow(lint(self_transfer))]
+ /// Anyone can mint a new NFT on this one
+ public fun mint_to_sender(
+ name: vector,
+ ctx: &mut TxContext
+ ) {
+ let sender = tx_context::sender(ctx);
+ let nft = ExampleNFT {
+ id: object::new(ctx),
+ name: string::utf8(name)
+ };
+
+ event::emit(NFTMinted {
+ object_id: object::id(&nft),
+ creator: sender,
+ name: nft.name,
+ });
+
+ transfer::public_transfer(nft, sender);
+ }
+
+ /// Transfer `nft` to `recipient`
+ public fun transfer(
+ nft: ExampleNFT, recipient: address, _: &mut TxContext
+ ) {
+ transfer::public_transfer(nft, recipient)
+ }
+
+ /// Permanently delete `nft`
+ public fun burn(nft: ExampleNFT, _: &mut TxContext) {
+ let ExampleNFT { id, name: _} = nft;
+ object::delete(id)
+ }
+}
\ No newline at end of file
diff --git a/docs/examples/move/evm-to-move/sources/token.move b/docs/examples/move/evm-to-move/sources/token.move
new file mode 100644
index 00000000000..5e0b6979d57
--- /dev/null
+++ b/docs/examples/move/evm-to-move/sources/token.move
@@ -0,0 +1,24 @@
+module example::exampletoken {
+ use iota::coin;
+
+ /// One-Time-Witness of kind: `Coin`
+ public struct EXAMPLETOKEN has drop {}
+
+ fun init(witness: EXAMPLETOKEN, ctx: &mut TxContext) {
+ let (treasurycap, metadata) = coin::create_currency(
+ witness,
+ 6, // decimals
+ b"EXAMPLE", // symbol
+ b"Example Coin", // name
+ b"Just an example", // description
+ option::none(), // icon URL
+ ctx
+ );
+
+ // transfer the `TreasuryCap` to the sender, admin capabilities
+ transfer::public_transfer(treasurycap, tx_context::sender(ctx));
+
+ // metadata is typically frozen after creation
+ transfer::public_freeze_object(metadata);
+ }
+}
\ No newline at end of file
diff --git a/examples/move/first_package/Move.toml b/examples/move/first_package/Move.toml
index 24f267c9634..9003fc5d467 100644
--- a/examples/move/first_package/Move.toml
+++ b/examples/move/first_package/Move.toml
@@ -1,10 +1,36 @@
[package]
name = "first_package"
-version = "0.0.1"
-edition = "2024.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 (joesmith@noemail.com)", "John Snow (johnsnow@noemail.com)"]
[dependencies]
Iota = { local = "../../../crates/iota-framework/packages/iota-framework" }
+# For remote import, use the `{ git = "...", subdir = "...", rev = "..." }`.
+# Revision can be a branch, a tag, and a commit hash.
+# MyRemotePackage = { git = "https://some.remote/host.git", subdir = "remote/path", rev = "main" }
+
+# For local dependencies use `local = path`. Path is relative to the package root
+# Local = { local = "../path/to" }
+
+# To resolve a version conflict and force a specific version for dependency
+# override use `override = true`
+# Override = { local = "../conflicting/version", override = true }
+
[addresses]
first_package = "0x0"
+
+# Named addresses will be accessible in Move as `@name`. They're also exported:
+# for example, `std = "0x1"` is exported by the Standard Library.
+# alice = "0xA11CE"
+
+[dev-dependencies]
+# The dev-dependencies section allows overriding dependencies for `--test` and
+# `--dev` modes. You can introduce test-only dependencies here.
+# Local = { local = "../path/to/dev-build" }
+
+[dev-addresses]
+# The dev-addresses section allows overwriting named addresses for the `--test`
+# and `--dev` modes.
+# alice = "0xB0B"
diff --git a/examples/move/first_package/sources/example.move b/examples/move/first_package/sources/first_package.move
similarity index 86%
rename from examples/move/first_package/sources/example.move
rename to examples/move/first_package/sources/first_package.move
index a9f369a44a0..eb431da5c84 100644
--- a/examples/move/first_package/sources/example.move
+++ b/examples/move/first_package/sources/first_package.move
@@ -2,7 +2,7 @@
// Modifications Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0
-module first_package::example {
+module first_package::my_module {
public struct Sword has key, store {
id: UID,
@@ -62,6 +62,26 @@ module first_package::example {
#[test_only] const ALICE: address = @0xA;
#[test_only] const BOB: address = @0xB;
+ #[test]
+ public fun test_sword() {
+ // Create a dummy TxContext for testing.
+ let mut ctx = tx_context::dummy();
+
+ // Create a sword.
+ let sword = Sword {
+ id: object::new(&mut ctx),
+ magic: 42,
+ strength: 7,
+ };
+
+ // Check if accessor functions return correct values.
+ assert!(magic(&sword) == 42 && strength(&sword) == 7, 1)
+
+ // Create a dummy address and transfer the sword.
+ let dummy_address = @0xCAFE;
+ transfer::transfer(sword, dummy_address);
+ }
+
#[test]
public fun test_module_init() {
let mut ts = ts::begin(@0x0);
From 5e48fbdebf728fe1a2759fe5df1dbaf39dcad65e Mon Sep 17 00:00:00 2001
From: Samuel Rufinatscha
Date: Tue, 24 Sep 2024 17:02:52 +0200
Subject: [PATCH 07/11] fix(iota-graphql-rpc): Transform stored transaction for
genesis (#2836)
* fix: Stored transaction from genesis objects
* fix: Remove &mut
---
crates/iota-graphql-rpc/src/types/transaction_block.rs | 6 +++++-
crates/iota-indexer/src/indexer_reader.rs | 4 ++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/crates/iota-graphql-rpc/src/types/transaction_block.rs b/crates/iota-graphql-rpc/src/types/transaction_block.rs
index 512a3389bfc..271a429204f 100644
--- a/crates/iota-graphql-rpc/src/types/transaction_block.rs
+++ b/crates/iota-graphql-rpc/src/types/transaction_block.rs
@@ -442,7 +442,11 @@ impl TransactionBlock {
// Defer to the provided checkpoint_viewed_at, but if it is not provided, use
// the current available range. This sets a consistent upper bound for
// the nested queries.
- for stored in results {
+ for mut stored in results {
+ if stored.is_genesis() {
+ stored = stored.set_genesis_large_object_as_inner_data(db.inner.get_pool())?;
+ }
+
let cursor = stored.cursor(checkpoint_viewed_at).encode_cursor();
let inner = TransactionBlockInner::try_from(stored)?;
let transaction = TransactionBlock {
diff --git a/crates/iota-indexer/src/indexer_reader.rs b/crates/iota-indexer/src/indexer_reader.rs
index a9e541cc0a4..bcef95c8d7f 100644
--- a/crates/iota-indexer/src/indexer_reader.rs
+++ b/crates/iota-indexer/src/indexer_reader.rs
@@ -100,6 +100,10 @@ impl IndexerReader {
})
}
+ pub fn get_pool(&self) -> &crate::db::PgConnectionPool {
+ &self.pool
+ }
+
fn get_connection(&self) -> Result {
self.pool.get().map_err(|e| {
IndexerError::PgPoolConnectionError(format!(
From a810d8b53178e0a365800a752d9c397c86e2e797 Mon Sep 17 00:00:00 2001
From: "Eugene P."
Date: Wed, 25 Sep 2024 10:41:00 +0300
Subject: [PATCH 08/11] fix(wallet): update isMainAccount function. (#2814)
Signed-off-by: Eugene Panteleymonchuk
---
.../src/background/accounts/isMainAccount.ts | 26 +++++++++----------
1 file changed, 12 insertions(+), 14 deletions(-)
diff --git a/apps/wallet/src/background/accounts/isMainAccount.ts b/apps/wallet/src/background/accounts/isMainAccount.ts
index f329358f40b..0e385c52cf0 100644
--- a/apps/wallet/src/background/accounts/isMainAccount.ts
+++ b/apps/wallet/src/background/accounts/isMainAccount.ts
@@ -8,21 +8,19 @@ import { parseDerivationPath } from '_src/background/account-sources/bip44Path';
import type { SerializedUIAccount } from '_src/background/accounts/Account';
export function isMainAccount(account: SerializedUIAccount | null) {
- {
- if (!account) {
- return false;
- }
+ if (!account) {
+ return false;
+ }
- if (
- isLedgerAccountSerializedUI(account) ||
- isMnemonicSerializedUiAccount(account) ||
- isSeedSerializedUiAccount(account)
- ) {
- const { addressIndex, changeIndex, accountIndex } = parseDerivationPath(
- account.derivationPath,
- );
+ if (
+ isLedgerAccountSerializedUI(account) ||
+ isMnemonicSerializedUiAccount(account) ||
+ isSeedSerializedUiAccount(account)
+ ) {
+ const { addressIndex, changeIndex, accountIndex } = parseDerivationPath(
+ account.derivationPath,
+ );
- return addressIndex === 0 && changeIndex === 0 && accountIndex === 0;
- }
+ return addressIndex === 0 && changeIndex === 0 && accountIndex === 0;
}
}
From 872ba396f5d7d9da42591a6b874ac2df147623bf Mon Sep 17 00:00:00 2001
From: Mario
Date: Wed, 25 Sep 2024 11:43:04 +0200
Subject: [PATCH 09/11] fix(tooling-ci): Use turbo@2 in the packages diff
command (#2848)
---
.github/actions/turbo-diffs/action.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/actions/turbo-diffs/action.yml b/.github/actions/turbo-diffs/action.yml
index 516f1e549c9..9f4056f39cb 100644
--- a/.github/actions/turbo-diffs/action.yml
+++ b/.github/actions/turbo-diffs/action.yml
@@ -17,7 +17,7 @@ runs:
- id: changes
name: Detect changes
shell: bash
- run: echo "packages=$(pnpm --silent dlx turbo@1 run build --filter="...[origin/develop]" --dry=json | jq -c ".packages")" >> $GITHUB_OUTPUT
+ run: echo "packages=$(pnpm --silent dlx turbo@2 run build --filter="...[origin/develop]" --dry=json | jq -c ".packages")" >> $GITHUB_OUTPUT
- name: Print changes for easy debugging
shell: bash
run: echo ${{ steps.changes.outputs.packages }}
From 86af63a0d52000ebf4d79d91f86653e5baeef30a Mon Sep 17 00:00:00 2001
From: Marc Espin
Date: Wed, 25 Sep 2024 11:47:14 +0200
Subject: [PATCH 10/11] feat(wallet): Add RC Release workflow (#2847)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* feat(wallet): Add RC Release workflow
* refactor: dprint fmt
* refactor: Remove unnecessary permission
* refactor: Remove turbo cache
* Update turbo.json
* Update .github/workflows/apps-wallet-rc.build.yml
Co-authored-by: Begoña Álvarez de la Cruz
* refactor: Use RC env vars
* refactor: Rename RC env vars
---------
Co-authored-by: Begoña Álvarez de la Cruz
---
.github/workflows/apps-wallet-rc.build.yml | 47 +++++++++++++++++++
.../configs/webpack/webpack.config.common.ts | 4 +-
turbo.json | 14 ++++++
3 files changed, 63 insertions(+), 2 deletions(-)
create mode 100644 .github/workflows/apps-wallet-rc.build.yml
diff --git a/.github/workflows/apps-wallet-rc.build.yml b/.github/workflows/apps-wallet-rc.build.yml
new file mode 100644
index 00000000000..4c623b6ccb7
--- /dev/null
+++ b/.github/workflows/apps-wallet-rc.build.yml
@@ -0,0 +1,47 @@
+name: Build Wallet App (RC)
+
+on:
+ workflow_dispatch:
+ inputs:
+ iota_branch:
+ description: "IOTA repo release branch to build artifacts from"
+ type: string
+ required: true
+ rc_version:
+ description: "The RC numeric version (X.Y.Z.RC)"
+ type: number
+ required: true
+
+env:
+ DEFAULT_NETWORK: ${{ secrets.WALLET_RC_DEFAULT_NETWORK }}
+ IOTA_NETWORKS: ${{ secrets.WALLET_RC_IOTA_NETWORKS }}
+ APPS_BACKEND: ${{ secrets.WALLET_RC_APPS_BACKEND }}
+ RC_VERSION: "${{ github.event.inputs.rc_version }}"
+ WALLET_RC: "true"
+
+jobs:
+ wallet-rc-build:
+ permissions:
+ contents: read
+ runs-on: [self-hosted]
+ steps:
+ - name: Checking out ${{ env.iota_branch }}
+ uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # pin@v3
+ with:
+ ref: ${{ env.iota_branch }}
+ - uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # pin@v4.0.0
+ - name: Install Nodejs
+ uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # pin@v4.0.2
+ with:
+ node-version: "20"
+ cache: "pnpm"
+ - name: Install dependencies
+ run: pnpm install --frozen-lockfile
+ - name: Build Wallet
+ run: pnpm wallet build:rc
+ - name: Upload artifacts
+ uses: actions/upload-artifact@v4
+ with:
+ name: ${{ env.artifact_name }}
+ path: |
+ ./apps/wallet/dist
diff --git a/apps/wallet/configs/webpack/webpack.config.common.ts b/apps/wallet/configs/webpack/webpack.config.common.ts
index 3645f4e838a..bfe06d71863 100644
--- a/apps/wallet/configs/webpack/webpack.config.common.ts
+++ b/apps/wallet/configs/webpack/webpack.config.common.ts
@@ -41,10 +41,10 @@ function generateVersion(n: number | undefined) {
const sha = gitRevSync.short();
const packageVersion = packageJson.version;
const version = n !== undefined ? `${packageVersion}.${n}` : packageVersion;
- const improved_version = n !== undefined ? `${packageVersion}-rc.${n}` : packageVersion;
+ const version_name = n !== undefined ? `${packageVersion}-rc.${n}` : packageVersion;
return {
version,
- version_name: `${improved_version} (${sha})`,
+ version_name: `${version_name} (${sha})`,
};
}
diff --git a/turbo.json b/turbo.json
index a7fefbe13e4..81d6773f367 100644
--- a/turbo.json
+++ b/turbo.json
@@ -64,6 +64,20 @@
"!.next/cache/**",
"pkg/**"
]
+ },
+ "build:rc": {
+ "dependsOn": [
+ "^build"
+ ],
+ "outputs": [
+ "build/**",
+ "dist/**",
+ "storybook-static/**",
+ ".next/**",
+ "!.next/cache/**",
+ "pkg/**"
+ ]
}
+
}
}
From 065513f48226154d9d83bb89d7890e854565171f Mon Sep 17 00:00:00 2001
From: evavirseda
Date: Wed, 25 Sep 2024 12:26:50 +0200
Subject: [PATCH 11/11] feat(sdk): rebrand dapp-kit components (#2783)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* feat: refine button and modal
* feat: refine styles
* feat: style dropwdown
* feat: update text
* feat: add missing style
* fix format
* fix format
* feat: refine styles
* feat: add iota wallet logo
* fix: remove console.log
* chore: add changeset
---------
Co-authored-by: Begoña Alvarez
Co-authored-by: Branko Bosnic
---
.changeset/gold-bobcats-check.md | 5 +
.../wallet-dashboard/app/dashboard/layout.tsx | 37 ++-
apps/wallet-dashboard/app/globals.css | 22 +-
apps/wallet-dashboard/tailwind.config.ts | 1 +
.../dapp-interface/WalletStandardInterface.ts | 2 +-
.../src/components/AccountDropdownMenu.css.ts | 28 ++-
.../src/components/AccountDropdownMenu.tsx | 11 +-
sdk/dapp-kit/src/components/ConnectButton.tsx | 5 +-
.../src/components/WalletProvider.tsx | 15 +-
.../connect-modal/ConnectModal.css.ts | 75 ++----
.../components/connect-modal/ConnectModal.tsx | 117 ++-------
.../views/ConnectionStatus.css.ts | 36 ---
.../connect-modal/views/ConnectionStatus.tsx | 55 -----
.../connect-modal/views/GetTheWallet.css.ts | 38 +++
.../connect-modal/views/GetTheWallet.tsx | 25 ++
.../connect-modal/views/GettingStarted.css.ts | 26 --
.../connect-modal/views/GettingStarted.tsx | 40 ---
.../connect-modal/views/WalletConnect.css.ts | 55 +++++
.../connect-modal/views/WalletConnect.tsx | 79 ++++++
.../connect-modal/views/WhatIsAWallet.css.ts | 20 --
.../connect-modal/views/WhatIsAWallet.tsx | 24 --
.../components/connect-modal/views/index.ts | 5 +
.../wallet-list/WalletList.css.ts | 6 +-
.../connect-modal/wallet-list/WalletList.tsx | 36 +--
.../wallet-list/WalletListItem.css.ts | 20 +-
.../wallet-list/WalletListItem.tsx | 21 +-
.../src/components/icons/ArrowRightIcon.tsx | 23 ++
.../components/icons/ArrowTopRightIcon.tsx | 23 ++
.../src/components/icons/BackIcon.tsx | 18 --
.../src/components/icons/IotaIcon.tsx | 228 +++++++++++++++++-
.../src/components/styling/StyleMarker.css.ts | 15 ++
sdk/dapp-kit/src/components/ui/Button.css.ts | 8 +-
.../src/components/ui/IconButton.css.ts | 3 -
sdk/dapp-kit/src/components/ui/Text.css.ts | 2 +-
sdk/dapp-kit/src/constants/walletDefaults.ts | 5 +
sdk/dapp-kit/src/index.ts | 1 +
sdk/dapp-kit/src/themes/darkTheme.ts | 69 ++++++
sdk/dapp-kit/src/themes/lightTheme.ts | 53 ++--
sdk/dapp-kit/src/themes/themeContract.ts | 17 +-
.../test/components/ConnectButton.test.tsx | 2 +-
40 files changed, 748 insertions(+), 523 deletions(-)
create mode 100644 .changeset/gold-bobcats-check.md
delete mode 100644 sdk/dapp-kit/src/components/connect-modal/views/ConnectionStatus.css.ts
delete mode 100644 sdk/dapp-kit/src/components/connect-modal/views/ConnectionStatus.tsx
create mode 100644 sdk/dapp-kit/src/components/connect-modal/views/GetTheWallet.css.ts
create mode 100644 sdk/dapp-kit/src/components/connect-modal/views/GetTheWallet.tsx
delete mode 100644 sdk/dapp-kit/src/components/connect-modal/views/GettingStarted.css.ts
delete mode 100644 sdk/dapp-kit/src/components/connect-modal/views/GettingStarted.tsx
create mode 100644 sdk/dapp-kit/src/components/connect-modal/views/WalletConnect.css.ts
create mode 100644 sdk/dapp-kit/src/components/connect-modal/views/WalletConnect.tsx
delete mode 100644 sdk/dapp-kit/src/components/connect-modal/views/WhatIsAWallet.css.ts
delete mode 100644 sdk/dapp-kit/src/components/connect-modal/views/WhatIsAWallet.tsx
create mode 100644 sdk/dapp-kit/src/components/connect-modal/views/index.ts
create mode 100644 sdk/dapp-kit/src/components/icons/ArrowRightIcon.tsx
create mode 100644 sdk/dapp-kit/src/components/icons/ArrowTopRightIcon.tsx
delete mode 100644 sdk/dapp-kit/src/components/icons/BackIcon.tsx
create mode 100644 sdk/dapp-kit/src/themes/darkTheme.ts
diff --git a/.changeset/gold-bobcats-check.md b/.changeset/gold-bobcats-check.md
new file mode 100644
index 00000000000..99e18ec0a8a
--- /dev/null
+++ b/.changeset/gold-bobcats-check.md
@@ -0,0 +1,5 @@
+---
+'@iota/dapp-kit': minor
+---
+
+Rebrand
diff --git a/apps/wallet-dashboard/app/dashboard/layout.tsx b/apps/wallet-dashboard/app/dashboard/layout.tsx
index 7cd36c639ce..ac56873f2b4 100644
--- a/apps/wallet-dashboard/app/dashboard/layout.tsx
+++ b/apps/wallet-dashboard/app/dashboard/layout.tsx
@@ -2,31 +2,42 @@
// SPDX-License-Identifier: Apache-2.0
'use client';
-import { Notifications, RouteLink } from '@/components/index';
-import React, { type PropsWithChildren } from 'react';
+import { Button, Notifications, RouteLink } from '@/components/index';
+import React, { useState, type PropsWithChildren } from 'react';
import { ConnectButton } from '@iota/dapp-kit';
+const routes = [
+ { title: 'Home', path: '/dashboard/home' },
+ { title: 'Assets', path: '/dashboard/assets' },
+ { title: 'Staking', path: '/dashboard/staking' },
+ { title: 'Apps', path: '/dashboard/apps' },
+ { title: 'Activity', path: '/dashboard/activity' },
+ { title: 'Migrations', path: '/dashboard/migrations' },
+ { title: 'Vesting', path: '/dashboard/vesting' },
+];
+
function DashboardLayout({ children }: PropsWithChildren): JSX.Element {
- const routes = [
- { title: 'Home', path: '/dashboard/home' },
- { title: 'Assets', path: '/dashboard/assets' },
- { title: 'Staking', path: '/dashboard/staking' },
- { title: 'Apps', path: '/dashboard/apps' },
- { title: 'Activity', path: '/dashboard/activity' },
- { title: 'Migrations', path: '/dashboard/migrations' },
- { title: 'Vesting', path: '/dashboard/vesting' },
- ];
+ const [isDarkMode, setIsDarkMode] = useState(false);
+
+ const toggleDarkMode = () => {
+ setIsDarkMode(!isDarkMode);
+ if (isDarkMode) {
+ document.documentElement.classList.remove('dark');
+ } else {
+ document.documentElement.classList.add('dark');
+ }
+ };
// TODO: check if the wallet is connected and if not redirect to the welcome screen
return (
<>
-
-
{routes.map((route) => {
return ;
})}
+
+
-
- We recommend pinning Iota Wallet to your taskbar for quicker access.
-
-
- Be sure to back up your wallet using a secure method. Never share your secret
- phrase with anyone.
-
-
- Once you set up your wallet, refresh this window browser to load up the
- extension.
-
-
-
- No need to create new accounts and passwords for every website. Just connect
- your wallet and get going.
-
-
- Send, receive, store, and display your digital assets like NFTs & coins.
-
-