@gearbox-protocol/sdk 12.8.1 → 12.9.0-txparser.2
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/dev/providers.js +0 -12
- package/dist/cjs/history/assembleOperations.js +110 -0
- package/dist/cjs/history/classifyMulticallOperations.js +157 -0
- package/dist/cjs/history/enrichTokens.js +80 -0
- package/dist/cjs/history/errors.js +91 -0
- package/dist/cjs/history/extractProtocolCalls.js +53 -0
- package/dist/cjs/history/extractTransfers.js +166 -0
- package/dist/cjs/history/findFacadeCalls.js +84 -0
- package/dist/cjs/history/index.js +38 -0
- package/dist/cjs/history/inner-operations.js +16 -0
- package/dist/cjs/history/internal-types.js +16 -0
- package/dist/cjs/history/package.json +1 -0
- package/dist/cjs/history/parseCreditAccountTransaction.js +83 -0
- package/dist/cjs/history/populateContractsRegister.js +68 -0
- package/dist/cjs/history/toLegacyOperation.js +120 -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/base/BaseContract.js +51 -0
- package/dist/cjs/sdk/base/ChainContractsRegister.js +33 -0
- package/dist/cjs/sdk/base/PlaceholderContract.js +2 -2
- package/dist/cjs/sdk/base/TokensMeta.js +1 -2
- package/dist/cjs/sdk/base/errors.js +35 -0
- package/dist/cjs/sdk/base/index.js +2 -0
- 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/utils/abi-decode.js +43 -2
- package/dist/esm/dev/providers.js +0 -12
- package/dist/esm/history/assembleOperations.js +86 -0
- package/dist/esm/history/classifyMulticallOperations.js +137 -0
- package/dist/esm/history/enrichTokens.js +56 -0
- package/dist/esm/history/errors.js +62 -0
- package/dist/esm/history/extractProtocolCalls.js +32 -0
- package/dist/esm/history/extractTransfers.js +146 -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/package.json +1 -0
- package/dist/esm/history/parseCreditAccountTransaction.js +59 -0
- package/dist/esm/history/populateContractsRegister.js +52 -0
- package/dist/esm/history/toLegacyOperation.js +96 -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/base/BaseContract.js +53 -0
- package/dist/esm/sdk/base/ChainContractsRegister.js +33 -0
- package/dist/esm/sdk/base/PlaceholderContract.js +2 -2
- package/dist/esm/sdk/base/TokensMeta.js +6 -2
- package/dist/esm/sdk/base/errors.js +11 -0
- package/dist/esm/sdk/base/index.js +1 -0
- 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/utils/abi-decode.js +43 -2
- package/dist/types/dev/providers.d.ts +5 -5
- package/dist/types/history/assembleOperations.d.ts +24 -0
- package/dist/types/history/classifyMulticallOperations.d.ts +35 -0
- package/dist/types/history/enrichTokens.d.ts +5 -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/parseCreditAccountTransaction.d.ts +29 -0
- package/dist/types/history/populateContractsRegister.d.ts +19 -0
- package/dist/types/history/toLegacyOperation.d.ts +35 -0
- package/dist/types/history/trace-utils.d.ts +12 -0
- package/dist/types/history/types.d.ts +65 -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 +64 -1
- package/dist/types/sdk/base/BaseContract.d.ts +14 -1
- package/dist/types/sdk/base/ChainContractsRegister.d.ts +11 -1
- package/dist/types/sdk/base/PlaceholderContract.d.ts +2 -2
- package/dist/types/sdk/base/TokensMeta.d.ts +1 -1
- 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/types.d.ts +31 -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/utils/abi-decode.d.ts +14 -1
- package/package.json +7 -2
- 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/esm/sdk/market/adapters/{factory.js → createAdapter.js} +0 -0
- /package/dist/types/sdk/market/adapters/{factory.d.ts → createAdapter.d.ts} +0 -0
|
@@ -11,6 +11,8 @@ import {
|
|
|
11
11
|
bytes32ToString,
|
|
12
12
|
createRawTx,
|
|
13
13
|
functionArgsToMap,
|
|
14
|
+
functionArgsToRecord,
|
|
15
|
+
getFunctionSignature,
|
|
14
16
|
json_stringify
|
|
15
17
|
} from "../utils/index.js";
|
|
16
18
|
import { Construct } from "./Construct.js";
|
|
@@ -195,6 +197,57 @@ class BaseContract extends Construct {
|
|
|
195
197
|
args
|
|
196
198
|
};
|
|
197
199
|
}
|
|
200
|
+
/**
|
|
201
|
+
* Parses calldata into structured result with preserved original types.
|
|
202
|
+
* When strict is true, throws {@link ContractParseError} on unknown selectors;
|
|
203
|
+
* otherwise returns a fallback with the raw calldata.
|
|
204
|
+
*/
|
|
205
|
+
parseFunctionDataV2(calldata, strict) {
|
|
206
|
+
try {
|
|
207
|
+
const decoded = decodeFunctionData({
|
|
208
|
+
abi: this.abi,
|
|
209
|
+
data: calldata
|
|
210
|
+
});
|
|
211
|
+
const functionName = getFunctionSignature(this.abi, calldata);
|
|
212
|
+
return this.wrapParseCallV2(
|
|
213
|
+
functionName,
|
|
214
|
+
this.parseFunctionParamsV2(decoded, strict)
|
|
215
|
+
);
|
|
216
|
+
} catch (e) {
|
|
217
|
+
if (strict) {
|
|
218
|
+
throw new ContractParseError(e, {
|
|
219
|
+
address: this.address,
|
|
220
|
+
callData: calldata,
|
|
221
|
+
contractName: this.name
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
this.logger?.warn(e);
|
|
225
|
+
const selector = calldata.slice(0, 10);
|
|
226
|
+
const data = `0x${calldata.slice(10)}`;
|
|
227
|
+
return this.wrapParseCallV2(`unknown function ${selector}`, {
|
|
228
|
+
_data: data
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Converts viem-decoded function arguments to a record preserving original types.
|
|
234
|
+
* Override in subclasses to handle nesting (e.g., multicall inner calls).
|
|
235
|
+
* @param strict - propagated from parseFunctionDataV2 for recursive parsing
|
|
236
|
+
*/
|
|
237
|
+
parseFunctionParamsV2(params, _strict) {
|
|
238
|
+
return functionArgsToRecord(this.abi, params.functionName, params.args);
|
|
239
|
+
}
|
|
240
|
+
wrapParseCallV2(functionName, rawArgs) {
|
|
241
|
+
return {
|
|
242
|
+
chainId: this.chainId,
|
|
243
|
+
target: this.address,
|
|
244
|
+
contractType: this.contractType,
|
|
245
|
+
label: this.register.labelAddress(this.address, true),
|
|
246
|
+
version: this.version,
|
|
247
|
+
functionName,
|
|
248
|
+
rawArgs
|
|
249
|
+
};
|
|
250
|
+
}
|
|
198
251
|
/**
|
|
199
252
|
* Creates a raw transaction for a function in this contract
|
|
200
253
|
* @param parameters
|
|
@@ -113,6 +113,39 @@ class ChainContractsRegister {
|
|
|
113
113
|
(call) => this.parseFunctionData(call.target, call.callData)
|
|
114
114
|
);
|
|
115
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* Parses calldata for a contract at the given address, preserving original types.
|
|
118
|
+
* When strict is true, throws on unknown address or selector; otherwise returns a fallback.
|
|
119
|
+
*/
|
|
120
|
+
parseFunctionDataV2(address, calldata, strict) {
|
|
121
|
+
const contract = this.contracts.get(address);
|
|
122
|
+
if (contract) {
|
|
123
|
+
return contract.parseFunctionDataV2(calldata, strict);
|
|
124
|
+
}
|
|
125
|
+
if (strict) {
|
|
126
|
+
throw new Error(`contract ${address} not found on chain ${this.chainId}`);
|
|
127
|
+
}
|
|
128
|
+
const selector = calldata.slice(0, 10);
|
|
129
|
+
const data = `0x${calldata.slice(10)}`;
|
|
130
|
+
return {
|
|
131
|
+
chainId: this.chainId,
|
|
132
|
+
target: address,
|
|
133
|
+
contractType: "",
|
|
134
|
+
label: this.labelAddress(address, true),
|
|
135
|
+
version: 0,
|
|
136
|
+
functionName: `unknown function ${selector}`,
|
|
137
|
+
rawArgs: { _data: data }
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Parses multicalls preserving original types.
|
|
142
|
+
* When strict is true, throws on unknown targets or selectors.
|
|
143
|
+
*/
|
|
144
|
+
parseMultiCallV2(calls, strict) {
|
|
145
|
+
return calls.map(
|
|
146
|
+
(call) => this.parseFunctionDataV2(call.target, call.callData, strict)
|
|
147
|
+
);
|
|
148
|
+
}
|
|
116
149
|
}
|
|
117
150
|
export {
|
|
118
151
|
ChainContractsRegister
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BaseContract } from "./BaseContract.js";
|
|
2
2
|
const abi = [];
|
|
3
3
|
class PlaceholderContract extends BaseContract {
|
|
4
|
-
constructor(
|
|
5
|
-
super(
|
|
4
|
+
constructor(options, args) {
|
|
5
|
+
super(options, { ...args, abi });
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
8
|
export {
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { iVersionAbi } from "../../abi/iVersion.js";
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import {
|
|
3
|
+
AddressMap,
|
|
4
|
+
AddressSet,
|
|
5
|
+
bytes32ToString,
|
|
6
|
+
formatBN
|
|
7
|
+
} from "../utils/index.js";
|
|
4
8
|
class TokensMeta extends AddressMap {
|
|
5
9
|
#client;
|
|
6
10
|
#phantomTokensLoaded;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
class MissingSerializedParamsError extends Error {
|
|
2
|
+
constructor(propertyName) {
|
|
3
|
+
super(
|
|
4
|
+
`Cannot access '${propertyName}': serializedParams were not provided`
|
|
5
|
+
);
|
|
6
|
+
this.name = "MissingSerializedParamsError";
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
MissingSerializedParamsError
|
|
11
|
+
};
|
|
@@ -1,9 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
MissingSerializedParamsError,
|
|
3
|
+
PlaceholderContract
|
|
4
|
+
} from "../../base/index.js";
|
|
2
5
|
class PlaceholderAdapterContract extends PlaceholderContract {
|
|
3
|
-
targetContract;
|
|
4
|
-
constructor(
|
|
5
|
-
super(
|
|
6
|
-
this
|
|
6
|
+
#targetContract;
|
|
7
|
+
constructor(options, args) {
|
|
8
|
+
super(options, args.baseParams);
|
|
9
|
+
this.#targetContract = args.targetContract;
|
|
10
|
+
}
|
|
11
|
+
get targetContract() {
|
|
12
|
+
if (!this.#targetContract) {
|
|
13
|
+
throw new MissingSerializedParamsError("targetContract");
|
|
14
|
+
}
|
|
15
|
+
return this.#targetContract;
|
|
7
16
|
}
|
|
8
17
|
}
|
|
9
18
|
export {
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import {
|
|
2
|
+
iCreditFacadeMulticallV310Abi,
|
|
3
|
+
iCreditFacadeV310Abi
|
|
4
|
+
} from "../../../abi/310/generated.js";
|
|
5
|
+
import { iPausableAbi } from "../../../abi/iPausable.js";
|
|
6
|
+
import { BaseContract } from "../../base/index.js";
|
|
7
|
+
const abi = [
|
|
8
|
+
...iCreditFacadeV310Abi,
|
|
9
|
+
...iCreditFacadeMulticallV310Abi,
|
|
10
|
+
...iPausableAbi
|
|
11
|
+
];
|
|
12
|
+
class CreditFacadeV310BaseContract extends BaseContract {
|
|
13
|
+
constructor(options, args) {
|
|
14
|
+
super(options, { ...args, abi });
|
|
15
|
+
}
|
|
16
|
+
parseFunctionParamsV2(params, strict) {
|
|
17
|
+
switch (params.functionName) {
|
|
18
|
+
case "openCreditAccount": {
|
|
19
|
+
const [onBehalfOf, calls, referralCode] = params.args;
|
|
20
|
+
return {
|
|
21
|
+
onBehalfOf,
|
|
22
|
+
calls: this.register.parseMultiCallV2([...calls], strict),
|
|
23
|
+
referralCode
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
case "closeCreditAccount": {
|
|
27
|
+
const [creditAccount, calls] = params.args;
|
|
28
|
+
return {
|
|
29
|
+
creditAccount,
|
|
30
|
+
calls: this.register.parseMultiCallV2([...calls], strict)
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
case "botMulticall":
|
|
34
|
+
case "multicall": {
|
|
35
|
+
const [creditAccount, calls] = params.args;
|
|
36
|
+
return {
|
|
37
|
+
creditAccount,
|
|
38
|
+
calls: this.register.parseMultiCallV2([...calls], strict)
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
case "liquidateCreditAccount": {
|
|
42
|
+
const [creditAccount, to, calls] = params.args;
|
|
43
|
+
return {
|
|
44
|
+
creditAccount,
|
|
45
|
+
to,
|
|
46
|
+
calls: this.register.parseMultiCallV2([...calls], strict)
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
default:
|
|
50
|
+
return super.parseFunctionParamsV2(params, strict);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
stringifyFunctionParams(params) {
|
|
54
|
+
switch (params.functionName) {
|
|
55
|
+
case "openCreditAccount": {
|
|
56
|
+
const [onBehalfOf, calls, referralCode] = params.args;
|
|
57
|
+
return [
|
|
58
|
+
this.labelAddress(onBehalfOf),
|
|
59
|
+
this.register.parseMultiCall([...calls]).join(","),
|
|
60
|
+
`${referralCode}`
|
|
61
|
+
];
|
|
62
|
+
}
|
|
63
|
+
case "closeCreditAccount": {
|
|
64
|
+
const [creditAccount, calls] = params.args;
|
|
65
|
+
return [
|
|
66
|
+
this.labelAddress(creditAccount),
|
|
67
|
+
this.register.parseMultiCall([...calls]).join(",")
|
|
68
|
+
];
|
|
69
|
+
}
|
|
70
|
+
case "liquidateCreditAccount": {
|
|
71
|
+
const [creditAccount, to, calls] = params.args;
|
|
72
|
+
return [
|
|
73
|
+
this.labelAddress(creditAccount),
|
|
74
|
+
this.labelAddress(to),
|
|
75
|
+
this.register.parseMultiCall([...calls]).join(",")
|
|
76
|
+
];
|
|
77
|
+
}
|
|
78
|
+
default:
|
|
79
|
+
return super.stringifyFunctionParams(params);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
export {
|
|
84
|
+
CreditFacadeV310BaseContract,
|
|
85
|
+
abi as creditFacadeV310Abi
|
|
86
|
+
};
|
|
@@ -1,28 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
iCreditFacadeMulticallV310Abi,
|
|
3
|
-
iCreditFacadeV310Abi
|
|
4
|
-
} from "../../../abi/310/generated.js";
|
|
5
|
-
import { iPausableAbi } from "../../../abi/iPausable.js";
|
|
6
|
-
import { BaseContract } from "../../base/index.js";
|
|
7
1
|
import { ADDRESS_0X0 } from "../../constants/index.js";
|
|
8
2
|
import {
|
|
9
3
|
fmtBinaryMask,
|
|
10
4
|
formatBNvalue,
|
|
11
5
|
formatTimestamp
|
|
12
6
|
} from "../../utils/index.js";
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
...iCreditFacadeMulticallV310Abi,
|
|
16
|
-
...iPausableAbi
|
|
17
|
-
];
|
|
18
|
-
class CreditFacadeV310Contract extends BaseContract {
|
|
7
|
+
import { CreditFacadeV310BaseContract } from "./CreditFacadeV310BaseContract.js";
|
|
8
|
+
class CreditFacadeV310Contract extends CreditFacadeV310BaseContract {
|
|
19
9
|
underlying;
|
|
20
10
|
constructor(options, { creditFacade, creditManager }) {
|
|
21
11
|
const { baseParams, ...rest } = creditFacade;
|
|
22
12
|
super(options, {
|
|
23
13
|
...baseParams,
|
|
24
|
-
name: `CreditFacadeV310(${creditManager.name})
|
|
25
|
-
abi
|
|
14
|
+
name: `CreditFacadeV310(${creditManager.name})`
|
|
26
15
|
});
|
|
27
16
|
Object.assign(this, rest);
|
|
28
17
|
this.underlying = creditManager.underlying;
|
|
@@ -89,35 +78,6 @@ class CreditFacadeV310Contract extends BaseContract {
|
|
|
89
78
|
args: [to, calls, referralCode]
|
|
90
79
|
});
|
|
91
80
|
}
|
|
92
|
-
stringifyFunctionParams(params) {
|
|
93
|
-
switch (params.functionName) {
|
|
94
|
-
case "openCreditAccount": {
|
|
95
|
-
const [onBehalfOf, calls, referralCode] = params.args;
|
|
96
|
-
return [
|
|
97
|
-
this.labelAddress(onBehalfOf),
|
|
98
|
-
this.register.parseMultiCall([...calls]).join(","),
|
|
99
|
-
`${referralCode}`
|
|
100
|
-
];
|
|
101
|
-
}
|
|
102
|
-
case "closeCreditAccount": {
|
|
103
|
-
const [creditAccount, calls] = params.args;
|
|
104
|
-
return [
|
|
105
|
-
this.labelAddress(creditAccount),
|
|
106
|
-
this.register.parseMultiCall([...calls]).join(",")
|
|
107
|
-
];
|
|
108
|
-
}
|
|
109
|
-
case "liquidateCreditAccount": {
|
|
110
|
-
const [creditAccount, to, calls] = params.args;
|
|
111
|
-
return [
|
|
112
|
-
this.labelAddress(creditAccount),
|
|
113
|
-
this.labelAddress(to),
|
|
114
|
-
this.register.parseMultiCall([...calls]).join(",")
|
|
115
|
-
];
|
|
116
|
-
}
|
|
117
|
-
default:
|
|
118
|
-
return super.stringifyFunctionParams(params);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
81
|
}
|
|
122
82
|
export {
|
|
123
83
|
CreditFacadeV310Contract
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from "./CreditConfiguratorV300Contract.js";
|
|
2
2
|
export * from "./CreditConfiguratorV310Contract.js";
|
|
3
3
|
export * from "./CreditFacadeV300Contract.js";
|
|
4
|
+
export * from "./CreditFacadeV310BaseContract.js";
|
|
4
5
|
export * from "./CreditFacadeV310Contract.js";
|
|
5
6
|
export * from "./CreditManagerV300Contract.js";
|
|
6
7
|
export * from "./CreditManagerV310Contract.js";
|
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AbiFunctionNotFoundError,
|
|
3
|
-
getAbiItem
|
|
3
|
+
getAbiItem,
|
|
4
|
+
toFunctionSelector,
|
|
5
|
+
toFunctionSignature
|
|
4
6
|
} from "viem";
|
|
5
7
|
import { json_stringify } from "../../sdk/utils/index.js";
|
|
8
|
+
function getFunctionSignature(abi, calldataOrSelector) {
|
|
9
|
+
const selector = calldataOrSelector.slice(0, 10);
|
|
10
|
+
for (const item of abi) {
|
|
11
|
+
if (item.type === "function" && toFunctionSelector(item) === selector) {
|
|
12
|
+
return toFunctionSignature(item);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
throw new Error(`Function with selector ${selector} not found in ABI`);
|
|
16
|
+
}
|
|
6
17
|
function functionArgsToMap(abi, functionName, args) {
|
|
7
18
|
const abiItem = getAbiItem({
|
|
8
19
|
abi,
|
|
@@ -32,6 +43,36 @@ function functionArgsToMap(abi, functionName, args) {
|
|
|
32
43
|
}
|
|
33
44
|
return namedArgs;
|
|
34
45
|
}
|
|
46
|
+
function functionArgsToRecord(abi, functionName, args) {
|
|
47
|
+
const abiItem = getAbiItem({
|
|
48
|
+
abi,
|
|
49
|
+
name: functionName,
|
|
50
|
+
args
|
|
51
|
+
});
|
|
52
|
+
if (!abiItem || abiItem.type !== "function") {
|
|
53
|
+
throw new AbiFunctionNotFoundError(functionName);
|
|
54
|
+
}
|
|
55
|
+
const namedArgs = {};
|
|
56
|
+
if (Array.isArray(args)) {
|
|
57
|
+
args.forEach((value, i) => {
|
|
58
|
+
const input = abiItem.inputs?.[i];
|
|
59
|
+
const key = input?.name || `${i}`;
|
|
60
|
+
namedArgs[key] = value;
|
|
61
|
+
});
|
|
62
|
+
} else {
|
|
63
|
+
Object.entries(args || {}).forEach(([key, value]) => {
|
|
64
|
+
const index = parseInt(key, 10);
|
|
65
|
+
if (!Number.isNaN(index) && abiItem.inputs?.[index]?.name) {
|
|
66
|
+
namedArgs[abiItem.inputs[index].name] = value;
|
|
67
|
+
} else {
|
|
68
|
+
namedArgs[key] = value;
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
return namedArgs;
|
|
73
|
+
}
|
|
35
74
|
export {
|
|
36
|
-
functionArgsToMap
|
|
75
|
+
functionArgsToMap,
|
|
76
|
+
functionArgsToRecord,
|
|
77
|
+
getFunctionSignature
|
|
37
78
|
};
|
|
@@ -8,11 +8,11 @@ export declare const rpcProvidersSchema: z.ZodEnum<{
|
|
|
8
8
|
ankr: "ankr";
|
|
9
9
|
}>;
|
|
10
10
|
export type RpcProvider = z.infer<typeof rpcProvidersSchema>;
|
|
11
|
-
export declare function getRpcProviderUrl(provider: RpcProvider, network: NetworkType, apiKey
|
|
12
|
-
export declare function getAlchemyUrl(network: NetworkType, apiKey
|
|
13
|
-
export declare function getDrpcUrl(network: NetworkType, apiKey
|
|
14
|
-
export declare function getAnkrUrl(network: NetworkType, apiKey
|
|
15
|
-
export declare function getThirdWebUrl(network: NetworkType, apiKey
|
|
11
|
+
export declare function getRpcProviderUrl(provider: RpcProvider, network: NetworkType, apiKey: string, protocol?: "http" | "ws"): string | undefined;
|
|
12
|
+
export declare function getAlchemyUrl(network: NetworkType, apiKey: string, protocol?: "http" | "ws"): string | undefined;
|
|
13
|
+
export declare function getDrpcUrl(network: NetworkType, apiKey: string, protocol?: "http" | "ws"): string | undefined;
|
|
14
|
+
export declare function getAnkrUrl(network: NetworkType, apiKey: string, protocol?: "http" | "ws"): string | undefined;
|
|
15
|
+
export declare function getThirdWebUrl(network: NetworkType, apiKey: string, protocol?: "http" | "ws"): string | undefined;
|
|
16
16
|
export declare function getErpcKey(network: NetworkType, projectId?: string, urlBase?: string): string | undefined;
|
|
17
17
|
/**
|
|
18
18
|
Non-existent event:
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Address, Hex } from "viem";
|
|
2
|
+
import type { AddressMap, ChainContractsRegister } from "../sdk/index.js";
|
|
3
|
+
import type { ExecuteResult, FacadeParsedCall } from "./internal-types.js";
|
|
4
|
+
import type { OuterFacadeOperation } from "./types.js";
|
|
5
|
+
export interface AssembleOperationsInput {
|
|
6
|
+
facadeCalls: FacadeParsedCall[];
|
|
7
|
+
executeResults: ExecuteResult[];
|
|
8
|
+
register: ChainContractsRegister;
|
|
9
|
+
underlying: Address;
|
|
10
|
+
txHash: Hex;
|
|
11
|
+
blockNumber: number;
|
|
12
|
+
liquidationRemainingFunds?: bigint;
|
|
13
|
+
phantomTokens?: AddressMap<Address>;
|
|
14
|
+
strict?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Combines parsed facade calls with per-Execute transfer data into
|
|
18
|
+
* fully classified {@link OuterFacadeOperation} entries.
|
|
19
|
+
*
|
|
20
|
+
* The flat `executeResults` array (one entry per Execute event across
|
|
21
|
+
* the entire transaction) is sliced per facade call based on how many
|
|
22
|
+
* adapter/unknown inner calls each one contains.
|
|
23
|
+
*/
|
|
24
|
+
export declare function assembleOperations(input: AssembleOperationsInput): OuterFacadeOperation[];
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type Address, type Hex } from "viem";
|
|
2
|
+
import type { AddressMap, ChainContractsRegister, ParsedCallV2 } from "../sdk/index.js";
|
|
3
|
+
import type { InnerOperation } from "./inner-operations.js";
|
|
4
|
+
import type { ExecuteResult } from "./internal-types.js";
|
|
5
|
+
export interface ClassifyMulticallOperationsInput {
|
|
6
|
+
innerCalls: ParsedCallV2[];
|
|
7
|
+
executeResults: ExecuteResult[];
|
|
8
|
+
protocolCalldatas: Hex[];
|
|
9
|
+
register: ChainContractsRegister;
|
|
10
|
+
creditAccount: Address;
|
|
11
|
+
underlying: Address;
|
|
12
|
+
strict?: boolean;
|
|
13
|
+
phantomTokens?: AddressMap<Address>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Classifies each multicall inner call into a {@link InnerOperation}:
|
|
17
|
+
*
|
|
18
|
+
* - **Adapter calls** (target registered as an adapter): delegates to
|
|
19
|
+
* `adapter.parseAdapterOperation()` and consumes the next entry from
|
|
20
|
+
* `executeTransfers` (one Execute event per adapter call).
|
|
21
|
+
*
|
|
22
|
+
* - **Facade self-calls** (`increaseDebt`, `updateQuota`, etc.): mapped
|
|
23
|
+
* directly from `functionName` / `rawArgs`. No transfer consumed.
|
|
24
|
+
*
|
|
25
|
+
* - **Unknown contracts** (address not in register): treated as adapter
|
|
26
|
+
* calls with a fallback to generic `Swap` from transfers.
|
|
27
|
+
*
|
|
28
|
+
* Skips facade calls we're not interested in (`onDemandPriceUpdates`, `disableToken`, etc.).
|
|
29
|
+
*
|
|
30
|
+
* @throws {TransferAlignmentError} if the number of adapter calls does not
|
|
31
|
+
* match the number of Execute transfers.
|
|
32
|
+
* @throws {UnknownAdapterError} if strict is true and an inner call target
|
|
33
|
+
* is not in the register.
|
|
34
|
+
*/
|
|
35
|
+
export declare function classifyMulticallOperations(input: ClassifyMulticallOperationsInput): InnerOperation[];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Address } from "viem";
|
|
2
|
+
import type { TokenInfo } from "../plugins/adapters/types.js";
|
|
3
|
+
import type { CreditAccountOperation } from "./types.js";
|
|
4
|
+
export type TokenResolver = (addr: Address) => TokenInfo;
|
|
5
|
+
export declare function enrichOperations(ops: CreditAccountOperation[], resolve: TokenResolver): CreditAccountOperation<TokenInfo>[];
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Address, Hex } from "viem";
|
|
2
|
+
export declare class UnknownAdapterError extends Error {
|
|
3
|
+
readonly address: Address;
|
|
4
|
+
constructor(address: Address);
|
|
5
|
+
}
|
|
6
|
+
export declare class TransferAlignmentError extends Error {
|
|
7
|
+
constructor(expected: number, actual: number);
|
|
8
|
+
}
|
|
9
|
+
export declare class ProtocolCallNotFoundError extends Error {
|
|
10
|
+
readonly targetContract: Address;
|
|
11
|
+
readonly executeIndex: number;
|
|
12
|
+
constructor(targetContract: Address, executeIndex: number);
|
|
13
|
+
}
|
|
14
|
+
export declare class AdapterTraceAlignmentError extends Error {
|
|
15
|
+
readonly expected: number;
|
|
16
|
+
readonly actual: number;
|
|
17
|
+
constructor(expected: number, actual: number);
|
|
18
|
+
}
|
|
19
|
+
export declare class UnexpectedFacadeEventOrderError extends Error {
|
|
20
|
+
constructor(e: {
|
|
21
|
+
eventName: string;
|
|
22
|
+
logIndex: number;
|
|
23
|
+
transactionHash: Hex;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
export declare class UnknownFacadeCallError extends Error {
|
|
27
|
+
readonly address: Address;
|
|
28
|
+
readonly functionName: string;
|
|
29
|
+
constructor(address: Address, functionName: string);
|
|
30
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Hex } from "viem";
|
|
2
|
+
import type { CallTrace, ExecuteResult } from "./internal-types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Extracts calldata sent to target contract for each Execute event.
|
|
5
|
+
*
|
|
6
|
+
* @returns
|
|
7
|
+
*/
|
|
8
|
+
export declare function extractProtocolCalls(facadeTrace: CallTrace, executeResults: ExecuteResult[]): Hex[];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type Address, type Log } from "viem";
|
|
2
|
+
import { AddressMap } from "../sdk/index.js";
|
|
3
|
+
import type { ExecuteResult } from "./internal-types.js";
|
|
4
|
+
import type { DirectTransferInfo } from "./types.js";
|
|
5
|
+
type RawLog = Log<bigint | number, number, false>;
|
|
6
|
+
/**
|
|
7
|
+
* Extracts per-adapter-call token balance changes and detects direct
|
|
8
|
+
* incoming transfers to the credit account.
|
|
9
|
+
*
|
|
10
|
+
* @param logs - raw viem Log[] from transaction receipt, sorted by logIndex
|
|
11
|
+
* @param facadeAddress - the credit facade address (sole boundary event source)
|
|
12
|
+
* @param creditAccount - the credit account address to track
|
|
13
|
+
*/
|
|
14
|
+
export interface ExtractTransfersResult {
|
|
15
|
+
executeResults: ExecuteResult[];
|
|
16
|
+
directTransfers: DirectTransferInfo[];
|
|
17
|
+
liquidationRemainingFunds?: bigint;
|
|
18
|
+
/** Maps phantom token address to its deposited (underlying) token address. */
|
|
19
|
+
phantomTokens: AddressMap<Address>;
|
|
20
|
+
}
|
|
21
|
+
export declare function extractTransfers(logs: RawLog[], creditAccount: Address, pool: Address, creditFacade: Address): ExtractTransfersResult;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Address } from "viem";
|
|
2
|
+
import type { ChainContractsRegister } from "../sdk/index.js";
|
|
3
|
+
import type { CallTrace, FacadeParsedCall } from "./internal-types.js";
|
|
4
|
+
/**
|
|
5
|
+
* Walks a `debug_traceTransaction` callTracer tree, finds all non-reverted
|
|
6
|
+
* calls to the credit facade, parses them via the register, and returns
|
|
7
|
+
* structured {@link FacadeParsedCall} entries for the given credit account.
|
|
8
|
+
*/
|
|
9
|
+
export declare function findFacadeCalls(trace: CallTrace, creditFacade: Address, creditAccount: Address, register: ChainContractsRegister, strict?: boolean): FacadeParsedCall[];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type { TokenInfo } from "../plugins/adapters/types.js";
|
|
2
|
+
export * from "./inner-operations.js";
|
|
3
|
+
export { parseCreditAccountTransaction } from "./parseCreditAccountTransaction.js";
|
|
4
|
+
export * from "./populateContractsRegister.js";
|
|
5
|
+
export { toLegacyOperations } from "./toLegacyOperation.js";
|
|
6
|
+
export * from "./types.js";
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { Address } from "viem";
|
|
2
|
+
import type { AdapterOperation } from "../plugins/adapters/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Increase debt (borrow more).
|
|
5
|
+
* @see https://github.com/Gearbox-protocol/charts_server/blob/master/core/operation_type_v3.go#L149-L154
|
|
6
|
+
*/
|
|
7
|
+
export interface IncreaseDebtOp<TToken = Address> {
|
|
8
|
+
operation: "IncreaseBorrowedAmount";
|
|
9
|
+
token: TToken;
|
|
10
|
+
amount: bigint;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Decrease debt (repay).
|
|
14
|
+
* @see https://github.com/Gearbox-protocol/charts_server/blob/master/core/operation_type_v3.go#L155-L161
|
|
15
|
+
*/
|
|
16
|
+
export interface DecreaseDebtOp<TToken = Address> {
|
|
17
|
+
operation: "DecreaseBorrowedAmount";
|
|
18
|
+
token: TToken;
|
|
19
|
+
amount: bigint;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Add collateral to credit account.
|
|
23
|
+
*/
|
|
24
|
+
export interface AddCollateralOp<TToken = Address> {
|
|
25
|
+
operation: "AddCollateral";
|
|
26
|
+
token: TToken;
|
|
27
|
+
amount: bigint;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Withdraw collateral from credit account.
|
|
31
|
+
* @see https://github.com/Gearbox-protocol/charts_server/blob/master/core/operation_type_v3.go#L162-L171
|
|
32
|
+
*/
|
|
33
|
+
export interface WithdrawCollateralOp<TToken = Address> {
|
|
34
|
+
operation: "WithdrawCollateral";
|
|
35
|
+
token: TToken;
|
|
36
|
+
amount: bigint;
|
|
37
|
+
to: Address;
|
|
38
|
+
phantomToken?: TToken;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Update token quota on credit account.
|
|
42
|
+
* @see https://github.com/Gearbox-protocol/charts_server/blob/master/core/operation_type_v3.go#L172-L178
|
|
43
|
+
*/
|
|
44
|
+
export interface UpdateQuotaOp<TToken = Address> {
|
|
45
|
+
operation: "UpdateQuota";
|
|
46
|
+
token: TToken;
|
|
47
|
+
change: bigint;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Union of facade inner-call operation types (non-adapter credit account operations).
|
|
51
|
+
* Discriminated on the `operation` field.
|
|
52
|
+
*/
|
|
53
|
+
export type InnerFacadeOperation<TToken = Address> = IncreaseDebtOp<TToken> | DecreaseDebtOp<TToken> | AddCollateralOp<TToken> | WithdrawCollateralOp<TToken> | UpdateQuotaOp<TToken>;
|
|
54
|
+
/**
|
|
55
|
+
* All operations that can happen within a CreditFacade's multicall and that we're interested in.
|
|
56
|
+
*/
|
|
57
|
+
export type InnerOperation<TToken = Address> = AdapterOperation<TToken> | InnerFacadeOperation<TToken>;
|