@armory-sh/base 0.2.13 → 0.2.14

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/dist/index.js CHANGED
@@ -104,6 +104,52 @@ function legacyToPaymentPayload(legacy) {
104
104
  };
105
105
  }
106
106
 
107
+ // src/types/v2.ts
108
+ var V2_HEADERS = {
109
+ PAYMENT_SIGNATURE: "PAYMENT-SIGNATURE",
110
+ PAYMENT_REQUIRED: "PAYMENT-REQUIRED",
111
+ PAYMENT_RESPONSE: "PAYMENT-RESPONSE"
112
+ };
113
+ function isCAIP2ChainId(value) {
114
+ return /^eip155:\d+$/.test(value);
115
+ }
116
+ function isCAIPAssetId(value) {
117
+ return /^eip155:\d+\/erc20:0x[a-fA-F0-9]+$/.test(value);
118
+ }
119
+ function isAddress(value) {
120
+ return /^0x[a-fA-F0-9]{40}$/.test(value);
121
+ }
122
+ function isPaymentRequiredV2(obj) {
123
+ return typeof obj === "object" && obj !== null && "x402Version" in obj && obj.x402Version === 2 && "resource" in obj && "accepts" in obj && Array.isArray(obj.accepts);
124
+ }
125
+ function isPaymentPayloadV2(obj) {
126
+ return typeof obj === "object" && obj !== null && "x402Version" in obj && obj.x402Version === 2 && "scheme" in obj && "network" in obj && "payload" in obj;
127
+ }
128
+ function assetIdToAddress(assetId) {
129
+ const match = assetId.match(/\/erc20:(0x[a-fA-F0-9]{40})$/);
130
+ if (!match) throw new Error(`Invalid CAIP asset ID: ${assetId}`);
131
+ return match[1];
132
+ }
133
+ function addressToAssetId(address, chainId) {
134
+ const chain = typeof chainId === "number" ? `eip155:${chainId}` : chainId;
135
+ if (!isCAIP2ChainId(chain)) throw new Error(`Invalid chain ID: ${chain}`);
136
+ return `${chain}/erc20:${address}`;
137
+ }
138
+ function parseSignature(signature) {
139
+ const sig = signature.slice(2);
140
+ return {
141
+ r: `0x${sig.slice(0, 64)}`,
142
+ s: `0x${sig.slice(64, 128)}`,
143
+ v: parseInt(sig.slice(128, 130), 16)
144
+ };
145
+ }
146
+ function combineSignature(v, r, s) {
147
+ const rClean = r.startsWith("0x") ? r.slice(2) : r;
148
+ const sClean = s.startsWith("0x") ? s.slice(2) : s;
149
+ const vHex = v.toString(16).padStart(2, "0");
150
+ return `0x${rClean}${sClean}${vHex}`;
151
+ }
152
+
107
153
  // src/encoding/x402.ts
108
154
  function safeBase64Encode(str) {
109
155
  return Buffer.from(str).toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
@@ -159,34 +205,14 @@ function decodeX402Response(encoded) {
159
205
  const decoded = safeBase64Decode(encoded);
160
206
  return JSON.parse(decoded);
161
207
  }
162
- var X402_HEADERS = {
163
- PAYMENT: "X-PAYMENT",
164
- PAYMENT_RESPONSE: "X-PAYMENT-RESPONSE",
165
- PAYMENT_REQUIRED: "X-PAYMENT-REQUIRED"
166
- };
167
208
  function detectPaymentVersion(headers) {
168
209
  if (headers.has("PAYMENT-SIGNATURE")) {
169
210
  return 2;
170
211
  }
171
- if (headers.has(X402_HEADERS.PAYMENT)) {
172
- const encoded = headers.get(X402_HEADERS.PAYMENT);
173
- if (encoded) {
174
- try {
175
- const decoded = decodePayment(encoded);
176
- if (isPaymentPayload(decoded) && "x402Version" in decoded) {
177
- return decoded.x402Version;
178
- }
179
- return 1;
180
- } catch {
181
- return 1;
182
- }
183
- }
184
- return 1;
185
- }
186
212
  return null;
187
213
  }
188
214
  function extractPaymentFromHeaders(headers) {
189
- const encoded = headers.get(X402_HEADERS.PAYMENT);
215
+ const encoded = headers.get("PAYMENT-SIGNATURE");
190
216
  if (!encoded) return null;
191
217
  try {
192
218
  return decodePayment(encoded);
@@ -197,21 +223,18 @@ function extractPaymentFromHeaders(headers) {
197
223
  function createPaymentRequiredHeaders(requirements) {
198
224
  const accepts = Array.isArray(requirements) ? requirements : [requirements];
199
225
  const response = {
200
- x402Version: 1,
226
+ x402Version: 2,
201
227
  accepts
202
228
  };
203
229
  return {
204
- [X402_HEADERS.PAYMENT_REQUIRED]: safeBase64Encode(JSON.stringify(response))
230
+ [V2_HEADERS.PAYMENT_REQUIRED]: safeBase64Encode(JSON.stringify(response))
205
231
  };
206
232
  }
207
233
  function createSettlementHeaders(settlement) {
208
234
  return {
209
- [X402_HEADERS.PAYMENT_RESPONSE]: encodeSettlementResponse(settlement)
235
+ [V2_HEADERS.PAYMENT_RESPONSE]: encodeSettlementResponse(settlement)
210
236
  };
211
237
  }
212
- function isLegacyV1(payload) {
213
- return typeof payload === "object" && payload !== null && "v" in payload && typeof payload.v === "number";
214
- }
215
238
  function isLegacyV2(payload) {
216
239
  return typeof payload === "object" && payload !== null && "signature" in payload && typeof payload.signature === "object";
217
240
  }
@@ -289,107 +312,9 @@ function normalizeAddress(address) {
289
312
  return address.toLowerCase();
290
313
  }
291
314
 
292
- // src/types/v1.ts
293
- var V1_HEADERS = {
294
- PAYMENT: "X-PAYMENT",
295
- PAYMENT_RESPONSE: "X-PAYMENT-RESPONSE",
296
- PAYMENT_REQUIRED: "X-PAYMENT-REQUIRED"
297
- };
298
- function encodeX402PaymentRequiredV1(data) {
299
- return Buffer.from(JSON.stringify(data)).toString("base64");
300
- }
301
- function decodeX402PaymentRequiredV1(encoded) {
302
- return JSON.parse(Buffer.from(encoded, "base64").toString("utf-8"));
303
- }
304
- function encodeX402PaymentPayloadV1(data) {
305
- return Buffer.from(JSON.stringify(data)).toString("base64");
306
- }
307
- function decodeX402PaymentPayloadV1(encoded) {
308
- return JSON.parse(Buffer.from(encoded, "base64").toString("utf-8"));
309
- }
310
- function encodeX402SettlementResponseV1(data) {
311
- return Buffer.from(JSON.stringify(data)).toString("base64");
312
- }
313
- function decodeX402SettlementResponseV1(encoded) {
314
- return JSON.parse(Buffer.from(encoded, "base64").toString("utf-8"));
315
- }
316
- function encodePaymentPayloadLegacy(payload) {
317
- return Buffer.from(JSON.stringify(payload)).toString("base64");
318
- }
319
- function decodePaymentPayloadLegacy(encoded) {
320
- return JSON.parse(Buffer.from(encoded, "base64").toString("utf-8"));
321
- }
322
- function encodeSettlementResponseLegacy(response) {
323
- return Buffer.from(JSON.stringify(response)).toString("base64");
324
- }
325
- function decodeSettlementResponseLegacy(encoded) {
326
- return JSON.parse(Buffer.from(encoded, "base64").toString("utf-8"));
327
- }
328
- function isX402PaymentRequiredV1(obj) {
329
- return typeof obj === "object" && obj !== null && "x402Version" in obj && obj.x402Version === 1 && "accepts" in obj && Array.isArray(obj.accepts);
330
- }
331
- function isX402PaymentPayloadV1(obj) {
332
- return typeof obj === "object" && obj !== null && "x402Version" in obj && obj.x402Version === 1 && "scheme" in obj && "network" in obj && "payload" in obj;
333
- }
334
- function isLegacyPaymentPayloadV1(obj) {
335
- return typeof obj === "object" && obj !== null && "v" in obj && "r" in obj && "s" in obj && "chainId" in obj && "contractAddress" in obj;
336
- }
337
-
338
- // src/types/v2.ts
339
- var V2_HEADERS = {
340
- PAYMENT_SIGNATURE: "PAYMENT-SIGNATURE",
341
- PAYMENT_REQUIRED: "PAYMENT-REQUIRED",
342
- PAYMENT_RESPONSE: "PAYMENT-RESPONSE"
343
- };
344
- function isCAIP2ChainId(value) {
345
- return /^eip155:\d+$/.test(value);
346
- }
347
- function isCAIPAssetId(value) {
348
- return /^eip155:\d+\/erc20:0x[a-fA-F0-9]+$/.test(value);
349
- }
350
- function isAddress(value) {
351
- return /^0x[a-fA-F0-9]{40}$/.test(value);
352
- }
353
- function isPaymentRequiredV2(obj) {
354
- return typeof obj === "object" && obj !== null && "x402Version" in obj && obj.x402Version === 2 && "resource" in obj && "accepts" in obj && Array.isArray(obj.accepts);
355
- }
356
- function isPaymentPayloadV2(obj) {
357
- return typeof obj === "object" && obj !== null && "x402Version" in obj && obj.x402Version === 2 && "scheme" in obj && "network" in obj && "payload" in obj;
358
- }
359
- function assetIdToAddress(assetId) {
360
- const match = assetId.match(/\/erc20:(0x[a-fA-F0-9]{40})$/);
361
- if (!match) throw new Error(`Invalid CAIP asset ID: ${assetId}`);
362
- return match[1];
363
- }
364
- function addressToAssetId(address, chainId) {
365
- const chain = typeof chainId === "number" ? `eip155:${chainId}` : chainId;
366
- if (!isCAIP2ChainId(chain)) throw new Error(`Invalid chain ID: ${chain}`);
367
- return `${chain}/erc20:${address}`;
368
- }
369
- function parseSignature(signature) {
370
- const sig = signature.slice(2);
371
- return {
372
- r: `0x${sig.slice(0, 64)}`,
373
- s: `0x${sig.slice(64, 128)}`,
374
- v: parseInt(sig.slice(128, 130), 16)
375
- };
376
- }
377
- function combineSignature(v, r, s) {
378
- const rClean = r.startsWith("0x") ? r.slice(2) : r;
379
- const sClean = s.startsWith("0x") ? s.slice(2) : s;
380
- const vHex = v.toString(16).padStart(2, "0");
381
- return `0x${rClean}${sClean}${vHex}`;
382
- }
383
-
384
315
  // src/types/protocol.ts
385
- function isX402V1Payload(obj) {
386
- return typeof obj === "object" && obj !== null && "x402Version" in obj && obj.x402Version === 1 && "scheme" in obj && "network" in obj && "payload" in obj;
387
- }
388
316
  function isX402V2Payload(obj) {
389
- return typeof obj === "object" && obj !== null && "x402Version" in obj && obj.x402Version === 2 && "scheme" in obj && "network" in obj && "payload" in obj;
390
- }
391
- function isLegacyV1Payload(obj) {
392
- return typeof obj === "object" && obj !== null && "v" in obj && "r" in obj && "s" in obj && "chainId" in obj && "contractAddress" in obj && !("x402Version" in obj);
317
+ return typeof obj === "object" && obj !== null && "x402Version" in obj && obj.x402Version === 2 && "signature" in obj && "chainId" in obj && "assetId" in obj;
393
318
  }
394
319
  function isLegacyV2Payload(obj) {
395
320
  if (typeof obj !== "object" || obj === null) return false;
@@ -397,85 +322,226 @@ function isLegacyV2Payload(obj) {
397
322
  const signature = record.signature;
398
323
  return "signature" in record && typeof signature === "object" && signature !== null && "v" in signature && "chainId" in record && typeof record.chainId === "string" && record.chainId.startsWith("eip155:") && "assetId" in record && !("x402Version" in record);
399
324
  }
400
- function getPaymentVersion(payload) {
401
- if (isX402V1Payload(payload)) return 1;
402
- if (isX402V2Payload(payload)) return 2;
403
- return 1;
404
- }
405
- function isX402V1Requirements(obj) {
406
- return typeof obj === "object" && obj !== null && "scheme" in obj && "network" in obj && typeof obj.network === "string" && !obj.network.includes(":") && // Not CAIP-2 format
407
- "maxAmountRequired" in obj;
408
- }
409
325
  function isX402V2Requirements(obj) {
410
- return typeof obj === "object" && obj !== null && "scheme" in obj && "network" in obj && typeof obj.network === "string" && obj.network.startsWith("eip155:") && // CAIP-2 format
411
- "amount" in obj;
412
- }
413
- function getRequirementsVersion(requirements) {
414
- if (isX402V1Requirements(requirements)) return 1;
415
- if (isX402V2Requirements(requirements)) return 2;
416
- return 1;
417
- }
418
- function isX402V1Settlement(obj) {
419
- return typeof obj === "object" && obj !== null && "success" in obj && "network" in obj && typeof obj.network === "string" && !obj.network.includes(":");
326
+ return typeof obj === "object" && obj !== null && "scheme" in obj && obj.scheme === "exact" && "network" in obj && typeof obj.network === "string" && obj.network.startsWith("eip155:") && // CAIP-2 format
327
+ "amount" in obj && "asset" in obj && "payTo" in obj && "maxTimeoutSeconds" in obj;
420
328
  }
421
329
  function isX402V2Settlement(obj) {
422
- return typeof obj === "object" && obj !== null && "success" in obj && "network" in obj && typeof obj.network === "string" && obj.network.startsWith("eip155:");
423
- }
424
- function getSettlementVersion(response) {
425
- if (isX402V1Settlement(response)) return 1;
426
- if (isX402V2Settlement(response)) return 2;
427
- return 1;
428
- }
429
- function isX402V1PaymentRequired(obj) {
430
- return typeof obj === "object" && obj !== null && "x402Version" in obj && obj.x402Version === 1 && "accepts" in obj;
330
+ return typeof obj === "object" && obj !== null && "success" in obj && typeof obj.success === "boolean" && "network" in obj && typeof obj.network === "string" && obj.network.startsWith("eip155:");
431
331
  }
432
332
  function isX402V2PaymentRequired(obj) {
433
333
  return typeof obj === "object" && obj !== null && "x402Version" in obj && obj.x402Version === 2 && "resource" in obj && "accepts" in obj;
434
334
  }
435
- function getPaymentRequiredVersion(obj) {
436
- if (isX402V1PaymentRequired(obj)) return 1;
437
- if (isX402V2PaymentRequired(obj)) return 2;
438
- return 1;
439
- }
440
- function getPaymentHeaderName(version) {
441
- return version === 1 ? "X-PAYMENT" : "PAYMENT-SIGNATURE";
442
- }
443
- function getPaymentResponseHeaderName(version) {
444
- return version === 1 ? "X-PAYMENT-RESPONSE" : "PAYMENT-RESPONSE";
445
- }
446
- function getPaymentRequiredHeaderName(version) {
447
- return version === 1 ? "X-PAYMENT-REQUIRED" : "PAYMENT-REQUIRED";
448
- }
335
+ var PAYMENT_SIGNATURE_HEADER = "PAYMENT-SIGNATURE";
336
+ var PAYMENT_RESPONSE_HEADER = "PAYMENT-RESPONSE";
337
+ var PAYMENT_REQUIRED_HEADER = "PAYMENT-REQUIRED";
449
338
  function isSettlementSuccessful(response) {
450
339
  return "success" in response ? response.success : false;
451
340
  }
452
341
  function getTxHash(response) {
453
342
  if ("transaction" in response) return response.transaction;
454
- if ("txHash" in response) return response.txHash;
455
343
  return void 0;
456
344
  }
457
- function isV1(obj) {
458
- return isX402V1Payload(obj) || isLegacyV1Payload(obj);
459
- }
460
- function isV2(obj) {
461
- return isX402V2Payload(obj) || isLegacyV2Payload(obj);
462
- }
463
345
 
464
346
  // src/types/networks.ts
465
- import { type as arkType2 } from "arktype";
347
+ var isEvmAddress = (value) => /^0x[a-fA-F0-9]{40}$/.test(value);
348
+ var tokenRegistry = /* @__PURE__ */ new Map();
349
+ var tokenKey = (chainId, contractAddress) => `${chainId}:${contractAddress.toLowerCase()}`;
350
+ var NETWORKS = {
351
+ ethereum: {
352
+ name: "Ethereum Mainnet",
353
+ chainId: 1,
354
+ usdcAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
355
+ rpcUrl: "https://eth.llamarpc.com",
356
+ caip2Id: "eip155:1",
357
+ caipAssetId: "eip155:1/erc20:0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
358
+ },
359
+ base: {
360
+ name: "Base Mainnet",
361
+ chainId: 8453,
362
+ usdcAddress: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
363
+ rpcUrl: "https://mainnet.base.org",
364
+ caip2Id: "eip155:8453",
365
+ caipAssetId: "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
366
+ },
367
+ "base-sepolia": {
368
+ name: "Base Sepolia",
369
+ chainId: 84532,
370
+ usdcAddress: "0x036CbD53842c5426634e7929541eA237834d2D14",
371
+ rpcUrl: "https://sepolia.base.org",
372
+ caip2Id: "eip155:84532",
373
+ caipAssetId: "eip155:84532/erc20:0x036CbD53842c5426634e7929541eA237834d2D14"
374
+ },
375
+ "skale-base": {
376
+ name: "SKALE Base",
377
+ chainId: 1187947933,
378
+ usdcAddress: "0x85889c8c714505E0c94b30fcfcF64fE3Ac8FCb20",
379
+ rpcUrl: "https://skale-base.skalenodes.com/v1/base",
380
+ caip2Id: "eip155:1187947933",
381
+ caipAssetId: "eip155:1187947933/erc20:0x85889c8c714505E0c94b30fcfcF64fE3Ac8FCb20"
382
+ },
383
+ "skale-base-sepolia": {
384
+ name: "SKALE Base Sepolia",
385
+ chainId: 324705682,
386
+ usdcAddress: "0x2e08028E3C4c2356572E096d8EF835cD5C6030bD",
387
+ rpcUrl: "https://base-sepolia-testnet.skalenodes.com/v1/jubilant-horrible-ancha",
388
+ caip2Id: "eip155:324705682",
389
+ caipAssetId: "eip155:324705682/erc20:0x2e08028E3C4c2356572E096d8EF835cD5C6030bD"
390
+ },
391
+ "ethereum-sepolia": {
392
+ name: "Ethereum Sepolia",
393
+ chainId: 11155111,
394
+ usdcAddress: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",
395
+ rpcUrl: "https://rpc.sepolia.org",
396
+ caip2Id: "eip155:11155111",
397
+ caipAssetId: "eip155:11155111/erc20:0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"
398
+ }
399
+ };
400
+ var getNetworkConfig = (name) => NETWORKS[name];
401
+ var getNetworkByChainId = (chainId) => Object.values(NETWORKS).find((c) => c.chainId === chainId);
402
+ var getMainnets = () => Object.values(NETWORKS).filter((c) => !c.name.toLowerCase().includes("sepolia"));
403
+ var getTestnets = () => Object.values(NETWORKS).filter((c) => c.name.toLowerCase().includes("sepolia"));
404
+ var registerToken = (token) => {
405
+ if (typeof token !== "object" || token === null) {
406
+ throw new Error("Invalid token: must be an object");
407
+ }
408
+ const t = token;
409
+ if (typeof t.symbol !== "string") {
410
+ throw new Error("Invalid token: symbol must be a string");
411
+ }
412
+ if (typeof t.name !== "string") {
413
+ throw new Error("Invalid token: name must be a string");
414
+ }
415
+ if (typeof t.version !== "string") {
416
+ throw new Error("Invalid token: version must be a string");
417
+ }
418
+ if (typeof t.contractAddress !== "string" || !isEvmAddress(t.contractAddress)) {
419
+ throw new Error("Invalid token: contractAddress must be a valid EVM address");
420
+ }
421
+ if (typeof t.chainId !== "number" || !Number.isInteger(t.chainId) || t.chainId <= 0) {
422
+ throw new Error("Invalid token: chainId must be a positive integer");
423
+ }
424
+ if (t.decimals !== void 0 && (typeof t.decimals !== "number" || !Number.isInteger(t.decimals) || t.decimals < 0)) {
425
+ throw new Error("Invalid token: decimals must be a non-negative integer");
426
+ }
427
+ const validated = {
428
+ symbol: t.symbol,
429
+ name: t.name,
430
+ version: t.version,
431
+ contractAddress: t.contractAddress,
432
+ chainId: t.chainId,
433
+ decimals: t.decimals
434
+ };
435
+ tokenRegistry.set(tokenKey(validated.chainId, validated.contractAddress), validated);
436
+ return validated;
437
+ };
438
+ var getCustomToken = (chainId, contractAddress) => tokenRegistry.get(tokenKey(chainId, contractAddress));
439
+ var getAllCustomTokens = () => Array.from(tokenRegistry.values());
440
+ var unregisterToken = (chainId, contractAddress) => tokenRegistry.delete(tokenKey(chainId, contractAddress));
441
+ var isCustomToken = (chainId, contractAddress) => tokenRegistry.has(tokenKey(chainId, contractAddress));
466
442
 
467
- // src/validation.ts
468
- import { type as arkType } from "arktype";
469
- var CustomTokenSchema = arkType({
470
- symbol: "string",
471
- name: "string",
472
- version: "string",
473
- contractAddress: "/^0x[a-fA-F0-9]{40}$/",
474
- chainId: "number.integer > 0",
475
- decimals: "number.integer >= 0?"
443
+ // src/abi/erc20.ts
444
+ var ERC20_ABI = [
445
+ {
446
+ type: "function",
447
+ name: "transferWithAuthorization",
448
+ stateMutability: "nonpayable",
449
+ inputs: [
450
+ { name: "from", type: "address" },
451
+ { name: "to", type: "address" },
452
+ { name: "amount", type: "uint256" },
453
+ { name: "validAfter", type: "uint256" },
454
+ { name: "expiry", type: "uint256" },
455
+ { name: "v", type: "uint8" },
456
+ { name: "r", type: "bytes32" },
457
+ { name: "s", type: "bytes32" }
458
+ ],
459
+ outputs: []
460
+ },
461
+ {
462
+ type: "function",
463
+ name: "receiveWithAuthorization",
464
+ stateMutability: "nonpayable",
465
+ inputs: [
466
+ { name: "from", type: "address" },
467
+ { name: "to", type: "address" },
468
+ { name: "amount", type: "uint256" },
469
+ { name: "validAfter", type: "uint256" },
470
+ { name: "expiry", type: "uint256" },
471
+ { name: "v", type: "uint8" },
472
+ { name: "r", type: "bytes32" },
473
+ { name: "s", type: "bytes32" }
474
+ ],
475
+ outputs: []
476
+ },
477
+ {
478
+ type: "function",
479
+ name: "balanceOf",
480
+ stateMutability: "view",
481
+ inputs: [{ name: "account", type: "address" }],
482
+ outputs: [{ name: "balance", type: "uint256" }]
483
+ },
484
+ {
485
+ type: "function",
486
+ name: "name",
487
+ stateMutability: "view",
488
+ inputs: [],
489
+ outputs: [{ name: "", type: "string" }]
490
+ },
491
+ {
492
+ type: "function",
493
+ name: "symbol",
494
+ stateMutability: "view",
495
+ inputs: [],
496
+ outputs: [{ name: "", type: "string" }]
497
+ }
498
+ ];
499
+
500
+ // src/eip712.ts
501
+ var EIP712_TYPES = {
502
+ TransferWithAuthorization: [
503
+ { name: "from", type: "address" },
504
+ { name: "to", type: "address" },
505
+ { name: "value", type: "uint256" },
506
+ { name: "validAfter", type: "uint256" },
507
+ { name: "validBefore", type: "uint256" },
508
+ { name: "nonce", type: "uint256" }
509
+ ]
510
+ };
511
+ var USDC_DOMAIN = {
512
+ NAME: "USD Coin",
513
+ VERSION: "2"
514
+ };
515
+ var createEIP712Domain = (chainId, contractAddress) => ({
516
+ name: USDC_DOMAIN.NAME,
517
+ version: USDC_DOMAIN.VERSION,
518
+ chainId,
519
+ verifyingContract: contractAddress
520
+ });
521
+ var createTransferWithAuthorization = (params) => ({
522
+ from: params.from,
523
+ to: params.to,
524
+ value: BigInt(params.value),
525
+ validAfter: BigInt(params.validAfter),
526
+ validBefore: BigInt(params.validBefore),
527
+ nonce: BigInt(params.nonce)
476
528
  });
477
- var NetworkIdSchema = arkType("string | number | object");
478
- var TokenIdSchema = arkType("string | number | object");
529
+ var isAddress2 = (value) => /^0x[a-fA-F0-9]{40}$/.test(value);
530
+ var validateTransferWithAuthorization = (message) => {
531
+ if (!isAddress2(message.from)) throw new Error(`Invalid "from" address: ${message.from}`);
532
+ if (!isAddress2(message.to)) throw new Error(`Invalid "to" address: ${message.to}`);
533
+ if (message.value < 0n) throw new Error(`"value" must be non-negative: ${message.value}`);
534
+ if (message.validAfter < 0n) throw new Error(`"validAfter" must be non-negative: ${message.validAfter}`);
535
+ if (message.validBefore < 0n) throw new Error(`"validBefore" must be non-negative: ${message.validBefore}`);
536
+ if (message.validAfter >= message.validBefore) {
537
+ throw new Error(`"validAfter" (${message.validAfter}) must be before "validBefore" (${message.validBefore})`);
538
+ }
539
+ if (message.nonce < 0n) throw new Error(`"nonce" must be non-negative: ${message.nonce}`);
540
+ return true;
541
+ };
542
+
543
+ // src/validation.ts
544
+ var isEvmAddress2 = (value) => /^0x[a-fA-F0-9]{40}$/.test(value);
479
545
  var createError = (code, message, details) => ({
480
546
  code,
481
547
  message,
@@ -483,14 +549,6 @@ var createError = (code, message, details) => ({
483
549
  });
484
550
  var normalizeNetworkName = (name) => name.toLowerCase().replace(/\s+/g, "-").replace("-mainnet", "").replace(/-mainnet/, "").replace("mainnet-", "").replace(/-sepolia$/, "-sepolia").replace(/^-|-$/g, "");
485
551
  var resolveNetwork = (input) => {
486
- const inputCheck = NetworkIdSchema(input);
487
- if (inputCheck instanceof arkType.errors) {
488
- return createError(
489
- "VALIDATION_FAILED",
490
- "Invalid network input type",
491
- { value: input, validOptions: ["string (name/CAIP-2)", "number (chainId)", "NetworkConfig"] }
492
- );
493
- }
494
552
  if (typeof input === "object" && input !== null && "chainId" in input) {
495
553
  const config = input;
496
554
  if (!config.chainId || !config.usdcAddress || !config.caip2Id) {
@@ -555,16 +613,7 @@ var resolveNetwork = (input) => {
555
613
  };
556
614
  var getAvailableNetworks = () => Object.keys(NETWORKS);
557
615
  var normalizeTokenSymbol = (symbol) => symbol.toUpperCase();
558
- var isEvmAddress = (value) => /^0x[a-fA-F0-9]{40}$/.test(value);
559
616
  var resolveToken = (input, network) => {
560
- const inputCheck = TokenIdSchema(input);
561
- if (inputCheck instanceof arkType.errors) {
562
- return createError(
563
- "VALIDATION_FAILED",
564
- "Invalid token input type",
565
- { value: input, validOptions: ["string (symbol/address/CAIP Asset)", "number (deprecated)", "CustomToken"] }
566
- );
567
- }
568
617
  if (typeof input === "object" && input !== null && "contractAddress" in input) {
569
618
  const config = input;
570
619
  if (!config.chainId || !config.contractAddress || !config.symbol) {
@@ -590,7 +639,7 @@ var resolveToken = (input, network) => {
590
639
  };
591
640
  }
592
641
  if (typeof input === "string") {
593
- if (isEvmAddress(input)) {
642
+ if (isEvmAddress2(input)) {
594
643
  const contractAddress = input;
595
644
  if (network) {
596
645
  const customToken = getCustomToken(network.config.chainId, contractAddress);
@@ -830,13 +879,13 @@ var validatePaymentConfig = (network, token, facilitators, payTo = "0x0000000000
830
879
  network: resolvedNetwork,
831
880
  token: resolvedToken,
832
881
  facilitators: resolvedFacilitators,
833
- version: "auto",
882
+ version: 2,
834
883
  payTo,
835
884
  amount
836
885
  };
837
886
  };
838
887
  var validateAcceptConfig = (options, payTo, amount) => {
839
- const { networks: networkInputs, tokens: tokenInputs, facilitators, version = "auto" } = options;
888
+ const { networks: networkInputs, tokens: tokenInputs, facilitators, version = 2 } = options;
840
889
  const networkIds = networkInputs?.length ? networkInputs : Object.keys(NETWORKS);
841
890
  const tokenIds = tokenInputs?.length ? tokenInputs : ["usdc"];
842
891
  const networks = [];
@@ -906,224 +955,121 @@ var isResolvedToken = (value) => {
906
955
  return typeof value === "object" && value !== null && "config" in value && "caipAsset" in value;
907
956
  };
908
957
 
909
- // src/types/networks.ts
910
- var tokenRegistry = /* @__PURE__ */ new Map();
911
- var tokenKey = (chainId, contractAddress) => `${chainId}:${contractAddress.toLowerCase()}`;
912
- var NETWORKS = {
913
- ethereum: {
914
- name: "Ethereum Mainnet",
915
- chainId: 1,
916
- usdcAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
917
- rpcUrl: "https://eth.llamarpc.com",
918
- caip2Id: "eip155:1",
919
- caipAssetId: "eip155:1/erc20:0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
920
- },
921
- base: {
922
- name: "Base Mainnet",
923
- chainId: 8453,
924
- usdcAddress: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
925
- rpcUrl: "https://mainnet.base.org",
926
- caip2Id: "eip155:8453",
927
- caipAssetId: "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
928
- },
929
- "base-sepolia": {
930
- name: "Base Sepolia",
931
- chainId: 84532,
932
- usdcAddress: "0x036CbD53842c5426634e7929541eA237834d2D14",
933
- rpcUrl: "https://sepolia.base.org",
934
- caip2Id: "eip155:84532",
935
- caipAssetId: "eip155:84532/erc20:0x036CbD53842c5426634e7929541eA237834d2D14"
936
- },
937
- "skale-base": {
938
- name: "SKALE Base",
939
- chainId: 1187947933,
940
- usdcAddress: "0x85889c8c714505E0c94b30fcfcF64fE3Ac8FCb20",
941
- rpcUrl: "https://skale-base.skalenodes.com/v1/base",
942
- caip2Id: "eip155:1187947933",
943
- caipAssetId: "eip155:1187947933/erc20:0x85889c8c714505E0c94b30fcfcF64fE3Ac8FCb20"
944
- },
945
- "skale-base-sepolia": {
946
- name: "SKALE Base Sepolia",
947
- chainId: 324705682,
948
- usdcAddress: "0x2e08028E3C4c2356572E096d8EF835cD5C6030bD",
949
- rpcUrl: "https://base-sepolia-testnet.skalenodes.com/v1/jubilant-horrible-ancha",
950
- caip2Id: "eip155:324705682",
951
- caipAssetId: "eip155:324705682/erc20:0x2e08028E3C4c2356572E096d8EF835cD5C6030bD"
952
- },
953
- "ethereum-sepolia": {
954
- name: "Ethereum Sepolia",
955
- chainId: 11155111,
956
- usdcAddress: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",
957
- rpcUrl: "https://rpc.sepolia.org",
958
- caip2Id: "eip155:11155111",
959
- caipAssetId: "eip155:11155111/erc20:0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"
960
- }
961
- };
962
- var getNetworkConfig = (name) => NETWORKS[name];
963
- var getNetworkByChainId = (chainId) => Object.values(NETWORKS).find((c) => c.chainId === chainId);
964
- var getMainnets = () => Object.values(NETWORKS).filter((c) => !c.name.toLowerCase().includes("sepolia"));
965
- var getTestnets = () => Object.values(NETWORKS).filter((c) => c.name.toLowerCase().includes("sepolia"));
966
- var registerToken = (token) => {
967
- const validated = CustomTokenSchema(token);
968
- if (validated instanceof arkType2.errors) {
969
- throw new Error(`Invalid token: ${validated.summary}`);
970
- }
971
- tokenRegistry.set(tokenKey(validated.chainId, validated.contractAddress), validated);
972
- return validated;
973
- };
974
- var getCustomToken = (chainId, contractAddress) => tokenRegistry.get(tokenKey(chainId, contractAddress));
975
- var getAllCustomTokens = () => Array.from(tokenRegistry.values());
976
- var unregisterToken = (chainId, contractAddress) => tokenRegistry.delete(tokenKey(chainId, contractAddress));
977
- var isCustomToken = (chainId, contractAddress) => tokenRegistry.has(tokenKey(chainId, contractAddress));
978
-
979
- // src/abi/erc20.ts
980
- var ERC20_ABI = [
981
- {
982
- type: "function",
983
- name: "transferWithAuthorization",
984
- stateMutability: "nonpayable",
985
- inputs: [
986
- { name: "from", type: "address" },
987
- { name: "to", type: "address" },
988
- { name: "amount", type: "uint256" },
989
- { name: "validAfter", type: "uint256" },
990
- { name: "expiry", type: "uint256" },
991
- { name: "v", type: "uint8" },
992
- { name: "r", type: "bytes32" },
993
- { name: "s", type: "bytes32" }
994
- ],
995
- outputs: []
996
- },
997
- {
998
- type: "function",
999
- name: "receiveWithAuthorization",
1000
- stateMutability: "nonpayable",
1001
- inputs: [
1002
- { name: "from", type: "address" },
1003
- { name: "to", type: "address" },
1004
- { name: "amount", type: "uint256" },
1005
- { name: "validAfter", type: "uint256" },
1006
- { name: "expiry", type: "uint256" },
1007
- { name: "v", type: "uint8" },
1008
- { name: "r", type: "bytes32" },
1009
- { name: "s", type: "bytes32" }
1010
- ],
1011
- outputs: []
1012
- },
1013
- {
1014
- type: "function",
1015
- name: "balanceOf",
1016
- stateMutability: "view",
1017
- inputs: [{ name: "account", type: "address" }],
1018
- outputs: [{ name: "balance", type: "uint256" }]
1019
- },
1020
- {
1021
- type: "function",
1022
- name: "name",
1023
- stateMutability: "view",
1024
- inputs: [],
1025
- outputs: [{ name: "", type: "string" }]
1026
- },
1027
- {
1028
- type: "function",
1029
- name: "symbol",
1030
- stateMutability: "view",
1031
- inputs: [],
1032
- outputs: [{ name: "", type: "string" }]
1033
- }
1034
- ];
1035
-
1036
- // src/eip712.ts
1037
- var EIP712_TYPES = {
1038
- TransferWithAuthorization: [
1039
- { name: "from", type: "address" },
1040
- { name: "to", type: "address" },
1041
- { name: "value", type: "uint256" },
1042
- { name: "validAfter", type: "uint256" },
1043
- { name: "validBefore", type: "uint256" },
1044
- { name: "nonce", type: "uint256" }
1045
- ]
1046
- };
1047
- var USDC_DOMAIN = {
1048
- NAME: "USD Coin",
1049
- VERSION: "2"
1050
- };
1051
- var createEIP712Domain = (chainId, contractAddress) => ({
1052
- name: USDC_DOMAIN.NAME,
1053
- version: USDC_DOMAIN.VERSION,
1054
- chainId,
1055
- verifyingContract: contractAddress
1056
- });
1057
- var createTransferWithAuthorization = (params) => ({
1058
- from: params.from,
1059
- to: params.to,
1060
- value: BigInt(params.value),
1061
- validAfter: BigInt(params.validAfter),
1062
- validBefore: BigInt(params.validBefore),
1063
- nonce: BigInt(params.nonce)
1064
- });
1065
- var isAddress2 = (value) => /^0x[a-fA-F0-9]{40}$/.test(value);
1066
- var validateTransferWithAuthorization = (message) => {
1067
- if (!isAddress2(message.from)) throw new Error(`Invalid "from" address: ${message.from}`);
1068
- if (!isAddress2(message.to)) throw new Error(`Invalid "to" address: ${message.to}`);
1069
- if (message.value < 0n) throw new Error(`"value" must be non-negative: ${message.value}`);
1070
- if (message.validAfter < 0n) throw new Error(`"validAfter" must be non-negative: ${message.validAfter}`);
1071
- if (message.validBefore < 0n) throw new Error(`"validBefore" must be non-negative: ${message.validBefore}`);
1072
- if (message.validAfter >= message.validBefore) {
1073
- throw new Error(`"validAfter" (${message.validAfter}) must be before "validBefore" (${message.validBefore})`);
1074
- }
1075
- if (message.nonce < 0n) throw new Error(`"nonce" must be non-negative: ${message.nonce}`);
1076
- return true;
1077
- };
1078
-
1079
958
  // src/encoding.ts
1080
- var base64Encode = (data) => Buffer.from(JSON.stringify(data)).toString("base64");
1081
- var base64Decode = (encoded) => JSON.parse(Buffer.from(encoded, "base64").toString("utf-8"));
1082
959
  var jsonEncode = (data) => JSON.stringify(data);
1083
960
  var jsonDecode = (encoded) => JSON.parse(encoded);
1084
- var encodePaymentV1 = (payload) => base64Encode(payload);
1085
- var decodePaymentV1 = (encoded) => base64Decode(encoded);
1086
- var encodeSettlementV1 = (response) => base64Encode(response);
1087
- var decodeSettlementV1 = (encoded) => base64Decode(encoded);
1088
961
  var encodePaymentV2 = (payload) => jsonEncode(payload);
1089
962
  var decodePaymentV2 = (encoded) => jsonDecode(encoded);
1090
963
  var encodeSettlementV2 = (response) => jsonEncode(response);
1091
964
  var decodeSettlementV2 = (encoded) => jsonDecode(encoded);
1092
- var detectPaymentVersion2 = (headers) => {
1093
- if (headers.has(V1_HEADERS.PAYMENT)) return 1;
1094
- if (headers.has(V2_HEADERS.PAYMENT_SIGNATURE)) return 2;
1095
- return null;
1096
- };
1097
- var decodePayment2 = (headers) => {
1098
- const version = detectPaymentVersion2(headers);
1099
- if (version === null) {
1100
- throw new Error("No valid payment headers found. Expected X-PAYMENT (v1) or PAYMENT-SIGNATURE (v2)");
965
+ var isPaymentV2 = (payload) => "signature" in payload && typeof payload.signature === "object";
966
+ var isSettlementV2 = (response) => "status" in response;
967
+
968
+ // src/fixtures/payloads.ts
969
+ var TEST_PRIVATE_KEY = "0x0000000000000000000000000000000000000000000000000000000000000000001";
970
+ var TEST_PAYER_ADDRESS = "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb1";
971
+ var TEST_PAY_TO_ADDRESS = "0x1234567890123456789012345678901234567890";
972
+ var TEST_CONTRACT_ADDRESS = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
973
+ var createV2Authorization = (nonce) => ({
974
+ from: TEST_PAYER_ADDRESS,
975
+ to: TEST_PAY_TO_ADDRESS,
976
+ value: "1000000",
977
+ validAfter: Math.floor(Date.now() / 1e3).toString(),
978
+ validBefore: (Math.floor(Date.now() / 1e3) + 3600).toString(),
979
+ nonce: `0x${Buffer.from(nonce).toString("hex").padStart(64, "0")}`
980
+ });
981
+ var createV2SchemePayload = (nonce) => ({
982
+ signature: `0x${"b".repeat(130)}`,
983
+ authorization: createV2Authorization(nonce)
984
+ });
985
+ var createX402V2Payload = (nonce) => ({
986
+ x402Version: 2,
987
+ scheme: "exact",
988
+ network: "eip155:84532",
989
+ payload: createV2SchemePayload(nonce ?? "test_v2_nonce"),
990
+ resource: {
991
+ url: "https://example.com/api/test",
992
+ description: "Test resource"
1101
993
  }
1102
- const headerName = version === 1 ? V1_HEADERS.PAYMENT : V2_HEADERS.PAYMENT_SIGNATURE;
1103
- const encoded = headers.get(headerName);
1104
- if (!encoded) throw new Error(`Header ${headerName} is empty`);
1105
- return version === 1 ? decodePaymentV1(encoded) : decodePaymentV2(encoded);
994
+ });
995
+ var createLegacyV2Payload = (nonce) => ({
996
+ from: TEST_PAYER_ADDRESS,
997
+ to: TEST_PAY_TO_ADDRESS,
998
+ amount: "1000000",
999
+ nonce: nonce ?? "test_legacy_v2_nonce",
1000
+ expiry: Math.floor(Date.now() / 1e3) + 3600,
1001
+ signature: {
1002
+ v: 27,
1003
+ r: `0x${"f".repeat(64)}`,
1004
+ s: `0x${"0".repeat(64)}`
1005
+ },
1006
+ chainId: "eip155:84532",
1007
+ assetId: `eip155:84532/erc20:${TEST_CONTRACT_ADDRESS.slice(2)}`
1008
+ });
1009
+ var INVALID_PAYLOADS = {
1010
+ missingFields: {},
1011
+ invalidAddress: {
1012
+ x402Version: 2,
1013
+ scheme: "exact",
1014
+ network: "eip155:84532",
1015
+ payload: {
1016
+ signature: `0x${"i".repeat(130)}`,
1017
+ authorization: {
1018
+ from: "not-an-address",
1019
+ to: TEST_PAY_TO_ADDRESS,
1020
+ value: "1000000",
1021
+ validAfter: Math.floor(Date.now() / 1e3).toString(),
1022
+ validBefore: (Math.floor(Date.now() / 1e3) + 3600).toString(),
1023
+ nonce: `0x${"1".repeat(64)}`
1024
+ }
1025
+ }
1026
+ },
1027
+ expired: (() => {
1028
+ const payload = createX402V2Payload("test_expired_nonce");
1029
+ payload.payload.authorization.validBefore = (Math.floor(Date.now() / 1e3) - 100).toString();
1030
+ return payload;
1031
+ })(),
1032
+ malformedSignature: (() => {
1033
+ const payload = createX402V2Payload("test_malformed_sig_nonce");
1034
+ payload.payload.signature = "not-hex";
1035
+ return payload;
1036
+ })()
1106
1037
  };
1107
- var decodeSettlement = (headers) => {
1108
- const v1Response = headers.get(V1_HEADERS.PAYMENT_RESPONSE);
1109
- if (v1Response) return decodeSettlementV1(v1Response);
1110
- const v2Response = headers.get(V2_HEADERS.PAYMENT_RESPONSE);
1111
- if (v2Response) return decodeSettlementV2(v2Response);
1112
- throw new Error("No valid settlement response headers found. Expected X-PAYMENT-RESPONSE (v1) or PAYMENT-RESPONSE (v2)");
1038
+
1039
+ // src/fixtures/config.ts
1040
+ var TEST_PRIVATE_KEY2 = process.env.TEST_PRIVATE_KEY || "0x0000000000000000000000000000000000000000000000000000000000000000000001";
1041
+ var TEST_PAY_TO_ADDRESS2 = "0x1234567890123456789012345678901234567890";
1042
+ var TEST_NETWORK = "base-sepolia";
1043
+ var TEST_AMOUNT_DECIMAL = "1.0";
1044
+ var FACILITATOR_URL = process.env.FACILITATOR_URL || "https://facilitator.payai.network";
1045
+ var TEST_RPC_URL = process.env.TEST_RPC_URL || "https://sepolia.base.org";
1046
+ var DEFAULT_PAYMENT_CONFIG = {
1047
+ payTo: TEST_PAY_TO_ADDRESS2,
1048
+ amount: TEST_AMOUNT_DECIMAL,
1049
+ network: TEST_NETWORK,
1050
+ defaultVersion: 2,
1051
+ accept: {
1052
+ networks: [TEST_NETWORK],
1053
+ tokens: ["usdc"],
1054
+ facilitators: [{ url: FACILITATOR_URL }]
1055
+ }
1113
1056
  };
1114
- var isPaymentV1 = (payload) => "v" in payload && typeof payload.v === "number";
1115
- var isPaymentV2 = (payload) => "signature" in payload && typeof payload.signature === "object";
1116
- var isSettlementV1 = (response) => "success" in response;
1117
- var isSettlementV2 = (response) => "status" in response;
1118
1057
  export {
1058
+ DEFAULT_PAYMENT_CONFIG,
1119
1059
  EIP712_TYPES,
1120
1060
  ERC20_ABI,
1061
+ INVALID_PAYLOADS,
1121
1062
  NETWORKS,
1063
+ PAYMENT_REQUIRED_HEADER,
1064
+ PAYMENT_RESPONSE_HEADER,
1065
+ PAYMENT_SIGNATURE_HEADER,
1122
1066
  SCHEMES,
1067
+ TEST_CONTRACT_ADDRESS,
1068
+ TEST_PAYER_ADDRESS,
1069
+ TEST_PAY_TO_ADDRESS,
1070
+ TEST_PRIVATE_KEY,
1123
1071
  USDC_DOMAIN,
1124
- V1_HEADERS,
1125
1072
  V2_HEADERS,
1126
- X402_HEADERS,
1127
1073
  X402_VERSION,
1128
1074
  addressToAssetId,
1129
1075
  assetIdToAddress,
@@ -1132,40 +1078,23 @@ export {
1132
1078
  combineSignature as combineSignatureV2,
1133
1079
  createEIP712Domain,
1134
1080
  createError,
1081
+ createLegacyV2Payload,
1135
1082
  createNonce,
1136
1083
  createPaymentRequiredHeaders,
1137
1084
  createSettlementHeaders,
1138
1085
  createTransferWithAuthorization,
1086
+ createX402V2Payload,
1139
1087
  decodePayment,
1140
- decodePayment2 as decodePaymentLegacy,
1141
- decodePaymentPayloadLegacy as decodePaymentPayload,
1142
- decodePaymentPayloadLegacy,
1143
- decodePaymentV1,
1144
1088
  decodePaymentV2,
1145
- decodeSettlement as decodeSettlementLegacy,
1146
1089
  decodeSettlementResponse,
1147
- decodeSettlementResponseLegacy,
1148
- decodeSettlementV1,
1149
1090
  decodeSettlementV2,
1150
- decodeX402PaymentPayloadV1,
1151
- decodeX402PaymentRequiredV1,
1152
1091
  decodeX402Response,
1153
- decodeX402SettlementResponseV1,
1154
1092
  detectPaymentVersion,
1155
- detectPaymentVersion2 as detectPaymentVersionLegacy,
1156
1093
  encodePayment,
1157
- encodePaymentPayloadLegacy as encodePaymentPayload,
1158
- encodePaymentPayloadLegacy,
1159
- encodePaymentV1,
1160
1094
  encodePaymentV2,
1161
1095
  encodeSettlementResponse,
1162
- encodeSettlementResponseLegacy,
1163
- encodeSettlementV1,
1164
1096
  encodeSettlementV2,
1165
- encodeX402PaymentPayloadV1,
1166
- encodeX402PaymentRequiredV1,
1167
1097
  encodeX402Response,
1168
- encodeX402SettlementResponseV1,
1169
1098
  extractPaymentFromHeaders,
1170
1099
  fromAtomicUnits,
1171
1100
  getAllCustomTokens,
@@ -1176,13 +1105,6 @@ export {
1176
1105
  getMainnets,
1177
1106
  getNetworkByChainId,
1178
1107
  getNetworkConfig,
1179
- getPaymentHeaderName,
1180
- getPaymentRequiredHeaderName,
1181
- getPaymentRequiredVersion,
1182
- getPaymentResponseHeaderName,
1183
- getPaymentVersion,
1184
- getRequirementsVersion,
1185
- getSettlementVersion,
1186
1108
  getTestnets,
1187
1109
  getTxHash,
1188
1110
  isAddress,
@@ -1190,30 +1112,18 @@ export {
1190
1112
  isCAIPAssetId,
1191
1113
  isCustomToken,
1192
1114
  isExactEvmPayload,
1193
- isLegacyPaymentPayloadV1,
1194
- isLegacyV1,
1195
- isLegacyV1Payload,
1196
1115
  isLegacyV2,
1116
+ isLegacyV2Payload,
1197
1117
  isPaymentPayload,
1198
1118
  isPaymentPayloadV2,
1199
1119
  isPaymentRequiredV2,
1200
- isPaymentV1,
1201
1120
  isPaymentV2,
1202
1121
  isResolvedNetwork,
1203
1122
  isResolvedToken,
1204
1123
  isSettlementSuccessful,
1205
- isSettlementV1,
1206
1124
  isSettlementV2,
1207
- isV1,
1208
- isV2,
1209
1125
  isValidAddress,
1210
1126
  isValidationError,
1211
- isX402PaymentPayloadV1,
1212
- isX402PaymentRequiredV1,
1213
- isX402V1Payload,
1214
- isX402V1PaymentRequired,
1215
- isX402V1Requirements,
1216
- isX402V1Settlement,
1217
1127
  isX402V2Payload,
1218
1128
  isX402V2PaymentRequired,
1219
1129
  isX402V2Requirements,