Skip to content

Commit

Permalink
Add production environment
Browse files Browse the repository at this point in the history
  • Loading branch information
rygine committed Jun 14, 2024
1 parent 6a90268 commit 5bdf0c1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions packages/mls-client/src/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { Conversations } from '@/Conversations'
export const ApiUrls = {
local: 'http://localhost:5556',
dev: 'https://grpc.dev.xmtp.network:443',
production: 'https://grpc.production.xmtp.network:443',
} as const

export type XmtpEnv = keyof typeof ApiUrls
Expand Down
10 changes: 5 additions & 5 deletions packages/mls-client/test/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { fileURLToPath } from 'node:url'
import { createWalletClient, http, toBytes } from 'viem'
import { generatePrivateKey, privateKeyToAccount } from 'viem/accounts'
import { sepolia } from 'viem/chains'
import { Client } from '@/Client'
import { Client, type XmtpEnv } from '@/Client'

const __dirname = dirname(fileURLToPath(import.meta.url))

Expand Down Expand Up @@ -33,14 +33,14 @@ export const getSignature = async (client: Client, user: User) => {
return null
}

export const createClient = async (user: User) =>
export const createClient = async (user: User, env?: XmtpEnv) =>
Client.create(user.account.address, {
env: 'local',
env: env ?? 'local',
dbPath: join(__dirname, `./test-${user.account.address}.db3`),
})

export const createRegisteredClient = async (user: User) => {
const client = await createClient(user)
export const createRegisteredClient = async (user: User, env?: XmtpEnv) => {
const client = await createClient(user, env)
if (!client.isRegistered) {
const signature = await getSignature(client, user)
if (signature) {
Expand Down

0 comments on commit 5bdf0c1

Please sign in to comment.