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

Hadi/xmtp plugin #80

Merged
merged 34 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
55edbf2
feat: basic but need to move to js sdk
HadiKhai Nov 24, 2024
9bc689c
feat: chat and getting the messages
HadiKhai Nov 25, 2024
b135daa
fix: tabs css
HadiKhai Nov 25, 2024
cbfb4af
feat: working on chat
anthony23991 Nov 26, 2024
9369bfb
feat: finalizing xmtp widget
anthony23991 Nov 27, 2024
9536e98
fix: message textfield fix when replying
anthony23991 Nov 27, 2024
3408e33
Merge remote-tracking branch 'origin/develop' into hadi/xmtp-plugin
HadiKhai Nov 28, 2024
c123018
Merge remote-tracking branch 'origin/develop' into hadi/xmtp-plugin
HadiKhai Nov 28, 2024
559d658
fix: xmtp build
HadiKhai Nov 28, 2024
36ab684
Merge pull request #78 from JustaName-id/develop
Ghadi8 Nov 29, 2024
9f972d5
chore(release): publish [skip ci]
Ghadi8 Nov 29, 2024
4fb3c2a
chore(release): publish [skip ci]
Ghadi8 Nov 29, 2024
af15cbf
chore(release): publish [skip ci]
Ghadi8 Nov 29, 2024
27d02b4
chore(release): publish [skip ci]
Ghadi8 Nov 29, 2024
26bdae9
chore(release): publish [skip ci]
Ghadi8 Nov 29, 2024
578f447
chore(release): publish [skip ci]
HadiKhai Nov 29, 2024
f82ab13
feat: support ethers 5 and ethers 6
HadiKhai Dec 1, 2024
dd74368
chore(release): publish [skip ci]
HadiKhai Dec 1, 2024
144583f
chore(release): publish [skip ci]
HadiKhai Dec 2, 2024
a9faa2e
Merge branch 'develop' of https://github.com/JustaName-id/JustaName-s…
anthony23991 Dec 2, 2024
aec600f
fix: yarn
anthony23991 Dec 2, 2024
3df90a7
feat: sign in optional
HadiKhai Dec 3, 2024
11c7dad
chore(release): publish [skip ci]
HadiKhai Dec 3, 2024
6e49774
feat: finalizing new convo
anthony23991 Dec 3, 2024
1fb2493
feat: added comment
anthony23991 Dec 3, 2024
e2fb63b
Merge branch 'main' into hadi/xmtp-plugin
HadiKhai Dec 3, 2024
bafad7b
feat: compute height for message, using justaname react hook for iden…
HadiKhai Dec 4, 2024
e7d8870
feat: finalised xmtp
anthony23991 Dec 4, 2024
fb31ee7
feat: chat from profile
HadiKhai Dec 5, 2024
f5a98b2
feat: console xmtp
HadiKhai Dec 5, 2024
3ade8be
feat: console
HadiKhai Dec 5, 2024
3900db0
feat: xmtp fix nextjs config
HadiKhai Dec 5, 2024
d4572e6
feat: xmtp refactor and unread count
HadiKhai Dec 6, 2024
4a3af5e
feat: chat optimization
HadiKhai Dec 9, 2024
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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,6 @@ cache/

.yarn/install-state.gz

storybook-static
storybook-static

.million
8 changes: 7 additions & 1 deletion apps/console/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

// eslint-disable-next-line @typescript-eslint/no-var-requires
const { composePlugins, withNx } = require('@nx/next');
const MillionLint = require('@million/lint');

/**
* @type {import('@nx/next/plugins/with-nx').WithNxOptions}
Expand All @@ -13,11 +14,16 @@ const nextConfig = {
// See: https://github.com/gregberge/svgr
svgr: false,
},
experimental: {
serverComponentsExternalPackages: ['@xmtp/user-preferences-bindings-wasm'],
},
};

const plugins = [
// Add more Next.js plugins to this list if needed.
withNx,
];

module.exports = composePlugins(...plugins)(nextConfig);
module.exports = MillionLint.next({ rsc: true })(
composePlugins(...plugins)(nextConfig)
);
1 change: 1 addition & 0 deletions apps/console/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export default function Page() {
</JustWeb3Button>

<JustEnsCard addressOrEns={'justhadi.eth'} />
<JustEnsCard addressOrEns={'justghadi.eth'} />
<JustEnsCard addressOrEns={'mely.eth'} />
<JustEnsCard addressOrEns={'nick.eth'} />
<JustEnsCard addressOrEns={'vitalik.eth'} />
Expand Down
1 change: 1 addition & 0 deletions apps/console/src/app/providers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export const Providers: React.FC<ProviderProps> = (props) => {
providerUrl: process.env.NEXT_PUBLIC_SEPOLIA_PROVIDER_URL as string,
},
],
enableAuth: true,
openOnWalletConnect: true,
allowedEns: 'all',
disableOverlay: true,
Expand Down
22 changes: 19 additions & 3 deletions apps/console/src/components/sections/code/CodeSection/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ export const CodeSection: React.FC<CodeSectionProps> = ({ mobile }) => {
[config]
);

const xmtpPluginEnabled = useMemo(
() => config.plugins?.find((p) => p.name === 'XMTPPlugin'),
[config]
);

const codeSnippet = useMemo(() => {
const plugins = [];

Expand All @@ -57,6 +62,10 @@ export const CodeSection: React.FC<CodeSectionProps> = ({ mobile }) => {
);
}

if (xmtpPluginEnabled) {
plugins.push("%%XMTPPlugin('production')%%");
}

return `
import '@rainbow-me/rainbowkit/styles.css';
import '@justweb3/widget/styles.css';
Expand Down Expand Up @@ -97,6 +106,9 @@ ${
? "import { TalentProtocolPlugin } from '@justweb3/talent-protocol-plugin';"
: ''
}
${
xmtpPluginEnabled ? "import { XMTPPlugin } from '@justweb3/xmtp-plugin';" : ''
}

export const App: React.FC = () => {
const { wallets } = getDefaultWallets();
Expand Down Expand Up @@ -163,6 +175,7 @@ export default App;`.trim();
justVerifiedEnabled,
poapPluginEnabled,
talentProtocolPluginEnabled,
xmtpPluginEnabled,
]);

const code = useMemo(() => {
Expand All @@ -172,16 +185,19 @@ export default App;`.trim();
}, [codeSnippet]);

const dependencies = useMemo(() => {
return `yarn add ${justVerifiedEnabled ? '@justverified/plugin' : ''} ${
poapPluginEnabled ? '@justweb3/poap-plugin' : ''
} ${efpPluginEnabled ? '@justweb3/efp-plugin' : ''}
return `yarn add ${xmtpPluginEnabled ? '@justweb3/xmtp-plugin' : ''} ${
justVerifiedEnabled ? '@justverified/plugin' : ''
} ${poapPluginEnabled ? '@justweb3/poap-plugin' : ''} ${
efpPluginEnabled ? '@justweb3/efp-plugin' : ''
}
${talentProtocolPluginEnabled ? '@justweb3/talent-protocol-plugin' : ''}
@justweb3/widget viem wagmi @rainbow-me/rainbowkit @tanstack/react-query ethers`;
}, [
efpPluginEnabled,
justVerifiedEnabled,
poapPluginEnabled,
talentProtocolPluginEnabled,
xmtpPluginEnabled,
]);

const handleDependenciesCopy = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const socials: { logo: ReactNode; title: string; credential: Credentials }[] = [
},
];

export const Verified = () => {
export const JustVerified = () => {
const { handleJustWeb3Config, config } = useContext(JustWeb3Context);
const { justVerified, setJustVerified } = useConsole();

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// import { AccordionItem, AccordionTrigger } from '../../../../ui/accordion';
import { Switch } from '../../../../ui/switch';
import { useContext } from 'react';
import { JustWeb3Context } from '@justweb3/widget';
import { XMTPPlugin } from '@justweb3/xmtp-plugin';

export const XMTP = () => {
const { handleJustWeb3Config, config } = useContext(JustWeb3Context);

const handleEFPConfig = (enabled: boolean) => {
if (enabled) {
handleJustWeb3Config({
...config,
plugins: [
...(config?.plugins || []).filter(
(plugin) => plugin.name !== XMTPPlugin.name
),
XMTPPlugin('production'),
],
});
} else {
handleJustWeb3Config({
...config,
plugins: (config?.plugins || []).filter(
(plugin) => plugin.name !== XMTPPlugin.name
),
});
}
};

return (
<div className="flex flex-row items-center justify-between w-full py-[16px] pl-[26px]">
<p className="text-base text-black font-bold leading-[125%] my-[5px]">
XMTP
</p>
<Switch
checked={
!!config?.plugins?.find((plugin) => plugin.name === XMTPPlugin.name)
}
onClick={(e) => {
e.stopPropagation();
}}
onCheckedChange={(checked) => {
handleEFPConfig(checked);
}}
/>
</div>
);
};
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { FC } from 'react';
import { Accordion } from '../../../ui/accordion';
import { Verified } from './Verified';
import { JustVerified } from './JustVerified';
import { EFP } from './EFP';
import { POAP } from './POAP';
import { TalentProtocol } from './TalentProtocol';
import { XMTP } from './XMTP';

export const PluginsSection: FC = () => {
return (
Expand All @@ -13,12 +14,14 @@ export const PluginsSection: FC = () => {
</p>

<Accordion type="single" collapsible className="w-full">
<Verified />
<JustVerified />
<EFP />
<div className="w-full h-[1px] min-h-[1px] bg-[#CBD5E180]" />
<POAP />
<div className="w-full h-[1px] min-h-[1px] bg-[#CBD5E180]" />
<TalentProtocol />
<div className="w-full h-[1px] min-h-[1px] bg-[#CBD5E180]" />
<XMTP />
</Accordion>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion apps/console/src/layout/navbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Link from 'next/link';

export const Navbar = () => {
return (
<div className="w-screen flex z-[100] pointer-events-auto flex-row items-center justify-between h-[60px] p-2.5 border-b-[1px]">
<div className="w-screen flex z-[50] pointer-events-auto flex-row items-center justify-between h-[60px] p-2.5 border-b-[1px]">
{/*<Image src="/static/logo.svg" alt="JustName" width={80} height={35} />*/}
<JustaNameLogoIcon width={80} height={35} />
<Link href={'https://docs.justaname.id'} passHref target="_blank">
Expand Down
6 changes: 6 additions & 0 deletions demo/server/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,15 @@ app.post('/api/signin', async (req: Request, res) => {
return;
}

if (!req.session.nonce) {
res.status(401).json({ message: 'No nonce found.' });
return;
}

const { data: message, ens } = await justaname.signIn.signIn({
message: req.body.message,
signature: req.body.signature,
nonce: req.session.nonce,
});

if (!message) {
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
"@hookform/error-message": "^2.0.1",
"@hookform/resolvers": "^3.9.0",
"@inquirer/prompts": "^4.3.0",
"@justaname.id/address-resolution": "^1.1.0",
"@million/lint": "^1.0.13",
"@privy-io/react-auth": "^1.82.0",
"@privy-io/wagmi": "^0.2.12",
"@radix-ui/react-accordion": "^1.2.1",
Expand Down Expand Up @@ -99,6 +101,7 @@
"react-native-url-polyfill": "^2.0.0",
"react-native-web": "~0.19.9",
"react-router-dom": "6.11.2",
"react-scan": "^0.0.35",
"react-split": "^2.0.14",
"react-timer-hook": "^3.0.8",
"react-tiny-popover": "^8.0.4",
Expand Down
119 changes: 119 additions & 0 deletions packages/@justaname.id/react/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,122 @@
## 0.3.158 (2024-12-03)


### 🚀 Features

- sign in optional ([3df90a7](https://github.com/JustaName-id/JustaName-sdk/commit/3df90a7))


### 🧱 Updated Dependencies

- Updated @justaname.id/sdk to 0.2.155


### ❤️ Thank You

- HadiKhai

## 0.3.157 (2024-12-02)


### 🧱 Updated Dependencies

- Updated @justaname.id/sdk to 0.2.154

## 0.3.156 (2024-12-01)


### 🚀 Features

- support ethers 5 and ethers 6 ([f82ab13](https://github.com/JustaName-id/JustaName-sdk/commit/f82ab13))


### 🧱 Updated Dependencies

- Updated @justaname.id/sdk to 0.2.153


### ❤️ Thank You

- HadiKhai

## 0.3.155 (2024-11-29)


### 🧱 Updated Dependencies

- Updated @justaname.id/sdk to 0.2.152

## 0.3.154 (2024-11-29)


### 🧱 Updated Dependencies

- Updated @justaname.id/sdk to 0.2.151

## 0.3.153 (2024-11-29)


### 🧱 Updated Dependencies

- Updated @justaname.id/sdk to 0.2.150

## 0.3.152 (2024-11-29)


### 🧱 Updated Dependencies

- Updated @justaname.id/sdk to 0.2.149

## 0.3.151 (2024-11-29)


### 🧱 Updated Dependencies

- Updated @justaname.id/sdk to 0.2.148

## 0.3.150 (2024-11-29)


### 🚀 Features

- remove mapps from justverified ([2898c521](https://github.com/JustaName-id/JustaName-sdk/commit/2898c521))

- efp ([36fcc153](https://github.com/JustaName-id/JustaName-sdk/commit/36fcc153))

- efp and storybook for react sdk ([f0c5c7a0](https://github.com/JustaName-id/JustaName-sdk/commit/f0c5c7a0))

- console fixes ([358b3a0e](https://github.com/JustaName-id/JustaName-sdk/commit/358b3a0e))

- added docs and the sign in should only show ens set to default resolver or justaname resolver only ([a3bcecaa](https://github.com/JustaName-id/JustaName-sdk/commit/a3bcecaa))

- enabled in hooks and siwens fix and coinbase fix ([c3fb455e](https://github.com/JustaName-id/JustaName-sdk/commit/c3fb455e))

- retryOnMount false ([bec00ba8](https://github.com/JustaName-id/JustaName-sdk/commit/bec00ba8))


### 🩹 Fixes

- packages ([6dd450f5](https://github.com/JustaName-id/JustaName-sdk/commit/6dd450f5))

- lint fix on react and package json of projects ([b29cd296](https://github.com/JustaName-id/JustaName-sdk/commit/b29cd296))

- error from useEnsWalletClient ([67043376](https://github.com/JustaName-id/JustaName-sdk/commit/67043376))

- update rest call and ui fixes ([81b05f29](https://github.com/JustaName-id/JustaName-sdk/commit/81b05f29))

- poap default options ([eb5d1c36](https://github.com/JustaName-id/JustaName-sdk/commit/eb5d1c36))


### 🧱 Updated Dependencies

- Updated @justaname.id/sdk to 0.2.147


### ❤️ Thank You

- anthony2399 @anthony23991
- HadiKhai

## 0.3.149 (2024-11-15)


Expand Down
6 changes: 3 additions & 3 deletions packages/@justaname.id/react/package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"name": "@justaname.id/react",
"version": "0.3.149",
"version": "0.3.158",
"dependencies": {
"@ensdomains/ensjs": "4.0.2",
"@justaname.id/sdk": "0.2.146",
"@justaname.id/sdk": "0.2.155",
"axios": "^1.6.0",
"qs": "^6.12.0"
},
"peerDependencies": {
"@tanstack/react-query": "^5.x",
"ethers": "^6.x",
"ethers": "^5.6.8 || ^6.0.8",
"react": ">=17",
"viem": "2.x",
"wagmi": "2.x"
Expand Down
Loading
Loading