diff --git a/android/build.gradle b/android/build.gradle
index 19442663a..4bf6199f3 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -98,7 +98,7 @@ repositories {
dependencies {
implementation project(':expo-modules-core')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}"
- implementation "org.xmtp:android:3.0.17"
+ implementation "org.xmtp:android:3.0.18"
implementation 'com.google.code.gson:gson:2.10.1'
implementation 'com.facebook.react:react-native:0.71.3'
implementation "com.daveanthonythomas.moshipack:moshipack:1.0.1"
diff --git a/android/src/main/java/expo/modules/xmtpreactnativesdk/wrappers/ConversationWrapper.kt b/android/src/main/java/expo/modules/xmtpreactnativesdk/wrappers/ConversationWrapper.kt
index 8d85ccb9b..1ea74caf4 100644
--- a/android/src/main/java/expo/modules/xmtpreactnativesdk/wrappers/ConversationWrapper.kt
+++ b/android/src/main/java/expo/modules/xmtpreactnativesdk/wrappers/ConversationWrapper.kt
@@ -7,7 +7,7 @@ import org.xmtp.android.library.Conversation
class ConversationWrapper {
companion object {
- fun encodeToObj(
+ suspend fun encodeToObj(
client: Client,
conversation: Conversation,
conversationParams: ConversationParamsWrapper = ConversationParamsWrapper(),
@@ -25,7 +25,7 @@ class ConversationWrapper {
}
}
- fun encode(
+ suspend fun encode(
client: Client,
conversation: Conversation,
conversationParams: ConversationParamsWrapper = ConversationParamsWrapper(),
diff --git a/android/src/main/java/expo/modules/xmtpreactnativesdk/wrappers/DecodedMessageWrapper.kt b/android/src/main/java/expo/modules/xmtpreactnativesdk/wrappers/DecodedMessageWrapper.kt
index 6d51552cd..ab5ac6835 100644
--- a/android/src/main/java/expo/modules/xmtpreactnativesdk/wrappers/DecodedMessageWrapper.kt
+++ b/android/src/main/java/expo/modules/xmtpreactnativesdk/wrappers/DecodedMessageWrapper.kt
@@ -22,7 +22,7 @@ class DecodedMessageWrapper {
"topic" to model.topic,
"contentTypeId" to model.encodedContent.type.description,
"content" to ContentJson(model.encodedContent).toJsonMap(),
- "senderAddress" to model.senderAddress,
+ "senderInboxId" to model.senderInboxId,
"sentNs" to model.sentNs,
"fallback" to fallback,
"deliveryStatus" to model.deliveryStatus.toString()
diff --git a/android/src/main/java/expo/modules/xmtpreactnativesdk/wrappers/DmWrapper.kt b/android/src/main/java/expo/modules/xmtpreactnativesdk/wrappers/DmWrapper.kt
index 9a690fbec..e41d2eaeb 100644
--- a/android/src/main/java/expo/modules/xmtpreactnativesdk/wrappers/DmWrapper.kt
+++ b/android/src/main/java/expo/modules/xmtpreactnativesdk/wrappers/DmWrapper.kt
@@ -6,7 +6,7 @@ import org.xmtp.android.library.Dm
class DmWrapper {
companion object {
- fun encodeToObj(
+ suspend fun encodeToObj(
client: Client,
dm: Dm,
dmParams: ConversationParamsWrapper = ConversationParamsWrapper(),
@@ -30,7 +30,7 @@ class DmWrapper {
}
}
- fun encode(
+ suspend fun encode(
client: Client,
dm: Dm,
dmParams: ConversationParamsWrapper = ConversationParamsWrapper(),
diff --git a/android/src/main/java/expo/modules/xmtpreactnativesdk/wrappers/GroupWrapper.kt b/android/src/main/java/expo/modules/xmtpreactnativesdk/wrappers/GroupWrapper.kt
index 6a0e14403..72a7bb36b 100644
--- a/android/src/main/java/expo/modules/xmtpreactnativesdk/wrappers/GroupWrapper.kt
+++ b/android/src/main/java/expo/modules/xmtpreactnativesdk/wrappers/GroupWrapper.kt
@@ -9,7 +9,7 @@ import org.xmtp.android.library.Group
class GroupWrapper {
companion object {
- fun encodeToObj(
+ suspend fun encodeToObj(
client: Client,
group: Group,
groupParams: ConversationParamsWrapper = ConversationParamsWrapper(),
@@ -37,7 +37,7 @@ class GroupWrapper {
}
}
- fun encode(
+ suspend fun encode(
client: Client,
group: Group,
groupParams: ConversationParamsWrapper = ConversationParamsWrapper(),
diff --git a/example/dev/local/test/script.js b/example/dev/local/test/script.js
index 76c7ce342..1f1f7ecdc 100644
--- a/example/dev/local/test/script.js
+++ b/example/dev/local/test/script.js
@@ -19,14 +19,14 @@ async function checkAll() {
try {
for await (const message of await client.conversations.streamAllMessages()) {
- if (message.senderAddress === wallet.address) {
+ if (message.senderInboxId === wallet.address) {
continue
}
await message.conversation.send({
- text: 'HI ' + message.senderAddress,
+ text: 'HI ' + message.senderInboxId,
})
- console.log(`Replied to ${message.senderAddress}`)
+ console.log(`Replied to ${message.senderInboxId}`)
}
} catch (e) {
console.info(`Error:`, e)
diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock
index 21fcf17c5..9ed12a86c 100644
--- a/example/ios/Podfile.lock
+++ b/example/ios/Podfile.lock
@@ -448,7 +448,7 @@ PODS:
- SQLCipher/standard (4.5.7):
- SQLCipher/common
- SwiftProtobuf (1.28.2)
- - XMTP (3.0.18):
+ - XMTP (3.0.19):
- Connect-Swift (= 1.0.0)
- CryptoSwift (= 1.8.3)
- CSecp256k1 (~> 0.2)
@@ -459,7 +459,7 @@ PODS:
- ExpoModulesCore
- MessagePacker
- SQLCipher (= 4.5.7)
- - XMTP (= 3.0.18)
+ - XMTP (= 3.0.19)
- Yoga (1.14.0)
DEPENDENCIES:
@@ -762,8 +762,8 @@ SPEC CHECKSUMS:
RNSVG: d00c8f91c3cbf6d476451313a18f04d220d4f396
SQLCipher: 5e6bfb47323635c8b657b1b27d25c5f1baf63bf5
SwiftProtobuf: 4dbaffec76a39a8dc5da23b40af1a5dc01a4c02d
- XMTP: a15bc6d07ab387b6ac70fbd3234189dc174ca024
- XMTPReactNative: 8010ff326eb0cbc69ece5ac6e9f7ca4acc9f3bf8
+ XMTP: b5311154b2a3cda7c07ce78ae9fa6d111bac979d
+ XMTPReactNative: 0d7f1d9b444eaeb3ffaf0fd29c6b71a0d6b6a29a
Yoga: e71803b4c1fff832ccf9b92541e00f9b873119b9
PODFILE CHECKSUM: 0e6fe50018f34e575d38dc6a1fdf1f99c9596cdd
diff --git a/example/src/ConversationScreen.tsx b/example/src/ConversationScreen.tsx
index 45304e7b9..64fa15036 100644
--- a/example/src/ConversationScreen.tsx
+++ b/example/src/ConversationScreen.tsx
@@ -178,8 +178,8 @@ export default function ConversationScreen({
showSender={
index === (filteredMessages || []).length - 1 ||
(index + 1 < (filteredMessages || []).length &&
- filteredMessages![index + 1].senderAddress !==
- message.senderAddress)
+ filteredMessages![index + 1].senderInboxId !==
+ message.senderInboxId)
}
/>
)}
@@ -469,8 +469,8 @@ function ReplyInputHeader({
}}
/>
- {message?.senderAddress.slice(0, 6)}…
- {message?.senderAddress.slice(-4)}
+ {message?.senderInboxId.slice(0, 6)}…
+ {message?.senderInboxId.slice(-4)}
@@ -864,8 +864,8 @@ function ReplyMessageHeader({
}}
/>
- {message.senderAddress.slice(0, 6)}…
- {message.senderAddress.slice(-4)}
+ {message.senderInboxId.slice(0, 6)}…
+ {message.senderInboxId.slice(-4)}
{typeof content !== 'string' && 'text' in content && content.text ? (
- {message.senderAddress.slice(0, 6)}…
- {message.senderAddress.slice(-4)}
+ {message.senderInboxId.slice(0, 6)}…
+ {message.senderInboxId.slice(-4)}
{moment(message.sentNs / 1000000).fromNow()}
diff --git a/example/src/GroupScreen.tsx b/example/src/GroupScreen.tsx
index 43d856377..fd8fa355e 100644
--- a/example/src/GroupScreen.tsx
+++ b/example/src/GroupScreen.tsx
@@ -180,8 +180,8 @@ export default function GroupScreen({
showSender={
index === (filteredMessages || []).length - 1 ||
(index + 1 < (filteredMessages || []).length &&
- filteredMessages![index + 1].senderAddress !==
- message.senderAddress)
+ filteredMessages![index + 1].senderInboxId !==
+ message.senderInboxId)
}
/>
)}
@@ -469,8 +469,8 @@ function ReplyInputHeader({
}}
/>
- {message?.senderAddress.slice(0, 6)}…
- {message?.senderAddress.slice(-4)}
+ {message?.senderInboxId.slice(0, 6)}…
+ {message?.senderInboxId.slice(-4)}
@@ -864,8 +864,8 @@ function ReplyMessageHeader({
}}
/>
- {message.senderAddress.slice(0, 6)}…
- {message.senderAddress.slice(-4)}
+ {message.senderInboxId.slice(0, 6)}…
+ {message.senderInboxId.slice(-4)}
{typeof content !== 'string' && 'text' in content && content.text ? (
- {message.senderAddress.slice(0, 6)}…
- {message.senderAddress.slice(-4)}
+ {message.senderInboxId.slice(0, 6)}…
+ {message.senderInboxId.slice(-4)}
{moment(message.sentNs / 1000000).fromNow()}
diff --git a/example/src/HomeScreen.tsx b/example/src/HomeScreen.tsx
index d45c57ed4..72f949582 100644
--- a/example/src/HomeScreen.tsx
+++ b/example/src/HomeScreen.tsx
@@ -150,7 +150,7 @@ function ConversationItem({
{lastMessage?.fallback}
- {lastMessage?.senderAddress}:
+ {lastMessage?.senderInboxId}:
{moment(lastMessage?.sentNs / 1000000).fromNow()}
diff --git a/example/src/hooks.tsx b/example/src/hooks.tsx
index addb8f99f..8a02b0d5c 100644
--- a/example/src/hooks.tsx
+++ b/example/src/hooks.tsx
@@ -171,7 +171,7 @@ export function useMessage({
console.log('Error refreshing messages', err)
)
}))
- const isSenderMe = message?.senderAddress === client?.address
+ const isSenderMe = message?.senderInboxId === client?.address
return {
message,
performReaction,
@@ -217,7 +217,7 @@ export function useGroupMessage({
console.log('Error refreshing messages', err)
)
}))
- const isSenderMe = message?.senderAddress === client?.address
+ const isSenderMe = message?.senderInboxId === client?.address
return {
message,
performReaction,
@@ -245,7 +245,7 @@ export function useConversationReactions({ topic }: { topic: string }) {
}>(
['xmtp', 'reactions', client?.address, topic, reactions.length],
() => {
- // SELECT messageId, reaction, senderAddress FROM reactions GROUP BY messageId, reaction
+ // SELECT messageId, reaction, senderInboxId FROM reactions GROUP BY messageId, reaction
const byId = {} as {
[messageId: string]: { [reaction: string]: string[] }
}
@@ -254,23 +254,23 @@ export function useConversationReactions({ topic }: { topic: string }) {
.slice()
.reverse()
.forEach((message) => {
- const { senderAddress } = message
+ const { senderInboxId } = message
const reaction = message.content() as ReactionContent
const messageId = reaction!.reference
const reactionText = reaction!.content
const v = byId[messageId] || ({} as { [reaction: string]: string[] })
- // DELETE FROM reactions WHERE messageId = ? AND reaction = ? AND senderAddress = ?
+ // DELETE FROM reactions WHERE messageId = ? AND reaction = ? AND senderInboxId = ?
let prior = (v[reactionText] || [])
// This removes any prior instances of the sender using this reaction.
- .filter((address) => address !== senderAddress)
+ .filter((address) => address !== senderInboxId)
if (reaction!.action === 'added') {
- // INSERT INTO reactions (messageId, reaction, senderAddress) VALUES (?, ?, ?)
- prior = prior.concat([senderAddress])
+ // INSERT INTO reactions (messageId, reaction, senderInboxId) VALUES (?, ?, ?)
+ prior = prior.concat([senderInboxId])
}
v[reactionText] = prior
byId[messageId] = v
})
- // SELECT messageId, reaction, COUNT(*) AS count, COUNT(senderAddress = ?) AS includesMe
+ // SELECT messageId, reaction, COUNT(*) AS count, COUNT(senderInboxId = ?) AS includesMe
// FROM reactions
// GROUP BY messageId, reaction
// ORDER BY count DESC
@@ -318,7 +318,7 @@ export function useGroupReactions({ groupId }: { groupId: string }) {
}>(
['xmtp', 'reactions', client?.address, groupId, reactions.length],
() => {
- // SELECT messageId, reaction, senderAddress FROM reactions GROUP BY messageId, reaction
+ // SELECT messageId, reaction, senderInboxId FROM reactions GROUP BY messageId, reaction
const byId = {} as {
[messageId: string]: { [reaction: string]: string[] }
}
@@ -327,23 +327,23 @@ export function useGroupReactions({ groupId }: { groupId: string }) {
.slice()
.reverse()
.forEach((message) => {
- const { senderAddress } = message
+ const { senderInboxId } = message
const reaction = message.content() as ReactionContent
const messageId = reaction!.reference
const reactionText = reaction!.content
const v = byId[messageId] || ({} as { [reaction: string]: string[] })
- // DELETE FROM reactions WHERE messageId = ? AND reaction = ? AND senderAddress = ?
+ // DELETE FROM reactions WHERE messageId = ? AND reaction = ? AND senderInboxId = ?
let prior = (v[reactionText] || [])
// This removes any prior instances of the sender using this reaction.
- .filter((address) => address !== senderAddress)
+ .filter((address) => address !== senderInboxId)
if (reaction!.action === 'added') {
- // INSERT INTO reactions (messageId, reaction, senderAddress) VALUES (?, ?, ?)
- prior = prior.concat([senderAddress])
+ // INSERT INTO reactions (messageId, reaction, senderInboxId) VALUES (?, ?, ?)
+ prior = prior.concat([senderInboxId])
}
v[reactionText] = prior
byId[messageId] = v
})
- // SELECT messageId, reaction, COUNT(*) AS count, COUNT(senderAddress = ?) AS includesMe
+ // SELECT messageId, reaction, COUNT(*) AS count, COUNT(senderInboxId = ?) AS includesMe
// FROM reactions
// GROUP BY messageId, reaction
// ORDER BY count DESC
diff --git a/ios/Wrappers/DecodedMessageWrapper.swift b/ios/Wrappers/DecodedMessageWrapper.swift
index 21f3bf535..f9e51e3bd 100644
--- a/ios/Wrappers/DecodedMessageWrapper.swift
+++ b/ios/Wrappers/DecodedMessageWrapper.swift
@@ -13,7 +13,7 @@ struct DecodedMessageWrapper {
"topic": model.topic,
"contentTypeId": model.encodedContent.type.description,
"content": try ContentJson.fromEncoded(model.encodedContent, client: client).toJsonMap() as Any,
- "senderAddress": model.senderAddress,
+ "senderInboxId": model.senderInboxId,
"sentNs": model.sentNs,
"fallback": fallback,
"deliveryStatus": model.deliveryStatus.rawValue.uppercased(),
diff --git a/ios/XMTPReactNative.podspec b/ios/XMTPReactNative.podspec
index 967079bbc..c5a62f4b8 100644
--- a/ios/XMTPReactNative.podspec
+++ b/ios/XMTPReactNative.podspec
@@ -26,7 +26,7 @@ Pod::Spec.new do |s|
s.source_files = "**/*.{h,m,swift}"
s.dependency "MessagePacker"
- s.dependency "XMTP", "= 3.0.18"
+ s.dependency "XMTP", "= 3.0.19"
s.dependency 'CSecp256k1', '~> 0.2'
s.dependency "SQLCipher", "= 4.5.7"
end
diff --git a/src/lib/DecodedMessage.ts b/src/lib/DecodedMessage.ts
index f5dd48976..6915c5f84 100644
--- a/src/lib/DecodedMessage.ts
+++ b/src/lib/DecodedMessage.ts
@@ -1,11 +1,12 @@
import { Buffer } from 'buffer'
-import { Client, ExtractDecodedType } from './Client'
+import { Client, ExtractDecodedType, InboxId } from './Client'
import {
JSContentCodec,
NativeContentCodec,
NativeMessageContent,
} from './ContentCodec'
+import { ConversationTopic, MessageId } from './types'
import { DecodedMessageUnion } from './types/DecodedMessageUnion'
import { DefaultContentTypes } from './types/DefaultContentType'
@@ -25,10 +26,10 @@ export class DecodedMessage<
ContentTypes extends DefaultContentTypes = DefaultContentTypes,
> {
client: Client
- id: string
- topic: string
+ id: MessageId
+ topic: ConversationTopic
contentTypeId: string
- senderAddress: string
+ senderInboxId: InboxId
sentNs: number // timestamp in nanoseconds
nativeContent: NativeMessageContent
fallback: string | undefined
@@ -48,7 +49,7 @@ export class DecodedMessage<
decoded.id,
decoded.topic,
decoded.contentTypeId,
- decoded.senderAddress,
+ decoded.senderInboxId,
decoded.sentNs,
decoded.content,
decoded.fallback,
@@ -62,10 +63,10 @@ export class DecodedMessage<
ContentTypes extends DefaultContentTypes = [ContentType],
>(
object: {
- id: string
- topic: string
+ id: MessageId
+ topic: ConversationTopic
contentTypeId: string
- senderAddress: string
+ senderInboxId: InboxId
sentNs: number // timestamp in nanoseconds
content: any
fallback: string | undefined
@@ -78,7 +79,7 @@ export class DecodedMessage<
object.id,
object.topic,
object.contentTypeId,
- object.senderAddress,
+ object.senderInboxId,
object.sentNs,
object.content,
object.fallback,
@@ -88,10 +89,10 @@ export class DecodedMessage<
constructor(
client: Client,
- id: string,
- topic: string,
+ id: MessageId,
+ topic: ConversationTopic,
contentTypeId: string,
- senderAddress: string,
+ senderInboxId: InboxId,
sentNs: number,
content: any,
fallback: string | undefined,
@@ -101,7 +102,7 @@ export class DecodedMessage<
this.id = id
this.topic = topic
this.contentTypeId = contentTypeId
- this.senderAddress = senderAddress
+ this.senderInboxId = senderInboxId
this.sentNs = sentNs
this.nativeContent = content
// undefined comes back as null when bridged, ensure undefined so integrators don't have to add a new check for null as well