-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from argentlabs/develop
release 1.0.22
- Loading branch information
Showing
5 changed files
with
60 additions
and
29 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { RPC_NODE_URL_MAINNET, RPC_NODE_URL_TESTNET } from "../constants" | ||
|
||
export function mapTargetUrlToNodeUrl(target: string): string { | ||
try { | ||
const { origin } = new URL(target) | ||
if (origin.includes("localhost") || origin.includes("127.0.0.1")) { | ||
return RPC_NODE_URL_TESTNET | ||
} | ||
if (origin.includes("hydrogen")) { | ||
return RPC_NODE_URL_TESTNET | ||
} | ||
if (origin.includes("staging")) { | ||
return RPC_NODE_URL_MAINNET | ||
} | ||
if (origin.includes("argent.xyz")) { | ||
return RPC_NODE_URL_MAINNET | ||
} | ||
} catch (e) { | ||
console.warn( | ||
"Could not determine rpc nodeUrl from target URL, defaulting to mainnet", | ||
) | ||
} | ||
return RPC_NODE_URL_MAINNET | ||
} |
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