@morpho-org/blue-sdk 6.0.1 → 6.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/lib/cjs/addresses.d.ts +225 -0
- package/lib/cjs/addresses.js +140 -0
- package/lib/cjs/chain.d.ts +108 -1
- package/lib/cjs/chain.js +94 -0
- package/lib/cjs/errors.d.ts +39 -0
- package/lib/cjs/errors.js +38 -1
- package/lib/cjs/holding/AssetBalances.d.ts +3 -0
- package/lib/cjs/holding/AssetBalances.js +1 -0
- package/lib/cjs/holding/Holding.d.ts +6 -0
- package/lib/cjs/holding/Holding.js +2 -0
- package/lib/cjs/market/Market.d.ts +4 -0
- package/lib/cjs/market/MarketParams.d.ts +3 -0
- package/lib/cjs/market/MarketParams.js +1 -0
- package/lib/cjs/market/MarketUtils.d.ts +397 -0
- package/lib/cjs/market/MarketUtils.js +397 -2
- package/lib/cjs/math/AdaptiveCurveIrmLib.d.ts +51 -1
- package/lib/cjs/math/AdaptiveCurveIrmLib.js +52 -2
- package/lib/cjs/math/MathLib.d.ts +152 -4
- package/lib/cjs/math/MathLib.js +151 -4
- package/lib/cjs/math/SharesMath.d.ts +34 -0
- package/lib/cjs/math/SharesMath.js +34 -0
- package/lib/cjs/position/Position.d.ts +4 -0
- package/lib/cjs/position/Position.js +2 -0
- package/lib/cjs/position/PreLiquidationPosition.d.ts +4 -0
- package/lib/cjs/position/PreLiquidationPosition.js +2 -0
- package/lib/cjs/preLiquidation.d.ts +16 -0
- package/lib/cjs/preLiquidation.js +16 -0
- package/lib/cjs/token/ConstantWrappedToken.d.ts +1 -0
- package/lib/cjs/token/ConstantWrappedToken.js +1 -0
- package/lib/cjs/token/Eip5267Domain.d.ts +4 -0
- package/lib/cjs/token/Eip5267Domain.js +2 -0
- package/lib/cjs/token/ExchangeRateWrappedToken.d.ts +1 -0
- package/lib/cjs/token/ExchangeRateWrappedToken.js +1 -0
- package/lib/cjs/token/Token.d.ts +2 -0
- package/lib/cjs/token/Token.js +1 -0
- package/lib/cjs/token/VaultToken.d.ts +2 -0
- package/lib/cjs/token/VaultToken.js +1 -0
- package/lib/cjs/token/WrappedToken.d.ts +1 -0
- package/lib/cjs/token/WrappedToken.js +1 -0
- package/lib/cjs/types.d.ts +17 -0
- package/lib/cjs/types.js +13 -0
- package/lib/cjs/user/User.d.ts +1 -0
- package/lib/cjs/user/User.js +1 -0
- package/lib/cjs/utils.d.ts +2 -0
- package/lib/cjs/utils.js +1 -0
- package/lib/cjs/vault/Vault.d.ts +9 -0
- package/lib/cjs/vault/Vault.js +14 -1
- package/lib/cjs/vault/VaultConfig.d.ts +2 -0
- package/lib/cjs/vault/VaultConfig.js +1 -0
- package/lib/cjs/vault/VaultMarketAllocation.d.ts +2 -0
- package/lib/cjs/vault/VaultMarketAllocation.js +1 -0
- package/lib/cjs/vault/VaultMarketConfig.d.ts +2 -0
- package/lib/cjs/vault/VaultMarketConfig.js +1 -0
- package/lib/cjs/vault/VaultMarketPublicAllocatorConfig.d.ts +1 -0
- package/lib/cjs/vault/VaultMarketPublicAllocatorConfig.js +1 -0
- package/lib/cjs/vault/VaultUser.d.ts +2 -0
- package/lib/cjs/vault/VaultUser.js +1 -0
- package/lib/cjs/vault/VaultUtils.d.ts +49 -0
- package/lib/cjs/vault/VaultUtils.js +51 -2
- package/lib/cjs/vault/v2/VaultV2.d.ts +5 -0
- package/lib/cjs/vault/v2/VaultV2.js +2 -0
- package/lib/cjs/vault/v2/VaultV2Adapter.d.ts +3 -0
- package/lib/cjs/vault/v2/VaultV2Adapter.js +1 -0
- package/lib/cjs/vault/v2/VaultV2MorphoMarketV1Adapter.d.ts +4 -0
- package/lib/cjs/vault/v2/VaultV2MorphoMarketV1Adapter.js +3 -1
- package/lib/cjs/vault/v2/VaultV2MorphoMarketV1AdapterV2.d.ts +4 -0
- package/lib/cjs/vault/v2/VaultV2MorphoMarketV1AdapterV2.js +3 -1
- package/lib/cjs/vault/v2/VaultV2MorphoVaultV1Adapter.d.ts +4 -0
- package/lib/cjs/vault/v2/VaultV2MorphoVaultV1Adapter.js +2 -0
- package/lib/esm/addresses.d.ts +225 -0
- package/lib/esm/addresses.js +140 -0
- package/lib/esm/chain.d.ts +108 -1
- package/lib/esm/chain.js +94 -0
- package/lib/esm/errors.d.ts +39 -0
- package/lib/esm/errors.js +36 -0
- package/lib/esm/holding/AssetBalances.d.ts +3 -0
- package/lib/esm/holding/AssetBalances.js +1 -0
- package/lib/esm/holding/Holding.d.ts +6 -0
- package/lib/esm/holding/Holding.js +2 -0
- package/lib/esm/market/Market.d.ts +4 -0
- package/lib/esm/market/MarketParams.d.ts +3 -0
- package/lib/esm/market/MarketParams.js +1 -0
- package/lib/esm/market/MarketUtils.d.ts +397 -0
- package/lib/esm/market/MarketUtils.js +397 -2
- package/lib/esm/math/AdaptiveCurveIrmLib.d.ts +51 -1
- package/lib/esm/math/AdaptiveCurveIrmLib.js +52 -2
- package/lib/esm/math/MathLib.d.ts +152 -4
- package/lib/esm/math/MathLib.js +151 -4
- package/lib/esm/math/SharesMath.d.ts +34 -0
- package/lib/esm/math/SharesMath.js +34 -0
- package/lib/esm/position/Position.d.ts +4 -0
- package/lib/esm/position/Position.js +2 -0
- package/lib/esm/position/PreLiquidationPosition.d.ts +4 -0
- package/lib/esm/position/PreLiquidationPosition.js +2 -0
- package/lib/esm/preLiquidation.d.ts +16 -0
- package/lib/esm/preLiquidation.js +16 -0
- package/lib/esm/token/ConstantWrappedToken.d.ts +1 -0
- package/lib/esm/token/ConstantWrappedToken.js +1 -0
- package/lib/esm/token/Eip5267Domain.d.ts +4 -0
- package/lib/esm/token/Eip5267Domain.js +2 -0
- package/lib/esm/token/ExchangeRateWrappedToken.d.ts +1 -0
- package/lib/esm/token/ExchangeRateWrappedToken.js +1 -0
- package/lib/esm/token/Token.d.ts +2 -0
- package/lib/esm/token/Token.js +1 -0
- package/lib/esm/token/VaultToken.d.ts +2 -0
- package/lib/esm/token/VaultToken.js +1 -0
- package/lib/esm/token/WrappedToken.d.ts +1 -0
- package/lib/esm/token/WrappedToken.js +1 -0
- package/lib/esm/types.d.ts +17 -0
- package/lib/esm/types.js +13 -0
- package/lib/esm/user/User.d.ts +1 -0
- package/lib/esm/user/User.js +1 -0
- package/lib/esm/utils.d.ts +2 -0
- package/lib/esm/utils.js +1 -0
- package/lib/esm/vault/Vault.d.ts +9 -0
- package/lib/esm/vault/Vault.js +14 -1
- package/lib/esm/vault/VaultConfig.d.ts +2 -0
- package/lib/esm/vault/VaultConfig.js +1 -0
- package/lib/esm/vault/VaultMarketAllocation.d.ts +2 -0
- package/lib/esm/vault/VaultMarketAllocation.js +1 -0
- package/lib/esm/vault/VaultMarketConfig.d.ts +2 -0
- package/lib/esm/vault/VaultMarketConfig.js +1 -0
- package/lib/esm/vault/VaultMarketPublicAllocatorConfig.d.ts +1 -0
- package/lib/esm/vault/VaultMarketPublicAllocatorConfig.js +1 -0
- package/lib/esm/vault/VaultUser.d.ts +2 -0
- package/lib/esm/vault/VaultUser.js +1 -0
- package/lib/esm/vault/VaultUtils.d.ts +49 -0
- package/lib/esm/vault/VaultUtils.js +51 -2
- package/lib/esm/vault/v2/VaultV2.d.ts +5 -0
- package/lib/esm/vault/v2/VaultV2.js +2 -0
- package/lib/esm/vault/v2/VaultV2Adapter.d.ts +3 -0
- package/lib/esm/vault/v2/VaultV2Adapter.js +1 -0
- package/lib/esm/vault/v2/VaultV2MorphoMarketV1Adapter.d.ts +4 -0
- package/lib/esm/vault/v2/VaultV2MorphoMarketV1Adapter.js +3 -1
- package/lib/esm/vault/v2/VaultV2MorphoMarketV1AdapterV2.d.ts +4 -0
- package/lib/esm/vault/v2/VaultV2MorphoMarketV1AdapterV2.js +3 -1
- package/lib/esm/vault/v2/VaultV2MorphoVaultV1Adapter.d.ts +4 -0
- package/lib/esm/vault/v2/VaultV2MorphoVaultV1Adapter.js +2 -0
- package/package.json +4 -4
package/lib/cjs/addresses.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import type { Address } from "./types.js";
|
|
|
6
6
|
* NB: data might differ from expected onchain native token data
|
|
7
7
|
*/
|
|
8
8
|
export declare const NATIVE_ADDRESS = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
|
|
9
|
+
/** Registry entry for protocol, adapter, factory, and token addresses on one chain. */
|
|
9
10
|
export interface ChainAddresses {
|
|
10
11
|
morpho: Address;
|
|
11
12
|
permit2?: Address;
|
|
@@ -725,7 +726,52 @@ declare const _addressesRegistry: {
|
|
|
725
726
|
readonly preLiquidationFactory: "0xe8eCe452F04117e5Fe1Ea4403097215443225440";
|
|
726
727
|
readonly wNative: "0x19Aac5f612f524B754CA7e7c41cbFa2E981A4432";
|
|
727
728
|
};
|
|
729
|
+
readonly 5042: {
|
|
730
|
+
readonly morpho: "0x34CD04070dD72b14E241112F6d83812Df5Af7fCD";
|
|
731
|
+
readonly permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3";
|
|
732
|
+
readonly bundler3: {
|
|
733
|
+
readonly bundler3: "0x855dbe13C409Df75CAF6a985Cf6993a4D0319Feb";
|
|
734
|
+
readonly generalAdapter1: "0x0AF5BE7BD7B615e94e1d9275414482D028952466";
|
|
735
|
+
};
|
|
736
|
+
readonly adaptiveCurveIrm: "0xF02615d094Fc02fC031C35fe705e175aA4653f20";
|
|
737
|
+
readonly vaultV2Factory: "0x3b0eefaBfa22ec7CF2c73877ac16e78D76749f12";
|
|
738
|
+
readonly morphoMarketV1AdapterV2Factory: "0x6C2FF5114E45b50bc7195c2F1f87C98cbdad62Cc";
|
|
739
|
+
readonly registryList: "0xdEBC92370Cd74d55DA144116138681dbbb528765";
|
|
740
|
+
readonly chainlinkOracleFactory: "0xbFc8D6167a02889D5EB08a023d9aB712B44f7dE8";
|
|
741
|
+
readonly preLiquidationFactory: "0x8edf6Ac769a7E7D81d571aC0FB8733aD724f6922";
|
|
742
|
+
};
|
|
743
|
+
readonly 2818: {
|
|
744
|
+
readonly morpho: "0xAd10d07901Dc3195c3cb5e78E061F4EA8D9B4905";
|
|
745
|
+
readonly permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3";
|
|
746
|
+
readonly bundler3: {
|
|
747
|
+
readonly bundler3: "0xDB83A44Bf8f53966f7A4F7dCE7F8CdAaBCf83628";
|
|
748
|
+
readonly generalAdapter1: "0xcaeec65c85Fe964c8Bd814cb8E4CaF8B06bde776";
|
|
749
|
+
};
|
|
750
|
+
readonly adaptiveCurveIrm: "0xfB69467De332E03FF502B85bB2249d2f721F3319";
|
|
751
|
+
readonly vaultV2Factory: "0x7D8BF8B276f967F7539c9e91E1a85a33fefE612B";
|
|
752
|
+
readonly morphoMarketV1AdapterV2Factory: "0xa01D7c41cf419405d4DF2e5750d26438DCAC28a6";
|
|
753
|
+
readonly registryList: "0x553c013d1978CF82EF6b316f5c247B73718ba481";
|
|
754
|
+
readonly chainlinkOracleFactory: "0xE91032cE5B8D86bA4Be146c186984F49Af37fbf1";
|
|
755
|
+
readonly preLiquidationFactory: "0x41581344ba49B07EFA758a0F2a199b90f05Cc866";
|
|
756
|
+
readonly wNative: "0x5300000000000000000000000000000000000011";
|
|
757
|
+
};
|
|
758
|
+
readonly 4326: {
|
|
759
|
+
readonly morpho: "0x18120312A7cf44DcfEc6dCe5632a431579ED9100";
|
|
760
|
+
readonly permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3";
|
|
761
|
+
readonly bundler3: {
|
|
762
|
+
readonly bundler3: "0xf53D4c8f0f83F697CD6bB303567400cCf411aA63";
|
|
763
|
+
readonly generalAdapter1: "0x74d3cbc721613C8461df92658d0a20dF275Ca31b";
|
|
764
|
+
};
|
|
765
|
+
readonly adaptiveCurveIrm: "0x56875764185548B0ca72A1877b3aE15E44e8A323";
|
|
766
|
+
readonly vaultV2Factory: "0xf133FA5A78C398B31Cc4a180E6Ae84111D6DCF5B";
|
|
767
|
+
readonly morphoMarketV1AdapterV2Factory: "0x00a58b7a9B3E86CB21f5F11f29F4A12346457012";
|
|
768
|
+
readonly registryList: "0x3aE18af9717C734820137726967bef4fBc5Ec95c";
|
|
769
|
+
readonly chainlinkOracleFactory: "0x02522D475E7064E1d1E966e3197db050b19b2FC2";
|
|
770
|
+
readonly preLiquidationFactory: "0xF6035B231028E61cd2283651f22ecA45f8e3ADc8";
|
|
771
|
+
readonly wNative: "0x4200000000000000000000000000000000000006";
|
|
772
|
+
};
|
|
728
773
|
};
|
|
774
|
+
/** Deployment block registry with the same shape as `ChainAddresses`. */
|
|
729
775
|
export type ChainDeployments<Addresses = ChainAddresses> = {
|
|
730
776
|
[key in keyof Addresses]: Address extends Addresses[key] ? bigint : ChainDeployments<Addresses[key]>;
|
|
731
777
|
};
|
|
@@ -1324,9 +1370,82 @@ declare const _deployments: {
|
|
|
1324
1370
|
readonly preLiquidationFactory: 213462907n;
|
|
1325
1371
|
readonly wNative: 104802159n;
|
|
1326
1372
|
};
|
|
1373
|
+
readonly 5042: {
|
|
1374
|
+
readonly morpho: 1208685n;
|
|
1375
|
+
readonly permit2: 0n;
|
|
1376
|
+
readonly bundler3: {
|
|
1377
|
+
readonly bundler3: 1208685n;
|
|
1378
|
+
readonly generalAdapter1: 1208685n;
|
|
1379
|
+
};
|
|
1380
|
+
readonly adaptiveCurveIrm: 1208685n;
|
|
1381
|
+
readonly vaultV2Factory: 1208931n;
|
|
1382
|
+
readonly morphoMarketV1AdapterV2Factory: 1208978n;
|
|
1383
|
+
readonly registryList: 1208978n;
|
|
1384
|
+
readonly chainlinkOracleFactory: 1208882n;
|
|
1385
|
+
readonly preLiquidationFactory: 1208882n;
|
|
1386
|
+
};
|
|
1387
|
+
readonly 2818: {
|
|
1388
|
+
readonly morpho: 23180020n;
|
|
1389
|
+
readonly permit2: 5081244n;
|
|
1390
|
+
readonly bundler3: {
|
|
1391
|
+
readonly bundler3: 23180020n;
|
|
1392
|
+
readonly generalAdapter1: 23180020n;
|
|
1393
|
+
};
|
|
1394
|
+
readonly adaptiveCurveIrm: 23180020n;
|
|
1395
|
+
readonly vaultV2Factory: 23180183n;
|
|
1396
|
+
readonly morphoMarketV1AdapterV2Factory: 23180228n;
|
|
1397
|
+
readonly registryList: 23180228n;
|
|
1398
|
+
readonly chainlinkOracleFactory: 23180111n;
|
|
1399
|
+
readonly preLiquidationFactory: 23180111n;
|
|
1400
|
+
readonly wNative: 0n;
|
|
1401
|
+
};
|
|
1402
|
+
readonly 4326: {
|
|
1403
|
+
readonly morpho: 16408957n;
|
|
1404
|
+
readonly permit2: 0n;
|
|
1405
|
+
readonly bundler3: {
|
|
1406
|
+
readonly bundler3: 16408957n;
|
|
1407
|
+
readonly generalAdapter1: 16408957n;
|
|
1408
|
+
};
|
|
1409
|
+
readonly adaptiveCurveIrm: 16408957n;
|
|
1410
|
+
readonly vaultV2Factory: 16409067n;
|
|
1411
|
+
readonly morphoMarketV1AdapterV2Factory: 16409115n;
|
|
1412
|
+
readonly registryList: 16409115n;
|
|
1413
|
+
readonly chainlinkOracleFactory: 16409024n;
|
|
1414
|
+
readonly preLiquidationFactory: 16409024n;
|
|
1415
|
+
readonly wNative: 0n;
|
|
1416
|
+
};
|
|
1327
1417
|
};
|
|
1418
|
+
/** Dot-separated label for an address entry in the chain registry. */
|
|
1328
1419
|
export type AddressLabel = DottedKeys<(typeof _addressesRegistry)[ChainId]>;
|
|
1420
|
+
/**
|
|
1421
|
+
* Returns the protocol address registry for a chain.
|
|
1422
|
+
*
|
|
1423
|
+
* @param chainId - The EIP-155 chain id.
|
|
1424
|
+
* @returns The configured protocol, adapter, factory, and token addresses for `chainId`.
|
|
1425
|
+
* @throws {UnsupportedChainIdError} when no address registry exists for `chainId`.
|
|
1426
|
+
* @example
|
|
1427
|
+
* ```ts
|
|
1428
|
+
* import { ChainId, getChainAddresses } from "@morpho-org/blue-sdk";
|
|
1429
|
+
*
|
|
1430
|
+
* const chainAddresses = getChainAddresses(ChainId.EthMainnet);
|
|
1431
|
+
* // chainAddresses satisfies ChainAddresses
|
|
1432
|
+
* ```
|
|
1433
|
+
*/
|
|
1329
1434
|
export declare const getChainAddresses: (chainId: number) => ChainAddresses;
|
|
1435
|
+
/**
|
|
1436
|
+
* Returns the unwrapped token mapped to a wrapped token on a chain.
|
|
1437
|
+
*
|
|
1438
|
+
* @param wrappedToken - The wrapped token address to resolve.
|
|
1439
|
+
* @param chainId - The EIP-155 chain id.
|
|
1440
|
+
* @returns The unwrapped token address, or `undefined` when no mapping is registered.
|
|
1441
|
+
* @example
|
|
1442
|
+
* ```ts
|
|
1443
|
+
* import { ChainId, getUnwrappedToken, NATIVE_ADDRESS, addresses } from "@morpho-org/blue-sdk";
|
|
1444
|
+
*
|
|
1445
|
+
* const unwrapped = getUnwrappedToken(addresses[ChainId.EthMainnet].wNative!, ChainId.EthMainnet);
|
|
1446
|
+
* // unwrapped === NATIVE_ADDRESS
|
|
1447
|
+
* ```
|
|
1448
|
+
*/
|
|
1330
1449
|
export declare function getUnwrappedToken(wrappedToken: Address, chainId: number): `0x${string}` | undefined;
|
|
1331
1450
|
/**
|
|
1332
1451
|
* The registry of all known ERC20Wrapper tokens.
|
|
@@ -1347,11 +1466,25 @@ export declare const permissionedBackedTokens: Record<number, Set<Address>>;
|
|
|
1347
1466
|
* All permissioned Coinbase tokens are considered PermissionedERC20Wrapper and automatically added to the permissionedWrapperTokens registry.
|
|
1348
1467
|
*/
|
|
1349
1468
|
export declare const permissionedCoinbaseTokens: Record<number, Set<Address>>;
|
|
1469
|
+
/**
|
|
1470
|
+
* Returns the known Coinbase-attested wrapped tokens for a chain.
|
|
1471
|
+
*
|
|
1472
|
+
* @param chainId - The EIP-155 chain id.
|
|
1473
|
+
* @returns A set of permissioned wrapped token addresses, or an empty set when none are registered.
|
|
1474
|
+
* @example
|
|
1475
|
+
* ```ts
|
|
1476
|
+
* import { ChainId, getPermissionedCoinbaseTokens } from "@morpho-org/blue-sdk";
|
|
1477
|
+
*
|
|
1478
|
+
* const tokens = getPermissionedCoinbaseTokens(ChainId.BaseMainnet);
|
|
1479
|
+
* // tokens satisfies Set<Address>
|
|
1480
|
+
* ```
|
|
1481
|
+
*/
|
|
1350
1482
|
export declare const getPermissionedCoinbaseTokens: (chainId: number) => Set<`0x${string}`>;
|
|
1351
1483
|
/** /!\ These tokens can not be listed in `erc20WrapperTokens` because the following specs are different:
|
|
1352
1484
|
* - calling `depositFor` supplies on blue instead of minting wrapped token to the user
|
|
1353
1485
|
*/
|
|
1354
1486
|
export declare const convexWrapperTokens: Record<number, Set<Address>>;
|
|
1487
|
+
/** Deep-frozen registry of known chain addresses, keyed by chain id. */
|
|
1355
1488
|
export declare let addressesRegistry: {
|
|
1356
1489
|
readonly 1: {
|
|
1357
1490
|
readonly morpho: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb";
|
|
@@ -2028,8 +2161,54 @@ export declare let addressesRegistry: {
|
|
|
2028
2161
|
readonly preLiquidationFactory: "0xe8eCe452F04117e5Fe1Ea4403097215443225440";
|
|
2029
2162
|
readonly wNative: "0x19Aac5f612f524B754CA7e7c41cbFa2E981A4432";
|
|
2030
2163
|
};
|
|
2164
|
+
readonly 5042: {
|
|
2165
|
+
readonly morpho: "0x34CD04070dD72b14E241112F6d83812Df5Af7fCD";
|
|
2166
|
+
readonly permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3";
|
|
2167
|
+
readonly bundler3: {
|
|
2168
|
+
readonly bundler3: "0x855dbe13C409Df75CAF6a985Cf6993a4D0319Feb";
|
|
2169
|
+
readonly generalAdapter1: "0x0AF5BE7BD7B615e94e1d9275414482D028952466";
|
|
2170
|
+
};
|
|
2171
|
+
readonly adaptiveCurveIrm: "0xF02615d094Fc02fC031C35fe705e175aA4653f20";
|
|
2172
|
+
readonly vaultV2Factory: "0x3b0eefaBfa22ec7CF2c73877ac16e78D76749f12";
|
|
2173
|
+
readonly morphoMarketV1AdapterV2Factory: "0x6C2FF5114E45b50bc7195c2F1f87C98cbdad62Cc";
|
|
2174
|
+
readonly registryList: "0xdEBC92370Cd74d55DA144116138681dbbb528765";
|
|
2175
|
+
readonly chainlinkOracleFactory: "0xbFc8D6167a02889D5EB08a023d9aB712B44f7dE8";
|
|
2176
|
+
readonly preLiquidationFactory: "0x8edf6Ac769a7E7D81d571aC0FB8733aD724f6922";
|
|
2177
|
+
};
|
|
2178
|
+
readonly 2818: {
|
|
2179
|
+
readonly morpho: "0xAd10d07901Dc3195c3cb5e78E061F4EA8D9B4905";
|
|
2180
|
+
readonly permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3";
|
|
2181
|
+
readonly bundler3: {
|
|
2182
|
+
readonly bundler3: "0xDB83A44Bf8f53966f7A4F7dCE7F8CdAaBCf83628";
|
|
2183
|
+
readonly generalAdapter1: "0xcaeec65c85Fe964c8Bd814cb8E4CaF8B06bde776";
|
|
2184
|
+
};
|
|
2185
|
+
readonly adaptiveCurveIrm: "0xfB69467De332E03FF502B85bB2249d2f721F3319";
|
|
2186
|
+
readonly vaultV2Factory: "0x7D8BF8B276f967F7539c9e91E1a85a33fefE612B";
|
|
2187
|
+
readonly morphoMarketV1AdapterV2Factory: "0xa01D7c41cf419405d4DF2e5750d26438DCAC28a6";
|
|
2188
|
+
readonly registryList: "0x553c013d1978CF82EF6b316f5c247B73718ba481";
|
|
2189
|
+
readonly chainlinkOracleFactory: "0xE91032cE5B8D86bA4Be146c186984F49Af37fbf1";
|
|
2190
|
+
readonly preLiquidationFactory: "0x41581344ba49B07EFA758a0F2a199b90f05Cc866";
|
|
2191
|
+
readonly wNative: "0x5300000000000000000000000000000000000011";
|
|
2192
|
+
};
|
|
2193
|
+
readonly 4326: {
|
|
2194
|
+
readonly morpho: "0x18120312A7cf44DcfEc6dCe5632a431579ED9100";
|
|
2195
|
+
readonly permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3";
|
|
2196
|
+
readonly bundler3: {
|
|
2197
|
+
readonly bundler3: "0xf53D4c8f0f83F697CD6bB303567400cCf411aA63";
|
|
2198
|
+
readonly generalAdapter1: "0x74d3cbc721613C8461df92658d0a20dF275Ca31b";
|
|
2199
|
+
};
|
|
2200
|
+
readonly adaptiveCurveIrm: "0x56875764185548B0ca72A1877b3aE15E44e8A323";
|
|
2201
|
+
readonly vaultV2Factory: "0xf133FA5A78C398B31Cc4a180E6Ae84111D6DCF5B";
|
|
2202
|
+
readonly morphoMarketV1AdapterV2Factory: "0x00a58b7a9B3E86CB21f5F11f29F4A12346457012";
|
|
2203
|
+
readonly registryList: "0x3aE18af9717C734820137726967bef4fBc5Ec95c";
|
|
2204
|
+
readonly chainlinkOracleFactory: "0x02522D475E7064E1d1E966e3197db050b19b2FC2";
|
|
2205
|
+
readonly preLiquidationFactory: "0xF6035B231028E61cd2283651f22ecA45f8e3ADc8";
|
|
2206
|
+
readonly wNative: "0x4200000000000000000000000000000000000006";
|
|
2207
|
+
};
|
|
2031
2208
|
};
|
|
2209
|
+
/** Address registry keyed by numeric chain id. */
|
|
2032
2210
|
export declare let addresses: Record<number, ChainAddresses>;
|
|
2211
|
+
/** Deep-frozen registry of deployment blocks, keyed by chain id. */
|
|
2033
2212
|
export declare let deployments: {
|
|
2034
2213
|
readonly 1: {
|
|
2035
2214
|
readonly morpho: 18883124n;
|
|
@@ -2625,7 +2804,52 @@ export declare let deployments: {
|
|
|
2625
2804
|
readonly preLiquidationFactory: 213462907n;
|
|
2626
2805
|
readonly wNative: 104802159n;
|
|
2627
2806
|
};
|
|
2807
|
+
readonly 5042: {
|
|
2808
|
+
readonly morpho: 1208685n;
|
|
2809
|
+
readonly permit2: 0n;
|
|
2810
|
+
readonly bundler3: {
|
|
2811
|
+
readonly bundler3: 1208685n;
|
|
2812
|
+
readonly generalAdapter1: 1208685n;
|
|
2813
|
+
};
|
|
2814
|
+
readonly adaptiveCurveIrm: 1208685n;
|
|
2815
|
+
readonly vaultV2Factory: 1208931n;
|
|
2816
|
+
readonly morphoMarketV1AdapterV2Factory: 1208978n;
|
|
2817
|
+
readonly registryList: 1208978n;
|
|
2818
|
+
readonly chainlinkOracleFactory: 1208882n;
|
|
2819
|
+
readonly preLiquidationFactory: 1208882n;
|
|
2820
|
+
};
|
|
2821
|
+
readonly 2818: {
|
|
2822
|
+
readonly morpho: 23180020n;
|
|
2823
|
+
readonly permit2: 5081244n;
|
|
2824
|
+
readonly bundler3: {
|
|
2825
|
+
readonly bundler3: 23180020n;
|
|
2826
|
+
readonly generalAdapter1: 23180020n;
|
|
2827
|
+
};
|
|
2828
|
+
readonly adaptiveCurveIrm: 23180020n;
|
|
2829
|
+
readonly vaultV2Factory: 23180183n;
|
|
2830
|
+
readonly morphoMarketV1AdapterV2Factory: 23180228n;
|
|
2831
|
+
readonly registryList: 23180228n;
|
|
2832
|
+
readonly chainlinkOracleFactory: 23180111n;
|
|
2833
|
+
readonly preLiquidationFactory: 23180111n;
|
|
2834
|
+
readonly wNative: 0n;
|
|
2835
|
+
};
|
|
2836
|
+
readonly 4326: {
|
|
2837
|
+
readonly morpho: 16408957n;
|
|
2838
|
+
readonly permit2: 0n;
|
|
2839
|
+
readonly bundler3: {
|
|
2840
|
+
readonly bundler3: 16408957n;
|
|
2841
|
+
readonly generalAdapter1: 16408957n;
|
|
2842
|
+
};
|
|
2843
|
+
readonly adaptiveCurveIrm: 16408957n;
|
|
2844
|
+
readonly vaultV2Factory: 16409067n;
|
|
2845
|
+
readonly morphoMarketV1AdapterV2Factory: 16409115n;
|
|
2846
|
+
readonly registryList: 16409115n;
|
|
2847
|
+
readonly chainlinkOracleFactory: 16409024n;
|
|
2848
|
+
readonly preLiquidationFactory: 16409024n;
|
|
2849
|
+
readonly wNative: 0n;
|
|
2850
|
+
};
|
|
2628
2851
|
};
|
|
2852
|
+
/** Deep-frozen registry of wrapped token to unwrapped token mappings. */
|
|
2629
2853
|
export declare let unwrappedTokensMapping: Record<number, Record<`0x${string}`, `0x${string}`>>;
|
|
2630
2854
|
/**
|
|
2631
2855
|
* Registers custom addresses and unwrapped token mappings to extend
|
|
@@ -2642,6 +2866,7 @@ export declare let unwrappedTokensMapping: Record<number, Record<`0x${string}`,
|
|
|
2642
2866
|
* Must provide all required deployments if chain is unknown.
|
|
2643
2867
|
*
|
|
2644
2868
|
* @throws {Error} If attempting to override an existing address.
|
|
2869
|
+
* @returns Nothing.
|
|
2645
2870
|
*
|
|
2646
2871
|
* @example
|
|
2647
2872
|
* ```ts
|
package/lib/cjs/addresses.js
CHANGED
|
@@ -718,6 +718,50 @@ const _addressesRegistry = {
|
|
|
718
718
|
preLiquidationFactory: "0xe8eCe452F04117e5Fe1Ea4403097215443225440",
|
|
719
719
|
wNative: "0x19Aac5f612f524B754CA7e7c41cbFa2E981A4432",
|
|
720
720
|
},
|
|
721
|
+
[chain_js_1.ChainId.ArcMainnet]: {
|
|
722
|
+
morpho: "0x34CD04070dD72b14E241112F6d83812Df5Af7fCD",
|
|
723
|
+
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
|
|
724
|
+
bundler3: {
|
|
725
|
+
bundler3: "0x855dbe13C409Df75CAF6a985Cf6993a4D0319Feb",
|
|
726
|
+
generalAdapter1: "0x0AF5BE7BD7B615e94e1d9275414482D028952466",
|
|
727
|
+
},
|
|
728
|
+
adaptiveCurveIrm: "0xF02615d094Fc02fC031C35fe705e175aA4653f20",
|
|
729
|
+
vaultV2Factory: "0x3b0eefaBfa22ec7CF2c73877ac16e78D76749f12",
|
|
730
|
+
morphoMarketV1AdapterV2Factory: "0x6C2FF5114E45b50bc7195c2F1f87C98cbdad62Cc",
|
|
731
|
+
registryList: "0xdEBC92370Cd74d55DA144116138681dbbb528765",
|
|
732
|
+
chainlinkOracleFactory: "0xbFc8D6167a02889D5EB08a023d9aB712B44f7dE8",
|
|
733
|
+
preLiquidationFactory: "0x8edf6Ac769a7E7D81d571aC0FB8733aD724f6922",
|
|
734
|
+
},
|
|
735
|
+
[chain_js_1.ChainId.MorphMainnet]: {
|
|
736
|
+
morpho: "0xAd10d07901Dc3195c3cb5e78E061F4EA8D9B4905",
|
|
737
|
+
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
|
|
738
|
+
bundler3: {
|
|
739
|
+
bundler3: "0xDB83A44Bf8f53966f7A4F7dCE7F8CdAaBCf83628",
|
|
740
|
+
generalAdapter1: "0xcaeec65c85Fe964c8Bd814cb8E4CaF8B06bde776",
|
|
741
|
+
},
|
|
742
|
+
adaptiveCurveIrm: "0xfB69467De332E03FF502B85bB2249d2f721F3319",
|
|
743
|
+
vaultV2Factory: "0x7D8BF8B276f967F7539c9e91E1a85a33fefE612B",
|
|
744
|
+
morphoMarketV1AdapterV2Factory: "0xa01D7c41cf419405d4DF2e5750d26438DCAC28a6",
|
|
745
|
+
registryList: "0x553c013d1978CF82EF6b316f5c247B73718ba481",
|
|
746
|
+
chainlinkOracleFactory: "0xE91032cE5B8D86bA4Be146c186984F49Af37fbf1",
|
|
747
|
+
preLiquidationFactory: "0x41581344ba49B07EFA758a0F2a199b90f05Cc866",
|
|
748
|
+
wNative: "0x5300000000000000000000000000000000000011",
|
|
749
|
+
},
|
|
750
|
+
[chain_js_1.ChainId.MegaEthMainnet]: {
|
|
751
|
+
morpho: "0x18120312A7cf44DcfEc6dCe5632a431579ED9100",
|
|
752
|
+
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
|
|
753
|
+
bundler3: {
|
|
754
|
+
bundler3: "0xf53D4c8f0f83F697CD6bB303567400cCf411aA63",
|
|
755
|
+
generalAdapter1: "0x74d3cbc721613C8461df92658d0a20dF275Ca31b",
|
|
756
|
+
},
|
|
757
|
+
adaptiveCurveIrm: "0x56875764185548B0ca72A1877b3aE15E44e8A323",
|
|
758
|
+
vaultV2Factory: "0xf133FA5A78C398B31Cc4a180E6Ae84111D6DCF5B",
|
|
759
|
+
morphoMarketV1AdapterV2Factory: "0x00a58b7a9B3E86CB21f5F11f29F4A12346457012",
|
|
760
|
+
registryList: "0x3aE18af9717C734820137726967bef4fBc5Ec95c",
|
|
761
|
+
chainlinkOracleFactory: "0x02522D475E7064E1d1E966e3197db050b19b2FC2",
|
|
762
|
+
preLiquidationFactory: "0xF6035B231028E61cd2283651f22ecA45f8e3ADc8",
|
|
763
|
+
wNative: "0x4200000000000000000000000000000000000006",
|
|
764
|
+
},
|
|
721
765
|
};
|
|
722
766
|
const _deployments = {
|
|
723
767
|
[chain_js_1.ChainId.EthMainnet]: {
|
|
@@ -1314,7 +1358,65 @@ const _deployments = {
|
|
|
1314
1358
|
preLiquidationFactory: 213462907n,
|
|
1315
1359
|
wNative: 104802159n,
|
|
1316
1360
|
},
|
|
1361
|
+
[chain_js_1.ChainId.ArcMainnet]: {
|
|
1362
|
+
morpho: 1208685n,
|
|
1363
|
+
permit2: 0n,
|
|
1364
|
+
bundler3: {
|
|
1365
|
+
bundler3: 1208685n,
|
|
1366
|
+
generalAdapter1: 1208685n,
|
|
1367
|
+
},
|
|
1368
|
+
adaptiveCurveIrm: 1208685n,
|
|
1369
|
+
vaultV2Factory: 1208931n,
|
|
1370
|
+
morphoMarketV1AdapterV2Factory: 1208978n,
|
|
1371
|
+
registryList: 1208978n,
|
|
1372
|
+
chainlinkOracleFactory: 1208882n,
|
|
1373
|
+
preLiquidationFactory: 1208882n,
|
|
1374
|
+
},
|
|
1375
|
+
[chain_js_1.ChainId.MorphMainnet]: {
|
|
1376
|
+
morpho: 23180020n,
|
|
1377
|
+
permit2: 5081244n,
|
|
1378
|
+
bundler3: {
|
|
1379
|
+
bundler3: 23180020n,
|
|
1380
|
+
generalAdapter1: 23180020n,
|
|
1381
|
+
},
|
|
1382
|
+
adaptiveCurveIrm: 23180020n,
|
|
1383
|
+
vaultV2Factory: 23180183n,
|
|
1384
|
+
morphoMarketV1AdapterV2Factory: 23180228n,
|
|
1385
|
+
registryList: 23180228n,
|
|
1386
|
+
chainlinkOracleFactory: 23180111n,
|
|
1387
|
+
preLiquidationFactory: 23180111n,
|
|
1388
|
+
wNative: 0n,
|
|
1389
|
+
},
|
|
1390
|
+
[chain_js_1.ChainId.MegaEthMainnet]: {
|
|
1391
|
+
morpho: 16408957n,
|
|
1392
|
+
permit2: 0n,
|
|
1393
|
+
bundler3: {
|
|
1394
|
+
bundler3: 16408957n,
|
|
1395
|
+
generalAdapter1: 16408957n,
|
|
1396
|
+
},
|
|
1397
|
+
adaptiveCurveIrm: 16408957n,
|
|
1398
|
+
vaultV2Factory: 16409067n,
|
|
1399
|
+
morphoMarketV1AdapterV2Factory: 16409115n,
|
|
1400
|
+
registryList: 16409115n,
|
|
1401
|
+
chainlinkOracleFactory: 16409024n,
|
|
1402
|
+
preLiquidationFactory: 16409024n,
|
|
1403
|
+
wNative: 0n,
|
|
1404
|
+
},
|
|
1317
1405
|
};
|
|
1406
|
+
/**
|
|
1407
|
+
* Returns the protocol address registry for a chain.
|
|
1408
|
+
*
|
|
1409
|
+
* @param chainId - The EIP-155 chain id.
|
|
1410
|
+
* @returns The configured protocol, adapter, factory, and token addresses for `chainId`.
|
|
1411
|
+
* @throws {UnsupportedChainIdError} when no address registry exists for `chainId`.
|
|
1412
|
+
* @example
|
|
1413
|
+
* ```ts
|
|
1414
|
+
* import { ChainId, getChainAddresses } from "@morpho-org/blue-sdk";
|
|
1415
|
+
*
|
|
1416
|
+
* const chainAddresses = getChainAddresses(ChainId.EthMainnet);
|
|
1417
|
+
* // chainAddresses satisfies ChainAddresses
|
|
1418
|
+
* ```
|
|
1419
|
+
*/
|
|
1318
1420
|
const getChainAddresses = (chainId) => {
|
|
1319
1421
|
const chainAddresses = exports.addresses[chainId];
|
|
1320
1422
|
if (chainAddresses == null)
|
|
@@ -1444,7 +1546,27 @@ const _unwrappedTokensMapping = {
|
|
|
1444
1546
|
[chain_js_1.ChainId.KaiaMainnet]: {
|
|
1445
1547
|
[_addressesRegistry[chain_js_1.ChainId.KaiaMainnet].wNative]: exports.NATIVE_ADDRESS,
|
|
1446
1548
|
},
|
|
1549
|
+
[chain_js_1.ChainId.MorphMainnet]: {
|
|
1550
|
+
[_addressesRegistry[chain_js_1.ChainId.MorphMainnet].wNative]: exports.NATIVE_ADDRESS,
|
|
1551
|
+
},
|
|
1552
|
+
[chain_js_1.ChainId.MegaEthMainnet]: {
|
|
1553
|
+
[_addressesRegistry[chain_js_1.ChainId.MegaEthMainnet].wNative]: exports.NATIVE_ADDRESS,
|
|
1554
|
+
},
|
|
1447
1555
|
};
|
|
1556
|
+
/**
|
|
1557
|
+
* Returns the unwrapped token mapped to a wrapped token on a chain.
|
|
1558
|
+
*
|
|
1559
|
+
* @param wrappedToken - The wrapped token address to resolve.
|
|
1560
|
+
* @param chainId - The EIP-155 chain id.
|
|
1561
|
+
* @returns The unwrapped token address, or `undefined` when no mapping is registered.
|
|
1562
|
+
* @example
|
|
1563
|
+
* ```ts
|
|
1564
|
+
* import { ChainId, getUnwrappedToken, NATIVE_ADDRESS, addresses } from "@morpho-org/blue-sdk";
|
|
1565
|
+
*
|
|
1566
|
+
* const unwrapped = getUnwrappedToken(addresses[ChainId.EthMainnet].wNative!, ChainId.EthMainnet);
|
|
1567
|
+
* // unwrapped === NATIVE_ADDRESS
|
|
1568
|
+
* ```
|
|
1569
|
+
*/
|
|
1448
1570
|
function getUnwrappedToken(wrappedToken, chainId) {
|
|
1449
1571
|
return exports.unwrappedTokensMapping[chainId]?.[wrappedToken];
|
|
1450
1572
|
}
|
|
@@ -1480,6 +1602,19 @@ exports.permissionedCoinbaseTokens = {
|
|
|
1480
1602
|
_addressesRegistry[chain_js_1.ChainId.BaseMainnet].verUsdc,
|
|
1481
1603
|
]),
|
|
1482
1604
|
};
|
|
1605
|
+
/**
|
|
1606
|
+
* Returns the known Coinbase-attested wrapped tokens for a chain.
|
|
1607
|
+
*
|
|
1608
|
+
* @param chainId - The EIP-155 chain id.
|
|
1609
|
+
* @returns A set of permissioned wrapped token addresses, or an empty set when none are registered.
|
|
1610
|
+
* @example
|
|
1611
|
+
* ```ts
|
|
1612
|
+
* import { ChainId, getPermissionedCoinbaseTokens } from "@morpho-org/blue-sdk";
|
|
1613
|
+
*
|
|
1614
|
+
* const tokens = getPermissionedCoinbaseTokens(ChainId.BaseMainnet);
|
|
1615
|
+
* // tokens satisfies Set<Address>
|
|
1616
|
+
* ```
|
|
1617
|
+
*/
|
|
1483
1618
|
const getPermissionedCoinbaseTokens = (chainId) => exports.permissionedCoinbaseTokens[chainId] ?? new Set();
|
|
1484
1619
|
exports.getPermissionedCoinbaseTokens = getPermissionedCoinbaseTokens;
|
|
1485
1620
|
(0, morpho_ts_1.entries)(exports.permissionedBackedTokens).forEach(([chainId, tokens]) => {
|
|
@@ -1504,9 +1639,13 @@ exports.convexWrapperTokens = {
|
|
|
1504
1639
|
_addressesRegistry[chain_js_1.ChainId.EthMainnet]["stkcvx2BTC-f-morpho"],
|
|
1505
1640
|
]),
|
|
1506
1641
|
};
|
|
1642
|
+
/** Deep-frozen registry of known chain addresses, keyed by chain id. */
|
|
1507
1643
|
exports.addressesRegistry = (0, morpho_ts_1.deepFreeze)(_addressesRegistry);
|
|
1644
|
+
/** Address registry keyed by numeric chain id. */
|
|
1508
1645
|
exports.addresses = exports.addressesRegistry;
|
|
1646
|
+
/** Deep-frozen registry of deployment blocks, keyed by chain id. */
|
|
1509
1647
|
exports.deployments = (0, morpho_ts_1.deepFreeze)(_deployments);
|
|
1648
|
+
/** Deep-frozen registry of wrapped token to unwrapped token mappings. */
|
|
1510
1649
|
exports.unwrappedTokensMapping = (0, morpho_ts_1.deepFreeze)(_unwrappedTokensMapping);
|
|
1511
1650
|
/**
|
|
1512
1651
|
* Registers custom addresses and unwrapped token mappings to extend
|
|
@@ -1523,6 +1662,7 @@ exports.unwrappedTokensMapping = (0, morpho_ts_1.deepFreeze)(_unwrappedTokensMap
|
|
|
1523
1662
|
* Must provide all required deployments if chain is unknown.
|
|
1524
1663
|
*
|
|
1525
1664
|
* @throws {Error} If attempting to override an existing address.
|
|
1665
|
+
* @returns Nothing.
|
|
1526
1666
|
*
|
|
1527
1667
|
* @example
|
|
1528
1668
|
* ```ts
|
package/lib/cjs/chain.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** Supported EIP-155 chain ids with Morpho Blue deployments or registry metadata. */
|
|
1
2
|
export declare enum ChainId {
|
|
2
3
|
EthMainnet = 1,
|
|
3
4
|
BaseMainnet = 8453,
|
|
@@ -37,8 +38,12 @@ export declare enum ChainId {
|
|
|
37
38
|
GensynMainnet = 685689,
|
|
38
39
|
FlareMainnet = 14,
|
|
39
40
|
XdcMainnet = 50,
|
|
40
|
-
KaiaMainnet = 8217
|
|
41
|
+
KaiaMainnet = 8217,
|
|
42
|
+
ArcMainnet = 5042,
|
|
43
|
+
MorphMainnet = 2818,
|
|
44
|
+
MegaEthMainnet = 4326
|
|
41
45
|
}
|
|
46
|
+
/** Explorer, native currency, and identifier metadata for a supported chain. */
|
|
42
47
|
export interface ChainMetadata {
|
|
43
48
|
readonly name: string;
|
|
44
49
|
readonly id: ChainId;
|
|
@@ -52,12 +57,81 @@ export interface ChainMetadata {
|
|
|
52
57
|
/** Whether eth_getBalance returns a reliable value. Defaults to true. */
|
|
53
58
|
readonly hasReliableNativeBalance?: boolean;
|
|
54
59
|
}
|
|
60
|
+
/** Chain metadata helpers and registries. */
|
|
55
61
|
export declare namespace ChainUtils {
|
|
62
|
+
/**
|
|
63
|
+
* Returns whether native token balances are reliable on a chain.
|
|
64
|
+
*
|
|
65
|
+
* @param chainId - The EIP-155 chain id to inspect.
|
|
66
|
+
* @returns `false` only for chains whose metadata marks native balances as unreliable.
|
|
67
|
+
* @example
|
|
68
|
+
* ```ts
|
|
69
|
+
* import { ChainId, ChainUtils } from "@morpho-org/blue-sdk";
|
|
70
|
+
*
|
|
71
|
+
* const reliable = ChainUtils.hasReliableNativeBalance(ChainId.EthMainnet);
|
|
72
|
+
* // reliable === true
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
56
75
|
const hasReliableNativeBalance: (chainId: number) => boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Converts a supported chain id to its hexadecimal JSON-RPC form.
|
|
78
|
+
*
|
|
79
|
+
* @param chainId - The supported chain id.
|
|
80
|
+
* @returns The chain id as a `0x`-prefixed hexadecimal string.
|
|
81
|
+
* @example
|
|
82
|
+
* ```ts
|
|
83
|
+
* import { ChainId, ChainUtils } from "@morpho-org/blue-sdk";
|
|
84
|
+
*
|
|
85
|
+
* const hexChainId = ChainUtils.toHexChainId(ChainId.EthMainnet);
|
|
86
|
+
* // hexChainId === "0x1"
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
57
89
|
const toHexChainId: (chainId: ChainId) => string;
|
|
90
|
+
/**
|
|
91
|
+
* Returns the block explorer base URL for a supported chain.
|
|
92
|
+
*
|
|
93
|
+
* @param chainId - The supported chain id.
|
|
94
|
+
* @returns The chain's configured block explorer base URL.
|
|
95
|
+
* @example
|
|
96
|
+
* ```ts
|
|
97
|
+
* import { ChainId, ChainUtils } from "@morpho-org/blue-sdk";
|
|
98
|
+
*
|
|
99
|
+
* const explorerUrl = ChainUtils.getExplorerUrl(ChainId.EthMainnet);
|
|
100
|
+
* // explorerUrl === "https://etherscan.io"
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
58
103
|
const getExplorerUrl: (chainId: ChainId) => string;
|
|
104
|
+
/**
|
|
105
|
+
* Returns a block explorer address URL for a supported chain.
|
|
106
|
+
*
|
|
107
|
+
* @param chainId - The supported chain id.
|
|
108
|
+
* @param address - The address to link to.
|
|
109
|
+
* @returns The block explorer URL for `address`.
|
|
110
|
+
* @example
|
|
111
|
+
* ```ts
|
|
112
|
+
* import { ChainId, ChainUtils, NATIVE_ADDRESS } from "@morpho-org/blue-sdk";
|
|
113
|
+
*
|
|
114
|
+
* const url = ChainUtils.getExplorerAddressUrl(ChainId.EthMainnet, NATIVE_ADDRESS);
|
|
115
|
+
* // url satisfies string
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
59
118
|
const getExplorerAddressUrl: (chainId: ChainId, address: string) => string;
|
|
119
|
+
/**
|
|
120
|
+
* Returns a block explorer transaction URL for a supported chain.
|
|
121
|
+
*
|
|
122
|
+
* @param chainId - The supported chain id.
|
|
123
|
+
* @param tx - The transaction hash to link to.
|
|
124
|
+
* @returns The block explorer URL for `tx`.
|
|
125
|
+
* @example
|
|
126
|
+
* ```ts
|
|
127
|
+
* import { ChainId, ChainUtils } from "@morpho-org/blue-sdk";
|
|
128
|
+
*
|
|
129
|
+
* const url = ChainUtils.getExplorerTransactionUrl(ChainId.EthMainnet, "0xabc");
|
|
130
|
+
* // url satisfies string
|
|
131
|
+
* ```
|
|
132
|
+
*/
|
|
60
133
|
const getExplorerTransactionUrl: (chainId: ChainId, tx: string) => string;
|
|
134
|
+
/** Metadata for each supported chain, keyed by `ChainId`. */
|
|
61
135
|
const CHAIN_METADATA: {
|
|
62
136
|
1: {
|
|
63
137
|
name: string;
|
|
@@ -489,5 +563,38 @@ export declare namespace ChainUtils {
|
|
|
489
563
|
explorerUrl: string;
|
|
490
564
|
identifier: string;
|
|
491
565
|
};
|
|
566
|
+
5042: {
|
|
567
|
+
name: string;
|
|
568
|
+
id: ChainId.ArcMainnet;
|
|
569
|
+
nativeCurrency: {
|
|
570
|
+
name: string;
|
|
571
|
+
symbol: string;
|
|
572
|
+
decimals: number;
|
|
573
|
+
};
|
|
574
|
+
explorerUrl: string;
|
|
575
|
+
identifier: string;
|
|
576
|
+
};
|
|
577
|
+
2818: {
|
|
578
|
+
name: string;
|
|
579
|
+
id: ChainId.MorphMainnet;
|
|
580
|
+
nativeCurrency: {
|
|
581
|
+
name: string;
|
|
582
|
+
symbol: string;
|
|
583
|
+
decimals: number;
|
|
584
|
+
};
|
|
585
|
+
explorerUrl: string;
|
|
586
|
+
identifier: string;
|
|
587
|
+
};
|
|
588
|
+
4326: {
|
|
589
|
+
name: string;
|
|
590
|
+
id: ChainId.MegaEthMainnet;
|
|
591
|
+
nativeCurrency: {
|
|
592
|
+
name: string;
|
|
593
|
+
symbol: string;
|
|
594
|
+
decimals: number;
|
|
595
|
+
};
|
|
596
|
+
explorerUrl: string;
|
|
597
|
+
identifier: string;
|
|
598
|
+
};
|
|
492
599
|
};
|
|
493
600
|
}
|