@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
27 lines (23 loc) • 655 B
JavaScript
;
var chains = require('@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 chains.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;
}
});
}
exports.getValidPublicRPCUrl = getValidPublicRPCUrl;
exports.isTwUrl = isTwUrl;