Skip to content

Commit

Permalink
Replace xmtp-rust-swift with libxmtp-swift (#217)
Browse files Browse the repository at this point in the history
* rename module from XMTP to XMTPiOS

* more renaming

* remove xmtp-rust-swift references

* Use new V2 client from libxmtp

* building clean

* remove PublishResponse

* Use actual dep instead of local

* Update XMTP.podspec

Co-authored-by: Naomi Plasterer <[email protected]>

* implement streaming and pagination

* Update XMTP.podspec

Co-authored-by: Cameron Voell <[email protected]>

* disable file_length linter

---------

Co-authored-by: Naomi Plasterer <[email protected]>
Co-authored-by: Cameron Voell <[email protected]>
  • Loading branch information
3 people authored Jan 22, 2024
1 parent f4f24aa commit 2ad3394
Show file tree
Hide file tree
Showing 125 changed files with 621 additions and 486 deletions.
1 change: 1 addition & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ disabled_rules: # rule identifiers turned on by default to exclude from running
- opening_brace
- nesting
- type_body_length
- file_length

opt_in_rules:
- force_unwrapping
Expand Down
87 changes: 30 additions & 57 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
{
"identity" : "generic-json-swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/iwill/generic-json-swift",
"location" : "https://github.com/zoul/generic-json-swift",
"state" : {
"revision" : "0a06575f4038b504e78ac330913d920f1630f510",
"version" : "2.0.2"
Expand All @@ -36,6 +36,15 @@
"version" : "5.2.0"
}
},
{
"identity" : "libxmtp-swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/xmtp/libxmtp-swift",
"state" : {
"branch" : "60b99d0",
"revision" : "60b99d04f642a7e2b15156d818dabc4aab65b1c0"
}
},
{
"identity" : "secp256k1.swift",
"kind" : "remoteSourceControl",
Expand All @@ -50,26 +59,26 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-atomics.git",
"state" : {
"revision" : "cd142fd2f64be2100422d658e7411e39489da985",
"version" : "1.2.0"
"revision" : "919eb1d83e02121cdb434c7bfc1f0c66ef17febe",
"version" : "1.0.2"
}
},
{
"identity" : "swift-collections",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-collections.git",
"state" : {
"revision" : "a902f1823a7ff3c9ab2fba0f992396b948eda307",
"version" : "1.0.5"
"revision" : "f504716c27d2e5d4144fa4794b12129301d17729",
"version" : "1.0.3"
}
},
{
"identity" : "swift-docc-plugin",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-docc-plugin.git",
"state" : {
"revision" : "26ac5758409154cc448d7ab82389c520fa8a8247",
"version" : "1.3.0"
"revision" : "9b1258905c21fc1b97bf03d1b4ca12c4ec4e5fda",
"version" : "1.2.0"
}
},
{
Expand All @@ -81,103 +90,67 @@
"version" : "1.0.0"
}
},
{
"identity" : "swift-http-types",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-http-types",
"state" : {
"revision" : "1827dc94bdab2eb5f2fc804e9b0cb43574282566",
"version" : "1.0.2"
}
},
{
"identity" : "swift-log",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-log.git",
"state" : {
"revision" : "532d8b529501fb73a2455b179e0bbb6d49b652ed",
"version" : "1.5.3"
"revision" : "6fe203dc33195667ce1759bf0182975e4653ba1c",
"version" : "1.4.4"
}
},
{
"identity" : "swift-nio",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio.git",
"state" : {
"revision" : "702cd7c56d5d44eeba73fdf83918339b26dc855c",
"version" : "2.62.0"
}
},
{
"identity" : "swift-nio-extras",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio-extras.git",
"state" : {
"revision" : "798c962495593a23fdea0c0c63fd55571d8dff51",
"version" : "1.20.0"
}
},
{
"identity" : "swift-nio-http2",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio-http2.git",
"state" : {
"revision" : "3bd9004b9d685ed6b629760fc84903e48efec806",
"version" : "1.29.0"
"revision" : "edfceecba13d68c1c993382806e72f7e96feaa86",
"version" : "2.44.0"
}
},
{
"identity" : "swift-nio-ssl",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio-ssl.git",
"state" : {
"revision" : "320bd978cceb8e88c125dcbb774943a92f6286e9",
"version" : "2.25.0"
"revision" : "4fb7ead803e38949eb1d6fabb849206a72c580f3",
"version" : "2.23.0"
}
},
{
"identity" : "swift-nio-transport-services",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio-transport-services.git",
"state" : {
"revision" : "ebf8b9c365a6ce043bf6e6326a04b15589bd285e",
"version" : "1.20.0"
"revision" : "c0d9a144cfaec8d3d596aadde3039286a266c15c",
"version" : "1.15.0"
}
},
{
"identity" : "swift-protobuf",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-protobuf.git",
"state" : {
"revision" : "65e8f29b2d63c4e38e736b25c27b83e012159be8",
"version" : "1.25.2"
"revision" : "ab3a58b7209a17d781c0d1dbb3e1ff3da306bae8",
"version" : "1.20.3"
}
},
{
"identity" : "web3.swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/argentlabs/web3.swift",
"state" : {
"revision" : "1e75f98a5738c470b23bbfffa9314e9f788df76b",
"version" : "1.6.1"
"revision" : "9da09d639d4e5d06eb59518e636b3ae957e8e9cd",
"version" : "1.3.0"
}
},
{
"identity" : "websocket-kit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/vapor/websocket-kit.git",
"state" : {
"revision" : "53fe0639a98903858d0196b699720decb42aee7b",
"version" : "2.14.0"
}
},
{
"identity" : "xmtp-rust-swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/xmtp/xmtp-rust-swift",
"state" : {
"branch" : "main",
"revision" : "e08af6942841054ae02a6fe01d90d18e76d5f248"
"revision" : "2d9d2188a08eef4a869d368daab21b3c08510991",
"version" : "2.6.1"
}
}
],
Expand Down
17 changes: 9 additions & 8 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
import PackageDescription

let package = Package(
name: "XMTP",
name: "XMTPiOS",
platforms: [.iOS(.v14), .macOS(.v11)],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "XMTP",
targets: ["XMTP"]
name: "XMTPiOS",
targets: ["XMTPiOS"]
),
.library(
name: "XMTPTestHelpers",
Expand All @@ -26,28 +26,29 @@ let package = Package(
.package(url: "https://github.com/1024jp/GzipSwift", from: "5.2.0"),
.package(url: "https://github.com/bufbuild/connect-swift", exact: "0.3.0"),
.package(url: "https://github.com/apple/swift-docc-plugin.git", from: "1.0.0"),
.package(url: "https://github.com/xmtp/xmtp-rust-swift", branch: "main"),
.package(url: "https://github.com/xmtp/libxmtp-swift", revision: "60b99d0"),
// .package(path: "../libxmtp-swift")
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "XMTP",
name: "XMTPiOS",
dependencies: [
.product(name: "secp256k1", package: "secp256k1.swift"),
"web3.swift",
.product(name: "Gzip", package: "GzipSwift"),
.product(name: "Connect", package: "connect-swift"),
.product(name: "XMTPRust", package: "xmtp-rust-swift"),
.product(name: "LibXMTP", package: "libxmtp-swift"),
]
),
.target(
name: "XMTPTestHelpers",
dependencies: ["XMTP"]
dependencies: ["XMTPiOS"]
),
.testTarget(
name: "XMTPTests",
dependencies: ["XMTP", "XMTPTestHelpers"]
dependencies: ["XMTPiOS", "XMTPTestHelpers"]
),
]
)
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Use Xcode to add to the project (**File** > **Add Packages…**) or add this to
The XMTP message API revolves around a message API client (client) that allows retrieving and sending messages to other XMTP network participants. A client must connect to a wallet app on startup. If this is the very first time the client is created, the client will generate a key bundle that is used to encrypt and authenticate messages. The key bundle persists encrypted in the network using an account signature. The public side of the key bundle is also regularly advertised on the network to allow parties to establish shared encryption keys. All of this happens transparently, without requiring any additional code.

```swift
import XMTP
import XMTPiOS

// You'll want to replace this with a wallet from your application.
let account = try PrivateKey.generate()
Expand Down Expand Up @@ -69,7 +69,7 @@ A client is created with `Client.create(account: SigningKey) async throws -> Cli
> The client connects to the XMTP `dev` environment by default. [Use `ClientOptions`](#configure-the-client) to change this and other parameters of the network connection.
```swift
import XMTP
import XMTPiOS

// Create the client with a `SigningKey` from your app
let client = try await Client.create(account: account, options: .init(api: .init(env: .production)))
Expand Down Expand Up @@ -129,7 +129,7 @@ To learn more about using `AttachmentCodec` and `RemoteAttachmentCodec`, see [Ha
Most of the time, when interacting with the network, you'll want to do it through `conversations`. Conversations are between two accounts.

```swift
import XMTP
import XMTPiOS
// Create the client with a wallet from your app
let client = try await Client.create(account: account)
let conversations = try await client.conversations.list()
Expand Down
Loading

0 comments on commit 2ad3394

Please sign in to comment.