@zkproofport-ai/sdk 0.1.1 → 0.1.2
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 +77 -6
- package/dist/cdp.d.ts +114 -16
- package/dist/cdp.d.ts.map +1 -1
- package/dist/cdp.js +64 -75
- package/dist/cdp.js.map +1 -1
- package/dist/flow.d.ts.map +1 -1
- package/dist/flow.js +1 -1
- package/dist/flow.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/payment.d.ts +3 -1
- package/dist/payment.d.ts.map +1 -1
- package/dist/payment.js +7 -4
- package/dist/payment.js.map +1 -1
- package/dist/types.d.ts +5 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -43,6 +43,7 @@ Before using the SDK, you need:
|
|
|
43
43
|
5. **Payment wallet** (optional) — Wallet with USDC balance for proof payment. Defaults to the attestation wallet. Choose one:
|
|
44
44
|
|
|
45
45
|
- **Same as attestation wallet** — No additional setup. The attestation wallet must hold USDC.
|
|
46
|
+
> ⚠️ **Privacy risk:** Using the attestation wallet for payment exposes your KYC-verified wallet address on-chain in the payment transaction, linking your identity to on-chain activity. Use a separate payment wallet for privacy.
|
|
46
47
|
- **Separate private key** — A different wallet with USDC balance.
|
|
47
48
|
- **CDP MPC wallet** — Coinbase Developer Platform managed wallet. Private keys never leave Coinbase's TEE. Get credentials at [CDP Portal](https://portal.cdp.coinbase.com). Requires additional install:
|
|
48
49
|
```bash
|
|
@@ -101,11 +102,10 @@ import { generateProof, createConfig, fromPrivateKey, CdpWalletSigner, verifyPro
|
|
|
101
102
|
|
|
102
103
|
const config = createConfig();
|
|
103
104
|
const attestationSigner = fromPrivateKey(process.env.ATTESTATION_KEY);
|
|
104
|
-
const paymentSigner =
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
address: process.env.CDP_WALLET_ADDRESS,
|
|
105
|
+
const paymentSigner = new CdpWalletSigner({
|
|
106
|
+
getAddress: () => myWallet.getAddress(),
|
|
107
|
+
signMessage: (msg) => myWallet.signMessage(msg),
|
|
108
|
+
signTypedData: (domain, types, message) => myWallet.signTypedData(domain, types, message),
|
|
109
109
|
});
|
|
110
110
|
|
|
111
111
|
const result = await generateProof(
|
|
@@ -118,6 +118,30 @@ const verification = await verifyProof(result);
|
|
|
118
118
|
console.log('Valid:', verification.valid);
|
|
119
119
|
```
|
|
120
120
|
|
|
121
|
+
### External Wallet Adapter
|
|
122
|
+
|
|
123
|
+
Wrap any external wallet (WalletConnect, MetaMask, etc.) using `fromExternalWallet()`:
|
|
124
|
+
|
|
125
|
+
```typescript
|
|
126
|
+
import { generateProof, createConfig, fromPrivateKey, fromExternalWallet, verifyProof } from '@zkproofport-ai/sdk';
|
|
127
|
+
|
|
128
|
+
const config = createConfig();
|
|
129
|
+
const attestationSigner = fromPrivateKey(process.env.ATTESTATION_KEY);
|
|
130
|
+
|
|
131
|
+
// Wrap external wallet (e.g., from WalletConnect modal, Privy, etc.)
|
|
132
|
+
const externalWallet = await getWalletFromUI(); // Your wallet integration
|
|
133
|
+
const paymentSigner = fromExternalWallet(externalWallet);
|
|
134
|
+
|
|
135
|
+
const result = await generateProof(
|
|
136
|
+
config,
|
|
137
|
+
{ attestation: attestationSigner, payment: paymentSigner },
|
|
138
|
+
{ circuit: 'coinbase_kyc', scope: 'my-app' }
|
|
139
|
+
);
|
|
140
|
+
|
|
141
|
+
const verification = await verifyProof(result);
|
|
142
|
+
console.log('Valid:', verification.valid);
|
|
143
|
+
```
|
|
144
|
+
|
|
121
145
|
## Configuration
|
|
122
146
|
|
|
123
147
|
```typescript
|
|
@@ -132,6 +156,14 @@ const config = createConfig({
|
|
|
132
156
|
easRpcUrl: 'https://mainnet.base.org',
|
|
133
157
|
easGraphqlUrl: 'https://base.easscan.org/graphql',
|
|
134
158
|
});
|
|
159
|
+
|
|
160
|
+
// Custom x402 facilitator (e.g., for CDP with JWT auth)
|
|
161
|
+
const config = createConfig({
|
|
162
|
+
facilitatorUrl: 'https://facilitator.example.com',
|
|
163
|
+
facilitatorHeaders: {
|
|
164
|
+
'Authorization': `Bearer ${process.env.CDP_FACILITATOR_TOKEN}`,
|
|
165
|
+
},
|
|
166
|
+
});
|
|
135
167
|
```
|
|
136
168
|
|
|
137
169
|
**Configuration fields:**
|
|
@@ -141,6 +173,8 @@ const config = createConfig({
|
|
|
141
173
|
| `baseUrl` | string | `https://ai.zkproofport.app` | proofport-ai server URL |
|
|
142
174
|
| `easRpcUrl` | string | `https://mainnet.base.org` | Base Mainnet RPC for EAS attestation queries |
|
|
143
175
|
| `easGraphqlUrl` | string | `https://base.easscan.org/graphql` | EAS GraphQL endpoint for attestation schema queries |
|
|
176
|
+
| `facilitatorUrl` | string | `https://x402.dexter.cash` | x402 payment facilitator URL |
|
|
177
|
+
| `facilitatorHeaders` | object | `{}` | Optional auth headers for custom facilitator (e.g., CDP with JWT) |
|
|
144
178
|
|
|
145
179
|
## Proof Generation
|
|
146
180
|
|
|
@@ -334,6 +368,8 @@ interface ClientConfig {
|
|
|
334
368
|
baseUrl: string;
|
|
335
369
|
easRpcUrl?: string;
|
|
336
370
|
easGraphqlUrl?: string;
|
|
371
|
+
facilitatorUrl?: string; // x402 facilitator URL (default: https://x402.dexter.cash)
|
|
372
|
+
facilitatorHeaders?: Record<string, string>; // Auth headers for custom facilitator
|
|
337
373
|
}
|
|
338
374
|
```
|
|
339
375
|
|
|
@@ -346,6 +382,27 @@ interface ProofportSigner {
|
|
|
346
382
|
signTypedData(domain: {...}, types: {...}, message: {...}): Promise<string>;
|
|
347
383
|
sendTransaction(tx: {...}): Promise<{ hash: string; wait(): Promise<{...}> }>;
|
|
348
384
|
}
|
|
385
|
+
|
|
386
|
+
// Create signer from ethers private key
|
|
387
|
+
function fromPrivateKey(key: string, provider?: ethers.Provider): ProofportSigner;
|
|
388
|
+
|
|
389
|
+
// Create signer from any external wallet (CDP, WalletConnect, Privy, etc.)
|
|
390
|
+
class CdpWalletSigner implements ProofportSigner {
|
|
391
|
+
constructor(wallet: {
|
|
392
|
+
getAddress(): string | Promise<string>;
|
|
393
|
+
signMessage(message: Uint8Array | string): Promise<string>;
|
|
394
|
+
signTypedData(domain: Record<string, unknown>, types: Record<string, Array<{ name: string; type: string }>>, message: Record<string, unknown>): Promise<string>;
|
|
395
|
+
sendTransaction?(tx: { to: string; data: string; value?: bigint }): Promise<{ hash: string; wait(): Promise<{ status: number | null }> }>;
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
// Wrap external wallet (WalletConnect, MetaMask, Privy, etc.)
|
|
400
|
+
function fromExternalWallet(wallet: {
|
|
401
|
+
address: string | (() => Promise<string>);
|
|
402
|
+
signMessage(message: Uint8Array): Promise<string>;
|
|
403
|
+
signTypedData(domain: any, types: any, message: any): Promise<string>;
|
|
404
|
+
sendTransaction?(tx: any): Promise<{ hash: string; wait(): Promise<any> }>;
|
|
405
|
+
}): ProofportSigner;
|
|
349
406
|
```
|
|
350
407
|
|
|
351
408
|
**Proof Parameters:**
|
|
@@ -414,11 +471,25 @@ Payment is transparent to the application. When `generateProof()` runs, the user
|
|
|
414
471
|
- Method: EIP-3009 `TransferWithAuthorization`
|
|
415
472
|
- Token: USDC on Base Mainnet
|
|
416
473
|
- Amount: $0.10 per proof
|
|
417
|
-
- Facilitator: https://
|
|
474
|
+
- Facilitator: `https://x402.dexter.cash` (default, pays gas)
|
|
418
475
|
- User cost: Only USDC, no ETH for gas
|
|
476
|
+
- Custom facilitator: Use `facilitatorUrl` + `facilitatorHeaders` in `ClientConfig` for alternative facilitators (e.g., CDP with JWT auth)
|
|
419
477
|
|
|
420
478
|
The payment transaction hash is included in `result.paymentTxHash` for settlement tracking.
|
|
421
479
|
|
|
480
|
+
### Custom Facilitator (CDP Example)
|
|
481
|
+
|
|
482
|
+
```typescript
|
|
483
|
+
const config = createConfig({
|
|
484
|
+
facilitatorUrl: 'https://cdp-facilitator.example.com',
|
|
485
|
+
facilitatorHeaders: {
|
|
486
|
+
'Authorization': `Bearer ${process.env.CDP_JWT_TOKEN}`,
|
|
487
|
+
},
|
|
488
|
+
});
|
|
489
|
+
|
|
490
|
+
const result = await generateProof(config, signers, params);
|
|
491
|
+
```
|
|
492
|
+
|
|
422
493
|
## Error Handling
|
|
423
494
|
|
|
424
495
|
```typescript
|
package/dist/cdp.d.ts
CHANGED
|
@@ -1,26 +1,100 @@
|
|
|
1
1
|
import type { ProofportSigner } from './signer.js';
|
|
2
2
|
/**
|
|
3
|
-
* CDP
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* Adapter interface for CDP wallet-like objects (or any external wallet).
|
|
4
|
+
*
|
|
5
|
+
* Pass any object that satisfies these method signatures — CDP MPC wallets,
|
|
6
|
+
* viem wallets, Privy embedded wallets, etc. — and wrap it with
|
|
7
|
+
* `CdpWalletSigner` or `fromExternalWallet()` to get a `ProofportSigner`.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* // With @coinbase/cdp-sdk
|
|
12
|
+
* import { CdpClient } from '@coinbase/cdp-sdk';
|
|
13
|
+
* import { CdpWalletSigner } from '@zkproofport-ai/sdk';
|
|
14
|
+
*
|
|
15
|
+
* const cdp = new CdpClient();
|
|
16
|
+
* const wallet = await cdp.evm.getOrCreateWallet({ networkId: 'base' });
|
|
17
|
+
* const account = await wallet.getDefaultAddress();
|
|
18
|
+
*
|
|
19
|
+
* const signer = new CdpWalletSigner({
|
|
20
|
+
* getAddress: () => account.getId(),
|
|
21
|
+
* signMessage: (msg) => account.signPayload({ payload: Buffer.from(msg).toString('hex') }).then(r => r.signature),
|
|
22
|
+
* signTypedData: (domain, types, message) => account.signTypedData({ domain, types, message }),
|
|
23
|
+
* sendTransaction: async (tx) => {
|
|
24
|
+
* const result = await account.sendTransaction(tx);
|
|
25
|
+
* return { hash: result.transactionHash, wait: async () => ({ status: 1 }) };
|
|
26
|
+
* },
|
|
27
|
+
* });
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export interface ExternalWallet {
|
|
31
|
+
/**
|
|
32
|
+
* Returns the wallet's Ethereum address.
|
|
33
|
+
* May be synchronous or asynchronous depending on the provider.
|
|
34
|
+
*/
|
|
35
|
+
getAddress(): string | Promise<string>;
|
|
36
|
+
/**
|
|
37
|
+
* Signs a raw message (personal_sign style).
|
|
38
|
+
* Accepts either a Uint8Array of raw bytes or a pre-encoded string.
|
|
39
|
+
*/
|
|
40
|
+
signMessage(message: Uint8Array | string): Promise<string>;
|
|
41
|
+
/**
|
|
42
|
+
* Signs EIP-712 typed data.
|
|
43
|
+
* Compatible with ethers v6 `signTypedData` and viem `signTypedData` call shapes.
|
|
44
|
+
*/
|
|
45
|
+
signTypedData(domain: Record<string, unknown>, types: Record<string, Array<{
|
|
46
|
+
name: string;
|
|
47
|
+
type: string;
|
|
48
|
+
}>>, message: Record<string, unknown>): Promise<string>;
|
|
49
|
+
/**
|
|
50
|
+
* Sends a transaction and returns the hash plus a `wait()` helper.
|
|
51
|
+
* Optional — omit if the wallet is used only for signing (e.g., attestation signer).
|
|
52
|
+
* If omitted and `sendTransaction` is called on the signer, an error is thrown at runtime.
|
|
53
|
+
*/
|
|
54
|
+
sendTransaction?(tx: {
|
|
55
|
+
to: string;
|
|
56
|
+
data: string;
|
|
57
|
+
value?: bigint;
|
|
58
|
+
}): Promise<{
|
|
59
|
+
hash: string;
|
|
60
|
+
wait(): Promise<{
|
|
61
|
+
status: number | null;
|
|
62
|
+
}>;
|
|
63
|
+
}>;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Adapter that bridges any `ExternalWallet`-compatible object to the
|
|
67
|
+
* `ProofportSigner` interface. No additional npm dependencies required —
|
|
68
|
+
* the caller brings their own wallet implementation.
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```typescript
|
|
72
|
+
* import { CdpWalletSigner } from '@zkproofport-ai/sdk';
|
|
73
|
+
*
|
|
74
|
+
* // Wrap any CDP / external wallet
|
|
75
|
+
* const signer = new CdpWalletSigner(myExternalWallet);
|
|
76
|
+
*
|
|
77
|
+
* // Use as attestation signer
|
|
78
|
+
* const client = new ProofportClient({ ... }, { attestation: signer });
|
|
79
|
+
* ```
|
|
6
80
|
*/
|
|
7
81
|
export declare class CdpWalletSigner implements ProofportSigner {
|
|
8
|
-
private
|
|
9
|
-
|
|
82
|
+
private readonly wallet;
|
|
83
|
+
constructor(wallet: ExternalWallet);
|
|
84
|
+
/** Returns the wallet address, resolving async providers transparently. */
|
|
85
|
+
getAddress(): string | Promise<string>;
|
|
10
86
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
87
|
+
* Signs a raw byte message.
|
|
88
|
+
* Passes the Uint8Array directly to the underlying wallet; the wallet is
|
|
89
|
+
* responsible for any encoding (e.g., personal_sign prefix).
|
|
14
90
|
*/
|
|
15
|
-
static create(opts?: {
|
|
16
|
-
apiKeyId?: string;
|
|
17
|
-
apiKeySecret?: string;
|
|
18
|
-
walletSecret?: string;
|
|
19
|
-
networkId?: string;
|
|
20
|
-
address?: string;
|
|
21
|
-
}): Promise<CdpWalletSigner>;
|
|
22
|
-
getAddress(): string;
|
|
23
91
|
signMessage(message: Uint8Array): Promise<string>;
|
|
92
|
+
/**
|
|
93
|
+
* Signs EIP-712 typed data.
|
|
94
|
+
* The strict `ProofportSigner` domain shape is widened to
|
|
95
|
+
* `Record<string, unknown>` when forwarded so any external wallet
|
|
96
|
+
* implementation can accept it without type conflicts.
|
|
97
|
+
*/
|
|
24
98
|
signTypedData(domain: {
|
|
25
99
|
name: string;
|
|
26
100
|
version: string;
|
|
@@ -30,6 +104,11 @@ export declare class CdpWalletSigner implements ProofportSigner {
|
|
|
30
104
|
name: string;
|
|
31
105
|
type: string;
|
|
32
106
|
}>>, message: Record<string, unknown>): Promise<string>;
|
|
107
|
+
/**
|
|
108
|
+
* Sends a transaction via the underlying wallet.
|
|
109
|
+
* Throws a descriptive error if the wrapped wallet did not provide
|
|
110
|
+
* a `sendTransaction` method (e.g., signing-only attestation wallets).
|
|
111
|
+
*/
|
|
33
112
|
sendTransaction(tx: {
|
|
34
113
|
to: string;
|
|
35
114
|
data: string;
|
|
@@ -41,4 +120,23 @@ export declare class CdpWalletSigner implements ProofportSigner {
|
|
|
41
120
|
}>;
|
|
42
121
|
}>;
|
|
43
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* Convenience factory — equivalent to `new CdpWalletSigner(wallet)`.
|
|
125
|
+
*
|
|
126
|
+
* Useful for returning a `ProofportSigner` without exposing the concrete
|
|
127
|
+
* `CdpWalletSigner` class to callers.
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* ```typescript
|
|
131
|
+
* import { fromExternalWallet } from '@zkproofport-ai/sdk';
|
|
132
|
+
*
|
|
133
|
+
* const signer = fromExternalWallet({
|
|
134
|
+
* getAddress: () => '0xYourAddress',
|
|
135
|
+
* signMessage: (msg) => myWallet.sign(msg),
|
|
136
|
+
* signTypedData: (domain, types, message) =>
|
|
137
|
+
* myWallet.signTypedData({ domain, types, message }),
|
|
138
|
+
* });
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
export declare function fromExternalWallet(wallet: ExternalWallet): ProofportSigner;
|
|
44
142
|
//# sourceMappingURL=cdp.d.ts.map
|
package/dist/cdp.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cdp.d.ts","sourceRoot":"","sources":["../src/cdp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD
|
|
1
|
+
{"version":3,"file":"cdp.d.ts","sourceRoot":"","sources":["../src/cdp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD;;;;;;;;;;;;;;;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AAO,EAAE,MAAM,CAAC;QAChB,iBAAiB,EAAE,MAAM,CAAC;KAC3B,EACD,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,EAC5D,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,OAAO,CAAC,MAAM,CAAC;IAIlB;;;;OAIG;IACG,eAAe,CAAC,EAAE,EAAE;QACxB,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,IAAI,OAAO,CAAC;YAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;SAAE,CAAC,CAAA;KAAE,CAAC;CAU1E;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,cAAc,GAAG,eAAe,CAE1E"}
|
package/dist/cdp.js
CHANGED
|
@@ -1,89 +1,78 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Adapter that bridges any `ExternalWallet`-compatible object to the
|
|
3
|
+
* `ProofportSigner` interface. No additional npm dependencies required —
|
|
4
|
+
* the caller brings their own wallet implementation.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import { CdpWalletSigner } from '@zkproofport-ai/sdk';
|
|
9
|
+
*
|
|
10
|
+
* // Wrap any CDP / external wallet
|
|
11
|
+
* const signer = new CdpWalletSigner(myExternalWallet);
|
|
12
|
+
*
|
|
13
|
+
* // Use as attestation signer
|
|
14
|
+
* const client = new ProofportClient({ ... }, { attestation: signer });
|
|
15
|
+
* ```
|
|
5
16
|
*/
|
|
6
17
|
export class CdpWalletSigner {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
this.provider = provider;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Create a CdpWalletSigner from environment variables.
|
|
14
|
-
* Requires: CDP_API_KEY_ID, CDP_API_KEY_SECRET, CDP_WALLET_SECRET
|
|
15
|
-
* Optional: CDP_WALLET_ADDRESS (to load existing wallet), CDP_NETWORK_ID (default: base-sepolia)
|
|
16
|
-
*/
|
|
17
|
-
static async create(opts) {
|
|
18
|
-
let CdpEvmWalletProvider;
|
|
19
|
-
try {
|
|
20
|
-
// @ts-ignore — optional peer dependency, may not be installed
|
|
21
|
-
const mod = await import('@coinbase/agentkit');
|
|
22
|
-
CdpEvmWalletProvider = mod.CdpEvmWalletProvider;
|
|
23
|
-
}
|
|
24
|
-
catch {
|
|
25
|
-
throw new Error('CDP wallet requires @coinbase/agentkit. Install it: npm install @coinbase/agentkit @coinbase/cdp-sdk');
|
|
26
|
-
}
|
|
27
|
-
const config = {
|
|
28
|
-
apiKeyId: opts?.apiKeyId || process.env.CDP_API_KEY_ID,
|
|
29
|
-
apiKeySecret: opts?.apiKeySecret || process.env.CDP_API_KEY_SECRET,
|
|
30
|
-
walletSecret: opts?.walletSecret || process.env.CDP_WALLET_SECRET,
|
|
31
|
-
networkId: opts?.networkId || process.env.CDP_NETWORK_ID || 'base-sepolia',
|
|
32
|
-
};
|
|
33
|
-
const address = opts?.address || process.env.CDP_WALLET_ADDRESS;
|
|
34
|
-
if (address) {
|
|
35
|
-
config.address = address;
|
|
36
|
-
}
|
|
37
|
-
const provider = await CdpEvmWalletProvider.configureWithWallet(config);
|
|
38
|
-
return new CdpWalletSigner(provider);
|
|
18
|
+
wallet;
|
|
19
|
+
constructor(wallet) {
|
|
20
|
+
this.wallet = wallet;
|
|
39
21
|
}
|
|
22
|
+
/** Returns the wallet address, resolving async providers transparently. */
|
|
40
23
|
getAddress() {
|
|
41
|
-
return this.
|
|
24
|
+
return this.wallet.getAddress();
|
|
42
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Signs a raw byte message.
|
|
28
|
+
* Passes the Uint8Array directly to the underlying wallet; the wallet is
|
|
29
|
+
* responsible for any encoding (e.g., personal_sign prefix).
|
|
30
|
+
*/
|
|
43
31
|
async signMessage(message) {
|
|
44
|
-
return this.
|
|
32
|
+
return this.wallet.signMessage(message);
|
|
45
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Signs EIP-712 typed data.
|
|
36
|
+
* The strict `ProofportSigner` domain shape is widened to
|
|
37
|
+
* `Record<string, unknown>` when forwarded so any external wallet
|
|
38
|
+
* implementation can accept it without type conflicts.
|
|
39
|
+
*/
|
|
46
40
|
async signTypedData(domain, types, message) {
|
|
47
|
-
|
|
48
|
-
// AgentKit's signTypedData expects { domain, types, primaryType, message }
|
|
49
|
-
// Determine primaryType: it's the first key in types that isn't EIP712Domain
|
|
50
|
-
const primaryType = Object.keys(types).find(k => k !== 'EIP712Domain') || Object.keys(types)[0];
|
|
51
|
-
return this.provider.signTypedData({
|
|
52
|
-
domain,
|
|
53
|
-
types: {
|
|
54
|
-
...types,
|
|
55
|
-
EIP712Domain: [
|
|
56
|
-
{ name: 'name', type: 'string' },
|
|
57
|
-
{ name: 'version', type: 'string' },
|
|
58
|
-
{ name: 'chainId', type: 'uint256' },
|
|
59
|
-
{ name: 'verifyingContract', type: 'address' },
|
|
60
|
-
],
|
|
61
|
-
},
|
|
62
|
-
primaryType,
|
|
63
|
-
message,
|
|
64
|
-
});
|
|
41
|
+
return this.wallet.signTypedData(domain, types, message);
|
|
65
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Sends a transaction via the underlying wallet.
|
|
45
|
+
* Throws a descriptive error if the wrapped wallet did not provide
|
|
46
|
+
* a `sendTransaction` method (e.g., signing-only attestation wallets).
|
|
47
|
+
*/
|
|
66
48
|
async sendTransaction(tx) {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
return {
|
|
74
|
-
hash,
|
|
75
|
-
wait: async () => {
|
|
76
|
-
// Use AgentKit's waitForTransactionReceipt if available
|
|
77
|
-
try {
|
|
78
|
-
const receipt = await this.provider.waitForTransactionReceipt(hash);
|
|
79
|
-
return { status: receipt?.status === 'success' ? 1 : 0 };
|
|
80
|
-
}
|
|
81
|
-
catch {
|
|
82
|
-
// Unknown status if receipt method unavailable
|
|
83
|
-
return { status: null };
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
};
|
|
49
|
+
if (typeof this.wallet.sendTransaction !== 'function') {
|
|
50
|
+
throw new Error('CdpWalletSigner: the wrapped wallet does not implement sendTransaction. ' +
|
|
51
|
+
'Provide a sendTransaction method on the ExternalWallet object, or use a ' +
|
|
52
|
+
'different signer for payment transactions.');
|
|
53
|
+
}
|
|
54
|
+
return this.wallet.sendTransaction(tx);
|
|
87
55
|
}
|
|
88
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* Convenience factory — equivalent to `new CdpWalletSigner(wallet)`.
|
|
59
|
+
*
|
|
60
|
+
* Useful for returning a `ProofportSigner` without exposing the concrete
|
|
61
|
+
* `CdpWalletSigner` class to callers.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```typescript
|
|
65
|
+
* import { fromExternalWallet } from '@zkproofport-ai/sdk';
|
|
66
|
+
*
|
|
67
|
+
* const signer = fromExternalWallet({
|
|
68
|
+
* getAddress: () => '0xYourAddress',
|
|
69
|
+
* signMessage: (msg) => myWallet.sign(msg),
|
|
70
|
+
* signTypedData: (domain, types, message) =>
|
|
71
|
+
* myWallet.signTypedData({ domain, types, message }),
|
|
72
|
+
* });
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
export function fromExternalWallet(wallet) {
|
|
76
|
+
return new CdpWalletSigner(wallet);
|
|
77
|
+
}
|
|
89
78
|
//# sourceMappingURL=cdp.js.map
|
package/dist/cdp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cdp.js","sourceRoot":"","sources":["../src/cdp.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cdp.js","sourceRoot":"","sources":["../src/cdp.ts"],"names":[],"mappings":"AAiEA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,eAAe;IACT,MAAM,CAAiB;IAExC,YAAY,MAAsB;QAChC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,2EAA2E;IAC3E,UAAU;QACR,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;IAClC,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,WAAW,CAAC,OAAmB;QACnC,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAC1C,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,aAAa,CACjB,MAKC,EACD,KAA4D,EAC5D,OAAgC;QAEhC,OAAO,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,MAAiC,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACtF,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,eAAe,CAAC,EAIrB;QACC,IAAI,OAAO,IAAI,CAAC,MAAM,CAAC,eAAe,KAAK,UAAU,EAAE,CAAC;YACtD,MAAM,IAAI,KAAK,CACb,0EAA0E;gBACxE,0EAA0E;gBAC1E,4CAA4C,CAC/C,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;IACzC,CAAC;CACF;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAsB;IACvD,OAAO,IAAI,eAAe,CAAC,MAAM,CAAC,CAAC;AACrC,CAAC"}
|
package/dist/flow.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flow.d.ts","sourceRoot":"","sources":["../src/flow.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,YAAY,EAEZ,WAAW,EACX,WAAW,EACX,UAAU,EAEX,MAAM,YAAY,CAAC;AAMpB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAKnD,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI,CAAC;CACrC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE;IAAE,WAAW,EAAE,eAAe,CAAC;IAAC,OAAO,CAAC,EAAE,eAAe,CAAA;CAAE,EACpE,MAAM,EAAE,WAAW,EACnB,SAAS,CAAC,EAAE,aAAa,GACxB,OAAO,CAAC,WAAW,CAAC,
|
|
1
|
+
{"version":3,"file":"flow.d.ts","sourceRoot":"","sources":["../src/flow.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,YAAY,EAEZ,WAAW,EACX,WAAW,EACX,UAAU,EAEX,MAAM,YAAY,CAAC;AAMpB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAKnD,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI,CAAC;CACrC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE;IAAE,WAAW,EAAE,eAAe,CAAC;IAAC,OAAO,CAAC,EAAE,eAAe,CAAA;CAAE,EACpE,MAAM,EAAE,WAAW,EACnB,SAAS,CAAC,EAAE,aAAa,GACxB,OAAO,CAAC,WAAW,CAAC,CAgGtB"}
|
package/dist/flow.js
CHANGED
|
@@ -67,7 +67,7 @@ export async function generateProof(config, signers, params, callbacks) {
|
|
|
67
67
|
network: challenge.payment.network,
|
|
68
68
|
instruction: challenge.payment.description,
|
|
69
69
|
};
|
|
70
|
-
const paymentTxHash = await makePayment(paymentSigner, paymentInfo);
|
|
70
|
+
const paymentTxHash = await makePayment(paymentSigner, paymentInfo, config.facilitatorUrl || challenge.facilitatorUrl, config.facilitatorHeaders);
|
|
71
71
|
recordStep(4, 'Make Payment', { txHash: paymentTxHash }, t);
|
|
72
72
|
// Step 5: Submit proof (encrypted or plaintext based on TEE availability)
|
|
73
73
|
t = Date.now();
|
package/dist/flow.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flow.js","sourceRoot":"","sources":["../src/flow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAShC,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAE/D,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAM5C;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,MAAoB,EACpB,OAAoE,EACpE,MAAmB,EACnB,SAAyB;IAEzB,MAAM,SAAS,GAAc,gBAAgB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC9D,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,IAAI,WAAW,CAAC;IAC1C,MAAM,aAAa,GAAG,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,WAAW,CAAC;IAE7D,MAAM,KAAK,GAAiB,EAAE,CAAC;IAC/B,SAAS,UAAU,CAAI,IAAY,EAAE,IA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AM,EAAE;YACxC,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,MAAM;YACN,aAAa;YACb,YAAY,EAAE,SAAS,CAAC,KAAK;SAC9B,CAAC,CAAC;QACH,UAAU,CAAC,CAAC,EAAE,gBAAgB,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC;IACpD,CAAC;IAED,OAAO;QACL,KAAK,EAAE,aAAa,CAAC,KAAK;QAC1B,YAAY,EAAE,aAAa,CAAC,YAAY;QACxC,eAAe,EAAE,aAAa,CAAC,eAAe;QAC9C,aAAa;QACb,WAAW,EAAE,aAAa,CAAC,WAAW;QACtC,MAAM,EAAE,aAAa,CAAC,MAAM;QAC5B,YAAY,EAAE,aAAa,CAAC,YAAY;KACzC,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -14,7 +14,8 @@ export { encryptForTee } from './tee.js';
|
|
|
14
14
|
export type { EncryptedEnvelope } from './tee.js';
|
|
15
15
|
export type { ProofportSigner } from './signer.js';
|
|
16
16
|
export { EthersWalletSigner, fromEthersWallet, fromPrivateKey } from './signer.js';
|
|
17
|
-
export { CdpWalletSigner } from './cdp.js';
|
|
17
|
+
export { CdpWalletSigner, fromExternalWallet } from './cdp.js';
|
|
18
|
+
export type { ExternalWallet } from './cdp.js';
|
|
18
19
|
export { fetchAttestation, fetchAttestationFromEAS, fetchRawTransaction, recoverAttesterPubkey, getSignerAddress, } from './attestation.js';
|
|
19
20
|
export { SimpleMerkleTree, findSignerIndex, buildSignerMerkleTree, } from './merkle.js';
|
|
20
21
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,YAAY,EACZ,WAAW,EACX,SAAS,EACT,WAAW,EACX,mBAAmB,EACnB,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,aAAa,EACb,YAAY,E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EAChB,uBAAuB,EACvB,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,qBAAqB,GACtB,MAAM,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -18,7 +18,7 @@ export { buildProverToml } from './toml.js';
|
|
|
18
18
|
export { encryptForTee } from './tee.js';
|
|
19
19
|
export { EthersWalletSigner, fromEthersWallet, fromPrivateKey } from './signer.js';
|
|
20
20
|
// CDP (Coinbase Developer Platform) signer
|
|
21
|
-
export { CdpWalletSigner } from './cdp.js';
|
|
21
|
+
export { CdpWalletSigner, fromExternalWallet } from './cdp.js';
|
|
22
22
|
// Attestation
|
|
23
23
|
export { fetchAttestation, fetchAttestationFromEAS, fetchRawTransaction, recoverAttesterPubkey, getSignerAddress, } from './attestation.js';
|
|
24
24
|
// Merkle
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE9D,YAAY;AACZ,OAAO,EACL,QAAQ,EACR,0BAA0B,EAC1B,kBAAkB,EAClB,cAAc,GACf,MAAM,gBAAgB,CAAC;AAExB,gBAAgB;AAChB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,0BAA0B;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAG1C,4CAA4C;AAC5C,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAEzD,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E5C,iBAAiB;AACjB,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAKzC,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAEnF,2CAA2C;AAC3C,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAG/D,cAAc;AACd,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAE1B,SAAS;AACT,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,qBAAqB,GACtB,MAAM,aAAa,CAAC"}
|
package/dist/payment.d.ts
CHANGED
|
@@ -9,7 +9,9 @@ import type { ProofportSigner } from './signer.js';
|
|
|
9
9
|
*
|
|
10
10
|
* @param signer - ProofportSigner (ethers, CDP MPC, or any implementation)
|
|
11
11
|
* @param payment - PaymentInfo from session or 402 response
|
|
12
|
+
* @param facilitatorUrl - Optional x402 facilitator URL (defaults to https://x402.dexter.cash)
|
|
13
|
+
* @param facilitatorHeaders - Optional headers for facilitator auth (e.g., CDP Bearer token)
|
|
12
14
|
* @returns Transaction hash
|
|
13
15
|
*/
|
|
14
|
-
export declare function makePayment(signer: ProofportSigner, payment: PaymentInfo): Promise<string>;
|
|
16
|
+
export declare function makePayment(signer: ProofportSigner, payment: PaymentInfo, facilitatorUrl?: string, facilitatorHeaders?: Record<string, string>): Promise<string>;
|
|
15
17
|
//# sourceMappingURL=payment.d.ts.map
|
package/dist/payment.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payment.d.ts","sourceRoot":"","sources":["../src/payment.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAenD
|
|
1
|
+
{"version":3,"file":"payment.d.ts","sourceRoot":"","sources":["../src/payment.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAenD;;;;;;;;;;;;GAYG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE,WAAW,EACpB,cAAc,CAAC,EAAE,MAAM,EACvB,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC1C,OAAO,CAAC,MAAM,CAAC,CAuGjB"}
|
package/dist/payment.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ethers } from 'ethers';
|
|
2
|
-
const
|
|
2
|
+
const DEFAULT_X402_FACILITATOR = 'https://x402.dexter.cash';
|
|
3
3
|
const CHAIN_IDS = {
|
|
4
4
|
'base-sepolia': 84532,
|
|
5
5
|
'base': 8453,
|
|
@@ -18,9 +18,12 @@ const USDC_DOMAIN_NAMES = {
|
|
|
18
18
|
*
|
|
19
19
|
* @param signer - ProofportSigner (ethers, CDP MPC, or any implementation)
|
|
20
20
|
* @param payment - PaymentInfo from session or 402 response
|
|
21
|
+
* @param facilitatorUrl - Optional x402 facilitator URL (defaults to https://x402.dexter.cash)
|
|
22
|
+
* @param facilitatorHeaders - Optional headers for facilitator auth (e.g., CDP Bearer token)
|
|
21
23
|
* @returns Transaction hash
|
|
22
24
|
*/
|
|
23
|
-
export async function makePayment(signer, payment) {
|
|
25
|
+
export async function makePayment(signer, payment, facilitatorUrl, facilitatorHeaders) {
|
|
26
|
+
const facilitator = facilitatorUrl || DEFAULT_X402_FACILITATOR;
|
|
24
27
|
const network = payment.network;
|
|
25
28
|
const chainId = CHAIN_IDS[network];
|
|
26
29
|
if (!chainId) {
|
|
@@ -95,9 +98,9 @@ export async function makePayment(signer, payment) {
|
|
|
95
98
|
},
|
|
96
99
|
},
|
|
97
100
|
};
|
|
98
|
-
const settleResponse = await fetch(`${
|
|
101
|
+
const settleResponse = await fetch(`${facilitator}/settle`, {
|
|
99
102
|
method: 'POST',
|
|
100
|
-
headers: { 'Content-Type': 'application/json' },
|
|
103
|
+
headers: { 'Content-Type': 'application/json', ...facilitatorHeaders },
|
|
101
104
|
body: JSON.stringify(settlePayload),
|
|
102
105
|
});
|
|
103
106
|
if (!settleResponse.ok) {
|
package/dist/payment.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payment.js","sourceRoot":"","sources":["../src/payment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIhC,MAAM,
|
|
1
|
+
{"version":3,"file":"payment.js","sourceRoot":"","sources":["../src/payment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIhC,MAAM,wBAAwB,GAAG,0BAA0B,CAAC;AAE5D,MAAM,SAAS,GAA2B;IACxC,cAAc,EAAE,KAAK;IACrB,MAAM,EAAE,IAAI;CACb,CAAC;AAEF,uEAAuE;AACvE,MAAM,iBAAiB,GAA2B;IAChD,cAAc,EAAE,MAAM;IACtB,MAAM,EAAE,UAAU;CACnB,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,MAAuB,EACvB,OAAoB,EACpB,cAAuB,EACvB,kBAA2C;IAE3C,MAAM,WAAW,GAAG,cAAc,IAAI,wBAAwB,CAAC;IAC/D,MAAM,OAAO,GAAG,OAAO,CAAC,OAAkC,CAAC;IAC3D,MAAM,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;IACnC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,wBAAwB,OAAO,EAAE,CAAC,CAAC;IACrD,CAAC;IAED,yDAAyD;IACzD,MAAM,KAAK,GAAG,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,KAAK,E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IAC1D,MAAM,MAAM,GAAG,YAAY,CAAC,MAAM,IAAI,YAAY,CAAC,WAAW,EAAE,IAAI,IAAI,YAAY,CAAC,WAAW,CAAC;IACjG,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,uBAAuB,YAAY,CAAC,WAAW,IAAI,qBAAqB,EAAE,CAAC,CAAC;IAC9F,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -13,6 +13,10 @@ export interface ClientConfig {
|
|
|
13
13
|
easRpcUrl?: string;
|
|
14
14
|
/** EAS GraphQL endpoint */
|
|
15
15
|
easGraphqlUrl?: string;
|
|
16
|
+
/** x402 facilitator URL for payment settlement */
|
|
17
|
+
facilitatorUrl?: string;
|
|
18
|
+
/** Optional headers for facilitator auth (e.g., CDP Bearer token) */
|
|
19
|
+
facilitatorHeaders?: Record<string, string>;
|
|
16
20
|
}
|
|
17
21
|
export interface PaymentInfo {
|
|
18
22
|
nonce: string;
|
|
@@ -41,6 +45,7 @@ export interface ChallengeResponse {
|
|
|
41
45
|
message: string;
|
|
42
46
|
nonce: string;
|
|
43
47
|
payment: PaymentRequirements;
|
|
48
|
+
facilitatorUrl?: string;
|
|
44
49
|
teePublicKey?: {
|
|
45
50
|
publicKey: string;
|
|
46
51
|
keyId: string;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,uCAAuC;AACvC,MAAM,MAAM,WAAW,GAAG,cAAc,GAAG,kBAAkB,CAAC;AAE9D,uDAAuD;AACvD,MAAM,MAAM,SAAS,GAAG,sBAAsB,GAAG,8BAA8B,CAAC;AAEhF,0DAA0D;AAC1D,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,WAAW,EAAE,SAAS,CAG3D,CAAC;AAEF,+DAA+D;AAC/D,eAAO,MAAM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