You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+21-33Lines changed: 21 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -84,7 +84,7 @@ batch.add([
84
84
usdc.check({
85
85
functionName: 'balanceOf',
86
86
args: [scaAddress],
87
-
constraints: [{ gte: amount }],
87
+
constraint: { gte: amount },
88
88
}),
89
89
90
90
// Action: transfer 50 USDC to the recipient
@@ -97,7 +97,7 @@ batch.add([
97
97
usdc.check({
98
98
functionName: 'balanceOf',
99
99
args: [recipient],
100
-
constraints: [{ gte: amount }],
100
+
constraint: { gte: amount },
101
101
}),
102
102
]);
103
103
```
@@ -223,51 +223,39 @@ The following constraint operators are available:
223
223
|`{ lteSigned: value }`| signed (`int256`) | The resolved value (as `int256`) must be ≤ `value`|
224
224
|`{ or: [...] }`| — | Passes if **any one** of the listed child constraints passes |
225
225
226
-
Constraints can be combined. All top-level constraints must pass. Children inside `or` must be standard or signed constraints — nested `or` is not supported.
226
+
Each `check` or `runtimeValue` call accepts one `constraint`. To require multiple conditions simultaneously, use multiple separate calls. Children inside `or` must be standard or signed constraints — nested `or` is not supported.
227
227
228
228
#### Constraints on a check call
229
229
230
230
`check` reads a view function and asserts its return value. If the assertion fails, the entire batch reverts before any writes happen.
231
231
232
232
```ts
233
-
// Assert USDC balance is between 10 and 1000 USDC (range check)
234
-
usdc.check({
235
-
functionName: 'balanceOf',
236
-
args: [scaAddress],
237
-
constraints: [
238
-
{ gte: parseUnits('10', 6) },
239
-
{ lte: parseUnits('1000', 6) },
240
-
],
241
-
})
233
+
// Assert USDC balance is between 10 and 1000 USDC (range check — two separate calls)
0 commit comments