File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -221,13 +221,22 @@ export interface ParsedTransaction {
221221}
222222
223223/**
224- * SS58 address format prefixes
224+ * SS58 address format prefixes.
225+ * Using a numeric union type rather than an enum so that callers can pass
226+ * the raw SS58 prefix number directly without a cast.
225227 */
226- export enum AddressFormat {
228+ export type AddressFormat = 0 | 2 | 42 ;
229+
230+ /**
231+ * Named constants for common SS58 address formats.
232+ * All existing call sites using AddressFormat.Polkadot / .Kusama / .Substrate
233+ * continue to work unchanged.
234+ */
235+ export const AddressFormat = {
227236 /** Polkadot mainnet (prefix 0, addresses start with '1') */
228- Polkadot = 0 ,
237+ Polkadot : 0 ,
229238 /** Kusama (prefix 2) */
230- Kusama = 2 ,
239+ Kusama : 2 ,
231240 /** Substrate generic (prefix 42, addresses start with '5') */
232- Substrate = 42 ,
233- }
241+ Substrate : 42 ,
242+ } as const satisfies Record < string , AddressFormat > ;
You can’t perform that action at this time.
0 commit comments