AmphiLIQUID
CAsoonOpen terminal
Documentation / Integration

EIP-712 and session keys

The typed data a trader signs, and the scoped key that avoids re-signing.

5 min read · pre-launch

Authorisation happens once. The wallet signs a gas-free Session naming a key generated in the browser, its scope, the wallet's revocation epoch and an expiry. From then on the browser key signs each order, so trading raises no wallet prompt. AmphiBook verifies the grant and the order on every fill.

const domain = {
  name: "Amphi Liquid",
  version: "1",
  chainId: 4663,              // Robinhood Chain
  verifyingContract: AMPHI_BOOK,
};

Session: trader address, sessionKey address, scope uint32,
         epoch uint64, issuedAt uint64, expiresAt uint64
         // scope: 1 open | 2 close | 4 cancel | 8 paper
         // 12 h by default; the book refuses more than 7 days

Order:   trader address, pair bytes32, isLong bool, margin uint256,
         leverage uint64, limitIndex uint256, nonce uint64, deadline uint64

ClosePosition: trader address, position bytes32, minIndex uint256,
               maxIndex uint256, nonce uint64, deadline uint64
  • Session keys can open, close and cancel. They cannot withdraw margin, transfer tokens or touch the vault.
  • Bumping the epoch with revokeAll() ends every key the wallet ever granted, in one transaction.
  • Nonces are single-use, not sequential; a refused order does not burn its nonce.
  • The pair is a field of the order: change it and the signature recovers to someone else.
  • Close intents carry a price band and a 10-minute deadline.

On the paper venue the same checks run in your browser before a paper order is accepted: the grant must recover to your wallet, the order to the session key, the nonce must be fresh and the mark inside the limit.