-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
feat: accept Uint8Array
s as inputs for Vec
s, add docs for bytecode inputs
#2018
Conversation
Uint8Array
s as inputs for Vec
s, add docs for bytecode inputs
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.
Hmm IMO a Vec<u8>
representing a byte array should actually be taking Bytes
as the input? Which would then be picked up by the ByteCoder
which accepts UInt8Array
. Is this a sway built in function which accepts Vec<u8>
when expecting bytes?
Co-authored-by: Peter Smith <[email protected]>
@danielbate yes that is the case. All the functions in this Sway library (which is officially maintained and supported by us) accept bytecode as |
apps/docs-snippets/test/fixtures/forc-projects/bytecode-input/.gitignore
Outdated
Show resolved
Hide resolved
Co-authored-by: Daniel Bate <[email protected]>
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.
LGTM! One small nit.
Co-authored-by: Peter Smith <[email protected]>
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.
Still looks great 😆
…s/fuels-ts into dp/bytecode-input-helper
This PR is published in NPM with version 0.0.0-pr-2018-20240410113607 |
Coverage Report:
Changed Files:
|
Summary
Before this PR, the
VecCoder
wasn't accepting input arrays of typeUint8Array
. In some cases, like thecompute_bytecode_root
function from the bytecode Sway Lib, you need to pass in aUint8Array
to the Sway function.I have tweaked the validation inside the
VecCoder
for the inputs, and also added some documentation around how to pass in bytecode to Sway functions.You can pass in bytecode to any Sway function like so now:
Closes #1950
This PR will unblock the Fuelnaut project, too.