Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ethgate/ethgate

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ethgate/ethgate

Ethgate is a library for making batched calls to Ethereum compatible calls.

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

Ethgate

Ethgate is a library for making batched calls to Ethereum compatible calls.

This library is very experimental. Even documented features might not work.

Usage

import { Contract as EthersContract } from '@ethersproject/contracts';
import { InfuraProvider as EthersInfuraProvider } from '@ethersproject/providers';
import { EthgateChain } from 'ethgate';

const ethersMainnetProvider = new EthersInfuraProvider('homestead');

const mainnet = new EthgateChain(ethersMainnetProvider, 1);

const ensRegistryContract = new EthersContract(
  '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e',
  ensRegistryContractInterface,
);

const names = ['resolver.eth', 'cardpunks.eth', 'alicanc.eth'];

const results = await Promise.all(
  names.map(async (name) => {
    const namehash = hashEnsName(name);

    const [recordExists, owner, resolver] = await Promise.all([
      mainnet.call(ensRegistryContract, 'recordExists(bytes32)', [namehash]),
      mainnet.call(ensRegistryContract, 'owner(bytes32)', [namehash]),
      mainnet.call(ensRegistryContract, 'resolver(bytes32)', [namehash]),
    ]);

    return { recordExists, owner, resolver };
  }),
);

// You now have the results and only one RPC call has been made!

FAQs

Package last updated on 28 Aug 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc