@hybrd/xmtp 1.0.0 → 1.0.3

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 (45) hide show
  1. package/.cache/tsbuildinfo.json +1 -1
  2. package/.turbo/turbo-build.log +5 -0
  3. package/.turbo/turbo-lint$colon$fix.log +6 -0
  4. package/dist/scripts/generate-keys.d.ts +1 -0
  5. package/dist/scripts/generate-keys.js +19 -0
  6. package/dist/scripts/refresh-identity.d.ts +1 -0
  7. package/dist/scripts/refresh-identity.js +93 -0
  8. package/dist/scripts/register-wallet.d.ts +1 -0
  9. package/dist/scripts/register-wallet.js +75 -0
  10. package/dist/scripts/revoke-all-installations.d.ts +2 -0
  11. package/dist/scripts/revoke-all-installations.js +68 -0
  12. package/dist/scripts/revoke-installations.d.ts +2 -0
  13. package/dist/scripts/revoke-installations.js +62 -0
  14. package/dist/src/abi/l2_resolver.d.ts +992 -0
  15. package/dist/src/abi/l2_resolver.js +699 -0
  16. package/dist/src/client.d.ts +76 -0
  17. package/dist/src/client.js +709 -0
  18. package/dist/src/constants.d.ts +3 -0
  19. package/dist/src/constants.js +6 -0
  20. package/dist/src/index.d.ts +22 -0
  21. package/dist/src/index.js +46 -0
  22. package/dist/src/lib/message-listener.d.ts +69 -0
  23. package/dist/src/lib/message-listener.js +235 -0
  24. package/dist/src/lib/message-listener.test.d.ts +1 -0
  25. package/dist/src/lib/message-listener.test.js +303 -0
  26. package/dist/src/lib/subjects.d.ts +24 -0
  27. package/dist/src/lib/subjects.js +68 -0
  28. package/dist/src/resolver/address-resolver.d.ts +57 -0
  29. package/dist/src/resolver/address-resolver.js +168 -0
  30. package/dist/src/resolver/basename-resolver.d.ts +134 -0
  31. package/dist/src/resolver/basename-resolver.js +409 -0
  32. package/dist/src/resolver/ens-resolver.d.ts +95 -0
  33. package/dist/src/resolver/ens-resolver.js +249 -0
  34. package/dist/src/resolver/index.d.ts +1 -0
  35. package/dist/src/resolver/index.js +1 -0
  36. package/dist/src/resolver/resolver.d.ts +162 -0
  37. package/dist/src/resolver/resolver.js +238 -0
  38. package/dist/src/resolver/xmtp-resolver.d.ts +95 -0
  39. package/dist/src/resolver/xmtp-resolver.js +297 -0
  40. package/dist/src/service-client.d.ts +77 -0
  41. package/dist/src/service-client.js +198 -0
  42. package/dist/src/types.d.ts +123 -0
  43. package/dist/src/types.js +5 -0
  44. package/package.json +5 -4
  45. package/tsconfig.json +3 -1
@@ -0,0 +1,76 @@
1
+ import { type Signer } from "@xmtp/node-sdk";
2
+ import { privateKeyToAccount } from "viem/accounts";
3
+ import { XmtpClient } from "./types";
4
+ interface User {
5
+ key: `0x${string}`;
6
+ account: ReturnType<typeof privateKeyToAccount>;
7
+ wallet: any;
8
+ }
9
+ export declare const createUser: (key: string) => User;
10
+ export declare const createSigner: (key: string) => Signer;
11
+ export declare function createXMTPClient(privateKey: string, opts?: {
12
+ persist?: boolean;
13
+ maxRetries?: number;
14
+ storagePath?: string;
15
+ }): Promise<XmtpClient>;
16
+ /**
17
+ * Generate a random encryption key
18
+ * @returns The encryption key as a hex string
19
+ */
20
+ export declare const generateEncryptionKeyHex: () => string;
21
+ /**
22
+ * Get the encryption key from a hex string
23
+ * @param hex - The hex string
24
+ * @returns The encryption key as Uint8Array
25
+ */
26
+ export declare const getEncryptionKeyFromHex: (hex: string) => Uint8Array;
27
+ export declare const getDbPath: (description?: string, storagePath?: string) => Promise<string>;
28
+ export declare const backupDbToPersistentStorage: (dbPath: string, description: string) => Promise<void>;
29
+ export declare const logAgentDetails: (clients: XmtpClient | XmtpClient[]) => Promise<void>;
30
+ export declare function validateEnvironment(vars: string[]): Record<string, string>;
31
+ /**
32
+ * Diagnose XMTP environment and identity issues
33
+ */
34
+ export declare function diagnoseXMTPIdentityIssue(client: XmtpClient, inboxId: string, environment: string): Promise<{
35
+ canResolve: boolean;
36
+ suggestions: string[];
37
+ details: Record<string, any>;
38
+ }>;
39
+ export interface XMTPConnectionConfig {
40
+ maxRetries?: number;
41
+ retryDelayMs?: number;
42
+ healthCheckIntervalMs?: number;
43
+ connectionTimeoutMs?: number;
44
+ reconnectOnFailure?: boolean;
45
+ }
46
+ export interface XMTPConnectionHealth {
47
+ isConnected: boolean;
48
+ lastHealthCheck: Date;
49
+ consecutiveFailures: number;
50
+ totalReconnects: number;
51
+ avgResponseTime: number;
52
+ }
53
+ export declare class XMTPConnectionManager {
54
+ private client;
55
+ private privateKey;
56
+ private config;
57
+ private health;
58
+ private healthCheckTimer;
59
+ private isReconnecting;
60
+ constructor(privateKey: string, config?: XMTPConnectionConfig);
61
+ connect(persist?: boolean): Promise<XmtpClient>;
62
+ private startHealthMonitoring;
63
+ private performHealthCheck;
64
+ private handleConnectionFailure;
65
+ private sleep;
66
+ getHealth(): XMTPConnectionHealth;
67
+ getClient(): XmtpClient | null;
68
+ disconnect(): Promise<void>;
69
+ }
70
+ export declare function createXMTPConnectionManager(privateKey: string, config?: XMTPConnectionConfig): Promise<XMTPConnectionManager>;
71
+ /**
72
+ * Resolve user address from inbox ID with automatic identity refresh on association errors
73
+ */
74
+ export declare function resolveUserAddress(client: XmtpClient, senderInboxId: string, maxRetries?: number): Promise<string>;
75
+ export declare const startPeriodicBackup: (dbPath: string, description: string, intervalMs?: number) => NodeJS.Timeout;
76
+ export {};