@oobe-protocol-labs/synapse-client-sdk 1.0.0-beta

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 (460) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1393 -0
  3. package/dist/cjs/advanced/circuit-breaker.d.ts +111 -0
  4. package/dist/cjs/advanced/circuit-breaker.d.ts.map +1 -0
  5. package/dist/cjs/advanced/circuit-breaker.js +278 -0
  6. package/dist/cjs/advanced/circuit-breaker.js.map +1 -0
  7. package/dist/cjs/advanced/index.d.ts +8 -0
  8. package/dist/cjs/advanced/index.d.ts.map +1 -0
  9. package/dist/cjs/advanced/index.js +13 -0
  10. package/dist/cjs/advanced/index.js.map +1 -0
  11. package/dist/cjs/advanced/load-balancer.d.ts +114 -0
  12. package/dist/cjs/advanced/load-balancer.d.ts.map +1 -0
  13. package/dist/cjs/advanced/load-balancer.js +354 -0
  14. package/dist/cjs/advanced/load-balancer.js.map +1 -0
  15. package/dist/cjs/advanced/smart-caching.d.ts +113 -0
  16. package/dist/cjs/advanced/smart-caching.d.ts.map +1 -0
  17. package/dist/cjs/advanced/smart-caching.js +461 -0
  18. package/dist/cjs/advanced/smart-caching.js.map +1 -0
  19. package/dist/cjs/advanced/types.d.ts +228 -0
  20. package/dist/cjs/advanced/types.d.ts.map +1 -0
  21. package/dist/cjs/advanced/types.js +7 -0
  22. package/dist/cjs/advanced/types.js.map +1 -0
  23. package/dist/cjs/ai/index.d.ts +15 -0
  24. package/dist/cjs/ai/index.d.ts.map +1 -0
  25. package/dist/cjs/ai/index.js +20 -0
  26. package/dist/cjs/ai/index.js.map +1 -0
  27. package/dist/cjs/ai/merkle-operation.d.ts +245 -0
  28. package/dist/cjs/ai/merkle-operation.d.ts.map +1 -0
  29. package/dist/cjs/ai/merkle-operation.js +522 -0
  30. package/dist/cjs/ai/merkle-operation.js.map +1 -0
  31. package/dist/cjs/ai/pda-manager.d.ts +134 -0
  32. package/dist/cjs/ai/pda-manager.d.ts.map +1 -0
  33. package/dist/cjs/ai/pda-manager.js +250 -0
  34. package/dist/cjs/ai/pda-manager.js.map +1 -0
  35. package/dist/cjs/ai/types.ai.d.ts +172 -0
  36. package/dist/cjs/ai/types.ai.d.ts.map +1 -0
  37. package/dist/cjs/ai/types.ai.js +14 -0
  38. package/dist/cjs/ai/types.ai.js.map +1 -0
  39. package/dist/cjs/ai/zero-combine-fetcher.d.ts +171 -0
  40. package/dist/cjs/ai/zero-combine-fetcher.d.ts.map +1 -0
  41. package/dist/cjs/ai/zero-combine-fetcher.js +412 -0
  42. package/dist/cjs/ai/zero-combine-fetcher.js.map +1 -0
  43. package/dist/cjs/client.d.ts +83 -0
  44. package/dist/cjs/client.d.ts.map +1 -0
  45. package/dist/cjs/client.js +287 -0
  46. package/dist/cjs/client.js.map +1 -0
  47. package/dist/cjs/defi/advanced-features.d.ts +207 -0
  48. package/dist/cjs/defi/advanced-features.d.ts.map +1 -0
  49. package/dist/cjs/defi/advanced-features.js +382 -0
  50. package/dist/cjs/defi/advanced-features.js.map +1 -0
  51. package/dist/cjs/defi/index.d.ts +29 -0
  52. package/dist/cjs/defi/index.d.ts.map +1 -0
  53. package/dist/cjs/defi/index.js +50 -0
  54. package/dist/cjs/defi/index.js.map +1 -0
  55. package/dist/cjs/defi/jito.d.ts +118 -0
  56. package/dist/cjs/defi/jito.d.ts.map +1 -0
  57. package/dist/cjs/defi/jito.js +291 -0
  58. package/dist/cjs/defi/jito.js.map +1 -0
  59. package/dist/cjs/defi/jupiter.d.ts +143 -0
  60. package/dist/cjs/defi/jupiter.d.ts.map +1 -0
  61. package/dist/cjs/defi/jupiter.js +219 -0
  62. package/dist/cjs/defi/jupiter.js.map +1 -0
  63. package/dist/cjs/defi/price-feed.d.ts +63 -0
  64. package/dist/cjs/defi/price-feed.d.ts.map +1 -0
  65. package/dist/cjs/defi/price-feed.js +153 -0
  66. package/dist/cjs/defi/price-feed.js.map +1 -0
  67. package/dist/cjs/defi/token-data.d.ts +83 -0
  68. package/dist/cjs/defi/token-data.d.ts.map +1 -0
  69. package/dist/cjs/defi/token-data.js +205 -0
  70. package/dist/cjs/defi/token-data.js.map +1 -0
  71. package/dist/cjs/defi/unstable-features.d.ts +207 -0
  72. package/dist/cjs/defi/unstable-features.d.ts.map +1 -0
  73. package/dist/cjs/defi/unstable-features.js +382 -0
  74. package/dist/cjs/defi/unstable-features.js.map +1 -0
  75. package/dist/cjs/defi/utils.d.ts +265 -0
  76. package/dist/cjs/defi/utils.d.ts.map +1 -0
  77. package/dist/cjs/defi/utils.js +619 -0
  78. package/dist/cjs/defi/utils.js.map +1 -0
  79. package/dist/cjs/index.d.ts +31 -0
  80. package/dist/cjs/index.d.ts.map +1 -0
  81. package/dist/cjs/index.js +71 -0
  82. package/dist/cjs/index.js.map +1 -0
  83. package/dist/cjs/methods/solana-rpc.d.ts +362 -0
  84. package/dist/cjs/methods/solana-rpc.d.ts.map +1 -0
  85. package/dist/cjs/methods/solana-rpc.js +584 -0
  86. package/dist/cjs/methods/solana-rpc.js.map +1 -0
  87. package/dist/cjs/nft/advanced-features.d.ts +205 -0
  88. package/dist/cjs/nft/advanced-features.d.ts.map +1 -0
  89. package/dist/cjs/nft/advanced-features.js +529 -0
  90. package/dist/cjs/nft/advanced-features.js.map +1 -0
  91. package/dist/cjs/nft/clients/index.d.ts +8 -0
  92. package/dist/cjs/nft/clients/index.d.ts.map +1 -0
  93. package/dist/cjs/nft/clients/index.js +14 -0
  94. package/dist/cjs/nft/clients/index.js.map +1 -0
  95. package/dist/cjs/nft/clients/magic-eden-client.d.ts +101 -0
  96. package/dist/cjs/nft/clients/magic-eden-client.d.ts.map +1 -0
  97. package/dist/cjs/nft/clients/magic-eden-client.js +263 -0
  98. package/dist/cjs/nft/clients/magic-eden-client.js.map +1 -0
  99. package/dist/cjs/nft/clients/metaplex-onchain-client.d.ts +154 -0
  100. package/dist/cjs/nft/clients/metaplex-onchain-client.d.ts.map +1 -0
  101. package/dist/cjs/nft/clients/metaplex-onchain-client.js +408 -0
  102. package/dist/cjs/nft/clients/metaplex-onchain-client.js.map +1 -0
  103. package/dist/cjs/nft/clients/tensor-client.d.ts +79 -0
  104. package/dist/cjs/nft/clients/tensor-client.d.ts.map +1 -0
  105. package/dist/cjs/nft/clients/tensor-client.js +222 -0
  106. package/dist/cjs/nft/clients/tensor-client.js.map +1 -0
  107. package/dist/cjs/nft/index.d.ts +13 -0
  108. package/dist/cjs/nft/index.d.ts.map +1 -0
  109. package/dist/cjs/nft/index.js +37 -0
  110. package/dist/cjs/nft/index.js.map +1 -0
  111. package/dist/cjs/nft/types.nft.d.ts +342 -0
  112. package/dist/cjs/nft/types.nft.d.ts.map +1 -0
  113. package/dist/cjs/nft/types.nft.js +3 -0
  114. package/dist/cjs/nft/types.nft.js.map +1 -0
  115. package/dist/cjs/nft/utils.d.ts +46 -0
  116. package/dist/cjs/nft/utils.d.ts.map +1 -0
  117. package/dist/cjs/nft/utils.js +281 -0
  118. package/dist/cjs/nft/utils.js.map +1 -0
  119. package/dist/cjs/types.d.ts +525 -0
  120. package/dist/cjs/types.d.ts.map +1 -0
  121. package/dist/cjs/types.js +192 -0
  122. package/dist/cjs/types.js.map +1 -0
  123. package/dist/cjs/utils/constant.d.ts +8 -0
  124. package/dist/cjs/utils/constant.d.ts.map +1 -0
  125. package/dist/cjs/utils/constant.js +12 -0
  126. package/dist/cjs/utils/constant.js.map +1 -0
  127. package/dist/cjs/utils/helpers.d.ts +92 -0
  128. package/dist/cjs/utils/helpers.d.ts.map +1 -0
  129. package/dist/cjs/utils/helpers.js +248 -0
  130. package/dist/cjs/utils/helpers.js.map +1 -0
  131. package/dist/cjs/websocket/client.d.ts +182 -0
  132. package/dist/cjs/websocket/client.d.ts.map +1 -0
  133. package/dist/cjs/websocket/client.js +465 -0
  134. package/dist/cjs/websocket/client.js.map +1 -0
  135. package/dist/cjs/websocket/index.d.ts +6 -0
  136. package/dist/cjs/websocket/index.d.ts.map +1 -0
  137. package/dist/cjs/websocket/index.js +9 -0
  138. package/dist/cjs/websocket/index.js.map +1 -0
  139. package/dist/docs/.nojekyll +1 -0
  140. package/dist/docs/assets/highlight.css +113 -0
  141. package/dist/docs/assets/icons.js +18 -0
  142. package/dist/docs/assets/icons.svg +1 -0
  143. package/dist/docs/assets/main.js +60 -0
  144. package/dist/docs/assets/navigation.js +1 -0
  145. package/dist/docs/assets/search.js +1 -0
  146. package/dist/docs/assets/style.css +1493 -0
  147. package/dist/docs/classes/AIError.html +40 -0
  148. package/dist/docs/classes/AIInvestmentAdvisor.html +26 -0
  149. package/dist/docs/classes/AIRarityCalculator.html +28 -0
  150. package/dist/docs/classes/ArbitrageDetector.html +30 -0
  151. package/dist/docs/classes/BatchingError.html +40 -0
  152. package/dist/docs/classes/CacheError.html +40 -0
  153. package/dist/docs/classes/CircuitBreaker.html +38 -0
  154. package/dist/docs/classes/CircuitBreakerError.html +40 -0
  155. package/dist/docs/classes/CollectionAnalytics.html +30 -0
  156. package/dist/docs/classes/DeFiError.html +40 -0
  157. package/dist/docs/classes/FlashLoanSimulator.html +26 -0
  158. package/dist/docs/classes/JitoIntegration.html +53 -0
  159. package/dist/docs/classes/JupiterIntegration.html +43 -0
  160. package/dist/docs/classes/Keypair.html +28 -0
  161. package/dist/docs/classes/LoadBalancer.html +34 -0
  162. package/dist/docs/classes/MEVProtection.html +28 -0
  163. package/dist/docs/classes/MarketplaceAggregator.html +28 -0
  164. package/dist/docs/classes/MerkleOperation.html +74 -0
  165. package/dist/docs/classes/NFTEngine.html +29 -0
  166. package/dist/docs/classes/NFTError.html +40 -0
  167. package/dist/docs/classes/NetworkError.html +40 -0
  168. package/dist/docs/classes/PDAManager.html +46 -0
  169. package/dist/docs/classes/PortfolioAnalytics.html +26 -0
  170. package/dist/docs/classes/PriceFeedIntegration.html +37 -0
  171. package/dist/docs/classes/PublicKey.html +46 -0
  172. package/dist/docs/classes/RateLimitError.html +39 -0
  173. package/dist/docs/classes/SmartCaching.html +42 -0
  174. package/dist/docs/classes/Synapse.html +6 -0
  175. package/dist/docs/classes/SynapseClient.html +55 -0
  176. package/dist/docs/classes/SynapseError.html +37 -0
  177. package/dist/docs/classes/SynapseSolanaEngine.html +49 -0
  178. package/dist/docs/classes/SynapseUtils.html +25 -0
  179. package/dist/docs/classes/TokenDataIntegration.html +41 -0
  180. package/dist/docs/classes/Transaction.html +87 -0
  181. package/dist/docs/classes/TransactionInstruction.html +10 -0
  182. package/dist/docs/classes/UpstreamError.html +39 -0
  183. package/dist/docs/classes/WebSocketClient.html +47 -0
  184. package/dist/docs/classes/WebSocketError.html +40 -0
  185. package/dist/docs/classes/YieldFarmingFinder.html +26 -0
  186. package/dist/docs/classes/ZeroCombineFetcher.html +25 -0
  187. package/dist/docs/functions/createSynapseClient.html +2 -0
  188. package/dist/docs/hierarchy.html +1 -0
  189. package/dist/docs/index.html +776 -0
  190. package/dist/docs/interfaces/AIAgentConfig.html +11 -0
  191. package/dist/docs/interfaces/AIAgentContext.html +7 -0
  192. package/dist/docs/interfaces/AIContext.html +6 -0
  193. package/dist/docs/interfaces/AIMethodResult.html +6 -0
  194. package/dist/docs/interfaces/AIRarityAnalysis.html +3 -0
  195. package/dist/docs/interfaces/AIResponse.html +5 -0
  196. package/dist/docs/interfaces/AccountInfo.html +8 -0
  197. package/dist/docs/interfaces/AdvancedClientConfig.html +7 -0
  198. package/dist/docs/interfaces/AdvancedEvents.html +9 -0
  199. package/dist/docs/interfaces/AdvancedMetricsData.html +5 -0
  200. package/dist/docs/interfaces/AdvancedPerformanceMetrics.html +6 -0
  201. package/dist/docs/interfaces/AgentAdapter.html +6 -0
  202. package/dist/docs/interfaces/AgentRiskReport.html +6 -0
  203. package/dist/docs/interfaces/AgentTradeSuggestion.html +10 -0
  204. package/dist/docs/interfaces/AggregatedCollectionStats.html +36 -0
  205. package/dist/docs/interfaces/ArbitrageOpportunity.html +8 -0
  206. package/dist/docs/interfaces/AutoTradingStrategy.html +13 -0
  207. package/dist/docs/interfaces/BatchResponse.html +4 -0
  208. package/dist/docs/interfaces/BatchResult.html +6 -0
  209. package/dist/docs/interfaces/BatcherConfig.html +5 -0
  210. package/dist/docs/interfaces/BirdeyeTokenPrice.html +4 -0
  211. package/dist/docs/interfaces/BlockhashInfo.html +5 -0
  212. package/dist/docs/interfaces/BuildSwapTxResult.html +7 -0
  213. package/dist/docs/interfaces/CacheStats.html +9 -0
  214. package/dist/docs/interfaces/ChunkInfo.html +10 -0
  215. package/dist/docs/interfaces/CircuitBreakerConfig.html +6 -0
  216. package/dist/docs/interfaces/ClientStats.html +14 -0
  217. package/dist/docs/interfaces/CollectionStats.html +17 -0
  218. package/dist/docs/interfaces/CollectionTrends.html +7 -0
  219. package/dist/docs/interfaces/CompressedNFTInfo.html +13 -0
  220. package/dist/docs/interfaces/ConfirmedTransaction.html +6 -0
  221. package/dist/docs/interfaces/ConnectionEvents.html +11 -0
  222. package/dist/docs/interfaces/DeFiConfig.html +16 -0
  223. package/dist/docs/interfaces/DiagnosticsResult.html +6 -0
  224. package/dist/docs/interfaces/EpochInfo.html +9 -0
  225. package/dist/docs/interfaces/ExecuteSwapParams.html +10 -0
  226. package/dist/docs/interfaces/FetchConfig.html +7 -0
  227. package/dist/docs/interfaces/FlashLoanAction.html +6 -0
  228. package/dist/docs/interfaces/FlashLoanSimulation.html +9 -0
  229. package/dist/docs/interfaces/GatewayStats.html +7 -0
  230. package/dist/docs/interfaces/InscriptionResult.html +18 -0
  231. package/dist/docs/interfaces/InvestmentRecommendation.html +10 -0
  232. package/dist/docs/interfaces/JitoBundleParams.html +4 -0
  233. package/dist/docs/interfaces/JitoBundleResult.html +6 -0
  234. package/dist/docs/interfaces/JitoBundleStatus.html +6 -0
  235. package/dist/docs/interfaces/JitoTipAccount.html +3 -0
  236. package/dist/docs/interfaces/JupiterQuoteParams.html +10 -0
  237. package/dist/docs/interfaces/JupiterQuoteRequest.html +17 -0
  238. package/dist/docs/interfaces/JupiterQuoteResponse.html +13 -0
  239. package/dist/docs/interfaces/JupiterSwapOptions.html +8 -0
  240. package/dist/docs/interfaces/JupiterSwapResponse.html +4 -0
  241. package/dist/docs/interfaces/JupiterTokenPrice.html +5 -0
  242. package/dist/docs/interfaces/LoadBalancerConfig.html +5 -0
  243. package/dist/docs/interfaces/MEVProtectionConfig.html +11 -0
  244. package/dist/docs/interfaces/MEVProtectionResult.html +6 -0
  245. package/dist/docs/interfaces/MagicEdenActivity.html +22 -0
  246. package/dist/docs/interfaces/MagicEdenCollection.html +22 -0
  247. package/dist/docs/interfaces/MagicEdenCollectionStats.html +17 -0
  248. package/dist/docs/interfaces/MagicEdenErrorResponse.html +4 -0
  249. package/dist/docs/interfaces/MagicEdenListing.html +24 -0
  250. package/dist/docs/interfaces/MarketplaceClientConfig.html +14 -0
  251. package/dist/docs/interfaces/MarketplaceFloorPrices.html +7 -0
  252. package/dist/docs/interfaces/MarketplaceListing.html +9 -0
  253. package/dist/docs/interfaces/MerkleLeaf.html +6 -0
  254. package/dist/docs/interfaces/MerkleProof.html +8 -0
  255. package/dist/docs/interfaces/MerkleValidationResult.html +10 -0
  256. package/dist/docs/interfaces/MultiChainSignal.html +8 -0
  257. package/dist/docs/interfaces/NFTAttribute.html +4 -0
  258. package/dist/docs/interfaces/NFTConfig.html +6 -0
  259. package/dist/docs/interfaces/NFTInfo.html +10 -0
  260. package/dist/docs/interfaces/NFTMetadata.html +9 -0
  261. package/dist/docs/interfaces/NormalizedMarketplaceListing.html +18 -0
  262. package/dist/docs/interfaces/OOBECompatibleAgent.html +8 -0
  263. package/dist/docs/interfaces/PDAConfig.html +10 -0
  264. package/dist/docs/interfaces/ParsedAccountInfo.html +8 -0
  265. package/dist/docs/interfaces/PerformanceMetrics.html +9 -0
  266. package/dist/docs/interfaces/PortfolioMetrics.html +10 -0
  267. package/dist/docs/interfaces/PriceData.html +8 -0
  268. package/dist/docs/interfaces/ProofRecord.html +12 -0
  269. package/dist/docs/interfaces/QuoteRequestCommon.html +11 -0
  270. package/dist/docs/interfaces/QuoteResponse.html +6 -0
  271. package/dist/docs/interfaces/RarityAlgorithmConfig.html +3 -0
  272. package/dist/docs/interfaces/RarityScore.html +8 -0
  273. package/dist/docs/interfaces/RaydiumBuildSwapParams.html +14 -0
  274. package/dist/docs/interfaces/RaydiumQuoteRequest.html +14 -0
  275. package/dist/docs/interfaces/RequestOptions.html +12 -0
  276. package/dist/docs/interfaces/RetryAttempt.html +5 -0
  277. package/dist/docs/interfaces/RpcError.html +5 -0
  278. package/dist/docs/interfaces/RpcRequest.html +6 -0
  279. package/dist/docs/interfaces/RpcResponse.html +6 -0
  280. package/dist/docs/interfaces/SecurityThreat.html +6 -0
  281. package/dist/docs/interfaces/SignatureInfo.html +8 -0
  282. package/dist/docs/interfaces/Signer.html +4 -0
  283. package/dist/docs/interfaces/SmartCacheConfig.html +7 -0
  284. package/dist/docs/interfaces/SmartQueryOptions.html +10 -0
  285. package/dist/docs/interfaces/StressTestOptions.html +8 -0
  286. package/dist/docs/interfaces/StressTestResult.html +9 -0
  287. package/dist/docs/interfaces/SubscriptionConfig.html +9 -0
  288. package/dist/docs/interfaces/SubscriptionOptions.html +7 -0
  289. package/dist/docs/interfaces/SubscriptionResult.html +7 -0
  290. package/dist/docs/interfaces/SynapseConfig.html +13 -0
  291. package/dist/docs/interfaces/SynapseLikeClient.html +4 -0
  292. package/dist/docs/interfaces/TensorCollectionStats.html +33 -0
  293. package/dist/docs/interfaces/TensorErrorResponse.html +5 -0
  294. package/dist/docs/interfaces/TensorListing.html +16 -0
  295. package/dist/docs/interfaces/TensorSale.html +16 -0
  296. package/dist/docs/interfaces/TokenAccount.html +7 -0
  297. package/dist/docs/interfaces/TokenAccountInfo.html +12 -0
  298. package/dist/docs/interfaces/TokenHolding.html +8 -0
  299. package/dist/docs/interfaces/TokenInfo.html +7 -0
  300. package/dist/docs/interfaces/TokenLargestAccount.html +5 -0
  301. package/dist/docs/interfaces/TokenSupply.html +5 -0
  302. package/dist/docs/interfaces/TradeExecution.html +14 -0
  303. package/dist/docs/interfaces/TransactionSignature.html +8 -0
  304. package/dist/docs/interfaces/UpstreamHealth.html +8 -0
  305. package/dist/docs/interfaces/UserPDAs.html +10 -0
  306. package/dist/docs/interfaces/WebSocketConfig.html +12 -0
  307. package/dist/docs/interfaces/WebSocketMessage.html +6 -0
  308. package/dist/docs/interfaces/YieldOpportunity.html +8 -0
  309. package/dist/docs/interfaces/ZeroChunk.html +8 -0
  310. package/dist/docs/interfaces/ZeroCombineResult.html +3 -0
  311. package/dist/docs/media/LICENSE +21 -0
  312. package/dist/docs/media/README-1.md +778 -0
  313. package/dist/docs/media/README-2.md +1050 -0
  314. package/dist/docs/media/README-3.md +1522 -0
  315. package/dist/docs/media/README-4.md +869 -0
  316. package/dist/docs/media/README-5.md +857 -0
  317. package/dist/docs/media/README-6.md +727 -0
  318. package/dist/docs/media/README.md +766 -0
  319. package/dist/docs/modules.html +168 -0
  320. package/dist/docs/types/BlockhashWithExpiryBlockHeight.html +1 -0
  321. package/dist/docs/types/Commitment.html +3 -0
  322. package/dist/docs/types/RiskTolerance.html +1 -0
  323. package/dist/docs/types/SimulatedTransactionResponse.html +1 -0
  324. package/dist/esm/advanced/circuit-breaker.d.ts +111 -0
  325. package/dist/esm/advanced/circuit-breaker.d.ts.map +1 -0
  326. package/dist/esm/advanced/circuit-breaker.js +274 -0
  327. package/dist/esm/advanced/circuit-breaker.js.map +1 -0
  328. package/dist/esm/advanced/index.d.ts +8 -0
  329. package/dist/esm/advanced/index.d.ts.map +1 -0
  330. package/dist/esm/advanced/index.js +7 -0
  331. package/dist/esm/advanced/index.js.map +1 -0
  332. package/dist/esm/advanced/load-balancer.d.ts +114 -0
  333. package/dist/esm/advanced/load-balancer.d.ts.map +1 -0
  334. package/dist/esm/advanced/load-balancer.js +350 -0
  335. package/dist/esm/advanced/load-balancer.js.map +1 -0
  336. package/dist/esm/advanced/smart-caching.d.ts +113 -0
  337. package/dist/esm/advanced/smart-caching.d.ts.map +1 -0
  338. package/dist/esm/advanced/smart-caching.js +457 -0
  339. package/dist/esm/advanced/smart-caching.js.map +1 -0
  340. package/dist/esm/advanced/types.d.ts +228 -0
  341. package/dist/esm/advanced/types.d.ts.map +1 -0
  342. package/dist/esm/advanced/types.js +6 -0
  343. package/dist/esm/advanced/types.js.map +1 -0
  344. package/dist/esm/ai/index.d.ts +15 -0
  345. package/dist/esm/ai/index.d.ts.map +1 -0
  346. package/dist/esm/ai/index.js +14 -0
  347. package/dist/esm/ai/index.js.map +1 -0
  348. package/dist/esm/ai/merkle-operation.d.ts +245 -0
  349. package/dist/esm/ai/merkle-operation.d.ts.map +1 -0
  350. package/dist/esm/ai/merkle-operation.js +485 -0
  351. package/dist/esm/ai/merkle-operation.js.map +1 -0
  352. package/dist/esm/ai/pda-manager.d.ts +134 -0
  353. package/dist/esm/ai/pda-manager.d.ts.map +1 -0
  354. package/dist/esm/ai/pda-manager.js +213 -0
  355. package/dist/esm/ai/pda-manager.js.map +1 -0
  356. package/dist/esm/ai/types.ai.d.ts +172 -0
  357. package/dist/esm/ai/types.ai.d.ts.map +1 -0
  358. package/dist/esm/ai/types.ai.js +13 -0
  359. package/dist/esm/ai/types.ai.js.map +1 -0
  360. package/dist/esm/ai/zero-combine-fetcher.d.ts +171 -0
  361. package/dist/esm/ai/zero-combine-fetcher.d.ts.map +1 -0
  362. package/dist/esm/ai/zero-combine-fetcher.js +408 -0
  363. package/dist/esm/ai/zero-combine-fetcher.js.map +1 -0
  364. package/dist/esm/client.d.ts +83 -0
  365. package/dist/esm/client.d.ts.map +1 -0
  366. package/dist/esm/client.js +283 -0
  367. package/dist/esm/client.js.map +1 -0
  368. package/dist/esm/defi/advanced-features.d.ts +207 -0
  369. package/dist/esm/defi/advanced-features.d.ts.map +1 -0
  370. package/dist/esm/defi/advanced-features.js +374 -0
  371. package/dist/esm/defi/advanced-features.js.map +1 -0
  372. package/dist/esm/defi/index.d.ts +29 -0
  373. package/dist/esm/defi/index.d.ts.map +1 -0
  374. package/dist/esm/defi/index.js +37 -0
  375. package/dist/esm/defi/index.js.map +1 -0
  376. package/dist/esm/defi/jito.d.ts +118 -0
  377. package/dist/esm/defi/jito.d.ts.map +1 -0
  378. package/dist/esm/defi/jito.js +287 -0
  379. package/dist/esm/defi/jito.js.map +1 -0
  380. package/dist/esm/defi/jupiter.d.ts +143 -0
  381. package/dist/esm/defi/jupiter.d.ts.map +1 -0
  382. package/dist/esm/defi/jupiter.js +215 -0
  383. package/dist/esm/defi/jupiter.js.map +1 -0
  384. package/dist/esm/defi/price-feed.d.ts +63 -0
  385. package/dist/esm/defi/price-feed.d.ts.map +1 -0
  386. package/dist/esm/defi/price-feed.js +149 -0
  387. package/dist/esm/defi/price-feed.js.map +1 -0
  388. package/dist/esm/defi/token-data.d.ts +83 -0
  389. package/dist/esm/defi/token-data.d.ts.map +1 -0
  390. package/dist/esm/defi/token-data.js +201 -0
  391. package/dist/esm/defi/token-data.js.map +1 -0
  392. package/dist/esm/defi/unstable-features.d.ts +207 -0
  393. package/dist/esm/defi/unstable-features.d.ts.map +1 -0
  394. package/dist/esm/defi/unstable-features.js +374 -0
  395. package/dist/esm/defi/unstable-features.js.map +1 -0
  396. package/dist/esm/defi/utils.d.ts +265 -0
  397. package/dist/esm/defi/utils.d.ts.map +1 -0
  398. package/dist/esm/defi/utils.js +582 -0
  399. package/dist/esm/defi/utils.js.map +1 -0
  400. package/dist/esm/index.d.ts +31 -0
  401. package/dist/esm/index.d.ts.map +1 -0
  402. package/dist/esm/index.js +47 -0
  403. package/dist/esm/index.js.map +1 -0
  404. package/dist/esm/methods/solana-rpc.d.ts +362 -0
  405. package/dist/esm/methods/solana-rpc.d.ts.map +1 -0
  406. package/dist/esm/methods/solana-rpc.js +532 -0
  407. package/dist/esm/methods/solana-rpc.js.map +1 -0
  408. package/dist/esm/nft/advanced-features.d.ts +205 -0
  409. package/dist/esm/nft/advanced-features.d.ts.map +1 -0
  410. package/dist/esm/nft/advanced-features.js +489 -0
  411. package/dist/esm/nft/advanced-features.js.map +1 -0
  412. package/dist/esm/nft/clients/index.d.ts +8 -0
  413. package/dist/esm/nft/clients/index.d.ts.map +1 -0
  414. package/dist/esm/nft/clients/index.js +8 -0
  415. package/dist/esm/nft/clients/index.js.map +1 -0
  416. package/dist/esm/nft/clients/magic-eden-client.d.ts +101 -0
  417. package/dist/esm/nft/clients/magic-eden-client.d.ts.map +1 -0
  418. package/dist/esm/nft/clients/magic-eden-client.js +259 -0
  419. package/dist/esm/nft/clients/magic-eden-client.js.map +1 -0
  420. package/dist/esm/nft/clients/metaplex-onchain-client.d.ts +154 -0
  421. package/dist/esm/nft/clients/metaplex-onchain-client.d.ts.map +1 -0
  422. package/dist/esm/nft/clients/metaplex-onchain-client.js +404 -0
  423. package/dist/esm/nft/clients/metaplex-onchain-client.js.map +1 -0
  424. package/dist/esm/nft/clients/tensor-client.d.ts +79 -0
  425. package/dist/esm/nft/clients/tensor-client.d.ts.map +1 -0
  426. package/dist/esm/nft/clients/tensor-client.js +218 -0
  427. package/dist/esm/nft/clients/tensor-client.js.map +1 -0
  428. package/dist/esm/nft/index.d.ts +13 -0
  429. package/dist/esm/nft/index.d.ts.map +1 -0
  430. package/dist/esm/nft/index.js +15 -0
  431. package/dist/esm/nft/index.js.map +1 -0
  432. package/dist/esm/nft/types.nft.d.ts +342 -0
  433. package/dist/esm/nft/types.nft.d.ts.map +1 -0
  434. package/dist/esm/nft/types.nft.js +2 -0
  435. package/dist/esm/nft/types.nft.js.map +1 -0
  436. package/dist/esm/nft/utils.d.ts +46 -0
  437. package/dist/esm/nft/utils.d.ts.map +1 -0
  438. package/dist/esm/nft/utils.js +276 -0
  439. package/dist/esm/nft/utils.js.map +1 -0
  440. package/dist/esm/types.d.ts +525 -0
  441. package/dist/esm/types.d.ts.map +1 -0
  442. package/dist/esm/types.js +178 -0
  443. package/dist/esm/types.js.map +1 -0
  444. package/dist/esm/utils/constant.d.ts +8 -0
  445. package/dist/esm/utils/constant.d.ts.map +1 -0
  446. package/dist/esm/utils/constant.js +8 -0
  447. package/dist/esm/utils/constant.js.map +1 -0
  448. package/dist/esm/utils/helpers.d.ts +92 -0
  449. package/dist/esm/utils/helpers.d.ts.map +1 -0
  450. package/dist/esm/utils/helpers.js +243 -0
  451. package/dist/esm/utils/helpers.js.map +1 -0
  452. package/dist/esm/websocket/client.d.ts +182 -0
  453. package/dist/esm/websocket/client.d.ts.map +1 -0
  454. package/dist/esm/websocket/client.js +458 -0
  455. package/dist/esm/websocket/client.js.map +1 -0
  456. package/dist/esm/websocket/index.d.ts +6 -0
  457. package/dist/esm/websocket/index.d.ts.map +1 -0
  458. package/dist/esm/websocket/index.js +5 -0
  459. package/dist/esm/websocket/index.js.map +1 -0
  460. package/package.json +160 -0
@@ -0,0 +1,857 @@
1
+ # Solana RPC Methods Module
2
+
3
+ Type-safe wrapper for 70+ Solana RPC methods with performance optimization and intelligent batching for Synapse Client SDK.
4
+
5
+ ## Table of Contents
6
+
7
+ - [Architecture](#architecture)
8
+ - [Features](#features)
9
+ - [Method Categories](#method-categories)
10
+ - [Implementation](#implementation)
11
+ - [Performance Characteristics](#performance-characteristics)
12
+ - [Advanced Usage](#advanced-usage)
13
+ - [Best Practices](#best-practices)
14
+ - [API Reference](#api-reference)
15
+
16
+ ---
17
+
18
+ ## Architecture
19
+
20
+ ```
21
+ ┌──────────────────────────────────────────────────────────────────┐
22
+ │ Solana RPC Methods Wrapper │
23
+ ├──────────────────────────────────────────────────────────────────┤
24
+ │ │
25
+ │ ┌────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │
26
+ │ │ Account │ │ Block │ │ Transaction │ │
27
+ │ │ Methods │ │ Methods │ │ Methods │ │
28
+ │ │ (10 APIs) │ │ (8 APIs) │ │ (5 APIs) │ │
29
+ │ └────────────────┘ └─────────────────┘ └─────────────────┘ │
30
+ │ │
31
+ │ ┌────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │
32
+ │ │ Token │ │ Slot/Epoch │ │ Network │ │
33
+ │ │ Methods │ │ Methods │ │ Methods │ │
34
+ │ │ (8 APIs) │ │ (7 APIs) │ │ (6 APIs) │ │
35
+ │ └────────────────┘ └─────────────────┘ └─────────────────┘ │
36
+ │ │
37
+ │ ┌────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │
38
+ │ │ Utility │ │ Subscription │ │ Validator │ │
39
+ │ │ Methods │ │ Methods │ │ Methods │ │
40
+ │ │ (12 APIs) │ │ (6 APIs) │ │ (8 APIs) │ │
41
+ │ └────────────────┘ └─────────────────┘ └─────────────────┘ │
42
+ │ │
43
+ ├──────────────────────────────────────────────────────────────────┤
44
+ │ SynapseClient Core │
45
+ └──────────────────────────────────────────────────────────────────┘
46
+ ```
47
+
48
+ ---
49
+
50
+ ## Features
51
+
52
+ ### Core Capabilities
53
+
54
+ | Feature | Description | Status |
55
+ |---------|-------------|--------|
56
+ | **Type Safety** | Full TypeScript definitions for all methods | Production |
57
+ | **Auto-Pagination** | Automatic pagination for large result sets | Production |
58
+ | **Error Handling** | Comprehensive error handling with retries | Production |
59
+ | **Performance Hints** | Method weight annotations (Light/Heavy/Very Heavy) | Production |
60
+ | **Batch Support** | Efficient batching of multiple calls | Production |
61
+ | **Commitment Levels** | Support for processed/confirmed/finalized | Production |
62
+ | **Encoding Options** | Multiple encoding formats (base58/base64/jsonParsed) | Production |
63
+ | **Backward Compatibility** | Legacy method support with deprecation warnings | Production |
64
+
65
+ ---
66
+
67
+ ## Method Categories
68
+
69
+ ### 1. Account Methods
70
+
71
+ Query account information and balances.
72
+
73
+ | Method | Weight | Commitment | Description |
74
+ |--------|--------|-----------|-------------|
75
+ | `getAccountInfo` | Heavy | Yes | Get account data and metadata |
76
+ | `getBalance` | Light | Yes | Get SOL balance for address |
77
+ | `getMultipleAccounts` | Very Heavy | Yes | Bulk account data retrieval |
78
+ | `getProgramAccounts` | Extremely Heavy | Yes | Query all accounts owned by program |
79
+
80
+ ### 2. Block Methods
81
+
82
+ Retrieve block information and production data.
83
+
84
+ | Method | Weight | Commitment | Description |
85
+ |--------|--------|-----------|-------------|
86
+ | `getBlock` | Heavy | No | Get complete block with transactions |
87
+ | `getBlockHeight` | Light | Yes | Get current block height |
88
+ | `getBlockTime` | Light | No | Get estimated production time |
89
+ | `getBlocks` | Very Heavy | Yes | Get list of blocks in range |
90
+ | `getBlocksWithLimit` | Heavy | Yes | Get blocks with result limit |
91
+ | `getBlockCommitment` | Light | No | Get commitment for specific block |
92
+ | `getBlockProduction` | Medium | Yes | Get validator block production stats |
93
+
94
+ ### 3. Transaction Methods
95
+
96
+ Transaction retrieval and status checking.
97
+
98
+ | Method | Weight | Commitment | Description |
99
+ |--------|--------|-----------|-------------|
100
+ | `getTransaction` | Heavy | No | Get transaction details |
101
+ | `getSignaturesForAddress` | Extremely Heavy | Yes | Get all transaction signatures for address |
102
+ | `getSignatureStatuses` | Light | No | Get confirmation status for signatures |
103
+ | `sendTransaction` | Medium | No | Submit transaction to cluster |
104
+ | `simulateTransaction` | Medium | Yes | Simulate transaction without sending |
105
+
106
+ ### 4. Token Methods
107
+
108
+ Token account queries.
109
+
110
+ | Method | Weight | Commitment | Description |
111
+ |--------|--------|-----------|-------------|
112
+ | `getTokenAccountsByOwner` | Very Heavy | Yes | Get all token accounts for owner |
113
+ | `getTokenAccountsByDelegate` | Very Heavy | Yes | Get token accounts by delegate |
114
+ | `getTokenSupply` | Light | Yes | Get total token supply |
115
+ | `getTokenAccountBalance` | Light | Yes | Get token account balance |
116
+ | `getTokenLargestAccounts` | Medium | Yes | Get largest token holders |
117
+
118
+ ### 5. Slot & Epoch Methods
119
+
120
+ Slot and epoch information.
121
+
122
+ | Method | Weight | Commitment | Description |
123
+ |--------|--------|-----------|-------------|
124
+ | `getSlot` | Light | Yes | Get current slot |
125
+ | `getEpochInfo` | Light | Yes | Get epoch information |
126
+ | `getEpochSchedule` | Light | No | Get epoch schedule configuration |
127
+ | `getSlotLeader` | Light | Yes | Get current slot leader |
128
+ | `getSlotLeaders` | Heavy | No | Get slot leaders for range |
129
+ | `getLeaderSchedule` | Heavy | No | Get leader schedule for epoch |
130
+
131
+ ### 6. Network Methods
132
+
133
+ Network status and node information.
134
+
135
+ | Method | Weight | Commitment | Description |
136
+ |--------|--------|-----------|-------------|
137
+ | `getClusterNodes` | Light | No | Get all cluster nodes |
138
+ | `getHealth` | Light | No | Get node health status |
139
+ | `getVersion` | Light | No | Get node software version |
140
+ | `getIdentity` | Light | No | Get node identity public key |
141
+ | `getInflationGovernor` | Light | No | Get inflation parameters |
142
+ | `getInflationRate` | Light | No | Get current inflation rate |
143
+
144
+ ### 7. Utility Methods
145
+
146
+ Utility functions for transactions and blockhashes.
147
+
148
+ | Method | Weight | Commitment | Description |
149
+ |--------|--------|-----------|-------------|
150
+ | `getLatestBlockhash` | Light | Yes | Get latest blockhash for transactions |
151
+ | `isBlockhashValid` | Light | Yes | Check if blockhash is still valid |
152
+ | `getFeeForMessage` | Light | Yes | Calculate transaction fee |
153
+ | `getMinimumBalanceForRentExemption` | Light | No | Get rent-exempt minimum balance |
154
+ | `getFirstAvailableBlock` | Light | No | Get oldest available block |
155
+ | `getGenesisHash` | Light | No | Get genesis block hash |
156
+ | `getHighestSnapshotSlot` | Light | No | Get highest snapshot slot |
157
+ | `getRecentPerformanceSamples` | Light | No | Get recent performance metrics |
158
+ | `getRecentPrioritizationFees` | Light | No | Get recent priority fees |
159
+
160
+ ### 8. Validator Methods
161
+
162
+ Validator and voting information.
163
+
164
+ | Method | Weight | Commitment | Description |
165
+ |--------|--------|-----------|-------------|
166
+ | `getVoteAccounts` | Medium | Yes | Get all vote accounts |
167
+ | `getStakeActivation` | Light | Yes | Get stake account activation info |
168
+ | `getStakeMinimumDelegation` | Light | No | Get minimum stake delegation |
169
+ | `getInflationReward` | Medium | No | Get inflation rewards for addresses |
170
+
171
+ ---
172
+
173
+ ## Implementation
174
+
175
+ ### Basic Usage
176
+
177
+ ```typescript
178
+ import { SynapseClient } from '@synapse/client-sdk';
179
+ import { SolanaRpcMethods } from '@synapse/client-sdk/methods';
180
+
181
+ // Initialize client
182
+ const client = new SynapseClient({
183
+ endpoint: process.env.SYNAPSE_ENDPOINT!,
184
+ apiKey: process.env.SYNAPSE_API_KEY,
185
+ });
186
+
187
+ // Create methods wrapper
188
+ const rpc = new SolanaRpcMethods(client);
189
+
190
+ // Get account balance
191
+ const balance = await rpc.getBalance('YourPublicKeyHere');
192
+ console.log('Balance:', balance / 1e9, 'SOL');
193
+
194
+ // Get account info with commitment
195
+ const accountInfo = await rpc.getAccountInfo(
196
+ 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', // USDC mint
197
+ {
198
+ commitment: 'confirmed',
199
+ encoding: 'jsonParsed',
200
+ }
201
+ );
202
+ console.log('Account owner:', accountInfo?.owner);
203
+ ```
204
+
205
+ ### Advanced Usage
206
+
207
+ ```typescript
208
+ // Get multiple accounts efficiently
209
+ const accounts = await rpc.getMultipleAccounts(
210
+ [
211
+ 'address1',
212
+ 'address2',
213
+ 'address3',
214
+ ],
215
+ {
216
+ commitment: 'confirmed',
217
+ encoding: 'base64',
218
+ }
219
+ );
220
+
221
+ // Get block with full transaction details
222
+ const blockHeight = await rpc.getBlockHeight();
223
+ const block = await rpc.getBlock(blockHeight, {
224
+ encoding: 'jsonParsed',
225
+ transactionDetails: 'full',
226
+ rewards: true,
227
+ maxSupportedTransactionVersion: 0,
228
+ });
229
+
230
+ console.log('Block transactions:', block.transactions.length);
231
+ console.log('Block rewards:', block.rewards);
232
+
233
+ // Get transaction history for address (auto-paginated)
234
+ const signatures = await rpc.getSignaturesForAddress(
235
+ 'YourAddressHere',
236
+ {
237
+ limit: 100,
238
+ commitment: 'confirmed',
239
+ }
240
+ );
241
+
242
+ console.log('Total signatures:', signatures.length);
243
+
244
+ // Check transaction status
245
+ const statuses = await rpc.getSignatureStatuses(
246
+ [signatures[0].signature],
247
+ { searchTransactionHistory: true }
248
+ );
249
+
250
+ console.log('Transaction status:', statuses[0]);
251
+ ```
252
+
253
+ ---
254
+
255
+ ## Performance Characteristics
256
+
257
+ ### Method Performance Table
258
+
259
+ | Category | P50 Latency | P95 Latency | Cache Hit Rate | Notes |
260
+ |----------|-------------|-------------|----------------|-------|
261
+ | **Light Methods** | 8ms | 20ms | 60% | Balance, slot, epoch |
262
+ | **Medium Methods** | 50ms | 150ms | 40% | Token supply, vote accounts |
263
+ | **Heavy Methods** | 200ms | 500ms | 20% | Block data, transactions |
264
+ | **Very Heavy** | 500ms | 1500ms | 10% | Multiple accounts, token accounts |
265
+ | **Extremely Heavy** | 1000ms+ | 5000ms+ | 5% | Program accounts, signatures |
266
+
267
+ ### Optimization Strategies
268
+
269
+ #### 1. Use Commitment Levels Wisely
270
+
271
+ ```typescript
272
+ // ✅ Fast: Use 'processed' for non-critical reads
273
+ const balance = await rpc.getBalance('address', 'processed');
274
+
275
+ // ⚖️ Balanced: Use 'confirmed' for most operations
276
+ const balance = await rpc.getBalance('address', 'confirmed');
277
+
278
+ // 🐌 Slow: Use 'finalized' only when necessary
279
+ const balance = await rpc.getBalance('address', 'finalized');
280
+ ```
281
+
282
+ #### 2. Batch Multiple Calls
283
+
284
+ ```typescript
285
+ // ✅ Efficient: Batch related calls
286
+ const [balance, accountInfo, slot] = await Promise.all([
287
+ rpc.getBalance('address'),
288
+ rpc.getAccountInfo('address'),
289
+ rpc.getSlot(),
290
+ ]);
291
+
292
+ // Or use client batch method
293
+ const results = await client.batch([
294
+ { method: 'getBalance', params: ['address'] },
295
+ { method: 'getAccountInfo', params: ['address'] },
296
+ { method: 'getSlot', params: [] },
297
+ ]);
298
+
299
+ // ❌ Inefficient: Sequential calls
300
+ const balance = await rpc.getBalance('address');
301
+ const accountInfo = await rpc.getAccountInfo('address');
302
+ const slot = await rpc.getSlot();
303
+ ```
304
+
305
+ #### 3. Use Filters for Heavy Methods
306
+
307
+ ```typescript
308
+ // ✅ Efficient: Use filters to reduce data
309
+ const accounts = await rpc.getProgramAccounts(
310
+ 'programId',
311
+ {
312
+ encoding: 'base64',
313
+ dataSlice: { offset: 0, length: 32 }, // Only get first 32 bytes
314
+ filters: [
315
+ { dataSize: 165 }, // Only accounts with specific size
316
+ { memcmp: { offset: 0, bytes: 'base58string' } }, // Filter by data
317
+ ],
318
+ }
319
+ );
320
+
321
+ // ❌ Inefficient: No filters (retrieves all data)
322
+ const accounts = await rpc.getProgramAccounts('programId');
323
+ ```
324
+
325
+ #### 4. Leverage Caching
326
+
327
+ ```typescript
328
+ // ✅ Recommended: Cache static or slow-changing data
329
+ const cache = new Map<string, any>();
330
+
331
+ async function getAccountInfoCached(address: string) {
332
+ if (cache.has(address)) {
333
+ return cache.get(address);
334
+ }
335
+
336
+ const info = await rpc.getAccountInfo(address);
337
+ cache.set(address, info);
338
+
339
+ // Invalidate after 1 minute
340
+ setTimeout(() => cache.delete(address), 60000);
341
+
342
+ return info;
343
+ }
344
+
345
+ // ❌ Not recommended: Fetch every time
346
+ const info = await rpc.getAccountInfo(address);
347
+ ```
348
+
349
+ ---
350
+
351
+ ## Best Practices
352
+
353
+ ### 1. Error Handling
354
+
355
+ ```typescript
356
+ import { SynapseError, NetworkError, TimeoutError } from '@synapse/client-sdk';
357
+
358
+ async function safeGetAccount(address: string) {
359
+ try {
360
+ return await rpc.getAccountInfo(address);
361
+ } catch (error) {
362
+ if (error instanceof NetworkError) {
363
+ console.error('Network error:', error.statusCode);
364
+ // Retry logic
365
+ } else if (error instanceof TimeoutError) {
366
+ console.error('Request timeout');
367
+ // Use cached data or fallback
368
+ } else if (error instanceof SynapseError) {
369
+ console.error('RPC error:', error.code, error.message);
370
+ // Handle specific RPC errors
371
+ }
372
+ throw error;
373
+ }
374
+ }
375
+ ```
376
+
377
+ ### 2. Rate Limiting
378
+
379
+ ```typescript
380
+ // ✅ Recommended: Implement rate limiting
381
+ import pLimit from 'p-limit';
382
+
383
+ const limit = pLimit(10); // Max 10 concurrent requests
384
+
385
+ const balances = await Promise.all(
386
+ addresses.map(address =>
387
+ limit(() => rpc.getBalance(address))
388
+ )
389
+ );
390
+
391
+ // ❌ Not recommended: Unlimited concurrent requests
392
+ const balances = await Promise.all(
393
+ addresses.map(address => rpc.getBalance(address))
394
+ );
395
+ ```
396
+
397
+ ### 3. Auto-Pagination Handling
398
+
399
+ ```typescript
400
+ // ✅ Recommended: Use built-in auto-pagination
401
+ const signatures = await rpc.getSignaturesForAddress(
402
+ 'address',
403
+ { limit: 1000 } // Automatically handles pagination
404
+ );
405
+
406
+ // ❌ Not recommended: Manual pagination
407
+ let allSignatures = [];
408
+ let before = undefined;
409
+ while (true) {
410
+ const batch = await rpc.getSignaturesForAddress(
411
+ 'address',
412
+ { limit: 1000, before }
413
+ );
414
+ if (batch.length === 0) break;
415
+ allSignatures.push(...batch);
416
+ before = batch[batch.length - 1].signature;
417
+ }
418
+ ```
419
+
420
+ ### 4. Transaction Confirmation
421
+
422
+ ```typescript
423
+ // ✅ Recommended: Use getSignatureStatuses
424
+ async function confirmTransaction(signature: string, maxAttempts = 30) {
425
+ for (let i = 0; i < maxAttempts; i++) {
426
+ const statuses = await rpc.getSignatureStatuses([signature]);
427
+ const status = statuses[0];
428
+
429
+ if (status?.confirmationStatus === 'confirmed' ||
430
+ status?.confirmationStatus === 'finalized') {
431
+ return status;
432
+ }
433
+
434
+ await new Promise(resolve => setTimeout(resolve, 1000));
435
+ }
436
+
437
+ throw new Error('Transaction confirmation timeout');
438
+ }
439
+
440
+ // ❌ Deprecated: Using confirmTransaction method
441
+ const status = await rpc.confirmTransaction({
442
+ signature,
443
+ blockhash,
444
+ lastValidBlockHeight,
445
+ });
446
+ ```
447
+
448
+ ### 5. Token Account Queries
449
+
450
+ ```typescript
451
+ // ✅ Efficient: Query specific token accounts
452
+ const usdcAccounts = await rpc.getTokenAccountsByOwner(
453
+ 'ownerAddress',
454
+ { mint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' }, // USDC
455
+ { encoding: 'jsonParsed' }
456
+ );
457
+
458
+ // ⚠️ Heavy: Query all token accounts
459
+ const allAccounts = await rpc.getTokenAccountsByOwner(
460
+ 'ownerAddress',
461
+ { programId: 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA' },
462
+ { encoding: 'jsonParsed' }
463
+ );
464
+ ```
465
+
466
+ ---
467
+
468
+ ## API Reference
469
+
470
+ ### Account Methods
471
+
472
+ #### getAccountInfo()
473
+
474
+ ```typescript
475
+ async getAccountInfo(
476
+ pubkey: string,
477
+ options?: {
478
+ commitment?: 'processed' | 'confirmed' | 'finalized';
479
+ encoding?: 'base58' | 'base64' | 'jsonParsed';
480
+ }
481
+ ): Promise<AccountInfo | null>
482
+ ```
483
+
484
+ Get account information including data, owner, and lamports.
485
+
486
+ **Example:**
487
+ ```typescript
488
+ const info = await rpc.getAccountInfo('address', {
489
+ commitment: 'confirmed',
490
+ encoding: 'jsonParsed',
491
+ });
492
+ console.log('Owner:', info?.owner);
493
+ console.log('Lamports:', info?.lamports);
494
+ ```
495
+
496
+ ---
497
+
498
+ #### getBalance()
499
+
500
+ ```typescript
501
+ async getBalance(
502
+ pubkey: string,
503
+ commitment?: 'processed' | 'confirmed' | 'finalized'
504
+ ): Promise<number>
505
+ ```
506
+
507
+ Get SOL balance for an address in lamports.
508
+
509
+ **Example:**
510
+ ```typescript
511
+ const balance = await rpc.getBalance('address', 'confirmed');
512
+ console.log('Balance:', balance / 1e9, 'SOL');
513
+ ```
514
+
515
+ ---
516
+
517
+ #### getMultipleAccounts()
518
+
519
+ ```typescript
520
+ async getMultipleAccounts(
521
+ pubkeys: string[],
522
+ options?: {
523
+ commitment?: 'processed' | 'confirmed' | 'finalized';
524
+ encoding?: 'base58' | 'base64' | 'jsonParsed';
525
+ }
526
+ ): Promise<(AccountInfo | null)[]>
527
+ ```
528
+
529
+ Get multiple account infos in a single call. Maximum 100 accounts per request.
530
+
531
+ **Example:**
532
+ ```typescript
533
+ const accounts = await rpc.getMultipleAccounts(
534
+ ['address1', 'address2', 'address3'],
535
+ { encoding: 'base64' }
536
+ );
537
+ accounts.forEach((acc, i) => {
538
+ console.log(`Account ${i}:`, acc?.lamports);
539
+ });
540
+ ```
541
+
542
+ ---
543
+
544
+ #### getProgramAccounts()
545
+
546
+ ```typescript
547
+ async getProgramAccounts(
548
+ programId: string,
549
+ options?: {
550
+ commitment?: 'processed' | 'confirmed' | 'finalized';
551
+ encoding?: 'base58' | 'base64' | 'jsonParsed';
552
+ dataSlice?: { offset: number; length: number };
553
+ filters?: Array<
554
+ | { dataSize: number }
555
+ | { memcmp: { offset: number; bytes: string } }
556
+ >;
557
+ }
558
+ ): Promise<any[]>
559
+ ```
560
+
561
+ Get all accounts owned by a program. Use filters to reduce data transfer.
562
+
563
+ **Example:**
564
+ ```typescript
565
+ const accounts = await rpc.getProgramAccounts('programId', {
566
+ encoding: 'base64',
567
+ dataSlice: { offset: 0, length: 32 },
568
+ filters: [
569
+ { dataSize: 165 },
570
+ { memcmp: { offset: 8, bytes: 'base58string' } },
571
+ ],
572
+ });
573
+ ```
574
+
575
+ ---
576
+
577
+ ### Block Methods
578
+
579
+ #### getBlock()
580
+
581
+ ```typescript
582
+ async getBlock(
583
+ slot: number,
584
+ options?: {
585
+ commitment?: 'processed' | 'confirmed' | 'finalized';
586
+ encoding?: 'json' | 'jsonParsed' | 'base64';
587
+ transactionDetails?: 'full' | 'accounts' | 'signatures' | 'none';
588
+ rewards?: boolean;
589
+ maxSupportedTransactionVersion?: number;
590
+ }
591
+ ): Promise<Block>
592
+ ```
593
+
594
+ Get a confirmed block with transactions and metadata.
595
+
596
+ **Example:**
597
+ ```typescript
598
+ const block = await rpc.getBlock(250_000_000, {
599
+ encoding: 'jsonParsed',
600
+ transactionDetails: 'full',
601
+ rewards: true,
602
+ maxSupportedTransactionVersion: 0,
603
+ });
604
+ console.log('Transactions:', block.transactions.length);
605
+ ```
606
+
607
+ ---
608
+
609
+ #### getBlockHeight()
610
+
611
+ ```typescript
612
+ async getBlockHeight(
613
+ commitment?: 'processed' | 'confirmed' | 'finalized'
614
+ ): Promise<number>
615
+ ```
616
+
617
+ Get current block height.
618
+
619
+ **Example:**
620
+ ```typescript
621
+ const height = await rpc.getBlockHeight('confirmed');
622
+ console.log('Current block:', height);
623
+ ```
624
+
625
+ ---
626
+
627
+ ### Transaction Methods
628
+
629
+ #### getTransaction()
630
+
631
+ ```typescript
632
+ async getTransaction(
633
+ signature: string,
634
+ options?: {
635
+ commitment?: 'processed' | 'confirmed' | 'finalized';
636
+ encoding?: 'json' | 'jsonParsed' | 'base64';
637
+ maxSupportedTransactionVersion?: number;
638
+ }
639
+ ): Promise<ConfirmedTransaction | null>
640
+ ```
641
+
642
+ Get transaction details by signature.
643
+
644
+ **Example:**
645
+ ```typescript
646
+ const tx = await rpc.getTransaction('signature', {
647
+ encoding: 'jsonParsed',
648
+ maxSupportedTransactionVersion: 0,
649
+ });
650
+ console.log('Status:', tx?.meta?.err ? 'Failed' : 'Success');
651
+ ```
652
+
653
+ ---
654
+
655
+ #### getSignaturesForAddress()
656
+
657
+ ```typescript
658
+ async getSignaturesForAddress(
659
+ address: string,
660
+ options?: {
661
+ limit?: number;
662
+ before?: string;
663
+ until?: string;
664
+ commitment?: 'processed' | 'confirmed' | 'finalized';
665
+ }
666
+ ): Promise<TransactionSignature[]>
667
+ ```
668
+
669
+ Get transaction signatures for an address. Auto-paginated up to specified limit.
670
+
671
+ **Example:**
672
+ ```typescript
673
+ const signatures = await rpc.getSignaturesForAddress('address', {
674
+ limit: 100,
675
+ commitment: 'confirmed',
676
+ });
677
+ console.log('Signatures:', signatures.length);
678
+ ```
679
+
680
+ ---
681
+
682
+ #### getSignatureStatuses()
683
+
684
+ ```typescript
685
+ async getSignatureStatuses(
686
+ signatures: string[],
687
+ options?: {
688
+ searchTransactionHistory?: boolean;
689
+ }
690
+ ): Promise<SignatureStatus[]>
691
+ ```
692
+
693
+ Get confirmation status for transaction signatures.
694
+
695
+ **Example:**
696
+ ```typescript
697
+ const statuses = await rpc.getSignatureStatuses(['sig1', 'sig2']);
698
+ statuses.forEach((status, i) => {
699
+ console.log(`Signature ${i}:`, status?.confirmationStatus);
700
+ });
701
+ ```
702
+
703
+ ---
704
+
705
+ ### Token Methods
706
+
707
+ #### getTokenAccountsByOwner()
708
+
709
+ ```typescript
710
+ async getTokenAccountsByOwner(
711
+ ownerPubkey: string,
712
+ filter: { mint: string } | { programId: string },
713
+ options?: {
714
+ commitment?: 'processed' | 'confirmed' | 'finalized';
715
+ encoding?: 'base58' | 'base64' | 'jsonParsed';
716
+ }
717
+ ): Promise<TokenAccount[]>
718
+ ```
719
+
720
+ Get all token accounts for an owner, filtered by mint or program.
721
+
722
+ **Example:**
723
+ ```typescript
724
+ // Get USDC accounts
725
+ const usdcAccounts = await rpc.getTokenAccountsByOwner(
726
+ 'ownerAddress',
727
+ { mint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' },
728
+ { encoding: 'jsonParsed' }
729
+ );
730
+
731
+ // Get all SPL token accounts
732
+ const allTokenAccounts = await rpc.getTokenAccountsByOwner(
733
+ 'ownerAddress',
734
+ { programId: 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA' },
735
+ { encoding: 'jsonParsed' }
736
+ );
737
+ ```
738
+
739
+ ---
740
+
741
+ #### getTokenSupply()
742
+
743
+ ```typescript
744
+ async getTokenSupply(
745
+ mint: string,
746
+ commitment?: 'processed' | 'confirmed' | 'finalized'
747
+ ): Promise<TokenAmount>
748
+ ```
749
+
750
+ Get total supply for an SPL token.
751
+
752
+ **Example:**
753
+ ```typescript
754
+ const supply = await rpc.getTokenSupply('mintAddress');
755
+ console.log('Supply:', supply.value.uiAmount);
756
+ console.log('Decimals:', supply.value.decimals);
757
+ ```
758
+
759
+ ---
760
+
761
+ ### Utility Methods
762
+
763
+ #### getLatestBlockhash()
764
+
765
+ ```typescript
766
+ async getLatestBlockhash(
767
+ commitment?: 'processed' | 'confirmed' | 'finalized'
768
+ ): Promise<BlockhashInfo>
769
+ ```
770
+
771
+ Get latest blockhash for transaction construction.
772
+
773
+ **Example:**
774
+ ```typescript
775
+ const { blockhash, lastValidBlockHeight } = await rpc.getLatestBlockhash();
776
+ console.log('Blockhash:', blockhash);
777
+ console.log('Valid until block:', lastValidBlockHeight);
778
+ ```
779
+
780
+ ---
781
+
782
+ #### isBlockhashValid()
783
+
784
+ ```typescript
785
+ async isBlockhashValid(
786
+ blockhash: string,
787
+ commitment?: 'processed' | 'confirmed' | 'finalized'
788
+ ): Promise<boolean>
789
+ ```
790
+
791
+ Check if a blockhash is still valid for transactions.
792
+
793
+ **Example:**
794
+ ```typescript
795
+ const isValid = await rpc.isBlockhashValid(blockhash);
796
+ if (!isValid) {
797
+ console.log('Blockhash expired, getting new one...');
798
+ const { blockhash: newBlockhash } = await rpc.getLatestBlockhash();
799
+ }
800
+ ```
801
+
802
+ ---
803
+
804
+ ## Troubleshooting
805
+
806
+ ### Issue: "Account not found" errors
807
+
808
+ **Solutions:**
809
+ - Verify the address is correct
810
+ - Check the account exists on the cluster
811
+ - Use correct commitment level (`finalized` for older data)
812
+
813
+ ```typescript
814
+ const info = await rpc.getAccountInfo(address, {
815
+ commitment: 'finalized' // Try finalized for older accounts
816
+ });
817
+ ```
818
+
819
+ ---
820
+
821
+ ### Issue: Slow getProgramAccounts queries
822
+
823
+ **Solutions:**
824
+ - Use dataSlice to reduce data transfer
825
+ - Apply filters to limit results
826
+ - Consider using caching
827
+
828
+ ```typescript
829
+ const accounts = await rpc.getProgramAccounts('programId', {
830
+ dataSlice: { offset: 0, length: 32 },
831
+ filters: [{ dataSize: 165 }],
832
+ });
833
+ ```
834
+
835
+ ---
836
+
837
+ ### Issue: Rate limiting errors
838
+
839
+ **Solutions:**
840
+ - Implement request throttling
841
+ - Use batch operations
842
+ - Increase API plan limits
843
+
844
+ ```typescript
845
+ import pLimit from 'p-limit';
846
+ const limit = pLimit(10);
847
+
848
+ const results = await Promise.all(
849
+ addresses.map(addr => limit(() => rpc.getBalance(addr)))
850
+ );
851
+ ```
852
+
853
+ ---
854
+
855
+ **Solana RPC Methods Module** - Type-safe Solana blockchain queries
856
+
857
+ Built for production-grade Solana development