1.1.2 ā€¢ Published 1 year ago

kotani-evm v1.1.2

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

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'
    );
1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago