-
Notifications
You must be signed in to change notification settings - Fork 94
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
[moveos_std] Handle object id and decimal value for json #3369
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.OpenSSF Scorecard
Scanned Files |
let decimal_value = decimal_value::new(1000000, 6); | ||
let decimal_value_json = to_json(&decimal_value); | ||
|
||
let from_decimal_value = from_json<DecimalValue>(decimal_value_json); | ||
assert!(decimal_value == from_decimal_value, 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
decimal_value to_json 后是 json 的 float 类型吗?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
意思是直接to_json 后直接表达成 float 类型,例如 3.14156 这样?现在是 struct 的表达结构
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DecimalValue 就是为了能表达 float 类型。如果是 struct 结构就没必要专门处理了。
public fun new_object_id_for_test(path: vector<address>): ObjectID { | ||
ObjectID { path } | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
可以多一个,很多测试用例中需要生成 ObjectID
#[test_only]
public fun derive_object_id_for_test():ObjectID{
}
Summary