@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
81 lines (80 loc) • 2.53 kB
TypeScript
/// <reference types="node" />
import * as bitcoin from "./bitcoinjs-lib";
export type InscriptionRefundFeeData = {
contentType: string;
body: string | Buffer;
revealAddr: string;
};
export type PrevOutput = {
txId: string;
vOut: number;
amount: number;
address: string;
privateKey: string;
publicKey?: string;
};
export type InscriptionRefundFeeRequest = {
inputs: PrevOutput[];
feeRate: number;
inscriptionRefundFeeDataList: InscriptionRefundFeeData[];
changeAddress: string;
minChangeValue?: number;
shareData?: string;
masterPublicKey?: string;
chainCode?: string;
commitTx?: string;
signatureList?: string[];
middleAddress?: string;
maxAmountOfInput?: number;
};
export type InscribeTxs = {
commitTx: string;
revealTxs: string[];
commitTxFee: number;
revealTxFees: number[];
commitAddrs: string[];
};
export type TxOut = {
pkScript: Buffer;
value: number;
};
type InscriptionTxCtxData = {
privateKey: Buffer;
inscriptionScript: Buffer;
commitTxAddress: string;
commitTxAddressPkScript: Buffer;
witness: Buffer[];
hash: Buffer;
revealTxPrevOutput: TxOut;
revealPkScript: Buffer;
};
export declare class InscriptionRefundFeeTool {
network: bitcoin.Network;
inscriptionTxCtxDataList: InscriptionTxCtxData[];
refundFeeTx: bitcoin.Transaction;
commitTxPrevOutputFetcher: number[];
revealTxPrevOutputFetcher: number[];
mustTxFee: number;
dustChange: number;
commitAddrs: string[];
merkleRoot: Uint8Array;
static newInscriptionRefundFeeTool(network: bitcoin.Network, request: InscriptionRefundFeeRequest): InscriptionRefundFeeTool;
buildrRefundFeeTx(network: bitcoin.Network, prevOutputList: PrevOutput[], changeAddress: string, totalRevealPrevOutputValue: number, commitFeeRate: number, minChangeValue: number): boolean;
signRefundFeeTx(inputs: PrevOutput[]): void;
calculateFee(): {
refundFeeTxFee: number;
};
}
export declare function createInscriptionTxCtxData(network: bitcoin.Network, inscriptionData: InscriptionRefundFeeData, privateKeyWif: string): InscriptionTxCtxData;
export declare function inscribeRefundFee(network: bitcoin.Network, request: InscriptionRefundFeeRequest): {
refundFeeTx: string;
mustTxFee: number;
dustChange: number;
} | {
middleAddresses: string[];
refundFeeTxFee: number;
refundFeeTx: string;
mustTxFee?: undefined;
dustChange?: undefined;
};
export {};