feat(jpyc): EIP-3009 transferWithAuthorization core lib (Phase 1 increment 1)#30
Merged
Conversation
…ement 1)
JPYC ガスレスを EIP-3009 + relayer で実現する計画 (memory:jpyc-eip3009) の純ロジック基盤。
client (署名) と server (relay endpoint) が共有する外部依存なしの純関数群で、unit test で完全に
担保 (OOM で動かない form render とは独立に検証可能)。まだどこにも配線していない inert な追加。
- jpycEip712Domain / buildTransferWithAuthorizationTypedData: 署名用 EIP-712 (domain は
JPYC_V3_ASSET と単一情報源で {name:"JPY Coin", version:"1"})。
- encodeTransferWithAuthorizationCalldata: relay (Gelato sponsoredCall の data) 用 calldata。
- recoverTransferAuthorizationSigner: server 側で署名者==from を検証 (無効署名で relay 枠を浪費しない)。
- randomAuthorizationNonce / validateAuthorization (value>0・期限・有効窓・上限・nonce 形式)。
検証: tsc 0 · eslint 0 · 新規 unit 14 件 (署名 round-trip / calldata decode / 改竄検知 / 範囲検証) ·
full suite 2597 passed/0 failed。
次増分: /api/relay/jpyc (Gelato sponsoredCall) — @gelatonetwork/relay-sdk 追加 + GELATO_SPONSOR_API_KEY
+ 1Balance 入金が前提。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
/api/relay/jpyc: 顧客の transferWithAuthorization 署名を受け、検証 → Gelato sponsoredCall で
submit → poll → {txHash}。委任不要なので現行 7702 経路より到達が広い (Polygon・memory:jpyc-eip3009)。
まだ client に未配線・GELATO_SPONSOR_API_KEY 未設定なら 503 relay_not_configured を返す inert 追加。
- lib/relay/jpycRelay.ts: 依存注入の純コア (検証→署名 recover==from→残高→rate-limit→submit→poll)。
I/O を inject するので viem/fetch を mock せず全分岐を unit test (9 件) で担保。
- app/api/relay/jpyc/route.ts: 薄い adapter。実依存を wire — viem balanceOf / Gelato REST
(fetch・**deprecated SDK は使わず** sponsored-call + tasks/status を直叩き) / KV sliding-window
rate-limit (per from + IP) / env-gate。Gelato は Polygon 対応・Kaia 非対応なので対象 chain を
Polygon(+Amoy) に限定。
- 濫用対策: サーバ署名検証 (無効署名で枠浪費せず)・残高事前確認・value 上限・rate-limit。
- **新規依存なし** (install した @gelatonetwork/relay-sdk は deprecated だったので REST 直叩きに切替)。
検証: tsc 0 · eslint 0 · 新規 unit 10 件 (relay コア 9 + route env-gate 1) · full suite 2607 passed/0 failed。
次増分: client hook (useJpycEip3009Payment) + resolveJpycGaslessProvider + form 配線 + 記録。
本番稼働は GELATO_SPONSOR_API_KEY + 1Balance 入金が前提。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
JPYC ガスレスを EIP-3009 + relayer で実現する計画([memory] Phase 0 検証で Polygon+Kaia GO)の 純ロジック基盤。client(署名)と server(relay endpoint)が共有する外部依存なしの純関数で、まだ配線していない inert な追加(unit test で完全担保)。
buildTransferWithAuthorizationTypedData— 署名用 EIP-712(domain{name:"JPY Coin", version:"1"}、x402 と単一情報源)encodeTransferWithAuthorizationCalldata— relay(GelatosponsoredCallの data)用 calldatarecoverTransferAuthorizationSigner— server 側で署名者==from を検証(無効署名で relay 枠を浪費しない)randomAuthorizationNonce/validateAuthorization(value>0・期限・有効窓・上限・nonce 形式)新規 unit 14 件(署名 round-trip / calldata decode / 改竄検知 / 範囲検証)。tsc 0 · eslint 0 · 全 2597 passed/0 failed。
次増分:
/api/relay/jpyc(GelatosponsoredCall)。🤖 Generated with Claude Code