@mojito-inc/connect-wallet
Version:
Connecting wallet via metamask, wallet connect, email
47 lines (45 loc) • 1.51 kB
JavaScript
const getActiveChainId = (chainName) => {
switch (chainName) {
case 'sepolia':
return 11155111;
case 'base-sepolia-testnet':
return 84532;
case 'base':
return 8453;
case 'ethereum':
return 1;
case 'goerli':
return 5;
case 'mumbai':
return 80001;
case 'polygon':
return 137;
default:
return 11155111;
}
};
const getSolanaChainId = (chain, customRPCUrl) => {
var _a, _b, _c;
if (customRPCUrl) {
if ((_a = customRPCUrl === null || customRPCUrl === void 0 ? void 0 : customRPCUrl.includes) === null || _a === void 0 ? void 0 : _a.call(customRPCUrl, 'devnet')) {
return 901;
}
if ((_b = customRPCUrl === null || customRPCUrl === void 0 ? void 0 : customRPCUrl.includes) === null || _b === void 0 ? void 0 : _b.call(customRPCUrl, 'mainnet')) {
return 900;
}
if ((_c = customRPCUrl === null || customRPCUrl === void 0 ? void 0 : customRPCUrl.includes) === null || _c === void 0 ? void 0 : _c.call(customRPCUrl, 'testnet')) {
return 902;
}
}
switch (chain) {
case 'devnet':
return 901;
case 'mainnet-beta':
return 900;
case 'testnet':
return 902;
default:
return 901;
}
};
export { getActiveChainId, getSolanaChainId };