Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump for batched consent #68

Merged
merged 2 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions LibXMTP.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'LibXMTP'
s.version = '0.5.8-beta5'
s.version = '0.5.8-beta6'
s.summary = 'XMTP shared Rust code that powers cross-platform SDKs'

s.homepage = 'https://github.com/xmtp/libxmtp-swift'
Expand All @@ -10,7 +10,7 @@ Pod::Spec.new do |s|
s.platform = :ios, '14.0', :macos, '11.0'
s.swift_version = '5.3'

s.source = { :http => "https://github.com/xmtp/libxmtp/releases/download/swift-bindings-7e70ad4/LibXMTPSwiftFFI.zip", :type => :zip }
s.source = { :http => "https://github.com/xmtp/libxmtp/releases/download/swift-bindings-34d3249/LibXMTPSwiftFFI.zip", :type => :zip }
s.vendored_frameworks = 'LibXMTPSwiftFFI.xcframework'
s.source_files = 'Sources/LibXMTP/**/*'
end
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ let package = Package(
),
.binaryTarget(
name: "LibXMTPSwiftFFI",
url: "https://github.com/xmtp/libxmtp/releases/download/swift-bindings-7e70ad4/LibXMTPSwiftFFI.zip",
checksum: "41a1bb49815416e3e19c6f629c6142a4623f2408ea1bb46facf65170b7c2d055"
url: "https://github.com/xmtp/libxmtp/releases/download/swift-bindings-34d3249/LibXMTPSwiftFFI.zip",
checksum: "8efa8d3ce01232a6308aaf26a2fbf5dc1e509a3cddfe32a79e6a487bf11a158d"
),
.testTarget(name: "LibXMTPTests", dependencies: ["LibXMTP"]),
]
Expand Down
4 changes: 2 additions & 2 deletions Sources/LibXMTP/libxmtp-version.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Version: 7e70ad48
Version: 34d32499
Branch: main
Date: 2024-09-13 15:56:37 +0000
Date: 2024-09-19 21:05:16 +0000
92 changes: 87 additions & 5 deletions Sources/LibXMTP/xmtpv3.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2180,7 +2180,7 @@ public protocol FfiXmtpClientProtocol: AnyObject {
*/
func revokeWallet(walletAddress: String) async throws -> FfiSignatureRequest

func setConsentState(state: FfiConsentState, entityType: FfiConsentEntityType, entity: String) async throws
func setConsentStates(records: [FfiConsent]) async throws

func signatureRequest() -> FfiSignatureRequest?
}
Expand Down Expand Up @@ -2478,13 +2478,13 @@ open class FfiXmtpClient:
)
}

open func setConsentState(state: FfiConsentState, entityType: FfiConsentEntityType, entity: String) async throws {
open func setConsentStates(records: [FfiConsent]) async throws {
return
try await uniffiRustCallAsync(
rustFutureFunc: {
uniffi_xmtpv3_fn_method_ffixmtpclient_set_consent_state(
uniffi_xmtpv3_fn_method_ffixmtpclient_set_consent_states(
self.uniffiClonePointer(),
FfiConverterTypeFfiConsentState.lower(state), FfiConverterTypeFfiConsentEntityType.lower(entityType), FfiConverterString.lower(entity)
FfiConverterSequenceTypeFfiConsent.lower(records)
)
},
pollFunc: ffi_xmtpv3_rust_future_poll_void,
Expand Down Expand Up @@ -2540,6 +2540,66 @@ public func FfiConverterTypeFfiXmtpClient_lower(_ value: FfiXmtpClient) -> Unsaf
return FfiConverterTypeFfiXmtpClient.lower(value)
}

public struct FfiConsent {
public var entityType: FfiConsentEntityType
public var state: FfiConsentState
public var entity: String

// Default memberwise initializers are never public by default, so we
// declare one manually.
public init(entityType: FfiConsentEntityType, state: FfiConsentState, entity: String) {
self.entityType = entityType
self.state = state
self.entity = entity
}
}

extension FfiConsent: Equatable, Hashable {
public static func == (lhs: FfiConsent, rhs: FfiConsent) -> Bool {
if lhs.entityType != rhs.entityType {
return false
}
if lhs.state != rhs.state {
return false
}
if lhs.entity != rhs.entity {
return false
}
return true
}

public func hash(into hasher: inout Hasher) {
hasher.combine(entityType)
hasher.combine(state)
hasher.combine(entity)
}
}

public struct FfiConverterTypeFfiConsent: FfiConverterRustBuffer {
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> FfiConsent {
return
try FfiConsent(
entityType: FfiConverterTypeFfiConsentEntityType.read(from: &buf),
state: FfiConverterTypeFfiConsentState.read(from: &buf),
entity: FfiConverterString.read(from: &buf)
)
}

public static func write(_ value: FfiConsent, into buf: inout [UInt8]) {
FfiConverterTypeFfiConsentEntityType.write(value.entityType, into: &buf)
FfiConverterTypeFfiConsentState.write(value.state, into: &buf)
FfiConverterString.write(value.entity, into: &buf)
}
}

public func FfiConverterTypeFfiConsent_lift(_ buf: RustBuffer) throws -> FfiConsent {
return try FfiConverterTypeFfiConsent.lift(buf)
}

public func FfiConverterTypeFfiConsent_lower(_ value: FfiConsent) -> RustBuffer {
return FfiConverterTypeFfiConsent.lower(value)
}

public struct FfiCreateGroupOptions {
public var permissions: FfiGroupPermissionsOptions?
public var groupName: String?
Expand Down Expand Up @@ -4896,6 +4956,28 @@ private struct FfiConverterSequenceTypeFfiGroup: FfiConverterRustBuffer {
}
}

private struct FfiConverterSequenceTypeFfiConsent: FfiConverterRustBuffer {
typealias SwiftType = [FfiConsent]

public static func write(_ value: [FfiConsent], into buf: inout [UInt8]) {
let len = Int32(value.count)
writeInt(&buf, len)
for item in value {
FfiConverterTypeFfiConsent.write(item, into: &buf)
}
}

public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [FfiConsent] {
let len: Int32 = try readInt(&buf)
var seq = [FfiConsent]()
seq.reserveCapacity(Int(len))
for _ in 0 ..< len {
try seq.append(FfiConverterTypeFfiConsent.read(from: &buf))
}
return seq
}
}

private struct FfiConverterSequenceTypeFfiEnvelope: FfiConverterRustBuffer {
typealias SwiftType = [FfiEnvelope]

Expand Down Expand Up @@ -5564,7 +5646,7 @@ private var initializationResult: InitializationResult = {
if uniffi_xmtpv3_checksum_method_ffixmtpclient_revoke_wallet() != 12211 {
return InitializationResult.apiChecksumMismatch
}
if uniffi_xmtpv3_checksum_method_ffixmtpclient_set_consent_state() != 36178 {
if uniffi_xmtpv3_checksum_method_ffixmtpclient_set_consent_states() != 64566 {
return InitializationResult.apiChecksumMismatch
}
if uniffi_xmtpv3_checksum_method_ffixmtpclient_signature_request() != 18270 {
Expand Down