@gobob/sats-wagmi
Version:
898 lines (880 loc) • 30.8 kB
TypeScript
import * as bitcoin_address_validation from 'bitcoin-address-validation';
import { Network, AddressType } from 'bitcoin-address-validation';
export { AddressType as BtcAddressType, Network } from 'bitcoin-address-validation';
import { FC, ReactNode } from 'react';
import * as _tanstack_react_query from '@tanstack/react-query';
import { QueryClient, UseQueryOptions, UndefinedInitialDataOptions, Optional, UseMutationOptions } from '@tanstack/react-query';
import { MetaMaskInpageProvider } from '@metamask/providers';
import { BIP32API } from 'bip32';
import * as bitcoin from 'bitcoinjs-lib';
import { Psbt } from 'bitcoinjs-lib';
import { MempoolRecomendedFee, EsploraFeeEstimates, GatewaySDK, GatewayQuoteParams } from '@gobob/bob-sdk';
type Address = string;
interface PsbtInputAccounts {
address: string;
signingIndexes: number[];
}
declare abstract class SatsConnector {
/** Unique connector id */
id: string;
/** Connector name */
name: string;
/** Extension or Snap homepage */
homepage: string;
/** Connector icon */
icon?: string;
/** Whether connector is usable */
ready: boolean;
/** Address types depend on which wallet is connected. Some wallets support connecting multiple addresses.
For example:
- Xverse: payment (P2SH) and ordinals (P2TR)
- UniSat: depends on the user selection in the extension
- Leather: payment (P2WPKH) and ordinals (P2TR)
- BOB MM Snap: payment (P2WPKH) and ordinals (P2TR) */
paymentAddress: Address | undefined;
/** P2TR address for ordinals and runes is kept separate from the payment address to ensure
that the user does not accidentally spend from the ordinals address */
ordinalsAddress: Address | undefined;
/** The public key is required to spend from P2SH and P2WSH addresses */
publicKey: string | undefined;
/** The Bitcoin network (mainnet, testnet, regtest) */
network: Network;
/** Override for the Esplora API */
esploraBaseUrl?: string;
constructor(network: Network, id: string, name: string, homepage: string, icon?: string, esploraBaseUrl?: string);
/** Connect to the wallet */
abstract connect(): Promise<void>;
/** Sign a message
* @param message - The message to sign.
* @returns The signature of the message.
*
* @example
* ```typescript
* const message = 'Hello, World!';
* const signature = await connector.signMessage(message);
* ```
*/
abstract signMessage(message: string): Promise<string>;
/** Sign a PSBT. This method is useful when creating custom PSBTs
* @param psbtHex - The PSBT hex to sign.
* @param psbtInputAccounts - The accounts to sign the PSBT with.
* @returns The signed PSBT hex.
*
* @example
* ```typescript
* const psbtHex = 'cHNidP8BAFICAAAAA...';
* const psbtInputAccounts = [
* {
* address: 'bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq',
* signingIndexes: [0, 1]
* }
* ];
* const signed = await connector.signPsbt(psbtHex, psbtInputAccounts);
* ```
* @note The signingIndexes are the indexes of the inputs to sign in the PSBT.
* @note The address is the address to sign the PSBT with.
* @note Each wallet handle the PSBT signing differently. Check the wallet documentation for more information.
* Unisat: https://docs.unisat.io/dev/unisat-developer-service/unisat-wallet#signpsbts
* Xverse: https://docs.xverse.app/sats-connect/bitcoin-methods/signpsbt
* Leather: https://leather.gitbook.io/developers/bitcoin-methods/signpsbt
*/
abstract signPsbt(psbtHex: string, psbtInputAccounts: PsbtInputAccounts[]): Promise<string>;
/** Verify if the wallet connection is ready (wallet unlocked, ...) */
abstract isReady(): Promise<boolean>;
/** Disconnect from the wallet */
disconnect(): void;
/** Get the payment address
* @returns The payment address
*/
getPaymentAddress(): string | undefined;
/** Get the ordinals address
* @returns The ordinals address
*/
getOrdinalsAddress(): string | undefined;
/** Convenience wrapper around the getAddressInfo function
* @param address - The address to get the type of.
* @returns The address type of the address.
*/
getAddressType(address: string): AddressType;
/** Check if the address is authorized */
isAuthorized(): boolean;
/** Return the public key of the connected address.
* @returns The public key of the connected address.
*/
getPublicKey(): string | undefined;
abstract on(callback: (account: string) => void): void;
abstract removeListener(callback: (account: string) => void): void;
private get esploraClient();
/** Get the transaction from the transaction ID
* @param txId - The transaction ID to get the transaction from.
* @returns The transaction hex.
*
* @example
* ```typescript
* import { Transaction } from '@scure/btc-signer';
*
* const txId = 'f5e7 ... 3b';
* const txHex = await connector.getTransaction(txId);
*
* // Decode the transaction
* Transaction.fromRaw(Buffer.from(txHex));
* ```
*/
getTransaction(txId: string): Promise<string>;
/** Send BTC to an address
* @param toAddress - The address to send BTC to. Can be any valid BTC address.
* @param amount - The BTC to send denomination in satoshis.
* @returns The transaction ID of the sent transaction.
*
* @example
* ```typescript
* const toAddress = 'bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq';
* const amount = 10000; // 0.0001 BTC
* const txId = await connector.sendToAddress(toAddress, amount);
* ```
*/
sendToAddress(toAddress: string, amount: number): Promise<string>;
/** Send BTC to an address with data in an OP_RETURN output
* @param toAddress - The address to send BTC to. Can be any valid BTC address.
* @param amount - The BTC to send denomination in satoshis.
* @param data - Optional OP_RETURN data to include in the transaction.
* @returns The transaction ID of the sent transaction.
*
* @example
* ```typescript
* const toAddress = 'bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq';
* const amount = 10000; // 0.0001 BTC
* const data = 'Hello, World!';
* const txId = await connector.sendToAddressWithData(toAddress, amount, data);
* ```
* @note Most wallets don't support transfers with OP_RETURN data, so we need to handle this case separately
* where wallets do not support it. This function is overwritten in the connectors that support transfer with OP_RETURN.
* @note Most Bitcoin nodes accept 80 bytes maximum for OP_RETURN data. If you want to include more data,
* consider using a dedicated service that can include such transactions in a block.
*/
sendToAddressWithOpReturn(toAddress: string, amount: number, data: string): Promise<string>;
/** Create and sign a transaction with an OP_RETURN output
* @param toAddress - The address to send BTC to. Can be any valid BTC address.
* @param amount - The BTC to send denomination in satoshis.
* @param data - The OP_RETURN data to include in the transaction.
* @returns The signed transaction hex.
*
* @example
* ```typescript
* const toAddress = 'bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq';
* const amount = 10000; // 0.0001 BTC
* const data = 'Hello, World!';
* const signedTx = await connector.createTxWithOpReturn(toAddress, amount, data);
* ```
*/
createAndSignTx(toAddress: string, amount: number, data?: string): Promise<string>;
/** Sign all PSBT inputs
* @param psbtBase64 - The Base64 encoded PSBT.
* @returns The signed transaction hex.
*/
signAllInputs(psbtBase64: string): Promise<string>;
private validatePaymentAddress;
}
type SatsConfigData = {
connector?: SatsConnector;
connectors: SatsConnector[];
setConnector: (connector?: SatsConnector) => void;
network: Network;
};
declare const useSatsWagmi: () => SatsConfigData;
type SatsWagmiConfigProps = {
children: ReactNode;
network?: Network;
queryClient: QueryClient;
};
declare const SatsWagmiConfig: FC<SatsWagmiConfigProps>;
declare global {
interface Window {
XverseProviders: any;
}
}
declare class XverseConnector extends SatsConnector {
constructor(network: Network);
connect(): Promise<void>;
on(): void;
removeListener(): void;
isReady(): Promise<boolean>;
signMessage(message: string): Promise<string>;
sendToAddress(toAddress: string, amount: number): Promise<string>;
signPsbt(psbtHex: string, psbtInputAccounts: PsbtInputAccounts[]): Promise<string>;
}
type Response<T> = {
jsonrpc: string;
id: string;
result: T;
};
type AddressResult = {
symbol: 'BTC' | 'STX';
type: 'p2wpkh' | 'p2tr';
address: string;
publicKey: string;
tweakedPublicKey: string;
derivationPath: string;
};
interface SignPsbtRequestParams {
hex: string;
allowedSighash?: any[];
signAtIndex?: number | number[];
network?: any;
account?: number;
broadcast?: boolean;
}
interface SignMessageParams {
message: string;
paymentType?: 'p2wpkh' | 'p2tr';
network?: any;
account?: number;
}
type RequestAddressesResult = {
addresses: AddressResult[];
};
type RequestSignMessageResult = {
signature: string;
address: string;
message: string;
};
type RequestAddressesFn = (method: 'getAddresses') => Promise<Response<RequestAddressesResult>>;
type SendBTCFn = (method: 'sendTransfer', options: {
address: string;
amount: string;
network: Network;
}) => Promise<Response<{
txid: string;
}>>;
type SignPsbtFn = (method: 'signPsbt', options: SignPsbtRequestParams) => Promise<Response<{
hex: string;
}>>;
type SignMessageFn = (method: 'signMessage', options: SignMessageParams) => Promise<Response<RequestSignMessageResult>>;
declare global {
interface Window {
LeatherProvider: {
request: RequestAddressesFn & SendBTCFn & SignPsbtFn & SignMessageFn;
};
}
}
declare class LeatherConnector extends SatsConnector {
derivationPath: string | undefined;
constructor(network: Network);
connect(): Promise<void>;
on(): void;
removeListener(): void;
isReady(): Promise<boolean>;
signMessage(message: string): Promise<string>;
sendToAddress(toAddress: string, amount: number): Promise<string>;
signPsbt(psbtHex: string, psbtInputAccounts: PsbtInputAccounts[]): Promise<string>;
}
type WalletNetwork$1 = 'livenet' | 'testnet';
type WalletChain = 'BITCOIN_MAINNET' | 'BITCOIN_TESTNET' | 'BITCOIN_TESTNET4' | 'BITCOIN_SIGNET' | 'FRACTAL_BITCOIN_MAINNET' | 'FRACTAL_BITCOIN_TESTNET';
type AccountsChangedEvent = (event: 'accountsChanged', handler: (accounts: Array<string>) => void) => void;
type Balance = {
confirmed: number;
unconfirmed: number;
total: number;
};
type UniSatBase = {
requestAccounts: () => Promise<string[]>;
getAccounts: () => Promise<string[]>;
getNetwork: () => Promise<WalletNetwork$1>;
getChain: () => Promise<WalletChain>;
switchNetwork: (network: WalletNetwork$1) => Promise<void>;
switchChain: (network: WalletChain) => Promise<void>;
getPublicKey: () => Promise<string>;
getBalance: () => Promise<Balance>;
signMessage: (msg: 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>;
on: AccountsChangedEvent;
removeListener: AccountsChangedEvent;
};
type UniSatExt = {
sendBitcoin: (address: string, atomicAmount: number, options?: {
feeRate: number;
}) => Promise<string>;
};
type WalletSource = 'bitkeep' | 'binancew3w' | 'unisat';
declare global {
interface Window {
unisat: UniSatBase & UniSatExt;
bitkeep: {
unisat: UniSatBase & UniSatExt;
};
binancew3w: {
bitcoin: UniSatBase;
};
}
}
declare class UnisatConnector extends SatsConnector {
source: WalletSource;
constructor(network: Network, source: WalletSource);
private getSource;
connect(): Promise<void>;
disconnect(): void;
signMessage(message: string): Promise<string>;
on(callback: (account: string) => void): void;
removeListener(callback: (account: string) => void): void;
changeAccount(account: string): Promise<void>;
isReady(): Promise<boolean>;
sendToAddress(toAddress: string, amount: number): Promise<string>;
signPsbt(psbtHex: string, psbtInputAccounts: PsbtInputAccounts[]): Promise<string>;
}
type WalletNetwork = 'main' | 'test';
declare enum BitcoinScriptType {
P2WPKH = "P2WPKH"
}
interface ExtendedPublicKey {
xpub: string;
mfp: string;
}
declare global {
interface Window {
readonly ethereum: MetaMaskInpageProvider;
}
}
declare class MMSnapConnector extends SatsConnector {
extendedPublicKey: ExtendedPublicKey | undefined;
snapNetwork: WalletNetwork;
bip32: BIP32API;
constructor(network: Network);
connect(): Promise<void>;
isReady(): Promise<boolean>;
on(): void;
removeListener(): void;
getExtendedPublicKey(): Promise<ExtendedPublicKey>;
getPublicKey(): string | undefined;
signMessage(message: string): Promise<string>;
signInput(inputIndex: number, psbt: Psbt): Promise<bitcoin.Psbt>;
getMasterFingerprint(): Promise<string>;
signPsbt(psbtHex: string, _psbtInputAccounts: PsbtInputAccounts[]): Promise<string>;
getNetworkInSnap(): Promise<"" | WalletNetwork>;
setNetworkInSnap(expectedNetwork: WalletNetwork): Promise<unknown>;
private snapRequest;
}
type UseAccountProps = {
onConnect?: ({ address, connector }: {
address?: string | undefined;
connector?: SatsConnector | undefined;
}) => void;
};
declare const useAccount: ({ onConnect }?: UseAccountProps) => {
connector: SatsConnector | undefined;
address: string | undefined;
addressType: bitcoin_address_validation.AddressType | undefined;
publicKey: string | undefined;
error: Error | null;
isError: boolean;
isLoading: boolean;
isSuccess: boolean;
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<{
address: string | undefined;
type: bitcoin_address_validation.AddressType | undefined;
publicKey: string | undefined;
} | undefined, Error>>;
};
type GetBalanceReturnType = {
confirmed: bigint;
unconfirmed: bigint;
total: bigint;
};
type UseBalanceProps = Omit<UseQueryOptions<GetBalanceReturnType, unknown, GetBalanceReturnType, (string | undefined)[]>, 'initialData' | 'queryFn' | 'queryKey' | 'enabled'>;
declare const useBalance: (props?: UseBalanceProps) => _tanstack_react_query.UseQueryResult<GetBalanceReturnType, unknown>;
declare const useConnect: () => {
connectors: SatsConnector[];
connect: _tanstack_react_query.UseMutateFunction<{
address: string | undefined;
}, Error, {
connector?: SatsConnector;
}, unknown>;
connectAsync: _tanstack_react_query.UseMutateAsyncFunction<{
address: string | undefined;
}, Error, {
connector?: SatsConnector;
}, unknown>;
data: undefined;
variables: undefined;
error: null;
isError: false;
isIdle: true;
isPending: false;
isSuccess: false;
status: "idle";
reset: () => void;
context: unknown;
failureCount: number;
failureReason: Error | null;
isPaused: boolean;
submittedAt: number;
} | {
connectors: SatsConnector[];
connect: _tanstack_react_query.UseMutateFunction<{
address: string | undefined;
}, Error, {
connector?: SatsConnector;
}, unknown>;
connectAsync: _tanstack_react_query.UseMutateAsyncFunction<{
address: string | undefined;
}, Error, {
connector?: SatsConnector;
}, unknown>;
data: undefined;
variables: {
connector?: SatsConnector;
};
error: null;
isError: false;
isIdle: false;
isPending: true;
isSuccess: false;
status: "pending";
reset: () => void;
context: unknown;
failureCount: number;
failureReason: Error | null;
isPaused: boolean;
submittedAt: number;
} | {
connectors: SatsConnector[];
connect: _tanstack_react_query.UseMutateFunction<{
address: string | undefined;
}, Error, {
connector?: SatsConnector;
}, unknown>;
connectAsync: _tanstack_react_query.UseMutateAsyncFunction<{
address: string | undefined;
}, Error, {
connector?: SatsConnector;
}, unknown>;
data: undefined;
error: Error;
variables: {
connector?: SatsConnector;
};
isError: true;
isIdle: false;
isPending: false;
isSuccess: false;
status: "error";
reset: () => void;
context: unknown;
failureCount: number;
failureReason: Error | null;
isPaused: boolean;
submittedAt: number;
} | {
connectors: SatsConnector[];
connect: _tanstack_react_query.UseMutateFunction<{
address: string | undefined;
}, Error, {
connector?: SatsConnector;
}, unknown>;
connectAsync: _tanstack_react_query.UseMutateAsyncFunction<{
address: string | undefined;
}, Error, {
connector?: SatsConnector;
}, unknown>;
data: {
address: string | undefined;
};
error: null;
variables: {
connector?: SatsConnector;
};
isError: false;
isIdle: false;
isPending: false;
isSuccess: true;
status: "success";
reset: () => void;
context: unknown;
failureCount: number;
failureReason: Error | null;
isPaused: boolean;
submittedAt: number;
};
declare const useDisconnect: () => {
disconnect: _tanstack_react_query.UseMutateFunction<void, Error, void, unknown>;
disconnectAsync: _tanstack_react_query.UseMutateAsyncFunction<void, Error, void, unknown>;
data: undefined;
variables: undefined;
error: null;
isError: false;
isIdle: true;
isPending: false;
isSuccess: false;
status: "idle";
reset: () => void;
context: unknown;
failureCount: number;
failureReason: Error | null;
isPaused: boolean;
submittedAt: number;
} | {
disconnect: _tanstack_react_query.UseMutateFunction<void, Error, void, unknown>;
disconnectAsync: _tanstack_react_query.UseMutateAsyncFunction<void, Error, void, unknown>;
data: undefined;
variables: void;
error: null;
isError: false;
isIdle: false;
isPending: true;
isSuccess: false;
status: "pending";
reset: () => void;
context: unknown;
failureCount: number;
failureReason: Error | null;
isPaused: boolean;
submittedAt: number;
} | {
disconnect: _tanstack_react_query.UseMutateFunction<void, Error, void, unknown>;
disconnectAsync: _tanstack_react_query.UseMutateAsyncFunction<void, Error, void, unknown>;
data: undefined;
error: Error;
variables: void;
isError: true;
isIdle: false;
isPending: false;
isSuccess: false;
status: "error";
reset: () => void;
context: unknown;
failureCount: number;
failureReason: Error | null;
isPaused: boolean;
submittedAt: number;
} | {
disconnect: _tanstack_react_query.UseMutateFunction<void, Error, void, unknown>;
disconnectAsync: _tanstack_react_query.UseMutateAsyncFunction<void, Error, void, unknown>;
data: void;
error: null;
variables: void;
isError: false;
isIdle: false;
isPending: false;
isSuccess: true;
status: "success";
reset: () => void;
context: unknown;
failureCount: number;
failureReason: Error | null;
isPaused: boolean;
submittedAt: number;
};
type UseFeeEstimateReturnType = {
amount: bigint;
feeRate: number;
};
type UseFeeEstimateProps<TData = UseFeeEstimateReturnType> = {
query?: Omit<UndefinedInitialDataOptions<UseFeeEstimateReturnType, Error, TData, (string | number | undefined)[]>, 'queryKey' | 'queryFn'>;
amount?: number;
opReturnData?: string;
confirmationTarget?: number;
feeRate?: number;
};
declare function useFeeEstimate<TData = UseFeeEstimateReturnType>({ amount, opReturnData, feeRate: feeRateProp, query }?: UseFeeEstimateProps<TData>): _tanstack_react_query.UseQueryResult<TData, Error>;
type FeeRateReturnType = {
memPool: Record<keyof MempoolRecomendedFee, number>;
esplora: Record<keyof EsploraFeeEstimates, number>;
};
type UseFeeRateProps<TData = FeeRateReturnType> = {
rate?: keyof FeeRateReturnType;
query?: Omit<UndefinedInitialDataOptions<FeeRateReturnType, Error, TData, (string | number)[]>, 'queryKey' | 'queryFn'>;
};
declare function useFeeRate<TData = FeeRateReturnType>({ query }?: UseFeeRateProps<TData>): _tanstack_react_query.UseQueryResult<TData, Error>;
type SendGatewayTransactionParams = {
toToken: string;
evmAddress: string;
value: bigint;
};
type UseSendGatewayTransactionProps = Omit<{
gatewaySDK?: GatewaySDK;
} & Omit<Optional<GatewayQuoteParams, 'fromUserAddress' | 'toUserAddress' | 'amount' | 'toToken' | 'fromChain' | 'fromToken'>, 'toChain'> & {
toChain: 'bob' | 'bob-sepolia';
} & UseMutationOptions<string | undefined, Error, SendGatewayTransactionParams, unknown>, 'mutationKey' | 'mutationFn'>;
declare const useSendGatewayTransaction: ({ gatewaySDK, toChain, ...props }: UseSendGatewayTransactionProps) => {
sendGatewayTransaction: _tanstack_react_query.UseMutateFunction<string | undefined, Error, SendGatewayTransactionParams, unknown>;
sendGatewayTransactionAsync: _tanstack_react_query.UseMutateAsyncFunction<string | undefined, Error, SendGatewayTransactionParams, unknown>;
data: undefined;
variables: undefined;
error: null;
isError: false;
isIdle: true;
isPending: false;
isSuccess: false;
status: "idle";
reset: () => void;
context: unknown;
failureCount: number;
failureReason: Error | null;
isPaused: boolean;
submittedAt: number;
} | {
sendGatewayTransaction: _tanstack_react_query.UseMutateFunction<string | undefined, Error, SendGatewayTransactionParams, unknown>;
sendGatewayTransactionAsync: _tanstack_react_query.UseMutateAsyncFunction<string | undefined, Error, SendGatewayTransactionParams, unknown>;
data: undefined;
variables: SendGatewayTransactionParams;
error: null;
isError: false;
isIdle: false;
isPending: true;
isSuccess: false;
status: "pending";
reset: () => void;
context: unknown;
failureCount: number;
failureReason: Error | null;
isPaused: boolean;
submittedAt: number;
} | {
sendGatewayTransaction: _tanstack_react_query.UseMutateFunction<string | undefined, Error, SendGatewayTransactionParams, unknown>;
sendGatewayTransactionAsync: _tanstack_react_query.UseMutateAsyncFunction<string | undefined, Error, SendGatewayTransactionParams, unknown>;
data: undefined;
error: Error;
variables: SendGatewayTransactionParams;
isError: true;
isIdle: false;
isPending: false;
isSuccess: false;
status: "error";
reset: () => void;
context: unknown;
failureCount: number;
failureReason: Error | null;
isPaused: boolean;
submittedAt: number;
} | {
sendGatewayTransaction: _tanstack_react_query.UseMutateFunction<string | undefined, Error, SendGatewayTransactionParams, unknown>;
sendGatewayTransactionAsync: _tanstack_react_query.UseMutateAsyncFunction<string | undefined, Error, SendGatewayTransactionParams, unknown>;
data: string | undefined;
error: null;
variables: SendGatewayTransactionParams;
isError: false;
isIdle: false;
isPending: false;
isSuccess: true;
status: "success";
reset: () => void;
context: unknown;
failureCount: number;
failureReason: Error | null;
isPaused: boolean;
submittedAt: number;
};
type UseSendTransactionProps = Omit<UseMutationOptions<string | undefined, Error, {
to: string;
value: bigint;
}, unknown>, 'mutationKey' | 'mutationFn'>;
declare const useSendTransaction: (props?: UseSendTransactionProps) => {
sendTransaction: _tanstack_react_query.UseMutateFunction<string | undefined, Error, {
to: string;
value: bigint;
}, unknown>;
sendTransactionAsync: _tanstack_react_query.UseMutateAsyncFunction<string | undefined, Error, {
to: string;
value: bigint;
}, unknown>;
data: undefined;
variables: undefined;
error: null;
isError: false;
isIdle: true;
isPending: false;
isSuccess: false;
status: "idle";
reset: () => void;
context: unknown;
failureCount: number;
failureReason: Error | null;
isPaused: boolean;
submittedAt: number;
} | {
sendTransaction: _tanstack_react_query.UseMutateFunction<string | undefined, Error, {
to: string;
value: bigint;
}, unknown>;
sendTransactionAsync: _tanstack_react_query.UseMutateAsyncFunction<string | undefined, Error, {
to: string;
value: bigint;
}, unknown>;
data: undefined;
variables: {
to: string;
value: bigint;
};
error: null;
isError: false;
isIdle: false;
isPending: true;
isSuccess: false;
status: "pending";
reset: () => void;
context: unknown;
failureCount: number;
failureReason: Error | null;
isPaused: boolean;
submittedAt: number;
} | {
sendTransaction: _tanstack_react_query.UseMutateFunction<string | undefined, Error, {
to: string;
value: bigint;
}, unknown>;
sendTransactionAsync: _tanstack_react_query.UseMutateAsyncFunction<string | undefined, Error, {
to: string;
value: bigint;
}, unknown>;
data: undefined;
error: Error;
variables: {
to: string;
value: bigint;
};
isError: true;
isIdle: false;
isPending: false;
isSuccess: false;
status: "error";
reset: () => void;
context: unknown;
failureCount: number;
failureReason: Error | null;
isPaused: boolean;
submittedAt: number;
} | {
sendTransaction: _tanstack_react_query.UseMutateFunction<string | undefined, Error, {
to: string;
value: bigint;
}, unknown>;
sendTransactionAsync: _tanstack_react_query.UseMutateAsyncFunction<string | undefined, Error, {
to: string;
value: bigint;
}, unknown>;
data: string | undefined;
error: null;
variables: {
to: string;
value: bigint;
};
isError: false;
isIdle: false;
isPending: false;
isSuccess: true;
status: "success";
reset: () => void;
context: unknown;
failureCount: number;
failureReason: Error | null;
isPaused: boolean;
submittedAt: number;
};
type UseSignMessageProps = Omit<UseMutationOptions<string | undefined, unknown, {
message: string;
}, unknown>, 'mutationKey' | 'mutationFn'>;
declare const useSignMessage: (props?: UseSignMessageProps) => {
signMessage: _tanstack_react_query.UseMutateFunction<string | undefined, unknown, {
message: string;
}, unknown>;
signMessageAsync: _tanstack_react_query.UseMutateAsyncFunction<string | undefined, unknown, {
message: string;
}, unknown>;
data: undefined;
variables: undefined;
error: null;
isError: false;
isIdle: true;
isPending: false;
isSuccess: false;
status: "idle";
reset: () => void;
context: unknown;
failureCount: number;
failureReason: unknown;
isPaused: boolean;
submittedAt: number;
} | {
signMessage: _tanstack_react_query.UseMutateFunction<string | undefined, unknown, {
message: string;
}, unknown>;
signMessageAsync: _tanstack_react_query.UseMutateAsyncFunction<string | undefined, unknown, {
message: string;
}, unknown>;
data: undefined;
variables: {
message: string;
};
error: null;
isError: false;
isIdle: false;
isPending: true;
isSuccess: false;
status: "pending";
reset: () => void;
context: unknown;
failureCount: number;
failureReason: unknown;
isPaused: boolean;
submittedAt: number;
} | {
signMessage: _tanstack_react_query.UseMutateFunction<string | undefined, unknown, {
message: string;
}, unknown>;
signMessageAsync: _tanstack_react_query.UseMutateAsyncFunction<string | undefined, unknown, {
message: string;
}, unknown>;
data: undefined;
error: unknown;
variables: {
message: string;
};
isError: true;
isIdle: false;
isPending: false;
isSuccess: false;
status: "error";
reset: () => void;
context: unknown;
failureCount: number;
failureReason: unknown;
isPaused: boolean;
submittedAt: number;
} | {
signMessage: _tanstack_react_query.UseMutateFunction<string | undefined, unknown, {
message: string;
}, unknown>;
signMessageAsync: _tanstack_react_query.UseMutateAsyncFunction<string | undefined, unknown, {
message: string;
}, unknown>;
data: string | undefined;
error: null;
variables: {
message: string;
};
isError: false;
isIdle: false;
isPending: false;
isSuccess: true;
status: "success";
reset: () => void;
context: unknown;
failureCount: number;
failureReason: unknown;
isPaused: boolean;
submittedAt: number;
};
type UseWaitForTransactionReceiptProps = Omit<UseQueryOptions<any, Error, any, (string | undefined)[]>, 'initialData' | 'queryFn' | 'queryKey' | 'enabled'> & {
/** The hash of the transaction. */
hash?: string;
};
declare const useWaitForTransactionReceipt: ({ hash, ...props }?: UseWaitForTransactionReceiptProps) => _tanstack_react_query.UseQueryResult<any, Error>;
export { BitcoinScriptType, type FeeRateReturnType, LeatherConnector, MMSnapConnector, type PsbtInputAccounts, SatsConnector, SatsWagmiConfig, UnisatConnector, type UseFeeEstimateProps, type UseFeeRateProps, XverseConnector, useAccount, useBalance, useConnect, useDisconnect, useFeeEstimate, useFeeRate, useSatsWagmi, useSendGatewayTransaction, useSendTransaction, useSignMessage, useWaitForTransactionReceipt };