Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add appVersion to xmtp client config #1128

Merged
merged 3 commits into from
Nov 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/components/utils/hooks/useXmtpClient.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Client } from '@xmtp/xmtp-js';
import { useCallback, useEffect, useState } from 'react';
import { LS_KEYS, XMTP_ENV } from 'src/constants';
import { APP_NAME, APP_VERSION, LS_KEYS, XMTP_ENV } from 'src/constants';
import { useAppStore } from 'src/store/app';
import { useMessageStore } from 'src/store/message';
import { useSigner } from 'wagmi';
Expand Down Expand Up @@ -43,11 +43,18 @@ const useXmtpClient = (cacheOnly = false) => {
return;
}
setAwaitingXmtpAuth(true);
keys = await Client.getKeys(signer, { env: XMTP_ENV });
keys = await Client.getKeys(signer, {
env: XMTP_ENV,
appVersion: APP_NAME + '/' + APP_VERSION
});
storeKeys(await signer.getAddress(), keys);
}

const xmtp = await Client.create(null, { env: XMTP_ENV, privateKeyOverride: keys });
const xmtp = await Client.create(null, {
saulmc marked this conversation as resolved.
Show resolved Hide resolved
env: XMTP_ENV,
appVersion: APP_NAME + '/' + APP_VERSION,
privateKeyOverride: keys
});
setClient(xmtp);
setAwaitingXmtpAuth(false);
} else {
Expand Down
3 changes: 3 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import getEnvConfig from '@lib/getEnvConfig';
import { chain } from 'wagmi';

import packageJson from '../package.json';

// Environments
export const IS_PRODUCTION = process.env.NODE_ENV === 'production';

Expand All @@ -25,6 +27,7 @@ export const XMTP_PREFIX = 'lens.dev/dm';

// Application
export const APP_NAME = 'Lenster';
export const APP_VERSION = packageJson.version;
export const DESCRIPTION =
'Lenster is a composable, decentralized, and permissionless social media web app built with Lens Protocol 🌿';
export const DEFAULT_OG = 'https://assets.lenster.xyz/images/og/logo.jpeg';
Expand Down