@gauntlet-xyz/sdk 2.3.0 → 3.0.1
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 +135 -0
- package/dist/api/activity.d.ts +1 -1
- package/dist/api/activity.d.ts.map +1 -1
- package/dist/api/caip.d.ts +1 -1
- package/dist/api/caip.d.ts.map +1 -1
- package/dist/api/client.d.ts +65 -6
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/errors.d.ts +1 -1
- package/dist/api/errors.d.ts.map +1 -1
- package/dist/api/generated.d.ts +621 -14
- package/dist/api/generated.d.ts.map +1 -1
- package/dist/api/index.d.ts +13 -13
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +48 -8
- package/dist/api/index.js.map +7 -1
- package/dist/api/positionHistory.d.ts +1 -1
- package/dist/api/positionHistory.d.ts.map +1 -1
- package/dist/attribution/index.d.ts +3 -3
- package/dist/attribution/index.d.ts.map +1 -1
- package/dist/chunk-7TA2OJUK.js +4364 -0
- package/dist/chunk-7TA2OJUK.js.map +7 -0
- package/dist/chunk-HC2BS7MK.js +439 -0
- package/dist/chunk-HC2BS7MK.js.map +7 -0
- package/dist/chunk-S2TTA45N.js +2009 -0
- package/dist/chunk-S2TTA45N.js.map +7 -0
- package/dist/chunk-STIV2CC4.js +57 -0
- package/dist/chunk-STIV2CC4.js.map +7 -0
- package/dist/chunk-SU6JAKIA.js +283 -0
- package/dist/chunk-SU6JAKIA.js.map +7 -0
- package/dist/cjs/api/activity.d.ts +70 -0
- package/dist/cjs/api/activity.d.ts.map +1 -0
- package/dist/cjs/api/activity.js +136 -0
- package/dist/cjs/api/activity.js.map +7 -0
- package/dist/cjs/api/caip.d.ts +29 -0
- package/dist/cjs/api/caip.d.ts.map +1 -0
- package/dist/cjs/api/caip.js +59 -0
- package/dist/cjs/api/caip.js.map +7 -0
- package/dist/cjs/api/client.d.ts +173 -0
- package/dist/cjs/api/client.d.ts.map +1 -0
- package/dist/cjs/api/client.js +171 -0
- package/dist/cjs/api/client.js.map +7 -0
- package/dist/cjs/api/decimal.d.ts +21 -0
- package/dist/cjs/api/decimal.d.ts.map +1 -0
- package/dist/cjs/api/decimal.js +60 -0
- package/dist/cjs/api/decimal.js.map +7 -0
- package/dist/cjs/api/errors.d.ts +32 -0
- package/dist/cjs/api/errors.d.ts.map +1 -0
- package/dist/cjs/api/errors.js +80 -0
- package/dist/cjs/api/errors.js.map +7 -0
- package/dist/cjs/api/generated.d.ts +2068 -0
- package/dist/cjs/api/generated.d.ts.map +1 -0
- package/dist/cjs/api/generated.js +17 -0
- package/dist/cjs/api/generated.js.map +7 -0
- package/dist/cjs/api/http.d.ts +16 -0
- package/dist/cjs/api/http.d.ts.map +1 -0
- package/dist/cjs/api/http.js +64 -0
- package/dist/cjs/api/http.js.map +7 -0
- package/dist/cjs/api/index.d.ts +14 -0
- package/dist/cjs/api/index.d.ts.map +1 -0
- package/dist/cjs/api/index.js +73 -0
- package/dist/cjs/api/index.js.map +7 -0
- package/dist/cjs/api/positionHistory.d.ts +44 -0
- package/dist/cjs/api/positionHistory.d.ts.map +1 -0
- package/dist/cjs/api/positionHistory.js +131 -0
- package/dist/cjs/api/positionHistory.js.map +7 -0
- package/dist/cjs/attribution/erc8021.d.ts +9 -0
- package/dist/cjs/attribution/erc8021.d.ts.map +1 -0
- package/dist/cjs/attribution/erc8021.js +37 -0
- package/dist/cjs/attribution/erc8021.js.map +7 -0
- package/dist/cjs/attribution/index.d.ts +25 -0
- package/dist/cjs/attribution/index.d.ts.map +1 -0
- package/dist/cjs/attribution/index.js +68 -0
- package/dist/cjs/attribution/index.js.map +7 -0
- package/dist/cjs/client.d.ts +72 -0
- package/dist/cjs/client.d.ts.map +1 -0
- package/dist/cjs/client.js +80 -0
- package/dist/cjs/client.js.map +7 -0
- package/dist/cjs/constants.d.ts +16 -0
- package/dist/cjs/constants.d.ts.map +1 -0
- package/dist/cjs/constants.js +83 -0
- package/dist/cjs/constants.js.map +7 -0
- package/dist/cjs/errors.d.ts +85 -0
- package/dist/cjs/errors.d.ts.map +1 -0
- package/dist/cjs/errors.js +210 -0
- package/dist/cjs/errors.js.map +7 -0
- package/dist/cjs/evm/abis/erc20.d.ts +41 -0
- package/dist/cjs/evm/abis/erc20.d.ts.map +1 -0
- package/dist/cjs/evm/abis/erc20.js +57 -0
- package/dist/cjs/evm/abis/erc20.js.map +7 -0
- package/dist/cjs/evm/abis/erc4626.d.ts +105 -0
- package/dist/cjs/evm/abis/erc4626.d.ts.map +1 -0
- package/dist/cjs/evm/abis/erc4626.js +97 -0
- package/dist/cjs/evm/abis/erc4626.js.map +7 -0
- package/dist/cjs/evm/abis/multiDepositorVault.d.ts +1048 -0
- package/dist/cjs/evm/abis/multiDepositorVault.d.ts.map +1 -0
- package/dist/cjs/evm/abis/multiDepositorVault.js +614 -0
- package/dist/cjs/evm/abis/multiDepositorVault.js.map +7 -0
- package/dist/cjs/evm/abis/priceAndFeeCalculator.d.ts +910 -0
- package/dist/cjs/evm/abis/priceAndFeeCalculator.d.ts.map +1 -0
- package/dist/cjs/evm/abis/priceAndFeeCalculator.js +517 -0
- package/dist/cjs/evm/abis/priceAndFeeCalculator.js.map +7 -0
- package/dist/cjs/evm/abis/priceAndFeeCalculatorV2.d.ts +277 -0
- package/dist/cjs/evm/abis/priceAndFeeCalculatorV2.d.ts.map +1 -0
- package/dist/cjs/evm/abis/priceAndFeeCalculatorV2.js +166 -0
- package/dist/cjs/evm/abis/priceAndFeeCalculatorV2.js.map +7 -0
- package/dist/cjs/evm/abis/provisioner.d.ts +4984 -0
- package/dist/cjs/evm/abis/provisioner.d.ts.map +1 -0
- package/dist/cjs/evm/abis/provisioner.js +2785 -0
- package/dist/cjs/evm/abis/provisioner.js.map +7 -0
- package/dist/cjs/evm/abis/provisionerV2.d.ts +740 -0
- package/dist/cjs/evm/abis/provisionerV2.d.ts.map +1 -0
- package/dist/cjs/evm/abis/provisionerV2.js +320 -0
- package/dist/cjs/evm/abis/provisionerV2.js.map +7 -0
- package/dist/cjs/evm/adapters/aera.d.ts +6 -0
- package/dist/cjs/evm/adapters/aera.d.ts.map +1 -0
- package/dist/cjs/evm/adapters/aera.js +491 -0
- package/dist/cjs/evm/adapters/aera.js.map +7 -0
- package/dist/cjs/evm/adapters/index.d.ts +3 -0
- package/dist/cjs/evm/adapters/index.d.ts.map +1 -0
- package/dist/cjs/evm/adapters/index.js +41 -0
- package/dist/cjs/evm/adapters/index.js.map +7 -0
- package/dist/cjs/evm/adapters/morpho.d.ts +3 -0
- package/dist/cjs/evm/adapters/morpho.d.ts.map +1 -0
- package/dist/cjs/evm/adapters/morpho.js +103 -0
- package/dist/cjs/evm/adapters/morpho.js.map +7 -0
- package/dist/cjs/evm/adapters/types.d.ts +84 -0
- package/dist/cjs/evm/adapters/types.d.ts.map +1 -0
- package/dist/cjs/evm/adapters/types.js +17 -0
- package/dist/cjs/evm/adapters/types.js.map +7 -0
- package/dist/cjs/evm/aeraContracts/priceAndFeeCalculator.d.ts +46 -0
- package/dist/cjs/evm/aeraContracts/priceAndFeeCalculator.d.ts.map +1 -0
- package/dist/cjs/evm/aeraContracts/priceAndFeeCalculator.js +223 -0
- package/dist/cjs/evm/aeraContracts/priceAndFeeCalculator.js.map +7 -0
- package/dist/cjs/evm/aeraContracts/readOptions.d.ts +8 -0
- package/dist/cjs/evm/aeraContracts/readOptions.d.ts.map +1 -0
- package/dist/cjs/evm/aeraContracts/readOptions.js +31 -0
- package/dist/cjs/evm/aeraContracts/readOptions.js.map +7 -0
- package/dist/cjs/evm/aeraContracts/v1.d.ts +2317 -0
- package/dist/cjs/evm/aeraContracts/v1.d.ts.map +1 -0
- package/dist/cjs/evm/aeraContracts/v1.js +120 -0
- package/dist/cjs/evm/aeraContracts/v1.js.map +7 -0
- package/dist/cjs/evm/aeraContracts/v2.d.ts +4538 -0
- package/dist/cjs/evm/aeraContracts/v2.d.ts.map +1 -0
- package/dist/cjs/evm/aeraContracts/v2.js +449 -0
- package/dist/cjs/evm/aeraContracts/v2.js.map +7 -0
- package/dist/cjs/evm/aeraContracts.d.ts +33 -0
- package/dist/cjs/evm/aeraContracts.d.ts.map +1 -0
- package/dist/cjs/evm/aeraContracts.js +224 -0
- package/dist/cjs/evm/aeraContracts.js.map +7 -0
- package/dist/cjs/evm/deposit.d.ts +50 -0
- package/dist/cjs/evm/deposit.d.ts.map +1 -0
- package/dist/cjs/evm/deposit.js +112 -0
- package/dist/cjs/evm/deposit.js.map +7 -0
- package/dist/cjs/evm/depositQuote.d.ts +32 -0
- package/dist/cjs/evm/depositQuote.d.ts.map +1 -0
- package/dist/cjs/evm/depositQuote.js +96 -0
- package/dist/cjs/evm/depositQuote.js.map +7 -0
- package/dist/cjs/evm/depositReceiverApproval.d.ts +17 -0
- package/dist/cjs/evm/depositReceiverApproval.d.ts.map +1 -0
- package/dist/cjs/evm/depositReceiverApproval.js +66 -0
- package/dist/cjs/evm/depositReceiverApproval.js.map +7 -0
- package/dist/cjs/evm/index.d.ts +28 -0
- package/dist/cjs/evm/index.d.ts.map +1 -0
- package/dist/cjs/evm/index.js +116 -0
- package/dist/cjs/evm/index.js.map +7 -0
- package/dist/cjs/evm/operationMode.d.ts +9 -0
- package/dist/cjs/evm/operationMode.d.ts.map +1 -0
- package/dist/cjs/evm/operationMode.js +65 -0
- package/dist/cjs/evm/operationMode.js.map +7 -0
- package/dist/cjs/evm/tokenModes.d.ts +22 -0
- package/dist/cjs/evm/tokenModes.d.ts.map +1 -0
- package/dist/cjs/evm/tokenModes.js +47 -0
- package/dist/cjs/evm/tokenModes.js.map +7 -0
- package/dist/cjs/evm/types.d.ts +34 -0
- package/dist/cjs/evm/types.d.ts.map +1 -0
- package/dist/cjs/evm/types.js +32 -0
- package/dist/cjs/evm/types.js.map +7 -0
- package/dist/cjs/evm/userCurrentBalance.d.ts +55 -0
- package/dist/cjs/evm/userCurrentBalance.d.ts.map +1 -0
- package/dist/cjs/evm/userCurrentBalance.js +225 -0
- package/dist/cjs/evm/userCurrentBalance.js.map +7 -0
- package/dist/cjs/evm/vaults.d.ts +44 -0
- package/dist/cjs/evm/vaults.d.ts.map +1 -0
- package/dist/cjs/evm/vaults.js +78 -0
- package/dist/cjs/evm/vaults.js.map +7 -0
- package/dist/cjs/evm/withdraw.d.ts +73 -0
- package/dist/cjs/evm/withdraw.d.ts.map +1 -0
- package/dist/cjs/evm/withdraw.js +161 -0
- package/dist/cjs/evm/withdraw.js.map +7 -0
- package/dist/cjs/evm/withdrawQuote.d.ts +135 -0
- package/dist/cjs/evm/withdrawQuote.d.ts.map +1 -0
- package/dist/cjs/evm/withdrawQuote.js +256 -0
- package/dist/cjs/evm/withdrawQuote.js.map +7 -0
- package/dist/cjs/index.d.ts +31 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +128 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/privy/index.d.ts +52 -0
- package/dist/cjs/privy/index.d.ts.map +1 -0
- package/dist/cjs/privy/index.js +57 -0
- package/dist/cjs/privy/index.js.map +7 -0
- package/dist/client.d.ts +4 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/errors.d.ts +15 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/evm/abis/priceAndFeeCalculatorV2.d.ts +44 -0
- package/dist/evm/abis/priceAndFeeCalculatorV2.d.ts.map +1 -1
- package/dist/evm/abis/provisionerV2.d.ts +56 -0
- package/dist/evm/abis/provisionerV2.d.ts.map +1 -1
- package/dist/evm/adapters/aera.d.ts +1 -1
- package/dist/evm/adapters/aera.d.ts.map +1 -1
- package/dist/evm/adapters/index.d.ts +1 -1
- package/dist/evm/adapters/index.d.ts.map +1 -1
- package/dist/evm/adapters/morpho.d.ts +1 -1
- package/dist/evm/adapters/morpho.d.ts.map +1 -1
- package/dist/evm/adapters/types.d.ts +6 -2
- package/dist/evm/adapters/types.d.ts.map +1 -1
- package/dist/evm/aeraContracts/priceAndFeeCalculator.d.ts +11 -6
- package/dist/evm/aeraContracts/priceAndFeeCalculator.d.ts.map +1 -1
- package/dist/evm/aeraContracts/readOptions.d.ts +8 -0
- package/dist/evm/aeraContracts/readOptions.d.ts.map +1 -0
- package/dist/evm/aeraContracts/v1.d.ts +2 -2
- package/dist/evm/aeraContracts/v1.d.ts.map +1 -1
- package/dist/evm/aeraContracts/v2.d.ts +396 -4
- package/dist/evm/aeraContracts/v2.d.ts.map +1 -1
- package/dist/evm/aeraContracts.d.ts +11 -5
- package/dist/evm/aeraContracts.d.ts.map +1 -1
- package/dist/evm/deposit.d.ts +4 -2
- package/dist/evm/deposit.d.ts.map +1 -1
- package/dist/evm/depositQuote.d.ts +32 -0
- package/dist/evm/depositQuote.d.ts.map +1 -0
- package/dist/evm/depositReceiverApproval.d.ts +2 -2
- package/dist/evm/depositReceiverApproval.d.ts.map +1 -1
- package/dist/evm/index.d.ts +27 -17
- package/dist/evm/index.d.ts.map +1 -1
- package/dist/evm/index.js +88 -9
- package/dist/evm/index.js.map +7 -1
- package/dist/evm/tokenModes.d.ts +22 -0
- package/dist/evm/tokenModes.d.ts.map +1 -0
- package/dist/evm/userCurrentBalance.d.ts +6 -2
- package/dist/evm/userCurrentBalance.d.ts.map +1 -1
- package/dist/evm/vaults.d.ts +2 -9
- package/dist/evm/vaults.d.ts.map +1 -1
- package/dist/evm/withdraw.d.ts +10 -2
- package/dist/evm/withdraw.d.ts.map +1 -1
- package/dist/evm/withdrawQuote.d.ts +135 -0
- package/dist/evm/withdrawQuote.d.ts.map +1 -0
- package/dist/index.d.ts +30 -22
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +139 -12
- package/dist/index.js.map +7 -1
- package/dist/manifest/vaults.json +1958 -0
- package/dist/privy/index.d.ts +1 -1
- package/dist/privy/index.d.ts.map +1 -1
- package/dist/privy/index.js +39 -48
- package/dist/privy/index.js.map +7 -1
- package/manifest/vaults.json +45 -460
- package/package.json +43 -9
- package/src/api/client.ts +104 -7
- package/src/api/generated.ts +621 -14
- package/src/api/index.ts +13 -0
- package/src/client.ts +4 -1
- package/src/constants.ts +2 -0
- package/src/errors.ts +39 -2
- package/src/evm/abis/priceAndFeeCalculatorV2.ts +22 -0
- package/src/evm/abis/provisionerV2.ts +33 -0
- package/src/evm/adapters/aera.ts +64 -34
- package/src/evm/adapters/types.ts +4 -0
- package/src/evm/aeraContracts/priceAndFeeCalculator.ts +72 -5
- package/src/evm/aeraContracts/readOptions.ts +3 -0
- package/src/evm/aeraContracts/v2.ts +273 -41
- package/src/evm/aeraContracts.ts +81 -8
- package/src/evm/deposit.ts +21 -8
- package/src/evm/depositQuote.ts +137 -0
- package/src/evm/index.ts +41 -0
- package/src/evm/tokenModes.ts +54 -0
- package/src/evm/userCurrentBalance.ts +12 -1
- package/src/evm/vaults.ts +0 -7
- package/src/evm/withdraw.ts +131 -7
- package/src/evm/withdrawQuote.ts +434 -0
- package/src/index.ts +26 -1
- package/dist/api/activity.js +0 -154
- package/dist/api/activity.js.map +0 -1
- package/dist/api/caip.js +0 -38
- package/dist/api/caip.js.map +0 -1
- package/dist/api/client.js +0 -109
- package/dist/api/client.js.map +0 -1
- package/dist/api/decimal.js +0 -44
- package/dist/api/decimal.js.map +0 -1
- package/dist/api/errors.js +0 -41
- package/dist/api/errors.js.map +0 -1
- package/dist/api/generated.js +0 -6
- package/dist/api/generated.js.map +0 -1
- package/dist/api/http.js +0 -39
- package/dist/api/http.js.map +0 -1
- package/dist/api/positionHistory.js +0 -126
- package/dist/api/positionHistory.js.map +0 -1
- package/dist/attribution/erc8021.js +0 -17
- package/dist/attribution/erc8021.js.map +0 -1
- package/dist/attribution/index.js +0 -45
- package/dist/attribution/index.js.map +0 -1
- package/dist/client.js +0 -72
- package/dist/client.js.map +0 -1
- package/dist/constants.js +0 -28
- package/dist/constants.js.map +0 -1
- package/dist/errors.js +0 -115
- package/dist/errors.js.map +0 -1
- package/dist/evm/abis/erc20.js +0 -30
- package/dist/evm/abis/erc20.js.map +0 -1
- package/dist/evm/abis/erc4626.js +0 -70
- package/dist/evm/abis/erc4626.js.map +0 -1
- package/dist/evm/abis/multiDepositorVault.js +0 -587
- package/dist/evm/abis/multiDepositorVault.js.map +0 -1
- package/dist/evm/abis/priceAndFeeCalculator.js +0 -490
- package/dist/evm/abis/priceAndFeeCalculator.js.map +0 -1
- package/dist/evm/abis/priceAndFeeCalculatorV2.js +0 -119
- package/dist/evm/abis/priceAndFeeCalculatorV2.js.map +0 -1
- package/dist/evm/abis/provisioner.js +0 -2768
- package/dist/evm/abis/provisioner.js.map +0 -1
- package/dist/evm/abis/provisionerV2.js +0 -262
- package/dist/evm/abis/provisionerV2.js.map +0 -1
- package/dist/evm/adapters/aera.js +0 -249
- package/dist/evm/adapters/aera.js.map +0 -1
- package/dist/evm/adapters/index.js +0 -14
- package/dist/evm/adapters/index.js.map +0 -1
- package/dist/evm/adapters/morpho.js +0 -79
- package/dist/evm/adapters/morpho.js.map +0 -1
- package/dist/evm/adapters/types.js +0 -2
- package/dist/evm/adapters/types.js.map +0 -1
- package/dist/evm/aeraContracts/priceAndFeeCalculator.js +0 -140
- package/dist/evm/aeraContracts/priceAndFeeCalculator.js.map +0 -1
- package/dist/evm/aeraContracts/v1.js +0 -59
- package/dist/evm/aeraContracts/v1.js.map +0 -1
- package/dist/evm/aeraContracts/v2.js +0 -217
- package/dist/evm/aeraContracts/v2.js.map +0 -1
- package/dist/evm/aeraContracts.js +0 -134
- package/dist/evm/aeraContracts.js.map +0 -1
- package/dist/evm/deposit.js +0 -109
- package/dist/evm/deposit.js.map +0 -1
- package/dist/evm/depositReceiverApproval.js +0 -32
- package/dist/evm/depositReceiverApproval.js.map +0 -1
- package/dist/evm/operationMode.js +0 -41
- package/dist/evm/operationMode.js.map +0 -1
- package/dist/evm/types.js +0 -5
- package/dist/evm/types.js.map +0 -1
- package/dist/evm/userCurrentBalance.js +0 -211
- package/dist/evm/userCurrentBalance.js.map +0 -1
- package/dist/evm/vaults.js +0 -75
- package/dist/evm/vaults.js.map +0 -1
- package/dist/evm/withdraw.js +0 -97
- package/dist/evm/withdraw.js.map +0 -1
package/src/api/index.ts
CHANGED
|
@@ -3,18 +3,26 @@ export type {
|
|
|
3
3
|
ActivityOptions,
|
|
4
4
|
AmountPair,
|
|
5
5
|
ChainSyncStatus,
|
|
6
|
+
FeaturedVault,
|
|
7
|
+
FeaturedVaultsResponse,
|
|
6
8
|
HealthResponse,
|
|
7
9
|
LatestPriceOptions,
|
|
8
10
|
LatestPriceResponse,
|
|
9
11
|
PageOptions,
|
|
10
12
|
PartialResponseError,
|
|
13
|
+
PositionsOptions,
|
|
11
14
|
PositionTimeseriesPoint,
|
|
12
15
|
PriceTimeseriesOptions,
|
|
13
16
|
PriceTimeseriesResponse,
|
|
17
|
+
StrategyCard,
|
|
18
|
+
StrategyListResponse,
|
|
14
19
|
TimeseriesMeta,
|
|
15
20
|
TimeWindowOptions,
|
|
16
21
|
TokenRef,
|
|
22
|
+
TvlBreakdownMode,
|
|
17
23
|
TvlResponse,
|
|
24
|
+
TvlTimeseriesPoint,
|
|
25
|
+
TvlTimeseriesResponse,
|
|
18
26
|
UserActivity,
|
|
19
27
|
UserActivityResponse,
|
|
20
28
|
UserAllPositionsResponse,
|
|
@@ -23,7 +31,12 @@ export type {
|
|
|
23
31
|
UserPositionsTimeseriesResponse,
|
|
24
32
|
VaultDetail,
|
|
25
33
|
VaultDetailResponse,
|
|
34
|
+
VaultAllocations,
|
|
35
|
+
VaultAllocationsResponse,
|
|
26
36
|
VaultMetrics,
|
|
37
|
+
VaultsOptions,
|
|
38
|
+
VaultGroupTimeseriesPoint,
|
|
39
|
+
VaultGroupTimeseriesResponse,
|
|
27
40
|
VaultTimeseriesPoint,
|
|
28
41
|
VaultTimeseriesResponse,
|
|
29
42
|
} from './client';
|
package/src/client.ts
CHANGED
|
@@ -20,6 +20,9 @@ export enum AttributionMode {
|
|
|
20
20
|
|
|
21
21
|
export type ChainId = string | number;
|
|
22
22
|
|
|
23
|
+
/** The static vault manifest bundled with this SDK release; the GauntletClient default. */
|
|
24
|
+
export const bundledVaultManifest = bundledManifest as VaultManifest;
|
|
25
|
+
|
|
23
26
|
export interface GauntletClientConfig {
|
|
24
27
|
/** Gaia API key, sent as `x-api-key` on `client.api` requests. Anonymous access is rate-limited. */
|
|
25
28
|
apiKey?: string;
|
|
@@ -68,7 +71,7 @@ export class GauntletClient {
|
|
|
68
71
|
/** Typed client for the Gaia REST API (vaults, positions, activity, tvl, prices). */
|
|
69
72
|
readonly api: GauntletApi;
|
|
70
73
|
|
|
71
|
-
private _manifest: VaultManifest =
|
|
74
|
+
private _manifest: VaultManifest = bundledVaultManifest;
|
|
72
75
|
|
|
73
76
|
constructor(config: GauntletClientConfig) {
|
|
74
77
|
this.apiKey = config.apiKey;
|
package/src/constants.ts
CHANGED
|
@@ -17,6 +17,7 @@ export const CHAIN_NAMES: Record<number, string> = {
|
|
|
17
17
|
8453: 'base',
|
|
18
18
|
42161: 'arbitrum',
|
|
19
19
|
10: 'optimism',
|
|
20
|
+
5042: 'arc',
|
|
20
21
|
};
|
|
21
22
|
|
|
22
23
|
// Approximate 3-day block lookback per chain based on avg block time.
|
|
@@ -25,6 +26,7 @@ export const BLOCKS_3_DAYS: Record<number, bigint> = {
|
|
|
25
26
|
8453: 129_600n,
|
|
26
27
|
42161: 1_036_800n,
|
|
27
28
|
10: 129_600n,
|
|
29
|
+
5042: 518_400n,
|
|
28
30
|
};
|
|
29
31
|
export const DEFAULT_BLOCKS_3_DAYS = 129_600n;
|
|
30
32
|
|
package/src/errors.ts
CHANGED
|
@@ -53,7 +53,7 @@ export class UnsupportedDepositModeError extends GauntletSDKError {
|
|
|
53
53
|
readonly available: string;
|
|
54
54
|
|
|
55
55
|
constructor(vaultId: string, requested: string, available: string) {
|
|
56
|
-
super(`Vault "${vaultId}" does not support ${requested}
|
|
56
|
+
super(`Vault "${vaultId}" does not support ${requested} operations (available: ${available})`);
|
|
57
57
|
this.name = 'UnsupportedDepositModeError';
|
|
58
58
|
this.vaultId = vaultId;
|
|
59
59
|
this.requested = requested;
|
|
@@ -73,11 +73,25 @@ export class RpcNotConfiguredError extends GauntletSDKError {
|
|
|
73
73
|
|
|
74
74
|
export class AccountRequiredError extends GauntletSDKError {
|
|
75
75
|
constructor() {
|
|
76
|
-
super(
|
|
76
|
+
super(
|
|
77
|
+
'No account specified. Pass the required account, or configure a wallet when building transactions.'
|
|
78
|
+
);
|
|
77
79
|
this.name = 'AccountRequiredError';
|
|
78
80
|
}
|
|
79
81
|
}
|
|
80
82
|
|
|
83
|
+
export class AccountMismatchError extends GauntletSDKError {
|
|
84
|
+
readonly expected: string;
|
|
85
|
+
readonly received: string;
|
|
86
|
+
|
|
87
|
+
constructor(expected: string, received: string) {
|
|
88
|
+
super(`Account mismatch: expected "${expected}", received "${received}"`);
|
|
89
|
+
this.name = 'AccountMismatchError';
|
|
90
|
+
this.expected = expected;
|
|
91
|
+
this.received = received;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
81
95
|
export class UnsupportedProtocolError extends GauntletSDKError {
|
|
82
96
|
readonly protocol: string;
|
|
83
97
|
|
|
@@ -95,6 +109,22 @@ export class InvalidWithdrawParamsError extends GauntletSDKError {
|
|
|
95
109
|
}
|
|
96
110
|
}
|
|
97
111
|
|
|
112
|
+
export type SyncWithdrawBound = 'tokensOut' | 'minTokensOut' | 'unitsIn' | 'maxUnitsIn';
|
|
113
|
+
|
|
114
|
+
export class InvalidSyncWithdrawBoundError extends GauntletSDKError {
|
|
115
|
+
readonly bound: SyncWithdrawBound;
|
|
116
|
+
|
|
117
|
+
constructor(bound: SyncWithdrawBound) {
|
|
118
|
+
super(`Sync withdraw cannot submit zero ${bound}; increase the amount or reduce slippage`);
|
|
119
|
+
this.name = 'InvalidSyncWithdrawBoundError';
|
|
120
|
+
this.bound = bound;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export function requireNonZeroSyncWithdrawBound(value: bigint, bound: SyncWithdrawBound) {
|
|
125
|
+
if (value === 0n) throw new InvalidSyncWithdrawBoundError(bound);
|
|
126
|
+
}
|
|
127
|
+
|
|
98
128
|
export class UnimplementedFeatureError extends GauntletSDKError {
|
|
99
129
|
readonly feature: string;
|
|
100
130
|
|
|
@@ -172,3 +202,10 @@ export class InvalidSlippageBPSError extends GauntletSDKError {
|
|
|
172
202
|
this.slippage = slippage;
|
|
173
203
|
}
|
|
174
204
|
}
|
|
205
|
+
|
|
206
|
+
export class InvalidSyncDepositBoundError extends GauntletSDKError {
|
|
207
|
+
constructor() {
|
|
208
|
+
super('Sync deposit minUnitsOut requires explicit sync mode and must be greater than zero');
|
|
209
|
+
this.name = 'InvalidSyncDepositBoundError';
|
|
210
|
+
}
|
|
211
|
+
}
|
|
@@ -47,6 +47,28 @@ export const priceAndFeeCalculatorV2Abi = [
|
|
|
47
47
|
outputs: [{ name: 'tokenAmount', internalType: 'uint256', type: 'uint256' }],
|
|
48
48
|
stateMutability: 'view',
|
|
49
49
|
},
|
|
50
|
+
{
|
|
51
|
+
type: 'function',
|
|
52
|
+
inputs: [
|
|
53
|
+
{ name: 'vault', internalType: 'address', type: 'address' },
|
|
54
|
+
{ name: 'token', internalType: 'contract IERC20', type: 'address' },
|
|
55
|
+
{ name: 'tokenAmount', internalType: 'uint256', type: 'uint256' },
|
|
56
|
+
],
|
|
57
|
+
name: 'convertTokenToNumeraire',
|
|
58
|
+
outputs: [{ name: 'numeraireAmount', internalType: 'uint256', type: 'uint256' }],
|
|
59
|
+
stateMutability: 'view',
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
type: 'function',
|
|
63
|
+
inputs: [
|
|
64
|
+
{ name: 'vault', internalType: 'address', type: 'address' },
|
|
65
|
+
{ name: 'token', internalType: 'contract IERC20', type: 'address' },
|
|
66
|
+
{ name: 'numeraireAmount', internalType: 'uint256', type: 'uint256' },
|
|
67
|
+
],
|
|
68
|
+
name: 'convertNumeraireToToken',
|
|
69
|
+
outputs: [{ name: 'tokenAmount', internalType: 'uint256', type: 'uint256' }],
|
|
70
|
+
stateMutability: 'view',
|
|
71
|
+
},
|
|
50
72
|
{
|
|
51
73
|
type: 'function',
|
|
52
74
|
inputs: [{ name: 'vault', internalType: 'address', type: 'address' }],
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
// Compact ABI derived from aera-finance/aera-contracts-v3@f4e3433058c29c3a0b1348ffbd358cc036a1687f
|
|
2
2
|
// source: src/core/interfaces/IProvisionerV2.sol
|
|
3
3
|
export const provisionerV2Abi = [
|
|
4
|
+
{
|
|
5
|
+
type: 'function',
|
|
6
|
+
inputs: [],
|
|
7
|
+
name: 'SOLVING_GATE_ENABLED',
|
|
8
|
+
outputs: [{ name: '', internalType: 'bool', type: 'bool' }],
|
|
9
|
+
stateMutability: 'view',
|
|
10
|
+
},
|
|
4
11
|
{
|
|
5
12
|
type: 'function',
|
|
6
13
|
inputs: [
|
|
@@ -53,6 +60,25 @@ export const provisionerV2Abi = [
|
|
|
53
60
|
],
|
|
54
61
|
stateMutability: 'view',
|
|
55
62
|
},
|
|
63
|
+
{
|
|
64
|
+
type: 'function',
|
|
65
|
+
inputs: [],
|
|
66
|
+
name: 'getSyncRedeemEpochState',
|
|
67
|
+
outputs: [
|
|
68
|
+
{ name: 'epochTimestamp', internalType: 'uint256', type: 'uint256' },
|
|
69
|
+
{ name: 'epochStartTvlNumeraire', internalType: 'uint256', type: 'uint256' },
|
|
70
|
+
{ name: 'epochRedeemedNumeraire', internalType: 'uint256', type: 'uint256' },
|
|
71
|
+
{ name: 'epochCapNumeraire', internalType: 'uint256', type: 'uint256' },
|
|
72
|
+
],
|
|
73
|
+
stateMutability: 'view',
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
type: 'function',
|
|
77
|
+
inputs: [{ name: 'user', internalType: 'address', type: 'address' }],
|
|
78
|
+
name: 'userUnitsRefundableUntil',
|
|
79
|
+
outputs: [{ name: 'unitsLockedUntil', internalType: 'uint256', type: 'uint256' }],
|
|
80
|
+
stateMutability: 'view',
|
|
81
|
+
},
|
|
56
82
|
{
|
|
57
83
|
type: 'function',
|
|
58
84
|
inputs: [
|
|
@@ -63,6 +89,13 @@ export const provisionerV2Abi = [
|
|
|
63
89
|
outputs: [],
|
|
64
90
|
stateMutability: 'nonpayable',
|
|
65
91
|
},
|
|
92
|
+
{
|
|
93
|
+
type: 'function',
|
|
94
|
+
inputs: [],
|
|
95
|
+
name: 'solvingGate',
|
|
96
|
+
outputs: [{ name: '', internalType: 'address', type: 'address' }],
|
|
97
|
+
stateMutability: 'view',
|
|
98
|
+
},
|
|
66
99
|
{
|
|
67
100
|
type: 'function',
|
|
68
101
|
inputs: [{ name: 'token', internalType: 'contract IERC20', type: 'address' }],
|
package/src/evm/adapters/aera.ts
CHANGED
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
getMultiDepositorVault,
|
|
4
4
|
applySlippageDown,
|
|
5
5
|
applySlippageUp,
|
|
6
|
+
requireAeraSyncRedeemRuntime,
|
|
6
7
|
resolveContractVersion,
|
|
7
8
|
type AeraRuntimeContracts,
|
|
8
9
|
} from '../aeraContracts';
|
|
@@ -12,6 +13,7 @@ import * as provisionerV2 from '../aeraContracts/v2';
|
|
|
12
13
|
import {
|
|
13
14
|
InvalidWithdrawParamsError,
|
|
14
15
|
InvalidSolverTipError,
|
|
16
|
+
requireNonZeroSyncWithdrawBound,
|
|
15
17
|
UnimplementedFeatureError,
|
|
16
18
|
UnsupportedFeatureError,
|
|
17
19
|
} from '../../errors';
|
|
@@ -223,6 +225,7 @@ export const aeraAdapter: EvmProtocolAdapter = {
|
|
|
223
225
|
solverTip = DEFAULT_SOLVER_TIP,
|
|
224
226
|
maxPriceAge = DEFAULT_MAX_PRICE_AGE,
|
|
225
227
|
aeraRuntime,
|
|
228
|
+
minUnitsOut: requestedMinUnitsOut,
|
|
226
229
|
} = params;
|
|
227
230
|
|
|
228
231
|
const runtime = requireAeraRuntime(aeraRuntime);
|
|
@@ -236,17 +239,19 @@ export const aeraAdapter: EvmProtocolAdapter = {
|
|
|
236
239
|
throw new UnsupportedFeatureError('Aera: sync operations on V1');
|
|
237
240
|
}
|
|
238
241
|
|
|
239
|
-
const
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
242
|
+
const minUnitsOut =
|
|
243
|
+
requestedMinUnitsOut ??
|
|
244
|
+
applySlippageDown(
|
|
245
|
+
await getDepositUnitsOut({
|
|
246
|
+
publicClient,
|
|
247
|
+
runtime,
|
|
248
|
+
vault: vault.vaultAddress,
|
|
249
|
+
token: asset.address,
|
|
250
|
+
tokensIn: isAsync ? subtractSolverTip(amount, solverTip) : amount,
|
|
251
|
+
isAsync,
|
|
252
|
+
}),
|
|
253
|
+
slippageBps
|
|
254
|
+
);
|
|
250
255
|
|
|
251
256
|
if (isAsync) {
|
|
252
257
|
const deadline = getRequestDeadline(vault.expirationDays);
|
|
@@ -321,9 +326,7 @@ export const aeraAdapter: EvmProtocolAdapter = {
|
|
|
321
326
|
throw new UnsupportedFeatureError('Aera: separate receiver address on V1');
|
|
322
327
|
}
|
|
323
328
|
|
|
324
|
-
if (!isAsync
|
|
325
|
-
throw new UnsupportedFeatureError('Aera: sync operations on V1');
|
|
326
|
-
}
|
|
329
|
+
if (!isAsync) requireAeraSyncRedeemRuntime(runtime);
|
|
327
330
|
|
|
328
331
|
const isV2ExactTokenWithdraw =
|
|
329
332
|
isContractV2 && !isAsync && 'amount' in params && params.amount != null;
|
|
@@ -332,40 +335,66 @@ export const aeraAdapter: EvmProtocolAdapter = {
|
|
|
332
335
|
let shares: bigint | undefined;
|
|
333
336
|
|
|
334
337
|
if (isContractV2 && !isAsync) {
|
|
338
|
+
const quote = params.syncWithdrawQuote;
|
|
335
339
|
if ('entireAmount' in params && params.entireAmount) {
|
|
336
|
-
|
|
340
|
+
const balance = await publicClient.readContract({
|
|
337
341
|
address: vault.vaultAddress,
|
|
338
342
|
abi: multiDepositorVaultAbi,
|
|
339
343
|
functionName: 'balanceOf',
|
|
340
344
|
args: [account],
|
|
341
345
|
});
|
|
346
|
+
if (quote !== undefined) {
|
|
347
|
+
if (quote.kind !== 'redeem' || quote.shares !== balance) {
|
|
348
|
+
throw new InvalidWithdrawParamsError();
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
shares = balance;
|
|
342
352
|
} else if ('shares' in params && params.shares != null) {
|
|
353
|
+
if (quote !== undefined && (quote.kind !== 'redeem' || quote.shares !== params.shares)) {
|
|
354
|
+
throw new InvalidWithdrawParamsError();
|
|
355
|
+
}
|
|
343
356
|
shares = params.shares;
|
|
344
357
|
} else if (!('amount' in params && params.amount != null)) {
|
|
345
358
|
throw new InvalidWithdrawParamsError();
|
|
346
359
|
}
|
|
347
360
|
|
|
348
361
|
if (isV2ExactTokenWithdraw) {
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
+
requireNonZeroSyncWithdrawBound(params.amount, 'tokensOut');
|
|
363
|
+
if (quote !== undefined) {
|
|
364
|
+
if (quote.kind !== 'withdraw' || quote.tokensOut !== params.amount) {
|
|
365
|
+
throw new InvalidWithdrawParamsError();
|
|
366
|
+
}
|
|
367
|
+
minTokenOut = quote.tokensOut;
|
|
368
|
+
maxUnitsIn = quote.maxUnitsIn;
|
|
369
|
+
} else {
|
|
370
|
+
minTokenOut = params.amount;
|
|
371
|
+
maxUnitsIn = applySlippageUp(
|
|
372
|
+
await provisionerV2.getSyncWithdrawUnitsIn(
|
|
373
|
+
publicClient,
|
|
374
|
+
provisionerAddress,
|
|
375
|
+
runtime.feeCalculator.address,
|
|
376
|
+
runtime.feeCalculator.version,
|
|
377
|
+
vault.vaultAddress,
|
|
378
|
+
asset.address,
|
|
379
|
+
params.amount
|
|
380
|
+
),
|
|
381
|
+
slippageBps
|
|
382
|
+
);
|
|
383
|
+
}
|
|
384
|
+
requireNonZeroSyncWithdrawBound(maxUnitsIn, 'maxUnitsIn');
|
|
362
385
|
} else {
|
|
363
386
|
if (shares === undefined) {
|
|
364
387
|
throw new InvalidWithdrawParamsError();
|
|
365
388
|
}
|
|
366
389
|
|
|
367
|
-
|
|
368
|
-
|
|
390
|
+
requireNonZeroSyncWithdrawBound(shares, 'unitsIn');
|
|
391
|
+
if (quote !== undefined) {
|
|
392
|
+
if (quote.kind !== 'redeem' || quote.shares !== shares) {
|
|
393
|
+
throw new InvalidWithdrawParamsError();
|
|
394
|
+
}
|
|
395
|
+
minTokenOut = quote.minTokensOut;
|
|
396
|
+
} else {
|
|
397
|
+
const tokensOut = await provisionerV2.getSyncRedeemTokenOut(
|
|
369
398
|
publicClient,
|
|
370
399
|
provisionerAddress,
|
|
371
400
|
runtime.feeCalculator.address,
|
|
@@ -373,10 +402,11 @@ export const aeraAdapter: EvmProtocolAdapter = {
|
|
|
373
402
|
vault.vaultAddress,
|
|
374
403
|
asset.address,
|
|
375
404
|
shares
|
|
376
|
-
)
|
|
377
|
-
slippageBps
|
|
378
|
-
|
|
379
|
-
|
|
405
|
+
);
|
|
406
|
+
minTokenOut = applySlippageDown(tokensOut, slippageBps);
|
|
407
|
+
}
|
|
408
|
+
requireNonZeroSyncWithdrawBound(minTokenOut, 'minTokensOut');
|
|
409
|
+
maxUnitsIn = shares;
|
|
380
410
|
}
|
|
381
411
|
} else {
|
|
382
412
|
if ('entireAmount' in params && params.entireAmount) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Abi, Address, Hex, PublicClient } from 'viem';
|
|
2
2
|
import type { AeraRuntimeContracts } from '../aeraContracts';
|
|
3
|
+
import type { SyncWithdrawQuoteBounds } from '../withdrawQuote';
|
|
3
4
|
import type { TokenInfo, VaultDeployment } from '../types';
|
|
4
5
|
|
|
5
6
|
export interface EvmTxStep<TAbi extends Abi = Abi, TFunctionName extends string = string> {
|
|
@@ -37,6 +38,8 @@ export interface AdapterDepositParams {
|
|
|
37
38
|
/** Maximum price age passed to async Aera provisioner requests. Defaults to 10 days. */
|
|
38
39
|
maxPriceAge?: bigint;
|
|
39
40
|
aeraRuntime?: AeraRuntimeContracts;
|
|
41
|
+
/** Caller-reviewed minimum output for an explicit synchronous deposit. */
|
|
42
|
+
minUnitsOut?: bigint;
|
|
40
43
|
}
|
|
41
44
|
|
|
42
45
|
export type AdapterWithdrawParams = {
|
|
@@ -53,6 +56,7 @@ export type AdapterWithdrawParams = {
|
|
|
53
56
|
/** Maximum price age passed to async Aera provisioner requests. Defaults to 10 days. */
|
|
54
57
|
maxPriceAge?: bigint;
|
|
55
58
|
aeraRuntime?: AeraRuntimeContracts;
|
|
59
|
+
syncWithdrawQuote?: SyncWithdrawQuoteBounds;
|
|
56
60
|
} & (
|
|
57
61
|
| { shares: bigint; amount?: never; entireAmount?: never }
|
|
58
62
|
| { amount: bigint; shares?: never; entireAmount?: never }
|
|
@@ -3,6 +3,7 @@ import { UnsupportedFeatureError } from '../../errors';
|
|
|
3
3
|
import { priceAndFeeCalculatorAbi } from '../abis/priceAndFeeCalculator';
|
|
4
4
|
import { priceAndFeeCalculatorV2Abi } from '../abis/priceAndFeeCalculatorV2';
|
|
5
5
|
import { ContractVersion } from '../types';
|
|
6
|
+
import { readAtBlock } from './readOptions';
|
|
6
7
|
|
|
7
8
|
const ROUNDING_FLOOR = 0;
|
|
8
9
|
const ROUNDING_CEIL = 1;
|
|
@@ -13,6 +14,10 @@ export interface NormalizedVaultPriceState {
|
|
|
13
14
|
timestamp: number;
|
|
14
15
|
}
|
|
15
16
|
|
|
17
|
+
type AeraPriceReadOptions = {
|
|
18
|
+
blockNumber?: bigint;
|
|
19
|
+
};
|
|
20
|
+
|
|
16
21
|
function toNumber(value: bigint | number): number {
|
|
17
22
|
return typeof value === 'bigint' ? Number(value) : value;
|
|
18
23
|
}
|
|
@@ -54,7 +59,8 @@ export async function convertTokenToUnitsIfActive(
|
|
|
54
59
|
vault: Address,
|
|
55
60
|
token: Address,
|
|
56
61
|
tokenAmount: bigint,
|
|
57
|
-
rounding: typeof ROUNDING_FLOOR | typeof ROUNDING_CEIL
|
|
62
|
+
rounding: typeof ROUNDING_FLOOR | typeof ROUNDING_CEIL,
|
|
63
|
+
options: AeraPriceReadOptions = {}
|
|
58
64
|
): Promise<bigint> {
|
|
59
65
|
if (feeCalculatorVersion === ContractVersion.V2) {
|
|
60
66
|
return client.readContract({
|
|
@@ -62,6 +68,7 @@ export async function convertTokenToUnitsIfActive(
|
|
|
62
68
|
abi: priceAndFeeCalculatorV2Abi,
|
|
63
69
|
functionName: 'convertTokenToUnitsIfActive',
|
|
64
70
|
args: [vault, token, tokenAmount, rounding],
|
|
71
|
+
...readAtBlock(options),
|
|
65
72
|
});
|
|
66
73
|
}
|
|
67
74
|
|
|
@@ -70,6 +77,7 @@ export async function convertTokenToUnitsIfActive(
|
|
|
70
77
|
abi: priceAndFeeCalculatorAbi,
|
|
71
78
|
functionName: 'convertTokenToUnitsIfActive',
|
|
72
79
|
args: [vault, token, tokenAmount, rounding],
|
|
80
|
+
...readAtBlock(options),
|
|
73
81
|
});
|
|
74
82
|
}
|
|
75
83
|
|
|
@@ -80,7 +88,8 @@ export async function convertUnitsToTokenIfActive(
|
|
|
80
88
|
vault: Address,
|
|
81
89
|
token: Address,
|
|
82
90
|
unitsAmount: bigint,
|
|
83
|
-
rounding: typeof ROUNDING_FLOOR | typeof ROUNDING_CEIL
|
|
91
|
+
rounding: typeof ROUNDING_FLOOR | typeof ROUNDING_CEIL,
|
|
92
|
+
options: AeraPriceReadOptions = {}
|
|
84
93
|
): Promise<bigint> {
|
|
85
94
|
if (feeCalculatorVersion === ContractVersion.V2) {
|
|
86
95
|
return client.readContract({
|
|
@@ -88,6 +97,7 @@ export async function convertUnitsToTokenIfActive(
|
|
|
88
97
|
abi: priceAndFeeCalculatorV2Abi,
|
|
89
98
|
functionName: 'convertUnitsToTokenIfActive',
|
|
90
99
|
args: [vault, token, unitsAmount, rounding],
|
|
100
|
+
...readAtBlock(options),
|
|
91
101
|
});
|
|
92
102
|
}
|
|
93
103
|
|
|
@@ -96,6 +106,7 @@ export async function convertUnitsToTokenIfActive(
|
|
|
96
106
|
abi: priceAndFeeCalculatorAbi,
|
|
97
107
|
functionName: 'convertUnitsToTokenIfActive',
|
|
98
108
|
args: [vault, token, unitsAmount, rounding],
|
|
109
|
+
...readAtBlock(options),
|
|
99
110
|
});
|
|
100
111
|
}
|
|
101
112
|
|
|
@@ -105,7 +116,8 @@ export async function convertTokenToUnits(
|
|
|
105
116
|
feeCalculatorVersion: ContractVersion,
|
|
106
117
|
vault: Address,
|
|
107
118
|
token: Address,
|
|
108
|
-
tokenAmount: bigint
|
|
119
|
+
tokenAmount: bigint,
|
|
120
|
+
options: AeraPriceReadOptions = {}
|
|
109
121
|
): Promise<bigint> {
|
|
110
122
|
if (feeCalculatorVersion === ContractVersion.V2) {
|
|
111
123
|
return client.readContract({
|
|
@@ -113,6 +125,7 @@ export async function convertTokenToUnits(
|
|
|
113
125
|
abi: priceAndFeeCalculatorV2Abi,
|
|
114
126
|
functionName: 'convertTokenToUnits',
|
|
115
127
|
args: [vault, token, tokenAmount],
|
|
128
|
+
...readAtBlock(options),
|
|
116
129
|
});
|
|
117
130
|
}
|
|
118
131
|
|
|
@@ -121,6 +134,7 @@ export async function convertTokenToUnits(
|
|
|
121
134
|
abi: priceAndFeeCalculatorAbi,
|
|
122
135
|
functionName: 'convertTokenToUnits',
|
|
123
136
|
args: [vault, token, tokenAmount],
|
|
137
|
+
...readAtBlock(options),
|
|
124
138
|
});
|
|
125
139
|
}
|
|
126
140
|
|
|
@@ -130,7 +144,8 @@ export async function convertUnitsToToken(
|
|
|
130
144
|
feeCalculatorVersion: ContractVersion,
|
|
131
145
|
vault: Address,
|
|
132
146
|
token: Address,
|
|
133
|
-
unitsAmount: bigint
|
|
147
|
+
unitsAmount: bigint,
|
|
148
|
+
options: AeraPriceReadOptions = {}
|
|
134
149
|
): Promise<bigint> {
|
|
135
150
|
if (feeCalculatorVersion === ContractVersion.V2) {
|
|
136
151
|
return client.readContract({
|
|
@@ -138,6 +153,7 @@ export async function convertUnitsToToken(
|
|
|
138
153
|
abi: priceAndFeeCalculatorV2Abi,
|
|
139
154
|
functionName: 'convertUnitsToToken',
|
|
140
155
|
args: [vault, token, unitsAmount],
|
|
156
|
+
...readAtBlock(options),
|
|
141
157
|
});
|
|
142
158
|
}
|
|
143
159
|
|
|
@@ -146,6 +162,55 @@ export async function convertUnitsToToken(
|
|
|
146
162
|
abi: priceAndFeeCalculatorAbi,
|
|
147
163
|
functionName: 'convertUnitsToToken',
|
|
148
164
|
args: [vault, token, unitsAmount],
|
|
165
|
+
...readAtBlock(options),
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export async function convertTokenToNumeraire(
|
|
170
|
+
client: PublicClient,
|
|
171
|
+
feeCalculator: Address,
|
|
172
|
+
feeCalculatorVersion: ContractVersion,
|
|
173
|
+
vault: Address,
|
|
174
|
+
token: Address,
|
|
175
|
+
tokenAmount: bigint,
|
|
176
|
+
options: AeraPriceReadOptions = {}
|
|
177
|
+
): Promise<bigint> {
|
|
178
|
+
if (feeCalculatorVersion !== ContractVersion.V2) {
|
|
179
|
+
throw new UnsupportedFeatureError(
|
|
180
|
+
'Aera: numeraire conversion requires V2 price and fee calculator'
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return client.readContract({
|
|
185
|
+
address: feeCalculator,
|
|
186
|
+
abi: priceAndFeeCalculatorV2Abi,
|
|
187
|
+
functionName: 'convertTokenToNumeraire',
|
|
188
|
+
args: [vault, token, tokenAmount],
|
|
189
|
+
...readAtBlock(options),
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export async function convertNumeraireToToken(
|
|
194
|
+
client: PublicClient,
|
|
195
|
+
feeCalculator: Address,
|
|
196
|
+
feeCalculatorVersion: ContractVersion,
|
|
197
|
+
vault: Address,
|
|
198
|
+
token: Address,
|
|
199
|
+
numeraireAmount: bigint,
|
|
200
|
+
options: AeraPriceReadOptions = {}
|
|
201
|
+
): Promise<bigint> {
|
|
202
|
+
if (feeCalculatorVersion !== ContractVersion.V2) {
|
|
203
|
+
throw new UnsupportedFeatureError(
|
|
204
|
+
'Aera: numeraire conversion requires V2 price and fee calculator'
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
return client.readContract({
|
|
209
|
+
address: feeCalculator,
|
|
210
|
+
abi: priceAndFeeCalculatorV2Abi,
|
|
211
|
+
functionName: 'convertNumeraireToToken',
|
|
212
|
+
args: [vault, token, numeraireAmount],
|
|
213
|
+
...readAtBlock(options),
|
|
149
214
|
});
|
|
150
215
|
}
|
|
151
216
|
|
|
@@ -153,7 +218,8 @@ export async function getAnchorTimestamp(
|
|
|
153
218
|
client: PublicClient,
|
|
154
219
|
feeCalculator: Address,
|
|
155
220
|
feeCalculatorVersion: ContractVersion,
|
|
156
|
-
vault: Address
|
|
221
|
+
vault: Address,
|
|
222
|
+
options: AeraPriceReadOptions = {}
|
|
157
223
|
): Promise<number> {
|
|
158
224
|
if (feeCalculatorVersion !== ContractVersion.V2) {
|
|
159
225
|
throw new UnsupportedFeatureError('Aera: sync redeem requires V2 price and fee calculator');
|
|
@@ -164,6 +230,7 @@ export async function getAnchorTimestamp(
|
|
|
164
230
|
abi: priceAndFeeCalculatorV2Abi,
|
|
165
231
|
functionName: 'getAnchorTimestamp',
|
|
166
232
|
args: [vault],
|
|
233
|
+
...readAtBlock(options),
|
|
167
234
|
});
|
|
168
235
|
}
|
|
169
236
|
|