Skip to content

Commit

Permalink
[events] Enable event doc and add examples (#4436)
Browse files Browse the repository at this point in the history
* stash

* add more for events

* rlint

* conflicts

* regenerate json
  • Loading branch information
longbowlu authored Sep 7, 2022
1 parent 9064487 commit 84511d6
Show file tree
Hide file tree
Showing 6 changed files with 1,752 additions and 845 deletions.
47 changes: 23 additions & 24 deletions crates/sui-open-rpc/samples/objects.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@
"fields": {
"description": "An NFT created by the Sui Command Line Tool",
"id": {
"id": "0x1e8e405f6fb3e6f7566cfbd2f05a112ce81024a7"
"id": "0x284c8eb915ea58dc9a7a153bcb44ab21d1ff586c"
},
"name": "Example NFT",
"url": "ipfs://bafkreibngqhl3gaa7daob4i2vccziay2jjlp435cf66vhono7nrvww53ty"
}
},
"owner": {
"AddressOwner": "0x226c0b18b03eaebee3db1a2e4613c29eddb216e6"
"AddressOwner": "0x5ebdaf43899d6f0062ba8106efb84ce9feee39c3"
},
"previousTransaction": "2ELWlyt4F1JkZvg83l6G1lZnrwRy9A6XOy/fqidfOHs=",
"previousTransaction": "4c5D8BFO7wQgOvDTn/fMWm+aO4l7YJIjbVTKXbycaa4=",
"storageRebate": 25,
"reference": {
"objectId": "0x1e8e405f6fb3e6f7566cfbd2f05a112ce81024a7",
"objectId": "0x284c8eb915ea58dc9a7a153bcb44ab21d1ff586c",
"version": 1,
"digest": "pgFtd238r5ahpT5DHYFu8+8iqNJxOP6a9rnJIwbScvA="
"digest": "ChSRu1cj9Su4HJXiIiqrLl0E8YWvwdnmCpal+i3iASM="
}
}
},
Expand All @@ -37,19 +37,19 @@
"fields": {
"balance": 100000000,
"id": {
"id": "0x02ed45cab5c1f60e26b77cca50054e12280d624b"
"id": "0x079ac14c4b1752bd8238a257191b27f1ed90e4a6"
}
}
},
"owner": {
"AddressOwner": "0x226c0b18b03eaebee3db1a2e4613c29eddb216e6"
"AddressOwner": "0x5ebdaf43899d6f0062ba8106efb84ce9feee39c3"
},
"previousTransaction": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=",
"storageRebate": 0,
"reference": {
"objectId": "0x02ed45cab5c1f60e26b77cca50054e12280d624b",
"objectId": "0x079ac14c4b1752bd8238a257191b27f1ed90e4a6",
"version": 0,
"digest": "DYGVPcOLk7d0FSbMEsAQUUwx9tQAGDF9qlls2Aix2TQ="
"digest": "KW70DEursbjcXUaYkcdbRHH3Xc7PaQTVd4108QsCA58="
}
}
},
Expand All @@ -59,16 +59,16 @@
"data": {
"dataType": "package",
"disassembled": {
"m1": "// Move bytecode v5\nmodule 33c8739d658297e0aa49d5ed26b1c4be94dd47fd.m1 {\nstruct Forge has store, key {\n\tid: UID,\n\tswords_created: u64\n}\nstruct Sword has store, key {\n\tid: UID,\n\tmagic: u64,\n\tstrength: u64\n}\n\ninit(Arg0: &mut TxContext) {\nB0:\n\t0: CopyLoc[0](Arg0: &mut TxContext)\n\t1: Call[6](new(&mut TxContext): UID)\n\t2: LdU64(0)\n\t3: Pack[0](Forge)\n\t4: StLoc[1](loc0: Forge)\n\t5: MoveLoc[1](loc0: Forge)\n\t6: MoveLoc[0](Arg0: &mut TxContext)\n\t7: FreezeRef\n\t8: Call[7](sender(&TxContext): address)\n\t9: Call[0](transfer<Forge>(Forge, address))\n\t10: Ret\n}\npublic magic(Arg0: &Sword): u64 {\nB0:\n\t0: MoveLoc[0](Arg0: &Sword)\n\t1: ImmBorrowField[0](Sword.magic: u64)\n\t2: ReadRef\n\t3: Ret\n}\npublic strength(Arg0: &Sword): u64 {\nB0:\n\t0: MoveLoc[0](Arg0: &Sword)\n\t1: ImmBorrowField[1](Sword.strength: u64)\n\t2: ReadRef\n\t3: Ret\n}\nentry public sword_create(Arg0: &mut Forge, Arg1: u64, Arg2: u64, Arg3: address, Arg4: &mut TxContext) {\nB0:\n\t0: MoveLoc[4](Arg4: &mut TxContext)\n\t1: Call[6](new(&mut TxContext): UID)\n\t2: MoveLoc[1](Arg1: u64)\n\t3: MoveLoc[2](Arg2: u64)\n\t4: Pack[1](Sword)\n\t5: StLoc[5](loc0: Sword)\n\t6: MoveLoc[5](loc0: Sword)\n\t7: MoveLoc[3](Arg3: address)\n\t8: Call[1](transfer<Sword>(Sword, address))\n\t9: CopyLoc[0](Arg0: &mut Forge)\n\t10: ImmBorrowField[2](Forge.swords_created: u64)\n\t11: ReadRef\n\t12: LdU64(1)\n\t13: Add\n\t14: MoveLoc[0](Arg0: &mut Forge)\n\t15: MutBorrowField[2](Forge.swords_created: u64)\n\t16: WriteRef\n\t17: Ret\n}\nentry public sword_transfer(Arg0: Sword, Arg1: address) {\nB0:\n\t0: MoveLoc[0](Arg0: Sword)\n\t1: MoveLoc[1](Arg1: address)\n\t2: Call[1](transfer<Sword>(Sword, address))\n\t3: Ret\n}\npublic swords_created(Arg0: &Forge): u64 {\nB0:\n\t0: MoveLoc[0](Arg0: &Forge)\n\t1: ImmBorrowField[2](Forge.swords_created: u64)\n\t2: ReadRef\n\t3: Ret\n}\n}"
"m1": "// Move bytecode v5\nmodule 75ac865faeb1ba097a8cc89a5255d44fd2db6830.m1 {\nstruct Forge has store, key {\n\tid: UID,\n\tswords_created: u64\n}\nstruct Sword has store, key {\n\tid: UID,\n\tmagic: u64,\n\tstrength: u64\n}\n\ninit(Arg0: &mut TxContext) {\nB0:\n\t0: CopyLoc[0](Arg0: &mut TxContext)\n\t1: Call[6](new(&mut TxContext): UID)\n\t2: LdU64(0)\n\t3: Pack[0](Forge)\n\t4: StLoc[1](loc0: Forge)\n\t5: MoveLoc[1](loc0: Forge)\n\t6: MoveLoc[0](Arg0: &mut TxContext)\n\t7: FreezeRef\n\t8: Call[7](sender(&TxContext): address)\n\t9: Call[0](transfer<Forge>(Forge, address))\n\t10: Ret\n}\npublic magic(Arg0: &Sword): u64 {\nB0:\n\t0: MoveLoc[0](Arg0: &Sword)\n\t1: ImmBorrowField[0](Sword.magic: u64)\n\t2: ReadRef\n\t3: Ret\n}\npublic strength(Arg0: &Sword): u64 {\nB0:\n\t0: MoveLoc[0](Arg0: &Sword)\n\t1: ImmBorrowField[1](Sword.strength: u64)\n\t2: ReadRef\n\t3: Ret\n}\nentry public sword_create(Arg0: &mut Forge, Arg1: u64, Arg2: u64, Arg3: address, Arg4: &mut TxContext) {\nB0:\n\t0: MoveLoc[4](Arg4: &mut TxContext)\n\t1: Call[6](new(&mut TxContext): UID)\n\t2: MoveLoc[1](Arg1: u64)\n\t3: MoveLoc[2](Arg2: u64)\n\t4: Pack[1](Sword)\n\t5: StLoc[5](loc0: Sword)\n\t6: MoveLoc[5](loc0: Sword)\n\t7: MoveLoc[3](Arg3: address)\n\t8: Call[1](transfer<Sword>(Sword, address))\n\t9: CopyLoc[0](Arg0: &mut Forge)\n\t10: ImmBorrowField[2](Forge.swords_created: u64)\n\t11: ReadRef\n\t12: LdU64(1)\n\t13: Add\n\t14: MoveLoc[0](Arg0: &mut Forge)\n\t15: MutBorrowField[2](Forge.swords_created: u64)\n\t16: WriteRef\n\t17: Ret\n}\nentry public sword_transfer(Arg0: Sword, Arg1: address) {\nB0:\n\t0: MoveLoc[0](Arg0: Sword)\n\t1: MoveLoc[1](Arg1: address)\n\t2: Call[1](transfer<Sword>(Sword, address))\n\t3: Ret\n}\npublic swords_created(Arg0: &Forge): u64 {\nB0:\n\t0: MoveLoc[0](Arg0: &Forge)\n\t1: ImmBorrowField[2](Forge.swords_created: u64)\n\t2: ReadRef\n\t3: Ret\n}\n}"
}
},
"owner": "Immutable",
"previousTransaction": "OpmWAAt95ttoaSlhcim8NEn/2fhOQbaWzljP1ozB2aI=",
"previousTransaction": "NeuC8MV+Zu978T9lCehhAnKCc2fP1Y9ZolvToXhf8GA=",
"storageRebate": 0,
"reference": {
"objectId": "0x33c8739d658297e0aa49d5ed26b1c4be94dd47fd",
"objectId": "0x75ac865faeb1ba097a8cc89a5255d44fd2db6830",
"version": 1,
"digest": "SfTD5O4aBKYVN81rnGoe0NEBp8TazXFVbeitlVMT7Pg="
"digest": "j1sxaTrbjhBuYg1i9pIjWXZnThVWFl+e1QhEKDNfTJU="
}
}
},
Expand All @@ -77,22 +77,21 @@
"details": {
"data": {
"dataType": "moveObject",
"type": "0x7c9b26e2c8ddff67419256af26fe5f1eddcf0fa7::hero::Hero",
"type": "0x6b9fe4dd703941158b3fcd3ec82caf313df0f17f::hero::Hero",
"has_public_transfer": true,
"fields": {
"experience": 0,
"game_id": "0x0b074aadeb6657f11e8da9b14dde1b943479d22f",
"game_id": "0x9dc960669ea6db78a339e948e4a094b76d0f757f",
"hp": 100,
"id": {
"id": "0x5653a665c3b63f686f480fe3dd2c38ea8a15ed7c"
"id": "0x5a2d7ed9d0bdd8587328a0abc9e760cabbdb79fc"
},

"sword": {
"type": "0x7c9b26e2c8ddff67419256af26fe5f1eddcf0fa7::hero::Sword",
"type": "0x6b9fe4dd703941158b3fcd3ec82caf313df0f17f::hero::Sword",
"fields": {
"game_id": "0x0b074aadeb6657f11e8da9b14dde1b943479d22f",
"game_id": "0x9dc960669ea6db78a339e948e4a094b76d0f757f",
"id": {
"id": "0xfe0a8b7af6af8b87a4a942bd4c80de288f4a4a50"
"id": "0x4e015f0cfc03cf028a29fa9ba078c7980d6162a3"
},
"magic": 10,
"strength": 1
Expand All @@ -101,14 +100,14 @@
}
},
"owner": {
"AddressOwner": "0x226c0b18b03eaebee3db1a2e4613c29eddb216e6"
"AddressOwner": "0x5ebdaf43899d6f0062ba8106efb84ce9feee39c3"
},
"previousTransaction": "uPtcs0LiTGhOqSiJFVfWBPaicQGF4a6rBvgHdH3JAbw=",
"previousTransaction": "hqkAt6yhjy0NqUPz/ktsoPzVnEsNnH9PUx4MiLYENpE=",
"storageRebate": 21,
"reference": {
"objectId": "0x5653a665c3b63f686f480fe3dd2c38ea8a15ed7c",
"objectId": "0x5a2d7ed9d0bdd8587328a0abc9e760cabbdb79fc",
"version": 1,
"digest": "OYmwHOxXeJrmzBxlDpxCWRz3V8RD8hQ5vcR9Kzc1yzk="
"digest": "/kSLV/qUW3kKwez4wTHTNCCnZcnrzOe1Llir5wz0JZE="
}
}
}
Expand Down
Loading

0 comments on commit 84511d6

Please sign in to comment.