Skip to main content
Note: see the language section for more details.

Allow ABI-specific contract call parameters

For contract interactions, use Smart Contract Interfaces (ABI upload) rather than raw calldata slicing. ABI-based policies use named arguments (eth.tx.contract_call_args['arg_name']) instead of byte offsets — they’re more readable, less error-prone, and won’t silently break if the contract encoding changes. Raw eth.tx.data[...] slicing is a fallback for contracts where no ABI is available. Restrict a transfer call to a maximum amount and a specific recipient:
Restrict by function name or selector (also requires an ABI upload):

Iterating over contract call arguments

When a contract function takes an array parameter, use .count(), .all(), and .any() to enforce conditions across every element, rather than checking a single index. Syntax:
  • Array element count: eth.tx.contract_call_args['arrayArg'].count()
  • All elements match: eth.tx.contract_call_args['arrayArg'].all(item, <condition>)
  • Any element matches: eth.tx.contract_call_args['arrayArg'].any(item, <condition>)
For functions that take a tuple array (e.g. executeBatch((address,uint256,bytes)[] calls)), tuple fields are currently accessed by position rather than name: call[0] (first field), call[1] (second field), and so on. The positions correspond to the order of fields as defined in your ABI — substitute the correct indices for your own struct. Named access such as call['target'] is not yet supported and produces OUTCOME_ERROR.
Enforce exact batch size Restrict signing to transactions containing exactly two calls:
Whitelist all call targets in a batch Allow signing only when every call targets a specific contract and sends zero ETH. call[0] is the target address and call[1] is the value, based on the field order in the executeBatch ABI:
Combine batch size and target restrictions
Whitelist recipients in a flat address array For functions that take a plain address[] parameter — such as a disperse-style multi-send contract — use in to restrict signing to a known set of addresses:
See Smart Contract Interfaces for the full upload walkthrough and Solana IDL support.

Allow ERC-20 transfers for a specific token smart contract (raw calldata fallback)

Use this pattern only when an ABI is unavailable. The selector 0xa9059cbb is the 4-byte keccak256 hash of transfer(address,uint256).

Allow anyone to sign transactions for testnet (Sepolia)

Allow ETH transactions with a specific nonce range

Allow signing of EIP-712 payloads for Hyperliquid ApproveAgent operations

Inspect nested fields in EIP-712 message payloads

The eth.eip_712.message map supports nested field access using bracket notation and array iteration operators, allowing policies to inspect and enforce conditions across typed data contents, beyond just the domain and primary type. Syntax:
  • Nested struct fields: eth.eip_712.message['outerField']['innerField']
  • Array element fields: eth.eip_712.message['arrayField'][0]['innerField']
  • Array iteration: eth.eip_712.message['arrayField'].all(item, <condition>)
  • Array length: eth.eip_712.message['arrayField'].count()
Example: Restrict Hyperliquid orders to a specific asset Hyperliquid’s HyperliquidTransaction:Order message contains an orders array of Order structs. Each Order uses short field names: a (asset index), b (isBuy), p (price), s (size), r (reduceOnly).
To allow only orders for a specific asset (e.g. ETH = asset index 3):
Array elements can be accessed by index ([0], [1], etc.). The condition message['orders'][0]['a'] == '3' only checks the first order — any additional orders in the array are not evaluated. Checking multiple positions explicitly (message[‘orders’][0][‘a’] == 3 && message[‘orders’][1][‘a’] == 3) works, but is fragile — adding a third order bypasses the check entirely. Use .all() to enforce a condition across every element regardless of array size.

Iterating over array fields

Enforce batch size with .count():
Whitelist a specific asset across all orders with .all():
Whitelist multiple assets with .all():
Combine size limit and asset whitelist:
Require at least one reduce-only order with .any():

Deny signing of NO_OP keccak256 payloads

Allow signing of EIP-712 payloads for EIP-3009 transfers

Allow signing of EIP-712 payloads for EIP-2612 permits for USD Coin

Allow signing of EIP-7702 authorizations