Skip to main content

ExtPsbt

@opcat-labs/scrypt-ts-opcat v1.0.4


@opcat-labs/scrypt-ts-opcat / ExtPsbt

Class: ExtPsbt

Defined in: packages/scrypt-ts-opcat/src/psbt/extPsbt.ts:99

Extends the standard Psbt class with additional functionality for OP_CAT transactions. Provides methods for:

  • Managing contract inputs/outputs
  • Handling UTXO spending
  • Calculating transaction fees and sizes
  • Finalizing and sealing transactions
  • Backtrace information for contract inputs
  • Change output management

Supports serialization to/from hex, base64 and buffer formats. Includes network-aware operations and signature handling.

Extends​

Implements​

Constructors​

new ExtPsbt()​

new ExtPsbt(opts, data?): ExtPsbt

Defined in: packages/scrypt-ts-opcat/src/psbt/extPsbt.ts:100

Parameters​

opts​

ExtPsbtOpts = {}

data?​

Psbt

Returns​

ExtPsbt

Overrides​

Psbt.constructor

Properties​

data​

readonly data: Psbt

Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:134

Implementation of​

IExtPsbt.data

Inherited from​

Psbt.data

Accessors​

hashSpentDatas​

Get Signature​

get hashSpentDatas(): ByteString

Defined in: packages/scrypt-ts-opcat/src/psbt/extPsbt.ts:235

Computes the hash of all spent data hashes in the PSBT. Concatenates all non-empty spent data hashes and returns their double SHA-256 hash.

Returns​

ByteString

The hash256 of all spent data hashes concatenated together.


inputAmount​

Get Signature​

get inputAmount(): bigint

Defined in: packages/scrypt-ts-opcat/src/psbt/extPsbt.ts:524

Gets the total input amount in satoshis as a bigint.

Returns​

bigint

The sum of all input values in the PSBT.


inputCount​

Get Signature​

get inputCount(): number

Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:180

Returns​

number

Implementation of​

IExtPsbt.inputCount

Inherited from​

Psbt.inputCount


isFinalized​

Get Signature​

get isFinalized(): boolean

Defined in: packages/scrypt-ts-opcat/src/psbt/extPsbt.ts:739

Checks if all inputs in the PSBT are finalized.

Returns​

boolean

True if all inputs are finalized, false otherwise.

Whether the PSBT is finalized.

Implementation of​

IExtPsbt.isFinalized


isFinalizing​

Get Signature​

get isFinalizing(): boolean

Defined in: packages/scrypt-ts-opcat/src/psbt/extPsbt.ts:672

Indicates whether the PSBT is currently in the process of being finalized.

Returns​

boolean

True if the PSBT is being finalized, false otherwise.

Whether the PSBT starts finalizing.

Implementation of​

IExtPsbt.isFinalizing


isSealed​

Get Signature​

get isSealed(): boolean

Defined in: packages/scrypt-ts-opcat/src/psbt/extPsbt.ts:680

Indicates whether the PSBT (Partially Signed Bitcoin Transaction) is sealed. A sealed PSBT cannot be modified further.

Returns​

boolean

Whether the PSBT is sealed.

Implementation of​

IExtPsbt.isSealed


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

Implementation of​

IExtPsbt.locktime

Inherited from​

Psbt.locktime


outputAmount​

Get Signature​

get outputAmount(): bigint

Defined in: packages/scrypt-ts-opcat/src/psbt/extPsbt.ts:535

Gets the total output amount of the PSBT transaction by summing up all output values.

Returns​

bigint

The sum of all output values as a bigint.


txInputs​

Get Signature​

get txInputs(): PsbtTxInput[]

Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:200

Returns​

PsbtTxInput[]

Implementation of​

IExtPsbt.txInputs

Inherited from​

Psbt.txInputs


txOutputs​

Get Signature​

get txOutputs(): PsbtTxOutput[]

Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:208

Returns​

PsbtTxOutput[]

Implementation of​

IExtPsbt.txOutputs

Inherited from​

Psbt.txOutputs


unsignedTx​

Get Signature​

get unsignedTx(): Transaction

Defined in: packages/scrypt-ts-opcat/src/psbt/extPsbt.ts:622

Gets the unsigned transaction from the PSBT's internal cache.

Returns​

Transaction

The raw unsigned transaction object.

The unsigned transaction when the PSBT is not finalized. note:

Implementation of​

IExtPsbt.unsignedTx


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

Implementation of​

IExtPsbt.version

Inherited from​

Psbt.version

Methods​

addContractInput()​

addContractInput\<Contract>(contract, contractCall): this

Defined in: packages/scrypt-ts-opcat/src/psbt/extPsbt.ts:393

Adds a contract input to the PSBT (Partially Signed Bitcoin Transaction).

Type Parameters​

• Contract extends SmartContract\<StructObject>

Parameters​

contract​

Contract

The smart contract instance to add as input.

contractCall​

ContractCall\<Contract>

The contract call containing the method and arguments.

Returns​

this

The PSBT instance for method chaining.

Throws​

Error if the contract does not have a bound UTXO.

Implementation of​

IExtPsbt.addContractInput


addContractOutput()​

addContractOutput\<Contract>(contract, satoshis): this

Defined in: packages/scrypt-ts-opcat/src/psbt/extPsbt.ts:502

Adds a contract output to the PSBT (Partially Signed Opcat Transaction).

Type Parameters​

• Contract extends SmartContract\<StructObject>

Type parameter extending SmartContract<OpcatState>

Parameters​

contract​

Contract

The smart contract instance to add as output

satoshis​

number

The amount in satoshis to lock in this output

Returns​

this

The PSBT instance for method chaining

Implementation of​

IExtPsbt.addContractOutput


addInput()​

addInput(inputData): this

Defined in: packages/scrypt-ts-opcat/src/psbt/extPsbt.ts:275

Adds an extended PSBT input with optional finalizer and signature requests.

  • Calls parent class's addInput method
  • Validates PSBT isn't sealed
  • If input has a finalizer, caches the unlock script and sets the finalizer callback
  • Processes any signature requests for the input

Parameters​

inputData​

PsbtInputExtended

Extended PSBT input data containing optional finalizer and sigRequests

Returns​

this

PSBT instance for chaining

Implementation of​

IExtPsbt.addInput

Overrides​

Psbt.addInput


addInputs()​

addInputs(inputDatas): this

Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:279

Parameters​

inputDatas​

PsbtInputExtended[]

Returns​

this

Implementation of​

IExtPsbt.addInputs

Inherited from​

Psbt.addInputs


addOutput()​

addOutput(outputData): this

Defined in: packages/scrypt-ts-opcat/src/psbt/extPsbt.ts:345

Adds an extended output to the PSBT.

Parameters​

outputData​

PsbtOutputExtended

The extended output data to add

Returns​

this

The PSBT instance for chaining

Throws​

Error if the PSBT is already sealed

Implementation of​

IExtPsbt.addOutput

Overrides​

Psbt.addOutput


addOutputs()​

addOutputs(outputDatas): this

Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:312

Parameters​

outputDatas​

PsbtOutputExtended[]

Returns​

this

Implementation of​

IExtPsbt.addOutputs

Inherited from​

Psbt.addOutputs


addUnknownKeyValToGlobal()​

addUnknownKeyValToGlobal(keyVal): this

Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:805

Parameters​

keyVal​

KeyValue

Returns​

this

Implementation of​

IExtPsbt.addUnknownKeyValToGlobal

Inherited from​

Psbt.addUnknownKeyValToGlobal


addUnknownKeyValToInput()​

addUnknownKeyValToInput(inputIndex, keyVal): this

Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:810

Parameters​

inputIndex​

number

keyVal​

KeyValue

Returns​

this

Implementation of​

IExtPsbt.addUnknownKeyValToInput

Inherited from​

Psbt.addUnknownKeyValToInput


addUnknownKeyValToOutput()​

addUnknownKeyValToOutput(outputIndex, keyVal): this

Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:815

Parameters​

outputIndex​

number

keyVal​

KeyValue

Returns​

this

Implementation of​

IExtPsbt.addUnknownKeyValToOutput

Inherited from​

Psbt.addUnknownKeyValToOutput


calculateBacktraceInfo()​

calculateBacktraceInfo(provider, prevPrevTxFinder?): Promise\<void>

Defined in: packages/scrypt-ts-opcat/src/psbt/extPsbt.ts:969

Calculates backtrace information for contract inputs in the PSBT.

Iterates through all inputs and collects backtrace info for contract inputs. Uses the provided provider to fetch previous transaction data when needed.

Parameters​

provider​

UtxoProvider & ChainProvider

Provider interface for fetching UTXO and chain data

prevPrevTxFinder?​

(prevTx, provider, inputIndex) => Promise\<string>

Optional function to find previous transactions

Returns​

Promise\<void>

Promise that resolves when all backtrace info is calculated


change()​

change(toAddr, feeRate, data?): this

Defined in: packages/scrypt-ts-opcat/src/psbt/extPsbt.ts:547

Adds or updates a change output to the PSBT.

Parameters​

toAddr​

string

The address to receive the change.

feeRate​

number

The fee rate to use for the change output.

data?​

Optional data to include in the output (hex string or Uint8Array).

string | Uint8Array

Returns​

this

The PSBT instance for chaining.

Implementation of​

IExtPsbt.change


clearFinalizedInput()​

clearFinalizedInput(inputIndex): this

Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:820

Parameters​

inputIndex​

number

Returns​

this

Implementation of​

IExtPsbt.clearFinalizedInput

Inherited from​

Psbt.clearFinalizedInput


clone()​

clone(): Psbt

Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:237

Returns​

Psbt

Implementation of​

IExtPsbt.clone

Inherited from​

Psbt.clone


combine()​

combine(...those): this

Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:232

Parameters​

those​

...Psbt[]

Returns​

this

Implementation of​

IExtPsbt.combine

Inherited from​

Psbt.combine


estimateFee()​

estimateFee(feeRate): number

Defined in: packages/scrypt-ts-opcat/src/psbt/extPsbt.ts:655

Estimates the transaction fee by multiplying the estimated size (in vbytes) by the given fee rate.

Parameters​

feeRate​

number

Fee rate in satoshis per virtual byte (sat/vbyte).

Returns​

number

The estimated fee amount in satoshis.

Implementation of​

IExtPsbt.estimateFee


estimateSize()​

estimateSize(): number

Defined in: packages/scrypt-ts-opcat/src/psbt/extPsbt.ts:646

Estimates the total size of the PSBT by summing the unsigned transaction size and the size of unfinalized call arguments.

Returns​

number

The estimated size in bytes.

Implementation of​

IExtPsbt.estimateSize


extractTransaction()​

extractTransaction(disableFeeCheck?): Transaction

Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:348

Parameters​

disableFeeCheck?​

boolean

Returns​

Transaction

Implementation of​

IExtPsbt.extractTransaction

Inherited from​

Psbt.extractTransaction


finalizeAllInputs()​

finalizeAllInputs(): this

Defined in: packages/scrypt-ts-opcat/src/psbt/extPsbt.ts:692

Finalizes all inputs in the PSBT by applying their respective finalizers. For each input, if a finalizer is present, it generates the unlocking script and creates a finalization function. After finalizing all inputs, it binds the contract UTXOs. Throws an error if any input fails to finalize.

Returns​

this

The current PSBT instance for chaining.

Implementation of​

IExtPsbt.finalizeAllInputs

Overrides​

Psbt.finalizeAllInputs


finalizeInput()​

finalizeInput(inputIndex, finalScriptsFunc?): this

Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:384

Parameters​

inputIndex​

number

finalScriptsFunc?​

FinalScriptsFunc

Returns​

this

Implementation of​

IExtPsbt.finalizeInput

Inherited from​

Psbt.finalizeInput


getB2GInputUtxo()​

getB2GInputUtxo(inputIndex): B2GUTXO

Defined in: packages/scrypt-ts-opcat/src/psbt/extPsbt.ts:875

Retrieves the B2G UTXO (Unspent Transaction Output) for a specific input index.

Parameters​

inputIndex​

number

The index of the input to retrieve the UTXO for.

Returns​

B2GUTXO

The B2G UTXO if found, otherwise undefined.

Implementation of​

IExtPsbt.getB2GInputUtxo


getBacktraceInfo()​

getBacktraceInfo(provider, inputIndex, prevPrevTxFinder): Promise\<BacktraceInfo>

Defined in: packages/scrypt-ts-opcat/src/psbt/extPsbt.ts:938

Retrieves backtrace information for a PSBT input by fetching and analyzing previous transactions.

Parameters​

provider​

UtxoProvider & ChainProvider

Provider interface for fetching UTXO and chain data

inputIndex​

number

Index of the input to trace back from

prevPrevTxFinder​

(prevTx, provider, inputIndex) => Promise\<string>

Async function to locate the transaction before the previous transaction

Returns​

Promise\<BacktraceInfo>

Promise resolving to backtrace information including:

     - Previous transaction input details
- Input index in current transaction
- Preimage of the transaction before previous transaction

getChangeInfo()​

getChangeInfo(): TxOut

Defined in: packages/scrypt-ts-opcat/src/psbt/extPsbt.ts:598

Gets the change output information from the PSBT transaction.

Returns​

TxOut

An object containing the script hash, satoshis value, and data hash of the change output. If no change output exists, returns an empty TxOut with default values (empty script/data hash and 0 satoshis).

Throws​

If the change output index is set but the output is not found at that index.

Implementation of​

IExtPsbt.getChangeInfo


getChangeUTXO()​

getChangeUTXO(): UTXO

Defined in: packages/scrypt-ts-opcat/src/psbt/extPsbt.ts:884

Gets the change UTXO (Unspent Transaction Output) if it exists.

Returns​

UTXO

The change UTXO if found, otherwise null.

Throws​

If the change output index is defined but no output is found at that index.


getFee()​

getFee(): bigint

Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:369

Returns​

bigint

Implementation of​

IExtPsbt.getFee

Inherited from​

Psbt.getFee


getFeeRate()​

getFeeRate(): number

Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:360

Returns​

number

Implementation of​

IExtPsbt.getFeeRate

Inherited from​

Psbt.getFeeRate


getInputContract()​

getInputContract(inputIndex): SmartContract\<StructObject>

Defined in: packages/scrypt-ts-opcat/src/psbt/extPsbt.ts:866

Gets the smart contract associated with a specific input index.

Parameters​

inputIndex​

number

The index of the input to retrieve the contract for

Returns​

SmartContract\<StructObject>

The smart contract for the specified input, or undefined if not found


getInputCtx()​

getInputCtx(inputIndex): InputContext

Defined in: packages/scrypt-ts-opcat/src/psbt/extPsbt.ts:210

Gets the input context for the specified input index.

Parameters​

inputIndex​

number

The index of the input to retrieve context for

Returns​

InputContext

The InputContext object associated with the specified input index

Implementation of​

IExtPsbt.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​

OpcatUtxo

The previous output of the input.

Implementation of​

IExtPsbt.getInputOutput

Inherited from​

Psbt.getInputOutput


getInputType()​

getInputType(inputIndex): AllScriptType

Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:421

Parameters​

inputIndex​

number

Returns​

AllScriptType

Implementation of​

IExtPsbt.getInputType

Inherited from​

Psbt.getInputType


getlockTime()​

getlockTime(): number

Defined in: packages/scrypt-ts-opcat/src/psbt/extPsbt.ts:132

Gets the lock time (nLockTime) value from the unsigned transaction.

Returns​

number

The lock time value as a number.

Implementation of​

IExtPsbt.getlockTime


getSequence()​

getSequence(inputIndex): number

Defined in: packages/scrypt-ts-opcat/src/psbt/extPsbt.ts:125

Gets the sequence number for the specified input index.

Parameters​

inputIndex​

number

The index of the input in the transaction.

Returns​

number

The sequence number of the input.

Implementation of​

IExtPsbt.getSequence


getSig()​

getSig(inputIndex, options): Sig

Defined in: packages/scrypt-ts-opcat/src/psbt/extPsbt.ts:841

Retrieves a signature for a specific input in the PSBT.

Parameters​

inputIndex​

number

The index of the input to sign.

options​

Omit\<ToSignInput, "index">

Signing options including address or public key.

Returns​

Sig

The signature as a Sig object. If no signature is found, returns a default zero-filled signature.

Throws​

May throw if the input index is invalid or if there are issues with public key conversion.

Implementation of​

IExtPsbt.getSig


getSigHashType()​

getSigHashType(inputIndex): SigHashType

Defined in: packages/scrypt-ts-opcat/src/psbt/extPsbt.ts:201

Gets the signature hash type for the specified input index.

Parameters​

inputIndex​

number

The index of the input to get the signature hash type for.

Returns​

SigHashType

The signature hash type for the specified input index.

Implementation of​

IExtPsbt.getSigHashType


getSpentDataHashes()​

getSpentDataHashes(): ByteString

Defined in: packages/scrypt-ts-opcat/src/psbt/extPsbt.ts:219

Calculates and returns the concatenated SHA-256 hashes of all input OP_CAT UTXO data. Each input's data is hashed individually and the results are concatenated.

Returns​

ByteString

The combined hashes of all input data as a ByteString.

Implementation of​

IExtPsbt.getSpentDataHashes


getUtxo()​

getUtxo(outputIndex): ExtUtxo

Defined in: packages/scrypt-ts-opcat/src/psbt/extPsbt.ts:903

Retrieves the UTXO (Unspent Transaction Output) at the specified output index.

Parameters​

outputIndex​

number

The index of the output to retrieve

Returns​

ExtUtxo

An ExtUtxo object containing the UTXO details

Throws​

Error if the output at the specified index is not found


inputHasHDKey()​

inputHasHDKey(inputIndex, root): boolean

Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:437

Parameters​

inputIndex​

number

root​

HDSigner

Returns​

boolean

Implementation of​

IExtPsbt.inputHasHDKey

Inherited from​

Psbt.inputHasHDKey


inputHasPubkey()​

inputHasPubkey(inputIndex, pubkey): boolean

Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:432

Parameters​

inputIndex​

number

pubkey​

Uint8Array

Returns​

boolean

Implementation of​

IExtPsbt.inputHasPubkey

Inherited from​

Psbt.inputHasPubkey


isB2GUtxo()​

isB2GUtxo(utxo): boolean

Defined in: packages/scrypt-ts-opcat/src/psbt/extPsbt.ts:989

Checks if a given UTXO is a B2G (Back to Genesis) UTXO. A B2G UTXO is identified by the presence of a 'txHashPreimage' property in the object.

Parameters​

utxo​

object

The UTXO object to check

Returns​

boolean

boolean indicating if the UTXO is a B2G UTXO


isContractInput()​

isContractInput(inputIndex): boolean

Defined in: packages/scrypt-ts-opcat/src/psbt/extPsbt.ts:762

Checks if the input at the specified index is a contract input.

Parameters​

inputIndex​

number

The index of the input to check.

Returns​

boolean

True if the input is a contract input, false otherwise.


outputHasHDKey()​

outputHasHDKey(outputIndex, root): boolean

Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:449

Parameters​

outputIndex​

number

root​

HDSigner

Returns​

boolean

Implementation of​

IExtPsbt.outputHasHDKey

Inherited from​

Psbt.outputHasHDKey


outputHasPubkey()​

outputHasPubkey(outputIndex, pubkey): boolean

Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:445

Parameters​

outputIndex​

number

pubkey​

Uint8Array

Returns​

boolean

Implementation of​

IExtPsbt.outputHasPubkey

Inherited from​

Psbt.outputHasPubkey


psbtOptions()​

psbtOptions(autoFinalized): SignOptions

Defined in: packages/scrypt-ts-opcat/src/psbt/extPsbt.ts:815

Generates PSBT signing options based on signature requests.

Parameters​

autoFinalized​

boolean = false

Whether to automatically finalize the PSBT after signing (default: false)

Returns​

SignOptions

SignOptions object containing signing inputs, or undefined if no signatures are required


removeInput()​

removeInput(inputIndex): this

Defined in: packages/scrypt-ts-opcat/src/psbt/extPsbt.ts:434

Removes an input from the PSBT at the specified index. This updates the unsigned transaction, input data, and clears related contract, UTXO, finalizer, and signature request mappings for the removed input.

Parameters​

inputIndex​

number

The index of the input to remove

Returns​

this

The PSBT instance for method chaining


removeLastInput()​

removeLastInput(): this

Defined in: packages/scrypt-ts-opcat/src/psbt/extPsbt.ts:449

Removes the last input from the PSBT.

Returns​

this

The modified PSBT instance for chaining.

Throws​

If there are no inputs to remove.


seal()​

seal(): this

Defined in: packages/scrypt-ts-opcat/src/psbt/extPsbt.ts:1018

Finalizes the PSBT by calculating and caching input unlocking scripts, finalizing the change output if specified, and marking the transaction as sealed. Also calculates input contexts after sealing.

Returns​

this

The sealed PSBT instance for method chaining.


setInputSequence()​

setInputSequence(inputIndex, sequence): this

Defined in: packages/scrypt-ts-opcat/src/psbt/extPsbt.ts:380

Sets the sequence number for the specified input.

Parameters​

inputIndex​

number

The index of the input to modify

sequence​

number

The sequence number to set

Returns​

this

The PSBT instance for method chaining

Throws​

If the PSBT is sealed (immutable)

Implementation of​

IExtPsbt.setInputSequence

Overrides​

Psbt.setInputSequence


setLocktime()​

setLocktime(locktime): this

Defined in: packages/scrypt-ts-opcat/src/psbt/extPsbt.ts:368

Sets the locktime for the PSBT (Partially Signed Opcat Transaction).

Parameters​

locktime​

number

The locktime value to set (in blocks or timestamp)

Returns​

this

The PSBT instance for chaining

Throws​

Error if the PSBT is already sealed

Implementation of​

IExtPsbt.setLocktime

Overrides​

Psbt.setLocktime


setMaximumFeeRate()​

setMaximumFeeRate(satoshiPerByte): void

Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:244

Parameters​

satoshiPerByte​

number

Returns​

void

Implementation of​

IExtPsbt.setMaximumFeeRate

Inherited from​

Psbt.setMaximumFeeRate


setSighashType()​

setSighashType(inputIndex, sigHashType): void

Defined in: packages/scrypt-ts-opcat/src/psbt/extPsbt.ts:184

Sets the sighash type for a specific input index. Throws an error if attempting to set a different sighash type for the same input index.

Parameters​

inputIndex​

number

The index of the input to set the sighash type for.

sigHashType​

SigHashType

The sighash type to set.

Returns​

void

Throws​

If the sighash type differs from the previously set type for the same input index.

Implementation of​

IExtPsbt.setSighashType


setVersion()​

setVersion(version): this

Defined in: packages/scrypt-ts-opcat/src/psbt/extPsbt.ts:357

Sets the version number of the PSBT.

Parameters​

version​

number

The version number to set.

Returns​

this

The PSBT instance for chaining.

Throws​

Error if the PSBT is sealed.

Implementation of​

IExtPsbt.setVersion

Overrides​

Psbt.setVersion


signAllInputs()​

signAllInputs(keyPair, sighashTypes?): this

Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:605

Parameters​

keyPair​

Signer

sighashTypes?​

number[]

Returns​

this

Implementation of​

IExtPsbt.signAllInputs

Inherited from​

Psbt.signAllInputs


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>

Implementation of​

IExtPsbt.signAllInputsAsync

Inherited from​

Psbt.signAllInputsAsync


signAllInputsHD()​

signAllInputsHD(hdKeyPair, sighashTypes): this

Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:512

Parameters​

hdKeyPair​

HDSigner

sighashTypes​

number[] = ...

Returns​

this

Implementation of​

IExtPsbt.signAllInputsHD

Inherited from​

Psbt.signAllInputsHD


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>

Implementation of​

IExtPsbt.signAllInputsHDAsync

Inherited from​

Psbt.signAllInputsHDAsync


signAndFinalize()​

signAndFinalize(signer): Promise\<void>

Defined in: packages/scrypt-ts-opcat/src/psbt/extPsbt.ts:115

Signs the PSBT with the provided signer and finalizes all inputs.

Parameters​

signer​

Signer

The signer instance used to sign the PSBT.

Returns​

Promise\<void>

A promise that resolves when signing and finalization are complete.

Implementation of​

IExtPsbt.signAndFinalize


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

Implementation of​

IExtPsbt.signInput

Inherited from​

Psbt.signInput


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>

Implementation of​

IExtPsbt.signInputAsync

Inherited from​

Psbt.signInputAsync


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

Implementation of​

IExtPsbt.signInputHD

Inherited from​

Psbt.signInputHD


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>

Implementation of​

IExtPsbt.signInputHDAsync

Inherited from​

Psbt.signInputHDAsync


spendUTXO()​

spendUTXO(utxos): this

Defined in: packages/scrypt-ts-opcat/src/psbt/extPsbt.ts:302

Add input(s) for current psbt to spend the utxos.

Parameters​

utxos​

the utxos to spend

ExtUtxo | ExtUtxo[]

Returns​

this

this


toBase64()​

toBase64(): string

Defined in: packages/scrypt-ts-opcat/src/psbt/extPsbt.ts:1064

Converts the PSBT to Base64 string representation.

Returns​

string

Base64 encoded PSBT data

Throws​

If the PSBT is not sealed (must call seal() first)

Implementation of​

IExtPsbt.toBase64

Overrides​

Psbt.toBase64


toBuffer()​

toBuffer(): Uint8Array

Defined in: packages/scrypt-ts-opcat/src/psbt/extPsbt.ts:1038

Converts the PSBT to a Uint8Array buffer.

Returns​

Uint8Array

The serialized PSBT buffer.

Throws​

If the PSBT is not sealed (must call seal() first).

Implementation of​

IExtPsbt.toBuffer

Overrides​

Psbt.toBuffer


toHex()​

toHex(): string

Defined in: packages/scrypt-ts-opcat/src/psbt/extPsbt.ts:1052

Converts the PSBT to a hexadecimal string representation.

Returns​

string

The hexadecimal string representation of the PSBT.

Throws​

If the PSBT is not sealed (must call seal() first).

Implementation of​

IExtPsbt.toHex

Overrides​

Psbt.toHex


txHashPreimage()​

txHashPreimage(): string

Defined in: packages/scrypt-ts-opcat/src/psbt/extPsbt.ts:1002

Generates the transaction hash preimage for the PSBT.

Returns​

string

The transaction hash preimage as a hexadecimal string.

Throws​

If the PSBT is not sealed (must call seal() first).


updateGlobal()​

updateGlobal(updateData): this

Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:790

Parameters​

updateData​

PsbtGlobalUpdate

Returns​

this

Implementation of​

IExtPsbt.updateGlobal

Inherited from​

Psbt.updateGlobal


updateInput()​

updateInput(inputIndex, updateData): this

Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:795

Parameters​

inputIndex​

number

updateData​

PsbtInputUpdate

Returns​

this

Implementation of​

IExtPsbt.updateInput

Inherited from​

Psbt.updateInput


updateOutput()​

updateOutput(outputIndex, updateData): this

Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:800

Parameters​

outputIndex​

number

updateData​

PsbtOutputUpdate

Returns​

this

Implementation of​

IExtPsbt.updateOutput

Inherited from​

Psbt.updateOutput


validateSignaturesOfAllInputs()​

validateSignaturesOfAllInputs(validator): boolean

Defined in: packages/scrypt-ts-opcat/src/psbt/psbt.ts:457

Parameters​

validator​

ValidateSigFunction

Returns​

boolean

Implementation of​

IExtPsbt.validateSignaturesOfAllInputs

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

Implementation of​

IExtPsbt.validateSignaturesOfInput

Inherited from​

Psbt.validateSignaturesOfInput


fromBase64()​

static fromBase64(data, opts): ExtPsbt

Defined in: packages/scrypt-ts-opcat/src/psbt/extPsbt.ts:142

Creates an ExtPsbt instance from a base64-encoded string.

Parameters​

data​

string

The base64-encoded PSBT data

opts​

ExtPsbtOpts = {}

Optional configuration options for the ExtPsbt

Returns​

ExtPsbt

A new ExtPsbt instance

Overrides​

Psbt.fromBase64


fromBuffer()​

static fromBuffer(buffer, opts): ExtPsbt

Defined in: packages/scrypt-ts-opcat/src/psbt/extPsbt.ts:164

Creates an ExtPsbt instance from a buffer containing PSBT data.

Parameters​

buffer​

Uint8Array

The buffer containing the PSBT data.

opts​

ExtPsbtOpts = {}

Optional parameters including network configuration.

Returns​

ExtPsbt

A new ExtPsbt instance initialized with the PSBT data.

Overrides​

Psbt.fromBuffer


fromHex()​

static fromHex(data, opts): ExtPsbt

Defined in: packages/scrypt-ts-opcat/src/psbt/extPsbt.ts:153

Creates an ExtPsbt instance from a hex string.

Parameters​

data​

string

Hex string representation of the PSBT data

opts​

ExtPsbtOpts = {}

Optional configuration options for the ExtPsbt

Returns​

ExtPsbt

A new ExtPsbt instance

Overrides​

Psbt.fromHex