Socket
Book a DemoInstallSign in
Socket

@getsafle/transaction-controller

Package Overview
Dependencies
Maintainers
3
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@getsafle/transaction-controller

Getsafle transaction controller

latest
Source
npmnpm
Version
1.9.3
Version published
Weekly downloads
2
Maintainers
3
Weekly downloads
 
Created
Source

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

FAQs

Package last updated on 28 Mar 2023

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