@sudobility/types 1.8.21 → 1.8.22

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.
@@ -16,6 +16,32 @@ export interface BlockchainApis {
16
16
  /** Etherscan Multichain API key for block explorer API access (EVM only) */
17
17
  etherscanApiKey: string;
18
18
  }
19
+ /**
20
+ * Consolidated chain information structure
21
+ * Contains all static metadata about a blockchain network
22
+ */
23
+ export interface ChainInfo {
24
+ /** Chain type (EVM or Solana) */
25
+ chainType: ChainType;
26
+ /** Numeric chain ID (positive for EVM, negative for Solana) */
27
+ chainId: number;
28
+ /** User-friendly display name */
29
+ name: string;
30
+ /** Alchemy network identifier for RPC endpoints */
31
+ alchemyNetwork: string;
32
+ /** Block explorer API domain (empty for Solana and unsupported chains) */
33
+ explorerDomain: string;
34
+ /** Block explorer browser domain */
35
+ explorerBrowserDomain: string;
36
+ /** USDC contract address (EVM) or mint address (Solana) */
37
+ usdcAddress: string;
38
+ /** Whether this is a development/testnet chain (true) or mainnet/production chain (false) */
39
+ isDev: boolean;
40
+ /** Optional deployed mailer contract address (EVM chains only) */
41
+ mailerAddress?: string;
42
+ /** Optional block number where the mailer contract was deployed (used for event indexing) */
43
+ startingBlock?: number;
44
+ }
19
45
  /**
20
46
  * Helper class for building RPC endpoints and block explorer API URLs
21
47
  */
@@ -47,6 +73,26 @@ export declare class RpcHelpers {
47
73
  * ```
48
74
  */
49
75
  static getChainType(chain: Chain): ChainType;
76
+ /**
77
+ * Get complete static chain information
78
+ * @param chain - Chain identifier
79
+ * @returns ChainInfo object containing all static chain metadata
80
+ * @throws Error if the chain is not recognized
81
+ * @example
82
+ * ```typescript
83
+ * const info = RpcHelpers.getChainInfo(Chain.ETH_MAINNET);
84
+ * // Returns: {
85
+ * // chainType: ChainType.EVM,
86
+ * // chainId: 1,
87
+ * // name: 'Ethereum',
88
+ * // alchemyNetwork: 'eth-mainnet',
89
+ * // explorerDomain: 'api.etherscan.io',
90
+ * // explorerBrowserDomain: 'etherscan.io',
91
+ * // usdcAddress: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'
92
+ * // }
93
+ * ```
94
+ */
95
+ static getChainInfo(chain: Chain): ChainInfo;
50
96
  /**
51
97
  * Get the chain ID for a given chain
52
98
  * @param chain - Chain identifier
@@ -109,22 +155,29 @@ export declare class RpcHelpers {
109
155
  static getUserFriendlyName(chain: Chain): string;
110
156
  /**
111
157
  * 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
158
+ * @param chainType - Filter by chain type (EVM or Solana)
159
+ * @param isDev - Whether to include development/testnet chains (true) or production chains (false)
160
+ * @returns Array of ChainInfo objects for chains that match the filters and have a mailer contract deployed
114
161
  * @example
115
162
  * ```typescript
116
- * const prodChains = RpcHelpers.getVisibleChains(false);
117
- * // Returns: [Chain.ETH_MAINNET, Chain.BASE_MAINNET, Chain.POLYGON_MAINNET, Chain.OPTIMISM_MAINNET]
163
+ * // Get production EVM chains with mailer contracts
164
+ * const prodEvmChains = RpcHelpers.getVisibleChains(ChainType.EVM, false);
165
+ * // Returns: ChainInfo[] with only mainnet EVM chains that have mailerAddress set
166
+ *
167
+ * // Get development EVM chains with mailer contracts
168
+ * const devEvmChains = RpcHelpers.getVisibleChains(ChainType.EVM, true);
169
+ * // Returns: ChainInfo[] with only testnet EVM chains that have mailerAddress set
118
170
  *
119
- * const devChains = RpcHelpers.getVisibleChains(true);
120
- * // Returns: [Chain.ETH_MAINNET, Chain.BASE_MAINNET, Chain.POLYGON_MAINNET, Chain.OPTIMISM_MAINNET, Chain.ETH_SEPOLIA]
171
+ * // Get production Solana chains with mailer contracts
172
+ * const prodSolanaChains = RpcHelpers.getVisibleChains(ChainType.SOLANA, false);
173
+ * // Returns: ChainInfo[] with only mainnet Solana chains that have mailerAddress set
121
174
  * ```
122
175
  */
123
- static getVisibleChains(isDev: boolean): Chain[];
176
+ static getVisibleChains(chainType: ChainType, isDev: boolean): ChainInfo[];
124
177
  /**
125
- * Derive all chain information from a ChainConfig
178
+ * Derive all chain information from a ChainConfig including API URLs
126
179
  * @param config - Chain configuration with API keys
127
- * @returns Object with all derived chain information
180
+ * @returns Object with all derived chain information including RPC and explorer URLs
128
181
  * @example
129
182
  * ```typescript
130
183
  * const config: ChainConfig = {
@@ -133,7 +186,7 @@ export declare class RpcHelpers {
133
186
  * etherscanApiKey: 'your-etherscan-key'
134
187
  * };
135
188
  *
136
- * const info = RpcHelpers.getChainInfo(config);
189
+ * const info = RpcHelpers.deriveChainInfo(config);
137
190
  * // Returns: {
138
191
  * // chain: Chain.ETH_MAINNET,
139
192
  * // chainId: 1,
@@ -146,7 +199,7 @@ export declare class RpcHelpers {
146
199
  * // }
147
200
  * ```
148
201
  */
149
- static getChainInfo(config: ChainConfig): {
202
+ static deriveChainInfo(config: ChainConfig): {
150
203
  chain: Chain;
151
204
  chainId: number;
152
205
  chainType: ChainType;
@@ -1 +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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