【学习笔记】Sui Move NFT发行
$ sui client envs
╭─────────┬───────────────────────────────────────┬────────╮
│ alias │ url │ active │
├─────────┼───────────────────────────────────────┼────────┤
│ devnet │ https://fullnode.devnet.sui.io:443 │ │
│ mainnet │ https://sui-mainnet.nodeinfra.com:443 │ │
│ testnet │ https://fullnode.testnet.sui.io:443 │ * │
╰─────────┴───────────────────────────────────────┴────────╯
$ sui client active-address
0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8
$ sui client gas
╭────────────────────────────────────────────────────────────────────┬────────────╮
│ gasCoinId │ gasBalance │
├────────────────────────────────────────────────────────────────────┼────────────┤
│ 0x70b96720fadb6aa45620ab84efd9139e4674057207c93e4375350ec695865fab │ 1000000000 │
╰────────────────────────────────────────────────────────────────────┴────────────╯
$ sui move new js_sui_nft
$ cd js_sui_nft/
module js_sui_nft::simplenft {
use std::string::utf8;
use sui::object::{Self, UID};
use sui::transfer;
use sui::tx_context::{Self, TxContext};
use sui::display;
use sui::package;
struct SIMPLENFT has drop{}
struct SimpleNFT has key, store {
id: UID,
tokenId: u64
}
struct State has key {
id: UID,
count: u64
}
// https://examples.sui.io/basics/one-time-witness.html
// In Sui Move a type is considered an OTW if its definition has the following properties:
// Named after the module but uppercased
// Has only drop ability
fun init(witness: SIMPLENFT, ctx: &mut TxContext) {
let keys = vector[
utf8(b"name"),
utf8(b"collection"),
utf8(b"image_url"),
utf8(b"description")
];
let values = vector[
utf8(b"Simple Bityoume NFT #{tokenId}"),
utf8(b"Simple Bityoume NFT Collection"),
utf8(b"ipfs://QmZo2QH4dtav6HQUqztQz81sifqrp3jCcdc5jQ8axyurna"),
utf8(b"This is Bityoume NFT")
];
let publisher = package::claim(witness, ctx);
let display = display::new_with_fields<SimpleNFT>(
&publisher, keys, values, ctx);
display::update_version(&mut display);
transfer::public_transfer(publisher, tx_context::sender(ctx));
transfer::public_transfer(display, tx_context::sender(ctx));
transfer::share_object(State{
id: object::new(ctx),
count: 0
});
}
entry public fun mint(state: &mut State, ctx: &mut TxContext) {
let sender = tx_context::sender(ctx);
state.count = state.count + 1;
let nft = SimpleNFT {
id: object::new(ctx),
tokenId: state.count,
};
transfer::public_transfer(nft, sender);
}
}
module js_sui_nft::simple_sbt_nft {
use std::string::utf8;
use sui::object::{Self, UID};
use sui::transfer;
use sui::tx_context::{Self, TxContext};
use sui::display;
use sui::package;
struct SIMPLE_SBT_NFT has drop{}
struct SBTNFT has key {
id: UID,
tokenId: u64
}
struct State has key {
id: UID,
count: u64
}
fun init(witness: SIMPLE_SBT_NFT, ctx: &mut TxContext) {
let keys = vector[
utf8(b"name"),
utf8(b"collection"),
utf8(b"image_url"),
utf8(b"description")
];
let values = vector[
utf8(b"SBT Bityoume NFT #{tokenId}"),
utf8(b"SBT Bityoume NFT Collection"),
utf8(b"ipfs://QmZo2QH4dtav6HQUqztQz81sifqrp3jCcdc5jQ8axyurna"),
utf8(b"This is Bityoume SBT NFT")
];
let publisher = package::claim(witness, ctx);
let display = display::new_with_fields<SBTNFT>(
&publisher, keys, values, ctx);
display::update_version(&mut display);
transfer::public_transfer(publisher, tx_context::sender(ctx));
transfer::public_transfer(display, tx_context::sender(ctx));
transfer::share_object(State{
id: object::new(ctx),
count: 0
});
}
entry public fun mint(state: &mut State, ctx: &mut TxContext) {
let sender = tx_context::sender(ctx);
state.count = state.count + 1;
let nft = SBTNFT {
id: object::new(ctx),
tokenId: state.count,
};
// nft_sbt.move(55, 15): The type '(js_sui_nft=0x0)::simple_sbt_nft::SBTNFT' does not have the ability 'store'
// transfer::public_transfer(nft, sender);
transfer::transfer(nft, sender);
}
}
module js_sui_nft::nft_hero{
use std::string::utf8;
use sui::object::{Self, UID};
use sui::transfer;
use sui::tx_context::{Self, TxContext};
use sui::clock::{Self, Clock};
use sui::display;
use sui::package;
struct NFT_HERO has drop{}
struct MyHero has key {
id: UID,
tokenId: u64,
hp: u64,
mp: u64,
xp: u64,
level: u64,
createTime: u64,
}
struct State has key {
id: UID,
count: u64
}
fun init(witness: NFT_HERO, ctx: &mut TxContext) {
let keys = vector[
utf8(b"name"),
utf8(b"image_url"),
utf8(b"hp"),
utf8(b"mp"),
utf8(b"xp"),
utf8(b"level")
];
let values = vector[
utf8(b"Bityoume NFT HERO #{tokenId}"),
utf8(b"ipfs://QmZo2QH4dtav6HQUqztQz81sifqrp3jCcdc5jQ8axyurna"),
utf8(b"{hp}"),
utf8(b"{mp}"),
utf8(b"{xp}"),
utf8(b"{level}")
];
let publisher = package::claim(witness, ctx);
let display = display::new_with_fields<MyHero>(
&publisher, keys, values, ctx);
display::update_version(&mut display);
transfer::public_transfer(publisher, tx_context::sender(ctx));
transfer::public_transfer(display, tx_context::sender(ctx));
transfer::share_object(State{
id: object::new(ctx),
count: 0
});
}
entry public fun mint(state: &mut State, clock: &Clock, ctx: &mut TxContext) {
let sender = tx_context::sender(ctx);
state.count = state.count + 1;
let nft = MyHero {
id: object::new(ctx),
tokenId: state.count,
hp: 100,
mp: 10,
xp: 0,
level: 1,
createTime: clock::timestamp_ms(clock)/1000,
};
transfer::transfer(nft, sender);
}
entry public fun update_hero(hero: &mut MyHero, _: &mut TxContext) {
hero.xp = hero.xp + 1;
if (hero.xp >= hero.level * 10) {
hero.level = hero.level + 1;
}
}
}
$ sui move build
UPDATING GIT DEPENDENCY https://github.com/MystenLabs/sui.git
INCLUDING DEPENDENCY Sui
INCLUDING DEPENDENCY MoveStdlib
BUILDING js_sui_nft
$ sui client publish --gas-budget 500000000
(2023-12-03 08:46:11) [jason@Ubuntu-2204-jammy-amd64-base:~/Study/JasonPlayBlockchain/07.Sui/SuiHome/roadmap02_nft/js_sui_nft] (main)$ sui client publish --gas-budget 500000000
[warn] Client/Server api version mismatch, client api version : 1.13.0, server api version : 1.14.2
UPDATING GIT DEPENDENCY https://github.com/MystenLabs/sui.git
INCLUDING DEPENDENCY Sui
INCLUDING DEPENDENCY MoveStdlib
BUILDING js_sui_nft
Successfully verified dependencies on-chain against source.
----- Transaction Digest ----
9mpGNmYD67WpiXpedQDbV61uEAXKND5t2VFq2chAnYBa
----- Transaction Data ----
Transaction Signature: [Signature(Ed25519SuiSignature(Ed25519SuiSignature([0, 3, 37, 70, 129, 9, 161, 103, 235, 135, 200, 70, 214, 251, 55, 171, 174, 50, 29, 208, 221, 199, 124, 8, 140, 147, 18, 19, 163, 6, 10, 74, 207, 15, 32, 208, 107, 104, 47, 192, 10, 134, 176, 63, 22, 48, 136, 29, 142, 40, 141, 206, 120, 5, 5, 41, 180, 59, 104, 16, 204, 208, 125, 246, 3, 10, 114, 213, 219, 204, 52, 207, 244, 13, 153, 120, 74, 160, 105, 143, 215, 148, 31, 191, 38, 109, 189, 36, 37, 133, 219, 150, 189, 73, 195, 80, 167])))]
Transaction Kind : Programmable
Inputs: [Pure(SuiPureValue { value_type: Some(Address), value: "0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8" })]
Commands: [
Publish(<modules>,0x0000000000000000000000000000000000000000000000000000000000000001,0x0000000000000000000000000000000000000000000000000000000000000002),
TransferObjects([Result(0)],Input(0)),
]
Sender: 0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8
Gas Payment: Object ID: 0x2492eb1c809b62d2376458edaef4d5d2a2b8587774e46ab0ad5842954cd46688, version: 0xe3bb8, digest: 5uiRFc9YWRFkfDsNpGf8s2EJbvqXPr18RRBzRhZ6Q79u
Gas Owner: 0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8
Gas Price: 1000
Gas Budget: 500000000
----- Transaction Effects ----
Status : Success
Created Objects:
- ID: 0x0021b8516f02a6b05254cf4cf0e3f05980ec1469cbc98ca6ca19be09dd6a90ea , Owner: Account Address ( 0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8 )
- ID: 0x20bcce743ea99e302f99b5d8f4894f785e459f83afb230cdc06fe53331ef7029 , Owner: Account Address ( 0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8 )
- ID: 0x4c64de9ab706235fef92cd57d6ca37898c49f73d33aa206d2d18c541c6c8c6c3 , Owner: Account Address ( 0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8 )
- ID: 0x531beb72aaadf1f57ff2bdfdb86624e37b4afe803095f998e31eb501e43168c3 , Owner: Account Address ( 0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8 )
- ID: 0x685c8d9315d6ae99cfb494fce3b059fd13277c280f5f0833c3f2b0236c6af3ae , Owner: Shared
- ID: 0x72c8f0933ce535664fe6cf3c91fb8b7ebd52f28de58b4b9941389fb3c44e3ce3 , Owner: Account Address ( 0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8 )
- ID: 0x9ad0a2363b577b40b8ce89385555b823827892c5270e016d82526cabf1587232 , Owner: Account Address ( 0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8 )
- ID: 0x9ee7e8e2a94cc6b9bd623ff7c8140ab92f366be43f96b1a89ad0c0010fb18f11 , Owner: Shared
- ID: 0xd3552c3a750b26fc90b7849b07196179675f77933ce50f040d572febec2d50fa , Owner: Account Address ( 0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8 )
- ID: 0xd56e1635f4c24759b84d71bc6d3a5b8a80a6cb0623bfa2602ebb23c8e40fb36c , Owner: Shared
- ID: 0xe9924e7c05fa3814b537d1a5767f71f83a6ac1caba63212863abb1bf976c0850 , Owner: Immutable
Mutated Objects:
- ID: 0x2492eb1c809b62d2376458edaef4d5d2a2b8587774e46ab0ad5842954cd46688 , Owner: Account Address ( 0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8 )
----- Events ----
Array [
Object {
"id": Object {
"txDigest": String("9mpGNmYD67WpiXpedQDbV61uEAXKND5t2VFq2chAnYBa"),
"eventSeq": String("0"),
},
"packageId": String("0xe9924e7c05fa3814b537d1a5767f71f83a6ac1caba63212863abb1bf976c0850"),
"transactionModule": String("nft_hero"),
"sender": String("0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8"),
"type": String("0x2::display::DisplayCreated<0xe9924e7c05fa3814b537d1a5767f71f83a6ac1caba63212863abb1bf976c0850::nft_hero::MyHero>"),
"parsedJson": Object {
"id": String("0x9ad0a2363b577b40b8ce89385555b823827892c5270e016d82526cabf1587232"),
},
"bcs": String("BRLJXH8roEpBzAfxSTkoeYEyuEcKHwgWufQYK8cGkmyB"),
},
Object {
"id": Object {
"txDigest": String("9mpGNmYD67WpiXpedQDbV61uEAXKND5t2VFq2chAnYBa"),
"eventSeq": String("1"),
},
"packageId": String("0xe9924e7c05fa3814b537d1a5767f71f83a6ac1caba63212863abb1bf976c0850"),
"transactionModule": String("nft_hero"),
"sender": String("0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8"),
"type": String("0x2::display::VersionUpdated<0xe9924e7c05fa3814b537d1a5767f71f83a6ac1caba63212863abb1bf976c0850::nft_hero::MyHero>"),
"parsedJson": Object {
"fields": Object {
"contents": Array [
Object {
"key": String("name"),
"value": String("Bityoume NFT HERO #{tokenId}"),
},
Object {
"key": String("image_url"),
"value": String("ipfs://QmZo2QH4dtav6HQUqztQz81sifqrp3jCcdc5jQ8axyurna"),
},
Object {
"key": String("hp"),
"value": String("{hp}"),
},
Object {
"key": String("mp"),
"value": String("{mp}"),
},
Object {
"key": String("xp"),
"value": String("{xp}"),
},
Object {
"key": String("level"),
"value": String("{level}"),
},
],
},
"id": String("0x9ad0a2363b577b40b8ce89385555b823827892c5270e016d82526cabf1587232"),
"version": Number(1),
},
"bcs": String("69kgm6X1Fnav3BXAGUud4kBB6dqHZRpTqzWipgfG53AZ5Z4kK51Y5f1zUfN9M48JqVw7quEjPKBE5GKWHFRLCuk5RDYMJC5kBR6FGFLK9w12VtBKM3fJxPH443hRfdXw6WXpUHrrpawM2EbaHv6wiKy4sTS2823iMFK1dfWVJAX4qGAPbZBqD9zL5LUgtxQ7dAKm25yXLFbsUswXUdyFRJAPXdo2scFzi4jEajvCd2"),
},
Object {
"id": Object {
"txDigest": String("9mpGNmYD67WpiXpedQDbV61uEAXKND5t2VFq2chAnYBa"),
"eventSeq": String("2"),
},
"packageId": String("0xe9924e7c05fa3814b537d1a5767f71f83a6ac1caba63212863abb1bf976c0850"),
"transactionModule": String("simple_sbt_nft"),
"sender": String("0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8"),
"type": String("0x2::display::DisplayCreated<0xe9924e7c05fa3814b537d1a5767f71f83a6ac1caba63212863abb1bf976c0850::simple_sbt_nft::SBTNFT>"),
"parsedJson": Object {
"id": String("0x4c64de9ab706235fef92cd57d6ca37898c49f73d33aa206d2d18c541c6c8c6c3"),
},
"bcs": String("69DCHXt4BPGee6FdADihAAJmqTUcbi4rZEKMnsNhZzYS"),
},
Object {
"id": Object {
"txDigest": String("9mpGNmYD67WpiXpedQDbV61uEAXKND5t2VFq2chAnYBa"),
"eventSeq": String("3"),
},
"packageId": String("0xe9924e7c05fa3814b537d1a5767f71f83a6ac1caba63212863abb1bf976c0850"),
"transactionModule": String("simple_sbt_nft"),
"sender": String("0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8"),
"type": String("0x2::display::VersionUpdated<0xe9924e7c05fa3814b537d1a5767f71f83a6ac1caba63212863abb1bf976c0850::simple_sbt_nft::SBTNFT>"),
"parsedJson": Object {
"fields": Object {
"contents": Array [
Object {
"key": String("name"),
"value": String("SBT Bityoume NFT #{tokenId}"),
},
Object {
"key": String("collection"),
"value": String("SBT Bityoume NFT Collection"),
},
Object {
"key": String("image_url"),
"value": String("ipfs://QmZo2QH4dtav6HQUqztQz81sifqrp3jCcdc5jQ8axyurna"),
},
Object {
"key": String("description"),
"value": String("This is Bityoume SBT NFT"),
},
],
},
"id": String("0x4c64de9ab706235fef92cd57d6ca37898c49f73d33aa206d2d18c541c6c8c6c3"),
"version": Number(1),
},
"bcs": String("Nor8SScaenRayxkvo1yEXT5XbH8oBgyJHX1xoqAJxwY25LEucDhjZKyZgsKBfdW16jkRty7LRsU6vJo3jeYwUimEnDc3c2ZhY4GNwua5SxG3UPS18fqUZ7gDFJeZ27qstJNrvvNZTdkNHbyoSryXL9x7w3vaDsACkb2MBmk2AyGMnEq6TXLTJCvZLwHxLm8KEYQgcnSJieq64Dn7ssSK8oPEbUTsxGsWeUS4AyvfNUquFdjgsKvad4Ubcxkr6MrYXK2uMkXq8wHxFzxAcqrvYXWsvU5R"),
},
Object {
"id": Object {
"txDigest": String("9mpGNmYD67WpiXpedQDbV61uEAXKND5t2VFq2chAnYBa"),
"eventSeq": String("4"),
},
"packageId": String("0xe9924e7c05fa3814b537d1a5767f71f83a6ac1caba63212863abb1bf976c0850"),
"transactionModule": String("simplenft"),
"sender": String("0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8"),
"type": String("0x2::display::DisplayCreated<0xe9924e7c05fa3814b537d1a5767f71f83a6ac1caba63212863abb1bf976c0850::simplenft::SimpleNFT>"),
"parsedJson": Object {
"id": String("0x0021b8516f02a6b05254cf4cf0e3f05980ec1469cbc98ca6ca19be09dd6a90ea"),
},
"bcs": String("1WpgetkBgc6Nc91VhyHSEDyiUFgNZz5rGbwzCupFGkq"),
},
Object {
"id": Object {
"txDigest": String("9mpGNmYD67WpiXpedQDbV61uEAXKND5t2VFq2chAnYBa"),
"eventSeq": String("5"),
},
"packageId": String("0xe9924e7c05fa3814b537d1a5767f71f83a6ac1caba63212863abb1bf976c0850"),
"transactionModule": String("simplenft"),
"sender": String("0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8"),
"type": String("0x2::display::VersionUpdated<0xe9924e7c05fa3814b537d1a5767f71f83a6ac1caba63212863abb1bf976c0850::simplenft::SimpleNFT>"),
"parsedJson": Object {
"fields": Object {
"contents": Array [
Object {
"key": String("name"),
"value": String("Simple Bityoume NFT #{tokenId}"),
},
Object {
"key": String("collection"),
"value": String("Simple Bityoume NFT Collection"),
},
Object {
"key": String("image_url"),
"value": String("ipfs://QmZo2QH4dtav6HQUqztQz81sifqrp3jCcdc5jQ8axyurna"),
},
Object {
"key": String("description"),
"value": String("This is Bityoume NFT"),
},
],
},
"id": String("0x0021b8516f02a6b05254cf4cf0e3f05980ec1469cbc98ca6ca19be09dd6a90ea"),
"version": Number(1),
},
"bcs": String("1jVDJLUiENWUZHgFYG2wEJ66Cmm5x1rJssdYywYZk3n1ET6vWyYAKDDnFq4DfGWFb4sbtr1kCwJrscow73mjAzikbub4jZNsQm4jpoN9skY3HmPYotg3dwExm4Tmgs1dugPAyB6iPHp5fgqyFvvudMioQFHWDTZqCY12eQ18tgJVUkT3tMe6VXXu72WB7t5jKh8ykrdc889FtQ2BnMAx3R5DcPg9LJgi1fPUD2JaXDDxMZkjEavQnToi6fiDhfZRDWWXQv8hbegGcp1UgYoZmKveLL3YkT"),
},
]
----- Object changes ----
Array [
Object {
"type": String("mutated"),
"sender": String("0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8"),
"owner": Object {
"AddressOwner": String("0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8"),
},
"objectType": String("0x2::coin::Coin<0x2::sui::SUI>"),
"objectId": String("0x2492eb1c809b62d2376458edaef4d5d2a2b8587774e46ab0ad5842954cd46688"),
"version": String("932793"),
"previousVersion": String("932792"),
"digest": String("CYJiBs4ZYzYp15zFCPc4himRbB8wfqRVRs24V3pJyKxi"),
},
Object {
"type": String("created"),
"sender": String("0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8"),
"owner": Object {
"AddressOwner": String("0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8"),
},
"objectType": String("0x2::display::Display<0xe9924e7c05fa3814b537d1a5767f71f83a6ac1caba63212863abb1bf976c0850::simplenft::SimpleNFT>"),
"objectId": String("0x0021b8516f02a6b05254cf4cf0e3f05980ec1469cbc98ca6ca19be09dd6a90ea"),
"version": String("932793"),
"digest": String("CCtRPL7S5ET5FxdERkdaHv4J9RUFELnLEwcoVhTLYcMH"),
},
Object {
"type": String("created"),
"sender": String("0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8"),
"owner": Object {
"AddressOwner": String("0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8"),
},
"objectType": String("0x2::package::Publisher"),
"objectId": String("0x20bcce743ea99e302f99b5d8f4894f785e459f83afb230cdc06fe53331ef7029"),
"version": String("932793"),
"digest": String("L14o7DwLhywrczN2sPuCLs3BvPAbxTi6zmLChbekKxs"),
},
Object {
"type": String("created"),
"sender": String("0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8"),
"owner": Object {
"AddressOwner": String("0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8"),
},
"objectType": String("0x2::display::Display<0xe9924e7c05fa3814b537d1a5767f71f83a6ac1caba63212863abb1bf976c0850::simple_sbt_nft::SBTNFT>"),
"objectId": String("0x4c64de9ab706235fef92cd57d6ca37898c49f73d33aa206d2d18c541c6c8c6c3"),
"version": String("932793"),
"digest": String("HUAMp5ompVEWLMifmt3USnaqvxLurd2RiW6EjrMiJDG9"),
},
Object {
"type": String("created"),
"sender": String("0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8"),
"owner": Object {
"AddressOwner": String("0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8"),
},
"objectType": String("0x2::package::Publisher"),
"objectId": String("0x531beb72aaadf1f57ff2bdfdb86624e37b4afe803095f998e31eb501e43168c3"),
"version": String("932793"),
"digest": String("7dPpnHwdf62UAYhoV5iDVWDC7MqfJEFvscrJDSn56hRL"),
},
Object {
"type": String("created"),
"sender": String("0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8"),
"owner": Object {
"Shared": Object {
"initial_shared_version": Number(932793),
},
},
"objectType": String("0xe9924e7c05fa3814b537d1a5767f71f83a6ac1caba63212863abb1bf976c0850::simplenft::State"),
"objectId": String("0x685c8d9315d6ae99cfb494fce3b059fd13277c280f5f0833c3f2b0236c6af3ae"),
"version": String("932793"),
"digest": String("BPsBBy9Ci9fPRUvShNWoBoMW6y4WXPBDXNFEwUWhsTzW"),
},
Object {
"type": String("created"),
"sender": String("0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8"),
"owner": Object {
"AddressOwner": String("0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8"),
},
"objectType": String("0x2::package::UpgradeCap"),
"objectId": String("0x72c8f0933ce535664fe6cf3c91fb8b7ebd52f28de58b4b9941389fb3c44e3ce3"),
"version": String("932793"),
"digest": String("XmGSurF2vyAXSfPep2Vi8pWL3q7iTjuqsDXWJEswohH"),
},
Object {
"type": String("created"),
"sender": String("0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8"),
"owner": Object {
"AddressOwner": String("0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8"),
},
"objectType": String("0x2::display::Display<0xe9924e7c05fa3814b537d1a5767f71f83a6ac1caba63212863abb1bf976c0850::nft_hero::MyHero>"),
"objectId": String("0x9ad0a2363b577b40b8ce89385555b823827892c5270e016d82526cabf1587232"),
"version": String("932793"),
"digest": String("AnBF3kg7gxMh41EGCK7fsQKGAP5PHp2KBvBNZmX2GxF6"),
},
Object {
"type": String("created"),
"sender": String("0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8"),
"owner": Object {
"Shared": Object {
"initial_shared_version": Number(932793),
},
},
"objectType": String("0xe9924e7c05fa3814b537d1a5767f71f83a6ac1caba63212863abb1bf976c0850::nft_hero::State"),
"objectId": String("0x9ee7e8e2a94cc6b9bd623ff7c8140ab92f366be43f96b1a89ad0c0010fb18f11"),
"version": String("932793"),
"digest": String("6GPRMJhnruDWoaoWqSekKEmf8XxAW7MWXj3vDHiVmLrt"),
},
Object {
"type": String("created"),
"sender": String("0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8"),
"owner": Object {
"AddressOwner": String("0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8"),
},
"objectType": String("0x2::package::Publisher"),
"objectId": String("0xd3552c3a750b26fc90b7849b07196179675f77933ce50f040d572febec2d50fa"),
"version": String("932793"),
"digest": String("EGKsRbYmx4Mci43rFiezFUTTdHBMGTx4PqKvYqC5hmT4"),
},
Object {
"type": String("created"),
"sender": String("0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8"),
"owner": Object {
"Shared": Object {
"initial_shared_version": Number(932793),
},
},
"objectType": String("0xe9924e7c05fa3814b537d1a5767f71f83a6ac1caba63212863abb1bf976c0850::simple_sbt_nft::State"),
"objectId": String("0xd56e1635f4c24759b84d71bc6d3a5b8a80a6cb0623bfa2602ebb23c8e40fb36c"),
"version": String("932793"),
"digest": String("E3pFwYpCuiHAjy5P5o91o6y2efgvtZhuRZPAWiP2KP9u"),
},
Object {
"type": String("published"),
"packageId": String("0xe9924e7c05fa3814b537d1a5767f71f83a6ac1caba63212863abb1bf976c0850"),
"version": String("1"),
"digest": String("3ncEjGLWGUKp9RN3MbDZbbpbduNGzu4f9omWCRypiBxQ"),
"modules": Array [
String("nft"),
String("nft_hero"),
String("simple_sbt_nft"),
String("simplenft"),
],
},
]
----- Balance changes ----
Array [
Object {
"owner": Object {
"AddressOwner": String("0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8"),
},
"coinType": String("0x2::sui::SUI"),
"amount": String("-55418280"),
},
]
$ sui client gas
╭────────────────────────────────────────────────────────────────────┬────────────╮
│ gasCoinId │ gasBalance │
├────────────────────────────────────────────────────────────────────┼────────────┤
│ 0x70b96720fadb6aa45620ab84efd9139e4674057207c93e4375350ec695865fab │ 991656120 │
╰────────────────────────────────────────────────────────────────────┴────────────╯
$ sui client call --package 0xe9924e7c05fa3814b537d1a5767f71f83a6ac1caba63212863abb1bf976c0850 --module simplenft --function mint --args "0x685c8d9315d6ae99cfb494fce3b059fd13277c280f5f0833c3f2b0236c6af3ae" --gas-budget 5000000
----- Transaction Digest ----
61QdZYzUD7PjobewiLa6cfhSwkK23HdGvrjm4M9M8mYG
----- Transaction Data ----
Transaction Signature: [Signature(Ed25519SuiSignature(Ed25519SuiSignature([0, 187, 76, 160, 23, 139, 27, 232, 38, 26, 169, 71, 87, 185, 217, 12, 153, 130, 249, 48, 174, 187, 46, 48, 205, 0, 38, 188, 164, 24, 101, 19, 63, 91, 153, 14, 140, 206, 157, 190, 184, 202, 26, 224, 45, 25, 232, 240, 248, 76, 56, 163, 4, 201, 172, 48, 5, 1, 73, 89, 81, 115, 95, 8, 4, 10, 114, 213, 219, 204, 52, 207, 244, 13, 153, 120, 74, 160, 105, 143, 215, 148, 31, 191, 38, 109, 189, 36, 37, 133, 219, 150, 189, 73, 195, 80, 167])))]
Transaction Kind : Programmable
Inputs: [Object(SharedObject { object_id: 0x685c8d9315d6ae99cfb494fce3b059fd13277c280f5f0833c3f2b0236c6af3ae, initial_shared_version: SequenceNumber(932793), mutable: true })]
Commands: [
MoveCall(0xe9924e7c05fa3814b537d1a5767f71f83a6ac1caba63212863abb1bf976c0850::simplenft::mint(Input(0))),
]
Sender: 0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8
Gas Payment: Object ID: 0x241d78606cb3b7d2f880854c49781e7c537d318a52c499faef24e101455adf9a, version: 0x11e50c, digest: FAvCBUwfw58TsRB3JFJ7eMyK6vPu57JBywNG5bfQy1Eb
Gas Owner: 0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8
Gas Price: 1000
Gas Budget: 5000000
----- Transaction Effects ----
Status : Success
Created Objects:
- ID: 0x8df2610fff4eca4b73e53655683b13bc4e837a12063fe31c52bdaf8dd2b17dae , Owner: Account Address ( 0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8 )
Mutated Objects:
- ID: 0x241d78606cb3b7d2f880854c49781e7c537d318a52c499faef24e101455adf9a , Owner: Account Address ( 0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8 )
- ID: 0x685c8d9315d6ae99cfb494fce3b059fd13277c280f5f0833c3f2b0236c6af3ae , Owner: Shared
----- Events ----
Array []
----- Object changes ----
Array [
Object {
"type": String("mutated"),
"sender": String("0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8"),
"owner": Object {
"AddressOwner": String("0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8"),
},
"objectType": String("0x2::coin::Coin<0x2::sui::SUI>"),
"objectId": String("0x241d78606cb3b7d2f880854c49781e7c537d318a52c499faef24e101455adf9a"),
"version": String("1172749"),
"previousVersion": String("1172748"),
"digest": String("77zqVzwoXwME4NBck1vjVyVH8Pa6cC3XrQkGVj76hRtY"),
},
Object {
"type": String("mutated"),
"sender": String("0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8"),
"owner": Object {
"Shared": Object {
"initial_shared_version": Number(932793),
},
},
"objectType": String("0xe9924e7c05fa3814b537d1a5767f71f83a6ac1caba63212863abb1bf976c0850::simplenft::State"),
"objectId": String("0x685c8d9315d6ae99cfb494fce3b059fd13277c280f5f0833c3f2b0236c6af3ae"),
"version": String("1172749"),
"previousVersion": String("932793"),
"digest": String("9k66r1KEPsAHFabJbRdByiitjrLthXPN9zEEMmqUzKiu"),
},
Object {
"type": String("created"),
"sender": String("0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8"),
"owner": Object {
"AddressOwner": String("0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8"),
},
"objectType": String("0xe9924e7c05fa3814b537d1a5767f71f83a6ac1caba63212863abb1bf976c0850::simplenft::SimpleNFT"),
"objectId": String("0x8df2610fff4eca4b73e53655683b13bc4e837a12063fe31c52bdaf8dd2b17dae"),
"version": String("1172749"),
"digest": String("5iBBdeFxfj43YvcjzbupTwgrR9swSh38bzSGyV6SmCyi"),
},
]
----- Balance changes ----
Array [
Object {
"owner": Object {
"AddressOwner": String("0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8"),
},
"coinType": String("0x2::sui::SUI"),
"amount": String("-2414284"),
},
]
$ sui client call --package 0xe9924e7c05fa3814b537d1a5767f71f83a6ac1caba63212863abb1bf976c0850 --module simple_sbt_nft --function mint --args "0xd56e1635f4c24759b84d71bc6d3a5b8a80a6cb0623bfa2602ebb23c8e40fb36c" --gas-budget 5000000
----- Transaction Digest ----
9X9kSdx9SN5a2tUD9S8nH5skwk2RUMUYPTEJ7xX9AjF5
----- Transaction Data ----
Transaction Signature: [Signature(Ed25519SuiSignature(Ed25519SuiSignature([0, 193, 233, 164, 206, 75, 67, 58, 194, 14, 56, 102, 55, 170, 86, 36, 9, 203, 144, 124, 33, 107, 2, 104, 232, 89, 105, 250, 80, 60, 241, 41, 194, 116, 176, 244, 175, 101, 209, 96, 2, 228, 110, 152, 128, 66, 37, 46, 69, 220, 70, 16, 212, 57, 106, 224, 166, 220, 98, 113, 66, 127, 225, 46, 13, 10, 114, 213, 219, 204, 52, 207, 244, 13, 153, 120, 74, 160, 105, 143, 215, 148, 31, 191, 38, 109, 189, 36, 37, 133, 219, 150, 189, 73, 195, 80, 167])))]
Transaction Kind : Programmable
Inputs: [Object(SharedObject { object_id: 0xd56e1635f4c24759b84d71bc6d3a5b8a80a6cb0623bfa2602ebb23c8e40fb36c, initial_shared_version: SequenceNumber(932793), mutable: true })]
Commands: [
MoveCall(0xe9924e7c05fa3814b537d1a5767f71f83a6ac1caba63212863abb1bf976c0850::simple_sbt_nft::mint(Input(0))),
]
Sender: 0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8
Gas Payment: Object ID: 0x241d78606cb3b7d2f880854c49781e7c537d318a52c499faef24e101455adf9a, version: 0x11e50e, digest: H1WaQnY69nDvVq3Pi5faB9J8867psaevzr4SJA9CS8MY
Gas Owner: 0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8
Gas Price: 1000
Gas Budget: 5000000
----- Transaction Effects ----
Status : Success
Created Objects:
- ID: 0xf7efc5ffe6eaadd90e939f62b784304f6d3a4a4de39e5f099b3e1512afd2ab3a , Owner: Account Address ( 0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8 )
Mutated Objects:
- ID: 0x241d78606cb3b7d2f880854c49781e7c537d318a52c499faef24e101455adf9a , Owner: Account Address ( 0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8 )
- ID: 0xd56e1635f4c24759b84d71bc6d3a5b8a80a6cb0623bfa2602ebb23c8e40fb36c , Owner: Shared
----- Events ----
Array []
----- Object changes ----
Array [
Object {
"type": String("mutated"),
"sender": String("0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8"),
"owner": Object {
"AddressOwner": String("0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8"),
},
"objectType": String("0x2::coin::Coin<0x2::sui::SUI>"),
"objectId": String("0x241d78606cb3b7d2f880854c49781e7c537d318a52c499faef24e101455adf9a"),
"version": String("1172751"),
"previousVersion": String("1172750"),
"digest": String("7aGQsjwMZnU7XcbKMXYGxzppXQmiENpb136iAmcKtp2r"),
},
Object {
"type": String("mutated"),
"sender": String("0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8"),
"owner": Object {
"Shared": Object {
"initial_shared_version": Number(932793),
},
},
"objectType": String("0xe9924e7c05fa3814b537d1a5767f71f83a6ac1caba63212863abb1bf976c0850::simple_sbt_nft::State"),
"objectId": String("0xd56e1635f4c24759b84d71bc6d3a5b8a80a6cb0623bfa2602ebb23c8e40fb36c"),
"version": String("1172751"),
"previousVersion": String("932793"),
"digest": String("7sbeat2o6suVLEGnNnhuAw4yg733hzW83sP5W2zPEAw6"),
},
Object {
"type": String("created"),
"sender": String("0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8"),
"owner": Object {
"AddressOwner": String("0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8"),
},
"objectType": String("0xe9924e7c05fa3814b537d1a5767f71f83a6ac1caba63212863abb1bf976c0850::simple_sbt_nft::SBTNFT"),
"objectId": String("0xf7efc5ffe6eaadd90e939f62b784304f6d3a4a4de39e5f099b3e1512afd2ab3a"),
"version": String("1172751"),
"digest": String("9djVA93vbNzXPFnhBfEePwEXTLSAwTSwqZiE3toRhvrM"),
},
]
----- Balance changes ----
Array [
Object {
"owner": Object {
"AddressOwner": String("0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8"),
},
"coinType": String("0x2::sui::SUI"),
"amount": String("-2429864"),
},
]
注:
0x6
为clock地址。
$ sui client call --package 0xe9924e7c05fa3814b537d1a5767f71f83a6ac1caba63212863abb1bf976c0850 --module nft_hero --function mint --args "0x9ee7e8e2a94cc6b9bd623ff7c8140ab92f366be43f96b1a89ad0c0010fb18f11" 0x6 --gas-budget 5000000
----- Transaction Digest ----
HAdG78ox3jwE5b12BgQwnYZf7jh8xCqenyG6SniF9zG9
----- Transaction Data ----
Transaction Signature: [Signature(Ed25519SuiSignature(Ed25519SuiSignature([0, 179, 118, 193, 175, 16, 228, 40, 106, 229, 71, 94, 33, 16, 41, 61, 31, 209, 3, 235, 233, 232, 44, 219, 242, 71, 253, 157, 114, 236, 139, 250, 57, 22, 24, 147, 66, 252, 253, 244, 171, 182, 88, 30, 47, 3, 132, 194, 175, 61, 5, 23, 68, 240, 155, 116, 39, 72, 162, 235, 172, 76, 118, 219, 5, 10, 114, 213, 219, 204, 52, 207, 244, 13, 153, 120, 74, 160, 105, 143, 215, 148, 31, 191, 38, 109, 189, 36, 37, 133, 219, 150, 189, 73, 195, 80, 167])))]
Transaction Kind : Programmable
Inputs: [Object(SharedObject { object_id: 0x9ee7e8e2a94cc6b9bd623ff7c8140ab92f366be43f96b1a89ad0c0010fb18f11, initial_shared_version: SequenceNumber(932793), mutable: true }), Object(SharedObject { object_id: 0x0000000000000000000000000000000000000000000000000000000000000006, initial_shared_version: SequenceNumber(1), mutable: false })]
Commands: [
MoveCall(0xe9924e7c05fa3814b537d1a5767f71f83a6ac1caba63212863abb1bf976c0850::nft_hero::mint(Input(0),Input(1))),
]
Sender: 0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8
Gas Payment: Object ID: 0x241d78606cb3b7d2f880854c49781e7c537d318a52c499faef24e101455adf9a, version: 0x11e50f, digest: 7aGQsjwMZnU7XcbKMXYGxzppXQmiENpb136iAmcKtp2r
Gas Owner: 0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8
Gas Price: 1000
Gas Budget: 5000000
----- Transaction Effects ----
Status : Success
Created Objects:
- ID: 0x21f04741491f32fd982306d01904dcd0db459937cb2bc7fe064b946636eb67a1 , Owner: Account Address ( 0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8 )
Mutated Objects:
- ID: 0x241d78606cb3b7d2f880854c49781e7c537d318a52c499faef24e101455adf9a , Owner: Account Address ( 0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8 )
- ID: 0x9ee7e8e2a94cc6b9bd623ff7c8140ab92f366be43f96b1a89ad0c0010fb18f11 , Owner: Shared
----- Events ----
Array []
----- Object changes ----
Array [
Object {
"type": String("mutated"),
"sender": String("0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8"),
"owner": Object {
"AddressOwner": String("0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8"),
},
"objectType": String("0x2::coin::Coin<0x2::sui::SUI>"),
"objectId": String("0x241d78606cb3b7d2f880854c49781e7c537d318a52c499faef24e101455adf9a"),
"version": String("17681228"),
"previousVersion": String("1172751"),
"digest": String("3drcd1CFDHRkFnEDTjpW4MwvfR8nNyCv1aUGghLFZkPU"),
},
Object {
"type": String("mutated"),
"sender": String("0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8"),
"owner": Object {
"Shared": Object {
"initial_shared_version": Number(932793),
},
},
"objectType": String("0xe9924e7c05fa3814b537d1a5767f71f83a6ac1caba63212863abb1bf976c0850::nft_hero::State"),
"objectId": String("0x9ee7e8e2a94cc6b9bd623ff7c8140ab92f366be43f96b1a89ad0c0010fb18f11"),
"version": String("17681228"),
"previousVersion": String("932793"),
"digest": String("Deqjau2xficspw7m7sWHZ3cXYQHmgSUANQodNx9EDMtx"),
},
Object {
"type": String("created"),
"sender": String("0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8"),
"owner": Object {
"AddressOwner": String("0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8"),
},
"objectType": String("0xe9924e7c05fa3814b537d1a5767f71f83a6ac1caba63212863abb1bf976c0850::nft_hero::MyHero"),
"objectId": String("0x21f04741491f32fd982306d01904dcd0db459937cb2bc7fe064b946636eb67a1"),
"version": String("17681228"),
"digest": String("7KPbfmPtx5L7HRYqSbAwi5UshrGUZ11zNT6JLK3exqjA"),
},
]
----- Balance changes ----
Array [
Object {
"owner": Object {
"AddressOwner": String("0x86e3621005f4d8f4cd85b06416d6c22c81e43acd6948cc7dbc3058fdd9bfeea8"),
},
"coinType": String("0x2::sui::SUI"),
"amount": String("-2687808"),
},
]
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!