diff --git a/BreezLiquidSDK.podspec b/BreezLiquidSDK.podspec index 1f3487f..18bb6b7 100644 --- a/BreezLiquidSDK.podspec +++ b/BreezLiquidSDK.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |spec| spec.name = "BreezLiquidSDK" - spec.version = "0.1.0-rc1" + spec.version = "0.1.1-dev1" spec.license = { :type => "MIT" } spec.summary = "Swift bindings to the Breez Liquid SDK" spec.homepage = "https://breez.technology" diff --git a/Package.swift b/Package.swift index f944426..df1629f 100644 --- a/Package.swift +++ b/Package.swift @@ -13,7 +13,7 @@ let package = Package( .library(name: "BreezLiquidSDK", targets: ["breez_liquid_sdkFFI", "BreezLiquidSDK"]), ], targets: [ - .binaryTarget(name: "breez_liquid_sdkFFI", url: "https://github.com/breez/breez-liquid-sdk-swift/releases/download/0.1.0-rc1/breez_liquid_sdkFFI.xcframework.zip", checksum: "1ef9a621be477446c5e6780b996a393b5735414f594184838dbcdb0c3a9481ed"), + .binaryTarget(name: "breez_liquid_sdkFFI", url: "https://github.com/breez/breez-liquid-sdk-swift/releases/download/0.1.1-dev1/breez_liquid_sdkFFI.xcframework.zip", checksum: "9609b4c3218f5c9a9424c31b9a5801df59269b628271c136743d69662823cd0e"), .target(name: "BreezLiquidSDK", dependencies: ["breez_liquid_sdkFFI"]), ] ) diff --git a/Sources/BreezLiquidSDK/BreezLiquidSDK.swift b/Sources/BreezLiquidSDK/BreezLiquidSDK.swift index 76971bd..3405c7e 100644 --- a/Sources/BreezLiquidSDK/BreezLiquidSDK.swift +++ b/Sources/BreezLiquidSDK/BreezLiquidSDK.swift @@ -394,6 +394,19 @@ fileprivate struct FfiConverterUInt8: FfiConverterPrimitive { } } +fileprivate struct FfiConverterUInt16: FfiConverterPrimitive { + typealias FfiType = UInt16 + typealias SwiftType = UInt16 + + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> UInt16 { + return try lift(readInt(&buf)) + } + + public static func write(_ value: SwiftType, into buf: inout [UInt8]) { + writeInt(&buf, lower(value)) + } +} + fileprivate struct FfiConverterUInt32: FfiConverterPrimitive { typealias FfiType = UInt32 typealias SwiftType = UInt32 @@ -433,6 +446,40 @@ fileprivate struct FfiConverterFloat: FfiConverterPrimitive { } } +fileprivate struct FfiConverterDouble: FfiConverterPrimitive { + typealias FfiType = Double + typealias SwiftType = Double + + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Double { + return try lift(readDouble(&buf)) + } + + public static func write(_ value: Double, into buf: inout [UInt8]) { + writeDouble(&buf, lower(value)) + } +} + +fileprivate struct FfiConverterBool : FfiConverter { + typealias FfiType = Int8 + typealias SwiftType = Bool + + public static func lift(_ value: Int8) throws -> Bool { + return value != 0 + } + + public static func lower(_ value: Bool) -> Int8 { + return value ? 1 : 0 + } + + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Bool { + return try lift(readInt(&buf)) + } + + public static func write(_ value: Bool, into buf: inout [UInt8]) { + writeInt(&buf, lower(value)) + } +} + fileprivate struct FfiConverterString: FfiConverter { typealias SwiftType = String typealias FfiType = RustBuffer @@ -482,18 +529,44 @@ public protocol BindingLiquidSdkProtocol : AnyObject { func disconnect() throws + func fetchFiatRates() throws -> [Rate] + func getInfo() throws -> GetInfoResponse + func listFiatCurrencies() throws -> [FiatCurrency] + func listPayments() throws -> [Payment] + func listRefundables() throws -> [RefundableSwap] + + func lnurlAuth(reqData: LnUrlAuthRequestData) throws -> LnUrlCallbackStatus + + func lnurlPay(req: LnUrlPayRequest) throws -> LnUrlPayResult + + func lnurlWithdraw(req: LnUrlWithdrawRequest) throws -> LnUrlWithdrawResult + + func payOnchain(req: PayOnchainRequest) throws -> SendPaymentResponse + + func preparePayOnchain(req: PreparePayOnchainRequest) throws -> PreparePayOnchainResponse + + func prepareReceiveOnchain(req: PrepareReceiveOnchainRequest) throws -> PrepareReceiveOnchainResponse + func prepareReceivePayment(req: PrepareReceiveRequest) throws -> PrepareReceiveResponse + func prepareRefund(req: PrepareRefundRequest) throws -> PrepareRefundResponse + func prepareSendPayment(req: PrepareSendRequest) throws -> PrepareSendResponse + func receiveOnchain(req: PrepareReceiveOnchainResponse) throws -> ReceiveOnchainResponse + func receivePayment(req: PrepareReceiveResponse) throws -> ReceivePaymentResponse + func refund(req: RefundRequest) throws -> RefundResponse + func removeEventListener(id: String) throws + func rescanOnchainSwaps() throws + func restore(req: RestoreRequest) throws func sendPayment(req: PrepareSendResponse) throws -> SendPaymentResponse @@ -564,6 +637,13 @@ open func disconnect()throws {try rustCallWithError(FfiConverterTypeLiquidSdkEr } } +open func fetchFiatRates()throws -> [Rate] { + return try FfiConverterSequenceTypeRate.lift(try rustCallWithError(FfiConverterTypeLiquidSdkError.lift) { + uniffi_breez_liquid_sdk_bindings_fn_method_bindingliquidsdk_fetch_fiat_rates(self.uniffiClonePointer(),$0 + ) +}) +} + open func getInfo()throws -> GetInfoResponse { return try FfiConverterTypeGetInfoResponse.lift(try rustCallWithError(FfiConverterTypeLiquidSdkError.lift) { uniffi_breez_liquid_sdk_bindings_fn_method_bindingliquidsdk_get_info(self.uniffiClonePointer(),$0 @@ -571,6 +651,13 @@ open func getInfo()throws -> GetInfoResponse { }) } +open func listFiatCurrencies()throws -> [FiatCurrency] { + return try FfiConverterSequenceTypeFiatCurrency.lift(try rustCallWithError(FfiConverterTypeLiquidSdkError.lift) { + uniffi_breez_liquid_sdk_bindings_fn_method_bindingliquidsdk_list_fiat_currencies(self.uniffiClonePointer(),$0 + ) +}) +} + open func listPayments()throws -> [Payment] { return try FfiConverterSequenceTypePayment.lift(try rustCallWithError(FfiConverterTypePaymentError.lift) { uniffi_breez_liquid_sdk_bindings_fn_method_bindingliquidsdk_list_payments(self.uniffiClonePointer(),$0 @@ -578,6 +665,61 @@ open func listPayments()throws -> [Payment] { }) } +open func listRefundables()throws -> [RefundableSwap] { + return try FfiConverterSequenceTypeRefundableSwap.lift(try rustCallWithError(FfiConverterTypeLiquidSdkError.lift) { + uniffi_breez_liquid_sdk_bindings_fn_method_bindingliquidsdk_list_refundables(self.uniffiClonePointer(),$0 + ) +}) +} + +open func lnurlAuth(reqData: LnUrlAuthRequestData)throws -> LnUrlCallbackStatus { + return try FfiConverterTypeLnUrlCallbackStatus.lift(try rustCallWithError(FfiConverterTypeLnUrlAuthError.lift) { + uniffi_breez_liquid_sdk_bindings_fn_method_bindingliquidsdk_lnurl_auth(self.uniffiClonePointer(), + FfiConverterTypeLnUrlAuthRequestData.lower(reqData),$0 + ) +}) +} + +open func lnurlPay(req: LnUrlPayRequest)throws -> LnUrlPayResult { + return try FfiConverterTypeLnUrlPayResult.lift(try rustCallWithError(FfiConverterTypeLnUrlPayError.lift) { + uniffi_breez_liquid_sdk_bindings_fn_method_bindingliquidsdk_lnurl_pay(self.uniffiClonePointer(), + FfiConverterTypeLnUrlPayRequest.lower(req),$0 + ) +}) +} + +open func lnurlWithdraw(req: LnUrlWithdrawRequest)throws -> LnUrlWithdrawResult { + return try FfiConverterTypeLnUrlWithdrawResult.lift(try rustCallWithError(FfiConverterTypeLnUrlWithdrawError.lift) { + uniffi_breez_liquid_sdk_bindings_fn_method_bindingliquidsdk_lnurl_withdraw(self.uniffiClonePointer(), + FfiConverterTypeLnUrlWithdrawRequest.lower(req),$0 + ) +}) +} + +open func payOnchain(req: PayOnchainRequest)throws -> SendPaymentResponse { + return try FfiConverterTypeSendPaymentResponse.lift(try rustCallWithError(FfiConverterTypePaymentError.lift) { + uniffi_breez_liquid_sdk_bindings_fn_method_bindingliquidsdk_pay_onchain(self.uniffiClonePointer(), + FfiConverterTypePayOnchainRequest.lower(req),$0 + ) +}) +} + +open func preparePayOnchain(req: PreparePayOnchainRequest)throws -> PreparePayOnchainResponse { + return try FfiConverterTypePreparePayOnchainResponse.lift(try rustCallWithError(FfiConverterTypePaymentError.lift) { + uniffi_breez_liquid_sdk_bindings_fn_method_bindingliquidsdk_prepare_pay_onchain(self.uniffiClonePointer(), + FfiConverterTypePreparePayOnchainRequest.lower(req),$0 + ) +}) +} + +open func prepareReceiveOnchain(req: PrepareReceiveOnchainRequest)throws -> PrepareReceiveOnchainResponse { + return try FfiConverterTypePrepareReceiveOnchainResponse.lift(try rustCallWithError(FfiConverterTypePaymentError.lift) { + uniffi_breez_liquid_sdk_bindings_fn_method_bindingliquidsdk_prepare_receive_onchain(self.uniffiClonePointer(), + FfiConverterTypePrepareReceiveOnchainRequest.lower(req),$0 + ) +}) +} + open func prepareReceivePayment(req: PrepareReceiveRequest)throws -> PrepareReceiveResponse { return try FfiConverterTypePrepareReceiveResponse.lift(try rustCallWithError(FfiConverterTypePaymentError.lift) { uniffi_breez_liquid_sdk_bindings_fn_method_bindingliquidsdk_prepare_receive_payment(self.uniffiClonePointer(), @@ -586,6 +728,14 @@ open func prepareReceivePayment(req: PrepareReceiveRequest)throws -> PrepareRec }) } +open func prepareRefund(req: PrepareRefundRequest)throws -> PrepareRefundResponse { + return try FfiConverterTypePrepareRefundResponse.lift(try rustCallWithError(FfiConverterTypeLiquidSdkError.lift) { + uniffi_breez_liquid_sdk_bindings_fn_method_bindingliquidsdk_prepare_refund(self.uniffiClonePointer(), + FfiConverterTypePrepareRefundRequest.lower(req),$0 + ) +}) +} + open func prepareSendPayment(req: PrepareSendRequest)throws -> PrepareSendResponse { return try FfiConverterTypePrepareSendResponse.lift(try rustCallWithError(FfiConverterTypePaymentError.lift) { uniffi_breez_liquid_sdk_bindings_fn_method_bindingliquidsdk_prepare_send_payment(self.uniffiClonePointer(), @@ -594,6 +744,14 @@ open func prepareSendPayment(req: PrepareSendRequest)throws -> PrepareSendRespo }) } +open func receiveOnchain(req: PrepareReceiveOnchainResponse)throws -> ReceiveOnchainResponse { + return try FfiConverterTypeReceiveOnchainResponse.lift(try rustCallWithError(FfiConverterTypePaymentError.lift) { + uniffi_breez_liquid_sdk_bindings_fn_method_bindingliquidsdk_receive_onchain(self.uniffiClonePointer(), + FfiConverterTypePrepareReceiveOnchainResponse.lower(req),$0 + ) +}) +} + open func receivePayment(req: PrepareReceiveResponse)throws -> ReceivePaymentResponse { return try FfiConverterTypeReceivePaymentResponse.lift(try rustCallWithError(FfiConverterTypePaymentError.lift) { uniffi_breez_liquid_sdk_bindings_fn_method_bindingliquidsdk_receive_payment(self.uniffiClonePointer(), @@ -602,6 +760,14 @@ open func receivePayment(req: PrepareReceiveResponse)throws -> ReceivePaymentRe }) } +open func refund(req: RefundRequest)throws -> RefundResponse { + return try FfiConverterTypeRefundResponse.lift(try rustCallWithError(FfiConverterTypePaymentError.lift) { + uniffi_breez_liquid_sdk_bindings_fn_method_bindingliquidsdk_refund(self.uniffiClonePointer(), + FfiConverterTypeRefundRequest.lower(req),$0 + ) +}) +} + open func removeEventListener(id: String)throws {try rustCallWithError(FfiConverterTypeLiquidSdkError.lift) { uniffi_breez_liquid_sdk_bindings_fn_method_bindingliquidsdk_remove_event_listener(self.uniffiClonePointer(), FfiConverterString.lower(id),$0 @@ -609,6 +775,12 @@ open func removeEventListener(id: String)throws {try rustCallWithError(FfiConve } } +open func rescanOnchainSwaps()throws {try rustCallWithError(FfiConverterTypeLiquidSdkError.lift) { + uniffi_breez_liquid_sdk_bindings_fn_method_bindingliquidsdk_rescan_onchain_swaps(self.uniffiClonePointer(),$0 + ) +} +} + open func restore(req: RestoreRequest)throws {try rustCallWithError(FfiConverterTypeLiquidSdkError.lift) { uniffi_breez_liquid_sdk_bindings_fn_method_bindingliquidsdk_restore(self.uniffiClonePointer(), FfiConverterTypeRestoreRequest.lower(req),$0 @@ -676,6 +848,63 @@ public func FfiConverterTypeBindingLiquidSdk_lower(_ value: BindingLiquidSdk) -> } +public struct AesSuccessActionDataDecrypted { + public var description: String + public var plaintext: String + + // Default memberwise initializers are never public by default, so we + // declare one manually. + public init(description: String, plaintext: String) { + self.description = description + self.plaintext = plaintext + } +} + + + +extension AesSuccessActionDataDecrypted: Equatable, Hashable { + public static func ==(lhs: AesSuccessActionDataDecrypted, rhs: AesSuccessActionDataDecrypted) -> Bool { + if lhs.description != rhs.description { + return false + } + if lhs.plaintext != rhs.plaintext { + return false + } + return true + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(description) + hasher.combine(plaintext) + } +} + + +public struct FfiConverterTypeAesSuccessActionDataDecrypted: FfiConverterRustBuffer { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AesSuccessActionDataDecrypted { + return + try AesSuccessActionDataDecrypted( + description: FfiConverterString.read(from: &buf), + plaintext: FfiConverterString.read(from: &buf) + ) + } + + public static func write(_ value: AesSuccessActionDataDecrypted, into buf: inout [UInt8]) { + FfiConverterString.write(value.description, into: &buf) + FfiConverterString.write(value.plaintext, into: &buf) + } +} + + +public func FfiConverterTypeAesSuccessActionDataDecrypted_lift(_ buf: RustBuffer) throws -> AesSuccessActionDataDecrypted { + return try FfiConverterTypeAesSuccessActionDataDecrypted.lift(buf) +} + +public func FfiConverterTypeAesSuccessActionDataDecrypted_lower(_ value: AesSuccessActionDataDecrypted) -> RustBuffer { + return FfiConverterTypeAesSuccessActionDataDecrypted.lower(value) +} + + public struct BackupRequest { public var backupPath: String? @@ -725,20 +954,101 @@ public func FfiConverterTypeBackupRequest_lower(_ value: BackupRequest) -> RustB } +public struct BitcoinAddressData { + public var address: String + public var network: Network + public var amountSat: UInt64? + public var label: String? + public var message: String? + + // Default memberwise initializers are never public by default, so we + // declare one manually. + public init(address: String, network: Network, amountSat: UInt64?, label: String?, message: String?) { + self.address = address + self.network = network + self.amountSat = amountSat + self.label = label + self.message = message + } +} + + + +extension BitcoinAddressData: Equatable, Hashable { + public static func ==(lhs: BitcoinAddressData, rhs: BitcoinAddressData) -> Bool { + if lhs.address != rhs.address { + return false + } + if lhs.network != rhs.network { + return false + } + if lhs.amountSat != rhs.amountSat { + return false + } + if lhs.label != rhs.label { + return false + } + if lhs.message != rhs.message { + return false + } + return true + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(address) + hasher.combine(network) + hasher.combine(amountSat) + hasher.combine(label) + hasher.combine(message) + } +} + + +public struct FfiConverterTypeBitcoinAddressData: FfiConverterRustBuffer { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> BitcoinAddressData { + return + try BitcoinAddressData( + address: FfiConverterString.read(from: &buf), + network: FfiConverterTypeNetwork.read(from: &buf), + amountSat: FfiConverterOptionUInt64.read(from: &buf), + label: FfiConverterOptionString.read(from: &buf), + message: FfiConverterOptionString.read(from: &buf) + ) + } + + public static func write(_ value: BitcoinAddressData, into buf: inout [UInt8]) { + FfiConverterString.write(value.address, into: &buf) + FfiConverterTypeNetwork.write(value.network, into: &buf) + FfiConverterOptionUInt64.write(value.amountSat, into: &buf) + FfiConverterOptionString.write(value.label, into: &buf) + FfiConverterOptionString.write(value.message, into: &buf) + } +} + + +public func FfiConverterTypeBitcoinAddressData_lift(_ buf: RustBuffer) throws -> BitcoinAddressData { + return try FfiConverterTypeBitcoinAddressData.lift(buf) +} + +public func FfiConverterTypeBitcoinAddressData_lower(_ value: BitcoinAddressData) -> RustBuffer { + return FfiConverterTypeBitcoinAddressData.lower(value) +} + + public struct Config { - public var boltzUrl: String - public var electrumUrl: String + public var liquidElectrumUrl: String + public var bitcoinElectrumUrl: String public var workingDir: String - public var network: Network + public var network: LiquidNetwork public var paymentTimeoutSec: UInt64 public var zeroConfMinFeeRate: Float public var zeroConfMaxAmountSat: UInt64? // Default memberwise initializers are never public by default, so we // declare one manually. - public init(boltzUrl: String, electrumUrl: String, workingDir: String, network: Network, paymentTimeoutSec: UInt64, zeroConfMinFeeRate: Float, zeroConfMaxAmountSat: UInt64?) { - self.boltzUrl = boltzUrl - self.electrumUrl = electrumUrl + public init(liquidElectrumUrl: String, bitcoinElectrumUrl: String, workingDir: String, network: LiquidNetwork, paymentTimeoutSec: UInt64, zeroConfMinFeeRate: Float, zeroConfMaxAmountSat: UInt64?) { + self.liquidElectrumUrl = liquidElectrumUrl + self.bitcoinElectrumUrl = bitcoinElectrumUrl self.workingDir = workingDir self.network = network self.paymentTimeoutSec = paymentTimeoutSec @@ -751,10 +1061,10 @@ public struct Config { extension Config: Equatable, Hashable { public static func ==(lhs: Config, rhs: Config) -> Bool { - if lhs.boltzUrl != rhs.boltzUrl { + if lhs.liquidElectrumUrl != rhs.liquidElectrumUrl { return false } - if lhs.electrumUrl != rhs.electrumUrl { + if lhs.bitcoinElectrumUrl != rhs.bitcoinElectrumUrl { return false } if lhs.workingDir != rhs.workingDir { @@ -776,8 +1086,8 @@ extension Config: Equatable, Hashable { } public func hash(into hasher: inout Hasher) { - hasher.combine(boltzUrl) - hasher.combine(electrumUrl) + hasher.combine(liquidElectrumUrl) + hasher.combine(bitcoinElectrumUrl) hasher.combine(workingDir) hasher.combine(network) hasher.combine(paymentTimeoutSec) @@ -791,10 +1101,10 @@ public struct FfiConverterTypeConfig: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Config { return try Config( - boltzUrl: FfiConverterString.read(from: &buf), - electrumUrl: FfiConverterString.read(from: &buf), + liquidElectrumUrl: FfiConverterString.read(from: &buf), + bitcoinElectrumUrl: FfiConverterString.read(from: &buf), workingDir: FfiConverterString.read(from: &buf), - network: FfiConverterTypeNetwork.read(from: &buf), + network: FfiConverterTypeLiquidNetwork.read(from: &buf), paymentTimeoutSec: FfiConverterUInt64.read(from: &buf), zeroConfMinFeeRate: FfiConverterFloat.read(from: &buf), zeroConfMaxAmountSat: FfiConverterOptionUInt64.read(from: &buf) @@ -802,10 +1112,10 @@ public struct FfiConverterTypeConfig: FfiConverterRustBuffer { } public static func write(_ value: Config, into buf: inout [UInt8]) { - FfiConverterString.write(value.boltzUrl, into: &buf) - FfiConverterString.write(value.electrumUrl, into: &buf) + FfiConverterString.write(value.liquidElectrumUrl, into: &buf) + FfiConverterString.write(value.bitcoinElectrumUrl, into: &buf) FfiConverterString.write(value.workingDir, into: &buf) - FfiConverterTypeNetwork.write(value.network, into: &buf) + FfiConverterTypeLiquidNetwork.write(value.network, into: &buf) FfiConverterUInt64.write(value.paymentTimeoutSec, into: &buf) FfiConverterFloat.write(value.zeroConfMinFeeRate, into: &buf) FfiConverterOptionUInt64.write(value.zeroConfMaxAmountSat, into: &buf) @@ -879,122 +1189,279 @@ public func FfiConverterTypeConnectRequest_lower(_ value: ConnectRequest) -> Rus } -public struct GetInfoResponse { - public var balanceSat: UInt64 - public var pendingSendSat: UInt64 - public var pendingReceiveSat: UInt64 - public var pubkey: String +public struct CurrencyInfo { + public var name: String + public var fractionSize: UInt32 + public var spacing: UInt32? + public var symbol: Symbol? + public var uniqSymbol: Symbol? + public var localizedName: [LocalizedName] + public var localeOverrides: [LocaleOverrides] // Default memberwise initializers are never public by default, so we // declare one manually. - public init(balanceSat: UInt64, pendingSendSat: UInt64, pendingReceiveSat: UInt64, pubkey: String) { - self.balanceSat = balanceSat - self.pendingSendSat = pendingSendSat - self.pendingReceiveSat = pendingReceiveSat - self.pubkey = pubkey + public init(name: String, fractionSize: UInt32, spacing: UInt32?, symbol: Symbol?, uniqSymbol: Symbol?, localizedName: [LocalizedName], localeOverrides: [LocaleOverrides]) { + self.name = name + self.fractionSize = fractionSize + self.spacing = spacing + self.symbol = symbol + self.uniqSymbol = uniqSymbol + self.localizedName = localizedName + self.localeOverrides = localeOverrides } } -extension GetInfoResponse: Equatable, Hashable { - public static func ==(lhs: GetInfoResponse, rhs: GetInfoResponse) -> Bool { - if lhs.balanceSat != rhs.balanceSat { +extension CurrencyInfo: Equatable, Hashable { + public static func ==(lhs: CurrencyInfo, rhs: CurrencyInfo) -> Bool { + if lhs.name != rhs.name { return false } - if lhs.pendingSendSat != rhs.pendingSendSat { + if lhs.fractionSize != rhs.fractionSize { return false } - if lhs.pendingReceiveSat != rhs.pendingReceiveSat { + if lhs.spacing != rhs.spacing { return false } - if lhs.pubkey != rhs.pubkey { + if lhs.symbol != rhs.symbol { + return false + } + if lhs.uniqSymbol != rhs.uniqSymbol { + return false + } + if lhs.localizedName != rhs.localizedName { + return false + } + if lhs.localeOverrides != rhs.localeOverrides { return false } return true } public func hash(into hasher: inout Hasher) { - hasher.combine(balanceSat) - hasher.combine(pendingSendSat) - hasher.combine(pendingReceiveSat) - hasher.combine(pubkey) + hasher.combine(name) + hasher.combine(fractionSize) + hasher.combine(spacing) + hasher.combine(symbol) + hasher.combine(uniqSymbol) + hasher.combine(localizedName) + hasher.combine(localeOverrides) } } -public struct FfiConverterTypeGetInfoResponse: FfiConverterRustBuffer { - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> GetInfoResponse { +public struct FfiConverterTypeCurrencyInfo: FfiConverterRustBuffer { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> CurrencyInfo { return - try GetInfoResponse( - balanceSat: FfiConverterUInt64.read(from: &buf), - pendingSendSat: FfiConverterUInt64.read(from: &buf), - pendingReceiveSat: FfiConverterUInt64.read(from: &buf), - pubkey: FfiConverterString.read(from: &buf) + try CurrencyInfo( + name: FfiConverterString.read(from: &buf), + fractionSize: FfiConverterUInt32.read(from: &buf), + spacing: FfiConverterOptionUInt32.read(from: &buf), + symbol: FfiConverterOptionTypeSymbol.read(from: &buf), + uniqSymbol: FfiConverterOptionTypeSymbol.read(from: &buf), + localizedName: FfiConverterSequenceTypeLocalizedName.read(from: &buf), + localeOverrides: FfiConverterSequenceTypeLocaleOverrides.read(from: &buf) ) } - public static func write(_ value: GetInfoResponse, into buf: inout [UInt8]) { - FfiConverterUInt64.write(value.balanceSat, into: &buf) - FfiConverterUInt64.write(value.pendingSendSat, into: &buf) - FfiConverterUInt64.write(value.pendingReceiveSat, into: &buf) - FfiConverterString.write(value.pubkey, into: &buf) + public static func write(_ value: CurrencyInfo, into buf: inout [UInt8]) { + FfiConverterString.write(value.name, into: &buf) + FfiConverterUInt32.write(value.fractionSize, into: &buf) + FfiConverterOptionUInt32.write(value.spacing, into: &buf) + FfiConverterOptionTypeSymbol.write(value.symbol, into: &buf) + FfiConverterOptionTypeSymbol.write(value.uniqSymbol, into: &buf) + FfiConverterSequenceTypeLocalizedName.write(value.localizedName, into: &buf) + FfiConverterSequenceTypeLocaleOverrides.write(value.localeOverrides, into: &buf) } } -public func FfiConverterTypeGetInfoResponse_lift(_ buf: RustBuffer) throws -> GetInfoResponse { - return try FfiConverterTypeGetInfoResponse.lift(buf) +public func FfiConverterTypeCurrencyInfo_lift(_ buf: RustBuffer) throws -> CurrencyInfo { + return try FfiConverterTypeCurrencyInfo.lift(buf) } -public func FfiConverterTypeGetInfoResponse_lower(_ value: GetInfoResponse) -> RustBuffer { - return FfiConverterTypeGetInfoResponse.lower(value) +public func FfiConverterTypeCurrencyInfo_lower(_ value: CurrencyInfo) -> RustBuffer { + return FfiConverterTypeCurrencyInfo.lower(value) } -public struct LnInvoice { - public var bolt11: String - public var network: Network - public var payeePubkey: String - public var paymentHash: String - public var description: String? - public var descriptionHash: String? - public var amountMsat: UInt64? - public var timestamp: UInt64 - public var expiry: UInt64 - public var routingHints: [RouteHint] - public var paymentSecret: [UInt8] - public var minFinalCltvExpiryDelta: UInt64 +public struct FiatCurrency { + public var id: String + public var info: CurrencyInfo // Default memberwise initializers are never public by default, so we // declare one manually. - public init(bolt11: String, network: Network, payeePubkey: String, paymentHash: String, description: String?, descriptionHash: String?, amountMsat: UInt64?, timestamp: UInt64, expiry: UInt64, routingHints: [RouteHint], paymentSecret: [UInt8], minFinalCltvExpiryDelta: UInt64) { - self.bolt11 = bolt11 - self.network = network - self.payeePubkey = payeePubkey - self.paymentHash = paymentHash - self.description = description - self.descriptionHash = descriptionHash - self.amountMsat = amountMsat - self.timestamp = timestamp - self.expiry = expiry - self.routingHints = routingHints - self.paymentSecret = paymentSecret - self.minFinalCltvExpiryDelta = minFinalCltvExpiryDelta + public init(id: String, info: CurrencyInfo) { + self.id = id + self.info = info } } -extension LnInvoice: Equatable, Hashable { - public static func ==(lhs: LnInvoice, rhs: LnInvoice) -> Bool { - if lhs.bolt11 != rhs.bolt11 { +extension FiatCurrency: Equatable, Hashable { + public static func ==(lhs: FiatCurrency, rhs: FiatCurrency) -> Bool { + if lhs.id != rhs.id { return false } - if lhs.network != rhs.network { + if lhs.info != rhs.info { return false } - if lhs.payeePubkey != rhs.payeePubkey { + return true + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(id) + hasher.combine(info) + } +} + + +public struct FfiConverterTypeFiatCurrency: FfiConverterRustBuffer { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> FiatCurrency { + return + try FiatCurrency( + id: FfiConverterString.read(from: &buf), + info: FfiConverterTypeCurrencyInfo.read(from: &buf) + ) + } + + public static func write(_ value: FiatCurrency, into buf: inout [UInt8]) { + FfiConverterString.write(value.id, into: &buf) + FfiConverterTypeCurrencyInfo.write(value.info, into: &buf) + } +} + + +public func FfiConverterTypeFiatCurrency_lift(_ buf: RustBuffer) throws -> FiatCurrency { + return try FfiConverterTypeFiatCurrency.lift(buf) +} + +public func FfiConverterTypeFiatCurrency_lower(_ value: FiatCurrency) -> RustBuffer { + return FfiConverterTypeFiatCurrency.lower(value) +} + + +public struct GetInfoResponse { + public var balanceSat: UInt64 + public var pendingSendSat: UInt64 + public var pendingReceiveSat: UInt64 + public var pubkey: String + + // Default memberwise initializers are never public by default, so we + // declare one manually. + public init(balanceSat: UInt64, pendingSendSat: UInt64, pendingReceiveSat: UInt64, pubkey: String) { + self.balanceSat = balanceSat + self.pendingSendSat = pendingSendSat + self.pendingReceiveSat = pendingReceiveSat + self.pubkey = pubkey + } +} + + + +extension GetInfoResponse: Equatable, Hashable { + public static func ==(lhs: GetInfoResponse, rhs: GetInfoResponse) -> Bool { + if lhs.balanceSat != rhs.balanceSat { + return false + } + if lhs.pendingSendSat != rhs.pendingSendSat { + return false + } + if lhs.pendingReceiveSat != rhs.pendingReceiveSat { + return false + } + if lhs.pubkey != rhs.pubkey { + return false + } + return true + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(balanceSat) + hasher.combine(pendingSendSat) + hasher.combine(pendingReceiveSat) + hasher.combine(pubkey) + } +} + + +public struct FfiConverterTypeGetInfoResponse: FfiConverterRustBuffer { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> GetInfoResponse { + return + try GetInfoResponse( + balanceSat: FfiConverterUInt64.read(from: &buf), + pendingSendSat: FfiConverterUInt64.read(from: &buf), + pendingReceiveSat: FfiConverterUInt64.read(from: &buf), + pubkey: FfiConverterString.read(from: &buf) + ) + } + + public static func write(_ value: GetInfoResponse, into buf: inout [UInt8]) { + FfiConverterUInt64.write(value.balanceSat, into: &buf) + FfiConverterUInt64.write(value.pendingSendSat, into: &buf) + FfiConverterUInt64.write(value.pendingReceiveSat, into: &buf) + FfiConverterString.write(value.pubkey, into: &buf) + } +} + + +public func FfiConverterTypeGetInfoResponse_lift(_ buf: RustBuffer) throws -> GetInfoResponse { + return try FfiConverterTypeGetInfoResponse.lift(buf) +} + +public func FfiConverterTypeGetInfoResponse_lower(_ value: GetInfoResponse) -> RustBuffer { + return FfiConverterTypeGetInfoResponse.lower(value) +} + + +/** + * /////////////////////////////// + */ +public struct LnInvoice { + public var bolt11: String + public var network: Network + public var payeePubkey: String + public var paymentHash: String + public var description: String? + public var descriptionHash: String? + public var amountMsat: UInt64? + public var timestamp: UInt64 + public var expiry: UInt64 + public var routingHints: [RouteHint] + public var paymentSecret: [UInt8] + public var minFinalCltvExpiryDelta: UInt64 + + // Default memberwise initializers are never public by default, so we + // declare one manually. + public init(bolt11: String, network: Network, payeePubkey: String, paymentHash: String, description: String?, descriptionHash: String?, amountMsat: UInt64?, timestamp: UInt64, expiry: UInt64, routingHints: [RouteHint], paymentSecret: [UInt8], minFinalCltvExpiryDelta: UInt64) { + self.bolt11 = bolt11 + self.network = network + self.payeePubkey = payeePubkey + self.paymentHash = paymentHash + self.description = description + self.descriptionHash = descriptionHash + self.amountMsat = amountMsat + self.timestamp = timestamp + self.expiry = expiry + self.routingHints = routingHints + self.paymentSecret = paymentSecret + self.minFinalCltvExpiryDelta = minFinalCltvExpiryDelta + } +} + + + +extension LnInvoice: Equatable, Hashable { + public static func ==(lhs: LnInvoice, rhs: LnInvoice) -> Bool { + if lhs.bolt11 != rhs.bolt11 { + return false + } + if lhs.network != rhs.network { + return false + } + if lhs.payeePubkey != rhs.payeePubkey { return false } if lhs.paymentHash != rhs.paymentHash { @@ -1089,865 +1556,3245 @@ public func FfiConverterTypeLNInvoice_lower(_ value: LnInvoice) -> RustBuffer { } -public struct LogEntry { - public var line: String - public var level: String +public struct LnUrlAuthRequestData { + public var k1: String + public var domain: String + public var url: String + public var action: String? // Default memberwise initializers are never public by default, so we // declare one manually. - public init(line: String, level: String) { - self.line = line - self.level = level + public init(k1: String, domain: String, url: String, action: String? = nil) { + self.k1 = k1 + self.domain = domain + self.url = url + self.action = action } } -extension LogEntry: Equatable, Hashable { - public static func ==(lhs: LogEntry, rhs: LogEntry) -> Bool { - if lhs.line != rhs.line { +extension LnUrlAuthRequestData: Equatable, Hashable { + public static func ==(lhs: LnUrlAuthRequestData, rhs: LnUrlAuthRequestData) -> Bool { + if lhs.k1 != rhs.k1 { return false } - if lhs.level != rhs.level { + if lhs.domain != rhs.domain { + return false + } + if lhs.url != rhs.url { + return false + } + if lhs.action != rhs.action { return false } return true } public func hash(into hasher: inout Hasher) { - hasher.combine(line) - hasher.combine(level) + hasher.combine(k1) + hasher.combine(domain) + hasher.combine(url) + hasher.combine(action) } } -public struct FfiConverterTypeLogEntry: FfiConverterRustBuffer { - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> LogEntry { +public struct FfiConverterTypeLnUrlAuthRequestData: FfiConverterRustBuffer { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> LnUrlAuthRequestData { return - try LogEntry( - line: FfiConverterString.read(from: &buf), - level: FfiConverterString.read(from: &buf) + try LnUrlAuthRequestData( + k1: FfiConverterString.read(from: &buf), + domain: FfiConverterString.read(from: &buf), + url: FfiConverterString.read(from: &buf), + action: FfiConverterOptionString.read(from: &buf) ) } - public static func write(_ value: LogEntry, into buf: inout [UInt8]) { - FfiConverterString.write(value.line, into: &buf) - FfiConverterString.write(value.level, into: &buf) + public static func write(_ value: LnUrlAuthRequestData, into buf: inout [UInt8]) { + FfiConverterString.write(value.k1, into: &buf) + FfiConverterString.write(value.domain, into: &buf) + FfiConverterString.write(value.url, into: &buf) + FfiConverterOptionString.write(value.action, into: &buf) } } -public func FfiConverterTypeLogEntry_lift(_ buf: RustBuffer) throws -> LogEntry { - return try FfiConverterTypeLogEntry.lift(buf) +public func FfiConverterTypeLnUrlAuthRequestData_lift(_ buf: RustBuffer) throws -> LnUrlAuthRequestData { + return try FfiConverterTypeLnUrlAuthRequestData.lift(buf) } -public func FfiConverterTypeLogEntry_lower(_ value: LogEntry) -> RustBuffer { - return FfiConverterTypeLogEntry.lower(value) +public func FfiConverterTypeLnUrlAuthRequestData_lower(_ value: LnUrlAuthRequestData) -> RustBuffer { + return FfiConverterTypeLnUrlAuthRequestData.lower(value) } -public struct Payment { - public var txId: String? - public var swapId: String? - public var timestamp: UInt32 - public var amountSat: UInt64 - public var feesSat: UInt64 - public var preimage: String? - public var refundTxId: String? - public var refundTxAmountSat: UInt64? - public var paymentType: PaymentType - public var status: PaymentState +public struct LnUrlErrorData { + public var reason: String // Default memberwise initializers are never public by default, so we // declare one manually. - public init(txId: String? = nil, swapId: String? = nil, timestamp: UInt32, amountSat: UInt64, feesSat: UInt64, preimage: String? = nil, refundTxId: String? = nil, refundTxAmountSat: UInt64? = nil, paymentType: PaymentType, status: PaymentState) { - self.txId = txId - self.swapId = swapId - self.timestamp = timestamp - self.amountSat = amountSat - self.feesSat = feesSat - self.preimage = preimage - self.refundTxId = refundTxId - self.refundTxAmountSat = refundTxAmountSat - self.paymentType = paymentType - self.status = status + public init(reason: String) { + self.reason = reason } } -extension Payment: Equatable, Hashable { - public static func ==(lhs: Payment, rhs: Payment) -> Bool { - if lhs.txId != rhs.txId { - return false - } - if lhs.swapId != rhs.swapId { - return false - } - if lhs.timestamp != rhs.timestamp { - return false - } - if lhs.amountSat != rhs.amountSat { - return false - } - if lhs.feesSat != rhs.feesSat { - return false - } - if lhs.preimage != rhs.preimage { - return false - } - if lhs.refundTxId != rhs.refundTxId { - return false - } - if lhs.refundTxAmountSat != rhs.refundTxAmountSat { - return false - } - if lhs.paymentType != rhs.paymentType { - return false - } - if lhs.status != rhs.status { +extension LnUrlErrorData: Equatable, Hashable { + public static func ==(lhs: LnUrlErrorData, rhs: LnUrlErrorData) -> Bool { + if lhs.reason != rhs.reason { return false } return true } public func hash(into hasher: inout Hasher) { - hasher.combine(txId) - hasher.combine(swapId) - hasher.combine(timestamp) - hasher.combine(amountSat) - hasher.combine(feesSat) - hasher.combine(preimage) - hasher.combine(refundTxId) - hasher.combine(refundTxAmountSat) - hasher.combine(paymentType) - hasher.combine(status) + hasher.combine(reason) } } -public struct FfiConverterTypePayment: FfiConverterRustBuffer { - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Payment { +public struct FfiConverterTypeLnUrlErrorData: FfiConverterRustBuffer { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> LnUrlErrorData { return - try Payment( - txId: FfiConverterOptionString.read(from: &buf), - swapId: FfiConverterOptionString.read(from: &buf), - timestamp: FfiConverterUInt32.read(from: &buf), - amountSat: FfiConverterUInt64.read(from: &buf), - feesSat: FfiConverterUInt64.read(from: &buf), - preimage: FfiConverterOptionString.read(from: &buf), - refundTxId: FfiConverterOptionString.read(from: &buf), - refundTxAmountSat: FfiConverterOptionUInt64.read(from: &buf), - paymentType: FfiConverterTypePaymentType.read(from: &buf), - status: FfiConverterTypePaymentState.read(from: &buf) + try LnUrlErrorData( + reason: FfiConverterString.read(from: &buf) ) } - public static func write(_ value: Payment, into buf: inout [UInt8]) { - FfiConverterOptionString.write(value.txId, into: &buf) - FfiConverterOptionString.write(value.swapId, into: &buf) - FfiConverterUInt32.write(value.timestamp, into: &buf) - FfiConverterUInt64.write(value.amountSat, into: &buf) - FfiConverterUInt64.write(value.feesSat, into: &buf) - FfiConverterOptionString.write(value.preimage, into: &buf) - FfiConverterOptionString.write(value.refundTxId, into: &buf) - FfiConverterOptionUInt64.write(value.refundTxAmountSat, into: &buf) - FfiConverterTypePaymentType.write(value.paymentType, into: &buf) - FfiConverterTypePaymentState.write(value.status, into: &buf) + public static func write(_ value: LnUrlErrorData, into buf: inout [UInt8]) { + FfiConverterString.write(value.reason, into: &buf) } } -public func FfiConverterTypePayment_lift(_ buf: RustBuffer) throws -> Payment { - return try FfiConverterTypePayment.lift(buf) +public func FfiConverterTypeLnUrlErrorData_lift(_ buf: RustBuffer) throws -> LnUrlErrorData { + return try FfiConverterTypeLnUrlErrorData.lift(buf) } -public func FfiConverterTypePayment_lower(_ value: Payment) -> RustBuffer { - return FfiConverterTypePayment.lower(value) +public func FfiConverterTypeLnUrlErrorData_lower(_ value: LnUrlErrorData) -> RustBuffer { + return FfiConverterTypeLnUrlErrorData.lower(value) } -public struct PrepareReceiveRequest { - public var payerAmountSat: UInt64 +public struct LnUrlPayErrorData { + public var paymentHash: String + public var reason: String // Default memberwise initializers are never public by default, so we // declare one manually. - public init(payerAmountSat: UInt64) { - self.payerAmountSat = payerAmountSat + public init(paymentHash: String, reason: String) { + self.paymentHash = paymentHash + self.reason = reason } } -extension PrepareReceiveRequest: Equatable, Hashable { - public static func ==(lhs: PrepareReceiveRequest, rhs: PrepareReceiveRequest) -> Bool { - if lhs.payerAmountSat != rhs.payerAmountSat { +extension LnUrlPayErrorData: Equatable, Hashable { + public static func ==(lhs: LnUrlPayErrorData, rhs: LnUrlPayErrorData) -> Bool { + if lhs.paymentHash != rhs.paymentHash { + return false + } + if lhs.reason != rhs.reason { return false } return true } public func hash(into hasher: inout Hasher) { - hasher.combine(payerAmountSat) + hasher.combine(paymentHash) + hasher.combine(reason) } } -public struct FfiConverterTypePrepareReceiveRequest: FfiConverterRustBuffer { - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PrepareReceiveRequest { +public struct FfiConverterTypeLnUrlPayErrorData: FfiConverterRustBuffer { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> LnUrlPayErrorData { return - try PrepareReceiveRequest( - payerAmountSat: FfiConverterUInt64.read(from: &buf) + try LnUrlPayErrorData( + paymentHash: FfiConverterString.read(from: &buf), + reason: FfiConverterString.read(from: &buf) ) } - public static func write(_ value: PrepareReceiveRequest, into buf: inout [UInt8]) { - FfiConverterUInt64.write(value.payerAmountSat, into: &buf) + public static func write(_ value: LnUrlPayErrorData, into buf: inout [UInt8]) { + FfiConverterString.write(value.paymentHash, into: &buf) + FfiConverterString.write(value.reason, into: &buf) } } -public func FfiConverterTypePrepareReceiveRequest_lift(_ buf: RustBuffer) throws -> PrepareReceiveRequest { - return try FfiConverterTypePrepareReceiveRequest.lift(buf) +public func FfiConverterTypeLnUrlPayErrorData_lift(_ buf: RustBuffer) throws -> LnUrlPayErrorData { + return try FfiConverterTypeLnUrlPayErrorData.lift(buf) } -public func FfiConverterTypePrepareReceiveRequest_lower(_ value: PrepareReceiveRequest) -> RustBuffer { - return FfiConverterTypePrepareReceiveRequest.lower(value) +public func FfiConverterTypeLnUrlPayErrorData_lower(_ value: LnUrlPayErrorData) -> RustBuffer { + return FfiConverterTypeLnUrlPayErrorData.lower(value) } -public struct PrepareReceiveResponse { - public var payerAmountSat: UInt64 - public var feesSat: UInt64 +public struct LnUrlPayRequest { + public var data: LnUrlPayRequestData + public var amountMsat: UInt64 + public var comment: String? + public var paymentLabel: String? // Default memberwise initializers are never public by default, so we // declare one manually. - public init(payerAmountSat: UInt64, feesSat: UInt64) { - self.payerAmountSat = payerAmountSat - self.feesSat = feesSat + public init(data: LnUrlPayRequestData, amountMsat: UInt64, comment: String? = nil, paymentLabel: String? = nil) { + self.data = data + self.amountMsat = amountMsat + self.comment = comment + self.paymentLabel = paymentLabel } } -extension PrepareReceiveResponse: Equatable, Hashable { - public static func ==(lhs: PrepareReceiveResponse, rhs: PrepareReceiveResponse) -> Bool { - if lhs.payerAmountSat != rhs.payerAmountSat { +extension LnUrlPayRequest: Equatable, Hashable { + public static func ==(lhs: LnUrlPayRequest, rhs: LnUrlPayRequest) -> Bool { + if lhs.data != rhs.data { return false } - if lhs.feesSat != rhs.feesSat { + if lhs.amountMsat != rhs.amountMsat { + return false + } + if lhs.comment != rhs.comment { + return false + } + if lhs.paymentLabel != rhs.paymentLabel { return false } return true } public func hash(into hasher: inout Hasher) { - hasher.combine(payerAmountSat) - hasher.combine(feesSat) + hasher.combine(data) + hasher.combine(amountMsat) + hasher.combine(comment) + hasher.combine(paymentLabel) } } -public struct FfiConverterTypePrepareReceiveResponse: FfiConverterRustBuffer { - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PrepareReceiveResponse { +public struct FfiConverterTypeLnUrlPayRequest: FfiConverterRustBuffer { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> LnUrlPayRequest { return - try PrepareReceiveResponse( - payerAmountSat: FfiConverterUInt64.read(from: &buf), - feesSat: FfiConverterUInt64.read(from: &buf) + try LnUrlPayRequest( + data: FfiConverterTypeLnUrlPayRequestData.read(from: &buf), + amountMsat: FfiConverterUInt64.read(from: &buf), + comment: FfiConverterOptionString.read(from: &buf), + paymentLabel: FfiConverterOptionString.read(from: &buf) ) } - public static func write(_ value: PrepareReceiveResponse, into buf: inout [UInt8]) { - FfiConverterUInt64.write(value.payerAmountSat, into: &buf) - FfiConverterUInt64.write(value.feesSat, into: &buf) + public static func write(_ value: LnUrlPayRequest, into buf: inout [UInt8]) { + FfiConverterTypeLnUrlPayRequestData.write(value.data, into: &buf) + FfiConverterUInt64.write(value.amountMsat, into: &buf) + FfiConverterOptionString.write(value.comment, into: &buf) + FfiConverterOptionString.write(value.paymentLabel, into: &buf) } } -public func FfiConverterTypePrepareReceiveResponse_lift(_ buf: RustBuffer) throws -> PrepareReceiveResponse { - return try FfiConverterTypePrepareReceiveResponse.lift(buf) +public func FfiConverterTypeLnUrlPayRequest_lift(_ buf: RustBuffer) throws -> LnUrlPayRequest { + return try FfiConverterTypeLnUrlPayRequest.lift(buf) } -public func FfiConverterTypePrepareReceiveResponse_lower(_ value: PrepareReceiveResponse) -> RustBuffer { - return FfiConverterTypePrepareReceiveResponse.lower(value) +public func FfiConverterTypeLnUrlPayRequest_lower(_ value: LnUrlPayRequest) -> RustBuffer { + return FfiConverterTypeLnUrlPayRequest.lower(value) } -public struct PrepareSendRequest { - public var invoice: String +public struct LnUrlPayRequestData { + public var callback: String + public var minSendable: UInt64 + public var maxSendable: UInt64 + public var metadataStr: String + public var commentAllowed: UInt16 + public var domain: String + public var allowsNostr: Bool + public var nostrPubkey: String? + public var lnAddress: String? // Default memberwise initializers are never public by default, so we // declare one manually. - public init(invoice: String) { - self.invoice = invoice + public init(callback: String, minSendable: UInt64, maxSendable: UInt64, metadataStr: String, commentAllowed: UInt16, domain: String, allowsNostr: Bool, nostrPubkey: String?, lnAddress: String?) { + self.callback = callback + self.minSendable = minSendable + self.maxSendable = maxSendable + self.metadataStr = metadataStr + self.commentAllowed = commentAllowed + self.domain = domain + self.allowsNostr = allowsNostr + self.nostrPubkey = nostrPubkey + self.lnAddress = lnAddress } } -extension PrepareSendRequest: Equatable, Hashable { - public static func ==(lhs: PrepareSendRequest, rhs: PrepareSendRequest) -> Bool { - if lhs.invoice != rhs.invoice { +extension LnUrlPayRequestData: Equatable, Hashable { + public static func ==(lhs: LnUrlPayRequestData, rhs: LnUrlPayRequestData) -> Bool { + if lhs.callback != rhs.callback { + return false + } + if lhs.minSendable != rhs.minSendable { + return false + } + if lhs.maxSendable != rhs.maxSendable { + return false + } + if lhs.metadataStr != rhs.metadataStr { + return false + } + if lhs.commentAllowed != rhs.commentAllowed { + return false + } + if lhs.domain != rhs.domain { + return false + } + if lhs.allowsNostr != rhs.allowsNostr { + return false + } + if lhs.nostrPubkey != rhs.nostrPubkey { + return false + } + if lhs.lnAddress != rhs.lnAddress { return false } return true } public func hash(into hasher: inout Hasher) { - hasher.combine(invoice) + hasher.combine(callback) + hasher.combine(minSendable) + hasher.combine(maxSendable) + hasher.combine(metadataStr) + hasher.combine(commentAllowed) + hasher.combine(domain) + hasher.combine(allowsNostr) + hasher.combine(nostrPubkey) + hasher.combine(lnAddress) } } -public struct FfiConverterTypePrepareSendRequest: FfiConverterRustBuffer { - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PrepareSendRequest { +public struct FfiConverterTypeLnUrlPayRequestData: FfiConverterRustBuffer { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> LnUrlPayRequestData { return - try PrepareSendRequest( - invoice: FfiConverterString.read(from: &buf) + try LnUrlPayRequestData( + callback: FfiConverterString.read(from: &buf), + minSendable: FfiConverterUInt64.read(from: &buf), + maxSendable: FfiConverterUInt64.read(from: &buf), + metadataStr: FfiConverterString.read(from: &buf), + commentAllowed: FfiConverterUInt16.read(from: &buf), + domain: FfiConverterString.read(from: &buf), + allowsNostr: FfiConverterBool.read(from: &buf), + nostrPubkey: FfiConverterOptionString.read(from: &buf), + lnAddress: FfiConverterOptionString.read(from: &buf) ) } - public static func write(_ value: PrepareSendRequest, into buf: inout [UInt8]) { - FfiConverterString.write(value.invoice, into: &buf) + public static func write(_ value: LnUrlPayRequestData, into buf: inout [UInt8]) { + FfiConverterString.write(value.callback, into: &buf) + FfiConverterUInt64.write(value.minSendable, into: &buf) + FfiConverterUInt64.write(value.maxSendable, into: &buf) + FfiConverterString.write(value.metadataStr, into: &buf) + FfiConverterUInt16.write(value.commentAllowed, into: &buf) + FfiConverterString.write(value.domain, into: &buf) + FfiConverterBool.write(value.allowsNostr, into: &buf) + FfiConverterOptionString.write(value.nostrPubkey, into: &buf) + FfiConverterOptionString.write(value.lnAddress, into: &buf) } } -public func FfiConverterTypePrepareSendRequest_lift(_ buf: RustBuffer) throws -> PrepareSendRequest { - return try FfiConverterTypePrepareSendRequest.lift(buf) +public func FfiConverterTypeLnUrlPayRequestData_lift(_ buf: RustBuffer) throws -> LnUrlPayRequestData { + return try FfiConverterTypeLnUrlPayRequestData.lift(buf) } -public func FfiConverterTypePrepareSendRequest_lower(_ value: PrepareSendRequest) -> RustBuffer { - return FfiConverterTypePrepareSendRequest.lower(value) +public func FfiConverterTypeLnUrlPayRequestData_lower(_ value: LnUrlPayRequestData) -> RustBuffer { + return FfiConverterTypeLnUrlPayRequestData.lower(value) } -public struct PrepareSendResponse { - public var invoice: String - public var feesSat: UInt64 +public struct LnUrlPaySuccessData { + public var successAction: SuccessActionProcessed? + public var payment: Payment // Default memberwise initializers are never public by default, so we // declare one manually. - public init(invoice: String, feesSat: UInt64) { - self.invoice = invoice - self.feesSat = feesSat + public init(successAction: SuccessActionProcessed?, payment: Payment) { + self.successAction = successAction + self.payment = payment } } -extension PrepareSendResponse: Equatable, Hashable { - public static func ==(lhs: PrepareSendResponse, rhs: PrepareSendResponse) -> Bool { - if lhs.invoice != rhs.invoice { +extension LnUrlPaySuccessData: Equatable, Hashable { + public static func ==(lhs: LnUrlPaySuccessData, rhs: LnUrlPaySuccessData) -> Bool { + if lhs.successAction != rhs.successAction { return false } - if lhs.feesSat != rhs.feesSat { + if lhs.payment != rhs.payment { return false } return true } public func hash(into hasher: inout Hasher) { - hasher.combine(invoice) - hasher.combine(feesSat) + hasher.combine(successAction) + hasher.combine(payment) } } -public struct FfiConverterTypePrepareSendResponse: FfiConverterRustBuffer { - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PrepareSendResponse { +public struct FfiConverterTypeLnUrlPaySuccessData: FfiConverterRustBuffer { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> LnUrlPaySuccessData { return - try PrepareSendResponse( - invoice: FfiConverterString.read(from: &buf), - feesSat: FfiConverterUInt64.read(from: &buf) + try LnUrlPaySuccessData( + successAction: FfiConverterOptionTypeSuccessActionProcessed.read(from: &buf), + payment: FfiConverterTypePayment.read(from: &buf) ) } - public static func write(_ value: PrepareSendResponse, into buf: inout [UInt8]) { - FfiConverterString.write(value.invoice, into: &buf) - FfiConverterUInt64.write(value.feesSat, into: &buf) + public static func write(_ value: LnUrlPaySuccessData, into buf: inout [UInt8]) { + FfiConverterOptionTypeSuccessActionProcessed.write(value.successAction, into: &buf) + FfiConverterTypePayment.write(value.payment, into: &buf) } } -public func FfiConverterTypePrepareSendResponse_lift(_ buf: RustBuffer) throws -> PrepareSendResponse { - return try FfiConverterTypePrepareSendResponse.lift(buf) +public func FfiConverterTypeLnUrlPaySuccessData_lift(_ buf: RustBuffer) throws -> LnUrlPaySuccessData { + return try FfiConverterTypeLnUrlPaySuccessData.lift(buf) } -public func FfiConverterTypePrepareSendResponse_lower(_ value: PrepareSendResponse) -> RustBuffer { - return FfiConverterTypePrepareSendResponse.lower(value) +public func FfiConverterTypeLnUrlPaySuccessData_lower(_ value: LnUrlPaySuccessData) -> RustBuffer { + return FfiConverterTypeLnUrlPaySuccessData.lower(value) } -public struct ReceivePaymentResponse { - public var id: String - public var invoice: String +public struct LnUrlWithdrawRequest { + public var data: LnUrlWithdrawRequestData + public var amountMsat: UInt64 + public var description: String? // Default memberwise initializers are never public by default, so we // declare one manually. - public init(id: String, invoice: String) { - self.id = id - self.invoice = invoice + public init(data: LnUrlWithdrawRequestData, amountMsat: UInt64, description: String? = nil) { + self.data = data + self.amountMsat = amountMsat + self.description = description } } -extension ReceivePaymentResponse: Equatable, Hashable { - public static func ==(lhs: ReceivePaymentResponse, rhs: ReceivePaymentResponse) -> Bool { - if lhs.id != rhs.id { +extension LnUrlWithdrawRequest: Equatable, Hashable { + public static func ==(lhs: LnUrlWithdrawRequest, rhs: LnUrlWithdrawRequest) -> Bool { + if lhs.data != rhs.data { return false } - if lhs.invoice != rhs.invoice { + if lhs.amountMsat != rhs.amountMsat { + return false + } + if lhs.description != rhs.description { return false } return true } public func hash(into hasher: inout Hasher) { - hasher.combine(id) - hasher.combine(invoice) + hasher.combine(data) + hasher.combine(amountMsat) + hasher.combine(description) } } -public struct FfiConverterTypeReceivePaymentResponse: FfiConverterRustBuffer { - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ReceivePaymentResponse { +public struct FfiConverterTypeLnUrlWithdrawRequest: FfiConverterRustBuffer { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> LnUrlWithdrawRequest { return - try ReceivePaymentResponse( - id: FfiConverterString.read(from: &buf), - invoice: FfiConverterString.read(from: &buf) + try LnUrlWithdrawRequest( + data: FfiConverterTypeLnUrlWithdrawRequestData.read(from: &buf), + amountMsat: FfiConverterUInt64.read(from: &buf), + description: FfiConverterOptionString.read(from: &buf) ) } - public static func write(_ value: ReceivePaymentResponse, into buf: inout [UInt8]) { - FfiConverterString.write(value.id, into: &buf) - FfiConverterString.write(value.invoice, into: &buf) + public static func write(_ value: LnUrlWithdrawRequest, into buf: inout [UInt8]) { + FfiConverterTypeLnUrlWithdrawRequestData.write(value.data, into: &buf) + FfiConverterUInt64.write(value.amountMsat, into: &buf) + FfiConverterOptionString.write(value.description, into: &buf) } } -public func FfiConverterTypeReceivePaymentResponse_lift(_ buf: RustBuffer) throws -> ReceivePaymentResponse { - return try FfiConverterTypeReceivePaymentResponse.lift(buf) +public func FfiConverterTypeLnUrlWithdrawRequest_lift(_ buf: RustBuffer) throws -> LnUrlWithdrawRequest { + return try FfiConverterTypeLnUrlWithdrawRequest.lift(buf) } -public func FfiConverterTypeReceivePaymentResponse_lower(_ value: ReceivePaymentResponse) -> RustBuffer { - return FfiConverterTypeReceivePaymentResponse.lower(value) +public func FfiConverterTypeLnUrlWithdrawRequest_lower(_ value: LnUrlWithdrawRequest) -> RustBuffer { + return FfiConverterTypeLnUrlWithdrawRequest.lower(value) } -public struct RestoreRequest { - public var backupPath: String? +public struct LnUrlWithdrawRequestData { + public var callback: String + public var k1: String + public var defaultDescription: String + public var minWithdrawable: UInt64 + public var maxWithdrawable: UInt64 // Default memberwise initializers are never public by default, so we // declare one manually. - public init(backupPath: String? = nil) { - self.backupPath = backupPath + public init(callback: String, k1: String, defaultDescription: String, minWithdrawable: UInt64, maxWithdrawable: UInt64) { + self.callback = callback + self.k1 = k1 + self.defaultDescription = defaultDescription + self.minWithdrawable = minWithdrawable + self.maxWithdrawable = maxWithdrawable } } -extension RestoreRequest: Equatable, Hashable { - public static func ==(lhs: RestoreRequest, rhs: RestoreRequest) -> Bool { - if lhs.backupPath != rhs.backupPath { +extension LnUrlWithdrawRequestData: Equatable, Hashable { + public static func ==(lhs: LnUrlWithdrawRequestData, rhs: LnUrlWithdrawRequestData) -> Bool { + if lhs.callback != rhs.callback { + return false + } + if lhs.k1 != rhs.k1 { + return false + } + if lhs.defaultDescription != rhs.defaultDescription { + return false + } + if lhs.minWithdrawable != rhs.minWithdrawable { + return false + } + if lhs.maxWithdrawable != rhs.maxWithdrawable { return false } return true } public func hash(into hasher: inout Hasher) { - hasher.combine(backupPath) + hasher.combine(callback) + hasher.combine(k1) + hasher.combine(defaultDescription) + hasher.combine(minWithdrawable) + hasher.combine(maxWithdrawable) } } -public struct FfiConverterTypeRestoreRequest: FfiConverterRustBuffer { - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RestoreRequest { +public struct FfiConverterTypeLnUrlWithdrawRequestData: FfiConverterRustBuffer { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> LnUrlWithdrawRequestData { return - try RestoreRequest( - backupPath: FfiConverterOptionString.read(from: &buf) + try LnUrlWithdrawRequestData( + callback: FfiConverterString.read(from: &buf), + k1: FfiConverterString.read(from: &buf), + defaultDescription: FfiConverterString.read(from: &buf), + minWithdrawable: FfiConverterUInt64.read(from: &buf), + maxWithdrawable: FfiConverterUInt64.read(from: &buf) ) } - public static func write(_ value: RestoreRequest, into buf: inout [UInt8]) { - FfiConverterOptionString.write(value.backupPath, into: &buf) + public static func write(_ value: LnUrlWithdrawRequestData, into buf: inout [UInt8]) { + FfiConverterString.write(value.callback, into: &buf) + FfiConverterString.write(value.k1, into: &buf) + FfiConverterString.write(value.defaultDescription, into: &buf) + FfiConverterUInt64.write(value.minWithdrawable, into: &buf) + FfiConverterUInt64.write(value.maxWithdrawable, into: &buf) } } -public func FfiConverterTypeRestoreRequest_lift(_ buf: RustBuffer) throws -> RestoreRequest { - return try FfiConverterTypeRestoreRequest.lift(buf) +public func FfiConverterTypeLnUrlWithdrawRequestData_lift(_ buf: RustBuffer) throws -> LnUrlWithdrawRequestData { + return try FfiConverterTypeLnUrlWithdrawRequestData.lift(buf) } -public func FfiConverterTypeRestoreRequest_lower(_ value: RestoreRequest) -> RustBuffer { - return FfiConverterTypeRestoreRequest.lower(value) +public func FfiConverterTypeLnUrlWithdrawRequestData_lower(_ value: LnUrlWithdrawRequestData) -> RustBuffer { + return FfiConverterTypeLnUrlWithdrawRequestData.lower(value) } -public struct RouteHint { - public var hops: [RouteHintHop] +public struct LnUrlWithdrawSuccessData { + public var invoice: LnInvoice // Default memberwise initializers are never public by default, so we // declare one manually. - public init(hops: [RouteHintHop]) { - self.hops = hops + public init(invoice: LnInvoice) { + self.invoice = invoice } } -extension RouteHint: Equatable, Hashable { - public static func ==(lhs: RouteHint, rhs: RouteHint) -> Bool { - if lhs.hops != rhs.hops { +extension LnUrlWithdrawSuccessData: Equatable, Hashable { + public static func ==(lhs: LnUrlWithdrawSuccessData, rhs: LnUrlWithdrawSuccessData) -> Bool { + if lhs.invoice != rhs.invoice { return false } return true } public func hash(into hasher: inout Hasher) { - hasher.combine(hops) + hasher.combine(invoice) } } -public struct FfiConverterTypeRouteHint: FfiConverterRustBuffer { - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RouteHint { +public struct FfiConverterTypeLnUrlWithdrawSuccessData: FfiConverterRustBuffer { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> LnUrlWithdrawSuccessData { return - try RouteHint( - hops: FfiConverterSequenceTypeRouteHintHop.read(from: &buf) + try LnUrlWithdrawSuccessData( + invoice: FfiConverterTypeLNInvoice.read(from: &buf) ) } - public static func write(_ value: RouteHint, into buf: inout [UInt8]) { - FfiConverterSequenceTypeRouteHintHop.write(value.hops, into: &buf) + public static func write(_ value: LnUrlWithdrawSuccessData, into buf: inout [UInt8]) { + FfiConverterTypeLNInvoice.write(value.invoice, into: &buf) } } -public func FfiConverterTypeRouteHint_lift(_ buf: RustBuffer) throws -> RouteHint { - return try FfiConverterTypeRouteHint.lift(buf) +public func FfiConverterTypeLnUrlWithdrawSuccessData_lift(_ buf: RustBuffer) throws -> LnUrlWithdrawSuccessData { + return try FfiConverterTypeLnUrlWithdrawSuccessData.lift(buf) } -public func FfiConverterTypeRouteHint_lower(_ value: RouteHint) -> RustBuffer { - return FfiConverterTypeRouteHint.lower(value) +public func FfiConverterTypeLnUrlWithdrawSuccessData_lower(_ value: LnUrlWithdrawSuccessData) -> RustBuffer { + return FfiConverterTypeLnUrlWithdrawSuccessData.lower(value) } -public struct RouteHintHop { - public var srcNodeId: String - public var shortChannelId: UInt64 - public var feesBaseMsat: UInt32 - public var feesProportionalMillionths: UInt32 - public var cltvExpiryDelta: UInt64 - public var htlcMinimumMsat: UInt64? - public var htlcMaximumMsat: UInt64? +public struct LocaleOverrides { + public var locale: String + public var spacing: UInt32? + public var symbol: Symbol // Default memberwise initializers are never public by default, so we // declare one manually. - public init(srcNodeId: String, shortChannelId: UInt64, feesBaseMsat: UInt32, feesProportionalMillionths: UInt32, cltvExpiryDelta: UInt64, htlcMinimumMsat: UInt64?, htlcMaximumMsat: UInt64?) { - self.srcNodeId = srcNodeId - self.shortChannelId = shortChannelId - self.feesBaseMsat = feesBaseMsat - self.feesProportionalMillionths = feesProportionalMillionths - self.cltvExpiryDelta = cltvExpiryDelta - self.htlcMinimumMsat = htlcMinimumMsat - self.htlcMaximumMsat = htlcMaximumMsat + public init(locale: String, spacing: UInt32?, symbol: Symbol) { + self.locale = locale + self.spacing = spacing + self.symbol = symbol } } -extension RouteHintHop: Equatable, Hashable { - public static func ==(lhs: RouteHintHop, rhs: RouteHintHop) -> Bool { - if lhs.srcNodeId != rhs.srcNodeId { - return false - } - if lhs.shortChannelId != rhs.shortChannelId { - return false - } - if lhs.feesBaseMsat != rhs.feesBaseMsat { - return false - } - if lhs.feesProportionalMillionths != rhs.feesProportionalMillionths { - return false - } - if lhs.cltvExpiryDelta != rhs.cltvExpiryDelta { +extension LocaleOverrides: Equatable, Hashable { + public static func ==(lhs: LocaleOverrides, rhs: LocaleOverrides) -> Bool { + if lhs.locale != rhs.locale { return false } - if lhs.htlcMinimumMsat != rhs.htlcMinimumMsat { + if lhs.spacing != rhs.spacing { return false } - if lhs.htlcMaximumMsat != rhs.htlcMaximumMsat { + if lhs.symbol != rhs.symbol { return false } return true } public func hash(into hasher: inout Hasher) { - hasher.combine(srcNodeId) - hasher.combine(shortChannelId) - hasher.combine(feesBaseMsat) - hasher.combine(feesProportionalMillionths) - hasher.combine(cltvExpiryDelta) - hasher.combine(htlcMinimumMsat) - hasher.combine(htlcMaximumMsat) + hasher.combine(locale) + hasher.combine(spacing) + hasher.combine(symbol) } } -public struct FfiConverterTypeRouteHintHop: FfiConverterRustBuffer { - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RouteHintHop { +public struct FfiConverterTypeLocaleOverrides: FfiConverterRustBuffer { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> LocaleOverrides { return - try RouteHintHop( - srcNodeId: FfiConverterString.read(from: &buf), - shortChannelId: FfiConverterUInt64.read(from: &buf), - feesBaseMsat: FfiConverterUInt32.read(from: &buf), - feesProportionalMillionths: FfiConverterUInt32.read(from: &buf), - cltvExpiryDelta: FfiConverterUInt64.read(from: &buf), - htlcMinimumMsat: FfiConverterOptionUInt64.read(from: &buf), - htlcMaximumMsat: FfiConverterOptionUInt64.read(from: &buf) + try LocaleOverrides( + locale: FfiConverterString.read(from: &buf), + spacing: FfiConverterOptionUInt32.read(from: &buf), + symbol: FfiConverterTypeSymbol.read(from: &buf) ) } - public static func write(_ value: RouteHintHop, into buf: inout [UInt8]) { - FfiConverterString.write(value.srcNodeId, into: &buf) - FfiConverterUInt64.write(value.shortChannelId, into: &buf) - FfiConverterUInt32.write(value.feesBaseMsat, into: &buf) - FfiConverterUInt32.write(value.feesProportionalMillionths, into: &buf) - FfiConverterUInt64.write(value.cltvExpiryDelta, into: &buf) - FfiConverterOptionUInt64.write(value.htlcMinimumMsat, into: &buf) - FfiConverterOptionUInt64.write(value.htlcMaximumMsat, into: &buf) + public static func write(_ value: LocaleOverrides, into buf: inout [UInt8]) { + FfiConverterString.write(value.locale, into: &buf) + FfiConverterOptionUInt32.write(value.spacing, into: &buf) + FfiConverterTypeSymbol.write(value.symbol, into: &buf) } } -public func FfiConverterTypeRouteHintHop_lift(_ buf: RustBuffer) throws -> RouteHintHop { - return try FfiConverterTypeRouteHintHop.lift(buf) +public func FfiConverterTypeLocaleOverrides_lift(_ buf: RustBuffer) throws -> LocaleOverrides { + return try FfiConverterTypeLocaleOverrides.lift(buf) } -public func FfiConverterTypeRouteHintHop_lower(_ value: RouteHintHop) -> RustBuffer { - return FfiConverterTypeRouteHintHop.lower(value) +public func FfiConverterTypeLocaleOverrides_lower(_ value: LocaleOverrides) -> RustBuffer { + return FfiConverterTypeLocaleOverrides.lower(value) } -public struct SendPaymentResponse { - public var payment: Payment +public struct LocalizedName { + public var locale: String + public var name: String // Default memberwise initializers are never public by default, so we // declare one manually. - public init(payment: Payment) { - self.payment = payment + public init(locale: String, name: String) { + self.locale = locale + self.name = name + } +} + + + +extension LocalizedName: Equatable, Hashable { + public static func ==(lhs: LocalizedName, rhs: LocalizedName) -> Bool { + if lhs.locale != rhs.locale { + return false + } + if lhs.name != rhs.name { + return false + } + return true + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(locale) + hasher.combine(name) + } +} + + +public struct FfiConverterTypeLocalizedName: FfiConverterRustBuffer { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> LocalizedName { + return + try LocalizedName( + locale: FfiConverterString.read(from: &buf), + name: FfiConverterString.read(from: &buf) + ) + } + + public static func write(_ value: LocalizedName, into buf: inout [UInt8]) { + FfiConverterString.write(value.locale, into: &buf) + FfiConverterString.write(value.name, into: &buf) + } +} + + +public func FfiConverterTypeLocalizedName_lift(_ buf: RustBuffer) throws -> LocalizedName { + return try FfiConverterTypeLocalizedName.lift(buf) +} + +public func FfiConverterTypeLocalizedName_lower(_ value: LocalizedName) -> RustBuffer { + return FfiConverterTypeLocalizedName.lower(value) +} + + +public struct LogEntry { + public var line: String + public var level: String + + // Default memberwise initializers are never public by default, so we + // declare one manually. + public init(line: String, level: String) { + self.line = line + self.level = level + } +} + + + +extension LogEntry: Equatable, Hashable { + public static func ==(lhs: LogEntry, rhs: LogEntry) -> Bool { + if lhs.line != rhs.line { + return false + } + if lhs.level != rhs.level { + return false + } + return true + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(line) + hasher.combine(level) + } +} + + +public struct FfiConverterTypeLogEntry: FfiConverterRustBuffer { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> LogEntry { + return + try LogEntry( + line: FfiConverterString.read(from: &buf), + level: FfiConverterString.read(from: &buf) + ) + } + + public static func write(_ value: LogEntry, into buf: inout [UInt8]) { + FfiConverterString.write(value.line, into: &buf) + FfiConverterString.write(value.level, into: &buf) + } +} + + +public func FfiConverterTypeLogEntry_lift(_ buf: RustBuffer) throws -> LogEntry { + return try FfiConverterTypeLogEntry.lift(buf) +} + +public func FfiConverterTypeLogEntry_lower(_ value: LogEntry) -> RustBuffer { + return FfiConverterTypeLogEntry.lower(value) +} + + +public struct MessageSuccessActionData { + public var message: String + + // Default memberwise initializers are never public by default, so we + // declare one manually. + public init(message: String) { + self.message = message + } +} + + + +extension MessageSuccessActionData: Equatable, Hashable { + public static func ==(lhs: MessageSuccessActionData, rhs: MessageSuccessActionData) -> Bool { + if lhs.message != rhs.message { + return false + } + return true + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(message) + } +} + + +public struct FfiConverterTypeMessageSuccessActionData: FfiConverterRustBuffer { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> MessageSuccessActionData { + return + try MessageSuccessActionData( + message: FfiConverterString.read(from: &buf) + ) + } + + public static func write(_ value: MessageSuccessActionData, into buf: inout [UInt8]) { + FfiConverterString.write(value.message, into: &buf) + } +} + + +public func FfiConverterTypeMessageSuccessActionData_lift(_ buf: RustBuffer) throws -> MessageSuccessActionData { + return try FfiConverterTypeMessageSuccessActionData.lift(buf) +} + +public func FfiConverterTypeMessageSuccessActionData_lower(_ value: MessageSuccessActionData) -> RustBuffer { + return FfiConverterTypeMessageSuccessActionData.lower(value) +} + + +public struct PayOnchainRequest { + public var address: String + public var prepareRes: PreparePayOnchainResponse + + // Default memberwise initializers are never public by default, so we + // declare one manually. + public init(address: String, prepareRes: PreparePayOnchainResponse) { + self.address = address + self.prepareRes = prepareRes + } +} + + + +extension PayOnchainRequest: Equatable, Hashable { + public static func ==(lhs: PayOnchainRequest, rhs: PayOnchainRequest) -> Bool { + if lhs.address != rhs.address { + return false + } + if lhs.prepareRes != rhs.prepareRes { + return false + } + return true + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(address) + hasher.combine(prepareRes) + } +} + + +public struct FfiConverterTypePayOnchainRequest: FfiConverterRustBuffer { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PayOnchainRequest { + return + try PayOnchainRequest( + address: FfiConverterString.read(from: &buf), + prepareRes: FfiConverterTypePreparePayOnchainResponse.read(from: &buf) + ) + } + + public static func write(_ value: PayOnchainRequest, into buf: inout [UInt8]) { + FfiConverterString.write(value.address, into: &buf) + FfiConverterTypePreparePayOnchainResponse.write(value.prepareRes, into: &buf) + } +} + + +public func FfiConverterTypePayOnchainRequest_lift(_ buf: RustBuffer) throws -> PayOnchainRequest { + return try FfiConverterTypePayOnchainRequest.lift(buf) +} + +public func FfiConverterTypePayOnchainRequest_lower(_ value: PayOnchainRequest) -> RustBuffer { + return FfiConverterTypePayOnchainRequest.lower(value) +} + + +public struct Payment { + public var txId: String? + public var swapId: String? + public var timestamp: UInt32 + public var amountSat: UInt64 + public var feesSat: UInt64 + public var preimage: String? + public var bolt11: String? + public var refundTxId: String? + public var refundTxAmountSat: UInt64? + public var paymentType: PaymentType + public var status: PaymentState + + // Default memberwise initializers are never public by default, so we + // declare one manually. + public init(txId: String? = nil, swapId: String? = nil, timestamp: UInt32, amountSat: UInt64, feesSat: UInt64, preimage: String? = nil, bolt11: String? = nil, refundTxId: String? = nil, refundTxAmountSat: UInt64? = nil, paymentType: PaymentType, status: PaymentState) { + self.txId = txId + self.swapId = swapId + self.timestamp = timestamp + self.amountSat = amountSat + self.feesSat = feesSat + self.preimage = preimage + self.bolt11 = bolt11 + self.refundTxId = refundTxId + self.refundTxAmountSat = refundTxAmountSat + self.paymentType = paymentType + self.status = status + } +} + + + +extension Payment: Equatable, Hashable { + public static func ==(lhs: Payment, rhs: Payment) -> Bool { + if lhs.txId != rhs.txId { + return false + } + if lhs.swapId != rhs.swapId { + return false + } + if lhs.timestamp != rhs.timestamp { + return false + } + if lhs.amountSat != rhs.amountSat { + return false + } + if lhs.feesSat != rhs.feesSat { + return false + } + if lhs.preimage != rhs.preimage { + return false + } + if lhs.bolt11 != rhs.bolt11 { + return false + } + if lhs.refundTxId != rhs.refundTxId { + return false + } + if lhs.refundTxAmountSat != rhs.refundTxAmountSat { + return false + } + if lhs.paymentType != rhs.paymentType { + return false + } + if lhs.status != rhs.status { + return false + } + return true + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(txId) + hasher.combine(swapId) + hasher.combine(timestamp) + hasher.combine(amountSat) + hasher.combine(feesSat) + hasher.combine(preimage) + hasher.combine(bolt11) + hasher.combine(refundTxId) + hasher.combine(refundTxAmountSat) + hasher.combine(paymentType) + hasher.combine(status) + } +} + + +public struct FfiConverterTypePayment: FfiConverterRustBuffer { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Payment { + return + try Payment( + txId: FfiConverterOptionString.read(from: &buf), + swapId: FfiConverterOptionString.read(from: &buf), + timestamp: FfiConverterUInt32.read(from: &buf), + amountSat: FfiConverterUInt64.read(from: &buf), + feesSat: FfiConverterUInt64.read(from: &buf), + preimage: FfiConverterOptionString.read(from: &buf), + bolt11: FfiConverterOptionString.read(from: &buf), + refundTxId: FfiConverterOptionString.read(from: &buf), + refundTxAmountSat: FfiConverterOptionUInt64.read(from: &buf), + paymentType: FfiConverterTypePaymentType.read(from: &buf), + status: FfiConverterTypePaymentState.read(from: &buf) + ) + } + + public static func write(_ value: Payment, into buf: inout [UInt8]) { + FfiConverterOptionString.write(value.txId, into: &buf) + FfiConverterOptionString.write(value.swapId, into: &buf) + FfiConverterUInt32.write(value.timestamp, into: &buf) + FfiConverterUInt64.write(value.amountSat, into: &buf) + FfiConverterUInt64.write(value.feesSat, into: &buf) + FfiConverterOptionString.write(value.preimage, into: &buf) + FfiConverterOptionString.write(value.bolt11, into: &buf) + FfiConverterOptionString.write(value.refundTxId, into: &buf) + FfiConverterOptionUInt64.write(value.refundTxAmountSat, into: &buf) + FfiConverterTypePaymentType.write(value.paymentType, into: &buf) + FfiConverterTypePaymentState.write(value.status, into: &buf) + } +} + + +public func FfiConverterTypePayment_lift(_ buf: RustBuffer) throws -> Payment { + return try FfiConverterTypePayment.lift(buf) +} + +public func FfiConverterTypePayment_lower(_ value: Payment) -> RustBuffer { + return FfiConverterTypePayment.lower(value) +} + + +public struct PreparePayOnchainRequest { + public var receiverAmountSat: UInt64 + + // Default memberwise initializers are never public by default, so we + // declare one manually. + public init(receiverAmountSat: UInt64) { + self.receiverAmountSat = receiverAmountSat + } +} + + + +extension PreparePayOnchainRequest: Equatable, Hashable { + public static func ==(lhs: PreparePayOnchainRequest, rhs: PreparePayOnchainRequest) -> Bool { + if lhs.receiverAmountSat != rhs.receiverAmountSat { + return false + } + return true + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(receiverAmountSat) + } +} + + +public struct FfiConverterTypePreparePayOnchainRequest: FfiConverterRustBuffer { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PreparePayOnchainRequest { + return + try PreparePayOnchainRequest( + receiverAmountSat: FfiConverterUInt64.read(from: &buf) + ) + } + + public static func write(_ value: PreparePayOnchainRequest, into buf: inout [UInt8]) { + FfiConverterUInt64.write(value.receiverAmountSat, into: &buf) + } +} + + +public func FfiConverterTypePreparePayOnchainRequest_lift(_ buf: RustBuffer) throws -> PreparePayOnchainRequest { + return try FfiConverterTypePreparePayOnchainRequest.lift(buf) +} + +public func FfiConverterTypePreparePayOnchainRequest_lower(_ value: PreparePayOnchainRequest) -> RustBuffer { + return FfiConverterTypePreparePayOnchainRequest.lower(value) +} + + +public struct PreparePayOnchainResponse { + public var receiverAmountSat: UInt64 + public var feesSat: UInt64 + + // Default memberwise initializers are never public by default, so we + // declare one manually. + public init(receiverAmountSat: UInt64, feesSat: UInt64) { + self.receiverAmountSat = receiverAmountSat + self.feesSat = feesSat + } +} + + + +extension PreparePayOnchainResponse: Equatable, Hashable { + public static func ==(lhs: PreparePayOnchainResponse, rhs: PreparePayOnchainResponse) -> Bool { + if lhs.receiverAmountSat != rhs.receiverAmountSat { + return false + } + if lhs.feesSat != rhs.feesSat { + return false + } + return true + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(receiverAmountSat) + hasher.combine(feesSat) + } +} + + +public struct FfiConverterTypePreparePayOnchainResponse: FfiConverterRustBuffer { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PreparePayOnchainResponse { + return + try PreparePayOnchainResponse( + receiverAmountSat: FfiConverterUInt64.read(from: &buf), + feesSat: FfiConverterUInt64.read(from: &buf) + ) + } + + public static func write(_ value: PreparePayOnchainResponse, into buf: inout [UInt8]) { + FfiConverterUInt64.write(value.receiverAmountSat, into: &buf) + FfiConverterUInt64.write(value.feesSat, into: &buf) + } +} + + +public func FfiConverterTypePreparePayOnchainResponse_lift(_ buf: RustBuffer) throws -> PreparePayOnchainResponse { + return try FfiConverterTypePreparePayOnchainResponse.lift(buf) +} + +public func FfiConverterTypePreparePayOnchainResponse_lower(_ value: PreparePayOnchainResponse) -> RustBuffer { + return FfiConverterTypePreparePayOnchainResponse.lower(value) +} + + +public struct PrepareReceiveOnchainRequest { + public var payerAmountSat: UInt64 + + // Default memberwise initializers are never public by default, so we + // declare one manually. + public init(payerAmountSat: UInt64) { + self.payerAmountSat = payerAmountSat + } +} + + + +extension PrepareReceiveOnchainRequest: Equatable, Hashable { + public static func ==(lhs: PrepareReceiveOnchainRequest, rhs: PrepareReceiveOnchainRequest) -> Bool { + if lhs.payerAmountSat != rhs.payerAmountSat { + return false + } + return true + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(payerAmountSat) + } +} + + +public struct FfiConverterTypePrepareReceiveOnchainRequest: FfiConverterRustBuffer { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PrepareReceiveOnchainRequest { + return + try PrepareReceiveOnchainRequest( + payerAmountSat: FfiConverterUInt64.read(from: &buf) + ) + } + + public static func write(_ value: PrepareReceiveOnchainRequest, into buf: inout [UInt8]) { + FfiConverterUInt64.write(value.payerAmountSat, into: &buf) + } +} + + +public func FfiConverterTypePrepareReceiveOnchainRequest_lift(_ buf: RustBuffer) throws -> PrepareReceiveOnchainRequest { + return try FfiConverterTypePrepareReceiveOnchainRequest.lift(buf) +} + +public func FfiConverterTypePrepareReceiveOnchainRequest_lower(_ value: PrepareReceiveOnchainRequest) -> RustBuffer { + return FfiConverterTypePrepareReceiveOnchainRequest.lower(value) +} + + +public struct PrepareReceiveOnchainResponse { + public var payerAmountSat: UInt64 + public var feesSat: UInt64 + + // Default memberwise initializers are never public by default, so we + // declare one manually. + public init(payerAmountSat: UInt64, feesSat: UInt64) { + self.payerAmountSat = payerAmountSat + self.feesSat = feesSat + } +} + + + +extension PrepareReceiveOnchainResponse: Equatable, Hashable { + public static func ==(lhs: PrepareReceiveOnchainResponse, rhs: PrepareReceiveOnchainResponse) -> Bool { + if lhs.payerAmountSat != rhs.payerAmountSat { + return false + } + if lhs.feesSat != rhs.feesSat { + return false + } + return true + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(payerAmountSat) + hasher.combine(feesSat) + } +} + + +public struct FfiConverterTypePrepareReceiveOnchainResponse: FfiConverterRustBuffer { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PrepareReceiveOnchainResponse { + return + try PrepareReceiveOnchainResponse( + payerAmountSat: FfiConverterUInt64.read(from: &buf), + feesSat: FfiConverterUInt64.read(from: &buf) + ) + } + + public static func write(_ value: PrepareReceiveOnchainResponse, into buf: inout [UInt8]) { + FfiConverterUInt64.write(value.payerAmountSat, into: &buf) + FfiConverterUInt64.write(value.feesSat, into: &buf) + } +} + + +public func FfiConverterTypePrepareReceiveOnchainResponse_lift(_ buf: RustBuffer) throws -> PrepareReceiveOnchainResponse { + return try FfiConverterTypePrepareReceiveOnchainResponse.lift(buf) +} + +public func FfiConverterTypePrepareReceiveOnchainResponse_lower(_ value: PrepareReceiveOnchainResponse) -> RustBuffer { + return FfiConverterTypePrepareReceiveOnchainResponse.lower(value) +} + + +public struct PrepareReceiveRequest { + public var payerAmountSat: UInt64 + + // Default memberwise initializers are never public by default, so we + // declare one manually. + public init(payerAmountSat: UInt64) { + self.payerAmountSat = payerAmountSat + } +} + + + +extension PrepareReceiveRequest: Equatable, Hashable { + public static func ==(lhs: PrepareReceiveRequest, rhs: PrepareReceiveRequest) -> Bool { + if lhs.payerAmountSat != rhs.payerAmountSat { + return false + } + return true + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(payerAmountSat) + } +} + + +public struct FfiConverterTypePrepareReceiveRequest: FfiConverterRustBuffer { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PrepareReceiveRequest { + return + try PrepareReceiveRequest( + payerAmountSat: FfiConverterUInt64.read(from: &buf) + ) + } + + public static func write(_ value: PrepareReceiveRequest, into buf: inout [UInt8]) { + FfiConverterUInt64.write(value.payerAmountSat, into: &buf) + } +} + + +public func FfiConverterTypePrepareReceiveRequest_lift(_ buf: RustBuffer) throws -> PrepareReceiveRequest { + return try FfiConverterTypePrepareReceiveRequest.lift(buf) +} + +public func FfiConverterTypePrepareReceiveRequest_lower(_ value: PrepareReceiveRequest) -> RustBuffer { + return FfiConverterTypePrepareReceiveRequest.lower(value) +} + + +public struct PrepareReceiveResponse { + public var payerAmountSat: UInt64 + public var feesSat: UInt64 + + // Default memberwise initializers are never public by default, so we + // declare one manually. + public init(payerAmountSat: UInt64, feesSat: UInt64) { + self.payerAmountSat = payerAmountSat + self.feesSat = feesSat + } +} + + + +extension PrepareReceiveResponse: Equatable, Hashable { + public static func ==(lhs: PrepareReceiveResponse, rhs: PrepareReceiveResponse) -> Bool { + if lhs.payerAmountSat != rhs.payerAmountSat { + return false + } + if lhs.feesSat != rhs.feesSat { + return false + } + return true + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(payerAmountSat) + hasher.combine(feesSat) + } +} + + +public struct FfiConverterTypePrepareReceiveResponse: FfiConverterRustBuffer { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PrepareReceiveResponse { + return + try PrepareReceiveResponse( + payerAmountSat: FfiConverterUInt64.read(from: &buf), + feesSat: FfiConverterUInt64.read(from: &buf) + ) + } + + public static func write(_ value: PrepareReceiveResponse, into buf: inout [UInt8]) { + FfiConverterUInt64.write(value.payerAmountSat, into: &buf) + FfiConverterUInt64.write(value.feesSat, into: &buf) + } +} + + +public func FfiConverterTypePrepareReceiveResponse_lift(_ buf: RustBuffer) throws -> PrepareReceiveResponse { + return try FfiConverterTypePrepareReceiveResponse.lift(buf) +} + +public func FfiConverterTypePrepareReceiveResponse_lower(_ value: PrepareReceiveResponse) -> RustBuffer { + return FfiConverterTypePrepareReceiveResponse.lower(value) +} + + +public struct PrepareRefundRequest { + public var swapAddress: String + public var refundAddress: String + public var satPerVbyte: UInt32 + + // Default memberwise initializers are never public by default, so we + // declare one manually. + public init(swapAddress: String, refundAddress: String, satPerVbyte: UInt32) { + self.swapAddress = swapAddress + self.refundAddress = refundAddress + self.satPerVbyte = satPerVbyte + } +} + + + +extension PrepareRefundRequest: Equatable, Hashable { + public static func ==(lhs: PrepareRefundRequest, rhs: PrepareRefundRequest) -> Bool { + if lhs.swapAddress != rhs.swapAddress { + return false + } + if lhs.refundAddress != rhs.refundAddress { + return false + } + if lhs.satPerVbyte != rhs.satPerVbyte { + return false + } + return true + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(swapAddress) + hasher.combine(refundAddress) + hasher.combine(satPerVbyte) + } +} + + +public struct FfiConverterTypePrepareRefundRequest: FfiConverterRustBuffer { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PrepareRefundRequest { + return + try PrepareRefundRequest( + swapAddress: FfiConverterString.read(from: &buf), + refundAddress: FfiConverterString.read(from: &buf), + satPerVbyte: FfiConverterUInt32.read(from: &buf) + ) + } + + public static func write(_ value: PrepareRefundRequest, into buf: inout [UInt8]) { + FfiConverterString.write(value.swapAddress, into: &buf) + FfiConverterString.write(value.refundAddress, into: &buf) + FfiConverterUInt32.write(value.satPerVbyte, into: &buf) + } +} + + +public func FfiConverterTypePrepareRefundRequest_lift(_ buf: RustBuffer) throws -> PrepareRefundRequest { + return try FfiConverterTypePrepareRefundRequest.lift(buf) +} + +public func FfiConverterTypePrepareRefundRequest_lower(_ value: PrepareRefundRequest) -> RustBuffer { + return FfiConverterTypePrepareRefundRequest.lower(value) +} + + +public struct PrepareRefundResponse { + public var txVsize: UInt32 + public var txFeeSat: UInt64 + public var refundTxId: String? + + // Default memberwise initializers are never public by default, so we + // declare one manually. + public init(txVsize: UInt32, txFeeSat: UInt64, refundTxId: String? = nil) { + self.txVsize = txVsize + self.txFeeSat = txFeeSat + self.refundTxId = refundTxId + } +} + + + +extension PrepareRefundResponse: Equatable, Hashable { + public static func ==(lhs: PrepareRefundResponse, rhs: PrepareRefundResponse) -> Bool { + if lhs.txVsize != rhs.txVsize { + return false + } + if lhs.txFeeSat != rhs.txFeeSat { + return false + } + if lhs.refundTxId != rhs.refundTxId { + return false + } + return true + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(txVsize) + hasher.combine(txFeeSat) + hasher.combine(refundTxId) + } +} + + +public struct FfiConverterTypePrepareRefundResponse: FfiConverterRustBuffer { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PrepareRefundResponse { + return + try PrepareRefundResponse( + txVsize: FfiConverterUInt32.read(from: &buf), + txFeeSat: FfiConverterUInt64.read(from: &buf), + refundTxId: FfiConverterOptionString.read(from: &buf) + ) + } + + public static func write(_ value: PrepareRefundResponse, into buf: inout [UInt8]) { + FfiConverterUInt32.write(value.txVsize, into: &buf) + FfiConverterUInt64.write(value.txFeeSat, into: &buf) + FfiConverterOptionString.write(value.refundTxId, into: &buf) + } +} + + +public func FfiConverterTypePrepareRefundResponse_lift(_ buf: RustBuffer) throws -> PrepareRefundResponse { + return try FfiConverterTypePrepareRefundResponse.lift(buf) +} + +public func FfiConverterTypePrepareRefundResponse_lower(_ value: PrepareRefundResponse) -> RustBuffer { + return FfiConverterTypePrepareRefundResponse.lower(value) +} + + +public struct PrepareSendRequest { + public var invoice: String + + // Default memberwise initializers are never public by default, so we + // declare one manually. + public init(invoice: String) { + self.invoice = invoice + } +} + + + +extension PrepareSendRequest: Equatable, Hashable { + public static func ==(lhs: PrepareSendRequest, rhs: PrepareSendRequest) -> Bool { + if lhs.invoice != rhs.invoice { + return false + } + return true + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(invoice) + } +} + + +public struct FfiConverterTypePrepareSendRequest: FfiConverterRustBuffer { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PrepareSendRequest { + return + try PrepareSendRequest( + invoice: FfiConverterString.read(from: &buf) + ) + } + + public static func write(_ value: PrepareSendRequest, into buf: inout [UInt8]) { + FfiConverterString.write(value.invoice, into: &buf) + } +} + + +public func FfiConverterTypePrepareSendRequest_lift(_ buf: RustBuffer) throws -> PrepareSendRequest { + return try FfiConverterTypePrepareSendRequest.lift(buf) +} + +public func FfiConverterTypePrepareSendRequest_lower(_ value: PrepareSendRequest) -> RustBuffer { + return FfiConverterTypePrepareSendRequest.lower(value) +} + + +public struct PrepareSendResponse { + public var invoice: String + public var feesSat: UInt64 + + // Default memberwise initializers are never public by default, so we + // declare one manually. + public init(invoice: String, feesSat: UInt64) { + self.invoice = invoice + self.feesSat = feesSat + } +} + + + +extension PrepareSendResponse: Equatable, Hashable { + public static func ==(lhs: PrepareSendResponse, rhs: PrepareSendResponse) -> Bool { + if lhs.invoice != rhs.invoice { + return false + } + if lhs.feesSat != rhs.feesSat { + return false + } + return true + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(invoice) + hasher.combine(feesSat) + } +} + + +public struct FfiConverterTypePrepareSendResponse: FfiConverterRustBuffer { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PrepareSendResponse { + return + try PrepareSendResponse( + invoice: FfiConverterString.read(from: &buf), + feesSat: FfiConverterUInt64.read(from: &buf) + ) + } + + public static func write(_ value: PrepareSendResponse, into buf: inout [UInt8]) { + FfiConverterString.write(value.invoice, into: &buf) + FfiConverterUInt64.write(value.feesSat, into: &buf) + } +} + + +public func FfiConverterTypePrepareSendResponse_lift(_ buf: RustBuffer) throws -> PrepareSendResponse { + return try FfiConverterTypePrepareSendResponse.lift(buf) +} + +public func FfiConverterTypePrepareSendResponse_lower(_ value: PrepareSendResponse) -> RustBuffer { + return FfiConverterTypePrepareSendResponse.lower(value) +} + + +public struct Rate { + public var coin: String + public var value: Double + + // Default memberwise initializers are never public by default, so we + // declare one manually. + public init(coin: String, value: Double) { + self.coin = coin + self.value = value + } +} + + + +extension Rate: Equatable, Hashable { + public static func ==(lhs: Rate, rhs: Rate) -> Bool { + if lhs.coin != rhs.coin { + return false + } + if lhs.value != rhs.value { + return false + } + return true + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(coin) + hasher.combine(value) + } +} + + +public struct FfiConverterTypeRate: FfiConverterRustBuffer { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Rate { + return + try Rate( + coin: FfiConverterString.read(from: &buf), + value: FfiConverterDouble.read(from: &buf) + ) + } + + public static func write(_ value: Rate, into buf: inout [UInt8]) { + FfiConverterString.write(value.coin, into: &buf) + FfiConverterDouble.write(value.value, into: &buf) + } +} + + +public func FfiConverterTypeRate_lift(_ buf: RustBuffer) throws -> Rate { + return try FfiConverterTypeRate.lift(buf) +} + +public func FfiConverterTypeRate_lower(_ value: Rate) -> RustBuffer { + return FfiConverterTypeRate.lower(value) +} + + +public struct ReceiveOnchainResponse { + public var address: String + public var bip21: String + + // Default memberwise initializers are never public by default, so we + // declare one manually. + public init(address: String, bip21: String) { + self.address = address + self.bip21 = bip21 + } +} + + + +extension ReceiveOnchainResponse: Equatable, Hashable { + public static func ==(lhs: ReceiveOnchainResponse, rhs: ReceiveOnchainResponse) -> Bool { + if lhs.address != rhs.address { + return false + } + if lhs.bip21 != rhs.bip21 { + return false + } + return true + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(address) + hasher.combine(bip21) + } +} + + +public struct FfiConverterTypeReceiveOnchainResponse: FfiConverterRustBuffer { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ReceiveOnchainResponse { + return + try ReceiveOnchainResponse( + address: FfiConverterString.read(from: &buf), + bip21: FfiConverterString.read(from: &buf) + ) + } + + public static func write(_ value: ReceiveOnchainResponse, into buf: inout [UInt8]) { + FfiConverterString.write(value.address, into: &buf) + FfiConverterString.write(value.bip21, into: &buf) + } +} + + +public func FfiConverterTypeReceiveOnchainResponse_lift(_ buf: RustBuffer) throws -> ReceiveOnchainResponse { + return try FfiConverterTypeReceiveOnchainResponse.lift(buf) +} + +public func FfiConverterTypeReceiveOnchainResponse_lower(_ value: ReceiveOnchainResponse) -> RustBuffer { + return FfiConverterTypeReceiveOnchainResponse.lower(value) +} + + +public struct ReceivePaymentResponse { + public var id: String + public var invoice: String + + // Default memberwise initializers are never public by default, so we + // declare one manually. + public init(id: String, invoice: String) { + self.id = id + self.invoice = invoice + } +} + + + +extension ReceivePaymentResponse: Equatable, Hashable { + public static func ==(lhs: ReceivePaymentResponse, rhs: ReceivePaymentResponse) -> Bool { + if lhs.id != rhs.id { + return false + } + if lhs.invoice != rhs.invoice { + return false + } + return true + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(id) + hasher.combine(invoice) + } +} + + +public struct FfiConverterTypeReceivePaymentResponse: FfiConverterRustBuffer { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ReceivePaymentResponse { + return + try ReceivePaymentResponse( + id: FfiConverterString.read(from: &buf), + invoice: FfiConverterString.read(from: &buf) + ) + } + + public static func write(_ value: ReceivePaymentResponse, into buf: inout [UInt8]) { + FfiConverterString.write(value.id, into: &buf) + FfiConverterString.write(value.invoice, into: &buf) + } +} + + +public func FfiConverterTypeReceivePaymentResponse_lift(_ buf: RustBuffer) throws -> ReceivePaymentResponse { + return try FfiConverterTypeReceivePaymentResponse.lift(buf) +} + +public func FfiConverterTypeReceivePaymentResponse_lower(_ value: ReceivePaymentResponse) -> RustBuffer { + return FfiConverterTypeReceivePaymentResponse.lower(value) +} + + +public struct RefundRequest { + public var swapAddress: String + public var refundAddress: String + public var satPerVbyte: UInt32 + + // Default memberwise initializers are never public by default, so we + // declare one manually. + public init(swapAddress: String, refundAddress: String, satPerVbyte: UInt32) { + self.swapAddress = swapAddress + self.refundAddress = refundAddress + self.satPerVbyte = satPerVbyte + } +} + + + +extension RefundRequest: Equatable, Hashable { + public static func ==(lhs: RefundRequest, rhs: RefundRequest) -> Bool { + if lhs.swapAddress != rhs.swapAddress { + return false + } + if lhs.refundAddress != rhs.refundAddress { + return false + } + if lhs.satPerVbyte != rhs.satPerVbyte { + return false + } + return true + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(swapAddress) + hasher.combine(refundAddress) + hasher.combine(satPerVbyte) + } +} + + +public struct FfiConverterTypeRefundRequest: FfiConverterRustBuffer { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RefundRequest { + return + try RefundRequest( + swapAddress: FfiConverterString.read(from: &buf), + refundAddress: FfiConverterString.read(from: &buf), + satPerVbyte: FfiConverterUInt32.read(from: &buf) + ) + } + + public static func write(_ value: RefundRequest, into buf: inout [UInt8]) { + FfiConverterString.write(value.swapAddress, into: &buf) + FfiConverterString.write(value.refundAddress, into: &buf) + FfiConverterUInt32.write(value.satPerVbyte, into: &buf) + } +} + + +public func FfiConverterTypeRefundRequest_lift(_ buf: RustBuffer) throws -> RefundRequest { + return try FfiConverterTypeRefundRequest.lift(buf) +} + +public func FfiConverterTypeRefundRequest_lower(_ value: RefundRequest) -> RustBuffer { + return FfiConverterTypeRefundRequest.lower(value) +} + + +public struct RefundResponse { + public var refundTxId: String + + // Default memberwise initializers are never public by default, so we + // declare one manually. + public init(refundTxId: String) { + self.refundTxId = refundTxId + } +} + + + +extension RefundResponse: Equatable, Hashable { + public static func ==(lhs: RefundResponse, rhs: RefundResponse) -> Bool { + if lhs.refundTxId != rhs.refundTxId { + return false + } + return true + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(refundTxId) + } +} + + +public struct FfiConverterTypeRefundResponse: FfiConverterRustBuffer { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RefundResponse { + return + try RefundResponse( + refundTxId: FfiConverterString.read(from: &buf) + ) + } + + public static func write(_ value: RefundResponse, into buf: inout [UInt8]) { + FfiConverterString.write(value.refundTxId, into: &buf) + } +} + + +public func FfiConverterTypeRefundResponse_lift(_ buf: RustBuffer) throws -> RefundResponse { + return try FfiConverterTypeRefundResponse.lift(buf) +} + +public func FfiConverterTypeRefundResponse_lower(_ value: RefundResponse) -> RustBuffer { + return FfiConverterTypeRefundResponse.lower(value) +} + + +public struct RefundableSwap { + public var swapAddress: String + public var timestamp: UInt32 + public var amountSat: UInt64 + + // Default memberwise initializers are never public by default, so we + // declare one manually. + public init(swapAddress: String, timestamp: UInt32, amountSat: UInt64) { + self.swapAddress = swapAddress + self.timestamp = timestamp + self.amountSat = amountSat + } +} + + + +extension RefundableSwap: Equatable, Hashable { + public static func ==(lhs: RefundableSwap, rhs: RefundableSwap) -> Bool { + if lhs.swapAddress != rhs.swapAddress { + return false + } + if lhs.timestamp != rhs.timestamp { + return false + } + if lhs.amountSat != rhs.amountSat { + return false + } + return true + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(swapAddress) + hasher.combine(timestamp) + hasher.combine(amountSat) + } +} + + +public struct FfiConverterTypeRefundableSwap: FfiConverterRustBuffer { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RefundableSwap { + return + try RefundableSwap( + swapAddress: FfiConverterString.read(from: &buf), + timestamp: FfiConverterUInt32.read(from: &buf), + amountSat: FfiConverterUInt64.read(from: &buf) + ) + } + + public static func write(_ value: RefundableSwap, into buf: inout [UInt8]) { + FfiConverterString.write(value.swapAddress, into: &buf) + FfiConverterUInt32.write(value.timestamp, into: &buf) + FfiConverterUInt64.write(value.amountSat, into: &buf) + } +} + + +public func FfiConverterTypeRefundableSwap_lift(_ buf: RustBuffer) throws -> RefundableSwap { + return try FfiConverterTypeRefundableSwap.lift(buf) +} + +public func FfiConverterTypeRefundableSwap_lower(_ value: RefundableSwap) -> RustBuffer { + return FfiConverterTypeRefundableSwap.lower(value) +} + + +public struct RestoreRequest { + public var backupPath: String? + + // Default memberwise initializers are never public by default, so we + // declare one manually. + public init(backupPath: String? = nil) { + self.backupPath = backupPath + } +} + + + +extension RestoreRequest: Equatable, Hashable { + public static func ==(lhs: RestoreRequest, rhs: RestoreRequest) -> Bool { + if lhs.backupPath != rhs.backupPath { + return false + } + return true + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(backupPath) + } +} + + +public struct FfiConverterTypeRestoreRequest: FfiConverterRustBuffer { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RestoreRequest { + return + try RestoreRequest( + backupPath: FfiConverterOptionString.read(from: &buf) + ) + } + + public static func write(_ value: RestoreRequest, into buf: inout [UInt8]) { + FfiConverterOptionString.write(value.backupPath, into: &buf) + } +} + + +public func FfiConverterTypeRestoreRequest_lift(_ buf: RustBuffer) throws -> RestoreRequest { + return try FfiConverterTypeRestoreRequest.lift(buf) +} + +public func FfiConverterTypeRestoreRequest_lower(_ value: RestoreRequest) -> RustBuffer { + return FfiConverterTypeRestoreRequest.lower(value) +} + + +public struct RouteHint { + public var hops: [RouteHintHop] + + // Default memberwise initializers are never public by default, so we + // declare one manually. + public init(hops: [RouteHintHop]) { + self.hops = hops + } +} + + + +extension RouteHint: Equatable, Hashable { + public static func ==(lhs: RouteHint, rhs: RouteHint) -> Bool { + if lhs.hops != rhs.hops { + return false + } + return true + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(hops) + } +} + + +public struct FfiConverterTypeRouteHint: FfiConverterRustBuffer { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RouteHint { + return + try RouteHint( + hops: FfiConverterSequenceTypeRouteHintHop.read(from: &buf) + ) + } + + public static func write(_ value: RouteHint, into buf: inout [UInt8]) { + FfiConverterSequenceTypeRouteHintHop.write(value.hops, into: &buf) + } +} + + +public func FfiConverterTypeRouteHint_lift(_ buf: RustBuffer) throws -> RouteHint { + return try FfiConverterTypeRouteHint.lift(buf) +} + +public func FfiConverterTypeRouteHint_lower(_ value: RouteHint) -> RustBuffer { + return FfiConverterTypeRouteHint.lower(value) +} + + +public struct RouteHintHop { + public var srcNodeId: String + public var shortChannelId: UInt64 + public var feesBaseMsat: UInt32 + public var feesProportionalMillionths: UInt32 + public var cltvExpiryDelta: UInt64 + public var htlcMinimumMsat: UInt64? + public var htlcMaximumMsat: UInt64? + + // Default memberwise initializers are never public by default, so we + // declare one manually. + public init(srcNodeId: String, shortChannelId: UInt64, feesBaseMsat: UInt32, feesProportionalMillionths: UInt32, cltvExpiryDelta: UInt64, htlcMinimumMsat: UInt64?, htlcMaximumMsat: UInt64?) { + self.srcNodeId = srcNodeId + self.shortChannelId = shortChannelId + self.feesBaseMsat = feesBaseMsat + self.feesProportionalMillionths = feesProportionalMillionths + self.cltvExpiryDelta = cltvExpiryDelta + self.htlcMinimumMsat = htlcMinimumMsat + self.htlcMaximumMsat = htlcMaximumMsat + } +} + + + +extension RouteHintHop: Equatable, Hashable { + public static func ==(lhs: RouteHintHop, rhs: RouteHintHop) -> Bool { + if lhs.srcNodeId != rhs.srcNodeId { + return false + } + if lhs.shortChannelId != rhs.shortChannelId { + return false + } + if lhs.feesBaseMsat != rhs.feesBaseMsat { + return false + } + if lhs.feesProportionalMillionths != rhs.feesProportionalMillionths { + return false + } + if lhs.cltvExpiryDelta != rhs.cltvExpiryDelta { + return false + } + if lhs.htlcMinimumMsat != rhs.htlcMinimumMsat { + return false + } + if lhs.htlcMaximumMsat != rhs.htlcMaximumMsat { + return false + } + return true + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(srcNodeId) + hasher.combine(shortChannelId) + hasher.combine(feesBaseMsat) + hasher.combine(feesProportionalMillionths) + hasher.combine(cltvExpiryDelta) + hasher.combine(htlcMinimumMsat) + hasher.combine(htlcMaximumMsat) + } +} + + +public struct FfiConverterTypeRouteHintHop: FfiConverterRustBuffer { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RouteHintHop { + return + try RouteHintHop( + srcNodeId: FfiConverterString.read(from: &buf), + shortChannelId: FfiConverterUInt64.read(from: &buf), + feesBaseMsat: FfiConverterUInt32.read(from: &buf), + feesProportionalMillionths: FfiConverterUInt32.read(from: &buf), + cltvExpiryDelta: FfiConverterUInt64.read(from: &buf), + htlcMinimumMsat: FfiConverterOptionUInt64.read(from: &buf), + htlcMaximumMsat: FfiConverterOptionUInt64.read(from: &buf) + ) + } + + public static func write(_ value: RouteHintHop, into buf: inout [UInt8]) { + FfiConverterString.write(value.srcNodeId, into: &buf) + FfiConverterUInt64.write(value.shortChannelId, into: &buf) + FfiConverterUInt32.write(value.feesBaseMsat, into: &buf) + FfiConverterUInt32.write(value.feesProportionalMillionths, into: &buf) + FfiConverterUInt64.write(value.cltvExpiryDelta, into: &buf) + FfiConverterOptionUInt64.write(value.htlcMinimumMsat, into: &buf) + FfiConverterOptionUInt64.write(value.htlcMaximumMsat, into: &buf) + } +} + + +public func FfiConverterTypeRouteHintHop_lift(_ buf: RustBuffer) throws -> RouteHintHop { + return try FfiConverterTypeRouteHintHop.lift(buf) +} + +public func FfiConverterTypeRouteHintHop_lower(_ value: RouteHintHop) -> RustBuffer { + return FfiConverterTypeRouteHintHop.lower(value) +} + + +public struct SendPaymentResponse { + public var payment: Payment + + // Default memberwise initializers are never public by default, so we + // declare one manually. + public init(payment: Payment) { + self.payment = payment + } +} + + + +extension SendPaymentResponse: Equatable, Hashable { + public static func ==(lhs: SendPaymentResponse, rhs: SendPaymentResponse) -> Bool { + if lhs.payment != rhs.payment { + return false + } + return true + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(payment) + } +} + + +public struct FfiConverterTypeSendPaymentResponse: FfiConverterRustBuffer { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SendPaymentResponse { + return + try SendPaymentResponse( + payment: FfiConverterTypePayment.read(from: &buf) + ) + } + + public static func write(_ value: SendPaymentResponse, into buf: inout [UInt8]) { + FfiConverterTypePayment.write(value.payment, into: &buf) + } +} + + +public func FfiConverterTypeSendPaymentResponse_lift(_ buf: RustBuffer) throws -> SendPaymentResponse { + return try FfiConverterTypeSendPaymentResponse.lift(buf) +} + +public func FfiConverterTypeSendPaymentResponse_lower(_ value: SendPaymentResponse) -> RustBuffer { + return FfiConverterTypeSendPaymentResponse.lower(value) +} + + +public struct Symbol { + public var grapheme: String? + public var template: String? + public var rtl: Bool? + public var position: UInt32? + + // Default memberwise initializers are never public by default, so we + // declare one manually. + public init(grapheme: String?, template: String?, rtl: Bool?, position: UInt32?) { + self.grapheme = grapheme + self.template = template + self.rtl = rtl + self.position = position + } +} + + + +extension Symbol: Equatable, Hashable { + public static func ==(lhs: Symbol, rhs: Symbol) -> Bool { + if lhs.grapheme != rhs.grapheme { + return false + } + if lhs.template != rhs.template { + return false + } + if lhs.rtl != rhs.rtl { + return false + } + if lhs.position != rhs.position { + return false + } + return true + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(grapheme) + hasher.combine(template) + hasher.combine(rtl) + hasher.combine(position) + } +} + + +public struct FfiConverterTypeSymbol: FfiConverterRustBuffer { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Symbol { + return + try Symbol( + grapheme: FfiConverterOptionString.read(from: &buf), + template: FfiConverterOptionString.read(from: &buf), + rtl: FfiConverterOptionBool.read(from: &buf), + position: FfiConverterOptionUInt32.read(from: &buf) + ) + } + + public static func write(_ value: Symbol, into buf: inout [UInt8]) { + FfiConverterOptionString.write(value.grapheme, into: &buf) + FfiConverterOptionString.write(value.template, into: &buf) + FfiConverterOptionBool.write(value.rtl, into: &buf) + FfiConverterOptionUInt32.write(value.position, into: &buf) + } +} + + +public func FfiConverterTypeSymbol_lift(_ buf: RustBuffer) throws -> Symbol { + return try FfiConverterTypeSymbol.lift(buf) +} + +public func FfiConverterTypeSymbol_lower(_ value: Symbol) -> RustBuffer { + return FfiConverterTypeSymbol.lower(value) +} + + +public struct UrlSuccessActionData { + public var description: String + public var url: String + + // Default memberwise initializers are never public by default, so we + // declare one manually. + public init(description: String, url: String) { + self.description = description + self.url = url + } +} + + + +extension UrlSuccessActionData: Equatable, Hashable { + public static func ==(lhs: UrlSuccessActionData, rhs: UrlSuccessActionData) -> Bool { + if lhs.description != rhs.description { + return false + } + if lhs.url != rhs.url { + return false + } + return true + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(description) + hasher.combine(url) + } +} + + +public struct FfiConverterTypeUrlSuccessActionData: FfiConverterRustBuffer { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> UrlSuccessActionData { + return + try UrlSuccessActionData( + description: FfiConverterString.read(from: &buf), + url: FfiConverterString.read(from: &buf) + ) + } + + public static func write(_ value: UrlSuccessActionData, into buf: inout [UInt8]) { + FfiConverterString.write(value.description, into: &buf) + FfiConverterString.write(value.url, into: &buf) + } +} + + +public func FfiConverterTypeUrlSuccessActionData_lift(_ buf: RustBuffer) throws -> UrlSuccessActionData { + return try FfiConverterTypeUrlSuccessActionData.lift(buf) +} + +public func FfiConverterTypeUrlSuccessActionData_lower(_ value: UrlSuccessActionData) -> RustBuffer { + return FfiConverterTypeUrlSuccessActionData.lower(value) +} + +// Note that we don't yet support `indirect` for enums. +// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion. + +public enum AesSuccessActionDataResult { + + case decrypted(data: AesSuccessActionDataDecrypted + ) + case errorStatus(reason: String + ) +} + + +public struct FfiConverterTypeAesSuccessActionDataResult: FfiConverterRustBuffer { + typealias SwiftType = AesSuccessActionDataResult + + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AesSuccessActionDataResult { + let variant: Int32 = try readInt(&buf) + switch variant { + + case 1: return .decrypted(data: try FfiConverterTypeAesSuccessActionDataDecrypted.read(from: &buf) + ) + + case 2: return .errorStatus(reason: try FfiConverterString.read(from: &buf) + ) + + default: throw UniffiInternalError.unexpectedEnumCase + } + } + + public static func write(_ value: AesSuccessActionDataResult, into buf: inout [UInt8]) { + switch value { + + + case let .decrypted(data): + writeInt(&buf, Int32(1)) + FfiConverterTypeAesSuccessActionDataDecrypted.write(data, into: &buf) + + + case let .errorStatus(reason): + writeInt(&buf, Int32(2)) + FfiConverterString.write(reason, into: &buf) + + } + } +} + + +public func FfiConverterTypeAesSuccessActionDataResult_lift(_ buf: RustBuffer) throws -> AesSuccessActionDataResult { + return try FfiConverterTypeAesSuccessActionDataResult.lift(buf) +} + +public func FfiConverterTypeAesSuccessActionDataResult_lower(_ value: AesSuccessActionDataResult) -> RustBuffer { + return FfiConverterTypeAesSuccessActionDataResult.lower(value) +} + + + +extension AesSuccessActionDataResult: Equatable, Hashable {} + + + +// Note that we don't yet support `indirect` for enums. +// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion. + +public enum InputType { + + case bitcoinAddress(address: BitcoinAddressData + ) + case bolt11(invoice: LnInvoice + ) + case nodeId(nodeId: String + ) + case url(url: String + ) + case lnUrlPay(data: LnUrlPayRequestData + ) + case lnUrlWithdraw(data: LnUrlWithdrawRequestData + ) + case lnUrlAuth(data: LnUrlAuthRequestData + ) + case lnUrlError(data: LnUrlErrorData + ) +} + + +public struct FfiConverterTypeInputType: FfiConverterRustBuffer { + typealias SwiftType = InputType + + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> InputType { + let variant: Int32 = try readInt(&buf) + switch variant { + + case 1: return .bitcoinAddress(address: try FfiConverterTypeBitcoinAddressData.read(from: &buf) + ) + + case 2: return .bolt11(invoice: try FfiConverterTypeLNInvoice.read(from: &buf) + ) + + case 3: return .nodeId(nodeId: try FfiConverterString.read(from: &buf) + ) + + case 4: return .url(url: try FfiConverterString.read(from: &buf) + ) + + case 5: return .lnUrlPay(data: try FfiConverterTypeLnUrlPayRequestData.read(from: &buf) + ) + + case 6: return .lnUrlWithdraw(data: try FfiConverterTypeLnUrlWithdrawRequestData.read(from: &buf) + ) + + case 7: return .lnUrlAuth(data: try FfiConverterTypeLnUrlAuthRequestData.read(from: &buf) + ) + + case 8: return .lnUrlError(data: try FfiConverterTypeLnUrlErrorData.read(from: &buf) + ) + + default: throw UniffiInternalError.unexpectedEnumCase + } + } + + public static func write(_ value: InputType, into buf: inout [UInt8]) { + switch value { + + + case let .bitcoinAddress(address): + writeInt(&buf, Int32(1)) + FfiConverterTypeBitcoinAddressData.write(address, into: &buf) + + + case let .bolt11(invoice): + writeInt(&buf, Int32(2)) + FfiConverterTypeLNInvoice.write(invoice, into: &buf) + + + case let .nodeId(nodeId): + writeInt(&buf, Int32(3)) + FfiConverterString.write(nodeId, into: &buf) + + + case let .url(url): + writeInt(&buf, Int32(4)) + FfiConverterString.write(url, into: &buf) + + + case let .lnUrlPay(data): + writeInt(&buf, Int32(5)) + FfiConverterTypeLnUrlPayRequestData.write(data, into: &buf) + + + case let .lnUrlWithdraw(data): + writeInt(&buf, Int32(6)) + FfiConverterTypeLnUrlWithdrawRequestData.write(data, into: &buf) + + + case let .lnUrlAuth(data): + writeInt(&buf, Int32(7)) + FfiConverterTypeLnUrlAuthRequestData.write(data, into: &buf) + + + case let .lnUrlError(data): + writeInt(&buf, Int32(8)) + FfiConverterTypeLnUrlErrorData.write(data, into: &buf) + + } + } +} + + +public func FfiConverterTypeInputType_lift(_ buf: RustBuffer) throws -> InputType { + return try FfiConverterTypeInputType.lift(buf) +} + +public func FfiConverterTypeInputType_lower(_ value: InputType) -> RustBuffer { + return FfiConverterTypeInputType.lower(value) +} + + + +extension InputType: Equatable, Hashable {} + + + +// Note that we don't yet support `indirect` for enums. +// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion. + +public enum LiquidNetwork { + + case mainnet + case testnet +} + + +public struct FfiConverterTypeLiquidNetwork: FfiConverterRustBuffer { + typealias SwiftType = LiquidNetwork + + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> LiquidNetwork { + let variant: Int32 = try readInt(&buf) + switch variant { + + case 1: return .mainnet + + case 2: return .testnet + + default: throw UniffiInternalError.unexpectedEnumCase + } + } + + public static func write(_ value: LiquidNetwork, into buf: inout [UInt8]) { + switch value { + + + case .mainnet: + writeInt(&buf, Int32(1)) + + + case .testnet: + writeInt(&buf, Int32(2)) + + } + } +} + + +public func FfiConverterTypeLiquidNetwork_lift(_ buf: RustBuffer) throws -> LiquidNetwork { + return try FfiConverterTypeLiquidNetwork.lift(buf) +} + +public func FfiConverterTypeLiquidNetwork_lower(_ value: LiquidNetwork) -> RustBuffer { + return FfiConverterTypeLiquidNetwork.lower(value) +} + + + +extension LiquidNetwork: Equatable, Hashable {} + + + + +/** + * ///////////////////////////// + */ +public enum LiquidSdkError { + + + + case AlreadyStarted(message: String) + + case Generic(message: String) + + case NotStarted(message: String) + + case ServiceConnectivity(message: String) + +} + + +public struct FfiConverterTypeLiquidSdkError: FfiConverterRustBuffer { + typealias SwiftType = LiquidSdkError + + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> LiquidSdkError { + let variant: Int32 = try readInt(&buf) + switch variant { + + + + + case 1: return .AlreadyStarted( + message: try FfiConverterString.read(from: &buf) + ) + + case 2: return .Generic( + message: try FfiConverterString.read(from: &buf) + ) + + case 3: return .NotStarted( + message: try FfiConverterString.read(from: &buf) + ) + + case 4: return .ServiceConnectivity( + message: try FfiConverterString.read(from: &buf) + ) + + + default: throw UniffiInternalError.unexpectedEnumCase + } + } + + public static func write(_ value: LiquidSdkError, into buf: inout [UInt8]) { + switch value { + + + + + case .AlreadyStarted(_ /* message is ignored*/): + writeInt(&buf, Int32(1)) + case .Generic(_ /* message is ignored*/): + writeInt(&buf, Int32(2)) + case .NotStarted(_ /* message is ignored*/): + writeInt(&buf, Int32(3)) + case .ServiceConnectivity(_ /* message is ignored*/): + writeInt(&buf, Int32(4)) + + + } + } +} + + +extension LiquidSdkError: Equatable, Hashable {} + +extension LiquidSdkError: Error { } + +// Note that we don't yet support `indirect` for enums. +// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion. + +public enum LiquidSdkEvent { + + case paymentFailed(details: Payment + ) + case paymentPending(details: Payment + ) + case paymentRefunded(details: Payment + ) + case paymentRefundPending(details: Payment + ) + case paymentSucceeded(details: Payment + ) + case paymentWaitingConfirmation(details: Payment + ) + case synced +} + + +public struct FfiConverterTypeLiquidSdkEvent: FfiConverterRustBuffer { + typealias SwiftType = LiquidSdkEvent + + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> LiquidSdkEvent { + let variant: Int32 = try readInt(&buf) + switch variant { + + case 1: return .paymentFailed(details: try FfiConverterTypePayment.read(from: &buf) + ) + + case 2: return .paymentPending(details: try FfiConverterTypePayment.read(from: &buf) + ) + + case 3: return .paymentRefunded(details: try FfiConverterTypePayment.read(from: &buf) + ) + + case 4: return .paymentRefundPending(details: try FfiConverterTypePayment.read(from: &buf) + ) + + case 5: return .paymentSucceeded(details: try FfiConverterTypePayment.read(from: &buf) + ) + + case 6: return .paymentWaitingConfirmation(details: try FfiConverterTypePayment.read(from: &buf) + ) + + case 7: return .synced + + default: throw UniffiInternalError.unexpectedEnumCase + } + } + + public static func write(_ value: LiquidSdkEvent, into buf: inout [UInt8]) { + switch value { + + + case let .paymentFailed(details): + writeInt(&buf, Int32(1)) + FfiConverterTypePayment.write(details, into: &buf) + + + case let .paymentPending(details): + writeInt(&buf, Int32(2)) + FfiConverterTypePayment.write(details, into: &buf) + + + case let .paymentRefunded(details): + writeInt(&buf, Int32(3)) + FfiConverterTypePayment.write(details, into: &buf) + + + case let .paymentRefundPending(details): + writeInt(&buf, Int32(4)) + FfiConverterTypePayment.write(details, into: &buf) + + + case let .paymentSucceeded(details): + writeInt(&buf, Int32(5)) + FfiConverterTypePayment.write(details, into: &buf) + + + case let .paymentWaitingConfirmation(details): + writeInt(&buf, Int32(6)) + FfiConverterTypePayment.write(details, into: &buf) + + + case .synced: + writeInt(&buf, Int32(7)) + + } + } +} + + +public func FfiConverterTypeLiquidSdkEvent_lift(_ buf: RustBuffer) throws -> LiquidSdkEvent { + return try FfiConverterTypeLiquidSdkEvent.lift(buf) +} + +public func FfiConverterTypeLiquidSdkEvent_lower(_ value: LiquidSdkEvent) -> RustBuffer { + return FfiConverterTypeLiquidSdkEvent.lower(value) +} + + + +extension LiquidSdkEvent: Equatable, Hashable {} + + + + +public enum LnUrlAuthError { + + + + case Generic(err: String + ) + case InvalidUri(err: String + ) + case ServiceConnectivity(err: String + ) +} + + +public struct FfiConverterTypeLnUrlAuthError: FfiConverterRustBuffer { + typealias SwiftType = LnUrlAuthError + + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> LnUrlAuthError { + let variant: Int32 = try readInt(&buf) + switch variant { + + + + + case 1: return .Generic( + err: try FfiConverterString.read(from: &buf) + ) + case 2: return .InvalidUri( + err: try FfiConverterString.read(from: &buf) + ) + case 3: return .ServiceConnectivity( + err: try FfiConverterString.read(from: &buf) + ) + + default: throw UniffiInternalError.unexpectedEnumCase + } + } + + public static func write(_ value: LnUrlAuthError, into buf: inout [UInt8]) { + switch value { + + + + + + case let .Generic(err): + writeInt(&buf, Int32(1)) + FfiConverterString.write(err, into: &buf) + + + case let .InvalidUri(err): + writeInt(&buf, Int32(2)) + FfiConverterString.write(err, into: &buf) + + + case let .ServiceConnectivity(err): + writeInt(&buf, Int32(3)) + FfiConverterString.write(err, into: &buf) + + } } } +extension LnUrlAuthError: Equatable, Hashable {} -extension SendPaymentResponse: Equatable, Hashable { - public static func ==(lhs: SendPaymentResponse, rhs: SendPaymentResponse) -> Bool { - if lhs.payment != rhs.payment { - return false - } - return true - } +extension LnUrlAuthError: Error { } - public func hash(into hasher: inout Hasher) { - hasher.combine(payment) - } +// Note that we don't yet support `indirect` for enums. +// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion. + +public enum LnUrlCallbackStatus { + + case ok + case errorStatus(data: LnUrlErrorData + ) } -public struct FfiConverterTypeSendPaymentResponse: FfiConverterRustBuffer { - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SendPaymentResponse { - return - try SendPaymentResponse( - payment: FfiConverterTypePayment.read(from: &buf) +public struct FfiConverterTypeLnUrlCallbackStatus: FfiConverterRustBuffer { + typealias SwiftType = LnUrlCallbackStatus + + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> LnUrlCallbackStatus { + let variant: Int32 = try readInt(&buf) + switch variant { + + case 1: return .ok + + case 2: return .errorStatus(data: try FfiConverterTypeLnUrlErrorData.read(from: &buf) ) + + default: throw UniffiInternalError.unexpectedEnumCase + } } - public static func write(_ value: SendPaymentResponse, into buf: inout [UInt8]) { - FfiConverterTypePayment.write(value.payment, into: &buf) + public static func write(_ value: LnUrlCallbackStatus, into buf: inout [UInt8]) { + switch value { + + + case .ok: + writeInt(&buf, Int32(1)) + + + case let .errorStatus(data): + writeInt(&buf, Int32(2)) + FfiConverterTypeLnUrlErrorData.write(data, into: &buf) + + } } } -public func FfiConverterTypeSendPaymentResponse_lift(_ buf: RustBuffer) throws -> SendPaymentResponse { - return try FfiConverterTypeSendPaymentResponse.lift(buf) +public func FfiConverterTypeLnUrlCallbackStatus_lift(_ buf: RustBuffer) throws -> LnUrlCallbackStatus { + return try FfiConverterTypeLnUrlCallbackStatus.lift(buf) } -public func FfiConverterTypeSendPaymentResponse_lower(_ value: SendPaymentResponse) -> RustBuffer { - return FfiConverterTypeSendPaymentResponse.lower(value) +public func FfiConverterTypeLnUrlCallbackStatus_lower(_ value: LnUrlCallbackStatus) -> RustBuffer { + return FfiConverterTypeLnUrlCallbackStatus.lower(value) } -public enum LiquidSdkError { + +extension LnUrlCallbackStatus: Equatable, Hashable {} + + + + +public enum LnUrlPayError { - case AlreadyStarted(message: String) - - case Generic(message: String) - - case NotStarted(message: String) - + case AlreadyPaid + case Generic(err: String + ) + case InvalidAmount(err: String + ) + case InvalidInvoice(err: String + ) + case InvalidNetwork(err: String + ) + case InvalidUri(err: String + ) + case InvoiceExpired(err: String + ) + case PaymentFailed(err: String + ) + case PaymentTimeout(err: String + ) + case RouteNotFound(err: String + ) + case RouteTooExpensive(err: String + ) + case ServiceConnectivity(err: String + ) } -public struct FfiConverterTypeLiquidSdkError: FfiConverterRustBuffer { - typealias SwiftType = LiquidSdkError +public struct FfiConverterTypeLnUrlPayError: FfiConverterRustBuffer { + typealias SwiftType = LnUrlPayError - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> LiquidSdkError { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> LnUrlPayError { let variant: Int32 = try readInt(&buf) switch variant { - case 1: return .AlreadyStarted( - message: try FfiConverterString.read(from: &buf) - ) - + case 1: return .AlreadyPaid case 2: return .Generic( - message: try FfiConverterString.read(from: &buf) - ) - - case 3: return .NotStarted( - message: try FfiConverterString.read(from: &buf) - ) - + err: try FfiConverterString.read(from: &buf) + ) + case 3: return .InvalidAmount( + err: try FfiConverterString.read(from: &buf) + ) + case 4: return .InvalidInvoice( + err: try FfiConverterString.read(from: &buf) + ) + case 5: return .InvalidNetwork( + err: try FfiConverterString.read(from: &buf) + ) + case 6: return .InvalidUri( + err: try FfiConverterString.read(from: &buf) + ) + case 7: return .InvoiceExpired( + err: try FfiConverterString.read(from: &buf) + ) + case 8: return .PaymentFailed( + err: try FfiConverterString.read(from: &buf) + ) + case 9: return .PaymentTimeout( + err: try FfiConverterString.read(from: &buf) + ) + case 10: return .RouteNotFound( + err: try FfiConverterString.read(from: &buf) + ) + case 11: return .RouteTooExpensive( + err: try FfiConverterString.read(from: &buf) + ) + case 12: return .ServiceConnectivity( + err: try FfiConverterString.read(from: &buf) + ) - default: throw UniffiInternalError.unexpectedEnumCase + default: throw UniffiInternalError.unexpectedEnumCase } } - public static func write(_ value: LiquidSdkError, into buf: inout [UInt8]) { + public static func write(_ value: LnUrlPayError, into buf: inout [UInt8]) { switch value { - case .AlreadyStarted(_ /* message is ignored*/): + + case .AlreadyPaid: writeInt(&buf, Int32(1)) - case .Generic(_ /* message is ignored*/): + + + case let .Generic(err): writeInt(&buf, Int32(2)) - case .NotStarted(_ /* message is ignored*/): + FfiConverterString.write(err, into: &buf) + + + case let .InvalidAmount(err): writeInt(&buf, Int32(3)) - + FfiConverterString.write(err, into: &buf) + + + case let .InvalidInvoice(err): + writeInt(&buf, Int32(4)) + FfiConverterString.write(err, into: &buf) + + + case let .InvalidNetwork(err): + writeInt(&buf, Int32(5)) + FfiConverterString.write(err, into: &buf) + + + case let .InvalidUri(err): + writeInt(&buf, Int32(6)) + FfiConverterString.write(err, into: &buf) + + + case let .InvoiceExpired(err): + writeInt(&buf, Int32(7)) + FfiConverterString.write(err, into: &buf) + + + case let .PaymentFailed(err): + writeInt(&buf, Int32(8)) + FfiConverterString.write(err, into: &buf) + + + case let .PaymentTimeout(err): + writeInt(&buf, Int32(9)) + FfiConverterString.write(err, into: &buf) + + + case let .RouteNotFound(err): + writeInt(&buf, Int32(10)) + FfiConverterString.write(err, into: &buf) + + + case let .RouteTooExpensive(err): + writeInt(&buf, Int32(11)) + FfiConverterString.write(err, into: &buf) + + case let .ServiceConnectivity(err): + writeInt(&buf, Int32(12)) + FfiConverterString.write(err, into: &buf) + } } } -extension LiquidSdkError: Equatable, Hashable {} +extension LnUrlPayError: Equatable, Hashable {} -extension LiquidSdkError: Error { } +extension LnUrlPayError: Error { } // Note that we don't yet support `indirect` for enums. // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion. +/** + * ///////////////////////////// + * /////////////////////////////// + */ -public enum LiquidSdkEvent { +public enum LnUrlPayResult { - case paymentFailed(details: Payment - ) - case paymentPending(details: Payment + case endpointSuccess(data: LnUrlPaySuccessData ) - case paymentRefunded(details: Payment - ) - case paymentRefundPending(details: Payment - ) - case paymentSucceeded(details: Payment + case endpointError(data: LnUrlErrorData ) - case paymentWaitingConfirmation(details: Payment + case payError(data: LnUrlPayErrorData ) - case synced } -public struct FfiConverterTypeLiquidSdkEvent: FfiConverterRustBuffer { - typealias SwiftType = LiquidSdkEvent +public struct FfiConverterTypeLnUrlPayResult: FfiConverterRustBuffer { + typealias SwiftType = LnUrlPayResult - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> LiquidSdkEvent { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> LnUrlPayResult { let variant: Int32 = try readInt(&buf) switch variant { - case 1: return .paymentFailed(details: try FfiConverterTypePayment.read(from: &buf) + case 1: return .endpointSuccess(data: try FfiConverterTypeLnUrlPaySuccessData.read(from: &buf) ) - case 2: return .paymentPending(details: try FfiConverterTypePayment.read(from: &buf) + case 2: return .endpointError(data: try FfiConverterTypeLnUrlErrorData.read(from: &buf) ) - case 3: return .paymentRefunded(details: try FfiConverterTypePayment.read(from: &buf) + case 3: return .payError(data: try FfiConverterTypeLnUrlPayErrorData.read(from: &buf) ) - case 4: return .paymentRefundPending(details: try FfiConverterTypePayment.read(from: &buf) - ) + default: throw UniffiInternalError.unexpectedEnumCase + } + } + + public static func write(_ value: LnUrlPayResult, into buf: inout [UInt8]) { + switch value { - case 5: return .paymentSucceeded(details: try FfiConverterTypePayment.read(from: &buf) - ) - case 6: return .paymentWaitingConfirmation(details: try FfiConverterTypePayment.read(from: &buf) - ) + case let .endpointSuccess(data): + writeInt(&buf, Int32(1)) + FfiConverterTypeLnUrlPaySuccessData.write(data, into: &buf) + - case 7: return .synced + case let .endpointError(data): + writeInt(&buf, Int32(2)) + FfiConverterTypeLnUrlErrorData.write(data, into: &buf) + - default: throw UniffiInternalError.unexpectedEnumCase + case let .payError(data): + writeInt(&buf, Int32(3)) + FfiConverterTypeLnUrlPayErrorData.write(data, into: &buf) + } } +} - public static func write(_ value: LiquidSdkEvent, into buf: inout [UInt8]) { + +public func FfiConverterTypeLnUrlPayResult_lift(_ buf: RustBuffer) throws -> LnUrlPayResult { + return try FfiConverterTypeLnUrlPayResult.lift(buf) +} + +public func FfiConverterTypeLnUrlPayResult_lower(_ value: LnUrlPayResult) -> RustBuffer { + return FfiConverterTypeLnUrlPayResult.lower(value) +} + + + +extension LnUrlPayResult: Equatable, Hashable {} + + + + +public enum LnUrlWithdrawError { + + + + case Generic(err: String + ) + case InvalidAmount(err: String + ) + case InvalidInvoice(err: String + ) + case InvalidUri(err: String + ) + case ServiceConnectivity(err: String + ) + case InvoiceNoRoutingHints(err: String + ) +} + + +public struct FfiConverterTypeLnUrlWithdrawError: FfiConverterRustBuffer { + typealias SwiftType = LnUrlWithdrawError + + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> LnUrlWithdrawError { + let variant: Int32 = try readInt(&buf) + switch variant { + + + + + case 1: return .Generic( + err: try FfiConverterString.read(from: &buf) + ) + case 2: return .InvalidAmount( + err: try FfiConverterString.read(from: &buf) + ) + case 3: return .InvalidInvoice( + err: try FfiConverterString.read(from: &buf) + ) + case 4: return .InvalidUri( + err: try FfiConverterString.read(from: &buf) + ) + case 5: return .ServiceConnectivity( + err: try FfiConverterString.read(from: &buf) + ) + case 6: return .InvoiceNoRoutingHints( + err: try FfiConverterString.read(from: &buf) + ) + + default: throw UniffiInternalError.unexpectedEnumCase + } + } + + public static func write(_ value: LnUrlWithdrawError, into buf: inout [UInt8]) { switch value { + + + - case let .paymentFailed(details): + case let .Generic(err): writeInt(&buf, Int32(1)) - FfiConverterTypePayment.write(details, into: &buf) + FfiConverterString.write(err, into: &buf) - case let .paymentPending(details): + case let .InvalidAmount(err): writeInt(&buf, Int32(2)) - FfiConverterTypePayment.write(details, into: &buf) + FfiConverterString.write(err, into: &buf) - case let .paymentRefunded(details): + case let .InvalidInvoice(err): writeInt(&buf, Int32(3)) - FfiConverterTypePayment.write(details, into: &buf) + FfiConverterString.write(err, into: &buf) - case let .paymentRefundPending(details): + case let .InvalidUri(err): writeInt(&buf, Int32(4)) - FfiConverterTypePayment.write(details, into: &buf) + FfiConverterString.write(err, into: &buf) - case let .paymentSucceeded(details): + case let .ServiceConnectivity(err): writeInt(&buf, Int32(5)) - FfiConverterTypePayment.write(details, into: &buf) + FfiConverterString.write(err, into: &buf) + + + case let .InvoiceNoRoutingHints(err): + writeInt(&buf, Int32(6)) + FfiConverterString.write(err, into: &buf) + } + } +} + + +extension LnUrlWithdrawError: Equatable, Hashable {} + +extension LnUrlWithdrawError: Error { } + +// Note that we don't yet support `indirect` for enums. +// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion. + +public enum LnUrlWithdrawResult { + + case ok(data: LnUrlWithdrawSuccessData + ) + case errorStatus(data: LnUrlErrorData + ) +} + + +public struct FfiConverterTypeLnUrlWithdrawResult: FfiConverterRustBuffer { + typealias SwiftType = LnUrlWithdrawResult + + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> LnUrlWithdrawResult { + let variant: Int32 = try readInt(&buf) + switch variant { + + case 1: return .ok(data: try FfiConverterTypeLnUrlWithdrawSuccessData.read(from: &buf) + ) + + case 2: return .errorStatus(data: try FfiConverterTypeLnUrlErrorData.read(from: &buf) + ) + + default: throw UniffiInternalError.unexpectedEnumCase + } + } + + public static func write(_ value: LnUrlWithdrawResult, into buf: inout [UInt8]) { + switch value { + - case let .paymentWaitingConfirmation(details): - writeInt(&buf, Int32(6)) - FfiConverterTypePayment.write(details, into: &buf) + case let .ok(data): + writeInt(&buf, Int32(1)) + FfiConverterTypeLnUrlWithdrawSuccessData.write(data, into: &buf) - case .synced: - writeInt(&buf, Int32(7)) - + case let .errorStatus(data): + writeInt(&buf, Int32(2)) + FfiConverterTypeLnUrlErrorData.write(data, into: &buf) + } } } -public func FfiConverterTypeLiquidSdkEvent_lift(_ buf: RustBuffer) throws -> LiquidSdkEvent { - return try FfiConverterTypeLiquidSdkEvent.lift(buf) +public func FfiConverterTypeLnUrlWithdrawResult_lift(_ buf: RustBuffer) throws -> LnUrlWithdrawResult { + return try FfiConverterTypeLnUrlWithdrawResult.lift(buf) } -public func FfiConverterTypeLiquidSdkEvent_lower(_ value: LiquidSdkEvent) -> RustBuffer { - return FfiConverterTypeLiquidSdkEvent.lower(value) +public func FfiConverterTypeLnUrlWithdrawResult_lower(_ value: LnUrlWithdrawResult) -> RustBuffer { + return FfiConverterTypeLnUrlWithdrawResult.lower(value) } -extension LiquidSdkEvent: Equatable, Hashable {} +extension LnUrlWithdrawResult: Equatable, Hashable {} @@ -1956,8 +4803,10 @@ extension LiquidSdkEvent: Equatable, Hashable {} public enum Network { - case mainnet + case bitcoin case testnet + case signet + case regtest } @@ -1968,10 +4817,14 @@ public struct FfiConverterTypeNetwork: FfiConverterRustBuffer { let variant: Int32 = try readInt(&buf) switch variant { - case 1: return .mainnet + case 1: return .bitcoin case 2: return .testnet + case 3: return .signet + + case 4: return .regtest + default: throw UniffiInternalError.unexpectedEnumCase } } @@ -1980,13 +4833,21 @@ public struct FfiConverterTypeNetwork: FfiConverterRustBuffer { switch value { - case .mainnet: + case .bitcoin: writeInt(&buf, Int32(1)) case .testnet: writeInt(&buf, Int32(2)) + + case .signet: + writeInt(&buf, Int32(3)) + + + case .regtest: + writeInt(&buf, Int32(4)) + } } } @@ -2200,6 +5061,8 @@ public enum PaymentState { case complete case failed case timedOut + case refundable + case refundPending } @@ -2220,6 +5083,10 @@ public struct FfiConverterTypePaymentState: FfiConverterRustBuffer { case 5: return .timedOut + case 6: return .refundable + + case 7: return .refundPending + default: throw UniffiInternalError.unexpectedEnumCase } } @@ -2247,6 +5114,14 @@ public struct FfiConverterTypePaymentState: FfiConverterRustBuffer { case .timedOut: writeInt(&buf, Int32(5)) + + case .refundable: + writeInt(&buf, Int32(6)) + + + case .refundPending: + writeInt(&buf, Int32(7)) + } } } @@ -2321,6 +5196,77 @@ extension PaymentType: Equatable, Hashable {} +// Note that we don't yet support `indirect` for enums. +// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion. + +public enum SuccessActionProcessed { + + case aes(result: AesSuccessActionDataResult + ) + case message(data: MessageSuccessActionData + ) + case url(data: UrlSuccessActionData + ) +} + + +public struct FfiConverterTypeSuccessActionProcessed: FfiConverterRustBuffer { + typealias SwiftType = SuccessActionProcessed + + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SuccessActionProcessed { + let variant: Int32 = try readInt(&buf) + switch variant { + + case 1: return .aes(result: try FfiConverterTypeAesSuccessActionDataResult.read(from: &buf) + ) + + case 2: return .message(data: try FfiConverterTypeMessageSuccessActionData.read(from: &buf) + ) + + case 3: return .url(data: try FfiConverterTypeUrlSuccessActionData.read(from: &buf) + ) + + default: throw UniffiInternalError.unexpectedEnumCase + } + } + + public static func write(_ value: SuccessActionProcessed, into buf: inout [UInt8]) { + switch value { + + + case let .aes(result): + writeInt(&buf, Int32(1)) + FfiConverterTypeAesSuccessActionDataResult.write(result, into: &buf) + + + case let .message(data): + writeInt(&buf, Int32(2)) + FfiConverterTypeMessageSuccessActionData.write(data, into: &buf) + + + case let .url(data): + writeInt(&buf, Int32(3)) + FfiConverterTypeUrlSuccessActionData.write(data, into: &buf) + + } + } +} + + +public func FfiConverterTypeSuccessActionProcessed_lift(_ buf: RustBuffer) throws -> SuccessActionProcessed { + return try FfiConverterTypeSuccessActionProcessed.lift(buf) +} + +public func FfiConverterTypeSuccessActionProcessed_lower(_ value: SuccessActionProcessed) -> RustBuffer { + return FfiConverterTypeSuccessActionProcessed.lower(value) +} + + + +extension SuccessActionProcessed: Equatable, Hashable {} + + + @@ -2489,6 +5435,27 @@ extension FfiConverterCallbackInterfaceLogger : FfiConverter { } } +fileprivate struct FfiConverterOptionUInt32: FfiConverterRustBuffer { + typealias SwiftType = UInt32? + + public static func write(_ value: SwiftType, into buf: inout [UInt8]) { + guard let value = value else { + writeInt(&buf, Int8(0)) + return + } + writeInt(&buf, Int8(1)) + FfiConverterUInt32.write(value, into: &buf) + } + + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType { + switch try readInt(&buf) as Int8 { + case 0: return nil + case 1: return try FfiConverterUInt32.read(from: &buf) + default: throw UniffiInternalError.unexpectedOptionalTag + } + } +} + fileprivate struct FfiConverterOptionUInt64: FfiConverterRustBuffer { typealias SwiftType = UInt64? @@ -2510,6 +5477,27 @@ fileprivate struct FfiConverterOptionUInt64: FfiConverterRustBuffer { } } +fileprivate struct FfiConverterOptionBool: FfiConverterRustBuffer { + typealias SwiftType = Bool? + + public static func write(_ value: SwiftType, into buf: inout [UInt8]) { + guard let value = value else { + writeInt(&buf, Int8(0)) + return + } + writeInt(&buf, Int8(1)) + FfiConverterBool.write(value, into: &buf) + } + + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType { + switch try readInt(&buf) as Int8 { + case 0: return nil + case 1: return try FfiConverterBool.read(from: &buf) + default: throw UniffiInternalError.unexpectedOptionalTag + } + } +} + fileprivate struct FfiConverterOptionString: FfiConverterRustBuffer { typealias SwiftType = String? @@ -2531,6 +5519,48 @@ fileprivate struct FfiConverterOptionString: FfiConverterRustBuffer { } } +fileprivate struct FfiConverterOptionTypeSymbol: FfiConverterRustBuffer { + typealias SwiftType = Symbol? + + public static func write(_ value: SwiftType, into buf: inout [UInt8]) { + guard let value = value else { + writeInt(&buf, Int8(0)) + return + } + writeInt(&buf, Int8(1)) + FfiConverterTypeSymbol.write(value, into: &buf) + } + + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType { + switch try readInt(&buf) as Int8 { + case 0: return nil + case 1: return try FfiConverterTypeSymbol.read(from: &buf) + default: throw UniffiInternalError.unexpectedOptionalTag + } + } +} + +fileprivate struct FfiConverterOptionTypeSuccessActionProcessed: FfiConverterRustBuffer { + typealias SwiftType = SuccessActionProcessed? + + public static func write(_ value: SwiftType, into buf: inout [UInt8]) { + guard let value = value else { + writeInt(&buf, Int8(0)) + return + } + writeInt(&buf, Int8(1)) + FfiConverterTypeSuccessActionProcessed.write(value, into: &buf) + } + + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType { + switch try readInt(&buf) as Int8 { + case 0: return nil + case 1: return try FfiConverterTypeSuccessActionProcessed.read(from: &buf) + default: throw UniffiInternalError.unexpectedOptionalTag + } + } +} + fileprivate struct FfiConverterSequenceUInt8: FfiConverterRustBuffer { typealias SwiftType = [UInt8] @@ -2553,6 +5583,72 @@ fileprivate struct FfiConverterSequenceUInt8: FfiConverterRustBuffer { } } +fileprivate struct FfiConverterSequenceTypeFiatCurrency: FfiConverterRustBuffer { + typealias SwiftType = [FiatCurrency] + + public static func write(_ value: [FiatCurrency], into buf: inout [UInt8]) { + let len = Int32(value.count) + writeInt(&buf, len) + for item in value { + FfiConverterTypeFiatCurrency.write(item, into: &buf) + } + } + + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [FiatCurrency] { + let len: Int32 = try readInt(&buf) + var seq = [FiatCurrency]() + seq.reserveCapacity(Int(len)) + for _ in 0 ..< len { + seq.append(try FfiConverterTypeFiatCurrency.read(from: &buf)) + } + return seq + } +} + +fileprivate struct FfiConverterSequenceTypeLocaleOverrides: FfiConverterRustBuffer { + typealias SwiftType = [LocaleOverrides] + + public static func write(_ value: [LocaleOverrides], into buf: inout [UInt8]) { + let len = Int32(value.count) + writeInt(&buf, len) + for item in value { + FfiConverterTypeLocaleOverrides.write(item, into: &buf) + } + } + + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [LocaleOverrides] { + let len: Int32 = try readInt(&buf) + var seq = [LocaleOverrides]() + seq.reserveCapacity(Int(len)) + for _ in 0 ..< len { + seq.append(try FfiConverterTypeLocaleOverrides.read(from: &buf)) + } + return seq + } +} + +fileprivate struct FfiConverterSequenceTypeLocalizedName: FfiConverterRustBuffer { + typealias SwiftType = [LocalizedName] + + public static func write(_ value: [LocalizedName], into buf: inout [UInt8]) { + let len = Int32(value.count) + writeInt(&buf, len) + for item in value { + FfiConverterTypeLocalizedName.write(item, into: &buf) + } + } + + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [LocalizedName] { + let len: Int32 = try readInt(&buf) + var seq = [LocalizedName]() + seq.reserveCapacity(Int(len)) + for _ in 0 ..< len { + seq.append(try FfiConverterTypeLocalizedName.read(from: &buf)) + } + return seq + } +} + fileprivate struct FfiConverterSequenceTypePayment: FfiConverterRustBuffer { typealias SwiftType = [Payment] @@ -2575,6 +5671,50 @@ fileprivate struct FfiConverterSequenceTypePayment: FfiConverterRustBuffer { } } +fileprivate struct FfiConverterSequenceTypeRate: FfiConverterRustBuffer { + typealias SwiftType = [Rate] + + public static func write(_ value: [Rate], into buf: inout [UInt8]) { + let len = Int32(value.count) + writeInt(&buf, len) + for item in value { + FfiConverterTypeRate.write(item, into: &buf) + } + } + + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [Rate] { + let len: Int32 = try readInt(&buf) + var seq = [Rate]() + seq.reserveCapacity(Int(len)) + for _ in 0 ..< len { + seq.append(try FfiConverterTypeRate.read(from: &buf)) + } + return seq + } +} + +fileprivate struct FfiConverterSequenceTypeRefundableSwap: FfiConverterRustBuffer { + typealias SwiftType = [RefundableSwap] + + public static func write(_ value: [RefundableSwap], into buf: inout [UInt8]) { + let len = Int32(value.count) + writeInt(&buf, len) + for item in value { + FfiConverterTypeRefundableSwap.write(item, into: &buf) + } + } + + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [RefundableSwap] { + let len: Int32 = try readInt(&buf) + var seq = [RefundableSwap]() + seq.reserveCapacity(Int(len)) + for _ in 0 ..< len { + seq.append(try FfiConverterTypeRefundableSwap.read(from: &buf)) + } + return seq + } +} + fileprivate struct FfiConverterSequenceTypeRouteHint: FfiConverterRustBuffer { typealias SwiftType = [RouteHint] @@ -2625,17 +5765,24 @@ public func connect(req: ConnectRequest)throws -> BindingLiquidSdk { ) }) } -public func defaultConfig(network: Network) -> Config { +public func defaultConfig(network: LiquidNetwork) -> Config { return try! FfiConverterTypeConfig.lift(try! rustCall() { uniffi_breez_liquid_sdk_bindings_fn_func_default_config( - FfiConverterTypeNetwork.lower(network),$0 + FfiConverterTypeLiquidNetwork.lower(network),$0 + ) +}) +} +public func parse(input: String)throws -> InputType { + return try FfiConverterTypeInputType.lift(try rustCallWithError(FfiConverterTypePaymentError.lift) { + uniffi_breez_liquid_sdk_bindings_fn_func_parse( + FfiConverterString.lower(input),$0 ) }) } -public func parseInvoice(invoice: String)throws -> LnInvoice { +public func parseInvoice(input: String)throws -> LnInvoice { return try FfiConverterTypeLNInvoice.lift(try rustCallWithError(FfiConverterTypePaymentError.lift) { uniffi_breez_liquid_sdk_bindings_fn_func_parse_invoice( - FfiConverterString.lower(invoice),$0 + FfiConverterString.lower(input),$0 ) }) } @@ -2664,10 +5811,13 @@ private var initializationResult: InitializationResult { if (uniffi_breez_liquid_sdk_bindings_checksum_func_connect() != 18922) { return InitializationResult.apiChecksumMismatch } - if (uniffi_breez_liquid_sdk_bindings_checksum_func_default_config() != 13178) { + if (uniffi_breez_liquid_sdk_bindings_checksum_func_default_config() != 7519) { return InitializationResult.apiChecksumMismatch } - if (uniffi_breez_liquid_sdk_bindings_checksum_func_parse_invoice() != 13238) { + if (uniffi_breez_liquid_sdk_bindings_checksum_func_parse() != 55677) { + return InitializationResult.apiChecksumMismatch + } + if (uniffi_breez_liquid_sdk_bindings_checksum_func_parse_invoice() != 24615) { return InitializationResult.apiChecksumMismatch } if (uniffi_breez_liquid_sdk_bindings_checksum_func_set_logger() != 34021) { @@ -2682,24 +5832,63 @@ private var initializationResult: InitializationResult { if (uniffi_breez_liquid_sdk_bindings_checksum_method_bindingliquidsdk_disconnect() != 31676) { return InitializationResult.apiChecksumMismatch } + if (uniffi_breez_liquid_sdk_bindings_checksum_method_bindingliquidsdk_fetch_fiat_rates() != 52001) { + return InitializationResult.apiChecksumMismatch + } if (uniffi_breez_liquid_sdk_bindings_checksum_method_bindingliquidsdk_get_info() != 38166) { return InitializationResult.apiChecksumMismatch } + if (uniffi_breez_liquid_sdk_bindings_checksum_method_bindingliquidsdk_list_fiat_currencies() != 44593) { + return InitializationResult.apiChecksumMismatch + } if (uniffi_breez_liquid_sdk_bindings_checksum_method_bindingliquidsdk_list_payments() != 34268) { return InitializationResult.apiChecksumMismatch } + if (uniffi_breez_liquid_sdk_bindings_checksum_method_bindingliquidsdk_list_refundables() != 38335) { + return InitializationResult.apiChecksumMismatch + } + if (uniffi_breez_liquid_sdk_bindings_checksum_method_bindingliquidsdk_lnurl_auth() != 46998) { + return InitializationResult.apiChecksumMismatch + } + if (uniffi_breez_liquid_sdk_bindings_checksum_method_bindingliquidsdk_lnurl_pay() != 46794) { + return InitializationResult.apiChecksumMismatch + } + if (uniffi_breez_liquid_sdk_bindings_checksum_method_bindingliquidsdk_lnurl_withdraw() != 9706) { + return InitializationResult.apiChecksumMismatch + } + if (uniffi_breez_liquid_sdk_bindings_checksum_method_bindingliquidsdk_pay_onchain() != 44319) { + return InitializationResult.apiChecksumMismatch + } + if (uniffi_breez_liquid_sdk_bindings_checksum_method_bindingliquidsdk_prepare_pay_onchain() != 52231) { + return InitializationResult.apiChecksumMismatch + } + if (uniffi_breez_liquid_sdk_bindings_checksum_method_bindingliquidsdk_prepare_receive_onchain() != 16997) { + return InitializationResult.apiChecksumMismatch + } if (uniffi_breez_liquid_sdk_bindings_checksum_method_bindingliquidsdk_prepare_receive_payment() != 57331) { return InitializationResult.apiChecksumMismatch } + if (uniffi_breez_liquid_sdk_bindings_checksum_method_bindingliquidsdk_prepare_refund() != 17862) { + return InitializationResult.apiChecksumMismatch + } if (uniffi_breez_liquid_sdk_bindings_checksum_method_bindingliquidsdk_prepare_send_payment() != 35897) { return InitializationResult.apiChecksumMismatch } + if (uniffi_breez_liquid_sdk_bindings_checksum_method_bindingliquidsdk_receive_onchain() != 60045) { + return InitializationResult.apiChecksumMismatch + } if (uniffi_breez_liquid_sdk_bindings_checksum_method_bindingliquidsdk_receive_payment() != 8257) { return InitializationResult.apiChecksumMismatch } + if (uniffi_breez_liquid_sdk_bindings_checksum_method_bindingliquidsdk_refund() != 46229) { + return InitializationResult.apiChecksumMismatch + } if (uniffi_breez_liquid_sdk_bindings_checksum_method_bindingliquidsdk_remove_event_listener() != 11780) { return InitializationResult.apiChecksumMismatch } + if (uniffi_breez_liquid_sdk_bindings_checksum_method_bindingliquidsdk_rescan_onchain_swaps() != 40255) { + return InitializationResult.apiChecksumMismatch + } if (uniffi_breez_liquid_sdk_bindings_checksum_method_bindingliquidsdk_restore() != 42575) { return InitializationResult.apiChecksumMismatch } diff --git a/breez_liquid_sdkFFI.podspec b/breez_liquid_sdkFFI.podspec index ae56990..9dc275c 100644 --- a/breez_liquid_sdkFFI.podspec +++ b/breez_liquid_sdkFFI.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |spec| spec.name = "breez_liquid_sdkFFI" - spec.version = "0.1.0-rc1" + spec.version = "0.1.1-dev1" spec.license = { :type => "MIT" } spec.summary = "Low-level bindings to the Breez Liquid SDK Rust API" spec.homepage = "https://breez.technology"