Skip to content

Commit

Permalink
Fix failing SCW test
Browse files Browse the repository at this point in the history
  • Loading branch information
neekolas committed Oct 17, 2024
1 parent 6ae1343 commit d8e447a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
9 changes: 9 additions & 0 deletions dev/local/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ services:
validation:
image: ghcr.io/xmtp/mls-validation-service:main
platform: linux/amd64
environment:
ANVIL_URL: "http://anvil:8545"

anvil:
build:
dockerfile: /Users/nickmolnar/code/xmtp/libxmtp/dev/docker/anvil.Dockerfile
platform: linux/amd64
ports:
- 8545:8545

db:
image: postgres:13
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class FakeSCWWallet(

return SignatureOuterClass.Signature.newBuilder().also {
it.ecdsaCompact = it.ecdsaCompact.toBuilder().also { builder ->
builder.bytes = signatureBytes.toByteString()
builder.bytes = encodedBytes.toByteString()
}.build()
}.build()
}
Expand All @@ -132,21 +132,24 @@ class FakeSCWWallet(
}

private fun createSmartContractWallet() {
val factory = CoinbaseSmartWalletFactory.deploy(
val smartWalletContract = CoinbaseSmartWallet.deploy(
web3j,
credentials,
DefaultGasProvider(),
BigInteger.ZERO,
"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
DefaultGasProvider()
).send()

CoinbaseSmartWallet.deploy(
val factory = CoinbaseSmartWalletFactory.deploy(
web3j,
credentials,
DefaultGasProvider()
DefaultGasProvider(),
BigInteger.ZERO,
smartWalletContract.contractAddress
).send()

val owners = listOf(Hash.sha3("eip155:31337:0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266".toByteArray()))
val ownerAddress = ByteArray(32) { 0 }.apply {
System.arraycopy(credentials.address.hexToByteArray(), 0, this, 12, 20)
}
val owners = listOf(ownerAddress)
val nonce = BigInteger.ZERO

val transactionReceipt = factory.createAccount(owners, nonce, BigInteger.ZERO).send()
Expand Down
5 changes: 3 additions & 2 deletions library/src/main/java/org/xmtp/android/library/Client.kt
Original file line number Diff line number Diff line change
Expand Up @@ -297,15 +297,16 @@ class Client() {
): Client {
this.hasV2Client = false
val clientOptions = options ?: ClientOptions(enableV3 = true)
val inboxId = getOrCreateInboxId(clientOptions, address)
val accountAddress = "eip155:31337:" + address.lowercase()
val inboxId = getOrCreateInboxId(clientOptions, accountAddress)

return try {
val (libXMTPClient, dbPath) = ffiXmtpClient(
clientOptions,
account,
clientOptions.appContext,
null,
address,
accountAddress,
inboxId
)

Expand Down

0 comments on commit d8e447a

Please sign in to comment.