@okxweb3/coin-bitcoin
Version:
@okxweb3/coin-bitcoin is a Bitcoin SDK for building Web3 wallets and applications. It supports BTC, BSV, DOGE, LTC, and TBTC, enabling private key management, transaction signing, address generation, and inscriptions like BRC-20, Runes, CAT, and Atomicals
135 lines (134 loc) • 2.93 kB
TypeScript
/// <reference types="node" />
type utxoInput = {
txId: string;
vOut: number;
amount: number;
address?: string;
reedScript?: string;
privateKey?: string;
publicKey?: string;
sequence?: number;
nonWitnessUtxo?: string;
bip32Derivation?: Bip32Derivation[];
derivationPath?: string;
sighashType?: number;
data?: any;
};
type Bip32Derivation = {
masterFingerprint: string;
pubkey: string;
path: string;
leafHashes?: string[];
};
type utxoOutput = {
address: string;
amount: number;
omniScript?: string;
bip32Derivation?: Bip32Derivation[];
derivationPath?: string;
isChange?: boolean;
data?: any;
};
type omniOutput = {
coinType?: number;
amount: number;
};
type utxoTx = {
inputs: [];
outputs: [];
address: string;
feePerB?: number;
decimal?: number;
fee?: number;
omni?: omniOutput;
dustSize?: number;
bip32Derivation?: Bip32Derivation[];
derivationPath?: string;
memo?: string;
memoPos?: number;
runeData?: RuneData;
};
type RuneData = {
edicts?: Edict[];
etching?: Etching;
useDefaultOutput?: boolean;
defaultOutput?: number;
burn?: boolean;
mint?: boolean;
mintNum?: number;
serialMint?: boolean;
revealAddr?: string;
};
type Etching = {
divisibility?: number;
premine?: bigint;
rune: Rune;
spacers?: number;
symbol?: string;
terms?: Terms;
turbo?: boolean;
contentType?: string;
body?: string | Buffer;
};
type Terms = {
amount?: bigint;
cap?: bigint;
height?: Range;
offset?: Range;
};
type Range = {
start?: bigint;
end?: bigint;
};
type Rune = {
value: bigint | string;
};
type Edict = {
block?: number;
id: number;
amount: bigint | string;
output: number;
};
type ListingData = {
nftAddress: string;
nftUtxo: {
txHash: string;
vout: number;
coinAmount: number;
rawTransation: string;
};
receiveBtcAddress: string;
price: number;
};
type BuyingData = {
dummyUtxos: {
txHash: string;
vout: number;
coinAmount: number;
rawTransation: string;
}[];
paymentUtxos: {
txHash: string;
vout: number;
coinAmount: number;
rawTransation: string;
}[];
receiveNftAddress: string;
paymentAndChangeAddress: string;
feeRate: number;
sellerPsbts: string[];
};
type toSignInput = {
index: number;
address?: string;
publicKey?: string;
sighashTypes?: number[];
tapLeafHashToSign?: string;
disableTweakSigner?: boolean;
useTweakSigner?: boolean;
};
type signPsbtOptions = {
autoFinalized?: boolean;
toSignInputs?: toSignInput[];
};
export { utxoInput, utxoOutput, omniOutput, utxoTx, ListingData, BuyingData, RuneData, Edict, Etching, Terms, Range, Rune, toSignInput, signPsbtOptions };