@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,123 @@
1
+ /**
2
+ * @fileoverview XMTP Types
3
+ *
4
+ * Type definitions for both the XMTP core client and service client library.
5
+ */
6
+ import { GroupUpdated } from "@xmtp/content-type-group-updated";
7
+ import { Reaction } from "@xmtp/content-type-reaction";
8
+ import { Reply } from "@xmtp/content-type-reply";
9
+ import { TransactionReference } from "@xmtp/content-type-transaction-reference";
10
+ import { WalletSendCallsParams } from "@xmtp/content-type-wallet-send-calls";
11
+ import { Client, Conversation, DecodedMessage } from "@xmtp/node-sdk";
12
+ import type { Resolver } from "./resolver/resolver";
13
+ export type HonoVariables = {
14
+ xmtpClient: XmtpClient;
15
+ resolver?: Resolver;
16
+ };
17
+ type Codec = GroupUpdated | Reaction | Reply | TransactionReference | WalletSendCallsParams;
18
+ export type XmtpClient = Client<string | Codec>;
19
+ export type XmtpConversation = Conversation<string | Codec>;
20
+ export type XmtpMessage = DecodedMessage<string | Codec>;
21
+ export type XmtpSender = {
22
+ address: string;
23
+ inboxId: string;
24
+ name: string;
25
+ basename?: string;
26
+ };
27
+ export type XmtpSubjects = Record<string, `0x${string}`>;
28
+ export interface MessageEvent {
29
+ conversation: XmtpConversation;
30
+ message: XmtpMessage;
31
+ rootMessage: XmtpMessage;
32
+ parentMessage?: XmtpMessage;
33
+ sender: XmtpSender;
34
+ subjects: XmtpSubjects;
35
+ }
36
+ export interface XmtpServiceClientConfig {
37
+ serviceUrl: string;
38
+ serviceToken: string;
39
+ }
40
+ export interface TransactionCall {
41
+ to: string;
42
+ data: string;
43
+ gas?: string;
44
+ value?: string;
45
+ metadata?: Record<string, unknown>;
46
+ }
47
+ export interface TransactionRequest {
48
+ fromAddress: string;
49
+ chainId: string;
50
+ calls: TransactionCall[];
51
+ }
52
+ export interface XmtpServiceResponse<T = unknown> {
53
+ success: boolean;
54
+ data?: T;
55
+ error?: string;
56
+ }
57
+ export interface XmtpServiceMessage {
58
+ id: string;
59
+ conversationId: string;
60
+ content: string | Record<string, unknown>;
61
+ senderInboxId: string;
62
+ sentAt: string;
63
+ contentType?: {
64
+ typeId: string;
65
+ authorityId?: string;
66
+ versionMajor?: number;
67
+ versionMinor?: number;
68
+ };
69
+ }
70
+ export interface XmtpRootMessageResponse {
71
+ id: string;
72
+ conversationId: string;
73
+ content: string | Record<string, unknown>;
74
+ senderInboxId: string;
75
+ sentAt: string;
76
+ contentType?: {
77
+ typeId: string;
78
+ authorityId?: string;
79
+ versionMajor?: number;
80
+ versionMinor?: number;
81
+ };
82
+ }
83
+ export interface SendMessageParams {
84
+ content: string;
85
+ }
86
+ export interface SendReplyParams {
87
+ content: string;
88
+ messageId: string;
89
+ }
90
+ export interface SendReactionParams {
91
+ messageId: string;
92
+ emoji: string;
93
+ action: "added" | "removed";
94
+ }
95
+ export interface SendTransactionParams extends TransactionRequest {
96
+ }
97
+ export interface GetMessageParams {
98
+ messageId: string;
99
+ }
100
+ export interface GetRootMessageParams {
101
+ messageId: string;
102
+ }
103
+ export interface SendMessageResponse {
104
+ success: boolean;
105
+ action: "send";
106
+ conversationId: string;
107
+ }
108
+ export interface SendReplyResponse {
109
+ success: boolean;
110
+ action: "reply";
111
+ conversationId: string;
112
+ }
113
+ export interface SendReactionResponse {
114
+ success: boolean;
115
+ action: "react";
116
+ conversationId: string;
117
+ }
118
+ export interface SendTransactionResponse {
119
+ success: boolean;
120
+ action: "transaction";
121
+ conversationId: string;
122
+ }
123
+ export {};
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @fileoverview XMTP Types
3
+ *
4
+ * Type definitions for both the XMTP core client and service client library.
5
+ */
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@hybrd/xmtp",
3
- "version": "1.0.0",
3
+ "version": "1.0.3",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
7
- "import": "./src/index.ts",
8
- "types": "./src/index.ts"
7
+ "import": "./dist/src/index.js",
8
+ "types": "./dist/src/index.d.ts"
9
9
  }
10
10
  },
11
11
  "dependencies": {
@@ -29,7 +29,8 @@
29
29
  "@hybrd/tsconfig": "0.0.0"
30
30
  },
31
31
  "scripts": {
32
- "clean": "rm -rf .turbo",
32
+ "build": "tsc",
33
+ "clean": "rm -rf .turbo dist",
33
34
  "gen:keys": "tsx scripts/generate-keys.ts",
34
35
  "register": "tsx scripts/register-wallet.ts",
35
36
  "revoke": "tsx scripts/revoke-installations.ts",
package/tsconfig.json CHANGED
@@ -5,7 +5,9 @@
5
5
  "target": "ES2020",
6
6
  "lib": ["ES2020"],
7
7
  "outDir": "dist",
8
- "isolatedModules": false
8
+ "isolatedModules": false,
9
+ "noEmit": false,
10
+ "declaration": true
9
11
  },
10
12
  "include": ["src/**/*", "scripts/**/*"],
11
13
  "exclude": ["node_modules", "dist"]