@zkproofport-ai/sdk 0.3.0 → 0.4.1
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.
- package/README.md +52 -134
- package/dist/action.js +1 -1
- package/dist/action.js.map +1 -1
- package/dist/actionApproval.js +1 -1
- package/dist/actionApproval.js.map +1 -1
- package/dist/attestation.d.ts +6 -1
- package/dist/attestation.d.ts.map +1 -1
- package/dist/attestation.js +41 -4
- package/dist/attestation.js.map +1 -1
- package/dist/cdp.d.ts +3 -3
- package/dist/circuits.d.ts +26 -105
- package/dist/circuits.d.ts.map +1 -1
- package/dist/circuits.js +18 -114
- package/dist/circuits.js.map +1 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +0 -10
- package/dist/constants.js.map +1 -1
- package/dist/extract.d.ts +6 -3
- package/dist/extract.d.ts.map +1 -1
- package/dist/extract.js +11 -10
- package/dist/extract.js.map +1 -1
- package/dist/flow.d.ts.map +1 -1
- package/dist/flow.js +13 -14
- package/dist/flow.js.map +1 -1
- package/dist/index.d.ts +2 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -16
- package/dist/index.js.map +1 -1
- package/dist/inputs.d.ts +4 -3
- package/dist/inputs.d.ts.map +1 -1
- package/dist/inputs.js +4 -7
- package/dist/inputs.js.map +1 -1
- package/dist/payment.d.ts +7 -9
- package/dist/payment.d.ts.map +1 -1
- package/dist/payment.js +20 -43
- package/dist/payment.js.map +1 -1
- package/dist/types.d.ts +9 -28
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +1 -1
- package/dist/usdc.d.ts +6 -10
- package/dist/usdc.d.ts.map +1 -1
- package/dist/usdc.js +6 -11
- package/dist/usdc.js.map +1 -1
- package/dist/verify.d.ts +5 -1
- package/dist/verify.d.ts.map +1 -1
- package/dist/verify.js +15 -13
- package/dist/verify.js.map +1 -1
- package/dist/wallets.d.ts +8 -34
- package/dist/wallets.d.ts.map +1 -1
- package/dist/wallets.js +10 -87
- package/dist/wallets.js.map +1 -1
- package/package.json +3 -12
- package/dist/arcWallet.d.ts +0 -50
- package/dist/arcWallet.d.ts.map +0 -1
- package/dist/arcWallet.js +0 -161
- package/dist/arcWallet.js.map +0 -1
- package/dist/delegation.d.ts +0 -107
- package/dist/delegation.d.ts.map +0 -1
- package/dist/delegation.js +0 -126
- package/dist/delegation.js.map +0 -1
- package/dist/nanopayment.d.ts +0 -71
- package/dist/nanopayment.d.ts.map +0 -1
- package/dist/nanopayment.js +0 -77
- package/dist/nanopayment.js.map +0 -1
- package/dist/typedAction.d.ts +0 -3
- package/dist/typedAction.d.ts.map +0 -1
- package/dist/typedAction.js +0 -50
- package/dist/typedAction.js.map +0 -1
package/dist/usdc.d.ts
CHANGED
|
@@ -9,11 +9,10 @@
|
|
|
9
9
|
* exactly that: it refuses to sign for an asset outside its own default list
|
|
10
10
|
* unless told otherwise, and refusing is the correct behaviour.
|
|
11
11
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* contracts and nothing else.
|
|
12
|
+
* Naming the allowed assets explicitly, rather than `spendControls: false`,
|
|
13
|
+
* matters: turning the control off allows every token on every chain, which is
|
|
14
|
+
* how an agent ends up signing away something nobody meant to spend. This
|
|
15
|
+
* allows four specific contracts and nothing else.
|
|
17
16
|
*
|
|
18
17
|
* So yes, this duplicates the server's table in `src/payment/networks.ts` --
|
|
19
18
|
* deliberately. A shared table would mean the client trusting the server's
|
|
@@ -22,10 +21,7 @@
|
|
|
22
21
|
* ## Keeping it right
|
|
23
22
|
*
|
|
24
23
|
* Each address was read from the chain, not from memory:
|
|
25
|
-
* `decimals()` is 6 and `name()`/`symbol()` say USDC on all
|
|
26
|
-
* ERC-20 view of its native balance, checked on 2026-09-09 -- name "USDC",
|
|
27
|
-
* version "2", decimals 6, and a `DOMAIN_SEPARATOR()` that matches the hash a
|
|
28
|
-
* client computes from those values.
|
|
24
|
+
* `decimals()` is 6 and `name()`/`symbol()` say USDC on all four.
|
|
29
25
|
*/
|
|
30
26
|
/**
|
|
31
27
|
* The most this SDK will sign for in one payment, unless the caller says
|
|
@@ -38,7 +34,7 @@
|
|
|
38
34
|
*/
|
|
39
35
|
export declare const DEFAULT_MAX_PAYMENT = "$1";
|
|
40
36
|
/**
|
|
41
|
-
* The spend controls to sign under: these
|
|
37
|
+
* The spend controls to sign under: these four USDC contracts, capped.
|
|
42
38
|
*
|
|
43
39
|
* Passing an asset the offer names that is NOT in the list produces a refusal
|
|
44
40
|
* from `@x402/core` rather than a signature.
|
package/dist/usdc.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usdc.d.ts","sourceRoot":"","sources":["../src/usdc.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"usdc.d.ts","sourceRoot":"","sources":["../src/usdc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAUH;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,OAAO,CAAC;AAExC;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,CAAC,EAAE,MAAM;;;;;;EAQpD;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAGnE;AAED,yDAAyD;AACzD,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE7D"}
|
package/dist/usdc.js
CHANGED
|
@@ -9,11 +9,10 @@
|
|
|
9
9
|
* exactly that: it refuses to sign for an asset outside its own default list
|
|
10
10
|
* unless told otherwise, and refusing is the correct behaviour.
|
|
11
11
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* contracts and nothing else.
|
|
12
|
+
* Naming the allowed assets explicitly, rather than `spendControls: false`,
|
|
13
|
+
* matters: turning the control off allows every token on every chain, which is
|
|
14
|
+
* how an agent ends up signing away something nobody meant to spend. This
|
|
15
|
+
* allows four specific contracts and nothing else.
|
|
17
16
|
*
|
|
18
17
|
* So yes, this duplicates the server's table in `src/payment/networks.ts` --
|
|
19
18
|
* deliberately. A shared table would mean the client trusting the server's
|
|
@@ -22,10 +21,7 @@
|
|
|
22
21
|
* ## Keeping it right
|
|
23
22
|
*
|
|
24
23
|
* Each address was read from the chain, not from memory:
|
|
25
|
-
* `decimals()` is 6 and `name()`/`symbol()` say USDC on all
|
|
26
|
-
* ERC-20 view of its native balance, checked on 2026-09-09 -- name "USDC",
|
|
27
|
-
* version "2", decimals 6, and a `DOMAIN_SEPARATOR()` that matches the hash a
|
|
28
|
-
* client computes from those values.
|
|
24
|
+
* `decimals()` is 6 and `name()`/`symbol()` say USDC on all four.
|
|
29
25
|
*/
|
|
30
26
|
/** CAIP-2 chain id → the USDC contract on it. */
|
|
31
27
|
const USDC_BY_CHAIN = {
|
|
@@ -33,7 +29,6 @@ const USDC_BY_CHAIN = {
|
|
|
33
29
|
'eip155:11155111': '0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238', // Ethereum Sepolia
|
|
34
30
|
'eip155:8453': '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913', // Base
|
|
35
31
|
'eip155:84532': '0x036CbD53842c5426634e7929541eC2318f3dCF7e', // Base Sepolia
|
|
36
|
-
'eip155:5042002': '0x3600000000000000000000000000000000000000', // Arc, native USDC's ERC-20 view
|
|
37
32
|
};
|
|
38
33
|
/**
|
|
39
34
|
* The most this SDK will sign for in one payment, unless the caller says
|
|
@@ -46,7 +41,7 @@ const USDC_BY_CHAIN = {
|
|
|
46
41
|
*/
|
|
47
42
|
export const DEFAULT_MAX_PAYMENT = '$1';
|
|
48
43
|
/**
|
|
49
|
-
* The spend controls to sign under: these
|
|
44
|
+
* The spend controls to sign under: these four USDC contracts, capped.
|
|
50
45
|
*
|
|
51
46
|
* Passing an asset the offer names that is NOT in the list produces a refusal
|
|
52
47
|
* from `@x402/core` rather than a signature.
|
package/dist/usdc.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usdc.js","sourceRoot":"","sources":["../src/usdc.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"usdc.js","sourceRoot":"","sources":["../src/usdc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,iDAAiD;AACjD,MAAM,aAAa,GAA2B;IAC5C,UAAU,EAAE,4CAA4C,EAAa,WAAW;IAChF,iBAAiB,EAAE,4CAA4C,EAAM,mBAAmB;IACxF,aAAa,EAAE,4CAA4C,EAAU,OAAO;IAC5E,cAAc,EAAE,4CAA4C,EAAS,eAAe;CACrF,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC;AAExC;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,UAAmB;IACnD,OAAO;QACL,mBAAmB,EAAE,UAAU,IAAI,mBAAmB;QACtD,aAAa,EAAE,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;YACtE,OAAO;YACP,KAAK;SACN,CAAC,CAAC;KACJ,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,OAAe,EAAE,KAAa;IACxD,MAAM,KAAK,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IACrC,OAAO,CAAC,CAAC,KAAK,IAAI,KAAK,CAAC,WAAW,EAAE,KAAK,KAAK,CAAC,WAAW,EAAE,CAAC;AAChE,CAAC;AAED,yDAAyD;AACzD,MAAM,UAAU,SAAS,CAAC,OAAe;IACvC,OAAO,aAAa,CAAC,OAAO,CAAC,CAAC;AAChC,CAAC"}
|
package/dist/verify.d.ts
CHANGED
|
@@ -2,11 +2,15 @@ import type { VerifyResult, ProveResponse } from './types.js';
|
|
|
2
2
|
/**
|
|
3
3
|
* Verify a ZK proof on-chain using server-provided verification info.
|
|
4
4
|
*
|
|
5
|
+
* The contract call is core's `verifyProofOnChain`; the proof and the split
|
|
6
|
+
* public inputs are passed through as they are.
|
|
7
|
+
*
|
|
8
|
+
* @param circuit - Canonical circuit id the proof was generated for
|
|
5
9
|
* @param verification - Chain info from ProveResponse (chainId, verifierAddress, rpcUrl)
|
|
6
10
|
* @param proof - Raw proof hex
|
|
7
11
|
* @param publicInputs - Concatenated public inputs hex
|
|
8
12
|
*/
|
|
9
|
-
export declare function verifyOnChain(verification: {
|
|
13
|
+
export declare function verifyOnChain(circuit: string, verification: {
|
|
10
14
|
chainId: number;
|
|
11
15
|
verifierAddress: string;
|
|
12
16
|
rpcUrl: string;
|
package/dist/verify.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../src/verify.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../src/verify.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAc9D;;;;;;;;;;GAUG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,MAAM,EACf,YAAY,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,eAAe,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EAC1E,KAAK,EAAE,MAAM,EACb,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,YAAY,CAAC,CAiBvB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,WAAW,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,CAK9E"}
|
package/dist/verify.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ethers } from 'ethers';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
];
|
|
2
|
+
import { VERIFIER_ABI, verifyProofOnChain } from '@zkproofport-app/core';
|
|
3
|
+
import { isCanonicalCircuitId } from './circuits.js';
|
|
5
4
|
/**
|
|
6
5
|
* Split concatenated public inputs hex into array of bytes32 values.
|
|
7
6
|
*/
|
|
@@ -16,22 +15,25 @@ function splitPublicInputs(publicInputsHex) {
|
|
|
16
15
|
/**
|
|
17
16
|
* Verify a ZK proof on-chain using server-provided verification info.
|
|
18
17
|
*
|
|
18
|
+
* The contract call is core's `verifyProofOnChain`; the proof and the split
|
|
19
|
+
* public inputs are passed through as they are.
|
|
20
|
+
*
|
|
21
|
+
* @param circuit - Canonical circuit id the proof was generated for
|
|
19
22
|
* @param verification - Chain info from ProveResponse (chainId, verifierAddress, rpcUrl)
|
|
20
23
|
* @param proof - Raw proof hex
|
|
21
24
|
* @param publicInputs - Concatenated public inputs hex
|
|
22
25
|
*/
|
|
23
|
-
export async function verifyOnChain(verification, proof, publicInputs) {
|
|
26
|
+
export async function verifyOnChain(circuit, verification, proof, publicInputs) {
|
|
27
|
+
if (!isCanonicalCircuitId(circuit)) {
|
|
28
|
+
return { valid: false, error: `Unknown circuit '${circuit}'; cannot verify it on-chain.` };
|
|
29
|
+
}
|
|
24
30
|
const provider = new ethers.JsonRpcProvider(verification.rpcUrl);
|
|
25
|
-
const verifier = new ethers.Contract(verification.verifierAddress, VERIFIER_ABI, provider);
|
|
26
31
|
const publicInputsArray = splitPublicInputs(publicInputs);
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return { valid:
|
|
30
|
-
}
|
|
31
|
-
catch (error) {
|
|
32
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
33
|
-
return { valid: false, error: `On-chain verification failed: ${message}` };
|
|
32
|
+
const result = await verifyProofOnChain(circuit, { proofHex: proof, publicInputsHex: publicInputsArray, numPublicInputs: publicInputsArray.length }, provider, { address: verification.verifierAddress, chainId: verification.chainId, abi: VERIFIER_ABI });
|
|
33
|
+
if (result.error !== undefined) {
|
|
34
|
+
return { valid: false, error: `On-chain verification failed: ${result.error}` };
|
|
34
35
|
}
|
|
36
|
+
return { valid: result.valid === true };
|
|
35
37
|
}
|
|
36
38
|
/**
|
|
37
39
|
* Verify a proof using the verification info from a ProveResponse.
|
|
@@ -51,6 +53,6 @@ export async function verifyProof(result) {
|
|
|
51
53
|
if (!result.verification) {
|
|
52
54
|
return { valid: false, error: 'No verification info in response (verifier not deployed on this network)' };
|
|
53
55
|
}
|
|
54
|
-
return verifyOnChain(result.verification, result.proof, result.publicInputs);
|
|
56
|
+
return verifyOnChain(result.circuit, result.verification, result.proof, result.publicInputs);
|
|
55
57
|
}
|
|
56
58
|
//# sourceMappingURL=verify.js.map
|
package/dist/verify.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify.js","sourceRoot":"","sources":["../src/verify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"verify.js","sourceRoot":"","sources":["../src/verify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAGrD;;GAEG;AACH,SAAS,iBAAiB,CAAC,eAAuB;IAChD,MAAM,GAAG,GAAG,eAAe,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC;IAC1F,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC;QACxC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AO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,0EAA0E,EAAE,CAAC;IAC7G,CAAC;IACD,OAAO,aAAa,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC;AAC/F,CAAC"}
|
package/dist/wallets.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The wallet that pays for a proof.
|
|
3
3
|
*
|
|
4
|
-
* ## One interface,
|
|
4
|
+
* ## One interface, two wallets
|
|
5
5
|
*
|
|
6
6
|
* Paying for a proof means signing one EIP-712 message -- an EIP-3009
|
|
7
7
|
* `TransferWithAuthorization` over USDC. Nothing else. No transaction, no gas,
|
|
@@ -17,22 +17,18 @@
|
|
|
17
17
|
* |---|---|---|
|
|
18
18
|
* | a raw private key | `walletFromPrivateKey` | the key |
|
|
19
19
|
* | a Coinbase CDP server wallet | `walletFromCdp` | CDP API key id + secret + wallet secret |
|
|
20
|
-
* | a Circle wallet, including on Arc | `walletFromCircle` | Circle API key + entity secret + wallet id |
|
|
21
20
|
*
|
|
22
|
-
* The chain is chosen separately, when paying. A CDP wallet can pay on
|
|
23
|
-
*
|
|
21
|
+
* The chain is chosen separately, when paying. A CDP wallet can pay on
|
|
22
|
+
* Ethereum or on Base; wallet and chain are independent, and the
|
|
24
23
|
* earlier version of this file got that wrong by baking one into the other.
|
|
25
24
|
*
|
|
26
|
-
* ## Why the CDP
|
|
25
|
+
* ## Why the CDP path is thin
|
|
27
26
|
*
|
|
28
|
-
*
|
|
27
|
+
* Coinbase ships the adapter. `@coinbase/cdp-sdk/x402` exports
|
|
29
28
|
* `fromCdpEvmAccount`, which returns exactly this interface, so the CDP path is
|
|
30
|
-
* a call to their function rather than an EIP-712 client written here.
|
|
31
|
-
* has no x402 adapter, so `walletFromCircle` is the one adapter this file
|
|
32
|
-
* really implements -- eleven lines around `signTypedData`, which is all Circle
|
|
33
|
-
* needs to participate.
|
|
29
|
+
* a call to their function rather than an EIP-712 client written here.
|
|
34
30
|
*
|
|
35
|
-
*
|
|
31
|
+
* The CDP import is lazy. Someone paying from a private key never installs it.
|
|
36
32
|
*/
|
|
37
33
|
import type { PaymentWallet } from './types.js';
|
|
38
34
|
/**
|
|
@@ -59,34 +55,12 @@ export declare function walletFromCdp(opts: {
|
|
|
59
55
|
walletSecret: string;
|
|
60
56
|
walletName?: string;
|
|
61
57
|
}): Promise<PaymentWallet>;
|
|
62
|
-
/**
|
|
63
|
-
* Pay from a Circle developer-controlled wallet -- the way to pay on Arc.
|
|
64
|
-
*
|
|
65
|
-
* Arc is Circle's chain and USDC is its gas asset, so a Circle wallet holding
|
|
66
|
-
* USDC there can pay without holding anything else. `ARC-TESTNET` is the
|
|
67
|
-
* blockchain name in Circle's own SDK types; it is not needed for signing (an
|
|
68
|
-
* authorization is chain-agnostic once the domain names the chain id) and is
|
|
69
|
-
* only used when this wallet is asked which chain it was created for.
|
|
70
|
-
*
|
|
71
|
-
* Note that Arc needs no special case in the payment path itself. Asked
|
|
72
|
-
* directly on 2026-09-09, Arc's USDC at 0x3600...0000 answers name()="USDC",
|
|
73
|
-
* version()="2", decimals()=6, and a DOMAIN_SEPARATOR() that matches what a
|
|
74
|
-
* client computes from those values -- so an Arc authorization is an ordinary
|
|
75
|
-
* USDC authorization and this wallet is an ordinary signer.
|
|
76
|
-
*/
|
|
77
|
-
export declare function walletFromCircle(opts: {
|
|
78
|
-
apiKey: string;
|
|
79
|
-
entitySecret: string;
|
|
80
|
-
walletId: string;
|
|
81
|
-
/** The wallet's address. Read from Circle when omitted. */
|
|
82
|
-
address?: string;
|
|
83
|
-
}): Promise<PaymentWallet>;
|
|
84
58
|
/**
|
|
85
59
|
* The wallet a set of environment variables describes, or an error saying
|
|
86
60
|
* which variables would have been needed.
|
|
87
61
|
*
|
|
88
62
|
* Deliberately refuses to pick when two wallets are configured, rather than
|
|
89
|
-
* preferring one. A machine holding both a
|
|
63
|
+
* preferring one. A machine holding both a private key and a CDP credential has no
|
|
90
64
|
* obvious default, and silently choosing means the money leaves an account the
|
|
91
65
|
* caller did not name.
|
|
92
66
|
*/
|
package/dist/wallets.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallets.d.ts","sourceRoot":"","sources":["../src/wallets.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"wallets.d.ts","sourceRoot":"","sources":["../src/wallets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CASrF;AAED;;;;;;;;;GASG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GAAG,OAAO,CAAC,aAAa,CAAC,CA+BzB;AAED;;;;;;;;GAQG;AACH,wBAAsB,aAAa,CAAC,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,GAAG,OAAO,CAAC,aAAa,CAAC,CAmBjH;AAED,qDAAqD;AACrD,wBAAsB,SAAS,CAC7B,KAAK,EAAE,MAAM,EACb,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,GACpD,OAAO,CAAC,aAAa,CAAC,CAmBxB"}
|
package/dist/wallets.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The wallet that pays for a proof.
|
|
3
3
|
*
|
|
4
|
-
* ## One interface,
|
|
4
|
+
* ## One interface, two wallets
|
|
5
5
|
*
|
|
6
6
|
* Paying for a proof means signing one EIP-712 message -- an EIP-3009
|
|
7
7
|
* `TransferWithAuthorization` over USDC. Nothing else. No transaction, no gas,
|
|
@@ -17,24 +17,19 @@
|
|
|
17
17
|
* |---|---|---|
|
|
18
18
|
* | a raw private key | `walletFromPrivateKey` | the key |
|
|
19
19
|
* | a Coinbase CDP server wallet | `walletFromCdp` | CDP API key id + secret + wallet secret |
|
|
20
|
-
* | a Circle wallet, including on Arc | `walletFromCircle` | Circle API key + entity secret + wallet id |
|
|
21
20
|
*
|
|
22
|
-
* The chain is chosen separately, when paying. A CDP wallet can pay on
|
|
23
|
-
*
|
|
21
|
+
* The chain is chosen separately, when paying. A CDP wallet can pay on
|
|
22
|
+
* Ethereum or on Base; wallet and chain are independent, and the
|
|
24
23
|
* earlier version of this file got that wrong by baking one into the other.
|
|
25
24
|
*
|
|
26
|
-
* ## Why the CDP
|
|
25
|
+
* ## Why the CDP path is thin
|
|
27
26
|
*
|
|
28
|
-
*
|
|
27
|
+
* Coinbase ships the adapter. `@coinbase/cdp-sdk/x402` exports
|
|
29
28
|
* `fromCdpEvmAccount`, which returns exactly this interface, so the CDP path is
|
|
30
|
-
* a call to their function rather than an EIP-712 client written here.
|
|
31
|
-
* has no x402 adapter, so `walletFromCircle` is the one adapter this file
|
|
32
|
-
* really implements -- eleven lines around `signTypedData`, which is all Circle
|
|
33
|
-
* needs to participate.
|
|
29
|
+
* a call to their function rather than an EIP-712 client written here.
|
|
34
30
|
*
|
|
35
|
-
*
|
|
31
|
+
* The CDP import is lazy. Someone paying from a private key never installs it.
|
|
36
32
|
*/
|
|
37
|
-
import { walletFromArcAgent } from './arcWallet.js';
|
|
38
33
|
/**
|
|
39
34
|
* Pay from a raw private key.
|
|
40
35
|
*
|
|
@@ -91,66 +86,12 @@ export async function walletFromCdp(opts) {
|
|
|
91
86
|
describe: () => `CDP wallet ${opts.walletName ?? 'zkproofport-payer'} (${signer.address})`,
|
|
92
87
|
};
|
|
93
88
|
}
|
|
94
|
-
/**
|
|
95
|
-
* Pay from a Circle developer-controlled wallet -- the way to pay on Arc.
|
|
96
|
-
*
|
|
97
|
-
* Arc is Circle's chain and USDC is its gas asset, so a Circle wallet holding
|
|
98
|
-
* USDC there can pay without holding anything else. `ARC-TESTNET` is the
|
|
99
|
-
* blockchain name in Circle's own SDK types; it is not needed for signing (an
|
|
100
|
-
* authorization is chain-agnostic once the domain names the chain id) and is
|
|
101
|
-
* only used when this wallet is asked which chain it was created for.
|
|
102
|
-
*
|
|
103
|
-
* Note that Arc needs no special case in the payment path itself. Asked
|
|
104
|
-
* directly on 2026-09-09, Arc's USDC at 0x3600...0000 answers name()="USDC",
|
|
105
|
-
* version()="2", decimals()=6, and a DOMAIN_SEPARATOR() that matches what a
|
|
106
|
-
* client computes from those values -- so an Arc authorization is an ordinary
|
|
107
|
-
* USDC authorization and this wallet is an ordinary signer.
|
|
108
|
-
*/
|
|
109
|
-
export async function walletFromCircle(opts) {
|
|
110
|
-
let initiateDeveloperControlledWalletsClient;
|
|
111
|
-
try {
|
|
112
|
-
({ initiateDeveloperControlledWalletsClient } = (await import('@circle-fin/developer-controlled-wallets')));
|
|
113
|
-
}
|
|
114
|
-
catch (e) {
|
|
115
|
-
throw new Error(`Paying from a Circle wallet needs @circle-fin/developer-controlled-wallets installed: ` +
|
|
116
|
-
`npm i @circle-fin/developer-controlled-wallets (${e.message})`);
|
|
117
|
-
}
|
|
118
|
-
const circle = initiateDeveloperControlledWalletsClient({
|
|
119
|
-
apiKey: opts.apiKey,
|
|
120
|
-
entitySecret: opts.entitySecret,
|
|
121
|
-
});
|
|
122
|
-
let address = opts.address;
|
|
123
|
-
if (!address) {
|
|
124
|
-
const got = await circle.getWallet({ id: opts.walletId });
|
|
125
|
-
address = got.data?.wallet?.address;
|
|
126
|
-
if (!address) {
|
|
127
|
-
throw new Error(`Circle wallet ${opts.walletId} has no address; check the wallet id and the API key`);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
return {
|
|
131
|
-
address: address,
|
|
132
|
-
async signTypedData(message) {
|
|
133
|
-
const res = await circle.signTypedData({
|
|
134
|
-
walletId: opts.walletId,
|
|
135
|
-
data: JSON.stringify(message),
|
|
136
|
-
memo: 'ZKProofport proof generation fee',
|
|
137
|
-
});
|
|
138
|
-
const signature = res.data?.signature;
|
|
139
|
-
if (!signature) {
|
|
140
|
-
throw new Error(`Circle wallet ${opts.walletId} returned no signature. A wallet can only sign on a chain it was ` +
|
|
141
|
-
`created for -- check it exists on the chain named in the payment's domain.`);
|
|
142
|
-
}
|
|
143
|
-
return signature;
|
|
144
|
-
},
|
|
145
|
-
describe: () => `Circle wallet ${opts.walletId} (${address})`,
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
89
|
/**
|
|
149
90
|
* The wallet a set of environment variables describes, or an error saying
|
|
150
91
|
* which variables would have been needed.
|
|
151
92
|
*
|
|
152
93
|
* Deliberately refuses to pick when two wallets are configured, rather than
|
|
153
|
-
* preferring one. A machine holding both a
|
|
94
|
+
* preferring one. A machine holding both a private key and a CDP credential has no
|
|
154
95
|
* obvious default, and silently choosing means the money leaves an account the
|
|
155
96
|
* caller did not name.
|
|
156
97
|
*/
|
|
@@ -160,13 +101,10 @@ export async function walletFromEnv(env = process.env) {
|
|
|
160
101
|
configured.push('key');
|
|
161
102
|
if (env.CDP_API_KEY_ID)
|
|
162
103
|
configured.push('cdp');
|
|
163
|
-
if (env.CIRCLE_API_KEY)
|
|
164
|
-
configured.push('circle');
|
|
165
104
|
if (configured.length === 0) {
|
|
166
105
|
throw new Error('No payment wallet configured. Set one of:\n' +
|
|
167
106
|
' PAYMENT_PRIVATE_KEY\n' +
|
|
168
|
-
' CDP_API_KEY_ID + CDP_API_KEY_SECRET + CDP_WALLET_SECRET
|
|
169
|
-
' CIRCLE_API_KEY + CIRCLE_ENTITY_SECRET + CIRCLE_WALLET_ID');
|
|
107
|
+
' CDP_API_KEY_ID + CDP_API_KEY_SECRET + CDP_WALLET_SECRET');
|
|
170
108
|
}
|
|
171
109
|
if (configured.length > 1) {
|
|
172
110
|
throw new Error(`More than one payment wallet is configured (${configured.join(', ')}). ` +
|
|
@@ -192,23 +130,8 @@ export async function walletFor(which, env = process.env) {
|
|
|
192
130
|
walletSecret: need('CDP_WALLET_SECRET'),
|
|
193
131
|
walletName: env.CDP_WALLET_NAME,
|
|
194
132
|
});
|
|
195
|
-
case 'arc':
|
|
196
|
-
// No credentials here: Circle's CLI holds the login, and the wallet is
|
|
197
|
-
// whichever agent wallet that login has on Arc. `ARC_AGENT_WALLET` names
|
|
198
|
-
// one when an account has several.
|
|
199
|
-
return walletFromArcAgent({
|
|
200
|
-
address: env.ARC_AGENT_WALLET,
|
|
201
|
-
chain: env.ARC_CLI_CHAIN ?? undefined,
|
|
202
|
-
});
|
|
203
|
-
case 'circle':
|
|
204
|
-
return walletFromCircle({
|
|
205
|
-
apiKey: need('CIRCLE_API_KEY'),
|
|
206
|
-
entitySecret: need('CIRCLE_ENTITY_SECRET'),
|
|
207
|
-
walletId: need('CIRCLE_WALLET_ID'),
|
|
208
|
-
address: env.CIRCLE_WALLET_ADDRESS,
|
|
209
|
-
});
|
|
210
133
|
default:
|
|
211
|
-
throw new Error(`Unknown payment wallet '${which}'. Choose one of: key, cdp
|
|
134
|
+
throw new Error(`Unknown payment wallet '${which}'. Choose one of: key, cdp`);
|
|
212
135
|
}
|
|
213
136
|
}
|
|
214
137
|
//# sourceMappingURL=wallets.js.map
|
package/dist/wallets.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallets.js","sourceRoot":"","sources":["../src/wallets.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"wallets.js","sourceRoot":"","sources":["../src/wallets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAIH;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,UAAkB;IAC3D,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U,EAAE;QACpC,MAAM,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC;QACpB,IAAI,CAAC,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,iBAAiB,KAAK,oBAAoB,IAAI,EAAE,CAAC,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.
|
|
4
|
-
"description": "TypeScript SDK for ZKProofport Coinbase KYC, country, OIDC
|
|
3
|
+
"version": "0.4.1",
|
|
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,9 +35,9 @@
|
|
|
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",
|
|
40
|
+
"@zkproofport-app/core": "0.1.2",
|
|
46
41
|
"ethers": "^6.13.0",
|
|
47
42
|
"viem": "^2.45.2"
|
|
48
43
|
},
|
|
@@ -60,7 +55,6 @@
|
|
|
60
55
|
"directory": "packages/sdk"
|
|
61
56
|
},
|
|
62
57
|
"peerDependencies": {
|
|
63
|
-
"@circle-fin/developer-controlled-wallets": ">=10.0.0",
|
|
64
58
|
"@coinbase/cdp-sdk": ">=1.55.0",
|
|
65
59
|
"@x402/extensions": ">=2.25.0"
|
|
66
60
|
},
|
|
@@ -68,9 +62,6 @@
|
|
|
68
62
|
"@coinbase/cdp-sdk": {
|
|
69
63
|
"optional": true
|
|
70
64
|
},
|
|
71
|
-
"@circle-fin/developer-controlled-wallets": {
|
|
72
|
-
"optional": true
|
|
73
|
-
},
|
|
74
65
|
"@x402/extensions": {
|
|
75
66
|
"optional": true
|
|
76
67
|
}
|
package/dist/arcWallet.d.ts
DELETED
|
@@ -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
|
package/dist/arcWallet.d.ts.map
DELETED
|
@@ -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"}
|