@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.
- package/README.md +41 -7
- package/dist/index.cjs +415 -3085
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -828
- package/dist/index.d.ts +12 -828
- package/dist/index.js +416 -3056
- package/dist/index.js.map +1 -1
- package/package.json +18 -5
- package/src/client.ts +23 -135
- package/src/index.ts +28 -81
- package/src/index.ts.old +145 -0
- package/src/lib/jwt.ts +45 -13
- package/src/lib/{message-listener.test.ts → message-listener.test.ts.old} +1 -1
- package/src/lib/subjects.ts +6 -5
- package/src/plugin.filters.test.ts +158 -0
- package/src/plugin.ts +456 -23
- package/src/resolver/address-resolver.ts +217 -211
- package/src/resolver/basename-resolver.ts +6 -5
- package/src/resolver/ens-resolver.ts +15 -14
- package/src/resolver/resolver.ts +3 -2
- package/src/resolver/xmtp-resolver.ts +10 -9
- package/src/{service-client.ts → service-client.ts.old} +26 -3
- package/src/types.ts +9 -157
- package/src/types.ts.old +157 -0
- package/.cache/tsbuildinfo.json +0 -1
- package/.turbo/turbo-build.log +0 -45
- package/.turbo/turbo-lint$colon$fix.log +0 -6
- package/.turbo/turbo-typecheck.log +0 -5
- package/biome.jsonc +0 -4
- package/scripts/generate-keys.ts +0 -25
- package/scripts/refresh-identity.ts +0 -119
- package/scripts/register-wallet.ts +0 -95
- package/scripts/revoke-all-installations.ts +0 -91
- package/scripts/revoke-installations.ts +0 -94
- package/src/endpoints.ts +0 -306
- package/tsconfig.json +0 -9
- package/tsup.config.ts +0 -14
- /package/src/lib/{message-listener.ts → message-listener.ts.old} +0 -0
package/package.json
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hybrd/xmtp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"type": "module",
|
|
5
|
+
"files": [
|
|
6
|
+
"dist",
|
|
7
|
+
"src"
|
|
8
|
+
],
|
|
9
|
+
"types": "dist/index.d.ts",
|
|
10
|
+
"main": "dist/index.cjs",
|
|
11
|
+
"module": "dist/index.js",
|
|
5
12
|
"exports": {
|
|
6
13
|
".": {
|
|
7
14
|
"types": "./dist/index.d.ts",
|
|
@@ -10,29 +17,35 @@
|
|
|
10
17
|
}
|
|
11
18
|
},
|
|
12
19
|
"dependencies": {
|
|
20
|
+
"@xmtp/agent-sdk": "0.0.14",
|
|
13
21
|
"@xmtp/content-type-group-updated": "2.0.2",
|
|
14
22
|
"@xmtp/content-type-reaction": "2.0.2",
|
|
15
23
|
"@xmtp/content-type-reply": "2.0.2",
|
|
16
24
|
"@xmtp/content-type-text": "2.0.2",
|
|
17
25
|
"@xmtp/content-type-transaction-reference": "2.0.2",
|
|
18
26
|
"@xmtp/content-type-wallet-send-calls": "2.0.0",
|
|
19
|
-
"@xmtp/node-sdk": "^4.0
|
|
27
|
+
"@xmtp/node-sdk": "^4.1.0",
|
|
20
28
|
"hono": "^4.7.4",
|
|
21
29
|
"jsonwebtoken": "^9.0.2",
|
|
22
30
|
"uint8arrays": "^5.1.0",
|
|
23
|
-
"viem": "^2.22.17"
|
|
31
|
+
"viem": "^2.22.17",
|
|
32
|
+
"@hybrd/utils": "1.4.0",
|
|
33
|
+
"@hybrd/types": "1.4.0"
|
|
24
34
|
},
|
|
25
35
|
"devDependencies": {
|
|
26
36
|
"@types/jsonwebtoken": "^9.0.7",
|
|
27
37
|
"@types/node": "22.8.6",
|
|
28
38
|
"tsup": "^8.5.0",
|
|
29
39
|
"vitest": "^3.2.4",
|
|
30
|
-
"@config/
|
|
31
|
-
"@config/
|
|
40
|
+
"@config/tsconfig": "0.0.0",
|
|
41
|
+
"@config/biome": "0.0.0"
|
|
32
42
|
},
|
|
33
43
|
"scripts": {
|
|
34
44
|
"build": "tsup",
|
|
45
|
+
"build:watch": "tsup --watch",
|
|
35
46
|
"clean": "rm -rf .turbo dist",
|
|
47
|
+
"test": "vitest run",
|
|
48
|
+
"test:watch": "vitest",
|
|
36
49
|
"typecheck": "tsc --noEmit",
|
|
37
50
|
"lint": "biome lint --unsafe",
|
|
38
51
|
"lint:fix": "biome lint --write --unsafe",
|
package/src/client.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { logger } from "@hybrd/utils"
|
|
1
2
|
import { ReactionCodec } from "@xmtp/content-type-reaction"
|
|
2
3
|
import { ReplyCodec } from "@xmtp/content-type-reply"
|
|
3
4
|
import { TransactionReferenceCodec } from "@xmtp/content-type-transaction-reference"
|
|
@@ -73,7 +74,7 @@ export const createSigner = (key: string): Signer => {
|
|
|
73
74
|
|
|
74
75
|
// Function to clear XMTP database when hitting installation limits
|
|
75
76
|
async function clearXMTPDatabase(address: string, env: string) {
|
|
76
|
-
|
|
77
|
+
logger.debug("🧹 Clearing XMTP database to resolve installation limit...")
|
|
77
78
|
|
|
78
79
|
// Get the storage directory using the same logic as getDbPath
|
|
79
80
|
const getStorageDirectory = () => {
|
|
@@ -120,9 +121,9 @@ async function clearXMTPDatabase(address: string, env: string) {
|
|
|
120
121
|
const fullPath = path.join(dir, file)
|
|
121
122
|
try {
|
|
122
123
|
fs.unlinkSync(fullPath)
|
|
123
|
-
|
|
124
|
+
logger.debug(`✅ Removed: ${fullPath}`)
|
|
124
125
|
} catch (err) {
|
|
125
|
-
|
|
126
|
+
logger.debug(`⚠️ Could not remove ${fullPath}:`, err)
|
|
126
127
|
}
|
|
127
128
|
}
|
|
128
129
|
}
|
|
@@ -133,7 +134,6 @@ async function clearXMTPDatabase(address: string, env: string) {
|
|
|
133
134
|
}
|
|
134
135
|
|
|
135
136
|
export async function createXMTPClient(
|
|
136
|
-
// signer: Signer,
|
|
137
137
|
privateKey: string,
|
|
138
138
|
opts?: {
|
|
139
139
|
persist?: boolean
|
|
@@ -154,7 +154,7 @@ export async function createXMTPClient(
|
|
|
154
154
|
)
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
-
const {
|
|
157
|
+
const { XMTP_DB_ENCRYPTION_KEY, XMTP_ENV } = process.env
|
|
158
158
|
|
|
159
159
|
// Get the wallet address to use the correct database
|
|
160
160
|
const identifier = await signer.getIdentifier()
|
|
@@ -162,7 +162,7 @@ export async function createXMTPClient(
|
|
|
162
162
|
|
|
163
163
|
while (attempt < maxRetries) {
|
|
164
164
|
try {
|
|
165
|
-
|
|
165
|
+
logger.debug(
|
|
166
166
|
`🔄 Attempt ${attempt + 1}/${maxRetries} to create XMTP client...`
|
|
167
167
|
)
|
|
168
168
|
|
|
@@ -175,16 +175,18 @@ export async function createXMTPClient(
|
|
|
175
175
|
)
|
|
176
176
|
}
|
|
177
177
|
|
|
178
|
-
if (!
|
|
179
|
-
throw new Error(
|
|
178
|
+
if (!XMTP_DB_ENCRYPTION_KEY) {
|
|
179
|
+
throw new Error(
|
|
180
|
+
"XMTP_DB_ENCRYPTION_KEY must be set for persistent mode"
|
|
181
|
+
)
|
|
180
182
|
}
|
|
181
183
|
|
|
182
|
-
const dbEncryptionKey = getEncryptionKeyFromHex(
|
|
184
|
+
const dbEncryptionKey = getEncryptionKeyFromHex(XMTP_DB_ENCRYPTION_KEY)
|
|
183
185
|
const dbPath = await getDbPath(
|
|
184
186
|
`${XMTP_ENV || "dev"}-${address}`,
|
|
185
187
|
storagePath
|
|
186
188
|
)
|
|
187
|
-
|
|
189
|
+
logger.debug(`📁 Using database path: ${dbPath}`)
|
|
188
190
|
|
|
189
191
|
// Always create a fresh client and sync it
|
|
190
192
|
const client = await Client.create(signer, {
|
|
@@ -200,7 +202,7 @@ export async function createXMTPClient(
|
|
|
200
202
|
})
|
|
201
203
|
|
|
202
204
|
// Force sync conversations to ensure we have the latest data
|
|
203
|
-
|
|
205
|
+
logger.debug("📡 Syncing conversations to ensure latest state...")
|
|
204
206
|
await client.conversations.sync()
|
|
205
207
|
|
|
206
208
|
await backupDbToPersistentStorage(
|
|
@@ -208,12 +210,11 @@ export async function createXMTPClient(
|
|
|
208
210
|
`${XMTP_ENV || "dev"}-${address}`
|
|
209
211
|
)
|
|
210
212
|
|
|
211
|
-
console.log(
|
|
212
|
-
console.log(
|
|
213
|
-
console.log(
|
|
214
|
-
console.log(`💾 Storage mode: persistent`)
|
|
213
|
+
console.log(`Wallet: ${address}`)
|
|
214
|
+
console.log(`Env: ${XMTP_ENV || "dev"}`)
|
|
215
|
+
console.log(`Storage: persistent`)
|
|
215
216
|
|
|
216
|
-
return client
|
|
217
|
+
return client as unknown as XmtpClient
|
|
217
218
|
} catch (error) {
|
|
218
219
|
attempt++
|
|
219
220
|
|
|
@@ -279,8 +280,8 @@ export async function createXMTPClient(
|
|
|
279
280
|
// Try to refresh identity by creating a persistent client first
|
|
280
281
|
try {
|
|
281
282
|
console.log("📝 Creating persistent client to refresh identity...")
|
|
282
|
-
const tempEncryptionKey =
|
|
283
|
-
? getEncryptionKeyFromHex(
|
|
283
|
+
const tempEncryptionKey = XMTP_DB_ENCRYPTION_KEY
|
|
284
|
+
? getEncryptionKeyFromHex(XMTP_DB_ENCRYPTION_KEY)
|
|
284
285
|
: getEncryptionKeyFromHex(generateEncryptionKeyHex())
|
|
285
286
|
const tempClient = await Client.create(signer, {
|
|
286
287
|
dbEncryptionKey: tempEncryptionKey,
|
|
@@ -348,7 +349,7 @@ export const generateEncryptionKeyHex = () => {
|
|
|
348
349
|
* @param hex - The hex string
|
|
349
350
|
* @returns The encryption key as Uint8Array
|
|
350
351
|
*/
|
|
351
|
-
|
|
352
|
+
const getEncryptionKeyFromHex = (hex: string): Uint8Array => {
|
|
352
353
|
return fromString(hex, "hex")
|
|
353
354
|
}
|
|
354
355
|
|
|
@@ -421,7 +422,7 @@ export const getDbPath = async (description = "xmtp", storagePath?: string) => {
|
|
|
421
422
|
return dbPath
|
|
422
423
|
}
|
|
423
424
|
|
|
424
|
-
|
|
425
|
+
const backupDbToPersistentStorage = async (
|
|
425
426
|
dbPath: string,
|
|
426
427
|
description: string
|
|
427
428
|
) => {
|
|
@@ -534,9 +535,9 @@ export function validateEnvironment(vars: string[]): Record<string, string> {
|
|
|
534
535
|
}
|
|
535
536
|
|
|
536
537
|
/**
|
|
537
|
-
* Diagnose XMTP environment and identity issues
|
|
538
|
+
* Diagnose XMTP environment and identity issues (internal use only)
|
|
538
539
|
*/
|
|
539
|
-
|
|
540
|
+
async function diagnoseXMTPIdentityIssue(
|
|
540
541
|
client: XmtpClient,
|
|
541
542
|
inboxId: string,
|
|
542
543
|
environment: string
|
|
@@ -825,116 +826,3 @@ export async function createXMTPConnectionManager(
|
|
|
825
826
|
// ===================================================================
|
|
826
827
|
// User Address Resolution with Auto-Refresh
|
|
827
828
|
// ===================================================================
|
|
828
|
-
|
|
829
|
-
/**
|
|
830
|
-
* Resolve user address from inbox ID with automatic identity refresh on association errors
|
|
831
|
-
*/
|
|
832
|
-
export async function resolveUserAddress(
|
|
833
|
-
client: XmtpClient,
|
|
834
|
-
senderInboxId: string,
|
|
835
|
-
maxRetries = 2
|
|
836
|
-
): Promise<string> {
|
|
837
|
-
let attempt = 0
|
|
838
|
-
|
|
839
|
-
while (attempt < maxRetries) {
|
|
840
|
-
try {
|
|
841
|
-
console.log(
|
|
842
|
-
`🔍 Resolving user address (attempt ${attempt + 1}/${maxRetries})...`
|
|
843
|
-
)
|
|
844
|
-
|
|
845
|
-
const inboxState = await client.preferences.inboxStateFromInboxIds([
|
|
846
|
-
senderInboxId
|
|
847
|
-
])
|
|
848
|
-
|
|
849
|
-
const firstInbox = inboxState[0]
|
|
850
|
-
if (
|
|
851
|
-
inboxState.length > 0 &&
|
|
852
|
-
firstInbox?.identifiers &&
|
|
853
|
-
firstInbox.identifiers.length > 0
|
|
854
|
-
) {
|
|
855
|
-
const userAddress = firstInbox.identifiers[0]?.identifier
|
|
856
|
-
if (userAddress) {
|
|
857
|
-
console.log("✅ Resolved user address:", userAddress)
|
|
858
|
-
return userAddress
|
|
859
|
-
}
|
|
860
|
-
}
|
|
861
|
-
|
|
862
|
-
console.log("⚠️ No identifiers found in inbox state")
|
|
863
|
-
return "unknown"
|
|
864
|
-
} catch (error) {
|
|
865
|
-
attempt++
|
|
866
|
-
|
|
867
|
-
if (
|
|
868
|
-
error instanceof Error &&
|
|
869
|
-
error.message.includes("Association error: Missing identity update")
|
|
870
|
-
) {
|
|
871
|
-
console.log(
|
|
872
|
-
`🔄 Identity association error during address resolution (attempt ${attempt}/${maxRetries})`
|
|
873
|
-
)
|
|
874
|
-
|
|
875
|
-
if (attempt < maxRetries) {
|
|
876
|
-
console.log(
|
|
877
|
-
"🔧 Attempting automatic identity refresh for address resolution..."
|
|
878
|
-
)
|
|
879
|
-
|
|
880
|
-
try {
|
|
881
|
-
// Force a conversation sync to refresh identity state
|
|
882
|
-
console.log("📡 Syncing conversations to refresh identity...")
|
|
883
|
-
await client.conversations.sync()
|
|
884
|
-
|
|
885
|
-
// Small delay before retry
|
|
886
|
-
console.log("⏳ Waiting 2s before retry...")
|
|
887
|
-
await new Promise((resolve) => setTimeout(resolve, 2000))
|
|
888
|
-
|
|
889
|
-
console.log(
|
|
890
|
-
"✅ Identity sync completed, retrying address resolution..."
|
|
891
|
-
)
|
|
892
|
-
} catch (refreshError) {
|
|
893
|
-
console.log(`❌ Identity refresh failed:`, refreshError)
|
|
894
|
-
}
|
|
895
|
-
} else {
|
|
896
|
-
console.error("❌ Failed to resolve user address after all retries")
|
|
897
|
-
console.error("💡 Identity association issue persists")
|
|
898
|
-
|
|
899
|
-
// Run diagnostic
|
|
900
|
-
try {
|
|
901
|
-
const diagnosis = await diagnoseXMTPIdentityIssue(
|
|
902
|
-
client,
|
|
903
|
-
senderInboxId,
|
|
904
|
-
process.env.XMTP_ENV || "dev"
|
|
905
|
-
)
|
|
906
|
-
|
|
907
|
-
console.log("🔍 XMTP Identity Diagnosis:")
|
|
908
|
-
diagnosis.suggestions.forEach((suggestion) => {
|
|
909
|
-
console.error(`💡 ${suggestion}`)
|
|
910
|
-
})
|
|
911
|
-
} catch (diagError) {
|
|
912
|
-
console.warn("⚠️ Could not run XMTP identity diagnosis:", diagError)
|
|
913
|
-
}
|
|
914
|
-
|
|
915
|
-
return "unknown"
|
|
916
|
-
}
|
|
917
|
-
} else {
|
|
918
|
-
// For other errors, don't retry
|
|
919
|
-
console.error("❌ Error resolving user address:", error)
|
|
920
|
-
return "unknown"
|
|
921
|
-
}
|
|
922
|
-
}
|
|
923
|
-
}
|
|
924
|
-
|
|
925
|
-
return "unknown"
|
|
926
|
-
}
|
|
927
|
-
|
|
928
|
-
export const startPeriodicBackup = (
|
|
929
|
-
dbPath: string,
|
|
930
|
-
description: string,
|
|
931
|
-
intervalMs = 300000
|
|
932
|
-
) => {
|
|
933
|
-
return setInterval(async () => {
|
|
934
|
-
try {
|
|
935
|
-
await backupDbToPersistentStorage(dbPath, description)
|
|
936
|
-
} catch (error) {
|
|
937
|
-
console.log(`⚠️ Periodic backup failed:`, error)
|
|
938
|
-
}
|
|
939
|
-
}, intervalMs)
|
|
940
|
-
}
|
package/src/index.ts
CHANGED
|
@@ -1,25 +1,38 @@
|
|
|
1
|
+
export {
|
|
2
|
+
Agent,
|
|
3
|
+
createSigner,
|
|
4
|
+
createUser,
|
|
5
|
+
filter,
|
|
6
|
+
getTestUrl
|
|
7
|
+
} from "@xmtp/agent-sdk"
|
|
8
|
+
|
|
9
|
+
export type * from "./types"
|
|
10
|
+
|
|
11
|
+
export {
|
|
12
|
+
DEFAULT_AMOUNT,
|
|
13
|
+
DEFAULT_OPTIONS,
|
|
14
|
+
MAX_USDC_AMOUNT
|
|
15
|
+
} from "./constants"
|
|
16
|
+
// NodeNext/Node16 requires explicit extensions for relative imports
|
|
17
|
+
// NodeNext/Node16 requires explicit extensions for relative imports
|
|
18
|
+
|
|
1
19
|
// ===================================================================
|
|
2
|
-
// XMTP
|
|
20
|
+
// XMTP Client and Connection Management
|
|
3
21
|
// ===================================================================
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export
|
|
12
|
-
export * from "./resolver/basename-resolver"
|
|
13
|
-
export * from "./resolver/ens-resolver"
|
|
14
|
-
export * from "./resolver/xmtp-resolver"
|
|
15
|
-
export * from "./service-client"
|
|
16
|
-
export * from "./types"
|
|
22
|
+
export {
|
|
23
|
+
createXMTPClient,
|
|
24
|
+
createSigner as createXMTPSigner,
|
|
25
|
+
logAgentDetails,
|
|
26
|
+
validateEnvironment,
|
|
27
|
+
XMTPConnectionManager
|
|
28
|
+
} from "./client"
|
|
29
|
+
export type { XMTPConnectionConfig } from "./client"
|
|
17
30
|
|
|
18
31
|
// ===================================================================
|
|
19
32
|
// XMTP Plugin for Agent Integration
|
|
20
33
|
// ===================================================================
|
|
21
34
|
export { XMTPPlugin } from "./plugin"
|
|
22
|
-
export type { Plugin
|
|
35
|
+
export type { Plugin } from "./plugin"
|
|
23
36
|
|
|
24
37
|
// ===================================================================
|
|
25
38
|
// JWT Utilities for XMTP Tools
|
|
@@ -27,47 +40,6 @@ export type { Plugin, XMTPPluginContext } from "./plugin"
|
|
|
27
40
|
export { generateXMTPToolsToken } from "./lib/jwt"
|
|
28
41
|
export type { XMTPToolsPayload } from "./lib/jwt"
|
|
29
42
|
|
|
30
|
-
// ===================================================================
|
|
31
|
-
// Enhanced XMTP Client & Connection Management
|
|
32
|
-
// ===================================================================
|
|
33
|
-
export {
|
|
34
|
-
// Enhanced connection management
|
|
35
|
-
XMTPConnectionManager,
|
|
36
|
-
createXMTPConnectionManager,
|
|
37
|
-
type XMTPConnectionConfig,
|
|
38
|
-
type XMTPConnectionHealth
|
|
39
|
-
} from "./client"
|
|
40
|
-
|
|
41
|
-
// ===================================================================
|
|
42
|
-
// XMTP Service Client (for external service communication)
|
|
43
|
-
// ===================================================================
|
|
44
|
-
export {
|
|
45
|
-
XmtpServiceClient,
|
|
46
|
-
createXmtpServiceClient
|
|
47
|
-
} from "./service-client"
|
|
48
|
-
|
|
49
|
-
// Service Client Types
|
|
50
|
-
export type {
|
|
51
|
-
GetMessageParams,
|
|
52
|
-
GetRootMessageParams,
|
|
53
|
-
// Function parameter types
|
|
54
|
-
SendMessageParams,
|
|
55
|
-
// Response types
|
|
56
|
-
SendMessageResponse,
|
|
57
|
-
SendReactionParams,
|
|
58
|
-
SendReactionResponse,
|
|
59
|
-
SendReplyParams,
|
|
60
|
-
SendReplyResponse,
|
|
61
|
-
SendTransactionParams,
|
|
62
|
-
SendTransactionResponse,
|
|
63
|
-
TransactionCall,
|
|
64
|
-
TransactionRequest,
|
|
65
|
-
XmtpRootMessageResponse,
|
|
66
|
-
XmtpServiceClientConfig,
|
|
67
|
-
XmtpServiceMessage,
|
|
68
|
-
XmtpServiceResponse
|
|
69
|
-
} from "./types"
|
|
70
|
-
|
|
71
43
|
// ===================================================================
|
|
72
44
|
// XMTP Core SDK Exports
|
|
73
45
|
// ===================================================================
|
|
@@ -114,28 +86,3 @@ export {
|
|
|
114
86
|
ContentTypeWalletSendCalls,
|
|
115
87
|
type WalletSendCallsParams
|
|
116
88
|
} from "@xmtp/content-type-wallet-send-calls"
|
|
117
|
-
|
|
118
|
-
// ===================================================================
|
|
119
|
-
// Local Client Utilities
|
|
120
|
-
// ===================================================================
|
|
121
|
-
export {
|
|
122
|
-
backupDbToPersistentStorage,
|
|
123
|
-
createSigner,
|
|
124
|
-
createUser,
|
|
125
|
-
createXMTPClient,
|
|
126
|
-
diagnoseXMTPIdentityIssue,
|
|
127
|
-
generateEncryptionKeyHex,
|
|
128
|
-
getEncryptionKeyFromHex,
|
|
129
|
-
logAgentDetails,
|
|
130
|
-
startPeriodicBackup,
|
|
131
|
-
validateEnvironment
|
|
132
|
-
} from "./client"
|
|
133
|
-
|
|
134
|
-
// ===================================================================
|
|
135
|
-
// Application Constants
|
|
136
|
-
// ===================================================================
|
|
137
|
-
export {
|
|
138
|
-
DEFAULT_AMOUNT,
|
|
139
|
-
DEFAULT_OPTIONS,
|
|
140
|
-
MAX_USDC_AMOUNT
|
|
141
|
-
} from "./constants"
|
package/src/index.ts.old
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
// ===================================================================
|
|
2
|
+
// XMTP Package - Main Entry Point
|
|
3
|
+
// ===================================================================
|
|
4
|
+
// This package provides a clean interface to XMTP functionality
|
|
5
|
+
// Re-exports core XMTP SDK types and utilities
|
|
6
|
+
|
|
7
|
+
// export * from "./client"
|
|
8
|
+
// export * from "./constants"
|
|
9
|
+
// export * from "./lib/message-listener"
|
|
10
|
+
// export * from "./lib/subjects"
|
|
11
|
+
// export * from "./resolver"
|
|
12
|
+
// export * from "./resolver/basename-resolver"
|
|
13
|
+
// export * from "./resolver/ens-resolver"
|
|
14
|
+
// export * from "./resolver/xmtp-resolver"
|
|
15
|
+
// export * from "./service-client"
|
|
16
|
+
// export * from "./types"
|
|
17
|
+
|
|
18
|
+
// ===================================================================
|
|
19
|
+
// XMTP Plugin for Agent Integration
|
|
20
|
+
// ===================================================================
|
|
21
|
+
export { XMTPPlugin } from "./plugin"
|
|
22
|
+
export type { Plugin, XMTPPluginContext } from "./plugin"
|
|
23
|
+
|
|
24
|
+
// ===================================================================
|
|
25
|
+
// JWT Utilities for XMTP Tools
|
|
26
|
+
// ===================================================================
|
|
27
|
+
export { generateXMTPToolsToken } from "./lib/jwt"
|
|
28
|
+
export type { XMTPToolsPayload } from "./lib/jwt"
|
|
29
|
+
export { logger } from "./lib/logger"
|
|
30
|
+
|
|
31
|
+
// ===================================================================
|
|
32
|
+
// Enhanced XMTP Client & Connection Management
|
|
33
|
+
// ===================================================================
|
|
34
|
+
// export {
|
|
35
|
+
// // Enhanced connection management
|
|
36
|
+
// XMTPConnectionManager,
|
|
37
|
+
// createXMTPConnectionManager,
|
|
38
|
+
// type XMTPConnectionConfig,
|
|
39
|
+
// type XMTPConnectionHealth
|
|
40
|
+
// } from "./client"
|
|
41
|
+
|
|
42
|
+
// ===================================================================
|
|
43
|
+
// XMTP Service Client (for external service communication)
|
|
44
|
+
// ===================================================================
|
|
45
|
+
// export {
|
|
46
|
+
// XmtpServiceClient,
|
|
47
|
+
// createXmtpServiceClient
|
|
48
|
+
// } from "./service-client"
|
|
49
|
+
|
|
50
|
+
// Service Client Types
|
|
51
|
+
// export type {
|
|
52
|
+
// GetMessageParams,
|
|
53
|
+
// GetRootMessageParams,
|
|
54
|
+
// // Function parameter types
|
|
55
|
+
// SendMessageParams,
|
|
56
|
+
// // Response types
|
|
57
|
+
// SendMessageResponse,
|
|
58
|
+
// SendReactionParams,
|
|
59
|
+
// SendReactionResponse,
|
|
60
|
+
// SendReplyParams,
|
|
61
|
+
// SendReplyResponse,
|
|
62
|
+
// SendTransactionParams,
|
|
63
|
+
// SendTransactionResponse,
|
|
64
|
+
// TransactionCall,
|
|
65
|
+
// TransactionRequest,
|
|
66
|
+
// XmtpRootMessageResponse,
|
|
67
|
+
// XmtpServiceClientConfig,
|
|
68
|
+
// XmtpServiceMessage,
|
|
69
|
+
// XmtpServiceResponse
|
|
70
|
+
// } from "./types"
|
|
71
|
+
|
|
72
|
+
// ===================================================================
|
|
73
|
+
// XMTP Core SDK Exports
|
|
74
|
+
// ===================================================================
|
|
75
|
+
export {
|
|
76
|
+
Client,
|
|
77
|
+
IdentifierKind,
|
|
78
|
+
// type Conversation,
|
|
79
|
+
type DecodedMessage,
|
|
80
|
+
type Dm,
|
|
81
|
+
// type Group,
|
|
82
|
+
type LogLevel,
|
|
83
|
+
type Signer,
|
|
84
|
+
type XmtpEnv
|
|
85
|
+
} from "@xmtp/node-sdk"
|
|
86
|
+
|
|
87
|
+
// ===================================================================
|
|
88
|
+
// XMTP Content Types
|
|
89
|
+
// ===================================================================
|
|
90
|
+
export {
|
|
91
|
+
ContentTypeTransactionReference,
|
|
92
|
+
type TransactionReference
|
|
93
|
+
} from "@xmtp/content-type-transaction-reference"
|
|
94
|
+
|
|
95
|
+
export { ContentTypeText, type TextParameters } from "@xmtp/content-type-text"
|
|
96
|
+
|
|
97
|
+
export {
|
|
98
|
+
ContentTypeReaction,
|
|
99
|
+
type Reaction
|
|
100
|
+
} from "@xmtp/content-type-reaction"
|
|
101
|
+
|
|
102
|
+
export {
|
|
103
|
+
ContentTypeReply,
|
|
104
|
+
ReplyCodec,
|
|
105
|
+
type Reply
|
|
106
|
+
} from "@xmtp/content-type-reply"
|
|
107
|
+
|
|
108
|
+
export {
|
|
109
|
+
ContentTypeGroupUpdated,
|
|
110
|
+
GroupUpdatedCodec,
|
|
111
|
+
type GroupUpdated
|
|
112
|
+
} from "@xmtp/content-type-group-updated"
|
|
113
|
+
|
|
114
|
+
export {
|
|
115
|
+
ContentTypeWalletSendCalls,
|
|
116
|
+
type WalletSendCallsParams
|
|
117
|
+
} from "@xmtp/content-type-wallet-send-calls"
|
|
118
|
+
|
|
119
|
+
// ===================================================================
|
|
120
|
+
// Local Client Utilities
|
|
121
|
+
// ===================================================================
|
|
122
|
+
// export {
|
|
123
|
+
// backupDbToPersistentStorage,
|
|
124
|
+
// createSigner,
|
|
125
|
+
// createUser,
|
|
126
|
+
// createXMTPClient,
|
|
127
|
+
// diagnoseXMTPIdentityIssue,
|
|
128
|
+
// generateEncryptionKeyHex,
|
|
129
|
+
// getEncryptionKeyFromHex,
|
|
130
|
+
// logAgentDetails,
|
|
131
|
+
// startPeriodicBackup,
|
|
132
|
+
// validateEnvironment
|
|
133
|
+
// } from "./client"
|
|
134
|
+
|
|
135
|
+
// ===================================================================
|
|
136
|
+
// Application Constants
|
|
137
|
+
// ===================================================================
|
|
138
|
+
export {
|
|
139
|
+
DEFAULT_AMOUNT,
|
|
140
|
+
DEFAULT_OPTIONS,
|
|
141
|
+
MAX_USDC_AMOUNT
|
|
142
|
+
} from "./constants"
|
|
143
|
+
|
|
144
|
+
export { Agent, createSigner, createUser, getTestUrl } from "@xmtp/agent-sdk"
|
|
145
|
+
|