@getsafle/transaction-controller

1.9.3 • Public • Published

Safle Transactions Controller

This SDK returns the list of all the transactions done by a particular address. The transactions include both incoming and outgoing transactions. Also provided is a functionality to convert the unreadable EVM transaction data to human readable one.

Installation

To install this SDK,

npm install --save @getsafle/transactions-controller

Initialization

Initialize the constructor,

const safleTransactionsController = require('@getsafle/transactions-controller');

const transactionsController = new safleTransactionsController.TransactionController();

Get incoming transactions


This function returns the list of all the incoming transactions.

const incomingTransactions= await transactionsController.getIncomingTransactions({ address, fromBlock, network, apiKey });
  • address - user wallet public address,
  • fromBlock - Start block number
  • network - ethereum network selected/ chain selected
  • apiKey - etherscan/polygonscan api key(based on the network selected)

Get outgoing transactions


This function returns the list of all the outgoing transactions.

const outgoingTransactions= await transactionsController.getOutgoingTransactions({ address, fromBlock, network, apiKey });
  • address - user wallet public address,
  • fromBlock - Start block number
  • network - ethereum network selected/ chain selected
  • apiKey - etherscan/polygonscan api key(based on the network selected)

Get all transactions


This function returns the list of all the transactions on an address (incoming + outgoing)

const transactions= await transactionsController.getTransactions({ address, fromBlock, network, apiKey });
  • address - user wallet public address,
  • fromBlock - Start block number
  • network - ethereum network selected/ chain selected
  • apiKey - etherscan/polygonscan api key(based on the network selected)

Analyze Transactions


This function accepts an EVM transaction hash and analyzes the transaction to output human readable values.

const result = await transactionsController.analyzeTransaction(transactionHash, rpcUrl, network);
  • transactionHash - The transaction hash for the transaction to be analyzed.
  • rpcUrl - RPC URL of the chain of the transaction hash passed.
  • network - Network to be used to query the safleId. valid inputs - mainnet or testnet

Get Transaction Type


This function returns the type of transaction based on the contract function called.

const transactionType = transactionsController.getTransactionType(functionInput, rpcUrl);
  • functionInput - The function name and the input parameter datatype in string format. eg. transfer(address, uint256).
  • rpcUrl - RPC URL of the chain of the transaction hash passed.

Chains supported

  • ethereum
  • polygon
  • bsc
  • bitcoin
  • avalanche

Readme

Keywords

none

Package Sidebar

Install

npm i @getsafle/transaction-controller

Weekly Downloads

2

Version

1.9.3

License

ISC

Unpacked Size

83.9 kB

Total Files

34

Last publish

Collaborators

  • subhanshugupta
  • apoorv31
  • shubham.3008
  • sidth