-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: sigAndKeyType validation and getTssPath
- Loading branch information
Showing
3 changed files
with
52 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,30 @@ | ||
import { | ||
INodeDetails, | ||
LEGACY_NETWORKS_ROUTE_MAP, | ||
TORUS_LEGACY_NETWORK, | ||
TORUS_LEGACY_NETWORK_TYPE, | ||
TORUS_NETWORK_TYPE, | ||
TORUS_SAPPHIRE_NETWORK, | ||
TORUS_SAPPHIRE_NETWORK_TYPE, | ||
WEB3AUTH_KEY_TYPE, | ||
WEB3AUTH_SIG_TYPE, | ||
} from "@toruslabs/constants"; | ||
|
||
import { getSapphireNodeDetails } from "./sapphireNetworkConfig"; | ||
|
||
export * from "./endpoints"; | ||
export * from "./sapphireNetworkConfig"; | ||
export * from "./utils"; | ||
|
||
export function fetchLocalConfig(network: TORUS_NETWORK_TYPE, keyType: WEB3AUTH_KEY_TYPE, sigType?: WEB3AUTH_SIG_TYPE): INodeDetails | undefined { | ||
if (Object.values(TORUS_SAPPHIRE_NETWORK).includes(network as TORUS_SAPPHIRE_NETWORK_TYPE)) { | ||
return getSapphireNodeDetails(network as TORUS_SAPPHIRE_NETWORK_TYPE, undefined, keyType, sigType); | ||
} | ||
|
||
if (Object.values(TORUS_LEGACY_NETWORK).includes(network as TORUS_LEGACY_NETWORK_TYPE)) { | ||
const legacyMap = LEGACY_NETWORKS_ROUTE_MAP[network as TORUS_LEGACY_NETWORK_TYPE]; | ||
if (legacyMap.migrationCompleted) return getSapphireNodeDetails(legacyMap.networkMigratedTo, network as TORUS_LEGACY_NETWORK_TYPE, keyType); | ||
} | ||
|
||
return undefined; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters