Skip to content

Commit

Permalink
Update Swift bindings to version 0.3.1-dev4
Browse files Browse the repository at this point in the history
  • Loading branch information
SDK release tagger committed Sep 16, 2024
1 parent 66680e7 commit a8da385
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 10 deletions.
2 changes: 1 addition & 1 deletion BreezSDKLiquid.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = "BreezSDKLiquid"
spec.version = "0.3.1-dev3"
spec.version = "0.3.1-dev4"
spec.license = { :type => "MIT" }
spec.summary = "Swift bindings to the Breez Liquid SDK"
spec.homepage = "https://breez.technology"
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ let package = Package(
.library(name: "BreezSDKLiquid", targets: ["breez_sdk_liquidFFI", "BreezSDKLiquid"]),
],
targets: [
.binaryTarget(name: "breez_sdk_liquidFFI", url: "https://github.com/breez/breez-sdk-liquid-swift/releases/download/0.3.1-dev3/breez_sdk_liquidFFI.xcframework.zip", checksum: "dc3cea0a84c06ea4df284d06af9c46ffcb713ddd8fc1ab80ab9eee60a177b62f"),
.binaryTarget(name: "breez_sdk_liquidFFI", url: "https://github.com/breez/breez-sdk-liquid-swift/releases/download/0.3.1-dev4/breez_sdk_liquidFFI.xcframework.zip", checksum: "bc66a4398da0710118f5f3a722668de93709a619bf5da7cf6cb468e65703d07f"),
.target(name: "BreezSDKLiquid", dependencies: ["breez_sdk_liquidFFI"]),
]
)
69 changes: 62 additions & 7 deletions Sources/BreezSDKLiquid/BreezSDKLiquid.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3159,21 +3159,21 @@ public func FfiConverterTypePrepareBuyBitcoinResponse_lower(_ value: PrepareBuyB


public struct PreparePayOnchainRequest {
public var receiverAmountSat: UInt64
public var amount: PayOnchainAmount
public var satPerVbyte: UInt32?

// Default memberwise initializers are never public by default, so we
// declare one manually.
public init(receiverAmountSat: UInt64, satPerVbyte: UInt32? = nil) {
self.receiverAmountSat = receiverAmountSat
public init(amount: PayOnchainAmount, satPerVbyte: UInt32? = nil) {
self.amount = amount
self.satPerVbyte = satPerVbyte
}
}


extension PreparePayOnchainRequest: Equatable, Hashable {
public static func ==(lhs: PreparePayOnchainRequest, rhs: PreparePayOnchainRequest) -> Bool {
if lhs.receiverAmountSat != rhs.receiverAmountSat {
if lhs.amount != rhs.amount {
return false
}
if lhs.satPerVbyte != rhs.satPerVbyte {
Expand All @@ -3183,7 +3183,7 @@ extension PreparePayOnchainRequest: Equatable, Hashable {
}

public func hash(into hasher: inout Hasher) {
hasher.combine(receiverAmountSat)
hasher.combine(amount)
hasher.combine(satPerVbyte)
}
}
Expand All @@ -3192,13 +3192,13 @@ extension PreparePayOnchainRequest: Equatable, Hashable {
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),
amount: FfiConverterTypePayOnchainAmount.read(from: &buf),
satPerVbyte: FfiConverterOptionUInt32.read(from: &buf)
)
}

public static func write(_ value: PreparePayOnchainRequest, into buf: inout [UInt8]) {
FfiConverterUInt64.write(value.receiverAmountSat, into: &buf)
FfiConverterTypePayOnchainAmount.write(value.amount, into: &buf)
FfiConverterOptionUInt32.write(value.satPerVbyte, into: &buf)
}
}
Expand Down Expand Up @@ -5406,6 +5406,61 @@ extension Network: 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 PayOnchainAmount {

case receiver(amountSat: UInt64)
case drain
}

public struct FfiConverterTypePayOnchainAmount: FfiConverterRustBuffer {
typealias SwiftType = PayOnchainAmount

public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PayOnchainAmount {
let variant: Int32 = try readInt(&buf)
switch variant {

case 1: return .receiver(
amountSat: try FfiConverterUInt64.read(from: &buf)
)

case 2: return .drain

default: throw UniffiInternalError.unexpectedEnumCase
}
}

public static func write(_ value: PayOnchainAmount, into buf: inout [UInt8]) {
switch value {


case let .receiver(amountSat):
writeInt(&buf, Int32(1))
FfiConverterUInt64.write(amountSat, into: &buf)


case .drain:
writeInt(&buf, Int32(2))

}
}
}


public func FfiConverterTypePayOnchainAmount_lift(_ buf: RustBuffer) throws -> PayOnchainAmount {
return try FfiConverterTypePayOnchainAmount.lift(buf)
}

public func FfiConverterTypePayOnchainAmount_lower(_ value: PayOnchainAmount) -> RustBuffer {
return FfiConverterTypePayOnchainAmount.lower(value)
}


extension PayOnchainAmount: 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 PaymentDetails {
Expand Down
2 changes: 1 addition & 1 deletion breez_sdk_liquidFFI.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = "breez_sdk_liquidFFI"
spec.version = "0.3.1-dev3"
spec.version = "0.3.1-dev4"
spec.license = { :type => "MIT" }
spec.summary = "Low-level bindings to the Breez Liquid SDK Rust API"
spec.homepage = "https://breez.technology"
Expand Down

0 comments on commit a8da385

Please sign in to comment.