Skip to content

Commit

Permalink
fixes errors introduced by object::Info (MystenLabs#3461)
Browse files Browse the repository at this point in the history
  • Loading branch information
damirka authored Jul 25, 2022
1 parent e627915 commit b9ec8e7
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion doc/book/examples/sources/basics/custom-transfer.move
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions doc/book/examples/sources/basics/entry-functions.move
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions doc/book/examples/sources/basics/events.move
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion doc/book/examples/sources/basics/init-function.move
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions doc/book/examples/sources/basics/shared-object.move
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions doc/book/examples/sources/basics/strings.move
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
6 changes: 3 additions & 3 deletions doc/book/examples/sources/basics/transfer.move
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -30,8 +30,8 @@ module examples::wrapper {

/// Destroy `Wrapper` and get T.
public fun destroy<T: store> (c: Wrapper<T>): T {
let Wrapper { id, contents } = c;
object::delete(id);
let Wrapper { info, contents } = c;
object::delete(info);
contents
}
}
Expand Down
2 changes: 1 addition & 1 deletion doc/book/examples/sources/patterns/capability.move
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
4 changes: 2 additions & 2 deletions doc/book/examples/sources/patterns/transferable-witness.move
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
4 changes: 2 additions & 2 deletions doc/book/examples/sources/patterns/witness.move
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
/// Module that defines a generic type `Guardian<T>` 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`.
Expand Down
6 changes: 3 additions & 3 deletions doc/book/examples/sources/samples/nft.move
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand All @@ -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)
}
}

0 comments on commit b9ec8e7

Please sign in to comment.