-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFetchFromChain.js
51 lines (39 loc) · 1.32 KB
/
FetchFromChain.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
const ethers = require("ethers")
const axios = require("axios")
const {EvmChain} = require("@moralisweb3/common-evm-utils")
const { sign } = require("crypto")
const { log } = require("console")
const func = async() => {
const provider = new ethers.JsonRpcProvider("https://rpc.test.btcs.network")
console.log(provider);
const network = await provider._detectNetwork()
console.log(network);
console.log("network",network.chainId);
const bal =await provider.getBalance("0xd103929e56b9AaB3Ce786429D2088a98ADAa9C9E")
console.log("balance",bal);
const chain= await provider.getNetwork()
// const signer = await provider("0xd103929e56b9AaB3Ce786429D2088a98ADAa9C9E")
// console.log("signer",signer)
console.log(chain.name)
console.log(chain.toJSON());
console.log(await provider.getFeeData());
// const gasPrice = await provider.
// console.log("gasPrice",gasPrice);
const options = {
method: 'GET',
url: 'https://api.chainbase.online/v1/account/balance?chain_id=1115&address=0xd103929e56b9AaB3Ce786429D2088a98ADAa9C9E',
headers: {
accept: 'application/json',
'x-api-key': '2goIzkQNbjGHZi5pcBl0OoodWv6'
}
};
// axios
// .request(options)
// .then(function (response) {
// console.log(response.data);
// })
// .catch(function (error) {
// console.error(error);
// });
}
func()