charms-wallet-js
Version:
Professional Bitcoin wallet library for Charms ecosystem using @scure stack
158 lines • 3.82 kB
TypeScript
export type Network = 'mainnet' | 'testnet' | 'testnet4';
export interface WalletData {
mnemonic: string;
address: string;
created: string;
network: Network;
}
export interface KeyPair {
privateKey: Uint8Array;
publicKey: Uint8Array;
xOnlyPubkey: Uint8Array;
}
export interface TaprootKeys {
privateKey: Uint8Array;
publicKey: Uint8Array;
xOnlyPubkey: Uint8Array;
address: string;
tweakedPrivateKey?: Uint8Array;
}
export interface UTXO {
txid: string;
vout: number;
amount: number;
address: string;
scriptPubKey?: string;
confirmations?: number;
}
export interface Output {
address: string;
amount: number;
}
export interface MiningData {
hash: string;
nonce: number;
}
export interface MiningTxParams {
utxo: UTXO;
miningData: MiningData;
changeAddress: string;
network?: Network;
feeRate?: number;
}
export interface SimpleTxParams {
utxos: UTXO[];
outputs: Output[];
changeAddress: string;
network?: Network;
feeRate?: number;
}
export interface SignedTransaction {
txid: string;
hex: string;
size: number;
vsize: number;
fee: number;
}
export interface TransactionResult {
success: boolean;
txid?: string;
hex?: string;
error?: string;
size?: number;
vsize?: number;
fee?: number;
}
export interface MonitorCallbacks {
onTransaction?: (utxo: UTXO) => void;
onStatus?: (status: MonitorStatus) => void;
onError?: (error: Error) => void;
}
export interface MonitorStatus {
message: string;
checking: boolean;
found: boolean;
utxoCount: number;
}
export type StopMonitorFunction = () => void;
export interface StorageOptions {
encrypt?: boolean;
password?: string;
storageKey?: string;
}
export interface EncryptedData {
data: string;
iv: string;
salt: string;
}
export interface ValidationResult {
valid: boolean;
error?: string;
}
export interface AddressValidation extends ValidationResult {
network?: Network;
type?: 'p2tr' | 'p2wpkh' | 'p2sh' | 'legacy';
}
export declare class CharmsWalletError extends Error {
readonly code: string;
readonly details?: any;
constructor(message: string, code: string, details?: any);
}
export declare class ValidationError extends CharmsWalletError {
constructor(message: string, details?: any);
}
export declare class TransactionError extends CharmsWalletError {
constructor(message: string, details?: any);
}
export declare class NetworkError extends CharmsWalletError {
constructor(message: string, details?: any);
}
export declare class CryptographyError extends CharmsWalletError {
constructor(message: string, details?: any);
}
export interface WalletConfig {
network: Network;
derivationPath?: string;
addressType?: 'taproot' | 'segwit';
storage?: StorageOptions;
}
export interface NetworkConfig {
name: Network;
bech32: string;
pubKeyHash: number;
scriptHash: number;
wif: number;
}
export interface APIResponse<T = any> {
success: boolean;
data?: T;
error?: string;
code?: number;
}
export interface BalanceResponse {
confirmed: number;
unconfirmed: number;
total: number;
}
export interface TransactionHistory {
txid: string;
confirmations: number;
time: number;
amount: number;
fee: number;
type: 'sent' | 'received';
}
export interface FeeEstimate {
fastestFee: number;
halfHourFee: number;
hourFee: number;
economyFee: number;
minimumFee: number;
}
export type Mnemonic = string;
export type Address = string;
export type PrivateKey = Uint8Array;
export type PublicKey = Uint8Array;
export type TransactionHex = string;
export type PSBTHex = string;
//# sourceMappingURL=types.d.ts.map