WDK logoWDK documentation

RGB wallet API reference

API reference for the independently maintained @utexo/wdk-wallet-rgb module.

This page summarizes the public API exposed by @utexo/wdk-wallet-rgb based on the package README, package.json, generated TypeScript declarations, and source files from commit 6d28bc9.

This module is developed and maintained independently by a third-party contributor. Tether and the WDK team do not endorse or assume responsibility for its code, security, or maintenance. Review the package and use your own judgment before using it with real funds.

Package

FieldValue
Package@utexo/wdk-wallet-rgb
RepositoryUTEXO-Protocol/wdk-wallet-rgb
Main entryindex.js
Bare entrybare.js
Typestypes/index.d.ts

Exports

ExportDescription
defaultWalletManagerRgb
WalletAccountRgbFull RGB wallet account implementation
WalletAccountReadOnlyRgbRead-only RGB wallet account implementation
RgbWalletConfigRGB wallet configuration type
RgbTransactionNative BTC transaction shape for the RGB wallet
TransferOptionsRGB transfer options
RgbTransactionReceiptRGB transaction receipt type from @utexo/rgb-sdk
RgbTransferReceiptRGB transfer receipt type from @utexo/rgb-sdk

RgbWalletConfig

FieldRequiredDescription
networkYesTarget RGB network. Runtime source maps mainnet, testnet, testnet4, signet, utexo, and regtest; generated typedefs currently list mainnet, testnet, and regtest.
dataDirYesPersistent app-private path where RGB wallet state is stored. Losing this directory can lose RGB asset state.
keysNoDerived RGB wallet keys. The manager derives these from the seed before creating an account.
indexerUrlNoElectrs indexer URL.
transportEndpointNoRGB transport endpoint.
transferMaxFeeNoMaximum fee amount for transfer operations.

WalletManagerRgb

import WalletManagerRgb from '@utexo/wdk-wallet-rgb'

const manager = new WalletManagerRgb(seed, config)
MethodDescription
constructor(seed, config)Creates a manager from a BIP-39 seed phrase or seed bytes. network and dataDir are required in config.
getAccount(index = 0)Returns the RGB account. RGB supports only account index 0; other indexes throw.
restoreAccountFromBackup(restoreConfig)Restores account state from encrypted backup material.
getAccountByPath(path)Always throws because RGB does not support arbitrary BIP-44 account paths in this module.
getFeeRates()Fetches normal and fast Bitcoin fee rates from mempool.space.
dispose()Clears cached account and key material from the manager.

WalletAccountRgb

Method or propertyDescription
static at(seed, config)Creates a full RGB wallet account.
static fromBackup(seed, config)Creates an account from encrypted backup material.
indexAccount index.
pathWDK-compatible path representation for the RGB account.
coloredPathRGB colored-account path representation.
keyPairPublic key material and RGB-specific extended public keys.
getAddress()Returns the wallet address.
sign(message)Signs a message.
verify(message, signature)Verifies a message signature.
sendTransaction(options)Sends native BTC through the RGB wallet flow.
quoteSendTransaction(options)Quotes native BTC send cost.
transfer(options)Transfers an RGB asset.
quoteTransfer(options)Quotes RGB asset transfer cost.
toReadOnlyAccount()Returns a WalletAccountReadOnlyRgb.
dispose()Erases account key material managed by this wrapper.
getRgbWallet()Returns the underlying RGB SDK wallet manager.

RGB-specific account methods

MethodDescription
listAssets()Lists RGB assets in the wallet.
issueAssetNia(options)Issues a Non-Inflatable Asset.
receiveAsset(options)Creates a blind or witness receive invoice.
sendBegin(options)Begins an RGB send and returns a PSBT.
signPsbt(psbt)Signs a PSBT.
sendEnd(options)Broadcasts a signed RGB send.
createUtxos(options)Creates UTXOs using the combined flow.
createUtxosBegin(options)Begins UTXO creation and returns a PSBT.
createUtxosEnd(options)Finalizes UTXO creation from a signed PSBT.
listUnspents()Lists UTXOs.
listTransactions()Lists Bitcoin transactions.
getTransfers(options)Lists RGB transfers with optional asset filtering and pagination.
listTransfers(assetId)Lists RGB transfers for an optional asset ID.
failTransfers(transferId)Marks a transfer as failed.
createBackup(options)Creates an encrypted wallet backup.
restoreFromBackup(params)Restores a wallet from encrypted backup material.

WalletAccountReadOnlyRgb

MethodDescription
verify(message, signature)Verifies a message signature without private key access.
getBalance()Returns the Bitcoin balance in satoshis.
getTokenBalance(tokenAddress)Returns the settled RGB asset balance for the given asset ID.
quoteSendTransaction(tx)Throws; use WalletAccountRgb for this operation.
quoteTransfer(options)Throws; use WalletAccountRgb for this operation.
getTransactionReceipt(hash)Looks up a Bitcoin transaction receipt by hash.
getTransferReceipt(hash)Looks up an RGB transfer receipt by hash.

Transfer options

FieldRequiredDescription
tokenYesRGB asset ID.
recipientYesRGB invoice recipient.
amountYesTransfer amount.
feeRateNoFee rate in sat/vbyte.
minConfirmationsNoMinimum confirmations.
witnessDataNoWitness data for transfer construction.

Limitations

  • RGB account creation is limited to account index 0.
  • getAccountByPath() is not supported.
  • Read-only accounts cannot quote transactions or transfers.
  • dataDir is part of the wallet state and needs durable storage.

On this page