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

chore: replace manual value extraction #1079

Merged
merged 2 commits into from Aug 23, 2023
Merged

chore: replace manual value extraction #1079

merged 2 commits into from Aug 23, 2023

Conversation

ghost
Copy link

@ghost ghost commented Aug 23, 2023

The TODO can be removed as the API discussed here was implemented and in a separate PR the json API for Value was used.

Before:

// TODO: replace the following manual value extraction when workspaces
// resolves https://github.com/near/workspaces-rs/issues/201
match res.receipt_outcomes()[5].clone().into_result()? {
ValueOrReceiptId::Value(val) => {
let bytes = base64::decode(&val)?;
let used_amount = serde_json::from_slice::<U128>(&bytes)?;
assert_eq!(used_amount, transfer_amount);
}
_ => panic!("Unexpected receipt id"),
}

After:
// TODO: replace the following manual value extraction when workspaces
// resolves https://github.com/near/workspaces-rs/issues/201
match res.receipt_outcomes()[5].clone().into_result()? {
ValueOrReceiptId::Value(val) => {
let used_amount = val.json::<U128>()?;
assert_eq!(used_amount, transfer_amount);
}
_ => panic!("Unexpected receipt id"),
}

@ghost ghost requested review from frol, agostbiro and uint as code owners August 23, 2023 09:27
Copy link
Contributor

@uint uint left a comment

Choose a reason for hiding this comment

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

Good catch!

@uint uint enabled auto-merge (squash) August 23, 2023 12:13
@uint uint merged commit 7f71f05 into near:master Aug 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant