|
1 |
| -import dotenv from "dotenv"; |
2 |
| -dotenv.config(); |
3 |
| -import { |
4 |
| - DecodedMessage, |
5 |
| - Client, |
6 |
| - ClientOptions, |
7 |
| - XmtpEnv, |
8 |
| - Conversation, |
9 |
| -} from "@xmtp/node-sdk"; |
10 |
| -import { ContentTypeReply, Reply, ReplyCodec } from "@xmtp/content-type-reply"; |
| 1 | +import crypto, { getRandomValues } from "crypto"; |
| 2 | +import * as fs from "fs"; |
| 3 | +import { readFile } from "fs/promises"; |
| 4 | +import path from "path"; |
11 | 5 | import {
|
12 | 6 | ContentTypeReaction,
|
13 | 7 | Reaction,
|
14 | 8 | ReactionCodec,
|
15 | 9 | } from "@xmtp/content-type-reaction";
|
16 |
| -import { ContentTypeText, TextCodec } from "@xmtp/content-type-text"; |
| 10 | +import { |
| 11 | + ContentTypeReadReceipt, |
| 12 | + ReadReceiptCodec, |
| 13 | +} from "@xmtp/content-type-read-receipt"; |
17 | 14 | import {
|
18 | 15 | Attachment,
|
19 | 16 | AttachmentCodec,
|
20 | 17 | ContentTypeRemoteAttachment,
|
21 | 18 | RemoteAttachmentCodec,
|
22 | 19 | } from "@xmtp/content-type-remote-attachment";
|
| 20 | +import { ContentTypeReply, Reply, ReplyCodec } from "@xmtp/content-type-reply"; |
| 21 | +import { ContentTypeText, TextCodec } from "@xmtp/content-type-text"; |
23 | 22 | import {
|
24 |
| - ContentTypeReadReceipt, |
25 |
| - ReadReceiptCodec, |
26 |
| -} from "@xmtp/content-type-read-receipt"; |
| 23 | + Client, |
| 24 | + ClientOptions, |
| 25 | + Conversation, |
| 26 | + DecodedMessage, |
| 27 | + XmtpEnv, |
| 28 | +} from "@xmtp/node-sdk"; |
| 29 | +import dotenv from "dotenv"; |
| 30 | +import fetch from "node-fetch"; |
| 31 | +import { createWalletClient, http, isAddress, toBytes, toHex } from "viem"; |
| 32 | +import { privateKeyToAccount } from "viem/accounts"; |
| 33 | +import { mainnet } from "viem/chains"; |
27 | 34 | import {
|
28 | 35 | AgentMessage,
|
29 | 36 | AgentMessageCodec,
|
30 | 37 | ContentTypeAgentMessage,
|
31 | 38 | } from "../content-types/agent-message.js";
|
32 |
| -import { createWalletClient, http, isAddress, toBytes, toHex } from "viem"; |
33 |
| -import { privateKeyToAccount } from "viem/accounts"; |
34 |
| -import { mainnet } from "viem/chains"; |
| 39 | +import { Agent, agentMessage, Message, User, UserReturnType } from "./types.js"; |
35 | 40 |
|
36 |
| -import { getRandomValues } from "crypto"; |
37 |
| -import path from "path"; |
38 |
| -import { Message, agentMessage, UserReturnType, User, Agent } from "./types.js"; |
39 |
| -import { readFile } from "fs/promises"; |
40 |
| -import * as fs from "fs"; |
41 |
| -import fetch from "node-fetch"; |
42 |
| -import crypto from "crypto"; |
| 41 | +dotenv.config(); |
43 | 42 |
|
44 | 43 | export async function xmtpClient(agent?: Agent): Promise<XMTP> {
|
45 | 44 | let xmtp: XMTP | null = null; // Ensure a single instance
|
|
0 commit comments