Write a mandate

A mandate is an EIP-712 typed structure signed by the owner. Its identifier is the digest, which binds the chain id and this registry: a signature from another chain or another deployment recovers to a different address and is refused.

const domain = {
      name: "AMW Mandate", version: "1",
      chainId, verifyingContract: mandateRegistry,
    };

    const mandate = {
      owner, agent,
      parent: "0x00…00",        // bytes32 — a parent mandate, or zero
      tokenIn, tokenOut,
      maxPerAction:      250_000_000000n,   // clause 2.1
      maxAggregate:    2_000_000_000000n,   // clause 3.4
      maxActions:                    12,    // clause 3.5
      maxOffPrimaryBps:            2500,    // clause 3.7
      windowSeconds:               3600,    // the epoch
      expiry, nonce,
    };

    const sig  = await owner.signTypedData({ domain, types, primaryType: "Mandate", message: mandate });
    const hash = await registry.read.hashMandate([mandate]);
    await registry.write.register([mandate, sig]);   // anyone may submit it

register takes the owner's signature, so a relayer can pay for it without holding any authority — a payload it altered would recover to a different address. The same pattern covers venue classification (setClassFor), naming an authoriser (setAuthoriserFor) and resolving a hold (resolveWithSig).

Delegation

A child mandate names its parent. Every action debits the window of every ancestor in the chain — without that, delegation is the bypass — and a child may only narrow its parent's bounds.