Skip to content

Commit

Permalink
check types/values length
Browse files Browse the repository at this point in the history
  • Loading branch information
fadeev committed Oct 3, 2024
1 parent 5814704 commit 231e856
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions examples/hello/tasks/callFromEVM.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => {

const types = JSON.parse(args.types);

if (types.length !== args.values.length) {
throw new Error(
`The number of types (${types.length}) does not match the number of values (${args.values.length}).`
);
}

const valuesArray = args.values.map((value: any, index: number) => {
const type = types[index];

Expand Down
6 changes: 6 additions & 0 deletions examples/hello/tasks/callFromZetachain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => {

const types = JSON.parse(args.types);

if (types.length !== args.values.length) {
throw new Error(
`The number of types (${types.length}) does not match the number of values (${args.values.length}).`
);
}

const valuesArray = args.values.map((value: any, index: number) => {
const type = types[index];

Expand Down

0 comments on commit 231e856

Please sign in to comment.