augustdigital-sdk 8.20.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.
Files changed (316) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +349 -0
  3. package/lib/abis/AddressResolver.d.ts +28 -0
  4. package/lib/abis/AddressResolver.js +23 -0
  5. package/lib/abis/ChainlinkV3.d.ts +87 -0
  6. package/lib/abis/ChainlinkV3.js +117 -0
  7. package/lib/abis/ERC20.d.ts +168 -0
  8. package/lib/abis/ERC20.js +226 -0
  9. package/lib/abis/ERC20_Bytes32.d.ts +139 -0
  10. package/lib/abis/ERC20_Bytes32.js +196 -0
  11. package/lib/abis/ERC4626.d.ts +364 -0
  12. package/lib/abis/ERC4626.js +507 -0
  13. package/lib/abis/ERC721.d.ts +231 -0
  14. package/lib/abis/ERC721.js +321 -0
  15. package/lib/abis/FeeOracle.d.ts +120 -0
  16. package/lib/abis/FeeOracle.js +162 -0
  17. package/lib/abis/LendingPool.d.ts +1393 -0
  18. package/lib/abis/LendingPool.js +1807 -0
  19. package/lib/abis/LendingPoolV2.d.ts +1413 -0
  20. package/lib/abis/LendingPoolV2.js +1833 -0
  21. package/lib/abis/LendingPoolV3.d.ts +1677 -0
  22. package/lib/abis/LendingPoolV3.js +1160 -0
  23. package/lib/abis/Loan.d.ts +837 -0
  24. package/lib/abis/Loan.js +1080 -0
  25. package/lib/abis/MultiAssetNativeDepositWrapper.d.ts +137 -0
  26. package/lib/abis/MultiAssetNativeDepositWrapper.js +125 -0
  27. package/lib/abis/Multicall3.d.ts +30 -0
  28. package/lib/abis/Multicall3.js +97 -0
  29. package/lib/abis/OFT.d.ts +116 -0
  30. package/lib/abis/OFT.js +85 -0
  31. package/lib/abis/PoolAdapter.d.ts +36 -0
  32. package/lib/abis/PoolAdapter.js +51 -0
  33. package/lib/abis/RewardDistributor.d.ts +267 -0
  34. package/lib/abis/RewardDistributor.js +352 -0
  35. package/lib/abis/RwaRedeemSubaccount.d.ts +747 -0
  36. package/lib/abis/RwaRedeemSubaccount.js +548 -0
  37. package/lib/abis/SmartAccount.d.ts +17 -0
  38. package/lib/abis/SmartAccount.js +19 -0
  39. package/lib/abis/SwapRouter.d.ts +1043 -0
  40. package/lib/abis/SwapRouter.js +740 -0
  41. package/lib/abis/TextResolver.d.ts +16 -0
  42. package/lib/abis/TextResolver.js +16 -0
  43. package/lib/abis/TokenizedVaultV2.d.ts +1364 -0
  44. package/lib/abis/TokenizedVaultV2.js +1041 -0
  45. package/lib/abis/TokenizedVaultV2DepositWithPermit.d.ts +1456 -0
  46. package/lib/abis/TokenizedVaultV2DepositWithPermit.js +1878 -0
  47. package/lib/abis/TokenizedVaultV2Receipt.d.ts +1568 -0
  48. package/lib/abis/TokenizedVaultV2Receipt.js +1061 -0
  49. package/lib/abis/TokenizedVaultV2SenderAllocationWhitelist.d.ts +454 -0
  50. package/lib/abis/TokenizedVaultV2SenderAllocationWhitelist.js +327 -0
  51. package/lib/abis/TokenizedVaultV2WhitelistedAllocation.d.ts +1466 -0
  52. package/lib/abis/TokenizedVaultV2WhitelistedAllocation.js +1092 -0
  53. package/lib/abis/TokenizedVaultV2WhitelistedAssets.d.ts +274 -0
  54. package/lib/abis/TokenizedVaultV2WhitelistedAssets.js +167 -0
  55. package/lib/abis/UniversalResolverResolve.d.ts +69 -0
  56. package/lib/abis/UniversalResolverResolve.js +35 -0
  57. package/lib/abis/UniversalSignatureValidator.d.ts +17 -0
  58. package/lib/abis/UniversalSignatureValidator.js +30 -0
  59. package/lib/abis/WrapperAdapter.d.ts +71 -0
  60. package/lib/abis/WrapperAdapter.js +77 -0
  61. package/lib/abis/index.d.ts +34 -0
  62. package/lib/abis/index.js +51 -0
  63. package/lib/adapters/evm/getters.d.ts +19 -0
  64. package/lib/adapters/evm/getters.js +209 -0
  65. package/lib/adapters/evm/index.d.ts +353 -0
  66. package/lib/adapters/evm/index.js +434 -0
  67. package/lib/adapters/evm/utils.d.ts +8 -0
  68. package/lib/adapters/evm/utils.js +51 -0
  69. package/lib/adapters/solana/constants.d.ts +33 -0
  70. package/lib/adapters/solana/constants.js +52 -0
  71. package/lib/adapters/solana/getters.d.ts +11 -0
  72. package/lib/adapters/solana/getters.js +165 -0
  73. package/lib/adapters/solana/idl/vault-idl.d.ts +272 -0
  74. package/lib/adapters/solana/idl/vault-idl.js +1084 -0
  75. package/lib/adapters/solana/index.d.ts +233 -0
  76. package/lib/adapters/solana/index.js +291 -0
  77. package/lib/adapters/solana/types.d.ts +67 -0
  78. package/lib/adapters/solana/types.js +3 -0
  79. package/lib/adapters/solana/utils.d.ts +141 -0
  80. package/lib/adapters/solana/utils.js +595 -0
  81. package/lib/adapters/solana/vault.actions.d.ts +57 -0
  82. package/lib/adapters/solana/vault.actions.js +379 -0
  83. package/lib/adapters/stellar/actions.d.ts +28 -0
  84. package/lib/adapters/stellar/actions.js +77 -0
  85. package/lib/adapters/stellar/constants.d.ts +43 -0
  86. package/lib/adapters/stellar/constants.js +53 -0
  87. package/lib/adapters/stellar/getters.d.ts +68 -0
  88. package/lib/adapters/stellar/getters.js +290 -0
  89. package/lib/adapters/stellar/index.d.ts +114 -0
  90. package/lib/adapters/stellar/index.js +175 -0
  91. package/lib/adapters/stellar/soroban.d.ts +123 -0
  92. package/lib/adapters/stellar/soroban.js +613 -0
  93. package/lib/adapters/stellar/submit.d.ts +34 -0
  94. package/lib/adapters/stellar/submit.js +149 -0
  95. package/lib/adapters/stellar/types.d.ts +58 -0
  96. package/lib/adapters/stellar/types.js +6 -0
  97. package/lib/adapters/stellar/utils.d.ts +24 -0
  98. package/lib/adapters/stellar/utils.js +34 -0
  99. package/lib/adapters/sui/constants.d.ts +14 -0
  100. package/lib/adapters/sui/constants.js +29 -0
  101. package/lib/adapters/sui/getters.d.ts +9 -0
  102. package/lib/adapters/sui/getters.js +60 -0
  103. package/lib/adapters/sui/index.d.ts +45 -0
  104. package/lib/adapters/sui/index.js +101 -0
  105. package/lib/adapters/sui/transformer.d.ts +10 -0
  106. package/lib/adapters/sui/transformer.js +107 -0
  107. package/lib/adapters/sui/types.d.ts +66 -0
  108. package/lib/adapters/sui/types.js +3 -0
  109. package/lib/adapters/sui/utils.d.ts +10 -0
  110. package/lib/adapters/sui/utils.js +29 -0
  111. package/lib/core/analytics/chain-name.d.ts +9 -0
  112. package/lib/core/analytics/chain-name.js +34 -0
  113. package/lib/core/analytics/constants.d.ts +5 -0
  114. package/lib/core/analytics/constants.js +9 -0
  115. package/lib/core/analytics/env.d.ts +29 -0
  116. package/lib/core/analytics/env.js +59 -0
  117. package/lib/core/analytics/index.d.ts +36 -0
  118. package/lib/core/analytics/index.js +79 -0
  119. package/lib/core/analytics/instrumentation.d.ts +29 -0
  120. package/lib/core/analytics/instrumentation.js +277 -0
  121. package/lib/core/analytics/method-taxonomy.d.ts +19 -0
  122. package/lib/core/analytics/method-taxonomy.js +128 -0
  123. package/lib/core/analytics/metrics.d.ts +33 -0
  124. package/lib/core/analytics/metrics.js +116 -0
  125. package/lib/core/analytics/sanitize.d.ts +44 -0
  126. package/lib/core/analytics/sanitize.js +260 -0
  127. package/lib/core/analytics/sentry-runtime.d.ts +15 -0
  128. package/lib/core/analytics/sentry-runtime.js +97 -0
  129. package/lib/core/analytics/sentry.d.ts +67 -0
  130. package/lib/core/analytics/sentry.js +613 -0
  131. package/lib/core/analytics/types.d.ts +48 -0
  132. package/lib/core/analytics/types.js +3 -0
  133. package/lib/core/analytics/user-identity.d.ts +41 -0
  134. package/lib/core/analytics/user-identity.js +141 -0
  135. package/lib/core/analytics/version.d.ts +6 -0
  136. package/lib/core/analytics/version.js +10 -0
  137. package/lib/core/attribution.d.ts +111 -0
  138. package/lib/core/attribution.js +142 -0
  139. package/lib/core/auth/index.d.ts +1 -0
  140. package/lib/core/auth/index.js +18 -0
  141. package/lib/core/auth/verify.d.ts +2 -0
  142. package/lib/core/auth/verify.js +31 -0
  143. package/lib/core/base.class.d.ts +152 -0
  144. package/lib/core/base.class.js +172 -0
  145. package/lib/core/cache.d.ts +9 -0
  146. package/lib/core/cache.js +31 -0
  147. package/lib/core/constants/adapters.d.ts +103 -0
  148. package/lib/core/constants/adapters.js +180 -0
  149. package/lib/core/constants/core.d.ts +133 -0
  150. package/lib/core/constants/core.js +209 -0
  151. package/lib/core/constants/swap-router.d.ts +150 -0
  152. package/lib/core/constants/swap-router.js +169 -0
  153. package/lib/core/constants/vaults.d.ts +93 -0
  154. package/lib/core/constants/vaults.js +273 -0
  155. package/lib/core/constants/web3.d.ts +91 -0
  156. package/lib/core/constants/web3.js +229 -0
  157. package/lib/core/errors/index.d.ts +114 -0
  158. package/lib/core/errors/index.js +183 -0
  159. package/lib/core/fetcher.d.ts +198 -0
  160. package/lib/core/fetcher.js +903 -0
  161. package/lib/core/helpers/adapters.d.ts +13 -0
  162. package/lib/core/helpers/adapters.js +39 -0
  163. package/lib/core/helpers/chain-address.d.ts +13 -0
  164. package/lib/core/helpers/chain-address.js +47 -0
  165. package/lib/core/helpers/chain-error.d.ts +207 -0
  166. package/lib/core/helpers/chain-error.js +682 -0
  167. package/lib/core/helpers/chain-support.d.ts +80 -0
  168. package/lib/core/helpers/chain-support.js +115 -0
  169. package/lib/core/helpers/core.d.ts +68 -0
  170. package/lib/core/helpers/core.js +285 -0
  171. package/lib/core/helpers/explorer-link.d.ts +16 -0
  172. package/lib/core/helpers/explorer-link.js +26 -0
  173. package/lib/core/helpers/multicall.d.ts +68 -0
  174. package/lib/core/helpers/multicall.js +103 -0
  175. package/lib/core/helpers/revert-decode.d.ts +248 -0
  176. package/lib/core/helpers/revert-decode.js +515 -0
  177. package/lib/core/helpers/signer.d.ts +52 -0
  178. package/lib/core/helpers/signer.js +145 -0
  179. package/lib/core/helpers/swap-router.d.ts +211 -0
  180. package/lib/core/helpers/swap-router.js +480 -0
  181. package/lib/core/helpers/vault-version.d.ts +23 -0
  182. package/lib/core/helpers/vault-version.js +75 -0
  183. package/lib/core/helpers/vaults.d.ts +89 -0
  184. package/lib/core/helpers/vaults.js +235 -0
  185. package/lib/core/helpers/web3.d.ts +353 -0
  186. package/lib/core/helpers/web3.js +992 -0
  187. package/lib/core/index.d.ts +23 -0
  188. package/lib/core/index.js +40 -0
  189. package/lib/core/logger/index.d.ts +98 -0
  190. package/lib/core/logger/index.js +144 -0
  191. package/lib/core/logger/slack.d.ts +16 -0
  192. package/lib/core/logger/slack.js +57 -0
  193. package/lib/core/vault-metadata.d.ts +12 -0
  194. package/lib/core/vault-metadata.js +42 -0
  195. package/lib/core/version-check.d.ts +58 -0
  196. package/lib/core/version-check.js +182 -0
  197. package/lib/evm/index.d.ts +2 -0
  198. package/lib/evm/index.js +19 -0
  199. package/lib/evm/methods/crossChainVault.d.ts +128 -0
  200. package/lib/evm/methods/crossChainVault.js +853 -0
  201. package/lib/evm/methods/crossChainVaultRegistry.d.ts +93 -0
  202. package/lib/evm/methods/crossChainVaultRegistry.js +240 -0
  203. package/lib/evm/methods/index.d.ts +2 -0
  204. package/lib/evm/methods/index.js +19 -0
  205. package/lib/evm/types/crossChain.d.ts +363 -0
  206. package/lib/evm/types/crossChain.js +20 -0
  207. package/lib/evm/types/index.d.ts +1 -0
  208. package/lib/evm/types/index.js +18 -0
  209. package/lib/index.d.ts +30 -0
  210. package/lib/index.js +52 -0
  211. package/lib/main.d.ts +527 -0
  212. package/lib/main.js +601 -0
  213. package/lib/modules/api/fetcher.d.ts +82 -0
  214. package/lib/modules/api/fetcher.js +150 -0
  215. package/lib/modules/api/index.d.ts +1 -0
  216. package/lib/modules/api/index.js +6 -0
  217. package/lib/modules/api/main.d.ts +313 -0
  218. package/lib/modules/api/main.js +479 -0
  219. package/lib/modules/sub-accounts/fetcher.d.ts +53 -0
  220. package/lib/modules/sub-accounts/fetcher.js +120 -0
  221. package/lib/modules/sub-accounts/index.d.ts +2 -0
  222. package/lib/modules/sub-accounts/index.js +19 -0
  223. package/lib/modules/sub-accounts/main.d.ts +243 -0
  224. package/lib/modules/sub-accounts/main.js +205 -0
  225. package/lib/modules/sub-accounts/utils.d.ts +106 -0
  226. package/lib/modules/sub-accounts/utils.js +112 -0
  227. package/lib/modules/vaults/adapter.helpers.d.ts +64 -0
  228. package/lib/modules/vaults/adapter.helpers.js +184 -0
  229. package/lib/modules/vaults/fetcher.d.ts +147 -0
  230. package/lib/modules/vaults/fetcher.js +368 -0
  231. package/lib/modules/vaults/getters.d.ts +570 -0
  232. package/lib/modules/vaults/getters.js +3051 -0
  233. package/lib/modules/vaults/index.d.ts +20 -0
  234. package/lib/modules/vaults/index.js +44 -0
  235. package/lib/modules/vaults/main.d.ts +601 -0
  236. package/lib/modules/vaults/main.js +1623 -0
  237. package/lib/modules/vaults/prefetch.d.ts +65 -0
  238. package/lib/modules/vaults/prefetch.js +120 -0
  239. package/lib/modules/vaults/read.actions.d.ts +225 -0
  240. package/lib/modules/vaults/read.actions.js +596 -0
  241. package/lib/modules/vaults/types.d.ts +71 -0
  242. package/lib/modules/vaults/types.js +3 -0
  243. package/lib/modules/vaults/utils/call-data-decoder.d.ts +61 -0
  244. package/lib/modules/vaults/utils/call-data-decoder.js +194 -0
  245. package/lib/modules/vaults/utils/date-utils.d.ts +50 -0
  246. package/lib/modules/vaults/utils/date-utils.js +84 -0
  247. package/lib/modules/vaults/utils.d.ts +140 -0
  248. package/lib/modules/vaults/utils.js +799 -0
  249. package/lib/modules/vaults/write.actions.d.ts +529 -0
  250. package/lib/modules/vaults/write.actions.js +1749 -0
  251. package/lib/polyfills.d.ts +1 -0
  252. package/lib/polyfills.js +12 -0
  253. package/lib/sdk.d.ts +26721 -0
  254. package/lib/services/coingecko/fetcher.d.ts +15 -0
  255. package/lib/services/coingecko/fetcher.js +67 -0
  256. package/lib/services/coingecko/index.d.ts +2 -0
  257. package/lib/services/coingecko/index.js +19 -0
  258. package/lib/services/coingecko/utils.d.ts +1 -0
  259. package/lib/services/coingecko/utils.js +24 -0
  260. package/lib/services/debank/fetcher.d.ts +126 -0
  261. package/lib/services/debank/fetcher.js +47 -0
  262. package/lib/services/debank/index.d.ts +2 -0
  263. package/lib/services/debank/index.js +19 -0
  264. package/lib/services/debank/utils.d.ts +38 -0
  265. package/lib/services/debank/utils.js +297 -0
  266. package/lib/services/layerzero/deposits.d.ts +49 -0
  267. package/lib/services/layerzero/deposits.js +166 -0
  268. package/lib/services/layerzero/redeems.d.ts +20 -0
  269. package/lib/services/layerzero/redeems.js +92 -0
  270. package/lib/services/layerzero/utils.d.ts +9 -0
  271. package/lib/services/layerzero/utils.js +22 -0
  272. package/lib/services/octavfi/fetcher.d.ts +9 -0
  273. package/lib/services/octavfi/fetcher.js +103 -0
  274. package/lib/services/octavfi/index.d.ts +3 -0
  275. package/lib/services/octavfi/index.js +20 -0
  276. package/lib/services/octavfi/types.d.ts +34 -0
  277. package/lib/services/octavfi/types.js +3 -0
  278. package/lib/services/octavfi/utils.d.ts +16 -0
  279. package/lib/services/octavfi/utils.js +212 -0
  280. package/lib/services/subgraph/fetcher.d.ts +2 -0
  281. package/lib/services/subgraph/fetcher.js +61 -0
  282. package/lib/services/subgraph/index.d.ts +2 -0
  283. package/lib/services/subgraph/index.js +19 -0
  284. package/lib/services/subgraph/schema.d.ts +45 -0
  285. package/lib/services/subgraph/schema.js +75 -0
  286. package/lib/services/subgraph/vaults.d.ts +25 -0
  287. package/lib/services/subgraph/vaults.js +1106 -0
  288. package/lib/services/swap-quotes/index.d.ts +105 -0
  289. package/lib/services/swap-quotes/index.js +77 -0
  290. package/lib/services/swap-quotes/paraswap.d.ts +51 -0
  291. package/lib/services/swap-quotes/paraswap.js +138 -0
  292. package/lib/types/api.d.ts +280 -0
  293. package/lib/types/api.js +3 -0
  294. package/lib/types/index.d.ts +12 -0
  295. package/lib/types/index.js +28 -0
  296. package/lib/types/points.d.ts +28 -0
  297. package/lib/types/points.js +3 -0
  298. package/lib/types/pools.d.ts +144 -0
  299. package/lib/types/pools.js +3 -0
  300. package/lib/types/staking.d.ts +28 -0
  301. package/lib/types/staking.js +3 -0
  302. package/lib/types/sub-accounts.d.ts +140 -0
  303. package/lib/types/sub-accounts.js +3 -0
  304. package/lib/types/subgraph.d.ts +74 -0
  305. package/lib/types/subgraph.js +3 -0
  306. package/lib/types/typed-contract.d.ts +102 -0
  307. package/lib/types/typed-contract.js +3 -0
  308. package/lib/types/user.d.ts +1 -0
  309. package/lib/types/user.js +3 -0
  310. package/lib/types/vaults.d.ts +714 -0
  311. package/lib/types/vaults.js +24 -0
  312. package/lib/types/web3.d.ts +51 -0
  313. package/lib/types/web3.js +14 -0
  314. package/lib/types/webserver.d.ts +698 -0
  315. package/lib/types/webserver.js +3 -0
  316. package/package.json +78 -0
@@ -0,0 +1,529 @@
1
+ import { type Signer, type Wallet, type TransactionResponse } from 'ethers';
2
+ import type { IAddress } from '../../types';
3
+ import type { ISwapAndDepositOptions, ISwapRouterDirectDepositOptions, ISwapRouterNativeDepositOptions, ISwapRouterDepositOptions } from '../../types';
4
+ export type IContractWriteOptions = {
5
+ target: IAddress;
6
+ wallet: IAddress;
7
+ amount?: string | bigint | number;
8
+ wait?: boolean;
9
+ /**
10
+ * Optional: Token to deposit (defaults to vault's underlying asset)
11
+ * If different from underlying, will use adapter logic
12
+ */
13
+ depositAsset?: IAddress;
14
+ /**
15
+ * Optional: Chain ID for the vault (used for adapter routing)
16
+ */
17
+ chainId?: number;
18
+ /**
19
+ * Optional: Pool/vault name for adapter routing
20
+ */
21
+ poolName?: string;
22
+ /**
23
+ * Optional: boolean for instant redeem
24
+ */
25
+ isInstantRedeem?: boolean;
26
+ /**
27
+ * Optional: boolean for depositWithPermit
28
+ */
29
+ isDepositWithPermit?: boolean;
30
+ /**
31
+ * Optional: address that receives the vault shares. Defaults to `wallet`.
32
+ * Only honored on the SwapRouter dispatch path; legacy adapters mint to `wallet`.
33
+ */
34
+ receiver?: IAddress;
35
+ /**
36
+ * Optional: slippage tolerance in bps (1 bp = 0.01%) applied to any swap
37
+ * quote the SwapRouter dispatch path fetches when `depositAsset` differs
38
+ * from the vault's reference asset. Must be in `[0, 10_000)`. Defaults to
39
+ * `100` (1%). Ignored for same-asset deposits and legacy adapter paths.
40
+ */
41
+ slippageBps?: number;
42
+ };
43
+ export type INativeDepositOptions = {
44
+ /**
45
+ * MultiAssetNativeDepositWrapper contract address
46
+ */
47
+ wrapperAddress: IAddress;
48
+ /**
49
+ * Optional: Receiver address for the deposit (defaults to signer address)
50
+ * If not provided, uses the overload without receiver parameter
51
+ */
52
+ receiver?: IAddress;
53
+ /**
54
+ * Amount of native token (ETH/AVAX/etc) to deposit
55
+ */
56
+ amount: string | bigint | number;
57
+ /**
58
+ * Optional: Wait for transaction confirmation
59
+ */
60
+ wait?: boolean;
61
+ };
62
+ /** @internal */
63
+ export declare function safeBigInt(value: unknown, context?: string): bigint;
64
+ /** @internal */
65
+ export declare function resolveDepositTokenDecimals(args: {
66
+ actualDepositAsset: IAddress;
67
+ underlyingAsset: IAddress;
68
+ isNativeToken: boolean;
69
+ isMultiAssetVault: boolean;
70
+ vaultDecimals: number;
71
+ readErc20Decimals: (address: IAddress) => Promise<number>;
72
+ }): Promise<number>;
73
+ /** @internal */
74
+ export declare function resolveSpender(args: {
75
+ target: IAddress;
76
+ isMultiAssetVault: boolean;
77
+ isAdapterDeposit: boolean;
78
+ adapterWrapperAddress?: IAddress;
79
+ }): IAddress;
80
+ /** @internal */
81
+ export declare function validateAmountPrecision(amount: string | bigint | number): void;
82
+ /** @internal */
83
+ export declare function isNonceParsing(error: unknown): boolean;
84
+ /**
85
+ * Await a broadcast transaction's receipt, surviving both malformed-nonce RPCs
86
+ * and transient transport faults while still reporting genuine on-chain
87
+ * failures.
88
+ *
89
+ * `tx.wait()` is tried first because it preserves ethers' replacement-tx
90
+ * detection and revert checks. Two recoverable failure modes are handled:
91
+ *
92
+ * 1. **Malformed nonce** ({@link isNonceParsing}) — Monad-style RPCs return
93
+ * `nonce: "undefined"` on the pending tx and ethers throws while parsing.
94
+ * One direct `provider.waitForTransaction()` recovers it (unchanged
95
+ * behaviour).
96
+ * 2. **Transient transport fault** ({@link isRetryableRpcError}) — the provider
97
+ * hiccups while polling `eth_getTransactionReceipt` and ethers surfaces
98
+ * `could not coalesce error (… "code": -32603 …)`. This used to propagate
99
+ * and make every write path report a **successfully mined** transaction as
100
+ * failed, driving users to retry into `ERC20InsufficientBalance`. The hash
101
+ * is already on the wire and receipt polling is idempotent, so we re-poll
102
+ * with bounded exponential backoff instead of rethrowing.
103
+ *
104
+ * Everything else — notably a real revert — is rethrown untouched.
105
+ *
106
+ * Every error this function throws is stamped by {@link markBroadcast}: by the
107
+ * time `tx.wait()` can fail, the transaction is already on the wire, so the
108
+ * caller must never report it as "never sent". See
109
+ * {@link localTxBroadcastContext} for how that reaches
110
+ * `AugustSDKError.context`.
111
+ *
112
+ * @param tx - The broadcast transaction response to await.
113
+ * @returns The mined receipt (never `null` on the fallback paths; `tx.wait()`
114
+ * itself may return `null` when the caller configured 0 confirmations).
115
+ * @throws {Error} `Transaction <hash> reverted on-chain` when the receipt
116
+ * reports `status === 0`. Marked `confirmationUnknown: false` — the chain
117
+ * answered.
118
+ * @throws {Error} `Transaction <hash> was not confirmed within <n>s` when the
119
+ * overall wait times out with no receipt. Marked
120
+ * `confirmationUnknown: true`.
121
+ * @throws The underlying transport error once receipt-poll retries are
122
+ * exhausted, marked `confirmationUnknown: true`.
123
+ * @internal
124
+ */
125
+ export declare function safeWaitForTx(tx: TransactionResponse): Promise<import("ethers").TransactionReceipt>;
126
+ /**
127
+ * Wraps an ethers contract call that returns a TransactionResponse.
128
+ * Some RPCs (e.g. Monad) return malformed pending tx fields like `nonce: "undefined"`,
129
+ * which causes ethers.js to throw during response parsing before safeWaitForTx runs.
130
+ * This wrapper catches that error, extracts the tx hash from the error context, and
131
+ * falls back to provider.waitForTransaction().
132
+ */
133
+ /** @internal */
134
+ export declare function safeSendTx(contractCall: () => Promise<TransactionResponse>, provider: Signer | Wallet, shouldWait?: boolean): Promise<{
135
+ tx: TransactionResponse | null;
136
+ hash: string;
137
+ }>;
138
+ /**
139
+ * Shared nonce-recovery helper for catch blocks. When an RPC returns a
140
+ * malformed nonce and ethers throws, try to extract the tx hash from the
141
+ * error payload. Optionally waits for confirmation (with status check).
142
+ *
143
+ * Returns the recovered hash, or null if this error is not a nonce-parse error
144
+ * or if no hash could be extracted (caller should re-throw the original error).
145
+ */
146
+ /** @internal */
147
+ export declare function tryRecoverTxHash(error: unknown, signer: Signer | Wallet, wait?: boolean): Promise<string | null>;
148
+ /**
149
+ * Discriminated union returned by {@link approve}. Lets callers tell apart
150
+ * "we sent a tx" / "existing allowance already covers it" / "native token, no
151
+ * allowance applies" without re-reading on-chain state.
152
+ */
153
+ export type ApproveResult =
154
+ /** An `approve` transaction was sent. `hash` is the tx hash. */
155
+ {
156
+ kind: 'sent';
157
+ hash: string;
158
+ }
159
+ /**
160
+ * Existing allowance already covers `amount`; no tx sent. `existing` is
161
+ * the on-chain allowance (raw bigint, in deposit-token units).
162
+ */
163
+ | {
164
+ kind: 'sufficient';
165
+ existing: bigint;
166
+ }
167
+ /**
168
+ * The resolved deposit asset is the native token — it travels as
169
+ * `msg.value`, so no ERC-20 allowance applies. No tx sent.
170
+ */
171
+ | {
172
+ kind: 'native';
173
+ };
174
+ /**
175
+ * Approve a vault (or the appropriate adapter wrapper) to spend a token
176
+ * ahead of a separate deposit call. Spender routing mirrors
177
+ * {@link vaultDeposit} (multi-asset → vault, adapter → wrapper, standard →
178
+ * vault). Returns `undefined` when the existing allowance already covers
179
+ * `amount` **or** when the deposit asset is native.
180
+ *
181
+ * @returns Transaction hash when an approval was sent, `undefined` when
182
+ * the existing allowance already covers `amount` or the deposit asset is
183
+ * native (no ERC-20 allowance applies). Use {@link approve} for a
184
+ * discriminated `ApproveResult` if you need to tell those two cases apart.
185
+ * @throws AugustValidationError on invalid wallet/target/amount.
186
+ *
187
+ * @example
188
+ * ```ts
189
+ * const hash = await augustSdk.evm.vaultApprove({
190
+ * target: '0x...', // vault contract address
191
+ * wallet: walletAddress,
192
+ * amount: '100', // 100 of the deposit token (UI units)
193
+ * wait: true, // wait for the approval to confirm
194
+ * });
195
+ * if (hash) console.log('approve tx', hash);
196
+ * // hash === undefined means the on-chain allowance already covers the
197
+ * // amount, or the deposit asset is native (msg.value, no allowance).
198
+ * ```
199
+ */
200
+ export declare function vaultApprove(signer: Signer | Wallet, options: IContractWriteOptions): Promise<string | undefined>;
201
+ /**
202
+ * Same approval logic as {@link vaultApprove} but returns a discriminated
203
+ * union so callers can tell `sent` apart from `sufficient` and `native`
204
+ * without re-reading on-chain state. Preferred shape for new integrations.
205
+ *
206
+ * @example
207
+ * ```ts
208
+ * const r = await augustSdk.evm.approve({
209
+ * target: vaultAddress,
210
+ * wallet: walletAddress,
211
+ * amount: '100',
212
+ * wait: true,
213
+ * });
214
+ * switch (r.kind) {
215
+ * case 'sent':
216
+ * showToast('Approval submitted', r.hash);
217
+ * break;
218
+ * case 'sufficient':
219
+ * // r.existing is the existing on-chain allowance (raw bigint)
220
+ * break;
221
+ * case 'native':
222
+ * // No allowance needed; native token will travel as msg.value
223
+ * break;
224
+ * }
225
+ * ```
226
+ *
227
+ * @throws AugustValidationError on invalid wallet/target/amount.
228
+ * @throws AugustSDKError when the approval submission fails.
229
+ */
230
+ export declare function approve(signer: Signer | Wallet, options: IContractWriteOptions): Promise<ApproveResult>;
231
+ /**
232
+ * Deposit underlying token into the specified vault. Auto-routes to the
233
+ * correct contract path (single-asset ERC-4626, EVM-2 multi-asset,
234
+ * Paraswap adapter, native-token wrapper, depositWithPermit) based on the
235
+ * vault version and `depositAsset`.
236
+ *
237
+ * Amounts are encoded against the **deposit token's** decimals, not the
238
+ * vault's share decimals. The SDK reads the appropriate decimals via the
239
+ * vault metadata and the asset's ERC-20.
240
+ *
241
+ * Approval is handled automatically: if the existing allowance doesn't
242
+ * cover `amount`, an `approve` is sent and **always waited for** (regardless
243
+ * of the caller's `wait` flag) so the deposit tx can't be re-ordered ahead
244
+ * of the approval on Monad-style RPCs.
245
+ *
246
+ * @param signer ethers Signer / Wallet (or viem WalletClient via {@link setSigner})
247
+ * @param options Vault address, wallet, amount, optional `depositAsset` for
248
+ * adapter routes, optional `wait` to wait for the deposit receipt.
249
+ * @returns Deposit transaction hash.
250
+ * @throws AugustValidationError on invalid wallet/target/amount or missing
251
+ * adapter config when `depositAsset` differs from the vault underlying.
252
+ * @throws AugustSDKError when the deposit submission or on-chain call fails.
253
+ *
254
+ * @example
255
+ * ```ts
256
+ * const hash = await augustSdk.evm.vaultDeposit({
257
+ * target: '0xE9B725010A9E419412ed67d0fA5f3A5f40159D32', // vault
258
+ * wallet: walletAddress,
259
+ * amount: '100', // 100 USDC (UI units)
260
+ * wait: true, // wait for the deposit receipt
261
+ * });
262
+ * ```
263
+ *
264
+ * @example Adapter deposit (different deposit asset than the vault's underlying)
265
+ * ```ts
266
+ * await augustSdk.evm.vaultDeposit({
267
+ * target: vaultAddress,
268
+ * wallet: walletAddress,
269
+ * amount: '0.5',
270
+ * depositAsset: WETH_ADDRESS, // swap WETH -> vault underlying via the adapter
271
+ * chainId: 1,
272
+ * });
273
+ * ```
274
+ */
275
+ export declare function vaultDeposit(signer: Signer | Wallet, options: IContractWriteOptions): Promise<string>;
276
+ /**
277
+ * Request to redeem vault shares. For EVM-1 vaults this queues a standard
278
+ * redemption (claimable later via `vaultRedeem`); for EVM-2 vaults this
279
+ * also handles the receipt-token allowance automatically. Pass
280
+ * `isInstantRedeem: true` for vaults that support instant settlement.
281
+ *
282
+ * Approval of the receipt token (EVM-2) is always waited on before the
283
+ * redeem call, regardless of the caller's `wait` flag.
284
+ *
285
+ * @param signer ethers Signer / Wallet (or viem WalletClient via {@link setSigner})
286
+ * @param options Vault address, wallet, amount, optional `isInstantRedeem`,
287
+ * optional `wait` to wait for the redeem receipt.
288
+ * @returns Redeem transaction hash.
289
+ * @throws AugustValidationError on invalid wallet/target/amount.
290
+ * @throws AugustSDKError when the redeem submission or on-chain call fails.
291
+ *
292
+ * @example
293
+ * ```ts
294
+ * const hash = await augustSdk.evm.vaultRequestRedeem({
295
+ * target: vaultAddress,
296
+ * wallet: walletAddress,
297
+ * amount: '10', // 10 shares (UI units)
298
+ * wait: true,
299
+ * });
300
+ * ```
301
+ *
302
+ * @example Instant redemption
303
+ * ```ts
304
+ * await augustSdk.evm.vaultRequestRedeem({
305
+ * target: vaultAddress,
306
+ * wallet: walletAddress,
307
+ * amount: '10',
308
+ * isInstantRedeem: true,
309
+ * });
310
+ * ```
311
+ */
312
+ export declare function vaultRequestRedeem(signer: Signer | Wallet, options: IContractWriteOptions): Promise<string>;
313
+ /**
314
+ * @TODO
315
+ * @description withdraw funds from the specified pool including accrued rewards
316
+ * @param signer signer / wallet object
317
+ * @param options object including pool contract address, user wallet address, and more
318
+ * @returns claim tx hash
319
+ */
320
+ export declare function vaultRedeem(signer: Signer | Wallet, options: IContractWriteOptions & {
321
+ year: string;
322
+ month: string;
323
+ day: string;
324
+ receiverIndex: string;
325
+ }): Promise<string>;
326
+ /**
327
+ * Deposit a native token (ETH / AVAX / etc.) into a vault via the
328
+ * `MultiAssetNativeDepositWrapper`. The wrapper forwards `msg.value` to
329
+ * the vault as the deposit underlying — no allowance is required.
330
+ *
331
+ * `amount` is the **raw on-chain value in wei-equivalent** (18 decimals
332
+ * for ETH-family natives). If you have a UI-shaped amount in ether, scale
333
+ * it first.
334
+ *
335
+ * @param signer ethers Signer / Wallet
336
+ * @param options `wrapperAddress` is the deployed wrapper contract;
337
+ * `receiver` defaults to the signer's address; `amount` is the native
338
+ * amount in wei; `wait` waits for the deposit receipt.
339
+ * @returns Deposit transaction hash.
340
+ * @throws AugustValidationError on invalid wrapper / receiver / amount.
341
+ * @throws AugustSDKError when the deposit submission or on-chain call fails.
342
+ *
343
+ * @example
344
+ * ```ts
345
+ * import { parseEther } from 'ethers';
346
+ *
347
+ * await augustSdk.evm.depositNative({
348
+ * wrapperAddress: nativeWrapperAddress,
349
+ * amount: parseEther('0.5'), // 0.5 ETH in wei
350
+ * wait: true,
351
+ * });
352
+ * ```
353
+ */
354
+ export declare function depositNative(signer: Signer | Wallet, options: INativeDepositOptions): Promise<string>;
355
+ export type IRwaRedeemOptions = {
356
+ /** RwaRedeemSubaccount contract address */
357
+ target: IAddress;
358
+ /** User wallet address */
359
+ wallet: IAddress;
360
+ /** Redeemable asset address (e.g. USDC, USDT) */
361
+ asset: IAddress;
362
+ /** Amount of vault shares to redeem */
363
+ amount: string | bigint | number;
364
+ /** Minimum output amount (slippage protection), in output asset decimals */
365
+ minOut: string | bigint | number;
366
+ /** Decimals of the vault share token */
367
+ decimals: number;
368
+ /** Decimals of the output/redeemable asset */
369
+ outputDecimals: number;
370
+ /** Wait for transaction confirmation */
371
+ wait?: boolean;
372
+ };
373
+ /**
374
+ * Redeem vault shares for an underlying asset via the RwaRedeemSubaccount.
375
+ * Caller must approve the **vault share token** (not the output asset) to
376
+ * the subaccount beforehand — it pulls shares via `transferFrom`.
377
+ *
378
+ * Pass `minOut` to enforce slippage protection (in `outputDecimals` units).
379
+ * The SDK does not currently compute `minOut` from a slippage percentage —
380
+ * the caller is responsible for choosing a safe lower bound.
381
+ *
382
+ * @throws AugustValidationError on invalid addresses or amount inputs.
383
+ * @throws AugustSDKError when the redeem submission or on-chain call fails.
384
+ *
385
+ * @example
386
+ * ```ts
387
+ * // 1. Approve the vault share token to the subaccount first.
388
+ * await augustSdk.evm.vaultApprove({
389
+ * target: subaccountAddress,
390
+ * wallet: walletAddress,
391
+ * amount: '10',
392
+ * wait: true,
393
+ * });
394
+ *
395
+ * // 2. Redeem 10 shares for USDC, requiring at least 9.5 USDC out.
396
+ * await augustSdk.evm.rwaRedeemAsset({
397
+ * target: subaccountAddress,
398
+ * wallet: walletAddress,
399
+ * asset: USDC_ADDRESS,
400
+ * amount: '10',
401
+ * minOut: '9.5',
402
+ * decimals: 18, // vault share decimals
403
+ * outputDecimals: 6, // USDC decimals
404
+ * wait: true,
405
+ * });
406
+ * ```
407
+ */
408
+ export declare function rwaRedeemAsset(signer: Signer | Wallet, options: IRwaRedeemOptions): Promise<string>;
409
+ /**
410
+ * Swap one or more whitelisted ERC-20s into a vault's reference asset via
411
+ * the on-chain SwapRouter, then deposit the proceeds into the vault.
412
+ *
413
+ * Approval is sent automatically when the caller's allowance on each
414
+ * `swaps[i].tokenIn` against the SwapRouter is below `amountIn`.
415
+ *
416
+ * @param signer - ethers `Signer` or `Wallet` with the EOA that holds the input tokens.
417
+ * @param options - {@link ISwapAndDepositOptions}.
418
+ * @returns The transaction hash of the `swapAndDeposit` call.
419
+ *
420
+ * @throws {@link AugustValidationError} for unsupported chains, invalid
421
+ * addresses, empty/oversized swap arrays.
422
+ * @throws {@link AugustSDKError} on unrecoverable contract or RPC failure.
423
+ *
424
+ * @example
425
+ * ```ts
426
+ * const quote = await fetchSwapQuote({
427
+ * chainId: 1,
428
+ * srcToken: WBTC,
429
+ * srcDecimals: 8,
430
+ * destToken: USDC,
431
+ * destDecimals: 6,
432
+ * amount: 100_000_000n,
433
+ * receiver: SWAP_ROUTER_ADDRESSES[1]!,
434
+ * });
435
+ * const hash = await swapAndDeposit(signer, {
436
+ * chainId: 1,
437
+ * vault: '0x8AcA0841993ef4C87244d519166e767f49362C21',
438
+ * receiver: wallet,
439
+ * swaps: [{
440
+ * tokenIn: WBTC,
441
+ * tokenOut: USDC,
442
+ * amountIn: 100_000_000n,
443
+ * minAmountOut: quote.minAmountOut,
444
+ * router: quote.router,
445
+ * payload: quote.payload,
446
+ * }],
447
+ * });
448
+ * ```
449
+ */
450
+ export declare function swapAndDeposit(signer: Signer | Wallet, options: ISwapAndDepositOptions): Promise<string>;
451
+ /**
452
+ * Deposit a vault's reference asset directly through the SwapRouter — no
453
+ * swap. Useful when the caller already holds the reference asset but wants
454
+ * the origin/referral fee accounting that only the SwapRouter path provides.
455
+ *
456
+ * @param signer - ethers `Signer` or `Wallet`.
457
+ * @param options - {@link ISwapRouterDirectDepositOptions}.
458
+ * @returns The transaction hash of the `deposit` call.
459
+ *
460
+ * @throws {@link AugustValidationError} for unsupported chains, invalid
461
+ * addresses, or zero amount.
462
+ */
463
+ export declare function depositViaSwapRouter(signer: Signer | Wallet, options: ISwapRouterDirectDepositOptions): Promise<string>;
464
+ /**
465
+ * Deposit native ETH (or chain-native equivalent) into a vault via the
466
+ * SwapRouter. The router wraps `amount` to the chain's wrapped-native token
467
+ * before depositing — only valid when the vault's reference asset equals
468
+ * the wrapped-native token.
469
+ *
470
+ * No ERC-20 approval is needed; `amount` travels as `msg.value`.
471
+ *
472
+ * @param signer - ethers `Signer` or `Wallet`.
473
+ * @param options - {@link ISwapRouterNativeDepositOptions}.
474
+ * @returns The transaction hash of the `depositNativeToken` call.
475
+ *
476
+ * @throws {@link AugustValidationError} for unsupported chains, invalid
477
+ * addresses, or zero amount.
478
+ */
479
+ export declare function depositNativeViaSwapRouter(signer: Signer | Wallet, options: ISwapRouterNativeDepositOptions): Promise<string>;
480
+ /**
481
+ * Deposit into an August vault through the on-chain `SwapRouter`, selecting the
482
+ * correct router path from the deposit asset. This is the high-level, explicit
483
+ * counterpart to the SwapRouter branch inside {@link vaultDeposit}.
484
+ *
485
+ * Where `vaultDeposit` decides whether to use the SwapRouter from the
486
+ * `VAULTS_USING_SWAP_ROUTER` allowlist, this function always routes through the
487
+ * SwapRouter because the caller asked it to. Making the intent explicit is the
488
+ * point: a native-deposit vault (e.g. a multi-asset Tokenized Vault V2 whose
489
+ * non-reference assets are accepted directly) is never accidentally swapped —
490
+ * the regression that implicit, allowlist-driven routing caused. Use
491
+ * `vaultDeposit` for native / adapter deposits and this for SwapRouter deposits.
492
+ *
493
+ * The vault's reference asset and its decimals are read on-chain (never trusted
494
+ * from the caller — a wrong reference asset would mis-route the swap). The path
495
+ * is then chosen from `depositAsset`:
496
+ * - equals the reference asset → direct router deposit, no swap
497
+ * ({@link depositViaSwapRouter});
498
+ * - the zero address → native-token deposit ({@link depositNativeViaSwapRouter}),
499
+ * valid only when the reference asset is the chain's wrapped-native token;
500
+ * - any other ERC-20 → a swap to the reference asset (Paraswap quote pinned to
501
+ * the chain's whitelisted aggregator, fail-closed on router/selector drift)
502
+ * bundled into {@link swapAndDeposit}.
503
+ *
504
+ * Side effects: reads tokenized-vault metadata, the vault's reference asset and
505
+ * decimals, and (on the swap path) one Paraswap quote; sends one ERC-20
506
+ * `approve` to the SwapRouter when allowance is short, then the deposit tx.
507
+ *
508
+ * @param signer - ethers `Signer` or `Wallet` that signs the approval + deposit.
509
+ * @param options - {@link ISwapRouterDepositOptions}.
510
+ * @returns The transaction hash of the router deposit call.
511
+ * @throws {@link AugustValidationError} for an unsupported chain (no SwapRouter
512
+ * deployment), an invalid vault or deposit-asset address, a missing or zero
513
+ * amount, a native deposit into a non-wrapped-native vault, or drift between
514
+ * the aggregator quote and the on-chain router whitelist.
515
+ * @worstCaseRpcCalls 5 on the swap path — tokenized-vault metadata, reference
516
+ * asset + decimals, deposit-token decimals, the quote, and the allowance read.
517
+ * @example
518
+ * ```ts
519
+ * // USDT deposited into a USDC-reference vault → swapped to USDC en route.
520
+ * const hash = await augustSdk.evm.swapRouterDeposit({
521
+ * chainId: 1,
522
+ * vault: '0xe9b725010a9e419412ed67d0fa5f3a5f40159d32',
523
+ * depositAsset: '0xdAC17F958D2ee523a2206206994597C13D831ec7',
524
+ * amount: '100',
525
+ * slippageBps: 50,
526
+ * });
527
+ * ```
528
+ */
529
+ export declare function swapRouterDeposit(signer: Signer | Wallet, options: ISwapRouterDepositOptions): Promise<string>;