Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@abstraxn/node-client

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@abstraxn/node-client

Node Client that comminucates with indexer service to fetch necessary details for the Smart Account

  • 0.0.4
  • npm
  • Socket score

Version published
Weekly downloads
22
increased by100%
Maintainers
2
Weekly downloads
 
Created
Source

@abstraxn/node-client

Abstraxn SDK Node Client

Node Client is the api client package that communicate with [Abstraxn SDK] backend node to fetch needed smart contract wallet data i.e supported chains list, transaction history, balances e.t.c

Installation

yarn add @abstraxn/node-client

OR

npm install @abstraxn/node-client

Usage

// import package
import NodeClient from '@abstraxn/node-client'

// initialisation

const nodeClient = new NodeClient({ txServiceUrl: '' })

Fetch Supported Chains List

const supportedChainsList = await nodeClient.getAllSupportedChains()
console.log('supportedChainsList ', supportedChainsList)

Fetch Transactions By Address

const chainId = 80001
const address = '0xabc......'
const trxHistory = await nodeClient.getTransactionByAddress(chainId, address)
console.log('trxHistory ', trxHistory)

Get Transaction By Hash

const txHash = '0x........'
const trxDetail = await nodeClient.getTransactionByHash(txHash)
console.log('trxDetail ', trxDetail)

Get Smart Contract Wallet Balances

import { BalancesDto } from '@abstraxn/node-client'

import { ChainId } from '@abstraxn/core-types'

const address = '0xabc......'

const balanceParams: BalancesDto =
      {
          // if no chainId is supplied, SDK will automatically pick active one that
         //  is being supplied for initialization

        chainId: ChainId.MAINNET, // chainId of your choice
        address: address,
        // If empty string you receive balances of all tokens watched by Indexer
        // you can only whitelist token addresses that are listed in token respository
        // specified above ^
        tokenAddresses: [],
      };

const balFromSdk = await nodeClient.getAllTokenBalances(balanceParams);
console.info("balFromSdk ", balFromSdk);

const usdBalFromSdk = await nodeClient.getTotalBalanceInUsd(balanceParams);
console.info("usdBalFromSdk ", usdBalFromSdk)

Keywords

FAQs

Package last updated on 02 Jan 2024

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc