feat(evm): EIP-2612 permit signing helper (Node SDK + Rust CLI)#187
feat(evm): EIP-2612 permit signing helper (Node SDK + Rust CLI)#187teyrebaz33 wants to merge 1 commit intoopen-wallet-standard:mainfrom
Conversation
Adds signPermit() to the Node SDK and `ows sign permit` to the CLI. Closes open-wallet-standard#132 Node SDK (bindings/node/src/evm/permit.mjs): - signPermit(ownerAddress, chainId, params, signTypedData) function - Auto-fetches permit nonce from chain when not supplied - Domain resolution: eip712Domain() (EIP-5267) → well-known override table (USDC v2, DAI v1) → name() + version fallback - Handles tokens that omit version from their EIP712Domain - No new runtime dependencies (raw fetch + minimal ABI decode) Rust CLI (ows sign permit): - New sign_permit() in ows-lib with synchronous ureq HTTP calls - PermitParams and PermitSignResult types in ows-lib - ows sign permit --wallet --chain --token --spender --value --deadline [--nonce] [--rpc-url] [--json] [--index] - Follows existing sign_message / sign_transaction command patterns Tests (bindings/node/__test__/permit.spec.mjs): - 12 offline tests, all passing - Covers: v/r/s splitting, typed data structure, eip712Domain() path, fallback path, nonce auto-fetch, nonce skip, version omission, chainId, error cases, known token versions Docs (docs/examples/eip2612-permit.md): - SDK and CLI usage examples - Domain resolution strategy explained - Supported chains and tokens table
|
@teyrebaz33 is attempting to deploy a commit to the MoonPay Team on Vercel. A member of the Team first needs to authorize it. |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|
Summary
Adds a purpose-built
signPermithelper that eliminates the boilerplate currently required to sign EIP-2612 permits via OWS. Closes #132What's included
Node SDK —
signPermit()CLI —
ows sign permitDomain resolution
The hard part of EIP-2612 is getting the domain separator right.
signPermitresolves it in three stages:eip712Domain()(EIP-5267) — self-describing; works for USDC v2.2+, OZ ERC20Permit 5.x"2"), DAI ("1"), Base USDTname()+ default version"1"— generic fallbackTokens that omit
versionfrom their domain are handled correctly — theEIP712Domaintype array is built dynamically.Tests
Files changed
bindings/node/src/evm/permit.mjsbindings/node/__test__/permit.spec.mjsdocs/examples/eip2612-permit.mdows/crates/ows-lib/src/ops.rssign_permit()Rust implementationows/crates/ows-lib/src/types.rsPermitParams,PermitSignResulttypesows/crates/ows-lib/Cargo.tomlureqfor sync HTTPows/crates/ows-cli/src/commands/sign_permit.rsows/crates/ows-cli/src/commands/mod.rsows/crates/ows-cli/src/main.rsPermitsubcommand + handlerChecklist
signPermit()ows sign permit