UNPKG

@secux/app-btc

Version:
66 lines (62 loc) 2.65 kB
/*! Copyright 2022 SecuX Technology Inc Copyright Chen Wei-En Copyright Wu Tsung-Yu Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /// <reference types="node" /> /// <reference types="node" /> import { BigNumber } from "bignumber.js"; export { Transaction, varSliceSize }; declare class Transaction { static readonly DEFAULT_SEQUENCE = 4294967295; static readonly SIGHASH_DEFAULT = 0; static readonly SIGHASH_ALL = 1; static readonly SIGHASH_NONE = 2; static readonly SIGHASH_SINGLE = 3; static readonly SIGHASH_ANYONECANPAY = 128; static readonly SIGHASH_OUTPUT_MASK = 3; static readonly SIGHASH_INPUT_MASK = 128; static readonly ADVANCED_TRANSACTION_MARKER = 0; static readonly ADVANCED_TRANSACTION_FLAG = 1; version: number; locktime: number; ins: Array<{ hash: Buffer; index: number; script: Buffer; sequence: number; witness: Array<Buffer>; }>; outs: Array<{ script: Buffer; value: BigNumber.Value; path?: string; }>; constructor(); static fromBuffer(buffer: Buffer): Transaction; static dataForSignature(trans: Transaction, inIndex: number, prevOutScript: Buffer, hashType: number): Buffer; static dataForWitnessV0(trans: Transaction, inIndex: number, prevOutScript: Buffer, value: number, hashType: number): Buffer; static dataForWitnessV1(trans: Transaction, inIndex: number, prevOutScripts: Buffer[], values: number[], hashType: number, leafHash?: Buffer, annex?: Buffer): Buffer; static getHash(trans: Transaction, forWitness?: boolean): Buffer; static getId(trans: Transaction): string; addInput(hash: Buffer, index: number, sequence?: number, scriptSig?: Buffer): void; addOutput(scriptPubKey: Buffer, value: BigNumber.Value, path?: string): void; toBuffer(buffer?: Buffer, initialOffset?: number, _ALLOW_WITNESS?: boolean): Buffer; toHex(): string; hasWitnesses(): boolean; isCoinbase(): boolean; clone(): Transaction; weight(): number; virtualSize(): number; byteLength(_ALLOW_WITNESS?: boolean): number; } declare function varSliceSize(someScript: Buffer): number;