upshift-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,233 @@
1
+ /**
2
+ * Solana Adapter for August SDK
3
+ *
4
+ * @module SolanaAdapter
5
+ */
6
+ import * as SolanaConstants from './constants';
7
+ import * as SolanaGetters from './getters';
8
+ import * as SolanaActions from './vault.actions';
9
+ import type { AnchorProvider, web3 } from '@coral-xyz/anchor';
10
+ import { Connection, PublicKey, type Transaction } from '@solana/web3.js';
11
+ import type { ISolanaNetwork, ISolanaRpcEndpoint } from './types';
12
+ import type { SendTransactionOptions } from '@solana/wallet-adapter-base';
13
+ export declare const Solana: {
14
+ utils: {
15
+ getExplorerLink: ({ signature, type, network, }: {
16
+ signature: string;
17
+ type: "tx" | "address" | "token";
18
+ } & import("./types").ISolanaConnectionOptions) => string;
19
+ isSolanaAddress: typeof import("./utils").isSolanaAddress;
20
+ isSolana: (signature: string) => boolean;
21
+ getProgram: ({ provider, idl, programId, network, }: {
22
+ idl?: any;
23
+ programId?: string;
24
+ } & import("./types").ISolanaConnectionOptions) => import("@coral-xyz/anchor").Program<any>;
25
+ getProvider: ({ connection, publicKey, signTransaction, }: {
26
+ publicKey: PublicKey;
27
+ signTransaction: (<T extends Transaction | web3.VersionedTransaction>(transaction: T) => Promise<T>) | undefined;
28
+ } & import("./types").ISolanaConnectionOptions) => AnchorProvider;
29
+ getReadOnlyProvider: ({ connection }: import("./types").ISolanaConnectionOptions) => AnchorProvider;
30
+ deriveShareMintPda: (vaultProgramId: PublicKey | string) => web3.PublicKey;
31
+ deriveVaultStatePda: (vaultProgramId: PublicKey | string) => web3.PublicKey;
32
+ deriveVaultTokenAtaPda: (vaultProgramId: PublicKey | string, depositMint: PublicKey, vaultVersion?: number) => web3.PublicKey;
33
+ getVaultState: ({ provider, connection, vaultProgramId, vaultAddress, idl, }: {
34
+ vaultProgramId: PublicKey | string;
35
+ vaultAddress?: PublicKey | string;
36
+ idl: any;
37
+ } & import("./types").ISolanaConnectionOptions) => Promise<{
38
+ vaultState: unknown | null;
39
+ depositMintDecimals: number | null;
40
+ }>;
41
+ getVaultStateReadOnly: ({ vaultProgramId, vaultAddress, connection, idl, }: {
42
+ vaultProgramId: PublicKey | string;
43
+ vaultAddress?: PublicKey | string;
44
+ idl: any;
45
+ } & import("./types").ISolanaConnectionOptions) => Promise<{
46
+ vaultState: import("./types").ISolanaVaultState | null;
47
+ depositMintDecimals: number | null;
48
+ }>;
49
+ getToken: ({ mintAddress, endpoint, connection, }: {
50
+ mintAddress: string | PublicKey;
51
+ } & import("./types").ISolanaConnectionOptions) => Promise<{
52
+ address: string;
53
+ symbol: string;
54
+ decimals: number;
55
+ name: string;
56
+ image: string;
57
+ } | null>;
58
+ getTokenSymbol: ({ endpoint, mintAddress, }: {
59
+ mintAddress: string | PublicKey;
60
+ } & import("./types").ISolanaConnectionOptions) => Promise<string | null>;
61
+ fetchUserTokenBalance: ({ connection, publicKey, depositMint, }: {
62
+ publicKey: PublicKey | string;
63
+ depositMint?: PublicKey | string;
64
+ } & import("./types").ISolanaConnectionOptions) => Promise<any>;
65
+ fetchUserShareBalance: ({ connection, publicKey, shareMint, }: {
66
+ publicKey: PublicKey | string;
67
+ shareMint?: PublicKey | string;
68
+ } & import("./types").ISolanaConnectionOptions) => Promise<any>;
69
+ fetchUserShareBalanceRaw: ({ connection, publicKey, shareMint, }: {
70
+ publicKey: PublicKey | string;
71
+ shareMint?: PublicKey | string;
72
+ } & import("./types").ISolanaConnectionOptions) => Promise<{
73
+ amount: string;
74
+ decimals: number | null;
75
+ }>;
76
+ getBestRpcEndpoint: ({ endpoint, network, connection, }: import("./types").ISolanaConnectionOptions) => Promise<"http://127.0.0.1:8899" | `https://${string}`>;
77
+ fallbackDecimals: number;
78
+ fallbackNetwork: import("../..").ISolanaNetwork;
79
+ programIds: {
80
+ devnet: {
81
+ vault: string;
82
+ };
83
+ "mainnet-beta": {
84
+ vault: string;
85
+ };
86
+ localnet: {
87
+ vault: string;
88
+ };
89
+ };
90
+ getVaultMints: ({ vaultProgramId, vaultAddress, connection, idl, }: {
91
+ vaultProgramId: PublicKey | string;
92
+ vaultAddress?: PublicKey | string;
93
+ idl: any;
94
+ } & import("./types").ISolanaConnectionOptions) => Promise<{
95
+ depositMint: string;
96
+ shareMint: string;
97
+ vaultVersion: number | undefined;
98
+ }>;
99
+ resolveProgramId: (vaultAddress: string, solanaMetadata?: {
100
+ program_id?: string;
101
+ } | null) => string;
102
+ };
103
+ constants: typeof SolanaConstants;
104
+ actions: typeof SolanaActions;
105
+ getters: typeof SolanaGetters;
106
+ };
107
+ /**
108
+ * Solana Adapter for August SDK
109
+ *
110
+ * @example
111
+ * To access the Solana adapter instance
112
+ * ```
113
+ * const sdk = new AugustSDK()
114
+ * sdk.solana.getVaultState()
115
+ * ```
116
+ */
117
+ declare class SolanaAdapter {
118
+ private _endpoint;
119
+ private _network;
120
+ private _connection;
121
+ private _provider;
122
+ constructor(endpoint: ISolanaRpcEndpoint, network?: ISolanaNetwork);
123
+ get endpoint(): `https://${string}`;
124
+ get network(): ISolanaNetwork;
125
+ get connection(): web3.Connection;
126
+ get provider(): AnchorProvider;
127
+ setWalletProvider(_publicKey: PublicKey | string, signTransaction: (<T extends Transaction | web3.VersionedTransaction>(transaction: T) => Promise<T>) | undefined): void;
128
+ /**
129
+ * Build an Anchor `Program` bound to this adapter's provider and network.
130
+ *
131
+ * The program id is resolved as: explicit `programId` → the `address` carried
132
+ * by a custom `programIdl` → the canonical deployment for this adapter's
133
+ * network. A copy of the SDK's bundled `vaultIdl` defers to the network
134
+ * default (its embedded `address` is a build stamp, not network-aware), so
135
+ * forwarding it on devnet never silently targets the mainnet program.
136
+ *
137
+ * @param programIdl - Anchor IDL to bind. Defaults to the SDK's bundled
138
+ * `august_vault` IDL. A custom IDL's `address` is honoured when it differs
139
+ * from the bundled build stamp.
140
+ * @param programId - Base58 program id that overrides both the IDL's address
141
+ * and the network default. Use this to target a non-canonical deployment.
142
+ * @returns An Anchor `Program` for the resolved program id. No RPC is made —
143
+ * construction is offline.
144
+ * @throws {@link AugustValidationError} if no program id can be resolved
145
+ * because this adapter's network has no canonical deployment (e.g.
146
+ * `testnet`) and neither `programId` nor a custom IDL address was supplied.
147
+ *
148
+ * @example
149
+ * ```ts
150
+ * // canonical program on the adapter's network
151
+ * const program = sdk.solana.getProgram();
152
+ *
153
+ * // a different deployment, same interface
154
+ * const legacy = sdk.solana.getProgram(vaultIdl, '7B8n9vL51b6ibqRAd1adZsi3x3kxtq5NZaondh22Vkyq');
155
+ * ```
156
+ */
157
+ getProgram(programIdl?: any, programId?: string): import("@coral-xyz/anchor").Program<any>;
158
+ getVaultState(vaultProgramId: PublicKey | string, idl: any, vaultAddress?: PublicKey | string): Promise<{
159
+ vaultState: unknown | null;
160
+ depositMintDecimals: number | null;
161
+ }>;
162
+ getVaultStateReadOnly(vaultProgramId: PublicKey | string, idl: any, vaultAddress?: PublicKey | string): Promise<{
163
+ vaultState: import("./types").ISolanaVaultState | null;
164
+ depositMintDecimals: number | null;
165
+ }>;
166
+ getToken(mintAddress: string | PublicKey): Promise<{
167
+ address: string;
168
+ symbol: string;
169
+ decimals: number;
170
+ name: string;
171
+ image: string;
172
+ }>;
173
+ getTokenSymbol(mintAddress: string | PublicKey): Promise<string>;
174
+ fetchUserTokenBalance(publicKey: PublicKey | string, depositMint: PublicKey | string): Promise<any>;
175
+ fetchUserShareBalance(publicKey: PublicKey | string, shareMint: PublicKey | string): Promise<any>;
176
+ /**
177
+ * BigInt-safe variant of {@link fetchUserShareBalance}. Returns the raw u64
178
+ * `amount` (as a base-units string) plus the mint's `decimals` (or `null`
179
+ * when the scale can't be determined — see Returns), so the caller can
180
+ * produce a correct `INormalizedNumber` without losing precision.
181
+ *
182
+ * Prefer this anywhere the result feeds BigInt math — positions, max-
183
+ * actions, redemption sizing, allowance checks. `fetchUserShareBalance`
184
+ * returns a JS-number `uiAmount` which silently encodes against 18 decimals
185
+ * when passed through `toNormalizedBn(value)` without an explicit decimals
186
+ * argument; that's exactly how the jitoSOL "missing position" regression
187
+ * manifested.
188
+ *
189
+ * RPC cost: 1 `getParsedTokenAccountsByOwner` call. Worst case ~150ms on a
190
+ * healthy mainnet endpoint.
191
+ *
192
+ * @param publicKey Wallet owner (PublicKey or base58 string).
193
+ * @param shareMint The vault's share-token mint (PublicKey or base58).
194
+ * @returns
195
+ * `{ amount, decimals }`. Three observable shapes:
196
+ * - `{ amount: '<u64>', decimals: <number> }` — token account exists.
197
+ * - `{ amount: '0', decimals: null }` — no token account for this mint
198
+ * under this wallet, OR `tokenAmount` was missing from the response,
199
+ * OR `publicKey`/`shareMint` was not supplied. Distinguishable from a
200
+ * genuine zero-balance account (`decimals` would be set there).
201
+ * - `{ amount: '0', decimals: null }` — RPC threw (error is logged).
202
+ *
203
+ * `decimals === null` means "we could not determine the scale" — callers
204
+ * that need an `INormalizedNumber` must fall back to a known decimals
205
+ * value (typically the deposit mint's decimals from backend metadata)
206
+ * before normalizing. Never throws.
207
+ */
208
+ fetchUserShareBalanceRaw(publicKey: PublicKey | string, shareMint: PublicKey | string): Promise<{
209
+ amount: string;
210
+ decimals: number | null;
211
+ }>;
212
+ /**
213
+ * Deposit funds into a Solana August vault.
214
+ * @param depositAmount `bigint` (raw on-chain units) or `number` (UI amount).
215
+ */
216
+ vaultDeposit(vaultProgramId: PublicKey | string, idl: any, publicKey: PublicKey | string, depositAmount: number | bigint, sendTransaction: (transaction: Transaction | web3.VersionedTransaction, connection: Connection, options?: SendTransactionOptions) => Promise<web3.TransactionSignature>, vaultAddress?: PublicKey | string): Promise<any>;
217
+ /**
218
+ * Redeem vault shares from a Solana August vault.
219
+ * @param redeemShares `bigint` (raw share units) or `number` (UI amount).
220
+ */
221
+ vaultRedeem(vaultProgramId: PublicKey | string, idl: any, publicKey: PublicKey | string, redeemShares: number | bigint, sendTransaction: (transaction: Transaction | web3.VersionedTransaction, connection: Connection, options?: SendTransactionOptions) => Promise<web3.TransactionSignature>, vaultAddress?: PublicKey | string): Promise<any>;
222
+ /**
223
+ * Canonical program id for a program type on this adapter's network.
224
+ *
225
+ * @param type - Program to look up. Only `'vault'` (august_vault) exists today.
226
+ * @returns The base58 program id.
227
+ * @throws {@link AugustValidationError} if the canonical program is not
228
+ * deployed on this adapter's network (e.g. `testnet`). Previously an
229
+ * unmapped network threw a bare `TypeError`.
230
+ */
231
+ getProgramId(type: 'vault'): string;
232
+ }
233
+ export default SolanaAdapter;
@@ -0,0 +1,291 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.Solana = void 0;
37
+ /**
38
+ * Solana Adapter for August SDK
39
+ *
40
+ * @module SolanaAdapter
41
+ */
42
+ const SolanaConstants = __importStar(require("./constants"));
43
+ const SolanaGetters = __importStar(require("./getters"));
44
+ const SolanaActions = __importStar(require("./vault.actions"));
45
+ const web3_js_1 = require("@solana/web3.js");
46
+ const utils_1 = require("./utils");
47
+ const vault_actions_1 = require("./vault.actions");
48
+ const constants_1 = require("./constants");
49
+ const core_1 = require("../../core");
50
+ exports.Solana = {
51
+ utils: utils_1.SolanaUtils,
52
+ constants: SolanaConstants,
53
+ actions: SolanaActions,
54
+ getters: SolanaGetters,
55
+ };
56
+ /**
57
+ * Solana Adapter for August SDK
58
+ *
59
+ * @example
60
+ * To access the Solana adapter instance
61
+ * ```
62
+ * const sdk = new AugustSDK()
63
+ * sdk.solana.getVaultState()
64
+ * ```
65
+ */
66
+ class SolanaAdapter {
67
+ _endpoint;
68
+ _network;
69
+ _connection;
70
+ _provider;
71
+ constructor(endpoint, network = utils_1.SolanaUtils.fallbackNetwork) {
72
+ this._endpoint = endpoint;
73
+ this._network = network;
74
+ const connection = new web3_js_1.Connection(endpoint);
75
+ this._connection = connection;
76
+ this._provider = utils_1.SolanaUtils.getReadOnlyProvider({
77
+ network: this._network,
78
+ connection,
79
+ });
80
+ }
81
+ // Getters and setters for private properties
82
+ get endpoint() {
83
+ return this._endpoint;
84
+ }
85
+ get network() {
86
+ return this._network;
87
+ }
88
+ get connection() {
89
+ return this._connection;
90
+ }
91
+ get provider() {
92
+ return this._provider;
93
+ }
94
+ // Method to set connection with wallet for authenticated operations
95
+ setWalletProvider(_publicKey, signTransaction) {
96
+ if (_publicKey && signTransaction) {
97
+ const publicKey = typeof _publicKey === 'string' ? new web3_js_1.PublicKey(_publicKey) : _publicKey;
98
+ this._provider = utils_1.SolanaUtils.getProvider({
99
+ network: this._network,
100
+ connection: this._connection,
101
+ publicKey,
102
+ signTransaction,
103
+ });
104
+ }
105
+ else {
106
+ this._provider = utils_1.SolanaUtils.getReadOnlyProvider({
107
+ network: this._network,
108
+ connection: this._connection,
109
+ });
110
+ }
111
+ }
112
+ /**
113
+ * Build an Anchor `Program` bound to this adapter's provider and network.
114
+ *
115
+ * The program id is resolved as: explicit `programId` → the `address` carried
116
+ * by a custom `programIdl` → the canonical deployment for this adapter's
117
+ * network. A copy of the SDK's bundled `vaultIdl` defers to the network
118
+ * default (its embedded `address` is a build stamp, not network-aware), so
119
+ * forwarding it on devnet never silently targets the mainnet program.
120
+ *
121
+ * @param programIdl - Anchor IDL to bind. Defaults to the SDK's bundled
122
+ * `august_vault` IDL. A custom IDL's `address` is honoured when it differs
123
+ * from the bundled build stamp.
124
+ * @param programId - Base58 program id that overrides both the IDL's address
125
+ * and the network default. Use this to target a non-canonical deployment.
126
+ * @returns An Anchor `Program` for the resolved program id. No RPC is made —
127
+ * construction is offline.
128
+ * @throws {@link AugustValidationError} if no program id can be resolved
129
+ * because this adapter's network has no canonical deployment (e.g.
130
+ * `testnet`) and neither `programId` nor a custom IDL address was supplied.
131
+ *
132
+ * @example
133
+ * ```ts
134
+ * // canonical program on the adapter's network
135
+ * const program = sdk.solana.getProgram();
136
+ *
137
+ * // a different deployment, same interface
138
+ * const legacy = sdk.solana.getProgram(vaultIdl, '7B8n9vL51b6ibqRAd1adZsi3x3kxtq5NZaondh22Vkyq');
139
+ * ```
140
+ */
141
+ getProgram(programIdl, programId) {
142
+ return utils_1.SolanaUtils.getProgram({
143
+ network: this._network,
144
+ provider: this._provider,
145
+ idl: programIdl,
146
+ programId,
147
+ });
148
+ }
149
+ async getVaultState(vaultProgramId, idl, vaultAddress) {
150
+ return await utils_1.SolanaUtils.getVaultState({
151
+ network: this._network,
152
+ provider: this._provider,
153
+ connection: this._connection,
154
+ vaultProgramId,
155
+ vaultAddress,
156
+ idl,
157
+ });
158
+ }
159
+ async getVaultStateReadOnly(vaultProgramId, idl, vaultAddress) {
160
+ return await utils_1.SolanaUtils.getVaultStateReadOnly({
161
+ network: this._network,
162
+ connection: this._connection,
163
+ vaultProgramId,
164
+ vaultAddress,
165
+ idl,
166
+ });
167
+ }
168
+ async getToken(mintAddress) {
169
+ return await utils_1.SolanaUtils.getToken({
170
+ network: this._network,
171
+ mintAddress,
172
+ endpoint: this._endpoint,
173
+ });
174
+ }
175
+ async getTokenSymbol(mintAddress) {
176
+ return await utils_1.SolanaUtils.getTokenSymbol({
177
+ network: this._network,
178
+ mintAddress,
179
+ endpoint: this._endpoint,
180
+ });
181
+ }
182
+ async fetchUserTokenBalance(publicKey, depositMint) {
183
+ return await utils_1.SolanaUtils.fetchUserTokenBalance({
184
+ network: this._network,
185
+ connection: this._connection,
186
+ publicKey,
187
+ depositMint,
188
+ });
189
+ }
190
+ async fetchUserShareBalance(publicKey, shareMint) {
191
+ return await utils_1.SolanaUtils.fetchUserShareBalance({
192
+ network: this._network,
193
+ connection: this._connection,
194
+ publicKey,
195
+ shareMint,
196
+ });
197
+ }
198
+ /**
199
+ * BigInt-safe variant of {@link fetchUserShareBalance}. Returns the raw u64
200
+ * `amount` (as a base-units string) plus the mint's `decimals` (or `null`
201
+ * when the scale can't be determined — see Returns), so the caller can
202
+ * produce a correct `INormalizedNumber` without losing precision.
203
+ *
204
+ * Prefer this anywhere the result feeds BigInt math — positions, max-
205
+ * actions, redemption sizing, allowance checks. `fetchUserShareBalance`
206
+ * returns a JS-number `uiAmount` which silently encodes against 18 decimals
207
+ * when passed through `toNormalizedBn(value)` without an explicit decimals
208
+ * argument; that's exactly how the jitoSOL "missing position" regression
209
+ * manifested.
210
+ *
211
+ * RPC cost: 1 `getParsedTokenAccountsByOwner` call. Worst case ~150ms on a
212
+ * healthy mainnet endpoint.
213
+ *
214
+ * @param publicKey Wallet owner (PublicKey or base58 string).
215
+ * @param shareMint The vault's share-token mint (PublicKey or base58).
216
+ * @returns
217
+ * `{ amount, decimals }`. Three observable shapes:
218
+ * - `{ amount: '<u64>', decimals: <number> }` — token account exists.
219
+ * - `{ amount: '0', decimals: null }` — no token account for this mint
220
+ * under this wallet, OR `tokenAmount` was missing from the response,
221
+ * OR `publicKey`/`shareMint` was not supplied. Distinguishable from a
222
+ * genuine zero-balance account (`decimals` would be set there).
223
+ * - `{ amount: '0', decimals: null }` — RPC threw (error is logged).
224
+ *
225
+ * `decimals === null` means "we could not determine the scale" — callers
226
+ * that need an `INormalizedNumber` must fall back to a known decimals
227
+ * value (typically the deposit mint's decimals from backend metadata)
228
+ * before normalizing. Never throws.
229
+ */
230
+ async fetchUserShareBalanceRaw(publicKey, shareMint) {
231
+ return await utils_1.SolanaUtils.fetchUserShareBalanceRaw({
232
+ network: this._network,
233
+ connection: this._connection,
234
+ publicKey,
235
+ shareMint,
236
+ });
237
+ }
238
+ /**
239
+ * Deposit funds into a Solana August vault.
240
+ * @param depositAmount `bigint` (raw on-chain units) or `number` (UI amount).
241
+ */
242
+ async vaultDeposit(vaultProgramId, idl, publicKey, depositAmount, sendTransaction, vaultAddress) {
243
+ return await (0, vault_actions_1.handleSolanaDeposit)({
244
+ network: this._network,
245
+ provider: this._provider,
246
+ connection: this._connection,
247
+ vaultProgramId,
248
+ vaultAddress,
249
+ idl,
250
+ publicKey,
251
+ depositAmount,
252
+ sendTransaction,
253
+ });
254
+ }
255
+ /**
256
+ * Redeem vault shares from a Solana August vault.
257
+ * @param redeemShares `bigint` (raw share units) or `number` (UI amount).
258
+ */
259
+ async vaultRedeem(vaultProgramId, idl, publicKey, redeemShares, sendTransaction, vaultAddress) {
260
+ return await (0, vault_actions_1.handleSolanaRedeem)({
261
+ network: this._network,
262
+ provider: this._provider,
263
+ connection: this._connection,
264
+ vaultProgramId,
265
+ vaultAddress,
266
+ idl,
267
+ publicKey,
268
+ redeemShares,
269
+ sendTransaction,
270
+ });
271
+ }
272
+ /**
273
+ * Canonical program id for a program type on this adapter's network.
274
+ *
275
+ * @param type - Program to look up. Only `'vault'` (august_vault) exists today.
276
+ * @returns The base58 program id.
277
+ * @throws {@link AugustValidationError} if the canonical program is not
278
+ * deployed on this adapter's network (e.g. `testnet`). Previously an
279
+ * unmapped network threw a bare `TypeError`.
280
+ */
281
+ getProgramId(type) {
282
+ const deployment = (0, constants_1.getDeployedProgramIds)(this._network);
283
+ if (!deployment) {
284
+ throw new core_1.AugustValidationError('INVALID_INPUT', `No canonical august_vault deployment for Solana network '${this._network}'. ` +
285
+ `Deployed networks: ${Object.keys(constants_1.programIds).join(', ')}.`);
286
+ }
287
+ return deployment[type];
288
+ }
289
+ }
290
+ exports.default = SolanaAdapter;
291
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,67 @@
1
+ import type { AnchorProvider } from '@coral-xyz/anchor';
2
+ import type { Connection, PublicKey } from '@solana/web3.js';
3
+ export type ISolanaRpcEndpoint = `https://${string}`;
4
+ export type ISolanaNetwork = 'devnet' | 'mainnet-beta' | 'testnet' | 'localnet';
5
+ export interface ISolanaConnectionOptions {
6
+ endpoint?: ISolanaRpcEndpoint;
7
+ connection?: Connection;
8
+ provider?: AnchorProvider;
9
+ network?: ISolanaNetwork;
10
+ }
11
+ export interface ISolanaVaultState {
12
+ operator: PublicKey | null;
13
+ admin: PublicKey | null;
14
+ shareMint: PublicKey | null;
15
+ depositMint: PublicKey | null;
16
+ feeRecipient: PublicKey | null;
17
+ withdrawalFee: number | null;
18
+ localAum: number | null;
19
+ deployedAum: number | null;
20
+ aumIncreaseLimit: number | null;
21
+ aumDecreaseLimit: number | null;
22
+ pdaBump: number[] | null;
23
+ vaultVersion: number[] | null;
24
+ paused: boolean | null;
25
+ }
26
+ export interface ISolanaToken {
27
+ address: string;
28
+ symbol: any;
29
+ decimals: number;
30
+ name: any;
31
+ image: any;
32
+ program: any;
33
+ mintAuthority: any;
34
+ freezeAuthority: any;
35
+ supply: string;
36
+ shareMintAddress: string;
37
+ }
38
+ export interface ISolanaVaultConfig {
39
+ programId: string;
40
+ vaultState: string;
41
+ shareMint: string;
42
+ vaultTokenAta: string;
43
+ depositMint: string;
44
+ network: ISolanaNetwork;
45
+ }
46
+ export interface ISolanaDepositResult {
47
+ success: boolean;
48
+ signature?: string;
49
+ sharesMinted?: number;
50
+ error?: string;
51
+ }
52
+ export interface ISolanaWithdrawResult {
53
+ success: boolean;
54
+ signature?: string;
55
+ tokensWithdrawn?: number;
56
+ error?: string;
57
+ }
58
+ export interface ISolanaVaultStats {
59
+ totalAssets: number;
60
+ totalShares: number;
61
+ isPaused: boolean;
62
+ withdrawalFee: number;
63
+ admin: string;
64
+ operator: string;
65
+ feeRecipient: string;
66
+ lastUpdated: Date;
67
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map