ubiqscan-link
TypeScript icon, indicating that this package has built-in type declarations

2.1.1 • Public • Published

Ubiqscan Link Generator

Usage

const ubiqscanLink = require('ubiqscan-link')
const networkId = '8'
const chainId = '0x8'
const account = '0xFDEa65C8e26263F6d9A1B5de9555D2931A33b825'
const accountLink = ubiqscanLink.createAccountLink(account, networkId)
const accountLinkForChain = ubiqscanLink.createAccountLinkForChain(account, chainId)

const hash = '0xa7540793de6b6ca7d3c948a8cc0a163bf107f5535a69353162ea9dec7ee7beca'
const txLink = ubiqscanLink.createExplorerLink(hash, networkId)
const txtLinkForChain = ubiqscanLink.createExplorerLinkForChain(hash, chainId)

const token = '0xdac17f958d2ee523a2206206994597c13d831ec7'
const tokenTrackerLink = ubiqscanLink.createTokenTrackerLink(token, networkId)
// You can also track token balances by account
const accountTokenTrackerLink = ubiqscanLink.createTokenTrackerLink(token, networkId, account)

const accountTokenTrackerLinkForChain = ubiqscanLink.createTokenTrackerLinkForChain(token, chainId, account)

// Create urls for interacting with custom networks
const customNetworkUrl = 'https://customnetwork.com/'

const customtTokenTrackerLink = ubiqscanLink.createCustomTokenTrackerLink(token, customNetworkUrl)

const customAccountLink = ubiqscanLink.createCustomAccountLink(account, customNetworkUrl)

const customExplorerLink = ubiqscanLink.createCustomExplorerLink(hash, customNetworkUrl)

// Generate custom or native block explorer link based on rcpPrefs
const blockExplorerLink = ubiqscanLink.getBlockExplorerLink(transaction, rcpPrefs)

// Generate account link for custom or native network 
const getAccountLink = ubiqscanLink.getAccountLink(address, chainId, rpcPrefs, networkId)

// Generate token tracker link for custom or native network 
const tokenTrackerLink = ubiqscanLink.getTokenTrackerLink(tokenAddress, chainId, networkId, holderAddress, rpcPrefs)

Running tests

yarn test

Readme

Keywords

Package Sidebar

Install

npm i ubiqscan-link

Weekly Downloads

1

Version

2.1.1

License

ISC

Unpacked Size

21.6 kB

Total Files

25

Last publish

Collaborators

  • jyap808