1.0.70 • Published 9 months ago

debeem-wallet v1.0.70

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

debeem-wallet

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

Table of contents

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

flowchart TD

    id([debeem-id])
    cipher([debeem-cipher])
    ethers([ethers])
    idb([idb])

    ethers -. «extend» .-> root
    id -. «extend» .-> root
    cipher -. «extend» .-> root
    idb -. «extend» .-> root

    subgraph debeem-wallet
        root([debeem-wallet])

        config(Config)
        walletServices(Wallet Services)
        storageServices(Storage Services)
        chainService(Chain Service)
        tokenService(Token Service)
        root --- config
        root --- walletServices
        root --- storageServices
        root --- chainService
        root --- tokenService

        %% wallet service list
        walletServiceList["WalletFactory
            WalletAccount
            WalletTransaction
            WalletNFT"]
        walletServices --- walletServiceList

        %% storage service list
        encryptedStorageServices(Encrypted Storage Services)
        storageServicesList["SysUserStorageService
            BasicStorageService
            ChainStorageService
            TokenStorageService
            WalletStorageService"]
        storageServices --- encryptedStorageServices
        encryptedStorageServices --- storageServicesList

        %% chain service list
        tokenServiceList["TokenService"]
        tokenService --- tokenServiceList

        %% token service list
        chainServiceList["ChainService"]
        chainService --- chainServiceList

    end

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

FunctionInvocationsStorageDescription
getDefaultChainsyncmemoryget default chainId from memory
getCurrentChainsyncmemoryget current chainId from memory
setCurrentChainsyncmemoryset/update current chainId to memory
revertToDefaultChainsyncmemoryrevert the current chain to the default value in memory
getCurrentChainAsyncasyncdatabaseasynchronously get current chainId from the database
putCurrentChainAsyncasyncdatabaseasynchronously set/update current chainId into the database
revertToDefaultChainAsyncasyncdatabaseasynchronously revert the current chain to the default value and save it into the database

2, Wallet Configuration

FunctionInvocationsStorageDescription
getCurrentWalletAsyncasyncdatabaseasynchronously get current wallet from the database
putCurrentWalletAsyncasyncdatabaseasynchronously put current wallet into the database
initWalletAsyncasyncdatabaseasynchronously 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

ClassDescription
WalletFactorycreate a new wallet, or import a wallet from a mnemonic, keystore, private key or a wallet address
WalletAccountquery balance, calculate total value, and request quotes in real-time for the Ethereum native token or any derivative tokens
WalletTransactionsend and receive your Ethereum native token or any derivative tokens, estimate transaction gas fee, and query transaction history, details and receipt
WalletNFTquery NFTs information

Storage Services

ClassDescription
SysUserStorageServicemanage encryption information table and modify PIN code
BasicStorageServicesimple storage based on key-value
ChainStorageServiceget the default supported chain list, get information of a chain, add, delete and update the information of a chain
TokenStorageServicemanage tokens of a wallet on a specified chain. get the token list, add, delete and update the token information
WalletStorageServicebased on secure encryption, obtain information of a wallet, add, delete and update a wallet

Chain Service

ClassDescription
ChainServicecheck whether a chain exists and obtain the chain information by chain id.

Token Service

ClassDescription
TokenServicecheck 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

Documentation

API Docs

License

1.0.70

9 months ago

1.0.69

9 months ago

1.0.68

9 months ago

1.0.66

10 months ago

1.0.67

9 months ago

1.0.65

11 months ago

1.0.64

11 months ago

1.0.63

11 months ago

1.0.62

11 months ago

1.0.61

11 months ago

1.0.49

1 year ago

1.0.51

1 year ago

1.0.50

1 year ago

1.0.60

1 year ago

1.0.55

1 year ago

1.0.54

1 year ago

1.0.53

1 year ago

1.0.52

1 year ago

1.0.59

1 year ago

1.0.48

1 year ago

1.0.58

1 year ago

1.0.47

1 year ago

1.0.57

1 year ago

1.0.46

1 year ago

1.0.56

1 year ago

1.0.44

1 year ago

1.0.43

1 year ago

1.0.45

1 year ago

1.0.41

1 year ago

1.0.40

1 year ago

1.0.39

1 year ago

1.0.38

1 year ago