@dodoex/btc-connect-react
Version:
Btc connect for unisat okx
936 lines (932 loc) • 28.1 kB
TypeScript
// Generated by dts-bundle-generator v9.5.1
import React$1 from 'react';
export declare enum BitcoinScriptType {
P2PKH = "P2PKH",
P2SH_P2WPKH = "P2SH-P2WPKH",
P2WPKH = "P2WPKH"
}
export declare enum Network {
LIVENET = "livenet",
TESTNET = "testnet",
REGTEST = "regtest",
TESTNET4 = "testnet4"
}
export type Balance = {
confirmed: number;
unconfirmed: number;
total: number;
};
export interface BtcWalletConnectOptions {
network?: Network;
}
export type BtcConnectorId = "unisat" | "okx" | "sat20";
export interface IBtcConnector {
connect(): Promise<boolean>;
disconnect(): Promise<void>;
getAccounts(): Promise<string[]>;
sendToAddress(toAddress: string, amount: number): Promise<string>;
signPsbt(psbtHex: string, options?: any): Promise<string>;
getCurrentInfo(): Promise<void>;
}
export type AccountsChangedEvent = (event: "accountsChanged", handler: (accounts: Array<string>) => void) => void;
export type AccountChangedEvent = (event: "accountChanged", handler: (account: string) => void) => void;
export type NetworkChangedEvent = (event: "networkChanged", handler: (network: Network) => void) => void;
export type MessageType = "ecdsa" | "bip322-simple";
export type Address = string;
declare abstract class BtcConnector {
/** 唯一的连接器标识 */
abstract readonly id: string;
/** 连接器名称 */
abstract readonly name: string;
abstract readonly logo: string;
/** 扩展或 Snap 的主页 */
abstract homepage: string;
/** 连接器是否可用 */
ready: boolean;
connected: boolean;
address: Address | undefined;
publicKey: string | undefined;
network: Network;
networks: Network[];
constructor(network: Network);
/** 连接方法,需在子类中实现 */
abstract connect(): Promise<boolean>;
/** 发送比特币到指定地址,需在子类中实现 */
abstract sendToAddress(toAddress: string, amount: number): Promise<string>;
/** 签署 PSBT,需在子类中实现 */
abstract signPsbt(psbtHex: string, options?: any): Promise<string>;
/** 获取当前信息,需在子类中实现 */
abstract getCurrentInfo(): Promise<void>;
abstract balance: Balance;
/**
* 断开连接,重置相关属性
*/
disconnect(): void;
/**
* 获取账户地址
* @returns 账户地址
*/
getAccount(): string | undefined;
/**
* 检查是否已授权
* @returns 是否授权
*/
isAuthorized(): boolean;
/**
* 获取当前网络
* @returns 当前网络
*/
getNetwork(): Promise<Network>;
/**
* 获取公共密钥
* @returns 公共密钥
*/
getPublicKey(): Promise<string>;
/**
* 切换网络
* @param network 目标网络
*/
switchNetwork(network: Network): Promise<void>;
}
declare namespace UnisatWalletTypes {
type AccountsChangedEvent = (event: "accountsChanged" | "networkChanged", handler: (accounts: Array<string> | string) => void) => void;
type Inscription = {
inscriptionId: string;
inscriptionNumber: string;
address: string;
outputValue: string;
content: string;
contentLength: string;
contentType: number;
preview: number;
timestamp: number;
offset: number;
genesisTransaction: string;
location: string;
};
type GetInscriptionsResult = {
total: number;
list: Inscription[];
nextCursor?: number;
};
type SendInscriptionsResult = {
txid: string;
};
}
export type Unisat = {
requestAccounts: () => Promise<string[]>;
getAccounts: () => Promise<string[]>;
on: UnisatWalletTypes.AccountsChangedEvent;
removeListener: UnisatWalletTypes.AccountsChangedEvent;
getInscriptions: (cursor: number, size: number) => Promise<UnisatWalletTypes.GetInscriptionsResult>;
sendInscription: (address: string, inscriptionId: string, options?: {
feeRate: number;
}) => Promise<UnisatWalletTypes.SendInscriptionsResult>;
switchNetwork: (network: Network) => Promise<void>;
getNetwork: () => Promise<Network>;
getPublicKey: () => Promise<string>;
getBalance: () => Promise<Balance>;
sendBitcoin: (address: string, atomicAmount: number, options?: {
feeRate: number;
}) => Promise<string>;
pushTx: ({ rawtx }: {
rawtx: string;
}) => Promise<string>;
pushPsbt: (psbtHex: string) => Promise<string>;
signMessage: (message: string, type?: "ecdsa" | "bip322-simple") => Promise<string>;
signPsbt: (psbtHex: string, options?: {
autoFinalized?: boolean;
toSignInputs: {
index: number;
address?: string;
publicKey?: string;
sighashTypes?: number[];
disableTweakSigner?: boolean;
}[];
}) => Promise<string>;
signPsbts: (psbtHexs: string[], options?: {
autoFinalized?: boolean;
toSignInputs: {
index: number;
address?: string;
publicKey?: string;
sighashTypes?: number[];
disableTweakSigner?: boolean;
};
}[]) => Promise<string[]>;
};
declare class UnisatConnector extends BtcConnector {
readonly id = "unisat";
readonly name: string;
readonly logo: string;
readonly networks: Network[];
homepage: string;
balance: Balance;
unisat: Unisat;
constructor(network: Network);
/**
* Connects to the Unisat wallet and retrieves account information.
* @returns Promise that resolves to true if connected successfully.
*/
connect(): Promise<boolean>;
/**
* Disconnects from the Unisat wallet.
*/
disconnect(): Promise<void>;
/**
* Subscribes to wallet events.
* @param event - The event type ('accountsChanged' or 'networkChanged').
* @param handler - The event handler function.
*/
on(event: "accountsChanged" | "networkChanged", handler: (data: any) => void): void;
/**
* Removes an event listener from the Unisat wallet.
* @param event - The event type ('accountsChanged' or 'networkChanged').
* @param handler - The event handler function to remove.
*/
removeListener(event: "accountsChanged" | "networkChanged", handler: (data: any) => void): void;
/**
* Requests account information from the Unisat wallet.
* @returns Promise that resolves to an array of account addresses.
*/
requestAccounts(): Promise<string[]>;
/**
* Retrieves the current account information.
*/
getCurrentInfo(): Promise<void>;
/**
* Retrieves the account balance from the Unisat wallet.
* @returns Promise that resolves to the balance object.
*/
getBalance(): Promise<Balance>;
/**
* Retrieves the current network from the Unisat wallet.
* @returns Promise that resolves to the current network.
*/
getNetwork(): Promise<Network>;
/**
* Retrieves the public key from the Unisat wallet.
* @returns Promise that resolves to the public key string.
*/
getPublicKey(): Promise<string>;
/**
* Retrieves the list of accounts from the Unisat wallet.
* @returns Promise that resolves to an array of account addresses.
*/
getAccounts(): Promise<string[]>;
/**
* Sends Bitcoin to a specified address.
* @param toAddress - Recipient's address.
* @param amount - Amount to send.
* @returns Promise that resolves to the transaction hash.
*/
sendToAddress(toAddress: string, amount: number): Promise<string>;
/**
* Switches the network for the Unisat wallet.
* @param network - The target network.
*/
switchNetwork(network: Network): Promise<void>;
/**
* Signs a message using the Unisat wallet.
* @param message - The message to sign.
* @param type - The type of signature.
* @returns Promise that resolves to the signature.
*/
signMessage(message: string, type?: MessageType): Promise<string>;
/**
* Signs a PSBT (Partially Signed Bitcoin Transaction).
* @param psbtHex - The PSBT in hexadecimal format.
* @param options - Signing options.
* @returns Promise that resolves to the signed PSBT.
*/
signPsbt(psbtHex: string, options?: any): Promise<string>;
/**
* Signs multiple PSBTs.
* @param psbtHexs - Array of PSBTs in hexadecimal format.
* @param options - Array of signing options.
* @returns Promise that resolves to an array of signed PSBTs.
*/
signPsbts(psbtHexs: string[], options?: any): Promise<string[]>;
/**
* Pushes a raw transaction to the network.
* @param rawTx - The raw transaction data.
* @returns Promise that resolves to the transaction hash.
*/
pushTx(rawTx: string): Promise<string>;
/**
* Pushes a PSBT to the network.
* @param psbtHex - The PSBT in hexadecimal format.
* @returns Promise that resolves to the transaction hash.
*/
pushPsbt(psbtHex: string): Promise<string>;
/**
* Retrieves inscriptions with pagination.
* @param cursor - Pagination cursor.
* @param size - Number of items to retrieve.
* @returns Promise that resolves to the inscriptions and next cursor.
*/
getInscriptions(cursor: number, size: number): Promise<UnisatWalletTypes.GetInscriptionsResult>;
}
declare namespace OkxWalletTypes {
interface AddressInfo {
address: string;
publicKey: string;
compressedPublicKey: string;
}
type OnEvent = (event: "accountsChanged" | "accountChanged", handler: (accounts: Array<string> | Array<AddressInfo>) => void) => void;
type Inscription = {
inscriptionId: string;
inscriptionNumber: string;
address: string;
outputValue: string;
content: string;
contentLength: string;
contentType: string;
preview: string;
timestamp: number;
offset: number;
genesisTransaction: string;
location: string;
};
type GetInscriptionsResult = {
total: number;
list: Inscription[];
};
interface ConnectResult {
address: string;
publicKey: string;
}
interface SendProps {
from: string;
to: string;
value: number;
satBytes: number;
}
interface SendResult {
txhash: string;
}
interface TransferNftProps {
from: string;
to: string;
data: string | string[];
}
interface TransferNftResult {
txhash: string;
}
interface SplitUtxoProps {
from: string;
amount: number;
}
interface SplitUtxoResult {
utxos: {
txId: string;
vOut: number;
amount: number;
rawTransaction: string;
}[];
}
interface InscribeProps {
type: 51 | 58;
from: string;
tick: string;
tid: string;
}
interface MintProps {
type: 60 | 50 | 51 | 62 | 61 | 36 | 33 | 34 | 35 | 58;
from: string;
inscriptions: {
contentType: string;
body: string;
}[];
}
interface MintResult {
commitAddrs: string[];
commitTx: string;
revealTxs: string[];
commitTxFee: number;
revealTxFees: number[];
feeRate: number;
size: number;
}
}
export type OkxWallet = {
connect: () => Promise<OkxWalletTypes.ConnectResult>;
requestAccounts: () => Promise<string[]>;
getAccounts: () => Promise<string[]>;
getNetwork: () => Promise<Network>;
getPublicKey: () => Promise<string>;
getBalance: () => Promise<Balance>;
getInscriptions: (cursor: number, size: number) => Promise<OkxWalletTypes.GetInscriptionsResult>;
sendBitcoin: (toAddress: string, satoshis: number, options?: {
feeRate: number;
}) => Promise<string>;
sendInscription: (address: string, inscriptionId: string, options?: {
feeRate: number;
}) => Promise<string>;
transferNft: ({ from, to, data, }: OkxWalletTypes.TransferNftProps) => Promise<OkxWalletTypes.TransferNftResult>;
send: ({ from, to, value, satBytes, }: OkxWalletTypes.SendProps) => Promise<OkxWalletTypes.SendResult>;
signMessage: (message: string, type?: MessageType) => Promise<string>;
pushTx: (rawtx: string) => Promise<string>;
splitUtxo: ({ from, amount, }: OkxWalletTypes.SplitUtxoProps) => Promise<OkxWalletTypes.SplitUtxoResult>;
inscribe: ({ type, from, tick, tid, }: OkxWalletTypes.InscribeProps) => Promise<string>;
mint: ({ type, from, inscriptions, }: OkxWalletTypes.MintProps) => Promise<OkxWalletTypes.MintResult>;
signPsbt: (psbtHex: string, options?: {
autoFinalized?: boolean;
toSignInputs: {
index: number;
address?: string;
publicKey?: string;
sighashTypes?: number[];
disableTweakSigner?: boolean;
}[];
}) => Promise<string>;
signPsbts: (psbtHexs: string[], options?: {
autoFinalized?: boolean;
toSignInputs: {
index: number;
address?: string;
publicKey?: string;
sighashTypes?: number[];
disableTweakSigner?: boolean;
};
}[]) => Promise<string[]>;
pushPsbt: (psbtHex: string) => Promise<string>;
on: OkxWalletTypes.OnEvent;
switchNetwork: (network: Network) => Promise<void>;
};
declare class OkxConnector extends BtcConnector {
readonly id = "okx";
readonly name: string;
readonly logo: string;
readonly networks: Network[];
homepage: string;
balance: Balance;
okxwallet: OkxWallet;
constructor(network: Network);
/**
* Connect to OKX Wallet
* @returns Whether the connection was successful
*/
connect(): Promise<boolean>;
/**
* Disconnect
*/
disconnect(): Promise<void>;
/**
* On event
* @param event Event type
* @param handler Event handler
*/
on(event: "accountsChanged" | "accountChanged", handler: any): void;
/**
* Inscribe
* @param type Inscription type
* @param from Sender address
* @param tick Tick value
* @param tid Transaction ID
* @returns Transaction hash
*/
inscribe({ type, from, tick, tid, }: OkxWalletTypes.InscribeProps): Promise<string>;
/**
* Mint inscriptions
* @param type Mint type
* @param from Sender address
* @param inscriptions Inscriptions data
* @returns Mint result
*/
mint({ type, from, inscriptions, }: OkxWalletTypes.MintProps): Promise<OkxWalletTypes.MintResult>;
/**
* Send transaction
* @param from Sender address
* @param to Recipient address
* @param value Value to send
* @param satBytes Satoshi bytes
* @returns Send result
*/
send({ from, to, value, satBytes, }: OkxWalletTypes.SendProps): Promise<OkxWalletTypes.SendResult>;
/**
* Send Bitcoin to address
* @param toAddress Recipient address
* @param amount Amount in satoshis
* @returns Transaction hash
*/
sendToAddress(toAddress: string, amount: number): Promise<string>;
/**
* Send inscription
* @param address Recipient address
* @param inscriptionId Inscription ID
* @param options Optional fee rate
* @returns Send inscription result
*/
sendInscription(address: string, inscriptionId: string, options?: {
feeRate: number;
}): Promise<string>;
/**
* Split UTXO
* @param from Sender address
* @param amount Amount to split
* @returns Split UTXO result
*/
splitUtxo({ from, amount, }: OkxWalletTypes.SplitUtxoProps): Promise<OkxWalletTypes.SplitUtxoResult>;
/**
* Sign message
* @param message Message to sign
* @param type Message type
* @returns Signed message
*/
signMessage(message: string, type?: MessageType): Promise<string>;
/**
* Sign PSBT
* @param psbtHex PSBT hexadecimal string
* @param options Signing options
* @returns Signed PSBT
*/
signPsbt(psbtHex: string, options?: any): Promise<string>;
/**
* Batch sign PSBTs
* @param psbtHexs Array of PSBT hexadecimal strings
* @param options Signing options array
* @returns Array of signed PSBTs
*/
signPsbts(psbtHexs: string[], options?: any): Promise<string[]>;
/**
* Get accounts
* @returns List of accounts
*/
getAccounts(): Promise<string[]>;
/**
* Get account balance
* @returns Balance information
*/
getBalance(): Promise<Balance>;
/**
* Get current information
*/
getCurrentInfo(): Promise<void>;
/**
* Get network
* @returns Current network
*/
getNetwork(): Promise<Network>;
/**
* Get public key
* @returns Public key
*/
getPublicKey(): Promise<string>;
/**
* Push PSBT
* @param psbtHex PSBT hexadecimal string
* @returns Transaction hash
*/
pushPsbt(psbtHex: string): Promise<string>;
/**
* Push transaction
* @param rawTx Raw transaction data
* @returns Transaction hash
*/
pushTx(rawTx: string): Promise<string>;
/**
* Switch network
* @param network Target network
*/
switchNetwork(network: Network): Promise<void>;
/**
* Get inscription information
* @param cursor Pagination cursor
* @param size Number of items to retrieve
* @returns Inscription information and pagination
*/
getInscriptions(cursor: number, size: number): Promise<OkxWalletTypes.GetInscriptionsResult>;
}
declare namespace Sat20WalletTypes {
type AccountsChangedEvent = (event: "accountsChanged" | "networkChanged", handler: (accounts: Array<string> | string) => void) => void;
type Inscription = {
inscriptionId: string;
inscriptionNumber: string;
address: string;
outputValue: string;
content: string;
contentLength: number;
contentType: number;
preview: number;
timestamp: number;
offset: number;
genesisTransaction: string;
location: string;
};
type GetInscriptionsResult = {
total: number;
list: Inscription[];
nextCursor?: number;
};
type SendInscriptionsResult = {
txid: string;
};
}
export type Sat20 = {
requestAccounts: () => Promise<string[]>;
getAccounts: () => Promise<string[]>;
on: Sat20WalletTypes.AccountsChangedEvent;
removeListener: Sat20WalletTypes.AccountsChangedEvent;
getInscriptions: (cursor: number, size: number) => Promise<Sat20WalletTypes.GetInscriptionsResult>;
sendInscription: (address: string, inscriptionId: string, options?: {
feeRate: number;
}) => Promise<Sat20WalletTypes.SendInscriptionsResult>;
switchNetwork: (network: Network) => Promise<void>;
getNetwork: () => Promise<Network>;
getPublicKey: () => Promise<string>;
getBalance: () => Promise<Balance>;
sendBitcoin: (address: string, atomicAmount: number, options?: {
feeRate: number;
}) => Promise<string>;
pushTx: ({ rawtx }: {
rawtx: string;
}) => Promise<string>;
pushPsbt: (psbtHex: string) => Promise<string>;
signMessage: (message: string, type?: "ecdsa" | "bip322-simple") => Promise<string>;
signPsbt: (psbtHex: string, options?: {
autoFinalized?: boolean;
toSignInputs: {
index: number;
address?: string;
publicKey?: string;
sighashTypes?: number[];
disableTweakSigner?: boolean;
}[];
}) => Promise<string>;
signPsbts: (psbtHexs: string[], options?: {
autoFinalized?: boolean;
toSignInputs: {
index: number;
address?: string;
publicKey?: string;
sighashTypes?: number[];
disableTweakSigner?: boolean;
};
}[]) => Promise<string[]>;
};
declare class Sat20Connector extends BtcConnector {
readonly id = "Sat20";
readonly name: string;
readonly logo: string;
readonly networks: Network[];
homepage: string;
balance: Balance;
sat20: Sat20;
constructor(network: Network);
/**
* Connects to the Sat20 wallet and retrieves account information.
* @returns Promise that resolves to true if connected successfully.
*/
connect(): Promise<boolean>;
/**
* Disconnects from the Sat20 wallet.
*/
disconnect(): Promise<void>;
/**
* Subscribes to wallet events.
* @param event - The event type ('accountsChanged' or 'networkChanged').
* @param handler - The event handler function.
*/
on(event: "accountsChanged" | "networkChanged", handler: (data: any) => void): void;
/**
* Removes an event listener from the Sat20 wallet.
* @param event - The event type ('accountsChanged' or 'networkChanged').
* @param handler - The event handler function to remove.
*/
removeListener(event: "accountsChanged" | "networkChanged", handler: (data: any) => void): void;
/**
* Requests account information from the Sat20 wallet.
* @returns Promise that resolves to an array of account addresses.
*/
requestAccounts(): Promise<string[]>;
/**
* Retrieves the current account information.
*/
getCurrentInfo(): Promise<void>;
/**
* Retrieves the account balance from the Sat20 wallet.
* @returns Promise that resolves to the balance object.
*/
getBalance(): Promise<Balance>;
/**
* Retrieves the current network from the Sat20 wallet.
* @returns Promise that resolves to the current network.
*/
getNetwork(): Promise<Network>;
/**
* Retrieves the public key from the Sat20 wallet.
* @returns Promise that resolves to the public key string.
*/
getPublicKey(): Promise<string>;
/**
* Retrieves the list of accounts from the Sat20 wallet.
* @returns Promise that resolves to an array of account addresses.
*/
getAccounts(): Promise<string[]>;
/**
* Sends Bitcoin to a specified address.
* @param toAddress - Recipient's address.
* @param amount - Amount to send.
* @returns Promise that resolves to the transaction ID.
*/
sendToAddress(toAddress: string, amount: number): Promise<any>;
/**
* Switches the network for the Sat20 wallet.
* @param network - The target network.
*/
switchNetwork(network: Network): Promise<void>;
/**
* Signs a message.
* @param message - The message to sign.
* @param type - The type of signature.
* @returns Promise that resolves to the signature.
*/
signMessage(message: string, type?: MessageType): Promise<string>;
/**
* Signs a PSBT (Partially Signed Bitcoin Transaction).
* @param psbtHex - The PSBT in hexadecimal format.
* @param options - Signing options.
* @returns Promise that resolves to the signed PSBT.
*/
signPsbt(psbtHex: string, options?: any): Promise<string>;
/**
* Signs multiple PSBTs.
* @param psbtHexs - Array of PSBTs in hexadecimal format.
* @param options - Array of signing options.
* @returns Promise that resolves to an array of signed PSBTs.
*/
signPsbts(psbtHexs: string[], options?: any): Promise<string[]>;
/**
* Pushes a raw transaction to the network.
* @param rawTx - The raw transaction data.
* @returns Promise that resolves to the transaction ID.
*/
pushTx(rawTx: string): Promise<string>;
/**
* Pushes a PSBT to the network.
* @param psbtHex - The PSBT in hexadecimal format.
* @returns Promise that resolves to the transaction ID.
*/
pushPsbt(psbtHex: string): Promise<any>;
/**
* Retrieves inscriptions with pagination.
* @param cursor - Pagination cursor.
* @param size - Number of items to retrieve.
* @returns Promise that resolves to the inscriptions and next cursor.
*/
getInscriptions(cursor: number, size: number): Promise<Sat20WalletTypes.GetInscriptionsResult>;
}
export type Connector = UnisatConnector | OkxConnector | Sat20Connector;
export interface BtcConnectors {
id: BtcConnectorId;
instance: Connector;
installed: boolean;
}
declare class BtcWalletConnect {
private local_storage_key;
private local_disconnect_key;
connectorId: BtcConnectorId;
localConnectorId?: BtcConnectorId;
disConnectStatus: boolean;
connected: boolean;
address?: string;
publicKey?: string;
network: Network;
balance: Balance;
connectors: BtcConnectors[];
connector?: Connector;
private connectorRegistry;
constructor({ network, }: BtcWalletConnectOptions);
/**
* Check if the connector is installed
* @param id Connector identifier
* @returns Whether it is installed
*/
private isConnectorInstalled;
/**
* Dynamically register a new connector
* @param id Connector identifier
* @param ConnectorClass Connector class
*/
registerConnector(id: BtcConnectorId, ConnectorClass: typeof BtcConnector): void;
/**
* Switch the current connector
* @param id Target connector identifier
* @returns The switched connector instance
*/
switchConnector(id: BtcConnectorId): Connector;
/**
* Connect the currently selected connector
* @returns Whether the connection was successful
*/
connect(): Promise<boolean>;
/**
* Get current information
*/
private getCurrentInfo;
/**
* Check connection status
*/
check(): Promise<boolean>;
/**
* Disconnect
*/
disconnect(): Promise<void>;
/**
* Get account list
* @returns Array of account addresses
*/
getAccounts(): Promise<string[]>;
/**
* Get the current network
* @returns Current network
*/
getNetwork(): Promise<Network>;
/**
* Switch network
* @param network Target network
*/
switchNetwork(network: Network): Promise<void>;
/**
* Send Bitcoin to a specified address
* @param toAddress Target address
* @param amount Amount
* @returns Transaction ID
*/
sendToAddress(toAddress: string, amount: number): Promise<string>;
/**
* Sign a message
* @param message Message content
* @param type Signature type
* @returns Signature result
*/
signMessage(message: string, type?: MessageType): Promise<string>;
/**
* Sign a PSBT
* @param psbtHex PSBT hexadecimal string
* @param options Signing options
* @returns Signed PSBT
*/
signPsbt(psbtHex: string, options?: any): Promise<string>;
/**
* Batch sign PSBTs
* @param psbtHexs Multiple PSBT hexadecimal strings
* @param options Signing options
* @returns Array of signed PSBTs
*/
signPsbts(psbtHexs: string[], options?: any): Promise<string[]>;
/**
* Push a transaction
* @param rawTx Raw transaction data
* @returns Transaction ID
*/
pushTx(rawTx: string): Promise<string>;
/**
* Push a PSBT
* @param psbtHex PSBT hexadecimal string
* @returns Transaction ID
*/
pushPsbt(psbtHex: string): Promise<string>;
/**
* Subscribe to events
* @param event Event type
* @param handler Event handler
*/
on(event: "networkChanged" | "accountsChanged" | "accountChanged", handler: (data: any) => void): void;
/**
* Remove event listener
* @param event Event type
* @param handler Event handler
*/
removeListener(event: "networkChanged" | "accountsChanged" | "accountChanged", handler: (data: any) => void): void;
/**
* Get inscription data
* @param cursor Pagination cursor
* @param size Number of items to return
* @returns Inscription data result
*/
getInscriptions(cursor: number, size: number): Promise<Sat20WalletTypes.GetInscriptionsResult | OkxWalletTypes.GetInscriptionsResult | UnisatWalletTypes.GetInscriptionsResult>;
}
interface BtcWalletConnectOptions$1 {
network?: Network;
}
export interface WalletConnectReactProps {
config?: BtcWalletConnectOptions$1;
theme?: "light" | "dark";
ui?: {
connectClass?: string;
disconnectClass?: string;
modalClass?: string;
modalZIndex?: number;
};
text?: {
connectText?: string;
disconnectText?: string;
modalTitle?: string;
};
onConnectSuccess?: (btcWallet: BtcWalletConnect) => void;
onConnectError?: (error: any) => void;
onDisconnectSuccess?: () => void;
onDisconnectError?: (error: any) => void;
}
export declare const WalletConnectReact: ({ config: { network }, theme, ui: { connectClass, disconnectClass, modalClass, modalZIndex, }, text: { connectText, disconnectText, modalTitle, }, onConnectSuccess, onConnectError, onDisconnectSuccess, onDisconnectError, }: WalletConnectReactProps) => React$1.JSX.Element | null;
export interface WalletSelectModalProps {
visible: boolean;
title?: string;
className?: string;
zIndex?: number;
theme?: "light" | "dark";
wallets: any[];
onClick?: (id: BtcConnectorId) => void;
onClose?: () => void;
}
export declare const WalletSelectModal: ({ visible, title, theme, wallets, zIndex, className, onClick, onClose, }: WalletSelectModalProps) => React$1.ReactPortal | null;
export type WalletState = {
btcWallet?: BtcWalletConnect;
balance: Balance;
publicKey: string;
address: string;
connected: boolean;
initStatus: boolean;
modalVisible: boolean;
network: Network;
connectorId?: BtcConnectorId;
localConnectorId?: BtcConnectorId;
connector?: Connector;
connectors?: {
id: BtcConnectorId;
name: string;
logo: string;
connector: any;
installed: boolean;
}[];
};
export type WalletActions = {
init: (config: BtcWalletConnectOptions) => void;
check: () => void;
connect: () => void;
disconnect: () => void;
switchConnector: (id: BtcConnectorId) => void;
switchNetwork: () => void;
setModalVisible: (visible: boolean) => void;
};
export type WalletStore = WalletState & WalletActions;
export declare const useReactWalletStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<WalletStore>, "setState" | "devtools"> & {
setState(partial: WalletStore | Partial<WalletStore> | ((state: WalletStore) => WalletStore | Partial<WalletStore>), replace?: false | undefined, action?: (string | {
[x: string]: unknown;
[x: number]: unknown;
[x: symbol]: unknown;
type: string;
}) | undefined): void;
setState(state: WalletStore | ((state: WalletStore) => WalletStore), replace: true, action?: (string | {
[x: string]: unknown;
[x: number]: unknown;
[x: symbol]: unknown;
type: string;
}) | undefined): void;
devtools: {
cleanup: () => void;
};
}>;
export {};