A complete, compact, and simple Ethereum wallet library based on the ethers
library.
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
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
npm i debeem-wallet
to fix issue: Module not found: Error: Can't resolve 'fake-indexeddb/auto'
npm i -D fake-indexeddb
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/
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 |
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. |
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 |
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 |
Class | Description |
---|---|
ChainService | check whether a chain exists and obtain the chain information by chain id. |
Class | Description |
---|---|
TokenService | check whether a token exists and obtain the token information by contract address. |
Class | Description |
---|---|
TokenService | check whether a token exists and obtain the token information by contract address. |
This project has complete unit tests with an average coverage of over 90%. Run the unit tests in the project root directory:
jest