Skip to content

Commit

Permalink
small bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
jfschwarz committed Jul 11, 2023
1 parent eb15892 commit 38747b4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zodiac-roles-sdk",
"version": "2.1.7",
"version": "2.1.8",
"license": "LGPL-3.0+",
"main": "build/cjs/sdk/src/index.js",
"module": "build/esm/sdk/src/index.js",
Expand Down
19 changes: 14 additions & 5 deletions packages/sdk/src/presets/authoring/conditions/matches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,12 +359,21 @@ const assertCompatibleParamTypes = (
const expectedType = parameterType(type)
const scopedType = checkScopedType(condition)

if (scopedType !== expectedType) {
const fieldReference = type.name ? `'${type.name}'` : `at index ${index}`
throw new Error(
`Condition for field ${fieldReference} has wrong paramType \`${ParameterType[scopedType]}\` (expected: \`${ParameterType[expectedType]}\`)`
)
if (scopedType === expectedType) return

// allow dynamic type values to be interpreted as calldata or abi encoded
if (
expectedType === ParameterType.Dynamic &&
(scopedType === ParameterType.Calldata ||
scopedType === ParameterType.AbiEncoded)
) {
return
}

const fieldReference = type.name ? `'${type.name}'` : `at index ${index}`
throw new Error(
`Condition for field ${fieldReference} has wrong paramType \`${ParameterType[scopedType]}\` (expected: \`${ParameterType[expectedType]}\`)`
)
})
}

Expand Down

0 comments on commit 38747b4

Please sign in to comment.