diff --git a/Package.swift b/Package.swift index 9757973..1354392 100644 --- a/Package.swift +++ b/Package.swift @@ -24,8 +24,8 @@ let package = Package( // Targets can depend on other targets in this package, and on products in packages this package depends on. .binaryTarget( name: "bdkFFI", - url: "https://github.com/bitcoindevkit/bdk-swift/releases/download/0.30.0/bdkFFI.xcframework.zip", - checksum: "b384b2968315f9d6cc68af830b6e56f3cf83dfd342c18765264d820b02b7c00d"), + url: "https://github.com/bitcoindevkit/bdk-swift/releases/download/0.31.0/bdkFFI.xcframework.zip", + checksum: "aaa290375c2c4631dbfc3e5aa2292cff637dae78f16597791c0aa1c294940df2"), .target( name: "BitcoinDevKit", dependencies: ["bdkFFI"]), diff --git a/Sources/BitcoinDevKit/BitcoinDevKit.swift b/Sources/BitcoinDevKit/BitcoinDevKit.swift index e65255e..c6ae427 100644 --- a/Sources/BitcoinDevKit/BitcoinDevKit.swift +++ b/Sources/BitcoinDevKit/BitcoinDevKit.swift @@ -19,13 +19,13 @@ fileprivate extension RustBuffer { } static func from(_ ptr: UnsafeBufferPointer) -> RustBuffer { - try! rustCall { ffi_bdk_bc5f_rustbuffer_from_bytes(ForeignBytes(bufferPointer: ptr), $0) } + try! rustCall { ffi_bdk_84_rustbuffer_from_bytes(ForeignBytes(bufferPointer: ptr), $0) } } // Frees the buffer in place. // The buffer must not be used after this is called. func deallocate() { - try! rustCall { ffi_bdk_bc5f_rustbuffer_free(self, $0) } + try! rustCall { ffi_bdk_84_rustbuffer_free(self, $0) } } } @@ -410,6 +410,7 @@ public protocol AddressProtocol { func `network`() -> Network func `scriptPubkey`() -> Script func `toQrUri`() -> String + func `isValidForNetwork`(`network`: Network) -> Bool func `asString`() -> String } @@ -423,18 +424,19 @@ public class Address: AddressProtocol { required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { self.pointer = pointer } - public convenience init(`address`: String) throws { + public convenience init(`address`: String, `network`: Network) throws { self.init(unsafeFromRawPointer: try rustCallWithError(FfiConverterTypeBdkError.self) { - bdk_bc5f_Address_new( - FfiConverterString.lower(`address`), $0) + bdk_84_Address_new( + FfiConverterString.lower(`address`), + FfiConverterTypeNetwork.lower(`network`), $0) }) } deinit { - try! rustCall { ffi_bdk_bc5f_Address_object_free(pointer, $0) } + try! rustCall { ffi_bdk_84_Address_object_free(pointer, $0) } } @@ -443,7 +445,7 @@ public class Address: AddressProtocol { rustCallWithError(FfiConverterTypeBdkError.self) { - bdk_bc5f_Address_from_script( + bdk_84_Address_from_script( FfiConverterTypeScript.lower(`script`), FfiConverterTypeNetwork.lower(`network`), $0) }) @@ -456,7 +458,7 @@ public class Address: AddressProtocol { try! rustCall() { - bdk_bc5f_Address_payload(self.pointer, $0 + bdk_84_Address_payload(self.pointer, $0 ) } ) @@ -466,7 +468,7 @@ public class Address: AddressProtocol { try! rustCall() { - bdk_bc5f_Address_network(self.pointer, $0 + bdk_84_Address_network(self.pointer, $0 ) } ) @@ -476,7 +478,7 @@ public class Address: AddressProtocol { try! rustCall() { - bdk_bc5f_Address_script_pubkey(self.pointer, $0 + bdk_84_Address_script_pubkey(self.pointer, $0 ) } ) @@ -486,7 +488,18 @@ public class Address: AddressProtocol { try! rustCall() { - bdk_bc5f_Address_to_qr_uri(self.pointer, $0 + bdk_84_Address_to_qr_uri(self.pointer, $0 + ) +} + ) + } + public func `isValidForNetwork`(`network`: Network) -> Bool { + return try! FfiConverterBool.lift( + try! + rustCall() { + + bdk_84_Address_is_valid_for_network(self.pointer, + FfiConverterTypeNetwork.lower(`network`), $0 ) } ) @@ -496,7 +509,7 @@ public class Address: AddressProtocol { try! rustCall() { - bdk_bc5f_Address_as_string(self.pointer, $0 + bdk_84_Address_as_string(self.pointer, $0 ) } ) @@ -558,13 +571,13 @@ public class Blockchain: BlockchainProtocol { rustCallWithError(FfiConverterTypeBdkError.self) { - bdk_bc5f_Blockchain_new( + bdk_84_Blockchain_new( FfiConverterTypeBlockchainConfig.lower(`config`), $0) }) } deinit { - try! rustCall { ffi_bdk_bc5f_Blockchain_object_free(pointer, $0) } + try! rustCall { ffi_bdk_84_Blockchain_object_free(pointer, $0) } } @@ -573,7 +586,7 @@ public class Blockchain: BlockchainProtocol { public func `broadcast`(`transaction`: Transaction) throws { try rustCallWithError(FfiConverterTypeBdkError.self) { - bdk_bc5f_Blockchain_broadcast(self.pointer, + bdk_84_Blockchain_broadcast(self.pointer, FfiConverterTypeTransaction.lower(`transaction`), $0 ) } @@ -582,7 +595,7 @@ public class Blockchain: BlockchainProtocol { return try FfiConverterTypeFeeRate.lift( try rustCallWithError(FfiConverterTypeBdkError.self) { - bdk_bc5f_Blockchain_estimate_fee(self.pointer, + bdk_84_Blockchain_estimate_fee(self.pointer, FfiConverterUInt64.lower(`target`), $0 ) } @@ -592,7 +605,7 @@ public class Blockchain: BlockchainProtocol { return try FfiConverterUInt32.lift( try rustCallWithError(FfiConverterTypeBdkError.self) { - bdk_bc5f_Blockchain_get_height(self.pointer, $0 + bdk_84_Blockchain_get_height(self.pointer, $0 ) } ) @@ -601,7 +614,7 @@ public class Blockchain: BlockchainProtocol { return try FfiConverterString.lift( try rustCallWithError(FfiConverterTypeBdkError.self) { - bdk_bc5f_Blockchain_get_block_hash(self.pointer, + bdk_84_Blockchain_get_block_hash(self.pointer, FfiConverterUInt32.lower(`height`), $0 ) } @@ -643,7 +656,7 @@ public struct FfiConverterTypeBlockchain: FfiConverter { public protocol BumpFeeTxBuilderProtocol { - func `allowShrinking`(`address`: String) -> BumpFeeTxBuilder + func `allowShrinking`(`scriptPubkey`: Script) -> BumpFeeTxBuilder func `enableRbf`() -> BumpFeeTxBuilder func `enableRbfWithSequence`(`nsequence`: UInt32) -> BumpFeeTxBuilder func `finish`(`wallet`: Wallet) throws -> PartiallySignedTransaction @@ -664,26 +677,26 @@ public class BumpFeeTxBuilder: BumpFeeTxBuilderProtocol { rustCall() { - bdk_bc5f_BumpFeeTxBuilder_new( + bdk_84_BumpFeeTxBuilder_new( FfiConverterString.lower(`txid`), FfiConverterFloat.lower(`newFeeRate`), $0) }) } deinit { - try! rustCall { ffi_bdk_bc5f_BumpFeeTxBuilder_object_free(pointer, $0) } + try! rustCall { ffi_bdk_84_BumpFeeTxBuilder_object_free(pointer, $0) } } - public func `allowShrinking`(`address`: String) -> BumpFeeTxBuilder { + public func `allowShrinking`(`scriptPubkey`: Script) -> BumpFeeTxBuilder { return try! FfiConverterTypeBumpFeeTxBuilder.lift( try! rustCall() { - bdk_bc5f_BumpFeeTxBuilder_allow_shrinking(self.pointer, - FfiConverterString.lower(`address`), $0 + bdk_84_BumpFeeTxBuilder_allow_shrinking(self.pointer, + FfiConverterTypeScript.lower(`scriptPubkey`), $0 ) } ) @@ -693,7 +706,7 @@ public class BumpFeeTxBuilder: BumpFeeTxBuilderProtocol { try! rustCall() { - bdk_bc5f_BumpFeeTxBuilder_enable_rbf(self.pointer, $0 + bdk_84_BumpFeeTxBuilder_enable_rbf(self.pointer, $0 ) } ) @@ -703,7 +716,7 @@ public class BumpFeeTxBuilder: BumpFeeTxBuilderProtocol { try! rustCall() { - bdk_bc5f_BumpFeeTxBuilder_enable_rbf_with_sequence(self.pointer, + bdk_84_BumpFeeTxBuilder_enable_rbf_with_sequence(self.pointer, FfiConverterUInt32.lower(`nsequence`), $0 ) } @@ -713,7 +726,7 @@ public class BumpFeeTxBuilder: BumpFeeTxBuilderProtocol { return try FfiConverterTypePartiallySignedTransaction.lift( try rustCallWithError(FfiConverterTypeBdkError.self) { - bdk_bc5f_BumpFeeTxBuilder_finish(self.pointer, + bdk_84_BumpFeeTxBuilder_finish(self.pointer, FfiConverterTypeWallet.lower(`wallet`), $0 ) } @@ -772,13 +785,13 @@ public class DerivationPath: DerivationPathProtocol { rustCallWithError(FfiConverterTypeBdkError.self) { - bdk_bc5f_DerivationPath_new( + bdk_84_DerivationPath_new( FfiConverterString.lower(`path`), $0) }) } deinit { - try! rustCall { ffi_bdk_bc5f_DerivationPath_object_free(pointer, $0) } + try! rustCall { ffi_bdk_84_DerivationPath_object_free(pointer, $0) } } @@ -839,14 +852,14 @@ public class Descriptor: DescriptorProtocol { rustCallWithError(FfiConverterTypeBdkError.self) { - bdk_bc5f_Descriptor_new( + bdk_84_Descriptor_new( FfiConverterString.lower(`descriptor`), FfiConverterTypeNetwork.lower(`network`), $0) }) } deinit { - try! rustCall { ffi_bdk_bc5f_Descriptor_object_free(pointer, $0) } + try! rustCall { ffi_bdk_84_Descriptor_object_free(pointer, $0) } } @@ -855,7 +868,7 @@ public class Descriptor: DescriptorProtocol { rustCall() { - bdk_bc5f_Descriptor_new_bip44( + bdk_84_Descriptor_new_bip44( FfiConverterTypeDescriptorSecretKey.lower(`secretKey`), FfiConverterTypeKeychainKind.lower(`keychain`), FfiConverterTypeNetwork.lower(`network`), $0) @@ -867,7 +880,7 @@ public class Descriptor: DescriptorProtocol { rustCall() { - bdk_bc5f_Descriptor_new_bip44_public( + bdk_84_Descriptor_new_bip44_public( FfiConverterTypeDescriptorPublicKey.lower(`publicKey`), FfiConverterString.lower(`fingerprint`), FfiConverterTypeKeychainKind.lower(`keychain`), @@ -880,7 +893,7 @@ public class Descriptor: DescriptorProtocol { rustCall() { - bdk_bc5f_Descriptor_new_bip49( + bdk_84_Descriptor_new_bip49( FfiConverterTypeDescriptorSecretKey.lower(`secretKey`), FfiConverterTypeKeychainKind.lower(`keychain`), FfiConverterTypeNetwork.lower(`network`), $0) @@ -892,7 +905,7 @@ public class Descriptor: DescriptorProtocol { rustCall() { - bdk_bc5f_Descriptor_new_bip49_public( + bdk_84_Descriptor_new_bip49_public( FfiConverterTypeDescriptorPublicKey.lower(`publicKey`), FfiConverterString.lower(`fingerprint`), FfiConverterTypeKeychainKind.lower(`keychain`), @@ -905,7 +918,7 @@ public class Descriptor: DescriptorProtocol { rustCall() { - bdk_bc5f_Descriptor_new_bip84( + bdk_84_Descriptor_new_bip84( FfiConverterTypeDescriptorSecretKey.lower(`secretKey`), FfiConverterTypeKeychainKind.lower(`keychain`), FfiConverterTypeNetwork.lower(`network`), $0) @@ -917,7 +930,7 @@ public class Descriptor: DescriptorProtocol { rustCall() { - bdk_bc5f_Descriptor_new_bip84_public( + bdk_84_Descriptor_new_bip84_public( FfiConverterTypeDescriptorPublicKey.lower(`publicKey`), FfiConverterString.lower(`fingerprint`), FfiConverterTypeKeychainKind.lower(`keychain`), @@ -930,7 +943,7 @@ public class Descriptor: DescriptorProtocol { rustCall() { - bdk_bc5f_Descriptor_new_bip86( + bdk_84_Descriptor_new_bip86( FfiConverterTypeDescriptorSecretKey.lower(`secretKey`), FfiConverterTypeKeychainKind.lower(`keychain`), FfiConverterTypeNetwork.lower(`network`), $0) @@ -942,7 +955,7 @@ public class Descriptor: DescriptorProtocol { rustCall() { - bdk_bc5f_Descriptor_new_bip86_public( + bdk_84_Descriptor_new_bip86_public( FfiConverterTypeDescriptorPublicKey.lower(`publicKey`), FfiConverterString.lower(`fingerprint`), FfiConverterTypeKeychainKind.lower(`keychain`), @@ -957,7 +970,7 @@ public class Descriptor: DescriptorProtocol { try! rustCall() { - bdk_bc5f_Descriptor_as_string(self.pointer, $0 + bdk_84_Descriptor_as_string(self.pointer, $0 ) } ) @@ -967,7 +980,7 @@ public class Descriptor: DescriptorProtocol { try! rustCall() { - bdk_bc5f_Descriptor_as_string_private(self.pointer, $0 + bdk_84_Descriptor_as_string_private(self.pointer, $0 ) } ) @@ -1025,7 +1038,7 @@ public class DescriptorPublicKey: DescriptorPublicKeyProtocol { } deinit { - try! rustCall { ffi_bdk_bc5f_DescriptorPublicKey_object_free(pointer, $0) } + try! rustCall { ffi_bdk_84_DescriptorPublicKey_object_free(pointer, $0) } } @@ -1034,7 +1047,7 @@ public class DescriptorPublicKey: DescriptorPublicKeyProtocol { rustCallWithError(FfiConverterTypeBdkError.self) { - bdk_bc5f_DescriptorPublicKey_from_string( + bdk_84_DescriptorPublicKey_from_string( FfiConverterString.lower(`publicKey`), $0) }) } @@ -1045,7 +1058,7 @@ public class DescriptorPublicKey: DescriptorPublicKeyProtocol { return try FfiConverterTypeDescriptorPublicKey.lift( try rustCallWithError(FfiConverterTypeBdkError.self) { - bdk_bc5f_DescriptorPublicKey_derive(self.pointer, + bdk_84_DescriptorPublicKey_derive(self.pointer, FfiConverterTypeDerivationPath.lower(`path`), $0 ) } @@ -1055,7 +1068,7 @@ public class DescriptorPublicKey: DescriptorPublicKeyProtocol { return try FfiConverterTypeDescriptorPublicKey.lift( try rustCallWithError(FfiConverterTypeBdkError.self) { - bdk_bc5f_DescriptorPublicKey_extend(self.pointer, + bdk_84_DescriptorPublicKey_extend(self.pointer, FfiConverterTypeDerivationPath.lower(`path`), $0 ) } @@ -1066,7 +1079,7 @@ public class DescriptorPublicKey: DescriptorPublicKeyProtocol { try! rustCall() { - bdk_bc5f_DescriptorPublicKey_as_string(self.pointer, $0 + bdk_84_DescriptorPublicKey_as_string(self.pointer, $0 ) } ) @@ -1129,7 +1142,7 @@ public class DescriptorSecretKey: DescriptorSecretKeyProtocol { rustCall() { - bdk_bc5f_DescriptorSecretKey_new( + bdk_84_DescriptorSecretKey_new( FfiConverterTypeNetwork.lower(`network`), FfiConverterTypeMnemonic.lower(`mnemonic`), FfiConverterOptionString.lower(`password`), $0) @@ -1137,7 +1150,7 @@ public class DescriptorSecretKey: DescriptorSecretKeyProtocol { } deinit { - try! rustCall { ffi_bdk_bc5f_DescriptorSecretKey_object_free(pointer, $0) } + try! rustCall { ffi_bdk_84_DescriptorSecretKey_object_free(pointer, $0) } } @@ -1146,7 +1159,7 @@ public class DescriptorSecretKey: DescriptorSecretKeyProtocol { rustCallWithError(FfiConverterTypeBdkError.self) { - bdk_bc5f_DescriptorSecretKey_from_string( + bdk_84_DescriptorSecretKey_from_string( FfiConverterString.lower(`secretKey`), $0) }) } @@ -1157,7 +1170,7 @@ public class DescriptorSecretKey: DescriptorSecretKeyProtocol { return try FfiConverterTypeDescriptorSecretKey.lift( try rustCallWithError(FfiConverterTypeBdkError.self) { - bdk_bc5f_DescriptorSecretKey_derive(self.pointer, + bdk_84_DescriptorSecretKey_derive(self.pointer, FfiConverterTypeDerivationPath.lower(`path`), $0 ) } @@ -1167,7 +1180,7 @@ public class DescriptorSecretKey: DescriptorSecretKeyProtocol { return try FfiConverterTypeDescriptorSecretKey.lift( try rustCallWithError(FfiConverterTypeBdkError.self) { - bdk_bc5f_DescriptorSecretKey_extend(self.pointer, + bdk_84_DescriptorSecretKey_extend(self.pointer, FfiConverterTypeDerivationPath.lower(`path`), $0 ) } @@ -1178,7 +1191,7 @@ public class DescriptorSecretKey: DescriptorSecretKeyProtocol { try! rustCall() { - bdk_bc5f_DescriptorSecretKey_as_public(self.pointer, $0 + bdk_84_DescriptorSecretKey_as_public(self.pointer, $0 ) } ) @@ -1188,7 +1201,7 @@ public class DescriptorSecretKey: DescriptorSecretKeyProtocol { try! rustCall() { - bdk_bc5f_DescriptorSecretKey_secret_bytes(self.pointer, $0 + bdk_84_DescriptorSecretKey_secret_bytes(self.pointer, $0 ) } ) @@ -1198,7 +1211,7 @@ public class DescriptorSecretKey: DescriptorSecretKeyProtocol { try! rustCall() { - bdk_bc5f_DescriptorSecretKey_as_string(self.pointer, $0 + bdk_84_DescriptorSecretKey_as_string(self.pointer, $0 ) } ) @@ -1254,7 +1267,7 @@ public class FeeRate: FeeRateProtocol { } deinit { - try! rustCall { ffi_bdk_bc5f_FeeRate_object_free(pointer, $0) } + try! rustCall { ffi_bdk_84_FeeRate_object_free(pointer, $0) } } @@ -1263,7 +1276,7 @@ public class FeeRate: FeeRateProtocol { rustCall() { - bdk_bc5f_FeeRate_from_sat_per_vb( + bdk_84_FeeRate_from_sat_per_vb( FfiConverterFloat.lower(`satPerVb`), $0) }) } @@ -1275,7 +1288,7 @@ public class FeeRate: FeeRateProtocol { try! rustCall() { - bdk_bc5f_FeeRate_as_sat_per_vb(self.pointer, $0 + bdk_84_FeeRate_as_sat_per_vb(self.pointer, $0 ) } ) @@ -1334,13 +1347,13 @@ public class Mnemonic: MnemonicProtocol { rustCall() { - bdk_bc5f_Mnemonic_new( + bdk_84_Mnemonic_new( FfiConverterTypeWordCount.lower(`wordCount`), $0) }) } deinit { - try! rustCall { ffi_bdk_bc5f_Mnemonic_object_free(pointer, $0) } + try! rustCall { ffi_bdk_84_Mnemonic_object_free(pointer, $0) } } @@ -1349,7 +1362,7 @@ public class Mnemonic: MnemonicProtocol { rustCallWithError(FfiConverterTypeBdkError.self) { - bdk_bc5f_Mnemonic_from_string( + bdk_84_Mnemonic_from_string( FfiConverterString.lower(`mnemonic`), $0) }) } @@ -1359,7 +1372,7 @@ public class Mnemonic: MnemonicProtocol { rustCallWithError(FfiConverterTypeBdkError.self) { - bdk_bc5f_Mnemonic_from_entropy( + bdk_84_Mnemonic_from_entropy( FfiConverterSequenceUInt8.lower(`entropy`), $0) }) } @@ -1371,7 +1384,7 @@ public class Mnemonic: MnemonicProtocol { try! rustCall() { - bdk_bc5f_Mnemonic_as_string(self.pointer, $0 + bdk_84_Mnemonic_as_string(self.pointer, $0 ) } ) @@ -1436,13 +1449,13 @@ public class PartiallySignedTransaction: PartiallySignedTransactionProtocol { rustCallWithError(FfiConverterTypeBdkError.self) { - bdk_bc5f_PartiallySignedTransaction_new( + bdk_84_PartiallySignedTransaction_new( FfiConverterString.lower(`psbtBase64`), $0) }) } deinit { - try! rustCall { ffi_bdk_bc5f_PartiallySignedTransaction_object_free(pointer, $0) } + try! rustCall { ffi_bdk_84_PartiallySignedTransaction_object_free(pointer, $0) } } @@ -1453,7 +1466,7 @@ public class PartiallySignedTransaction: PartiallySignedTransactionProtocol { try! rustCall() { - bdk_bc5f_PartiallySignedTransaction_serialize(self.pointer, $0 + bdk_84_PartiallySignedTransaction_serialize(self.pointer, $0 ) } ) @@ -1463,7 +1476,7 @@ public class PartiallySignedTransaction: PartiallySignedTransactionProtocol { try! rustCall() { - bdk_bc5f_PartiallySignedTransaction_txid(self.pointer, $0 + bdk_84_PartiallySignedTransaction_txid(self.pointer, $0 ) } ) @@ -1473,7 +1486,7 @@ public class PartiallySignedTransaction: PartiallySignedTransactionProtocol { try! rustCall() { - bdk_bc5f_PartiallySignedTransaction_extract_tx(self.pointer, $0 + bdk_84_PartiallySignedTransaction_extract_tx(self.pointer, $0 ) } ) @@ -1482,7 +1495,7 @@ public class PartiallySignedTransaction: PartiallySignedTransactionProtocol { return try FfiConverterTypePartiallySignedTransaction.lift( try rustCallWithError(FfiConverterTypeBdkError.self) { - bdk_bc5f_PartiallySignedTransaction_combine(self.pointer, + bdk_84_PartiallySignedTransaction_combine(self.pointer, FfiConverterTypePartiallySignedTransaction.lower(`other`), $0 ) } @@ -1493,7 +1506,7 @@ public class PartiallySignedTransaction: PartiallySignedTransactionProtocol { try! rustCall() { - bdk_bc5f_PartiallySignedTransaction_fee_amount(self.pointer, $0 + bdk_84_PartiallySignedTransaction_fee_amount(self.pointer, $0 ) } ) @@ -1503,7 +1516,7 @@ public class PartiallySignedTransaction: PartiallySignedTransactionProtocol { try! rustCall() { - bdk_bc5f_PartiallySignedTransaction_fee_rate(self.pointer, $0 + bdk_84_PartiallySignedTransaction_fee_rate(self.pointer, $0 ) } ) @@ -1513,7 +1526,7 @@ public class PartiallySignedTransaction: PartiallySignedTransactionProtocol { try! rustCall() { - bdk_bc5f_PartiallySignedTransaction_json_serialize(self.pointer, $0 + bdk_84_PartiallySignedTransaction_json_serialize(self.pointer, $0 ) } ) @@ -1572,13 +1585,13 @@ public class Script: ScriptProtocol { rustCall() { - bdk_bc5f_Script_new( + bdk_84_Script_new( FfiConverterSequenceUInt8.lower(`rawOutputScript`), $0) }) } deinit { - try! rustCall { ffi_bdk_bc5f_Script_object_free(pointer, $0) } + try! rustCall { ffi_bdk_84_Script_object_free(pointer, $0) } } @@ -1589,7 +1602,7 @@ public class Script: ScriptProtocol { try! rustCall() { - bdk_bc5f_Script_to_bytes(self.pointer, $0 + bdk_84_Script_to_bytes(self.pointer, $0 ) } ) @@ -1659,13 +1672,13 @@ public class Transaction: TransactionProtocol { rustCallWithError(FfiConverterTypeBdkError.self) { - bdk_bc5f_Transaction_new( + bdk_84_Transaction_new( FfiConverterSequenceUInt8.lower(`transactionBytes`), $0) }) } deinit { - try! rustCall { ffi_bdk_bc5f_Transaction_object_free(pointer, $0) } + try! rustCall { ffi_bdk_84_Transaction_object_free(pointer, $0) } } @@ -1676,7 +1689,7 @@ public class Transaction: TransactionProtocol { try! rustCall() { - bdk_bc5f_Transaction_txid(self.pointer, $0 + bdk_84_Transaction_txid(self.pointer, $0 ) } ) @@ -1686,7 +1699,7 @@ public class Transaction: TransactionProtocol { try! rustCall() { - bdk_bc5f_Transaction_weight(self.pointer, $0 + bdk_84_Transaction_weight(self.pointer, $0 ) } ) @@ -1696,7 +1709,7 @@ public class Transaction: TransactionProtocol { try! rustCall() { - bdk_bc5f_Transaction_size(self.pointer, $0 + bdk_84_Transaction_size(self.pointer, $0 ) } ) @@ -1706,7 +1719,7 @@ public class Transaction: TransactionProtocol { try! rustCall() { - bdk_bc5f_Transaction_vsize(self.pointer, $0 + bdk_84_Transaction_vsize(self.pointer, $0 ) } ) @@ -1716,7 +1729,7 @@ public class Transaction: TransactionProtocol { try! rustCall() { - bdk_bc5f_Transaction_serialize(self.pointer, $0 + bdk_84_Transaction_serialize(self.pointer, $0 ) } ) @@ -1726,7 +1739,7 @@ public class Transaction: TransactionProtocol { try! rustCall() { - bdk_bc5f_Transaction_is_coin_base(self.pointer, $0 + bdk_84_Transaction_is_coin_base(self.pointer, $0 ) } ) @@ -1736,7 +1749,7 @@ public class Transaction: TransactionProtocol { try! rustCall() { - bdk_bc5f_Transaction_is_explicitly_rbf(self.pointer, $0 + bdk_84_Transaction_is_explicitly_rbf(self.pointer, $0 ) } ) @@ -1746,7 +1759,7 @@ public class Transaction: TransactionProtocol { try! rustCall() { - bdk_bc5f_Transaction_is_lock_time_enabled(self.pointer, $0 + bdk_84_Transaction_is_lock_time_enabled(self.pointer, $0 ) } ) @@ -1756,7 +1769,7 @@ public class Transaction: TransactionProtocol { try! rustCall() { - bdk_bc5f_Transaction_version(self.pointer, $0 + bdk_84_Transaction_version(self.pointer, $0 ) } ) @@ -1766,7 +1779,7 @@ public class Transaction: TransactionProtocol { try! rustCall() { - bdk_bc5f_Transaction_lock_time(self.pointer, $0 + bdk_84_Transaction_lock_time(self.pointer, $0 ) } ) @@ -1776,7 +1789,7 @@ public class Transaction: TransactionProtocol { try! rustCall() { - bdk_bc5f_Transaction_input(self.pointer, $0 + bdk_84_Transaction_input(self.pointer, $0 ) } ) @@ -1786,7 +1799,7 @@ public class Transaction: TransactionProtocol { try! rustCall() { - bdk_bc5f_Transaction_output(self.pointer, $0 + bdk_84_Transaction_output(self.pointer, $0 ) } ) @@ -1861,12 +1874,12 @@ public class TxBuilder: TxBuilderProtocol { rustCall() { - bdk_bc5f_TxBuilder_new($0) + bdk_84_TxBuilder_new($0) }) } deinit { - try! rustCall { ffi_bdk_bc5f_TxBuilder_object_free(pointer, $0) } + try! rustCall { ffi_bdk_84_TxBuilder_object_free(pointer, $0) } } @@ -1877,7 +1890,7 @@ public class TxBuilder: TxBuilderProtocol { try! rustCall() { - bdk_bc5f_TxBuilder_add_recipient(self.pointer, + bdk_84_TxBuilder_add_recipient(self.pointer, FfiConverterTypeScript.lower(`script`), FfiConverterUInt64.lower(`amount`), $0 ) @@ -1889,7 +1902,7 @@ public class TxBuilder: TxBuilderProtocol { try! rustCall() { - bdk_bc5f_TxBuilder_add_unspendable(self.pointer, + bdk_84_TxBuilder_add_unspendable(self.pointer, FfiConverterTypeOutPoint.lower(`unspendable`), $0 ) } @@ -1900,7 +1913,7 @@ public class TxBuilder: TxBuilderProtocol { try! rustCall() { - bdk_bc5f_TxBuilder_add_utxo(self.pointer, + bdk_84_TxBuilder_add_utxo(self.pointer, FfiConverterTypeOutPoint.lower(`outpoint`), $0 ) } @@ -1911,7 +1924,7 @@ public class TxBuilder: TxBuilderProtocol { try! rustCall() { - bdk_bc5f_TxBuilder_add_utxos(self.pointer, + bdk_84_TxBuilder_add_utxos(self.pointer, FfiConverterSequenceTypeOutPoint.lower(`outpoints`), $0 ) } @@ -1922,7 +1935,7 @@ public class TxBuilder: TxBuilderProtocol { try! rustCall() { - bdk_bc5f_TxBuilder_do_not_spend_change(self.pointer, $0 + bdk_84_TxBuilder_do_not_spend_change(self.pointer, $0 ) } ) @@ -1932,7 +1945,7 @@ public class TxBuilder: TxBuilderProtocol { try! rustCall() { - bdk_bc5f_TxBuilder_manually_selected_only(self.pointer, $0 + bdk_84_TxBuilder_manually_selected_only(self.pointer, $0 ) } ) @@ -1942,7 +1955,7 @@ public class TxBuilder: TxBuilderProtocol { try! rustCall() { - bdk_bc5f_TxBuilder_only_spend_change(self.pointer, $0 + bdk_84_TxBuilder_only_spend_change(self.pointer, $0 ) } ) @@ -1952,7 +1965,7 @@ public class TxBuilder: TxBuilderProtocol { try! rustCall() { - bdk_bc5f_TxBuilder_unspendable(self.pointer, + bdk_84_TxBuilder_unspendable(self.pointer, FfiConverterSequenceTypeOutPoint.lower(`unspendable`), $0 ) } @@ -1963,7 +1976,7 @@ public class TxBuilder: TxBuilderProtocol { try! rustCall() { - bdk_bc5f_TxBuilder_fee_rate(self.pointer, + bdk_84_TxBuilder_fee_rate(self.pointer, FfiConverterFloat.lower(`satPerVbyte`), $0 ) } @@ -1974,7 +1987,7 @@ public class TxBuilder: TxBuilderProtocol { try! rustCall() { - bdk_bc5f_TxBuilder_fee_absolute(self.pointer, + bdk_84_TxBuilder_fee_absolute(self.pointer, FfiConverterUInt64.lower(`feeAmount`), $0 ) } @@ -1985,7 +1998,7 @@ public class TxBuilder: TxBuilderProtocol { try! rustCall() { - bdk_bc5f_TxBuilder_drain_wallet(self.pointer, $0 + bdk_84_TxBuilder_drain_wallet(self.pointer, $0 ) } ) @@ -1995,7 +2008,7 @@ public class TxBuilder: TxBuilderProtocol { try! rustCall() { - bdk_bc5f_TxBuilder_drain_to(self.pointer, + bdk_84_TxBuilder_drain_to(self.pointer, FfiConverterTypeScript.lower(`script`), $0 ) } @@ -2006,7 +2019,7 @@ public class TxBuilder: TxBuilderProtocol { try! rustCall() { - bdk_bc5f_TxBuilder_enable_rbf(self.pointer, $0 + bdk_84_TxBuilder_enable_rbf(self.pointer, $0 ) } ) @@ -2016,7 +2029,7 @@ public class TxBuilder: TxBuilderProtocol { try! rustCall() { - bdk_bc5f_TxBuilder_enable_rbf_with_sequence(self.pointer, + bdk_84_TxBuilder_enable_rbf_with_sequence(self.pointer, FfiConverterUInt32.lower(`nsequence`), $0 ) } @@ -2027,7 +2040,7 @@ public class TxBuilder: TxBuilderProtocol { try! rustCall() { - bdk_bc5f_TxBuilder_add_data(self.pointer, + bdk_84_TxBuilder_add_data(self.pointer, FfiConverterSequenceUInt8.lower(`data`), $0 ) } @@ -2038,7 +2051,7 @@ public class TxBuilder: TxBuilderProtocol { try! rustCall() { - bdk_bc5f_TxBuilder_set_recipients(self.pointer, + bdk_84_TxBuilder_set_recipients(self.pointer, FfiConverterSequenceTypeScriptAmount.lower(`recipients`), $0 ) } @@ -2048,7 +2061,7 @@ public class TxBuilder: TxBuilderProtocol { return try FfiConverterTypeTxBuilderResult.lift( try rustCallWithError(FfiConverterTypeBdkError.self) { - bdk_bc5f_TxBuilder_finish(self.pointer, + bdk_84_TxBuilder_finish(self.pointer, FfiConverterTypeWallet.lower(`wallet`), $0 ) } @@ -2116,7 +2129,7 @@ public class Wallet: WalletProtocol { rustCallWithError(FfiConverterTypeBdkError.self) { - bdk_bc5f_Wallet_new( + bdk_84_Wallet_new( FfiConverterTypeDescriptor.lower(`descriptor`), FfiConverterOptionTypeDescriptor.lower(`changeDescriptor`), FfiConverterTypeNetwork.lower(`network`), @@ -2125,7 +2138,7 @@ public class Wallet: WalletProtocol { } deinit { - try! rustCall { ffi_bdk_bc5f_Wallet_object_free(pointer, $0) } + try! rustCall { ffi_bdk_84_Wallet_object_free(pointer, $0) } } @@ -2136,7 +2149,7 @@ public class Wallet: WalletProtocol { try! rustCall() { - bdk_bc5f_Wallet_network(self.pointer, $0 + bdk_84_Wallet_network(self.pointer, $0 ) } ) @@ -2145,7 +2158,7 @@ public class Wallet: WalletProtocol { return try FfiConverterTypeAddressInfo.lift( try rustCallWithError(FfiConverterTypeBdkError.self) { - bdk_bc5f_Wallet_get_address(self.pointer, + bdk_84_Wallet_get_address(self.pointer, FfiConverterTypeAddressIndex.lower(`addressIndex`), $0 ) } @@ -2155,7 +2168,7 @@ public class Wallet: WalletProtocol { return try FfiConverterTypeAddressInfo.lift( try rustCallWithError(FfiConverterTypeBdkError.self) { - bdk_bc5f_Wallet_get_internal_address(self.pointer, + bdk_84_Wallet_get_internal_address(self.pointer, FfiConverterTypeAddressIndex.lower(`addressIndex`), $0 ) } @@ -2165,7 +2178,7 @@ public class Wallet: WalletProtocol { return try FfiConverterBool.lift( try rustCallWithError(FfiConverterTypeBdkError.self) { - bdk_bc5f_Wallet_is_mine(self.pointer, + bdk_84_Wallet_is_mine(self.pointer, FfiConverterTypeScript.lower(`script`), $0 ) } @@ -2175,7 +2188,7 @@ public class Wallet: WalletProtocol { return try FfiConverterSequenceTypeLocalUtxo.lift( try rustCallWithError(FfiConverterTypeBdkError.self) { - bdk_bc5f_Wallet_list_unspent(self.pointer, $0 + bdk_84_Wallet_list_unspent(self.pointer, $0 ) } ) @@ -2184,7 +2197,7 @@ public class Wallet: WalletProtocol { return try FfiConverterSequenceTypeTransactionDetails.lift( try rustCallWithError(FfiConverterTypeBdkError.self) { - bdk_bc5f_Wallet_list_transactions(self.pointer, + bdk_84_Wallet_list_transactions(self.pointer, FfiConverterBool.lower(`includeRaw`), $0 ) } @@ -2194,7 +2207,7 @@ public class Wallet: WalletProtocol { return try FfiConverterTypeBalance.lift( try rustCallWithError(FfiConverterTypeBdkError.self) { - bdk_bc5f_Wallet_get_balance(self.pointer, $0 + bdk_84_Wallet_get_balance(self.pointer, $0 ) } ) @@ -2203,7 +2216,7 @@ public class Wallet: WalletProtocol { return try FfiConverterBool.lift( try rustCallWithError(FfiConverterTypeBdkError.self) { - bdk_bc5f_Wallet_sign(self.pointer, + bdk_84_Wallet_sign(self.pointer, FfiConverterTypePartiallySignedTransaction.lower(`psbt`), FfiConverterOptionTypeSignOptions.lower(`signOptions`), $0 ) @@ -2213,7 +2226,7 @@ public class Wallet: WalletProtocol { public func `sync`(`blockchain`: Blockchain, `progress`: Progress?) throws { try rustCallWithError(FfiConverterTypeBdkError.self) { - bdk_bc5f_Wallet_sync(self.pointer, + bdk_84_Wallet_sync(self.pointer, FfiConverterTypeBlockchain.lower(`blockchain`), FfiConverterOptionCallbackInterfaceProgress.lower(`progress`), $0 ) @@ -3653,8 +3666,8 @@ extension Network: Equatable, Hashable {} // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion. public enum Payload { - case `pubkeyHash`(`pubkeyHash`: [UInt8]) - case `scriptHash`(`scriptHash`: [UInt8]) + case `pubkeyHash`(`pubkeyHash`: String) + case `scriptHash`(`scriptHash`: String) case `witnessProgram`(`version`: WitnessVersion, `program`: [UInt8]) } @@ -3666,11 +3679,11 @@ public struct FfiConverterTypePayload: FfiConverterRustBuffer { switch variant { case 1: return .`pubkeyHash`( - `pubkeyHash`: try FfiConverterSequenceUInt8.read(from: &buf) + `pubkeyHash`: try FfiConverterString.read(from: &buf) ) case 2: return .`scriptHash`( - `scriptHash`: try FfiConverterSequenceUInt8.read(from: &buf) + `scriptHash`: try FfiConverterString.read(from: &buf) ) case 3: return .`witnessProgram`( @@ -3688,12 +3701,12 @@ public struct FfiConverterTypePayload: FfiConverterRustBuffer { case let .`pubkeyHash`(`pubkeyHash`): writeInt(&buf, Int32(1)) - FfiConverterSequenceUInt8.write(`pubkeyHash`, into: &buf) + FfiConverterString.write(`pubkeyHash`, into: &buf) case let .`scriptHash`(`scriptHash`): writeInt(&buf, Int32(2)) - FfiConverterSequenceUInt8.write(`scriptHash`, into: &buf) + FfiConverterString.write(`scriptHash`, into: &buf) case let .`witnessProgram`(`version`,`program`): @@ -4077,6 +4090,9 @@ public enum BdkError { // Simple error enums only carry a message case Rpc(message: String) + // Simple error enums only carry a message + case HardenedIndex(message: String) + } public struct FfiConverterTypeBdkError: FfiConverterRustBuffer { @@ -4257,6 +4273,10 @@ public struct FfiConverterTypeBdkError: FfiConverterRustBuffer { message: try FfiConverterString.read(from: &buf) ) + case 43: return .HardenedIndex( + message: try FfiConverterString.read(from: &buf) + ) + default: throw UniffiInternalError.unexpectedEnumCase } @@ -4394,6 +4414,9 @@ public struct FfiConverterTypeBdkError: FfiConverterRustBuffer { case let .Rpc(message): writeInt(&buf, Int32(42)) FfiConverterString.write(message, into: &buf) + case let .HardenedIndex(message): + writeInt(&buf, Int32(43)) + FfiConverterString.write(message, into: &buf) } @@ -4532,7 +4555,7 @@ fileprivate struct FfiConverterCallbackInterfaceProgress { private static var callbackInitialized = false private static func initCallback() { try! rustCall { (err: UnsafeMutablePointer) in - ffi_bdk_bc5f_Progress_init_callback(foreignCallbackCallbackInterfaceProgress, err) + ffi_bdk_84_Progress_init_callback(foreignCallbackCallbackInterfaceProgress, err) } } private static func ensureCallbackinitialized() {