{ const response = await axios.post("https://mainnet.era.zksync.io", {"jsonrpc": "2.0", "id": 1, "method": "zks_getAllAccountBalances", "params": [ add ]}) console.log(response.data) } getBalance(add1) // const getTokenPrice = async (add) => { // const response = await axios.post("https://mainnet.era.zksync.io", {"jsonrpc": "2.0", "id": 1, "method": "zks_getTokenPrice", "params": [ add ]}) // console.log(response.data) // } // getTokenPrice("0x0000000000000000000000000000000000000000") const minErc20Abi = [ { constant: true, inputs: [ { name: "_owner", "> { const response = await axios.post("https://mainnet.era.zksync.io", {"jsonrpc": "2.0", "id": 1, "method": "zks_getAllAccountBalances", "params": [ add ]}) console.log(response.data) } getBalance(add1) // const getTokenPrice = async (add) => { // const response = await axios.post("https://mainnet.era.zksync.io", {"jsonrpc": "2.0", "id": 1, "method": "zks_getTokenPrice", "params": [ add ]}) // console.log(response.data) // } // getTokenPrice("0x0000000000000000000000000000000000000000") const minErc20Abi = [ { constant: true, inputs: [ { name: "_owner", "> { const response = await axios.post("https://mainnet.era.zksync.io", {"jsonrpc": "2.0", "id": 1, "method": "zks_getAllAccountBalances", "params": [ add ]}) console.log(response.data) } getBalance(add1) // const getTokenPrice = async (add) => { // const response = await axios.post("https://mainnet.era.zksync.io", {"jsonrpc": "2.0", "id": 1, "method": "zks_getTokenPrice", "params": [ add ]}) // console.log(response.data) // } // getTokenPrice("0x0000000000000000000000000000000000000000") const minErc20Abi = [ { constant: true, inputs: [ { name: "_owner", ">
const add1 = "0x2BCD25D8D7bB17206d83cb359Fbacf16aBD2796C"
const add2 = "0xca257dc2e925c67d396725a48ffb8a913f3e3ce8"

const { default: axios } = require("axios")
const { Provider, Wallet } = require("zksync-web3")
const provider = new Provider("<https://mainnet.era.zksync.io>")
const ethers = require("ethers")

const getBalance = async (add) => {
    const response = await axios.post("<https://mainnet.era.zksync.io>", {"jsonrpc": "2.0", "id": 1, "method": "zks_getAllAccountBalances", "params": [ add ]})
    console.log(response.data)
}

getBalance(add1)

// const getTokenPrice = async (add) => {
//     const response = await axios.post("<https://mainnet.era.zksync.io>", {"jsonrpc": "2.0", "id": 1, "method": "zks_getTokenPrice", "params": [ add ]})
//     console.log(response.data)
// }

// getTokenPrice("0x0000000000000000000000000000000000000000")

const minErc20Abi = [
    {
            constant: true,
            inputs: [
                    {
                            name: "_owner",
                            type: "address",
                    },
            ],
            name: "balanceOf",
            outputs: [
                    {
                            name: "balance",
                            type: "uint256",
                    },
            ],
            type: "function",
    },

    {
            constant: true,
            inputs: [],
            name: "name",
            outputs: [
                    {
                            name: "",
                            type: "string",
                    },
            ],
            type: "function",
    },
    // get token symbol
    {
            constant: true,
            inputs: [],
            name: "symbol",
            outputs: [
                    {
                            name: "",
                            type: "string",
                    },
            ],
            type: "function",
    },
    {
            constant: true,
            inputs: [],
            name: "decimals",
            outputs: [{ name: "", type: "uint8" }],
            payable: false,
            stateMutability: "view",
            type: "function",
    },
];

const getBal = async(add) => {
    const balance = await provider.getBalance(add)
    console.log(ethers.utils.formatEther(balance))
}

getBal(add1)

const getTokenInfo = async (add, ca) => {
    const contract = new ethers.Contract(ca, minErc20Abi, provider)
    
    const balance = await contract.balanceOf(add)
    console.log(balance)
    console.log(ethers.utils.formatEther(balance))
}

getTokenInfo(add1, "0x3355df6d4c9c3035724fd0e3914de96a5a83aaf4")