@augustdigital/sdk 8.12.0 → 8.13.0
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/lib/core/analytics/method-taxonomy.js +2 -0
- package/lib/core/analytics/version.d.ts +1 -1
- package/lib/core/analytics/version.js +1 -1
- package/lib/core/constants/swap-router.d.ts +44 -4
- package/lib/core/constants/swap-router.js +49 -5
- package/lib/core/helpers/revert-decode.d.ts +248 -0
- package/lib/core/helpers/revert-decode.js +515 -0
- package/lib/core/helpers/swap-router.d.ts +132 -4
- package/lib/core/helpers/swap-router.js +337 -4
- package/lib/core/helpers/vault-version.d.ts +15 -0
- package/lib/core/helpers/vault-version.js +15 -1
- package/lib/core/index.d.ts +1 -0
- package/lib/core/index.js +1 -0
- package/lib/main.d.ts +46 -0
- package/lib/main.js +46 -0
- package/lib/modules/vaults/main.d.ts +53 -0
- package/lib/modules/vaults/main.js +73 -0
- package/lib/sdk.d.ts +552 -8
- package/package.json +3 -3
|
@@ -1070,6 +1070,79 @@ class AugustVaults extends core_1.AugustBase {
|
|
|
1070
1070
|
return true;
|
|
1071
1071
|
});
|
|
1072
1072
|
}
|
|
1073
|
+
/**
|
|
1074
|
+
* Resolve the ERC-20 tokens currently whitelisted for the `SwapRouter` on a
|
|
1075
|
+
* chain — the any-token set a deposit UI can offer as swap-and-deposit inputs,
|
|
1076
|
+
* each verified `true` against the router's on-chain allowlist.
|
|
1077
|
+
*
|
|
1078
|
+
* Reconstructs the set from the router's `TokenEnabled` event history and
|
|
1079
|
+
* re-checks `whitelistedTokens(token)` for each (the mapping is not
|
|
1080
|
+
* enumerable). See {@link getSwapRouterWhitelistedTokens} for the full
|
|
1081
|
+
* two-stage behavior and RPC cost. Uses this instance's configured provider
|
|
1082
|
+
* for `chainId`; returns `[]` (no RPC) when no router is deployed there or no
|
|
1083
|
+
* provider is configured.
|
|
1084
|
+
*
|
|
1085
|
+
* @param chainId - EVM chain ID to resolve the allowlist for.
|
|
1086
|
+
* @param options - Optional `fromBlock` to override the deploy-block scan floor.
|
|
1087
|
+
* @returns Checksummed whitelisted token addresses; `[]` when unavailable.
|
|
1088
|
+
* Callers still exclude a target vault's natively-accepted assets (those
|
|
1089
|
+
* deposit without a swap).
|
|
1090
|
+
* @throws AugustSDKError when an `eth_getLogs` scan chunk fails.
|
|
1091
|
+
* @example
|
|
1092
|
+
* ```ts
|
|
1093
|
+
* const tokens = await augustSdk.getSwapRouterWhitelistedTokens(1);
|
|
1094
|
+
* ```
|
|
1095
|
+
*/
|
|
1096
|
+
async getSwapRouterWhitelistedTokens(chainId, options) {
|
|
1097
|
+
if (!(0, core_1.getSwapRouterAddress)(chainId))
|
|
1098
|
+
return [];
|
|
1099
|
+
const rpcUrl = this.providers?.[chainId];
|
|
1100
|
+
if (!rpcUrl) {
|
|
1101
|
+
core_1.Logger.log.warn('getSwapRouterWhitelistedTokens', `no provider configured for chain ${chainId}`);
|
|
1102
|
+
return [];
|
|
1103
|
+
}
|
|
1104
|
+
return (0, core_1.getSwapRouterWhitelistedTokens)(chainId, {
|
|
1105
|
+
rpcUrl,
|
|
1106
|
+
fromBlock: options?.fromBlock,
|
|
1107
|
+
});
|
|
1108
|
+
}
|
|
1109
|
+
/**
|
|
1110
|
+
* Resolve the vaults currently eligible for the any-token `SwapRouter`
|
|
1111
|
+
* deposit surface on a chain — every vault the router has `enableVault`-ed
|
|
1112
|
+
* whose on-chain registration is still live.
|
|
1113
|
+
*
|
|
1114
|
+
* Reconstructs the set from the router's `VaultEnabled` event history and
|
|
1115
|
+
* re-checks `vaultInfo(vault).referenceAsset != 0` for each (the mapping is
|
|
1116
|
+
* not enumerable). See {@link getSwapRouterEligibleVaults} for the full
|
|
1117
|
+
* two-stage behavior and RPC cost. Uses this instance's configured provider
|
|
1118
|
+
* for `chainId`; returns `[]` (no RPC) when no router is deployed there or no
|
|
1119
|
+
* provider is configured.
|
|
1120
|
+
*
|
|
1121
|
+
* On-chain eligibility only — app-level policy (e.g. excluding vaults with
|
|
1122
|
+
* their own OVault deposit flow) remains the caller's responsibility.
|
|
1123
|
+
*
|
|
1124
|
+
* @param chainId - EVM chain ID to resolve eligible vaults for.
|
|
1125
|
+
* @param options - Optional `fromBlock` to override the deploy-block scan floor.
|
|
1126
|
+
* @returns Checksummed eligible vault addresses; `[]` when unavailable.
|
|
1127
|
+
* @throws AugustSDKError when an `eth_getLogs` scan chunk fails.
|
|
1128
|
+
* @example
|
|
1129
|
+
* ```ts
|
|
1130
|
+
* const vaults = await augustSdk.getSwapRouterEligibleVaults(1);
|
|
1131
|
+
* ```
|
|
1132
|
+
*/
|
|
1133
|
+
async getSwapRouterEligibleVaults(chainId, options) {
|
|
1134
|
+
if (!(0, core_1.getSwapRouterAddress)(chainId))
|
|
1135
|
+
return [];
|
|
1136
|
+
const rpcUrl = this.providers?.[chainId];
|
|
1137
|
+
if (!rpcUrl) {
|
|
1138
|
+
core_1.Logger.log.warn('getSwapRouterEligibleVaults', `no provider configured for chain ${chainId}`);
|
|
1139
|
+
return [];
|
|
1140
|
+
}
|
|
1141
|
+
return (0, core_1.getSwapRouterEligibleVaults)(chainId, {
|
|
1142
|
+
rpcUrl,
|
|
1143
|
+
fromBlock: options?.fromBlock,
|
|
1144
|
+
});
|
|
1145
|
+
}
|
|
1073
1146
|
/**
|
|
1074
1147
|
* @function getStakingPositions gets all available reward staking positions
|
|
1075
1148
|
* @param wallet optionally passed user wallet address
|