@x402r/evm 0.0.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 ADDED
@@ -0,0 +1,44 @@
1
+ # @x402r/evm
2
+
3
+ Escrow payment scheme for x402 HTTP 402 flows. Bridges the x402 protocol with x402r escrow contracts on Base.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @x402r/evm
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ### Client — Create payment payloads
14
+
15
+ ```typescript
16
+ import { createPaymentPayload } from "@x402r/evm/escrow/client";
17
+
18
+ const payload = await createPaymentPayload(requirements, walletClient);
19
+ ```
20
+
21
+ ### Server — Register with x402 resource server
22
+
23
+ ```typescript
24
+ import { EscrowServerScheme } from "@x402r/evm/escrow/server";
25
+
26
+ const scheme = new EscrowServerScheme();
27
+ server.register("eip155:84532", scheme);
28
+ ```
29
+
30
+ ## Exports
31
+
32
+ - `@x402r/evm/escrow/client` — `createPaymentPayload()`, `EscrowScheme`
33
+ - `@x402r/evm/escrow/server` — `EscrowServerScheme`
34
+ - `@x402r/evm/escrow/facilitator` — Settlement and verification
35
+ - `@x402r/evm/escrow/types` — `EscrowExtra`, `EscrowPayload`
36
+
37
+ ## Links
38
+
39
+ - [Documentation](https://docs.x402r.org)
40
+ - [GitHub](https://github.com/BackTrackCo/x402r-scheme)
41
+
42
+ ## License
43
+
44
+ MIT
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Escrow Scheme - Client
3
+ * Creates payment payloads for escrow payments
4
+ */
5
+ import type { WalletClient } from "viem";
6
+ import type { EscrowExtra, EscrowPayload } from "../../shared/types.js";
7
+ export interface PaymentRequirements {
8
+ scheme: string;
9
+ network: string;
10
+ amount: string;
11
+ asset: `0x${string}`;
12
+ payTo: `0x${string}`;
13
+ extra: EscrowExtra;
14
+ }
15
+ /**
16
+ * Create an escrow payment payload from payment requirements
17
+ */
18
+ export declare function createPaymentPayload(requirements: PaymentRequirements, wallet: WalletClient): Promise<EscrowPayload>;
19
+ export declare const EscrowScheme: {
20
+ scheme: "escrow";
21
+ createPaymentPayload: typeof createPaymentPayload;
22
+ };
23
+ export type { EscrowExtra, EscrowPayload } from "../../shared/types.js";
24
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/escrow/client/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAOzC,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAExE,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,KAAK,MAAM,EAAE,CAAC;IACrB,KAAK,EAAE,KAAK,MAAM,EAAE,CAAC;IACrB,KAAK,EAAE,WAAW,CAAC;CACpB;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CACxC,YAAY,EAAE,mBAAmB,EACjC,MAAM,EAAE,YAAY,GACnB,OAAO,CAAC,aAAa,CAAC,CAmDxB;AAED,eAAO,MAAM,YAAY;;;CAGxB,CAAC;AAEF,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Escrow Scheme - Client
3
+ * Creates payment payloads for escrow payments
4
+ */
5
+ import { computeEscrowNonce, signERC3009, generateSalt, } from "../../shared/nonce.js";
6
+ import { MAX_UINT48 } from "../../shared/constants.js";
7
+ /**
8
+ * Create an escrow payment payload from payment requirements
9
+ */
10
+ export async function createPaymentPayload(requirements, wallet) {
11
+ const { escrowAddress, operatorAddress, tokenCollector, minFeeBps = 0, maxFeeBps = 0, feeReceiver, preApprovalExpirySeconds, refundExpirySeconds, authorizationExpirySeconds, } = requirements.extra;
12
+ const chainId = await wallet.getChainId();
13
+ const maxAmount = requirements.amount;
14
+ const paymentInfo = {
15
+ operator: operatorAddress,
16
+ receiver: requirements.payTo,
17
+ token: requirements.asset,
18
+ maxAmount,
19
+ preApprovalExpiry: preApprovalExpirySeconds ?? MAX_UINT48,
20
+ authorizationExpiry: authorizationExpirySeconds ?? MAX_UINT48,
21
+ refundExpiry: refundExpirySeconds ?? MAX_UINT48,
22
+ minFeeBps,
23
+ maxFeeBps,
24
+ feeReceiver: feeReceiver ?? operatorAddress,
25
+ salt: generateSalt(),
26
+ };
27
+ const nonce = computeEscrowNonce(chainId, escrowAddress, paymentInfo);
28
+ // ERC-3009 authorization - validBefore MUST match what contract passes to receiveWithAuthorization
29
+ // The contract uses paymentInfo.preApprovalExpiry as validBefore
30
+ const authorization = {
31
+ from: wallet.account.address,
32
+ to: tokenCollector,
33
+ value: maxAmount,
34
+ validAfter: "0",
35
+ validBefore: String(paymentInfo.preApprovalExpiry),
36
+ nonce,
37
+ };
38
+ const signature = await signERC3009(wallet, authorization, requirements.extra, requirements.asset);
39
+ return { authorization, signature, paymentInfo };
40
+ }
41
+ export const EscrowScheme = {
42
+ scheme: "escrow",
43
+ createPaymentPayload,
44
+ };
45
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/escrow/client/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACL,kBAAkB,EAClB,WAAW,EACX,YAAY,GACb,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAYvD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,YAAiC,EACjC,MAAoB;IAEpB,MAAM,EACJ,aAAa,EACb,eAAe,EACf,cAAc,EACd,SAAS,GAAG,CAAC,EACb,SAAS,GAAG,CAAC,EACb,WAAW,EACX,wBAAwB,EACxB,mBAAmB,EACnB,0BAA0B,GAC3B,GAAG,YAAY,CAAC,KAAK,CAAC;IAEvB,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,UAAU,EAAE,CAAC;IAC1C,MAAM,SAAS,GAAG,YAAY,CAAC,MAAM,CAAC;IAEtC,MAAM,WAAW,GAAG;QAClB,QAAQ,EAAE,eAAe;QACzB,QAAQ,EAAE,YAAY,CAAC,KAAK;QAC5B,KAAK,EAAE,YAAY,CAAC,KAAK;QACzB,SAAS;QACT,iBAAiB,EAAE,wBAAwB,IAAI,UAAU;QACzD,mBAAmB,EAAE,0BAA0B,IAAI,UAAU;QAC7D,YAAY,EAAE,mBAAmB,IAAI,UAAU;QAC/C,SAAS;QACT,SAAS;QACT,WAAW,EAAE,WAAW,IAAI,eAAe;QAC3C,IAAI,EAAE,YAAY,EAAE;KACrB,CAAC;IAEF,MAAM,KAAK,GAAG,kBAAkB,CAAC,OAAO,EAAE,aAAa,EAAE,WAAW,CAAC,CAAC;IAEtE,mGAAmG;IACnG,iEAAiE;IACjE,MAAM,aAAa,GAAG;QACpB,IAAI,EAAE,MAAM,CAAC,OAAQ,CAAC,OAAO;QAC7B,EAAE,EAAE,cAAc;QAClB,KAAK,EAAE,SAAS;QAChB,UAAU,EAAE,GAAG;QACf,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,iBAAiB,CAAC;QAClD,KAAK;KACN,CAAC;IAEF,MAAM,SAAS,GAAG,MAAM,WAAW,CACjC,MAAM,EACN,aAAa,EACb,YAAY,CAAC,KAAK,EAClB,YAAY,CAAC,KAAK,CACnB,CAAC;IAEF,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;AACnD,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,MAAM,EAAE,QAAiB;IACzB,oBAAoB;CACrB,CAAC"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Escrow Scheme - Facilitator
3
+ * Handles verification and settlement of escrow payments.
4
+ *
5
+ * Implements x402's SchemeNetworkFacilitator interface so the escrow scheme
6
+ * is a drop-in for the x402 facilitator, just like ExactEvmScheme.
7
+ */
8
+ import type { Network, PaymentPayload, PaymentRequirements, SchemeNetworkFacilitator, SettleResponse, VerifyResponse } from "@x402/core/types";
9
+ import type { FacilitatorEvmSigner } from "@x402/evm";
10
+ import { x402Facilitator } from "@x402/core/facilitator";
11
+ /**
12
+ * Escrow Facilitator Scheme - implements x402's SchemeNetworkFacilitator
13
+ *
14
+ * The facilitator is operator-agnostic: it does not store operator/escrow/tokenCollector
15
+ * config. Those values are set by the merchant via `refundable()` and arrive in
16
+ * `requirements.extra` at verify/settle time.
17
+ */
18
+ export declare class EscrowFacilitatorScheme implements SchemeNetworkFacilitator {
19
+ private signer;
20
+ readonly scheme = "escrow";
21
+ readonly caipFamily = "eip155:*";
22
+ constructor(signer: FacilitatorEvmSigner);
23
+ getSigners(_network: string): string[];
24
+ getExtra(_network: string): Record<string, unknown>;
25
+ verify(payload: PaymentPayload, requirements: PaymentRequirements): Promise<VerifyResponse>;
26
+ settle(payload: PaymentPayload, requirements: PaymentRequirements): Promise<SettleResponse>;
27
+ }
28
+ /**
29
+ * Register escrow scheme with x402Facilitator
30
+ *
31
+ * The facilitator is operator-agnostic — it supports any operator. Operator,
32
+ * escrow, and tokenCollector addresses are provided per-request by the merchant
33
+ * via `refundable()` and arrive in `requirements.extra`.
34
+ *
35
+ * @example
36
+ * ```typescript
37
+ * const facilitator = new x402Facilitator();
38
+ * registerEscrowScheme(facilitator, {
39
+ * signer: evmSigner,
40
+ * networks: "eip155:84532",
41
+ * });
42
+ * ```
43
+ */
44
+ export declare function registerEscrowScheme(facilitator: x402Facilitator, config: {
45
+ signer: FacilitatorEvmSigner;
46
+ networks: Network | Network[];
47
+ }): x402Facilitator;
48
+ export type { EscrowExtra, EscrowPayload } from "../../shared/types.js";
49
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/escrow/facilitator/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,OAAO,EACP,cAAc,EACd,mBAAmB,EACnB,wBAAwB,EACxB,cAAc,EACd,cAAc,EACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAwBzD;;;;;;GAMG;AACH,qBAAa,uBAAwB,YAAW,wBAAwB;IAI1D,OAAO,CAAC,MAAM;IAH1B,QAAQ,CAAC,MAAM,YAAY;IAC3B,QAAQ,CAAC,UAAU,cAAc;gBAEb,MAAM,EAAE,oBAAoB;IAEhD,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE;IAItC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAI7C,MAAM,CACV,OAAO,EAAE,cAAc,EACvB,YAAY,EAAE,mBAAmB,GAChC,OAAO,CAAC,cAAc,CAAC;IAgDpB,MAAM,CACV,OAAO,EAAE,cAAc,EACvB,YAAY,EAAE,mBAAmB,GAChC,OAAO,CAAC,cAAc,CAAC;CAuD3B;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,eAAe,EAC5B,MAAM,EAAE;IACN,MAAM,EAAE,oBAAoB,CAAC;IAC7B,QAAQ,EAAE,OAAO,GAAG,OAAO,EAAE,CAAC;CAC/B,GACA,eAAe,CAMjB;AAED,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,146 @@
1
+ /**
2
+ * Escrow Scheme - Facilitator
3
+ * Handles verification and settlement of escrow payments.
4
+ *
5
+ * Implements x402's SchemeNetworkFacilitator interface so the escrow scheme
6
+ * is a drop-in for the x402 facilitator, just like ExactEvmScheme.
7
+ */
8
+ import { OPERATOR_ABI } from "../../shared/constants.js";
9
+ import { verifyERC3009Signature } from "../../shared/nonce.js";
10
+ /**
11
+ * Parse chainId from CAIP-2 network identifier
12
+ * @param network - CAIP-2 network identifier (e.g., 'eip155:84532')
13
+ * @returns The chain ID as a number
14
+ */
15
+ function parseChainId(network) {
16
+ const parts = network.split(":");
17
+ if (parts.length !== 2 || parts[0] !== "eip155") {
18
+ throw new Error(`Invalid network format: ${network}. Expected 'eip155:<chainId>'`);
19
+ }
20
+ const chainId = parseInt(parts[1], 10);
21
+ if (isNaN(chainId)) {
22
+ throw new Error(`Invalid chainId in network: ${network}`);
23
+ }
24
+ return chainId;
25
+ }
26
+ /**
27
+ * Escrow Facilitator Scheme - implements x402's SchemeNetworkFacilitator
28
+ *
29
+ * The facilitator is operator-agnostic: it does not store operator/escrow/tokenCollector
30
+ * config. Those values are set by the merchant via `refundable()` and arrive in
31
+ * `requirements.extra` at verify/settle time.
32
+ */
33
+ export class EscrowFacilitatorScheme {
34
+ signer;
35
+ scheme = "escrow";
36
+ caipFamily = "eip155:*";
37
+ constructor(signer) {
38
+ this.signer = signer;
39
+ }
40
+ getSigners(_network) {
41
+ return [...this.signer.getAddresses()];
42
+ }
43
+ getExtra(_network) {
44
+ return { name: "USDC", version: "2" };
45
+ }
46
+ async verify(payload, requirements) {
47
+ const escrowPayload = payload.payload;
48
+ const extra = requirements.extra;
49
+ const chainId = parseChainId(requirements.network);
50
+ // Verify ERC-3009 signature
51
+ const isValidSignature = await verifyERC3009Signature(this.signer, escrowPayload.authorization, escrowPayload.signature, { ...extra, chainId }, requirements.asset);
52
+ if (!isValidSignature) {
53
+ return { isValid: false, invalidReason: "Invalid ERC-3009 signature" };
54
+ }
55
+ // Verify amount meets requirements
56
+ if (BigInt(escrowPayload.authorization.value) <
57
+ BigInt(requirements.amount)) {
58
+ return { isValid: false, invalidReason: "Insufficient payment amount" };
59
+ }
60
+ // Verify token matches
61
+ if (escrowPayload.paymentInfo.token.toLowerCase() !==
62
+ requirements.asset.toLowerCase()) {
63
+ return { isValid: false, invalidReason: "Token mismatch" };
64
+ }
65
+ // Verify receiver matches
66
+ if (escrowPayload.paymentInfo.receiver.toLowerCase() !==
67
+ requirements.payTo.toLowerCase()) {
68
+ return { isValid: false, invalidReason: "Receiver mismatch" };
69
+ }
70
+ return {
71
+ isValid: true,
72
+ payer: escrowPayload.authorization.from,
73
+ };
74
+ }
75
+ async settle(payload, requirements) {
76
+ const escrowPayload = payload.payload;
77
+ const extra = requirements.extra;
78
+ const { authorizeAddress, operatorAddress, tokenCollector } = extra;
79
+ const paymentInfo = {
80
+ operator: escrowPayload.paymentInfo.operator,
81
+ payer: escrowPayload.authorization.from,
82
+ receiver: escrowPayload.paymentInfo.receiver,
83
+ token: escrowPayload.paymentInfo.token,
84
+ maxAmount: BigInt(escrowPayload.paymentInfo.maxAmount),
85
+ preApprovalExpiry: escrowPayload.paymentInfo.preApprovalExpiry,
86
+ authorizationExpiry: escrowPayload.paymentInfo.authorizationExpiry,
87
+ refundExpiry: escrowPayload.paymentInfo.refundExpiry,
88
+ minFeeBps: escrowPayload.paymentInfo.minFeeBps,
89
+ maxFeeBps: escrowPayload.paymentInfo.maxFeeBps,
90
+ feeReceiver: escrowPayload.paymentInfo.feeReceiver,
91
+ salt: BigInt(escrowPayload.paymentInfo.salt),
92
+ };
93
+ // Pass raw signature - ERC3009PaymentCollector expects raw bytes, not ABI-encoded
94
+ const collectorData = escrowPayload.signature;
95
+ const target = authorizeAddress ?? operatorAddress;
96
+ try {
97
+ const txHash = await this.signer.writeContract({
98
+ address: target,
99
+ abi: OPERATOR_ABI,
100
+ functionName: "authorize",
101
+ args: [
102
+ paymentInfo,
103
+ BigInt(escrowPayload.authorization.value),
104
+ tokenCollector,
105
+ collectorData,
106
+ ],
107
+ });
108
+ return {
109
+ success: true,
110
+ transaction: txHash,
111
+ network: requirements.network,
112
+ payer: escrowPayload.authorization.from,
113
+ };
114
+ }
115
+ catch (error) {
116
+ return {
117
+ success: false,
118
+ errorReason: error instanceof Error ? error.message : "Settlement failed",
119
+ transaction: "",
120
+ network: requirements.network,
121
+ payer: escrowPayload.authorization.from,
122
+ };
123
+ }
124
+ }
125
+ }
126
+ /**
127
+ * Register escrow scheme with x402Facilitator
128
+ *
129
+ * The facilitator is operator-agnostic — it supports any operator. Operator,
130
+ * escrow, and tokenCollector addresses are provided per-request by the merchant
131
+ * via `refundable()` and arrive in `requirements.extra`.
132
+ *
133
+ * @example
134
+ * ```typescript
135
+ * const facilitator = new x402Facilitator();
136
+ * registerEscrowScheme(facilitator, {
137
+ * signer: evmSigner,
138
+ * networks: "eip155:84532",
139
+ * });
140
+ * ```
141
+ */
142
+ export function registerEscrowScheme(facilitator, config) {
143
+ facilitator.register(config.networks, new EscrowFacilitatorScheme(config.signer));
144
+ return facilitator;
145
+ }
146
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/escrow/facilitator/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAYH,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAG/D;;;;GAIG;AACH,SAAS,YAAY,CAAC,OAAe;IACnC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACjC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE,CAAC;QAChD,MAAM,IAAI,KAAK,CACb,2BAA2B,OAAO,+BAA+B,CAClE,CAAC;IACJ,CAAC;IACD,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACvC,IAAI,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,+BAA+B,OAAO,EAAE,CAAC,CAAC;IAC5D,CAAC;IACD,OAAO,O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C;IACF,OAAO,WAAW,CAAC;AACrB,CAAC"}
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Escrow Scheme - Server
3
+ * Handles price parsing and requirement enhancement for resource servers.
4
+ *
5
+ * Implements x402's SchemeNetworkServer interface so it can be registered
6
+ * on an x402ResourceServer via server.register('eip155:84532', new EscrowServerScheme()).
7
+ */
8
+ /**
9
+ * x402 PaymentRequirements (matches @x402/core/types PaymentRequirements)
10
+ */
11
+ export interface PaymentRequirements {
12
+ scheme: string;
13
+ network: string;
14
+ amount: string;
15
+ asset: string;
16
+ payTo: string;
17
+ maxTimeoutSeconds: number;
18
+ extra: Record<string, unknown>;
19
+ }
20
+ export interface SupportedKind {
21
+ x402Version: number;
22
+ scheme: string;
23
+ network: string;
24
+ extra?: Record<string, unknown>;
25
+ }
26
+ /**
27
+ * x402 AssetAmount (matches @x402/core/types AssetAmount)
28
+ */
29
+ export interface AssetAmount {
30
+ asset: string;
31
+ amount: string;
32
+ extra?: Record<string, unknown>;
33
+ }
34
+ /**
35
+ * x402 Price type (matches @x402/core/types Price)
36
+ */
37
+ export type Price = string | number | AssetAmount;
38
+ export type Network = `${string}:${string}`;
39
+ /**
40
+ * Server scheme - handles price parsing and requirement enhancement.
41
+ * Implements x402's SchemeNetworkServer interface.
42
+ */
43
+ export declare class EscrowServerScheme {
44
+ readonly scheme = "escrow";
45
+ private readonly decimals;
46
+ constructor(config?: {
47
+ decimals?: number;
48
+ });
49
+ /**
50
+ * Parse a price into an x402 AssetAmount.
51
+ *
52
+ * Accepts x402's Price type:
53
+ * - string: "$0.01", "0.01", "10000"
54
+ * - number: 0.01
55
+ * - AssetAmount: { asset: "0x...", amount: "10000" }
56
+ */
57
+ parsePrice(price: Price, network: Network): Promise<AssetAmount>;
58
+ /**
59
+ * Enhance payment requirements with facilitator's extra fields.
60
+ *
61
+ * Merges supportedKind.extra (from facilitator's /supported endpoint) into
62
+ * the requirements, so escrow addresses flow from facilitator → merchant
63
+ * requirements automatically.
64
+ */
65
+ enhancePaymentRequirements(requirements: PaymentRequirements, supportedKind: SupportedKind, _facilitatorExtensions: string[]): Promise<PaymentRequirements>;
66
+ }
67
+ export type { EscrowExtra, EscrowPayload } from "../../shared/types.js";
68
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/escrow/server/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB,EAAE,MAAM,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,WAAW,CAAC;AAElD,MAAM,MAAM,OAAO,GAAG,GAAG,MAAM,IAAI,MAAM,EAAE,CAAC;AAU5C;;;GAGG;AACH,qBAAa,kBAAkB;IAC7B,QAAQ,CAAC,MAAM,YAAY;IAC3B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;gBAEtB,MAAM,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE;IAI1C;;;;;;;OAOG;IACG,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC;IAoCtE;;;;;;OAMG;IACG,0BAA0B,CAC9B,YAAY,EAAE,mBAAmB,EACjC,aAAa,EAAE,aAAa,EAC5B,sBAAsB,EAAE,MAAM,EAAE,GAC/B,OAAO,CAAC,mBAAmB,CAAC;CAShC;AAED,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Escrow Scheme - Server
3
+ * Handles price parsing and requirement enhancement for resource servers.
4
+ *
5
+ * Implements x402's SchemeNetworkServer interface so it can be registered
6
+ * on an x402ResourceServer via server.register('eip155:84532', new EscrowServerScheme()).
7
+ */
8
+ /**
9
+ * Known USDC addresses per network
10
+ */
11
+ const USDC_ADDRESSES = {
12
+ "eip155:84532": "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
13
+ "eip155:8453": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
14
+ };
15
+ /**
16
+ * Server scheme - handles price parsing and requirement enhancement.
17
+ * Implements x402's SchemeNetworkServer interface.
18
+ */
19
+ export class EscrowServerScheme {
20
+ scheme = "escrow";
21
+ decimals;
22
+ constructor(config) {
23
+ this.decimals = config?.decimals ?? 6; // USDC default
24
+ }
25
+ /**
26
+ * Parse a price into an x402 AssetAmount.
27
+ *
28
+ * Accepts x402's Price type:
29
+ * - string: "$0.01", "0.01", "10000"
30
+ * - number: 0.01
31
+ * - AssetAmount: { asset: "0x...", amount: "10000" }
32
+ */
33
+ async parsePrice(price, network) {
34
+ // If already an AssetAmount, pass through
35
+ if (typeof price === "object" &&
36
+ price !== null &&
37
+ "amount" in price &&
38
+ "asset" in price) {
39
+ return price;
40
+ }
41
+ // Convert to number for calculation
42
+ let numericAmount;
43
+ if (typeof price === "number") {
44
+ numericAmount = price;
45
+ }
46
+ else {
47
+ const cleaned = String(price).replace(/[$,]/g, "").trim();
48
+ numericAmount = parseFloat(cleaned);
49
+ }
50
+ if (isNaN(numericAmount)) {
51
+ throw new Error(`Cannot parse price: ${price}`);
52
+ }
53
+ const rawAmount = BigInt(Math.round(numericAmount * 10 ** this.decimals));
54
+ const asset = USDC_ADDRESSES[network];
55
+ if (!asset) {
56
+ throw new Error(`No USDC address configured for network: ${network}`);
57
+ }
58
+ return {
59
+ asset,
60
+ amount: rawAmount.toString(),
61
+ };
62
+ }
63
+ /**
64
+ * Enhance payment requirements with facilitator's extra fields.
65
+ *
66
+ * Merges supportedKind.extra (from facilitator's /supported endpoint) into
67
+ * the requirements, so escrow addresses flow from facilitator → merchant
68
+ * requirements automatically.
69
+ */
70
+ async enhancePaymentRequirements(requirements, supportedKind, _facilitatorExtensions) {
71
+ return {
72
+ ...requirements,
73
+ extra: {
74
+ ...supportedKind.extra,
75
+ ...requirements.extra,
76
+ },
77
+ };
78
+ }
79
+ }
80
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/escrow/server/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAwCH;;GAEG;AACH,MAAM,cAAc,GAA2B;IAC7C,cAAc,EAAE,4CAA4C;IAC5D,aAAa,EAAE,4CAA4C;CAC5D,CAAC;AAEF;;;GAGG;AACH,MAAM,OAAO,kBAAkB;IACpB,MAAM,GAAG,QAAQ,CAAC;IACV,QAAQ,CAAS;IAElC,YAAY,MAA8B;QACxC,IAAI,CAAC,QAAQ,GAAG,MAAM,EAAE,QAAQ,IAAI,CAAC,CAAC,CAAC,eAAe;IACxD,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,UAAU,CAAC,KAAY,EAAE,OAAgB;QAC7C,0CAA0C;QAC1C,IACE,OAAO,KAAK,KAAK,QAAQ;YACzB,KAAK,KAAK,IAAI;YACd,QAAQ,IAAI,KAAK;YACjB,OAAO,IAAI,KAAK,EAChB,CAAC;YACD,OAAO,KAAoB,CAAC;QAC9B,CAAC;QAED,oCAAoC;QACpC,IAAI,aAAqB,CAAC;QAC1B,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC9B,aAAa,GAAG,KAAK,CAAC;QACxB,CAAC;aAAM,CAAC;YACN,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;YAC1D,aAAa,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;QACtC,CAAC;QAED,IAAI,KAAK,CAAC,aAAa,CAAC,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CAAC,uBAAuB,KAAK,EAAE,CAAC,CAAC;QAClD,CAAC;QAED,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,GAAG,EAAE,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC1E,MAAM,KAAK,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;QACtC,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,IAAI,KAAK,CAAC,2CAA2C,OAAO,EAAE,CAAC,CAAC;QACxE,CAAC;QAED,OAAO;YACL,KAAK;YACL,MAAM,EAAE,SAAS,CAAC,QAAQ,EAAE;SAC7B,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,0BAA0B,CAC9B,YAAiC,EACjC,aAA4B,EAC5B,sBAAgC;QAEhC,OAAO;YACL,GAAG,YAAY;YACf,KAAK,EAAE;gBACL,GAAG,aAAa,CAAC,KAAK;gBACtB,GAAG,YAAY,CAAC,KAAK;aACtB;SACF,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,98 @@
1
+ export declare const ZERO_ADDRESS: "0x0000000000000000000000000000000000000000";
2
+ export declare const MAX_UINT48 = 281474976710655;
3
+ export declare const MAX_UINT32 = 4294967295;
4
+ export declare const PAYMENT_INFO_COMPONENTS: readonly [{
5
+ readonly name: "operator";
6
+ readonly type: "address";
7
+ }, {
8
+ readonly name: "payer";
9
+ readonly type: "address";
10
+ }, {
11
+ readonly name: "receiver";
12
+ readonly type: "address";
13
+ }, {
14
+ readonly name: "token";
15
+ readonly type: "address";
16
+ }, {
17
+ readonly name: "maxAmount";
18
+ readonly type: "uint120";
19
+ }, {
20
+ readonly name: "preApprovalExpiry";
21
+ readonly type: "uint48";
22
+ }, {
23
+ readonly name: "authorizationExpiry";
24
+ readonly type: "uint48";
25
+ }, {
26
+ readonly name: "refundExpiry";
27
+ readonly type: "uint48";
28
+ }, {
29
+ readonly name: "minFeeBps";
30
+ readonly type: "uint16";
31
+ }, {
32
+ readonly name: "maxFeeBps";
33
+ readonly type: "uint16";
34
+ }, {
35
+ readonly name: "feeReceiver";
36
+ readonly type: "address";
37
+ }, {
38
+ readonly name: "salt";
39
+ readonly type: "uint256";
40
+ }];
41
+ export declare const OPERATOR_ABI: readonly [{
42
+ readonly name: "authorize";
43
+ readonly type: "function";
44
+ readonly stateMutability: "nonpayable";
45
+ readonly inputs: readonly [{
46
+ readonly name: "paymentInfo";
47
+ readonly type: "tuple";
48
+ readonly components: readonly [{
49
+ readonly name: "operator";
50
+ readonly type: "address";
51
+ }, {
52
+ readonly name: "payer";
53
+ readonly type: "address";
54
+ }, {
55
+ readonly name: "receiver";
56
+ readonly type: "address";
57
+ }, {
58
+ readonly name: "token";
59
+ readonly type: "address";
60
+ }, {
61
+ readonly name: "maxAmount";
62
+ readonly type: "uint120";
63
+ }, {
64
+ readonly name: "preApprovalExpiry";
65
+ readonly type: "uint48";
66
+ }, {
67
+ readonly name: "authorizationExpiry";
68
+ readonly type: "uint48";
69
+ }, {
70
+ readonly name: "refundExpiry";
71
+ readonly type: "uint48";
72
+ }, {
73
+ readonly name: "minFeeBps";
74
+ readonly type: "uint16";
75
+ }, {
76
+ readonly name: "maxFeeBps";
77
+ readonly type: "uint16";
78
+ }, {
79
+ readonly name: "feeReceiver";
80
+ readonly type: "address";
81
+ }, {
82
+ readonly name: "salt";
83
+ readonly type: "uint256";
84
+ }];
85
+ }, {
86
+ readonly name: "amount";
87
+ readonly type: "uint256";
88
+ }, {
89
+ readonly name: "tokenCollector";
90
+ readonly type: "address";
91
+ }, {
92
+ readonly name: "collectorData";
93
+ readonly type: "bytes";
94
+ }];
95
+ readonly outputs: readonly [];
96
+ }];
97
+ export declare const TRANSFER_WITH_AUTHORIZATION_TYPEHASH: "0x7c7c6cdb67a18743f49ec6fa9b35f50d52ed05cbed4cc592e13b44501c1a2267";
98
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/shared/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,EACvB,4CAAqD,CAAC;AACxD,eAAO,MAAM,UAAU,kBAAkB,CAAC;AAC1C,eAAO,MAAM,UAAU,aAAa,CAAC;AAGrC,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAa1B,CAAC;AAEX,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiBf,CAAC;AAGX,eAAO,MAAM,oCAAoC,EAC/C,oEAA6E,CAAC"}
@@ -0,0 +1,39 @@
1
+ export const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
2
+ export const MAX_UINT48 = 281474976710655;
3
+ export const MAX_UINT32 = 4294967295;
4
+ // PaymentInfo struct for AuthCaptureEscrow (matches commerce-payments contract)
5
+ export const PAYMENT_INFO_COMPONENTS = [
6
+ { name: "operator", type: "address" },
7
+ { name: "payer", type: "address" },
8
+ { name: "receiver", type: "address" },
9
+ { name: "token", type: "address" },
10
+ { name: "maxAmount", type: "uint120" },
11
+ { name: "preApprovalExpiry", type: "uint48" },
12
+ { name: "authorizationExpiry", type: "uint48" },
13
+ { name: "refundExpiry", type: "uint48" },
14
+ { name: "minFeeBps", type: "uint16" },
15
+ { name: "maxFeeBps", type: "uint16" },
16
+ { name: "feeReceiver", type: "address" },
17
+ { name: "salt", type: "uint256" },
18
+ ];
19
+ export const OPERATOR_ABI = [
20
+ {
21
+ name: "authorize",
22
+ type: "function",
23
+ stateMutability: "nonpayable",
24
+ inputs: [
25
+ {
26
+ name: "paymentInfo",
27
+ type: "tuple",
28
+ components: PAYMENT_INFO_COMPONENTS,
29
+ },
30
+ { name: "amount", type: "uint256" },
31
+ { name: "tokenCollector", type: "address" },
32
+ { name: "collectorData", type: "bytes" },
33
+ ],
34
+ outputs: [],
35
+ },
36
+ ];
37
+ // ERC-3009 TransferWithAuthorization type hash
38
+ export const TRANSFER_WITH_AUTHORIZATION_TYPEHASH = "0x7c7c6cdb67a18743f49ec6fa9b35f50d52ed05cbed4cc592e13b44501c1a2267";
39
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/shared/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GACvB,4CAAqD,CAAC;AACxD,MAAM,CAAC,MAAM,UAAU,GAAG,eAAe,CAAC;AAC1C,MAAM,CAAC,MAAM,UAAU,GAAG,UAAU,CAAC;AAErC,gFAAgF;AAChF,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE;IACrC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE;IAClC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE;IACrC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE;IAClC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE;IACtC,EAAE,IAAI,EAAE,mBAAmB,EAAE,IAAI,EAAE,QAAQ,EAAE;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