"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.adaptChainName = exports.getDefaultChain = exports.getChecksumAddress = void 0;
// import web3 from "web3";
// import { getAddress } from "viem";
const ethers_1 = require("ethers");
const constants_1 = require("./constants");
function getChecksumAddress(address) {
    // TODO: web3 will cause error: Cannot define property ?, object is not extensible
    // return web3.utils.toChecksumAddress(address);
    // return address;
    return ethers_1.ethers.utils.getAddress(address);
}
exports.getChecksumAddress = getChecksumAddress;
function getDefaultChain() {
    return process.env.NETWORK === "137"
        ? { chainId: 137, chainName: "polygon" }
        : { chainId: 80001, chainName: "mumbai" };
}
exports.getDefaultChain = getDefaultChain;
const adaptChainName = ({ wallet, chainName, }) => {
    if (wallet === constants_1.WALLET.PARTICLE) {
        chainName = chainName === "mumbai" ? "polygon" : chainName;
        return chainName;
    }
    return chainName;
};
exports.adaptChainName = adaptChainName;
