@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
64 lines (63 loc) • 2.85 kB
TypeScript
/// <reference types="node" />
import { CAT20, ProtocolState, TxOutpoint } from '@cat-protocol/cat-smartcontracts';
import { btc, SupportedNetwork } from '../common';
import { bsv, ByteString, ContractTransaction, SmartContract, TestWallet, UTXO } from 'scrypt-ts';
import { EcKeyService } from "./eckey";
export declare function toXOnly(pubkey: Buffer): Buffer;
export declare const byteStringToBuffer: (byteStringList: ByteString[]) => Buffer[];
export declare function strToByteString(s: string): ByteString;
export declare function contract2P2TR(contract: SmartContract): {
p2tr: string;
tapScript: string;
cblock: string;
script: string;
contract: SmartContract;
};
export declare function script2P2TR(script: Buffer): {
p2tr: string;
tapScript: string;
cblock: string;
};
export declare enum GuardType {
Transfer = 0,
Burn = 1
}
export declare function getGuardsP2TR(guardType?: GuardType): {
p2tr: string;
tapScript: string;
cblock: string;
script: string;
contract: SmartContract;
};
export declare function getTokenContract(minterP2TR: string, guardsP2TR: string): CAT20;
export declare function getTokenContractP2TR(minterP2TR: string): {
p2tr: string;
tapScript: string;
cblock: string;
script: string;
contract: SmartContract;
};
export declare function toTxOutpoint(txid: string, outputIndex: number): TxOutpoint;
export declare function outpoint2TxOutpoint(outpoint: string): TxOutpoint;
export declare const outpoint2ByteString: (outpoint: string) => string;
export declare function getDummySigner(privateKey?: bsv.PrivateKey | bsv.PrivateKey[]): TestWallet;
export declare const dummyUTXO: {
txId: string;
outputIndex: number;
script: string;
satoshis: number;
};
export declare function getDummyUTXO(satoshis?: number, unique?: boolean): UTXO;
export declare const callToBufferList: (ct: ContractTransaction) => Buffer[];
export declare const toStateScript: (state: ProtocolState) => any;
export declare function toBitcoinNetwork(network: SupportedNetwork): btc.Network;
export declare function p2tr2Address(p2tr: string | btc.Script, network: SupportedNetwork): any;
export declare function toP2tr(address: string | btc.Address): string;
export declare function scaleByDecimals(amount: bigint, decimals: number): bigint;
export declare function unScaleByDecimals(amount: bigint, decimals: number): string;
export declare function resetTx(tx: btc.Transaction): void;
export declare function toTokenAddress(address: btc.Address | string): string;
export declare function verifyContract(utxo: UTXO, tx: btc.Transaction, inputIndex: number, witnesses: Buffer[]): string | true;
export declare function getDummyEcKey(): EcKeyService;
export declare function getDummySignature(): any;
export declare function getFee(tx: btc.Transaction): number;