New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

klaytn-multicall-use-kas

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
Package was removed
Sorry, it seems this package was removed from the registry

klaytn-multicall-use-kas

Gets multiple results with a single contract call

unpublished
latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

klaytn-multicall-use-kas

Gets multiple results with a single contract call

Installation

npm install klaytn-multicall-use-kas
yarn add klaytn-multicall-use-kas

API

  • .aggregate(calls): Excute calls in a single request
  • .getKlaytnBalanceMethod(address): return getEthBalance(address) method
  • .getKlaytnBalance(address): return klaytn balance in address
  • .getBlockHash(blockNumber): return blockHash
  • .getLastBlockHash(): return last block hash
  • .getCurrentBlockTimestamp(): return current block timestamp
  • .getCurrentBlockDifficulty(): return current block difficulty
  • .getCurrentBlockGasLimit(): return current block gas limit
  • .getCurrentBlockCoinbase(): return current block coinbase

Example

require("dotenv").config();

const { Provider } = require("./src");

const CaverExtKAS = require("caver-js-ext-kas");

const { CYPRESS_CHAIN_ID, ACCESS_KEY_ID, SECRET_ACCESS_KEY } = process.env;

const caver = new CaverExtKAS(
  CYPRESS_CHAIN_ID,
  ACCESS_KEY_ID,
  SECRET_ACCESS_KEY
);

const provider = new Provider(caver);
const erc20ABI = require("./abi/erc20");

const run = async () => {
  // Klay - KSP Liquidity Pool in KlaySwap
  const klaySwapAndKlayPoolAddress =
    "0x34cf46c21539e03deb26e4fa406618650766f3b9";

  const klaySwapProtocolContractAddress =
    "0xc6a2ad8cc6e4a7e08fc37cc5954be07d499e7654";

  const klaySwapProtocolContract = new caver.contract(
    erc20ABI,
    klaySwapProtocolContractAddress
  );

  const calls = [
    provider.getKlayBalanceMethod(klaySwapAndKlayPoolAddress),
    klaySwapProtocolContract.methods.balanceOf(klaySwapAndKlayPoolAddress),
  ];

  const [klayBalance, kspBalance] = await provider.aggregate(calls);

  console.log(`
  klayBalance: ${klayBalance.toString()}
  kspBalance: ${kspBalance.toString()}
  `);
};

run();

Test

npm run test

Keywords

caver

FAQs

Package last updated on 12 Mar 2022

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