OneChain TypeScript SDK Quick Start
The OneChain TypeScript SDK is a modular library of tools for interacting with the OneChain blockchain. Use it to send queries to RPC nodes, build and sign transactions, and interact with a OneChain or local network.
Installation
Network locations
The following table lists the locations for OneChain networks.
Network | Full node | faucet |
---|---|---|
local | http://127.0.0.1:9000 (default) | http://127.0.0.1:9123/gas (default) |
Devnet | https://rpc-devnet.onelabs.cc:443 | https://rpc-devnet.onelabs.cc:443/gas |
Testnet | https://rpc-testnet.onelabs.cc:443 | https://rpc-testnet.onelabs.cc:443/gas |
Mainnet | https://rpc.mainnet.onelabs.cc:443 | null |
Use dedicated nodes/shared services rather than public endpoints for production apps. The public
endpoints maintained by OneChain Labs (rpc-.<NETWORK>.onelabs.cc:443
) are rate-limited, and support
only 100 requests per 30 seconds or so. Do not use public endpoints in production applications with
high traffic volume.
You can either run your own Full nodes, or outsource this to a professional infrastructure provider (preferred for apps that have high traffic). You can find a list of reliable RPC endpoint providers for OneChain on the OneChain Dev Portal using the Node Service tab.
Module packages
The SDK contains a set of modular packages that you can use independently or together. Import just what you need to keep your code light and compact.
@onelabs/sui/client
- A client for interacting with OneChain RPC nodes.@onelabs/sui/bcs
- A BCS builder with pre-defined types for OneChain.@onelabs/sui/transactions
- Utilities for building and interacting with transactions.@onelabs/sui/keypairs/*
- Modular exports for specific KeyPair implementations.@onelabs/sui/verify
- Methods for verifying transactions and messages.@onelabs/sui/cryptography
- Shared types and classes for cryptography.@onelabs/sui/multisig
- Utilities for working with multisig signatures.@onelabs/sui/utils
- Utilities for formatting and parsing various OneChain types.@onelabs/sui/faucet
- Methods for requesting OCT from a faucet.@onelabs/sui/zklogin
- Utilities for working with zkLogin.