@wildcatfi/wildcat-sdk 3.0.68-beta → 3.0.69-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/abi/generated.d.ts +34207 -0
- package/dist/abi/generated.d.ts.map +1 -0
- package/dist/abi/generated.js +43811 -0
- package/dist/abi/generated.js.map +1 -0
- package/dist/abi/index.d.ts +3 -0
- package/dist/abi/index.d.ts.map +1 -0
- package/dist/abi/index.js +19 -0
- package/dist/abi/index.js.map +1 -0
- package/dist/abi/manual.d.ts +354 -0
- package/dist/abi/manual.d.ts.map +1 -0
- package/dist/abi/manual.js +202 -0
- package/dist/abi/manual.js.map +1 -0
- package/dist/access/access-control.d.ts +16 -18
- package/dist/access/access-control.d.ts.map +1 -1
- package/dist/access/access-control.js +101 -101
- package/dist/access/access-control.js.map +1 -1
- package/dist/access/fixed-term.d.ts +16 -18
- package/dist/access/fixed-term.d.ts.map +1 -1
- package/dist/access/fixed-term.js +115 -104
- package/dist/access/fixed-term.js.map +1 -1
- package/dist/access/index.d.ts +3 -3
- package/dist/access/index.d.ts.map +1 -1
- package/dist/access/index.js +47 -13
- package/dist/access/index.js.map +1 -1
- package/dist/access/revolving.d.ts +2 -1
- package/dist/access/revolving.d.ts.map +1 -1
- package/dist/access/revolving.js +6 -6
- package/dist/access/revolving.js.map +1 -1
- package/dist/access/utils.d.ts +2 -1
- package/dist/access/utils.d.ts.map +1 -1
- package/dist/access/utils.js +40 -10
- package/dist/access/utils.js.map +1 -1
- package/dist/access/validation.d.ts +7 -6
- package/dist/access/validation.d.ts.map +1 -1
- package/dist/access/validation.js +1 -0
- package/dist/access/validation.js.map +1 -1
- package/dist/account/index.d.ts +21 -30
- package/dist/account/index.d.ts.map +1 -1
- package/dist/account/index.js +193 -224
- package/dist/account/index.js.map +1 -1
- package/dist/client.d.ts +22 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +51 -0
- package/dist/client.js.map +1 -0
- package/dist/collateral/collateral-events.d.ts +9 -10
- package/dist/collateral/collateral-events.d.ts.map +1 -1
- package/dist/collateral/collateral-events.js +4 -4
- package/dist/collateral/collateral-events.js.map +1 -1
- package/dist/collateral/index.d.ts +7 -10
- package/dist/collateral/index.d.ts.map +1 -1
- package/dist/collateral/index.js +36 -37
- package/dist/collateral/index.js.map +1 -1
- package/dist/constants.d.ts +72 -16
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +137 -23
- package/dist/constants.js.map +1 -1
- package/dist/controller.d.ts +10 -17
- package/dist/controller.d.ts.map +1 -1
- package/dist/controller.js +66 -67
- package/dist/controller.js.map +1 -1
- package/dist/gql/getActiveLendersByMarket.d.ts +2 -3
- package/dist/gql/getActiveLendersByMarket.d.ts.map +1 -1
- package/dist/gql/getActiveLendersByMarket.js +10 -10
- package/dist/gql/getActiveLendersByMarket.js.map +1 -1
- package/dist/gql/getAllHooksDataForBorrower.d.ts.map +1 -1
- package/dist/gql/getAllHooksDataForBorrower.js +6 -3
- package/dist/gql/getAllHooksDataForBorrower.js.map +1 -1
- package/dist/gql/getAllHooksTemplates.d.ts.map +1 -1
- package/dist/gql/getAllHooksTemplates.js +3 -3
- package/dist/gql/getAllHooksTemplates.js.map +1 -1
- package/dist/gql/graphql.d.ts +373 -10
- package/dist/gql/graphql.d.ts.map +1 -1
- package/dist/gql/graphql.js +78 -4
- package/dist/gql/graphql.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -14
- package/dist/index.js.map +1 -1
- package/dist/internal/arch-controller.d.ts +6 -0
- package/dist/internal/arch-controller.d.ts.map +1 -0
- package/dist/internal/arch-controller.js +36 -0
- package/dist/internal/arch-controller.js.map +1 -0
- package/dist/internal/ethers-signer.d.ts +4 -0
- package/dist/internal/ethers-signer.d.ts.map +1 -0
- package/dist/internal/ethers-signer.js +12 -0
- package/dist/internal/ethers-signer.js.map +1 -0
- package/dist/internal/ethers-viem.d.ts +4 -0
- package/dist/internal/ethers-viem.d.ts.map +1 -0
- package/dist/internal/ethers-viem.js +43 -0
- package/dist/internal/ethers-viem.js.map +1 -0
- package/dist/internal/market-lens.d.ts +26 -0
- package/dist/internal/market-lens.d.ts.map +1 -0
- package/dist/internal/market-lens.js +117 -0
- package/dist/internal/market-lens.js.map +1 -0
- package/dist/internal/viem-read.d.ts +3 -0
- package/dist/internal/viem-read.d.ts.map +1 -0
- package/dist/internal/viem-read.js +13 -0
- package/dist/internal/viem-read.js.map +1 -0
- package/dist/internal/viem-write.d.ts +9 -0
- package/dist/internal/viem-write.d.ts.map +1 -0
- package/dist/internal/viem-write.js +24 -0
- package/dist/internal/viem-write.js.map +1 -0
- package/dist/lens-types.d.ts +283 -0
- package/dist/lens-types.d.ts.map +1 -0
- package/dist/{typechain/ISafe.js → lens-types.js} +1 -1
- package/dist/lens-types.js.map +1 -0
- package/dist/market.d.ts +13 -16
- package/dist/market.d.ts.map +1 -1
- package/dist/market.js +207 -198
- package/dist/market.js.map +1 -1
- package/dist/mockerc20factory.d.ts +4 -15
- package/dist/mockerc20factory.d.ts.map +1 -1
- package/dist/mockerc20factory.js +20 -15
- package/dist/mockerc20factory.js.map +1 -1
- package/dist/token.d.ts +24 -11
- package/dist/token.d.ts.map +1 -1
- package/dist/token.js +78 -61
- package/dist/token.js.map +1 -1
- package/dist/types.d.ts +53 -12
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +6 -15
- package/dist/types.js.map +1 -1
- package/dist/utils/bigint.d.ts +22 -0
- package/dist/utils/bigint.d.ts.map +1 -0
- package/dist/utils/bigint.js +111 -0
- package/dist/utils/bigint.js.map +1 -0
- package/dist/utils/check-registered-borrowers.d.ts.map +1 -1
- package/dist/utils/check-registered-borrowers.js +7 -6
- package/dist/utils/check-registered-borrowers.js.map +1 -1
- package/dist/utils/describe-account.d.ts.map +1 -1
- package/dist/utils/describe-account.js +33 -4
- package/dist/utils/describe-account.js.map +1 -1
- package/dist/utils/describe-signature.d.ts.map +1 -1
- package/dist/utils/describe-signature.js +66 -14
- package/dist/utils/describe-signature.js.map +1 -1
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +2 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/math.d.ts +1 -13
- package/dist/utils/math.d.ts.map +1 -1
- package/dist/utils/math.js +14 -50
- package/dist/utils/math.js.map +1 -1
- package/dist/utils/misc.d.ts +5 -4
- package/dist/utils/misc.d.ts.map +1 -1
- package/dist/utils/misc.js +6 -6
- package/dist/utils/misc.js.map +1 -1
- package/dist/utils/record-types.d.ts +4 -5
- package/dist/utils/record-types.d.ts.map +1 -1
- package/dist/utils/record-types.js +2 -2
- package/dist/utils/record-types.js.map +1 -1
- package/dist/utils/type-parsers.d.ts +9 -3
- package/dist/utils/type-parsers.d.ts.map +1 -1
- package/dist/utils/type-parsers.js +14 -13
- package/dist/utils/type-parsers.js.map +1 -1
- package/dist/utils/viem-encoding.d.ts +15 -0
- package/dist/utils/viem-encoding.d.ts.map +1 -0
- package/dist/utils/viem-encoding.js +33 -0
- package/dist/utils/viem-encoding.js.map +1 -0
- package/dist/withdrawal-batch.d.ts +6 -7
- package/dist/withdrawal-batch.d.ts.map +1 -1
- package/dist/withdrawal-batch.js +29 -30
- package/dist/withdrawal-batch.js.map +1 -1
- package/dist/withdrawal-status.d.ts +5 -5
- package/dist/withdrawal-status.d.ts.map +1 -1
- package/dist/withdrawal-status.js +15 -12
- package/dist/withdrawal-status.js.map +1 -1
- package/dist/wrapper/index.d.ts +14 -31
- package/dist/wrapper/index.d.ts.map +1 -1
- package/dist/wrapper/index.js +80 -83
- package/dist/wrapper/index.js.map +1 -1
- package/package.json +13 -11
- package/dist/typechain/AccountQuery.d.ts +0 -56
- package/dist/typechain/AccountQuery.d.ts.map +0 -1
- package/dist/typechain/AccountQuery.js +0 -3
- package/dist/typechain/AccountQuery.js.map +0 -1
- package/dist/typechain/AccountsQuery.d.ts +0 -56
- package/dist/typechain/AccountsQuery.d.ts.map +0 -1
- package/dist/typechain/AccountsQuery.js +0 -3
- package/dist/typechain/AccountsQuery.js.map +0 -1
- package/dist/typechain/CheckBorrowersRegistered.d.ts +0 -29
- package/dist/typechain/CheckBorrowersRegistered.d.ts.map +0 -1
- package/dist/typechain/CheckBorrowersRegistered.js +0 -3
- package/dist/typechain/CheckBorrowersRegistered.js.map +0 -1
- package/dist/typechain/CheckSafeSignature.d.ts +0 -29
- package/dist/typechain/CheckSafeSignature.d.ts.map +0 -1
- package/dist/typechain/CheckSafeSignature.js +0 -3
- package/dist/typechain/CheckSafeSignature.js.map +0 -1
- package/dist/typechain/CollateralLens.d.ts +0 -220
- package/dist/typechain/CollateralLens.d.ts.map +0 -1
- package/dist/typechain/CollateralLens.js +0 -3
- package/dist/typechain/CollateralLens.js.map +0 -1
- package/dist/typechain/DescribeSignature.d.ts +0 -102
- package/dist/typechain/DescribeSignature.d.ts.map +0 -1
- package/dist/typechain/DescribeSignature.js +0 -3
- package/dist/typechain/DescribeSignature.js.map +0 -1
- package/dist/typechain/HooksFactory.d.ts +0 -593
- package/dist/typechain/HooksFactory.d.ts.map +0 -1
- package/dist/typechain/HooksFactory.js +0 -3
- package/dist/typechain/HooksFactory.js.map +0 -1
- package/dist/typechain/HooksFactoryRevolving.d.ts +0 -603
- package/dist/typechain/HooksFactoryRevolving.d.ts.map +0 -1
- package/dist/typechain/HooksFactoryRevolving.js +0 -3
- package/dist/typechain/HooksFactoryRevolving.js.map +0 -1
- package/dist/typechain/IERC20.d.ts +0 -232
- package/dist/typechain/IERC20.d.ts.map +0 -1
- package/dist/typechain/IERC20.js +0 -3
- package/dist/typechain/IERC20.js.map +0 -1
- package/dist/typechain/IFixedTermHooks.d.ts +0 -1032
- package/dist/typechain/IFixedTermHooks.d.ts.map +0 -1
- package/dist/typechain/IFixedTermHooks.js +0 -3
- package/dist/typechain/IFixedTermHooks.js.map +0 -1
- package/dist/typechain/IOpenTermHooks.d.ts +0 -987
- package/dist/typechain/IOpenTermHooks.d.ts.map +0 -1
- package/dist/typechain/IOpenTermHooks.js +0 -3
- package/dist/typechain/IOpenTermHooks.js.map +0 -1
- package/dist/typechain/ISafe.d.ts +0 -124
- package/dist/typechain/ISafe.d.ts.map +0 -1
- package/dist/typechain/ISafe.js.map +0 -1
- package/dist/typechain/MarketLens.d.ts +0 -611
- package/dist/typechain/MarketLens.d.ts.map +0 -1
- package/dist/typechain/MarketLens.js +0 -3
- package/dist/typechain/MarketLens.js.map +0 -1
- package/dist/typechain/MarketLensV2.d.ts +0 -704
- package/dist/typechain/MarketLensV2.d.ts.map +0 -1
- package/dist/typechain/MarketLensV2.js +0 -3
- package/dist/typechain/MarketLensV2.js.map +0 -1
- package/dist/typechain/MarketLensV2_5.d.ts +0 -996
- package/dist/typechain/MarketLensV2_5.d.ts.map +0 -1
- package/dist/typechain/MarketLensV2_5.js +0 -3
- package/dist/typechain/MarketLensV2_5.js.map +0 -1
- package/dist/typechain/MockArchControllerOwner.d.ts +0 -130
- package/dist/typechain/MockArchControllerOwner.d.ts.map +0 -1
- package/dist/typechain/MockArchControllerOwner.js +0 -3
- package/dist/typechain/MockArchControllerOwner.js.map +0 -1
- package/dist/typechain/MockERC20Factory.d.ts +0 -122
- package/dist/typechain/MockERC20Factory.d.ts.map +0 -1
- package/dist/typechain/MockERC20Factory.js +0 -3
- package/dist/typechain/MockERC20Factory.js.map +0 -1
- package/dist/typechain/SimpleMarketCollateral.d.ts +0 -270
- package/dist/typechain/SimpleMarketCollateral.d.ts.map +0 -1
- package/dist/typechain/SimpleMarketCollateral.js +0 -3
- package/dist/typechain/SimpleMarketCollateral.js.map +0 -1
- package/dist/typechain/Wildcat4626Wrapper.sol/IWildcatMarketToken.d.ts +0 -176
- package/dist/typechain/Wildcat4626Wrapper.sol/IWildcatMarketToken.d.ts.map +0 -1
- package/dist/typechain/Wildcat4626Wrapper.sol/IWildcatMarketToken.js +0 -3
- package/dist/typechain/Wildcat4626Wrapper.sol/IWildcatMarketToken.js.map +0 -1
- package/dist/typechain/Wildcat4626Wrapper.sol/IWildcatSanctionsSentinel.d.ts +0 -44
- package/dist/typechain/Wildcat4626Wrapper.sol/IWildcatSanctionsSentinel.d.ts.map +0 -1
- package/dist/typechain/Wildcat4626Wrapper.sol/IWildcatSanctionsSentinel.js +0 -3
- package/dist/typechain/Wildcat4626Wrapper.sol/IWildcatSanctionsSentinel.js.map +0 -1
- package/dist/typechain/Wildcat4626Wrapper.sol/Wildcat4626Wrapper.d.ts +0 -501
- package/dist/typechain/Wildcat4626Wrapper.sol/Wildcat4626Wrapper.d.ts.map +0 -1
- package/dist/typechain/Wildcat4626Wrapper.sol/Wildcat4626Wrapper.js +0 -3
- package/dist/typechain/Wildcat4626Wrapper.sol/Wildcat4626Wrapper.js.map +0 -1
- package/dist/typechain/Wildcat4626Wrapper.sol/index.d.ts +0 -4
- package/dist/typechain/Wildcat4626Wrapper.sol/index.d.ts.map +0 -1
- package/dist/typechain/Wildcat4626Wrapper.sol/index.js +0 -3
- package/dist/typechain/Wildcat4626Wrapper.sol/index.js.map +0 -1
- package/dist/typechain/Wildcat4626WrapperFactory.d.ts +0 -83
- package/dist/typechain/Wildcat4626WrapperFactory.d.ts.map +0 -1
- package/dist/typechain/Wildcat4626WrapperFactory.js +0 -3
- package/dist/typechain/Wildcat4626WrapperFactory.js.map +0 -1
- package/dist/typechain/WildcatArchController.d.ts +0 -545
- package/dist/typechain/WildcatArchController.d.ts.map +0 -1
- package/dist/typechain/WildcatArchController.js +0 -3
- package/dist/typechain/WildcatArchController.js.map +0 -1
- package/dist/typechain/WildcatCollateralFactory.d.ts +0 -164
- package/dist/typechain/WildcatCollateralFactory.d.ts.map +0 -1
- package/dist/typechain/WildcatCollateralFactory.js +0 -3
- package/dist/typechain/WildcatCollateralFactory.js.map +0 -1
- package/dist/typechain/WildcatMarket.d.ts +0 -1062
- package/dist/typechain/WildcatMarket.d.ts.map +0 -1
- package/dist/typechain/WildcatMarket.js +0 -3
- package/dist/typechain/WildcatMarket.js.map +0 -1
- package/dist/typechain/WildcatMarketController.d.ts +0 -553
- package/dist/typechain/WildcatMarketController.d.ts.map +0 -1
- package/dist/typechain/WildcatMarketController.js +0 -3
- package/dist/typechain/WildcatMarketController.js.map +0 -1
- package/dist/typechain/WildcatMarketControllerFactory.d.ts +0 -344
- package/dist/typechain/WildcatMarketControllerFactory.d.ts.map +0 -1
- package/dist/typechain/WildcatMarketControllerFactory.js +0 -3
- package/dist/typechain/WildcatMarketControllerFactory.js.map +0 -1
- package/dist/typechain/WildcatMarketV2.d.ts +0 -1086
- package/dist/typechain/WildcatMarketV2.d.ts.map +0 -1
- package/dist/typechain/WildcatMarketV2.js +0 -3
- package/dist/typechain/WildcatMarketV2.js.map +0 -1
- package/dist/typechain/common.d.ts +0 -23
- package/dist/typechain/common.d.ts.map +0 -1
- package/dist/typechain/common.js +0 -3
- package/dist/typechain/common.js.map +0 -1
- package/dist/typechain/factories/AccountQuery__factory.d.ts +0 -63
- package/dist/typechain/factories/AccountQuery__factory.d.ts.map +0 -1
- package/dist/typechain/factories/AccountQuery__factory.js +0 -96
- package/dist/typechain/factories/AccountQuery__factory.js.map +0 -1
- package/dist/typechain/factories/AccountsQuery__factory.d.ts +0 -63
- package/dist/typechain/factories/AccountsQuery__factory.d.ts.map +0 -1
- package/dist/typechain/factories/AccountsQuery__factory.js +0 -96
- package/dist/typechain/factories/AccountsQuery__factory.js.map +0 -1
- package/dist/typechain/factories/CheckBorrowersRegistered__factory.d.ts +0 -36
- package/dist/typechain/factories/CheckBorrowersRegistered__factory.d.ts.map +0 -1
- package/dist/typechain/factories/CheckBorrowersRegistered__factory.js +0 -60
- package/dist/typechain/factories/CheckBorrowersRegistered__factory.js.map +0 -1
- package/dist/typechain/factories/CheckSafeSignature__factory.d.ts +0 -40
- package/dist/typechain/factories/CheckSafeSignature__factory.d.ts.map +0 -1
- package/dist/typechain/factories/CheckSafeSignature__factory.js +0 -65
- package/dist/typechain/factories/CheckSafeSignature__factory.js.map +0 -1
- package/dist/typechain/factories/CollateralLens__factory.d.ts +0 -854
- package/dist/typechain/factories/CollateralLens__factory.d.ts.map +0 -1
- package/dist/typechain/factories/CollateralLens__factory.js +0 -1101
- package/dist/typechain/factories/CollateralLens__factory.js.map +0 -1
- package/dist/typechain/factories/DescribeSignature__factory.d.ts +0 -145
- package/dist/typechain/factories/DescribeSignature__factory.d.ts.map +0 -1
- package/dist/typechain/factories/DescribeSignature__factory.js +0 -203
- package/dist/typechain/factories/DescribeSignature__factory.js.map +0 -1
- package/dist/typechain/factories/HooksFactoryRevolving__factory.d.ts +0 -872
- package/dist/typechain/factories/HooksFactoryRevolving__factory.d.ts.map +0 -1
- package/dist/typechain/factories/HooksFactoryRevolving__factory.js +0 -1131
- package/dist/typechain/factories/HooksFactoryRevolving__factory.js.map +0 -1
- package/dist/typechain/factories/HooksFactory__factory.d.ts +0 -902
- package/dist/typechain/factories/HooksFactory__factory.d.ts.map +0 -1
- package/dist/typechain/factories/HooksFactory__factory.js +0 -1168
- package/dist/typechain/factories/HooksFactory__factory.js.map +0 -1
- package/dist/typechain/factories/IERC20__factory.d.ts +0 -235
- package/dist/typechain/factories/IERC20__factory.d.ts.map +0 -1
- package/dist/typechain/factories/IERC20__factory.js +0 -315
- package/dist/typechain/factories/IERC20__factory.js.map +0 -1
- package/dist/typechain/factories/IFixedTermHooks__factory.d.ts +0 -1894
- package/dist/typechain/factories/IFixedTermHooks__factory.d.ts.map +0 -1
- package/dist/typechain/factories/IFixedTermHooks__factory.js +0 -2423
- package/dist/typechain/factories/IFixedTermHooks__factory.js.map +0 -1
- package/dist/typechain/factories/IOpenTermHooks__factory.d.ts +0 -1791
- package/dist/typechain/factories/IOpenTermHooks__factory.d.ts.map +0 -1
- package/dist/typechain/factories/IOpenTermHooks__factory.js +0 -2293
- package/dist/typechain/factories/IOpenTermHooks__factory.js.map +0 -1
- package/dist/typechain/factories/ISafe__factory.d.ts +0 -163
- package/dist/typechain/factories/ISafe__factory.d.ts.map +0 -1
- package/dist/typechain/factories/ISafe__factory.js +0 -225
- package/dist/typechain/factories/ISafe__factory.js.map +0 -1
- package/dist/typechain/factories/MarketLensV2_5__factory.d.ts +0 -14397
- package/dist/typechain/factories/MarketLensV2_5__factory.d.ts.map +0 -1
- package/dist/typechain/factories/MarketLensV2_5__factory.js +0 -18393
- package/dist/typechain/factories/MarketLensV2_5__factory.js.map +0 -1
- package/dist/typechain/factories/MarketLensV2__factory.d.ts +0 -6612
- package/dist/typechain/factories/MarketLensV2__factory.d.ts.map +0 -1
- package/dist/typechain/factories/MarketLensV2__factory.js +0 -8454
- package/dist/typechain/factories/MarketLensV2__factory.js.map +0 -1
- package/dist/typechain/factories/MarketLens__factory.d.ts +0 -3572
- package/dist/typechain/factories/MarketLens__factory.d.ts.map +0 -1
- package/dist/typechain/factories/MarketLens__factory.js +0 -4569
- package/dist/typechain/factories/MarketLens__factory.js.map +0 -1
- package/dist/typechain/factories/MockArchControllerOwner__factory.d.ts +0 -85
- package/dist/typechain/factories/MockArchControllerOwner__factory.d.ts.map +0 -1
- package/dist/typechain/factories/MockArchControllerOwner__factory.js +0 -118
- package/dist/typechain/factories/MockArchControllerOwner__factory.js.map +0 -1
- package/dist/typechain/factories/MockERC20Factory__factory.d.ts +0 -114
- package/dist/typechain/factories/MockERC20Factory__factory.d.ts.map +0 -1
- package/dist/typechain/factories/MockERC20Factory__factory.js +0 -157
- package/dist/typechain/factories/MockERC20Factory__factory.js.map +0 -1
- package/dist/typechain/factories/SimpleMarketCollateral__factory.d.ts +0 -264
- package/dist/typechain/factories/SimpleMarketCollateral__factory.d.ts.map +0 -1
- package/dist/typechain/factories/SimpleMarketCollateral__factory.js +0 -354
- package/dist/typechain/factories/SimpleMarketCollateral__factory.js.map +0 -1
- package/dist/typechain/factories/Wildcat4626Wrapper.sol/IWildcatMarketToken__factory.d.ts +0 -193
- package/dist/typechain/factories/Wildcat4626Wrapper.sol/IWildcatMarketToken__factory.d.ts.map +0 -1
- package/dist/typechain/factories/Wildcat4626Wrapper.sol/IWildcatMarketToken__factory.js +0 -263
- package/dist/typechain/factories/Wildcat4626Wrapper.sol/IWildcatMarketToken__factory.js.map +0 -1
- package/dist/typechain/factories/Wildcat4626Wrapper.sol/IWildcatSanctionsSentinel__factory.d.ts +0 -27
- package/dist/typechain/factories/Wildcat4626Wrapper.sol/IWildcatSanctionsSentinel__factory.d.ts.map +0 -1
- package/dist/typechain/factories/Wildcat4626Wrapper.sol/IWildcatSanctionsSentinel__factory.js +0 -44
- package/dist/typechain/factories/Wildcat4626Wrapper.sol/IWildcatSanctionsSentinel__factory.js.map +0 -1
- package/dist/typechain/factories/Wildcat4626Wrapper.sol/Wildcat4626Wrapper__factory.d.ts +0 -718
- package/dist/typechain/factories/Wildcat4626Wrapper.sol/Wildcat4626Wrapper__factory.d.ts.map +0 -1
- package/dist/typechain/factories/Wildcat4626Wrapper.sol/Wildcat4626Wrapper__factory.js +0 -946
- package/dist/typechain/factories/Wildcat4626Wrapper.sol/Wildcat4626Wrapper__factory.js.map +0 -1
- package/dist/typechain/factories/Wildcat4626Wrapper.sol/index.d.ts +0 -4
- package/dist/typechain/factories/Wildcat4626Wrapper.sol/index.d.ts.map +0 -1
- package/dist/typechain/factories/Wildcat4626Wrapper.sol/index.js +0 -13
- package/dist/typechain/factories/Wildcat4626Wrapper.sol/index.js.map +0 -1
- package/dist/typechain/factories/Wildcat4626WrapperFactory__factory.d.ts +0 -82
- package/dist/typechain/factories/Wildcat4626WrapperFactory__factory.d.ts.map +0 -1
- package/dist/typechain/factories/Wildcat4626WrapperFactory__factory.js +0 -117
- package/dist/typechain/factories/Wildcat4626WrapperFactory__factory.js.map +0 -1
- package/dist/typechain/factories/WildcatArchController__factory.d.ts +0 -554
- package/dist/typechain/factories/WildcatArchController__factory.d.ts.map +0 -1
- package/dist/typechain/factories/WildcatArchController__factory.js +0 -728
- package/dist/typechain/factories/WildcatArchController__factory.js.map +0 -1
- package/dist/typechain/factories/WildcatCollateralFactory__factory.d.ts +0 -160
- package/dist/typechain/factories/WildcatCollateralFactory__factory.d.ts.map +0 -1
- package/dist/typechain/factories/WildcatCollateralFactory__factory.js +0 -223
- package/dist/typechain/factories/WildcatCollateralFactory__factory.js.map +0 -1
- package/dist/typechain/factories/WildcatMarketControllerFactory__factory.d.ts +0 -421
- package/dist/typechain/factories/WildcatMarketControllerFactory__factory.d.ts.map +0 -1
- package/dist/typechain/factories/WildcatMarketControllerFactory__factory.js +0 -549
- package/dist/typechain/factories/WildcatMarketControllerFactory__factory.js.map +0 -1
- package/dist/typechain/factories/WildcatMarketController__factory.d.ts +0 -671
- package/dist/typechain/factories/WildcatMarketController__factory.d.ts.map +0 -1
- package/dist/typechain/factories/WildcatMarketController__factory.js +0 -870
- package/dist/typechain/factories/WildcatMarketController__factory.js.map +0 -1
- package/dist/typechain/factories/WildcatMarketV2__factory.d.ts +0 -1304
- package/dist/typechain/factories/WildcatMarketV2__factory.d.ts.map +0 -1
- package/dist/typechain/factories/WildcatMarketV2__factory.js +0 -1680
- package/dist/typechain/factories/WildcatMarketV2__factory.js.map +0 -1
- package/dist/typechain/factories/WildcatMarket__factory.d.ts +0 -1326
- package/dist/typechain/factories/WildcatMarket__factory.d.ts.map +0 -1
- package/dist/typechain/factories/WildcatMarket__factory.js +0 -1712
- package/dist/typechain/factories/WildcatMarket__factory.js.map +0 -1
- package/dist/typechain/factories/index.d.ts +0 -27
- package/dist/typechain/factories/index.d.ts.map +0 -1
- package/dist/typechain/factories/index.js +0 -81
- package/dist/typechain/factories/index.js.map +0 -1
- package/dist/typechain/index.d.ts +0 -73
- package/dist/typechain/index.d.ts.map +0 -1
- package/dist/typechain/index.js +0 -84
- package/dist/typechain/index.js.map +0 -1
package/dist/account/index.js
CHANGED
|
@@ -15,15 +15,18 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.MarketAccount = exports.LenderRole = void 0;
|
|
18
|
-
const ethers_1 = require("ethers");
|
|
19
18
|
const token_1 = require("../token");
|
|
20
19
|
const market_1 = require("../market");
|
|
21
|
-
const typechain_1 = require("../typechain");
|
|
22
20
|
const utils_1 = require("../utils");
|
|
23
21
|
const constants_1 = require("../constants");
|
|
22
|
+
const arch_controller_1 = require("../internal/arch-controller");
|
|
23
|
+
const market_lens_1 = require("../internal/market-lens");
|
|
24
24
|
const types_1 = require("../types");
|
|
25
25
|
const withdrawal_status_1 = require("../withdrawal-status");
|
|
26
26
|
const validation_1 = require("./validation");
|
|
27
|
+
const abi_1 = require("../abi");
|
|
28
|
+
const viem_write_1 = require("../internal/viem-write");
|
|
29
|
+
const viem_1 = require("viem");
|
|
27
30
|
__exportStar(require("./validation"), exports);
|
|
28
31
|
var LenderRole;
|
|
29
32
|
(function (LenderRole) {
|
|
@@ -32,7 +35,7 @@ var LenderRole;
|
|
|
32
35
|
LenderRole[LenderRole["WithdrawOnly"] = 2] = "WithdrawOnly";
|
|
33
36
|
LenderRole[LenderRole["DepositAndWithdraw"] = 3] = "DepositAndWithdraw";
|
|
34
37
|
})(LenderRole = exports.LenderRole || (exports.LenderRole = {}));
|
|
35
|
-
const NullProviderIndex =
|
|
38
|
+
const NullProviderIndex = 2 ** 24 - 1;
|
|
36
39
|
const hasUnifiedLatestLensForAccountReads = (chainId) => {
|
|
37
40
|
return (0, constants_1.hasDeploymentAddress)(chainId, "MarketLensV2_5");
|
|
38
41
|
};
|
|
@@ -280,110 +283,101 @@ class MarketAccount {
|
|
|
280
283
|
(0, utils_1.assert)(status === validation_1.SetMinimumDepositStatus.Ready, `Cannot set minimum deposit: ${status}`);
|
|
281
284
|
const config = this.market.hooksConfig;
|
|
282
285
|
(0, utils_1.assert)(config !== undefined, `V2 market missing hooksConfig`);
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
};
|
|
286
|
+
return (0, utils_1.prepareTransaction)({
|
|
287
|
+
to: config.hooksAddress,
|
|
288
|
+
abi: abi_1.iOpenTermHooksAbi,
|
|
289
|
+
functionName: "setMinimumDeposit",
|
|
290
|
+
args: [this.market.address, amount.raw]
|
|
291
|
+
});
|
|
289
292
|
}
|
|
290
293
|
async populateSetFixedTermEndTime(endTime) {
|
|
291
294
|
const { status } = this.previewSetFixedTermEndTime(endTime);
|
|
292
295
|
(0, utils_1.assert)(status === validation_1.SetFixedTermEndTimeStatus.Ready, `Cannot set fixed term end time: ${status}`);
|
|
293
296
|
const config = this.market.hooksConfig;
|
|
294
297
|
(0, utils_1.assert)(config !== undefined, `V2 market missing hooksConfig`);
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
};
|
|
298
|
+
return (0, utils_1.prepareTransaction)({
|
|
299
|
+
to: config.hooksAddress,
|
|
300
|
+
abi: abi_1.iFixedTermHooksAbi,
|
|
301
|
+
functionName: "setFixedTermEndTime",
|
|
302
|
+
args: [this.market.address, endTime]
|
|
303
|
+
});
|
|
301
304
|
}
|
|
302
305
|
async setMinimumDeposit(amount) {
|
|
303
|
-
|
|
304
|
-
(0, utils_1.assert)(status === validation_1.SetMinimumDepositStatus.Ready, `Cannot set minimum deposit: ${status}`);
|
|
305
|
-
const config = this.market.hooksConfig;
|
|
306
|
-
(0, utils_1.assert)(config !== undefined, `V2 market missing hooksConfig`);
|
|
307
|
-
const contract = typechain_1.IOpenTermHooks__factory.connect(config.hooksAddress, this.market.signer);
|
|
308
|
-
return contract.setMinimumDeposit(this.market.address, amount.raw);
|
|
306
|
+
return (0, viem_write_1.submitPreparedTransaction)(this.market.signer, await this.populateSetMinimumDeposit(amount));
|
|
309
307
|
}
|
|
310
308
|
async setFixedTermEndTime(endTime) {
|
|
311
|
-
|
|
312
|
-
(0, utils_1.assert)(status === validation_1.SetFixedTermEndTimeStatus.Ready, `Cannot set fixed term end time: ${status}`);
|
|
313
|
-
const config = this.market.hooksConfig;
|
|
314
|
-
(0, utils_1.assert)(config !== undefined, `V2 market missing hooksConfig`);
|
|
315
|
-
const contract = typechain_1.IFixedTermHooks__factory.connect(config.hooksAddress, this.market.signer);
|
|
316
|
-
return contract.setFixedTermEndTime(this.market.address, endTime);
|
|
309
|
+
return (0, viem_write_1.submitPreparedTransaction)(this.market.signer, await this.populateSetFixedTermEndTime(endTime));
|
|
317
310
|
}
|
|
318
311
|
/* -------------------------------------------------------------------------- */
|
|
319
312
|
/* Management Actions */
|
|
320
313
|
/* -------------------------------------------------------------------------- */
|
|
321
314
|
async closeMarket() {
|
|
322
|
-
|
|
323
|
-
(0, utils_1.assert)(status === validation_1.CloseMarketStatus.Ready, `Cannot close market: ${status}`);
|
|
324
|
-
if (this.market.version === types_1.MarketVersion.V1) {
|
|
325
|
-
(0, utils_1.assert)(this.market.controller !== undefined, "Controller address is required for V1 markets");
|
|
326
|
-
const controller = (0, constants_1.getControllerContract)(this.market.signer, this.market.controller);
|
|
327
|
-
return controller.closeMarket(this.market.address);
|
|
328
|
-
}
|
|
329
|
-
return this.market.contract.closeMarket();
|
|
315
|
+
return (0, viem_write_1.submitPreparedTransaction)(this.market.signer, this.populateCloseMarket());
|
|
330
316
|
}
|
|
331
317
|
populateCloseMarket() {
|
|
332
318
|
const { status } = this.previewCloseMarket();
|
|
333
319
|
(0, utils_1.assert)(status === validation_1.CloseMarketStatus.Ready, `Cannot close market: ${status}`);
|
|
334
320
|
if (this.market.version === types_1.MarketVersion.V1) {
|
|
335
321
|
(0, utils_1.assert)(this.market.controller !== undefined, "Controller address is required for V1 markets");
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
};
|
|
322
|
+
return (0, utils_1.prepareTransaction)({
|
|
323
|
+
to: this.market.controller,
|
|
324
|
+
abi: abi_1.wildcatMarketControllerAbi,
|
|
325
|
+
functionName: "closeMarket",
|
|
326
|
+
args: [this.market.address]
|
|
327
|
+
});
|
|
342
328
|
}
|
|
343
|
-
return {
|
|
329
|
+
return (0, utils_1.prepareTransaction)({
|
|
344
330
|
to: this.market.address,
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
};
|
|
331
|
+
abi: abi_1.wildcatMarketV2Abi,
|
|
332
|
+
functionName: "closeMarket"
|
|
333
|
+
});
|
|
348
334
|
}
|
|
349
335
|
async setMaxTotalSupply(amount) {
|
|
350
336
|
const { status } = this.previewSetMaxTotalSupply(amount);
|
|
351
337
|
(0, utils_1.assert)(status === validation_1.SetMaxTotalSupplyStatus.Ready, `Cannot close market: ${status}`);
|
|
352
338
|
if (this.market.version === types_1.MarketVersion.V1) {
|
|
353
339
|
(0, utils_1.assert)(this.market.controller !== undefined, "Controller address is required for V1 markets");
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
340
|
+
return (0, viem_write_1.submitPreparedTransaction)(this.market.signer, (0, utils_1.prepareTransaction)({
|
|
341
|
+
to: this.market.controller,
|
|
342
|
+
abi: abi_1.wildcatMarketControllerAbi,
|
|
343
|
+
functionName: "setMaxTotalSupply",
|
|
344
|
+
args: [this.market.address, amount.raw]
|
|
345
|
+
}));
|
|
346
|
+
}
|
|
347
|
+
return (0, viem_write_1.submitPreparedTransaction)(this.market.signer, (0, utils_1.prepareTransaction)({
|
|
348
|
+
to: this.market.address,
|
|
349
|
+
abi: abi_1.wildcatMarketV2Abi,
|
|
350
|
+
functionName: "setMaxTotalSupply",
|
|
351
|
+
args: [amount.raw]
|
|
352
|
+
}));
|
|
360
353
|
}
|
|
361
354
|
async setAnnualInterestBips(newAprBips) {
|
|
362
355
|
const { status } = this.previewSetAPR(newAprBips);
|
|
363
356
|
(0, utils_1.assert)(status === validation_1.SetAprStatus.Ready, `Cannot set new APR of ${newAprBips / 10000}%: ${status}`);
|
|
364
357
|
if (this.market.version === types_1.MarketVersion.V1) {
|
|
365
358
|
(0, utils_1.assert)(this.market.controller !== undefined, "Controller address is required for V1 markets");
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
}
|
|
359
|
+
return (0, viem_write_1.submitPreparedTransaction)(this.market.signer, (0, utils_1.prepareTransaction)({
|
|
360
|
+
to: this.market.controller,
|
|
361
|
+
abi: abi_1.wildcatMarketControllerAbi,
|
|
362
|
+
functionName: "setAnnualInterestBips",
|
|
363
|
+
args: [this.market.address, newAprBips]
|
|
364
|
+
}));
|
|
365
|
+
}
|
|
366
|
+
return (0, viem_write_1.submitPreparedTransaction)(this.market.signer, (0, utils_1.prepareTransaction)({
|
|
367
|
+
to: this.market.address,
|
|
368
|
+
abi: abi_1.wildcatMarketV2Abi,
|
|
369
|
+
functionName: "setAnnualInterestAndReserveRatioBips",
|
|
370
|
+
args: [newAprBips, this.market.reserveRatioBips]
|
|
371
|
+
}));
|
|
373
372
|
}
|
|
374
373
|
/* -------------------------------------------------------------------------- */
|
|
375
374
|
/* Approval */
|
|
376
375
|
/* -------------------------------------------------------------------------- */
|
|
377
376
|
isApprovedFor(amount) {
|
|
378
|
-
return this.underlyingApproval
|
|
377
|
+
return this.underlyingApproval >= amount.raw;
|
|
379
378
|
}
|
|
380
379
|
async approveMarket(amount) {
|
|
381
|
-
|
|
382
|
-
const signer = await token.signer.getAddress();
|
|
383
|
-
if (signer.toLowerCase() !== this.account.toLowerCase()) {
|
|
384
|
-
throw Error(`MarketAccount signer ${signer} does not match ${this.account}`);
|
|
385
|
-
}
|
|
386
|
-
return token.contract.approve(this.market.address, amount.raw);
|
|
380
|
+
return (0, viem_write_1.submitPreparedTransaction)(this.market.signer, await this.populateApproveMarket(amount));
|
|
387
381
|
}
|
|
388
382
|
async populateApproveMarket(amount) {
|
|
389
383
|
const token = this.market.underlyingToken;
|
|
@@ -391,14 +385,12 @@ class MarketAccount {
|
|
|
391
385
|
if (signer.toLowerCase() !== this.account.toLowerCase()) {
|
|
392
386
|
throw Error(`MarketAccount signer ${signer} does not match ${this.account}`);
|
|
393
387
|
}
|
|
394
|
-
return {
|
|
388
|
+
return (0, utils_1.prepareTransaction)({
|
|
395
389
|
to: token.address,
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
value: "0"
|
|
401
|
-
};
|
|
390
|
+
abi: abi_1.iERC20Abi,
|
|
391
|
+
functionName: "approve",
|
|
392
|
+
args: [this.market.address, amount.raw]
|
|
393
|
+
});
|
|
402
394
|
}
|
|
403
395
|
/* -------------------------------------------------------------------------- */
|
|
404
396
|
/* ForceBuyBack */
|
|
@@ -426,20 +418,17 @@ class MarketAccount {
|
|
|
426
418
|
};
|
|
427
419
|
}
|
|
428
420
|
async forceBuyBack(lender, amount) {
|
|
429
|
-
|
|
430
|
-
(0, utils_1.assert)(status === validation_1.ForceBuyBackStatus.Ready, `Cannot force buy back: ${status}`);
|
|
431
|
-
const contract = typechain_1.WildcatMarketV2__factory.connect(this.market.address, this.market.signer);
|
|
432
|
-
return await contract.forceBuyBack(lender, amount.raw);
|
|
421
|
+
return (0, viem_write_1.submitPreparedTransaction)(this.market.signer, this.populateForceBuyBack(lender, amount));
|
|
433
422
|
}
|
|
434
423
|
populateForceBuyBack(lender, amount) {
|
|
435
424
|
const { status } = this.previewForceBuyBack(lender, amount);
|
|
436
425
|
(0, utils_1.assert)(status === validation_1.ForceBuyBackStatus.Ready, `Cannot force buy back: ${status}`);
|
|
437
|
-
|
|
438
|
-
return {
|
|
426
|
+
return (0, utils_1.prepareTransaction)({
|
|
439
427
|
to: this.market.address,
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
428
|
+
abi: abi_1.wildcatMarketV2Abi,
|
|
429
|
+
functionName: "forceBuyBack",
|
|
430
|
+
args: [lender, amount.raw]
|
|
431
|
+
});
|
|
443
432
|
}
|
|
444
433
|
/* -------------------------------------------------------------------------- */
|
|
445
434
|
/* Deposits */
|
|
@@ -485,20 +474,15 @@ class MarketAccount {
|
|
|
485
474
|
if (signer.toLowerCase() !== this.account.toLowerCase()) {
|
|
486
475
|
throw Error(`MarketAccount signer ${signer} does not match ${this.account}`);
|
|
487
476
|
}
|
|
488
|
-
return {
|
|
477
|
+
return (0, utils_1.prepareTransaction)({
|
|
489
478
|
to: this.market.address,
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
479
|
+
abi: abi_1.wildcatMarketAbi,
|
|
480
|
+
functionName: "deposit",
|
|
481
|
+
args: [amount.raw]
|
|
482
|
+
});
|
|
493
483
|
}
|
|
494
484
|
async deposit(amount) {
|
|
495
|
-
|
|
496
|
-
(0, utils_1.assert)(status === validation_1.DepositStatus.Ready, `Cannot deposit: ${status}`);
|
|
497
|
-
const signer = await this.market.signer.getAddress();
|
|
498
|
-
if (signer.toLowerCase() !== this.account.toLowerCase()) {
|
|
499
|
-
throw Error(`MarketAccount signer ${signer} does not match ${this.account}`);
|
|
500
|
-
}
|
|
501
|
-
return this.market.contract.deposit(amount.raw);
|
|
485
|
+
return (0, viem_write_1.submitPreparedTransaction)(this.market.signer, await this.populateDeposit(amount));
|
|
502
486
|
}
|
|
503
487
|
/* ------ Withdrawals ------ */
|
|
504
488
|
previewQueueWithdrawal(amount) {
|
|
@@ -517,17 +501,18 @@ class MarketAccount {
|
|
|
517
501
|
if (signer.toLowerCase() !== this.account.toLowerCase()) {
|
|
518
502
|
throw Error(`MarketAccount signer ${signer} does not match ${this.account}`);
|
|
519
503
|
}
|
|
520
|
-
const
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
504
|
+
const { hash, receipt } = await (0, viem_write_1.submitPreparedTransactionAndWait)(this.market.provider, this.market.signer, (0, utils_1.prepareTransaction)({
|
|
505
|
+
to: this.market.address,
|
|
506
|
+
abi: abi_1.wildcatMarketAbi,
|
|
507
|
+
functionName: "queueWithdrawal",
|
|
508
|
+
args: [amount.raw]
|
|
509
|
+
}));
|
|
510
|
+
const queuedWithdrawalTransaction = toQueueWithdrawalTransaction(this.market.underlyingToken, receipt, this.market.address);
|
|
526
511
|
const withdrawal = await withdrawal_status_1.LenderWithdrawalStatus.getWithdrawalForLender(this.market, queuedWithdrawalTransaction.expiry, this.account);
|
|
527
512
|
return {
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
513
|
+
hash,
|
|
514
|
+
receipt,
|
|
515
|
+
result: withdrawal
|
|
531
516
|
};
|
|
532
517
|
}
|
|
533
518
|
async queueFullWithdrawal() {
|
|
@@ -537,24 +522,24 @@ class MarketAccount {
|
|
|
537
522
|
if (signer.toLowerCase() !== this.account.toLowerCase()) {
|
|
538
523
|
throw Error(`MarketAccount signer ${signer} does not match ${this.account}`);
|
|
539
524
|
}
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
525
|
+
const { hash, receipt } = await (0, viem_write_1.submitPreparedTransactionAndWait)(this.market.provider, this.market.signer, this.market.version === types_1.MarketVersion.V2
|
|
526
|
+
? (0, utils_1.prepareTransaction)({
|
|
527
|
+
to: this.market.address,
|
|
528
|
+
abi: abi_1.wildcatMarketV2Abi,
|
|
529
|
+
functionName: "queueFullWithdrawal"
|
|
530
|
+
})
|
|
531
|
+
: (0, utils_1.prepareTransaction)({
|
|
532
|
+
to: this.market.address,
|
|
533
|
+
abi: abi_1.wildcatMarketAbi,
|
|
534
|
+
functionName: "queueWithdrawal",
|
|
535
|
+
args: [this.marketBalance.raw]
|
|
536
|
+
}));
|
|
537
|
+
const queuedWithdrawalTransaction = toQueueWithdrawalTransaction(this.market.underlyingToken, receipt, this.market.address);
|
|
553
538
|
const withdrawal = await withdrawal_status_1.LenderWithdrawalStatus.getWithdrawalForLender(this.market, queuedWithdrawalTransaction.expiry, this.account);
|
|
554
539
|
return {
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
540
|
+
hash,
|
|
541
|
+
receipt,
|
|
542
|
+
result: withdrawal
|
|
558
543
|
};
|
|
559
544
|
}
|
|
560
545
|
/* -------------------------------------------------------------------------- */
|
|
@@ -591,13 +576,7 @@ class MarketAccount {
|
|
|
591
576
|
return { status: validation_1.RepayStatus.Ready };
|
|
592
577
|
}
|
|
593
578
|
async repay(amount) {
|
|
594
|
-
|
|
595
|
-
if (signer.toLowerCase() !== this.account.toLowerCase()) {
|
|
596
|
-
throw Error(`MarketAccount signer ${signer} does not match ${this.account}`);
|
|
597
|
-
}
|
|
598
|
-
if (!this.isBorrower)
|
|
599
|
-
throw Error("Only borrower can repay");
|
|
600
|
-
return this.market.contract.repay(amount);
|
|
579
|
+
return (0, viem_write_1.submitPreparedTransaction)(this.market.signer, await this.populateRepay(amount));
|
|
601
580
|
}
|
|
602
581
|
async populateRepay(amount) {
|
|
603
582
|
const signer = await this.market.signer.getAddress();
|
|
@@ -606,23 +585,15 @@ class MarketAccount {
|
|
|
606
585
|
}
|
|
607
586
|
if (!this.isBorrower)
|
|
608
587
|
throw Error("Only borrower can repay");
|
|
609
|
-
return {
|
|
588
|
+
return (0, utils_1.prepareTransaction)({
|
|
610
589
|
to: this.market.address,
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
590
|
+
abi: abi_1.wildcatMarketAbi,
|
|
591
|
+
functionName: "repay",
|
|
592
|
+
args: [(0, token_1.toRawAmount)(amount)]
|
|
593
|
+
});
|
|
614
594
|
}
|
|
615
595
|
async repayOutstandingDebt() {
|
|
616
|
-
|
|
617
|
-
throw Error(`Only V1 supports repayOutstandingDebt`);
|
|
618
|
-
}
|
|
619
|
-
if (!this.isBorrower)
|
|
620
|
-
throw Error("Only borrower can repay");
|
|
621
|
-
const signer = await this.market.signer.getAddress();
|
|
622
|
-
if (signer.toLowerCase() !== this.account.toLowerCase()) {
|
|
623
|
-
throw Error(`MarketAccount signer ${signer} does not match ${this.account}`);
|
|
624
|
-
}
|
|
625
|
-
return this.market.contract.repayOutstandingDebt();
|
|
596
|
+
return (0, viem_write_1.submitPreparedTransaction)(this.market.signer, await this.populateRepayOutstandingDebt());
|
|
626
597
|
}
|
|
627
598
|
async populateRepayOutstandingDebt() {
|
|
628
599
|
if (this.market.version !== types_1.MarketVersion.V1) {
|
|
@@ -634,23 +605,14 @@ class MarketAccount {
|
|
|
634
605
|
if (signer.toLowerCase() !== this.account.toLowerCase()) {
|
|
635
606
|
throw Error(`MarketAccount signer ${signer} does not match ${this.account}`);
|
|
636
607
|
}
|
|
637
|
-
return {
|
|
608
|
+
return (0, utils_1.prepareTransaction)({
|
|
638
609
|
to: this.market.address,
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
};
|
|
610
|
+
abi: abi_1.wildcatMarketAbi,
|
|
611
|
+
functionName: "repayOutstandingDebt"
|
|
612
|
+
});
|
|
642
613
|
}
|
|
643
614
|
async repayDelinquentDebt() {
|
|
644
|
-
|
|
645
|
-
throw Error(`Only V1 supports repayDelinquentDebt`);
|
|
646
|
-
}
|
|
647
|
-
if (!this.isBorrower)
|
|
648
|
-
throw Error("Only borrower can repay");
|
|
649
|
-
const signer = await this.market.signer.getAddress();
|
|
650
|
-
if (signer.toLowerCase() !== this.account.toLowerCase()) {
|
|
651
|
-
throw Error(`MarketAccount signer ${signer} does not match ${this.account}`);
|
|
652
|
-
}
|
|
653
|
-
return this.market.contract.repayDelinquentDebt();
|
|
615
|
+
return (0, viem_write_1.submitPreparedTransaction)(this.market.signer, await this.populateRepayDelinquentDebt());
|
|
654
616
|
}
|
|
655
617
|
async populateRepayDelinquentDebt() {
|
|
656
618
|
if (this.market.version !== types_1.MarketVersion.V1) {
|
|
@@ -662,11 +624,11 @@ class MarketAccount {
|
|
|
662
624
|
if (signer.toLowerCase() !== this.account.toLowerCase()) {
|
|
663
625
|
throw Error(`MarketAccount signer ${signer} does not match ${this.account}`);
|
|
664
626
|
}
|
|
665
|
-
return {
|
|
627
|
+
return (0, utils_1.prepareTransaction)({
|
|
666
628
|
to: this.market.address,
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
};
|
|
629
|
+
abi: abi_1.wildcatMarketAbi,
|
|
630
|
+
functionName: "repayDelinquentDebt"
|
|
631
|
+
});
|
|
670
632
|
}
|
|
671
633
|
/* -------------------------------------------------------------------------- */
|
|
672
634
|
/* Borrow */
|
|
@@ -687,64 +649,69 @@ class MarketAccount {
|
|
|
687
649
|
if (amount.gt(this.market.borrowableAssets)) {
|
|
688
650
|
throw Error("Insufficient borrowable assets");
|
|
689
651
|
}
|
|
690
|
-
return this.market.
|
|
652
|
+
return (0, viem_write_1.submitPreparedTransaction)(this.market.signer, (0, utils_1.prepareTransaction)({
|
|
653
|
+
to: this.market.address,
|
|
654
|
+
abi: abi_1.wildcatMarketAbi,
|
|
655
|
+
functionName: "borrow",
|
|
656
|
+
args: [amount.raw]
|
|
657
|
+
}));
|
|
691
658
|
}
|
|
692
659
|
/* -------------------------------------------------------------------------- */
|
|
693
660
|
/* Updates */
|
|
694
661
|
/* -------------------------------------------------------------------------- */
|
|
695
662
|
async update() {
|
|
696
663
|
if (this.market.version === types_1.MarketVersion.V1) {
|
|
697
|
-
const acccountMarketInfo = await (0,
|
|
664
|
+
const acccountMarketInfo = await (0, market_lens_1.getLegacyMarketLenderStatus)(this.chainId, this.market.provider, this.account, this.market.address);
|
|
698
665
|
this.updateWith(acccountMarketInfo);
|
|
699
666
|
return;
|
|
700
667
|
}
|
|
701
|
-
const accountMarketInfo = await (0,
|
|
668
|
+
const accountMarketInfo = await (0, market_lens_1.getLatestLenderAccountData)(this.chainId, this.market.provider, this.account, this.market.address);
|
|
702
669
|
this.updateWith(accountMarketInfo);
|
|
703
670
|
}
|
|
704
671
|
updateWith(info) {
|
|
705
672
|
if ("isAuthorizedOnController" in info) {
|
|
706
673
|
(0, utils_1.assert)(this.market.version === types_1.MarketVersion.V1, "V2 market can not be updated with V1 lens data");
|
|
707
674
|
this.isAuthorizedOnController = info.isAuthorizedOnController;
|
|
708
|
-
this.role = info.role;
|
|
675
|
+
this.role = (0, utils_1.toNumber)(info.role);
|
|
709
676
|
}
|
|
710
677
|
else {
|
|
711
678
|
(0, utils_1.assert)(this.market.version === types_1.MarketVersion.V2, "V1 market can not be updated with V2 lens data");
|
|
712
679
|
this.credential = {
|
|
713
680
|
canRefresh: info.canRefresh,
|
|
714
681
|
isBlockedFromDeposits: info.isBlockedFromDeposits,
|
|
715
|
-
lastApprovalTimestamp: info.lastApprovalTimestamp,
|
|
682
|
+
lastApprovalTimestamp: (0, utils_1.toNumber)(info.lastApprovalTimestamp),
|
|
716
683
|
lastProvider: {
|
|
717
684
|
isApproved: true,
|
|
718
685
|
providerAddress: info.lastProvider.providerAddress,
|
|
719
|
-
isPullProvider: info.lastProvider.pullProviderIndex !== NullProviderIndex,
|
|
720
|
-
isPushProvider: info.lastProvider.pushProviderIndex !== NullProviderIndex,
|
|
721
|
-
pullProviderIndex: info.lastProvider.pullProviderIndex,
|
|
722
|
-
pushProviderIndex: info.lastProvider.pushProviderIndex,
|
|
723
|
-
timeToLive: info.lastProvider.timeToLive
|
|
686
|
+
isPullProvider: (0, utils_1.toNumber)(info.lastProvider.pullProviderIndex) !== NullProviderIndex,
|
|
687
|
+
isPushProvider: (0, utils_1.toNumber)(info.lastProvider.pushProviderIndex) !== NullProviderIndex,
|
|
688
|
+
pullProviderIndex: (0, utils_1.toNumber)(info.lastProvider.pullProviderIndex),
|
|
689
|
+
pushProviderIndex: (0, utils_1.toNumber)(info.lastProvider.pushProviderIndex),
|
|
690
|
+
timeToLive: (0, utils_1.toNumber)(info.lastProvider.timeToLive)
|
|
724
691
|
}
|
|
725
692
|
};
|
|
726
693
|
this.isKnownLender = info.isKnownLender;
|
|
727
694
|
}
|
|
728
|
-
this.scaledMarketBalance = info.scaledBalance;
|
|
695
|
+
this.scaledMarketBalance = (0, token_1.toRawAmount)(info.scaledBalance);
|
|
729
696
|
this.marketBalance = this.market.marketToken.getAmount(info.normalizedBalance);
|
|
730
697
|
this.underlyingBalance = this.market.underlyingToken.getAmount(info.underlyingBalance);
|
|
731
|
-
this.underlyingApproval = info.underlyingApproval;
|
|
698
|
+
this.underlyingApproval = (0, token_1.toRawAmount)(info.underlyingApproval);
|
|
732
699
|
this.processInterestAccrued();
|
|
733
700
|
}
|
|
734
701
|
calculateInterestEarned() {
|
|
735
702
|
if (!this.lastScaleFactor)
|
|
736
|
-
return
|
|
737
|
-
if (this.scaledMarketBalance
|
|
738
|
-
return
|
|
703
|
+
return 0n;
|
|
704
|
+
if (this.scaledMarketBalance === 0n || this.lastScaleFactor === this.market.scaleFactor) {
|
|
705
|
+
return 0n;
|
|
739
706
|
}
|
|
740
|
-
const lastBalance = (0, utils_1.
|
|
741
|
-
const currentBalance = (0, utils_1.
|
|
742
|
-
return currentBalance
|
|
707
|
+
const lastBalance = (0, utils_1.rayMulBigint)(this.scaledMarketBalance, this.lastScaleFactor);
|
|
708
|
+
const currentBalance = (0, utils_1.rayMulBigint)(this.scaledMarketBalance, this.market.scaleFactor);
|
|
709
|
+
return currentBalance - lastBalance;
|
|
743
710
|
}
|
|
744
711
|
processInterestAccrued() {
|
|
745
712
|
if (!this.lastScaleFactor || !this.totalInterestEarned)
|
|
746
713
|
return;
|
|
747
|
-
if (
|
|
714
|
+
if (this.lastScaleFactor !== this.market.scaleFactor) {
|
|
748
715
|
const interestEarned = this.calculateInterestEarned();
|
|
749
716
|
this.lastScaleFactor = this.market.scaleFactor;
|
|
750
717
|
this.totalInterestEarned = this.totalInterestEarned.add(interestEarned);
|
|
@@ -757,19 +724,19 @@ class MarketAccount {
|
|
|
757
724
|
/* Builders / Getters */
|
|
758
725
|
/* -------------------------------------------------------------------------- */
|
|
759
726
|
static fromSubgraphAccountData(market, data) {
|
|
760
|
-
const scaledBalance =
|
|
727
|
+
const scaledBalance = (0, token_1.toRawAmount)(data.scaledBalance);
|
|
761
728
|
const account = new MarketAccount({
|
|
762
729
|
account: data.address,
|
|
763
730
|
isAuthorizedOnController: data.controllerAuthorization?.authorized ?? false,
|
|
764
731
|
role: (0, utils_1.parseSubgraphLenderStatus)(data.role),
|
|
765
732
|
scaledMarketBalance: scaledBalance,
|
|
766
|
-
marketBalance: market.marketToken.getAmount((0, utils_1.
|
|
733
|
+
marketBalance: market.marketToken.getAmount((0, utils_1.rayMulBigint)(scaledBalance, market.scaleFactor)),
|
|
767
734
|
underlyingBalance: market.underlyingToken.getAmount(0),
|
|
768
|
-
underlyingApproval:
|
|
735
|
+
underlyingApproval: 0n,
|
|
769
736
|
market,
|
|
770
737
|
deposits: data.deposits,
|
|
771
738
|
totalDeposited: market.underlyingToken.getAmount(data.totalDeposited),
|
|
772
|
-
lastScaleFactor:
|
|
739
|
+
lastScaleFactor: (0, token_1.toRawAmount)(data.lastScaleFactor),
|
|
773
740
|
lastUpdatedTimestamp: data.lastUpdatedTimestamp,
|
|
774
741
|
totalInterestEarned: market.underlyingToken.getAmount(data.totalInterestEarned),
|
|
775
742
|
numPendingWithdrawalBatches: data.numPendingWithdrawalBatches,
|
|
@@ -785,10 +752,10 @@ class MarketAccount {
|
|
|
785
752
|
account,
|
|
786
753
|
isAuthorizedOnController: info.isAuthorizedOnController,
|
|
787
754
|
role: info.role,
|
|
788
|
-
scaledMarketBalance: info.scaledBalance,
|
|
755
|
+
scaledMarketBalance: (0, token_1.toRawAmount)(info.scaledBalance),
|
|
789
756
|
marketBalance: market.marketToken.getAmount(info.normalizedBalance),
|
|
790
757
|
underlyingBalance: market.underlyingToken.getAmount(info.underlyingBalance),
|
|
791
|
-
underlyingApproval: info.underlyingApproval,
|
|
758
|
+
underlyingApproval: (0, token_1.toRawAmount)(info.underlyingApproval),
|
|
792
759
|
market
|
|
793
760
|
});
|
|
794
761
|
}
|
|
@@ -798,23 +765,23 @@ class MarketAccount {
|
|
|
798
765
|
market,
|
|
799
766
|
role: LenderRole.Null,
|
|
800
767
|
marketBalance: market.marketToken.getAmount(data.normalizedBalance),
|
|
801
|
-
scaledMarketBalance: data.scaledBalance,
|
|
802
|
-
underlyingApproval: data.underlyingApproval,
|
|
768
|
+
scaledMarketBalance: (0, token_1.toRawAmount)(data.scaledBalance),
|
|
769
|
+
underlyingApproval: (0, token_1.toRawAmount)(data.underlyingApproval),
|
|
803
770
|
underlyingBalance: market.underlyingToken.getAmount(data.underlyingBalance),
|
|
804
771
|
isAuthorizedOnController: false,
|
|
805
772
|
isKnownLender: data.isKnownLender,
|
|
806
773
|
credential: {
|
|
807
774
|
canRefresh: data.canRefresh,
|
|
808
775
|
isBlockedFromDeposits: data.isBlockedFromDeposits,
|
|
809
|
-
lastApprovalTimestamp: data.lastApprovalTimestamp,
|
|
776
|
+
lastApprovalTimestamp: (0, utils_1.toNumber)(data.lastApprovalTimestamp),
|
|
810
777
|
lastProvider: {
|
|
811
778
|
isApproved: true,
|
|
812
779
|
providerAddress: data.lastProvider.providerAddress,
|
|
813
|
-
isPullProvider: data.lastProvider.pullProviderIndex !== NullProviderIndex,
|
|
814
|
-
pullProviderIndex: data.lastProvider.pullProviderIndex,
|
|
815
|
-
isPushProvider: data.lastProvider.pushProviderIndex !== NullProviderIndex,
|
|
816
|
-
pushProviderIndex: data.lastProvider.pushProviderIndex,
|
|
817
|
-
timeToLive: data.lastProvider.timeToLive
|
|
780
|
+
isPullProvider: (0, utils_1.toNumber)(data.lastProvider.pullProviderIndex) !== NullProviderIndex,
|
|
781
|
+
pullProviderIndex: (0, utils_1.toNumber)(data.lastProvider.pullProviderIndex),
|
|
782
|
+
isPushProvider: (0, utils_1.toNumber)(data.lastProvider.pushProviderIndex) !== NullProviderIndex,
|
|
783
|
+
pushProviderIndex: (0, utils_1.toNumber)(data.lastProvider.pushProviderIndex),
|
|
784
|
+
timeToLive: (0, utils_1.toNumber)(data.lastProvider.timeToLive)
|
|
818
785
|
}
|
|
819
786
|
}
|
|
820
787
|
});
|
|
@@ -840,10 +807,10 @@ class MarketAccount {
|
|
|
840
807
|
account,
|
|
841
808
|
isAuthorizedOnController,
|
|
842
809
|
role: LenderRole.Null,
|
|
843
|
-
scaledMarketBalance:
|
|
810
|
+
scaledMarketBalance: 0n,
|
|
844
811
|
marketBalance: market.marketToken.getAmount(0),
|
|
845
812
|
underlyingBalance: market.underlyingToken.getAmount(0),
|
|
846
|
-
underlyingApproval:
|
|
813
|
+
underlyingApproval: 0n,
|
|
847
814
|
market
|
|
848
815
|
});
|
|
849
816
|
}
|
|
@@ -854,19 +821,16 @@ class MarketAccount {
|
|
|
854
821
|
static async getMarketAccount(chainId, provider, account, market) {
|
|
855
822
|
if (market instanceof market_1.Market) {
|
|
856
823
|
if (market.version === types_1.MarketVersion.V1) {
|
|
857
|
-
return (0,
|
|
858
|
-
.getMarketLenderStatus(account, market.address)
|
|
859
|
-
.then((info) => MarketAccount.fromMarketLenderStatus(account, info, market));
|
|
824
|
+
return (0, market_lens_1.getLegacyMarketLenderStatus)(chainId, provider, account, market.address).then((info) => MarketAccount.fromMarketLenderStatus(account, info, market));
|
|
860
825
|
}
|
|
861
|
-
return (0,
|
|
862
|
-
.then((info) => MarketAccount.fromLenderAccountData(market, info));
|
|
826
|
+
return (0, market_lens_1.getLatestLenderAccountData)(chainId, provider, account, market.address).then((info) => MarketAccount.fromLenderAccountData(market, info));
|
|
863
827
|
}
|
|
864
828
|
try {
|
|
865
|
-
const info = await (0,
|
|
829
|
+
const info = await (0, market_lens_1.getLatestMarketDataWithLenderStatus)(chainId, provider, account, market);
|
|
866
830
|
return MarketAccount.fromMarketDataWithLenderStatus(chainId, provider, account, info);
|
|
867
831
|
}
|
|
868
832
|
catch (_) {
|
|
869
|
-
const info = await (0,
|
|
833
|
+
const info = await (0, market_lens_1.getLegacyMarketDataWithLenderStatus)(chainId, provider, account, market);
|
|
870
834
|
return MarketAccount.fromMarketDataWithLenderStatus(chainId, provider, account, info);
|
|
871
835
|
}
|
|
872
836
|
}
|
|
@@ -876,12 +840,9 @@ class MarketAccount {
|
|
|
876
840
|
*/
|
|
877
841
|
static async getMarketAccountV2(chainId, provider, account, market) {
|
|
878
842
|
if (market instanceof market_1.Market) {
|
|
879
|
-
return (0,
|
|
880
|
-
.then((info) => MarketAccount.fromLenderAccountData(market, info));
|
|
843
|
+
return (0, market_lens_1.getLatestLenderAccountData)(chainId, provider, account, market.address).then((info) => MarketAccount.fromLenderAccountData(market, info));
|
|
881
844
|
}
|
|
882
|
-
return (0,
|
|
883
|
-
.getMarketDataWithLenderStatus(account, market)
|
|
884
|
-
.then((info) => MarketAccount.fromMarketDataWithLenderStatus(chainId, provider, account, info));
|
|
845
|
+
return (0, market_lens_1.getLatestMarketDataWithLenderStatus)(chainId, provider, account, market).then((info) => MarketAccount.fromMarketDataWithLenderStatus(chainId, provider, account, info));
|
|
885
846
|
}
|
|
886
847
|
/**
|
|
887
848
|
* Get multiple `MarketAccount`s given an account and existing list of `Market`
|
|
@@ -906,14 +867,14 @@ class MarketAccount {
|
|
|
906
867
|
});
|
|
907
868
|
if (legacyIndexes.length > 0) {
|
|
908
869
|
const legacyMarkets = legacyIndexes.map((index) => markets[index]);
|
|
909
|
-
const infos = await (0,
|
|
870
|
+
const infos = await (0, market_lens_1.getLegacyMarketsLenderStatus)(chainId, provider, account, legacyMarkets.map((market) => market.address));
|
|
910
871
|
infos.forEach((info, i) => {
|
|
911
872
|
results[legacyIndexes[i]] = MarketAccount.fromMarketLenderStatus(account, info, legacyMarkets[i]);
|
|
912
873
|
});
|
|
913
874
|
}
|
|
914
875
|
if (latestIndexes.length > 0) {
|
|
915
876
|
const latestMarkets = latestIndexes.map((index) => markets[index]);
|
|
916
|
-
const infos = await (0,
|
|
877
|
+
const infos = await (0, market_lens_1.getLatestLenderAccountsData)(chainId, provider, account, latestMarkets.map((market) => market.address));
|
|
917
878
|
infos.forEach((info, i) => {
|
|
918
879
|
results[latestIndexes[i]] = MarketAccount.fromLenderAccountData(latestMarkets[i], info);
|
|
919
880
|
});
|
|
@@ -921,11 +882,11 @@ class MarketAccount {
|
|
|
921
882
|
return results;
|
|
922
883
|
}
|
|
923
884
|
try {
|
|
924
|
-
const infos = await (0,
|
|
885
|
+
const infos = await (0, market_lens_1.getLatestMarketsDataWithLenderStatus)(chainId, provider, account, markets);
|
|
925
886
|
return MarketAccount.hydrateMarketAccounts(chainId, provider, account, infos);
|
|
926
887
|
}
|
|
927
888
|
catch (_) {
|
|
928
|
-
const infos = await (0,
|
|
889
|
+
const infos = await (0, market_lens_1.getLegacyMarketsDataWithLenderStatus)(chainId, provider, account, markets);
|
|
929
890
|
return MarketAccount.hydrateMarketAccounts(chainId, provider, account, infos);
|
|
930
891
|
}
|
|
931
892
|
}
|
|
@@ -935,14 +896,14 @@ class MarketAccount {
|
|
|
935
896
|
*/
|
|
936
897
|
static async getAllMarketAccountsForLender(chainId, provider, account) {
|
|
937
898
|
if (hasUnifiedLatestLensForAccountReads(chainId)) {
|
|
938
|
-
const markets = await (0,
|
|
899
|
+
const markets = await (0, arch_controller_1.getRegisteredMarkets)(chainId, provider);
|
|
939
900
|
if (markets.length === 0) {
|
|
940
901
|
return [];
|
|
941
902
|
}
|
|
942
|
-
const infos = await (0,
|
|
903
|
+
const infos = await (0, market_lens_1.getLatestMarketsDataWithLenderStatus)(chainId, provider, account, markets);
|
|
943
904
|
return MarketAccount.hydrateMarketAccounts(chainId, provider, account, infos);
|
|
944
905
|
}
|
|
945
|
-
const infos = await (0,
|
|
906
|
+
const infos = await (0, market_lens_1.getLegacyAllMarketsDataWithLenderStatus)(chainId, provider, account);
|
|
946
907
|
return MarketAccount.hydrateMarketAccounts(chainId, provider, account, infos);
|
|
947
908
|
}
|
|
948
909
|
/**
|
|
@@ -955,31 +916,39 @@ class MarketAccount {
|
|
|
955
916
|
if (count <= 0) {
|
|
956
917
|
return [];
|
|
957
918
|
}
|
|
958
|
-
const
|
|
959
|
-
const totalMarkets = (await archController.getRegisteredMarketsCount()).toNumber();
|
|
919
|
+
const totalMarkets = await (0, arch_controller_1.getRegisteredMarketsCount)(chainId, provider);
|
|
960
920
|
if (start >= totalMarkets) {
|
|
961
921
|
return [];
|
|
962
922
|
}
|
|
963
923
|
const end = Math.min(start + count, totalMarkets);
|
|
964
|
-
const markets = await
|
|
924
|
+
const markets = await (0, arch_controller_1.getRegisteredMarketsPage)(chainId, provider, start, end);
|
|
965
925
|
if (markets.length === 0) {
|
|
966
926
|
return [];
|
|
967
927
|
}
|
|
968
|
-
const infos = await (0,
|
|
928
|
+
const infos = await (0, market_lens_1.getLatestMarketsDataWithLenderStatus)(chainId, provider, account, markets);
|
|
969
929
|
return MarketAccount.hydrateMarketAccounts(chainId, provider, account, infos);
|
|
970
930
|
}
|
|
971
|
-
const infos = await (0,
|
|
931
|
+
const infos = await (0, market_lens_1.getLegacyPaginatedMarketsDataWithLenderStatus)(chainId, provider, account, start, count);
|
|
972
932
|
return MarketAccount.hydrateMarketAccounts(chainId, provider, account, infos);
|
|
973
933
|
}
|
|
974
934
|
}
|
|
975
935
|
exports.MarketAccount = MarketAccount;
|
|
976
|
-
const toQueueWithdrawalTransaction = (underlyingToken,
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
936
|
+
const toQueueWithdrawalTransaction = (underlyingToken, receipt, marketAddress) => {
|
|
937
|
+
const event = (0, viem_1.parseEventLogs)({
|
|
938
|
+
abi: abi_1.wildcatMarketAbi,
|
|
939
|
+
eventName: "WithdrawalQueued",
|
|
940
|
+
logs: receipt.logs
|
|
941
|
+
})[0];
|
|
942
|
+
if (!event)
|
|
943
|
+
throw Error("No queued withdrawal event found");
|
|
944
|
+
return {
|
|
945
|
+
transactionHash: receipt.transactionHash,
|
|
946
|
+
blockNumber: Number(receipt.blockNumber),
|
|
947
|
+
expiry: Number(event.args.expiry),
|
|
948
|
+
lender: event.args.account,
|
|
949
|
+
market: marketAddress,
|
|
950
|
+
scaledAmount: (0, token_1.toRawAmount)(event.args.scaledAmount),
|
|
951
|
+
originalAmount: underlyingToken.getAmount(event.args.normalizedAmount)
|
|
952
|
+
};
|
|
953
|
+
};
|
|
985
954
|
//# sourceMappingURL=index.js.map
|