基于区块链的毕业设计ethereum-erc20-token-balances-multicall – 以太坊-erc20-token-balances-multicall

本文提供基于区块链的毕业设计国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,基于区块链的毕业设计ethereum-erc20-token-balances-multicall – 以太坊-erc20-token-balances-multicall 是一篇很好的国外资料

ethereum-erc20-token-balances-multicall - <a href=以太坊eth-erc20-token-balances-multicall”> ethereum-erc20-token-balances-multicall - <a href=以太坊eth-erc20-token-balances-multicall”>

ethereum-erc20-token-balances-multicall

This library will fetch all the token balances you want within 1 JSONRPC call. This solves long loading time when your trying to show balances for a lot of assets and brings down JSONRPC request limits. It also brings down the metadata for the token aka decimal places, name, symbol and balance. This will return in lighting speed if you compare that to say doing 50 seperate JSONRPC calls this brings the speed down around 50x.

This uses the ethereum-multicall which is a lightweight library for interacting with the multicall smart contract.

ethereum-erc20-token-balances-multicall is fully written in typescript so has full compile time support. The motivation of this package was to expose a super simple and easy to understand interface for you to take the full benefits of the fast loading of erc20 balances for users. Also to not being opinionated on how you use it, you can use it with web3 or ethers.

Supports

  • mainnet
  • kovan
  • görli
  • rinkeby
  • ropsten
  • binance smart chain
  • xdai
  • matic
  • mumbai

Installation

npm:

$ npm install ethereum-erc20-token-balances-multicall

yarn:

$ yarn add ethereum-erc20-token-balances-multicall

Usage

Ethers

import { getBalances } from 'ethereum-erc20-token-balances-multicall';  const balances = await getBalances({   // erc20 tokens you want to query!   contractAddresses: [     '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984',     '0xde30da39c46104798bb5aa3fe8b9e0e1f348163f',     // unlimited amount you can keep adding and adding     // you can also build up easily through the code as well   ],   // ethereum address of the user you want to get the balances for   ethereumAddress: 'THE_ETHEREUM_ADDRESS',   // your ethers provider   providerOptions: {     ethersProvider: YOUR_ETHERS_PROVIDER,   }, });  console.log('result', balances);  // result [   {     contractAddress: '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984',     symbol: 'UNI',     decimals: 18,     name: 'Uniswap',     balance: '703.523279430449604142',   },   {     contractAddress: '0xde30da39c46104798bb5aa3fe8b9e0e1f348163f',     symbol: 'GTC',     decimals: 18,     name: 'Gitcoin',     balance: '400.606',   }, ];

Web3

import { getBalances } from 'ethereum-erc20-token-balances-multicall';  const balances = await getBalances({   // erc20 tokens you want to query!   contractAddresses: [     '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984',     '0xde30da39c46104798bb5aa3fe8b9e0e1f348163f',     // unlimited amount you can keep adding and adding     // you can also build up easily through the code as well   ],   // ethereum address of the user you want to get the balances for   ethereumAddress: 'THE_ETHEREUM_ADDRESS',   // your web3 provider   providerOptions: {     web3Instance: YOUR_WEB_PROVIDER,   }, });  console.log('result', balances);  // result [   {     contractAddress: '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984',     symbol: 'UNI',     decimals: 18,     name: 'Uniswap',     balance: '703.523279430449604142',   },   {     contractAddress: '0xde30da39c46104798bb5aa3fe8b9e0e1f348163f',     symbol: 'GTC',     decimals: 18,     name: 'Gitcoin',     balance: '400.606',   }, ];

Issues

Please raise any issues in the below link.

https://github.com/joshstevens19/ethereum-erc20-token-balances-multicall/issues

Thanks And Support

This package is brought to you by Josh Stevens. My aim is to be able to keep creating these awesome packages to help the Ethereum space grow with easier-to-use tools to allow the learning curve to get involved with blockchain development easier and making Ethereum ecosystem better. If you want to help with that vision and allow me to invest more time into creating cool packages or if this package has saved you a lot of development time donations are welcome, every little helps. By donating, you are supporting me to be able to maintain existing packages, extend existing packages (as Ethereum matures), and allowing me to build more packages for Ethereum due to being able to invest more time into it. Thanks, everyone!

Direct donations

Direct donations any token accepted – Eth address > 0x699c2daD091ffcF18f3cd9E8495929CA3a64dFe1

Github sponsors

sponsor me via github using fiat money


ethereum-erc20-token-balances-multicall - <a href=以太坊eth-erc20-token-balances-multicall”>ethereum-erc20-token-balances-multicall - <a href=以太坊eth-erc20-token-balances-multicall”>

以太坊eth-erc20-token-balances-multicall

此库将在1次JSONRPC调用中获取所需的所有令牌余额。这解决了当您试图显示大量资产的余额时加载时间过长的问题,并降低了JSONRPC请求限制。它还降低了令牌的元数据,即小数位、名称、符号和余额。如果您将其与50个单独的JSONRPC调用进行比较,这将返回光速,这将使光速降低约50倍

这使用以太坊eth多呼叫,这是一个轻量级库,用于与多呼叫智能合约交互

请在下面的链接中提出任何问题

npm:

  • 主网
  • 科万
  • 格尔利
  • 林克比
  • ropsten
  • binance智能链
  • xdai
  • matic
  • mumbai

Github赞助商

npm:

$ npm install ethereum-erc20-token-balances-multicall

yarn:

$ yarn add ethereum-erc20-token-balances-multicall

Usage

Ethers

import { getBalances } from 'ethereum-erc20-token-balances-multicall';  const balances = await getBalances({   // erc20 tokens you want to query!   contractAddresses: [     '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984',     '0xde30da39c46104798bb5aa3fe8b9e0e1f348163f',     // unlimited amount you can keep adding and adding     // you can also build up easily through the code as well   ],   // ethereum address of the user you want to get the balances for   ethereumAddress: 'THE_ETHEREUM_ADDRESS',   // your ethers provider   providerOptions: {     ethersProvider: YOUR_ETHERS_PROVIDER,   }, });  console.log('result', balances);  // result [   {     contractAddress: '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984',     symbol: 'UNI',     decimals: 18,     name: 'Uniswap',     balance: '703.523279430449604142',   },   {     contractAddress: '0xde30da39c46104798bb5aa3fe8b9e0e1f348163f',     symbol: 'GTC',     decimals: 18,     name: 'Gitcoin',     balance: '400.606',   }, ];

Web3

import { getBalances } from 'ethereum-erc20-token-balances-multicall';  const balances = await getBalances({   // erc20 tokens you want to query!   contractAddresses: [     '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984',     '0xde30da39c46104798bb5aa3fe8b9e0e1f348163f',     // unlimited amount you can keep adding and adding     // you can also build up easily through the code as well   ],   // ethereum address of the user you want to get the balances for   ethereumAddress: 'THE_ETHEREUM_ADDRESS',   // your web3 provider   providerOptions: {     web3Instance: YOUR_WEB_PROVIDER,   }, });  console.log('result', balances);  // result [   {     contractAddress: '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984',     symbol: 'UNI',     decimals: 18,     name: 'Uniswap',     balance: '703.523279430449604142',   },   {     contractAddress: '0xde30da39c46104798bb5aa3fe8b9e0e1f348163f',     symbol: 'GTC',     decimals: 18,     name: 'Gitcoin',     balance: '400.606',   }, ];

Issues

https://github.com/joshstevens19/ethereum-erc20-token-balances-multicall/issues

这个包裹是Josh Stevens带给你的。我的目标是能够继续创建这些令人敬畏的软件包,以帮助以太坊eth空间的发展,并使用更易于使用的工具,让学习曲线更容易地参与区块链blockchain开发,使以太坊eth生态系统变得更好。如果您希望帮助实现这一愿景,并允许我投入更多的时间来创建酷包,或者如果这个包为您节省了大量的开发时间,欢迎捐款,每一点都有帮助。通过捐赠,您支持我维护现有软件包,扩展现有软件包(随着以太坊eth的成熟),并允许我为以太坊eth构建更多软件包,因为我可以在其中投入更多时间。谢谢大家

Thanks And Support

直接捐赠任何接受的代币-Eth地址&gt;0x699c2daD091ffcF18f3cd9E8495929CA3a64dFe1

Direct donations

使用法定货币通过github赞助我

Github sponsors

sponsor me via github using fiat money

部分转自网络,侵权联系删除区块链源码网

www.interchains.cc

https://www.interchains.cc/23696.html

区块链毕设网(www.interchains.cc)全网最靠谱的原创区块链毕设代做网站 部分资料来自网络,侵权联系删除! 最全最大的区块链源码站 ! QQ3039046426
区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » 基于区块链的毕业设计ethereum-erc20-token-balances-multicall – 以太坊-erc20-token-balances-multicall

提供最优质的资源集合

立即查看 了解详情