UNPKG

@iam4x/bsc-scan

Version:

An efficient BNB and token balance scanner

10 lines 919 B
import{fromHex}from"@findeth/abi";import EIP1193Provider from"./eip-1193";import EthersProvider from"./ethers";import HttpProvider from"./http";import Web3Provider from"./web3";const providers=[EIP1193Provider,EthersProvider,HttpProvider,Web3Provider];/** * Send a call with the data, using the specified provider. If the provider is not a valid provider type (e.g. not a * Ethers.js provider, URL or Web3 provider), this will throw an error. * * @param {ProviderLike} providerLike * @param {string} contractAddress * @param {string} data * @return {Promise<Uint8Array>} */export const call=async(a,b,c)=>{const d=providers.find(b=>b.isProvider(a));if(!d)throw new Error("Invalid provider type");try{const e=await d.call(a,b,c);return fromHex(e)}catch(a){var e;throw new Error(`Failed to get data from eth-scan contract: ${null!==(e=a.stack)&&void 0!==e?e:a.toString()}`)}}; //# sourceMappingURL=provider.js.map