@t402/evm 2.5.0 → 2.6.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.
Files changed (39) hide show
  1. package/dist/cjs/index-fzI2FyBT.d.ts +122 -0
  2. package/dist/cjs/permit2/client/index.d.ts +81 -0
  3. package/dist/cjs/permit2/client/index.js +150 -0
  4. package/dist/cjs/permit2/client/index.js.map +1 -0
  5. package/dist/cjs/permit2/facilitator/index.d.ts +82 -0
  6. package/dist/cjs/permit2/facilitator/index.js +301 -0
  7. package/dist/cjs/permit2/facilitator/index.js.map +1 -0
  8. package/dist/cjs/permit2/index.d.ts +145 -0
  9. package/dist/cjs/permit2/index.js +1075 -0
  10. package/dist/cjs/permit2/index.js.map +1 -0
  11. package/dist/cjs/permit2/server/index.d.ts +3 -0
  12. package/dist/cjs/permit2/server/index.js +686 -0
  13. package/dist/cjs/permit2/server/index.js.map +1 -0
  14. package/dist/esm/chunk-3KHB6QTD.mjs +112 -0
  15. package/dist/esm/chunk-3KHB6QTD.mjs.map +1 -0
  16. package/dist/esm/{chunk-ZDGWVHD5.mjs → chunk-EEZNFYCW.mjs} +5 -5
  17. package/dist/esm/chunk-MMQSLAA2.mjs +190 -0
  18. package/dist/esm/chunk-MMQSLAA2.mjs.map +1 -0
  19. package/dist/esm/chunk-NIGKNI66.mjs +224 -0
  20. package/dist/esm/chunk-NIGKNI66.mjs.map +1 -0
  21. package/dist/esm/chunk-URG4HEYQ.mjs +74 -0
  22. package/dist/esm/chunk-URG4HEYQ.mjs.map +1 -0
  23. package/dist/esm/index-fzI2FyBT.d.mts +122 -0
  24. package/dist/esm/index.mjs +10 -10
  25. package/dist/esm/permit2/client/index.d.mts +81 -0
  26. package/dist/esm/permit2/client/index.mjs +11 -0
  27. package/dist/esm/permit2/client/index.mjs.map +1 -0
  28. package/dist/esm/permit2/facilitator/index.d.mts +82 -0
  29. package/dist/esm/permit2/facilitator/index.mjs +11 -0
  30. package/dist/esm/permit2/facilitator/index.mjs.map +1 -0
  31. package/dist/esm/permit2/index.d.mts +145 -0
  32. package/dist/esm/permit2/index.mjs +31 -0
  33. package/dist/esm/permit2/index.mjs.map +1 -0
  34. package/dist/esm/permit2/server/index.d.mts +3 -0
  35. package/dist/esm/permit2/server/index.mjs +12 -0
  36. package/dist/esm/permit2/server/index.mjs.map +1 -0
  37. package/dist/esm/upto/index.mjs +2 -2
  38. package/package.json +58 -11
  39. /package/dist/esm/{chunk-ZDGWVHD5.mjs.map → chunk-EEZNFYCW.mjs.map} +0 -0
@@ -0,0 +1,224 @@
1
+ import {
2
+ PERMIT2_ADDRESS,
3
+ erc20BalanceABI,
4
+ permit2ABI
5
+ } from "./chunk-URG4HEYQ.mjs";
6
+ import {
7
+ __publicField
8
+ } from "./chunk-NSSMTXJJ.mjs";
9
+
10
+ // src/permit2/facilitator/scheme.ts
11
+ import { getAddress } from "viem";
12
+ var Permit2EvmScheme = class {
13
+ /**
14
+ * Creates a new Permit2 facilitator instance.
15
+ *
16
+ * @param signer - The facilitator EVM signer
17
+ */
18
+ constructor(signer) {
19
+ this.signer = signer;
20
+ __publicField(this, "scheme", "permit2");
21
+ __publicField(this, "caipFamily", "eip155:*");
22
+ }
23
+ /**
24
+ * Get mechanism-specific extra data for supported kinds.
25
+ *
26
+ * @param _ - The network identifier
27
+ * @returns Extra data including permit2 contract address
28
+ */
29
+ getExtra(_) {
30
+ return { permit2Address: PERMIT2_ADDRESS };
31
+ }
32
+ /**
33
+ * Get signer addresses for this facilitator.
34
+ *
35
+ * @param _ - The network identifier
36
+ * @returns Array of signer addresses
37
+ */
38
+ getSigners(_) {
39
+ return [...this.signer.getAddresses()];
40
+ }
41
+ /**
42
+ * Verify a Permit2 payment payload.
43
+ *
44
+ * @param payload - The payment payload to verify
45
+ * @param requirements - The payment requirements
46
+ * @returns Verification result
47
+ */
48
+ async verify(payload, requirements) {
49
+ const permit2Payload = payload.payload;
50
+ if (!permit2Payload?.permit?.permitted?.token || !permit2Payload?.owner) {
51
+ return {
52
+ isValid: false,
53
+ invalidReason: "invalid_payload_structure",
54
+ payer: void 0
55
+ };
56
+ }
57
+ if (payload.accepted.scheme !== "permit2" || requirements.scheme !== "permit2") {
58
+ return {
59
+ isValid: false,
60
+ invalidReason: "unsupported_scheme",
61
+ payer: permit2Payload.owner
62
+ };
63
+ }
64
+ if (payload.accepted.network !== requirements.network) {
65
+ return {
66
+ isValid: false,
67
+ invalidReason: "network_mismatch",
68
+ payer: permit2Payload.owner
69
+ };
70
+ }
71
+ if (getAddress(permit2Payload.permit.permitted.token) !== getAddress(requirements.asset)) {
72
+ return {
73
+ isValid: false,
74
+ invalidReason: "token_mismatch",
75
+ payer: permit2Payload.owner
76
+ };
77
+ }
78
+ if (getAddress(permit2Payload.transferDetails.to) !== getAddress(requirements.payTo)) {
79
+ return {
80
+ isValid: false,
81
+ invalidReason: "recipient_mismatch",
82
+ payer: permit2Payload.owner
83
+ };
84
+ }
85
+ const now = Math.floor(Date.now() / 1e3);
86
+ if (BigInt(permit2Payload.permit.deadline) < BigInt(now + 6)) {
87
+ return {
88
+ isValid: false,
89
+ invalidReason: "permit_expired",
90
+ payer: permit2Payload.owner
91
+ };
92
+ }
93
+ if (BigInt(permit2Payload.permit.permitted.amount) < BigInt(requirements.amount)) {
94
+ return {
95
+ isValid: false,
96
+ invalidReason: "insufficient_permitted_amount",
97
+ payer: permit2Payload.owner
98
+ };
99
+ }
100
+ if (BigInt(permit2Payload.transferDetails.requestedAmount) < BigInt(requirements.amount)) {
101
+ return {
102
+ isValid: false,
103
+ invalidReason: "insufficient_requested_amount",
104
+ payer: permit2Payload.owner
105
+ };
106
+ }
107
+ try {
108
+ const balance = await this.signer.readContract({
109
+ address: getAddress(requirements.asset),
110
+ abi: erc20BalanceABI,
111
+ functionName: "balanceOf",
112
+ args: [getAddress(permit2Payload.owner)]
113
+ });
114
+ if (BigInt(balance) < BigInt(requirements.amount)) {
115
+ return {
116
+ isValid: false,
117
+ invalidReason: "insufficient_funds",
118
+ payer: permit2Payload.owner
119
+ };
120
+ }
121
+ } catch (error) {
122
+ const errorMessage = error instanceof Error ? error.message : String(error);
123
+ return {
124
+ isValid: false,
125
+ invalidReason: `balance_check_failed: ${errorMessage}`,
126
+ payer: permit2Payload.owner
127
+ };
128
+ }
129
+ return {
130
+ isValid: true,
131
+ invalidReason: void 0,
132
+ payer: permit2Payload.owner
133
+ };
134
+ }
135
+ /**
136
+ * Settle a Permit2 payment by executing permitTransferFrom.
137
+ *
138
+ * @param payload - The payment payload
139
+ * @param requirements - The payment requirements
140
+ * @returns Settlement result
141
+ */
142
+ async settle(payload, requirements) {
143
+ const permit2Payload = payload.payload;
144
+ if (!permit2Payload?.permit?.permitted?.token || !permit2Payload?.owner) {
145
+ return {
146
+ success: false,
147
+ network: payload.accepted.network,
148
+ transaction: "",
149
+ errorReason: "invalid_payload_structure",
150
+ payer: void 0
151
+ };
152
+ }
153
+ const valid = await this.verify(payload, requirements);
154
+ if (!valid.isValid) {
155
+ return {
156
+ success: false,
157
+ network: payload.accepted.network,
158
+ transaction: "",
159
+ errorReason: valid.invalidReason ?? "invalid_scheme",
160
+ payer: permit2Payload.owner
161
+ };
162
+ }
163
+ try {
164
+ const tx = await this.signer.writeContract({
165
+ address: PERMIT2_ADDRESS,
166
+ abi: permit2ABI,
167
+ functionName: "permitTransferFrom",
168
+ args: [
169
+ {
170
+ permitted: {
171
+ token: getAddress(permit2Payload.permit.permitted.token),
172
+ amount: BigInt(permit2Payload.permit.permitted.amount)
173
+ },
174
+ nonce: BigInt(permit2Payload.permit.nonce),
175
+ deadline: BigInt(permit2Payload.permit.deadline)
176
+ },
177
+ {
178
+ to: getAddress(permit2Payload.transferDetails.to),
179
+ requestedAmount: BigInt(permit2Payload.transferDetails.requestedAmount)
180
+ },
181
+ getAddress(permit2Payload.owner),
182
+ permit2Payload.signature
183
+ ]
184
+ });
185
+ const receipt = await this.signer.waitForTransactionReceipt({ hash: tx });
186
+ if (receipt.status !== "success") {
187
+ return {
188
+ success: false,
189
+ errorReason: "invalid_transaction_state",
190
+ transaction: tx,
191
+ network: payload.accepted.network,
192
+ payer: permit2Payload.owner
193
+ };
194
+ }
195
+ return {
196
+ success: true,
197
+ transaction: tx,
198
+ network: payload.accepted.network,
199
+ payer: permit2Payload.owner
200
+ };
201
+ } catch (error) {
202
+ console.error("Failed to settle Permit2 transaction:", error);
203
+ return {
204
+ success: false,
205
+ errorReason: "transaction_failed",
206
+ transaction: "",
207
+ network: payload.accepted.network,
208
+ payer: permit2Payload.owner
209
+ };
210
+ }
211
+ }
212
+ };
213
+
214
+ // src/permit2/facilitator/register.ts
215
+ function registerPermit2EvmScheme(facilitator, config) {
216
+ facilitator.register(config.networks, new Permit2EvmScheme(config.signer));
217
+ return facilitator;
218
+ }
219
+
220
+ export {
221
+ Permit2EvmScheme,
222
+ registerPermit2EvmScheme
223
+ };
224
+ //# sourceMappingURL=chunk-NIGKNI66.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/permit2/facilitator/scheme.ts","../../src/permit2/facilitator/register.ts"],"sourcesContent":["import {\n PaymentPayload,\n PaymentRequirements,\n SchemeNetworkFacilitator,\n SettleResponse,\n VerifyResponse,\n} from \"@t402/core/types\";\nimport { getAddress } from \"viem\";\nimport { FacilitatorEvmSigner } from \"../../signer\";\nimport { Permit2PayloadV2 } from \"../types\";\nimport { PERMIT2_ADDRESS, permit2ABI, erc20BalanceABI } from \"../constants\";\n\n/**\n * Configuration for Permit2 EVM facilitator\n */\nexport interface Permit2EvmSchemeConfig {\n [key: string]: unknown;\n}\n\n/**\n * EVM facilitator implementation for the Permit2 payment scheme.\n *\n * Verifies Permit2 signatures and settles payments by calling\n * permitTransferFrom on the Permit2 contract.\n */\nexport class Permit2EvmScheme implements SchemeNetworkFacilitator {\n readonly scheme = \"permit2\";\n readonly caipFamily = \"eip155:*\";\n\n /**\n * Creates a new Permit2 facilitator instance.\n *\n * @param signer - The facilitator EVM signer\n */\n constructor(private readonly signer: FacilitatorEvmSigner) {}\n\n /**\n * Get mechanism-specific extra data for supported kinds.\n *\n * @param _ - The network identifier\n * @returns Extra data including permit2 contract address\n */\n getExtra(_: string): Record<string, unknown> | undefined {\n return { permit2Address: PERMIT2_ADDRESS };\n }\n\n /**\n * Get signer addresses for this facilitator.\n *\n * @param _ - The network identifier\n * @returns Array of signer addresses\n */\n getSigners(_: string): string[] {\n return [...this.signer.getAddresses()];\n }\n\n /**\n * Verify a Permit2 payment payload.\n *\n * @param payload - The payment payload to verify\n * @param requirements - The payment requirements\n * @returns Verification result\n */\n async verify(\n payload: PaymentPayload,\n requirements: PaymentRequirements,\n ): Promise<VerifyResponse> {\n const permit2Payload = payload.payload as Permit2PayloadV2 | undefined;\n\n // Validate payload structure\n if (!permit2Payload?.permit?.permitted?.token || !permit2Payload?.owner) {\n return {\n isValid: false,\n invalidReason: \"invalid_payload_structure\",\n payer: undefined,\n };\n }\n\n // Verify scheme matches\n if (payload.accepted.scheme !== \"permit2\" || requirements.scheme !== \"permit2\") {\n return {\n isValid: false,\n invalidReason: \"unsupported_scheme\",\n payer: permit2Payload.owner,\n };\n }\n\n // Verify network matches\n if (payload.accepted.network !== requirements.network) {\n return {\n isValid: false,\n invalidReason: \"network_mismatch\",\n payer: permit2Payload.owner,\n };\n }\n\n // Verify token matches\n if (getAddress(permit2Payload.permit.permitted.token) !== getAddress(requirements.asset)) {\n return {\n isValid: false,\n invalidReason: \"token_mismatch\",\n payer: permit2Payload.owner,\n };\n }\n\n // Verify recipient matches\n if (getAddress(permit2Payload.transferDetails.to) !== getAddress(requirements.payTo)) {\n return {\n isValid: false,\n invalidReason: \"recipient_mismatch\",\n payer: permit2Payload.owner,\n };\n }\n\n // Verify deadline is in the future\n const now = Math.floor(Date.now() / 1000);\n if (BigInt(permit2Payload.permit.deadline) < BigInt(now + 6)) {\n return {\n isValid: false,\n invalidReason: \"permit_expired\",\n payer: permit2Payload.owner,\n };\n }\n\n // Verify amount is sufficient\n if (BigInt(permit2Payload.permit.permitted.amount) < BigInt(requirements.amount)) {\n return {\n isValid: false,\n invalidReason: \"insufficient_permitted_amount\",\n payer: permit2Payload.owner,\n };\n }\n\n if (BigInt(permit2Payload.transferDetails.requestedAmount) < BigInt(requirements.amount)) {\n return {\n isValid: false,\n invalidReason: \"insufficient_requested_amount\",\n payer: permit2Payload.owner,\n };\n }\n\n // Check balance\n try {\n const balance = (await this.signer.readContract({\n address: getAddress(requirements.asset),\n abi: erc20BalanceABI,\n functionName: \"balanceOf\",\n args: [getAddress(permit2Payload.owner)],\n })) as bigint;\n\n if (BigInt(balance) < BigInt(requirements.amount)) {\n return {\n isValid: false,\n invalidReason: \"insufficient_funds\",\n payer: permit2Payload.owner,\n };\n }\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n return {\n isValid: false,\n invalidReason: `balance_check_failed: ${errorMessage}`,\n payer: permit2Payload.owner,\n };\n }\n\n return {\n isValid: true,\n invalidReason: undefined,\n payer: permit2Payload.owner,\n };\n }\n\n /**\n * Settle a Permit2 payment by executing permitTransferFrom.\n *\n * @param payload - The payment payload\n * @param requirements - The payment requirements\n * @returns Settlement result\n */\n async settle(\n payload: PaymentPayload,\n requirements: PaymentRequirements,\n ): Promise<SettleResponse> {\n const permit2Payload = payload.payload as Permit2PayloadV2 | undefined;\n\n if (!permit2Payload?.permit?.permitted?.token || !permit2Payload?.owner) {\n return {\n success: false,\n network: payload.accepted.network,\n transaction: \"\",\n errorReason: \"invalid_payload_structure\",\n payer: undefined,\n };\n }\n\n // Re-verify before settling\n const valid = await this.verify(payload, requirements);\n if (!valid.isValid) {\n return {\n success: false,\n network: payload.accepted.network,\n transaction: \"\",\n errorReason: valid.invalidReason ?? \"invalid_scheme\",\n payer: permit2Payload.owner,\n };\n }\n\n try {\n // Call permitTransferFrom on the Permit2 contract\n const tx = await this.signer.writeContract({\n address: PERMIT2_ADDRESS,\n abi: permit2ABI,\n functionName: \"permitTransferFrom\",\n args: [\n {\n permitted: {\n token: getAddress(permit2Payload.permit.permitted.token),\n amount: BigInt(permit2Payload.permit.permitted.amount),\n },\n nonce: BigInt(permit2Payload.permit.nonce),\n deadline: BigInt(permit2Payload.permit.deadline),\n },\n {\n to: getAddress(permit2Payload.transferDetails.to),\n requestedAmount: BigInt(permit2Payload.transferDetails.requestedAmount),\n },\n getAddress(permit2Payload.owner),\n permit2Payload.signature,\n ],\n });\n\n // Wait for transaction confirmation\n const receipt = await this.signer.waitForTransactionReceipt({ hash: tx });\n\n if (receipt.status !== \"success\") {\n return {\n success: false,\n errorReason: \"invalid_transaction_state\",\n transaction: tx,\n network: payload.accepted.network,\n payer: permit2Payload.owner,\n };\n }\n\n return {\n success: true,\n transaction: tx,\n network: payload.accepted.network,\n payer: permit2Payload.owner,\n };\n } catch (error) {\n console.error(\"Failed to settle Permit2 transaction:\", error);\n return {\n success: false,\n errorReason: \"transaction_failed\",\n transaction: \"\",\n network: payload.accepted.network,\n payer: permit2Payload.owner,\n };\n }\n }\n}\n","import { t402Facilitator } from \"@t402/core/facilitator\";\nimport { Network } from \"@t402/core/types\";\nimport { FacilitatorEvmSigner } from \"../../signer\";\nimport { Permit2EvmScheme } from \"./scheme\";\n\n/**\n * Configuration options for registering Permit2 schemes to an t402Facilitator\n */\nexport interface Permit2EvmFacilitatorConfig {\n /**\n * The EVM signer for facilitator operations (verify and settle)\n */\n signer: FacilitatorEvmSigner;\n\n /**\n * Networks to register (single network or array of networks)\n * Examples: \"eip155:84532\", [\"eip155:84532\", \"eip155:1\"]\n */\n networks: Network | Network[];\n}\n\n/**\n * Registers Permit2 EVM payment schemes to an t402Facilitator instance.\n *\n * @param facilitator - The t402Facilitator instance to register schemes to\n * @param config - Configuration for Permit2 EVM facilitator registration\n * @returns The facilitator instance for chaining\n */\nexport function registerPermit2EvmScheme(\n facilitator: t402Facilitator,\n config: Permit2EvmFacilitatorConfig,\n): t402Facilitator {\n facilitator.register(config.networks, new Permit2EvmScheme(config.signer));\n\n return facilitator;\n}\n"],"mappings":";;;;;;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;AAAA,UAC1B,OAAO,eAAe;AAAA,QACxB;AAAA,MACF;AAEA,aAAO;AAAA,QACL,SAAS;AAAA,QACT,aAAa;AAAA,QACb,SAAS,QAAQ,SAAS;AAAA,QAC1B,OAAO,eAAe;AAAA,MACxB;AAAA,IACF,SAAS,OAAO;AACd,cAAQ,MAAM,yCAAyC,KAAK;AAC5D,aAAO;AAAA,QACL,SAAS;AAAA,QACT,aAAa;AAAA,QACb,aAAa;AAAA,QACb,SAAS,QAAQ,SAAS;AAAA,QAC1B,OAAO,eAAe;AAAA,MACxB;AAAA,IACF;AAAA,EACF;AACF;;;AC1OO,SAAS,yBACd,aACA,QACiB;AACjB,cAAY,SAAS,OAAO,UAAU,IAAI,iBAAiB,OAAO,MAAM,CAAC;AAEzE,SAAO;AACT;","names":[]}
@@ -0,0 +1,74 @@
1
+ // src/permit2/constants.ts
2
+ var PERMIT2_ADDRESS = "0x000000000022D473030F116dDEE9F6B43aC78BA3";
3
+ var permit2Types = {
4
+ PermitTransferFrom: [
5
+ { name: "permitted", type: "TokenPermissions" },
6
+ { name: "spender", type: "address" },
7
+ { name: "nonce", type: "uint256" },
8
+ { name: "deadline", type: "uint256" }
9
+ ],
10
+ TokenPermissions: [
11
+ { name: "token", type: "address" },
12
+ { name: "amount", type: "uint256" }
13
+ ]
14
+ };
15
+ var permit2ABI = [
16
+ {
17
+ inputs: [
18
+ {
19
+ components: [
20
+ {
21
+ components: [
22
+ { name: "token", type: "address" },
23
+ { name: "amount", type: "uint256" }
24
+ ],
25
+ name: "permitted",
26
+ type: "tuple"
27
+ },
28
+ { name: "nonce", type: "uint256" },
29
+ { name: "deadline", type: "uint256" }
30
+ ],
31
+ name: "permit",
32
+ type: "tuple"
33
+ },
34
+ {
35
+ components: [
36
+ { name: "to", type: "address" },
37
+ { name: "requestedAmount", type: "uint256" }
38
+ ],
39
+ name: "transferDetails",
40
+ type: "tuple"
41
+ },
42
+ { name: "owner", type: "address" },
43
+ { name: "signature", type: "bytes" }
44
+ ],
45
+ name: "permitTransferFrom",
46
+ outputs: [],
47
+ stateMutability: "nonpayable",
48
+ type: "function"
49
+ },
50
+ {
51
+ inputs: [{ name: "account", type: "address" }],
52
+ name: "balanceOf",
53
+ outputs: [{ name: "", type: "uint256" }],
54
+ stateMutability: "view",
55
+ type: "function"
56
+ }
57
+ ];
58
+ var erc20BalanceABI = [
59
+ {
60
+ inputs: [{ name: "account", type: "address" }],
61
+ name: "balanceOf",
62
+ outputs: [{ name: "", type: "uint256" }],
63
+ stateMutability: "view",
64
+ type: "function"
65
+ }
66
+ ];
67
+
68
+ export {
69
+ PERMIT2_ADDRESS,
70
+ permit2Types,
71
+ permit2ABI,
72
+ erc20BalanceABI
73
+ };
74
+ //# sourceMappingURL=chunk-URG4HEYQ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/permit2/constants.ts"],"sourcesContent":["/**\n * Permit2 Constants\n *\n * Uniswap Permit2 contract addresses, type hashes, and ABI fragments.\n */\n\n/** Canonical Permit2 contract address (same on all EVM chains) */\nexport const PERMIT2_ADDRESS = \"0x000000000022D473030F116dDEE9F6B43aC78BA3\" as const;\n\n/** EIP-712 type definitions for Permit2 SignatureTransfer */\nexport const permit2Types = {\n PermitTransferFrom: [\n { name: \"permitted\", type: \"TokenPermissions\" },\n { name: \"spender\", type: \"address\" },\n { name: \"nonce\", type: \"uint256\" },\n { name: \"deadline\", type: \"uint256\" },\n ],\n TokenPermissions: [\n { name: \"token\", type: \"address\" },\n { name: \"amount\", type: \"uint256\" },\n ],\n} as const;\n\n/** Permit2 ABI for permitTransferFrom */\nexport const permit2ABI = [\n {\n inputs: [\n {\n components: [\n {\n components: [\n { name: \"token\", type: \"address\" },\n { name: \"amount\", type: \"uint256\" },\n ],\n name: \"permitted\",\n type: \"tuple\",\n },\n { name: \"nonce\", type: \"uint256\" },\n { name: \"deadline\", type: \"uint256\" },\n ],\n name: \"permit\",\n type: \"tuple\",\n },\n {\n components: [\n { name: \"to\", type: \"address\" },\n { name: \"requestedAmount\", type: \"uint256\" },\n ],\n name: \"transferDetails\",\n type: \"tuple\",\n },\n { name: \"owner\", type: \"address\" },\n { name: \"signature\", type: \"bytes\" },\n ],\n name: \"permitTransferFrom\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [{ name: \"account\", type: \"address\" }],\n name: \"balanceOf\",\n outputs: [{ name: \"\", type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n] as const;\n\n/** ERC20 balanceOf ABI for balance checks */\nexport const erc20BalanceABI = [\n {\n inputs: [{ name: \"account\", type: \"address\" }],\n name: \"balanceOf\",\n outputs: [{ name: \"\", type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n] as const;\n"],"mappings":";AAOO,IAAM,kBAAkB;AAGxB,IAAM,eAAe;AAAA,EAC1B,oBAAoB;AAAA,IAClB,EAAE,MAAM,aAAa,MAAM,mBAAmB;AAAA,IAC9C,EAAE,MAAM,WAAW,MAAM,UAAU;AAAA,IACnC,EAAE,MAAM,SAAS,MAAM,UAAU;AAAA,IACjC,EAAE,MAAM,YAAY,MAAM,UAAU;AAAA,EACtC;AAAA,EACA,kBAAkB;AAAA,IAChB,EAAE,MAAM,SAAS,MAAM,UAAU;AAAA,IACjC,EAAE,MAAM,UAAU,MAAM,UAAU;AAAA,EACpC;AACF;AAGO,IAAM,aAAa;AAAA,EACxB;AAAA,IACE,QAAQ;AAAA,MACN;AAAA,QACE,YAAY;AAAA,UACV;AAAA,YACE,YAAY;AAAA,cACV,EAAE,MAAM,SAAS,MAAM,UAAU;AAAA,cACjC,EAAE,MAAM,UAAU,MAAM,UAAU;AAAA,YACpC;AAAA,YACA,MAAM;AAAA,YACN,MAAM;AAAA,UACR;AAAA,UACA,EAAE,MAAM,SAAS,MAAM,UAAU;AAAA,UACjC,EAAE,MAAM,YAAY,MAAM,UAAU;AAAA,QACtC;AAAA,QACA,MAAM;AAAA,QACN,MAAM;AAAA,MACR;AAAA,MACA;AAAA,QACE,YAAY;AAAA,UACV,EAAE,MAAM,MAAM,MAAM,UAAU;AAAA,UAC9B,EAAE,MAAM,mBAAmB,MAAM,UAAU;AAAA,QAC7C;AAAA,QACA,MAAM;AAAA,QACN,MAAM;AAAA,MACR;AAAA,MACA,EAAE,MAAM,SAAS,MAAM,UAAU;AAAA,MACjC,EAAE,MAAM,aAAa,MAAM,QAAQ;AAAA,IACrC;AAAA,IACA,MAAM;AAAA,IACN,SAAS,CAAC;AAAA,IACV,iBAAiB;AAAA,IACjB,MAAM;AAAA,EACR;AAAA,EACA;AAAA,IACE,QAAQ,CAAC,EAAE,MAAM,WAAW,MAAM,UAAU,CAAC;AAAA,IAC7C,MAAM;AAAA,IACN,SAAS,CAAC,EAAE,MAAM,IAAI,MAAM,UAAU,CAAC;AAAA,IACvC,iBAAiB;AAAA,IACjB,MAAM;AAAA,EACR;AACF;AAGO,IAAM,kBAAkB;AAAA,EAC7B;AAAA,IACE,QAAQ,CAAC,EAAE,MAAM,WAAW,MAAM,UAAU,CAAC;AAAA,IAC7C,MAAM;AAAA,IACN,SAAS,CAAC,EAAE,MAAM,IAAI,MAAM,UAAU,CAAC;AAAA,IACvC,iBAAiB;AAAA,IACjB,MAAM;AAAA,EACR;AACF;","names":[]}
@@ -0,0 +1,122 @@
1
+ import { SchemeNetworkServer, MoneyParser, Price, Network, AssetAmount, PaymentRequirements } from '@t402/core/types';
2
+ import { t402ResourceServer } from '@t402/core/server';
3
+
4
+ /**
5
+ * Configuration options for Permit2EvmScheme server
6
+ */
7
+ interface Permit2EvmSchemeConfig {
8
+ /** Preferred token symbol (e.g., "USDT0", "USDC"). Defaults to network's highest priority token. */
9
+ preferredToken?: string;
10
+ }
11
+ /**
12
+ * EVM server implementation for the Permit2 payment scheme.
13
+ * Supports USDT0, USDC, and other ERC20 tokens via Uniswap Permit2.
14
+ */
15
+ declare class Permit2EvmScheme implements SchemeNetworkServer {
16
+ readonly scheme = "permit2";
17
+ private moneyParsers;
18
+ private config;
19
+ /**
20
+ * Creates a new Permit2EvmScheme server instance.
21
+ *
22
+ * @param config - Server configuration options
23
+ */
24
+ constructor(config?: Permit2EvmSchemeConfig);
25
+ /**
26
+ * Get the list of supported EVM networks.
27
+ *
28
+ * @returns Array of supported network identifiers
29
+ */
30
+ static getSupportedNetworks(): string[];
31
+ /**
32
+ * Check if a network is supported.
33
+ *
34
+ * @param network - Network identifier to check
35
+ * @returns Whether the network is supported
36
+ */
37
+ static isNetworkSupported(network: string): boolean;
38
+ /**
39
+ * Register a custom money parser for price conversion.
40
+ *
41
+ * @param parser - The money parser to register
42
+ * @returns This instance for chaining
43
+ */
44
+ registerMoneyParser(parser: MoneyParser): Permit2EvmScheme;
45
+ /**
46
+ * Parse a price into an AssetAmount for the given network.
47
+ *
48
+ * @param price - The price to parse
49
+ * @param network - The target network
50
+ * @returns The parsed asset amount
51
+ */
52
+ parsePrice(price: Price, network: Network): Promise<AssetAmount>;
53
+ /**
54
+ * Enhance payment requirements with Permit2-specific data.
55
+ *
56
+ * @param paymentRequirements - The base payment requirements
57
+ * @param supportedKind - The supported kind metadata
58
+ * @param supportedKind.t402Version - Protocol version
59
+ * @param supportedKind.scheme - Payment scheme
60
+ * @param supportedKind.network - Target network
61
+ * @param supportedKind.extra - Extra metadata
62
+ * @param extensionKeys - Active extension keys
63
+ * @returns Enhanced payment requirements
64
+ */
65
+ enhancePaymentRequirements(paymentRequirements: PaymentRequirements, supportedKind: {
66
+ t402Version: number;
67
+ scheme: string;
68
+ network: Network;
69
+ extra?: Record<string, unknown>;
70
+ }, extensionKeys: string[]): Promise<PaymentRequirements>;
71
+ /**
72
+ * Parse a money value into a decimal number.
73
+ *
74
+ * @param money - The money value to parse
75
+ * @returns The decimal amount
76
+ */
77
+ private parseMoneyToDecimal;
78
+ /**
79
+ * Convert a decimal amount to a token amount using default network token.
80
+ *
81
+ * @param amount - The decimal amount
82
+ * @param network - The target network
83
+ * @returns The asset amount with token details
84
+ */
85
+ private defaultMoneyConversion;
86
+ /**
87
+ * Convert a decimal amount string to token smallest units.
88
+ *
89
+ * @param decimalAmount - The decimal amount as a string
90
+ * @param decimals - The token's decimal places
91
+ * @returns The amount in smallest units
92
+ */
93
+ private convertToTokenAmount;
94
+ /**
95
+ * Get the default token asset for a network.
96
+ *
97
+ * @param network - The target network
98
+ * @returns The token configuration
99
+ */
100
+ private getDefaultAsset;
101
+ }
102
+
103
+ /**
104
+ * Configuration options for registering Permit2 schemes to an t402ResourceServer
105
+ */
106
+ interface Permit2EvmResourceServerConfig {
107
+ /**
108
+ * Optional specific networks to register
109
+ * If not provided, registers wildcard support (eip155:*)
110
+ */
111
+ networks?: Network[];
112
+ }
113
+ /**
114
+ * Registers Permit2 EVM payment schemes to an t402ResourceServer instance.
115
+ *
116
+ * @param server - The t402ResourceServer instance to register schemes to
117
+ * @param config - Configuration for Permit2 resource server registration
118
+ * @returns The server instance for chaining
119
+ */
120
+ declare function registerPermit2EvmScheme(server: t402ResourceServer, config?: Permit2EvmResourceServerConfig): t402ResourceServer;
121
+
122
+ export { type Permit2EvmResourceServerConfig as P, Permit2EvmScheme as a, type Permit2EvmSchemeConfig as b, registerPermit2EvmScheme as r };
@@ -3,26 +3,26 @@ import {
3
3
  UptoEvmServerScheme,
4
4
  createUptoEvmFacilitatorScheme,
5
5
  createUptoEvmServerScheme
6
- } from "./chunk-ZDGWVHD5.mjs";
6
+ } from "./chunk-EEZNFYCW.mjs";
7
+ import {
8
+ UptoEvmScheme,
9
+ createUptoEvmScheme
10
+ } from "./chunk-AH3XB4XD.mjs";
7
11
  import {
8
12
  ExactEvmScheme
9
13
  } from "./chunk-LM5RZBVP.mjs";
10
- import {
11
- TOKEN_REGISTRY,
12
- USDT_LEGACY_ADDRESSES,
13
- getTokenConfig
14
- } from "./chunk-FUUW3JGG.mjs";
15
14
  import {
16
15
  erc20LegacyABI,
17
16
  legacyAuthorizationTypes
18
17
  } from "./chunk-Y4U7Q543.mjs";
19
- import {
20
- UptoEvmScheme,
21
- createUptoEvmScheme
22
- } from "./chunk-AH3XB4XD.mjs";
23
18
  import {
24
19
  createNonce
25
20
  } from "./chunk-SYVPLXYV.mjs";
21
+ import {
22
+ TOKEN_REGISTRY,
23
+ USDT_LEGACY_ADDRESSES,
24
+ getTokenConfig
25
+ } from "./chunk-FUUW3JGG.mjs";
26
26
  import {
27
27
  __publicField
28
28
  } from "./chunk-NSSMTXJJ.mjs";
@@ -0,0 +1,81 @@
1
+ import { SchemeNetworkClient, PaymentRequirements, PaymentPayload, Network } from '@t402/core/types';
2
+ import { C as ClientEvmSigner } from '../../signer-DcavxxZt.mjs';
3
+ import { SelectPaymentRequirements, PaymentPolicy, t402Client } from '@t402/core/client';
4
+
5
+ /**
6
+ * EVM client implementation for the Permit2 payment scheme.
7
+ *
8
+ * Uses Uniswap Permit2 SignatureTransfer for gasless token approvals.
9
+ */
10
+ declare class Permit2EvmScheme implements SchemeNetworkClient {
11
+ private readonly signer;
12
+ readonly scheme = "permit2";
13
+ /**
14
+ * Creates a new Permit2EvmScheme instance.
15
+ *
16
+ * @param signer - The EVM signer for client operations
17
+ */
18
+ constructor(signer: ClientEvmSigner);
19
+ /**
20
+ * Creates a payment payload for the Permit2 scheme.
21
+ *
22
+ * @param t402Version - The t402 protocol version
23
+ * @param paymentRequirements - The payment requirements
24
+ * @returns Promise resolving to a payment payload
25
+ */
26
+ createPaymentPayload(t402Version: number, paymentRequirements: PaymentRequirements): Promise<Pick<PaymentPayload, "t402Version" | "payload">>;
27
+ /**
28
+ * Sign the Permit2 SignatureTransfer using EIP-712
29
+ *
30
+ * @param permit - The permit transfer data
31
+ * @param spender - The spender address
32
+ * @param requirements - The payment requirements
33
+ * @returns Signed typed data hex string
34
+ */
35
+ private signPermit2;
36
+ }
37
+
38
+ /**
39
+ * Configuration options for registering Permit2 EVM schemes to an t402Client
40
+ */
41
+ interface Permit2EvmClientConfig {
42
+ /**
43
+ * The EVM signer to use for creating payment payloads
44
+ */
45
+ signer: ClientEvmSigner;
46
+ /**
47
+ * Optional payment requirements selector function
48
+ * If not provided, uses the default selector (first available option)
49
+ */
50
+ paymentRequirementsSelector?: SelectPaymentRequirements;
51
+ /**
52
+ * Optional policies to apply to the client
53
+ */
54
+ policies?: PaymentPolicy[];
55
+ /**
56
+ * Optional specific networks to register
57
+ * If not provided, registers wildcard support (eip155:*)
58
+ */
59
+ networks?: Network[];
60
+ }
61
+ /**
62
+ * Registers Permit2 EVM payment schemes to an t402Client instance.
63
+ *
64
+ * @param client - The t402Client instance to register schemes to
65
+ * @param config - Configuration for Permit2 EVM client registration
66
+ * @returns The client instance for chaining
67
+ *
68
+ * @example
69
+ * ```typescript
70
+ * import { registerPermit2EvmScheme } from "@t402/evm/permit2/client";
71
+ * import { t402Client } from "@t402/core/client";
72
+ * import { privateKeyToAccount } from "viem/accounts";
73
+ *
74
+ * const account = privateKeyToAccount("0x...");
75
+ * const client = new t402Client();
76
+ * registerPermit2EvmScheme(client, { signer: account });
77
+ * ```
78
+ */
79
+ declare function registerPermit2EvmScheme(client: t402Client, config: Permit2EvmClientConfig): t402Client;
80
+
81
+ export { type Permit2EvmClientConfig, Permit2EvmScheme, registerPermit2EvmScheme };
@@ -0,0 +1,11 @@
1
+ import {
2
+ Permit2EvmScheme,
3
+ registerPermit2EvmScheme
4
+ } from "../../chunk-3KHB6QTD.mjs";
5
+ import "../../chunk-URG4HEYQ.mjs";
6
+ import "../../chunk-NSSMTXJJ.mjs";
7
+ export {
8
+ Permit2EvmScheme,
9
+ registerPermit2EvmScheme
10
+ };
11
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,82 @@
1
+ import { SchemeNetworkFacilitator, PaymentPayload, PaymentRequirements, VerifyResponse, SettleResponse, Network } from '@t402/core/types';
2
+ import { F as FacilitatorEvmSigner } from '../../signer-DcavxxZt.mjs';
3
+ import { t402Facilitator } from '@t402/core/facilitator';
4
+
5
+ /**
6
+ * Configuration for Permit2 EVM facilitator
7
+ */
8
+ interface Permit2EvmSchemeConfig {
9
+ [key: string]: unknown;
10
+ }
11
+ /**
12
+ * EVM facilitator implementation for the Permit2 payment scheme.
13
+ *
14
+ * Verifies Permit2 signatures and settles payments by calling
15
+ * permitTransferFrom on the Permit2 contract.
16
+ */
17
+ declare class Permit2EvmScheme implements SchemeNetworkFacilitator {
18
+ private readonly signer;
19
+ readonly scheme = "permit2";
20
+ readonly caipFamily = "eip155:*";
21
+ /**
22
+ * Creates a new Permit2 facilitator instance.
23
+ *
24
+ * @param signer - The facilitator EVM signer
25
+ */
26
+ constructor(signer: FacilitatorEvmSigner);
27
+ /**
28
+ * Get mechanism-specific extra data for supported kinds.
29
+ *
30
+ * @param _ - The network identifier
31
+ * @returns Extra data including permit2 contract address
32
+ */
33
+ getExtra(_: string): Record<string, unknown> | undefined;
34
+ /**
35
+ * Get signer addresses for this facilitator.
36
+ *
37
+ * @param _ - The network identifier
38
+ * @returns Array of signer addresses
39
+ */
40
+ getSigners(_: string): string[];
41
+ /**
42
+ * Verify a Permit2 payment payload.
43
+ *
44
+ * @param payload - The payment payload to verify
45
+ * @param requirements - The payment requirements
46
+ * @returns Verification result
47
+ */
48
+ verify(payload: PaymentPayload, requirements: PaymentRequirements): Promise<VerifyResponse>;
49
+ /**
50
+ * Settle a Permit2 payment by executing permitTransferFrom.
51
+ *
52
+ * @param payload - The payment payload
53
+ * @param requirements - The payment requirements
54
+ * @returns Settlement result
55
+ */
56
+ settle(payload: PaymentPayload, requirements: PaymentRequirements): Promise<SettleResponse>;
57
+ }
58
+
59
+ /**
60
+ * Configuration options for registering Permit2 schemes to an t402Facilitator
61
+ */
62
+ interface Permit2EvmFacilitatorConfig {
63
+ /**
64
+ * The EVM signer for facilitator operations (verify and settle)
65
+ */
66
+ signer: FacilitatorEvmSigner;
67
+ /**
68
+ * Networks to register (single network or array of networks)
69
+ * Examples: "eip155:84532", ["eip155:84532", "eip155:1"]
70
+ */
71
+ networks: Network | Network[];
72
+ }
73
+ /**
74
+ * Registers Permit2 EVM payment schemes to an t402Facilitator instance.
75
+ *
76
+ * @param facilitator - The t402Facilitator instance to register schemes to
77
+ * @param config - Configuration for Permit2 EVM facilitator registration
78
+ * @returns The facilitator instance for chaining
79
+ */
80
+ declare function registerPermit2EvmScheme(facilitator: t402Facilitator, config: Permit2EvmFacilitatorConfig): t402Facilitator;
81
+
82
+ export { type Permit2EvmFacilitatorConfig, Permit2EvmScheme, type Permit2EvmSchemeConfig, registerPermit2EvmScheme };