@zkproofport-ai/sdk 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/README.md +52 -134
  2. package/dist/actionApproval.js +1 -1
  3. package/dist/actionApproval.js.map +1 -1
  4. package/dist/attestation.d.ts +6 -1
  5. package/dist/attestation.d.ts.map +1 -1
  6. package/dist/attestation.js +41 -4
  7. package/dist/attestation.js.map +1 -1
  8. package/dist/cdp.d.ts +3 -3
  9. package/dist/circuits.d.ts +1 -3
  10. package/dist/circuits.d.ts.map +1 -1
  11. package/dist/circuits.js +0 -4
  12. package/dist/circuits.js.map +1 -1
  13. package/dist/constants.d.ts.map +1 -1
  14. package/dist/constants.js +0 -10
  15. package/dist/constants.js.map +1 -1
  16. package/dist/extract.d.ts.map +1 -1
  17. package/dist/extract.js +5 -7
  18. package/dist/extract.js.map +1 -1
  19. package/dist/flow.d.ts.map +1 -1
  20. package/dist/flow.js +13 -14
  21. package/dist/flow.js.map +1 -1
  22. package/dist/index.d.ts +1 -4
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +3 -12
  25. package/dist/index.js.map +1 -1
  26. package/dist/inputs.d.ts +4 -3
  27. package/dist/inputs.d.ts.map +1 -1
  28. package/dist/inputs.js +4 -7
  29. package/dist/inputs.js.map +1 -1
  30. package/dist/payment.d.ts +7 -9
  31. package/dist/payment.d.ts.map +1 -1
  32. package/dist/payment.js +20 -43
  33. package/dist/payment.js.map +1 -1
  34. package/dist/typedAction.js +1 -1
  35. package/dist/typedAction.js.map +1 -1
  36. package/dist/types.d.ts +5 -9
  37. package/dist/types.d.ts.map +1 -1
  38. package/dist/types.js +0 -2
  39. package/dist/types.js.map +1 -1
  40. package/dist/usdc.d.ts +6 -10
  41. package/dist/usdc.d.ts.map +1 -1
  42. package/dist/usdc.js +6 -11
  43. package/dist/usdc.js.map +1 -1
  44. package/dist/wallets.d.ts +8 -34
  45. package/dist/wallets.d.ts.map +1 -1
  46. package/dist/wallets.js +10 -87
  47. package/dist/wallets.js.map +1 -1
  48. package/package.json +2 -12
  49. package/dist/arcWallet.d.ts +0 -50
  50. package/dist/arcWallet.d.ts.map +0 -1
  51. package/dist/arcWallet.js +0 -161
  52. package/dist/arcWallet.js.map +0 -1
  53. package/dist/delegation.d.ts +0 -107
  54. package/dist/delegation.d.ts.map +0 -1
  55. package/dist/delegation.js +0 -126
  56. package/dist/delegation.js.map +0 -1
  57. package/dist/nanopayment.d.ts +0 -71
  58. package/dist/nanopayment.d.ts.map +0 -1
  59. package/dist/nanopayment.js +0 -77
  60. package/dist/nanopayment.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"wallets.js","sourceRoot":"","sources":["../src/wallets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEpD;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,UAAkB;IAC3D,MAAM,EAAE,mBAAmB,EAAE,GAAG,MAAM,MAAM,CAAC,eAAe,CAAC,CAAC;IAC9D,MAAM,GAAG,GAAG,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,UAAU,EAAE,CAAC;IACzE,MAAM,OAAO,GAAG,mBAAmB,CAAC,GAAoB,CAAC,CAAC;IAC1D,OAAO;QACL,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,aAAa,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,aAAa,CAAC,OAAgB,CAAC;QACnE,QAAQ,EAAE,GAAG,EAAE,CAAC,eAAe,OAAO,CAAC,OAAO,EAAE;KACjD,CAAC;AACJ,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,IAKnC;IACC,IA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,CAAC;QAC1E,OAAO,CAAC,CAAC;IACX,CAAC,CAAC;IACF,QAAQ,KAAK,EAAE,CAAC;QACd,KAAK,KAAK;YACR,OAAO,oBAAoB,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC;QAC3D,KAAK,KAAK;YACR,OAAO,aAAa,CAAC;gBACnB,QAAQ,EAAE,IAAI,CAAC,gBAAgB,CAAC;gBAChC,YAAY,EAAE,IAAI,CAAC,oBAAoB,CAAC;gBACxC,YAAY,EAAE,IAAI,CAAC,mBAAmB,CAAC;gBACvC,UAAU,EAAE,GAAG,CAAC,eAAe;aAChC,CAAC,CAAC;QACL;YACE,MAAM,IAAI,KAAK,CAAC,2BAA2B,KAAK,4BAA4B,CAAC,CAAC;IAClF,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zkproofport-ai/sdk",
3
- "version": "0.3.0",
4
- "description": "TypeScript SDK for ZKProofport Coinbase KYC, country, OIDC, Arc eligibility and GIWA attestation proofs. Optional EIP-712 action binding for Arc/GIWA; x402 USDC and Circle Gateway payments.",
3
+ "version": "0.4.0",
4
+ "description": "TypeScript SDK for ZKProofport Coinbase KYC, country, OIDC and GIWA attestation proofs. Optional EIP-712 action binding for GIWA; x402 USDC payments.",
5
5
  "keywords": [
6
6
  "sdk",
7
7
  "typescript",
@@ -18,11 +18,6 @@
18
18
  "noir-lang",
19
19
  "base-chain",
20
20
  "ethers",
21
- "arc-testnet",
22
- "experimental-arc",
23
- "circle-agent-wallet",
24
- "circle-gateway",
25
- "gateway-nanopayments",
26
21
  "action-authorization",
27
22
  "eip-712"
28
23
  ],
@@ -40,7 +35,6 @@
40
35
  "typecheck": "tsc --noEmit"
41
36
  },
42
37
  "dependencies": {
43
- "@circle-fin/x402-batching": "^3.4.0",
44
38
  "@x402/core": "^2.25.0",
45
39
  "@x402/evm": "^2.25.0",
46
40
  "ethers": "^6.13.0",
@@ -60,7 +54,6 @@
60
54
  "directory": "packages/sdk"
61
55
  },
62
56
  "peerDependencies": {
63
- "@circle-fin/developer-controlled-wallets": ">=10.0.0",
64
57
  "@coinbase/cdp-sdk": ">=1.55.0",
65
58
  "@x402/extensions": ">=2.25.0"
66
59
  },
@@ -68,9 +61,6 @@
68
61
  "@coinbase/cdp-sdk": {
69
62
  "optional": true
70
63
  },
71
- "@circle-fin/developer-controlled-wallets": {
72
- "optional": true
73
- },
74
64
  "@x402/extensions": {
75
65
  "optional": true
76
66
  }
@@ -1,50 +0,0 @@
1
- /**
2
- * Paying from an Arc agent wallet, through Circle's CLI.
3
- *
4
- * ## Why the CLI and not an API
5
- *
6
- * An Arc agent wallet is not a key this process can hold. Circle keeps it, and
7
- * everything that touches it — creating it, reading its balance, signing with
8
- * it — goes through `@circle-fin/cli`, which authenticates with a login that a
9
- * person does once. So the integration is a wrapper around that command, and
10
- * the alternative would be reimplementing Circle's auth, which is both work and
11
- * a second thing to get wrong.
12
- *
13
- * ## What this buys over a private key
14
- *
15
- * The wallet carries policies Circle enforces: spending limits per period,
16
- * recipient allowlists, contract blocklists. A raw key has none of that — it
17
- * signs whatever it is handed. That is the whole point of an agent holding
18
- * money: the agent acts on its own, and the limits are not the agent's to
19
- * ignore.
20
- *
21
- * ## What it costs
22
- *
23
- * A subprocess per signature, and the CLI must be installed and logged in. Both
24
- * are checked before signing rather than discovered as a cryptic failure, and
25
- * the errors here say which of the two is missing and what command fixes it.
26
- */
27
- import type { PaymentWallet } from './types.js';
28
- /** How Circle names Arc's chains. Not ours to choose. */
29
- export declare const ARC_CLI_CHAINS: {
30
- readonly testnet: "ARC-TESTNET";
31
- readonly mainnet: "ARC";
32
- };
33
- export type ArcCliChain = (typeof ARC_CLI_CHAINS)[keyof typeof ARC_CLI_CHAINS];
34
- /** The agent wallets Circle holds for this login on one chain. */
35
- export declare function listArcAgentWallets(chain?: ArcCliChain): Promise<string[]>;
36
- /** Create one. Circle caps an account at five. */
37
- export declare function createArcAgentWallet(): Promise<string>;
38
- /**
39
- * A payment wallet backed by an Arc agent wallet.
40
- *
41
- * `address` may be omitted, in which case the single agent wallet on that chain
42
- * is used — and having none, or several, is an error rather than a guess:
43
- * paying from a wallet the caller did not name spends somebody's money
44
- * somewhere they did not choose.
45
- */
46
- export declare function walletFromArcAgent(opts?: {
47
- address?: string;
48
- chain?: ArcCliChain;
49
- }): Promise<PaymentWallet>;
50
- //# sourceMappingURL=arcWallet.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"arcWallet.d.ts","sourceRoot":"","sources":["../src/arcWallet.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAIhD,yDAAyD;AACzD,eAAO,MAAM,cAAc;;;CAAsD,CAAC;AAClF,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,OAAO,cAAc,CAAC,CAAC;AA+C/E,kEAAkE;AAClE,wBAAsB,mBAAmB,CAAC,KAAK,GAAE,WAAoC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAKxG;AAED,kDAAkD;AAClD,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,MAAM,CAAC,CAK5D;AAiBD;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,GAAE;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,WAAW,CAAC;CAChB,GAAG,OAAO,CAAC,aAAa,CAAC,CAkE9B"}
package/dist/arcWallet.js DELETED
@@ -1,161 +0,0 @@
1
- /**
2
- * Paying from an Arc agent wallet, through Circle's CLI.
3
- *
4
- * ## Why the CLI and not an API
5
- *
6
- * An Arc agent wallet is not a key this process can hold. Circle keeps it, and
7
- * everything that touches it — creating it, reading its balance, signing with
8
- * it — goes through `@circle-fin/cli`, which authenticates with a login that a
9
- * person does once. So the integration is a wrapper around that command, and
10
- * the alternative would be reimplementing Circle's auth, which is both work and
11
- * a second thing to get wrong.
12
- *
13
- * ## What this buys over a private key
14
- *
15
- * The wallet carries policies Circle enforces: spending limits per period,
16
- * recipient allowlists, contract blocklists. A raw key has none of that — it
17
- * signs whatever it is handed. That is the whole point of an agent holding
18
- * money: the agent acts on its own, and the limits are not the agent's to
19
- * ignore.
20
- *
21
- * ## What it costs
22
- *
23
- * A subprocess per signature, and the CLI must be installed and logged in. Both
24
- * are checked before signing rather than discovered as a cryptic failure, and
25
- * the errors here say which of the two is missing and what command fixes it.
26
- */
27
- import { execFile } from 'node:child_process';
28
- import { promisify } from 'node:util';
29
- const run = promisify(execFile);
30
- /** How Circle names Arc's chains. Not ours to choose. */
31
- export const ARC_CLI_CHAINS = { testnet: 'ARC-TESTNET', mainnet: 'ARC' };
32
- async function circle(args) {
33
- try {
34
- const { stdout } = await run('circle', [...args, '--output', 'json'], {
35
- // Non-interactive: a script has no way to answer the terms prompt, and
36
- // Circle documents this variable for exactly that.
37
- env: { ...process.env, CIRCLE_ACCEPT_TERMS: '1' },
38
- maxBuffer: 8 * 1024 * 1024,
39
- });
40
- return JSON.parse(stdout);
41
- }
42
- catch (error) {
43
- const err = error;
44
- if (err.code === 'ENOENT') {
45
- throw new Error('Circle CLI is not installed, so an Arc agent wallet cannot sign. Install it with ' +
46
- '`npm install -g @circle-fin/cli@>=1.1.4`, then `circle wallet login <email> --testnet`.');
47
- }
48
- // The CLI prints a JSON error on stdout even when it exits non-zero.
49
- let reason = err.stderr?.trim() || err.message || 'unknown error';
50
- try {
51
- const parsed = JSON.parse(err.stdout ?? '');
52
- if (parsed.error?.message) {
53
- reason = parsed.error.hint ? `${parsed.error.message} (${parsed.error.hint})` : parsed.error.message;
54
- }
55
- }
56
- catch {
57
- // stdout was not JSON; the stderr text above is the best there is.
58
- }
59
- if (/no longer supported/i.test(reason)) {
60
- throw new Error(`Circle CLI is too old: ${reason} Update it with \`circle update\` or ` +
61
- '`npm install -g @circle-fin/cli@latest`. Circle disables wallet operations on ' +
62
- 'versions it has retired, so the pin cannot be held here — 1.0.0 stopped working ' +
63
- 'for wallet commands and 1.1.4 was current on 2026-09-22.');
64
- }
65
- if (/AUTH_REQUIRED|Not logged in/i.test(reason)) {
66
- throw new Error(`Circle CLI is not logged in for this environment: ${reason}. ` +
67
- 'Testnet and mainnet are separate logins — `circle wallet login <email> --testnet` for Arc Testnet.');
68
- }
69
- throw new Error(`Circle CLI failed: ${reason}`);
70
- }
71
- }
72
- /** The agent wallets Circle holds for this login on one chain. */
73
- export async function listArcAgentWallets(chain = ARC_CLI_CHAINS.testnet) {
74
- const answer = (await circle(['wallet', 'list', '--chain', chain, '--type', 'agent']));
75
- return (answer.data?.wallets ?? []).map((w) => String(w.address)).filter(Boolean);
76
- }
77
- /** Create one. Circle caps an account at five. */
78
- export async function createArcAgentWallet() {
79
- const answer = (await circle(['wallet', 'create']));
80
- const address = answer.data?.wallet?.address;
81
- if (!address)
82
- throw new Error('Circle CLI created a wallet but reported no address.');
83
- return address;
84
- }
85
- /** The address that actually signs for an agent wallet, per Circle. */
86
- async function backingEoa(wallet, chain) {
87
- const answer = (await circle(['gateway', 'balance', '--address', wallet, '--chain', chain]));
88
- const backer = answer.data?.backingEOA;
89
- if (!backer) {
90
- throw new Error(`Circle did not say which address signs for agent wallet ${wallet}. ` +
91
- 'Gateway holds the balance under that address, so paying without it would sign as nobody.');
92
- }
93
- return backer;
94
- }
95
- /**
96
- * A payment wallet backed by an Arc agent wallet.
97
- *
98
- * `address` may be omitted, in which case the single agent wallet on that chain
99
- * is used — and having none, or several, is an error rather than a guess:
100
- * paying from a wallet the caller did not name spends somebody's money
101
- * somewhere they did not choose.
102
- */
103
- export async function walletFromArcAgent(opts = {}) {
104
- const chain = opts.chain ?? ARC_CLI_CHAINS.testnet;
105
- let address = opts.address;
106
- if (!address) {
107
- const wallets = await listArcAgentWallets(chain);
108
- if (wallets.length === 0) {
109
- throw new Error(`No Arc agent wallet exists on ${chain}. Create one with \`circle wallet create\`, ` +
110
- 'or pass the address of one that does.');
111
- }
112
- if (wallets.length > 1) {
113
- throw new Error(`${wallets.length} agent wallets exist on ${chain} (${wallets.join(', ')}). ` +
114
- 'Name the one to pay from — picking for you would spend from a wallet nobody chose.');
115
- }
116
- address = wallets[0];
117
- }
118
- // Circle uses the smart wallet for direct USDC authorizations (ERC-1271),
119
- // but its backing EOA owns the Gateway deposit. Signing always goes through
120
- // the same Circle agent wallet; signPayment chooses the authorization owner
121
- // for the selected offer without changing this wallet's identity.
122
- const signer = await backingEoa(address, chain);
123
- return {
124
- address: address,
125
- gatewayAddress: signer,
126
- signTypedData: async (message) => {
127
- // EIP-712 amounts arrive as BigInt and `JSON.stringify` refuses them
128
- // outright — "Do not know how to serialize a BigInt". They go over as
129
- // decimal strings, which is what EIP-712 encoders take for a uint256
130
- // anyway, so nothing is lost and nothing is rounded.
131
- // `EIP712Domain` spelled out.
132
- //
133
- // viem infers it from the domain's own fields and most libraries follow,
134
- // but Circle's CLI validates the typed data strictly and refuses a
135
- // request whose `types` does not declare it: "there is extra data
136
- // provided in the message (0 < 4)". Declared here to match the domain
137
- // actually given, field for field.
138
- const typed = message;
139
- const domainFields = [
140
- ['name', 'string'],
141
- ['version', 'string'],
142
- ['chainId', 'uint256'],
143
- ['verifyingContract', 'address'],
144
- ].filter(([field]) => typed.domain && typed.domain[field] !== undefined)
145
- .map(([name, type]) => ({ name, type }));
146
- const asJson = JSON.stringify({ ...typed, types: { EIP712Domain: domainFields, ...(typed.types ?? {}) } }, (_key, value) => (typeof value === 'bigint' ? value.toString() : value));
147
- if (process.env.ARC_WALLET_DEBUG)
148
- console.error('[arc-wallet] 서명 요청 =', asJson);
149
- const answer = (await circle([
150
- 'wallet', 'sign', 'typed-data', asJson,
151
- '--address', address, '--chain', chain,
152
- ]));
153
- const signature = answer.data?.signature;
154
- if (!signature)
155
- throw new Error('Circle CLI signed nothing: no signature in its answer.');
156
- return signature;
157
- },
158
- describe: () => `Arc agent wallet ${address} on ${chain}, Gateway depositor ${signer}`,
159
- };
160
- }
161
- //# sourceMappingURL=arcWallet.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"arcWallet.js","sourceRoot":"","sources":["../src/arcWallet.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGtC,MAAM,GAAG,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAEhC,yDAAyD;AACzD,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,KAAK,EAAW,CAAC;AAGlF,KAAK,UAAU,MAAM,CAAC,IAAc;IAClC,IAAI,CAAC;QACH,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,CAAC,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE;YACpE,uEAAuE;YACvE,mDAAmD;YACnD,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,mBAAmB,EAAE,GAAG,EAAE;YACjD,SAAS,EAAE,CAAC,GAAG,IAAI,GAAG,IAAI;SAC3B,CAAC,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC5B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,GAAG,GAAG,KAA8E,CAAC;QAC3F,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC1B,MAAM,IAAI,KAAK,CACb,mFAAmF;gBACnF,yFAAyF,CAC1F,CAAC;QACJ,CAAC;QACD,qEAAqE;QACrE,IAAI,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,CAAC,OAAO,IAAI,eAAe,CAAC;QAClE,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,I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E,YAAY,EAAE,YAAY,EAAE,GAAG,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC,EAAE,EAAE,EAC3E,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CACxE,CAAC;YACF,IAAI,OAAO,CAAC,GAAG,CAAC,gBAAgB;gBAAE,OAAO,CAAC,KAAK,CAAC,sBAAsB,EAAE,MAAM,CAAC,CAAC;YAChF,MAAM,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC;gBAC3B,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM;gBACtC,WAAW,EAAE,OAAQ,EAAE,SAAS,EAAE,KAAK;aACxC,CAAC,CAAsC,CAAC;YACzC,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC;YACzC,IAAI,CAAC,SAAS;gBAAE,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;YAC1F,OAAO,SAA0B,CAAC;QACpC,CAAC;QACD,QAAQ,EAAE,GAAG,EAAE,CAAC,oBAAoB,OAAO,OAAO,KAAK,uBAAuB,MAAM,EAAE;KACvF,CAAC;AACJ,CAAC"}
@@ -1,107 +0,0 @@
1
- /**
2
- * Authorizing an action by another wallet without transferring KYC or identity.
3
- *
4
- * ## The problem this solves
5
- *
6
- * A wallet holds a Coinbase KYC attestation — call it A. A service wants proof
7
- * of that KYC before it will let anyone stake. But A is the wallet whose
8
- * on-chain history is worth hiding: revealing it links the KYC to everything
9
- * else A has ever done.
10
- *
11
- * So A never appears. A signs a statement naming a second wallet, B, and the
12
- * proof carries the hash of that statement. The service checks the proof, reads
13
- * B out of the statement, and lets B act — while A stays behind the proof.
14
- *
15
- * ## Why this is an ordinary action and not a new mechanism
16
- *
17
- * `arc_eligibility` already proves "the wallet holding this KYC authorised ONE
18
- * EIP-712 action". A delegation IS such an action: its fields name who is being
19
- * delegated to, what they may do, and until when. Nothing in the circuit
20
- * changes — only the structure being signed.
21
- *
22
- * That also means the delegation is bound to the proof: a proof made for one
23
- * delegation verifies for no other, because the action's hash is a public
24
- * input. Lifting the proof onto a different B is not possible.
25
- *
26
- * ## What the verifier must do
27
- *
28
- * Reading B out of the action is not enough. The service MUST rebuild the
29
- * action's hash from the delegation it was shown and compare it with the
30
- * proof's public input — otherwise anyone could present a valid proof
31
- * alongside a delegation naming a wallet of their choosing.
32
- * `delegationMatchesProof` is that check.
33
- */
34
- import type { TypedAction } from './types.js';
35
- /** What a delegation says. Every field is signed and none may be inferred. */
36
- export interface Delegation {
37
- /** The operational wallet authorized by this action; it does not acquire KYC. */
38
- delegate: string;
39
- /** What the delegate may do, e.g. 'stake'. Free text the service defines. */
40
- action: string;
41
- /** Unix seconds. A delegation without an end is not offered. */
42
- expiresAt: number;
43
- /** Makes this delegation single-use, so it cannot be replayed. */
44
- nonce: string;
45
- }
46
- /** The EIP-712 type of a delegation, and the name its wallet renders. */
47
- export declare const DELEGATION_PRIMARY_TYPE = "CredentialDelegation";
48
- export declare const DELEGATION_TYPES: {
49
- readonly CredentialDelegation: readonly [{
50
- readonly name: "delegate";
51
- readonly type: "address";
52
- }, {
53
- readonly name: "action";
54
- readonly type: "string";
55
- }, {
56
- readonly name: "expiresAt";
57
- readonly type: "uint256";
58
- }, {
59
- readonly name: "nonce";
60
- readonly type: "string";
61
- }];
62
- };
63
- /**
64
- * Build the legacy generic action that A signs to authorize B.
65
- *
66
- * This four-field wire schema has no amount and is not compatible with the
67
- * Ledger House staking Gate's five-field CredentialDelegation type. For that
68
- * Gate, supply its exact TypedAction including amount; do not change this
69
- * helper's established type hash or treat this as a transfer of identity.
70
- *
71
- * `domain` names the service the delegation is for, so a delegation issued to
72
- * one service cannot be presented at another: the domain separator is part of
73
- * what the proof binds.
74
- */
75
- export declare function buildDelegationAction(params: {
76
- delegation: Delegation;
77
- domain: {
78
- name: string;
79
- version: string;
80
- chainId: number;
81
- verifyingContract: string;
82
- };
83
- }): TypedAction;
84
- /** The 32 bytes a proof carries for this action: EIP-712's hashStruct. */
85
- export declare function delegationActionHash(action: TypedAction): string;
86
- /** The 32 bytes a proof carries for the service this delegation is for. */
87
- export declare function delegationDomainSeparator(action: TypedAction): string;
88
- /**
89
- * Whether a proof was made for exactly this delegation.
90
- *
91
- * The reason to call this rather than trust the delegation shown alongside the
92
- * proof: a proof is public once presented, and anything that reads the
93
- * delegate out of an unverified structure can be handed a proof plus a
94
- * delegation naming somebody else.
95
- */
96
- export declare function delegationMatchesProof(params: {
97
- action: TypedAction;
98
- /** The proof's `domain_separator` public input. */
99
- domainSeparator: string;
100
- /** The proof's `action_hash` public input. */
101
- actionHash: string;
102
- /** Unix seconds. An expired delegation is refused even when the proof is sound. */
103
- now?: number;
104
- }): string | null;
105
- /** The wallet a checked delegation names. Throws rather than return a guess. */
106
- export declare function delegateOf(action: TypedAction): string;
107
- //# sourceMappingURL=delegation.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"delegation.d.ts","sourceRoot":"","sources":["../src/delegation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,8EAA8E;AAC9E,MAAM,WAAW,UAAU;IACzB,iFAAiF;IACjF,QAAQ,EAAE,MAAM,CAAC;IACjB,6EAA6E;IAC7E,MAAM,EAAE,MAAM,CAAC;IACf,gEAAgE;IAChE,SAAS,EAAE,MAAM,CAAC;IAClB,kEAAkE;IAClE,KAAK,EAAE,MAAM,CAAC;CACf;AAID,yEAAyE;AACzE,eAAO,MAAM,uBAAuB,yBAAyB,CAAC;AAC9D,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;CAOnB,CAAC;AAEX;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE;IAC5C,UAAU,EAAE,UAAU,CAAC;IACvB,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,iBAAiB,EAAE,MAAM,CAAA;KAAE,CAAC;CACvF,GAAG,WAAW,CAyBd;AAED,0EAA0E;AAC1E,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAEhE;AAED,2EAA2E;AAC3E,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAErE;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE;IAC7C,MAAM,EAAE,WAAW,CAAC;IACpB,mDAAmD;IACnD,eAAe,EAAE,MAAM,CAAC;IACxB,8CAA8C;IAC9C,UAAU,EAAE,MAAM,CAAC;IACnB,mFAAmF;IACnF,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,GAAG,MAAM,GAAG,IAAI,CAkBhB;AAED,gFAAgF;AAChF,wBAAgB,UAAU,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAMtD"}
@@ -1,126 +0,0 @@
1
- /**
2
- * Authorizing an action by another wallet without transferring KYC or identity.
3
- *
4
- * ## The problem this solves
5
- *
6
- * A wallet holds a Coinbase KYC attestation — call it A. A service wants proof
7
- * of that KYC before it will let anyone stake. But A is the wallet whose
8
- * on-chain history is worth hiding: revealing it links the KYC to everything
9
- * else A has ever done.
10
- *
11
- * So A never appears. A signs a statement naming a second wallet, B, and the
12
- * proof carries the hash of that statement. The service checks the proof, reads
13
- * B out of the statement, and lets B act — while A stays behind the proof.
14
- *
15
- * ## Why this is an ordinary action and not a new mechanism
16
- *
17
- * `arc_eligibility` already proves "the wallet holding this KYC authorised ONE
18
- * EIP-712 action". A delegation IS such an action: its fields name who is being
19
- * delegated to, what they may do, and until when. Nothing in the circuit
20
- * changes — only the structure being signed.
21
- *
22
- * That also means the delegation is bound to the proof: a proof made for one
23
- * delegation verifies for no other, because the action's hash is a public
24
- * input. Lifting the proof onto a different B is not possible.
25
- *
26
- * ## What the verifier must do
27
- *
28
- * Reading B out of the action is not enough. The service MUST rebuild the
29
- * action's hash from the delegation it was shown and compare it with the
30
- * proof's public input — otherwise anyone could present a valid proof
31
- * alongside a delegation naming a wallet of their choosing.
32
- * `delegationMatchesProof` is that check.
33
- */
34
- import { ethers } from 'ethers';
35
- const ADDRESS = /^0x[0-9a-fA-F]{40}$/;
36
- /** The EIP-712 type of a delegation, and the name its wallet renders. */
37
- export const DELEGATION_PRIMARY_TYPE = 'CredentialDelegation';
38
- export const DELEGATION_TYPES = {
39
- [DELEGATION_PRIMARY_TYPE]: [
40
- { name: 'delegate', type: 'address' },
41
- { name: 'action', type: 'string' },
42
- { name: 'expiresAt', type: 'uint256' },
43
- { name: 'nonce', type: 'string' },
44
- ],
45
- };
46
- /**
47
- * Build the legacy generic action that A signs to authorize B.
48
- *
49
- * This four-field wire schema has no amount and is not compatible with the
50
- * Ledger House staking Gate's five-field CredentialDelegation type. For that
51
- * Gate, supply its exact TypedAction including amount; do not change this
52
- * helper's established type hash or treat this as a transfer of identity.
53
- *
54
- * `domain` names the service the delegation is for, so a delegation issued to
55
- * one service cannot be presented at another: the domain separator is part of
56
- * what the proof binds.
57
- */
58
- export function buildDelegationAction(params) {
59
- const { delegation, domain } = params;
60
- if (!ADDRESS.test(delegation.delegate)) {
61
- throw new Error(`delegate must be an address, got '${delegation.delegate}'.`);
62
- }
63
- if (!delegation.action.trim()) {
64
- throw new Error('A delegation must say what the delegate may do; `action` was empty.');
65
- }
66
- if (!Number.isInteger(delegation.expiresAt) || delegation.expiresAt <= 0) {
67
- throw new Error('expiresAt must be a Unix time in seconds. A delegation without an end is not offered.');
68
- }
69
- if (!delegation.nonce.trim()) {
70
- throw new Error('A delegation needs a nonce, or the same signature can be replayed.');
71
- }
72
- return {
73
- domain,
74
- types: DELEGATION_TYPES,
75
- primaryType: DELEGATION_PRIMARY_TYPE,
76
- message: {
77
- delegate: delegation.delegate,
78
- action: delegation.action,
79
- expiresAt: delegation.expiresAt,
80
- nonce: delegation.nonce,
81
- },
82
- };
83
- }
84
- /** The 32 bytes a proof carries for this action: EIP-712's hashStruct. */
85
- export function delegationActionHash(action) {
86
- return ethers.TypedDataEncoder.hashStruct(action.primaryType, action.types, action.message);
87
- }
88
- /** The 32 bytes a proof carries for the service this delegation is for. */
89
- export function delegationDomainSeparator(action) {
90
- return ethers.TypedDataEncoder.hashDomain(action.domain);
91
- }
92
- /**
93
- * Whether a proof was made for exactly this delegation.
94
- *
95
- * The reason to call this rather than trust the delegation shown alongside the
96
- * proof: a proof is public once presented, and anything that reads the
97
- * delegate out of an unverified structure can be handed a proof plus a
98
- * delegation naming somebody else.
99
- */
100
- export function delegationMatchesProof(params) {
101
- const { action, domainSeparator, actionHash } = params;
102
- const now = params.now ?? Math.floor(Date.now() / 1000);
103
- if (action.primaryType !== DELEGATION_PRIMARY_TYPE) {
104
- return `This action is a '${action.primaryType}', not a ${DELEGATION_PRIMARY_TYPE}. It authorises something, but not a delegation.`;
105
- }
106
- if (delegationDomainSeparator(action).toLowerCase() !== domainSeparator.toLowerCase()) {
107
- return 'The proof was made for a different service: its domain separator does not match this delegation.';
108
- }
109
- if (delegationActionHash(action).toLowerCase() !== actionHash.toLowerCase()) {
110
- return 'The proof was made for a different delegation: its action hash does not match the one shown.';
111
- }
112
- const expiresAt = Number(action.message.expiresAt);
113
- if (!Number.isFinite(expiresAt) || expiresAt <= now) {
114
- return `This delegation expired at ${expiresAt}, and it is now ${now}.`;
115
- }
116
- return null;
117
- }
118
- /** The wallet a checked delegation names. Throws rather than return a guess. */
119
- export function delegateOf(action) {
120
- const delegate = action.message.delegate;
121
- if (typeof delegate !== 'string' || !ADDRESS.test(delegate)) {
122
- return (() => { throw new Error(`This action names no delegate address: got '${String(delegate)}'.`); })();
123
- }
124
- return delegate;
125
- }
126
- //# sourceMappingURL=delegation.js.map
@@ -1 +0,0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CAAC;IACD,IAAI,oBAAoB,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,KAAK,UAAU,CAAC,WAAW,EAAE,EAAE,CAAC;QAC5E,OAAO,8FAA8F,CAAC;IACxG,CAAC;IACD,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACnD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,SAAS,IAAI,GAAG,EAAE,CAAC;QACpD,OAAO,8BAA8B,SAAS,mBAAmB,GAAG,GAAG,CAAC;IAC1E,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,gFAAgF;AAChF,MAAM,UAAU,UAAU,CAAC,MAAmB;IAC5C,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC;IACzC,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC5D,OAAO,CAAC,GAAG,EAAE,GAAG,MAAM,IAAI,KAAK,CAAC,+CAA+C,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7G,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -1,71 +0,0 @@
1
- /**
2
- * Paying with Arc nanopayments: deposit once, then pay many times for free.
3
- *
4
- * ## What is different from the ordinary path
5
- *
6
- * An ordinary x402 payment puts one authorization on chain per purchase, and
7
- * on Arc that costs gas in USDC — measured 2026-09-12 at 0.0035 USDC to settle
8
- * a payment of 0.001, which is four times the price of the thing being bought.
9
- * That is fine for a one-off and absurd for an agent buying thousands of
10
- * proofs.
11
- *
12
- * Circle Gateway takes the same EIP-3009 authorization, verifies it off chain
13
- * in under a second, and settles thousands of them in one transaction. The
14
- * buyer's money moves into Gateway once, by depositing; after that each
15
- * payment is a signature and nothing more.
16
- *
17
- * ## What the buyer has to do
18
- *
19
- * Deposit first. A signature drawn against a Gateway balance that is not there
20
- * is refused, and the refusal names the balance rather than the signature, so
21
- * `ensureGatewayBalance` checks before paying rather than after failing.
22
- */
23
- /** Arc Testnet, as `@circle-fin/x402-batching` names it. */
24
- export declare const ARC_GATEWAY_CHAIN: "arcTestnet";
25
- export interface NanopaymentWallet {
26
- /** The buyer's key. Gateway signs authorizations with it and never sends a transaction per payment. */
27
- privateKey: `0x${string}`;
28
- /** Arc's RPC. Required — the package's default is for Arc mainnet. */
29
- rpcUrl: string;
30
- }
31
- /** What a buyer holds inside Gateway, in USDC's smallest units. */
32
- export interface GatewayBalances {
33
- /** Spendable right now. */
34
- available: bigint;
35
- /** On the way out, not spendable. */
36
- withdrawing: bigint;
37
- }
38
- /** What the buyer currently has inside Gateway. */
39
- export declare function gatewayBalance(wallet: NanopaymentWallet): Promise<GatewayBalances>;
40
- /**
41
- * Make sure the buyer can pay `atLeast`, depositing `topUp` if not.
42
- *
43
- * Deposits are the one on-chain step in this flow and they cost gas, so this
44
- * is deliberately not called before every payment — an agent deposits once and
45
- * spends against it.
46
- */
47
- export declare function ensureGatewayBalance(wallet: NanopaymentWallet,
48
- /** In USDC's smallest units. Undefined requests an unconditional deposit. */
49
- atLeast: bigint | undefined,
50
- /** In whole USDC, like everything the deposit call takes. */
51
- topUp: string): Promise<{
52
- deposited: boolean;
53
- balance: GatewayBalances;
54
- depositTxHash?: string;
55
- }>;
56
- /**
57
- * Buy something priced in x402, paying through Gateway.
58
- *
59
- * The 402 answer must carry a batched offer; a service that offers only the
60
- * ordinary on-chain options is not reachable this way, and saying so is better
61
- * than silently paying the expensive way.
62
- */
63
- export declare function payWithNanopayments<T = unknown>(wallet: NanopaymentWallet, url: string, options?: {
64
- method?: string;
65
- body?: unknown;
66
- headers?: Record<string, string>;
67
- }): Promise<{
68
- data: T;
69
- amount: string;
70
- }>;
71
- //# sourceMappingURL=nanopayment.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nan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