-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add hexencode/base64encode tasks #7167
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
Conversation
|
I see that you haven't updated any CHANGELOG files. Would it make sense to do so? |
| return Result{Error: errors.Wrap(err, "task inputs")}, runInfo | ||
| } | ||
|
|
||
| if strValue, ok := inputs[0].Value.(string); ok { |
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.
I think this approach is wrong, because it will not support expressions like $(other_task.result).
In other tasks you could find statements like this:
errors.Wrap(ResolveParam(&input, From(VarExpr(t.Input, vars), Input(inputs, 0))), "input"),
Here, VarExpr is handling the case of expressions. However, this requires to know the exact variable type.
At the same time we do not support types like "variant".
I would suggest to limit the supported types to:
- string
- []byte
- uint/int of arbitrary precision
Then you can do a chain of if-else for errors.Wrap(ResolveParam(&input, From(VarExpr(t.Input, vars), Input(inputs, 0))), "input"), trying to match the parameter type, and failing in the last else.
Would this work?
Other approach is to introduce a new param type, like VariantParam and then do what ETHABIEncodeTask2 does in convertToETHABIType function.
3f8652b to
4fb776d
Compare
pinebit
left a comment
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, let's just iterate once on my comments. Thank you!
4fb776d to
7cb286b
Compare
7cb286b to
c18a94c
Compare
c18a94c to
19d9f38
Compare
Adding two new tasks: hexencode and base64encode
Docs in: smartcontractkit/documentation#909