From b9ec8e7c091fe698462ab8220754605ac6761be0 Mon Sep 17 00:00:00 2001 From: Damir Shamanaev Date: Tue, 26 Jul 2022 01:22:07 +0300 Subject: [PATCH] fixes errors introduced by object::Info (#3461) --- doc/book/examples/sources/basics/custom-transfer.move | 2 +- doc/book/examples/sources/basics/entry-functions.move | 4 ++-- doc/book/examples/sources/basics/events.move | 10 +++++----- doc/book/examples/sources/basics/init-function.move | 2 +- doc/book/examples/sources/basics/shared-object.move | 4 ++-- doc/book/examples/sources/basics/strings.move | 4 ++-- doc/book/examples/sources/basics/transfer.move | 6 +++--- doc/book/examples/sources/patterns/capability.move | 2 +- .../sources/patterns/transferable-witness.move | 4 ++-- doc/book/examples/sources/patterns/witness.move | 4 ++-- doc/book/examples/sources/samples/nft.move | 6 +++--- 11 files changed, 24 insertions(+), 24 deletions(-) diff --git a/doc/book/examples/sources/basics/custom-transfer.move b/doc/book/examples/sources/basics/custom-transfer.move index 8b57375c92a3f..bd159b6b47e01 100644 --- a/doc/book/examples/sources/basics/custom-transfer.move +++ b/doc/book/examples/sources/basics/custom-transfer.move @@ -5,7 +5,7 @@ module examples::restricted_transfer { use sui::tx_context::{Self, TxContext}; use sui::balance::{Self, Balance}; use sui::coin::{Self, Coin}; - use sui::object::Info; + use sui::object::{Self, Info}; use sui::transfer; use sui::sui::SUI; diff --git a/doc/book/examples/sources/basics/entry-functions.move b/doc/book/examples/sources/basics/entry-functions.move index 984270bbb9a4e..95c0a46a85b43 100644 --- a/doc/book/examples/sources/basics/entry-functions.move +++ b/doc/book/examples/sources/basics/entry-functions.move @@ -3,8 +3,8 @@ module examples::object { use sui::transfer; - use sui::object::Info; - use sui::tx_context::{Self, TxContext}; + use sui::object::{Self, Info}; + use sui::tx_context::TxContext; struct Object has key { info: Info diff --git a/doc/book/examples/sources/basics/events.move b/doc/book/examples/sources/basics/events.move index 5dcfdaac5e58a..7d8573ca45b01 100644 --- a/doc/book/examples/sources/basics/events.move +++ b/doc/book/examples/sources/basics/events.move @@ -62,19 +62,19 @@ module examples::donuts_with_events { let coin_balance = coin::balance_mut(payment); let paid = balance::split(coin_balance, shop.price); - let id = object::new(ctx); + let info = object::new(ctx); balance::join(&mut shop.balance, paid); // Emit the event using future object's ID. - event::emit(DonutBought { id: *object::info_id(&id) }); - transfer::transfer(Donut { id }, tx_context::sender(ctx)) + event::emit(DonutBought { id: *object::info_id(&info) }); + transfer::transfer(Donut { info }, tx_context::sender(ctx)) } /// Consume donut and get nothing... public entry fun eat_donut(d: Donut) { - let Donut { id } = d; - object::delete(id); + let Donut { info } = d; + object::delete(info); } /// Take coin from `DonutShop` and transfer it to tx sender. diff --git a/doc/book/examples/sources/basics/init-function.move b/doc/book/examples/sources/basics/init-function.move index 65befdc56af4e..d80a12f169834 100644 --- a/doc/book/examples/sources/basics/init-function.move +++ b/doc/book/examples/sources/basics/init-function.move @@ -3,7 +3,7 @@ module examples::one_timer { use sui::transfer; - use sui::object::Info; + use sui::object::{Self, Info}; use sui::tx_context::{Self, TxContext}; /// The one of a kind - created in the module initializer. diff --git a/doc/book/examples/sources/basics/shared-object.move b/doc/book/examples/sources/basics/shared-object.move index 03b6f22a9e95c..c666263752774 100644 --- a/doc/book/examples/sources/basics/shared-object.move +++ b/doc/book/examples/sources/basics/shared-object.move @@ -65,8 +65,8 @@ module examples::donuts { /// Consume donut and get nothing... public entry fun eat_donut(d: Donut) { - let Donut { id } = d; - object::delete(id); + let Donut { info } = d; + object::delete(info); } /// Take coin from `DonutShop` and transfer it to tx sender. diff --git a/doc/book/examples/sources/basics/strings.move b/doc/book/examples/sources/basics/strings.move index b299a1d2e6250..55c8da3b0f721 100644 --- a/doc/book/examples/sources/basics/strings.move +++ b/doc/book/examples/sources/basics/strings.move @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 module examples::strings { - use sui::object::Info; - use sui::tx_context::{Self, TxContext}; + use sui::object::{Self, Info}; + use sui::tx_context::TxContext; // Use this dependency to get a type wrapper for UTF-8 strings use sui::utf8::{Self, String}; diff --git a/doc/book/examples/sources/basics/transfer.move b/doc/book/examples/sources/basics/transfer.move index c4c341da56314..fbb1e2c315373 100644 --- a/doc/book/examples/sources/basics/transfer.move +++ b/doc/book/examples/sources/basics/transfer.move @@ -4,7 +4,7 @@ /// A freely transfererrable Wrapper for custom data. module examples::wrapper { use sui::object::{Self, Info}; - use sui::tx_context::{Self, TxContext}; + use sui::tx_context::TxContext; /// An object with `store` can be transferred in any /// module without a custom transfer implementation. @@ -30,8 +30,8 @@ module examples::wrapper { /// Destroy `Wrapper` and get T. public fun destroy (c: Wrapper): T { - let Wrapper { id, contents } = c; - object::delete(id); + let Wrapper { info, contents } = c; + object::delete(info); contents } } diff --git a/doc/book/examples/sources/patterns/capability.move b/doc/book/examples/sources/patterns/capability.move index 056402f84052c..beecea1e85647 100644 --- a/doc/book/examples/sources/patterns/capability.move +++ b/doc/book/examples/sources/patterns/capability.move @@ -3,7 +3,7 @@ module examples::item { use sui::transfer; - use sui::object::Info; + use sui::object::{Self, Info}; use sui::utf8::{Self, String}; use sui::tx_context::{Self, TxContext}; diff --git a/doc/book/examples/sources/patterns/transferable-witness.move b/doc/book/examples/sources/patterns/transferable-witness.move index c35839521d88b..8202109debd21 100644 --- a/doc/book/examples/sources/patterns/transferable-witness.move +++ b/doc/book/examples/sources/patterns/transferable-witness.move @@ -29,8 +29,8 @@ module examples::transferable_witness { /// Unwrap a carrier and get the inner WITNESS type. public fun get_witness(carrier: WitnessCarrier): WITNESS { - let WitnessCarrier { id, witness } = carrier; - object::delete(id); + let WitnessCarrier { info, witness } = carrier; + object::delete(info); witness } } diff --git a/doc/book/examples/sources/patterns/witness.move b/doc/book/examples/sources/patterns/witness.move index dd0e9d7decb54..ad3f162da8205 100644 --- a/doc/book/examples/sources/patterns/witness.move +++ b/doc/book/examples/sources/patterns/witness.move @@ -4,8 +4,8 @@ /// Module that defines a generic type `Guardian` which can only be /// instantiated with a witness. module examples::guardian { - use sui::object::Info; - use sui::tx_context::{Self, TxContext}; + use sui::object::{Self, Info}; + use sui::tx_context::TxContext; /// Phantom parameter T can only be initialized in the `create_guardian` /// function. But the types passed here must have `drop`. diff --git a/doc/book/examples/sources/samples/nft.move b/doc/book/examples/sources/samples/nft.move index 6147978e1dbb3..39e8e3d96096c 100644 --- a/doc/book/examples/sources/samples/nft.move +++ b/doc/book/examples/sources/samples/nft.move @@ -67,7 +67,7 @@ module examples::devnet_nft { }; event::emit(NFTMinted { - object_id: *object::info_id(&nft.id), + object_id: *object::info_id(&nft.info), creator: sender, name: nft.name, }); @@ -93,7 +93,7 @@ module examples::devnet_nft { /// Permanently delete `nft` public entry fun burn(nft: DevNetNFT, _: &mut TxContext) { - let DevNetNFT { id, name: _, description: _, url: _ } = nft; - object::delete(id) + let DevNetNFT { info, name: _, description: _, url: _ } = nft; + object::delete(info) } }