From 17092ae3ce997f60e3d833e9336a2c69d9a08ea1 Mon Sep 17 00:00:00 2001 From: ethicnology Date: Tue, 30 Jun 2026 06:29:24 +0000 Subject: [PATCH] chore(deps): bump bdk-ffi to uniffi 0.31.2 Move bdk-ffi from v3.0.0 (uniffi 0.31.1) to upstream master at the uniffi 0.31.2 bump (bitcoindevkit/bdk-ffi#1040, merge commit 17c48b8), and align uniffi to =0.31.2 and uniffi-dart to v0.2.1+v0.31.2. uniffi requires the scaffolding (bdk-ffi) and the bindgen to share the exact same uniffi version, so all three move together. Pinned to the #1040 merge commit rev since no bdk-ffi release tag past v3.0.0 carries 0.31.2 yet; swap to a tag once one is cut. Regenerate lib/bdk.dart against the new library. --- lib/bdk.dart | 27873 ++++++++++++++++++++++---------------------- native/Cargo.toml | 10 +- 2 files changed, 14137 insertions(+), 13746 deletions(-) diff --git a/lib/bdk.dart b/lib/bdk.dart index 1681c21..b17e358 100644 --- a/lib/bdk.dart +++ b/lib/bdk.dart @@ -8,1670 +8,2673 @@ import "dart:isolate"; import "dart:typed_data"; import "package:ffi/ffi.dart"; -class AddressInfo { - final int index; - final Address address; - final KeychainKind keychain; - AddressInfo({ - required this.index, - required this.address, - required this.keychain, - }); +class Block { + final Header header; + final List txdata; + Block({required this.header, required this.txdata}); } -class FfiConverterAddressInfo { - static AddressInfo lift(RustBuffer buf) { - return FfiConverterAddressInfo.read(buf.asUint8List()).value; +class FfiConverterBlock { + static Block lift(RustBuffer buf) { + return FfiConverterBlock.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final index_lifted = FfiConverterUInt32.read( + final header_lifted = FfiConverterHeader.read( Uint8List.view(buf.buffer, new_offset), ); - final index = index_lifted.value; - new_offset += index_lifted.bytesRead; - final address_lifted = Address.read(Uint8List.view(buf.buffer, new_offset)); - final address = address_lifted.value; - new_offset += address_lifted.bytesRead; - final keychain_lifted = FfiConverterKeychainKind.read( + final header = header_lifted.value; + new_offset += header_lifted.bytesRead; + final txdata_lifted = FfiConverterSequenceTransaction.read( Uint8List.view(buf.buffer, new_offset), ); - final keychain = keychain_lifted.value; - new_offset += keychain_lifted.bytesRead; + final txdata = txdata_lifted.value; + new_offset += txdata_lifted.bytesRead; return LiftRetVal( - AddressInfo(index: index, address: address, keychain: keychain), + Block(header: header, txdata: txdata), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(AddressInfo value) { + static RustBuffer lower(Block value) { final total_length = - FfiConverterUInt32.allocationSize(value.index) + - Address.allocationSize(value.address) + - FfiConverterKeychainKind.allocationSize(value.keychain) + + FfiConverterHeader.allocationSize(value.header) + + FfiConverterSequenceTransaction.allocationSize(value.txdata) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(AddressInfo value, Uint8List buf) { + static int write(Block value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += FfiConverterUInt32.write( - value.index, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += Address.write( - value.address, + new_offset += FfiConverterHeader.write( + value.header, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterKeychainKind.write( - value.keychain, + new_offset += FfiConverterSequenceTransaction.write( + value.txdata, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(AddressInfo value) { - return FfiConverterUInt32.allocationSize(value.index) + - Address.allocationSize(value.address) + - FfiConverterKeychainKind.allocationSize(value.keychain) + + static int allocationSize(Block value) { + return FfiConverterHeader.allocationSize(value.header) + + FfiConverterSequenceTransaction.allocationSize(value.txdata) + 0; } } -class Anchor { - final ConfirmationBlockTime confirmationBlockTime; - final Txid txid; - Anchor({required this.confirmationBlockTime, required this.txid}); +class ControlBlock { + final Uint8List internalKey; + final List merkleBranch; + final int outputKeyParity; + final int leafVersion; + ControlBlock({ + required this.internalKey, + required this.merkleBranch, + required this.outputKeyParity, + required this.leafVersion, + }); } -class FfiConverterAnchor { - static Anchor lift(RustBuffer buf) { - return FfiConverterAnchor.read(buf.asUint8List()).value; +class FfiConverterControlBlock { + static ControlBlock lift(RustBuffer buf) { + return FfiConverterControlBlock.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final confirmationBlockTime_lifted = FfiConverterConfirmationBlockTime.read( + final internalKey_lifted = FfiConverterUint8List.read( Uint8List.view(buf.buffer, new_offset), ); - final confirmationBlockTime = confirmationBlockTime_lifted.value; - new_offset += confirmationBlockTime_lifted.bytesRead; - final txid_lifted = Txid.read(Uint8List.view(buf.buffer, new_offset)); - final txid = txid_lifted.value; - new_offset += txid_lifted.bytesRead; + final internalKey = internalKey_lifted.value; + new_offset += internalKey_lifted.bytesRead; + final merkleBranch_lifted = FfiConverterSequenceString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final merkleBranch = merkleBranch_lifted.value; + new_offset += merkleBranch_lifted.bytesRead; + final outputKeyParity_lifted = FfiConverterUInt8.read( + Uint8List.view(buf.buffer, new_offset), + ); + final outputKeyParity = outputKeyParity_lifted.value; + new_offset += outputKeyParity_lifted.bytesRead; + final leafVersion_lifted = FfiConverterUInt8.read( + Uint8List.view(buf.buffer, new_offset), + ); + final leafVersion = leafVersion_lifted.value; + new_offset += leafVersion_lifted.bytesRead; return LiftRetVal( - Anchor(confirmationBlockTime: confirmationBlockTime, txid: txid), + ControlBlock( + internalKey: internalKey, + merkleBranch: merkleBranch, + outputKeyParity: outputKeyParity, + leafVersion: leafVersion, + ), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(Anchor value) { + static RustBuffer lower(ControlBlock value) { final total_length = - FfiConverterConfirmationBlockTime.allocationSize( - value.confirmationBlockTime, - ) + - Txid.allocationSize(value.txid) + + FfiConverterUint8List.allocationSize(value.internalKey) + + FfiConverterSequenceString.allocationSize(value.merkleBranch) + + FfiConverterUInt8.allocationSize(value.outputKeyParity) + + FfiConverterUInt8.allocationSize(value.leafVersion) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(Anchor value, Uint8List buf) { + static int write(ControlBlock value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += FfiConverterConfirmationBlockTime.write( - value.confirmationBlockTime, + new_offset += FfiConverterUint8List.write( + value.internalKey, Uint8List.view(buf.buffer, new_offset), ); - new_offset += Txid.write( - value.txid, + new_offset += FfiConverterSequenceString.write( + value.merkleBranch, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterUInt8.write( + value.outputKeyParity, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterUInt8.write( + value.leafVersion, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(Anchor value) { - return FfiConverterConfirmationBlockTime.allocationSize( - value.confirmationBlockTime, - ) + - Txid.allocationSize(value.txid) + + static int allocationSize(ControlBlock value) { + return FfiConverterUint8List.allocationSize(value.internalKey) + + FfiConverterSequenceString.allocationSize(value.merkleBranch) + + FfiConverterUInt8.allocationSize(value.outputKeyParity) + + FfiConverterUInt8.allocationSize(value.leafVersion) + 0; } } -class Balance { - final Amount immature; - final Amount trustedPending; - final Amount untrustedPending; - final Amount confirmed; - final Amount trustedSpendable; - final Amount total; - Balance({ - required this.immature, - required this.trustedPending, - required this.untrustedPending, - required this.confirmed, - required this.trustedSpendable, - required this.total, +class FinalizedPsbtResult { + final Psbt psbt; + final bool couldFinalize; + final List? errors; + FinalizedPsbtResult({ + required this.psbt, + required this.couldFinalize, + this.errors, }); } -class FfiConverterBalance { - static Balance lift(RustBuffer buf) { - return FfiConverterBalance.read(buf.asUint8List()).value; +class FfiConverterFinalizedPsbtResult { + static FinalizedPsbtResult lift(RustBuffer buf) { + return FfiConverterFinalizedPsbtResult.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final immature_lifted = Amount.read(Uint8List.view(buf.buffer, new_offset)); - final immature = immature_lifted.value; - new_offset += immature_lifted.bytesRead; - final trustedPending_lifted = Amount.read( - Uint8List.view(buf.buffer, new_offset), - ); - final trustedPending = trustedPending_lifted.value; - new_offset += trustedPending_lifted.bytesRead; - final untrustedPending_lifted = Amount.read( - Uint8List.view(buf.buffer, new_offset), - ); - final untrustedPending = untrustedPending_lifted.value; - new_offset += untrustedPending_lifted.bytesRead; - final confirmed_lifted = Amount.read( - Uint8List.view(buf.buffer, new_offset), - ); - final confirmed = confirmed_lifted.value; - new_offset += confirmed_lifted.bytesRead; - final trustedSpendable_lifted = Amount.read( + final psbt_lifted = Psbt.read(Uint8List.view(buf.buffer, new_offset)); + final psbt = psbt_lifted.value; + new_offset += psbt_lifted.bytesRead; + final couldFinalize_lifted = FfiConverterBool.read( Uint8List.view(buf.buffer, new_offset), ); - final trustedSpendable = trustedSpendable_lifted.value; - new_offset += trustedSpendable_lifted.bytesRead; - final total_lifted = Amount.read(Uint8List.view(buf.buffer, new_offset)); - final total = total_lifted.value; - new_offset += total_lifted.bytesRead; + final couldFinalize = couldFinalize_lifted.value; + new_offset += couldFinalize_lifted.bytesRead; + final errors_lifted = + FfiConverterOptionalSequencePsbtFinalizeException.read( + Uint8List.view(buf.buffer, new_offset), + ); + final errors = errors_lifted.value; + new_offset += errors_lifted.bytesRead; return LiftRetVal( - Balance( - immature: immature, - trustedPending: trustedPending, - untrustedPending: untrustedPending, - confirmed: confirmed, - trustedSpendable: trustedSpendable, - total: total, + FinalizedPsbtResult( + psbt: psbt, + couldFinalize: couldFinalize, + errors: errors, ), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(Balance value) { + static RustBuffer lower(FinalizedPsbtResult value) { final total_length = - Amount.allocationSize(value.immature) + - Amount.allocationSize(value.trustedPending) + - Amount.allocationSize(value.untrustedPending) + - Amount.allocationSize(value.confirmed) + - Amount.allocationSize(value.trustedSpendable) + - Amount.allocationSize(value.total) + + Psbt.allocationSize(value.psbt) + + FfiConverterBool.allocationSize(value.couldFinalize) + + FfiConverterOptionalSequencePsbtFinalizeException.allocationSize( + value.errors, + ) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(Balance value, Uint8List buf) { + static int write(FinalizedPsbtResult value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += Amount.write( - value.immature, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += Amount.write( - value.trustedPending, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += Amount.write( - value.untrustedPending, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += Amount.write( - value.confirmed, + new_offset += Psbt.write( + value.psbt, Uint8List.view(buf.buffer, new_offset), ); - new_offset += Amount.write( - value.trustedSpendable, + new_offset += FfiConverterBool.write( + value.couldFinalize, Uint8List.view(buf.buffer, new_offset), ); - new_offset += Amount.write( - value.total, + new_offset += FfiConverterOptionalSequencePsbtFinalizeException.write( + value.errors, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(Balance value) { - return Amount.allocationSize(value.immature) + - Amount.allocationSize(value.trustedPending) + - Amount.allocationSize(value.untrustedPending) + - Amount.allocationSize(value.confirmed) + - Amount.allocationSize(value.trustedSpendable) + - Amount.allocationSize(value.total) + + static int allocationSize(FinalizedPsbtResult value) { + return Psbt.allocationSize(value.psbt) + + FfiConverterBool.allocationSize(value.couldFinalize) + + FfiConverterOptionalSequencePsbtFinalizeException.allocationSize( + value.errors, + ) + 0; } } -class Block { - final Header header; - final List txdata; - Block({required this.header, required this.txdata}); +class Header { + final int version; + final BlockHash prevBlockhash; + final TxMerkleNode merkleRoot; + final int time; + final int bits; + final int nonce; + Header({ + required this.version, + required this.prevBlockhash, + required this.merkleRoot, + required this.time, + required this.bits, + required this.nonce, + }); } -class FfiConverterBlock { - static Block lift(RustBuffer buf) { - return FfiConverterBlock.read(buf.asUint8List()).value; +class FfiConverterHeader { + static Header lift(RustBuffer buf) { + return FfiConverterHeader.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal
read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final header_lifted = FfiConverterHeader.read( + final version_lifted = FfiConverterInt32.read( Uint8List.view(buf.buffer, new_offset), ); - final header = header_lifted.value; - new_offset += header_lifted.bytesRead; - final txdata_lifted = FfiConverterSequenceTransaction.read( + final version = version_lifted.value; + new_offset += version_lifted.bytesRead; + final prevBlockhash_lifted = BlockHash.read( Uint8List.view(buf.buffer, new_offset), ); - final txdata = txdata_lifted.value; - new_offset += txdata_lifted.bytesRead; - return LiftRetVal( - Block(header: header, txdata: txdata), - new_offset - buf.offsetInBytes, + final prevBlockhash = prevBlockhash_lifted.value; + new_offset += prevBlockhash_lifted.bytesRead; + final merkleRoot_lifted = TxMerkleNode.read( + Uint8List.view(buf.buffer, new_offset), ); - } - - static RustBuffer lower(Block value) { - final total_length = - FfiConverterHeader.allocationSize(value.header) + - FfiConverterSequenceTransaction.allocationSize(value.txdata) + - 0; - final buf = Uint8List(total_length); - write(value, buf); - return toRustBuffer(buf); - } - - static int write(Block value, Uint8List buf) { - int new_offset = buf.offsetInBytes; - new_offset += FfiConverterHeader.write( - value.header, + final merkleRoot = merkleRoot_lifted.value; + new_offset += merkleRoot_lifted.bytesRead; + final time_lifted = FfiConverterUInt32.read( Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterSequenceTransaction.write( - value.txdata, + final time = time_lifted.value; + new_offset += time_lifted.bytesRead; + final bits_lifted = FfiConverterUInt32.read( Uint8List.view(buf.buffer, new_offset), ); - return new_offset - buf.offsetInBytes; - } - - static int allocationSize(Block value) { - return FfiConverterHeader.allocationSize(value.header) + - FfiConverterSequenceTransaction.allocationSize(value.txdata) + - 0; - } -} - -class BlockId { - final int height; - final BlockHash hash; - BlockId({required this.height, required this.hash}); -} - -class FfiConverterBlockId { - static BlockId lift(RustBuffer buf) { - return FfiConverterBlockId.read(buf.asUint8List()).value; - } - - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final height_lifted = FfiConverterUInt32.read( + final bits = bits_lifted.value; + new_offset += bits_lifted.bytesRead; + final nonce_lifted = FfiConverterUInt32.read( Uint8List.view(buf.buffer, new_offset), ); - final height = height_lifted.value; - new_offset += height_lifted.bytesRead; - final hash_lifted = BlockHash.read(Uint8List.view(buf.buffer, new_offset)); - final hash = hash_lifted.value; - new_offset += hash_lifted.bytesRead; + final nonce = nonce_lifted.value; + new_offset += nonce_lifted.bytesRead; return LiftRetVal( - BlockId(height: height, hash: hash), + Header( + version: version, + prevBlockhash: prevBlockhash, + merkleRoot: merkleRoot, + time: time, + bits: bits, + nonce: nonce, + ), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(BlockId value) { + static RustBuffer lower(Header value) { final total_length = - FfiConverterUInt32.allocationSize(value.height) + - BlockHash.allocationSize(value.hash) + + FfiConverterInt32.allocationSize(value.version) + + BlockHash.allocationSize(value.prevBlockhash) + + TxMerkleNode.allocationSize(value.merkleRoot) + + FfiConverterUInt32.allocationSize(value.time) + + FfiConverterUInt32.allocationSize(value.bits) + + FfiConverterUInt32.allocationSize(value.nonce) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(BlockId value, Uint8List buf) { + static int write(Header value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += FfiConverterUInt32.write( - value.height, + new_offset += FfiConverterInt32.write( + value.version, Uint8List.view(buf.buffer, new_offset), ); new_offset += BlockHash.write( - value.hash, + value.prevBlockhash, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += TxMerkleNode.write( + value.merkleRoot, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterUInt32.write( + value.time, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterUInt32.write( + value.bits, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterUInt32.write( + value.nonce, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(BlockId value) { - return FfiConverterUInt32.allocationSize(value.height) + - BlockHash.allocationSize(value.hash) + + static int allocationSize(Header value) { + return FfiConverterInt32.allocationSize(value.version) + + BlockHash.allocationSize(value.prevBlockhash) + + TxMerkleNode.allocationSize(value.merkleRoot) + + FfiConverterUInt32.allocationSize(value.time) + + FfiConverterUInt32.allocationSize(value.bits) + + FfiConverterUInt32.allocationSize(value.nonce) + 0; } } -class CanonicalTx { - final Transaction transaction; - final ChainPosition chainPosition; - CanonicalTx({required this.transaction, required this.chainPosition}); +class Input { + final Transaction? nonWitnessUtxo; + final TxOut? witnessUtxo; + final Map partialSigs; + final String? sighashType; + final Script? redeemScript; + final Script? witnessScript; + final Map bip32Derivation; + final Script? finalScriptSig; + final List? finalScriptWitness; + final Map ripemd160Preimages; + final Map sha256Preimages; + final Map hash160Preimages; + final Map hash256Preimages; + final Uint8List? tapKeySig; + final Map tapScriptSigs; + final Map tapScripts; + final Map tapKeyOrigins; + final String? tapInternalKey; + final String? tapMerkleRoot; + final Map proprietary; + final Map unknown; + Input({ + this.nonWitnessUtxo, + this.witnessUtxo, + required this.partialSigs, + this.sighashType, + this.redeemScript, + this.witnessScript, + required this.bip32Derivation, + this.finalScriptSig, + this.finalScriptWitness, + required this.ripemd160Preimages, + required this.sha256Preimages, + required this.hash160Preimages, + required this.hash256Preimages, + this.tapKeySig, + required this.tapScriptSigs, + required this.tapScripts, + required this.tapKeyOrigins, + this.tapInternalKey, + this.tapMerkleRoot, + required this.proprietary, + required this.unknown, + }); } -class FfiConverterCanonicalTx { - static CanonicalTx lift(RustBuffer buf) { - return FfiConverterCanonicalTx.read(buf.asUint8List()).value; +class FfiConverterInput { + static Input lift(RustBuffer buf) { + return FfiConverterInput.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final transaction_lifted = Transaction.read( + final nonWitnessUtxo_lifted = FfiConverterOptionalTransaction.read( Uint8List.view(buf.buffer, new_offset), ); - final transaction = transaction_lifted.value; - new_offset += transaction_lifted.bytesRead; - final chainPosition_lifted = FfiConverterChainPosition.read( + final nonWitnessUtxo = nonWitnessUtxo_lifted.value; + new_offset += nonWitnessUtxo_lifted.bytesRead; + final witnessUtxo_lifted = FfiConverterOptionalTxOut.read( Uint8List.view(buf.buffer, new_offset), ); - final chainPosition = chainPosition_lifted.value; - new_offset += chainPosition_lifted.bytesRead; - return LiftRetVal( - CanonicalTx(transaction: transaction, chainPosition: chainPosition), - new_offset - buf.offsetInBytes, + final witnessUtxo = witnessUtxo_lifted.value; + new_offset += witnessUtxo_lifted.bytesRead; + final partialSigs_lifted = FfiConverterMapStringToUint8List.read( + Uint8List.view(buf.buffer, new_offset), ); - } - - static RustBuffer lower(CanonicalTx value) { - final total_length = - Transaction.allocationSize(value.transaction) + - FfiConverterChainPosition.allocationSize(value.chainPosition) + - 0; - final buf = Uint8List(total_length); - write(value, buf); - return toRustBuffer(buf); - } - - static int write(CanonicalTx value, Uint8List buf) { - int new_offset = buf.offsetInBytes; - new_offset += Transaction.write( - value.transaction, + final partialSigs = partialSigs_lifted.value; + new_offset += partialSigs_lifted.bytesRead; + final sighashType_lifted = FfiConverterOptionalString.read( Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterChainPosition.write( - value.chainPosition, + final sighashType = sighashType_lifted.value; + new_offset += sighashType_lifted.bytesRead; + final redeemScript_lifted = FfiConverterOptionalScript.read( Uint8List.view(buf.buffer, new_offset), ); - return new_offset - buf.offsetInBytes; - } - - static int allocationSize(CanonicalTx value) { - return Transaction.allocationSize(value.transaction) + - FfiConverterChainPosition.allocationSize(value.chainPosition) + - 0; - } -} - -class CbfComponents { - final CbfClient client; - final CbfNode node; - CbfComponents({required this.client, required this.node}); -} - -class FfiConverterCbfComponents { - static CbfComponents lift(RustBuffer buf) { - return FfiConverterCbfComponents.read(buf.asUint8List()).value; - } - - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final client_lifted = CbfClient.read( + final redeemScript = redeemScript_lifted.value; + new_offset += redeemScript_lifted.bytesRead; + final witnessScript_lifted = FfiConverterOptionalScript.read( Uint8List.view(buf.buffer, new_offset), ); - final client = client_lifted.value; - new_offset += client_lifted.bytesRead; - final node_lifted = CbfNode.read(Uint8List.view(buf.buffer, new_offset)); - final node = node_lifted.value; - new_offset += node_lifted.bytesRead; + final witnessScript = witnessScript_lifted.value; + new_offset += witnessScript_lifted.bytesRead; + final bip32Derivation_lifted = FfiConverterMapStringToKeySource.read( + Uint8List.view(buf.buffer, new_offset), + ); + final bip32Derivation = bip32Derivation_lifted.value; + new_offset += bip32Derivation_lifted.bytesRead; + final finalScriptSig_lifted = FfiConverterOptionalScript.read( + Uint8List.view(buf.buffer, new_offset), + ); + final finalScriptSig = finalScriptSig_lifted.value; + new_offset += finalScriptSig_lifted.bytesRead; + final finalScriptWitness_lifted = + FfiConverterOptionalSequenceUint8List.read( + Uint8List.view(buf.buffer, new_offset), + ); + final finalScriptWitness = finalScriptWitness_lifted.value; + new_offset += finalScriptWitness_lifted.bytesRead; + final ripemd160Preimages_lifted = FfiConverterMapStringToUint8List.read( + Uint8List.view(buf.buffer, new_offset), + ); + final ripemd160Preimages = ripemd160Preimages_lifted.value; + new_offset += ripemd160Preimages_lifted.bytesRead; + final sha256Preimages_lifted = FfiConverterMapStringToUint8List.read( + Uint8List.view(buf.buffer, new_offset), + ); + final sha256Preimages = sha256Preimages_lifted.value; + new_offset += sha256Preimages_lifted.bytesRead; + final hash160Preimages_lifted = FfiConverterMapStringToUint8List.read( + Uint8List.view(buf.buffer, new_offset), + ); + final hash160Preimages = hash160Preimages_lifted.value; + new_offset += hash160Preimages_lifted.bytesRead; + final hash256Preimages_lifted = FfiConverterMapStringToUint8List.read( + Uint8List.view(buf.buffer, new_offset), + ); + final hash256Preimages = hash256Preimages_lifted.value; + new_offset += hash256Preimages_lifted.bytesRead; + final tapKeySig_lifted = FfiConverterOptionalUint8List.read( + Uint8List.view(buf.buffer, new_offset), + ); + final tapKeySig = tapKeySig_lifted.value; + new_offset += tapKeySig_lifted.bytesRead; + final tapScriptSigs_lifted = FfiConverterMapTapScriptSigKeyToUint8List.read( + Uint8List.view(buf.buffer, new_offset), + ); + final tapScriptSigs = tapScriptSigs_lifted.value; + new_offset += tapScriptSigs_lifted.bytesRead; + final tapScripts_lifted = FfiConverterMapControlBlockToTapScriptEntry.read( + Uint8List.view(buf.buffer, new_offset), + ); + final tapScripts = tapScripts_lifted.value; + new_offset += tapScripts_lifted.bytesRead; + final tapKeyOrigins_lifted = FfiConverterMapStringToTapKeyOrigin.read( + Uint8List.view(buf.buffer, new_offset), + ); + final tapKeyOrigins = tapKeyOrigins_lifted.value; + new_offset += tapKeyOrigins_lifted.bytesRead; + final tapInternalKey_lifted = FfiConverterOptionalString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final tapInternalKey = tapInternalKey_lifted.value; + new_offset += tapInternalKey_lifted.bytesRead; + final tapMerkleRoot_lifted = FfiConverterOptionalString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final tapMerkleRoot = tapMerkleRoot_lifted.value; + new_offset += tapMerkleRoot_lifted.bytesRead; + final proprietary_lifted = FfiConverterMapProprietaryKeyToUint8List.read( + Uint8List.view(buf.buffer, new_offset), + ); + final proprietary = proprietary_lifted.value; + new_offset += proprietary_lifted.bytesRead; + final unknown_lifted = FfiConverterMapKeyToUint8List.read( + Uint8List.view(buf.buffer, new_offset), + ); + final unknown = unknown_lifted.value; + new_offset += unknown_lifted.bytesRead; return LiftRetVal( - CbfComponents(client: client, node: node), + Input( + nonWitnessUtxo: nonWitnessUtxo, + witnessUtxo: witnessUtxo, + partialSigs: partialSigs, + sighashType: sighashType, + redeemScript: redeemScript, + witnessScript: witnessScript, + bip32Derivation: bip32Derivation, + finalScriptSig: finalScriptSig, + finalScriptWitness: finalScriptWitness, + ripemd160Preimages: ripemd160Preimages, + sha256Preimages: sha256Preimages, + hash160Preimages: hash160Preimages, + hash256Preimages: hash256Preimages, + tapKeySig: tapKeySig, + tapScriptSigs: tapScriptSigs, + tapScripts: tapScripts, + tapKeyOrigins: tapKeyOrigins, + tapInternalKey: tapInternalKey, + tapMerkleRoot: tapMerkleRoot, + proprietary: proprietary, + unknown: unknown, + ), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(CbfComponents value) { + static RustBuffer lower(Input value) { final total_length = - CbfClient.allocationSize(value.client) + - CbfNode.allocationSize(value.node) + + FfiConverterOptionalTransaction.allocationSize(value.nonWitnessUtxo) + + FfiConverterOptionalTxOut.allocationSize(value.witnessUtxo) + + FfiConverterMapStringToUint8List.allocationSize(value.partialSigs) + + FfiConverterOptionalString.allocationSize(value.sighashType) + + FfiConverterOptionalScript.allocationSize(value.redeemScript) + + FfiConverterOptionalScript.allocationSize(value.witnessScript) + + FfiConverterMapStringToKeySource.allocationSize(value.bip32Derivation) + + FfiConverterOptionalScript.allocationSize(value.finalScriptSig) + + FfiConverterOptionalSequenceUint8List.allocationSize( + value.finalScriptWitness, + ) + + FfiConverterMapStringToUint8List.allocationSize( + value.ripemd160Preimages, + ) + + FfiConverterMapStringToUint8List.allocationSize(value.sha256Preimages) + + FfiConverterMapStringToUint8List.allocationSize( + value.hash160Preimages, + ) + + FfiConverterMapStringToUint8List.allocationSize( + value.hash256Preimages, + ) + + FfiConverterOptionalUint8List.allocationSize(value.tapKeySig) + + FfiConverterMapTapScriptSigKeyToUint8List.allocationSize( + value.tapScriptSigs, + ) + + FfiConverterMapControlBlockToTapScriptEntry.allocationSize( + value.tapScripts, + ) + + FfiConverterMapStringToTapKeyOrigin.allocationSize( + value.tapKeyOrigins, + ) + + FfiConverterOptionalString.allocationSize(value.tapInternalKey) + + FfiConverterOptionalString.allocationSize(value.tapMerkleRoot) + + FfiConverterMapProprietaryKeyToUint8List.allocationSize( + value.proprietary, + ) + + FfiConverterMapKeyToUint8List.allocationSize(value.unknown) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(CbfComponents value, Uint8List buf) { + static int write(Input value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += CbfClient.write( - value.client, + new_offset += FfiConverterOptionalTransaction.write( + value.nonWitnessUtxo, Uint8List.view(buf.buffer, new_offset), ); - new_offset += CbfNode.write( - value.node, + new_offset += FfiConverterOptionalTxOut.write( + value.witnessUtxo, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterMapStringToUint8List.write( + value.partialSigs, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalString.write( + value.sighashType, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalScript.write( + value.redeemScript, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalScript.write( + value.witnessScript, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterMapStringToKeySource.write( + value.bip32Derivation, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalScript.write( + value.finalScriptSig, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalSequenceUint8List.write( + value.finalScriptWitness, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterMapStringToUint8List.write( + value.ripemd160Preimages, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterMapStringToUint8List.write( + value.sha256Preimages, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterMapStringToUint8List.write( + value.hash160Preimages, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterMapStringToUint8List.write( + value.hash256Preimages, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalUint8List.write( + value.tapKeySig, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterMapTapScriptSigKeyToUint8List.write( + value.tapScriptSigs, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterMapControlBlockToTapScriptEntry.write( + value.tapScripts, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterMapStringToTapKeyOrigin.write( + value.tapKeyOrigins, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalString.write( + value.tapInternalKey, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalString.write( + value.tapMerkleRoot, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterMapProprietaryKeyToUint8List.write( + value.proprietary, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterMapKeyToUint8List.write( + value.unknown, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(CbfComponents value) { - return CbfClient.allocationSize(value.client) + - CbfNode.allocationSize(value.node) + + static int allocationSize(Input value) { + return FfiConverterOptionalTransaction.allocationSize( + value.nonWitnessUtxo, + ) + + FfiConverterOptionalTxOut.allocationSize(value.witnessUtxo) + + FfiConverterMapStringToUint8List.allocationSize(value.partialSigs) + + FfiConverterOptionalString.allocationSize(value.sighashType) + + FfiConverterOptionalScript.allocationSize(value.redeemScript) + + FfiConverterOptionalScript.allocationSize(value.witnessScript) + + FfiConverterMapStringToKeySource.allocationSize(value.bip32Derivation) + + FfiConverterOptionalScript.allocationSize(value.finalScriptSig) + + FfiConverterOptionalSequenceUint8List.allocationSize( + value.finalScriptWitness, + ) + + FfiConverterMapStringToUint8List.allocationSize( + value.ripemd160Preimages, + ) + + FfiConverterMapStringToUint8List.allocationSize(value.sha256Preimages) + + FfiConverterMapStringToUint8List.allocationSize( + value.hash160Preimages, + ) + + FfiConverterMapStringToUint8List.allocationSize( + value.hash256Preimages, + ) + + FfiConverterOptionalUint8List.allocationSize(value.tapKeySig) + + FfiConverterMapTapScriptSigKeyToUint8List.allocationSize( + value.tapScriptSigs, + ) + + FfiConverterMapControlBlockToTapScriptEntry.allocationSize( + value.tapScripts, + ) + + FfiConverterMapStringToTapKeyOrigin.allocationSize( + value.tapKeyOrigins, + ) + + FfiConverterOptionalString.allocationSize(value.tapInternalKey) + + FfiConverterOptionalString.allocationSize(value.tapMerkleRoot) + + FfiConverterMapProprietaryKeyToUint8List.allocationSize( + value.proprietary, + ) + + FfiConverterMapKeyToUint8List.allocationSize(value.unknown) + 0; } } -class ChainChange { - final int height; - final BlockHash? hash; - ChainChange({required this.height, this.hash}); +class Key { + final int typeValue; + final Uint8List key; + Key({required this.typeValue, required this.key}); } -class FfiConverterChainChange { - static ChainChange lift(RustBuffer buf) { - return FfiConverterChainChange.read(buf.asUint8List()).value; +class FfiConverterKey { + static Key lift(RustBuffer buf) { + return FfiConverterKey.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final height_lifted = FfiConverterUInt32.read( + final typeValue_lifted = FfiConverterUInt8.read( Uint8List.view(buf.buffer, new_offset), ); - final height = height_lifted.value; - new_offset += height_lifted.bytesRead; - final hash_lifted = FfiConverterOptionalBlockHash.read( + final typeValue = typeValue_lifted.value; + new_offset += typeValue_lifted.bytesRead; + final key_lifted = FfiConverterUint8List.read( Uint8List.view(buf.buffer, new_offset), ); - final hash = hash_lifted.value; - new_offset += hash_lifted.bytesRead; + final key = key_lifted.value; + new_offset += key_lifted.bytesRead; return LiftRetVal( - ChainChange(height: height, hash: hash), + Key(typeValue: typeValue, key: key), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(ChainChange value) { + static RustBuffer lower(Key value) { final total_length = - FfiConverterUInt32.allocationSize(value.height) + - FfiConverterOptionalBlockHash.allocationSize(value.hash) + + FfiConverterUInt8.allocationSize(value.typeValue) + + FfiConverterUint8List.allocationSize(value.key) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(ChainChange value, Uint8List buf) { + static int write(Key value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += FfiConverterUInt32.write( - value.height, + new_offset += FfiConverterUInt8.write( + value.typeValue, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterOptionalBlockHash.write( - value.hash, + new_offset += FfiConverterUint8List.write( + value.key, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(ChainChange value) { - return FfiConverterUInt32.allocationSize(value.height) + - FfiConverterOptionalBlockHash.allocationSize(value.hash) + + static int allocationSize(Key value) { + return FfiConverterUInt8.allocationSize(value.typeValue) + + FfiConverterUint8List.allocationSize(value.key) + 0; } } -class Condition { - final int? csv; - final LockTime? timelock; - Condition({this.csv, this.timelock}); +class KeySource { + final String fingerprint; + final DerivationPath path; + KeySource({required this.fingerprint, required this.path}); } -class FfiConverterCondition { - static Condition lift(RustBuffer buf) { - return FfiConverterCondition.read(buf.asUint8List()).value; +class FfiConverterKeySource { + static KeySource lift(RustBuffer buf) { + return FfiConverterKeySource.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final csv_lifted = FfiConverterOptionalUInt32.read( + final fingerprint_lifted = FfiConverterString.read( Uint8List.view(buf.buffer, new_offset), ); - final csv = csv_lifted.value; - new_offset += csv_lifted.bytesRead; - final timelock_lifted = FfiConverterOptionalLockTime.read( + final fingerprint = fingerprint_lifted.value; + new_offset += fingerprint_lifted.bytesRead; + final path_lifted = DerivationPath.read( Uint8List.view(buf.buffer, new_offset), ); - final timelock = timelock_lifted.value; - new_offset += timelock_lifted.bytesRead; + final path = path_lifted.value; + new_offset += path_lifted.bytesRead; return LiftRetVal( - Condition(csv: csv, timelock: timelock), + KeySource(fingerprint: fingerprint, path: path), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(Condition value) { + static RustBuffer lower(KeySource value) { final total_length = - FfiConverterOptionalUInt32.allocationSize(value.csv) + - FfiConverterOptionalLockTime.allocationSize(value.timelock) + + FfiConverterString.allocationSize(value.fingerprint) + + DerivationPath.allocationSize(value.path) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(Condition value, Uint8List buf) { + static int write(KeySource value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += FfiConverterOptionalUInt32.write( - value.csv, + new_offset += FfiConverterString.write( + value.fingerprint, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterOptionalLockTime.write( - value.timelock, + new_offset += DerivationPath.write( + value.path, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(Condition value) { - return FfiConverterOptionalUInt32.allocationSize(value.csv) + - FfiConverterOptionalLockTime.allocationSize(value.timelock) + + static int allocationSize(KeySource value) { + return FfiConverterString.allocationSize(value.fingerprint) + + DerivationPath.allocationSize(value.path) + 0; } } -class ConfirmationBlockTime { - final BlockId blockId; - final int confirmationTime; - ConfirmationBlockTime({ - required this.blockId, - required this.confirmationTime, - }); +class OutPoint { + final Txid txid; + final int vout; + OutPoint({required this.txid, required this.vout}); } -class FfiConverterConfirmationBlockTime { - static ConfirmationBlockTime lift(RustBuffer buf) { - return FfiConverterConfirmationBlockTime.read(buf.asUint8List()).value; +class FfiConverterOutPoint { + static OutPoint lift(RustBuffer buf) { + return FfiConverterOutPoint.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final blockId_lifted = FfiConverterBlockId.read( - Uint8List.view(buf.buffer, new_offset), - ); - final blockId = blockId_lifted.value; - new_offset += blockId_lifted.bytesRead; - final confirmationTime_lifted = FfiConverterUInt64.read( + final txid_lifted = Txid.read(Uint8List.view(buf.buffer, new_offset)); + final txid = txid_lifted.value; + new_offset += txid_lifted.bytesRead; + final vout_lifted = FfiConverterUInt32.read( Uint8List.view(buf.buffer, new_offset), ); - final confirmationTime = confirmationTime_lifted.value; - new_offset += confirmationTime_lifted.bytesRead; + final vout = vout_lifted.value; + new_offset += vout_lifted.bytesRead; return LiftRetVal( - ConfirmationBlockTime( - blockId: blockId, - confirmationTime: confirmationTime, - ), + OutPoint(txid: txid, vout: vout), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(ConfirmationBlockTime value) { + static RustBuffer lower(OutPoint value) { final total_length = - FfiConverterBlockId.allocationSize(value.blockId) + - FfiConverterUInt64.allocationSize(value.confirmationTime) + + Txid.allocationSize(value.txid) + + FfiConverterUInt32.allocationSize(value.vout) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(ConfirmationBlockTime value, Uint8List buf) { + static int write(OutPoint value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += FfiConverterBlockId.write( - value.blockId, + new_offset += Txid.write( + value.txid, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterUInt64.write( - value.confirmationTime, + new_offset += FfiConverterUInt32.write( + value.vout, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(ConfirmationBlockTime value) { - return FfiConverterBlockId.allocationSize(value.blockId) + - FfiConverterUInt64.allocationSize(value.confirmationTime) + + static int allocationSize(OutPoint value) { + return Txid.allocationSize(value.txid) + + FfiConverterUInt32.allocationSize(value.vout) + 0; } } -class Conflict { - final int vin; - final Txid txid; - Conflict({required this.vin, required this.txid}); -} - -class FfiConverterConflict { - static Conflict lift(RustBuffer buf) { - return FfiConverterConflict.read(buf.asUint8List()).value; - } - - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final vin_lifted = FfiConverterUInt32.read( - Uint8List.view(buf.buffer, new_offset), - ); - final vin = vin_lifted.value; - new_offset += vin_lifted.bytesRead; - final txid_lifted = Txid.read(Uint8List.view(buf.buffer, new_offset)); - final txid = txid_lifted.value; - new_offset += txid_lifted.bytesRead; - return LiftRetVal( - Conflict(vin: vin, txid: txid), - new_offset - buf.offsetInBytes, - ); - } +class Output { + final Script? redeemScript; + final Script? witnessScript; + final Map bip32Derivation; + final String? tapInternalKey; + final TapTree? tapTree; + final Map tapKeyOrigins; + final Map proprietary; + final Map unknown; + Output({ + this.redeemScript, + this.witnessScript, + required this.bip32Derivation, + this.tapInternalKey, + this.tapTree, + required this.tapKeyOrigins, + required this.proprietary, + required this.unknown, + }); +} - static RustBuffer lower(Conflict value) { - final total_length = - FfiConverterUInt32.allocationSize(value.vin) + - Txid.allocationSize(value.txid) + - 0; - final buf = Uint8List(total_length); - write(value, buf); - return toRustBuffer(buf); +class FfiConverterOutput { + static Output lift(RustBuffer buf) { + return FfiConverterOutput.read(buf.asUint8List()).value; } - static int write(Conflict value, Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += FfiConverterUInt32.write( - value.vin, + final redeemScript_lifted = FfiConverterOptionalScript.read( Uint8List.view(buf.buffer, new_offset), ); - new_offset += Txid.write( - value.txid, + final redeemScript = redeemScript_lifted.value; + new_offset += redeemScript_lifted.bytesRead; + final witnessScript_lifted = FfiConverterOptionalScript.read( Uint8List.view(buf.buffer, new_offset), ); - return new_offset - buf.offsetInBytes; - } - - static int allocationSize(Conflict value) { - return FfiConverterUInt32.allocationSize(value.vin) + - Txid.allocationSize(value.txid) + - 0; - } -} - -class ControlBlock { - final Uint8List internalKey; - final List merkleBranch; - final int outputKeyParity; - final int leafVersion; - ControlBlock({ - required this.internalKey, - required this.merkleBranch, - required this.outputKeyParity, - required this.leafVersion, - }); -} - -class FfiConverterControlBlock { - static ControlBlock lift(RustBuffer buf) { - return FfiConverterControlBlock.read(buf.asUint8List()).value; - } - - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final internalKey_lifted = FfiConverterUint8List.read( + final witnessScript = witnessScript_lifted.value; + new_offset += witnessScript_lifted.bytesRead; + final bip32Derivation_lifted = FfiConverterMapStringToKeySource.read( Uint8List.view(buf.buffer, new_offset), ); - final internalKey = internalKey_lifted.value; - new_offset += internalKey_lifted.bytesRead; - final merkleBranch_lifted = FfiConverterSequenceString.read( + final bip32Derivation = bip32Derivation_lifted.value; + new_offset += bip32Derivation_lifted.bytesRead; + final tapInternalKey_lifted = FfiConverterOptionalString.read( Uint8List.view(buf.buffer, new_offset), ); - final merkleBranch = merkleBranch_lifted.value; - new_offset += merkleBranch_lifted.bytesRead; - final outputKeyParity_lifted = FfiConverterUInt8.read( + final tapInternalKey = tapInternalKey_lifted.value; + new_offset += tapInternalKey_lifted.bytesRead; + final tapTree_lifted = FfiConverterOptionalTapTree.read( Uint8List.view(buf.buffer, new_offset), ); - final outputKeyParity = outputKeyParity_lifted.value; - new_offset += outputKeyParity_lifted.bytesRead; - final leafVersion_lifted = FfiConverterUInt8.read( + final tapTree = tapTree_lifted.value; + new_offset += tapTree_lifted.bytesRead; + final tapKeyOrigins_lifted = FfiConverterMapStringToTapKeyOrigin.read( Uint8List.view(buf.buffer, new_offset), ); - final leafVersion = leafVersion_lifted.value; - new_offset += leafVersion_lifted.bytesRead; + final tapKeyOrigins = tapKeyOrigins_lifted.value; + new_offset += tapKeyOrigins_lifted.bytesRead; + final proprietary_lifted = FfiConverterMapProprietaryKeyToUint8List.read( + Uint8List.view(buf.buffer, new_offset), + ); + final proprietary = proprietary_lifted.value; + new_offset += proprietary_lifted.bytesRead; + final unknown_lifted = FfiConverterMapKeyToUint8List.read( + Uint8List.view(buf.buffer, new_offset), + ); + final unknown = unknown_lifted.value; + new_offset += unknown_lifted.bytesRead; return LiftRetVal( - ControlBlock( - internalKey: internalKey, - merkleBranch: merkleBranch, - outputKeyParity: outputKeyParity, - leafVersion: leafVersion, + Output( + redeemScript: redeemScript, + witnessScript: witnessScript, + bip32Derivation: bip32Derivation, + tapInternalKey: tapInternalKey, + tapTree: tapTree, + tapKeyOrigins: tapKeyOrigins, + proprietary: proprietary, + unknown: unknown, ), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(ControlBlock value) { + static RustBuffer lower(Output value) { final total_length = - FfiConverterUint8List.allocationSize(value.internalKey) + - FfiConverterSequenceString.allocationSize(value.merkleBranch) + - FfiConverterUInt8.allocationSize(value.outputKeyParity) + - FfiConverterUInt8.allocationSize(value.leafVersion) + + FfiConverterOptionalScript.allocationSize(value.redeemScript) + + FfiConverterOptionalScript.allocationSize(value.witnessScript) + + FfiConverterMapStringToKeySource.allocationSize(value.bip32Derivation) + + FfiConverterOptionalString.allocationSize(value.tapInternalKey) + + FfiConverterOptionalTapTree.allocationSize(value.tapTree) + + FfiConverterMapStringToTapKeyOrigin.allocationSize( + value.tapKeyOrigins, + ) + + FfiConverterMapProprietaryKeyToUint8List.allocationSize( + value.proprietary, + ) + + FfiConverterMapKeyToUint8List.allocationSize(value.unknown) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(ControlBlock value, Uint8List buf) { + static int write(Output value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += FfiConverterUint8List.write( - value.internalKey, + new_offset += FfiConverterOptionalScript.write( + value.redeemScript, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterSequenceString.write( - value.merkleBranch, + new_offset += FfiConverterOptionalScript.write( + value.witnessScript, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterUInt8.write( - value.outputKeyParity, + new_offset += FfiConverterMapStringToKeySource.write( + value.bip32Derivation, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterUInt8.write( - value.leafVersion, + new_offset += FfiConverterOptionalString.write( + value.tapInternalKey, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalTapTree.write( + value.tapTree, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterMapStringToTapKeyOrigin.write( + value.tapKeyOrigins, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterMapProprietaryKeyToUint8List.write( + value.proprietary, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterMapKeyToUint8List.write( + value.unknown, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(ControlBlock value) { - return FfiConverterUint8List.allocationSize(value.internalKey) + - FfiConverterSequenceString.allocationSize(value.merkleBranch) + - FfiConverterUInt8.allocationSize(value.outputKeyParity) + - FfiConverterUInt8.allocationSize(value.leafVersion) + + static int allocationSize(Output value) { + return FfiConverterOptionalScript.allocationSize(value.redeemScript) + + FfiConverterOptionalScript.allocationSize(value.witnessScript) + + FfiConverterMapStringToKeySource.allocationSize(value.bip32Derivation) + + FfiConverterOptionalString.allocationSize(value.tapInternalKey) + + FfiConverterOptionalTapTree.allocationSize(value.tapTree) + + FfiConverterMapStringToTapKeyOrigin.allocationSize( + value.tapKeyOrigins, + ) + + FfiConverterMapProprietaryKeyToUint8List.allocationSize( + value.proprietary, + ) + + FfiConverterMapKeyToUint8List.allocationSize(value.unknown) + 0; } } -class EvictedTx { - final Txid txid; - final int evictedAt; - EvictedTx({required this.txid, required this.evictedAt}); +class ProprietaryKey { + final Uint8List prefix; + final int subtype; + final Uint8List key; + ProprietaryKey({ + required this.prefix, + required this.subtype, + required this.key, + }); } -class FfiConverterEvictedTx { - static EvictedTx lift(RustBuffer buf) { - return FfiConverterEvictedTx.read(buf.asUint8List()).value; +class FfiConverterProprietaryKey { + static ProprietaryKey lift(RustBuffer buf) { + return FfiConverterProprietaryKey.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final txid_lifted = Txid.read(Uint8List.view(buf.buffer, new_offset)); - final txid = txid_lifted.value; - new_offset += txid_lifted.bytesRead; - final evictedAt_lifted = FfiConverterUInt64.read( + final prefix_lifted = FfiConverterUint8List.read( Uint8List.view(buf.buffer, new_offset), ); - final evictedAt = evictedAt_lifted.value; - new_offset += evictedAt_lifted.bytesRead; + final prefix = prefix_lifted.value; + new_offset += prefix_lifted.bytesRead; + final subtype_lifted = FfiConverterUInt8.read( + Uint8List.view(buf.buffer, new_offset), + ); + final subtype = subtype_lifted.value; + new_offset += subtype_lifted.bytesRead; + final key_lifted = FfiConverterUint8List.read( + Uint8List.view(buf.buffer, new_offset), + ); + final key = key_lifted.value; + new_offset += key_lifted.bytesRead; return LiftRetVal( - EvictedTx(txid: txid, evictedAt: evictedAt), + ProprietaryKey(prefix: prefix, subtype: subtype, key: key), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(EvictedTx value) { + static RustBuffer lower(ProprietaryKey value) { final total_length = - Txid.allocationSize(value.txid) + - FfiConverterUInt64.allocationSize(value.evictedAt) + + FfiConverterUint8List.allocationSize(value.prefix) + + FfiConverterUInt8.allocationSize(value.subtype) + + FfiConverterUint8List.allocationSize(value.key) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(EvictedTx value, Uint8List buf) { + static int write(ProprietaryKey value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += Txid.write( - value.txid, + new_offset += FfiConverterUint8List.write( + value.prefix, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterUInt64.write( - value.evictedAt, + new_offset += FfiConverterUInt8.write( + value.subtype, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterUint8List.write( + value.key, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(EvictedTx value) { - return Txid.allocationSize(value.txid) + - FfiConverterUInt64.allocationSize(value.evictedAt) + + static int allocationSize(ProprietaryKey value) { + return FfiConverterUint8List.allocationSize(value.prefix) + + FfiConverterUInt8.allocationSize(value.subtype) + + FfiConverterUint8List.allocationSize(value.key) + 0; } } -class FinalizedPsbtResult { - final Psbt psbt; - final bool couldFinalize; - final List? errors; - FinalizedPsbtResult({ - required this.psbt, - required this.couldFinalize, - this.errors, - }); +class TapKeyOrigin { + final List tapLeafHashes; + final KeySource keySource; + TapKeyOrigin({required this.tapLeafHashes, required this.keySource}); } -class FfiConverterFinalizedPsbtResult { - static FinalizedPsbtResult lift(RustBuffer buf) { - return FfiConverterFinalizedPsbtResult.read(buf.asUint8List()).value; +class FfiConverterTapKeyOrigin { + static TapKeyOrigin lift(RustBuffer buf) { + return FfiConverterTapKeyOrigin.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final psbt_lifted = Psbt.read(Uint8List.view(buf.buffer, new_offset)); - final psbt = psbt_lifted.value; - new_offset += psbt_lifted.bytesRead; - final couldFinalize_lifted = FfiConverterBool.read( + final tapLeafHashes_lifted = FfiConverterSequenceString.read( Uint8List.view(buf.buffer, new_offset), ); - final couldFinalize = couldFinalize_lifted.value; - new_offset += couldFinalize_lifted.bytesRead; - final errors_lifted = - FfiConverterOptionalSequencePsbtFinalizeException.read( - Uint8List.view(buf.buffer, new_offset), - ); - final errors = errors_lifted.value; - new_offset += errors_lifted.bytesRead; + final tapLeafHashes = tapLeafHashes_lifted.value; + new_offset += tapLeafHashes_lifted.bytesRead; + final keySource_lifted = FfiConverterKeySource.read( + Uint8List.view(buf.buffer, new_offset), + ); + final keySource = keySource_lifted.value; + new_offset += keySource_lifted.bytesRead; return LiftRetVal( - FinalizedPsbtResult( - psbt: psbt, - couldFinalize: couldFinalize, - errors: errors, - ), + TapKeyOrigin(tapLeafHashes: tapLeafHashes, keySource: keySource), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(FinalizedPsbtResult value) { + static RustBuffer lower(TapKeyOrigin value) { final total_length = - Psbt.allocationSize(value.psbt) + - FfiConverterBool.allocationSize(value.couldFinalize) + - FfiConverterOptionalSequencePsbtFinalizeException.allocationSize( - value.errors, - ) + + FfiConverterSequenceString.allocationSize(value.tapLeafHashes) + + FfiConverterKeySource.allocationSize(value.keySource) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(FinalizedPsbtResult value, Uint8List buf) { + static int write(TapKeyOrigin value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += Psbt.write( - value.psbt, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterBool.write( - value.couldFinalize, + new_offset += FfiConverterSequenceString.write( + value.tapLeafHashes, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterOptionalSequencePsbtFinalizeException.write( - value.errors, + new_offset += FfiConverterKeySource.write( + value.keySource, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(FinalizedPsbtResult value) { - return Psbt.allocationSize(value.psbt) + - FfiConverterBool.allocationSize(value.couldFinalize) + - FfiConverterOptionalSequencePsbtFinalizeException.allocationSize( - value.errors, - ) + + static int allocationSize(TapKeyOrigin value) { + return FfiConverterSequenceString.allocationSize(value.tapLeafHashes) + + FfiConverterKeySource.allocationSize(value.keySource) + 0; } } -class Header { - final int version; - final BlockHash prevBlockhash; - final TxMerkleNode merkleRoot; - final int time; - final int bits; - final int nonce; - Header({ - required this.version, - required this.prevBlockhash, - required this.merkleRoot, - required this.time, - required this.bits, - required this.nonce, - }); +class TapScriptEntry { + final Script script; + final int leafVersion; + TapScriptEntry({required this.script, required this.leafVersion}); } -class FfiConverterHeader { - static Header lift(RustBuffer buf) { - return FfiConverterHeader.read(buf.asUint8List()).value; +class FfiConverterTapScriptEntry { + static TapScriptEntry lift(RustBuffer buf) { + return FfiConverterTapScriptEntry.read(buf.asUint8List()).value; } - static LiftRetVal
read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final version_lifted = FfiConverterInt32.read( - Uint8List.view(buf.buffer, new_offset), - ); - final version = version_lifted.value; - new_offset += version_lifted.bytesRead; - final prevBlockhash_lifted = BlockHash.read( - Uint8List.view(buf.buffer, new_offset), - ); - final prevBlockhash = prevBlockhash_lifted.value; - new_offset += prevBlockhash_lifted.bytesRead; - final merkleRoot_lifted = TxMerkleNode.read( - Uint8List.view(buf.buffer, new_offset), - ); - final merkleRoot = merkleRoot_lifted.value; - new_offset += merkleRoot_lifted.bytesRead; - final time_lifted = FfiConverterUInt32.read( - Uint8List.view(buf.buffer, new_offset), - ); - final time = time_lifted.value; - new_offset += time_lifted.bytesRead; - final bits_lifted = FfiConverterUInt32.read( - Uint8List.view(buf.buffer, new_offset), - ); - final bits = bits_lifted.value; - new_offset += bits_lifted.bytesRead; - final nonce_lifted = FfiConverterUInt32.read( + final script_lifted = Script.read(Uint8List.view(buf.buffer, new_offset)); + final script = script_lifted.value; + new_offset += script_lifted.bytesRead; + final leafVersion_lifted = FfiConverterUInt8.read( Uint8List.view(buf.buffer, new_offset), ); - final nonce = nonce_lifted.value; - new_offset += nonce_lifted.bytesRead; + final leafVersion = leafVersion_lifted.value; + new_offset += leafVersion_lifted.bytesRead; return LiftRetVal( - Header( - version: version, - prevBlockhash: prevBlockhash, - merkleRoot: merkleRoot, - time: time, - bits: bits, - nonce: nonce, - ), + TapScriptEntry(script: script, leafVersion: leafVersion), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(Header value) { + static RustBuffer lower(TapScriptEntry value) { final total_length = - FfiConverterInt32.allocationSize(value.version) + - BlockHash.allocationSize(value.prevBlockhash) + - TxMerkleNode.allocationSize(value.merkleRoot) + - FfiConverterUInt32.allocationSize(value.time) + - FfiConverterUInt32.allocationSize(value.bits) + - FfiConverterUInt32.allocationSize(value.nonce) + + Script.allocationSize(value.script) + + FfiConverterUInt8.allocationSize(value.leafVersion) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(Header value, Uint8List buf) { + static int write(TapScriptEntry value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += FfiConverterInt32.write( - value.version, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += BlockHash.write( - value.prevBlockhash, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += TxMerkleNode.write( - value.merkleRoot, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterUInt32.write( - value.time, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterUInt32.write( - value.bits, + new_offset += Script.write( + value.script, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterUInt32.write( - value.nonce, + new_offset += FfiConverterUInt8.write( + value.leafVersion, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(Header value) { - return FfiConverterInt32.allocationSize(value.version) + - BlockHash.allocationSize(value.prevBlockhash) + - TxMerkleNode.allocationSize(value.merkleRoot) + - FfiConverterUInt32.allocationSize(value.time) + - FfiConverterUInt32.allocationSize(value.bits) + - FfiConverterUInt32.allocationSize(value.nonce) + + static int allocationSize(TapScriptEntry value) { + return Script.allocationSize(value.script) + + FfiConverterUInt8.allocationSize(value.leafVersion) + 0; } } -class HeaderNotification { - final int height; - final Header header; - HeaderNotification({required this.height, required this.header}); +class TapScriptSigKey { + final String xonlyPubkey; + final String tapLeafHash; + TapScriptSigKey({required this.xonlyPubkey, required this.tapLeafHash}); } -class FfiConverterHeaderNotification { - static HeaderNotification lift(RustBuffer buf) { - return FfiConverterHeaderNotification.read(buf.asUint8List()).value; +class FfiConverterTapScriptSigKey { + static TapScriptSigKey lift(RustBuffer buf) { + return FfiConverterTapScriptSigKey.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final height_lifted = FfiConverterUInt64.read( + final xonlyPubkey_lifted = FfiConverterString.read( Uint8List.view(buf.buffer, new_offset), ); - final height = height_lifted.value; - new_offset += height_lifted.bytesRead; - final header_lifted = FfiConverterHeader.read( + final xonlyPubkey = xonlyPubkey_lifted.value; + new_offset += xonlyPubkey_lifted.bytesRead; + final tapLeafHash_lifted = FfiConverterString.read( Uint8List.view(buf.buffer, new_offset), ); - final header = header_lifted.value; - new_offset += header_lifted.bytesRead; + final tapLeafHash = tapLeafHash_lifted.value; + new_offset += tapLeafHash_lifted.bytesRead; return LiftRetVal( - HeaderNotification(height: height, header: header), + TapScriptSigKey(xonlyPubkey: xonlyPubkey, tapLeafHash: tapLeafHash), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(HeaderNotification value) { + static RustBuffer lower(TapScriptSigKey value) { final total_length = - FfiConverterUInt64.allocationSize(value.height) + - FfiConverterHeader.allocationSize(value.header) + + FfiConverterString.allocationSize(value.xonlyPubkey) + + FfiConverterString.allocationSize(value.tapLeafHash) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(HeaderNotification value, Uint8List buf) { + static int write(TapScriptSigKey value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += FfiConverterUInt64.write( - value.height, + new_offset += FfiConverterString.write( + value.xonlyPubkey, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterHeader.write( - value.header, + new_offset += FfiConverterString.write( + value.tapLeafHash, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(HeaderNotification value) { - return FfiConverterUInt64.allocationSize(value.height) + - FfiConverterHeader.allocationSize(value.header) + + static int allocationSize(TapScriptSigKey value) { + return FfiConverterString.allocationSize(value.xonlyPubkey) + + FfiConverterString.allocationSize(value.tapLeafHash) + 0; } } -class IndexerChangeSet { - final Map lastRevealed; - IndexerChangeSet({required this.lastRevealed}); +class TxIn { + final OutPoint previousOutput; + final Script scriptSig; + final int sequence; + final List witness; + TxIn({ + required this.previousOutput, + required this.scriptSig, + required this.sequence, + required this.witness, + }); } -class FfiConverterIndexerChangeSet { - static IndexerChangeSet lift(RustBuffer buf) { - return FfiConverterIndexerChangeSet.read(buf.asUint8List()).value; +class FfiConverterTxIn { + static TxIn lift(RustBuffer buf) { + return FfiConverterTxIn.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final lastRevealed_lifted = FfiConverterMapDescriptorIdToUInt32.read( + final previousOutput_lifted = FfiConverterOutPoint.read( Uint8List.view(buf.buffer, new_offset), ); - final lastRevealed = lastRevealed_lifted.value; - new_offset += lastRevealed_lifted.bytesRead; + final previousOutput = previousOutput_lifted.value; + new_offset += previousOutput_lifted.bytesRead; + final scriptSig_lifted = Script.read( + Uint8List.view(buf.buffer, new_offset), + ); + final scriptSig = scriptSig_lifted.value; + new_offset += scriptSig_lifted.bytesRead; + final sequence_lifted = FfiConverterUInt32.read( + Uint8List.view(buf.buffer, new_offset), + ); + final sequence = sequence_lifted.value; + new_offset += sequence_lifted.bytesRead; + final witness_lifted = FfiConverterSequenceUint8List.read( + Uint8List.view(buf.buffer, new_offset), + ); + final witness = witness_lifted.value; + new_offset += witness_lifted.bytesRead; return LiftRetVal( - IndexerChangeSet(lastRevealed: lastRevealed), + TxIn( + previousOutput: previousOutput, + scriptSig: scriptSig, + sequence: sequence, + witness: witness, + ), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(IndexerChangeSet value) { + static RustBuffer lower(TxIn value) { final total_length = - FfiConverterMapDescriptorIdToUInt32.allocationSize(value.lastRevealed) + + FfiConverterOutPoint.allocationSize(value.previousOutput) + + Script.allocationSize(value.scriptSig) + + FfiConverterUInt32.allocationSize(value.sequence) + + FfiConverterSequenceUint8List.allocationSize(value.witness) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(IndexerChangeSet value, Uint8List buf) { + static int write(TxIn value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += FfiConverterMapDescriptorIdToUInt32.write( - value.lastRevealed, + new_offset += FfiConverterOutPoint.write( + value.previousOutput, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += Script.write( + value.scriptSig, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterUInt32.write( + value.sequence, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterSequenceUint8List.write( + value.witness, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(IndexerChangeSet value) { - return FfiConverterMapDescriptorIdToUInt32.allocationSize( - value.lastRevealed, - ) + + static int allocationSize(TxIn value) { + return FfiConverterOutPoint.allocationSize(value.previousOutput) + + Script.allocationSize(value.scriptSig) + + FfiConverterUInt32.allocationSize(value.sequence) + + FfiConverterSequenceUint8List.allocationSize(value.witness) + 0; } } -class Input { - final Transaction? nonWitnessUtxo; - final TxOut? witnessUtxo; - final Map partialSigs; - final String? sighashType; - final Script? redeemScript; - final Script? witnessScript; - final Map bip32Derivation; - final Script? finalScriptSig; - final List? finalScriptWitness; - final Map ripemd160Preimages; - final Map sha256Preimages; - final Map hash160Preimages; - final Map hash256Preimages; - final Uint8List? tapKeySig; - final Map tapScriptSigs; - final Map tapScripts; - final Map tapKeyOrigins; - final String? tapInternalKey; - final String? tapMerkleRoot; - final Map proprietary; - final Map unknown; - Input({ - this.nonWitnessUtxo, - this.witnessUtxo, - required this.partialSigs, - this.sighashType, - this.redeemScript, - this.witnessScript, - required this.bip32Derivation, - this.finalScriptSig, - this.finalScriptWitness, - required this.ripemd160Preimages, - required this.sha256Preimages, - required this.hash160Preimages, - required this.hash256Preimages, - this.tapKeySig, - required this.tapScriptSigs, - required this.tapScripts, - required this.tapKeyOrigins, - this.tapInternalKey, - this.tapMerkleRoot, - required this.proprietary, - required this.unknown, - }); +class TxOut { + final Amount value; + final Script scriptPubkey; + TxOut({required this.value, required this.scriptPubkey}); } -class FfiConverterInput { - static Input lift(RustBuffer buf) { - return FfiConverterInput.read(buf.asUint8List()).value; +class FfiConverterTxOut { + static TxOut lift(RustBuffer buf) { + return FfiConverterTxOut.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final nonWitnessUtxo_lifted = FfiConverterOptionalTransaction.read( + final value_lifted = Amount.read(Uint8List.view(buf.buffer, new_offset)); + final value = value_lifted.value; + new_offset += value_lifted.bytesRead; + final scriptPubkey_lifted = Script.read( Uint8List.view(buf.buffer, new_offset), ); - final nonWitnessUtxo = nonWitnessUtxo_lifted.value; - new_offset += nonWitnessUtxo_lifted.bytesRead; - final witnessUtxo_lifted = FfiConverterOptionalTxOut.read( - Uint8List.view(buf.buffer, new_offset), + final scriptPubkey = scriptPubkey_lifted.value; + new_offset += scriptPubkey_lifted.bytesRead; + return LiftRetVal( + TxOut(value: value, scriptPubkey: scriptPubkey), + new_offset - buf.offsetInBytes, ); - final witnessUtxo = witnessUtxo_lifted.value; - new_offset += witnessUtxo_lifted.bytesRead; - final partialSigs_lifted = FfiConverterMapStringToUint8List.read( + } + + static RustBuffer lower(TxOut value) { + final total_length = + Amount.allocationSize(value.value) + + Script.allocationSize(value.scriptPubkey) + + 0; + final buf = Uint8List(total_length); + write(value, buf); + return toRustBuffer(buf); + } + + static int write(TxOut value, Uint8List buf) { + int new_offset = buf.offsetInBytes; + new_offset += Amount.write( + value.value, Uint8List.view(buf.buffer, new_offset), ); - final partialSigs = partialSigs_lifted.value; - new_offset += partialSigs_lifted.bytesRead; - final sighashType_lifted = FfiConverterOptionalString.read( + new_offset += Script.write( + value.scriptPubkey, Uint8List.view(buf.buffer, new_offset), ); - final sighashType = sighashType_lifted.value; - new_offset += sighashType_lifted.bytesRead; - final redeemScript_lifted = FfiConverterOptionalScript.read( + return new_offset - buf.offsetInBytes; + } + + static int allocationSize(TxOut value) { + return Amount.allocationSize(value.value) + + Script.allocationSize(value.scriptPubkey) + + 0; + } +} + +class WitnessProgram { + final int version; + final Uint8List program; + WitnessProgram({required this.version, required this.program}); +} + +class FfiConverterWitnessProgram { + static WitnessProgram lift(RustBuffer buf) { + return FfiConverterWitnessProgram.read(buf.asUint8List()).value; + } + + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final version_lifted = FfiConverterUInt8.read( Uint8List.view(buf.buffer, new_offset), ); - final redeemScript = redeemScript_lifted.value; - new_offset += redeemScript_lifted.bytesRead; - final witnessScript_lifted = FfiConverterOptionalScript.read( + final version = version_lifted.value; + new_offset += version_lifted.bytesRead; + final program_lifted = FfiConverterUint8List.read( Uint8List.view(buf.buffer, new_offset), ); - final witnessScript = witnessScript_lifted.value; - new_offset += witnessScript_lifted.bytesRead; - final bip32Derivation_lifted = FfiConverterMapStringToKeySource.read( - Uint8List.view(buf.buffer, new_offset), + final program = program_lifted.value; + new_offset += program_lifted.bytesRead; + return LiftRetVal( + WitnessProgram(version: version, program: program), + new_offset - buf.offsetInBytes, ); - final bip32Derivation = bip32Derivation_lifted.value; - new_offset += bip32Derivation_lifted.bytesRead; - final finalScriptSig_lifted = FfiConverterOptionalScript.read( + } + + static RustBuffer lower(WitnessProgram value) { + final total_length = + FfiConverterUInt8.allocationSize(value.version) + + FfiConverterUint8List.allocationSize(value.program) + + 0; + final buf = Uint8List(total_length); + write(value, buf); + return toRustBuffer(buf); + } + + static int write(WitnessProgram value, Uint8List buf) { + int new_offset = buf.offsetInBytes; + new_offset += FfiConverterUInt8.write( + value.version, Uint8List.view(buf.buffer, new_offset), ); - final finalScriptSig = finalScriptSig_lifted.value; - new_offset += finalScriptSig_lifted.bytesRead; - final finalScriptWitness_lifted = - FfiConverterOptionalSequenceUint8List.read( - Uint8List.view(buf.buffer, new_offset), - ); - final finalScriptWitness = finalScriptWitness_lifted.value; - new_offset += finalScriptWitness_lifted.bytesRead; - final ripemd160Preimages_lifted = FfiConverterMapStringToUint8List.read( + new_offset += FfiConverterUint8List.write( + value.program, Uint8List.view(buf.buffer, new_offset), ); - final ripemd160Preimages = ripemd160Preimages_lifted.value; - new_offset += ripemd160Preimages_lifted.bytesRead; - final sha256Preimages_lifted = FfiConverterMapStringToUint8List.read( + return new_offset - buf.offsetInBytes; + } + + static int allocationSize(WitnessProgram value) { + return FfiConverterUInt8.allocationSize(value.version) + + FfiConverterUint8List.allocationSize(value.program) + + 0; + } +} + +class HeaderNotification { + final int height; + final Header header; + HeaderNotification({required this.height, required this.header}); +} + +class FfiConverterHeaderNotification { + static HeaderNotification lift(RustBuffer buf) { + return FfiConverterHeaderNotification.read(buf.asUint8List()).value; + } + + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final height_lifted = FfiConverterUInt64.read( Uint8List.view(buf.buffer, new_offset), ); - final sha256Preimages = sha256Preimages_lifted.value; - new_offset += sha256Preimages_lifted.bytesRead; - final hash160Preimages_lifted = FfiConverterMapStringToUint8List.read( + final height = height_lifted.value; + new_offset += height_lifted.bytesRead; + final header_lifted = FfiConverterHeader.read( Uint8List.view(buf.buffer, new_offset), ); - final hash160Preimages = hash160Preimages_lifted.value; - new_offset += hash160Preimages_lifted.bytesRead; - final hash256Preimages_lifted = FfiConverterMapStringToUint8List.read( - Uint8List.view(buf.buffer, new_offset), + final header = header_lifted.value; + new_offset += header_lifted.bytesRead; + return LiftRetVal( + HeaderNotification(height: height, header: header), + new_offset - buf.offsetInBytes, ); - final hash256Preimages = hash256Preimages_lifted.value; - new_offset += hash256Preimages_lifted.bytesRead; - final tapKeySig_lifted = FfiConverterOptionalUint8List.read( + } + + static RustBuffer lower(HeaderNotification value) { + final total_length = + FfiConverterUInt64.allocationSize(value.height) + + FfiConverterHeader.allocationSize(value.header) + + 0; + final buf = Uint8List(total_length); + write(value, buf); + return toRustBuffer(buf); + } + + static int write(HeaderNotification value, Uint8List buf) { + int new_offset = buf.offsetInBytes; + new_offset += FfiConverterUInt64.write( + value.height, Uint8List.view(buf.buffer, new_offset), ); - final tapKeySig = tapKeySig_lifted.value; - new_offset += tapKeySig_lifted.bytesRead; - final tapScriptSigs_lifted = FfiConverterMapTapScriptSigKeyToUint8List.read( + new_offset += FfiConverterHeader.write( + value.header, Uint8List.view(buf.buffer, new_offset), ); - final tapScriptSigs = tapScriptSigs_lifted.value; - new_offset += tapScriptSigs_lifted.bytesRead; - final tapScripts_lifted = FfiConverterMapControlBlockToTapScriptEntry.read( + return new_offset - buf.offsetInBytes; + } + + static int allocationSize(HeaderNotification value) { + return FfiConverterUInt64.allocationSize(value.height) + + FfiConverterHeader.allocationSize(value.header) + + 0; + } +} + +class ServerFeaturesRes { + final String serverVersion; + final BlockHash genesisHash; + final String protocolMin; + final String protocolMax; + final String? hashFunction; + final int? pruning; + ServerFeaturesRes({ + required this.serverVersion, + required this.genesisHash, + required this.protocolMin, + required this.protocolMax, + this.hashFunction, + this.pruning, + }); +} + +class FfiConverterServerFeaturesRes { + static ServerFeaturesRes lift(RustBuffer buf) { + return FfiConverterServerFeaturesRes.read(buf.asUint8List()).value; + } + + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final serverVersion_lifted = FfiConverterString.read( Uint8List.view(buf.buffer, new_offset), ); - final tapScripts = tapScripts_lifted.value; - new_offset += tapScripts_lifted.bytesRead; - final tapKeyOrigins_lifted = FfiConverterMapStringToTapKeyOrigin.read( + final serverVersion = serverVersion_lifted.value; + new_offset += serverVersion_lifted.bytesRead; + final genesisHash_lifted = BlockHash.read( Uint8List.view(buf.buffer, new_offset), ); - final tapKeyOrigins = tapKeyOrigins_lifted.value; - new_offset += tapKeyOrigins_lifted.bytesRead; - final tapInternalKey_lifted = FfiConverterOptionalString.read( + final genesisHash = genesisHash_lifted.value; + new_offset += genesisHash_lifted.bytesRead; + final protocolMin_lifted = FfiConverterString.read( Uint8List.view(buf.buffer, new_offset), ); - final tapInternalKey = tapInternalKey_lifted.value; - new_offset += tapInternalKey_lifted.bytesRead; - final tapMerkleRoot_lifted = FfiConverterOptionalString.read( + final protocolMin = protocolMin_lifted.value; + new_offset += protocolMin_lifted.bytesRead; + final protocolMax_lifted = FfiConverterString.read( Uint8List.view(buf.buffer, new_offset), ); - final tapMerkleRoot = tapMerkleRoot_lifted.value; - new_offset += tapMerkleRoot_lifted.bytesRead; - final proprietary_lifted = FfiConverterMapProprietaryKeyToUint8List.read( + final protocolMax = protocolMax_lifted.value; + new_offset += protocolMax_lifted.bytesRead; + final hashFunction_lifted = FfiConverterOptionalString.read( Uint8List.view(buf.buffer, new_offset), ); - final proprietary = proprietary_lifted.value; - new_offset += proprietary_lifted.bytesRead; - final unknown_lifted = FfiConverterMapKeyToUint8List.read( + final hashFunction = hashFunction_lifted.value; + new_offset += hashFunction_lifted.bytesRead; + final pruning_lifted = FfiConverterOptionalInt64.read( Uint8List.view(buf.buffer, new_offset), ); - final unknown = unknown_lifted.value; - new_offset += unknown_lifted.bytesRead; + final pruning = pruning_lifted.value; + new_offset += pruning_lifted.bytesRead; return LiftRetVal( - Input( - nonWitnessUtxo: nonWitnessUtxo, - witnessUtxo: witnessUtxo, - partialSigs: partialSigs, - sighashType: sighashType, - redeemScript: redeemScript, - witnessScript: witnessScript, - bip32Derivation: bip32Derivation, - finalScriptSig: finalScriptSig, - finalScriptWitness: finalScriptWitness, - ripemd160Preimages: ripemd160Preimages, - sha256Preimages: sha256Preimages, - hash160Preimages: hash160Preimages, - hash256Preimages: hash256Preimages, - tapKeySig: tapKeySig, - tapScriptSigs: tapScriptSigs, - tapScripts: tapScripts, - tapKeyOrigins: tapKeyOrigins, - tapInternalKey: tapInternalKey, - tapMerkleRoot: tapMerkleRoot, - proprietary: proprietary, - unknown: unknown, + ServerFeaturesRes( + serverVersion: serverVersion, + genesisHash: genesisHash, + protocolMin: protocolMin, + protocolMax: protocolMax, + hashFunction: hashFunction, + pruning: pruning, ), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(Input value) { + static RustBuffer lower(ServerFeaturesRes value) { final total_length = - FfiConverterOptionalTransaction.allocationSize(value.nonWitnessUtxo) + - FfiConverterOptionalTxOut.allocationSize(value.witnessUtxo) + - FfiConverterMapStringToUint8List.allocationSize(value.partialSigs) + - FfiConverterOptionalString.allocationSize(value.sighashType) + - FfiConverterOptionalScript.allocationSize(value.redeemScript) + - FfiConverterOptionalScript.allocationSize(value.witnessScript) + - FfiConverterMapStringToKeySource.allocationSize(value.bip32Derivation) + - FfiConverterOptionalScript.allocationSize(value.finalScriptSig) + - FfiConverterOptionalSequenceUint8List.allocationSize( - value.finalScriptWitness, - ) + - FfiConverterMapStringToUint8List.allocationSize( - value.ripemd160Preimages, - ) + - FfiConverterMapStringToUint8List.allocationSize(value.sha256Preimages) + - FfiConverterMapStringToUint8List.allocationSize( - value.hash160Preimages, - ) + - FfiConverterMapStringToUint8List.allocationSize( - value.hash256Preimages, - ) + - FfiConverterOptionalUint8List.allocationSize(value.tapKeySig) + - FfiConverterMapTapScriptSigKeyToUint8List.allocationSize( - value.tapScriptSigs, - ) + - FfiConverterMapControlBlockToTapScriptEntry.allocationSize( - value.tapScripts, - ) + - FfiConverterMapStringToTapKeyOrigin.allocationSize( - value.tapKeyOrigins, - ) + - FfiConverterOptionalString.allocationSize(value.tapInternalKey) + - FfiConverterOptionalString.allocationSize(value.tapMerkleRoot) + - FfiConverterMapProprietaryKeyToUint8List.allocationSize( - value.proprietary, - ) + - FfiConverterMapKeyToUint8List.allocationSize(value.unknown) + + FfiConverterString.allocationSize(value.serverVersion) + + BlockHash.allocationSize(value.genesisHash) + + FfiConverterString.allocationSize(value.protocolMin) + + FfiConverterString.allocationSize(value.protocolMax) + + FfiConverterOptionalString.allocationSize(value.hashFunction) + + FfiConverterOptionalInt64.allocationSize(value.pruning) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(Input value, Uint8List buf) { + static int write(ServerFeaturesRes value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += FfiConverterOptionalTransaction.write( - value.nonWitnessUtxo, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalTxOut.write( - value.witnessUtxo, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterMapStringToUint8List.write( - value.partialSigs, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalString.write( - value.sighashType, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalScript.write( - value.redeemScript, + new_offset += FfiConverterString.write( + value.serverVersion, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterOptionalScript.write( - value.witnessScript, + new_offset += BlockHash.write( + value.genesisHash, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterMapStringToKeySource.write( - value.bip32Derivation, + new_offset += FfiConverterString.write( + value.protocolMin, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterOptionalScript.write( - value.finalScriptSig, + new_offset += FfiConverterString.write( + value.protocolMax, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterOptionalSequenceUint8List.write( - value.finalScriptWitness, + new_offset += FfiConverterOptionalString.write( + value.hashFunction, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterMapStringToUint8List.write( - value.ripemd160Preimages, + new_offset += FfiConverterOptionalInt64.write( + value.pruning, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterMapStringToUint8List.write( - value.sha256Preimages, + return new_offset - buf.offsetInBytes; + } + + static int allocationSize(ServerFeaturesRes value) { + return FfiConverterString.allocationSize(value.serverVersion) + + BlockHash.allocationSize(value.genesisHash) + + FfiConverterString.allocationSize(value.protocolMin) + + FfiConverterString.allocationSize(value.protocolMax) + + FfiConverterOptionalString.allocationSize(value.hashFunction) + + FfiConverterOptionalInt64.allocationSize(value.pruning) + + 0; + } +} + +class CbfComponents { + final CbfClient client; + final CbfNode node; + CbfComponents({required this.client, required this.node}); +} + +class FfiConverterCbfComponents { + static CbfComponents lift(RustBuffer buf) { + return FfiConverterCbfComponents.read(buf.asUint8List()).value; + } + + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final client_lifted = CbfClient.read( Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterMapStringToUint8List.write( - value.hash160Preimages, + final client = client_lifted.value; + new_offset += client_lifted.bytesRead; + final node_lifted = CbfNode.read(Uint8List.view(buf.buffer, new_offset)); + final node = node_lifted.value; + new_offset += node_lifted.bytesRead; + return LiftRetVal( + CbfComponents(client: client, node: node), + new_offset - buf.offsetInBytes, + ); + } + + static RustBuffer lower(CbfComponents value) { + final total_length = + CbfClient.allocationSize(value.client) + + CbfNode.allocationSize(value.node) + + 0; + final buf = Uint8List(total_length); + write(value, buf); + return toRustBuffer(buf); + } + + static int write(CbfComponents value, Uint8List buf) { + int new_offset = buf.offsetInBytes; + new_offset += CbfClient.write( + value.client, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterMapStringToUint8List.write( - value.hash256Preimages, + new_offset += CbfNode.write( + value.node, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterOptionalUint8List.write( - value.tapKeySig, + return new_offset - buf.offsetInBytes; + } + + static int allocationSize(CbfComponents value) { + return CbfClient.allocationSize(value.client) + + CbfNode.allocationSize(value.node) + + 0; + } +} + +class Peer { + final IpAddress address; + final int? port; + final bool v2Transport; + Peer({required this.address, this.port, required this.v2Transport}); +} + +class FfiConverterPeer { + static Peer lift(RustBuffer buf) { + return FfiConverterPeer.read(buf.asUint8List()).value; + } + + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final address_lifted = IpAddress.read( Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterMapTapScriptSigKeyToUint8List.write( - value.tapScriptSigs, + final address = address_lifted.value; + new_offset += address_lifted.bytesRead; + final port_lifted = FfiConverterOptionalUInt16.read( Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterMapControlBlockToTapScriptEntry.write( - value.tapScripts, + final port = port_lifted.value; + new_offset += port_lifted.bytesRead; + final v2Transport_lifted = FfiConverterBool.read( Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterMapStringToTapKeyOrigin.write( - value.tapKeyOrigins, + final v2Transport = v2Transport_lifted.value; + new_offset += v2Transport_lifted.bytesRead; + return LiftRetVal( + Peer(address: address, port: port, v2Transport: v2Transport), + new_offset - buf.offsetInBytes, + ); + } + + static RustBuffer lower(Peer value) { + final total_length = + IpAddress.allocationSize(value.address) + + FfiConverterOptionalUInt16.allocationSize(value.port) + + FfiConverterBool.allocationSize(value.v2Transport) + + 0; + final buf = Uint8List(total_length); + write(value, buf); + return toRustBuffer(buf); + } + + static int write(Peer value, Uint8List buf) { + int new_offset = buf.offsetInBytes; + new_offset += IpAddress.write( + value.address, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterOptionalString.write( - value.tapInternalKey, + new_offset += FfiConverterOptionalUInt16.write( + value.port, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterOptionalString.write( - value.tapMerkleRoot, + new_offset += FfiConverterBool.write( + value.v2Transport, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterMapProprietaryKeyToUint8List.write( - value.proprietary, + return new_offset - buf.offsetInBytes; + } + + static int allocationSize(Peer value) { + return IpAddress.allocationSize(value.address) + + FfiConverterOptionalUInt16.allocationSize(value.port) + + FfiConverterBool.allocationSize(value.v2Transport) + + 0; + } +} + +class Socks5Proxy { + final IpAddress address; + final int port; + Socks5Proxy({required this.address, required this.port}); +} + +class FfiConverterSocks5Proxy { + static Socks5Proxy lift(RustBuffer buf) { + return FfiConverterSocks5Proxy.read(buf.asUint8List()).value; + } + + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final address_lifted = IpAddress.read( Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterMapKeyToUint8List.write( - value.unknown, + final address = address_lifted.value; + new_offset += address_lifted.bytesRead; + final port_lifted = FfiConverterUInt16.read( + Uint8List.view(buf.buffer, new_offset), + ); + final port = port_lifted.value; + new_offset += port_lifted.bytesRead; + return LiftRetVal( + Socks5Proxy(address: address, port: port), + new_offset - buf.offsetInBytes, + ); + } + + static RustBuffer lower(Socks5Proxy value) { + final total_length = + IpAddress.allocationSize(value.address) + + FfiConverterUInt16.allocationSize(value.port) + + 0; + final buf = Uint8List(total_length); + write(value, buf); + return toRustBuffer(buf); + } + + static int write(Socks5Proxy value, Uint8List buf) { + int new_offset = buf.offsetInBytes; + new_offset += IpAddress.write( + value.address, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterUInt16.write( + value.port, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(Input value) { - return FfiConverterOptionalTransaction.allocationSize( - value.nonWitnessUtxo, - ) + - FfiConverterOptionalTxOut.allocationSize(value.witnessUtxo) + - FfiConverterMapStringToUint8List.allocationSize(value.partialSigs) + - FfiConverterOptionalString.allocationSize(value.sighashType) + - FfiConverterOptionalScript.allocationSize(value.redeemScript) + - FfiConverterOptionalScript.allocationSize(value.witnessScript) + - FfiConverterMapStringToKeySource.allocationSize(value.bip32Derivation) + - FfiConverterOptionalScript.allocationSize(value.finalScriptSig) + - FfiConverterOptionalSequenceUint8List.allocationSize( - value.finalScriptWitness, - ) + - FfiConverterMapStringToUint8List.allocationSize( - value.ripemd160Preimages, - ) + - FfiConverterMapStringToUint8List.allocationSize(value.sha256Preimages) + - FfiConverterMapStringToUint8List.allocationSize( - value.hash160Preimages, - ) + - FfiConverterMapStringToUint8List.allocationSize( - value.hash256Preimages, - ) + - FfiConverterOptionalUint8List.allocationSize(value.tapKeySig) + - FfiConverterMapTapScriptSigKeyToUint8List.allocationSize( - value.tapScriptSigs, - ) + - FfiConverterMapControlBlockToTapScriptEntry.allocationSize( - value.tapScripts, - ) + - FfiConverterMapStringToTapKeyOrigin.allocationSize( - value.tapKeyOrigins, + static int allocationSize(Socks5Proxy value) { + return IpAddress.allocationSize(value.address) + + FfiConverterUInt16.allocationSize(value.port) + + 0; + } +} + +class PreV1WalletKeychain { + final KeychainKind keychain; + final int lastDerivationIndex; + final String checksum; + PreV1WalletKeychain({ + required this.keychain, + required this.lastDerivationIndex, + required this.checksum, + }); +} + +class FfiConverterPreV1WalletKeychain { + static PreV1WalletKeychain lift(RustBuffer buf) { + return FfiConverterPreV1WalletKeychain.read(buf.asUint8List()).value; + } + + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final keychain_lifted = FfiConverterKeychainKind.read( + Uint8List.view(buf.buffer, new_offset), + ); + final keychain = keychain_lifted.value; + new_offset += keychain_lifted.bytesRead; + final lastDerivationIndex_lifted = FfiConverterUInt32.read( + Uint8List.view(buf.buffer, new_offset), + ); + final lastDerivationIndex = lastDerivationIndex_lifted.value; + new_offset += lastDerivationIndex_lifted.bytesRead; + final checksum_lifted = FfiConverterString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final checksum = checksum_lifted.value; + new_offset += checksum_lifted.bytesRead; + return LiftRetVal( + PreV1WalletKeychain( + keychain: keychain, + lastDerivationIndex: lastDerivationIndex, + checksum: checksum, + ), + new_offset - buf.offsetInBytes, + ); + } + + static RustBuffer lower(PreV1WalletKeychain value) { + final total_length = + FfiConverterKeychainKind.allocationSize(value.keychain) + + FfiConverterUInt32.allocationSize(value.lastDerivationIndex) + + FfiConverterString.allocationSize(value.checksum) + + 0; + final buf = Uint8List(total_length); + write(value, buf); + return toRustBuffer(buf); + } + + static int write(PreV1WalletKeychain value, Uint8List buf) { + int new_offset = buf.offsetInBytes; + new_offset += FfiConverterKeychainKind.write( + value.keychain, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterUInt32.write( + value.lastDerivationIndex, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterString.write( + value.checksum, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset - buf.offsetInBytes; + } + + static int allocationSize(PreV1WalletKeychain value) { + return FfiConverterKeychainKind.allocationSize(value.keychain) + + FfiConverterUInt32.allocationSize(value.lastDerivationIndex) + + FfiConverterString.allocationSize(value.checksum) + + 0; + } +} + +class AddressInfo { + final int index; + final Address address; + final KeychainKind keychain; + AddressInfo({ + required this.index, + required this.address, + required this.keychain, + }); +} + +class FfiConverterAddressInfo { + static AddressInfo lift(RustBuffer buf) { + return FfiConverterAddressInfo.read(buf.asUint8List()).value; + } + + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final index_lifted = FfiConverterUInt32.read( + Uint8List.view(buf.buffer, new_offset), + ); + final index = index_lifted.value; + new_offset += index_lifted.bytesRead; + final address_lifted = Address.read(Uint8List.view(buf.buffer, new_offset)); + final address = address_lifted.value; + new_offset += address_lifted.bytesRead; + final keychain_lifted = FfiConverterKeychainKind.read( + Uint8List.view(buf.buffer, new_offset), + ); + final keychain = keychain_lifted.value; + new_offset += keychain_lifted.bytesRead; + return LiftRetVal( + AddressInfo(index: index, address: address, keychain: keychain), + new_offset - buf.offsetInBytes, + ); + } + + static RustBuffer lower(AddressInfo value) { + final total_length = + FfiConverterUInt32.allocationSize(value.index) + + Address.allocationSize(value.address) + + FfiConverterKeychainKind.allocationSize(value.keychain) + + 0; + final buf = Uint8List(total_length); + write(value, buf); + return toRustBuffer(buf); + } + + static int write(AddressInfo value, Uint8List buf) { + int new_offset = buf.offsetInBytes; + new_offset += FfiConverterUInt32.write( + value.index, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += Address.write( + value.address, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterKeychainKind.write( + value.keychain, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset - buf.offsetInBytes; + } + + static int allocationSize(AddressInfo value) { + return FfiConverterUInt32.allocationSize(value.index) + + Address.allocationSize(value.address) + + FfiConverterKeychainKind.allocationSize(value.keychain) + + 0; + } +} + +class Anchor { + final ConfirmationBlockTime confirmationBlockTime; + final Txid txid; + Anchor({required this.confirmationBlockTime, required this.txid}); +} + +class FfiConverterAnchor { + static Anchor lift(RustBuffer buf) { + return FfiConverterAnchor.read(buf.asUint8List()).value; + } + + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final confirmationBlockTime_lifted = FfiConverterConfirmationBlockTime.read( + Uint8List.view(buf.buffer, new_offset), + ); + final confirmationBlockTime = confirmationBlockTime_lifted.value; + new_offset += confirmationBlockTime_lifted.bytesRead; + final txid_lifted = Txid.read(Uint8List.view(buf.buffer, new_offset)); + final txid = txid_lifted.value; + new_offset += txid_lifted.bytesRead; + return LiftRetVal( + Anchor(confirmationBlockTime: confirmationBlockTime, txid: txid), + new_offset - buf.offsetInBytes, + ); + } + + static RustBuffer lower(Anchor value) { + final total_length = + FfiConverterConfirmationBlockTime.allocationSize( + value.confirmationBlockTime, ) + - FfiConverterOptionalString.allocationSize(value.tapInternalKey) + - FfiConverterOptionalString.allocationSize(value.tapMerkleRoot) + - FfiConverterMapProprietaryKeyToUint8List.allocationSize( - value.proprietary, + Txid.allocationSize(value.txid) + + 0; + final buf = Uint8List(total_length); + write(value, buf); + return toRustBuffer(buf); + } + + static int write(Anchor value, Uint8List buf) { + int new_offset = buf.offsetInBytes; + new_offset += FfiConverterConfirmationBlockTime.write( + value.confirmationBlockTime, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += Txid.write( + value.txid, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset - buf.offsetInBytes; + } + + static int allocationSize(Anchor value) { + return FfiConverterConfirmationBlockTime.allocationSize( + value.confirmationBlockTime, ) + - FfiConverterMapKeyToUint8List.allocationSize(value.unknown) + + Txid.allocationSize(value.txid) + 0; } } -class Key { - final int typeValue; - final Uint8List key; - Key({required this.typeValue, required this.key}); +class Balance { + final Amount immature; + final Amount trustedPending; + final Amount untrustedPending; + final Amount confirmed; + final Amount trustedSpendable; + final Amount total; + Balance({ + required this.immature, + required this.trustedPending, + required this.untrustedPending, + required this.confirmed, + required this.trustedSpendable, + required this.total, + }); } -class FfiConverterKey { - static Key lift(RustBuffer buf) { - return FfiConverterKey.read(buf.asUint8List()).value; +class FfiConverterBalance { + static Balance lift(RustBuffer buf) { + return FfiConverterBalance.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final typeValue_lifted = FfiConverterUInt8.read( + final immature_lifted = Amount.read(Uint8List.view(buf.buffer, new_offset)); + final immature = immature_lifted.value; + new_offset += immature_lifted.bytesRead; + final trustedPending_lifted = Amount.read( Uint8List.view(buf.buffer, new_offset), ); - final typeValue = typeValue_lifted.value; - new_offset += typeValue_lifted.bytesRead; - final key_lifted = FfiConverterUint8List.read( + final trustedPending = trustedPending_lifted.value; + new_offset += trustedPending_lifted.bytesRead; + final untrustedPending_lifted = Amount.read( Uint8List.view(buf.buffer, new_offset), ); - final key = key_lifted.value; - new_offset += key_lifted.bytesRead; + final untrustedPending = untrustedPending_lifted.value; + new_offset += untrustedPending_lifted.bytesRead; + final confirmed_lifted = Amount.read( + Uint8List.view(buf.buffer, new_offset), + ); + final confirmed = confirmed_lifted.value; + new_offset += confirmed_lifted.bytesRead; + final trustedSpendable_lifted = Amount.read( + Uint8List.view(buf.buffer, new_offset), + ); + final trustedSpendable = trustedSpendable_lifted.value; + new_offset += trustedSpendable_lifted.bytesRead; + final total_lifted = Amount.read(Uint8List.view(buf.buffer, new_offset)); + final total = total_lifted.value; + new_offset += total_lifted.bytesRead; return LiftRetVal( - Key(typeValue: typeValue, key: key), + Balance( + immature: immature, + trustedPending: trustedPending, + untrustedPending: untrustedPending, + confirmed: confirmed, + trustedSpendable: trustedSpendable, + total: total, + ), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(Key value) { + static RustBuffer lower(Balance value) { final total_length = - FfiConverterUInt8.allocationSize(value.typeValue) + - FfiConverterUint8List.allocationSize(value.key) + + Amount.allocationSize(value.immature) + + Amount.allocationSize(value.trustedPending) + + Amount.allocationSize(value.untrustedPending) + + Amount.allocationSize(value.confirmed) + + Amount.allocationSize(value.trustedSpendable) + + Amount.allocationSize(value.total) + + 0; + final buf = Uint8List(total_length); + write(value, buf); + return toRustBuffer(buf); + } + + static int write(Balance value, Uint8List buf) { + int new_offset = buf.offsetInBytes; + new_offset += Amount.write( + value.immature, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += Amount.write( + value.trustedPending, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += Amount.write( + value.untrustedPending, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += Amount.write( + value.confirmed, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += Amount.write( + value.trustedSpendable, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += Amount.write( + value.total, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset - buf.offsetInBytes; + } + + static int allocationSize(Balance value) { + return Amount.allocationSize(value.immature) + + Amount.allocationSize(value.trustedPending) + + Amount.allocationSize(value.untrustedPending) + + Amount.allocationSize(value.confirmed) + + Amount.allocationSize(value.trustedSpendable) + + Amount.allocationSize(value.total) + + 0; + } +} + +class BlockId { + final int height; + final BlockHash hash; + BlockId({required this.height, required this.hash}); +} + +class FfiConverterBlockId { + static BlockId lift(RustBuffer buf) { + return FfiConverterBlockId.read(buf.asUint8List()).value; + } + + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final height_lifted = FfiConverterUInt32.read( + Uint8List.view(buf.buffer, new_offset), + ); + final height = height_lifted.value; + new_offset += height_lifted.bytesRead; + final hash_lifted = BlockHash.read(Uint8List.view(buf.buffer, new_offset)); + final hash = hash_lifted.value; + new_offset += hash_lifted.bytesRead; + return LiftRetVal( + BlockId(height: height, hash: hash), + new_offset - buf.offsetInBytes, + ); + } + + static RustBuffer lower(BlockId value) { + final total_length = + FfiConverterUInt32.allocationSize(value.height) + + BlockHash.allocationSize(value.hash) + + 0; + final buf = Uint8List(total_length); + write(value, buf); + return toRustBuffer(buf); + } + + static int write(BlockId value, Uint8List buf) { + int new_offset = buf.offsetInBytes; + new_offset += FfiConverterUInt32.write( + value.height, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += BlockHash.write( + value.hash, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset - buf.offsetInBytes; + } + + static int allocationSize(BlockId value) { + return FfiConverterUInt32.allocationSize(value.height) + + BlockHash.allocationSize(value.hash) + + 0; + } +} + +class CanonicalTx { + final Transaction transaction; + final ChainPosition chainPosition; + CanonicalTx({required this.transaction, required this.chainPosition}); +} + +class FfiConverterCanonicalTx { + static CanonicalTx lift(RustBuffer buf) { + return FfiConverterCanonicalTx.read(buf.asUint8List()).value; + } + + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final transaction_lifted = Transaction.read( + Uint8List.view(buf.buffer, new_offset), + ); + final transaction = transaction_lifted.value; + new_offset += transaction_lifted.bytesRead; + final chainPosition_lifted = FfiConverterChainPosition.read( + Uint8List.view(buf.buffer, new_offset), + ); + final chainPosition = chainPosition_lifted.value; + new_offset += chainPosition_lifted.bytesRead; + return LiftRetVal( + CanonicalTx(transaction: transaction, chainPosition: chainPosition), + new_offset - buf.offsetInBytes, + ); + } + + static RustBuffer lower(CanonicalTx value) { + final total_length = + Transaction.allocationSize(value.transaction) + + FfiConverterChainPosition.allocationSize(value.chainPosition) + + 0; + final buf = Uint8List(total_length); + write(value, buf); + return toRustBuffer(buf); + } + + static int write(CanonicalTx value, Uint8List buf) { + int new_offset = buf.offsetInBytes; + new_offset += Transaction.write( + value.transaction, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterChainPosition.write( + value.chainPosition, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset - buf.offsetInBytes; + } + + static int allocationSize(CanonicalTx value) { + return Transaction.allocationSize(value.transaction) + + FfiConverterChainPosition.allocationSize(value.chainPosition) + + 0; + } +} + +class ChainChange { + final int height; + final BlockHash? hash; + ChainChange({required this.height, this.hash}); +} + +class FfiConverterChainChange { + static ChainChange lift(RustBuffer buf) { + return FfiConverterChainChange.read(buf.asUint8List()).value; + } + + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final height_lifted = FfiConverterUInt32.read( + Uint8List.view(buf.buffer, new_offset), + ); + final height = height_lifted.value; + new_offset += height_lifted.bytesRead; + final hash_lifted = FfiConverterOptionalBlockHash.read( + Uint8List.view(buf.buffer, new_offset), + ); + final hash = hash_lifted.value; + new_offset += hash_lifted.bytesRead; + return LiftRetVal( + ChainChange(height: height, hash: hash), + new_offset - buf.offsetInBytes, + ); + } + + static RustBuffer lower(ChainChange value) { + final total_length = + FfiConverterUInt32.allocationSize(value.height) + + FfiConverterOptionalBlockHash.allocationSize(value.hash) + + 0; + final buf = Uint8List(total_length); + write(value, buf); + return toRustBuffer(buf); + } + + static int write(ChainChange value, Uint8List buf) { + int new_offset = buf.offsetInBytes; + new_offset += FfiConverterUInt32.write( + value.height, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalBlockHash.write( + value.hash, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset - buf.offsetInBytes; + } + + static int allocationSize(ChainChange value) { + return FfiConverterUInt32.allocationSize(value.height) + + FfiConverterOptionalBlockHash.allocationSize(value.hash) + + 0; + } +} + +class Condition { + final int? csv; + final LockTime? timelock; + Condition({this.csv, this.timelock}); +} + +class FfiConverterCondition { + static Condition lift(RustBuffer buf) { + return FfiConverterCondition.read(buf.asUint8List()).value; + } + + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final csv_lifted = FfiConverterOptionalUInt32.read( + Uint8List.view(buf.buffer, new_offset), + ); + final csv = csv_lifted.value; + new_offset += csv_lifted.bytesRead; + final timelock_lifted = FfiConverterOptionalLockTime.read( + Uint8List.view(buf.buffer, new_offset), + ); + final timelock = timelock_lifted.value; + new_offset += timelock_lifted.bytesRead; + return LiftRetVal( + Condition(csv: csv, timelock: timelock), + new_offset - buf.offsetInBytes, + ); + } + + static RustBuffer lower(Condition value) { + final total_length = + FfiConverterOptionalUInt32.allocationSize(value.csv) + + FfiConverterOptionalLockTime.allocationSize(value.timelock) + + 0; + final buf = Uint8List(total_length); + write(value, buf); + return toRustBuffer(buf); + } + + static int write(Condition value, Uint8List buf) { + int new_offset = buf.offsetInBytes; + new_offset += FfiConverterOptionalUInt32.write( + value.csv, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalLockTime.write( + value.timelock, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset - buf.offsetInBytes; + } + + static int allocationSize(Condition value) { + return FfiConverterOptionalUInt32.allocationSize(value.csv) + + FfiConverterOptionalLockTime.allocationSize(value.timelock) + + 0; + } +} + +class ConfirmationBlockTime { + final BlockId blockId; + final int confirmationTime; + ConfirmationBlockTime({ + required this.blockId, + required this.confirmationTime, + }); +} + +class FfiConverterConfirmationBlockTime { + static ConfirmationBlockTime lift(RustBuffer buf) { + return FfiConverterConfirmationBlockTime.read(buf.asUint8List()).value; + } + + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final blockId_lifted = FfiConverterBlockId.read( + Uint8List.view(buf.buffer, new_offset), + ); + final blockId = blockId_lifted.value; + new_offset += blockId_lifted.bytesRead; + final confirmationTime_lifted = FfiConverterUInt64.read( + Uint8List.view(buf.buffer, new_offset), + ); + final confirmationTime = confirmationTime_lifted.value; + new_offset += confirmationTime_lifted.bytesRead; + return LiftRetVal( + ConfirmationBlockTime( + blockId: blockId, + confirmationTime: confirmationTime, + ), + new_offset - buf.offsetInBytes, + ); + } + + static RustBuffer lower(ConfirmationBlockTime value) { + final total_length = + FfiConverterBlockId.allocationSize(value.blockId) + + FfiConverterUInt64.allocationSize(value.confirmationTime) + + 0; + final buf = Uint8List(total_length); + write(value, buf); + return toRustBuffer(buf); + } + + static int write(ConfirmationBlockTime value, Uint8List buf) { + int new_offset = buf.offsetInBytes; + new_offset += FfiConverterBlockId.write( + value.blockId, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterUInt64.write( + value.confirmationTime, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset - buf.offsetInBytes; + } + + static int allocationSize(ConfirmationBlockTime value) { + return FfiConverterBlockId.allocationSize(value.blockId) + + FfiConverterUInt64.allocationSize(value.confirmationTime) + + 0; + } +} + +class Conflict { + final int vin; + final Txid txid; + Conflict({required this.vin, required this.txid}); +} + +class FfiConverterConflict { + static Conflict lift(RustBuffer buf) { + return FfiConverterConflict.read(buf.asUint8List()).value; + } + + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final vin_lifted = FfiConverterUInt32.read( + Uint8List.view(buf.buffer, new_offset), + ); + final vin = vin_lifted.value; + new_offset += vin_lifted.bytesRead; + final txid_lifted = Txid.read(Uint8List.view(buf.buffer, new_offset)); + final txid = txid_lifted.value; + new_offset += txid_lifted.bytesRead; + return LiftRetVal( + Conflict(vin: vin, txid: txid), + new_offset - buf.offsetInBytes, + ); + } + + static RustBuffer lower(Conflict value) { + final total_length = + FfiConverterUInt32.allocationSize(value.vin) + + Txid.allocationSize(value.txid) + + 0; + final buf = Uint8List(total_length); + write(value, buf); + return toRustBuffer(buf); + } + + static int write(Conflict value, Uint8List buf) { + int new_offset = buf.offsetInBytes; + new_offset += FfiConverterUInt32.write( + value.vin, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += Txid.write( + value.txid, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset - buf.offsetInBytes; + } + + static int allocationSize(Conflict value) { + return FfiConverterUInt32.allocationSize(value.vin) + + Txid.allocationSize(value.txid) + + 0; + } +} + +class EvictedTx { + final Txid txid; + final int evictedAt; + EvictedTx({required this.txid, required this.evictedAt}); +} + +class FfiConverterEvictedTx { + static EvictedTx lift(RustBuffer buf) { + return FfiConverterEvictedTx.read(buf.asUint8List()).value; + } + + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final txid_lifted = Txid.read(Uint8List.view(buf.buffer, new_offset)); + final txid = txid_lifted.value; + new_offset += txid_lifted.bytesRead; + final evictedAt_lifted = FfiConverterUInt64.read( + Uint8List.view(buf.buffer, new_offset), + ); + final evictedAt = evictedAt_lifted.value; + new_offset += evictedAt_lifted.bytesRead; + return LiftRetVal( + EvictedTx(txid: txid, evictedAt: evictedAt), + new_offset - buf.offsetInBytes, + ); + } + + static RustBuffer lower(EvictedTx value) { + final total_length = + Txid.allocationSize(value.txid) + + FfiConverterUInt64.allocationSize(value.evictedAt) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(Key value, Uint8List buf) { + static int write(EvictedTx value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += FfiConverterUInt8.write( - value.typeValue, + new_offset += Txid.write( + value.txid, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterUint8List.write( - value.key, + new_offset += FfiConverterUInt64.write( + value.evictedAt, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(Key value) { - return FfiConverterUInt8.allocationSize(value.typeValue) + - FfiConverterUint8List.allocationSize(value.key) + + static int allocationSize(EvictedTx value) { + return Txid.allocationSize(value.txid) + + FfiConverterUInt64.allocationSize(value.evictedAt) + 0; } } -class KeySource { - final String fingerprint; - final DerivationPath path; - KeySource({required this.fingerprint, required this.path}); +class IndexerChangeSet { + final Map lastRevealed; + IndexerChangeSet({required this.lastRevealed}); } -class FfiConverterKeySource { - static KeySource lift(RustBuffer buf) { - return FfiConverterKeySource.read(buf.asUint8List()).value; +class FfiConverterIndexerChangeSet { + static IndexerChangeSet lift(RustBuffer buf) { + return FfiConverterIndexerChangeSet.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final fingerprint_lifted = FfiConverterString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final fingerprint = fingerprint_lifted.value; - new_offset += fingerprint_lifted.bytesRead; - final path_lifted = DerivationPath.read( + final lastRevealed_lifted = FfiConverterMapDescriptorIdToUInt32.read( Uint8List.view(buf.buffer, new_offset), ); - final path = path_lifted.value; - new_offset += path_lifted.bytesRead; + final lastRevealed = lastRevealed_lifted.value; + new_offset += lastRevealed_lifted.bytesRead; return LiftRetVal( - KeySource(fingerprint: fingerprint, path: path), + IndexerChangeSet(lastRevealed: lastRevealed), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(KeySource value) { + static RustBuffer lower(IndexerChangeSet value) { final total_length = - FfiConverterString.allocationSize(value.fingerprint) + - DerivationPath.allocationSize(value.path) + + FfiConverterMapDescriptorIdToUInt32.allocationSize(value.lastRevealed) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(KeySource value, Uint8List buf) { + static int write(IndexerChangeSet value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += FfiConverterString.write( - value.fingerprint, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += DerivationPath.write( - value.path, + new_offset += FfiConverterMapDescriptorIdToUInt32.write( + value.lastRevealed, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(KeySource value) { - return FfiConverterString.allocationSize(value.fingerprint) + - DerivationPath.allocationSize(value.path) + + static int allocationSize(IndexerChangeSet value) { + return FfiConverterMapDescriptorIdToUInt32.allocationSize( + value.lastRevealed, + ) + 0; } } @@ -1933,567 +2936,128 @@ class FfiConverterMerkleProof { Uint8List.view(buf.buffer, new_offset), ); final pos = pos_lifted.value; - new_offset += pos_lifted.bytesRead; - return LiftRetVal( - MerkleProof(blockHeight: blockHeight, merkle: merkle, pos: pos), - new_offset - buf.offsetInBytes, - ); - } - - static RustBuffer lower(MerkleProof value) { - final total_length = - FfiConverterUInt32.allocationSize(value.blockHeight) + - FfiConverterSequenceTxid.allocationSize(value.merkle) + - FfiConverterUInt64.allocationSize(value.pos) + - 0; - final buf = Uint8List(total_length); - write(value, buf); - return toRustBuffer(buf); - } - - static int write(MerkleProof value, Uint8List buf) { - int new_offset = buf.offsetInBytes; - new_offset += FfiConverterUInt32.write( - value.blockHeight, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterSequenceTxid.write( - value.merkle, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterUInt64.write( - value.pos, - Uint8List.view(buf.buffer, new_offset), - ); - return new_offset - buf.offsetInBytes; - } - - static int allocationSize(MerkleProof value) { - return FfiConverterUInt32.allocationSize(value.blockHeight) + - FfiConverterSequenceTxid.allocationSize(value.merkle) + - FfiConverterUInt64.allocationSize(value.pos) + - 0; - } -} - -class OutPoint { - final Txid txid; - final int vout; - OutPoint({required this.txid, required this.vout}); -} - -class FfiConverterOutPoint { - static OutPoint lift(RustBuffer buf) { - return FfiConverterOutPoint.read(buf.asUint8List()).value; - } - - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final txid_lifted = Txid.read(Uint8List.view(buf.buffer, new_offset)); - final txid = txid_lifted.value; - new_offset += txid_lifted.bytesRead; - final vout_lifted = FfiConverterUInt32.read( - Uint8List.view(buf.buffer, new_offset), - ); - final vout = vout_lifted.value; - new_offset += vout_lifted.bytesRead; - return LiftRetVal( - OutPoint(txid: txid, vout: vout), - new_offset - buf.offsetInBytes, - ); - } - - static RustBuffer lower(OutPoint value) { - final total_length = - Txid.allocationSize(value.txid) + - FfiConverterUInt32.allocationSize(value.vout) + - 0; - final buf = Uint8List(total_length); - write(value, buf); - return toRustBuffer(buf); - } - - static int write(OutPoint value, Uint8List buf) { - int new_offset = buf.offsetInBytes; - new_offset += Txid.write( - value.txid, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterUInt32.write( - value.vout, - Uint8List.view(buf.buffer, new_offset), - ); - return new_offset - buf.offsetInBytes; - } - - static int allocationSize(OutPoint value) { - return Txid.allocationSize(value.txid) + - FfiConverterUInt32.allocationSize(value.vout) + - 0; - } -} - -class Output { - final Script? redeemScript; - final Script? witnessScript; - final Map bip32Derivation; - final String? tapInternalKey; - final TapTree? tapTree; - final Map tapKeyOrigins; - final Map proprietary; - final Map unknown; - Output({ - this.redeemScript, - this.witnessScript, - required this.bip32Derivation, - this.tapInternalKey, - this.tapTree, - required this.tapKeyOrigins, - required this.proprietary, - required this.unknown, - }); -} - -class FfiConverterOutput { - static Output lift(RustBuffer buf) { - return FfiConverterOutput.read(buf.asUint8List()).value; - } - - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final redeemScript_lifted = FfiConverterOptionalScript.read( - Uint8List.view(buf.buffer, new_offset), - ); - final redeemScript = redeemScript_lifted.value; - new_offset += redeemScript_lifted.bytesRead; - final witnessScript_lifted = FfiConverterOptionalScript.read( - Uint8List.view(buf.buffer, new_offset), - ); - final witnessScript = witnessScript_lifted.value; - new_offset += witnessScript_lifted.bytesRead; - final bip32Derivation_lifted = FfiConverterMapStringToKeySource.read( - Uint8List.view(buf.buffer, new_offset), - ); - final bip32Derivation = bip32Derivation_lifted.value; - new_offset += bip32Derivation_lifted.bytesRead; - final tapInternalKey_lifted = FfiConverterOptionalString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final tapInternalKey = tapInternalKey_lifted.value; - new_offset += tapInternalKey_lifted.bytesRead; - final tapTree_lifted = FfiConverterOptionalTapTree.read( - Uint8List.view(buf.buffer, new_offset), - ); - final tapTree = tapTree_lifted.value; - new_offset += tapTree_lifted.bytesRead; - final tapKeyOrigins_lifted = FfiConverterMapStringToTapKeyOrigin.read( - Uint8List.view(buf.buffer, new_offset), - ); - final tapKeyOrigins = tapKeyOrigins_lifted.value; - new_offset += tapKeyOrigins_lifted.bytesRead; - final proprietary_lifted = FfiConverterMapProprietaryKeyToUint8List.read( - Uint8List.view(buf.buffer, new_offset), - ); - final proprietary = proprietary_lifted.value; - new_offset += proprietary_lifted.bytesRead; - final unknown_lifted = FfiConverterMapKeyToUint8List.read( - Uint8List.view(buf.buffer, new_offset), - ); - final unknown = unknown_lifted.value; - new_offset += unknown_lifted.bytesRead; - return LiftRetVal( - Output( - redeemScript: redeemScript, - witnessScript: witnessScript, - bip32Derivation: bip32Derivation, - tapInternalKey: tapInternalKey, - tapTree: tapTree, - tapKeyOrigins: tapKeyOrigins, - proprietary: proprietary, - unknown: unknown, - ), - new_offset - buf.offsetInBytes, - ); - } - - static RustBuffer lower(Output value) { - final total_length = - FfiConverterOptionalScript.allocationSize(value.redeemScript) + - FfiConverterOptionalScript.allocationSize(value.witnessScript) + - FfiConverterMapStringToKeySource.allocationSize(value.bip32Derivation) + - FfiConverterOptionalString.allocationSize(value.tapInternalKey) + - FfiConverterOptionalTapTree.allocationSize(value.tapTree) + - FfiConverterMapStringToTapKeyOrigin.allocationSize( - value.tapKeyOrigins, - ) + - FfiConverterMapProprietaryKeyToUint8List.allocationSize( - value.proprietary, - ) + - FfiConverterMapKeyToUint8List.allocationSize(value.unknown) + - 0; - final buf = Uint8List(total_length); - write(value, buf); - return toRustBuffer(buf); - } - - static int write(Output value, Uint8List buf) { - int new_offset = buf.offsetInBytes; - new_offset += FfiConverterOptionalScript.write( - value.redeemScript, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalScript.write( - value.witnessScript, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterMapStringToKeySource.write( - value.bip32Derivation, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalString.write( - value.tapInternalKey, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalTapTree.write( - value.tapTree, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterMapStringToTapKeyOrigin.write( - value.tapKeyOrigins, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterMapProprietaryKeyToUint8List.write( - value.proprietary, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterMapKeyToUint8List.write( - value.unknown, - Uint8List.view(buf.buffer, new_offset), - ); - return new_offset - buf.offsetInBytes; - } - - static int allocationSize(Output value) { - return FfiConverterOptionalScript.allocationSize(value.redeemScript) + - FfiConverterOptionalScript.allocationSize(value.witnessScript) + - FfiConverterMapStringToKeySource.allocationSize(value.bip32Derivation) + - FfiConverterOptionalString.allocationSize(value.tapInternalKey) + - FfiConverterOptionalTapTree.allocationSize(value.tapTree) + - FfiConverterMapStringToTapKeyOrigin.allocationSize( - value.tapKeyOrigins, - ) + - FfiConverterMapProprietaryKeyToUint8List.allocationSize( - value.proprietary, - ) + - FfiConverterMapKeyToUint8List.allocationSize(value.unknown) + - 0; - } -} - -class OutputStatus { - final bool spent; - final Txid? txid; - final int? vin; - final TxStatus? status; - OutputStatus({required this.spent, this.txid, this.vin, this.status}); -} - -class FfiConverterOutputStatus { - static OutputStatus lift(RustBuffer buf) { - return FfiConverterOutputStatus.read(buf.asUint8List()).value; - } - - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final spent_lifted = FfiConverterBool.read( - Uint8List.view(buf.buffer, new_offset), - ); - final spent = spent_lifted.value; - new_offset += spent_lifted.bytesRead; - final txid_lifted = FfiConverterOptionalTxid.read( - Uint8List.view(buf.buffer, new_offset), - ); - final txid = txid_lifted.value; - new_offset += txid_lifted.bytesRead; - final vin_lifted = FfiConverterOptionalUInt64.read( - Uint8List.view(buf.buffer, new_offset), - ); - final vin = vin_lifted.value; - new_offset += vin_lifted.bytesRead; - final status_lifted = FfiConverterOptionalTxStatus.read( - Uint8List.view(buf.buffer, new_offset), - ); - final status = status_lifted.value; - new_offset += status_lifted.bytesRead; - return LiftRetVal( - OutputStatus(spent: spent, txid: txid, vin: vin, status: status), - new_offset - buf.offsetInBytes, - ); - } - - static RustBuffer lower(OutputStatus value) { - final total_length = - FfiConverterBool.allocationSize(value.spent) + - FfiConverterOptionalTxid.allocationSize(value.txid) + - FfiConverterOptionalUInt64.allocationSize(value.vin) + - FfiConverterOptionalTxStatus.allocationSize(value.status) + - 0; - final buf = Uint8List(total_length); - write(value, buf); - return toRustBuffer(buf); - } - - static int write(OutputStatus value, Uint8List buf) { - int new_offset = buf.offsetInBytes; - new_offset += FfiConverterBool.write( - value.spent, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalTxid.write( - value.txid, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalUInt64.write( - value.vin, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalTxStatus.write( - value.status, - Uint8List.view(buf.buffer, new_offset), - ); - return new_offset - buf.offsetInBytes; - } - - static int allocationSize(OutputStatus value) { - return FfiConverterBool.allocationSize(value.spent) + - FfiConverterOptionalTxid.allocationSize(value.txid) + - FfiConverterOptionalUInt64.allocationSize(value.vin) + - FfiConverterOptionalTxStatus.allocationSize(value.status) + - 0; - } -} - -class Peer { - final IpAddress address; - final int? port; - final bool v2Transport; - Peer({required this.address, this.port, required this.v2Transport}); -} - -class FfiConverterPeer { - static Peer lift(RustBuffer buf) { - return FfiConverterPeer.read(buf.asUint8List()).value; - } - - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final address_lifted = IpAddress.read( - Uint8List.view(buf.buffer, new_offset), - ); - final address = address_lifted.value; - new_offset += address_lifted.bytesRead; - final port_lifted = FfiConverterOptionalUInt16.read( - Uint8List.view(buf.buffer, new_offset), - ); - final port = port_lifted.value; - new_offset += port_lifted.bytesRead; - final v2Transport_lifted = FfiConverterBool.read( - Uint8List.view(buf.buffer, new_offset), - ); - final v2Transport = v2Transport_lifted.value; - new_offset += v2Transport_lifted.bytesRead; - return LiftRetVal( - Peer(address: address, port: port, v2Transport: v2Transport), - new_offset - buf.offsetInBytes, - ); - } - - static RustBuffer lower(Peer value) { - final total_length = - IpAddress.allocationSize(value.address) + - FfiConverterOptionalUInt16.allocationSize(value.port) + - FfiConverterBool.allocationSize(value.v2Transport) + - 0; - final buf = Uint8List(total_length); - write(value, buf); - return toRustBuffer(buf); - } - - static int write(Peer value, Uint8List buf) { - int new_offset = buf.offsetInBytes; - new_offset += IpAddress.write( - value.address, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalUInt16.write( - value.port, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterBool.write( - value.v2Transport, - Uint8List.view(buf.buffer, new_offset), - ); - return new_offset - buf.offsetInBytes; - } - - static int allocationSize(Peer value) { - return IpAddress.allocationSize(value.address) + - FfiConverterOptionalUInt16.allocationSize(value.port) + - FfiConverterBool.allocationSize(value.v2Transport) + - 0; - } -} - -class PreV1WalletKeychain { - final KeychainKind keychain; - final int lastDerivationIndex; - final String checksum; - PreV1WalletKeychain({ - required this.keychain, - required this.lastDerivationIndex, - required this.checksum, - }); -} - -class FfiConverterPreV1WalletKeychain { - static PreV1WalletKeychain lift(RustBuffer buf) { - return FfiConverterPreV1WalletKeychain.read(buf.asUint8List()).value; - } - - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final keychain_lifted = FfiConverterKeychainKind.read( - Uint8List.view(buf.buffer, new_offset), - ); - final keychain = keychain_lifted.value; - new_offset += keychain_lifted.bytesRead; - final lastDerivationIndex_lifted = FfiConverterUInt32.read( - Uint8List.view(buf.buffer, new_offset), - ); - final lastDerivationIndex = lastDerivationIndex_lifted.value; - new_offset += lastDerivationIndex_lifted.bytesRead; - final checksum_lifted = FfiConverterString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final checksum = checksum_lifted.value; - new_offset += checksum_lifted.bytesRead; + new_offset += pos_lifted.bytesRead; return LiftRetVal( - PreV1WalletKeychain( - keychain: keychain, - lastDerivationIndex: lastDerivationIndex, - checksum: checksum, - ), + MerkleProof(blockHeight: blockHeight, merkle: merkle, pos: pos), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(PreV1WalletKeychain value) { + static RustBuffer lower(MerkleProof value) { final total_length = - FfiConverterKeychainKind.allocationSize(value.keychain) + - FfiConverterUInt32.allocationSize(value.lastDerivationIndex) + - FfiConverterString.allocationSize(value.checksum) + + FfiConverterUInt32.allocationSize(value.blockHeight) + + FfiConverterSequenceTxid.allocationSize(value.merkle) + + FfiConverterUInt64.allocationSize(value.pos) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(PreV1WalletKeychain value, Uint8List buf) { + static int write(MerkleProof value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += FfiConverterKeychainKind.write( - value.keychain, + new_offset += FfiConverterUInt32.write( + value.blockHeight, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterUInt32.write( - value.lastDerivationIndex, + new_offset += FfiConverterSequenceTxid.write( + value.merkle, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterString.write( - value.checksum, + new_offset += FfiConverterUInt64.write( + value.pos, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(PreV1WalletKeychain value) { - return FfiConverterKeychainKind.allocationSize(value.keychain) + - FfiConverterUInt32.allocationSize(value.lastDerivationIndex) + - FfiConverterString.allocationSize(value.checksum) + + static int allocationSize(MerkleProof value) { + return FfiConverterUInt32.allocationSize(value.blockHeight) + + FfiConverterSequenceTxid.allocationSize(value.merkle) + + FfiConverterUInt64.allocationSize(value.pos) + 0; } } -class ProprietaryKey { - final Uint8List prefix; - final int subtype; - final Uint8List key; - ProprietaryKey({ - required this.prefix, - required this.subtype, - required this.key, - }); +class OutputStatus { + final bool spent; + final Txid? txid; + final int? vin; + final TxStatus? status; + OutputStatus({required this.spent, this.txid, this.vin, this.status}); } -class FfiConverterProprietaryKey { - static ProprietaryKey lift(RustBuffer buf) { - return FfiConverterProprietaryKey.read(buf.asUint8List()).value; +class FfiConverterOutputStatus { + static OutputStatus lift(RustBuffer buf) { + return FfiConverterOutputStatus.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final prefix_lifted = FfiConverterUint8List.read( + final spent_lifted = FfiConverterBool.read( Uint8List.view(buf.buffer, new_offset), ); - final prefix = prefix_lifted.value; - new_offset += prefix_lifted.bytesRead; - final subtype_lifted = FfiConverterUInt8.read( + final spent = spent_lifted.value; + new_offset += spent_lifted.bytesRead; + final txid_lifted = FfiConverterOptionalTxid.read( Uint8List.view(buf.buffer, new_offset), ); - final subtype = subtype_lifted.value; - new_offset += subtype_lifted.bytesRead; - final key_lifted = FfiConverterUint8List.read( + final txid = txid_lifted.value; + new_offset += txid_lifted.bytesRead; + final vin_lifted = FfiConverterOptionalUInt64.read( Uint8List.view(buf.buffer, new_offset), ); - final key = key_lifted.value; - new_offset += key_lifted.bytesRead; + final vin = vin_lifted.value; + new_offset += vin_lifted.bytesRead; + final status_lifted = FfiConverterOptionalTxStatus.read( + Uint8List.view(buf.buffer, new_offset), + ); + final status = status_lifted.value; + new_offset += status_lifted.bytesRead; return LiftRetVal( - ProprietaryKey(prefix: prefix, subtype: subtype, key: key), + OutputStatus(spent: spent, txid: txid, vin: vin, status: status), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(ProprietaryKey value) { + static RustBuffer lower(OutputStatus value) { final total_length = - FfiConverterUint8List.allocationSize(value.prefix) + - FfiConverterUInt8.allocationSize(value.subtype) + - FfiConverterUint8List.allocationSize(value.key) + + FfiConverterBool.allocationSize(value.spent) + + FfiConverterOptionalTxid.allocationSize(value.txid) + + FfiConverterOptionalUInt64.allocationSize(value.vin) + + FfiConverterOptionalTxStatus.allocationSize(value.status) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(ProprietaryKey value, Uint8List buf) { + static int write(OutputStatus value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += FfiConverterUint8List.write( - value.prefix, + new_offset += FfiConverterBool.write( + value.spent, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterUInt8.write( - value.subtype, + new_offset += FfiConverterOptionalTxid.write( + value.txid, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterUint8List.write( - value.key, + new_offset += FfiConverterOptionalUInt64.write( + value.vin, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalTxStatus.write( + value.status, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(ProprietaryKey value) { - return FfiConverterUint8List.allocationSize(value.prefix) + - FfiConverterUInt8.allocationSize(value.subtype) + - FfiConverterUint8List.allocationSize(value.key) + + static int allocationSize(OutputStatus value) { + return FfiConverterBool.allocationSize(value.spent) + + FfiConverterOptionalTxid.allocationSize(value.txid) + + FfiConverterOptionalUInt64.allocationSize(value.vin) + + FfiConverterOptionalTxStatus.allocationSize(value.status) + 0; } } @@ -2608,127 +3172,6 @@ class FfiConverterSentAndReceivedValues { } } -class ServerFeaturesRes { - final String serverVersion; - final BlockHash genesisHash; - final String protocolMin; - final String protocolMax; - final String? hashFunction; - final int? pruning; - ServerFeaturesRes({ - required this.serverVersion, - required this.genesisHash, - required this.protocolMin, - required this.protocolMax, - this.hashFunction, - this.pruning, - }); -} - -class FfiConverterServerFeaturesRes { - static ServerFeaturesRes lift(RustBuffer buf) { - return FfiConverterServerFeaturesRes.read(buf.asUint8List()).value; - } - - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final serverVersion_lifted = FfiConverterString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final serverVersion = serverVersion_lifted.value; - new_offset += serverVersion_lifted.bytesRead; - final genesisHash_lifted = BlockHash.read( - Uint8List.view(buf.buffer, new_offset), - ); - final genesisHash = genesisHash_lifted.value; - new_offset += genesisHash_lifted.bytesRead; - final protocolMin_lifted = FfiConverterString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final protocolMin = protocolMin_lifted.value; - new_offset += protocolMin_lifted.bytesRead; - final protocolMax_lifted = FfiConverterString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final protocolMax = protocolMax_lifted.value; - new_offset += protocolMax_lifted.bytesRead; - final hashFunction_lifted = FfiConverterOptionalString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final hashFunction = hashFunction_lifted.value; - new_offset += hashFunction_lifted.bytesRead; - final pruning_lifted = FfiConverterOptionalInt64.read( - Uint8List.view(buf.buffer, new_offset), - ); - final pruning = pruning_lifted.value; - new_offset += pruning_lifted.bytesRead; - return LiftRetVal( - ServerFeaturesRes( - serverVersion: serverVersion, - genesisHash: genesisHash, - protocolMin: protocolMin, - protocolMax: protocolMax, - hashFunction: hashFunction, - pruning: pruning, - ), - new_offset - buf.offsetInBytes, - ); - } - - static RustBuffer lower(ServerFeaturesRes value) { - final total_length = - FfiConverterString.allocationSize(value.serverVersion) + - BlockHash.allocationSize(value.genesisHash) + - FfiConverterString.allocationSize(value.protocolMin) + - FfiConverterString.allocationSize(value.protocolMax) + - FfiConverterOptionalString.allocationSize(value.hashFunction) + - FfiConverterOptionalInt64.allocationSize(value.pruning) + - 0; - final buf = Uint8List(total_length); - write(value, buf); - return toRustBuffer(buf); - } - - static int write(ServerFeaturesRes value, Uint8List buf) { - int new_offset = buf.offsetInBytes; - new_offset += FfiConverterString.write( - value.serverVersion, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += BlockHash.write( - value.genesisHash, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterString.write( - value.protocolMin, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterString.write( - value.protocolMax, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalString.write( - value.hashFunction, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalInt64.write( - value.pruning, - Uint8List.view(buf.buffer, new_offset), - ); - return new_offset - buf.offsetInBytes; - } - - static int allocationSize(ServerFeaturesRes value) { - return FfiConverterString.allocationSize(value.serverVersion) + - BlockHash.allocationSize(value.genesisHash) + - FfiConverterString.allocationSize(value.protocolMin) + - FfiConverterString.allocationSize(value.protocolMax) + - FfiConverterOptionalString.allocationSize(value.hashFunction) + - FfiConverterOptionalInt64.allocationSize(value.pruning) + - 0; - } -} - class SignOptions { final bool trustWitnessUtxo; final int? assumeHeight; @@ -2776,310 +3219,76 @@ class FfiConverterSignOptions { final signWithTapInternalKey_lifted = FfiConverterBool.read( Uint8List.view(buf.buffer, new_offset), ); - final signWithTapInternalKey = signWithTapInternalKey_lifted.value; - new_offset += signWithTapInternalKey_lifted.bytesRead; - final allowGrinding_lifted = FfiConverterBool.read( - Uint8List.view(buf.buffer, new_offset), - ); - final allowGrinding = allowGrinding_lifted.value; - new_offset += allowGrinding_lifted.bytesRead; - return LiftRetVal( - SignOptions( - trustWitnessUtxo: trustWitnessUtxo, - assumeHeight: assumeHeight, - allowAllSighashes: allowAllSighashes, - tryFinalize: tryFinalize, - signWithTapInternalKey: signWithTapInternalKey, - allowGrinding: allowGrinding, - ), - new_offset - buf.offsetInBytes, - ); - } - - static RustBuffer lower(SignOptions value) { - final total_length = - FfiConverterBool.allocationSize(value.trustWitnessUtxo) + - FfiConverterOptionalUInt32.allocationSize(value.assumeHeight) + - FfiConverterBool.allocationSize(value.allowAllSighashes) + - FfiConverterBool.allocationSize(value.tryFinalize) + - FfiConverterBool.allocationSize(value.signWithTapInternalKey) + - FfiConverterBool.allocationSize(value.allowGrinding) + - 0; - final buf = Uint8List(total_length); - write(value, buf); - return toRustBuffer(buf); - } - - static int write(SignOptions value, Uint8List buf) { - int new_offset = buf.offsetInBytes; - new_offset += FfiConverterBool.write( - value.trustWitnessUtxo, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalUInt32.write( - value.assumeHeight, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterBool.write( - value.allowAllSighashes, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterBool.write( - value.tryFinalize, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterBool.write( - value.signWithTapInternalKey, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterBool.write( - value.allowGrinding, - Uint8List.view(buf.buffer, new_offset), - ); - return new_offset - buf.offsetInBytes; - } - - static int allocationSize(SignOptions value) { - return FfiConverterBool.allocationSize(value.trustWitnessUtxo) + - FfiConverterOptionalUInt32.allocationSize(value.assumeHeight) + - FfiConverterBool.allocationSize(value.allowAllSighashes) + - FfiConverterBool.allocationSize(value.tryFinalize) + - FfiConverterBool.allocationSize(value.signWithTapInternalKey) + - FfiConverterBool.allocationSize(value.allowGrinding) + - 0; - } -} - -class Socks5Proxy { - final IpAddress address; - final int port; - Socks5Proxy({required this.address, required this.port}); -} - -class FfiConverterSocks5Proxy { - static Socks5Proxy lift(RustBuffer buf) { - return FfiConverterSocks5Proxy.read(buf.asUint8List()).value; - } - - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final address_lifted = IpAddress.read( - Uint8List.view(buf.buffer, new_offset), - ); - final address = address_lifted.value; - new_offset += address_lifted.bytesRead; - final port_lifted = FfiConverterUInt16.read( - Uint8List.view(buf.buffer, new_offset), - ); - final port = port_lifted.value; - new_offset += port_lifted.bytesRead; - return LiftRetVal( - Socks5Proxy(address: address, port: port), - new_offset - buf.offsetInBytes, - ); - } - - static RustBuffer lower(Socks5Proxy value) { - final total_length = - IpAddress.allocationSize(value.address) + - FfiConverterUInt16.allocationSize(value.port) + - 0; - final buf = Uint8List(total_length); - write(value, buf); - return toRustBuffer(buf); - } - - static int write(Socks5Proxy value, Uint8List buf) { - int new_offset = buf.offsetInBytes; - new_offset += IpAddress.write( - value.address, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterUInt16.write( - value.port, - Uint8List.view(buf.buffer, new_offset), - ); - return new_offset - buf.offsetInBytes; - } - - static int allocationSize(Socks5Proxy value) { - return IpAddress.allocationSize(value.address) + - FfiConverterUInt16.allocationSize(value.port) + - 0; - } -} - -class TapKeyOrigin { - final List tapLeafHashes; - final KeySource keySource; - TapKeyOrigin({required this.tapLeafHashes, required this.keySource}); -} - -class FfiConverterTapKeyOrigin { - static TapKeyOrigin lift(RustBuffer buf) { - return FfiConverterTapKeyOrigin.read(buf.asUint8List()).value; - } - - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final tapLeafHashes_lifted = FfiConverterSequenceString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final tapLeafHashes = tapLeafHashes_lifted.value; - new_offset += tapLeafHashes_lifted.bytesRead; - final keySource_lifted = FfiConverterKeySource.read( - Uint8List.view(buf.buffer, new_offset), - ); - final keySource = keySource_lifted.value; - new_offset += keySource_lifted.bytesRead; - return LiftRetVal( - TapKeyOrigin(tapLeafHashes: tapLeafHashes, keySource: keySource), - new_offset - buf.offsetInBytes, - ); - } - - static RustBuffer lower(TapKeyOrigin value) { - final total_length = - FfiConverterSequenceString.allocationSize(value.tapLeafHashes) + - FfiConverterKeySource.allocationSize(value.keySource) + - 0; - final buf = Uint8List(total_length); - write(value, buf); - return toRustBuffer(buf); - } - - static int write(TapKeyOrigin value, Uint8List buf) { - int new_offset = buf.offsetInBytes; - new_offset += FfiConverterSequenceString.write( - value.tapLeafHashes, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterKeySource.write( - value.keySource, - Uint8List.view(buf.buffer, new_offset), - ); - return new_offset - buf.offsetInBytes; - } - - static int allocationSize(TapKeyOrigin value) { - return FfiConverterSequenceString.allocationSize(value.tapLeafHashes) + - FfiConverterKeySource.allocationSize(value.keySource) + - 0; - } -} - -class TapScriptEntry { - final Script script; - final int leafVersion; - TapScriptEntry({required this.script, required this.leafVersion}); -} - -class FfiConverterTapScriptEntry { - static TapScriptEntry lift(RustBuffer buf) { - return FfiConverterTapScriptEntry.read(buf.asUint8List()).value; - } - - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final script_lifted = Script.read(Uint8List.view(buf.buffer, new_offset)); - final script = script_lifted.value; - new_offset += script_lifted.bytesRead; - final leafVersion_lifted = FfiConverterUInt8.read( - Uint8List.view(buf.buffer, new_offset), - ); - final leafVersion = leafVersion_lifted.value; - new_offset += leafVersion_lifted.bytesRead; - return LiftRetVal( - TapScriptEntry(script: script, leafVersion: leafVersion), - new_offset - buf.offsetInBytes, - ); - } - - static RustBuffer lower(TapScriptEntry value) { - final total_length = - Script.allocationSize(value.script) + - FfiConverterUInt8.allocationSize(value.leafVersion) + - 0; - final buf = Uint8List(total_length); - write(value, buf); - return toRustBuffer(buf); - } - - static int write(TapScriptEntry value, Uint8List buf) { - int new_offset = buf.offsetInBytes; - new_offset += Script.write( - value.script, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterUInt8.write( - value.leafVersion, - Uint8List.view(buf.buffer, new_offset), - ); - return new_offset - buf.offsetInBytes; - } - - static int allocationSize(TapScriptEntry value) { - return Script.allocationSize(value.script) + - FfiConverterUInt8.allocationSize(value.leafVersion) + - 0; - } -} - -class TapScriptSigKey { - final String xonlyPubkey; - final String tapLeafHash; - TapScriptSigKey({required this.xonlyPubkey, required this.tapLeafHash}); -} - -class FfiConverterTapScriptSigKey { - static TapScriptSigKey lift(RustBuffer buf) { - return FfiConverterTapScriptSigKey.read(buf.asUint8List()).value; - } - - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final xonlyPubkey_lifted = FfiConverterString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final xonlyPubkey = xonlyPubkey_lifted.value; - new_offset += xonlyPubkey_lifted.bytesRead; - final tapLeafHash_lifted = FfiConverterString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final tapLeafHash = tapLeafHash_lifted.value; - new_offset += tapLeafHash_lifted.bytesRead; + final signWithTapInternalKey = signWithTapInternalKey_lifted.value; + new_offset += signWithTapInternalKey_lifted.bytesRead; + final allowGrinding_lifted = FfiConverterBool.read( + Uint8List.view(buf.buffer, new_offset), + ); + final allowGrinding = allowGrinding_lifted.value; + new_offset += allowGrinding_lifted.bytesRead; return LiftRetVal( - TapScriptSigKey(xonlyPubkey: xonlyPubkey, tapLeafHash: tapLeafHash), + SignOptions( + trustWitnessUtxo: trustWitnessUtxo, + assumeHeight: assumeHeight, + allowAllSighashes: allowAllSighashes, + tryFinalize: tryFinalize, + signWithTapInternalKey: signWithTapInternalKey, + allowGrinding: allowGrinding, + ), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(TapScriptSigKey value) { + static RustBuffer lower(SignOptions value) { final total_length = - FfiConverterString.allocationSize(value.xonlyPubkey) + - FfiConverterString.allocationSize(value.tapLeafHash) + + FfiConverterBool.allocationSize(value.trustWitnessUtxo) + + FfiConverterOptionalUInt32.allocationSize(value.assumeHeight) + + FfiConverterBool.allocationSize(value.allowAllSighashes) + + FfiConverterBool.allocationSize(value.tryFinalize) + + FfiConverterBool.allocationSize(value.signWithTapInternalKey) + + FfiConverterBool.allocationSize(value.allowGrinding) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(TapScriptSigKey value, Uint8List buf) { + static int write(SignOptions value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += FfiConverterString.write( - value.xonlyPubkey, + new_offset += FfiConverterBool.write( + value.trustWitnessUtxo, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterString.write( - value.tapLeafHash, + new_offset += FfiConverterOptionalUInt32.write( + value.assumeHeight, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterBool.write( + value.allowAllSighashes, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterBool.write( + value.tryFinalize, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterBool.write( + value.signWithTapInternalKey, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterBool.write( + value.allowGrinding, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(TapScriptSigKey value) { - return FfiConverterString.allocationSize(value.xonlyPubkey) + - FfiConverterString.allocationSize(value.tapLeafHash) + + static int allocationSize(SignOptions value) { + return FfiConverterBool.allocationSize(value.trustWitnessUtxo) + + FfiConverterOptionalUInt32.allocationSize(value.assumeHeight) + + FfiConverterBool.allocationSize(value.allowAllSighashes) + + FfiConverterBool.allocationSize(value.tryFinalize) + + FfiConverterBool.allocationSize(value.signWithTapInternalKey) + + FfiConverterBool.allocationSize(value.allowGrinding) + 0; } } @@ -3479,362 +3688,648 @@ class FfiConverterTxGraphChangeSet { } } -class TxIn { - final OutPoint previousOutput; - final Script scriptSig; - final int sequence; - final List witness; - TxIn({ - required this.previousOutput, - required this.scriptSig, - required this.sequence, - required this.witness, +class TxStatus { + final bool confirmed; + final int? blockHeight; + final BlockHash? blockHash; + final int? blockTime; + TxStatus({ + required this.confirmed, + this.blockHeight, + this.blockHash, + this.blockTime, }); } -class FfiConverterTxIn { - static TxIn lift(RustBuffer buf) { - return FfiConverterTxIn.read(buf.asUint8List()).value; +class FfiConverterTxStatus { + static TxStatus lift(RustBuffer buf) { + return FfiConverterTxStatus.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final previousOutput_lifted = FfiConverterOutPoint.read( + final confirmed_lifted = FfiConverterBool.read( Uint8List.view(buf.buffer, new_offset), ); - final previousOutput = previousOutput_lifted.value; - new_offset += previousOutput_lifted.bytesRead; - final scriptSig_lifted = Script.read( + final confirmed = confirmed_lifted.value; + new_offset += confirmed_lifted.bytesRead; + final blockHeight_lifted = FfiConverterOptionalUInt32.read( Uint8List.view(buf.buffer, new_offset), ); - final scriptSig = scriptSig_lifted.value; - new_offset += scriptSig_lifted.bytesRead; - final sequence_lifted = FfiConverterUInt32.read( + final blockHeight = blockHeight_lifted.value; + new_offset += blockHeight_lifted.bytesRead; + final blockHash_lifted = FfiConverterOptionalBlockHash.read( Uint8List.view(buf.buffer, new_offset), ); - final sequence = sequence_lifted.value; - new_offset += sequence_lifted.bytesRead; - final witness_lifted = FfiConverterSequenceUint8List.read( + final blockHash = blockHash_lifted.value; + new_offset += blockHash_lifted.bytesRead; + final blockTime_lifted = FfiConverterOptionalUInt64.read( Uint8List.view(buf.buffer, new_offset), ); - final witness = witness_lifted.value; - new_offset += witness_lifted.bytesRead; + final blockTime = blockTime_lifted.value; + new_offset += blockTime_lifted.bytesRead; return LiftRetVal( - TxIn( - previousOutput: previousOutput, - scriptSig: scriptSig, - sequence: sequence, - witness: witness, + TxStatus( + confirmed: confirmed, + blockHeight: blockHeight, + blockHash: blockHash, + blockTime: blockTime, ), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(TxIn value) { + static RustBuffer lower(TxStatus value) { final total_length = - FfiConverterOutPoint.allocationSize(value.previousOutput) + - Script.allocationSize(value.scriptSig) + - FfiConverterUInt32.allocationSize(value.sequence) + - FfiConverterSequenceUint8List.allocationSize(value.witness) + + FfiConverterBool.allocationSize(value.confirmed) + + FfiConverterOptionalUInt32.allocationSize(value.blockHeight) + + FfiConverterOptionalBlockHash.allocationSize(value.blockHash) + + FfiConverterOptionalUInt64.allocationSize(value.blockTime) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(TxIn value, Uint8List buf) { + static int write(TxStatus value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += FfiConverterOutPoint.write( - value.previousOutput, + new_offset += FfiConverterBool.write( + value.confirmed, Uint8List.view(buf.buffer, new_offset), ); - new_offset += Script.write( - value.scriptSig, + new_offset += FfiConverterOptionalUInt32.write( + value.blockHeight, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterUInt32.write( - value.sequence, + new_offset += FfiConverterOptionalBlockHash.write( + value.blockHash, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterSequenceUint8List.write( - value.witness, + new_offset += FfiConverterOptionalUInt64.write( + value.blockTime, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(TxIn value) { - return FfiConverterOutPoint.allocationSize(value.previousOutput) + - Script.allocationSize(value.scriptSig) + - FfiConverterUInt32.allocationSize(value.sequence) + - FfiConverterSequenceUint8List.allocationSize(value.witness) + + static int allocationSize(TxStatus value) { + return FfiConverterBool.allocationSize(value.confirmed) + + FfiConverterOptionalUInt32.allocationSize(value.blockHeight) + + FfiConverterOptionalBlockHash.allocationSize(value.blockHash) + + FfiConverterOptionalUInt64.allocationSize(value.blockTime) + 0; } } -class TxOut { - final Amount value; - final Script scriptPubkey; - TxOut({required this.value, required this.scriptPubkey}); +class UnconfirmedTx { + final Transaction tx; + final int lastSeen; + UnconfirmedTx({required this.tx, required this.lastSeen}); } -class FfiConverterTxOut { - static TxOut lift(RustBuffer buf) { - return FfiConverterTxOut.read(buf.asUint8List()).value; +class FfiConverterUnconfirmedTx { + static UnconfirmedTx lift(RustBuffer buf) { + return FfiConverterUnconfirmedTx.read(buf.asUint8List()).value; + } + + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final tx_lifted = Transaction.read(Uint8List.view(buf.buffer, new_offset)); + final tx = tx_lifted.value; + new_offset += tx_lifted.bytesRead; + final lastSeen_lifted = FfiConverterUInt64.read( + Uint8List.view(buf.buffer, new_offset), + ); + final lastSeen = lastSeen_lifted.value; + new_offset += lastSeen_lifted.bytesRead; + return LiftRetVal( + UnconfirmedTx(tx: tx, lastSeen: lastSeen), + new_offset - buf.offsetInBytes, + ); + } + + static RustBuffer lower(UnconfirmedTx value) { + final total_length = + Transaction.allocationSize(value.tx) + + FfiConverterUInt64.allocationSize(value.lastSeen) + + 0; + final buf = Uint8List(total_length); + write(value, buf); + return toRustBuffer(buf); + } + + static int write(UnconfirmedTx value, Uint8List buf) { + int new_offset = buf.offsetInBytes; + new_offset += Transaction.write( + value.tx, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterUInt64.write( + value.lastSeen, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset - buf.offsetInBytes; + } + + static int allocationSize(UnconfirmedTx value) { + return Transaction.allocationSize(value.tx) + + FfiConverterUInt64.allocationSize(value.lastSeen) + + 0; + } +} + +class WalletKeychain { + final KeychainKind keychain; + final Descriptor publicDescriptor; + WalletKeychain({required this.keychain, required this.publicDescriptor}); +} + +class FfiConverterWalletKeychain { + static WalletKeychain lift(RustBuffer buf) { + return FfiConverterWalletKeychain.read(buf.asUint8List()).value; + } + + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final keychain_lifted = FfiConverterKeychainKind.read( + Uint8List.view(buf.buffer, new_offset), + ); + final keychain = keychain_lifted.value; + new_offset += keychain_lifted.bytesRead; + final publicDescriptor_lifted = Descriptor.read( + Uint8List.view(buf.buffer, new_offset), + ); + final publicDescriptor = publicDescriptor_lifted.value; + new_offset += publicDescriptor_lifted.bytesRead; + return LiftRetVal( + WalletKeychain(keychain: keychain, publicDescriptor: publicDescriptor), + new_offset - buf.offsetInBytes, + ); + } + + static RustBuffer lower(WalletKeychain value) { + final total_length = + FfiConverterKeychainKind.allocationSize(value.keychain) + + Descriptor.allocationSize(value.publicDescriptor) + + 0; + final buf = Uint8List(total_length); + write(value, buf); + return toRustBuffer(buf); + } + + static int write(WalletKeychain value, Uint8List buf) { + int new_offset = buf.offsetInBytes; + new_offset += FfiConverterKeychainKind.write( + value.keychain, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += Descriptor.write( + value.publicDescriptor, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset - buf.offsetInBytes; + } + + static int allocationSize(WalletKeychain value) { + return FfiConverterKeychainKind.allocationSize(value.keychain) + + Descriptor.allocationSize(value.publicDescriptor) + + 0; + } +} + +abstract class AddressData { + RustBuffer lower(); + int allocationSize(); + int write(Uint8List buf); +} + +class FfiConverterAddressData { + static AddressData lift(RustBuffer buffer) { + return FfiConverterAddressData.read(buffer.asUint8List()).value; + } + + static LiftRetVal read(Uint8List buf) { + final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); + final subview = Uint8List.view(buf.buffer, buf.offsetInBytes + 4); + switch (index) { + case 1: + final lifted = P2pkhAddressData.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 2: + final lifted = P2shAddressData.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 3: + final lifted = SegwitAddressData.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + default: + throw UniffiInternalError( + UniffiInternalError.unexpectedEnumCase, + "Unable to determine enum variant", + ); + } + } + + static RustBuffer lower(AddressData value) { + return value.lower(); + } + + static int allocationSize(AddressData value) { + return value.allocationSize(); + } + + static int write(AddressData value, Uint8List buf) { + return value.write(buf) - buf.offsetInBytes; + } +} + +class P2pkhAddressData extends AddressData { + final String pubkeyHash; + P2pkhAddressData(String this.pubkeyHash); + P2pkhAddressData._(String this.pubkeyHash); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final pubkeyHash_lifted = FfiConverterString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final pubkeyHash = pubkeyHash_lifted.value; + new_offset += pubkeyHash_lifted.bytesRead; + return LiftRetVal(P2pkhAddressData._(pubkeyHash), new_offset); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return FfiConverterString.allocationSize(pubkeyHash) + 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); + int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterString.write( + pubkeyHash, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset; + } +} + +class P2shAddressData extends AddressData { + final String scriptHash; + P2shAddressData(String this.scriptHash); + P2shAddressData._(String this.scriptHash); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final scriptHash_lifted = FfiConverterString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final scriptHash = scriptHash_lifted.value; + new_offset += scriptHash_lifted.bytesRead; + return LiftRetVal(P2shAddressData._(scriptHash), new_offset); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return FfiConverterString.allocationSize(scriptHash) + 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 2); + int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterString.write( + scriptHash, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset; + } +} + +class SegwitAddressData extends AddressData { + final WitnessProgram witnessProgram; + SegwitAddressData(WitnessProgram this.witnessProgram); + SegwitAddressData._(WitnessProgram this.witnessProgram); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final witnessProgram_lifted = FfiConverterWitnessProgram.read( + Uint8List.view(buf.buffer, new_offset), + ); + final witnessProgram = witnessProgram_lifted.value; + new_offset += witnessProgram_lifted.bytesRead; + return LiftRetVal(SegwitAddressData._(witnessProgram), new_offset); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return FfiConverterWitnessProgram.allocationSize(witnessProgram) + 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 3); + int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterWitnessProgram.write( + witnessProgram, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset; + } +} + +abstract class ChildNumber { + RustBuffer lower(); + int allocationSize(); + int write(Uint8List buf); +} + +class FfiConverterChildNumber { + static ChildNumber lift(RustBuffer buffer) { + return FfiConverterChildNumber.read(buffer.asUint8List()).value; + } + + static LiftRetVal read(Uint8List buf) { + final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); + final subview = Uint8List.view(buf.buffer, buf.offsetInBytes + 4); + switch (index) { + case 1: + final lifted = NormalChildNumber.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 2: + final lifted = HardenedChildNumber.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + default: + throw UniffiInternalError( + UniffiInternalError.unexpectedEnumCase, + "Unable to determine enum variant", + ); + } + } + + static RustBuffer lower(ChildNumber value) { + return value.lower(); + } + + static int allocationSize(ChildNumber value) { + return value.allocationSize(); + } + + static int write(ChildNumber value, Uint8List buf) { + return value.write(buf) - buf.offsetInBytes; + } +} + +class NormalChildNumber extends ChildNumber { + final int index; + NormalChildNumber(int this.index); + NormalChildNumber._(int this.index); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final index_lifted = FfiConverterUInt32.read( + Uint8List.view(buf.buffer, new_offset), + ); + final index = index_lifted.value; + new_offset += index_lifted.bytesRead; + return LiftRetVal(NormalChildNumber._(index), new_offset); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return FfiConverterUInt32.allocationSize(index) + 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); + int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterUInt32.write( + index, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset; } +} - static LiftRetVal read(Uint8List buf) { +class HardenedChildNumber extends ChildNumber { + final int index; + HardenedChildNumber(int this.index); + HardenedChildNumber._(int this.index); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final value_lifted = Amount.read(Uint8List.view(buf.buffer, new_offset)); - final value = value_lifted.value; - new_offset += value_lifted.bytesRead; - final scriptPubkey_lifted = Script.read( + final index_lifted = FfiConverterUInt32.read( Uint8List.view(buf.buffer, new_offset), ); - final scriptPubkey = scriptPubkey_lifted.value; - new_offset += scriptPubkey_lifted.bytesRead; - return LiftRetVal( - TxOut(value: value, scriptPubkey: scriptPubkey), - new_offset - buf.offsetInBytes, - ); + final index = index_lifted.value; + new_offset += index_lifted.bytesRead; + return LiftRetVal(HardenedChildNumber._(index), new_offset); } - static RustBuffer lower(TxOut value) { - final total_length = - Amount.allocationSize(value.value) + - Script.allocationSize(value.scriptPubkey) + - 0; - final buf = Uint8List(total_length); - write(value, buf); + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); return toRustBuffer(buf); } - static int write(TxOut value, Uint8List buf) { - int new_offset = buf.offsetInBytes; - new_offset += Amount.write( - value.value, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += Script.write( - value.scriptPubkey, - Uint8List.view(buf.buffer, new_offset), - ); - return new_offset - buf.offsetInBytes; + @override + int allocationSize() { + return FfiConverterUInt32.allocationSize(index) + 4; } - static int allocationSize(TxOut value) { - return Amount.allocationSize(value.value) + - Script.allocationSize(value.scriptPubkey) + - 0; + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 2); + int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterUInt32.write( + index, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset; } } -class TxStatus { - final bool confirmed; - final int? blockHeight; - final BlockHash? blockHash; - final int? blockTime; - TxStatus({ - required this.confirmed, - this.blockHeight, - this.blockHash, - this.blockTime, - }); +enum DescriptorType { + bare, + sh, + pkh, + wpkh, + wsh, + shWsh, + shWpkh, + shSortedMulti, + wshSortedMulti, + shWshSortedMulti, + tr, } -class FfiConverterTxStatus { - static TxStatus lift(RustBuffer buf) { - return FfiConverterTxStatus.read(buf.asUint8List()).value; +class FfiConverterDescriptorType { + static LiftRetVal read(Uint8List buf) { + final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); + switch (index) { + case 1: + return LiftRetVal(DescriptorType.bare, 4); + case 2: + return LiftRetVal(DescriptorType.sh, 4); + case 3: + return LiftRetVal(DescriptorType.pkh, 4); + case 4: + return LiftRetVal(DescriptorType.wpkh, 4); + case 5: + return LiftRetVal(DescriptorType.wsh, 4); + case 6: + return LiftRetVal(DescriptorType.shWsh, 4); + case 7: + return LiftRetVal(DescriptorType.shWpkh, 4); + case 8: + return LiftRetVal(DescriptorType.shSortedMulti, 4); + case 9: + return LiftRetVal(DescriptorType.wshSortedMulti, 4); + case 10: + return LiftRetVal(DescriptorType.shWshSortedMulti, 4); + case 11: + return LiftRetVal(DescriptorType.tr, 4); + default: + throw UniffiInternalError( + UniffiInternalError.unexpectedEnumCase, + "Unable to determine enum variant", + ); + } } - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final confirmed_lifted = FfiConverterBool.read( - Uint8List.view(buf.buffer, new_offset), - ); - final confirmed = confirmed_lifted.value; - new_offset += confirmed_lifted.bytesRead; - final blockHeight_lifted = FfiConverterOptionalUInt32.read( - Uint8List.view(buf.buffer, new_offset), - ); - final blockHeight = blockHeight_lifted.value; - new_offset += blockHeight_lifted.bytesRead; - final blockHash_lifted = FfiConverterOptionalBlockHash.read( - Uint8List.view(buf.buffer, new_offset), - ); - final blockHash = blockHash_lifted.value; - new_offset += blockHash_lifted.bytesRead; - final blockTime_lifted = FfiConverterOptionalUInt64.read( - Uint8List.view(buf.buffer, new_offset), - ); - final blockTime = blockTime_lifted.value; - new_offset += blockTime_lifted.bytesRead; - return LiftRetVal( - TxStatus( - confirmed: confirmed, - blockHeight: blockHeight, - blockHash: blockHash, - blockTime: blockTime, - ), - new_offset - buf.offsetInBytes, - ); + static DescriptorType lift(RustBuffer buffer) { + return FfiConverterDescriptorType.read(buffer.asUint8List()).value; } - static RustBuffer lower(TxStatus value) { - final total_length = - FfiConverterBool.allocationSize(value.confirmed) + - FfiConverterOptionalUInt32.allocationSize(value.blockHeight) + - FfiConverterOptionalBlockHash.allocationSize(value.blockHash) + - FfiConverterOptionalUInt64.allocationSize(value.blockTime) + - 0; - final buf = Uint8List(total_length); - write(value, buf); - return toRustBuffer(buf); + static RustBuffer lower(DescriptorType input) { + return toRustBuffer(createUint8ListFromInt(input.index + 1)); } - static int write(TxStatus value, Uint8List buf) { - int new_offset = buf.offsetInBytes; - new_offset += FfiConverterBool.write( - value.confirmed, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalUInt32.write( - value.blockHeight, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalBlockHash.write( - value.blockHash, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalUInt64.write( - value.blockTime, - Uint8List.view(buf.buffer, new_offset), - ); - return new_offset - buf.offsetInBytes; + static int allocationSize(DescriptorType _value) { + return 4; } - static int allocationSize(TxStatus value) { - return FfiConverterBool.allocationSize(value.confirmed) + - FfiConverterOptionalUInt32.allocationSize(value.blockHeight) + - FfiConverterOptionalBlockHash.allocationSize(value.blockHash) + - FfiConverterOptionalUInt64.allocationSize(value.blockTime) + - 0; + static int write(DescriptorType value, Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, value.index + 1); + return 4; } } -class UnconfirmedTx { - final Transaction tx; - final int lastSeen; - UnconfirmedTx({required this.tx, required this.lastSeen}); -} +enum Network { bitcoin, testnet, testnet4, signet, regtest } -class FfiConverterUnconfirmedTx { - static UnconfirmedTx lift(RustBuffer buf) { - return FfiConverterUnconfirmedTx.read(buf.asUint8List()).value; +class FfiConverterNetwork { + static LiftRetVal read(Uint8List buf) { + final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); + switch (index) { + case 1: + return LiftRetVal(Network.bitcoin, 4); + case 2: + return LiftRetVal(Network.testnet, 4); + case 3: + return LiftRetVal(Network.testnet4, 4); + case 4: + return LiftRetVal(Network.signet, 4); + case 5: + return LiftRetVal(Network.regtest, 4); + default: + throw UniffiInternalError( + UniffiInternalError.unexpectedEnumCase, + "Unable to determine enum variant", + ); + } } - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final tx_lifted = Transaction.read(Uint8List.view(buf.buffer, new_offset)); - final tx = tx_lifted.value; - new_offset += tx_lifted.bytesRead; - final lastSeen_lifted = FfiConverterUInt64.read( - Uint8List.view(buf.buffer, new_offset), - ); - final lastSeen = lastSeen_lifted.value; - new_offset += lastSeen_lifted.bytesRead; - return LiftRetVal( - UnconfirmedTx(tx: tx, lastSeen: lastSeen), - new_offset - buf.offsetInBytes, - ); + static Network lift(RustBuffer buffer) { + return FfiConverterNetwork.read(buffer.asUint8List()).value; } - static RustBuffer lower(UnconfirmedTx value) { - final total_length = - Transaction.allocationSize(value.tx) + - FfiConverterUInt64.allocationSize(value.lastSeen) + - 0; - final buf = Uint8List(total_length); - write(value, buf); - return toRustBuffer(buf); + static RustBuffer lower(Network input) { + return toRustBuffer(createUint8ListFromInt(input.index + 1)); } - static int write(UnconfirmedTx value, Uint8List buf) { - int new_offset = buf.offsetInBytes; - new_offset += Transaction.write( - value.tx, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterUInt64.write( - value.lastSeen, - Uint8List.view(buf.buffer, new_offset), - ); - return new_offset - buf.offsetInBytes; + static int allocationSize(Network _value) { + return 4; } - static int allocationSize(UnconfirmedTx value) { - return Transaction.allocationSize(value.tx) + - FfiConverterUInt64.allocationSize(value.lastSeen) + - 0; + static int write(Network value, Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, value.index + 1); + return 4; } } -class WitnessProgram { - final int version; - final Uint8List program; - WitnessProgram({required this.version, required this.program}); -} +enum NetworkKind { main, test } -class FfiConverterWitnessProgram { - static WitnessProgram lift(RustBuffer buf) { - return FfiConverterWitnessProgram.read(buf.asUint8List()).value; +class FfiConverterNetworkKind { + static LiftRetVal read(Uint8List buf) { + final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); + switch (index) { + case 1: + return LiftRetVal(NetworkKind.main, 4); + case 2: + return LiftRetVal(NetworkKind.test, 4); + default: + throw UniffiInternalError( + UniffiInternalError.unexpectedEnumCase, + "Unable to determine enum variant", + ); + } } - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final version_lifted = FfiConverterUInt8.read( - Uint8List.view(buf.buffer, new_offset), - ); - final version = version_lifted.value; - new_offset += version_lifted.bytesRead; - final program_lifted = FfiConverterUint8List.read( - Uint8List.view(buf.buffer, new_offset), - ); - final program = program_lifted.value; - new_offset += program_lifted.bytesRead; - return LiftRetVal( - WitnessProgram(version: version, program: program), - new_offset - buf.offsetInBytes, - ); + static NetworkKind lift(RustBuffer buffer) { + return FfiConverterNetworkKind.read(buffer.asUint8List()).value; } - static RustBuffer lower(WitnessProgram value) { - final total_length = - FfiConverterUInt8.allocationSize(value.version) + - FfiConverterUint8List.allocationSize(value.program) + - 0; - final buf = Uint8List(total_length); - write(value, buf); - return toRustBuffer(buf); + static RustBuffer lower(NetworkKind input) { + return toRustBuffer(createUint8ListFromInt(input.index + 1)); } - static int write(WitnessProgram value, Uint8List buf) { - int new_offset = buf.offsetInBytes; - new_offset += FfiConverterUInt8.write( - value.version, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterUint8List.write( - value.program, - Uint8List.view(buf.buffer, new_offset), - ); - return new_offset - buf.offsetInBytes; + static int allocationSize(NetworkKind _value) { + return 4; } - static int allocationSize(WitnessProgram value) { - return FfiConverterUInt8.allocationSize(value.version) + - FfiConverterUint8List.allocationSize(value.program) + - 0; + static int write(NetworkKind value, Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, value.index + 1); + return 4; } } @@ -4074,174 +4569,6 @@ class AddForeignUtxoExceptionErrorHandler final AddForeignUtxoExceptionErrorHandler addForeignUtxoExceptionErrorHandler = AddForeignUtxoExceptionErrorHandler(); -abstract class AddressData { - RustBuffer lower(); - int allocationSize(); - int write(Uint8List buf); -} - -class FfiConverterAddressData { - static AddressData lift(RustBuffer buffer) { - return FfiConverterAddressData.read(buffer.asUint8List()).value; - } - - static LiftRetVal read(Uint8List buf) { - final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); - final subview = Uint8List.view(buf.buffer, buf.offsetInBytes + 4); - switch (index) { - case 1: - final lifted = P2pkhAddressData.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 2: - final lifted = P2shAddressData.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 3: - final lifted = SegwitAddressData.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - default: - throw UniffiInternalError( - UniffiInternalError.unexpectedEnumCase, - "Unable to determine enum variant", - ); - } - } - - static RustBuffer lower(AddressData value) { - return value.lower(); - } - - static int allocationSize(AddressData value) { - return value.allocationSize(); - } - - static int write(AddressData value, Uint8List buf) { - return value.write(buf) - buf.offsetInBytes; - } -} - -class P2pkhAddressData extends AddressData { - final String pubkeyHash; - P2pkhAddressData(String this.pubkeyHash); - P2pkhAddressData._(String this.pubkeyHash); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final pubkeyHash_lifted = FfiConverterString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final pubkeyHash = pubkeyHash_lifted.value; - new_offset += pubkeyHash_lifted.bytesRead; - return LiftRetVal(P2pkhAddressData._(pubkeyHash), new_offset); - } - - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); - } - - @override - int allocationSize() { - return FfiConverterString.allocationSize(pubkeyHash) + 4; - } - - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); - int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - pubkeyHash, - Uint8List.view(buf.buffer, new_offset), - ); - return new_offset; - } -} - -class P2shAddressData extends AddressData { - final String scriptHash; - P2shAddressData(String this.scriptHash); - P2shAddressData._(String this.scriptHash); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final scriptHash_lifted = FfiConverterString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final scriptHash = scriptHash_lifted.value; - new_offset += scriptHash_lifted.bytesRead; - return LiftRetVal(P2shAddressData._(scriptHash), new_offset); - } - - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); - } - - @override - int allocationSize() { - return FfiConverterString.allocationSize(scriptHash) + 4; - } - - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 2); - int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - scriptHash, - Uint8List.view(buf.buffer, new_offset), - ); - return new_offset; - } -} - -class SegwitAddressData extends AddressData { - final WitnessProgram witnessProgram; - SegwitAddressData(WitnessProgram this.witnessProgram); - SegwitAddressData._(WitnessProgram this.witnessProgram); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final witnessProgram_lifted = FfiConverterWitnessProgram.read( - Uint8List.view(buf.buffer, new_offset), - ); - final witnessProgram = witnessProgram_lifted.value; - new_offset += witnessProgram_lifted.bytesRead; - return LiftRetVal(SegwitAddressData._(witnessProgram), new_offset); - } - - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); - } - - @override - int allocationSize() { - return FfiConverterWitnessProgram.allocationSize(witnessProgram) + 4; - } - - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 3); - int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterWitnessProgram.write( - witnessProgram, - Uint8List.view(buf.buffer, new_offset), - ); - return new_offset; - } -} - abstract class AddressParseException implements Exception { RustBuffer lower(); int allocationSize(); @@ -5921,315 +6248,6 @@ class CbfExceptionErrorHandler extends UniffiRustCallStatusErrorHandler { final CbfExceptionErrorHandler cbfExceptionErrorHandler = CbfExceptionErrorHandler(); -abstract class ChainPosition { - RustBuffer lower(); - int allocationSize(); - int write(Uint8List buf); -} - -class FfiConverterChainPosition { - static ChainPosition lift(RustBuffer buffer) { - return FfiConverterChainPosition.read(buffer.asUint8List()).value; - } - - static LiftRetVal read(Uint8List buf) { - final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); - final subview = Uint8List.view(buf.buffer, buf.offsetInBytes + 4); - switch (index) { - case 1: - final lifted = ConfirmedChainPosition.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 2: - final lifted = UnconfirmedChainPosition.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - default: - throw UniffiInternalError( - UniffiInternalError.unexpectedEnumCase, - "Unable to determine enum variant", - ); - } - } - - static RustBuffer lower(ChainPosition value) { - return value.lower(); - } - - static int allocationSize(ChainPosition value) { - return value.allocationSize(); - } - - static int write(ChainPosition value, Uint8List buf) { - return value.write(buf) - buf.offsetInBytes; - } -} - -class ConfirmedChainPosition extends ChainPosition { - final ConfirmationBlockTime confirmationBlockTime; - final Txid? transitively; - ConfirmedChainPosition({ - required ConfirmationBlockTime this.confirmationBlockTime, - required Txid? this.transitively, - }); - ConfirmedChainPosition._( - ConfirmationBlockTime this.confirmationBlockTime, - Txid? this.transitively, - ); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final confirmationBlockTime_lifted = FfiConverterConfirmationBlockTime.read( - Uint8List.view(buf.buffer, new_offset), - ); - final confirmationBlockTime = confirmationBlockTime_lifted.value; - new_offset += confirmationBlockTime_lifted.bytesRead; - final transitively_lifted = FfiConverterOptionalTxid.read( - Uint8List.view(buf.buffer, new_offset), - ); - final transitively = transitively_lifted.value; - new_offset += transitively_lifted.bytesRead; - return LiftRetVal( - ConfirmedChainPosition._(confirmationBlockTime, transitively), - new_offset, - ); - } - - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); - } - - @override - int allocationSize() { - return FfiConverterConfirmationBlockTime.allocationSize( - confirmationBlockTime, - ) + - FfiConverterOptionalTxid.allocationSize(transitively) + - 4; - } - - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); - int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterConfirmationBlockTime.write( - confirmationBlockTime, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalTxid.write( - transitively, - Uint8List.view(buf.buffer, new_offset), - ); - return new_offset; - } -} - -class UnconfirmedChainPosition extends ChainPosition { - final int? timestamp; - UnconfirmedChainPosition(int? this.timestamp); - UnconfirmedChainPosition._(int? this.timestamp); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final timestamp_lifted = FfiConverterOptionalUInt64.read( - Uint8List.view(buf.buffer, new_offset), - ); - final timestamp = timestamp_lifted.value; - new_offset += timestamp_lifted.bytesRead; - return LiftRetVal(UnconfirmedChainPosition._(timestamp), new_offset); - } - - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); - } - - @override - int allocationSize() { - return FfiConverterOptionalUInt64.allocationSize(timestamp) + 4; - } - - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 2); - int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterOptionalUInt64.write( - timestamp, - Uint8List.view(buf.buffer, new_offset), - ); - return new_offset; - } -} - -enum ChangeSpendPolicy { changeAllowed, onlyChange, changeForbidden } - -class FfiConverterChangeSpendPolicy { - static LiftRetVal read(Uint8List buf) { - final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); - switch (index) { - case 1: - return LiftRetVal(ChangeSpendPolicy.changeAllowed, 4); - case 2: - return LiftRetVal(ChangeSpendPolicy.onlyChange, 4); - case 3: - return LiftRetVal(ChangeSpendPolicy.changeForbidden, 4); - default: - throw UniffiInternalError( - UniffiInternalError.unexpectedEnumCase, - "Unable to determine enum variant", - ); - } - } - - static ChangeSpendPolicy lift(RustBuffer buffer) { - return FfiConverterChangeSpendPolicy.read(buffer.asUint8List()).value; - } - - static RustBuffer lower(ChangeSpendPolicy input) { - return toRustBuffer(createUint8ListFromInt(input.index + 1)); - } - - static int allocationSize(ChangeSpendPolicy _value) { - return 4; - } - - static int write(ChangeSpendPolicy value, Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, value.index + 1); - return 4; - } -} - -abstract class ChildNumber { - RustBuffer lower(); - int allocationSize(); - int write(Uint8List buf); -} - -class FfiConverterChildNumber { - static ChildNumber lift(RustBuffer buffer) { - return FfiConverterChildNumber.read(buffer.asUint8List()).value; - } - - static LiftRetVal read(Uint8List buf) { - final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); - final subview = Uint8List.view(buf.buffer, buf.offsetInBytes + 4); - switch (index) { - case 1: - final lifted = NormalChildNumber.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 2: - final lifted = HardenedChildNumber.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - default: - throw UniffiInternalError( - UniffiInternalError.unexpectedEnumCase, - "Unable to determine enum variant", - ); - } - } - - static RustBuffer lower(ChildNumber value) { - return value.lower(); - } - - static int allocationSize(ChildNumber value) { - return value.allocationSize(); - } - - static int write(ChildNumber value, Uint8List buf) { - return value.write(buf) - buf.offsetInBytes; - } -} - -class NormalChildNumber extends ChildNumber { - final int index; - NormalChildNumber(int this.index); - NormalChildNumber._(int this.index); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final index_lifted = FfiConverterUInt32.read( - Uint8List.view(buf.buffer, new_offset), - ); - final index = index_lifted.value; - new_offset += index_lifted.bytesRead; - return LiftRetVal(NormalChildNumber._(index), new_offset); - } - - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); - } - - @override - int allocationSize() { - return FfiConverterUInt32.allocationSize(index) + 4; - } - - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); - int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterUInt32.write( - index, - Uint8List.view(buf.buffer, new_offset), - ); - return new_offset; - } -} - -class HardenedChildNumber extends ChildNumber { - final int index; - HardenedChildNumber(int this.index); - HardenedChildNumber._(int this.index); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final index_lifted = FfiConverterUInt32.read( - Uint8List.view(buf.buffer, new_offset), - ); - final index = index_lifted.value; - new_offset += index_lifted.bytesRead; - return LiftRetVal(HardenedChildNumber._(index), new_offset); - } - - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); - } - - @override - int allocationSize() { - return FfiConverterUInt32.allocationSize(index) + 4; - } - - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 2); - int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterUInt32.write( - index, - Uint8List.view(buf.buffer, new_offset), - ); - return new_offset; - } -} - abstract class CreateTxException implements Exception { RustBuffer lower(); int allocationSize(); @@ -8462,72 +8480,6 @@ class DescriptorKeyExceptionErrorHandler final DescriptorKeyExceptionErrorHandler descriptorKeyExceptionErrorHandler = DescriptorKeyExceptionErrorHandler(); -enum DescriptorType { - bare, - sh, - pkh, - wpkh, - wsh, - shWsh, - shWpkh, - shSortedMulti, - wshSortedMulti, - shWshSortedMulti, - tr, -} - -class FfiConverterDescriptorType { - static LiftRetVal read(Uint8List buf) { - final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); - switch (index) { - case 1: - return LiftRetVal(DescriptorType.bare, 4); - case 2: - return LiftRetVal(DescriptorType.sh, 4); - case 3: - return LiftRetVal(DescriptorType.pkh, 4); - case 4: - return LiftRetVal(DescriptorType.wpkh, 4); - case 5: - return LiftRetVal(DescriptorType.wsh, 4); - case 6: - return LiftRetVal(DescriptorType.shWsh, 4); - case 7: - return LiftRetVal(DescriptorType.shWpkh, 4); - case 8: - return LiftRetVal(DescriptorType.shSortedMulti, 4); - case 9: - return LiftRetVal(DescriptorType.wshSortedMulti, 4); - case 10: - return LiftRetVal(DescriptorType.shWshSortedMulti, 4); - case 11: - return LiftRetVal(DescriptorType.tr, 4); - default: - throw UniffiInternalError( - UniffiInternalError.unexpectedEnumCase, - "Unable to determine enum variant", - ); - } - } - - static DescriptorType lift(RustBuffer buffer) { - return FfiConverterDescriptorType.read(buffer.asUint8List()).value; - } - - static RustBuffer lower(DescriptorType input) { - return toRustBuffer(createUint8ListFromInt(input.index + 1)); - } - - static int allocationSize(DescriptorType _value) { - return 4; - } - - static int write(DescriptorType value, Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, value.index + 1); - return 4; - } -} - abstract class ElectrumException implements Exception { RustBuffer lower(); int allocationSize(); @@ -10750,252 +10702,6 @@ class HashParseExceptionErrorHandler extends UniffiRustCallStatusErrorHandler { final HashParseExceptionErrorHandler hashParseExceptionErrorHandler = HashParseExceptionErrorHandler(); -abstract class Info { - RustBuffer lower(); - int allocationSize(); - int write(Uint8List buf); -} - -class FfiConverterInfo { - static Info lift(RustBuffer buffer) { - return FfiConverterInfo.read(buffer.asUint8List()).value; - } - - static LiftRetVal read(Uint8List buf) { - final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); - final subview = Uint8List.view(buf.buffer, buf.offsetInBytes + 4); - switch (index) { - case 1: - final lifted = ConnectionsMetInfo.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 2: - final lifted = SuccessfulHandshakeInfo.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 3: - final lifted = ProgressInfo.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 4: - final lifted = BlockReceivedInfo.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - default: - throw UniffiInternalError( - UniffiInternalError.unexpectedEnumCase, - "Unable to determine enum variant", - ); - } - } - - static RustBuffer lower(Info value) { - return value.lower(); - } - - static int allocationSize(Info value) { - return value.allocationSize(); - } - - static int write(Info value, Uint8List buf) { - return value.write(buf) - buf.offsetInBytes; - } -} - -class ConnectionsMetInfo extends Info { - ConnectionsMetInfo(); - ConnectionsMetInfo._(); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - return LiftRetVal(ConnectionsMetInfo._(), new_offset); - } - - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); - } - - @override - int allocationSize() { - return 4; - } - - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); - int new_offset = buf.offsetInBytes + 4; - return new_offset; - } -} - -class SuccessfulHandshakeInfo extends Info { - SuccessfulHandshakeInfo(); - SuccessfulHandshakeInfo._(); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - return LiftRetVal(SuccessfulHandshakeInfo._(), new_offset); - } - - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); - } - - @override - int allocationSize() { - return 4; - } - - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 2); - int new_offset = buf.offsetInBytes + 4; - return new_offset; - } -} - -class ProgressInfo extends Info { - final int chainHeight; - final double filtersDownloadedPercent; - ProgressInfo({ - required int this.chainHeight, - required double this.filtersDownloadedPercent, - }); - ProgressInfo._(int this.chainHeight, double this.filtersDownloadedPercent); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final chainHeight_lifted = FfiConverterUInt32.read( - Uint8List.view(buf.buffer, new_offset), - ); - final chainHeight = chainHeight_lifted.value; - new_offset += chainHeight_lifted.bytesRead; - final filtersDownloadedPercent_lifted = FfiConverterDouble32.read( - Uint8List.view(buf.buffer, new_offset), - ); - final filtersDownloadedPercent = filtersDownloadedPercent_lifted.value; - new_offset += filtersDownloadedPercent_lifted.bytesRead; - return LiftRetVal( - ProgressInfo._(chainHeight, filtersDownloadedPercent), - new_offset, - ); - } - - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); - } - - @override - int allocationSize() { - return FfiConverterUInt32.allocationSize(chainHeight) + - FfiConverterDouble32.allocationSize(filtersDownloadedPercent) + - 4; - } - - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 3); - int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterUInt32.write( - chainHeight, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterDouble32.write( - filtersDownloadedPercent, - Uint8List.view(buf.buffer, new_offset), - ); - return new_offset; - } -} - -class BlockReceivedInfo extends Info { - final String v0; - BlockReceivedInfo(String this.v0); - BlockReceivedInfo._(String this.v0); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final v0_lifted = FfiConverterString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final v0 = v0_lifted.value; - new_offset += v0_lifted.bytesRead; - return LiftRetVal(BlockReceivedInfo._(v0), new_offset); - } - - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); - } - - @override - int allocationSize() { - return FfiConverterString.allocationSize(v0) + 4; - } - - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 4); - int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - v0, - Uint8List.view(buf.buffer, new_offset), - ); - return new_offset; - } -} - -enum KeychainKind { external_, internal } - -class FfiConverterKeychainKind { - static LiftRetVal read(Uint8List buf) { - final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); - switch (index) { - case 1: - return LiftRetVal(KeychainKind.external_, 4); - case 2: - return LiftRetVal(KeychainKind.internal, 4); - default: - throw UniffiInternalError( - UniffiInternalError.unexpectedEnumCase, - "Unable to determine enum variant", - ); - } - } - - static KeychainKind lift(RustBuffer buffer) { - return FfiConverterKeychainKind.read(buffer.asUint8List()).value; - } - - static RustBuffer lower(KeychainKind input) { - return toRustBuffer(createUint8ListFromInt(input.index + 1)); - } - - static int allocationSize(KeychainKind _value) { - return 4; - } - - static int write(KeychainKind value, Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, value.index + 1); - return 4; - } -} - abstract class LoadWithPersistException implements Exception { RustBuffer lower(); int allocationSize(); @@ -11181,140 +10887,16 @@ class CouldNotLoadLoadWithPersistException extends LoadWithPersistException { } class LoadWithPersistExceptionErrorHandler - extends UniffiRustCallStatusErrorHandler { - @override - Exception lift(RustBuffer errorBuf) { - return FfiConverterLoadWithPersistException.lift(errorBuf); - } -} - -final LoadWithPersistExceptionErrorHandler -loadWithPersistExceptionErrorHandler = LoadWithPersistExceptionErrorHandler(); - -abstract class LockTime { - RustBuffer lower(); - int allocationSize(); - int write(Uint8List buf); -} - -class FfiConverterLockTime { - static LockTime lift(RustBuffer buffer) { - return FfiConverterLockTime.read(buffer.asUint8List()).value; - } - - static LiftRetVal read(Uint8List buf) { - final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); - final subview = Uint8List.view(buf.buffer, buf.offsetInBytes + 4); - switch (index) { - case 1: - final lifted = BlocksLockTime.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 2: - final lifted = SecondsLockTime.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - default: - throw UniffiInternalError( - UniffiInternalError.unexpectedEnumCase, - "Unable to determine enum variant", - ); - } - } - - static RustBuffer lower(LockTime value) { - return value.lower(); - } - - static int allocationSize(LockTime value) { - return value.allocationSize(); - } - - static int write(LockTime value, Uint8List buf) { - return value.write(buf) - buf.offsetInBytes; - } -} - -class BlocksLockTime extends LockTime { - final int height; - BlocksLockTime(int this.height); - BlocksLockTime._(int this.height); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final height_lifted = FfiConverterUInt32.read( - Uint8List.view(buf.buffer, new_offset), - ); - final height = height_lifted.value; - new_offset += height_lifted.bytesRead; - return LiftRetVal(BlocksLockTime._(height), new_offset); - } - - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); - } - - @override - int allocationSize() { - return FfiConverterUInt32.allocationSize(height) + 4; - } - - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); - int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterUInt32.write( - height, - Uint8List.view(buf.buffer, new_offset), - ); - return new_offset; - } -} - -class SecondsLockTime extends LockTime { - final int consensusTime; - SecondsLockTime(int this.consensusTime); - SecondsLockTime._(int this.consensusTime); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final consensusTime_lifted = FfiConverterUInt32.read( - Uint8List.view(buf.buffer, new_offset), - ); - final consensusTime = consensusTime_lifted.value; - new_offset += consensusTime_lifted.bytesRead; - return LiftRetVal(SecondsLockTime._(consensusTime), new_offset); - } - - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); - } - - @override - int allocationSize() { - return FfiConverterUInt32.allocationSize(consensusTime) + 4; - } - + extends UniffiRustCallStatusErrorHandler { @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 2); - int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterUInt32.write( - consensusTime, - Uint8List.view(buf.buffer, new_offset), - ); - return new_offset; + Exception lift(RustBuffer errorBuf) { + return FfiConverterLoadWithPersistException.lift(errorBuf); } } +final LoadWithPersistExceptionErrorHandler +loadWithPersistExceptionErrorHandler = LoadWithPersistExceptionErrorHandler(); + abstract class MiniscriptException implements Exception { RustBuffer lower(); int allocationSize(); @@ -12012,28 +11594,527 @@ class ExpectedCharMiniscriptException extends MiniscriptException { int write(Uint8List buf) { buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 11); int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - char, - Uint8List.view(buf.buffer, new_offset), - ); + new_offset += FfiConverterString.write( + char, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset; + } + + @override + String toString() { + return "ExpectedCharMiniscriptException($char)"; + } +} + +class ImpossibleSatisfactionMiniscriptException extends MiniscriptException { + ImpossibleSatisfactionMiniscriptException(); + ImpossibleSatisfactionMiniscriptException._(); + static LiftRetVal read( + Uint8List buf, + ) { + int new_offset = buf.offsetInBytes; + return LiftRetVal( + ImpossibleSatisfactionMiniscriptException._(), + new_offset, + ); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 12); + int new_offset = buf.offsetInBytes + 4; + return new_offset; + } + + @override + String toString() { + return "ImpossibleSatisfactionMiniscriptException"; + } +} + +class InvalidOpcodeMiniscriptException extends MiniscriptException { + InvalidOpcodeMiniscriptException(); + InvalidOpcodeMiniscriptException._(); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + return LiftRetVal(InvalidOpcodeMiniscriptException._(), new_offset); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 13); + int new_offset = buf.offsetInBytes + 4; + return new_offset; + } + + @override + String toString() { + return "InvalidOpcodeMiniscriptException"; + } +} + +class InvalidPushMiniscriptException extends MiniscriptException { + InvalidPushMiniscriptException(); + InvalidPushMiniscriptException._(); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + return LiftRetVal(InvalidPushMiniscriptException._(), new_offset); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 14); + int new_offset = buf.offsetInBytes + 4; + return new_offset; + } + + @override + String toString() { + return "InvalidPushMiniscriptException"; + } +} + +class LiftExceptionMiniscriptException extends MiniscriptException { + final String errorMessage; + LiftExceptionMiniscriptException(String this.errorMessage); + LiftExceptionMiniscriptException._(String this.errorMessage); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final errorMessage_lifted = FfiConverterString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final errorMessage = errorMessage_lifted.value; + new_offset += errorMessage_lifted.bytesRead; + return LiftRetVal( + LiftExceptionMiniscriptException._(errorMessage), + new_offset, + ); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return FfiConverterString.allocationSize(errorMessage) + 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 15); + int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterString.write( + errorMessage, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset; + } + + @override + String toString() { + return "LiftExceptionMiniscriptException($errorMessage)"; + } +} + +class MaxRecursiveDepthExceededMiniscriptException extends MiniscriptException { + MaxRecursiveDepthExceededMiniscriptException(); + MaxRecursiveDepthExceededMiniscriptException._(); + static LiftRetVal read( + Uint8List buf, + ) { + int new_offset = buf.offsetInBytes; + return LiftRetVal( + MaxRecursiveDepthExceededMiniscriptException._(), + new_offset, + ); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 16); + int new_offset = buf.offsetInBytes + 4; + return new_offset; + } + + @override + String toString() { + return "MaxRecursiveDepthExceededMiniscriptException"; + } +} + +class MissingSigMiniscriptException extends MiniscriptException { + MissingSigMiniscriptException(); + MissingSigMiniscriptException._(); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + return LiftRetVal(MissingSigMiniscriptException._(), new_offset); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 17); + int new_offset = buf.offsetInBytes + 4; + return new_offset; + } + + @override + String toString() { + return "MissingSigMiniscriptException"; + } +} + +class MultiATooManyKeysMiniscriptException extends MiniscriptException { + final int keys; + MultiATooManyKeysMiniscriptException(int this.keys); + MultiATooManyKeysMiniscriptException._(int this.keys); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final keys_lifted = FfiConverterUInt64.read( + Uint8List.view(buf.buffer, new_offset), + ); + final keys = keys_lifted.value; + new_offset += keys_lifted.bytesRead; + return LiftRetVal(MultiATooManyKeysMiniscriptException._(keys), new_offset); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return FfiConverterUInt64.allocationSize(keys) + 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 18); + int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterUInt64.write( + keys, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset; + } + + @override + String toString() { + return "MultiATooManyKeysMiniscriptException($keys)"; + } +} + +class MultiColonMiniscriptException extends MiniscriptException { + MultiColonMiniscriptException(); + MultiColonMiniscriptException._(); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + return LiftRetVal(MultiColonMiniscriptException._(), new_offset); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 19); + int new_offset = buf.offsetInBytes + 4; + return new_offset; + } + + @override + String toString() { + return "MultiColonMiniscriptException"; + } +} + +class MultipathDescLenMismatchMiniscriptException extends MiniscriptException { + MultipathDescLenMismatchMiniscriptException(); + MultipathDescLenMismatchMiniscriptException._(); + static LiftRetVal read( + Uint8List buf, + ) { + int new_offset = buf.offsetInBytes; + return LiftRetVal( + MultipathDescLenMismatchMiniscriptException._(), + new_offset, + ); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 20); + int new_offset = buf.offsetInBytes + 4; + return new_offset; + } + + @override + String toString() { + return "MultipathDescLenMismatchMiniscriptException"; + } +} + +class NonMinimalVerifyMiniscriptException extends MiniscriptException { + final String errorMessage; + NonMinimalVerifyMiniscriptException(String this.errorMessage); + NonMinimalVerifyMiniscriptException._(String this.errorMessage); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final errorMessage_lifted = FfiConverterString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final errorMessage = errorMessage_lifted.value; + new_offset += errorMessage_lifted.bytesRead; + return LiftRetVal( + NonMinimalVerifyMiniscriptException._(errorMessage), + new_offset, + ); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return FfiConverterString.allocationSize(errorMessage) + 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 21); + int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterString.write( + errorMessage, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset; + } + + @override + String toString() { + return "NonMinimalVerifyMiniscriptException($errorMessage)"; + } +} + +class NonStandardBareScriptMiniscriptException extends MiniscriptException { + NonStandardBareScriptMiniscriptException(); + NonStandardBareScriptMiniscriptException._(); + static LiftRetVal read( + Uint8List buf, + ) { + int new_offset = buf.offsetInBytes; + return LiftRetVal(NonStandardBareScriptMiniscriptException._(), new_offset); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 22); + int new_offset = buf.offsetInBytes + 4; + return new_offset; + } + + @override + String toString() { + return "NonStandardBareScriptMiniscriptException"; + } +} + +class NonTopLevelMiniscriptException extends MiniscriptException { + final String errorMessage; + NonTopLevelMiniscriptException(String this.errorMessage); + NonTopLevelMiniscriptException._(String this.errorMessage); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final errorMessage_lifted = FfiConverterString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final errorMessage = errorMessage_lifted.value; + new_offset += errorMessage_lifted.bytesRead; + return LiftRetVal( + NonTopLevelMiniscriptException._(errorMessage), + new_offset, + ); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return FfiConverterString.allocationSize(errorMessage) + 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 23); + int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterString.write( + errorMessage, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset; + } + + @override + String toString() { + return "NonTopLevelMiniscriptException($errorMessage)"; + } +} + +class ParseThresholdMiniscriptException extends MiniscriptException { + ParseThresholdMiniscriptException(); + ParseThresholdMiniscriptException._(); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + return LiftRetVal(ParseThresholdMiniscriptException._(), new_offset); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 24); + int new_offset = buf.offsetInBytes + 4; return new_offset; } @override String toString() { - return "ExpectedCharMiniscriptException($char)"; + return "ParseThresholdMiniscriptException"; } } -class ImpossibleSatisfactionMiniscriptException extends MiniscriptException { - ImpossibleSatisfactionMiniscriptException(); - ImpossibleSatisfactionMiniscriptException._(); - static LiftRetVal read( - Uint8List buf, - ) { +class PolicyExceptionMiniscriptException extends MiniscriptException { + final String errorMessage; + PolicyExceptionMiniscriptException(String this.errorMessage); + PolicyExceptionMiniscriptException._(String this.errorMessage); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; + final errorMessage_lifted = FfiConverterString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final errorMessage = errorMessage_lifted.value; + new_offset += errorMessage_lifted.bytesRead; return LiftRetVal( - ImpossibleSatisfactionMiniscriptException._(), + PolicyExceptionMiniscriptException._(errorMessage), new_offset, ); } @@ -12047,28 +12128,32 @@ class ImpossibleSatisfactionMiniscriptException extends MiniscriptException { @override int allocationSize() { - return 4; + return FfiConverterString.allocationSize(errorMessage) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 12); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 25); int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterString.write( + errorMessage, + Uint8List.view(buf.buffer, new_offset), + ); return new_offset; } @override String toString() { - return "ImpossibleSatisfactionMiniscriptException"; + return "PolicyExceptionMiniscriptException($errorMessage)"; } } -class InvalidOpcodeMiniscriptException extends MiniscriptException { - InvalidOpcodeMiniscriptException(); - InvalidOpcodeMiniscriptException._(); - static LiftRetVal read(Uint8List buf) { +class PubKeyCtxExceptionMiniscriptException extends MiniscriptException { + PubKeyCtxExceptionMiniscriptException(); + PubKeyCtxExceptionMiniscriptException._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(InvalidOpcodeMiniscriptException._(), new_offset); + return LiftRetVal(PubKeyCtxExceptionMiniscriptException._(), new_offset); } @override @@ -12085,23 +12170,23 @@ class InvalidOpcodeMiniscriptException extends MiniscriptException { @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 13); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 26); int new_offset = buf.offsetInBytes + 4; return new_offset; } @override String toString() { - return "InvalidOpcodeMiniscriptException"; + return "PubKeyCtxExceptionMiniscriptException"; } } -class InvalidPushMiniscriptException extends MiniscriptException { - InvalidPushMiniscriptException(); - InvalidPushMiniscriptException._(); - static LiftRetVal read(Uint8List buf) { +class RelativeLockTimeMiniscriptException extends MiniscriptException { + RelativeLockTimeMiniscriptException(); + RelativeLockTimeMiniscriptException._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(InvalidPushMiniscriptException._(), new_offset); + return LiftRetVal(RelativeLockTimeMiniscriptException._(), new_offset); } @override @@ -12118,32 +12203,29 @@ class InvalidPushMiniscriptException extends MiniscriptException { @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 14); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 27); int new_offset = buf.offsetInBytes + 4; return new_offset; } @override String toString() { - return "InvalidPushMiniscriptException"; + return "RelativeLockTimeMiniscriptException"; } } -class LiftExceptionMiniscriptException extends MiniscriptException { +class ScriptMiniscriptException extends MiniscriptException { final String errorMessage; - LiftExceptionMiniscriptException(String this.errorMessage); - LiftExceptionMiniscriptException._(String this.errorMessage); - static LiftRetVal read(Uint8List buf) { + ScriptMiniscriptException(String this.errorMessage); + ScriptMiniscriptException._(String this.errorMessage); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; final errorMessage_lifted = FfiConverterString.read( Uint8List.view(buf.buffer, new_offset), ); final errorMessage = errorMessage_lifted.value; new_offset += errorMessage_lifted.bytesRead; - return LiftRetVal( - LiftExceptionMiniscriptException._(errorMessage), - new_offset, - ); + return LiftRetVal(ScriptMiniscriptException._(errorMessage), new_offset); } @override @@ -12160,7 +12242,7 @@ class LiftExceptionMiniscriptException extends MiniscriptException { @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 15); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 28); int new_offset = buf.offsetInBytes + 4; new_offset += FfiConverterString.write( errorMessage, @@ -12171,21 +12253,22 @@ class LiftExceptionMiniscriptException extends MiniscriptException { @override String toString() { - return "LiftExceptionMiniscriptException($errorMessage)"; + return "ScriptMiniscriptException($errorMessage)"; } } -class MaxRecursiveDepthExceededMiniscriptException extends MiniscriptException { - MaxRecursiveDepthExceededMiniscriptException(); - MaxRecursiveDepthExceededMiniscriptException._(); - static LiftRetVal read( - Uint8List buf, - ) { +class SecpMiniscriptException extends MiniscriptException { + final String errorMessage; + SecpMiniscriptException(String this.errorMessage); + SecpMiniscriptException._(String this.errorMessage); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal( - MaxRecursiveDepthExceededMiniscriptException._(), - new_offset, + final errorMessage_lifted = FfiConverterString.read( + Uint8List.view(buf.buffer, new_offset), ); + final errorMessage = errorMessage_lifted.value; + new_offset += errorMessage_lifted.bytesRead; + return LiftRetVal(SecpMiniscriptException._(errorMessage), new_offset); } @override @@ -12197,28 +12280,32 @@ class MaxRecursiveDepthExceededMiniscriptException extends MiniscriptException { @override int allocationSize() { - return 4; + return FfiConverterString.allocationSize(errorMessage) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 16); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 29); int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterString.write( + errorMessage, + Uint8List.view(buf.buffer, new_offset), + ); return new_offset; } @override String toString() { - return "MaxRecursiveDepthExceededMiniscriptException"; + return "SecpMiniscriptException($errorMessage)"; } } -class MissingSigMiniscriptException extends MiniscriptException { - MissingSigMiniscriptException(); - MissingSigMiniscriptException._(); - static LiftRetVal read(Uint8List buf) { +class ThresholdMiniscriptException extends MiniscriptException { + ThresholdMiniscriptException(); + ThresholdMiniscriptException._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(MissingSigMiniscriptException._(), new_offset); + return LiftRetVal(ThresholdMiniscriptException._(), new_offset); } @override @@ -12235,29 +12322,23 @@ class MissingSigMiniscriptException extends MiniscriptException { @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 17); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 30); int new_offset = buf.offsetInBytes + 4; return new_offset; } @override String toString() { - return "MissingSigMiniscriptException"; + return "ThresholdMiniscriptException"; } } -class MultiATooManyKeysMiniscriptException extends MiniscriptException { - final int keys; - MultiATooManyKeysMiniscriptException(int this.keys); - MultiATooManyKeysMiniscriptException._(int this.keys); - static LiftRetVal read(Uint8List buf) { +class TrNoScriptCodeMiniscriptException extends MiniscriptException { + TrNoScriptCodeMiniscriptException(); + TrNoScriptCodeMiniscriptException._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final keys_lifted = FfiConverterUInt64.read( - Uint8List.view(buf.buffer, new_offset), - ); - final keys = keys_lifted.value; - new_offset += keys_lifted.bytesRead; - return LiftRetVal(MultiATooManyKeysMiniscriptException._(keys), new_offset); + return LiftRetVal(TrNoScriptCodeMiniscriptException._(), new_offset); } @override @@ -12269,32 +12350,34 @@ class MultiATooManyKeysMiniscriptException extends MiniscriptException { @override int allocationSize() { - return FfiConverterUInt64.allocationSize(keys) + 4; + return 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 18); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 31); int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterUInt64.write( - keys, - Uint8List.view(buf.buffer, new_offset), - ); return new_offset; } @override String toString() { - return "MultiATooManyKeysMiniscriptException($keys)"; + return "TrNoScriptCodeMiniscriptException"; } } -class MultiColonMiniscriptException extends MiniscriptException { - MultiColonMiniscriptException(); - MultiColonMiniscriptException._(); - static LiftRetVal read(Uint8List buf) { +class TrailingMiniscriptException extends MiniscriptException { + final String errorMessage; + TrailingMiniscriptException(String this.errorMessage); + TrailingMiniscriptException._(String this.errorMessage); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(MultiColonMiniscriptException._(), new_offset); + final errorMessage_lifted = FfiConverterString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final errorMessage = errorMessage_lifted.value; + new_offset += errorMessage_lifted.bytesRead; + return LiftRetVal(TrailingMiniscriptException._(errorMessage), new_offset); } @override @@ -12306,33 +12389,38 @@ class MultiColonMiniscriptException extends MiniscriptException { @override int allocationSize() { - return 4; + return FfiConverterString.allocationSize(errorMessage) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 19); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 32); int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterString.write( + errorMessage, + Uint8List.view(buf.buffer, new_offset), + ); return new_offset; } @override String toString() { - return "MultiColonMiniscriptException"; + return "TrailingMiniscriptException($errorMessage)"; } } -class MultipathDescLenMismatchMiniscriptException extends MiniscriptException { - MultipathDescLenMismatchMiniscriptException(); - MultipathDescLenMismatchMiniscriptException._(); - static LiftRetVal read( - Uint8List buf, - ) { +class TypeCheckMiniscriptException extends MiniscriptException { + final String errorMessage; + TypeCheckMiniscriptException(String this.errorMessage); + TypeCheckMiniscriptException._(String this.errorMessage); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal( - MultipathDescLenMismatchMiniscriptException._(), - new_offset, + final errorMessage_lifted = FfiConverterString.read( + Uint8List.view(buf.buffer, new_offset), ); + final errorMessage = errorMessage_lifted.value; + new_offset += errorMessage_lifted.bytesRead; + return LiftRetVal(TypeCheckMiniscriptException._(errorMessage), new_offset); } @override @@ -12344,27 +12432,31 @@ class MultipathDescLenMismatchMiniscriptException extends MiniscriptException { @override int allocationSize() { - return 4; + return FfiConverterString.allocationSize(errorMessage) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 20); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 33); int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterString.write( + errorMessage, + Uint8List.view(buf.buffer, new_offset), + ); return new_offset; } @override String toString() { - return "MultipathDescLenMismatchMiniscriptException"; + return "TypeCheckMiniscriptException($errorMessage)"; } } -class NonMinimalVerifyMiniscriptException extends MiniscriptException { +class UnexpectedMiniscriptException extends MiniscriptException { final String errorMessage; - NonMinimalVerifyMiniscriptException(String this.errorMessage); - NonMinimalVerifyMiniscriptException._(String this.errorMessage); - static LiftRetVal read(Uint8List buf) { + UnexpectedMiniscriptException(String this.errorMessage); + UnexpectedMiniscriptException._(String this.errorMessage); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; final errorMessage_lifted = FfiConverterString.read( Uint8List.view(buf.buffer, new_offset), @@ -12372,7 +12464,7 @@ class NonMinimalVerifyMiniscriptException extends MiniscriptException { final errorMessage = errorMessage_lifted.value; new_offset += errorMessage_lifted.bytesRead; return LiftRetVal( - NonMinimalVerifyMiniscriptException._(errorMessage), + UnexpectedMiniscriptException._(errorMessage), new_offset, ); } @@ -12391,7 +12483,7 @@ class NonMinimalVerifyMiniscriptException extends MiniscriptException { @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 21); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 34); int new_offset = buf.offsetInBytes + 4; new_offset += FfiConverterString.write( errorMessage, @@ -12402,18 +12494,16 @@ class NonMinimalVerifyMiniscriptException extends MiniscriptException { @override String toString() { - return "NonMinimalVerifyMiniscriptException($errorMessage)"; + return "UnexpectedMiniscriptException($errorMessage)"; } } -class NonStandardBareScriptMiniscriptException extends MiniscriptException { - NonStandardBareScriptMiniscriptException(); - NonStandardBareScriptMiniscriptException._(); - static LiftRetVal read( - Uint8List buf, - ) { +class UnexpectedStartMiniscriptException extends MiniscriptException { + UnexpectedStartMiniscriptException(); + UnexpectedStartMiniscriptException._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(NonStandardBareScriptMiniscriptException._(), new_offset); + return LiftRetVal(UnexpectedStartMiniscriptException._(), new_offset); } @override @@ -12430,32 +12520,29 @@ class NonStandardBareScriptMiniscriptException extends MiniscriptException { @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 22); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 35); int new_offset = buf.offsetInBytes + 4; return new_offset; } @override String toString() { - return "NonStandardBareScriptMiniscriptException"; + return "UnexpectedStartMiniscriptException"; } } -class NonTopLevelMiniscriptException extends MiniscriptException { - final String errorMessage; - NonTopLevelMiniscriptException(String this.errorMessage); - NonTopLevelMiniscriptException._(String this.errorMessage); - static LiftRetVal read(Uint8List buf) { +class UnknownWrapperMiniscriptException extends MiniscriptException { + final String char; + UnknownWrapperMiniscriptException(String this.char); + UnknownWrapperMiniscriptException._(String this.char); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final errorMessage_lifted = FfiConverterString.read( + final char_lifted = FfiConverterString.read( Uint8List.view(buf.buffer, new_offset), ); - final errorMessage = errorMessage_lifted.value; - new_offset += errorMessage_lifted.bytesRead; - return LiftRetVal( - NonTopLevelMiniscriptException._(errorMessage), - new_offset, - ); + final char = char_lifted.value; + new_offset += char_lifted.bytesRead; + return LiftRetVal(UnknownWrapperMiniscriptException._(char), new_offset); } @override @@ -12467,15 +12554,15 @@ class NonTopLevelMiniscriptException extends MiniscriptException { @override int allocationSize() { - return FfiConverterString.allocationSize(errorMessage) + 4; + return FfiConverterString.allocationSize(char) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 23); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 36); int new_offset = buf.offsetInBytes + 4; new_offset += FfiConverterString.write( - errorMessage, + char, Uint8List.view(buf.buffer, new_offset), ); return new_offset; @@ -12483,16 +12570,22 @@ class NonTopLevelMiniscriptException extends MiniscriptException { @override String toString() { - return "NonTopLevelMiniscriptException($errorMessage)"; + return "UnknownWrapperMiniscriptException($char)"; } } -class ParseThresholdMiniscriptException extends MiniscriptException { - ParseThresholdMiniscriptException(); - ParseThresholdMiniscriptException._(); - static LiftRetVal read(Uint8List buf) { +class UnprintableMiniscriptException extends MiniscriptException { + final int byte; + UnprintableMiniscriptException(int this.byte); + UnprintableMiniscriptException._(int this.byte); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(ParseThresholdMiniscriptException._(), new_offset); + final byte_lifted = FfiConverterUInt8.read( + Uint8List.view(buf.buffer, new_offset), + ); + final byte = byte_lifted.value; + new_offset += byte_lifted.bytesRead; + return LiftRetVal(UnprintableMiniscriptException._(byte), new_offset); } @override @@ -12504,74 +12597,114 @@ class ParseThresholdMiniscriptException extends MiniscriptException { @override int allocationSize() { - return 4; + return FfiConverterUInt8.allocationSize(byte) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 24); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 37); int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterUInt8.write( + byte, + Uint8List.view(buf.buffer, new_offset), + ); return new_offset; } @override String toString() { - return "ParseThresholdMiniscriptException"; + return "UnprintableMiniscriptException($byte)"; } } -class PolicyExceptionMiniscriptException extends MiniscriptException { - final String errorMessage; - PolicyExceptionMiniscriptException(String this.errorMessage); - PolicyExceptionMiniscriptException._(String this.errorMessage); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final errorMessage_lifted = FfiConverterString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final errorMessage = errorMessage_lifted.value; - new_offset += errorMessage_lifted.bytesRead; - return LiftRetVal( - PolicyExceptionMiniscriptException._(errorMessage), - new_offset, - ); +class MiniscriptExceptionErrorHandler extends UniffiRustCallStatusErrorHandler { + @override + Exception lift(RustBuffer errorBuf) { + return FfiConverterMiniscriptException.lift(errorBuf); } +} - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); +final MiniscriptExceptionErrorHandler miniscriptExceptionErrorHandler = + MiniscriptExceptionErrorHandler(); + +abstract class ParseAmountException implements Exception { + RustBuffer lower(); + int allocationSize(); + int write(Uint8List buf); +} + +class FfiConverterParseAmountException { + static ParseAmountException lift(RustBuffer buffer) { + return FfiConverterParseAmountException.read(buffer.asUint8List()).value; } - @override - int allocationSize() { - return FfiConverterString.allocationSize(errorMessage) + 4; + static LiftRetVal read(Uint8List buf) { + final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); + final subview = Uint8List.view(buf.buffer, buf.offsetInBytes + 4); + switch (index) { + case 1: + final lifted = OutOfRangeParseAmountException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 2: + final lifted = TooPreciseParseAmountException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 3: + final lifted = MissingDigitsParseAmountException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 4: + final lifted = InputTooLargeParseAmountException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 5: + final lifted = InvalidCharacterParseAmountException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 6: + final lifted = OtherParseAmountErrParseAmountException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + default: + throw UniffiInternalError( + UniffiInternalError.unexpectedEnumCase, + "Unable to determine enum variant", + ); + } } - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 25); - int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - errorMessage, - Uint8List.view(buf.buffer, new_offset), - ); - return new_offset; + static RustBuffer lower(ParseAmountException value) { + return value.lower(); } - @override - String toString() { - return "PolicyExceptionMiniscriptException($errorMessage)"; + static int allocationSize(ParseAmountException value) { + return value.allocationSize(); + } + + static int write(ParseAmountException value, Uint8List buf) { + return value.write(buf) - buf.offsetInBytes; } } -class PubKeyCtxExceptionMiniscriptException extends MiniscriptException { - PubKeyCtxExceptionMiniscriptException(); - PubKeyCtxExceptionMiniscriptException._(); - static LiftRetVal read(Uint8List buf) { +class OutOfRangeParseAmountException extends ParseAmountException { + OutOfRangeParseAmountException(); + OutOfRangeParseAmountException._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(PubKeyCtxExceptionMiniscriptException._(), new_offset); + return LiftRetVal(OutOfRangeParseAmountException._(), new_offset); } @override @@ -12588,23 +12721,23 @@ class PubKeyCtxExceptionMiniscriptException extends MiniscriptException { @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 26); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); int new_offset = buf.offsetInBytes + 4; return new_offset; } @override String toString() { - return "PubKeyCtxExceptionMiniscriptException"; + return "OutOfRangeParseAmountException"; } } -class RelativeLockTimeMiniscriptException extends MiniscriptException { - RelativeLockTimeMiniscriptException(); - RelativeLockTimeMiniscriptException._(); - static LiftRetVal read(Uint8List buf) { +class TooPreciseParseAmountException extends ParseAmountException { + TooPreciseParseAmountException(); + TooPreciseParseAmountException._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(RelativeLockTimeMiniscriptException._(), new_offset); + return LiftRetVal(TooPreciseParseAmountException._(), new_offset); } @override @@ -12621,29 +12754,23 @@ class RelativeLockTimeMiniscriptException extends MiniscriptException { @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 27); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 2); int new_offset = buf.offsetInBytes + 4; return new_offset; } @override String toString() { - return "RelativeLockTimeMiniscriptException"; + return "TooPreciseParseAmountException"; } } -class ScriptMiniscriptException extends MiniscriptException { - final String errorMessage; - ScriptMiniscriptException(String this.errorMessage); - ScriptMiniscriptException._(String this.errorMessage); - static LiftRetVal read(Uint8List buf) { +class MissingDigitsParseAmountException extends ParseAmountException { + MissingDigitsParseAmountException(); + MissingDigitsParseAmountException._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final errorMessage_lifted = FfiConverterString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final errorMessage = errorMessage_lifted.value; - new_offset += errorMessage_lifted.bytesRead; - return LiftRetVal(ScriptMiniscriptException._(errorMessage), new_offset); + return LiftRetVal(MissingDigitsParseAmountException._(), new_offset); } @override @@ -12655,38 +12782,28 @@ class ScriptMiniscriptException extends MiniscriptException { @override int allocationSize() { - return FfiConverterString.allocationSize(errorMessage) + 4; + return 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 28); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 3); int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - errorMessage, - Uint8List.view(buf.buffer, new_offset), - ); return new_offset; } @override String toString() { - return "ScriptMiniscriptException($errorMessage)"; + return "MissingDigitsParseAmountException"; } } -class SecpMiniscriptException extends MiniscriptException { - final String errorMessage; - SecpMiniscriptException(String this.errorMessage); - SecpMiniscriptException._(String this.errorMessage); - static LiftRetVal read(Uint8List buf) { +class InputTooLargeParseAmountException extends ParseAmountException { + InputTooLargeParseAmountException(); + InputTooLargeParseAmountException._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final errorMessage_lifted = FfiConverterString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final errorMessage = errorMessage_lifted.value; - new_offset += errorMessage_lifted.bytesRead; - return LiftRetVal(SecpMiniscriptException._(errorMessage), new_offset); + return LiftRetVal(InputTooLargeParseAmountException._(), new_offset); } @override @@ -12698,32 +12815,37 @@ class SecpMiniscriptException extends MiniscriptException { @override int allocationSize() { - return FfiConverterString.allocationSize(errorMessage) + 4; + return 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 29); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 4); int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - errorMessage, - Uint8List.view(buf.buffer, new_offset), - ); return new_offset; } @override String toString() { - return "SecpMiniscriptException($errorMessage)"; + return "InputTooLargeParseAmountException"; } } -class ThresholdMiniscriptException extends MiniscriptException { - ThresholdMiniscriptException(); - ThresholdMiniscriptException._(); - static LiftRetVal read(Uint8List buf) { +class InvalidCharacterParseAmountException extends ParseAmountException { + final String errorMessage; + InvalidCharacterParseAmountException(String this.errorMessage); + InvalidCharacterParseAmountException._(String this.errorMessage); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(ThresholdMiniscriptException._(), new_offset); + final errorMessage_lifted = FfiConverterString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final errorMessage = errorMessage_lifted.value; + new_offset += errorMessage_lifted.bytesRead; + return LiftRetVal( + InvalidCharacterParseAmountException._(errorMessage), + new_offset, + ); } @override @@ -12735,28 +12857,34 @@ class ThresholdMiniscriptException extends MiniscriptException { @override int allocationSize() { - return 4; + return FfiConverterString.allocationSize(errorMessage) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 30); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 5); int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterString.write( + errorMessage, + Uint8List.view(buf.buffer, new_offset), + ); return new_offset; } @override String toString() { - return "ThresholdMiniscriptException"; + return "InvalidCharacterParseAmountException($errorMessage)"; } } -class TrNoScriptCodeMiniscriptException extends MiniscriptException { - TrNoScriptCodeMiniscriptException(); - TrNoScriptCodeMiniscriptException._(); - static LiftRetVal read(Uint8List buf) { +class OtherParseAmountErrParseAmountException extends ParseAmountException { + OtherParseAmountErrParseAmountException(); + OtherParseAmountErrParseAmountException._(); + static LiftRetVal read( + Uint8List buf, + ) { int new_offset = buf.offsetInBytes; - return LiftRetVal(TrNoScriptCodeMiniscriptException._(), new_offset); + return LiftRetVal(OtherParseAmountErrParseAmountException._(), new_offset); } @override @@ -12773,29 +12901,82 @@ class TrNoScriptCodeMiniscriptException extends MiniscriptException { @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 31); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 6); int new_offset = buf.offsetInBytes + 4; return new_offset; } @override String toString() { - return "TrNoScriptCodeMiniscriptException"; + return "OtherParseAmountErrParseAmountException"; } } -class TrailingMiniscriptException extends MiniscriptException { +class ParseAmountExceptionErrorHandler + extends UniffiRustCallStatusErrorHandler { + @override + Exception lift(RustBuffer errorBuf) { + return FfiConverterParseAmountException.lift(errorBuf); + } +} + +final ParseAmountExceptionErrorHandler parseAmountExceptionErrorHandler = + ParseAmountExceptionErrorHandler(); + +abstract class PersistenceException implements Exception { + RustBuffer lower(); + int allocationSize(); + int write(Uint8List buf); +} + +class FfiConverterPersistenceException { + static PersistenceException lift(RustBuffer buffer) { + return FfiConverterPersistenceException.read(buffer.asUint8List()).value; + } + + static LiftRetVal read(Uint8List buf) { + final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); + final subview = Uint8List.view(buf.buffer, buf.offsetInBytes + 4); + switch (index) { + case 1: + final lifted = ReasonPersistenceException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + default: + throw UniffiInternalError( + UniffiInternalError.unexpectedEnumCase, + "Unable to determine enum variant", + ); + } + } + + static RustBuffer lower(PersistenceException value) { + return value.lower(); + } + + static int allocationSize(PersistenceException value) { + return value.allocationSize(); + } + + static int write(PersistenceException value, Uint8List buf) { + return value.write(buf) - buf.offsetInBytes; + } +} + +class ReasonPersistenceException extends PersistenceException { final String errorMessage; - TrailingMiniscriptException(String this.errorMessage); - TrailingMiniscriptException._(String this.errorMessage); - static LiftRetVal read(Uint8List buf) { + ReasonPersistenceException(String this.errorMessage); + ReasonPersistenceException._(String this.errorMessage); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; final errorMessage_lifted = FfiConverterString.read( Uint8List.view(buf.buffer, new_offset), ); final errorMessage = errorMessage_lifted.value; new_offset += errorMessage_lifted.bytesRead; - return LiftRetVal(TrailingMiniscriptException._(errorMessage), new_offset); + return LiftRetVal(ReasonPersistenceException._(errorMessage), new_offset); } @override @@ -12812,7 +12993,7 @@ class TrailingMiniscriptException extends MiniscriptException { @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 32); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); int new_offset = buf.offsetInBytes + 4; new_offset += FfiConverterString.write( errorMessage, @@ -12823,22 +13004,87 @@ class TrailingMiniscriptException extends MiniscriptException { @override String toString() { - return "TrailingMiniscriptException($errorMessage)"; + return "ReasonPersistenceException($errorMessage)"; } } -class TypeCheckMiniscriptException extends MiniscriptException { - final String errorMessage; - TypeCheckMiniscriptException(String this.errorMessage); - TypeCheckMiniscriptException._(String this.errorMessage); - static LiftRetVal read(Uint8List buf) { +class PersistenceExceptionErrorHandler + extends UniffiRustCallStatusErrorHandler { + @override + Exception lift(RustBuffer errorBuf) { + return FfiConverterPersistenceException.lift(errorBuf); + } +} + +final PersistenceExceptionErrorHandler persistenceExceptionErrorHandler = + PersistenceExceptionErrorHandler(); + +abstract class PreV1MigrationException implements Exception { + RustBuffer lower(); + int allocationSize(); + int write(Uint8List buf); +} + +class FfiConverterPreV1MigrationException { + static PreV1MigrationException lift(RustBuffer buffer) { + return FfiConverterPreV1MigrationException.read(buffer.asUint8List()).value; + } + + static LiftRetVal read(Uint8List buf) { + final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); + final subview = Uint8List.view(buf.buffer, buf.offsetInBytes + 4); + switch (index) { + case 1: + final lifted = SqliteOnlyPreV1MigrationException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 2: + final lifted = SqlitePreV1MigrationException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 3: + final lifted = InvalidKeychainPreV1MigrationException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 4: + final lifted = InvalidChecksumPreV1MigrationException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + default: + throw UniffiInternalError( + UniffiInternalError.unexpectedEnumCase, + "Unable to determine enum variant", + ); + } + } + + static RustBuffer lower(PreV1MigrationException value) { + return value.lower(); + } + + static int allocationSize(PreV1MigrationException value) { + return value.allocationSize(); + } + + static int write(PreV1MigrationException value, Uint8List buf) { + return value.write(buf) - buf.offsetInBytes; + } +} + +class SqliteOnlyPreV1MigrationException extends PreV1MigrationException { + SqliteOnlyPreV1MigrationException(); + SqliteOnlyPreV1MigrationException._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final errorMessage_lifted = FfiConverterString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final errorMessage = errorMessage_lifted.value; - new_offset += errorMessage_lifted.bytesRead; - return LiftRetVal(TypeCheckMiniscriptException._(errorMessage), new_offset); + return LiftRetVal(SqliteOnlyPreV1MigrationException._(), new_offset); } @override @@ -12850,31 +13096,27 @@ class TypeCheckMiniscriptException extends MiniscriptException { @override int allocationSize() { - return FfiConverterString.allocationSize(errorMessage) + 4; + return 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 33); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - errorMessage, - Uint8List.view(buf.buffer, new_offset), - ); return new_offset; } @override String toString() { - return "TypeCheckMiniscriptException($errorMessage)"; + return "SqliteOnlyPreV1MigrationException"; } } -class UnexpectedMiniscriptException extends MiniscriptException { +class SqlitePreV1MigrationException extends PreV1MigrationException { final String errorMessage; - UnexpectedMiniscriptException(String this.errorMessage); - UnexpectedMiniscriptException._(String this.errorMessage); - static LiftRetVal read(Uint8List buf) { + SqlitePreV1MigrationException(String this.errorMessage); + SqlitePreV1MigrationException._(String this.errorMessage); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; final errorMessage_lifted = FfiConverterString.read( Uint8List.view(buf.buffer, new_offset), @@ -12882,7 +13124,7 @@ class UnexpectedMiniscriptException extends MiniscriptException { final errorMessage = errorMessage_lifted.value; new_offset += errorMessage_lifted.bytesRead; return LiftRetVal( - UnexpectedMiniscriptException._(errorMessage), + SqlitePreV1MigrationException._(errorMessage), new_offset, ); } @@ -12901,7 +13143,7 @@ class UnexpectedMiniscriptException extends MiniscriptException { @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 34); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 2); int new_offset = buf.offsetInBytes + 4; new_offset += FfiConverterString.write( errorMessage, @@ -12912,55 +13154,27 @@ class UnexpectedMiniscriptException extends MiniscriptException { @override String toString() { - return "UnexpectedMiniscriptException($errorMessage)"; - } -} - -class UnexpectedStartMiniscriptException extends MiniscriptException { - UnexpectedStartMiniscriptException(); - UnexpectedStartMiniscriptException._(); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - return LiftRetVal(UnexpectedStartMiniscriptException._(), new_offset); - } - - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); - } - - @override - int allocationSize() { - return 4; - } - - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 35); - int new_offset = buf.offsetInBytes + 4; - return new_offset; - } - - @override - String toString() { - return "UnexpectedStartMiniscriptException"; + return "SqlitePreV1MigrationException($errorMessage)"; } } -class UnknownWrapperMiniscriptException extends MiniscriptException { - final String char; - UnknownWrapperMiniscriptException(String this.char); - UnknownWrapperMiniscriptException._(String this.char); - static LiftRetVal read(Uint8List buf) { +class InvalidKeychainPreV1MigrationException extends PreV1MigrationException { + final String keychain; + InvalidKeychainPreV1MigrationException(String this.keychain); + InvalidKeychainPreV1MigrationException._(String this.keychain); + static LiftRetVal read( + Uint8List buf, + ) { int new_offset = buf.offsetInBytes; - final char_lifted = FfiConverterString.read( + final keychain_lifted = FfiConverterString.read( Uint8List.view(buf.buffer, new_offset), ); - final char = char_lifted.value; - new_offset += char_lifted.bytesRead; - return LiftRetVal(UnknownWrapperMiniscriptException._(char), new_offset); + final keychain = keychain_lifted.value; + new_offset += keychain_lifted.bytesRead; + return LiftRetVal( + InvalidKeychainPreV1MigrationException._(keychain), + new_offset, + ); } @override @@ -12972,15 +13186,15 @@ class UnknownWrapperMiniscriptException extends MiniscriptException { @override int allocationSize() { - return FfiConverterString.allocationSize(char) + 4; + return FfiConverterString.allocationSize(keychain) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 36); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 3); int new_offset = buf.offsetInBytes + 4; new_offset += FfiConverterString.write( - char, + keychain, Uint8List.view(buf.buffer, new_offset), ); return new_offset; @@ -12988,22 +13202,27 @@ class UnknownWrapperMiniscriptException extends MiniscriptException { @override String toString() { - return "UnknownWrapperMiniscriptException($char)"; + return "InvalidKeychainPreV1MigrationException($keychain)"; } } -class UnprintableMiniscriptException extends MiniscriptException { - final int byte; - UnprintableMiniscriptException(int this.byte); - UnprintableMiniscriptException._(int this.byte); - static LiftRetVal read(Uint8List buf) { +class InvalidChecksumPreV1MigrationException extends PreV1MigrationException { + final String errorMessage; + InvalidChecksumPreV1MigrationException(String this.errorMessage); + InvalidChecksumPreV1MigrationException._(String this.errorMessage); + static LiftRetVal read( + Uint8List buf, + ) { int new_offset = buf.offsetInBytes; - final byte_lifted = FfiConverterUInt8.read( + final errorMessage_lifted = FfiConverterString.read( Uint8List.view(buf.buffer, new_offset), ); - final byte = byte_lifted.value; - new_offset += byte_lifted.bytesRead; - return LiftRetVal(UnprintableMiniscriptException._(byte), new_offset); + final errorMessage = errorMessage_lifted.value; + new_offset += errorMessage_lifted.bytesRead; + return LiftRetVal( + InvalidChecksumPreV1MigrationException._(errorMessage), + new_offset, + ); } @override @@ -13015,15 +13234,15 @@ class UnprintableMiniscriptException extends MiniscriptException { @override int allocationSize() { - return FfiConverterUInt8.allocationSize(byte) + 4; + return FfiConverterString.allocationSize(errorMessage) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 37); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 4); int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterUInt8.write( - byte, + new_offset += FfiConverterString.write( + errorMessage, Uint8List.view(buf.buffer, new_offset), ); return new_offset; @@ -13031,146 +13250,231 @@ class UnprintableMiniscriptException extends MiniscriptException { @override String toString() { - return "UnprintableMiniscriptException($byte)"; + return "InvalidChecksumPreV1MigrationException($errorMessage)"; } } -class MiniscriptExceptionErrorHandler extends UniffiRustCallStatusErrorHandler { +class PreV1MigrationExceptionErrorHandler + extends UniffiRustCallStatusErrorHandler { @override Exception lift(RustBuffer errorBuf) { - return FfiConverterMiniscriptException.lift(errorBuf); - } -} - -final MiniscriptExceptionErrorHandler miniscriptExceptionErrorHandler = - MiniscriptExceptionErrorHandler(); - -enum Network { bitcoin, testnet, testnet4, signet, regtest } - -class FfiConverterNetwork { - static LiftRetVal read(Uint8List buf) { - final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); - switch (index) { - case 1: - return LiftRetVal(Network.bitcoin, 4); - case 2: - return LiftRetVal(Network.testnet, 4); - case 3: - return LiftRetVal(Network.testnet4, 4); - case 4: - return LiftRetVal(Network.signet, 4); - case 5: - return LiftRetVal(Network.regtest, 4); - default: - throw UniffiInternalError( - UniffiInternalError.unexpectedEnumCase, - "Unable to determine enum variant", - ); - } - } - - static Network lift(RustBuffer buffer) { - return FfiConverterNetwork.read(buffer.asUint8List()).value; - } - - static RustBuffer lower(Network input) { - return toRustBuffer(createUint8ListFromInt(input.index + 1)); - } - - static int allocationSize(Network _value) { - return 4; - } - - static int write(Network value, Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, value.index + 1); - return 4; + return FfiConverterPreV1MigrationException.lift(errorBuf); } } -enum NetworkKind { main, test } - -class FfiConverterNetworkKind { - static LiftRetVal read(Uint8List buf) { - final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); - switch (index) { - case 1: - return LiftRetVal(NetworkKind.main, 4); - case 2: - return LiftRetVal(NetworkKind.test, 4); - default: - throw UniffiInternalError( - UniffiInternalError.unexpectedEnumCase, - "Unable to determine enum variant", - ); - } - } - - static NetworkKind lift(RustBuffer buffer) { - return FfiConverterNetworkKind.read(buffer.asUint8List()).value; - } - - static RustBuffer lower(NetworkKind input) { - return toRustBuffer(createUint8ListFromInt(input.index + 1)); - } - - static int allocationSize(NetworkKind _value) { - return 4; - } - - static int write(NetworkKind value, Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, value.index + 1); - return 4; - } -} +final PreV1MigrationExceptionErrorHandler preV1MigrationExceptionErrorHandler = + PreV1MigrationExceptionErrorHandler(); -abstract class ParseAmountException implements Exception { +abstract class PsbtException implements Exception { RustBuffer lower(); int allocationSize(); int write(Uint8List buf); } -class FfiConverterParseAmountException { - static ParseAmountException lift(RustBuffer buffer) { - return FfiConverterParseAmountException.read(buffer.asUint8List()).value; +class FfiConverterPsbtException { + static PsbtException lift(RustBuffer buffer) { + return FfiConverterPsbtException.read(buffer.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); final subview = Uint8List.view(buf.buffer, buf.offsetInBytes + 4); switch (index) { case 1: - final lifted = OutOfRangeParseAmountException.read(subview); - return LiftRetVal( + final lifted = InvalidMagicPsbtException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 2: + final lifted = MissingUtxoPsbtException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 3: + final lifted = InvalidSeparatorPsbtException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 4: + final lifted = PsbtUtxoOutOfBoundsPsbtException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 5: + final lifted = InvalidKeyPsbtException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 6: + final lifted = InvalidProprietaryKeyPsbtException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 7: + final lifted = DuplicateKeyPsbtException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 8: + final lifted = UnsignedTxHasScriptSigsPsbtException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 9: + final lifted = UnsignedTxHasScriptWitnessesPsbtException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 10: + final lifted = MustHaveUnsignedTxPsbtException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 11: + final lifted = NoMorePairsPsbtException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 12: + final lifted = UnexpectedUnsignedTxPsbtException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 13: + final lifted = NonStandardSighashTypePsbtException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 14: + final lifted = InvalidHashPsbtException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 15: + final lifted = InvalidPreimageHashPairPsbtException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 16: + final lifted = CombineInconsistentKeySourcesPsbtException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 17: + final lifted = ConsensusEncodingPsbtException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 18: + final lifted = NegativeFeePsbtException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 19: + final lifted = FeeOverflowPsbtException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 20: + final lifted = InvalidPublicKeyPsbtException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 21: + final lifted = InvalidSecp256k1PublicKeyPsbtException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 22: + final lifted = InvalidXOnlyPublicKeyPsbtException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 23: + final lifted = InvalidEcdsaSignaturePsbtException.read(subview); + return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); - case 2: - final lifted = TooPreciseParseAmountException.read(subview); - return LiftRetVal( + case 24: + final lifted = InvalidTaprootSignaturePsbtException.read(subview); + return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); - case 3: - final lifted = MissingDigitsParseAmountException.read(subview); - return LiftRetVal( + case 25: + final lifted = InvalidControlBlockPsbtException.read(subview); + return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); - case 4: - final lifted = InputTooLargeParseAmountException.read(subview); - return LiftRetVal( + case 26: + final lifted = InvalidLeafVersionPsbtException.read(subview); + return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); - case 5: - final lifted = InvalidCharacterParseAmountException.read(subview); - return LiftRetVal( + case 27: + final lifted = TaprootPsbtException.read(subview); + return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); - case 6: - final lifted = OtherParseAmountErrParseAmountException.read(subview); - return LiftRetVal( + case 28: + final lifted = TapTreePsbtException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 29: + final lifted = XPubKeyPsbtException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 30: + final lifted = VersionPsbtException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 31: + final lifted = PartialDataConsumptionPsbtException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 32: + final lifted = IoPsbtException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 33: + final lifted = OtherPsbtErrPsbtException.read(subview); + return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); @@ -13182,25 +13486,25 @@ class FfiConverterParseAmountException { } } - static RustBuffer lower(ParseAmountException value) { + static RustBuffer lower(PsbtException value) { return value.lower(); } - static int allocationSize(ParseAmountException value) { + static int allocationSize(PsbtException value) { return value.allocationSize(); } - static int write(ParseAmountException value, Uint8List buf) { + static int write(PsbtException value, Uint8List buf) { return value.write(buf) - buf.offsetInBytes; } } -class OutOfRangeParseAmountException extends ParseAmountException { - OutOfRangeParseAmountException(); - OutOfRangeParseAmountException._(); - static LiftRetVal read(Uint8List buf) { +class InvalidMagicPsbtException extends PsbtException { + InvalidMagicPsbtException(); + InvalidMagicPsbtException._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(OutOfRangeParseAmountException._(), new_offset); + return LiftRetVal(InvalidMagicPsbtException._(), new_offset); } @override @@ -13224,16 +13528,16 @@ class OutOfRangeParseAmountException extends ParseAmountException { @override String toString() { - return "OutOfRangeParseAmountException"; + return "InvalidMagicPsbtException"; } } -class TooPreciseParseAmountException extends ParseAmountException { - TooPreciseParseAmountException(); - TooPreciseParseAmountException._(); - static LiftRetVal read(Uint8List buf) { +class MissingUtxoPsbtException extends PsbtException { + MissingUtxoPsbtException(); + MissingUtxoPsbtException._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(TooPreciseParseAmountException._(), new_offset); + return LiftRetVal(MissingUtxoPsbtException._(), new_offset); } @override @@ -13257,16 +13561,16 @@ class TooPreciseParseAmountException extends ParseAmountException { @override String toString() { - return "TooPreciseParseAmountException"; + return "MissingUtxoPsbtException"; } } -class MissingDigitsParseAmountException extends ParseAmountException { - MissingDigitsParseAmountException(); - MissingDigitsParseAmountException._(); - static LiftRetVal read(Uint8List buf) { +class InvalidSeparatorPsbtException extends PsbtException { + InvalidSeparatorPsbtException(); + InvalidSeparatorPsbtException._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(MissingDigitsParseAmountException._(), new_offset); + return LiftRetVal(InvalidSeparatorPsbtException._(), new_offset); } @override @@ -13290,16 +13594,16 @@ class MissingDigitsParseAmountException extends ParseAmountException { @override String toString() { - return "MissingDigitsParseAmountException"; + return "InvalidSeparatorPsbtException"; } } -class InputTooLargeParseAmountException extends ParseAmountException { - InputTooLargeParseAmountException(); - InputTooLargeParseAmountException._(); - static LiftRetVal read(Uint8List buf) { +class PsbtUtxoOutOfBoundsPsbtException extends PsbtException { + PsbtUtxoOutOfBoundsPsbtException(); + PsbtUtxoOutOfBoundsPsbtException._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(InputTooLargeParseAmountException._(), new_offset); + return LiftRetVal(PsbtUtxoOutOfBoundsPsbtException._(), new_offset); } @override @@ -13323,25 +13627,22 @@ class InputTooLargeParseAmountException extends ParseAmountException { @override String toString() { - return "InputTooLargeParseAmountException"; + return "PsbtUtxoOutOfBoundsPsbtException"; } } -class InvalidCharacterParseAmountException extends ParseAmountException { - final String errorMessage; - InvalidCharacterParseAmountException(String this.errorMessage); - InvalidCharacterParseAmountException._(String this.errorMessage); - static LiftRetVal read(Uint8List buf) { +class InvalidKeyPsbtException extends PsbtException { + final String key; + InvalidKeyPsbtException(String this.key); + InvalidKeyPsbtException._(String this.key); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final errorMessage_lifted = FfiConverterString.read( + final key_lifted = FfiConverterString.read( Uint8List.view(buf.buffer, new_offset), ); - final errorMessage = errorMessage_lifted.value; - new_offset += errorMessage_lifted.bytesRead; - return LiftRetVal( - InvalidCharacterParseAmountException._(errorMessage), - new_offset, - ); + final key = key_lifted.value; + new_offset += key_lifted.bytesRead; + return LiftRetVal(InvalidKeyPsbtException._(key), new_offset); } @override @@ -13353,7 +13654,7 @@ class InvalidCharacterParseAmountException extends ParseAmountException { @override int allocationSize() { - return FfiConverterString.allocationSize(errorMessage) + 4; + return FfiConverterString.allocationSize(key) + 4; } @override @@ -13361,7 +13662,7 @@ class InvalidCharacterParseAmountException extends ParseAmountException { buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 5); int new_offset = buf.offsetInBytes + 4; new_offset += FfiConverterString.write( - errorMessage, + key, Uint8List.view(buf.buffer, new_offset), ); return new_offset; @@ -13369,18 +13670,16 @@ class InvalidCharacterParseAmountException extends ParseAmountException { @override String toString() { - return "InvalidCharacterParseAmountException($errorMessage)"; + return "InvalidKeyPsbtException($key)"; } } -class OtherParseAmountErrParseAmountException extends ParseAmountException { - OtherParseAmountErrParseAmountException(); - OtherParseAmountErrParseAmountException._(); - static LiftRetVal read( - Uint8List buf, - ) { +class InvalidProprietaryKeyPsbtException extends PsbtException { + InvalidProprietaryKeyPsbtException(); + InvalidProprietaryKeyPsbtException._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(OtherParseAmountErrParseAmountException._(), new_offset); + return LiftRetVal(InvalidProprietaryKeyPsbtException._(), new_offset); } @override @@ -13404,75 +13703,97 @@ class OtherParseAmountErrParseAmountException extends ParseAmountException { @override String toString() { - return "OtherParseAmountErrParseAmountException"; + return "InvalidProprietaryKeyPsbtException"; } } -class ParseAmountExceptionErrorHandler - extends UniffiRustCallStatusErrorHandler { +class DuplicateKeyPsbtException extends PsbtException { + final String key; + DuplicateKeyPsbtException(String this.key); + DuplicateKeyPsbtException._(String this.key); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final key_lifted = FfiConverterString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final key = key_lifted.value; + new_offset += key_lifted.bytesRead; + return LiftRetVal(DuplicateKeyPsbtException._(key), new_offset); + } + @override - Exception lift(RustBuffer errorBuf) { - return FfiConverterParseAmountException.lift(errorBuf); + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); } -} -final ParseAmountExceptionErrorHandler parseAmountExceptionErrorHandler = - ParseAmountExceptionErrorHandler(); + @override + int allocationSize() { + return FfiConverterString.allocationSize(key) + 4; + } -abstract class PersistenceException implements Exception { - RustBuffer lower(); - int allocationSize(); - int write(Uint8List buf); + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 7); + int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterString.write( + key, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset; + } + + @override + String toString() { + return "DuplicateKeyPsbtException($key)"; + } } -class FfiConverterPersistenceException { - static PersistenceException lift(RustBuffer buffer) { - return FfiConverterPersistenceException.read(buffer.asUint8List()).value; +class UnsignedTxHasScriptSigsPsbtException extends PsbtException { + UnsignedTxHasScriptSigsPsbtException(); + UnsignedTxHasScriptSigsPsbtException._(); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + return LiftRetVal(UnsignedTxHasScriptSigsPsbtException._(), new_offset); } - static LiftRetVal read(Uint8List buf) { - final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); - final subview = Uint8List.view(buf.buffer, buf.offsetInBytes + 4); - switch (index) { - case 1: - final lifted = ReasonPersistenceException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - default: - throw UniffiInternalError( - UniffiInternalError.unexpectedEnumCase, - "Unable to determine enum variant", - ); - } + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); } - static RustBuffer lower(PersistenceException value) { - return value.lower(); + @override + int allocationSize() { + return 4; } - static int allocationSize(PersistenceException value) { - return value.allocationSize(); + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 8); + int new_offset = buf.offsetInBytes + 4; + return new_offset; } - static int write(PersistenceException value, Uint8List buf) { - return value.write(buf) - buf.offsetInBytes; + @override + String toString() { + return "UnsignedTxHasScriptSigsPsbtException"; } } -class ReasonPersistenceException extends PersistenceException { - final String errorMessage; - ReasonPersistenceException(String this.errorMessage); - ReasonPersistenceException._(String this.errorMessage); - static LiftRetVal read(Uint8List buf) { +class UnsignedTxHasScriptWitnessesPsbtException extends PsbtException { + UnsignedTxHasScriptWitnessesPsbtException(); + UnsignedTxHasScriptWitnessesPsbtException._(); + static LiftRetVal read( + Uint8List buf, + ) { int new_offset = buf.offsetInBytes; - final errorMessage_lifted = FfiConverterString.read( - Uint8List.view(buf.buffer, new_offset), + return LiftRetVal( + UnsignedTxHasScriptWitnessesPsbtException._(), + new_offset, ); - final errorMessage = errorMessage_lifted.value; - new_offset += errorMessage_lifted.bytesRead; - return LiftRetVal(ReasonPersistenceException._(errorMessage), new_offset); } @override @@ -13484,103 +13805,216 @@ class ReasonPersistenceException extends PersistenceException { @override int allocationSize() { - return FfiConverterString.allocationSize(errorMessage) + 4; + return 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 9); int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - errorMessage, - Uint8List.view(buf.buffer, new_offset), - ); return new_offset; } @override String toString() { - return "ReasonPersistenceException($errorMessage)"; + return "UnsignedTxHasScriptWitnessesPsbtException"; } } -class PersistenceExceptionErrorHandler - extends UniffiRustCallStatusErrorHandler { +class MustHaveUnsignedTxPsbtException extends PsbtException { + MustHaveUnsignedTxPsbtException(); + MustHaveUnsignedTxPsbtException._(); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + return LiftRetVal(MustHaveUnsignedTxPsbtException._(), new_offset); + } + @override - Exception lift(RustBuffer errorBuf) { - return FfiConverterPersistenceException.lift(errorBuf); + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 10); + int new_offset = buf.offsetInBytes + 4; + return new_offset; + } + + @override + String toString() { + return "MustHaveUnsignedTxPsbtException"; } } -final PersistenceExceptionErrorHandler persistenceExceptionErrorHandler = - PersistenceExceptionErrorHandler(); +class NoMorePairsPsbtException extends PsbtException { + NoMorePairsPsbtException(); + NoMorePairsPsbtException._(); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + return LiftRetVal(NoMorePairsPsbtException._(), new_offset); + } -abstract class PkOrF { - RustBuffer lower(); - int allocationSize(); - int write(Uint8List buf); + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 11); + int new_offset = buf.offsetInBytes + 4; + return new_offset; + } + + @override + String toString() { + return "NoMorePairsPsbtException"; + } } -class FfiConverterPkOrF { - static PkOrF lift(RustBuffer buffer) { - return FfiConverterPkOrF.read(buffer.asUint8List()).value; +class UnexpectedUnsignedTxPsbtException extends PsbtException { + UnexpectedUnsignedTxPsbtException(); + UnexpectedUnsignedTxPsbtException._(); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + return LiftRetVal(UnexpectedUnsignedTxPsbtException._(), new_offset); } - static LiftRetVal read(Uint8List buf) { - final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); - final subview = Uint8List.view(buf.buffer, buf.offsetInBytes + 4); - switch (index) { - case 1: - final lifted = PubkeyPkOrF.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 2: - final lifted = XOnlyPubkeyPkOrF.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 3: - final lifted = FingerprintPkOrF.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - default: - throw UniffiInternalError( - UniffiInternalError.unexpectedEnumCase, - "Unable to determine enum variant", - ); - } + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); } - static RustBuffer lower(PkOrF value) { - return value.lower(); + @override + int allocationSize() { + return 4; } - static int allocationSize(PkOrF value) { - return value.allocationSize(); + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 12); + int new_offset = buf.offsetInBytes + 4; + return new_offset; } - static int write(PkOrF value, Uint8List buf) { - return value.write(buf) - buf.offsetInBytes; + @override + String toString() { + return "UnexpectedUnsignedTxPsbtException"; } } -class PubkeyPkOrF extends PkOrF { - final String value; - PubkeyPkOrF(String this.value); - PubkeyPkOrF._(String this.value); - static LiftRetVal read(Uint8List buf) { +class NonStandardSighashTypePsbtException extends PsbtException { + final int sighash; + NonStandardSighashTypePsbtException(int this.sighash); + NonStandardSighashTypePsbtException._(int this.sighash); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final value_lifted = FfiConverterString.read( + final sighash_lifted = FfiConverterUInt32.read( Uint8List.view(buf.buffer, new_offset), ); - final value = value_lifted.value; - new_offset += value_lifted.bytesRead; - return LiftRetVal(PubkeyPkOrF._(value), new_offset); + final sighash = sighash_lifted.value; + new_offset += sighash_lifted.bytesRead; + return LiftRetVal( + NonStandardSighashTypePsbtException._(sighash), + new_offset, + ); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return FfiConverterUInt32.allocationSize(sighash) + 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 13); + int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterUInt32.write( + sighash, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset; + } + + @override + String toString() { + return "NonStandardSighashTypePsbtException($sighash)"; + } +} + +class InvalidHashPsbtException extends PsbtException { + final String hash; + InvalidHashPsbtException(String this.hash); + InvalidHashPsbtException._(String this.hash); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final hash_lifted = FfiConverterString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final hash = hash_lifted.value; + new_offset += hash_lifted.bytesRead; + return LiftRetVal(InvalidHashPsbtException._(hash), new_offset); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return FfiConverterString.allocationSize(hash) + 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 14); + int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterString.write( + hash, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset; + } + + @override + String toString() { + return "InvalidHashPsbtException($hash)"; + } +} + +class InvalidPreimageHashPairPsbtException extends PsbtException { + InvalidPreimageHashPairPsbtException(); + InvalidPreimageHashPairPsbtException._(); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + return LiftRetVal(InvalidPreimageHashPairPsbtException._(), new_offset); } @override @@ -13592,33 +14026,39 @@ class PubkeyPkOrF extends PkOrF { @override int allocationSize() { - return FfiConverterString.allocationSize(value) + 4; + return 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 15); int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - value, - Uint8List.view(buf.buffer, new_offset), - ); return new_offset; } + + @override + String toString() { + return "InvalidPreimageHashPairPsbtException"; + } } -class XOnlyPubkeyPkOrF extends PkOrF { - final String value; - XOnlyPubkeyPkOrF(String this.value); - XOnlyPubkeyPkOrF._(String this.value); - static LiftRetVal read(Uint8List buf) { +class CombineInconsistentKeySourcesPsbtException extends PsbtException { + final String xpub; + CombineInconsistentKeySourcesPsbtException(String this.xpub); + CombineInconsistentKeySourcesPsbtException._(String this.xpub); + static LiftRetVal read( + Uint8List buf, + ) { int new_offset = buf.offsetInBytes; - final value_lifted = FfiConverterString.read( + final xpub_lifted = FfiConverterString.read( Uint8List.view(buf.buffer, new_offset), ); - final value = value_lifted.value; - new_offset += value_lifted.bytesRead; - return LiftRetVal(XOnlyPubkeyPkOrF._(value), new_offset); + final xpub = xpub_lifted.value; + new_offset += xpub_lifted.bytesRead; + return LiftRetVal( + CombineInconsistentKeySourcesPsbtException._(xpub), + new_offset, + ); } @override @@ -13630,33 +14070,41 @@ class XOnlyPubkeyPkOrF extends PkOrF { @override int allocationSize() { - return FfiConverterString.allocationSize(value) + 4; + return FfiConverterString.allocationSize(xpub) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 2); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 16); int new_offset = buf.offsetInBytes + 4; new_offset += FfiConverterString.write( - value, + xpub, Uint8List.view(buf.buffer, new_offset), ); return new_offset; } + + @override + String toString() { + return "CombineInconsistentKeySourcesPsbtException($xpub)"; + } } -class FingerprintPkOrF extends PkOrF { - final String value; - FingerprintPkOrF(String this.value); - FingerprintPkOrF._(String this.value); - static LiftRetVal read(Uint8List buf) { +class ConsensusEncodingPsbtException extends PsbtException { + final String encodingError; + ConsensusEncodingPsbtException(String this.encodingError); + ConsensusEncodingPsbtException._(String this.encodingError); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final value_lifted = FfiConverterString.read( + final encodingError_lifted = FfiConverterString.read( Uint8List.view(buf.buffer, new_offset), ); - final value = value_lifted.value; - new_offset += value_lifted.bytesRead; - return LiftRetVal(FingerprintPkOrF._(value), new_offset); + final encodingError = encodingError_lifted.value; + new_offset += encodingError_lifted.bytesRead; + return LiftRetVal( + ConsensusEncodingPsbtException._(encodingError), + new_offset, + ); } @override @@ -13668,87 +14116,65 @@ class FingerprintPkOrF extends PkOrF { @override int allocationSize() { - return FfiConverterString.allocationSize(value) + 4; + return FfiConverterString.allocationSize(encodingError) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 3); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 17); int new_offset = buf.offsetInBytes + 4; new_offset += FfiConverterString.write( - value, + encodingError, Uint8List.view(buf.buffer, new_offset), ); return new_offset; } -} -abstract class PreV1MigrationException implements Exception { - RustBuffer lower(); - int allocationSize(); - int write(Uint8List buf); + @override + String toString() { + return "ConsensusEncodingPsbtException($encodingError)"; + } } -class FfiConverterPreV1MigrationException { - static PreV1MigrationException lift(RustBuffer buffer) { - return FfiConverterPreV1MigrationException.read(buffer.asUint8List()).value; +class NegativeFeePsbtException extends PsbtException { + NegativeFeePsbtException(); + NegativeFeePsbtException._(); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + return LiftRetVal(NegativeFeePsbtException._(), new_offset); } - static LiftRetVal read(Uint8List buf) { - final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); - final subview = Uint8List.view(buf.buffer, buf.offsetInBytes + 4); - switch (index) { - case 1: - final lifted = SqliteOnlyPreV1MigrationException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 2: - final lifted = SqlitePreV1MigrationException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 3: - final lifted = InvalidKeychainPreV1MigrationException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 4: - final lifted = InvalidChecksumPreV1MigrationException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - default: - throw UniffiInternalError( - UniffiInternalError.unexpectedEnumCase, - "Unable to determine enum variant", - ); - } + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); } - static RustBuffer lower(PreV1MigrationException value) { - return value.lower(); + @override + int allocationSize() { + return 4; } - static int allocationSize(PreV1MigrationException value) { - return value.allocationSize(); + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 18); + int new_offset = buf.offsetInBytes + 4; + return new_offset; } - static int write(PreV1MigrationException value, Uint8List buf) { - return value.write(buf) - buf.offsetInBytes; + @override + String toString() { + return "NegativeFeePsbtException"; } } -class SqliteOnlyPreV1MigrationException extends PreV1MigrationException { - SqliteOnlyPreV1MigrationException(); - SqliteOnlyPreV1MigrationException._(); - static LiftRetVal read(Uint8List buf) { +class FeeOverflowPsbtException extends PsbtException { + FeeOverflowPsbtException(); + FeeOverflowPsbtException._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(SqliteOnlyPreV1MigrationException._(), new_offset); + return LiftRetVal(FeeOverflowPsbtException._(), new_offset); } @override @@ -13765,22 +14191,22 @@ class SqliteOnlyPreV1MigrationException extends PreV1MigrationException { @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 19); int new_offset = buf.offsetInBytes + 4; return new_offset; } @override String toString() { - return "SqliteOnlyPreV1MigrationException"; + return "FeeOverflowPsbtException"; } } -class SqlitePreV1MigrationException extends PreV1MigrationException { +class InvalidPublicKeyPsbtException extends PsbtException { final String errorMessage; - SqlitePreV1MigrationException(String this.errorMessage); - SqlitePreV1MigrationException._(String this.errorMessage); - static LiftRetVal read(Uint8List buf) { + InvalidPublicKeyPsbtException(String this.errorMessage); + InvalidPublicKeyPsbtException._(String this.errorMessage); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; final errorMessage_lifted = FfiConverterString.read( Uint8List.view(buf.buffer, new_offset), @@ -13788,7 +14214,7 @@ class SqlitePreV1MigrationException extends PreV1MigrationException { final errorMessage = errorMessage_lifted.value; new_offset += errorMessage_lifted.bytesRead; return LiftRetVal( - SqlitePreV1MigrationException._(errorMessage), + InvalidPublicKeyPsbtException._(errorMessage), new_offset, ); } @@ -13807,7 +14233,7 @@ class SqlitePreV1MigrationException extends PreV1MigrationException { @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 2); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 20); int new_offset = buf.offsetInBytes + 4; new_offset += FfiConverterString.write( errorMessage, @@ -13818,25 +14244,25 @@ class SqlitePreV1MigrationException extends PreV1MigrationException { @override String toString() { - return "SqlitePreV1MigrationException($errorMessage)"; + return "InvalidPublicKeyPsbtException($errorMessage)"; } } -class InvalidKeychainPreV1MigrationException extends PreV1MigrationException { - final String keychain; - InvalidKeychainPreV1MigrationException(String this.keychain); - InvalidKeychainPreV1MigrationException._(String this.keychain); - static LiftRetVal read( +class InvalidSecp256k1PublicKeyPsbtException extends PsbtException { + final String secp256k1Error; + InvalidSecp256k1PublicKeyPsbtException(String this.secp256k1Error); + InvalidSecp256k1PublicKeyPsbtException._(String this.secp256k1Error); + static LiftRetVal read( Uint8List buf, ) { int new_offset = buf.offsetInBytes; - final keychain_lifted = FfiConverterString.read( + final secp256k1Error_lifted = FfiConverterString.read( Uint8List.view(buf.buffer, new_offset), ); - final keychain = keychain_lifted.value; - new_offset += keychain_lifted.bytesRead; + final secp256k1Error = secp256k1Error_lifted.value; + new_offset += secp256k1Error_lifted.bytesRead; return LiftRetVal( - InvalidKeychainPreV1MigrationException._(keychain), + InvalidSecp256k1PublicKeyPsbtException._(secp256k1Error), new_offset, ); } @@ -13850,15 +14276,15 @@ class InvalidKeychainPreV1MigrationException extends PreV1MigrationException { @override int allocationSize() { - return FfiConverterString.allocationSize(keychain) + 4; + return FfiConverterString.allocationSize(secp256k1Error) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 3); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 21); int new_offset = buf.offsetInBytes + 4; new_offset += FfiConverterString.write( - keychain, + secp256k1Error, Uint8List.view(buf.buffer, new_offset), ); return new_offset; @@ -13866,17 +14292,48 @@ class InvalidKeychainPreV1MigrationException extends PreV1MigrationException { @override String toString() { - return "InvalidKeychainPreV1MigrationException($keychain)"; + return "InvalidSecp256k1PublicKeyPsbtException($secp256k1Error)"; } } -class InvalidChecksumPreV1MigrationException extends PreV1MigrationException { +class InvalidXOnlyPublicKeyPsbtException extends PsbtException { + InvalidXOnlyPublicKeyPsbtException(); + InvalidXOnlyPublicKeyPsbtException._(); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + return LiftRetVal(InvalidXOnlyPublicKeyPsbtException._(), new_offset); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 22); + int new_offset = buf.offsetInBytes + 4; + return new_offset; + } + + @override + String toString() { + return "InvalidXOnlyPublicKeyPsbtException"; + } +} + +class InvalidEcdsaSignaturePsbtException extends PsbtException { final String errorMessage; - InvalidChecksumPreV1MigrationException(String this.errorMessage); - InvalidChecksumPreV1MigrationException._(String this.errorMessage); - static LiftRetVal read( - Uint8List buf, - ) { + InvalidEcdsaSignaturePsbtException(String this.errorMessage); + InvalidEcdsaSignaturePsbtException._(String this.errorMessage); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; final errorMessage_lifted = FfiConverterString.read( Uint8List.view(buf.buffer, new_offset), @@ -13884,7 +14341,7 @@ class InvalidChecksumPreV1MigrationException extends PreV1MigrationException { final errorMessage = errorMessage_lifted.value; new_offset += errorMessage_lifted.bytesRead; return LiftRetVal( - InvalidChecksumPreV1MigrationException._(errorMessage), + InvalidEcdsaSignaturePsbtException._(errorMessage), new_offset, ); } @@ -13903,7 +14360,7 @@ class InvalidChecksumPreV1MigrationException extends PreV1MigrationException { @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 4); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 23); int new_offset = buf.offsetInBytes + 4; new_offset += FfiConverterString.write( errorMessage, @@ -13914,261 +14371,25 @@ class InvalidChecksumPreV1MigrationException extends PreV1MigrationException { @override String toString() { - return "InvalidChecksumPreV1MigrationException($errorMessage)"; - } -} - -class PreV1MigrationExceptionErrorHandler - extends UniffiRustCallStatusErrorHandler { - @override - Exception lift(RustBuffer errorBuf) { - return FfiConverterPreV1MigrationException.lift(errorBuf); - } -} - -final PreV1MigrationExceptionErrorHandler preV1MigrationExceptionErrorHandler = - PreV1MigrationExceptionErrorHandler(); - -abstract class PsbtException implements Exception { - RustBuffer lower(); - int allocationSize(); - int write(Uint8List buf); -} - -class FfiConverterPsbtException { - static PsbtException lift(RustBuffer buffer) { - return FfiConverterPsbtException.read(buffer.asUint8List()).value; - } - - static LiftRetVal read(Uint8List buf) { - final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); - final subview = Uint8List.view(buf.buffer, buf.offsetInBytes + 4); - switch (index) { - case 1: - final lifted = InvalidMagicPsbtException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 2: - final lifted = MissingUtxoPsbtException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 3: - final lifted = InvalidSeparatorPsbtException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 4: - final lifted = PsbtUtxoOutOfBoundsPsbtException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 5: - final lifted = InvalidKeyPsbtException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 6: - final lifted = InvalidProprietaryKeyPsbtException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 7: - final lifted = DuplicateKeyPsbtException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 8: - final lifted = UnsignedTxHasScriptSigsPsbtException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 9: - final lifted = UnsignedTxHasScriptWitnessesPsbtException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 10: - final lifted = MustHaveUnsignedTxPsbtException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 11: - final lifted = NoMorePairsPsbtException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 12: - final lifted = UnexpectedUnsignedTxPsbtException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 13: - final lifted = NonStandardSighashTypePsbtException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 14: - final lifted = InvalidHashPsbtException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 15: - final lifted = InvalidPreimageHashPairPsbtException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 16: - final lifted = CombineInconsistentKeySourcesPsbtException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 17: - final lifted = ConsensusEncodingPsbtException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 18: - final lifted = NegativeFeePsbtException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 19: - final lifted = FeeOverflowPsbtException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 20: - final lifted = InvalidPublicKeyPsbtException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 21: - final lifted = InvalidSecp256k1PublicKeyPsbtException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 22: - final lifted = InvalidXOnlyPublicKeyPsbtException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 23: - final lifted = InvalidEcdsaSignaturePsbtException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 24: - final lifted = InvalidTaprootSignaturePsbtException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 25: - final lifted = InvalidControlBlockPsbtException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 26: - final lifted = InvalidLeafVersionPsbtException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 27: - final lifted = TaprootPsbtException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 28: - final lifted = TapTreePsbtException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 29: - final lifted = XPubKeyPsbtException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 30: - final lifted = VersionPsbtException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 31: - final lifted = PartialDataConsumptionPsbtException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 32: - final lifted = IoPsbtException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 33: - final lifted = OtherPsbtErrPsbtException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - default: - throw UniffiInternalError( - UniffiInternalError.unexpectedEnumCase, - "Unable to determine enum variant", - ); - } - } - - static RustBuffer lower(PsbtException value) { - return value.lower(); - } - - static int allocationSize(PsbtException value) { - return value.allocationSize(); - } - - static int write(PsbtException value, Uint8List buf) { - return value.write(buf) - buf.offsetInBytes; + return "InvalidEcdsaSignaturePsbtException($errorMessage)"; } } -class InvalidMagicPsbtException extends PsbtException { - InvalidMagicPsbtException(); - InvalidMagicPsbtException._(); - static LiftRetVal read(Uint8List buf) { +class InvalidTaprootSignaturePsbtException extends PsbtException { + final String errorMessage; + InvalidTaprootSignaturePsbtException(String this.errorMessage); + InvalidTaprootSignaturePsbtException._(String this.errorMessage); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(InvalidMagicPsbtException._(), new_offset); + final errorMessage_lifted = FfiConverterString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final errorMessage = errorMessage_lifted.value; + new_offset += errorMessage_lifted.bytesRead; + return LiftRetVal( + InvalidTaprootSignaturePsbtException._(errorMessage), + new_offset, + ); } @override @@ -14180,28 +14401,32 @@ class InvalidMagicPsbtException extends PsbtException { @override int allocationSize() { - return 4; + return FfiConverterString.allocationSize(errorMessage) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 24); int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterString.write( + errorMessage, + Uint8List.view(buf.buffer, new_offset), + ); return new_offset; } @override String toString() { - return "InvalidMagicPsbtException"; + return "InvalidTaprootSignaturePsbtException($errorMessage)"; } } -class MissingUtxoPsbtException extends PsbtException { - MissingUtxoPsbtException(); - MissingUtxoPsbtException._(); - static LiftRetVal read(Uint8List buf) { +class InvalidControlBlockPsbtException extends PsbtException { + InvalidControlBlockPsbtException(); + InvalidControlBlockPsbtException._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(MissingUtxoPsbtException._(), new_offset); + return LiftRetVal(InvalidControlBlockPsbtException._(), new_offset); } @override @@ -14218,23 +14443,23 @@ class MissingUtxoPsbtException extends PsbtException { @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 2); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 25); int new_offset = buf.offsetInBytes + 4; return new_offset; } @override String toString() { - return "MissingUtxoPsbtException"; + return "InvalidControlBlockPsbtException"; } } -class InvalidSeparatorPsbtException extends PsbtException { - InvalidSeparatorPsbtException(); - InvalidSeparatorPsbtException._(); - static LiftRetVal read(Uint8List buf) { +class InvalidLeafVersionPsbtException extends PsbtException { + InvalidLeafVersionPsbtException(); + InvalidLeafVersionPsbtException._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(InvalidSeparatorPsbtException._(), new_offset); + return LiftRetVal(InvalidLeafVersionPsbtException._(), new_offset); } @override @@ -14251,23 +14476,23 @@ class InvalidSeparatorPsbtException extends PsbtException { @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 3); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 26); int new_offset = buf.offsetInBytes + 4; return new_offset; } @override String toString() { - return "InvalidSeparatorPsbtException"; + return "InvalidLeafVersionPsbtException"; } } -class PsbtUtxoOutOfBoundsPsbtException extends PsbtException { - PsbtUtxoOutOfBoundsPsbtException(); - PsbtUtxoOutOfBoundsPsbtException._(); - static LiftRetVal read(Uint8List buf) { +class TaprootPsbtException extends PsbtException { + TaprootPsbtException(); + TaprootPsbtException._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(PsbtUtxoOutOfBoundsPsbtException._(), new_offset); + return LiftRetVal(TaprootPsbtException._(), new_offset); } @override @@ -14284,29 +14509,29 @@ class PsbtUtxoOutOfBoundsPsbtException extends PsbtException { @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 4); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 27); int new_offset = buf.offsetInBytes + 4; return new_offset; } @override String toString() { - return "PsbtUtxoOutOfBoundsPsbtException"; + return "TaprootPsbtException"; } } -class InvalidKeyPsbtException extends PsbtException { - final String key; - InvalidKeyPsbtException(String this.key); - InvalidKeyPsbtException._(String this.key); - static LiftRetVal read(Uint8List buf) { +class TapTreePsbtException extends PsbtException { + final String errorMessage; + TapTreePsbtException(String this.errorMessage); + TapTreePsbtException._(String this.errorMessage); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final key_lifted = FfiConverterString.read( + final errorMessage_lifted = FfiConverterString.read( Uint8List.view(buf.buffer, new_offset), ); - final key = key_lifted.value; - new_offset += key_lifted.bytesRead; - return LiftRetVal(InvalidKeyPsbtException._(key), new_offset); + final errorMessage = errorMessage_lifted.value; + new_offset += errorMessage_lifted.bytesRead; + return LiftRetVal(TapTreePsbtException._(errorMessage), new_offset); } @override @@ -14318,15 +14543,15 @@ class InvalidKeyPsbtException extends PsbtException { @override int allocationSize() { - return FfiConverterString.allocationSize(key) + 4; + return FfiConverterString.allocationSize(errorMessage) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 5); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 28); int new_offset = buf.offsetInBytes + 4; new_offset += FfiConverterString.write( - key, + errorMessage, Uint8List.view(buf.buffer, new_offset), ); return new_offset; @@ -14334,16 +14559,16 @@ class InvalidKeyPsbtException extends PsbtException { @override String toString() { - return "InvalidKeyPsbtException($key)"; + return "TapTreePsbtException($errorMessage)"; } } -class InvalidProprietaryKeyPsbtException extends PsbtException { - InvalidProprietaryKeyPsbtException(); - InvalidProprietaryKeyPsbtException._(); - static LiftRetVal read(Uint8List buf) { +class XPubKeyPsbtException extends PsbtException { + XPubKeyPsbtException(); + XPubKeyPsbtException._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(InvalidProprietaryKeyPsbtException._(), new_offset); + return LiftRetVal(XPubKeyPsbtException._(), new_offset); } @override @@ -14360,29 +14585,29 @@ class InvalidProprietaryKeyPsbtException extends PsbtException { @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 6); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 29); int new_offset = buf.offsetInBytes + 4; return new_offset; } @override String toString() { - return "InvalidProprietaryKeyPsbtException"; + return "XPubKeyPsbtException"; } } -class DuplicateKeyPsbtException extends PsbtException { - final String key; - DuplicateKeyPsbtException(String this.key); - DuplicateKeyPsbtException._(String this.key); - static LiftRetVal read(Uint8List buf) { +class VersionPsbtException extends PsbtException { + final String errorMessage; + VersionPsbtException(String this.errorMessage); + VersionPsbtException._(String this.errorMessage); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final key_lifted = FfiConverterString.read( + final errorMessage_lifted = FfiConverterString.read( Uint8List.view(buf.buffer, new_offset), ); - final key = key_lifted.value; - new_offset += key_lifted.bytesRead; - return LiftRetVal(DuplicateKeyPsbtException._(key), new_offset); + final errorMessage = errorMessage_lifted.value; + new_offset += errorMessage_lifted.bytesRead; + return LiftRetVal(VersionPsbtException._(errorMessage), new_offset); } @override @@ -14394,15 +14619,15 @@ class DuplicateKeyPsbtException extends PsbtException { @override int allocationSize() { - return FfiConverterString.allocationSize(key) + 4; + return FfiConverterString.allocationSize(errorMessage) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 7); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 30); int new_offset = buf.offsetInBytes + 4; new_offset += FfiConverterString.write( - key, + errorMessage, Uint8List.view(buf.buffer, new_offset), ); return new_offset; @@ -14410,16 +14635,16 @@ class DuplicateKeyPsbtException extends PsbtException { @override String toString() { - return "DuplicateKeyPsbtException($key)"; + return "VersionPsbtException($errorMessage)"; } } -class UnsignedTxHasScriptSigsPsbtException extends PsbtException { - UnsignedTxHasScriptSigsPsbtException(); - UnsignedTxHasScriptSigsPsbtException._(); - static LiftRetVal read(Uint8List buf) { +class PartialDataConsumptionPsbtException extends PsbtException { + PartialDataConsumptionPsbtException(); + PartialDataConsumptionPsbtException._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(UnsignedTxHasScriptSigsPsbtException._(), new_offset); + return LiftRetVal(PartialDataConsumptionPsbtException._(), new_offset); } @override @@ -14436,28 +14661,29 @@ class UnsignedTxHasScriptSigsPsbtException extends PsbtException { @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 8); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 31); int new_offset = buf.offsetInBytes + 4; return new_offset; } @override String toString() { - return "UnsignedTxHasScriptSigsPsbtException"; + return "PartialDataConsumptionPsbtException"; } } -class UnsignedTxHasScriptWitnessesPsbtException extends PsbtException { - UnsignedTxHasScriptWitnessesPsbtException(); - UnsignedTxHasScriptWitnessesPsbtException._(); - static LiftRetVal read( - Uint8List buf, - ) { +class IoPsbtException extends PsbtException { + final String errorMessage; + IoPsbtException(String this.errorMessage); + IoPsbtException._(String this.errorMessage); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal( - UnsignedTxHasScriptWitnessesPsbtException._(), - new_offset, + final errorMessage_lifted = FfiConverterString.read( + Uint8List.view(buf.buffer, new_offset), ); + final errorMessage = errorMessage_lifted.value; + new_offset += errorMessage_lifted.bytesRead; + return LiftRetVal(IoPsbtException._(errorMessage), new_offset); } @override @@ -14469,28 +14695,32 @@ class UnsignedTxHasScriptWitnessesPsbtException extends PsbtException { @override int allocationSize() { - return 4; + return FfiConverterString.allocationSize(errorMessage) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 9); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 32); int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterString.write( + errorMessage, + Uint8List.view(buf.buffer, new_offset), + ); return new_offset; } @override String toString() { - return "UnsignedTxHasScriptWitnessesPsbtException"; + return "IoPsbtException($errorMessage)"; } } -class MustHaveUnsignedTxPsbtException extends PsbtException { - MustHaveUnsignedTxPsbtException(); - MustHaveUnsignedTxPsbtException._(); - static LiftRetVal read(Uint8List buf) { +class OtherPsbtErrPsbtException extends PsbtException { + OtherPsbtErrPsbtException(); + OtherPsbtErrPsbtException._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(MustHaveUnsignedTxPsbtException._(), new_offset); + return LiftRetVal(OtherPsbtErrPsbtException._(), new_offset); } @override @@ -14507,96 +14737,103 @@ class MustHaveUnsignedTxPsbtException extends PsbtException { @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 10); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 33); int new_offset = buf.offsetInBytes + 4; return new_offset; } @override String toString() { - return "MustHaveUnsignedTxPsbtException"; + return "OtherPsbtErrPsbtException"; } } -class NoMorePairsPsbtException extends PsbtException { - NoMorePairsPsbtException(); - NoMorePairsPsbtException._(); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - return LiftRetVal(NoMorePairsPsbtException._(), new_offset); - } - - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); - } - +class PsbtExceptionErrorHandler extends UniffiRustCallStatusErrorHandler { @override - int allocationSize() { - return 4; + Exception lift(RustBuffer errorBuf) { + return FfiConverterPsbtException.lift(errorBuf); } +} - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 11); - int new_offset = buf.offsetInBytes + 4; - return new_offset; - } +final PsbtExceptionErrorHandler psbtExceptionErrorHandler = + PsbtExceptionErrorHandler(); - @override - String toString() { - return "NoMorePairsPsbtException"; - } +abstract class PsbtFinalizeException implements Exception { + RustBuffer lower(); + int allocationSize(); + int write(Uint8List buf); } -class UnexpectedUnsignedTxPsbtException extends PsbtException { - UnexpectedUnsignedTxPsbtException(); - UnexpectedUnsignedTxPsbtException._(); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - return LiftRetVal(UnexpectedUnsignedTxPsbtException._(), new_offset); +class FfiConverterPsbtFinalizeException { + static PsbtFinalizeException lift(RustBuffer buffer) { + return FfiConverterPsbtFinalizeException.read(buffer.asUint8List()).value; } - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); + static LiftRetVal read(Uint8List buf) { + final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); + final subview = Uint8List.view(buf.buffer, buf.offsetInBytes + 4); + switch (index) { + case 1: + final lifted = InputExceptionPsbtFinalizeException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 2: + final lifted = WrongInputCountPsbtFinalizeException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 3: + final lifted = InputIdxOutofBoundsPsbtFinalizeException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + default: + throw UniffiInternalError( + UniffiInternalError.unexpectedEnumCase, + "Unable to determine enum variant", + ); + } } - @override - int allocationSize() { - return 4; + static RustBuffer lower(PsbtFinalizeException value) { + return value.lower(); } - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 12); - int new_offset = buf.offsetInBytes + 4; - return new_offset; + static int allocationSize(PsbtFinalizeException value) { + return value.allocationSize(); } - @override - String toString() { - return "UnexpectedUnsignedTxPsbtException"; + static int write(PsbtFinalizeException value, Uint8List buf) { + return value.write(buf) - buf.offsetInBytes; } } -class NonStandardSighashTypePsbtException extends PsbtException { - final int sighash; - NonStandardSighashTypePsbtException(int this.sighash); - NonStandardSighashTypePsbtException._(int this.sighash); - static LiftRetVal read(Uint8List buf) { +class InputExceptionPsbtFinalizeException extends PsbtFinalizeException { + final String reason; + final int index; + InputExceptionPsbtFinalizeException({ + required String this.reason, + required int this.index, + }); + InputExceptionPsbtFinalizeException._(String this.reason, int this.index); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final sighash_lifted = FfiConverterUInt32.read( + final reason_lifted = FfiConverterString.read( Uint8List.view(buf.buffer, new_offset), ); - final sighash = sighash_lifted.value; - new_offset += sighash_lifted.bytesRead; + final reason = reason_lifted.value; + new_offset += reason_lifted.bytesRead; + final index_lifted = FfiConverterUInt32.read( + Uint8List.view(buf.buffer, new_offset), + ); + final index = index_lifted.value; + new_offset += index_lifted.bytesRead; return LiftRetVal( - NonStandardSighashTypePsbtException._(sighash), + InputExceptionPsbtFinalizeException._(reason, index), new_offset, ); } @@ -14610,15 +14847,21 @@ class NonStandardSighashTypePsbtException extends PsbtException { @override int allocationSize() { - return FfiConverterUInt32.allocationSize(sighash) + 4; + return FfiConverterString.allocationSize(reason) + + FfiConverterUInt32.allocationSize(index) + + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 13); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterString.write( + reason, + Uint8List.view(buf.buffer, new_offset), + ); new_offset += FfiConverterUInt32.write( - sighash, + index, Uint8List.view(buf.buffer, new_offset), ); return new_offset; @@ -14626,22 +14869,34 @@ class NonStandardSighashTypePsbtException extends PsbtException { @override String toString() { - return "NonStandardSighashTypePsbtException($sighash)"; + return "InputExceptionPsbtFinalizeException($reason, $index)"; } } -class InvalidHashPsbtException extends PsbtException { - final String hash; - InvalidHashPsbtException(String this.hash); - InvalidHashPsbtException._(String this.hash); - static LiftRetVal read(Uint8List buf) { +class WrongInputCountPsbtFinalizeException extends PsbtFinalizeException { + final int inTx; + final int inMap; + WrongInputCountPsbtFinalizeException({ + required int this.inTx, + required int this.inMap, + }); + WrongInputCountPsbtFinalizeException._(int this.inTx, int this.inMap); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final hash_lifted = FfiConverterString.read( + final inTx_lifted = FfiConverterUInt32.read( Uint8List.view(buf.buffer, new_offset), ); - final hash = hash_lifted.value; - new_offset += hash_lifted.bytesRead; - return LiftRetVal(InvalidHashPsbtException._(hash), new_offset); + final inTx = inTx_lifted.value; + new_offset += inTx_lifted.bytesRead; + final inMap_lifted = FfiConverterUInt32.read( + Uint8List.view(buf.buffer, new_offset), + ); + final inMap = inMap_lifted.value; + new_offset += inMap_lifted.bytesRead; + return LiftRetVal( + WrongInputCountPsbtFinalizeException._(inTx, inMap), + new_offset, + ); } @override @@ -14653,15 +14908,21 @@ class InvalidHashPsbtException extends PsbtException { @override int allocationSize() { - return FfiConverterString.allocationSize(hash) + 4; + return FfiConverterUInt32.allocationSize(inTx) + + FfiConverterUInt32.allocationSize(inMap) + + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 14); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 2); int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - hash, + new_offset += FfiConverterUInt32.write( + inTx, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterUInt32.write( + inMap, Uint8List.view(buf.buffer, new_offset), ); return new_offset; @@ -14669,16 +14930,39 @@ class InvalidHashPsbtException extends PsbtException { @override String toString() { - return "InvalidHashPsbtException($hash)"; + return "WrongInputCountPsbtFinalizeException($inTx, $inMap)"; } } -class InvalidPreimageHashPairPsbtException extends PsbtException { - InvalidPreimageHashPairPsbtException(); - InvalidPreimageHashPairPsbtException._(); - static LiftRetVal read(Uint8List buf) { +class InputIdxOutofBoundsPsbtFinalizeException extends PsbtFinalizeException { + final int psbtInp; + final int requested; + InputIdxOutofBoundsPsbtFinalizeException({ + required int this.psbtInp, + required int this.requested, + }); + InputIdxOutofBoundsPsbtFinalizeException._( + int this.psbtInp, + int this.requested, + ); + static LiftRetVal read( + Uint8List buf, + ) { int new_offset = buf.offsetInBytes; - return LiftRetVal(InvalidPreimageHashPairPsbtException._(), new_offset); + final psbtInp_lifted = FfiConverterUInt32.read( + Uint8List.view(buf.buffer, new_offset), + ); + final psbtInp = psbtInp_lifted.value; + new_offset += psbtInp_lifted.bytesRead; + final requested_lifted = FfiConverterUInt32.read( + Uint8List.view(buf.buffer, new_offset), + ); + final requested = requested_lifted.value; + new_offset += requested_lifted.bytesRead; + return LiftRetVal( + InputIdxOutofBoundsPsbtFinalizeException._(psbtInp, requested), + new_offset, + ); } @override @@ -14690,83 +14974,104 @@ class InvalidPreimageHashPairPsbtException extends PsbtException { @override int allocationSize() { - return 4; + return FfiConverterUInt32.allocationSize(psbtInp) + + FfiConverterUInt32.allocationSize(requested) + + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 15); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 3); int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterUInt32.write( + psbtInp, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterUInt32.write( + requested, + Uint8List.view(buf.buffer, new_offset), + ); return new_offset; } @override String toString() { - return "InvalidPreimageHashPairPsbtException"; + return "InputIdxOutofBoundsPsbtFinalizeException($psbtInp, $requested)"; } } -class CombineInconsistentKeySourcesPsbtException extends PsbtException { - final String xpub; - CombineInconsistentKeySourcesPsbtException(String this.xpub); - CombineInconsistentKeySourcesPsbtException._(String this.xpub); - static LiftRetVal read( - Uint8List buf, - ) { - int new_offset = buf.offsetInBytes; - final xpub_lifted = FfiConverterString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final xpub = xpub_lifted.value; - new_offset += xpub_lifted.bytesRead; - return LiftRetVal( - CombineInconsistentKeySourcesPsbtException._(xpub), - new_offset, - ); +class PsbtFinalizeExceptionErrorHandler + extends UniffiRustCallStatusErrorHandler { + @override + Exception lift(RustBuffer errorBuf) { + return FfiConverterPsbtFinalizeException.lift(errorBuf); } +} - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); +final PsbtFinalizeExceptionErrorHandler psbtFinalizeExceptionErrorHandler = + PsbtFinalizeExceptionErrorHandler(); + +abstract class PsbtParseException implements Exception { + RustBuffer lower(); + int allocationSize(); + int write(Uint8List buf); +} + +class FfiConverterPsbtParseException { + static PsbtParseException lift(RustBuffer buffer) { + return FfiConverterPsbtParseException.read(buffer.asUint8List()).value; } - @override - int allocationSize() { - return FfiConverterString.allocationSize(xpub) + 4; + static LiftRetVal read(Uint8List buf) { + final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); + final subview = Uint8List.view(buf.buffer, buf.offsetInBytes + 4); + switch (index) { + case 1: + final lifted = PsbtEncodingPsbtParseException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 2: + final lifted = Base64EncodingPsbtParseException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + default: + throw UniffiInternalError( + UniffiInternalError.unexpectedEnumCase, + "Unable to determine enum variant", + ); + } } - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 16); - int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - xpub, - Uint8List.view(buf.buffer, new_offset), - ); - return new_offset; + static RustBuffer lower(PsbtParseException value) { + return value.lower(); } - @override - String toString() { - return "CombineInconsistentKeySourcesPsbtException($xpub)"; + static int allocationSize(PsbtParseException value) { + return value.allocationSize(); + } + + static int write(PsbtParseException value, Uint8List buf) { + return value.write(buf) - buf.offsetInBytes; } } -class ConsensusEncodingPsbtException extends PsbtException { - final String encodingError; - ConsensusEncodingPsbtException(String this.encodingError); - ConsensusEncodingPsbtException._(String this.encodingError); - static LiftRetVal read(Uint8List buf) { +class PsbtEncodingPsbtParseException extends PsbtParseException { + final String errorMessage; + PsbtEncodingPsbtParseException(String this.errorMessage); + PsbtEncodingPsbtParseException._(String this.errorMessage); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final encodingError_lifted = FfiConverterString.read( + final errorMessage_lifted = FfiConverterString.read( Uint8List.view(buf.buffer, new_offset), ); - final encodingError = encodingError_lifted.value; - new_offset += encodingError_lifted.bytesRead; + final errorMessage = errorMessage_lifted.value; + new_offset += errorMessage_lifted.bytesRead; return LiftRetVal( - ConsensusEncodingPsbtException._(encodingError), + PsbtEncodingPsbtParseException._(errorMessage), new_offset, ); } @@ -14780,15 +15085,15 @@ class ConsensusEncodingPsbtException extends PsbtException { @override int allocationSize() { - return FfiConverterString.allocationSize(encodingError) + 4; + return FfiConverterString.allocationSize(errorMessage) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 17); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); int new_offset = buf.offsetInBytes + 4; new_offset += FfiConverterString.write( - encodingError, + errorMessage, Uint8List.view(buf.buffer, new_offset), ); return new_offset; @@ -14796,16 +15101,25 @@ class ConsensusEncodingPsbtException extends PsbtException { @override String toString() { - return "ConsensusEncodingPsbtException($encodingError)"; + return "PsbtEncodingPsbtParseException($errorMessage)"; } } -class NegativeFeePsbtException extends PsbtException { - NegativeFeePsbtException(); - NegativeFeePsbtException._(); - static LiftRetVal read(Uint8List buf) { +class Base64EncodingPsbtParseException extends PsbtParseException { + final String errorMessage; + Base64EncodingPsbtParseException(String this.errorMessage); + Base64EncodingPsbtParseException._(String this.errorMessage); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(NegativeFeePsbtException._(), new_offset); + final errorMessage_lifted = FfiConverterString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final errorMessage = errorMessage_lifted.value; + new_offset += errorMessage_lifted.bytesRead; + return LiftRetVal( + Base64EncodingPsbtParseException._(errorMessage), + new_offset, + ); } @override @@ -14817,68 +15131,90 @@ class NegativeFeePsbtException extends PsbtException { @override int allocationSize() { - return 4; + return FfiConverterString.allocationSize(errorMessage) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 18); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 2); int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterString.write( + errorMessage, + Uint8List.view(buf.buffer, new_offset), + ); return new_offset; } @override String toString() { - return "NegativeFeePsbtException"; + return "Base64EncodingPsbtParseException($errorMessage)"; } } -class FeeOverflowPsbtException extends PsbtException { - FeeOverflowPsbtException(); - FeeOverflowPsbtException._(); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - return LiftRetVal(FeeOverflowPsbtException._(), new_offset); +class PsbtParseExceptionErrorHandler extends UniffiRustCallStatusErrorHandler { + @override + Exception lift(RustBuffer errorBuf) { + return FfiConverterPsbtParseException.lift(errorBuf); } +} - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); +final PsbtParseExceptionErrorHandler psbtParseExceptionErrorHandler = + PsbtParseExceptionErrorHandler(); + +abstract class RequestBuilderException implements Exception { + RustBuffer lower(); + int allocationSize(); + int write(Uint8List buf); +} + +class FfiConverterRequestBuilderException { + static RequestBuilderException lift(RustBuffer buffer) { + return FfiConverterRequestBuilderException.read(buffer.asUint8List()).value; } - @override - int allocationSize() { - return 4; + static LiftRetVal read(Uint8List buf) { + final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); + final subview = Uint8List.view(buf.buffer, buf.offsetInBytes + 4); + switch (index) { + case 1: + final lifted = RequestAlreadyConsumedRequestBuilderException.read( + subview, + ); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + default: + throw UniffiInternalError( + UniffiInternalError.unexpectedEnumCase, + "Unable to determine enum variant", + ); + } } - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 19); - int new_offset = buf.offsetInBytes + 4; - return new_offset; + static RustBuffer lower(RequestBuilderException value) { + return value.lower(); } - @override - String toString() { - return "FeeOverflowPsbtException"; + static int allocationSize(RequestBuilderException value) { + return value.allocationSize(); + } + + static int write(RequestBuilderException value, Uint8List buf) { + return value.write(buf) - buf.offsetInBytes; } } -class InvalidPublicKeyPsbtException extends PsbtException { - final String errorMessage; - InvalidPublicKeyPsbtException(String this.errorMessage); - InvalidPublicKeyPsbtException._(String this.errorMessage); - static LiftRetVal read(Uint8List buf) { +class RequestAlreadyConsumedRequestBuilderException + extends RequestBuilderException { + RequestAlreadyConsumedRequestBuilderException(); + RequestAlreadyConsumedRequestBuilderException._(); + static LiftRetVal read( + Uint8List buf, + ) { int new_offset = buf.offsetInBytes; - final errorMessage_lifted = FfiConverterString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final errorMessage = errorMessage_lifted.value; - new_offset += errorMessage_lifted.bytesRead; return LiftRetVal( - InvalidPublicKeyPsbtException._(errorMessage), + RequestAlreadyConsumedRequestBuilderException._(), new_offset, ); } @@ -14892,43 +15228,87 @@ class InvalidPublicKeyPsbtException extends PsbtException { @override int allocationSize() { - return FfiConverterString.allocationSize(errorMessage) + 4; + return 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 20); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - errorMessage, - Uint8List.view(buf.buffer, new_offset), - ); return new_offset; } @override String toString() { - return "InvalidPublicKeyPsbtException($errorMessage)"; + return "RequestAlreadyConsumedRequestBuilderException"; } } -class InvalidSecp256k1PublicKeyPsbtException extends PsbtException { - final String secp256k1Error; - InvalidSecp256k1PublicKeyPsbtException(String this.secp256k1Error); - InvalidSecp256k1PublicKeyPsbtException._(String this.secp256k1Error); - static LiftRetVal read( - Uint8List buf, - ) { +class RequestBuilderExceptionErrorHandler + extends UniffiRustCallStatusErrorHandler { + @override + Exception lift(RustBuffer errorBuf) { + return FfiConverterRequestBuilderException.lift(errorBuf); + } +} + +final RequestBuilderExceptionErrorHandler requestBuilderExceptionErrorHandler = + RequestBuilderExceptionErrorHandler(); + +abstract class SighashParseException implements Exception { + RustBuffer lower(); + int allocationSize(); + int write(Uint8List buf); +} + +class FfiConverterSighashParseException { + static SighashParseException lift(RustBuffer buffer) { + return FfiConverterSighashParseException.read(buffer.asUint8List()).value; + } + + static LiftRetVal read(Uint8List buf) { + final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); + final subview = Uint8List.view(buf.buffer, buf.offsetInBytes + 4); + switch (index) { + case 1: + final lifted = InvalidSighashParseException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + default: + throw UniffiInternalError( + UniffiInternalError.unexpectedEnumCase, + "Unable to determine enum variant", + ); + } + } + + static RustBuffer lower(SighashParseException value) { + return value.lower(); + } + + static int allocationSize(SighashParseException value) { + return value.allocationSize(); + } + + static int write(SighashParseException value, Uint8List buf) { + return value.write(buf) - buf.offsetInBytes; + } +} + +class InvalidSighashParseException extends SighashParseException { + final String errorMessage; + InvalidSighashParseException(String this.errorMessage); + InvalidSighashParseException._(String this.errorMessage); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final secp256k1Error_lifted = FfiConverterString.read( + final errorMessage_lifted = FfiConverterString.read( Uint8List.view(buf.buffer, new_offset), ); - final secp256k1Error = secp256k1Error_lifted.value; - new_offset += secp256k1Error_lifted.bytesRead; - return LiftRetVal( - InvalidSecp256k1PublicKeyPsbtException._(secp256k1Error), - new_offset, - ); + final errorMessage = errorMessage_lifted.value; + new_offset += errorMessage_lifted.bytesRead; + return LiftRetVal(InvalidSighashParseException._(errorMessage), new_offset); } @override @@ -14940,15 +15320,15 @@ class InvalidSecp256k1PublicKeyPsbtException extends PsbtException { @override int allocationSize() { - return FfiConverterString.allocationSize(secp256k1Error) + 4; + return FfiConverterString.allocationSize(errorMessage) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 21); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); int new_offset = buf.offsetInBytes + 4; new_offset += FfiConverterString.write( - secp256k1Error, + errorMessage, Uint8List.view(buf.buffer, new_offset), ); return new_offset; @@ -14956,58 +15336,165 @@ class InvalidSecp256k1PublicKeyPsbtException extends PsbtException { @override String toString() { - return "InvalidSecp256k1PublicKeyPsbtException($secp256k1Error)"; + return "InvalidSighashParseException($errorMessage)"; } } -class InvalidXOnlyPublicKeyPsbtException extends PsbtException { - InvalidXOnlyPublicKeyPsbtException(); - InvalidXOnlyPublicKeyPsbtException._(); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - return LiftRetVal(InvalidXOnlyPublicKeyPsbtException._(), new_offset); +class SighashParseExceptionErrorHandler + extends UniffiRustCallStatusErrorHandler { + @override + Exception lift(RustBuffer errorBuf) { + return FfiConverterSighashParseException.lift(errorBuf); } +} - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); +final SighashParseExceptionErrorHandler sighashParseExceptionErrorHandler = + SighashParseExceptionErrorHandler(); + +abstract class SignerException implements Exception { + RustBuffer lower(); + int allocationSize(); + int write(Uint8List buf); +} + +class FfiConverterSignerException { + static SignerException lift(RustBuffer buffer) { + return FfiConverterSignerException.read(buffer.asUint8List()).value; } - @override - int allocationSize() { - return 4; + static LiftRetVal read(Uint8List buf) { + final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); + final subview = Uint8List.view(buf.buffer, buf.offsetInBytes + 4); + switch (index) { + case 1: + final lifted = MissingKeySignerException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 2: + final lifted = InvalidKeySignerException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 3: + final lifted = UserCanceledSignerException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 4: + final lifted = InputIndexOutOfRangeSignerException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 5: + final lifted = MissingNonWitnessUtxoSignerException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 6: + final lifted = InvalidNonWitnessUtxoSignerException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 7: + final lifted = MissingWitnessUtxoSignerException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 8: + final lifted = MissingWitnessScriptSignerException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 9: + final lifted = MissingHdKeypathSignerException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 10: + final lifted = NonStandardSighashSignerException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 11: + final lifted = InvalidSighashSignerException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 12: + final lifted = SighashP2wpkhSignerException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 13: + final lifted = SighashTaprootSignerException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 14: + final lifted = TxInputsIndexExceptionSignerException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 15: + final lifted = MiniscriptPsbtSignerException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 16: + final lifted = ExternalSignerException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 17: + final lifted = PsbtSignerException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + default: + throw UniffiInternalError( + UniffiInternalError.unexpectedEnumCase, + "Unable to determine enum variant", + ); + } } - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 22); - int new_offset = buf.offsetInBytes + 4; - return new_offset; + static RustBuffer lower(SignerException value) { + return value.lower(); } - @override - String toString() { - return "InvalidXOnlyPublicKeyPsbtException"; + static int allocationSize(SignerException value) { + return value.allocationSize(); + } + + static int write(SignerException value, Uint8List buf) { + return value.write(buf) - buf.offsetInBytes; } } -class InvalidEcdsaSignaturePsbtException extends PsbtException { - final String errorMessage; - InvalidEcdsaSignaturePsbtException(String this.errorMessage); - InvalidEcdsaSignaturePsbtException._(String this.errorMessage); - static LiftRetVal read(Uint8List buf) { +class MissingKeySignerException extends SignerException { + MissingKeySignerException(); + MissingKeySignerException._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final errorMessage_lifted = FfiConverterString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final errorMessage = errorMessage_lifted.value; - new_offset += errorMessage_lifted.bytesRead; - return LiftRetVal( - InvalidEcdsaSignaturePsbtException._(errorMessage), - new_offset, - ); + return LiftRetVal(MissingKeySignerException._(), new_offset); } @override @@ -15019,41 +15506,28 @@ class InvalidEcdsaSignaturePsbtException extends PsbtException { @override int allocationSize() { - return FfiConverterString.allocationSize(errorMessage) + 4; + return 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 23); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - errorMessage, - Uint8List.view(buf.buffer, new_offset), - ); return new_offset; } @override String toString() { - return "InvalidEcdsaSignaturePsbtException($errorMessage)"; + return "MissingKeySignerException"; } } -class InvalidTaprootSignaturePsbtException extends PsbtException { - final String errorMessage; - InvalidTaprootSignaturePsbtException(String this.errorMessage); - InvalidTaprootSignaturePsbtException._(String this.errorMessage); - static LiftRetVal read(Uint8List buf) { +class InvalidKeySignerException extends SignerException { + InvalidKeySignerException(); + InvalidKeySignerException._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final errorMessage_lifted = FfiConverterString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final errorMessage = errorMessage_lifted.value; - new_offset += errorMessage_lifted.bytesRead; - return LiftRetVal( - InvalidTaprootSignaturePsbtException._(errorMessage), - new_offset, - ); + return LiftRetVal(InvalidKeySignerException._(), new_offset); } @override @@ -15065,32 +15539,28 @@ class InvalidTaprootSignaturePsbtException extends PsbtException { @override int allocationSize() { - return FfiConverterString.allocationSize(errorMessage) + 4; + return 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 24); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 2); int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - errorMessage, - Uint8List.view(buf.buffer, new_offset), - ); return new_offset; } @override String toString() { - return "InvalidTaprootSignaturePsbtException($errorMessage)"; + return "InvalidKeySignerException"; } } -class InvalidControlBlockPsbtException extends PsbtException { - InvalidControlBlockPsbtException(); - InvalidControlBlockPsbtException._(); - static LiftRetVal read(Uint8List buf) { +class UserCanceledSignerException extends SignerException { + UserCanceledSignerException(); + UserCanceledSignerException._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(InvalidControlBlockPsbtException._(), new_offset); + return LiftRetVal(UserCanceledSignerException._(), new_offset); } @override @@ -15107,23 +15577,23 @@ class InvalidControlBlockPsbtException extends PsbtException { @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 25); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 3); int new_offset = buf.offsetInBytes + 4; return new_offset; } @override String toString() { - return "InvalidControlBlockPsbtException"; + return "UserCanceledSignerException"; } } -class InvalidLeafVersionPsbtException extends PsbtException { - InvalidLeafVersionPsbtException(); - InvalidLeafVersionPsbtException._(); - static LiftRetVal read(Uint8List buf) { +class InputIndexOutOfRangeSignerException extends SignerException { + InputIndexOutOfRangeSignerException(); + InputIndexOutOfRangeSignerException._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(InvalidLeafVersionPsbtException._(), new_offset); + return LiftRetVal(InputIndexOutOfRangeSignerException._(), new_offset); } @override @@ -15140,23 +15610,23 @@ class InvalidLeafVersionPsbtException extends PsbtException { @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 26); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 4); int new_offset = buf.offsetInBytes + 4; return new_offset; } @override String toString() { - return "InvalidLeafVersionPsbtException"; + return "InputIndexOutOfRangeSignerException"; } } -class TaprootPsbtException extends PsbtException { - TaprootPsbtException(); - TaprootPsbtException._(); - static LiftRetVal read(Uint8List buf) { +class MissingNonWitnessUtxoSignerException extends SignerException { + MissingNonWitnessUtxoSignerException(); + MissingNonWitnessUtxoSignerException._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(TaprootPsbtException._(), new_offset); + return LiftRetVal(MissingNonWitnessUtxoSignerException._(), new_offset); } @override @@ -15173,29 +15643,23 @@ class TaprootPsbtException extends PsbtException { @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 27); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 5); int new_offset = buf.offsetInBytes + 4; return new_offset; } @override String toString() { - return "TaprootPsbtException"; + return "MissingNonWitnessUtxoSignerException"; } } -class TapTreePsbtException extends PsbtException { - final String errorMessage; - TapTreePsbtException(String this.errorMessage); - TapTreePsbtException._(String this.errorMessage); - static LiftRetVal read(Uint8List buf) { +class InvalidNonWitnessUtxoSignerException extends SignerException { + InvalidNonWitnessUtxoSignerException(); + InvalidNonWitnessUtxoSignerException._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final errorMessage_lifted = FfiConverterString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final errorMessage = errorMessage_lifted.value; - new_offset += errorMessage_lifted.bytesRead; - return LiftRetVal(TapTreePsbtException._(errorMessage), new_offset); + return LiftRetVal(InvalidNonWitnessUtxoSignerException._(), new_offset); } @override @@ -15207,32 +15671,28 @@ class TapTreePsbtException extends PsbtException { @override int allocationSize() { - return FfiConverterString.allocationSize(errorMessage) + 4; + return 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 28); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 6); int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - errorMessage, - Uint8List.view(buf.buffer, new_offset), - ); return new_offset; } @override String toString() { - return "TapTreePsbtException($errorMessage)"; + return "InvalidNonWitnessUtxoSignerException"; } } -class XPubKeyPsbtException extends PsbtException { - XPubKeyPsbtException(); - XPubKeyPsbtException._(); - static LiftRetVal read(Uint8List buf) { +class MissingWitnessUtxoSignerException extends SignerException { + MissingWitnessUtxoSignerException(); + MissingWitnessUtxoSignerException._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(XPubKeyPsbtException._(), new_offset); + return LiftRetVal(MissingWitnessUtxoSignerException._(), new_offset); } @override @@ -15249,29 +15709,23 @@ class XPubKeyPsbtException extends PsbtException { @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 29); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 7); int new_offset = buf.offsetInBytes + 4; return new_offset; } @override String toString() { - return "XPubKeyPsbtException"; + return "MissingWitnessUtxoSignerException"; } } -class VersionPsbtException extends PsbtException { - final String errorMessage; - VersionPsbtException(String this.errorMessage); - VersionPsbtException._(String this.errorMessage); - static LiftRetVal read(Uint8List buf) { +class MissingWitnessScriptSignerException extends SignerException { + MissingWitnessScriptSignerException(); + MissingWitnessScriptSignerException._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final errorMessage_lifted = FfiConverterString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final errorMessage = errorMessage_lifted.value; - new_offset += errorMessage_lifted.bytesRead; - return LiftRetVal(VersionPsbtException._(errorMessage), new_offset); + return LiftRetVal(MissingWitnessScriptSignerException._(), new_offset); } @override @@ -15283,32 +15737,28 @@ class VersionPsbtException extends PsbtException { @override int allocationSize() { - return FfiConverterString.allocationSize(errorMessage) + 4; + return 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 30); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 8); int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - errorMessage, - Uint8List.view(buf.buffer, new_offset), - ); return new_offset; } @override String toString() { - return "VersionPsbtException($errorMessage)"; + return "MissingWitnessScriptSignerException"; } } -class PartialDataConsumptionPsbtException extends PsbtException { - PartialDataConsumptionPsbtException(); - PartialDataConsumptionPsbtException._(); - static LiftRetVal read(Uint8List buf) { +class MissingHdKeypathSignerException extends SignerException { + MissingHdKeypathSignerException(); + MissingHdKeypathSignerException._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(PartialDataConsumptionPsbtException._(), new_offset); + return LiftRetVal(MissingHdKeypathSignerException._(), new_offset); } @override @@ -15325,29 +15775,23 @@ class PartialDataConsumptionPsbtException extends PsbtException { @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 31); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 9); int new_offset = buf.offsetInBytes + 4; return new_offset; } @override String toString() { - return "PartialDataConsumptionPsbtException"; + return "MissingHdKeypathSignerException"; } } -class IoPsbtException extends PsbtException { - final String errorMessage; - IoPsbtException(String this.errorMessage); - IoPsbtException._(String this.errorMessage); - static LiftRetVal read(Uint8List buf) { +class NonStandardSighashSignerException extends SignerException { + NonStandardSighashSignerException(); + NonStandardSighashSignerException._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final errorMessage_lifted = FfiConverterString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final errorMessage = errorMessage_lifted.value; - new_offset += errorMessage_lifted.bytesRead; - return LiftRetVal(IoPsbtException._(errorMessage), new_offset); + return LiftRetVal(NonStandardSighashSignerException._(), new_offset); } @override @@ -15359,32 +15803,28 @@ class IoPsbtException extends PsbtException { @override int allocationSize() { - return FfiConverterString.allocationSize(errorMessage) + 4; + return 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 32); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 10); int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - errorMessage, - Uint8List.view(buf.buffer, new_offset), - ); return new_offset; } @override String toString() { - return "IoPsbtException($errorMessage)"; + return "NonStandardSighashSignerException"; } } -class OtherPsbtErrPsbtException extends PsbtException { - OtherPsbtErrPsbtException(); - OtherPsbtErrPsbtException._(); - static LiftRetVal read(Uint8List buf) { +class InvalidSighashSignerException extends SignerException { + InvalidSighashSignerException(); + InvalidSighashSignerException._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(OtherPsbtErrPsbtException._(), new_offset); + return LiftRetVal(InvalidSighashSignerException._(), new_offset); } @override @@ -15401,103 +15841,73 @@ class OtherPsbtErrPsbtException extends PsbtException { @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 33); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 11); int new_offset = buf.offsetInBytes + 4; return new_offset; } @override String toString() { - return "OtherPsbtErrPsbtException"; - } -} - -class PsbtExceptionErrorHandler extends UniffiRustCallStatusErrorHandler { - @override - Exception lift(RustBuffer errorBuf) { - return FfiConverterPsbtException.lift(errorBuf); + return "InvalidSighashSignerException"; } } -final PsbtExceptionErrorHandler psbtExceptionErrorHandler = - PsbtExceptionErrorHandler(); - -abstract class PsbtFinalizeException implements Exception { - RustBuffer lower(); - int allocationSize(); - int write(Uint8List buf); -} - -class FfiConverterPsbtFinalizeException { - static PsbtFinalizeException lift(RustBuffer buffer) { - return FfiConverterPsbtFinalizeException.read(buffer.asUint8List()).value; +class SighashP2wpkhSignerException extends SignerException { + final String errorMessage; + SighashP2wpkhSignerException(String this.errorMessage); + SighashP2wpkhSignerException._(String this.errorMessage); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final errorMessage_lifted = FfiConverterString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final errorMessage = errorMessage_lifted.value; + new_offset += errorMessage_lifted.bytesRead; + return LiftRetVal(SighashP2wpkhSignerException._(errorMessage), new_offset); } - static LiftRetVal read(Uint8List buf) { - final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); - final subview = Uint8List.view(buf.buffer, buf.offsetInBytes + 4); - switch (index) { - case 1: - final lifted = InputExceptionPsbtFinalizeException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 2: - final lifted = WrongInputCountPsbtFinalizeException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 3: - final lifted = InputIdxOutofBoundsPsbtFinalizeException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - default: - throw UniffiInternalError( - UniffiInternalError.unexpectedEnumCase, - "Unable to determine enum variant", - ); - } + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); } - static RustBuffer lower(PsbtFinalizeException value) { - return value.lower(); + @override + int allocationSize() { + return FfiConverterString.allocationSize(errorMessage) + 4; } - static int allocationSize(PsbtFinalizeException value) { - return value.allocationSize(); + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 12); + int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterString.write( + errorMessage, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset; } - static int write(PsbtFinalizeException value, Uint8List buf) { - return value.write(buf) - buf.offsetInBytes; + @override + String toString() { + return "SighashP2wpkhSignerException($errorMessage)"; } } -class InputExceptionPsbtFinalizeException extends PsbtFinalizeException { - final String reason; - final int index; - InputExceptionPsbtFinalizeException({ - required String this.reason, - required int this.index, - }); - InputExceptionPsbtFinalizeException._(String this.reason, int this.index); - static LiftRetVal read(Uint8List buf) { +class SighashTaprootSignerException extends SignerException { + final String errorMessage; + SighashTaprootSignerException(String this.errorMessage); + SighashTaprootSignerException._(String this.errorMessage); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final reason_lifted = FfiConverterString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final reason = reason_lifted.value; - new_offset += reason_lifted.bytesRead; - final index_lifted = FfiConverterUInt32.read( + final errorMessage_lifted = FfiConverterString.read( Uint8List.view(buf.buffer, new_offset), ); - final index = index_lifted.value; - new_offset += index_lifted.bytesRead; + final errorMessage = errorMessage_lifted.value; + new_offset += errorMessage_lifted.bytesRead; return LiftRetVal( - InputExceptionPsbtFinalizeException._(reason, index), + SighashTaprootSignerException._(errorMessage), new_offset, ); } @@ -15511,21 +15921,15 @@ class InputExceptionPsbtFinalizeException extends PsbtFinalizeException { @override int allocationSize() { - return FfiConverterString.allocationSize(reason) + - FfiConverterUInt32.allocationSize(index) + - 4; + return FfiConverterString.allocationSize(errorMessage) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 13); int new_offset = buf.offsetInBytes + 4; new_offset += FfiConverterString.write( - reason, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterUInt32.write( - index, + errorMessage, Uint8List.view(buf.buffer, new_offset), ); return new_offset; @@ -15533,32 +15937,23 @@ class InputExceptionPsbtFinalizeException extends PsbtFinalizeException { @override String toString() { - return "InputExceptionPsbtFinalizeException($reason, $index)"; + return "SighashTaprootSignerException($errorMessage)"; } } -class WrongInputCountPsbtFinalizeException extends PsbtFinalizeException { - final int inTx; - final int inMap; - WrongInputCountPsbtFinalizeException({ - required int this.inTx, - required int this.inMap, - }); - WrongInputCountPsbtFinalizeException._(int this.inTx, int this.inMap); - static LiftRetVal read(Uint8List buf) { +class TxInputsIndexExceptionSignerException extends SignerException { + final String errorMessage; + TxInputsIndexExceptionSignerException(String this.errorMessage); + TxInputsIndexExceptionSignerException._(String this.errorMessage); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final inTx_lifted = FfiConverterUInt32.read( - Uint8List.view(buf.buffer, new_offset), - ); - final inTx = inTx_lifted.value; - new_offset += inTx_lifted.bytesRead; - final inMap_lifted = FfiConverterUInt32.read( + final errorMessage_lifted = FfiConverterString.read( Uint8List.view(buf.buffer, new_offset), ); - final inMap = inMap_lifted.value; - new_offset += inMap_lifted.bytesRead; + final errorMessage = errorMessage_lifted.value; + new_offset += errorMessage_lifted.bytesRead; return LiftRetVal( - WrongInputCountPsbtFinalizeException._(inTx, inMap), + TxInputsIndexExceptionSignerException._(errorMessage), new_offset, ); } @@ -15572,21 +15967,15 @@ class WrongInputCountPsbtFinalizeException extends PsbtFinalizeException { @override int allocationSize() { - return FfiConverterUInt32.allocationSize(inTx) + - FfiConverterUInt32.allocationSize(inMap) + - 4; + return FfiConverterString.allocationSize(errorMessage) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 2); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 14); int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterUInt32.write( - inTx, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterUInt32.write( - inMap, + new_offset += FfiConverterString.write( + errorMessage, Uint8List.view(buf.buffer, new_offset), ); return new_offset; @@ -15594,37 +15983,23 @@ class WrongInputCountPsbtFinalizeException extends PsbtFinalizeException { @override String toString() { - return "WrongInputCountPsbtFinalizeException($inTx, $inMap)"; + return "TxInputsIndexExceptionSignerException($errorMessage)"; } } -class InputIdxOutofBoundsPsbtFinalizeException extends PsbtFinalizeException { - final int psbtInp; - final int requested; - InputIdxOutofBoundsPsbtFinalizeException({ - required int this.psbtInp, - required int this.requested, - }); - InputIdxOutofBoundsPsbtFinalizeException._( - int this.psbtInp, - int this.requested, - ); - static LiftRetVal read( - Uint8List buf, - ) { +class MiniscriptPsbtSignerException extends SignerException { + final String errorMessage; + MiniscriptPsbtSignerException(String this.errorMessage); + MiniscriptPsbtSignerException._(String this.errorMessage); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final psbtInp_lifted = FfiConverterUInt32.read( - Uint8List.view(buf.buffer, new_offset), - ); - final psbtInp = psbtInp_lifted.value; - new_offset += psbtInp_lifted.bytesRead; - final requested_lifted = FfiConverterUInt32.read( + final errorMessage_lifted = FfiConverterString.read( Uint8List.view(buf.buffer, new_offset), ); - final requested = requested_lifted.value; - new_offset += requested_lifted.bytesRead; + final errorMessage = errorMessage_lifted.value; + new_offset += errorMessage_lifted.bytesRead; return LiftRetVal( - InputIdxOutofBoundsPsbtFinalizeException._(psbtInp, requested), + MiniscriptPsbtSignerException._(errorMessage), new_offset, ); } @@ -15638,21 +16013,15 @@ class InputIdxOutofBoundsPsbtFinalizeException extends PsbtFinalizeException { @override int allocationSize() { - return FfiConverterUInt32.allocationSize(psbtInp) + - FfiConverterUInt32.allocationSize(requested) + - 4; + return FfiConverterString.allocationSize(errorMessage) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 3); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 15); int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterUInt32.write( - psbtInp, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterUInt32.write( - requested, + new_offset += FfiConverterString.write( + errorMessage, Uint8List.view(buf.buffer, new_offset), ); return new_offset; @@ -15660,84 +16029,22 @@ class InputIdxOutofBoundsPsbtFinalizeException extends PsbtFinalizeException { @override String toString() { - return "InputIdxOutofBoundsPsbtFinalizeException($psbtInp, $requested)"; - } -} - -class PsbtFinalizeExceptionErrorHandler - extends UniffiRustCallStatusErrorHandler { - @override - Exception lift(RustBuffer errorBuf) { - return FfiConverterPsbtFinalizeException.lift(errorBuf); - } -} - -final PsbtFinalizeExceptionErrorHandler psbtFinalizeExceptionErrorHandler = - PsbtFinalizeExceptionErrorHandler(); - -abstract class PsbtParseException implements Exception { - RustBuffer lower(); - int allocationSize(); - int write(Uint8List buf); -} - -class FfiConverterPsbtParseException { - static PsbtParseException lift(RustBuffer buffer) { - return FfiConverterPsbtParseException.read(buffer.asUint8List()).value; - } - - static LiftRetVal read(Uint8List buf) { - final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); - final subview = Uint8List.view(buf.buffer, buf.offsetInBytes + 4); - switch (index) { - case 1: - final lifted = PsbtEncodingPsbtParseException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 2: - final lifted = Base64EncodingPsbtParseException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - default: - throw UniffiInternalError( - UniffiInternalError.unexpectedEnumCase, - "Unable to determine enum variant", - ); - } - } - - static RustBuffer lower(PsbtParseException value) { - return value.lower(); - } - - static int allocationSize(PsbtParseException value) { - return value.allocationSize(); - } - - static int write(PsbtParseException value, Uint8List buf) { - return value.write(buf) - buf.offsetInBytes; + return "MiniscriptPsbtSignerException($errorMessage)"; } } -class PsbtEncodingPsbtParseException extends PsbtParseException { +class ExternalSignerException extends SignerException { final String errorMessage; - PsbtEncodingPsbtParseException(String this.errorMessage); - PsbtEncodingPsbtParseException._(String this.errorMessage); - static LiftRetVal read(Uint8List buf) { + ExternalSignerException(String this.errorMessage); + ExternalSignerException._(String this.errorMessage); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; final errorMessage_lifted = FfiConverterString.read( Uint8List.view(buf.buffer, new_offset), ); final errorMessage = errorMessage_lifted.value; new_offset += errorMessage_lifted.bytesRead; - return LiftRetVal( - PsbtEncodingPsbtParseException._(errorMessage), - new_offset, - ); + return LiftRetVal(ExternalSignerException._(errorMessage), new_offset); } @override @@ -15754,7 +16061,7 @@ class PsbtEncodingPsbtParseException extends PsbtParseException { @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 16); int new_offset = buf.offsetInBytes + 4; new_offset += FfiConverterString.write( errorMessage, @@ -15765,25 +16072,22 @@ class PsbtEncodingPsbtParseException extends PsbtParseException { @override String toString() { - return "PsbtEncodingPsbtParseException($errorMessage)"; + return "ExternalSignerException($errorMessage)"; } } -class Base64EncodingPsbtParseException extends PsbtParseException { +class PsbtSignerException extends SignerException { final String errorMessage; - Base64EncodingPsbtParseException(String this.errorMessage); - Base64EncodingPsbtParseException._(String this.errorMessage); - static LiftRetVal read(Uint8List buf) { + PsbtSignerException(String this.errorMessage); + PsbtSignerException._(String this.errorMessage); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; final errorMessage_lifted = FfiConverterString.read( Uint8List.view(buf.buffer, new_offset), ); final errorMessage = errorMessage_lifted.value; new_offset += errorMessage_lifted.bytesRead; - return LiftRetVal( - Base64EncodingPsbtParseException._(errorMessage), - new_offset, - ); + return LiftRetVal(PsbtSignerException._(errorMessage), new_offset); } @override @@ -15800,7 +16104,7 @@ class Base64EncodingPsbtParseException extends PsbtParseException { @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 2); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 17); int new_offset = buf.offsetInBytes + 4; new_offset += FfiConverterString.write( errorMessage, @@ -15811,56 +16115,76 @@ class Base64EncodingPsbtParseException extends PsbtParseException { @override String toString() { - return "Base64EncodingPsbtParseException($errorMessage)"; + return "PsbtSignerException($errorMessage)"; } } -class PsbtParseExceptionErrorHandler extends UniffiRustCallStatusErrorHandler { +class SignerExceptionErrorHandler extends UniffiRustCallStatusErrorHandler { @override Exception lift(RustBuffer errorBuf) { - return FfiConverterPsbtParseException.lift(errorBuf); + return FfiConverterSignerException.lift(errorBuf); } } -final PsbtParseExceptionErrorHandler psbtParseExceptionErrorHandler = - PsbtParseExceptionErrorHandler(); +final SignerExceptionErrorHandler signerExceptionErrorHandler = + SignerExceptionErrorHandler(); -abstract class RecoveryPoint { +abstract class TransactionException implements Exception { RustBuffer lower(); int allocationSize(); int write(Uint8List buf); } -class FfiConverterRecoveryPoint { - static RecoveryPoint lift(RustBuffer buffer) { - return FfiConverterRecoveryPoint.read(buffer.asUint8List()).value; +class FfiConverterTransactionException { + static TransactionException lift(RustBuffer buffer) { + return FfiConverterTransactionException.read(buffer.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); final subview = Uint8List.view(buf.buffer, buf.offsetInBytes + 4); switch (index) { case 1: - final lifted = GenesisBlockRecoveryPoint.read(subview); - return LiftRetVal( + final lifted = IoTransactionException.read(subview); + return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); case 2: - final lifted = SegwitActivationRecoveryPoint.read(subview); - return LiftRetVal( + final lifted = OversizedVectorAllocationTransactionException.read( + subview, + ); + return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); case 3: - final lifted = TaprootActivationRecoveryPoint.read(subview); - return LiftRetVal( + final lifted = InvalidChecksumTransactionException.read(subview); + return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); case 4: - final lifted = OtherRecoveryPoint.read(subview); - return LiftRetVal( + final lifted = NonMinimalVarIntTransactionException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 5: + final lifted = ParseFailedTransactionException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 6: + final lifted = UnsupportedSegwitFlagTransactionException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 7: + final lifted = OtherTransactionErrTransactionException.read(subview); + return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); @@ -15872,25 +16196,118 @@ class FfiConverterRecoveryPoint { } } - static RustBuffer lower(RecoveryPoint value) { - return value.lower(); + static RustBuffer lower(TransactionException value) { + return value.lower(); + } + + static int allocationSize(TransactionException value) { + return value.allocationSize(); + } + + static int write(TransactionException value, Uint8List buf) { + return value.write(buf) - buf.offsetInBytes; + } +} + +class IoTransactionException extends TransactionException { + IoTransactionException(); + IoTransactionException._(); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + return LiftRetVal(IoTransactionException._(), new_offset); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); + int new_offset = buf.offsetInBytes + 4; + return new_offset; + } + + @override + String toString() { + return "IoTransactionException"; + } +} + +class OversizedVectorAllocationTransactionException + extends TransactionException { + OversizedVectorAllocationTransactionException(); + OversizedVectorAllocationTransactionException._(); + static LiftRetVal read( + Uint8List buf, + ) { + int new_offset = buf.offsetInBytes; + return LiftRetVal( + OversizedVectorAllocationTransactionException._(), + new_offset, + ); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return 4; } - static int allocationSize(RecoveryPoint value) { - return value.allocationSize(); + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 2); + int new_offset = buf.offsetInBytes + 4; + return new_offset; } - static int write(RecoveryPoint value, Uint8List buf) { - return value.write(buf) - buf.offsetInBytes; + @override + String toString() { + return "OversizedVectorAllocationTransactionException"; } } -class GenesisBlockRecoveryPoint extends RecoveryPoint { - GenesisBlockRecoveryPoint(); - GenesisBlockRecoveryPoint._(); - static LiftRetVal read(Uint8List buf) { +class InvalidChecksumTransactionException extends TransactionException { + final String expected; + final String actual; + InvalidChecksumTransactionException({ + required String this.expected, + required String this.actual, + }); + InvalidChecksumTransactionException._( + String this.expected, + String this.actual, + ); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(GenesisBlockRecoveryPoint._(), new_offset); + final expected_lifted = FfiConverterString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final expected = expected_lifted.value; + new_offset += expected_lifted.bytesRead; + final actual_lifted = FfiConverterString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final actual = actual_lifted.value; + new_offset += actual_lifted.bytesRead; + return LiftRetVal( + InvalidChecksumTransactionException._(expected, actual), + new_offset, + ); } @override @@ -15902,23 +16319,38 @@ class GenesisBlockRecoveryPoint extends RecoveryPoint { @override int allocationSize() { - return 4; + return FfiConverterString.allocationSize(expected) + + FfiConverterString.allocationSize(actual) + + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 3); int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterString.write( + expected, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterString.write( + actual, + Uint8List.view(buf.buffer, new_offset), + ); return new_offset; } + + @override + String toString() { + return "InvalidChecksumTransactionException($expected, $actual)"; + } } -class SegwitActivationRecoveryPoint extends RecoveryPoint { - SegwitActivationRecoveryPoint(); - SegwitActivationRecoveryPoint._(); - static LiftRetVal read(Uint8List buf) { +class NonMinimalVarIntTransactionException extends TransactionException { + NonMinimalVarIntTransactionException(); + NonMinimalVarIntTransactionException._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(SegwitActivationRecoveryPoint._(), new_offset); + return LiftRetVal(NonMinimalVarIntTransactionException._(), new_offset); } @override @@ -15935,18 +16367,23 @@ class SegwitActivationRecoveryPoint extends RecoveryPoint { @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 2); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 4); int new_offset = buf.offsetInBytes + 4; return new_offset; } + + @override + String toString() { + return "NonMinimalVarIntTransactionException"; + } } -class TaprootActivationRecoveryPoint extends RecoveryPoint { - TaprootActivationRecoveryPoint(); - TaprootActivationRecoveryPoint._(); - static LiftRetVal read(Uint8List buf) { +class ParseFailedTransactionException extends TransactionException { + ParseFailedTransactionException(); + ParseFailedTransactionException._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(TaprootActivationRecoveryPoint._(), new_offset); + return LiftRetVal(ParseFailedTransactionException._(), new_offset); } @override @@ -15963,24 +16400,34 @@ class TaprootActivationRecoveryPoint extends RecoveryPoint { @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 3); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 5); int new_offset = buf.offsetInBytes + 4; return new_offset; } + + @override + String toString() { + return "ParseFailedTransactionException"; + } } -class OtherRecoveryPoint extends RecoveryPoint { - final BlockId birthday; - OtherRecoveryPoint(BlockId this.birthday); - OtherRecoveryPoint._(BlockId this.birthday); - static LiftRetVal read(Uint8List buf) { +class UnsupportedSegwitFlagTransactionException extends TransactionException { + final int flag; + UnsupportedSegwitFlagTransactionException(int this.flag); + UnsupportedSegwitFlagTransactionException._(int this.flag); + static LiftRetVal read( + Uint8List buf, + ) { int new_offset = buf.offsetInBytes; - final birthday_lifted = FfiConverterBlockId.read( + final flag_lifted = FfiConverterUInt8.read( Uint8List.view(buf.buffer, new_offset), ); - final birthday = birthday_lifted.value; - new_offset += birthday_lifted.bytesRead; - return LiftRetVal(OtherRecoveryPoint._(birthday), new_offset); + final flag = flag_lifted.value; + new_offset += flag_lifted.bytesRead; + return LiftRetVal( + UnsupportedSegwitFlagTransactionException._(flag), + new_offset, + ); } @override @@ -15992,77 +16439,34 @@ class OtherRecoveryPoint extends RecoveryPoint { @override int allocationSize() { - return FfiConverterBlockId.allocationSize(birthday) + 4; + return FfiConverterUInt8.allocationSize(flag) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 4); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 6); int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterBlockId.write( - birthday, + new_offset += FfiConverterUInt8.write( + flag, Uint8List.view(buf.buffer, new_offset), ); return new_offset; } -} - -abstract class RequestBuilderException implements Exception { - RustBuffer lower(); - int allocationSize(); - int write(Uint8List buf); -} - -class FfiConverterRequestBuilderException { - static RequestBuilderException lift(RustBuffer buffer) { - return FfiConverterRequestBuilderException.read(buffer.asUint8List()).value; - } - - static LiftRetVal read(Uint8List buf) { - final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); - final subview = Uint8List.view(buf.buffer, buf.offsetInBytes + 4); - switch (index) { - case 1: - final lifted = RequestAlreadyConsumedRequestBuilderException.read( - subview, - ); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - default: - throw UniffiInternalError( - UniffiInternalError.unexpectedEnumCase, - "Unable to determine enum variant", - ); - } - } - - static RustBuffer lower(RequestBuilderException value) { - return value.lower(); - } - - static int allocationSize(RequestBuilderException value) { - return value.allocationSize(); - } - static int write(RequestBuilderException value, Uint8List buf) { - return value.write(buf) - buf.offsetInBytes; + @override + String toString() { + return "UnsupportedSegwitFlagTransactionException($flag)"; } } -class RequestAlreadyConsumedRequestBuilderException - extends RequestBuilderException { - RequestAlreadyConsumedRequestBuilderException(); - RequestAlreadyConsumedRequestBuilderException._(); - static LiftRetVal read( +class OtherTransactionErrTransactionException extends TransactionException { + OtherTransactionErrTransactionException(); + OtherTransactionErrTransactionException._(); + static LiftRetVal read( Uint8List buf, ) { int new_offset = buf.offsetInBytes; - return LiftRetVal( - RequestAlreadyConsumedRequestBuilderException._(), - new_offset, - ); + return LiftRetVal(OtherTransactionErrTransactionException._(), new_offset); } @override @@ -16079,64 +16483,46 @@ class RequestAlreadyConsumedRequestBuilderException @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 7); int new_offset = buf.offsetInBytes + 4; return new_offset; } @override String toString() { - return "RequestAlreadyConsumedRequestBuilderException"; + return "OtherTransactionErrTransactionException"; } } -class RequestBuilderExceptionErrorHandler +class TransactionExceptionErrorHandler extends UniffiRustCallStatusErrorHandler { @override Exception lift(RustBuffer errorBuf) { - return FfiConverterRequestBuilderException.lift(errorBuf); + return FfiConverterTransactionException.lift(errorBuf); } } -final RequestBuilderExceptionErrorHandler requestBuilderExceptionErrorHandler = - RequestBuilderExceptionErrorHandler(); +final TransactionExceptionErrorHandler transactionExceptionErrorHandler = + TransactionExceptionErrorHandler(); -abstract class Satisfaction { +abstract class TxidParseException implements Exception { RustBuffer lower(); int allocationSize(); int write(Uint8List buf); } -class FfiConverterSatisfaction { - static Satisfaction lift(RustBuffer buffer) { - return FfiConverterSatisfaction.read(buffer.asUint8List()).value; +class FfiConverterTxidParseException { + static TxidParseException lift(RustBuffer buffer) { + return FfiConverterTxidParseException.read(buffer.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); final subview = Uint8List.view(buf.buffer, buf.offsetInBytes + 4); switch (index) { case 1: - final lifted = PartialSatisfaction.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 2: - final lifted = PartialCompleteSatisfaction.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 3: - final lifted = CompleteSatisfaction.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 4: - final lifted = NoneSatisfaction.read(subview); - return LiftRetVal( + final lifted = InvalidTxidTxidParseException.read(subview); + return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); @@ -16148,70 +16534,31 @@ class FfiConverterSatisfaction { } } - static RustBuffer lower(Satisfaction value) { + static RustBuffer lower(TxidParseException value) { return value.lower(); } - static int allocationSize(Satisfaction value) { + static int allocationSize(TxidParseException value) { return value.allocationSize(); } - static int write(Satisfaction value, Uint8List buf) { + static int write(TxidParseException value, Uint8List buf) { return value.write(buf) - buf.offsetInBytes; } } -class PartialSatisfaction extends Satisfaction { - final int n; - final int m; - final List items; - final bool? sorted; - final Map> conditions; - PartialSatisfaction({ - required int this.n, - required int this.m, - required List this.items, - required bool? this.sorted, - required Map> this.conditions, - }); - PartialSatisfaction._( - int this.n, - int this.m, - List this.items, - bool? this.sorted, - Map> this.conditions, - ); - static LiftRetVal read(Uint8List buf) { +class InvalidTxidTxidParseException extends TxidParseException { + final String txid; + InvalidTxidTxidParseException(String this.txid); + InvalidTxidTxidParseException._(String this.txid); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final n_lifted = FfiConverterUInt64.read( - Uint8List.view(buf.buffer, new_offset), - ); - final n = n_lifted.value; - new_offset += n_lifted.bytesRead; - final m_lifted = FfiConverterUInt64.read( - Uint8List.view(buf.buffer, new_offset), - ); - final m = m_lifted.value; - new_offset += m_lifted.bytesRead; - final items_lifted = FfiConverterSequenceUInt64.read( - Uint8List.view(buf.buffer, new_offset), - ); - final items = items_lifted.value; - new_offset += items_lifted.bytesRead; - final sorted_lifted = FfiConverterOptionalBool.read( - Uint8List.view(buf.buffer, new_offset), - ); - final sorted = sorted_lifted.value; - new_offset += sorted_lifted.bytesRead; - final conditions_lifted = FfiConverterMapUInt32ToSequenceCondition.read( + final txid_lifted = FfiConverterString.read( Uint8List.view(buf.buffer, new_offset), ); - final conditions = conditions_lifted.value; - new_offset += conditions_lifted.bytesRead; - return LiftRetVal( - PartialSatisfaction._(n, m, items, sorted, conditions), - new_offset, - ); + final txid = txid_lifted.value; + new_offset += txid_lifted.bytesRead; + return LiftRetVal(InvalidTxidTxidParseException._(txid), new_offset); } @override @@ -16223,291 +16570,72 @@ class PartialSatisfaction extends Satisfaction { @override int allocationSize() { - return FfiConverterUInt64.allocationSize(n) + - FfiConverterUInt64.allocationSize(m) + - FfiConverterSequenceUInt64.allocationSize(items) + - FfiConverterOptionalBool.allocationSize(sorted) + - FfiConverterMapUInt32ToSequenceCondition.allocationSize(conditions) + - 4; + return FfiConverterString.allocationSize(txid) + 4; } @override int write(Uint8List buf) { buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterUInt64.write( - n, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterUInt64.write( - m, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterSequenceUInt64.write( - items, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalBool.write( - sorted, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterMapUInt32ToSequenceCondition.write( - conditions, + new_offset += FfiConverterString.write( + txid, Uint8List.view(buf.buffer, new_offset), ); return new_offset; } -} - -class PartialCompleteSatisfaction extends Satisfaction { - final int n; - final int m; - final List items; - final bool? sorted; - final Map, List> conditions; - PartialCompleteSatisfaction({ - required int this.n, - required int this.m, - required List this.items, - required bool? this.sorted, - required Map, List> this.conditions, - }); - PartialCompleteSatisfaction._( - int this.n, - int this.m, - List this.items, - bool? this.sorted, - Map, List> this.conditions, - ); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final n_lifted = FfiConverterUInt64.read( - Uint8List.view(buf.buffer, new_offset), - ); - final n = n_lifted.value; - new_offset += n_lifted.bytesRead; - final m_lifted = FfiConverterUInt64.read( - Uint8List.view(buf.buffer, new_offset), - ); - final m = m_lifted.value; - new_offset += m_lifted.bytesRead; - final items_lifted = FfiConverterSequenceUInt64.read( - Uint8List.view(buf.buffer, new_offset), - ); - final items = items_lifted.value; - new_offset += items_lifted.bytesRead; - final sorted_lifted = FfiConverterOptionalBool.read( - Uint8List.view(buf.buffer, new_offset), - ); - final sorted = sorted_lifted.value; - new_offset += sorted_lifted.bytesRead; - final conditions_lifted = - FfiConverterMapSequenceUInt32ToSequenceCondition.read( - Uint8List.view(buf.buffer, new_offset), - ); - final conditions = conditions_lifted.value; - new_offset += conditions_lifted.bytesRead; - return LiftRetVal( - PartialCompleteSatisfaction._(n, m, items, sorted, conditions), - new_offset, - ); - } - - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); - } - - @override - int allocationSize() { - return FfiConverterUInt64.allocationSize(n) + - FfiConverterUInt64.allocationSize(m) + - FfiConverterSequenceUInt64.allocationSize(items) + - FfiConverterOptionalBool.allocationSize(sorted) + - FfiConverterMapSequenceUInt32ToSequenceCondition.allocationSize( - conditions, - ) + - 4; - } @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 2); - int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterUInt64.write( - n, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterUInt64.write( - m, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterSequenceUInt64.write( - items, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalBool.write( - sorted, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterMapSequenceUInt32ToSequenceCondition.write( - conditions, - Uint8List.view(buf.buffer, new_offset), - ); - return new_offset; + String toString() { + return "InvalidTxidTxidParseException($txid)"; } } -class CompleteSatisfaction extends Satisfaction { - final Condition condition; - CompleteSatisfaction(Condition this.condition); - CompleteSatisfaction._(Condition this.condition); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final condition_lifted = FfiConverterCondition.read( - Uint8List.view(buf.buffer, new_offset), - ); - final condition = condition_lifted.value; - new_offset += condition_lifted.bytesRead; - return LiftRetVal(CompleteSatisfaction._(condition), new_offset); - } - - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); - } - - @override - int allocationSize() { - return FfiConverterCondition.allocationSize(condition) + 4; - } - +class TxidParseExceptionErrorHandler extends UniffiRustCallStatusErrorHandler { @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 3); - int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterCondition.write( - condition, - Uint8List.view(buf.buffer, new_offset), - ); - return new_offset; + Exception lift(RustBuffer errorBuf) { + return FfiConverterTxidParseException.lift(errorBuf); } } -class NoneSatisfaction extends Satisfaction { - final String msg; - NoneSatisfaction(String this.msg); - NoneSatisfaction._(String this.msg); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final msg_lifted = FfiConverterString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final msg = msg_lifted.value; - new_offset += msg_lifted.bytesRead; - return LiftRetVal(NoneSatisfaction._(msg), new_offset); - } - - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); - } - - @override - int allocationSize() { - return FfiConverterString.allocationSize(msg) + 4; - } - - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 4); - int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - msg, - Uint8List.view(buf.buffer, new_offset), - ); - return new_offset; - } -} +final TxidParseExceptionErrorHandler txidParseExceptionErrorHandler = + TxidParseExceptionErrorHandler(); -abstract class SatisfiableItem { +abstract class Info { RustBuffer lower(); int allocationSize(); int write(Uint8List buf); } -class FfiConverterSatisfiableItem { - static SatisfiableItem lift(RustBuffer buffer) { - return FfiConverterSatisfiableItem.read(buffer.asUint8List()).value; +class FfiConverterInfo { + static Info lift(RustBuffer buffer) { + return FfiConverterInfo.read(buffer.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); final subview = Uint8List.view(buf.buffer, buf.offsetInBytes + 4); switch (index) { case 1: - final lifted = EcdsaSignatureSatisfiableItem.read(subview); - return LiftRetVal( + final lifted = ConnectionsMetInfo.read(subview); + return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); case 2: - final lifted = SchnorrSignatureSatisfiableItem.read(subview); - return LiftRetVal( + final lifted = SuccessfulHandshakeInfo.read(subview); + return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); case 3: - final lifted = Sha256PreimageSatisfiableItem.read(subview); - return LiftRetVal( + final lifted = ProgressInfo.read(subview); + return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); case 4: - final lifted = Hash256PreimageSatisfiableItem.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 5: - final lifted = Ripemd160PreimageSatisfiableItem.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 6: - final lifted = Hash160PreimageSatisfiableItem.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 7: - final lifted = AbsoluteTimelockSatisfiableItem.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 8: - final lifted = RelativeTimelockSatisfiableItem.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 9: - final lifted = MultisigSatisfiableItem.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 10: - final lifted = ThreshSatisfiableItem.read(subview); - return LiftRetVal( + final lifted = BlockReceivedInfo.read(subview); + return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); @@ -16519,31 +16647,25 @@ class FfiConverterSatisfiableItem { } } - static RustBuffer lower(SatisfiableItem value) { + static RustBuffer lower(Info value) { return value.lower(); } - static int allocationSize(SatisfiableItem value) { + static int allocationSize(Info value) { return value.allocationSize(); } - static int write(SatisfiableItem value, Uint8List buf) { + static int write(Info value, Uint8List buf) { return value.write(buf) - buf.offsetInBytes; } } -class EcdsaSignatureSatisfiableItem extends SatisfiableItem { - final PkOrF key; - EcdsaSignatureSatisfiableItem(PkOrF this.key); - EcdsaSignatureSatisfiableItem._(PkOrF this.key); - static LiftRetVal read(Uint8List buf) { +class ConnectionsMetInfo extends Info { + ConnectionsMetInfo(); + ConnectionsMetInfo._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final key_lifted = FfiConverterPkOrF.read( - Uint8List.view(buf.buffer, new_offset), - ); - final key = key_lifted.value; - new_offset += key_lifted.bytesRead; - return LiftRetVal(EcdsaSignatureSatisfiableItem._(key), new_offset); + return LiftRetVal(ConnectionsMetInfo._(), new_offset); } @override @@ -16555,33 +16677,23 @@ class EcdsaSignatureSatisfiableItem extends SatisfiableItem { @override int allocationSize() { - return FfiConverterPkOrF.allocationSize(key) + 4; + return 4; } @override int write(Uint8List buf) { buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterPkOrF.write( - key, - Uint8List.view(buf.buffer, new_offset), - ); return new_offset; } } -class SchnorrSignatureSatisfiableItem extends SatisfiableItem { - final PkOrF key; - SchnorrSignatureSatisfiableItem(PkOrF this.key); - SchnorrSignatureSatisfiableItem._(PkOrF this.key); - static LiftRetVal read(Uint8List buf) { +class SuccessfulHandshakeInfo extends Info { + SuccessfulHandshakeInfo(); + SuccessfulHandshakeInfo._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final key_lifted = FfiConverterPkOrF.read( - Uint8List.view(buf.buffer, new_offset), - ); - final key = key_lifted.value; - new_offset += key_lifted.bytesRead; - return LiftRetVal(SchnorrSignatureSatisfiableItem._(key), new_offset); + return LiftRetVal(SuccessfulHandshakeInfo._(), new_offset); } @override @@ -16593,33 +16705,41 @@ class SchnorrSignatureSatisfiableItem extends SatisfiableItem { @override int allocationSize() { - return FfiConverterPkOrF.allocationSize(key) + 4; + return 4; } @override int write(Uint8List buf) { buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 2); int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterPkOrF.write( - key, - Uint8List.view(buf.buffer, new_offset), - ); return new_offset; } } -class Sha256PreimageSatisfiableItem extends SatisfiableItem { - final String hash; - Sha256PreimageSatisfiableItem(String this.hash); - Sha256PreimageSatisfiableItem._(String this.hash); - static LiftRetVal read(Uint8List buf) { +class ProgressInfo extends Info { + final int chainHeight; + final double filtersDownloadedPercent; + ProgressInfo({ + required int this.chainHeight, + required double this.filtersDownloadedPercent, + }); + ProgressInfo._(int this.chainHeight, double this.filtersDownloadedPercent); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final hash_lifted = FfiConverterString.read( + final chainHeight_lifted = FfiConverterUInt32.read( Uint8List.view(buf.buffer, new_offset), ); - final hash = hash_lifted.value; - new_offset += hash_lifted.bytesRead; - return LiftRetVal(Sha256PreimageSatisfiableItem._(hash), new_offset); + final chainHeight = chainHeight_lifted.value; + new_offset += chainHeight_lifted.bytesRead; + final filtersDownloadedPercent_lifted = FfiConverterDouble32.read( + Uint8List.view(buf.buffer, new_offset), + ); + final filtersDownloadedPercent = filtersDownloadedPercent_lifted.value; + new_offset += filtersDownloadedPercent_lifted.bytesRead; + return LiftRetVal( + ProgressInfo._(chainHeight, filtersDownloadedPercent), + new_offset, + ); } @override @@ -16631,33 +16751,39 @@ class Sha256PreimageSatisfiableItem extends SatisfiableItem { @override int allocationSize() { - return FfiConverterString.allocationSize(hash) + 4; + return FfiConverterUInt32.allocationSize(chainHeight) + + FfiConverterDouble32.allocationSize(filtersDownloadedPercent) + + 4; } @override int write(Uint8List buf) { buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 3); int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - hash, + new_offset += FfiConverterUInt32.write( + chainHeight, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterDouble32.write( + filtersDownloadedPercent, Uint8List.view(buf.buffer, new_offset), ); return new_offset; } } -class Hash256PreimageSatisfiableItem extends SatisfiableItem { - final String hash; - Hash256PreimageSatisfiableItem(String this.hash); - Hash256PreimageSatisfiableItem._(String this.hash); - static LiftRetVal read(Uint8List buf) { +class BlockReceivedInfo extends Info { + final String v0; + BlockReceivedInfo(String this.v0); + BlockReceivedInfo._(String this.v0); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final hash_lifted = FfiConverterString.read( + final v0_lifted = FfiConverterString.read( Uint8List.view(buf.buffer, new_offset), ); - final hash = hash_lifted.value; - new_offset += hash_lifted.bytesRead; - return LiftRetVal(Hash256PreimageSatisfiableItem._(hash), new_offset); + final v0 = v0_lifted.value; + new_offset += v0_lifted.bytesRead; + return LiftRetVal(BlockReceivedInfo._(v0), new_offset); } @override @@ -16669,7 +16795,7 @@ class Hash256PreimageSatisfiableItem extends SatisfiableItem { @override int allocationSize() { - return FfiConverterString.allocationSize(hash) + 4; + return FfiConverterString.allocationSize(v0) + 4; } @override @@ -16677,101 +16803,79 @@ class Hash256PreimageSatisfiableItem extends SatisfiableItem { buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 4); int new_offset = buf.offsetInBytes + 4; new_offset += FfiConverterString.write( - hash, + v0, Uint8List.view(buf.buffer, new_offset), ); return new_offset; } } -class Ripemd160PreimageSatisfiableItem extends SatisfiableItem { - final String hash; - Ripemd160PreimageSatisfiableItem(String this.hash); - Ripemd160PreimageSatisfiableItem._(String this.hash); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final hash_lifted = FfiConverterString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final hash = hash_lifted.value; - new_offset += hash_lifted.bytesRead; - return LiftRetVal(Ripemd160PreimageSatisfiableItem._(hash), new_offset); - } - - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); - } - - @override - int allocationSize() { - return FfiConverterString.allocationSize(hash) + 4; - } +abstract class RecoveryPoint { + RustBuffer lower(); + int allocationSize(); + int write(Uint8List buf); +} - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 5); - int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - hash, - Uint8List.view(buf.buffer, new_offset), - ); - return new_offset; +class FfiConverterRecoveryPoint { + static RecoveryPoint lift(RustBuffer buffer) { + return FfiConverterRecoveryPoint.read(buffer.asUint8List()).value; } -} -class Hash160PreimageSatisfiableItem extends SatisfiableItem { - final String hash; - Hash160PreimageSatisfiableItem(String this.hash); - Hash160PreimageSatisfiableItem._(String this.hash); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final hash_lifted = FfiConverterString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final hash = hash_lifted.value; - new_offset += hash_lifted.bytesRead; - return LiftRetVal(Hash160PreimageSatisfiableItem._(hash), new_offset); + static LiftRetVal read(Uint8List buf) { + final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); + final subview = Uint8List.view(buf.buffer, buf.offsetInBytes + 4); + switch (index) { + case 1: + final lifted = GenesisBlockRecoveryPoint.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 2: + final lifted = SegwitActivationRecoveryPoint.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 3: + final lifted = TaprootActivationRecoveryPoint.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 4: + final lifted = OtherRecoveryPoint.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + default: + throw UniffiInternalError( + UniffiInternalError.unexpectedEnumCase, + "Unable to determine enum variant", + ); + } } - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); + static RustBuffer lower(RecoveryPoint value) { + return value.lower(); } - @override - int allocationSize() { - return FfiConverterString.allocationSize(hash) + 4; + static int allocationSize(RecoveryPoint value) { + return value.allocationSize(); } - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 6); - int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - hash, - Uint8List.view(buf.buffer, new_offset), - ); - return new_offset; + static int write(RecoveryPoint value, Uint8List buf) { + return value.write(buf) - buf.offsetInBytes; } } -class AbsoluteTimelockSatisfiableItem extends SatisfiableItem { - final LockTime value; - AbsoluteTimelockSatisfiableItem(LockTime this.value); - AbsoluteTimelockSatisfiableItem._(LockTime this.value); - static LiftRetVal read(Uint8List buf) { +class GenesisBlockRecoveryPoint extends RecoveryPoint { + GenesisBlockRecoveryPoint(); + GenesisBlockRecoveryPoint._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final value_lifted = FfiConverterLockTime.read( - Uint8List.view(buf.buffer, new_offset), - ); - final value = value_lifted.value; - new_offset += value_lifted.bytesRead; - return LiftRetVal(AbsoluteTimelockSatisfiableItem._(value), new_offset); + return LiftRetVal(GenesisBlockRecoveryPoint._(), new_offset); } @override @@ -16783,33 +16887,23 @@ class AbsoluteTimelockSatisfiableItem extends SatisfiableItem { @override int allocationSize() { - return FfiConverterLockTime.allocationSize(value) + 4; + return 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 7); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterLockTime.write( - value, - Uint8List.view(buf.buffer, new_offset), - ); return new_offset; } } -class RelativeTimelockSatisfiableItem extends SatisfiableItem { - final int value; - RelativeTimelockSatisfiableItem(int this.value); - RelativeTimelockSatisfiableItem._(int this.value); - static LiftRetVal read(Uint8List buf) { +class SegwitActivationRecoveryPoint extends RecoveryPoint { + SegwitActivationRecoveryPoint(); + SegwitActivationRecoveryPoint._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final value_lifted = FfiConverterUInt32.read( - Uint8List.view(buf.buffer, new_offset), - ); - final value = value_lifted.value; - new_offset += value_lifted.bytesRead; - return LiftRetVal(RelativeTimelockSatisfiableItem._(value), new_offset); + return LiftRetVal(SegwitActivationRecoveryPoint._(), new_offset); } @override @@ -16821,42 +16915,23 @@ class RelativeTimelockSatisfiableItem extends SatisfiableItem { @override int allocationSize() { - return FfiConverterUInt32.allocationSize(value) + 4; + return 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 8); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 2); int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterUInt32.write( - value, - Uint8List.view(buf.buffer, new_offset), - ); return new_offset; } } -class MultisigSatisfiableItem extends SatisfiableItem { - final List keys; - final int threshold; - MultisigSatisfiableItem({ - required List this.keys, - required int this.threshold, - }); - MultisigSatisfiableItem._(List this.keys, int this.threshold); - static LiftRetVal read(Uint8List buf) { +class TaprootActivationRecoveryPoint extends RecoveryPoint { + TaprootActivationRecoveryPoint(); + TaprootActivationRecoveryPoint._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final keys_lifted = FfiConverterSequencePkOrF.read( - Uint8List.view(buf.buffer, new_offset), - ); - final keys = keys_lifted.value; - new_offset += keys_lifted.bytesRead; - final threshold_lifted = FfiConverterUInt64.read( - Uint8List.view(buf.buffer, new_offset), - ); - final threshold = threshold_lifted.value; - new_offset += threshold_lifted.bytesRead; - return LiftRetVal(MultisigSatisfiableItem._(keys, threshold), new_offset); + return LiftRetVal(TaprootActivationRecoveryPoint._(), new_offset); } @override @@ -16868,48 +16943,29 @@ class MultisigSatisfiableItem extends SatisfiableItem { @override int allocationSize() { - return FfiConverterSequencePkOrF.allocationSize(keys) + - FfiConverterUInt64.allocationSize(threshold) + - 4; + return 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 9); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 3); int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterSequencePkOrF.write( - keys, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterUInt64.write( - threshold, - Uint8List.view(buf.buffer, new_offset), - ); return new_offset; } } -class ThreshSatisfiableItem extends SatisfiableItem { - final List items; - final int threshold; - ThreshSatisfiableItem({ - required List this.items, - required int this.threshold, - }); - ThreshSatisfiableItem._(List this.items, int this.threshold); - static LiftRetVal read(Uint8List buf) { +class OtherRecoveryPoint extends RecoveryPoint { + final BlockId birthday; + OtherRecoveryPoint(BlockId this.birthday); + OtherRecoveryPoint._(BlockId this.birthday); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final items_lifted = FfiConverterSequencePolicy.read( - Uint8List.view(buf.buffer, new_offset), - ); - final items = items_lifted.value; - new_offset += items_lifted.bytesRead; - final threshold_lifted = FfiConverterUInt64.read( + final birthday_lifted = FfiConverterBlockId.read( Uint8List.view(buf.buffer, new_offset), ); - final threshold = threshold_lifted.value; - new_offset += threshold_lifted.bytesRead; - return LiftRetVal(ThreshSatisfiableItem._(items, threshold), new_offset); + final birthday = birthday_lifted.value; + new_offset += birthday_lifted.bytesRead; + return LiftRetVal(OtherRecoveryPoint._(birthday), new_offset); } @override @@ -16921,21 +16977,15 @@ class ThreshSatisfiableItem extends SatisfiableItem { @override int allocationSize() { - return FfiConverterSequencePolicy.allocationSize(items) + - FfiConverterUInt64.allocationSize(threshold) + - 4; + return FfiConverterBlockId.allocationSize(birthday) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 10); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 4); int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterSequencePolicy.write( - items, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterUInt64.write( - threshold, + new_offset += FfiConverterBlockId.write( + birthday, Uint8List.view(buf.buffer, new_offset), ); return new_offset; @@ -17005,129 +17055,43 @@ class SyncScanType extends ScanType { return toRustBuffer(buf); } - @override - int allocationSize() { - return 4; - } - - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); - int new_offset = buf.offsetInBytes + 4; - return new_offset; - } -} - -class RecoveryScanType extends ScanType { - final int usedScriptIndex; - final RecoveryPoint checkpoint; - RecoveryScanType({ - required int this.usedScriptIndex, - required RecoveryPoint this.checkpoint, - }); - RecoveryScanType._(int this.usedScriptIndex, RecoveryPoint this.checkpoint); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final usedScriptIndex_lifted = FfiConverterUInt32.read( - Uint8List.view(buf.buffer, new_offset), - ); - final usedScriptIndex = usedScriptIndex_lifted.value; - new_offset += usedScriptIndex_lifted.bytesRead; - final checkpoint_lifted = FfiConverterRecoveryPoint.read( - Uint8List.view(buf.buffer, new_offset), - ); - final checkpoint = checkpoint_lifted.value; - new_offset += checkpoint_lifted.bytesRead; - return LiftRetVal( - RecoveryScanType._(usedScriptIndex, checkpoint), - new_offset, - ); - } - - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); - } - - @override - int allocationSize() { - return FfiConverterUInt32.allocationSize(usedScriptIndex) + - FfiConverterRecoveryPoint.allocationSize(checkpoint) + - 4; - } - - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 2); - int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterUInt32.write( - usedScriptIndex, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterRecoveryPoint.write( - checkpoint, - Uint8List.view(buf.buffer, new_offset), - ); - return new_offset; - } -} - -abstract class SighashParseException implements Exception { - RustBuffer lower(); - int allocationSize(); - int write(Uint8List buf); -} - -class FfiConverterSighashParseException { - static SighashParseException lift(RustBuffer buffer) { - return FfiConverterSighashParseException.read(buffer.asUint8List()).value; - } - - static LiftRetVal read(Uint8List buf) { - final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); - final subview = Uint8List.view(buf.buffer, buf.offsetInBytes + 4); - switch (index) { - case 1: - final lifted = InvalidSighashParseException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - default: - throw UniffiInternalError( - UniffiInternalError.unexpectedEnumCase, - "Unable to determine enum variant", - ); - } - } - - static RustBuffer lower(SighashParseException value) { - return value.lower(); - } - - static int allocationSize(SighashParseException value) { - return value.allocationSize(); + @override + int allocationSize() { + return 4; } - static int write(SighashParseException value, Uint8List buf) { - return value.write(buf) - buf.offsetInBytes; + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); + int new_offset = buf.offsetInBytes + 4; + return new_offset; } } -class InvalidSighashParseException extends SighashParseException { - final String errorMessage; - InvalidSighashParseException(String this.errorMessage); - InvalidSighashParseException._(String this.errorMessage); - static LiftRetVal read(Uint8List buf) { +class RecoveryScanType extends ScanType { + final int usedScriptIndex; + final RecoveryPoint checkpoint; + RecoveryScanType({ + required int this.usedScriptIndex, + required RecoveryPoint this.checkpoint, + }); + RecoveryScanType._(int this.usedScriptIndex, RecoveryPoint this.checkpoint); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final errorMessage_lifted = FfiConverterString.read( + final usedScriptIndex_lifted = FfiConverterUInt32.read( Uint8List.view(buf.buffer, new_offset), ); - final errorMessage = errorMessage_lifted.value; - new_offset += errorMessage_lifted.bytesRead; - return LiftRetVal(InvalidSighashParseException._(errorMessage), new_offset); + final usedScriptIndex = usedScriptIndex_lifted.value; + new_offset += usedScriptIndex_lifted.bytesRead; + final checkpoint_lifted = FfiConverterRecoveryPoint.read( + Uint8List.view(buf.buffer, new_offset), + ); + final checkpoint = checkpoint_lifted.value; + new_offset += checkpoint_lifted.bytesRead; + return LiftRetVal( + RecoveryScanType._(usedScriptIndex, checkpoint), + new_offset, + ); } @override @@ -17139,151 +17103,99 @@ class InvalidSighashParseException extends SighashParseException { @override int allocationSize() { - return FfiConverterString.allocationSize(errorMessage) + 4; + return FfiConverterUInt32.allocationSize(usedScriptIndex) + + FfiConverterRecoveryPoint.allocationSize(checkpoint) + + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 2); int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - errorMessage, + new_offset += FfiConverterUInt32.write( + usedScriptIndex, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterRecoveryPoint.write( + checkpoint, Uint8List.view(buf.buffer, new_offset), ); return new_offset; } - - @override - String toString() { - return "InvalidSighashParseException($errorMessage)"; - } -} - -class SighashParseExceptionErrorHandler - extends UniffiRustCallStatusErrorHandler { - @override - Exception lift(RustBuffer errorBuf) { - return FfiConverterSighashParseException.lift(errorBuf); - } } -final SighashParseExceptionErrorHandler sighashParseExceptionErrorHandler = - SighashParseExceptionErrorHandler(); - -abstract class SignerException implements Exception { +abstract class Warning { RustBuffer lower(); int allocationSize(); int write(Uint8List buf); } -class FfiConverterSignerException { - static SignerException lift(RustBuffer buffer) { - return FfiConverterSignerException.read(buffer.asUint8List()).value; +class FfiConverterWarning { + static Warning lift(RustBuffer buffer) { + return FfiConverterWarning.read(buffer.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); final subview = Uint8List.view(buf.buffer, buf.offsetInBytes + 4); switch (index) { case 1: - final lifted = MissingKeySignerException.read(subview); - return LiftRetVal( + final lifted = NeedConnectionsWarning.read(subview); + return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); case 2: - final lifted = InvalidKeySignerException.read(subview); - return LiftRetVal( + final lifted = PeerTimedOutWarning.read(subview); + return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); case 3: - final lifted = UserCanceledSignerException.read(subview); - return LiftRetVal( + final lifted = CouldNotConnectWarning.read(subview); + return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); case 4: - final lifted = InputIndexOutOfRangeSignerException.read(subview); - return LiftRetVal( + final lifted = NoCompactFiltersWarning.read(subview); + return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); case 5: - final lifted = MissingNonWitnessUtxoSignerException.read(subview); - return LiftRetVal( + final lifted = PotentialStaleTipWarning.read(subview); + return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); case 6: - final lifted = InvalidNonWitnessUtxoSignerException.read(subview); - return LiftRetVal( + final lifted = UnsolicitedMessageWarning.read(subview); + return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); case 7: - final lifted = MissingWitnessUtxoSignerException.read(subview); - return LiftRetVal( + final lifted = TransactionRejectedWarning.read(subview); + return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); case 8: - final lifted = MissingWitnessScriptSignerException.read(subview); - return LiftRetVal( + final lifted = EvaluatingForkWarning.read(subview); + return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); case 9: - final lifted = MissingHdKeypathSignerException.read(subview); - return LiftRetVal( + final lifted = UnexpectedSyncExceptionWarning.read(subview); + return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); case 10: - final lifted = NonStandardSighashSignerException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 11: - final lifted = InvalidSighashSignerException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 12: - final lifted = SighashP2wpkhSignerException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 13: - final lifted = SighashTaprootSignerException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 14: - final lifted = TxInputsIndexExceptionSignerException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 15: - final lifted = MiniscriptPsbtSignerException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 16: - final lifted = ExternalSignerException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 17: - final lifted = PsbtSignerException.read(subview); - return LiftRetVal( + final lifted = RequestFailedWarning.read(subview); + return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); @@ -17295,25 +17207,25 @@ class FfiConverterSignerException { } } - static RustBuffer lower(SignerException value) { + static RustBuffer lower(Warning value) { return value.lower(); } - static int allocationSize(SignerException value) { + static int allocationSize(Warning value) { return value.allocationSize(); } - static int write(SignerException value, Uint8List buf) { + static int write(Warning value, Uint8List buf) { return value.write(buf) - buf.offsetInBytes; } } -class MissingKeySignerException extends SignerException { - MissingKeySignerException(); - MissingKeySignerException._(); - static LiftRetVal read(Uint8List buf) { +class NeedConnectionsWarning extends Warning { + NeedConnectionsWarning(); + NeedConnectionsWarning._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(MissingKeySignerException._(), new_offset); + return LiftRetVal(NeedConnectionsWarning._(), new_offset); } @override @@ -17334,19 +17246,14 @@ class MissingKeySignerException extends SignerException { int new_offset = buf.offsetInBytes + 4; return new_offset; } - - @override - String toString() { - return "MissingKeySignerException"; - } } -class InvalidKeySignerException extends SignerException { - InvalidKeySignerException(); - InvalidKeySignerException._(); - static LiftRetVal read(Uint8List buf) { +class PeerTimedOutWarning extends Warning { + PeerTimedOutWarning(); + PeerTimedOutWarning._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(InvalidKeySignerException._(), new_offset); + return LiftRetVal(PeerTimedOutWarning._(), new_offset); } @override @@ -17367,19 +17274,14 @@ class InvalidKeySignerException extends SignerException { int new_offset = buf.offsetInBytes + 4; return new_offset; } - - @override - String toString() { - return "InvalidKeySignerException"; - } } -class UserCanceledSignerException extends SignerException { - UserCanceledSignerException(); - UserCanceledSignerException._(); - static LiftRetVal read(Uint8List buf) { +class CouldNotConnectWarning extends Warning { + CouldNotConnectWarning(); + CouldNotConnectWarning._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(UserCanceledSignerException._(), new_offset); + return LiftRetVal(CouldNotConnectWarning._(), new_offset); } @override @@ -17400,19 +17302,14 @@ class UserCanceledSignerException extends SignerException { int new_offset = buf.offsetInBytes + 4; return new_offset; } - - @override - String toString() { - return "UserCanceledSignerException"; - } } -class InputIndexOutOfRangeSignerException extends SignerException { - InputIndexOutOfRangeSignerException(); - InputIndexOutOfRangeSignerException._(); - static LiftRetVal read(Uint8List buf) { +class NoCompactFiltersWarning extends Warning { + NoCompactFiltersWarning(); + NoCompactFiltersWarning._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(InputIndexOutOfRangeSignerException._(), new_offset); + return LiftRetVal(NoCompactFiltersWarning._(), new_offset); } @override @@ -17433,19 +17330,14 @@ class InputIndexOutOfRangeSignerException extends SignerException { int new_offset = buf.offsetInBytes + 4; return new_offset; } - - @override - String toString() { - return "InputIndexOutOfRangeSignerException"; - } } -class MissingNonWitnessUtxoSignerException extends SignerException { - MissingNonWitnessUtxoSignerException(); - MissingNonWitnessUtxoSignerException._(); - static LiftRetVal read(Uint8List buf) { +class PotentialStaleTipWarning extends Warning { + PotentialStaleTipWarning(); + PotentialStaleTipWarning._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(MissingNonWitnessUtxoSignerException._(), new_offset); + return LiftRetVal(PotentialStaleTipWarning._(), new_offset); } @override @@ -17466,19 +17358,14 @@ class MissingNonWitnessUtxoSignerException extends SignerException { int new_offset = buf.offsetInBytes + 4; return new_offset; } - - @override - String toString() { - return "MissingNonWitnessUtxoSignerException"; - } } -class InvalidNonWitnessUtxoSignerException extends SignerException { - InvalidNonWitnessUtxoSignerException(); - InvalidNonWitnessUtxoSignerException._(); - static LiftRetVal read(Uint8List buf) { +class UnsolicitedMessageWarning extends Warning { + UnsolicitedMessageWarning(); + UnsolicitedMessageWarning._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(InvalidNonWitnessUtxoSignerException._(), new_offset); + return LiftRetVal(UnsolicitedMessageWarning._(), new_offset); } @override @@ -17499,19 +17386,29 @@ class InvalidNonWitnessUtxoSignerException extends SignerException { int new_offset = buf.offsetInBytes + 4; return new_offset; } - - @override - String toString() { - return "InvalidNonWitnessUtxoSignerException"; - } } -class MissingWitnessUtxoSignerException extends SignerException { - MissingWitnessUtxoSignerException(); - MissingWitnessUtxoSignerException._(); - static LiftRetVal read(Uint8List buf) { +class TransactionRejectedWarning extends Warning { + final String wtxid; + final String? reason; + TransactionRejectedWarning({ + required String this.wtxid, + required String? this.reason, + }); + TransactionRejectedWarning._(String this.wtxid, String? this.reason); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(MissingWitnessUtxoSignerException._(), new_offset); + final wtxid_lifted = FfiConverterString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final wtxid = wtxid_lifted.value; + new_offset += wtxid_lifted.bytesRead; + final reason_lifted = FfiConverterOptionalString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final reason = reason_lifted.value; + new_offset += reason_lifted.bytesRead; + return LiftRetVal(TransactionRejectedWarning._(wtxid, reason), new_offset); } @override @@ -17523,28 +17420,33 @@ class MissingWitnessUtxoSignerException extends SignerException { @override int allocationSize() { - return 4; + return FfiConverterString.allocationSize(wtxid) + + FfiConverterOptionalString.allocationSize(reason) + + 4; } @override int write(Uint8List buf) { buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 7); int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterString.write( + wtxid, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalString.write( + reason, + Uint8List.view(buf.buffer, new_offset), + ); return new_offset; } - - @override - String toString() { - return "MissingWitnessUtxoSignerException"; - } } -class MissingWitnessScriptSignerException extends SignerException { - MissingWitnessScriptSignerException(); - MissingWitnessScriptSignerException._(); - static LiftRetVal read(Uint8List buf) { +class EvaluatingForkWarning extends Warning { + EvaluatingForkWarning(); + EvaluatingForkWarning._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(MissingWitnessScriptSignerException._(), new_offset); + return LiftRetVal(EvaluatingForkWarning._(), new_offset); } @override @@ -17565,19 +17467,20 @@ class MissingWitnessScriptSignerException extends SignerException { int new_offset = buf.offsetInBytes + 4; return new_offset; } - - @override - String toString() { - return "MissingWitnessScriptSignerException"; - } } -class MissingHdKeypathSignerException extends SignerException { - MissingHdKeypathSignerException(); - MissingHdKeypathSignerException._(); - static LiftRetVal read(Uint8List buf) { +class UnexpectedSyncExceptionWarning extends Warning { + final String warning; + UnexpectedSyncExceptionWarning(String this.warning); + UnexpectedSyncExceptionWarning._(String this.warning); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(MissingHdKeypathSignerException._(), new_offset); + final warning_lifted = FfiConverterString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final warning = warning_lifted.value; + new_offset += warning_lifted.bytesRead; + return LiftRetVal(UnexpectedSyncExceptionWarning._(warning), new_offset); } @override @@ -17589,28 +17492,27 @@ class MissingHdKeypathSignerException extends SignerException { @override int allocationSize() { - return 4; + return FfiConverterString.allocationSize(warning) + 4; } @override int write(Uint8List buf) { buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 9); int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterString.write( + warning, + Uint8List.view(buf.buffer, new_offset), + ); return new_offset; } - - @override - String toString() { - return "MissingHdKeypathSignerException"; - } } -class NonStandardSighashSignerException extends SignerException { - NonStandardSighashSignerException(); - NonStandardSighashSignerException._(); - static LiftRetVal read(Uint8List buf) { +class RequestFailedWarning extends Warning { + RequestFailedWarning(); + RequestFailedWarning._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(NonStandardSighashSignerException._(), new_offset); + return LiftRetVal(RequestFailedWarning._(), new_offset); } @override @@ -17631,58 +17533,157 @@ class NonStandardSighashSignerException extends SignerException { int new_offset = buf.offsetInBytes + 4; return new_offset; } +} - @override - String toString() { - return "NonStandardSighashSignerException"; +enum ChangeSpendPolicy { changeAllowed, onlyChange, changeForbidden } + +class FfiConverterChangeSpendPolicy { + static LiftRetVal read(Uint8List buf) { + final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); + switch (index) { + case 1: + return LiftRetVal(ChangeSpendPolicy.changeAllowed, 4); + case 2: + return LiftRetVal(ChangeSpendPolicy.onlyChange, 4); + case 3: + return LiftRetVal(ChangeSpendPolicy.changeForbidden, 4); + default: + throw UniffiInternalError( + UniffiInternalError.unexpectedEnumCase, + "Unable to determine enum variant", + ); + } + } + + static ChangeSpendPolicy lift(RustBuffer buffer) { + return FfiConverterChangeSpendPolicy.read(buffer.asUint8List()).value; + } + + static RustBuffer lower(ChangeSpendPolicy input) { + return toRustBuffer(createUint8ListFromInt(input.index + 1)); + } + + static int allocationSize(ChangeSpendPolicy _value) { + return 4; + } + + static int write(ChangeSpendPolicy value, Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, value.index + 1); + return 4; } } -class InvalidSighashSignerException extends SignerException { - InvalidSighashSignerException(); - InvalidSighashSignerException._(); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - return LiftRetVal(InvalidSighashSignerException._(), new_offset); +enum TxOrdering { shuffle, untouched } + +class FfiConverterTxOrdering { + static LiftRetVal read(Uint8List buf) { + final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); + switch (index) { + case 1: + return LiftRetVal(TxOrdering.shuffle, 4); + case 2: + return LiftRetVal(TxOrdering.untouched, 4); + default: + throw UniffiInternalError( + UniffiInternalError.unexpectedEnumCase, + "Unable to determine enum variant", + ); + } } - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); + static TxOrdering lift(RustBuffer buffer) { + return FfiConverterTxOrdering.read(buffer.asUint8List()).value; } - @override - int allocationSize() { + static RustBuffer lower(TxOrdering input) { + return toRustBuffer(createUint8ListFromInt(input.index + 1)); + } + + static int allocationSize(TxOrdering _value) { return 4; } - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 11); - int new_offset = buf.offsetInBytes + 4; - return new_offset; + static int write(TxOrdering value, Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, value.index + 1); + return 4; } +} - @override - String toString() { - return "InvalidSighashSignerException"; +abstract class ChainPosition { + RustBuffer lower(); + int allocationSize(); + int write(Uint8List buf); +} + +class FfiConverterChainPosition { + static ChainPosition lift(RustBuffer buffer) { + return FfiConverterChainPosition.read(buffer.asUint8List()).value; + } + + static LiftRetVal read(Uint8List buf) { + final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); + final subview = Uint8List.view(buf.buffer, buf.offsetInBytes + 4); + switch (index) { + case 1: + final lifted = ConfirmedChainPosition.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 2: + final lifted = UnconfirmedChainPosition.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + default: + throw UniffiInternalError( + UniffiInternalError.unexpectedEnumCase, + "Unable to determine enum variant", + ); + } + } + + static RustBuffer lower(ChainPosition value) { + return value.lower(); + } + + static int allocationSize(ChainPosition value) { + return value.allocationSize(); + } + + static int write(ChainPosition value, Uint8List buf) { + return value.write(buf) - buf.offsetInBytes; } } -class SighashP2wpkhSignerException extends SignerException { - final String errorMessage; - SighashP2wpkhSignerException(String this.errorMessage); - SighashP2wpkhSignerException._(String this.errorMessage); - static LiftRetVal read(Uint8List buf) { +class ConfirmedChainPosition extends ChainPosition { + final ConfirmationBlockTime confirmationBlockTime; + final Txid? transitively; + ConfirmedChainPosition({ + required ConfirmationBlockTime this.confirmationBlockTime, + required Txid? this.transitively, + }); + ConfirmedChainPosition._( + ConfirmationBlockTime this.confirmationBlockTime, + Txid? this.transitively, + ); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final errorMessage_lifted = FfiConverterString.read( + final confirmationBlockTime_lifted = FfiConverterConfirmationBlockTime.read( + Uint8List.view(buf.buffer, new_offset), + ); + final confirmationBlockTime = confirmationBlockTime_lifted.value; + new_offset += confirmationBlockTime_lifted.bytesRead; + final transitively_lifted = FfiConverterOptionalTxid.read( Uint8List.view(buf.buffer, new_offset), ); - final errorMessage = errorMessage_lifted.value; - new_offset += errorMessage_lifted.bytesRead; - return LiftRetVal(SighashP2wpkhSignerException._(errorMessage), new_offset); + final transitively = transitively_lifted.value; + new_offset += transitively_lifted.bytesRead; + return LiftRetVal( + ConfirmedChainPosition._(confirmationBlockTime, transitively), + new_offset, + ); } @override @@ -17694,41 +17695,41 @@ class SighashP2wpkhSignerException extends SignerException { @override int allocationSize() { - return FfiConverterString.allocationSize(errorMessage) + 4; + return FfiConverterConfirmationBlockTime.allocationSize( + confirmationBlockTime, + ) + + FfiConverterOptionalTxid.allocationSize(transitively) + + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 12); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - errorMessage, + new_offset += FfiConverterConfirmationBlockTime.write( + confirmationBlockTime, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalTxid.write( + transitively, Uint8List.view(buf.buffer, new_offset), ); return new_offset; } - - @override - String toString() { - return "SighashP2wpkhSignerException($errorMessage)"; - } } -class SighashTaprootSignerException extends SignerException { - final String errorMessage; - SighashTaprootSignerException(String this.errorMessage); - SighashTaprootSignerException._(String this.errorMessage); - static LiftRetVal read(Uint8List buf) { +class UnconfirmedChainPosition extends ChainPosition { + final int? timestamp; + UnconfirmedChainPosition(int? this.timestamp); + UnconfirmedChainPosition._(int? this.timestamp); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final errorMessage_lifted = FfiConverterString.read( + final timestamp_lifted = FfiConverterOptionalUInt64.read( Uint8List.view(buf.buffer, new_offset), ); - final errorMessage = errorMessage_lifted.value; - new_offset += errorMessage_lifted.bytesRead; - return LiftRetVal( - SighashTaprootSignerException._(errorMessage), - new_offset, - ); + final timestamp = timestamp_lifted.value; + new_offset += timestamp_lifted.bytesRead; + return LiftRetVal(UnconfirmedChainPosition._(timestamp), new_offset); } @override @@ -17740,130 +17741,117 @@ class SighashTaprootSignerException extends SignerException { @override int allocationSize() { - return FfiConverterString.allocationSize(errorMessage) + 4; + return FfiConverterOptionalUInt64.allocationSize(timestamp) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 13); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 2); int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - errorMessage, + new_offset += FfiConverterOptionalUInt64.write( + timestamp, Uint8List.view(buf.buffer, new_offset), ); return new_offset; } - - @override - String toString() { - return "SighashTaprootSignerException($errorMessage)"; - } } -class TxInputsIndexExceptionSignerException extends SignerException { - final String errorMessage; - TxInputsIndexExceptionSignerException(String this.errorMessage); - TxInputsIndexExceptionSignerException._(String this.errorMessage); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final errorMessage_lifted = FfiConverterString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final errorMessage = errorMessage_lifted.value; - new_offset += errorMessage_lifted.bytesRead; - return LiftRetVal( - TxInputsIndexExceptionSignerException._(errorMessage), - new_offset, - ); +enum KeychainKind { external_, internal } + +class FfiConverterKeychainKind { + static LiftRetVal read(Uint8List buf) { + final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); + switch (index) { + case 1: + return LiftRetVal(KeychainKind.external_, 4); + case 2: + return LiftRetVal(KeychainKind.internal, 4); + default: + throw UniffiInternalError( + UniffiInternalError.unexpectedEnumCase, + "Unable to determine enum variant", + ); + } } - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); + static KeychainKind lift(RustBuffer buffer) { + return FfiConverterKeychainKind.read(buffer.asUint8List()).value; } - @override - int allocationSize() { - return FfiConverterString.allocationSize(errorMessage) + 4; + static RustBuffer lower(KeychainKind input) { + return toRustBuffer(createUint8ListFromInt(input.index + 1)); } - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 14); - int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - errorMessage, - Uint8List.view(buf.buffer, new_offset), - ); - return new_offset; + static int allocationSize(KeychainKind _value) { + return 4; } - @override - String toString() { - return "TxInputsIndexExceptionSignerException($errorMessage)"; + static int write(KeychainKind value, Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, value.index + 1); + return 4; } } -class MiniscriptPsbtSignerException extends SignerException { - final String errorMessage; - MiniscriptPsbtSignerException(String this.errorMessage); - MiniscriptPsbtSignerException._(String this.errorMessage); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final errorMessage_lifted = FfiConverterString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final errorMessage = errorMessage_lifted.value; - new_offset += errorMessage_lifted.bytesRead; - return LiftRetVal( - MiniscriptPsbtSignerException._(errorMessage), - new_offset, - ); +abstract class LockTime { + RustBuffer lower(); + int allocationSize(); + int write(Uint8List buf); +} + +class FfiConverterLockTime { + static LockTime lift(RustBuffer buffer) { + return FfiConverterLockTime.read(buffer.asUint8List()).value; } - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); + static LiftRetVal read(Uint8List buf) { + final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); + final subview = Uint8List.view(buf.buffer, buf.offsetInBytes + 4); + switch (index) { + case 1: + final lifted = BlocksLockTime.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 2: + final lifted = SecondsLockTime.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + default: + throw UniffiInternalError( + UniffiInternalError.unexpectedEnumCase, + "Unable to determine enum variant", + ); + } } - @override - int allocationSize() { - return FfiConverterString.allocationSize(errorMessage) + 4; + static RustBuffer lower(LockTime value) { + return value.lower(); } - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 15); - int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - errorMessage, - Uint8List.view(buf.buffer, new_offset), - ); - return new_offset; + static int allocationSize(LockTime value) { + return value.allocationSize(); } - @override - String toString() { - return "MiniscriptPsbtSignerException($errorMessage)"; + static int write(LockTime value, Uint8List buf) { + return value.write(buf) - buf.offsetInBytes; } } -class ExternalSignerException extends SignerException { - final String errorMessage; - ExternalSignerException(String this.errorMessage); - ExternalSignerException._(String this.errorMessage); - static LiftRetVal read(Uint8List buf) { +class BlocksLockTime extends LockTime { + final int height; + BlocksLockTime(int this.height); + BlocksLockTime._(int this.height); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final errorMessage_lifted = FfiConverterString.read( + final height_lifted = FfiConverterUInt32.read( Uint8List.view(buf.buffer, new_offset), ); - final errorMessage = errorMessage_lifted.value; - new_offset += errorMessage_lifted.bytesRead; - return LiftRetVal(ExternalSignerException._(errorMessage), new_offset); + final height = height_lifted.value; + new_offset += height_lifted.bytesRead; + return LiftRetVal(BlocksLockTime._(height), new_offset); } @override @@ -17875,38 +17863,33 @@ class ExternalSignerException extends SignerException { @override int allocationSize() { - return FfiConverterString.allocationSize(errorMessage) + 4; + return FfiConverterUInt32.allocationSize(height) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 16); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - errorMessage, + new_offset += FfiConverterUInt32.write( + height, Uint8List.view(buf.buffer, new_offset), ); return new_offset; } - - @override - String toString() { - return "ExternalSignerException($errorMessage)"; - } } -class PsbtSignerException extends SignerException { - final String errorMessage; - PsbtSignerException(String this.errorMessage); - PsbtSignerException._(String this.errorMessage); - static LiftRetVal read(Uint8List buf) { +class SecondsLockTime extends LockTime { + final int consensusTime; + SecondsLockTime(int this.consensusTime); + SecondsLockTime._(int this.consensusTime); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final errorMessage_lifted = FfiConverterString.read( + final consensusTime_lifted = FfiConverterUInt32.read( Uint8List.view(buf.buffer, new_offset), ); - final errorMessage = errorMessage_lifted.value; - new_offset += errorMessage_lifted.bytesRead; - return LiftRetVal(PsbtSignerException._(errorMessage), new_offset); + final consensusTime = consensusTime_lifted.value; + new_offset += consensusTime_lifted.bytesRead; + return LiftRetVal(SecondsLockTime._(consensusTime), new_offset); } @override @@ -17918,92 +17901,51 @@ class PsbtSignerException extends SignerException { @override int allocationSize() { - return FfiConverterString.allocationSize(errorMessage) + 4; + return FfiConverterUInt32.allocationSize(consensusTime) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 17); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 2); int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - errorMessage, + new_offset += FfiConverterUInt32.write( + consensusTime, Uint8List.view(buf.buffer, new_offset), ); return new_offset; } - - @override - String toString() { - return "PsbtSignerException($errorMessage)"; - } -} - -class SignerExceptionErrorHandler extends UniffiRustCallStatusErrorHandler { - @override - Exception lift(RustBuffer errorBuf) { - return FfiConverterSignerException.lift(errorBuf); - } } -final SignerExceptionErrorHandler signerExceptionErrorHandler = - SignerExceptionErrorHandler(); - -abstract class TransactionException implements Exception { +abstract class PkOrF { RustBuffer lower(); int allocationSize(); int write(Uint8List buf); } -class FfiConverterTransactionException { - static TransactionException lift(RustBuffer buffer) { - return FfiConverterTransactionException.read(buffer.asUint8List()).value; +class FfiConverterPkOrF { + static PkOrF lift(RustBuffer buffer) { + return FfiConverterPkOrF.read(buffer.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); final subview = Uint8List.view(buf.buffer, buf.offsetInBytes + 4); switch (index) { case 1: - final lifted = IoTransactionException.read(subview); - return LiftRetVal( + final lifted = PubkeyPkOrF.read(subview); + return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); case 2: - final lifted = OversizedVectorAllocationTransactionException.read( - subview, - ); - return LiftRetVal( + final lifted = XOnlyPubkeyPkOrF.read(subview); + return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); case 3: - final lifted = InvalidChecksumTransactionException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 4: - final lifted = NonMinimalVarIntTransactionException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 5: - final lifted = ParseFailedTransactionException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 6: - final lifted = UnsupportedSegwitFlagTransactionException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 7: - final lifted = OtherTransactionErrTransactionException.read(subview); - return LiftRetVal( + final lifted = FingerprintPkOrF.read(subview); + return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); @@ -18015,25 +17957,31 @@ class FfiConverterTransactionException { } } - static RustBuffer lower(TransactionException value) { + static RustBuffer lower(PkOrF value) { return value.lower(); } - static int allocationSize(TransactionException value) { + static int allocationSize(PkOrF value) { return value.allocationSize(); } - static int write(TransactionException value, Uint8List buf) { + static int write(PkOrF value, Uint8List buf) { return value.write(buf) - buf.offsetInBytes; } } -class IoTransactionException extends TransactionException { - IoTransactionException(); - IoTransactionException._(); - static LiftRetVal read(Uint8List buf) { +class PubkeyPkOrF extends PkOrF { + final String value; + PubkeyPkOrF(String this.value); + PubkeyPkOrF._(String this.value); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(IoTransactionException._(), new_offset); + final value_lifted = FfiConverterString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final value = value_lifted.value; + new_offset += value_lifted.bytesRead; + return LiftRetVal(PubkeyPkOrF._(value), new_offset); } @override @@ -18045,34 +17993,71 @@ class IoTransactionException extends TransactionException { @override int allocationSize() { - return 4; + return FfiConverterString.allocationSize(value) + 4; } @override int write(Uint8List buf) { buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterString.write( + value, + Uint8List.view(buf.buffer, new_offset), + ); return new_offset; } +} + +class XOnlyPubkeyPkOrF extends PkOrF { + final String value; + XOnlyPubkeyPkOrF(String this.value); + XOnlyPubkeyPkOrF._(String this.value); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final value_lifted = FfiConverterString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final value = value_lifted.value; + new_offset += value_lifted.bytesRead; + return LiftRetVal(XOnlyPubkeyPkOrF._(value), new_offset); + } @override - String toString() { - return "IoTransactionException"; + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return FfiConverterString.allocationSize(value) + 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 2); + int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterString.write( + value, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset; } } -class OversizedVectorAllocationTransactionException - extends TransactionException { - OversizedVectorAllocationTransactionException(); - OversizedVectorAllocationTransactionException._(); - static LiftRetVal read( - Uint8List buf, - ) { +class FingerprintPkOrF extends PkOrF { + final String value; + FingerprintPkOrF(String this.value); + FingerprintPkOrF._(String this.value); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal( - OversizedVectorAllocationTransactionException._(), - new_offset, + final value_lifted = FfiConverterString.read( + Uint8List.view(buf.buffer, new_offset), ); + final value = value_lifted.value; + new_offset += value_lifted.bytesRead; + return LiftRetVal(FingerprintPkOrF._(value), new_offset); } @override @@ -18084,47 +18069,130 @@ class OversizedVectorAllocationTransactionException @override int allocationSize() { - return 4; + return FfiConverterString.allocationSize(value) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 2); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 3); int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterString.write( + value, + Uint8List.view(buf.buffer, new_offset), + ); return new_offset; } +} - @override - String toString() { - return "OversizedVectorAllocationTransactionException"; +abstract class Satisfaction { + RustBuffer lower(); + int allocationSize(); + int write(Uint8List buf); +} + +class FfiConverterSatisfaction { + static Satisfaction lift(RustBuffer buffer) { + return FfiConverterSatisfaction.read(buffer.asUint8List()).value; + } + + static LiftRetVal read(Uint8List buf) { + final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); + final subview = Uint8List.view(buf.buffer, buf.offsetInBytes + 4); + switch (index) { + case 1: + final lifted = PartialSatisfaction.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 2: + final lifted = PartialCompleteSatisfaction.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 3: + final lifted = CompleteSatisfaction.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 4: + final lifted = NoneSatisfaction.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + default: + throw UniffiInternalError( + UniffiInternalError.unexpectedEnumCase, + "Unable to determine enum variant", + ); + } + } + + static RustBuffer lower(Satisfaction value) { + return value.lower(); + } + + static int allocationSize(Satisfaction value) { + return value.allocationSize(); + } + + static int write(Satisfaction value, Uint8List buf) { + return value.write(buf) - buf.offsetInBytes; } } -class InvalidChecksumTransactionException extends TransactionException { - final String expected; - final String actual; - InvalidChecksumTransactionException({ - required String this.expected, - required String this.actual, +class PartialSatisfaction extends Satisfaction { + final int n; + final int m; + final List items; + final bool? sorted; + final Map> conditions; + PartialSatisfaction({ + required int this.n, + required int this.m, + required List this.items, + required bool? this.sorted, + required Map> this.conditions, }); - InvalidChecksumTransactionException._( - String this.expected, - String this.actual, + PartialSatisfaction._( + int this.n, + int this.m, + List this.items, + bool? this.sorted, + Map> this.conditions, ); - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final expected_lifted = FfiConverterString.read( + final n_lifted = FfiConverterUInt64.read( + Uint8List.view(buf.buffer, new_offset), + ); + final n = n_lifted.value; + new_offset += n_lifted.bytesRead; + final m_lifted = FfiConverterUInt64.read( + Uint8List.view(buf.buffer, new_offset), + ); + final m = m_lifted.value; + new_offset += m_lifted.bytesRead; + final items_lifted = FfiConverterSequenceUInt64.read( + Uint8List.view(buf.buffer, new_offset), + ); + final items = items_lifted.value; + new_offset += items_lifted.bytesRead; + final sorted_lifted = FfiConverterOptionalBool.read( Uint8List.view(buf.buffer, new_offset), ); - final expected = expected_lifted.value; - new_offset += expected_lifted.bytesRead; - final actual_lifted = FfiConverterString.read( + final sorted = sorted_lifted.value; + new_offset += sorted_lifted.bytesRead; + final conditions_lifted = FfiConverterMapUInt32ToSequenceCondition.read( Uint8List.view(buf.buffer, new_offset), ); - final actual = actual_lifted.value; - new_offset += actual_lifted.bytesRead; + final conditions = conditions_lifted.value; + new_offset += conditions_lifted.bytesRead; return LiftRetVal( - InvalidChecksumTransactionException._(expected, actual), + PartialSatisfaction._(n, m, items, sorted, conditions), new_offset, ); } @@ -18138,113 +18206,92 @@ class InvalidChecksumTransactionException extends TransactionException { @override int allocationSize() { - return FfiConverterString.allocationSize(expected) + - FfiConverterString.allocationSize(actual) + + return FfiConverterUInt64.allocationSize(n) + + FfiConverterUInt64.allocationSize(m) + + FfiConverterSequenceUInt64.allocationSize(items) + + FfiConverterOptionalBool.allocationSize(sorted) + + FfiConverterMapUInt32ToSequenceCondition.allocationSize(conditions) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 3); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - expected, + new_offset += FfiConverterUInt64.write( + n, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterString.write( - actual, + new_offset += FfiConverterUInt64.write( + m, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterSequenceUInt64.write( + items, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalBool.write( + sorted, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterMapUInt32ToSequenceCondition.write( + conditions, Uint8List.view(buf.buffer, new_offset), ); return new_offset; } - - @override - String toString() { - return "InvalidChecksumTransactionException($expected, $actual)"; - } -} - -class NonMinimalVarIntTransactionException extends TransactionException { - NonMinimalVarIntTransactionException(); - NonMinimalVarIntTransactionException._(); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - return LiftRetVal(NonMinimalVarIntTransactionException._(), new_offset); - } - - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); - } - - @override - int allocationSize() { - return 4; - } - - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 4); - int new_offset = buf.offsetInBytes + 4; - return new_offset; - } - - @override - String toString() { - return "NonMinimalVarIntTransactionException"; - } -} - -class ParseFailedTransactionException extends TransactionException { - ParseFailedTransactionException(); - ParseFailedTransactionException._(); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - return LiftRetVal(ParseFailedTransactionException._(), new_offset); - } - - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); - } - - @override - int allocationSize() { - return 4; - } - - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 5); - int new_offset = buf.offsetInBytes + 4; - return new_offset; - } - - @override - String toString() { - return "ParseFailedTransactionException"; - } } -class UnsupportedSegwitFlagTransactionException extends TransactionException { - final int flag; - UnsupportedSegwitFlagTransactionException(int this.flag); - UnsupportedSegwitFlagTransactionException._(int this.flag); - static LiftRetVal read( - Uint8List buf, - ) { +class PartialCompleteSatisfaction extends Satisfaction { + final int n; + final int m; + final List items; + final bool? sorted; + final Map, List> conditions; + PartialCompleteSatisfaction({ + required int this.n, + required int this.m, + required List this.items, + required bool? this.sorted, + required Map, List> this.conditions, + }); + PartialCompleteSatisfaction._( + int this.n, + int this.m, + List this.items, + bool? this.sorted, + Map, List> this.conditions, + ); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final flag_lifted = FfiConverterUInt8.read( + final n_lifted = FfiConverterUInt64.read( Uint8List.view(buf.buffer, new_offset), ); - final flag = flag_lifted.value; - new_offset += flag_lifted.bytesRead; + final n = n_lifted.value; + new_offset += n_lifted.bytesRead; + final m_lifted = FfiConverterUInt64.read( + Uint8List.view(buf.buffer, new_offset), + ); + final m = m_lifted.value; + new_offset += m_lifted.bytesRead; + final items_lifted = FfiConverterSequenceUInt64.read( + Uint8List.view(buf.buffer, new_offset), + ); + final items = items_lifted.value; + new_offset += items_lifted.bytesRead; + final sorted_lifted = FfiConverterOptionalBool.read( + Uint8List.view(buf.buffer, new_offset), + ); + final sorted = sorted_lifted.value; + new_offset += sorted_lifted.bytesRead; + final conditions_lifted = + FfiConverterMapSequenceUInt32ToSequenceCondition.read( + Uint8List.view(buf.buffer, new_offset), + ); + final conditions = conditions_lifted.value; + new_offset += conditions_lifted.bytesRead; return LiftRetVal( - UnsupportedSegwitFlagTransactionException._(flag), + PartialCompleteSatisfaction._(n, m, items, sorted, conditions), new_offset, ); } @@ -18258,34 +18305,56 @@ class UnsupportedSegwitFlagTransactionException extends TransactionException { @override int allocationSize() { - return FfiConverterUInt8.allocationSize(flag) + 4; + return FfiConverterUInt64.allocationSize(n) + + FfiConverterUInt64.allocationSize(m) + + FfiConverterSequenceUInt64.allocationSize(items) + + FfiConverterOptionalBool.allocationSize(sorted) + + FfiConverterMapSequenceUInt32ToSequenceCondition.allocationSize( + conditions, + ) + + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 6); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 2); int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterUInt8.write( - flag, + new_offset += FfiConverterUInt64.write( + n, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterUInt64.write( + m, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterSequenceUInt64.write( + items, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalBool.write( + sorted, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterMapSequenceUInt32ToSequenceCondition.write( + conditions, Uint8List.view(buf.buffer, new_offset), ); return new_offset; } - - @override - String toString() { - return "UnsupportedSegwitFlagTransactionException($flag)"; - } } -class OtherTransactionErrTransactionException extends TransactionException { - OtherTransactionErrTransactionException(); - OtherTransactionErrTransactionException._(); - static LiftRetVal read( - Uint8List buf, - ) { +class CompleteSatisfaction extends Satisfaction { + final Condition condition; + CompleteSatisfaction(Condition this.condition); + CompleteSatisfaction._(Condition this.condition); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(OtherTransactionErrTransactionException._(), new_offset); + final condition_lifted = FfiConverterCondition.read( + Uint8List.view(buf.buffer, new_offset), + ); + final condition = condition_lifted.value; + new_offset += condition_lifted.bytesRead; + return LiftRetVal(CompleteSatisfaction._(condition), new_offset); } @override @@ -18297,123 +18366,33 @@ class OtherTransactionErrTransactionException extends TransactionException { @override int allocationSize() { - return 4; + return FfiConverterCondition.allocationSize(condition) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 7); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 3); int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterCondition.write( + condition, + Uint8List.view(buf.buffer, new_offset), + ); return new_offset; } - - @override - String toString() { - return "OtherTransactionErrTransactionException"; - } -} - -class TransactionExceptionErrorHandler - extends UniffiRustCallStatusErrorHandler { - @override - Exception lift(RustBuffer errorBuf) { - return FfiConverterTransactionException.lift(errorBuf); - } -} - -final TransactionExceptionErrorHandler transactionExceptionErrorHandler = - TransactionExceptionErrorHandler(); - -enum TxOrdering { shuffle, untouched } - -class FfiConverterTxOrdering { - static LiftRetVal read(Uint8List buf) { - final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); - switch (index) { - case 1: - return LiftRetVal(TxOrdering.shuffle, 4); - case 2: - return LiftRetVal(TxOrdering.untouched, 4); - default: - throw UniffiInternalError( - UniffiInternalError.unexpectedEnumCase, - "Unable to determine enum variant", - ); - } - } - - static TxOrdering lift(RustBuffer buffer) { - return FfiConverterTxOrdering.read(buffer.asUint8List()).value; - } - - static RustBuffer lower(TxOrdering input) { - return toRustBuffer(createUint8ListFromInt(input.index + 1)); - } - - static int allocationSize(TxOrdering _value) { - return 4; - } - - static int write(TxOrdering value, Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, value.index + 1); - return 4; - } -} - -abstract class TxidParseException implements Exception { - RustBuffer lower(); - int allocationSize(); - int write(Uint8List buf); -} - -class FfiConverterTxidParseException { - static TxidParseException lift(RustBuffer buffer) { - return FfiConverterTxidParseException.read(buffer.asUint8List()).value; - } - - static LiftRetVal read(Uint8List buf) { - final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); - final subview = Uint8List.view(buf.buffer, buf.offsetInBytes + 4); - switch (index) { - case 1: - final lifted = InvalidTxidTxidParseException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - default: - throw UniffiInternalError( - UniffiInternalError.unexpectedEnumCase, - "Unable to determine enum variant", - ); - } - } - - static RustBuffer lower(TxidParseException value) { - return value.lower(); - } - - static int allocationSize(TxidParseException value) { - return value.allocationSize(); - } - - static int write(TxidParseException value, Uint8List buf) { - return value.write(buf) - buf.offsetInBytes; - } } -class InvalidTxidTxidParseException extends TxidParseException { - final String txid; - InvalidTxidTxidParseException(String this.txid); - InvalidTxidTxidParseException._(String this.txid); - static LiftRetVal read(Uint8List buf) { +class NoneSatisfaction extends Satisfaction { + final String msg; + NoneSatisfaction(String this.msg); + NoneSatisfaction._(String this.msg); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final txid_lifted = FfiConverterString.read( + final msg_lifted = FfiConverterString.read( Uint8List.view(buf.buffer, new_offset), ); - final txid = txid_lifted.value; - new_offset += txid_lifted.bytesRead; - return LiftRetVal(InvalidTxidTxidParseException._(txid), new_offset); + final msg = msg_lifted.value; + new_offset += msg_lifted.bytesRead; + return LiftRetVal(NoneSatisfaction._(msg), new_offset); } @override @@ -18425,78 +18404,93 @@ class InvalidTxidTxidParseException extends TxidParseException { @override int allocationSize() { - return FfiConverterString.allocationSize(txid) + 4; + return FfiConverterString.allocationSize(msg) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 4); int new_offset = buf.offsetInBytes + 4; new_offset += FfiConverterString.write( - txid, + msg, Uint8List.view(buf.buffer, new_offset), ); return new_offset; } - - @override - String toString() { - return "InvalidTxidTxidParseException($txid)"; - } -} - -class TxidParseExceptionErrorHandler extends UniffiRustCallStatusErrorHandler { - @override - Exception lift(RustBuffer errorBuf) { - return FfiConverterTxidParseException.lift(errorBuf); - } } -final TxidParseExceptionErrorHandler txidParseExceptionErrorHandler = - TxidParseExceptionErrorHandler(); - -abstract class WalletEvent { +abstract class SatisfiableItem { RustBuffer lower(); int allocationSize(); int write(Uint8List buf); } -class FfiConverterWalletEvent { - static WalletEvent lift(RustBuffer buffer) { - return FfiConverterWalletEvent.read(buffer.asUint8List()).value; +class FfiConverterSatisfiableItem { + static SatisfiableItem lift(RustBuffer buffer) { + return FfiConverterSatisfiableItem.read(buffer.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); final subview = Uint8List.view(buf.buffer, buf.offsetInBytes + 4); switch (index) { case 1: - final lifted = ChainTipChangedWalletEvent.read(subview); - return LiftRetVal( + final lifted = EcdsaSignatureSatisfiableItem.read(subview); + return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); case 2: - final lifted = TxConfirmedWalletEvent.read(subview); - return LiftRetVal( + final lifted = SchnorrSignatureSatisfiableItem.read(subview); + return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); case 3: - final lifted = TxUnconfirmedWalletEvent.read(subview); - return LiftRetVal( + final lifted = Sha256PreimageSatisfiableItem.read(subview); + return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); case 4: - final lifted = TxReplacedWalletEvent.read(subview); - return LiftRetVal( + final lifted = Hash256PreimageSatisfiableItem.read(subview); + return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); case 5: - final lifted = TxDroppedWalletEvent.read(subview); - return LiftRetVal( + final lifted = Ripemd160PreimageSatisfiableItem.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 6: + final lifted = Hash160PreimageSatisfiableItem.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 7: + final lifted = AbsoluteTimelockSatisfiableItem.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 8: + final lifted = RelativeTimelockSatisfiableItem.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 9: + final lifted = MultisigSatisfiableItem.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 10: + final lifted = ThreshSatisfiableItem.read(subview); + return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); @@ -18508,40 +18502,31 @@ class FfiConverterWalletEvent { } } - static RustBuffer lower(WalletEvent value) { + static RustBuffer lower(SatisfiableItem value) { return value.lower(); } - static int allocationSize(WalletEvent value) { + static int allocationSize(SatisfiableItem value) { return value.allocationSize(); } - static int write(WalletEvent value, Uint8List buf) { + static int write(SatisfiableItem value, Uint8List buf) { return value.write(buf) - buf.offsetInBytes; } } -class ChainTipChangedWalletEvent extends WalletEvent { - final BlockId oldTip; - final BlockId newTip; - ChainTipChangedWalletEvent({ - required BlockId this.oldTip, - required BlockId this.newTip, - }); - ChainTipChangedWalletEvent._(BlockId this.oldTip, BlockId this.newTip); - static LiftRetVal read(Uint8List buf) { +class EcdsaSignatureSatisfiableItem extends SatisfiableItem { + final PkOrF key; + EcdsaSignatureSatisfiableItem(PkOrF this.key); + EcdsaSignatureSatisfiableItem._(PkOrF this.key); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final oldTip_lifted = FfiConverterBlockId.read( - Uint8List.view(buf.buffer, new_offset), - ); - final oldTip = oldTip_lifted.value; - new_offset += oldTip_lifted.bytesRead; - final newTip_lifted = FfiConverterBlockId.read( + final key_lifted = FfiConverterPkOrF.read( Uint8List.view(buf.buffer, new_offset), ); - final newTip = newTip_lifted.value; - new_offset += newTip_lifted.bytesRead; - return LiftRetVal(ChainTipChangedWalletEvent._(oldTip, newTip), new_offset); + final key = key_lifted.value; + new_offset += key_lifted.bytesRead; + return LiftRetVal(EcdsaSignatureSatisfiableItem._(key), new_offset); } @override @@ -18553,66 +18538,33 @@ class ChainTipChangedWalletEvent extends WalletEvent { @override int allocationSize() { - return FfiConverterBlockId.allocationSize(oldTip) + - FfiConverterBlockId.allocationSize(newTip) + - 4; + return FfiConverterPkOrF.allocationSize(key) + 4; } @override int write(Uint8List buf) { buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterBlockId.write( - oldTip, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterBlockId.write( - newTip, + new_offset += FfiConverterPkOrF.write( + key, Uint8List.view(buf.buffer, new_offset), ); return new_offset; } } -class TxConfirmedWalletEvent extends WalletEvent { - final Txid txid; - final Transaction tx; - final ConfirmationBlockTime blockTime; - final ConfirmationBlockTime? oldBlockTime; - TxConfirmedWalletEvent({ - required Txid this.txid, - required Transaction this.tx, - required ConfirmationBlockTime this.blockTime, - required ConfirmationBlockTime? this.oldBlockTime, - }); - TxConfirmedWalletEvent._( - Txid this.txid, - Transaction this.tx, - ConfirmationBlockTime this.blockTime, - ConfirmationBlockTime? this.oldBlockTime, - ); - static LiftRetVal read(Uint8List buf) { +class SchnorrSignatureSatisfiableItem extends SatisfiableItem { + final PkOrF key; + SchnorrSignatureSatisfiableItem(PkOrF this.key); + SchnorrSignatureSatisfiableItem._(PkOrF this.key); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final txid_lifted = Txid.read(Uint8List.view(buf.buffer, new_offset)); - final txid = txid_lifted.value; - new_offset += txid_lifted.bytesRead; - final tx_lifted = Transaction.read(Uint8List.view(buf.buffer, new_offset)); - final tx = tx_lifted.value; - new_offset += tx_lifted.bytesRead; - final blockTime_lifted = FfiConverterConfirmationBlockTime.read( - Uint8List.view(buf.buffer, new_offset), - ); - final blockTime = blockTime_lifted.value; - new_offset += blockTime_lifted.bytesRead; - final oldBlockTime_lifted = FfiConverterOptionalConfirmationBlockTime.read( + final key_lifted = FfiConverterPkOrF.read( Uint8List.view(buf.buffer, new_offset), ); - final oldBlockTime = oldBlockTime_lifted.value; - new_offset += oldBlockTime_lifted.bytesRead; - return LiftRetVal( - TxConfirmedWalletEvent._(txid, tx, blockTime, oldBlockTime), - new_offset, - ); + final key = key_lifted.value; + new_offset += key_lifted.bytesRead; + return LiftRetVal(SchnorrSignatureSatisfiableItem._(key), new_offset); } @override @@ -18624,62 +18576,33 @@ class TxConfirmedWalletEvent extends WalletEvent { @override int allocationSize() { - return Txid.allocationSize(txid) + - Transaction.allocationSize(tx) + - FfiConverterConfirmationBlockTime.allocationSize(blockTime) + - FfiConverterOptionalConfirmationBlockTime.allocationSize(oldBlockTime) + - 4; + return FfiConverterPkOrF.allocationSize(key) + 4; } @override int write(Uint8List buf) { buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 2); int new_offset = buf.offsetInBytes + 4; - new_offset += Txid.write(txid, Uint8List.view(buf.buffer, new_offset)); - new_offset += Transaction.write(tx, Uint8List.view(buf.buffer, new_offset)); - new_offset += FfiConverterConfirmationBlockTime.write( - blockTime, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalConfirmationBlockTime.write( - oldBlockTime, + new_offset += FfiConverterPkOrF.write( + key, Uint8List.view(buf.buffer, new_offset), ); return new_offset; } } -class TxUnconfirmedWalletEvent extends WalletEvent { - final Txid txid; - final Transaction tx; - final ConfirmationBlockTime? oldBlockTime; - TxUnconfirmedWalletEvent({ - required Txid this.txid, - required Transaction this.tx, - required ConfirmationBlockTime? this.oldBlockTime, - }); - TxUnconfirmedWalletEvent._( - Txid this.txid, - Transaction this.tx, - ConfirmationBlockTime? this.oldBlockTime, - ); - static LiftRetVal read(Uint8List buf) { +class Sha256PreimageSatisfiableItem extends SatisfiableItem { + final String hash; + Sha256PreimageSatisfiableItem(String this.hash); + Sha256PreimageSatisfiableItem._(String this.hash); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final txid_lifted = Txid.read(Uint8List.view(buf.buffer, new_offset)); - final txid = txid_lifted.value; - new_offset += txid_lifted.bytesRead; - final tx_lifted = Transaction.read(Uint8List.view(buf.buffer, new_offset)); - final tx = tx_lifted.value; - new_offset += tx_lifted.bytesRead; - final oldBlockTime_lifted = FfiConverterOptionalConfirmationBlockTime.read( + final hash_lifted = FfiConverterString.read( Uint8List.view(buf.buffer, new_offset), ); - final oldBlockTime = oldBlockTime_lifted.value; - new_offset += oldBlockTime_lifted.bytesRead; - return LiftRetVal( - TxUnconfirmedWalletEvent._(txid, tx, oldBlockTime), - new_offset, - ); + final hash = hash_lifted.value; + new_offset += hash_lifted.bytesRead; + return LiftRetVal(Sha256PreimageSatisfiableItem._(hash), new_offset); } @override @@ -18691,54 +18614,33 @@ class TxUnconfirmedWalletEvent extends WalletEvent { @override int allocationSize() { - return Txid.allocationSize(txid) + - Transaction.allocationSize(tx) + - FfiConverterOptionalConfirmationBlockTime.allocationSize(oldBlockTime) + - 4; + return FfiConverterString.allocationSize(hash) + 4; } @override int write(Uint8List buf) { buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 3); int new_offset = buf.offsetInBytes + 4; - new_offset += Txid.write(txid, Uint8List.view(buf.buffer, new_offset)); - new_offset += Transaction.write(tx, Uint8List.view(buf.buffer, new_offset)); - new_offset += FfiConverterOptionalConfirmationBlockTime.write( - oldBlockTime, + new_offset += FfiConverterString.write( + hash, Uint8List.view(buf.buffer, new_offset), ); return new_offset; } } -class TxReplacedWalletEvent extends WalletEvent { - final Txid txid; - final Transaction tx; - final List conflicts; - TxReplacedWalletEvent({ - required Txid this.txid, - required Transaction this.tx, - required List this.conflicts, - }); - TxReplacedWalletEvent._( - Txid this.txid, - Transaction this.tx, - List this.conflicts, - ); - static LiftRetVal read(Uint8List buf) { +class Hash256PreimageSatisfiableItem extends SatisfiableItem { + final String hash; + Hash256PreimageSatisfiableItem(String this.hash); + Hash256PreimageSatisfiableItem._(String this.hash); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final txid_lifted = Txid.read(Uint8List.view(buf.buffer, new_offset)); - final txid = txid_lifted.value; - new_offset += txid_lifted.bytesRead; - final tx_lifted = Transaction.read(Uint8List.view(buf.buffer, new_offset)); - final tx = tx_lifted.value; - new_offset += tx_lifted.bytesRead; - final conflicts_lifted = FfiConverterSequenceConflict.read( + final hash_lifted = FfiConverterString.read( Uint8List.view(buf.buffer, new_offset), ); - final conflicts = conflicts_lifted.value; - new_offset += conflicts_lifted.bytesRead; - return LiftRetVal(TxReplacedWalletEvent._(txid, tx, conflicts), new_offset); + final hash = hash_lifted.value; + new_offset += hash_lifted.bytesRead; + return LiftRetVal(Hash256PreimageSatisfiableItem._(hash), new_offset); } @override @@ -18750,40 +18652,33 @@ class TxReplacedWalletEvent extends WalletEvent { @override int allocationSize() { - return Txid.allocationSize(txid) + - Transaction.allocationSize(tx) + - FfiConverterSequenceConflict.allocationSize(conflicts) + - 4; + return FfiConverterString.allocationSize(hash) + 4; } @override int write(Uint8List buf) { buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 4); int new_offset = buf.offsetInBytes + 4; - new_offset += Txid.write(txid, Uint8List.view(buf.buffer, new_offset)); - new_offset += Transaction.write(tx, Uint8List.view(buf.buffer, new_offset)); - new_offset += FfiConverterSequenceConflict.write( - conflicts, + new_offset += FfiConverterString.write( + hash, Uint8List.view(buf.buffer, new_offset), ); return new_offset; } } -class TxDroppedWalletEvent extends WalletEvent { - final Txid txid; - final Transaction tx; - TxDroppedWalletEvent({required Txid this.txid, required Transaction this.tx}); - TxDroppedWalletEvent._(Txid this.txid, Transaction this.tx); - static LiftRetVal read(Uint8List buf) { +class Ripemd160PreimageSatisfiableItem extends SatisfiableItem { + final String hash; + Ripemd160PreimageSatisfiableItem(String this.hash); + Ripemd160PreimageSatisfiableItem._(String this.hash); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final txid_lifted = Txid.read(Uint8List.view(buf.buffer, new_offset)); - final txid = txid_lifted.value; - new_offset += txid_lifted.bytesRead; - final tx_lifted = Transaction.read(Uint8List.view(buf.buffer, new_offset)); - final tx = tx_lifted.value; - new_offset += tx_lifted.bytesRead; - return LiftRetVal(TxDroppedWalletEvent._(txid, tx), new_offset); + final hash_lifted = FfiConverterString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final hash = hash_lifted.value; + new_offset += hash_lifted.bytesRead; + return LiftRetVal(Ripemd160PreimageSatisfiableItem._(hash), new_offset); } @override @@ -18795,121 +18690,33 @@ class TxDroppedWalletEvent extends WalletEvent { @override int allocationSize() { - return Txid.allocationSize(txid) + Transaction.allocationSize(tx) + 4; + return FfiConverterString.allocationSize(hash) + 4; } @override int write(Uint8List buf) { buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 5); int new_offset = buf.offsetInBytes + 4; - new_offset += Txid.write(txid, Uint8List.view(buf.buffer, new_offset)); - new_offset += Transaction.write(tx, Uint8List.view(buf.buffer, new_offset)); + new_offset += FfiConverterString.write( + hash, + Uint8List.view(buf.buffer, new_offset), + ); return new_offset; } } -abstract class Warning { - RustBuffer lower(); - int allocationSize(); - int write(Uint8List buf); -} - -class FfiConverterWarning { - static Warning lift(RustBuffer buffer) { - return FfiConverterWarning.read(buffer.asUint8List()).value; - } - - static LiftRetVal read(Uint8List buf) { - final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); - final subview = Uint8List.view(buf.buffer, buf.offsetInBytes + 4); - switch (index) { - case 1: - final lifted = NeedConnectionsWarning.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 2: - final lifted = PeerTimedOutWarning.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 3: - final lifted = CouldNotConnectWarning.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 4: - final lifted = NoCompactFiltersWarning.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 5: - final lifted = PotentialStaleTipWarning.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 6: - final lifted = UnsolicitedMessageWarning.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 7: - final lifted = TransactionRejectedWarning.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 8: - final lifted = EvaluatingForkWarning.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 9: - final lifted = UnexpectedSyncExceptionWarning.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 10: - final lifted = RequestFailedWarning.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - default: - throw UniffiInternalError( - UniffiInternalError.unexpectedEnumCase, - "Unable to determine enum variant", - ); - } - } - - static RustBuffer lower(Warning value) { - return value.lower(); - } - - static int allocationSize(Warning value) { - return value.allocationSize(); - } - - static int write(Warning value, Uint8List buf) { - return value.write(buf) - buf.offsetInBytes; - } -} - -class NeedConnectionsWarning extends Warning { - NeedConnectionsWarning(); - NeedConnectionsWarning._(); - static LiftRetVal read(Uint8List buf) { +class Hash160PreimageSatisfiableItem extends SatisfiableItem { + final String hash; + Hash160PreimageSatisfiableItem(String this.hash); + Hash160PreimageSatisfiableItem._(String this.hash); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(NeedConnectionsWarning._(), new_offset); + final hash_lifted = FfiConverterString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final hash = hash_lifted.value; + new_offset += hash_lifted.bytesRead; + return LiftRetVal(Hash160PreimageSatisfiableItem._(hash), new_offset); } @override @@ -18921,23 +18728,33 @@ class NeedConnectionsWarning extends Warning { @override int allocationSize() { - return 4; + return FfiConverterString.allocationSize(hash) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 6); int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterString.write( + hash, + Uint8List.view(buf.buffer, new_offset), + ); return new_offset; } } -class PeerTimedOutWarning extends Warning { - PeerTimedOutWarning(); - PeerTimedOutWarning._(); - static LiftRetVal read(Uint8List buf) { +class AbsoluteTimelockSatisfiableItem extends SatisfiableItem { + final LockTime value; + AbsoluteTimelockSatisfiableItem(LockTime this.value); + AbsoluteTimelockSatisfiableItem._(LockTime this.value); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(PeerTimedOutWarning._(), new_offset); + final value_lifted = FfiConverterLockTime.read( + Uint8List.view(buf.buffer, new_offset), + ); + final value = value_lifted.value; + new_offset += value_lifted.bytesRead; + return LiftRetVal(AbsoluteTimelockSatisfiableItem._(value), new_offset); } @override @@ -18949,23 +18766,33 @@ class PeerTimedOutWarning extends Warning { @override int allocationSize() { - return 4; + return FfiConverterLockTime.allocationSize(value) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 2); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 7); int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterLockTime.write( + value, + Uint8List.view(buf.buffer, new_offset), + ); return new_offset; } } -class CouldNotConnectWarning extends Warning { - CouldNotConnectWarning(); - CouldNotConnectWarning._(); - static LiftRetVal read(Uint8List buf) { +class RelativeTimelockSatisfiableItem extends SatisfiableItem { + final int value; + RelativeTimelockSatisfiableItem(int this.value); + RelativeTimelockSatisfiableItem._(int this.value); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(CouldNotConnectWarning._(), new_offset); + final value_lifted = FfiConverterUInt32.read( + Uint8List.view(buf.buffer, new_offset), + ); + final value = value_lifted.value; + new_offset += value_lifted.bytesRead; + return LiftRetVal(RelativeTimelockSatisfiableItem._(value), new_offset); } @override @@ -18977,23 +18804,42 @@ class CouldNotConnectWarning extends Warning { @override int allocationSize() { - return 4; + return FfiConverterUInt32.allocationSize(value) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 3); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 8); int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterUInt32.write( + value, + Uint8List.view(buf.buffer, new_offset), + ); return new_offset; } } -class NoCompactFiltersWarning extends Warning { - NoCompactFiltersWarning(); - NoCompactFiltersWarning._(); - static LiftRetVal read(Uint8List buf) { +class MultisigSatisfiableItem extends SatisfiableItem { + final List keys; + final int threshold; + MultisigSatisfiableItem({ + required List this.keys, + required int this.threshold, + }); + MultisigSatisfiableItem._(List this.keys, int this.threshold); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(NoCompactFiltersWarning._(), new_offset); + final keys_lifted = FfiConverterSequencePkOrF.read( + Uint8List.view(buf.buffer, new_offset), + ); + final keys = keys_lifted.value; + new_offset += keys_lifted.bytesRead; + final threshold_lifted = FfiConverterUInt64.read( + Uint8List.view(buf.buffer, new_offset), + ); + final threshold = threshold_lifted.value; + new_offset += threshold_lifted.bytesRead; + return LiftRetVal(MultisigSatisfiableItem._(keys, threshold), new_offset); } @override @@ -19005,23 +18851,48 @@ class NoCompactFiltersWarning extends Warning { @override int allocationSize() { - return 4; + return FfiConverterSequencePkOrF.allocationSize(keys) + + FfiConverterUInt64.allocationSize(threshold) + + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 4); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 9); int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterSequencePkOrF.write( + keys, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterUInt64.write( + threshold, + Uint8List.view(buf.buffer, new_offset), + ); return new_offset; } } -class PotentialStaleTipWarning extends Warning { - PotentialStaleTipWarning(); - PotentialStaleTipWarning._(); - static LiftRetVal read(Uint8List buf) { +class ThreshSatisfiableItem extends SatisfiableItem { + final List items; + final int threshold; + ThreshSatisfiableItem({ + required List this.items, + required int this.threshold, + }); + ThreshSatisfiableItem._(List this.items, int this.threshold); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(PotentialStaleTipWarning._(), new_offset); + final items_lifted = FfiConverterSequencePolicy.read( + Uint8List.view(buf.buffer, new_offset), + ); + final items = items_lifted.value; + new_offset += items_lifted.bytesRead; + final threshold_lifted = FfiConverterUInt64.read( + Uint8List.view(buf.buffer, new_offset), + ); + final threshold = threshold_lifted.value; + new_offset += threshold_lifted.bytesRead; + return LiftRetVal(ThreshSatisfiableItem._(items, threshold), new_offset); } @override @@ -19033,23 +18904,114 @@ class PotentialStaleTipWarning extends Warning { @override int allocationSize() { - return 4; + return FfiConverterSequencePolicy.allocationSize(items) + + FfiConverterUInt64.allocationSize(threshold) + + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 5); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 10); int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterSequencePolicy.write( + items, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterUInt64.write( + threshold, + Uint8List.view(buf.buffer, new_offset), + ); return new_offset; } } -class UnsolicitedMessageWarning extends Warning { - UnsolicitedMessageWarning(); - UnsolicitedMessageWarning._(); - static LiftRetVal read(Uint8List buf) { +abstract class WalletEvent { + RustBuffer lower(); + int allocationSize(); + int write(Uint8List buf); +} + +class FfiConverterWalletEvent { + static WalletEvent lift(RustBuffer buffer) { + return FfiConverterWalletEvent.read(buffer.asUint8List()).value; + } + + static LiftRetVal read(Uint8List buf) { + final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); + final subview = Uint8List.view(buf.buffer, buf.offsetInBytes + 4); + switch (index) { + case 1: + final lifted = ChainTipChangedWalletEvent.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 2: + final lifted = TxConfirmedWalletEvent.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 3: + final lifted = TxUnconfirmedWalletEvent.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 4: + final lifted = TxReplacedWalletEvent.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 5: + final lifted = TxDroppedWalletEvent.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + default: + throw UniffiInternalError( + UniffiInternalError.unexpectedEnumCase, + "Unable to determine enum variant", + ); + } + } + + static RustBuffer lower(WalletEvent value) { + return value.lower(); + } + + static int allocationSize(WalletEvent value) { + return value.allocationSize(); + } + + static int write(WalletEvent value, Uint8List buf) { + return value.write(buf) - buf.offsetInBytes; + } +} + +class ChainTipChangedWalletEvent extends WalletEvent { + final BlockId oldTip; + final BlockId newTip; + ChainTipChangedWalletEvent({ + required BlockId this.oldTip, + required BlockId this.newTip, + }); + ChainTipChangedWalletEvent._(BlockId this.oldTip, BlockId this.newTip); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(UnsolicitedMessageWarning._(), new_offset); + final oldTip_lifted = FfiConverterBlockId.read( + Uint8List.view(buf.buffer, new_offset), + ); + final oldTip = oldTip_lifted.value; + new_offset += oldTip_lifted.bytesRead; + final newTip_lifted = FfiConverterBlockId.read( + Uint8List.view(buf.buffer, new_offset), + ); + final newTip = newTip_lifted.value; + new_offset += newTip_lifted.bytesRead; + return LiftRetVal(ChainTipChangedWalletEvent._(oldTip, newTip), new_offset); } @override @@ -19061,38 +19023,66 @@ class UnsolicitedMessageWarning extends Warning { @override int allocationSize() { - return 4; + return FfiConverterBlockId.allocationSize(oldTip) + + FfiConverterBlockId.allocationSize(newTip) + + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 6); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterBlockId.write( + oldTip, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterBlockId.write( + newTip, + Uint8List.view(buf.buffer, new_offset), + ); return new_offset; } } -class TransactionRejectedWarning extends Warning { - final String wtxid; - final String? reason; - TransactionRejectedWarning({ - required String this.wtxid, - required String? this.reason, +class TxConfirmedWalletEvent extends WalletEvent { + final Txid txid; + final Transaction tx; + final ConfirmationBlockTime blockTime; + final ConfirmationBlockTime? oldBlockTime; + TxConfirmedWalletEvent({ + required Txid this.txid, + required Transaction this.tx, + required ConfirmationBlockTime this.blockTime, + required ConfirmationBlockTime? this.oldBlockTime, }); - TransactionRejectedWarning._(String this.wtxid, String? this.reason); - static LiftRetVal read(Uint8List buf) { + TxConfirmedWalletEvent._( + Txid this.txid, + Transaction this.tx, + ConfirmationBlockTime this.blockTime, + ConfirmationBlockTime? this.oldBlockTime, + ); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final wtxid_lifted = FfiConverterString.read( + final txid_lifted = Txid.read(Uint8List.view(buf.buffer, new_offset)); + final txid = txid_lifted.value; + new_offset += txid_lifted.bytesRead; + final tx_lifted = Transaction.read(Uint8List.view(buf.buffer, new_offset)); + final tx = tx_lifted.value; + new_offset += tx_lifted.bytesRead; + final blockTime_lifted = FfiConverterConfirmationBlockTime.read( Uint8List.view(buf.buffer, new_offset), ); - final wtxid = wtxid_lifted.value; - new_offset += wtxid_lifted.bytesRead; - final reason_lifted = FfiConverterOptionalString.read( + final blockTime = blockTime_lifted.value; + new_offset += blockTime_lifted.bytesRead; + final oldBlockTime_lifted = FfiConverterOptionalConfirmationBlockTime.read( Uint8List.view(buf.buffer, new_offset), ); - final reason = reason_lifted.value; - new_offset += reason_lifted.bytesRead; - return LiftRetVal(TransactionRejectedWarning._(wtxid, reason), new_offset); + final oldBlockTime = oldBlockTime_lifted.value; + new_offset += oldBlockTime_lifted.bytesRead; + return LiftRetVal( + TxConfirmedWalletEvent._(txid, tx, blockTime, oldBlockTime), + new_offset, + ); } @override @@ -19104,33 +19094,62 @@ class TransactionRejectedWarning extends Warning { @override int allocationSize() { - return FfiConverterString.allocationSize(wtxid) + - FfiConverterOptionalString.allocationSize(reason) + + return Txid.allocationSize(txid) + + Transaction.allocationSize(tx) + + FfiConverterConfirmationBlockTime.allocationSize(blockTime) + + FfiConverterOptionalConfirmationBlockTime.allocationSize(oldBlockTime) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 7); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 2); int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - wtxid, + new_offset += Txid.write(txid, Uint8List.view(buf.buffer, new_offset)); + new_offset += Transaction.write(tx, Uint8List.view(buf.buffer, new_offset)); + new_offset += FfiConverterConfirmationBlockTime.write( + blockTime, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterOptionalString.write( - reason, + new_offset += FfiConverterOptionalConfirmationBlockTime.write( + oldBlockTime, Uint8List.view(buf.buffer, new_offset), ); return new_offset; } } -class EvaluatingForkWarning extends Warning { - EvaluatingForkWarning(); - EvaluatingForkWarning._(); - static LiftRetVal read(Uint8List buf) { +class TxUnconfirmedWalletEvent extends WalletEvent { + final Txid txid; + final Transaction tx; + final ConfirmationBlockTime? oldBlockTime; + TxUnconfirmedWalletEvent({ + required Txid this.txid, + required Transaction this.tx, + required ConfirmationBlockTime? this.oldBlockTime, + }); + TxUnconfirmedWalletEvent._( + Txid this.txid, + Transaction this.tx, + ConfirmationBlockTime? this.oldBlockTime, + ); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(EvaluatingForkWarning._(), new_offset); + final txid_lifted = Txid.read(Uint8List.view(buf.buffer, new_offset)); + final txid = txid_lifted.value; + new_offset += txid_lifted.bytesRead; + final tx_lifted = Transaction.read(Uint8List.view(buf.buffer, new_offset)); + final tx = tx_lifted.value; + new_offset += tx_lifted.bytesRead; + final oldBlockTime_lifted = FfiConverterOptionalConfirmationBlockTime.read( + Uint8List.view(buf.buffer, new_offset), + ); + final oldBlockTime = oldBlockTime_lifted.value; + new_offset += oldBlockTime_lifted.bytesRead; + return LiftRetVal( + TxUnconfirmedWalletEvent._(txid, tx, oldBlockTime), + new_offset, + ); } @override @@ -19142,29 +19161,54 @@ class EvaluatingForkWarning extends Warning { @override int allocationSize() { - return 4; + return Txid.allocationSize(txid) + + Transaction.allocationSize(tx) + + FfiConverterOptionalConfirmationBlockTime.allocationSize(oldBlockTime) + + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 8); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 3); int new_offset = buf.offsetInBytes + 4; + new_offset += Txid.write(txid, Uint8List.view(buf.buffer, new_offset)); + new_offset += Transaction.write(tx, Uint8List.view(buf.buffer, new_offset)); + new_offset += FfiConverterOptionalConfirmationBlockTime.write( + oldBlockTime, + Uint8List.view(buf.buffer, new_offset), + ); return new_offset; } } -class UnexpectedSyncExceptionWarning extends Warning { - final String warning; - UnexpectedSyncExceptionWarning(String this.warning); - UnexpectedSyncExceptionWarning._(String this.warning); - static LiftRetVal read(Uint8List buf) { +class TxReplacedWalletEvent extends WalletEvent { + final Txid txid; + final Transaction tx; + final List conflicts; + TxReplacedWalletEvent({ + required Txid this.txid, + required Transaction this.tx, + required List this.conflicts, + }); + TxReplacedWalletEvent._( + Txid this.txid, + Transaction this.tx, + List this.conflicts, + ); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final warning_lifted = FfiConverterString.read( + final txid_lifted = Txid.read(Uint8List.view(buf.buffer, new_offset)); + final txid = txid_lifted.value; + new_offset += txid_lifted.bytesRead; + final tx_lifted = Transaction.read(Uint8List.view(buf.buffer, new_offset)); + final tx = tx_lifted.value; + new_offset += tx_lifted.bytesRead; + final conflicts_lifted = FfiConverterSequenceConflict.read( Uint8List.view(buf.buffer, new_offset), ); - final warning = warning_lifted.value; - new_offset += warning_lifted.bytesRead; - return LiftRetVal(UnexpectedSyncExceptionWarning._(warning), new_offset); + final conflicts = conflicts_lifted.value; + new_offset += conflicts_lifted.bytesRead; + return LiftRetVal(TxReplacedWalletEvent._(txid, tx, conflicts), new_offset); } @override @@ -19176,27 +19220,40 @@ class UnexpectedSyncExceptionWarning extends Warning { @override int allocationSize() { - return FfiConverterString.allocationSize(warning) + 4; + return Txid.allocationSize(txid) + + Transaction.allocationSize(tx) + + FfiConverterSequenceConflict.allocationSize(conflicts) + + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 9); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 4); int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - warning, + new_offset += Txid.write(txid, Uint8List.view(buf.buffer, new_offset)); + new_offset += Transaction.write(tx, Uint8List.view(buf.buffer, new_offset)); + new_offset += FfiConverterSequenceConflict.write( + conflicts, Uint8List.view(buf.buffer, new_offset), ); return new_offset; } } -class RequestFailedWarning extends Warning { - RequestFailedWarning(); - RequestFailedWarning._(); - static LiftRetVal read(Uint8List buf) { +class TxDroppedWalletEvent extends WalletEvent { + final Txid txid; + final Transaction tx; + TxDroppedWalletEvent({required Txid this.txid, required Transaction this.tx}); + TxDroppedWalletEvent._(Txid this.txid, Transaction this.tx); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(RequestFailedWarning._(), new_offset); + final txid_lifted = Txid.read(Uint8List.view(buf.buffer, new_offset)); + final txid = txid_lifted.value; + new_offset += txid_lifted.bytesRead; + final tx_lifted = Transaction.read(Uint8List.view(buf.buffer, new_offset)); + final tx = tx_lifted.value; + new_offset += tx_lifted.bytesRead; + return LiftRetVal(TxDroppedWalletEvent._(txid, tx), new_offset); } @override @@ -19208,13 +19265,15 @@ class RequestFailedWarning extends Warning { @override int allocationSize() { - return 4; + return Txid.allocationSize(txid) + Transaction.allocationSize(tx) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 10); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 5); int new_offset = buf.offsetInBytes + 4; + new_offset += Txid.write(txid, Uint8List.view(buf.buffer, new_offset)); + new_offset += Transaction.write(tx, Uint8List.view(buf.buffer, new_offset)); return new_offset; } } @@ -19320,57 +19379,403 @@ class Address implements AddressInterface { FfiConverterNetwork.lower(network), status, ), - fromScriptExceptionErrorHandler, + fromScriptExceptionErrorHandler, + ) { + _AddressFinalizer.attach(this, _ptr, detach: this); + } + Address({required String address, required Network network}) + : _ptr = rustCall( + (status) => uniffi_bdkffi_fn_constructor_address_new( + FfiConverterString.lower(address), + FfiConverterNetwork.lower(network), + status, + ), + addressParseExceptionErrorHandler, + ) { + _AddressFinalizer.attach(this, _ptr, detach: this); + } + factory Address.lift(Pointer ptr) { + return Address._(ptr); + } + static Pointer lower(Address value) { + return value.uniffiClonePointer(); + } + + Pointer uniffiClonePointer() { + return rustCall((status) => uniffi_bdkffi_fn_clone_address(_ptr, status)); + } + + static int allocationSize(Address value) { + return 8; + } + + static LiftRetVal
read(Uint8List buf) { + final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); + final pointer = Pointer.fromAddress(handle); + return LiftRetVal(Address.lift(pointer), 8); + } + + static int write(Address value, Uint8List buf) { + final handle = lower(value); + buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); + return 8; + } + + void dispose() { + _AddressFinalizer.detach(this); + rustCall((status) => uniffi_bdkffi_fn_free_address(_ptr, status)); + } + + @override + String toString() { + return rustCallWithLifter( + (status) => uniffi_bdkffi_fn_method_address_uniffi_trait_display( + uniffiClonePointer(), + status, + ), + FfiConverterString.lift, + null, + ); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (other is! Address) { + return false; + } + return rustCallWithLifter( + (status) => uniffi_bdkffi_fn_method_address_uniffi_trait_eq_eq( + uniffiClonePointer(), + Address.lower(other), + status, + ), + FfiConverterBool.lift, + null, + ); + } + + bool isValidForNetwork({required Network network}) { + return rustCallWithLifter( + (status) => uniffi_bdkffi_fn_method_address_is_valid_for_network( + uniffiClonePointer(), + FfiConverterNetwork.lower(network), + status, + ), + FfiConverterBool.lift, + null, + ); + } + + Script scriptPubkey() { + return rustCallWithLifter( + (status) => uniffi_bdkffi_fn_method_address_script_pubkey( + uniffiClonePointer(), + status, + ), + Script.lift, + null, + ); + } + + AddressData toAddressData() { + return rustCallWithLifter( + (status) => uniffi_bdkffi_fn_method_address_to_address_data( + uniffiClonePointer(), + status, + ), + FfiConverterAddressData.lift, + null, + ); + } + + String toQrUri() { + return rustCallWithLifter( + (status) => uniffi_bdkffi_fn_method_address_to_qr_uri( + uniffiClonePointer(), + status, + ), + FfiConverterString.lift, + null, + ); + } +} + +abstract class AmountInterface { + double toBtc(); + int toSat(); +} + +final _AmountFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_bdkffi_fn_free_amount(ptr, status)); +}); + +class Amount implements AmountInterface { + late final Pointer _ptr; + Amount._(this._ptr) { + _AmountFinalizer.attach(this, _ptr, detach: this); + } + Amount.fromBtc({required double btc}) + : _ptr = rustCall( + (status) => uniffi_bdkffi_fn_constructor_amount_from_btc(btc, status), + parseAmountExceptionErrorHandler, + ) { + _AmountFinalizer.attach(this, _ptr, detach: this); + } + Amount.fromSat({required int satoshi}) + : _ptr = rustCall( + (status) => uniffi_bdkffi_fn_constructor_amount_from_sat( + FfiConverterUInt64.lower(satoshi), + status, + ), + null, + ) { + _AmountFinalizer.attach(this, _ptr, detach: this); + } + factory Amount.lift(Pointer ptr) { + return Amount._(ptr); + } + static Pointer lower(Amount value) { + return value.uniffiClonePointer(); + } + + Pointer uniffiClonePointer() { + return rustCall((status) => uniffi_bdkffi_fn_clone_amount(_ptr, status)); + } + + static int allocationSize(Amount value) { + return 8; + } + + static LiftRetVal read(Uint8List buf) { + final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); + final pointer = Pointer.fromAddress(handle); + return LiftRetVal(Amount.lift(pointer), 8); + } + + static int write(Amount value, Uint8List buf) { + final handle = lower(value); + buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); + return 8; + } + + void dispose() { + _AmountFinalizer.detach(this); + rustCall((status) => uniffi_bdkffi_fn_free_amount(_ptr, status)); + } + + double toBtc() { + return rustCallWithLifter( + (status) => + uniffi_bdkffi_fn_method_amount_to_btc(uniffiClonePointer(), status), + FfiConverterDouble64.lift, + null, + ); + } + + int toSat() { + return rustCallWithLifter( + (status) => + uniffi_bdkffi_fn_method_amount_to_sat(uniffiClonePointer(), status), + FfiConverterUInt64.lift, + null, + ); + } +} + +abstract class BlockHashInterface { + Uint8List serialize(); +} + +final _BlockHashFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_bdkffi_fn_free_blockhash(ptr, status)); +}); + +class BlockHash implements BlockHashInterface { + late final Pointer _ptr; + BlockHash._(this._ptr) { + _BlockHashFinalizer.attach(this, _ptr, detach: this); + } + BlockHash.fromBytes({required Uint8List bytes}) + : _ptr = rustCall( + (status) => uniffi_bdkffi_fn_constructor_blockhash_from_bytes( + FfiConverterUint8List.lower(bytes), + status, + ), + hashParseExceptionErrorHandler, + ) { + _BlockHashFinalizer.attach(this, _ptr, detach: this); + } + BlockHash.fromString({required String hex}) + : _ptr = rustCall( + (status) => uniffi_bdkffi_fn_constructor_blockhash_from_string( + FfiConverterString.lower(hex), + status, + ), + hashParseExceptionErrorHandler, + ) { + _BlockHashFinalizer.attach(this, _ptr, detach: this); + } + factory BlockHash.lift(Pointer ptr) { + return BlockHash._(ptr); + } + static Pointer lower(BlockHash value) { + return value.uniffiClonePointer(); + } + + Pointer uniffiClonePointer() { + return rustCall((status) => uniffi_bdkffi_fn_clone_blockhash(_ptr, status)); + } + + static int allocationSize(BlockHash value) { + return 8; + } + + static LiftRetVal read(Uint8List buf) { + final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); + final pointer = Pointer.fromAddress(handle); + return LiftRetVal(BlockHash.lift(pointer), 8); + } + + static int write(BlockHash value, Uint8List buf) { + final handle = lower(value); + buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); + return 8; + } + + void dispose() { + _BlockHashFinalizer.detach(this); + rustCall((status) => uniffi_bdkffi_fn_free_blockhash(_ptr, status)); + } + + @override + String toString() { + return rustCallWithLifter( + (status) => uniffi_bdkffi_fn_method_blockhash_uniffi_trait_display( + uniffiClonePointer(), + status, + ), + FfiConverterString.lift, + null, + ); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (other is! BlockHash) { + return false; + } + return rustCallWithLifter( + (status) => uniffi_bdkffi_fn_method_blockhash_uniffi_trait_eq_eq( + uniffiClonePointer(), + BlockHash.lower(other), + status, + ), + FfiConverterBool.lift, + null, + ); + } + + @override + int get hashCode { + return rustCallWithLifter( + (status) => uniffi_bdkffi_fn_method_blockhash_uniffi_trait_hash( + uniffiClonePointer(), + status, + ), + FfiConverterUInt64.lift, + null, + ); + } + + Uint8List serialize() { + return rustCallWithLifter( + (status) => uniffi_bdkffi_fn_method_blockhash_serialize( + uniffiClonePointer(), + status, + ), + FfiConverterUint8List.lift, + null, + ); + } +} + +abstract class DescriptorIdInterface { + Uint8List serialize(); +} + +final _DescriptorIdFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_bdkffi_fn_free_descriptorid(ptr, status)); +}); + +class DescriptorId implements DescriptorIdInterface { + late final Pointer _ptr; + DescriptorId._(this._ptr) { + _DescriptorIdFinalizer.attach(this, _ptr, detach: this); + } + DescriptorId.fromBytes({required Uint8List bytes}) + : _ptr = rustCall( + (status) => uniffi_bdkffi_fn_constructor_descriptorid_from_bytes( + FfiConverterUint8List.lower(bytes), + status, + ), + hashParseExceptionErrorHandler, ) { - _AddressFinalizer.attach(this, _ptr, detach: this); + _DescriptorIdFinalizer.attach(this, _ptr, detach: this); } - Address({required String address, required Network network}) + DescriptorId.fromString({required String hex}) : _ptr = rustCall( - (status) => uniffi_bdkffi_fn_constructor_address_new( - FfiConverterString.lower(address), - FfiConverterNetwork.lower(network), + (status) => uniffi_bdkffi_fn_constructor_descriptorid_from_string( + FfiConverterString.lower(hex), status, ), - addressParseExceptionErrorHandler, + hashParseExceptionErrorHandler, ) { - _AddressFinalizer.attach(this, _ptr, detach: this); + _DescriptorIdFinalizer.attach(this, _ptr, detach: this); } - factory Address.lift(Pointer ptr) { - return Address._(ptr); + factory DescriptorId.lift(Pointer ptr) { + return DescriptorId._(ptr); } - static Pointer lower(Address value) { + static Pointer lower(DescriptorId value) { return value.uniffiClonePointer(); } Pointer uniffiClonePointer() { - return rustCall((status) => uniffi_bdkffi_fn_clone_address(_ptr, status)); + return rustCall( + (status) => uniffi_bdkffi_fn_clone_descriptorid(_ptr, status), + ); } - static int allocationSize(Address value) { + static int allocationSize(DescriptorId value) { return 8; } - static LiftRetVal
read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); final pointer = Pointer.fromAddress(handle); - return LiftRetVal(Address.lift(pointer), 8); + return LiftRetVal(DescriptorId.lift(pointer), 8); } - static int write(Address value, Uint8List buf) { + static int write(DescriptorId value, Uint8List buf) { final handle = lower(value); buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); return 8; } void dispose() { - _AddressFinalizer.detach(this); - rustCall((status) => uniffi_bdkffi_fn_free_address(_ptr, status)); + _DescriptorIdFinalizer.detach(this); + rustCall((status) => uniffi_bdkffi_fn_free_descriptorid(_ptr, status)); } @override String toString() { return rustCallWithLifter( - (status) => uniffi_bdkffi_fn_method_address_uniffi_trait_display( + (status) => uniffi_bdkffi_fn_method_descriptorid_uniffi_trait_display( uniffiClonePointer(), status, ), @@ -19384,25 +19789,13 @@ class Address implements AddressInterface { if (identical(this, other)) { return true; } - if (other is! Address) { + if (other is! DescriptorId) { return false; } return rustCallWithLifter( - (status) => uniffi_bdkffi_fn_method_address_uniffi_trait_eq_eq( - uniffiClonePointer(), - Address.lower(other), - status, - ), - FfiConverterBool.lift, - null, - ); - } - - bool isValidForNetwork({required Network network}) { - return rustCallWithLifter( - (status) => uniffi_bdkffi_fn_method_address_is_valid_for_network( + (status) => uniffi_bdkffi_fn_method_descriptorid_uniffi_trait_eq_eq( uniffiClonePointer(), - FfiConverterNetwork.lower(network), + DescriptorId.lower(other), status, ), FfiConverterBool.lift, @@ -19410,191 +19803,229 @@ class Address implements AddressInterface { ); } - Script scriptPubkey() { - return rustCallWithLifter( - (status) => uniffi_bdkffi_fn_method_address_script_pubkey( - uniffiClonePointer(), - status, - ), - Script.lift, - null, - ); - } - - AddressData toAddressData() { + @override + int get hashCode { return rustCallWithLifter( - (status) => uniffi_bdkffi_fn_method_address_to_address_data( + (status) => uniffi_bdkffi_fn_method_descriptorid_uniffi_trait_hash( uniffiClonePointer(), status, ), - FfiConverterAddressData.lift, + FfiConverterUInt64.lift, null, ); } - String toQrUri() { + Uint8List serialize() { return rustCallWithLifter( - (status) => uniffi_bdkffi_fn_method_address_to_qr_uri( + (status) => uniffi_bdkffi_fn_method_descriptorid_serialize( uniffiClonePointer(), status, ), - FfiConverterString.lift, + FfiConverterUint8List.lift, null, ); } } -abstract class AmountInterface { - double toBtc(); - int toSat(); +abstract class FeeRateInterface { + Amount? feeVb({required int vb}); + Amount? feeWu({required int wu}); + int toSatPerKwu(); + int toSatPerVbCeil(); + int toSatPerVbFloor(); } -final _AmountFinalizer = Finalizer>((ptr) { - rustCall((status) => uniffi_bdkffi_fn_free_amount(ptr, status)); +final _FeeRateFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_bdkffi_fn_free_feerate(ptr, status)); }); -class Amount implements AmountInterface { +class FeeRate implements FeeRateInterface { late final Pointer _ptr; - Amount._(this._ptr) { - _AmountFinalizer.attach(this, _ptr, detach: this); + FeeRate._(this._ptr) { + _FeeRateFinalizer.attach(this, _ptr, detach: this); } - Amount.fromBtc({required double btc}) + FeeRate.fromSatPerKwu({required int satKwu}) : _ptr = rustCall( - (status) => uniffi_bdkffi_fn_constructor_amount_from_btc(btc, status), - parseAmountExceptionErrorHandler, + (status) => uniffi_bdkffi_fn_constructor_feerate_from_sat_per_kwu( + FfiConverterUInt64.lower(satKwu), + status, + ), + null, ) { - _AmountFinalizer.attach(this, _ptr, detach: this); + _FeeRateFinalizer.attach(this, _ptr, detach: this); } - Amount.fromSat({required int satoshi}) + FeeRate.fromSatPerVb({required int satVb}) : _ptr = rustCall( - (status) => uniffi_bdkffi_fn_constructor_amount_from_sat( - FfiConverterUInt64.lower(satoshi), + (status) => uniffi_bdkffi_fn_constructor_feerate_from_sat_per_vb( + FfiConverterUInt64.lower(satVb), status, ), - null, + feeRateExceptionErrorHandler, ) { - _AmountFinalizer.attach(this, _ptr, detach: this); + _FeeRateFinalizer.attach(this, _ptr, detach: this); } - factory Amount.lift(Pointer ptr) { - return Amount._(ptr); + factory FeeRate.lift(Pointer ptr) { + return FeeRate._(ptr); } - static Pointer lower(Amount value) { + static Pointer lower(FeeRate value) { return value.uniffiClonePointer(); } Pointer uniffiClonePointer() { - return rustCall((status) => uniffi_bdkffi_fn_clone_amount(_ptr, status)); + return rustCall((status) => uniffi_bdkffi_fn_clone_feerate(_ptr, status)); } - static int allocationSize(Amount value) { + static int allocationSize(FeeRate value) { return 8; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); final pointer = Pointer.fromAddress(handle); - return LiftRetVal(Amount.lift(pointer), 8); + return LiftRetVal(FeeRate.lift(pointer), 8); } - static int write(Amount value, Uint8List buf) { + static int write(FeeRate value, Uint8List buf) { final handle = lower(value); buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); return 8; } void dispose() { - _AmountFinalizer.detach(this); - rustCall((status) => uniffi_bdkffi_fn_free_amount(_ptr, status)); + _FeeRateFinalizer.detach(this); + rustCall((status) => uniffi_bdkffi_fn_free_feerate(_ptr, status)); } - double toBtc() { + @override + String toString() { return rustCallWithLifter( - (status) => - uniffi_bdkffi_fn_method_amount_to_btc(uniffiClonePointer(), status), - FfiConverterDouble64.lift, + (status) => uniffi_bdkffi_fn_method_feerate_uniffi_trait_display( + uniffiClonePointer(), + status, + ), + FfiConverterString.lift, null, ); } - int toSat() { + Amount? feeVb({required int vb}) { return rustCallWithLifter( - (status) => - uniffi_bdkffi_fn_method_amount_to_sat(uniffiClonePointer(), status), + (status) => uniffi_bdkffi_fn_method_feerate_fee_vb( + uniffiClonePointer(), + FfiConverterUInt64.lower(vb), + status, + ), + FfiConverterOptionalAmount.lift, + null, + ); + } + + Amount? feeWu({required int wu}) { + return rustCallWithLifter( + (status) => uniffi_bdkffi_fn_method_feerate_fee_wu( + uniffiClonePointer(), + FfiConverterUInt64.lower(wu), + status, + ), + FfiConverterOptionalAmount.lift, + null, + ); + } + + int toSatPerKwu() { + return rustCallWithLifter( + (status) => uniffi_bdkffi_fn_method_feerate_to_sat_per_kwu( + uniffiClonePointer(), + status, + ), + FfiConverterUInt64.lift, + null, + ); + } + + int toSatPerVbCeil() { + return rustCallWithLifter( + (status) => uniffi_bdkffi_fn_method_feerate_to_sat_per_vb_ceil( + uniffiClonePointer(), + status, + ), + FfiConverterUInt64.lift, + null, + ); + } + + int toSatPerVbFloor() { + return rustCallWithLifter( + (status) => uniffi_bdkffi_fn_method_feerate_to_sat_per_vb_floor( + uniffiClonePointer(), + status, + ), FfiConverterUInt64.lift, null, ); } } -abstract class BlockHashInterface { - Uint8List serialize(); +abstract class HashableOutPointInterface { + OutPoint outpoint(); } -final _BlockHashFinalizer = Finalizer>((ptr) { - rustCall((status) => uniffi_bdkffi_fn_free_blockhash(ptr, status)); +final _HashableOutPointFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_bdkffi_fn_free_hashableoutpoint(ptr, status)); }); -class BlockHash implements BlockHashInterface { +class HashableOutPoint implements HashableOutPointInterface { late final Pointer _ptr; - BlockHash._(this._ptr) { - _BlockHashFinalizer.attach(this, _ptr, detach: this); - } - BlockHash.fromBytes({required Uint8List bytes}) - : _ptr = rustCall( - (status) => uniffi_bdkffi_fn_constructor_blockhash_from_bytes( - FfiConverterUint8List.lower(bytes), - status, - ), - hashParseExceptionErrorHandler, - ) { - _BlockHashFinalizer.attach(this, _ptr, detach: this); + HashableOutPoint._(this._ptr) { + _HashableOutPointFinalizer.attach(this, _ptr, detach: this); } - BlockHash.fromString({required String hex}) + HashableOutPoint({required OutPoint outpoint}) : _ptr = rustCall( - (status) => uniffi_bdkffi_fn_constructor_blockhash_from_string( - FfiConverterString.lower(hex), + (status) => uniffi_bdkffi_fn_constructor_hashableoutpoint_new( + FfiConverterOutPoint.lower(outpoint), status, ), - hashParseExceptionErrorHandler, + null, ) { - _BlockHashFinalizer.attach(this, _ptr, detach: this); + _HashableOutPointFinalizer.attach(this, _ptr, detach: this); } - factory BlockHash.lift(Pointer ptr) { - return BlockHash._(ptr); + factory HashableOutPoint.lift(Pointer ptr) { + return HashableOutPoint._(ptr); } - static Pointer lower(BlockHash value) { + static Pointer lower(HashableOutPoint value) { return value.uniffiClonePointer(); } Pointer uniffiClonePointer() { - return rustCall((status) => uniffi_bdkffi_fn_clone_blockhash(_ptr, status)); + return rustCall( + (status) => uniffi_bdkffi_fn_clone_hashableoutpoint(_ptr, status), + ); } - static int allocationSize(BlockHash value) { + static int allocationSize(HashableOutPoint value) { return 8; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); final pointer = Pointer.fromAddress(handle); - return LiftRetVal(BlockHash.lift(pointer), 8); + return LiftRetVal(HashableOutPoint.lift(pointer), 8); } - static int write(BlockHash value, Uint8List buf) { + static int write(HashableOutPoint value, Uint8List buf) { final handle = lower(value); buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); return 8; } void dispose() { - _BlockHashFinalizer.detach(this); - rustCall((status) => uniffi_bdkffi_fn_free_blockhash(_ptr, status)); + _HashableOutPointFinalizer.detach(this); + rustCall((status) => uniffi_bdkffi_fn_free_hashableoutpoint(_ptr, status)); } - @override - String toString() { + String debugString() { return rustCallWithLifter( - (status) => uniffi_bdkffi_fn_method_blockhash_uniffi_trait_display( + (status) => uniffi_bdkffi_fn_method_hashableoutpoint_uniffi_trait_debug( uniffiClonePointer(), status, ), @@ -19608,13 +20039,13 @@ class BlockHash implements BlockHashInterface { if (identical(this, other)) { return true; } - if (other is! BlockHash) { + if (other is! HashableOutPoint) { return false; } return rustCallWithLifter( - (status) => uniffi_bdkffi_fn_method_blockhash_uniffi_trait_eq_eq( + (status) => uniffi_bdkffi_fn_method_hashableoutpoint_uniffi_trait_eq_eq( uniffiClonePointer(), - BlockHash.lower(other), + HashableOutPoint.lower(other), status, ), FfiConverterBool.lift, @@ -19625,7 +20056,7 @@ class BlockHash implements BlockHashInterface { @override int get hashCode { return rustCallWithLifter( - (status) => uniffi_bdkffi_fn_method_blockhash_uniffi_trait_hash( + (status) => uniffi_bdkffi_fn_method_hashableoutpoint_uniffi_trait_hash( uniffiClonePointer(), status, ), @@ -19634,894 +20065,881 @@ class BlockHash implements BlockHashInterface { ); } - Uint8List serialize() { + OutPoint outpoint() { return rustCallWithLifter( - (status) => uniffi_bdkffi_fn_method_blockhash_serialize( + (status) => uniffi_bdkffi_fn_method_hashableoutpoint_outpoint( uniffiClonePointer(), status, ), - FfiConverterUint8List.lift, + FfiConverterOutPoint.lift, null, ); } } -abstract class BumpFeeTxBuilderInterface { - BumpFeeTxBuilder allowDust({required bool allowDust}); - BumpFeeTxBuilder currentHeight({required int height}); - Psbt finish({required Wallet wallet}); - BumpFeeTxBuilder nlocktime({required LockTime locktime}); - BumpFeeTxBuilder ordering({required TxOrdering ordering}); - BumpFeeTxBuilder setExactSequence({required int nsequence}); - BumpFeeTxBuilder sighash({required String sighash}); - BumpFeeTxBuilder version({required int version}); +abstract class LeafNodeInterface { + int depth(); + String? leafHash(); + int? leafVersion(); + List merkleBranch(); + String nodeHash(); + Script? script(); } -final _BumpFeeTxBuilderFinalizer = Finalizer>((ptr) { - rustCall((status) => uniffi_bdkffi_fn_free_bumpfeetxbuilder(ptr, status)); +final _LeafNodeFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_bdkffi_fn_free_leafnode(ptr, status)); }); -class BumpFeeTxBuilder implements BumpFeeTxBuilderInterface { +class LeafNode implements LeafNodeInterface { late final Pointer _ptr; - BumpFeeTxBuilder._(this._ptr) { - _BumpFeeTxBuilderFinalizer.attach(this, _ptr, detach: this); - } - BumpFeeTxBuilder({required Txid txid, required FeeRate feeRate}) - : _ptr = rustCall( - (status) => uniffi_bdkffi_fn_constructor_bumpfeetxbuilder_new( - Txid.lower(txid), - FeeRate.lower(feeRate), - status, - ), - null, - ) { - _BumpFeeTxBuilderFinalizer.attach(this, _ptr, detach: this); + LeafNode._(this._ptr) { + _LeafNodeFinalizer.attach(this, _ptr, detach: this); } - factory BumpFeeTxBuilder.lift(Pointer ptr) { - return BumpFeeTxBuilder._(ptr); + factory LeafNode.lift(Pointer ptr) { + return LeafNode._(ptr); } - static Pointer lower(BumpFeeTxBuilder value) { + static Pointer lower(LeafNode value) { return value.uniffiClonePointer(); } Pointer uniffiClonePointer() { - return rustCall( - (status) => uniffi_bdkffi_fn_clone_bumpfeetxbuilder(_ptr, status), - ); + return rustCall((status) => uniffi_bdkffi_fn_clone_leafnode(_ptr, status)); } - static int allocationSize(BumpFeeTxBuilder value) { + static int allocationSize(LeafNode value) { return 8; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); final pointer = Pointer.fromAddress(handle); - return LiftRetVal(BumpFeeTxBuilder.lift(pointer), 8); + return LiftRetVal(LeafNode.lift(pointer), 8); } - static int write(BumpFeeTxBuilder value, Uint8List buf) { + static int write(LeafNode value, Uint8List buf) { final handle = lower(value); buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); return 8; } void dispose() { - _BumpFeeTxBuilderFinalizer.detach(this); - rustCall((status) => uniffi_bdkffi_fn_free_bumpfeetxbuilder(_ptr, status)); + _LeafNodeFinalizer.detach(this); + rustCall((status) => uniffi_bdkffi_fn_free_leafnode(_ptr, status)); } - BumpFeeTxBuilder allowDust({required bool allowDust}) { + @override + String toString() { return rustCallWithLifter( - (status) => uniffi_bdkffi_fn_method_bumpfeetxbuilder_allow_dust( + (status) => uniffi_bdkffi_fn_method_leafnode_uniffi_trait_display( uniffiClonePointer(), - FfiConverterBool.lower(allowDust), status, ), - BumpFeeTxBuilder.lift, + FfiConverterString.lift, null, ); } - BumpFeeTxBuilder currentHeight({required int height}) { + int depth() { return rustCallWithLifter( - (status) => uniffi_bdkffi_fn_method_bumpfeetxbuilder_current_height( + (status) => + uniffi_bdkffi_fn_method_leafnode_depth(uniffiClonePointer(), status), + FfiConverterUInt8.lift, + null, + ); + } + + String? leafHash() { + return rustCallWithLifter( + (status) => uniffi_bdkffi_fn_method_leafnode_leaf_hash( uniffiClonePointer(), - FfiConverterUInt32.lower(height), status, ), - BumpFeeTxBuilder.lift, + FfiConverterOptionalString.lift, null, ); } - Psbt finish({required Wallet wallet}) { + int? leafVersion() { return rustCallWithLifter( - (status) => uniffi_bdkffi_fn_method_bumpfeetxbuilder_finish( + (status) => uniffi_bdkffi_fn_method_leafnode_leaf_version( uniffiClonePointer(), - Wallet.lower(wallet), status, ), - Psbt.lift, - createTxExceptionErrorHandler, + FfiConverterOptionalUInt8.lift, + null, ); } - BumpFeeTxBuilder nlocktime({required LockTime locktime}) { + List merkleBranch() { return rustCallWithLifter( - (status) => uniffi_bdkffi_fn_method_bumpfeetxbuilder_nlocktime( + (status) => uniffi_bdkffi_fn_method_leafnode_merkle_branch( uniffiClonePointer(), - FfiConverterLockTime.lower(locktime), status, ), - BumpFeeTxBuilder.lift, + FfiConverterSequenceString.lift, null, ); } - BumpFeeTxBuilder ordering({required TxOrdering ordering}) { + String nodeHash() { return rustCallWithLifter( - (status) => uniffi_bdkffi_fn_method_bumpfeetxbuilder_ordering( + (status) => uniffi_bdkffi_fn_method_leafnode_node_hash( uniffiClonePointer(), - FfiConverterTxOrdering.lower(ordering), status, ), - BumpFeeTxBuilder.lift, + FfiConverterString.lift, null, ); } - BumpFeeTxBuilder setExactSequence({required int nsequence}) { + Script? script() { return rustCallWithLifter( - (status) => uniffi_bdkffi_fn_method_bumpfeetxbuilder_set_exact_sequence( + (status) => + uniffi_bdkffi_fn_method_leafnode_script(uniffiClonePointer(), status), + FfiConverterOptionalScript.lift, + null, + ); + } +} + +abstract class NodeInfoInterface { + List leafNodes(); + String nodeHash(); +} + +final _NodeInfoFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_bdkffi_fn_free_nodeinfo(ptr, status)); +}); + +class NodeInfo implements NodeInfoInterface { + late final Pointer _ptr; + NodeInfo._(this._ptr) { + _NodeInfoFinalizer.attach(this, _ptr, detach: this); + } + factory NodeInfo.lift(Pointer ptr) { + return NodeInfo._(ptr); + } + static Pointer lower(NodeInfo value) { + return value.uniffiClonePointer(); + } + + Pointer uniffiClonePointer() { + return rustCall((status) => uniffi_bdkffi_fn_clone_nodeinfo(_ptr, status)); + } + + static int allocationSize(NodeInfo value) { + return 8; + } + + static LiftRetVal read(Uint8List buf) { + final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); + final pointer = Pointer.fromAddress(handle); + return LiftRetVal(NodeInfo.lift(pointer), 8); + } + + static int write(NodeInfo value, Uint8List buf) { + final handle = lower(value); + buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); + return 8; + } + + void dispose() { + _NodeInfoFinalizer.detach(this); + rustCall((status) => uniffi_bdkffi_fn_free_nodeinfo(_ptr, status)); + } + + @override + String toString() { + return rustCallWithLifter( + (status) => uniffi_bdkffi_fn_method_nodeinfo_uniffi_trait_display( uniffiClonePointer(), - FfiConverterUInt32.lower(nsequence), status, ), - BumpFeeTxBuilder.lift, + FfiConverterString.lift, null, ); } - BumpFeeTxBuilder sighash({required String sighash}) { + List leafNodes() { return rustCallWithLifter( - (status) => uniffi_bdkffi_fn_method_bumpfeetxbuilder_sighash( + (status) => uniffi_bdkffi_fn_method_nodeinfo_leaf_nodes( uniffiClonePointer(), - FfiConverterString.lower(sighash), status, ), - BumpFeeTxBuilder.lift, - sighashParseExceptionErrorHandler, + FfiConverterSequenceLeafNode.lift, + null, ); } - BumpFeeTxBuilder version({required int version}) { + String nodeHash() { return rustCallWithLifter( - (status) => uniffi_bdkffi_fn_method_bumpfeetxbuilder_version( + (status) => uniffi_bdkffi_fn_method_nodeinfo_node_hash( uniffiClonePointer(), - FfiConverterInt32.lower(version), status, ), - BumpFeeTxBuilder.lift, + FfiConverterString.lift, null, ); } } -abstract class CbfBuilderInterface { - CbfComponents build({required Wallet wallet}); - CbfBuilder configureTimeoutMillis({ - required int handshake, - required int response, - }); - CbfBuilder connections({required int connections}); - CbfBuilder dataDir({required String dataDir}); - CbfBuilder peers({required List peers}); - CbfBuilder scanType({required ScanType scanType}); - CbfBuilder socks5Proxy({required Socks5Proxy proxy}); +abstract class PsbtInterface { + Psbt combine({required Psbt other}); + Transaction extractTx(); + int fee(); + FinalizedPsbtResult finalize(); + List input(); + String jsonSerialize(); + List output(); + String serialize(); + String spendUtxo({required int inputIndex}); + void writeToFile({required String path}); } -final _CbfBuilderFinalizer = Finalizer>((ptr) { - rustCall((status) => uniffi_bdkffi_fn_free_cbfbuilder(ptr, status)); +final _PsbtFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_bdkffi_fn_free_psbt(ptr, status)); }); -class CbfBuilder implements CbfBuilderInterface { +class Psbt implements PsbtInterface { late final Pointer _ptr; - CbfBuilder._(this._ptr) { - _CbfBuilderFinalizer.attach(this, _ptr, detach: this); + Psbt._(this._ptr) { + _PsbtFinalizer.attach(this, _ptr, detach: this); + } + Psbt.fromFile({required String path}) + : _ptr = rustCall( + (status) => uniffi_bdkffi_fn_constructor_psbt_from_file( + FfiConverterString.lower(path), + status, + ), + psbtExceptionErrorHandler, + ) { + _PsbtFinalizer.attach(this, _ptr, detach: this); + } + Psbt.fromUnsignedTx({required Transaction tx}) + : _ptr = rustCall( + (status) => uniffi_bdkffi_fn_constructor_psbt_from_unsigned_tx( + Transaction.lower(tx), + status, + ), + psbtExceptionErrorHandler, + ) { + _PsbtFinalizer.attach(this, _ptr, detach: this); } - CbfBuilder() + Psbt({required String psbtBase64}) : _ptr = rustCall( - (status) => uniffi_bdkffi_fn_constructor_cbfbuilder_new(status), - null, + (status) => uniffi_bdkffi_fn_constructor_psbt_new( + FfiConverterString.lower(psbtBase64), + status, + ), + psbtParseExceptionErrorHandler, ) { - _CbfBuilderFinalizer.attach(this, _ptr, detach: this); + _PsbtFinalizer.attach(this, _ptr, detach: this); } - factory CbfBuilder.lift(Pointer ptr) { - return CbfBuilder._(ptr); + factory Psbt.lift(Pointer ptr) { + return Psbt._(ptr); } - static Pointer lower(CbfBuilder value) { + static Pointer lower(Psbt value) { return value.uniffiClonePointer(); } Pointer uniffiClonePointer() { - return rustCall( - (status) => uniffi_bdkffi_fn_clone_cbfbuilder(_ptr, status), - ); + return rustCall((status) => uniffi_bdkffi_fn_clone_psbt(_ptr, status)); } - static int allocationSize(CbfBuilder value) { + static int allocationSize(Psbt value) { return 8; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); final pointer = Pointer.fromAddress(handle); - return LiftRetVal(CbfBuilder.lift(pointer), 8); + return LiftRetVal(Psbt.lift(pointer), 8); } - static int write(CbfBuilder value, Uint8List buf) { + static int write(Psbt value, Uint8List buf) { final handle = lower(value); buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); return 8; } void dispose() { - _CbfBuilderFinalizer.detach(this); - rustCall((status) => uniffi_bdkffi_fn_free_cbfbuilder(_ptr, status)); + _PsbtFinalizer.detach(this); + rustCall((status) => uniffi_bdkffi_fn_free_psbt(_ptr, status)); } - CbfComponents build({required Wallet wallet}) { + Psbt combine({required Psbt other}) { return rustCallWithLifter( - (status) => uniffi_bdkffi_fn_method_cbfbuilder_build( + (status) => uniffi_bdkffi_fn_method_psbt_combine( uniffiClonePointer(), - Wallet.lower(wallet), + Psbt.lower(other), status, ), - FfiConverterCbfComponents.lift, - null, + Psbt.lift, + psbtExceptionErrorHandler, ); } - CbfBuilder configureTimeoutMillis({ - required int handshake, - required int response, - }) { + Transaction extractTx() { return rustCallWithLifter( - (status) => uniffi_bdkffi_fn_method_cbfbuilder_configure_timeout_millis( - uniffiClonePointer(), - FfiConverterUInt64.lower(handshake), - FfiConverterUInt64.lower(response), - status, - ), - CbfBuilder.lift, + (status) => + uniffi_bdkffi_fn_method_psbt_extract_tx(uniffiClonePointer(), status), + Transaction.lift, + extractTxExceptionErrorHandler, + ); + } + + int fee() { + return rustCallWithLifter( + (status) => + uniffi_bdkffi_fn_method_psbt_fee(uniffiClonePointer(), status), + FfiConverterUInt64.lift, + psbtExceptionErrorHandler, + ); + } + + FinalizedPsbtResult finalize() { + return rustCallWithLifter( + (status) => + uniffi_bdkffi_fn_method_psbt_finalize(uniffiClonePointer(), status), + FfiConverterFinalizedPsbtResult.lift, null, ); } - CbfBuilder connections({required int connections}) { + List input() { return rustCallWithLifter( - (status) => uniffi_bdkffi_fn_method_cbfbuilder_connections( - uniffiClonePointer(), - FfiConverterUInt8.lower(connections), - status, - ), - CbfBuilder.lift, + (status) => + uniffi_bdkffi_fn_method_psbt_input(uniffiClonePointer(), status), + FfiConverterSequenceInput.lift, null, ); } - CbfBuilder dataDir({required String dataDir}) { + String jsonSerialize() { return rustCallWithLifter( - (status) => uniffi_bdkffi_fn_method_cbfbuilder_data_dir( + (status) => uniffi_bdkffi_fn_method_psbt_json_serialize( uniffiClonePointer(), - FfiConverterString.lower(dataDir), status, ), - CbfBuilder.lift, + FfiConverterString.lift, null, ); } - CbfBuilder peers({required List peers}) { + List output() { return rustCallWithLifter( - (status) => uniffi_bdkffi_fn_method_cbfbuilder_peers( - uniffiClonePointer(), - FfiConverterSequencePeer.lower(peers), - status, - ), - CbfBuilder.lift, + (status) => + uniffi_bdkffi_fn_method_psbt_output(uniffiClonePointer(), status), + FfiConverterSequenceOutput.lift, null, ); } - CbfBuilder scanType({required ScanType scanType}) { + String serialize() { return rustCallWithLifter( - (status) => uniffi_bdkffi_fn_method_cbfbuilder_scan_type( - uniffiClonePointer(), - FfiConverterScanType.lower(scanType), - status, - ), - CbfBuilder.lift, + (status) => + uniffi_bdkffi_fn_method_psbt_serialize(uniffiClonePointer(), status), + FfiConverterString.lift, null, ); } - CbfBuilder socks5Proxy({required Socks5Proxy proxy}) { + String spendUtxo({required int inputIndex}) { return rustCallWithLifter( - (status) => uniffi_bdkffi_fn_method_cbfbuilder_socks5_proxy( + (status) => uniffi_bdkffi_fn_method_psbt_spend_utxo( uniffiClonePointer(), - FfiConverterSocks5Proxy.lower(proxy), + FfiConverterUInt64.lower(inputIndex), status, ), - CbfBuilder.lift, + FfiConverterString.lift, null, ); } + + void writeToFile({required String path}) { + return rustCall((status) { + uniffi_bdkffi_fn_method_psbt_write_to_file( + uniffiClonePointer(), + FfiConverterString.lower(path), + status, + ); + }, psbtExceptionErrorHandler); + } } -abstract class CbfClientInterface { - Future averageFeeRate({required BlockHash blockhash}); - Future broadcast({required Transaction transaction}); - void connect({required Peer peer}); - bool isRunning(); - List lookupHost({required String hostname}); - Future minBroadcastFeerate(); - Future nextInfo(); - Future nextWarning(); - Future> peerInfo(); - void shutdown(); - Future update(); +abstract class ScriptInterface { + Uint8List toBytes(); } -final _CbfClientFinalizer = Finalizer>((ptr) { - rustCall((status) => uniffi_bdkffi_fn_free_cbfclient(ptr, status)); +final _ScriptFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_bdkffi_fn_free_script(ptr, status)); }); -class CbfClient implements CbfClientInterface { +class Script implements ScriptInterface { late final Pointer _ptr; - CbfClient._(this._ptr) { - _CbfClientFinalizer.attach(this, _ptr, detach: this); + Script._(this._ptr) { + _ScriptFinalizer.attach(this, _ptr, detach: this); } - factory CbfClient.lift(Pointer ptr) { - return CbfClient._(ptr); + Script({required Uint8List rawOutputScript}) + : _ptr = rustCall( + (status) => uniffi_bdkffi_fn_constructor_script_new( + FfiConverterUint8List.lower(rawOutputScript), + status, + ), + null, + ) { + _ScriptFinalizer.attach(this, _ptr, detach: this); } - static Pointer lower(CbfClient value) { + factory Script.lift(Pointer ptr) { + return Script._(ptr); + } + static Pointer lower(Script value) { return value.uniffiClonePointer(); } Pointer uniffiClonePointer() { - return rustCall((status) => uniffi_bdkffi_fn_clone_cbfclient(_ptr, status)); + return rustCall((status) => uniffi_bdkffi_fn_clone_script(_ptr, status)); } - static int allocationSize(CbfClient value) { + static int allocationSize(Script value) { return 8; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal