@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.
- package/.cache/tsbuildinfo.json +1 -1
- package/.turbo/turbo-build.log +5 -0
- package/.turbo/turbo-lint$colon$fix.log +6 -0
- package/dist/scripts/generate-keys.d.ts +1 -0
- package/dist/scripts/generate-keys.js +19 -0
- package/dist/scripts/refresh-identity.d.ts +1 -0
- package/dist/scripts/refresh-identity.js +93 -0
- package/dist/scripts/register-wallet.d.ts +1 -0
- package/dist/scripts/register-wallet.js +75 -0
- package/dist/scripts/revoke-all-installations.d.ts +2 -0
- package/dist/scripts/revoke-all-installations.js +68 -0
- package/dist/scripts/revoke-installations.d.ts +2 -0
- package/dist/scripts/revoke-installations.js +62 -0
- package/dist/src/abi/l2_resolver.d.ts +992 -0
- package/dist/src/abi/l2_resolver.js +699 -0
- package/dist/src/client.d.ts +76 -0
- package/dist/src/client.js +709 -0
- package/dist/src/constants.d.ts +3 -0
- package/dist/src/constants.js +6 -0
- package/dist/src/index.d.ts +22 -0
- package/dist/src/index.js +46 -0
- package/dist/src/lib/message-listener.d.ts +69 -0
- package/dist/src/lib/message-listener.js +235 -0
- package/dist/src/lib/message-listener.test.d.ts +1 -0
- package/dist/src/lib/message-listener.test.js +303 -0
- package/dist/src/lib/subjects.d.ts +24 -0
- package/dist/src/lib/subjects.js +68 -0
- package/dist/src/resolver/address-resolver.d.ts +57 -0
- package/dist/src/resolver/address-resolver.js +168 -0
- package/dist/src/resolver/basename-resolver.d.ts +134 -0
- package/dist/src/resolver/basename-resolver.js +409 -0
- package/dist/src/resolver/ens-resolver.d.ts +95 -0
- package/dist/src/resolver/ens-resolver.js +249 -0
- package/dist/src/resolver/index.d.ts +1 -0
- package/dist/src/resolver/index.js +1 -0
- package/dist/src/resolver/resolver.d.ts +162 -0
- package/dist/src/resolver/resolver.js +238 -0
- package/dist/src/resolver/xmtp-resolver.d.ts +95 -0
- package/dist/src/resolver/xmtp-resolver.js +297 -0
- package/dist/src/service-client.d.ts +77 -0
- package/dist/src/service-client.js +198 -0
- package/dist/src/types.d.ts +123 -0
- package/dist/src/types.js +5 -0
- package/package.json +5 -4
- 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 {};
|