IExtPsbt
@opcat-labs/scrypt-ts-opcat v1.0.4
@opcat-labs/scrypt-ts-opcat / IExtPsbt
Interface: IExtPsbt
Defined in: packages/scrypt-ts-opcat/src/psbt/types.ts:69
Extended PSBT (Partially Signed Bitcoin Transaction) interface with additional contract-related functionality.
This interface extends the standard Psbt with methods for:
- Adding contract inputs/outputs
- Handling change outputs
- Estimating transaction size and fees
- Managing signatures
It provides a higher-level abstraction for working with smart contracts in Bitcoin transactions.
Extends
Psbt.Contextual
Properties
data
readonlydata:Psbt
Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:134
Inherited from
isFinalized
isFinalized:
boolean
Defined in: packages/scrypt-ts-opcat/src/smart-contract/types/context.ts:137
Whether the PSBT is finalized.
Inherited from
Contextual.isFinalized
isFinalizing
isFinalizing:
boolean
Defined in: packages/scrypt-ts-opcat/src/smart-contract/types/context.ts:132
Whether the PSBT starts finalizing.
Inherited from
Contextual.isFinalizing
isSealed
isSealed:
boolean
Defined in: packages/scrypt-ts-opcat/src/smart-contract/types/context.ts:142
Whether the PSBT is sealed.
Inherited from
Contextual.isSealed
unsignedTx
unsignedTx:
Transaction
Defined in: packages/scrypt-ts-opcat/src/psbt/types.ts:108
The unsigned transaction when the PSBT is not finalized. note:
Accessors
inputCount
Get Signature
get inputCount():
number
Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:180
Returns
number
Inherited from
locktime
Get Signature
get locktime():
number
Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:192
Returns
number
Set Signature
set locktime(
locktime):void
Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:196
Parameters
locktime
number
Returns
void
Inherited from
txInputs
Get Signature
get txInputs():
PsbtTxInput[]
Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:200
Returns
PsbtTxInput[]
Inherited from
txOutputs
Get Signature
get txOutputs():
PsbtTxOutput[]
Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:208
Returns
PsbtTxOutput[]
Inherited from
version
Get Signature
get version():
number
Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:184
Returns
number
Set Signature
set version(
version):void
Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:188
Parameters
version
number
Returns
void
Inherited from
Methods
addContractInput()
addContractInput\<
Contract>(contract,contractCall):this
Defined in: packages/scrypt-ts-opcat/src/psbt/types.ts:75
Add an input to spend the contract.
Type Parameters
• Contract extends SmartContract\<StructObject>
Parameters
contract
Contract
the contract
contractCall
ContractCall\<Contract>
the contract call function, such as (contract: Counter) => { contract.increase() }, used to determine how to unlock the contract.
Returns
this
addContractOutput()
addContractOutput(
contract,satoshis):this
Defined in: packages/scrypt-ts-opcat/src/psbt/types.ts:82
Add an output to create new contract.
Parameters
contract
SmartContract\<StructObject>
a new contract
satoshis
number
the output includes the amount of satoshis.
Returns
this
addInput()
addInput(
inputData):this
Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:284
Parameters
inputData
PsbtInputExtended
Returns
this
Inherited from
addInputs()
addInputs(
inputDatas):this
Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:279
Parameters
inputDatas
PsbtInputExtended[]
Returns
this
Inherited from
addOutput()
addOutput(
outputData):this
Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:317
Parameters
outputData
PsbtOutputExtended & object
Returns
this
Inherited from
addOutputs()
addOutputs(
outputDatas):this
Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:312
Parameters
outputDatas
PsbtOutputExtended[]
Returns
this
Inherited from
addUnknownKeyValToGlobal()
addUnknownKeyValToGlobal(
keyVal):this
Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:805
Parameters
keyVal
KeyValue
Returns
this
Inherited from
addUnknownKeyValToInput()
addUnknownKeyValToInput(
inputIndex,keyVal):this
Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:810
Parameters
inputIndex
number
keyVal
KeyValue
Returns
this
Inherited from
addUnknownKeyValToOutput()
addUnknownKeyValToOutput(
outputIndex,keyVal):this
Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:815
Parameters
outputIndex
number
keyVal
KeyValue
Returns
this
Inherited from
change()
change(
address,feeRate,data?):this
Defined in: packages/scrypt-ts-opcat/src/psbt/types.ts:90
Add a change output to the transaction if neccesarry.
Parameters
address
string
the address to send the change to
feeRate
number
the fee rate in satoshi per byte
data?
Uint8Array
optional data to be included in the change output
Returns
this
clearFinalizedInput()
clearFinalizedInput(
inputIndex):this
Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:820
Parameters
inputIndex
number
Returns
this
Inherited from
clone()
clone():
Psbt
Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:237
Returns
Inherited from
combine()
combine(...
those):this
Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:232
Parameters
those
...Psbt[]
Returns
this
Inherited from
estimateFee()
estimateFee(
feeRate):number
Defined in: packages/scrypt-ts-opcat/src/psbt/types.ts:102
Estimate the fee of the transaction.
Parameters
feeRate
number
the fee rate in satoshi per byte
Returns
number
the estimated fee in satoshis
estimateSize()
estimateSize():
number
Defined in: packages/scrypt-ts-opcat/src/psbt/types.ts:95
Estimate the size of the transaction.
Returns
number
extractTransaction()
extractTransaction(
disableFeeCheck?):Transaction
Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:348
Parameters
disableFeeCheck?
boolean
Returns
Inherited from
finalizeAllInputs()
finalizeAllInputs():
this
Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:378
Returns
this
Inherited from
finalizeInput()
finalizeInput(
inputIndex,finalScriptsFunc?):this
Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:384
Parameters
inputIndex
number
finalScriptsFunc?
FinalScriptsFunc
Returns
this
Inherited from
getB2GInputUtxo()
getB2GInputUtxo(
inputIndex):B2GUTXO
Defined in: packages/scrypt-ts-opcat/src/smart-contract/types/context.ts:155
Get the b2g contract utxo of the current input
Parameters
inputIndex
number
the index of the input in the PSBT
Returns
the stateful contract utxo of the current input
Inherited from
Contextual.getB2GInputUtxo
getChangeInfo()
getChangeInfo():
TxOut
Defined in: packages/scrypt-ts-opcat/src/smart-contract/types/context.ts:127
Get the change output information.
Returns
Inherited from
Contextual.getChangeInfo
getFee()
getFee():
bigint
Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:369
Returns
bigint
Inherited from
getFeeRate()
getFeeRate():
number
Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:360
Returns
number
Inherited from
getInputCtx()
getInputCtx(
inputIndex):InputContext
Defined in: packages/scrypt-ts-opcat/src/smart-contract/types/context.ts:93
Get the context of the current PSBT input in which this contract is called or spent.
Parameters
inputIndex
number
the index of the input in the PSBT
Returns
InputContext
the context of the current PSBT input
Inherited from
Contextual.getInputCtx
getInputOutput()
getInputOutput(
inputIndex):OpcatUtxo
Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:228
Parameters
inputIndex
number
The index of the input to get the output for.
Returns
The previous output of the input.
Inherited from
getInputType()
getInputType(
inputIndex):AllScriptType
Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:421
Parameters
inputIndex
number
Returns
AllScriptType
Inherited from
getlockTime()
getlockTime():
number
Defined in: packages/scrypt-ts-opcat/src/smart-contract/types/context.ts:99
Get the lockTime of the current PSBT.
Returns
number
lockTime of the current PSBT input
Inherited from
Contextual.getlockTime
getSequence()
getSequence(
inputIndex):number
Defined in: packages/scrypt-ts-opcat/src/smart-contract/types/context.ts:106
Get the sequence of the input by inputIndex.
Parameters
inputIndex
number
the index of the input in the PSBT
Returns
number
the sequence of the PSBT input
Inherited from
Contextual.getSequence
getSig()
getSig(
inputIndex,options):Sig
Defined in: packages/scrypt-ts-opcat/src/psbt/types.ts:116
Get signature from signed psbt by inputIndex
Parameters
inputIndex
number
index of the input
options
Omit\<ToSignInput, "index">
options to find signatures
Returns
the signature, if no signature found, return a dummy signature.
getSigHashType()
getSigHashType(
inputIndex):SigHashType
Defined in: packages/scrypt-ts-opcat/src/smart-contract/types/context.ts:122
Get the sighash type for the current input.
Parameters
inputIndex
number
the index of the input in the PSBT
Returns
the sighash type for the current input
Inherited from
Contextual.getSigHashType
getSpentDataHashes()
getSpentDataHashes():
ByteString
Defined in: packages/scrypt-ts-opcat/src/smart-contract/types/context.ts:148
Get the output state hashes of the current transaction
Returns
the output state hashes of the current transaction
Inherited from
Contextual.getSpentDataHashes
inputHasHDKey()
inputHasHDKey(
inputIndex,root):boolean
Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:437
Parameters
inputIndex
number
root
HDSigner
Returns
boolean
Inherited from
inputHasPubkey()
inputHasPubkey(
inputIndex,pubkey):boolean
Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:432
Parameters
inputIndex
number
pubkey
Uint8Array
Returns
boolean
Inherited from
outputHasHDKey()
outputHasHDKey(
outputIndex,root):boolean
Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:449
Parameters
outputIndex
number
root
HDSigner
Returns
boolean
Inherited from
outputHasPubkey()
outputHasPubkey(
outputIndex,pubkey):boolean
Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:445
Parameters
outputIndex
number
pubkey
Uint8Array
Returns
boolean
Inherited from
setInputSequence()
setInputSequence(
inputIndex,sequence):this
Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:267
Parameters
inputIndex
number
sequence
number
Returns
this
Inherited from
setLocktime()
setLocktime(
locktime):this
Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:258
Parameters
locktime
number
Returns
this
Inherited from
setMaximumFeeRate()
setMaximumFeeRate(
satoshiPerByte):void
Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:244
Parameters
satoshiPerByte
number
Returns
void
Inherited from
setSighashType()
setSighashType(
inputIndex,sigHashType):void
Defined in: packages/scrypt-ts-opcat/src/smart-contract/types/context.ts:115
Set the sighash type for the current input.
used for @method decorator to set the sighash type for the current input.
sighash type is used to generate the preimage for the current input.
Parameters
inputIndex
number
the index of the input in the PSBT
sigHashType
the sighash type to set
Returns
void
Inherited from
Contextual.setSighashType
setVersion()
setVersion(
version):this
Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:249
Parameters
version
number
Returns
this
Inherited from
signAllInputs()
signAllInputs(
keyPair,sighashTypes?):this
Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:605
Parameters
keyPair
Signer
sighashTypes?
number[]
Returns
this
Inherited from
signAllInputsAsync()
signAllInputsAsync(
keyPair,sighashTypes?):Promise\<void>
Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:627
Parameters
keyPair
Signer | SignerAsync
sighashTypes?
number[]
Returns
Promise\<void>
Inherited from
signAllInputsHD()
signAllInputsHD(
hdKeyPair,sighashTypes):this
Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:512
Parameters
hdKeyPair
HDSigner
sighashTypes
number[] = ...
Returns
this
Inherited from
signAllInputsHDAsync()
signAllInputsHDAsync(
hdKeyPair,sighashTypes):Promise\<void>
Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:535
Parameters
hdKeyPair
HDSigner | HDSignerAsync
sighashTypes
number[] = ...
Returns
Promise\<void>
Inherited from
signAndFinalize()
signAndFinalize(
singer):Promise\<void>
Defined in: packages/scrypt-ts-opcat/src/psbt/types.ts:123
Signs the PSBT with the provided signer and finalizes all inputs.
Parameters
singer
Returns
Promise\<void>
A promise that resolves when signing and finalization are complete.
signInput()
signInput(
inputIndex,keyPair,sighashTypes?):this
Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:661
Parameters
inputIndex
number
keyPair
Signer
sighashTypes?
number[]
Returns
this
Inherited from
signInputAsync()
signInputAsync(
inputIndex,keyPair,sighashTypes?):Promise\<void>
Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:694
Parameters
inputIndex
number
keyPair
Signer | SignerAsync
sighashTypes?
number[]
Returns
Promise\<void>
Inherited from
signInputHD()
signInputHD(
inputIndex,hdKeyPair,sighashTypes):this
Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:567
Parameters
inputIndex
number
hdKeyPair
HDSigner
sighashTypes
number[] = ...
Returns
this
Inherited from
signInputHDAsync()
signInputHDAsync(
inputIndex,hdKeyPair,sighashTypes):Promise\<void>
Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:584
Parameters
inputIndex
number
hdKeyPair
HDSigner | HDSignerAsync
sighashTypes
number[] = ...
Returns
Promise\<void>
Inherited from
toBase64()
toBase64():
string
Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:784
Returns
string
Inherited from
toBuffer()
toBuffer():
Uint8Array
Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:772
Returns
Uint8Array
Inherited from
toHex()
toHex():
string
Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:778
Returns
string
Inherited from
updateGlobal()
updateGlobal(
updateData):this
Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:790
Parameters
updateData
PsbtGlobalUpdate
Returns
this
Inherited from
updateInput()
updateInput(
inputIndex,updateData):this
Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:795
Parameters
inputIndex
number
updateData
PsbtInputUpdate
Returns
this
Inherited from
updateOutput()
updateOutput(
outputIndex,updateData):this
Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:800
Parameters
outputIndex
number
updateData
PsbtOutputUpdate
Returns
this
Inherited from
validateSignaturesOfAllInputs()
validateSignaturesOfAllInputs(
validator):boolean
Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:457
Parameters
validator
ValidateSigFunction
Returns
boolean
Inherited from
Psbt.validateSignaturesOfAllInputs
validateSignaturesOfInput()
validateSignaturesOfInput(
inputIndex,validator,pubkey?):boolean
Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:465
Parameters
inputIndex
number
validator
ValidateSigFunction
pubkey?
Uint8Array
Returns
boolean