Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Docs] - add 0x prefix and change SuiAddress and ObjectID to lowercase #1867

Merged
merged 3 commits into from
May 10, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions doc/src/build/json-rpc.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ The output you see should resemble the following (abbreviated to show only two o
"objects" : [
{
"digest" : "zpa45U9ANfA9A6iS01NvAoVH0RbYB6a5rjhgh2Hb/GE=",
"objectId" : "17b348903b0cfb75fc9ab5426bb69d83d1e756a5",
"objectId" : "0x17b348903b0cfb75fc9ab5426bb69d83d1e756a5",
"version" : 1
},
{
"digest" : "8SPi0h6xVMVNBvGzzF4RfuOoaXISdtiB5aT7+BYDbxg=",
"objectId" : "7599d8ea1de4c9616d077f16ca0eb38cdecacc07",
"objectId" : "0x7599d8ea1de4c9616d077f16ca0eb38cdecacc07",
"version" : 1
},
...
Expand Down Expand Up @@ -153,7 +153,7 @@ The signing tool will create and print out the signature and public key informat
You will see output resembling:
```shell
2022-04-25T18:50:06.031722Z INFO sui::sui_commands: Data to sign : VHJhbnNhY3Rpb25EYXRhOjoAAFHe8jecgzoGWyGlZ1sJ2KBFN8aZF7NIkDsM+3X8mrVCa7adg9HnVqUBAAAAAAAAACDOlrjlT0A18D0DqJLTU28ChUfRFtgHprmuOGCHYdv8YVHe8jecgzoGWyGlZ1sJ2KBFN8aZdZnY6h3kyWFtB38Wyg6zjN7KzAcBAAAAAAAAACDxI+LSHrFUxU0G8bPMXhF+46hpchJ22IHlpPv4FgNvGOgDAAAAAAAA
2022-04-25T18:50:06.031765Z INFO sui::sui_commands: Address : 51DEF2379C833A065B21A5675B09D8A04537C699
2022-04-25T18:50:06.031765Z INFO sui::sui_commands: Address : 0x51DEF2379C833A065B21A5675B09D8A04537C699
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the letters be lower case here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch! it should be lowercase

2022-04-25T18:50:06.031911Z INFO sui::sui_commands: Public Key Base64: H82FDLUZN1u0+6UdZilxu9HDT5rPd3khKo2UJoCPJFo=
2022-04-25T18:50:06.031925Z INFO sui::sui_commands: Signature : 6vc+ku0RsMKdky8DRfoy/hw6eCQ3YsadH6rZ9WUCwGTAumuWER3TOJRw7u7F4QaHkqUsIPfJN9GRraSX+N8ADQ==
```
Expand Down Expand Up @@ -201,11 +201,11 @@ curl --location --request POST $SUI_RPC_HOST \
"method": "sui_moveCall",
"params": [
"{{owner_address}}",
"0000000000000000000000000000000000000002",
"0x2",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we allow short form everywhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I have done some test manually and a unit test here

#[test]
fn test_object_id_zero_padding() {
let hex = "0x2";
let long_hex = "0x0000000000000000000000000000000000000002";
let long_hex_alt = "0000000000000000000000000000000000000002";
let obj_id_1 = ObjectID::from_hex_literal(hex).unwrap();
let obj_id_2 = ObjectID::from_hex_literal(long_hex).unwrap();
let obj_id_3 = ObjectID::from_hex(long_hex_alt).unwrap();
let obj_id_4: ObjectID = serde_json::from_str(&format!("\"{}\"", hex)).unwrap();
let obj_id_5: ObjectID = serde_json::from_str(&format!("\"{}\"", long_hex)).unwrap();
let obj_id_6: ObjectID = serde_json::from_str(&format!("\"{}\"", long_hex_alt)).unwrap();
assert_eq!(SUI_FRAMEWORK_ADDRESS, obj_id_1.0);
assert_eq!(SUI_FRAMEWORK_ADDRESS, obj_id_2.0);
assert_eq!(SUI_FRAMEWORK_ADDRESS, obj_id_3.0);
assert_eq!(SUI_FRAMEWORK_ADDRESS, obj_id_4.0);
assert_eq!(SUI_FRAMEWORK_ADDRESS, obj_id_5.0);
assert_eq!(SUI_FRAMEWORK_ADDRESS, obj_id_6.0);
}

Should be allowed everywhere

"Coin",
"transfer_",
["0x2::SUI::SUI"],
["0x{{coin_object_id}}",10000, "0x{{recipient_address}}"],
["{{coin_object_id}}",10000, "{{recipient_address}}"],
"{{gas_object_id}}",
2000
],
Expand Down Expand Up @@ -294,7 +294,7 @@ Below you can see a truncated sample output of [sui_publish](#sui_publish). One
```
{
"package": [
"13e3ec7279060663e1bbc45aaf5859113fc164d2",
"0x13e3ec7279060663e1bbc45aaf5859113fc164d2",
...
}
```
Expand Down
12 changes: 6 additions & 6 deletions doc/src/build/programming-with-objects/ch1-object-basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,11 @@ $ wallet publish --path $ROOT/sui_programmability/examples/objects_tutorial --ga
You can find the published package object ID in the **Publish Results** output:
```
----- Publish Results ----
The newly published package object: (57258F32746FD1443F2A077C0C6EC03282087C19, SequenceNumber(1), o#b3a8e284dea7482891768e166e4cd16f9749e0fa90eeb0834189016c42327401)
The newly published package object: (0x57258f32746fd1443f2a077c0c6ec03282087c19, SequenceNumber(1), o#b3a8e284dea7482891768e166e4cd16f9749e0fa90eeb0834189016c42327401)
```
Note that the exact data you see will be different. The first hex string in that triple is the package object ID (`57258F32746FD1443F2A077C0C6EC03282087C19` in this case). For convenience, let's save it to an environment variable:
Note that the exact data you see will be different. The first hex string in that triple is the package object ID (`0x57258f32746fd1443f2a077c0c6ec03282087c19` in this case). For convenience, let's save it to an environment variable:
```
$ export PACKAGE=57258F32746FD1443F2A077C0C6EC03282087C19
$ export PACKAGE=0x57258f32746fd1443f2a077c0c6ec03282087c19
```
Next we can call the function to create a color object:
```
Expand All @@ -173,11 +173,11 @@ In the **Transaction Effects** portion of the output, you will see an object sho

```
Created Objects:
5EB2C3E55693282FAA7F5B07CE1C4803E6FDC1BB SequenceNumber(1) o#691b417670979c6c192bdfd643630a125961c71c841a6c7d973cf9429c792efa
0x5eb2c3e55693282faa7f5b07ce1c4803e6fdc1bb SequenceNumber(1) o#691b417670979c6c192bdfd643630a125961c71c841a6c7d973cf9429c792efa
```
Again, for convenience, let's save the object ID:
```
$ export OBJECT=5EB2C3E55693282FAA7F5B07CE1C4803E6FDC1BB
$ export OBJECT=0x5eb2c3e55693282faa7f5b07ce1c4803e6fdc1bb
```
We can inspect this object and see what kind of object it is:
```
Expand All @@ -187,7 +187,7 @@ This will show you the metadata of the object with its type:
```
Owner: AddressOwner(k#5db53ebb05fd3ea5f1d163d9d487ee8cd7b591ee)
Version: 1
ID: 5EB2C3E55693282FAA7F5B07CE1C4803E6FDC1BB
ID: 0x5eb2c3e55693282faa7f5b07ce1c4803e6fdc1bb
Readonly: false
Type: 0x57258f32746fd1443f2a077c0c6ec03282087c19::ColorObject
```
Expand Down
4 changes: 2 additions & 2 deletions doc/src/build/programming-with-objects/ch2-using-objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,9 @@ Now we can try to transfer it to another account address. First let's see what o
```
$ wallet addresses
```
Since the default current address is the first address, let's pick the second address in the list as the recipient. In my case, I have `1416F3D5AF469905B0580B9AF843EC82D02EFD30`. Let's save it for convenience:
Since the default current address is the first address, let's pick the second address in the list as the recipient. In my case, I have `0x1416f3d5af469905b0580b9af843ec82d02efd30`. Let's save it for convenience:
```
$ export RECIPIENT=1416F3D5AF469905B0580B9AF843EC82D02EFD30
$ export RECIPIENT=0x1416f3d5af469905b0580b9af843ec82d02efd30
```
Now let's transfer the object to this address:
```
Expand Down
Loading