From 2d52a43d500050fa17a2c4c946357a796d22512b Mon Sep 17 00:00:00 2001 From: Philipp Gackstatter Date: Tue, 13 Aug 2024 16:17:49 +0200 Subject: [PATCH 1/7] docs: Proofread Standards docs (#1668) * fix(docs): Typos in Standards section * fix(docs): Fix typos and broken links in coin docs * fix(docs): Typos in CoinManager doc * feat(docs): Add missing PTBs to kiosk docs * fix(docs): Typos in kiosk apps * fix(docs): Fix typos and consistency * fix(docs): Convert tabs to spaces * fix(docs): Typos in wallet standard * fix(docs): JavaScript examples * fix(docs): Make Move examples syntactically correct * fix(docs): Put overview on Standards header * fix(docs): update link to Standards in developer documentation * Update docs/content/sidebars/developer.js Co-authored-by: Dr-Electron * fix(docs): Auto generate standards overview * fix(docs): More move warning fixes * fix(docs): Use `programmable_move_call` instead of command --------- Co-authored-by: Thibault Martinez Co-authored-by: Dr-Electron --- docs/content/developer/developer.mdx | 4 +- .../developer/standards/closed-loop-token.mdx | 4 +- .../closed-loop-token/action-request.mdx | 4 +- .../standards/closed-loop-token/rules.mdx | 5 +- .../standards/closed-loop-token/spending.mdx | 2 +- .../developer/standards/coin-manager.mdx | 54 +++++---- docs/content/developer/standards/coin.mdx | 17 +-- docs/content/developer/standards/display.mdx | 90 +++++++-------- .../developer/standards/kiosk-apps.mdx | 79 +++++++------ docs/content/developer/standards/kiosk.mdx | 109 +++++++++++++----- .../content/developer/standards/standards.mdx | 15 --- .../developer/standards/wallet-standard.mdx | 80 ++++++------- docs/content/sidebars/developer.js | 7 +- 13 files changed, 259 insertions(+), 211 deletions(-) delete mode 100644 docs/content/developer/standards/standards.mdx diff --git a/docs/content/developer/developer.mdx b/docs/content/developer/developer.mdx index 747e751157a..a5dc0b0e1e3 100644 --- a/docs/content/developer/developer.mdx +++ b/docs/content/developer/developer.mdx @@ -39,7 +39,7 @@ Go to [Cryptography](cryptography.mdx). Utilizing standards while developing applications is very important for composability. In this section you can find out all about the standards within the IOTA Move ecosystem for dealing with tokens, NFT like objects, and wallets. -Go to the [Standards](standards/standards.mdx). +Go to the [Standards](/developer/standards). ## Advanced Topics @@ -69,4 +69,4 @@ Go to [Migrating from IOTA/Shimmer Stardust](stardust/stardust-migration.mdx). This section contains the technical details needed to integrate IOTA on a exchange. -Go to [Exchange integration](exchange-integration/exchange-integration.mdx). \ No newline at end of file +Go to [Exchange integration](exchange-integration/exchange-integration.mdx). diff --git a/docs/content/developer/standards/closed-loop-token.mdx b/docs/content/developer/standards/closed-loop-token.mdx index d8a36fc16fe..cad0586b726 100644 --- a/docs/content/developer/standards/closed-loop-token.mdx +++ b/docs/content/developer/standards/closed-loop-token.mdx @@ -2,13 +2,13 @@ title: Closed-Loop Token --- -Using the Closed-Loop Token standard, you can limit the applications that can use the token and set up custom policies for transfers, spends, and conversions. The [`iota::token` module](https://github.com/iotaledger/iota/blob/main/crates/iota-framework/docs/iota-framework/token.md) in the IOTA framework defines the standard. +Using the Closed-Loop Token standard, you can limit the applications that can use the token and set up custom policies for transfers, spends, and conversions. The [`iota::token` module](../../references/framework/iota-framework/token.mdx) in the IOTA framework defines the standard. ## Background and use cases The [Coin standard](coin.mdx) on IOTA is an example of an open-loop system - coins are free-flowing, [wrappable](../iota-101/objects/object-ownership/wrapped.mdx), [freely transferable](../iota-101/objects/transfers/custom-rules.mdx#the-store-ability-and-transfer-rules) and you can store them in any application. The best real world analogy would be cash - hardly regulated and can be freely used and passed. -Some applications, however, require constraining the scope of the token to a specific purpose. For example, some applications might need a token that you can only use for a specific service, or that an authorized account can only use, or a token that you can block certain accounts from using. A real-world analogy would be a bank account - regulated, bank-controlled, and compliant with certain rules and policies. +Some applications, however, require constraining the scope of the token to a specific purpose. For example, some applications might need a token that you can only use for a specific service, or that only an authorized account can use, or a token that you can block certain accounts from using. A real-world analogy would be a bank account - regulated, bank-controlled, and compliant with certain rules and policies. ## Difference with Coin diff --git a/docs/content/developer/standards/closed-loop-token/action-request.mdx b/docs/content/developer/standards/closed-loop-token/action-request.mdx index 2bc9f9a9f91..582fb781440 100644 --- a/docs/content/developer/standards/closed-loop-token/action-request.mdx +++ b/docs/content/developer/standards/closed-loop-token/action-request.mdx @@ -146,7 +146,7 @@ tx.moveCall({ ### Confirming with TokenPolicyCap -Use `TokenPolicyCap` to confirm action requests. A convenient approach when the `TreasuryCap` is wrapped in another object, and `TokenPolicy` does not allow certain action or has rules that make the default way of confirming impossible. +Use `TokenPolicyCap` to confirm action requests. A convenient approach when the `TreasuryCap` is wrapped in another object, and `TokenPolicy` does not allow a certain action or has rules that make the default way of confirming impossible. :::info @@ -192,7 +192,7 @@ tx.moveCall({ ## Approving actions -`ActionRequest`s can collect approvals - witness stamps from applications or rules. They carry the confirmation that a certain module or a rule has approved the action. This mechanic allows gating actions behind certain requirements. +`ActionRequest`s can collect approvals - witness stamps from applications or rules. They carry the confirmation that a certain module or a rule has approved the action. This mechanism allows gating actions behind certain requirements. The signature for the `token::add_approval` function is: diff --git a/docs/content/developer/standards/closed-loop-token/rules.mdx b/docs/content/developer/standards/closed-loop-token/rules.mdx index 3fd38e46619..f9bb9488633 100644 --- a/docs/content/developer/standards/closed-loop-token/rules.mdx +++ b/docs/content/developer/standards/closed-loop-token/rules.mdx @@ -10,7 +10,7 @@ A rule is represented as a witness - a type with a `drop` ability. You can eithe ```move /// The Rule type -struct Rule has drop {} +public struct Rule has drop {} ``` After you [add a rule](token-policy.mdx#adding-rules) to an action in the `TokenPolicy`, the action requires a stamp of the rule to pass confirmation. @@ -25,11 +25,10 @@ A rule module is a regular module with a `verify`-like function that typically t ```move module example::pass_rule { - use iota::tx_context; use iota::token::{Self, ActionRequest, TokenPolicy}; /// The Rule type - struct Pass has drop {} + public struct Pass has drop {} /// Add approval from the Pass rule to the ActionRequest public fun verify( diff --git a/docs/content/developer/standards/closed-loop-token/spending.mdx b/docs/content/developer/standards/closed-loop-token/spending.mdx index 5d28ee32023..5f09f149eb4 100644 --- a/docs/content/developer/standards/closed-loop-token/spending.mdx +++ b/docs/content/developer/standards/closed-loop-token/spending.mdx @@ -28,7 +28,7 @@ Normally, the `spend` action should have at least one rule assigned to it to pre ```move /// Rule-like witness to stamp the ActionRequest -struct GiftShop has drop {} +public struct GiftShop has drop {} /// Spend the token and return a Gift + ActionRequest public fun buy_gift( diff --git a/docs/content/developer/standards/coin-manager.mdx b/docs/content/developer/standards/coin-manager.mdx index 88fdf2f3041..f554129df08 100644 --- a/docs/content/developer/standards/coin-manager.mdx +++ b/docs/content/developer/standards/coin-manager.mdx @@ -21,15 +21,15 @@ By having your `Coin` managed by a `CoinManager`, you gain the following functio - Both management caps can transparently be renounced through the `CoinManager` so that everyone on-chain can know that the supply and metadata are immutable, Offering end-users clarity and assurance. - A `CoinManagerTreasuryCap`-owned object will allow you to set a maximum supply for a coin. This will ensure that once set (a one-time, irrevocable action), there will never be any more tokens minted as the provided maximum supply. This offers assurances to the end-user about the asset they are interested in. - A custom additional Metadata object can be provided, allowing coins to have more data than just the standard fields provided by the default `Metadata` object. The existing metadata object will stay the same and remain fully compatible. -- The total supply of a given `Coin` type, the maximum supply, and the metadata can be transparently queried through the `CoinManager` by anyone interested, not just the `TreauryCap` owner. +- The total supply of a given `Coin` type, the maximum supply, and the metadata can be transparently queried through the `CoinManager` by anyone interested, not just the `TreasuryCap` owner. -With a `CoinManager` in place, you can offer assurances to whoever uses your `Coin` that can not be offered with just a regular `Coin` and `TreasuryCap`. We recommend every new coin utilize the `CoinManager.` Any existing coin can be managed by a `CoinManager` as long as the `TreasuryCap` object for that `Coin` is still in possession. +With a `CoinManager` in place, you can offer assurances to whoever uses your `Coin` that can not be offered with just a regular `Coin` and `TreasuryCap`. We recommend every new coin utilize the `CoinManager`. Any existing coin can be managed by a `CoinManager` as long as the `TreasuryCap` object for that `Coin` is still in possession. -## How To Manage A `Coin` With A `CoinManager` +## How To Manage a `Coin` With a `CoinManager` ### New `Coin` Assets -When you are starting a new `Coin` type and wish to use the `CoinManager` you can use the `CoinManager` directly to create this `Coin`. You will receive back the `CoinManagerTreasuryCap` and a `CoinManagerMetadataCap` to perform any follow-up management actions: +When you are creating a new `Coin` type and wish to use the `CoinManager` you can use the `CoinManager` directly to create this `Coin`. You will receive back the `CoinManagerTreasuryCap` and a `CoinManagerMetadataCap` to perform any follow-up management actions: ```move module example::exclusive_coin { @@ -37,10 +37,9 @@ module example::exclusive_coin { public struct EXCLUSIVE_COIN has drop {} - #[allow(lint(share_owned))] fun init(witness: EXCLUSIVE_COIN, ctx: &mut TxContext) { // Create a `Coin` type and have it managed. - let (cm_treasury_cap, cm_meta_cap, mut manager) = coin_manager::create( + let (cm_treasury_cap, cm_meta_cap, manager) = coin_manager::create( witness, 0, b"EXCL", @@ -50,13 +49,13 @@ module example::exclusive_coin { ctx ); - // Returning a new `CoinManagerTreasuryCap` to the creator of the `Coin` + // Transfer the `CoinManagerTreasuryCap` to the creator of the `Coin`. transfer::public_transfer(cm_treasury_cap, ctx.sender()); - // Returning a new `CoinManagerMetadataCap` to the creator of the `Coin` + // Transfer the `CoinManagerMetadataCap` to the creator of the `Coin`. transfer::public_transfer(cm_meta_cap, ctx.sender()); - // Publicly sharing the `CoinManager` object for convenient usage by anyone interested + // Publicly share the `CoinManager` object for convenient usage by anyone interested. transfer::public_share_object(manager); } } @@ -71,12 +70,12 @@ If you already have an existing `Coin`, you can create the `CoinManager` object If you already froze the `Metadata` object you can only migrate to a `CoinManager` that has immutable metadata from the start. You will not receive a `CoinManagerMetadataCap` in return, but you will get a `CoinManagerTreasuryCap`: ```move -let (cm_treasury_cap, mut manager) = coin_manager::new_with_immutable_metadata(cap, &meta, ctx); +let (cm_treasury_cap, manager) = coin_manager::new_with_immutable_metadata(cap, &meta, ctx); -// Returning a new `CoinManagerTreasuryCap` to the creator of the `Coin` +// Transfer the `CoinManagerTreasuryCap` to the creator of the `Coin`. transfer::public_transfer(cm_treasury_cap, ctx.sender()); -// Publicly sharing the `CoinManager` object for convenient usage by anyone interested +// Publicly share the `CoinManager` object for convenient usage by anyone interested. transfer::public_share_object(manager); ``` #### With mutable metadata @@ -84,15 +83,15 @@ transfer::public_share_object(manager); If the metadata object is still owned, you can take advantage of the full functionality of the `CoinManager` with mutable `Metadata`: ```move -let (cm_treasury_cap, cm_meta_cap, mut manager) = coin_manager::new(cap, meta, ctx); +let (cm_treasury_cap, cm_meta_cap, manager) = coin_manager::new(cap, meta, ctx); -// Returning a new `CoinManagerTreasuryCap` to the creator of the `Coin` +// Transfer the `CoinManagerTreasuryCap` to the creator of the `Coin`. transfer::public_transfer(cm_treasury_cap, ctx.sender()); -// Returning a new `CoinManagerMetadataCap` to the creator of the `Coin` +// Transfer the `CoinManagerMetadataCap` to the creator of the `Coin`. transfer::public_transfer(cm_meta_cap, ctx.sender()); -// Publicly sharing the `CoinManager` object for convenient usage by anyone interested +// Publicly share the `CoinManager` object for convenient usage by anyone interested. transfer::public_share_object(manager); ``` @@ -103,10 +102,10 @@ Once the `CoinManager` has been created and publicly shared you can make use of ### Retrieving metadata ```move -/// Get the decimals for a Coin managed by this manager, without needing the Metadata object +/// Get the decimals for the `Coin` of this manager, without needing the Metadata object. let decimals = manager.decimals(); -/// See if the Metadata is immutable or if it can still be changed later: +/// See if the Metadata is immutable or if it can still be changed later. let immutabe = manager.metadata_is_immutable(); ``` @@ -118,17 +117,17 @@ let max_supply = manager.maximum_supply(); let remaining_supply = manager.available_supply(); let has_maximum_supply = manager.has_maximum_supply(); let supply_reference = manager.supply_immut(); -let immutabe = manager.supply_is_immutable(); +let supply_is_immutable = manager.supply_is_immutable(); ``` ### Minting ```move -/// Minting more coins, if allowed +/// Mint more coins, if allowed. let coin = coin_manager_treasury_cap.mint(&mut manager, 100, ctx); ``` -Next to minting the same functionality is available that usually is available on the `TreasuryCap` like `burn`, `mint_balance`, and `mint_and_transfer`. +Next to minting, the same functionality is available that usually is available on the `TreasuryCap` like `burn`, `mint_balance` and `mint_and_transfer`. ### Updating Metadata @@ -143,10 +142,10 @@ coin_manager_metadata_cap.update_symbol(&mut manager, "NEW"); By renouncing ownership (handing in your cap(s)), you provide assurances for your `Coin` type to its users. Users can check if a `Coin` type has an immutable supply or metadata on-chain. ```move -/// Turns the supply immutable, no more minting or max. supply changes +/// Turns the supply immutable. No more minting or maximum supply changes. coin_manager_treasury_cap.renounce_ownership(&mut manager); -/// Turns the metadata immutable +/// Turns the metadata immutable. coin_manager_metadata_cap.renounce_ownership(&mut manager); ``` @@ -169,15 +168,14 @@ let version = wrapper.additional_metadata().version; If you wish to update or replace your custom Metadata object with a new one (of the same type or another), you can do so using the `replace_additional_metadata` function, which returns the old Metadata object: ```move - public struct NewCustomMetadata has store { - website: Url, - is_amazing: bool + website: Url, + is_amazing: bool } let new_meta = NewCustomMetadata { - website: url::new_unsafe(string(b"https://iota.org")), - is_amazing: true + website: url::new_unsafe(string(b"https://iota.org")), + is_amazing: true }; let oldmeta = metacap.replace_additional_metadata(&mut wrapper, new_meta); diff --git a/docs/content/developer/standards/coin.mdx b/docs/content/developer/standards/coin.mdx index 5276c3597dd..3a566ba903a 100644 --- a/docs/content/developer/standards/coin.mdx +++ b/docs/content/developer/standards/coin.mdx @@ -174,14 +174,15 @@ let deny_list = ptb.obj(ObjectArg::SharedObject { mutable: true, })?; let deny_cap = ptb.obj(ObjectArg::ImmOrOwnedObject(deny_cap))?; -let address = ptb.pure(cmd.address())?; -ptb.command(Command::move_call( +let address_to_ban = IotaAddress::from_str("0x...")?; +let address_to_ban_arg = ptb.pure(address_to_ban)?; +ptb.programmable_move_call( IOTA_FRAMEWORK_PACKAGE_ID, Identifier::from(COIN_MODULE_NAME), - Identifier::from_str("deny_list_add".to_string())?, + Identifier::from_str("deny_list_add")?, vec![], - vec![deny_list, deny_cap, address], -)); + vec![deny_list, deny_cap, address_to_ban_arg], +); let builder = ptb.finish(); ``` @@ -191,7 +192,7 @@ let builder = ptb.finish(); - `SequenceNumber` is the `initial_shared_version` of the `DenyList` singleton. - `deny_cap` is the `ObjectRef` (`(ObjectID, SequenceNumber, ObjectDigest)`) of the `DenyCap` the publisher has received. - `otw_type` is the `TypeTag` created from `::regulated_coin::REGULATED_COIN` type. -- `cmd.address()` returns the address to ban as a `IOTAAddress`. +- `address_to_ban` is the address to ban as an `IotaAddress`. @@ -266,6 +267,6 @@ Check out the following content for more information about coins and tokens on I - [Create a Coin](../iota-101/create-coin/create-coin.mdx): Guide for creating coins and regulated coins in your smart contracts. - [Closed-Loop Token Standard](closed-loop-token.mdx): Details the Token standard on IOTA. -- [`coin` module rustdoc documentation](https://github.com/iotaledger/iota/blob/main/crates/iota-framework/docs/iota-framework/coin.md): Automated documentation output for the IOTA framework `coin` module. -- [`token` module rustdoc documentation](https://github.com/iotaledger/iota/blob/main/crates/iota-framework/docs/iota-framework/token.md): Automated documentation output for the IOTA framework `token` module. +- [`coin` module documentation](../../references/framework/iota-framework/coin.mdx): Automated documentation output for the IOTA framework `coin` module. +- [`token` module documentation](../../references/framework/iota-framework/token.mdx): Automated documentation output for the IOTA framework `token` module. - [Tokenomics](../../about-iota/tokenomics.mdx): Discover the IOTA ecosystem and where IOTA coins fit within it. \ No newline at end of file diff --git a/docs/content/developer/standards/display.mdx b/docs/content/developer/standards/display.mdx index 5a69306960e..8c4d35c1f26 100644 --- a/docs/content/developer/standards/display.mdx +++ b/docs/content/developer/standards/display.mdx @@ -7,7 +7,7 @@ The IOTA Object Display standard is a template engine that enables on-chain mana Use a `Publisher` object that you own to set `iota::display` for a type. For more information about `Publisher` objects, see [Publisher](https://examples.iota.io/basics/publisher.html) topic in *IOTA Move by Example*. -In IOTA Move, `Display` represents an object that specifies a set of named templates for the type `T`. For example, for a type `0x2::capy::Capy` the display syntax is: `Display<0x2::capy::Capy>`. +In IOTA Move, `Display` represents an object that specifies a set of named templates for the type `T`. For example, for a type `0x2::hero::Hero` the display syntax is: `Display<0x2::hero::Hero>`. IOTA Full nodes process all objects of the type `T` by matching the `Display` definition, and return the processed result when you query an object with the `{ showDisplay: true }` setting in the query. @@ -45,24 +45,21 @@ The following represents the template the `init` function defines: /// to use it to get the `Display` object - a way to describe a /// type for the ecosystem. module examples::my_hero { - use iota::tx_context::{sender, TxContext}; use std::string::{utf8, String}; - use iota::transfer; - use iota::object::{Self, UID}; // The creator bundle: these two packages often go together. use iota::package; use iota::display; /// The Hero - an outstanding collection of digital art. - struct Hero has key, store { + public struct Hero has key, store { id: UID, name: String, image_url: String, } /// One-Time-Witness for the module. - struct MY_HERO has drop {} + public struct MY_HERO has drop {} /// In the module initializer one claims the `Publisher` object /// to then create a `Display`. The `Display` is initialized with @@ -82,17 +79,17 @@ module examples::my_hero { ]; let values = vector[ - // For `name` one can use the `Hero.name` property + // For `name` one can use the `Hero.name` property. utf8(b"{name}"), - // For `link` one can build a URL using an `id` property + // For `link` one can build a URL using an `id` property. utf8(b"https://iota-heroes.io/hero/{id}"), // For `image_url` use an IPFS template + `image_url` property. utf8(b"ipfs://{image_url}"), // Description is static for all `Hero` objects. utf8(b"A true Hero of the IOTA ecosystem!"), - // Project URL is usually static + // Project URL is usually static. utf8(b"https://iota-heroes.io"), - // Creator field can be any + // Creator field can be any. utf8(b"Unknown IOTA Fan") ]; @@ -100,15 +97,15 @@ module examples::my_hero { let publisher = package::claim(otw, ctx); // Get a new `Display` object for the `Hero` type. - let display = display::new_with_fields( + let mut display = display::new_with_fields( &publisher, keys, values, ctx ); // Commit first version of `Display` to apply changes. display::update_version(&mut display); - transfer::public_transfer(publisher, sender(ctx)); - transfer::public_transfer(display, sender(ctx)); + transfer::public_transfer(publisher, ctx.sender()); + transfer::public_transfer(display, ctx.sender()); } /// Anyone can mint their `Hero`! @@ -137,17 +134,17 @@ After you create the `Display`, you can modify it. The following code sample dem ```move module iota::display { - /// Sets multiple fields at once + /// Sets multiple fields at once. public fun add_multiple( self: &mut Display, keys: vector, values: vector ) { /* ... */ } - /// Edit a single field + /// Edit a single field. public fun edit(self: &mut Display, key: String, value: String) { /* ... */ } - /// Remove a key from Display + /// Remove a key from Display. public fun remove(self: &mut Display, key: String ) { /* ... */ } } ``` @@ -168,14 +165,15 @@ module iota::display { In IOTA, utility objects enable authorization for capabilities. Almost all modules have features that can be accessed only with the required capability. Generic modules allow one capability per application, such as a marketplace. Some capabilities mark ownership of a shared object on-chain, or access the shared data from another account. With capabilities, it is important to provide a meaningful description of objects to facilitate user interface implementation. This helps avoid accidentally transferring the wrong object when objects are similar. It also provides a user-friendly description of items that users see. -The following example demonstrates how to create a capy capability: +The following example demonstrates how to create a pet capability: ```move -module capy::utility { - /// A capability which grants Capy Manager permission to add - /// new genes and manage the Capy Market - struct CapyManagerCap has key, store { - id: UID } +module pet::utility { + /// A capability which grants Pet Manager permission to add + /// new genes and manage the Pet Market. + public struct PetManagerCap has key, store { + id: UID + } } ``` @@ -184,36 +182,36 @@ module capy::utility { A common case with in-game items is to have a large number of similar objects grouped by some criteria. It is important to optimize their size and the cost to mint and update them. Typically, a game uses a single source image or URL per group or item criteria. Storing the source image inside of every object is not optimal. In some cases, users mint in-game items when a game allows them or when they purchase an in-game item. To enable this, some IPFS/Arweave metadata must be created and stored in advance. This requires additional logic that is usually not related to the in-game properties of the item. -The following example demonstrates how to create a Capy: +The following example demonstrates how to create a Pet: ```move -module capy::capy_items { - /// A wearable Capy item. For some items there can be an - /// unlimited supply. And items with the same name are identical. - struct CapyItem has key, store { +module pet::pet_items { + /// A wearable Pet item. For some items there can be an + /// unlimited supply. And items with the same name are identical. + public struct PetItem has key, store { id: UID, name: String - } + } } ``` ## Unique objects with dynamic representation -IOTA Capys use dynamic image generation. When a Capy is born, its attributes determine the Capy’s appearance, such as color or pattern. When a user puts an item on a Capy, the Capy’s appearance changes. When users put multiple items on a Capy, there’s a chance of a bonus for a combination of items. +IOTA Pets use dynamic image generation. When a Pet is born, its attributes determine the Pet’s appearance, such as color or pattern. When a user puts an item on a Pet, the Pet’s appearance changes. When users put multiple items on a Pet, there’s a chance of a bonus for a combination of items. -To implement this, the Capys game API service refreshes the image in response to a user-initiated change. The URL for a Capy is a template with the `capy.id`. But storing the full URL - as well as other fields in the Capy object due to their diverse population - also leads to users paying for excess storage and increased gas fees. +To implement this, the Pet's game API service refreshes the image in response to a user-initiated change. The URL for a Pet is a template with the `pet.id`. But storing the full URL - as well as other fields in the Pet object due to their diverse population - also leads to users paying for excess storage and increased gas fees. The following example demonstrates how to implement dynamic image generation: ```move -module capy::capy { - /// A Capy - very diverse object with different combination - /// of genes. Created dynamically + for images a dynamic SVG - /// generation is used. - struct Capy has key, store { - id: UID, - genes: vector - } +module pet::pet { + /// A Pet - very diverse object with different combination + /// of genes. Created dynamically. For images, a dynamic SVG + /// generation is used. + public struct Pet has key, store { + id: UID, + genes: vector + } } ``` @@ -223,13 +221,13 @@ This is the simplest scenario - an object represents everything itself. It is ve ```move module iota::devnet_nft { - /// A Collectible with a static data. URL, name, description are - /// set only once on a mint event - struct DevNetNFT has key, store { - id: UID, - name: String, - description: String, - url: Url, - } + /// A Collectible with static data. + /// URL, name and description are set only once during minting. + public struct DevNetNFT has key, store { + id: UID, + name: String, + description: String, + url: Url, + } } ``` diff --git a/docs/content/developer/standards/kiosk-apps.mdx b/docs/content/developer/standards/kiosk-apps.mdx index 2580f81172d..ce5d149ec86 100644 --- a/docs/content/developer/standards/kiosk-apps.mdx +++ b/docs/content/developer/standards/kiosk-apps.mdx @@ -12,24 +12,21 @@ There are two types of apps: ## Basic apps -Basic Kiosk apps do not require Kiosk Apps API to function. They usually serve the purpose of adding custom metadata to a kiosk or wrapping/working with existing objects such as `Kiosk` or `KioskOwnerCap`. An example of an app that does not require the API is the Personal Kiosk app. +Basic Kiosk apps do not require the Kiosk Apps API to function. They usually serve the purpose of adding custom metadata to a kiosk or wrapping/working with existing objects such as `Kiosk` or `KioskOwnerCap`. An example of an app that does not require the API is the Personal Kiosk app. -### UID access via the uid_mut +### UID access via `uid_mut` Kiosk has an `id: UID` field like all objects on IOTA, which allows this object to be uniquely identified and carry custom dynamic fields and dynamic object fields. The Kiosk itself is built around dynamic fields and features like place and list are built around dynamic object fields. -### The uid_mut_as_owner function +### The `uid_mut_as_owner` function -Kiosk can carry additional dynamic fields and dynamic object fields. The `uid_mut_as_owner` function allows the Kiosk owner to mutably access the UID of the Kiosk object and use it to add or remove custom fields. +A Kiosk can carry additional dynamic fields and dynamic object fields. The `uid_mut_as_owner` function allows the Kiosk owner to mutably access the `UID` of the Kiosk object and use it to add or remove custom fields. -Function signature: +Its function signature is: `kiosk::uid_mut_as_owner(self: &mut Kiosk, cap: &KioskOwnerCap): &mut UID` +### The public UID getter -`kiosk::uid_mut_as_owner(self: &mut Kiosk, cap: &KioskOwnerCap): &mut UID` - -### The public uid getter - -Anyone can read the `uid` of kiosks. This allows third party modules to read the fields of the kiosk if they're allowed to do so. Therefore enabling the object capability and other patterns. +Anyone can read the `UID` of kiosks. This allows third party modules to read the fields of the kiosk if they're allowed to do so. Therefore enabling the object capability and other patterns. ### Basic app ideas @@ -38,20 +35,19 @@ You can attach custom dynamic fields to your kiosks that anyone can then read (b ```move module examples::kiosk_name_ext { use std::string::String; - use std::option::{Self, Option}; use iota::dynamic_field as df; use iota::kiosk::{Self, Kiosk, KioskOwnerCap}; - /// The dynamic field key for the Kiosk Name Extension - struct KioskName has copy, store, drop {} + /// The dynamic field key for the Kiosk Name extension. + public struct KioskName has copy, store, drop {} - /// Add a name to the Kiosk (in this implementation can be called only once) + /// Add a name to the Kiosk (in this implementation it can be called only once). public fun add(self: &mut Kiosk, cap: &KioskOwnerCap, name: String) { let uid_mut = kiosk::uid_mut_as_owner(self, cap); df::add(uid_mut, KioskName {}, name) } - /// Try read the name of the Kiosk - if set - return Some(String), if not - None + /// Return `some(String)` as the name of the Kiosk if it's set, otherwise `none`. public fun name(self: &Kiosk): Option { if (df::exists_(kiosk::uid(self), KioskName {})) { option::some(*df::borrow(kiosk::uid(self), KioskName {})) @@ -101,15 +97,16 @@ The signature of the `kiosk_extension::add` function requires the app witness, m ```move module examples::letterbox_ext { - // ... dependencies + use iota::kiosk_extension; + use iota::kiosk::{Kiosk, KioskOwnerCap}; /// The expected set of permissions for extension. It requires `place`. const PERMISSIONS: u128 = 1; /// The Witness struct used to identify and authorize the extension. - struct Extension has drop {} + public struct Extension has drop {} - /// Install the Mallbox extension into the Kiosk. + /// Install the Letterbox extension into the Kiosk. public fun add(kiosk: &mut Kiosk, cap: &KioskOwnerCap, ctx: &mut TxContext) { kiosk_extension::add(Extension {}, kiosk, cap, PERMISSIONS, ctx) } @@ -143,15 +140,16 @@ It's considered good practice to define a constant containing permissions of the ```move module examples::letterbox_ext { - // ... dependencies + use iota::kiosk_extension; + use iota::kiosk::{Kiosk, KioskOwnerCap}; /// The expected set of permissions for the app. It requires `place`. const PERMISSIONS: u128 = 1; - /// The witness struct used to identify and authorize the app. - struct Extension has drop {} + /// The Witness struct used to identify and authorize the app. + public struct Extension has drop {} - /// Install the Mallbox app into the kiosk and request `place` permission. + /// Install the Letterbox extension into the Kiosk. public fun add(kiosk: &mut Kiosk, cap: &KioskOwnerCap, ctx: &mut TxContext) { kiosk_extension::add(Extension {}, kiosk, cap, PERMISSIONS, ctx) } @@ -164,16 +162,25 @@ If an app requests and is granted permissions (and isn't disabled), it can acces ```move module examples::letterbox_ext { - // ... + use iota::kiosk_extension; + use iota::kiosk::Kiosk; + use iota::transfer_policy::TransferPolicy; + + /// The Witness struct used to identify and authorize the app. + public struct Extension has drop {} + /// Our example object we want to place in the kiosk. + public struct Letter has key, store { + id: UID, + } /// Emitted when trying to place an item without permissions. const ENotEnoughPermissions: u64 = 1; /// Place a letter into the kiosk without the `KioskOwnerCap`. - public fun place(kiosk: &mut Kiosk, letter: Letter, policy: &TransferPolicy) { - assert!(kiosk_extension::can_place(kiosk), ENotEnoughPermissions) + public fun place(kiosk: &mut Kiosk, letter: Letter, policy: &TransferPolicy) { + assert!(kiosk_extension::can_place(kiosk), ENotEnoughPermissions); - kiosk_extension::place(Extension {}, kiosk, letter, policy) + kiosk_extension::place(Extension {}, kiosk, letter, policy); } } ``` @@ -211,15 +218,15 @@ Use the `disable(kiosk: &mut Kiosk, cap: &KioskOwnerCap)` function to disab **Example PTB** -```move -let txb = new TransactionBuilder(); -let kioskArg = tx.object(''); -let capArg = tx.object(''); +```javascript +let txb = new TransactionBlock(); +let kioskArg = txb.object(''); +let capArg = txb.object(''); txb.moveCall({ target: '0x2::kiosk_extension::disable', arguments: [ kioskArg, capArg ], - typeArguments: '::letterbox_ext::Extension' + typeArguments: [ '::letterbox_ext::Extension' ] }); ``` @@ -231,14 +238,14 @@ The call fails if the storage is not empty. **Example PTB** -```move -let txb = new TransactionBuilder(); -let kioskArg = tx.object(''); -let capArg = tx.object(''); +```javascript +let txb = new TransactionBlock(); +let kioskArg = txb.object(''); +let capArg = txb.object(''); txb.moveCall({ target: '0x2::kiosk_extension::remove', arguments: [ kioskArg, capArg ], - typeArguments: '::letterbox_ext::Extension' + typeArguments: [ '::letterbox_ext::Extension' ] }); ``` diff --git a/docs/content/developer/standards/kiosk.mdx b/docs/content/developer/standards/kiosk.mdx index bb79df2e85b..b38601d6f57 100644 --- a/docs/content/developer/standards/kiosk.mdx +++ b/docs/content/developer/standards/kiosk.mdx @@ -19,7 +19,7 @@ See the [Kiosk SDK documentation](../../references/ts-sdk/kiosk/index.mdx) for e ## IOTA Kiosk owners -Anyone can create a IOTA Kiosk. Ownership of a kiosk is determined by the owner of the `KioskOwnerCap`, a special object that grants full access to a single kiosk. As the owner, you can sell any asset with a type (T) that has a shared `TransferPolicy` available, or you can use a kiosk to store assets even without a shared policy. You can’t sell or transfer any assets from your kiosk that do not have an associated transfer policy available. +Anyone can create an IOTA Kiosk. Ownership of a kiosk is determined by the owner of the `KioskOwnerCap`, a special object that grants full access to a single kiosk. As the owner, you can sell any asset with a type (T) that has a shared `TransferPolicy` available, or you can use a kiosk to store assets even without a shared policy. You can’t sell or transfer any assets from your kiosk that do not have an associated transfer policy available. To sell an item, if there is an existing transfer policy for the type (T), you just add your assets to your kiosk and then list them. You specify an offer amount when you list an item. Anyone can then purchase the item for the amount of IOTA specified in the listing. The associated transfer policy determines what the buyer can do with the purchased asset. @@ -35,7 +35,7 @@ A Kiosk owner can: A buyer is a party that purchases (or - more generally - receives) items from Kiosks, anyone on the network can be a Buyer (and, for example, a Kiosk Owner at the same time). -** Benefits:** +**Benefits:** * Buyers get access to global liquidity and can get the best offer * Buyers can place bids on collections through their Kiosks * Most of the actions performed in Kiosks are free (gas-less) for Buyers @@ -55,7 +55,7 @@ As a marketplace operator, you can implement IOTA Kiosk to watch for offers made As a creator, IOTA Kiosk supports strong enforcement for transfer policies and associated rules to protect assets and enforce asset ownership. IOTA Kiosk gives creators more control over their creations, and puts creators and owners in control of how their works can be used. -Creator is a party that creates and controls the TransferPolicy for a single type. For example, the authors of IOTAFrens are the Creators of the `IOTAFren` type and act as creators in the Kiosk ecosystem. Creators set the policy, but they might also be the first sellers of their assets through a Kiosk. +A creator is a party that creates and controls the TransferPolicy for a single type. Creators set the policy, but they might also be the first sellers of their assets through a Kiosk. **Creators can:** * Set any rules for trades @@ -90,17 +90,17 @@ In practice, these guarantees mean that: IOTA Kiosk is a shared object that can store heterogeneous values, such as different sets of asset collectibles. When you add an asset to your kiosk, it has one of the following states: * PLACED - an item placed in the kiosk using the `kiosk::place` function. The Kiosk Owner can withdraw it and use it directly, borrow it (mutably or immutably), or list an item for sale. -* LOCKED - an item placed in the kiosk using the `kiosk::lock` function. You can’t withdraw a Locked item from a kiosk, but you can borrow it mutably and list it for sale. Any item placed in a kiosk that has an associated Kiosk Lock policy have a LOCKED state. +* LOCKED - an item placed in the kiosk using the `kiosk::lock` function. You can’t withdraw a Locked item from a kiosk, but you can borrow it mutably and list it for sale. Any item placed in a kiosk that has an associated Kiosk Lock policy has a LOCKED state. * LISTED - an item in the kiosk that is listed for sale using the `kiosk::list` or `kiosk::place_and_list` functions. You can’t modify an item while listed, but you can borrow it immutably or delist it, which returns it to its previous state. * LISTED EXCLUSIVELY - an item placed or locked in the kiosk by an extension that calls the `kiosk::list_with_purchase_cap` function. Only the kiosk owner can approve calling the function. The owner can only borrow it immutably. The extension must provide the functionality to delist / unlock the asset, or it might stay locked forever. Given that this action is explicitly performed by the Owner - it is the responsibility of the Owner to choose verified and audited extensions to use. When someone purchases an asset from a kiosk, the asset leaves the kiosk and ownership transfers to the buyer’s address. -## Open a IOTA Kiosk +## Open an IOTA Kiosk -To use a IOTA Kiosk, you must create one and have the `KioskOwnerCap` that matches the `Kiosk` object. You can create a new kiosk using a single transaction by calling the `kiosk::default` function. The function creates and shares a `Kiosk`, and transfers the `KioskOwnerCap` to your address. +To use an IOTA Kiosk, you must create one and have the `KioskOwnerCap` that matches the `Kiosk` object. You can create a new kiosk using a single transaction by calling the `kiosk::default` function. The function creates and shares a `Kiosk`, and transfers the `KioskOwnerCap` to your address. -### Create a IOTA Kiosk using programmable transaction blocks +### Create an IOTA Kiosk using programmable transaction blocks ```javascript let tx = new TransactionBlock(); @@ -109,7 +109,7 @@ tx.moveCall({ }); ``` -### Create a IOTA Kiosk using the IOTA CLI +### Create an IOTA Kiosk using the IOTA CLI ```shell iota client call \ @@ -119,15 +119,17 @@ iota client call \ --gas-budget 1000000000 ``` -### Create a IOTA Kiosk with advanced options +### Create an IOTA Kiosk with advanced options For more advanced use cases, when you want to choose the storage model or perform an action right away, you can use the programmable transaction block (PTB) friendly function kiosk::new. Kiosk is designed to be shared. If you choose a different storage model, such as owned, your kiosk might not function as intended or not be accessible to other users. You can make sure your Kiosk works by testing it on IOTA Testnet. -### Create a IOTA Kiosk with advanced options using programmable transaction blocks +### Create an IOTA Kiosk with advanced options using programmable transaction blocks ```javascript let tx = new TransactionBlock(); +let sender = "0x..."; + let [kiosk, kioskOwnerCap] = tx.moveCall({ target: '0x2::kiosk::new' }); @@ -136,13 +138,22 @@ tx.transferObjects([ kioskOwnerCap ], sender); tx.moveCall({ target: '0x2::transfer::public_share_object', arguments: [ kiosk ], - typeArguments: '0x2::kiosk::Kiosk' + typeArguments: ['0x2::kiosk::Kiosk'] }) ``` -### Create a IOTA Kiosk with advanced options using the IOTA CLI +### Create an IOTA Kiosk with advanced options using a PTB in the IOTA CLI + +```shell +iota client ptb \ + --gas-budget 1000000000 \ + --move-call 0x2::kiosk::new \ + --assign kiosk \ + --move-call 0x2::transfer::public_share_object "<0x2::kiosk::Kiosk>" kiosk.0 \ + --transfer-objects [kiosk.1] +``` -IOTA CLI does not support PTBs and transaction chaining yet. You can use the `kiosk::default` function instead. +Since `0x2::kiosk::new` returns a tuple, `kiosk.0` refers to the `Kiosk` itself and `kiosk.1` to the `KioskOwnerCap`. ## Place items in and take items from your kiosk @@ -208,7 +219,18 @@ let item = tx.moveCall({ ### Take an item from a kiosk using the IOTA CLI -The `kiosk::take` function is built to be PTB friendly and returns the asset. The IOTA CLI does not yet support transaction chaining. +The `kiosk::take` function is built to be PTB friendly and returns the asset. In this IOTA CLI PTB example we transfer the taken item to the given address. + +```shell +iota client ptb \ + --gas-budget 1000000000 \ + --assign kiosk @ \ + --assign kiosk_owner_cap @ \ + --assign item @ \ + --move-call 0x2::kiosk::take "" kiosk kiosk_owner_cap item \ + --assign taken_item \ + --transfer-objects [taken_item] +``` ## Lock items in a kiosk @@ -264,12 +286,12 @@ IOTA Kiosk provides basic trading functionality. As a kiosk owner, you can list * `kiosk::delist` - remove an existing listing * `kiosk::purchase` - purchase an asset listed for sale -Anyone on the network can purchase an item listed from a IOTA Kiosk. To learn more about the purchase flow, see the [Purchase section](#purchase). To learn more about asset states and what can be done with a listed item, see the [Asset States](#asset-states) section. +Anyone on the network can purchase an item listed from an IOTA Kiosk. To learn more about the purchase flow, see the [Purchase section](#purchase). To learn more about asset states and what can be done with a listed item, see the [Asset States](#asset-states) section. ### List an item from a kiosk -As a kiosk owner, you can use the `kiosk::list` function to list any asset you added to your kiosk. Include the item to sell and the list price as arguments. All listings on IOTA are in IOTA tokens. -When you list an item, IOTA emits a `kiosk::ItemListed` event that contains the Kiosk ID, Item ID, type of the Item, and the list price. +As a kiosk owner, you can use the `kiosk::list` function to list any asset you added to your kiosk by including the item to sell and the list price as arguments. All listings on IOTA are in IOTA coins. +When you list an item, IOTA emits a `kiosk::ItemListed` event that contains the Kiosk ID, Item ID, the type of the Item, and the list price. ### List an item using programmable transaction blocks @@ -309,7 +331,7 @@ When you delist an item, IOTA returns to the kiosk owner the gas fees charged to When you delist an item, IOTA emits a `kiosk::ItemDelisted` event that contains the Kiosk ID, Item ID, and the type of the item. -### Delist an item using the programmable transaction blocks +### Delist an item using programmable transaction blocks ```javascript let tx = new TransactionBlock(); @@ -339,12 +361,35 @@ iota client call \ ## Purchase an item from a kiosk {#purchase} -Anyone that has an address on the IOTA network can purchase an item listed from a IOTA Kiosk. To purchase an item, you can use the `kiosk::purchase` function. Specify the item to purchase and pay the list price set by the Kiosk Owner. +Anyone that has an address on the IOTA network can purchase an item listed from an IOTA Kiosk. To purchase an item, you can use the `kiosk::purchase` function. Specify the item to purchase and pay the list price set by the Kiosk Owner. You can discover the items listed on the network with the `kiosk::ItemListed` event. When you use the `kiosk::purchase` function, it returns the purchased asset and the `TransferRequest` for the type associated with the asset. To complete the purchase, you must meet the terms defined in the `TransferPolicy` applied to the asset. +### Purchase an item using the IOTA CLI + +```shell +iota client ptb \ + --gas-budget 1000000000 \ + --assign kiosk @ \ + --assign item @ \ + --assign coin @ \ + --assign transfer_policy @ \ + # We have to purchase the item with a `Coin` whose balance matches the item price exactly. + # In this example we take one of our coins as input and split off a `Coin` with the required balance. + # The remainder will be sent back to us. + --split-coins coin [] \ + --assign coins \ + --move-call 0x2::kiosk::purchase '' kiosk item coins.0 \ + # This is a tuple consisting of the purchased item and a `TransferRequest` that we need to resolve in this PTB. + --assign purchase_result \ + # Resolve the `TransferRequest` by confirming it with `TransferPolicy`. + --move-call 0x2::transfer_policy::confirm_request '' transfer_policy purchase_result.1 \ + # Transfer the purchased item to ourselves. + --transfer-objects [purchase_result.0] +``` + ## Borrow an item from a kiosk As a kiosk owner, you can access an asset placed or locked in a kiosk without taking the asset from the kiosk. You can always borrow the asset immutably. Whether you can mutably borrow an asset depends on the state of the asset. For example, you can’t borrow a listed asset because you can’t modify it while listed. The functions available include: @@ -376,7 +421,7 @@ You can mutably borrow an asset from a kiosk if it is not listed. You can use th ### Mutably borrow an asset using IOTA Move ```move -module examples::mutable_borrow +module examples::mutable_borrow { use iota::object::ID; use iota::kiosk::{Self, Kiosk, KioskOwnerCap}; @@ -388,9 +433,9 @@ module examples::mutable_borrow } ``` -### Mutable borrow with borrow_val +### Mutable borrow with `borrow_val` -You can use the PTB-friendly kiosk::borrow_val function. It allows you to take an asset and place it back in the same transaction. To make sure the asset is placed back into the kiosk, the function "obliges" the caller with a “Hot Potato”. +You can use the PTB-friendly `kiosk::borrow_val` function. It allows you to take an asset and place it back in the same transaction. To make sure the asset is placed back into the kiosk, the function "obliges" the caller with a “Hot Potato”. ### Mutable borrow with `borrow_val` using programmable transaction blocks @@ -408,9 +453,9 @@ let [item, promise] = tx.moveCall({ typeArguments: [ itemType ], }); -// freely mutate or reference the `item` -// any calls are available as long as they take a reference -// `returnValue` must be explicitly called +// Freely mutate or reference the `item`. +// Any calls are available as long as they take a reference. +// `return_val` must be explicitly called. tx.moveCall({ target: '0x2::kiosk::return_val', @@ -421,7 +466,7 @@ tx.moveCall({ ## Withdraw proceeds from a completed sale -When someone purchases an item, IOTA stores the proceeds from the sale in the Kiosk. As the kiosk owner, you can withdraw the proceeds at any time by calling the `kiosk::withdraw` function. The function is simple, but because it is PTB friendly it is not currently supported in the IOTA CLI. +When someone purchases an item, IOTA stores the proceeds from the sale in the Kiosk. As the kiosk owner, you can withdraw the proceeds at any time by calling the `kiosk::withdraw` function. ### Withdraw proceeds using programmable transaction blocks @@ -453,4 +498,14 @@ let coin = tx.moveCall({ ### Withdraw proceeds using the IOTA CLI -Due to the function being PTB friendly, it is not currently supported in the CLI environment. +```shell +iota client ptb \ + --assign kiosk @ \ + --assign kiosk_owner_cap @ \ + --move-call 0x2::kiosk::withdraw kiosk kiosk_owner_cap none \ + --assign withdrawn_coin \ + --transfer-objects [withdrawn_coin] \ + --gas-budget 1000000000 +``` + +Passing `none` withdraws all profits, while passing `some(x)` will attempt to withdraw a `Coin` with a balance of `x`. This amount `x` can be smaller or equal to the contained profits. diff --git a/docs/content/developer/standards/standards.mdx b/docs/content/developer/standards/standards.mdx deleted file mode 100644 index 930a8712921..00000000000 --- a/docs/content/developer/standards/standards.mdx +++ /dev/null @@ -1,15 +0,0 @@ ---- -title: IOTA Standards Overview -sidebar_label: Overview ---- - -Standards on the IOTA blockchain are features, frameworks, or apps that you can extend or customize. - - - - - - - - - diff --git a/docs/content/developer/standards/wallet-standard.mdx b/docs/content/developer/standards/wallet-standard.mdx index b73f5712381..2aaaa596738 100644 --- a/docs/content/developer/standards/wallet-standard.mdx +++ b/docs/content/developer/standards/wallet-standard.mdx @@ -13,23 +13,23 @@ You need to create a class that represents your wallet. You can use the `Wallet` `@iota/wallet-standard` to help ensure your class adheres to the standard. ```tsx -import { IOTA_DEVNET_CHAIN, Wallet } from '@iota/wallet-standard'; +import { IOTA_TESTNET_CHAIN, Wallet } from '@iota/wallet-standard'; class YourWallet implements Wallet { - get version() { - // Return the version of the Wallet Standard this implements (in this case, 1.0.0). - return '1.0.0'; - } - get name() { - return 'Wallet Name'; - } - get icon() { - return 'some-icon-data-url'; - } - // Return the IOTA chains that your wallet supports. - get chains() { - return [IOTA_DEVNET_CHAIN]; - } + get version() { + // Return the version of the Wallet Standard this implements (in this case, 1.0.0). + return '1.0.0'; + } + get name() { + return 'Wallet Name'; + } + get icon() { + return 'some-icon-data-url'; + } + // Return the IOTA chains that your wallet supports. + get chains() { + return [IOTA_TESTNET_CHAIN]; + } } ``` @@ -64,7 +64,7 @@ import { } from "@iota/wallet-standard"; class YourWallet implements Wallet { - /* ... existing code from above ... */ + /* ... existing code from above ... */ get features(): ConnectFeature & EventsFeature & IOTAFeatures { return { @@ -76,10 +76,10 @@ class YourWallet implements Wallet { version: "1.0.0", on: this.#on, }, - "iota:signPersonalMessage": { + "iota:signPersonalMessage": { version: "1.0.0", - signPersonalMessage: this.#signPersonalMessage, - }, + signPersonalMessage: this.#signPersonalMessage, + }, "iota:signTransactionBlock": { version: "1.0.0", signTransactionBlock: this.#signTransactionBlock, @@ -99,7 +99,7 @@ class YourWallet implements Wallet { // Your wallet's connect implementation }; - #signPersonalMessage: IOTASignPersonalMessageMethod = () => { + #signPersonalMessage: IOTASignPersonalMessageMethod = () => { // Your wallet's signTransaction implementation }; @@ -126,26 +126,26 @@ required interface. import { ReadonlyWalletAccount } from '@iota/wallet-standard'; class YourWallet implements Wallet { - get accounts() { - // Assuming we already have some internal representation of accounts: - return someWalletAccounts.map( - (walletAccount) => - // Return - new ReadonlyWalletAccount({ - address: walletAccount.iotaAddress, - publicKey: walletAccount.pubkey, - // The IOTA chains that your wallet supports. - chains: [IOTA_DEVNET_CHAIN], - // The features that this account supports. This can be a subset of the wallet's supported features. - // These features must exist on the wallet as well. - features: [ - 'iota:signPersonalMessage', - 'iota:signTransactionBlock', - 'iota:signAndExecuteTransactionBlock', - ], - }), - ); - } + get accounts() { + // Assuming we already have some internal representation of accounts: + return someWalletAccounts.map( + (walletAccount) => + // Return + new ReadonlyWalletAccount({ + address: walletAccount.iotaAddress, + publicKey: walletAccount.pubkey, + // The IOTA chains that your wallet supports. + chains: [IOTA_TESTNET_CHAIN], + // The features that this account supports. This can be a subset of the wallet's supported features. + // These features must exist on the wallet as well. + features: [ + 'iota:signPersonalMessage', + 'iota:signTransactionBlock', + 'iota:signAndExecuteTransactionBlock', + ], + }), + ); + } } ``` diff --git a/docs/content/sidebars/developer.js b/docs/content/sidebars/developer.js index 7a49bcd8d9e..f3f3df0a7f7 100644 --- a/docs/content/sidebars/developer.js +++ b/docs/content/sidebars/developer.js @@ -187,8 +187,13 @@ const developer = [ { type: 'category', label: 'Standards', + link: { + type: 'generated-index', + title:'IOTA Standards Overview', + description: 'Standards on the IOTA blockchain are features, frameworks, or apps that you can extend or customize.', + slug: 'developer/standards', + }, items: [ - 'developer/standards/standards', 'developer/standards/coin', 'developer/standards/coin-manager', { From fbb9a5a8568d132f6852ac9a98c0b2506b8029c2 Mon Sep 17 00:00:00 2001 From: Thoralf-M <46689931+Thoralf-M@users.noreply.github.com> Date: Tue, 13 Aug 2024 17:39:02 +0200 Subject: [PATCH 2/7] feat!(iota): disable zklogin in keytool (#1770) * feat!(iota): disable zklogin in keytool * Link issue in comment --- Cargo.lock | 3 - crates/iota/Cargo.toml | 3 - crates/iota/src/keytool.rs | 764 ++++++++++++++++++------------------- crates/iota/src/lib.rs | 3 +- 4 files changed, 377 insertions(+), 396 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 91568075ef1..25d491ba6fc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5123,10 +5123,8 @@ dependencies = [ "datatest-stable", "expect-test", "fastcrypto", - "fastcrypto-zkp", "fs_extra", "git-version", - "im", "inquire", "insta", "iota-config", @@ -5157,7 +5155,6 @@ dependencies = [ "move-package", "move-vm-profiler", "msim", - "num-bigint 0.4.6", "prometheus", "rand 0.8.5", "regex", diff --git a/crates/iota/Cargo.toml b/crates/iota/Cargo.toml index 7e99e716c24..b43d0009b9f 100644 --- a/crates/iota/Cargo.toml +++ b/crates/iota/Cargo.toml @@ -20,12 +20,10 @@ clap.workspace = true const-str.workspace = true datatest-stable.workspace = true git-version.workspace = true -im.workspace = true inquire.workspace = true insta.workspace = true json_to_table.workspace = true miette.workspace = true -num-bigint.workspace = true prometheus.workspace = true rand.workspace = true regex.workspace = true @@ -62,7 +60,6 @@ move-binary-format.workspace = true shared-crypto.workspace = true fastcrypto.workspace = true -fastcrypto-zkp.workspace = true colored.workspace = true rustyline.workspace = true diff --git a/crates/iota/src/keytool.rs b/crates/iota/src/keytool.rs index 680d8b78bcd..f0166cefeb4 100644 --- a/crates/iota/src/keytool.rs +++ b/crates/iota/src/keytool.rs @@ -19,17 +19,10 @@ use clap::*; use fastcrypto::{ ed25519::Ed25519KeyPair, encoding::{Base64, Encoding, Hex}, - error::FastCryptoError, hash::HashFunction, secp256k1::recoverable::Secp256k1Sig, traits::{KeyPair, ToFromBytes}, }; -use fastcrypto_zkp::bn254::{ - utils::{get_oidc_url, get_token_exchange_url}, - zk_login::{JwkId, OIDCProvider, JWK}, - zk_login_api::ZkLoginEnv, -}; -use im::hashmap::HashMap as ImHashMap; use iota_keys::{ key_derive::generate_new_key, keypair_file::{ @@ -40,9 +33,8 @@ use iota_keys::{ }; use iota_types::{ base_types::IotaAddress, - committee::EpochId, crypto::{ - get_authority_key_pair, DefaultHash, EncodeDecodeBase64, IotaKeyPair, PublicKey, Signature, + get_authority_key_pair, DefaultHash, EncodeDecodeBase64, IotaKeyPair, PublicKey, SignatureScheme, }, error::IotaResult, @@ -50,25 +42,18 @@ use iota_types::{ multisig_legacy::{MultiSigLegacy, MultiSigPublicKeyLegacy}, signature::{AuthenticatorTrait, GenericSignature, VerifyParams}, transaction::{TransactionData, TransactionDataAPI}, - zk_login_authenticator::ZkLoginAuthenticator, - zk_login_util::get_zklogin_inputs, }; use json_to_table::{json_to_table, Orientation}; -use num_bigint::BigUint; -use rand::{rngs::StdRng, Rng, SeedableRng}; use serde::Serialize; use serde_json::json; -use shared_crypto::intent::{Intent, IntentMessage, IntentScope, PersonalMessage}; +use shared_crypto::intent::{Intent, IntentMessage}; use tabled::{ builder::Builder, settings::{object::Rows, Modify, Rotate, Width}, }; use tracing::info; -use crate::{ - key_identity::{get_identity_address_from_keystore, KeyIdentity}, - zklogin_commands_util::{perform_zk_login_test_tx, read_cli_line}, -}; +use crate::key_identity::{get_identity_address_from_keystore, KeyIdentity}; #[cfg(test)] #[path = "unit_tests/keytool_tests.rs"] mod keytool_tests; @@ -246,80 +231,80 @@ pub enum KeyToolCommand { /// address, Base64 encoded public key, the key scheme, and the key scheme /// flag. Unpack { keypair: String }, - - /// Given the max_epoch, generate an OAuth url, ask user to paste the - /// redirect with id_token, call salt server, then call the prover server, - /// create a test transaction, use the ephemeral key to sign and execute it - /// by assembling to a serialized zkLogin signature. - ZkLoginSignAndExecuteTx { - #[clap(long)] - max_epoch: EpochId, - #[clap(long, default_value = "devnet")] - network: String, - #[clap(long, default_value = "true")] - fixed: bool, // if true, use a fixed kp generated from [0; 32] seed. - #[clap(long, default_value = "true")] - test_multisig: bool, // if true, use a multisig address with zklogin and a traditional kp. - #[clap(long, default_value = "false")] - sign_with_sk: bool, /* if true, execute tx with the traditional sig (in the multisig), - * otherwise with the zklogin sig. */ - }, - - /// A workaround to the above command because sometimes token pasting does - /// not work (for Facebook). All the inputs required here are printed from - /// the command above. - ZkLoginEnterToken { - #[clap(long)] - parsed_token: String, - #[clap(long)] - max_epoch: EpochId, - #[clap(long)] - jwt_randomness: String, - #[clap(long)] - kp_bigint: String, - #[clap(long)] - ephemeral_key_identifier: IotaAddress, - #[clap(long, default_value = "devnet")] - network: String, - #[clap(long, default_value = "true")] - test_multisig: bool, - #[clap(long, default_value = "false")] - sign_with_sk: bool, - }, - - /// Given a zkLogin signature, parse it if valid. If `bytes` provided, - /// parse it as either as TransactionData or PersonalMessage based on - /// `intent_scope`. It verifies the zkLogin signature based its latest - /// JWK fetched. Example request: iota keytool zk-login-sig-verify --sig - /// $SERIALIZED_ZKLOGIN_SIG --bytes $BYTES --intent-scope 0 --network devnet - /// --curr-epoch 10 - ZkLoginSigVerify { - /// The Base64 of the serialized zkLogin signature. - #[clap(long)] - sig: String, - /// The Base64 of the BCS encoded TransactionData or PersonalMessage. - #[clap(long)] - bytes: Option, - /// Either 0 for TransactionData or 3 for PersonalMessage. - #[clap(long)] - intent_scope: u8, - /// The current epoch for the network to verify the signature's - /// max_epoch against. - #[clap(long)] - curr_epoch: Option, - /// The network to verify the signature for, determines ZkLoginEnv. - #[clap(long, default_value = "devnet")] - network: String, - }, - - /// TESTING ONLY: Given a string of data, sign with the fixed dev-only - /// ephemeral key and output a zkLogin signature with a fixed dev-only - /// proof with fixed max epoch 10. - ZkLoginInsecureSignPersonalMessage { - /// The string of data to sign. - #[clap(long)] - data: String, - }, + // Commented for now: https://github.com/iotaledger/iota/issues/1777 + // /// Given the max_epoch, generate an OAuth url, ask user to paste the + // /// redirect with id_token, call salt server, then call the prover server, + // /// create a test transaction, use the ephemeral key to sign and execute it + // /// by assembling to a serialized zkLogin signature. + // ZkLoginSignAndExecuteTx { + // #[clap(long)] + // max_epoch: EpochId, + // #[clap(long, default_value = "devnet")] + // network: String, + // #[clap(long, default_value = "true")] + // fixed: bool, // if true, use a fixed kp generated from [0; 32] seed. + // #[clap(long, default_value = "true")] + // test_multisig: bool, // if true, use a multisig address with zklogin and a traditional + // kp. #[clap(long, default_value = "false")] + // sign_with_sk: bool, /* if true, execute tx with the traditional sig (in the multisig), + // * otherwise with the zklogin sig. */ + // }, + + // /// A workaround to the above command because sometimes token pasting does + // /// not work (for Facebook). All the inputs required here are printed from + // /// the command above. + // ZkLoginEnterToken { + // #[clap(long)] + // parsed_token: String, + // #[clap(long)] + // max_epoch: EpochId, + // #[clap(long)] + // jwt_randomness: String, + // #[clap(long)] + // kp_bigint: String, + // #[clap(long)] + // ephemeral_key_identifier: IotaAddress, + // #[clap(long, default_value = "devnet")] + // network: String, + // #[clap(long, default_value = "true")] + // test_multisig: bool, + // #[clap(long, default_value = "false")] + // sign_with_sk: bool, + // }, + + // /// Given a zkLogin signature, parse it if valid. If `bytes` provided, + // /// parse it as either as TransactionData or PersonalMessage based on + // /// `intent_scope`. It verifies the zkLogin signature based its latest + // /// JWK fetched. Example request: iota keytool zk-login-sig-verify --sig + // /// $SERIALIZED_ZKLOGIN_SIG --bytes $BYTES --intent-scope 0 --network devnet + // /// --curr-epoch 10 + // ZkLoginSigVerify { + // /// The Base64 of the serialized zkLogin signature. + // #[clap(long)] + // sig: String, + // /// The Base64 of the BCS encoded TransactionData or PersonalMessage. + // #[clap(long)] + // bytes: Option, + // /// Either 0 for TransactionData or 3 for PersonalMessage. + // #[clap(long)] + // intent_scope: u8, + // /// The current epoch for the network to verify the signature's + // /// max_epoch against. + // #[clap(long)] + // curr_epoch: Option, + // /// The network to verify the signature for, determines ZkLoginEnv. + // #[clap(long, default_value = "devnet")] + // network: String, + // }, + + // /// TESTING ONLY: Given a string of data, sign with the fixed dev-only + // /// ephemeral key and output a zkLogin signature with a fixed dev-only + // /// proof with fixed max epoch 10. + // ZkLoginInsecureSignPersonalMessage { + // /// The string of data to sign. + // #[clap(long)] + // data: String, + // }, } // Command Output types @@ -454,27 +439,27 @@ pub struct SignData { iota_signature: String, } -#[derive(Serialize)] -#[serde(rename_all = "camelCase")] -pub struct ZkLoginSignAndExecuteTx { - tx_digest: String, -} - -#[derive(Serialize)] -#[serde(rename_all = "camelCase")] -pub struct ZkLoginSigVerifyResponse { - data: Option, - parsed: Option, - jwks: Option, - res: Option, -} - -#[derive(Serialize)] -#[serde(rename_all = "camelCase")] -pub struct ZkLoginInsecureSignPersonalMessage { - sig: String, - bytes: String, -} +// #[derive(Serialize)] +// #[serde(rename_all = "camelCase")] +// pub struct ZkLoginSignAndExecuteTx { +// tx_digest: String, +// } + +// #[derive(Serialize)] +// #[serde(rename_all = "camelCase")] +// pub struct ZkLoginSigVerifyResponse { +// data: Option, +// parsed: Option, +// jwks: Option, +// res: Option, +// } + +// #[derive(Serialize)] +// #[serde(rename_all = "camelCase")] +// pub struct ZkLoginInsecureSignPersonalMessage { +// sig: String, +// bytes: String, +// } #[derive(Serialize)] #[serde(untagged)] @@ -496,9 +481,9 @@ pub enum CommandOutput { Show(Key), Sign(SignData), SignKMS(SerializedSig), - ZkLoginSignAndExecuteTx(ZkLoginSignAndExecuteTx), - ZkLoginInsecureSignPersonalMessage(ZkLoginInsecureSignPersonalMessage), - ZkLoginSigVerify(ZkLoginSigVerifyResponse), + // ZkLoginSignAndExecuteTx(ZkLoginSignAndExecuteTx), + // ZkLoginInsecureSignPersonalMessage(ZkLoginInsecureSignPersonalMessage), + // ZkLoginSigVerify(ZkLoginSigVerifyResponse), } impl KeyToolCommand { @@ -920,285 +905,286 @@ impl KeyToolCommand { ); fs::write(path, out_str).unwrap(); CommandOutput::Show(key) - } - - KeyToolCommand::ZkLoginInsecureSignPersonalMessage { data } => { - let msg = PersonalMessage { - message: data.as_bytes().to_vec(), - }; - let intent_msg = IntentMessage::new(Intent::personal_message(), msg.clone()); - - let ikp = - IotaKeyPair::Ed25519(Ed25519KeyPair::generate(&mut StdRng::from_seed([0; 32]))); - let s = Signature::new_secure(&intent_msg, &ikp); - - let sig = GenericSignature::ZkLoginAuthenticator(ZkLoginAuthenticator::new( - get_zklogin_inputs(), // this is for the fixed keypair - 10, - s, - )); - CommandOutput::ZkLoginInsecureSignPersonalMessage( - ZkLoginInsecureSignPersonalMessage { - sig: Base64::encode(sig.as_bytes()), - bytes: Base64::encode(bcs::to_bytes(&msg).unwrap()), - }, - ) - } - KeyToolCommand::ZkLoginSignAndExecuteTx { - max_epoch, - network, - fixed, - test_multisig, - sign_with_sk, - } => { - let ikp = if fixed { - IotaKeyPair::Ed25519(Ed25519KeyPair::generate(&mut StdRng::from_seed([0; 32]))) - } else { - IotaKeyPair::Ed25519(Ed25519KeyPair::generate(&mut rand::thread_rng())) - }; - println!("Ephemeral keypair: {:?}", ikp.encode()); - let pk = ikp.public(); - let ephemeral_key_identifier: IotaAddress = (&ikp.public()).into(); - println!("Ephemeral key identifier: {ephemeral_key_identifier}"); - keystore.add_key(None, ikp)?; - - let mut eph_pk_bytes = vec![pk.flag()]; - eph_pk_bytes.extend(pk.as_ref()); - let kp_bigint = BigUint::from_bytes_be(&eph_pk_bytes); - println!("Ephemeral pubkey (BigInt): {:?}", kp_bigint); - - let jwt_randomness = if fixed { - "100681567828351849884072155819400689117".to_string() - } else { - let random_bytes = rand::thread_rng().gen::<[u8; 16]>(); - let jwt_random_bytes = BigUint::from_bytes_be(&random_bytes); - jwt_random_bytes.to_string() - }; - println!("Jwt randomness: {jwt_randomness}"); - let url = get_oidc_url( - OIDCProvider::Google, - &eph_pk_bytes, - max_epoch, - "25769832374-famecqrhe2gkebt5fvqms2263046lj96.apps.googleusercontent.com", - "https://iota.io/", - &jwt_randomness, - )?; - let url_2 = get_oidc_url( - OIDCProvider::Twitch, - &eph_pk_bytes, - max_epoch, - "rs1bh065i9ya4ydvifixl4kss0uhpt", - "https://iota.io/", - &jwt_randomness, - )?; - let url_3 = get_oidc_url( - OIDCProvider::Facebook, - &eph_pk_bytes, - max_epoch, - "233307156352917", - "https://iota.io/", - &jwt_randomness, - )?; - let url_4 = get_oidc_url( - OIDCProvider::Kakao, - &eph_pk_bytes, - max_epoch, - "aa6bddf393b54d4e0d42ae0014edfd2f", - "https://iota.io/", - &jwt_randomness, - )?; - let url_5 = get_token_exchange_url( - OIDCProvider::Kakao, - "aa6bddf393b54d4e0d42ae0014edfd2f", - "https://iota.io/", - "$YOUR_AUTH_CODE", - "", // not needed - )?; - let url_6 = get_oidc_url( - OIDCProvider::Apple, - &eph_pk_bytes, - max_epoch, - "nl.digkas.wallet.client", - "https://iota.io/", - &jwt_randomness, - )?; - let url_7 = get_oidc_url( - OIDCProvider::Slack, - &eph_pk_bytes, - max_epoch, - "2426087588661.5742457039348", - "https://iota.io/", - &jwt_randomness, - )?; - let url_8 = get_token_exchange_url( - OIDCProvider::Slack, - "2426087588661.5742457039348", - "https://iota.io/", - "$YOUR_AUTH_CODE", - "39b955a118f2f21110939bf3dff1de90", - )?; - println!("Visit URL (Google): {url}"); - println!("Visit URL (Twitch): {url_2}"); - println!("Visit URL (Facebook): {url_3}"); - println!("Visit URL (Kakao): {url_4}"); - println!("Token exchange URL (Kakao): {url_5}"); - println!("Visit URL (Apple): {url_6}"); - println!("Visit URL (Slack): {url_7}"); - println!("Token exchange URL (Slack): {url_8}"); - - println!( - "Finish login and paste the entire URL here (e.g. https://iota.io/#id_token=...):" - ); - - let parsed_token = read_cli_line()?; - let tx_digest = perform_zk_login_test_tx( - &parsed_token, - max_epoch, - &jwt_randomness, - &kp_bigint.to_string(), - ephemeral_key_identifier, - keystore, - &network, - test_multisig, - sign_with_sk, - ) - .await?; - CommandOutput::ZkLoginSignAndExecuteTx(ZkLoginSignAndExecuteTx { tx_digest }) - } - KeyToolCommand::ZkLoginEnterToken { - parsed_token, - max_epoch, - jwt_randomness, - kp_bigint, - ephemeral_key_identifier, - network, - test_multisig, - sign_with_sk, - } => { - let tx_digest = perform_zk_login_test_tx( - &parsed_token, - max_epoch, - &jwt_randomness, - &kp_bigint, - ephemeral_key_identifier, - keystore, - &network, - test_multisig, - sign_with_sk, - ) - .await?; - CommandOutput::ZkLoginSignAndExecuteTx(ZkLoginSignAndExecuteTx { tx_digest }) - } - - KeyToolCommand::ZkLoginSigVerify { - sig, - bytes, - intent_scope, - curr_epoch, - network, - } => { - match GenericSignature::from_bytes( - &Base64::decode(&sig).map_err(|e| anyhow!("Invalid base64 sig: {:?}", e))?, - )? { - GenericSignature::ZkLoginAuthenticator(zk) => { - if bytes.is_none() || curr_epoch.is_none() { - return Ok(CommandOutput::ZkLoginSigVerify(ZkLoginSigVerifyResponse { - data: None, - parsed: Some(serde_json::to_string(&zk)?), - res: None, - jwks: None, - })); - } - - let client = reqwest::Client::new(); - let provider = OIDCProvider::from_iss(zk.get_iss()) - .map_err(|_| anyhow!("Invalid iss"))?; - let jwks = fetch_jwks(&provider, &client).await?; - let parsed: ImHashMap = jwks.clone().into_iter().collect(); - let env = match network.as_str() { - "devnet" | "localnet" => ZkLoginEnv::Test, - "mainnet" | "testnet" => ZkLoginEnv::Prod, - _ => return Err(anyhow!("Invalid network")), - }; - let aux_verify_data = VerifyParams::new(parsed, vec![], env, true, true); - - let (serialized, res) = match IntentScope::try_from(intent_scope) - .map_err(|_| anyhow!("Invalid scope"))? - { - IntentScope::TransactionData => { - let tx_data: TransactionData = bcs::from_bytes( - &Base64::decode(&bytes.unwrap()) - .map_err(|e| anyhow!("Invalid base64 tx data: {:?}", e))?, - )?; - - let res = zk.verify_authenticator( - &IntentMessage::new( - Intent::iota_transaction(), - tx_data.clone(), - ), - tx_data.execution_parts().1, - Some(curr_epoch.unwrap()), - &aux_verify_data, - ); - (serde_json::to_string(&tx_data)?, res) - } - IntentScope::PersonalMessage => { - let data: PersonalMessage = bcs::from_bytes( - &Base64::decode(&bytes.unwrap()).map_err(|e| { - anyhow!("Invalid base64 personal message data: {:?}", e) - })?, - )?; - - let res = zk.verify_authenticator( - &IntentMessage::new(Intent::personal_message(), data.clone()), - (&zk).try_into()?, - Some(curr_epoch.unwrap()), - &aux_verify_data, - ); - (serde_json::to_string(&data)?, res) - } - _ => return Err(anyhow!("Invalid intent scope")), - }; - CommandOutput::ZkLoginSigVerify(ZkLoginSigVerifyResponse { - data: Some(serialized), - parsed: Some(serde_json::to_string(&zk)?), - jwks: Some(serde_json::to_string(&jwks)?), - res: Some(res), - }) - } - _ => CommandOutput::Error("Not a zkLogin signature".to_string()), - } - } + } /* KeyToolCommand::ZkLoginInsecureSignPersonalMessage { data } => { + * let msg = PersonalMessage { + * message: data.as_bytes().to_vec(), + * }; + * let intent_msg = IntentMessage::new(Intent::personal_message(), + * msg.clone()); */ + + /* let ikp = + * IotaKeyPair::Ed25519(Ed25519KeyPair::generate(&mut StdRng::from_seed([0; + * 32]))); let s = Signature::new_secure(&intent_msg, &ikp); */ + + /* let sig = GenericSignature::ZkLoginAuthenticator(ZkLoginAuthenticator::new( + * get_zklogin_inputs(), // this is for the fixed keypair + * 10, + * s, + * )); + * CommandOutput::ZkLoginInsecureSignPersonalMessage( + * ZkLoginInsecureSignPersonalMessage { + * sig: Base64::encode(sig.as_bytes()), + * bytes: Base64::encode(bcs::to_bytes(&msg).unwrap()), + * }, + * ) + * } + * KeyToolCommand::ZkLoginSignAndExecuteTx { + * max_epoch, + * network, + * fixed, + * test_multisig, + * sign_with_sk, + * } => { + * let ikp = if fixed { + * IotaKeyPair::Ed25519(Ed25519KeyPair::generate(&mut StdRng::from_seed([0; + * 32]))) } else { + * IotaKeyPair::Ed25519(Ed25519KeyPair::generate(&mut rand::thread_rng())) + * }; + * println!("Ephemeral keypair: {:?}", ikp.encode()); + * let pk = ikp.public(); + * let ephemeral_key_identifier: IotaAddress = (&ikp.public()).into(); + * println!("Ephemeral key identifier: {ephemeral_key_identifier}"); + * keystore.add_key(None, ikp)?; */ + + /* let mut eph_pk_bytes = vec![pk.flag()]; + * eph_pk_bytes.extend(pk.as_ref()); + * let kp_bigint = BigUint::from_bytes_be(&eph_pk_bytes); + * println!("Ephemeral pubkey (BigInt): {:?}", kp_bigint); */ + + /* let jwt_randomness = if fixed { + * "100681567828351849884072155819400689117".to_string() + * } else { + * let random_bytes = rand::thread_rng().gen::<[u8; 16]>(); + * let jwt_random_bytes = BigUint::from_bytes_be(&random_bytes); + * jwt_random_bytes.to_string() + * }; + * println!("Jwt randomness: {jwt_randomness}"); + * let url = get_oidc_url( + * OIDCProvider::Google, + * &eph_pk_bytes, + * max_epoch, + * "25769832374-famecqrhe2gkebt5fvqms2263046lj96.apps.googleusercontent. + * com", "https://iota.io/", + * &jwt_randomness, + * )?; + * let url_2 = get_oidc_url( + * OIDCProvider::Twitch, + * &eph_pk_bytes, + * max_epoch, + * "rs1bh065i9ya4ydvifixl4kss0uhpt", + * "https://iota.io/", + * &jwt_randomness, + * )?; + * let url_3 = get_oidc_url( + * OIDCProvider::Facebook, + * &eph_pk_bytes, + * max_epoch, + * "233307156352917", + * "https://iota.io/", + * &jwt_randomness, + * )?; + * let url_4 = get_oidc_url( + * OIDCProvider::Kakao, + * &eph_pk_bytes, + * max_epoch, + * "aa6bddf393b54d4e0d42ae0014edfd2f", + * "https://iota.io/", + * &jwt_randomness, + * )?; + * let url_5 = get_token_exchange_url( + * OIDCProvider::Kakao, + * "aa6bddf393b54d4e0d42ae0014edfd2f", + * "https://iota.io/", + * "$YOUR_AUTH_CODE", + * "", // not needed + * )?; + * let url_6 = get_oidc_url( + * OIDCProvider::Apple, + * &eph_pk_bytes, + * max_epoch, + * "nl.digkas.wallet.client", + * "https://iota.io/", + * &jwt_randomness, + * )?; + * let url_7 = get_oidc_url( + * OIDCProvider::Slack, + * &eph_pk_bytes, + * max_epoch, + * "2426087588661.5742457039348", + * "https://iota.io/", + * &jwt_randomness, + * )?; + * let url_8 = get_token_exchange_url( + * OIDCProvider::Slack, + * "2426087588661.5742457039348", + * "https://iota.io/", + * "$YOUR_AUTH_CODE", + * "39b955a118f2f21110939bf3dff1de90", + * )?; + * println!("Visit URL (Google): {url}"); + * println!("Visit URL (Twitch): {url_2}"); + * println!("Visit URL (Facebook): {url_3}"); + * println!("Visit URL (Kakao): {url_4}"); + * println!("Token exchange URL (Kakao): {url_5}"); + * println!("Visit URL (Apple): {url_6}"); + * println!("Visit URL (Slack): {url_7}"); + * println!("Token exchange URL (Slack): {url_8}"); */ + + /* println!( + * "Finish login and paste the entire URL here (e.g. https://iota.io/#id_token=...):" + * ); */ + + /* let parsed_token = read_cli_line()?; + * let tx_digest = perform_zk_login_test_tx( + * &parsed_token, + * max_epoch, + * &jwt_randomness, + * &kp_bigint.to_string(), + * ephemeral_key_identifier, + * keystore, + * &network, + * test_multisig, + * sign_with_sk, + * ) + * .await?; + * CommandOutput::ZkLoginSignAndExecuteTx(ZkLoginSignAndExecuteTx { tx_digest + * }) } + * KeyToolCommand::ZkLoginEnterToken { + * parsed_token, + * max_epoch, + * jwt_randomness, + * kp_bigint, + * ephemeral_key_identifier, + * network, + * test_multisig, + * sign_with_sk, + * } => { + * let tx_digest = perform_zk_login_test_tx( + * &parsed_token, + * max_epoch, + * &jwt_randomness, + * &kp_bigint, + * ephemeral_key_identifier, + * keystore, + * &network, + * test_multisig, + * sign_with_sk, + * ) + * .await?; + * CommandOutput::ZkLoginSignAndExecuteTx(ZkLoginSignAndExecuteTx { tx_digest + * }) } */ + + /* KeyToolCommand::ZkLoginSigVerify { + * sig, + * bytes, + * intent_scope, + * curr_epoch, + * network, + * } => { + * match GenericSignature::from_bytes( + * &Base64::decode(&sig).map_err(|e| anyhow!("Invalid base64 sig: {:?}", + * e))?, )? { + * GenericSignature::ZkLoginAuthenticator(zk) => { + * if bytes.is_none() || curr_epoch.is_none() { + * return + * Ok(CommandOutput::ZkLoginSigVerify(ZkLoginSigVerifyResponse { + * data: None, + * parsed: Some(serde_json::to_string(&zk)?), + * res: None, + * jwks: None, + * })); + * } */ + + /* let client = reqwest::Client::new(); + * let provider = OIDCProvider::from_iss(zk.get_iss()) + * .map_err(|_| anyhow!("Invalid iss"))?; + * let jwks = fetch_jwks(&provider, &client).await?; + * let parsed: ImHashMap = + * jwks.clone().into_iter().collect(); let env = match + * network.as_str() { "devnet" | "localnet" => + * ZkLoginEnv::Test, "mainnet" | "testnet" => + * ZkLoginEnv::Prod, _ => return Err(anyhow!("Invalid + * network")), }; + * let aux_verify_data = VerifyParams::new(parsed, vec![], env, true, + * true); */ + + /* let (serialized, res) = match IntentScope::try_from(intent_scope) + * .map_err(|_| anyhow!("Invalid scope"))? + * { + * IntentScope::TransactionData => { + * let tx_data: TransactionData = bcs::from_bytes( + * &Base64::decode(&bytes.unwrap()) + * .map_err(|e| anyhow!("Invalid base64 tx data: {:?}", + * e))?, )?; */ + + /* let res = zk.verify_authenticator( + * &IntentMessage::new( + * Intent::iota_transaction(), + * tx_data.clone(), + * ), + * tx_data.execution_parts().1, + * Some(curr_epoch.unwrap()), + * &aux_verify_data, + * ); + * (serde_json::to_string(&tx_data)?, res) + * } + * IntentScope::PersonalMessage => { + * let data: PersonalMessage = bcs::from_bytes( + * &Base64::decode(&bytes.unwrap()).map_err(|e| { + * anyhow!("Invalid base64 personal message data: + * {:?}", e) })?, + * )?; */ + + /* let res = zk.verify_authenticator( + * &IntentMessage::new(Intent::personal_message(), + * data.clone()), (&zk).try_into()?, + * Some(curr_epoch.unwrap()), + * &aux_verify_data, + * ); + * (serde_json::to_string(&data)?, res) + * } + * _ => return Err(anyhow!("Invalid intent scope")), + * }; + * CommandOutput::ZkLoginSigVerify(ZkLoginSigVerifyResponse { + * data: Some(serialized), + * parsed: Some(serde_json::to_string(&zk)?), + * jwks: Some(serde_json::to_string(&jwks)?), + * res: Some(res), + * }) + * } + * _ => CommandOutput::Error("Not a zkLogin signature".to_string()), + * } + * } */ }); cmd_result } } -pub async fn fetch_jwks( - provider: &OIDCProvider, - client: &reqwest::Client, -) -> Result, FastCryptoError> { - let response = client - .get(provider.get_config().jwk_endpoint) - .send() - .await - .map_err(|e| { - FastCryptoError::GeneralError(format!( - "Failed to get JWK {:?} {:?}", - e.to_string(), - provider - )) - })?; - let bytes = response.bytes().await.map_err(|e| { - FastCryptoError::GeneralError(format!( - "Failed to get bytes {:?} {:?}", - e.to_string(), - provider - )) - })?; - fastcrypto_zkp::bn254::zk_login::parse_jwks(&bytes, provider) -} +// pub async fn fetch_jwks( +// provider: &OIDCProvider, +// client: &reqwest::Client, +// ) -> Result, FastCryptoError> { +// let response = client +// .get(provider.get_config().jwk_endpoint) +// .send() +// .await +// .map_err(|e| { +// FastCryptoError::GeneralError(format!( +// "Failed to get JWK {:?} {:?}", +// e.to_string(), +// provider +// )) +// })?; +// let bytes = response.bytes().await.map_err(|e| { +// FastCryptoError::GeneralError(format!( +// "Failed to get bytes {:?} {:?}", +// e.to_string(), +// provider +// )) +// })?; +// fastcrypto_zkp::bn254::zk_login::parse_jwks(&bytes, provider) +// } impl From<&IotaKeyPair> for Key { fn from(ikp: &IotaKeyPair) -> Self { diff --git a/crates/iota/src/lib.rs b/crates/iota/src/lib.rs index 420f101da65..6a6138f2c0b 100644 --- a/crates/iota/src/lib.rs +++ b/crates/iota/src/lib.rs @@ -15,4 +15,5 @@ pub mod key_identity; pub mod keytool; pub mod shell; pub mod validator_commands; -pub mod zklogin_commands_util; +// Commented: https://github.com/iotaledger/iota/issues/1777 +// pub mod zklogin_commands_util; From 4daa3ca7e19e551d1ba0dd5d2978ab3d4a36f46d Mon Sep 17 00:00:00 2001 From: Thoralf-M <46689931+Thoralf-M@users.noreply.github.com> Date: Tue, 13 Aug 2024 17:44:26 +0200 Subject: [PATCH 3/7] feat!(iota): remove MultiSigCombinePartialSigLegacy (#1767) * feat!(iota): remove MultiSigCombinePartialSigLegacy * Remove unused imports --------- Co-authored-by: Thibault Martinez --- crates/iota/src/keytool.rs | 43 -------------------------------------- 1 file changed, 43 deletions(-) diff --git a/crates/iota/src/keytool.rs b/crates/iota/src/keytool.rs index f0166cefeb4..6339952b231 100644 --- a/crates/iota/src/keytool.rs +++ b/crates/iota/src/keytool.rs @@ -39,7 +39,6 @@ use iota_types::{ }, error::IotaResult, multisig::{MultiSig, MultiSigPublicKey, ThresholdUnit, WeightUnit}, - multisig_legacy::{MultiSigLegacy, MultiSigPublicKeyLegacy}, signature::{AuthenticatorTrait, GenericSignature, VerifyParams}, transaction::{TransactionData, TransactionDataAPI}, }; @@ -180,16 +179,6 @@ pub enum KeyToolCommand { #[clap(long)] threshold: ThresholdUnit, }, - MultiSigCombinePartialSigLegacy { - #[clap(long, num_args(1..))] - sigs: Vec, - #[clap(long, num_args(1..))] - pks: Vec, - #[clap(long, num_args(1..))] - weights: Vec, - #[clap(long)] - threshold: ThresholdUnit, - }, /// Read the content at the provided file path. The accepted format can be /// [enum IotaKeyPair] (Base64 encoded of 33-byte `flag || privkey`) or @@ -384,14 +373,6 @@ pub struct MultiSigCombinePartialSig { multisig_serialized: String, } -#[derive(Serialize)] -#[serde(rename_all = "camelCase")] -pub struct MultiSigCombinePartialSigLegacyOutput { - multisig_address: IotaAddress, - multisig_legacy_parsed: GenericSignature, - multisig_legacy_serialized: String, -} - #[derive(Serialize)] #[serde(rename_all = "camelCase")] pub struct MultiSigOutput { @@ -476,7 +457,6 @@ pub enum CommandOutput { LoadKeypair(KeypairData), MultiSigAddress(MultiSigAddress), MultiSigCombinePartialSig(MultiSigCombinePartialSig), - MultiSigCombinePartialSigLegacy(MultiSigCombinePartialSigLegacyOutput), PrivateKeyBase64(PrivateKeyBase64), Show(Key), Sign(SignData), @@ -751,29 +731,6 @@ impl KeyToolCommand { }) } - KeyToolCommand::MultiSigCombinePartialSigLegacy { - sigs, - pks, - weights, - threshold, - } => { - let multisig_pk_legacy = - MultiSigPublicKeyLegacy::new(pks.clone(), weights.clone(), threshold)?; - let multisig_pk = MultiSigPublicKey::new(pks, weights, threshold)?; - let address: IotaAddress = (&multisig_pk).into(); - let multisig = MultiSigLegacy::combine(sigs, multisig_pk_legacy)?; - let generic_sig: GenericSignature = multisig.into(); - let multisig_legacy_serialized = generic_sig.encode_base64(); - - CommandOutput::MultiSigCombinePartialSigLegacy( - MultiSigCombinePartialSigLegacyOutput { - multisig_address: address, - multisig_legacy_parsed: generic_sig, - multisig_legacy_serialized, - }, - ) - } - KeyToolCommand::Show { file } => { let res = read_keypair_from_file(&file); match res { From 99dd67c96e67287d46f1f612432a977c3ea78c98 Mon Sep 17 00:00:00 2001 From: evavirseda Date: Tue, 13 Aug 2024 17:55:20 +0200 Subject: [PATCH 4/7] feat(wallet): update `AddAccountPage` with template and refactor page (#1707) * feat: add header template * feat: refine AddAcountPage to use HeaderTemplate * feat: rename to PageTemplate * feat:cleanup * feat: cleanup * feat: update template * feat: revert changes * fix format * feat: refactor AddAccountPage and use PageTemplate * fix import * feat: apply suggestions * feat: use AccountsFormType --- .../ui/app/pages/accounts/AddAccountPage.tsx | 197 ++++++++++-------- 1 file changed, 107 insertions(+), 90 deletions(-) diff --git a/apps/wallet/src/ui/app/pages/accounts/AddAccountPage.tsx b/apps/wallet/src/ui/app/pages/accounts/AddAccountPage.tsx index 4a3c1cb7199..1f6e1fb28f0 100644 --- a/apps/wallet/src/ui/app/pages/accounts/AddAccountPage.tsx +++ b/apps/wallet/src/ui/app/pages/accounts/AddAccountPage.tsx @@ -8,14 +8,13 @@ import toast from 'react-hot-toast'; import { useNavigate, useSearchParams } from 'react-router-dom'; import Browser from 'webextension-polyfill'; import { - Header, Card, CardType, CardImage, CardBody, - CardActionType, CardAction, ImageType, + CardActionType, } from '@iota/apps-ui-kit'; import { AccountsFormType, @@ -27,6 +26,7 @@ import { useAppSelector } from '../../hooks'; import { useCreateAccountsMutation } from '../../hooks/useCreateAccountMutation'; import { AppType } from '../../redux/slices/app/AppType'; import { Create, ImportPass, Key, Seed, Ledger } from '@iota/ui-icons'; +import { PageTemplate } from '../../components/PageTemplate'; async function openTabWithSearchParam(searchParam: string, searchParamValue: string) { const currentURL = new URL(window.location.href); @@ -50,96 +50,113 @@ export function AddAccountPage() { const isPopup = useAppSelector((state) => state.app.appType === AppType.Popup); const [isConnectLedgerModalOpen, setConnectLedgerModalOpen] = useState(forceShowLedger); const createAccountsMutation = useCreateAccountsMutation(); + const cardGroups = [ + { + title: 'Create a new mnemonic profile', + cards: [ + { + title: 'Create New', + icon: Create, + actionType: AccountsFormType.NewMnemonic, + isDisabled: createAccountsMutation.isPending, + }, + ], + }, + { + title: 'Import', + cards: [ + { + title: 'Mnemonic', + icon: ImportPass, + actionType: AccountsFormType.ImportMnemonic, + isDisabled: createAccountsMutation.isPending, + }, + { + title: 'Private Key', + icon: Key, + actionType: AccountsFormType.ImportPrivateKey, + isDisabled: createAccountsMutation.isPending, + }, + { + title: 'Seed', + icon: Seed, + actionType: AccountsFormType.ImportSeed, + isDisabled: createAccountsMutation.isPending, + }, + ], + }, + { + title: 'Import from Legder', + cards: [ + { + title: 'Ledger', + icon: Ledger, + actionType: AccountsFormType.ImportLedger, + isDisabled: createAccountsMutation.isPending, + }, + ], + }, + ]; + + const handleCardAction = async (actionType: AccountsFormType) => { + switch (actionType) { + case AccountsFormType.NewMnemonic: + setAccountsFormValues({ type: AccountsFormType.NewMnemonic }); + ampli.clickedCreateNewAccount({ sourceFlow }); + navigate( + `/accounts/protect-account?accountsFormType=${AccountsFormType.NewMnemonic}`, + ); + break; + case AccountsFormType.ImportMnemonic: + ampli.clickedImportPassphrase({ sourceFlow }); + navigate('/accounts/import-passphrase'); + break; + case AccountsFormType.ImportPrivateKey: + ampli.clickedImportPrivateKey({ sourceFlow }); + navigate('/accounts/import-private-key'); + break; + case AccountsFormType.ImportSeed: + navigate('/accounts/import-seed'); + break; + case AccountsFormType.ImportLedger: + ampli.openedConnectLedgerFlow({ sourceFlow }); + if (isPopup) { + await openTabWithSearchParam('showLedger', 'true'); + window.close(); + } else { + setConnectLedgerModalOpen(true); + } + break; + default: + break; + } + }; return ( -
-
navigate('/')} - onBack={() => navigate('/')} - /> -
-
-
- - Create a new mnemonic profile - - { - setAccountsFormValues({ type: AccountsFormType.NewMnemonic }); - ampli.clickedCreateNewAccount({ sourceFlow }); - navigate( - `/accounts/protect-account?accountsFormType=${AccountsFormType.NewMnemonic}`, - ); - }} - isDisabled={createAccountsMutation.isPending} - > - - - - -
-
- Import - { - ampli.clickedImportPassphrase({ sourceFlow }); - navigate('/accounts/import-passphrase'); - }} - isDisabled={createAccountsMutation.isPending} - > - - - - - { - ampli.clickedImportPrivateKey({ sourceFlow }); - navigate('/accounts/import-private-key'); - }} - isDisabled={createAccountsMutation.isPending} - > - - - - - { - navigate('/accounts/import-seed'); - }} - isDisabled={createAccountsMutation.isPending} - > - - - - -
-
- Import from Legder - { - ampli.openedConnectLedgerFlow({ sourceFlow }); - if (isPopup) { - await openTabWithSearchParam('showLedger', 'true'); - window.close(); - } else { - setConnectLedgerModalOpen(true); - } - }} - isDisabled={createAccountsMutation.isPending} - > - - - - + navigate('/')} + showBackButton + > +
+ {cardGroups.map((group, groupIndex) => ( +
+ {group.title} + {group.cards.map((card, cardIndex) => ( + handleCardAction(card.actionType)} + isDisabled={card.isDisabled} + > + + + + + ))}
-
+ ))}
{isConnectLedgerModalOpen && ( )} -
+ ); } From 20159adc2747be4258dc75a9899aa69a3c9a3733 Mon Sep 17 00:00:00 2001 From: Marc Espin Date: Tue, 13 Aug 2024 17:56:10 +0200 Subject: [PATCH 5/7] refactor(ts-sdk): Reset TS SDK version to `0.0.0` (#1713) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor(general): Reset TS SDK * fix: Update name of uikit in changesets config.json * chore: Revert unnecessary version downgrade of move-bytecode-template as it will never be published --------- Co-authored-by: Begoña Álvarez de la Cruz --- .changeset/config.json | 1 + sdk/bcs/CHANGELOG.md | 210 ------- sdk/bcs/package.json | 2 +- sdk/create-dapp/CHANGELOG.md | 221 ------- sdk/create-dapp/package.json | 2 +- sdk/dapp-kit/CHANGELOG.md | 356 ----------- sdk/dapp-kit/package.json | 2 +- sdk/graphql-transport/CHANGELOG.md | 24 - sdk/graphql-transport/package.json | 2 +- sdk/iotans-toolkit/CHANGELOG.md | 259 -------- sdk/iotans-toolkit/package.json | 2 +- sdk/kiosk/CHANGELOG.md | 313 ---------- sdk/kiosk/package.json | 2 +- sdk/ledgerjs-hw-app-iota/CHANGELOG.md | 27 - sdk/ledgerjs-hw-app-iota/package.json | 2 +- sdk/typescript/CHANGELOG.md | 858 -------------------------- sdk/typescript/package.json | 2 +- sdk/wallet-standard/CHANGELOG.md | 679 -------------------- sdk/wallet-standard/package.json | 2 +- sdk/zklogin/CHANGELOG.md | 252 -------- sdk/zklogin/package.json | 2 +- 21 files changed, 11 insertions(+), 3209 deletions(-) delete mode 100644 sdk/bcs/CHANGELOG.md delete mode 100644 sdk/create-dapp/CHANGELOG.md delete mode 100644 sdk/dapp-kit/CHANGELOG.md delete mode 100644 sdk/graphql-transport/CHANGELOG.md delete mode 100644 sdk/iotans-toolkit/CHANGELOG.md delete mode 100644 sdk/kiosk/CHANGELOG.md delete mode 100644 sdk/ledgerjs-hw-app-iota/CHANGELOG.md delete mode 100644 sdk/typescript/CHANGELOG.md delete mode 100644 sdk/wallet-standard/CHANGELOG.md delete mode 100644 sdk/zklogin/CHANGELOG.md diff --git a/.changeset/config.json b/.changeset/config.json index fdfee77bdfc..f67c14f3c25 100644 --- a/.changeset/config.json +++ b/.changeset/config.json @@ -12,6 +12,7 @@ "iota-wallet", "iota-explorer", "wallet-dashboard", + "@iota/apps-ui-kit", "apps-backend", "@iota/core", "@iota/ui", diff --git a/sdk/bcs/CHANGELOG.md b/sdk/bcs/CHANGELOG.md deleted file mode 100644 index b2fddce6a0a..00000000000 --- a/sdk/bcs/CHANGELOG.md +++ /dev/null @@ -1,210 +0,0 @@ -# Change Log - -## 0.11.1 - -### Patch Changes - -- 4830361fa4: Updated typescript version - -## 0.11.0 - -### Minor Changes - -- bae8802fe3: Update base64 encoding to use global `atob` and `btoa` functions. - -## 0.10.1 - -### Patch Changes - -- 9ac0a4ec01: Add extensions to all sdk import paths - -## 0.10.0 - -### Minor Changes - -- e5f9e3ba21: Replace tsup based build to fix issues with esm/cjs dual publishing - -## 0.9.1 - -### Patch Changes - -- dd362ec1d6: Update docs url to sdk.mystenlabs.com - -## 0.9.0 - -### Minor Changes - -- fce0a08d0f: Deprecate the bcs.generic helper. This helper causes typescript performance issues, and the generated generics can't be exported - -## 0.8.1 - -### Patch Changes - -- b48289346: Mark packages as being side-effect free. - -## 0.8.0 - -### Minor Changes - -- 1bc430161: Add new type-safe schema builder. See https://sdk.mystenlabs.com/bcs for updated documentation -- e4484852b: Add isSerializedBcs helper - -## 0.7.4 - -### Patch Changes - -- 290c8e640: Fix parsing of hex strings where leading 0s have been trimmed - -## 0.7.3 - -### Patch Changes - -- 36f2edff3: Fix an issue with parsing struct types with nested type parameters - -## 0.7.2 - -### Patch Changes - -- ca5c72815d: Fix a bcs decoding bug for u128 and u256 values -- fdb569464e: Fixes an issue with a top level generic in a nested vector - -## 0.7.1 - -### Patch Changes - -- b4f0bfc76: Fix type definitions for package exports. - -## 0.7.0 - -### Minor Changes - -- 19b567f21: Unified self- and delegated staking flows. Removed fields from `Validator` (`stake_amount`, `pending_stake`, and `pending_withdraw`) and renamed `delegation_staking_pool` to `staking_pool`. Additionally removed the `validator_stake` and `delegated_stake` fields in the `ValidatorSet` type and replaced them with a `total_stake` field. -- 5c3b00cde: Add object id to staking pool and pool id to staked iota. -- 3d9a04648: Adds `deactivation_epoch` to staking pool object, and adds `inactive_pools` to the validator set object. -- a8049d159: Fixes the issue with deep nested generics by introducing array type names - - - all of the methods (except for aliasing) now allow passing in arrays instead - of strings to allow for easier composition of generics and avoid using template - strings - - ```js - // new syntax - bcs.registerStructType(['VecMap', 'K', 'V'], { - keys: ['vector', 'K'], - values: ['vector', 'V'], - }); - - // is identical to an old string definition - bcs.registerStructType('VecMap', { - keys: 'vector', - values: 'vector', - }); - ``` - - Similar approach applies to `bcs.ser()` and `bcs.de()` as well as to other register\* methods - -- a0955c479: Switch from 20 to 32-byte address. Match Secp256k1.deriveKeypair with Ed25519. -- 0a7b42a6d: This changes almost all occurrences of "delegate", "delegation" (and various capitalizations/forms) to their equivalent "stake"-based name. Function names, function argument names, RPC endpoints, Move functions, and object fields have been updated with this new naming convention. -- 77bdf907f: When parsing u64, u128, and u256 values with bcs, they are now string encoded. - -## 0.6.1 - -### Patch Changes - -- 0e202a543: Remove pending delegation switches. - -## 0.6.0 - -```js -// new syntax -bcs.registerStructType(['VecMap', 'K', 'V'], { - keys: ['vector', 'K'], - values: ['vector', 'V'], -}); - -// is identical to an old string definition -bcs.registerStructType('VecMap', { - keys: 'vector', - values: 'vector', -}); -``` - -### Minor Changes - -- 598f106ef: Adds base58 encoding support to bcs - -- two functions added: `fromB58` and `toB58` similar to existing encodings -- `Reader.toString` and `de/encodeStr` methods support new `base58` value -- adds a 3 built-in types "hex-string", "base58-string" and "base64-string" -- adds constants for the built-ins: `BCS.BASE64`, `BCS.BASE58` and `BCS.HEX` - -```js -bcs.registerStructType('TestStruct', { - hex: BCS.HEX, - base58: BCS.BASE58, - base64: BCS.BASE64, -}); -``` - -### Adds type aliasing and inline definitions - -- adds new `registerAlias` function which allows type aliases and tracks basic recursion -- adds support for inline definitions in the `.de()` and `.ser()` methods - -### Examples - -```js -// inline definition example -let struct = { name: 'Alice', age: 25 }; -let bytes = bcs.ser({ name: 'string', age: 'u8' }, struct).toBytes(); -let restored = bcs.de({ name: 'string', age: 'u8' }, bytes); - -// `restored` deeply equals `struct` -``` - -```js -// aliases for types -bcs.registerAlias('Name', 'string'); -bcs.ser('Name', 'Palpatine'); -``` - -## 0.5.0 - -### Minor Changes - -- 1a0968636: Remove usage of bn.js, and use native bigints instead. - -## 0.4.0 - -### Minor Changes - -- 1591726e8: Support multiple instances of BCS - -### Patch Changes - -- 1591726e8: Add support for generic types - -## 0.3.0 - -### Minor Changes - -- d343b67e: Re-release packages - -## 0.2.1 - -### Patch Changes - -- c5e4851b: Updated build process from TSDX to tsup. -- e2aa08e9: Fix missing built files for packages. - -Version history from v0.1.0 to this day. - -## v0.2.0 - Usability Boost - -- `bcs.de(...)` now supports strings if encoding is passed as the last argument -- `BCS` (upper) -> `bcs` (lower) renaming -- Improved documentation, checked documentation examples for failures - -## v0.1.0 - -First version of library published. diff --git a/sdk/bcs/package.json b/sdk/bcs/package.json index 91519618d03..e218d01eb74 100644 --- a/sdk/bcs/package.json +++ b/sdk/bcs/package.json @@ -1,6 +1,6 @@ { "name": "@iota/bcs", - "version": "0.11.1", + "version": "0.0.0", "description": "BCS - Canonical Binary Serialization implementation for JavaScript", "license": "Apache-2.0", "author": "Mysten Labs ", diff --git a/sdk/create-dapp/CHANGELOG.md b/sdk/create-dapp/CHANGELOG.md deleted file mode 100644 index cdd01ef2932..00000000000 --- a/sdk/create-dapp/CHANGELOG.md +++ /dev/null @@ -1,221 +0,0 @@ -# @iota/create-dapp - -## 0.2.9 - -### Patch Changes - -- Updated dependencies [6984dd1e38] - - @iota/iota-sdk@0.51.1 - - @iota/dapp-kit@0.12.7 - -## 0.2.8 - -### Patch Changes - -- @iota/dapp-kit@0.12.6 - -## 0.2.7 - -### Patch Changes - -- @iota/dapp-kit@0.12.5 - -## 0.2.6 - -### Patch Changes - -- @iota/dapp-kit@0.12.4 - -## 0.2.5 - -### Patch Changes - -- Updated dependencies [0cafa94027] - - @iota/iota-sdk@0.51.0 - - @iota/dapp-kit@0.12.3 - -## 0.2.4 - -### Patch Changes - -- 4830361fa4: Updated typescript version -- Updated dependencies [4830361fa4] - - @iota/iota-sdk@0.50.1 - - @iota/dapp-kit@0.12.2 - -## 0.2.3 - -### Patch Changes - -- @iota/dapp-kit@0.12.1 - -## 0.2.2 - -### Patch Changes - -- Updated dependencies [a34f1cb67d] -- Updated dependencies [33c7325ee1] -- Updated dependencies [c08e3569ef] -- Updated dependencies [9a14e61db4] -- Updated dependencies [13e922d9b1] -- Updated dependencies [7b8d044603] -- Updated dependencies [a34f1cb67d] -- Updated dependencies [220a766d86] - - @iota/iota-sdk@0.50.0 - - @iota/dapp-kit@0.12.0 - -## 0.2.1 - -### Patch Changes - -- 9ac0a4ec01: Add extensions to all sdk import paths -- Updated dependencies [9ac0a4ec01] - - @iota/iota-sdk@0.49.1 - - @iota/dapp-kit@0.11.1 - -## 0.2.0 - -### Minor Changes - -- e5f9e3ba21: Replace tsup based build to fix issues with esm/cjs dual publishing - -### Patch Changes - -- Updated dependencies [9ba167b0af] -- Updated dependencies [e5f9e3ba21] - - @iota/dapp-kit@0.11.0 - - @iota/iota-sdk@0.49.0 - -## 0.1.8 - -### Patch Changes - -- f8d44c25cc: Fix handling of paths on windows -- dd362ec1d6: Update docs url to sdk.mystenlabs.com -- Updated dependencies [165ad6b21d] -- Updated dependencies [dd362ec1d6] -- Updated dependencies [d55db38647] - - @iota/dapp-kit@0.10.3 - - @iota/iota-sdk@0.48.1 - -## 0.1.7 - -### Patch Changes - -- Updated dependencies [2ae1a6a108] -- Updated dependencies [b30fecbbca] -- Updated dependencies [cdcfa76c43] - - @iota/dapp-kit@0.10.2 - - @iota/iota-sdk@0.48.0 - -## 0.1.6 - -### Patch Changes - -- Updated dependencies [367779ea2] - - @iota/dapp-kit@0.10.1 - -## 0.1.5 - -### Patch Changes - -- Updated dependencies [47b137d03] - - @iota/dapp-kit@0.10.0 - -## 0.1.4 - -### Patch Changes - -- Updated dependencies [194c980cb] -- Updated dependencies [9ac7e2f3d] -- Updated dependencies [0259aec82] -- Updated dependencies [64d45ba27] - - @iota/iota-sdk@0.47.0 - - @iota/dapp-kit@0.9.1 - -## 0.1.3 - -### Patch Changes - -- Updated dependencies [c5d4db238] -- Updated dependencies [652bcdd92] - - @iota/dapp-kit@0.9.0 - - @iota/iota-sdk@0.46.1 - -## 0.1.2 - -### Patch Changes - -- Updated dependencies [28c2c3330] -- Updated dependencies [43444c58f] -- Updated dependencies [8d1e74e52] -- Updated dependencies [103ad29c0] -- Updated dependencies [093554a0d] -- Updated dependencies [3718a230b] - - @iota/iota-sdk@0.46.0 - - @iota/dapp-kit@0.8.0 - -## 0.1.1 - -### Patch Changes - -- Updated dependencies [b359868e3] -- Updated dependencies [5d7055365] -- Updated dependencies [30b47b758] - - @iota/dapp-kit@0.7.0 - - @iota/iota-sdk@0.45.1 - -## 0.1.0 - -### Minor Changes - -- d4d9c9218: Upgrade dapp-kit and the scaffold applications to react-query v5 - -### Patch Changes - -- Updated dependencies [d4d9c9218] -- Updated dependencies [fb0ce3485] -- Updated dependencies [09c103002] -- Updated dependencies [e0578094b] -- Updated dependencies [b9afb5567] - - @iota/dapp-kit@0.6.0 - - @iota/iota-sdk@0.45.0 - -## 0.0.5 - -### Patch Changes - -- Updated dependencies [ade244c3d] - - @iota/dapp-kit@0.5.0 - -## 0.0.4 - -### Patch Changes - -- Updated dependencies [b7c304696] - - @iota/dapp-kit@0.4.0 - -## 0.0.3 - -### Patch Changes - -- de5fdf738: Remove entry keyword from counter example move code - -## 0.0.2 - -### Patch Changes - -- 49e04b2e4: Fix dependency mapping - -## 0.0.1 - -### Patch Changes - -- Updated dependencies [361818abc] -- Updated dependencies [2b532bc37] -- Updated dependencies [b48289346] -- Updated dependencies [11cf4e68b] -- Updated dependencies [0c5cdc049] -- Updated dependencies [c7e12c928] - - @iota/dapp-kit@0.3.0 - - @iota/iota-sdk@0.44.0 diff --git a/sdk/create-dapp/package.json b/sdk/create-dapp/package.json index 2e3f2e6c484..5a3d1545ac2 100644 --- a/sdk/create-dapp/package.json +++ b/sdk/create-dapp/package.json @@ -3,7 +3,7 @@ "author": "Mysten Labs ", "description": "A CLI for creating new Iota dApps", "homepage": "https://sdk.mystenlabs.com", - "version": "0.2.9", + "version": "0.0.0", "license": "Apache-2.0", "files": [ "CHANGELOG.md", diff --git a/sdk/dapp-kit/CHANGELOG.md b/sdk/dapp-kit/CHANGELOG.md deleted file mode 100644 index e9586dfa8aa..00000000000 --- a/sdk/dapp-kit/CHANGELOG.md +++ /dev/null @@ -1,356 +0,0 @@ -# @iota/dapp-kit - -## 0.12.7 - -### Patch Changes - -- Updated dependencies [6984dd1e38] - - @iota/iota-sdk@0.51.1 - - @iota/wallet-standard@0.11.1 - - @iota/zksend@0.4.1 - -## 0.12.6 - -### Patch Changes - -- Updated dependencies [c05a4e8cb7] -- Updated dependencies [c05a4e8cb7] -- Updated dependencies [c05a4e8cb7] -- Updated dependencies [c05a4e8cb7] -- Updated dependencies [c05a4e8cb7] - - @iota/zksend@0.4.0 - -## 0.12.5 - -### Patch Changes - -- Updated dependencies [b82832279b] - - @iota/zksend@0.3.1 - -## 0.12.4 - -### Patch Changes - -- Updated dependencies [3b1da3967a] - - @iota/zksend@0.3.0 - -## 0.12.3 - -### Patch Changes - -- Updated dependencies [0cafa94027] -- Updated dependencies [437f0ca2ef] - - @iota/iota-sdk@0.51.0 - - @iota/wallet-standard@0.11.0 - - @iota/zksend@0.2.3 - -## 0.12.2 - -### Patch Changes - -- 4830361fa4: Updated typescript version -- Updated dependencies [4830361fa4] -- Updated dependencies [4fd676671b] - - @iota/wallet-standard@0.10.3 - - @iota/iota-sdk@0.50.1 - - @iota/zksend@0.2.2 - -## 0.12.1 - -### Patch Changes - -- Updated dependencies [f069e3a13d] - - @iota/zksend@0.2.1 - -## 0.12.0 - -### Minor Changes - -- 7b8d044603: Add support for zkSend wallet - -### Patch Changes - -- 33c7325ee1: Fix infinite queries never ending -- Updated dependencies [a34f1cb67d] -- Updated dependencies [c07aa19958] -- Updated dependencies [13e922d9b1] -- Updated dependencies [c859f41a1c] -- Updated dependencies [d21c01ed47] -- Updated dependencies [2814db6529] -- Updated dependencies [e81f49e8dc] -- Updated dependencies [e87d99734a] -- Updated dependencies [c08e3569ef] -- Updated dependencies [9a14e61db4] -- Updated dependencies [ba6fccd010] -- Updated dependencies [c6b3066069] -- Updated dependencies [66fbbc7faa] -- Updated dependencies [7b8d044603] -- Updated dependencies [13e922d9b1] -- Updated dependencies [c6b3066069] -- Updated dependencies [a2904e0075] -- Updated dependencies [ea2744b0c3] -- Updated dependencies [44a1f9ea0b] -- Updated dependencies [7cc09a7bb4] -- Updated dependencies [9a14e61db4] -- Updated dependencies [f041b10b9f] -- Updated dependencies [c1f6cfff47] -- Updated dependencies [7c9a8cc24b] -- Updated dependencies [a34f1cb67d] -- Updated dependencies [ae9ae17eea] -- Updated dependencies [220a766d86] - - @iota/iota-sdk@0.50.0 - - @iota/zksend@0.2.0 - - @iota/wallet-standard@0.10.2 - -## 0.11.1 - -### Patch Changes - -- Updated dependencies [9ac0a4ec01] - - @iota/wallet-standard@0.10.1 - - @iota/iota-sdk@0.49.1 - -## 0.11.0 - -### Minor Changes - -- e5f9e3ba21: Replace tsup based build to fix issues with esm/cjs dual publishing - -### Patch Changes - -- 9ba167b0af: Default storage to memory storage when local storage isn't available during SSR -- Updated dependencies [e5f9e3ba21] - - @iota/wallet-standard@0.10.0 - - @iota/iota-sdk@0.49.0 - -## 0.10.3 - -### Patch Changes - -- 165ad6b21d: Support both `id` and `name` as unique wallet identifiers. -- dd362ec1d6: Update docs url to sdk.mystenlabs.com -- d55db38647: Set a high z-index for the account dropdown so that it doesn't get hidden -- Updated dependencies [dd362ec1d6] -- Updated dependencies [165ad6b21d] - - @iota/wallet-standard@0.9.0 - - @iota/iota-sdk@0.48.1 - -## 0.10.2 - -### Patch Changes - -- 2ae1a6a108: Early return on `useAutoConnectWallet` to improve account switching performance -- b30fecbbca: Fix missing export of useIotaClientQueries -- Updated dependencies [cdcfa76c43] - - @iota/iota-sdk@0.48.0 - - @iota/wallet-standard@0.8.11 - -## 0.10.1 - -### Patch Changes - -- 367779ea2: Improve the reliability of the `useAutoConnectWallet` hook. - -## 0.10.0 - -### Minor Changes - -- 47b137d03: Add new useIotaClientQueries hook to support variable client queries - -## 0.9.1 - -### Patch Changes - -- Updated dependencies [194c980cb] -- Updated dependencies [9ac7e2f3d] -- Updated dependencies [0259aec82] -- Updated dependencies [64d45ba27] - - @iota/iota-sdk@0.47.0 - - @iota/wallet-standard@0.8.10 - -## 0.9.0 - -### Minor Changes - -- c5d4db238: Have useSignPersonalMessage fall back to use iota:signMessage - -### Patch Changes - -- Updated dependencies [652bcdd92] - - @iota/iota-sdk@0.46.1 - - @iota/wallet-standard@0.8.9 - -## 0.8.0 - -### Minor Changes - -- 103ad29c0: Fix the connect button component not opening the modal - -### Patch Changes - -- Updated dependencies [28c2c3330] -- Updated dependencies [43444c58f] -- Updated dependencies [8d1e74e52] -- Updated dependencies [093554a0d] -- Updated dependencies [3718a230b] - - @iota/iota-sdk@0.46.0 - - @iota/wallet-standard@0.8.8 - -## 0.7.0 - -### Minor Changes - -- b359868e3: Fix how esm types are built -- 5d7055365: Fix bug where style resets were being applied to custom trigger buttons - -### Patch Changes - -- Updated dependencies [30b47b758] - - @iota/iota-sdk@0.45.1 - - @iota/wallet-standard@0.8.7 - -## 0.6.0 - -### Minor Changes - -- d4d9c9218: Upgrade dapp-kit and the scaffold applications to react-query v5 -- fb0ce3485: Add global connection status info and change the hook interface of `useCurrentWallet` to - return an object to encapsulate connection info together. To migrate: - - Before: - const currentWallet = useCurrentWallet(); - - After: - const { currentWallet } = useCurrentWallet(); - -### Patch Changes - -- 09c103002: fix pagination in useIotaClientInfiniteQuery -- e0578094b: Fix typing of data for useIotaClientInfiniteQuery -- Updated dependencies [b9afb5567] - - @iota/iota-sdk@0.45.0 - - @iota/wallet-standard@0.8.6 - -## 0.5.0 - -### Minor Changes - -- ade244c3d: Add a new createNetworkConfig helper for managing network specific state - -## 0.4.0 - -### Minor Changes - -- b7c304696: Show account label or iotaNS domain in connect button - -## 0.3.0 - -### Minor Changes - -- 361818abc: execute transaction from dApp rather than wallet in useSignAndExecuteTransactionBlock -- 2b532bc37: Fix issue where CSS was being overridden by application code -- 0c5cdc049: Expose types related to theming -- c7e12c928: Infer the active chain when signing transactions and expose some more descriptive errors - -### Patch Changes - -- Updated dependencies [b48289346] -- Updated dependencies [11cf4e68b] - - @iota/wallet-standard@0.8.5 - - @iota/iota-sdk@0.44.0 - -## 0.2.4 - -### Patch Changes - -- Updated dependencies [004fb1991] - - @iota/iota-sdk@0.43.3 - - @iota/wallet-standard@0.8.4 - -## 0.2.3 - -### Patch Changes - -- Updated dependencies [9b052166d] - - @iota/iota-sdk@0.43.2 - - @iota/wallet-standard@0.8.3 - -## 0.2.2 - -### Patch Changes - -- 87ef14c70: Fix side effects - -## 0.2.1 - -### Patch Changes - -- Updated dependencies [faa13ded9] -- Updated dependencies [c5684bb52] - - @iota/iota-sdk@0.43.1 - - @iota/wallet-standard@0.8.2 - -## 0.2.0 - -### Minor Changes - -- b29f66f18: Add theme definitions for our UI components -- 1227ee1ce: Theme UI components based on provided theme and add design polish -- 8e9590a8c: Exclude non-Iota accounts from the accounts state when someone connects a multi-chain wallet - -## 0.1.0 - -### Minor Changes - -- c51db090a: update useIotaClientQuery hooks and remove generated RPC hooks -- ccfc810c0: Require wallets to have some default characteristics in order to be recognized - -### Patch Changes - -- Updated dependencies [781d073d9] -- Updated dependencies [3764c464f] -- Updated dependencies [e4484852b] -- Updated dependencies [71e0a3197] -- Updated dependencies [1bc430161] - - @iota/iota-sdk@0.43.0 - - @iota/wallet-standard@0.8.1 - -## 0.0.5 - -### Patch Changes - -- Updated dependencies [fd8589806] -- Updated dependencies [fd8589806] -- Updated dependencies [8b9e5f737] - - @iota/wallet-standard@0.8.0 - - @iota/iota-sdk@0.42.0 - -## 0.0.4 - -### Patch Changes - -- @iota/iota-sdk@0.41.2 -- @iota/wallet-standard@0.7.2 - -## 0.0.3 - -### Patch Changes - -- Updated dependencies [24c21e1f0] - - @iota/iota-sdk@0.41.1 - -## 0.0.2 - -### Patch Changes - -- Updated dependencies [ba8e3b857] -- Updated dependencies [f4b7b3474] - - @iota/iota-sdk@0.41.0 - -## 0.0.1 - -### Patch Changes - -- Updated dependencies [a503cad34] -- Updated dependencies [8281e3d25] - - @iota/iota-sdk@0.40.0 diff --git a/sdk/dapp-kit/package.json b/sdk/dapp-kit/package.json index b8f3aba7777..c2bf697a4b4 100644 --- a/sdk/dapp-kit/package.json +++ b/sdk/dapp-kit/package.json @@ -3,7 +3,7 @@ "author": "Mysten Labs ", "description": "A collection of React hooks and components for interacting with the Iota blockchain and wallets.", "homepage": "https://sdk.mystenlabs.com/typescript", - "version": "0.12.7", + "version": "0.0.0", "license": "Apache-2.0", "files": [ "CHANGELOG.md", diff --git a/sdk/graphql-transport/CHANGELOG.md b/sdk/graphql-transport/CHANGELOG.md deleted file mode 100644 index 88ea5ce7bc2..00000000000 --- a/sdk/graphql-transport/CHANGELOG.md +++ /dev/null @@ -1,24 +0,0 @@ -# @iota/graphql-transport - -## 0.0.3 - -### Patch Changes - -- Updated dependencies [6984dd1e38] - - @iota/iota-sdk@0.51.1 - -## 0.0.2 - -### Patch Changes - -- a63b9327a6: Protocol config update -- Updated dependencies [0cafa94027] - - @iota/iota-sdk@0.51.0 - -## 0.0.1 - -### Patch Changes - -- Updated dependencies [4830361fa4] - - @iota/iota-sdk@0.50.1 - - @iota/bcs@0.11.1 diff --git a/sdk/graphql-transport/package.json b/sdk/graphql-transport/package.json index 427d12763a0..10987f6d932 100644 --- a/sdk/graphql-transport/package.json +++ b/sdk/graphql-transport/package.json @@ -1,6 +1,6 @@ { "name": "@iota/graphql-transport", - "version": "0.0.3", + "version": "0.0.0", "description": "A GraphQL transport to allow IotaClient to work with RPC 2.0", "license": "Apache-2.0", "author": "Mysten Labs ", diff --git a/sdk/iotans-toolkit/CHANGELOG.md b/sdk/iotans-toolkit/CHANGELOG.md deleted file mode 100644 index 346b0ee0dad..00000000000 --- a/sdk/iotans-toolkit/CHANGELOG.md +++ /dev/null @@ -1,259 +0,0 @@ -# @iota/iotans-toolkit - -## 0.4.5 - -### Patch Changes - -- Updated dependencies [6984dd1e38] - - @iota/iota-sdk@0.51.1 - -## 0.4.4 - -### Patch Changes - -- Updated dependencies [0cafa94027] - - @iota/iota-sdk@0.51.0 - -## 0.4.3 - -### Patch Changes - -- 4830361fa4: Updated typescript version -- Updated dependencies [4830361fa4] - - @iota/iota-sdk@0.50.1 - -## 0.4.2 - -### Patch Changes - -- Updated dependencies [a34f1cb67d] -- Updated dependencies [c08e3569ef] -- Updated dependencies [9a14e61db4] -- Updated dependencies [13e922d9b1] -- Updated dependencies [a34f1cb67d] -- Updated dependencies [220a766d86] - - @iota/iota-sdk@0.50.0 - -## 0.4.1 - -### Patch Changes - -- 9ac0a4ec01: Add extensions to all sdk import paths -- Updated dependencies [9ac0a4ec01] - - @iota/iota-sdk@0.49.1 - -## 0.4.0 - -### Minor Changes - -- e5f9e3ba21: Replace tsup based build to fix issues with esm/cjs dual publishing - -### Patch Changes - -- Updated dependencies [e5f9e3ba21] - - @iota/iota-sdk@0.49.0 - -## 0.3.18 - -### Patch Changes - -- Updated dependencies [dd362ec1d6] - - @iota/iota-sdk@0.48.1 - -## 0.3.17 - -### Patch Changes - -- Updated dependencies [cdcfa76c43] - - @iota/iota-sdk@0.48.0 - -## 0.3.16 - -### Patch Changes - -- Updated dependencies [194c980cb] -- Updated dependencies [9ac7e2f3d] -- Updated dependencies [0259aec82] -- Updated dependencies [64d45ba27] - - @iota/iota-sdk@0.47.0 - -## 0.3.15 - -### Patch Changes - -- Updated dependencies [652bcdd92] - - @iota/iota-sdk@0.46.1 - -## 0.3.14 - -### Patch Changes - -- Updated dependencies [28c2c3330] -- Updated dependencies [43444c58f] -- Updated dependencies [8d1e74e52] -- Updated dependencies [093554a0d] -- Updated dependencies [3718a230b] - - @iota/iota-sdk@0.46.0 - -## 0.3.13 - -### Patch Changes - -- Updated dependencies [30b47b758] - - @iota/iota-sdk@0.45.1 - -## 0.3.12 - -### Patch Changes - -- Updated dependencies [b9afb5567] - - @iota/iota-sdk@0.45.0 - -## 0.3.11 - -### Patch Changes - -- Updated dependencies [b48289346] -- Updated dependencies [11cf4e68b] - - @iota/iota-sdk@0.44.0 - -## 0.3.10 - -### Patch Changes - -- Updated dependencies [004fb1991] - - @iota/iota-sdk@0.43.3 - -## 0.3.9 - -### Patch Changes - -- Updated dependencies [9b052166d] - - @iota/iota-sdk@0.43.2 - -## 0.3.8 - -### Patch Changes - -- Updated dependencies [faa13ded9] -- Updated dependencies [c5684bb52] - - @iota/iota-sdk@0.43.1 - -## 0.3.7 - -### Patch Changes - -- Updated dependencies [781d073d9] -- Updated dependencies [3764c464f] -- Updated dependencies [e4484852b] -- Updated dependencies [71e0a3197] -- Updated dependencies [1bc430161] - - @iota/iota-sdk@0.43.0 - -## 0.3.6 - -### Patch Changes - -- Updated dependencies [fd8589806] - - @iota/iota-sdk@0.42.0 - -## 0.3.5 - -### Patch Changes - -- @iota/iota-sdk@0.41.2 - -## 0.3.4 - -### Patch Changes - -- Updated dependencies [24c21e1f0] - - @iota/iota-sdk@0.41.1 - -## 0.3.3 - -### Patch Changes - -- Updated dependencies [ba8e3b857] -- Updated dependencies [f4b7b3474] - - @iota/iota-sdk@0.41.0 - -## 0.3.2 - -### Patch Changes - -- Updated dependencies [a503cad34] -- Updated dependencies [8281e3d25] - - @iota/iota-sdk@0.40.0 - -## 0.3.1 - -### Patch Changes - -- Updated dependencies [47ea5ec7c] - - @iota/iota-sdk@0.39.0 - -## 0.3.0 - -### Minor Changes - -- cc6441f46: Updated types and imports to use new modular exports from the `@iota/iota-sdk` refactor -- 6d41059c7: Update to use modular imports from @iota/iota-sdk - - Some methods now accept a `IotaClient` imported from `@iota/iota-sdk/client` rather than a `JsonRpcProvider` - -### Patch Changes - -- Updated dependencies [ad46f9f2f] -- Updated dependencies [67e581a5a] -- Updated dependencies [34242be56] -- Updated dependencies [4e2a150a1] -- Updated dependencies [cce6ffbcc] -- Updated dependencies [0f06d593a] -- Updated dependencies [83d0fb734] -- Updated dependencies [09f4ed3fc] -- Updated dependencies [6d41059c7] -- Updated dependencies [cc6441f46] -- Updated dependencies [001148443] - - @iota/iota-sdk@0.38.0 - -## 0.2.3 - -### Patch Changes - -- Updated dependencies [34cc7d610] - - @iota/iota-sdk@0.37.1 - -## 0.2.2 - -### Patch Changes - -- Updated dependencies [36f2edff3] -- Updated dependencies [75d1a190d] -- Updated dependencies [93794f9f2] -- Updated dependencies [c3a4ec57c] -- Updated dependencies [a17d3678a] -- Updated dependencies [2f37537d5] -- Updated dependencies [00484bcc3] - - @iota/iota-sdk@0.37.0 - -## 0.2.1 - -### Patch Changes - -- Updated dependencies [3ea9adb71a] -- Updated dependencies [1cfb1c9da3] -- Updated dependencies [1cfb1c9da3] -- Updated dependencies [fb3bb9118a] - - @iota/iota-sdk@0.36.0 - -## 0.2.0 - -### Minor Changes - -- 09d77325a9: Add new IotaNS Toolkit package. - -### Patch Changes - -- Updated dependencies [09d77325a9] - - @iota/iota-sdk@0.35.1 diff --git a/sdk/iotans-toolkit/package.json b/sdk/iotans-toolkit/package.json index 04d302b48da..3db51a55b34 100644 --- a/sdk/iotans-toolkit/package.json +++ b/sdk/iotans-toolkit/package.json @@ -2,7 +2,7 @@ "name": "@iota/iotans-toolkit", "author": "Mysten Labs ", "description": "IotaNS TypeScript SDK", - "version": "0.4.5", + "version": "0.0.0", "license": "Apache-2.0", "type": "commonjs", "main": "./dist/cjs/index.js", diff --git a/sdk/kiosk/CHANGELOG.md b/sdk/kiosk/CHANGELOG.md deleted file mode 100644 index 3ee581dcfd4..00000000000 --- a/sdk/kiosk/CHANGELOG.md +++ /dev/null @@ -1,313 +0,0 @@ -# @iota/kiosk - -## 0.8.5 - -### Patch Changes - -- Updated dependencies [6984dd1e38] - - @iota/iota-sdk@0.51.1 - -## 0.8.4 - -### Patch Changes - -- Updated dependencies [0cafa94027] - - @iota/iota-sdk@0.51.0 - -## 0.8.3 - -### Patch Changes - -- 4830361fa4: Updated typescript version -- Updated dependencies [4830361fa4] - - @iota/iota-sdk@0.50.1 - -## 0.8.2 - -### Patch Changes - -- a3971c3524: Fixes `lock` function arguments. `itemId` is replaced by `item`, which accepts an ObjectArgument instead of a string. `itemId` is still supported but deprecated, and will be removed in future versions. -- Updated dependencies [a34f1cb67d] -- Updated dependencies [c08e3569ef] -- Updated dependencies [9a14e61db4] -- Updated dependencies [13e922d9b1] -- Updated dependencies [a34f1cb67d] -- Updated dependencies [220a766d86] - - @iota/iota-sdk@0.50.0 - -## 0.8.1 - -### Patch Changes - -- 9ac0a4ec01: Add extensions to all sdk import paths -- Updated dependencies [9ac0a4ec01] - - @iota/iota-sdk@0.49.1 - -## 0.8.0 - -### Minor Changes - -- e5f9e3ba21: Replace tsup based build to fix issues with esm/cjs dual publishing - -### Patch Changes - -- Updated dependencies [e5f9e3ba21] - - @iota/iota-sdk@0.49.0 - -## 0.7.13 - -### Patch Changes - -- dd362ec1d6: Update docs url to sdk.mystenlabs.com -- Updated dependencies [dd362ec1d6] - - @iota/iota-sdk@0.48.1 - -## 0.7.12 - -### Patch Changes - -- Updated dependencies [cdcfa76c43] - - @iota/iota-sdk@0.48.0 - -## 0.7.11 - -### Patch Changes - -- Updated dependencies [194c980cb] -- Updated dependencies [9ac7e2f3d] -- Updated dependencies [0259aec82] -- Updated dependencies [64d45ba27] - - @iota/iota-sdk@0.47.0 - -## 0.7.10 - -### Patch Changes - -- Updated dependencies [652bcdd92] - - @iota/iota-sdk@0.46.1 - -## 0.7.9 - -### Patch Changes - -- 43444c58f: Extend the `TransactionBlock#object()` API to accept the `TransactionResult` type as well, so that it can be used flexibly in SDKs. -- 3718a230b: Adds `txb.pure.id()` to pass ID pure values more intuitively -- Updated dependencies [28c2c3330] -- Updated dependencies [43444c58f] -- Updated dependencies [8d1e74e52] -- Updated dependencies [093554a0d] -- Updated dependencies [3718a230b] - - @iota/iota-sdk@0.46.0 - -## 0.7.8 - -### Patch Changes - -- Updated dependencies [30b47b758] - - @iota/iota-sdk@0.45.1 - -## 0.7.7 - -### Patch Changes - -- Updated dependencies [b9afb5567] - - @iota/iota-sdk@0.45.0 - -## 0.7.6 - -### Patch Changes - -- b48289346: Mark packages as being side-effect free. -- 3699dd364: Adds support for extensions (on `getKiosk()`), and exports a `getKioskExtension()` function on kioskClient to get extension's content -- Updated dependencies [b48289346] -- Updated dependencies [11cf4e68b] - - @iota/iota-sdk@0.44.0 - -## 0.7.5 - -### Patch Changes - -- Updated dependencies [004fb1991] - - @iota/iota-sdk@0.43.3 - -## 0.7.4 - -### Patch Changes - -- Updated dependencies [9b052166d] - - @iota/iota-sdk@0.43.2 - -## 0.7.3 - -### Patch Changes - -- Updated dependencies [faa13ded9] -- Updated dependencies [c5684bb52] - - @iota/iota-sdk@0.43.1 - -## 0.7.2 - -### Patch Changes - -- 68fea9e97: Fixes resolve royalty rule from breaking. - -## 0.7.1 - -### Patch Changes - -- Updated dependencies [781d073d9] -- Updated dependencies [3764c464f] -- Updated dependencies [e4484852b] -- Updated dependencies [71e0a3197] -- Updated dependencies [1bc430161] - - @iota/iota-sdk@0.43.0 - -## 0.7.0 - -### Minor Changes - -- 5ee8c24f1: Introduces BREAKING CHANGES. Migration guide and explanation: https://sdk.mystenlabs.com/kiosk/from-v1 - -## 0.6.0 - -### Minor Changes - -- fd8589806: Remove uses of deprecated imports from @iota/iota-sdk - -### Patch Changes - -- Updated dependencies [fd8589806] - - @iota/iota-sdk@0.42.0 - -## 0.5.3 - -### Patch Changes - -- @iota/iota-sdk@0.41.2 - -## 0.5.2 - -### Patch Changes - -- Updated dependencies [24c21e1f0] - - @iota/iota-sdk@0.41.1 - -## 0.5.1 - -### Patch Changes - -- Updated dependencies [ba8e3b857] -- Updated dependencies [f4b7b3474] - - @iota/iota-sdk@0.41.0 - -## 0.5.0 - -### Minor Changes - -- 210bfac58: Adds support for attaching royalty rule and kiosk lock rule to a transfer policy. - -### Patch Changes - -- Updated dependencies [a503cad34] -- Updated dependencies [8281e3d25] - - @iota/iota-sdk@0.40.0 - -## 0.4.1 - -### Patch Changes - -- Updated dependencies [47ea5ec7c] - - @iota/iota-sdk@0.39.0 - -## 0.4.0 - -### Minor Changes - -- cc6441f46: Updated types and imports to use new modular exports from the `@iota/iota-sdk` refactor -- 6d41059c7: Update to use modular imports from @iota/iota-sdk - - Some methods now accept a `IotaClient` imported from `@iota/iota-sdk/client` rather than a `JsonRpcProvider` - -### Patch Changes - -- Updated dependencies [ad46f9f2f] -- Updated dependencies [67e581a5a] -- Updated dependencies [34242be56] -- Updated dependencies [4e2a150a1] -- Updated dependencies [cce6ffbcc] -- Updated dependencies [0f06d593a] -- Updated dependencies [83d0fb734] -- Updated dependencies [09f4ed3fc] -- Updated dependencies [6d41059c7] -- Updated dependencies [cc6441f46] -- Updated dependencies [001148443] - - @iota/iota-sdk@0.38.0 - -## 0.3.3 - -### Patch Changes - -- Updated dependencies [34cc7d610] - - @iota/iota-sdk@0.37.1 - -## 0.3.2 - -### Patch Changes - -- Updated dependencies [36f2edff3] -- Updated dependencies [75d1a190d] -- Updated dependencies [93794f9f2] -- Updated dependencies [c3a4ec57c] -- Updated dependencies [a17d3678a] -- Updated dependencies [2f37537d5] -- Updated dependencies [00484bcc3] - - @iota/iota-sdk@0.37.0 - -## 0.3.1 - -### Patch Changes - -- 6a2a42d779: Add `getOwnedKiosks` query to easily get owned kiosks and their ownerCaps for an address -- abf6ad381e: Refactor the fetchKiosk function to return all content instead of paginating, to prevent missing data -- d72fdb5a5c: Fix on createTransferPolicy method. Updated type arguments for public_share_object command. -- Updated dependencies [3ea9adb71a] -- Updated dependencies [1cfb1c9da3] -- Updated dependencies [1cfb1c9da3] -- Updated dependencies [fb3bb9118a] - - @iota/iota-sdk@0.36.0 - -## 0.3.0 - -### Minor Changes - -- 968304368d: Support kiosk_lock_rule and environment support for rules package. Breaks `purchaseAndResolvePolicies` as it changes signature and return format. - -### Patch Changes - -- Updated dependencies [09d77325a9] - - @iota/iota-sdk@0.35.1 - -## 0.2.0 - -### Minor Changes - -- c322a230da: Fix fetchKiosk consistency/naming, include locked state in items - -## 0.1.0 - -### Minor Changes - -- 4ea96d909a: Kiosk SDK for managing, querying and interacting with Kiosk and TransferPolicy objects - -### Patch Changes - -- 528cfec314: fixes publishing flow -- Updated dependencies [4ea96d909a] -- Updated dependencies [bcbb178c44] -- Updated dependencies [470c27af50] -- Updated dependencies [03828224c9] -- Updated dependencies [671faefe3c] -- Updated dependencies [9ce7e051b4] -- Updated dependencies [9ce7e051b4] -- Updated dependencies [bb50698551] - - @iota/iota-sdk@0.35.0 diff --git a/sdk/kiosk/package.json b/sdk/kiosk/package.json index 42c15c656a9..2cf8681fda5 100644 --- a/sdk/kiosk/package.json +++ b/sdk/kiosk/package.json @@ -2,7 +2,7 @@ "name": "@iota/kiosk", "author": "Mysten Labs ", "description": "Iota Kiosk library", - "version": "0.8.5", + "version": "0.0.0", "license": "Apache-2.0", "type": "commonjs", "main": "./dist/cjs/index.js", diff --git a/sdk/ledgerjs-hw-app-iota/CHANGELOG.md b/sdk/ledgerjs-hw-app-iota/CHANGELOG.md deleted file mode 100644 index dcb03d12d6e..00000000000 --- a/sdk/ledgerjs-hw-app-iota/CHANGELOG.md +++ /dev/null @@ -1,27 +0,0 @@ -# @iota/ledgerjs-hw-app-iota - -## 0.3.1 - -### Patch Changes - -- 4830361fa4: Updated typescript version - -## 0.3.0 - -### Minor Changes - -- e5f9e3ba21: Replace tsup based build to fix issues with esm/cjs dual publishing - -## 0.2.0 - -### Minor Changes - -- 29a29756d: Added "displayOnDevice" option to getPublicKey and cleaned-up some library code - -## 0.1.0 - -### Minor Changes - -- a6690ac7d: Changed the default behavior of `publish` to publish an upgreadeable-by-sender package instead of immutable. -- 0a7b42a6d: This changes almost all occurrences of "delegate", "delegation" (and various capitalizations/forms) to their equivalent "stake"-based name. Function names, function argument names, RPC endpoints, Move functions, and object fields have been updated with this new naming convention. -- 3709957cf: Published initial version of library diff --git a/sdk/ledgerjs-hw-app-iota/package.json b/sdk/ledgerjs-hw-app-iota/package.json index 5a690a8bf5f..5726f41b8f9 100644 --- a/sdk/ledgerjs-hw-app-iota/package.json +++ b/sdk/ledgerjs-hw-app-iota/package.json @@ -1,6 +1,6 @@ { "name": "@iota/ledgerjs-hw-app-iota", - "version": "0.3.1", + "version": "0.0.0", "description": "Ledger Hardware Wallet Iota Application API", "keywords": [ "Ledger", diff --git a/sdk/typescript/CHANGELOG.md b/sdk/typescript/CHANGELOG.md deleted file mode 100644 index 81124e71d2f..00000000000 --- a/sdk/typescript/CHANGELOG.md +++ /dev/null @@ -1,858 +0,0 @@ -# @iota/iota-sdk - -## 0.51.1 - -### Patch Changes - -- 6984dd1e38: Update gql.tada and add type definitions for custom scalars - -## 0.51.0 - -### Minor Changes - -- 0cafa94027: Remove deprecated types directory - -## 0.50.1 - -### Patch Changes - -- 4830361fa4: Updated typescript version -- Updated dependencies [4830361fa4] - - @iota/bcs@0.11.1 - -## 0.50.0 - -### Minor Changes - -- a34f1cb67d: Use Bech32 instead of Hex for private key export, supports both Hex and Bech32 for importing - -### Patch Changes - -- a34f1cb67d: deprecate ExportedKeypair -- c08e3569ef: Export all keypair utilities -- 9a14e61db4: Allow signer in signAndExecuteTransactionBlock to be a Signer rather than a Keypair -- 13e922d9b1: Fix multiple shared objects not respecting mutable correctly -- 220a766d86: Fix WebSocket constructor not being properly assigned in IotaClient HTTP transport -- Updated dependencies [bae8802fe3] - - @iota/bcs@0.11.0 - -## 0.49.1 - -### Patch Changes - -- 9ac0a4ec01: Add extensions to all sdk import paths -- Updated dependencies [9ac0a4ec01] - - @iota/bcs@0.10.1 - -## 0.49.0 - -### Minor Changes - -- e5f9e3ba21: Replace tsup based build to fix issues with esm/cjs dual publishing - -### Patch Changes - -- Updated dependencies [e5f9e3ba21] - - @iota/bcs@0.10.0 - -## 0.48.1 - -### Patch Changes - -- dd362ec1d6: Update docs url to sdk.mystenlabs.com -- Updated dependencies [dd362ec1d6] - - @iota/bcs@0.9.1 - -## 0.48.0 - -### Minor Changes - -- cdcfa76c43: Add a new client method for retrieving epoch metrics (iotax_getEpochMetrics) - -### Patch Changes - -- Updated dependencies [fce0a08d0f] - - @iota/bcs@0.9.0 - -## 0.47.0 - -### Minor Changes - -- 0259aec82: Removed dependency on @open-rpc/client-js and replaced it with standard fetch and WebSocket based APIs - - If you are using the `subscribeEvent` or `subscribeTransaction` in environments that do not support the `WebSocket` api natively (This will be true for most versions of Node.js) you will need to provide a WebSocket implementation when creating your IotaClient. You can either use a global polyfill for the WebSocket class, or pass a compatible WebSocket implementation into IotaHTTPTransport (eg, using the `ws` package) - - ```typescript - import { getFullnodeUrl, IotaClient, IotaHTTPTransport } from '@iota/iota-sdk/client'; - import { WebSocket } from 'ws'; - - new IotaClient({ - transport: new IotaHTTPTransport({ - url: getFullnodeUrl('mainnet'), - // The typescript definitions may not match perfectly, casting to never avoids these minor incompatibilities - WebSocketConstructor: WebSocket as never, - }), - }); - ``` - -- 64d45ba27: Add support for zklogin sig inside multisig - -### Patch Changes - -- 194c980cb: Properly determine shared object mutability when being passed by value. -- 9ac7e2f3d: Add additional type exports to zklogin package - -## 0.46.1 - -### Patch Changes - -- 652bcdd92: Remove some multisig methods that had previously been deprecated and are no longer exported - -## 0.46.0 - -### Minor Changes - -- 093554a0d: Remove deprecated framework code. - -### Patch Changes - -- 28c2c3330: Use the same issuer string in address derivation for the two google's iss values -- 43444c58f: Extend the `TransactionBlock#object()` API to accept the `TransactionResult` type as well, so that it can be used flexibly in SDKs. -- 8d1e74e52: Fix setting gasPrice for devInspectTransactionBlock -- 3718a230b: Adds `txb.pure.id()` to pass ID pure values more intuitively - -## 0.45.1 - -### Patch Changes - -- 30b47b758: Fix formatting when parsing addresses with bcs.Address - -## 0.45.0 - -### Minor Changes - -- b9afb5567: adds "transfer to object" (receivingRef) support - -## 0.44.0 - -### Minor Changes - -- 11cf4e68b: Remove deprecated methods. - -### Patch Changes - -- b48289346: Mark packages as being side-effect free. -- Updated dependencies [b48289346] - - @iota/bcs@0.8.1 - -## 0.43.3 - -### Patch Changes - -- 004fb1991: Export TransactionResult type - -## 0.43.2 - -### Patch Changes - -- 9b052166d: Register Option enum to sdk bcs registry - -## 0.43.1 - -### Patch Changes - -- faa13ded9: Ensure that TransactionBlocks can be copied via structuredClone to workaround bug in iota wallet -- c5684bb52: rename zk to zkLogin - -## 0.43.0 - -### Minor Changes - -- 781d073d9: Update getFaucetRequestStatus to GET request -- e4484852b: Improve APIs for building transaction inputs - - - txb.splitCoins now accepts `amounts`` as raw JavaScript number - - txb.transferObjects now accepts `address` as JavaScript string - - All single objects, or lists of objects, now also accepts object IDs as JavaScript strings - - txb.pure accepts `SerializedBcs` (eg `txb.pure(bcs.U64.serialize(123))`) - - Added pure helpers (`txb.pure.address()`, `txb.bool()`, and `txb.pure.u{8-256}()`) to simplify serialization of pure values - - Deprecated using `txb.pure` with raw JavaScript values, or an explicit type argument. - -- 1bc430161: Updated BCS definitions to use new BCS schema builder - -### Patch Changes - -- 3764c464f: - add support for basic parsing of zkLogin signatures - - new zklogin package -- 71e0a3197: zklogin improvements - - - use new bcs api - - rename `toBufferBE` to `toBigEndianBytes` - - stop exporting `ZkLoginSignatureInputs` and `extractClaimValue` - -- Updated dependencies [1bc430161] -- Updated dependencies [e4484852b] - - @iota/bcs@0.8.0 - -## 0.42.0 - -### Minor Changes - -- fd8589806: Remove all previously deprecated exports from @iota/iota-sdk - -## 0.41.2 - -### Patch Changes - -- Updated dependencies [290c8e640] - - @iota/bcs@0.7.4 - -## 0.41.1 - -### Patch Changes - -- 24c21e1f0: Fix defaults not being applied correctly in websocket client - -## 0.41.0 - -### Minor Changes - -- ba8e3b857: Rename TransactionBlock generated type in @iota/iota-sdk/client to IotaTransactionBlock to avoid conflicting names in exports - -### Patch Changes - -- f4b7b3474: Adds zk signature scheme - -## 0.40.0 - -### Minor Changes - -- a503cad34: Add exports to `@iota/iota-sdk/client` for rpc method params - -### Patch Changes - -- 8281e3d25: Add new `sign` method to the TransactionBlock class, so that implementing transaction signing is easier. - -## 0.39.0 - -### Minor Changes - -- 47ea5ec7c: Update keypair signature methods to return bytes as a base64 encoded string for better compatability - -## 0.38.0 - -### Minor Changes - -- 67e581a5a: Added FromOrToAddress Transaction Filter -- cce6ffbcc: Add toIotaPublicKey method for retrieving the Iota representation of a raw public key -- 0f06d593a: Added a MultiSigPublicKey class for verifying multisig signatures -- 09f4ed3fc: update signMessage to correctly wrap PersonalMessages before signing -- 6d41059c7: Deprecate imports from the root path which can be imported from a modular export -- cc6441f46: The Iota TS SDK has been broken up into a set of modular exports, and all exports from the root of - the package have been deprecated. The following export paths have been added: - - - `@iota/iota-sdk/client` - A client for interacting with Iota RPC nodes. - - `@iota/iota-sdk/bcs` - A BCS builder with pre-defined types for Iota. - - `@iota/iota-sdk/transaction` - Utilities for building and interacting with transactions. - - `@iota/iota-sdk/keypairs/*` - Modular exports for specific KeyPair implementations. - - `@iota/iota-sdk/verify` - Methods for verifying transactions and messages. - - `@iota/iota-sdk/cryptography` - Shared types and classes for cryptography. - - `@iota/iota-sdk/multisig` - Utilities for working with multisig signatures. - - `@iota/iota-sdk/utils` - Utilities for formatting and parsing various Iota types. - - `@iota/iota-sdk/faucet`- Methods for requesting iota from a faucet. - - As part of this refactor we are deprecating a number of existing APIs: - - - `JsonRPCProvider` - This Provider pattern is being replaced by a new `IotaClient` - - `SignerWithProver` and `RawSigner` - The Concept of Signers is being removed from the SDK. Signing - in verifying has been moved to the KeyPair classes, and the `signAndExecuteTransactionBlock` - method has been moved to the new `IotaClient`. - - The `superstruct` type definitions for types used by JsonRPCProvider are being replaced with - generated types exported from `@iota/iota-sdk/client`. The new type definitions are pure - typescript types and can't be used for runtime validation. By generating these as types, it will - be easier to keep them in sync with the RPC definitions and avoid discrepancies between the type - definitions in the SDK and the data returned by RPC methods. - - A large number of "getters" are being deprecated. These getters were intended to reduce friction - caused by rapid iteration in the RPC layer leading up to the mainnet launch. Now that mainnet has - been launched the RPC API should be more stable, and many of these helpers can be replaced by - simply accessing the nested properties in the returned data directly. - - The current release should be mostly backwards compatible, and all existing exports will continue to - be available in this release (with deprecation warnings). With the large number of deprecations - there may be functionality that should be moved into the new modular version of the SDK. If you find - there are features that were deprecated without a suitable replacement, we have created a - [Github Discussion thread](https://github.com/iotaledger/iota/discussions/13150) to track those - use-cases. - - #### Migrating imports - - To migrate imports, you should be able to hover over the deprecated import in the editor of you - choice, this should provide either the deprecation message letting you know where to import the - replacement from, or a like "The declaration was marked as deprecated here." with a link to the - deprecation comment which will tell you how to update your import - - #### Migrating JsonRpcProvider - - The new IotaClient should mostly work as a drop in replacement for the `JsonRpcProvider` provider. - Setting up a `IotaClient` is slightly different, but once constructed should work just like a - provider. - - ```diff - - import { JsonRpcProvider, devnetConnection } from '@iota/iota-sdk'; - + import { IotaClient, getFullnodeUrl } from '@iota/iota-sdk/client'; - - - const provider = new JsonRpcProvider(localnetConnection); - + const client = new IotaClient({ url: getFullnodeUrl('localnet')}); - ``` - - #### Signing TransactionBlocks - - Signing and sending transaction blocks has change slightly with the deprecation of the `Signer` - pattern: - - ```diff - - import { - - Ed25519Keypair, - - JsonRpcProvider, - - RawSigner, - - TransactionBlock, - - localnetConnection, - - } from '@iota/iota-sdk'; - + import { Ed25519Keypair } from '@iota/iota-sdk/keypairs/ed25519'; - + import { IotaClient, getFullnodeUrl } from '@iota/iota-sdk/client'; - + import { TransactionBlock } from '@iota/iota-sdk/transactions'; - - const keypair = new Ed25519Keypair() - - const provider = new JsonRpcProvider(localnetConnection); - - const signer = new RawSigner(keyPair, provider); - + const client = new IotaClient({ url: getFullnodeUrl('localnet')}); - - - const result = await signer.signAndExecuteTransactionBlock({ - + const result = await client.signAndExecuteTransactionBlock({ - + signer: keypair, - transactionBlock: tx, - options: { ... } - }) - ``` - - #### Migrating faucet requests - - The ability to request Iota from a faucet was not added to `IotaClient`, instead you will need to use - a method `@iota/iota-sdk/faucet` to make these requests - - ```diff - - import { JsonRpcProvider, devnetConnection } from '@iota/iota-sdk'; - - const provider = new JsonRpcProvider(devnetConnection); - + import { requestIotaFromFaucetV0, getFaucetHost } from '@iota/iota-sdk/faucet'; - - - await provider.requestIotaFromFaucet( - - '' - - ); - + await requestIotaFromFaucetV0({ - + host: getFaucetHost('devnet'), - + recipient: '', - +}); - ``` - -- 001148443: Introduce new `@iota/iota-sdk/faucet` export, which should be used for all faucet interactions. This deprecates the previous `requestIotaFromFaucet` APIs that existed on the `JsonRpcProvider` and `Signer` classes. - -### Patch Changes - -- ad46f9f2f: add getAllEpochAddressMetrics method to rpc-provider -- 34242be56: Add new `isTransactionBlock` method, and deprecate the previous `TransactionBlock.is` method -- 4e2a150a1: websocket client memory leak fix in reconnect logics -- 83d0fb734: Deprecate type aliases for strings. - -## 0.37.1 - -### Patch Changes - -- 34cc7d610: Fix unhandled rejections thrown by waitForTransaction - -## 0.37.0 - -### Minor Changes - -- 93794f9f2: Update build to avoid bundling for better modularity -- a17d3678a: Add keypair exports to allow modular imports for various keypair types - -### Patch Changes - -- 36f2edff3: Use splitGenericParamaters util from bcs -- 75d1a190d: Fix bug that prevented deserializing transaction blocks with a set expiration -- c3a4ec57c: Add explicit dependency on events package -- 2f37537d5: Update `IotaEventFilter` structure for `TimeRange` query. -- 00484bcc3: add method to create Ed25519Keypair from a mnemonic seed -- Updated dependencies [36f2edff3] - - @iota/bcs@0.7.3 - -## 0.36.0 - -### Minor Changes - -- 3ea9adb71a: Add multisig support -- 1cfb1c9da3: The `TransactionBlock` builder now uses the protocol config from the chain when constructing and validating transactions, instead of using hard-coded limits. If you wish to perform signing offline (without a provider), you can either define a `protocolConfig` option when building a transaction, or explicitly set `limits`, which will be used instead of the protocol config. -- fb3bb9118a: Remove logging of RPCValidation errors when typescript types do not match RPC response types - -### Patch Changes - -- 1cfb1c9da3: Added `getProtocolConfig()` method to the provider. -- Updated dependencies [ca5c72815d] -- Updated dependencies [fdb569464e] - - @iota/bcs@0.7.2 - -## 0.35.1 - -### Patch Changes - -- 09d77325a9: Add new IotaNS Toolkit package. - -## 0.35.0 - -### Minor Changes - -- 470c27af50: Added network address metrics -- 671faefe3c: Add `getChainIdentifier` method -- 9ce7e051b4: Update internal client to use `@open-rpc/client-js` instead of `jayson` and `rpc-websockets`. This results in a more consistent experience and better error messaging. - -### Patch Changes - -- 4ea96d909a: the event BCS data is a base64 string -- bcbb178c44: Fixes BCS definition so it matches the RPC one -- 03828224c9: Previously, effects had an unwrapped_then_deleted field on ts-sdk. This is an issue since jsonrpc returns the field as unwrappedThenDeleted. Update the transaction type definition to use camelcase. -- 9ce7e051b4: Add `subscribeTransaction` method. -- bb50698551: Fixes BCS type definition in the type layout - -## 0.34.1 - -### Patch Changes - -- 85719ac933: Add `tryGetPastObject` support in the provider. -- c3d9cc87f3: Update ts-sdk e2e test to reflect new rpc error language -- 02a6063f82: Add `normalizeStructTag` and `parseStructTag` helper functions - -## 0.34.0 - -### Minor Changes - -- 280821e0ab: Add "mainnet" connection to the list of available connections - -### Patch Changes - -- 6a9abe9e38: Fix `type` field in MakeMoveVec - -## 0.33.0 - -### Minor Changes - -- 7915de531: Strip disassembled modules from publish/upgrade transaction inputs. -- e61ed2bac: Added new TransactionFilter fields - -### Patch Changes - -- 6f9fc94ca: Increase max size of pure inputs -- 605eac8c6: Bugfix for makeMoveVec when not providing type arguments. -- 262e3dfdd: Add support for account switching in Wallet Kit. -- 91c63e4f8: Fix transaction building with >50 input objects. -- 5053a8dc8: Add getValidatorsApy to rpc - -## 0.32.2 - -### Patch Changes - -- 4ae3cbea3: Response for `getCoinMetadata` is now nullable, in the event that no metadata can be found. -- d2755a496: Fix dependency on msw -- f612dac98: Change the default gas budgeting to take storage rebates into account. -- c219e7470: Changed the response type of `getRpcApiVersion` to string. -- 59ae0e7d6: Removed `skipDataValidation` option, this is now not configurable and is the default behavior. -- c219e7470: Fix type of `limit` on `getCheckpoints` and `getEpochs` API so that is correctly a number. -- 4e463c691: Add `waitForTransactionBlock` API to wait for a transaction to be available over the API. -- b4f0bfc76: Fix type definitions for package exports. -- Updated dependencies [b4f0bfc76] - - @iota/bcs@0.7.1 - -## 0.32.1 - -### Patch Changes - -- 3224ffcd0: Adding support for the `upgrade` transaction type. - -## 0.32.0 - -### Minor Changes - -- 9b42d0ada: This release replaces all uint64 and uint128 numbers with BigInt in all JSON RPC responses to preserve precision. This is a Major Breaking Change - you must update your TS-SDK to latest version - -## 0.31.0 - -### Minor Changes - -- 976d3e1fe: Add new `getNetworkMetrics` endpoint to JSONRPCProvider. -- 5a4e3e416: Change getOwnedObject to ignore checkpoint and return latest objects - -### Patch Changes - -- 0419b7c53: Match ts Publish schema to rust sdk -- f3c096e3a: Fix PaginatedObjectsResponse schema -- 27dec39eb: Make getOwnedObjects backward compatible from 0.29 to 0.30. - -## 0.30.0 - -### Minor Changes - -- 956ec28eb: Change `signMessage` to return message bytes. Add support for iota:signMessage in the wallet standard -- 4adfbff73: Use Blake2b instead of sha3_256 for address generation -- 4c4573ebe: Removed DevInspectResultsType and now DevInspectResults has a property results of ExecutionResultType and a property error -- acc2edb31: Update schema for `IotaSystemState` and `DelegatedStake` -- 941b03af1: Change functions in transactions.ts of ts-sdk such that: `getTotalGasUsed` and `getTotalGasUsedUpperBound` of ts-sdk return a `bigint`,fields of `gasCostSummary` are defined as `string`, `epochId` is defined as `string`. In `iota-json-rpc` the corresponding types are defined as `BigInt`. Introduce `IotaEpochId` type to `iota-json-rpc` types that is a `BigInt`. -- a6690ac7d: Changed the default behavior of `publish` to publish an upgreadeable-by-sender package instead of immutable. -- a211dc03a: Change object digest from Base64 encoded to Base58 encoded for rpc version >= 0.28.0 -- 4c1e331b8: Gas budget is now optional, and will automatically be computed by executing a dry-run when not provided. -- 19b567f21: Unified self- and delegated staking flows. Removed fields from `Validator` (`stake_amount`, `pending_stake`, and `pending_withdraw`) and renamed `delegation_staking_pool` to `staking_pool`. Additionally removed the `validator_stake` and `delegated_stake` fields in the `ValidatorSet` type and replaced them with a `total_stake` field. -- 7659e2e91: Introduce new `Transaction` builder class, and deprecate all existing methods of sending transactions. The new builder class is designed to take full advantage of Programmable Transactions. Any transaction using the previous `SignableTransaction` interface will be converted to a `Transaction` class when possible, but this interface will be fully removed soon. -- 0d3cb44d9: Change all snake_case field in ts-sdk normalized.ts to camelCase. -- 36c264ebb: Remove `generateTransactionDigest`. Use one of the following instead: `signer.getTransactionDigest`, `Transaction.getDigest()` or `TransactionDataBuilder.getDigestFromBytes()` instead. -- 891abf5ed: Remove support for RPC Batch Request in favor of multiGetTransactions and multiGetObjects -- 2e0ef59fa: Added VALIDATORS_EVENTS_QUERY -- 33cb357e1: Change functions in json-rpc-provider.ts of ts-sdk such that: `getTotalTransactionBlocks`, `getReferenceGasPrice` return a `bigint`, `getLatestCheckpointSequenceNumber` returns a `string`, `gasPrice` of `devInspectTransactionBlock` is defined as a `string`, checkpoint sequence number of `getCheckpoint` is defined as a `string`, `cursor` of `getCheckpoints` is defined as a `string`. Introduce `IotaCheckpointSequenceNumber` type in iota-json-rpc-types that is a `BigInt` to use instead of `CheckpointSequenceNumber` of iota-types. -- 6bd88570c: Rework all coin APIs to take objects as arguments instead of positional arguments. -- f1e42f792: Consolidate get_object and get_raw_object into a single get_object endpoint which now takes an additional config parameter with type `IotaObjectDataOptions` and has a new return type `IotaObjectResponse`. By default, only object_id, version, and digest are fetched. -- 272389c20: Support for new versioned TransactionData format -- 3de8de361: Remove `getIotaSystemState` method. Use `getLatestIotaSystemState` method instead. -- be3c4f51e: Add `display` field in `IotaObjectResponse` for frontend rendering. See more details in https://forums.iota.io/t/nft-object-display-proposal/4872 -- dbe73d5a4: Update `executeTransaction` and `signAndExecuteTransaction` to take in an additional parameter `IotaTransactionBlockResponseOptions` which is used to specify which fields to include in `IotaTransactionBlockResponse` (e.g., transaction, effects, events, etc). By default, only the transaction digest will be included. -- c82e4b454: Introduce BigInt struct to iota-json-rpc-types to serialize and deserialize amounts to/from string. Change ts-sdk to serialize amounts of PayIota and Pay as string. -- 7a2eaf4a3: Changing the IotaObjectResponse struct to use data/error fields instead of details/status -- 2ef2bb59e: Deprecate getTransactionDigestsInRange. This method will be removed before April 2023, please use `getTransactions` instead -- 9b29bef37: Pass blake2b hash to signer API -- 8700809b5: Add a new `getCheckpoints` endpoint that returns a paginated list of checkpoints. -- 5c3b00cde: Add object id to staking pool and pool id to staked iota. -- 01272ab7d: Remove deprecated `getCheckpointContents`, `getCheckpointContentsByDigest`, `getCheckpointSummary` and `getCheckpointSummaryByDigest` methods. -- 9822357d6: Add getStakesByIds to get DelegatedStake queried by id -- 3d9a04648: Adds `deactivation_epoch` to staking pool object, and adds `inactive_pools` to the validator set object. -- da72e73a9: Change the address of Move package for staking and validator related Move modules. -- a0955c479: Switch from 20 to 32-byte address. Match Secp256k1.deriveKeypair with Ed25519. -- 0c9047698: Remove all gas selection APIs from the json rpc provider. -- d5ef1b6e5: Added dependencies to publish command, dependencies now also returned from the iota move CLI with the `--dump-bytecode-as-base64` flag -- 0a7b42a6d: This changes almost all occurrences of "delegate", "delegation" (and various capitalizations/forms) to their equivalent "stake"-based name. Function names, function argument names, RPC endpoints, Move functions, and object fields have been updated with this new naming convention. -- 3de8de361: Remove `getValidators` API. Use `getLatestIotaSystemState` instead. -- dd348cf03: Refactor `getTransactions` to `queryTransactions` -- 57c17e02a: Removed `JsonRpcProviderWithCache`, use `JsonRpcProvider` instead. -- 65f1372dd: Rename `provider.getTransactionWithEffects` to `provider.getTransaction`. The new method takes in an additional parameter `IotaTransactionBlockResponseOptions` to configure which fields to fetch(transaction, effects, events, etc). By default, only the transaction digest will be returned. -- a09239308: [testing only] an intent scope can be passed in to verifyMessage -- fe335e6ba: Removed usage of `cross-fetch` in the TypeScript SDK. If you are running in an environment that does not have `fetch` defined, you will need to polyfill it. -- 5dc25faad: Remove getTransactionDigestsInRange from the SDK -- 64234baaf: added combined `getCheckpoint` endpoint for retrieving information about a checkpoint -- d3170ba41: All JSON-RPC APIs now accept objects instead of positional arguments. -- a6ffb8088: Removed events from transaction effects, TransactionEvents will now be provided in the TransactionResponse, along side TransactionEffects. -- 3304eb83b: Refactor Rust IotaTransactionBlockKind to be internally tagged for Json serialization with tag="type" and IotaEvent to be adjacently tagged with tag="type" and content="content" -- 4189171ef: Adds support for validator candidate. -- 77bdf907f: When parsing u64, u128, and u256 values with bcs, they are now string encoded. -- a74df16ec: Minor change to the system transaction format -- 0f7aa6507: Switching the response type of the getOwnedObjects api to a paginatedObjects response, and also moving filtering to FN -- 9b60bf700: Change all snake_case fields in checkpoint.ts and faucet.ts to camelCase -- 64fb649eb: Remove old `IotaExecuteTransactionResponse` interface, and `CertifiedTransaction` interface in favor of the new unified `IotaTransactionBlockResponse` interfaces. -- a6b0c4e5f: Changed the getOwnerObjectsForAddress api to getOwnedObjects, and added options/ pagination to the parameters - -### Patch Changes - -- 00bb9bb66: Correct "consensus_address" in ValidatorMetadata to "primary_address" -- 14ba89144: Change StakingPool structure by removing pool token supply and adding exchange rates. -- 3eb3a1de8: Make Ed25519 ExportedKeyPair only use 32 bytes seed. -- 4593333bd: Add optional parameter for filtering object by type in getOwnedObjectsByAddress -- 79c2165cb: Remove locked coin staking -- 210840114: Add cross-env to prepare:e2e script for Windows machines functionality -- Updated dependencies [19b567f21] -- Updated dependencies [5c3b00cde] -- Updated dependencies [3d9a04648] -- Updated dependencies [a8049d159] -- Updated dependencies [a0955c479] -- Updated dependencies [0a7b42a6d] -- Updated dependencies [77bdf907f] - - @iota/bcs@0.7.0 - -## 0.29.1 - -### Patch Changes - -- 31bfcae6a: Make arguments field optional for MoveCall to match Rust definition. This fixes a bug where the Explorer page does not load for transactions with no argument. - -## 0.29.0 - -### Minor Changes - -- f2e713bd0: Add TransactionExpiration to TransactionData -- 4baf554f1: Make fromSecretKey take the 32 bytes privkey -- aa650aa3b: Introduce new `Connection` class, which is used to define the endpoints that are used when interacting with the network. -- 6ff0c785f: Use DynamicFieldName struct instead of string for dynamic field's name - -### Patch Changes - -- f1e3a0373: Expose rpcClient and websocketClient options -- 0e202a543: Remove pending delegation switches. -- 67e503c7c: Move base58 libraries to BCS -- Updated dependencies [0e202a543] - - @iota/bcs@0.6.1 - -## 0.28.0 - -### Minor Changes - -- a67cc044b: Transaction signatures are now serialized into a single string, and all APIs that previously took the public key, signature, and scheme now just take the single serialized signature string. To help make parsing this easier, there are new `toSerializedSignature` and `toParsedSignaturePubkeyPair` methods exposed as well. -- a67cc044b: The RawSigner now provides a `signTransaction` function, which can be used to sign a transaction without submitting it to the network. -- a67cc044b: The RawSigner now provides a `signMessage` function that can be used to sign personal messages. The SDK also now exports a `verifyMessage` function that can be used to easily verify a message signed with `signMessage`. - -### Patch Changes - -- 24bdb66c6: Include client type and version in RPC client request headers -- Updated dependencies [598f106ef] - - @iota/bcs@0.6.0 - -## 0.27.0 - -### Minor Changes - -- 473005d8f: Add protocol_version to CheckpointSummary and IotaSystemObject. Consolidate end-of-epoch information in CheckpointSummary. -- 59641dc29: Support for deserializing new ConsensusCommitPrologue system transaction -- 629804d26: Remove usage of `Base64DataBuffer`, and use `Uint8Array` instead. -- f51c85e85: remove get_objects_owned_by_object and replace it with get_dynamic_fields - -### Patch Changes - -- fcba70206: Add basic formatting utilities -- ebe6c3945: Support deserializing `payIota` and `payAllIota` transactions -- e630f6832: Added string option to getCheckpointContents call in SDK to support 0.22.0 - -## 0.26.1 - -### Patch Changes - -- 97c46ca9d: Support calling Move function with "option" parameter - -## 0.26.0 - -### Minor Changes - -- a8746d4e9: update IotaExecuteTransactionResponse -- e6a71882f: Rename getDelegatedStake to getDelegatedStakes -- 21781ba52: Secp256k1 signs 64-bytes signature [r, s] instead of [r, s, v] with recovery id - -### Patch Changes - -- 034158656: Allow passing Pure args directly in Move call -- 57fc4dedd: Fix gas selection logic to take gas price into account -- e6a71882f: Add convenience methods in RpcTxnDataSerializer for building staking transactions -- b3ba6dfbc: Support Genesis transaction kind - -## 0.25.0 - -### Minor Changes - -- 7b4bf43bc: Support for interacting with Devnet v0.24+ where Move Calls refer to their packages by ObjectID only (not ObjectRef). - -### Patch Changes - -- ebfdd5c56: Adding Checkpoint APIs for ts sdk -- 72481e759: Updated to new dev inspect transaction layout -- 969a88669: RPC requests errors now don't include the html response text (to keep message shorter) - -## 0.24.0 - -### Minor Changes - -- 88a687834: Add methods for the CoinRead endpoints - -### Patch Changes - -- 01458ffd5: Fix websocket default port for DevNet -- a274ecfc7: Make previousTransaction optional for CoinStruct to support v0.22 network where it doesn't exist -- 89091ddab: change estimator logic to use upper bound -- 71bee7563: fix creating websocket url - -## 0.23.0 - -### Minor Changes - -- e26f47cbf: added getDelegatedStake and getValidators and validator type -- b745cde24: Add a call(endpoint, params) method to invoke any RPC endpoint -- 35e0df780: EventID should use TransactionDigest instead of TxSequence -- 5cd51dd38: Deprecate iota_executeTransaction in favor of iota_executeTransactionSerializedSig -- 8474242af: Add methods for getDynamicFields and getDynamicFieldObject -- f74181212: Add method to deserialize a public key, using it's schema and base64 data - -### Patch Changes - -- f3444bdf2: fix faucet response type -- 01efa8bc6: Add getReferenceGasPrice -- 01efa8bc6: Use reference gas price instead of a hardcoded "1" for transaction construction - -## 0.22.0 - -### Minor Changes - -- a55236e48: Add gas price field to RPC transaction data type - -### Patch Changes - -- 8ae226dae: Fix schema validation bug in Coin.newPayTransaction - -## 0.21.0 - -### Minor Changes - -- 4fb12ac6d: - removes `transfer` function from framework Coin - - renames `newTransferTx` function from framework Coin to `newPayTransaction`. Also it's now a public method and without the need of signer so a dapp can use it - - fixes edge cases with pay txs -- bb14ffdc5: Remove ImmediateReturn and WaitForTxCert from ExecuteTransactionRequestType -- d2015f815: Rebuilt type-narrowing utilities (e.g. `isIotaObject`) on top of Superstruct, which should make them more reliable. - The type-narrowing functions are no longer exported, instead a Superstruct schema is exported, in addition to an `is` and `assert` function, both of which can be used to replace the previous narrowing functions. For example, `isIotaObject(data)` becomes `is(data, IotaObject)`. -- 7d0f25b61: Add devInspectTransaction, which is similar to dryRunTransaction, but lets you call any Move function(including non-entry function) with arbitrary values. - -### Patch Changes - -- 9fbe2714b: Add devInspectMoveCall, which is similar to devInspectTransaction, but lets you call any Move function without a gas object and budget - -## 0.20.0 - -### Minor Changes - -- ea71d8216: Use intent signing if iota version > 0.18 - -### Patch Changes - -- f93b59f3a: Fixed usage of named export for CommonJS module - -## 0.19.0 - -### Minor Changes - -- 6c1f81228: Remove signature from trasaction digest hash -- 519e11551: Allow keypairs to be exported -- b03bfaec2: Add getTransactionAuthSigners endpoint - -### Patch Changes - -- b8257cecb: add missing int types -- f9be28a42: Fix bug in Coin.isCoin -- 24987df35: Regex change for account index for supporting multiple accounts - -## 0.18.0 - -### Minor Changes - -- 66021884e: Send serialized signature with new executeTransactionSerializedSig endpoint -- 7a67d61e2: Unify TxnSerializer interface -- 2a0b8e85d: Add base58 encoding for TransactionDigest - -### Patch Changes - -- 45293b6ff: Replace `getCoinDenominationInfo` with `getCoinMetadata` -- 7a67d61e2: Add method in SignerWithProvider for calculating transaction digest - -## 0.17.1 - -### Patch Changes - -- 623505886: Fix callArg serialization bug in LocalTxnSerializer - -## 0.17.0 - -### Minor Changes - -- a9602e533: Remove deprecated events API -- db22728c1: \* adds dryRunTransaction support - - adds getGasCostEstimation to the signer-with-provider that estimates the gas cost for a transaction -- 3b510d0fc: adds coin transfer method to framework that uses pay and payIota - -## 0.16.0 - -### Minor Changes - -- 01989d3d5: Remove usage of Buffer within SDK -- 5e20e6569: Event query pagination and merge all getEvents\* methods - -### Patch Changes - -- Updated dependencies [1a0968636] - - @iota/bcs@0.5.0 - -## 0.15.0 - -### Minor Changes - -- c27933292: Update the type of the `endpoint` field in JsonRpcProvider from string to object - -### Patch Changes - -- c27933292: Add util function for faucet -- 90898d366: Support passing utf8 and ascii string -- c27933292: Add constants for default API endpoints -- Updated dependencies [1591726e8] -- Updated dependencies [1591726e8] - - @iota/bcs@0.4.0 - -## 0.14.0 - -### Minor Changes - -- 8b4bea5e2: Remove gateway related APIs -- e45b188a8: Introduce PayIota and PayAllIota native transaction types to TS SDK. - -### Patch Changes - -- e86f8bc5e: Add `getRpcApiVersion` to Provider interface -- b4a8ee9bf: Support passing a vector of objects in LocalTxnBuilder -- ef3571dc8: Fix gas selection bug for a vector of objects -- cccfe9315: Add deserialization util method to LocalTxnDataSerializer -- 2dc594ef7: Introduce getCoinDenominationInfo, which returns denomination info of a coin, now only supporting IOTA coin. -- 4f0c611ff: Protocol change to add 'initial shared version' to shared object references. - -## 0.13.0 - -### Minor Changes - -- 1d036d459: Transactions query pagination and merge all getTransactions\* methods -- b11b69262: Add gas selection to LocalTxnSerializer -- b11b69262: Deprecate Gateway related APIs -- b11b69262: Add rpcAPIVersion to JsonRpcProvider to support multiple RPC API Versions - -## 0.12.0 - -### Minor Changes - -- e0b173b9e: Standardize Ed25519KeyPair key derivation with SLIP10 -- 059ede517: Flip the default value of `skipDataValidation` to true in order to mitigate the impact of breaking changes on applications. When there's a mismatch between the TypeScript definitions and RPC response, the SDK now log a console warning instead of throwing an error. -- 03e6b552b: Add util function to get coin balances -- 4575c0a02: Fix type definition of IotaMoveNormalizedType -- ccf7f148d: Added generic signAndExecuteTransaction method to the SDK, which can be used with any supported type of transaction. - -### Patch Changes - -- e0b173b9e: Support Pay Transaction type in local transaction serializer - -## 0.11.0 - -### Minor Changes - -- d343b67e: Re-release packages - -### Patch Changes - -- Updated dependencies [d343b67e] - - @iota/bcs@0.3.0 - -## 0.11.0-pre - -### Minor Changes - -- 5de312c9: Add support for subscribing to events on RPC using "subscribeEvent". -- 5de312c9: Add support for Secp256k1 keypairs. - -### Patch Changes - -- c5e4851b: Updated build process from TSDX to tsup. -- a0fdb52e: Updated publish transactions to accept ArrayLike instead of Iterable. -- e2aa08e9: Fix missing built files for packages. -- Updated dependencies [c5e4851b] -- Updated dependencies [e2aa08e9] - - @iota/bcs@0.2.1 diff --git a/sdk/typescript/package.json b/sdk/typescript/package.json index 4e2d82e5354..3649fc1354f 100644 --- a/sdk/typescript/package.json +++ b/sdk/typescript/package.json @@ -3,7 +3,7 @@ "author": "Mysten Labs ", "description": "Iota TypeScript API(Work in Progress)", "homepage": "https://sdk.mystenlabs.com", - "version": "0.51.1", + "version": "0.0.0", "license": "Apache-2.0", "sideEffects": false, "files": [ diff --git a/sdk/wallet-standard/CHANGELOG.md b/sdk/wallet-standard/CHANGELOG.md deleted file mode 100644 index 46ef1337833..00000000000 --- a/sdk/wallet-standard/CHANGELOG.md +++ /dev/null @@ -1,679 +0,0 @@ -# @iota/wallet-standard - -## 0.11.1 - -### Patch Changes - -- Updated dependencies [6984dd1e38] - - @iota/iota-sdk@0.51.1 - -## 0.11.0 - -### Minor Changes - -- 437f0ca2ef: Add isIotaChain utility which is useful for type-safe dApp interfaces in wallets - -### Patch Changes - -- Updated dependencies [0cafa94027] - - @iota/iota-sdk@0.51.0 - -## 0.10.3 - -### Patch Changes - -- 4830361fa4: Updated typescript version -- Updated dependencies [4830361fa4] - - @iota/iota-sdk@0.50.1 - -## 0.10.2 - -### Patch Changes - -- Updated dependencies [a34f1cb67d] -- Updated dependencies [c08e3569ef] -- Updated dependencies [9a14e61db4] -- Updated dependencies [13e922d9b1] -- Updated dependencies [a34f1cb67d] -- Updated dependencies [220a766d86] - - @iota/iota-sdk@0.50.0 - -## 0.10.1 - -### Patch Changes - -- 9ac0a4ec01: Add extensions to all sdk import paths -- Updated dependencies [9ac0a4ec01] - - @iota/iota-sdk@0.49.1 - -## 0.10.0 - -### Minor Changes - -- e5f9e3ba21: Replace tsup based build to fix issues with esm/cjs dual publishing - -### Patch Changes - -- Updated dependencies [e5f9e3ba21] - - @iota/iota-sdk@0.49.0 - -## 0.9.0 - -### Minor Changes - -- 165ad6b21d: Introduce new optional `id` property, which wallets can specify as a unique identifier, separate from the wallet name. - -### Patch Changes - -- dd362ec1d6: Update docs url to sdk.mystenlabs.com -- Updated dependencies [dd362ec1d6] - - @iota/iota-sdk@0.48.1 - -## 0.8.11 - -### Patch Changes - -- Updated dependencies [cdcfa76c43] - - @iota/iota-sdk@0.48.0 - -## 0.8.10 - -### Patch Changes - -- Updated dependencies [194c980cb] -- Updated dependencies [9ac7e2f3d] -- Updated dependencies [0259aec82] -- Updated dependencies [64d45ba27] - - @iota/iota-sdk@0.47.0 - -## 0.8.9 - -### Patch Changes - -- Updated dependencies [652bcdd92] - - @iota/iota-sdk@0.46.1 - -## 0.8.8 - -### Patch Changes - -- Updated dependencies [28c2c3330] -- Updated dependencies [43444c58f] -- Updated dependencies [8d1e74e52] -- Updated dependencies [093554a0d] -- Updated dependencies [3718a230b] - - @iota/iota-sdk@0.46.0 - -## 0.8.7 - -### Patch Changes - -- Updated dependencies [30b47b758] - - @iota/iota-sdk@0.45.1 - -## 0.8.6 - -### Patch Changes - -- Updated dependencies [b9afb5567] - - @iota/iota-sdk@0.45.0 - -## 0.8.5 - -### Patch Changes - -- b48289346: Mark packages as being side-effect free. -- Updated dependencies [b48289346] -- Updated dependencies [11cf4e68b] - - @iota/iota-sdk@0.44.0 - -## 0.8.4 - -### Patch Changes - -- Updated dependencies [004fb1991] - - @iota/iota-sdk@0.43.3 - -## 0.8.3 - -### Patch Changes - -- Updated dependencies [9b052166d] - - @iota/iota-sdk@0.43.2 - -## 0.8.2 - -### Patch Changes - -- Updated dependencies [faa13ded9] -- Updated dependencies [c5684bb52] - - @iota/iota-sdk@0.43.1 - -## 0.8.1 - -### Patch Changes - -- Updated dependencies [781d073d9] -- Updated dependencies [3764c464f] -- Updated dependencies [e4484852b] -- Updated dependencies [71e0a3197] -- Updated dependencies [1bc430161] - - @iota/iota-sdk@0.43.0 - -## 0.8.0 - -### Minor Changes - -- fd8589806: Remove uses of deprecated imports from @iota/iota-sdk -- 8b9e5f737: Added new isWalletWithRequiredFeatureSet utility and accompanying type - -### Patch Changes - -- Updated dependencies [fd8589806] - - @iota/iota-sdk@0.42.0 - -## 0.7.2 - -### Patch Changes - -- @iota/iota-sdk@0.41.2 - -## 0.7.1 - -### Patch Changes - -- 189e02aba: Fix broken documentation link for the wallet-standard SDK -- Updated dependencies [24c21e1f0] - - @iota/iota-sdk@0.41.1 - -## 0.7.0 - -### Minor Changes - -- 85f785c97: Rebuild wallet kit and wallet standard to no longer use wallet adapters. - -### Patch Changes - -- Updated dependencies [ba8e3b857] -- Updated dependencies [f4b7b3474] - - @iota/iota-sdk@0.41.0 - -## 0.6.0 - -### Minor Changes - -- 8281e3d25: Deprecate `signMessage` method, and introduce the new `signPersonalMessage` method. - -### Patch Changes - -- Updated dependencies [a503cad34] -- Updated dependencies [8281e3d25] - - @iota/iota-sdk@0.40.0 - -## 0.5.14 - -### Patch Changes - -- Updated dependencies [47ea5ec7c] - - @iota/iota-sdk@0.39.0 - -## 0.5.13 - -### Patch Changes - -- Updated dependencies [ad46f9f2f] -- Updated dependencies [67e581a5a] -- Updated dependencies [34242be56] -- Updated dependencies [4e2a150a1] -- Updated dependencies [cce6ffbcc] -- Updated dependencies [0f06d593a] -- Updated dependencies [83d0fb734] -- Updated dependencies [09f4ed3fc] -- Updated dependencies [6d41059c7] -- Updated dependencies [cc6441f46] -- Updated dependencies [001148443] - - @iota/iota-sdk@0.38.0 - -## 0.5.12 - -### Patch Changes - -- Updated dependencies [34cc7d610] - - @iota/iota-sdk@0.37.1 - -## 0.5.11 - -### Patch Changes - -- Updated dependencies [36f2edff3] -- Updated dependencies [75d1a190d] -- Updated dependencies [93794f9f2] -- Updated dependencies [c3a4ec57c] -- Updated dependencies [a17d3678a] -- Updated dependencies [2f37537d5] -- Updated dependencies [00484bcc3] - - @iota/iota-sdk@0.37.0 - -## 0.5.10 - -### Patch Changes - -- Updated dependencies [3ea9adb71a] -- Updated dependencies [1cfb1c9da3] -- Updated dependencies [1cfb1c9da3] -- Updated dependencies [fb3bb9118a] - - @iota/iota-sdk@0.36.0 - -## 0.5.9 - -### Patch Changes - -- Updated dependencies [09d77325a9] - - @iota/iota-sdk@0.35.1 - -## 0.5.8 - -### Patch Changes - -- Updated dependencies [4ea96d909a] -- Updated dependencies [bcbb178c44] -- Updated dependencies [470c27af50] -- Updated dependencies [03828224c9] -- Updated dependencies [671faefe3c] -- Updated dependencies [9ce7e051b4] -- Updated dependencies [9ce7e051b4] -- Updated dependencies [bb50698551] - - @iota/iota-sdk@0.35.0 - -## 0.5.7 - -### Patch Changes - -- Updated dependencies [85719ac933] -- Updated dependencies [c3d9cc87f3] -- Updated dependencies [02a6063f82] - - @iota/iota-sdk@0.34.1 - -## 0.5.6 - -### Patch Changes - -- Updated dependencies [280821e0ab] -- Updated dependencies [6a9abe9e38] - - @iota/iota-sdk@0.34.0 - -## 0.5.5 - -### Patch Changes - -- 44e76bbd2: Expose mainnet chain. -- Updated dependencies [7915de531] -- Updated dependencies [6f9fc94ca] -- Updated dependencies [605eac8c6] -- Updated dependencies [262e3dfdd] -- Updated dependencies [91c63e4f8] -- Updated dependencies [e61ed2bac] -- Updated dependencies [5053a8dc8] - - @iota/iota-sdk@0.33.0 - -## 0.5.4 - -### Patch Changes - -- b4f0bfc76: Fix type definitions for package exports. -- Updated dependencies [4ae3cbea3] -- Updated dependencies [d2755a496] -- Updated dependencies [f612dac98] -- Updated dependencies [c219e7470] -- Updated dependencies [59ae0e7d6] -- Updated dependencies [c219e7470] -- Updated dependencies [4e463c691] -- Updated dependencies [b4f0bfc76] - - @iota/iota-sdk@0.32.2 - -## 0.5.3 - -### Patch Changes - -- Updated dependencies [3224ffcd0] - - @iota/iota-sdk@0.32.1 - -## 0.5.2 - -### Patch Changes - -- Updated dependencies [9b42d0ada] - - @iota/iota-sdk@0.32.0 - -## 0.5.1 - -### Patch Changes - -- Updated dependencies [976d3e1fe] -- Updated dependencies [0419b7c53] -- Updated dependencies [f3c096e3a] -- Updated dependencies [5a4e3e416] -- Updated dependencies [27dec39eb] - - @iota/iota-sdk@0.31.0 - -## 0.5.0 - -### Minor Changes - -- 956ec28eb: Change `signMessage` to return message bytes. Add support for iota:signMessage in the wallet standard -- 19b567f21: Unified self- and delegated staking flows. Removed fields from `Validator` (`stake_amount`, `pending_stake`, and `pending_withdraw`) and renamed `delegation_staking_pool` to `staking_pool`. Additionally removed the `validator_stake` and `delegated_stake` fields in the `ValidatorSet` type and replaced them with a `total_stake` field. -- 5c3b00cde: Add object id to staking pool and pool id to staked iota. -- 3d9a04648: Adds `deactivation_epoch` to staking pool object, and adds `inactive_pools` to the validator set object. -- da72e73a9: Change the address of Move package for staking and validator related Move modules. -- 0672b5990: The Wallet Standard now only supports the `Transaction` type, instead of the previous `SignableTransaction` type. -- 0a7b42a6d: This changes almost all occurrences of "delegate", "delegation" (and various capitalizations/forms) to their equivalent "stake"-based name. Function names, function argument names, RPC endpoints, Move functions, and object fields have been updated with this new naming convention. -- c718deef4: wallet-standard: changes iota:signAndExecuteTransaction and iota:signTransaction features to support account and chain options - wallet-adapter-wallet-standard: change signAndExecuteTransaction and signTransaction signatures to support account and chain options - wallet-adapter-wallet-standard: ensure version compatibility for of the wallet signAndExecuteTransaction and signTransaction features before using them (same major version) - wallet-kit-core/wallet-kit: expose accounts as ReadonlyWalletAccount instead of only the address - wallet-kit-core: signTransaction and signAndExecuteTransaction methods mirror the ones in standard adapter -- 68e60b02c: Changed where the options and requestType for signAndExecuteTransaction are. -- dbe73d5a4: Add an optional `contentOptions` field to `IotaSignAndExecuteTransactionOptions` to specify which fields to include in `IotaTransactionBlockResponse` (e.g., transaction, effects, events, etc). By default, only the transaction digest will be included. - -### Patch Changes - -- bf545c7d0: Add `features` prop to wallet kit that allows dapps to define which features they require to function properly. -- Updated dependencies [956ec28eb] -- Updated dependencies [4adfbff73] -- Updated dependencies [4c4573ebe] -- Updated dependencies [acc2edb31] -- Updated dependencies [941b03af1] -- Updated dependencies [a6690ac7d] -- Updated dependencies [a211dc03a] -- Updated dependencies [4c1e331b8] -- Updated dependencies [19b567f21] -- Updated dependencies [7659e2e91] -- Updated dependencies [0d3cb44d9] -- Updated dependencies [00bb9bb66] -- Updated dependencies [36c264ebb] -- Updated dependencies [891abf5ed] -- Updated dependencies [2e0ef59fa] -- Updated dependencies [33cb357e1] -- Updated dependencies [6bd88570c] -- Updated dependencies [f1e42f792] -- Updated dependencies [272389c20] -- Updated dependencies [3de8de361] -- Updated dependencies [be3c4f51e] -- Updated dependencies [dbe73d5a4] -- Updated dependencies [14ba89144] -- Updated dependencies [c82e4b454] -- Updated dependencies [7a2eaf4a3] -- Updated dependencies [2ef2bb59e] -- Updated dependencies [9b29bef37] -- Updated dependencies [8700809b5] -- Updated dependencies [5c3b00cde] -- Updated dependencies [01272ab7d] -- Updated dependencies [9822357d6] -- Updated dependencies [3d9a04648] -- Updated dependencies [da72e73a9] -- Updated dependencies [a0955c479] -- Updated dependencies [3eb3a1de8] -- Updated dependencies [0c9047698] -- Updated dependencies [4593333bd] -- Updated dependencies [d5ef1b6e5] -- Updated dependencies [0a7b42a6d] -- Updated dependencies [3de8de361] -- Updated dependencies [dd348cf03] -- Updated dependencies [57c17e02a] -- Updated dependencies [65f1372dd] -- Updated dependencies [a09239308] -- Updated dependencies [fe335e6ba] -- Updated dependencies [5dc25faad] -- Updated dependencies [64234baaf] -- Updated dependencies [79c2165cb] -- Updated dependencies [d3170ba41] -- Updated dependencies [a6ffb8088] -- Updated dependencies [3304eb83b] -- Updated dependencies [4189171ef] -- Updated dependencies [210840114] -- Updated dependencies [77bdf907f] -- Updated dependencies [a74df16ec] -- Updated dependencies [0f7aa6507] -- Updated dependencies [9b60bf700] -- Updated dependencies [64fb649eb] -- Updated dependencies [a6b0c4e5f] - - @iota/iota-sdk@0.30.0 - -## 0.4.3 - -### Patch Changes - -- Updated dependencies [31bfcae6a] - - @iota/iota-sdk@0.29.1 - -## 0.4.2 - -### Patch Changes - -- 0e202a543: Remove pending delegation switches. -- Updated dependencies [f1e3a0373] -- Updated dependencies [f2e713bd0] -- Updated dependencies [0e202a543] -- Updated dependencies [67e503c7c] -- Updated dependencies [4baf554f1] -- Updated dependencies [aa650aa3b] -- Updated dependencies [6ff0c785f] - - @iota/iota-sdk@0.29.0 - -## 0.4.1 - -### Patch Changes - -- Updated dependencies [a67cc044b] -- Updated dependencies [24bdb66c6] -- Updated dependencies [a67cc044b] -- Updated dependencies [a67cc044b] - - @iota/iota-sdk@0.28.0 - -## 0.4.0 - -### Minor Changes - -- 473005d8f: Add protocol_version to CheckpointSummary and IotaSystemObject. Consolidate end-of-epoch information in CheckpointSummary. - -### Patch Changes - -- Updated dependencies [473005d8f] -- Updated dependencies [fcba70206] -- Updated dependencies [59641dc29] -- Updated dependencies [ebe6c3945] -- Updated dependencies [629804d26] -- Updated dependencies [f51c85e85] -- Updated dependencies [e630f6832] - - @iota/iota-sdk@0.27.0 - -## 0.3.1 - -### Patch Changes - -- Updated dependencies [97c46ca9d] - - @iota/iota-sdk@0.26.1 - -## 0.3.0 - -### Minor Changes - -- 96e883fc1: Update wallet adapter and wallet standard to support passing through the desired request type. - -### Patch Changes - -- a8746d4e9: update IotaExecuteTransactionResponse -- Updated dependencies [034158656] -- Updated dependencies [a8746d4e9] -- Updated dependencies [57fc4dedd] -- Updated dependencies [e6a71882f] -- Updated dependencies [e6a71882f] -- Updated dependencies [21781ba52] -- Updated dependencies [b3ba6dfbc] - - @iota/iota-sdk@0.26.0 - -## 0.2.11 - -### Patch Changes - -- Updated dependencies [ebfdd5c56] -- Updated dependencies [7b4bf43bc] -- Updated dependencies [72481e759] -- Updated dependencies [969a88669] - - @iota/iota-sdk@0.25.0 - -## 0.2.10 - -### Patch Changes - -- Updated dependencies [01458ffd5] -- Updated dependencies [a274ecfc7] -- Updated dependencies [88a687834] -- Updated dependencies [89091ddab] -- Updated dependencies [71bee7563] - - @iota/iota-sdk@0.24.0 - -## 0.2.9 - -### Patch Changes - -- Updated dependencies [f3444bdf2] -- Updated dependencies [e26f47cbf] -- Updated dependencies [b745cde24] -- Updated dependencies [01efa8bc6] -- Updated dependencies [35e0df780] -- Updated dependencies [5cd51dd38] -- Updated dependencies [8474242af] -- Updated dependencies [01efa8bc6] -- Updated dependencies [f74181212] - - @iota/iota-sdk@0.23.0 - -## 0.2.8 - -### Patch Changes - -- Updated dependencies [a55236e48] -- Updated dependencies [8ae226dae] - - @iota/iota-sdk@0.22.0 - -## 0.2.7 - -### Patch Changes - -- Updated dependencies [4fb12ac6d] -- Updated dependencies [bb14ffdc5] -- Updated dependencies [9fbe2714b] -- Updated dependencies [d2015f815] -- Updated dependencies [7d0f25b61] - - @iota/iota-sdk@0.21.0 - -## 0.2.6 - -### Patch Changes - -- Updated dependencies [f93b59f3a] -- Updated dependencies [ea71d8216] - - @iota/iota-sdk@0.20.0 - -## 0.2.5 - -### Patch Changes - -- Updated dependencies [b8257cecb] -- Updated dependencies [6c1f81228] -- Updated dependencies [519e11551] -- Updated dependencies [b03bfaec2] -- Updated dependencies [f9be28a42] -- Updated dependencies [24987df35] - - @iota/iota-sdk@0.19.0 - -## 0.2.4 - -### Patch Changes - -- Updated dependencies [66021884e] -- Updated dependencies [7a67d61e2] -- Updated dependencies [45293b6ff] -- Updated dependencies [7a67d61e2] -- Updated dependencies [2a0b8e85d] - - @iota/iota-sdk@0.18.0 - -## 0.2.3 - -### Patch Changes - -- Updated dependencies [623505886] - - @iota/iota-sdk@0.17.1 - -## 0.2.2 - -### Patch Changes - -- Updated dependencies [a9602e533] -- Updated dependencies [db22728c1] -- Updated dependencies [3b510d0fc] - - @iota/iota-sdk@0.17.0 - -## 0.2.1 - -### Patch Changes - -- Updated dependencies [01989d3d5] -- Updated dependencies [5e20e6569] - - @iota/iota-sdk@0.16.0 - -## 0.2.0 - -### Minor Changes - -- e97d280d7: Update to 1.0 release of wallet standard -- 56de8448f: Update wallet standard adapters to use new wallet registration logic. - -### Patch Changes - -- Updated dependencies [c27933292] -- Updated dependencies [90898d366] -- Updated dependencies [c27933292] -- Updated dependencies [c27933292] - - @iota/iota-sdk@0.15.0 - -## 0.1.2 - -### Patch Changes - -- Updated dependencies [e86f8bc5e] -- Updated dependencies [b4a8ee9bf] -- Updated dependencies [ef3571dc8] -- Updated dependencies [cccfe9315] -- Updated dependencies [8b4bea5e2] -- Updated dependencies [e45b188a8] -- Updated dependencies [2dc594ef7] -- Updated dependencies [4f0c611ff] - - @iota/iota-sdk@0.14.0 - -## 0.1.1 - -### Patch Changes - -- Updated dependencies [1d036d459] -- Updated dependencies [b11b69262] -- Updated dependencies [b11b69262] -- Updated dependencies [b11b69262] - - @iota/iota-sdk@0.13.0 - -## 0.1.0 - -### Minor Changes - -- 5ac98bc9a: Introduce new wallet adapter based on the Wallet Standard. This wallet adapter automatically detects wallets that adhere to the standard interface. -- 5ac98bc9a: Introduce new "wallet-standard" package which can be used to build wallets that are compatible with the Wallet Standard. - -### Patch Changes - -- Updated dependencies [e0b173b9e] -- Updated dependencies [059ede517] -- Updated dependencies [03e6b552b] -- Updated dependencies [4575c0a02] -- Updated dependencies [e0b173b9e] -- Updated dependencies [ccf7f148d] - - @iota/iota-sdk@0.12.0 diff --git a/sdk/wallet-standard/package.json b/sdk/wallet-standard/package.json index 34e8aed3447..339fde5ee51 100644 --- a/sdk/wallet-standard/package.json +++ b/sdk/wallet-standard/package.json @@ -1,6 +1,6 @@ { "name": "@iota/wallet-standard", - "version": "0.11.1", + "version": "0.0.0", "description": "A suite of standard utilities for implementing wallets based on the Wallet Standard.", "license": "Apache-2.0", "author": "Mysten Labs ", diff --git a/sdk/zklogin/CHANGELOG.md b/sdk/zklogin/CHANGELOG.md deleted file mode 100644 index faa49355973..00000000000 --- a/sdk/zklogin/CHANGELOG.md +++ /dev/null @@ -1,252 +0,0 @@ -# @iota/zklogin - -## 0.5.1 - -### Patch Changes - -- Updated dependencies [6984dd1e38] - - @iota/iota-sdk@0.51.1 - -## 0.5.0 - -### Minor Changes - -- 3a84c3ab21: Expose toZkLoginPublicIdentifier function - -### Patch Changes - -- Updated dependencies [0cafa94027] - - @iota/iota-sdk@0.51.0 - -## 0.4.3 - -### Patch Changes - -- 4830361fa4: Updated typescript version -- Updated dependencies [4830361fa4] - - @iota/iota-sdk@0.50.1 - - @iota/bcs@0.11.1 - -## 0.4.2 - -### Patch Changes - -- Updated dependencies [a34f1cb67d] -- Updated dependencies [bae8802fe3] -- Updated dependencies [c08e3569ef] -- Updated dependencies [9a14e61db4] -- Updated dependencies [13e922d9b1] -- Updated dependencies [a34f1cb67d] -- Updated dependencies [220a766d86] - - @iota/iota-sdk@0.50.0 - - @iota/bcs@0.11.0 - -## 0.4.1 - -### Patch Changes - -- Updated dependencies [9ac0a4ec01] - - @iota/iota-sdk@0.49.1 - - @iota/bcs@0.10.1 - -## 0.4.0 - -### Minor Changes - -- e5f9e3ba21: Replace tsup based build to fix issues with esm/cjs dual publishing - -### Patch Changes - -- Updated dependencies [e5f9e3ba21] - - @iota/iota-sdk@0.49.0 - - @iota/bcs@0.10.0 - -## 0.3.10 - -### Patch Changes - -- Updated dependencies [dd362ec1d6] - - @iota/iota-sdk@0.48.1 - - @iota/bcs@0.9.1 - -## 0.3.9 - -### Patch Changes - -- Updated dependencies [cdcfa76c43] -- Updated dependencies [fce0a08d0f] - - @iota/iota-sdk@0.48.0 - - @iota/bcs@0.9.0 - -## 0.3.8 - -### Patch Changes - -- 0e3d0dfae: Add simple length checks - -## 0.3.7 - -### Patch Changes - -- 9ac7e2f3d: Add additional type exports to zklogin package -- Updated dependencies [194c980cb] -- Updated dependencies [9ac7e2f3d] -- Updated dependencies [0259aec82] -- Updated dependencies [64d45ba27] - - @iota/iota-sdk@0.47.0 - -## 0.3.6 - -### Patch Changes - -- Updated dependencies [652bcdd92] - - @iota/iota-sdk@0.46.1 - -## 0.3.5 - -### Patch Changes - -- 28c2c3330: Use the same issuer string in address derivation for the two google's iss values -- Updated dependencies [28c2c3330] -- Updated dependencies [43444c58f] -- Updated dependencies [8d1e74e52] -- Updated dependencies [093554a0d] -- Updated dependencies [3718a230b] - - @iota/iota-sdk@0.46.0 - -## 0.3.4 - -### Patch Changes - -- Updated dependencies [30b47b758] - - @iota/iota-sdk@0.45.1 - -## 0.3.3 - -### Patch Changes - -- Updated dependencies [b9afb5567] - - @iota/iota-sdk@0.45.0 - -## 0.3.2 - -### Patch Changes - -- c34c3c734: Revert additional JWT checks - -## 0.3.1 - -### Patch Changes - -- 4ba17833c: Fixes ESM usage of the SDK. - -## 0.3.0 - -### Minor Changes - -- 28ee0ff2f: Fix bug in nonce length check - -## 0.2.1 - -### Patch Changes - -- 9a1c8105e: Fix usage of string values in the SDK - -## 0.2.0 - -### Minor Changes - -- d80a6ed62: Remove toBigIntBE, expose new `getExtendedEphemeralPublicKey` method. Methods now return base64-encoded strings instead of bigints. - -### Patch Changes - -- 067d464f4: Introduce precise key-value pair parsing that matches the circuit -- b48289346: Mark packages as being side-effect free. -- Updated dependencies [b48289346] -- Updated dependencies [11cf4e68b] - - @iota/iota-sdk@0.44.0 - - @iota/bcs@0.8.1 - -## 0.1.8 - -### Patch Changes - -- Updated dependencies [004fb1991] - - @iota/iota-sdk@0.43.3 - -## 0.1.7 - -### Patch Changes - -- Updated dependencies [9b052166d] - - @iota/iota-sdk@0.43.2 - -## 0.1.6 - -### Patch Changes - -- c5684bb52: rename zk to zkLogin -- Updated dependencies [faa13ded9] -- Updated dependencies [c5684bb52] - - @iota/iota-sdk@0.43.1 - -## 0.1.5 - -### Patch Changes - -- 3764c464f: - use new zklogin package from @iota/iota-sdk for some of the zklogin functionality - - rename `getZkSignature` to `getZkLoginSignature` -- 71e0a3197: - stop exporting `ZkSignatureInputs` - - use `toBigEndianBytes` instead of `toBufferBE` that was renamed -- Updated dependencies [781d073d9] -- Updated dependencies [3764c464f] -- Updated dependencies [1bc430161] -- Updated dependencies [e4484852b] -- Updated dependencies [e4484852b] -- Updated dependencies [71e0a3197] -- Updated dependencies [1bc430161] - - @iota/iota-sdk@0.43.0 - - @iota/bcs@0.8.0 - -## 0.1.4 - -### Patch Changes - -- 9b3ffc7d6: - removes `AddressParams` bcs struct, now address is created by using the iss bytes - - updated zklogin signature bcs struct for new camelCase fields -- d257d20ee: Improve nodejs compatibility -- Updated dependencies [fd8589806] - - @iota/iota-sdk@0.42.0 - -## 0.1.3 - -### Patch Changes - -- 1786c68b5: Update hashASCIIStr logic and constants -- 8384490bb: Remove BCS export and introduce new getZkSignature export. -- 35bdbd00d: update bcs AddressParams struct -- 1f87936fd: Move aud to inner hash -- d89fff405: Expose new randomness function -- Updated dependencies [290c8e640] - - @iota/bcs@0.7.4 - - @iota/iota-sdk@0.41.2 - -## 0.1.2 - -### Patch Changes - -- d0750ea0f: rename pin to salt -- a82600f2d: fix nonce calculation -- Updated dependencies [24c21e1f0] - - @iota/iota-sdk@0.41.1 - -## 0.1.1 - -### Patch Changes - -- b676fa4e9: Change function signature of genAddrSeed -- 626098033: Fix generated types -- 608e8e407: Update max key claim value length -- 5d344399f: Initial experimental zklogin SDK -- f5d5a4e8b: Polish utils -- f53d5823a: Change build process to use new internal build process. diff --git a/sdk/zklogin/package.json b/sdk/zklogin/package.json index 343ae13804b..93bcea3dfa1 100644 --- a/sdk/zklogin/package.json +++ b/sdk/zklogin/package.json @@ -1,6 +1,6 @@ { "name": "@iota/zklogin", - "version": "0.5.1", + "version": "0.0.0", "description": "Utilities for interacting with zkLogin in Iota", "license": "Apache-2.0", "author": "Mysten Labs ", From eff71c2b155b6ee546560ef3f8891383cde3a7cf Mon Sep 17 00:00:00 2001 From: evavirseda Date: Tue, 13 Aug 2024 18:29:58 +0200 Subject: [PATCH 6/7] feat(wallet,apps-ui-kit): polish UI (#1747) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: add tabIndex * feat: add disabled missing styles * feat: remove disabled hover effect * feat: update cmissing styles * feat: use tailwind classes for width and height --------- Co-authored-by: Begoña Álvarez de la Cruz --- .../lib/components/atoms/button/Button.tsx | 8 +++++- .../atoms/button/ButtonUnstyled.tsx | 8 +++++- .../components/atoms/checkbox/Checkbox.tsx | 6 ++--- .../lib/components/atoms/header/Header.tsx | 6 ++--- .../atoms/radio-button/RadioButton.tsx | 4 +-- .../components/molecules/card/CardAction.tsx | 7 ++++-- .../lib/components/molecules/chip/Chip.tsx | 8 ++++-- .../lib/components/molecules/input/Input.tsx | 19 +++++++------- .../molecules/input/InputWrapper.tsx | 2 +- .../components/molecules/input/TextArea.tsx | 3 ++- .../molecules/input/input.classes.ts | 4 +-- .../components/molecules/search/Search.tsx | 6 ++--- .../components/molecules/select/Select.tsx | 4 +-- .../molecules/table-cell/TableCell.tsx | 8 ++++-- .../table-header-cell/TableHeaderCell.tsx | 15 +++++++---- .../organisms/accordion/Accordion.tsx | 2 +- .../organisms/accordion/accordion.classes.ts | 3 +-- .../components/organisms/navbar/Navbar.tsx | 12 +++------ .../organisms/navbar/NavbarSlideout.tsx | 4 +-- apps/ui-kit/src/lib/styles/index.css | 4 +++ .../components/accounts/AutoLockSelector.tsx | 4 +-- .../accounts/ProtectAccountForm.tsx | 6 ++++- .../src/ui/app/shared/forms/CheckboxField.tsx | 1 + .../src/ui/app/shared/forms/SelectField.tsx | 25 ++++++------------- .../src/ui/app/shared/forms/TextField.tsx | 13 +++++----- 25 files changed, 102 insertions(+), 80 deletions(-) diff --git a/apps/ui-kit/src/lib/components/atoms/button/Button.tsx b/apps/ui-kit/src/lib/components/atoms/button/Button.tsx index 056bd337f7c..1801e79439f 100644 --- a/apps/ui-kit/src/lib/components/atoms/button/Button.tsx +++ b/apps/ui-kit/src/lib/components/atoms/button/Button.tsx @@ -47,6 +47,10 @@ export interface ButtonProps { * The type of the button. Available options are 'button', 'submit', 'reset'. */ htmlType?: ButtonHtmlType; + /** + * The tab index of the button. + */ + tabIndex?: number; } export function Button({ @@ -58,6 +62,7 @@ export function Button({ htmlType = ButtonHtmlType.Button, size = ButtonSize.Medium, type = ButtonType.Primary, + tabIndex = 0, }: ButtonProps): React.JSX.Element { const paddingClasses = icon && !text ? PADDINGS_ONLY_ICON[size] : PADDINGS[size]; const textSizes = TEXT_CLASSES[size]; @@ -68,12 +73,13 @@ export function Button({ onClick={onClick} type={htmlType} className={cx( - 'state-layer relative flex flex-row items-center justify-center gap-2 rounded-full disabled:opacity-40', + 'state-layer relative flex flex-row items-center justify-center gap-2 rounded-full disabled:cursor-not-allowed disabled:opacity-40', paddingClasses, backgroundColors, fullWidth && 'w-full', )} disabled={disabled} + tabIndex={tabIndex} > {icon && {icon}} {text && {text}} diff --git a/apps/ui-kit/src/lib/components/atoms/button/ButtonUnstyled.tsx b/apps/ui-kit/src/lib/components/atoms/button/ButtonUnstyled.tsx index ae32dfe759e..8cdc09ae253 100644 --- a/apps/ui-kit/src/lib/components/atoms/button/ButtonUnstyled.tsx +++ b/apps/ui-kit/src/lib/components/atoms/button/ButtonUnstyled.tsx @@ -16,10 +16,16 @@ export function ButtonUnstyled({ htmlType = ButtonHtmlType.Button, children, className, + tabIndex = 0, ...buttonProps }: ButtonUnstyledProps): React.JSX.Element { return ( - ); diff --git a/apps/ui-kit/src/lib/components/atoms/checkbox/Checkbox.tsx b/apps/ui-kit/src/lib/components/atoms/checkbox/Checkbox.tsx index 86522c8f9ff..6a744e4990d 100644 --- a/apps/ui-kit/src/lib/components/atoms/checkbox/Checkbox.tsx +++ b/apps/ui-kit/src/lib/components/atoms/checkbox/Checkbox.tsx @@ -91,9 +91,9 @@ export const Checkbox = forwardRef( /> inputRef.current?.click()} - className="peer-enabled:state-layer relative inset-0 flex h-5 w-5 items-center justify-center rounded border border-neutral-80 text-neutral-40 peer-disabled:text-neutral-70 peer-disabled:text-opacity-40 peer-disabled:opacity-40 peer-[&:is(:checked,:indeterminate)]:border-primary-30 peer-[&:is(:checked,:indeterminate)]:bg-primary-30 peer-[&:is(:checked,:indeterminate)]:text-white peer-[&:not(:checked,:indeterminate)]:text-opacity-40 disabled:peer-[&:not(:checked,:indeterminate)]:border-neutral-70 dark:border-neutral-20 dark:text-neutral-60 dark:peer-disabled:text-neutral-30 dark:peer-disabled:text-opacity-40 dark:peer-disabled:peer-[&:not(:checked,:indeterminate)]:border-neutral-30 dark:peer-disabled:peer-[&:is(:checked,:indeterminate)]:bg-neutral-40 peer-disabled:[&:is(:checked,:indeterminate)]:border-neutral-60 peer-disabled:[&:is(:checked,:indeterminate)]:bg-neutral-60 dark:peer-disabled:[&:is(:checked,:indeterminate)]:border-neutral-40" + className="peer-enabled:state-layer relative inset-0 flex h-5 w-5 items-center justify-center rounded border border-neutral-80 text-neutral-40 group-[.disabled]:cursor-not-allowed peer-disabled:text-neutral-70 peer-disabled:text-opacity-40 peer-disabled:opacity-40 peer-[&:is(:checked,:indeterminate)]:border-primary-30 peer-[&:is(:checked,:indeterminate)]:bg-primary-30 peer-[&:is(:checked,:indeterminate)]:text-white peer-[&:not(:checked,:indeterminate)]:text-opacity-40 disabled:peer-[&:not(:checked,:indeterminate)]:border-neutral-70 dark:border-neutral-20 dark:text-neutral-60 dark:peer-disabled:text-neutral-30 dark:peer-disabled:text-opacity-40 dark:peer-disabled:peer-[&:not(:checked,:indeterminate)]:border-neutral-30 dark:peer-disabled:peer-[&:is(:checked,:indeterminate)]:bg-neutral-40 peer-disabled:[&:is(:checked,:indeterminate)]:border-neutral-60 peer-disabled:[&:is(:checked,:indeterminate)]:bg-neutral-60 dark:peer-disabled:[&:is(:checked,:indeterminate)]:border-neutral-40 [&_svg]:h-4 [&_svg]:w-4" > - +
@@ -105,7 +105,7 @@ function LabelText({ label, name }: Pick) { return ( diff --git a/apps/ui-kit/src/lib/components/atoms/header/Header.tsx b/apps/ui-kit/src/lib/components/atoms/header/Header.tsx index 503e9765d11..a988413e5cc 100644 --- a/apps/ui-kit/src/lib/components/atoms/header/Header.tsx +++ b/apps/ui-kit/src/lib/components/atoms/header/Header.tsx @@ -29,13 +29,13 @@ export function Header({ title, titleCentered, onBack, onClose }: HeaderProps): const keepSpaceForIcon = titleCentered && (!onBack || !onClose); return ( -
+
{onBack ? (
{items.map((item) => ( diff --git a/apps/ui-kit/src/lib/styles/index.css b/apps/ui-kit/src/lib/styles/index.css index 97fa4033aad..7579359862f 100644 --- a/apps/ui-kit/src/lib/styles/index.css +++ b/apps/ui-kit/src/lib/styles/index.css @@ -68,6 +68,10 @@ &:active::after { @apply opacity-12; } + + &:disabled::after { + @apply opacity-0; + } } .state-layer { diff --git a/apps/wallet/src/ui/app/components/accounts/AutoLockSelector.tsx b/apps/wallet/src/ui/app/components/accounts/AutoLockSelector.tsx index fdde11b5396..ffb32d74792 100644 --- a/apps/wallet/src/ui/app/components/accounts/AutoLockSelector.tsx +++ b/apps/wallet/src/ui/app/components/accounts/AutoLockSelector.tsx @@ -7,9 +7,9 @@ import { useFormContext } from 'react-hook-form'; import { z } from 'zod'; import { CheckboxField } from '../../shared/forms/CheckboxField'; -import { Input } from '../../shared/forms/controls/Input'; import FormField from '../../shared/forms/FormField'; import { SelectField } from '../../shared/forms/SelectField'; +import { Input, InputType } from '@iota/apps-ui-kit'; const LOCK_INTERVALS = [ { id: 'day', label: 'Day' }, @@ -62,7 +62,7 @@ export function AutoLockSelector({ disabled }: AutoLockSelectorProps) {
diff --git a/apps/wallet/src/ui/app/components/accounts/ProtectAccountForm.tsx b/apps/wallet/src/ui/app/components/accounts/ProtectAccountForm.tsx index ea399596dcc..0fc501ea06f 100644 --- a/apps/wallet/src/ui/app/components/accounts/ProtectAccountForm.tsx +++ b/apps/wallet/src/ui/app/components/accounts/ProtectAccountForm.tsx @@ -133,7 +133,11 @@ export function ProtectAccountForm({ I read and agreed to the - + Terms of Services
diff --git a/apps/wallet/src/ui/app/shared/forms/CheckboxField.tsx b/apps/wallet/src/ui/app/shared/forms/CheckboxField.tsx index d28114f353c..670748de62f 100644 --- a/apps/wallet/src/ui/app/shared/forms/CheckboxField.tsx +++ b/apps/wallet/src/ui/app/shared/forms/CheckboxField.tsx @@ -29,6 +29,7 @@ export const CheckboxField = forwardRef( isChecked={value} ref={forwardedRef} {...props} + isDisabled={props.disabled} />
diff --git a/apps/wallet/src/ui/app/shared/forms/SelectField.tsx b/apps/wallet/src/ui/app/shared/forms/SelectField.tsx index 396f2554259..bafa88ea248 100644 --- a/apps/wallet/src/ui/app/shared/forms/SelectField.tsx +++ b/apps/wallet/src/ui/app/shared/forms/SelectField.tsx @@ -4,8 +4,7 @@ import { forwardRef, type ReactNode } from 'react'; import { Controller, useFormContext } from 'react-hook-form'; - -import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from './controls/Select'; +import { Select } from '@iota/apps-ui-kit'; interface SelectFieldProps { name: string; @@ -21,21 +20,13 @@ export const SelectField = forwardRef( control={control} name={name} render={({ field }) => ( - + ); }, From d56a3e5b939edcf5373047ee8884d80e5b48bdbd Mon Sep 17 00:00:00 2001 From: "Ching-Hua (Vivian) Lin" Date: Wed, 14 Aug 2024 01:48:45 +0800 Subject: [PATCH 7/7] doc(node): Add doc comments to iota-network/state_sync mod (#1645) * doc(node): Add doc comments to state_sync mod * fix: Fix typo * fix: Make comments in StateSyncMessage doc comments * fix: Capitalize the first character in comments --------- Co-authored-by: muXxer --- crates/iota-network/src/state_sync/mod.rs | 85 +++++++++++++++----- crates/iota-network/src/state_sync/server.rs | 8 ++ crates/iota-network/src/state_sync/tests.rs | 16 ++-- 3 files changed, 83 insertions(+), 26 deletions(-) diff --git a/crates/iota-network/src/state_sync/mod.rs b/crates/iota-network/src/state_sync/mod.rs index b54d29d6152..4b56869836f 100644 --- a/crates/iota-network/src/state_sync/mod.rs +++ b/crates/iota-network/src/state_sync/mod.rs @@ -185,10 +185,10 @@ impl PeerHeights { .filter(|(_peer_id, info)| info.on_same_chain_as_us) } - // Returns a bool that indicates if the update was done successfully. - // - // This will return false if the given peer doesn't have an entry or is not on - // the same chain as us + /// Returns a bool that indicates if the update was done successfully. + /// + /// This will return false if the given peer doesn't have an entry or is not + /// on the same chain as us pub fn update_peer_info( &mut self, peer_id: PeerId, @@ -357,13 +357,16 @@ impl Iterator for PeerBalancer { #[derive(Clone, Debug)] enum StateSyncMessage { + /// Node will send this to StateSyncEventLoop in order to kick off the state + /// sync process. StartSyncJob, - // Validators will send this to the StateSyncEventLoop in order to kick off notifying our - // peers of the new checkpoint. + /// Validators will send this to the StateSyncEventLoop in order to kick off + /// notifying our peers of the new checkpoint. VerifiedCheckpoint(Box), - // Notification that the checkpoint content sync task will send to the event loop in the event - // it was able to successfully sync a checkpoint's contents. If multiple checkpoints were - // synced at the same time, only the highest checkpoint is sent. + /// Notification that the checkpoint content sync task will send to the + /// event loop in the event it was able to successfully sync a + /// checkpoint's contents. If multiple checkpoints were synced at the + /// same time, only the highest checkpoint is sent. SyncedCheckpoint(Box), } @@ -374,6 +377,7 @@ struct StateSyncEventLoop { /// Weak reference to our own mailbox weak_sender: mpsc::WeakSender, + /// A set of all spawned tasks. tasks: JoinSet<()>, sync_checkpoint_summaries_task: Option, sync_checkpoint_contents_task: Option, @@ -460,9 +464,12 @@ where loop { tokio::select! { now = interval.tick() => { + // Query the latest checkpoint of connected peers that are on the + // same chain as us. And check if download_limit_layer needs to be pruned or not. self.handle_tick(now.into_std()); }, maybe_message = self.mailbox.recv() => { + // Handle StateSyncMessage. // Once all handles to our mailbox have been dropped this // will yield `None` and we can terminate the event loop if let Some(message) = maybe_message { @@ -472,16 +479,18 @@ where } }, peer_event = peer_events.recv() => { + // Handle new and closed peer connections. self.handle_peer_event(peer_event); }, + // Resolve the spawned tasks. Some(task_result) = self.tasks.join_next() => { match task_result { Ok(()) => {}, Err(e) => { if e.is_cancelled() { - // avoid crashing on ungraceful shutdown + // Avoid crashing on ungraceful shutdown } else if e.is_panic() { - // propagate panics. + // Propagate panics. std::panic::resume_unwind(e.into_panic()); } else { panic!("task failed: {e}"); @@ -489,14 +498,17 @@ where }, }; + // The sync_checkpoint_contents task is expected to run indefinitely. if matches!(&self.sync_checkpoint_contents_task, Some(t) if t.is_finished()) { panic!("sync_checkpoint_contents task unexpectedly terminated") } + // Clean up sync_checkpoint_summaries_task if it's finished. if matches!(&self.sync_checkpoint_summaries_task, Some(t) if t.is_finished()) { self.sync_checkpoint_summaries_task = None; } + // The sync_checkpoint_from_archive_task task is expected to run indefinitely. if matches!(&self.sync_checkpoint_from_archive_task, Some(t) if t.is_finished()) { panic!("sync_checkpoint_from_archive task unexpectedly terminated") } @@ -589,7 +601,7 @@ where .collect::>(); } - // If this is the last checkpoint of a epoch, we need to make sure + // If this is the last checkpoint of an epoch, we need to make sure // new committee is in store before we verify newer checkpoints in next epoch. // This could happen before this validator's reconfiguration finishes, because // state sync does not reconfig. @@ -618,6 +630,7 @@ where // We don't care if no one is listening as this is a broadcast channel let _ = self.checkpoint_event_sender.send(checkpoint.clone()); + // Notify connected peers of the new checkpoint self.spawn_notify_peers_of_checkpoint(checkpoint); } @@ -677,6 +690,9 @@ where } } + /// Starts syncing checkpoint summaries if there are peers that have a + /// higher known checkpoint than us. Only one sync task is allowed to + /// run at a time. fn maybe_start_checkpoint_summary_sync_task(&mut self) { // Only run one sync task at a time if self.sync_checkpoint_summaries_task.is_some() { @@ -700,7 +716,7 @@ where .as_ref() .map(|x| x.sequence_number()) { - // start sync job + // Start sync job let task = sync_to_checkpoint( self.network.clone(), self.store.clone(), @@ -723,6 +739,10 @@ where } } + /// Triggers the checkpoint contents sync task if + /// highest_verified_checkpoint > highest_synced_checkpoint and there + /// are peers that have highest_known_checkpoint > + /// highest_synced_checkpoint. fn maybe_trigger_checkpoint_contents_sync_task( &mut self, target_sequence_channel: &watch::Sender, @@ -738,7 +758,7 @@ where if highest_verified_checkpoint.sequence_number() > highest_synced_checkpoint.sequence_number() - // skip if we aren't connected to any peers that can help + // Skip if we aren't connected to any peers that can help && self .peer_heights .read() @@ -768,6 +788,8 @@ where } } +/// Sends a notification of the new checkpoint to all connected peers that are +/// on the same chain as us. async fn notify_peers_of_checkpoint( network: anemo::Network, peer_heights: Arc>, @@ -777,6 +799,7 @@ async fn notify_peers_of_checkpoint( let futs = peer_heights .read() .unwrap() + // Filter out any peers who is not on the same chain as us .peers_on_same_chain() // Filter out any peers who we know already have a checkpoint higher than this one .filter_map(|(peer_id, info)| { @@ -793,6 +816,8 @@ async fn notify_peers_of_checkpoint( futures::future::join_all(futs).await; } +/// Queries a peer for their latest PeerStateSyncInfo and +/// keep the updated info in PeerHeights. async fn get_latest_from_peer( our_genesis_checkpoint_digest: CheckpointDigest, peer: anemo::Peer, @@ -891,7 +916,7 @@ async fn query_peer_for_latest_info( }; // Then we try the old query - // TODO: remove this once the new feature stabilizes + // TODO: Remove this once the new feature stabilizes let request = Request::new(GetCheckpointSummaryRequest::Latest).with_timeout(timeout); let response = client .get_checkpoint_summary(request) @@ -907,6 +932,10 @@ async fn query_peer_for_latest_info( } } +/// Queries and update the latest checkpoint of connected peers that are on the +/// same chain as us. If the received highest checkpoint of any peer is higher +/// than the current one, we will start syncing via +/// StateSyncMessage::StartSyncJob. async fn query_peers_for_their_latest_checkpoint( network: anemo::Network, peer_heights: Arc>, @@ -959,6 +988,10 @@ async fn query_peers_for_their_latest_checkpoint( } } +/// Queries connected peers for checkpoints from sequence +/// current+1 to the target. The received checkpoints will be verified and +/// stored in the store. Checkpoints in temporary store (peer_heights) will be +/// cleaned up after syncing. async fn sync_to_checkpoint( network: anemo::Network, store: S, @@ -990,7 +1023,7 @@ where peer_heights.clone(), PeerCheckpointRequestType::Summary, ); - // range of the next sequence_numbers to fetch + // Range of the next sequence_numbers to fetch let mut request_stream = (current.sequence_number().checked_add(1).unwrap() ..=*checkpoint.sequence_number()) .map(|next| { @@ -1019,7 +1052,7 @@ where .and_then(Response::into_inner) .tap_none(|| trace!("peer unable to help sync")) { - // peer didn't give us a checkpoint with the height that we requested + // Peer didn't give us a checkpoint with the height that we requested if *checkpoint.sequence_number() != next { tracing::debug!( "peer returned checkpoint with wrong sequence number: expected {next}, got {}", @@ -1028,7 +1061,7 @@ where continue; } - // peer gave us a checkpoint whose digest does not match pinned digest + // Peer gave us a checkpoint whose digest does not match pinned digest let checkpoint_digest = checkpoint.digest(); if let Ok(pinned_digest_index) = pinned_checkpoints.binary_search_by_key( checkpoint.sequence_number(), @@ -1120,6 +1153,9 @@ where Ok(()) } +/// Syncs checkpoint contents from one of the archive_readers if the +/// highest_synced_checkpoint < lowest_checkpoint among peers. The requesting +/// checkpoint range is from highest_synced_checkpoint+1 to lowest_checkpoint. async fn sync_checkpoint_contents_from_archive( network: anemo::Network, archive_readers: ArchiveReaderBalancer, @@ -1129,6 +1165,7 @@ async fn sync_checkpoint_contents_from_archive( S: WriteStore + Clone + Send + Sync + 'static, { loop { + // Get connected peers that are on the same chain as us let peers: Vec<_> = peer_heights .read() .unwrap() @@ -1187,6 +1224,11 @@ async fn sync_checkpoint_contents_from_archive( } } +/// Syncs checkpoint contents from peers if the target sequence cursor, which is +/// changed via target_sequence_channel, is greater than the current one. The +/// requesting checkpoint range is from current_sequence+1 to +/// target_sequence_cursor. It will also periodically notify the peers of our +/// latest synced checkpoint. async fn sync_checkpoint_contents( network: anemo::Network, store: S, @@ -1262,7 +1304,7 @@ async fn sync_checkpoint_contents( }, } - // Start new tasks up to configured concurrency limits. + // Start syncing tasks up to configured concurrency limits. while current_sequence < target_sequence_cursor && checkpoint_contents_tasks.len() < checkpoint_content_download_concurrency { @@ -1306,6 +1348,8 @@ async fn sync_checkpoint_contents( } #[instrument(level = "debug", skip_all, fields(sequence_number = ?checkpoint.sequence_number()))] +/// Requests a single checkpoint contents from peers if the store does not +/// have it. async fn sync_one_checkpoint_contents( network: anemo::Network, store: S, @@ -1354,6 +1398,9 @@ where } #[instrument(level = "debug", skip_all)] +/// Request the full checkpoint contents from peers if the store does not +/// already have it. Requests are sent to peer one by one, until the contents +/// are successfully retrieved. async fn get_full_checkpoint_contents( peers: PeerBalancer, store: S, diff --git a/crates/iota-network/src/state_sync/server.rs b/crates/iota-network/src/state_sync/server.rs index 1a24487aa36..9d75afef580 100644 --- a/crates/iota-network/src/state_sync/server.rs +++ b/crates/iota-network/src/state_sync/server.rs @@ -47,6 +47,9 @@ impl StateSync for Server where S: WriteStore + Send + Sync + 'static, { + /// Pushes a checkpoint summary to the server. + /// If the checkpoint is higher than the highest verified checkpoint, it + /// will notify the event loop to potentially sync it. async fn push_checkpoint_summary( &self, request: Request, @@ -83,6 +86,8 @@ where Ok(Response::new(())) } + /// Gets a checkpoint summary by digest or sequence number, or get the + /// latest one. async fn get_checkpoint_summary( &self, request: Request, @@ -104,6 +109,8 @@ where Ok(Response::new(checkpoint)) } + /// Gets the highest synced checkpoint and the lowest available checkpoint + /// of the node. async fn get_checkpoint_availability( &self, _request: Request<()>, @@ -124,6 +131,7 @@ where })) } + /// Gets the contents of a checkpoint. async fn get_checkpoint_contents( &self, request: Request, diff --git a/crates/iota-network/src/state_sync/tests.rs b/crates/iota-network/src/state_sync/tests.rs index b378447c18b..18e729a9f0d 100644 --- a/crates/iota-network/src/state_sync/tests.rs +++ b/crates/iota-network/src/state_sync/tests.rs @@ -30,6 +30,8 @@ use crate::{ }; #[tokio::test] +// Test that the server stores the pushed checkpoint summary and triggers the +// sync job. async fn server_push_checkpoint() { let committee = CommitteeFixture::generate(rand::rngs::OsRng, 0, 4); let (ordered_checkpoints, _, _sequence_number_to_digest, _checkpoints) = @@ -186,7 +188,7 @@ async fn server_get_checkpoint() { #[tokio::test] async fn isolated_sync_job() { let committee = CommitteeFixture::generate(rand::rngs::OsRng, 0, 4); - // build mock data + // Build mock data let (ordered_checkpoints, _, sequence_number_to_digest, checkpoints) = committee.make_empty_checkpoints(100, None); @@ -271,7 +273,7 @@ async fn isolated_sync_job() { #[tokio::test] async fn test_state_sync_using_archive() -> anyhow::Result<()> { let committee = CommitteeFixture::generate(rand::rngs::OsRng, 0, 4); - // build mock data + // Build mock data let (ordered_checkpoints, _, sequence_number_to_digest, checkpoints) = committee.make_empty_checkpoints(100, None); // Initialize archive store with all checkpoints @@ -455,7 +457,7 @@ async fn test_state_sync_using_archive() -> anyhow::Result<()> { async fn sync_with_checkpoints_being_inserted() { telemetry_subscribers::init_for_testing(); let committee = CommitteeFixture::generate(rand::rngs::OsRng, 0, 4); - // build mock data + // Build mock data let (ordered_checkpoints, _contents, sequence_number_to_digest, checkpoints) = committee.make_empty_checkpoints(4, None); @@ -480,10 +482,10 @@ async fn sync_with_checkpoints_being_inserted() { committee.committee().to_owned(), ); - // get handles to each node's stores + // Get handles to each node's stores let store_1 = event_loop_1.store.clone(); let store_2 = event_loop_2.store.clone(); - // make sure that node_1 knows about node_2 + // Make sure that node_1 knows about node_2 event_loop_1.peer_heights.write().unwrap().peers.insert( network_2.peer_id(), PeerStateSyncInfo { @@ -585,7 +587,7 @@ async fn sync_with_checkpoints_being_inserted() { async fn sync_with_checkpoints_watermark() { telemetry_subscribers::init_for_testing(); let committee = CommitteeFixture::generate(rand::rngs::OsRng, 0, 4); - // build mock data + // Build mock data let (ordered_checkpoints, contents, _sequence_number_to_digest, _checkpoints) = committee.make_random_checkpoints(4, None); let last_checkpoint_seq = *ordered_checkpoints @@ -614,7 +616,7 @@ async fn sync_with_checkpoints_watermark() { committee.committee().to_owned(), ); - // get handles to each node's stores + // Get handles to each node's stores let store_1 = event_loop_1.store.clone(); let store_2 = event_loop_2.store.clone(); let peer_id_1 = network_1.peer_id();