@parallel-protocol/chains 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -55,6 +55,26 @@ ABIs are exposed under the `/abi` subpath:
55
55
  import { PARALLELIZER_ABI, ERC20_ABI } from "@parallel-protocol/chains/abi";
56
56
  ```
57
57
 
58
+ ## Payment tokens
59
+
60
+ `getTokenDecimals` is the single source of truth for the decimals of every
61
+ Parallel payment token — USDp, sUSDp, USDC and the Parallelizer backing
62
+ collaterals — so merchant and payer sides price amounts identically:
63
+
64
+ ```ts
65
+ import { getTokenDecimals, COLLATERAL_TOKENS } from "@parallel-protocol/chains";
66
+
67
+ getTokenDecimals("base", "0x76A9A0062ec…"); // 18 (USDp)
68
+ getTokenDecimals("base", "0x833589fCD6…"); // 6 (USDC)
69
+ getTokenDecimals("base", "0x820C137fa7…"); // 18 (USDS, a backing collateral)
70
+ getTokenDecimals("base", "0xdead…"); // undefined — outside the catalogue
71
+
72
+ COLLATERAL_TOKENS.base; // { "0x820c…": { symbol: "USDS", decimals: 18 }, … }
73
+ ```
74
+
75
+ Values are verified on-chain and immutable per token; `undefined` lets callers
76
+ decide their own fallback for tokens outside the catalogue.
77
+
58
78
  ## Composing your RPC layer
59
79
 
60
80
  Pass `.viem` straight to `createPublicClient` — RPC URLs are intentionally
package/dist/abi.cjs CHANGED
@@ -2006,6 +2006,28 @@ var SUSDP_ABI = [
2006
2006
  { name: "s", type: "bytes32" }
2007
2007
  ],
2008
2008
  outputs: []
2009
+ },
2010
+ // ERC-4626 events
2011
+ {
2012
+ name: "Deposit",
2013
+ type: "event",
2014
+ inputs: [
2015
+ { name: "caller", type: "address", indexed: true },
2016
+ { name: "owner", type: "address", indexed: true },
2017
+ { name: "assets", type: "uint256", indexed: false },
2018
+ { name: "shares", type: "uint256", indexed: false }
2019
+ ]
2020
+ },
2021
+ {
2022
+ name: "Withdraw",
2023
+ type: "event",
2024
+ inputs: [
2025
+ { name: "caller", type: "address", indexed: true },
2026
+ { name: "receiver", type: "address", indexed: true },
2027
+ { name: "owner", type: "address", indexed: true },
2028
+ { name: "assets", type: "uint256", indexed: false },
2029
+ { name: "shares", type: "uint256", indexed: false }
2030
+ ]
2009
2031
  }
2010
2032
  ];
2011
2033
 
package/dist/abi.d.cts CHANGED
@@ -3413,6 +3413,50 @@ declare const SUSDP_ABI: readonly [{
3413
3413
  readonly type: "bytes32";
3414
3414
  }];
3415
3415
  readonly outputs: readonly [];
3416
+ }, {
3417
+ readonly name: "Deposit";
3418
+ readonly type: "event";
3419
+ readonly inputs: readonly [{
3420
+ readonly name: "caller";
3421
+ readonly type: "address";
3422
+ readonly indexed: true;
3423
+ }, {
3424
+ readonly name: "owner";
3425
+ readonly type: "address";
3426
+ readonly indexed: true;
3427
+ }, {
3428
+ readonly name: "assets";
3429
+ readonly type: "uint256";
3430
+ readonly indexed: false;
3431
+ }, {
3432
+ readonly name: "shares";
3433
+ readonly type: "uint256";
3434
+ readonly indexed: false;
3435
+ }];
3436
+ }, {
3437
+ readonly name: "Withdraw";
3438
+ readonly type: "event";
3439
+ readonly inputs: readonly [{
3440
+ readonly name: "caller";
3441
+ readonly type: "address";
3442
+ readonly indexed: true;
3443
+ }, {
3444
+ readonly name: "receiver";
3445
+ readonly type: "address";
3446
+ readonly indexed: true;
3447
+ }, {
3448
+ readonly name: "owner";
3449
+ readonly type: "address";
3450
+ readonly indexed: true;
3451
+ }, {
3452
+ readonly name: "assets";
3453
+ readonly type: "uint256";
3454
+ readonly indexed: false;
3455
+ }, {
3456
+ readonly name: "shares";
3457
+ readonly type: "uint256";
3458
+ readonly indexed: false;
3459
+ }];
3416
3460
  }];
3417
3461
 
3418
3462
  declare const USDC_EIP3009_ABI: readonly [{
package/dist/abi.d.ts CHANGED
@@ -3413,6 +3413,50 @@ declare const SUSDP_ABI: readonly [{
3413
3413
  readonly type: "bytes32";
3414
3414
  }];
3415
3415
  readonly outputs: readonly [];
3416
+ }, {
3417
+ readonly name: "Deposit";
3418
+ readonly type: "event";
3419
+ readonly inputs: readonly [{
3420
+ readonly name: "caller";
3421
+ readonly type: "address";
3422
+ readonly indexed: true;
3423
+ }, {
3424
+ readonly name: "owner";
3425
+ readonly type: "address";
3426
+ readonly indexed: true;
3427
+ }, {
3428
+ readonly name: "assets";
3429
+ readonly type: "uint256";
3430
+ readonly indexed: false;
3431
+ }, {
3432
+ readonly name: "shares";
3433
+ readonly type: "uint256";
3434
+ readonly indexed: false;
3435
+ }];
3436
+ }, {
3437
+ readonly name: "Withdraw";
3438
+ readonly type: "event";
3439
+ readonly inputs: readonly [{
3440
+ readonly name: "caller";
3441
+ readonly type: "address";
3442
+ readonly indexed: true;
3443
+ }, {
3444
+ readonly name: "receiver";
3445
+ readonly type: "address";
3446
+ readonly indexed: true;
3447
+ }, {
3448
+ readonly name: "owner";
3449
+ readonly type: "address";
3450
+ readonly indexed: true;
3451
+ }, {
3452
+ readonly name: "assets";
3453
+ readonly type: "uint256";
3454
+ readonly indexed: false;
3455
+ }, {
3456
+ readonly name: "shares";
3457
+ readonly type: "uint256";
3458
+ readonly indexed: false;
3459
+ }];
3416
3460
  }];
3417
3461
 
3418
3462
  declare const USDC_EIP3009_ABI: readonly [{
package/dist/abi.js CHANGED
@@ -2004,6 +2004,28 @@ var SUSDP_ABI = [
2004
2004
  { name: "s", type: "bytes32" }
2005
2005
  ],
2006
2006
  outputs: []
2007
+ },
2008
+ // ERC-4626 events
2009
+ {
2010
+ name: "Deposit",
2011
+ type: "event",
2012
+ inputs: [
2013
+ { name: "caller", type: "address", indexed: true },
2014
+ { name: "owner", type: "address", indexed: true },
2015
+ { name: "assets", type: "uint256", indexed: false },
2016
+ { name: "shares", type: "uint256", indexed: false }
2017
+ ]
2018
+ },
2019
+ {
2020
+ name: "Withdraw",
2021
+ type: "event",
2022
+ inputs: [
2023
+ { name: "caller", type: "address", indexed: true },
2024
+ { name: "receiver", type: "address", indexed: true },
2025
+ { name: "owner", type: "address", indexed: true },
2026
+ { name: "assets", type: "uint256", indexed: false },
2027
+ { name: "shares", type: "uint256", indexed: false }
2028
+ ]
2007
2029
  }
2008
2030
  ];
2009
2031
 
package/dist/index.cjs CHANGED
@@ -392,10 +392,70 @@ function getMulticall3Address(chainName) {
392
392
  return cfg?.viem.contracts?.multicall3?.address;
393
393
  }
394
394
 
395
+ // src/tokens.ts
396
+ var USDC_BASE = USDC_CHAIN_ADDRESSES.base;
397
+ var USDC_AVALANCHE = USDC_CHAIN_ADDRESSES.avalanche;
398
+ var COLLATERAL_TOKENS = {
399
+ ethereum: {
400
+ "0xcacd6fd266af91b8aed52accc382b4e165586e29": {
401
+ symbol: "frxUSD",
402
+ decimals: 18
403
+ },
404
+ "0xcf62f905562626cfcdd2261162a51fd02fc9c5b6": {
405
+ symbol: "sfrxUSD",
406
+ decimals: 18
407
+ },
408
+ "0x4c9edd5852cd905f086c759e8383e09bff1e68b3": {
409
+ symbol: "USDe",
410
+ decimals: 18
411
+ },
412
+ "0x9d39a5de30e57443bff2a8307a4256c8797a3497": {
413
+ symbol: "sUSDe",
414
+ decimals: 18
415
+ }
416
+ },
417
+ base: {
418
+ "0x820c137fa70c8691f0e44dc420a5e53c168921dc": {
419
+ symbol: "USDS",
420
+ decimals: 18
421
+ },
422
+ "0x5875eee11cf8398102fdad704c9e96607675467a": {
423
+ symbol: "sUSDS",
424
+ decimals: 18
425
+ },
426
+ [USDC_BASE.toLowerCase()]: { symbol: "USDC", decimals: 6 }
427
+ },
428
+ avalanche: {
429
+ "0x9fd32fd5e32c6b95483d36c5e724c5c5250ce010": {
430
+ symbol: "ygamiUSDC",
431
+ decimals: 6
432
+ },
433
+ [USDC_AVALANCHE.toLowerCase()]: { symbol: "USDC", decimals: 6 }
434
+ },
435
+ hyperevm: {
436
+ "0x5d3a1ff2b6bab83b63cd9ad0787074081a52ef34": {
437
+ symbol: "USDe",
438
+ decimals: 18
439
+ },
440
+ "0x211cc4dd073734da055fbf44a2b4667d5e5fe5d2": {
441
+ symbol: "sUSDe",
442
+ decimals: 18
443
+ }
444
+ }
445
+ };
446
+ function getTokenDecimals(chainName, address) {
447
+ const lower = address.toLowerCase();
448
+ if (getUSDpAddress(chainName)?.toLowerCase() === lower) return 18;
449
+ if (getSUSDpAddress(chainName)?.toLowerCase() === lower) return 18;
450
+ if (getUSDCAddress(chainName)?.toLowerCase() === lower) return 6;
451
+ return COLLATERAL_TOKENS[chainName]?.[lower]?.decimals;
452
+ }
453
+
395
454
  exports.ACTIVE_CHAINS = ACTIVE_CHAINS;
396
455
  exports.BPT_POOL_ID = BPT_POOL_ID;
397
456
  exports.CHAINS_STATIC = CHAINS_STATIC;
398
457
  exports.CHAIN_NAMES = CHAIN_NAMES;
458
+ exports.COLLATERAL_TOKENS = COLLATERAL_TOKENS;
399
459
  exports.ChainEnum = ChainEnum;
400
460
  exports.PARALLELIZER_CHAINS = PARALLELIZER_CHAINS;
401
461
  exports.PRL_ADDRESS = PRL_ADDRESS;
@@ -411,6 +471,7 @@ exports.getChainId = getChainId;
411
471
  exports.getMulticall3Address = getMulticall3Address;
412
472
  exports.getParallelizerAddress = getParallelizerAddress;
413
473
  exports.getSUSDpAddress = getSUSDpAddress;
474
+ exports.getTokenDecimals = getTokenDecimals;
414
475
  exports.getUSDCAddress = getUSDCAddress;
415
476
  exports.getUSDpAddress = getUSDpAddress;
416
477
  exports.isKnownChain = isKnownChain;
package/dist/index.d.cts CHANGED
@@ -101,4 +101,21 @@ declare function isKnownChain(chainName: string): chainName is Chain;
101
101
  /** Returns the canonical multicall3 address for a given chain, if available. */
102
102
  declare function getMulticall3Address(chainName: string): Address | undefined;
103
103
 
104
- export { ACTIVE_CHAINS, BPT_POOL_ID, CHAINS_STATIC, CHAIN_NAMES, type Chain, type ChainContracts, ChainEnum, type ChainStaticConfig, type ChainStatus, PARALLELIZER_CHAINS, PRL_ADDRESS, REWARD_MERKLE_DISTRIBUTOR_ADDRESS, SAVINGS_CHAINS, SPRL1_ADDRESS, SPRL1_CHAIN_ADDRESSES, SPRL2_ADDRESS, STAKING_CHAINS, USDC_CHAIN_ADDRESSES, WETH_ADDRESS, getChainId, getMulticall3Address, getParallelizerAddress, getSUSDpAddress, getUSDCAddress, getUSDpAddress, isKnownChain, isParallelizerChain };
104
+ type TokenInfo = {
105
+ symbol: string;
106
+ decimals: number;
107
+ };
108
+ /**
109
+ * Parallelizer backing collaterals per chain — addresses and decimals verified
110
+ * on-chain (`getCollateralList`). Keys are lowercase addresses. USDp and sUSDp
111
+ * are protocol tokens, not collaterals; they resolve through the chain catalog.
112
+ */
113
+ declare const COLLATERAL_TOKENS: Partial<Record<Chain, Record<string, TokenInfo>>>;
114
+ /**
115
+ * Decimals of a known Parallel payment token (USDp, sUSDp, USDC or a backing
116
+ * collateral) by address. Returns `undefined` for tokens outside the catalog
117
+ * so callers can fall back explicitly.
118
+ */
119
+ declare function getTokenDecimals(chainName: string, address: string): number | undefined;
120
+
121
+ export { ACTIVE_CHAINS, BPT_POOL_ID, CHAINS_STATIC, CHAIN_NAMES, COLLATERAL_TOKENS, type Chain, type ChainContracts, ChainEnum, type ChainStaticConfig, type ChainStatus, PARALLELIZER_CHAINS, PRL_ADDRESS, REWARD_MERKLE_DISTRIBUTOR_ADDRESS, SAVINGS_CHAINS, SPRL1_ADDRESS, SPRL1_CHAIN_ADDRESSES, SPRL2_ADDRESS, STAKING_CHAINS, USDC_CHAIN_ADDRESSES, WETH_ADDRESS, getChainId, getMulticall3Address, getParallelizerAddress, getSUSDpAddress, getTokenDecimals, getUSDCAddress, getUSDpAddress, isKnownChain, isParallelizerChain };
package/dist/index.d.ts CHANGED
@@ -101,4 +101,21 @@ declare function isKnownChain(chainName: string): chainName is Chain;
101
101
  /** Returns the canonical multicall3 address for a given chain, if available. */
102
102
  declare function getMulticall3Address(chainName: string): Address | undefined;
103
103
 
104
- export { ACTIVE_CHAINS, BPT_POOL_ID, CHAINS_STATIC, CHAIN_NAMES, type Chain, type ChainContracts, ChainEnum, type ChainStaticConfig, type ChainStatus, PARALLELIZER_CHAINS, PRL_ADDRESS, REWARD_MERKLE_DISTRIBUTOR_ADDRESS, SAVINGS_CHAINS, SPRL1_ADDRESS, SPRL1_CHAIN_ADDRESSES, SPRL2_ADDRESS, STAKING_CHAINS, USDC_CHAIN_ADDRESSES, WETH_ADDRESS, getChainId, getMulticall3Address, getParallelizerAddress, getSUSDpAddress, getUSDCAddress, getUSDpAddress, isKnownChain, isParallelizerChain };
104
+ type TokenInfo = {
105
+ symbol: string;
106
+ decimals: number;
107
+ };
108
+ /**
109
+ * Parallelizer backing collaterals per chain — addresses and decimals verified
110
+ * on-chain (`getCollateralList`). Keys are lowercase addresses. USDp and sUSDp
111
+ * are protocol tokens, not collaterals; they resolve through the chain catalog.
112
+ */
113
+ declare const COLLATERAL_TOKENS: Partial<Record<Chain, Record<string, TokenInfo>>>;
114
+ /**
115
+ * Decimals of a known Parallel payment token (USDp, sUSDp, USDC or a backing
116
+ * collateral) by address. Returns `undefined` for tokens outside the catalog
117
+ * so callers can fall back explicitly.
118
+ */
119
+ declare function getTokenDecimals(chainName: string, address: string): number | undefined;
120
+
121
+ export { ACTIVE_CHAINS, BPT_POOL_ID, CHAINS_STATIC, CHAIN_NAMES, COLLATERAL_TOKENS, type Chain, type ChainContracts, ChainEnum, type ChainStaticConfig, type ChainStatus, PARALLELIZER_CHAINS, PRL_ADDRESS, REWARD_MERKLE_DISTRIBUTOR_ADDRESS, SAVINGS_CHAINS, SPRL1_ADDRESS, SPRL1_CHAIN_ADDRESSES, SPRL2_ADDRESS, STAKING_CHAINS, USDC_CHAIN_ADDRESSES, WETH_ADDRESS, getChainId, getMulticall3Address, getParallelizerAddress, getSUSDpAddress, getTokenDecimals, getUSDCAddress, getUSDpAddress, isKnownChain, isParallelizerChain };
package/dist/index.js CHANGED
@@ -390,4 +390,63 @@ function getMulticall3Address(chainName) {
390
390
  return cfg?.viem.contracts?.multicall3?.address;
391
391
  }
392
392
 
393
- export { ACTIVE_CHAINS, BPT_POOL_ID, CHAINS_STATIC, CHAIN_NAMES, ChainEnum, PARALLELIZER_CHAINS, PRL_ADDRESS, REWARD_MERKLE_DISTRIBUTOR_ADDRESS, SAVINGS_CHAINS, SPRL1_ADDRESS, SPRL1_CHAIN_ADDRESSES, SPRL2_ADDRESS, STAKING_CHAINS, USDC_CHAIN_ADDRESSES, WETH_ADDRESS, getChainId, getMulticall3Address, getParallelizerAddress, getSUSDpAddress, getUSDCAddress, getUSDpAddress, isKnownChain, isParallelizerChain };
393
+ // src/tokens.ts
394
+ var USDC_BASE = USDC_CHAIN_ADDRESSES.base;
395
+ var USDC_AVALANCHE = USDC_CHAIN_ADDRESSES.avalanche;
396
+ var COLLATERAL_TOKENS = {
397
+ ethereum: {
398
+ "0xcacd6fd266af91b8aed52accc382b4e165586e29": {
399
+ symbol: "frxUSD",
400
+ decimals: 18
401
+ },
402
+ "0xcf62f905562626cfcdd2261162a51fd02fc9c5b6": {
403
+ symbol: "sfrxUSD",
404
+ decimals: 18
405
+ },
406
+ "0x4c9edd5852cd905f086c759e8383e09bff1e68b3": {
407
+ symbol: "USDe",
408
+ decimals: 18
409
+ },
410
+ "0x9d39a5de30e57443bff2a8307a4256c8797a3497": {
411
+ symbol: "sUSDe",
412
+ decimals: 18
413
+ }
414
+ },
415
+ base: {
416
+ "0x820c137fa70c8691f0e44dc420a5e53c168921dc": {
417
+ symbol: "USDS",
418
+ decimals: 18
419
+ },
420
+ "0x5875eee11cf8398102fdad704c9e96607675467a": {
421
+ symbol: "sUSDS",
422
+ decimals: 18
423
+ },
424
+ [USDC_BASE.toLowerCase()]: { symbol: "USDC", decimals: 6 }
425
+ },
426
+ avalanche: {
427
+ "0x9fd32fd5e32c6b95483d36c5e724c5c5250ce010": {
428
+ symbol: "ygamiUSDC",
429
+ decimals: 6
430
+ },
431
+ [USDC_AVALANCHE.toLowerCase()]: { symbol: "USDC", decimals: 6 }
432
+ },
433
+ hyperevm: {
434
+ "0x5d3a1ff2b6bab83b63cd9ad0787074081a52ef34": {
435
+ symbol: "USDe",
436
+ decimals: 18
437
+ },
438
+ "0x211cc4dd073734da055fbf44a2b4667d5e5fe5d2": {
439
+ symbol: "sUSDe",
440
+ decimals: 18
441
+ }
442
+ }
443
+ };
444
+ function getTokenDecimals(chainName, address) {
445
+ const lower = address.toLowerCase();
446
+ if (getUSDpAddress(chainName)?.toLowerCase() === lower) return 18;
447
+ if (getSUSDpAddress(chainName)?.toLowerCase() === lower) return 18;
448
+ if (getUSDCAddress(chainName)?.toLowerCase() === lower) return 6;
449
+ return COLLATERAL_TOKENS[chainName]?.[lower]?.decimals;
450
+ }
451
+
452
+ export { ACTIVE_CHAINS, BPT_POOL_ID, CHAINS_STATIC, CHAIN_NAMES, COLLATERAL_TOKENS, ChainEnum, PARALLELIZER_CHAINS, PRL_ADDRESS, REWARD_MERKLE_DISTRIBUTOR_ADDRESS, SAVINGS_CHAINS, SPRL1_ADDRESS, SPRL1_CHAIN_ADDRESSES, SPRL2_ADDRESS, STAKING_CHAINS, USDC_CHAIN_ADDRESSES, WETH_ADDRESS, getChainId, getMulticall3Address, getParallelizerAddress, getSUSDpAddress, getTokenDecimals, getUSDCAddress, getUSDpAddress, isKnownChain, isParallelizerChain };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parallel-protocol/chains",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Parallel Protocol on-chain catalogue — chain ids, contract addresses, viem-typed ABIs",
5
5
  "author": "Parallel Protocol <contact@parallel.best>",
6
6
  "repository": "github:parallel-protocol/sdk-merchant",