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

Fix package location #398

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
16 changes: 8 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,20 @@ jobs:
uses: gradle/actions/setup-gradle@v3
- name: Run build with Gradle Wrapper
run: ./gradlew build
- name: Tag version 4.0.0-rc1
- name: Tag version 4.0.0
run: |
git tag 4.0.0-rc1
git push origin 4.0.0-rc1
- name: Create a GitHub release for version 4.0.0-rc1
git tag 4.0.0
git push origin 4.0.0
- name: Create a GitHub release for version 4.0.0
uses: ncipollo/release-action@v1
with:
tag: "4.0.0-rc1"
name: "Release 4.0.0-rc1"
body: "A release candidate for the new identity scheme"
tag: "4.0.0"
name: "Release 4.0.0"
body: "A release for the new identity scheme"

- name: Gradle Publish
env:
RELEASE_VERSION: "4.0.0-rc1"
RELEASE_VERSION: "4.0.0"
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
SIGN_KEY: ${{ secrets.OSSRH_GPG_SECRET_KEY }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@ import kotlinx.coroutines.runBlocking
import org.junit.Assert
import org.junit.Assert.assertEquals
import org.junit.BeforeClass
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
import org.xmtp.android.library.libxmtp.DecodedMessage
import org.xmtp.android.library.messages.PrivateKey
import org.xmtp.android.library.messages.PrivateKeyBuilder
import uniffi.xmtpv3.GenericException

@RunWith(AndroidJUnit4::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class SmartContractWalletTest {
companion object {
private lateinit var davonSCW: FakeSCWWallet
Expand Down Expand Up @@ -75,7 +78,7 @@ class SmartContractWalletTest {
}

@Test
fun testCanBuildASCW() {
fun test1_CanBuildASCW() {
val davonSCWClient2 = runBlocking {
Client.build(
publicIdentity = davonSCW.publicIdentity,
Expand All @@ -84,58 +87,30 @@ class SmartContractWalletTest {
}

assertEquals(davonSCWClient.inboxId, davonSCWClient2.inboxId)
}

@Test
fun testAddAndRemovingAccounts() {
val davonEOA = PrivateKeyBuilder()
val davonSCW2 = FakeSCWWallet.generate(ANVIL_TEST_PRIVATE_KEY_3)

runBlocking { davonSCWClient.addAccount(davonEOA) }
runBlocking { davonSCWClient.addAccount(davonSCW2) }

var state = runBlocking { davonSCWClient.inboxState(true) }
assertEquals(state.installations.size, 1)
assertEquals(state.identities.size, 3)
assertEquals(state.recoveryPublicIdentity, davonSCW.publicIdentity)
assertEquals(
state.identities,
listOf(
davonEOA.publicIdentity,
davonSCW2.publicIdentity,
davonSCW.publicIdentity
)
davonSCWClient2.inboxId,
runBlocking { davonSCWClient.inboxIdFromIdentity(davonSCW.publicIdentity) }
)

runBlocking { davonSCWClient.removeAccount(davonSCW, davonSCW2.publicIdentity) }
state = runBlocking { davonSCWClient.inboxState(true) }
assertEquals(state.identities.size, 2)
assertEquals(state.recoveryPublicIdentity, davonSCW.publicIdentity)
assertEquals(
state.identities,
listOf(
davonEOA.publicIdentity,
davonSCW.publicIdentity
)
)
assertEquals(state.installations.size, 1)
runBlocking {
davonSCWClient.canMessage(listOf(boEOAWallet.publicIdentity))[boEOAWallet.publicIdentity.identifier]?.let {
assert(
it
)
}
}

// Cannot remove the recovery address
Assert.assertThrows(
"Client error: Unknown Signer",
GenericException::class.java
) {
runBlocking {
davonSCWClient.removeAccount(
davonEOA,
davonSCW.publicIdentity
runBlocking {
boEOAClient.canMessage(listOf(davonSCW.publicIdentity))[davonSCW.publicIdentity.identifier]?.let {
assert(
it
)
}
}
}

@Test
fun testsCanCreateGroup() {
fun test2_CanCreateGroup() {
val group1 = runBlocking {
boEOAClient.conversations.newGroup(
listOf(
Expand All @@ -158,13 +133,17 @@ class SmartContractWalletTest {
listOf(davonSCWClient.inboxId, boEOAClient.inboxId, eriSCWClient.inboxId).sorted()
)
assertEquals(
runBlocking { group2.members().map { it.identities.first() } },
listOf(davonSCW.publicIdentity, boEOAWallet.publicIdentity, eriSCW.publicIdentity)
runBlocking { group2.members().map { it.identities.first().identifier }.sorted() },
listOf(
davonSCW.publicIdentity.identifier,
boEOAWallet.publicIdentity.identifier,
eriSCW.publicIdentity.identifier
).sorted()
)
}

@Test
fun testsCanSendMessages() {
fun test3_CanSendMessages() {
val boGroup = runBlocking {
boEOAClient.conversations.newGroup(
listOf(
Expand All @@ -185,7 +164,7 @@ class SmartContractWalletTest {
assertEquals(runBlocking { boGroup.messages() }.size, 3)

runBlocking { davonSCWClient.conversations.sync() }
val davonGroup = runBlocking { davonSCWClient.conversations.listGroups().last() }
val davonGroup = runBlocking { davonSCWClient.conversations.findGroup(boGroup.id)!! }
runBlocking { davonGroup.sync() }
assertEquals(runBlocking { davonGroup.messages() }.size, 2)
assertEquals(runBlocking { davonGroup.messages() }.first().body, "gm")
Expand All @@ -200,7 +179,7 @@ class SmartContractWalletTest {
}

@Test
fun testGroupConsent() {
fun test4_GroupConsent() {
runBlocking {
val davonGroup = runBlocking {
davonSCWClient.conversations.newGroup(
Expand Down Expand Up @@ -241,7 +220,7 @@ class SmartContractWalletTest {
}

@Test
fun testCanAllowAndDenyInboxId() {
fun test5_CanAllowAndDenyInboxId() {
runBlocking {
val davonGroup = runBlocking {
davonSCWClient.conversations.newGroup(
Expand Down Expand Up @@ -292,7 +271,7 @@ class SmartContractWalletTest {
}

@Test
fun testCanStreamAllMessages() {
fun test6_CanStreamAllMessages() {
val group1 = runBlocking {
davonSCWClient.conversations.newGroup(
listOf(
Expand Down Expand Up @@ -337,7 +316,8 @@ class SmartContractWalletTest {
}

@Test
fun testCanStreamConversations() {
fun test7_CanStreamConversations() {
val fixtures = fixtures()
val allMessages = mutableListOf<String>()

val job = CoroutineScope(Dispatchers.IO).launch {
Expand All @@ -354,12 +334,60 @@ class SmartContractWalletTest {
runBlocking {
eriSCWClient.conversations.newGroup(listOf(boEOAClient.inboxId, davonSCWClient.inboxId))
boEOAClient.conversations.newGroup(listOf(eriSCWClient.inboxId, davonSCWClient.inboxId))
eriSCWClient.conversations.findOrCreateDm(davonSCWClient.inboxId)
boEOAClient.conversations.findOrCreateDm(davonSCWClient.inboxId)
davonSCWClient.conversations.findOrCreateDm(fixtures.alixClient.inboxId)
fixtures.caroClient.conversations.findOrCreateDm(davonSCWClient.inboxId)
}

Thread.sleep(1000)
assertEquals(4, allMessages.size)
job.cancel()
}
}

@Test
fun test8_AddAndRemovingAccounts() {
val davonEOA = PrivateKeyBuilder()
val davonSCW2 = FakeSCWWallet.generate(ANVIL_TEST_PRIVATE_KEY_3)

runBlocking { davonSCWClient.addAccount(davonEOA) }
runBlocking { davonSCWClient.addAccount(davonSCW2) }

var state = runBlocking { davonSCWClient.inboxState(true) }
assertEquals(state.installations.size, 1)
assertEquals(state.identities.size, 3)
assertEquals(state.recoveryPublicIdentity.identifier, davonSCW.publicIdentity.identifier)
assertEquals(
state.identities.map { it.identifier }.sorted(),
listOf(
davonEOA.publicIdentity.identifier,
davonSCW2.publicIdentity.identifier,
davonSCW.publicIdentity.identifier
).sorted()
)

runBlocking { davonSCWClient.removeAccount(davonSCW, davonSCW2.publicIdentity) }
state = runBlocking { davonSCWClient.inboxState(true) }
assertEquals(state.identities.size, 2)
assertEquals(state.recoveryPublicIdentity.identifier, davonSCW.publicIdentity.identifier)
assertEquals(
state.identities.map { it.identifier }.sorted(),
listOf(
davonEOA.publicIdentity.identifier,
davonSCW.publicIdentity.identifier
).sorted()
)
assertEquals(state.installations.size, 1)

// Cannot remove the recovery address
Assert.assertThrows(
"Client error: Unknown Signer",
GenericException::class.java
) {
runBlocking {
davonSCWClient.removeAccount(
davonEOA,
davonSCW.publicIdentity
)
}
}
}
}
4 changes: 2 additions & 2 deletions library/src/main/java/libxmtp-version.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Version: 9a625234
Version: 54e98b1b
Branch: main
Date: 2025-03-10 16:50:45 +0000
Date: 2025-03-12 19:10:26 +0000
2 changes: 1 addition & 1 deletion library/src/main/java/org/xmtp/android/library/Group.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import org.xmtp.android.library.libxmtp.DecodedMessage
import org.xmtp.android.library.libxmtp.DecodedMessage.MessageDeliveryStatus
import org.xmtp.android.library.libxmtp.DecodedMessage.SortDirection
import org.xmtp.android.library.libxmtp.DisappearingMessageSettings
import org.xmtp.android.library.libxmtp.GroupMembershipResult
import org.xmtp.android.library.libxmtp.PublicIdentity
import org.xmtp.android.library.libxmtp.PermissionOption
import org.xmtp.android.library.libxmtp.PermissionPolicySet
Expand All @@ -27,7 +28,6 @@ import uniffi.xmtpv3.FfiMessageDisappearingSettings
import uniffi.xmtpv3.FfiMetadataField
import uniffi.xmtpv3.FfiPermissionUpdateType
import uniffi.xmtpv3.FfiSubscribeException
import uniffi.xmtpv3.org.xmtp.android.library.libxmtp.GroupMembershipResult

import java.util.Date

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package uniffi.xmtpv3.org.xmtp.android.library.libxmtp
package org.xmtp.android.library.libxmtp

import org.xmtp.android.library.InboxId
import org.xmtp.android.library.toHex
Expand Down
Binary file modified library/src/main/jniLibs/arm64-v8a/libuniffi_xmtpv3.so
Binary file not shown.
Binary file modified library/src/main/jniLibs/armeabi-v7a/libuniffi_xmtpv3.so
Binary file not shown.
Binary file modified library/src/main/jniLibs/x86/libuniffi_xmtpv3.so
Binary file not shown.
Binary file modified library/src/main/jniLibs/x86_64/libuniffi_xmtpv3.so
Binary file not shown.
Loading