Skip to content

Commit

Permalink
[move] Using new UTF8 strings instead of ASCII strings (aptos-labs#2088)
Browse files Browse the repository at this point in the history
The Move library has a new type for utf8 strings, which we much prefer over the ascii strings. The utf8 strings will be eventually also
supported by the compiler, s.t. someone can directly write `foo("abc")` in Move (instead of `foo(ascii::string(b"abc"))`). This switches
us over to the new string type.

Also fixing some missed file renamings.

Co-authored-by: Wolfgang Grieskamp <[email protected]>
  • Loading branch information
wrwg and Wolfgang Grieskamp authored Jul 20, 2022
1 parent cd7744f commit b189a79
Show file tree
Hide file tree
Showing 46 changed files with 419 additions and 687 deletions.
2 changes: 1 addition & 1 deletion api/doc/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1657,7 +1657,7 @@ components:
**Special serialization for Move stdlib types:**
* [0x1::ascii::String](https://github.com/aptos-labs/aptos-core/blob/main/language/move-stdlib/docs/ascii.md) is serialized into `string`. For example, struct value `0x1::ascii::String{bytes: b"hello world"}` is serialized as `"hello world"` in JSON.
* [0x1::string::String](https://github.com/aptos-labs/aptos-core/blob/main/language/move-stdlib/docs/ascii.md) is serialized into `string`. For example, struct value `0x1::string::String{bytes: b"hello world"}` is serialized as `"hello world"` in JSON.
example: "3344000000"
Event:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@
],
"params": [],
"return": [
"0x1::ascii::String"
"0x1::string::String"
]
},
{
Expand Down Expand Up @@ -409,7 +409,7 @@
"fields": [
{
"name": "name",
"type": "0x1::ascii::String"
"type": "0x1::string::String"
},
{
"name": "scaling_factor",
Expand Down Expand Up @@ -814,7 +814,7 @@
"visibility": "public",
"generic_type_params": [],
"params": [
"&0x1::ascii::String"
"&0x1::string::String"
],
"return": [
"bool"
Expand All @@ -825,7 +825,7 @@
"visibility": "public",
"generic_type_params": [],
"params": [
"&0x1::ascii::String"
"&0x1::string::String"
],
"return": [
"&vector<u8>"
Expand All @@ -836,7 +836,7 @@
"visibility": "public",
"generic_type_params": [],
"params": [
"0x1::ascii::Char"
"0x1::string::Char"
],
"return": [
"u8"
Expand All @@ -850,15 +850,15 @@
"u8"
],
"return": [
"0x1::ascii::Char"
"0x1::string::Char"
]
},
{
"name": "into_bytes",
"visibility": "public",
"generic_type_params": [],
"params": [
"0x1::ascii::String"
"0x1::string::String"
],
"return": [
"vector<u8>"
Expand Down Expand Up @@ -891,7 +891,7 @@
"visibility": "public",
"generic_type_params": [],
"params": [
"&0x1::ascii::String"
"&0x1::string::String"
],
"return": [
"u64"
Expand All @@ -902,19 +902,19 @@
"visibility": "public",
"generic_type_params": [],
"params": [
"&mut 0x1::ascii::String"
"&mut 0x1::string::String"
],
"return": [
"0x1::ascii::Char"
"0x1::string::Char"
]
},
{
"name": "push_char",
"visibility": "public",
"generic_type_params": [],
"params": [
"&mut 0x1::ascii::String",
"0x1::ascii::Char"
"&mut 0x1::string::String",
"0x1::string::Char"
],
"return": []
},
Expand All @@ -926,7 +926,7 @@
"vector<u8>"
],
"return": [
"0x1::ascii::String"
"0x1::string::String"
]
},
{
Expand All @@ -937,7 +937,7 @@
"vector<u8>"
],
"return": [
"0x1::Option::Option<0x1::ascii::String>"
"0x1::Option::Option<0x1::string::String>"
]
}
],
Expand Down Expand Up @@ -1836,9 +1836,9 @@
"generic_type_params": [],
"params": [
"&signer",
"0x1::ascii::String",
"0x1::ascii::String",
"0x1::ascii::String",
"0x1::string::String",
"0x1::string::String",
"0x1::string::String",
"0x1::Option::Option<u64>"
],
"return": []
Expand Down Expand Up @@ -1878,13 +1878,13 @@
"generic_type_params": [],
"params": [
"&signer",
"0x1::ascii::String",
"0x1::ascii::String",
"0x1::ascii::String",
"0x1::string::String",
"0x1::string::String",
"0x1::string::String",
"bool",
"u64",
"0x1::Option::Option<u64>",
"0x1::ascii::String"
"0x1::string::String"
],
"return": [
"0x1::token::TokenId"
Expand All @@ -1896,8 +1896,8 @@
"generic_type_params": [],
"params": [
"address",
"0x1::ascii::String",
"0x1::ascii::String"
"0x1::string::String",
"0x1::string::String"
],
"return": [
"0x1::token::TokenId"
Expand Down Expand Up @@ -2136,15 +2136,15 @@
"fields": [
{
"name": "description",
"type": "0x1::ascii::String"
"type": "0x1::string::String"
},
{
"name": "name",
"type": "0x1::ascii::String"
"type": "0x1::string::String"
},
{
"name": "uri",
"type": "0x1::ascii::String"
"type": "0x1::string::String"
},
{
"name": "count",
Expand All @@ -2166,7 +2166,7 @@
"fields": [
{
"name": "collections",
"type": "0x1::Table::Table<0x1::ascii::String, 0x1::token::Collection>"
"type": "0x1::Table::Table<0x1::string::String, 0x1::token::Collection>"
},
{
"name": "token_data",
Expand Down Expand Up @@ -2245,15 +2245,15 @@
"fields": [
{
"name": "collection",
"type": "0x1::ascii::String"
"type": "0x1::string::String"
},
{
"name": "description",
"type": "0x1::ascii::String"
"type": "0x1::string::String"
},
{
"name": "name",
"type": "0x1::ascii::String"
"type": "0x1::string::String"
},
{
"name": "maximum",
Expand All @@ -2265,7 +2265,7 @@
},
{
"name": "uri",
"type": "0x1::ascii::String"
"type": "0x1::string::String"
}
]
},
Expand All @@ -2285,11 +2285,11 @@
},
{
"name": "collection",
"type": "0x1::ascii::String"
"type": "0x1::string::String"
},
{
"name": "name",
"type": "0x1::ascii::String"
"type": "0x1::string::String"
}
]
},
Expand Down
Loading

0 comments on commit b189a79

Please sign in to comment.