debeem-wallet

debeem-wallet - v1.0.70

What is debeem-wallet?

A complete, compact, and simple Ethereum wallet library based on the ethers library.

Features

  1. Easy to use, whether you have experience in Ethereum wallet development or not, you can easily get started.
  2. Provides complete functions such as creation, import, and backup of Ethereum wallets.
  3. Provides balance query, total value statistics, and real-time trading pair quotes for Ethereum native token and derivative tokens.
  4. Provides transfer, real-time transaction gas fee estimating, transaction history query, transaction details query, and transaction receipt query functions for Ethereum native token and derivative tokens.
  5. Provides information query for Ethereum native token and derivative tokens.
  6. Provides network information query by chainId.
  7. Provide local structured data storage based on AES256 encryption algorithm, and the password can be modified at will.

Architecture

UML Graph

UML Graph

Dependency Packages

Installation

1, install nvm

use the following cURL or Wget command to install nvm:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash

2, install node

install the latest LTS version of node, for example: v18.20.3 (Latest LTS: Hydrogen)

nvm install v18.20.3
nvm use v18.20.3

3, install our package

npm i debeem-wallet

to fix issue: Module not found: Error: Can't resolve 'fake-indexeddb/auto'

npm i -D fake-indexeddb

Configuration

About chain

There are many chains in the entire blockchain world, such as the Bitcoin chain, Ethereum chain, etc. Every wallet MUST work on a certain chain (or call it a network).

So, before using any functions or classes in this development package, you MUST first configure a chain/network for your wallet.

View all chains on:
https://chainlist.org/

Configurations

1, Chain Configuration

Function Invocations Storage Description
getDefaultChain sync memory get default chainId from memory
getCurrentChain sync memory get current chainId from memory
setCurrentChain sync memory set/update current chainId to memory
revertToDefaultChain sync memory revert the current chain to the default value in memory
getCurrentChainAsync async database asynchronously get current chainId from the database
putCurrentChainAsync async database asynchronously set/update current chainId into the database
revertToDefaultChainAsync async database asynchronously revert the current chain to the default value and save it into the database

2, Wallet Configuration

Function Invocations Storage Description
getCurrentWalletAsync async database asynchronously get current wallet from the database
putCurrentWalletAsync async database asynchronously put current wallet into the database
initWalletAsync async database asynchronously create or recover an account. For detailed usage instructions, please refer to the unit tests: config.test.ts, SysUserStorageService.test.ts, WalletStorageService.test.ts.

Usage

Wallet Services

Class Description
WalletFactory create a new wallet, or import a wallet from a mnemonic, keystore, private key or a wallet address
WalletAccount query balance, calculate total value, and request quotes in real-time for the Ethereum native token or any derivative tokens
WalletTransaction send and receive your Ethereum native token or any derivative tokens, estimate transaction gas fee, and query transaction history, details and receipt
WalletNFT query NFTs information

Storage Services

Class Description
SysUserStorageService manage encryption information table and modify PIN code
BasicStorageService simple storage based on key-value
ChainStorageService get the default supported chain list, get information of a chain, add, delete and update the information of a chain
TokenStorageService manage tokens of a wallet on a specified chain. get the token list, add, delete and update the token information
WalletStorageService based on secure encryption, obtain information of a wallet, add, delete and update a wallet

Chain Service

Class Description
ChainService check whether a chain exists and obtain the chain information by chain id.

Token Service

Class Description
TokenService check whether a token exists and obtain the token information by contract address.

Token Service

Class Description
TokenService check whether a token exists and obtain the token information by contract address.

Unit Tests

This project has complete unit tests with an average coverage of over 90%. Run the unit tests in the project root directory:

jest

License