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

feat: multisignature manager #707

Draft
wants to merge 19 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ INDEXER_ENDPOINT=indexer.local

NEXT_PUBLIC_POSTHOG_KEY=ph_project_api_key
NEXT_PUBLIC_POSTHOG_HOST=ph_instance_address

FAUNADB_SECRET=fauna_db_secret_key
FAUNADB_URL=fauna_db_url
8 changes: 8 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,18 @@ enableGlobalCache: false

nodeLinker: node-modules

npmRegistryServer: "http://npm.haqq.sh"

npmScopes:
npm:
npmAuthToken: yRcr2MaVexpigup8O46NCtAPb6OfFKeBlSwenr83ACQ=
npmRegistryServer: "http://npm.haqq.sh"
buf:
npmRegistryServer: "https://buf.build/gen/npm/v1"

unsafeHttpWhitelist:
- npm.haqq.sh

tsEnableAutoTypes: true

yarnPath: .yarn/releases/yarn-4.1.0.cjs
1 change: 1 addition & 0 deletions apps/shell/src/app/app-wrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ function HeaderButtons({
<HeaderNavLink href="/staking">Staking</HeaderNavLink>
<HeaderNavLink href="/governance">Governance</HeaderNavLink>
<HeaderNavLink href="/authz">Authz</HeaderNavLink>
<HeaderNavLink href="/multisig">Multisig</HeaderNavLink>
</nav>

<div className="hidden pl-[80px] lg:block">
Expand Down
42 changes: 35 additions & 7 deletions apps/shell/src/app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ const AirdropPage = lazy(async () => {
const { AirdropPage } = await import('@haqq/shell-airdrop');
return { default: AirdropPage };
});
const MultisigMainPage = lazy(async () => {
const { MultisigMainPage } = await import('@haqq/shell-multisig');
return { default: MultisigMainPage };
});
const MultisigAddressPage = lazy(async () => {
const { MultisigAddressPage } = await import('@haqq/shell-multisig');
return { default: MultisigAddressPage };
});

export function App() {
return (
Expand All @@ -54,6 +62,7 @@ export function App() {
</Routes>
}
/>

<Route
path="/governance/*"
element={
Expand All @@ -63,19 +72,38 @@ export function App() {
</Routes>
}
/>

<Route path="/authz" element={<ShellAuthzPage />} />

<Route
path="/airdrop"
path="/airdrop/*"
element={
<AirdropPage
turnstileSiteKey={environment.turnstileSiteKey}
airdropEndpoint={environment.airdropEndpoint}
/>
<Routes>
<Route
path="/"
element={
<AirdropPage
turnstileSiteKey={environment.turnstileSiteKey}
airdropEndpoint={environment.airdropEndpoint}
/>
}
/>
<Route
path="/revision-address"
element={<Navigate to="/airdrop" replace />}
/>
</Routes>
}
/>

<Route
path="/airdrop/revision-address"
element={<Navigate to="/airdrop" replace />}
path="/multisig/*"
element={
<Routes>
<Route path="/" element={<MultisigMainPage />} />
<Route path=":address" element={<MultisigAddressPage />} />
</Routes>
}
/>

<Route path="not-found" element={<NotFoundPage />} />
Expand Down
2 changes: 2 additions & 0 deletions apps/shell/src/environments/environment.prod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ export const environment = {
turnstileSiteKey: process.env['NX_TURNSTILE_SITEKEY'],
airdropEndpoint: process.env['NX_AIRDROP_ENDPOINT'],
commitSha: process.env['GIT_COMMIT_SHA'],
faunaDbSecret: process.env['FAUNADB_SECRET'],
faunaDbUrl: process.env['FAUNADB_URL'],
};
2 changes: 2 additions & 0 deletions apps/shell/src/environments/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ export const environment = {
turnstileSiteKey: process.env['NX_TURNSTILE_SITEKEY'],
airdropEndpoint: process.env['NX_AIRDROP_ENDPOINT'],
commitSha: process.env['GIT_COMMIT_SHA'],
faunaDbSecret: process.env['FAUNADB_SECRET'],
faunaDbUrl: process.env['FAUNADB_URL'],
};
11 changes: 10 additions & 1 deletion apps/shell/tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,14 @@
"src/**/*.spec.jsx",
"src/**/*.test.jsx"
],
"include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"]
"include": [
"src/**/*.js",
"src/**/*.jsx",
"src/**/*.ts",
"src/**/*.tsx",
"../../libs/multisig/src/lib/utils/display-helpers.ts",
"../../libs/multisig/src/lib/utils/graphql-helpers.ts",
"../../libs/multisig/src/lib/utils/multisig-helpers.ts",
"../../libs/multisig/src/lib/utils/request.ts"
]
}
14 changes: 14 additions & 0 deletions apps/shell/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ module.exports = composePlugins(
process.env['VERCEL_GIT_COMMIT_SHA'] ??
'dev',
),
'process.env.FAUNADB_SECRET': JSON.stringify(
process.env.FAUNADB_SECRET,
),
'process.env.FAUNADB_URL': JSON.stringify(process.env.FAUNADB_URL),
}),
],
node: { global: true },
Expand All @@ -41,6 +45,16 @@ module.exports = composePlugins(
url: false,
},
},
ignoreWarnings: [
{ module: /next/ },
{ module: /cosmjs-types/ },
{ module: /ethereumjs-util/ },
{ module: /@evmos/ },
{ module: /@walletconnect/ },
{ module: /@cosmjs/ },
{ module: /@haqqjs/ },
{ module: /@confio/ },
],
});
},
);
14 changes: 14 additions & 0 deletions apps/shell/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ module.exports = composePlugins(
process.env['VERCEL_GIT_COMMIT_SHA'] ??
'dev',
),
'process.env.FAUNADB_SECRET': JSON.stringify(
process.env.FAUNADB_SECRET,
),
'process.env.FAUNADB_URL': JSON.stringify(process.env.FAUNADB_URL),
}),
],
node: { global: true },
Expand All @@ -41,6 +45,16 @@ module.exports = composePlugins(
url: false,
},
},
ignoreWarnings: [
{ module: /next/ },
{ module: /cosmjs-types/ },
{ module: /ethereumjs-util/ },
{ module: /@evmos/ },
{ module: /@walletconnect/ },
{ module: /@cosmjs/ },
{ module: /@haqqjs/ },
{ module: /@confio/ },
],
});
},
);
4 changes: 2 additions & 2 deletions apps/vesting/src/OnboardingContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
createContext,
ReactElement,
PropsWithChildren,
useCallback,
useContext,
useEffect,
Expand Down Expand Up @@ -34,7 +34,7 @@ export interface OnboardingHook {

const OnboardingContext = createContext<OnboardingHook | undefined>(undefined);

export function OnboardingContainer({ children }: { children: ReactElement }) {
export function OnboardingContainer({ children }: PropsWithChildren) {
const { chain } = useNetwork();
const { chains, switchNetworkAsync } = useSwitchNetwork();
const [step, setOnboardingStep] = useState<OnboardingSteps>('start');
Expand Down
21 changes: 14 additions & 7 deletions apps/vesting/src/app/app-container.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,32 @@
import { ReactElement } from 'react';
import { haqqMainnet } from '@wagmi/chains';
import { PropsWithChildren } from 'react';
import { BrowserRouter } from 'react-router-dom';
import { haqqMainnet, haqqTestedge2 } from 'viem/chains';
import {
CosmosProvider,
ReactQueryProvider,
Toaster,
WagmiProvider,
WalletProvider,
} from '@haqq/shared';
import { environment } from '../environments/environment';
import { OnboardingContainer } from '../OnboardingContainer';

export function AppContainer({ children }: { children: ReactElement }) {
export function AppContainer({ children }: PropsWithChildren) {
return (
<BrowserRouter>
<ReactQueryProvider>
<WagmiProvider
walletConnectProjectId={environment.walletConnectProjectId}
supportedChains={[haqqMainnet]}
supportedChains={[haqqMainnet, haqqTestedge2]}
>
<CosmosProvider>
<OnboardingContainer>{children}</OnboardingContainer>
</CosmosProvider>
<WalletProvider>
<CosmosProvider>
<OnboardingContainer>
{children}
<Toaster />
</OnboardingContainer>
</CosmosProvider>
</WalletProvider>
</WagmiProvider>
</ReactQueryProvider>
</BrowserRouter>
Expand Down
34 changes: 22 additions & 12 deletions apps/vesting/src/components/Button/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ReactNode, SyntheticEvent } from 'react';
import clsx from 'clsx';
import { Loader } from '../Loader/Loader';

export interface ButtonProps {
children: ReactNode;
Expand All @@ -10,6 +11,7 @@ export interface ButtonProps {
fill?: boolean;
type?: 'submit' | 'reset' | 'button';
onClick?: (event: SyntheticEvent<HTMLButtonElement, MouseEvent>) => void;
isPending?: boolean;
}

export function Button({
Expand All @@ -20,28 +22,36 @@ export function Button({
fill = false,
type = 'button',
className,
isPending = false,
}: ButtonProps) {
const classNames = clsx(
outline
? 'bg-transparent text-primary border-[2px] border-solid border-primary hover:text-[#20d775] hover:border-[#20d775]'
: 'bg-primary text-white hover:bg-[#20d775]',
'bg-primary text-white hover:bg-[#20d775]',
'text-base font-semibold font-sans leading-[24px]',
'rounded-[8px] py-[8px] px-[16px] appearance-none box-border',
? 'bg-transparent text-primary border-[1px] border-solid border-primary hover:text-[#20d775] hover:border-[#20d775] py-[10px]'
: 'bg-primary text-white hover:bg-[#20d775] py-[11px]',
'text-[14px] font-semibold font-sans leading-[20px]',
'rounded-[8px] px-[16px] appearance-none relative',
'transition-colors duration-150 ease-linear',
fill ? 'w-full' : 'inline-block',
{ 'opacity-75 cursor-not-allowed': disabled },
disabled && 'opacity-75 cursor-not-allowed',
isPending && 'cursor-wait',
className,
);

return (
<button
type={type}
disabled={disabled}
onClick={onClick}
className={classNames}
disabled={disabled || isPending}
>
{children}
<span className={clsx(isPending && 'invisible')}>{children}</span>

<Loader
className={clsx(
'pointer-events-none absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2',
isPending ? 'visible' : 'invisible',
)}
/>
</button>
);
}
Expand All @@ -57,10 +67,10 @@ export function DangerButton({
}: ButtonProps) {
const classNames = clsx(
outline
? 'bg-transparent text-danger border-[2px] border-solid border-danger hover:text-[#ff0000] hover:border-[#ff0000]'
: 'bg-danger text-white hover:bg-[#ff0000]',
'text-base font-semibold font-sans leading-[24px]',
'rounded-[8px] py-[8px] px-[16px] appearance-none box-border',
? 'bg-transparent text-danger border-[1px] border-solid border-danger hover:text-[#ff0000] hover:border-[#ff0000] py-[10px]'
: 'bg-danger text-white hover:bg-[#ff0000] py-[11px]',
'text-[14px] font-semibold font-sans leading-[20px]',
'rounded-[8px] px-[16px] appearance-none box-border',
'transition-colors duration-150 ease-linear',
fill ? 'w-full' : 'inline-block',
{ 'opacity-75 cursor-not-allowed': disabled },
Expand Down
Loading
Loading