diff --git a/hub/components/GlobalHeader/User/Connect.tsx b/hub/components/GlobalHeader/User/Connect.tsx
index da0682e7c1..57f7964040 100644
--- a/hub/components/GlobalHeader/User/Connect.tsx
+++ b/hub/components/GlobalHeader/User/Connect.tsx
@@ -42,7 +42,7 @@ interface Props {
}
export function Connect(props: Props) {
- const { connect, signMessage } = useWallet();
+ const { connect, signMessage, setSoftConnect } = useWallet();
const [, createClaim] = useMutation(getClaimResp, getClaim);
const [, createToken] = useMutation(getTokenResp, getToken);
const [, setJwt] = useJWT();
@@ -73,6 +73,7 @@ export function Connect(props: Props) {
)}
onClick={async () => {
try {
+ localStorage.removeItem('walletName');
const publicKey = await connect();
const claimResult = await createClaim({
@@ -88,7 +89,15 @@ export function Connect(props: Props) {
} = claimResult.data;
const claimBlob = sig.toUint8Array(claim);
- const signatureResp = await signMessage(claimBlob);
+ const signatureResp = await signMessage(claimBlob).catch(
+ () => null,
+ );
+
+ if (!signatureResp) {
+ setSoftConnect(true);
+ return;
+ }
+
const signature = sig.toHex(signatureResp);
const tokenResult = await createToken({ claim, signature });
diff --git a/hub/components/GlobalHeader/User/Connected.tsx b/hub/components/GlobalHeader/User/Connected.tsx
new file mode 100644
index 0000000000..ed18d8448a
--- /dev/null
+++ b/hub/components/GlobalHeader/User/Connected.tsx
@@ -0,0 +1,41 @@
+import type { PublicKey } from '@solana/web3.js';
+
+import { AuthorAvatar } from '@hub/components/AuthorAvatar';
+import { abbreviateAddress } from '@hub/lib/abbreviateAddress';
+import cx from '@hub/lib/cx';
+
+interface Props {
+ className?: string;
+ compressed?: boolean;
+ userPublicKey: PublicKey;
+}
+
+export function Connected(props: Props) {
+ const username = abbreviateAddress(props.userPublicKey);
+
+ return (
+
+
+
+ {!props.compressed && (
+
{username}
+ )}
+
+
+
+ );
+}
diff --git a/hub/components/GlobalHeader/User/index.tsx b/hub/components/GlobalHeader/User/index.tsx
index d37028dc19..0a88e438a8 100644
--- a/hub/components/GlobalHeader/User/index.tsx
+++ b/hub/components/GlobalHeader/User/index.tsx
@@ -1,10 +1,13 @@
import { pipe } from 'fp-ts/function';
+import { useJWT } from '@hub/hooks/useJWT';
import { useQuery } from '@hub/hooks/useQuery';
+import { useWallet } from '@hub/hooks/useWallet';
import cx from '@hub/lib/cx';
import * as RE from '@hub/types/Result';
import { Connect } from './Connect';
+import { Connected } from './Connected';
import { DialectNotifications } from './DialectNotifications';
import * as gql from './gql';
import { Loading } from './Loading';
@@ -17,6 +20,18 @@ interface Props {
export function User(props: Props) {
const [result, refetch] = useQuery(gql.getUserResp, { query: gql.getUser });
+ const { publicKey, softConnect } = useWallet();
+ const [jwt] = useJWT();
+
+ if (!jwt && publicKey && softConnect) {
+ return (
+
+ );
+ }
return pipe(
result,
diff --git a/hub/components/GlobalStats/ValueByDao/index.tsx b/hub/components/GlobalStats/ValueByDao/index.tsx
index 77f5cf0538..adea5f8fe8 100644
--- a/hub/components/GlobalStats/ValueByDao/index.tsx
+++ b/hub/components/GlobalStats/ValueByDao/index.tsx
@@ -1,4 +1,3 @@
-import type { BigNumber } from 'bignumber.js';
import React from 'react';
import * as common from '../common';
diff --git a/hub/hooks/useWallet.ts b/hub/hooks/useWallet.ts
index 7398cce267..e71482768d 100644
--- a/hub/hooks/useWallet.ts
+++ b/hub/hooks/useWallet.ts
@@ -6,6 +6,8 @@ export function useWallet() {
const {
connect,
publicKey,
+ softConnect,
+ setSoftConnect,
signMessage,
signTransaction,
signAllTransactions,
@@ -13,6 +15,8 @@ export function useWallet() {
return {
connect,
publicKey,
+ softConnect,
+ setSoftConnect,
signMessage,
signTransaction,
signAllTransactions,
diff --git a/hub/providers/Proposal/createProposal.ts b/hub/providers/Proposal/createProposal.ts
index 0bc90106b2..d273fcd5f7 100644
--- a/hub/providers/Proposal/createProposal.ts
+++ b/hub/providers/Proposal/createProposal.ts
@@ -29,7 +29,6 @@ import {
vsrPluginsPks,
nftPluginsPks,
gatewayPluginsPks,
- switchboardPluginsPks,
pythPluginsPks,
} from '@hooks/useVotingPlugins';
import { getRegistrarPDA as getPluginRegistrarPDA } from '@utils/plugin/accounts';
@@ -205,13 +204,6 @@ export async function createProposal(args: Args) {
}
}
- // if (
- // switchboardPluginsPks.includes(pluginPublicKeyStr) &&
- // votingPlugins.switchboardClient
- // ) {
- // client = votingPlugins.switchboardClient;
- // }
-
if (
gatewayPluginsPks.includes(pluginPublicKeyStr) &&
votingPlugins.gatewayClient
diff --git a/hub/providers/Proposal/fetchPlugins.ts b/hub/providers/Proposal/fetchPlugins.ts
index 1e2093284c..bc317d4bb5 100644
--- a/hub/providers/Proposal/fetchPlugins.ts
+++ b/hub/providers/Proposal/fetchPlugins.ts
@@ -8,8 +8,6 @@ import { Connection, PublicKey } from '@solana/web3.js';
import { PythClient } from 'pyth-staking-api';
import { VsrClient } from 'VoteStakeRegistry/sdk/client';
-import { SwitchboardQueueVoterClient } from '../../../SwitchboardVotePlugin/SwitchboardQueueVoterClient';
-
export async function fetchPlugins(
connection: Connection,
programPublicKey: PublicKey,
@@ -19,17 +17,10 @@ export async function fetchPlugins(
const defaultOptions = AnchorProvider.defaultOptions();
const anchorProvider = new AnchorProvider(connection, wallet, defaultOptions);
- const [
- vsrClient,
- nftClient,
- gatewayClient,
- //switchboardClient,
- pythClient,
- ] = await Promise.all([
+ const [vsrClient, nftClient, gatewayClient, pythClient] = await Promise.all([
VsrClient.connect(anchorProvider, programPublicKey, isDevnet),
NftVoterClient.connect(anchorProvider, isDevnet),
GatewayClient.connect(anchorProvider, isDevnet),
- //SwitchboardQueueVoterClient.connect(anchorProvider, isDevnet),
PythClient.connect(anchorProvider, connection.rpcEndpoint),
]);
@@ -37,7 +28,6 @@ export async function fetchPlugins(
vsrClient,
nftClient,
gatewayClient,
- //switchboardClient,
pythClient,
};
}
diff --git a/hub/providers/Wallet/index.tsx b/hub/providers/Wallet/index.tsx
index f25e1fb44d..65a5d9a7b4 100644
--- a/hub/providers/Wallet/index.tsx
+++ b/hub/providers/Wallet/index.tsx
@@ -1,6 +1,6 @@
import { WalletContextState, useWallet } from '@solana/wallet-adapter-react';
import type { PublicKey } from '@solana/web3.js';
-import React, { createContext } from 'react';
+import React, { createContext, useState } from 'react';
import { useWalletSelector } from '@hub/hooks/useWalletSelector';
import { WalletSelector } from '@hub/providers/WalletSelector';
@@ -8,6 +8,8 @@ import { WalletSelector } from '@hub/providers/WalletSelector';
interface Value {
connect(): Promise
;
publicKey?: PublicKey;
+ softConnect: boolean;
+ setSoftConnect(value: boolean): void;
signMessage: NonNullable;
signTransaction: NonNullable;
signAllTransactions: NonNullable;
@@ -18,6 +20,10 @@ export const DEFAULT: Value = {
throw new Error('Not implemented');
},
publicKey: undefined,
+ softConnect: false,
+ setSoftConnect: () => {
+ throw new Error('Not implemented');
+ },
signMessage: async () => {
throw new Error('Not implemented');
},
@@ -38,12 +44,15 @@ interface Props {
function WalletProviderInner(props: Props) {
const { wallet } = useWallet();
const { getAdapter } = useWalletSelector();
+ const [softConnect, setSoftConnect] = useState(false);
return (
getAdapter().then(({ publicKey }) => publicKey),
publicKey: wallet?.adapter.publicKey || undefined,
+ setSoftConnect: (val) => setSoftConnect(val),
signMessage: async (message) => {
const { signMessage } = await getAdapter();
return signMessage(message);
diff --git a/pages/_app.tsx b/pages/_app.tsx
index b54b99f6bd..41c0d20f92 100644
--- a/pages/_app.tsx
+++ b/pages/_app.tsx
@@ -23,7 +23,8 @@ export default function App({ Component, pageProps, router }: AppProps) {
if (
router.pathname.startsWith('/verify-wallet') ||
router.pathname.startsWith('/matchday/verify-wallet') ||
- router.pathname.startsWith('/realm/[id]/governance')
+ router.pathname.startsWith('/realm/[id]/governance') ||
+ router.pathname.startsWith('/realm/[id]/config')
) {
return (
diff --git a/pages/dao/[symbol]/params/components/ParamsView.tsx b/pages/dao/[symbol]/params/components/ParamsView.tsx
index 243720b5c5..6a4fe9f195 100644
--- a/pages/dao/[symbol]/params/components/ParamsView.tsx
+++ b/pages/dao/[symbol]/params/components/ParamsView.tsx
@@ -6,12 +6,16 @@ import Button from '@components/Button'
import { VoteTipping } from '@solana/spl-governance'
import { AddressField, NumberField } from '../index'
import useProgramVersion from '@hooks/useProgramVersion'
+import { useRouter } from 'next/router'
+import useQueryContext from '@hooks/useQueryContext'
-const ParamsView = ({ activeGovernance, openGovernanceProposalModal }) => {
- const { realm, mint, councilMint, ownVoterWeight } = useRealm()
+const ParamsView = ({ activeGovernance }) => {
+ const { realm, mint, councilMint, ownVoterWeight, symbol } = useRealm()
const programVersion = useProgramVersion()
const realmAccount = realm?.account
const communityMint = realmAccount?.communityMint.toBase58()
+ const router = useRouter()
+ const { fmtUrlWithCluster } = useQueryContext()
const minCommunityTokensToCreateProposal = activeGovernance?.account?.config
?.minCommunityTokensToCreateProposal
@@ -134,7 +138,9 @@ const ParamsView = ({ activeGovernance, openGovernanceProposalModal }) => {
tooltipMessage={
'Please connect wallet with enough voting power to create governance config proposals'
}
- onClick={openGovernanceProposalModal}
+ onClick={() => {
+ router.push(fmtUrlWithCluster(`/realm/${symbol}/config/edit`))
+ }}
className="ml-auto"
>
Change config
diff --git a/pages/dao/[symbol]/params/index.tsx b/pages/dao/[symbol]/params/index.tsx
index 3a16a7264e..211e4cdc84 100644
--- a/pages/dao/[symbol]/params/index.tsx
+++ b/pages/dao/[symbol]/params/index.tsx
@@ -30,9 +30,9 @@ import useQueryContext from '@hooks/useQueryContext'
const Params = () => {
const router = useRouter()
- const { fmtUrlWithCluster } = useQueryContext()
const { realm, mint, config, symbol } = useRealm()
const wallet = useWalletStore((s) => s.current)
+ const { fmtUrlWithCluster } = useQueryContext()
const {
canUseAuthorityInstruction,
assetAccounts,
@@ -85,9 +85,6 @@ const Params = () => {
const communityMintMaxVoteWeightSource =
realmAccount?.config.communityMintMaxVoteWeightSource
const realmConfig = realmAccount?.config
- const openRealmProposalModal = () => {
- setIsRealmProposalModalOpen(true)
- }
const closeRealmProposalModal = () => {
setIsRealmProposalModalOpen(false)
}
@@ -262,7 +259,11 @@ const Params = () => {
? 'None of the governances is realm authority'
: ''
}
- onClick={openRealmProposalModal}
+ onClick={() => {
+ router.push(
+ fmtUrlWithCluster(`/realm/${symbol}/config/edit`)
+ )
+ }}
className="ml-auto"
>
Change config
@@ -331,16 +332,7 @@ const Params = () => {
/>
) : null}
{activeTab === 'Params' && (
-
- router.push(
- fmtUrlWithCluster(
- `/realm/${symbol}/governance/${activeGovernance.pubkey.toBase58()}/edit`
- )
- )
- }
- />
+
)}
{activeTab === 'Accounts' && (
{
+ if (id === ECOSYSTEM_PAGE.toBase58()) {
+ router.replace('/ecosystem')
+ }
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- TODO please fix, it can cause difficult bugs. You might wanna check out https://bobbyhadz.com/blog/react-hooks-exhaustive-deps for info. -@asktree
+ }, [id])
+
+ if (id === ECOSYSTEM_PAGE.toBase58()) {
+ return
+ }
+
+ return (
+
+
+
Edit Org Config
+
+
+
+
+ )
+}