Skip to main content

bsv.Transaction-1

scrypt-ts / bsv / Transaction

Class: Transaction

bsv.Transaction

Hierarchy

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new Transaction(raw?)

Parameters

NameType
raw?string

Defined in

node_modules/bsv/index.d.ts:910

Properties

_estimateSize

_estimateSize: number

Defined in

node_modules/bsv/index.d.ts:963


hash

Readonly hash: string

Defined in

node_modules/bsv/index.d.ts:904


id

Readonly id: string

Defined in

node_modules/bsv/index.d.ts:903


inputAmount

Readonly inputAmount: number

Defined in

node_modules/bsv/index.d.ts:905


inputs

inputs: Input[]

Defined in

node_modules/bsv/index.d.ts:901


nLockTime

nLockTime: number

Defined in

node_modules/bsv/index.d.ts:908


nid

nid: string

Defined in

node_modules/bsv/index.d.ts:907


outputAmount

Readonly outputAmount: number

Defined in

node_modules/bsv/index.d.ts:906


outputs

outputs: Output[]

Defined in

node_modules/bsv/index.d.ts:902


DUMMY_PRIVATEKEY

Static DUMMY_PRIVATEKEY: PrivateKey

Defined in

node_modules/bsv/index.d.ts:900

Methods

_estimateFee

_estimateFee(): number

Returns

number

Defined in

node_modules/bsv/index.d.ts:962


_getUnspentValue

_getUnspentValue(): number

Returns

number

Defined in

node_modules/bsv/index.d.ts:961


addData

addData(value): Transaction

Parameters

NameType
valuestring | Buffer

Returns

Transaction

Defined in

node_modules/bsv/index.d.ts:933


addDummyInput

addDummyInput(script, satoshis): Transaction

Parameters

NameType
scriptScript
satoshisnumber

Returns

Transaction

Defined in

node_modules/bsv/index.d.ts:987


addInput

addInput(input, outputScript?, satoshis?): Transaction

Parameters

NameType
inputInput
outputScript?string | Script
satoshis?number

Returns

Transaction

Defined in

node_modules/bsv/index.d.ts:927


addInputFromPrevTx

addInputFromPrevTx(prevTx, outputIndex?): Transaction

Parameters

NameType
prevTxTransaction
outputIndex?number

Returns

Transaction

Defined in

node_modules/bsv/index.d.ts:986


addOutput

addOutput(output): Transaction

Parameters

NameType
outputOutput

Returns

Transaction

Defined in

node_modules/bsv/index.d.ts:932


applySignature

applySignature(sig): Transaction

Parameters

NameType
sigObject
sig.inputIndexnumber
sig.publicKeyPublicKey
sig.signatureSignature
sig.sigtypenumber

Returns

Transaction

Defined in

node_modules/bsv/index.d.ts:925


change

change(address): Transaction

Parameters

NameType
addressstring | Address

Returns

Transaction

Defined in

node_modules/bsv/index.d.ts:918


checkFeeRate

checkFeeRate(feePerKb?): boolean

Parameters

NameType
feePerKb?number

Returns

boolean

Defined in

node_modules/bsv/index.d.ts:982


dummyChange

dummyChange(): Transaction

Returns

Transaction

Defined in

node_modules/bsv/index.d.ts:988


enableRBF

enableRBF(): Transaction

Returns

Transaction

Defined in

node_modules/bsv/index.d.ts:947


fee

fee(amount): Transaction

Parameters

NameType
amountnumber

Returns

Transaction

Defined in

node_modules/bsv/index.d.ts:919


feePerKb

feePerKb(amount): Transaction

Parameters

NameType
amountnumber

Returns

Transaction

Defined in

node_modules/bsv/index.d.ts:920


from

from(utxos): Transaction

Parameters

NameType
utxosIUnspentOutput | IUnspentOutput[]

Returns

Transaction

Defined in

node_modules/bsv/index.d.ts:912


fromBuffer

fromBuffer(buffer): Transaction

Parameters

NameType
bufferBuffer

Returns

Transaction

Defined in

node_modules/bsv/index.d.ts:916


fromString

fromString(rawTxHex): Transaction

Parameters

NameType
rawTxHexstring

Returns

Transaction

Defined in

node_modules/bsv/index.d.ts:915


getChangeAddress

getChangeAddress(): Address

Returns

Address

Defined in

node_modules/bsv/index.d.ts:940


getChangeAmount

getChangeAmount(): number

Returns

number

Defined in

node_modules/bsv/index.d.ts:980


getChangeOutput

getChangeOutput(): Output

Returns

Output

Defined in

node_modules/bsv/index.d.ts:939


getEstimateFee

getEstimateFee(): number

Returns

number

Defined in

node_modules/bsv/index.d.ts:981


getFee

getFee(): number

Returns

number

Defined in

node_modules/bsv/index.d.ts:938


getInputAmount

getInputAmount(inputIndex): number

Parameters

NameType
inputIndexnumber

Returns

number

Defined in

node_modules/bsv/index.d.ts:1003


getLockTime

getLockTime(): number | Date

Returns

number | Date

Defined in

node_modules/bsv/index.d.ts:941


getOutputAmount

getOutputAmount(outputIndex): number

Parameters

NameType
outputIndexnumber

Returns

number

Defined in

node_modules/bsv/index.d.ts:1004


getPreimage

getPreimage(inputIndex, sigtype?, isLowS?): string

Parameters

NameType
inputIndexnumber
sigtype?number
isLowS?boolean

Returns

string

Defined in

node_modules/bsv/index.d.ts:985


getSerializationError

getSerializationError(opts?): any

Parameters

NameType
opts?object

Returns

any

Defined in

node_modules/bsv/index.d.ts:959


getSignature

getSignature(inputIndex, privateKey?, sigtype?): string | string[]

Parameters

NameType
inputIndexnumber
privateKey?PrivateKey | PrivateKey[]
sigtype?number

Returns

string | string[]

Defined in

node_modules/bsv/index.d.ts:984


hasWitnesses

hasWitnesses(): boolean

Returns

boolean

Defined in

node_modules/bsv/index.d.ts:937


inspect

inspect(): string

Returns

string

Defined in

node_modules/bsv/index.d.ts:950


isCoinbase

isCoinbase(): boolean

Returns

boolean

Defined in

node_modules/bsv/index.d.ts:945


isFullySigned

isFullySigned(): boolean

Returns

boolean

Defined in

node_modules/bsv/index.d.ts:957


isRBF

isRBF(): boolean

Returns

boolean

Defined in

node_modules/bsv/index.d.ts:948


isSealed

isSealed(): boolean

Returns

boolean

Defined in

node_modules/bsv/index.d.ts:979


lockUntilBlockHeight

lockUntilBlockHeight(height): Transaction

Parameters

NameType
heightnumber

Returns

Transaction

Defined in

node_modules/bsv/index.d.ts:935


lockUntilDate

lockUntilDate(time): Transaction

Parameters

NameType
timenumber | Date

Returns

Transaction

Defined in

node_modules/bsv/index.d.ts:934


prevouts

prevouts(): string

Returns

string

Defined in

node_modules/bsv/index.d.ts:983


seal

seal(): Transaction

Returns

Transaction

Defined in

node_modules/bsv/index.d.ts:977


sealAsync

sealAsync(): Promise<Transaction>

Returns

Promise<Transaction>

Defined in

node_modules/bsv/index.d.ts:978


serialize

serialize(opts?): string

Parameters

NameType
opts?object

Returns

string

Defined in

node_modules/bsv/index.d.ts:951


setInputScript

setInputScript(inputIndex, unlockingScript): Transaction

Parameters

NameType
inputIndexnumber | { inputIndex: number ; isLowS?: boolean ; privateKey?: PrivateKey | PrivateKey[] ; sigtype?: number }
unlockingScriptScript | (tx: Transaction, outputInPrevTx: Output) => Script

Returns

Transaction

Defined in

node_modules/bsv/index.d.ts:964


setInputScriptAsync

setInputScriptAsync(inputIndex, callback): Promise<Transaction>

Parameters

NameType
inputIndexnumber | { inputIndex: number ; isLowS?: boolean ; sigtype?: number }
callback(tx: Transaction, outputInPrevTx: Output) => Promise<Script>

Returns

Promise<Transaction>

Defined in

node_modules/bsv/index.d.ts:970


setInputSequence

setInputSequence(inputIndex, sequence): Transaction

Parameters

NameType
inputIndexnumber
sequencenumber

Returns

Transaction

Defined in

node_modules/bsv/index.d.ts:975


setLockTime

setLockTime(t): Transaction

Parameters

NameType
tnumber

Returns

Transaction

Defined in

node_modules/bsv/index.d.ts:942


setOutput

setOutput(outputIndex, output): Transaction

Parameters

NameType
outputIndexnumber
outputOutput | (tx: Transaction) => Output

Returns

Transaction

Defined in

node_modules/bsv/index.d.ts:976


sign

sign(privateKey, sigtype?): Transaction

Parameters

NameType
privateKeystring | string[] | PrivateKey | PrivateKey[]
sigtype?number

Returns

Transaction

Defined in

node_modules/bsv/index.d.ts:921


to

to(address, amount): Transaction

Parameters

NameType
addressstring | Address | Address[]
amountnumber

Returns

Transaction

Defined in

node_modules/bsv/index.d.ts:917


toBuffer

toBuffer(): Buffer

Returns

Buffer

Defined in

node_modules/bsv/index.d.ts:955


toObject

toObject(): any

Returns

any

Defined in

node_modules/bsv/index.d.ts:954


uncheckedSerialize

uncheckedSerialize(): string

Returns

string

Defined in

node_modules/bsv/index.d.ts:952


verify

verify(): string | true

Returns

string | true

Defined in

node_modules/bsv/index.d.ts:944


verifyInputScript

verifyInputScript(inputIndex): Object

Deprecated

please use verifyScript instead

Parameters

NameType
inputIndexnumber

Returns

Object

NameType
errorstring
failedAtany
successboolean

Defined in

node_modules/bsv/index.d.ts:993


verifyScript

verifyScript(inputIndex): Object

Parameters

NameType
inputIndexnumber

Returns

Object

NameType
errorstring
failedAtany
successboolean

Defined in

node_modules/bsv/index.d.ts:998


verifySignature

verifySignature(sig, pubkey, nin, subscript, satoshisBN, flags): boolean

Parameters

NameType
sigSignature
pubkeyPublicKey
ninnumber
subscriptScript
satoshisBNBN
flagsnumber

Returns

boolean

Defined in

node_modules/bsv/index.d.ts:926