@armory-sh/base 0.2.33-alpha.26.93 → 0.2.34
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 +2 -0
- package/dist/eip712.d.ts +4 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +128 -221
- package/dist/payment-client.d.ts +1 -1
- package/dist/types/api.d.ts +3 -3
- package/dist/types/protocol.d.ts +3 -3
- package/package.json +1 -1
- package/src/data/tokens.ts +11 -0
- package/src/eip712.ts +11 -20
- package/src/index.ts +2 -0
- package/src/payment-client.ts +5 -8
- package/src/types/api.ts +3 -3
- package/src/types/networks.ts +1 -100
- package/src/types/protocol.ts +3 -3
package/dist/data/tokens.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export declare const USDC_BASE: CustomToken;
|
|
|
3
3
|
export declare const EURC_BASE: CustomToken;
|
|
4
4
|
export declare const USDC_BASE_SEPOLIA: CustomToken;
|
|
5
5
|
export declare const USDC_SKALE_BASE: CustomToken;
|
|
6
|
+
export declare const SKL_SKALE_BASE: CustomToken;
|
|
6
7
|
export declare const USDT_SKALE_BASE: CustomToken;
|
|
7
8
|
export declare const WBTC_SKALE_BASE: CustomToken;
|
|
8
9
|
export declare const WETH_SKALE_BASE: CustomToken;
|
|
@@ -19,6 +20,7 @@ export declare const TOKENS: {
|
|
|
19
20
|
readonly USDT_SKALE_BASE: CustomToken;
|
|
20
21
|
readonly WBTC_SKALE_BASE: CustomToken;
|
|
21
22
|
readonly WETH_SKALE_BASE: CustomToken;
|
|
23
|
+
readonly SKL_SKALE_BASE: CustomToken;
|
|
22
24
|
readonly SKL_SKALE_BASE_SEPOLIA: CustomToken;
|
|
23
25
|
readonly USDC_SKALE_BASE_SEPOLIA: CustomToken;
|
|
24
26
|
readonly USDT_SKALE_BASE_SEPOLIA: CustomToken;
|
package/dist/eip712.d.ts
CHANGED
|
@@ -48,6 +48,10 @@ export declare const EIP712_TYPES: {
|
|
|
48
48
|
readonly type: "bytes32";
|
|
49
49
|
}];
|
|
50
50
|
};
|
|
51
|
+
export declare const USDC_DOMAIN: {
|
|
52
|
+
readonly NAME: "USD Coin";
|
|
53
|
+
readonly VERSION: "2";
|
|
54
|
+
};
|
|
51
55
|
export declare const createEIP712Domain: (chainId: number, contractAddress: `0x${string}`) => EIP712Domain;
|
|
52
56
|
export declare const createTransferWithAuthorization: (params: Omit<TransferWithAuthorization, "value" | "validAfter" | "validBefore" | "nonce"> & {
|
|
53
57
|
value: bigint | number;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export type { BalanceOfParams, BalanceOfReturnType, ERC20Abi, NameReturnType, ReceiveWithAuthorizationParams, SymbolReturnType, TransferWithAuthorizationParams, } from "./abi/erc20";
|
|
2
2
|
export { ERC20_ABI } from "./abi/erc20";
|
|
3
3
|
export { runAfterPaymentResponseHooks, runBeforeSignPaymentHooks, runOnPaymentRequiredHooks, selectRequirementWithHooks, } from "./client-hooks-runtime";
|
|
4
|
-
export { EURC_BASE, getAllTokens, getEURCTokens, getSKLTokens, getToken, getTokensByChain, getTokensBySymbol, getUSDCTokens, getUSDTTokens, getWBTCTokens, getWETHTokens, SKL_SKALE_BASE_SEPOLIA, TOKENS, USDC_BASE, USDC_BASE_SEPOLIA, USDC_SKALE_BASE, USDC_SKALE_BASE_SEPOLIA, USDT_SKALE_BASE, USDT_SKALE_BASE_SEPOLIA, WBTC_SKALE_BASE, WBTC_SKALE_BASE_SEPOLIA, WETH_SKALE_BASE, WETH_SKALE_BASE_SEPOLIA, } from "./data/tokens";
|
|
4
|
+
export { EURC_BASE, getAllTokens, getEURCTokens, getSKLTokens, getToken, getTokensByChain, getTokensBySymbol, getUSDCTokens, getUSDTTokens, getWBTCTokens, getWETHTokens, SKL_SKALE_BASE, SKL_SKALE_BASE_SEPOLIA, TOKENS, USDC_BASE, USDC_BASE_SEPOLIA, USDC_SKALE_BASE, USDC_SKALE_BASE_SEPOLIA, USDT_SKALE_BASE, USDT_SKALE_BASE_SEPOLIA, WBTC_SKALE_BASE, WBTC_SKALE_BASE_SEPOLIA, WETH_SKALE_BASE, WETH_SKALE_BASE_SEPOLIA, } from "./data/tokens";
|
|
5
5
|
export type { EIP712Domain, EIP712Types, TransferWithAuthorization, TypedDataDomain, TypedDataField, } from "./eip712";
|
|
6
|
-
export { createEIP712Domain, createTransferWithAuthorization, EIP712_TYPES, validateTransferWithAuthorization, } from "./eip712";
|
|
6
|
+
export { createEIP712Domain, createTransferWithAuthorization, EIP712_TYPES, USDC_DOMAIN, validateTransferWithAuthorization, } from "./eip712";
|
|
7
7
|
export { decodePaymentV2, decodeSettlementV2, encodePaymentV2, encodeSettlementV2, isPaymentV2, isSettlementV2, } from "./encoding";
|
|
8
8
|
export type { PaymentRequiredOptions } from "./encoding/x402";
|
|
9
9
|
export { createPaymentRequiredHeaders, createSettlementHeaders, decodePayment, decodeSettlementResponse, decodeX402Response, detectPaymentVersion, encodePayment, encodeSettlementResponse, encodeX402Response, extractPaymentFromHeaders, safeBase64Decode, safeBase64Encode, } from "./encoding/x402";
|
package/dist/index.js
CHANGED
|
@@ -190,6 +190,14 @@ var USDC_SKALE_BASE = {
|
|
|
190
190
|
chainId: 1187947933,
|
|
191
191
|
decimals: 6
|
|
192
192
|
};
|
|
193
|
+
var SKL_SKALE_BASE = {
|
|
194
|
+
symbol: "SKL",
|
|
195
|
+
name: "SKALE",
|
|
196
|
+
version: "1",
|
|
197
|
+
contractAddress: "0xE0595a049d02b7674572b0d59cd4880Db60EDC50",
|
|
198
|
+
chainId: 1187947933,
|
|
199
|
+
decimals: 18
|
|
200
|
+
};
|
|
193
201
|
var USDT_SKALE_BASE = {
|
|
194
202
|
symbol: "USDT",
|
|
195
203
|
name: "Tether USD",
|
|
@@ -262,6 +270,7 @@ var TOKENS = {
|
|
|
262
270
|
USDT_SKALE_BASE,
|
|
263
271
|
WBTC_SKALE_BASE,
|
|
264
272
|
WETH_SKALE_BASE,
|
|
273
|
+
SKL_SKALE_BASE,
|
|
265
274
|
SKL_SKALE_BASE_SEPOLIA,
|
|
266
275
|
USDC_SKALE_BASE_SEPOLIA,
|
|
267
276
|
USDT_SKALE_BASE_SEPOLIA,
|
|
@@ -304,209 +313,6 @@ function getWETHTokens() {
|
|
|
304
313
|
return getTokensBySymbol("WETH");
|
|
305
314
|
}
|
|
306
315
|
|
|
307
|
-
// src/types/networks.ts
|
|
308
|
-
var isEvmAddress = (value) => /^0x[a-fA-F0-9]{40}$/.test(value);
|
|
309
|
-
var tokenKey = (chainId, contractAddress) => `${chainId}:${contractAddress.toLowerCase()}`;
|
|
310
|
-
var tokenRegistry = /* @__PURE__ */ new Map([
|
|
311
|
-
[tokenKey(8453, "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"), {
|
|
312
|
-
symbol: "USDC",
|
|
313
|
-
name: "USDC",
|
|
314
|
-
version: "2",
|
|
315
|
-
contractAddress: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
|
|
316
|
-
chainId: 8453,
|
|
317
|
-
decimals: 6
|
|
318
|
-
}],
|
|
319
|
-
[tokenKey(84532, "0x036CbD53842c5426634e7929541eC2318f3dCF7e"), {
|
|
320
|
-
symbol: "USDC",
|
|
321
|
-
name: "USDC",
|
|
322
|
-
version: "2",
|
|
323
|
-
contractAddress: "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
|
|
324
|
-
chainId: 84532,
|
|
325
|
-
decimals: 6
|
|
326
|
-
}],
|
|
327
|
-
[tokenKey(8453, "0x60a3E35Cc302bFA44Cb288Bc5a4F316Fdb1adb42"), {
|
|
328
|
-
symbol: "EURC",
|
|
329
|
-
name: "EURC",
|
|
330
|
-
version: "2",
|
|
331
|
-
contractAddress: "0x60a3E35Cc302bFA44Cb288Bc5a4F316Fdb1adb42",
|
|
332
|
-
chainId: 8453,
|
|
333
|
-
decimals: 6
|
|
334
|
-
}],
|
|
335
|
-
[tokenKey(1187947933, "0x85889c8c714505E0c94b30fcfcF64fE3Ac8FCb20"), {
|
|
336
|
-
symbol: "USDC",
|
|
337
|
-
name: "USDC",
|
|
338
|
-
version: "2",
|
|
339
|
-
contractAddress: "0x85889c8c714505E0c94b30fcfcF64fE3Ac8FCb20",
|
|
340
|
-
chainId: 1187947933,
|
|
341
|
-
decimals: 6
|
|
342
|
-
}],
|
|
343
|
-
[tokenKey(1187947933, "0x2bF5bF154b515EaA82C31a65ec11554fF5aF7fCA"), {
|
|
344
|
-
symbol: "USDT",
|
|
345
|
-
name: "USDT",
|
|
346
|
-
version: "1",
|
|
347
|
-
contractAddress: "0x2bF5bF154b515EaA82C31a65ec11554fF5aF7fCA",
|
|
348
|
-
chainId: 1187947933,
|
|
349
|
-
decimals: 6
|
|
350
|
-
}],
|
|
351
|
-
[tokenKey(1187947933, "0x1aeeCFE5454c83B42D8A316246CAc9739E7f690e"), {
|
|
352
|
-
symbol: "WBTC",
|
|
353
|
-
name: "Wrapped BTC",
|
|
354
|
-
version: "1",
|
|
355
|
-
contractAddress: "0x1aeeCFE5454c83B42D8A316246CAc9739E7f690e",
|
|
356
|
-
chainId: 1187947933,
|
|
357
|
-
decimals: 8
|
|
358
|
-
}],
|
|
359
|
-
[tokenKey(1187947933, "0x7bD39ABBd0Dd13103542cAe3276C7fA332bCA486"), {
|
|
360
|
-
symbol: "WETH",
|
|
361
|
-
name: "Wrapped Ether",
|
|
362
|
-
version: "1",
|
|
363
|
-
contractAddress: "0x7bD39ABBd0Dd13103542cAe3276C7fA332bCA486",
|
|
364
|
-
chainId: 1187947933,
|
|
365
|
-
decimals: 6
|
|
366
|
-
}],
|
|
367
|
-
[tokenKey(324705682, "0xaf2e0ff5b5f51553fdb34ce7f04a6c3201cee57b"), {
|
|
368
|
-
symbol: "SKL",
|
|
369
|
-
name: "SKALE",
|
|
370
|
-
version: "1",
|
|
371
|
-
contractAddress: "0xaf2e0ff5b5f51553fdb34ce7f04a6c3201cee57b",
|
|
372
|
-
chainId: 324705682,
|
|
373
|
-
decimals: 18
|
|
374
|
-
}],
|
|
375
|
-
[tokenKey(324705682, "0x036CbD53842c5426634e7929541eC2318f3dCF7e"), {
|
|
376
|
-
symbol: "USDC",
|
|
377
|
-
name: "USDC",
|
|
378
|
-
version: "2",
|
|
379
|
-
contractAddress: "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
|
|
380
|
-
chainId: 324705682,
|
|
381
|
-
decimals: 6
|
|
382
|
-
}],
|
|
383
|
-
[tokenKey(324705682, "0x3ca0a49f511c2c89c4dcbbf1731120d8919050bf"), {
|
|
384
|
-
symbol: "USDT",
|
|
385
|
-
name: "USDT",
|
|
386
|
-
version: "1",
|
|
387
|
-
contractAddress: "0x3ca0a49f511c2c89c4dcbbf1731120d8919050bf",
|
|
388
|
-
chainId: 324705682,
|
|
389
|
-
decimals: 6
|
|
390
|
-
}],
|
|
391
|
-
[tokenKey(324705682, "0x4512eacd4186b025186e1cf6cc0d89497c530e87"), {
|
|
392
|
-
symbol: "WBTC",
|
|
393
|
-
name: "Wrapped BTC",
|
|
394
|
-
version: "1",
|
|
395
|
-
contractAddress: "0x4512eacd4186b025186e1cf6cc0d89497c530e87",
|
|
396
|
-
chainId: 324705682,
|
|
397
|
-
decimals: 8
|
|
398
|
-
}],
|
|
399
|
-
[tokenKey(324705682, "0xf94056bd7f6965db3757e1b145f200b7346b4fc0"), {
|
|
400
|
-
symbol: "WETH",
|
|
401
|
-
name: "Wrapped Ether",
|
|
402
|
-
version: "1",
|
|
403
|
-
contractAddress: "0xf94056bd7f6965db3757e1b145f200b7346b4fc0",
|
|
404
|
-
chainId: 324705682,
|
|
405
|
-
decimals: 18
|
|
406
|
-
}]
|
|
407
|
-
]);
|
|
408
|
-
var NETWORKS = {
|
|
409
|
-
ethereum: {
|
|
410
|
-
name: "Ethereum Mainnet",
|
|
411
|
-
chainId: 1,
|
|
412
|
-
usdcAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
|
413
|
-
rpcUrl: "https://eth.llamarpc.com",
|
|
414
|
-
caip2Id: "eip155:1",
|
|
415
|
-
caipAssetId: "eip155:1/erc20:0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
|
|
416
|
-
},
|
|
417
|
-
base: {
|
|
418
|
-
name: "Base Mainnet",
|
|
419
|
-
chainId: 8453,
|
|
420
|
-
usdcAddress: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
|
|
421
|
-
rpcUrl: "https://mainnet.base.org",
|
|
422
|
-
caip2Id: "eip155:8453",
|
|
423
|
-
caipAssetId: "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
|
|
424
|
-
},
|
|
425
|
-
"base-sepolia": {
|
|
426
|
-
name: "Base Sepolia",
|
|
427
|
-
chainId: 84532,
|
|
428
|
-
usdcAddress: "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
|
|
429
|
-
rpcUrl: "https://sepolia.base.org",
|
|
430
|
-
caip2Id: "eip155:84532",
|
|
431
|
-
caipAssetId: "eip155:84532/erc20:0x036CbD53842c5426634e7929541eC2318f3dCF7e"
|
|
432
|
-
},
|
|
433
|
-
"skale-base": {
|
|
434
|
-
name: "SKALE Base",
|
|
435
|
-
chainId: 1187947933,
|
|
436
|
-
usdcAddress: "0x85889c8c714505E0c94b30fcfcF64fE3Ac8FCb20",
|
|
437
|
-
rpcUrl: "https://skale-base.skalenodes.com/v1/base",
|
|
438
|
-
caip2Id: "eip155:1187947933",
|
|
439
|
-
caipAssetId: "eip155:1187947933/erc20:0x85889c8c714505E0c94b30fcfcF64fE3Ac8FCb20"
|
|
440
|
-
},
|
|
441
|
-
"skale-base-sepolia": {
|
|
442
|
-
name: "SKALE Base Sepolia",
|
|
443
|
-
chainId: 324705682,
|
|
444
|
-
usdcAddress: "0x2e08028E3C4c2356572E096d8EF835cD5C6030bD",
|
|
445
|
-
rpcUrl: "https://base-sepolia-testnet.skalenodes.com/v1/jubilant-horrible-ancha",
|
|
446
|
-
caip2Id: "eip155:324705682",
|
|
447
|
-
caipAssetId: "eip155:324705682/erc20:0x2e08028E3C4c2356572E096d8EF835cD5C6030bD"
|
|
448
|
-
},
|
|
449
|
-
"ethereum-sepolia": {
|
|
450
|
-
name: "Ethereum Sepolia",
|
|
451
|
-
chainId: 11155111,
|
|
452
|
-
usdcAddress: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",
|
|
453
|
-
rpcUrl: "https://rpc.sepolia.org",
|
|
454
|
-
caip2Id: "eip155:11155111",
|
|
455
|
-
caipAssetId: "eip155:11155111/erc20:0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"
|
|
456
|
-
}
|
|
457
|
-
};
|
|
458
|
-
var getNetworkConfig = (name) => NETWORKS[name];
|
|
459
|
-
var getNetworkByChainId = (chainId) => Object.values(NETWORKS).find((c) => c.chainId === chainId);
|
|
460
|
-
var getMainnets = () => Object.values(NETWORKS).filter(
|
|
461
|
-
(c) => !c.name.toLowerCase().includes("sepolia")
|
|
462
|
-
);
|
|
463
|
-
var getTestnets = () => Object.values(NETWORKS).filter(
|
|
464
|
-
(c) => c.name.toLowerCase().includes("sepolia")
|
|
465
|
-
);
|
|
466
|
-
var registerToken = (token) => {
|
|
467
|
-
if (typeof token !== "object" || token === null) {
|
|
468
|
-
throw new Error("Invalid token: must be an object");
|
|
469
|
-
}
|
|
470
|
-
const t = token;
|
|
471
|
-
if (typeof t.symbol !== "string") {
|
|
472
|
-
throw new Error("Invalid token: symbol must be a string");
|
|
473
|
-
}
|
|
474
|
-
if (typeof t.name !== "string") {
|
|
475
|
-
throw new Error("Invalid token: name must be a string");
|
|
476
|
-
}
|
|
477
|
-
if (typeof t.version !== "string") {
|
|
478
|
-
throw new Error("Invalid token: version must be a string");
|
|
479
|
-
}
|
|
480
|
-
if (typeof t.contractAddress !== "string" || !isEvmAddress(t.contractAddress)) {
|
|
481
|
-
throw new Error(
|
|
482
|
-
"Invalid token: contractAddress must be a valid EVM address"
|
|
483
|
-
);
|
|
484
|
-
}
|
|
485
|
-
if (typeof t.chainId !== "number" || !Number.isInteger(t.chainId) || t.chainId <= 0) {
|
|
486
|
-
throw new Error("Invalid token: chainId must be a positive integer");
|
|
487
|
-
}
|
|
488
|
-
if (t.decimals !== void 0 && (typeof t.decimals !== "number" || !Number.isInteger(t.decimals) || t.decimals < 0)) {
|
|
489
|
-
throw new Error("Invalid token: decimals must be a non-negative integer");
|
|
490
|
-
}
|
|
491
|
-
const validated = {
|
|
492
|
-
symbol: t.symbol,
|
|
493
|
-
name: t.name,
|
|
494
|
-
version: t.version,
|
|
495
|
-
contractAddress: t.contractAddress,
|
|
496
|
-
chainId: t.chainId,
|
|
497
|
-
decimals: t.decimals
|
|
498
|
-
};
|
|
499
|
-
tokenRegistry.set(
|
|
500
|
-
tokenKey(validated.chainId, validated.contractAddress),
|
|
501
|
-
validated
|
|
502
|
-
);
|
|
503
|
-
return validated;
|
|
504
|
-
};
|
|
505
|
-
var getCustomToken = (chainId, contractAddress) => tokenRegistry.get(tokenKey(chainId, contractAddress));
|
|
506
|
-
var getAllCustomTokens = () => Array.from(tokenRegistry.values());
|
|
507
|
-
var unregisterToken = (chainId, contractAddress) => tokenRegistry.delete(tokenKey(chainId, contractAddress));
|
|
508
|
-
var isCustomToken = (chainId, contractAddress) => tokenRegistry.has(tokenKey(chainId, contractAddress));
|
|
509
|
-
|
|
510
316
|
// src/eip712.ts
|
|
511
317
|
var EIP712_TYPES = {
|
|
512
318
|
TransferWithAuthorization: [
|
|
@@ -518,20 +324,16 @@ var EIP712_TYPES = {
|
|
|
518
324
|
{ name: "nonce", type: "bytes32" }
|
|
519
325
|
]
|
|
520
326
|
};
|
|
521
|
-
var
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
throw new Error(
|
|
525
|
-
`Token not found in registry: chainId=${chainId}, contractAddress=${contractAddress}. Please register the token using registerToken() before use.`
|
|
526
|
-
);
|
|
527
|
-
}
|
|
528
|
-
return {
|
|
529
|
-
name: token.name,
|
|
530
|
-
version: token.version,
|
|
531
|
-
chainId,
|
|
532
|
-
verifyingContract: contractAddress
|
|
533
|
-
};
|
|
327
|
+
var USDC_DOMAIN = {
|
|
328
|
+
NAME: "USD Coin",
|
|
329
|
+
VERSION: "2"
|
|
534
330
|
};
|
|
331
|
+
var createEIP712Domain = (chainId, contractAddress) => ({
|
|
332
|
+
name: USDC_DOMAIN.NAME,
|
|
333
|
+
version: USDC_DOMAIN.VERSION,
|
|
334
|
+
chainId,
|
|
335
|
+
verifyingContract: contractAddress
|
|
336
|
+
});
|
|
535
337
|
var createTransferWithAuthorization = (params) => ({
|
|
536
338
|
from: params.from,
|
|
537
339
|
to: params.to,
|
|
@@ -820,11 +622,10 @@ function toJsonSafe(data) {
|
|
|
820
622
|
function resolveUrl(config) {
|
|
821
623
|
return config?.url ?? DEFAULT_FACILITATOR_URL;
|
|
822
624
|
}
|
|
823
|
-
|
|
625
|
+
function resolveHeaders(config) {
|
|
824
626
|
const base = { "Content-Type": "application/json" };
|
|
825
|
-
if (!config?.
|
|
826
|
-
|
|
827
|
-
return { ...base, ...extra };
|
|
627
|
+
if (!config?.headers) return base;
|
|
628
|
+
return { ...base, ...config.headers };
|
|
828
629
|
}
|
|
829
630
|
async function verifyPayment(payload, requirements, config) {
|
|
830
631
|
const url = resolveUrl(config);
|
|
@@ -924,6 +725,112 @@ function extractPayerAddress(payload) {
|
|
|
924
725
|
}
|
|
925
726
|
throw new Error("Unable to extract payer address from payload");
|
|
926
727
|
}
|
|
728
|
+
|
|
729
|
+
// src/types/networks.ts
|
|
730
|
+
var isEvmAddress = (value) => /^0x[a-fA-F0-9]{40}$/.test(value);
|
|
731
|
+
var tokenRegistry = /* @__PURE__ */ new Map();
|
|
732
|
+
var tokenKey = (chainId, contractAddress) => `${chainId}:${contractAddress.toLowerCase()}`;
|
|
733
|
+
var NETWORKS = {
|
|
734
|
+
ethereum: {
|
|
735
|
+
name: "Ethereum Mainnet",
|
|
736
|
+
chainId: 1,
|
|
737
|
+
usdcAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
|
738
|
+
rpcUrl: "https://eth.llamarpc.com",
|
|
739
|
+
caip2Id: "eip155:1",
|
|
740
|
+
caipAssetId: "eip155:1/erc20:0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
|
|
741
|
+
},
|
|
742
|
+
base: {
|
|
743
|
+
name: "Base Mainnet",
|
|
744
|
+
chainId: 8453,
|
|
745
|
+
usdcAddress: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
|
|
746
|
+
rpcUrl: "https://mainnet.base.org",
|
|
747
|
+
caip2Id: "eip155:8453",
|
|
748
|
+
caipAssetId: "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
|
|
749
|
+
},
|
|
750
|
+
"base-sepolia": {
|
|
751
|
+
name: "Base Sepolia",
|
|
752
|
+
chainId: 84532,
|
|
753
|
+
usdcAddress: "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
|
|
754
|
+
rpcUrl: "https://sepolia.base.org",
|
|
755
|
+
caip2Id: "eip155:84532",
|
|
756
|
+
caipAssetId: "eip155:84532/erc20:0x036CbD53842c5426634e7929541eC2318f3dCF7e"
|
|
757
|
+
},
|
|
758
|
+
"skale-base": {
|
|
759
|
+
name: "SKALE Base",
|
|
760
|
+
chainId: 1187947933,
|
|
761
|
+
usdcAddress: "0x85889c8c714505E0c94b30fcfcF64fE3Ac8FCb20",
|
|
762
|
+
rpcUrl: "https://skale-base.skalenodes.com/v1/base",
|
|
763
|
+
caip2Id: "eip155:1187947933",
|
|
764
|
+
caipAssetId: "eip155:1187947933/erc20:0x85889c8c714505E0c94b30fcfcF64fE3Ac8FCb20"
|
|
765
|
+
},
|
|
766
|
+
"skale-base-sepolia": {
|
|
767
|
+
name: "SKALE Base Sepolia",
|
|
768
|
+
chainId: 324705682,
|
|
769
|
+
usdcAddress: "0x2e08028E3C4c2356572E096d8EF835cD5C6030bD",
|
|
770
|
+
rpcUrl: "https://base-sepolia-testnet.skalenodes.com/v1/jubilant-horrible-ancha",
|
|
771
|
+
caip2Id: "eip155:324705682",
|
|
772
|
+
caipAssetId: "eip155:324705682/erc20:0x2e08028E3C4c2356572E096d8EF835cD5C6030bD"
|
|
773
|
+
},
|
|
774
|
+
"ethereum-sepolia": {
|
|
775
|
+
name: "Ethereum Sepolia",
|
|
776
|
+
chainId: 11155111,
|
|
777
|
+
usdcAddress: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",
|
|
778
|
+
rpcUrl: "https://rpc.sepolia.org",
|
|
779
|
+
caip2Id: "eip155:11155111",
|
|
780
|
+
caipAssetId: "eip155:11155111/erc20:0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"
|
|
781
|
+
}
|
|
782
|
+
};
|
|
783
|
+
var getNetworkConfig = (name) => NETWORKS[name];
|
|
784
|
+
var getNetworkByChainId = (chainId) => Object.values(NETWORKS).find((c) => c.chainId === chainId);
|
|
785
|
+
var getMainnets = () => Object.values(NETWORKS).filter(
|
|
786
|
+
(c) => !c.name.toLowerCase().includes("sepolia")
|
|
787
|
+
);
|
|
788
|
+
var getTestnets = () => Object.values(NETWORKS).filter(
|
|
789
|
+
(c) => c.name.toLowerCase().includes("sepolia")
|
|
790
|
+
);
|
|
791
|
+
var registerToken = (token) => {
|
|
792
|
+
if (typeof token !== "object" || token === null) {
|
|
793
|
+
throw new Error("Invalid token: must be an object");
|
|
794
|
+
}
|
|
795
|
+
const t = token;
|
|
796
|
+
if (typeof t.symbol !== "string") {
|
|
797
|
+
throw new Error("Invalid token: symbol must be a string");
|
|
798
|
+
}
|
|
799
|
+
if (typeof t.name !== "string") {
|
|
800
|
+
throw new Error("Invalid token: name must be a string");
|
|
801
|
+
}
|
|
802
|
+
if (typeof t.version !== "string") {
|
|
803
|
+
throw new Error("Invalid token: version must be a string");
|
|
804
|
+
}
|
|
805
|
+
if (typeof t.contractAddress !== "string" || !isEvmAddress(t.contractAddress)) {
|
|
806
|
+
throw new Error(
|
|
807
|
+
"Invalid token: contractAddress must be a valid EVM address"
|
|
808
|
+
);
|
|
809
|
+
}
|
|
810
|
+
if (typeof t.chainId !== "number" || !Number.isInteger(t.chainId) || t.chainId <= 0) {
|
|
811
|
+
throw new Error("Invalid token: chainId must be a positive integer");
|
|
812
|
+
}
|
|
813
|
+
if (t.decimals !== void 0 && (typeof t.decimals !== "number" || !Number.isInteger(t.decimals) || t.decimals < 0)) {
|
|
814
|
+
throw new Error("Invalid token: decimals must be a non-negative integer");
|
|
815
|
+
}
|
|
816
|
+
const validated = {
|
|
817
|
+
symbol: t.symbol,
|
|
818
|
+
name: t.name,
|
|
819
|
+
version: t.version,
|
|
820
|
+
contractAddress: t.contractAddress,
|
|
821
|
+
chainId: t.chainId,
|
|
822
|
+
decimals: t.decimals
|
|
823
|
+
};
|
|
824
|
+
tokenRegistry.set(
|
|
825
|
+
tokenKey(validated.chainId, validated.contractAddress),
|
|
826
|
+
validated
|
|
827
|
+
);
|
|
828
|
+
return validated;
|
|
829
|
+
};
|
|
830
|
+
var getCustomToken = (chainId, contractAddress) => tokenRegistry.get(tokenKey(chainId, contractAddress));
|
|
831
|
+
var getAllCustomTokens = () => Array.from(tokenRegistry.values());
|
|
832
|
+
var unregisterToken = (chainId, contractAddress) => tokenRegistry.delete(tokenKey(chainId, contractAddress));
|
|
833
|
+
var isCustomToken = (chainId, contractAddress) => tokenRegistry.has(tokenKey(chainId, contractAddress));
|
|
927
834
|
function createNonce() {
|
|
928
835
|
const bytes = randomBytes(32);
|
|
929
836
|
return `0x${bytes.toString("hex")}`;
|
|
@@ -2025,4 +1932,4 @@ function validateRouteConfig(config) {
|
|
|
2025
1932
|
return null;
|
|
2026
1933
|
}
|
|
2027
1934
|
|
|
2028
|
-
export { EIP712_TYPES, ERC20_ABI, EURC_BASE, NETWORKS, PAYMENT_REQUIRED_HEADER, PAYMENT_RESPONSE_HEADER, PAYMENT_SIGNATURE_HEADER, PaymentException, SCHEMES, SKL_SKALE_BASE_SEPOLIA, SigningError, TOKENS, USDC_BASE, USDC_BASE_SEPOLIA, USDC_SKALE_BASE, USDC_SKALE_BASE_SEPOLIA, USDT_SKALE_BASE, USDT_SKALE_BASE_SEPOLIA, V2_HEADERS, WBTC_SKALE_BASE, WBTC_SKALE_BASE_SEPOLIA, WETH_SKALE_BASE, WETH_SKALE_BASE_SEPOLIA, X402ClientError, X402_VERSION, addressToAssetId, assetIdToAddress, caip2ToNetwork, calculateValidBefore, checkFacilitatorSupport, clearFacilitatorCapabilityCache, combineSignature as combineSignatureV2, createEIP712Domain, createError, createNonce, createPaymentRequiredHeaders, createPaymentRequirements, createSettlementHeaders, createTransferWithAuthorization, decodeBase64ToUtf8, decodePayloadHeader, decodePayment, decodePaymentV2, decodeSettlementResponse, decodeSettlementV2, decodeX402Response, detectPaymentVersion, detectX402Version, encodePayment, encodePaymentV2, encodeSettlementResponse, encodeSettlementV2, encodeUtf8ToBase64, encodeX402Response, enrichPaymentRequirement, enrichPaymentRequirements, extractPayerAddress, extractPaymentFromHeaders, filterExtensionsForFacilitator, filterExtensionsForFacilitators, filterExtensionsForRequirements, findMatchingRoute, findRequirementByAccepted, findRequirementByNetwork, fromAtomicUnits, generateNonce, getAllCustomTokens, getAllTokens, getAvailableNetworks, getAvailableTokens, getCurrentTimestamp, getCustomToken, getEURCTokens, getMainnets, getNetworkByChainId, getNetworkConfig, getPaymentHeaderName, getSKLTokens, getSupported, getTestnets, getToken, getTokensByChain, getTokensBySymbol, getTxHash, getUSDCTokens, getUSDTTokens, getWBTCTokens, getWETHTokens, isAddress2 as isAddress, isCAIP2ChainId, isCAIPAssetId, isCustomToken, isExactEvmPayload, isPaymentPayload, isPaymentPayloadV2, isPaymentRequiredV2, isPaymentV2, isResolvedNetwork, isResolvedToken, isSettlementSuccessful, isSettlementV2, isValidAddress, isValidationError, isX402V2Payload, isX402V2PaymentRequired, isX402V2Requirements, isX402V2Settlement, matchRoute, networkToCaip2, normalizeAddress, normalizeBase64Url, normalizeNetworkName, parseJsonOrBase64, parseRoutePattern, parseSignature as parseSignatureV2, registerToken, resolveFacilitator, resolveFacilitatorUrlFromRequirement, resolveNetwork, resolveToken, runAfterPaymentResponseHooks, runBeforeSignPaymentHooks, runOnPaymentRequiredHooks, safeBase64Decode2 as safeBase64Decode, safeBase64Encode2 as safeBase64Encode, selectRequirementWithHooks, settlePayment, toAtomicUnits, toBase64Url, unregisterToken, validateAcceptConfig, validatePaymentConfig, validateRouteConfig, validateTransferWithAuthorization, verifyPayment };
|
|
1935
|
+
export { EIP712_TYPES, ERC20_ABI, EURC_BASE, NETWORKS, PAYMENT_REQUIRED_HEADER, PAYMENT_RESPONSE_HEADER, PAYMENT_SIGNATURE_HEADER, PaymentException, SCHEMES, SKL_SKALE_BASE, SKL_SKALE_BASE_SEPOLIA, SigningError, TOKENS, USDC_BASE, USDC_BASE_SEPOLIA, USDC_DOMAIN, USDC_SKALE_BASE, USDC_SKALE_BASE_SEPOLIA, USDT_SKALE_BASE, USDT_SKALE_BASE_SEPOLIA, V2_HEADERS, WBTC_SKALE_BASE, WBTC_SKALE_BASE_SEPOLIA, WETH_SKALE_BASE, WETH_SKALE_BASE_SEPOLIA, X402ClientError, X402_VERSION, addressToAssetId, assetIdToAddress, caip2ToNetwork, calculateValidBefore, checkFacilitatorSupport, clearFacilitatorCapabilityCache, combineSignature as combineSignatureV2, createEIP712Domain, createError, createNonce, createPaymentRequiredHeaders, createPaymentRequirements, createSettlementHeaders, createTransferWithAuthorization, decodeBase64ToUtf8, decodePayloadHeader, decodePayment, decodePaymentV2, decodeSettlementResponse, decodeSettlementV2, decodeX402Response, detectPaymentVersion, detectX402Version, encodePayment, encodePaymentV2, encodeSettlementResponse, encodeSettlementV2, encodeUtf8ToBase64, encodeX402Response, enrichPaymentRequirement, enrichPaymentRequirements, extractPayerAddress, extractPaymentFromHeaders, filterExtensionsForFacilitator, filterExtensionsForFacilitators, filterExtensionsForRequirements, findMatchingRoute, findRequirementByAccepted, findRequirementByNetwork, fromAtomicUnits, generateNonce, getAllCustomTokens, getAllTokens, getAvailableNetworks, getAvailableTokens, getCurrentTimestamp, getCustomToken, getEURCTokens, getMainnets, getNetworkByChainId, getNetworkConfig, getPaymentHeaderName, getSKLTokens, getSupported, getTestnets, getToken, getTokensByChain, getTokensBySymbol, getTxHash, getUSDCTokens, getUSDTTokens, getWBTCTokens, getWETHTokens, isAddress2 as isAddress, isCAIP2ChainId, isCAIPAssetId, isCustomToken, isExactEvmPayload, isPaymentPayload, isPaymentPayloadV2, isPaymentRequiredV2, isPaymentV2, isResolvedNetwork, isResolvedToken, isSettlementSuccessful, isSettlementV2, isValidAddress, isValidationError, isX402V2Payload, isX402V2PaymentRequired, isX402V2Requirements, isX402V2Settlement, matchRoute, networkToCaip2, normalizeAddress, normalizeBase64Url, normalizeNetworkName, parseJsonOrBase64, parseRoutePattern, parseSignature as parseSignatureV2, registerToken, resolveFacilitator, resolveFacilitatorUrlFromRequirement, resolveNetwork, resolveToken, runAfterPaymentResponseHooks, runBeforeSignPaymentHooks, runOnPaymentRequiredHooks, safeBase64Decode2 as safeBase64Decode, safeBase64Encode2 as safeBase64Encode, selectRequirementWithHooks, settlePayment, toAtomicUnits, toBase64Url, unregisterToken, validateAcceptConfig, validatePaymentConfig, validateRouteConfig, validateTransferWithAuthorization, verifyPayment };
|
package/dist/payment-client.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PaymentPayload, PaymentRequirements, SettlementResponse, VerifyResponse } from "./types/x402";
|
|
2
2
|
export interface FacilitatorClientConfig {
|
|
3
3
|
url: string;
|
|
4
|
-
|
|
4
|
+
headers?: Record<string, string>;
|
|
5
5
|
}
|
|
6
6
|
export declare function verifyPayment(payload: PaymentPayload, requirements: PaymentRequirements, config?: FacilitatorClientConfig): Promise<VerifyResponse>;
|
|
7
7
|
export declare function settlePayment(payload: PaymentPayload, requirements: PaymentRequirements, config?: FacilitatorClientConfig): Promise<SettlementResponse>;
|
package/dist/types/api.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ export interface FacilitatorConfig {
|
|
|
25
25
|
/** Facilitator URL for verification/settlement */
|
|
26
26
|
url: string;
|
|
27
27
|
/** Optional authentication headers */
|
|
28
|
-
headers?:
|
|
28
|
+
headers?: Record<string, string>;
|
|
29
29
|
/** Networks this facilitator supports (auto-detected if not provided) */
|
|
30
30
|
networks?: NetworkId[];
|
|
31
31
|
/** Tokens this facilitator supports (optional) */
|
|
@@ -50,9 +50,9 @@ export interface FacilitatorSettleResult {
|
|
|
50
50
|
error?: string;
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
53
|
-
* Settlement mode - verify only
|
|
53
|
+
* Settlement mode - verify only or settle
|
|
54
54
|
*/
|
|
55
|
-
export type SettlementMode = "verify" | "settle"
|
|
55
|
+
export type SettlementMode = "verify" | "settle";
|
|
56
56
|
/**
|
|
57
57
|
* CAIP-2 chain ID type (e.g., eip155:8453)
|
|
58
58
|
*/
|
package/dist/types/protocol.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export type PaymentRequired = PaymentRequiredV2;
|
|
|
13
13
|
*/
|
|
14
14
|
export interface FacilitatorConfig {
|
|
15
15
|
url: string;
|
|
16
|
-
|
|
16
|
+
headers?: Record<string, string>;
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
19
|
* Result from facilitator verification
|
|
@@ -34,9 +34,9 @@ export interface FacilitatorSettleResult {
|
|
|
34
34
|
error?: string;
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
|
-
* Settlement mode - verify only
|
|
37
|
+
* Settlement mode - verify only or settle
|
|
38
38
|
*/
|
|
39
|
-
export type SettlementMode = "verify" | "settle"
|
|
39
|
+
export type SettlementMode = "verify" | "settle";
|
|
40
40
|
/**
|
|
41
41
|
* Payment destination - address, CAIP-2 chain ID, or CAIP asset ID
|
|
42
42
|
*/
|
package/package.json
CHANGED
package/src/data/tokens.ts
CHANGED
|
@@ -40,6 +40,16 @@ export const USDC_SKALE_BASE: CustomToken = {
|
|
|
40
40
|
decimals: 6,
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
+
export const SKL_SKALE_BASE: CustomToken = {
|
|
44
|
+
symbol: "SKL",
|
|
45
|
+
name: "SKALE",
|
|
46
|
+
version: "1",
|
|
47
|
+
contractAddress:
|
|
48
|
+
"0xE0595a049d02b7674572b0d59cd4880Db60EDC50" as `0x${string}`,
|
|
49
|
+
chainId: 1187947933,
|
|
50
|
+
decimals: 18,
|
|
51
|
+
};
|
|
52
|
+
|
|
43
53
|
export const USDT_SKALE_BASE: CustomToken = {
|
|
44
54
|
symbol: "USDT",
|
|
45
55
|
name: "Tether USD",
|
|
@@ -128,6 +138,7 @@ export const TOKENS = {
|
|
|
128
138
|
USDT_SKALE_BASE,
|
|
129
139
|
WBTC_SKALE_BASE,
|
|
130
140
|
WETH_SKALE_BASE,
|
|
141
|
+
SKL_SKALE_BASE,
|
|
131
142
|
SKL_SKALE_BASE_SEPOLIA,
|
|
132
143
|
USDC_SKALE_BASE_SEPOLIA,
|
|
133
144
|
USDT_SKALE_BASE_SEPOLIA,
|
package/src/eip712.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import type { CustomToken } from "./types/networks";
|
|
2
|
-
import { getCustomToken } from "./types/networks";
|
|
3
|
-
|
|
4
1
|
export type TypedDataDomain = {
|
|
5
2
|
name?: string;
|
|
6
3
|
version?: string;
|
|
@@ -45,26 +42,20 @@ export const EIP712_TYPES = {
|
|
|
45
42
|
] as const,
|
|
46
43
|
} as const satisfies EIP712Types;
|
|
47
44
|
|
|
45
|
+
export const USDC_DOMAIN = {
|
|
46
|
+
NAME: "USD Coin",
|
|
47
|
+
VERSION: "2",
|
|
48
|
+
} as const;
|
|
49
|
+
|
|
48
50
|
export const createEIP712Domain = (
|
|
49
51
|
chainId: number,
|
|
50
52
|
contractAddress: `0x${string}`,
|
|
51
|
-
): EIP712Domain => {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
`Please register the token using registerToken() before use.`
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return {
|
|
62
|
-
name: token.name,
|
|
63
|
-
version: token.version,
|
|
64
|
-
chainId,
|
|
65
|
-
verifyingContract: contractAddress,
|
|
66
|
-
};
|
|
67
|
-
};
|
|
53
|
+
): EIP712Domain => ({
|
|
54
|
+
name: USDC_DOMAIN.NAME,
|
|
55
|
+
version: USDC_DOMAIN.VERSION,
|
|
56
|
+
chainId,
|
|
57
|
+
verifyingContract: contractAddress,
|
|
58
|
+
});
|
|
68
59
|
|
|
69
60
|
export const createTransferWithAuthorization = (
|
|
70
61
|
params: Omit<
|
package/src/index.ts
CHANGED
|
@@ -33,6 +33,7 @@ export {
|
|
|
33
33
|
getUSDTTokens,
|
|
34
34
|
getWBTCTokens,
|
|
35
35
|
getWETHTokens,
|
|
36
|
+
SKL_SKALE_BASE,
|
|
36
37
|
SKL_SKALE_BASE_SEPOLIA,
|
|
37
38
|
TOKENS,
|
|
38
39
|
USDC_BASE,
|
|
@@ -60,6 +61,7 @@ export {
|
|
|
60
61
|
createEIP712Domain,
|
|
61
62
|
createTransferWithAuthorization,
|
|
62
63
|
EIP712_TYPES,
|
|
64
|
+
USDC_DOMAIN,
|
|
63
65
|
validateTransferWithAuthorization,
|
|
64
66
|
} from "./eip712";
|
|
65
67
|
// ============================================
|
package/src/payment-client.ts
CHANGED
|
@@ -9,9 +9,7 @@ import { decodeBase64ToUtf8 } from "./utils/base64";
|
|
|
9
9
|
|
|
10
10
|
export interface FacilitatorClientConfig {
|
|
11
11
|
url: string;
|
|
12
|
-
|
|
13
|
-
| Record<string, string>
|
|
14
|
-
| Promise<Record<string, string>>;
|
|
12
|
+
headers?: Record<string, string>;
|
|
15
13
|
}
|
|
16
14
|
|
|
17
15
|
const DEFAULT_FACILITATOR_URL = "https://facilitator.payai.network";
|
|
@@ -38,13 +36,12 @@ function resolveUrl(config?: FacilitatorClientConfig): string {
|
|
|
38
36
|
return config?.url ?? DEFAULT_FACILITATOR_URL;
|
|
39
37
|
}
|
|
40
38
|
|
|
41
|
-
|
|
39
|
+
function resolveHeaders(
|
|
42
40
|
config?: FacilitatorClientConfig,
|
|
43
|
-
):
|
|
41
|
+
): Record<string, string> {
|
|
44
42
|
const base: Record<string, string> = { "Content-Type": "application/json" };
|
|
45
|
-
if (!config?.
|
|
46
|
-
|
|
47
|
-
return { ...base, ...extra };
|
|
43
|
+
if (!config?.headers) return base;
|
|
44
|
+
return { ...base, ...config.headers };
|
|
48
45
|
}
|
|
49
46
|
|
|
50
47
|
export async function verifyPayment(
|
package/src/types/api.ts
CHANGED
|
@@ -33,7 +33,7 @@ export interface FacilitatorConfig {
|
|
|
33
33
|
/** Facilitator URL for verification/settlement */
|
|
34
34
|
url: string;
|
|
35
35
|
/** Optional authentication headers */
|
|
36
|
-
headers?:
|
|
36
|
+
headers?: Record<string, string>;
|
|
37
37
|
/** Networks this facilitator supports (auto-detected if not provided) */
|
|
38
38
|
networks?: NetworkId[];
|
|
39
39
|
/** Tokens this facilitator supports (optional) */
|
|
@@ -61,9 +61,9 @@ export interface FacilitatorSettleResult {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
/**
|
|
64
|
-
* Settlement mode - verify only
|
|
64
|
+
* Settlement mode - verify only or settle
|
|
65
65
|
*/
|
|
66
|
-
export type SettlementMode = "verify" | "settle"
|
|
66
|
+
export type SettlementMode = "verify" | "settle";
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
69
|
* CAIP-2 chain ID type (e.g., eip155:8453)
|
package/src/types/networks.ts
CHANGED
|
@@ -19,109 +19,10 @@ export interface CustomToken {
|
|
|
19
19
|
decimals?: number;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
const tokenRegistry = new Map<string, CustomToken>();
|
|
22
23
|
const tokenKey = (chainId: number, contractAddress: string): string =>
|
|
23
24
|
`${chainId}:${contractAddress.toLowerCase()}`;
|
|
24
25
|
|
|
25
|
-
// Built-in tokens - hardcoded in registry
|
|
26
|
-
const tokenRegistry = new Map<string, CustomToken>([
|
|
27
|
-
[tokenKey(8453, "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"), {
|
|
28
|
-
symbol: "USDC",
|
|
29
|
-
name: "USDC",
|
|
30
|
-
version: "2",
|
|
31
|
-
contractAddress: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913" as `0x${string}`,
|
|
32
|
-
chainId: 8453,
|
|
33
|
-
decimals: 6,
|
|
34
|
-
}],
|
|
35
|
-
[tokenKey(84532, "0x036CbD53842c5426634e7929541eC2318f3dCF7e"), {
|
|
36
|
-
symbol: "USDC",
|
|
37
|
-
name: "USDC",
|
|
38
|
-
version: "2",
|
|
39
|
-
contractAddress: "0x036CbD53842c5426634e7929541eC2318f3dCF7e" as `0x${string}`,
|
|
40
|
-
chainId: 84532,
|
|
41
|
-
decimals: 6,
|
|
42
|
-
}],
|
|
43
|
-
[tokenKey(8453, "0x60a3E35Cc302bFA44Cb288Bc5a4F316Fdb1adb42"), {
|
|
44
|
-
symbol: "EURC",
|
|
45
|
-
name: "EURC",
|
|
46
|
-
version: "2",
|
|
47
|
-
contractAddress: "0x60a3E35Cc302bFA44Cb288Bc5a4F316Fdb1adb42" as `0x${string}`,
|
|
48
|
-
chainId: 8453,
|
|
49
|
-
decimals: 6,
|
|
50
|
-
}],
|
|
51
|
-
[tokenKey(1187947933, "0x85889c8c714505E0c94b30fcfcF64fE3Ac8FCb20"), {
|
|
52
|
-
symbol: "USDC",
|
|
53
|
-
name: "USDC",
|
|
54
|
-
version: "2",
|
|
55
|
-
contractAddress: "0x85889c8c714505E0c94b30fcfcF64fE3Ac8FCb20" as `0x${string}`,
|
|
56
|
-
chainId: 1187947933,
|
|
57
|
-
decimals: 6,
|
|
58
|
-
}],
|
|
59
|
-
[tokenKey(1187947933, "0x2bF5bF154b515EaA82C31a65ec11554fF5aF7fCA"), {
|
|
60
|
-
symbol: "USDT",
|
|
61
|
-
name: "USDT",
|
|
62
|
-
version: "1",
|
|
63
|
-
contractAddress: "0x2bF5bF154b515EaA82C31a65ec11554fF5aF7fCA" as `0x${string}`,
|
|
64
|
-
chainId: 1187947933,
|
|
65
|
-
decimals: 6,
|
|
66
|
-
}],
|
|
67
|
-
[tokenKey(1187947933, "0x1aeeCFE5454c83B42D8A316246CAc9739E7f690e"), {
|
|
68
|
-
symbol: "WBTC",
|
|
69
|
-
name: "Wrapped BTC",
|
|
70
|
-
version: "1",
|
|
71
|
-
contractAddress: "0x1aeeCFE5454c83B42D8A316246CAc9739E7f690e" as `0x${string}`,
|
|
72
|
-
chainId: 1187947933,
|
|
73
|
-
decimals: 8,
|
|
74
|
-
}],
|
|
75
|
-
[tokenKey(1187947933, "0x7bD39ABBd0Dd13103542cAe3276C7fA332bCA486"), {
|
|
76
|
-
symbol: "WETH",
|
|
77
|
-
name: "Wrapped Ether",
|
|
78
|
-
version: "1",
|
|
79
|
-
contractAddress: "0x7bD39ABBd0Dd13103542cAe3276C7fA332bCA486" as `0x${string}`,
|
|
80
|
-
chainId: 1187947933,
|
|
81
|
-
decimals: 6,
|
|
82
|
-
}],
|
|
83
|
-
[tokenKey(324705682, "0xaf2e0ff5b5f51553fdb34ce7f04a6c3201cee57b"), {
|
|
84
|
-
symbol: "SKL",
|
|
85
|
-
name: "SKALE",
|
|
86
|
-
version: "1",
|
|
87
|
-
contractAddress: "0xaf2e0ff5b5f51553fdb34ce7f04a6c3201cee57b" as `0x${string}`,
|
|
88
|
-
chainId: 324705682,
|
|
89
|
-
decimals: 18,
|
|
90
|
-
}],
|
|
91
|
-
[tokenKey(324705682, "0x036CbD53842c5426634e7929541eC2318f3dCF7e"), {
|
|
92
|
-
symbol: "USDC",
|
|
93
|
-
name: "USDC",
|
|
94
|
-
version: "2",
|
|
95
|
-
contractAddress: "0x036CbD53842c5426634e7929541eC2318f3dCF7e" as `0x${string}`,
|
|
96
|
-
chainId: 324705682,
|
|
97
|
-
decimals: 6,
|
|
98
|
-
}],
|
|
99
|
-
[tokenKey(324705682, "0x3ca0a49f511c2c89c4dcbbf1731120d8919050bf"), {
|
|
100
|
-
symbol: "USDT",
|
|
101
|
-
name: "USDT",
|
|
102
|
-
version: "1",
|
|
103
|
-
contractAddress: "0x3ca0a49f511c2c89c4dcbbf1731120d8919050bf" as `0x${string}`,
|
|
104
|
-
chainId: 324705682,
|
|
105
|
-
decimals: 6,
|
|
106
|
-
}],
|
|
107
|
-
[tokenKey(324705682, "0x4512eacd4186b025186e1cf6cc0d89497c530e87"), {
|
|
108
|
-
symbol: "WBTC",
|
|
109
|
-
name: "Wrapped BTC",
|
|
110
|
-
version: "1",
|
|
111
|
-
contractAddress: "0x4512eacd4186b025186e1cf6cc0d89497c530e87" as `0x${string}`,
|
|
112
|
-
chainId: 324705682,
|
|
113
|
-
decimals: 8,
|
|
114
|
-
}],
|
|
115
|
-
[tokenKey(324705682, "0xf94056bd7f6965db3757e1b145f200b7346b4fc0"), {
|
|
116
|
-
symbol: "WETH",
|
|
117
|
-
name: "Wrapped Ether",
|
|
118
|
-
version: "1",
|
|
119
|
-
contractAddress: "0xf94056bd7f6965db3757e1b145f200b7346b4fc0" as `0x${string}`,
|
|
120
|
-
chainId: 324705682,
|
|
121
|
-
decimals: 18,
|
|
122
|
-
}],
|
|
123
|
-
]);
|
|
124
|
-
|
|
125
26
|
export const NETWORKS: Record<string, NetworkConfig> = {
|
|
126
27
|
ethereum: {
|
|
127
28
|
name: "Ethereum Mainnet",
|
package/src/types/protocol.ts
CHANGED
|
@@ -30,7 +30,7 @@ export type PaymentRequired = PaymentRequiredV2;
|
|
|
30
30
|
*/
|
|
31
31
|
export interface FacilitatorConfig {
|
|
32
32
|
url: string;
|
|
33
|
-
|
|
33
|
+
headers?: Record<string, string>;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
/**
|
|
@@ -54,9 +54,9 @@ export interface FacilitatorSettleResult {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
/**
|
|
57
|
-
* Settlement mode - verify only
|
|
57
|
+
* Settlement mode - verify only or settle
|
|
58
58
|
*/
|
|
59
|
-
export type SettlementMode = "verify" | "settle"
|
|
59
|
+
export type SettlementMode = "verify" | "settle";
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
62
|
* Payment destination - address, CAIP-2 chain ID, or CAIP asset ID
|