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

fix: disabled JoyID connector #68

Merged
merged 6 commits into from
Feb 8, 2024
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ the creation and transfer of clusters, as well as minting, transferring, and mel
This project currently supports the following wallets:

- [MetaMask](https://metamask.io) - A crypto wallet & gateway to blockchain apps.
- [JoyID](https://joy.id) - Universal Account Protocol for Web3 Mass-adoption.
- ~~[JoyID](https://joy.id) - Universal Account Protocol for Web3 Mass-adoption.~~ (We temporarily disable JoyID in the demo to avoid confusion. It will be re-added when we can fully support JoyID. See [issue#69](https://github.com/sporeprotocol/spore-demo/issues/69))

> This project integrates MetaMask and JoyID through the use of [Omnilock](https://blog.cryptape.com/omnilock-a-universal-lock-that-powers-interoperability-1) for now.
> This project integrates MetaMask ~~and JoyID~~ through the use of [Omnilock](https://blog.cryptape.com/omnilock-a-universal-lock-that-powers-interoperability-1) for now.

## Installation

Expand Down
26 changes: 21 additions & 5 deletions src/components/ConnectModal.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import CKBConnector from '@/connectors/base';
import { showError } from '@/utils/notifications';
import { Button, Flex, createStyles } from '@mantine/core';
import { Text, Alert, Button, Flex, createStyles } from '@mantine/core';
import Image from 'next/image';
import Link from 'next/link';
import { useState } from 'react';

export interface ConnectModalProps {
Expand All @@ -27,8 +28,8 @@ const useStyles = createStyles((theme) => ({

'&.joyid': {
borderRadius: '12px',
border: `0.5px solid ${theme.colors.background[0]}`
}
border: `0.5px solid ${theme.colors.background[0]}`,
},
},
}));

Expand All @@ -49,13 +50,28 @@ export default function ConnectModal(props: ConnectModalProps) {

return (
<Flex direction="column" gap="md">
<Alert variant="filled" color="brand.1" title="JoyID deprecated">
{`We've deprecate the JoyID (Omnilock) option because it is more recommended to connect to JoyID using the JoyId lock instead of Omnilock.`}
<Link
href="https://github.com/sporeprotocol/spore-demo/issues/69"
target="_blank"
style={{
textDecoration: 'none',
}}
>
<Text color="brand.0">See spore-demo issue #69</Text>
</Link>
</Alert>
{connectors.map((connector) => (
<Button
key={connector.type}
className={classes.button}
style={{
cursor: connector.enabled ? 'pointer' : 'not-allowed',
}}
onClick={() => connect(connector)}
loading={connectingConnector === connector.type}
disabled={!connector.enable}
disabled={!connector.enabled}
>
<Flex align="center" gap="xs">
<Image
Expand All @@ -65,7 +81,7 @@ export default function ConnectModal(props: ConnectModalProps) {
width="24"
height="24"
/>
{connector.type} {connector.enable ? '' : '(Coming Soon)'}
{connector.type}
</Flex>
</Button>
))}
Expand Down
10 changes: 5 additions & 5 deletions src/connectors/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Script, Transaction, config, helpers } from '@ckb-lumos/lumos';

export default abstract class CKBConnector {
private _isConnected: boolean = false;
private _enable: boolean = true;
private _enabled: boolean = true;
protected store = store;
abstract type: string;
abstract icon: string;
Expand All @@ -17,12 +17,12 @@ export default abstract class CKBConnector {
return this._isConnected;
}

protected set enable(val: boolean) {
this._enable = val;
protected set enabled(val: boolean) {
this._enabled = val;
}

public get enable() {
return this._enable;
public get enabled() {
return this._enabled;
}

public get lock(): Script | undefined {
Expand Down
1 change: 1 addition & 0 deletions src/connectors/joyId.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export default class JoyIdConnector extends CKBConnector {
name: 'Spore Demo',
joyidAppURL: 'https://testnet.joyid.dev',
});
this.enabled = false;
}

private setAddress(ethAddress: `0x${string}` | undefined) {
Expand Down