@armory-sh/base 0.2.13 → 0.2.16
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/data/tokens.d.ts +40 -0
- package/dist/encoding/x402.d.ts +15 -26
- package/dist/encoding.d.ts +19 -12
- package/dist/fixtures/payloads.d.ts +3 -5
- package/dist/fixtures/requirements.d.ts +4 -4
- package/dist/index.d.ts +8 -8
- package/dist/index.js +534 -446
- package/dist/types/{simple.d.ts → api.d.ts} +4 -4
- package/dist/types/protocol.d.ts +13 -70
- package/dist/types/v2.d.ts +5 -1
- package/dist/types/x402.d.ts +4 -5
- package/dist/validation.d.ts +2 -10
- package/package.json +3 -6
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(
|
|
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:
|
|
226
|
+
x402Version: 2,
|
|
201
227
|
accepts
|
|
202
228
|
};
|
|
203
229
|
return {
|
|
204
|
-
[
|
|
230
|
+
[V2_HEADERS.PAYMENT_REQUIRED]: safeBase64Encode(JSON.stringify(response))
|
|
205
231
|
};
|
|
206
232
|
}
|
|
207
233
|
function createSettlementHeaders(settlement) {
|
|
208
234
|
return {
|
|
209
|
-
[
|
|
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 && "
|
|
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,380 @@ 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
|
-
|
|
436
|
-
|
|
437
|
-
|
|
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
|
-
|
|
458
|
-
|
|
345
|
+
|
|
346
|
+
// src/types/networks.ts
|
|
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));
|
|
442
|
+
|
|
443
|
+
// src/data/tokens.ts
|
|
444
|
+
var USDC_BASE = {
|
|
445
|
+
symbol: "USDC",
|
|
446
|
+
name: "USD Coin",
|
|
447
|
+
version: "2",
|
|
448
|
+
contractAddress: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
|
|
449
|
+
chainId: 8453,
|
|
450
|
+
decimals: 6
|
|
451
|
+
};
|
|
452
|
+
var EURC_BASE = {
|
|
453
|
+
symbol: "EURC",
|
|
454
|
+
name: "EURC",
|
|
455
|
+
version: "2",
|
|
456
|
+
contractAddress: "0x60a3E35Cc302bFA44Cb288Bc5a4F316Fdb1adb42",
|
|
457
|
+
chainId: 8453,
|
|
458
|
+
decimals: 6
|
|
459
|
+
};
|
|
460
|
+
var USDC_BASE_SEPOLIA = {
|
|
461
|
+
symbol: "USDC",
|
|
462
|
+
name: "USD Coin",
|
|
463
|
+
version: "2",
|
|
464
|
+
contractAddress: "0x036CbD5d9A3b9231f83BefBE4F9E3FAA03eee2e0",
|
|
465
|
+
chainId: 84532,
|
|
466
|
+
decimals: 6
|
|
467
|
+
};
|
|
468
|
+
var USDC_SKALE_BASE = {
|
|
469
|
+
symbol: "USDC",
|
|
470
|
+
name: "USD Coin",
|
|
471
|
+
version: "2",
|
|
472
|
+
contractAddress: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
|
|
473
|
+
chainId: 1187947933,
|
|
474
|
+
decimals: 6
|
|
475
|
+
};
|
|
476
|
+
var SKL_SKALE_BASE = {
|
|
477
|
+
symbol: "SKL",
|
|
478
|
+
name: "SKALE",
|
|
479
|
+
version: "1",
|
|
480
|
+
contractAddress: "0xaf2e1eb5c9f4a94dbf7400f76e4ec0d8de18fb8584",
|
|
481
|
+
chainId: 1187947933,
|
|
482
|
+
decimals: 18
|
|
483
|
+
};
|
|
484
|
+
var USDT_SKALE_BASE = {
|
|
485
|
+
symbol: "USDT",
|
|
486
|
+
name: "Tether USD",
|
|
487
|
+
version: "1",
|
|
488
|
+
contractAddress: "0x2bF5bF154b4881Ef4E3Ff28Ac1a60Fa1aDcb5fE5F6",
|
|
489
|
+
chainId: 1187947933,
|
|
490
|
+
decimals: 6
|
|
491
|
+
};
|
|
492
|
+
var WBTC_SKALE_BASE = {
|
|
493
|
+
symbol: "WBTC",
|
|
494
|
+
name: "Wrapped BTC",
|
|
495
|
+
version: "1",
|
|
496
|
+
contractAddress: "0x1aee79F6316aD699F96468A32F7BaF2fD8d55c0000",
|
|
497
|
+
chainId: 1187947933,
|
|
498
|
+
decimals: 8
|
|
499
|
+
};
|
|
500
|
+
var WETH_SKALE_BASE = {
|
|
501
|
+
symbol: "WETH",
|
|
502
|
+
name: "Wrapped Ether",
|
|
503
|
+
version: "1",
|
|
504
|
+
contractAddress: "0x8fF2237e4d845bc7Db6E1f1a93C8bCb288Bc5a400",
|
|
505
|
+
chainId: 1187947933,
|
|
506
|
+
decimals: 18
|
|
507
|
+
};
|
|
508
|
+
var SKL_SKALE_BASE_SEPOLIA = {
|
|
509
|
+
symbol: "SKL",
|
|
510
|
+
name: "SKALE",
|
|
511
|
+
version: "1",
|
|
512
|
+
contractAddress: "0xaf2e1eb5c9f4a94dbf7400f76e4ec0d8de18fb8584",
|
|
513
|
+
chainId: 324705682,
|
|
514
|
+
decimals: 18
|
|
515
|
+
};
|
|
516
|
+
var USDC_SKALE_BASE_SEPOLIA = {
|
|
517
|
+
symbol: "USDC",
|
|
518
|
+
name: "USD Coin",
|
|
519
|
+
version: "2",
|
|
520
|
+
contractAddress: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
|
|
521
|
+
chainId: 324705682,
|
|
522
|
+
decimals: 6
|
|
523
|
+
};
|
|
524
|
+
var USDT_SKALE_BASE_SEPOLIA = {
|
|
525
|
+
symbol: "USDT",
|
|
526
|
+
name: "Tether USD",
|
|
527
|
+
version: "1",
|
|
528
|
+
contractAddress: "0xe8af39ca6558a983f6b5f8c0b828cc609f7a1c200",
|
|
529
|
+
chainId: 324705682,
|
|
530
|
+
decimals: 6
|
|
531
|
+
};
|
|
532
|
+
var WBTC_SKALE_BASE_SEPOLIA = {
|
|
533
|
+
symbol: "WBTC",
|
|
534
|
+
name: "Wrapped BTC",
|
|
535
|
+
version: "1",
|
|
536
|
+
contractAddress: "0x1aee79F6316aD699F96468A32F7BaF2fD8d55c0000",
|
|
537
|
+
chainId: 324705682,
|
|
538
|
+
decimals: 8
|
|
539
|
+
};
|
|
540
|
+
var WETH_SKALE_BASE_SEPOLIA = {
|
|
541
|
+
symbol: "WETH",
|
|
542
|
+
name: "Wrapped Ether",
|
|
543
|
+
version: "1",
|
|
544
|
+
contractAddress: "0x8fF2237e4d845bc7Db6E1f1a93C8bCb288Bc5a400",
|
|
545
|
+
chainId: 324705682,
|
|
546
|
+
decimals: 18
|
|
547
|
+
};
|
|
548
|
+
var TOKENS = {
|
|
549
|
+
USDC_BASE,
|
|
550
|
+
USDC_BASE_SEPOLIA,
|
|
551
|
+
EURC_BASE,
|
|
552
|
+
USDC_SKALE_BASE,
|
|
553
|
+
USDT_SKALE_BASE,
|
|
554
|
+
WBTC_SKALE_BASE,
|
|
555
|
+
WETH_SKALE_BASE,
|
|
556
|
+
SKL_SKALE_BASE,
|
|
557
|
+
SKL_SKALE_BASE_SEPOLIA,
|
|
558
|
+
USDC_SKALE_BASE_SEPOLIA,
|
|
559
|
+
USDT_SKALE_BASE_SEPOLIA,
|
|
560
|
+
WBTC_SKALE_BASE_SEPOLIA,
|
|
561
|
+
WETH_SKALE_BASE_SEPOLIA
|
|
562
|
+
};
|
|
563
|
+
function getToken(chainId, contractAddress) {
|
|
564
|
+
const tokens = Object.values(TOKENS);
|
|
565
|
+
return tokens.find(
|
|
566
|
+
(t) => t.chainId === chainId && t.contractAddress.toLowerCase() === contractAddress.toLowerCase()
|
|
567
|
+
);
|
|
568
|
+
}
|
|
569
|
+
function getAllTokens() {
|
|
570
|
+
return Object.values(TOKENS);
|
|
571
|
+
}
|
|
572
|
+
function getTokensBySymbol(symbol) {
|
|
573
|
+
return getAllTokens().filter((t) => t.symbol.toUpperCase() === symbol.toUpperCase());
|
|
574
|
+
}
|
|
575
|
+
function getTokensByChain(chainId) {
|
|
576
|
+
return getAllTokens().filter((t) => t.chainId === chainId);
|
|
577
|
+
}
|
|
578
|
+
function getUSDCTokens() {
|
|
579
|
+
return getTokensBySymbol("USDC");
|
|
580
|
+
}
|
|
581
|
+
function getEURCTokens() {
|
|
582
|
+
return getTokensBySymbol("EURC");
|
|
459
583
|
}
|
|
460
|
-
function
|
|
461
|
-
return
|
|
584
|
+
function getSKLTokens() {
|
|
585
|
+
return getTokensBySymbol("SKL");
|
|
462
586
|
}
|
|
587
|
+
function getUSDTTokens() {
|
|
588
|
+
return getTokensBySymbol("USDT");
|
|
589
|
+
}
|
|
590
|
+
function getWBTCTokens() {
|
|
591
|
+
return getTokensBySymbol("WBTC");
|
|
592
|
+
}
|
|
593
|
+
function getWETHTokens() {
|
|
594
|
+
return getTokensBySymbol("WETH");
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
// src/abi/erc20.ts
|
|
598
|
+
var ERC20_ABI = [
|
|
599
|
+
{
|
|
600
|
+
type: "function",
|
|
601
|
+
name: "transferWithAuthorization",
|
|
602
|
+
stateMutability: "nonpayable",
|
|
603
|
+
inputs: [
|
|
604
|
+
{ name: "from", type: "address" },
|
|
605
|
+
{ name: "to", type: "address" },
|
|
606
|
+
{ name: "amount", type: "uint256" },
|
|
607
|
+
{ name: "validAfter", type: "uint256" },
|
|
608
|
+
{ name: "expiry", type: "uint256" },
|
|
609
|
+
{ name: "v", type: "uint8" },
|
|
610
|
+
{ name: "r", type: "bytes32" },
|
|
611
|
+
{ name: "s", type: "bytes32" }
|
|
612
|
+
],
|
|
613
|
+
outputs: []
|
|
614
|
+
},
|
|
615
|
+
{
|
|
616
|
+
type: "function",
|
|
617
|
+
name: "receiveWithAuthorization",
|
|
618
|
+
stateMutability: "nonpayable",
|
|
619
|
+
inputs: [
|
|
620
|
+
{ name: "from", type: "address" },
|
|
621
|
+
{ name: "to", type: "address" },
|
|
622
|
+
{ name: "amount", type: "uint256" },
|
|
623
|
+
{ name: "validAfter", type: "uint256" },
|
|
624
|
+
{ name: "expiry", type: "uint256" },
|
|
625
|
+
{ name: "v", type: "uint8" },
|
|
626
|
+
{ name: "r", type: "bytes32" },
|
|
627
|
+
{ name: "s", type: "bytes32" }
|
|
628
|
+
],
|
|
629
|
+
outputs: []
|
|
630
|
+
},
|
|
631
|
+
{
|
|
632
|
+
type: "function",
|
|
633
|
+
name: "balanceOf",
|
|
634
|
+
stateMutability: "view",
|
|
635
|
+
inputs: [{ name: "account", type: "address" }],
|
|
636
|
+
outputs: [{ name: "balance", type: "uint256" }]
|
|
637
|
+
},
|
|
638
|
+
{
|
|
639
|
+
type: "function",
|
|
640
|
+
name: "name",
|
|
641
|
+
stateMutability: "view",
|
|
642
|
+
inputs: [],
|
|
643
|
+
outputs: [{ name: "", type: "string" }]
|
|
644
|
+
},
|
|
645
|
+
{
|
|
646
|
+
type: "function",
|
|
647
|
+
name: "symbol",
|
|
648
|
+
stateMutability: "view",
|
|
649
|
+
inputs: [],
|
|
650
|
+
outputs: [{ name: "", type: "string" }]
|
|
651
|
+
}
|
|
652
|
+
];
|
|
463
653
|
|
|
464
|
-
// src/
|
|
465
|
-
|
|
654
|
+
// src/eip712.ts
|
|
655
|
+
var EIP712_TYPES = {
|
|
656
|
+
TransferWithAuthorization: [
|
|
657
|
+
{ name: "from", type: "address" },
|
|
658
|
+
{ name: "to", type: "address" },
|
|
659
|
+
{ name: "value", type: "uint256" },
|
|
660
|
+
{ name: "validAfter", type: "uint256" },
|
|
661
|
+
{ name: "validBefore", type: "uint256" },
|
|
662
|
+
{ name: "nonce", type: "uint256" }
|
|
663
|
+
]
|
|
664
|
+
};
|
|
665
|
+
var USDC_DOMAIN = {
|
|
666
|
+
NAME: "USD Coin",
|
|
667
|
+
VERSION: "2"
|
|
668
|
+
};
|
|
669
|
+
var createEIP712Domain = (chainId, contractAddress) => ({
|
|
670
|
+
name: USDC_DOMAIN.NAME,
|
|
671
|
+
version: USDC_DOMAIN.VERSION,
|
|
672
|
+
chainId,
|
|
673
|
+
verifyingContract: contractAddress
|
|
674
|
+
});
|
|
675
|
+
var createTransferWithAuthorization = (params) => ({
|
|
676
|
+
from: params.from,
|
|
677
|
+
to: params.to,
|
|
678
|
+
value: BigInt(params.value),
|
|
679
|
+
validAfter: BigInt(params.validAfter),
|
|
680
|
+
validBefore: BigInt(params.validBefore),
|
|
681
|
+
nonce: BigInt(params.nonce)
|
|
682
|
+
});
|
|
683
|
+
var isAddress2 = (value) => /^0x[a-fA-F0-9]{40}$/.test(value);
|
|
684
|
+
var validateTransferWithAuthorization = (message) => {
|
|
685
|
+
if (!isAddress2(message.from)) throw new Error(`Invalid "from" address: ${message.from}`);
|
|
686
|
+
if (!isAddress2(message.to)) throw new Error(`Invalid "to" address: ${message.to}`);
|
|
687
|
+
if (message.value < 0n) throw new Error(`"value" must be non-negative: ${message.value}`);
|
|
688
|
+
if (message.validAfter < 0n) throw new Error(`"validAfter" must be non-negative: ${message.validAfter}`);
|
|
689
|
+
if (message.validBefore < 0n) throw new Error(`"validBefore" must be non-negative: ${message.validBefore}`);
|
|
690
|
+
if (message.validAfter >= message.validBefore) {
|
|
691
|
+
throw new Error(`"validAfter" (${message.validAfter}) must be before "validBefore" (${message.validBefore})`);
|
|
692
|
+
}
|
|
693
|
+
if (message.nonce < 0n) throw new Error(`"nonce" must be non-negative: ${message.nonce}`);
|
|
694
|
+
return true;
|
|
695
|
+
};
|
|
466
696
|
|
|
467
697
|
// src/validation.ts
|
|
468
|
-
|
|
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?"
|
|
476
|
-
});
|
|
477
|
-
var NetworkIdSchema = arkType("string | number | object");
|
|
478
|
-
var TokenIdSchema = arkType("string | number | object");
|
|
698
|
+
var isEvmAddress2 = (value) => /^0x[a-fA-F0-9]{40}$/.test(value);
|
|
479
699
|
var createError = (code, message, details) => ({
|
|
480
700
|
code,
|
|
481
701
|
message,
|
|
@@ -483,14 +703,6 @@ var createError = (code, message, details) => ({
|
|
|
483
703
|
});
|
|
484
704
|
var normalizeNetworkName = (name) => name.toLowerCase().replace(/\s+/g, "-").replace("-mainnet", "").replace(/-mainnet/, "").replace("mainnet-", "").replace(/-sepolia$/, "-sepolia").replace(/^-|-$/g, "");
|
|
485
705
|
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
706
|
if (typeof input === "object" && input !== null && "chainId" in input) {
|
|
495
707
|
const config = input;
|
|
496
708
|
if (!config.chainId || !config.usdcAddress || !config.caip2Id) {
|
|
@@ -555,16 +767,7 @@ var resolveNetwork = (input) => {
|
|
|
555
767
|
};
|
|
556
768
|
var getAvailableNetworks = () => Object.keys(NETWORKS);
|
|
557
769
|
var normalizeTokenSymbol = (symbol) => symbol.toUpperCase();
|
|
558
|
-
var isEvmAddress = (value) => /^0x[a-fA-F0-9]{40}$/.test(value);
|
|
559
770
|
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
771
|
if (typeof input === "object" && input !== null && "contractAddress" in input) {
|
|
569
772
|
const config = input;
|
|
570
773
|
if (!config.chainId || !config.contractAddress || !config.symbol) {
|
|
@@ -590,7 +793,7 @@ var resolveToken = (input, network) => {
|
|
|
590
793
|
};
|
|
591
794
|
}
|
|
592
795
|
if (typeof input === "string") {
|
|
593
|
-
if (
|
|
796
|
+
if (isEvmAddress2(input)) {
|
|
594
797
|
const contractAddress = input;
|
|
595
798
|
if (network) {
|
|
596
799
|
const customToken = getCustomToken(network.config.chainId, contractAddress);
|
|
@@ -830,13 +1033,13 @@ var validatePaymentConfig = (network, token, facilitators, payTo = "0x0000000000
|
|
|
830
1033
|
network: resolvedNetwork,
|
|
831
1034
|
token: resolvedToken,
|
|
832
1035
|
facilitators: resolvedFacilitators,
|
|
833
|
-
version:
|
|
1036
|
+
version: 2,
|
|
834
1037
|
payTo,
|
|
835
1038
|
amount
|
|
836
1039
|
};
|
|
837
1040
|
};
|
|
838
1041
|
var validateAcceptConfig = (options, payTo, amount) => {
|
|
839
|
-
const { networks: networkInputs, tokens: tokenInputs, facilitators, version =
|
|
1042
|
+
const { networks: networkInputs, tokens: tokenInputs, facilitators, version = 2 } = options;
|
|
840
1043
|
const networkIds = networkInputs?.length ? networkInputs : Object.keys(NETWORKS);
|
|
841
1044
|
const tokenIds = tokenInputs?.length ? tokenInputs : ["usdc"];
|
|
842
1045
|
const networks = [];
|
|
@@ -906,224 +1109,135 @@ var isResolvedToken = (value) => {
|
|
|
906
1109
|
return typeof value === "object" && value !== null && "config" in value && "caipAsset" in value;
|
|
907
1110
|
};
|
|
908
1111
|
|
|
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
1112
|
// 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
1113
|
var jsonEncode = (data) => JSON.stringify(data);
|
|
1083
1114
|
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
1115
|
var encodePaymentV2 = (payload) => jsonEncode(payload);
|
|
1089
1116
|
var decodePaymentV2 = (encoded) => jsonDecode(encoded);
|
|
1090
1117
|
var encodeSettlementV2 = (response) => jsonEncode(response);
|
|
1091
1118
|
var decodeSettlementV2 = (encoded) => jsonDecode(encoded);
|
|
1092
|
-
var
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
var
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1119
|
+
var isPaymentV2 = (payload) => "signature" in payload && typeof payload.signature === "object";
|
|
1120
|
+
var isSettlementV2 = (response) => "status" in response;
|
|
1121
|
+
|
|
1122
|
+
// src/fixtures/payloads.ts
|
|
1123
|
+
var TEST_PRIVATE_KEY = "0x0000000000000000000000000000000000000000000000000000000000000000001";
|
|
1124
|
+
var TEST_PAYER_ADDRESS = "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb1";
|
|
1125
|
+
var TEST_PAY_TO_ADDRESS = "0x1234567890123456789012345678901234567890";
|
|
1126
|
+
var TEST_CONTRACT_ADDRESS = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
|
|
1127
|
+
var createV2Authorization = (nonce) => ({
|
|
1128
|
+
from: TEST_PAYER_ADDRESS,
|
|
1129
|
+
to: TEST_PAY_TO_ADDRESS,
|
|
1130
|
+
value: "1000000",
|
|
1131
|
+
validAfter: Math.floor(Date.now() / 1e3).toString(),
|
|
1132
|
+
validBefore: (Math.floor(Date.now() / 1e3) + 3600).toString(),
|
|
1133
|
+
nonce: `0x${Buffer.from(nonce).toString("hex").padStart(64, "0")}`
|
|
1134
|
+
});
|
|
1135
|
+
var createV2SchemePayload = (nonce) => ({
|
|
1136
|
+
signature: `0x${"b".repeat(130)}`,
|
|
1137
|
+
authorization: createV2Authorization(nonce)
|
|
1138
|
+
});
|
|
1139
|
+
var createX402V2Payload = (nonce) => ({
|
|
1140
|
+
x402Version: 2,
|
|
1141
|
+
scheme: "exact",
|
|
1142
|
+
network: "eip155:84532",
|
|
1143
|
+
payload: createV2SchemePayload(nonce ?? "test_v2_nonce"),
|
|
1144
|
+
resource: {
|
|
1145
|
+
url: "https://example.com/api/test",
|
|
1146
|
+
description: "Test resource"
|
|
1101
1147
|
}
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1148
|
+
});
|
|
1149
|
+
var createLegacyV2Payload = (nonce) => ({
|
|
1150
|
+
from: TEST_PAYER_ADDRESS,
|
|
1151
|
+
to: TEST_PAY_TO_ADDRESS,
|
|
1152
|
+
amount: "1000000",
|
|
1153
|
+
nonce: nonce ?? "test_legacy_v2_nonce",
|
|
1154
|
+
expiry: Math.floor(Date.now() / 1e3) + 3600,
|
|
1155
|
+
signature: {
|
|
1156
|
+
v: 27,
|
|
1157
|
+
r: `0x${"f".repeat(64)}`,
|
|
1158
|
+
s: `0x${"0".repeat(64)}`
|
|
1159
|
+
},
|
|
1160
|
+
chainId: "eip155:84532",
|
|
1161
|
+
assetId: `eip155:84532/erc20:${TEST_CONTRACT_ADDRESS.slice(2)}`
|
|
1162
|
+
});
|
|
1163
|
+
var INVALID_PAYLOADS = {
|
|
1164
|
+
missingFields: {},
|
|
1165
|
+
invalidAddress: {
|
|
1166
|
+
x402Version: 2,
|
|
1167
|
+
scheme: "exact",
|
|
1168
|
+
network: "eip155:84532",
|
|
1169
|
+
payload: {
|
|
1170
|
+
signature: `0x${"i".repeat(130)}`,
|
|
1171
|
+
authorization: {
|
|
1172
|
+
from: "not-an-address",
|
|
1173
|
+
to: TEST_PAY_TO_ADDRESS,
|
|
1174
|
+
value: "1000000",
|
|
1175
|
+
validAfter: Math.floor(Date.now() / 1e3).toString(),
|
|
1176
|
+
validBefore: (Math.floor(Date.now() / 1e3) + 3600).toString(),
|
|
1177
|
+
nonce: `0x${"1".repeat(64)}`
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
},
|
|
1181
|
+
expired: (() => {
|
|
1182
|
+
const payload = createX402V2Payload("test_expired_nonce");
|
|
1183
|
+
payload.payload.authorization.validBefore = (Math.floor(Date.now() / 1e3) - 100).toString();
|
|
1184
|
+
return payload;
|
|
1185
|
+
})(),
|
|
1186
|
+
malformedSignature: (() => {
|
|
1187
|
+
const payload = createX402V2Payload("test_malformed_sig_nonce");
|
|
1188
|
+
payload.payload.signature = "not-hex";
|
|
1189
|
+
return payload;
|
|
1190
|
+
})()
|
|
1106
1191
|
};
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1192
|
+
|
|
1193
|
+
// src/fixtures/config.ts
|
|
1194
|
+
var TEST_PRIVATE_KEY2 = process.env.TEST_PRIVATE_KEY || "0x0000000000000000000000000000000000000000000000000000000000000000000001";
|
|
1195
|
+
var TEST_PAY_TO_ADDRESS2 = "0x1234567890123456789012345678901234567890";
|
|
1196
|
+
var TEST_NETWORK = "base-sepolia";
|
|
1197
|
+
var TEST_AMOUNT_DECIMAL = "1.0";
|
|
1198
|
+
var FACILITATOR_URL = process.env.FACILITATOR_URL || "https://facilitator.payai.network";
|
|
1199
|
+
var TEST_RPC_URL = process.env.TEST_RPC_URL || "https://sepolia.base.org";
|
|
1200
|
+
var DEFAULT_PAYMENT_CONFIG = {
|
|
1201
|
+
payTo: TEST_PAY_TO_ADDRESS2,
|
|
1202
|
+
amount: TEST_AMOUNT_DECIMAL,
|
|
1203
|
+
network: TEST_NETWORK,
|
|
1204
|
+
defaultVersion: 2,
|
|
1205
|
+
accept: {
|
|
1206
|
+
networks: [TEST_NETWORK],
|
|
1207
|
+
tokens: ["usdc"],
|
|
1208
|
+
facilitators: [{ url: FACILITATOR_URL }]
|
|
1209
|
+
}
|
|
1113
1210
|
};
|
|
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
1211
|
export {
|
|
1212
|
+
DEFAULT_PAYMENT_CONFIG,
|
|
1119
1213
|
EIP712_TYPES,
|
|
1120
1214
|
ERC20_ABI,
|
|
1215
|
+
EURC_BASE,
|
|
1216
|
+
INVALID_PAYLOADS,
|
|
1121
1217
|
NETWORKS,
|
|
1218
|
+
PAYMENT_REQUIRED_HEADER,
|
|
1219
|
+
PAYMENT_RESPONSE_HEADER,
|
|
1220
|
+
PAYMENT_SIGNATURE_HEADER,
|
|
1122
1221
|
SCHEMES,
|
|
1222
|
+
SKL_SKALE_BASE,
|
|
1223
|
+
SKL_SKALE_BASE_SEPOLIA,
|
|
1224
|
+
TEST_CONTRACT_ADDRESS,
|
|
1225
|
+
TEST_PAYER_ADDRESS,
|
|
1226
|
+
TEST_PAY_TO_ADDRESS,
|
|
1227
|
+
TEST_PRIVATE_KEY,
|
|
1228
|
+
TOKENS,
|
|
1229
|
+
USDC_BASE,
|
|
1230
|
+
USDC_BASE_SEPOLIA,
|
|
1123
1231
|
USDC_DOMAIN,
|
|
1124
|
-
|
|
1232
|
+
USDC_SKALE_BASE,
|
|
1233
|
+
USDC_SKALE_BASE_SEPOLIA,
|
|
1234
|
+
USDT_SKALE_BASE,
|
|
1235
|
+
USDT_SKALE_BASE_SEPOLIA,
|
|
1125
1236
|
V2_HEADERS,
|
|
1126
|
-
|
|
1237
|
+
WBTC_SKALE_BASE,
|
|
1238
|
+
WBTC_SKALE_BASE_SEPOLIA,
|
|
1239
|
+
WETH_SKALE_BASE,
|
|
1240
|
+
WETH_SKALE_BASE_SEPOLIA,
|
|
1127
1241
|
X402_VERSION,
|
|
1128
1242
|
addressToAssetId,
|
|
1129
1243
|
assetIdToAddress,
|
|
@@ -1132,88 +1246,62 @@ export {
|
|
|
1132
1246
|
combineSignature as combineSignatureV2,
|
|
1133
1247
|
createEIP712Domain,
|
|
1134
1248
|
createError,
|
|
1249
|
+
createLegacyV2Payload,
|
|
1135
1250
|
createNonce,
|
|
1136
1251
|
createPaymentRequiredHeaders,
|
|
1137
1252
|
createSettlementHeaders,
|
|
1138
1253
|
createTransferWithAuthorization,
|
|
1254
|
+
createX402V2Payload,
|
|
1139
1255
|
decodePayment,
|
|
1140
|
-
decodePayment2 as decodePaymentLegacy,
|
|
1141
|
-
decodePaymentPayloadLegacy as decodePaymentPayload,
|
|
1142
|
-
decodePaymentPayloadLegacy,
|
|
1143
|
-
decodePaymentV1,
|
|
1144
1256
|
decodePaymentV2,
|
|
1145
|
-
decodeSettlement as decodeSettlementLegacy,
|
|
1146
1257
|
decodeSettlementResponse,
|
|
1147
|
-
decodeSettlementResponseLegacy,
|
|
1148
|
-
decodeSettlementV1,
|
|
1149
1258
|
decodeSettlementV2,
|
|
1150
|
-
decodeX402PaymentPayloadV1,
|
|
1151
|
-
decodeX402PaymentRequiredV1,
|
|
1152
1259
|
decodeX402Response,
|
|
1153
|
-
decodeX402SettlementResponseV1,
|
|
1154
1260
|
detectPaymentVersion,
|
|
1155
|
-
detectPaymentVersion2 as detectPaymentVersionLegacy,
|
|
1156
1261
|
encodePayment,
|
|
1157
|
-
encodePaymentPayloadLegacy as encodePaymentPayload,
|
|
1158
|
-
encodePaymentPayloadLegacy,
|
|
1159
|
-
encodePaymentV1,
|
|
1160
1262
|
encodePaymentV2,
|
|
1161
1263
|
encodeSettlementResponse,
|
|
1162
|
-
encodeSettlementResponseLegacy,
|
|
1163
|
-
encodeSettlementV1,
|
|
1164
1264
|
encodeSettlementV2,
|
|
1165
|
-
encodeX402PaymentPayloadV1,
|
|
1166
|
-
encodeX402PaymentRequiredV1,
|
|
1167
1265
|
encodeX402Response,
|
|
1168
|
-
encodeX402SettlementResponseV1,
|
|
1169
1266
|
extractPaymentFromHeaders,
|
|
1170
1267
|
fromAtomicUnits,
|
|
1171
1268
|
getAllCustomTokens,
|
|
1269
|
+
getAllTokens,
|
|
1172
1270
|
getAvailableNetworks,
|
|
1173
1271
|
getAvailableTokens,
|
|
1174
1272
|
getCurrentTimestamp,
|
|
1175
1273
|
getCustomToken,
|
|
1274
|
+
getEURCTokens,
|
|
1176
1275
|
getMainnets,
|
|
1177
1276
|
getNetworkByChainId,
|
|
1178
1277
|
getNetworkConfig,
|
|
1179
|
-
|
|
1180
|
-
getPaymentRequiredHeaderName,
|
|
1181
|
-
getPaymentRequiredVersion,
|
|
1182
|
-
getPaymentResponseHeaderName,
|
|
1183
|
-
getPaymentVersion,
|
|
1184
|
-
getRequirementsVersion,
|
|
1185
|
-
getSettlementVersion,
|
|
1278
|
+
getSKLTokens,
|
|
1186
1279
|
getTestnets,
|
|
1280
|
+
getToken,
|
|
1281
|
+
getTokensByChain,
|
|
1282
|
+
getTokensBySymbol,
|
|
1187
1283
|
getTxHash,
|
|
1284
|
+
getUSDCTokens,
|
|
1285
|
+
getUSDTTokens,
|
|
1286
|
+
getWBTCTokens,
|
|
1287
|
+
getWETHTokens,
|
|
1188
1288
|
isAddress,
|
|
1189
1289
|
isCAIP2ChainId,
|
|
1190
1290
|
isCAIPAssetId,
|
|
1191
1291
|
isCustomToken,
|
|
1192
1292
|
isExactEvmPayload,
|
|
1193
|
-
isLegacyPaymentPayloadV1,
|
|
1194
|
-
isLegacyV1,
|
|
1195
|
-
isLegacyV1Payload,
|
|
1196
1293
|
isLegacyV2,
|
|
1294
|
+
isLegacyV2Payload,
|
|
1197
1295
|
isPaymentPayload,
|
|
1198
1296
|
isPaymentPayloadV2,
|
|
1199
1297
|
isPaymentRequiredV2,
|
|
1200
|
-
isPaymentV1,
|
|
1201
1298
|
isPaymentV2,
|
|
1202
1299
|
isResolvedNetwork,
|
|
1203
1300
|
isResolvedToken,
|
|
1204
1301
|
isSettlementSuccessful,
|
|
1205
|
-
isSettlementV1,
|
|
1206
1302
|
isSettlementV2,
|
|
1207
|
-
isV1,
|
|
1208
|
-
isV2,
|
|
1209
1303
|
isValidAddress,
|
|
1210
1304
|
isValidationError,
|
|
1211
|
-
isX402PaymentPayloadV1,
|
|
1212
|
-
isX402PaymentRequiredV1,
|
|
1213
|
-
isX402V1Payload,
|
|
1214
|
-
isX402V1PaymentRequired,
|
|
1215
|
-
isX402V1Requirements,
|
|
1216
|
-
isX402V1Settlement,
|
|
1217
1305
|
isX402V2Payload,
|
|
1218
1306
|
isX402V2PaymentRequired,
|
|
1219
1307
|
isX402V2Requirements,
|