bsv.Transaction-1
Class: Transaction
bsv.Transaction
Hierarchy
Transaction
Table of contents
Constructors
Properties
Methods
- _estimateFee
- _getUnspentValue
- addData
- addDummyInput
- addInput
- addInputFromPrevTx
- addOutput
- applySignature
- change
- checkFeeRate
- dummyChange
- enableRBF
- fee
- feePerKb
- from
- fromBuffer
- fromString
- getChangeAddress
- getChangeAmount
- getChangeOutput
- getEstimateFee
- getFee
- getInputAmount
- getLockTime
- getOutputAmount
- getPreimage
- getSerializationError
- getSignature
- hasWitnesses
- inspect
- isCoinbase
- isFullySigned
- isRBF
- isSealed
- lockUntilBlockHeight
- lockUntilDate
- prevouts
- seal
- sealAsync
- serialize
- setInputScript
- setInputScriptAsync
- setInputSequence
- setLockTime
- setOutput
- sign
- to
- toBuffer
- toObject
- uncheckedSerialize
- verify
- verifyInputScript
- verifyScript
- verifySignature
Constructors
constructor
• new Transaction(raw?
)
Parameters
Name | Type |
---|---|
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
Name | Type |
---|---|
value | string | Buffer |
Returns
Defined in
node_modules/bsv/index.d.ts:933
addDummyInput
▸ addDummyInput(script
, satoshis
): Transaction
Parameters
Name | Type |
---|---|
script | Script |
satoshis | number |
Returns
Defined in
node_modules/bsv/index.d.ts:987
addInput
▸ addInput(input
, outputScript?
, satoshis?
): Transaction
Parameters
Name | Type |
---|---|
input | Input |
outputScript? | string | Script |
satoshis? | number |
Returns
Defined in
node_modules/bsv/index.d.ts:927
addInputFromPrevTx
▸ addInputFromPrevTx(prevTx
, outputIndex?
): Transaction
Parameters
Name | Type |
---|---|
prevTx | Transaction |
outputIndex? | number |
Returns
Defined in
node_modules/bsv/index.d.ts:986
addOutput
▸ addOutput(output
): Transaction
Parameters
Name | Type |
---|---|
output | Output |
Returns
Defined in
node_modules/bsv/index.d.ts:932
applySignature
▸ applySignature(sig
): Transaction
Parameters
Name | Type |
---|---|
sig | Object |
sig.inputIndex | number |
sig.publicKey | PublicKey |
sig.signature | Signature |
sig.sigtype | number |
Returns
Defined in
node_modules/bsv/index.d.ts:925
change
▸ change(address
): Transaction
Parameters
Name | Type |
---|---|
address | string | Address |
Returns
Defined in
node_modules/bsv/index.d.ts:918
checkFeeRate
▸ checkFeeRate(feePerKb?
): boolean
Parameters
Name | Type |
---|---|
feePerKb? | number |
Returns
boolean
Defined in
node_modules/bsv/index.d.ts:982
dummyChange
▸ dummyChange(): Transaction
Returns
Defined in
node_modules/bsv/index.d.ts:988
enableRBF
▸ enableRBF(): Transaction
Returns
Defined in
node_modules/bsv/index.d.ts:947
fee
▸ fee(amount
): Transaction
Parameters
Name | Type |
---|---|
amount | number |
Returns
Defined in
node_modules/bsv/index.d.ts:919
feePerKb
▸ feePerKb(amount
): Transaction
Parameters
Name | Type |
---|---|
amount | number |
Returns
Defined in
node_modules/bsv/index.d.ts:920
from
▸ from(utxos
): Transaction
Parameters
Name | Type |
---|---|
utxos | IUnspentOutput | IUnspentOutput [] |
Returns
Defined in
node_modules/bsv/index.d.ts:912
fromBuffer
▸ fromBuffer(buffer
): Transaction
Parameters
Name | Type |
---|---|
buffer | Buffer |
Returns
Defined in
node_modules/bsv/index.d.ts:916
fromString
▸ fromString(rawTxHex
): Transaction
Parameters
Name | Type |
---|---|
rawTxHex | string |
Returns
Defined in
node_modules/bsv/index.d.ts:915
getChangeAddress
▸ getChangeAddress(): Address
Returns
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
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
Name | Type |
---|---|
inputIndex | number |
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
Name | Type |
---|---|
outputIndex | number |
Returns
number
Defined in
node_modules/bsv/index.d.ts:1004
getPreimage
▸ getPreimage(inputIndex
, sigtype?
, isLowS?
): string
Parameters
Name | Type |
---|---|
inputIndex | number |
sigtype? | number |
isLowS? | boolean |
Returns
string
Defined in
node_modules/bsv/index.d.ts:985
getSerializationError
▸ getSerializationError(opts?
): any
Parameters
Name | Type |
---|---|
opts? | object |
Returns
any
Defined in
node_modules/bsv/index.d.ts:959
getSignature
▸ getSignature(inputIndex
, privateKey?
, sigtype?
): string
| string
[]
Parameters
Name | Type |
---|---|
inputIndex | number |
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
Name | Type |
---|---|
height | number |
Returns
Defined in
node_modules/bsv/index.d.ts:935
lockUntilDate
▸ lockUntilDate(time
): Transaction
Parameters
Name | Type |
---|---|
time | number | Date |
Returns
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
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
Name | Type |
---|---|
opts? | object |
Returns
string
Defined in
node_modules/bsv/index.d.ts:951
setInputScript
▸ setInputScript(inputIndex
, unlockingScript
): Transaction
Parameters
Name | Type |
---|---|
inputIndex | number | { inputIndex : number ; isLowS? : boolean ; privateKey? : PrivateKey | PrivateKey [] ; sigtype? : number } |
unlockingScript | Script | (tx : Transaction , outputInPrevTx : Output ) => Script |
Returns
Defined in
node_modules/bsv/index.d.ts:964
setInputScriptAsync
▸ setInputScriptAsync(inputIndex
, callback
): Promise
<Transaction
>
Parameters
Name | Type |
---|---|
inputIndex | number | { 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
Name | Type |
---|---|
inputIndex | number |
sequence | number |
Returns
Defined in
node_modules/bsv/index.d.ts:975
setLockTime
▸ setLockTime(t
): Transaction
Parameters
Name | Type |
---|---|
t | number |
Returns
Defined in
node_modules/bsv/index.d.ts:942
setOutput
▸ setOutput(outputIndex
, output
): Transaction
Parameters
Name | Type |
---|---|
outputIndex | number |
output | Output | (tx : Transaction ) => Output |
Returns
Defined in
node_modules/bsv/index.d.ts:976
sign
▸ sign(privateKey
, sigtype?
): Transaction
Parameters
Name | Type |
---|---|
privateKey | string | string [] | PrivateKey | PrivateKey [] |
sigtype? | number |
Returns
Defined in
node_modules/bsv/index.d.ts:921
to
▸ to(address
, amount
): Transaction
Parameters
Name | Type |
---|---|
address | string | Address | Address [] |
amount | number |
Returns
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
Name | Type |
---|---|
inputIndex | number |
Returns
Object
Name | Type |
---|---|
error | string |
failedAt | any |
success | boolean |
Defined in
node_modules/bsv/index.d.ts:993
verifyScript
▸ verifyScript(inputIndex
): Object
Parameters
Name | Type |
---|---|
inputIndex | number |
Returns
Object
Name | Type |
---|---|
error | string |
failedAt | any |
success | boolean |
Defined in
node_modules/bsv/index.d.ts:998
verifySignature
▸ verifySignature(sig
, pubkey
, nin
, subscript
, satoshisBN
, flags
): boolean
Parameters
Name | Type |
---|---|
sig | Signature |
pubkey | PublicKey |
nin | number |
subscript | Script |
satoshisBN | BN |
flags | number |
Returns
boolean
Defined in
node_modules/bsv/index.d.ts:926