@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
87 lines (86 loc) • 3.02 kB
TypeScript
/// <reference types="node" />
import * as bitcoin from "./bitcoinjs-lib";
import { Etching, RuneData } from "./type";
import { BtcXrcTypes } from "./common";
import { TxOut } from "./inscribe";
export type PrevOutput = {
txId: string;
vOut: number;
amount: number;
address: string;
privateKey: string;
publicKey?: string;
};
export type RunesMainInscriptionRequest = {
type: BtcXrcTypes;
commitTxPrevOutputList: PrevOutput[];
commitFeeRate: number;
revealFeeRate: number;
runeData: RuneData;
revealOutValue: number;
changeAddress: string;
minChangeValue?: number;
shareData?: string;
masterPublicKey?: string;
chainCode?: string;
commitTx?: string;
signatureList?: string[];
};
export type RunesMainInscribeTxs = {
commitTx: string;
revealTxs: string[];
commitTxFee: number;
revealTxFees: number[];
commitAddrs: string[];
};
type RunesMainInscriptionTxCtxData = {
privateKey: Buffer;
inscriptionScript: Buffer;
commitTxAddress: string;
commitTxAddressPkScript: Buffer;
witness: Buffer[];
hash: Buffer;
revealTxPrevOutput: TxOut;
revealPkScript: Buffer;
runeOpReturnData?: Buffer;
};
export declare class RunesMainInscriptionTool {
network: bitcoin.Network;
inscriptionTxCtxDataList: RunesMainInscriptionTxCtxData[];
revealTxs: bitcoin.Transaction[];
commitTx: bitcoin.Transaction;
commitTxPrevOutputFetcher: number[];
revealTxPrevOutputFetcher: number[];
mustCommitTxFee: number;
mustRevealTxFees: number[];
commitAddrs: string[];
static newInscriptionTool(network: bitcoin.Network, request: RunesMainInscriptionRequest): RunesMainInscriptionTool;
buildEmptyRevealTx(network: bitcoin.Network, revealOutValue: number, revealFeeRate: number, opReturnData?: Buffer): number;
buildCommitTx(network: bitcoin.Network, commitTxPrevOutputList: PrevOutput[], changeAddress: string, totalRevealPrevOutputValue: number, commitFeeRate: number, minChangeValue: number): boolean;
signCommitTx(commitTxPrevOutputList: PrevOutput[]): void;
completeRevealTx(): void;
calculateFee(): {
commitTxFee: number;
revealTxFees: number[];
};
}
export declare const uint128Max: bigint;
export declare const uint64Max: bigint;
export declare const MAX_SPACERS = 134217727;
export declare function checkEtching(e: Etching): boolean;
export declare function runesMainInscribe(network: bitcoin.Network, request: RunesMainInscriptionRequest): {
commitAddrs: string[];
commitTxFee: number;
revealTxFees: number[];
commitTx: string;
revealTxs: string[];
};
export declare function inscribe(network: bitcoin.Network, request: RunesMainInscriptionRequest): {
commitAddrs: string[];
commitTxFee: number;
revealTxFees: number[];
commitTx: string;
revealTxs: string[];
};
export declare function buildRuneMainDeployData(etching: Etching, useDefaultOutput: boolean, defaultOutput: number): Buffer;
export {};