diff --git a/sdks/node-sdk/src/Client.ts b/sdks/node-sdk/src/Client.ts index 71a0ce24..5e061151 100644 --- a/sdks/node-sdk/src/Client.ts +++ b/sdks/node-sdk/src/Client.ts @@ -35,6 +35,12 @@ export const ApiUrls = { production: "https://grpc.production.xmtp.network:443", } as const; +export const HistorySyncUrls = { + local: "http://localhost:5558", + dev: "https://message-history.dev.ephemera.network", + production: "https://message-history.production.ephemera.network", +} as const; + export type XmtpEnv = keyof typeof ApiUrls; /** @@ -50,6 +56,11 @@ export type NetworkOptions = { * specific endpoint */ apiUrl?: string; + /** + * historySyncUrl can be used to override the `env` flag and connect to a + * specific endpoint for syncing history + */ + historySyncUrl?: string; }; /** @@ -70,10 +81,6 @@ export type ContentOptions = { }; export type OtherOptions = { - /** - * Optionally set the request history sync URL - */ - requestHistorySync?: string; /** * Enable structured JSON logging */ @@ -132,6 +139,9 @@ export class Client { level: options?.loggingLevel ?? LogLevel.off, }; + const historySyncUrl = + options?.historySyncUrl ?? HistorySyncUrls[options?.env ?? "dev"]; + const client = new Client( await createClient( host, @@ -140,7 +150,7 @@ export class Client { inboxId, accountAddress, encryptionKey, - options?.requestHistorySync, + historySyncUrl, logOptions, ), signer, diff --git a/sdks/node-sdk/src/index.ts b/sdks/node-sdk/src/index.ts index b4cd0e24..45cc2d30 100644 --- a/sdks/node-sdk/src/index.ts +++ b/sdks/node-sdk/src/index.ts @@ -5,7 +5,7 @@ export type { StorageOptions, XmtpEnv, } from "./Client"; -export { Client, ApiUrls } from "./Client"; +export { Client, ApiUrls, HistorySyncUrls } from "./Client"; export { Conversation } from "./Conversation"; export { Conversations } from "./Conversations"; export { DecodedMessage } from "./DecodedMessage";