@morpho-org/blue-sdk 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/lib/addresses.d.ts +156 -0
  2. package/lib/addresses.js +160 -0
  3. package/lib/chain/chain.constants.d.ts +3 -0
  4. package/lib/chain/chain.constants.js +232 -0
  5. package/lib/chain/chain.test.d.ts +1 -0
  6. package/lib/chain/chain.test.js +37 -0
  7. package/lib/chain/chain.types.d.ts +20 -0
  8. package/lib/chain/chain.types.js +30 -0
  9. package/lib/chain/chain.utils.d.ts +14 -0
  10. package/lib/chain/chain.utils.js +30 -0
  11. package/lib/chain/index.js +18 -0
  12. package/lib/constants.d.ts +8 -0
  13. package/lib/constants.js +13 -0
  14. package/lib/errors.d.ts +37 -0
  15. package/lib/errors.js +71 -0
  16. package/lib/ethers/ethers.test.d.ts +1 -0
  17. package/lib/ethers/ethers.test.js +11 -0
  18. package/lib/ethers/index.js +18 -0
  19. package/lib/ethers/safeGetAddress.d.ts +1 -0
  20. package/lib/ethers/safeGetAddress.js +6 -0
  21. package/lib/ethers/safeParseUnits.d.ts +2 -0
  22. package/lib/ethers/safeParseUnits.js +25 -0
  23. package/lib/evm.d.ts +36 -0
  24. package/lib/evm.js +113 -0
  25. package/lib/helpers/format/format.d.ts +98 -0
  26. package/lib/helpers/format/format.js +301 -0
  27. package/lib/helpers/format/format.test.d.ts +1 -0
  28. package/lib/helpers/format/format.test.js +257 -0
  29. package/lib/helpers/format/index.js +17 -0
  30. package/lib/helpers/getChecksumedAddress.d.ts +7 -0
  31. package/lib/helpers/getChecksumedAddress.js +17 -0
  32. package/lib/helpers/index.js +20 -0
  33. package/{src/helpers/isZeroAddressOrUnset.ts → lib/helpers/isZeroAddressOrUnset.d.ts} +1 -7
  34. package/lib/helpers/isZeroAddressOrUnset.js +14 -0
  35. package/lib/helpers/locale.d.ts +36 -0
  36. package/lib/helpers/locale.js +86 -0
  37. package/lib/holding/Holding.d.ts +60 -0
  38. package/lib/holding/Holding.js +31 -0
  39. package/lib/holding/index.js +17 -0
  40. package/{src/index.ts → lib/index.d.ts} +0 -1
  41. package/lib/index.js +62 -0
  42. package/lib/market/Market.d.ts +159 -0
  43. package/lib/market/Market.js +240 -0
  44. package/lib/market/MarketConfig.d.ts +44 -0
  45. package/lib/market/MarketConfig.js +56 -0
  46. package/lib/market/MarketUtils.d.ts +165 -0
  47. package/lib/market/MarketUtils.js +182 -0
  48. package/lib/market/MarketUtils.test.d.ts +1 -0
  49. package/lib/market/MarketUtils.test.js +19 -0
  50. package/lib/market/index.js +19 -0
  51. package/lib/maths/AdaptiveCurveIrmLib.d.ts +37 -0
  52. package/lib/maths/AdaptiveCurveIrmLib.js +116 -0
  53. package/lib/maths/MathLib.d.ts +94 -0
  54. package/lib/maths/MathLib.js +153 -0
  55. package/lib/maths/MathUtils.d.ts +15 -0
  56. package/lib/maths/MathUtils.js +33 -0
  57. package/lib/maths/SharesMath.d.ts +12 -0
  58. package/lib/maths/SharesMath.js +22 -0
  59. package/lib/maths/index.js +20 -0
  60. package/lib/notifications.d.ts +98 -0
  61. package/lib/notifications.js +52 -0
  62. package/lib/position/Position.d.ts +118 -0
  63. package/lib/position/Position.js +145 -0
  64. package/lib/position/index.js +17 -0
  65. package/lib/signatures/index.d.ts +12 -0
  66. package/lib/signatures/index.js +39 -0
  67. package/lib/signatures/manager.d.ts +10 -0
  68. package/lib/signatures/manager.js +37 -0
  69. package/lib/signatures/permit.d.ts +21 -0
  70. package/lib/signatures/permit.js +101 -0
  71. package/lib/signatures/permit2.d.ts +20 -0
  72. package/lib/signatures/permit2.js +91 -0
  73. package/lib/signatures/types.d.ts +13 -0
  74. package/lib/signatures/types.js +2 -0
  75. package/lib/signatures/utils.d.ts +6 -0
  76. package/lib/signatures/utils.js +44 -0
  77. package/lib/tests/mocks/markets.d.ts +17 -0
  78. package/lib/tests/mocks/markets.js +108 -0
  79. package/lib/token/ERC20Metadata.d.ts +249 -0
  80. package/lib/token/ERC20Metadata.js +81 -0
  81. package/lib/token/Token.d.ts +45 -0
  82. package/lib/token/Token.js +39 -0
  83. package/lib/token/TokenNamespace.d.ts +18 -0
  84. package/lib/token/TokenNamespace.js +55 -0
  85. package/lib/token/WrappedToken.d.ts +42 -0
  86. package/lib/token/WrappedToken.js +87 -0
  87. package/lib/token/index.js +18 -0
  88. package/lib/types.d.ts +29 -0
  89. package/lib/types.js +23 -0
  90. package/lib/user/User.d.ts +20 -0
  91. package/lib/user/User.js +11 -0
  92. package/lib/user/index.js +18 -0
  93. package/lib/user/user.types.d.ts +18 -0
  94. package/lib/user/user.types.js +2 -0
  95. package/lib/vault/Vault.d.ts +167 -0
  96. package/lib/vault/Vault.js +156 -0
  97. package/lib/vault/VaultAllocation.d.ts +38 -0
  98. package/lib/vault/VaultAllocation.js +18 -0
  99. package/lib/vault/VaultConfig.d.ts +23 -0
  100. package/lib/vault/VaultConfig.js +26 -0
  101. package/lib/vault/VaultUtils.d.ts +17 -0
  102. package/lib/vault/VaultUtils.js +17 -0
  103. package/lib/vault/index.js +20 -0
  104. package/package.json +7 -11
  105. package/src/addresses.ts +0 -261
  106. package/src/chain/chain.constants.ts +0 -235
  107. package/src/chain/chain.test.ts +0 -51
  108. package/src/chain/chain.types.ts +0 -42
  109. package/src/chain/chain.utils.ts +0 -44
  110. package/src/constants.ts +0 -18
  111. package/src/errors.ts +0 -75
  112. package/src/ethers/ethers.test.ts +0 -17
  113. package/src/ethers/safeGetAddress.ts +0 -4
  114. package/src/ethers/safeParseUnits.ts +0 -29
  115. package/src/evm.ts +0 -172
  116. package/src/helpers/format/format.test.ts +0 -340
  117. package/src/helpers/format/format.ts +0 -416
  118. package/src/helpers/getChecksumedAddress.ts +0 -15
  119. package/src/helpers/locale.ts +0 -108
  120. package/src/holding/Holding.ts +0 -109
  121. package/src/market/Market.ts +0 -479
  122. package/src/market/MarketConfig.ts +0 -108
  123. package/src/market/MarketUtils.test.ts +0 -25
  124. package/src/market/MarketUtils.ts +0 -467
  125. package/src/maths/AdaptiveCurveIrmLib.ts +0 -143
  126. package/src/maths/MathLib.ts +0 -208
  127. package/src/maths/MathUtils.ts +0 -31
  128. package/src/maths/SharesMath.ts +0 -40
  129. package/src/notifications.ts +0 -167
  130. package/src/position/Position.ts +0 -251
  131. package/src/signatures/index.ts +0 -18
  132. package/src/signatures/manager.ts +0 -50
  133. package/src/signatures/permit.ts +0 -126
  134. package/src/signatures/permit2.ts +0 -120
  135. package/src/signatures/types.ts +0 -18
  136. package/src/signatures/utils.ts +0 -83
  137. package/src/tests/mocks/markets.ts +0 -110
  138. package/src/token/ERC20Metadata.ts +0 -124
  139. package/src/token/Token.ts +0 -83
  140. package/src/token/TokenNamespace.ts +0 -76
  141. package/src/token/WrappedToken.ts +0 -142
  142. package/src/types.ts +0 -37
  143. package/src/user/User.ts +0 -32
  144. package/src/user/user.types.ts +0 -23
  145. package/src/vault/Vault.ts +0 -370
  146. package/src/vault/VaultAllocation.ts +0 -58
  147. package/src/vault/VaultConfig.ts +0 -55
  148. package/src/vault/VaultUtils.ts +0 -47
  149. /package/{src/chain/index.ts → lib/chain/index.d.ts} +0 -0
  150. /package/{src/ethers/index.ts → lib/ethers/index.d.ts} +0 -0
  151. /package/{src/helpers/format/index.ts → lib/helpers/format/index.d.ts} +0 -0
  152. /package/{src/helpers/index.ts → lib/helpers/index.d.ts} +0 -0
  153. /package/{src/holding/index.ts → lib/holding/index.d.ts} +0 -0
  154. /package/{src/market/index.ts → lib/market/index.d.ts} +0 -0
  155. /package/{src/maths/index.ts → lib/maths/index.d.ts} +0 -0
  156. /package/{src/position/index.ts → lib/position/index.d.ts} +0 -0
  157. /package/{src/token/index.ts → lib/token/index.d.ts} +0 -0
  158. /package/{src/user/index.ts → lib/user/index.d.ts} +0 -0
  159. /package/{src/vault/index.ts → lib/vault/index.d.ts} +0 -0
@@ -0,0 +1,156 @@
1
+ import { ChainId } from "./chain";
2
+ import { Address } from "./types";
3
+ /** Address used to replicate an erc20-behaviour for native token.
4
+ *
5
+ * NB: data might differ from expected onchain native token data
6
+ */
7
+ export declare const NATIVE_ADDRESS = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
8
+ export declare const addresses: {
9
+ readonly 5: {
10
+ readonly morpho: "0x64c7044050Ba0431252df24fEd4d9635a275CB41";
11
+ readonly permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3";
12
+ readonly bundler: "0xCFFbEEAFCD79Fd68FD56Dbc31A419f290A2Fe9e0";
13
+ readonly urd: "0x820755E757a590683dc43115290eb1Cb20a60405";
14
+ readonly wNative: "0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6";
15
+ readonly stEth: "0x1643E812aE58766192Cf7D2Cf9567dF2C37e9B7F";
16
+ readonly wstEth: "0x6320cD32aA674d2898A68ec82e869385Fc5f7E2f";
17
+ readonly rEth: "0x178E141a0E3b34152f73Ff610437A7bf9B83267A";
18
+ readonly sDai: "0xD8134205b0328F5676aaeFb3B2a0DC15f4029d8C";
19
+ readonly dai: "0x11fE4B6AE13d2a6055C8D9cF65c55bac32B5d844";
20
+ readonly usdc: "0x62bD2A599664D421132d7C54AB4DbE3233f4f0Ae";
21
+ readonly usdt: "0x576e379FA7B899b4De1E251e935B31543Df3e954";
22
+ };
23
+ readonly 1: {
24
+ readonly morpho: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb";
25
+ readonly adaptiveCurveIrm: "0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC";
26
+ readonly publicAllocator: "0xfd32fA2ca22c76dD6E550706Ad913FC6CE91c75D";
27
+ readonly permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3";
28
+ readonly bundler: "0x4095F064B8d3c3548A3bebfd0Bbfd04750E30077";
29
+ readonly aaveV3OptimizerBundler: "0x16F38d2E764E7BeBF625a8E995b34968226D2F9c";
30
+ readonly aaveV2Bundler: "0xb3dCc75DB379925edFd3007511A8CE0cB4aa8e76";
31
+ readonly aaveV3Bundler: "0x98ccB155E86bb478d514a827d16f58c6912f9BDC";
32
+ readonly morphoToken: "0x9994E35Db50125E0DF82e4c2dde62496CE330999";
33
+ readonly rEth: "0xae78736Cd615f374D3085123A210448E74Fc6393";
34
+ readonly sDai: "0x83F20F44975D03b1b09e64809B757c47f942BEeA";
35
+ readonly dai: "0x6B175474E89094C44Da98b954EedeAC495271d0F";
36
+ readonly mkr: "0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2";
37
+ readonly wstEth: "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0";
38
+ readonly wNative: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";
39
+ readonly stEth: "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84";
40
+ readonly USDe: "0x4c9EDD5852cd905f086C759E8383e09bff1E68B3";
41
+ readonly sUSDe: "0x9D39A5DE30e57443BfF2A8307A4256c8797A3497";
42
+ readonly bIB01: "0xCA30c93B02514f86d5C86a6e375E3A330B435Fb5";
43
+ readonly wbIB01: "0xcA2A7068e551d5C4482eb34880b194E4b945712F";
44
+ readonly bC3M: "0x2F123cF3F37CE3328CC9B5b8415f9EC5109b45e7";
45
+ readonly wbC3M: "0x95D7337d43340E2721960Dc402D9b9117f0d81a2";
46
+ readonly usdc: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
47
+ readonly usdt: "0xdAC17F958D2ee523a2206206994597C13D831ec7";
48
+ readonly wbtc: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599";
49
+ readonly sWise: "0x48C3399719B582dD63eB5AADf12A40B4C3f52FA2";
50
+ readonly osEth: "0xf1C9acDc66974dFB6dEcB12aA385b9cD01190E38";
51
+ readonly weEth: "0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee";
52
+ readonly ezEth: "0xbf5495Efe5DB9ce00f80364C8B423567e58d2110";
53
+ readonly pyUsd: "0x6c3ea9036406852006290770BEdFcAbA0e23A0e8";
54
+ readonly crvUsd: "0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E";
55
+ readonly morphoOperator: "0x640428D38189B11B844dAEBDBAAbbdfbd8aE0143";
56
+ readonly butterfly: "0xc55126051B22eBb829D00368f4B12Bde432de5Da";
57
+ readonly marketRewardsProgramRegistry: "0x5148bF15bb722E1854F66430Bc9FeD0E9FDaCE7D";
58
+ readonly timeBoundedUrd: "0x330eefa8a787552DC5cAd3C3cA644844B1E61Ddb";
59
+ readonly rsEth: "0xA1290d69c65A6Fe4DF752f95823fae25cB99e5A7";
60
+ readonly "stkcvxcrvUSDTWBTCWETH-morpho": "0xb0Ce26C88e4e7DCa51968b6047f44646f5064278";
61
+ readonly crvUSDTWBTCWETH: "0xf5f5B97624542D72A9E06f04804Bf81baA15e2B4";
62
+ readonly "stkcvxcrvUSDCWBTCWETH-morpho": "0x0ea1a65A2c255f24Ee8D81eA6AaC54Decd9d269e";
63
+ readonly crvUSDCWBTCWETH: "0x7F86Bf177Dd4F3494b841a37e810A34dD56c829B";
64
+ readonly "stkcvxcrvCRVUSDTBTCWSTETH-morpho": "0x3ce8Ec9f3d89aD0A2DdbCC3FDB8991BD241Fc82E";
65
+ readonly crvCRVUSDTBTCWSTETH: "0x2889302a794dA87fBF1D6Db415C1492194663D13";
66
+ readonly "stkcvxTryLSD-morpho": "0x6BA072F0d22806F2C52e9792AF47f2D59103BEBE";
67
+ readonly tryLSD: "0x2570f1bD5D2735314FC102eb12Fc1aFe9e6E7193";
68
+ readonly "stkcvxcrvUSDETHCRV-morpho": "0xAc904BAfBb5FB04Deb2b6198FdCEedE75a78Ce5a";
69
+ readonly crvUSDETHCRV: "0x4eBdF703948ddCEA3B11f675B4D1Fba9d2414A14";
70
+ };
71
+ readonly 8453: {
72
+ readonly morpho: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb";
73
+ readonly permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3";
74
+ readonly bundler: "0xb5D342521EB5b983aE6a6324A4D9eac87C9D1987";
75
+ readonly wNative: "0x4200000000000000000000000000000000000006";
76
+ readonly adaptiveCurveIrm: "0x46415998764C29aB2a25CbeA6254146D50D22687";
77
+ readonly publicAllocator: "0xA090dD1a701408Df1d4d0B85b716c87565f90467";
78
+ readonly usdc: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
79
+ readonly cbEth: "0x2Ae3F1Ec7F1F5012CFEab0185bfc7aa3cf0DEc22";
80
+ };
81
+ };
82
+ interface ChainAddresses {
83
+ morpho: Address;
84
+ permit2: Address;
85
+ bundler: Address;
86
+ wNative: Address;
87
+ adaptiveCurveIrm?: Address;
88
+ publicAllocator?: Address;
89
+ morphoToken?: Address;
90
+ wstEth?: Address;
91
+ stEth?: Address;
92
+ dai?: Address;
93
+ mkr?: Address;
94
+ rEth?: Address;
95
+ sDai?: Address;
96
+ usdc?: Address;
97
+ usdt?: Address;
98
+ bIB01?: Address;
99
+ wbIB01?: Address;
100
+ bC3M?: Address;
101
+ wbC3M?: Address;
102
+ wbtc?: Address;
103
+ sWise?: Address;
104
+ osEth?: Address;
105
+ weEth?: Address;
106
+ ezEth?: Address;
107
+ pyUsd?: Address;
108
+ sUSDe?: Address;
109
+ USDe?: Address;
110
+ marketRewardsProgramRegistry?: Address;
111
+ timeBoundedUrd?: Address;
112
+ rsEth?: Address;
113
+ crvUsd?: Address;
114
+ morphoOperator?: Address;
115
+ butterfly?: Address;
116
+ aaveV3OptimizerBundler?: Address;
117
+ aaveV2Bundler?: Address;
118
+ aaveV3Bundler?: Address;
119
+ "stkcvxcrvUSDTWBTCWETH-morpho"?: Address;
120
+ crvUSDTWBTCWETH?: Address;
121
+ "stkcvxcrvUSDCWBTCWETH-morpho"?: Address;
122
+ crvUSDCWBTCWETH?: Address;
123
+ "stkcvxcrvCRVUSDTBTCWSTETH-morpho"?: Address;
124
+ crvCRVUSDTBTCWSTETH?: Address;
125
+ "stkcvxTryLSD-morpho"?: Address;
126
+ tryLSD?: Address;
127
+ "stkcvxcrvUSDETHCRV-morpho"?: Address;
128
+ crvUSDETHCRV?: Address;
129
+ }
130
+ export type AddressLabel = keyof (typeof addresses)[ChainId];
131
+ declare const _default: {
132
+ 1: ChainAddresses;
133
+ 5: ChainAddresses;
134
+ 8453: ChainAddresses;
135
+ };
136
+ export default _default;
137
+ export declare const getChainAddresses: (chainId: number) => ChainAddresses;
138
+ export declare const unwrappedTokensMapping: {
139
+ [n in ChainId]: {
140
+ [wrapped: string]: string;
141
+ };
142
+ };
143
+ export declare function getUnwrappedToken(wrappedToken: Address, chainId: ChainId): string | undefined;
144
+ export declare const erc20WrapperTokens: {
145
+ [id in ChainId]: Set<Address>;
146
+ };
147
+ export declare const wrappedBackedTokens: {
148
+ [id in ChainId]: Set<Address>;
149
+ };
150
+ export declare const getWrappedBackedTokens: (chainId: number) => Set<string>;
151
+ /** /!\ These tokens can not be listed in `erc20WrapperTokens` because the following specs are different:
152
+ * - calling `depositFor` supplies on blue instead of minting wrapped token to the user
153
+ */
154
+ export declare const convexWrapperTokens: {
155
+ [id in ChainId]: Set<Address>;
156
+ };
@@ -0,0 +1,160 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.convexWrapperTokens = exports.getWrappedBackedTokens = exports.wrappedBackedTokens = exports.erc20WrapperTokens = exports.getUnwrappedToken = exports.unwrappedTokensMapping = exports.getChainAddresses = exports.addresses = exports.NATIVE_ADDRESS = void 0;
4
+ const chain_1 = require("./chain");
5
+ const errors_1 = require("./errors");
6
+ /** Address used to replicate an erc20-behaviour for native token.
7
+ *
8
+ * NB: data might differ from expected onchain native token data
9
+ */
10
+ exports.NATIVE_ADDRESS = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
11
+ exports.addresses = {
12
+ [chain_1.ChainId.EthGoerliTestnet]: {
13
+ morpho: "0x64c7044050Ba0431252df24fEd4d9635a275CB41",
14
+ permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
15
+ bundler: "0xCFFbEEAFCD79Fd68FD56Dbc31A419f290A2Fe9e0",
16
+ urd: "0x820755E757a590683dc43115290eb1Cb20a60405",
17
+ wNative: "0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6",
18
+ stEth: "0x1643E812aE58766192Cf7D2Cf9567dF2C37e9B7F",
19
+ wstEth: "0x6320cD32aA674d2898A68ec82e869385Fc5f7E2f",
20
+ rEth: "0x178E141a0E3b34152f73Ff610437A7bf9B83267A",
21
+ sDai: "0xD8134205b0328F5676aaeFb3B2a0DC15f4029d8C",
22
+ dai: "0x11fE4B6AE13d2a6055C8D9cF65c55bac32B5d844",
23
+ usdc: "0x62bD2A599664D421132d7C54AB4DbE3233f4f0Ae",
24
+ usdt: "0x576e379FA7B899b4De1E251e935B31543Df3e954",
25
+ },
26
+ [chain_1.ChainId.EthMainnet]: {
27
+ morpho: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb",
28
+ adaptiveCurveIrm: "0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC",
29
+ publicAllocator: "0xfd32fA2ca22c76dD6E550706Ad913FC6CE91c75D",
30
+ permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
31
+ bundler: "0x4095F064B8d3c3548A3bebfd0Bbfd04750E30077",
32
+ aaveV3OptimizerBundler: "0x16F38d2E764E7BeBF625a8E995b34968226D2F9c",
33
+ aaveV2Bundler: "0xb3dCc75DB379925edFd3007511A8CE0cB4aa8e76",
34
+ aaveV3Bundler: "0x98ccB155E86bb478d514a827d16f58c6912f9BDC",
35
+ morphoToken: "0x9994E35Db50125E0DF82e4c2dde62496CE330999",
36
+ rEth: "0xae78736Cd615f374D3085123A210448E74Fc6393",
37
+ sDai: "0x83F20F44975D03b1b09e64809B757c47f942BEeA",
38
+ dai: "0x6B175474E89094C44Da98b954EedeAC495271d0F",
39
+ mkr: "0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2",
40
+ wstEth: "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0",
41
+ wNative: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
42
+ stEth: "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84",
43
+ USDe: "0x4c9EDD5852cd905f086C759E8383e09bff1E68B3",
44
+ sUSDe: "0x9D39A5DE30e57443BfF2A8307A4256c8797A3497",
45
+ bIB01: "0xCA30c93B02514f86d5C86a6e375E3A330B435Fb5",
46
+ // If we want to change the wbIB01 address, we have to check if the new one has simple permit or not.
47
+ // Currently, wbIB01 is considered to have simple permit.
48
+ wbIB01: "0xcA2A7068e551d5C4482eb34880b194E4b945712F",
49
+ bC3M: "0x2F123cF3F37CE3328CC9B5b8415f9EC5109b45e7",
50
+ // If we want to change the wbC3M address, we have to check if the new one has simple permit or not.
51
+ // Currently, wbC3M is considered to have simple permit.
52
+ wbC3M: "0x95D7337d43340E2721960Dc402D9b9117f0d81a2",
53
+ usdc: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
54
+ usdt: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
55
+ wbtc: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599",
56
+ sWise: "0x48C3399719B582dD63eB5AADf12A40B4C3f52FA2",
57
+ osEth: "0xf1C9acDc66974dFB6dEcB12aA385b9cD01190E38",
58
+ weEth: "0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee",
59
+ ezEth: "0xbf5495Efe5DB9ce00f80364C8B423567e58d2110",
60
+ pyUsd: "0x6c3ea9036406852006290770BEdFcAbA0e23A0e8",
61
+ crvUsd: "0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E",
62
+ morphoOperator: "0x640428D38189B11B844dAEBDBAAbbdfbd8aE0143",
63
+ butterfly: "0xc55126051B22eBb829D00368f4B12Bde432de5Da",
64
+ marketRewardsProgramRegistry: "0x5148bF15bb722E1854F66430Bc9FeD0E9FDaCE7D",
65
+ timeBoundedUrd: "0x330eefa8a787552DC5cAd3C3cA644844B1E61Ddb",
66
+ rsEth: "0xA1290d69c65A6Fe4DF752f95823fae25cB99e5A7",
67
+ /* Curve tokens */
68
+ "stkcvxcrvUSDTWBTCWETH-morpho": "0xb0Ce26C88e4e7DCa51968b6047f44646f5064278",
69
+ crvUSDTWBTCWETH: "0xf5f5B97624542D72A9E06f04804Bf81baA15e2B4",
70
+ "stkcvxcrvUSDCWBTCWETH-morpho": "0x0ea1a65A2c255f24Ee8D81eA6AaC54Decd9d269e",
71
+ crvUSDCWBTCWETH: "0x7F86Bf177Dd4F3494b841a37e810A34dD56c829B",
72
+ "stkcvxcrvCRVUSDTBTCWSTETH-morpho": "0x3ce8Ec9f3d89aD0A2DdbCC3FDB8991BD241Fc82E",
73
+ crvCRVUSDTBTCWSTETH: "0x2889302a794dA87fBF1D6Db415C1492194663D13",
74
+ "stkcvxTryLSD-morpho": "0x6BA072F0d22806F2C52e9792AF47f2D59103BEBE",
75
+ tryLSD: "0x2570f1bD5D2735314FC102eb12Fc1aFe9e6E7193",
76
+ "stkcvxcrvUSDETHCRV-morpho": "0xAc904BAfBb5FB04Deb2b6198FdCEedE75a78Ce5a",
77
+ crvUSDETHCRV: "0x4eBdF703948ddCEA3B11f675B4D1Fba9d2414A14",
78
+ },
79
+ [chain_1.ChainId.BaseMainnet]: {
80
+ morpho: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb",
81
+ permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
82
+ bundler: "0xb5D342521EB5b983aE6a6324A4D9eac87C9D1987",
83
+ wNative: "0x4200000000000000000000000000000000000006",
84
+ adaptiveCurveIrm: "0x46415998764C29aB2a25CbeA6254146D50D22687",
85
+ publicAllocator: "0xA090dD1a701408Df1d4d0B85b716c87565f90467",
86
+ /* Tokens */
87
+ usdc: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
88
+ cbEth: "0x2Ae3F1Ec7F1F5012CFEab0185bfc7aa3cf0DEc22",
89
+ },
90
+ };
91
+ exports.default = exports.addresses;
92
+ const getChainAddresses = (chainId) => {
93
+ const chainAddresses = exports.addresses[chainId];
94
+ if (!chainAddresses)
95
+ throw new errors_1.UnsupportedChainIdError(chainId);
96
+ return chainAddresses;
97
+ };
98
+ exports.getChainAddresses = getChainAddresses;
99
+ exports.unwrappedTokensMapping = {
100
+ [chain_1.ChainId.EthGoerliTestnet]: {
101
+ [exports.addresses[chain_1.ChainId.EthGoerliTestnet].wNative]: exports.NATIVE_ADDRESS,
102
+ [exports.addresses[chain_1.ChainId.EthGoerliTestnet].wstEth]: exports.addresses[chain_1.ChainId.EthGoerliTestnet].stEth,
103
+ },
104
+ [chain_1.ChainId.EthMainnet]: {
105
+ [exports.addresses[chain_1.ChainId.EthMainnet].wbIB01]: exports.addresses[chain_1.ChainId.EthMainnet].bIB01,
106
+ [exports.addresses[chain_1.ChainId.EthMainnet].wbC3M]: exports.addresses[chain_1.ChainId.EthMainnet].bC3M,
107
+ [exports.addresses[chain_1.ChainId.EthMainnet].wNative]: exports.NATIVE_ADDRESS,
108
+ [exports.addresses[chain_1.ChainId.EthMainnet].stEth]: exports.NATIVE_ADDRESS,
109
+ [exports.addresses[chain_1.ChainId.EthMainnet].wstEth]: exports.addresses[chain_1.ChainId.EthMainnet].stEth,
110
+ [exports.addresses[chain_1.ChainId.EthMainnet]["stkcvxcrvUSDTWBTCWETH-morpho"]]: exports.addresses[chain_1.ChainId.EthMainnet].crvUSDTWBTCWETH,
111
+ [exports.addresses[chain_1.ChainId.EthMainnet]["stkcvxcrvUSDCWBTCWETH-morpho"]]: exports.addresses[chain_1.ChainId.EthMainnet].crvUSDCWBTCWETH,
112
+ [exports.addresses[chain_1.ChainId.EthMainnet]["stkcvxcrvCRVUSDTBTCWSTETH-morpho"]]: exports.addresses[chain_1.ChainId.EthMainnet].crvCRVUSDTBTCWSTETH,
113
+ [exports.addresses[chain_1.ChainId.EthMainnet]["stkcvxTryLSD-morpho"]]: exports.addresses[chain_1.ChainId.EthMainnet].tryLSD,
114
+ [exports.addresses[chain_1.ChainId.EthMainnet]["stkcvxcrvUSDETHCRV-morpho"]]: exports.addresses[chain_1.ChainId.EthMainnet].crvUSDETHCRV,
115
+ },
116
+ [chain_1.ChainId.BaseMainnet]: {
117
+ [exports.addresses[chain_1.ChainId.BaseMainnet].wNative]: exports.NATIVE_ADDRESS,
118
+ },
119
+ };
120
+ function getUnwrappedToken(wrappedToken, chainId) {
121
+ return exports.unwrappedTokensMapping[chainId][wrappedToken];
122
+ }
123
+ exports.getUnwrappedToken = getUnwrappedToken;
124
+ exports.erc20WrapperTokens = {
125
+ [chain_1.ChainId.EthMainnet]: new Set([
126
+ exports.addresses[chain_1.ChainId.EthMainnet].wbIB01,
127
+ exports.addresses[chain_1.ChainId.EthMainnet].wbC3M,
128
+ ]),
129
+ [chain_1.ChainId.EthGoerliTestnet]: new Set(),
130
+ [chain_1.ChainId.BaseMainnet]: new Set(),
131
+ };
132
+ exports.wrappedBackedTokens = {
133
+ [chain_1.ChainId.EthMainnet]: new Set([
134
+ exports.addresses[chain_1.ChainId.EthMainnet].wbIB01,
135
+ exports.addresses[chain_1.ChainId.EthMainnet].wbC3M,
136
+ ]),
137
+ [chain_1.ChainId.EthGoerliTestnet]: new Set(),
138
+ [chain_1.ChainId.BaseMainnet]: new Set(),
139
+ };
140
+ const getWrappedBackedTokens = (chainId) => {
141
+ const tokens = exports.wrappedBackedTokens[chainId];
142
+ if (!tokens)
143
+ throw new errors_1.UnsupportedChainIdError(chainId);
144
+ return tokens;
145
+ };
146
+ exports.getWrappedBackedTokens = getWrappedBackedTokens;
147
+ /** /!\ These tokens can not be listed in `erc20WrapperTokens` because the following specs are different:
148
+ * - calling `depositFor` supplies on blue instead of minting wrapped token to the user
149
+ */
150
+ exports.convexWrapperTokens = {
151
+ [chain_1.ChainId.EthMainnet]: new Set([
152
+ exports.addresses[chain_1.ChainId.EthMainnet]["stkcvxcrvUSDTWBTCWETH-morpho"],
153
+ exports.addresses[chain_1.ChainId.EthMainnet]["stkcvxcrvUSDCWBTCWETH-morpho"],
154
+ exports.addresses[chain_1.ChainId.EthMainnet]["stkcvxcrvCRVUSDTBTCWSTETH-morpho"],
155
+ exports.addresses[chain_1.ChainId.EthMainnet]["stkcvxTryLSD-morpho"],
156
+ exports.addresses[chain_1.ChainId.EthMainnet]["stkcvxcrvUSDETHCRV-morpho"],
157
+ ]),
158
+ [chain_1.ChainId.EthGoerliTestnet]: new Set(),
159
+ [chain_1.ChainId.BaseMainnet]: new Set(),
160
+ };
@@ -0,0 +1,3 @@
1
+ import { ChainMetadata, ChainId } from "./chain.types";
2
+ export declare const BLUE_AVAILABLE_CHAINS: ChainId[];
3
+ export declare const CHAIN_METADATA: Record<ChainId, ChainMetadata>;
@@ -0,0 +1,232 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CHAIN_METADATA = exports.BLUE_AVAILABLE_CHAINS = void 0;
4
+ const chain_types_1 = require("./chain.types");
5
+ exports.BLUE_AVAILABLE_CHAINS = [chain_types_1.ChainId.EthMainnet, chain_types_1.ChainId.BaseMainnet];
6
+ exports.CHAIN_METADATA = {
7
+ [chain_types_1.ChainId.EthMainnet]: {
8
+ name: "Ethereum",
9
+ id: chain_types_1.ChainId.EthMainnet,
10
+ nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
11
+ defaultRpcUrl: "https://mainnet.infura.io/V3/84842078b09946638c03157f83405213",
12
+ explorerUrl: "https://etherscan.io",
13
+ isTestnet: false,
14
+ shortName: "ETH",
15
+ logoSrc: "https://cdn.morpho.org/assets/chains/eth.svg",
16
+ identifier: "mainnet",
17
+ },
18
+ [chain_types_1.ChainId.EthGoerliTestnet]: {
19
+ name: "Ethereum Goerli Testnet",
20
+ id: chain_types_1.ChainId.EthGoerliTestnet,
21
+ nativeCurrency: { name: "Goerli Ether", symbol: "ETH", decimals: 18 },
22
+ defaultRpcUrl: "https://goerli.infura.io/V3/84842078b09946638c03157f83405213",
23
+ explorerUrl: "https://goerli.etherscan.io",
24
+ isTestnet: true,
25
+ shortName: "Goerli",
26
+ logoSrc: "https://cdn.morpho.org/assets/chains/eth.svg",
27
+ identifier: "goerli",
28
+ },
29
+ [chain_types_1.ChainId.BaseMainnet]: {
30
+ name: "Base",
31
+ id: chain_types_1.ChainId.BaseMainnet,
32
+ nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
33
+ defaultRpcUrl: "https://rpc.baseprotocol.org",
34
+ explorerUrl: "https://basescan.org",
35
+ isTestnet: false,
36
+ shortName: "Base",
37
+ logoSrc: "https://cdn.morpho.org/assets/chains/base.png",
38
+ identifier: "base",
39
+ },
40
+ // [ChainId.PolygonMainnet]: {
41
+ // name: "Polygon Mainnet",
42
+ // id: ChainId.PolygonMainnet,
43
+ // nativeCurrency: { name: "MATIC", symbol: "MATIC", decimals: 18n },
44
+ // defaultRpcUrl: "https://rpc-mainnet.maticvigil.com",
45
+ // explorerUrl: "https://polygonscan.com",
46
+ // isTestnet: false,
47
+ // shortName: "Polygon",
48
+ // },
49
+ // [ChainId.MumbaiTestnet]: {
50
+ // name: "Mumbai Testnet",
51
+ // id: ChainId.MumbaiTestnet,
52
+ // nativeCurrency: { name: "MATIC", symbol: "MATIC", decimals: 18n },
53
+ // defaultRpcUrl: "https://rpc-mumbai.maticvigil.com",
54
+ // explorerUrl: "https://mumbai.polygonscan.com",
55
+ // isTestnet: true,
56
+ // shortName: "Mumbai",
57
+ // },
58
+ /* see https://chainid.network/chains.json */
59
+ // [ChainId.PolygonMainnet]: {
60
+ // name: "Polygon Mainnet",
61
+ // id: ChainId.PolygonMainnet,
62
+ // nativeCurrency: { name: "MATIC", symbol: "MATIC", decimals: 18n },
63
+ // defaultRpcUrl: "https://rpc-mainnet.maticvigil.com",
64
+ // explorerUrl: "https://polygonscan.com",
65
+ // isTestnet: false,
66
+ // shortName: "Polygon",
67
+ // },
68
+ // [ChainId.MumbaiTestnet]: {
69
+ // name: "Mumbai Testnet",
70
+ // id: ChainId.MumbaiTestnet,
71
+ // nativeCurrency: { name: "MATIC", symbol: "MATIC", decimals: 18n },
72
+ // defaultRpcUrl: "https://rpc-mumbai.maticvigil.com",
73
+ // explorerUrl: "https://mumbai.polygonscan.com",
74
+ // isTestnet: true,
75
+ // shortName: "Mumbai",
76
+ // },
77
+ // [ChainId.OptimismMainnet]: {
78
+ // name: "Optimism Mainnet",
79
+ // id: ChainId.OptimismMainnet,
80
+ // baseCurrency: "ETH",
81
+ // defaultRpcUrl: "https://mainnet.optimism.io",
82
+ // explorerUrl: "https://optimistic.etherscan.io",
83
+ // isTestnet: false,
84
+ // },
85
+ // [ChainId.BscMainnet]: {
86
+ // name: "Binance Smart Chain Mainnet",
87
+ // id: ChainId.BscMainnet,
88
+ // baseCurrency: "BNB",
89
+ // defaultRpcUrl: "https://bsc-dataseed.binance.org",
90
+ // explorerUrl: "https://bscscan.com",
91
+ // isTestnet: false,
92
+ // },
93
+ // [ChainId.ArbitrumMainnet]: {
94
+ // name: "Arbitrum Mainnet",
95
+ // id: ChainId.ArbitrumMainnet,
96
+ // baseCurrency: "ETH",
97
+ // defaultRpcUrl: "https://arb1.arbitrum.io/rpc",
98
+ // explorerUrl: "https://arbiscan.io",
99
+ // isTestnet: false,
100
+ // },
101
+ // [ChainId.ArbitrumTestnet]: {
102
+ // name: "Arbitrum Testnet",
103
+ // id: ChainId.ArbitrumTestnet,
104
+ // baseCurrency: "ETH",
105
+ // defaultRpcUrl: "https://rinkeby.arbitrum.io/rpc",
106
+ // explorerUrl: "https://rinkeby-explorer.arbitrum.io",
107
+ // isTestnet: true,
108
+ // },
109
+ // [ChainId.GnosisChain]: {
110
+ // name: "Gnosis Chain",
111
+ // id: ChainId.GnosisChain,
112
+ // baseCurrency: "XDAI",
113
+ // defaultRpcUrl: "https://rpc.xdaichain.com",
114
+ // explorerUrl: "https://gnosis.blockscout.com",
115
+ // isTestnet: false,
116
+ // },
117
+ // [ChainId.FantomMainnet]: {
118
+ // name: "Fantom Mainnet",
119
+ // id: ChainId.FantomMainnet,
120
+ // baseCurrency: "FTM",
121
+ // defaultRpcUrl: "https://rpcapi.fantom.network",
122
+ // explorerUrl: "https://ftmscan.com",
123
+ // isTestnet: false,
124
+ // },
125
+ // [ChainId.FantomTestnet]: {
126
+ // name: "Fantom Testnet",
127
+ // id: ChainId.FantomTestnet,
128
+ // baseCurrency: "FTM",
129
+ // defaultRpcUrl: "https://rpc.testnet.fantom.network",
130
+ // explorerUrl: "https://explorer.testnet.fantom.network",
131
+ // isTestnet: true,
132
+ // },
133
+ // [ChainId.HarmonyMainnet]: {
134
+ // name: "Harmony Mainnet",
135
+ // id: ChainId.HarmonyMainnet,
136
+ // baseCurrency: "ONE",
137
+ // defaultRpcUrl: "https://api.harmony.one",
138
+ // explorerUrl: "https://explorer.harmony.one",
139
+ // isTestnet: false,
140
+ // },
141
+ // [ChainId.HarmonyTestnet]: {
142
+ // name: "Harmony Testnet",
143
+ // id: ChainId.HarmonyTestnet,
144
+ // baseCurrency: "ONE",
145
+ // defaultRpcUrl: "https://api.s0.b.hmny.io",
146
+ // explorerUrl: "https://explorer.testnet.harmony.one",
147
+ // isTestnet: true,
148
+ // },
149
+ // [ChainId.BscTestnet]: {
150
+ // name: "Binance Smart Chain Testnet",
151
+ // id: ChainId.BscTestnet,
152
+ // baseCurrency: "BNB",
153
+ // defaultRpcUrl: "https://data-seed-prebsc-1-s1.binance.org:8545",
154
+ // explorerUrl: "https://testnet.bscscan.com",
155
+ // isTestnet: true,
156
+ // },
157
+ // [ChainId.OptimismTestnet]: {
158
+ // name: "Optimism Testnet",
159
+ // id: ChainId.OptimismTestnet,
160
+ // baseCurrency: "ETH",
161
+ // defaultRpcUrl: "https://kovan.optimism.io",
162
+ // explorerUrl: "https://kovan-optimistic.etherscan.io",
163
+ // isTestnet: true,
164
+ // },
165
+ // [ChainId.EthRopstenTestnet]: {
166
+ // name: "Ethereum Ropsten Testnet",
167
+ // id: ChainId.EthRopstenTestnet,
168
+ // baseCurrency: "ETH",
169
+ // defaultRpcUrl:
170
+ // "https://ropsten.infura.io/V4/84842078b09946638c03157f83405213",
171
+ // explorerUrl: "https://ropsten.etherscan.io",
172
+ // isTestnet: true,
173
+ // },
174
+ // [ChainId.EthRinkebyTestnet]: {
175
+ // name: "Ethereum Rinkeby Testnet",
176
+ // id: ChainId.EthRinkebyTestnet,
177
+ // baseCurrency: "ETH",
178
+ // defaultRpcUrl:
179
+ // "https://rinkeby.infura.io/V4/84842078b09946638c03157f83405213",
180
+ // explorerUrl: "https://rinkeby.etherscan.io",
181
+ // isTestnet: true,
182
+ // },
183
+ // [ChainId.EthKovanTestnet]: {
184
+ // name: "Ethereum Kovan Testnet",
185
+ // id: ChainId.EthKovanTestnet,
186
+ // baseCurrency: "ETH",
187
+ // defaultRpcUrl:
188
+ // "https://kovan.infura.io/V4/84842078b09946638c03157f83405213",
189
+ // explorerUrl: "https://kovan.etherscan.io",
190
+ // isTestnet: true,
191
+ // },
192
+ // [ChainId.BaseGoerliTestnet]: {
193
+ // name: "Base Goerli Testnet",
194
+ // id: ChainId.BaseGoerliTestnet,
195
+ // baseCurrency: "ETH",
196
+ // defaultRpcUrl: "https://rpc-goerli.baseprotocol.org",
197
+ // explorerUrl: "https://goerli.basescan.org",
198
+ // isTestnet: true,
199
+ // },
200
+ // [ChainId.GnosisChainTestnet]: {
201
+ // name: "Gnosis Chain Testnet",
202
+ // id: ChainId.GnosisChainTestnet,
203
+ // baseCurrency: "XDAI",
204
+ // defaultRpcUrl: "https://rpc.chiado.gnosis.gateway.fm",
205
+ // explorerUrl: "https://gnosis-chiado.blockscout.com/",
206
+ // isTestnet: true,
207
+ // },
208
+ // [ChainId.AvalancheMainnet]: {
209
+ // name: "Avalanche Mainnet",
210
+ // id: ChainId.AvalancheMainnet,
211
+ // baseCurrency: "AVAX",
212
+ // defaultRpcUrl: "https://api.avax.network/ext/bc/C/rpc",
213
+ // explorerUrl: "https://cchain.explorer.avax.network",
214
+ // isTestnet: false,
215
+ // },
216
+ // [ChainId.AvalancheFujiTestnet]: {
217
+ // name: "Avalanche Fuji Testnet",
218
+ // id: ChainId.AvalancheFujiTestnet,
219
+ // baseCurrency: "AVAX",
220
+ // defaultRpcUrl: "https://api.avax-test.network/ext/bc/C/rpc",
221
+ // explorerUrl: "https://cchain.explorer.avax-test.network",
222
+ // isTestnet: true,
223
+ // },
224
+ // [ChainId.MoonbaseAlphaTestnet]: {
225
+ // name: "Moonbase Alpha Testnet",
226
+ // id: ChainId.MoonbaseAlphaTestnet,
227
+ // baseCurrency: "DEV",
228
+ // defaultRpcUrl: "https://rpc.testnet.moonbeam.network",
229
+ // explorerUrl: "https://moonbase-blockscout.testnet.moonbeam.network",
230
+ // isTestnet: true,
231
+ // },
232
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const morpho_ts_1 = require("@morpho-org/morpho-ts");
4
+ const chain_types_1 = require("./chain.types");
5
+ const chain_utils_1 = require("./chain.utils");
6
+ describe("Network", () => {
7
+ it("Should have all data for all networks", () => {
8
+ const chainIdLength = chain_utils_1.ChainUtils.getAllChainIds().length;
9
+ const chainMetadataLength = (0, morpho_ts_1.keys)(chain_utils_1.ChainUtils.chainMetadata).length;
10
+ expect(chainIdLength).toEqual(chainMetadataLength);
11
+ });
12
+ it("Should have consistent chainIds", () => {
13
+ (0, morpho_ts_1.entries)(chain_utils_1.ChainUtils.chainMetadata).forEach(([chainId, { id }]) => {
14
+ expect(+chainId).toEqual(id);
15
+ });
16
+ });
17
+ it("Should have Testnet in the name for testnet chains", () => {
18
+ Object.values(chain_utils_1.ChainUtils.chainMetadata)
19
+ .filter(({ isTestnet }) => isTestnet)
20
+ .forEach(({ name }) => {
21
+ expect(name).toMatch(/Testnet/);
22
+ });
23
+ });
24
+ it("Should convert correctly a chainId to hexChainId", () => {
25
+ expect(chain_utils_1.ChainUtils.toHexChainId(chain_utils_1.ChainUtils.ChainId.EthGoerliTestnet)).toEqual("0x5");
26
+ expect(chain_utils_1.ChainUtils.toHexChainId(chain_utils_1.ChainUtils.ChainId.BaseMainnet)).toEqual("0x2105");
27
+ });
28
+ it("Should return all testnets", () => {
29
+ expect(chain_utils_1.ChainUtils.getTestnets()).toEqual((0, morpho_ts_1.values)(chain_utils_1.ChainUtils.chainMetadata)
30
+ .filter(({ isTestnet }) => isTestnet)
31
+ .map(({ id }) => id));
32
+ });
33
+ it("Should return all networks", () => {
34
+ expect(chain_utils_1.ChainUtils.getAllChainIds()).toEqual((0, morpho_ts_1.values)(chain_utils_1.ChainUtils.chainMetadata).map(({ id }) => id));
35
+ expect(chain_utils_1.ChainUtils.getAllChainLabels().map((label) => chain_types_1.ChainId[label])).toEqual(chain_utils_1.ChainUtils.getAllChainIds());
36
+ });
37
+ });
@@ -0,0 +1,20 @@
1
+ export declare enum ChainId {
2
+ EthMainnet = 1,
3
+ EthGoerliTestnet = 5,
4
+ BaseMainnet = 8453
5
+ }
6
+ export interface ChainMetadata {
7
+ readonly name: string;
8
+ readonly id: ChainId;
9
+ readonly defaultRpcUrl: string;
10
+ readonly explorerUrl: string;
11
+ readonly nativeCurrency: {
12
+ readonly name: string;
13
+ readonly symbol: string;
14
+ readonly decimals: number;
15
+ };
16
+ readonly isTestnet: boolean;
17
+ readonly shortName: string;
18
+ readonly identifier: string;
19
+ readonly logoSrc: string;
20
+ }
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ChainId = void 0;
4
+ var ChainId;
5
+ (function (ChainId) {
6
+ ChainId[ChainId["EthMainnet"] = 1] = "EthMainnet";
7
+ ChainId[ChainId["EthGoerliTestnet"] = 5] = "EthGoerliTestnet";
8
+ ChainId[ChainId["BaseMainnet"] = 8453] = "BaseMainnet";
9
+ // PolygonMainnet = 137,
10
+ // MumbaiTestnet = 80001,
11
+ // OptimismMainnet = 10,
12
+ // BscMainnet = 56,
13
+ // ArbitrumMainnet = 42161,
14
+ // ArbitrumTestnet = 421611,
15
+ // GnosisChain = 100,
16
+ // FantomMainnet = 250,
17
+ // FantomTestnet = 4002,
18
+ // HarmonyMainnet = 128,
19
+ // HarmonyTestnet = 1666600000,
20
+ // BscTestnet = 97,
21
+ // OptimismTestnet = 69,
22
+ // EthRopstenTestnet = 3,
23
+ // EthRinkebyTestnet = 4,
24
+ // EthKovanTestnet = 42,
25
+ // GnosisChainTestnet = 10200,
26
+ // AvalancheMainnet = 43114,
27
+ // AvalancheFujiTestnet = 43113,
28
+ // MoonbaseAlphaTestnet = 1287,
29
+ // BaseGoerliTestnet = 84531,
30
+ })(ChainId || (exports.ChainId = ChainId = {}));
@@ -0,0 +1,14 @@
1
+ import { ChainId as _ChainId, ChainMetadata as _ChainMetadata } from "./chain.types";
2
+ export declare namespace ChainUtils {
3
+ const blueAvailableChains: ChainId[];
4
+ const chainMetadata: Record<ChainId, _ChainMetadata>;
5
+ interface ChainMetadata extends _ChainMetadata {
6
+ }
7
+ export import ChainId = _ChainId;
8
+ const toHexChainId: (chainId: ChainId) => string;
9
+ const getAllChainIds: () => ChainId[];
10
+ const getAllChainLabels: () => ("EthMainnet" | "EthGoerliTestnet" | "BaseMainnet")[];
11
+ const getTestnets: () => ChainId[];
12
+ function isSupported(chainId: number): chainId is ChainId;
13
+ function parseSupportedChainId(candidate: any): ChainId;
14
+ }