Supported chains in @okxweb3/coin-base
mainThe @okxweb3/coin-base package provides common functionality for the following chains and coins:
- Bitcoins
- Ethereum
- Aptos
- Near
- Starknet
- Sui
- Zkspace
- Cosmos
- Eos
- Flow
- Polkadot
- Solana
- Stacks
- Tron
repository·main·Indexed 18 days ago
https://github.com/okx/js-wallet-sdkA TypeScript/JavaScript solution for building multi-chain wallet applications. The SDK enables offline transaction signing, account management, and support for various blockchain protocols. It includes specialized packages such as @okxweb3/coin-base for core cryptographic functions and MPC/Hardware wallet workflows, @okxweb3/coin-bitcoin for Bitcoin-based standards including BRC-20, Doginals, and Runes, and @okxweb3/coin-aptos for Aptos blockchain operations including smart contract interactions and NFT operations.
The @okxweb3/coin-base package provides common functionality for the following chains and coins:
The @okxweb3/coin-bitcoin SDK supports the following chains:
@okxweb3/coin-aptos package provides specialized tools for interacting with the Aptos blockchain. It allows developers to perform key operations such as generating private keys and addresses, verifying addresses, and executing transfers (both native APTOS and token-based) as well as interacting with DEX contracts.The @okxweb3/coin-cosmos SDK supports a wide range of Cosmos ecosystem chains, including:
The @okxweb3/coin-bitcoin SDK supports the following chains:
The SDK supports specialized transaction patterns:
Enable withFeePayer: true in the base object to allow a third party to pay for gas.
Use type: "dapp" with a specific type: 3 in the data object to sign transactions containing bytecode and functionArguments.
For transactions requiring multiple signers, include secondarySignerAddresses (an array of addresses) in the base object.
// Multi-agent transaction example
let res = await wallet.signTransaction({
privateKey: "",
data: {
"type": "dapp",
"base": {
"expirationTimestampSecs": 1817258177,
"sequenceNumber": "42",
"chainId": 2,
"gasUnitPrice": "100",
"maxGasAmount": "8000",
"reserveFeeRatio": "1.1",
"sender": "0x986d10e6ffde60518ab0664f70339196f914f96255f31a1c6b226670c73d3f92",
"secondarySignerAddresses": ["0x79b2d1f85c5d644b2f1c24e435ea80d72ae8c800a4ed5e0b01a7f40445c37b2d", "0x318717be403fefbed1e1cd2567a215514c524d0f315b743d664abb137d9ed8ae"]
},
"data": {
data:{
bytecode: multiSignerScriptBytecode,
functionArguments: funcParam,
},
type:"3",
}
},
});The SDK is designed with an extensible three-tier architecture:
crypto-lib: The foundation layer that manages general security and signature algorithms.coin-base: The abstraction layer that defines a common interface used by all supported coins to ensure consistency.coin-specific packages: The implementation layer where the unique transaction creation and signing logic for each specific blockchain (e.g., Ethereum, Bitcoin, Solana) resides.The WaxWallet class is the primary interface for interacting with the EOS and WAX blockchains. It provides methods for key management, address derivation, and transaction signing.
import { WaxWallet } from "@okxweb3/coin-eos";
let wallet = new WaxWallet();The primary entry point for the EOS SDK is the WaxWallet class. It provides methods for key management, address derivation, and transaction signing for both EOS and WAX chains.
import { WaxWallet } from "@okxweb3/coin-eos";
let wallet = new WaxWallet();To use the Solana SDK for interacting with the Solana ecosystem, install the @okxweb3/coin-solana package via npm.
npm install @okxweb3/coin-solananpm install to install all required dependencies.npm installFor hardware wallet integration, the process is split into two steps: building a raw transaction and then building the final signed transaction using the signature components (r, s, v) provided by the device.
getHardWareRawTransaction(signParams) to get the unsigned transaction data.getHardWareSignedTransaction(hardwareRawTransactionParam) passing the raw transaction and the signature components.import { EthWallet } from "@okxweb3/coin-ethereum"
let wallet = new EthWallet();
// 1. Build raw transaction
let signParams = {
data: {
to: "0xee7c7f76795cd0cab3885fee6f2c50def89f48a3",
value: 1,
nonce: 5,
gasPrice: "100000000000",
gasLimit: 21000,
chainId: 42,
}
};
const rawTx = await wallet.getHardWareRawTransaction(signParams);
// 2. Build signed transaction
const hardwareRawTransactionParam = {
raw: rawTx,
r: r, // provided by hardware wallet
s: s, // provided by hardware wallet
v: v, // provided by hardware wallet
}
const signedTx = await wallet.getHardWareSignedTransaction(hardwareRawTransactionParam);