@gearbox-protocol/sdk 13.0.0-next.3 → 13.0.0-next.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/abi/310/iSecuritizeDegenNFT.js +263 -0
- package/dist/cjs/abi/310/iSecuritizeKYCFactory.js +278 -0
- package/dist/cjs/dev/AccountOpener.js +45 -5
- package/dist/cjs/dev/providers.js +12 -0
- package/dist/cjs/history/assembleOperations.js +103 -0
- package/dist/cjs/history/classifyMulticallOperations.js +157 -0
- package/dist/cjs/history/errors.js +91 -0
- package/dist/cjs/history/extractProtocolCalls.js +53 -0
- package/dist/cjs/history/extractTransfers.js +168 -0
- package/dist/cjs/history/findFacadeCalls.js +84 -0
- package/dist/cjs/history/index.js +39 -0
- package/dist/cjs/history/inner-operations.js +16 -0
- package/dist/cjs/history/internal-types.js +16 -0
- package/dist/cjs/history/mapOperations.js +79 -0
- package/dist/cjs/history/package.json +1 -0
- package/dist/cjs/history/parseCreditAccountTransaction.js +86 -0
- package/dist/cjs/history/populateContractsRegister.js +68 -0
- package/dist/cjs/history/toLegacyOperation.js +182 -0
- package/dist/cjs/{plugins/adapters/contracts/YearnV2AdapterContract.js → history/trace-utils.js} +36 -21
- package/dist/cjs/history/types.js +16 -0
- package/dist/cjs/plugins/adapters/AdaptersPlugin.js +13 -106
- package/dist/cjs/plugins/adapters/abi/index.js +2 -0
- package/dist/cjs/plugins/adapters/abi/targetContractAbi.js +5168 -0
- package/dist/cjs/plugins/adapters/contracts/AbstractAdapter.js +102 -3
- package/dist/cjs/plugins/adapters/contracts/AccountMigratorAdapterContract.js +8 -1
- package/dist/cjs/plugins/adapters/contracts/BalancerV3RouterAdapterContract.js +40 -30
- package/dist/cjs/plugins/adapters/contracts/BalancerV3WrapperAdapterContract.js +21 -11
- package/dist/cjs/plugins/adapters/contracts/CamelotV3AdapterContract.js +31 -21
- package/dist/cjs/plugins/adapters/contracts/ConvexV1BaseRewardPoolAdapterContract.js +91 -25
- package/dist/cjs/plugins/adapters/contracts/ConvexV1BoosterAdapterContract.js +63 -25
- package/dist/cjs/plugins/adapters/contracts/Curve2AssetsAdapterContract.js +68 -31
- package/dist/cjs/plugins/adapters/contracts/Curve3AssetsAdapterContract.js +68 -31
- package/dist/cjs/plugins/adapters/contracts/Curve4AssetsAdapterContract.js +73 -31
- package/dist/cjs/plugins/adapters/contracts/CurveV1AdapterDeposit.js +80 -33
- package/dist/cjs/plugins/adapters/contracts/CurveV1AdapterStETHContract.js +62 -26
- package/dist/cjs/plugins/adapters/contracts/CurveV1StableNGAdapterContract.js +80 -34
- package/dist/cjs/plugins/adapters/contracts/DaiUsdsAdapterContract.js +39 -14
- package/dist/cjs/plugins/adapters/contracts/ERC4626AdapterContract.js +55 -27
- package/dist/cjs/plugins/adapters/contracts/ERC4626ReferralAdapterContract.js +39 -14
- package/dist/cjs/plugins/adapters/contracts/FluidDexAdapterContract.js +27 -14
- package/dist/cjs/plugins/adapters/contracts/InfinifiGatewayAdapterContract.js +45 -23
- package/dist/cjs/plugins/adapters/contracts/InfinifiUnwindingGatewayAdapterContract.js +23 -14
- package/dist/cjs/plugins/adapters/contracts/KelpLRTDepositPoolAdapterContract.js +22 -12
- package/dist/cjs/plugins/adapters/contracts/KelpLRTWithdrawalManagerAdapterContract.js +26 -16
- package/dist/cjs/plugins/adapters/contracts/LidoV1AdapterContract.js +39 -17
- package/dist/cjs/plugins/adapters/contracts/MellowClaimerAdapterContract.js +21 -11
- package/dist/cjs/plugins/adapters/contracts/MellowDVVAdapterContract.js +38 -14
- package/dist/cjs/plugins/adapters/contracts/MellowERC4626VaultAdapterContract.js +71 -42
- package/dist/cjs/plugins/adapters/contracts/MellowWrapperAdapterContract.js +21 -11
- package/dist/cjs/plugins/adapters/contracts/MidasIssuanceVaultAdapterContract.js +36 -17
- package/dist/cjs/plugins/adapters/contracts/MidasRedemptionVaultAdapterContract.js +38 -21
- package/dist/cjs/plugins/adapters/contracts/PendleRouterAdapterContract.js +63 -53
- package/dist/cjs/plugins/adapters/contracts/StakingRewardsAdapterContract.js +62 -37
- package/dist/cjs/plugins/adapters/contracts/TraderJoeRouterAdapterContract.js +35 -25
- package/dist/cjs/plugins/adapters/contracts/UniswapV2AdapterContract.js +35 -21
- package/dist/cjs/plugins/adapters/contracts/UniswapV3AdapterContract.js +32 -23
- package/dist/cjs/plugins/adapters/contracts/UniswapV4AdapterContract.js +41 -27
- package/dist/cjs/plugins/adapters/contracts/UpshiftVaultAdapterContract.js +34 -17
- package/dist/cjs/plugins/adapters/contracts/VelodromeV2AdapterContract.js +35 -25
- package/dist/cjs/plugins/adapters/contracts/WstETHV1AdapterContract.js +31 -11
- package/dist/cjs/plugins/adapters/contracts/deprecated/BalancerV2VaultAdapterContract.js +585 -0
- package/dist/cjs/plugins/adapters/contracts/deprecated/EqualizerRouterAdapterContract.js +262 -0
- package/dist/cjs/plugins/adapters/contracts/deprecated/InfraredVaultAdapterContract.js +296 -0
- package/dist/cjs/plugins/adapters/contracts/deprecated/KodiakIslandGatewayAdapterContract.js +415 -0
- package/dist/cjs/plugins/adapters/contracts/deprecated/MellowDepositQueueAdapterContract.js +74 -0
- package/dist/cjs/plugins/adapters/contracts/{MellowRedeemQueueAdapterContract.js → deprecated/MellowRedeemQueueAdapterContract.js} +33 -14
- package/dist/cjs/plugins/adapters/contracts/deprecated/MellowVaultAdapterContract.js +233 -0
- package/dist/cjs/plugins/adapters/contracts/deprecated/YearnV2AdapterContract.js +359 -0
- package/dist/cjs/plugins/adapters/contracts/deprecated/index.js +36 -0
- package/dist/cjs/plugins/adapters/contracts/index.js +3 -17
- package/dist/cjs/plugins/adapters/contracts/types.js +0 -9
- package/dist/cjs/plugins/adapters/createAdapter.js +140 -0
- package/dist/cjs/plugins/adapters/index.js +6 -0
- package/dist/cjs/plugins/adapters/legacyAdapterOperations.js +16 -0
- package/dist/cjs/plugins/adapters/transferHelpers.js +127 -0
- package/dist/cjs/sdk/accounts/AbstractCreditAccountsService.js +464 -105
- package/dist/cjs/sdk/accounts/CreditAccountsServiceV300.js +9 -4
- package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +16 -5
- package/dist/cjs/sdk/base/BaseContract.js +54 -3
- package/dist/cjs/sdk/base/ChainContractsRegister.js +34 -1
- package/dist/cjs/sdk/base/Construct.js +11 -3
- package/dist/cjs/sdk/base/PlaceholderContract.js +2 -2
- package/dist/cjs/sdk/base/TokensMeta.js +161 -22
- package/dist/cjs/sdk/base/errors.js +35 -0
- package/dist/cjs/sdk/base/index.js +2 -0
- package/dist/cjs/sdk/chain/chains.js +2 -1
- package/dist/cjs/sdk/market/MarketRegister.js +2 -2
- package/dist/cjs/sdk/market/MarketSuite.js +3 -0
- package/dist/cjs/sdk/{pools/extraZappers.js → market/ZapperRegister.js} +110 -6
- package/dist/cjs/sdk/market/adapters/PlaceholderAdapterContracts.js +10 -4
- package/dist/cjs/sdk/market/adapters/{factory.js → createAdapter.js} +3 -3
- package/dist/cjs/sdk/market/adapters/index.js +2 -2
- package/dist/cjs/sdk/market/credit/CreditFacadeV310BaseContract.js +108 -0
- package/dist/cjs/sdk/market/credit/CreditFacadeV310Contract.js +3 -40
- package/dist/cjs/sdk/market/credit/index.js +2 -0
- package/dist/cjs/sdk/market/index.js +3 -1
- package/dist/cjs/sdk/market/pool/PoolSuite.js +3 -0
- package/dist/cjs/sdk/market/pool/PoolV300Contract.js +3 -0
- package/dist/cjs/sdk/market/pool/PoolV310Contract.js +17 -2
- package/dist/cjs/sdk/market/pool/SecuritizeKYCFactory.js +97 -0
- package/dist/cjs/sdk/market/pool/index.js +2 -0
- package/dist/cjs/sdk/market/pricefeeds/PythPriceFeed.js +20 -0
- package/dist/cjs/sdk/market/types.js +16 -0
- package/dist/cjs/sdk/pools/PoolService.js +181 -91
- package/dist/cjs/sdk/sdk-legacy/core/creditAccount.js +2 -0
- package/dist/cjs/sdk/utils/AddressMap.js +1 -1
- package/dist/cjs/sdk/utils/abi-decode.js +43 -2
- package/dist/cjs/sdk/utils/viem/sendRawTx.js +16 -0
- package/dist/esm/abi/310/iSecuritizeDegenNFT.js +239 -0
- package/dist/esm/abi/310/iSecuritizeKYCFactory.js +254 -0
- package/dist/esm/dev/AccountOpener.js +47 -6
- package/dist/esm/dev/providers.js +12 -0
- package/dist/esm/history/assembleOperations.js +79 -0
- package/dist/esm/history/classifyMulticallOperations.js +137 -0
- package/dist/esm/history/errors.js +62 -0
- package/dist/esm/history/extractProtocolCalls.js +32 -0
- package/dist/esm/history/extractTransfers.js +148 -0
- package/dist/esm/history/findFacadeCalls.js +63 -0
- package/dist/esm/history/index.js +9 -0
- package/dist/esm/history/inner-operations.js +0 -0
- package/dist/esm/history/internal-types.js +0 -0
- package/dist/esm/history/mapOperations.js +55 -0
- package/dist/esm/history/package.json +1 -0
- package/dist/esm/history/parseCreditAccountTransaction.js +62 -0
- package/dist/esm/history/populateContractsRegister.js +52 -0
- package/dist/esm/history/toLegacyOperation.js +157 -0
- package/dist/esm/history/trace-utils.js +36 -0
- package/dist/esm/history/types.js +0 -0
- package/dist/esm/plugins/adapters/AdaptersPlugin.js +14 -148
- package/dist/esm/plugins/adapters/abi/index.js +1 -0
- package/dist/esm/plugins/adapters/abi/targetContractAbi.js +5113 -0
- package/dist/esm/plugins/adapters/contracts/AbstractAdapter.js +111 -4
- package/dist/esm/plugins/adapters/contracts/AccountMigratorAdapterContract.js +8 -1
- package/dist/esm/plugins/adapters/contracts/BalancerV3RouterAdapterContract.js +40 -30
- package/dist/esm/plugins/adapters/contracts/BalancerV3WrapperAdapterContract.js +21 -11
- package/dist/esm/plugins/adapters/contracts/CamelotV3AdapterContract.js +31 -21
- package/dist/esm/plugins/adapters/contracts/ConvexV1BaseRewardPoolAdapterContract.js +100 -26
- package/dist/esm/plugins/adapters/contracts/ConvexV1BoosterAdapterContract.js +65 -25
- package/dist/esm/plugins/adapters/contracts/Curve2AssetsAdapterContract.js +70 -31
- package/dist/esm/plugins/adapters/contracts/Curve3AssetsAdapterContract.js +70 -31
- package/dist/esm/plugins/adapters/contracts/Curve4AssetsAdapterContract.js +75 -31
- package/dist/esm/plugins/adapters/contracts/CurveV1AdapterDeposit.js +82 -33
- package/dist/esm/plugins/adapters/contracts/CurveV1AdapterStETHContract.js +64 -26
- package/dist/esm/plugins/adapters/contracts/CurveV1StableNGAdapterContract.js +85 -34
- package/dist/esm/plugins/adapters/contracts/DaiUsdsAdapterContract.js +41 -14
- package/dist/esm/plugins/adapters/contracts/ERC4626AdapterContract.js +57 -27
- package/dist/esm/plugins/adapters/contracts/ERC4626ReferralAdapterContract.js +41 -14
- package/dist/esm/plugins/adapters/contracts/FluidDexAdapterContract.js +29 -14
- package/dist/esm/plugins/adapters/contracts/InfinifiGatewayAdapterContract.js +47 -23
- package/dist/esm/plugins/adapters/contracts/InfinifiUnwindingGatewayAdapterContract.js +29 -15
- package/dist/esm/plugins/adapters/contracts/KelpLRTDepositPoolAdapterContract.js +27 -12
- package/dist/esm/plugins/adapters/contracts/KelpLRTWithdrawalManagerAdapterContract.js +31 -16
- package/dist/esm/plugins/adapters/contracts/LidoV1AdapterContract.js +41 -17
- package/dist/esm/plugins/adapters/contracts/MellowClaimerAdapterContract.js +23 -11
- package/dist/esm/plugins/adapters/contracts/MellowDVVAdapterContract.js +40 -14
- package/dist/esm/plugins/adapters/contracts/MellowERC4626VaultAdapterContract.js +74 -43
- package/dist/esm/plugins/adapters/contracts/MellowWrapperAdapterContract.js +23 -11
- package/dist/esm/plugins/adapters/contracts/MidasIssuanceVaultAdapterContract.js +38 -17
- package/dist/esm/plugins/adapters/contracts/MidasRedemptionVaultAdapterContract.js +44 -22
- package/dist/esm/plugins/adapters/contracts/PendleRouterAdapterContract.js +65 -53
- package/dist/esm/plugins/adapters/contracts/StakingRewardsAdapterContract.js +64 -37
- package/dist/esm/plugins/adapters/contracts/TraderJoeRouterAdapterContract.js +35 -25
- package/dist/esm/plugins/adapters/contracts/UniswapV2AdapterContract.js +36 -22
- package/dist/esm/plugins/adapters/contracts/UniswapV3AdapterContract.js +33 -24
- package/dist/esm/plugins/adapters/contracts/UniswapV4AdapterContract.js +45 -28
- package/dist/esm/plugins/adapters/contracts/UpshiftVaultAdapterContract.js +40 -18
- package/dist/esm/plugins/adapters/contracts/VelodromeV2AdapterContract.js +35 -25
- package/dist/esm/plugins/adapters/contracts/WstETHV1AdapterContract.js +33 -11
- package/dist/esm/plugins/adapters/contracts/deprecated/BalancerV2VaultAdapterContract.js +559 -0
- package/dist/esm/plugins/adapters/contracts/deprecated/EqualizerRouterAdapterContract.js +236 -0
- package/dist/esm/plugins/adapters/contracts/deprecated/InfraredVaultAdapterContract.js +272 -0
- package/dist/esm/plugins/adapters/contracts/deprecated/KodiakIslandGatewayAdapterContract.js +390 -0
- package/dist/esm/plugins/adapters/contracts/deprecated/MellowDepositQueueAdapterContract.js +52 -0
- package/dist/esm/plugins/adapters/contracts/deprecated/MellowRedeemQueueAdapterContract.js +45 -0
- package/dist/esm/plugins/adapters/contracts/deprecated/MellowVaultAdapterContract.js +209 -0
- package/dist/esm/plugins/adapters/contracts/deprecated/YearnV2AdapterContract.js +336 -0
- package/dist/esm/plugins/adapters/contracts/deprecated/index.js +8 -0
- package/dist/esm/plugins/adapters/contracts/index.js +1 -8
- package/dist/esm/plugins/adapters/contracts/types.js +0 -8
- package/dist/esm/plugins/adapters/createAdapter.js +158 -0
- package/dist/esm/plugins/adapters/index.js +3 -0
- package/dist/esm/plugins/adapters/legacyAdapterOperations.js +0 -0
- package/dist/esm/plugins/adapters/transferHelpers.js +95 -0
- package/dist/esm/sdk/accounts/AbstractCreditAccountsService.js +464 -105
- package/dist/esm/sdk/accounts/CreditAccountsServiceV300.js +9 -4
- package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +16 -5
- package/dist/esm/sdk/base/BaseContract.js +56 -3
- package/dist/esm/sdk/base/ChainContractsRegister.js +34 -1
- package/dist/esm/sdk/base/Construct.js +11 -3
- package/dist/esm/sdk/base/PlaceholderContract.js +2 -2
- package/dist/esm/sdk/base/TokensMeta.js +165 -21
- package/dist/esm/sdk/base/errors.js +11 -0
- package/dist/esm/sdk/base/index.js +1 -0
- package/dist/esm/sdk/chain/chains.js +2 -1
- package/dist/esm/sdk/market/MarketRegister.js +2 -2
- package/dist/esm/sdk/market/MarketSuite.js +3 -0
- package/dist/esm/sdk/{pools/extraZappers.js → market/ZapperRegister.js} +109 -2
- package/dist/esm/sdk/market/adapters/PlaceholderAdapterContracts.js +14 -5
- package/dist/esm/sdk/market/adapters/index.js +1 -1
- package/dist/esm/sdk/market/credit/CreditFacadeV310BaseContract.js +86 -0
- package/dist/esm/sdk/market/credit/CreditFacadeV310Contract.js +3 -43
- package/dist/esm/sdk/market/credit/index.js +1 -0
- package/dist/esm/sdk/market/index.js +1 -0
- package/dist/esm/sdk/market/pool/PoolSuite.js +3 -0
- package/dist/esm/sdk/market/pool/PoolV300Contract.js +3 -0
- package/dist/esm/sdk/market/pool/PoolV310Contract.js +17 -2
- package/dist/esm/sdk/market/pool/SecuritizeKYCFactory.js +73 -0
- package/dist/esm/sdk/market/pool/index.js +1 -0
- package/dist/esm/sdk/market/pricefeeds/PythPriceFeed.js +21 -1
- package/dist/esm/sdk/market/types.js +0 -0
- package/dist/esm/sdk/pools/PoolService.js +182 -98
- package/dist/esm/sdk/sdk-legacy/core/creditAccount.js +2 -0
- package/dist/esm/sdk/utils/AddressMap.js +1 -1
- package/dist/esm/sdk/utils/abi-decode.js +43 -2
- package/dist/esm/sdk/utils/viem/sendRawTx.js +19 -1
- package/dist/types/abi/310/iSecuritizeDegenNFT.d.ts +324 -0
- package/dist/types/abi/310/iSecuritizeKYCFactory.d.ts +322 -0
- package/dist/types/dev/providers.d.ts +5 -5
- package/dist/types/history/assembleOperations.d.ts +22 -0
- package/dist/types/history/classifyMulticallOperations.d.ts +35 -0
- package/dist/types/history/errors.d.ts +30 -0
- package/dist/types/history/extractProtocolCalls.d.ts +8 -0
- package/dist/types/history/extractTransfers.d.ts +22 -0
- package/dist/types/history/findFacadeCalls.d.ts +9 -0
- package/dist/types/history/index.d.ts +6 -0
- package/dist/types/history/inner-operations.d.ts +57 -0
- package/dist/types/history/internal-types.d.ts +47 -0
- package/dist/types/history/mapOperations.d.ts +27 -0
- package/dist/types/history/parseCreditAccountTransaction.d.ts +27 -0
- package/dist/types/history/populateContractsRegister.d.ts +19 -0
- package/dist/types/history/toLegacyOperation.d.ts +18 -0
- package/dist/types/history/trace-utils.d.ts +12 -0
- package/dist/types/history/types.d.ts +71 -0
- package/dist/types/plugins/adapters/abi/index.d.ts +1 -0
- package/dist/types/plugins/adapters/abi/targetContractAbi.d.ts +8262 -0
- package/dist/types/plugins/adapters/contracts/AbstractAdapter.d.ts +50 -8
- package/dist/types/plugins/adapters/contracts/AccountMigratorAdapterContract.d.ts +238 -4
- package/dist/types/plugins/adapters/contracts/BalancerV3RouterAdapterContract.d.ts +113 -4
- package/dist/types/plugins/adapters/contracts/BalancerV3WrapperAdapterContract.d.ts +37 -4
- package/dist/types/plugins/adapters/contracts/CamelotV3AdapterContract.d.ts +210 -4
- package/dist/types/plugins/adapters/contracts/ConvexV1BaseRewardPoolAdapterContract.d.ts +407 -8
- package/dist/types/plugins/adapters/contracts/ConvexV1BoosterAdapterContract.d.ts +208 -5
- package/dist/types/plugins/adapters/contracts/Curve2AssetsAdapterContract.d.ts +1244 -10
- package/dist/types/plugins/adapters/contracts/Curve3AssetsAdapterContract.d.ts +1244 -10
- package/dist/types/plugins/adapters/contracts/Curve4AssetsAdapterContract.d.ts +1244 -10
- package/dist/types/plugins/adapters/contracts/CurveV1AdapterDeposit.d.ts +575 -11
- package/dist/types/plugins/adapters/contracts/CurveV1AdapterStETHContract.d.ts +1244 -10
- package/dist/types/plugins/adapters/contracts/CurveV1StableNGAdapterContract.d.ts +1213 -11
- package/dist/types/plugins/adapters/contracts/DaiUsdsAdapterContract.d.ts +60 -6
- package/dist/types/plugins/adapters/contracts/ERC4626AdapterContract.d.ts +483 -6
- package/dist/types/plugins/adapters/contracts/ERC4626ReferralAdapterContract.d.ts +58 -6
- package/dist/types/plugins/adapters/contracts/FluidDexAdapterContract.d.ts +123 -6
- package/dist/types/plugins/adapters/contracts/InfinifiGatewayAdapterContract.d.ts +133 -8
- package/dist/types/plugins/adapters/contracts/InfinifiUnwindingGatewayAdapterContract.d.ts +155 -5
- package/dist/types/plugins/adapters/contracts/KelpLRTDepositPoolAdapterContract.d.ts +240 -6
- package/dist/types/plugins/adapters/contracts/KelpLRTWithdrawalManagerAdapterContract.d.ts +356 -6
- package/dist/types/plugins/adapters/contracts/LidoV1AdapterContract.d.ts +94 -7
- package/dist/types/plugins/adapters/contracts/MellowClaimerAdapterContract.d.ts +38 -5
- package/dist/types/plugins/adapters/contracts/MellowDVVAdapterContract.d.ts +479 -6
- package/dist/types/plugins/adapters/contracts/MellowERC4626VaultAdapterContract.d.ts +483 -7
- package/dist/types/plugins/adapters/contracts/MellowWrapperAdapterContract.d.ts +48 -5
- package/dist/types/plugins/adapters/contracts/MidasIssuanceVaultAdapterContract.d.ts +42 -7
- package/dist/types/plugins/adapters/contracts/MidasRedemptionVaultAdapterContract.d.ts +186 -7
- package/dist/types/plugins/adapters/contracts/PendleRouterAdapterContract.d.ts +1010 -5
- package/dist/types/plugins/adapters/contracts/StakingRewardsAdapterContract.d.ts +71 -8
- package/dist/types/plugins/adapters/contracts/TraderJoeRouterAdapterContract.d.ts +123 -4
- package/dist/types/plugins/adapters/contracts/UniswapV2AdapterContract.d.ts +747 -5
- package/dist/types/plugins/adapters/contracts/UniswapV3AdapterContract.d.ts +171 -4
- package/dist/types/plugins/adapters/contracts/UniswapV4AdapterContract.d.ts +96 -5
- package/dist/types/plugins/adapters/contracts/UpshiftVaultAdapterContract.d.ts +74 -7
- package/dist/types/plugins/adapters/contracts/VelodromeV2AdapterContract.d.ts +109 -4
- package/dist/types/plugins/adapters/contracts/WstETHV1AdapterContract.d.ts +267 -5
- package/dist/types/plugins/adapters/contracts/deprecated/BalancerV2VaultAdapterContract.d.ts +1664 -0
- package/dist/types/plugins/adapters/contracts/deprecated/EqualizerRouterAdapterContract.d.ts +611 -0
- package/dist/types/plugins/adapters/contracts/deprecated/InfraredVaultAdapterContract.d.ts +686 -0
- package/dist/types/plugins/adapters/contracts/deprecated/KodiakIslandGatewayAdapterContract.d.ts +1270 -0
- package/dist/types/plugins/adapters/contracts/deprecated/MellowDepositQueueAdapterContract.d.ts +19 -0
- package/dist/types/plugins/adapters/contracts/deprecated/MellowRedeemQueueAdapterContract.d.ts +18 -0
- package/dist/types/plugins/adapters/contracts/deprecated/MellowVaultAdapterContract.d.ts +531 -0
- package/dist/types/plugins/adapters/contracts/deprecated/YearnV2AdapterContract.d.ts +662 -0
- package/dist/types/plugins/adapters/contracts/deprecated/index.d.ts +8 -0
- package/dist/types/plugins/adapters/contracts/index.d.ts +1 -8
- package/dist/types/plugins/adapters/contracts/types.d.ts +0 -6
- package/dist/types/plugins/adapters/createAdapter.d.ts +7 -0
- package/dist/types/plugins/adapters/index.d.ts +3 -0
- package/dist/types/plugins/adapters/legacyAdapterOperations.d.ts +200 -0
- package/dist/types/plugins/adapters/transferHelpers.d.ts +60 -0
- package/dist/types/plugins/adapters/types.d.ts +59 -1
- package/dist/types/sdk/accounts/AbstractCreditAccountsService.d.ts +123 -27
- package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +1 -1
- package/dist/types/sdk/accounts/types.d.ts +108 -8
- package/dist/types/sdk/base/BaseContract.d.ts +15 -2
- package/dist/types/sdk/base/ChainContractsRegister.d.ts +11 -1
- package/dist/types/sdk/base/Construct.d.ts +6 -3
- package/dist/types/sdk/base/PlaceholderContract.d.ts +2 -2
- package/dist/types/sdk/base/TokensMeta.d.ts +30 -5
- package/dist/types/sdk/base/errors.d.ts +3 -0
- package/dist/types/sdk/base/index.d.ts +1 -0
- package/dist/types/sdk/base/token-types.d.ts +10 -2
- package/dist/types/sdk/base/types.d.ts +31 -0
- package/dist/types/sdk/chain/chains.d.ts +1 -1
- package/dist/types/sdk/market/MarketRegister.d.ts +2 -2
- package/dist/types/sdk/market/MarketSuite.d.ts +2 -0
- package/dist/types/sdk/market/ZapperRegister.d.ts +17 -0
- package/dist/types/sdk/market/adapters/PlaceholderAdapterContracts.d.ts +9 -4
- package/dist/types/sdk/market/adapters/index.d.ts +1 -1
- package/dist/types/sdk/market/credit/CreditFacadeV310BaseContract.d.ts +856 -0
- package/dist/types/sdk/market/credit/CreditFacadeV310Contract.d.ts +6 -848
- package/dist/types/sdk/market/credit/index.d.ts +1 -0
- package/dist/types/sdk/market/index.d.ts +1 -0
- package/dist/types/sdk/market/pool/PoolSuite.d.ts +2 -0
- package/dist/types/sdk/market/pool/PoolV300Contract.d.ts +2 -0
- package/dist/types/sdk/market/pool/PoolV310Contract.d.ts +6 -2
- package/dist/types/sdk/market/pool/SecuritizeKYCFactory.d.ts +345 -0
- package/dist/types/sdk/market/pool/index.d.ts +1 -0
- package/dist/types/sdk/market/pricefeeds/PythPriceFeed.d.ts +21 -1
- package/dist/types/sdk/market/types.d.ts +10 -0
- package/dist/types/sdk/pools/PoolService.d.ts +4 -4
- package/dist/types/sdk/pools/types.d.ts +25 -16
- package/dist/types/sdk/sdk-legacy/core/creditAccount.d.ts +1 -0
- package/dist/types/sdk/sdk-legacy/payload/creditAccount.d.ts +1 -0
- package/dist/types/sdk/utils/AddressMap.d.ts +1 -1
- package/dist/types/sdk/utils/abi-decode.d.ts +14 -1
- package/dist/types/sdk/utils/viem/sendRawTx.d.ts +5 -1
- package/package.json +16 -11
- package/dist/cjs/plugins/adapters/contracts/BalancerV2VaultAdapterContract.js +0 -51
- package/dist/cjs/plugins/adapters/contracts/EqualizerRouterAdapterContract.js +0 -58
- package/dist/cjs/plugins/adapters/contracts/InfraredVaultAdapterContract.js +0 -49
- package/dist/cjs/plugins/adapters/contracts/KodiakIslandGatewayAdapterContract.js +0 -56
- package/dist/cjs/plugins/adapters/contracts/MellowDepositQueueAdapterContract.js +0 -51
- package/dist/cjs/plugins/adapters/contracts/MellowVaultAdapterContract.js +0 -46
- package/dist/esm/plugins/adapters/contracts/BalancerV2VaultAdapterContract.js +0 -27
- package/dist/esm/plugins/adapters/contracts/EqualizerRouterAdapterContract.js +0 -34
- package/dist/esm/plugins/adapters/contracts/InfraredVaultAdapterContract.js +0 -25
- package/dist/esm/plugins/adapters/contracts/KodiakIslandGatewayAdapterContract.js +0 -32
- package/dist/esm/plugins/adapters/contracts/MellowDepositQueueAdapterContract.js +0 -27
- package/dist/esm/plugins/adapters/contracts/MellowRedeemQueueAdapterContract.js +0 -24
- package/dist/esm/plugins/adapters/contracts/MellowVaultAdapterContract.js +0 -22
- package/dist/esm/plugins/adapters/contracts/YearnV2AdapterContract.js +0 -22
- package/dist/types/plugins/adapters/contracts/BalancerV2VaultAdapterContract.d.ts +0 -482
- package/dist/types/plugins/adapters/contracts/EqualizerRouterAdapterContract.d.ts +0 -225
- package/dist/types/plugins/adapters/contracts/InfraredVaultAdapterContract.d.ts +0 -198
- package/dist/types/plugins/adapters/contracts/KodiakIslandGatewayAdapterContract.d.ts +0 -396
- package/dist/types/plugins/adapters/contracts/MellowDepositQueueAdapterContract.d.ts +0 -13
- package/dist/types/plugins/adapters/contracts/MellowRedeemQueueAdapterContract.d.ts +0 -12
- package/dist/types/plugins/adapters/contracts/MellowVaultAdapterContract.d.ts +0 -203
- package/dist/types/plugins/adapters/contracts/YearnV2AdapterContract.d.ts +0 -185
- package/dist/types/sdk/pools/extraZappers.d.ts +0 -9
- /package/dist/esm/sdk/market/adapters/{factory.js → createAdapter.js} +0 -0
- /package/dist/types/sdk/market/adapters/{factory.d.ts → createAdapter.d.ts} +0 -0
|
@@ -76,7 +76,7 @@ class CreditAccountServiceV300 extends import_AbstractCreditAccountsService.Abst
|
|
|
76
76
|
averageQuota
|
|
77
77
|
})
|
|
78
78
|
];
|
|
79
|
-
const tx =
|
|
79
|
+
const tx = await this.multicallTx(cm, creditAccount.creditAccount, calls);
|
|
80
80
|
return { tx, calls, creditFacade: cm.creditFacade };
|
|
81
81
|
}
|
|
82
82
|
/**
|
|
@@ -113,7 +113,12 @@ class CreditAccountServiceV300 extends import_AbstractCreditAccountsService.Abst
|
|
|
113
113
|
(t) => this.prepareWithdrawToken(ca.creditFacade, t.token, import_math.MAX_UINT256, to)
|
|
114
114
|
)
|
|
115
115
|
];
|
|
116
|
-
const tx =
|
|
116
|
+
const tx = await this.closeCreditAccountTx(
|
|
117
|
+
cm,
|
|
118
|
+
ca.creditAccount,
|
|
119
|
+
calls,
|
|
120
|
+
operation
|
|
121
|
+
);
|
|
117
122
|
return { tx, calls, creditFacade: cm.creditFacade };
|
|
118
123
|
}
|
|
119
124
|
/**
|
|
@@ -177,7 +182,7 @@ class CreditAccountServiceV300 extends import_AbstractCreditAccountsService.Abst
|
|
|
177
182
|
),
|
|
178
183
|
...this.prepareUpdateQuotas(ca.creditFacade, { minQuota, averageQuota })
|
|
179
184
|
];
|
|
180
|
-
const tx =
|
|
185
|
+
const tx = await this.multicallTx(cm, ca.creditAccount, calls);
|
|
181
186
|
return { tx, calls, creditFacade: cm.creditFacade };
|
|
182
187
|
}
|
|
183
188
|
async previewWithdrawLlamathenaProportionally({
|
|
@@ -269,7 +274,7 @@ class CreditAccountServiceV300 extends import_AbstractCreditAccountsService.Abst
|
|
|
269
274
|
averageQuota
|
|
270
275
|
})
|
|
271
276
|
];
|
|
272
|
-
const tx =
|
|
277
|
+
const tx = await this.multicallTx(cm, ca.creditAccount, calls);
|
|
273
278
|
return { tx, calls, creditFacade: cm.creditFacade };
|
|
274
279
|
}
|
|
275
280
|
/**
|
|
@@ -65,7 +65,7 @@ class CreditAccountServiceV310 extends import_AbstractCreditAccountsService.Abst
|
|
|
65
65
|
})
|
|
66
66
|
};
|
|
67
67
|
const calls = [...priceUpdatesCalls, addBotCall];
|
|
68
|
-
const tx = targetContract.type === "creditAccount" ?
|
|
68
|
+
const tx = targetContract.type === "creditAccount" ? await this.multicallTx(cm, targetContract.creditAccount, calls) : void 0;
|
|
69
69
|
return { tx, calls, creditFacade: cm.creditFacade };
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
@@ -100,7 +100,7 @@ class CreditAccountServiceV310 extends import_AbstractCreditAccountsService.Abst
|
|
|
100
100
|
averageQuota
|
|
101
101
|
})
|
|
102
102
|
];
|
|
103
|
-
const tx =
|
|
103
|
+
const tx = await this.multicallTx(cm, creditAccount.creditAccount, calls);
|
|
104
104
|
return { tx, calls, creditFacade: cm.creditFacade };
|
|
105
105
|
}
|
|
106
106
|
/**
|
|
@@ -113,11 +113,13 @@ class CreditAccountServiceV310 extends import_AbstractCreditAccountsService.Abst
|
|
|
113
113
|
creditAccount: ca,
|
|
114
114
|
permits,
|
|
115
115
|
to,
|
|
116
|
-
tokensToClaim
|
|
116
|
+
tokensToClaim,
|
|
117
|
+
calls: wrapCalls = []
|
|
117
118
|
}) {
|
|
118
119
|
const cm = this.sdk.marketRegister.findCreditManager(ca.creditManager);
|
|
119
120
|
const addCollateral = collateralAssets.filter((a) => a.balance > 0);
|
|
120
121
|
const router = this.sdk.routerFor(ca);
|
|
122
|
+
const unwrapCalls = await this.getRedeemDiffCalls(1n, ca.creditManager) ?? [];
|
|
121
123
|
const claimPath = await router.findClaimAllRewards({
|
|
122
124
|
calls: [],
|
|
123
125
|
tokensToClaim,
|
|
@@ -130,15 +132,22 @@ class CreditAccountServiceV310 extends import_AbstractCreditAccountsService.Abst
|
|
|
130
132
|
const calls = [
|
|
131
133
|
...operation === "close" ? [] : priceUpdates,
|
|
132
134
|
...this.prepareAddCollateral(ca.creditFacade, addCollateral, permits),
|
|
135
|
+
...wrapCalls,
|
|
133
136
|
...this.prepareDisableQuotas(ca),
|
|
134
137
|
...this.prepareDecreaseDebt(ca),
|
|
138
|
+
...unwrapCalls,
|
|
135
139
|
...claimPath.calls,
|
|
136
140
|
...this.prepareDisableTokens(ca),
|
|
137
141
|
...assetsToWithdraw.map(
|
|
138
142
|
(t) => this.prepareWithdrawToken(ca.creditFacade, t.token, import_math.MAX_UINT256, to)
|
|
139
143
|
)
|
|
140
144
|
];
|
|
141
|
-
const tx =
|
|
145
|
+
const tx = await this.closeCreditAccountTx(
|
|
146
|
+
cm,
|
|
147
|
+
ca.creditAccount,
|
|
148
|
+
calls,
|
|
149
|
+
operation
|
|
150
|
+
);
|
|
142
151
|
return { tx, calls, creditFacade: cm.creditFacade };
|
|
143
152
|
}
|
|
144
153
|
/**
|
|
@@ -163,11 +172,13 @@ class CreditAccountServiceV310 extends import_AbstractCreditAccountsService.Abst
|
|
|
163
172
|
creditManager: ca.creditManager,
|
|
164
173
|
creditAccount: ca
|
|
165
174
|
});
|
|
175
|
+
const wrapCalls = await this.getDepositDiffCalls(1n, ca.creditManager) ?? [];
|
|
166
176
|
const addCollateral = collateralAssets.filter((a) => a.balance > 0);
|
|
167
177
|
const calls = [
|
|
168
178
|
...priceUpdates,
|
|
169
179
|
...this.prepareAddCollateral(ca.creditFacade, addCollateral, permits),
|
|
170
180
|
...claimPath.calls,
|
|
181
|
+
...wrapCalls,
|
|
171
182
|
...assetsToWithdraw.map(
|
|
172
183
|
(t) => this.prepareWithdrawToken(ca.creditFacade, t.token, import_math.MAX_UINT256, to)
|
|
173
184
|
)
|
|
@@ -209,7 +220,7 @@ class CreditAccountServiceV310 extends import_AbstractCreditAccountsService.Abst
|
|
|
209
220
|
...claimPath.calls,
|
|
210
221
|
...this.prepareUpdateQuotas(ca.creditFacade, { minQuota, averageQuota })
|
|
211
222
|
];
|
|
212
|
-
const tx =
|
|
223
|
+
const tx = await this.multicallTx(cm, ca.creditAccount, calls);
|
|
213
224
|
return { tx, calls, creditFacade: cm.creditFacade };
|
|
214
225
|
}
|
|
215
226
|
async previewWithdrawLlamathenaProportionally(_) {
|
|
@@ -51,15 +51,15 @@ class BaseContract extends import_Construct.Construct {
|
|
|
51
51
|
version;
|
|
52
52
|
address;
|
|
53
53
|
name;
|
|
54
|
-
constructor(
|
|
55
|
-
super(
|
|
54
|
+
constructor(options, args) {
|
|
55
|
+
super(options);
|
|
56
56
|
this.abi = args.abi;
|
|
57
57
|
this.address = (0, import_viem.getAddress)(args.addr);
|
|
58
58
|
this.contract = (0, import_viem.getContract)({
|
|
59
59
|
address: this.address,
|
|
60
60
|
// add exceptions for better error decoding
|
|
61
61
|
abi: [...this.abi, ...import_errors.errorAbis],
|
|
62
|
-
client
|
|
62
|
+
client: this.client
|
|
63
63
|
});
|
|
64
64
|
this.version = Number(args.version || 0);
|
|
65
65
|
this.contractType = args.contractType ?? "";
|
|
@@ -207,6 +207,57 @@ class BaseContract extends import_Construct.Construct {
|
|
|
207
207
|
args
|
|
208
208
|
};
|
|
209
209
|
}
|
|
210
|
+
/**
|
|
211
|
+
* Parses calldata into structured result with preserved original types.
|
|
212
|
+
* When strict is true, throws {@link ContractParseError} on unknown selectors;
|
|
213
|
+
* otherwise returns a fallback with the raw calldata.
|
|
214
|
+
*/
|
|
215
|
+
parseFunctionDataV2(calldata, strict) {
|
|
216
|
+
try {
|
|
217
|
+
const decoded = (0, import_viem.decodeFunctionData)({
|
|
218
|
+
abi: this.abi,
|
|
219
|
+
data: calldata
|
|
220
|
+
});
|
|
221
|
+
const functionName = (0, import_utils.getFunctionSignature)(this.abi, calldata);
|
|
222
|
+
return this.wrapParseCallV2(
|
|
223
|
+
functionName,
|
|
224
|
+
this.parseFunctionParamsV2(decoded, strict)
|
|
225
|
+
);
|
|
226
|
+
} catch (e) {
|
|
227
|
+
if (strict) {
|
|
228
|
+
throw new ContractParseError(e, {
|
|
229
|
+
address: this.address,
|
|
230
|
+
callData: calldata,
|
|
231
|
+
contractName: this.name
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
this.logger?.warn(e);
|
|
235
|
+
const selector = calldata.slice(0, 10);
|
|
236
|
+
const data = `0x${calldata.slice(10)}`;
|
|
237
|
+
return this.wrapParseCallV2(`unknown function ${selector}`, {
|
|
238
|
+
_data: data
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Converts viem-decoded function arguments to a record preserving original types.
|
|
244
|
+
* Override in subclasses to handle nesting (e.g., multicall inner calls).
|
|
245
|
+
* @param strict - propagated from parseFunctionDataV2 for recursive parsing
|
|
246
|
+
*/
|
|
247
|
+
parseFunctionParamsV2(params, _strict) {
|
|
248
|
+
return (0, import_utils.functionArgsToRecord)(this.abi, params.functionName, params.args);
|
|
249
|
+
}
|
|
250
|
+
wrapParseCallV2(functionName, rawArgs) {
|
|
251
|
+
return {
|
|
252
|
+
chainId: this.chainId,
|
|
253
|
+
target: this.address,
|
|
254
|
+
contractType: this.contractType,
|
|
255
|
+
label: this.register.labelAddress(this.address, true),
|
|
256
|
+
version: this.version,
|
|
257
|
+
functionName,
|
|
258
|
+
rawArgs
|
|
259
|
+
};
|
|
260
|
+
}
|
|
210
261
|
/**
|
|
211
262
|
* Creates a raw transaction for a function in this contract
|
|
212
263
|
* @param parameters
|
|
@@ -48,7 +48,7 @@ class ChainContractsRegister {
|
|
|
48
48
|
logger;
|
|
49
49
|
constructor(client, logger) {
|
|
50
50
|
this.client = client;
|
|
51
|
-
this.tokensMeta = new import_TokensMeta.TokensMeta(client);
|
|
51
|
+
this.tokensMeta = new import_TokensMeta.TokensMeta(client, logger);
|
|
52
52
|
this.logger = logger;
|
|
53
53
|
}
|
|
54
54
|
resetContracts() {
|
|
@@ -136,6 +136,39 @@ class ChainContractsRegister {
|
|
|
136
136
|
(call) => this.parseFunctionData(call.target, call.callData)
|
|
137
137
|
);
|
|
138
138
|
}
|
|
139
|
+
/**
|
|
140
|
+
* Parses calldata for a contract at the given address, preserving original types.
|
|
141
|
+
* When strict is true, throws on unknown address or selector; otherwise returns a fallback.
|
|
142
|
+
*/
|
|
143
|
+
parseFunctionDataV2(address, calldata, strict) {
|
|
144
|
+
const contract = this.contracts.get(address);
|
|
145
|
+
if (contract) {
|
|
146
|
+
return contract.parseFunctionDataV2(calldata, strict);
|
|
147
|
+
}
|
|
148
|
+
if (strict) {
|
|
149
|
+
throw new Error(`contract ${address} not found on chain ${this.chainId}`);
|
|
150
|
+
}
|
|
151
|
+
const selector = calldata.slice(0, 10);
|
|
152
|
+
const data = `0x${calldata.slice(10)}`;
|
|
153
|
+
return {
|
|
154
|
+
chainId: this.chainId,
|
|
155
|
+
target: address,
|
|
156
|
+
contractType: "",
|
|
157
|
+
label: this.labelAddress(address, true),
|
|
158
|
+
version: 0,
|
|
159
|
+
functionName: `unknown function ${selector}`,
|
|
160
|
+
rawArgs: { _data: data }
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Parses multicalls preserving original types.
|
|
165
|
+
* When strict is true, throws on unknown targets or selectors.
|
|
166
|
+
*/
|
|
167
|
+
parseMultiCallV2(calls, strict) {
|
|
168
|
+
return calls.map(
|
|
169
|
+
(call) => this.parseFunctionDataV2(call.target, call.callData, strict)
|
|
170
|
+
);
|
|
171
|
+
}
|
|
139
172
|
}
|
|
140
173
|
// Annotate the CommonJS export names for ESM import in node:
|
|
141
174
|
0 && (module.exports = {
|
|
@@ -31,9 +31,17 @@ class Construct {
|
|
|
31
31
|
* Indicates that contract state needs to be updated
|
|
32
32
|
*/
|
|
33
33
|
#dirty = false;
|
|
34
|
-
constructor(
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
constructor(options) {
|
|
35
|
+
const { logger } = options;
|
|
36
|
+
if ("client" in options) {
|
|
37
|
+
const { client } = options;
|
|
38
|
+
this.client = client;
|
|
39
|
+
this.register = import_ChainContractsRegister.ChainContractsRegister.for(client, logger);
|
|
40
|
+
} else {
|
|
41
|
+
const { register } = options;
|
|
42
|
+
this.register = register;
|
|
43
|
+
this.client = register.client;
|
|
44
|
+
}
|
|
37
45
|
this.logger = (0, import_utils.childLogger)(
|
|
38
46
|
this.constructor.name,
|
|
39
47
|
this.register.logger ?? logger
|
|
@@ -24,8 +24,8 @@ module.exports = __toCommonJS(PlaceholderContract_exports);
|
|
|
24
24
|
var import_BaseContract = require("./BaseContract.js");
|
|
25
25
|
const abi = [];
|
|
26
26
|
class PlaceholderContract extends import_BaseContract.BaseContract {
|
|
27
|
-
constructor(
|
|
28
|
-
super(
|
|
27
|
+
constructor(options, args) {
|
|
28
|
+
super(options, { ...args, abi });
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -22,20 +22,34 @@ __export(TokensMeta_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(TokensMeta_exports);
|
|
24
24
|
var import_viem = require("viem");
|
|
25
|
+
var import_iSecuritizeKYCFactory = require("../../abi/310/iSecuritizeKYCFactory.js");
|
|
25
26
|
var import_iStateSerializer = require("../../abi/iStateSerializer.js");
|
|
26
27
|
var import_iVersion = require("../../abi/iVersion.js");
|
|
27
|
-
var import__ = require("../index.js");
|
|
28
28
|
var import_utils = require("../utils/index.js");
|
|
29
|
+
var import_token_types = require("./token-types.js");
|
|
29
30
|
class TokensMeta extends import_utils.AddressMap {
|
|
30
31
|
#client;
|
|
31
|
-
#tokenDataLoaded =
|
|
32
|
-
|
|
32
|
+
#tokenDataLoaded = new import_utils.AddressSet();
|
|
33
|
+
#logger;
|
|
34
|
+
constructor(client, logger) {
|
|
33
35
|
super(void 0, "tokensMeta");
|
|
34
36
|
this.#client = client;
|
|
37
|
+
this.#logger = logger?.child?.({ name: "TokensMeta" }) ?? logger;
|
|
35
38
|
}
|
|
36
39
|
reset() {
|
|
37
40
|
this.clear();
|
|
38
|
-
this.#tokenDataLoaded
|
|
41
|
+
this.#tokenDataLoaded.clear();
|
|
42
|
+
}
|
|
43
|
+
upsert(address, value) {
|
|
44
|
+
let v = value;
|
|
45
|
+
const existing = this.get(address);
|
|
46
|
+
if (existing && v) {
|
|
47
|
+
v = {
|
|
48
|
+
...existing,
|
|
49
|
+
...v
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
super.upsert(address, v);
|
|
39
53
|
}
|
|
40
54
|
symbol(token) {
|
|
41
55
|
return this.mustGet(token).symbol;
|
|
@@ -43,21 +57,48 @@ class TokensMeta extends import_utils.AddressMap {
|
|
|
43
57
|
decimals(token) {
|
|
44
58
|
return this.mustGet(token).decimals;
|
|
45
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Returns true if the token is a phantom token, throws if the token data is not loaded
|
|
62
|
+
* @param t
|
|
63
|
+
* @returns
|
|
64
|
+
*/
|
|
46
65
|
isPhantomToken(t) {
|
|
47
|
-
if (!this.#tokenDataLoaded) {
|
|
48
|
-
throw new Error(
|
|
66
|
+
if (!this.#tokenDataLoaded.has(t.addr)) {
|
|
67
|
+
throw new Error(
|
|
68
|
+
`extended token data not loaded for ${t.symbol} (${t.addr})`
|
|
69
|
+
);
|
|
49
70
|
}
|
|
50
|
-
return
|
|
71
|
+
return !!t.contractType?.startsWith("PHANTOM_TOKEN::");
|
|
51
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Returns true if the token is a KYC underlying token, throws if the token data is not loaded
|
|
75
|
+
* @param t
|
|
76
|
+
* @returns
|
|
77
|
+
*/
|
|
52
78
|
isKYCUnderlying(t) {
|
|
53
|
-
if (!this.#tokenDataLoaded) {
|
|
54
|
-
throw new Error(
|
|
79
|
+
if (!this.#tokenDataLoaded.has(t.addr)) {
|
|
80
|
+
throw new Error(
|
|
81
|
+
`extended token data not loaded for ${t.symbol} (${t.addr})`
|
|
82
|
+
);
|
|
55
83
|
}
|
|
56
|
-
return
|
|
84
|
+
return !!t.contractType?.startsWith("KYC_UNDERLYING::");
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Returns true if the token is a DSToken, throws if the token data is not loaded
|
|
88
|
+
* @param t
|
|
89
|
+
* @returns
|
|
90
|
+
*/
|
|
91
|
+
isDSToken(t) {
|
|
92
|
+
if (!this.#tokenDataLoaded.has(t.addr)) {
|
|
93
|
+
throw new Error(
|
|
94
|
+
`extended token data not loaded for ${t.symbol} (${t.addr})`
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
return !!t.isDSToken;
|
|
57
98
|
}
|
|
58
99
|
/**
|
|
59
100
|
* Returns a map of all phantom tokens
|
|
60
|
-
* Throws if
|
|
101
|
+
* Throws if token data is not loaded
|
|
61
102
|
*/
|
|
62
103
|
get phantomTokens() {
|
|
63
104
|
const result = new import_utils.AddressMap();
|
|
@@ -68,6 +109,10 @@ class TokensMeta extends import_utils.AddressMap {
|
|
|
68
109
|
}
|
|
69
110
|
return result;
|
|
70
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Returns a map of all KYC underlying tokens
|
|
114
|
+
* Throws if token data is not loaded
|
|
115
|
+
*/
|
|
71
116
|
get kycUnderlyings() {
|
|
72
117
|
const result = new import_utils.AddressMap();
|
|
73
118
|
for (const [token, meta] of this.entries()) {
|
|
@@ -77,6 +122,15 @@ class TokensMeta extends import_utils.AddressMap {
|
|
|
77
122
|
}
|
|
78
123
|
return result;
|
|
79
124
|
}
|
|
125
|
+
get dsTokens() {
|
|
126
|
+
const result = new import_utils.AddressMap();
|
|
127
|
+
for (const [token, meta] of this.entries()) {
|
|
128
|
+
if (this.isDSToken(meta)) {
|
|
129
|
+
result.upsert(token, meta);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return result;
|
|
133
|
+
}
|
|
80
134
|
formatBN(arg0, arg1, arg2) {
|
|
81
135
|
const token = typeof arg0 === "object" ? arg0.token : arg0;
|
|
82
136
|
const amount = typeof arg0 === "object" ? arg0.balance : arg1;
|
|
@@ -96,12 +150,18 @@ class TokensMeta extends import_utils.AddressMap {
|
|
|
96
150
|
return meta;
|
|
97
151
|
}
|
|
98
152
|
/**
|
|
99
|
-
* Loads token information about phantom
|
|
153
|
+
* Loads token information about phantom tokens, KYC underlying tokens and DSTokens
|
|
154
|
+
*
|
|
155
|
+
* @param tokens - tokens to load data for, defaults to all tokens
|
|
100
156
|
*/
|
|
101
|
-
async loadTokenData() {
|
|
102
|
-
const
|
|
157
|
+
async loadTokenData(...tokens) {
|
|
158
|
+
const tokenz = new import_utils.AddressSet(tokens.length > 0 ? tokens : this.keys());
|
|
159
|
+
const tokensToLoad = Array.from(tokenz.difference(this.#tokenDataLoaded));
|
|
160
|
+
if (tokensToLoad.length === 0) {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
103
163
|
const resp = await this.#client.multicall({
|
|
104
|
-
contracts:
|
|
164
|
+
contracts: tokensToLoad.flatMap(
|
|
105
165
|
(t) => [
|
|
106
166
|
{
|
|
107
167
|
address: t,
|
|
@@ -118,15 +178,26 @@ class TokensMeta extends import_utils.AddressMap {
|
|
|
118
178
|
allowFailure: true,
|
|
119
179
|
batchSize: 0
|
|
120
180
|
});
|
|
121
|
-
|
|
122
|
-
|
|
181
|
+
this.#logger?.debug(`loaded ${resp.length} contract types`);
|
|
182
|
+
const kycFactories = new import_utils.AddressSet();
|
|
183
|
+
for (let i = 0; i < tokensToLoad.length; i++) {
|
|
184
|
+
const meta = this.#overrideTokenMeta(
|
|
185
|
+
tokensToLoad[i],
|
|
186
|
+
resp[2 * i],
|
|
187
|
+
resp[2 * i + 1]
|
|
188
|
+
);
|
|
189
|
+
this.#tokenDataLoaded.add(tokensToLoad[i]);
|
|
190
|
+
if (this.isKYCUnderlying(meta)) {
|
|
191
|
+
kycFactories.add(meta.kycFactory);
|
|
192
|
+
}
|
|
123
193
|
}
|
|
124
|
-
this.#
|
|
194
|
+
this.#logger?.debug(`found ${kycFactories.size} KYC factories`);
|
|
195
|
+
await this.#loadDSTokens(kycFactories);
|
|
125
196
|
}
|
|
126
197
|
#overrideTokenMeta(token, contractTypeResp, serializeResp) {
|
|
127
198
|
const meta = this.mustGet(token);
|
|
128
199
|
if (contractTypeResp.status === "success") {
|
|
129
|
-
const contractType = (0,
|
|
200
|
+
const contractType = (0, import_utils.bytes32ToString)(contractTypeResp.result);
|
|
130
201
|
if (contractType.startsWith("KYC_UNDERLYING::")) {
|
|
131
202
|
if (serializeResp.status === "success") {
|
|
132
203
|
this.#overrideKYCUnderlying(meta, contractType, serializeResp.result);
|
|
@@ -135,16 +206,18 @@ class TokensMeta extends import_utils.AddressMap {
|
|
|
135
206
|
`token ${meta.symbol} (${token}) is ${contractType} but serialize failed: ${serializeResp.error}`
|
|
136
207
|
);
|
|
137
208
|
}
|
|
138
|
-
} else
|
|
209
|
+
} else {
|
|
139
210
|
this.upsert(token, {
|
|
140
211
|
...meta,
|
|
141
212
|
contractType
|
|
142
213
|
});
|
|
143
214
|
}
|
|
215
|
+
this.#logger?.debug(`token ${meta.symbol} is ${contractType}`);
|
|
144
216
|
}
|
|
217
|
+
return this.mustGet(token);
|
|
145
218
|
}
|
|
146
219
|
#overrideKYCUnderlying(meta, contractType, serialized) {
|
|
147
|
-
if (contractType ===
|
|
220
|
+
if (contractType === import_token_types.KYC_UNDERLYING_DEFAULT) {
|
|
148
221
|
const decoded = (0, import_viem.decodeAbiParameters)(
|
|
149
222
|
[
|
|
150
223
|
{ type: "address", name: "kycFactory" },
|
|
@@ -158,7 +231,7 @@ class TokensMeta extends import_utils.AddressMap {
|
|
|
158
231
|
kycFactory: decoded[0],
|
|
159
232
|
asset: decoded[1]
|
|
160
233
|
});
|
|
161
|
-
} else if (contractType ===
|
|
234
|
+
} else if (contractType === import_token_types.KYC_UNDERLYING_ON_DEMAND) {
|
|
162
235
|
const decoded = (0, import_viem.decodeAbiParameters)(
|
|
163
236
|
[
|
|
164
237
|
{ type: "address", name: "kycFactory" },
|
|
@@ -178,6 +251,72 @@ class TokensMeta extends import_utils.AddressMap {
|
|
|
178
251
|
});
|
|
179
252
|
}
|
|
180
253
|
}
|
|
254
|
+
async #loadDSTokens(kycFactories) {
|
|
255
|
+
const resp = await this.#client.multicall({
|
|
256
|
+
contracts: kycFactories.map((address) => ({
|
|
257
|
+
address,
|
|
258
|
+
abi: import_iSecuritizeKYCFactory.iSecuritizeKYCFactoryAbi,
|
|
259
|
+
functionName: "getDSTokens"
|
|
260
|
+
})),
|
|
261
|
+
allowFailure: false,
|
|
262
|
+
batchSize: 0
|
|
263
|
+
});
|
|
264
|
+
const dsToken = new import_utils.AddressSet(resp.flat());
|
|
265
|
+
const tokensToLoad = dsToken.difference(new Set(this.keys()));
|
|
266
|
+
this.#logger?.debug(
|
|
267
|
+
`found ${dsToken.size} DSTokens in KYC factories, need to load ${tokensToLoad.size} basic metadata`
|
|
268
|
+
);
|
|
269
|
+
await this.#loadWithoutCompressor(tokensToLoad);
|
|
270
|
+
for (const token of dsToken) {
|
|
271
|
+
const meta = this.mustGet(token);
|
|
272
|
+
this.upsert(token, {
|
|
273
|
+
...meta,
|
|
274
|
+
isDSToken: true
|
|
275
|
+
});
|
|
276
|
+
this.#tokenDataLoaded.add(token);
|
|
277
|
+
this.#logger?.debug(`token ${meta.symbol} (${token}) is a DSToken`);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
async #loadWithoutCompressor(tokens_) {
|
|
281
|
+
if (tokens_.size === 0) {
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
const tokens = Array.from(tokens_);
|
|
285
|
+
const resp = await this.#client.multicall({
|
|
286
|
+
contracts: tokens.flatMap(
|
|
287
|
+
(t) => [
|
|
288
|
+
{
|
|
289
|
+
address: t,
|
|
290
|
+
abi: import_viem.erc20Abi,
|
|
291
|
+
functionName: "symbol"
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
address: t,
|
|
295
|
+
abi: import_viem.erc20Abi,
|
|
296
|
+
functionName: "name"
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
address: t,
|
|
300
|
+
abi: import_viem.erc20Abi,
|
|
301
|
+
functionName: "decimals"
|
|
302
|
+
}
|
|
303
|
+
]
|
|
304
|
+
),
|
|
305
|
+
allowFailure: false,
|
|
306
|
+
batchSize: 0
|
|
307
|
+
});
|
|
308
|
+
this.#logger?.debug(
|
|
309
|
+
`loaded ${resp.length} basic metadata without compressor`
|
|
310
|
+
);
|
|
311
|
+
for (let i = 0; i < tokens.length; i++) {
|
|
312
|
+
this.upsert(tokens[i], {
|
|
313
|
+
addr: tokens[i],
|
|
314
|
+
symbol: resp[3 * i],
|
|
315
|
+
name: resp[3 * i + 1],
|
|
316
|
+
decimals: resp[3 * i + 2]
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
}
|
|
181
320
|
}
|
|
182
321
|
// Annotate the CommonJS export names for ESM import in node:
|
|
183
322
|
0 && (module.exports = {
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var errors_exports = {};
|
|
20
|
+
__export(errors_exports, {
|
|
21
|
+
MissingSerializedParamsError: () => MissingSerializedParamsError
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(errors_exports);
|
|
24
|
+
class MissingSerializedParamsError extends Error {
|
|
25
|
+
constructor(propertyName) {
|
|
26
|
+
super(
|
|
27
|
+
`Cannot access '${propertyName}': serializedParams were not provided`
|
|
28
|
+
);
|
|
29
|
+
this.name = "MissingSerializedParamsError";
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
33
|
+
0 && (module.exports = {
|
|
34
|
+
MissingSerializedParamsError
|
|
35
|
+
});
|
|
@@ -18,6 +18,7 @@ module.exports = __toCommonJS(base_exports);
|
|
|
18
18
|
__reExport(base_exports, require("./BaseContract.js"), module.exports);
|
|
19
19
|
__reExport(base_exports, require("./ChainContractsRegister.js"), module.exports);
|
|
20
20
|
__reExport(base_exports, require("./Construct.js"), module.exports);
|
|
21
|
+
__reExport(base_exports, require("./errors.js"), module.exports);
|
|
21
22
|
__reExport(base_exports, require("./PlaceholderContract.js"), module.exports);
|
|
22
23
|
__reExport(base_exports, require("./SDKConstruct.js"), module.exports);
|
|
23
24
|
__reExport(base_exports, require("./TokensMeta.js"), module.exports);
|
|
@@ -28,6 +29,7 @@ __reExport(base_exports, require("./types.js"), module.exports);
|
|
|
28
29
|
...require("./BaseContract.js"),
|
|
29
30
|
...require("./ChainContractsRegister.js"),
|
|
30
31
|
...require("./Construct.js"),
|
|
32
|
+
...require("./errors.js"),
|
|
31
33
|
...require("./PlaceholderContract.js"),
|
|
32
34
|
...require("./SDKConstruct.js"),
|
|
33
35
|
...require("./TokensMeta.js"),
|
|
@@ -81,7 +81,8 @@ const chains = {
|
|
|
81
81
|
"0x601067eba24bb5b558a184fc082525637e96a42d": "Gami Labs"
|
|
82
82
|
},
|
|
83
83
|
testMarketConfigurators: {
|
|
84
|
-
"0x99df7330bf42d596af2e9d9836d4fc2077c574aa": "M11 Credit"
|
|
84
|
+
"0x99df7330bf42d596af2e9d9836d4fc2077c574aa": "M11 Credit",
|
|
85
|
+
"0xE0527dE5908B3fc2e054B7eEE0DeF6c9965AbF24": "Securitize"
|
|
85
86
|
},
|
|
86
87
|
isPublic: true,
|
|
87
88
|
wellKnownToken: {
|
|
@@ -22,13 +22,13 @@ __export(MarketRegister_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(MarketRegister_exports);
|
|
24
24
|
var import_marketCompressor = require("../../abi/compressors/marketCompressor.js");
|
|
25
|
-
var import_base = require("../base/index.js");
|
|
26
25
|
var import_constants = require("../constants/index.js");
|
|
27
26
|
var import_utils = require("../utils/index.js");
|
|
28
27
|
var import_viem = require("../utils/viem/index.js");
|
|
29
28
|
var import_MarketConfiguratorContract = require("./MarketConfiguratorContract.js");
|
|
30
29
|
var import_MarketSuite = require("./MarketSuite.js");
|
|
31
|
-
|
|
30
|
+
var import_ZapperRegister = require("./ZapperRegister.js");
|
|
31
|
+
class MarketRegister extends import_ZapperRegister.ZapperRegister {
|
|
32
32
|
/**
|
|
33
33
|
* Mapping pool.address -> MarketSuite
|
|
34
34
|
*/
|
|
@@ -65,6 +65,9 @@ class MarketSuite extends import_base.SDKConstruct {
|
|
|
65
65
|
get underlying() {
|
|
66
66
|
return this.pool.underlying;
|
|
67
67
|
}
|
|
68
|
+
async getKYCFactory() {
|
|
69
|
+
return this.pool.getKYCFactory();
|
|
70
|
+
}
|
|
68
71
|
get dirty() {
|
|
69
72
|
return this.configurator.dirty || this.pool.dirty || this.priceOracle.dirty || this.creditManagers.some((cm) => cm.dirty);
|
|
70
73
|
}
|