@a-2-c-2-anpm/quaerat-doloremque-pariatur
Version:
🏃包含一些常用方法例如对象深克隆、递归调用、一一对比/数组交集、并集、差集/二维向量点乘、叉乘/股票KDJ、MACD、RSI、BOLL/验证为空、车牌号、邮箱、身份证、统一社会信用代码、手机号、版本对比/转换日期、星座、身份证解析、字节...持续更新整合
52 lines (46 loc) • 1.18 kB
JavaScript
import Web3 from "web3";
let minABI = [
// balanceOf
{
constant: true,
inputs: [{ name: "_owner", type: "address" }],
name: "balanceOf",
outputs: [{ name: "balance", type: "uint256" }],
type: "function"
},
// decimals
{
constant: true,
inputs: [],
name: "decimals",
outputs: [{ name: "", type: "uint8" }],
type: "function"
}
];
const addr = "0xxxx";
const contractSeedTree = "0xxxx";
export default function IndexPage() {
const web3 = new Web3(
new Web3.providers.HttpProvider("https://bsc-dataseed.binance.org/")
//Web3.givenProvider
);
const click = async () => {
console.log("teste");
var filter = { from: addr };
//web3.eth.getBalance(addr).then(console.log);
let contract = new web3.eth.Contract(minABI, contractSeedTree);
//var balance1 = contract.balanceOf(addr).toNumber();
var pastTransferEvents = contract.getPastEvents("allEvents", filter, {
fromBlock: 0
});
};
return (
<div>
Address: {addr}
<br />
<button onClick={click}>List</button>
<br />
{web3 ? "loading" : web3.eth.getBalance(addr).then(console.log)}
</div>
);
}