Skip to content

Commit

Permalink
added default value and placeholder (#2091)
Browse files Browse the repository at this point in the history
* added default value and placeholder

* removed default value

* added dafualt value back

* data field is now optional with default value

* change text in placeholder
  • Loading branch information
roienatan authored and Oren Sokolowsky committed Sep 7, 2020
1 parent 973cd43 commit eb3d39f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
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)) {
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

0 comments on commit eb3d39f

Please sign in to comment.