@thirdweb-dev/wallets
Version:
<p align="center"> <br /> <a href="https://thirdweb.com"><img src="https://github.com/thirdweb-dev/js/blob/main/packages/sdk/logo.svg?raw=true" width="200" alt=""/></a> <br /> </p> <h1 align="center">thirdweb Wallet SDK</h1> <p align="center"> <a href="ht
24 lines (21 loc) • 617 B
JavaScript
import { getValidChainRPCs } from '@thirdweb-dev/chains';
function isTwUrl(url) {
const host = new URL(url).hostname;
return host.endsWith(".thirdweb.com") || host === "localhost" || host === "0.0.0.0";
}
function getValidPublicRPCUrl(chain) {
return getValidChainRPCs(chain).map(rpc => {
try {
const url = new URL(rpc);
// remove client id from url
if (url.hostname.endsWith(".thirdweb.com")) {
url.pathname = "";
url.search = "";
}
return url.toString();
} catch (e) {
return rpc;
}
});
}
export { getValidPublicRPCUrl as g, isTwUrl as i };