@sudobility/types 1.8.21

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 (248) hide show
  1. package/CLAUDE.md +285 -0
  2. package/README.md +310 -0
  3. package/dist/index.cjs +62 -0
  4. package/dist/index.d.ts +18 -0
  5. package/dist/index.d.ts.map +1 -0
  6. package/dist/index.js +62 -0
  7. package/dist/index.js.map +1 -0
  8. package/dist/types/blockchain/common.cjs +102 -0
  9. package/dist/types/blockchain/common.d.ts +262 -0
  10. package/dist/types/blockchain/common.d.ts.map +1 -0
  11. package/dist/types/blockchain/common.js +102 -0
  12. package/dist/types/blockchain/common.js.map +1 -0
  13. package/dist/types/blockchain/index.cjs +18 -0
  14. package/dist/types/blockchain/index.d.ts +4 -0
  15. package/dist/types/blockchain/index.d.ts.map +1 -0
  16. package/dist/types/blockchain/index.js +18 -0
  17. package/dist/types/blockchain/index.js.map +1 -0
  18. package/dist/types/blockchain/validation.cjs +88 -0
  19. package/dist/types/blockchain/validation.d.ts +9 -0
  20. package/dist/types/blockchain/validation.d.ts.map +1 -0
  21. package/dist/types/blockchain/validation.js +88 -0
  22. package/dist/types/blockchain/validation.js.map +1 -0
  23. package/dist/types/business/enums.cjs +314 -0
  24. package/dist/types/business/enums.d.ts +227 -0
  25. package/dist/types/business/enums.d.ts.map +1 -0
  26. package/dist/types/business/enums.js +314 -0
  27. package/dist/types/business/enums.js.map +1 -0
  28. package/dist/types/business/index.cjs +33 -0
  29. package/dist/types/business/index.d.ts +5 -0
  30. package/dist/types/business/index.d.ts.map +1 -0
  31. package/dist/types/business/index.js +33 -0
  32. package/dist/types/business/index.js.map +1 -0
  33. package/dist/types/business/wallet-status.cjs +38 -0
  34. package/dist/types/business/wallet-status.d.ts +32 -0
  35. package/dist/types/business/wallet-status.d.ts.map +1 -0
  36. package/dist/types/business/wallet-status.js +38 -0
  37. package/dist/types/business/wallet-status.js.map +1 -0
  38. package/dist/types/common.cjs +6 -0
  39. package/dist/types/common.d.ts +142 -0
  40. package/dist/types/common.d.ts.map +1 -0
  41. package/dist/types/common.js +6 -0
  42. package/dist/types/common.js.map +1 -0
  43. package/dist/types/config/app-config.cjs +6 -0
  44. package/dist/types/config/app-config.d.ts +67 -0
  45. package/dist/types/config/app-config.d.ts.map +1 -0
  46. package/dist/types/config/app-config.js +6 -0
  47. package/dist/types/config/app-config.js.map +1 -0
  48. package/dist/types/config/environment.cjs +24 -0
  49. package/dist/types/config/environment.d.ts +68 -0
  50. package/dist/types/config/environment.d.ts.map +1 -0
  51. package/dist/types/config/environment.js +24 -0
  52. package/dist/types/config/environment.js.map +1 -0
  53. package/dist/types/config/index.cjs +6 -0
  54. package/dist/types/config/index.d.ts +4 -0
  55. package/dist/types/config/index.d.ts.map +1 -0
  56. package/dist/types/config/index.js +6 -0
  57. package/dist/types/config/index.js.map +1 -0
  58. package/dist/types/index.cjs +35 -0
  59. package/dist/types/index.d.ts +10 -0
  60. package/dist/types/index.d.ts.map +1 -0
  61. package/dist/types/index.js +35 -0
  62. package/dist/types/index.js.map +1 -0
  63. package/dist/types/indexer/index.cjs +19 -0
  64. package/dist/types/indexer/index.d.ts +3 -0
  65. package/dist/types/indexer/index.d.ts.map +1 -0
  66. package/dist/types/indexer/index.js +19 -0
  67. package/dist/types/indexer/index.js.map +1 -0
  68. package/dist/types/indexer/indexer-guards.cjs +145 -0
  69. package/dist/types/indexer/indexer-guards.d.ts +26 -0
  70. package/dist/types/indexer/indexer-guards.d.ts.map +1 -0
  71. package/dist/types/indexer/indexer-guards.js +145 -0
  72. package/dist/types/indexer/indexer-guards.js.map +1 -0
  73. package/dist/types/indexer/indexer-responses.cjs +8 -0
  74. package/dist/types/indexer/indexer-responses.d.ts +136 -0
  75. package/dist/types/indexer/indexer-responses.d.ts.map +1 -0
  76. package/dist/types/indexer/indexer-responses.js +8 -0
  77. package/dist/types/indexer/indexer-responses.js.map +1 -0
  78. package/dist/types/infrastructure/analytics.cjs +212 -0
  79. package/dist/types/infrastructure/analytics.d.ts +449 -0
  80. package/dist/types/infrastructure/analytics.d.ts.map +1 -0
  81. package/dist/types/infrastructure/analytics.js +212 -0
  82. package/dist/types/infrastructure/analytics.js.map +1 -0
  83. package/dist/types/infrastructure/api.cjs +17 -0
  84. package/dist/types/infrastructure/api.d.ts +152 -0
  85. package/dist/types/infrastructure/api.d.ts.map +1 -0
  86. package/dist/types/infrastructure/api.js +17 -0
  87. package/dist/types/infrastructure/api.js.map +1 -0
  88. package/dist/types/infrastructure/index.cjs +14 -0
  89. package/dist/types/infrastructure/index.d.ts +9 -0
  90. package/dist/types/infrastructure/index.d.ts.map +1 -0
  91. package/dist/types/infrastructure/index.js +14 -0
  92. package/dist/types/infrastructure/index.js.map +1 -0
  93. package/dist/types/infrastructure/navigation.cjs +3 -0
  94. package/dist/types/infrastructure/navigation.d.ts +56 -0
  95. package/dist/types/infrastructure/navigation.d.ts.map +1 -0
  96. package/dist/types/infrastructure/navigation.js +3 -0
  97. package/dist/types/infrastructure/navigation.js.map +1 -0
  98. package/dist/types/infrastructure/network.cjs +18 -0
  99. package/dist/types/infrastructure/network.d.ts +48 -0
  100. package/dist/types/infrastructure/network.d.ts.map +1 -0
  101. package/dist/types/infrastructure/network.js +18 -0
  102. package/dist/types/infrastructure/network.js.map +1 -0
  103. package/dist/types/infrastructure/wallet.cjs +37 -0
  104. package/dist/types/infrastructure/wallet.d.ts +33 -0
  105. package/dist/types/infrastructure/wallet.d.ts.map +1 -0
  106. package/dist/types/infrastructure/wallet.js +37 -0
  107. package/dist/types/infrastructure/wallet.js.map +1 -0
  108. package/dist/types/kyc/index.cjs +19 -0
  109. package/dist/types/kyc/index.d.ts +2 -0
  110. package/dist/types/kyc/index.d.ts.map +1 -0
  111. package/dist/types/kyc/index.js +19 -0
  112. package/dist/types/kyc/index.js.map +1 -0
  113. package/dist/types/kyc/kyc-types.cjs +12 -0
  114. package/dist/types/kyc/kyc-types.d.ts +260 -0
  115. package/dist/types/kyc/kyc-types.d.ts.map +1 -0
  116. package/dist/types/kyc/kyc-types.js +12 -0
  117. package/dist/types/kyc/kyc-types.js.map +1 -0
  118. package/dist/types/mailer/index.cjs +19 -0
  119. package/dist/types/mailer/index.d.ts +2 -0
  120. package/dist/types/mailer/index.d.ts.map +1 -0
  121. package/dist/types/mailer/index.js +19 -0
  122. package/dist/types/mailer/index.js.map +1 -0
  123. package/dist/types/mailer/mail-types.cjs +38 -0
  124. package/dist/types/mailer/mail-types.d.ts +296 -0
  125. package/dist/types/mailer/mail-types.d.ts.map +1 -0
  126. package/dist/types/mailer/mail-types.js +38 -0
  127. package/dist/types/mailer/mail-types.js.map +1 -0
  128. package/dist/types/wildduck/index.cjs +19 -0
  129. package/dist/types/wildduck/index.d.ts +2 -0
  130. package/dist/types/wildduck/index.d.ts.map +1 -0
  131. package/dist/types/wildduck/index.js +19 -0
  132. package/dist/types/wildduck/index.js.map +1 -0
  133. package/dist/types/wildduck/wildduck-types.cjs +48 -0
  134. package/dist/types/wildduck/wildduck-types.d.ts +1239 -0
  135. package/dist/types/wildduck/wildduck-types.d.ts.map +1 -0
  136. package/dist/types/wildduck/wildduck-types.js +48 -0
  137. package/dist/types/wildduck/wildduck-types.js.map +1 -0
  138. package/dist/utils/async-helpers.cjs +130 -0
  139. package/dist/utils/async-helpers.d.ts +35 -0
  140. package/dist/utils/async-helpers.d.ts.map +1 -0
  141. package/dist/utils/async-helpers.js +130 -0
  142. package/dist/utils/async-helpers.js.map +1 -0
  143. package/dist/utils/auth/auth.cjs +96 -0
  144. package/dist/utils/auth/auth.d.ts +40 -0
  145. package/dist/utils/auth/auth.d.ts.map +1 -0
  146. package/dist/utils/auth/auth.js +96 -0
  147. package/dist/utils/auth/auth.js.map +1 -0
  148. package/dist/utils/auth/index.cjs +14 -0
  149. package/dist/utils/auth/index.d.ts +2 -0
  150. package/dist/utils/auth/index.d.ts.map +1 -0
  151. package/dist/utils/auth/index.js +14 -0
  152. package/dist/utils/auth/index.js.map +1 -0
  153. package/dist/utils/blockchain/address.cjs +231 -0
  154. package/dist/utils/blockchain/address.d.ts +65 -0
  155. package/dist/utils/blockchain/address.d.ts.map +1 -0
  156. package/dist/utils/blockchain/address.js +231 -0
  157. package/dist/utils/blockchain/address.js.map +1 -0
  158. package/dist/utils/blockchain/event-helpers.cjs +143 -0
  159. package/dist/utils/blockchain/event-helpers.d.ts +87 -0
  160. package/dist/utils/blockchain/event-helpers.d.ts.map +1 -0
  161. package/dist/utils/blockchain/event-helpers.js +143 -0
  162. package/dist/utils/blockchain/event-helpers.js.map +1 -0
  163. package/dist/utils/blockchain/index.cjs +30 -0
  164. package/dist/utils/blockchain/index.d.ts +8 -0
  165. package/dist/utils/blockchain/index.d.ts.map +1 -0
  166. package/dist/utils/blockchain/index.js +30 -0
  167. package/dist/utils/blockchain/index.js.map +1 -0
  168. package/dist/utils/blockchain/rpc-helpers.cjs +865 -0
  169. package/dist/utils/blockchain/rpc-helpers.d.ts +251 -0
  170. package/dist/utils/blockchain/rpc-helpers.d.ts.map +1 -0
  171. package/dist/utils/blockchain/rpc-helpers.js +865 -0
  172. package/dist/utils/blockchain/rpc-helpers.js.map +1 -0
  173. package/dist/utils/constants/application.cjs +158 -0
  174. package/dist/utils/constants/application.d.ts +119 -0
  175. package/dist/utils/constants/application.d.ts.map +1 -0
  176. package/dist/utils/constants/application.js +158 -0
  177. package/dist/utils/constants/application.js.map +1 -0
  178. package/dist/utils/constants/index.cjs +30 -0
  179. package/dist/utils/constants/index.d.ts +7 -0
  180. package/dist/utils/constants/index.d.ts.map +1 -0
  181. package/dist/utils/constants/index.js +30 -0
  182. package/dist/utils/constants/index.js.map +1 -0
  183. package/dist/utils/constants/status-values.cjs +14 -0
  184. package/dist/utils/constants/status-values.d.ts +12 -0
  185. package/dist/utils/constants/status-values.d.ts.map +1 -0
  186. package/dist/utils/constants/status-values.js +14 -0
  187. package/dist/utils/constants/status-values.js.map +1 -0
  188. package/dist/utils/formatting/currency.cjs +36 -0
  189. package/dist/utils/formatting/currency.d.ts +26 -0
  190. package/dist/utils/formatting/currency.d.ts.map +1 -0
  191. package/dist/utils/formatting/currency.js +36 -0
  192. package/dist/utils/formatting/currency.js.map +1 -0
  193. package/dist/utils/formatting/date.cjs +138 -0
  194. package/dist/utils/formatting/date.d.ts +33 -0
  195. package/dist/utils/formatting/date.d.ts.map +1 -0
  196. package/dist/utils/formatting/date.js +138 -0
  197. package/dist/utils/formatting/date.js.map +1 -0
  198. package/dist/utils/formatting/index.cjs +37 -0
  199. package/dist/utils/formatting/index.d.ts +4 -0
  200. package/dist/utils/formatting/index.d.ts.map +1 -0
  201. package/dist/utils/formatting/index.js +37 -0
  202. package/dist/utils/formatting/index.js.map +1 -0
  203. package/dist/utils/formatting/string.cjs +193 -0
  204. package/dist/utils/formatting/string.d.ts +69 -0
  205. package/dist/utils/formatting/string.d.ts.map +1 -0
  206. package/dist/utils/formatting/string.js +193 -0
  207. package/dist/utils/formatting/string.js.map +1 -0
  208. package/dist/utils/index.cjs +28 -0
  209. package/dist/utils/index.d.ts +12 -0
  210. package/dist/utils/index.d.ts.map +1 -0
  211. package/dist/utils/index.js +28 -0
  212. package/dist/utils/index.js.map +1 -0
  213. package/dist/utils/logging/index.cjs +16 -0
  214. package/dist/utils/logging/index.d.ts +5 -0
  215. package/dist/utils/logging/index.d.ts.map +1 -0
  216. package/dist/utils/logging/index.js +16 -0
  217. package/dist/utils/logging/index.js.map +1 -0
  218. package/dist/utils/logging/logger.cjs +92 -0
  219. package/dist/utils/logging/logger.d.ts +70 -0
  220. package/dist/utils/logging/logger.d.ts.map +1 -0
  221. package/dist/utils/logging/logger.js +92 -0
  222. package/dist/utils/logging/logger.js.map +1 -0
  223. package/dist/utils/url/index.cjs +13 -0
  224. package/dist/utils/url/index.d.ts +5 -0
  225. package/dist/utils/url/index.d.ts.map +1 -0
  226. package/dist/utils/url/index.js +13 -0
  227. package/dist/utils/url/index.js.map +1 -0
  228. package/dist/utils/url/url-params.cjs +128 -0
  229. package/dist/utils/url/url-params.d.ts +36 -0
  230. package/dist/utils/url/url-params.d.ts.map +1 -0
  231. package/dist/utils/url/url-params.js +128 -0
  232. package/dist/utils/url/url-params.js.map +1 -0
  233. package/dist/utils/validation/index.cjs +25 -0
  234. package/dist/utils/validation/index.d.ts +5 -0
  235. package/dist/utils/validation/index.d.ts.map +1 -0
  236. package/dist/utils/validation/index.js +25 -0
  237. package/dist/utils/validation/index.js.map +1 -0
  238. package/dist/utils/validation/type-validation.cjs +167 -0
  239. package/dist/utils/validation/type-validation.d.ts +68 -0
  240. package/dist/utils/validation/type-validation.d.ts.map +1 -0
  241. package/dist/utils/validation/type-validation.js +167 -0
  242. package/dist/utils/validation/type-validation.js.map +1 -0
  243. package/dist/utils/validation/web3-username-validator.cjs +132 -0
  244. package/dist/utils/validation/web3-username-validator.d.ts +43 -0
  245. package/dist/utils/validation/web3-username-validator.d.ts.map +1 -0
  246. package/dist/utils/validation/web3-username-validator.js +132 -0
  247. package/dist/utils/validation/web3-username-validator.js.map +1 -0
  248. package/package.json +80 -0
@@ -0,0 +1,251 @@
1
+ /**
2
+ * RPC and API endpoint helper utilities
3
+ *
4
+ * Provides helper functions to build RPC endpoints and block explorer API URLs
5
+ * from API keys and chain identifiers.
6
+ */
7
+ import { Chain, ChainType } from '../../types/business/enums';
8
+ import { Optional } from '../../types/common';
9
+ import type { ChainConfig } from '../../types/blockchain/common';
10
+ /**
11
+ * Blockchain API keys configuration
12
+ */
13
+ export interface BlockchainApis {
14
+ /** Alchemy API key for RPC access (supports both EVM and Solana) */
15
+ alchemyApiKey: string;
16
+ /** Etherscan Multichain API key for block explorer API access (EVM only) */
17
+ etherscanApiKey: string;
18
+ }
19
+ /**
20
+ * Helper class for building RPC endpoints and block explorer API URLs
21
+ */
22
+ export declare class RpcHelpers {
23
+ /**
24
+ * Check if a chain is an EVM chain
25
+ * @param chain - Chain identifier to check
26
+ * @returns True if the chain is an EVM chain
27
+ */
28
+ static isEvmChain(chain: Chain): boolean;
29
+ /**
30
+ * Check if a chain is a Solana chain
31
+ * @param chain - Chain identifier to check
32
+ * @returns True if the chain is a Solana chain
33
+ */
34
+ static isSolanaChain(chain: Chain): boolean;
35
+ /**
36
+ * Get the chain type (EVM or Solana) for a given chain
37
+ * @param chain - Chain identifier
38
+ * @returns ChainType.EVM or ChainType.SOLANA
39
+ * @throws Error if the chain is not recognized
40
+ * @example
41
+ * ```typescript
42
+ * const type = RpcHelpers.getChainType(Chain.ETH_MAINNET);
43
+ * // Returns: ChainType.EVM
44
+ *
45
+ * const solanaType = RpcHelpers.getChainType(Chain.SOLANA_MAINNET);
46
+ * // Returns: ChainType.SOLANA
47
+ * ```
48
+ */
49
+ static getChainType(chain: Chain): ChainType;
50
+ /**
51
+ * Get the chain ID for a given chain
52
+ * @param chain - Chain identifier
53
+ * @returns Numeric chain ID for EVM chains, or negative ID for Solana chains
54
+ * @throws Error if the chain is not recognized or has no chain ID
55
+ * @example
56
+ * ```typescript
57
+ * const ethChainId = RpcHelpers.getChainId(Chain.ETH_MAINNET);
58
+ * // Returns: 1
59
+ *
60
+ * const polygonChainId = RpcHelpers.getChainId(Chain.POLYGON_MAINNET);
61
+ * // Returns: 137
62
+ *
63
+ * const solanaChainId = RpcHelpers.getChainId(Chain.SOLANA_MAINNET);
64
+ * // Returns: -101
65
+ *
66
+ * const localChainId = RpcHelpers.getChainId(Chain.EVM_LOCAL);
67
+ * // Returns: 31337
68
+ * ```
69
+ */
70
+ static getChainId(chain: Chain): number;
71
+ /**
72
+ * Get the USDC address/mint for a given chain
73
+ * @param chain - Chain identifier
74
+ * @returns USDC contract address for EVM chains, or mint address for Solana chains
75
+ * @throws Error if the chain is not recognized
76
+ * @example
77
+ * ```typescript
78
+ * const ethUSDC = RpcHelpers.getUSDCAddress(Chain.ETH_MAINNET);
79
+ * // Returns: '0xA0b86a33E6441146a8A8e27c01f0D9B1F5E42E92'
80
+ *
81
+ * const polygonUSDC = RpcHelpers.getUSDCAddress(Chain.POLYGON_MAINNET);
82
+ * // Returns: '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174'
83
+ *
84
+ * const solanaUSDC = RpcHelpers.getUSDCAddress(Chain.SOLANA_MAINNET);
85
+ * // Returns: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'
86
+ * ```
87
+ */
88
+ static getUSDCAddress(chain: Chain): string;
89
+ /**
90
+ * Get the user-friendly display name for a chain
91
+ * @param chain - Chain identifier
92
+ * @returns Human-readable chain name
93
+ * @throws Error if the chain is not recognized
94
+ * @example
95
+ * ```typescript
96
+ * const ethName = RpcHelpers.getUserFriendlyName(Chain.ETH_MAINNET);
97
+ * // Returns: 'Ethereum'
98
+ *
99
+ * const polygonName = RpcHelpers.getUserFriendlyName(Chain.POLYGON_MAINNET);
100
+ * // Returns: 'Polygon'
101
+ *
102
+ * const sepoliaName = RpcHelpers.getUserFriendlyName(Chain.ETH_SEPOLIA);
103
+ * // Returns: 'Ethereum Sepolia'
104
+ *
105
+ * const localName = RpcHelpers.getUserFriendlyName(Chain.EVM_LOCAL);
106
+ * // Returns: 'Local EVM'
107
+ * ```
108
+ */
109
+ static getUserFriendlyName(chain: Chain): string;
110
+ /**
111
+ * Get the list of visible chains for the application
112
+ * @param isDev - Whether to include development/testnet chains
113
+ * @returns Array of Chain values to display
114
+ * @example
115
+ * ```typescript
116
+ * const prodChains = RpcHelpers.getVisibleChains(false);
117
+ * // Returns: [Chain.ETH_MAINNET, Chain.BASE_MAINNET, Chain.POLYGON_MAINNET, Chain.OPTIMISM_MAINNET]
118
+ *
119
+ * const devChains = RpcHelpers.getVisibleChains(true);
120
+ * // Returns: [Chain.ETH_MAINNET, Chain.BASE_MAINNET, Chain.POLYGON_MAINNET, Chain.OPTIMISM_MAINNET, Chain.ETH_SEPOLIA]
121
+ * ```
122
+ */
123
+ static getVisibleChains(isDev: boolean): Chain[];
124
+ /**
125
+ * Derive all chain information from a ChainConfig
126
+ * @param config - Chain configuration with API keys
127
+ * @returns Object with all derived chain information
128
+ * @example
129
+ * ```typescript
130
+ * const config: ChainConfig = {
131
+ * chain: Chain.ETH_MAINNET,
132
+ * alchemyApiKey: 'your-alchemy-key',
133
+ * etherscanApiKey: 'your-etherscan-key'
134
+ * };
135
+ *
136
+ * const info = RpcHelpers.getChainInfo(config);
137
+ * // Returns: {
138
+ * // chain: Chain.ETH_MAINNET,
139
+ * // chainId: 1,
140
+ * // chainType: ChainType.EVM,
141
+ * // name: 'Ethereum',
142
+ * // rpcUrl: 'https://eth-mainnet.g.alchemy.com/v2/your-alchemy-key',
143
+ * // explorerApiUrl: 'https://api.etherscan.io/api?apikey=your-etherscan-key',
144
+ * // explorerUrl: 'https://etherscan.io',
145
+ * // usdcAddress: '0xA0b86a33E6441146a8A8e27c01f0D9B1F5E42E92'
146
+ * // }
147
+ * ```
148
+ */
149
+ static getChainInfo(config: ChainConfig): {
150
+ chain: Chain;
151
+ chainId: number;
152
+ chainType: ChainType;
153
+ name: string;
154
+ rpcUrl: Optional<string>;
155
+ explorerApiUrl: Optional<string>;
156
+ explorerUrl: Optional<string>;
157
+ usdcAddress: string;
158
+ };
159
+ /**
160
+ * Build Alchemy RPC URL for any supported chain
161
+ *
162
+ * @param alchemyApiKey - Your Alchemy API key
163
+ * @param chain - Chain identifier from Chain enum
164
+ * @returns Complete RPC URL, or undefined if API key is empty or chain is unsupported
165
+ *
166
+ * @example
167
+ * ```typescript
168
+ * const rpcUrl = RpcHelpers.getRpcUrl('your-api-key', Chain.ETH_MAINNET);
169
+ * // Returns: https://eth-mainnet.g.alchemy.com/v2/your-api-key
170
+ *
171
+ * const solanaUrl = RpcHelpers.getRpcUrl('your-api-key', Chain.SOLANA_MAINNET);
172
+ * // Returns: https://solana-mainnet.g.alchemy.com/v2/your-api-key
173
+ *
174
+ * const invalidUrl = RpcHelpers.getRpcUrl('', Chain.ETH_MAINNET);
175
+ * // Returns: undefined
176
+ * ```
177
+ */
178
+ static getRpcUrl(alchemyApiKey: string, chain: Chain): Optional<string>;
179
+ /**
180
+ * Get RPC URL using BlockchainApis configuration
181
+ *
182
+ * Convenience overload that uses the BlockchainApis structure.
183
+ *
184
+ * @param apis - Blockchain API keys configuration
185
+ * @param chain - Chain identifier from Chain enum
186
+ * @returns Complete RPC URL, or undefined if invalid
187
+ *
188
+ * @example
189
+ * ```typescript
190
+ * const apis = {
191
+ * alchemyApiKey: 'your-alchemy-key',
192
+ * etherscanApiKey: 'your-etherscan-key'
193
+ * };
194
+ *
195
+ * const ethRpcUrl = RpcHelpers.getRpcUrl(apis, Chain.ETH_MAINNET);
196
+ * // Returns: https://eth-mainnet.g.alchemy.com/v2/your-alchemy-key
197
+ * ```
198
+ */
199
+ static getRpcUrl(apis: BlockchainApis, chain: Chain): Optional<string>;
200
+ /**
201
+ * Get block explorer API URL
202
+ *
203
+ * Uses the Etherscan Multichain API key which works across 60+ EVM networks.
204
+ * The API key is included as a query parameter in the URL.
205
+ * Note: Solana chains don't have Etherscan-style API endpoints and will return undefined.
206
+ *
207
+ * @param etherscanApiKey - Your Etherscan Multichain API key (or BlockchainApis object)
208
+ * @param chain - Chain identifier from Chain enum
209
+ * @returns Complete API endpoint URL with API key, or undefined if API key is empty, chain is Solana, or no explorer API available
210
+ *
211
+ * @example
212
+ * ```typescript
213
+ * // With API key string
214
+ * const etherscanUrl = RpcHelpers.getExplorerApiUrl('your-api-key', Chain.ETH_MAINNET);
215
+ * // Returns: https://api.etherscan.io/api?apikey=your-api-key
216
+ *
217
+ * // With BlockchainApis object
218
+ * const apis = {
219
+ * alchemyApiKey: 'your-alchemy-key',
220
+ * etherscanApiKey: 'your-etherscan-key'
221
+ * };
222
+ * const explorerApiUrl = RpcHelpers.getExplorerApiUrl(apis, Chain.POLYGON_MAINNET);
223
+ * // Returns: https://api.polygonscan.com/api?apikey=your-etherscan-key
224
+ *
225
+ * const solanaUrl = RpcHelpers.getExplorerApiUrl('your-api-key', Chain.SOLANA_MAINNET);
226
+ * // Returns: undefined (Solana doesn't have Etherscan-style API)
227
+ * ```
228
+ */
229
+ static getExplorerApiUrl(etherscanApiKey: string, chain: Chain): Optional<string>;
230
+ static getExplorerApiUrl(apis: BlockchainApis, chain: Chain): Optional<string>;
231
+ /**
232
+ * Get block explorer browser URL
233
+ *
234
+ * @param chain - Chain identifier from Chain enum
235
+ * @returns Browser URL for the explorer, or undefined if no explorer available
236
+ *
237
+ * @example
238
+ * ```typescript
239
+ * const etherscanUrl = RpcHelpers.getBlockExplorerUrl(Chain.ETH_MAINNET);
240
+ * // Returns: https://etherscan.io
241
+ *
242
+ * const basescanUrl = RpcHelpers.getBlockExplorerUrl(Chain.BASE_MAINNET);
243
+ * // Returns: https://basescan.org
244
+ *
245
+ * const solanaUrl = RpcHelpers.getBlockExplorerUrl(Chain.SOLANA_MAINNET);
246
+ * // Returns: https://explorer.solana.com
247
+ * ```
248
+ */
249
+ static getBlockExplorerUrl(chain: Chain): Optional<string>;
250
+ }
251
+ //# sourceMappingURL=rpc-helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rpc-helpers.d.ts","sourceRoot":"","sources":["../../../src/utils/blockchain/rpc-helpers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAEjE;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,oEAAoE;IACpE,aAAa,EAAE,MAAM,CAAC;IACtB,4EAA4E;IAC5E,eAAe,EAAE,MAAM,CAAC;CACzB;AA0wBD;;GAEG;AACH,qBAAa,UAAU;IACrB;;;;OAIG;IACH,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO;IAIxC;;;;OAIG;IACH,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO;IAI3C;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS;IAU5C;;;;;;;;;;;;;;;;;;;OAmBG;IACH,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM;IAQvC;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM;IAQ3C;;;;;;;;;;;;;;;;;;;OAmBG;IACH,MAAM,CAAC,mBAAmB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM;IAQhD;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,EAAE;IAehD;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,WAAW;;;;;;;;;;IAgBvC;;;;;;;;;;;;;;;;;;OAkBG;IACH,MAAM,CAAC,SAAS,CAAC,aAAa,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC;IACvE;;;;;;;;;;;;;;;;;;;OAmBG;IACH,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC;IA0BtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,MAAM,CAAC,iBAAiB,CACtB,eAAe,EAAE,MAAM,EACvB,KAAK,EAAE,KAAK,GACX,QAAQ,CAAC,MAAM,CAAC;IACnB,MAAM,CAAC,iBAAiB,CACtB,IAAI,EAAE,cAAc,EACpB,KAAK,EAAE,KAAK,GACX,QAAQ,CAAC,MAAM,CAAC;IA0BnB;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,CAAC,mBAAmB,CAAC,KAAK,EAAE,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC;CAQ3D"}