kotani-evm
TypeScript icon, indicating that this package has built-in type declarations

1.1.2 • Public • Published

KOTANI PAY EVM PACKAGE

🚀 Npm package to hold all reusable functions for EVM compatible chains ⚒️

Installation

yarn add kotani-evm  or 

npm install kotani-evm

GET BALANCE

const kotaniEvm = require('kotani-evm');

const config = {
    CHAIN: 'eg: CELO, POLYGON, ETHEREUM, BINANCE, ARBITRAM, AVALANCHE, OPTIMISM','COSMOS'
    ENVIRONMENT: 'eg: TESTNET, MAINNET',
    TOKEN_TYPE: 'eg: CUSD, USDC, USDT, BUSD',
};

const evm = new kotaniEvm.Evm(config)
/**
 * @param accountAddress 
 * */ 
await evm.getBalance(
    '0x278c43C0cdE777DF8fAA921F7aB2fb235A699B93'
);

SEND TOKEN

const payload = {
    recipientAddress: '0x278c43C0cdE777DF8fAA921F7aB2fb235A699B93',
    amount: 0.00001,
    privateKey:
    '29fd8128fc45a67f1c5db331b2f14c45c399ec9b9180a73d37b60c1a99d37ec7',
};

await evm.sendToken(payload);

CREATE ACCOUNT

await evm.createAccount();

VALIDATE TRANSACTION

/**
 * @param txHash - transaction hash of the transaction
 * */ 
await evm.validateTx('0x19c68b1c8f1fcbca024dc29628d4723864fee9b060bbb97cbe492a33ae67e963');

ESTIMATE GAS

const payload = {
    privateKey:
    '29fd8128fc45a67f1c5db331b2f14c45c399ec9b9180a73d37b60c1a99d37ec7',
};

  /**
   * @param {privateKey} - privateKey is an optional param
   * @return {string} - gasEstimation 
  */
await evm.estimateGas(payload);

GET NATIVE TOKEN BALANCE

 /**
   * @param {string} accountAddress - account address of the user
   * @param {string} rpcUrl - rpc url to connect to the blockchain
   * @returns {string} tokenBalance
   *
   */
await testClient.getNativeBalance(
        '0x278c43C0cdE777DF8fAA921F7aB2fb235A699B93',
        'https://alfajores-forno.celo-testnet.org'
    );

Readme

Keywords

none

Package Sidebar

Install

npm i kotani-evm

Weekly Downloads

1

Version

1.1.2

License

ISC

Unpacked Size

65.6 kB

Total Files

51

Last publish

Collaborators

  • alphonce-mutebi