Skip to content

Commit

Permalink
Require only 1 signature to add a wallet (#337)
Browse files Browse the repository at this point in the history
* bump to latest

* support only one signature for add wallet
  • Loading branch information
nplasterer authored Nov 22, 2024
1 parent 3416280 commit 0e831ca
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -419,8 +419,8 @@ class ClientTest {
val fixtures = fixtures()
val alix2Wallet = PrivateKeyBuilder()
val alix3Wallet = PrivateKeyBuilder()
runBlocking { fixtures.alixClient.addAccount(fixtures.alixAccount, alix2Wallet) }
runBlocking { fixtures.alixClient.addAccount(fixtures.alixAccount, alix3Wallet) }
runBlocking { fixtures.alixClient.addAccount(alix2Wallet) }
runBlocking { fixtures.alixClient.addAccount(alix3Wallet) }

val state = runBlocking { fixtures.alixClient.inboxState(true) }
assertEquals(state.installations.size, 1)
Expand All @@ -441,8 +441,8 @@ class ClientTest {
val fixtures = fixtures()
val alix2Wallet = PrivateKeyBuilder()
val alix3Wallet = PrivateKeyBuilder()
runBlocking { fixtures.alixClient.addAccount(fixtures.alixAccount, alix2Wallet) }
runBlocking { fixtures.alixClient.addAccount(fixtures.alixAccount, alix3Wallet) }
runBlocking { fixtures.alixClient.addAccount(alix2Wallet) }
runBlocking { fixtures.alixClient.addAccount(alix3Wallet) }

var state = runBlocking { fixtures.alixClient.inboxState(true) }
assertEquals(state.addresses.size, 3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ class SmartContractWalletTest {
val davonEOA = PrivateKeyBuilder()
val davonSCW2 = FakeSCWWallet.generate(ANVIL_TEST_PRIVATE_KEY_3)

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

var state = runBlocking { davonSCWClient.inboxState(true) }
assertEquals(state.installations.size, 1)
Expand Down
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: cbff7296
Version: d07fb2bf
Branch: main
Date: 2024-11-21 17:51:27 +0000
Date: 2024-11-22 18:36:31 +0000
5 changes: 2 additions & 3 deletions library/src/main/java/org/xmtp/android/library/Client.kt
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,9 @@ class Client() {
ffiClient.applySignatureRequest(signatureRequest)
}

suspend fun addAccount(recoverAccount: SigningKey, newAccount: SigningKey) {
suspend fun addAccount(newAccount: SigningKey) {
val signatureRequest =
ffiClient.addWallet(address.lowercase(), newAccount.address.lowercase())
handleSignature(signatureRequest, recoverAccount)
ffiClient.addWallet(newAccount.address.lowercase())
handleSignature(signatureRequest, newAccount)
ffiClient.applySignatureRequest(signatureRequest)
}
Expand Down
Loading

0 comments on commit 0e831ca

Please sign in to comment.