@hybrd/xmtp 1.3.2 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/README.md +41 -7
  2. package/dist/index.cjs +415 -3085
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.cts +12 -828
  5. package/dist/index.d.ts +12 -828
  6. package/dist/index.js +416 -3056
  7. package/dist/index.js.map +1 -1
  8. package/package.json +18 -5
  9. package/src/client.ts +23 -135
  10. package/src/index.ts +28 -81
  11. package/src/index.ts.old +145 -0
  12. package/src/lib/jwt.ts +45 -13
  13. package/src/lib/{message-listener.test.ts → message-listener.test.ts.old} +1 -1
  14. package/src/lib/subjects.ts +6 -5
  15. package/src/plugin.filters.test.ts +158 -0
  16. package/src/plugin.ts +456 -23
  17. package/src/resolver/address-resolver.ts +217 -211
  18. package/src/resolver/basename-resolver.ts +6 -5
  19. package/src/resolver/ens-resolver.ts +15 -14
  20. package/src/resolver/resolver.ts +3 -2
  21. package/src/resolver/xmtp-resolver.ts +10 -9
  22. package/src/{service-client.ts → service-client.ts.old} +26 -3
  23. package/src/types.ts +9 -157
  24. package/src/types.ts.old +157 -0
  25. package/.cache/tsbuildinfo.json +0 -1
  26. package/.turbo/turbo-build.log +0 -45
  27. package/.turbo/turbo-lint$colon$fix.log +0 -6
  28. package/.turbo/turbo-typecheck.log +0 -5
  29. package/biome.jsonc +0 -4
  30. package/scripts/generate-keys.ts +0 -25
  31. package/scripts/refresh-identity.ts +0 -119
  32. package/scripts/register-wallet.ts +0 -95
  33. package/scripts/revoke-all-installations.ts +0 -91
  34. package/scripts/revoke-installations.ts +0 -94
  35. package/src/endpoints.ts +0 -306
  36. package/tsconfig.json +0 -9
  37. package/tsup.config.ts +0 -14
  38. /package/src/lib/{message-listener.ts → message-listener.ts.old} +0 -0
@@ -1,221 +1,227 @@
1
1
  import type { XmtpClient } from "../types"
2
+ import { logger } from "@hybrd/utils"
2
3
 
3
4
  interface AddressResolverOptions {
4
- /**
5
- * Maximum number of addresses to cache
6
- * @default 1000
7
- */
8
- maxCacheSize?: number
9
- /**
10
- * Cache TTL in milliseconds
11
- * @default 86400000 (24 hours)
12
- */
13
- cacheTtl?: number
5
+ /**
6
+ * Maximum number of addresses to cache
7
+ * @default 1000
8
+ */
9
+ maxCacheSize?: number
10
+ /**
11
+ * Cache TTL in milliseconds
12
+ * @default 86400000 (24 hours)
13
+ */
14
+ cacheTtl?: number
14
15
  }
15
16
 
16
17
  interface CacheEntry {
17
- address: string
18
- timestamp: number
18
+ address: string
19
+ timestamp: number
19
20
  }
20
21
 
21
22
  export class AddressResolver {
22
- private cache = new Map<string, CacheEntry>()
23
- private readonly maxCacheSize: number
24
- private readonly cacheTtl: number
25
-
26
- constructor(
27
- private client: XmtpClient,
28
- options: AddressResolverOptions = {}
29
- ) {
30
- this.maxCacheSize = options.maxCacheSize ?? 1000
31
- this.cacheTtl = options.cacheTtl ?? 86400000 // 24 hours
32
- }
33
-
34
- /**
35
- * Resolve user address from inbox ID with caching
36
- */
37
- async resolveAddress(
38
- inboxId: string,
39
- conversationId?: string
40
- ): Promise<`0x${string}` | null> {
41
- // Check cache first (fastest)
42
- const cached = this.getCachedAddress(inboxId)
43
- if (cached) {
44
- console.log(`✅ Resolved user address from cache: ${cached}`)
45
- return cached
46
- }
47
-
48
- let userAddress = undefined
49
-
50
- try {
51
- // Try conversation members lookup first (faster than network call)
52
- if (conversationId) {
53
- const conversation =
54
- await this.client.conversations.getConversationById(conversationId)
55
- if (conversation) {
56
- userAddress = await this.resolveFromConversation(
57
- conversation,
58
- inboxId
59
- )
60
- if (userAddress) {
61
- this.setCachedAddress(inboxId, userAddress)
62
- console.log(`✅ Resolved user address: ${userAddress}`)
63
- return userAddress
64
- }
65
- }
66
- }
67
-
68
- // Fallback to inboxStateFromInboxIds
69
- userAddress = await this.resolveFromInboxState(inboxId)
70
- if (userAddress) {
71
- this.setCachedAddress(inboxId, userAddress)
72
- console.log(`✅ Resolved user address via fallback: ${userAddress}`)
73
- return userAddress
74
- }
75
-
76
- console.log(`⚠️ No identifiers found for inbox ${inboxId}`)
77
- return null
78
- } catch (error) {
79
- console.error(`❌ Error resolving user address for ${inboxId}:`, error)
80
- return null
81
- }
82
- }
83
-
84
- /**
85
- * Resolve address from conversation members
86
- */
87
- private async resolveFromConversation(
88
- conversation: any,
89
- inboxId: string
90
- ): Promise<`0x${string}` | null> {
91
- try {
92
- const members = await conversation.members()
93
- const sender = members.find(
94
- (member: any) => member.inboxId.toLowerCase() === inboxId.toLowerCase()
95
- )
96
-
97
- if (sender) {
98
- const ethIdentifier = sender.accountIdentifiers.find(
99
- (id: any) => id.identifierKind === 0 // IdentifierKind.Ethereum
100
- )
101
- if (ethIdentifier) {
102
- return ethIdentifier.identifier
103
- } else {
104
- console.log(`⚠️ No Ethereum identifier found for inbox ${inboxId}`)
105
- }
106
- } else {
107
- console.log(
108
- `⚠️ Sender not found in conversation members for inbox ${inboxId}`
109
- )
110
- }
111
- } catch (error) {
112
- console.error(`❌ Error resolving from conversation members:`, error)
113
- }
114
-
115
- return null
116
- }
117
-
118
- /**
119
- * Resolve address from inbox state (network fallback)
120
- */
121
- private async resolveFromInboxState(inboxId: string): Promise<`0x${string}` | null> {
122
- try {
123
- const inboxState = await this.client.preferences.inboxStateFromInboxIds([
124
- inboxId
125
- ])
126
- const firstState = inboxState?.[0]
127
- if (firstState?.identifiers && firstState.identifiers.length > 0) {
128
- const firstIdentifier = firstState.identifiers[0]
129
- return firstIdentifier?.identifier as `0x${string}`
130
- }
131
- } catch (error) {
132
- console.error(`❌ Error resolving from inbox state:`, error)
133
- }
134
-
135
- return null
136
- }
137
-
138
- /**
139
- * Get cached address if not expired
140
- */
141
- private getCachedAddress(inboxId: string): `0x${string}` | null {
142
- const entry = this.cache.get(inboxId)
143
- if (!entry) return null
144
-
145
- const now = Date.now()
146
- if (now - entry.timestamp > this.cacheTtl) {
147
- this.cache.delete(inboxId)
148
- return null
149
- }
150
-
151
- return entry.address as `0x${string}`
152
- }
153
-
154
- /**
155
- * Cache address with LRU eviction
156
- */
157
- private setCachedAddress(inboxId: string, address: `0x${string}`): void {
158
- // Simple LRU: if cache is full, remove oldest entry
159
- if (this.cache.size >= this.maxCacheSize) {
160
- const firstKey = this.cache.keys().next().value
161
- if (firstKey) {
162
- this.cache.delete(firstKey)
163
- }
164
- }
165
-
166
- this.cache.set(inboxId, {
167
- address,
168
- timestamp: Date.now()
169
- })
170
- }
171
-
172
- /**
173
- * Pre-populate cache from existing conversations
174
- */
175
- async prePopulateCache(): Promise<void> {
176
- console.log("🔄 Pre-populating address cache...")
177
- try {
178
- const conversations = await this.client.conversations.list()
179
- let cachedCount = 0
180
-
181
- for (const conversation of conversations) {
182
- try {
183
- const members = await conversation.members()
184
- for (const member of members) {
185
- const ethIdentifier = member.accountIdentifiers.find(
186
- (id: any) => id.identifierKind === 0 // IdentifierKind.Ethereum
187
- )
188
- if (ethIdentifier) {
189
- this.setCachedAddress(member.inboxId, ethIdentifier.identifier as `0x${string}`)
190
- cachedCount++
191
- }
192
- }
193
- } catch (error) {
194
- console.error("Error pre-caching conversation members:", error)
195
- }
196
- }
197
-
198
- console.log(`✅ Pre-cached ${cachedCount} address mappings`)
199
- } catch (error) {
200
- console.error("Error pre-populating cache:", error)
201
- }
202
- }
203
-
204
- /**
205
- * Clear the cache
206
- */
207
- clearCache(): void {
208
- this.cache.clear()
209
- console.log("🗑️ Address cache cleared")
210
- }
211
-
212
- /**
213
- * Get cache statistics
214
- */
215
- getCacheStats(): { size: number; maxSize: number; hitRate?: number } {
216
- return {
217
- size: this.cache.size,
218
- maxSize: this.maxCacheSize
219
- }
220
- }
23
+ private cache = new Map<string, CacheEntry>()
24
+ private readonly maxCacheSize: number
25
+ private readonly cacheTtl: number
26
+
27
+ constructor(
28
+ private client: XmtpClient,
29
+ options: AddressResolverOptions = {}
30
+ ) {
31
+ this.maxCacheSize = options.maxCacheSize ?? 1000
32
+ this.cacheTtl = options.cacheTtl ?? 86400000 // 24 hours
33
+ }
34
+
35
+ /**
36
+ * Resolve user address from inbox ID with caching
37
+ */
38
+ async resolveAddress(
39
+ inboxId: string,
40
+ conversationId?: string
41
+ ): Promise<`0x${string}` | null> {
42
+ // Check cache first (fastest)
43
+ const cached = this.getCachedAddress(inboxId)
44
+ if (cached) {
45
+ logger.debug(`✅ Resolved user address from cache: ${cached}`)
46
+ return cached
47
+ }
48
+
49
+ let userAddress = undefined
50
+
51
+ try {
52
+ // Try conversation members lookup first (faster than network call)
53
+ if (conversationId) {
54
+ const conversation =
55
+ await this.client.conversations.getConversationById(conversationId)
56
+ if (conversation) {
57
+ userAddress = await this.resolveFromConversation(
58
+ conversation,
59
+ inboxId
60
+ )
61
+ if (userAddress) {
62
+ this.setCachedAddress(inboxId, userAddress)
63
+ logger.debug(`✅ Resolved user address: ${userAddress}`)
64
+ return userAddress
65
+ }
66
+ }
67
+ }
68
+
69
+ // Fallback to inboxStateFromInboxIds
70
+ userAddress = await this.resolveFromInboxState(inboxId)
71
+ if (userAddress) {
72
+ this.setCachedAddress(inboxId, userAddress)
73
+ logger.debug(`✅ Resolved user address via fallback: ${userAddress}`)
74
+ return userAddress
75
+ }
76
+
77
+ logger.debug(`⚠️ No identifiers found for inbox ${inboxId}`)
78
+ return null
79
+ } catch (error) {
80
+ console.error(`❌ Error resolving user address for ${inboxId}:`, error)
81
+ return null
82
+ }
83
+ }
84
+
85
+ /**
86
+ * Resolve address from conversation members
87
+ */
88
+ private async resolveFromConversation(
89
+ conversation: any,
90
+ inboxId: string
91
+ ): Promise<`0x${string}` | null> {
92
+ try {
93
+ const members = await conversation.members()
94
+ const sender = members.find(
95
+ (member: any) => member.inboxId.toLowerCase() === inboxId.toLowerCase()
96
+ )
97
+
98
+ if (sender) {
99
+ const ethIdentifier = sender.accountIdentifiers.find(
100
+ (id: any) => id.identifierKind === 0 // IdentifierKind.Ethereum
101
+ )
102
+ if (ethIdentifier) {
103
+ return ethIdentifier.identifier
104
+ } else {
105
+ logger.debug(`⚠️ No Ethereum identifier found for inbox ${inboxId}`)
106
+ }
107
+ } else {
108
+ logger.debug(
109
+ `⚠️ Sender not found in conversation members for inbox ${inboxId}`
110
+ )
111
+ }
112
+ } catch (error) {
113
+ console.error(`❌ Error resolving from conversation members:`, error)
114
+ }
115
+
116
+ return null
117
+ }
118
+
119
+ /**
120
+ * Resolve address from inbox state (network fallback)
121
+ */
122
+ private async resolveFromInboxState(
123
+ inboxId: string
124
+ ): Promise<`0x${string}` | null> {
125
+ try {
126
+ const inboxState = await this.client.preferences.inboxStateFromInboxIds([
127
+ inboxId
128
+ ])
129
+ const firstState = inboxState?.[0]
130
+ if (firstState?.identifiers && firstState.identifiers.length > 0) {
131
+ const firstIdentifier = firstState.identifiers[0]
132
+ return firstIdentifier?.identifier as `0x${string}`
133
+ }
134
+ } catch (error) {
135
+ console.error(`❌ Error resolving from inbox state:`, error)
136
+ }
137
+
138
+ return null
139
+ }
140
+
141
+ /**
142
+ * Get cached address if not expired
143
+ */
144
+ private getCachedAddress(inboxId: string): `0x${string}` | null {
145
+ const entry = this.cache.get(inboxId)
146
+ if (!entry) return null
147
+
148
+ const now = Date.now()
149
+ if (now - entry.timestamp > this.cacheTtl) {
150
+ this.cache.delete(inboxId)
151
+ return null
152
+ }
153
+
154
+ return entry.address as `0x${string}`
155
+ }
156
+
157
+ /**
158
+ * Cache address with LRU eviction
159
+ */
160
+ private setCachedAddress(inboxId: string, address: `0x${string}`): void {
161
+ // Simple LRU: if cache is full, remove oldest entry
162
+ if (this.cache.size >= this.maxCacheSize) {
163
+ const firstKey = this.cache.keys().next().value
164
+ if (firstKey) {
165
+ this.cache.delete(firstKey)
166
+ }
167
+ }
168
+
169
+ this.cache.set(inboxId, {
170
+ address,
171
+ timestamp: Date.now()
172
+ })
173
+ }
174
+
175
+ /**
176
+ * Pre-populate cache from existing conversations
177
+ */
178
+ async prePopulateCache(): Promise<void> {
179
+ logger.debug("🔄 Pre-populating address cache...")
180
+ try {
181
+ const conversations = await this.client.conversations.list()
182
+ let cachedCount = 0
183
+
184
+ for (const conversation of conversations) {
185
+ try {
186
+ const members = await conversation.members()
187
+ for (const member of members) {
188
+ const ethIdentifier = member.accountIdentifiers.find(
189
+ (id: any) => id.identifierKind === 0 // IdentifierKind.Ethereum
190
+ )
191
+ if (ethIdentifier) {
192
+ this.setCachedAddress(
193
+ member.inboxId,
194
+ ethIdentifier.identifier as `0x${string}`
195
+ )
196
+ cachedCount++
197
+ }
198
+ }
199
+ } catch (error) {
200
+ console.error("Error pre-caching conversation members:", error)
201
+ }
202
+ }
203
+
204
+ logger.debug(`✅ Pre-cached ${cachedCount} address mappings`)
205
+ } catch (error) {
206
+ console.error("Error pre-populating cache:", error)
207
+ }
208
+ }
209
+
210
+ /**
211
+ * Clear the cache
212
+ */
213
+ clearCache(): void {
214
+ this.cache.clear()
215
+ logger.debug("🗑️ Address cache cleared")
216
+ }
217
+
218
+ /**
219
+ * Get cache statistics
220
+ */
221
+ getCacheStats(): { size: number; maxSize: number; hitRate?: number } {
222
+ return {
223
+ size: this.cache.size,
224
+ maxSize: this.maxCacheSize
225
+ }
226
+ }
221
227
  }
@@ -7,6 +7,7 @@ import {
7
7
  } from "viem"
8
8
  import { mainnet } from "viem/chains"
9
9
  import { L2ResolverAbi } from "../abi/l2_resolver"
10
+ import { logger } from "@hybrd/utils"
10
11
 
11
12
  // Base L2 Resolver Address mapping by chain ID
12
13
  // const BASENAME_L2_RESOLVER_ADDRESSES: Record<number, Address> = {
@@ -139,23 +140,23 @@ export class BasenameResolver {
139
140
  */
140
141
  private async initializeResolver(): Promise<void> {
141
142
  if (this.resolverAddress && this.chainId) {
142
- console.log(
143
+ logger.debug(
143
144
  `🔄 BasenameResolver already initialized for chain ${this.chainId} with resolver ${this.resolverAddress}`
144
145
  )
145
146
  return
146
147
  }
147
148
 
148
149
  try {
149
- console.log("🔄 Initializing BasenameResolver...")
150
+ logger.debug("🔄 Initializing BasenameResolver...")
150
151
  this.chainId = await this.baseClient.getChainId()
151
- console.log(`🔗 Chain ID detected: ${this.chainId}`)
152
+ logger.debug(`🔗 Chain ID detected: ${this.chainId}`)
152
153
 
153
154
  this.resolverAddress = getResolverAddress()
154
- console.log(
155
+ logger.debug(
155
156
  `📍 Resolver address for chain ${this.chainId}: ${this.resolverAddress}`
156
157
  )
157
158
 
158
- console.log(
159
+ logger.debug(
159
160
  `✅ Initialized BasenameResolver for chain ${this.chainId} with resolver ${this.resolverAddress}`
160
161
  )
161
162
  } catch (error) {
@@ -1,4 +1,5 @@
1
1
  import { type Address, PublicClient } from "viem"
2
+ import { logger } from "@hybrd/utils"
2
3
 
3
4
  interface ENSResolverOptions {
4
5
  /**
@@ -48,33 +49,33 @@ export class ENSResolver {
48
49
  * Resolve an ENS name to an Ethereum address
49
50
  */
50
51
  async resolveENSName(ensName: string): Promise<Address | null> {
51
- console.log(`🔍 Resolving ENS name: ${ensName}`)
52
+ logger.debug(`🔍 Resolving ENS name: ${ensName}`)
52
53
 
53
54
  try {
54
55
  // Check cache first
55
56
  const cached = this.getCachedAddress(ensName)
56
57
  if (cached) {
57
- console.log(`✅ Resolved ENS from cache: ${ensName} → ${cached}`)
58
+ logger.debug(`✅ Resolved ENS from cache: ${ensName} → ${cached}`)
58
59
  return cached as Address
59
60
  }
60
61
 
61
- console.log(`📭 No cached address found for ENS: ${ensName}`)
62
+ logger.debug(`📭 No cached address found for ENS: ${ensName}`)
62
63
 
63
64
  // Resolve using mainnet ENS
64
- console.log("🔄 Reading ENS contract...")
65
+ logger.debug("🔄 Reading ENS contract...")
65
66
  const address = await this.mainnetClient.getEnsAddress({
66
67
  name: ensName
67
68
  })
68
69
 
69
- console.log(`📋 ENS contract returned address: "${address}"`)
70
+ logger.debug(`📋 ENS contract returned address: "${address}"`)
70
71
 
71
72
  if (address && address !== "0x0000000000000000000000000000000000000000") {
72
73
  this.setCachedAddress(ensName, address)
73
- console.log(`✅ Resolved ENS: ${ensName} → ${address}`)
74
+ logger.debug(`✅ Resolved ENS: ${ensName} → ${address}`)
74
75
  return address
75
76
  }
76
77
 
77
- console.log(`❌ No address found for ENS: ${ensName}`)
78
+ logger.debug(`❌ No address found for ENS: ${ensName}`)
78
79
  return null
79
80
  } catch (error) {
80
81
  console.error(`❌ Error resolving ENS name ${ensName}:`, error)
@@ -89,35 +90,35 @@ export class ENSResolver {
89
90
  * Resolve an address to its primary ENS name (reverse resolution)
90
91
  */
91
92
  async resolveAddressToENS(address: Address): Promise<string | null> {
92
- console.log(`🔍 Reverse resolving address to ENS: ${address}`)
93
+ logger.debug(`🔍 Reverse resolving address to ENS: ${address}`)
93
94
 
94
95
  try {
95
96
  // Check cache first
96
97
  const cached = this.getCachedENSName(address)
97
98
  if (cached) {
98
- console.log(
99
+ logger.debug(
99
100
  `✅ Resolved ENS from reverse cache: ${address} → ${cached}`
100
101
  )
101
102
  return cached
102
103
  }
103
104
 
104
- console.log(`📭 No cached ENS name found for address: ${address}`)
105
+ logger.debug(`📭 No cached ENS name found for address: ${address}`)
105
106
 
106
107
  // Reverse resolve using mainnet ENS
107
- console.log("🔄 Reading ENS reverse resolver...")
108
+ logger.debug("🔄 Reading ENS reverse resolver...")
108
109
  const ensName = await this.mainnetClient.getEnsName({
109
110
  address: address
110
111
  })
111
112
 
112
- console.log(`📋 ENS reverse resolver returned: "${ensName}"`)
113
+ logger.debug(`📋 ENS reverse resolver returned: "${ensName}"`)
113
114
 
114
115
  if (ensName && ensName.length > 0) {
115
116
  this.setCachedENSName(address, ensName)
116
- console.log(`✅ Reverse resolved: ${address} → ${ensName}`)
117
+ logger.debug(`✅ Reverse resolved: ${address} → ${ensName}`)
117
118
  return ensName
118
119
  }
119
120
 
120
- console.log(`❌ No ENS name found for address: ${address}`)
121
+ logger.debug(`❌ No ENS name found for address: ${address}`)
121
122
  return null
122
123
  } catch (error) {
123
124
  console.error(`❌ Error reverse resolving address ${address}:`, error)
@@ -8,6 +8,7 @@ import {
8
8
  } from "./basename-resolver"
9
9
  import { ENSResolver } from "./ens-resolver"
10
10
  import { XmtpResolver } from "./xmtp-resolver"
11
+ import { logger } from "@hybrd/utils"
11
12
 
12
13
  interface ResolverOptions {
13
14
  /**
@@ -293,14 +294,14 @@ export class Resolver {
293
294
  if (address) {
294
295
  // Try basename first since that's what we expect for this address
295
296
  const basenameResult = await this.getBasename(address)
296
- console.log(
297
+ logger.debug(
297
298
  `🔍 [RESOLVER] Direct basename lookup for ${address}:`,
298
299
  basenameResult
299
300
  )
300
301
 
301
302
  // Try to get a human-readable name
302
303
  const resolvedName = await this.resolveAddressToName(address)
303
- console.log(
304
+ logger.debug(
304
305
  `🔍 [RESOLVER] Universal name resolution for ${address}:`,
305
306
  resolvedName
306
307
  )
@@ -1,4 +1,5 @@
1
1
  import type { XmtpClient, XmtpMessage } from "../types"
2
+ import { logger } from "@hybrd/utils"
2
3
 
3
4
  interface XmtpResolverOptions {
4
5
  /**
@@ -61,7 +62,7 @@ export class XmtpResolver {
61
62
  // Check cache first (fastest)
62
63
  const cached = this.getCachedAddress(inboxId)
63
64
  if (cached) {
64
- console.log(
65
+ logger.debug(
65
66
  `✅ [XmtpResolver] Resolved user address from cache: ${cached}`
66
67
  )
67
68
  return cached
@@ -81,7 +82,7 @@ export class XmtpResolver {
81
82
  )
82
83
  if (userAddress) {
83
84
  this.setCachedAddress(inboxId, userAddress)
84
- console.log(
85
+ logger.debug(
85
86
  `✅ [XmtpResolver] Resolved user address: ${userAddress}`
86
87
  )
87
88
  return userAddress
@@ -93,13 +94,13 @@ export class XmtpResolver {
93
94
  userAddress = await this.resolveFromInboxState(inboxId)
94
95
  if (userAddress) {
95
96
  this.setCachedAddress(inboxId, userAddress)
96
- console.log(
97
+ logger.debug(
97
98
  `✅ [XmtpResolver] Resolved user address via fallback: ${userAddress}`
98
99
  )
99
100
  return userAddress
100
101
  }
101
102
 
102
- console.log(`⚠️ [XmtpResolver] No identifiers found for inbox ${inboxId}`)
103
+ logger.debug(`⚠️ [XmtpResolver] No identifiers found for inbox ${inboxId}`)
103
104
  return null
104
105
  } catch (error) {
105
106
  console.error(
@@ -117,7 +118,7 @@ export class XmtpResolver {
117
118
  // Check cache first
118
119
  const cached = this.getCachedMessage(messageId)
119
120
  if (cached !== undefined) {
120
- console.log(
121
+ logger.debug(
121
122
  cached
122
123
  ? `✅ [XmtpResolver] Found message from cache: ${cached.id}`
123
124
  : `✅ [XmtpResolver] Found cached null message for: ${messageId}`
@@ -126,16 +127,16 @@ export class XmtpResolver {
126
127
  }
127
128
 
128
129
  try {
129
- console.log(`🔍 [XmtpResolver] Finding message: ${messageId}`)
130
+ logger.debug(`🔍 [XmtpResolver] Finding message: ${messageId}`)
130
131
  const message = await this.client.conversations.getMessageById(messageId)
131
132
 
132
133
  if (message) {
133
134
  this.setCachedMessage(messageId, message)
134
- console.log(`✅ [XmtpResolver] Found and cached message: ${message.id}`)
135
+ logger.debug(`✅ [XmtpResolver] Found and cached message: ${message.id}`)
135
136
  return message
136
137
  }
137
138
 
138
- console.log(`⚠️ [XmtpResolver] Message not found: ${messageId}`)
139
+ logger.debug(`⚠️ [XmtpResolver] Message not found: ${messageId}`)
139
140
  this.setCachedMessage(messageId, null)
140
141
  return null
141
142
  } catch (error) {
@@ -156,7 +157,7 @@ export class XmtpResolver {
156
157
  const rootCacheKey = `root:${messageId}`
157
158
  const cached = this.getCachedMessage(rootCacheKey)
158
159
  if (cached !== undefined) {
159
- console.log(
160
+ logger.debug(
160
161
  cached
161
162
  ? `✅ [XmtpResolver] Found root message from cache: ${cached.id}`
162
163
  : `✅ [XmtpResolver] Found cached null root for: ${messageId}`