Skip to content

Commit

Permalink
Update the documentation to let users understand how to pass paramete…
Browse files Browse the repository at this point in the history
…rs of type Option`<Move Type>` via JSON (#20210)

## Description 

Update the documentation to let users understand how to pass parameters
of type Option`<Move Type>` via JSON
- sui-api.mdx
- json-rpc-format.mdx

This is very helpful when users pass parameters using JSON RPC and sui
client call.
  • Loading branch information
Allenxuxu authored Nov 11, 2024
1 parent 83d3570 commit 3bea403
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/content/references/sui-api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ Additionally, Move supports u128 and u256 but JSON doesn't. As a result Sui allo
| Address | 32 byte hex string prefixed with 0x | "0xbc33e6e4818f9f2ef77d020b35c24be738213e64d9e58839ee7b4222029610de" | 0xbc33: string too short bc33e6e4818f9f2ef77d020b35c24be738213e64d9e58839ee7b4222029610de: missing 0x prefix 0xG2B1A39A1514E1D8A7CE45919CFEB4FEE70B4E01: invalid hex char G |
| ObjectID | 32 byte hex string prefixed with 0x | "0x1b879f00b03357c95a908b7fb568712f5be862c5cb0a5894f62d06e9098de6dc" | Similar to above |
| Identifier | Typically used for module and function names. Encoded as one of the following: A String whose first character is a letter and the remaining characters are letters, digits or underscore. A String whose first character is an underscore, and there is at least one further letter, digit or underscore | "function", "\_function", "some_name", "\_\_\_\_some_name", "Another" | "\_": missing trailing underscore, digit or letter, "8name": cannot start with digit, ".function": cannot start with period, " ": cannot be empty space, "func name": cannot have spaces |
| Vector`<Move Type>` | Homogeneous vector of aforementioned types including nested vectors of primitive types (only "flat" vectors of ObjectIDs are allowed) | [1,2,3,4]: simple U8 vector [[3,600],[],[0,7,4]]: nested U32 vector ["0x2B1A39A1514E1D8A7CE45919CFEB4FEE", "0x2B1A39A1514E1D8A7CE45919CFEB4FEF"]: ObjectID vector | [1,2,3,false]: not homogeneous JSON [1,2,null,4]: invalid elements [1,2,"7"]: although Sui allows encoding numbers as strings meaning this array can evaluate to [1,2,7], the array is still ambiguous so it fails the homogeneity check. |
| Vector`<Move Type>` / Option`<Move Type>` | Homogeneous vector of aforementioned types including nested vectors of primitive types (only "flat" vectors of ObjectIDs are allowed) | [1,2,3,4]: simple U8 vector [[3,600],[],[0,7,4]]: nested U32 vector ["0x2B1A39A1514E1D8A7CE45919CFEB4FEE", "0x2B1A39A1514E1D8A7CE45919CFEB4FEF"]: ObjectID vector | [1,2,3,false]: not homogeneous JSON [1,2,null,4]: invalid elements [1,2,"7"]: although Sui allows encoding numbers as strings meaning this array can evaluate to [1,2,7], the array is still ambiguous so it fails the homogeneity check. |
| Vector`<u8>` | For convenience, Sui allows: U8 vectors represented as UTF-8 (and ASCII) strings. | "√®ˆbo72 √∂†∆˚–œ∑π2ie": UTF-8 "abcdE738-2 \_=?": ASCII | |
2 changes: 1 addition & 1 deletion docs/content/references/sui-api/json-rpc-format.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ Additionally, Move supports u128 and u256 but JSON doesn't. As a result Sui allo
| Address | 32 byte hex string prefixed with 0x | "0xbc33e6e4818f9f2ef77d020b35c24be738213e64d9e58839ee7b4222029610de" | 0xbc33: string too short bc33e6e4818f9f2ef77d020b35c24be738213e64d9e58839ee7b4222029610de: missing 0x prefix 0xG2B1A39A1514E1D8A7CE45919CFEB4FEE70B4E01: invalid hex char G |
| ObjectID | 32 byte hex string prefixed with 0x | "0x1b879f00b03357c95a908b7fb568712f5be862c5cb0a5894f62d06e9098de6dc" | Similar to above |
| Identifier | Typically used for module and function names. Encoded as one of the following: A String whose first character is a letter and the remaining characters are letters, digits or underscore. A String whose first character is an underscore, and there is at least one further letter, digit or underscore | "function", "\_function", "some_name", "\_\_\_\_some_name", "Another" | "\_": missing trailing underscore, digit or letter, "8name": cannot start with digit, ".function": cannot start with period, " ": cannot be empty space, "func name": cannot have spaces |
| Vector`<Move Type>` | Homogeneous vector of aforementioned types including nested vectors of primitive types (only "flat" vectors of ObjectIDs are allowed) | [1,2,3,4]: simple U8 vector [[3,600],[],[0,7,4]]: nested U32 vector ["0x2B1A39A1514E1D8A7CE45919CFEB4FEE", "0x2B1A39A1514E1D8A7CE45919CFEB4FEF"]: ObjectID vector | [1,2,3,false]: not homogeneous JSON [1,2,null,4]: invalid elements [1,2,"7"]: although Sui allows encoding numbers as strings meaning this array can evaluate to [1,2,7], the array is still ambiguous so it fails the homogeneity check. |
| Vector`<Move Type>` / Option`<Move Type>` | Homogeneous vector of aforementioned types including nested vectors of primitive types (only "flat" vectors of ObjectIDs are allowed) | [1,2,3,4]: simple U8 vector [[3,600],[],[0,7,4]]: nested U32 vector ["0x2B1A39A1514E1D8A7CE45919CFEB4FEE", "0x2B1A39A1514E1D8A7CE45919CFEB4FEF"]: ObjectID vector | [1,2,3,false]: not homogeneous JSON [1,2,null,4]: invalid elements [1,2,"7"]: although Sui allows encoding numbers as strings meaning this array can evaluate to [1,2,7], the array is still ambiguous so it fails the homogeneity check. |
| Vector`<u8>` | For convenience, Sui allows: U8 vectors represented as UTF-8 (and ASCII) strings. | "√®ˆbo72 √∂†∆˚–œ∑π2ie": UTF-8 "abcdE738-2 \_=?": ASCII | |

0 comments on commit 3bea403

Please sign in to comment.