@gauntlet-xyz/sdk 2.5.0 → 3.1.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 +121 -7
- package/dist/api/activity.d.ts +4 -2
- package/dist/api/activity.d.ts.map +1 -1
- package/dist/api/activityRows.d.ts +11 -0
- package/dist/api/activityRows.d.ts.map +1 -0
- package/dist/api/caip.d.ts +1 -1
- package/dist/api/caip.d.ts.map +1 -1
- package/dist/api/client.d.ts +43 -5
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/decimal.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 +570 -7
- package/dist/api/generated.d.ts.map +1 -1
- package/dist/api/http.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 +47 -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 +8 -5
- package/dist/attribution/index.d.ts.map +1 -1
- package/dist/chunk-JJOLVL5V.js +546 -0
- package/dist/chunk-JJOLVL5V.js.map +7 -0
- package/dist/chunk-JRSNLXFY.js +2009 -0
- package/dist/chunk-JRSNLXFY.js.map +7 -0
- package/dist/chunk-MEKISE2T.js +367 -0
- package/dist/chunk-MEKISE2T.js.map +7 -0
- package/dist/chunk-YQXTLIJA.js +4477 -0
- package/dist/chunk-YQXTLIJA.js.map +7 -0
- package/dist/cjs/api/activity.d.ts +72 -0
- package/dist/cjs/api/activity.d.ts.map +1 -0
- package/dist/cjs/api/activity.js +138 -0
- package/dist/cjs/api/activity.js.map +7 -0
- package/dist/cjs/api/activityRows.d.ts +11 -0
- package/dist/cjs/api/activityRows.d.ts.map +1 -0
- package/dist/cjs/api/activityRows.js +139 -0
- package/dist/cjs/api/activityRows.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 +61 -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 +199 -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 +61 -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 +65 -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 +144 -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 +28 -0
- package/dist/cjs/attribution/index.d.ts.map +1 -0
- package/dist/cjs/attribution/index.js +70 -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 +500 -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 +85 -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 +234 -0
- package/dist/cjs/evm/aeraContracts.js.map +7 -0
- package/dist/cjs/evm/deposit.d.ts +51 -0
- package/dist/cjs/evm/deposit.d.ts.map +1 -0
- package/dist/cjs/evm/deposit.js +142 -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 +97 -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 +71 -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 +69 -0
- package/dist/cjs/evm/userCurrentBalance.d.ts.map +1 -0
- package/dist/cjs/evm/userCurrentBalance.js +268 -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 +75 -0
- package/dist/cjs/evm/withdraw.d.ts.map +1 -0
- package/dist/cjs/evm/withdraw.js +174 -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 +257 -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 +4 -1
- package/dist/errors.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 -3
- package/dist/evm/adapters/types.d.ts.map +1 -1
- package/dist/evm/aeraContracts/priceAndFeeCalculator.d.ts +1 -1
- package/dist/evm/aeraContracts/priceAndFeeCalculator.d.ts.map +1 -1
- 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 +25 -4
- package/dist/evm/aeraContracts/v2.d.ts.map +1 -1
- package/dist/evm/aeraContracts.d.ts +2 -2
- package/dist/evm/aeraContracts.d.ts.map +1 -1
- package/dist/evm/deposit.d.ts +7 -4
- 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 -25
- package/dist/evm/index.d.ts.map +1 -1
- package/dist/evm/index.js +86 -12
- package/dist/evm/index.js.map +7 -1
- package/dist/evm/tokenModes.d.ts +2 -2
- package/dist/evm/tokenModes.d.ts.map +1 -1
- package/dist/evm/userCurrentBalance.d.ts +21 -3
- 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 +5 -3
- package/dist/evm/withdraw.d.ts.map +1 -1
- package/dist/evm/withdrawQuote.d.ts +14 -6
- package/dist/evm/withdrawQuote.d.ts.map +1 -1
- package/dist/index.d.ts +30 -28
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +137 -14
- 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 +22 -395
- package/package.json +43 -9
- package/src/api/activity.ts +18 -15
- package/src/api/activityRows.ts +143 -0
- package/src/api/caip.ts +3 -1
- package/src/api/client.ts +105 -6
- package/src/api/decimal.ts +1 -0
- package/src/api/generated.ts +570 -7
- package/src/api/http.ts +1 -0
- package/src/api/index.ts +8 -0
- package/src/api/positionHistory.ts +20 -5
- package/src/attribution/index.ts +6 -2
- package/src/client.ts +4 -1
- package/src/constants.ts +2 -0
- package/src/errors.ts +7 -0
- package/src/evm/adapters/aera.ts +40 -19
- package/src/evm/adapters/types.ts +3 -0
- package/src/evm/aeraContracts/v2.ts +124 -16
- package/src/evm/aeraContracts.ts +29 -14
- package/src/evm/deposit.ts +61 -18
- package/src/evm/depositQuote.ts +138 -0
- package/src/evm/depositReceiverApproval.ts +14 -9
- package/src/evm/index.ts +10 -1
- package/src/evm/userCurrentBalance.ts +155 -60
- package/src/evm/vaults.ts +0 -7
- package/src/evm/withdraw.ts +20 -1
- package/src/evm/withdrawQuote.ts +126 -51
- package/src/index.ts +11 -2
- 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 -119
- 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 -134
- 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 -141
- 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 -295
- package/dist/evm/abis/provisionerV2.js.map +0 -1
- package/dist/evm/adapters/aera.js +0 -280
- 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 -174
- package/dist/evm/aeraContracts/priceAndFeeCalculator.js.map +0 -1
- package/dist/evm/aeraContracts/readOptions.js +0 -4
- package/dist/evm/aeraContracts/readOptions.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 -273
- package/dist/evm/aeraContracts/v2.js.map +0 -1
- package/dist/evm/aeraContracts.js +0 -195
- 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/tokenModes.js +0 -34
- package/dist/evm/tokenModes.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 -177
- package/dist/evm/withdraw.js.map +0 -1
- package/dist/evm/withdrawQuote.js +0 -164
- package/dist/evm/withdrawQuote.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gauntlet-xyz/sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"description": "Official Gauntlet SDK for vault deposits, withdrawals, and attribution",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -28,12 +28,44 @@
|
|
|
28
28
|
"types": "./dist/index.d.ts",
|
|
29
29
|
"exports": {
|
|
30
30
|
".": {
|
|
31
|
-
"
|
|
32
|
-
|
|
31
|
+
"import": {
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"default": "./dist/index.js"
|
|
34
|
+
},
|
|
35
|
+
"require": {
|
|
36
|
+
"types": "./dist/cjs/index.d.ts",
|
|
37
|
+
"default": "./dist/cjs/index.js"
|
|
38
|
+
}
|
|
33
39
|
},
|
|
34
40
|
"./evm": {
|
|
35
|
-
"
|
|
36
|
-
|
|
41
|
+
"import": {
|
|
42
|
+
"types": "./dist/evm/index.d.ts",
|
|
43
|
+
"default": "./dist/evm/index.js"
|
|
44
|
+
},
|
|
45
|
+
"require": {
|
|
46
|
+
"types": "./dist/cjs/evm/index.d.ts",
|
|
47
|
+
"default": "./dist/cjs/evm/index.js"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"./api": {
|
|
51
|
+
"import": {
|
|
52
|
+
"types": "./dist/api/index.d.ts",
|
|
53
|
+
"default": "./dist/api/index.js"
|
|
54
|
+
},
|
|
55
|
+
"require": {
|
|
56
|
+
"types": "./dist/cjs/api/index.d.ts",
|
|
57
|
+
"default": "./dist/cjs/api/index.js"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"./privy": {
|
|
61
|
+
"import": {
|
|
62
|
+
"types": "./dist/privy/index.d.ts",
|
|
63
|
+
"default": "./dist/privy/index.js"
|
|
64
|
+
},
|
|
65
|
+
"require": {
|
|
66
|
+
"types": "./dist/cjs/privy/index.d.ts",
|
|
67
|
+
"default": "./dist/cjs/privy/index.js"
|
|
68
|
+
}
|
|
37
69
|
}
|
|
38
70
|
},
|
|
39
71
|
"files": [
|
|
@@ -42,14 +74,15 @@
|
|
|
42
74
|
"manifest"
|
|
43
75
|
],
|
|
44
76
|
"scripts": {
|
|
45
|
-
"build": "
|
|
46
|
-
"dev": "
|
|
77
|
+
"build": "node scripts/build.mjs",
|
|
78
|
+
"dev": "node scripts/build.mjs --watch",
|
|
47
79
|
"test": "vitest run",
|
|
48
80
|
"test:watch": "vitest",
|
|
49
81
|
"lint": "eslint --ext=tsx,ts,js src && echo-cli '✔ No ESLint warnings or errors'",
|
|
50
82
|
"format": "eslint --fix --quiet --ext=tsx,ts,js src && echo-cli '✔ No ESLint warnings or errors'",
|
|
51
83
|
"typecheck": "npx tsc --noEmit",
|
|
52
|
-
"clean": "rm -rf dist .turbo"
|
|
84
|
+
"clean": "rm -rf dist .turbo",
|
|
85
|
+
"test:node": "node --test tests/package.test.mjs"
|
|
53
86
|
},
|
|
54
87
|
"peerDependencies": {
|
|
55
88
|
"viem": ">=2.0.0"
|
|
@@ -62,7 +95,8 @@
|
|
|
62
95
|
"eslint": "^8.57.0",
|
|
63
96
|
"typescript": "~5.6.3",
|
|
64
97
|
"viem": "2.30.1",
|
|
65
|
-
"vitest": "^4.1.2"
|
|
98
|
+
"vitest": "^4.1.2",
|
|
99
|
+
"esbuild": "^0.25.0"
|
|
66
100
|
},
|
|
67
101
|
"engines": {
|
|
68
102
|
"npm": ">=11.5.1",
|
package/src/api/activity.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { activityLifecycles, orderActivityRows } from './activityRows';
|
|
1
2
|
import { GauntletSDKError } from '../errors';
|
|
2
3
|
import type { ActivityOptions, GauntletApi, TokenRef, UserActivity } from './client';
|
|
3
4
|
import { decimalToBigInt, sharesToBigInt } from './decimal';
|
|
@@ -44,8 +45,8 @@ const PENDING_TYPES = new Set(['deposit_pending', 'withdraw_pending']);
|
|
|
44
45
|
const REFUNDED_TYPES = new Set(['deposit_refunded', 'withdraw_refunded']);
|
|
45
46
|
|
|
46
47
|
function flowKind(rowType: string): ActivityFlowKind {
|
|
47
|
-
if (
|
|
48
|
-
if (
|
|
48
|
+
if (['deposit', 'deposit_pending', 'deposit_refunded'].includes(rowType)) return 'deposit';
|
|
49
|
+
if (['withdraw', 'withdraw_pending', 'withdraw_refunded'].includes(rowType)) return 'withdraw';
|
|
49
50
|
if (rowType === 'transfer_in' || rowType === 'transfer_out') return rowType;
|
|
50
51
|
throw new GauntletSDKError(`Unknown activity row type "${rowType}"`);
|
|
51
52
|
}
|
|
@@ -88,19 +89,10 @@ function toAssetAmount(rows: UserActivity[]): AssetAmount {
|
|
|
88
89
|
* `request_hash`. Flows are returned newest-first (by the flow's latest row).
|
|
89
90
|
*/
|
|
90
91
|
export function stitchActivityFlows(rows: UserActivity[]): ActivityFlow[] {
|
|
91
|
-
const groups =
|
|
92
|
-
for (const [index, row] of rows.entries()) {
|
|
93
|
-
// Rows without a request_hash are standalone sync flows: each one is its
|
|
94
|
-
// own group, so two same-type events in one transaction (e.g. a multicall
|
|
95
|
-
// doing two deposits) stay two flows.
|
|
96
|
-
const key = row.request_hash ?? `row:${index}`;
|
|
97
|
-
const group = groups.get(key);
|
|
98
|
-
if (group) group.push(row);
|
|
99
|
-
else groups.set(key, [row]);
|
|
100
|
-
}
|
|
92
|
+
const groups = activityLifecycles(orderActivityRows(rows));
|
|
101
93
|
|
|
102
94
|
const flows: ActivityFlow[] = [];
|
|
103
|
-
for (const group of groups
|
|
95
|
+
for (const group of groups) {
|
|
104
96
|
group.sort((a, b) => a.block_timestamp - b.block_timestamp);
|
|
105
97
|
const pendingRow = group.find((r) => PENDING_TYPES.has(r.type)) ?? null;
|
|
106
98
|
const terminalRow = group.find((r) => !PENDING_TYPES.has(r.type)) ?? null;
|
|
@@ -183,6 +175,8 @@ export async function getActivityFlows(
|
|
|
183
175
|
}
|
|
184
176
|
|
|
185
177
|
export interface WaitForSettlementOptions {
|
|
178
|
+
/** Transaction hash of the submitted request. Prevents reuse of an earlier settlement. */
|
|
179
|
+
requestTxHash: string;
|
|
186
180
|
/** CAIP-10 vault id — narrows polling to one vault's activity. */
|
|
187
181
|
vaultId?: string;
|
|
188
182
|
/** Polling interval. Defaults to 5s. */
|
|
@@ -200,15 +194,24 @@ export async function waitForRequestSettlement(
|
|
|
200
194
|
api: GauntletApi,
|
|
201
195
|
walletAddress: string,
|
|
202
196
|
requestHash: string,
|
|
203
|
-
options: WaitForSettlementOptions
|
|
197
|
+
options: WaitForSettlementOptions
|
|
204
198
|
): Promise<ActivityFlow> {
|
|
199
|
+
if (typeof options?.requestTxHash !== 'string' || options.requestTxHash.length === 0) {
|
|
200
|
+
throw new GauntletSDKError(
|
|
201
|
+
'Settlement polling requires the submitted request transaction hash'
|
|
202
|
+
);
|
|
203
|
+
}
|
|
205
204
|
const pollIntervalMs = options.pollIntervalMs ?? 5_000;
|
|
206
205
|
const timeoutMs = options.timeoutMs ?? 600_000;
|
|
207
206
|
const deadline = Date.now() + timeoutMs;
|
|
208
207
|
|
|
209
208
|
for (;;) {
|
|
210
209
|
const flows = await getActivityFlows(api, walletAddress, { vaultId: options.vaultId });
|
|
211
|
-
const flow = flows.find(
|
|
210
|
+
const flow = flows.find(
|
|
211
|
+
(f) =>
|
|
212
|
+
f.requestHash === requestHash &&
|
|
213
|
+
f.txHashes.some((hash) => hash.toLowerCase() === options.requestTxHash.toLowerCase())
|
|
214
|
+
);
|
|
212
215
|
if (flow && flow.status !== 'pending') return flow;
|
|
213
216
|
|
|
214
217
|
if (Date.now() + pollIntervalMs > deadline) {
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { GauntletSDKError } from '../errors';
|
|
2
|
+
import type { UserActivity } from './client';
|
|
3
|
+
import { decimalToBigInt, sharesToBigInt } from './decimal';
|
|
4
|
+
|
|
5
|
+
export function isPending(row: UserActivity): boolean {
|
|
6
|
+
return row.type === 'deposit_pending' || row.type === 'withdraw_pending';
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function requireSameToken(leftRow: UserActivity, rightRow: UserActivity): void {
|
|
10
|
+
// The vault ID includes the chain ID; TokenRef has no chain field.
|
|
11
|
+
if (leftRow.vault_id.split(':')[0] !== rightRow.vault_id.split(':')[0]) {
|
|
12
|
+
throw new GauntletSDKError('Activity rows contain assets on different chains');
|
|
13
|
+
}
|
|
14
|
+
const left = leftRow.assets_delta.token;
|
|
15
|
+
const right = rightRow.assets_delta.token;
|
|
16
|
+
if (
|
|
17
|
+
left != null &&
|
|
18
|
+
right != null &&
|
|
19
|
+
(left.address.toLowerCase() !== right.address.toLowerCase() ||
|
|
20
|
+
(left.decimals ?? null) !== (right.decimals ?? null))
|
|
21
|
+
) {
|
|
22
|
+
throw new GauntletSDKError('Activity rows contain different asset denominations');
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function validateActivityRow(row: UserActivity): void {
|
|
27
|
+
const shares = sharesToBigInt(row.shares_delta);
|
|
28
|
+
const assets = decimalToBigInt(row.assets_delta.native, 18);
|
|
29
|
+
if (
|
|
30
|
+
!Number.isSafeInteger(row.block_number) ||
|
|
31
|
+
row.block_number < 0 ||
|
|
32
|
+
!Number.isSafeInteger(row.block_timestamp) ||
|
|
33
|
+
row.block_timestamp < 0 ||
|
|
34
|
+
typeof row.vault_id !== 'string' ||
|
|
35
|
+
row.vault_id.length === 0 ||
|
|
36
|
+
typeof row.tx_hash !== 'string' ||
|
|
37
|
+
row.tx_hash.length === 0 ||
|
|
38
|
+
(row.request_hash != null &&
|
|
39
|
+
(typeof row.request_hash !== 'string' || row.request_hash.length === 0))
|
|
40
|
+
) {
|
|
41
|
+
throw new GauntletSDKError('The activity row has invalid event identifiers');
|
|
42
|
+
}
|
|
43
|
+
const token = row.assets_delta.token;
|
|
44
|
+
if (token != null && token.decimals != null) {
|
|
45
|
+
if (!Number.isInteger(token.decimals) || token.decimals < 0 || token.decimals > 255) {
|
|
46
|
+
throw new GauntletSDKError('The activity token has invalid decimals');
|
|
47
|
+
}
|
|
48
|
+
decimalToBigInt(row.assets_delta.native, token.decimals);
|
|
49
|
+
}
|
|
50
|
+
let valid: boolean;
|
|
51
|
+
switch (row.type) {
|
|
52
|
+
case 'deposit':
|
|
53
|
+
valid = shares >= 0n && assets >= 0n && (row.request_hash == null || assets === 0n);
|
|
54
|
+
break;
|
|
55
|
+
case 'deposit_pending':
|
|
56
|
+
valid = shares === 0n && assets > 0n && row.request_hash != null;
|
|
57
|
+
break;
|
|
58
|
+
case 'deposit_refunded':
|
|
59
|
+
valid = shares === 0n && assets < 0n && row.request_hash != null;
|
|
60
|
+
break;
|
|
61
|
+
case 'withdraw':
|
|
62
|
+
valid = shares <= 0n && assets <= 0n && (row.request_hash == null || shares === 0n);
|
|
63
|
+
break;
|
|
64
|
+
case 'withdraw_pending':
|
|
65
|
+
valid = shares < 0n && assets === 0n && row.request_hash != null;
|
|
66
|
+
break;
|
|
67
|
+
case 'withdraw_refunded':
|
|
68
|
+
valid = shares > 0n && assets === 0n && row.request_hash != null;
|
|
69
|
+
break;
|
|
70
|
+
case 'transfer_in':
|
|
71
|
+
valid = shares >= 0n && assets >= 0n && row.request_hash == null;
|
|
72
|
+
break;
|
|
73
|
+
case 'transfer_out':
|
|
74
|
+
valid = shares <= 0n && assets <= 0n && row.request_hash == null;
|
|
75
|
+
break;
|
|
76
|
+
default:
|
|
77
|
+
valid = false;
|
|
78
|
+
}
|
|
79
|
+
if (!valid) throw new GauntletSDKError(`Invalid activity deltas for ${row.type}`);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export function orderActivityRows(rows: UserActivity[]): UserActivity[] {
|
|
83
|
+
rows.forEach(validateActivityRow);
|
|
84
|
+
return [...rows].sort(
|
|
85
|
+
(a, b) =>
|
|
86
|
+
a.block_number - b.block_number ||
|
|
87
|
+
a.block_timestamp - b.block_timestamp ||
|
|
88
|
+
Number(isPending(b)) - Number(isPending(a))
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Split request hashes by vault and by each request occurrence.
|
|
94
|
+
* Takes the output of `orderActivityRows`.
|
|
95
|
+
*/
|
|
96
|
+
export function activityLifecycles(ordered: UserActivity[]): UserActivity[][] {
|
|
97
|
+
const groups: UserActivity[][] = [];
|
|
98
|
+
const latest = new Map<string, UserActivity[]>();
|
|
99
|
+
for (const row of ordered) {
|
|
100
|
+
if (row.request_hash == null) {
|
|
101
|
+
groups.push([row]);
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
const key = `${row.vault_id}:${row.request_hash}`;
|
|
105
|
+
const previous = latest.get(key);
|
|
106
|
+
if (previous === undefined || isPending(row)) {
|
|
107
|
+
if (previous !== undefined && previous.every(isPending)) {
|
|
108
|
+
throw new GauntletSDKError('An activity request has duplicate pending rows');
|
|
109
|
+
}
|
|
110
|
+
const group = [row];
|
|
111
|
+
latest.set(key, group);
|
|
112
|
+
groups.push(group);
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
if (previous.some((entry) => !isPending(entry))) {
|
|
116
|
+
throw new GauntletSDKError('An activity request has conflicting terminal rows');
|
|
117
|
+
}
|
|
118
|
+
const pending = previous[0];
|
|
119
|
+
requireSameToken(pending, row);
|
|
120
|
+
const expected =
|
|
121
|
+
pending.type === 'deposit_pending'
|
|
122
|
+
? ['deposit', 'deposit_refunded']
|
|
123
|
+
: ['withdraw', 'withdraw_refunded'];
|
|
124
|
+
if (!expected.includes(row.type)) {
|
|
125
|
+
throw new GauntletSDKError('The activity terminal does not match its request');
|
|
126
|
+
}
|
|
127
|
+
if (
|
|
128
|
+
row.type === 'deposit_refunded' &&
|
|
129
|
+
decimalToBigInt(pending.assets_delta.native, 18) !==
|
|
130
|
+
-decimalToBigInt(row.assets_delta.native, 18)
|
|
131
|
+
) {
|
|
132
|
+
throw new GauntletSDKError('The deposit refund does not match its request');
|
|
133
|
+
}
|
|
134
|
+
if (
|
|
135
|
+
row.type === 'withdraw_refunded' &&
|
|
136
|
+
sharesToBigInt(pending.shares_delta) !== -sharesToBigInt(row.shares_delta)
|
|
137
|
+
) {
|
|
138
|
+
throw new GauntletSDKError('The withdrawal refund does not match its request');
|
|
139
|
+
}
|
|
140
|
+
previous.push(row);
|
|
141
|
+
}
|
|
142
|
+
return groups;
|
|
143
|
+
}
|
package/src/api/caip.ts
CHANGED
|
@@ -16,7 +16,9 @@ export interface ApiVaultId {
|
|
|
16
16
|
export function parseApiVaultId(id: string): ApiVaultId {
|
|
17
17
|
const match = /^(?:eip155:)?(\d+):(0x[0-9a-fA-F]{40})$/.exec(id);
|
|
18
18
|
if (!match) throw new InvalidCaipIdError(id);
|
|
19
|
-
|
|
19
|
+
const chainId = Number(match[1]);
|
|
20
|
+
if (!Number.isSafeInteger(chainId) || chainId <= 0) throw new InvalidCaipIdError(id);
|
|
21
|
+
return { chainId, address: match[2].toLowerCase() };
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
export function formatApiVaultId(chainId: number, address: string): string {
|
package/src/api/client.ts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
import { parseApiVaultId } from './caip';
|
|
2
|
+
import { GauntletApiError } from './errors';
|
|
1
3
|
import type { components } from './generated';
|
|
2
4
|
import { apiGet, type GauntletApiConfig, type QueryParams } from './http';
|
|
3
5
|
|
|
4
6
|
type Schemas = components['schemas'];
|
|
5
7
|
|
|
8
|
+
function activityError(message: string, code?: string): GauntletApiError {
|
|
9
|
+
return new GauntletApiError({ status: 200, path: '/v1/users/activity', message, code });
|
|
10
|
+
}
|
|
11
|
+
|
|
6
12
|
export type UserActivity = Schemas['UserActivity'];
|
|
7
13
|
export type UserActivityResponse = Schemas['UserActivityResponse'];
|
|
8
14
|
export type UserPosition = Schemas['UserPosition'];
|
|
@@ -12,7 +18,12 @@ export type UserPositionsTimeseriesResponse = Schemas['UserPositionsTimeseriesRe
|
|
|
12
18
|
export type PositionTimeseriesPoint = Schemas['PositionTimeseriesPoint'];
|
|
13
19
|
export type VaultDetail = Schemas['VaultDetail'];
|
|
14
20
|
export type VaultDetailResponse = Schemas['VaultDetailResponse'];
|
|
21
|
+
export type VaultListResponse = Schemas['VaultListResponse'];
|
|
22
|
+
export type VaultAllocations = Schemas['VaultAllocations'];
|
|
23
|
+
export type VaultAllocationsResponse = Schemas['VaultAllocationsResponse'];
|
|
15
24
|
export type VaultTimeseriesResponse = Schemas['VaultTimeseriesResponse'];
|
|
25
|
+
export type VaultGroupTimeseriesResponse = Schemas['VaultGroupTimeseriesResponse'];
|
|
26
|
+
export type VaultGroupTimeseriesPoint = Schemas['VaultGroupTimeseriesPoint'];
|
|
16
27
|
export type VaultTimeseriesPoint = Schemas['VaultTimeseriesPoint'];
|
|
17
28
|
export type VaultMetrics = Schemas['VaultMetrics'];
|
|
18
29
|
export type FeaturedVault = Schemas['FeaturedVault'];
|
|
@@ -20,6 +31,9 @@ export type FeaturedVaultsResponse = Schemas['FeaturedVaultsResponse'];
|
|
|
20
31
|
export type StrategyCard = Schemas['StrategyCard'];
|
|
21
32
|
export type StrategyListResponse = Schemas['StrategyListResponse'];
|
|
22
33
|
export type TvlResponse = Schemas['TvlResponse'];
|
|
34
|
+
export type TvlBreakdownMode = Schemas['TvlBreakdownMode'];
|
|
35
|
+
export type TvlTimeseriesResponse = Schemas['TvlTimeseriesResponse'];
|
|
36
|
+
export type TvlTimeseriesPoint = Schemas['TvlTimeseriesPoint'];
|
|
23
37
|
export type LatestPriceResponse = Schemas['LatestPriceResponse'];
|
|
24
38
|
export type PriceTimeseriesResponse = Schemas['TimeseriesResponse'];
|
|
25
39
|
export type TokenRef = Schemas['TokenRef'];
|
|
@@ -62,6 +76,14 @@ export interface PositionsOptions extends PageOptions {
|
|
|
62
76
|
includeHidden?: boolean;
|
|
63
77
|
}
|
|
64
78
|
|
|
79
|
+
export interface VaultsOptions extends PageOptions {
|
|
80
|
+
/**
|
|
81
|
+
* Include hidden (enabled but unlisted) vaults alongside visible ones.
|
|
82
|
+
* Disabled vaults are never listed.
|
|
83
|
+
*/
|
|
84
|
+
includeHidden?: boolean;
|
|
85
|
+
}
|
|
86
|
+
|
|
65
87
|
export interface LatestPriceOptions {
|
|
66
88
|
address: string;
|
|
67
89
|
chainId: number;
|
|
@@ -117,8 +139,37 @@ export class GauntletApi {
|
|
|
117
139
|
}
|
|
118
140
|
|
|
119
141
|
/** GET /v1/vaults — all indexed vaults with live metrics (TVL, APY, unit price). */
|
|
120
|
-
vaults(options:
|
|
121
|
-
return this.get('/v1/vaults', {
|
|
142
|
+
vaults(options: VaultsOptions = {}): Promise<{ data: VaultDetail[]; meta: TimeseriesMeta }> {
|
|
143
|
+
return this.get('/v1/vaults', {
|
|
144
|
+
next: options.next,
|
|
145
|
+
limit: options.limit,
|
|
146
|
+
include_hidden: options.includeHidden,
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/** GET /v1/vaults/slug/{slug} — all enabled deployments for one exact vault slug. */
|
|
151
|
+
vaultsBySlug(slug: string): Promise<VaultListResponse> {
|
|
152
|
+
return this.get(`/v1/vaults/slug/${encodeURIComponent(slug)}`);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/** GET /v1/vaults/slug/{slug}/timeseries — aggregate USD TVL and supply, plus primary-deployment metrics.
|
|
156
|
+
* APY and unit price come from meta.resolved_vault_id; null marks missing data.
|
|
157
|
+
*/
|
|
158
|
+
vaultTimeseriesBySlug(
|
|
159
|
+
slug: string,
|
|
160
|
+
options: TimeWindowOptions = {}
|
|
161
|
+
): Promise<VaultGroupTimeseriesResponse> {
|
|
162
|
+
return this.get(`/v1/vaults/slug/${encodeURIComponent(slug)}/timeseries`, { ...options });
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/** GET /v1/vaults/slug/{slug}/primary/timeseries — primary deployment history. */
|
|
166
|
+
primaryVaultTimeseriesBySlug(
|
|
167
|
+
slug: string,
|
|
168
|
+
options: TimeWindowOptions = {}
|
|
169
|
+
): Promise<VaultTimeseriesResponse> {
|
|
170
|
+
return this.get(`/v1/vaults/slug/${encodeURIComponent(slug)}/primary/timeseries`, {
|
|
171
|
+
...options,
|
|
172
|
+
});
|
|
122
173
|
}
|
|
123
174
|
|
|
124
175
|
/** GET /v1/vaults/featured — admin-curated featured vault cards. */
|
|
@@ -141,6 +192,11 @@ export class GauntletApi {
|
|
|
141
192
|
return this.get(`/v1/vaults/${encodeURIComponent(vaultId)}/definition`);
|
|
142
193
|
}
|
|
143
194
|
|
|
195
|
+
/** GET /v1/vaults/{vault_id}/allocations — current Aera allocations with source lineage. */
|
|
196
|
+
vaultAllocations(vaultId: string): Promise<VaultAllocationsResponse> {
|
|
197
|
+
return this.get(`/v1/vaults/${encodeURIComponent(vaultId)}/allocations`);
|
|
198
|
+
}
|
|
199
|
+
|
|
144
200
|
/** GET /v1/vaults/{vault_id}/timeseries — TVL / unit-price / APY history. */
|
|
145
201
|
vaultTimeseries(
|
|
146
202
|
vaultId: string,
|
|
@@ -198,17 +254,60 @@ export class GauntletApi {
|
|
|
198
254
|
walletAddress: string,
|
|
199
255
|
options: Omit<ActivityOptions, 'next'> = {}
|
|
200
256
|
): AsyncGenerator<UserActivity> {
|
|
257
|
+
const vault = options.vaultId === undefined ? undefined : parseApiVaultId(options.vaultId);
|
|
258
|
+
// Gaia pages on (timestamp, logIndex), which rows do not expose. Rows
|
|
259
|
+
// can repeat legitimately inside one transaction, so the boundary check
|
|
260
|
+
// is the timestamp order.
|
|
261
|
+
const descending = (options.order ?? 'desc') === 'desc';
|
|
262
|
+
let lastTimestamp: number | undefined;
|
|
201
263
|
let next: string | undefined;
|
|
264
|
+
const cursors = new Set<string>();
|
|
202
265
|
do {
|
|
203
266
|
const page = await this.activity(walletAddress, { ...options, next });
|
|
204
|
-
|
|
267
|
+
if (page.meta.partial_errors?.length) {
|
|
268
|
+
throw activityError('The activity response is incomplete', 'INCOMPLETE_ACTIVITY');
|
|
269
|
+
}
|
|
270
|
+
for (const row of page.data) {
|
|
271
|
+
if (vault !== undefined) {
|
|
272
|
+
const rowVault = parseApiVaultId(row.vault_id);
|
|
273
|
+
if (rowVault.chainId !== vault.chainId || rowVault.address !== vault.address) {
|
|
274
|
+
throw activityError('The activity vault does not match the request');
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
if (
|
|
278
|
+
lastTimestamp !== undefined &&
|
|
279
|
+
(descending ? row.block_timestamp > lastTimestamp : row.block_timestamp < lastTimestamp)
|
|
280
|
+
) {
|
|
281
|
+
throw activityError('The activity rows are out of order');
|
|
282
|
+
}
|
|
283
|
+
lastTimestamp = row.block_timestamp;
|
|
284
|
+
yield row;
|
|
285
|
+
}
|
|
205
286
|
next = page.meta.next_cursor ?? undefined;
|
|
287
|
+
if (next !== undefined) {
|
|
288
|
+
if (cursors.has(next)) throw activityError('The activity cursor repeats');
|
|
289
|
+
cursors.add(next);
|
|
290
|
+
}
|
|
206
291
|
} while (next);
|
|
207
292
|
}
|
|
208
293
|
|
|
209
|
-
/**
|
|
210
|
-
|
|
211
|
-
|
|
294
|
+
/**
|
|
295
|
+
* GET /v1/tvl — aggregate Gauntlet TVL. Pass `mode` for a `breakdown`:
|
|
296
|
+
* `chain` for one row per chain, `strategy` for one row per curated
|
|
297
|
+
* strategy. Omit it for the headline totals only.
|
|
298
|
+
*/
|
|
299
|
+
tvl(options: { mode?: TvlBreakdownMode } = {}): Promise<TvlResponse> {
|
|
300
|
+
return this.get('/v1/tvl', { mode: options.mode });
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* GET /v1/tvl/timeseries — daily aggregate Gauntlet TVL over a fixed
|
|
305
|
+
* 3-month trailing window. `mode` partitions each point's `sources` the
|
|
306
|
+
* same way `tvl()` partitions its `breakdown`; a point's total never
|
|
307
|
+
* depends on it.
|
|
308
|
+
*/
|
|
309
|
+
tvlTimeseries(options: { mode?: TvlBreakdownMode } = {}): Promise<TvlTimeseriesResponse> {
|
|
310
|
+
return this.get('/v1/tvl/timeseries', { mode: options.mode });
|
|
212
311
|
}
|
|
213
312
|
|
|
214
313
|
/** GET /v1/prices — latest USD price for a token. */
|
package/src/api/decimal.ts
CHANGED
|
@@ -17,6 +17,7 @@ export function decimalToBigInt(value: string, decimals: number): bigint {
|
|
|
17
17
|
if (!Number.isInteger(decimals) || decimals < 0) {
|
|
18
18
|
throw new InvalidDecimalError(`decimals=${decimals}`);
|
|
19
19
|
}
|
|
20
|
+
if (typeof value !== 'string') throw new InvalidDecimalError(String(value));
|
|
20
21
|
const match = DECIMAL_RE.exec(value);
|
|
21
22
|
if (!match) throw new InvalidDecimalError(value);
|
|
22
23
|
|