GitXplorerGitXplorer
o

js-wallet-sdk

public
201 stars
72 forks
5 issues

Commits

List of commits on branch main.
Verified
773f313f4606352f4a889d097f34706006958e35

Merge pull request #131 from okx/update_doc

ddebuggor committed 2 days ago
Unverified
f5d7fde19a2496907c47c4255a1a99dbb5e96446

Update docs

kkaijiel24 committed 2 days ago
Verified
594fa2854b62f2958a2ea8acd27750de6d267161

Merge pull request #123 from okx/up_readme

yyanminmin committed 16 days ago
Unverified
19f7db3efeaecfffb43b2e0d5d13dcaf3c284f92

Update main readme

committed 16 days ago
Verified
9b1549b598b9bae3fa4bdfdb954ab831489f2e68

Merge pull request #122 from okx/up_readme

ddebuggor committed 16 days ago
Unverified
be20a0b15992306833cdabab0e44e051fc5d994a

Update main readme

committed 16 days ago

README

The README file for this repository.

OKX Web3 JS Wallet SDK

npm version License

OKX Web3 Wallet SDK is a comprehensive TypeScript/JavaScript solution for building wallet applications that support offline transactions across multiple blockchain networks. This SDK provides a unified interface for account management, transaction creation, and signing for various mainstream public blockchains.

Features

  • Multi-chain support
  • Offline transaction signing
  • Account generation and management
  • Customizable transaction creation
  • BRC20/Atomical/Runes.. support for Bitcoin
  • Extensible architecture

Documentation

For detailed documentation and API references, please visit our online documentation.

Online Demo

Try our online signing demo to see the SDK in action.

Supported Chains

Package Generate Address Sign Transaction Sign Message Version
@okxweb3/coin-bitcoin npm
@okxweb3/coin-ethereum npm
@okxweb3/coin-aptos npm
@okxweb3/coin-cosmos npm
@okxweb3/coin-eos npm
@okxweb3/coin-stacks npm
@okxweb3/coin-starknet npm
@okxweb3/coin-sui npm
@okxweb3/coin-near npm
@okxweb3/coin-tron npm
@okxweb3/coin-ton npm
@okxweb3/coin-cardano npm
@okxweb3/coin-solana npm
@okxweb3/coin-kaspa npm

*Note: Bitcoin support includes core functions for BRC20 ,Atomicals and Runes protocols, such as deployment, minting, transfer, and trading. This covers inscription creation, buying, selling, and other advanced operations across these Bitcoin-based token standards.

Architecture

The OKX Web3 Wallet SDK is composed of three main modules:

  1. crypto-lib: Handles general security and signature algorithms.
  2. coin-base: Provides a common interface for all supported coins.
  3. coin-specific packages: Implement transaction creation and signing for each supported blockchain.

Installation

To use the OKX Web3 Wallet SDK, install the core packages and the specific coin packages you need:

# Core packages (required for all coins)
npm install @okxweb3/crypto-lib
npm install @okxweb3/coin-base

# coin-specific packages (install as needed)

npm install @okxweb3/coin-ethereum
npm install @okxweb3/coin-bitcoin

# ... other coin packages

Build Locally

To build the SDK locally and run tests:

git clone https://github.com/okx/js-wallet-sdk.git
cd js-wallet-sdk
sh build.sh

Usage

Here's a basic example of how to use the SDK with Ethereum:

const { EthWallet } = require('@okxweb3/coin-ethereum');
const privateKey = "your_private_key_here";

async function run() {
    const wallet = new EthWallet();
    let params = {
        privateKey: privateKey
    };
    let address = await wallet.getNewAddress(params);
    console.log('Ethereum address:', address);

    let ethTxParams = {
        to: "0xee7c7f76795cd0cab3885fee6f2c50def89f48a3",
        value: 1,
        nonce: 5,
        gasPrice: "100000000000",
        gasLimit: 21000,
        chainId: 42,
    };
    let signParams = {
        privateKey: privateKey,
        data: ethTxParams
    };
    let tx = await wallet.signTransaction(signParams);
    console.log('Signed transaction:', tx);
}

run();

For more detailed examples and usage instructions for each supported blockchain, please refer to the documentation in the respective coin-specific package.

Feedback and Support

We encourage everyone to use our online demo and documentation. If you encounter any issues or have suggestions, please submit them through GitHub Issues.

Security

If you find security risks, it is recommended to feedback through the following channels and get your reward! submit on HackerOne platform https://hackerone.com/okg Or on our OKX feedback submission page > security bugs https://www.okx.com/feedback/submit

License

The OKX Web3 Wallet SDK is open-sourced software licensed under the MIT license.