0.0.1-23 • Published 9 months ago

@uniblock/uniblocksdk v0.0.1-23

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

Uniblock-sdk-blockchain

Uniblock-sdk-blockchain is Uniblock's premier SDK of which includes different blockchain functions including; balance, nft, chart, token endpoints and more...

General Overview

A blockchain API SDK is a software development kit that enables developers to create applications that integrate with blockchain technology. It is used to interact with blockchains, such as Ethereum, and more. The API SDK provides APIs for building applications that access the blockchain, enabling developers to write applications that interact with the blockchain, such as creating wallets, getting data about sending and receiving transactions, and more. By using an API SDK, developers can easily create applications that interact with blockchain, allowing developers to quickly create applications that can interact with the blockchain.

🚀 Quick Start

1. Installation

Install the pacakge with npm.

npm i @uniblock/uniblocksdk

or with yarn

yarn add @uniblock/uniblocksdk

Install the package with yarn link

Steps:

  1. git clone the SDK repository: https://github.com/Uniblock-dev/uniblock-sdk-blockchain.git
  2. Go to the root folder of the project and yarn install to install any dependencies
  3. Use yarn compile to compile the library
  4. Use the yarn link at the root folder to register this library in yarn
  5. use yarn link @uniblock/uniblockSDK to link the SDK library to your repo
  6. Done!

2. Initalize Uniblock

Import initializeUniblockSDK:

import { initializeUniblockSDK } from '@uniblock/uniblocksdk';

Initialize uniblockSDK:

const uniblockSDK = await initializeUniblockSDK(
  apiKey: API-X-KEY,
  {
    options...
  }
);

3. Call Uniblock Functions

You can call uniblockSDK methods to use our SDK:

const result = await uniblockSDK.balance(
  walletAddress,
  chainId,
  optionalParms,
  pagination,
);

Functions

Blockchain API Endpoints

Here is a list of all the functions that are supported by our blockchain API. | Function| Arguments| Description| | ----------------- |------------- | ----------------- | | balance | (walletAddress: string, chainId: number, optionalParms?: OptionalBalanceParams, pagination?: Pagination) | Get current balance records for a specified account, provided the account's wallet address.| | balanceHistorical | (walletAddress: string, chainId: number, timestamp: number, optionalParms?: OptionalBalanceParams, pagination?: Pagination) | Get historical balance records for a specified account, provided the account's wallet address and a timestamp. | | transaction | (walletAddress: string, chainId: number, optionalParms?: OptionalTransactionParams, pagination?: Pagination) | Gets transaction records for a specified user, provided the user's wallet address. | | getTransactionByHash | (chainId: number, hash: string) | Gets transaction information, provided a transaction hash. | | getTransactionByHashDetailed | (chainId: number, hash: string) | Gets detailed transaction information, provided a transaction hash. | | tokenTransfer | (walletAddress: string, chainId: number, optionalParams?: OptionalTokenTransferParams, pagination?: Pagination) | Gets token transfer records for a specified user, the user's wallet address. | | nftTransfer | (walletAddress: string, chainId: number, optionalParams: OptionalNftTransferParams, pagination?: Pagination) | Gets NFT transfer records for a specified user, provided user's wallet address. | | price | (address: string, chainId: number) | Gets the current price of a token, provided the address of the desired token and the network the token resides on. | | priceHistoryDate | (address: string, chainId: number, startDate: number, endDate: number) | Gets the current price of a token, provided the address of the desired token and the network the token resides on. | | priceHistoryPeriod | (address: string, chainId: number, period: string) | Gets the current price of a token, provided the address of the desired token and the network the token resides on.| | priceHistoryBlock | (address: string, chainId: number, startBlock: number, endBlock: number) | Gets the current price of a token, provided the address of the desired token and the network the token resides on.| | nft | (walletAddress: string, chainId: number, optionalParams?: OptionalNftParams, pagination?: Pagination) | Gets the NFT balance of a specific user from all supported networks. If a network is specified, the NFT balance of that particular network will only be returned.| | nftHistorical | (walletAddress: string, chainId: number, timestamp: number, optionalParams?: OptionalNftParams, pagination?: NftPagination) | Gets the NFT balance of a specific user from all supported networks at a certain point in time. If a network is specified, the NFT balance of that particular network will only be returned.| | nftCollections | (walletAddress: string, chainId: number, optionalParams?: OptionalCollectionsParams, pagination?: NftPagination) | Gets all NFT collections of a specific user from all supported networks. If a network is specified, the NFT collections of that particular network will only be returned.| | nftInfo | (chainId: number, nftAddress: string, nftId: string) | Gets information of a specific NFT | | nftMetadata | (chainId: number, nftAddress: string, nftId: string) | Updates the NFT metadata of a single NFT | | nftOwner | (chainId: number, nftAddress: string, nftId: string) | Gets the owner of a particular nft | | chartDate | (address: string, chainId: number, startDate: number, endDate: number) | Get the net worth chart of all tokens the user owned between two dates | | chartPeriod | (address: string, chainId: number, period: string) | Get the net worth chart of all tokens the user owned given a period | | chartBlock | (address: string, chainId: number, startBlock: number, endBlock: number) | Get the net worth chart of all tokens the user owned between two blocks. | | log | (address: string, chainId: number, optionalParams?: OptionalLogParams) | Gets logs of a contract. | | getNativeBalance | (address: string, chainId: number) | Gets the native token balance of an address, provided the user's wallet address and a specific network (chainId).| | getNativeBalanceAt | (address: string, chainId: number, blockNumber: number) | Gets the user balance of a native token at any given block, provided the user's wallet address and a specific network (chainId). | | getDecimals | (address: string, chainId: number) | Gets the number of decimal places used by an ERC-20 token, provided a contract address and the network it resides on.| | getTokenBalance | (walletAddress: string, chainId: number, contractAddress: string) | Gets the balance of an ERC token, provided a contract address, specific network (chainId), and the token owner's wallet address.| | getSymbol | (address: string, chainId: number) | Gets the symbol for a given ERC-20 token, provided a contract address and the network it resides on.| | getTotalSupply | tokenAddress: string, chainId: number |Gets the total supply of an erc20 or erc721 token.| | getAllowance | (tokenAddress: string, chainId: number, owner: string, spender: string) | Gets the allowance token limit of a spender that wants to spender an owner address tokens.| | getApprovalForAll | (address: string, chainId: number, owner: string, spender: string) | Determines whether or not an spender address can transfer NFT of an owner address. | | ensResolveName | (domain: string, chainId: number) | Resolves the ens domain to get the address | | ensLookupName | (address: string, chainId: number) | Looks up the ens domain for a crypto addresse if there is any domain bound with the address. | | getBlockNumberFromTimestamp | (chainId: number, timestamp: number) | Gets the block number closest to the timestamp, provided a numerical timestamp and a specific network (chainId).| | getBlockTimestamp | (chainId: number, blockNumber: number) | Gets a numerical timestamp, provided a block number and a specific network (chainId).| | getBlockNumber | (chainId: number) | Gets the current block number, provided a specific network (chainId). | | getBlock | (chainId: number, blockNumber: number) | Gets a block, provided a block number and a specific network (chainId). | | getBlockDetailed | (chainId: number, blockNumber: number) | Gets detailed block information, provided a block number and chain ID. | | getBlockWithTransactions | (chainId: number, blockNumber: number) | Gets a block with transactions, provided a block number and a specific network (chainId). | | createWallet | () | Creates and gets a new wallet with a random private key, generated from cryptographically secure entropy sources. | | generateMnemonic | () | Generates a random mnemonic (uses crypto.randomBytes under the hood), defaults to 128-bits of entropy | | fromMnemonic | (mnemonic: string, optionalParams?: OptionalMnemonicParams) | Generates a wallet from a mnemonic phrase and index. If no index is provided, it will default to 0. | | getGasPrice | (chainId: number) | Gets the best estimate for gas price to use in a transaction, provided a specific network (chainId). | | getCode | (address: string, chainId: number) | Gets the code at a given address and network (chainId). This code can be used to distinguish between contract addresses and wallet addresses. Contract addresses return bytecode whereas wallet addresses return "0x".| | commify | (value: number) | Gets a string grouped by three digits separated by comma(s). | | formatUnits | (unit: string, value: string) | Gets a string representation of a given value formatted with unit digits. | | formatEther | (value: string) | Gets a string representation of a given value in terms of ether. | | parseUnits | (unit: string, value: string) | Gets a string representation of value, parsed with unit digits. | | parseEther | (value: string) | Gets a string representation of a given value, parsed with 18 digits (in terms of wei). | | convertUnits | (address: string, chainId: number, direction: string, value: string) | Gets the converted value (decimal units to number or number to decimal units) of a specified amount of a token.|

Help

Check out our docs for more information:

🏠Community

0.0.1-23

9 months ago

0.0.1-22

9 months ago

0.0.1-19

1 year ago

0.0.1-21

1 year ago

0.0.1-20

1 year ago

0.0.1-18

1 year ago

0.0.1-3

1 year ago

0.0.1-2

1 year ago

0.0.1-7

1 year ago

0.0.1-6

1 year ago

0.0.1-5

1 year ago

0.0.1-4

1 year ago

0.0.1-10

1 year ago

0.0.1-12

1 year ago

0.0.1-11

1 year ago

0.0.1-14

1 year ago

0.0.1-9

1 year ago

0.0.1-13

1 year ago

0.0.1-8

1 year ago

0.0.1-16

1 year ago

0.0.1-15

1 year ago

0.0.1-17

1 year ago

0.0.1-1

1 year ago

0.0.1-0

1 year ago