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

added default value and placeholder #2091

Merged
merged 6 commits into from
Sep 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,10 @@ class CreateKnownPluginProposal extends React.Component<IProps, IState> {
const callValues = [];

for (const field of currentAction.getFields()) {
const callValue = field.callValue(values[field.name]);
let callValue = field.callValue(values[field.name]);
if (!callValue && field.defaultValue){
callValue = field.defaultValue;
}
values[field.name] = callValue;
callValues.push(callValue);
}
Expand Down Expand Up @@ -380,7 +383,7 @@ class CreateKnownPluginProposal extends React.Component<IProps, IState> {
}

if (field.type.includes("bytes")) {
if (!isHexString(value)) {
if (value && !isHexString(value)) {
Copy link
Contributor

@dkent600 dkent600 Sep 2, 2020

Choose a reason for hiding this comment

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

I think it may be wrong to expect this to be a hex string. the data type is bytes. I seem to recall the contract saying it can be any data. Are you sure this cannot in fact be any string value? This is what you are implying in the placeholder text.

Copy link
Contributor

Choose a reason for hiding this comment

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

it is hex string

errors[field.name] = "Must be a hex value";
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/genericPluginRegistry/plugins/NFTManager.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
{
"label": "Data",
"name": "data",
"placeholder": ""
"placeholder": "Arbitrary data to transfer (0x0 means no data)",
"defaultValue": "0x0",
"optional": true
}
],
"abi": {
Expand Down