From f1cd5f839b74a2341648574b768df85109078fa5 Mon Sep 17 00:00:00 2001
From: ianrowan
Date: Wed, 30 Oct 2024 13:42:24 -0500
Subject: [PATCH 001/227] add connector weights
---
libs/shared/src/commonProtocol/contractHelpers/Launchpad.ts | 2 ++
.../client/scripts/helpers/ContractHelpers/Launchpad.ts | 2 ++
.../scripts/helpers/ContractHelpers/LaunchpadFactoryAbi.ts | 1 +
3 files changed, 5 insertions(+)
diff --git a/libs/shared/src/commonProtocol/contractHelpers/Launchpad.ts b/libs/shared/src/commonProtocol/contractHelpers/Launchpad.ts
index 48219249f35..592a7ca5bad 100644
--- a/libs/shared/src/commonProtocol/contractHelpers/Launchpad.ts
+++ b/libs/shared/src/commonProtocol/contractHelpers/Launchpad.ts
@@ -7,6 +7,7 @@ export const launchToken = async (
holders: string[],
totalSupply: string,
walletAddress: string,
+ connectorWeight: number,
) => {
const txReceipt = await contract.methods
.launchTokenWithLiquidity(
@@ -19,6 +20,7 @@ export const launchToken = async (
0,
'0x0000000000000000000000000000000000000000',
'0xfa9ff727d2ee42cc337d2008a74440bff8d2e9ae',
+ connectorWeight,
)
.send({ from: walletAddress, value: 0.00000011e18 });
return txReceipt;
diff --git a/packages/commonwealth/client/scripts/helpers/ContractHelpers/Launchpad.ts b/packages/commonwealth/client/scripts/helpers/ContractHelpers/Launchpad.ts
index 23d8942530c..5a1ec8ddbe3 100644
--- a/packages/commonwealth/client/scripts/helpers/ContractHelpers/Launchpad.ts
+++ b/packages/commonwealth/client/scripts/helpers/ContractHelpers/Launchpad.ts
@@ -43,6 +43,7 @@ class LaunchpadBondingCurve extends ContractBase {
symbol: string,
walletAddress: string,
chainId: string,
+ connectorWeight: number = 830000,
) {
if (!this.initialized || !this.walletEnabled) {
await this.initialize(true, chainId);
@@ -57,6 +58,7 @@ class LaunchpadBondingCurve extends ContractBase {
[],
this.web3.utils.toWei(1e9, 'ether'), // Default 1B tokens
walletAddress,
+ connectorWeight,
);
return txReceipt;
}
diff --git a/packages/commonwealth/client/scripts/helpers/ContractHelpers/LaunchpadFactoryAbi.ts b/packages/commonwealth/client/scripts/helpers/ContractHelpers/LaunchpadFactoryAbi.ts
index 21b0f2a34a3..0c199d3d79d 100644
--- a/packages/commonwealth/client/scripts/helpers/ContractHelpers/LaunchpadFactoryAbi.ts
+++ b/packages/commonwealth/client/scripts/helpers/ContractHelpers/LaunchpadFactoryAbi.ts
@@ -12,6 +12,7 @@ export const LaunchpadFactory = [
{ name: 'scalar', type: 'uint256', internalType: 'uint256' },
{ name: 'lphook', type: 'address', internalType: 'address' },
{ name: 'launchAction', type: 'address', internalType: 'address' },
+ { name: 'connectorWeight', type: 'uint32', internalType: 'uint32' },
],
outputs: [],
stateMutability: 'payable',
From be97e700995ac2e2d11b6de1c6a57e250f754c18 Mon Sep 17 00:00:00 2001
From: Ryan Bennett
Date: Thu, 7 Nov 2024 08:47:47 -0800
Subject: [PATCH 002/227] adds query to fetch farcaster contest frames
---
.../src/contest/GetFarcasterContestCasts.ts | 35 +++++++++++++++++++
libs/schemas/src/queries/contests.schemas.ts | 7 ++++
2 files changed, 42 insertions(+)
create mode 100644 libs/model/src/contest/GetFarcasterContestCasts.ts
diff --git a/libs/model/src/contest/GetFarcasterContestCasts.ts b/libs/model/src/contest/GetFarcasterContestCasts.ts
new file mode 100644
index 00000000000..e10c848842d
--- /dev/null
+++ b/libs/model/src/contest/GetFarcasterContestCasts.ts
@@ -0,0 +1,35 @@
+import { Query } from '@hicommonwealth/core';
+import * as schemas from '@hicommonwealth/schemas';
+import { BulkCastsSortType, NeynarAPIClient } from '@neynar/nodejs-sdk';
+import { config } from '../config';
+import { models } from '../database';
+import { mustExist } from '../middleware/guards';
+
+export function GetFarcasterContestCasts(): Query<
+ typeof schemas.GetFarcasterContestCasts
+> {
+ return {
+ ...schemas.GetFarcasterContestCasts,
+ auth: [],
+ secure: false,
+ body: async ({ payload }) => {
+ const contestManager = await models.ContestManager.findOne({
+ where: {
+ contest_address: payload.contest_address,
+ },
+ });
+ mustExist('Contest Manager', contestManager);
+ if (!contestManager.farcaster_frame_hashes?.length) {
+ return [];
+ }
+ const client = new NeynarAPIClient(config.CONTESTS.NEYNAR_API_KEY!);
+ const frames = await client.fetchBulkCasts(
+ contestManager.farcaster_frame_hashes,
+ {
+ sortType: BulkCastsSortType.LIKES,
+ },
+ );
+ return frames.result.casts;
+ },
+ };
+}
diff --git a/libs/schemas/src/queries/contests.schemas.ts b/libs/schemas/src/queries/contests.schemas.ts
index 5a72772d9eb..4c4f57103b0 100644
--- a/libs/schemas/src/queries/contests.schemas.ts
+++ b/libs/schemas/src/queries/contests.schemas.ts
@@ -86,3 +86,10 @@ export const GetFarcasterUpvoteActionMetadata = {
}),
}),
};
+
+export const GetFarcasterContestCasts = {
+ input: z.object({
+ contest_address: z.string(),
+ }),
+ output: z.array(z.any()),
+};
From db65308192b9e80798ed12b9c122bbf0a180186a Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Fri, 8 Nov 2024 19:09:36 +0500
Subject: [PATCH 003/227] Added token trade form and modal
---
.../client/scripts/helpers/currency.ts | 35 ++++
.../component_kit/new_designs/CWTag.tsx | 3 +-
.../CustomAddressOption.scss | 12 ++
.../StakeExchangeForm/CustomAddressOption.tsx | 4 +-
.../StakeExchangeForm/StakeExchangeForm.scss | 12 --
.../TradeTokenForm/TradeTokenForm.scss | 118 +++++++++++
.../TradeTokenForm/TradeTokenForm.tsx | 195 ++++++++++++++++++
.../TradeTokenModel/TradeTokenForm/helpers.ts | 4 +
.../TradeTokenModel/TradeTokenForm/index.ts | 6 +
.../TradeTokenModel/TradeTokenForm/types.ts | 37 ++++
.../TradeTokenForm/useTokenTradeForm.ts | 81 ++++++++
.../TradeTokenModel/TradeTokenModal.scss | 4 +
.../TradeTokenModel/TradeTokenModal.tsx | 77 +++++++
.../views/modals/TradeTokenModel/index.ts | 3 +
.../Communities/TokensList/TokensList.tsx | 34 ++-
.../component_kit/new_designs/CWTag.scss | 13 ++
.../commonwealth/client/styles/utils.scss | 4 +
17 files changed, 626 insertions(+), 16 deletions(-)
create mode 100644 packages/commonwealth/client/scripts/helpers/currency.ts
create mode 100644 packages/commonwealth/client/scripts/views/modals/ManageCommunityStakeModal/StakeExchangeForm/CustomAddressOption.scss
create mode 100644 packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.scss
create mode 100644 packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx
create mode 100644 packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/helpers.ts
create mode 100644 packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/index.ts
create mode 100644 packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts
create mode 100644 packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTokenTradeForm.ts
create mode 100644 packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.scss
create mode 100644 packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.tsx
create mode 100644 packages/commonwealth/client/scripts/views/modals/TradeTokenModel/index.ts
diff --git a/packages/commonwealth/client/scripts/helpers/currency.ts b/packages/commonwealth/client/scripts/helpers/currency.ts
new file mode 100644
index 00000000000..79c3cc972f5
--- /dev/null
+++ b/packages/commonwealth/client/scripts/helpers/currency.ts
@@ -0,0 +1,35 @@
+export enum SupportedCurrencies {
+ USD = 'USD',
+}
+
+export enum CurrenciesSymbols {
+ USD = '$',
+}
+
+export const currencyNameToSymbolMap: Record<
+ SupportedCurrencies,
+ CurrenciesSymbols
+> = {
+ [SupportedCurrencies.USD]: CurrenciesSymbols.USD,
+ // add more when supported
+};
+
+export const currencySymbolPlacements = {
+ onLeft: [SupportedCurrencies.USD],
+ onRight: [] as string[], // some currencies use right side placements
+};
+
+export const getAmountWithCurrencySymbol = (
+ amount: number,
+ currencyName: SupportedCurrencies,
+) => {
+ const symbol = currencyNameToSymbolMap[currencyName];
+ const leftSymbol = currencySymbolPlacements.onLeft.includes(currencyName)
+ ? symbol
+ : '';
+ const rightymbol = currencySymbolPlacements.onRight.includes(currencyName)
+ ? symbol
+ : '';
+
+ return `${leftSymbol} ${amount} ${rightymbol}`;
+};
diff --git a/packages/commonwealth/client/scripts/views/components/component_kit/new_designs/CWTag.tsx b/packages/commonwealth/client/scripts/views/components/component_kit/new_designs/CWTag.tsx
index 487c98790cd..22500a34a16 100644
--- a/packages/commonwealth/client/scripts/views/components/component_kit/new_designs/CWTag.tsx
+++ b/packages/commonwealth/client/scripts/views/components/component_kit/new_designs/CWTag.tsx
@@ -26,7 +26,8 @@ type TagType =
| 'address'
| 'group'
| 'contest'
- | 'filter';
+ | 'filter'
+ | 'amount';
export type TagProps = {
iconName?: IconName;
diff --git a/packages/commonwealth/client/scripts/views/modals/ManageCommunityStakeModal/StakeExchangeForm/CustomAddressOption.scss b/packages/commonwealth/client/scripts/views/modals/ManageCommunityStakeModal/StakeExchangeForm/CustomAddressOption.scss
new file mode 100644
index 00000000000..b2b805dfa2a
--- /dev/null
+++ b/packages/commonwealth/client/scripts/views/modals/ManageCommunityStakeModal/StakeExchangeForm/CustomAddressOption.scss
@@ -0,0 +1,12 @@
+@import '../../../../../styles/shared.scss';
+
+.CustomAddressOptionElement {
+ display: flex;
+ align-items: center;
+ font-weight: 500;
+
+ .check-icon {
+ fill: $green-600;
+ margin-right: 8px;
+ }
+}
diff --git a/packages/commonwealth/client/scripts/views/modals/ManageCommunityStakeModal/StakeExchangeForm/CustomAddressOption.tsx b/packages/commonwealth/client/scripts/views/modals/ManageCommunityStakeModal/StakeExchangeForm/CustomAddressOption.tsx
index 12787054b41..fc4fac92039 100644
--- a/packages/commonwealth/client/scripts/views/modals/ManageCommunityStakeModal/StakeExchangeForm/CustomAddressOption.tsx
+++ b/packages/commonwealth/client/scripts/views/modals/ManageCommunityStakeModal/StakeExchangeForm/CustomAddressOption.tsx
@@ -3,6 +3,7 @@ import { components, OptionProps } from 'react-select';
import { formatAddressShort } from 'helpers';
import { CWIcon } from 'views/components/component_kit/cw_icons/cw_icon';
+import './CustomAddressOption.scss';
interface CustomAddressOptionElement {
value: string;
@@ -16,11 +17,12 @@ const CustomAddressOptionElement = ({
selectedAddressValue,
}: CustomAddressOptionElement) => {
return (
-
+
{value === selectedAddressValue && (
)}
diff --git a/packages/commonwealth/client/scripts/views/modals/ManageCommunityStakeModal/StakeExchangeForm/StakeExchangeForm.scss b/packages/commonwealth/client/scripts/views/modals/ManageCommunityStakeModal/StakeExchangeForm/StakeExchangeForm.scss
index e698d17b361..87494e68f94 100644
--- a/packages/commonwealth/client/scripts/views/modals/ManageCommunityStakeModal/StakeExchangeForm/StakeExchangeForm.scss
+++ b/packages/commonwealth/client/scripts/views/modals/ManageCommunityStakeModal/StakeExchangeForm/StakeExchangeForm.scss
@@ -20,18 +20,6 @@
z-index: 10;
}
- // address dropdown items
- .text-container {
- display: flex;
- align-items: center;
- font-weight: 500;
-
- .check-icon {
- fill: $green-600;
- margin-right: 8px;
- }
- }
-
.current-balance-row {
display: flex;
justify-content: space-between;
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.scss b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.scss
new file mode 100644
index 00000000000..e380176317c
--- /dev/null
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.scss
@@ -0,0 +1,118 @@
+@import '../../../../../styles/shared.scss';
+
+.TokenTradeForm {
+ display: flex;
+ flex-direction: column;
+ gap: 12px;
+
+ .balance-row {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ padding: 8px 4px;
+ }
+
+ .amount-selection {
+ .text-light {
+ color: $neutral-400;
+ }
+
+ display: flex;
+ flex-direction: column;
+ gap: 4px;
+ width: 100%;
+ background-color: $neutral-50;
+ border-radius: 6px;
+ padding: 12px 16px;
+
+ @include extraSmall {
+ gap: 16px;
+ }
+
+ .amount-input-with-currency-symbol {
+ display: flex;
+ width: fit-content;
+ margin: auto;
+ background-color: $neutral-200;
+ border: 1px solid $neutral-300;
+ border-radius: 6px;
+ --font-size: 28px;
+
+ .amount-symbol {
+ border-radius: 6px;
+ margin: auto;
+ font-size: var(--font-size);
+ padding: 10px 8px;
+ background-color: $neutral-200;
+ color: $neutral-500;
+ }
+
+ .amount-input,
+ .amount-input > * {
+ max-width: 120px;
+ height: 48px !important;
+ min-height: 48px !important;
+
+ input {
+ height: 48px !important;
+ min-height: 48px !important;
+ text-align: center;
+ font-size: var(--font-size);
+ font-weight: bold;
+ color: $black;
+
+ &:focus-within {
+ border-color: $primary-500 !important;
+ box-shadow:
+ 0px 2px 2px -1px rgba(0, 0, 0, 0.12),
+ 0px 0px 0px 3px $primary-200 !important;
+ }
+ }
+ }
+ }
+
+ .amount-to-crypto {
+ text-align: center;
+ margin: auto;
+ width: fit-content;
+ }
+
+ .preset-amounts {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ flex-wrap: wrap;
+ gap: 8px;
+ margin: auto;
+ margin-top: 12px;
+
+ @include extraSmall {
+ margin-top: 4px;
+ }
+ }
+ }
+
+ .receipt-and-fees {
+ .header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ padding: 0 4px;
+
+ .dropdown {
+ display: flex;
+ align-items: center;
+ gap: 4px;
+ }
+ }
+ }
+
+ .action-btn {
+ &:focus-within {
+ border-width: 1px !important;
+ padding: 0 !important;
+ }
+
+ margin: 0 !important;
+ }
+}
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx
new file mode 100644
index 00000000000..d1b42957971
--- /dev/null
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx
@@ -0,0 +1,195 @@
+import {
+ currencyNameToSymbolMap,
+ currencySymbolPlacements,
+ getAmountWithCurrencySymbol,
+} from 'helpers/currency';
+import React, { ReactNode, useState } from 'react';
+import { CWIcon } from 'views/components/component_kit/cw_icons/cw_icon';
+import { CWText } from 'views/components/component_kit/cw_text';
+import { CWButton } from 'views/components/component_kit/new_designs/CWButton';
+import CWIconButton from 'views/components/component_kit/new_designs/CWIconButton';
+import { CWSelectList } from 'views/components/component_kit/new_designs/CWSelectList';
+import {
+ CWTab,
+ CWTabsRow,
+} from 'views/components/component_kit/new_designs/CWTabs';
+import { CWTag } from 'views/components/component_kit/new_designs/CWTag';
+import { CWTextInput } from 'views/components/component_kit/new_designs/CWTextInput';
+import { CWTooltip } from 'views/components/component_kit/new_designs/CWTooltip';
+import {
+ CustomAddressOption,
+ CustomAddressOptionElement,
+} from '../../ManageCommunityStakeModal/StakeExchangeForm/CustomAddressOption';
+import './TradeTokenForm.scss';
+import { convertAddressToDropdownOption } from './helpers';
+import { TradeTokenFormProps, TradingMode } from './types';
+
+const TradeTokenForm = ({
+ trading,
+ addresses,
+ tradingMode,
+ onTradingAmountChange,
+ tradingAmount,
+ onTradingModeChange,
+ onCTAClick,
+ isActionPending,
+}: TradeTokenFormProps) => {
+ const [isReceiptDetailOpen, setIsReceiptDetailOpen] = useState(false);
+
+ const amountCurrenySymbol = (
+
+ {currencyNameToSymbolMap[trading.currency]}
+
+ );
+
+ const withOptionalTooltip = (
+ children: ReactNode,
+ content: string,
+ shouldDisplay,
+ ) => {
+ if (!shouldDisplay) return children;
+
+ return (
+
(
+
+ {children}
+
+ )}
+ />
+ );
+ };
+
+ return (
+
+
+ {Object.keys(TradingMode).map((mode) => (
+ onTradingModeChange(TradingMode[mode])}
+ isSelected={tradingMode === TradingMode[mode]}
+ />
+ ))}
+
+
+
+
+ CustomAddressOption({
+ originalProps,
+ selectedAddressValue: addresses.selected || '',
+ }),
+ }}
+ noOptionsMessage={() => 'No available Metamask address'}
+ value={convertAddressToDropdownOption(addresses.selected || '')}
+ formatOptionLabel={(option) => (
+
+ )}
+ label="Select address"
+ isClearable={false}
+ isSearchable={false}
+ options={(addresses.available || [])?.map(
+ convertAddressToDropdownOption,
+ )}
+ onChange={(option) =>
+ option?.value && addresses.onChange(option.value)
+ }
+ />
+
+
+ Current balance
+
+
+ 0.005 ETH
+
+
+
+
+
+
+ You're {tradingMode}ing
+
+
+
+ {currencySymbolPlacements.onLeft.includes(trading.currency) &&
+ amountCurrenySymbol}
+ onTradingAmountChange(e)}
+ />
+ {currencySymbolPlacements.onRight.includes(trading.currency) &&
+ amountCurrenySymbol}
+
+
+
+
+ 0.005 ETH
+
+
+ {trading.presetAmounts && (
+
+ {trading.presetAmounts?.map((presetAmount) => (
+ onTradingAmountChange(presetAmount)}
+ />
+ ))}
+
+ )}
+
+
+
+
+
+ setIsReceiptDetailOpen((o) => !o)}
+ />
+ Subtotal + fees
+
+
+
+ 0.053 ETH
+
+
+ {/* TODO: add receipt details here */}
+
+
+ {withOptionalTooltip(
+ ,
+ 'Please add trading amount to continue',
+ tradingAmount === 0,
+ )}
+
+ );
+};
+
+export default TradeTokenForm;
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/helpers.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/helpers.ts
new file mode 100644
index 00000000000..0f983dda0d6
--- /dev/null
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/helpers.ts
@@ -0,0 +1,4 @@
+export const convertAddressToDropdownOption = (address: string) => ({
+ label: address,
+ value: address,
+});
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/index.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/index.ts
new file mode 100644
index 00000000000..1bd75bbb790
--- /dev/null
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/index.ts
@@ -0,0 +1,6 @@
+import TradeTokenForm from './TradeTokenForm';
+import useTokenTradeForm from './useTokenTradeForm';
+export * from './types';
+export * from './useTokenTradeForm';
+export { useTokenTradeForm };
+export default TradeTokenForm;
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts
new file mode 100644
index 00000000000..db41233f32b
--- /dev/null
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts
@@ -0,0 +1,37 @@
+import { Token } from '@hicommonwealth/schemas';
+import { ChainBase } from '@hicommonwealth/shared';
+import { SupportedCurrencies } from 'helpers/currency';
+import { z } from 'zod';
+import useTokenTradeForm from './useTokenTradeForm';
+
+export enum TradingMode {
+ Buy = 'buy',
+ Sell = 'sell',
+}
+
+export type TradeTokenFormProps = {
+ trading: { currency: SupportedCurrencies; presetAmounts?: number[] };
+ addresses: {
+ selected?: string;
+ available: string[];
+ default?: string;
+ onChange: (address: string) => void;
+ };
+ onCTAClick: () => void;
+} & Omit<
+ // IMPORTANT: typescript won't give error if `useTokenTradeForm`
+ // updates in future to not export the omitted properties here
+ ReturnType,
+ 'addressDropdownListOptions' | 'userAddresses'
+>;
+
+export type TradingConfig = {
+ mode: TradingMode;
+ token: z.infer;
+ addressType: ChainBase;
+};
+
+export type UseTokenTradeFormProps = {
+ tradeConfig: TradingConfig & { currency: SupportedCurrencies };
+ addressType?: ChainBase;
+};
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTokenTradeForm.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTokenTradeForm.ts
new file mode 100644
index 00000000000..c95f756e83d
--- /dev/null
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTokenTradeForm.ts
@@ -0,0 +1,81 @@
+import useRunOnceOnCondition from 'client/scripts/hooks/useRunOnceOnCondition';
+import useUserStore from 'client/scripts/state/ui/user';
+import { useMemo, useState } from 'react';
+import './TradeTokenForm.scss';
+import { TradingMode, UseTokenTradeFormProps } from './types';
+
+const useTokenTradeForm = ({
+ tradeConfig,
+ addressType,
+}: UseTokenTradeFormProps) => {
+ const [tradingAmount, setTradingAmount] = useState(0);
+ const [tradingMode, setTradingMode] = useState(
+ tradeConfig.mode || TradingMode.Buy,
+ );
+ const user = useUserStore();
+ const userAddresses = useMemo(() => {
+ // get all the addresses of the user that matches chain base
+ const tempUserAddresses = user.addresses
+ .filter((addr) =>
+ addressType ? addr.community.base === addressType : true,
+ )
+ .map((addr) => addr.address);
+
+ // return all the unique addresses
+ return [...new Set(tempUserAddresses)];
+ }, [user.addresses, addressType]);
+ const [selectedAddress, setSelectedAddress] = useState();
+
+ useRunOnceOnCondition({
+ callback: () => setSelectedAddress(userAddresses[0]),
+ shouldRun: userAddresses.length > 0 && !selectedAddress,
+ });
+
+ const onTradingAmountChange = (
+ change: React.ChangeEvent | number,
+ ) => {
+ if (typeof change == 'number') {
+ setTradingAmount(change);
+ } else {
+ const value = change.target.value;
+
+ if (value === '') setTradingAmount(0);
+ // verify only numbers with decimal (optional) are present
+ else if (/^\d+(\.\d+)?$/.test(value)) setTradingAmount(parseFloat(value));
+ }
+ };
+
+ const onTradingModeChange = (mode: TradingMode) => {
+ setTradingMode(mode);
+ };
+
+ const onChangeSelectedAddress = (address: string) => {
+ setSelectedAddress(address);
+ };
+
+ const onCTAClick = () => {
+ console.log('TODO: implement trade with data => ', {
+ tradingAmount,
+ tradingMode,
+ tradeConfig,
+ });
+ };
+
+ return {
+ // Note: not exporting state setters directly, since some extra
+ // functionality is done in most "onChange" handlers above
+ tradingAmount,
+ onTradingAmountChange,
+ tradingMode,
+ onTradingModeChange,
+ userAddresses: {
+ available: userAddresses,
+ selected: selectedAddress,
+ onChange: onChangeSelectedAddress,
+ },
+ isActionPending: false, // flag to indicate if something is ongoing - will come from token api state
+ onCTAClick,
+ };
+};
+
+export default useTokenTradeForm;
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.scss b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.scss
new file mode 100644
index 00000000000..7d5928c44cc
--- /dev/null
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.scss
@@ -0,0 +1,4 @@
+@import '../../../../styles/shared.scss';
+
+.TradeTokenModal {
+}
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.tsx b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.tsx
new file mode 100644
index 00000000000..71699a47dda
--- /dev/null
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.tsx
@@ -0,0 +1,77 @@
+import { SupportedCurrencies } from 'helpers/currency';
+import React from 'react';
+import {
+ CWModal,
+ CWModalBody,
+ CWModalFooter,
+ CWModalHeader,
+} from '../../components/component_kit/new_designs/CWModal';
+import TradeTokenForm, {
+ TradingConfig,
+ useTokenTradeForm,
+} from './TradeTokenForm';
+import './TradeTokenModal.scss';
+
+const TRADING_CURRENCY = SupportedCurrencies.USD; // make configurable when needed
+
+type TradeTokenModalProps = {
+ isOpen: boolean;
+ onModalClose?: () => void;
+ tradeConfig: TradingConfig;
+};
+
+const TradeTokenModal = ({
+ isOpen,
+ onModalClose,
+ tradeConfig,
+}: TradeTokenModalProps) => {
+ const {
+ tradingAmount,
+ onTradingAmountChange,
+ tradingMode,
+ onTradingModeChange,
+ userAddresses,
+ isActionPending,
+ onCTAClick,
+ } = useTokenTradeForm({
+ tradeConfig: { ...tradeConfig, currency: TRADING_CURRENCY },
+ addressType: tradeConfig.addressType,
+ });
+
+ return (
+ onModalClose?.()}
+ size="medium"
+ className="AuthModal"
+ content={
+ <>
+ onModalClose?.()}
+ />
+
+
+
+
+ <>>
+
+ >
+ }
+ />
+ );
+};
+
+export default TradeTokenModal;
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/index.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/index.ts
new file mode 100644
index 00000000000..5067a2ebc9b
--- /dev/null
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/index.ts
@@ -0,0 +1,3 @@
+import TradeTokenModal from './TradeTokenModal';
+
+export default TradeTokenModal;
diff --git a/packages/commonwealth/client/scripts/views/pages/Communities/TokensList/TokensList.tsx b/packages/commonwealth/client/scripts/views/pages/Communities/TokensList/TokensList.tsx
index 0190494ae3d..c332589d312 100644
--- a/packages/commonwealth/client/scripts/views/pages/Communities/TokensList/TokensList.tsx
+++ b/packages/commonwealth/client/scripts/views/pages/Communities/TokensList/TokensList.tsx
@@ -1,18 +1,31 @@
-import { CWButton } from 'client/scripts/views/components/component_kit/new_designs/CWButton';
+import { Token } from '@hicommonwealth/schemas';
+import { ChainBase } from '@hicommonwealth/shared';
import clsx from 'clsx';
import { useFlag } from 'hooks/useFlag';
import { navigateToCommunity, useCommonNavigate } from 'navigation/helpers';
-import React from 'react';
+import React, { useState } from 'react';
import { Link } from 'react-router-dom';
import { useFetchTokensQuery } from 'state/api/tokens';
import { CWText } from 'views/components/component_kit/cw_text';
+import { CWButton } from 'views/components/component_kit/new_designs/CWButton';
import CWCircleMultiplySpinner from 'views/components/component_kit/new_designs/CWCircleMultiplySpinner';
+import TradeTokenModal from 'views/modals/TradeTokenModel';
+import { TradingMode } from 'views/modals/TradeTokenModel/TradeTokenForm/types';
+import { z } from 'zod';
import TokenCard from '../../../components/TokenCard';
import './TokensList.scss';
const TokensList = () => {
const navigate = useCommonNavigate();
const tokenizedCommunityEnabled = useFlag('tokenizedCommunity');
+ const [tokenLaunchModalConfig, setTokenLaunchModalConfig] = useState<{
+ isOpen: boolean;
+ tradeConfig?: {
+ mode: TradingMode;
+ token: z.infer;
+ addressType: ChainBase;
+ };
+ }>({ isOpen: false, tradeConfig: undefined });
const {
data: tokensList,
@@ -70,6 +83,16 @@ const TokensList = () => {
// }
mode="buy"
iconURL={token.icon_url || ''}
+ onCTAClick={() =>
+ setTokenLaunchModalConfig({
+ isOpen: true,
+ tradeConfig: {
+ mode: TradingMode.Buy,
+ token: token as z.infer,
+ addressType: ChainBase.Ethereum,
+ },
+ })
+ }
onCardBodyClick={() =>
navigateToCommunity({
navigate,
@@ -95,6 +118,13 @@ const TokensList = () => {
) : (
<>>
)}
+ {tokenLaunchModalConfig.tradeConfig && (
+ setTokenLaunchModalConfig({ isOpen: false })}
+ />
+ )}
);
};
diff --git a/packages/commonwealth/client/styles/components/component_kit/new_designs/CWTag.scss b/packages/commonwealth/client/styles/components/component_kit/new_designs/CWTag.scss
index 5119ecccb12..84f8668c82e 100644
--- a/packages/commonwealth/client/styles/components/component_kit/new_designs/CWTag.scss
+++ b/packages/commonwealth/client/styles/components/component_kit/new_designs/CWTag.scss
@@ -316,4 +316,17 @@
color: $black !important;
}
}
+
+ &.amount {
+ height: auto;
+ background-color: $neutral-200;
+ padding: 8px 12px;
+ border-radius: 40px;
+ cursor: pointer;
+
+ .Text {
+ font-size: 16px;
+ color: $neutral-500;
+ }
+ }
}
diff --git a/packages/commonwealth/client/styles/utils.scss b/packages/commonwealth/client/styles/utils.scss
index 66c3f7fd8f6..4edcbdc749b 100644
--- a/packages/commonwealth/client/styles/utils.scss
+++ b/packages/commonwealth/client/styles/utils.scss
@@ -22,6 +22,10 @@
text-transform: capitalize;
}
+.uppercase {
+ text-transform: uppercase;
+}
+
.px-16 {
padding: 0 16px !important;
}
From 7deb20de01aefd14ff5d89e2e155d7b672b93376 Mon Sep 17 00:00:00 2001
From: Ryan Bennett
Date: Fri, 8 Nov 2024 12:15:40 -0800
Subject: [PATCH 004/227] get parent cast + reply casts
---
common_knowledge/Farcaster-Contests.md | 11 +++--
.../src/contest/GetFarcasterContestCasts.ts | 47 ++++++++++++++++---
libs/model/src/contest/index.ts | 1 +
packages/commonwealth/server/api/contest.ts | 8 +++-
.../server/api/integration-router.ts | 1 +
.../commonwealth/server/farcaster/router.tsx | 1 +
6 files changed, 56 insertions(+), 13 deletions(-)
diff --git a/common_knowledge/Farcaster-Contests.md b/common_knowledge/Farcaster-Contests.md
index 6e92a75cae3..bb844dee659 100644
--- a/common_knowledge/Farcaster-Contests.md
+++ b/common_knowledge/Farcaster-Contests.md
@@ -37,8 +37,11 @@ FLAG_FARCASTER_CONTEST=true
NEYNAR_API_KEY=
NEYNAR_REPLY_WEBHOOK_URL=https://YOUR_NGROK_DOMAIN/api/integration/farcaster/ReplyCastCreated
FARCASTER_ACTION_URL=https://YOUR_NGROK_DOMAIN/api/integration/farcaster/CastUpvoteAction
+FARCASTER_NGROK_DOMAIN=https://YOUR_NGROK_DOMAIN
```
+Note: `FARCASTER_NGROK_DOMAIN` should only be used locally– not on QA or production.
+
## Run local services
Run services required for testing contests:
@@ -57,10 +60,10 @@ Farcaster allows users to add a custom “action” to their account, which can
- Paste URL into browser, you’ll see the Warpcast page, then click `Add Action`
## How to test the Farcaster/Contests integration
-- For testing, you can use any contest that has an associated Topic.
-- First, post a farcaster contest URL on Warpcast. It has this format: `https://YOUR_DOMAIN/api/integration/farcaster/contests/CONTEST_ADDRESS/contestCard`
- - Fill in your ngrok domain and contest address
- - Upon posting, it should trigger the `CastCreated` webhook and associate the Cast (message) with the contest. It’ll also create a new programatic webhook for `CastReplyCreated`.
+- Create a Farcaster Contest with a funding token (e.g. CMN on Base Sepolia `0x429ae85883f82203D736e8fc203A455990745ca1`)
+- Copy the Farcaster Contest URL. It should have this format: `https://YOUR_DOMAIN/api/integration/farcaster/contests/CONTEST_ADDRESS/contestCard`
+- Post a the URL to WarpCast
+ - it should trigger the `CastCreated` webhook and associate the Cast (message) with the contest. It’ll also create a new programatic webhook for `CastReplyCreated`.
- Then, add a reply message to the contest cast.
- This should trigger the `CastReplyCreated` webhook, which will create onchain content.
- Finally, perform the custom Upvote action on your reply message (icon with 4 squares).
diff --git a/libs/model/src/contest/GetFarcasterContestCasts.ts b/libs/model/src/contest/GetFarcasterContestCasts.ts
index e10c848842d..984108759dd 100644
--- a/libs/model/src/contest/GetFarcasterContestCasts.ts
+++ b/libs/model/src/contest/GetFarcasterContestCasts.ts
@@ -1,6 +1,8 @@
import { Query } from '@hicommonwealth/core';
import * as schemas from '@hicommonwealth/schemas';
import { BulkCastsSortType, NeynarAPIClient } from '@neynar/nodejs-sdk';
+import { CastWithInteractions } from '@neynar/nodejs-sdk/build/neynar-api/v2';
+import lo from 'lodash';
import { config } from '../config';
import { models } from '../database';
import { mustExist } from '../middleware/guards';
@@ -22,14 +24,45 @@ export function GetFarcasterContestCasts(): Query<
if (!contestManager.farcaster_frame_hashes?.length) {
return [];
}
- const client = new NeynarAPIClient(config.CONTESTS.NEYNAR_API_KEY!);
- const frames = await client.fetchBulkCasts(
- contestManager.farcaster_frame_hashes,
- {
- sortType: BulkCastsSortType.LIKES,
+ const parentCastHashes = contestManager.farcaster_frame_hashes || [];
+ const actions = await models.ContestAction.findAll({
+ where: {
+ contest_address: payload.contest_address,
+ action: 'added',
},
- );
- return frames.result.casts;
+ });
+ const replyCastHashes = actions.map((action) => {
+ /*
+ /farcaster/0x123/0x234
+ */
+ const [, , , replyCastHash] = action.content_url!.split('/');
+ return replyCastHash;
+ });
+ const frameHashesToFetch = [...parentCastHashes, ...replyCastHashes];
+ const client = new NeynarAPIClient(config.CONTESTS.NEYNAR_API_KEY!);
+ const castsResponse = await client.fetchBulkCasts(frameHashesToFetch, {
+ sortType: BulkCastsSortType.LIKES,
+ });
+
+ const { casts } = castsResponse.result;
+
+ const parentCasts = casts
+ .filter((cast) => parentCastHashes.includes(cast.hash))
+ .map((cast) => ({
+ ...cast,
+ replies: [] as Array,
+ }));
+
+ const replyCasts = lo.groupBy(casts, (cast) => {
+ return cast.parent_hash;
+ });
+ for (const parentCast of parentCasts) {
+ for (const replyCast of replyCasts[parentCast.hash]) {
+ parentCast.replies = parentCast.replies || [];
+ parentCast.replies.push(replyCast);
+ }
+ }
+ return parentCasts;
},
};
}
diff --git a/libs/model/src/contest/index.ts b/libs/model/src/contest/index.ts
index 6c6fec76f45..760687a1f3d 100644
--- a/libs/model/src/contest/index.ts
+++ b/libs/model/src/contest/index.ts
@@ -7,6 +7,7 @@ export * from './FarcasterUpvoteAction.command';
export * from './GetActiveContestManagers.query';
export * from './GetAllContests.query';
export * from './GetContestLog.query';
+export * from './GetFarcasterContestCasts';
export * from './GetFarcasterUpvoteActionMetadata.query';
export * from './PerformContestRollovers.command';
export * from './UpdateContestManagerMetadata.command';
diff --git a/packages/commonwealth/server/api/contest.ts b/packages/commonwealth/server/api/contest.ts
index 3904a3c7a7e..e077b68d7be 100644
--- a/packages/commonwealth/server/api/contest.ts
+++ b/packages/commonwealth/server/api/contest.ts
@@ -16,8 +16,12 @@ export const trpcRouter = trpc.router({
trpc.Tag.Community,
),
getContestLog: trpc.query(Contest.GetContestLog, trpc.Tag.Community),
+ getFarcasterCasts: trpc.query(
+ Contest.GetFarcasterContestCasts,
+ trpc.Tag.Community,
+ ),
farcasterWebhook: trpc.command(
Contest.FarcasterCastCreatedWebhook,
- trpc.Tag.Community,
- ), // TODO: Use different tag?
+ trpc.Tag.Integration,
+ ),
});
diff --git a/packages/commonwealth/server/api/integration-router.ts b/packages/commonwealth/server/api/integration-router.ts
index 7c72ecd392d..72cdab8f23c 100644
--- a/packages/commonwealth/server/api/integration-router.ts
+++ b/packages/commonwealth/server/api/integration-router.ts
@@ -30,6 +30,7 @@ function build() {
if (config.CONTESTS.FLAG_FARCASTER_CONTEST) {
// Farcaster frames
+ // WARNING: do not change this because cloudflare may route to it
router.use('/farcaster/contests', farcasterRouter);
// Farcaster webhooks/actions
diff --git a/packages/commonwealth/server/farcaster/router.tsx b/packages/commonwealth/server/farcaster/router.tsx
index f3f986e8c84..8ee5ab79aa8 100644
--- a/packages/commonwealth/server/farcaster/router.tsx
+++ b/packages/commonwealth/server/farcaster/router.tsx
@@ -8,6 +8,7 @@ import { resultGame, startGame } from './frames/gameExample';
const farcasterRouter = express.Router();
+// WARNING: do not change these paths because cloudflare may route to it
farcasterRouter.get('/:contest_address/contestCard', contestCard);
farcasterRouter.post('/:contest_address/contestCard', contestCard);
farcasterRouter.post('/:contest_address/viewLeaderboard', viewLeaderboard);
From e8a6b1a035dea6491f6a5c82b8389c63ec5212ea Mon Sep 17 00:00:00 2001
From: Ryan Bennett
Date: Fri, 8 Nov 2024 12:29:02 -0800
Subject: [PATCH 005/227] add sort option
---
libs/model/src/contest/GetFarcasterContestCasts.ts | 5 ++++-
libs/schemas/src/queries/contests.schemas.ts | 1 +
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/libs/model/src/contest/GetFarcasterContestCasts.ts b/libs/model/src/contest/GetFarcasterContestCasts.ts
index 984108759dd..df88a5d5c0e 100644
--- a/libs/model/src/contest/GetFarcasterContestCasts.ts
+++ b/libs/model/src/contest/GetFarcasterContestCasts.ts
@@ -41,7 +41,10 @@ export function GetFarcasterContestCasts(): Query<
const frameHashesToFetch = [...parentCastHashes, ...replyCastHashes];
const client = new NeynarAPIClient(config.CONTESTS.NEYNAR_API_KEY!);
const castsResponse = await client.fetchBulkCasts(frameHashesToFetch, {
- sortType: BulkCastsSortType.LIKES,
+ sortType:
+ payload.sort_by === 'likes'
+ ? BulkCastsSortType.LIKES
+ : BulkCastsSortType.RECENT,
});
const { casts } = castsResponse.result;
diff --git a/libs/schemas/src/queries/contests.schemas.ts b/libs/schemas/src/queries/contests.schemas.ts
index 4c4f57103b0..5c9f07839c8 100644
--- a/libs/schemas/src/queries/contests.schemas.ts
+++ b/libs/schemas/src/queries/contests.schemas.ts
@@ -90,6 +90,7 @@ export const GetFarcasterUpvoteActionMetadata = {
export const GetFarcasterContestCasts = {
input: z.object({
contest_address: z.string(),
+ sort_by: z.enum(['likes', 'recent']).optional().default('likes'),
}),
output: z.array(z.any()),
};
From 9a89efe8516597ff0f8c8f97475e65e7969c02b1 Mon Sep 17 00:00:00 2001
From: Ryan Bennett
Date: Fri, 8 Nov 2024 12:32:36 -0800
Subject: [PATCH 006/227] simplify reply mapping
---
.../src/contest/GetFarcasterContestCasts.ts | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/libs/model/src/contest/GetFarcasterContestCasts.ts b/libs/model/src/contest/GetFarcasterContestCasts.ts
index df88a5d5c0e..62f39a3829a 100644
--- a/libs/model/src/contest/GetFarcasterContestCasts.ts
+++ b/libs/model/src/contest/GetFarcasterContestCasts.ts
@@ -1,7 +1,6 @@
import { Query } from '@hicommonwealth/core';
import * as schemas from '@hicommonwealth/schemas';
import { BulkCastsSortType, NeynarAPIClient } from '@neynar/nodejs-sdk';
-import { CastWithInteractions } from '@neynar/nodejs-sdk/build/neynar-api/v2';
import lo from 'lodash';
import { config } from '../config';
import { models } from '../database';
@@ -49,22 +48,17 @@ export function GetFarcasterContestCasts(): Query<
const { casts } = castsResponse.result;
+ const replyCasts = lo.groupBy(casts, (cast) => {
+ return cast.parent_hash;
+ });
+
const parentCasts = casts
.filter((cast) => parentCastHashes.includes(cast.hash))
.map((cast) => ({
...cast,
- replies: [] as Array,
+ replies: replyCasts[cast.hash],
}));
- const replyCasts = lo.groupBy(casts, (cast) => {
- return cast.parent_hash;
- });
- for (const parentCast of parentCasts) {
- for (const replyCast of replyCasts[parentCast.hash]) {
- parentCast.replies = parentCast.replies || [];
- parentCast.replies.push(replyCast);
- }
- }
return parentCasts;
},
};
From 8b2c440ffd5bfeda62e92006c7ced4673fb84745 Mon Sep 17 00:00:00 2001
From: Raymond Z
Date: Sun, 10 Nov 2024 15:11:03 -0500
Subject: [PATCH 007/227] only run libp2p in production
---
libs/shared/src/canvas/runtime/node.ts | 22 +++++++++++--------
.../commonwealth/server/federation/index.ts | 16 ++++++++------
2 files changed, 22 insertions(+), 16 deletions(-)
diff --git a/libs/shared/src/canvas/runtime/node.ts b/libs/shared/src/canvas/runtime/node.ts
index 0c20ce9b4cd..7c0f79fa839 100644
--- a/libs/shared/src/canvas/runtime/node.ts
+++ b/libs/shared/src/canvas/runtime/node.ts
@@ -10,7 +10,7 @@ export const CANVAS_TOPIC = contractTopic;
export const startCanvasNode = async (config: {
LIBP2P_PRIVATE_KEY?: string;
-}): Promise<{ app: Canvas; libp2p: Libp2p }> => {
+}): Promise<{ app: Canvas; libp2p: Libp2p | null }> => {
const path =
process.env.FEDERATION_POSTGRES_DB_URL ??
(process.env.APP_ENV === 'local'
@@ -57,14 +57,18 @@ export const startCanvasNode = async (config: {
signers: getSessionSigners(),
});
- const libp2p = await app.startLibp2p({
- announce: [announce],
- listen: [listen],
- bootstrapList: [explorerNode],
- denyDialMultiaddr: (multiaddr) => multiaddr.toString() !== explorerNode,
- privateKey,
- start: true,
- });
+ const libp2p =
+ process.env.APP_ENV === 'production'
+ ? await app.startLibp2p({
+ announce: [announce],
+ listen: [listen],
+ bootstrapList: [explorerNode],
+ denyDialMultiaddr: (multiaddr) =>
+ multiaddr.toString() !== explorerNode,
+ privateKey,
+ start: true,
+ })
+ : null;
return { app, libp2p };
};
diff --git a/packages/commonwealth/server/federation/index.ts b/packages/commonwealth/server/federation/index.ts
index 3693a638223..2a08d279de7 100644
--- a/packages/commonwealth/server/federation/index.ts
+++ b/packages/commonwealth/server/federation/index.ts
@@ -6,13 +6,15 @@ import { config } from '../config';
const log = logger(import.meta);
export const { app: canvas, libp2p } = await startCanvasNode(config);
-log.info(
- 'canvas: started libp2p with multiaddrs: ' +
- libp2p
- .getMultiaddrs()
- .map((m) => m.toString())
- .join(', '),
-);
+if (libp2p) {
+ log.info(
+ 'canvas: started libp2p with multiaddrs: ' +
+ libp2p
+ .getMultiaddrs()
+ .map((m) => m.toString())
+ .join(', '),
+ );
+}
export const applyCanvasSignedDataMiddleware: (
input,
From c2b49ef577519b16fcbd82eb2c2660304ef78143 Mon Sep 17 00:00:00 2001
From: rotorsoft
Date: Tue, 12 Nov 2024 13:08:31 -0500
Subject: [PATCH 008/227] load global .env in vite.config to fix vscode
extension
---
package.json | 1 +
pnpm-lock.yaml | 23 +++++++++++++----------
vite.config.ts | 5 +++++
3 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/package.json b/package.json
index fa1c7ac2968..89ad96e18a5 100644
--- a/package.json
+++ b/package.json
@@ -101,6 +101,7 @@
"chromatic": "^6.17.4",
"concurrently": "^7.6.0",
"dependency-cruiser": "^16.2.0",
+ "dotenv": "^16.0.3",
"eslint": "^8.51.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-diff": "^2.0.3",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index a9b9dc58d18..d968d4ad725 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -186,6 +186,9 @@ importers:
dependency-cruiser:
specifier: ^16.2.0
version: 16.3.1
+ dotenv:
+ specifier: ^16.0.3
+ version: 16.4.5
eslint:
specifier: ^8.51.0
version: 8.57.0
@@ -16585,8 +16588,8 @@ snapshots:
'@aws-crypto/sha1-browser': 3.0.0
'@aws-crypto/sha256-browser': 3.0.0
'@aws-crypto/sha256-js': 3.0.0
- '@aws-sdk/client-sso-oidc': 3.577.0(@aws-sdk/client-sts@3.577.0)
- '@aws-sdk/client-sts': 3.577.0
+ '@aws-sdk/client-sso-oidc': 3.577.0
+ '@aws-sdk/client-sts': 3.577.0(@aws-sdk/client-sso-oidc@3.577.0)
'@aws-sdk/core': 3.576.0
'@aws-sdk/credential-provider-node': 3.577.0(@aws-sdk/client-sso-oidc@3.577.0)(@aws-sdk/client-sts@3.577.0)
'@aws-sdk/middleware-bucket-endpoint': 3.577.0
@@ -16643,11 +16646,11 @@ snapshots:
transitivePeerDependencies:
- aws-crt
- '@aws-sdk/client-sso-oidc@3.577.0(@aws-sdk/client-sts@3.577.0)':
+ '@aws-sdk/client-sso-oidc@3.577.0':
dependencies:
'@aws-crypto/sha256-browser': 3.0.0
'@aws-crypto/sha256-js': 3.0.0
- '@aws-sdk/client-sts': 3.577.0
+ '@aws-sdk/client-sts': 3.577.0(@aws-sdk/client-sso-oidc@3.577.0)
'@aws-sdk/core': 3.576.0
'@aws-sdk/credential-provider-node': 3.577.0(@aws-sdk/client-sso-oidc@3.577.0)(@aws-sdk/client-sts@3.577.0)
'@aws-sdk/middleware-host-header': 3.577.0
@@ -16686,7 +16689,6 @@ snapshots:
'@smithy/util-utf8': 3.0.0
tslib: 2.7.0
transitivePeerDependencies:
- - '@aws-sdk/client-sts'
- aws-crt
'@aws-sdk/client-sso@3.577.0':
@@ -16732,11 +16734,11 @@ snapshots:
transitivePeerDependencies:
- aws-crt
- '@aws-sdk/client-sts@3.577.0':
+ '@aws-sdk/client-sts@3.577.0(@aws-sdk/client-sso-oidc@3.577.0)':
dependencies:
'@aws-crypto/sha256-browser': 3.0.0
'@aws-crypto/sha256-js': 3.0.0
- '@aws-sdk/client-sso-oidc': 3.577.0(@aws-sdk/client-sts@3.577.0)
+ '@aws-sdk/client-sso-oidc': 3.577.0
'@aws-sdk/core': 3.576.0
'@aws-sdk/credential-provider-node': 3.577.0(@aws-sdk/client-sso-oidc@3.577.0)(@aws-sdk/client-sts@3.577.0)
'@aws-sdk/middleware-host-header': 3.577.0
@@ -16775,6 +16777,7 @@ snapshots:
'@smithy/util-utf8': 3.0.0
tslib: 2.7.0
transitivePeerDependencies:
+ - '@aws-sdk/client-sso-oidc'
- aws-crt
'@aws-sdk/core@3.576.0':
@@ -16808,7 +16811,7 @@ snapshots:
'@aws-sdk/credential-provider-ini@3.577.0(@aws-sdk/client-sso-oidc@3.577.0)(@aws-sdk/client-sts@3.577.0)':
dependencies:
- '@aws-sdk/client-sts': 3.577.0
+ '@aws-sdk/client-sts': 3.577.0(@aws-sdk/client-sso-oidc@3.577.0)
'@aws-sdk/credential-provider-env': 3.577.0
'@aws-sdk/credential-provider-process': 3.577.0
'@aws-sdk/credential-provider-sso': 3.577.0(@aws-sdk/client-sso-oidc@3.577.0)
@@ -16865,7 +16868,7 @@ snapshots:
'@aws-sdk/credential-provider-web-identity@3.577.0(@aws-sdk/client-sts@3.577.0)':
dependencies:
- '@aws-sdk/client-sts': 3.577.0
+ '@aws-sdk/client-sts': 3.577.0(@aws-sdk/client-sso-oidc@3.577.0)
'@aws-sdk/types': 3.577.0
'@smithy/property-provider': 3.0.0
'@smithy/types': 3.0.0
@@ -17003,7 +17006,7 @@ snapshots:
'@aws-sdk/token-providers@3.577.0(@aws-sdk/client-sso-oidc@3.577.0)':
dependencies:
- '@aws-sdk/client-sso-oidc': 3.577.0(@aws-sdk/client-sts@3.577.0)
+ '@aws-sdk/client-sso-oidc': 3.577.0
'@aws-sdk/types': 3.577.0
'@smithy/property-provider': 3.0.0
'@smithy/shared-ini-file-loader': 3.0.0
diff --git a/vite.config.ts b/vite.config.ts
index 57c07d519bc..24dd65016eb 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -1,9 +1,14 @@
///
+import * as dotenv from 'dotenv';
import path from 'path';
import { defineConfig } from 'vite';
import tsconfigPaths from 'vite-tsconfig-paths';
+dotenv.config({
+ path: path.resolve(__dirname, '.env'),
+});
+
export default defineConfig({
plugins: [tsconfigPaths()],
test: {
From 5f971223bf4cc21253e0b21ad7d71c8b8ee3f4da Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Wed, 13 Nov 2024 03:31:45 +0500
Subject: [PATCH 009/227] Fix typo
---
libs/model/src/token/CreateToken.command.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libs/model/src/token/CreateToken.command.ts b/libs/model/src/token/CreateToken.command.ts
index b6a21b23d11..10f6f8e201d 100644
--- a/libs/model/src/token/CreateToken.command.ts
+++ b/libs/model/src/token/CreateToken.command.ts
@@ -95,7 +95,7 @@ export function CreateToken(): Command {
const tokenAddress = txReceipt.logs[0].address!;
if (!tokenAddress) {
throw Error(
- 'Failed to find tokenAddress is token creation command. Review tokenAddress logic',
+ 'Failed to find tokenAddress in token creation command. Review tokenAddress logic',
);
}
From 4a9dbd9ac23007a27b1829358d7de4eb53db6658 Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Wed, 13 Nov 2024 04:13:41 +0500
Subject: [PATCH 010/227] Fix create token flow
---
.../src/community/UpdateCommunity.command.ts | 21 ++++++++++---------
libs/schemas/src/entities/token.schemas.ts | 7 ++++---
.../scripts/state/api/tokens/createToken.ts | 5 ++++-
.../QuickTokenLaunchForm.tsx | 5 ++++-
.../SignTokenTransactions.tsx | 4 +++-
5 files changed, 26 insertions(+), 16 deletions(-)
diff --git a/libs/model/src/community/UpdateCommunity.command.ts b/libs/model/src/community/UpdateCommunity.command.ts
index 677a559b84a..c8c37f415b7 100644
--- a/libs/model/src/community/UpdateCommunity.command.ts
+++ b/libs/model/src/community/UpdateCommunity.command.ts
@@ -4,7 +4,7 @@ import { ChainBase } from '@hicommonwealth/shared';
import { models } from '../database';
import { authRoles } from '../middleware';
import { mustExist } from '../middleware/guards';
-import { checkSnapshotObjectExists, commonProtocol } from '../services';
+import { checkSnapshotObjectExists } from '../services';
export const UpdateCommunityErrors = {
SnapshotOnlyOnEthereum:
@@ -84,17 +84,18 @@ export function UpdateCommunity(): Command {
throw new InvalidInput(UpdateCommunityErrors.InvalidDefaultPage);
if (namespace) {
- if (!transactionHash)
- throw new InvalidInput(UpdateCommunityErrors.InvalidTransactionHash);
+ // TODO: this breaks token creation flow even when tx hash is provided @Kurtis
+ // if (!transactionHash)
+ // throw new InvalidInput(UpdateCommunityErrors.InvalidTransactionHash);
community.namespace = namespace;
- community.namespace_address =
- await commonProtocol.newNamespaceValidator.validateNamespace(
- namespace!,
- transactionHash,
- actor.address!,
- community,
- );
+ // community.namespace_address =
+ // await commonProtocol.newNamespaceValidator.validateNamespace(
+ // namespace!,
+ // transactionHash,
+ // actor.address!,
+ // community,
+ // );
}
default_page && (community.default_page = default_page);
diff --git a/libs/schemas/src/entities/token.schemas.ts b/libs/schemas/src/entities/token.schemas.ts
index 3d160203981..c856e8b6241 100644
--- a/libs/schemas/src/entities/token.schemas.ts
+++ b/libs/schemas/src/entities/token.schemas.ts
@@ -7,9 +7,10 @@ export const Token = z.object({
namespace: z.string().describe('Namespace associated with the token'),
name: z.string().describe('Name of the token'),
symbol: z.string().describe('Symbol of the token'),
- initial_supply: PG_ETH.describe(
- 'Initial supply of the token before deploying to uniswap',
- ),
+ initial_supply: z.union([
+ PG_ETH.describe('Initial supply of the token before deploying to uniswap'),
+ z.any(),
+ ]), // TODO: create token returns this value as a string, but schema expects bigint
is_locked: z
.boolean()
.default(false)
diff --git a/packages/commonwealth/client/scripts/state/api/tokens/createToken.ts b/packages/commonwealth/client/scripts/state/api/tokens/createToken.ts
index d08f3d8c451..01f133afad6 100644
--- a/packages/commonwealth/client/scripts/state/api/tokens/createToken.ts
+++ b/packages/commonwealth/client/scripts/state/api/tokens/createToken.ts
@@ -3,10 +3,13 @@ import useUserStore from '../../ui/user';
const useCreateTokenMutation = () => {
const user = useUserStore();
+ const utils = trpc.useUtils();
return trpc.token.createToken.useMutation({
- onSuccess: () => {
+ onSuccess: async () => {
user.setData({ addressSelectorSelectedAddress: undefined });
+
+ await utils.token.getTokens.invalidate();
},
});
};
diff --git a/packages/commonwealth/client/scripts/views/pages/Communities/IdeaLaunchpad/QuickTokenLaunchForm/QuickTokenLaunchForm.tsx b/packages/commonwealth/client/scripts/views/pages/Communities/IdeaLaunchpad/QuickTokenLaunchForm/QuickTokenLaunchForm.tsx
index ff183cf16c2..5c524629d7f 100644
--- a/packages/commonwealth/client/scripts/views/pages/Communities/IdeaLaunchpad/QuickTokenLaunchForm/QuickTokenLaunchForm.tsx
+++ b/packages/commonwealth/client/scripts/views/pages/Communities/IdeaLaunchpad/QuickTokenLaunchForm/QuickTokenLaunchForm.tsx
@@ -255,11 +255,12 @@ export const QuickTokenLaunchForm = ({
addressSelectorSelectedAddress: selectedAddress.address,
});
- await createToken({
+ const token = await createToken({
transaction_hash: txReceipt.transactionHash,
chain_node_id: baseNode.id,
community_id: communityId,
icon_url: sanitizedTokenInfo.imageURL,
+ description: sanitizedTokenInfo.description,
});
// 4. update community to reference the created token
@@ -269,6 +270,8 @@ export const QuickTokenLaunchForm = ({
});
await updateCommunity({
community_id: communityId,
+ namespace: token.namespace,
+ transactionHash: txReceipt.transactionHash,
token_name: sanitizedTokenInfo.name,
...(sanitizedTokenInfo.description && {
description: sanitizedTokenInfo.description,
diff --git a/packages/commonwealth/client/scripts/views/pages/LaunchToken/steps/SignatureStep/SignTokenTransactions/SignTokenTransactions.tsx b/packages/commonwealth/client/scripts/views/pages/LaunchToken/steps/SignatureStep/SignTokenTransactions/SignTokenTransactions.tsx
index 482dfd638eb..c659ce8778e 100644
--- a/packages/commonwealth/client/scripts/views/pages/LaunchToken/steps/SignatureStep/SignTokenTransactions/SignTokenTransactions.tsx
+++ b/packages/commonwealth/client/scripts/views/pages/LaunchToken/steps/SignatureStep/SignTokenTransactions/SignTokenTransactions.tsx
@@ -55,7 +55,7 @@ const SignTokenTransactions = ({
const txReceipt = await launchToken(payload);
// 2. store `tokenInfo` on db
- await createToken({
+ const token = await createToken({
transaction_hash: txReceipt.transactionHash,
chain_node_id: baseNode.id,
community_id: createdCommunityId,
@@ -67,6 +67,8 @@ const SignTokenTransactions = ({
await updateCommunity({
community_id: createdCommunityId,
token_name: payload.name,
+ namespace: token.namespace,
+ transactionHash: txReceipt.transactionHash,
});
onSuccess();
From 74c6d66ff982b17a421868d4e27fd1cd169b4f50 Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Wed, 13 Nov 2024 04:14:19 +0500
Subject: [PATCH 011/227] Fix get tokens query
---
libs/model/src/token/GetTokens.query.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libs/model/src/token/GetTokens.query.ts b/libs/model/src/token/GetTokens.query.ts
index 6c204e09aeb..0849b5cf4b0 100644
--- a/libs/model/src/token/GetTokens.query.ts
+++ b/libs/model/src/token/GetTokens.query.ts
@@ -31,7 +31,7 @@ export function GetTokens(): Query {
};
const sql = `
- SELECT T.*, C.community_id
+ SELECT T.*, C.id as community_id,
count(*) OVER() AS total
FROM "Tokens" as T
JOIN "Communities" as C ON T.namespace = C.namespace
From dee3d4a61095ed96da1d0d2ab1495e025fab26bc Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Wed, 13 Nov 2024 04:20:21 +0500
Subject: [PATCH 012/227] Added logic to buy token from explore page
---
.../scripts/state/api/launchPad/buyToken.ts | 37 +++++
.../scripts/state/api/launchPad/index.ts | 3 +-
.../TradeTokenForm/TradeTokenForm.tsx | 45 ++++---
.../TradeTokenModel/TradeTokenForm/types.ts | 25 ++--
.../TradeTokenForm/useTokenTradeForm.ts | 126 +++++++++++++++---
.../TradeTokenModel/TradeTokenModal.tsx | 33 ++---
6 files changed, 195 insertions(+), 74 deletions(-)
create mode 100644 packages/commonwealth/client/scripts/state/api/launchPad/buyToken.ts
diff --git a/packages/commonwealth/client/scripts/state/api/launchPad/buyToken.ts b/packages/commonwealth/client/scripts/state/api/launchPad/buyToken.ts
new file mode 100644
index 00000000000..47a02f39352
--- /dev/null
+++ b/packages/commonwealth/client/scripts/state/api/launchPad/buyToken.ts
@@ -0,0 +1,37 @@
+import { commonProtocol } from '@hicommonwealth/shared';
+import { useMutation } from '@tanstack/react-query';
+import LaunchpadBondingCurve from 'helpers/ContractHelpers/Launchpad';
+
+interface BuyTokenProps {
+ chainRpc: string;
+ ethChainId: number;
+ tokenAddress: string;
+ amountEth: number;
+ walletAddress: string;
+}
+
+const buyToken = async ({
+ ethChainId,
+ chainRpc,
+ tokenAddress,
+ amountEth,
+ walletAddress,
+}: BuyTokenProps) => {
+ const launchPad = new LaunchpadBondingCurve(
+ commonProtocol.factoryContracts[ethChainId].lpBondingCurve,
+ commonProtocol.factoryContracts[ethChainId].launchpad,
+ tokenAddress,
+ commonProtocol.factoryContracts[ethChainId].tokenCommunityManager,
+ chainRpc,
+ );
+
+ return await launchPad.buyToken(amountEth, walletAddress);
+};
+
+const useBuyTokenMutation = () => {
+ return useMutation({
+ mutationFn: buyToken,
+ });
+};
+
+export default useBuyTokenMutation;
diff --git a/packages/commonwealth/client/scripts/state/api/launchPad/index.ts b/packages/commonwealth/client/scripts/state/api/launchPad/index.ts
index 0a80c7cf292..566cba5330f 100644
--- a/packages/commonwealth/client/scripts/state/api/launchPad/index.ts
+++ b/packages/commonwealth/client/scripts/state/api/launchPad/index.ts
@@ -1,3 +1,4 @@
+import useBuyTokenMutation from './buyToken';
import useLaunchTokenMutation from './launchToken';
-export { useLaunchTokenMutation };
+export { useBuyTokenMutation, useLaunchTokenMutation };
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx
index d1b42957971..e0212730a39 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx
@@ -4,6 +4,7 @@ import {
getAmountWithCurrencySymbol,
} from 'helpers/currency';
import React, { ReactNode, useState } from 'react';
+import { Skeleton } from 'views/components/Skeleton';
import { CWIcon } from 'views/components/component_kit/cw_icons/cw_icon';
import { CWText } from 'views/components/component_kit/cw_text';
import { CWButton } from 'views/components/component_kit/new_designs/CWButton';
@@ -27,10 +28,6 @@ import { TradeTokenFormProps, TradingMode } from './types';
const TradeTokenForm = ({
trading,
addresses,
- tradingMode,
- onTradingAmountChange,
- tradingAmount,
- onTradingModeChange,
onCTAClick,
isActionPending,
}: TradeTokenFormProps) => {
@@ -72,8 +69,8 @@ const TradeTokenForm = ({
onTradingModeChange(TradingMode[mode])}
- isSelected={tradingMode === TradingMode[mode]}
+ onClick={() => trading.mode.onChange(TradingMode[mode])}
+ isSelected={trading.mode.value === TradingMode[mode]}
/>
))}
@@ -84,16 +81,17 @@ const TradeTokenForm = ({
Option: (originalProps) =>
CustomAddressOption({
originalProps,
- selectedAddressValue: addresses.selected || '',
+ selectedAddressValue: addresses.selected.value || '',
}),
}}
noOptionsMessage={() => 'No available Metamask address'}
- value={convertAddressToDropdownOption(addresses.selected || '')}
+ value={convertAddressToDropdownOption(addresses.selected.value || '')}
+ defaultValue={convertAddressToDropdownOption(addresses.default || '')}
formatOptionLabel={(option) => (
)}
label="Select address"
@@ -103,7 +101,7 @@ const TradeTokenForm = ({
convertAddressToDropdownOption,
)}
onChange={(option) =>
- option?.value && addresses.onChange(option.value)
+ option?.value && addresses.selected.onChange(option.value)
}
/>
@@ -111,14 +109,19 @@ const TradeTokenForm = ({
Current balance
- 0.005 ETH
+ {addresses.selected.ethBalance.isLoading ? (
+
+ ) : (
+ addresses.selected.ethBalance.value
+ )}
+ ETH
- You're {tradingMode}ing
+ You're {trading.mode.value}ing
@@ -127,8 +130,8 @@ const TradeTokenForm = ({
onTradingAmountChange(e)}
+ value={trading.amount.value}
+ onInput={(e) => trading.amount.onChange(e)}
/>
{currencySymbolPlacements.onRight.includes(trading.currency) &&
amountCurrenySymbol}
@@ -136,7 +139,7 @@ const TradeTokenForm = ({
- 0.005 ETH
+ {trading.ethAmounts.buy} ETH
{trading.presetAmounts && (
@@ -149,7 +152,7 @@ const TradeTokenForm = ({
presetAmount,
trading.currency,
)}
- onClick={() => onTradingAmountChange(presetAmount)}
+ onClick={() => trading.amount.onChange(presetAmount)}
/>
))}
@@ -176,17 +179,19 @@ const TradeTokenForm = ({
{withOptionalTooltip(
,
'Please add trading amount to continue',
- tradingAmount === 0,
+ trading.amount.value === 0,
)}
);
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts
index db41233f32b..d52780065b2 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts
@@ -9,29 +9,20 @@ export enum TradingMode {
Sell = 'sell',
}
-export type TradeTokenFormProps = {
- trading: { currency: SupportedCurrencies; presetAmounts?: number[] };
- addresses: {
- selected?: string;
- available: string[];
- default?: string;
- onChange: (address: string) => void;
- };
- onCTAClick: () => void;
-} & Omit<
- // IMPORTANT: typescript won't give error if `useTokenTradeForm`
- // updates in future to not export the omitted properties here
- ReturnType
,
- 'addressDropdownListOptions' | 'userAddresses'
->;
+export type TradeTokenFormProps = ReturnType;
+
+const TokenWithCommunity = Token.extend({ community_id: z.string() });
export type TradingConfig = {
mode: TradingMode;
- token: z.infer;
+ token: z.infer;
addressType: ChainBase;
};
export type UseTokenTradeFormProps = {
- tradeConfig: TradingConfig & { currency: SupportedCurrencies };
+ tradeConfig: TradingConfig & {
+ currency: SupportedCurrencies;
+ presetAmounts?: number[];
+ };
addressType?: ChainBase;
};
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTokenTradeForm.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTokenTradeForm.ts
index c95f756e83d..742a245585b 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTokenTradeForm.ts
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTokenTradeForm.ts
@@ -1,6 +1,15 @@
-import useRunOnceOnCondition from 'client/scripts/hooks/useRunOnceOnCondition';
-import useUserStore from 'client/scripts/state/ui/user';
+import { commonProtocol } from '@hicommonwealth/shared';
+import useRunOnceOnCondition from 'hooks/useRunOnceOnCondition';
+import NodeInfo from 'models/NodeInfo';
import { useMemo, useState } from 'react';
+import { useGetCommunityByIdQuery } from 'state/api/communities';
+import {
+ useFetchTokenUsdRateQuery,
+ useGetUserEthBalanceQuery,
+} from 'state/api/communityStake';
+import { useBuyTokenMutation } from 'state/api/launchPad';
+import { fetchCachedNodes } from 'state/api/nodes';
+import useUserStore from 'state/ui/user';
import './TradeTokenForm.scss';
import { TradingMode, UseTokenTradeFormProps } from './types';
@@ -8,6 +17,8 @@ const useTokenTradeForm = ({
tradeConfig,
addressType,
}: UseTokenTradeFormProps) => {
+ // when tradeConfig.mode === TradingMode.Buy - trade amount represents value in tradeConfig.currency
+ // when tradeConfig.mode === TradingMode.Sell - trade amount represents value in tradeConfig.token.symbol
const [tradingAmount, setTradingAmount] = useState(0);
const [tradingMode, setTradingMode] = useState(
tradeConfig.mode || TradingMode.Buy,
@@ -26,11 +37,49 @@ const useTokenTradeForm = ({
}, [user.addresses, addressType]);
const [selectedAddress, setSelectedAddress] = useState();
+ // base chain node info
+ const nodes = fetchCachedNodes();
+ const baseNode = nodes?.find(
+ (n) => n.ethChainId === commonProtocol.ValidChains.SepoliaBase,
+ ) as NodeInfo; // this is expected to exist
+
+ const { data: ethToCurrencyRateData, isLoading: isLoadingETHToCurrencyRate } =
+ useFetchTokenUsdRateQuery({
+ tokenSymbol: 'ETH',
+ });
+ const ethToCurrencyRate = parseFloat(
+ ethToCurrencyRateData?.data?.data?.amount || '0.00',
+ );
+
+ const ethBuyAmount = tradingAmount / ethToCurrencyRate;
+
+ const { data: tokenCommunity, isLoading: isLoadingTokenCommunity } =
+ useGetCommunityByIdQuery({
+ id: tradeConfig.token.community_id,
+ enabled: !!tradeConfig.token.community_id,
+ includeNodeInfo: true,
+ });
+
+ // imp: this query uses CommunityStakes helper to get eth price, but its
+ // a generic query so no need to initiate a separate Launhpad helper
+ const {
+ data: selectedAddressEthBalance,
+ isLoading: isLoadingUserEthBalance,
+ } = useGetUserEthBalanceQuery({
+ chainRpc: tokenCommunity?.ChainNode?.url || '',
+ ethChainId: tokenCommunity?.ChainNode?.eth_chain_id || 0,
+ walletAddress: selectedAddress || '',
+ apiEnabled: !!(selectedAddress && tokenCommunity),
+ });
+
useRunOnceOnCondition({
callback: () => setSelectedAddress(userAddresses[0]),
shouldRun: userAddresses.length > 0 && !selectedAddress,
});
+ const { mutateAsync: buyToken, isLoading: isBuyingToken } =
+ useBuyTokenMutation();
+
const onTradingAmountChange = (
change: React.ChangeEvent | number,
) => {
@@ -53,27 +102,74 @@ const useTokenTradeForm = ({
setSelectedAddress(address);
};
+ const handleTokenBuy = async () => {
+ // this condition wouldn't be called, but adding to avoid typescript issues
+ if (!baseNode?.url || !baseNode?.ethChainId || !selectedAddress) return;
+
+ const payload = {
+ chainRpc: baseNode.url,
+ ethChainId: baseNode.ethChainId,
+ amountEth: ethBuyAmount,
+ walletAddress: selectedAddress,
+ tokenAddress: tradeConfig.token.token_address,
+ };
+ console.log('buy payload => ', payload);
+ const receipt = await buyToken(payload);
+ console.log('receipt => ', receipt);
+ };
+
+ const handleTokenSell = async () => {
+ // TODO: implement selling logic
+ };
+
+ // flag to indicate if something is ongoing
+ const isActionPending =
+ isLoadingTokenCommunity ||
+ isLoadingUserEthBalance ||
+ isBuyingToken ||
+ isLoadingETHToCurrencyRate;
+
const onCTAClick = () => {
- console.log('TODO: implement trade with data => ', {
- tradingAmount,
- tradingMode,
- tradeConfig,
- });
+ if (isActionPending) return;
+
+ switch (tradingMode) {
+ case TradingMode.Buy:
+ handleTokenBuy().catch(console.error);
+ break;
+ case TradingMode.Sell:
+ handleTokenSell().catch(console.error);
+ break;
+ default:
+ console.error('Trading mode not selected');
+ break;
+ }
};
return {
// Note: not exporting state setters directly, since some extra
// functionality is done in most "onChange" handlers above
- tradingAmount,
- onTradingAmountChange,
- tradingMode,
- onTradingModeChange,
- userAddresses: {
+ trading: {
+ amount: { value: tradingAmount, onChange: onTradingAmountChange },
+ mode: { value: tradingMode, onChange: onTradingModeChange },
+ currency: tradeConfig.currency,
+ presetAmounts: tradeConfig.presetAmounts,
+ ethAmounts: {
+ buy: ethBuyAmount,
+ },
+ },
+ addresses: {
available: userAddresses,
- selected: selectedAddress,
- onChange: onChangeSelectedAddress,
+ default: selectedAddress,
+ selected: {
+ value: selectedAddress,
+ ethBalance: {
+ value: selectedAddressEthBalance || `0.0`,
+ isLoading: isLoadingUserEthBalance,
+ },
+ onChange: onChangeSelectedAddress,
+ },
},
- isActionPending: false, // flag to indicate if something is ongoing - will come from token api state
+ isActionPending,
onCTAClick,
};
};
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.tsx b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.tsx
index 71699a47dda..134d56834a4 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.tsx
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.tsx
@@ -25,18 +25,16 @@ const TradeTokenModal = ({
onModalClose,
tradeConfig,
}: TradeTokenModalProps) => {
- const {
- tradingAmount,
- onTradingAmountChange,
- tradingMode,
- onTradingModeChange,
- userAddresses,
- isActionPending,
- onCTAClick,
- } = useTokenTradeForm({
- tradeConfig: { ...tradeConfig, currency: TRADING_CURRENCY },
- addressType: tradeConfig.addressType,
- });
+ const { trading, addresses, isActionPending, onCTAClick } = useTokenTradeForm(
+ {
+ tradeConfig: {
+ ...tradeConfig,
+ currency: TRADING_CURRENCY,
+ presetAmounts: [100, 300, 1000],
+ },
+ addressType: tradeConfig.addressType,
+ },
+ );
return (
From 1acbd4b898e777d01ce24e1fe5139956564d030d Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Wed, 13 Nov 2024 04:26:57 +0500
Subject: [PATCH 013/227] Added token trade call after buying token
---
.../state/api/tokens/createTokenTrade.ts | 7 +++++++
.../client/scripts/state/api/tokens/index.ts | 2 ++
.../TradeTokenForm/useTokenTradeForm.ts | 18 ++++++++++++++----
3 files changed, 23 insertions(+), 4 deletions(-)
create mode 100644 packages/commonwealth/client/scripts/state/api/tokens/createTokenTrade.ts
diff --git a/packages/commonwealth/client/scripts/state/api/tokens/createTokenTrade.ts b/packages/commonwealth/client/scripts/state/api/tokens/createTokenTrade.ts
new file mode 100644
index 00000000000..d7a6b90a218
--- /dev/null
+++ b/packages/commonwealth/client/scripts/state/api/tokens/createTokenTrade.ts
@@ -0,0 +1,7 @@
+import { trpc } from 'utils/trpcClient';
+
+const useCreateTokenTradeMutation = () => {
+ return trpc.token.createLaunchpadTrade.useMutation();
+};
+
+export default useCreateTokenTradeMutation;
diff --git a/packages/commonwealth/client/scripts/state/api/tokens/index.ts b/packages/commonwealth/client/scripts/state/api/tokens/index.ts
index 2a7ab465767..ecc6cd75596 100644
--- a/packages/commonwealth/client/scripts/state/api/tokens/index.ts
+++ b/packages/commonwealth/client/scripts/state/api/tokens/index.ts
@@ -1,4 +1,5 @@
import useCreateTokenMutation from './createToken';
+import useCreateTokenTradeMutation from './createTokenTrade';
import useFetchTokensQuery from './fetchTokens';
import useGetERC20BalanceQuery from './getERC20Balance';
import useTokenBalanceQuery from './getTokenBalance';
@@ -6,6 +7,7 @@ import useTokenMetadataQuery from './getTokenMetadata';
export {
useCreateTokenMutation,
+ useCreateTokenTradeMutation,
useFetchTokensQuery,
useGetERC20BalanceQuery,
useTokenBalanceQuery,
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTokenTradeForm.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTokenTradeForm.ts
index 742a245585b..11c703894d5 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTokenTradeForm.ts
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTokenTradeForm.ts
@@ -9,6 +9,7 @@ import {
} from 'state/api/communityStake';
import { useBuyTokenMutation } from 'state/api/launchPad';
import { fetchCachedNodes } from 'state/api/nodes';
+import { useCreateTokenTradeMutation } from 'state/api/tokens';
import useUserStore from 'state/ui/user';
import './TradeTokenForm.scss';
import { TradingMode, UseTokenTradeFormProps } from './types';
@@ -80,6 +81,9 @@ const useTokenTradeForm = ({
const { mutateAsync: buyToken, isLoading: isBuyingToken } =
useBuyTokenMutation();
+ const { mutateAsync: createTokenTrade, isLoading: isCreatingTokenTrade } =
+ useCreateTokenTradeMutation();
+
const onTradingAmountChange = (
change: React.ChangeEvent | number,
) => {
@@ -106,6 +110,7 @@ const useTokenTradeForm = ({
// this condition wouldn't be called, but adding to avoid typescript issues
if (!baseNode?.url || !baseNode?.ethChainId || !selectedAddress) return;
+ // buy token on chain
const payload = {
chainRpc: baseNode.url,
ethChainId: baseNode.ethChainId,
@@ -113,9 +118,13 @@ const useTokenTradeForm = ({
walletAddress: selectedAddress,
tokenAddress: tradeConfig.token.token_address,
};
- console.log('buy payload => ', payload);
- const receipt = await buyToken(payload);
- console.log('receipt => ', receipt);
+ const txReceipt = await buyToken(payload);
+
+ // create token trade on db
+ await createTokenTrade({
+ eth_chain_id: baseNode?.ethChainId,
+ transaction_hash: txReceipt.transactionHash,
+ });
};
const handleTokenSell = async () => {
@@ -127,7 +136,8 @@ const useTokenTradeForm = ({
isLoadingTokenCommunity ||
isLoadingUserEthBalance ||
isBuyingToken ||
- isLoadingETHToCurrencyRate;
+ isLoadingETHToCurrencyRate ||
+ isCreatingTokenTrade;
const onCTAClick = () => {
if (isActionPending) return;
From 3dc1c9a0534d93153e12200b842355d3b2e824d4 Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Wed, 13 Nov 2024 04:37:55 +0500
Subject: [PATCH 014/227] close trade modal after successful transaction
---
.../views/modals/TradeTokenModel/TradeTokenForm/types.ts | 1 +
.../modals/TradeTokenModel/TradeTokenForm/useTokenTradeForm.ts | 3 +++
.../scripts/views/modals/TradeTokenModel/TradeTokenModal.tsx | 1 +
3 files changed, 5 insertions(+)
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts
index d52780065b2..082cafe12a1 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts
@@ -25,4 +25,5 @@ export type UseTokenTradeFormProps = {
presetAmounts?: number[];
};
addressType?: ChainBase;
+ onTradeComplete?: () => void;
};
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTokenTradeForm.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTokenTradeForm.ts
index 11c703894d5..41c6cff159f 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTokenTradeForm.ts
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTokenTradeForm.ts
@@ -17,6 +17,7 @@ import { TradingMode, UseTokenTradeFormProps } from './types';
const useTokenTradeForm = ({
tradeConfig,
addressType,
+ onTradeComplete,
}: UseTokenTradeFormProps) => {
// when tradeConfig.mode === TradingMode.Buy - trade amount represents value in tradeConfig.currency
// when tradeConfig.mode === TradingMode.Sell - trade amount represents value in tradeConfig.token.symbol
@@ -125,6 +126,8 @@ const useTokenTradeForm = ({
eth_chain_id: baseNode?.ethChainId,
transaction_hash: txReceipt.transactionHash,
});
+
+ onTradeComplete?.();
};
const handleTokenSell = async () => {
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.tsx b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.tsx
index 134d56834a4..a95761ff666 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.tsx
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.tsx
@@ -33,6 +33,7 @@ const TradeTokenModal = ({
presetAmounts: [100, 300, 1000],
},
addressType: tradeConfig.addressType,
+ onTradeComplete: () => onModalClose?.(),
},
);
From e61805c4774dab08cb9a8b101b160d756f5c5299 Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Wed, 13 Nov 2024 04:41:25 +0500
Subject: [PATCH 015/227] only show buy mode options in buy state of token form
---
.../TradeTokenForm/TradeTokenForm.tsx | 64 ++++++++++---------
1 file changed, 34 insertions(+), 30 deletions(-)
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx
index e0212730a39..2cb231fe1d3 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx
@@ -124,38 +124,42 @@ const TradeTokenForm = ({
You're {trading.mode.value}ing
-
- {currencySymbolPlacements.onLeft.includes(trading.currency) &&
- amountCurrenySymbol}
- trading.amount.onChange(e)}
- />
- {currencySymbolPlacements.onRight.includes(trading.currency) &&
- amountCurrenySymbol}
-
+ {trading.mode.value === TradingMode.Buy && (
+ <>
+
+ {currencySymbolPlacements.onLeft.includes(trading.currency) &&
+ amountCurrenySymbol}
+ trading.amount.onChange(e)}
+ />
+ {currencySymbolPlacements.onRight.includes(trading.currency) &&
+ amountCurrenySymbol}
+
-
-
- {trading.ethAmounts.buy} ETH
-
+
+
+ {trading.ethAmounts.buy} ETH
+
- {trading.presetAmounts && (
-
- {trading.presetAmounts?.map((presetAmount) => (
- trading.amount.onChange(presetAmount)}
- />
- ))}
-
+ {trading.presetAmounts && (
+
+ {trading.presetAmounts?.map((presetAmount) => (
+ trading.amount.onChange(presetAmount)}
+ />
+ ))}
+
+ )}
+ >
)}
From 54a35a8669122004adea1c57287705d5e12ac213 Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Wed, 13 Nov 2024 04:50:49 +0500
Subject: [PATCH 016/227] Simplified token trade modal state
---
.../TradeTokenForm/TradeTokenForm.tsx | 63 ++++++++++++-------
.../TradeTokenForm/useTokenTradeForm.ts | 33 +++++-----
2 files changed, 58 insertions(+), 38 deletions(-)
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx
index 2cb231fe1d3..cc83c1ba9ce 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx
@@ -33,9 +33,9 @@ const TradeTokenForm = ({
}: TradeTokenFormProps) => {
const [isReceiptDetailOpen, setIsReceiptDetailOpen] = useState(false);
- const amountCurrenySymbol = (
+ const buyAmountCurrenySymbol = (
- {currencyNameToSymbolMap[trading.currency]}
+ {currencyNameToSymbolMap[trading.amounts.buy.baseCurrency.name]}
);
@@ -127,36 +127,49 @@ const TradeTokenForm = ({
{trading.mode.value === TradingMode.Buy && (
<>
- {currencySymbolPlacements.onLeft.includes(trading.currency) &&
- amountCurrenySymbol}
+ {currencySymbolPlacements.onLeft.includes(
+ trading.amounts.buy.baseCurrency.name,
+ ) && buyAmountCurrenySymbol}
trading.amount.onChange(e)}
+ placeholder={getAmountWithCurrencySymbol(
+ 0,
+ trading.amounts.buy.baseCurrency.name,
+ )}
+ value={trading.amounts.buy.baseCurrency.amount}
+ onInput={(e) =>
+ trading.amounts.buy.baseCurrency.onAmountChange(e)
+ }
/>
- {currencySymbolPlacements.onRight.includes(trading.currency) &&
- amountCurrenySymbol}
+ {currencySymbolPlacements.onRight.includes(
+ trading.amounts.buy.baseCurrency.name,
+ ) && buyAmountCurrenySymbol}
- {trading.ethAmounts.buy} ETH
+ {trading.amounts.buy.ethAmount} ETH
- {trading.presetAmounts && (
+ {trading.amounts.buy.baseCurrency.presetAmounts && (
- {trading.presetAmounts?.map((presetAmount) => (
- trading.amount.onChange(presetAmount)}
- />
- ))}
+ {trading.amounts.buy.baseCurrency.presetAmounts?.map(
+ (presetAmount) => (
+
+ trading.amounts.buy.baseCurrency.onAmountChange(
+ presetAmount,
+ )
+ }
+ />
+ ),
+ )}
)}
>
@@ -191,11 +204,13 @@ const TradeTokenForm = ({
buttonAlt={
trading.mode.value === TradingMode.Buy ? 'green' : 'rorange'
}
- disabled={isActionPending || trading.amount.value === 0}
+ disabled={
+ isActionPending || trading.amounts.buy.baseCurrency.amount === 0
+ }
onClick={onCTAClick}
/>,
'Please add trading amount to continue',
- trading.amount.value === 0,
+ trading.amounts.buy.baseCurrency.amount === 0,
)}
);
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTokenTradeForm.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTokenTradeForm.ts
index 41c6cff159f..f21a0355633 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTokenTradeForm.ts
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTokenTradeForm.ts
@@ -19,9 +19,8 @@ const useTokenTradeForm = ({
addressType,
onTradeComplete,
}: UseTokenTradeFormProps) => {
- // when tradeConfig.mode === TradingMode.Buy - trade amount represents value in tradeConfig.currency
- // when tradeConfig.mode === TradingMode.Sell - trade amount represents value in tradeConfig.token.symbol
- const [tradingAmount, setTradingAmount] = useState(0);
+ const [baseCurrencyTradingAmount, setBaseCurrencyTradingAmount] =
+ useState(0);
const [tradingMode, setTradingMode] = useState(
tradeConfig.mode || TradingMode.Buy,
);
@@ -53,7 +52,7 @@ const useTokenTradeForm = ({
ethToCurrencyRateData?.data?.data?.amount || '0.00',
);
- const ethBuyAmount = tradingAmount / ethToCurrencyRate;
+ const ethBuyAmount = baseCurrencyTradingAmount / ethToCurrencyRate;
const { data: tokenCommunity, isLoading: isLoadingTokenCommunity } =
useGetCommunityByIdQuery({
@@ -85,17 +84,18 @@ const useTokenTradeForm = ({
const { mutateAsync: createTokenTrade, isLoading: isCreatingTokenTrade } =
useCreateTokenTradeMutation();
- const onTradingAmountChange = (
+ const onBaseCurrencyTradingAmountChange = (
change: React.ChangeEvent | number,
) => {
if (typeof change == 'number') {
- setTradingAmount(change);
+ setBaseCurrencyTradingAmount(change);
} else {
const value = change.target.value;
- if (value === '') setTradingAmount(0);
+ if (value === '') setBaseCurrencyTradingAmount(0);
// verify only numbers with decimal (optional) are present
- else if (/^\d+(\.\d+)?$/.test(value)) setTradingAmount(parseFloat(value));
+ else if (/^\d+(\.\d+)?$/.test(value))
+ setBaseCurrencyTradingAmount(parseFloat(value));
}
};
@@ -162,13 +162,18 @@ const useTokenTradeForm = ({
// Note: not exporting state setters directly, since some extra
// functionality is done in most "onChange" handlers above
trading: {
- amount: { value: tradingAmount, onChange: onTradingAmountChange },
- mode: { value: tradingMode, onChange: onTradingModeChange },
- currency: tradeConfig.currency,
- presetAmounts: tradeConfig.presetAmounts,
- ethAmounts: {
- buy: ethBuyAmount,
+ amounts: {
+ buy: {
+ ethAmount: ethBuyAmount,
+ baseCurrency: {
+ presetAmounts: tradeConfig.presetAmounts,
+ name: tradeConfig.currency, // USD/GBP etc
+ amount: baseCurrencyTradingAmount,
+ onAmountChange: onBaseCurrencyTradingAmountChange,
+ },
+ },
},
+ mode: { value: tradingMode, onChange: onTradingModeChange },
},
addresses: {
available: userAddresses,
From d9f167d4cda6f3ede6fdaacc55d49fca74e8cef8 Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Wed, 13 Nov 2024 04:59:43 +0500
Subject: [PATCH 017/227] Show insufficient funds error if user don't have
required funds to buy token
---
.../TradeTokenForm/TradeTokenForm.tsx | 24 +++++++++----------
.../TradeTokenForm/useTokenTradeForm.ts | 6 +++--
2 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx
index cc83c1ba9ce..21c9149127a 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx
@@ -39,17 +39,21 @@ const TradeTokenForm = ({
);
- const withOptionalTooltip = (
- children: ReactNode,
- content: string,
- shouldDisplay,
- ) => {
- if (!shouldDisplay) return children;
+ const getCTADisabledTooltipText = () => {
+ if (isActionPending || trading.amounts.buy.baseCurrency.amount === 0)
+ return 'Please add trading amount to continue';
+ if (trading.amounts.buy.insufficientFunds)
+ return `You don't have sufficient funds to buy token`;
+ };
+
+ const withOptionalTooltip = (children: ReactNode) => {
+ const tooltipText = getCTADisabledTooltipText();
+ if (!tooltipText) return children;
return (
(
,
- 'Please add trading amount to continue',
- trading.amounts.buy.baseCurrency.amount === 0,
)}
);
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTokenTradeForm.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTokenTradeForm.ts
index f21a0355633..e243ac15f23 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTokenTradeForm.ts
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTokenTradeForm.ts
@@ -64,7 +64,7 @@ const useTokenTradeForm = ({
// imp: this query uses CommunityStakes helper to get eth price, but its
// a generic query so no need to initiate a separate Launhpad helper
const {
- data: selectedAddressEthBalance,
+ data: selectedAddressEthBalance = `0.0`,
isLoading: isLoadingUserEthBalance,
} = useGetUserEthBalanceQuery({
chainRpc: tokenCommunity?.ChainNode?.url || '',
@@ -171,6 +171,8 @@ const useTokenTradeForm = ({
amount: baseCurrencyTradingAmount,
onAmountChange: onBaseCurrencyTradingAmountChange,
},
+ insufficientFunds:
+ ethBuyAmount > parseFloat(selectedAddressEthBalance),
},
},
mode: { value: tradingMode, onChange: onTradingModeChange },
@@ -181,7 +183,7 @@ const useTokenTradeForm = ({
selected: {
value: selectedAddress,
ethBalance: {
- value: selectedAddressEthBalance || `0.0`,
+ value: selectedAddressEthBalance,
isLoading: isLoadingUserEthBalance,
},
onChange: onChangeSelectedAddress,
From a75aa7298f53a64597e3951d1c38190785626dee Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Wed, 13 Nov 2024 05:01:01 +0500
Subject: [PATCH 018/227] Updated tooltip when any action is loading
---
.../modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx
index 21c9149127a..479885e7fa3 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx
@@ -40,7 +40,10 @@ const TradeTokenForm = ({
);
const getCTADisabledTooltipText = () => {
- if (isActionPending || trading.amounts.buy.baseCurrency.amount === 0)
+ if (isActionPending) return 'Processing trade...';
+
+ // buy mode
+ if (trading.amounts.buy.baseCurrency.amount === 0)
return 'Please add trading amount to continue';
if (trading.amounts.buy.insufficientFunds)
return `You don't have sufficient funds to buy token`;
From 270791a28b4e37c9cb387e171c3a69ca9a2808f2 Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Wed, 13 Nov 2024 05:35:07 +0500
Subject: [PATCH 019/227] Added receipt details section for token buy mode
---
.../TradeTokenForm/TradeTokenForm.scss | 18 ++++
.../TradeTokenForm/TradeTokenForm.tsx | 88 +++++++++++++++++--
.../TradeTokenForm/useTokenTradeForm.ts | 12 ++-
.../TradeTokenModel/TradeTokenModal.tsx | 2 +-
4 files changed, 110 insertions(+), 10 deletions(-)
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.scss b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.scss
index e380176317c..5bce5becb10 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.scss
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.scss
@@ -105,6 +105,24 @@
gap: 4px;
}
}
+
+ .details {
+ display: flex;
+ flex-direction: column;
+ gap: 4px;
+ width: 100%;
+ background-color: $neutral-50;
+ padding: 12px;
+ border-radius: 2px;
+
+ .entry {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ width: 100%;
+ border-bottom: 1px solid $neutral-200;
+ }
+ }
}
.action-btn {
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx
index 479885e7fa3..ee93920d5ef 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx
@@ -131,7 +131,7 @@ const TradeTokenForm = ({
You're {trading.mode.value}ing
- {trading.mode.value === TradingMode.Buy && (
+ {trading.mode.value === TradingMode.Buy ? (
<>
{currencySymbolPlacements.onLeft.includes(
@@ -155,7 +155,8 @@ const TradeTokenForm = ({
- {trading.amounts.buy.ethAmount} ETH
+ {trading.amounts.buy.eth} ETH = {trading.amounts.buy.token}{' '}
+ {trading.token.symbol}
{trading.amounts.buy.baseCurrency.presetAmounts && (
@@ -180,6 +181,8 @@ const TradeTokenForm = ({
)}
>
+ ) : (
+ <>{/* TODO: sell mode data here */}>
)}
@@ -190,15 +193,86 @@ const TradeTokenForm = ({
iconName={isReceiptDetailOpen ? 'caretUp' : 'caretDown'}
weight="fill"
onClick={() => setIsReceiptDetailOpen((o) => !o)}
+ disabled={!!getCTADisabledTooltipText()}
/>
Subtotal + fees
-
-
- 0.053 ETH
-
- {/* TODO: add receipt details here */}
+ {isReceiptDetailOpen ? (
+ trading.mode.value === TradingMode.Buy ? (
+
+
+
+ ETH to {trading.amounts.buy.baseCurrency.name} rate
+
+
+ 1 ETH ={' '}
+ {currencySymbolPlacements.onLeft.includes(
+ trading.amounts.buy.baseCurrency.name,
+ )
+ ? currencyNameToSymbolMap[
+ trading.amounts.buy.baseCurrency.name
+ ]
+ : ''}{' '}
+ {trading.unitEthToBaseCurrencyRate}
+ {currencySymbolPlacements.onRight.includes(
+ trading.amounts.buy.baseCurrency.name,
+ )
+ ? currencyNameToSymbolMap[
+ trading.amounts.buy.baseCurrency.name
+ ]
+ : ''}
+
+
+
+
+ Amount invested ({trading.amounts.buy.baseCurrency.name})
+
+
+ {currencySymbolPlacements.onLeft.includes(
+ trading.amounts.buy.baseCurrency.name,
+ )
+ ? currencyNameToSymbolMap[
+ trading.amounts.buy.baseCurrency.name
+ ]
+ : ''}{' '}
+ {trading.amounts.buy.baseCurrency.amount}
+ {currencySymbolPlacements.onRight.includes(
+ trading.amounts.buy.baseCurrency.name,
+ )
+ ? currencyNameToSymbolMap[
+ trading.amounts.buy.baseCurrency.name
+ ]
+ : ''}
+
+
+
+ ETH bought from invested amount
+ {trading.amounts.buy.eth} ETH
+
+
+
+ Common's Platform Fee (
+ {trading.commonPlatformFee.percentage})
+
+
+ {trading.commonPlatformFee.eth} ETH
+
+
+
+ Remaining ETH to tokens
+
+ {trading.amounts.buy.eth - trading.commonPlatformFee.eth} ETH
+ = {trading.amounts.buy.token} {trading.token.symbol}
+
+
+
+ ) : (
+ <>{/* TODO: sell mode data here */}>
+ )
+ ) : (
+ <>>
+ )}
{withOptionalTooltip(
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTokenTradeForm.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTokenTradeForm.ts
index e243ac15f23..6f80f4e32fa 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTokenTradeForm.ts
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTokenTradeForm.ts
@@ -164,18 +164,26 @@ const useTokenTradeForm = ({
trading: {
amounts: {
buy: {
- ethAmount: ethBuyAmount,
+ eth: ethBuyAmount,
+ token: 100, // TODO: hardcoded for now
baseCurrency: {
- presetAmounts: tradeConfig.presetAmounts,
name: tradeConfig.currency, // USD/GBP etc
amount: baseCurrencyTradingAmount,
onAmountChange: onBaseCurrencyTradingAmountChange,
+ presetAmounts: tradeConfig.presetAmounts,
},
insufficientFunds:
ethBuyAmount > parseFloat(selectedAddressEthBalance),
},
},
+ unitEthToBaseCurrencyRate: ethToCurrencyRate,
mode: { value: tradingMode, onChange: onTradingModeChange },
+ token: tradeConfig.token,
+ // TODO: hardcoded for now
+ commonPlatformFee: {
+ percentage: '0.5%',
+ eth: 0.0000178,
+ },
},
addresses: {
available: userAddresses,
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.tsx b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.tsx
index a95761ff666..ea9408a11be 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.tsx
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.tsx
@@ -46,7 +46,7 @@ const TradeTokenModal = ({
content={
<>
onModalClose?.()}
/>
From bca9b2474425a204a359f50143386cc48413436d Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Wed, 13 Nov 2024 05:45:47 +0500
Subject: [PATCH 020/227] Fix type
---
.../views/pages/Communities/TokensList/TokensList.tsx | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/packages/commonwealth/client/scripts/views/pages/Communities/TokensList/TokensList.tsx b/packages/commonwealth/client/scripts/views/pages/Communities/TokensList/TokensList.tsx
index c332589d312..e1fb01a5ea5 100644
--- a/packages/commonwealth/client/scripts/views/pages/Communities/TokensList/TokensList.tsx
+++ b/packages/commonwealth/client/scripts/views/pages/Communities/TokensList/TokensList.tsx
@@ -15,6 +15,8 @@ import { z } from 'zod';
import TokenCard from '../../../components/TokenCard';
import './TokensList.scss';
+const TokenWithCommunity = Token.extend({ community_id: z.string() });
+
const TokensList = () => {
const navigate = useCommonNavigate();
const tokenizedCommunityEnabled = useFlag('tokenizedCommunity');
@@ -22,7 +24,7 @@ const TokensList = () => {
isOpen: boolean;
tradeConfig?: {
mode: TradingMode;
- token: z.infer;
+ token: z.infer;
addressType: ChainBase;
};
}>({ isOpen: false, tradeConfig: undefined });
@@ -88,7 +90,7 @@ const TokensList = () => {
isOpen: true,
tradeConfig: {
mode: TradingMode.Buy,
- token: token as z.infer,
+ token: token as z.infer,
addressType: ChainBase.Ethereum,
},
})
From 60f4e88740a14ccf18a2c6891b68d2a3dba5eda4 Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Wed, 13 Nov 2024 05:50:02 +0500
Subject: [PATCH 021/227] Inform user about token buy error
---
.../TradeTokenForm/useTokenTradeForm.ts | 46 +++++++++++--------
1 file changed, 26 insertions(+), 20 deletions(-)
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTokenTradeForm.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTokenTradeForm.ts
index 6f80f4e32fa..5a4edd1ab9e 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTokenTradeForm.ts
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTokenTradeForm.ts
@@ -1,4 +1,5 @@
import { commonProtocol } from '@hicommonwealth/shared';
+import { notifyError } from 'controllers/app/notifications';
import useRunOnceOnCondition from 'hooks/useRunOnceOnCondition';
import NodeInfo from 'models/NodeInfo';
import { useMemo, useState } from 'react';
@@ -108,26 +109,31 @@ const useTokenTradeForm = ({
};
const handleTokenBuy = async () => {
- // this condition wouldn't be called, but adding to avoid typescript issues
- if (!baseNode?.url || !baseNode?.ethChainId || !selectedAddress) return;
-
- // buy token on chain
- const payload = {
- chainRpc: baseNode.url,
- ethChainId: baseNode.ethChainId,
- amountEth: ethBuyAmount,
- walletAddress: selectedAddress,
- tokenAddress: tradeConfig.token.token_address,
- };
- const txReceipt = await buyToken(payload);
-
- // create token trade on db
- await createTokenTrade({
- eth_chain_id: baseNode?.ethChainId,
- transaction_hash: txReceipt.transactionHash,
- });
-
- onTradeComplete?.();
+ try {
+ // this condition wouldn't be called, but adding to avoid typescript issues
+ if (!baseNode?.url || !baseNode?.ethChainId || !selectedAddress) return;
+
+ // buy token on chain
+ const payload = {
+ chainRpc: baseNode.url,
+ ethChainId: baseNode.ethChainId,
+ amountEth: ethBuyAmount,
+ walletAddress: selectedAddress,
+ tokenAddress: tradeConfig.token.token_address,
+ };
+ const txReceipt = await buyToken(payload);
+
+ // create token trade on db
+ await createTokenTrade({
+ eth_chain_id: baseNode?.ethChainId,
+ transaction_hash: txReceipt.transactionHash,
+ });
+
+ onTradeComplete?.();
+ } catch (e) {
+ notifyError('Failed to buy token');
+ console.log('Failed to buy token => ', e);
+ }
};
const handleTokenSell = async () => {
From de8302e5d79fa16c22feb9db656acb5768dad94e Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Wed, 13 Nov 2024 14:04:06 +0500
Subject: [PATCH 022/227] Switch chains correctly when buying tokens
---
.../client/scripts/helpers/ContractHelpers/Launchpad.ts | 4 ++--
.../client/scripts/state/api/launchPad/buyToken.ts | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/packages/commonwealth/client/scripts/helpers/ContractHelpers/Launchpad.ts b/packages/commonwealth/client/scripts/helpers/ContractHelpers/Launchpad.ts
index f555800c773..feff0e02fec 100644
--- a/packages/commonwealth/client/scripts/helpers/ContractHelpers/Launchpad.ts
+++ b/packages/commonwealth/client/scripts/helpers/ContractHelpers/Launchpad.ts
@@ -65,9 +65,9 @@ class LaunchpadBondingCurve extends ContractBase {
return txReceipt;
}
- async buyToken(amountEth: number, walletAddress: string) {
+ async buyToken(amountEth: number, walletAddress: string, chainId: string) {
if (!this.initialized || !this.walletEnabled) {
- await this.initialize(true);
+ await this.initialize(true, chainId);
}
const txReceipt = await buyToken(
diff --git a/packages/commonwealth/client/scripts/state/api/launchPad/buyToken.ts b/packages/commonwealth/client/scripts/state/api/launchPad/buyToken.ts
index 47a02f39352..19ce4340f0a 100644
--- a/packages/commonwealth/client/scripts/state/api/launchPad/buyToken.ts
+++ b/packages/commonwealth/client/scripts/state/api/launchPad/buyToken.ts
@@ -25,7 +25,7 @@ const buyToken = async ({
chainRpc,
);
- return await launchPad.buyToken(amountEth, walletAddress);
+ return await launchPad.buyToken(amountEth, walletAddress, `${ethChainId}`);
};
const useBuyTokenMutation = () => {
From 87bbc881611fe17beb21dacfaf4cd9e05a73ceee Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Wed, 13 Nov 2024 14:08:46 +0500
Subject: [PATCH 023/227] updated component names
---
.../TradeTokenModel/TradeTokenForm/TradeTokenForm.scss | 2 +-
.../TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx | 2 +-
.../views/modals/TradeTokenModel/TradeTokenForm/index.ts | 6 +++---
.../views/modals/TradeTokenModel/TradeTokenForm/types.ts | 6 +++---
.../{useTokenTradeForm.ts => useTradeTokenForm.ts} | 8 ++++----
.../views/modals/TradeTokenModel/TradeTokenModal.tsx | 4 ++--
6 files changed, 14 insertions(+), 14 deletions(-)
rename packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/{useTokenTradeForm.ts => useTradeTokenForm.ts} (97%)
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.scss b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.scss
index 5bce5becb10..da932c53d25 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.scss
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.scss
@@ -1,6 +1,6 @@
@import '../../../../../styles/shared.scss';
-.TokenTradeForm {
+.TradeTokenForm {
display: flex;
flex-direction: column;
gap: 12px;
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx
index ee93920d5ef..e51680693b8 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx
@@ -70,7 +70,7 @@ const TradeTokenForm = ({
};
return (
-
+
{Object.keys(TradingMode).map((mode) => (
;
+export type TradeTokenFormProps = ReturnType;
const TokenWithCommunity = Token.extend({ community_id: z.string() });
@@ -19,7 +19,7 @@ export type TradingConfig = {
addressType: ChainBase;
};
-export type UseTokenTradeFormProps = {
+export type UseTradeTokenFormProps = {
tradeConfig: TradingConfig & {
currency: SupportedCurrencies;
presetAmounts?: number[];
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTokenTradeForm.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts
similarity index 97%
rename from packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTokenTradeForm.ts
rename to packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts
index 5a4edd1ab9e..601089f1418 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTokenTradeForm.ts
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts
@@ -13,13 +13,13 @@ import { fetchCachedNodes } from 'state/api/nodes';
import { useCreateTokenTradeMutation } from 'state/api/tokens';
import useUserStore from 'state/ui/user';
import './TradeTokenForm.scss';
-import { TradingMode, UseTokenTradeFormProps } from './types';
+import { TradingMode, UseTradeTokenFormProps } from './types';
-const useTokenTradeForm = ({
+const useTradeTokenForm = ({
tradeConfig,
addressType,
onTradeComplete,
-}: UseTokenTradeFormProps) => {
+}: UseTradeTokenFormProps) => {
const [baseCurrencyTradingAmount, setBaseCurrencyTradingAmount] =
useState(0);
const [tradingMode, setTradingMode] = useState(
@@ -208,4 +208,4 @@ const useTokenTradeForm = ({
};
};
-export default useTokenTradeForm;
+export default useTradeTokenForm;
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.tsx b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.tsx
index ea9408a11be..19a97f0de27 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.tsx
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.tsx
@@ -8,7 +8,7 @@ import {
} from '../../components/component_kit/new_designs/CWModal';
import TradeTokenForm, {
TradingConfig,
- useTokenTradeForm,
+ useTradeTokenForm,
} from './TradeTokenForm';
import './TradeTokenModal.scss';
@@ -25,7 +25,7 @@ const TradeTokenModal = ({
onModalClose,
tradeConfig,
}: TradeTokenModalProps) => {
- const { trading, addresses, isActionPending, onCTAClick } = useTokenTradeForm(
+ const { trading, addresses, isActionPending, onCTAClick } = useTradeTokenForm(
{
tradeConfig: {
...tradeConfig,
From e46b20d7c1e875fc9480028cac3ffea79692da55 Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Wed, 13 Nov 2024 14:29:00 +0500
Subject: [PATCH 024/227] Move buy receipt details to dedicated component
---
.../ReceiptDetails/BuyReceipt.tsx | 57 +++++++++++
.../ReceiptDetails/ReceiptDetails.scss | 19 ++++
.../TradeTokenForm/TradeTokenForm.scss | 18 ----
.../TradeTokenForm/TradeTokenForm.tsx | 95 ++++---------------
.../TradeTokenModel/TradeTokenForm/types.ts | 5 +
5 files changed, 98 insertions(+), 96 deletions(-)
create mode 100644 packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/ReceiptDetails/BuyReceipt.tsx
create mode 100644 packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/ReceiptDetails/ReceiptDetails.scss
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/ReceiptDetails/BuyReceipt.tsx b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/ReceiptDetails/BuyReceipt.tsx
new file mode 100644
index 00000000000..24ac076b43d
--- /dev/null
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/ReceiptDetails/BuyReceipt.tsx
@@ -0,0 +1,57 @@
+import {
+ currencyNameToSymbolMap,
+ currencySymbolPlacements,
+} from 'helpers/currency';
+import React from 'react';
+import { CWText } from 'views/components/component_kit/cw_text';
+import { ReceiptDetailsProps } from '../types';
+import './ReceiptDetails.scss';
+
+const BuyReceipt = ({ trading }: ReceiptDetailsProps) => {
+ const baseCurrencyName = trading.amounts.buy.baseCurrency.name;
+ const baseCurrencySymbol = currencyNameToSymbolMap[baseCurrencyName];
+ const isLeftSymbolCurrency =
+ currencySymbolPlacements.onLeft.includes(baseCurrencyName);
+ const isRightSymbolCurrency =
+ currencySymbolPlacements.onRight.includes(baseCurrencyName);
+
+ return (
+
+
+ ETH to {baseCurrencyName} rate
+
+ 1 ETH = {isLeftSymbolCurrency ? baseCurrencySymbol : ''}{' '}
+ {trading.unitEthToBaseCurrencyRate}
+ {isRightSymbolCurrency ? baseCurrencySymbol : ''}
+
+
+
+ Amount invested ({baseCurrencyName})
+
+ {isLeftSymbolCurrency ? baseCurrencySymbol : ''}{' '}
+ {trading.amounts.buy.baseCurrency.amount}
+ {isRightSymbolCurrency ? baseCurrencySymbol : ''}
+
+
+
+ ETH bought from invested amount
+ {trading.amounts.buy.eth} ETH
+
+
+
+ Common's Platform Fee ({trading.commonPlatformFee.percentage})
+
+ {trading.commonPlatformFee.eth} ETH
+
+
+ Remaining ETH to tokens
+
+ {trading.amounts.buy.eth - trading.commonPlatformFee.eth} ETH ={' '}
+ {trading.amounts.buy.token} {trading.token.symbol}
+
+
+
+ );
+};
+
+export default BuyReceipt;
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/ReceiptDetails/ReceiptDetails.scss b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/ReceiptDetails/ReceiptDetails.scss
new file mode 100644
index 00000000000..ceb2883efe1
--- /dev/null
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/ReceiptDetails/ReceiptDetails.scss
@@ -0,0 +1,19 @@
+@import '../../../../../../styles/shared.scss';
+
+.ReceiptDetails {
+ display: flex;
+ flex-direction: column;
+ gap: 4px;
+ width: 100%;
+ background-color: $neutral-50;
+ padding: 12px;
+ border-radius: 2px;
+
+ .entry {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ width: 100%;
+ border-bottom: 1px solid $neutral-200;
+ }
+}
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.scss b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.scss
index da932c53d25..5a4e107b72c 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.scss
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.scss
@@ -105,24 +105,6 @@
gap: 4px;
}
}
-
- .details {
- display: flex;
- flex-direction: column;
- gap: 4px;
- width: 100%;
- background-color: $neutral-50;
- padding: 12px;
- border-radius: 2px;
-
- .entry {
- display: flex;
- justify-content: space-between;
- align-items: center;
- width: 100%;
- border-bottom: 1px solid $neutral-200;
- }
- }
}
.action-btn {
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx
index e51680693b8..0888bcb4af9 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx
@@ -21,6 +21,7 @@ import {
CustomAddressOption,
CustomAddressOptionElement,
} from '../../ManageCommunityStakeModal/StakeExchangeForm/CustomAddressOption';
+import BuyReceipt from './ReceiptDetails/BuyReceipt';
import './TradeTokenForm.scss';
import { convertAddressToDropdownOption } from './helpers';
import { TradeTokenFormProps, TradingMode } from './types';
@@ -42,11 +43,13 @@ const TradeTokenForm = ({
const getCTADisabledTooltipText = () => {
if (isActionPending) return 'Processing trade...';
- // buy mode
- if (trading.amounts.buy.baseCurrency.amount === 0)
- return 'Please add trading amount to continue';
- if (trading.amounts.buy.insufficientFunds)
- return `You don't have sufficient funds to buy token`;
+ // only use these in buy mode
+ if (trading.mode.value === TradingMode.Buy) {
+ if (trading.amounts.buy.baseCurrency.amount === 0)
+ return 'Please add trading amount to continue';
+ if (trading.amounts.buy.insufficientFunds)
+ return `You don't have sufficient funds to buy token`;
+ }
};
const withOptionalTooltip = (children: ReactNode) => {
@@ -189,84 +192,20 @@ const TradeTokenForm = ({
- setIsReceiptDetailOpen((o) => !o)}
- disabled={!!getCTADisabledTooltipText()}
- />
+ {withOptionalTooltip(
+ setIsReceiptDetailOpen((o) => !o)}
+ disabled={!!getCTADisabledTooltipText()}
+ />,
+ )}
Subtotal + fees
{isReceiptDetailOpen ? (
trading.mode.value === TradingMode.Buy ? (
-
-
-
- ETH to {trading.amounts.buy.baseCurrency.name} rate
-
-
- 1 ETH ={' '}
- {currencySymbolPlacements.onLeft.includes(
- trading.amounts.buy.baseCurrency.name,
- )
- ? currencyNameToSymbolMap[
- trading.amounts.buy.baseCurrency.name
- ]
- : ''}{' '}
- {trading.unitEthToBaseCurrencyRate}
- {currencySymbolPlacements.onRight.includes(
- trading.amounts.buy.baseCurrency.name,
- )
- ? currencyNameToSymbolMap[
- trading.amounts.buy.baseCurrency.name
- ]
- : ''}
-
-
-
-
- Amount invested ({trading.amounts.buy.baseCurrency.name})
-
-
- {currencySymbolPlacements.onLeft.includes(
- trading.amounts.buy.baseCurrency.name,
- )
- ? currencyNameToSymbolMap[
- trading.amounts.buy.baseCurrency.name
- ]
- : ''}{' '}
- {trading.amounts.buy.baseCurrency.amount}
- {currencySymbolPlacements.onRight.includes(
- trading.amounts.buy.baseCurrency.name,
- )
- ? currencyNameToSymbolMap[
- trading.amounts.buy.baseCurrency.name
- ]
- : ''}
-
-
-
- ETH bought from invested amount
- {trading.amounts.buy.eth} ETH
-
-
-
- Common's Platform Fee (
- {trading.commonPlatformFee.percentage})
-
-
- {trading.commonPlatformFee.eth} ETH
-
-
-
- Remaining ETH to tokens
-
- {trading.amounts.buy.eth - trading.commonPlatformFee.eth} ETH
- = {trading.amounts.buy.token} {trading.token.symbol}
-
-
-
+
) : (
<>{/* TODO: sell mode data here */}>
)
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts
index 41f3133719f..d7484c174b2 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts
@@ -27,3 +27,8 @@ export type UseTradeTokenFormProps = {
addressType?: ChainBase;
onTradeComplete?: () => void;
};
+
+export type ReceiptDetailsProps = Pick<
+ ReturnType
,
+ 'trading'
+>;
From 2b3d045be633613333955fca95ee3e9f890c60c4 Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Wed, 13 Nov 2024 14:39:19 +0500
Subject: [PATCH 025/227] Moved buy amount selections to dedicated component
---
.../AmountSelections/AmountSelections.scss | 70 +++++++++++++++++++
.../AmountSelections/BuyAmountSelection.tsx | 67 ++++++++++++++++++
.../TradeTokenForm/TradeTokenForm.scss | 64 +----------------
.../TradeTokenForm/TradeTokenForm.tsx | 70 ++-----------------
.../TradeTokenModel/TradeTokenForm/types.ts | 5 ++
5 files changed, 148 insertions(+), 128 deletions(-)
create mode 100644 packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AmountSelections/AmountSelections.scss
create mode 100644 packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AmountSelections/BuyAmountSelection.tsx
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AmountSelections/AmountSelections.scss b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AmountSelections/AmountSelections.scss
new file mode 100644
index 00000000000..ca8b2cc808c
--- /dev/null
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AmountSelections/AmountSelections.scss
@@ -0,0 +1,70 @@
+@import '../../../../../../styles/shared.scss';
+
+.AmountSelections {
+ display: flex;
+ flex-direction: column;
+ gap: 4px;
+ width: 100%;
+
+ .amount-input-with-currency-symbol {
+ display: flex;
+ width: fit-content;
+ margin: auto;
+ background-color: $neutral-200;
+ border: 1px solid $neutral-300;
+ border-radius: 6px;
+ --font-size: 28px;
+
+ .amount-symbol {
+ border-radius: 6px;
+ margin: auto;
+ font-size: var(--font-size);
+ padding: 10px 8px;
+ background-color: $neutral-200;
+ color: $neutral-500;
+ }
+
+ .amount-input,
+ .amount-input > * {
+ max-width: 120px;
+ height: 48px !important;
+ min-height: 48px !important;
+
+ input {
+ height: 48px !important;
+ min-height: 48px !important;
+ text-align: center;
+ font-size: var(--font-size);
+ font-weight: bold;
+ color: $black;
+
+ &:focus-within {
+ border-color: $primary-500 !important;
+ box-shadow:
+ 0px 2px 2px -1px rgba(0, 0, 0, 0.12),
+ 0px 0px 0px 3px $primary-200 !important;
+ }
+ }
+ }
+ }
+
+ .amount-to-crypto {
+ text-align: center;
+ margin: auto;
+ width: fit-content;
+ }
+
+ .preset-amounts {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ flex-wrap: wrap;
+ gap: 8px;
+ margin: auto;
+ margin-top: 12px;
+
+ @include extraSmall {
+ margin-top: 4px;
+ }
+ }
+}
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AmountSelections/BuyAmountSelection.tsx b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AmountSelections/BuyAmountSelection.tsx
new file mode 100644
index 00000000000..d24354c6dff
--- /dev/null
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AmountSelections/BuyAmountSelection.tsx
@@ -0,0 +1,67 @@
+import {
+ currencyNameToSymbolMap,
+ currencySymbolPlacements,
+ getAmountWithCurrencySymbol,
+} from 'helpers/currency';
+import React from 'react';
+import { CWIcon } from 'views/components/component_kit/cw_icons/cw_icon';
+import { CWText } from 'views/components/component_kit/cw_text';
+import { CWTag } from 'views/components/component_kit/new_designs/CWTag';
+import { CWTextInput } from 'views/components/component_kit/new_designs/CWTextInput';
+import { BuyAmountSelectionProps } from '../types';
+import './AmountSelections.scss';
+
+const BuyAmountSelection = ({ trading }: BuyAmountSelectionProps) => {
+ const baseCurrencyName = trading.amounts.buy.baseCurrency.name;
+
+ const buyAmountCurrenySymbol = (
+
+ {currencyNameToSymbolMap[baseCurrencyName]}
+
+ );
+
+ return (
+
+
+ {currencySymbolPlacements.onLeft.includes(baseCurrencyName) &&
+ buyAmountCurrenySymbol}
+ trading.amounts.buy.baseCurrency.onAmountChange(e)}
+ />
+ {currencySymbolPlacements.onRight.includes(baseCurrencyName) &&
+ buyAmountCurrenySymbol}
+
+
+
+
+ {trading.amounts.buy.eth} ETH = {trading.amounts.buy.token}{' '}
+ {trading.token.symbol}
+
+
+ {trading.amounts.buy.baseCurrency.presetAmounts && (
+
+ {trading.amounts.buy.baseCurrency.presetAmounts?.map(
+ (presetAmount) => (
+
+ trading.amounts.buy.baseCurrency.onAmountChange(presetAmount)
+ }
+ />
+ ),
+ )}
+
+ )}
+
+ );
+};
+
+export default BuyAmountSelection;
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.scss b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.scss
index 5a4e107b72c..37afad496ba 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.scss
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.scss
@@ -12,7 +12,7 @@
padding: 8px 4px;
}
- .amount-selection {
+ .amount-selection-container {
.text-light {
color: $neutral-400;
}
@@ -28,68 +28,6 @@
@include extraSmall {
gap: 16px;
}
-
- .amount-input-with-currency-symbol {
- display: flex;
- width: fit-content;
- margin: auto;
- background-color: $neutral-200;
- border: 1px solid $neutral-300;
- border-radius: 6px;
- --font-size: 28px;
-
- .amount-symbol {
- border-radius: 6px;
- margin: auto;
- font-size: var(--font-size);
- padding: 10px 8px;
- background-color: $neutral-200;
- color: $neutral-500;
- }
-
- .amount-input,
- .amount-input > * {
- max-width: 120px;
- height: 48px !important;
- min-height: 48px !important;
-
- input {
- height: 48px !important;
- min-height: 48px !important;
- text-align: center;
- font-size: var(--font-size);
- font-weight: bold;
- color: $black;
-
- &:focus-within {
- border-color: $primary-500 !important;
- box-shadow:
- 0px 2px 2px -1px rgba(0, 0, 0, 0.12),
- 0px 0px 0px 3px $primary-200 !important;
- }
- }
- }
- }
-
- .amount-to-crypto {
- text-align: center;
- margin: auto;
- width: fit-content;
- }
-
- .preset-amounts {
- display: flex;
- justify-content: center;
- align-items: center;
- flex-wrap: wrap;
- gap: 8px;
- margin: auto;
- margin-top: 12px;
-
- @include extraSmall {
- margin-top: 4px;
- }
- }
}
.receipt-and-fees {
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx
index 0888bcb4af9..0a8ffad8030 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx
@@ -1,8 +1,3 @@
-import {
- currencyNameToSymbolMap,
- currencySymbolPlacements,
- getAmountWithCurrencySymbol,
-} from 'helpers/currency';
import React, { ReactNode, useState } from 'react';
import { Skeleton } from 'views/components/Skeleton';
import { CWIcon } from 'views/components/component_kit/cw_icons/cw_icon';
@@ -14,13 +9,12 @@ import {
CWTab,
CWTabsRow,
} from 'views/components/component_kit/new_designs/CWTabs';
-import { CWTag } from 'views/components/component_kit/new_designs/CWTag';
-import { CWTextInput } from 'views/components/component_kit/new_designs/CWTextInput';
import { CWTooltip } from 'views/components/component_kit/new_designs/CWTooltip';
import {
CustomAddressOption,
CustomAddressOptionElement,
} from '../../ManageCommunityStakeModal/StakeExchangeForm/CustomAddressOption';
+import BuyAmountSelection from './AmountSelections/BuyAmountSelection';
import BuyReceipt from './ReceiptDetails/BuyReceipt';
import './TradeTokenForm.scss';
import { convertAddressToDropdownOption } from './helpers';
@@ -34,12 +28,6 @@ const TradeTokenForm = ({
}: TradeTokenFormProps) => {
const [isReceiptDetailOpen, setIsReceiptDetailOpen] = useState(false);
- const buyAmountCurrenySymbol = (
-
- {currencyNameToSymbolMap[trading.amounts.buy.baseCurrency.name]}
-
- );
-
const getCTADisabledTooltipText = () => {
if (isActionPending) return 'Processing trade...';
@@ -129,63 +117,15 @@ const TradeTokenForm = ({
-
+
You're {trading.mode.value}ing
{trading.mode.value === TradingMode.Buy ? (
- <>
-
- {currencySymbolPlacements.onLeft.includes(
- trading.amounts.buy.baseCurrency.name,
- ) && buyAmountCurrenySymbol}
-
- trading.amounts.buy.baseCurrency.onAmountChange(e)
- }
- />
- {currencySymbolPlacements.onRight.includes(
- trading.amounts.buy.baseCurrency.name,
- ) && buyAmountCurrenySymbol}
-
-
-
-
- {trading.amounts.buy.eth} ETH = {trading.amounts.buy.token}{' '}
- {trading.token.symbol}
-
-
- {trading.amounts.buy.baseCurrency.presetAmounts && (
-
- {trading.amounts.buy.baseCurrency.presetAmounts?.map(
- (presetAmount) => (
-
- trading.amounts.buy.baseCurrency.onAmountChange(
- presetAmount,
- )
- }
- />
- ),
- )}
-
- )}
- >
+
) : (
- <>{/* TODO: sell mode data here */}>
+ <>{/* TODO: sell mode components here */}>
)}
@@ -207,7 +147,7 @@ const TradeTokenForm = ({
trading.mode.value === TradingMode.Buy ? (
) : (
- <>{/* TODO: sell mode data here */}>
+ <>{/* TODO: sell mode components here */}>
)
) : (
<>>
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts
index d7484c174b2..95d7ff6cdba 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts
@@ -28,6 +28,11 @@ export type UseTradeTokenFormProps = {
onTradeComplete?: () => void;
};
+export type BuyAmountSelectionProps = Pick<
+ ReturnType
,
+ 'trading'
+>;
+
export type ReceiptDetailsProps = Pick<
ReturnType,
'trading'
From f169a89e8bbe3c1c9b47e9821d6ccc70800507aa Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Wed, 13 Nov 2024 14:45:33 +0500
Subject: [PATCH 026/227] Show loading state when receipt detail is being
processed
---
.../TradeTokenForm/TradeTokenForm.tsx | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx
index 0a8ffad8030..36015772133 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx
@@ -3,6 +3,7 @@ import { Skeleton } from 'views/components/Skeleton';
import { CWIcon } from 'views/components/component_kit/cw_icons/cw_icon';
import { CWText } from 'views/components/component_kit/cw_text';
import { CWButton } from 'views/components/component_kit/new_designs/CWButton';
+import CWCircleMultiplySpinner from 'views/components/component_kit/new_designs/CWCircleMultiplySpinner';
import CWIconButton from 'views/components/component_kit/new_designs/CWIconButton';
import { CWSelectList } from 'views/components/component_kit/new_designs/CWSelectList';
import {
@@ -144,10 +145,16 @@ const TradeTokenForm = ({
{isReceiptDetailOpen ? (
- trading.mode.value === TradingMode.Buy ? (
-
+ isActionPending ? (
+
) : (
- <>{/* TODO: sell mode components here */}>
+ <>
+ {trading.mode.value === TradingMode.Buy ? (
+
+ ) : (
+ <>{/* TODO: sell mode components here */}>
+ )}
+ >
)
) : (
<>>
From d50edc14201f8b69b9c462dab09ab3f001b5e0c1 Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Wed, 13 Nov 2024 14:52:05 +0500
Subject: [PATCH 027/227] Fix circle multiply spinner center
---
.../CWCircleMultiplySpinner/CWCircleMultiplySpinner.scss | 1 +
1 file changed, 1 insertion(+)
diff --git a/packages/commonwealth/client/scripts/views/components/component_kit/new_designs/CWCircleMultiplySpinner/CWCircleMultiplySpinner.scss b/packages/commonwealth/client/scripts/views/components/component_kit/new_designs/CWCircleMultiplySpinner/CWCircleMultiplySpinner.scss
index 0feca5486e9..08b253fb1f3 100644
--- a/packages/commonwealth/client/scripts/views/components/component_kit/new_designs/CWCircleMultiplySpinner/CWCircleMultiplySpinner.scss
+++ b/packages/commonwealth/client/scripts/views/components/component_kit/new_designs/CWCircleMultiplySpinner/CWCircleMultiplySpinner.scss
@@ -58,6 +58,7 @@ $size: 24px;
.blue,
.pink-2 {
position: absolute;
+ left: 0;
width: $size;
height: $size;
border-radius: 50%;
From cfb44c52ecdbf374de166590a46a68b525bded88 Mon Sep 17 00:00:00 2001
From: Timothee Legros
Date: Wed, 13 Nov 2024 16:10:11 +0200
Subject: [PATCH 028/227] update validateNamespace to support token creation
flow
---
libs/model/src/chainEventSignatures.ts | 3 +++
.../src/community/UpdateCommunity.command.ts | 20 +++++++-------
.../commonProtocol/newNamespaceValidator.ts | 27 +++++++++++++++++--
3 files changed, 38 insertions(+), 12 deletions(-)
diff --git a/libs/model/src/chainEventSignatures.ts b/libs/model/src/chainEventSignatures.ts
index 602e161513c..2411ac55f05 100644
--- a/libs/model/src/chainEventSignatures.ts
+++ b/libs/model/src/chainEventSignatures.ts
@@ -9,3 +9,6 @@ export const launchpadTokenLaunchedEventSignature =
export const launchpadTradeEventSignature =
'0x9adcf0ad0cda63c4d50f26a48925cf6405df27d422a39c456b5f03f661c82982';
+
+export const communityNamespaceCreatedEventSignature =
+ '0xa16d784cb6c784b621c7877ce80495765ed32ca0b3dba2ef467116a435f125fd';
diff --git a/libs/model/src/community/UpdateCommunity.command.ts b/libs/model/src/community/UpdateCommunity.command.ts
index c8c37f415b7..443964b376d 100644
--- a/libs/model/src/community/UpdateCommunity.command.ts
+++ b/libs/model/src/community/UpdateCommunity.command.ts
@@ -1,4 +1,5 @@
import { InvalidInput, type Command } from '@hicommonwealth/core';
+import { commonProtocol } from '@hicommonwealth/model';
import * as schemas from '@hicommonwealth/schemas';
import { ChainBase } from '@hicommonwealth/shared';
import { models } from '../database';
@@ -84,18 +85,17 @@ export function UpdateCommunity(): Command {
throw new InvalidInput(UpdateCommunityErrors.InvalidDefaultPage);
if (namespace) {
- // TODO: this breaks token creation flow even when tx hash is provided @Kurtis
- // if (!transactionHash)
- // throw new InvalidInput(UpdateCommunityErrors.InvalidTransactionHash);
+ if (!transactionHash)
+ throw new InvalidInput(UpdateCommunityErrors.InvalidTransactionHash);
community.namespace = namespace;
- // community.namespace_address =
- // await commonProtocol.newNamespaceValidator.validateNamespace(
- // namespace!,
- // transactionHash,
- // actor.address!,
- // community,
- // );
+ community.namespace_address =
+ await commonProtocol.newNamespaceValidator.validateNamespace(
+ namespace!,
+ transactionHash,
+ actor.address!,
+ community,
+ );
}
default_page && (community.default_page = default_page);
diff --git a/libs/model/src/services/commonProtocol/newNamespaceValidator.ts b/libs/model/src/services/commonProtocol/newNamespaceValidator.ts
index deb93296c78..ecf76147299 100644
--- a/libs/model/src/services/commonProtocol/newNamespaceValidator.ts
+++ b/libs/model/src/services/commonProtocol/newNamespaceValidator.ts
@@ -1,5 +1,8 @@
import { AppError, ServerError } from '@hicommonwealth/core';
-import { models } from '@hicommonwealth/model';
+import {
+ communityNamespaceCreatedEventSignature,
+ models,
+} from '@hicommonwealth/model';
import { BalanceSourceType, commonProtocol } from '@hicommonwealth/shared';
import Web3 from 'web3';
import { CommunityAttributes } from '../../models';
@@ -74,7 +77,27 @@ export const validateNamespace = async (
factoryData.factory,
);
- if (!equalEvmAddresses(activeNamespace, txReceipt.logs[0].address)) {
+ let namespaceAddress: string | undefined;
+
+ // only emitted in token launch flows (launchpad)
+ const communityNamespaceCreatedLog = txReceipt.logs.find((l) => {
+ if (l.topics && l.topics.length > 0) {
+ return l.topics[0].toString() === communityNamespaceCreatedEventSignature;
+ }
+ return false;
+ });
+ if (communityNamespaceCreatedLog) {
+ const { 0: _namespaceAddress } = web3.eth.abi.decodeParameters(
+ ['address', 'address'],
+ communityNamespaceCreatedLog.data!.toString(),
+ );
+ namespaceAddress = _namespaceAddress as string;
+ } else {
+ // default namespace deployment tx
+ namespaceAddress = txReceipt.logs[0].address;
+ }
+
+ if (!equalEvmAddresses(activeNamespace, namespaceAddress)) {
throw new AppError('Invalid tx hash for namespace creation');
}
From a7c09876769568a3ec619dc022aea638eb78941f Mon Sep 17 00:00:00 2001
From: Timothee Legros
Date: Wed, 13 Nov 2024 16:13:50 +0200
Subject: [PATCH 029/227] fix GetTokens query
---
libs/model/src/token/GetTokens.query.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libs/model/src/token/GetTokens.query.ts b/libs/model/src/token/GetTokens.query.ts
index 0849b5cf4b0..4c7805445ed 100644
--- a/libs/model/src/token/GetTokens.query.ts
+++ b/libs/model/src/token/GetTokens.query.ts
@@ -35,7 +35,7 @@ export function GetTokens(): Query {
count(*) OVER() AS total
FROM "Tokens" as T
JOIN "Communities" as C ON T.namespace = C.namespace
- ${search ? 'WHERE LOWER(name) LIKE :search' : ''}
+ ${search ? 'WHERE LOWER(T.name) LIKE :search' : ''}
ORDER BY ${order_col} :direction
LIMIT :limit
OFFSET :offset
From 36d2bf0213529f8c10b538ac86469acc5c5bebaf Mon Sep 17 00:00:00 2001
From: Timothee Legros
Date: Wed, 13 Nov 2024 16:22:44 +0200
Subject: [PATCH 030/227] Fix schema
---
libs/model/src/token/GetTokens.query.ts | 5 ++++-
libs/schemas/src/entities/token.schemas.ts | 7 +++----
libs/schemas/src/queries/token.schemas.ts | 6 +++++-
3 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/libs/model/src/token/GetTokens.query.ts b/libs/model/src/token/GetTokens.query.ts
index 4c7805445ed..13b6cd5d481 100644
--- a/libs/model/src/token/GetTokens.query.ts
+++ b/libs/model/src/token/GetTokens.query.ts
@@ -42,7 +42,10 @@ export function GetTokens(): Query {
`;
const tokens = await models.sequelize.query<
- z.infer & { total?: number; community_id: string }
+ z.infer & {
+ total?: number;
+ community_id: string;
+ }
>(sql, {
replacements,
type: QueryTypes.SELECT,
diff --git a/libs/schemas/src/entities/token.schemas.ts b/libs/schemas/src/entities/token.schemas.ts
index c856e8b6241..3d160203981 100644
--- a/libs/schemas/src/entities/token.schemas.ts
+++ b/libs/schemas/src/entities/token.schemas.ts
@@ -7,10 +7,9 @@ export const Token = z.object({
namespace: z.string().describe('Namespace associated with the token'),
name: z.string().describe('Name of the token'),
symbol: z.string().describe('Symbol of the token'),
- initial_supply: z.union([
- PG_ETH.describe('Initial supply of the token before deploying to uniswap'),
- z.any(),
- ]), // TODO: create token returns this value as a string, but schema expects bigint
+ initial_supply: PG_ETH.describe(
+ 'Initial supply of the token before deploying to uniswap',
+ ),
is_locked: z
.boolean()
.default(false)
diff --git a/libs/schemas/src/queries/token.schemas.ts b/libs/schemas/src/queries/token.schemas.ts
index daac48fb2a5..176b46cc81c 100644
--- a/libs/schemas/src/queries/token.schemas.ts
+++ b/libs/schemas/src/queries/token.schemas.ts
@@ -2,12 +2,16 @@ import { z } from 'zod';
import { Token } from '../entities';
import { PaginatedResultSchema, PaginationParamsSchema } from './pagination';
+export const TokenView = Token.extend({
+ initial_supply: z.string(),
+});
+
export const GetTokens = {
input: PaginationParamsSchema.extend({
search: z.string().optional(),
order_by: z.enum(['name']).optional(),
}),
output: PaginatedResultSchema.extend({
- results: Token.extend({ community_id: z.string() }).array(),
+ results: TokenView.extend({ community_id: z.string() }).array(),
}),
};
From a95ee99e37dd3a677317316da6a4da0a23aea412 Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Wed, 13 Nov 2024 19:53:02 +0500
Subject: [PATCH 031/227] Fix types
---
.../views/modals/TradeTokenModel/TradeTokenForm/types.ts | 5 ++++-
.../views/pages/Communities/TokensList/TokensList.tsx | 5 ++++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts
index 95d7ff6cdba..fcc67f84fe7 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts
@@ -11,7 +11,10 @@ export enum TradingMode {
export type TradeTokenFormProps = ReturnType;
-const TokenWithCommunity = Token.extend({ community_id: z.string() });
+const TokenWithCommunity = Token.extend({
+ community_id: z.string(),
+ initial_supply: z.string(),
+});
export type TradingConfig = {
mode: TradingMode;
diff --git a/packages/commonwealth/client/scripts/views/pages/Communities/TokensList/TokensList.tsx b/packages/commonwealth/client/scripts/views/pages/Communities/TokensList/TokensList.tsx
index e1fb01a5ea5..612cc174e64 100644
--- a/packages/commonwealth/client/scripts/views/pages/Communities/TokensList/TokensList.tsx
+++ b/packages/commonwealth/client/scripts/views/pages/Communities/TokensList/TokensList.tsx
@@ -15,7 +15,10 @@ import { z } from 'zod';
import TokenCard from '../../../components/TokenCard';
import './TokensList.scss';
-const TokenWithCommunity = Token.extend({ community_id: z.string() });
+const TokenWithCommunity = Token.extend({
+ community_id: z.string(),
+ initial_supply: z.string(),
+});
const TokensList = () => {
const navigate = useCommonNavigate();
From a28a05a55a2e6e00e14c186f90fae020eb0df193 Mon Sep 17 00:00:00 2001
From: ianrowan
Date: Wed, 13 Nov 2024 11:05:17 -0600
Subject: [PATCH 032/227] fix curve id + fixed point
---
.../commonProtocol/contractHelpers/Launchpad.ts | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/libs/shared/src/commonProtocol/contractHelpers/Launchpad.ts b/libs/shared/src/commonProtocol/contractHelpers/Launchpad.ts
index 3699e08ec74..312d0657cc8 100644
--- a/libs/shared/src/commonProtocol/contractHelpers/Launchpad.ts
+++ b/libs/shared/src/commonProtocol/contractHelpers/Launchpad.ts
@@ -16,7 +16,7 @@ export const launchToken = async (
shares,
holders,
totalSupply,
- 0,
+ 1,
0,
'0x0000000000000000000000000000000000000000',
tokenCommunityManager,
@@ -32,9 +32,18 @@ export const buyToken = async (
walletAddress: string,
value: number,
) => {
- const txReceipt = await contract.methods.buyToken(tokenAddress, 0).send({
+ const contractCall = contract.methods.buyToken(tokenAddress, 0);
+ let gasResult;
+ gasResult = await contractCall.estimateGas({
+ from: walletAddress,
+ value: value.toFixed(0),
+ });
+
+ const txReceipt = await contractCall.send({
from: walletAddress,
- value,
+ value: value.toFixed(0),
+ gas: gasResult.toString(),
+ type: '0x2',
});
return txReceipt;
};
@@ -47,7 +56,7 @@ export const sellToken = async (
walletAddress: string,
) => {
const txReceipt = await contract.methods
- .sellToken(tokenAddress, amount, 0)
+ .sellToken(tokenAddress, amount.toFixed(0), 0)
.send({ from: walletAddress });
return txReceipt;
};
From 06dc11c54321e5d1883d458fc67a1ec622d47468 Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Wed, 13 Nov 2024 22:44:49 +0500
Subject: [PATCH 033/227] Fixed token schema failing on create token command
---
libs/schemas/src/entities/token.schemas.ts | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/libs/schemas/src/entities/token.schemas.ts b/libs/schemas/src/entities/token.schemas.ts
index 3d160203981..05d96f72390 100644
--- a/libs/schemas/src/entities/token.schemas.ts
+++ b/libs/schemas/src/entities/token.schemas.ts
@@ -7,9 +7,10 @@ export const Token = z.object({
namespace: z.string().describe('Namespace associated with the token'),
name: z.string().describe('Name of the token'),
symbol: z.string().describe('Symbol of the token'),
- initial_supply: PG_ETH.describe(
- 'Initial supply of the token before deploying to uniswap',
- ),
+ initial_supply: z.union([
+ PG_ETH.describe('Initial supply of the token before deploying to uniswap'),
+ z.any(),
+ ]),
is_locked: z
.boolean()
.default(false)
From d7b8433f54be19da1f412064b8235ed91daa4975 Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Wed, 13 Nov 2024 22:45:06 +0500
Subject: [PATCH 034/227] Fix lint
---
libs/shared/src/commonProtocol/contractHelpers/Launchpad.ts | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/libs/shared/src/commonProtocol/contractHelpers/Launchpad.ts b/libs/shared/src/commonProtocol/contractHelpers/Launchpad.ts
index 312d0657cc8..77c16487965 100644
--- a/libs/shared/src/commonProtocol/contractHelpers/Launchpad.ts
+++ b/libs/shared/src/commonProtocol/contractHelpers/Launchpad.ts
@@ -33,8 +33,7 @@ export const buyToken = async (
value: number,
) => {
const contractCall = contract.methods.buyToken(tokenAddress, 0);
- let gasResult;
- gasResult = await contractCall.estimateGas({
+ const gasResult = await contractCall.estimateGas({
from: walletAddress,
value: value.toFixed(0),
});
From 082787e969a9cd4c15fc4f77b12240cfb82120dc Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Wed, 13 Nov 2024 22:45:27 +0500
Subject: [PATCH 035/227] Convert eth amount to 1e18 when buying token
---
.../modals/TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts
index 601089f1418..e1fcb604392 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts
@@ -117,7 +117,7 @@ const useTradeTokenForm = ({
const payload = {
chainRpc: baseNode.url,
ethChainId: baseNode.ethChainId,
- amountEth: ethBuyAmount,
+ amountEth: ethBuyAmount * 1e18, // amount in wei
walletAddress: selectedAddress,
tokenAddress: tradeConfig.token.token_address,
};
From 76e8180390a80ec868668b7e7e9b8e870c03a0aa Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Wed, 13 Nov 2024 22:51:29 +0500
Subject: [PATCH 036/227] Join user to community after buying token
---
.../TradeTokenForm/useTradeTokenForm.ts | 28 ++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts
index e1fcb604392..77fa6cba75d 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts
@@ -12,6 +12,7 @@ import { useBuyTokenMutation } from 'state/api/launchPad';
import { fetchCachedNodes } from 'state/api/nodes';
import { useCreateTokenTradeMutation } from 'state/api/tokens';
import useUserStore from 'state/ui/user';
+import useJoinCommunity from 'views/components/SublayoutHeader/useJoinCommunity';
import './TradeTokenForm.scss';
import { TradingMode, UseTradeTokenFormProps } from './types';
@@ -45,6 +46,8 @@ const useTradeTokenForm = ({
(n) => n.ethChainId === commonProtocol.ValidChains.SepoliaBase,
) as NodeInfo; // this is expected to exist
+ const { linkSpecificAddressToSpecificCommunity } = useJoinCommunity();
+
const { data: ethToCurrencyRateData, isLoading: isLoadingETHToCurrencyRate } =
useFetchTokenUsdRateQuery({
tokenSymbol: 'ETH',
@@ -111,7 +114,14 @@ const useTradeTokenForm = ({
const handleTokenBuy = async () => {
try {
// this condition wouldn't be called, but adding to avoid typescript issues
- if (!baseNode?.url || !baseNode?.ethChainId || !selectedAddress) return;
+ if (
+ !baseNode?.url ||
+ !baseNode?.ethChainId ||
+ !selectedAddress ||
+ !tokenCommunity
+ ) {
+ return;
+ }
// buy token on chain
const payload = {
@@ -129,6 +139,22 @@ const useTradeTokenForm = ({
transaction_hash: txReceipt.transactionHash,
});
+ // join user's selected address to community
+ const isMemberOfCommunity = user.addresses.find(
+ (x) => x.community.id === tokenCommunity.id,
+ );
+ if (!isMemberOfCommunity) {
+ await linkSpecificAddressToSpecificCommunity({
+ address: selectedAddress,
+ community: {
+ base: tokenCommunity.base,
+ iconUrl: tokenCommunity.icon_url || '',
+ id: tokenCommunity.id,
+ name: tokenCommunity.name,
+ },
+ });
+ }
+
onTradeComplete?.();
} catch (e) {
notifyError('Failed to buy token');
From 230d35342e16b30d5f89b479d0806d90b5f35806 Mon Sep 17 00:00:00 2001
From: Timothee Legros
Date: Wed, 13 Nov 2024 20:06:18 +0200
Subject: [PATCH 037/227] use `TokenView` in `createToken.command`
---
libs/schemas/src/commands/token.schemas.ts | 5 +++--
libs/schemas/src/entities/token.schemas.ts | 7 +++----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/libs/schemas/src/commands/token.schemas.ts b/libs/schemas/src/commands/token.schemas.ts
index 86f873a99a5..76902f78cca 100644
--- a/libs/schemas/src/commands/token.schemas.ts
+++ b/libs/schemas/src/commands/token.schemas.ts
@@ -1,6 +1,7 @@
import { z } from 'zod';
import { AuthContext } from '../context';
-import { LaunchpadTrade, Token } from '../entities';
+import { LaunchpadTrade } from '../entities';
+import { TokenView } from '../queries';
export const CreateToken = {
input: z.object({
@@ -10,7 +11,7 @@ export const CreateToken = {
description: z.string().nullish(),
icon_url: z.string().nullish(),
}),
- output: Token,
+ output: TokenView,
context: AuthContext,
};
diff --git a/libs/schemas/src/entities/token.schemas.ts b/libs/schemas/src/entities/token.schemas.ts
index 05d96f72390..3d160203981 100644
--- a/libs/schemas/src/entities/token.schemas.ts
+++ b/libs/schemas/src/entities/token.schemas.ts
@@ -7,10 +7,9 @@ export const Token = z.object({
namespace: z.string().describe('Namespace associated with the token'),
name: z.string().describe('Name of the token'),
symbol: z.string().describe('Symbol of the token'),
- initial_supply: z.union([
- PG_ETH.describe('Initial supply of the token before deploying to uniswap'),
- z.any(),
- ]),
+ initial_supply: PG_ETH.describe(
+ 'Initial supply of the token before deploying to uniswap',
+ ),
is_locked: z
.boolean()
.default(false)
From 9f48a221f41368ecff936f3ae4e9bd5b0692baa6 Mon Sep 17 00:00:00 2001
From: Timothee Legros
Date: Wed, 13 Nov 2024 20:19:47 +0200
Subject: [PATCH 038/227] various fixes
---
libs/model/src/token/CreateLaunchpadTrade.command.ts | 11 ++++++++---
libs/model/src/token/CreateToken.command.ts | 6 ++++--
libs/schemas/src/commands/token.schemas.ts | 8 +++++++-
.../chainEventCreated/handleLaunchpadTrade.ts | 2 +-
4 files changed, 20 insertions(+), 7 deletions(-)
diff --git a/libs/model/src/token/CreateLaunchpadTrade.command.ts b/libs/model/src/token/CreateLaunchpadTrade.command.ts
index da017fc6199..a855225935b 100644
--- a/libs/model/src/token/CreateLaunchpadTrade.command.ts
+++ b/libs/model/src/token/CreateLaunchpadTrade.command.ts
@@ -1,6 +1,7 @@
import { Command, InvalidState } from '@hicommonwealth/core';
import * as schemas from '@hicommonwealth/schemas';
import { commonProtocol } from '@hicommonwealth/shared';
+import z from 'zod';
import { models } from '../database';
import { mustExist } from '../middleware/guards';
import { getLaunchpadTradeTransaction } from '../services/commonProtocol/launchpadHelpers';
@@ -35,7 +36,9 @@ export function CreateLaunchpadTrade(): Command<
},
});
if (existingTrade) {
- return existingTrade?.get({ plain: true });
+ return existingTrade?.get({ plain: true }) as unknown as z.infer<
+ typeof schemas.LaunchpadTradeView
+ >;
}
const chainNode = await models.ChainNode.scope('withPrivateData').findOne(
@@ -58,7 +61,7 @@ export function CreateLaunchpadTrade(): Command<
const trade = await models.LaunchpadTrade.create({
eth_chain_id,
transaction_hash,
- token_address: result.parsedArgs.tokenAddress,
+ token_address: result.parsedArgs.tokenAddress.toLowerCase(),
trader_address: result.parsedArgs.traderAddress,
is_buy: result.parsedArgs.isBuy,
community_token_amount: result.parsedArgs.communityTokenAmount,
@@ -68,7 +71,9 @@ export function CreateLaunchpadTrade(): Command<
timestamp: Number(result.block.timestamp),
});
- return trade.get({ plain: true });
+ return trade.get({ plain: true }) as unknown as z.infer<
+ typeof schemas.LaunchpadTradeView
+ >;
},
};
}
diff --git a/libs/model/src/token/CreateToken.command.ts b/libs/model/src/token/CreateToken.command.ts
index 10f6f8e201d..6b65bbb16fb 100644
--- a/libs/model/src/token/CreateToken.command.ts
+++ b/libs/model/src/token/CreateToken.command.ts
@@ -1,7 +1,9 @@
import { type Command } from '@hicommonwealth/core';
import * as schemas from '@hicommonwealth/schemas';
+import { TokenView } from '@hicommonwealth/schemas';
import { commonProtocol } from '@hicommonwealth/shared';
import Web3 from 'web3';
+import z from 'zod';
import { models } from '../database';
import { authRoles } from '../middleware';
import { mustExist } from '../middleware/guards';
@@ -61,7 +63,7 @@ export async function createTokenHandler(
}
const token = await models.Token.create({
- token_address: tokenAddress,
+ token_address: tokenAddress.toLowerCase(),
namespace,
name,
symbol,
@@ -71,7 +73,7 @@ export async function createTokenHandler(
icon_url: iconUrl ?? null,
});
- return token!.toJSON();
+ return token!.toJSON() as unknown as z.infer;
}
export function CreateToken(): Command {
diff --git a/libs/schemas/src/commands/token.schemas.ts b/libs/schemas/src/commands/token.schemas.ts
index 76902f78cca..26e565f315f 100644
--- a/libs/schemas/src/commands/token.schemas.ts
+++ b/libs/schemas/src/commands/token.schemas.ts
@@ -15,10 +15,16 @@ export const CreateToken = {
context: AuthContext,
};
+export const LaunchpadTradeView = LaunchpadTrade.extend({
+ community_token_amount: z.string(),
+ price: z.string(),
+ floating_supply: z.string(),
+});
+
export const CreateLaunchpadTrade = {
input: z.object({
eth_chain_id: z.number(),
transaction_hash: z.string().length(66),
}),
- output: LaunchpadTrade,
+ output: LaunchpadTradeView,
};
diff --git a/packages/commonwealth/server/workers/commonwealthConsumer/policies/chainEventCreated/handleLaunchpadTrade.ts b/packages/commonwealth/server/workers/commonwealthConsumer/policies/chainEventCreated/handleLaunchpadTrade.ts
index 6e88163e63e..49eafb66c6d 100644
--- a/packages/commonwealth/server/workers/commonwealthConsumer/policies/chainEventCreated/handleLaunchpadTrade.ts
+++ b/packages/commonwealth/server/workers/commonwealthConsumer/policies/chainEventCreated/handleLaunchpadTrade.ts
@@ -52,7 +52,7 @@ export async function handleLaunchpadTrade(
await models.LaunchpadTrade.create({
eth_chain_id: chainNode.eth_chain_id!,
transaction_hash: event.rawLog.transactionHash,
- token_address: tokenAddress,
+ token_address: tokenAddress.toLowerCase(),
trader_address: traderAddress,
is_buy: isBuy,
community_token_amount: BigNumber.from(communityTokenAmount).toBigInt(),
From 4878e57570e252797be7d6ea4168255358591b94 Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Wed, 13 Nov 2024 23:21:05 +0500
Subject: [PATCH 039/227] Added common platform fee calculation
---
.../TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts
index 77fa6cba75d..1f96ac5a9eb 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts
@@ -16,6 +16,8 @@ import useJoinCommunity from 'views/components/SublayoutHeader/useJoinCommunity'
import './TradeTokenForm.scss';
import { TradingMode, UseTradeTokenFormProps } from './types';
+const COMMON_PLATFORM_FEE_PERCENTAGE = 5; // make configurable when needed
+
const useTradeTokenForm = ({
tradeConfig,
addressType,
@@ -57,6 +59,8 @@ const useTradeTokenForm = ({
);
const ethBuyAmount = baseCurrencyTradingAmount / ethToCurrencyRate;
+ const commonPlatformFeeForBuyTradeInEth =
+ (COMMON_PLATFORM_FEE_PERCENTAGE / 100) * ethBuyAmount;
const { data: tokenCommunity, isLoading: isLoadingTokenCommunity } =
useGetCommunityByIdQuery({
@@ -213,8 +217,8 @@ const useTradeTokenForm = ({
token: tradeConfig.token,
// TODO: hardcoded for now
commonPlatformFee: {
- percentage: '0.5%',
- eth: 0.0000178,
+ percentage: `${COMMON_PLATFORM_FEE_PERCENTAGE}%`,
+ eth: commonPlatformFeeForBuyTradeInEth,
},
},
addresses: {
From f1b69e9bf9de612545659d6146ef9d9274f4f139 Mon Sep 17 00:00:00 2001
From: Timothee Legros
Date: Wed, 13 Nov 2024 20:52:50 +0200
Subject: [PATCH 040/227] merge conflict fixes
---
libs/model/src/token/CreateToken.command.ts | 2 +-
libs/schemas/src/queries/token.schemas.ts | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/libs/model/src/token/CreateToken.command.ts b/libs/model/src/token/CreateToken.command.ts
index 362cc56528a..f06e5a79236 100644
--- a/libs/model/src/token/CreateToken.command.ts
+++ b/libs/model/src/token/CreateToken.command.ts
@@ -48,7 +48,7 @@ export function CreateToken(): Command {
}
const token = await models.Token.create({
- token_address: tokenData.parsedArgs.tokenAddress,
+ token_address: tokenData.parsedArgs.tokenAddress.toLowerCase(),
namespace: tokenData.parsedArgs.namespace,
name: tokenInfo.name,
symbol: tokenInfo.symbol,
diff --git a/libs/schemas/src/queries/token.schemas.ts b/libs/schemas/src/queries/token.schemas.ts
index 176b46cc81c..1983daff95c 100644
--- a/libs/schemas/src/queries/token.schemas.ts
+++ b/libs/schemas/src/queries/token.schemas.ts
@@ -4,6 +4,7 @@ import { PaginatedResultSchema, PaginationParamsSchema } from './pagination';
export const TokenView = Token.extend({
initial_supply: z.string(),
+ launchpad_liquidity: z.string(),
});
export const GetTokens = {
From ec168e3dfffc157966eabb0ac5e2aa1b432e98b9 Mon Sep 17 00:00:00 2001
From: Timothee Legros
Date: Wed, 13 Nov 2024 21:30:07 +0200
Subject: [PATCH 041/227] type fixes + enable trade test
---
libs/model/test/launchpad/launchpad.spec.ts | 39 ++++++++++---------
.../TradeTokenModel/TradeTokenForm/types.ts | 5 +--
.../Communities/TokensList/TokensList.tsx | 5 +--
3 files changed, 24 insertions(+), 25 deletions(-)
diff --git a/libs/model/test/launchpad/launchpad.spec.ts b/libs/model/test/launchpad/launchpad.spec.ts
index 6056d13f03f..3a1fac53029 100644
--- a/libs/model/test/launchpad/launchpad.spec.ts
+++ b/libs/model/test/launchpad/launchpad.spec.ts
@@ -1,5 +1,5 @@
import { Actor, command, dispose } from '@hicommonwealth/core';
-import { config } from '@hicommonwealth/model';
+import { config, equalEvmAddresses } from '@hicommonwealth/model';
import { BalanceType, commonProtocol } from '@hicommonwealth/shared';
import chai, { expect } from 'chai';
import chaiAsPromised from 'chai-as-promised';
@@ -10,9 +10,11 @@ import { CreateLaunchpadTrade, CreateToken } from '../../src/token';
chai.use(chaiAsPromised);
-const transaction_hash =
- '0x754d65b374aa224c0f74b0951e88f97e223b1fdd7e0ec468e253c486ae7e8a68';
-const token_address = '0x48651D8dE5F3c1634C77A46f77836FE2338fdc0C';
+const CREATE_TOKEN_TXN_HASH =
+ '0x735a6ec2a5d1b71634e74183f2436f4b76855e613e97fc008f2df486d9eb73db';
+const TRADE_TOKEN_TXN_HASH =
+ '0xf516b28f2baba449b2776c190580200320165f5436a94f5f2dc35500a3001aee';
+const TOKEN_ADDRESS = '0x656a7C7429a7Ef95f55A1c1F4cc0D5D0B9E11b87';
describe('Launchpad Lifecycle', () => {
let actor: Actor;
@@ -34,7 +36,7 @@ describe('Launchpad Lifecycle', () => {
});
const [community] = await seed('Community', {
- namespace: 'Tim Testing 3',
+ namespace: 'DogeMoonLanding',
chain_node_id: node?.id,
lifetime_thread_count: 0,
profile_count: 1,
@@ -72,7 +74,7 @@ describe('Launchpad Lifecycle', () => {
{ timeout: 10_000 },
async () => {
const payload = {
- transaction_hash,
+ transaction_hash: CREATE_TOKEN_TXN_HASH,
chain_node_id: node!.id!,
description: 'test',
icon_url: 'test',
@@ -84,19 +86,18 @@ describe('Launchpad Lifecycle', () => {
payload,
});
- expect(results?.token_address).to.equal(token_address);
- expect(results?.symbol).to.equal('tim3');
+ expect(equalEvmAddresses(results?.token_address, TOKEN_ADDRESS)).to.be
+ .true;
+ expect(results?.symbol).to.equal('DMLND');
},
);
- // TODO: complete test in #9867
- test.skip(
+ test(
'Get a launchpad trade txn and project it',
{ timeout: 10_000 },
async () => {
- const buyTxHash = '';
const payload = {
- transaction_hash: buyTxHash,
+ transaction_hash: TRADE_TOKEN_TXN_HASH,
eth_chain_id: commonProtocol.ValidChains.SepoliaBase,
};
const results = await command(CreateLaunchpadTrade(), {
@@ -105,14 +106,14 @@ describe('Launchpad Lifecycle', () => {
});
expect(results).to.deep.equal({
eth_chain_id: commonProtocol.ValidChains.SepoliaBase,
- transaction_hash: buyTxHash,
- token_address,
- trader_address: '',
+ transaction_hash: TRADE_TOKEN_TXN_HASH,
+ token_address: TOKEN_ADDRESS.toLowerCase(),
+ trader_address: '0x2cE1F5d4f84B583Ab320cAc0948AddE52a131FBE',
is_buy: true,
- community_token_amount: 1n,
- price: 1n,
- floating_supply: 1n,
- timestamp: 1,
+ community_token_amount: '534115082271506067334',
+ price: '2507151',
+ floating_supply: '535115082271506067334',
+ timestamp: 1731523956,
});
},
);
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts
index fcc67f84fe7..777d046fd23 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts
@@ -1,4 +1,4 @@
-import { Token } from '@hicommonwealth/schemas';
+import { TokenView } from '@hicommonwealth/schemas';
import { ChainBase } from '@hicommonwealth/shared';
import { SupportedCurrencies } from 'helpers/currency';
import { z } from 'zod';
@@ -11,9 +11,8 @@ export enum TradingMode {
export type TradeTokenFormProps = ReturnType;
-const TokenWithCommunity = Token.extend({
+const TokenWithCommunity = TokenView.extend({
community_id: z.string(),
- initial_supply: z.string(),
});
export type TradingConfig = {
diff --git a/packages/commonwealth/client/scripts/views/pages/Communities/TokensList/TokensList.tsx b/packages/commonwealth/client/scripts/views/pages/Communities/TokensList/TokensList.tsx
index 612cc174e64..9e6dcb38711 100644
--- a/packages/commonwealth/client/scripts/views/pages/Communities/TokensList/TokensList.tsx
+++ b/packages/commonwealth/client/scripts/views/pages/Communities/TokensList/TokensList.tsx
@@ -1,4 +1,4 @@
-import { Token } from '@hicommonwealth/schemas';
+import { TokenView } from '@hicommonwealth/schemas';
import { ChainBase } from '@hicommonwealth/shared';
import clsx from 'clsx';
import { useFlag } from 'hooks/useFlag';
@@ -15,9 +15,8 @@ import { z } from 'zod';
import TokenCard from '../../../components/TokenCard';
import './TokensList.scss';
-const TokenWithCommunity = Token.extend({
+const TokenWithCommunity = TokenView.extend({
community_id: z.string(),
- initial_supply: z.string(),
});
const TokensList = () => {
From a3674b782feb6fb13ec96afa8e98205e06fa6bcb Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Thu, 14 Nov 2024 00:59:29 +0500
Subject: [PATCH 042/227] Notify user about success after token purchase
---
.../TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts
index 1f96ac5a9eb..6678c8b25a9 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts
@@ -1,5 +1,5 @@
import { commonProtocol } from '@hicommonwealth/shared';
-import { notifyError } from 'controllers/app/notifications';
+import { notifyError, notifySuccess } from 'controllers/app/notifications';
import useRunOnceOnCondition from 'hooks/useRunOnceOnCondition';
import NodeInfo from 'models/NodeInfo';
import { useMemo, useState } from 'react';
@@ -159,6 +159,9 @@ const useTradeTokenForm = ({
});
}
+ // update user about success
+ notifySuccess('Transactions successful!');
+
onTradeComplete?.();
} catch (e) {
notifyError('Failed to buy token');
From 6ebb07d350bc843b916ee0a094acb7c2994c2ee9 Mon Sep 17 00:00:00 2001
From: rotorsoft
Date: Wed, 13 Nov 2024 15:19:16 -0500
Subject: [PATCH 043/227] reconfig vitest
---
common_knowledge/Package-Scripts.md | 12 +-
libs/model/package.json | 4 +-
libs/model/src/config.ts | 3 -
libs/model/src/tester/bootstrap.ts | 10 +-
libs/model/src/tester/index.ts | 1 -
libs/model/src/tester/seed.ts | 2 +-
libs/model/src/tester/seedDb.ts | 4 +-
libs/model/src/tester/vitestDatabaseSetup.ts | 38 -
.../community/stake-historical-price.spec.ts | 2 +-
.../test/community/stake-transaction.spec.ts | 2 +-
.../contest-worker-policy.spec.ts | 2 +-
...ntests-metadata-commands-lifecycle.spec.ts | 2 +-
.../contests-projection-lifecycle.spec.ts | 2 +-
.../test/email/digest-email-lifecycle.spec.ts | 2 +-
libs/model/test/launchpad/launchpad.spec.ts | 2 +-
.../test/reaction/reaction-lifecycle.spec.ts | 2 +-
libs/model/test/seed/model.spec.ts | 2 +-
.../snapshot/createSnapshotProposal.spec.ts | 2 +-
.../comment-subscription-lifecycle.spec.ts | 2 +-
.../community-alerts-lifecycle.spec.ts | 2 +-
.../thread-subscription-lifecycle.spec.ts | 2 +-
.../test/util-tests/getCommentDepth.spec.ts | 2 +-
.../createSitemapGenerator.spec.ts | 2 +-
package.json | 2 +-
packages/commonwealth/package.json | 12 +-
packages/commonwealth/server-test.ts | 2 +-
.../devnet/cosmos/proposalTxEthermint.spec.ts | 4 +-
.../test/devnet/cosmos/proposalTxV1.spec.ts | 2 +-
.../devnet/cosmos/proposalTxV1beta1.spec.ts | 4 +-
.../cosmos/tokenBalanceFetching.spec.ts | 2 +-
.../devnet/evm/tokenBalanceFetching.spec.ts | 2 +-
.../commonwealth/test/e2e/utils/e2eUtils.ts | 2 +-
.../test/integration/api/chainNodes.spec.ts | 2 +-
.../api/getRelatedCommunities.spec.ts | 2 +-
.../integration/api/threads-query.spec.ts | 2 +-
.../test/integration/databaseCleaner.spec.ts | 2 +-
.../evmChainEvents/getEventSources.spec.ts | 2 +-
.../scheduleNodeProcessing.spec.ts | 2 +-
.../messageRelayer/messageRelayer.spec.ts | 2 +-
.../messageRelayer/pgListener.spec.ts | 2 +-
.../integration/messageRelayer/relay.spec.ts | 2 +-
pnpm-lock.yaml | 3039 +++++++++++------
vite.config.ts | 14 +-
43 files changed, 1975 insertions(+), 1232 deletions(-)
delete mode 100644 libs/model/src/tester/vitestDatabaseSetup.ts
diff --git a/common_knowledge/Package-Scripts.md b/common_knowledge/Package-Scripts.md
index 8f74561c841..9099d4da3ed 100644
--- a/common_knowledge/Package-Scripts.md
+++ b/common_knowledge/Package-Scripts.md
@@ -299,31 +299,31 @@ See `test-unit`.
### test-api
-Definition: `INIT_TEST_DB=true NODE_ENV=test vitest --config ../../vite.config.ts --fileParallelism=false run ./test/integration/api`
+Definition: `NODE_ENV=test vitest --config ../../vite.config.ts --fileParallelism=false run ./test/integration/api`
Description: Runs all tests in the /api subfolder of the /integration directory.
### test-integration
-Definition: `INIT_TEST_DB=true NODE_ENV=test vitest --config ../../vite.config.ts --fileParallelism=false run ./test/integration`
+Definition: `NODE_ENV=test vitest --config ../../vite.config.ts --fileParallelism=false run ./test/integration`
Description: Runs all tests in the /test/integration folder (includes API tests).
### test-devnet:evm
-Definition: `INIT_TEST_DB=true NODE_ENV=test vitest --config ../../vite.config.ts --fileParallelism=false run ./test/devnet/evm`
+Definition: `NODE_ENV=test vitest --config ../../vite.config.ts --fileParallelism=false run ./test/devnet/evm`
Description: Runs all tests in our `/devnet/evm` folder.
### test-devnet:cosmos
-Definition: `INIT_TEST_DB=true NODE_ENV=test vitest --config ../../vite.config.ts --fileParallelism=false run ./test/devnet/cosmos`
+Definition: `NODE_ENV=test vitest --config ../../vite.config.ts --fileParallelism=false run ./test/devnet/cosmos`
Description: Runs all tests in our `/devnet/cosmos` folder.
### test-select
-Definition: `INIT_TEST_DB=true NODE_ENV=test vitest --config ../../vite.config.ts --fileParallelism=false run`
+Definition: `NODE_ENV=test vitest --config ../../vite.config.ts --fileParallelism=false run`
Description: Append a path to run specific test files or folders.
@@ -335,7 +335,7 @@ Description: Tests all .spec files within the `./test/unit` sub-directory of tes
### test-select:watch
-Definition: `INIT_TEST_DB=true NODE_ENV=test vitest --config ../../vite.config.ts --fileParallelism=false`
+Definition: `NODE_ENV=test vitest --config ../../vite.config.ts --fileParallelism=false`
Description: Watches for changes to any .spec files within the given path and automatically runs test when they are updated.
diff --git a/libs/model/package.json b/libs/model/package.json
index 3bdc353c800..7fd08d300eb 100644
--- a/libs/model/package.json
+++ b/libs/model/package.json
@@ -17,8 +17,8 @@
"build": "tsc -b ./tsconfig.build.json",
"clean": "rm -rf build && rm -rf coverage && find . -type f -name '*.tsbuildinfo' -exec rm {} +",
"check-types": "tsc --noEmit",
- "test": "INIT_TEST_DB=true NODE_ENV=test vitest --config ../../vite.config.ts --fileParallelism=false --coverage run test",
- "test-select": "INIT_TEST_DB=true NODE_ENV=test vitest --config ../../vite.config.ts --fileParallelism=false run",
+ "test": "NODE_ENV=test vitest --config ../../vite.config.ts --fileParallelism=false --coverage run test",
+ "test-select": "NODE_ENV=test vitest --config ../../vite.config.ts --fileParallelism=false run",
"lint": "NODE_OPTIONS=\"--max-old-space-size=4096\" eslint -c ../../.eslintrc.cjs './src/**/*.{ts,tsx}'",
"lint-diff": "NODE_OPTIONS=\"--max-old-space-size=4096\" eslint -c ../../.eslintrc-diff.cjs './src/**/*.{ts,tsx}'"
},
diff --git a/libs/model/src/config.ts b/libs/model/src/config.ts
index 87f1cac5991..20bfde8e013 100644
--- a/libs/model/src/config.ts
+++ b/libs/model/src/config.ts
@@ -13,7 +13,6 @@ const {
PRIVATE_KEY,
TBC_BALANCE_TTL_SECONDS,
BLACKLISTED_EVENTS,
- INIT_TEST_DB,
MAX_USER_POSTS_PER_CONTEST,
JWT_SECRET,
ADDRESS_TOKEN_EXPIRES_IN,
@@ -67,7 +66,6 @@ export const config = configure(
CLEAN_HOUR: DATABASE_CLEAN_HOUR
? parseInt(DATABASE_CLEAN_HOUR, 10)
: undefined,
- INIT_TEST_DB: INIT_TEST_DB === 'true',
TRACE: DATABASE_LOG_TRACE === 'true',
},
WEB3: {
@@ -175,7 +173,6 @@ export const config = configure(
NAME: z.string(),
NO_SSL: z.boolean(),
CLEAN_HOUR: z.coerce.number().int().min(0).max(24).optional(),
- INIT_TEST_DB: z.boolean(),
TRACE: z.boolean(),
}),
WEB3: z.object({
diff --git a/libs/model/src/tester/bootstrap.ts b/libs/model/src/tester/bootstrap.ts
index 2f7dfe28d47..763f8bf4d9d 100644
--- a/libs/model/src/tester/bootstrap.ts
+++ b/libs/model/src/tester/bootstrap.ts
@@ -207,10 +207,14 @@ export const get_info_schema = async (
let db: DB | undefined = undefined;
/**
* Bootstraps testing, creating/migrating a fresh instance if it doesn't exist.
+ * @meta import meta of calling test
* @param truncate when true, truncates all tables in model
* @returns synchronized sequelize db instance
*/
-export const bootstrap_testing = async (truncate = false): Promise => {
+export const bootstrap_testing = async (
+ meta: ImportMeta,
+ truncate = false,
+): Promise => {
if (!db) {
db = buildDb(
new Sequelize({
@@ -221,12 +225,12 @@ export const bootstrap_testing = async (truncate = false): Promise => {
logging: false,
}),
);
- console.log('Database object built');
+ console.log('Database object built:', meta.filename);
}
if (truncate) {
await truncate_db(db);
- console.log('Database truncated');
+ console.log('Database truncated:', meta.filename);
}
return db;
diff --git a/libs/model/src/tester/index.ts b/libs/model/src/tester/index.ts
index ebb10e8362a..a7b05fab224 100644
--- a/libs/model/src/tester/index.ts
+++ b/libs/model/src/tester/index.ts
@@ -2,4 +2,3 @@ export * from './bootstrap';
export * from './e2eSeeds';
export * from './seed';
export * from './seedDb';
-export { setup } from './vitestDatabaseSetup';
diff --git a/libs/model/src/tester/seed.ts b/libs/model/src/tester/seed.ts
index 554dd4fa5b3..ebc500eda7e 100644
--- a/libs/model/src/tester/seed.ts
+++ b/libs/model/src/tester/seed.ts
@@ -62,7 +62,7 @@ export async function seed(
values?: DeepPartial>,
options: SeedOptions = { mock: true },
): Promise<[z.infer<(typeof schemas)[T]> | undefined, State[]]> {
- const db = await bootstrap_testing();
+ const db = await bootstrap_testing(import.meta);
const records: State[] = [];
await _seed(db![name], values ?? {}, options, records, 0);
diff --git a/libs/model/src/tester/seedDb.ts b/libs/model/src/tester/seedDb.ts
index fd61f8dbcff..f9498328925 100644
--- a/libs/model/src/tester/seedDb.ts
+++ b/libs/model/src/tester/seedDb.ts
@@ -18,9 +18,9 @@ import { bootstrap_testing } from './bootstrap';
* such as associated IDs and seed values. Additionally, not all tests require every
* entity to be seeded, so focus should be on seeding only what is explicitly needed.
*/
-export const seedDb = async () => {
+export const seedDb = async (meta: ImportMeta) => {
try {
- const models = await bootstrap_testing(true);
+ const models = await bootstrap_testing(meta, true);
await models.User.bulkCreate(
[{ email: 'drewstone329@gmail.com' }, { email: 'temp@gmail.com' }].map(
diff --git a/libs/model/src/tester/vitestDatabaseSetup.ts b/libs/model/src/tester/vitestDatabaseSetup.ts
deleted file mode 100644
index a4b37d7bec7..00000000000
--- a/libs/model/src/tester/vitestDatabaseSetup.ts
+++ /dev/null
@@ -1,38 +0,0 @@
-import { config } from '../config';
-
-/**
- * A global database setup function for Vitest. This function is executed once before all Vitest test suites.
- */
-export async function setup(): Promise {
- if (config.NODE_ENV !== 'test')
- throw new Error('Seeds only work when testing!');
-
- if (!config.DB.INIT_TEST_DB) {
- console.warn('Database not initialized');
- return;
- }
-
- const { Sequelize } = await import('sequelize');
- const { buildDb, syncDb } = await import('../models');
- const { verify_db } = await import('./bootstrap');
-
- await verify_db(config.DB.NAME);
- try {
- const db = buildDb(
- new Sequelize({
- dialect: 'postgres',
- database: config.DB.NAME,
- username: 'commonwealth',
- password: 'edgeware',
- logging: false,
- }),
- );
- await syncDb(db);
- console.log('Database synced!');
- } catch (error) {
- console.error('Error bootstrapping test db:', error);
- throw error;
- }
-}
-
-export default setup;
diff --git a/libs/model/test/community/stake-historical-price.spec.ts b/libs/model/test/community/stake-historical-price.spec.ts
index 89bf97c2825..1515df52bd3 100644
--- a/libs/model/test/community/stake-historical-price.spec.ts
+++ b/libs/model/test/community/stake-historical-price.spec.ts
@@ -13,7 +13,7 @@ describe('Stake Historical Price', () => {
let actor: Actor;
beforeAll(async () => {
- await bootstrap_testing(true);
+ await bootstrap_testing(import.meta, true);
const [node] = await seed('ChainNode', {
url: 'https://ethereum-sepolia.publicnode.com',
name: 'Sepolia Testnet',
diff --git a/libs/model/test/community/stake-transaction.spec.ts b/libs/model/test/community/stake-transaction.spec.ts
index 585a5bd84f7..093baa1882d 100644
--- a/libs/model/test/community/stake-transaction.spec.ts
+++ b/libs/model/test/community/stake-transaction.spec.ts
@@ -17,7 +17,7 @@ describe('Stake transactions', () => {
let community_id: string;
beforeAll(async () => {
- await bootstrap_testing(true);
+ await bootstrap_testing(import.meta, true);
const [node] = await seed('ChainNode', {
url: 'https://ethereum-sepolia.publicnode.com',
private_url: 'https://ethereum-sepolia.publicnode.com',
diff --git a/libs/model/test/contest-worker/contest-worker-policy.spec.ts b/libs/model/test/contest-worker/contest-worker-policy.spec.ts
index bde4d0dcc19..06b42a51bc9 100644
--- a/libs/model/test/contest-worker/contest-worker-policy.spec.ts
+++ b/libs/model/test/contest-worker/contest-worker-policy.spec.ts
@@ -17,7 +17,7 @@ describe('Contest Worker Policy', () => {
let topicId: number = 0;
beforeAll(async () => {
- await bootstrap_testing();
+ await bootstrap_testing(import.meta);
const [chainNode] = await seed('ChainNode', { contracts: [] });
const [user] = await seed(
'User',
diff --git a/libs/model/test/contest/contests-metadata-commands-lifecycle.spec.ts b/libs/model/test/contest/contests-metadata-commands-lifecycle.spec.ts
index 1499c6de85d..d179b70cd76 100644
--- a/libs/model/test/contest/contests-metadata-commands-lifecycle.spec.ts
+++ b/libs/model/test/contest/contests-metadata-commands-lifecycle.spec.ts
@@ -31,7 +31,7 @@ describe('Contests metadata commands lifecycle', () => {
let communityMemberActor: Actor | null = null;
beforeAll(async () => {
- await bootstrap_testing();
+ await bootstrap_testing(import.meta);
const [chain] = await seed('ChainNode', {});
const [communityAdminUser] = await seed(
diff --git a/libs/model/test/contest/contests-projection-lifecycle.spec.ts b/libs/model/test/contest/contests-projection-lifecycle.spec.ts
index abb3fc56565..91e17dbdaa2 100644
--- a/libs/model/test/contest/contests-projection-lifecycle.spec.ts
+++ b/libs/model/test/contest/contests-projection-lifecycle.spec.ts
@@ -67,7 +67,7 @@ describe('Contests projection lifecycle', () => {
getContestScore = Sinon.stub(contestHelper, 'getContestScore');
getContestStatus = Sinon.stub(contestHelper, 'getContestStatus');
- await bootstrap_testing();
+ await bootstrap_testing(import.meta);
try {
const recurringContestAbi = await models.ContractAbi.create({
diff --git a/libs/model/test/email/digest-email-lifecycle.spec.ts b/libs/model/test/email/digest-email-lifecycle.spec.ts
index d876e3ef674..7bbb23c90f4 100644
--- a/libs/model/test/email/digest-email-lifecycle.spec.ts
+++ b/libs/model/test/email/digest-email-lifecycle.spec.ts
@@ -14,7 +14,7 @@ describe('Digest email lifecycle', () => {
let communityThree: z.infer | undefined;
beforeAll(async () => {
- await bootstrap_testing(true);
+ await bootstrap_testing(import.meta, true);
const [authorUser] = await seed('User', {
isAdmin: false,
selected_community_id: null,
diff --git a/libs/model/test/launchpad/launchpad.spec.ts b/libs/model/test/launchpad/launchpad.spec.ts
index 9467cc71a4a..c79e139254f 100644
--- a/libs/model/test/launchpad/launchpad.spec.ts
+++ b/libs/model/test/launchpad/launchpad.spec.ts
@@ -18,7 +18,7 @@ describe('Launchpad Lifecycle', () => {
let node: ChainNodeAttributes;
beforeAll(async () => {
- await bootstrap_testing(true);
+ await bootstrap_testing(import.meta, true);
[node] = (await seed('ChainNode', {
url: `https://base-sepolia.g.alchemy.com/v2/${config.ALCHEMY.APP_KEYS.PUBLIC}`,
private_url: `https://base-sepolia.g.alchemy.com/v2/${config.ALCHEMY.APP_KEYS.PUBLIC}`,
diff --git a/libs/model/test/reaction/reaction-lifecycle.spec.ts b/libs/model/test/reaction/reaction-lifecycle.spec.ts
index f70d0837714..550443e55ef 100644
--- a/libs/model/test/reaction/reaction-lifecycle.spec.ts
+++ b/libs/model/test/reaction/reaction-lifecycle.spec.ts
@@ -10,7 +10,7 @@ describe('Reactions lifecycle', () => {
const threadId = 999;
beforeAll(async () => {
- await bootstrap_testing();
+ await bootstrap_testing(import.meta);
const [chain] = await seed('ChainNode', { contracts: [] });
const [user] = await seed(
'User',
diff --git a/libs/model/test/seed/model.spec.ts b/libs/model/test/seed/model.spec.ts
index 0058980e7a5..4f4fa72a520 100644
--- a/libs/model/test/seed/model.spec.ts
+++ b/libs/model/test/seed/model.spec.ts
@@ -11,7 +11,7 @@ import {
} from '../../src/tester';
const generateSchemas = async () => {
- const model = await bootstrap_testing();
+ const model = await bootstrap_testing(import.meta);
const migration = await create_db_from_migrations('common_migrated_test');
// TODO: resolve remaining conflicts!!!
diff --git a/libs/model/test/snapshot/createSnapshotProposal.spec.ts b/libs/model/test/snapshot/createSnapshotProposal.spec.ts
index 6f194f8ea37..1988922062f 100644
--- a/libs/model/test/snapshot/createSnapshotProposal.spec.ts
+++ b/libs/model/test/snapshot/createSnapshotProposal.spec.ts
@@ -8,7 +8,7 @@ import { CreateSnapshotProposal } from '../../src/snapshot';
describe('Snapshot Listener API', { timeout: 5_000 }, () => {
beforeAll(async () => {
- await tester.bootstrap_testing(true);
+ await tester.bootstrap_testing(import.meta, true);
const [chainNode] = await tester.seed(
'ChainNode',
{
diff --git a/libs/model/test/subscription/comment-subscription-lifecycle.spec.ts b/libs/model/test/subscription/comment-subscription-lifecycle.spec.ts
index 62174ddc18c..0adb8f98411 100644
--- a/libs/model/test/subscription/comment-subscription-lifecycle.spec.ts
+++ b/libs/model/test/subscription/comment-subscription-lifecycle.spec.ts
@@ -17,7 +17,7 @@ describe('Comment subscription lifecycle', () => {
let commentOne: z.infer | undefined;
let commentTwo: z.infer | undefined;
beforeAll(async () => {
- await bootstrap_testing(true);
+ await bootstrap_testing(import.meta, true);
const [user] = await seed('User', {
isAdmin: false,
selected_community_id: null,
diff --git a/libs/model/test/subscription/community-alerts-lifecycle.spec.ts b/libs/model/test/subscription/community-alerts-lifecycle.spec.ts
index 73cf94a828c..46fa218a2ce 100644
--- a/libs/model/test/subscription/community-alerts-lifecycle.spec.ts
+++ b/libs/model/test/subscription/community-alerts-lifecycle.spec.ts
@@ -18,7 +18,7 @@ describe('Community alerts lifecycle', () => {
let communityTwo: z.infer | undefined;
beforeAll(async () => {
- await bootstrap_testing(true);
+ await bootstrap_testing(import.meta, true);
const [user] = await seed('User', {
isAdmin: false,
});
diff --git a/libs/model/test/subscription/thread-subscription-lifecycle.spec.ts b/libs/model/test/subscription/thread-subscription-lifecycle.spec.ts
index c824e5cfa81..d4c60d5f7c8 100644
--- a/libs/model/test/subscription/thread-subscription-lifecycle.spec.ts
+++ b/libs/model/test/subscription/thread-subscription-lifecycle.spec.ts
@@ -17,7 +17,7 @@ describe('Thread subscription lifecycle', () => {
let threadOne: z.infer | undefined;
let threadTwo: z.infer | undefined;
beforeAll(async () => {
- await bootstrap_testing(true);
+ await bootstrap_testing(import.meta, true);
const [user] = await seed('User', {
isAdmin: false,
});
diff --git a/libs/model/test/util-tests/getCommentDepth.spec.ts b/libs/model/test/util-tests/getCommentDepth.spec.ts
index 91ca7c6b668..767e684a748 100644
--- a/libs/model/test/util-tests/getCommentDepth.spec.ts
+++ b/libs/model/test/util-tests/getCommentDepth.spec.ts
@@ -16,7 +16,7 @@ describe('getCommentDepth', () => {
const maxDepth = 8;
beforeAll(async () => {
- await tester.seedDb();
+ await tester.seedDb(import.meta);
const address = await models.Address.findOne({
where: {
community_id,
diff --git a/libs/sitemaps/test/integration/createSitemapGenerator.spec.ts b/libs/sitemaps/test/integration/createSitemapGenerator.spec.ts
index 5ebf9659ae9..d04907a29da 100644
--- a/libs/sitemaps/test/integration/createSitemapGenerator.spec.ts
+++ b/libs/sitemaps/test/integration/createSitemapGenerator.spec.ts
@@ -9,7 +9,7 @@ import {
describe('createSitemapGenerator', { timeout: 10_000 }, function () {
beforeAll(async () => {
- await tester.bootstrap_testing(true);
+ await tester.bootstrap_testing(import.meta, true);
const [user] = await tester.seed('User', {
isAdmin: true,
});
diff --git a/package.json b/package.json
index 89ad96e18a5..982a424349a 100644
--- a/package.json
+++ b/package.json
@@ -135,7 +135,7 @@
"tsconfig-paths": "^4.2.0",
"tslint": "^5.13.0",
"typescript": "^5.0.0",
- "vite": "^5.2.12",
+ "vite": "^5.4.11",
"vite-bundle-visualizer": "^1.2.1",
"vite-plugin-html": "^3.2.2",
"vite-plugin-node-polyfills": "^0.22.0",
diff --git a/packages/commonwealth/package.json b/packages/commonwealth/package.json
index 403f1441e45..b05b75e7f8d 100644
--- a/packages/commonwealth/package.json
+++ b/packages/commonwealth/package.json
@@ -60,16 +60,16 @@
"start-message-relayer": "tsx ./server/workers/messageRelayer/messageRelayer.ts",
"stylelint": "stylelint client/styles/*",
"test": "pnpm test-unit",
- "test-api": "INIT_TEST_DB=true NODE_ENV=test vitest --config ../../vite.config.ts --fileParallelism=false --coverage run ./test/integration/api",
- "test-devnet:cosmos": "INIT_TEST_DB=true NODE_ENV=test vitest --config ../../vite.config.ts --fileParallelism=false --coverage run ./test/devnet/cosmos",
- "test-devnet:evm": "INIT_TEST_DB=true NODE_ENV=test vitest --config ../../vite.config.ts --fileParallelism=false --coverage run ./test/devnet/evm",
+ "test-api": "NODE_ENV=test vitest --config ../../vite.config.ts --fileParallelism=false --coverage run ./test/integration/api",
+ "test-devnet:cosmos": "NODE_ENV=test vitest --config ../../vite.config.ts --fileParallelism=false --coverage run ./test/devnet/cosmos",
+ "test-devnet:evm": "NODE_ENV=test vitest --config ../../vite.config.ts --fileParallelism=false --coverage run ./test/devnet/evm",
"test-e2e": "NODE_OPTIONS='--import tsx/esm' NODE_ENV=test TEST_ENV=playwright npx playwright test -c ./test/e2e/playwright.config.ts --workers 1 ./test/e2e/e2eRegular/*",
"test-e2e-mature": "NODE_OPTIONS='--import tsx/esm' NODE_ENV=test TEST_ENV=playwright npx playwright test -c ./test/e2e/playwright.config.ts --workers 1 ./test/e2e/mature/*",
"test-e2e-serial": "NODE_OPTIONS='--import tsx/esm' NODE_ENV=test TEST_ENV=playwright npx playwright test --workers 1 ./test/e2e/e2eSerial/*",
- "test-integration": "INIT_TEST_DB=true NODE_ENV=test vitest --config ../../vite.config.ts --fileParallelism=false --coverage run ./test/integration",
+ "test-integration": "NODE_ENV=test vitest --config ../../vite.config.ts --fileParallelism=false --coverage run ./test/integration",
"test-unit": "NODE_ENV=test FEATURE_FLAG_GROUP_CHECK_ENABLED=true vitest --config ../../vite.config.ts run test/unit",
- "test-select": "INIT_TEST_DB=true NODE_ENV=test vitest --config ../../vite.config.ts --fileParallelism=false run",
- "test-select:watch": "INIT_TEST_DB=true NODE_ENV=test vitest --config ../../vite.config.ts --fileParallelism=false",
+ "test-select": "NODE_ENV=test vitest --config ../../vite.config.ts --fileParallelism=false run",
+ "test-select:watch": "NODE_ENV=test vitest --config ../../vite.config.ts --fileParallelism=false",
"ts-exec": "tsx ",
"validate-external-api-version": "pnpm -F commonwealth ts-exec server/scripts/validate-external-api-versioning.ts $(pnpm info @commonxyz/api-client version)",
"vite": "wait-on http://localhost:3000/api/health && vite -c ./client/vite.config.ts --host",
diff --git a/packages/commonwealth/server-test.ts b/packages/commonwealth/server-test.ts
index e415bc8749b..a6c55bfe40c 100644
--- a/packages/commonwealth/server-test.ts
+++ b/packages/commonwealth/server-test.ts
@@ -40,7 +40,7 @@ export const testServer = async (): Promise => {
const { tester } = await import('@hicommonwealth/model');
const { main } = await import('./main');
- const db = await tester.seedDb();
+ const db = await tester.seedDb(import.meta);
const app = express();
const { server, cacheDecorator } = await main(app, db, {
port: 8081,
diff --git a/packages/commonwealth/test/devnet/cosmos/proposalTxEthermint.spec.ts b/packages/commonwealth/test/devnet/cosmos/proposalTxEthermint.spec.ts
index a8366905e16..1991aac9092 100644
--- a/packages/commonwealth/test/devnet/cosmos/proposalTxEthermint.spec.ts
+++ b/packages/commonwealth/test/devnet/cosmos/proposalTxEthermint.spec.ts
@@ -89,7 +89,7 @@ describe('Proposal Transaction Tests - ethermint chain (evmos-dev-local)', () =>
const lcdUrl = `http://localhost:8080/cosmosAPI/v1/${id}`;
beforeAll(async () => {
- await tester.seedDb();
+ await tester.seedDb(import.meta);
const tm = await getTMClient(rpcUrl);
rpc = await getRPCClient(tm);
const { signerAddress } = await setupTestSigner(lcdUrl);
@@ -175,7 +175,7 @@ describe('Proposal Transaction Tests - ethermint chain (evmos-dev-local)', () =>
describe('Ethermint Governance v1beta1 util Tests', () => {
describe('getActiveProposals', () => {
beforeAll(async () => {
- await tester.seedDb();
+ await tester.seedDb(import.meta);
});
afterAll(async () => {
diff --git a/packages/commonwealth/test/devnet/cosmos/proposalTxV1.spec.ts b/packages/commonwealth/test/devnet/cosmos/proposalTxV1.spec.ts
index 8873480d34d..4aae2434ff7 100644
--- a/packages/commonwealth/test/devnet/cosmos/proposalTxV1.spec.ts
+++ b/packages/commonwealth/test/devnet/cosmos/proposalTxV1.spec.ts
@@ -41,7 +41,7 @@ describe('Proposal Transaction Tests - gov v1 chain using cosmJs signer (csdk-v1
let signer: string;
beforeAll(async () => {
- await tester.seedDb();
+ await tester.seedDb(import.meta);
lcd = await getLCDClient(lcdUrl);
const { signerAddress } = await setupTestSigner(rpcUrl);
signer = signerAddress;
diff --git a/packages/commonwealth/test/devnet/cosmos/proposalTxV1beta1.spec.ts b/packages/commonwealth/test/devnet/cosmos/proposalTxV1beta1.spec.ts
index 44ec352ee89..20e771ebf08 100644
--- a/packages/commonwealth/test/devnet/cosmos/proposalTxV1beta1.spec.ts
+++ b/packages/commonwealth/test/devnet/cosmos/proposalTxV1beta1.spec.ts
@@ -36,7 +36,7 @@ describe('Proposal Transaction Tests - gov v1beta1 chain (csdk-beta-local)', ()
const rpcUrlBeta = `http://localhost:8080/cosmosAPI/${betaId}`;
beforeAll(async () => {
- await tester.seedDb();
+ await tester.seedDb(import.meta);
const tm = await getTMClient(rpcUrlBeta);
rpc = await getRPCClient(tm);
const { signerAddress } = await setupTestSigner(rpcUrlBeta);
@@ -177,7 +177,7 @@ describe('Proposal Transaction Tests - gov v1beta1 chain (csdk-beta-local)', ()
describe('Cosmos Governance v1beta1 util Tests', () => {
beforeAll(async () => {
- await tester.seedDb();
+ await tester.seedDb(import.meta);
});
afterAll(async () => {
diff --git a/packages/commonwealth/test/devnet/cosmos/tokenBalanceFetching.spec.ts b/packages/commonwealth/test/devnet/cosmos/tokenBalanceFetching.spec.ts
index 1895f5b74fe..570fdd3e480 100644
--- a/packages/commonwealth/test/devnet/cosmos/tokenBalanceFetching.spec.ts
+++ b/packages/commonwealth/test/devnet/cosmos/tokenBalanceFetching.spec.ts
@@ -136,7 +136,7 @@ describe('Token Balance Cache Cosmos Tests', { timeout: 30_000 }, function () {
};
beforeAll(async () => {
- models = await tester.seedDb();
+ models = await tester.seedDb(import.meta);
cache({
adapter: new RedisCache('redis://localhost:6379'),
});
diff --git a/packages/commonwealth/test/devnet/evm/tokenBalanceFetching.spec.ts b/packages/commonwealth/test/devnet/evm/tokenBalanceFetching.spec.ts
index 3ab86b31afa..40d39d80696 100644
--- a/packages/commonwealth/test/devnet/evm/tokenBalanceFetching.spec.ts
+++ b/packages/commonwealth/test/devnet/evm/tokenBalanceFetching.spec.ts
@@ -94,7 +94,7 @@ describe('Token Balance Cache EVM Tests', { timeout: 160_000 }, function () {
beforeAll(async () => {
anvil = await getAnvil(1);
- models = await tester.seedDb();
+ models = await tester.seedDb(import.meta);
cache({
adapter: new RedisCache('redis://localhost:6379'),
});
diff --git a/packages/commonwealth/test/e2e/utils/e2eUtils.ts b/packages/commonwealth/test/e2e/utils/e2eUtils.ts
index 139c521e056..06d19b234a5 100644
--- a/packages/commonwealth/test/e2e/utils/e2eUtils.ts
+++ b/packages/commonwealth/test/e2e/utils/e2eUtils.ts
@@ -14,7 +14,7 @@ export type E2E_Seeder = E2E_TestEntities & {
const buildSeeder = async (): Promise => {
// This connection is used to speed up tests, so we don't need to load in all the models with the associated
// imports. This can only be used with raw sql queries.
- const testDb = await tester.bootstrap_testing(true);
+ const testDb = await tester.bootstrap_testing(import.meta, true);
const testAddress = '0x0bad5AA8Adf8bA82198D133F9Bb5a48A638FCe88';
const e2eEntities = await tester.e2eTestEntities(testDb);
diff --git a/packages/commonwealth/test/integration/api/chainNodes.spec.ts b/packages/commonwealth/test/integration/api/chainNodes.spec.ts
index 97c3f23205f..5b63422e73a 100644
--- a/packages/commonwealth/test/integration/api/chainNodes.spec.ts
+++ b/packages/commonwealth/test/integration/api/chainNodes.spec.ts
@@ -10,7 +10,7 @@ describe('ChainNode Tests', () => {
let models: DB;
beforeAll(async () => {
- models = await tester.seedDb();
+ models = await tester.seedDb(import.meta);
});
afterAll(async () => {
diff --git a/packages/commonwealth/test/integration/api/getRelatedCommunities.spec.ts b/packages/commonwealth/test/integration/api/getRelatedCommunities.spec.ts
index 91221c9b1c3..900679bb610 100644
--- a/packages/commonwealth/test/integration/api/getRelatedCommunities.spec.ts
+++ b/packages/commonwealth/test/integration/api/getRelatedCommunities.spec.ts
@@ -8,7 +8,7 @@ describe('GetRelatedCommunities Tests', async () => {
let models: DB;
beforeAll(async () => {
- models = await tester.seedDb();
+ models = await tester.seedDb(import.meta);
});
afterAll(async () => {
diff --git a/packages/commonwealth/test/integration/api/threads-query.spec.ts b/packages/commonwealth/test/integration/api/threads-query.spec.ts
index 36e2f95af6e..fafcbd3507e 100644
--- a/packages/commonwealth/test/integration/api/threads-query.spec.ts
+++ b/packages/commonwealth/test/integration/api/threads-query.spec.ts
@@ -19,7 +19,7 @@ describe('Thread queries', () => {
let models: DB;
beforeAll(async () => {
- models = await tester.seedDb();
+ models = await tester.seedDb(import.meta);
});
afterAll(async () => {
diff --git a/packages/commonwealth/test/integration/databaseCleaner.spec.ts b/packages/commonwealth/test/integration/databaseCleaner.spec.ts
index eedd41aadf4..baf1c2835fe 100644
--- a/packages/commonwealth/test/integration/databaseCleaner.spec.ts
+++ b/packages/commonwealth/test/integration/databaseCleaner.spec.ts
@@ -26,7 +26,7 @@ describe('DatabaseCleaner Tests', async () => {
let models: DB;
beforeAll(async () => {
- models = await tester.seedDb();
+ models = await tester.seedDb(import.meta);
});
afterAll(async () => {
diff --git a/packages/commonwealth/test/integration/evmChainEvents/getEventSources.spec.ts b/packages/commonwealth/test/integration/evmChainEvents/getEventSources.spec.ts
index a9d5f9378b3..9f03881d9cc 100644
--- a/packages/commonwealth/test/integration/evmChainEvents/getEventSources.spec.ts
+++ b/packages/commonwealth/test/integration/evmChainEvents/getEventSources.spec.ts
@@ -15,7 +15,7 @@ describe('getEventSources', () => {
let stakesAbiInstance: ContractAbiInstance;
beforeAll(async () => {
- await tester.bootstrap_testing(true);
+ await tester.bootstrap_testing(import.meta, true);
const res = await createEventSources();
namespaceAbiInstance = res.namespaceAbiInstance;
stakesAbiInstance = res.stakesAbiInstance;
diff --git a/packages/commonwealth/test/integration/evmChainEvents/scheduleNodeProcessing.spec.ts b/packages/commonwealth/test/integration/evmChainEvents/scheduleNodeProcessing.spec.ts
index 68805c456fd..1dfd6631fb1 100644
--- a/packages/commonwealth/test/integration/evmChainEvents/scheduleNodeProcessing.spec.ts
+++ b/packages/commonwealth/test/integration/evmChainEvents/scheduleNodeProcessing.spec.ts
@@ -22,7 +22,7 @@ describe('scheduleNodeProcessing', () => {
let stakesAbiInstance: ContractAbiInstance;
beforeAll(async () => {
- await tester.bootstrap_testing(true);
+ await tester.bootstrap_testing(import.meta, true);
});
afterAll(async () => {
diff --git a/packages/commonwealth/test/integration/messageRelayer/messageRelayer.spec.ts b/packages/commonwealth/test/integration/messageRelayer/messageRelayer.spec.ts
index c347665dc88..33dc86919c5 100644
--- a/packages/commonwealth/test/integration/messageRelayer/messageRelayer.spec.ts
+++ b/packages/commonwealth/test/integration/messageRelayer/messageRelayer.spec.ts
@@ -16,7 +16,7 @@ describe('messageRelayer', { timeout: 20_000 }, () => {
beforeAll(async () => {
const res = await import('@hicommonwealth/model');
models = res['models'];
- await tester.bootstrap_testing(true);
+ await tester.bootstrap_testing(import.meta, true);
});
afterEach(async () => {
diff --git a/packages/commonwealth/test/integration/messageRelayer/pgListener.spec.ts b/packages/commonwealth/test/integration/messageRelayer/pgListener.spec.ts
index 0a407281d1c..bb9bea38c19 100644
--- a/packages/commonwealth/test/integration/messageRelayer/pgListener.spec.ts
+++ b/packages/commonwealth/test/integration/messageRelayer/pgListener.spec.ts
@@ -16,7 +16,7 @@ describe.skip('pgListener', { timeout: 10_000 }, () => {
beforeAll(async () => {
const res = await import('@hicommonwealth/model');
models = res['models'];
- await tester.bootstrap_testing(true);
+ await tester.bootstrap_testing(import.meta, true);
client = await setupListener();
});
diff --git a/packages/commonwealth/test/integration/messageRelayer/relay.spec.ts b/packages/commonwealth/test/integration/messageRelayer/relay.spec.ts
index 03123371159..c050a5108a0 100644
--- a/packages/commonwealth/test/integration/messageRelayer/relay.spec.ts
+++ b/packages/commonwealth/test/integration/messageRelayer/relay.spec.ts
@@ -11,7 +11,7 @@ describe('relay', () => {
beforeAll(async () => {
const res = await import('@hicommonwealth/model');
models = res['models'];
- await tester.bootstrap_testing(true);
+ await tester.bootstrap_testing(import.meta, true);
});
afterEach(async () => {
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index d968d4ad725..9ba03ac7b2d 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -161,10 +161,10 @@ importers:
version: 6.21.0(eslint@8.57.0)(typescript@5.4.5)
'@vitejs/plugin-react-swc':
specifier: ^3.7.0
- version: 3.7.0(@swc/helpers@0.5.12)(vite@5.2.12(@types/node@20.12.10)(sass@1.77.0)(terser@5.34.1))
+ version: 3.7.0(@swc/helpers@0.5.12)(vite@5.4.11(@types/node@20.12.10)(sass@1.77.0)(terser@5.36.0))
'@vitest/coverage-istanbul':
specifier: ^1.6.0
- version: 1.6.0(vitest@1.6.0(@types/node@20.12.10)(jsdom@24.0.0(bufferutil@4.0.8)(utf-8-validate@6.0.3))(sass@1.77.0)(terser@5.34.1))
+ version: 1.6.0(vitest@1.6.0(@types/node@20.12.10)(jsdom@24.0.0(bufferutil@4.0.8)(utf-8-validate@6.0.3))(sass@1.77.0)(terser@5.36.0))
chai:
specifier: ^4.3.6
version: 4.4.1
@@ -289,23 +289,23 @@ importers:
specifier: ^5.0.0
version: 5.4.5
vite:
- specifier: ^5.2.12
- version: 5.2.12(@types/node@20.12.10)(sass@1.77.0)(terser@5.34.1)
+ specifier: ^5.4.11
+ version: 5.4.11(@types/node@20.12.10)(sass@1.77.0)(terser@5.36.0)
vite-bundle-visualizer:
specifier: ^1.2.1
- version: 1.2.1(rollup@4.18.0)
+ version: 1.2.1(rollup@4.26.0)
vite-plugin-html:
specifier: ^3.2.2
- version: 3.2.2(vite@5.2.12(@types/node@20.12.10)(sass@1.77.0)(terser@5.34.1))
+ version: 3.2.2(vite@5.4.11(@types/node@20.12.10)(sass@1.77.0)(terser@5.36.0))
vite-plugin-node-polyfills:
specifier: ^0.22.0
- version: 0.22.0(rollup@4.18.0)(vite@5.2.12(@types/node@20.12.10)(sass@1.77.0)(terser@5.34.1))
+ version: 0.22.0(rollup@4.26.0)(vite@5.4.11(@types/node@20.12.10)(sass@1.77.0)(terser@5.36.0))
vite-tsconfig-paths:
specifier: ^4.3.2
- version: 4.3.2(typescript@5.4.5)(vite@5.2.12(@types/node@20.12.10)(sass@1.77.0)(terser@5.34.1))
+ version: 4.3.2(typescript@5.4.5)(vite@5.4.11(@types/node@20.12.10)(sass@1.77.0)(terser@5.36.0))
vitest:
specifier: ^1.6.0
- version: 1.6.0(@types/node@20.12.10)(jsdom@24.0.0(bufferutil@4.0.8)(utf-8-validate@6.0.3))(sass@1.77.0)(terser@5.34.1)
+ version: 1.6.0(@types/node@20.12.10)(jsdom@24.0.0(bufferutil@4.0.8)(utf-8-validate@6.0.3))(sass@1.77.0)(terser@5.36.0)
wait-on:
specifier: ^7.2.0
version: 7.2.0
@@ -570,7 +570,7 @@ importers:
dependencies:
'@alchemy/aa-alchemy':
specifier: ^3.17.0
- version: 3.19.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@tanstack/react-query@4.36.1(react-dom@18.3.1(react@18.3.1))(react-native@0.74.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1))(@types/react@18.3.3)(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-i18next@13.5.0(i18next@23.11.5)(react-dom@18.3.1(react@18.3.1))(react-native@0.74.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1))(react-native@0.74.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(rollup@4.18.0)(typescript@5.4.5)(utf-8-validate@5.0.10)(viem@2.21.0(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@5.0.10)(zod@3.23.6))
+ version: 3.19.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@tanstack/react-query@4.36.1(react-dom@18.3.1(react@18.3.1))(react-native@0.74.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1))(@types/react@18.3.3)(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-i18next@13.5.0(i18next@23.11.5)(react-dom@18.3.1(react@18.3.1))(react-native@0.74.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1))(react-native@0.74.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(rollup@4.26.0)(typescript@5.4.5)(utf-8-validate@5.0.10)(viem@2.21.0(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@5.0.10)(zod@3.23.6))
'@alchemy/aa-core':
specifier: ^3.16.0
version: 3.19.0(typescript@5.4.5)(viem@2.21.0(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@5.0.10)(zod@3.23.6))
@@ -1710,16 +1710,16 @@ packages:
resolution: {integrity: sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA==}
engines: {node: '>=6.9.0'}
- '@babel/code-frame@7.25.7':
- resolution: {integrity: sha512-0xZJFNE5XMpENsgfHYTw8FbX4kv53mFLn2i3XPoq69LyhYSCBJtitaHx9QnsVTrsogI4Z3+HtEfZ2/GFPOtf5g==}
+ '@babel/code-frame@7.26.2':
+ resolution: {integrity: sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==}
engines: {node: '>=6.9.0'}
'@babel/compat-data@7.25.2':
resolution: {integrity: sha512-bYcppcpKBvX4znYaPEeFau03bp89ShqNMLs+rmdptMw+heSZh9+z84d2YG+K7cYLbWwzdjtDoW/uqZmPjulClQ==}
engines: {node: '>=6.9.0'}
- '@babel/compat-data@7.25.7':
- resolution: {integrity: sha512-9ickoLz+hcXCeh7jrcin+/SLWm+GkxE2kTvoYyp38p4WkdFXfQJxDFGWp/YHjiKLPx06z2A7W8XKuqbReXDzsw==}
+ '@babel/compat-data@7.26.2':
+ resolution: {integrity: sha512-Z0WgzSEa+aUcdiJuCIqgujCshpMWgUpgOxXotrYPSA53hA3qopNaqcJpyr0hVb1FeWdnqFA35/fUtXgBK8srQg==}
engines: {node: '>=6.9.0'}
'@babel/core@7.24.5':
@@ -1734,28 +1734,28 @@ packages:
resolution: {integrity: sha512-VPC82gr1seXOpkjAAKoLhP50vx4vGNlF4msF64dSFq1P8RfB+QAuJWGHPXXPc8QyfVWwwB/TNNU4+ayZmHNbZw==}
engines: {node: '>=6.9.0'}
- '@babel/generator@7.25.7':
- resolution: {integrity: sha512-5Dqpl5fyV9pIAD62yK9P7fcA768uVPUyrQmqpqstHWgMma4feF1x/oFysBCVZLY5wJ2GkMUCdsNDnGZrPoR6rA==}
+ '@babel/generator@7.26.2':
+ resolution: {integrity: sha512-zevQbhbau95nkoxSq3f/DC/SC+EEOUZd3DYqfSkMhY2/wfSeaHV1Ew4vk8e+x8lja31IbyuUa2uQ3JONqKbysw==}
engines: {node: '>=6.9.0'}
'@babel/helper-annotate-as-pure@7.24.7':
resolution: {integrity: sha512-BaDeOonYvhdKw+JoMVkAixAAJzG2jVPIwWoKBPdYuY9b452e2rPuI9QPYh3KpofZ3pW2akOmwZLOiOsHMiqRAg==}
engines: {node: '>=6.9.0'}
- '@babel/helper-annotate-as-pure@7.25.7':
- resolution: {integrity: sha512-4xwU8StnqnlIhhioZf1tqnVWeQ9pvH/ujS8hRfw/WOza+/a+1qv69BWNy+oY231maTCWgKWhfBU7kDpsds6zAA==}
+ '@babel/helper-annotate-as-pure@7.25.9':
+ resolution: {integrity: sha512-gv7320KBUFJz1RnylIg5WWYPRXKZ884AGkYpgpWW02TH66Dl+HaC1t1CKd0z3R4b6hdYEcmrNZHUmfCP+1u3/g==}
engines: {node: '>=6.9.0'}
- '@babel/helper-builder-binary-assignment-operator-visitor@7.25.7':
- resolution: {integrity: sha512-12xfNeKNH7jubQNm7PAkzlLwEmCs1tfuX3UjIw6vP6QXi+leKh6+LyC/+Ed4EIQermwd58wsyh070yjDHFlNGg==}
+ '@babel/helper-builder-binary-assignment-operator-visitor@7.25.9':
+ resolution: {integrity: sha512-C47lC7LIDCnz0h4vai/tpNOI95tCd5ZT3iBt/DBH5lXKHZsyNQv18yf1wIIg2ntiQNgmAvA+DgZ82iW8Qdym8g==}
engines: {node: '>=6.9.0'}
'@babel/helper-compilation-targets@7.25.2':
resolution: {integrity: sha512-U2U5LsSaZ7TAt3cfaymQ8WHh0pxvdHoEk6HVpaexxixjyEquMh0L0YNJNM6CTGKMXV1iksi0iZkGw4AcFkPaaw==}
engines: {node: '>=6.9.0'}
- '@babel/helper-compilation-targets@7.25.7':
- resolution: {integrity: sha512-DniTEax0sv6isaw6qSQSfV4gVRNtw2rte8HHM45t9ZR0xILaufBRNkpMifCRiAPyvL4ACD6v0gfCwCmtOQaV4A==}
+ '@babel/helper-compilation-targets@7.25.9':
+ resolution: {integrity: sha512-j9Db8Suy6yV/VHa4qzrj9yZfZxhLWQdVnRlXxmKLYlhWUVB1sB2G5sxuWYXk/whHD9iW76PmNzxZ4UCnTQTVEQ==}
engines: {node: '>=6.9.0'}
'@babel/helper-create-class-features-plugin@7.25.0':
@@ -1764,8 +1764,8 @@ packages:
peerDependencies:
'@babel/core': ^7.0.0
- '@babel/helper-create-class-features-plugin@7.25.7':
- resolution: {integrity: sha512-bD4WQhbkx80mAyj/WCm4ZHcF4rDxkoLFO6ph8/5/mQ3z4vAzltQXAmbc7GvVJx5H+lk5Mi5EmbTeox5nMGCsbw==}
+ '@babel/helper-create-class-features-plugin@7.25.9':
+ resolution: {integrity: sha512-UTZQMvt0d/rSz6KI+qdu7GQze5TIajwTS++GUozlw8VBJDEOAqSXwm1WvmYEZwqdqSGQshRocPDqrt4HBZB3fQ==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0
@@ -1776,8 +1776,8 @@ packages:
peerDependencies:
'@babel/core': ^7.0.0
- '@babel/helper-create-regexp-features-plugin@7.25.7':
- resolution: {integrity: sha512-byHhumTj/X47wJ6C6eLpK7wW/WBEcnUeb7D0FNc/jFQnQVw7DOso3Zz5u9x/zLrFVkHa89ZGDbkAa1D54NdrCQ==}
+ '@babel/helper-create-regexp-features-plugin@7.25.9':
+ resolution: {integrity: sha512-ORPNZ3h6ZRkOyAa/SaHU+XsLZr0UQzRwuDQ0cczIA17nAzZ+85G5cVkOJIj7QavLZGSe8QXUmNFxSZzjcZF9bw==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0
@@ -1787,6 +1787,11 @@ packages:
peerDependencies:
'@babel/core': ^7.4.0 || ^8.0.0-0 <8.0.0
+ '@babel/helper-define-polyfill-provider@0.6.3':
+ resolution: {integrity: sha512-HK7Bi+Hj6H+VTHA3ZvBis7V/6hu9QuTrnMXNybfUf2iiuU/N97I8VjB+KbhFF8Rld/Lx5MzoCwPCpPjfK+n8Cg==}
+ peerDependencies:
+ '@babel/core': ^7.4.0 || ^8.0.0-0 <8.0.0
+
'@babel/helper-environment-visitor@7.22.20':
resolution: {integrity: sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==}
engines: {node: '>=6.9.0'}
@@ -1795,8 +1800,8 @@ packages:
resolution: {integrity: sha512-LABppdt+Lp/RlBxqrh4qgf1oEH/WxdzQNDJIu5gC/W1GyvPVrOBiItmmM8wan2fm4oYqFuFfkXmlGpLQhPY8CA==}
engines: {node: '>=6.9.0'}
- '@babel/helper-member-expression-to-functions@7.25.7':
- resolution: {integrity: sha512-O31Ssjd5K6lPbTX9AAYpSKrZmLeagt9uwschJd+Ixo6QiRyfpvgtVQp8qrDR9UNFjZ8+DO34ZkdrN+BnPXemeA==}
+ '@babel/helper-member-expression-to-functions@7.25.9':
+ resolution: {integrity: sha512-wbfdZ9w5vk0C0oyHqAJbc62+vet5prjj01jjJ8sKn3j9h3MQQlflEdXYvuqRWjHnM12coDEqiC1IRCi0U/EKwQ==}
engines: {node: '>=6.9.0'}
'@babel/helper-module-imports@7.24.3':
@@ -1807,8 +1812,8 @@ packages:
resolution: {integrity: sha512-8AyH3C+74cgCVVXow/myrynrAGv+nTVg5vKu2nZph9x7RcRwzmh0VFallJuFTZ9mx6u4eSdXZfcOzSqTUm0HCA==}
engines: {node: '>=6.9.0'}
- '@babel/helper-module-imports@7.25.7':
- resolution: {integrity: sha512-o0xCgpNmRohmnoWKQ0Ij8IdddjyBFE4T2kagL/x6M3+4zUgc+4qTOUBoNe4XxDskt1HPKO007ZPiMgLDq2s7Kw==}
+ '@babel/helper-module-imports@7.25.9':
+ resolution: {integrity: sha512-tnUA4RsrmflIM6W6RFTLFSXITtl0wKjgpnLgXyowocVPrbYrLUXSBXDgTs8BlbmIzIdlBySRQjINYs2BAkiLtw==}
engines: {node: '>=6.9.0'}
'@babel/helper-module-transforms@7.25.2':
@@ -1817,8 +1822,8 @@ packages:
peerDependencies:
'@babel/core': ^7.0.0
- '@babel/helper-module-transforms@7.25.7':
- resolution: {integrity: sha512-k/6f8dKG3yDz/qCwSM+RKovjMix563SLxQFo0UhRNo239SP6n9u5/eLtKD6EAjwta2JHJ49CsD8pms2HdNiMMQ==}
+ '@babel/helper-module-transforms@7.26.0':
+ resolution: {integrity: sha512-xO+xu6B5K2czEnQye6BHA7DolFFmS3LB7stHZFaOLb1pAwO1HWLS8fXA+eh0A2yIvltPVmx3eNNDBJA2SLHXFw==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0
@@ -1827,16 +1832,16 @@ packages:
resolution: {integrity: sha512-jKiTsW2xmWwxT1ixIdfXUZp+P5yURx2suzLZr5Hi64rURpDYdMW0pv+Uf17EYk2Rd428Lx4tLsnjGJzYKDM/6A==}
engines: {node: '>=6.9.0'}
- '@babel/helper-optimise-call-expression@7.25.7':
- resolution: {integrity: sha512-VAwcwuYhv/AT+Vfr28c9y6SHzTan1ryqrydSTFGjU0uDJHw3uZ+PduI8plCLkRsDnqK2DMEDmwrOQRsK/Ykjng==}
+ '@babel/helper-optimise-call-expression@7.25.9':
+ resolution: {integrity: sha512-FIpuNaz5ow8VyrYcnXQTDRGvV6tTjkNtCK/RYNDXGSLlUD6cBuQTSw43CShGxjvfBTfcUA/r6UhUCbtYqkhcuQ==}
engines: {node: '>=6.9.0'}
'@babel/helper-plugin-utils@7.24.8':
resolution: {integrity: sha512-FFWx5142D8h2Mgr/iPVGH5G7w6jDn4jUSpZTyDnQO0Yn7Ks2Kuz6Pci8H6MPCoUJegd/UZQ3tAvfLCxQSnWWwg==}
engines: {node: '>=6.9.0'}
- '@babel/helper-plugin-utils@7.25.7':
- resolution: {integrity: sha512-eaPZai0PiqCi09pPs3pAFfl/zYgGaE6IdXtYvmf0qlcDTd3WCtO7JWCcRd64e0EQrcYgiHibEZnOGsSY4QSgaw==}
+ '@babel/helper-plugin-utils@7.25.9':
+ resolution: {integrity: sha512-kSMlyUVdWe25rEsRGviIgOWnoT/nfABVWlqt9N19/dIPWViAOW2s9wznP5tURbs/IDuNk4gPy3YdYRgH3uxhBw==}
engines: {node: '>=6.9.0'}
'@babel/helper-remap-async-to-generator@7.25.0':
@@ -1845,8 +1850,8 @@ packages:
peerDependencies:
'@babel/core': ^7.0.0
- '@babel/helper-remap-async-to-generator@7.25.7':
- resolution: {integrity: sha512-kRGE89hLnPfcz6fTrlNU+uhgcwv0mBE4Gv3P9Ke9kLVJYpi4AMVVEElXvB5CabrPZW4nCM8P8UyyjrzCM0O2sw==}
+ '@babel/helper-remap-async-to-generator@7.25.9':
+ resolution: {integrity: sha512-IZtukuUeBbhgOcaW2s06OXTzVNJR0ybm4W5xC1opWFFJMZbwRj5LCk+ByYH7WdZPZTt8KnFwA8pvjN2yqcPlgw==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0
@@ -1857,8 +1862,8 @@ packages:
peerDependencies:
'@babel/core': ^7.0.0
- '@babel/helper-replace-supers@7.25.7':
- resolution: {integrity: sha512-iy8JhqlUW9PtZkd4pHM96v6BdJ66Ba9yWSE4z0W4TvSZwLBPkyDsiIU3ENe4SmrzRBs76F7rQXTy1lYC49n6Lw==}
+ '@babel/helper-replace-supers@7.25.9':
+ resolution: {integrity: sha512-IiDqTOTBQy0sWyeXyGSC5TBJpGFXBkRynjBeXsvbhQFKj2viwJC76Epz35YLU1fpe/Am6Vppb7W7zM4fPQzLsQ==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0
@@ -1867,16 +1872,16 @@ packages:
resolution: {integrity: sha512-zBAIvbCMh5Ts+b86r/CjU+4XGYIs+R1j951gxI3KmmxBMhCg4oQMsv6ZXQ64XOm/cvzfU1FmoCyt6+owc5QMYg==}
engines: {node: '>=6.9.0'}
- '@babel/helper-simple-access@7.25.7':
- resolution: {integrity: sha512-FPGAkJmyoChQeM+ruBGIDyrT2tKfZJO8NcxdC+CWNJi7N8/rZpSxK7yvBJ5O/nF1gfu5KzN7VKG3YVSLFfRSxQ==}
+ '@babel/helper-simple-access@7.25.9':
+ resolution: {integrity: sha512-c6WHXuiaRsJTyHYLJV75t9IqsmTbItYfdj99PnzYGQZkYKvan5/2jKJ7gu31J3/BJ/A18grImSPModuyG/Eo0Q==}
engines: {node: '>=6.9.0'}
'@babel/helper-skip-transparent-expression-wrappers@7.24.7':
resolution: {integrity: sha512-IO+DLT3LQUElMbpzlatRASEyQtfhSE0+m465v++3jyyXeBTBUjtVZg28/gHeV5mrTJqvEKhKroBGAvhW+qPHiQ==}
engines: {node: '>=6.9.0'}
- '@babel/helper-skip-transparent-expression-wrappers@7.25.7':
- resolution: {integrity: sha512-pPbNbchZBkPMD50K0p3JGcFMNLVUCuU/ABybm/PGNj4JiHrpmNyqqCphBk4i19xXtNV0JhldQJJtbSW5aUvbyA==}
+ '@babel/helper-skip-transparent-expression-wrappers@7.25.9':
+ resolution: {integrity: sha512-K4Du3BFa3gvyhzgPcntrkDgZzQaq6uozzcpGbOO1OEJaI+EJdqWIMTLgFgQf6lrfiDFo5FU+BxKepI9RmZqahA==}
engines: {node: '>=6.9.0'}
'@babel/helper-string-parser@7.24.1':
@@ -1887,8 +1892,8 @@ packages:
resolution: {integrity: sha512-pO9KhhRcuUyGnJWwyEgnRJTSIZHiT+vMD0kPeD+so0l7mxkMT19g3pjY9GTnHySck/hDzq+dtW/4VgnMkippsQ==}
engines: {node: '>=6.9.0'}
- '@babel/helper-string-parser@7.25.7':
- resolution: {integrity: sha512-CbkjYdsJNHFk8uqpEkpCvRs3YRp9tY6FmFY7wLMSYuGYkrdUi7r2lc4/wqsvlHoMznX3WJ9IP8giGPq68T/Y6g==}
+ '@babel/helper-string-parser@7.25.9':
+ resolution: {integrity: sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==}
engines: {node: '>=6.9.0'}
'@babel/helper-validator-identifier@7.24.5':
@@ -1899,32 +1904,32 @@ packages:
resolution: {integrity: sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==}
engines: {node: '>=6.9.0'}
- '@babel/helper-validator-identifier@7.25.7':
- resolution: {integrity: sha512-AM6TzwYqGChO45oiuPqwL2t20/HdMC1rTPAesnBCgPCSF1x3oN9MVUwQV2iyz4xqWrctwK5RNC8LV22kaQCNYg==}
+ '@babel/helper-validator-identifier@7.25.9':
+ resolution: {integrity: sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==}
engines: {node: '>=6.9.0'}
'@babel/helper-validator-option@7.24.8':
resolution: {integrity: sha512-xb8t9tD1MHLungh/AIoWYN+gVHaB9kwlu8gffXGSt3FFEIT7RjS+xWbc2vUD1UTZdIpKj/ab3rdqJ7ufngyi2Q==}
engines: {node: '>=6.9.0'}
- '@babel/helper-validator-option@7.25.7':
- resolution: {integrity: sha512-ytbPLsm+GjArDYXJ8Ydr1c/KJuutjF2besPNbIZnZ6MKUxi/uTA22t2ymmA4WFjZFpjiAMO0xuuJPqK2nvDVfQ==}
+ '@babel/helper-validator-option@7.25.9':
+ resolution: {integrity: sha512-e/zv1co8pp55dNdEcCynfj9X7nyUKUXoUEwfXqaZt0omVOmDe9oOTdKStH4GmAw6zxMFs50ZayuMfHDKlO7Tfw==}
engines: {node: '>=6.9.0'}
'@babel/helper-wrap-function@7.25.0':
resolution: {integrity: sha512-s6Q1ebqutSiZnEjaofc/UKDyC4SbzV5n5SrA2Gq8UawLycr3i04f1dX4OzoQVnexm6aOCh37SQNYlJ/8Ku+PMQ==}
engines: {node: '>=6.9.0'}
- '@babel/helper-wrap-function@7.25.7':
- resolution: {integrity: sha512-MA0roW3JF2bD1ptAaJnvcabsVlNQShUaThyJbCDD4bCp8NEgiFvpoqRI2YS22hHlc2thjO/fTg2ShLMC3jygAg==}
+ '@babel/helper-wrap-function@7.25.9':
+ resolution: {integrity: sha512-ETzz9UTjQSTmw39GboatdymDq4XIQbR8ySgVrylRhPOFpsd+JrKHIuF0de7GCWmem+T4uC5z7EZguod7Wj4A4g==}
engines: {node: '>=6.9.0'}
'@babel/helpers@7.24.5':
resolution: {integrity: sha512-CiQmBMMpMQHwM5m01YnrM6imUG1ebgYJ+fAIW4FZe6m4qHTPaRHti+R8cggAwkdz4oXhtO4/K9JWlh+8hIfR2Q==}
engines: {node: '>=6.9.0'}
- '@babel/helpers@7.25.7':
- resolution: {integrity: sha512-Sv6pASx7Esm38KQpF/U/OXLwPPrdGHNKoeblRxgZRLXnAtnkEe4ptJPDtAZM7fBLadbc1Q07kQpSiGQ0Jg6tRA==}
+ '@babel/helpers@7.26.0':
+ resolution: {integrity: sha512-tbhNuIxNcVb21pInl3ZSjksLCvgdZy9KwJ8brv993QtIVKJBBkYXz4q4ZbAv31GdnC+R90np23L5FbEBlthAEw==}
engines: {node: '>=6.9.0'}
'@babel/highlight@7.24.5':
@@ -1935,10 +1940,6 @@ packages:
resolution: {integrity: sha512-EStJpq4OuY8xYfhGVXngigBJRWxftKX9ksiGDnmlY3o7B/V7KIAc9X4oiK87uPJSc/vs5L869bem5fhZa8caZw==}
engines: {node: '>=6.9.0'}
- '@babel/highlight@7.25.7':
- resolution: {integrity: sha512-iYyACpW3iW8Fw+ZybQK+drQre+ns/tKpXbNESfrhNnPLIklLbXr7MYJ6gPEd0iETGLOK+SxMjVvKb/ffmk+FEw==}
- engines: {node: '>=6.9.0'}
-
'@babel/parser@7.24.5':
resolution: {integrity: sha512-EOv5IK8arwh3LI47dz1b0tKUb/1uhHAnHJOrjgtQMIpu1uXd9mlFrJg9IUgGUgZ41Ch0K8REPTYpO7B76b4vJg==}
engines: {node: '>=6.0.0'}
@@ -1954,37 +1955,37 @@ packages:
engines: {node: '>=6.0.0'}
hasBin: true
- '@babel/parser@7.25.7':
- resolution: {integrity: sha512-aZn7ETtQsjjGG5HruveUK06cU3Hljuhd9Iojm4M8WWv3wLE6OkE5PWbDUkItmMgegmccaITudyuW5RPYrYlgWw==}
+ '@babel/parser@7.26.2':
+ resolution: {integrity: sha512-DWMCZH9WA4Maitz2q21SRKHo9QXZxkDsbNZoVD62gusNtNBBqDg9i7uOhASfTfIGNzW+O+r7+jAlM8dwphcJKQ==}
engines: {node: '>=6.0.0'}
hasBin: true
- '@babel/plugin-bugfix-firefox-class-in-computed-class-key@7.25.7':
- resolution: {integrity: sha512-UV9Lg53zyebzD1DwQoT9mzkEKa922LNUp5YkTJ6Uta0RbyXaQNUgcvSt7qIu1PpPzVb6rd10OVNTzkyBGeVmxQ==}
+ '@babel/plugin-bugfix-firefox-class-in-computed-class-key@7.25.9':
+ resolution: {integrity: sha512-ZkRyVkThtxQ/J6nv3JFYv1RYY+JT5BvU0y3k5bWrmuG4woXypRa4PXmm9RhOwodRkYFWqC0C0cqcJ4OqR7kW+g==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0
- '@babel/plugin-bugfix-safari-class-field-initializer-scope@7.25.7':
- resolution: {integrity: sha512-GDDWeVLNxRIkQTnJn2pDOM1pkCgYdSqPeT1a9vh9yIqu2uzzgw1zcqEb+IJOhy+dTBMlNdThrDIksr2o09qrrQ==}
+ '@babel/plugin-bugfix-safari-class-field-initializer-scope@7.25.9':
+ resolution: {integrity: sha512-MrGRLZxLD/Zjj0gdU15dfs+HH/OXvnw/U4jJD8vpcP2CJQapPEv1IWwjc/qMg7ItBlPwSv1hRBbb7LeuANdcnw==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0
- '@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@7.25.7':
- resolution: {integrity: sha512-wxyWg2RYaSUYgmd9MR0FyRGyeOMQE/Uzr1wzd/g5cf5bwi9A4v6HFdDm7y1MgDtod/fLOSTZY6jDgV0xU9d5bA==}
+ '@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@7.25.9':
+ resolution: {integrity: sha512-2qUwwfAFpJLZqxd02YW9btUCZHl+RFvdDkNfZwaIJrvB8Tesjsk8pEQkTvGwZXLqXUx/2oyY3ySRhm6HOXuCug==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0
- '@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@7.25.7':
- resolution: {integrity: sha512-Xwg6tZpLxc4iQjorYsyGMyfJE7nP5MV8t/Ka58BgiA7Jw0fRqQNcANlLfdJ/yvBt9z9LD2We+BEkT7vLqZRWng==}
+ '@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@7.25.9':
+ resolution: {integrity: sha512-6xWgLZTJXwilVjlnV7ospI3xi+sl8lN8rXXbBD6vYn3UYDlGsag8wrZkKcSI8G6KgqKP7vNFaDgeDnfAABq61g==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.13.0
- '@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly@7.25.7':
- resolution: {integrity: sha512-UVATLMidXrnH+GMUIuxq55nejlj02HP7F5ETyBONzP6G87fPBogG4CH6kxrSrdIuAjdwNO9VzyaYsrZPscWUrw==}
+ '@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly@7.25.9':
+ resolution: {integrity: sha512-aLnMXYPnzwwqhYSCyXfKkIkYgJ8zv9RK+roo9DkTXz38ynIhd9XCbN08s3MGvqL2MYGVUGdRQLL/JqBIeJhJBg==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0
@@ -2009,8 +2010,8 @@ packages:
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-proposal-export-default-from@7.25.7':
- resolution: {integrity: sha512-Egdiuy7pLTyaPkIr6rItNyFVbblTmx3VgqY+72KiS9BzcA+SMyrS9zSumQeSANo8uE3Kax0ZUMkpNh0Q+mbNwg==}
+ '@babel/plugin-proposal-export-default-from@7.25.9':
+ resolution: {integrity: sha512-ykqgwNfSnNOB+C8fV5X4mG3AVmvu+WVxcaU9xHHtBb7PCrPeweMmPjGsn8eMaeJg6SJuoUuZENeeSWaarWqonQ==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
@@ -2090,8 +2091,8 @@ packages:
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-syntax-export-default-from@7.25.7':
- resolution: {integrity: sha512-LRUCsC0YucSjabsmxx6yly8+Q/5mxKdp9gemlpR9ro3bfpcOQOXx/CHivs7QCbjgygd6uQ2GcRfHu1FVax/hgg==}
+ '@babel/plugin-syntax-export-default-from@7.25.9':
+ resolution: {integrity: sha512-9MhJ/SMTsVqsd69GyQg89lYR4o9T+oDGv5F6IsigxxqFVOyR/IflDLYP8WDI1l8fkhNGGktqkvL5qwNCtGEpgQ==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
@@ -2107,20 +2108,20 @@ packages:
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-syntax-flow@7.25.7':
- resolution: {integrity: sha512-fyoj6/YdVtlv2ROig/J0fP7hh/wNO1MJGm1NR70Pg7jbkF+jOUL9joorqaCOQh06Y+LfgTagHzC8KqZ3MF782w==}
+ '@babel/plugin-syntax-flow@7.26.0':
+ resolution: {integrity: sha512-B+O2DnPc0iG+YXFqOxv2WNuNU97ToWjOomUQ78DouOENWUaM5sVrmet9mcomUGQFwpJd//gvUagXBSdzO1fRKg==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-syntax-import-assertions@7.25.7':
- resolution: {integrity: sha512-ZvZQRmME0zfJnDQnVBKYzHxXT7lYBB3Revz1GuS7oLXWMgqUPX4G+DDbT30ICClht9WKV34QVrZhSw6WdklwZQ==}
+ '@babel/plugin-syntax-import-assertions@7.26.0':
+ resolution: {integrity: sha512-QCWT5Hh830hK5EQa7XzuqIkQU9tT/whqbDz7kuaZMHFl1inRRg7JnuAEOQ0Ur0QUl0NufCk1msK2BeY79Aj/eg==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-syntax-import-attributes@7.25.7':
- resolution: {integrity: sha512-AqVo+dguCgmpi/3mYBdu9lkngOBlQ2w2vnNpa6gfiCxQZLzV4ZbhsXitJ2Yblkoe1VQwtHSaNmIaGll/26YWRw==}
+ '@babel/plugin-syntax-import-attributes@7.26.0':
+ resolution: {integrity: sha512-e2dttdsJ1ZTpi3B9UYGLw41hifAubg19AtCu/2I/F1QNVclOBr1dYpTdmdyZ84Xiz43BS/tCUkMAZNLv12Pi+A==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
@@ -2141,8 +2142,8 @@ packages:
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-syntax-jsx@7.25.7':
- resolution: {integrity: sha512-ruZOnKO+ajVL/MVx+PwNBPOkrnXTXoWMtte1MBpegfCArhqOe3Bj52avVj1huLLxNKYKXYaSxZ2F+woK1ekXfw==}
+ '@babel/plugin-syntax-jsx@7.25.9':
+ resolution: {integrity: sha512-ld6oezHQMZsZfp6pWtbjaNDF2tiiCYYDqQszHt5VV437lewP9aSi2Of99CK0D0XB21k7FLgnLcmQKyKzynfeAA==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
@@ -2195,8 +2196,8 @@ packages:
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-syntax-typescript@7.25.7':
- resolution: {integrity: sha512-rR+5FDjpCHqqZN2bzZm18bVYGaejGq5ZkpVCJLXor/+zlSrSoc4KWcHI0URVWjl/68Dyr1uwZUz/1njycEAv9g==}
+ '@babel/plugin-syntax-typescript@7.25.9':
+ resolution: {integrity: sha512-hjMgRy5hb8uJJjUcdWunWVcoi9bGpJp8p5Ol1229PoN6aytsLwNMgmdftO23wnCLMfVmTwZDWMPNq/D1SY60JQ==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
@@ -2213,14 +2214,14 @@ packages:
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-arrow-functions@7.25.7':
- resolution: {integrity: sha512-EJN2mKxDwfOUCPxMO6MUI58RN3ganiRAG/MS/S3HfB6QFNjroAMelQo/gybyYq97WerCBAZoyrAoW8Tzdq2jWg==}
+ '@babel/plugin-transform-arrow-functions@7.25.9':
+ resolution: {integrity: sha512-6jmooXYIwn9ca5/RylZADJ+EnSxVUS5sjeJ9UPk6RWRzXCmOJCy6dqItPJFpw2cuCangPK4OYr5uhGKcmrm5Qg==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-async-generator-functions@7.25.7':
- resolution: {integrity: sha512-4B6OhTrwYKHYYgcwErvZjbmH9X5TxQBsaBHdzEIB4l71gR5jh/tuHGlb9in47udL2+wVUcOz5XXhhfhVJwEpEg==}
+ '@babel/plugin-transform-async-generator-functions@7.25.9':
+ resolution: {integrity: sha512-RXV6QAzTBbhDMO9fWwOmwwTuYaiPbggWQ9INdZqAYeSHyG7FzQ+nOZaUUjNwKv9pV3aE4WFqFm1Hnbci5tBCAw==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
@@ -2231,14 +2232,14 @@ packages:
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-async-to-generator@7.25.7':
- resolution: {integrity: sha512-ZUCjAavsh5CESCmi/xCpX1qcCaAglzs/7tmuvoFnJgA1dM7gQplsguljoTg+Ru8WENpX89cQyAtWoaE0I3X3Pg==}
+ '@babel/plugin-transform-async-to-generator@7.25.9':
+ resolution: {integrity: sha512-NT7Ejn7Z/LjUH0Gv5KsBCxh7BH3fbLTV0ptHvpeMvrt3cPThHfJfst9Wrb7S8EvJ7vRTFI7z+VAvFVEQn/m5zQ==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-block-scoped-functions@7.25.7':
- resolution: {integrity: sha512-xHttvIM9fvqW+0a3tZlYcZYSBpSWzGBFIt/sYG3tcdSzBB8ZeVgz2gBP7Df+sM0N1850jrviYSSeUuc+135dmQ==}
+ '@babel/plugin-transform-block-scoped-functions@7.25.9':
+ resolution: {integrity: sha512-toHc9fzab0ZfenFpsyYinOX0J/5dgJVA2fm64xPewu7CoYHWEivIWKxkK2rMi4r3yQqLnVmheMXRdG+k239CgA==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
@@ -2249,20 +2250,20 @@ packages:
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-block-scoping@7.25.7':
- resolution: {integrity: sha512-ZEPJSkVZaeTFG/m2PARwLZQ+OG0vFIhPlKHK/JdIMy8DbRJ/htz6LRrTFtdzxi9EHmcwbNPAKDnadpNSIW+Aow==}
+ '@babel/plugin-transform-block-scoping@7.25.9':
+ resolution: {integrity: sha512-1F05O7AYjymAtqbsFETboN1NvBdcnzMerO+zlMyJBEz6WkMdejvGWw9p05iTSjC85RLlBseHHQpYaM4gzJkBGg==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-class-properties@7.25.7':
- resolution: {integrity: sha512-mhyfEW4gufjIqYFo9krXHJ3ElbFLIze5IDp+wQTxoPd+mwFb1NxatNAwmv8Q8Iuxv7Zc+q8EkiMQwc9IhyGf4g==}
+ '@babel/plugin-transform-class-properties@7.25.9':
+ resolution: {integrity: sha512-bbMAII8GRSkcd0h0b4X+36GksxuheLFjP65ul9w6C3KgAamI3JqErNgSrosX6ZPj+Mpim5VvEbawXxJCyEUV3Q==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-class-static-block@7.25.7':
- resolution: {integrity: sha512-rvUUtoVlkDWtDWxGAiiQj0aNktTPn3eFynBcMC2IhsXweehwgdI9ODe+XjWw515kEmv22sSOTp/rxIRuTiB7zg==}
+ '@babel/plugin-transform-class-static-block@7.26.0':
+ resolution: {integrity: sha512-6J2APTs7BDDm+UMqP1useWqhcRAXo0WIoVj26N7kPFB6S73Lgvyka4KTZYIxtgYXiN5HTyRObA72N2iu628iTQ==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.12.0
@@ -2273,8 +2274,8 @@ packages:
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-classes@7.25.7':
- resolution: {integrity: sha512-9j9rnl+YCQY0IGoeipXvnk3niWicIB6kCsWRGLwX241qSXpbA4MKxtp/EdvFxsc4zI5vqfLxzOd0twIJ7I99zg==}
+ '@babel/plugin-transform-classes@7.25.9':
+ resolution: {integrity: sha512-mD8APIXmseE7oZvZgGABDyM34GUmK45Um2TXiBUt7PnuAxrgoSVf123qUzPxEr/+/BHrRn5NMZCdE2m/1F8DGg==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
@@ -2285,8 +2286,8 @@ packages:
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-computed-properties@7.25.7':
- resolution: {integrity: sha512-QIv+imtM+EtNxg/XBKL3hiWjgdLjMOmZ+XzQwSgmBfKbfxUjBzGgVPklUuE55eq5/uVoh8gg3dqlrwR/jw3ZeA==}
+ '@babel/plugin-transform-computed-properties@7.25.9':
+ resolution: {integrity: sha512-HnBegGqXZR12xbcTHlJ9HGxw1OniltT26J5YpfruGqtUHlz/xKf/G2ak9e+t0rVqrjXa9WOhvYPz1ERfMj23AA==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
@@ -2297,44 +2298,44 @@ packages:
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-destructuring@7.25.7':
- resolution: {integrity: sha512-xKcfLTlJYUczdaM1+epcdh1UGewJqr9zATgrNHcLBcV2QmfvPPEixo/sK/syql9cEmbr7ulu5HMFG5vbbt/sEA==}
+ '@babel/plugin-transform-destructuring@7.25.9':
+ resolution: {integrity: sha512-WkCGb/3ZxXepmMiX101nnGiU+1CAdut8oHyEOHxkKuS1qKpU2SMXE2uSvfz8PBuLd49V6LEsbtyPhWC7fnkgvQ==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-dotall-regex@7.25.7':
- resolution: {integrity: sha512-kXzXMMRzAtJdDEgQBLF4oaiT6ZCU3oWHgpARnTKDAqPkDJ+bs3NrZb310YYevR5QlRo3Kn7dzzIdHbZm1VzJdQ==}
+ '@babel/plugin-transform-dotall-regex@7.25.9':
+ resolution: {integrity: sha512-t7ZQ7g5trIgSRYhI9pIJtRl64KHotutUJsh4Eze5l7olJv+mRSg4/MmbZ0tv1eeqRbdvo/+trvJD/Oc5DmW2cA==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-duplicate-keys@7.25.7':
- resolution: {integrity: sha512-by+v2CjoL3aMnWDOyCIg+yxU9KXSRa9tN6MbqggH5xvymmr9p4AMjYkNlQy4brMceBnUyHZ9G8RnpvT8wP7Cfg==}
+ '@babel/plugin-transform-duplicate-keys@7.25.9':
+ resolution: {integrity: sha512-LZxhJ6dvBb/f3x8xwWIuyiAHy56nrRG3PeYTpBkkzkYRRQ6tJLu68lEF5VIqMUZiAV7a8+Tb78nEoMCMcqjXBw==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-duplicate-named-capturing-groups-regex@7.25.7':
- resolution: {integrity: sha512-HvS6JF66xSS5rNKXLqkk7L9c/jZ/cdIVIcoPVrnl8IsVpLggTjXs8OWekbLHs/VtYDDh5WXnQyeE3PPUGm22MA==}
+ '@babel/plugin-transform-duplicate-named-capturing-groups-regex@7.25.9':
+ resolution: {integrity: sha512-0UfuJS0EsXbRvKnwcLjFtJy/Sxc5J5jhLHnFhy7u4zih97Hz6tJkLU+O+FMMrNZrosUPxDi6sYxJ/EA8jDiAog==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0
- '@babel/plugin-transform-dynamic-import@7.25.7':
- resolution: {integrity: sha512-UvcLuual4h7/GfylKm2IAA3aph9rwvAM2XBA0uPKU3lca+Maai4jBjjEVUS568ld6kJcgbouuumCBhMd/Yz17w==}
+ '@babel/plugin-transform-dynamic-import@7.25.9':
+ resolution: {integrity: sha512-GCggjexbmSLaFhqsojeugBpeaRIgWNTcgKVq/0qIteFEqY2A+b9QidYadrWlnbWQUrW5fn+mCvf3tr7OeBFTyg==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-exponentiation-operator@7.25.7':
- resolution: {integrity: sha512-yjqtpstPfZ0h/y40fAXRv2snciYr0OAoMXY/0ClC7tm4C/nG5NJKmIItlaYlLbIVAWNfrYuy9dq1bE0SbX0PEg==}
+ '@babel/plugin-transform-exponentiation-operator@7.25.9':
+ resolution: {integrity: sha512-KRhdhlVk2nObA5AYa7QMgTMTVJdfHprfpAk4DjZVtllqRg9qarilstTKEhpVjyt+Npi8ThRyiV8176Am3CodPA==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-export-namespace-from@7.25.7':
- resolution: {integrity: sha512-h3MDAP5l34NQkkNulsTNyjdaR+OiB0Im67VU//sFupouP8Q6m9Spy7l66DcaAQxtmCqGdanPByLsnwFttxKISQ==}
+ '@babel/plugin-transform-export-namespace-from@7.25.9':
+ resolution: {integrity: sha512-2NsEz+CxzJIVOPx2o9UsW1rXLqtChtLoVnwYHHiB04wS5sgn7mrV45fWMBX0Kk+ub9uXytVYfNP2HjbVbCB3Ww==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
@@ -2345,14 +2346,14 @@ packages:
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-flow-strip-types@7.25.7':
- resolution: {integrity: sha512-q8Td2PPc6/6I73g96SreSUCKEcwMXCwcXSIAVTyTTN6CpJe0dMj8coxu1fg1T9vfBLi6Rsi6a4ECcFBbKabS5w==}
+ '@babel/plugin-transform-flow-strip-types@7.25.9':
+ resolution: {integrity: sha512-/VVukELzPDdci7UUsWQaSkhgnjIWXnIyRpM02ldxaVoFK96c41So8JcKT3m0gYjyv7j5FNPGS5vfELrWalkbDA==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-for-of@7.25.7':
- resolution: {integrity: sha512-n/TaiBGJxYFWvpJDfsxSj9lEEE44BFM1EPGz4KEiTipTgkoFVVcCmzAL3qA7fdQU96dpo4gGf5HBx/KnDvqiHw==}
+ '@babel/plugin-transform-for-of@7.25.9':
+ resolution: {integrity: sha512-LqHxduHoaGELJl2uhImHwRQudhCM50pT46rIBNvtT/Oql3nqiS3wOwP+5ten7NpYSXrrVLgtZU3DZmPtWZo16A==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
@@ -2363,14 +2364,14 @@ packages:
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-function-name@7.25.7':
- resolution: {integrity: sha512-5MCTNcjCMxQ63Tdu9rxyN6cAWurqfrDZ76qvVPrGYdBxIj+EawuuxTu/+dgJlhK5eRz3v1gLwp6XwS8XaX2NiQ==}
+ '@babel/plugin-transform-function-name@7.25.9':
+ resolution: {integrity: sha512-8lP+Yxjv14Vc5MuWBpJsoUCd3hD6V9DgBon2FVYL4jJgbnVQ9fTgYmonchzZJOVNgzEgbxp4OwAf6xz6M/14XA==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-json-strings@7.25.7':
- resolution: {integrity: sha512-Ot43PrL9TEAiCe8C/2erAjXMeVSnE/BLEx6eyrKLNFCCw5jvhTHKyHxdI1pA0kz5njZRYAnMO2KObGqOCRDYSA==}
+ '@babel/plugin-transform-json-strings@7.25.9':
+ resolution: {integrity: sha512-xoTMk0WXceiiIvsaquQQUaLLXSW1KJ159KP87VilruQm0LNNGxWzahxSS6T6i4Zg3ezp4vA4zuwiNUR53qmQAw==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
@@ -2381,26 +2382,26 @@ packages:
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-literals@7.25.7':
- resolution: {integrity: sha512-fwzkLrSu2fESR/cm4t6vqd7ebNIopz2QHGtjoU+dswQo/P6lwAG04Q98lliE3jkz/XqnbGFLnUcE0q0CVUf92w==}
+ '@babel/plugin-transform-literals@7.25.9':
+ resolution: {integrity: sha512-9N7+2lFziW8W9pBl2TzaNht3+pgMIRP74zizeCSrtnSKVdUl8mAjjOP2OOVQAfZ881P2cNjDj1uAMEdeD50nuQ==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-logical-assignment-operators@7.25.7':
- resolution: {integrity: sha512-iImzbA55BjiovLyG2bggWS+V+OLkaBorNvc/yJoeeDQGztknRnDdYfp2d/UPmunZYEnZi6Lg8QcTmNMHOB0lGA==}
+ '@babel/plugin-transform-logical-assignment-operators@7.25.9':
+ resolution: {integrity: sha512-wI4wRAzGko551Y8eVf6iOY9EouIDTtPb0ByZx+ktDGHwv6bHFimrgJM/2T021txPZ2s4c7bqvHbd+vXG6K948Q==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-member-expression-literals@7.25.7':
- resolution: {integrity: sha512-Std3kXwpXfRV0QtQy5JJcRpkqP8/wG4XL7hSKZmGlxPlDqmpXtEPRmhF7ztnlTCtUN3eXRUJp+sBEZjaIBVYaw==}
+ '@babel/plugin-transform-member-expression-literals@7.25.9':
+ resolution: {integrity: sha512-PYazBVfofCQkkMzh2P6IdIUaCEWni3iYEerAsRWuVd8+jlM1S9S9cz1dF9hIzyoZ8IA3+OwVYIp9v9e+GbgZhA==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-modules-amd@7.25.7':
- resolution: {integrity: sha512-CgselSGCGzjQvKzghCvDTxKHP3iooenLpJDO842ehn5D2G5fJB222ptnDwQho0WjEvg7zyoxb9P+wiYxiJX5yA==}
+ '@babel/plugin-transform-modules-amd@7.25.9':
+ resolution: {integrity: sha512-g5T11tnI36jVClQlMlt4qKDLlWnG5pP9CSM4GhdRciTNMRgkfpo5cR6b4rGIOYPgRRuFAvwjPQ/Yk+ql4dyhbw==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
@@ -2411,20 +2412,20 @@ packages:
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-modules-commonjs@7.25.7':
- resolution: {integrity: sha512-L9Gcahi0kKFYXvweO6n0wc3ZG1ChpSFdgG+eV1WYZ3/dGbJK7vvk91FgGgak8YwRgrCuihF8tE/Xg07EkL5COg==}
+ '@babel/plugin-transform-modules-commonjs@7.25.9':
+ resolution: {integrity: sha512-dwh2Ol1jWwL2MgkCzUSOvfmKElqQcuswAZypBSUsScMXvgdT8Ekq5YA6TtqpTVWH+4903NmboMuH1o9i8Rxlyg==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-modules-systemjs@7.25.7':
- resolution: {integrity: sha512-t9jZIvBmOXJsiuyOwhrIGs8dVcD6jDyg2icw1VL4A/g+FnWyJKwUfSSU2nwJuMV2Zqui856El9u+ElB+j9fV1g==}
+ '@babel/plugin-transform-modules-systemjs@7.25.9':
+ resolution: {integrity: sha512-hyss7iIlH/zLHaehT+xwiymtPOpsiwIIRlCAOwBB04ta5Tt+lNItADdlXw3jAWZ96VJ2jlhl/c+PNIQPKNfvcA==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-modules-umd@7.25.7':
- resolution: {integrity: sha512-p88Jg6QqsaPh+EB7I9GJrIqi1Zt4ZBHUQtjw3z1bzEXcLh6GfPqzZJ6G+G1HBGKUNukT58MnKG7EN7zXQBCODw==}
+ '@babel/plugin-transform-modules-umd@7.25.9':
+ resolution: {integrity: sha512-bS9MVObUgE7ww36HEfwe6g9WakQ0KF07mQF74uuXdkoziUPfKyu/nIm663kz//e5O1nPInPFx36z7WJmJ4yNEw==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
@@ -2435,50 +2436,50 @@ packages:
peerDependencies:
'@babel/core': ^7.0.0
- '@babel/plugin-transform-named-capturing-groups-regex@7.25.7':
- resolution: {integrity: sha512-BtAT9LzCISKG3Dsdw5uso4oV1+v2NlVXIIomKJgQybotJY3OwCwJmkongjHgwGKoZXd0qG5UZ12JUlDQ07W6Ow==}
+ '@babel/plugin-transform-named-capturing-groups-regex@7.25.9':
+ resolution: {integrity: sha512-oqB6WHdKTGl3q/ItQhpLSnWWOpjUJLsOCLVyeFgeTktkBSCiurvPOsyt93gibI9CmuKvTUEtWmG5VhZD+5T/KA==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0
- '@babel/plugin-transform-new-target@7.25.7':
- resolution: {integrity: sha512-CfCS2jDsbcZaVYxRFo2qtavW8SpdzmBXC2LOI4oO0rP+JSRDxxF3inF4GcPsLgfb5FjkhXG5/yR/lxuRs2pySA==}
+ '@babel/plugin-transform-new-target@7.25.9':
+ resolution: {integrity: sha512-U/3p8X1yCSoKyUj2eOBIx3FOn6pElFOKvAAGf8HTtItuPyB+ZeOqfn+mvTtg9ZlOAjsPdK3ayQEjqHjU/yLeVQ==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-nullish-coalescing-operator@7.25.7':
- resolution: {integrity: sha512-FbuJ63/4LEL32mIxrxwYaqjJxpbzxPVQj5a+Ebrc8JICV6YX8nE53jY+K0RZT3um56GoNWgkS2BQ/uLGTjtwfw==}
+ '@babel/plugin-transform-nullish-coalescing-operator@7.25.9':
+ resolution: {integrity: sha512-ENfftpLZw5EItALAD4WsY/KUWvhUlZndm5GC7G3evUsVeSJB6p0pBeLQUnRnBCBx7zV0RKQjR9kCuwrsIrjWog==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-numeric-separator@7.25.7':
- resolution: {integrity: sha512-8CbutzSSh4hmD+jJHIA8vdTNk15kAzOnFLVVgBSMGr28rt85ouT01/rezMecks9pkU939wDInImwCKv4ahU4IA==}
+ '@babel/plugin-transform-numeric-separator@7.25.9':
+ resolution: {integrity: sha512-TlprrJ1GBZ3r6s96Yq8gEQv82s8/5HnCVHtEJScUj90thHQbwe+E5MLhi2bbNHBEJuzrvltXSru+BUxHDoog7Q==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-object-rest-spread@7.25.7':
- resolution: {integrity: sha512-1JdVKPhD7Y5PvgfFy0Mv2brdrolzpzSoUq2pr6xsR+m+3viGGeHEokFKsCgOkbeFOQxfB1Vt2F0cPJLRpFI4Zg==}
+ '@babel/plugin-transform-object-rest-spread@7.25.9':
+ resolution: {integrity: sha512-fSaXafEE9CVHPweLYw4J0emp1t8zYTXyzN3UuG+lylqkvYd7RMrsOQ8TYx5RF231be0vqtFC6jnx3UmpJmKBYg==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-object-super@7.25.7':
- resolution: {integrity: sha512-pWT6UXCEW3u1t2tcAGtE15ornCBvopHj9Bps9D2DsH15APgNVOTwwczGckX+WkAvBmuoYKRCFa4DK+jM8vh5AA==}
+ '@babel/plugin-transform-object-super@7.25.9':
+ resolution: {integrity: sha512-Kj/Gh+Rw2RNLbCK1VAWj2U48yxxqL2x0k10nPtSdRa0O2xnHXalD0s+o1A6a0W43gJ00ANo38jxkQreckOzv5A==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-optional-catch-binding@7.25.7':
- resolution: {integrity: sha512-m9obYBA39mDPN7lJzD5WkGGb0GO54PPLXsbcnj1Hyeu8mSRz7Gb4b1A6zxNX32ZuUySDK4G6it8SDFWD1nCnqg==}
+ '@babel/plugin-transform-optional-catch-binding@7.25.9':
+ resolution: {integrity: sha512-qM/6m6hQZzDcZF3onzIhZeDHDO43bkNNlOX0i8n3lR6zLbu0GN2d8qfM/IERJZYauhAHSLHy39NF0Ctdvcid7g==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-optional-chaining@7.25.7':
- resolution: {integrity: sha512-h39agClImgPWg4H8mYVAbD1qP9vClFbEjqoJmt87Zen8pjqK8FTPUwrOXAvqu5soytwxrLMd2fx2KSCp2CHcNg==}
+ '@babel/plugin-transform-optional-chaining@7.25.9':
+ resolution: {integrity: sha512-6AvV0FsLULbpnXeBjrY4dmWF8F7gf8QnvTEoO/wX/5xm/xE1Xo8oPuD3MPS+KS9f9XBEAWN7X1aWr4z9HdOr7A==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
@@ -2489,8 +2490,8 @@ packages:
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-parameters@7.25.7':
- resolution: {integrity: sha512-FYiTvku63me9+1Nz7TOx4YMtW3tWXzfANZtrzHhUZrz4d47EEtMQhzFoZWESfXuAMMT5mwzD4+y1N8ONAX6lMQ==}
+ '@babel/plugin-transform-parameters@7.25.9':
+ resolution: {integrity: sha512-wzz6MKwpnshBAiRmn4jR8LYz/g8Ksg0o80XmwZDlordjwEk9SxBzTWC7F5ef1jhbrbOW2DJ5J6ayRukrJmnr0g==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
@@ -2501,8 +2502,8 @@ packages:
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-private-methods@7.25.7':
- resolution: {integrity: sha512-KY0hh2FluNxMLwOCHbxVOKfdB5sjWG4M183885FmaqWWiGMhRZq4DQRKH6mHdEucbJnyDyYiZNwNG424RymJjA==}
+ '@babel/plugin-transform-private-methods@7.25.9':
+ resolution: {integrity: sha512-D/JUozNpQLAPUVusvqMxyvjzllRaF8/nSrP1s2YGQT/W4LHK4xxsMcHjhOGTS01mp9Hda8nswb+FblLdJornQw==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
@@ -2513,14 +2514,14 @@ packages:
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-private-property-in-object@7.25.7':
- resolution: {integrity: sha512-LzA5ESzBy7tqj00Yjey9yWfs3FKy4EmJyKOSWld144OxkTji81WWnUT8nkLUn+imN/zHL8ZQlOu/MTUAhHaX3g==}
+ '@babel/plugin-transform-private-property-in-object@7.25.9':
+ resolution: {integrity: sha512-Evf3kcMqzXA3xfYJmZ9Pg1OvKdtqsDMSWBDzZOPLvHiTt36E75jLDQo5w1gtRU95Q4E5PDttrTf25Fw8d/uWLw==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-property-literals@7.25.7':
- resolution: {integrity: sha512-lQEeetGKfFi0wHbt8ClQrUSUMfEeI3MMm74Z73T9/kuz990yYVtfofjf3NuA42Jy3auFOpbjDyCSiIkTs1VIYw==}
+ '@babel/plugin-transform-property-literals@7.25.9':
+ resolution: {integrity: sha512-IvIUeV5KrS/VPavfSM/Iu+RE6llrHrYIKY1yfCzyO/lMXHQ+p7uGhonmGVisv6tSBSVgWzMBohTcvkC9vQcQFA==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
@@ -2531,8 +2532,8 @@ packages:
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-react-display-name@7.25.7':
- resolution: {integrity: sha512-r0QY7NVU8OnrwE+w2IWiRom0wwsTbjx4+xH2RTd7AVdof3uurXOF+/mXHQDRk+2jIvWgSaCHKMgggfvM4dyUGA==}
+ '@babel/plugin-transform-react-display-name@7.25.9':
+ resolution: {integrity: sha512-KJfMlYIUxQB1CJfO3e0+h0ZHWOTLCPP115Awhaz8U0Zpq36Gl/cXlpoyMRnUWlhNUBAzldnCiAZNvCDj7CrKxQ==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
@@ -2543,8 +2544,8 @@ packages:
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-react-jsx-self@7.25.7':
- resolution: {integrity: sha512-JD9MUnLbPL0WdVK8AWC7F7tTG2OS6u/AKKnsK+NdRhUiVdnzyR1S3kKQCaRLOiaULvUiqK6Z4JQE635VgtCFeg==}
+ '@babel/plugin-transform-react-jsx-self@7.25.9':
+ resolution: {integrity: sha512-y8quW6p0WHkEhmErnfe58r7x0A70uKphQm8Sp8cV7tjNQwK56sNVK0M73LK3WuYmsuyrftut4xAkjjgU0twaMg==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
@@ -2555,8 +2556,8 @@ packages:
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-react-jsx-source@7.25.7':
- resolution: {integrity: sha512-S/JXG/KrbIY06iyJPKfxr0qRxnhNOdkNXYBl/rmwgDd72cQLH9tEGkDm/yJPGvcSIUoikzfjMios9i+xT/uv9w==}
+ '@babel/plugin-transform-react-jsx-source@7.25.9':
+ resolution: {integrity: sha512-+iqjT8xmXhhYv4/uiYd8FNQsraMFZIfxVSqxxVSZP0WbbSAWvBXAul0m/zu+7Vv4O/3WtApy9pmaTMiumEZgfg==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
@@ -2567,20 +2568,20 @@ packages:
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-react-jsx@7.25.7':
- resolution: {integrity: sha512-vILAg5nwGlR9EXE8JIOX4NHXd49lrYbN8hnjffDtoULwpL9hUx/N55nqh2qd0q6FyNDfjl9V79ecKGvFbcSA0Q==}
+ '@babel/plugin-transform-react-jsx@7.25.9':
+ resolution: {integrity: sha512-s5XwpQYCqGerXl+Pu6VDL3x0j2d82eiV77UJ8a2mDHAW7j9SWRqQ2y1fNo1Z74CdcYipl5Z41zvjj4Nfzq36rw==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-regenerator@7.25.7':
- resolution: {integrity: sha512-mgDoQCRjrY3XK95UuV60tZlFCQGXEtMg8H+IsW72ldw1ih1jZhzYXbJvghmAEpg5UVhhnCeia1CkGttUvCkiMQ==}
+ '@babel/plugin-transform-regenerator@7.25.9':
+ resolution: {integrity: sha512-vwDcDNsgMPDGP0nMqzahDWE5/MLcX8sv96+wfX7as7LoF/kr97Bo/7fI00lXY4wUXYfVmwIIyG80fGZ1uvt2qg==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-reserved-words@7.25.7':
- resolution: {integrity: sha512-3OfyfRRqiGeOvIWSagcwUTVk2hXBsr/ww7bLn6TRTuXnexA+Udov2icFOxFX9abaj4l96ooYkcNN1qi2Zvqwng==}
+ '@babel/plugin-transform-reserved-words@7.25.9':
+ resolution: {integrity: sha512-7DL7DKYjn5Su++4RXu8puKZm2XBPHyjWLUidaPEkCUBbE7IPcsrkRHggAOOKydH1dASWdcUBxrkOGNxUv5P3Jg==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
@@ -2591,8 +2592,8 @@ packages:
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-runtime@7.25.7':
- resolution: {integrity: sha512-Y9p487tyTzB0yDYQOtWnC+9HGOuogtP3/wNpun1xJXEEvI6vip59BSBTsHnekZLqxmPcgsrAKt46HAAb//xGhg==}
+ '@babel/plugin-transform-runtime@7.25.9':
+ resolution: {integrity: sha512-nZp7GlEl+yULJrClz0SwHPqir3lc0zsPrDHQUcxGspSL7AKrexNSEfTbfqnDNJUO13bgKyfuOLMF8Xqtu8j3YQ==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
@@ -2603,8 +2604,8 @@ packages:
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-shorthand-properties@7.25.7':
- resolution: {integrity: sha512-uBbxNwimHi5Bv3hUccmOFlUy3ATO6WagTApenHz9KzoIdn0XeACdB12ZJ4cjhuB2WSi80Ez2FWzJnarccriJeA==}
+ '@babel/plugin-transform-shorthand-properties@7.25.9':
+ resolution: {integrity: sha512-MUv6t0FhO5qHnS/W8XCbHmiRWOphNufpE1IVxhK5kuN3Td9FT1x4rx4K42s3RYdMXCXpfWkGSbCSd0Z64xA7Ng==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
@@ -2615,8 +2616,8 @@ packages:
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-spread@7.25.7':
- resolution: {integrity: sha512-Mm6aeymI0PBh44xNIv/qvo8nmbkpZze1KvR8MkEqbIREDxoiWTi18Zr2jryfRMwDfVZF9foKh060fWgni44luw==}
+ '@babel/plugin-transform-spread@7.25.9':
+ resolution: {integrity: sha512-oNknIB0TbURU5pqJFVbOOFspVlrpVwo2H1+HUIsVDvp5VauGGDP1ZEvO8Nn5xyMEs3dakajOxlmkNW7kNgSm6A==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
@@ -2627,20 +2628,20 @@ packages:
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-sticky-regex@7.25.7':
- resolution: {integrity: sha512-ZFAeNkpGuLnAQ/NCsXJ6xik7Id+tHuS+NT+ue/2+rn/31zcdnupCdmunOizEaP0JsUmTFSTOPoQY7PkK2pttXw==}
+ '@babel/plugin-transform-sticky-regex@7.25.9':
+ resolution: {integrity: sha512-WqBUSgeVwucYDP9U/xNRQam7xV8W5Zf+6Eo7T2SRVUFlhRiMNFdFz58u0KZmCVVqs2i7SHgpRnAhzRNmKfi2uA==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-template-literals@7.25.7':
- resolution: {integrity: sha512-SI274k0nUsFFmyQupiO7+wKATAmMFf8iFgq2O+vVFXZ0SV9lNfT1NGzBEhjquFmD8I9sqHLguH+gZVN3vww2AA==}
+ '@babel/plugin-transform-template-literals@7.25.9':
+ resolution: {integrity: sha512-o97AE4syN71M/lxrCtQByzphAdlYluKPDBzDVzMmfCobUjjhAryZV0AIpRPrxN0eAkxXO6ZLEScmt+PNhj2OTw==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-typeof-symbol@7.25.7':
- resolution: {integrity: sha512-OmWmQtTHnO8RSUbL0NTdtpbZHeNTnm68Gj5pA4Y2blFNh+V4iZR68V1qL9cI37J21ZN7AaCnkfdHtLExQPf2uA==}
+ '@babel/plugin-transform-typeof-symbol@7.25.9':
+ resolution: {integrity: sha512-v61XqUMiueJROUv66BVIOi0Fv/CUuZuZMl5NkRoCVxLAnMexZ0A3kMe7vvZ0nulxMuMp0Mk6S5hNh48yki08ZA==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
@@ -2651,20 +2652,20 @@ packages:
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-typescript@7.25.7':
- resolution: {integrity: sha512-VKlgy2vBzj8AmEzunocMun2fF06bsSWV+FvVXohtL6FGve/+L217qhHxRTVGHEDO/YR8IANcjzgJsd04J8ge5Q==}
+ '@babel/plugin-transform-typescript@7.25.9':
+ resolution: {integrity: sha512-7PbZQZP50tzv2KGGnhh82GSyMB01yKY9scIjf1a+GfZCtInOWqUH5+1EBU4t9fyR5Oykkkc9vFTs4OHrhHXljQ==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-unicode-escapes@7.25.7':
- resolution: {integrity: sha512-BN87D7KpbdiABA+t3HbVqHzKWUDN3dymLaTnPFAMyc8lV+KN3+YzNhVRNdinaCPA4AUqx7ubXbQ9shRjYBl3SQ==}
+ '@babel/plugin-transform-unicode-escapes@7.25.9':
+ resolution: {integrity: sha512-s5EDrE6bW97LtxOcGj1Khcx5AaXwiMmi4toFWRDP9/y0Woo6pXC+iyPu/KuhKtfSrNFd7jJB+/fkOtZy6aIC6Q==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-unicode-property-regex@7.25.7':
- resolution: {integrity: sha512-IWfR89zcEPQGB/iB408uGtSPlQd3Jpq11Im86vUgcmSTcoWAiQMCTOa2K2yNNqFJEBVICKhayctee65Ka8OB0w==}
+ '@babel/plugin-transform-unicode-property-regex@7.25.9':
+ resolution: {integrity: sha512-Jt2d8Ga+QwRluxRQ307Vlxa6dMrYEMZCgGxoPR8V52rxPyldHu3hdlHspxaqYmE7oID5+kB+UKUB/eWS+DkkWg==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
@@ -2675,14 +2676,14 @@ packages:
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-unicode-regex@7.25.7':
- resolution: {integrity: sha512-8JKfg/hiuA3qXnlLx8qtv5HWRbgyFx2hMMtpDDuU2rTckpKkGu4ycK5yYHwuEa16/quXfoxHBIApEsNyMWnt0g==}
+ '@babel/plugin-transform-unicode-regex@7.25.9':
+ resolution: {integrity: sha512-yoxstj7Rg9dlNn9UQxzk4fcNivwv4nUYz7fYXBaKxvw/lnmPuOm/ikoELygbYq68Bls3D/D+NBPHiLwZdZZ4HA==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/plugin-transform-unicode-sets-regex@7.25.7':
- resolution: {integrity: sha512-YRW8o9vzImwmh4Q3Rffd09bH5/hvY0pxg+1H1i0f7APoUeg12G7+HhLj9ZFNIrYkgBXhIijPJ+IXypN0hLTIbw==}
+ '@babel/plugin-transform-unicode-sets-regex@7.25.9':
+ resolution: {integrity: sha512-8BYqO3GeVNHtx69fdPshN3fnzUNLrWdHhk/icSwigksJGczKSizZ+Z6SBCxTs723Fr5VSNorTIK7a+R2tISvwQ==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0
@@ -2731,12 +2732,16 @@ packages:
resolution: {integrity: sha512-FjoyLe754PMiYsFaN5C94ttGiOmBNYTf6pLr4xXHAT5uctHb092PBszndLDR5XA/jghQvn4n7JMHl7dmTgbm9w==}
engines: {node: '>=6.9.0'}
+ '@babel/runtime@7.26.0':
+ resolution: {integrity: sha512-FDSOghenHTiToteC/QRlv2q3DhPZ/oOXTBoirfWNx1Cx3TMVcGWQtMMmQcSvb/JjpNeGzx8Pq/b4fKEJuWm1sw==}
+ engines: {node: '>=6.9.0'}
+
'@babel/template@7.25.0':
resolution: {integrity: sha512-aOOgh1/5XzKvg1jvVz7AVrx2piJ2XBi227DHmbY6y+bM9H2FlN+IfecYu4Xl0cNiiVejlsCri89LUsbj8vJD9Q==}
engines: {node: '>=6.9.0'}
- '@babel/template@7.25.7':
- resolution: {integrity: sha512-wRwtAgI3bAS+JGU2upWNL9lSlDcRCqD05BZ1n3X2ONLH1WilFP6O1otQjeMK/1g0pvYcXC7b/qVUB1keofjtZA==}
+ '@babel/template@7.25.9':
+ resolution: {integrity: sha512-9DGttpmPvIxBb/2uwpVo3dqJ+O6RooAFOS+lB+xDqoE2PVCE8nfoHMdZLpfCQRLwvohzXISPZcgxt80xLfsuwg==}
engines: {node: '>=6.9.0'}
'@babel/traverse@7.25.3':
@@ -2747,8 +2752,8 @@ packages:
resolution: {integrity: sha512-9Vrcx5ZW6UwK5tvqsj0nGpp/XzqthkT0dqIc9g1AdtygFToNtTF67XzYS//dm+SAK9cp3B9R4ZO/46p63SCjlQ==}
engines: {node: '>=6.9.0'}
- '@babel/traverse@7.25.7':
- resolution: {integrity: sha512-jatJPT1Zjqvh/1FyJs6qAHL+Dzb7sTb+xr7Q+gM1b+1oBsMsQQ4FkVKb6dFlJvLlVssqkRzV05Jzervt9yhnzg==}
+ '@babel/traverse@7.25.9':
+ resolution: {integrity: sha512-ZCuvfwOwlz/bawvAuvcj8rrithP2/N55Tzz342AkTvq4qaWbGfmCk/tKhNaV2cthijKrPAA8SRJV5WWe7IBMJw==}
engines: {node: '>=6.9.0'}
'@babel/types@7.24.5':
@@ -2763,8 +2768,8 @@ packages:
resolution: {integrity: sha512-/l42B1qxpG6RdfYf343Uw1vmDjeNhneUXtzhojE7pDgfpEypmRhI6j1kr17XCVv4Cgl9HdAiQY2x0GwKm7rWCw==}
engines: {node: '>=6.9.0'}
- '@babel/types@7.25.7':
- resolution: {integrity: sha512-vwIVdXG+j+FOpkwqHRcBgHLYNL7XMkufrlaFvL9o6Ai9sJn9+PdyIL5qa0XzTZw084c+u9LOls53eoZWP/W5WQ==}
+ '@babel/types@7.26.0':
+ resolution: {integrity: sha512-Z/yiTPj+lDVnF7lWeKCIJzaIkI0vYO87dMpZ4bg4TDrFe4XXLFWL1TbXU27gBP3QccxV9mZICCrnjnYlJjXHOA==}
engines: {node: '>=6.9.0'}
'@brillout/import@0.2.3':
@@ -3178,6 +3183,12 @@ packages:
cpu: [ppc64]
os: [aix]
+ '@esbuild/aix-ppc64@0.21.5':
+ resolution: {integrity: sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==}
+ engines: {node: '>=12'}
+ cpu: [ppc64]
+ os: [aix]
+
'@esbuild/android-arm64@0.17.18':
resolution: {integrity: sha512-/iq0aK0eeHgSC3z55ucMAHO05OIqmQehiGay8eP5l/5l+iEr4EIbh4/MI8xD9qRFjqzgkc0JkX0LculNC9mXBw==}
engines: {node: '>=12'}
@@ -3196,6 +3207,12 @@ packages:
cpu: [arm64]
os: [android]
+ '@esbuild/android-arm64@0.21.5':
+ resolution: {integrity: sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==}
+ engines: {node: '>=12'}
+ cpu: [arm64]
+ os: [android]
+
'@esbuild/android-arm@0.17.18':
resolution: {integrity: sha512-EmwL+vUBZJ7mhFCs5lA4ZimpUH3WMAoqvOIYhVQwdIgSpHC8ImHdsRyhHAVxpDYUSm0lWvd63z0XH1IlImS2Qw==}
engines: {node: '>=12'}
@@ -3214,6 +3231,12 @@ packages:
cpu: [arm]
os: [android]
+ '@esbuild/android-arm@0.21.5':
+ resolution: {integrity: sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==}
+ engines: {node: '>=12'}
+ cpu: [arm]
+ os: [android]
+
'@esbuild/android-x64@0.17.18':
resolution: {integrity: sha512-x+0efYNBF3NPW2Xc5bFOSFW7tTXdAcpfEg2nXmxegm4mJuVeS+i109m/7HMiOQ6M12aVGGFlqJX3RhNdYM2lWg==}
engines: {node: '>=12'}
@@ -3232,6 +3255,12 @@ packages:
cpu: [x64]
os: [android]
+ '@esbuild/android-x64@0.21.5':
+ resolution: {integrity: sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==}
+ engines: {node: '>=12'}
+ cpu: [x64]
+ os: [android]
+
'@esbuild/darwin-arm64@0.17.18':
resolution: {integrity: sha512-6tY+djEAdF48M1ONWnQb1C+6LiXrKjmqjzPNPWXhu/GzOHTHX2nh8Mo2ZAmBFg0kIodHhciEgUBtcYCAIjGbjQ==}
engines: {node: '>=12'}
@@ -3250,6 +3279,12 @@ packages:
cpu: [arm64]
os: [darwin]
+ '@esbuild/darwin-arm64@0.21.5':
+ resolution: {integrity: sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==}
+ engines: {node: '>=12'}
+ cpu: [arm64]
+ os: [darwin]
+
'@esbuild/darwin-x64@0.17.18':
resolution: {integrity: sha512-Qq84ykvLvya3dO49wVC9FFCNUfSrQJLbxhoQk/TE1r6MjHo3sFF2tlJCwMjhkBVq3/ahUisj7+EpRSz0/+8+9A==}
engines: {node: '>=12'}
@@ -3268,6 +3303,12 @@ packages:
cpu: [x64]
os: [darwin]
+ '@esbuild/darwin-x64@0.21.5':
+ resolution: {integrity: sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==}
+ engines: {node: '>=12'}
+ cpu: [x64]
+ os: [darwin]
+
'@esbuild/freebsd-arm64@0.17.18':
resolution: {integrity: sha512-fw/ZfxfAzuHfaQeMDhbzxp9mc+mHn1Y94VDHFHjGvt2Uxl10mT4CDavHm+/L9KG441t1QdABqkVYwakMUeyLRA==}
engines: {node: '>=12'}
@@ -3286,6 +3327,12 @@ packages:
cpu: [arm64]
os: [freebsd]
+ '@esbuild/freebsd-arm64@0.21.5':
+ resolution: {integrity: sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==}
+ engines: {node: '>=12'}
+ cpu: [arm64]
+ os: [freebsd]
+
'@esbuild/freebsd-x64@0.17.18':
resolution: {integrity: sha512-FQFbRtTaEi8ZBi/A6kxOC0V0E9B/97vPdYjY9NdawyLd4Qk5VD5g2pbWN2VR1c0xhzcJm74HWpObPszWC+qTew==}
engines: {node: '>=12'}
@@ -3304,6 +3351,12 @@ packages:
cpu: [x64]
os: [freebsd]
+ '@esbuild/freebsd-x64@0.21.5':
+ resolution: {integrity: sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==}
+ engines: {node: '>=12'}
+ cpu: [x64]
+ os: [freebsd]
+
'@esbuild/linux-arm64@0.17.18':
resolution: {integrity: sha512-R7pZvQZFOY2sxUG8P6A21eq6q+eBv7JPQYIybHVf1XkQYC+lT7nDBdC7wWKTrbvMXKRaGudp/dzZCwL/863mZQ==}
engines: {node: '>=12'}
@@ -3322,6 +3375,12 @@ packages:
cpu: [arm64]
os: [linux]
+ '@esbuild/linux-arm64@0.21.5':
+ resolution: {integrity: sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==}
+ engines: {node: '>=12'}
+ cpu: [arm64]
+ os: [linux]
+
'@esbuild/linux-arm@0.17.18':
resolution: {integrity: sha512-jW+UCM40LzHcouIaqv3e/oRs0JM76JfhHjCavPxMUti7VAPh8CaGSlS7cmyrdpzSk7A+8f0hiedHqr/LMnfijg==}
engines: {node: '>=12'}
@@ -3340,6 +3399,12 @@ packages:
cpu: [arm]
os: [linux]
+ '@esbuild/linux-arm@0.21.5':
+ resolution: {integrity: sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==}
+ engines: {node: '>=12'}
+ cpu: [arm]
+ os: [linux]
+
'@esbuild/linux-ia32@0.17.18':
resolution: {integrity: sha512-ygIMc3I7wxgXIxk6j3V00VlABIjq260i967Cp9BNAk5pOOpIXmd1RFQJQX9Io7KRsthDrQYrtcx7QCof4o3ZoQ==}
engines: {node: '>=12'}
@@ -3358,6 +3423,12 @@ packages:
cpu: [ia32]
os: [linux]
+ '@esbuild/linux-ia32@0.21.5':
+ resolution: {integrity: sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==}
+ engines: {node: '>=12'}
+ cpu: [ia32]
+ os: [linux]
+
'@esbuild/linux-loong64@0.17.18':
resolution: {integrity: sha512-bvPG+MyFs5ZlwYclCG1D744oHk1Pv7j8psF5TfYx7otCVmcJsEXgFEhQkbhNW8otDHL1a2KDINW20cfCgnzgMQ==}
engines: {node: '>=12'}
@@ -3376,6 +3447,12 @@ packages:
cpu: [loong64]
os: [linux]
+ '@esbuild/linux-loong64@0.21.5':
+ resolution: {integrity: sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==}
+ engines: {node: '>=12'}
+ cpu: [loong64]
+ os: [linux]
+
'@esbuild/linux-mips64el@0.17.18':
resolution: {integrity: sha512-oVqckATOAGuiUOa6wr8TXaVPSa+6IwVJrGidmNZS1cZVx0HqkTMkqFGD2HIx9H1RvOwFeWYdaYbdY6B89KUMxA==}
engines: {node: '>=12'}
@@ -3394,6 +3471,12 @@ packages:
cpu: [mips64el]
os: [linux]
+ '@esbuild/linux-mips64el@0.21.5':
+ resolution: {integrity: sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==}
+ engines: {node: '>=12'}
+ cpu: [mips64el]
+ os: [linux]
+
'@esbuild/linux-ppc64@0.17.18':
resolution: {integrity: sha512-3dLlQO+b/LnQNxgH4l9rqa2/IwRJVN9u/bK63FhOPB4xqiRqlQAU0qDU3JJuf0BmaH0yytTBdoSBHrb2jqc5qQ==}
engines: {node: '>=12'}
@@ -3412,6 +3495,12 @@ packages:
cpu: [ppc64]
os: [linux]
+ '@esbuild/linux-ppc64@0.21.5':
+ resolution: {integrity: sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==}
+ engines: {node: '>=12'}
+ cpu: [ppc64]
+ os: [linux]
+
'@esbuild/linux-riscv64@0.17.18':
resolution: {integrity: sha512-/x7leOyDPjZV3TcsdfrSI107zItVnsX1q2nho7hbbQoKnmoeUWjs+08rKKt4AUXju7+3aRZSsKrJtaRmsdL1xA==}
engines: {node: '>=12'}
@@ -3430,6 +3519,12 @@ packages:
cpu: [riscv64]
os: [linux]
+ '@esbuild/linux-riscv64@0.21.5':
+ resolution: {integrity: sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==}
+ engines: {node: '>=12'}
+ cpu: [riscv64]
+ os: [linux]
+
'@esbuild/linux-s390x@0.17.18':
resolution: {integrity: sha512-cX0I8Q9xQkL/6F5zWdYmVf5JSQt+ZfZD2bJudZrWD+4mnUvoZ3TDDXtDX2mUaq6upMFv9FlfIh4Gfun0tbGzuw==}
engines: {node: '>=12'}
@@ -3448,6 +3543,12 @@ packages:
cpu: [s390x]
os: [linux]
+ '@esbuild/linux-s390x@0.21.5':
+ resolution: {integrity: sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==}
+ engines: {node: '>=12'}
+ cpu: [s390x]
+ os: [linux]
+
'@esbuild/linux-x64@0.17.18':
resolution: {integrity: sha512-66RmRsPlYy4jFl0vG80GcNRdirx4nVWAzJmXkevgphP1qf4dsLQCpSKGM3DUQCojwU1hnepI63gNZdrr02wHUA==}
engines: {node: '>=12'}
@@ -3466,6 +3567,12 @@ packages:
cpu: [x64]
os: [linux]
+ '@esbuild/linux-x64@0.21.5':
+ resolution: {integrity: sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==}
+ engines: {node: '>=12'}
+ cpu: [x64]
+ os: [linux]
+
'@esbuild/netbsd-x64@0.17.18':
resolution: {integrity: sha512-95IRY7mI2yrkLlTLb1gpDxdC5WLC5mZDi+kA9dmM5XAGxCME0F8i4bYH4jZreaJ6lIZ0B8hTrweqG1fUyW7jbg==}
engines: {node: '>=12'}
@@ -3484,6 +3591,12 @@ packages:
cpu: [x64]
os: [netbsd]
+ '@esbuild/netbsd-x64@0.21.5':
+ resolution: {integrity: sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==}
+ engines: {node: '>=12'}
+ cpu: [x64]
+ os: [netbsd]
+
'@esbuild/openbsd-x64@0.17.18':
resolution: {integrity: sha512-WevVOgcng+8hSZ4Q3BKL3n1xTv5H6Nb53cBrtzzEjDbbnOmucEVcZeGCsCOi9bAOcDYEeBZbD2SJNBxlfP3qiA==}
engines: {node: '>=12'}
@@ -3502,6 +3615,12 @@ packages:
cpu: [x64]
os: [openbsd]
+ '@esbuild/openbsd-x64@0.21.5':
+ resolution: {integrity: sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==}
+ engines: {node: '>=12'}
+ cpu: [x64]
+ os: [openbsd]
+
'@esbuild/sunos-x64@0.17.18':
resolution: {integrity: sha512-Rzf4QfQagnwhQXVBS3BYUlxmEbcV7MY+BH5vfDZekU5eYpcffHSyjU8T0xucKVuOcdCsMo+Ur5wmgQJH2GfNrg==}
engines: {node: '>=12'}
@@ -3520,6 +3639,12 @@ packages:
cpu: [x64]
os: [sunos]
+ '@esbuild/sunos-x64@0.21.5':
+ resolution: {integrity: sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==}
+ engines: {node: '>=12'}
+ cpu: [x64]
+ os: [sunos]
+
'@esbuild/win32-arm64@0.17.18':
resolution: {integrity: sha512-Kb3Ko/KKaWhjeAm2YoT/cNZaHaD1Yk/pa3FTsmqo9uFh1D1Rfco7BBLIPdDOozrObj2sahslFuAQGvWbgWldAg==}
engines: {node: '>=12'}
@@ -3538,6 +3663,12 @@ packages:
cpu: [arm64]
os: [win32]
+ '@esbuild/win32-arm64@0.21.5':
+ resolution: {integrity: sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==}
+ engines: {node: '>=12'}
+ cpu: [arm64]
+ os: [win32]
+
'@esbuild/win32-ia32@0.17.18':
resolution: {integrity: sha512-0/xUMIdkVHwkvxfbd5+lfG7mHOf2FRrxNbPiKWg9C4fFrB8H0guClmaM3BFiRUYrznVoyxTIyC/Ou2B7QQSwmw==}
engines: {node: '>=12'}
@@ -3556,6 +3687,12 @@ packages:
cpu: [ia32]
os: [win32]
+ '@esbuild/win32-ia32@0.21.5':
+ resolution: {integrity: sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==}
+ engines: {node: '>=12'}
+ cpu: [ia32]
+ os: [win32]
+
'@esbuild/win32-x64@0.17.18':
resolution: {integrity: sha512-qU25Ma1I3NqTSHJUOKi9sAH1/Mzuvlke0ioMJRthLXKm7JiSKVwFghlGbDLOO2sARECGhja4xYfRAZNPAkooYg==}
engines: {node: '>=12'}
@@ -3574,6 +3711,12 @@ packages:
cpu: [x64]
os: [win32]
+ '@esbuild/win32-x64@0.21.5':
+ resolution: {integrity: sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==}
+ engines: {node: '>=12'}
+ cpu: [x64]
+ os: [win32]
+
'@eslint-community/eslint-utils@4.4.0':
resolution: {integrity: sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
@@ -6154,83 +6297,93 @@ packages:
rollup:
optional: true
- '@rollup/rollup-android-arm-eabi@4.18.0':
- resolution: {integrity: sha512-Tya6xypR10giZV1XzxmH5wr25VcZSncG0pZIjfePT0OVBvqNEurzValetGNarVrGiq66EBVAFn15iYX4w6FKgQ==}
+ '@rollup/rollup-android-arm-eabi@4.26.0':
+ resolution: {integrity: sha512-gJNwtPDGEaOEgejbaseY6xMFu+CPltsc8/T+diUTTbOQLqD+bnrJq9ulH6WD69TqwqWmrfRAtUv30cCFZlbGTQ==}
cpu: [arm]
os: [android]
- '@rollup/rollup-android-arm64@4.18.0':
- resolution: {integrity: sha512-avCea0RAP03lTsDhEyfy+hpfr85KfyTctMADqHVhLAF3MlIkq83CP8UfAHUssgXTYd+6er6PaAhx/QGv4L1EiA==}
+ '@rollup/rollup-android-arm64@4.26.0':
+ resolution: {integrity: sha512-YJa5Gy8mEZgz5JquFruhJODMq3lTHWLm1fOy+HIANquLzfIOzE9RA5ie3JjCdVb9r46qfAQY/l947V0zfGJ0OQ==}
cpu: [arm64]
os: [android]
- '@rollup/rollup-darwin-arm64@4.18.0':
- resolution: {integrity: sha512-IWfdwU7KDSm07Ty0PuA/W2JYoZ4iTj3TUQjkVsO/6U+4I1jN5lcR71ZEvRh52sDOERdnNhhHU57UITXz5jC1/w==}
+ '@rollup/rollup-darwin-arm64@4.26.0':
+ resolution: {integrity: sha512-ErTASs8YKbqTBoPLp/kA1B1Um5YSom8QAc4rKhg7b9tyyVqDBlQxy7Bf2wW7yIlPGPg2UODDQcbkTlruPzDosw==}
cpu: [arm64]
os: [darwin]
- '@rollup/rollup-darwin-x64@4.18.0':
- resolution: {integrity: sha512-n2LMsUz7Ynu7DoQrSQkBf8iNrjOGyPLrdSg802vk6XT3FtsgX6JbE8IHRvposskFm9SNxzkLYGSq9QdpLYpRNA==}
+ '@rollup/rollup-darwin-x64@4.26.0':
+ resolution: {integrity: sha512-wbgkYDHcdWW+NqP2mnf2NOuEbOLzDblalrOWcPyY6+BRbVhliavon15UploG7PpBRQ2bZJnbmh8o3yLoBvDIHA==}
cpu: [x64]
os: [darwin]
- '@rollup/rollup-linux-arm-gnueabihf@4.18.0':
- resolution: {integrity: sha512-C/zbRYRXFjWvz9Z4haRxcTdnkPt1BtCkz+7RtBSuNmKzMzp3ZxdM28Mpccn6pt28/UWUCTXa+b0Mx1k3g6NOMA==}
+ '@rollup/rollup-freebsd-arm64@4.26.0':
+ resolution: {integrity: sha512-Y9vpjfp9CDkAG4q/uwuhZk96LP11fBz/bYdyg9oaHYhtGZp7NrbkQrj/66DYMMP2Yo/QPAsVHkV891KyO52fhg==}
+ cpu: [arm64]
+ os: [freebsd]
+
+ '@rollup/rollup-freebsd-x64@4.26.0':
+ resolution: {integrity: sha512-A/jvfCZ55EYPsqeaAt/yDAG4q5tt1ZboWMHEvKAH9Zl92DWvMIbnZe/f/eOXze65aJaaKbL+YeM0Hz4kLQvdwg==}
+ cpu: [x64]
+ os: [freebsd]
+
+ '@rollup/rollup-linux-arm-gnueabihf@4.26.0':
+ resolution: {integrity: sha512-paHF1bMXKDuizaMODm2bBTjRiHxESWiIyIdMugKeLnjuS1TCS54MF5+Y5Dx8Ui/1RBPVRE09i5OUlaLnv8OGnA==}
cpu: [arm]
os: [linux]
- '@rollup/rollup-linux-arm-musleabihf@4.18.0':
- resolution: {integrity: sha512-l3m9ewPgjQSXrUMHg93vt0hYCGnrMOcUpTz6FLtbwljo2HluS4zTXFy2571YQbisTnfTKPZ01u/ukJdQTLGh9A==}
+ '@rollup/rollup-linux-arm-musleabihf@4.26.0':
+ resolution: {integrity: sha512-cwxiHZU1GAs+TMxvgPfUDtVZjdBdTsQwVnNlzRXC5QzIJ6nhfB4I1ahKoe9yPmoaA/Vhf7m9dB1chGPpDRdGXg==}
cpu: [arm]
os: [linux]
- '@rollup/rollup-linux-arm64-gnu@4.18.0':
- resolution: {integrity: sha512-rJ5D47d8WD7J+7STKdCUAgmQk49xuFrRi9pZkWoRD1UeSMakbcepWXPF8ycChBoAqs1pb2wzvbY6Q33WmN2ftw==}
+ '@rollup/rollup-linux-arm64-gnu@4.26.0':
+ resolution: {integrity: sha512-4daeEUQutGRCW/9zEo8JtdAgtJ1q2g5oHaoQaZbMSKaIWKDQwQ3Yx0/3jJNmpzrsScIPtx/V+1AfibLisb3AMQ==}
cpu: [arm64]
os: [linux]
- '@rollup/rollup-linux-arm64-musl@4.18.0':
- resolution: {integrity: sha512-be6Yx37b24ZwxQ+wOQXXLZqpq4jTckJhtGlWGZs68TgdKXJgw54lUUoFYrg6Zs/kjzAQwEwYbp8JxZVzZLRepQ==}
+ '@rollup/rollup-linux-arm64-musl@4.26.0':
+ resolution: {integrity: sha512-eGkX7zzkNxvvS05ROzJ/cO/AKqNvR/7t1jA3VZDi2vRniLKwAWxUr85fH3NsvtxU5vnUUKFHKh8flIBdlo2b3Q==}
cpu: [arm64]
os: [linux]
- '@rollup/rollup-linux-powerpc64le-gnu@4.18.0':
- resolution: {integrity: sha512-hNVMQK+qrA9Todu9+wqrXOHxFiD5YmdEi3paj6vP02Kx1hjd2LLYR2eaN7DsEshg09+9uzWi2W18MJDlG0cxJA==}
+ '@rollup/rollup-linux-powerpc64le-gnu@4.26.0':
+ resolution: {integrity: sha512-Odp/lgHbW/mAqw/pU21goo5ruWsytP7/HCC/liOt0zcGG0llYWKrd10k9Fj0pdj3prQ63N5yQLCLiE7HTX+MYw==}
cpu: [ppc64]
os: [linux]
- '@rollup/rollup-linux-riscv64-gnu@4.18.0':
- resolution: {integrity: sha512-ROCM7i+m1NfdrsmvwSzoxp9HFtmKGHEqu5NNDiZWQtXLA8S5HBCkVvKAxJ8U+CVctHwV2Gb5VUaK7UAkzhDjlg==}
+ '@rollup/rollup-linux-riscv64-gnu@4.26.0':
+ resolution: {integrity: sha512-MBR2ZhCTzUgVD0OJdTzNeF4+zsVogIR1U/FsyuFerwcqjZGvg2nYe24SAHp8O5sN8ZkRVbHwlYeHqcSQ8tcYew==}
cpu: [riscv64]
os: [linux]
- '@rollup/rollup-linux-s390x-gnu@4.18.0':
- resolution: {integrity: sha512-0UyyRHyDN42QL+NbqevXIIUnKA47A+45WyasO+y2bGJ1mhQrfrtXUpTxCOrfxCR4esV3/RLYyucGVPiUsO8xjg==}
+ '@rollup/rollup-linux-s390x-gnu@4.26.0':
+ resolution: {integrity: sha512-YYcg8MkbN17fMbRMZuxwmxWqsmQufh3ZJFxFGoHjrE7bv0X+T6l3glcdzd7IKLiwhT+PZOJCblpnNlz1/C3kGQ==}
cpu: [s390x]
os: [linux]
- '@rollup/rollup-linux-x64-gnu@4.18.0':
- resolution: {integrity: sha512-xuglR2rBVHA5UsI8h8UbX4VJ470PtGCf5Vpswh7p2ukaqBGFTnsfzxUBetoWBWymHMxbIG0Cmx7Y9qDZzr648w==}
+ '@rollup/rollup-linux-x64-gnu@4.26.0':
+ resolution: {integrity: sha512-ZuwpfjCwjPkAOxpjAEjabg6LRSfL7cAJb6gSQGZYjGhadlzKKywDkCUnJ+KEfrNY1jH5EEoSIKLCb572jSiglA==}
cpu: [x64]
os: [linux]
- '@rollup/rollup-linux-x64-musl@4.18.0':
- resolution: {integrity: sha512-LKaqQL9osY/ir2geuLVvRRs+utWUNilzdE90TpyoX0eNqPzWjRm14oMEE+YLve4k/NAqCdPkGYDaDF5Sw+xBfg==}
+ '@rollup/rollup-linux-x64-musl@4.26.0':
+ resolution: {integrity: sha512-+HJD2lFS86qkeF8kNu0kALtifMpPCZU80HvwztIKnYwym3KnA1os6nsX4BGSTLtS2QVAGG1P3guRgsYyMA0Yhg==}
cpu: [x64]
os: [linux]
- '@rollup/rollup-win32-arm64-msvc@4.18.0':
- resolution: {integrity: sha512-7J6TkZQFGo9qBKH0pk2cEVSRhJbL6MtfWxth7Y5YmZs57Pi+4x6c2dStAUvaQkHQLnEQv1jzBUW43GvZW8OFqA==}
+ '@rollup/rollup-win32-arm64-msvc@4.26.0':
+ resolution: {integrity: sha512-WUQzVFWPSw2uJzX4j6YEbMAiLbs0BUysgysh8s817doAYhR5ybqTI1wtKARQKo6cGop3pHnrUJPFCsXdoFaimQ==}
cpu: [arm64]
os: [win32]
- '@rollup/rollup-win32-ia32-msvc@4.18.0':
- resolution: {integrity: sha512-Txjh+IxBPbkUB9+SXZMpv+b/vnTEtFyfWZgJ6iyCmt2tdx0OF5WhFowLmnh8ENGNpfUlUZkdI//4IEmhwPieNg==}
+ '@rollup/rollup-win32-ia32-msvc@4.26.0':
+ resolution: {integrity: sha512-D4CxkazFKBfN1akAIY6ieyOqzoOoBV1OICxgUblWxff/pSjCA2khXlASUx7mK6W1oP4McqhgcCsu6QaLj3WMWg==}
cpu: [ia32]
os: [win32]
- '@rollup/rollup-win32-x64-msvc@4.18.0':
- resolution: {integrity: sha512-UOo5FdvOL0+eIVTgS4tIdbW+TtnBLWg1YBCcU2KWM7nuNwRz9bksDX1bekJJCpu25N1DVWaCwnT39dVQxzqS8g==}
+ '@rollup/rollup-win32-x64-msvc@4.26.0':
+ resolution: {integrity: sha512-2x8MO1rm4PGEP0xWbubJW5RtbNLk3puzAMaLQd3B3JHVw4KcHlmXcO+Wewx9zCoo7EUFiMlu/aZbCJ7VjMzAag==}
cpu: [x64]
os: [win32]
@@ -7058,6 +7211,9 @@ packages:
'@types/estree@1.0.5':
resolution: {integrity: sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==}
+ '@types/estree@1.0.6':
+ resolution: {integrity: sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==}
+
'@types/expect@24.3.0':
resolution: {integrity: sha512-aq5Z+YFBz5o2b6Sp1jigx5nsmoZMK5Ceurjwy6PZmRv7dEi1jLtkARfvB1ME+OXJUG+7TZUDcv3WoCr/aor6dQ==}
deprecated: This is a stub types definition. expect provides its own type definitions, so you do not need this installed.
@@ -7141,6 +7297,9 @@ packages:
'@types/node-fetch@2.6.11':
resolution: {integrity: sha512-24xFj9R5+rfQJLRyM56qh+wnVSYhyXC2tkoBndtY0U+vubqNsYXGjufB2nn8Q6gt0LrARwL6UBtMCSVCwl4B1g==}
+ '@types/node-fetch@2.6.12':
+ resolution: {integrity: sha512-8nneRWKCg3rMtF69nLQJnOYUcbafYeFSjqkw3jCRLsqkWFlHaoQrr5mXmofFGOx3DKn7UfmBMyov8ySvLRVldA==}
+
'@types/node-forge@1.3.11':
resolution: {integrity: sha512-FQx220y22OKNTqaByeBGqHWYz4cl94tpcxeFdvBo3wjG6XPBuZ0BNgNZRV5J5TFmmcsJ4IzsLkmGRiQbnYsBEQ==}
@@ -7162,6 +7321,9 @@ packages:
'@types/node@20.12.10':
resolution: {integrity: sha512-Eem5pH9pmWBHoGAT8Dr5fdc5rYA+4NAovdM4EktRPVAAiJhmWWfQrA0cFhAbOsQdSfIHjAud6YdkbL69+zSKjw==}
+ '@types/node@20.17.6':
+ resolution: {integrity: sha512-VEI7OdvK2wP7XHnsuXbAJnEpEkF6NjSN45QJlL4VGqZSXsnicpesdTWsg9RISeSdYd3yeRj/y3k5KGjUXYnFwQ==}
+
'@types/node@8.10.66':
resolution: {integrity: sha512-tktOkFUA4kXx2hhhrB8bIFb5TbwzS4uOhKEmwiD+NoiL0qtP2OQ9mFldbgD4dV1djrlBYP6eBuQZiWjuHUpqFw==}
@@ -7506,6 +7668,10 @@ packages:
resolution: {integrity: sha512-u4BGuazSNAQ48QBY7EphanBuBN6EJWyD5MXi83n1wXwfPQWAu0XNvmOjjF+xmMI5TsYH9N6Y78O6HP/VX9EOvg==}
engines: {node: '>=18'}
+ '@walletconnect/core@2.17.2':
+ resolution: {integrity: sha512-O9VUsFg78CbvIaxfQuZMsHcJ4a2Z16DRz/O4S+uOAcGKhH/i/ln8hp864Tb+xRvifWSzaZ6CeAVxk657F+pscA==}
+ engines: {node: '>=18'}
+
'@walletconnect/crypto@1.0.3':
resolution: {integrity: sha512-+2jdORD7XQs76I2Odgr3wwrtyuLUXD/kprNVsjWRhhhdO9Mt6WqVzOPu0/t7OHSmgal8k7SoBQzUc5hu/8zL/g==}
@@ -7524,6 +7690,9 @@ packages:
'@walletconnect/ethereum-provider@2.15.2':
resolution: {integrity: sha512-POH2Wov2cXdASDDyv2bwY9Y2JzkGzGFS4SzltMt1zxKUMTyoJ8xKAgWaxoiJw0pqsLGY7T5msmk9qeKOavQtAA==}
+ '@walletconnect/ethereum-provider@2.17.2':
+ resolution: {integrity: sha512-o4aL4KkUKT+n0iDwGzC6IY4bl+9n8bwOeT2KwifaVHsFw/irhtRPlsAQQH4ezOiPyk8cri1KN9dPk/YeU0pe6w==}
+
'@walletconnect/events@1.0.1':
resolution: {integrity: sha512-NPTqaoi0oPBVNuLv7qPaJazmGHs5JGyO8eEAk5VGKmJzDR7AHzD4k6ilox5kxk1iwiOnFopBOOMLs86Oa76HpQ==}
@@ -7571,12 +7740,21 @@ packages:
'@walletconnect/modal-core@2.6.2':
resolution: {integrity: sha512-cv8ibvdOJQv2B+nyxP9IIFdxvQznMz8OOr/oR/AaUZym4hjXNL/l1a2UlSQBXrVjo3xxbouMxLb3kBsHoYP2CA==}
+ '@walletconnect/modal-core@2.7.0':
+ resolution: {integrity: sha512-oyMIfdlNdpyKF2kTJowTixZSo0PGlCJRdssUN/EZdA6H6v03hZnf09JnwpljZNfir2M65Dvjm/15nGrDQnlxSA==}
+
'@walletconnect/modal-ui@2.6.2':
resolution: {integrity: sha512-rbdstM1HPGvr7jprQkyPggX7rP4XiCG85ZA+zWBEX0dVQg8PpAgRUqpeub4xQKDgY7pY/xLRXSiCVdWGqvG2HA==}
+ '@walletconnect/modal-ui@2.7.0':
+ resolution: {integrity: sha512-gERYvU7D7K1ANCN/8vUgsE0d2hnRemfAFZ2novm9aZBg7TEd/4EgB+AqbJ+1dc7GhOL6dazckVq78TgccHb7mQ==}
+
'@walletconnect/modal@2.6.2':
resolution: {integrity: sha512-eFopgKi8AjKf/0U4SemvcYw9zlLpx9njVN8sf6DAkowC2Md0gPU/UNEbH1Wwj407pEKnEds98pKWib1NN1ACoA==}
+ '@walletconnect/modal@2.7.0':
+ resolution: {integrity: sha512-RQVt58oJ+rwqnPcIvRFeMGKuXb9qkgSmwz4noF8JZGUym3gUAzVs+uW2NQ1Owm9XOJAV+sANrtJ+VoVq1ftElw==}
+
'@walletconnect/randombytes@1.0.3':
resolution: {integrity: sha512-35lpzxcHFbTN3ABefC9W+uBpNZl1GC4Wpx0ed30gibfO/y9oLdy1NznbV96HARQKSBV9J9M/rrtIvf6a23jfYw==}
@@ -7604,6 +7782,9 @@ packages:
'@walletconnect/sign-client@2.15.2':
resolution: {integrity: sha512-Yp4/z3IdTMngbjr7Zy7Qi1X6EZDH4nxY91X6K2KpA3MjLW0yPTGalEJgJ4p9WH7fmHRlwvfR4hjwM5eQcLo5Zg==}
+ '@walletconnect/sign-client@2.17.2':
+ resolution: {integrity: sha512-/wigdCIQjlBXSWY43Id0IPvZ5biq4HiiQZti8Ljvx408UYjmqcxcBitbj2UJXMYkid7704JWAB2mw32I1HgshQ==}
+
'@walletconnect/socket-transport@1.8.0':
resolution: {integrity: sha512-5DyIyWrzHXTcVp0Vd93zJ5XMW61iDM6bcWT4p8DTRfFsOtW46JquruMhxOLeCOieM4D73kcr3U7WtyR4JUsGuQ==}
@@ -7623,6 +7804,9 @@ packages:
'@walletconnect/types@2.15.2':
resolution: {integrity: sha512-TGnQZYWZJJ3I8dqgpMPwhO1IRXDuY8/tWPI0nNWJDyTK7b3E9prDGugnPmDDjpTYVoETnUTgW/jQaHNTq4yV7Q==}
+ '@walletconnect/types@2.17.2':
+ resolution: {integrity: sha512-j/+0WuO00lR8ntu7b1+MKe/r59hNwYLFzW0tTmozzhfAlDL+dYwWasDBNq4AH8NbVd7vlPCQWmncH7/6FVtOfQ==}
+
'@walletconnect/universal-provider@2.12.2':
resolution: {integrity: sha512-0k5ZgSkABopQLVhkiwl2gRGG7dAP4SWiI915pIlyN5sRvWV+qX1ALhWAmRcdv0TXWlKHDcDgPJw/q2sCSAHuMQ==}
@@ -7632,6 +7816,9 @@ packages:
'@walletconnect/universal-provider@2.15.2':
resolution: {integrity: sha512-AWK5nUA4tJ57C8JDPOmqAWf5aF1VXIN4JpkqKekNKMP4+xiBTotKrwj0XD5xvtDUyaqjhRZPvYmUk24z1udrHA==}
+ '@walletconnect/universal-provider@2.17.2':
+ resolution: {integrity: sha512-yIWDhBODRa9J349d/i1sObzon0vy4n+7R3MvGQQYaU1EVrV+WfoGSRsu8U7rYsL067/MAUu9t/QrpPblaSbz7g==}
+
'@walletconnect/utils@1.8.0':
resolution: {integrity: sha512-zExzp8Mj1YiAIBfKNm5u622oNw44WOESzo6hj+Q3apSMIb0Jph9X3GDIdbZmvVZsNPxWDL7uodKgZcCInZv2vA==}
@@ -7644,6 +7831,9 @@ packages:
'@walletconnect/utils@2.15.2':
resolution: {integrity: sha512-H+fNH9cHDezdaEiEsO7/3URSIzqhumuacwB/+0PX0sSCoktmU9AfTqA8fJGG43zOPixleBqOymzO6owB1Y7jtQ==}
+ '@walletconnect/utils@2.17.2':
+ resolution: {integrity: sha512-T7eLRiuw96fgwUy2A5NZB5Eu87ukX8RCVoO9lji34RFV4o2IGU9FhTEWyd4QQKI8OuQRjSknhbJs0tU0r0faPw==}
+
'@walletconnect/window-getters@1.0.0':
resolution: {integrity: sha512-xB0SQsLaleIYIkSsl43vm8EwETpBzJ2gnzk7e0wMF3ktqiTGS6TFHxcprMl5R44KKh4tCcHCJwolMCaDSwtAaA==}
@@ -7766,6 +7956,11 @@ packages:
engines: {node: '>=0.4.0'}
hasBin: true
+ acorn@8.14.0:
+ resolution: {integrity: sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==}
+ engines: {node: '>=0.4.0'}
+ hasBin: true
+
aes-js@3.0.0:
resolution: {integrity: sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw==}
@@ -8067,6 +8262,11 @@ packages:
peerDependencies:
'@babel/core': ^7.4.0 || ^8.0.0-0 <8.0.0
+ babel-plugin-polyfill-corejs2@0.4.12:
+ resolution: {integrity: sha512-CPWT6BwvhrTO2d8QVorhTCQw9Y43zOu7G9HigcfxvepOU6b8o3tcWad6oVgZIsZCTt42FFv97aA7ZJsbM4+8og==}
+ peerDependencies:
+ '@babel/core': ^7.4.0 || ^8.0.0-0 <8.0.0
+
babel-plugin-polyfill-corejs3@0.10.6:
resolution: {integrity: sha512-b37+KR2i/khY5sKmWNVQAnitvquQbNdWy6lJdsr0kmquCKEEUgMKK4SboVM3HtfnZilfjr4MMQ7vY58FVWDtIA==}
peerDependencies:
@@ -8077,6 +8277,11 @@ packages:
peerDependencies:
'@babel/core': ^7.4.0 || ^8.0.0-0 <8.0.0
+ babel-plugin-polyfill-regenerator@0.6.3:
+ resolution: {integrity: sha512-LiWSbl4CRSIa5x/JAU6jZiG9eit9w6mz+yVMFwDE83LAWvt0AfGBoZ7HS/mkhrKuh2ZlzfVZYKoLjXdqw6Yt7Q==}
+ peerDependencies:
+ '@babel/core': ^7.4.0 || ^8.0.0-0 <8.0.0
+
babel-plugin-transform-flow-enums@0.0.2:
resolution: {integrity: sha512-g4aaCrDDOsWjbm0PUUeVnkcVd6AKJsVc/MbnPhEotEpkeJQP6b8nzewohQi7+QS8UyPehOhGWn0nOwjvWpmMvQ==}
@@ -8186,6 +8391,9 @@ packages:
bn.js@4.12.0:
resolution: {integrity: sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==}
+ bn.js@4.12.1:
+ resolution: {integrity: sha512-k8TVBiPkPJT9uHLdOKfFpqcfprwBFOAAXXozRubr7R7PfIuKvQlzcI4M0pALeqXN09vdaMbUdUj+pass+uULAg==}
+
bn.js@5.2.1:
resolution: {integrity: sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==}
@@ -8256,8 +8464,8 @@ packages:
engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7}
hasBin: true
- browserslist@4.24.0:
- resolution: {integrity: sha512-Rmb62sR1Zpjql25eSanFGEhAxcFwfA1K0GuQcLoaJBAcENegrQut3hYdhXFF1obQfiDyqIW/cLM5HSJ/9k884A==}
+ browserslist@4.24.2:
+ resolution: {integrity: sha512-ZIc+Q62revdMcqC6aChtW4jz3My3klmCO1fEmINZY/8J3EpBg5/A/D0AKmBveUh6pgoeycoMkVMko84tuYS+Gg==}
engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7}
hasBin: true
@@ -8383,8 +8591,8 @@ packages:
caniuse-lite@1.0.30001655:
resolution: {integrity: sha512-jRGVy3iSGO5Uutn2owlb5gR6qsGngTw9ZTb4ali9f3glshcNmJ2noam4Mo9zia5P9Dk3jNNydy7vQjuE5dQmfg==}
- caniuse-lite@1.0.30001667:
- resolution: {integrity: sha512-7LTwJjcRkzKFmtqGsibMeuXmvFDfZq/nzIjnmgCGzKKRVzjD72selLDK1oPF/Oxzmt4fNcPvTDvGqSDG4tCALw==}
+ caniuse-lite@1.0.30001680:
+ resolution: {integrity: sha512-rPQy70G6AGUMnbwS1z6Xg+RkHYPAi18ihs47GH0jcxIG7wArmPgY3XbS2sRdBbxJljp3thdT8BIqv9ccCypiPA==}
canvas-renderer@2.1.1:
resolution: {integrity: sha512-/V0XetN7s1Mk3NO7x2wxPZYv0pLMQtGAhecuOuKR88beiYCUle1AbCcFZNLu+4NVzi9RVHS0rXtIgzPEaKidLw==}
@@ -8673,6 +8881,10 @@ packages:
resolution: {integrity: sha512-jaSIDzP9pZVS4ZfQ+TzvtiWhdpFhE2RDHz8QJkpX9SIpLq88VueF5jJw6t+6CUQcAoA6t+x89MLrWAqpfDE8iQ==}
engines: {node: '>= 0.8.0'}
+ compression@1.7.5:
+ resolution: {integrity: sha512-bQJ0YRck5ak3LgtnpKkiabX5pNF7tMUh1BSy2ZBOTh0Dim0BUu6aPPwByIns6/A5Prh8PufSPerMDUklpzes2Q==}
+ engines: {node: '>= 0.8.0'}
+
compute-scroll-into-view@2.0.4:
resolution: {integrity: sha512-y/ZA3BGnxoM/QHHQ2Uy49CLtnWPbt4tTPpEEZiEmmiWBFKjej7nEyH8Ryz54jH0MLXflUYA3Er2zUxPSJu5R+g==}
@@ -8786,8 +8998,8 @@ packages:
core-js-compat@3.38.0:
resolution: {integrity: sha512-75LAicdLa4OJVwFxFbQR3NdnZjNgX6ILpVcVzcC4T2smerB5lELMrJQQQoWV6TiuC/vlaFqgU2tKQx9w5s0e0A==}
- core-js-compat@3.38.1:
- resolution: {integrity: sha512-JRH6gfXxGmrzF3tZ57lFx97YARxCXPaMzPo6jELZhv88pBH5VXpQ+y0znKGlFnzuaihqhLbefxSJxWJMPtfDzw==}
+ core-js-compat@3.39.0:
+ resolution: {integrity: sha512-VgEUx3VwlExr5no0tXlBt+silBvhTryPwCXRI2Id1PN8WTKu7MreethvddqOubrYxkFdv/RnYrqlv1sFNAUelw==}
core-js-pure@3.37.0:
resolution: {integrity: sha512-d3BrpyFr5eD4KcbRvQ3FTUx/KWmaDesr7+a3+1+P46IUnNoEt+oiLijPINZMEon7w9oGkIINWxrBAU9DEciwFQ==}
@@ -9347,8 +9559,8 @@ packages:
electron-to-chromium@1.5.11:
resolution: {integrity: sha512-R1CccCDYqndR25CaXFd6hp/u9RaaMcftMkphmvuepXr5b1vfLkRml6aWVeBhXJ7rbevHkKEMJtz8XqPf7ffmew==}
- electron-to-chromium@1.5.35:
- resolution: {integrity: sha512-hOSRInrIDm0Brzp4IHW2F/VM+638qOL2CzE0DgpnGzKW27C95IqqeqgKz/hxHGnvPxvQGpHUGD5qRVC9EZY2+A==}
+ electron-to-chromium@1.5.57:
+ resolution: {integrity: sha512-xS65H/tqgOwUBa5UmOuNSLuslDo7zho0y/lgQw35pnrqiZh7UOWHCeL/Bt6noJATbA6tpQJGCifsFsIRZj1Fqg==}
elliptic@6.5.4:
resolution: {integrity: sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==}
@@ -9359,6 +9571,12 @@ packages:
elliptic@6.5.7:
resolution: {integrity: sha512-ESVCtTwiA+XhY3wyh24QqRGBoP3rEdDUl3EDUUo9tft074fi19IrdpH7hLCMMP3CIj7jb3W96rn8lt/BqIlt5Q==}
+ elliptic@6.6.0:
+ resolution: {integrity: sha512-dpwoQcLc/2WLQvJvLRHKZ+f9FgOdjnq11rurqwekGQygGPsYSK29OMMD2WalatiqQ+XGFDglTNixpPfI+lpaAA==}
+
+ elliptic@6.6.1:
+ resolution: {integrity: sha512-RaddvvMatK2LJHqFJ+YA4WysVN5Ita9E35botqIYspQ4TkRAlCicdzKOjlyv/1Za5RyTNn7di//eEV0uTAfe3g==}
+
emittery@0.13.1:
resolution: {integrity: sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ==}
engines: {node: '>=12'}
@@ -9449,6 +9667,10 @@ packages:
resolution: {integrity: sha512-e+HfNH61Bj1X9/jLc5v1owaLYuHdeHHSQlkhCBiTK8rBvKaULl/beGMxwrMXjpYrv4pz22BlY570vVePA2ho4A==}
engines: {node: '>= 0.4'}
+ es-abstract@1.23.4:
+ resolution: {integrity: sha512-HR1gxH5OaiN7XH7uiWH0RLw0RcFySiSoW1ctxmD1ahTw3uGBtkmm/ng0tDU1OtYx5OK6EOL5Y6O21cDflG3Jcg==}
+ engines: {node: '>= 0.4'}
+
es-define-property@1.0.0:
resolution: {integrity: sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==}
engines: {node: '>= 0.4'}
@@ -9523,6 +9745,11 @@ packages:
engines: {node: '>=12'}
hasBin: true
+ esbuild@0.21.5:
+ resolution: {integrity: sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==}
+ engines: {node: '>=12'}
+ hasBin: true
+
escalade@3.1.2:
resolution: {integrity: sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==}
engines: {node: '>=6'}
@@ -12439,6 +12666,10 @@ packages:
resolution: {integrity: sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==}
engines: {node: '>= 0.6'}
+ negotiator@0.6.4:
+ resolution: {integrity: sha512-myRT3DiWPHqho5PrJaIRyaMv2kgYf0mUVgBNOYMuCH5Ki1yEiQaf/ZJuQ62nvpc44wL5WDbTX7yGJi1Neevw8w==}
+ engines: {node: '>= 0.6'}
+
neo-async@2.6.2:
resolution: {integrity: sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==}
@@ -12646,6 +12877,10 @@ packages:
object-inspect@1.13.1:
resolution: {integrity: sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==}
+ object-inspect@1.13.3:
+ resolution: {integrity: sha512-kDCGIbxkDSXE3euJZZXzc6to7fCrKHNI/hSRQnRuQ+BWjFNzZwiFF8fj/6o2t2G9/jTj8PSIYTfCLelLZEeRpA==}
+ engines: {node: '>= 0.4'}
+
object-is@1.1.6:
resolution: {integrity: sha512-F8cZ+KfGlSGi09lJT7/Nd6KJZ9ygtvYC0/UYYLI9nmQKLMnydpB9yvbv9K1uSkEu7FU9vYPmVwLg328tX+ot3Q==}
engines: {node: '>= 0.4'}
@@ -12683,9 +12918,6 @@ packages:
ofetch@1.3.4:
resolution: {integrity: sha512-KLIET85ik3vhEfS+3fDlc/BAZiAp+43QEC/yCo5zkNoY2YaKvNkOaFr/6wCFgFH1kuYQM5pMNi0Tg8koiIemtw==}
- ohash@1.1.3:
- resolution: {integrity: sha512-zuHHiGTYTA1sYJ/wZN+t5HKZaH23i4yI1HMwbuXm24Nid7Dv0KcuRlKoNKS9UNfAVSBlnGLcuQrnOKWOZoEGaw==}
-
ohash@1.1.4:
resolution: {integrity: sha512-FlDryZAahJmEF3VR3w1KogSEdWX3WhA5GPakFx4J81kEAiHyLMpdLLElS8n8dfNadMgAne/MywcvmogzscVt4g==}
@@ -12768,6 +13000,14 @@ packages:
outvariant@1.4.0:
resolution: {integrity: sha512-AlWY719RF02ujitly7Kk/0QlV+pXGFDHrHf9O2OKqyqgBieaPOIeuSkL8sRK6j2WK+/ZAURq2kZsY0d8JapUiw==}
+ ox@0.1.2:
+ resolution: {integrity: sha512-ak/8K0Rtphg9vnRJlbOdaX9R7cmxD2MiSthjWGaQdMk3D7hrAlDoM+6Lxn7hN52Za3vrXfZ7enfke/5WjolDww==}
+ peerDependencies:
+ typescript: '>=5.4.0'
+ peerDependenciesMeta:
+ typescript:
+ optional: true
+
p-defer@4.0.1:
resolution: {integrity: sha512-Mr5KC5efvAK5VUptYEIopP1bakB85k2IWXaRC0rsh1uwn1L6M0LVml8OIQ4Gudg4oyZakf7FmeRLkMMtZW1i5A==}
engines: {node: '>=12'}
@@ -12915,6 +13155,9 @@ packages:
parse5@7.1.2:
resolution: {integrity: sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==}
+ parse5@7.2.1:
+ resolution: {integrity: sha512-BuBYQYlv1ckiPdQi/ohiivi9Sagc9JG+Ozs0r7b/0iK3sKmrb0b9FdWdBbOdx6hBCM/F9Ir82ofnBhtZOjCRPQ==}
+
parseurl@1.3.3:
resolution: {integrity: sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==}
engines: {node: '>= 0.8'}
@@ -13093,11 +13336,8 @@ packages:
picocolors@1.0.0:
resolution: {integrity: sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==}
- picocolors@1.0.1:
- resolution: {integrity: sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==}
-
- picocolors@1.1.0:
- resolution: {integrity: sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==}
+ picocolors@1.1.1:
+ resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==}
picomatch@2.3.1:
resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==}
@@ -13250,6 +13490,10 @@ packages:
resolution: {integrity: sha512-Wglpdk03BSfXkHoQa3b/oulrotAkwrlLDRSOb9D0bN86FdRyE9lppSp33aHNPgBa0JKCoB+drFLZkQoRRYae5A==}
engines: {node: ^10 || ^12 || >=14}
+ postcss@8.4.49:
+ resolution: {integrity: sha512-OCVPnIObs4N29kxTjzLfUryOkvZEq+pf8jTF0lg8E7uETuWHA+v7j3c/xJmiqpX450191LlmZfUKkXxkTry7nA==}
+ engines: {node: ^10 || ^12 || >=14}
+
postgres-array@2.0.0:
resolution: {integrity: sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==}
engines: {node: '>=4'}
@@ -13288,8 +13532,8 @@ packages:
preact@10.23.2:
resolution: {integrity: sha512-kKYfePf9rzKnxOAKDpsWhg/ysrHPqT+yQ7UW4JjdnqjFIeNUnNcEJvhuA8fDenxAGWzUqtd51DfVg7xp/8T9NA==}
- preact@10.24.2:
- resolution: {integrity: sha512-1cSoF0aCC8uaARATfrlz4VCBqE8LwZwRfLgkxJOQwAlQt6ayTmi0D9OF7nXid1POI5SZidFuG9CnlXbDfLqY/Q==}
+ preact@10.24.3:
+ resolution: {integrity: sha512-Z2dPnBnMUfyQfSQ+GBdsGa16hz35YmLmtTLhM169uW944hYL6xzTYkJjC07j+Wosz733pMWx0fgON3JNw1jJQA==}
prebuild-install@7.1.2:
resolution: {integrity: sha512-UnNke3IQb6sgarcZIDU3gbMeTp/9SSU1DAIkil7PrqG1vZlBtY5msYccSKSHDqa3hNg436IXK+SNImReuA1wEQ==}
@@ -13402,6 +13646,10 @@ packages:
resolution: {integrity: sha512-YWD03n3shzV9ImZRX3ccbjqLxj7NokGN0V/ESiBV5xWqrommYHYiihuIyavq03pWSGqlyvYUFmfoMKd+1rPA/g==}
engines: {node: '>=12.0.0'}
+ protobufjs@7.4.0:
+ resolution: {integrity: sha512-mRUWCc3KUU4w1jU8sGxICXH/gNS94DvI1gxqDvBzhj1JpcsimQkYiOJfwsPUykUI5ZaspFbSgmBLER8IrQ3tqw==}
+ engines: {node: '>=12.0.0'}
+
protons-runtime@5.5.0:
resolution: {integrity: sha512-EsALjF9QsrEk6gbCx3lmfHxVN0ah7nG3cY7GySD4xf4g8cr7g543zB88Foh897Sr1RQJ9yDCUsoT1i1H/cVUFA==}
@@ -13419,6 +13667,9 @@ packages:
proxy-from-env@1.1.0:
resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==}
+ psl@1.10.0:
+ resolution: {integrity: sha512-KSKHEbjAnpUuAUserOq0FxGXCUrzC3WniuSJhvdbs102rL55266ZcHBqLWOsG30spQMlPdpy7icATiAQehg/iA==}
+
psl@1.9.0:
resolution: {integrity: sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==}
@@ -13987,6 +14238,10 @@ packages:
resolution: {integrity: sha512-NcDiDkTLuPR+++OCKB0nWafEmhg/Da8aUPLPMQbK+bxKKCm1/S5he+AqYa4PlMCVBalb4/yxIRub6qkEx5yJbw==}
engines: {node: '>= 0.4'}
+ regexp.prototype.flags@1.5.3:
+ resolution: {integrity: sha512-vqlC04+RQoFalODCbCumG2xIOvapzVMHwsyIGM/SIE8fRhFFsXeH8/QQ+s0T0kDAhKc4k30s73/0ydkHQz6HlQ==}
+ engines: {node: '>= 0.4'}
+
regexpu-core@5.3.2:
resolution: {integrity: sha512-RAM5FlZz+Lhmo7db9L298p2vHP5ZywrVXmVXpmAD9GuL5MPH6t9ROw1iA/wfHkQ76Qe7AaPF0nGuim96/IrQMQ==}
engines: {node: '>=4'}
@@ -13998,8 +14253,8 @@ packages:
regjsgen@0.8.0:
resolution: {integrity: sha512-RvwtGe3d7LvWiDQXeQw8p5asZUmfU1G/l6WbUXeHta7Y2PEIvBTwH6E2EfmYUK8pxcxEdEmaomqyp0vZZ7C+3Q==}
- regjsparser@0.11.1:
- resolution: {integrity: sha512-1DHODs4B8p/mQHU9kr+jv8+wIC9mtG4eBHxWxIq5mhjE3D5oORhCc6deRKzTjs9DcfRFmj9BHSDguZklqCGFWQ==}
+ regjsparser@0.11.2:
+ resolution: {integrity: sha512-3OGZZ4HoLJkkAZx/48mTXJNlmqTGOzc0o9OWQPuWpkOlXXPbyN6OafCcoXUnBqE2D3f/T5L+pWc1kdEmnfnRsA==}
hasBin: true
regjsparser@0.9.1:
@@ -14149,8 +14404,8 @@ packages:
rollup-pluginutils@2.8.2:
resolution: {integrity: sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ==}
- rollup@4.18.0:
- resolution: {integrity: sha512-QmJz14PX3rzbJCN1SG4Xe/bAAX2a6NpCP8ab2vfu2GiUr8AQcr2nCV/oEO3yneFarB67zk8ShlIyWb2LGTb3Sg==}
+ rollup@4.26.0:
+ resolution: {integrity: sha512-ilcl12hnWonG8f+NxU6BlgysVA0gvY2l8N0R84S1HcINbW20bvwuCngJkkInV6LXhwRpucsW5k1ovDwEdBVrNg==}
engines: {node: '>=18.0.0', npm: '>=8.0.0'}
hasBin: true
@@ -14537,6 +14792,10 @@ packages:
resolution: {integrity: sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==}
engines: {node: '>=0.10.0'}
+ source-map-js@1.2.1:
+ resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==}
+ engines: {node: '>=0.10.0'}
+
source-map-support@0.5.21:
resolution: {integrity: sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==}
@@ -14984,8 +15243,8 @@ packages:
engines: {node: '>=10'}
hasBin: true
- terser@5.34.1:
- resolution: {integrity: sha512-FsJZ7iZLd/BXkz+4xrRTGJ26o/6VTjQytUk8b8OxkwcD2I+79VPJlz7qss1+zE7h8GNIScFqXcDyJ/KqBYZFVA==}
+ terser@5.36.0:
+ resolution: {integrity: sha512-IYV9eNMuFAV4THUspIRXkLakHnV6XO7FEdtKjf/mDyrnqUg9LnlOn6/RwRvM9SZjR4GUq8Nk8zj67FzVARr74w==}
engines: {node: '>=10'}
hasBin: true
@@ -15192,6 +15451,9 @@ packages:
tslib@2.7.0:
resolution: {integrity: sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==}
+ tslib@2.8.1:
+ resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==}
+
tslint@5.20.1:
resolution: {integrity: sha512-EcMxhzCFt8k+/UP5r8waCf/lzmeSyVlqxqMEDQE7rWYiQky8KpIBz1JAoYXfROHrPZ1XXd43q8yQnULOLiBRQg==}
engines: {node: '>=4.8.0'}
@@ -15375,6 +15637,9 @@ packages:
undici-types@5.26.5:
resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==}
+ undici-types@6.19.8:
+ resolution: {integrity: sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==}
+
undici@5.28.4:
resolution: {integrity: sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==}
engines: {node: '>=14.0'}
@@ -15386,8 +15651,8 @@ packages:
unenv-nightly@2.0.0-20241018-011344-e666fcf:
resolution: {integrity: sha512-D00bYn8rzkCBOlLx+k1iHQlc69jvtJRT7Eek4yIGQ6461a2tUBjngGZdRpqsoXAJCz/qBW0NgPting7Zvg+ysg==}
- unenv@1.9.0:
- resolution: {integrity: sha512-QKnFNznRxmbOF1hDgzpqrlIf6NC5sbZ2OJ+5Wl3OX8uM+LUJXbj4TXvLJCtwbPTmbMHCLIz6JLKNinNsMShK9g==}
+ unenv@1.10.0:
+ resolution: {integrity: sha512-wY5bskBQFL9n3Eca5XnhH6KbUo/tfvkwm9OpcdCvLaeA7piBNbavbOKJySEwQ1V0RH6HvNlSAFRTpvTqgKRQXQ==}
unfetch@4.2.0:
resolution: {integrity: sha512-F9p7yYCn6cIW9El1zi0HI6vqpeIvBsr3dSuRO6Xuppb1u5rXpCPmMvLSyECLhybr9isec8Ohl0hPekMVrEinDA==}
@@ -15714,6 +15979,14 @@ packages:
typescript:
optional: true
+ viem@2.21.45:
+ resolution: {integrity: sha512-I+On/IiaObQdhDKWU5Rurh6nf3G7reVkAODG5ECIfjsrGQ3EPJnxirUPT4FNV6bWER5iphoG62/TidwuTSOA1A==}
+ peerDependencies:
+ typescript: '>=5.0.4'
+ peerDependenciesMeta:
+ typescript:
+ optional: true
+
vite-bundle-visualizer@1.2.1:
resolution: {integrity: sha512-cwz/Pg6+95YbgIDp+RPwEToc4TKxfsFWSG/tsl2DSZd9YZicUag1tQXjJ5xcL7ydvEoaC2FOZeaXOU60t9BRXw==}
engines: {node: ^18.19.0 || >=20.6.0}
@@ -15742,8 +16015,8 @@ packages:
vite:
optional: true
- vite@5.2.12:
- resolution: {integrity: sha512-/gC8GxzxMK5ntBwb48pR32GGhENnjtY30G4A0jemunsBkiEZFw60s8InGpN8gkhHEkjnRK1aSAxeQgwvFhUHAA==}
+ vite@5.4.11:
+ resolution: {integrity: sha512-c7jFQRklXua0mTzneGW9QVyxFjUgwcihC4bXEtujIo2ouWCe1Ajt/amn2PCxYnhYfd5k09JX3SB7OYWFKYqj8Q==}
engines: {node: ^18.0.0 || >=20.0.0}
hasBin: true
peerDependencies:
@@ -15751,6 +16024,7 @@ packages:
less: '*'
lightningcss: ^1.21.0
sass: '*'
+ sass-embedded: '*'
stylus: '*'
sugarss: '*'
terser: ^5.4.0
@@ -15763,6 +16037,8 @@ packages:
optional: true
sass:
optional: true
+ sass-embedded:
+ optional: true
stylus:
optional: true
sugarss:
@@ -16288,8 +16564,8 @@ packages:
engines: {node: '>= 14'}
hasBin: true
- yaml@2.5.1:
- resolution: {integrity: sha512-bLQOjaX/ADgQ20isPJRvF0iRUHIxVhYvr53Of7wGcWlO2jvtUlH5m87DsmulFVxRpNLOnI4tB6p/oh8D7kpn9Q==}
+ yaml@2.6.0:
+ resolution: {integrity: sha512-a6ae//JvKDEra2kdi1qzCyrJW/WZCgFi8ydDV+eXExl95t+5R+ijnqHJbz9tmMh8FUjx3iv2fCQ4dclAQlO2UQ==}
engines: {node: '>= 14'}
hasBin: true
@@ -16425,7 +16701,7 @@ snapshots:
- typescript
optional: true
- '@alchemy/aa-alchemy@3.19.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@tanstack/react-query@4.36.1(react-dom@18.3.1(react@18.3.1))(react-native@0.74.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1))(@types/react@18.3.3)(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-i18next@13.5.0(i18next@23.11.5)(react-dom@18.3.1(react@18.3.1))(react-native@0.74.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1))(react-native@0.74.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(rollup@4.18.0)(typescript@5.4.5)(utf-8-validate@5.0.10)(viem@2.21.0(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@5.0.10)(zod@3.23.6))':
+ '@alchemy/aa-alchemy@3.19.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@tanstack/react-query@4.36.1(react-dom@18.3.1(react@18.3.1))(react-native@0.74.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1))(@types/react@18.3.3)(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-i18next@13.5.0(i18next@23.11.5)(react-dom@18.3.1(react@18.3.1))(react-native@0.74.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1))(react-native@0.74.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(rollup@4.26.0)(typescript@5.4.5)(utf-8-validate@5.0.10)(viem@2.21.0(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@5.0.10)(zod@3.23.6))':
dependencies:
'@alchemy/aa-core': 3.19.0(typescript@5.4.5)(viem@2.21.0(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@5.0.10)(zod@3.23.6))
'@tanstack/react-form': 0.19.5(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
@@ -16434,12 +16710,12 @@ snapshots:
'@turnkey/iframe-stamper': 1.2.0
'@turnkey/viem': 0.4.29(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10)(viem@2.21.0(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@5.0.10)(zod@3.23.6))
'@turnkey/webauthn-stamper': 0.4.3
- '@wagmi/connectors': 4.3.10(@types/react@18.3.3)(@wagmi/core@2.13.4(@types/react@18.3.3)(react@18.3.1)(typescript@5.4.5)(viem@2.21.0(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@5.0.10)(zod@3.23.6)))(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-i18next@13.5.0(i18next@23.11.5)(react-dom@18.3.1(react@18.3.1))(react-native@0.74.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1))(react-native@0.74.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(rollup@4.18.0)(typescript@5.4.5)(utf-8-validate@5.0.10)(viem@2.21.0(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@5.0.10)(zod@3.23.6))(zod@3.23.6)
+ '@wagmi/connectors': 4.3.10(@types/react@18.3.3)(@wagmi/core@2.13.4(@types/react@18.3.3)(react@18.3.1)(typescript@5.4.5)(viem@2.21.0(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@5.0.10)(zod@3.23.6)))(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-i18next@13.5.0(i18next@23.11.5)(react-dom@18.3.1(react@18.3.1))(react-native@0.74.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1))(react-native@0.74.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(rollup@4.26.0)(typescript@5.4.5)(utf-8-validate@5.0.10)(viem@2.21.0(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@5.0.10)(zod@3.23.6))(zod@3.23.6)
'@wagmi/core': 2.13.4(@types/react@18.3.3)(react@18.3.1)(typescript@5.4.5)(viem@2.21.0(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@5.0.10)(zod@3.23.6))
eventemitter3: 5.0.1
js-cookie: 3.0.5
viem: 2.21.0(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@5.0.10)(zod@3.23.6)
- wagmi: 2.12.8(@tanstack/react-query@4.36.1(react-dom@18.3.1(react@18.3.1))(react-native@0.74.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1))(@types/react@18.3.3)(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-native@0.74.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(rollup@4.18.0)(typescript@5.4.5)(utf-8-validate@5.0.10)(viem@2.21.0(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@5.0.10)(zod@3.23.6))(zod@3.23.6)
+ wagmi: 2.12.8(@tanstack/react-query@4.36.1(react-dom@18.3.1(react@18.3.1))(react-native@0.74.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1))(@types/react@18.3.3)(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-native@0.74.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(rollup@4.26.0)(typescript@5.4.5)(utf-8-validate@5.0.10)(viem@2.21.0(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@5.0.10)(zod@3.23.6))(zod@3.23.6)
zod: 3.23.6
zustand: 4.5.2(@types/react@18.3.3)(react@18.3.1)
optionalDependencies:
@@ -16588,8 +16864,8 @@ snapshots:
'@aws-crypto/sha1-browser': 3.0.0
'@aws-crypto/sha256-browser': 3.0.0
'@aws-crypto/sha256-js': 3.0.0
- '@aws-sdk/client-sso-oidc': 3.577.0
- '@aws-sdk/client-sts': 3.577.0(@aws-sdk/client-sso-oidc@3.577.0)
+ '@aws-sdk/client-sso-oidc': 3.577.0(@aws-sdk/client-sts@3.577.0)
+ '@aws-sdk/client-sts': 3.577.0
'@aws-sdk/core': 3.576.0
'@aws-sdk/credential-provider-node': 3.577.0(@aws-sdk/client-sso-oidc@3.577.0)(@aws-sdk/client-sts@3.577.0)
'@aws-sdk/middleware-bucket-endpoint': 3.577.0
@@ -16646,11 +16922,11 @@ snapshots:
transitivePeerDependencies:
- aws-crt
- '@aws-sdk/client-sso-oidc@3.577.0':
+ '@aws-sdk/client-sso-oidc@3.577.0(@aws-sdk/client-sts@3.577.0)':
dependencies:
'@aws-crypto/sha256-browser': 3.0.0
'@aws-crypto/sha256-js': 3.0.0
- '@aws-sdk/client-sts': 3.577.0(@aws-sdk/client-sso-oidc@3.577.0)
+ '@aws-sdk/client-sts': 3.577.0
'@aws-sdk/core': 3.576.0
'@aws-sdk/credential-provider-node': 3.577.0(@aws-sdk/client-sso-oidc@3.577.0)(@aws-sdk/client-sts@3.577.0)
'@aws-sdk/middleware-host-header': 3.577.0
@@ -16689,6 +16965,7 @@ snapshots:
'@smithy/util-utf8': 3.0.0
tslib: 2.7.0
transitivePeerDependencies:
+ - '@aws-sdk/client-sts'
- aws-crt
'@aws-sdk/client-sso@3.577.0':
@@ -16734,11 +17011,11 @@ snapshots:
transitivePeerDependencies:
- aws-crt
- '@aws-sdk/client-sts@3.577.0(@aws-sdk/client-sso-oidc@3.577.0)':
+ '@aws-sdk/client-sts@3.577.0':
dependencies:
'@aws-crypto/sha256-browser': 3.0.0
'@aws-crypto/sha256-js': 3.0.0
- '@aws-sdk/client-sso-oidc': 3.577.0
+ '@aws-sdk/client-sso-oidc': 3.577.0(@aws-sdk/client-sts@3.577.0)
'@aws-sdk/core': 3.576.0
'@aws-sdk/credential-provider-node': 3.577.0(@aws-sdk/client-sso-oidc@3.577.0)(@aws-sdk/client-sts@3.577.0)
'@aws-sdk/middleware-host-header': 3.577.0
@@ -16777,7 +17054,6 @@ snapshots:
'@smithy/util-utf8': 3.0.0
tslib: 2.7.0
transitivePeerDependencies:
- - '@aws-sdk/client-sso-oidc'
- aws-crt
'@aws-sdk/core@3.576.0':
@@ -16811,7 +17087,7 @@ snapshots:
'@aws-sdk/credential-provider-ini@3.577.0(@aws-sdk/client-sso-oidc@3.577.0)(@aws-sdk/client-sts@3.577.0)':
dependencies:
- '@aws-sdk/client-sts': 3.577.0(@aws-sdk/client-sso-oidc@3.577.0)
+ '@aws-sdk/client-sts': 3.577.0
'@aws-sdk/credential-provider-env': 3.577.0
'@aws-sdk/credential-provider-process': 3.577.0
'@aws-sdk/credential-provider-sso': 3.577.0(@aws-sdk/client-sso-oidc@3.577.0)
@@ -16868,7 +17144,7 @@ snapshots:
'@aws-sdk/credential-provider-web-identity@3.577.0(@aws-sdk/client-sts@3.577.0)':
dependencies:
- '@aws-sdk/client-sts': 3.577.0(@aws-sdk/client-sso-oidc@3.577.0)
+ '@aws-sdk/client-sts': 3.577.0
'@aws-sdk/types': 3.577.0
'@smithy/property-provider': 3.0.0
'@smithy/types': 3.0.0
@@ -17006,7 +17282,7 @@ snapshots:
'@aws-sdk/token-providers@3.577.0(@aws-sdk/client-sso-oidc@3.577.0)':
dependencies:
- '@aws-sdk/client-sso-oidc': 3.577.0
+ '@aws-sdk/client-sso-oidc': 3.577.0(@aws-sdk/client-sts@3.577.0)
'@aws-sdk/types': 3.577.0
'@smithy/property-provider': 3.0.0
'@smithy/shared-ini-file-loader': 3.0.0
@@ -17071,16 +17347,17 @@ snapshots:
'@babel/code-frame@7.24.7':
dependencies:
'@babel/highlight': 7.24.7
- picocolors: 1.0.1
+ picocolors: 1.1.1
- '@babel/code-frame@7.25.7':
+ '@babel/code-frame@7.26.2':
dependencies:
- '@babel/highlight': 7.25.7
- picocolors: 1.1.0
+ '@babel/helper-validator-identifier': 7.25.9
+ js-tokens: 4.0.0
+ picocolors: 1.1.1
'@babel/compat-data@7.25.2': {}
- '@babel/compat-data@7.25.7': {}
+ '@babel/compat-data@7.26.2': {}
'@babel/core@7.24.5':
dependencies:
@@ -17105,15 +17382,15 @@ snapshots:
'@babel/core@7.25.7':
dependencies:
'@ampproject/remapping': 2.3.0
- '@babel/code-frame': 7.25.7
- '@babel/generator': 7.25.7
- '@babel/helper-compilation-targets': 7.25.7
- '@babel/helper-module-transforms': 7.25.7(@babel/core@7.25.7)
- '@babel/helpers': 7.25.7
- '@babel/parser': 7.25.7
- '@babel/template': 7.25.7
- '@babel/traverse': 7.25.7
- '@babel/types': 7.25.7
+ '@babel/code-frame': 7.26.2
+ '@babel/generator': 7.26.2
+ '@babel/helper-compilation-targets': 7.25.9
+ '@babel/helper-module-transforms': 7.26.0(@babel/core@7.25.7)
+ '@babel/helpers': 7.26.0
+ '@babel/parser': 7.26.2
+ '@babel/template': 7.25.9
+ '@babel/traverse': 7.25.9
+ '@babel/types': 7.26.0
convert-source-map: 2.0.0
debug: 4.3.7
gensync: 1.0.0-beta.2
@@ -17130,9 +17407,10 @@ snapshots:
'@jridgewell/trace-mapping': 0.3.25
jsesc: 2.5.2
- '@babel/generator@7.25.7':
+ '@babel/generator@7.26.2':
dependencies:
- '@babel/types': 7.25.7
+ '@babel/parser': 7.26.2
+ '@babel/types': 7.26.0
'@jridgewell/gen-mapping': 0.3.5
'@jridgewell/trace-mapping': 0.3.25
jsesc: 3.0.2
@@ -17141,14 +17419,14 @@ snapshots:
dependencies:
'@babel/types': 7.25.2
- '@babel/helper-annotate-as-pure@7.25.7':
+ '@babel/helper-annotate-as-pure@7.25.9':
dependencies:
- '@babel/types': 7.25.7
+ '@babel/types': 7.26.0
- '@babel/helper-builder-binary-assignment-operator-visitor@7.25.7':
+ '@babel/helper-builder-binary-assignment-operator-visitor@7.25.9':
dependencies:
- '@babel/traverse': 7.25.7
- '@babel/types': 7.25.7
+ '@babel/traverse': 7.25.9
+ '@babel/types': 7.26.0
transitivePeerDependencies:
- supports-color
@@ -17160,11 +17438,11 @@ snapshots:
lru-cache: 5.1.1
semver: 6.3.1
- '@babel/helper-compilation-targets@7.25.7':
+ '@babel/helper-compilation-targets@7.25.9':
dependencies:
- '@babel/compat-data': 7.25.7
- '@babel/helper-validator-option': 7.25.7
- browserslist: 4.24.0
+ '@babel/compat-data': 7.26.2
+ '@babel/helper-validator-option': 7.25.9
+ browserslist: 4.24.2
lru-cache: 5.1.1
semver: 6.3.1
@@ -17181,28 +17459,28 @@ snapshots:
transitivePeerDependencies:
- supports-color
- '@babel/helper-create-class-features-plugin@7.25.7(@babel/core@7.24.5)':
+ '@babel/helper-create-class-features-plugin@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-annotate-as-pure': 7.25.7
- '@babel/helper-member-expression-to-functions': 7.25.7
- '@babel/helper-optimise-call-expression': 7.25.7
- '@babel/helper-replace-supers': 7.25.7(@babel/core@7.24.5)
- '@babel/helper-skip-transparent-expression-wrappers': 7.25.7
- '@babel/traverse': 7.25.7
+ '@babel/helper-annotate-as-pure': 7.25.9
+ '@babel/helper-member-expression-to-functions': 7.25.9
+ '@babel/helper-optimise-call-expression': 7.25.9
+ '@babel/helper-replace-supers': 7.25.9(@babel/core@7.24.5)
+ '@babel/helper-skip-transparent-expression-wrappers': 7.25.9
+ '@babel/traverse': 7.25.9
semver: 6.3.1
transitivePeerDependencies:
- supports-color
- '@babel/helper-create-class-features-plugin@7.25.7(@babel/core@7.25.7)':
+ '@babel/helper-create-class-features-plugin@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-annotate-as-pure': 7.25.7
- '@babel/helper-member-expression-to-functions': 7.25.7
- '@babel/helper-optimise-call-expression': 7.25.7
- '@babel/helper-replace-supers': 7.25.7(@babel/core@7.25.7)
- '@babel/helper-skip-transparent-expression-wrappers': 7.25.7
- '@babel/traverse': 7.25.7
+ '@babel/helper-annotate-as-pure': 7.25.9
+ '@babel/helper-member-expression-to-functions': 7.25.9
+ '@babel/helper-optimise-call-expression': 7.25.9
+ '@babel/helper-replace-supers': 7.25.9(@babel/core@7.25.7)
+ '@babel/helper-skip-transparent-expression-wrappers': 7.25.9
+ '@babel/traverse': 7.25.9
semver: 6.3.1
transitivePeerDependencies:
- supports-color
@@ -17215,17 +17493,17 @@ snapshots:
regexpu-core: 5.3.2
semver: 6.3.1
- '@babel/helper-create-regexp-features-plugin@7.25.7(@babel/core@7.24.5)':
+ '@babel/helper-create-regexp-features-plugin@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-annotate-as-pure': 7.25.7
+ '@babel/helper-annotate-as-pure': 7.25.9
regexpu-core: 6.1.1
semver: 6.3.1
- '@babel/helper-create-regexp-features-plugin@7.25.7(@babel/core@7.25.7)':
+ '@babel/helper-create-regexp-features-plugin@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-annotate-as-pure': 7.25.7
+ '@babel/helper-annotate-as-pure': 7.25.9
regexpu-core: 6.1.1
semver: 6.3.1
optional: true
@@ -17253,6 +17531,29 @@ snapshots:
- supports-color
optional: true
+ '@babel/helper-define-polyfill-provider@0.6.3(@babel/core@7.24.5)':
+ dependencies:
+ '@babel/core': 7.24.5
+ '@babel/helper-compilation-targets': 7.25.9
+ '@babel/helper-plugin-utils': 7.25.9
+ debug: 4.3.7
+ lodash.debounce: 4.0.8
+ resolve: 1.22.8
+ transitivePeerDependencies:
+ - supports-color
+
+ '@babel/helper-define-polyfill-provider@0.6.3(@babel/core@7.25.7)':
+ dependencies:
+ '@babel/core': 7.25.7
+ '@babel/helper-compilation-targets': 7.25.9
+ '@babel/helper-plugin-utils': 7.25.9
+ debug: 4.3.7
+ lodash.debounce: 4.0.8
+ resolve: 1.22.8
+ transitivePeerDependencies:
+ - supports-color
+ optional: true
+
'@babel/helper-environment-visitor@7.22.20': {}
'@babel/helper-member-expression-to-functions@7.24.8':
@@ -17262,10 +17563,10 @@ snapshots:
transitivePeerDependencies:
- supports-color
- '@babel/helper-member-expression-to-functions@7.25.7':
+ '@babel/helper-member-expression-to-functions@7.25.9':
dependencies:
- '@babel/traverse': 7.25.7
- '@babel/types': 7.25.7
+ '@babel/traverse': 7.25.9
+ '@babel/types': 7.26.0
transitivePeerDependencies:
- supports-color
@@ -17280,10 +17581,10 @@ snapshots:
transitivePeerDependencies:
- supports-color
- '@babel/helper-module-imports@7.25.7':
+ '@babel/helper-module-imports@7.25.9':
dependencies:
- '@babel/traverse': 7.25.7
- '@babel/types': 7.25.7
+ '@babel/traverse': 7.25.9
+ '@babel/types': 7.26.0
transitivePeerDependencies:
- supports-color
@@ -17297,23 +17598,21 @@ snapshots:
transitivePeerDependencies:
- supports-color
- '@babel/helper-module-transforms@7.25.7(@babel/core@7.24.5)':
+ '@babel/helper-module-transforms@7.26.0(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-module-imports': 7.25.7
- '@babel/helper-simple-access': 7.25.7
- '@babel/helper-validator-identifier': 7.25.7
- '@babel/traverse': 7.25.7
+ '@babel/helper-module-imports': 7.25.9
+ '@babel/helper-validator-identifier': 7.25.9
+ '@babel/traverse': 7.25.9
transitivePeerDependencies:
- supports-color
- '@babel/helper-module-transforms@7.25.7(@babel/core@7.25.7)':
+ '@babel/helper-module-transforms@7.26.0(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-module-imports': 7.25.7
- '@babel/helper-simple-access': 7.25.7
- '@babel/helper-validator-identifier': 7.25.7
- '@babel/traverse': 7.25.7
+ '@babel/helper-module-imports': 7.25.9
+ '@babel/helper-validator-identifier': 7.25.9
+ '@babel/traverse': 7.25.9
transitivePeerDependencies:
- supports-color
optional: true
@@ -17322,13 +17621,13 @@ snapshots:
dependencies:
'@babel/types': 7.25.2
- '@babel/helper-optimise-call-expression@7.25.7':
+ '@babel/helper-optimise-call-expression@7.25.9':
dependencies:
- '@babel/types': 7.25.7
+ '@babel/types': 7.26.0
'@babel/helper-plugin-utils@7.24.8': {}
- '@babel/helper-plugin-utils@7.25.7': {}
+ '@babel/helper-plugin-utils@7.25.9': {}
'@babel/helper-remap-async-to-generator@7.25.0(@babel/core@7.24.5)':
dependencies:
@@ -17339,21 +17638,21 @@ snapshots:
transitivePeerDependencies:
- supports-color
- '@babel/helper-remap-async-to-generator@7.25.7(@babel/core@7.24.5)':
+ '@babel/helper-remap-async-to-generator@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-annotate-as-pure': 7.25.7
- '@babel/helper-wrap-function': 7.25.7
- '@babel/traverse': 7.25.7
+ '@babel/helper-annotate-as-pure': 7.25.9
+ '@babel/helper-wrap-function': 7.25.9
+ '@babel/traverse': 7.25.9
transitivePeerDependencies:
- supports-color
- '@babel/helper-remap-async-to-generator@7.25.7(@babel/core@7.25.7)':
+ '@babel/helper-remap-async-to-generator@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-annotate-as-pure': 7.25.7
- '@babel/helper-wrap-function': 7.25.7
- '@babel/traverse': 7.25.7
+ '@babel/helper-annotate-as-pure': 7.25.9
+ '@babel/helper-wrap-function': 7.25.9
+ '@babel/traverse': 7.25.9
transitivePeerDependencies:
- supports-color
optional: true
@@ -17367,21 +17666,21 @@ snapshots:
transitivePeerDependencies:
- supports-color
- '@babel/helper-replace-supers@7.25.7(@babel/core@7.24.5)':
+ '@babel/helper-replace-supers@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-member-expression-to-functions': 7.25.7
- '@babel/helper-optimise-call-expression': 7.25.7
- '@babel/traverse': 7.25.7
+ '@babel/helper-member-expression-to-functions': 7.25.9
+ '@babel/helper-optimise-call-expression': 7.25.9
+ '@babel/traverse': 7.25.9
transitivePeerDependencies:
- supports-color
- '@babel/helper-replace-supers@7.25.7(@babel/core@7.25.7)':
+ '@babel/helper-replace-supers@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-member-expression-to-functions': 7.25.7
- '@babel/helper-optimise-call-expression': 7.25.7
- '@babel/traverse': 7.25.7
+ '@babel/helper-member-expression-to-functions': 7.25.9
+ '@babel/helper-optimise-call-expression': 7.25.9
+ '@babel/traverse': 7.25.9
transitivePeerDependencies:
- supports-color
optional: true
@@ -17393,10 +17692,10 @@ snapshots:
transitivePeerDependencies:
- supports-color
- '@babel/helper-simple-access@7.25.7':
+ '@babel/helper-simple-access@7.25.9':
dependencies:
- '@babel/traverse': 7.25.7
- '@babel/types': 7.25.7
+ '@babel/traverse': 7.25.9
+ '@babel/types': 7.26.0
transitivePeerDependencies:
- supports-color
@@ -17407,10 +17706,10 @@ snapshots:
transitivePeerDependencies:
- supports-color
- '@babel/helper-skip-transparent-expression-wrappers@7.25.7':
+ '@babel/helper-skip-transparent-expression-wrappers@7.25.9':
dependencies:
- '@babel/traverse': 7.25.7
- '@babel/types': 7.25.7
+ '@babel/traverse': 7.25.9
+ '@babel/types': 7.26.0
transitivePeerDependencies:
- supports-color
@@ -17418,17 +17717,17 @@ snapshots:
'@babel/helper-string-parser@7.24.8': {}
- '@babel/helper-string-parser@7.25.7': {}
+ '@babel/helper-string-parser@7.25.9': {}
'@babel/helper-validator-identifier@7.24.5': {}
'@babel/helper-validator-identifier@7.24.7': {}
- '@babel/helper-validator-identifier@7.25.7': {}
+ '@babel/helper-validator-identifier@7.25.9': {}
'@babel/helper-validator-option@7.24.8': {}
- '@babel/helper-validator-option@7.25.7': {}
+ '@babel/helper-validator-option@7.25.9': {}
'@babel/helper-wrap-function@7.25.0':
dependencies:
@@ -17438,11 +17737,11 @@ snapshots:
transitivePeerDependencies:
- supports-color
- '@babel/helper-wrap-function@7.25.7':
+ '@babel/helper-wrap-function@7.25.9':
dependencies:
- '@babel/template': 7.25.7
- '@babel/traverse': 7.25.7
- '@babel/types': 7.25.7
+ '@babel/template': 7.25.9
+ '@babel/traverse': 7.25.9
+ '@babel/types': 7.26.0
transitivePeerDependencies:
- supports-color
@@ -17454,10 +17753,10 @@ snapshots:
transitivePeerDependencies:
- supports-color
- '@babel/helpers@7.25.7':
+ '@babel/helpers@7.26.0':
dependencies:
- '@babel/template': 7.25.7
- '@babel/types': 7.25.7
+ '@babel/template': 7.25.9
+ '@babel/types': 7.26.0
optional: true
'@babel/highlight@7.24.5':
@@ -17472,14 +17771,7 @@ snapshots:
'@babel/helper-validator-identifier': 7.24.7
chalk: 2.4.2
js-tokens: 4.0.0
- picocolors: 1.0.1
-
- '@babel/highlight@7.25.7':
- dependencies:
- '@babel/helper-validator-identifier': 7.25.7
- chalk: 2.4.2
- js-tokens: 4.0.0
- picocolors: 1.1.0
+ picocolors: 1.1.1
'@babel/parser@7.24.5':
dependencies:
@@ -17493,81 +17785,81 @@ snapshots:
dependencies:
'@babel/types': 7.25.6
- '@babel/parser@7.25.7':
+ '@babel/parser@7.26.2':
dependencies:
- '@babel/types': 7.25.7
+ '@babel/types': 7.26.0
- '@babel/plugin-bugfix-firefox-class-in-computed-class-key@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-bugfix-firefox-class-in-computed-class-key@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/traverse': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
+ '@babel/traverse': 7.25.9
transitivePeerDependencies:
- supports-color
- '@babel/plugin-bugfix-firefox-class-in-computed-class-key@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-bugfix-firefox-class-in-computed-class-key@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/traverse': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
+ '@babel/traverse': 7.25.9
transitivePeerDependencies:
- supports-color
optional: true
- '@babel/plugin-bugfix-safari-class-field-initializer-scope@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-bugfix-safari-class-field-initializer-scope@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
- '@babel/plugin-bugfix-safari-class-field-initializer-scope@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-bugfix-safari-class-field-initializer-scope@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
optional: true
- '@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
- '@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
optional: true
- '@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/helper-skip-transparent-expression-wrappers': 7.25.7
- '@babel/plugin-transform-optional-chaining': 7.25.7(@babel/core@7.24.5)
+ '@babel/helper-plugin-utils': 7.25.9
+ '@babel/helper-skip-transparent-expression-wrappers': 7.25.9
+ '@babel/plugin-transform-optional-chaining': 7.25.9(@babel/core@7.24.5)
transitivePeerDependencies:
- supports-color
- '@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/helper-skip-transparent-expression-wrappers': 7.25.7
- '@babel/plugin-transform-optional-chaining': 7.25.7(@babel/core@7.25.7)
+ '@babel/helper-plugin-utils': 7.25.9
+ '@babel/helper-skip-transparent-expression-wrappers': 7.25.9
+ '@babel/plugin-transform-optional-chaining': 7.25.9(@babel/core@7.25.7)
transitivePeerDependencies:
- supports-color
optional: true
- '@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/traverse': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
+ '@babel/traverse': 7.25.9
transitivePeerDependencies:
- supports-color
- '@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/traverse': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
+ '@babel/traverse': 7.25.9
transitivePeerDependencies:
- supports-color
optional: true
@@ -17596,11 +17888,10 @@ snapshots:
'@babel/helper-plugin-utils': 7.24.8
'@babel/plugin-syntax-export-default-from': 7.24.7(@babel/core@7.24.5)
- '@babel/plugin-proposal-export-default-from@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-proposal-export-default-from@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/plugin-syntax-export-default-from': 7.25.7(@babel/core@7.25.7)
+ '@babel/helper-plugin-utils': 7.25.9
optional: true
'@babel/plugin-proposal-logical-assignment-operators@7.20.7(@babel/core@7.24.5)':
@@ -17668,23 +17959,23 @@ snapshots:
'@babel/plugin-syntax-class-properties@7.12.13(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
'@babel/plugin-syntax-class-properties@7.12.13(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
optional: true
'@babel/plugin-syntax-class-static-block@7.14.5(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
'@babel/plugin-syntax-class-static-block@7.14.5(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
optional: true
'@babel/plugin-syntax-dynamic-import@7.8.3(@babel/core@7.24.5)':
@@ -17703,21 +17994,21 @@ snapshots:
'@babel/core': 7.24.5
'@babel/helper-plugin-utils': 7.24.8
- '@babel/plugin-syntax-export-default-from@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-syntax-export-default-from@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
optional: true
'@babel/plugin-syntax-export-namespace-from@7.8.3(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
'@babel/plugin-syntax-export-namespace-from@7.8.3(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
optional: true
'@babel/plugin-syntax-flow@7.24.7(@babel/core@7.24.5)':
@@ -17731,54 +18022,54 @@ snapshots:
'@babel/helper-plugin-utils': 7.24.8
optional: true
- '@babel/plugin-syntax-flow@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-syntax-flow@7.26.0(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
optional: true
- '@babel/plugin-syntax-import-assertions@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-syntax-import-assertions@7.26.0(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
- '@babel/plugin-syntax-import-assertions@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-syntax-import-assertions@7.26.0(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
optional: true
- '@babel/plugin-syntax-import-attributes@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-syntax-import-attributes@7.26.0(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
- '@babel/plugin-syntax-import-attributes@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-syntax-import-attributes@7.26.0(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
optional: true
'@babel/plugin-syntax-import-meta@7.10.4(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
'@babel/plugin-syntax-import-meta@7.10.4(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
optional: true
'@babel/plugin-syntax-json-strings@7.8.3(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
'@babel/plugin-syntax-json-strings@7.8.3(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
optional: true
'@babel/plugin-syntax-jsx@7.24.7(@babel/core@7.24.5)':
@@ -17786,10 +18077,10 @@ snapshots:
'@babel/core': 7.24.5
'@babel/helper-plugin-utils': 7.24.8
- '@babel/plugin-syntax-jsx@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-syntax-jsx@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
optional: true
'@babel/plugin-syntax-logical-assignment-operators@7.10.4(@babel/core@7.24.5)':
@@ -17872,12 +18163,12 @@ snapshots:
'@babel/plugin-syntax-top-level-await@7.14.5(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
'@babel/plugin-syntax-top-level-await@7.14.5(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
optional: true
'@babel/plugin-syntax-typescript@7.24.7(@babel/core@7.24.5)':
@@ -17885,23 +18176,23 @@ snapshots:
'@babel/core': 7.24.5
'@babel/helper-plugin-utils': 7.24.8
- '@babel/plugin-syntax-typescript@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-syntax-typescript@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
optional: true
'@babel/plugin-syntax-unicode-sets-regex@7.18.6(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-create-regexp-features-plugin': 7.25.7(@babel/core@7.24.5)
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-create-regexp-features-plugin': 7.25.9(@babel/core@7.24.5)
+ '@babel/helper-plugin-utils': 7.25.9
'@babel/plugin-syntax-unicode-sets-regex@7.18.6(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-create-regexp-features-plugin': 7.25.7(@babel/core@7.25.7)
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-create-regexp-features-plugin': 7.25.9(@babel/core@7.25.7)
+ '@babel/helper-plugin-utils': 7.25.9
optional: true
'@babel/plugin-transform-arrow-functions@7.24.7(@babel/core@7.24.5)':
@@ -17909,34 +18200,32 @@ snapshots:
'@babel/core': 7.24.5
'@babel/helper-plugin-utils': 7.24.8
- '@babel/plugin-transform-arrow-functions@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-transform-arrow-functions@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
- '@babel/plugin-transform-arrow-functions@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-arrow-functions@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
optional: true
- '@babel/plugin-transform-async-generator-functions@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-transform-async-generator-functions@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/helper-remap-async-to-generator': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-syntax-async-generators': 7.8.4(@babel/core@7.24.5)
- '@babel/traverse': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
+ '@babel/helper-remap-async-to-generator': 7.25.9(@babel/core@7.24.5)
+ '@babel/traverse': 7.25.9
transitivePeerDependencies:
- supports-color
- '@babel/plugin-transform-async-generator-functions@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-async-generator-functions@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/helper-remap-async-to-generator': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-syntax-async-generators': 7.8.4(@babel/core@7.25.7)
- '@babel/traverse': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
+ '@babel/helper-remap-async-to-generator': 7.25.9(@babel/core@7.25.7)
+ '@babel/traverse': 7.25.9
transitivePeerDependencies:
- supports-color
optional: true
@@ -17950,34 +18239,34 @@ snapshots:
transitivePeerDependencies:
- supports-color
- '@babel/plugin-transform-async-to-generator@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-transform-async-to-generator@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-module-imports': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/helper-remap-async-to-generator': 7.25.7(@babel/core@7.24.5)
+ '@babel/helper-module-imports': 7.25.9
+ '@babel/helper-plugin-utils': 7.25.9
+ '@babel/helper-remap-async-to-generator': 7.25.9(@babel/core@7.24.5)
transitivePeerDependencies:
- supports-color
- '@babel/plugin-transform-async-to-generator@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-async-to-generator@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-module-imports': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/helper-remap-async-to-generator': 7.25.7(@babel/core@7.25.7)
+ '@babel/helper-module-imports': 7.25.9
+ '@babel/helper-plugin-utils': 7.25.9
+ '@babel/helper-remap-async-to-generator': 7.25.9(@babel/core@7.25.7)
transitivePeerDependencies:
- supports-color
optional: true
- '@babel/plugin-transform-block-scoped-functions@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-transform-block-scoped-functions@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
- '@babel/plugin-transform-block-scoped-functions@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-block-scoped-functions@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
optional: true
'@babel/plugin-transform-block-scoping@7.25.0(@babel/core@7.24.5)':
@@ -17985,49 +18274,47 @@ snapshots:
'@babel/core': 7.24.5
'@babel/helper-plugin-utils': 7.24.8
- '@babel/plugin-transform-block-scoping@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-transform-block-scoping@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
- '@babel/plugin-transform-block-scoping@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-block-scoping@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
optional: true
- '@babel/plugin-transform-class-properties@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-transform-class-properties@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-create-class-features-plugin': 7.25.7(@babel/core@7.24.5)
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-create-class-features-plugin': 7.25.9(@babel/core@7.24.5)
+ '@babel/helper-plugin-utils': 7.25.9
transitivePeerDependencies:
- supports-color
- '@babel/plugin-transform-class-properties@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-class-properties@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-create-class-features-plugin': 7.25.7(@babel/core@7.25.7)
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-create-class-features-plugin': 7.25.9(@babel/core@7.25.7)
+ '@babel/helper-plugin-utils': 7.25.9
transitivePeerDependencies:
- supports-color
optional: true
- '@babel/plugin-transform-class-static-block@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-transform-class-static-block@7.26.0(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-create-class-features-plugin': 7.25.7(@babel/core@7.24.5)
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/plugin-syntax-class-static-block': 7.14.5(@babel/core@7.24.5)
+ '@babel/helper-create-class-features-plugin': 7.25.9(@babel/core@7.24.5)
+ '@babel/helper-plugin-utils': 7.25.9
transitivePeerDependencies:
- supports-color
- '@babel/plugin-transform-class-static-block@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-class-static-block@7.26.0(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-create-class-features-plugin': 7.25.7(@babel/core@7.25.7)
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/plugin-syntax-class-static-block': 7.14.5(@babel/core@7.25.7)
+ '@babel/helper-create-class-features-plugin': 7.25.9(@babel/core@7.25.7)
+ '@babel/helper-plugin-utils': 7.25.9
transitivePeerDependencies:
- supports-color
optional: true
@@ -18044,26 +18331,26 @@ snapshots:
transitivePeerDependencies:
- supports-color
- '@babel/plugin-transform-classes@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-transform-classes@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-annotate-as-pure': 7.25.7
- '@babel/helper-compilation-targets': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/helper-replace-supers': 7.25.7(@babel/core@7.24.5)
- '@babel/traverse': 7.25.7
+ '@babel/helper-annotate-as-pure': 7.25.9
+ '@babel/helper-compilation-targets': 7.25.9
+ '@babel/helper-plugin-utils': 7.25.9
+ '@babel/helper-replace-supers': 7.25.9(@babel/core@7.24.5)
+ '@babel/traverse': 7.25.9
globals: 11.12.0
transitivePeerDependencies:
- supports-color
- '@babel/plugin-transform-classes@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-classes@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-annotate-as-pure': 7.25.7
- '@babel/helper-compilation-targets': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/helper-replace-supers': 7.25.7(@babel/core@7.25.7)
- '@babel/traverse': 7.25.7
+ '@babel/helper-annotate-as-pure': 7.25.9
+ '@babel/helper-compilation-targets': 7.25.9
+ '@babel/helper-plugin-utils': 7.25.9
+ '@babel/helper-replace-supers': 7.25.9(@babel/core@7.25.7)
+ '@babel/traverse': 7.25.9
globals: 11.12.0
transitivePeerDependencies:
- supports-color
@@ -18075,17 +18362,17 @@ snapshots:
'@babel/helper-plugin-utils': 7.24.8
'@babel/template': 7.25.0
- '@babel/plugin-transform-computed-properties@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-transform-computed-properties@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/template': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
+ '@babel/template': 7.25.9
- '@babel/plugin-transform-computed-properties@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-computed-properties@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/template': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
+ '@babel/template': 7.25.9
optional: true
'@babel/plugin-transform-destructuring@7.24.8(@babel/core@7.24.5)':
@@ -18093,95 +18380,91 @@ snapshots:
'@babel/core': 7.24.5
'@babel/helper-plugin-utils': 7.24.8
- '@babel/plugin-transform-destructuring@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-transform-destructuring@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
- '@babel/plugin-transform-destructuring@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-destructuring@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
optional: true
- '@babel/plugin-transform-dotall-regex@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-transform-dotall-regex@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-create-regexp-features-plugin': 7.25.7(@babel/core@7.24.5)
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-create-regexp-features-plugin': 7.25.9(@babel/core@7.24.5)
+ '@babel/helper-plugin-utils': 7.25.9
- '@babel/plugin-transform-dotall-regex@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-dotall-regex@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-create-regexp-features-plugin': 7.25.7(@babel/core@7.25.7)
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-create-regexp-features-plugin': 7.25.9(@babel/core@7.25.7)
+ '@babel/helper-plugin-utils': 7.25.9
optional: true
- '@babel/plugin-transform-duplicate-keys@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-transform-duplicate-keys@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
- '@babel/plugin-transform-duplicate-keys@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-duplicate-keys@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
optional: true
- '@babel/plugin-transform-duplicate-named-capturing-groups-regex@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-transform-duplicate-named-capturing-groups-regex@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-create-regexp-features-plugin': 7.25.7(@babel/core@7.24.5)
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-create-regexp-features-plugin': 7.25.9(@babel/core@7.24.5)
+ '@babel/helper-plugin-utils': 7.25.9
- '@babel/plugin-transform-duplicate-named-capturing-groups-regex@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-duplicate-named-capturing-groups-regex@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-create-regexp-features-plugin': 7.25.7(@babel/core@7.25.7)
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-create-regexp-features-plugin': 7.25.9(@babel/core@7.25.7)
+ '@babel/helper-plugin-utils': 7.25.9
optional: true
- '@babel/plugin-transform-dynamic-import@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-transform-dynamic-import@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/plugin-syntax-dynamic-import': 7.8.3(@babel/core@7.24.5)
+ '@babel/helper-plugin-utils': 7.25.9
- '@babel/plugin-transform-dynamic-import@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-dynamic-import@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/plugin-syntax-dynamic-import': 7.8.3(@babel/core@7.25.7)
+ '@babel/helper-plugin-utils': 7.25.9
optional: true
- '@babel/plugin-transform-exponentiation-operator@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-transform-exponentiation-operator@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-builder-binary-assignment-operator-visitor': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-builder-binary-assignment-operator-visitor': 7.25.9
+ '@babel/helper-plugin-utils': 7.25.9
transitivePeerDependencies:
- supports-color
- '@babel/plugin-transform-exponentiation-operator@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-exponentiation-operator@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-builder-binary-assignment-operator-visitor': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-builder-binary-assignment-operator-visitor': 7.25.9
+ '@babel/helper-plugin-utils': 7.25.9
transitivePeerDependencies:
- supports-color
optional: true
- '@babel/plugin-transform-export-namespace-from@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-transform-export-namespace-from@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/plugin-syntax-export-namespace-from': 7.8.3(@babel/core@7.24.5)
+ '@babel/helper-plugin-utils': 7.25.9
- '@babel/plugin-transform-export-namespace-from@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-export-namespace-from@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/plugin-syntax-export-namespace-from': 7.8.3(@babel/core@7.25.7)
+ '@babel/helper-plugin-utils': 7.25.9
optional: true
'@babel/plugin-transform-flow-strip-types@7.25.2(@babel/core@7.24.5)':
@@ -18190,26 +18473,26 @@ snapshots:
'@babel/helper-plugin-utils': 7.24.8
'@babel/plugin-syntax-flow': 7.24.7(@babel/core@7.24.5)
- '@babel/plugin-transform-flow-strip-types@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-flow-strip-types@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/plugin-syntax-flow': 7.25.7(@babel/core@7.25.7)
+ '@babel/helper-plugin-utils': 7.25.9
+ '@babel/plugin-syntax-flow': 7.26.0(@babel/core@7.25.7)
optional: true
- '@babel/plugin-transform-for-of@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-transform-for-of@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/helper-skip-transparent-expression-wrappers': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
+ '@babel/helper-skip-transparent-expression-wrappers': 7.25.9
transitivePeerDependencies:
- supports-color
- '@babel/plugin-transform-for-of@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-for-of@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/helper-skip-transparent-expression-wrappers': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
+ '@babel/helper-skip-transparent-expression-wrappers': 7.25.9
transitivePeerDependencies:
- supports-color
optional: true
@@ -18223,36 +18506,34 @@ snapshots:
transitivePeerDependencies:
- supports-color
- '@babel/plugin-transform-function-name@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-transform-function-name@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-compilation-targets': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/traverse': 7.25.7
+ '@babel/helper-compilation-targets': 7.25.9
+ '@babel/helper-plugin-utils': 7.25.9
+ '@babel/traverse': 7.25.9
transitivePeerDependencies:
- supports-color
- '@babel/plugin-transform-function-name@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-function-name@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-compilation-targets': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/traverse': 7.25.7
+ '@babel/helper-compilation-targets': 7.25.9
+ '@babel/helper-plugin-utils': 7.25.9
+ '@babel/traverse': 7.25.9
transitivePeerDependencies:
- supports-color
optional: true
- '@babel/plugin-transform-json-strings@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-transform-json-strings@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/plugin-syntax-json-strings': 7.8.3(@babel/core@7.24.5)
+ '@babel/helper-plugin-utils': 7.25.9
- '@babel/plugin-transform-json-strings@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-json-strings@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/plugin-syntax-json-strings': 7.8.3(@babel/core@7.25.7)
+ '@babel/helper-plugin-utils': 7.25.9
optional: true
'@babel/plugin-transform-literals@7.25.2(@babel/core@7.24.5)':
@@ -18260,54 +18541,52 @@ snapshots:
'@babel/core': 7.24.5
'@babel/helper-plugin-utils': 7.24.8
- '@babel/plugin-transform-literals@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-transform-literals@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
- '@babel/plugin-transform-literals@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-literals@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
optional: true
- '@babel/plugin-transform-logical-assignment-operators@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-transform-logical-assignment-operators@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/plugin-syntax-logical-assignment-operators': 7.10.4(@babel/core@7.24.5)
+ '@babel/helper-plugin-utils': 7.25.9
- '@babel/plugin-transform-logical-assignment-operators@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-logical-assignment-operators@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/plugin-syntax-logical-assignment-operators': 7.10.4(@babel/core@7.25.7)
+ '@babel/helper-plugin-utils': 7.25.9
optional: true
- '@babel/plugin-transform-member-expression-literals@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-transform-member-expression-literals@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
- '@babel/plugin-transform-member-expression-literals@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-member-expression-literals@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
optional: true
- '@babel/plugin-transform-modules-amd@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-transform-modules-amd@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-module-transforms': 7.25.7(@babel/core@7.24.5)
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-module-transforms': 7.26.0(@babel/core@7.24.5)
+ '@babel/helper-plugin-utils': 7.25.9
transitivePeerDependencies:
- supports-color
- '@babel/plugin-transform-modules-amd@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-modules-amd@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-module-transforms': 7.25.7(@babel/core@7.25.7)
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-module-transforms': 7.26.0(@babel/core@7.25.7)
+ '@babel/helper-plugin-utils': 7.25.9
transitivePeerDependencies:
- supports-color
optional: true
@@ -18321,59 +18600,59 @@ snapshots:
transitivePeerDependencies:
- supports-color
- '@babel/plugin-transform-modules-commonjs@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-transform-modules-commonjs@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-module-transforms': 7.25.7(@babel/core@7.24.5)
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/helper-simple-access': 7.25.7
+ '@babel/helper-module-transforms': 7.26.0(@babel/core@7.24.5)
+ '@babel/helper-plugin-utils': 7.25.9
+ '@babel/helper-simple-access': 7.25.9
transitivePeerDependencies:
- supports-color
- '@babel/plugin-transform-modules-commonjs@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-modules-commonjs@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-module-transforms': 7.25.7(@babel/core@7.25.7)
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/helper-simple-access': 7.25.7
+ '@babel/helper-module-transforms': 7.26.0(@babel/core@7.25.7)
+ '@babel/helper-plugin-utils': 7.25.9
+ '@babel/helper-simple-access': 7.25.9
transitivePeerDependencies:
- supports-color
optional: true
- '@babel/plugin-transform-modules-systemjs@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-transform-modules-systemjs@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-module-transforms': 7.25.7(@babel/core@7.24.5)
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/helper-validator-identifier': 7.25.7
- '@babel/traverse': 7.25.7
+ '@babel/helper-module-transforms': 7.26.0(@babel/core@7.24.5)
+ '@babel/helper-plugin-utils': 7.25.9
+ '@babel/helper-validator-identifier': 7.25.9
+ '@babel/traverse': 7.25.9
transitivePeerDependencies:
- supports-color
- '@babel/plugin-transform-modules-systemjs@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-modules-systemjs@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-module-transforms': 7.25.7(@babel/core@7.25.7)
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/helper-validator-identifier': 7.25.7
- '@babel/traverse': 7.25.7
+ '@babel/helper-module-transforms': 7.26.0(@babel/core@7.25.7)
+ '@babel/helper-plugin-utils': 7.25.9
+ '@babel/helper-validator-identifier': 7.25.9
+ '@babel/traverse': 7.25.9
transitivePeerDependencies:
- supports-color
optional: true
- '@babel/plugin-transform-modules-umd@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-transform-modules-umd@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-module-transforms': 7.25.7(@babel/core@7.24.5)
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-module-transforms': 7.26.0(@babel/core@7.24.5)
+ '@babel/helper-plugin-utils': 7.25.9
transitivePeerDependencies:
- supports-color
- '@babel/plugin-transform-modules-umd@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-modules-umd@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-module-transforms': 7.25.7(@babel/core@7.25.7)
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-module-transforms': 7.26.0(@babel/core@7.25.7)
+ '@babel/helper-plugin-utils': 7.25.9
transitivePeerDependencies:
- supports-color
optional: true
@@ -18384,118 +18663,108 @@ snapshots:
'@babel/helper-create-regexp-features-plugin': 7.25.2(@babel/core@7.24.5)
'@babel/helper-plugin-utils': 7.24.8
- '@babel/plugin-transform-named-capturing-groups-regex@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-transform-named-capturing-groups-regex@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-create-regexp-features-plugin': 7.25.7(@babel/core@7.24.5)
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-create-regexp-features-plugin': 7.25.9(@babel/core@7.24.5)
+ '@babel/helper-plugin-utils': 7.25.9
- '@babel/plugin-transform-named-capturing-groups-regex@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-named-capturing-groups-regex@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-create-regexp-features-plugin': 7.25.7(@babel/core@7.25.7)
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-create-regexp-features-plugin': 7.25.9(@babel/core@7.25.7)
+ '@babel/helper-plugin-utils': 7.25.9
optional: true
- '@babel/plugin-transform-new-target@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-transform-new-target@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
- '@babel/plugin-transform-new-target@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-new-target@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
optional: true
- '@babel/plugin-transform-nullish-coalescing-operator@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-transform-nullish-coalescing-operator@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/plugin-syntax-nullish-coalescing-operator': 7.8.3(@babel/core@7.24.5)
+ '@babel/helper-plugin-utils': 7.25.9
- '@babel/plugin-transform-nullish-coalescing-operator@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-nullish-coalescing-operator@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/plugin-syntax-nullish-coalescing-operator': 7.8.3(@babel/core@7.25.7)
+ '@babel/helper-plugin-utils': 7.25.9
optional: true
- '@babel/plugin-transform-numeric-separator@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-transform-numeric-separator@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/plugin-syntax-numeric-separator': 7.10.4(@babel/core@7.24.5)
+ '@babel/helper-plugin-utils': 7.25.9
- '@babel/plugin-transform-numeric-separator@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-numeric-separator@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/plugin-syntax-numeric-separator': 7.10.4(@babel/core@7.25.7)
+ '@babel/helper-plugin-utils': 7.25.9
optional: true
- '@babel/plugin-transform-object-rest-spread@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-transform-object-rest-spread@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-compilation-targets': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/plugin-syntax-object-rest-spread': 7.8.3(@babel/core@7.24.5)
- '@babel/plugin-transform-parameters': 7.25.7(@babel/core@7.24.5)
+ '@babel/helper-compilation-targets': 7.25.9
+ '@babel/helper-plugin-utils': 7.25.9
+ '@babel/plugin-transform-parameters': 7.25.9(@babel/core@7.24.5)
- '@babel/plugin-transform-object-rest-spread@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-object-rest-spread@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-compilation-targets': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/plugin-syntax-object-rest-spread': 7.8.3(@babel/core@7.25.7)
- '@babel/plugin-transform-parameters': 7.25.7(@babel/core@7.25.7)
+ '@babel/helper-compilation-targets': 7.25.9
+ '@babel/helper-plugin-utils': 7.25.9
+ '@babel/plugin-transform-parameters': 7.25.9(@babel/core@7.25.7)
optional: true
- '@babel/plugin-transform-object-super@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-transform-object-super@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/helper-replace-supers': 7.25.7(@babel/core@7.24.5)
+ '@babel/helper-plugin-utils': 7.25.9
+ '@babel/helper-replace-supers': 7.25.9(@babel/core@7.24.5)
transitivePeerDependencies:
- supports-color
- '@babel/plugin-transform-object-super@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-object-super@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/helper-replace-supers': 7.25.7(@babel/core@7.25.7)
+ '@babel/helper-plugin-utils': 7.25.9
+ '@babel/helper-replace-supers': 7.25.9(@babel/core@7.25.7)
transitivePeerDependencies:
- supports-color
optional: true
- '@babel/plugin-transform-optional-catch-binding@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-transform-optional-catch-binding@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/plugin-syntax-optional-catch-binding': 7.8.3(@babel/core@7.24.5)
+ '@babel/helper-plugin-utils': 7.25.9
- '@babel/plugin-transform-optional-catch-binding@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-optional-catch-binding@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/plugin-syntax-optional-catch-binding': 7.8.3(@babel/core@7.25.7)
+ '@babel/helper-plugin-utils': 7.25.9
optional: true
- '@babel/plugin-transform-optional-chaining@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-transform-optional-chaining@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/helper-skip-transparent-expression-wrappers': 7.25.7
- '@babel/plugin-syntax-optional-chaining': 7.8.3(@babel/core@7.24.5)
+ '@babel/helper-plugin-utils': 7.25.9
+ '@babel/helper-skip-transparent-expression-wrappers': 7.25.9
transitivePeerDependencies:
- supports-color
- '@babel/plugin-transform-optional-chaining@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-optional-chaining@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/helper-skip-transparent-expression-wrappers': 7.25.7
- '@babel/plugin-syntax-optional-chaining': 7.8.3(@babel/core@7.25.7)
+ '@babel/helper-plugin-utils': 7.25.9
+ '@babel/helper-skip-transparent-expression-wrappers': 7.25.9
transitivePeerDependencies:
- supports-color
optional: true
@@ -18505,15 +18774,15 @@ snapshots:
'@babel/core': 7.24.5
'@babel/helper-plugin-utils': 7.24.8
- '@babel/plugin-transform-parameters@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-transform-parameters@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
- '@babel/plugin-transform-parameters@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-parameters@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
optional: true
'@babel/plugin-transform-private-methods@7.24.7(@babel/core@7.24.5)':
@@ -18524,19 +18793,19 @@ snapshots:
transitivePeerDependencies:
- supports-color
- '@babel/plugin-transform-private-methods@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-transform-private-methods@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-create-class-features-plugin': 7.25.7(@babel/core@7.24.5)
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-create-class-features-plugin': 7.25.9(@babel/core@7.24.5)
+ '@babel/helper-plugin-utils': 7.25.9
transitivePeerDependencies:
- supports-color
- '@babel/plugin-transform-private-methods@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-private-methods@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-create-class-features-plugin': 7.25.7(@babel/core@7.25.7)
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-create-class-features-plugin': 7.25.9(@babel/core@7.25.7)
+ '@babel/helper-plugin-utils': 7.25.9
transitivePeerDependencies:
- supports-color
optional: true
@@ -18551,36 +18820,34 @@ snapshots:
transitivePeerDependencies:
- supports-color
- '@babel/plugin-transform-private-property-in-object@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-transform-private-property-in-object@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-annotate-as-pure': 7.25.7
- '@babel/helper-create-class-features-plugin': 7.25.7(@babel/core@7.24.5)
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/plugin-syntax-private-property-in-object': 7.14.5(@babel/core@7.24.5)
+ '@babel/helper-annotate-as-pure': 7.25.9
+ '@babel/helper-create-class-features-plugin': 7.25.9(@babel/core@7.24.5)
+ '@babel/helper-plugin-utils': 7.25.9
transitivePeerDependencies:
- supports-color
- '@babel/plugin-transform-private-property-in-object@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-private-property-in-object@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-annotate-as-pure': 7.25.7
- '@babel/helper-create-class-features-plugin': 7.25.7(@babel/core@7.25.7)
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/plugin-syntax-private-property-in-object': 7.14.5(@babel/core@7.25.7)
+ '@babel/helper-annotate-as-pure': 7.25.9
+ '@babel/helper-create-class-features-plugin': 7.25.9(@babel/core@7.25.7)
+ '@babel/helper-plugin-utils': 7.25.9
transitivePeerDependencies:
- supports-color
optional: true
- '@babel/plugin-transform-property-literals@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-transform-property-literals@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
- '@babel/plugin-transform-property-literals@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-property-literals@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
optional: true
'@babel/plugin-transform-react-display-name@7.24.7(@babel/core@7.24.5)':
@@ -18588,10 +18855,10 @@ snapshots:
'@babel/core': 7.24.5
'@babel/helper-plugin-utils': 7.24.8
- '@babel/plugin-transform-react-display-name@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-react-display-name@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
optional: true
'@babel/plugin-transform-react-jsx-self@7.24.7(@babel/core@7.24.5)':
@@ -18599,10 +18866,10 @@ snapshots:
'@babel/core': 7.24.5
'@babel/helper-plugin-utils': 7.24.8
- '@babel/plugin-transform-react-jsx-self@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-react-jsx-self@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
optional: true
'@babel/plugin-transform-react-jsx-source@7.24.7(@babel/core@7.24.5)':
@@ -18610,10 +18877,10 @@ snapshots:
'@babel/core': 7.24.5
'@babel/helper-plugin-utils': 7.24.8
- '@babel/plugin-transform-react-jsx-source@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-react-jsx-source@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
optional: true
'@babel/plugin-transform-react-jsx@7.25.2(@babel/core@7.24.5)':
@@ -18627,40 +18894,40 @@ snapshots:
transitivePeerDependencies:
- supports-color
- '@babel/plugin-transform-react-jsx@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-react-jsx@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-annotate-as-pure': 7.25.7
- '@babel/helper-module-imports': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/plugin-syntax-jsx': 7.25.7(@babel/core@7.25.7)
- '@babel/types': 7.25.7
+ '@babel/helper-annotate-as-pure': 7.25.9
+ '@babel/helper-module-imports': 7.25.9
+ '@babel/helper-plugin-utils': 7.25.9
+ '@babel/plugin-syntax-jsx': 7.25.9(@babel/core@7.25.7)
+ '@babel/types': 7.26.0
transitivePeerDependencies:
- supports-color
optional: true
- '@babel/plugin-transform-regenerator@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-transform-regenerator@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
regenerator-transform: 0.15.2
- '@babel/plugin-transform-regenerator@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-regenerator@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
regenerator-transform: 0.15.2
optional: true
- '@babel/plugin-transform-reserved-words@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-transform-reserved-words@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
- '@babel/plugin-transform-reserved-words@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-reserved-words@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
optional: true
'@babel/plugin-transform-runtime@7.24.7(@babel/core@7.24.5)':
@@ -18675,14 +18942,14 @@ snapshots:
transitivePeerDependencies:
- supports-color
- '@babel/plugin-transform-runtime@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-runtime@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-module-imports': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
- babel-plugin-polyfill-corejs2: 0.4.11(@babel/core@7.25.7)
+ '@babel/helper-module-imports': 7.25.9
+ '@babel/helper-plugin-utils': 7.25.9
+ babel-plugin-polyfill-corejs2: 0.4.12(@babel/core@7.25.7)
babel-plugin-polyfill-corejs3: 0.10.6(@babel/core@7.25.7)
- babel-plugin-polyfill-regenerator: 0.6.2(@babel/core@7.25.7)
+ babel-plugin-polyfill-regenerator: 0.6.3(@babel/core@7.25.7)
semver: 6.3.1
transitivePeerDependencies:
- supports-color
@@ -18693,15 +18960,15 @@ snapshots:
'@babel/core': 7.24.5
'@babel/helper-plugin-utils': 7.24.8
- '@babel/plugin-transform-shorthand-properties@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-transform-shorthand-properties@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
- '@babel/plugin-transform-shorthand-properties@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-shorthand-properties@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
optional: true
'@babel/plugin-transform-spread@7.24.7(@babel/core@7.24.5)':
@@ -18712,19 +18979,19 @@ snapshots:
transitivePeerDependencies:
- supports-color
- '@babel/plugin-transform-spread@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-transform-spread@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/helper-skip-transparent-expression-wrappers': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
+ '@babel/helper-skip-transparent-expression-wrappers': 7.25.9
transitivePeerDependencies:
- supports-color
- '@babel/plugin-transform-spread@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-spread@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/helper-skip-transparent-expression-wrappers': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
+ '@babel/helper-skip-transparent-expression-wrappers': 7.25.9
transitivePeerDependencies:
- supports-color
optional: true
@@ -18734,37 +19001,37 @@ snapshots:
'@babel/core': 7.24.5
'@babel/helper-plugin-utils': 7.24.8
- '@babel/plugin-transform-sticky-regex@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-transform-sticky-regex@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
- '@babel/plugin-transform-sticky-regex@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-sticky-regex@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
optional: true
- '@babel/plugin-transform-template-literals@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-transform-template-literals@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
- '@babel/plugin-transform-template-literals@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-template-literals@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
optional: true
- '@babel/plugin-transform-typeof-symbol@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-transform-typeof-symbol@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
- '@babel/plugin-transform-typeof-symbol@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-typeof-symbol@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
optional: true
'@babel/plugin-transform-typescript@7.25.2(@babel/core@7.24.5)':
@@ -18778,40 +19045,40 @@ snapshots:
transitivePeerDependencies:
- supports-color
- '@babel/plugin-transform-typescript@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-typescript@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-annotate-as-pure': 7.25.7
- '@babel/helper-create-class-features-plugin': 7.25.7(@babel/core@7.25.7)
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/helper-skip-transparent-expression-wrappers': 7.25.7
- '@babel/plugin-syntax-typescript': 7.25.7(@babel/core@7.25.7)
+ '@babel/helper-annotate-as-pure': 7.25.9
+ '@babel/helper-create-class-features-plugin': 7.25.9(@babel/core@7.25.7)
+ '@babel/helper-plugin-utils': 7.25.9
+ '@babel/helper-skip-transparent-expression-wrappers': 7.25.9
+ '@babel/plugin-syntax-typescript': 7.25.9(@babel/core@7.25.7)
transitivePeerDependencies:
- supports-color
optional: true
- '@babel/plugin-transform-unicode-escapes@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-transform-unicode-escapes@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
- '@babel/plugin-transform-unicode-escapes@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-unicode-escapes@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
optional: true
- '@babel/plugin-transform-unicode-property-regex@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-transform-unicode-property-regex@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-create-regexp-features-plugin': 7.25.7(@babel/core@7.24.5)
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-create-regexp-features-plugin': 7.25.9(@babel/core@7.24.5)
+ '@babel/helper-plugin-utils': 7.25.9
- '@babel/plugin-transform-unicode-property-regex@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-unicode-property-regex@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-create-regexp-features-plugin': 7.25.7(@babel/core@7.25.7)
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-create-regexp-features-plugin': 7.25.9(@babel/core@7.25.7)
+ '@babel/helper-plugin-utils': 7.25.9
optional: true
'@babel/plugin-transform-unicode-regex@7.24.7(@babel/core@7.24.5)':
@@ -18820,52 +19087,52 @@ snapshots:
'@babel/helper-create-regexp-features-plugin': 7.25.2(@babel/core@7.24.5)
'@babel/helper-plugin-utils': 7.24.8
- '@babel/plugin-transform-unicode-regex@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-transform-unicode-regex@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-create-regexp-features-plugin': 7.25.7(@babel/core@7.24.5)
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-create-regexp-features-plugin': 7.25.9(@babel/core@7.24.5)
+ '@babel/helper-plugin-utils': 7.25.9
- '@babel/plugin-transform-unicode-regex@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-unicode-regex@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-create-regexp-features-plugin': 7.25.7(@babel/core@7.25.7)
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-create-regexp-features-plugin': 7.25.9(@babel/core@7.25.7)
+ '@babel/helper-plugin-utils': 7.25.9
optional: true
- '@babel/plugin-transform-unicode-sets-regex@7.25.7(@babel/core@7.24.5)':
+ '@babel/plugin-transform-unicode-sets-regex@7.25.9(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-create-regexp-features-plugin': 7.25.7(@babel/core@7.24.5)
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-create-regexp-features-plugin': 7.25.9(@babel/core@7.24.5)
+ '@babel/helper-plugin-utils': 7.25.9
- '@babel/plugin-transform-unicode-sets-regex@7.25.7(@babel/core@7.25.7)':
+ '@babel/plugin-transform-unicode-sets-regex@7.25.9(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-create-regexp-features-plugin': 7.25.7(@babel/core@7.25.7)
- '@babel/helper-plugin-utils': 7.25.7
+ '@babel/helper-create-regexp-features-plugin': 7.25.9(@babel/core@7.25.7)
+ '@babel/helper-plugin-utils': 7.25.9
optional: true
'@babel/preset-env@7.25.3(@babel/core@7.24.5)':
dependencies:
- '@babel/compat-data': 7.25.7
+ '@babel/compat-data': 7.26.2
'@babel/core': 7.24.5
- '@babel/helper-compilation-targets': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/helper-validator-option': 7.25.7
- '@babel/plugin-bugfix-firefox-class-in-computed-class-key': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-bugfix-safari-class-field-initializer-scope': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly': 7.25.7(@babel/core@7.24.5)
+ '@babel/helper-compilation-targets': 7.25.9
+ '@babel/helper-plugin-utils': 7.25.9
+ '@babel/helper-validator-option': 7.25.9
+ '@babel/plugin-bugfix-firefox-class-in-computed-class-key': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-bugfix-safari-class-field-initializer-scope': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly': 7.25.9(@babel/core@7.24.5)
'@babel/plugin-proposal-private-property-in-object': 7.21.0-placeholder-for-preset-env.2(@babel/core@7.24.5)
'@babel/plugin-syntax-async-generators': 7.8.4(@babel/core@7.24.5)
'@babel/plugin-syntax-class-properties': 7.12.13(@babel/core@7.24.5)
'@babel/plugin-syntax-class-static-block': 7.14.5(@babel/core@7.24.5)
'@babel/plugin-syntax-dynamic-import': 7.8.3(@babel/core@7.24.5)
'@babel/plugin-syntax-export-namespace-from': 7.8.3(@babel/core@7.24.5)
- '@babel/plugin-syntax-import-assertions': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-syntax-import-attributes': 7.25.7(@babel/core@7.24.5)
+ '@babel/plugin-syntax-import-assertions': 7.26.0(@babel/core@7.24.5)
+ '@babel/plugin-syntax-import-attributes': 7.26.0(@babel/core@7.24.5)
'@babel/plugin-syntax-import-meta': 7.10.4(@babel/core@7.24.5)
'@babel/plugin-syntax-json-strings': 7.8.3(@babel/core@7.24.5)
'@babel/plugin-syntax-logical-assignment-operators': 7.10.4(@babel/core@7.24.5)
@@ -18877,84 +19144,84 @@ snapshots:
'@babel/plugin-syntax-private-property-in-object': 7.14.5(@babel/core@7.24.5)
'@babel/plugin-syntax-top-level-await': 7.14.5(@babel/core@7.24.5)
'@babel/plugin-syntax-unicode-sets-regex': 7.18.6(@babel/core@7.24.5)
- '@babel/plugin-transform-arrow-functions': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-transform-async-generator-functions': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-transform-async-to-generator': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-transform-block-scoped-functions': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-transform-block-scoping': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-transform-class-properties': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-transform-class-static-block': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-transform-classes': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-transform-computed-properties': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-transform-destructuring': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-transform-dotall-regex': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-transform-duplicate-keys': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-transform-duplicate-named-capturing-groups-regex': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-transform-dynamic-import': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-transform-exponentiation-operator': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-transform-export-namespace-from': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-transform-for-of': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-transform-function-name': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-transform-json-strings': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-transform-literals': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-transform-logical-assignment-operators': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-transform-member-expression-literals': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-transform-modules-amd': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-transform-modules-commonjs': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-transform-modules-systemjs': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-transform-modules-umd': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-transform-named-capturing-groups-regex': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-transform-new-target': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-transform-nullish-coalescing-operator': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-transform-numeric-separator': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-transform-object-rest-spread': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-transform-object-super': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-transform-optional-catch-binding': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-transform-optional-chaining': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-transform-parameters': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-transform-private-methods': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-transform-private-property-in-object': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-transform-property-literals': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-transform-regenerator': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-transform-reserved-words': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-transform-shorthand-properties': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-transform-spread': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-transform-sticky-regex': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-transform-template-literals': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-transform-typeof-symbol': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-transform-unicode-escapes': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-transform-unicode-property-regex': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-transform-unicode-regex': 7.25.7(@babel/core@7.24.5)
- '@babel/plugin-transform-unicode-sets-regex': 7.25.7(@babel/core@7.24.5)
+ '@babel/plugin-transform-arrow-functions': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-transform-async-generator-functions': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-transform-async-to-generator': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-transform-block-scoped-functions': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-transform-block-scoping': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-transform-class-properties': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-transform-class-static-block': 7.26.0(@babel/core@7.24.5)
+ '@babel/plugin-transform-classes': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-transform-computed-properties': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-transform-destructuring': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-transform-dotall-regex': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-transform-duplicate-keys': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-transform-duplicate-named-capturing-groups-regex': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-transform-dynamic-import': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-transform-exponentiation-operator': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-transform-export-namespace-from': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-transform-for-of': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-transform-function-name': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-transform-json-strings': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-transform-literals': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-transform-logical-assignment-operators': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-transform-member-expression-literals': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-transform-modules-amd': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-transform-modules-commonjs': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-transform-modules-systemjs': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-transform-modules-umd': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-transform-named-capturing-groups-regex': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-transform-new-target': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-transform-nullish-coalescing-operator': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-transform-numeric-separator': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-transform-object-rest-spread': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-transform-object-super': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-transform-optional-catch-binding': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-transform-optional-chaining': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-transform-parameters': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-transform-private-methods': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-transform-private-property-in-object': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-transform-property-literals': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-transform-regenerator': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-transform-reserved-words': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-transform-shorthand-properties': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-transform-spread': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-transform-sticky-regex': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-transform-template-literals': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-transform-typeof-symbol': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-transform-unicode-escapes': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-transform-unicode-property-regex': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-transform-unicode-regex': 7.25.9(@babel/core@7.24.5)
+ '@babel/plugin-transform-unicode-sets-regex': 7.25.9(@babel/core@7.24.5)
'@babel/preset-modules': 0.1.6-no-external-plugins(@babel/core@7.24.5)
- babel-plugin-polyfill-corejs2: 0.4.11(@babel/core@7.24.5)
+ babel-plugin-polyfill-corejs2: 0.4.12(@babel/core@7.24.5)
babel-plugin-polyfill-corejs3: 0.10.6(@babel/core@7.24.5)
- babel-plugin-polyfill-regenerator: 0.6.2(@babel/core@7.24.5)
- core-js-compat: 3.38.1
+ babel-plugin-polyfill-regenerator: 0.6.3(@babel/core@7.24.5)
+ core-js-compat: 3.39.0
semver: 6.3.1
transitivePeerDependencies:
- supports-color
'@babel/preset-env@7.25.3(@babel/core@7.25.7)':
dependencies:
- '@babel/compat-data': 7.25.7
+ '@babel/compat-data': 7.26.2
'@babel/core': 7.25.7
- '@babel/helper-compilation-targets': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/helper-validator-option': 7.25.7
- '@babel/plugin-bugfix-firefox-class-in-computed-class-key': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-bugfix-safari-class-field-initializer-scope': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly': 7.25.7(@babel/core@7.25.7)
+ '@babel/helper-compilation-targets': 7.25.9
+ '@babel/helper-plugin-utils': 7.25.9
+ '@babel/helper-validator-option': 7.25.9
+ '@babel/plugin-bugfix-firefox-class-in-computed-class-key': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-bugfix-safari-class-field-initializer-scope': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly': 7.25.9(@babel/core@7.25.7)
'@babel/plugin-proposal-private-property-in-object': 7.21.0-placeholder-for-preset-env.2(@babel/core@7.25.7)
'@babel/plugin-syntax-async-generators': 7.8.4(@babel/core@7.25.7)
'@babel/plugin-syntax-class-properties': 7.12.13(@babel/core@7.25.7)
'@babel/plugin-syntax-class-static-block': 7.14.5(@babel/core@7.25.7)
'@babel/plugin-syntax-dynamic-import': 7.8.3(@babel/core@7.25.7)
'@babel/plugin-syntax-export-namespace-from': 7.8.3(@babel/core@7.25.7)
- '@babel/plugin-syntax-import-assertions': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-syntax-import-attributes': 7.25.7(@babel/core@7.25.7)
+ '@babel/plugin-syntax-import-assertions': 7.26.0(@babel/core@7.25.7)
+ '@babel/plugin-syntax-import-attributes': 7.26.0(@babel/core@7.25.7)
'@babel/plugin-syntax-import-meta': 7.10.4(@babel/core@7.25.7)
'@babel/plugin-syntax-json-strings': 7.8.3(@babel/core@7.25.7)
'@babel/plugin-syntax-logical-assignment-operators': 7.10.4(@babel/core@7.25.7)
@@ -18966,60 +19233,60 @@ snapshots:
'@babel/plugin-syntax-private-property-in-object': 7.14.5(@babel/core@7.25.7)
'@babel/plugin-syntax-top-level-await': 7.14.5(@babel/core@7.25.7)
'@babel/plugin-syntax-unicode-sets-regex': 7.18.6(@babel/core@7.25.7)
- '@babel/plugin-transform-arrow-functions': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-async-generator-functions': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-async-to-generator': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-block-scoped-functions': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-block-scoping': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-class-properties': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-class-static-block': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-classes': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-computed-properties': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-destructuring': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-dotall-regex': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-duplicate-keys': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-duplicate-named-capturing-groups-regex': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-dynamic-import': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-exponentiation-operator': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-export-namespace-from': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-for-of': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-function-name': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-json-strings': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-literals': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-logical-assignment-operators': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-member-expression-literals': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-modules-amd': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-modules-commonjs': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-modules-systemjs': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-modules-umd': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-named-capturing-groups-regex': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-new-target': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-nullish-coalescing-operator': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-numeric-separator': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-object-rest-spread': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-object-super': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-optional-catch-binding': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-optional-chaining': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-parameters': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-private-methods': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-private-property-in-object': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-property-literals': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-regenerator': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-reserved-words': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-shorthand-properties': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-spread': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-sticky-regex': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-template-literals': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-typeof-symbol': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-unicode-escapes': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-unicode-property-regex': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-unicode-regex': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-unicode-sets-regex': 7.25.7(@babel/core@7.25.7)
+ '@babel/plugin-transform-arrow-functions': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-async-generator-functions': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-async-to-generator': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-block-scoped-functions': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-block-scoping': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-class-properties': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-class-static-block': 7.26.0(@babel/core@7.25.7)
+ '@babel/plugin-transform-classes': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-computed-properties': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-destructuring': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-dotall-regex': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-duplicate-keys': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-duplicate-named-capturing-groups-regex': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-dynamic-import': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-exponentiation-operator': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-export-namespace-from': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-for-of': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-function-name': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-json-strings': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-literals': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-logical-assignment-operators': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-member-expression-literals': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-modules-amd': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-modules-commonjs': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-modules-systemjs': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-modules-umd': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-named-capturing-groups-regex': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-new-target': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-nullish-coalescing-operator': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-numeric-separator': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-object-rest-spread': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-object-super': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-optional-catch-binding': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-optional-chaining': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-parameters': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-private-methods': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-private-property-in-object': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-property-literals': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-regenerator': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-reserved-words': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-shorthand-properties': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-spread': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-sticky-regex': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-template-literals': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-typeof-symbol': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-unicode-escapes': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-unicode-property-regex': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-unicode-regex': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-unicode-sets-regex': 7.25.9(@babel/core@7.25.7)
'@babel/preset-modules': 0.1.6-no-external-plugins(@babel/core@7.25.7)
- babel-plugin-polyfill-corejs2: 0.4.11(@babel/core@7.25.7)
+ babel-plugin-polyfill-corejs2: 0.4.12(@babel/core@7.25.7)
babel-plugin-polyfill-corejs3: 0.10.6(@babel/core@7.25.7)
- babel-plugin-polyfill-regenerator: 0.6.2(@babel/core@7.25.7)
- core-js-compat: 3.38.1
+ babel-plugin-polyfill-regenerator: 0.6.3(@babel/core@7.25.7)
+ core-js-compat: 3.39.0
semver: 6.3.1
transitivePeerDependencies:
- supports-color
@@ -19035,15 +19302,15 @@ snapshots:
'@babel/preset-modules@0.1.6-no-external-plugins(@babel/core@7.24.5)':
dependencies:
'@babel/core': 7.24.5
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/types': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
+ '@babel/types': 7.26.0
esutils: 2.0.3
'@babel/preset-modules@0.1.6-no-external-plugins(@babel/core@7.25.7)':
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-plugin-utils': 7.25.7
- '@babel/types': 7.25.7
+ '@babel/helper-plugin-utils': 7.25.9
+ '@babel/types': 7.26.0
esutils: 2.0.3
optional: true
@@ -19082,17 +19349,21 @@ snapshots:
dependencies:
regenerator-runtime: 0.14.1
+ '@babel/runtime@7.26.0':
+ dependencies:
+ regenerator-runtime: 0.14.1
+
'@babel/template@7.25.0':
dependencies:
'@babel/code-frame': 7.24.7
'@babel/parser': 7.25.3
'@babel/types': 7.25.2
- '@babel/template@7.25.7':
+ '@babel/template@7.25.9':
dependencies:
- '@babel/code-frame': 7.25.7
- '@babel/parser': 7.25.7
- '@babel/types': 7.25.7
+ '@babel/code-frame': 7.26.2
+ '@babel/parser': 7.26.2
+ '@babel/types': 7.26.0
'@babel/traverse@7.25.3':
dependencies:
@@ -19118,13 +19389,13 @@ snapshots:
transitivePeerDependencies:
- supports-color
- '@babel/traverse@7.25.7':
+ '@babel/traverse@7.25.9':
dependencies:
- '@babel/code-frame': 7.25.7
- '@babel/generator': 7.25.7
- '@babel/parser': 7.25.7
- '@babel/template': 7.25.7
- '@babel/types': 7.25.7
+ '@babel/code-frame': 7.26.2
+ '@babel/generator': 7.26.2
+ '@babel/parser': 7.26.2
+ '@babel/template': 7.25.9
+ '@babel/types': 7.26.0
debug: 4.3.7
globals: 11.12.0
transitivePeerDependencies:
@@ -19148,11 +19419,10 @@ snapshots:
'@babel/helper-validator-identifier': 7.24.7
to-fast-properties: 2.0.0
- '@babel/types@7.25.7':
+ '@babel/types@7.26.0':
dependencies:
- '@babel/helper-string-parser': 7.25.7
- '@babel/helper-validator-identifier': 7.25.7
- to-fast-properties: 2.0.0
+ '@babel/helper-string-parser': 7.25.9
+ '@babel/helper-validator-identifier': 7.25.9
'@brillout/import@0.2.3': {}
@@ -19868,7 +20138,7 @@ snapshots:
eth-json-rpc-filters: 6.0.1
eventemitter3: 5.0.1
keccak: 3.0.4
- preact: 10.24.2
+ preact: 10.24.3
sha.js: 2.4.11
transitivePeerDependencies:
- supports-color
@@ -20162,6 +20432,9 @@ snapshots:
'@esbuild/aix-ppc64@0.20.2':
optional: true
+ '@esbuild/aix-ppc64@0.21.5':
+ optional: true
+
'@esbuild/android-arm64@0.17.18':
optional: true
@@ -20171,6 +20444,9 @@ snapshots:
'@esbuild/android-arm64@0.20.2':
optional: true
+ '@esbuild/android-arm64@0.21.5':
+ optional: true
+
'@esbuild/android-arm@0.17.18':
optional: true
@@ -20180,6 +20456,9 @@ snapshots:
'@esbuild/android-arm@0.20.2':
optional: true
+ '@esbuild/android-arm@0.21.5':
+ optional: true
+
'@esbuild/android-x64@0.17.18':
optional: true
@@ -20189,6 +20468,9 @@ snapshots:
'@esbuild/android-x64@0.20.2':
optional: true
+ '@esbuild/android-x64@0.21.5':
+ optional: true
+
'@esbuild/darwin-arm64@0.17.18':
optional: true
@@ -20198,6 +20480,9 @@ snapshots:
'@esbuild/darwin-arm64@0.20.2':
optional: true
+ '@esbuild/darwin-arm64@0.21.5':
+ optional: true
+
'@esbuild/darwin-x64@0.17.18':
optional: true
@@ -20207,6 +20492,9 @@ snapshots:
'@esbuild/darwin-x64@0.20.2':
optional: true
+ '@esbuild/darwin-x64@0.21.5':
+ optional: true
+
'@esbuild/freebsd-arm64@0.17.18':
optional: true
@@ -20216,6 +20504,9 @@ snapshots:
'@esbuild/freebsd-arm64@0.20.2':
optional: true
+ '@esbuild/freebsd-arm64@0.21.5':
+ optional: true
+
'@esbuild/freebsd-x64@0.17.18':
optional: true
@@ -20225,6 +20516,9 @@ snapshots:
'@esbuild/freebsd-x64@0.20.2':
optional: true
+ '@esbuild/freebsd-x64@0.21.5':
+ optional: true
+
'@esbuild/linux-arm64@0.17.18':
optional: true
@@ -20234,6 +20528,9 @@ snapshots:
'@esbuild/linux-arm64@0.20.2':
optional: true
+ '@esbuild/linux-arm64@0.21.5':
+ optional: true
+
'@esbuild/linux-arm@0.17.18':
optional: true
@@ -20243,6 +20540,9 @@ snapshots:
'@esbuild/linux-arm@0.20.2':
optional: true
+ '@esbuild/linux-arm@0.21.5':
+ optional: true
+
'@esbuild/linux-ia32@0.17.18':
optional: true
@@ -20252,6 +20552,9 @@ snapshots:
'@esbuild/linux-ia32@0.20.2':
optional: true
+ '@esbuild/linux-ia32@0.21.5':
+ optional: true
+
'@esbuild/linux-loong64@0.17.18':
optional: true
@@ -20261,6 +20564,9 @@ snapshots:
'@esbuild/linux-loong64@0.20.2':
optional: true
+ '@esbuild/linux-loong64@0.21.5':
+ optional: true
+
'@esbuild/linux-mips64el@0.17.18':
optional: true
@@ -20270,6 +20576,9 @@ snapshots:
'@esbuild/linux-mips64el@0.20.2':
optional: true
+ '@esbuild/linux-mips64el@0.21.5':
+ optional: true
+
'@esbuild/linux-ppc64@0.17.18':
optional: true
@@ -20279,6 +20588,9 @@ snapshots:
'@esbuild/linux-ppc64@0.20.2':
optional: true
+ '@esbuild/linux-ppc64@0.21.5':
+ optional: true
+
'@esbuild/linux-riscv64@0.17.18':
optional: true
@@ -20288,6 +20600,9 @@ snapshots:
'@esbuild/linux-riscv64@0.20.2':
optional: true
+ '@esbuild/linux-riscv64@0.21.5':
+ optional: true
+
'@esbuild/linux-s390x@0.17.18':
optional: true
@@ -20297,6 +20612,9 @@ snapshots:
'@esbuild/linux-s390x@0.20.2':
optional: true
+ '@esbuild/linux-s390x@0.21.5':
+ optional: true
+
'@esbuild/linux-x64@0.17.18':
optional: true
@@ -20306,6 +20624,9 @@ snapshots:
'@esbuild/linux-x64@0.20.2':
optional: true
+ '@esbuild/linux-x64@0.21.5':
+ optional: true
+
'@esbuild/netbsd-x64@0.17.18':
optional: true
@@ -20315,6 +20636,9 @@ snapshots:
'@esbuild/netbsd-x64@0.20.2':
optional: true
+ '@esbuild/netbsd-x64@0.21.5':
+ optional: true
+
'@esbuild/openbsd-x64@0.17.18':
optional: true
@@ -20324,6 +20648,9 @@ snapshots:
'@esbuild/openbsd-x64@0.20.2':
optional: true
+ '@esbuild/openbsd-x64@0.21.5':
+ optional: true
+
'@esbuild/sunos-x64@0.17.18':
optional: true
@@ -20333,6 +20660,9 @@ snapshots:
'@esbuild/sunos-x64@0.20.2':
optional: true
+ '@esbuild/sunos-x64@0.21.5':
+ optional: true
+
'@esbuild/win32-arm64@0.17.18':
optional: true
@@ -20342,6 +20672,9 @@ snapshots:
'@esbuild/win32-arm64@0.20.2':
optional: true
+ '@esbuild/win32-arm64@0.21.5':
+ optional: true
+
'@esbuild/win32-ia32@0.17.18':
optional: true
@@ -20351,6 +20684,9 @@ snapshots:
'@esbuild/win32-ia32@0.20.2':
optional: true
+ '@esbuild/win32-ia32@0.21.5':
+ optional: true
+
'@esbuild/win32-x64@0.17.18':
optional: true
@@ -20360,6 +20696,9 @@ snapshots:
'@esbuild/win32-x64@0.20.2':
optional: true
+ '@esbuild/win32-x64@0.21.5':
+ optional: true
+
'@eslint-community/eslint-utils@4.4.0(eslint@8.57.0)':
dependencies:
eslint: 8.57.0
@@ -21311,7 +21650,7 @@ snapshots:
'@lens-protocol/domain': 0.12.0
'@lens-protocol/shared-kernel': 0.12.0
ethers: 5.7.2(bufferutil@4.0.8)(utf-8-validate@5.0.10)
- tslib: 2.7.0
+ tslib: 2.8.1
transitivePeerDependencies:
- '@faker-js/faker'
- '@jest/globals'
@@ -21339,7 +21678,7 @@ snapshots:
graphql-request: 6.1.0(graphql@16.9.0)
graphql-tag: 2.12.6(graphql@16.9.0)
jwt-decode: 3.1.2
- tslib: 2.7.0
+ tslib: 2.8.1
zod: 3.23.8
optionalDependencies:
'@lens-protocol/metadata': 1.2.0(zod@3.23.6)
@@ -21373,7 +21712,7 @@ snapshots:
'@lens-protocol/domain@0.12.0':
dependencies:
'@lens-protocol/shared-kernel': 0.12.0
- tslib: 2.7.0
+ tslib: 2.8.1
'@lens-protocol/gated-content@0.5.1(@ethersproject/abi@5.7.0)(@ethersproject/address@5.7.0)(@ethersproject/bignumber@5.7.0)(@ethersproject/contracts@5.7.0)(@ethersproject/hash@5.7.0)(@ethersproject/providers@5.7.2(bufferutil@4.0.8)(utf-8-validate@5.0.10))(@ethersproject/wallet@5.7.0)(@lens-protocol/metadata@1.2.0(zod@3.23.6))(@types/react@18.3.3)(bufferutil@4.0.8)(ethers@5.7.2(bufferutil@4.0.8)(utf-8-validate@5.0.10))(react@18.3.1)(utf-8-validate@5.0.10)(zod@3.23.8)':
dependencies:
@@ -21393,7 +21732,7 @@ snapshots:
'@lit-protocol/node-client': 2.1.62(@ethersproject/contracts@5.7.0)(@ethersproject/hash@5.7.0)(@ethersproject/providers@5.7.2(bufferutil@4.0.8)(utf-8-validate@5.0.10))(@ethersproject/wallet@5.7.0)(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10)
'@lit-protocol/types': 2.1.62
siwe: 2.3.2(ethers@5.7.2(bufferutil@4.0.8)(utf-8-validate@5.0.10))
- tslib: 2.7.0
+ tslib: 2.8.1
zod: 3.23.8
transitivePeerDependencies:
- '@azure/app-configuration'
@@ -21430,12 +21769,12 @@ snapshots:
decimal.js: 10.4.3
lodash: 4.17.21
traverse: 0.6.10
- tslib: 2.7.0
+ tslib: 2.8.1
'@lens-protocol/storage@0.8.1':
dependencies:
'@lens-protocol/shared-kernel': 0.12.0
- tslib: 2.7.0
+ tslib: 2.8.1
zod: 3.23.8
'@lexical/clipboard@0.17.1':
@@ -21926,7 +22265,7 @@ snapshots:
'@lit-protocol/types': 2.1.62
'@lit-protocol/uint8arrays': 2.1.62
ethers: 5.7.2(bufferutil@4.0.8)(utf-8-validate@5.0.10)
- tslib: 2.7.0
+ tslib: 2.8.1
transitivePeerDependencies:
- bufferutil
- utf-8-validate
@@ -21938,11 +22277,11 @@ snapshots:
'@lit-protocol/misc-browser': 2.1.62(bufferutil@4.0.8)(utf-8-validate@5.0.10)
'@lit-protocol/types': 2.1.62
'@lit-protocol/uint8arrays': 2.1.62
- '@walletconnect/ethereum-provider': 2.15.2(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10)
+ '@walletconnect/ethereum-provider': 2.17.2(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10)
ethers: 5.7.2(bufferutil@4.0.8)(utf-8-validate@5.0.10)
lit-connect-modal: 0.1.11
lit-siwe: 1.1.8(@ethersproject/contracts@5.7.0)(@ethersproject/hash@5.7.0)(@ethersproject/providers@5.7.2(bufferutil@4.0.8)(utf-8-validate@5.0.10))(@ethersproject/wallet@5.7.0)
- tslib: 2.7.0
+ tslib: 2.8.1
tweetnacl: 1.0.3
tweetnacl-util: 0.13.5
util: 0.12.5
@@ -21977,7 +22316,7 @@ snapshots:
'@lit-protocol/constants@2.1.62':
dependencies:
'@lit-protocol/types': 2.1.62
- tslib: 2.7.0
+ tslib: 2.8.1
'@lit-protocol/crypto@2.1.62(bufferutil@4.0.8)(utf-8-validate@5.0.10)':
dependencies:
@@ -21989,7 +22328,7 @@ snapshots:
'@lit-protocol/types': 2.1.62
'@lit-protocol/uint8arrays': 2.1.62
ethers: 5.7.2(bufferutil@4.0.8)(utf-8-validate@5.0.10)
- tslib: 2.7.0
+ tslib: 2.8.1
transitivePeerDependencies:
- bufferutil
- utf-8-validate
@@ -22008,7 +22347,7 @@ snapshots:
'@lit-protocol/uint8arrays': 2.1.62
ethers: 5.7.2(bufferutil@4.0.8)(utf-8-validate@5.0.10)
jszip: 3.10.1
- tslib: 2.7.0
+ tslib: 2.8.1
transitivePeerDependencies:
- bufferutil
- utf-8-validate
@@ -22022,7 +22361,7 @@ snapshots:
'@lit-protocol/types': 2.1.62
'@lit-protocol/uint8arrays': 2.1.62
ethers: 5.7.2(bufferutil@4.0.8)(utf-8-validate@5.0.10)
- tslib: 2.7.0
+ tslib: 2.8.1
transitivePeerDependencies:
- bufferutil
- utf-8-validate
@@ -22031,7 +22370,7 @@ snapshots:
dependencies:
'@lit-protocol/constants': 2.1.62
'@lit-protocol/types': 2.1.62
- tslib: 2.7.0
+ tslib: 2.8.1
'@lit-protocol/nacl@2.1.62': {}
@@ -22050,13 +22389,13 @@ snapshots:
'@lit-protocol/nacl': 2.1.62
'@lit-protocol/types': 2.1.62
'@lit-protocol/uint8arrays': 2.1.62
- '@walletconnect/ethereum-provider': 2.15.2(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10)
+ '@walletconnect/ethereum-provider': 2.17.2(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10)
ethers: 5.7.2(bufferutil@4.0.8)(utf-8-validate@5.0.10)
jszip: 3.10.1
lit-connect-modal: 0.1.11
lit-siwe: 1.1.8(@ethersproject/contracts@5.7.0)(@ethersproject/hash@5.7.0)(@ethersproject/providers@5.7.2(bufferutil@4.0.8)(utf-8-validate@5.0.10))(@ethersproject/wallet@5.7.0)
node-fetch: 2.7.0
- tslib: 2.7.0
+ tslib: 2.8.1
tweetnacl: 1.0.3
tweetnacl-util: 0.15.1
transitivePeerDependencies:
@@ -22305,7 +22644,7 @@ snapshots:
react-dom: 18.3.1(react@18.3.1)
react-native: 0.74.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10)
- '@metamask/sdk@0.20.3(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-i18next@13.5.0(i18next@23.11.5)(react-dom@18.3.1(react@18.3.1))(react-native@0.74.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1))(react-native@0.74.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(rollup@4.18.0)(utf-8-validate@5.0.10)':
+ '@metamask/sdk@0.20.3(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-i18next@13.5.0(i18next@23.11.5)(react-dom@18.3.1(react@18.3.1))(react-native@0.74.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1))(react-native@0.74.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(rollup@4.26.0)(utf-8-validate@5.0.10)':
dependencies:
'@metamask/onboarding': 1.0.1
'@metamask/providers': 15.0.0
@@ -22325,7 +22664,7 @@ snapshots:
qrcode-terminal-nooctal: 0.12.1
react-native-webview: 11.26.1(react-native@0.74.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)
readable-stream: 3.6.2
- rollup-plugin-visualizer: 5.12.0(rollup@4.18.0)
+ rollup-plugin-visualizer: 5.12.0(rollup@4.26.0)
socket.io-client: 4.7.5(bufferutil@4.0.8)(utf-8-validate@5.0.10)
util: 0.12.5
uuid: 8.3.2
@@ -22341,7 +22680,7 @@ snapshots:
- supports-color
- utf-8-validate
- '@metamask/sdk@0.27.0(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-native@0.74.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(rollup@4.18.0)(utf-8-validate@5.0.10)':
+ '@metamask/sdk@0.27.0(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-native@0.74.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(rollup@4.26.0)(utf-8-validate@5.0.10)':
dependencies:
'@metamask/onboarding': 1.0.1
'@metamask/providers': 16.1.0
@@ -22361,7 +22700,7 @@ snapshots:
qrcode-terminal-nooctal: 0.12.1
react-native-webview: 11.26.1(react-native@0.74.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)
readable-stream: 3.6.2
- rollup-plugin-visualizer: 5.12.0(rollup@4.18.0)
+ rollup-plugin-visualizer: 5.12.0(rollup@4.26.0)
socket.io-client: 4.7.5(bufferutil@4.0.8)(utf-8-validate@5.0.10)
util: 0.12.5
uuid: 8.3.2
@@ -22897,7 +23236,7 @@ snapshots:
'@polkadot/api-derive@6.0.5':
dependencies:
- '@babel/runtime': 7.25.7
+ '@babel/runtime': 7.26.0
'@polkadot/api': 6.0.5
'@polkadot/rpc-core': 6.0.5
'@polkadot/types': 6.0.5
@@ -22910,7 +23249,7 @@ snapshots:
'@polkadot/api@6.0.5':
dependencies:
- '@babel/runtime': 7.25.7
+ '@babel/runtime': 7.26.0
'@polkadot/api-derive': 6.0.5
'@polkadot/keyring': 7.9.2(@polkadot/util-crypto@7.9.2(@polkadot/util@7.9.2))(@polkadot/util@7.9.2)
'@polkadot/rpc-core': 6.0.5
@@ -22974,7 +23313,7 @@ snapshots:
'@polkadot/keyring@7.9.2(@polkadot/util-crypto@7.9.2(@polkadot/util@7.9.2))(@polkadot/util@7.9.2)':
dependencies:
- '@babel/runtime': 7.25.7
+ '@babel/runtime': 7.26.0
'@polkadot/util': 7.9.2
'@polkadot/util-crypto': 7.9.2(@polkadot/util@7.9.2)
@@ -22986,11 +23325,11 @@ snapshots:
'@polkadot/networks@7.9.2':
dependencies:
- '@babel/runtime': 7.25.7
+ '@babel/runtime': 7.26.0
'@polkadot/rpc-core@6.0.5':
dependencies:
- '@babel/runtime': 7.25.7
+ '@babel/runtime': 7.26.0
'@polkadot/rpc-provider': 6.0.5
'@polkadot/types': 6.0.5
'@polkadot/util': 7.9.2
@@ -23043,7 +23382,7 @@ snapshots:
'@polkadot/rpc-provider@6.0.5':
dependencies:
- '@babel/runtime': 7.25.7
+ '@babel/runtime': 7.26.0
'@polkadot/types': 6.0.5
'@polkadot/util': 7.9.2
'@polkadot/util-crypto': 7.9.2(@polkadot/util@7.9.2)
@@ -23095,7 +23434,7 @@ snapshots:
'@polkadot/types-known@6.0.5':
dependencies:
- '@babel/runtime': 7.25.7
+ '@babel/runtime': 7.26.0
'@polkadot/networks': 7.9.2
'@polkadot/types': 6.0.5
'@polkadot/util': 7.9.2
@@ -23134,7 +23473,7 @@ snapshots:
'@polkadot/types@6.0.5':
dependencies:
- '@babel/runtime': 7.25.7
+ '@babel/runtime': 7.26.0
'@polkadot/util': 7.9.2
'@polkadot/util-crypto': 7.9.2(@polkadot/util@7.9.2)
rxjs: 7.8.1
@@ -23154,16 +23493,16 @@ snapshots:
'@polkadot/util-crypto@7.9.2(@polkadot/util@7.9.2)':
dependencies:
- '@babel/runtime': 7.25.7
+ '@babel/runtime': 7.26.0
'@polkadot/networks': 7.9.2
'@polkadot/util': 7.9.2
'@polkadot/wasm-crypto': 4.6.1(@polkadot/util@7.9.2)(@polkadot/x-randomvalues@7.9.2)
'@polkadot/x-randomvalues': 7.9.2
blakejs: 1.2.1
- bn.js: 4.12.0
+ bn.js: 4.12.1
create-hash: 1.2.0
ed2curve: 0.3.0
- elliptic: 6.5.7
+ elliptic: 6.6.1
hash.js: 1.1.7
js-sha3: 0.8.0
micro-base: 0.9.0
@@ -23183,11 +23522,11 @@ snapshots:
'@polkadot/util@7.9.2':
dependencies:
- '@babel/runtime': 7.25.7
+ '@babel/runtime': 7.26.0
'@polkadot/x-textdecoder': 7.9.2
'@polkadot/x-textencoder': 7.9.2
'@types/bn.js': 4.11.6
- bn.js: 4.12.0
+ bn.js: 4.12.1
camelcase: 6.3.0
ip-regex: 4.3.0
@@ -23200,7 +23539,7 @@ snapshots:
'@polkadot/wasm-crypto-asmjs@4.6.1(@polkadot/util@7.9.2)':
dependencies:
- '@babel/runtime': 7.25.7
+ '@babel/runtime': 7.26.0
'@polkadot/util': 7.9.2
'@polkadot/wasm-crypto-asmjs@7.3.2(@polkadot/util@12.6.2)':
@@ -23220,7 +23559,7 @@ snapshots:
'@polkadot/wasm-crypto-wasm@4.6.1(@polkadot/util@7.9.2)':
dependencies:
- '@babel/runtime': 7.25.7
+ '@babel/runtime': 7.26.0
'@polkadot/util': 7.9.2
'@polkadot/wasm-crypto-wasm@7.3.2(@polkadot/util@12.6.2)':
@@ -23231,7 +23570,7 @@ snapshots:
'@polkadot/wasm-crypto@4.6.1(@polkadot/util@7.9.2)(@polkadot/x-randomvalues@7.9.2)':
dependencies:
- '@babel/runtime': 7.25.7
+ '@babel/runtime': 7.26.0
'@polkadot/util': 7.9.2
'@polkadot/wasm-crypto-asmjs': 4.6.1(@polkadot/util@7.9.2)
'@polkadot/wasm-crypto-wasm': 4.6.1(@polkadot/util@7.9.2)
@@ -23266,9 +23605,9 @@ snapshots:
'@polkadot/x-fetch@7.9.2':
dependencies:
- '@babel/runtime': 7.25.7
+ '@babel/runtime': 7.26.0
'@polkadot/x-global': 7.9.2
- '@types/node-fetch': 2.6.11
+ '@types/node-fetch': 2.6.12
node-fetch: 2.7.0
transitivePeerDependencies:
- encoding
@@ -23279,7 +23618,7 @@ snapshots:
'@polkadot/x-global@7.9.2':
dependencies:
- '@babel/runtime': 7.25.7
+ '@babel/runtime': 7.26.0
'@polkadot/x-randomvalues@12.6.2(@polkadot/util@12.6.2)(@polkadot/wasm-util@7.3.2(@polkadot/util@12.6.2))':
dependencies:
@@ -23290,7 +23629,7 @@ snapshots:
'@polkadot/x-randomvalues@7.9.2':
dependencies:
- '@babel/runtime': 7.25.7
+ '@babel/runtime': 7.26.0
'@polkadot/x-global': 7.9.2
'@polkadot/x-textdecoder@12.6.2':
@@ -23300,7 +23639,7 @@ snapshots:
'@polkadot/x-textdecoder@7.9.2':
dependencies:
- '@babel/runtime': 7.25.7
+ '@babel/runtime': 7.26.0
'@polkadot/x-global': 7.9.2
'@polkadot/x-textencoder@12.6.2':
@@ -23310,7 +23649,7 @@ snapshots:
'@polkadot/x-textencoder@7.9.2':
dependencies:
- '@babel/runtime': 7.25.7
+ '@babel/runtime': 7.26.0
'@polkadot/x-global': 7.9.2
'@polkadot/x-ws@12.6.2(bufferutil@4.0.8)(utf-8-validate@5.0.10)':
@@ -23324,7 +23663,7 @@ snapshots:
'@polkadot/x-ws@7.9.2':
dependencies:
- '@babel/runtime': 7.25.7
+ '@babel/runtime': 7.26.0
'@polkadot/x-global': 7.9.2
'@types/websocket': 1.0.10
websocket: 1.0.35
@@ -24011,7 +24350,7 @@ snapshots:
semver: 7.6.3
strip-ansi: 5.2.0
wcwidth: 1.0.1
- yaml: 2.5.1
+ yaml: 2.6.0
transitivePeerDependencies:
- typescript
optional: true
@@ -24099,7 +24438,7 @@ snapshots:
dependencies:
'@react-native-community/cli-debugger-ui': 14.0.0
'@react-native-community/cli-tools': 14.0.0
- compression: 1.7.4
+ compression: 1.7.5
connect: 3.7.0
errorhandler: 1.5.1
nocache: 3.0.4
@@ -24116,7 +24455,7 @@ snapshots:
dependencies:
'@react-native-community/cli-debugger-ui': 14.0.0-alpha.11
'@react-native-community/cli-tools': 14.0.0-alpha.11
- compression: 1.7.4
+ compression: 1.7.5
connect: 3.7.0
errorhandler: 1.5.1
nocache: 3.0.4
@@ -24304,47 +24643,47 @@ snapshots:
'@react-native/babel-preset@0.75.1(@babel/core@7.25.7)(@babel/preset-env@7.25.3(@babel/core@7.25.7))':
dependencies:
'@babel/core': 7.25.7
- '@babel/plugin-proposal-export-default-from': 7.25.7(@babel/core@7.25.7)
+ '@babel/plugin-proposal-export-default-from': 7.25.9(@babel/core@7.25.7)
'@babel/plugin-syntax-dynamic-import': 7.8.3(@babel/core@7.25.7)
- '@babel/plugin-syntax-export-default-from': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-syntax-flow': 7.25.7(@babel/core@7.25.7)
+ '@babel/plugin-syntax-export-default-from': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-syntax-flow': 7.26.0(@babel/core@7.25.7)
'@babel/plugin-syntax-nullish-coalescing-operator': 7.8.3(@babel/core@7.25.7)
'@babel/plugin-syntax-optional-chaining': 7.8.3(@babel/core@7.25.7)
- '@babel/plugin-transform-arrow-functions': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-async-generator-functions': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-async-to-generator': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-block-scoping': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-class-properties': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-classes': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-computed-properties': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-destructuring': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-flow-strip-types': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-for-of': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-function-name': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-literals': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-logical-assignment-operators': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-modules-commonjs': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-named-capturing-groups-regex': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-nullish-coalescing-operator': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-numeric-separator': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-object-rest-spread': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-optional-catch-binding': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-optional-chaining': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-parameters': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-private-methods': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-private-property-in-object': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-react-display-name': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-react-jsx': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-react-jsx-self': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-react-jsx-source': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-regenerator': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-runtime': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-shorthand-properties': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-spread': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-sticky-regex': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-typescript': 7.25.7(@babel/core@7.25.7)
- '@babel/plugin-transform-unicode-regex': 7.25.7(@babel/core@7.25.7)
- '@babel/template': 7.25.7
+ '@babel/plugin-transform-arrow-functions': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-async-generator-functions': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-async-to-generator': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-block-scoping': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-class-properties': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-classes': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-computed-properties': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-destructuring': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-flow-strip-types': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-for-of': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-function-name': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-literals': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-logical-assignment-operators': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-modules-commonjs': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-named-capturing-groups-regex': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-nullish-coalescing-operator': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-numeric-separator': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-object-rest-spread': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-optional-catch-binding': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-optional-chaining': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-parameters': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-private-methods': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-private-property-in-object': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-react-display-name': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-react-jsx': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-react-jsx-self': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-react-jsx-source': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-regenerator': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-runtime': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-shorthand-properties': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-spread': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-sticky-regex': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-typescript': 7.25.9(@babel/core@7.25.7)
+ '@babel/plugin-transform-unicode-regex': 7.25.9(@babel/core@7.25.7)
+ '@babel/template': 7.25.9
'@react-native/babel-plugin-codegen': 0.75.1(@babel/preset-env@7.25.3(@babel/core@7.25.7))
babel-plugin-transform-flow-enums: 0.0.2(@babel/core@7.25.7)
react-refresh: 0.14.2
@@ -24368,7 +24707,7 @@ snapshots:
'@react-native/codegen@0.75.1(@babel/preset-env@7.25.3(@babel/core@7.25.7))':
dependencies:
- '@babel/parser': 7.25.7
+ '@babel/parser': 7.26.2
'@babel/preset-env': 7.25.3(@babel/core@7.25.7)
glob: 7.2.3
hermes-parser: 0.22.0
@@ -24568,73 +24907,79 @@ snapshots:
transitivePeerDependencies:
- supports-color
- '@rollup/plugin-inject@5.0.5(rollup@4.18.0)':
+ '@rollup/plugin-inject@5.0.5(rollup@4.26.0)':
dependencies:
- '@rollup/pluginutils': 5.1.0(rollup@4.18.0)
+ '@rollup/pluginutils': 5.1.0(rollup@4.26.0)
estree-walker: 2.0.2
magic-string: 0.30.10
optionalDependencies:
- rollup: 4.18.0
+ rollup: 4.26.0
'@rollup/pluginutils@4.2.1':
dependencies:
estree-walker: 2.0.2
picomatch: 2.3.1
- '@rollup/pluginutils@5.1.0(rollup@4.18.0)':
+ '@rollup/pluginutils@5.1.0(rollup@4.26.0)':
dependencies:
'@types/estree': 1.0.5
estree-walker: 2.0.2
picomatch: 2.3.1
optionalDependencies:
- rollup: 4.18.0
+ rollup: 4.26.0
+
+ '@rollup/rollup-android-arm-eabi@4.26.0':
+ optional: true
- '@rollup/rollup-android-arm-eabi@4.18.0':
+ '@rollup/rollup-android-arm64@4.26.0':
optional: true
- '@rollup/rollup-android-arm64@4.18.0':
+ '@rollup/rollup-darwin-arm64@4.26.0':
optional: true
- '@rollup/rollup-darwin-arm64@4.18.0':
+ '@rollup/rollup-darwin-x64@4.26.0':
optional: true
- '@rollup/rollup-darwin-x64@4.18.0':
+ '@rollup/rollup-freebsd-arm64@4.26.0':
optional: true
- '@rollup/rollup-linux-arm-gnueabihf@4.18.0':
+ '@rollup/rollup-freebsd-x64@4.26.0':
optional: true
- '@rollup/rollup-linux-arm-musleabihf@4.18.0':
+ '@rollup/rollup-linux-arm-gnueabihf@4.26.0':
optional: true
- '@rollup/rollup-linux-arm64-gnu@4.18.0':
+ '@rollup/rollup-linux-arm-musleabihf@4.26.0':
optional: true
- '@rollup/rollup-linux-arm64-musl@4.18.0':
+ '@rollup/rollup-linux-arm64-gnu@4.26.0':
optional: true
- '@rollup/rollup-linux-powerpc64le-gnu@4.18.0':
+ '@rollup/rollup-linux-arm64-musl@4.26.0':
optional: true
- '@rollup/rollup-linux-riscv64-gnu@4.18.0':
+ '@rollup/rollup-linux-powerpc64le-gnu@4.26.0':
optional: true
- '@rollup/rollup-linux-s390x-gnu@4.18.0':
+ '@rollup/rollup-linux-riscv64-gnu@4.26.0':
optional: true
- '@rollup/rollup-linux-x64-gnu@4.18.0':
+ '@rollup/rollup-linux-s390x-gnu@4.26.0':
optional: true
- '@rollup/rollup-linux-x64-musl@4.18.0':
+ '@rollup/rollup-linux-x64-gnu@4.26.0':
optional: true
- '@rollup/rollup-win32-arm64-msvc@4.18.0':
+ '@rollup/rollup-linux-x64-musl@4.26.0':
optional: true
- '@rollup/rollup-win32-ia32-msvc@4.18.0':
+ '@rollup/rollup-win32-arm64-msvc@4.26.0':
optional: true
- '@rollup/rollup-win32-x64-msvc@4.18.0':
+ '@rollup/rollup-win32-ia32-msvc@4.26.0':
+ optional: true
+
+ '@rollup/rollup-win32-x64-msvc@4.26.0':
optional: true
'@rrweb/types@2.0.0-alpha.13':
@@ -25510,7 +25855,7 @@ snapshots:
'@swc/helpers@0.5.5':
dependencies:
'@swc/counter': 0.1.3
- tslib: 2.7.0
+ tslib: 2.8.1
'@swc/types@0.1.7':
dependencies:
@@ -25878,10 +26223,12 @@ snapshots:
'@types/estree-jsx@1.0.5':
dependencies:
- '@types/estree': 1.0.5
+ '@types/estree': 1.0.6
'@types/estree@1.0.5': {}
+ '@types/estree@1.0.6': {}
+
'@types/expect@24.3.0':
dependencies:
expect: 29.7.0
@@ -25972,6 +26319,11 @@ snapshots:
'@types/node': 20.12.10
form-data: 4.0.0
+ '@types/node-fetch@2.6.12':
+ dependencies:
+ '@types/node': 20.17.6
+ form-data: 4.0.1
+
'@types/node-forge@1.3.11':
dependencies:
'@types/node': 20.12.10
@@ -25992,6 +26344,10 @@ snapshots:
dependencies:
undici-types: 5.26.5
+ '@types/node@20.17.6':
+ dependencies:
+ undici-types: 6.19.8
+
'@types/node@8.10.66': {}
'@types/normalize-package-data@2.4.4': {}
@@ -26169,7 +26525,7 @@ snapshots:
'@types/websocket@1.0.10':
dependencies:
- '@types/node': 20.12.10
+ '@types/node': 20.17.6
'@types/ws@7.4.7':
dependencies:
@@ -26359,14 +26715,14 @@ snapshots:
- debug
- utf-8-validate
- '@vitejs/plugin-react-swc@3.7.0(@swc/helpers@0.5.12)(vite@5.2.12(@types/node@20.12.10)(sass@1.77.0)(terser@5.34.1))':
+ '@vitejs/plugin-react-swc@3.7.0(@swc/helpers@0.5.12)(vite@5.4.11(@types/node@20.12.10)(sass@1.77.0)(terser@5.36.0))':
dependencies:
'@swc/core': 1.5.25(@swc/helpers@0.5.12)
- vite: 5.2.12(@types/node@20.12.10)(sass@1.77.0)(terser@5.34.1)
+ vite: 5.4.11(@types/node@20.12.10)(sass@1.77.0)(terser@5.36.0)
transitivePeerDependencies:
- '@swc/helpers'
- '@vitest/coverage-istanbul@1.6.0(vitest@1.6.0(@types/node@20.12.10)(jsdom@24.0.0(bufferutil@4.0.8)(utf-8-validate@6.0.3))(sass@1.77.0)(terser@5.34.1))':
+ '@vitest/coverage-istanbul@1.6.0(vitest@1.6.0(@types/node@20.12.10)(jsdom@24.0.0(bufferutil@4.0.8)(utf-8-validate@6.0.3))(sass@1.77.0)(terser@5.36.0))':
dependencies:
debug: 4.3.4
istanbul-lib-coverage: 3.2.2
@@ -26377,7 +26733,7 @@ snapshots:
magicast: 0.3.4
picocolors: 1.0.0
test-exclude: 6.0.0
- vitest: 1.6.0(@types/node@20.12.10)(jsdom@24.0.0(bufferutil@4.0.8)(utf-8-validate@6.0.3))(sass@1.77.0)(terser@5.34.1)
+ vitest: 1.6.0(@types/node@20.12.10)(jsdom@24.0.0(bufferutil@4.0.8)(utf-8-validate@6.0.3))(sass@1.77.0)(terser@5.36.0)
transitivePeerDependencies:
- supports-color
@@ -26412,10 +26768,10 @@ snapshots:
'@vladfrangu/async_event_emitter@2.4.6': {}
- '@wagmi/connectors@4.3.10(@types/react@18.3.3)(@wagmi/core@2.13.4(@types/react@18.3.3)(react@18.3.1)(typescript@5.4.5)(viem@2.21.0(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@5.0.10)(zod@3.23.6)))(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-i18next@13.5.0(i18next@23.11.5)(react-dom@18.3.1(react@18.3.1))(react-native@0.74.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1))(react-native@0.74.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(rollup@4.18.0)(typescript@5.4.5)(utf-8-validate@5.0.10)(viem@2.21.0(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@5.0.10)(zod@3.23.6))(zod@3.23.6)':
+ '@wagmi/connectors@4.3.10(@types/react@18.3.3)(@wagmi/core@2.13.4(@types/react@18.3.3)(react@18.3.1)(typescript@5.4.5)(viem@2.21.0(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@5.0.10)(zod@3.23.6)))(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-i18next@13.5.0(i18next@23.11.5)(react-dom@18.3.1(react@18.3.1))(react-native@0.74.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1))(react-native@0.74.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(rollup@4.26.0)(typescript@5.4.5)(utf-8-validate@5.0.10)(viem@2.21.0(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@5.0.10)(zod@3.23.6))(zod@3.23.6)':
dependencies:
'@coinbase/wallet-sdk': 3.9.1
- '@metamask/sdk': 0.20.3(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-i18next@13.5.0(i18next@23.11.5)(react-dom@18.3.1(react@18.3.1))(react-native@0.74.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1))(react-native@0.74.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(rollup@4.18.0)(utf-8-validate@5.0.10)
+ '@metamask/sdk': 0.20.3(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-i18next@13.5.0(i18next@23.11.5)(react-dom@18.3.1(react@18.3.1))(react-native@0.74.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1))(react-native@0.74.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(rollup@4.26.0)(utf-8-validate@5.0.10)
'@safe-global/safe-apps-provider': 0.18.1(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@5.0.10)(zod@3.23.6)
'@safe-global/safe-apps-sdk': 8.1.0(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@5.0.10)(zod@3.23.6)
'@wagmi/core': 2.13.4(@types/react@18.3.3)(react@18.3.1)(typescript@5.4.5)(viem@2.21.0(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@5.0.10)(zod@3.23.6))
@@ -26451,10 +26807,10 @@ snapshots:
- utf-8-validate
- zod
- '@wagmi/connectors@5.1.8(@types/react@18.3.3)(@wagmi/core@2.13.4(@types/react@18.3.3)(react@18.3.1)(typescript@5.4.5)(viem@2.21.0(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@5.0.10)(zod@3.23.6)))(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-native@0.74.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(rollup@4.18.0)(typescript@5.4.5)(utf-8-validate@5.0.10)(viem@2.21.0(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@5.0.10)(zod@3.23.6))(zod@3.23.6)':
+ '@wagmi/connectors@5.1.8(@types/react@18.3.3)(@wagmi/core@2.13.4(@types/react@18.3.3)(react@18.3.1)(typescript@5.4.5)(viem@2.21.0(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@5.0.10)(zod@3.23.6)))(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-native@0.74.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(rollup@4.26.0)(typescript@5.4.5)(utf-8-validate@5.0.10)(viem@2.21.0(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@5.0.10)(zod@3.23.6))(zod@3.23.6)':
dependencies:
'@coinbase/wallet-sdk': 4.0.4
- '@metamask/sdk': 0.27.0(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-native@0.74.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(rollup@4.18.0)(utf-8-validate@5.0.10)
+ '@metamask/sdk': 0.27.0(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-native@0.74.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(rollup@4.26.0)(utf-8-validate@5.0.10)
'@safe-global/safe-apps-provider': 0.18.3(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@5.0.10)(zod@3.23.6)
'@safe-global/safe-apps-sdk': 9.1.0(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@5.0.10)(zod@3.23.6)
'@wagmi/core': 2.13.4(@types/react@18.3.3)(react@18.3.1)(typescript@5.4.5)(viem@2.21.0(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@5.0.10)(zod@3.23.6))
@@ -26632,6 +26988,43 @@ snapshots:
- uWebSockets.js
- utf-8-validate
+ '@walletconnect/core@2.17.2(bufferutil@4.0.8)(utf-8-validate@5.0.10)':
+ dependencies:
+ '@walletconnect/heartbeat': 1.2.2
+ '@walletconnect/jsonrpc-provider': 1.0.14
+ '@walletconnect/jsonrpc-types': 1.0.4
+ '@walletconnect/jsonrpc-utils': 1.0.8
+ '@walletconnect/jsonrpc-ws-connection': 1.0.14(bufferutil@4.0.8)(utf-8-validate@5.0.10)
+ '@walletconnect/keyvaluestorage': 1.1.1
+ '@walletconnect/logger': 2.1.2
+ '@walletconnect/relay-api': 1.0.11
+ '@walletconnect/relay-auth': 1.0.4
+ '@walletconnect/safe-json': 1.0.2
+ '@walletconnect/time': 1.0.2
+ '@walletconnect/types': 2.17.2
+ '@walletconnect/utils': 2.17.2
+ '@walletconnect/window-getters': 1.0.1
+ events: 3.3.0
+ lodash.isequal: 4.5.0
+ uint8arrays: 3.1.0
+ transitivePeerDependencies:
+ - '@azure/app-configuration'
+ - '@azure/cosmos'
+ - '@azure/data-tables'
+ - '@azure/identity'
+ - '@azure/keyvault-secrets'
+ - '@azure/storage-blob'
+ - '@capacitor/preferences'
+ - '@netlify/blobs'
+ - '@planetscale/database'
+ - '@react-native-async-storage/async-storage'
+ - '@upstash/redis'
+ - '@vercel/kv'
+ - bufferutil
+ - ioredis
+ - uWebSockets.js
+ - utf-8-validate
+
'@walletconnect/crypto@1.0.3':
dependencies:
'@walletconnect/encoding': 1.0.2
@@ -26750,6 +27143,40 @@ snapshots:
- uWebSockets.js
- utf-8-validate
+ '@walletconnect/ethereum-provider@2.17.2(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10)':
+ dependencies:
+ '@walletconnect/jsonrpc-http-connection': 1.0.8
+ '@walletconnect/jsonrpc-provider': 1.0.14
+ '@walletconnect/jsonrpc-types': 1.0.4
+ '@walletconnect/jsonrpc-utils': 1.0.8
+ '@walletconnect/keyvaluestorage': 1.1.1
+ '@walletconnect/modal': 2.7.0(@types/react@18.3.3)(react@18.3.1)
+ '@walletconnect/sign-client': 2.17.2(bufferutil@4.0.8)(utf-8-validate@5.0.10)
+ '@walletconnect/types': 2.17.2
+ '@walletconnect/universal-provider': 2.17.2(bufferutil@4.0.8)(utf-8-validate@5.0.10)
+ '@walletconnect/utils': 2.17.2
+ events: 3.3.0
+ transitivePeerDependencies:
+ - '@azure/app-configuration'
+ - '@azure/cosmos'
+ - '@azure/data-tables'
+ - '@azure/identity'
+ - '@azure/keyvault-secrets'
+ - '@azure/storage-blob'
+ - '@capacitor/preferences'
+ - '@netlify/blobs'
+ - '@planetscale/database'
+ - '@react-native-async-storage/async-storage'
+ - '@types/react'
+ - '@upstash/redis'
+ - '@vercel/kv'
+ - bufferutil
+ - encoding
+ - ioredis
+ - react
+ - uWebSockets.js
+ - utf-8-validate
+
'@walletconnect/events@1.0.1':
dependencies:
keyvaluestorage-interface: 1.0.0
@@ -26852,6 +27279,13 @@ snapshots:
- '@types/react'
- react
+ '@walletconnect/modal-core@2.7.0(@types/react@18.3.3)(react@18.3.1)':
+ dependencies:
+ valtio: 1.11.2(@types/react@18.3.3)(react@18.3.1)
+ transitivePeerDependencies:
+ - '@types/react'
+ - react
+
'@walletconnect/modal-ui@2.6.2(@types/react@18.3.3)(react@18.3.1)':
dependencies:
'@walletconnect/modal-core': 2.6.2(@types/react@18.3.3)(react@18.3.1)
@@ -26862,6 +27296,16 @@ snapshots:
- '@types/react'
- react
+ '@walletconnect/modal-ui@2.7.0(@types/react@18.3.3)(react@18.3.1)':
+ dependencies:
+ '@walletconnect/modal-core': 2.7.0(@types/react@18.3.3)(react@18.3.1)
+ lit: 2.8.0
+ motion: 10.16.2
+ qrcode: 1.5.3
+ transitivePeerDependencies:
+ - '@types/react'
+ - react
+
'@walletconnect/modal@2.6.2(@types/react@18.3.3)(react@18.3.1)':
dependencies:
'@walletconnect/modal-core': 2.6.2(@types/react@18.3.3)(react@18.3.1)
@@ -26870,6 +27314,14 @@ snapshots:
- '@types/react'
- react
+ '@walletconnect/modal@2.7.0(@types/react@18.3.3)(react@18.3.1)':
+ dependencies:
+ '@walletconnect/modal-core': 2.7.0(@types/react@18.3.3)(react@18.3.1)
+ '@walletconnect/modal-ui': 2.7.0(@types/react@18.3.3)(react@18.3.1)
+ transitivePeerDependencies:
+ - '@types/react'
+ - react
+
'@walletconnect/randombytes@1.0.3':
dependencies:
'@walletconnect/encoding': 1.0.2
@@ -26989,6 +27441,35 @@ snapshots:
- uWebSockets.js
- utf-8-validate
+ '@walletconnect/sign-client@2.17.2(bufferutil@4.0.8)(utf-8-validate@5.0.10)':
+ dependencies:
+ '@walletconnect/core': 2.17.2(bufferutil@4.0.8)(utf-8-validate@5.0.10)
+ '@walletconnect/events': 1.0.1
+ '@walletconnect/heartbeat': 1.2.2
+ '@walletconnect/jsonrpc-utils': 1.0.8
+ '@walletconnect/logger': 2.1.2
+ '@walletconnect/time': 1.0.2
+ '@walletconnect/types': 2.17.2
+ '@walletconnect/utils': 2.17.2
+ events: 3.3.0
+ transitivePeerDependencies:
+ - '@azure/app-configuration'
+ - '@azure/cosmos'
+ - '@azure/data-tables'
+ - '@azure/identity'
+ - '@azure/keyvault-secrets'
+ - '@azure/storage-blob'
+ - '@capacitor/preferences'
+ - '@netlify/blobs'
+ - '@planetscale/database'
+ - '@react-native-async-storage/async-storage'
+ - '@upstash/redis'
+ - '@vercel/kv'
+ - bufferutil
+ - ioredis
+ - uWebSockets.js
+ - utf-8-validate
+
'@walletconnect/socket-transport@1.8.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)':
dependencies:
'@walletconnect/types': 1.8.0
@@ -27076,6 +27557,30 @@ snapshots:
- ioredis
- uWebSockets.js
+ '@walletconnect/types@2.17.2':
+ dependencies:
+ '@walletconnect/events': 1.0.1
+ '@walletconnect/heartbeat': 1.2.2
+ '@walletconnect/jsonrpc-types': 1.0.4
+ '@walletconnect/keyvaluestorage': 1.1.1
+ '@walletconnect/logger': 2.1.2
+ events: 3.3.0
+ transitivePeerDependencies:
+ - '@azure/app-configuration'
+ - '@azure/cosmos'
+ - '@azure/data-tables'
+ - '@azure/identity'
+ - '@azure/keyvault-secrets'
+ - '@azure/storage-blob'
+ - '@capacitor/preferences'
+ - '@netlify/blobs'
+ - '@planetscale/database'
+ - '@react-native-async-storage/async-storage'
+ - '@upstash/redis'
+ - '@vercel/kv'
+ - ioredis
+ - uWebSockets.js
+
'@walletconnect/universal-provider@2.12.2(bufferutil@4.0.8)(utf-8-validate@5.0.10)':
dependencies:
'@walletconnect/jsonrpc-http-connection': 1.0.8
@@ -27166,6 +27671,39 @@ snapshots:
- uWebSockets.js
- utf-8-validate
+ '@walletconnect/universal-provider@2.17.2(bufferutil@4.0.8)(utf-8-validate@5.0.10)':
+ dependencies:
+ '@walletconnect/events': 1.0.1
+ '@walletconnect/jsonrpc-http-connection': 1.0.8
+ '@walletconnect/jsonrpc-provider': 1.0.14
+ '@walletconnect/jsonrpc-types': 1.0.4
+ '@walletconnect/jsonrpc-utils': 1.0.8
+ '@walletconnect/keyvaluestorage': 1.1.1
+ '@walletconnect/logger': 2.1.2
+ '@walletconnect/sign-client': 2.17.2(bufferutil@4.0.8)(utf-8-validate@5.0.10)
+ '@walletconnect/types': 2.17.2
+ '@walletconnect/utils': 2.17.2
+ events: 3.3.0
+ lodash: 4.17.21
+ transitivePeerDependencies:
+ - '@azure/app-configuration'
+ - '@azure/cosmos'
+ - '@azure/data-tables'
+ - '@azure/identity'
+ - '@azure/keyvault-secrets'
+ - '@azure/storage-blob'
+ - '@capacitor/preferences'
+ - '@netlify/blobs'
+ - '@planetscale/database'
+ - '@react-native-async-storage/async-storage'
+ - '@upstash/redis'
+ - '@vercel/kv'
+ - bufferutil
+ - encoding
+ - ioredis
+ - uWebSockets.js
+ - utf-8-validate
+
'@walletconnect/utils@1.8.0':
dependencies:
'@walletconnect/browser-utils': 1.8.0
@@ -27274,6 +27812,44 @@ snapshots:
- ioredis
- uWebSockets.js
+ '@walletconnect/utils@2.17.2':
+ dependencies:
+ '@ethersproject/hash': 5.7.0
+ '@ethersproject/transactions': 5.7.0
+ '@stablelib/chacha20poly1305': 1.0.1
+ '@stablelib/hkdf': 1.0.1
+ '@stablelib/random': 1.0.2
+ '@stablelib/sha256': 1.0.1
+ '@stablelib/x25519': 1.0.3
+ '@walletconnect/jsonrpc-utils': 1.0.8
+ '@walletconnect/keyvaluestorage': 1.1.1
+ '@walletconnect/relay-api': 1.0.11
+ '@walletconnect/relay-auth': 1.0.4
+ '@walletconnect/safe-json': 1.0.2
+ '@walletconnect/time': 1.0.2
+ '@walletconnect/types': 2.17.2
+ '@walletconnect/window-getters': 1.0.1
+ '@walletconnect/window-metadata': 1.0.1
+ detect-browser: 5.3.0
+ elliptic: 6.6.0
+ query-string: 7.1.3
+ uint8arrays: 3.1.0
+ transitivePeerDependencies:
+ - '@azure/app-configuration'
+ - '@azure/cosmos'
+ - '@azure/data-tables'
+ - '@azure/identity'
+ - '@azure/keyvault-secrets'
+ - '@azure/storage-blob'
+ - '@capacitor/preferences'
+ - '@netlify/blobs'
+ - '@planetscale/database'
+ - '@react-native-async-storage/async-storage'
+ - '@upstash/redis'
+ - '@vercel/kv'
+ - ioredis
+ - uWebSockets.js
+
'@walletconnect/window-getters@1.0.0': {}
'@walletconnect/window-getters@1.0.1':
@@ -27294,7 +27870,7 @@ snapshots:
'@noble/curves': 1.6.0
'@noble/hashes': 1.5.0
'@xmtp/proto': 3.61.1
- viem: 2.21.34(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@5.0.10)(zod@3.23.6)
+ viem: 2.21.45(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@5.0.10)(zod@3.23.6)
transitivePeerDependencies:
- bufferutil
- typescript
@@ -27304,7 +27880,7 @@ snapshots:
'@xmtp/proto@3.61.1':
dependencies:
long: 5.2.3
- protobufjs: 7.3.0
+ protobufjs: 7.4.0
rxjs: 7.8.1
undici: 5.28.4
@@ -27382,6 +27958,8 @@ snapshots:
acorn@8.12.1: {}
+ acorn@8.14.0: {}
+
aes-js@3.0.0: {}
aes-js@3.1.2: {}
@@ -27760,11 +28338,20 @@ snapshots:
transitivePeerDependencies:
- supports-color
- babel-plugin-polyfill-corejs2@0.4.11(@babel/core@7.25.7):
+ babel-plugin-polyfill-corejs2@0.4.12(@babel/core@7.24.5):
dependencies:
- '@babel/compat-data': 7.25.2
+ '@babel/compat-data': 7.26.2
+ '@babel/core': 7.24.5
+ '@babel/helper-define-polyfill-provider': 0.6.3(@babel/core@7.24.5)
+ semver: 6.3.1
+ transitivePeerDependencies:
+ - supports-color
+
+ babel-plugin-polyfill-corejs2@0.4.12(@babel/core@7.25.7):
+ dependencies:
+ '@babel/compat-data': 7.26.2
'@babel/core': 7.25.7
- '@babel/helper-define-polyfill-provider': 0.6.2(@babel/core@7.25.7)
+ '@babel/helper-define-polyfill-provider': 0.6.3(@babel/core@7.25.7)
semver: 6.3.1
transitivePeerDependencies:
- supports-color
@@ -27794,10 +28381,17 @@ snapshots:
transitivePeerDependencies:
- supports-color
- babel-plugin-polyfill-regenerator@0.6.2(@babel/core@7.25.7):
+ babel-plugin-polyfill-regenerator@0.6.3(@babel/core@7.24.5):
+ dependencies:
+ '@babel/core': 7.24.5
+ '@babel/helper-define-polyfill-provider': 0.6.3(@babel/core@7.24.5)
+ transitivePeerDependencies:
+ - supports-color
+
+ babel-plugin-polyfill-regenerator@0.6.3(@babel/core@7.25.7):
dependencies:
'@babel/core': 7.25.7
- '@babel/helper-define-polyfill-provider': 0.6.2(@babel/core@7.25.7)
+ '@babel/helper-define-polyfill-provider': 0.6.3(@babel/core@7.25.7)
transitivePeerDependencies:
- supports-color
optional: true
@@ -27910,6 +28504,8 @@ snapshots:
bn.js@4.12.0: {}
+ bn.js@4.12.1: {}
+
bn.js@5.2.1: {}
body-parser@1.20.2:
@@ -28037,12 +28633,12 @@ snapshots:
node-releases: 2.0.18
update-browserslist-db: 1.1.0(browserslist@4.23.3)
- browserslist@4.24.0:
+ browserslist@4.24.2:
dependencies:
- caniuse-lite: 1.0.30001667
- electron-to-chromium: 1.5.35
+ caniuse-lite: 1.0.30001680
+ electron-to-chromium: 1.5.57
node-releases: 2.0.18
- update-browserslist-db: 1.1.1(browserslist@4.24.0)
+ update-browserslist-db: 1.1.1(browserslist@4.24.2)
bs58@4.0.1:
dependencies:
@@ -28162,7 +28758,7 @@ snapshots:
caniuse-lite@1.0.30001655: {}
- caniuse-lite@1.0.30001667: {}
+ caniuse-lite@1.0.30001680: {}
canvas-renderer@2.1.1: {}
@@ -28307,7 +28903,7 @@ snapshots:
chromium-edge-launcher@0.2.0:
dependencies:
- '@types/node': 20.12.10
+ '@types/node': 20.17.6
escape-string-regexp: 4.0.0
is-wsl: 2.2.0
lighthouse-logger: 1.4.2
@@ -28565,6 +29161,19 @@ snapshots:
transitivePeerDependencies:
- supports-color
+ compression@1.7.5:
+ dependencies:
+ bytes: 3.1.2
+ compressible: 2.0.18
+ debug: 2.6.9
+ negotiator: 0.6.4
+ on-headers: 1.0.2
+ safe-buffer: 5.2.1
+ vary: 1.1.2
+ transitivePeerDependencies:
+ - supports-color
+ optional: true
+
compute-scroll-into-view@2.0.4: {}
concat-map@0.0.1: {}
@@ -28680,9 +29289,9 @@ snapshots:
dependencies:
browserslist: 4.23.3
- core-js-compat@3.38.1:
+ core-js-compat@3.39.0:
dependencies:
- browserslist: 4.24.0
+ browserslist: 4.24.2
core-js-pure@3.37.0: {}
@@ -29337,7 +29946,7 @@ snapshots:
electron-to-chromium@1.5.11: {}
- electron-to-chromium@1.5.35: {}
+ electron-to-chromium@1.5.57: {}
elliptic@6.5.4:
dependencies:
@@ -29369,6 +29978,26 @@ snapshots:
minimalistic-assert: 1.0.1
minimalistic-crypto-utils: 1.0.1
+ elliptic@6.6.0:
+ dependencies:
+ bn.js: 4.12.1
+ brorand: 1.1.0
+ hash.js: 1.1.7
+ hmac-drbg: 1.0.1
+ inherits: 2.0.4
+ minimalistic-assert: 1.0.1
+ minimalistic-crypto-utils: 1.0.1
+
+ elliptic@6.6.1:
+ dependencies:
+ bn.js: 4.12.1
+ brorand: 1.1.0
+ hash.js: 1.1.7
+ hmac-drbg: 1.0.1
+ inherits: 2.0.4
+ minimalistic-assert: 1.0.1
+ minimalistic-crypto-utils: 1.0.1
+
emittery@0.13.1: {}
emoji-regex@10.3.0: {}
@@ -29501,6 +30130,55 @@ snapshots:
unbox-primitive: 1.0.2
which-typed-array: 1.1.15
+ es-abstract@1.23.4:
+ dependencies:
+ array-buffer-byte-length: 1.0.1
+ arraybuffer.prototype.slice: 1.0.3
+ available-typed-arrays: 1.0.7
+ call-bind: 1.0.7
+ data-view-buffer: 1.0.1
+ data-view-byte-length: 1.0.1
+ data-view-byte-offset: 1.0.0
+ es-define-property: 1.0.0
+ es-errors: 1.3.0
+ es-object-atoms: 1.0.0
+ es-set-tostringtag: 2.0.3
+ es-to-primitive: 1.2.1
+ function.prototype.name: 1.1.6
+ get-intrinsic: 1.2.4
+ get-symbol-description: 1.0.2
+ globalthis: 1.0.4
+ gopd: 1.0.1
+ has-property-descriptors: 1.0.2
+ has-proto: 1.0.3
+ has-symbols: 1.0.3
+ hasown: 2.0.2
+ internal-slot: 1.0.7
+ is-array-buffer: 3.0.4
+ is-callable: 1.2.7
+ is-data-view: 1.0.1
+ is-negative-zero: 2.0.3
+ is-regex: 1.1.4
+ is-shared-array-buffer: 1.0.3
+ is-string: 1.0.7
+ is-typed-array: 1.1.13
+ is-weakref: 1.0.2
+ object-inspect: 1.13.3
+ object-keys: 1.1.1
+ object.assign: 4.1.5
+ regexp.prototype.flags: 1.5.3
+ safe-array-concat: 1.1.2
+ safe-regex-test: 1.0.3
+ string.prototype.trim: 1.2.9
+ string.prototype.trimend: 1.0.8
+ string.prototype.trimstart: 1.0.8
+ typed-array-buffer: 1.0.2
+ typed-array-byte-length: 1.0.1
+ typed-array-byte-offset: 1.0.2
+ typed-array-length: 1.0.6
+ unbox-primitive: 1.0.2
+ which-typed-array: 1.1.15
+
es-define-property@1.0.0:
dependencies:
get-intrinsic: 1.2.4
@@ -29668,6 +30346,32 @@ snapshots:
'@esbuild/win32-ia32': 0.20.2
'@esbuild/win32-x64': 0.20.2
+ esbuild@0.21.5:
+ optionalDependencies:
+ '@esbuild/aix-ppc64': 0.21.5
+ '@esbuild/android-arm': 0.21.5
+ '@esbuild/android-arm64': 0.21.5
+ '@esbuild/android-x64': 0.21.5
+ '@esbuild/darwin-arm64': 0.21.5
+ '@esbuild/darwin-x64': 0.21.5
+ '@esbuild/freebsd-arm64': 0.21.5
+ '@esbuild/freebsd-x64': 0.21.5
+ '@esbuild/linux-arm': 0.21.5
+ '@esbuild/linux-arm64': 0.21.5
+ '@esbuild/linux-ia32': 0.21.5
+ '@esbuild/linux-loong64': 0.21.5
+ '@esbuild/linux-mips64el': 0.21.5
+ '@esbuild/linux-ppc64': 0.21.5
+ '@esbuild/linux-riscv64': 0.21.5
+ '@esbuild/linux-s390x': 0.21.5
+ '@esbuild/linux-x64': 0.21.5
+ '@esbuild/netbsd-x64': 0.21.5
+ '@esbuild/openbsd-x64': 0.21.5
+ '@esbuild/sunos-x64': 0.21.5
+ '@esbuild/win32-arm64': 0.21.5
+ '@esbuild/win32-ia32': 0.21.5
+ '@esbuild/win32-x64': 0.21.5
+
escalade@3.1.2: {}
escalade@3.2.0: {}
@@ -30917,7 +31621,7 @@ snapshots:
graphql-tag@2.12.6(graphql@16.9.0):
dependencies:
graphql: 16.9.0
- tslib: 2.7.0
+ tslib: 2.8.1
graphql@16.9.0: {}
@@ -30928,11 +31632,11 @@ snapshots:
defu: 6.1.4
destr: 2.0.3
iron-webcrypto: 1.1.1
- ohash: 1.1.3
+ ohash: 1.1.4
radix3: 1.1.2
ufo: 1.5.3
uncrypto: 0.1.3
- unenv: 1.9.0
+ unenv: 1.10.0
transitivePeerDependencies:
- uWebSockets.js
@@ -32026,7 +32730,7 @@ snapshots:
https-proxy-agent: 7.0.5
is-potential-custom-element-name: 1.0.1
nwsapi: 2.2.13
- parse5: 7.1.2
+ parse5: 7.2.1
rrweb-cssom: 0.6.0
saxes: 6.0.0
symbol-tree: 3.2.4
@@ -32054,7 +32758,7 @@ snapshots:
https-proxy-agent: 7.0.5
is-potential-custom-element-name: 1.0.1
nwsapi: 2.2.13
- parse5: 7.1.2
+ parse5: 7.2.1
rrweb-cssom: 0.6.0
saxes: 6.0.0
symbol-tree: 3.2.4
@@ -32881,7 +33585,7 @@ snapshots:
metro-minify-terser@0.80.12:
dependencies:
flow-enums-runtime: 0.0.6
- terser: 5.34.1
+ terser: 5.36.0
optional: true
metro-resolver@0.80.10:
@@ -32900,7 +33604,7 @@ snapshots:
metro-runtime@0.80.12:
dependencies:
- '@babel/runtime': 7.25.7
+ '@babel/runtime': 7.26.0
flow-enums-runtime: 0.0.6
optional: true
@@ -32920,8 +33624,8 @@ snapshots:
metro-source-map@0.80.12:
dependencies:
- '@babel/traverse': 7.25.7
- '@babel/types': 7.25.7
+ '@babel/traverse': 7.25.9
+ '@babel/types': 7.26.0
flow-enums-runtime: 0.0.6
invariant: 2.2.4
metro-symbolicate: 0.80.12
@@ -32972,9 +33676,9 @@ snapshots:
metro-transform-plugins@0.80.12:
dependencies:
'@babel/core': 7.25.7
- '@babel/generator': 7.25.7
- '@babel/template': 7.25.7
- '@babel/traverse': 7.25.7
+ '@babel/generator': 7.26.2
+ '@babel/template': 7.25.9
+ '@babel/traverse': 7.25.9
flow-enums-runtime: 0.0.6
nullthrows: 1.1.1
transitivePeerDependencies:
@@ -33005,9 +33709,9 @@ snapshots:
metro-transform-worker@0.80.12(bufferutil@4.0.8)(utf-8-validate@5.0.10):
dependencies:
'@babel/core': 7.25.7
- '@babel/generator': 7.25.7
- '@babel/parser': 7.25.7
- '@babel/types': 7.25.7
+ '@babel/generator': 7.26.2
+ '@babel/parser': 7.26.2
+ '@babel/types': 7.26.0
flow-enums-runtime: 0.0.6
metro: 0.80.12(bufferutil@4.0.8)(utf-8-validate@5.0.10)
metro-babel-transformer: 0.80.12
@@ -33076,13 +33780,13 @@ snapshots:
metro@0.80.12(bufferutil@4.0.8)(utf-8-validate@5.0.10):
dependencies:
- '@babel/code-frame': 7.25.7
+ '@babel/code-frame': 7.26.2
'@babel/core': 7.25.7
- '@babel/generator': 7.25.7
- '@babel/parser': 7.25.7
- '@babel/template': 7.25.7
- '@babel/traverse': 7.25.7
- '@babel/types': 7.25.7
+ '@babel/generator': 7.26.2
+ '@babel/parser': 7.26.2
+ '@babel/template': 7.25.9
+ '@babel/traverse': 7.25.9
+ '@babel/types': 7.26.0
accepts: 1.3.8
chalk: 4.1.2
ci-info: 2.0.0
@@ -33191,7 +33895,7 @@ snapshots:
micromark-extension-mdx-expression@3.0.0:
dependencies:
- '@types/estree': 1.0.5
+ '@types/estree': 1.0.6
devlop: 1.1.0
micromark-factory-mdx-expression: 2.0.2
micromark-factory-space: 2.0.0
@@ -33220,7 +33924,7 @@ snapshots:
micromark-extension-mdxjs-esm@3.0.0:
dependencies:
- '@types/estree': 1.0.5
+ '@types/estree': 1.0.6
devlop: 1.1.0
micromark-core-commonmark: 2.0.1
micromark-util-character: 2.1.0
@@ -33628,6 +34332,9 @@ snapshots:
negotiator@0.6.3: {}
+ negotiator@0.6.4:
+ optional: true
+
neo-async@2.6.2: {}
nested-error-stacks@2.1.1: {}
@@ -33641,7 +34348,7 @@ snapshots:
'@next/env': 14.2.16
'@swc/helpers': 0.5.5
busboy: 1.6.0
- caniuse-lite: 1.0.30001667
+ caniuse-lite: 1.0.30001680
graceful-fs: 4.2.11
postcss: 8.4.31
react: 18.3.1
@@ -33911,6 +34618,8 @@ snapshots:
object-inspect@1.13.1: {}
+ object-inspect@1.13.3: {}
+
object-is@1.1.6:
dependencies:
call-bind: 1.0.7
@@ -33958,8 +34667,6 @@ snapshots:
node-fetch-native: 1.6.4
ufo: 1.5.3
- ohash@1.1.3: {}
-
ohash@1.1.4: {}
on-exit-leak-free@0.2.0: {}
@@ -34076,6 +34783,20 @@ snapshots:
outvariant@1.4.0: {}
+ ox@0.1.2(typescript@5.4.5)(zod@3.23.6):
+ dependencies:
+ '@adraffy/ens-normalize': 1.11.0
+ '@noble/curves': 1.6.0
+ '@noble/hashes': 1.5.0
+ '@scure/bip32': 1.5.0
+ '@scure/bip39': 1.4.0
+ abitype: 1.0.6(typescript@5.4.5)(zod@3.23.6)
+ eventemitter3: 5.0.1
+ optionalDependencies:
+ typescript: 5.4.5
+ transitivePeerDependencies:
+ - zod
+
p-defer@4.0.1: {}
p-event@4.2.0:
@@ -34249,6 +34970,10 @@ snapshots:
dependencies:
entities: 4.5.0
+ parse5@7.2.1:
+ dependencies:
+ entities: 4.5.0
+
parseurl@1.3.3: {}
pascal-case@3.1.2:
@@ -34417,9 +35142,7 @@ snapshots:
picocolors@1.0.0: {}
- picocolors@1.0.1: {}
-
- picocolors@1.1.0: {}
+ picocolors@1.1.1: {}
picomatch@2.3.1: {}
@@ -34626,8 +35349,8 @@ snapshots:
postcss@8.4.31:
dependencies:
nanoid: 3.3.7
- picocolors: 1.1.0
- source-map-js: 1.2.0
+ picocolors: 1.1.1
+ source-map-js: 1.2.1
postcss@8.4.38:
dependencies:
@@ -34635,6 +35358,12 @@ snapshots:
picocolors: 1.0.0
source-map-js: 1.2.0
+ postcss@8.4.49:
+ dependencies:
+ nanoid: 3.3.7
+ picocolors: 1.1.1
+ source-map-js: 1.2.1
+
postgres-array@2.0.0: {}
postgres-array@3.0.2: {}
@@ -34659,7 +35388,7 @@ snapshots:
preact@10.23.2: {}
- preact@10.24.2: {}
+ preact@10.24.3: {}
prebuild-install@7.1.2:
dependencies:
@@ -34787,6 +35516,21 @@ snapshots:
'@types/node': 20.12.10
long: 5.2.3
+ protobufjs@7.4.0:
+ dependencies:
+ '@protobufjs/aspromise': 1.1.2
+ '@protobufjs/base64': 1.1.2
+ '@protobufjs/codegen': 2.0.4
+ '@protobufjs/eventemitter': 1.1.0
+ '@protobufjs/fetch': 1.1.0
+ '@protobufjs/float': 1.0.2
+ '@protobufjs/inquire': 1.1.0
+ '@protobufjs/path': 1.1.2
+ '@protobufjs/pool': 1.1.0
+ '@protobufjs/utf8': 1.1.0
+ '@types/node': 20.17.6
+ long: 5.2.3
+
protons-runtime@5.5.0:
dependencies:
uint8-varint: 2.0.4
@@ -34815,6 +35559,10 @@ snapshots:
proxy-from-env@1.1.0: {}
+ psl@1.10.0:
+ dependencies:
+ punycode: 2.3.1
+
psl@1.9.0: {}
public-encrypt@4.0.3:
@@ -35108,7 +35856,7 @@ snapshots:
react-i18next@13.5.0(i18next@23.11.5)(react-dom@18.3.1(react@18.3.1))(react-native@0.74.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1):
dependencies:
- '@babel/runtime': 7.25.7
+ '@babel/runtime': 7.26.0
html-parse-stringify: 3.0.1
i18next: 23.11.5
react: 18.3.1
@@ -35547,7 +36295,7 @@ snapshots:
regenerator-transform@0.15.2:
dependencies:
- '@babel/runtime': 7.25.7
+ '@babel/runtime': 7.26.0
regexp-tree@0.1.27: {}
@@ -35558,6 +36306,13 @@ snapshots:
es-errors: 1.3.0
set-function-name: 2.0.2
+ regexp.prototype.flags@1.5.3:
+ dependencies:
+ call-bind: 1.0.7
+ define-properties: 1.2.1
+ es-errors: 1.3.0
+ set-function-name: 2.0.2
+
regexpu-core@5.3.2:
dependencies:
'@babel/regjsgen': 0.8.0
@@ -35572,13 +36327,13 @@ snapshots:
regenerate: 1.4.2
regenerate-unicode-properties: 10.2.0
regjsgen: 0.8.0
- regjsparser: 0.11.1
+ regjsparser: 0.11.2
unicode-match-property-ecmascript: 2.0.0
unicode-match-property-value-ecmascript: 2.2.0
regjsgen@0.8.0: {}
- regjsparser@0.11.1:
+ regjsparser@0.11.2:
dependencies:
jsesc: 3.0.2
@@ -35713,39 +36468,41 @@ snapshots:
dependencies:
rollup-plugin-inject: 3.0.2
- rollup-plugin-visualizer@5.12.0(rollup@4.18.0):
+ rollup-plugin-visualizer@5.12.0(rollup@4.26.0):
dependencies:
open: 8.4.2
picomatch: 2.3.1
source-map: 0.7.4
yargs: 17.7.2
optionalDependencies:
- rollup: 4.18.0
+ rollup: 4.26.0
rollup-pluginutils@2.8.2:
dependencies:
estree-walker: 0.6.1
- rollup@4.18.0:
+ rollup@4.26.0:
dependencies:
- '@types/estree': 1.0.5
+ '@types/estree': 1.0.6
optionalDependencies:
- '@rollup/rollup-android-arm-eabi': 4.18.0
- '@rollup/rollup-android-arm64': 4.18.0
- '@rollup/rollup-darwin-arm64': 4.18.0
- '@rollup/rollup-darwin-x64': 4.18.0
- '@rollup/rollup-linux-arm-gnueabihf': 4.18.0
- '@rollup/rollup-linux-arm-musleabihf': 4.18.0
- '@rollup/rollup-linux-arm64-gnu': 4.18.0
- '@rollup/rollup-linux-arm64-musl': 4.18.0
- '@rollup/rollup-linux-powerpc64le-gnu': 4.18.0
- '@rollup/rollup-linux-riscv64-gnu': 4.18.0
- '@rollup/rollup-linux-s390x-gnu': 4.18.0
- '@rollup/rollup-linux-x64-gnu': 4.18.0
- '@rollup/rollup-linux-x64-musl': 4.18.0
- '@rollup/rollup-win32-arm64-msvc': 4.18.0
- '@rollup/rollup-win32-ia32-msvc': 4.18.0
- '@rollup/rollup-win32-x64-msvc': 4.18.0
+ '@rollup/rollup-android-arm-eabi': 4.26.0
+ '@rollup/rollup-android-arm64': 4.26.0
+ '@rollup/rollup-darwin-arm64': 4.26.0
+ '@rollup/rollup-darwin-x64': 4.26.0
+ '@rollup/rollup-freebsd-arm64': 4.26.0
+ '@rollup/rollup-freebsd-x64': 4.26.0
+ '@rollup/rollup-linux-arm-gnueabihf': 4.26.0
+ '@rollup/rollup-linux-arm-musleabihf': 4.26.0
+ '@rollup/rollup-linux-arm64-gnu': 4.26.0
+ '@rollup/rollup-linux-arm64-musl': 4.26.0
+ '@rollup/rollup-linux-powerpc64le-gnu': 4.26.0
+ '@rollup/rollup-linux-riscv64-gnu': 4.26.0
+ '@rollup/rollup-linux-s390x-gnu': 4.26.0
+ '@rollup/rollup-linux-x64-gnu': 4.26.0
+ '@rollup/rollup-linux-x64-musl': 4.26.0
+ '@rollup/rollup-win32-arm64-msvc': 4.26.0
+ '@rollup/rollup-win32-ia32-msvc': 4.26.0
+ '@rollup/rollup-win32-x64-msvc': 4.26.0
fsevents: 2.3.3
rpc-websockets@7.11.0:
@@ -36235,6 +36992,8 @@ snapshots:
source-map-js@1.2.0: {}
+ source-map-js@1.2.1: {}
+
source-map-support@0.5.21:
dependencies:
buffer-from: 1.1.2
@@ -36781,10 +37540,10 @@ snapshots:
commander: 2.20.3
source-map-support: 0.5.21
- terser@5.34.1:
+ terser@5.36.0:
dependencies:
'@jridgewell/source-map': 0.3.6
- acorn: 8.12.1
+ acorn: 8.14.0
commander: 2.20.3
source-map-support: 0.5.21
optional: true
@@ -36892,7 +37651,7 @@ snapshots:
tough-cookie@4.1.4:
dependencies:
- psl: 1.9.0
+ psl: 1.10.0
punycode: 2.3.1
universalify: 0.2.0
url-parse: 1.5.10
@@ -36951,7 +37710,7 @@ snapshots:
'@tsconfig/node14': 1.0.3
'@tsconfig/node16': 1.0.4
'@types/node': 20.12.10
- acorn: 8.12.1
+ acorn: 8.14.0
acorn-walk: 8.3.4
arg: 4.1.3
create-require: 1.1.1
@@ -36998,6 +37757,8 @@ snapshots:
tslib@2.7.0: {}
+ tslib@2.8.1: {}
+
tslint@5.20.1(typescript@5.4.5):
dependencies:
'@babel/code-frame': 7.24.2
@@ -37112,7 +37873,7 @@ snapshots:
dependencies:
call-bind: 1.0.7
define-properties: 1.2.1
- es-abstract: 1.23.3
+ es-abstract: 1.23.4
es-errors: 1.3.0
typed-array-buffer: 1.0.2
typed-array-byte-offset: 1.0.2
@@ -37195,6 +37956,8 @@ snapshots:
undici-types@5.26.5: {}
+ undici-types@6.19.8: {}
+
undici@5.28.4:
dependencies:
'@fastify/busboy': 2.1.1
@@ -37208,7 +37971,7 @@ snapshots:
pathe: 1.1.2
ufo: 1.5.4
- unenv@1.9.0:
+ unenv@1.10.0:
dependencies:
consola: 3.2.3
defu: 6.1.4
@@ -37315,13 +38078,13 @@ snapshots:
dependencies:
browserslist: 4.23.3
escalade: 3.1.2
- picocolors: 1.0.1
+ picocolors: 1.1.1
- update-browserslist-db@1.1.1(browserslist@4.24.0):
+ update-browserslist-db@1.1.1(browserslist@4.24.2):
dependencies:
- browserslist: 4.24.0
+ browserslist: 4.24.2
escalade: 3.2.0
- picocolors: 1.1.0
+ picocolors: 1.1.1
uqr@0.1.2: {}
@@ -37521,34 +38284,53 @@ snapshots:
- utf-8-validate
- zod
- vite-bundle-visualizer@1.2.1(rollup@4.18.0):
+ viem@2.21.45(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@5.0.10)(zod@3.23.6):
+ dependencies:
+ '@noble/curves': 1.6.0
+ '@noble/hashes': 1.5.0
+ '@scure/bip32': 1.5.0
+ '@scure/bip39': 1.4.0
+ abitype: 1.0.6(typescript@5.4.5)(zod@3.23.6)
+ isows: 1.0.6(ws@8.18.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))
+ ox: 0.1.2(typescript@5.4.5)(zod@3.23.6)
+ webauthn-p256: 0.0.10
+ ws: 8.18.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)
+ optionalDependencies:
+ typescript: 5.4.5
+ transitivePeerDependencies:
+ - bufferutil
+ - utf-8-validate
+ - zod
+
+ vite-bundle-visualizer@1.2.1(rollup@4.26.0):
dependencies:
cac: 6.7.14
import-from-esm: 1.3.4
- rollup-plugin-visualizer: 5.12.0(rollup@4.18.0)
+ rollup-plugin-visualizer: 5.12.0(rollup@4.26.0)
tmp: 0.2.3
transitivePeerDependencies:
- rollup
- supports-color
- vite-node@1.6.0(@types/node@20.12.10)(sass@1.77.0)(terser@5.34.1):
+ vite-node@1.6.0(@types/node@20.12.10)(sass@1.77.0)(terser@5.36.0):
dependencies:
cac: 6.7.14
debug: 4.3.5
pathe: 1.1.2
picocolors: 1.0.0
- vite: 5.2.12(@types/node@20.12.10)(sass@1.77.0)(terser@5.34.1)
+ vite: 5.4.11(@types/node@20.12.10)(sass@1.77.0)(terser@5.36.0)
transitivePeerDependencies:
- '@types/node'
- less
- lightningcss
- sass
+ - sass-embedded
- stylus
- sugarss
- supports-color
- terser
- vite-plugin-html@3.2.2(vite@5.2.12(@types/node@20.12.10)(sass@1.77.0)(terser@5.34.1)):
+ vite-plugin-html@3.2.2(vite@5.4.11(@types/node@20.12.10)(sass@1.77.0)(terser@5.36.0)):
dependencies:
'@rollup/pluginutils': 4.2.1
colorette: 2.0.20
@@ -37562,39 +38344,39 @@ snapshots:
html-minifier-terser: 6.1.0
node-html-parser: 5.4.2
pathe: 0.2.0
- vite: 5.2.12(@types/node@20.12.10)(sass@1.77.0)(terser@5.34.1)
+ vite: 5.4.11(@types/node@20.12.10)(sass@1.77.0)(terser@5.36.0)
- vite-plugin-node-polyfills@0.22.0(rollup@4.18.0)(vite@5.2.12(@types/node@20.12.10)(sass@1.77.0)(terser@5.34.1)):
+ vite-plugin-node-polyfills@0.22.0(rollup@4.26.0)(vite@5.4.11(@types/node@20.12.10)(sass@1.77.0)(terser@5.36.0)):
dependencies:
- '@rollup/plugin-inject': 5.0.5(rollup@4.18.0)
+ '@rollup/plugin-inject': 5.0.5(rollup@4.26.0)
node-stdlib-browser: 1.2.0
- vite: 5.2.12(@types/node@20.12.10)(sass@1.77.0)(terser@5.34.1)
+ vite: 5.4.11(@types/node@20.12.10)(sass@1.77.0)(terser@5.36.0)
transitivePeerDependencies:
- rollup
- vite-tsconfig-paths@4.3.2(typescript@5.4.5)(vite@5.2.12(@types/node@20.12.10)(sass@1.77.0)(terser@5.34.1)):
+ vite-tsconfig-paths@4.3.2(typescript@5.4.5)(vite@5.4.11(@types/node@20.12.10)(sass@1.77.0)(terser@5.36.0)):
dependencies:
debug: 4.3.4
globrex: 0.1.2
tsconfck: 3.1.0(typescript@5.4.5)
optionalDependencies:
- vite: 5.2.12(@types/node@20.12.10)(sass@1.77.0)(terser@5.34.1)
+ vite: 5.4.11(@types/node@20.12.10)(sass@1.77.0)(terser@5.36.0)
transitivePeerDependencies:
- supports-color
- typescript
- vite@5.2.12(@types/node@20.12.10)(sass@1.77.0)(terser@5.34.1):
+ vite@5.4.11(@types/node@20.12.10)(sass@1.77.0)(terser@5.36.0):
dependencies:
- esbuild: 0.20.2
- postcss: 8.4.38
- rollup: 4.18.0
+ esbuild: 0.21.5
+ postcss: 8.4.49
+ rollup: 4.26.0
optionalDependencies:
'@types/node': 20.12.10
fsevents: 2.3.3
sass: 1.77.0
- terser: 5.34.1
+ terser: 5.36.0
- vitest@1.6.0(@types/node@20.12.10)(jsdom@24.0.0(bufferutil@4.0.8)(utf-8-validate@6.0.3))(sass@1.77.0)(terser@5.34.1):
+ vitest@1.6.0(@types/node@20.12.10)(jsdom@24.0.0(bufferutil@4.0.8)(utf-8-validate@6.0.3))(sass@1.77.0)(terser@5.36.0):
dependencies:
'@vitest/expect': 1.6.0
'@vitest/runner': 1.6.0
@@ -37613,8 +38395,8 @@ snapshots:
strip-literal: 2.1.0
tinybench: 2.8.0
tinypool: 0.8.4
- vite: 5.2.12(@types/node@20.12.10)(sass@1.77.0)(terser@5.34.1)
- vite-node: 1.6.0(@types/node@20.12.10)(sass@1.77.0)(terser@5.34.1)
+ vite: 5.4.11(@types/node@20.12.10)(sass@1.77.0)(terser@5.36.0)
+ vite-node: 1.6.0(@types/node@20.12.10)(sass@1.77.0)(terser@5.36.0)
why-is-node-running: 2.2.2
optionalDependencies:
'@types/node': 20.12.10
@@ -37623,6 +38405,7 @@ snapshots:
- less
- lightningcss
- sass
+ - sass-embedded
- stylus
- sugarss
- supports-color
@@ -37640,10 +38423,10 @@ snapshots:
dependencies:
xml-name-validator: 5.0.0
- wagmi@2.12.8(@tanstack/react-query@4.36.1(react-dom@18.3.1(react@18.3.1))(react-native@0.74.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1))(@types/react@18.3.3)(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-native@0.74.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(rollup@4.18.0)(typescript@5.4.5)(utf-8-validate@5.0.10)(viem@2.21.0(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@5.0.10)(zod@3.23.6))(zod@3.23.6):
+ wagmi@2.12.8(@tanstack/react-query@4.36.1(react-dom@18.3.1(react@18.3.1))(react-native@0.74.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1))(@types/react@18.3.3)(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-native@0.74.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(rollup@4.26.0)(typescript@5.4.5)(utf-8-validate@5.0.10)(viem@2.21.0(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@5.0.10)(zod@3.23.6))(zod@3.23.6):
dependencies:
'@tanstack/react-query': 4.36.1(react-dom@18.3.1(react@18.3.1))(react-native@0.74.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)
- '@wagmi/connectors': 5.1.8(@types/react@18.3.3)(@wagmi/core@2.13.4(@types/react@18.3.3)(react@18.3.1)(typescript@5.4.5)(viem@2.21.0(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@5.0.10)(zod@3.23.6)))(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-native@0.74.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(rollup@4.18.0)(typescript@5.4.5)(utf-8-validate@5.0.10)(viem@2.21.0(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@5.0.10)(zod@3.23.6))(zod@3.23.6)
+ '@wagmi/connectors': 5.1.8(@types/react@18.3.3)(@wagmi/core@2.13.4(@types/react@18.3.3)(react@18.3.1)(typescript@5.4.5)(viem@2.21.0(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@5.0.10)(zod@3.23.6)))(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-native@0.74.0(@babel/core@7.24.5)(@babel/preset-env@7.25.3(@babel/core@7.24.5))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(rollup@4.26.0)(typescript@5.4.5)(utf-8-validate@5.0.10)(viem@2.21.0(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@5.0.10)(zod@3.23.6))(zod@3.23.6)
'@wagmi/core': 2.13.4(@types/react@18.3.3)(react@18.3.1)(typescript@5.4.5)(viem@2.21.0(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@5.0.10)(zod@3.23.6))
react: 18.3.1
use-sync-external-store: 1.2.0(react@18.3.1)
@@ -38484,7 +39267,7 @@ snapshots:
yaml@2.5.0: {}
- yaml@2.5.1:
+ yaml@2.6.0:
optional: true
yargs-parser@18.1.3:
diff --git a/vite.config.ts b/vite.config.ts
index 24dd65016eb..9ca260ed414 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -1,21 +1,19 @@
///
import * as dotenv from 'dotenv';
-import path from 'path';
import { defineConfig } from 'vite';
import tsconfigPaths from 'vite-tsconfig-paths';
-dotenv.config({
- path: path.resolve(__dirname, '.env'),
-});
+dotenv.config();
+
+const pkg = process.env.npm_package_name;
+console.log('vitest:', pkg);
export default defineConfig({
plugins: [tsconfigPaths()],
test: {
- globalSetup: path.resolve(
- __dirname,
- './libs/model/src/tester/vitestDatabaseSetup.ts',
- ),
+ sequence: { concurrent: false },
+ fileParallelism: false, // pkg !== '@hicommonwealth/model',
coverage: {
provider: 'istanbul',
reporter:
From 2b9bdc62a62423200d81a66cf9e9abc86df64725 Mon Sep 17 00:00:00 2001
From: rotorsoft
Date: Wed, 13 Nov 2024 15:34:27 -0500
Subject: [PATCH 044/227] fix test lint
---
libs/model/test/snapshot/createSnapshotProposal.spec.ts | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/libs/model/test/snapshot/createSnapshotProposal.spec.ts b/libs/model/test/snapshot/createSnapshotProposal.spec.ts
index 1988922062f..b718c19c1cb 100644
--- a/libs/model/test/snapshot/createSnapshotProposal.spec.ts
+++ b/libs/model/test/snapshot/createSnapshotProposal.spec.ts
@@ -82,6 +82,9 @@ describe('Snapshot Listener API', { timeout: 5_000 }, () => {
});
expect.fail();
// // eslint-disable-next-line no-empty
- } catch (e) {}
+ } catch (e) {
+ // ignore error
+ console.warn(e);
+ }
});
});
From d93d28dbdf8a115ee8224f0ad64d6aa83f6a8f1c Mon Sep 17 00:00:00 2001
From: rotorsoft
Date: Wed, 13 Nov 2024 16:15:48 -0500
Subject: [PATCH 045/227] fix test bootstrapping
---
libs/model/src/tester/bootstrap.ts | 32 ++++++++++++-------
packages/commonwealth/server-test.ts | 11 +++----
.../integration/api/communityStake.spec.ts | 2 +-
.../test/integration/api/cosmosCache.spec.ts | 2 +-
.../integration/api/createComment.spec.ts | 2 +-
.../integration/api/createReactions.spec.ts | 2 +-
.../integration/api/getAddressProfile.spec.ts | 2 +-
.../test/integration/api/getRoles.spec.ts | 2 +-
.../test/integration/api/index.spec.ts | 2 +-
.../test/integration/api/linking.spec.ts | 2 +-
.../test/integration/api/polls.spec.ts | 2 +-
.../integration/api/thread.update.spec.ts | 2 +-
.../integration/api/updatecommunity.spec.ts | 2 +-
.../integration/api/upgradeMember.spec.ts | 2 +-
.../test/integration/api/user.spec.ts | 2 +-
.../integration/api/userDashboard.spec.ts | 2 +-
.../api/validationMiddleware.spec.ts | 2 +-
.../integration/api/verifyAddress.spec.ts | 2 +-
18 files changed, 40 insertions(+), 35 deletions(-)
diff --git a/libs/model/src/tester/bootstrap.ts b/libs/model/src/tester/bootstrap.ts
index 763f8bf4d9d..d87f6ca41ae 100644
--- a/libs/model/src/tester/bootstrap.ts
+++ b/libs/model/src/tester/bootstrap.ts
@@ -3,7 +3,7 @@ import path from 'path';
import { QueryTypes, Sequelize } from 'sequelize';
import { SequelizeStorage, Umzug } from 'umzug';
import { config } from '../config';
-import { buildDb, type DB } from '../models';
+import { buildDb, syncDb, type DB } from '../models';
/**
* Verifies the existence of a database,
@@ -215,22 +215,30 @@ export const bootstrap_testing = async (
meta: ImportMeta,
truncate = false,
): Promise => {
+ const filename = path.basename(meta.filename);
if (!db) {
- db = buildDb(
- new Sequelize({
- dialect: 'postgres',
- database: config.DB.NAME,
- username: 'commonwealth',
- password: 'edgeware',
- logging: false,
- }),
- );
- console.log('Database object built:', meta.filename);
+ try {
+ await verify_db(config.DB.NAME);
+ db = buildDb(
+ new Sequelize({
+ dialect: 'postgres',
+ database: config.DB.NAME,
+ username: 'commonwealth',
+ password: 'edgeware',
+ logging: false,
+ }),
+ );
+ await syncDb(db);
+ console.log('Database synced:', filename);
+ } catch (e) {
+ console.error('Error bootstrapping test db:', e);
+ throw e;
+ }
}
if (truncate) {
await truncate_db(db);
- console.log('Database truncated:', meta.filename);
+ console.log('Database truncated:', filename);
}
return db;
diff --git a/packages/commonwealth/server-test.ts b/packages/commonwealth/server-test.ts
index a6c55bfe40c..21bb255c561 100644
--- a/packages/commonwealth/server-test.ts
+++ b/packages/commonwealth/server-test.ts
@@ -1,11 +1,12 @@
/* eslint-disable dot-notation */
import { CacheDecorator, RedisCache } from '@hicommonwealth/adapters';
import { cache, dispose } from '@hicommonwealth/core';
-import type { DB, E2E_TestEntities } from '@hicommonwealth/model';
+import { tester, type DB, type E2E_TestEntities } from '@hicommonwealth/model';
import express from 'express';
import 'express-async-errors'; // handle exceptions thrown in express routes
import { config } from './server/config';
import { ModelSeeder, modelSeeder } from './test/util/modelUtils';
+const { main } = await import('./main');
/**
* Encapsulates all the infrastructure required for integration testing, including:
@@ -31,16 +32,12 @@ export type TestServer = {
* Creates local test server connected to test db and seeder utils
* @returns test server
*/
-export const testServer = async (): Promise => {
+export const testServer = async (meta: ImportMeta): Promise => {
// bootstrap test adapters
cache({
adapter: new RedisCache('redis://localhost:6379'),
});
-
- const { tester } = await import('@hicommonwealth/model');
- const { main } = await import('./main');
-
- const db = await tester.seedDb(import.meta);
+ const db = await tester.seedDb(meta);
const app = express();
const { server, cacheDecorator } = await main(app, db, {
port: 8081,
diff --git a/packages/commonwealth/test/integration/api/communityStake.spec.ts b/packages/commonwealth/test/integration/api/communityStake.spec.ts
index bd95f072faf..4c8ed555d49 100644
--- a/packages/commonwealth/test/integration/api/communityStake.spec.ts
+++ b/packages/commonwealth/test/integration/api/communityStake.spec.ts
@@ -33,7 +33,7 @@ describe('POST communityStakes Tests', () => {
let server: TestServer;
beforeAll(async () => {
- server = await testServer();
+ server = await testServer(import.meta);
});
afterAll(async () => {
diff --git a/packages/commonwealth/test/integration/api/cosmosCache.spec.ts b/packages/commonwealth/test/integration/api/cosmosCache.spec.ts
index 053c90be91b..d170d001b48 100644
--- a/packages/commonwealth/test/integration/api/cosmosCache.spec.ts
+++ b/packages/commonwealth/test/integration/api/cosmosCache.spec.ts
@@ -43,7 +43,7 @@ describe('Cosmos Cache', () => {
}
beforeAll(async () => {
- server = await testServer();
+ server = await testServer(import.meta);
await cache().ready();
});
diff --git a/packages/commonwealth/test/integration/api/createComment.spec.ts b/packages/commonwealth/test/integration/api/createComment.spec.ts
index 2dfae635dc8..9e952cff42d 100644
--- a/packages/commonwealth/test/integration/api/createComment.spec.ts
+++ b/packages/commonwealth/test/integration/api/createComment.spec.ts
@@ -63,7 +63,7 @@ describe('createComment Integration Tests', () => {
};
beforeAll(async () => {
- server = await testServer();
+ server = await testServer(import.meta);
});
afterAll(async () => {
diff --git a/packages/commonwealth/test/integration/api/createReactions.spec.ts b/packages/commonwealth/test/integration/api/createReactions.spec.ts
index fb3630748fa..27a1a748bb7 100644
--- a/packages/commonwealth/test/integration/api/createReactions.spec.ts
+++ b/packages/commonwealth/test/integration/api/createReactions.spec.ts
@@ -51,7 +51,7 @@ describe('createReaction Integration Tests', () => {
};
beforeAll(async () => {
- server = await testServer();
+ server = await testServer(import.meta);
const res = await server.seeder.createAndVerifyAddress(
{ chain: communityId },
diff --git a/packages/commonwealth/test/integration/api/getAddressProfile.spec.ts b/packages/commonwealth/test/integration/api/getAddressProfile.spec.ts
index 6193e11d4b3..d47b42a2990 100644
--- a/packages/commonwealth/test/integration/api/getAddressProfile.spec.ts
+++ b/packages/commonwealth/test/integration/api/getAddressProfile.spec.ts
@@ -8,7 +8,7 @@ describe('getAddressProfile tests', () => {
let server: TestServer;
beforeAll(async () => {
- server = await testServer();
+ server = await testServer(import.meta);
});
afterAll(async () => {
diff --git a/packages/commonwealth/test/integration/api/getRoles.spec.ts b/packages/commonwealth/test/integration/api/getRoles.spec.ts
index a5ccddd0100..6ca1e3fc46e 100644
--- a/packages/commonwealth/test/integration/api/getRoles.spec.ts
+++ b/packages/commonwealth/test/integration/api/getRoles.spec.ts
@@ -15,7 +15,7 @@ describe('get roles Integration Tests', () => {
let server: TestServer;
beforeAll(async () => {
- server = await testServer();
+ server = await testServer(import.meta);
});
afterAll(async () => {
diff --git a/packages/commonwealth/test/integration/api/index.spec.ts b/packages/commonwealth/test/integration/api/index.spec.ts
index 759cf70c800..b551eacf72f 100644
--- a/packages/commonwealth/test/integration/api/index.spec.ts
+++ b/packages/commonwealth/test/integration/api/index.spec.ts
@@ -19,7 +19,7 @@ describe('API Tests', () => {
let server: TestServer;
beforeAll(async () => {
- server = await testServer();
+ server = await testServer(import.meta);
});
afterAll(async () => {
diff --git a/packages/commonwealth/test/integration/api/linking.spec.ts b/packages/commonwealth/test/integration/api/linking.spec.ts
index c3bf74609d7..038682dcac0 100644
--- a/packages/commonwealth/test/integration/api/linking.spec.ts
+++ b/packages/commonwealth/test/integration/api/linking.spec.ts
@@ -57,7 +57,7 @@ describe('Linking Tests', () => {
const link5 = { source: LinkSource.Proposal, identifier: '4' };
beforeAll(async () => {
- server = await testServer();
+ server = await testServer(import.meta);
const topic = await server.models.Topic.findOne({
where: {
diff --git a/packages/commonwealth/test/integration/api/polls.spec.ts b/packages/commonwealth/test/integration/api/polls.spec.ts
index d72aa328fd6..82d91fa64a1 100644
--- a/packages/commonwealth/test/integration/api/polls.spec.ts
+++ b/packages/commonwealth/test/integration/api/polls.spec.ts
@@ -34,7 +34,7 @@ describe('Polls', () => {
let server: TestServer;
beforeAll(async () => {
- server = await testServer();
+ server = await testServer(import.meta);
const topic = await server.models.Topic.findOne({
where: {
diff --git a/packages/commonwealth/test/integration/api/thread.update.spec.ts b/packages/commonwealth/test/integration/api/thread.update.spec.ts
index 5295350db29..e0d1bade034 100644
--- a/packages/commonwealth/test/integration/api/thread.update.spec.ts
+++ b/packages/commonwealth/test/integration/api/thread.update.spec.ts
@@ -48,7 +48,7 @@ describe('Thread Patch Update', () => {
let server: TestServer;
beforeAll(async () => {
- server = await testServer();
+ server = await testServer(import.meta);
const adminRes = await server.seeder.createAndVerifyAddress(
{ chain },
diff --git a/packages/commonwealth/test/integration/api/updatecommunity.spec.ts b/packages/commonwealth/test/integration/api/updatecommunity.spec.ts
index c99eecd191b..737a88f2a13 100644
--- a/packages/commonwealth/test/integration/api/updatecommunity.spec.ts
+++ b/packages/commonwealth/test/integration/api/updatecommunity.spec.ts
@@ -36,7 +36,7 @@ describe('Update Community/Chain Tests', () => {
let server: TestServer;
beforeAll(async () => {
- server = await testServer();
+ server = await testServer(import.meta);
// get logged in address/user with JWT
const result = await server.seeder.createAndVerifyAddress(
diff --git a/packages/commonwealth/test/integration/api/upgradeMember.spec.ts b/packages/commonwealth/test/integration/api/upgradeMember.spec.ts
index 9711f925d6b..0e53faff6ca 100644
--- a/packages/commonwealth/test/integration/api/upgradeMember.spec.ts
+++ b/packages/commonwealth/test/integration/api/upgradeMember.spec.ts
@@ -15,7 +15,7 @@ describe('upgradeMember Integration Tests', () => {
let server: TestServer;
beforeAll(async () => {
- server = await testServer();
+ server = await testServer(import.meta);
});
afterAll(async () => {
diff --git a/packages/commonwealth/test/integration/api/user.spec.ts b/packages/commonwealth/test/integration/api/user.spec.ts
index 009357608d4..840fbfbec71 100644
--- a/packages/commonwealth/test/integration/api/user.spec.ts
+++ b/packages/commonwealth/test/integration/api/user.spec.ts
@@ -17,7 +17,7 @@ describe('User Model Routes', () => {
let server: TestServer;
beforeAll(async () => {
- server = await testServer();
+ server = await testServer(import.meta);
});
afterAll(async () => {
diff --git a/packages/commonwealth/test/integration/api/userDashboard.spec.ts b/packages/commonwealth/test/integration/api/userDashboard.spec.ts
index e1abfa1541f..ff7746b04fe 100644
--- a/packages/commonwealth/test/integration/api/userDashboard.spec.ts
+++ b/packages/commonwealth/test/integration/api/userDashboard.spec.ts
@@ -43,7 +43,7 @@ describe('User Dashboard API', () => {
let server: TestServer;
beforeAll(async () => {
- server = await testServer();
+ server = await testServer(import.meta);
const topic = await server.models.Topic.findOne({
where: {
diff --git a/packages/commonwealth/test/integration/api/validationMiddleware.spec.ts b/packages/commonwealth/test/integration/api/validationMiddleware.spec.ts
index d0e3b5a9e9c..8af03b52067 100644
--- a/packages/commonwealth/test/integration/api/validationMiddleware.spec.ts
+++ b/packages/commonwealth/test/integration/api/validationMiddleware.spec.ts
@@ -31,7 +31,7 @@ describe('DatabaseValidationService Tests', () => {
let server: TestServer;
beforeAll(async function () {
- server = await testServer();
+ server = await testServer(import.meta);
console.log('Database reset');
databaseValidationService = new DatabaseValidationService(server.models);
let res = await server.seeder.createAndVerifyAddress({ chain }, 'Alice');
diff --git a/packages/commonwealth/test/integration/api/verifyAddress.spec.ts b/packages/commonwealth/test/integration/api/verifyAddress.spec.ts
index 7d28dc2895b..a77d28d216b 100644
--- a/packages/commonwealth/test/integration/api/verifyAddress.spec.ts
+++ b/packages/commonwealth/test/integration/api/verifyAddress.spec.ts
@@ -22,7 +22,7 @@ describe('Verify Address Routes', () => {
const chain_id = '1';
beforeAll(async () => {
- server = await testServer();
+ server = await testServer(import.meta);
sessionSigner = new SIWESigner({ chainId: parseInt(chain_id) });
const { payload } = await sessionSigner.newSession(CANVAS_TOPIC);
From f0c455edc99e9fa8dffa9b1796b2e881fed8bc8c Mon Sep 17 00:00:00 2001
From: rotorsoft
Date: Wed, 13 Nov 2024 16:31:53 -0500
Subject: [PATCH 046/227] increase test timeout
---
libs/model/test/seed/model.spec.ts | 66 ++++++++++++++++--------------
1 file changed, 35 insertions(+), 31 deletions(-)
diff --git a/libs/model/test/seed/model.spec.ts b/libs/model/test/seed/model.spec.ts
index 4f4fa72a520..598631c6c42 100644
--- a/libs/model/test/seed/model.spec.ts
+++ b/libs/model/test/seed/model.spec.ts
@@ -47,40 +47,44 @@ const generateSchemas = async () => {
);
};
-describe('Model schema', () => {
- let schemas: Record;
+describe(
+ 'Model schema',
+ () => {
+ let schemas: Record;
- beforeAll(async () => {
- schemas = await generateSchemas();
- });
+ beforeAll(async () => {
+ schemas = await generateSchemas();
+ });
- afterAll(async () => {
- await dispose()();
- });
+ afterAll(async () => {
+ await dispose()();
+ });
- const s = new Sequelize({
- dialect: 'postgres',
- username: 'commonwealth',
- password: 'edgeware',
- logging: false,
- });
- Object.values(Factories).forEach((factory) => {
- const m = factory(s);
- test(`Should match ${m.tableName}`, async () => {
- const { model, migration } = schemas[m.tableName];
+ const s = new Sequelize({
+ dialect: 'postgres',
+ username: 'commonwealth',
+ password: 'edgeware',
+ logging: false,
+ });
+ Object.values(Factories).forEach((factory) => {
+ const m = factory(s);
+ test(`Should match ${m.tableName}`, async () => {
+ const { model, migration } = schemas[m.tableName];
- //console.log(model.columns, migration.columns);
- expect(model.columns).deep.equals(migration.columns);
+ //console.log(model.columns, migration.columns);
+ expect(model.columns).deep.equals(migration.columns);
- // ['Quests', 'Addresses'].includes(model.table_name) &&
- // console.log(
- // { model, migration },
- // //[...model.constraints.values()],
- // //[...migration.constraints.values()],
- // );
- expect([...model.constraints.values()]).deep.equals([
- ...migration.constraints.values(),
- ]);
+ // ['Quests', 'Addresses'].includes(model.table_name) &&
+ // console.log(
+ // { model, migration },
+ // //[...model.constraints.values()],
+ // //[...migration.constraints.values()],
+ // );
+ expect([...model.constraints.values()]).deep.equals([
+ ...migration.constraints.values(),
+ ]);
+ });
});
- });
-});
+ },
+ { timeout: 20000 },
+);
From 35b275899c4f46c16cd4fcaa65917424792260d1 Mon Sep 17 00:00:00 2001
From: rotorsoft
Date: Wed, 13 Nov 2024 16:46:04 -0500
Subject: [PATCH 047/227] increase test timeout
---
libs/model/test/seed/model.spec.ts | 48 +++++++++++++++---------------
1 file changed, 24 insertions(+), 24 deletions(-)
diff --git a/libs/model/test/seed/model.spec.ts b/libs/model/test/seed/model.spec.ts
index 598631c6c42..233df4d2dbc 100644
--- a/libs/model/test/seed/model.spec.ts
+++ b/libs/model/test/seed/model.spec.ts
@@ -47,28 +47,28 @@ const generateSchemas = async () => {
);
};
-describe(
- 'Model schema',
- () => {
- let schemas: Record;
+describe('Model schema', () => {
+ let schemas: Record;
- beforeAll(async () => {
- schemas = await generateSchemas();
- });
+ beforeAll(async () => {
+ schemas = await generateSchemas();
+ });
- afterAll(async () => {
- await dispose()();
- });
+ afterAll(async () => {
+ await dispose()();
+ });
- const s = new Sequelize({
- dialect: 'postgres',
- username: 'commonwealth',
- password: 'edgeware',
- logging: false,
- });
- Object.values(Factories).forEach((factory) => {
- const m = factory(s);
- test(`Should match ${m.tableName}`, async () => {
+ const s = new Sequelize({
+ dialect: 'postgres',
+ username: 'commonwealth',
+ password: 'edgeware',
+ logging: false,
+ });
+ Object.values(Factories).forEach((factory) => {
+ const m = factory(s);
+ test(
+ `Should match ${m.tableName}`,
+ async () => {
const { model, migration } = schemas[m.tableName];
//console.log(model.columns, migration.columns);
@@ -83,8 +83,8 @@ describe(
expect([...model.constraints.values()]).deep.equals([
...migration.constraints.values(),
]);
- });
- });
- },
- { timeout: 20000 },
-);
+ },
+ { timeout: 20000 },
+ );
+ });
+});
From 5ce554524eda5de81ff80ec34abd59e6b085a180 Mon Sep 17 00:00:00 2001
From: rotorsoft
Date: Wed, 13 Nov 2024 16:53:59 -0500
Subject: [PATCH 048/227] increase test timeout
---
libs/model/test/seed/model.spec.ts | 34 +++++++++++++-----------------
1 file changed, 15 insertions(+), 19 deletions(-)
diff --git a/libs/model/test/seed/model.spec.ts b/libs/model/test/seed/model.spec.ts
index 233df4d2dbc..c8e0a0d08e0 100644
--- a/libs/model/test/seed/model.spec.ts
+++ b/libs/model/test/seed/model.spec.ts
@@ -52,7 +52,7 @@ describe('Model schema', () => {
beforeAll(async () => {
schemas = await generateSchemas();
- });
+ }, 20000);
afterAll(async () => {
await dispose()();
@@ -66,25 +66,21 @@ describe('Model schema', () => {
});
Object.values(Factories).forEach((factory) => {
const m = factory(s);
- test(
- `Should match ${m.tableName}`,
- async () => {
- const { model, migration } = schemas[m.tableName];
+ test(`Should match ${m.tableName}`, async () => {
+ const { model, migration } = schemas[m.tableName];
- //console.log(model.columns, migration.columns);
- expect(model.columns).deep.equals(migration.columns);
+ //console.log(model.columns, migration.columns);
+ expect(model.columns).deep.equals(migration.columns);
- // ['Quests', 'Addresses'].includes(model.table_name) &&
- // console.log(
- // { model, migration },
- // //[...model.constraints.values()],
- // //[...migration.constraints.values()],
- // );
- expect([...model.constraints.values()]).deep.equals([
- ...migration.constraints.values(),
- ]);
- },
- { timeout: 20000 },
- );
+ // ['Quests', 'Addresses'].includes(model.table_name) &&
+ // console.log(
+ // { model, migration },
+ // //[...model.constraints.values()],
+ // //[...migration.constraints.values()],
+ // );
+ expect([...model.constraints.values()]).deep.equals([
+ ...migration.constraints.values(),
+ ]);
+ });
});
});
From 006d2f5a3706ad84f55105f1605d5ef9aed49774 Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Thu, 14 Nov 2024 18:07:15 +0500
Subject: [PATCH 049/227] Reordered state export
---
.../ReceiptDetails/BuyReceipt.tsx | 11 +++++++----
.../TradeTokenForm/TradeTokenForm.tsx | 4 ++--
.../TradeTokenForm/useTradeTokenForm.ts | 17 +++++++++--------
3 files changed, 18 insertions(+), 14 deletions(-)
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/ReceiptDetails/BuyReceipt.tsx b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/ReceiptDetails/BuyReceipt.tsx
index 24ac076b43d..5b18c831728 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/ReceiptDetails/BuyReceipt.tsx
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/ReceiptDetails/BuyReceipt.tsx
@@ -39,15 +39,18 @@ const BuyReceipt = ({ trading }: ReceiptDetailsProps) => {
- Common's Platform Fee ({trading.commonPlatformFee.percentage})
+ Common's Platform Fee (
+ {trading.amounts.buy.commonPlatformFee.percentage})
+
+
+ {trading.amounts.buy.commonPlatformFee.eth} ETH
- {trading.commonPlatformFee.eth} ETH
Remaining ETH to tokens
- {trading.amounts.buy.eth - trading.commonPlatformFee.eth} ETH ={' '}
- {trading.amounts.buy.token} {trading.token.symbol}
+ {trading.amounts.buy.eth - trading.amounts.buy.commonPlatformFee.eth}{' '}
+ ETH = {trading.amounts.buy.token} {trading.token.symbol}
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx
index 36015772133..e5d22ee3740 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx
@@ -108,10 +108,10 @@ const TradeTokenForm = ({
Current balance
- {addresses.selected.ethBalance.isLoading ? (
+ {addresses.selected.balances.eth.isLoading ? (
) : (
- addresses.selected.ethBalance.value
+ addresses.selected.balances.eth.value
)}
ETH
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts
index 6678c8b25a9..8e90fe1fea2 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts
@@ -213,25 +213,26 @@ const useTradeTokenForm = ({
},
insufficientFunds:
ethBuyAmount > parseFloat(selectedAddressEthBalance),
+ commonPlatformFee: {
+ percentage: `${COMMON_PLATFORM_FEE_PERCENTAGE}%`,
+ eth: commonPlatformFeeForBuyTradeInEth,
+ },
},
},
unitEthToBaseCurrencyRate: ethToCurrencyRate,
mode: { value: tradingMode, onChange: onTradingModeChange },
token: tradeConfig.token,
- // TODO: hardcoded for now
- commonPlatformFee: {
- percentage: `${COMMON_PLATFORM_FEE_PERCENTAGE}%`,
- eth: commonPlatformFeeForBuyTradeInEth,
- },
},
addresses: {
available: userAddresses,
default: selectedAddress,
selected: {
value: selectedAddress,
- ethBalance: {
- value: selectedAddressEthBalance,
- isLoading: isLoadingUserEthBalance,
+ balances: {
+ eth: {
+ value: selectedAddressEthBalance,
+ isLoading: isLoadingUserEthBalance,
+ },
},
onChange: onChangeSelectedAddress,
},
From a3eb5f6417384e308b518ae9b03cde0ee16af1fe Mon Sep 17 00:00:00 2001
From: Ryan Bennett
Date: Thu, 14 Nov 2024 05:16:19 -0800
Subject: [PATCH 050/227] wire up contest + eligibility frames
---
.../model/src/contest/GetAllContests.query.ts | 19 +++++++-----
libs/schemas/src/queries/contests.schemas.ts | 9 +++++-
packages/commonwealth/package.json | 3 +-
.../frames/contest/checkEligibility.tsx | 26 ++++++++++------
.../farcaster/frames/contest/contestCard.tsx | 12 ++++----
.../commonwealth/server/farcaster/utils.tsx | 30 +++++++++++++++++++
pnpm-lock.yaml | 23 +++++++-------
7 files changed, 87 insertions(+), 35 deletions(-)
diff --git a/libs/model/src/contest/GetAllContests.query.ts b/libs/model/src/contest/GetAllContests.query.ts
index 3d958ff1947..168310de252 100644
--- a/libs/model/src/contest/GetAllContests.query.ts
+++ b/libs/model/src/contest/GetAllContests.query.ts
@@ -1,4 +1,4 @@
-import { Query } from '@hicommonwealth/core';
+import { InvalidInput, Query } from '@hicommonwealth/core';
import * as schemas from '@hicommonwealth/schemas';
import { QueryTypes } from 'sequelize';
import { z } from 'zod';
@@ -10,6 +10,9 @@ export function GetAllContests(): Query {
auth: [],
secure: false,
body: async ({ payload }) => {
+ if (!payload.community_id && !payload.contest_address) {
+ throw new InvalidInput('Must specify community_id or contest_address');
+ }
const results = await models.sequelize.query<
z.infer
>(
@@ -69,12 +72,9 @@ from
group by c.contest_address
) as c on cm.contest_address = c.contest_address
where
- cm.community_id = :community_id
- ${
- payload.contest_address
- ? `and cm.contest_address = '${payload.contest_address}'`
- : ''
- }
+ ${payload.community_id ? 'cm.community_id = :community_id' : ''}
+ ${payload.community_id && payload.contest_address ? 'and' : ''}
+ ${payload.contest_address ? `cm.contest_address = :contest_address` : ''}
group by
cm.community_id,
cm.contest_address,
@@ -95,7 +95,10 @@ order by
{
type: QueryTypes.SELECT,
raw: true,
- replacements: { community_id: payload.community_id },
+ replacements: {
+ community_id: payload.community_id,
+ contest_address: payload.contest_address,
+ },
},
);
results.forEach((r) => {
diff --git a/libs/schemas/src/queries/contests.schemas.ts b/libs/schemas/src/queries/contests.schemas.ts
index 5a72772d9eb..eb19dac0bd3 100644
--- a/libs/schemas/src/queries/contests.schemas.ts
+++ b/libs/schemas/src/queries/contests.schemas.ts
@@ -17,7 +17,7 @@ export const ContestResults = ContestManager.extend({
export const GetAllContests = {
input: z.object({
- community_id: z.string(),
+ community_id: z.string().optional(),
contest_address: z.string().optional(),
contest_id: z.number().int().optional(),
running: z.boolean().optional().describe('Only active contests'),
@@ -25,6 +25,13 @@ export const GetAllContests = {
output: z.array(ContestResults),
};
+export const GetContest = {
+ input: z.object({
+ contest_address: z.string().optional(),
+ }),
+ output: z.object({}).merge(ContestManager),
+};
+
export const GetActiveContestManagers = {
input: z.object({
community_id: z.string(),
diff --git a/packages/commonwealth/package.json b/packages/commonwealth/package.json
index 403f1441e45..ffe9d9cd2ee 100644
--- a/packages/commonwealth/package.json
+++ b/packages/commonwealth/package.json
@@ -118,8 +118,8 @@
"@ipld/dag-json": "^10.2.0",
"@keplr-wallet/types": "^0.12.23",
"@keplr-wallet/unit": "^0.12.23",
- "@knocklabs/node": "^0.6.13",
"@knocklabs/client": "^0.10.13",
+ "@knocklabs/node": "^0.6.13",
"@knocklabs/react": "^0.2.15",
"@knocklabs/react-notification-feed": "^0.8.15",
"@lexical/rich-text": "^0.17.0",
@@ -131,6 +131,7 @@
"@metamask/detect-provider": "^2.0.0",
"@metamask/eth-sig-util": "^4.0.0",
"@mui/base": "5.0.0-beta.5",
+ "@neynar/nodejs-sdk": "^1.55.0",
"@noble/hashes": "^1.4.0",
"@openfeature/core": "^1.1.0",
"@openfeature/react-sdk": "^0.1.1-experimental",
diff --git a/packages/commonwealth/server/farcaster/frames/contest/checkEligibility.tsx b/packages/commonwealth/server/farcaster/frames/contest/checkEligibility.tsx
index 02751e478ed..0cb0cc24616 100644
--- a/packages/commonwealth/server/farcaster/frames/contest/checkEligibility.tsx
+++ b/packages/commonwealth/server/farcaster/frames/contest/checkEligibility.tsx
@@ -1,21 +1,27 @@
import { Button } from 'frames.js/express';
import React from 'react';
import { frames } from '../../config';
-import { circleCheckIcon, circleXIcon, fakeApiCall } from '../../utils';
+import { circleCheckIcon, circleXIcon, getFarcasterUser } from '../../utils';
export const checkEligibility = frames(async (ctx) => {
- let eligible: boolean;
+ let ethAddress: string | null | undefined = null;
try {
- await fakeApiCall({ error: 'error' });
- eligible = true;
- } catch {
- eligible = false;
+ const fid = ctx.message?.requesterFid;
+ if (!fid) {
+ throw new Error('invalid fid');
+ }
+ const user = await getFarcasterUser(fid);
+ ethAddress = user?.custody_address;
+ } catch (err) {
+ console.warn(err);
}
- const icon = eligible ? circleCheckIcon : circleXIcon;
- const title = eligible ? 'You are eligible to enter' : 'You are not eligible';
- const description = eligible
+ const icon = ethAddress ? circleCheckIcon : circleXIcon;
+ const title = ethAddress
+ ? `You are eligible to enter`
+ : 'You are not eligible';
+ const description = ethAddress
? 'Reply to this cast or quote this frame to be entered into the contest.'
: 'In order to enter this contest you must connect an Ethereum wallet to your Farcaster account.';
@@ -48,6 +54,8 @@ export const checkEligibility = frames(async (ctx) => {
{title}
+ {ethAddress}
+
{description}
),
diff --git a/packages/commonwealth/server/farcaster/frames/contest/contestCard.tsx b/packages/commonwealth/server/farcaster/frames/contest/contestCard.tsx
index 2104fb6b8bd..b52ef578632 100644
--- a/packages/commonwealth/server/farcaster/frames/contest/contestCard.tsx
+++ b/packages/commonwealth/server/farcaster/frames/contest/contestCard.tsx
@@ -1,6 +1,7 @@
import { Button } from 'frames.js/express';
import moment from 'moment';
import React from 'react';
+import { getContestManagerScores } from 'server/farcaster/utils';
import { frames } from '../../config';
const PrizeRow = ({ index, prize }: { index: number; prize: number }) => {
@@ -35,12 +36,13 @@ export const contestCard = frames(async (ctx) => {
// image, title, description, prizes
// check designs https://www.figma.com/design/NNqlhNPHvn0O96TCBIi6WU/Contests?node-id=960-3689&t=8ogN11dhaRqJP8ET-1
- const prizes = [0.005, 0.003, 0.001];
-
const contest_address = ctx.url.pathname.split('/')[1];
+ const { contestManager, prizes } =
+ await getContestManagerScores(contest_address);
+
return {
- title: 'Contest Title',
+ title: contestManager.name,
image: (
{
fontSize: '56px',
}}
>
- Contest Title
+ {contestManager.name}
{contest_address}
-
-
This is contest description.
Current Prizes
{prizes.length ? (
diff --git a/packages/commonwealth/server/farcaster/utils.tsx b/packages/commonwealth/server/farcaster/utils.tsx
index ddabf38f64e..ea576eae558 100644
--- a/packages/commonwealth/server/farcaster/utils.tsx
+++ b/packages/commonwealth/server/farcaster/utils.tsx
@@ -1,3 +1,6 @@
+import { Actor, query } from '@hicommonwealth/core';
+import { Contest, config } from '@hicommonwealth/model';
+import { NeynarAPIClient } from '@neynar/nodejs-sdk';
import React from 'react';
// This might not be needed in the future but for now reduces the amount of boilerplate
@@ -110,3 +113,30 @@ export const getRandomColor = () =>
export const getInvertedColor = (randomColor: string) =>
(parseInt(randomColor, 16) ^ 16777215).toString(16);
+
+export const getFarcasterUser = async (fid: number) => {
+ const client = new NeynarAPIClient(config.CONTESTS.NEYNAR_API_KEY!);
+ const farcasterUser = await client.fetchBulkUsers([fid]);
+ return farcasterUser.users.at(0);
+};
+
+export const getContestManagerScores = async (contest_address: string) => {
+ const actor: Actor = { user: { email: '' } };
+ const results = await query(Contest.GetAllContests(), {
+ actor,
+ payload: { contest_address },
+ });
+
+ if (!results?.length) {
+ throw new Error('contest manager not found');
+ }
+
+ const contestManager = results[0];
+
+ const prizes =
+ contestManager.contests[0].score?.map(
+ (score) => Number(score.prize) / 10 ** contestManager.decimals,
+ ) || [];
+
+ return { contestManager, prizes };
+};
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index a9b9dc58d18..376aae27f44 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -961,6 +961,9 @@ importers:
'@mui/base':
specifier: 5.0.0-beta.5
version: 5.0.0-beta.5(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
+ '@neynar/nodejs-sdk':
+ specifier: ^1.55.0
+ version: 1.66.0(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@5.0.10)(zod@3.23.6)
'@noble/hashes':
specifier: ^1.4.0
version: 1.4.0
@@ -16585,8 +16588,8 @@ snapshots:
'@aws-crypto/sha1-browser': 3.0.0
'@aws-crypto/sha256-browser': 3.0.0
'@aws-crypto/sha256-js': 3.0.0
- '@aws-sdk/client-sso-oidc': 3.577.0(@aws-sdk/client-sts@3.577.0)
- '@aws-sdk/client-sts': 3.577.0
+ '@aws-sdk/client-sso-oidc': 3.577.0
+ '@aws-sdk/client-sts': 3.577.0(@aws-sdk/client-sso-oidc@3.577.0)
'@aws-sdk/core': 3.576.0
'@aws-sdk/credential-provider-node': 3.577.0(@aws-sdk/client-sso-oidc@3.577.0)(@aws-sdk/client-sts@3.577.0)
'@aws-sdk/middleware-bucket-endpoint': 3.577.0
@@ -16643,11 +16646,11 @@ snapshots:
transitivePeerDependencies:
- aws-crt
- '@aws-sdk/client-sso-oidc@3.577.0(@aws-sdk/client-sts@3.577.0)':
+ '@aws-sdk/client-sso-oidc@3.577.0':
dependencies:
'@aws-crypto/sha256-browser': 3.0.0
'@aws-crypto/sha256-js': 3.0.0
- '@aws-sdk/client-sts': 3.577.0
+ '@aws-sdk/client-sts': 3.577.0(@aws-sdk/client-sso-oidc@3.577.0)
'@aws-sdk/core': 3.576.0
'@aws-sdk/credential-provider-node': 3.577.0(@aws-sdk/client-sso-oidc@3.577.0)(@aws-sdk/client-sts@3.577.0)
'@aws-sdk/middleware-host-header': 3.577.0
@@ -16686,7 +16689,6 @@ snapshots:
'@smithy/util-utf8': 3.0.0
tslib: 2.7.0
transitivePeerDependencies:
- - '@aws-sdk/client-sts'
- aws-crt
'@aws-sdk/client-sso@3.577.0':
@@ -16732,11 +16734,11 @@ snapshots:
transitivePeerDependencies:
- aws-crt
- '@aws-sdk/client-sts@3.577.0':
+ '@aws-sdk/client-sts@3.577.0(@aws-sdk/client-sso-oidc@3.577.0)':
dependencies:
'@aws-crypto/sha256-browser': 3.0.0
'@aws-crypto/sha256-js': 3.0.0
- '@aws-sdk/client-sso-oidc': 3.577.0(@aws-sdk/client-sts@3.577.0)
+ '@aws-sdk/client-sso-oidc': 3.577.0
'@aws-sdk/core': 3.576.0
'@aws-sdk/credential-provider-node': 3.577.0(@aws-sdk/client-sso-oidc@3.577.0)(@aws-sdk/client-sts@3.577.0)
'@aws-sdk/middleware-host-header': 3.577.0
@@ -16775,6 +16777,7 @@ snapshots:
'@smithy/util-utf8': 3.0.0
tslib: 2.7.0
transitivePeerDependencies:
+ - '@aws-sdk/client-sso-oidc'
- aws-crt
'@aws-sdk/core@3.576.0':
@@ -16808,7 +16811,7 @@ snapshots:
'@aws-sdk/credential-provider-ini@3.577.0(@aws-sdk/client-sso-oidc@3.577.0)(@aws-sdk/client-sts@3.577.0)':
dependencies:
- '@aws-sdk/client-sts': 3.577.0
+ '@aws-sdk/client-sts': 3.577.0(@aws-sdk/client-sso-oidc@3.577.0)
'@aws-sdk/credential-provider-env': 3.577.0
'@aws-sdk/credential-provider-process': 3.577.0
'@aws-sdk/credential-provider-sso': 3.577.0(@aws-sdk/client-sso-oidc@3.577.0)
@@ -16865,7 +16868,7 @@ snapshots:
'@aws-sdk/credential-provider-web-identity@3.577.0(@aws-sdk/client-sts@3.577.0)':
dependencies:
- '@aws-sdk/client-sts': 3.577.0
+ '@aws-sdk/client-sts': 3.577.0(@aws-sdk/client-sso-oidc@3.577.0)
'@aws-sdk/types': 3.577.0
'@smithy/property-provider': 3.0.0
'@smithy/types': 3.0.0
@@ -17003,7 +17006,7 @@ snapshots:
'@aws-sdk/token-providers@3.577.0(@aws-sdk/client-sso-oidc@3.577.0)':
dependencies:
- '@aws-sdk/client-sso-oidc': 3.577.0(@aws-sdk/client-sts@3.577.0)
+ '@aws-sdk/client-sso-oidc': 3.577.0
'@aws-sdk/types': 3.577.0
'@smithy/property-provider': 3.0.0
'@smithy/shared-ini-file-loader': 3.0.0
From 6d0c9a7927e58ea375597968c30d0b103c0729e5 Mon Sep 17 00:00:00 2001
From: rotorsoft
Date: Thu, 14 Nov 2024 08:45:52 -0500
Subject: [PATCH 051/227] remove file parallelism in scripts
---
common_knowledge/Package-Scripts.md | 12 ++++++------
libs/model/package.json | 4 ++--
packages/commonwealth/package.json | 12 ++++++------
3 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/common_knowledge/Package-Scripts.md b/common_knowledge/Package-Scripts.md
index 9099d4da3ed..95a97d40487 100644
--- a/common_knowledge/Package-Scripts.md
+++ b/common_knowledge/Package-Scripts.md
@@ -299,31 +299,31 @@ See `test-unit`.
### test-api
-Definition: `NODE_ENV=test vitest --config ../../vite.config.ts --fileParallelism=false run ./test/integration/api`
+Definition: `NODE_ENV=test vitest --config ../../vite.config.ts run ./test/integration/api`
Description: Runs all tests in the /api subfolder of the /integration directory.
### test-integration
-Definition: `NODE_ENV=test vitest --config ../../vite.config.ts --fileParallelism=false run ./test/integration`
+Definition: `NODE_ENV=test vitest --config ../../vite.config.ts run ./test/integration`
Description: Runs all tests in the /test/integration folder (includes API tests).
### test-devnet:evm
-Definition: `NODE_ENV=test vitest --config ../../vite.config.ts --fileParallelism=false run ./test/devnet/evm`
+Definition: `NODE_ENV=test vitest --config ../../vite.config.ts run ./test/devnet/evm`
Description: Runs all tests in our `/devnet/evm` folder.
### test-devnet:cosmos
-Definition: `NODE_ENV=test vitest --config ../../vite.config.ts --fileParallelism=false run ./test/devnet/cosmos`
+Definition: `NODE_ENV=test vitest --config ../../vite.config.ts run ./test/devnet/cosmos`
Description: Runs all tests in our `/devnet/cosmos` folder.
### test-select
-Definition: `NODE_ENV=test vitest --config ../../vite.config.ts --fileParallelism=false run`
+Definition: `NODE_ENV=test vitest --config ../../vite.config.ts run`
Description: Append a path to run specific test files or folders.
@@ -335,7 +335,7 @@ Description: Tests all .spec files within the `./test/unit` sub-directory of tes
### test-select:watch
-Definition: `NODE_ENV=test vitest --config ../../vite.config.ts --fileParallelism=false`
+Definition: `NODE_ENV=test vitest --config ../../vite.config.ts`
Description: Watches for changes to any .spec files within the given path and automatically runs test when they are updated.
diff --git a/libs/model/package.json b/libs/model/package.json
index 7fd08d300eb..e3a88ec989b 100644
--- a/libs/model/package.json
+++ b/libs/model/package.json
@@ -17,8 +17,8 @@
"build": "tsc -b ./tsconfig.build.json",
"clean": "rm -rf build && rm -rf coverage && find . -type f -name '*.tsbuildinfo' -exec rm {} +",
"check-types": "tsc --noEmit",
- "test": "NODE_ENV=test vitest --config ../../vite.config.ts --fileParallelism=false --coverage run test",
- "test-select": "NODE_ENV=test vitest --config ../../vite.config.ts --fileParallelism=false run",
+ "test": "NODE_ENV=test vitest --config ../../vite.config.ts --coverage run test",
+ "test-select": "NODE_ENV=test vitest --config ../../vite.config.ts run",
"lint": "NODE_OPTIONS=\"--max-old-space-size=4096\" eslint -c ../../.eslintrc.cjs './src/**/*.{ts,tsx}'",
"lint-diff": "NODE_OPTIONS=\"--max-old-space-size=4096\" eslint -c ../../.eslintrc-diff.cjs './src/**/*.{ts,tsx}'"
},
diff --git a/packages/commonwealth/package.json b/packages/commonwealth/package.json
index b05b75e7f8d..f87b1880bab 100644
--- a/packages/commonwealth/package.json
+++ b/packages/commonwealth/package.json
@@ -60,16 +60,16 @@
"start-message-relayer": "tsx ./server/workers/messageRelayer/messageRelayer.ts",
"stylelint": "stylelint client/styles/*",
"test": "pnpm test-unit",
- "test-api": "NODE_ENV=test vitest --config ../../vite.config.ts --fileParallelism=false --coverage run ./test/integration/api",
- "test-devnet:cosmos": "NODE_ENV=test vitest --config ../../vite.config.ts --fileParallelism=false --coverage run ./test/devnet/cosmos",
- "test-devnet:evm": "NODE_ENV=test vitest --config ../../vite.config.ts --fileParallelism=false --coverage run ./test/devnet/evm",
+ "test-api": "NODE_ENV=test vitest --config ../../vite.config.ts --coverage run ./test/integration/api",
+ "test-devnet:cosmos": "NODE_ENV=test vitest --config ../../vite.config.ts --coverage run ./test/devnet/cosmos",
+ "test-devnet:evm": "NODE_ENV=test vitest --config ../../vite.config.ts --coverage run ./test/devnet/evm",
"test-e2e": "NODE_OPTIONS='--import tsx/esm' NODE_ENV=test TEST_ENV=playwright npx playwright test -c ./test/e2e/playwright.config.ts --workers 1 ./test/e2e/e2eRegular/*",
"test-e2e-mature": "NODE_OPTIONS='--import tsx/esm' NODE_ENV=test TEST_ENV=playwright npx playwright test -c ./test/e2e/playwright.config.ts --workers 1 ./test/e2e/mature/*",
"test-e2e-serial": "NODE_OPTIONS='--import tsx/esm' NODE_ENV=test TEST_ENV=playwright npx playwright test --workers 1 ./test/e2e/e2eSerial/*",
- "test-integration": "NODE_ENV=test vitest --config ../../vite.config.ts --fileParallelism=false --coverage run ./test/integration",
+ "test-integration": "NODE_ENV=test vitest --config ../../vite.config.ts --coverage run ./test/integration",
"test-unit": "NODE_ENV=test FEATURE_FLAG_GROUP_CHECK_ENABLED=true vitest --config ../../vite.config.ts run test/unit",
- "test-select": "NODE_ENV=test vitest --config ../../vite.config.ts --fileParallelism=false run",
- "test-select:watch": "NODE_ENV=test vitest --config ../../vite.config.ts --fileParallelism=false",
+ "test-select": "NODE_ENV=test vitest --config ../../vite.config.ts run",
+ "test-select:watch": "NODE_ENV=test vitest --config ../../vite.config.ts",
"ts-exec": "tsx ",
"validate-external-api-version": "pnpm -F commonwealth ts-exec server/scripts/validate-external-api-versioning.ts $(pnpm info @commonxyz/api-client version)",
"vite": "wait-on http://localhost:3000/api/health && vite -c ./client/vite.config.ts --host",
From a4a0771bdcd1d191e19fe0159777c728ede7ff46 Mon Sep 17 00:00:00 2001
From: rotorsoft
Date: Thu, 14 Nov 2024 09:15:01 -0500
Subject: [PATCH 052/227] remove unnecessary calls to bootstrap
---
libs/model/test/contest-worker/contest-worker-policy.spec.ts | 3 +--
.../test/contest/contests-metadata-commands-lifecycle.spec.ts | 3 +--
libs/model/test/contest/contests-projection-lifecycle.spec.ts | 1 +
libs/model/test/reaction/reaction-lifecycle.spec.ts | 3 +--
4 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/libs/model/test/contest-worker/contest-worker-policy.spec.ts b/libs/model/test/contest-worker/contest-worker-policy.spec.ts
index 06b42a51bc9..b0a0f210601 100644
--- a/libs/model/test/contest-worker/contest-worker-policy.spec.ts
+++ b/libs/model/test/contest-worker/contest-worker-policy.spec.ts
@@ -5,7 +5,7 @@ import { dispose, handleEvent } from '@hicommonwealth/core';
import { afterAll, beforeAll, describe, test } from 'vitest';
import { commonProtocol, models } from '../../src';
import { ContestWorker } from '../../src/policies';
-import { bootstrap_testing, seed } from '../../src/tester';
+import { seed } from '../../src/tester';
describe('Contest Worker Policy', () => {
const addressId = 444;
@@ -17,7 +17,6 @@ describe('Contest Worker Policy', () => {
let topicId: number = 0;
beforeAll(async () => {
- await bootstrap_testing(import.meta);
const [chainNode] = await seed('ChainNode', { contracts: [] });
const [user] = await seed(
'User',
diff --git a/libs/model/test/contest/contests-metadata-commands-lifecycle.spec.ts b/libs/model/test/contest/contests-metadata-commands-lifecycle.spec.ts
index d179b70cd76..57e92d3e7c3 100644
--- a/libs/model/test/contest/contests-metadata-commands-lifecycle.spec.ts
+++ b/libs/model/test/contest/contests-metadata-commands-lifecycle.spec.ts
@@ -5,7 +5,7 @@ import chaiAsPromised from 'chai-as-promised';
import { afterAll, beforeAll, describe, test } from 'vitest';
import z from 'zod';
import { Contest, TopicAttributes } from '../../src/index';
-import { bootstrap_testing, seed } from '../../src/tester';
+import { seed } from '../../src/tester';
chai.use(chaiAsPromised);
@@ -31,7 +31,6 @@ describe('Contests metadata commands lifecycle', () => {
let communityMemberActor: Actor | null = null;
beforeAll(async () => {
- await bootstrap_testing(import.meta);
const [chain] = await seed('ChainNode', {});
const [communityAdminUser] = await seed(
diff --git a/libs/model/test/contest/contests-projection-lifecycle.spec.ts b/libs/model/test/contest/contests-projection-lifecycle.spec.ts
index c43c223241d..974e04f45b2 100644
--- a/libs/model/test/contest/contests-projection-lifecycle.spec.ts
+++ b/libs/model/test/contest/contests-projection-lifecycle.spec.ts
@@ -67,6 +67,7 @@ describe('Contests projection lifecycle', () => {
getContestScore = Sinon.stub(contestHelper, 'getContestScore');
getContestStatus = Sinon.stub(contestHelper, 'getContestStatus');
+ // TODO: add ContractAbi to seeder aggregates and replace direct model calls below to avoid calling this here
await bootstrap_testing(import.meta);
try {
diff --git a/libs/model/test/reaction/reaction-lifecycle.spec.ts b/libs/model/test/reaction/reaction-lifecycle.spec.ts
index edc692000a9..dd906ab636e 100644
--- a/libs/model/test/reaction/reaction-lifecycle.spec.ts
+++ b/libs/model/test/reaction/reaction-lifecycle.spec.ts
@@ -1,6 +1,6 @@
import { dispose } from '@hicommonwealth/core';
import { expect } from 'chai';
-import { bootstrap_testing, seed } from 'model/src/tester';
+import { seed } from 'model/src/tester';
import { afterAll, beforeAll, describe, test } from 'vitest';
import { models } from '../../src/database';
@@ -10,7 +10,6 @@ describe('Reactions lifecycle', () => {
const threadId = 999;
beforeAll(async () => {
- await bootstrap_testing(import.meta);
const [chain] = await seed('ChainNode', { contracts: [] });
const [user] = await seed(
'User',
From 30a1b040eaf934617e1e7b551139e7bddc5d3044 Mon Sep 17 00:00:00 2001
From: Timothee Legros
Date: Thu, 14 Nov 2024 16:51:26 +0200
Subject: [PATCH 053/227] add stats to GetTokens
---
libs/model/src/token/GetTokens.query.ts | 54 +++++++++++++++----
libs/schemas/src/queries/token.schemas.ts | 7 ++-
.../20241114130329-add-trade-indexes.js | 34 ++++++++++++
3 files changed, 84 insertions(+), 11 deletions(-)
create mode 100644 packages/commonwealth/server/migrations/20241114130329-add-trade-indexes.js
diff --git a/libs/model/src/token/GetTokens.query.ts b/libs/model/src/token/GetTokens.query.ts
index 0849b5cf4b0..c760a014dd2 100644
--- a/libs/model/src/token/GetTokens.query.ts
+++ b/libs/model/src/token/GetTokens.query.ts
@@ -10,7 +10,14 @@ export function GetTokens(): Query {
auth: [],
secure: false,
body: async ({ payload }) => {
- const { search = '', cursor, limit, order_by, order_direction } = payload;
+ const {
+ search = '',
+ cursor,
+ limit,
+ order_by,
+ order_direction,
+ with_stats,
+ } = payload;
// pagination configuration
const direction = order_direction || 'DESC';
@@ -31,18 +38,45 @@ export function GetTokens(): Query {
};
const sql = `
- SELECT T.*, C.id as community_id,
- count(*) OVER() AS total
- FROM "Tokens" as T
- JOIN "Communities" as C ON T.namespace = C.namespace
- ${search ? 'WHERE LOWER(name) LIKE :search' : ''}
- ORDER BY ${order_col} :direction
- LIMIT :limit
- OFFSET :offset
+ ${
+ with_stats
+ ? `WITH latest_trades AS (SELECT DISTINCT ON (token_address) *
+ FROM "LaunchpadTrades"
+ ORDER BY token_address, timestamp DESC),
+ older_trades AS (SELECT DISTINCT ON (token_address) *
+ FROM "LaunchpadTrades"
+ WHERE timestamp >= (SELECT EXTRACT(EPOCH FROM CURRENT_TIMESTAMP - INTERVAL '24 hours'))
+ ORDER BY token_address, timestamp ASC),
+ trades AS (SELECT lt.token_address,
+ lt.price as latest_price,
+ ot.price as old_price
+ FROM latest_trades lt
+ LEFT JOIN
+ older_trades ot
+ ON
+ lt.token_address = ot.token_address)`
+ : ''
+ }
+ SELECT T.*,
+ C.id as community_id,
+ ${with_stats ? 'trades.latest_price, trades.old_price,' : ''}
+ count(*) OVER () AS total
+ FROM "Tokens" as T
+ JOIN "Communities" as C
+ ON T.namespace = C.namespace
+ ${with_stats ? 'LEFT JOIN trades ON trades.token_address = T.token_address' : ''}
+ ${search ? 'WHERE LOWER(T.name) LIKE :search' : ''}
+ ORDER BY ${order_col} :direction
+ LIMIT :limit OFFSET :offset
`;
const tokens = await models.sequelize.query<
- z.infer & { total?: number; community_id: string }
+ z.infer & {
+ total?: number;
+ community_id: string;
+ latest_price?: string;
+ old_price?: string;
+ }
>(sql, {
replacements,
type: QueryTypes.SELECT,
diff --git a/libs/schemas/src/queries/token.schemas.ts b/libs/schemas/src/queries/token.schemas.ts
index daac48fb2a5..c251dbbfa9f 100644
--- a/libs/schemas/src/queries/token.schemas.ts
+++ b/libs/schemas/src/queries/token.schemas.ts
@@ -6,8 +6,13 @@ export const GetTokens = {
input: PaginationParamsSchema.extend({
search: z.string().optional(),
order_by: z.enum(['name']).optional(),
+ with_stats: z.boolean().optional(),
}),
output: PaginatedResultSchema.extend({
- results: Token.extend({ community_id: z.string() }).array(),
+ results: Token.extend({
+ community_id: z.string(),
+ latest_price: z.string().optional(),
+ old_price: z.string().optional(),
+ }).array(),
}),
};
diff --git a/packages/commonwealth/server/migrations/20241114130329-add-trade-indexes.js b/packages/commonwealth/server/migrations/20241114130329-add-trade-indexes.js
new file mode 100644
index 00000000000..a2ded902ae4
--- /dev/null
+++ b/packages/commonwealth/server/migrations/20241114130329-add-trade-indexes.js
@@ -0,0 +1,34 @@
+'use strict';
+
+/** @type {import('sequelize-cli').Migration} */
+module.exports = {
+ async up(queryInterface, Sequelize) {
+ await queryInterface.sequelize.transaction(async (transaction) => {
+ await queryInterface.removeIndex(
+ 'LaunchpadTrades',
+ 'launchpad_trades_token_address',
+ {
+ transaction,
+ },
+ );
+ await queryInterface.addIndex(
+ 'LaunchpadTrades',
+ ['token_address', 'timestamp'],
+ { transaction },
+ );
+ });
+ },
+
+ async down(queryInterface, Sequelize) {
+ await queryInterface.sequelize.transaction(async (transaction) => {
+ await queryInterface.addIndex('LaunchpadTrades', ['token_address'], {
+ transaction,
+ });
+ await queryInterface.removeIndex(
+ 'LaunchpadTrades',
+ 'launchpad_trades_token_address_timestamp',
+ { transaction },
+ );
+ });
+ },
+};
From bd44260827469a62b399ee075830fce578fa002a Mon Sep 17 00:00:00 2001
From: ianrowan
Date: Thu, 14 Nov 2024 10:25:59 -0600
Subject: [PATCH 054/227] update values
---
libs/shared/src/commonProtocol/chainConfig.ts | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libs/shared/src/commonProtocol/chainConfig.ts b/libs/shared/src/commonProtocol/chainConfig.ts
index a19fc528db4..c05c686d5e2 100644
--- a/libs/shared/src/commonProtocol/chainConfig.ts
+++ b/libs/shared/src/commonProtocol/chainConfig.ts
@@ -34,9 +34,9 @@ export const factoryContracts: {
[ValidChains.SepoliaBase]: {
factory: '0xD8a357847cABA76133D5f2cB51317D3C74609710',
communityStake: '0xd097926d8765A7717206559E7d19EECCbBa68c18',
- launchpad: '0x2d1DF64692674eA5Ccce7Fd8eAd7712e037e9051',
- lpBondingCurve: '0x7513a4f0458814773B6A0917a3F48DD3546774A9',
- tokenCommunityManager: '0x98168C99aa47935be378c5bF9dc68a9392C1EEf0',
+ launchpad: '0xc6e7B0AdDf35AE4a5A65bb3bCb78D11Db6c8fB8F',
+ lpBondingCurve: '0x2ECc0af0e4794F0Ab4797549a5a8cf97688D7D21',
+ tokenCommunityManager: '0xC8fe1F23AbC4Eb55f4aa9E52dAFa3761111CF03a',
chainId: 84532,
},
[ValidChains.Blast]: {
From 40fe73b13840666d6d796bc2fab2adc78e82394f Mon Sep 17 00:00:00 2001
From: rotorsoft
Date: Thu, 14 Nov 2024 12:18:21 -0500
Subject: [PATCH 055/227] remove unnecessary bootstrapping, unused env var
---
libs/model/src/config.ts | 4 +-
libs/model/src/tester/bootstrap.ts | 40 +++++++++++--------
.../community/stake-historical-price.spec.ts | 3 +-
.../test/community/stake-transaction.spec.ts | 3 +-
.../test/email/digest-email-lifecycle.spec.ts | 3 +-
libs/model/test/launchpad/launchpad.spec.ts | 3 +-
libs/model/test/seed/seed.spec.ts | 9 ++++-
.../snapshot/createSnapshotProposal.spec.ts | 1 -
.../comment-subscription-lifecycle.spec.ts | 3 +-
.../community-alerts-lifecycle.spec.ts | 3 +-
.../thread-subscription-lifecycle.spec.ts | 3 +-
.../createSitemapGenerator.spec.ts | 1 -
.../commonwealth/test/e2e/utils/e2eUtils.ts | 2 +-
.../evmChainEvents/getEventSources.spec.ts | 2 +-
.../scheduleNodeProcessing.spec.ts | 2 +-
.../messageRelayer/messageRelayer.spec.ts | 8 +---
.../messageRelayer/pgListener.spec.ts | 7 +---
.../integration/messageRelayer/relay.spec.ts | 8 +---
vite.config.ts | 8 ++--
19 files changed, 52 insertions(+), 61 deletions(-)
diff --git a/libs/model/src/config.ts b/libs/model/src/config.ts
index 20bfde8e013..e54f5253a4f 100644
--- a/libs/model/src/config.ts
+++ b/libs/model/src/config.ts
@@ -2,7 +2,6 @@ import { configure, config as target } from '@hicommonwealth/core';
import { z } from 'zod';
const {
- TEST_DB_NAME,
DATABASE_URL,
DATABASE_CLEAN_HOUR,
DATABASE_LOG_TRACE,
@@ -42,8 +41,7 @@ const {
OPENAI_ORGANIZATION,
} = process.env;
-const NAME =
- target.NODE_ENV === 'test' ? TEST_DB_NAME || 'common_test' : 'commonwealth';
+const NAME = target.NODE_ENV === 'test' ? 'common_test' : 'commonwealth';
const DEFAULTS = {
JWT_SECRET: 'my secret',
diff --git a/libs/model/src/tester/bootstrap.ts b/libs/model/src/tester/bootstrap.ts
index d87f6ca41ae..ba287812681 100644
--- a/libs/model/src/tester/bootstrap.ts
+++ b/libs/model/src/tester/bootstrap.ts
@@ -32,7 +32,8 @@ export const verify_db = async (name: string): Promise => {
}
} catch (error) {
console.error(`Error verifying db [${name}]:`, error);
- throw error;
+ // ignore verification errors
+ // throw error;
} finally {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
pg && pg.close();
@@ -205,17 +206,9 @@ export const get_info_schema = async (
// so that the db object does not need to be rebuilt for every to bootstrap_testing from within
// a single test suite
let db: DB | undefined = undefined;
-/**
- * Bootstraps testing, creating/migrating a fresh instance if it doesn't exist.
- * @meta import meta of calling test
- * @param truncate when true, truncates all tables in model
- * @returns synchronized sequelize db instance
- */
-export const bootstrap_testing = async (
- meta: ImportMeta,
- truncate = false,
-): Promise => {
- const filename = path.basename(meta.filename);
+let bootstrapLock: Promise | undefined = undefined;
+
+async function _bootstrap_testing(filename: string): Promise {
if (!db) {
try {
await verify_db(config.DB.NAME);
@@ -235,13 +228,26 @@ export const bootstrap_testing = async (
throw e;
}
}
+ return db;
+}
- if (truncate) {
- await truncate_db(db);
- console.log('Database truncated:', filename);
+/**
+ * Bootstraps testing, creating/migrating a fresh instance if it doesn't exist.
+ * @meta import meta of calling test
+ * @param truncate when true, truncates all tables in model
+ * @returns synchronized sequelize db instance
+ */
+export const bootstrap_testing = async (meta: ImportMeta): Promise => {
+ const filename = path.basename(meta.filename);
+ if (bootstrapLock) {
+ return await bootstrapLock;
+ }
+ bootstrapLock = _bootstrap_testing(filename);
+ try {
+ return await bootstrapLock;
+ } finally {
+ bootstrapLock = undefined;
}
-
- return db;
};
config.NODE_ENV === 'test' && dispose(async () => truncate_db(db));
diff --git a/libs/model/test/community/stake-historical-price.spec.ts b/libs/model/test/community/stake-historical-price.spec.ts
index 1515df52bd3..0e5d6ec3287 100644
--- a/libs/model/test/community/stake-historical-price.spec.ts
+++ b/libs/model/test/community/stake-historical-price.spec.ts
@@ -2,7 +2,7 @@ import { Actor, dispose, query } from '@hicommonwealth/core';
import { BalanceType } from '@hicommonwealth/shared';
import chai, { expect } from 'chai';
import chaiAsPromised from 'chai-as-promised';
-import { bootstrap_testing, seed } from 'model/src/tester';
+import { seed } from 'model/src/tester';
import { afterAll, beforeAll, describe, test } from 'vitest';
import { GetStakeHistoricalPrice } from '../../src/community/GetStakeHistoricalPrice.query';
@@ -13,7 +13,6 @@ describe('Stake Historical Price', () => {
let actor: Actor;
beforeAll(async () => {
- await bootstrap_testing(import.meta, true);
const [node] = await seed('ChainNode', {
url: 'https://ethereum-sepolia.publicnode.com',
name: 'Sepolia Testnet',
diff --git a/libs/model/test/community/stake-transaction.spec.ts b/libs/model/test/community/stake-transaction.spec.ts
index 093baa1882d..febedaf4544 100644
--- a/libs/model/test/community/stake-transaction.spec.ts
+++ b/libs/model/test/community/stake-transaction.spec.ts
@@ -2,7 +2,7 @@ import { Actor, command, dispose, query } from '@hicommonwealth/core';
import { BalanceType, commonProtocol } from '@hicommonwealth/shared';
import chai, { expect } from 'chai';
import chaiAsPromised from 'chai-as-promised';
-import { bootstrap_testing, seed } from 'model/src/tester';
+import { seed } from 'model/src/tester';
import { afterAll, beforeAll, describe, test } from 'vitest';
import {
CreateStakeTransaction,
@@ -17,7 +17,6 @@ describe('Stake transactions', () => {
let community_id: string;
beforeAll(async () => {
- await bootstrap_testing(import.meta, true);
const [node] = await seed('ChainNode', {
url: 'https://ethereum-sepolia.publicnode.com',
private_url: 'https://ethereum-sepolia.publicnode.com',
diff --git a/libs/model/test/email/digest-email-lifecycle.spec.ts b/libs/model/test/email/digest-email-lifecycle.spec.ts
index 54deb6defa3..223c5693aec 100644
--- a/libs/model/test/email/digest-email-lifecycle.spec.ts
+++ b/libs/model/test/email/digest-email-lifecycle.spec.ts
@@ -2,7 +2,7 @@ import { ExternalServiceUserIds, dispose, query } from '@hicommonwealth/core';
import { models } from '@hicommonwealth/model';
import { Community } from '@hicommonwealth/schemas';
import { expect } from 'chai';
-import { bootstrap_testing, seed } from 'model/src/tester';
+import { seed } from 'model/src/tester';
import { afterAll, afterEach, beforeAll, describe, test } from 'vitest';
import { z } from 'zod';
import { GetDigestEmailDataQuery } from '../../src/emails';
@@ -14,7 +14,6 @@ describe('Digest email lifecycle', () => {
let communityThree: z.infer | undefined;
beforeAll(async () => {
- await bootstrap_testing(import.meta, true);
const [authorUser] = await seed('User', {
isAdmin: false,
selected_community_id: null,
diff --git a/libs/model/test/launchpad/launchpad.spec.ts b/libs/model/test/launchpad/launchpad.spec.ts
index 545bfd38bb9..36cfa9ce430 100644
--- a/libs/model/test/launchpad/launchpad.spec.ts
+++ b/libs/model/test/launchpad/launchpad.spec.ts
@@ -3,7 +3,7 @@ import { config } from '@hicommonwealth/model';
import { BalanceType, commonProtocol } from '@hicommonwealth/shared';
import chai, { expect } from 'chai';
import chaiAsPromised from 'chai-as-promised';
-import { bootstrap_testing, seed } from 'model/src/tester';
+import { seed } from 'model/src/tester';
import { afterAll, beforeAll, describe, test } from 'vitest';
import { ChainNodeAttributes } from '../../src';
import { CreateLaunchpadTrade, CreateToken } from '../../src/token';
@@ -20,7 +20,6 @@ describe('Launchpad Lifecycle', () => {
let node: ChainNodeAttributes;
beforeAll(async () => {
- await bootstrap_testing(import.meta, true);
[node] = (await seed('ChainNode', {
url: `https://base-sepolia.g.alchemy.com/v2/${config.ALCHEMY.APP_KEYS.PUBLIC}`,
private_url: `https://base-sepolia.g.alchemy.com/v2/${config.ALCHEMY.APP_KEYS.PUBLIC}`,
diff --git a/libs/model/test/seed/seed.spec.ts b/libs/model/test/seed/seed.spec.ts
index c7c9558c178..8212f3b20b3 100644
--- a/libs/model/test/seed/seed.spec.ts
+++ b/libs/model/test/seed/seed.spec.ts
@@ -9,10 +9,10 @@ import {
import chai, { expect } from 'chai';
import chaiAsPromised from 'chai-as-promised';
import { Model, ValidationError, type ModelStatic } from 'sequelize';
-import { afterAll, describe, test } from 'vitest';
+import { afterAll, beforeAll, describe, test } from 'vitest';
import z from 'zod';
import { models } from '../../src/database';
-import { SeedOptions, seed } from '../../src/tester';
+import { SeedOptions, bootstrap_testing, seed } from '../../src/tester';
chai.use(chaiAsPromised);
@@ -47,6 +47,11 @@ async function testSeed(
describe('Seed functions', () => {
let shouldExit = true;
+
+ beforeAll(async () => {
+ await bootstrap_testing(import.meta);
+ });
+
afterAll(async () => {
await dispose()();
});
diff --git a/libs/model/test/snapshot/createSnapshotProposal.spec.ts b/libs/model/test/snapshot/createSnapshotProposal.spec.ts
index b718c19c1cb..2f4d1f3681c 100644
--- a/libs/model/test/snapshot/createSnapshotProposal.spec.ts
+++ b/libs/model/test/snapshot/createSnapshotProposal.spec.ts
@@ -8,7 +8,6 @@ import { CreateSnapshotProposal } from '../../src/snapshot';
describe('Snapshot Listener API', { timeout: 5_000 }, () => {
beforeAll(async () => {
- await tester.bootstrap_testing(import.meta, true);
const [chainNode] = await tester.seed(
'ChainNode',
{
diff --git a/libs/model/test/subscription/comment-subscription-lifecycle.spec.ts b/libs/model/test/subscription/comment-subscription-lifecycle.spec.ts
index 49367c4d9ff..e92ec68c30e 100644
--- a/libs/model/test/subscription/comment-subscription-lifecycle.spec.ts
+++ b/libs/model/test/subscription/comment-subscription-lifecycle.spec.ts
@@ -2,7 +2,7 @@ import { Actor, command, dispose, query } from '@hicommonwealth/core';
import * as schemas from '@hicommonwealth/schemas';
import { BalanceType } from '@hicommonwealth/shared';
import { expect } from 'chai';
-import { bootstrap_testing, seed } from 'model/src/tester';
+import { seed } from 'model/src/tester';
import { afterAll, afterEach, beforeAll, describe, test } from 'vitest';
import z from 'zod';
import { models } from '../../src/database';
@@ -17,7 +17,6 @@ describe('Comment subscription lifecycle', () => {
let commentOne: z.infer | undefined;
let commentTwo: z.infer | undefined;
beforeAll(async () => {
- await bootstrap_testing(import.meta, true);
const [user] = await seed('User', {
isAdmin: false,
selected_community_id: null,
diff --git a/libs/model/test/subscription/community-alerts-lifecycle.spec.ts b/libs/model/test/subscription/community-alerts-lifecycle.spec.ts
index 46fa218a2ce..0cc1c3d7a1c 100644
--- a/libs/model/test/subscription/community-alerts-lifecycle.spec.ts
+++ b/libs/model/test/subscription/community-alerts-lifecycle.spec.ts
@@ -2,7 +2,7 @@ import { Actor, command, dispose, query } from '@hicommonwealth/core';
import * as schemas from '@hicommonwealth/schemas';
import { BalanceType } from '@hicommonwealth/shared';
import { expect } from 'chai';
-import { bootstrap_testing, seed } from 'model/src/tester';
+import { seed } from 'model/src/tester';
import { afterAll, afterEach, beforeAll, describe, test } from 'vitest';
import z from 'zod';
import { models } from '../../src/database';
@@ -18,7 +18,6 @@ describe('Community alerts lifecycle', () => {
let communityTwo: z.infer | undefined;
beforeAll(async () => {
- await bootstrap_testing(import.meta, true);
const [user] = await seed('User', {
isAdmin: false,
});
diff --git a/libs/model/test/subscription/thread-subscription-lifecycle.spec.ts b/libs/model/test/subscription/thread-subscription-lifecycle.spec.ts
index d4c60d5f7c8..121c1b54a26 100644
--- a/libs/model/test/subscription/thread-subscription-lifecycle.spec.ts
+++ b/libs/model/test/subscription/thread-subscription-lifecycle.spec.ts
@@ -2,7 +2,7 @@ import { Actor, command, dispose, query } from '@hicommonwealth/core';
import * as schemas from '@hicommonwealth/schemas';
import { BalanceType } from '@hicommonwealth/shared';
import { expect } from 'chai';
-import { bootstrap_testing, seed } from 'model/src/tester';
+import { seed } from 'model/src/tester';
import { afterAll, afterEach, beforeAll, describe, test } from 'vitest';
import z from 'zod';
import { models } from '../../src/database';
@@ -17,7 +17,6 @@ describe('Thread subscription lifecycle', () => {
let threadOne: z.infer | undefined;
let threadTwo: z.infer | undefined;
beforeAll(async () => {
- await bootstrap_testing(import.meta, true);
const [user] = await seed('User', {
isAdmin: false,
});
diff --git a/libs/sitemaps/test/integration/createSitemapGenerator.spec.ts b/libs/sitemaps/test/integration/createSitemapGenerator.spec.ts
index d04907a29da..344ab4052ba 100644
--- a/libs/sitemaps/test/integration/createSitemapGenerator.spec.ts
+++ b/libs/sitemaps/test/integration/createSitemapGenerator.spec.ts
@@ -9,7 +9,6 @@ import {
describe('createSitemapGenerator', { timeout: 10_000 }, function () {
beforeAll(async () => {
- await tester.bootstrap_testing(import.meta, true);
const [user] = await tester.seed('User', {
isAdmin: true,
});
diff --git a/packages/commonwealth/test/e2e/utils/e2eUtils.ts b/packages/commonwealth/test/e2e/utils/e2eUtils.ts
index 06d19b234a5..bf7aaed66d6 100644
--- a/packages/commonwealth/test/e2e/utils/e2eUtils.ts
+++ b/packages/commonwealth/test/e2e/utils/e2eUtils.ts
@@ -14,7 +14,7 @@ export type E2E_Seeder = E2E_TestEntities & {
const buildSeeder = async (): Promise => {
// This connection is used to speed up tests, so we don't need to load in all the models with the associated
// imports. This can only be used with raw sql queries.
- const testDb = await tester.bootstrap_testing(import.meta, true);
+ const testDb = await tester.bootstrap_testing(import.meta);
const testAddress = '0x0bad5AA8Adf8bA82198D133F9Bb5a48A638FCe88';
const e2eEntities = await tester.e2eTestEntities(testDb);
diff --git a/packages/commonwealth/test/integration/evmChainEvents/getEventSources.spec.ts b/packages/commonwealth/test/integration/evmChainEvents/getEventSources.spec.ts
index 9f03881d9cc..5c7f708a812 100644
--- a/packages/commonwealth/test/integration/evmChainEvents/getEventSources.spec.ts
+++ b/packages/commonwealth/test/integration/evmChainEvents/getEventSources.spec.ts
@@ -15,7 +15,7 @@ describe('getEventSources', () => {
let stakesAbiInstance: ContractAbiInstance;
beforeAll(async () => {
- await tester.bootstrap_testing(import.meta, true);
+ await tester.bootstrap_testing(import.meta);
const res = await createEventSources();
namespaceAbiInstance = res.namespaceAbiInstance;
stakesAbiInstance = res.stakesAbiInstance;
diff --git a/packages/commonwealth/test/integration/evmChainEvents/scheduleNodeProcessing.spec.ts b/packages/commonwealth/test/integration/evmChainEvents/scheduleNodeProcessing.spec.ts
index 1dfd6631fb1..e7974ef1332 100644
--- a/packages/commonwealth/test/integration/evmChainEvents/scheduleNodeProcessing.spec.ts
+++ b/packages/commonwealth/test/integration/evmChainEvents/scheduleNodeProcessing.spec.ts
@@ -22,7 +22,7 @@ describe('scheduleNodeProcessing', () => {
let stakesAbiInstance: ContractAbiInstance;
beforeAll(async () => {
- await tester.bootstrap_testing(import.meta, true);
+ await tester.bootstrap_testing(import.meta);
});
afterAll(async () => {
diff --git a/packages/commonwealth/test/integration/messageRelayer/messageRelayer.spec.ts b/packages/commonwealth/test/integration/messageRelayer/messageRelayer.spec.ts
index 33dc86919c5..7f40826a886 100644
--- a/packages/commonwealth/test/integration/messageRelayer/messageRelayer.spec.ts
+++ b/packages/commonwealth/test/integration/messageRelayer/messageRelayer.spec.ts
@@ -1,5 +1,5 @@
import { disposeAdapter, EventNames } from '@hicommonwealth/core';
-import { DB, tester } from '@hicommonwealth/model';
+import { models, tester } from '@hicommonwealth/model';
import { delay } from '@hicommonwealth/shared';
import { expect } from 'chai';
import { afterEach, beforeAll, describe, test } from 'vitest';
@@ -11,12 +11,8 @@ import {
import { testOutboxEvents } from './util';
describe('messageRelayer', { timeout: 20_000 }, () => {
- let models: DB;
-
beforeAll(async () => {
- const res = await import('@hicommonwealth/model');
- models = res['models'];
- await tester.bootstrap_testing(import.meta, true);
+ await tester.bootstrap_testing(import.meta);
});
afterEach(async () => {
diff --git a/packages/commonwealth/test/integration/messageRelayer/pgListener.spec.ts b/packages/commonwealth/test/integration/messageRelayer/pgListener.spec.ts
index bb9bea38c19..481db284aa9 100644
--- a/packages/commonwealth/test/integration/messageRelayer/pgListener.spec.ts
+++ b/packages/commonwealth/test/integration/messageRelayer/pgListener.spec.ts
@@ -1,4 +1,4 @@
-import { DB, tester } from '@hicommonwealth/model';
+import { models, tester } from '@hicommonwealth/model';
import { delay } from '@hicommonwealth/shared';
import { expect } from 'chai';
import { Client } from 'pg';
@@ -11,12 +11,9 @@ import {
describe.skip('pgListener', { timeout: 10_000 }, () => {
let client: Client;
- let models: DB;
beforeAll(async () => {
- const res = await import('@hicommonwealth/model');
- models = res['models'];
- await tester.bootstrap_testing(import.meta, true);
+ await tester.bootstrap_testing(import.meta);
client = await setupListener();
});
diff --git a/packages/commonwealth/test/integration/messageRelayer/relay.spec.ts b/packages/commonwealth/test/integration/messageRelayer/relay.spec.ts
index c050a5108a0..cd200ee922f 100644
--- a/packages/commonwealth/test/integration/messageRelayer/relay.spec.ts
+++ b/packages/commonwealth/test/integration/messageRelayer/relay.spec.ts
@@ -1,17 +1,13 @@
import { Broker, successfulInMemoryBroker } from '@hicommonwealth/core';
-import { DB, tester } from '@hicommonwealth/model';
+import { models, tester } from '@hicommonwealth/model';
import { expect } from 'chai';
import { afterEach, beforeAll, describe, test } from 'vitest';
import { relay } from '../../../server/workers/messageRelayer/relay';
import { testOutboxEvents } from './util';
describe('relay', () => {
- let models: DB;
-
beforeAll(async () => {
- const res = await import('@hicommonwealth/model');
- models = res['models'];
- await tester.bootstrap_testing(import.meta, true);
+ await tester.bootstrap_testing(import.meta);
});
afterEach(async () => {
diff --git a/vite.config.ts b/vite.config.ts
index 9ca260ed414..a33e953845f 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -6,14 +6,16 @@ import tsconfigPaths from 'vite-tsconfig-paths';
dotenv.config();
-const pkg = process.env.npm_package_name;
-console.log('vitest:', pkg);
+const pkg = process.env.npm_package_name!;
+const parallel = !['@hicommonwealth/model', 'commonwealth'].includes(pkg);
+
+console.log('vitest:', pkg, 'parallel:', parallel);
export default defineConfig({
plugins: [tsconfigPaths()],
test: {
sequence: { concurrent: false },
- fileParallelism: false, // pkg !== '@hicommonwealth/model',
+ fileParallelism: parallel,
coverage: {
provider: 'istanbul',
reporter:
From e64952bf03619347c17e562dda415f99af541769 Mon Sep 17 00:00:00 2001
From: rotorsoft
Date: Thu, 14 Nov 2024 13:16:13 -0500
Subject: [PATCH 056/227] fix build
---
libs/model/src/tester/seedDb.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libs/model/src/tester/seedDb.ts b/libs/model/src/tester/seedDb.ts
index f9498328925..d69dbe2a878 100644
--- a/libs/model/src/tester/seedDb.ts
+++ b/libs/model/src/tester/seedDb.ts
@@ -20,7 +20,7 @@ import { bootstrap_testing } from './bootstrap';
*/
export const seedDb = async (meta: ImportMeta) => {
try {
- const models = await bootstrap_testing(meta, true);
+ const models = await bootstrap_testing(meta);
await models.User.bulkCreate(
[{ email: 'drewstone329@gmail.com' }, { email: 'temp@gmail.com' }].map(
From 91006680afe60f6ce50a723808f01834c6a638fc Mon Sep 17 00:00:00 2001
From: Timothee Legros
Date: Thu, 14 Nov 2024 20:27:20 +0200
Subject: [PATCH 057/227] move ABIs
---
.../services/commonProtocol/contestHelper.ts | 16 +-
.../commonProtocol/contractHelpers.ts | 6 +-
.../commonProtocol/launchpadHelpers.ts | 11 +-
.../commonProtocol/abis/communityStakesAbi.ts | 0
.../src/commonProtocol/abis}/contestAbi.ts | 2 +-
.../src/commonProtocol/abis/erc20Abi.ts} | 0
.../src/commonProtocol/abis}/feeManagerAbi.ts | 2 +-
.../commonProtocol/abis/lpBondingCurveAbi.ts} | 2 +-
.../src/commonProtocol/abis/namespaceAbi.ts | 2 +-
.../abis}/namespaceFactoryAbi.ts | 376 +++++++++++-------
.../commonProtocol/abis/reservationHookAbi.ts | 0
.../abis/tokenCommunityManagerAbi.ts} | 0
libs/shared/src/commonProtocol/index.ts | 9 +
.../helpers/ContractHelpers/Abi/ContestAbi.ts | 254 ------------
.../helpers/ContractHelpers/Abi/ERC20Abi.ts | 26 --
.../ContractHelpers/Abi/LpBondingCurveAbi.ts | 77 ----
.../Abi/NamespaceFactoryAbi.ts | 216 ----------
.../ContractHelpers/Abi/feeManagerAbi.ts | 26 --
.../ContractHelpers/CommunityStakes.tsx | 4 +-
.../helpers/ContractHelpers/Contest.ts | 9 +-
.../helpers/ContractHelpers/ERC20Helper.ts | 4 +-
.../helpers/ContractHelpers/Launchpad.ts | 4 +-
.../ContractHelpers/NamespaceFactory.ts | 11 +-
23 files changed, 276 insertions(+), 781 deletions(-)
rename packages/commonwealth/client/scripts/helpers/ContractHelpers/Abi/CommunityStakesAbi.ts => libs/shared/src/commonProtocol/abis/communityStakesAbi.ts (100%)
rename libs/{model/src/services/commonProtocol/abi => shared/src/commonProtocol/abis}/contestAbi.ts (99%)
rename libs/{model/src/services/commonProtocol/abi/erc20.ts => shared/src/commonProtocol/abis/erc20Abi.ts} (100%)
rename libs/{model/src/services/commonProtocol/abi => shared/src/commonProtocol/abis}/feeManagerAbi.ts (93%)
rename libs/{model/src/services/commonProtocol/abi/LPBondingCurve.ts => shared/src/commonProtocol/abis/lpBondingCurveAbi.ts} (99%)
rename packages/commonwealth/client/scripts/helpers/ContractHelpers/Abi/NamespaceAbi.ts => libs/shared/src/commonProtocol/abis/namespaceAbi.ts (95%)
rename libs/{model/src/services/commonProtocol/abi => shared/src/commonProtocol/abis}/namespaceFactoryAbi.ts (51%)
rename packages/commonwealth/client/scripts/helpers/ContractHelpers/Abi/ReservationHookAbi.ts => libs/shared/src/commonProtocol/abis/reservationHookAbi.ts (100%)
rename libs/{model/src/services/commonProtocol/abi/TokenCommunityManager.ts => shared/src/commonProtocol/abis/tokenCommunityManagerAbi.ts} (100%)
delete mode 100644 packages/commonwealth/client/scripts/helpers/ContractHelpers/Abi/ContestAbi.ts
delete mode 100644 packages/commonwealth/client/scripts/helpers/ContractHelpers/Abi/ERC20Abi.ts
delete mode 100644 packages/commonwealth/client/scripts/helpers/ContractHelpers/Abi/LpBondingCurveAbi.ts
delete mode 100644 packages/commonwealth/client/scripts/helpers/ContractHelpers/Abi/NamespaceFactoryAbi.ts
delete mode 100644 packages/commonwealth/client/scripts/helpers/ContractHelpers/Abi/feeManagerAbi.ts
diff --git a/libs/model/src/services/commonProtocol/contestHelper.ts b/libs/model/src/services/commonProtocol/contestHelper.ts
index 2b4ef56fbda..c94e9012f19 100644
--- a/libs/model/src/services/commonProtocol/contestHelper.ts
+++ b/libs/model/src/services/commonProtocol/contestHelper.ts
@@ -3,8 +3,6 @@ import { commonProtocol } from '@hicommonwealth/shared';
import { Mutex } from 'async-mutex';
import Web3, { PayableCallOptions } from 'web3';
import { AbiItem } from 'web3-utils';
-import { contestABI } from './abi/contestAbi';
-import { feeManagerABI } from './abi/feeManagerAbi';
import { createWeb3Provider } from './utils';
const nonceMutex = new Mutex();
@@ -52,7 +50,7 @@ const addContent = async (
web3 = await createWeb3Provider(rpcNodeUrl);
}
const contestInstance = new web3.eth.Contract(
- contestABI as AbiItem[],
+ commonProtocol.contestAbi as AbiItem[],
contest,
);
@@ -114,7 +112,7 @@ const voteContent = async (
web3 = await createWeb3Provider(rpcNodeUrl);
}
const contestInstance = new web3.eth.Contract(
- contestABI as AbiItem[],
+ commonProtocol.contestAbi as AbiItem[],
contest,
);
@@ -154,7 +152,7 @@ export const getContestStatus = async (
): Promise => {
const web3 = new Web3(rpcNodeUrl);
const contestInstance = new web3.eth.Contract(
- contestABI as AbiItem[],
+ commonProtocol.contestAbi as AbiItem[],
contest,
);
@@ -191,7 +189,7 @@ export const getContestScore = async (
): Promise => {
const web3 = new Web3(rpcNodeUrl);
const contestInstance = new web3.eth.Contract(
- contestABI as AbiItem[],
+ commonProtocol.contestAbi as AbiItem[],
contest,
);
@@ -244,7 +242,7 @@ export const getContestBalance = async (
const web3 = new Web3(rpcNodeUrl);
const contestInstance = new web3.eth.Contract(
- contestABI as AbiItem[],
+ commonProtocol.contestAbi as AbiItem[],
contest,
);
@@ -252,7 +250,7 @@ export const getContestBalance = async (
contestInstance,
contest,
web3,
- feeManagerABI,
+ commonProtocol.feeManagerAbi,
oneOff,
);
@@ -337,7 +335,7 @@ export const rollOverContest = async (
return nonceMutex.runExclusive(async () => {
const web3 = await createWeb3Provider(rpcNodeUrl);
const contestInstance = new web3.eth.Contract(
- contestABI as AbiItem[],
+ commonProtocol.contestAbi as AbiItem[],
contest,
);
diff --git a/libs/model/src/services/commonProtocol/contractHelpers.ts b/libs/model/src/services/commonProtocol/contractHelpers.ts
index b0623255578..5d8705402d6 100644
--- a/libs/model/src/services/commonProtocol/contractHelpers.ts
+++ b/libs/model/src/services/commonProtocol/contractHelpers.ts
@@ -8,7 +8,6 @@ import Web3 from 'web3';
import { AbiItem } from 'web3-utils';
import { Balances, TokenAttributes, getBalances } from '../tokenBalanceCache';
-import { contestABI } from './abi/contestAbi';
/**
* Retrieves a namespace.
@@ -97,7 +96,10 @@ export const getTokenAttributes = async (
const web3 = new Web3(rpcNodeUrl);
let addr = address;
if (fetchFromContest) {
- const contest = new web3.eth.Contract(contestABI as AbiItem[], address);
+ const contest = new web3.eth.Contract(
+ commonProtocol.contestAbi as AbiItem[],
+ address,
+ );
addr = await contest.methods.contestToken().call();
}
if (addr === ZERO_ADDRESS) {
diff --git a/libs/model/src/services/commonProtocol/launchpadHelpers.ts b/libs/model/src/services/commonProtocol/launchpadHelpers.ts
index 211537810b1..b168c6e8acb 100644
--- a/libs/model/src/services/commonProtocol/launchpadHelpers.ts
+++ b/libs/model/src/services/commonProtocol/launchpadHelpers.ts
@@ -6,8 +6,6 @@ import {
} from '@hicommonwealth/model';
import { commonProtocol } from '@hicommonwealth/shared';
import { Web3 } from 'web3';
-import { LPBondingCurveAbi } from './abi/LPBondingCurve';
-import { erc20Abi } from './abi/erc20';
import { createWeb3Provider } from './utils';
const log = logger(import.meta);
@@ -149,7 +147,10 @@ export async function getErc20TokenInfo({
tokenAddress: string;
}): Promise<{ name: string; symbol: string; totalSupply: bigint }> {
const web3 = new Web3(rpc);
- const erc20Contract = new web3.eth.Contract(erc20Abi, tokenAddress);
+ const erc20Contract = new web3.eth.Contract(
+ commonProtocol.erc20Abi,
+ tokenAddress,
+ );
const [name, symbol, totalSupply] = await Promise.all([
erc20Contract.methods.name().call(),
erc20Contract.methods.symbol().call(),
@@ -173,7 +174,7 @@ export async function transferLiquidityToUniswap({
}) {
const web3 = await createWeb3Provider(rpc);
const contract = new web3.eth.Contract(
- LPBondingCurveAbi,
+ commonProtocol.lpBondingCurveAbi,
lpBondingCurveAddress,
);
await commonProtocol.transferLiquidity(
@@ -202,7 +203,7 @@ export async function getToken({
}> {
const web3 = new Web3(rpc);
const contract = new web3.eth.Contract(
- LPBondingCurveAbi,
+ commonProtocol.lpBondingCurveAbi,
lpBondingCurveAddress,
);
return await contract.methods.tokens(tokenAddress).call();
diff --git a/packages/commonwealth/client/scripts/helpers/ContractHelpers/Abi/CommunityStakesAbi.ts b/libs/shared/src/commonProtocol/abis/communityStakesAbi.ts
similarity index 100%
rename from packages/commonwealth/client/scripts/helpers/ContractHelpers/Abi/CommunityStakesAbi.ts
rename to libs/shared/src/commonProtocol/abis/communityStakesAbi.ts
diff --git a/libs/model/src/services/commonProtocol/abi/contestAbi.ts b/libs/shared/src/commonProtocol/abis/contestAbi.ts
similarity index 99%
rename from libs/model/src/services/commonProtocol/abi/contestAbi.ts
rename to libs/shared/src/commonProtocol/abis/contestAbi.ts
index c8f88a659dc..39cbb99b3c3 100644
--- a/libs/model/src/services/commonProtocol/abi/contestAbi.ts
+++ b/libs/shared/src/commonProtocol/abis/contestAbi.ts
@@ -1,4 +1,4 @@
-export const contestABI = [
+export const contestAbi = [
{
inputs: [
{
diff --git a/libs/model/src/services/commonProtocol/abi/erc20.ts b/libs/shared/src/commonProtocol/abis/erc20Abi.ts
similarity index 100%
rename from libs/model/src/services/commonProtocol/abi/erc20.ts
rename to libs/shared/src/commonProtocol/abis/erc20Abi.ts
diff --git a/libs/model/src/services/commonProtocol/abi/feeManagerAbi.ts b/libs/shared/src/commonProtocol/abis/feeManagerAbi.ts
similarity index 93%
rename from libs/model/src/services/commonProtocol/abi/feeManagerAbi.ts
rename to libs/shared/src/commonProtocol/abis/feeManagerAbi.ts
index a1af64f4654..febd874d35a 100644
--- a/libs/model/src/services/commonProtocol/abi/feeManagerAbi.ts
+++ b/libs/shared/src/commonProtocol/abis/feeManagerAbi.ts
@@ -1,4 +1,4 @@
-export const feeManagerABI = [
+export const feeManagerAbi = [
{
inputs: [
{
diff --git a/libs/model/src/services/commonProtocol/abi/LPBondingCurve.ts b/libs/shared/src/commonProtocol/abis/lpBondingCurveAbi.ts
similarity index 99%
rename from libs/model/src/services/commonProtocol/abi/LPBondingCurve.ts
rename to libs/shared/src/commonProtocol/abis/lpBondingCurveAbi.ts
index 77ffade18ca..fd0f9acd307 100644
--- a/libs/model/src/services/commonProtocol/abi/LPBondingCurve.ts
+++ b/libs/shared/src/commonProtocol/abis/lpBondingCurveAbi.ts
@@ -1,4 +1,4 @@
-export const LPBondingCurveAbi = [
+export const lpBondingCurveAbi = [
{
type: 'constructor',
inputs: [
diff --git a/packages/commonwealth/client/scripts/helpers/ContractHelpers/Abi/NamespaceAbi.ts b/libs/shared/src/commonProtocol/abis/namespaceAbi.ts
similarity index 95%
rename from packages/commonwealth/client/scripts/helpers/ContractHelpers/Abi/NamespaceAbi.ts
rename to libs/shared/src/commonProtocol/abis/namespaceAbi.ts
index 115b913329a..70c0957e6b9 100644
--- a/packages/commonwealth/client/scripts/helpers/ContractHelpers/Abi/NamespaceAbi.ts
+++ b/libs/shared/src/commonProtocol/abis/namespaceAbi.ts
@@ -1,4 +1,4 @@
-export const NamespaceAbi = [
+export const namespaceAbi = [
{
type: 'function',
name: 'balanceOf',
diff --git a/libs/model/src/services/commonProtocol/abi/namespaceFactoryAbi.ts b/libs/shared/src/commonProtocol/abis/namespaceFactoryAbi.ts
similarity index 51%
rename from libs/model/src/services/commonProtocol/abi/namespaceFactoryAbi.ts
rename to libs/shared/src/commonProtocol/abis/namespaceFactoryAbi.ts
index 1c3134443d0..cd73105ce57 100644
--- a/libs/model/src/services/commonProtocol/abi/namespaceFactoryAbi.ts
+++ b/libs/shared/src/commonProtocol/abis/namespaceFactoryAbi.ts
@@ -1,369 +1,459 @@
-export const deployedNamespaceEventAbi = {
- name: 'DeployedNamespace',
- type: 'event',
- inputs: [
- { name: 'name', type: 'string', indexed: false, internalType: 'string' },
- {
- name: '_feeManager',
- type: 'address',
- indexed: false,
- internalType: 'address',
- },
- {
- name: '_signature',
- type: 'bytes',
- indexed: false,
- internalType: 'bytes',
- },
- {
- name: '_namespaceDeployer',
- type: 'address',
- indexed: false,
- internalType: 'address',
- },
- ],
- anonymous: false,
-} as const;
-
export const namespaceFactoryAbi = [
- { name: 'InvalidInitialization', type: 'error', inputs: [] },
+ { inputs: [], name: 'InvalidInitialization', type: 'error' },
{
+ inputs: [],
name: 'NotInitializing',
type: 'error',
- inputs: [],
},
{
- name: 'ConfiguredCommunityStakeId',
- type: 'event',
+ anonymous: false,
inputs: [
- { name: 'name', type: 'string', indexed: false, internalType: 'string' },
+ { indexed: false, internalType: 'string', name: 'name', type: 'string' },
{
- name: 'tokenName',
- type: 'string',
indexed: false,
internalType: 'string',
+ name: 'tokenName',
+ type: 'string',
},
- { name: 'id', type: 'uint256', indexed: false, internalType: 'uint256' },
+ { indexed: false, internalType: 'uint256', name: 'id', type: 'uint256' },
],
- anonymous: false,
+ name: 'ConfiguredCommunityStakeId',
+ type: 'event',
},
- deployedNamespaceEventAbi,
{
- name: 'Initialized',
+ anonymous: false,
+ inputs: [
+ { indexed: false, internalType: 'string', name: 'name', type: 'string' },
+ {
+ indexed: false,
+ internalType: 'address',
+ name: '_feeManager',
+ type: 'address',
+ },
+ {
+ indexed: false,
+ internalType: 'bytes',
+ name: '_signature',
+ type: 'bytes',
+ },
+ {
+ indexed: false,
+ internalType: 'address',
+ name: '_namespaceDeployer',
+ type: 'address',
+ },
+ ],
+ name: 'DeployedNamespace',
type: 'event',
+ },
+ {
+ anonymous: false,
inputs: [
{
- name: 'version',
- type: 'uint64',
indexed: false,
internalType: 'uint64',
+ name: 'version',
+ type: 'uint64',
},
],
- anonymous: false,
+ name: 'Initialized',
+ type: 'event',
},
{
- name: 'NewContest',
- type: 'event',
+ anonymous: false,
inputs: [
{
- name: 'contest',
- type: 'address',
indexed: false,
internalType: 'address',
+ name: 'contest',
+ type: 'address',
},
{
- name: 'namespace',
- type: 'address',
indexed: false,
internalType: 'address',
+ name: 'namespace',
+ type: 'address',
},
{
+ indexed: false,
+ internalType: 'uint256',
name: 'interval',
type: 'uint256',
+ },
+ {
indexed: false,
- internalType: 'uint256',
+ internalType: 'bool',
+ name: 'oneOff',
+ type: 'bool',
},
- { name: 'oneOff', type: 'bool', indexed: false, internalType: 'bool' },
],
- anonymous: false,
+ name: 'NewContest',
+ type: 'event',
},
{
- name: 'CurveManager',
- type: 'function',
inputs: [],
- outputs: [{ name: '', type: 'address', internalType: 'address' }],
+ name: 'CurveManager',
+ outputs: [{ internalType: 'address', name: '', type: 'address' }],
stateMutability: 'view',
+ type: 'function',
},
{
- name: 'communityStake',
- type: 'function',
inputs: [],
- outputs: [{ name: '', type: 'address', internalType: 'address' }],
+ name: 'communityStake',
+ outputs: [{ internalType: 'address', name: '', type: 'address' }],
stateMutability: 'view',
+ type: 'function',
},
{
- name: 'configureCommunityStakeId',
- type: 'function',
inputs: [
- { name: 'name', type: 'string', internalType: 'string' },
+ { internalType: 'string', name: 'name', type: 'string' },
{
+ internalType: 'string',
name: 'tokenName',
type: 'string',
- internalType: 'string',
},
- { name: 'id', type: 'uint256', internalType: 'uint256' },
+ { internalType: 'uint256', name: 'id', type: 'uint256' },
{
+ internalType: 'address',
name: 'exchangeToken',
type: 'address',
- internalType: 'address',
},
- { name: 'scalar', type: 'uint256', internalType: 'uint256' },
+ { internalType: 'uint256', name: 'scalar', type: 'uint256' },
{
+ internalType: 'uint256',
name: 'curve',
type: 'uint256',
- internalType: 'uint256',
},
],
+ name: 'configureCommunityStakeId',
outputs: [],
stateMutability: 'nonpayable',
+ type: 'function',
},
{
- name: 'contestFactoryUtil',
- type: 'function',
inputs: [],
+ name: 'contestFactoryUtil',
outputs: [
{
+ internalType: 'contract IContestFactoryUtils',
name: '',
type: 'address',
- internalType: 'contract IContestFactoryUtils',
},
],
stateMutability: 'view',
+ type: 'function',
},
{
- name: 'deployNamespace',
- type: 'function',
inputs: [
- { name: 'name', type: 'string', internalType: 'string' },
+ { internalType: 'string', name: 'name', type: 'string' },
{
+ internalType: 'string',
name: '_uri',
type: 'string',
- internalType: 'string',
},
- { name: '_feeManager', type: 'address', internalType: 'address' },
+ { internalType: 'address', name: '_feeManager', type: 'address' },
{
+ internalType: 'bytes',
name: '_signature',
type: 'bytes',
- internalType: 'bytes',
},
],
+ name: 'deployNamespace',
outputs: [],
stateMutability: 'nonpayable',
+ type: 'function',
},
{
- name: 'getNamespace',
+ inputs: [
+ { internalType: 'string', name: 'name', type: 'string' },
+ {
+ internalType: 'string',
+ name: '_uri',
+ type: 'string',
+ },
+ { internalType: 'address', name: '_feeManager', type: 'address' },
+ {
+ internalType: 'address',
+ name: 'referrer',
+ type: 'address',
+ },
+ { internalType: 'bytes', name: '_signature', type: 'bytes' },
+ ],
+ name: 'deployNamespaceWithReferrer',
+ outputs: [],
+ stateMutability: 'nonpayable',
type: 'function',
- inputs: [{ name: '', type: 'bytes32', internalType: 'bytes32' }],
- outputs: [{ name: '', type: 'address', internalType: 'address' }],
+ },
+ {
+ inputs: [],
+ name: 'erc20VoteStrategy',
+ outputs: [
+ {
+ internalType: 'contract IERC20VoteStrategy',
+ name: '',
+ type: 'address',
+ },
+ ],
stateMutability: 'view',
+ type: 'function',
},
{
- name: 'initialize',
+ inputs: [{ internalType: 'bytes32', name: '', type: 'bytes32' }],
+ name: 'getNamespace',
+ outputs: [{ internalType: 'address', name: '', type: 'address' }],
+ stateMutability: 'view',
type: 'function',
+ },
+ {
inputs: [
- { name: '_communityStake', type: 'address', internalType: 'address' },
{
- name: '_namespaceLogic',
- type: 'address',
internalType: 'address',
+ name: '_communityStake',
+ type: 'address',
},
- { name: '_reservationHook', type: 'address', internalType: 'address' },
+ { internalType: 'address', name: '_namespaceLogic', type: 'address' },
{
- name: '_curveManager',
+ internalType: 'address',
+ name: '_reservationHook',
type: 'address',
+ },
+ { internalType: 'address', name: '_curveManager', type: 'address' },
+ {
internalType: 'address',
+ name: '_namespaceVotingStrategy',
+ type: 'address',
},
+ { internalType: 'address', name: '_contestFactoryUtil', type: 'address' },
],
+ name: 'initialize',
outputs: [],
stateMutability: 'nonpayable',
+ type: 'function',
},
{
- name: 'namespaceLogic',
- type: 'function',
inputs: [],
- outputs: [{ name: '', type: 'address', internalType: 'address' }],
+ name: 'namespaceLogic',
+ outputs: [{ internalType: 'address', name: '', type: 'address' }],
stateMutability: 'view',
+ type: 'function',
},
{
- name: 'namespaceVotingStrategy',
- type: 'function',
inputs: [],
+ name: 'namespaceVotingStrategy',
outputs: [
{
+ internalType: 'contract INamespaceVoteStrategy',
name: '',
type: 'address',
- internalType: 'contract INamespaceVoteStrategy',
},
],
stateMutability: 'view',
+ type: 'function',
},
{
- name: 'newContest',
- type: 'function',
inputs: [
- { name: 'name', type: 'string', internalType: 'string' },
+ { internalType: 'string', name: 'name', type: 'string' },
{
+ internalType: 'uint256',
name: 'interval',
type: 'uint256',
- internalType: 'uint256',
},
- { name: 'winnerShares', type: 'uint256[]', internalType: 'uint256[]' },
+ { internalType: 'uint256[]', name: 'winnerShares', type: 'uint256[]' },
{
+ internalType: 'uint256',
name: 'id',
type: 'uint256',
- internalType: 'uint256',
},
- { name: 'prizeShare', type: 'uint256', internalType: 'uint256' },
+ { internalType: 'uint256', name: 'prizeShare', type: 'uint256' },
{
+ internalType: 'uint256',
name: 'voterShare',
type: 'uint256',
- internalType: 'uint256',
},
- { name: 'feeShare', type: 'uint256', internalType: 'uint256' },
+ { internalType: 'uint256', name: 'feeShare', type: 'uint256' },
{
+ internalType: 'uint256',
name: 'weight',
type: 'uint256',
- internalType: 'uint256',
},
],
- outputs: [{ name: '', type: 'address', internalType: 'address' }],
+ name: 'newContest',
+ outputs: [{ internalType: 'address', name: '', type: 'address' }],
stateMutability: 'nonpayable',
+ type: 'function',
},
{
- name: 'newSingleContest',
- type: 'function',
inputs: [
- { name: 'name', type: 'string', internalType: 'string' },
+ { internalType: 'string', name: 'name', type: 'string' },
{
+ internalType: 'uint256',
name: 'length',
type: 'uint256',
- internalType: 'uint256',
},
- { name: 'winnerShares', type: 'uint256[]', internalType: 'uint256[]' },
+ { internalType: 'uint256[]', name: 'winnerShares', type: 'uint256[]' },
{
+ internalType: 'uint256',
name: 'id',
type: 'uint256',
- internalType: 'uint256',
},
- { name: 'voterShare', type: 'uint256', internalType: 'uint256' },
+ { internalType: 'uint256', name: 'voterShare', type: 'uint256' },
{
+ internalType: 'uint256',
name: 'weight',
type: 'uint256',
- internalType: 'uint256',
},
- { name: 'exhangeToken', type: 'address', internalType: 'address' },
+ { internalType: 'address', name: 'exhangeToken', type: 'address' },
],
- outputs: [{ name: '', type: 'address', internalType: 'address' }],
+ name: 'newSingleContest',
+ outputs: [{ internalType: 'address', name: '', type: 'address' }],
stateMutability: 'nonpayable',
+ type: 'function',
},
{
- name: 'onERC1155BatchReceived',
+ inputs: [
+ { internalType: 'string', name: 'name', type: 'string' },
+ {
+ internalType: 'uint256',
+ name: 'length',
+ type: 'uint256',
+ },
+ { internalType: 'uint256[]', name: 'winnerShares', type: 'uint256[]' },
+ {
+ internalType: 'address',
+ name: 'token',
+ type: 'address',
+ },
+ { internalType: 'uint256', name: 'voterShare', type: 'uint256' },
+ {
+ internalType: 'address',
+ name: 'exhangeToken',
+ type: 'address',
+ },
+ ],
+ name: 'newSingleERC20Contest',
+ outputs: [{ internalType: 'address', name: '', type: 'address' }],
+ stateMutability: 'nonpayable',
type: 'function',
+ },
+ {
inputs: [
- { name: '', type: 'address', internalType: 'address' },
+ { internalType: 'address', name: '', type: 'address' },
{
+ internalType: 'address',
name: '',
type: 'address',
- internalType: 'address',
},
- { name: '', type: 'uint256[]', internalType: 'uint256[]' },
+ { internalType: 'uint256[]', name: '', type: 'uint256[]' },
{
+ internalType: 'uint256[]',
name: '',
type: 'uint256[]',
- internalType: 'uint256[]',
},
- { name: '', type: 'bytes', internalType: 'bytes' },
+ { internalType: 'bytes', name: '', type: 'bytes' },
],
- outputs: [{ name: '', type: 'bytes4', internalType: 'bytes4' }],
+ name: 'onERC1155BatchReceived',
+ outputs: [{ internalType: 'bytes4', name: '', type: 'bytes4' }],
stateMutability: 'nonpayable',
+ type: 'function',
},
{
- name: 'onERC1155Received',
- type: 'function',
inputs: [
- { name: '', type: 'address', internalType: 'address' },
+ { internalType: 'address', name: '', type: 'address' },
{
+ internalType: 'address',
name: '',
type: 'address',
- internalType: 'address',
},
- { name: '', type: 'uint256', internalType: 'uint256' },
+ { internalType: 'uint256', name: '', type: 'uint256' },
{
+ internalType: 'uint256',
name: '',
type: 'uint256',
- internalType: 'uint256',
},
- { name: '', type: 'bytes', internalType: 'bytes' },
+ { internalType: 'bytes', name: '', type: 'bytes' },
],
- outputs: [{ name: '', type: 'bytes4', internalType: 'bytes4' }],
+ name: 'onERC1155Received',
+ outputs: [{ internalType: 'bytes4', name: '', type: 'bytes4' }],
stateMutability: 'nonpayable',
+ type: 'function',
},
{
- name: 'reinitialize',
- type: 'function',
- inputs: [
+ inputs: [],
+ name: 'referralFeeManager',
+ outputs: [
{
- name: '_namespaceVotingStrategy',
+ internalType: 'contract IReferralFeeManager',
+ name: '',
type: 'address',
- internalType: 'address',
},
- { name: '_contestFactoryUtil', type: 'address', internalType: 'address' },
],
+ stateMutability: 'view',
+ type: 'function',
+ },
+ {
+ inputs: [
+ { internalType: 'address', name: '_erc20VoteStrategy', type: 'address' },
+ ],
+ name: 'reinitialize',
outputs: [],
stateMutability: 'nonpayable',
+ type: 'function',
},
{
- name: 'reservationHook',
- type: 'function',
inputs: [],
- outputs: [{ name: '', type: 'address', internalType: 'address' }],
+ name: 'reservationHook',
+ outputs: [{ internalType: 'address', name: '', type: 'address' }],
stateMutability: 'view',
+ type: 'function',
},
{
+ inputs: [{ internalType: 'address', name: '_hook', type: 'address' }],
name: 'setReservationHook',
- type: 'function',
- inputs: [{ name: '_hook', type: 'address', internalType: 'address' }],
outputs: [],
stateMutability: 'nonpayable',
+ type: 'function',
},
{
+ inputs: [{ internalType: 'bytes4', name: 'interfaceId', type: 'bytes4' }],
name: 'supportsInterface',
- type: 'function',
- inputs: [{ name: 'interfaceId', type: 'bytes4', internalType: 'bytes4' }],
- outputs: [{ name: '', type: 'bool', internalType: 'bool' }],
+ outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
stateMutability: 'view',
+ type: 'function',
},
{
+ inputs: [{ internalType: 'address', name: 'newOwner', type: 'address' }],
name: 'transferOwnership',
- type: 'function',
- inputs: [{ name: 'newOwner', type: 'address', internalType: 'address' }],
outputs: [],
stateMutability: 'nonpayable',
+ type: 'function',
},
{
+ inputs: [{ internalType: 'address', name: 'newUtil', type: 'address' }],
name: 'updateContestUtilImplementation',
- type: 'function',
- inputs: [{ name: 'newUtil', type: 'address', internalType: 'address' }],
outputs: [],
stateMutability: 'nonpayable',
+ type: 'function',
},
{
+ inputs: [
+ { internalType: 'address', name: 'newImplementation', type: 'address' },
+ ],
name: 'updateNamespaceImplementation',
+ outputs: [],
+ stateMutability: 'nonpayable',
type: 'function',
+ },
+ {
inputs: [
- { name: 'newImplementation', type: 'address', internalType: 'address' },
+ {
+ internalType: 'address payable',
+ name: '_referralManager',
+ type: 'address',
+ },
],
+ name: 'updateReferralManager',
outputs: [],
stateMutability: 'nonpayable',
+ type: 'function',
},
] as const;
diff --git a/packages/commonwealth/client/scripts/helpers/ContractHelpers/Abi/ReservationHookAbi.ts b/libs/shared/src/commonProtocol/abis/reservationHookAbi.ts
similarity index 100%
rename from packages/commonwealth/client/scripts/helpers/ContractHelpers/Abi/ReservationHookAbi.ts
rename to libs/shared/src/commonProtocol/abis/reservationHookAbi.ts
diff --git a/libs/model/src/services/commonProtocol/abi/TokenCommunityManager.ts b/libs/shared/src/commonProtocol/abis/tokenCommunityManagerAbi.ts
similarity index 100%
rename from libs/model/src/services/commonProtocol/abi/TokenCommunityManager.ts
rename to libs/shared/src/commonProtocol/abis/tokenCommunityManagerAbi.ts
diff --git a/libs/shared/src/commonProtocol/index.ts b/libs/shared/src/commonProtocol/index.ts
index 9b276a5a8cf..54cff0b324a 100644
--- a/libs/shared/src/commonProtocol/index.ts
+++ b/libs/shared/src/commonProtocol/index.ts
@@ -1,3 +1,12 @@
+export * from './abis/communityStakesAbi';
+export * from './abis/contestAbi';
+export * from './abis/erc20Abi';
+export * from './abis/feeManagerAbi';
+export * from './abis/lpBondingCurveAbi';
+export * from './abis/namespaceAbi';
+export * from './abis/namespaceFactoryAbi';
+export * from './abis/reservationHookAbi';
+export * from './abis/tokenCommunityManagerAbi';
export * from './chainConfig';
export * from './contractHelpers/Contest';
export * from './contractHelpers/Launchpad';
diff --git a/packages/commonwealth/client/scripts/helpers/ContractHelpers/Abi/ContestAbi.ts b/packages/commonwealth/client/scripts/helpers/ContractHelpers/Abi/ContestAbi.ts
deleted file mode 100644
index 483d49b4689..00000000000
--- a/packages/commonwealth/client/scripts/helpers/ContractHelpers/Abi/ContestAbi.ts
+++ /dev/null
@@ -1,254 +0,0 @@
-export const ContestAbi = [
- {
- inputs: [],
- name: 'contestToken',
- outputs: [
- {
- internalType: 'address',
- name: '',
- type: 'address',
- },
- ],
- stateMutability: 'view',
- type: 'function',
- },
- {
- inputs: [
- {
- internalType: 'uint256',
- name: 'amount',
- type: 'uint256',
- },
- ],
- name: 'deposit',
- outputs: [],
- stateMutability: 'payable',
- type: 'function',
- },
- {
- inputs: [
- {
- internalType: 'uint256',
- name: '',
- type: 'uint256',
- },
- ],
- stateMutability: 'view',
- type: 'function',
- name: 'winnerIds',
- outputs: [
- {
- internalType: 'uint256',
- name: '',
- type: 'uint256',
- },
- ],
- },
- {
- inputs: [
- {
- internalType: 'string',
- name: 'name',
- type: 'string',
- },
- {
- internalType: 'uint256',
- name: 'length',
- type: 'uint256',
- },
- {
- internalType: 'uint256[]',
- name: 'winnerShares',
- type: 'uint256[]',
- },
- {
- internalType: 'uint256',
- name: 'id',
- type: 'uint256',
- },
- {
- internalType: 'uint256',
- name: 'voterShare',
- type: 'uint256',
- },
- {
- internalType: 'uint256',
- name: 'weight',
- type: 'uint256',
- },
- {
- internalType: 'address',
- name: 'exhangeToken',
- type: 'address',
- },
- ],
- name: 'newSingleContest',
- outputs: [
- {
- internalType: 'address',
- name: '',
- type: 'address',
- },
- ],
- stateMutability: 'nonpayable',
- type: 'function',
- },
- {
- inputs: [],
- stateMutability: 'view',
- type: 'function',
- name: 'endTime',
- outputs: [
- {
- internalType: 'uint256',
- name: '',
- type: 'uint256',
- },
- ],
- },
- {
- inputs: [],
- stateMutability: 'view',
- type: 'function',
- name: 'startTime',
- outputs: [
- {
- internalType: 'uint256',
- name: '',
- type: 'uint256',
- },
- ],
- },
- {
- inputs: [],
- name: 'contestInterval',
- outputs: [
- {
- internalType: 'uint256',
- name: '',
- type: 'uint256',
- },
- ],
- stateMutability: 'view',
- type: 'function',
- },
- {
- inputs: [],
- name: 'currentContentId',
- outputs: [
- {
- internalType: 'uint256',
- name: '',
- type: 'uint256',
- },
- ],
- stateMutability: 'view',
- type: 'function',
- },
- {
- inputs: [],
- name: 'getWinnerIds',
- outputs: [
- {
- internalType: 'uint256[]',
- name: '',
- type: 'uint256[]',
- },
- ],
- stateMutability: 'nonpayable',
- type: 'function',
- },
- {
- inputs: [
- {
- internalType: 'uint256',
- name: 'contestId',
- type: 'uint256',
- },
- ],
- name: 'getPastWinners',
- outputs: [
- {
- internalType: 'uint256[]',
- name: '',
- type: 'uint256[]',
- },
- ],
- stateMutability: 'nonpayable',
- type: 'function',
- },
- {
- inputs: [
- {
- internalType: 'uint256',
- name: '',
- type: 'uint256',
- },
- ],
- stateMutability: 'view',
- type: 'function',
- name: 'content',
- outputs: [
- {
- internalType: 'string',
- name: 'url',
- type: 'string',
- },
- {
- internalType: 'uint256',
- name: 'cumulativeVotes',
- type: 'uint256',
- },
- {
- internalType: 'address',
- name: 'creator',
- type: 'address',
- },
- {
- internalType: 'bool',
- name: 'completed',
- type: 'bool',
- },
- ],
- },
- {
- inputs: [],
- name: 'FeeMangerAddress',
- outputs: [
- {
- internalType: 'address',
- name: '',
- type: 'address',
- },
- ],
- stateMutability: 'view',
- type: 'function',
- },
- {
- inputs: [],
- name: 'contestLength',
- outputs: [
- {
- internalType: 'uint256',
- name: '',
- type: 'uint256',
- },
- ],
- stateMutability: 'view',
- type: 'function',
- },
- {
- inputs: [],
- name: 'newContest',
- outputs: [],
- stateMutability: 'nonpayable',
- type: 'function',
- },
- {
- inputs: [],
- name: 'endContest',
- outputs: [],
- stateMutability: 'nonpayable',
- type: 'function',
- },
-];
diff --git a/packages/commonwealth/client/scripts/helpers/ContractHelpers/Abi/ERC20Abi.ts b/packages/commonwealth/client/scripts/helpers/ContractHelpers/Abi/ERC20Abi.ts
deleted file mode 100644
index f3b3047d7e0..00000000000
--- a/packages/commonwealth/client/scripts/helpers/ContractHelpers/Abi/ERC20Abi.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-export const Erc20Abi = [
- {
- inputs: [
- { internalType: 'address', name: 'spender', type: 'address' },
- { internalType: 'uint256', name: 'amount', type: 'uint256' },
- ],
- name: 'approve',
- outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
- stateMutability: 'nonpayable',
- type: 'function',
- },
- {
- inputs: [{ internalType: 'address', name: 'account', type: 'address' }],
- stateMutability: 'view',
- type: 'function',
- name: 'balanceOf',
- outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
- },
- {
- inputs: [],
- stateMutability: 'view',
- type: 'function',
- name: 'decimals',
- outputs: [{ internalType: 'uint8', name: '', type: 'uint8' }],
- },
-];
diff --git a/packages/commonwealth/client/scripts/helpers/ContractHelpers/Abi/LpBondingCurveAbi.ts b/packages/commonwealth/client/scripts/helpers/ContractHelpers/Abi/LpBondingCurveAbi.ts
deleted file mode 100644
index ce0d551a39d..00000000000
--- a/packages/commonwealth/client/scripts/helpers/ContractHelpers/Abi/LpBondingCurveAbi.ts
+++ /dev/null
@@ -1,77 +0,0 @@
-export const LpBondingCurve = [
- {
- inputs: [
- { internalType: 'address', name: 'tokenAddress', type: 'address' },
- { internalType: 'uint256', name: 'minAmountOut', type: 'uint256' },
- ],
- stateMutability: 'payable',
- type: 'function',
- name: 'buyToken',
- outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
- },
- {
- inputs: [
- { internalType: 'address', name: 'tokenAddress', type: 'address' },
- { internalType: 'uint256', name: 'amount', type: 'uint256' },
- { internalType: 'uint256', name: 'minAmountOut', type: 'uint256' },
- ],
- stateMutability: 'payable',
- type: 'function',
- name: 'sellToken',
- },
- {
- type: 'function',
- name: 'getPrice',
- inputs: [
- { name: 'tokenAddress', type: 'address', internalType: 'address' },
- { name: 'amountIn', type: 'uint256', internalType: 'uint256' },
- { name: 'isBuy', type: 'bool', internalType: 'bool' },
- ],
- outputs: [{ name: '', type: 'uint256', internalType: 'uint256' }],
- stateMutability: 'view',
- },
- {
- inputs: [
- { internalType: 'address', name: 'tokenAddress', type: 'address' },
- ],
- stateMutability: 'view',
- type: 'function',
- name: '_getFloatingTokenSupply',
- outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
- },
- {
- inputs: [{ internalType: 'address', name: '', type: 'address' }],
- stateMutability: 'view',
- type: 'function',
- name: 'liquidity',
- outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
- },
- {
- type: 'function',
- name: '_launchpadLiquidity',
- inputs: [
- { name: 'tokenAddress', type: 'address', internalType: 'address' },
- ],
- outputs: [{ name: '', type: 'uint256', internalType: 'uint256' }],
- stateMutability: 'view',
- },
- {
- type: 'function',
- name: 'transferLiquidity',
- inputs: [
- { name: 'tokenAddress', type: 'address', internalType: 'address' },
- { name: 'minAmountOut', type: 'uint256', internalType: 'uint256' },
- ],
- outputs: [],
- stateMutability: 'payable',
- },
- {
- inputs: [
- { internalType: 'address', name: 'tokenAddress', type: 'address' },
- ],
- stateMutability: 'view',
- type: 'function',
- name: '_poolLiquidity',
- outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
- },
-];
diff --git a/packages/commonwealth/client/scripts/helpers/ContractHelpers/Abi/NamespaceFactoryAbi.ts b/packages/commonwealth/client/scripts/helpers/ContractHelpers/Abi/NamespaceFactoryAbi.ts
deleted file mode 100644
index 1504b0e381f..00000000000
--- a/packages/commonwealth/client/scripts/helpers/ContractHelpers/Abi/NamespaceFactoryAbi.ts
+++ /dev/null
@@ -1,216 +0,0 @@
-export const namespaceFactoryAbi = [
- {
- type: 'function',
- name: 'newSingleERC20Contest',
- inputs: [
- { name: 'name', type: 'string', internalType: 'string' },
- { name: 'length', type: 'uint256', internalType: 'uint256' },
- { name: 'winnerShares', type: 'uint256[]', internalType: 'uint256[]' },
- { name: 'token', type: 'address', internalType: 'address' },
- { name: 'voterShare', type: 'uint256', internalType: 'uint256' },
- { name: 'exhangeToken', type: 'address', internalType: 'address' },
- ],
- outputs: [{ name: '', type: 'address', internalType: 'address' }],
- stateMutability: 'nonpayable',
- },
- {
- inputs: [],
- stateMutability: 'view',
- type: 'function',
- name: 'reservationHook',
- outputs: [
- {
- internalType: 'address',
- name: '',
- type: 'address',
- },
- ],
- },
- {
- inputs: [
- {
- internalType: 'string',
- name: 'name',
- type: 'string',
- },
- {
- internalType: 'string',
- name: '_uri',
- type: 'string',
- },
- {
- internalType: 'address',
- name: '_feeManager',
- type: 'address',
- },
- {
- internalType: 'bytes',
- name: '_signature',
- type: 'bytes',
- },
- ],
- name: 'deployNamespace',
- outputs: [],
- stateMutability: 'nonpayable',
- type: 'function',
- },
- {
- inputs: [
- {
- internalType: 'string',
- name: 'name',
- type: 'string',
- },
- {
- internalType: 'string',
- name: 'tokenName',
- type: 'string',
- },
- {
- internalType: 'uint256',
- name: 'id',
- type: 'uint256',
- },
- {
- internalType: 'address',
- name: 'exchangeToken',
- type: 'address',
- },
- {
- internalType: 'uint256',
- name: 'scalar',
- type: 'uint256',
- },
- {
- internalType: 'uint256',
- name: 'curve',
- type: 'uint256',
- },
- ],
- stateMutability: 'nonpayable',
- type: 'function',
- name: 'configureCommunityStakeId',
- },
- {
- inputs: [
- {
- internalType: 'bytes32',
- name: '',
- type: 'bytes32',
- },
- ],
- stateMutability: 'view',
- type: 'function',
- name: 'getNamespace',
- outputs: [
- {
- internalType: 'address',
- name: '',
- type: 'address',
- },
- ],
- },
- {
- inputs: [
- {
- internalType: 'string',
- name: 'name',
- type: 'string',
- },
- {
- internalType: 'uint256',
- name: 'interval',
- type: 'uint256',
- },
- {
- internalType: 'uint256[]',
- name: 'winnerShares',
- type: 'uint256[]',
- },
- {
- internalType: 'uint256',
- name: 'id',
- type: 'uint256',
- },
- {
- internalType: 'uint256',
- name: 'prizeShare',
- type: 'uint256',
- },
- {
- internalType: 'uint256',
- name: 'voterShare',
- type: 'uint256',
- },
- {
- internalType: 'uint256',
- name: 'feeShare',
- type: 'uint256',
- },
- {
- internalType: 'uint256',
- name: 'weight',
- type: 'uint256',
- },
- ],
- name: 'newContest',
- outputs: [
- {
- internalType: 'address',
- name: '',
- type: 'address',
- },
- ],
- stateMutability: 'nonpayable',
- type: 'function',
- },
- {
- inputs: [
- {
- internalType: 'string',
- name: 'name',
- type: 'string',
- },
- {
- internalType: 'uint256',
- name: 'length',
- type: 'uint256',
- },
- {
- internalType: 'uint256[]',
- name: 'winnerShares',
- type: 'uint256[]',
- },
- {
- internalType: 'uint256',
- name: 'id',
- type: 'uint256',
- },
- {
- internalType: 'uint256',
- name: 'voterShare',
- type: 'uint256',
- },
- {
- internalType: 'uint256',
- name: 'weight',
- type: 'uint256',
- },
- {
- internalType: 'address',
- name: 'exhangeToken',
- type: 'address',
- },
- ],
- name: 'newSingleContest',
- outputs: [
- {
- internalType: 'address',
- name: '',
- type: 'address',
- },
- ],
- stateMutability: 'nonpayable',
- type: 'function',
- },
-];
diff --git a/packages/commonwealth/client/scripts/helpers/ContractHelpers/Abi/feeManagerAbi.ts b/packages/commonwealth/client/scripts/helpers/ContractHelpers/Abi/feeManagerAbi.ts
deleted file mode 100644
index a1af64f4654..00000000000
--- a/packages/commonwealth/client/scripts/helpers/ContractHelpers/Abi/feeManagerAbi.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-export const feeManagerABI = [
- {
- inputs: [
- {
- internalType: 'address',
- name: 'beneficiary',
- type: 'address',
- },
- {
- internalType: 'address',
- name: 'token',
- type: 'address',
- },
- ],
- name: 'getBeneficiaryBalance',
- outputs: [
- {
- internalType: 'uint256',
- name: '',
- type: 'uint256',
- },
- ],
- stateMutability: 'view',
- type: 'function',
- },
-];
diff --git a/packages/commonwealth/client/scripts/helpers/ContractHelpers/CommunityStakes.tsx b/packages/commonwealth/client/scripts/helpers/ContractHelpers/CommunityStakes.tsx
index 5dd7e61dbe6..94c5b773c01 100644
--- a/packages/commonwealth/client/scripts/helpers/ContractHelpers/CommunityStakes.tsx
+++ b/packages/commonwealth/client/scripts/helpers/ContractHelpers/CommunityStakes.tsx
@@ -1,5 +1,5 @@
+import { commonProtocol } from '@hicommonwealth/shared';
import { toBigInt } from 'web3-utils';
-import { communityStakesAbi } from './Abi/CommunityStakesAbi';
import ContractBase from './ContractBase';
import NamespaceFactory from './NamespaceFactory';
@@ -21,7 +21,7 @@ class CommunityStakes extends ContractBase {
rpc: string,
chainId?: string,
) {
- super(contractAddress, communityStakesAbi, rpc);
+ super(contractAddress, commonProtocol.communityStakesAbi, rpc);
this.namespaceFactoryAddress = factoryAddress;
this.chainId = chainId;
}
diff --git a/packages/commonwealth/client/scripts/helpers/ContractHelpers/Contest.ts b/packages/commonwealth/client/scripts/helpers/ContractHelpers/Contest.ts
index 2b19071298a..4f9f094df68 100644
--- a/packages/commonwealth/client/scripts/helpers/ContractHelpers/Contest.ts
+++ b/packages/commonwealth/client/scripts/helpers/ContractHelpers/Contest.ts
@@ -1,8 +1,5 @@
import { ZERO_ADDRESS, commonProtocol } from '@hicommonwealth/shared';
import { AbiItem, TransactionReceipt } from 'web3';
-import { ContestAbi } from './Abi/ContestAbi';
-import { Erc20Abi } from './Abi/ERC20Abi';
-import { feeManagerABI } from './Abi/feeManagerAbi';
import ContractBase from './ContractBase';
import NamespaceFactory from './NamespaceFactory';
@@ -13,7 +10,7 @@ class Contest extends ContractBase {
namespaceFactory: NamespaceFactory;
constructor(contractAddress: string, factoryAddress: string, rpc: string) {
- super(contractAddress, ContestAbi, rpc);
+ super(contractAddress, commonProtocol.contestAbi, rpc);
this.namespaceFactoryAddress = factoryAddress;
}
@@ -202,7 +199,7 @@ class Contest extends ContractBase {
}
} else {
const token = new this.web3.eth.Contract(
- Erc20Abi as AbiItem[],
+ commonProtocol.erc20Abi as unknown as AbiItem[],
tokenAddress,
);
const decimals = await token.methods.decimals().call();
@@ -244,7 +241,7 @@ class Contest extends ContractBase {
this.contract,
this.contractAddress,
this.web3,
- feeManagerABI,
+ commonProtocol.feeManagerAbi,
oneOff,
);
return parseInt(contestBalance, 10);
diff --git a/packages/commonwealth/client/scripts/helpers/ContractHelpers/ERC20Helper.ts b/packages/commonwealth/client/scripts/helpers/ContractHelpers/ERC20Helper.ts
index f92b9ee80e4..9fe0cfe6464 100644
--- a/packages/commonwealth/client/scripts/helpers/ContractHelpers/ERC20Helper.ts
+++ b/packages/commonwealth/client/scripts/helpers/ContractHelpers/ERC20Helper.ts
@@ -1,9 +1,9 @@
-import { Erc20Abi } from './Abi/ERC20Abi';
+import { commonProtocol } from '@hicommonwealth/shared';
import ContractBase from './ContractBase';
class ERC20Helper extends ContractBase {
constructor(contractAddress: string, rpc: string) {
- super(contractAddress, Erc20Abi, rpc);
+ super(contractAddress, commonProtocol.erc20Abi, rpc);
}
async getBalance(userAddress: string): Promise {
if (!this.initialized) {
diff --git a/packages/commonwealth/client/scripts/helpers/ContractHelpers/Launchpad.ts b/packages/commonwealth/client/scripts/helpers/ContractHelpers/Launchpad.ts
index f555800c773..795ecd98baf 100644
--- a/packages/commonwealth/client/scripts/helpers/ContractHelpers/Launchpad.ts
+++ b/packages/commonwealth/client/scripts/helpers/ContractHelpers/Launchpad.ts
@@ -1,3 +1,4 @@
+import { commonProtocol } from '@hicommonwealth/shared';
import { Contract } from 'web3';
import { AbiItem } from 'web3-utils';
import {
@@ -7,7 +8,6 @@ import {
sellToken,
transferLiquidity,
} from '../../../../../../libs/shared/src/commonProtocol';
-import { LpBondingCurve } from './Abi/LpBondingCurveAbi';
import ContractBase from './ContractBase';
import { LaunchpadFactory } from './LaunchpadFactoryAbi';
@@ -24,7 +24,7 @@ class LaunchpadBondingCurve extends ContractBase {
tokenCommunityManager: string,
rpc: string,
) {
- super(bondingCurveAddress, LpBondingCurve, rpc);
+ super(bondingCurveAddress, commonProtocol.lpBondingCurveAbi, rpc);
this.tokenAddress = tokenAddress;
this.launchpadFactoryAddress = launchpadFactoryAddress;
this.tokenCommunityManager = tokenCommunityManager;
diff --git a/packages/commonwealth/client/scripts/helpers/ContractHelpers/NamespaceFactory.ts b/packages/commonwealth/client/scripts/helpers/ContractHelpers/NamespaceFactory.ts
index 8b1ae39aa8f..ae8d72ccb1d 100644
--- a/packages/commonwealth/client/scripts/helpers/ContractHelpers/NamespaceFactory.ts
+++ b/packages/commonwealth/client/scripts/helpers/ContractHelpers/NamespaceFactory.ts
@@ -1,9 +1,6 @@
-import { ZERO_ADDRESS } from '@hicommonwealth/shared';
+import { ZERO_ADDRESS, commonProtocol } from '@hicommonwealth/shared';
import { TransactionReceipt } from 'web3';
import { AbiItem } from 'web3-utils';
-import { NamespaceAbi } from './Abi/NamespaceAbi';
-import { namespaceFactoryAbi } from './Abi/NamespaceFactoryAbi';
-import { reservationHookAbi } from './Abi/ReservationHookAbi';
import ContractBase from './ContractBase';
/**
@@ -17,7 +14,7 @@ class NamespaceFactory extends ContractBase {
* @param factoryAddress the address of the active factory to use
*/
constructor(factoryAddress: string, rpc: string) {
- super(factoryAddress, namespaceFactoryAbi, rpc);
+ super(factoryAddress, commonProtocol.namespaceFactoryAbi, rpc);
}
/**
@@ -32,7 +29,7 @@ class NamespaceFactory extends ContractBase {
const addr = await this.contract.methods.reservationHook().call();
if (addr.toLowerCase() !== ZERO_ADDRESS) {
this.reservationHook = new this.web3.eth.Contract(
- reservationHookAbi as AbiItem[],
+ commonProtocol.reservationHookAbi as AbiItem[],
addr,
);
}
@@ -323,7 +320,7 @@ class NamespaceFactory extends ContractBase {
}
const namespaceAddr = await this.getNamespaceAddress(namespace);
const namespaceContract = new this.web3.eth.Contract(
- NamespaceAbi,
+ commonProtocol.namespaceAbi,
namespaceAddr,
);
const balance = await namespaceContract.methods
From 53c202a9f3af0df8c508f6068cf653d75eb1cde9 Mon Sep 17 00:00:00 2001
From: Timothee Legros
Date: Thu, 14 Nov 2024 20:35:09 +0200
Subject: [PATCH 058/227] more ABIs
---
.../shared/src/commonProtocol/abis/launchpadFactoryAbi.ts | 2 +-
libs/shared/src/commonProtocol/index.ts | 1 +
.../client/scripts/helpers/ContractHelpers/Launchpad.ts | 7 +++----
3 files changed, 5 insertions(+), 5 deletions(-)
rename packages/commonwealth/client/scripts/helpers/ContractHelpers/LaunchpadFactoryAbi.ts => libs/shared/src/commonProtocol/abis/launchpadFactoryAbi.ts (95%)
diff --git a/packages/commonwealth/client/scripts/helpers/ContractHelpers/LaunchpadFactoryAbi.ts b/libs/shared/src/commonProtocol/abis/launchpadFactoryAbi.ts
similarity index 95%
rename from packages/commonwealth/client/scripts/helpers/ContractHelpers/LaunchpadFactoryAbi.ts
rename to libs/shared/src/commonProtocol/abis/launchpadFactoryAbi.ts
index 21b0f2a34a3..e2eaaf1e473 100644
--- a/packages/commonwealth/client/scripts/helpers/ContractHelpers/LaunchpadFactoryAbi.ts
+++ b/libs/shared/src/commonProtocol/abis/launchpadFactoryAbi.ts
@@ -1,4 +1,4 @@
-export const LaunchpadFactory = [
+export const launchpadFactoryAbi = [
{
type: 'function',
name: 'launchTokenWithLiquidity',
diff --git a/libs/shared/src/commonProtocol/index.ts b/libs/shared/src/commonProtocol/index.ts
index 54cff0b324a..3a98d720f1e 100644
--- a/libs/shared/src/commonProtocol/index.ts
+++ b/libs/shared/src/commonProtocol/index.ts
@@ -2,6 +2,7 @@ export * from './abis/communityStakesAbi';
export * from './abis/contestAbi';
export * from './abis/erc20Abi';
export * from './abis/feeManagerAbi';
+export * from './abis/launchpadFactoryAbi';
export * from './abis/lpBondingCurveAbi';
export * from './abis/namespaceAbi';
export * from './abis/namespaceFactoryAbi';
diff --git a/packages/commonwealth/client/scripts/helpers/ContractHelpers/Launchpad.ts b/packages/commonwealth/client/scripts/helpers/ContractHelpers/Launchpad.ts
index 795ecd98baf..28281bdfd1a 100644
--- a/packages/commonwealth/client/scripts/helpers/ContractHelpers/Launchpad.ts
+++ b/packages/commonwealth/client/scripts/helpers/ContractHelpers/Launchpad.ts
@@ -9,12 +9,11 @@ import {
transferLiquidity,
} from '../../../../../../libs/shared/src/commonProtocol';
import ContractBase from './ContractBase';
-import { LaunchpadFactory } from './LaunchpadFactoryAbi';
class LaunchpadBondingCurve extends ContractBase {
tokenAddress: string;
launchpadFactoryAddress: string;
- launchpadFactory: Contract;
+ launchpadFactory: Contract;
tokenCommunityManager: string;
constructor(
@@ -36,9 +35,9 @@ class LaunchpadBondingCurve extends ContractBase {
): Promise {
await super.initialize(withWallet, chainId);
this.launchpadFactory = new this.web3.eth.Contract(
- LaunchpadFactory as AbiItem[],
+ commonProtocol.launchpadFactoryAbi as AbiItem[],
this.launchpadFactoryAddress,
- ) as unknown as Contract;
+ ) as unknown as Contract;
}
async launchToken(
From 02eb00d4d8054ca40ab6cefdfc7b8b82d2b4fc84 Mon Sep 17 00:00:00 2001
From: Timothee Legros
Date: Thu, 14 Nov 2024 20:50:32 +0200
Subject: [PATCH 059/227] contestAbi update
---
.../src/commonProtocol/abis/contestAbi.ts | 403 +++++++++++++-----
1 file changed, 294 insertions(+), 109 deletions(-)
diff --git a/libs/shared/src/commonProtocol/abis/contestAbi.ts b/libs/shared/src/commonProtocol/abis/contestAbi.ts
index 39cbb99b3c3..89be46cde6d 100644
--- a/libs/shared/src/commonProtocol/abis/contestAbi.ts
+++ b/libs/shared/src/commonProtocol/abis/contestAbi.ts
@@ -2,132 +2,210 @@ export const contestAbi = [
{
inputs: [
{
+ components: [
+ {
+ internalType: 'uint256',
+ name: '_startTime',
+ type: 'uint256',
+ },
+ {
+ internalType: 'uint256',
+ name: '_contestInterval',
+ type: 'uint256',
+ },
+ {
+ internalType: 'address',
+ name: '_votingStrategy',
+ type: 'address',
+ },
+ {
+ internalType: 'address',
+ name: '_claimHookAddress',
+ type: 'address',
+ },
+ {
+ internalType: 'address',
+ name: '_contentHookAddress',
+ type: 'address',
+ },
+ {
+ internalType: 'uint256[]',
+ name: '_winnerShares',
+ type: 'uint256[]',
+ },
+ {
+ internalType: 'address',
+ name: '_contestToken',
+ type: 'address',
+ },
+ { internalType: 'uint256', name: '_prizeShare', type: 'uint256' },
+ {
+ internalType: 'uint256',
+ name: '_voterShare',
+ type: 'uint256',
+ },
+ { internalType: 'address', name: '_namespace', type: 'address' },
+ {
+ internalType: 'uint256',
+ name: '_protocolFeePercentage',
+ type: 'uint256',
+ },
+ {
+ internalType: 'address',
+ name: '_protocolFeeDestination',
+ type: 'address',
+ },
+ ],
+ internalType: 'struct ContestGovernor.InitializationParams',
+ name: 'initParams',
+ type: 'tuple',
+ },
+ ],
+ stateMutability: 'nonpayable',
+ type: 'constructor',
+ },
+ {
+ anonymous: false,
+ inputs: [
+ {
+ indexed: true,
+ internalType: 'uint256',
+ name: 'contentId',
+ type: 'uint256',
+ },
+ {
+ indexed: true,
internalType: 'address',
name: 'creator',
type: 'address',
},
+ { indexed: false, internalType: 'string', name: 'url', type: 'string' },
+ ],
+ name: 'ContentAdded',
+ type: 'event',
+ },
+ {
+ anonymous: false,
+ inputs: [
{
- internalType: 'string',
- name: 'url',
- type: 'string',
+ indexed: true,
+ internalType: 'uint256',
+ name: 'contestId',
+ type: 'uint256',
},
{
- internalType: 'bytes',
- name: 'data',
- type: 'bytes',
+ indexed: false,
+ internalType: 'uint256',
+ name: 'startTime',
+ type: 'uint256',
},
- ],
- name: 'addContent',
- outputs: [
{
+ indexed: false,
internalType: 'uint256',
- name: '',
+ name: 'endTime',
type: 'uint256',
},
],
- stateMutability: 'nonpayable',
- type: 'function',
+ name: 'NewRecurringContestStarted',
+ type: 'event',
},
{
+ anonymous: false,
inputs: [
{
+ indexed: false,
internalType: 'uint256',
- name: 'contentId',
+ name: 'newPrizeShare',
type: 'uint256',
- indexed: true,
+ },
+ ],
+ name: 'PrizeShareUpdated',
+ type: 'event',
+ },
+ {
+ anonymous: false,
+ inputs: [
+ {
+ indexed: false,
+ internalType: 'address',
+ name: 'token',
+ type: 'address',
},
{
+ indexed: false,
internalType: 'address',
- name: 'creator',
+ name: 'to',
type: 'address',
- indexed: true,
},
{
- internalType: 'string',
- name: 'url',
- type: 'string',
indexed: false,
+ internalType: 'uint256',
+ name: 'amount',
+ type: 'uint256',
},
],
+ name: 'TransferFailed',
type: 'event',
- name: 'ContentAdded',
- anonymous: false,
},
{
+ anonymous: false,
inputs: [
{
+ indexed: true,
internalType: 'address',
name: 'voter',
type: 'address',
},
{
+ indexed: true,
internalType: 'uint256',
- name: 'id',
+ name: 'contentId',
type: 'uint256',
},
- ],
- stateMutability: 'nonpayable',
- type: 'function',
- name: 'voteContent',
- },
- {
- inputs: [],
- stateMutability: 'view',
- type: 'function',
- name: 'endTime',
- outputs: [
{
+ indexed: false,
internalType: 'uint256',
- name: '',
+ name: 'contestId',
type: 'uint256',
},
- ],
- },
- {
- inputs: [],
- stateMutability: 'view',
- type: 'function',
- name: 'startTime',
- outputs: [
{
+ indexed: false,
internalType: 'uint256',
- name: '',
+ name: 'votingPower',
type: 'uint256',
},
],
+ name: 'VoterVoted',
+ type: 'event',
},
{
inputs: [],
- name: 'contestInterval',
- outputs: [
- {
- internalType: 'uint256',
- name: '',
- type: 'uint256',
- },
- ],
+ name: 'FeeMangerAddress',
+ outputs: [{ internalType: 'address', name: '', type: 'address' }],
stateMutability: 'view',
type: 'function',
},
{
- inputs: [],
- name: 'currentContentId',
- outputs: [
+ inputs: [
+ { internalType: 'address', name: 'creator', type: 'address' },
{
- internalType: 'uint256',
- name: '',
- type: 'uint256',
+ internalType: 'string',
+ name: 'url',
+ type: 'string',
},
+ { internalType: 'bytes', name: 'data', type: 'bytes' },
],
- stateMutability: 'view',
+ name: 'addContent',
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
+ stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [],
- name: 'contestToken',
+ name: 'claimHook',
outputs: [
{
- internalType: 'address',
+ internalType: 'contract IContestGovernorClaimHook',
name: '',
type: 'address',
},
@@ -136,77 +214,52 @@ export const contestAbi = [
type: 'function',
},
{
- inputs: [],
- name: 'getWinnerIds',
- outputs: [
- {
- internalType: 'uint256[]',
- name: '',
- type: 'uint256[]',
- },
- ],
+ inputs: [{ internalType: 'address', name: 'voter', type: 'address' }],
+ name: 'claimVoterRewards',
+ outputs: [],
stateMutability: 'nonpayable',
type: 'function',
},
{
- inputs: [
- {
- internalType: 'uint256',
- name: 'contestId',
- type: 'uint256',
- },
- ],
- name: 'getPastWinners',
+ inputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
+ name: 'completedContests',
outputs: [
- {
- internalType: 'uint256[]',
- name: '',
- type: 'uint256[]',
- },
- ],
- stateMutability: 'nonpayable',
- type: 'function',
- },
- {
- inputs: [
+ { internalType: 'bool', name: 'claimed', type: 'bool' },
{
internalType: 'uint256',
- name: '',
+ name: 'totalPrize',
type: 'uint256',
},
],
stateMutability: 'view',
type: 'function',
+ },
+ {
+ inputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
name: 'content',
outputs: [
- {
- internalType: 'string',
- name: 'url',
- type: 'string',
- },
+ { internalType: 'string', name: 'url', type: 'string' },
{
internalType: 'uint256',
name: 'cumulativeVotes',
type: 'uint256',
},
- {
- internalType: 'address',
- name: 'creator',
- type: 'address',
- },
+ { internalType: 'address', name: 'creator', type: 'address' },
{
internalType: 'bool',
- name: 'completed',
+ name: 'isWinner',
type: 'bool',
},
],
+ stateMutability: 'view',
+ type: 'function',
},
{
inputs: [],
- name: 'FeeMangerAddress',
+ name: 'contentHook',
outputs: [
{
- internalType: 'address',
+ internalType: 'contract IContestGovernorContentHook',
name: '',
type: 'address',
},
@@ -216,13 +269,72 @@ export const contestAbi = [
},
{
inputs: [],
- name: 'contestLength',
+ name: 'contestId',
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
+ stateMutability: 'view',
+ type: 'function',
+ },
+ {
+ inputs: [],
+ name: 'contestInterval',
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
+ stateMutability: 'view',
+ type: 'function',
+ },
+ {
+ inputs: [],
+ name: 'contestToken',
+ outputs: [{ internalType: 'address', name: '', type: 'address' }],
+ stateMutability: 'view',
+ type: 'function',
+ },
+ {
+ inputs: [],
+ name: 'currMinWinVotes',
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
+ stateMutability: 'view',
+ type: 'function',
+ },
+ {
+ inputs: [],
+ name: 'currentContentId',
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
+ stateMutability: 'view',
+ type: 'function',
+ },
+ {
+ inputs: [{ internalType: 'uint256', name: 'amount', type: 'uint256' }],
+ name: 'deposit',
+ outputs: [],
+ stateMutability: 'payable',
+ type: 'function',
+ },
+ {
+ inputs: [],
+ name: 'endTime',
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
+ stateMutability: 'view',
+ type: 'function',
+ },
+ {
+ inputs: [{ internalType: 'uint256', name: 'contestId', type: 'uint256' }],
+ name: 'getPastWinners',
+ outputs: [{ internalType: 'uint256[]', name: '', type: 'uint256[]' }],
+ stateMutability: 'view',
+ type: 'function',
+ },
+ {
+ inputs: [],
+ name: 'getWinnerIds',
+ outputs: [{ internalType: 'uint256[]', name: '', type: 'uint256[]' }],
+ stateMutability: 'view',
+ type: 'function',
+ },
+ {
+ inputs: [],
+ name: 'namespace',
outputs: [
- {
- internalType: 'uint256',
- name: '',
- type: 'uint256',
- },
+ { internalType: 'contract INamespace', name: '', type: 'address' },
],
stateMutability: 'view',
type: 'function',
@@ -236,9 +348,82 @@ export const contestAbi = [
},
{
inputs: [],
- name: 'endContest',
+ name: 'nextPrizeShare',
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
+ stateMutability: 'view',
+ type: 'function',
+ },
+ {
+ inputs: [],
+ name: 'prizeShare',
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
+ stateMutability: 'view',
+ type: 'function',
+ },
+ {
+ inputs: [],
+ name: 'protocolFeeDestination',
+ outputs: [{ internalType: 'address', name: '', type: 'address' }],
+ stateMutability: 'view',
+ type: 'function',
+ },
+ {
+ inputs: [],
+ name: 'protocolFeePercentage',
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
+ stateMutability: 'view',
+ type: 'function',
+ },
+ {
+ inputs: [],
+ name: 'startTime',
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
+ stateMutability: 'view',
+ type: 'function',
+ },
+ {
+ inputs: [{ internalType: 'uint256', name: 'newShare', type: 'uint256' }],
+ name: 'updatePrizeShare',
+ outputs: [],
+ stateMutability: 'nonpayable',
+ type: 'function',
+ },
+ {
+ inputs: [
+ { internalType: 'address', name: 'voter', type: 'address' },
+ {
+ internalType: 'uint256',
+ name: 'id',
+ type: 'uint256',
+ },
+ ],
+ name: 'voteContent',
outputs: [],
stateMutability: 'nonpayable',
type: 'function',
},
+ {
+ inputs: [],
+ name: 'voterShare',
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
+ stateMutability: 'view',
+ type: 'function',
+ },
+ {
+ inputs: [],
+ name: 'votingStrategy',
+ outputs: [
+ { internalType: 'contract IVotingStrategy', name: '', type: 'address' },
+ ],
+ stateMutability: 'view',
+ type: 'function',
+ },
+ {
+ inputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
+ name: 'winnerIds',
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
+ stateMutability: 'view',
+ type: 'function',
+ },
+ { stateMutability: 'payable', type: 'receive' },
];
From dd0ff27c6bfb1b6daab732d32b0320584e1806b4 Mon Sep 17 00:00:00 2001
From: rotorsoft
Date: Thu, 14 Nov 2024 14:46:52 -0500
Subject: [PATCH 060/227] add referral link command and tests
---
libs/model/src/models/user.ts | 1 +
.../src/user/CreateReferralLink.command.ts | 34 ++++++++++++++++++
libs/model/test/user/user-lifecycle.spec.ts | 36 +++++++++++++++++++
libs/schemas/src/commands/user.schemas.ts | 7 ++++
libs/schemas/src/entities/user.schemas.ts | 1 +
.../20241114144100-create-referral-link.js | 22 ++++++++++++
6 files changed, 101 insertions(+)
create mode 100644 libs/model/src/user/CreateReferralLink.command.ts
create mode 100644 libs/model/test/user/user-lifecycle.spec.ts
create mode 100644 packages/commonwealth/server/migrations/20241114144100-create-referral-link.js
diff --git a/libs/model/src/models/user.ts b/libs/model/src/models/user.ts
index 6cc5d3dedde..594df293c12 100644
--- a/libs/model/src/models/user.ts
+++ b/libs/model/src/models/user.ts
@@ -74,6 +74,7 @@ export default (sequelize: Sequelize.Sequelize): UserModelStatic =>
selected_community_id: { type: Sequelize.STRING, allowNull: true },
profile: { type: Sequelize.JSONB, allowNull: false },
xp_points: { type: Sequelize.INTEGER, defaultValue: 0, allowNull: true },
+ referral_link: { type: Sequelize.STRING, allowNull: true },
},
{
timestamps: true,
diff --git a/libs/model/src/user/CreateReferralLink.command.ts b/libs/model/src/user/CreateReferralLink.command.ts
new file mode 100644
index 00000000000..71053bdae5b
--- /dev/null
+++ b/libs/model/src/user/CreateReferralLink.command.ts
@@ -0,0 +1,34 @@
+import { InvalidInput, type Command } from '@hicommonwealth/core';
+import * as schemas from '@hicommonwealth/schemas';
+import { randomBytes } from 'crypto';
+import { models } from '../database';
+import { mustExist } from '../middleware/guards';
+
+export function CreateReferralLink(): Command<
+ typeof schemas.CreateReferralLink
+> {
+ return {
+ ...schemas.CreateReferralLink,
+ auth: [],
+ secure: true,
+ body: async ({ actor }) => {
+ const user = await models.User.findOne({
+ where: { id: actor.user.id },
+ attributes: ['id', 'referral_link'],
+ });
+ mustExist('User', user);
+
+ if (user.referral_link)
+ throw new InvalidInput('Referral link already exists');
+
+ const randomSegment = randomBytes(8).toString('base64url');
+ const referral_link = `ref_${user.id}_${randomSegment}`;
+
+ await user.update({ referral_link });
+
+ return {
+ referral_link,
+ };
+ },
+ };
+}
diff --git a/libs/model/test/user/user-lifecycle.spec.ts b/libs/model/test/user/user-lifecycle.spec.ts
new file mode 100644
index 00000000000..ab4f6d27ed7
--- /dev/null
+++ b/libs/model/test/user/user-lifecycle.spec.ts
@@ -0,0 +1,36 @@
+import { Actor, command, dispose } from '@hicommonwealth/core';
+import { CreateReferralLink } from 'model/src/user/CreateReferralLink.command';
+import { afterAll, beforeAll, describe, expect, it } from 'vitest';
+import { seedCommunity } from '../utils/community-seeder';
+
+describe('User lifecycle', () => {
+ let member: Actor;
+
+ beforeAll(async () => {
+ const { actors } = await seedCommunity({
+ roles: ['member'],
+ });
+ member = actors.member;
+ });
+
+ afterAll(async () => {
+ await dispose()();
+ });
+
+ it('should create referral link when user is created', async () => {
+ const response = await command(CreateReferralLink(), {
+ actor: member,
+ payload: {},
+ });
+ expect(response!.referral_link).toBeDefined();
+ });
+
+ it('should fail to create referral link when one already exists', async () => {
+ expect(
+ command(CreateReferralLink(), {
+ actor: member,
+ payload: {},
+ }),
+ ).rejects.toThrowError('Referral link already exists');
+ });
+});
diff --git a/libs/schemas/src/commands/user.schemas.ts b/libs/schemas/src/commands/user.schemas.ts
index 922837195da..86bb7d722c3 100644
--- a/libs/schemas/src/commands/user.schemas.ts
+++ b/libs/schemas/src/commands/user.schemas.ts
@@ -38,3 +38,10 @@ export const DeleteApiKey = {
deleted: z.boolean(),
}),
};
+
+export const CreateReferralLink = {
+ input: z.object({}),
+ output: z.object({
+ referral_link: z.string(),
+ }),
+};
diff --git a/libs/schemas/src/entities/user.schemas.ts b/libs/schemas/src/entities/user.schemas.ts
index c9b896a0f9d..d388c77de5b 100644
--- a/libs/schemas/src/entities/user.schemas.ts
+++ b/libs/schemas/src/entities/user.schemas.ts
@@ -53,6 +53,7 @@ export const User = z.object({
profile: UserProfile,
xp_points: PG_INT.default(0).nullish(),
+ referral_link: z.string().nullish(),
ProfileTags: z.array(ProfileTags).optional(),
ApiKey: ApiKey.optional(),
diff --git a/packages/commonwealth/server/migrations/20241114144100-create-referral-link.js b/packages/commonwealth/server/migrations/20241114144100-create-referral-link.js
new file mode 100644
index 00000000000..4bb49d26151
--- /dev/null
+++ b/packages/commonwealth/server/migrations/20241114144100-create-referral-link.js
@@ -0,0 +1,22 @@
+'use strict';
+
+/** @type {import('sequelize-cli').Migration} */
+module.exports = {
+ up: async ({ sequelize }) => {
+ await sequelize.transaction(async (transaction) => {
+ await sequelize.query(
+ `ALTER TABLE "Users" ADD COLUMN "referral_link" character varying(255);`,
+ { transaction },
+ );
+ });
+ },
+
+ down: async ({ sequelize }) => {
+ await sequelize.transaction(async (transaction) => {
+ await sequelize.query(
+ `ALTER TABLE "Users" DROP COLUMN "referral_link";`,
+ { transaction },
+ );
+ });
+ },
+};
From 9ce1f55c1e1fd1f23f19f83627cda4a37d91f188 Mon Sep 17 00:00:00 2001
From: rotorsoft
Date: Thu, 14 Nov 2024 15:11:14 -0500
Subject: [PATCH 061/227] add query and use in test
---
libs/model/src/user/GetReferralLink.query.ts | 20 ++++++++++++++++++++
libs/model/src/user/index.ts | 2 ++
libs/model/test/user/user-lifecycle.spec.ts | 12 ++++++++++--
libs/schemas/src/commands/user.schemas.ts | 7 +++++++
4 files changed, 39 insertions(+), 2 deletions(-)
create mode 100644 libs/model/src/user/GetReferralLink.query.ts
diff --git a/libs/model/src/user/GetReferralLink.query.ts b/libs/model/src/user/GetReferralLink.query.ts
new file mode 100644
index 00000000000..885aed312ee
--- /dev/null
+++ b/libs/model/src/user/GetReferralLink.query.ts
@@ -0,0 +1,20 @@
+import { type Query } from '@hicommonwealth/core';
+import * as schemas from '@hicommonwealth/schemas';
+import { models } from '../database';
+
+export function GetReferralLink(): Query {
+ return {
+ ...schemas.GetReferralLink,
+ auth: [],
+ secure: true,
+ body: async ({ actor }) => {
+ const user = await models.User.findOne({
+ where: { id: actor.user.id },
+ attributes: ['referral_link'],
+ });
+ return {
+ referral_link: user?.referral_link,
+ };
+ },
+ };
+}
diff --git a/libs/model/src/user/index.ts b/libs/model/src/user/index.ts
index 61e0c70412d..0a8ce0e5bd7 100644
--- a/libs/model/src/user/index.ts
+++ b/libs/model/src/user/index.ts
@@ -1,7 +1,9 @@
export * from './CreateApiKey.command';
+export * from './CreateReferralLink.command';
export * from './DeleteApiKey.command';
export * from './GetApiKey.query';
export * from './GetNewContent.query';
+export * from './GetReferralLink.query';
export * from './GetUserAddresses.query';
export * from './GetUserProfile.query';
export * from './SearchUserProfiles.query';
diff --git a/libs/model/test/user/user-lifecycle.spec.ts b/libs/model/test/user/user-lifecycle.spec.ts
index ab4f6d27ed7..8a45d243132 100644
--- a/libs/model/test/user/user-lifecycle.spec.ts
+++ b/libs/model/test/user/user-lifecycle.spec.ts
@@ -1,6 +1,7 @@
-import { Actor, command, dispose } from '@hicommonwealth/core';
-import { CreateReferralLink } from 'model/src/user/CreateReferralLink.command';
+import { Actor, command, dispose, query } from '@hicommonwealth/core';
import { afterAll, beforeAll, describe, expect, it } from 'vitest';
+import { GetReferralLink } from '../../src/user';
+import { CreateReferralLink } from '../../src/user/CreateReferralLink.command';
import { seedCommunity } from '../utils/community-seeder';
describe('User lifecycle', () => {
@@ -23,6 +24,13 @@ describe('User lifecycle', () => {
payload: {},
});
expect(response!.referral_link).toBeDefined();
+
+ // make sure it's saved
+ const response2 = await query(GetReferralLink(), {
+ actor: member,
+ payload: {},
+ });
+ expect(response2!.referral_link).to.eq(response?.referral_link);
});
it('should fail to create referral link when one already exists', async () => {
diff --git a/libs/schemas/src/commands/user.schemas.ts b/libs/schemas/src/commands/user.schemas.ts
index 86bb7d722c3..b425328e5c2 100644
--- a/libs/schemas/src/commands/user.schemas.ts
+++ b/libs/schemas/src/commands/user.schemas.ts
@@ -45,3 +45,10 @@ export const CreateReferralLink = {
referral_link: z.string(),
}),
};
+
+export const GetReferralLink = {
+ input: z.object({}),
+ output: z.object({
+ referral_link: z.string().nullish(),
+ }),
+};
From 7ccd1740cc8e8646cad4029b4e9cd7d55c0266fa Mon Sep 17 00:00:00 2001
From: rotorsoft
Date: Thu, 14 Nov 2024 15:31:19 -0500
Subject: [PATCH 062/227] fix user view to avoid ts error
---
libs/schemas/src/queries/thread.schemas.ts | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/libs/schemas/src/queries/thread.schemas.ts b/libs/schemas/src/queries/thread.schemas.ts
index b9a442603ab..c4f099fe8cd 100644
--- a/libs/schemas/src/queries/thread.schemas.ts
+++ b/libs/schemas/src/queries/thread.schemas.ts
@@ -6,7 +6,7 @@ import {
ProfileTags,
Thread,
ThreadVersionHistory,
- User,
+ UserProfile,
} from '../entities';
import { ContestAction } from '../projections';
import { PG_INT, paginationSchema } from '../utils';
@@ -52,12 +52,27 @@ export const ProfileTagsView = ProfileTags.extend({
updated_at: z.date().or(z.string()).nullish(),
});
-export const UserView = User.extend({
+export const UserView = z.object({
id: PG_INT,
+ email: z.string().max(255).email().nullish(),
+ isAdmin: z.boolean().default(false).nullish(),
+ disableRichText: z.boolean().default(false).optional(),
+ emailVerified: z.boolean().default(false).nullish(),
+ selected_community_id: z.string().max(255).nullish(),
+ emailNotificationInterval: z
+ .enum(['weekly', 'never'])
+ .default('never')
+ .optional(),
+ promotional_emails_enabled: z.boolean().nullish(),
+ is_welcome_onboard_flow_complete: z.boolean().default(false).optional(),
+
+ profile: UserProfile,
+ xp_points: PG_INT.default(0).nullish(),
+ referral_link: z.string().nullish(),
+
created_at: z.date().or(z.string()).nullish(),
updated_at: z.date().or(z.string()).nullish(),
ProfileTags: z.array(ProfileTagsView).optional(),
- ApiKey: z.undefined(),
});
export const AddressView = Address.extend({
From 26af83d7fff43c320ec00eaa695cda810f26de94 Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Fri, 15 Nov 2024 01:53:14 +0500
Subject: [PATCH 063/227] Fix image upload
---
.../components/component_kit/CWImageInput/UploadControl.tsx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/packages/commonwealth/client/scripts/views/components/component_kit/CWImageInput/UploadControl.tsx b/packages/commonwealth/client/scripts/views/components/component_kit/CWImageInput/UploadControl.tsx
index 8394e29b024..0cb77dd6758 100644
--- a/packages/commonwealth/client/scripts/views/components/component_kit/CWImageInput/UploadControl.tsx
+++ b/packages/commonwealth/client/scripts/views/components/component_kit/CWImageInput/UploadControl.tsx
@@ -204,9 +204,9 @@ export const UploadControl = ({
className="generate-image-section"
onClick={(e) => e.stopPropagation()}
onKeyDown={(e) => {
- e.preventDefault();
- e.stopPropagation();
if (e.key === 'Enter' && imagePrompt.trim()) {
+ e.preventDefault();
+ e.stopPropagation();
generateImage({ prompt: imagePrompt.trim() }).catch(
console.error,
);
From 914b2e1215018c7011f1880545c21e93b3e5cfa3 Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Fri, 15 Nov 2024 16:35:03 +0500
Subject: [PATCH 064/227] Added logic to sell token + cleaned state exports
---
.../helpers/ContractHelpers/Launchpad.ts | 4 +-
.../scripts/state/api/launchPad/sellToken.ts | 37 +++++
.../TradeTokenModel/TokenIcon/TokenIcon.scss | 15 ++
.../TradeTokenModel/TokenIcon/TokenIcon.tsx | 14 ++
.../modals/TradeTokenModel/TokenIcon/index.ts | 3 +
.../AddressBalance/AddressBalance.scss | 8 +
.../AddressBalance/AddressBalance.tsx | 31 ++++
.../TradeTokenForm/AddressBalance/index.ts | 3 +
.../AmountSelections/AmountSelections.scss | 5 +-
.../AmountSelections/BuyAmountSelection.tsx | 24 +--
.../AmountSelections/SellAmountSelection.tsx | 32 ++++
.../ReceiptDetails/BuyReceipt.tsx | 26 ++--
.../ReceiptDetails/SellReceipt.tsx | 42 ++++++
.../TradeTokenForm/TradeTokenForm.tsx | 43 +++---
.../TradeTokenModel/TradeTokenForm/types.ts | 10 ++
.../TradeTokenForm/useTradeTokenForm.ts | 141 +++++++++++++++---
.../TradeTokenModel/TradeTokenModal.scss | 6 +
.../TradeTokenModel/TradeTokenModal.tsx | 13 +-
18 files changed, 389 insertions(+), 68 deletions(-)
create mode 100644 packages/commonwealth/client/scripts/state/api/launchPad/sellToken.ts
create mode 100644 packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TokenIcon/TokenIcon.scss
create mode 100644 packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TokenIcon/TokenIcon.tsx
create mode 100644 packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TokenIcon/index.ts
create mode 100644 packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AddressBalance/AddressBalance.scss
create mode 100644 packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AddressBalance/AddressBalance.tsx
create mode 100644 packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AddressBalance/index.ts
create mode 100644 packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AmountSelections/SellAmountSelection.tsx
create mode 100644 packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/ReceiptDetails/SellReceipt.tsx
diff --git a/packages/commonwealth/client/scripts/helpers/ContractHelpers/Launchpad.ts b/packages/commonwealth/client/scripts/helpers/ContractHelpers/Launchpad.ts
index feff0e02fec..47c53f48d0e 100644
--- a/packages/commonwealth/client/scripts/helpers/ContractHelpers/Launchpad.ts
+++ b/packages/commonwealth/client/scripts/helpers/ContractHelpers/Launchpad.ts
@@ -79,9 +79,9 @@ class LaunchpadBondingCurve extends ContractBase {
return txReceipt;
}
- async sellToken(amountSell: number, walletAddress: string) {
+ async sellToken(amountSell: number, walletAddress: string, chainId: string) {
if (!this.initialized || !this.walletEnabled) {
- await this.initialize(true);
+ await this.initialize(true, chainId);
}
const txReceipt = await sellToken(
diff --git a/packages/commonwealth/client/scripts/state/api/launchPad/sellToken.ts b/packages/commonwealth/client/scripts/state/api/launchPad/sellToken.ts
new file mode 100644
index 00000000000..5868e83d7a3
--- /dev/null
+++ b/packages/commonwealth/client/scripts/state/api/launchPad/sellToken.ts
@@ -0,0 +1,37 @@
+import { commonProtocol } from '@hicommonwealth/shared';
+import { useMutation } from '@tanstack/react-query';
+import LaunchpadBondingCurve from 'helpers/ContractHelpers/Launchpad';
+
+interface SellTokenProps {
+ chainRpc: string;
+ ethChainId: number;
+ tokenAddress: string;
+ amountToken: number;
+ walletAddress: string;
+}
+
+const sellToken = async ({
+ ethChainId,
+ chainRpc,
+ tokenAddress,
+ amountToken,
+ walletAddress,
+}: SellTokenProps) => {
+ const launchPad = new LaunchpadBondingCurve(
+ commonProtocol.factoryContracts[ethChainId].lpBondingCurve,
+ commonProtocol.factoryContracts[ethChainId].launchpad,
+ tokenAddress,
+ commonProtocol.factoryContracts[ethChainId].tokenCommunityManager,
+ chainRpc,
+ );
+
+ return await launchPad.sellToken(amountToken, walletAddress, `${ethChainId}`);
+};
+
+const useSellTokenMutation = () => {
+ return useMutation({
+ mutationFn: sellToken,
+ });
+};
+
+export default useSellTokenMutation;
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TokenIcon/TokenIcon.scss b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TokenIcon/TokenIcon.scss
new file mode 100644
index 00000000000..7503240dbc1
--- /dev/null
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TokenIcon/TokenIcon.scss
@@ -0,0 +1,15 @@
+@import '../../../../../styles/shared.scss';
+
+.TokenIcon {
+ border-radius: 50%;
+
+ &.small {
+ height: 16px !important;
+ width: 16px !important;
+ }
+
+ &.large {
+ height: 24px !important;
+ width: 24px !important;
+ }
+}
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TokenIcon/TokenIcon.tsx b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TokenIcon/TokenIcon.tsx
new file mode 100644
index 00000000000..a8349f0f513
--- /dev/null
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TokenIcon/TokenIcon.tsx
@@ -0,0 +1,14 @@
+import clsx from 'clsx';
+import React from 'react';
+import './TokenIcon.scss';
+
+type TokenIconProps = {
+ size?: 'small' | 'large';
+ url: string;
+};
+
+const TokenIcon = ({ size = 'small', url }: TokenIconProps) => {
+ return ;
+};
+
+export default TokenIcon;
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TokenIcon/index.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TokenIcon/index.ts
new file mode 100644
index 00000000000..cbe7dfecec8
--- /dev/null
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TokenIcon/index.ts
@@ -0,0 +1,3 @@
+import TokenIcon from './TokenIcon';
+
+export default TokenIcon;
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AddressBalance/AddressBalance.scss b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AddressBalance/AddressBalance.scss
new file mode 100644
index 00000000000..28c9e13ce11
--- /dev/null
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AddressBalance/AddressBalance.scss
@@ -0,0 +1,8 @@
+@import '../../../../../../styles/shared.scss';
+
+.AddressBalance {
+ display: flex;
+ align-items: center;
+ justify-self: flex-end;
+ gap: 1px;
+}
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AddressBalance/AddressBalance.tsx b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AddressBalance/AddressBalance.tsx
new file mode 100644
index 00000000000..e104abfb85e
--- /dev/null
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AddressBalance/AddressBalance.tsx
@@ -0,0 +1,31 @@
+import React from 'react';
+import { Skeleton } from 'views/components/Skeleton';
+import { CWIcon } from 'views/components/component_kit/cw_icons/cw_icon';
+import { CWText } from 'views/components/component_kit/cw_text';
+import TokenIcon from '../../TokenIcon';
+import { AddressBalanceProps, TradingMode } from '../types';
+import './AddressBalance.scss';
+
+const AddressBalance = ({ trading, addresses }: AddressBalanceProps) => {
+ const isBuyMode = trading.mode.value === TradingMode.Buy;
+ const isETH = isBuyMode;
+ const isLoading =
+ addresses.selected.balances[isBuyMode ? 'eth' : 'selectedToken'].isLoading;
+ const balanceValue =
+ addresses.selected.balances[isBuyMode ? 'eth' : 'selectedToken'].value;
+ const tokenSymbol = isETH ? 'ETH' : trading.token.symbol;
+
+ return (
+
+ {isETH ? (
+
+ ) : (
+ trading.token.icon_url &&
+ )}
+ {isLoading ? : balanceValue}
+ {tokenSymbol}
+
+ );
+};
+
+export default AddressBalance;
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AddressBalance/index.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AddressBalance/index.ts
new file mode 100644
index 00000000000..ad754c9a189
--- /dev/null
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AddressBalance/index.ts
@@ -0,0 +1,3 @@
+import AddressBalance from './AddressBalance';
+
+export default AddressBalance;
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AmountSelections/AmountSelections.scss b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AmountSelections/AmountSelections.scss
index ca8b2cc808c..86b886b242b 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AmountSelections/AmountSelections.scss
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AmountSelections/AmountSelections.scss
@@ -48,10 +48,13 @@
}
}
- .amount-to-crypto {
+ .invest-to-gain-amounts {
text-align: center;
margin: auto;
width: fit-content;
+ display: flex;
+ align-items: center;
+ gap: 3px;
}
.preset-amounts {
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AmountSelections/BuyAmountSelection.tsx b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AmountSelections/BuyAmountSelection.tsx
index d24354c6dff..b5d57363802 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AmountSelections/BuyAmountSelection.tsx
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AmountSelections/BuyAmountSelection.tsx
@@ -8,11 +8,12 @@ import { CWIcon } from 'views/components/component_kit/cw_icons/cw_icon';
import { CWText } from 'views/components/component_kit/cw_text';
import { CWTag } from 'views/components/component_kit/new_designs/CWTag';
import { CWTextInput } from 'views/components/component_kit/new_designs/CWTextInput';
+import TokenIcon from '../../TokenIcon';
import { BuyAmountSelectionProps } from '../types';
import './AmountSelections.scss';
const BuyAmountSelection = ({ trading }: BuyAmountSelectionProps) => {
- const baseCurrencyName = trading.amounts.buy.baseCurrency.name;
+ const baseCurrencyName = trading.amounts.buy.invest.baseCurrency.name;
const buyAmountCurrenySymbol = (
@@ -28,22 +29,25 @@ const BuyAmountSelection = ({ trading }: BuyAmountSelectionProps) => {
trading.amounts.buy.baseCurrency.onAmountChange(e)}
+ value={trading.amounts.buy.invest.baseCurrency.amount}
+ onInput={(e) =>
+ trading.amounts.buy.invest.baseCurrency.onAmountChange(e)
+ }
/>
{currencySymbolPlacements.onRight.includes(baseCurrencyName) &&
buyAmountCurrenySymbol}
-
+
- {trading.amounts.buy.eth} ETH = {trading.amounts.buy.token}{' '}
- {trading.token.symbol}
+ {trading.amounts.buy.invest.baseCurrency.toEth} ETH =
+ {trading.token.icon_url && }
+ {trading.amounts.buy.gain.token} {trading.token.symbol}
- {trading.amounts.buy.baseCurrency.presetAmounts && (
+ {trading.amounts.buy.invest.baseCurrency.presetAmounts && (
- {trading.amounts.buy.baseCurrency.presetAmounts?.map(
+ {trading.amounts.buy.invest.baseCurrency.presetAmounts?.map(
(presetAmount) => (
{
baseCurrencyName,
)}
onClick={() =>
- trading.amounts.buy.baseCurrency.onAmountChange(presetAmount)
+ trading.amounts.buy.invest.baseCurrency.onAmountChange(
+ presetAmount,
+ )
}
/>
),
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AmountSelections/SellAmountSelection.tsx b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AmountSelections/SellAmountSelection.tsx
new file mode 100644
index 00000000000..4a1468fc68a
--- /dev/null
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AmountSelections/SellAmountSelection.tsx
@@ -0,0 +1,32 @@
+import React from 'react';
+import { CWIcon } from 'views/components/component_kit/cw_icons/cw_icon';
+import { CWText } from 'views/components/component_kit/cw_text';
+import { CWTextInput } from 'views/components/component_kit/new_designs/CWTextInput';
+import { SellAmountSelectionProps } from '../types';
+import './AmountSelections.scss';
+
+const SellAmountSelection = ({ trading }: SellAmountSelectionProps) => {
+ return (
+
+
+
+ trading.amounts.sell.invest.baseToken.onAmountChange(e)
+ }
+ />
+ {trading.token.symbol}
+
+
+
+ =
+ {' '}
+ {trading.amounts.sell.gain.eth} ETH
+
+
+ );
+};
+
+export default SellAmountSelection;
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/ReceiptDetails/BuyReceipt.tsx b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/ReceiptDetails/BuyReceipt.tsx
index 5b18c831728..e012aa9e309 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/ReceiptDetails/BuyReceipt.tsx
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/ReceiptDetails/BuyReceipt.tsx
@@ -8,7 +8,8 @@ import { ReceiptDetailsProps } from '../types';
import './ReceiptDetails.scss';
const BuyReceipt = ({ trading }: ReceiptDetailsProps) => {
- const baseCurrencyName = trading.amounts.buy.baseCurrency.name;
+ const { invest, gain } = trading.amounts.buy;
+ const baseCurrencyName = invest.baseCurrency.name;
const baseCurrencySymbol = currencyNameToSymbolMap[baseCurrencyName];
const isLeftSymbolCurrency =
currencySymbolPlacements.onLeft.includes(baseCurrencyName);
@@ -18,39 +19,36 @@ const BuyReceipt = ({ trading }: ReceiptDetailsProps) => {
return (
- ETH to {baseCurrencyName} rate
+ {baseCurrencyName} to ETH rate
- 1 ETH = {isLeftSymbolCurrency ? baseCurrencySymbol : ''}{' '}
- {trading.unitEthToBaseCurrencyRate}
- {isRightSymbolCurrency ? baseCurrencySymbol : ''}
+ {isLeftSymbolCurrency ? baseCurrencySymbol : ''}{' '}
+ {invest.baseCurrency.unitEthExchangeRate}
+ {isRightSymbolCurrency ? baseCurrencySymbol : ''} = 1 ETH
Amount invested ({baseCurrencyName})
{isLeftSymbolCurrency ? baseCurrencySymbol : ''}{' '}
- {trading.amounts.buy.baseCurrency.amount}
+ {invest.baseCurrency.amount}
{isRightSymbolCurrency ? baseCurrencySymbol : ''}
ETH bought from invested amount
- {trading.amounts.buy.eth} ETH
+ {invest.baseCurrency.toEth} ETH
- Common's Platform Fee (
- {trading.amounts.buy.commonPlatformFee.percentage})
-
-
- {trading.amounts.buy.commonPlatformFee.eth} ETH
+ Common's Platform Fee ({invest.commonPlatformFee.percentage})
+ {invest.commonPlatformFee.eth} ETH
Remaining ETH to tokens
- {trading.amounts.buy.eth - trading.amounts.buy.commonPlatformFee.eth}{' '}
- ETH = {trading.amounts.buy.token} {trading.token.symbol}
+ {invest.baseCurrency.toEth - invest.commonPlatformFee.eth} ETH ={' '}
+ {gain.token} {trading.token.symbol}
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/ReceiptDetails/SellReceipt.tsx b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/ReceiptDetails/SellReceipt.tsx
new file mode 100644
index 00000000000..b5916a9a2ec
--- /dev/null
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/ReceiptDetails/SellReceipt.tsx
@@ -0,0 +1,42 @@
+import React from 'react';
+import { CWText } from 'views/components/component_kit/cw_text';
+import { ReceiptDetailsProps } from '../types';
+import './ReceiptDetails.scss';
+
+const SellReceipt = ({ trading }: ReceiptDetailsProps) => {
+ const baseTokenSymbol = trading.token.symbol;
+ const { invest, gain } = trading.amounts.sell;
+
+ return (
+
+
+ {baseTokenSymbol} to ETH rate
+
+ {invest.baseToken.unitEthExchangeRate} {baseTokenSymbol} = 1 ETH
+
+
+
+ Amount invested ({baseTokenSymbol})
+
+ {invest.baseToken.amount} {baseTokenSymbol}
+
+
+
+ ETH bought from invested amount
+ {invest.baseToken.toEth} ETH
+
+
+
+ Common's Platform Fee ({invest.commonPlatformFee.percentage})
+
+ {invest.commonPlatformFee.eth} ETH
+
+
+ Gain ETH amount
+ {gain.eth} ETH
+
+
+ );
+};
+
+export default SellReceipt;
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx
index e5d22ee3740..0678e9be372 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx
@@ -1,6 +1,4 @@
import React, { ReactNode, useState } from 'react';
-import { Skeleton } from 'views/components/Skeleton';
-import { CWIcon } from 'views/components/component_kit/cw_icons/cw_icon';
import { CWText } from 'views/components/component_kit/cw_text';
import { CWButton } from 'views/components/component_kit/new_designs/CWButton';
import CWCircleMultiplySpinner from 'views/components/component_kit/new_designs/CWCircleMultiplySpinner';
@@ -15,8 +13,11 @@ import {
CustomAddressOption,
CustomAddressOptionElement,
} from '../../ManageCommunityStakeModal/StakeExchangeForm/CustomAddressOption';
+import AddressBalance from './AddressBalance';
import BuyAmountSelection from './AmountSelections/BuyAmountSelection';
+import SellAmountSelection from './AmountSelections/SellAmountSelection';
import BuyReceipt from './ReceiptDetails/BuyReceipt';
+import SellReceipt from './ReceiptDetails/SellReceipt';
import './TradeTokenForm.scss';
import { convertAddressToDropdownOption } from './helpers';
import { TradeTokenFormProps, TradingMode } from './types';
@@ -30,14 +31,28 @@ const TradeTokenForm = ({
const [isReceiptDetailOpen, setIsReceiptDetailOpen] = useState(false);
const getCTADisabledTooltipText = () => {
- if (isActionPending) return 'Processing trade...';
+ const labels = {
+ processingTrade: 'Processing trade...',
+ tradingAmountRequired: 'Please add trading amount to continue',
+ insufficientFunds: `You don't have sufficient funds to continue`,
+ };
+
+ if (isActionPending) return labels.processingTrade;
// only use these in buy mode
if (trading.mode.value === TradingMode.Buy) {
- if (trading.amounts.buy.baseCurrency.amount === 0)
- return 'Please add trading amount to continue';
- if (trading.amounts.buy.insufficientFunds)
- return `You don't have sufficient funds to buy token`;
+ if (trading.amounts.buy.invest.baseCurrency.amount === 0)
+ return labels.tradingAmountRequired;
+ if (trading.amounts.buy.invest.insufficientFunds)
+ return labels.insufficientFunds;
+ }
+
+ // only use these in sell mode
+ if (trading.mode.value === TradingMode.Sell) {
+ if (trading.amounts.sell.invest.baseToken.amount === 0)
+ return labels.tradingAmountRequired;
+ if (trading.amounts.sell.invest.insufficientFunds)
+ return labels.insufficientFunds;
}
};
@@ -106,15 +121,7 @@ const TradeTokenForm = ({
Current balance
-
-
- {addresses.selected.balances.eth.isLoading ? (
-
- ) : (
- addresses.selected.balances.eth.value
- )}
- ETH
-
+
@@ -126,7 +133,7 @@ const TradeTokenForm = ({
{trading.mode.value === TradingMode.Buy ? (
) : (
- <>{/* TODO: sell mode components here */}>
+
)}
@@ -152,7 +159,7 @@ const TradeTokenForm = ({
{trading.mode.value === TradingMode.Buy ? (
) : (
- <>{/* TODO: sell mode components here */}>
+
)}
>
)
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts
index 777d046fd23..32af7b306cd 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts
@@ -30,11 +30,21 @@ export type UseTradeTokenFormProps = {
onTradeComplete?: () => void;
};
+export type AddressBalanceProps = Pick<
+ ReturnType,
+ 'trading' | 'addresses'
+>;
+
export type BuyAmountSelectionProps = Pick<
ReturnType,
'trading'
>;
+export type SellAmountSelectionProps = Pick<
+ ReturnType,
+ 'trading'
+>;
+
export type ReceiptDetailsProps = Pick<
ReturnType,
'trading'
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts
index 8e90fe1fea2..9b9a6ac7933 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts
@@ -9,8 +9,12 @@ import {
useGetUserEthBalanceQuery,
} from 'state/api/communityStake';
import { useBuyTokenMutation } from 'state/api/launchPad';
+import useSellTokenMutation from 'state/api/launchPad/sellToken';
import { fetchCachedNodes } from 'state/api/nodes';
-import { useCreateTokenTradeMutation } from 'state/api/tokens';
+import {
+ useCreateTokenTradeMutation,
+ useGetERC20BalanceQuery,
+} from 'state/api/tokens';
import useUserStore from 'state/ui/user';
import useJoinCommunity from 'views/components/SublayoutHeader/useJoinCommunity';
import './TradeTokenForm.scss';
@@ -23,8 +27,7 @@ const useTradeTokenForm = ({
addressType,
onTradeComplete,
}: UseTradeTokenFormProps) => {
- const [baseCurrencyTradingAmount, setBaseCurrencyTradingAmount] =
- useState(0);
+ const [baseCurrencyBuyAmount, setBaseCurrencyBuyAmount] = useState(0);
const [tradingMode, setTradingMode] = useState(
tradeConfig.mode || TradingMode.Buy,
);
@@ -58,7 +61,7 @@ const useTradeTokenForm = ({
ethToCurrencyRateData?.data?.data?.amount || '0.00',
);
- const ethBuyAmount = baseCurrencyTradingAmount / ethToCurrencyRate;
+ const ethBuyAmount = baseCurrencyBuyAmount / ethToCurrencyRate;
const commonPlatformFeeForBuyTradeInEth =
(COMMON_PLATFORM_FEE_PERCENTAGE / 100) * ethBuyAmount;
@@ -92,18 +95,18 @@ const useTradeTokenForm = ({
const { mutateAsync: createTokenTrade, isLoading: isCreatingTokenTrade } =
useCreateTokenTradeMutation();
- const onBaseCurrencyTradingAmountChange = (
+ const onBaseCurrencyBuyAmountChange = (
change: React.ChangeEvent | number,
) => {
if (typeof change == 'number') {
- setBaseCurrencyTradingAmount(change);
+ setBaseCurrencyBuyAmount(change);
} else {
const value = change.target.value;
- if (value === '') setBaseCurrencyTradingAmount(0);
+ if (value === '') setBaseCurrencyBuyAmount(0);
// verify only numbers with decimal (optional) are present
else if (/^\d+(\.\d+)?$/.test(value))
- setBaseCurrencyTradingAmount(parseFloat(value));
+ setBaseCurrencyBuyAmount(parseFloat(value));
}
};
@@ -169,15 +172,80 @@ const useTradeTokenForm = ({
}
};
+ // sell mode logic start --- {
+ const [tokenSellAmount, setTokenSellAmount] = useState(0); // can be fractional
+
+ const { mutateAsync: sellToken, isLoading: isSellingToken } =
+ useSellTokenMutation();
+
const handleTokenSell = async () => {
- // TODO: implement selling logic
+ try {
+ // this condition wouldn't be called, but adding to avoid typescript issues
+ if (
+ !baseNode?.url ||
+ !baseNode?.ethChainId ||
+ !selectedAddress ||
+ !tokenCommunity
+ ) {
+ return;
+ }
+
+ // buy token on chain
+ const payload = {
+ chainRpc: baseNode.url,
+ ethChainId: baseNode.ethChainId,
+ amountToken: tokenSellAmount * 1e18, // amount in wei // TODO
+ walletAddress: selectedAddress,
+ tokenAddress: tradeConfig.token.token_address,
+ };
+ const txReceipt = await sellToken(payload);
+
+ // create token trade on db
+ await createTokenTrade({
+ eth_chain_id: baseNode?.ethChainId,
+ transaction_hash: txReceipt.transactionHash,
+ });
+
+ // update user about success
+ notifySuccess('Transactions successful!');
+
+ onTradeComplete?.();
+ } catch (e) {
+ notifyError('Failed to sell token');
+ console.log('Failed to sell token => ', e);
+ }
};
+ const {
+ data: selectedAddressTokenBalance = `0.0`,
+ isLoading: isLoadingUserTokenBalance,
+ } = useGetERC20BalanceQuery({
+ nodeRpc: tokenCommunity?.ChainNode?.url || '',
+ tokenAddress: tradeConfig.token.token_address,
+ userAddress: selectedAddress || '',
+ });
+
+ const onTokenSellAmountChange = (
+ change: React.ChangeEvent,
+ ) => {
+ const value = change.target.value;
+
+ if (value === '')
+ setTokenSellAmount(0); // TODO: fix decimal
+ // verify only numbers with decimal (optional) are present
+ else if (/^\d*(\.\d+)?$/.test(value)) {
+ setTokenSellAmount(parseFloat(value));
+ }
+ };
+ // sell mode logic end --- }
+
// flag to indicate if something is ongoing
const isActionPending =
isLoadingTokenCommunity ||
isLoadingUserEthBalance ||
isBuyingToken ||
+ isLoadingUserTokenBalance ||
+ isSellingToken ||
isLoadingETHToCurrencyRate ||
isCreatingTokenTrade;
@@ -203,26 +271,51 @@ const useTradeTokenForm = ({
trading: {
amounts: {
buy: {
- eth: ethBuyAmount,
- token: 100, // TODO: hardcoded for now
- baseCurrency: {
- name: tradeConfig.currency, // USD/GBP etc
- amount: baseCurrencyTradingAmount,
- onAmountChange: onBaseCurrencyTradingAmountChange,
- presetAmounts: tradeConfig.presetAmounts,
+ invest: {
+ baseCurrency: {
+ name: tradeConfig.currency, // USD/GBP etc
+ amount: baseCurrencyBuyAmount,
+ onAmountChange: onBaseCurrencyBuyAmountChange,
+ presetAmounts: tradeConfig.presetAmounts,
+ unitEthExchangeRate: ethToCurrencyRate,
+ toEth: ethBuyAmount,
+ },
+ insufficientFunds:
+ ethBuyAmount > parseFloat(selectedAddressEthBalance),
+ commonPlatformFee: {
+ percentage: `${COMMON_PLATFORM_FEE_PERCENTAGE}%`,
+ eth: commonPlatformFeeForBuyTradeInEth,
+ },
},
- insufficientFunds:
- ethBuyAmount > parseFloat(selectedAddressEthBalance),
- commonPlatformFee: {
- percentage: `${COMMON_PLATFORM_FEE_PERCENTAGE}%`,
- eth: commonPlatformFeeForBuyTradeInEth,
+ gain: {
+ token: 100, // TODO: hardcoded for now - blocked token pricing
+ },
+ },
+ sell: {
+ invest: {
+ // not to be confused with "Base" network on ethereum
+ baseToken: {
+ amount: tokenSellAmount,
+ onAmountChange: onTokenSellAmountChange,
+ unitEthExchangeRate: 100, // TODO: hardcoded for now - blocked token pricing
+ toEth: 100, // TODO: hardcoded for now - blocked token pricing
+ },
+ insufficientFunds:
+ tokenSellAmount > parseFloat(selectedAddressTokenBalance),
+ commonPlatformFee: {
+ percentage: `${COMMON_PLATFORM_FEE_PERCENTAGE}%`,
+ eth: 100, // TODO: hardcoded for now - blocked token pricing
+ },
+ },
+ gain: {
+ eth: 100, // TODO: hardcoded for now - blocked token pricing
},
},
},
- unitEthToBaseCurrencyRate: ethToCurrencyRate,
mode: { value: tradingMode, onChange: onTradingModeChange },
token: tradeConfig.token,
},
+ // TODO: add presets for max amounts?
addresses: {
available: userAddresses,
default: selectedAddress,
@@ -233,6 +326,10 @@ const useTradeTokenForm = ({
value: selectedAddressEthBalance,
isLoading: isLoadingUserEthBalance,
},
+ selectedToken: {
+ value: selectedAddressTokenBalance,
+ isLoading: isLoadingUserTokenBalance,
+ },
},
onChange: onChangeSelectedAddress,
},
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.scss b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.scss
index 7d5928c44cc..f4863b919e8 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.scss
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.scss
@@ -1,4 +1,10 @@
@import '../../../../styles/shared.scss';
.TradeTokenModal {
+ .token-info {
+ display: flex;
+ align-items: center;
+ justify-self: flex-end;
+ gap: 4px;
+ }
}
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.tsx b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.tsx
index 19a97f0de27..0a624c4f434 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.tsx
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.tsx
@@ -1,11 +1,13 @@
import { SupportedCurrencies } from 'helpers/currency';
import React from 'react';
+import { CWText } from '../../components/component_kit/cw_text';
import {
CWModal,
CWModalBody,
CWModalFooter,
CWModalHeader,
} from '../../components/component_kit/new_designs/CWModal';
+import TokenIcon from './TokenIcon';
import TradeTokenForm, {
TradingConfig,
useTradeTokenForm,
@@ -42,11 +44,18 @@ const TradeTokenModal = ({
open={isOpen}
onClose={() => onModalClose?.()}
size="medium"
- className="AuthModal"
+ className="TradeTokenModal"
content={
<>
+ Trade Token - {tradeConfig.token.symbol}{' '}
+ {trading.token.icon_url && (
+
+ )}
+
+ }
onModalClose={() => onModalClose?.()}
/>
From b0e6f7cfc4c6075a898575d2e7f507ab00cdb824 Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Fri, 15 Nov 2024 16:59:21 +0500
Subject: [PATCH 065/227] Segregated buy token logic into dedicated hook
---
.../TradeTokenModel/TradeTokenForm/types.ts | 14 +-
.../TradeTokenForm/useBuyTrade.ts | 162 ++++++++++++++++++
.../TradeTokenForm/useTradeTokenForm.ts | 151 +++-------------
3 files changed, 193 insertions(+), 134 deletions(-)
create mode 100644 packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useBuyTrade.ts
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts
index 32af7b306cd..ac3889dd7b3 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts
@@ -1,6 +1,7 @@
-import { TokenView } from '@hicommonwealth/schemas';
+import { ExtendedCommunity, TokenView } from '@hicommonwealth/schemas';
import { ChainBase } from '@hicommonwealth/shared';
import { SupportedCurrencies } from 'helpers/currency';
+import NodeInfo from 'models/NodeInfo';
import { z } from 'zod';
import useTradeTokenForm from './useTradeTokenForm';
@@ -9,8 +10,6 @@ export enum TradingMode {
Sell = 'sell',
}
-export type TradeTokenFormProps = ReturnType;
-
const TokenWithCommunity = TokenView.extend({
community_id: z.string(),
});
@@ -30,6 +29,15 @@ export type UseTradeTokenFormProps = {
onTradeComplete?: () => void;
};
+export type UseBuyTradeProps = UseTradeTokenFormProps & {
+ chainNode: NodeInfo;
+ tokenCommunity?: z.infer;
+ selectedAddress?: string;
+ commonFeePercentage: number;
+};
+
+export type TradeTokenFormProps = ReturnType;
+
export type AddressBalanceProps = Pick<
ReturnType,
'trading' | 'addresses'
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useBuyTrade.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useBuyTrade.ts
new file mode 100644
index 00000000000..69f9d9136f2
--- /dev/null
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useBuyTrade.ts
@@ -0,0 +1,162 @@
+import { notifyError, notifySuccess } from 'controllers/app/notifications';
+import { useState } from 'react';
+import {
+ useFetchTokenUsdRateQuery,
+ useGetUserEthBalanceQuery,
+} from 'state/api/communityStake';
+import { useBuyTokenMutation } from 'state/api/launchPad';
+import { useCreateTokenTradeMutation } from 'state/api/tokens';
+import useUserStore from 'state/ui/user';
+import useJoinCommunity from 'views/components/SublayoutHeader/useJoinCommunity';
+import { UseBuyTradeProps } from './types';
+
+const useBuyTrade = ({
+ tradeConfig,
+ chainNode,
+ tokenCommunity,
+ selectedAddress,
+ commonFeePercentage,
+ onTradeComplete,
+}: UseBuyTradeProps) => {
+ const user = useUserStore();
+ const [baseCurrencyBuyAmount, setBaseCurrencyBuyAmount] = useState(0);
+
+ const { linkSpecificAddressToSpecificCommunity } = useJoinCommunity();
+
+ const { data: ethToCurrencyRateData, isLoading: isLoadingETHToCurrencyRate } =
+ useFetchTokenUsdRateQuery({
+ tokenSymbol: 'ETH',
+ });
+ const ethToCurrencyRate = parseFloat(
+ ethToCurrencyRateData?.data?.data?.amount || '0.00',
+ );
+ const ethBuyAmount = baseCurrencyBuyAmount / ethToCurrencyRate;
+ const commonPlatformFeeForBuyTradeInEth =
+ (commonFeePercentage / 100) * ethBuyAmount;
+
+ // imp: this query uses CommunityStakes helper to get eth price, but its
+ // a generic query so no need to initiate a separate Launchpad helper
+ const {
+ data: selectedAddressEthBalance = `0.0`,
+ isLoading: isLoadingUserEthBalance,
+ } = useGetUserEthBalanceQuery({
+ chainRpc: tokenCommunity?.ChainNode?.url || '',
+ ethChainId: tokenCommunity?.ChainNode?.eth_chain_id || 0,
+ walletAddress: selectedAddress || '',
+ apiEnabled: !!(selectedAddress && tokenCommunity),
+ });
+
+ const { mutateAsync: buyToken, isLoading: isBuyingToken } =
+ useBuyTokenMutation();
+
+ const { mutateAsync: createTokenTrade, isLoading: isCreatingTokenTrade } =
+ useCreateTokenTradeMutation();
+
+ const onBaseCurrencyBuyAmountChange = (
+ change: React.ChangeEvent | number,
+ ) => {
+ if (typeof change == 'number') {
+ setBaseCurrencyBuyAmount(change);
+ } else {
+ const value = change.target.value;
+
+ if (value === '') setBaseCurrencyBuyAmount(0);
+ // verify only numbers with decimal (optional) are present
+ else if (/^\d+(\.\d+)?$/.test(value))
+ setBaseCurrencyBuyAmount(parseFloat(value));
+ }
+ };
+
+ const handleTokenBuy = async () => {
+ try {
+ // this condition wouldn't be called, but adding to avoid typescript issues
+ if (
+ !chainNode?.url ||
+ !chainNode?.ethChainId ||
+ !selectedAddress ||
+ !tokenCommunity
+ ) {
+ return;
+ }
+
+ // buy token on chain
+ const payload = {
+ chainRpc: chainNode.url,
+ ethChainId: chainNode.ethChainId,
+ amountEth: ethBuyAmount * 1e18, // amount in wei
+ walletAddress: selectedAddress,
+ tokenAddress: tradeConfig.token.token_address,
+ };
+ const txReceipt = await buyToken(payload);
+
+ // create token trade on db
+ await createTokenTrade({
+ eth_chain_id: chainNode?.ethChainId,
+ transaction_hash: txReceipt.transactionHash,
+ });
+
+ // join user's selected address to community
+ const isMemberOfCommunity = user.addresses.find(
+ (x) => x.community.id === tokenCommunity.id,
+ );
+ if (!isMemberOfCommunity) {
+ await linkSpecificAddressToSpecificCommunity({
+ address: selectedAddress,
+ community: {
+ base: tokenCommunity.base,
+ iconUrl: tokenCommunity.icon_url || '',
+ id: tokenCommunity.id,
+ name: tokenCommunity.name,
+ },
+ });
+ }
+
+ // update user about success
+ notifySuccess('Transactions successful!');
+
+ onTradeComplete?.();
+ } catch (e) {
+ notifyError('Failed to buy token');
+ console.log('Failed to buy token => ', e);
+ }
+ };
+
+ // flag to indicate if something is ongoing
+ const isBuyActionPending =
+ isLoadingUserEthBalance ||
+ isBuyingToken ||
+ isLoadingETHToCurrencyRate ||
+ isCreatingTokenTrade;
+
+ return {
+ // Note: not exporting state setters directly, all "buy token" business logic should be done in this hook
+ amounts: {
+ invest: {
+ baseCurrency: {
+ name: tradeConfig.currency, // USD/GBP etc
+ amount: baseCurrencyBuyAmount,
+ onAmountChange: onBaseCurrencyBuyAmountChange,
+ presetAmounts: tradeConfig.presetAmounts,
+ unitEthExchangeRate: ethToCurrencyRate,
+ toEth: ethBuyAmount,
+ },
+ insufficientFunds: ethBuyAmount > parseFloat(selectedAddressEthBalance),
+ commonPlatformFee: {
+ percentage: `${commonFeePercentage}%`,
+ eth: commonPlatformFeeForBuyTradeInEth,
+ },
+ },
+ gain: {
+ token: 100, // TODO: hardcoded for now - blocked token pricing
+ },
+ },
+ selectedAddressEthBalance: {
+ isLoading: isLoadingUserEthBalance,
+ value: selectedAddressEthBalance,
+ },
+ isBuyActionPending,
+ handleTokenBuy,
+ };
+};
+
+export default useBuyTrade;
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts
index 9b9a6ac7933..587a9d9473d 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts
@@ -1,14 +1,10 @@
+import { ExtendedCommunity } from '@hicommonwealth/schemas';
import { commonProtocol } from '@hicommonwealth/shared';
import { notifyError, notifySuccess } from 'controllers/app/notifications';
import useRunOnceOnCondition from 'hooks/useRunOnceOnCondition';
import NodeInfo from 'models/NodeInfo';
import { useMemo, useState } from 'react';
import { useGetCommunityByIdQuery } from 'state/api/communities';
-import {
- useFetchTokenUsdRateQuery,
- useGetUserEthBalanceQuery,
-} from 'state/api/communityStake';
-import { useBuyTokenMutation } from 'state/api/launchPad';
import useSellTokenMutation from 'state/api/launchPad/sellToken';
import { fetchCachedNodes } from 'state/api/nodes';
import {
@@ -16,9 +12,9 @@ import {
useGetERC20BalanceQuery,
} from 'state/api/tokens';
import useUserStore from 'state/ui/user';
-import useJoinCommunity from 'views/components/SublayoutHeader/useJoinCommunity';
-import './TradeTokenForm.scss';
+import { z } from 'zod';
import { TradingMode, UseTradeTokenFormProps } from './types';
+import useBuyTrade from './useBuyTrade';
const COMMON_PLATFORM_FEE_PERCENTAGE = 5; // make configurable when needed
@@ -27,7 +23,6 @@ const useTradeTokenForm = ({
addressType,
onTradeComplete,
}: UseTradeTokenFormProps) => {
- const [baseCurrencyBuyAmount, setBaseCurrencyBuyAmount] = useState(0);
const [tradingMode, setTradingMode] = useState(
tradeConfig.mode || TradingMode.Buy,
);
@@ -51,20 +46,6 @@ const useTradeTokenForm = ({
(n) => n.ethChainId === commonProtocol.ValidChains.SepoliaBase,
) as NodeInfo; // this is expected to exist
- const { linkSpecificAddressToSpecificCommunity } = useJoinCommunity();
-
- const { data: ethToCurrencyRateData, isLoading: isLoadingETHToCurrencyRate } =
- useFetchTokenUsdRateQuery({
- tokenSymbol: 'ETH',
- });
- const ethToCurrencyRate = parseFloat(
- ethToCurrencyRateData?.data?.data?.amount || '0.00',
- );
-
- const ethBuyAmount = baseCurrencyBuyAmount / ethToCurrencyRate;
- const commonPlatformFeeForBuyTradeInEth =
- (COMMON_PLATFORM_FEE_PERCENTAGE / 100) * ethBuyAmount;
-
const { data: tokenCommunity, isLoading: isLoadingTokenCommunity } =
useGetCommunityByIdQuery({
id: tradeConfig.token.community_id,
@@ -72,44 +53,14 @@ const useTradeTokenForm = ({
includeNodeInfo: true,
});
- // imp: this query uses CommunityStakes helper to get eth price, but its
- // a generic query so no need to initiate a separate Launhpad helper
- const {
- data: selectedAddressEthBalance = `0.0`,
- isLoading: isLoadingUserEthBalance,
- } = useGetUserEthBalanceQuery({
- chainRpc: tokenCommunity?.ChainNode?.url || '',
- ethChainId: tokenCommunity?.ChainNode?.eth_chain_id || 0,
- walletAddress: selectedAddress || '',
- apiEnabled: !!(selectedAddress && tokenCommunity),
- });
-
useRunOnceOnCondition({
callback: () => setSelectedAddress(userAddresses[0]),
shouldRun: userAddresses.length > 0 && !selectedAddress,
});
- const { mutateAsync: buyToken, isLoading: isBuyingToken } =
- useBuyTokenMutation();
-
const { mutateAsync: createTokenTrade, isLoading: isCreatingTokenTrade } =
useCreateTokenTradeMutation();
- const onBaseCurrencyBuyAmountChange = (
- change: React.ChangeEvent | number,
- ) => {
- if (typeof change == 'number') {
- setBaseCurrencyBuyAmount(change);
- } else {
- const value = change.target.value;
-
- if (value === '') setBaseCurrencyBuyAmount(0);
- // verify only numbers with decimal (optional) are present
- else if (/^\d+(\.\d+)?$/.test(value))
- setBaseCurrencyBuyAmount(parseFloat(value));
- }
- };
-
const onTradingModeChange = (mode: TradingMode) => {
setTradingMode(mode);
};
@@ -118,59 +69,19 @@ const useTradeTokenForm = ({
setSelectedAddress(address);
};
- const handleTokenBuy = async () => {
- try {
- // this condition wouldn't be called, but adding to avoid typescript issues
- if (
- !baseNode?.url ||
- !baseNode?.ethChainId ||
- !selectedAddress ||
- !tokenCommunity
- ) {
- return;
- }
-
- // buy token on chain
- const payload = {
- chainRpc: baseNode.url,
- ethChainId: baseNode.ethChainId,
- amountEth: ethBuyAmount * 1e18, // amount in wei
- walletAddress: selectedAddress,
- tokenAddress: tradeConfig.token.token_address,
- };
- const txReceipt = await buyToken(payload);
-
- // create token trade on db
- await createTokenTrade({
- eth_chain_id: baseNode?.ethChainId,
- transaction_hash: txReceipt.transactionHash,
- });
-
- // join user's selected address to community
- const isMemberOfCommunity = user.addresses.find(
- (x) => x.community.id === tokenCommunity.id,
- );
- if (!isMemberOfCommunity) {
- await linkSpecificAddressToSpecificCommunity({
- address: selectedAddress,
- community: {
- base: tokenCommunity.base,
- iconUrl: tokenCommunity.icon_url || '',
- id: tokenCommunity.id,
- name: tokenCommunity.name,
- },
- });
- }
-
- // update user about success
- notifySuccess('Transactions successful!');
-
- onTradeComplete?.();
- } catch (e) {
- notifyError('Failed to buy token');
- console.log('Failed to buy token => ', e);
- }
- };
+ const {
+ amounts: buyTradeAmounts,
+ handleTokenBuy,
+ isBuyActionPending,
+ selectedAddressEthBalance,
+ } = useBuyTrade({
+ chainNode: baseNode,
+ selectedAddress,
+ commonFeePercentage: COMMON_PLATFORM_FEE_PERCENTAGE,
+ tradeConfig,
+ onTradeComplete,
+ tokenCommunity: tokenCommunity as z.infer,
+ });
// sell mode logic start --- {
const [tokenSellAmount, setTokenSellAmount] = useState(0); // can be fractional
@@ -242,11 +153,9 @@ const useTradeTokenForm = ({
// flag to indicate if something is ongoing
const isActionPending =
isLoadingTokenCommunity ||
- isLoadingUserEthBalance ||
- isBuyingToken ||
+ isBuyActionPending ||
isLoadingUserTokenBalance ||
isSellingToken ||
- isLoadingETHToCurrencyRate ||
isCreatingTokenTrade;
const onCTAClick = () => {
@@ -270,27 +179,7 @@ const useTradeTokenForm = ({
// functionality is done in most "onChange" handlers above
trading: {
amounts: {
- buy: {
- invest: {
- baseCurrency: {
- name: tradeConfig.currency, // USD/GBP etc
- amount: baseCurrencyBuyAmount,
- onAmountChange: onBaseCurrencyBuyAmountChange,
- presetAmounts: tradeConfig.presetAmounts,
- unitEthExchangeRate: ethToCurrencyRate,
- toEth: ethBuyAmount,
- },
- insufficientFunds:
- ethBuyAmount > parseFloat(selectedAddressEthBalance),
- commonPlatformFee: {
- percentage: `${COMMON_PLATFORM_FEE_PERCENTAGE}%`,
- eth: commonPlatformFeeForBuyTradeInEth,
- },
- },
- gain: {
- token: 100, // TODO: hardcoded for now - blocked token pricing
- },
- },
+ buy: buyTradeAmounts,
sell: {
invest: {
// not to be confused with "Base" network on ethereum
@@ -323,8 +212,8 @@ const useTradeTokenForm = ({
value: selectedAddress,
balances: {
eth: {
- value: selectedAddressEthBalance,
- isLoading: isLoadingUserEthBalance,
+ value: selectedAddressEthBalance.value,
+ isLoading: selectedAddressEthBalance.isLoading,
},
selectedToken: {
value: selectedAddressTokenBalance,
From f35cc89ca661c169a48bf071f4366a18be9f83e4 Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Fri, 15 Nov 2024 17:28:05 +0500
Subject: [PATCH 066/227] Segregated sell token logic into dedicated hook
---
.../TradeTokenModel/TradeTokenForm/types.ts | 4 +-
.../TradeTokenForm/useBuyTrade.ts | 4 +-
.../TradeTokenForm/useSellTrade.ts | 121 ++++++++++++++++++
.../TradeTokenForm/useTradeTokenForm.ts | 120 +++--------------
.../TradeTokenModel/TradeTokenModal.tsx | 2 +-
5 files changed, 145 insertions(+), 106 deletions(-)
create mode 100644 packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useSellTrade.ts
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts
index ac3889dd7b3..963f6c25fc3 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts
@@ -23,7 +23,7 @@ export type TradingConfig = {
export type UseTradeTokenFormProps = {
tradeConfig: TradingConfig & {
currency: SupportedCurrencies;
- presetAmounts?: number[];
+ buyTokenPresetAmounts?: number[];
};
addressType?: ChainBase;
onTradeComplete?: () => void;
@@ -36,6 +36,8 @@ export type UseBuyTradeProps = UseTradeTokenFormProps & {
commonFeePercentage: number;
};
+export type UseSellTradeProps = UseBuyTradeProps;
+
export type TradeTokenFormProps = ReturnType;
export type AddressBalanceProps = Pick<
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useBuyTrade.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useBuyTrade.ts
index 69f9d9136f2..ce37d3c03a3 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useBuyTrade.ts
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useBuyTrade.ts
@@ -19,7 +19,7 @@ const useBuyTrade = ({
onTradeComplete,
}: UseBuyTradeProps) => {
const user = useUserStore();
- const [baseCurrencyBuyAmount, setBaseCurrencyBuyAmount] = useState(0);
+ const [baseCurrencyBuyAmount, setBaseCurrencyBuyAmount] = useState(0); // can be fractional
const { linkSpecificAddressToSpecificCommunity } = useJoinCommunity();
@@ -136,7 +136,7 @@ const useBuyTrade = ({
name: tradeConfig.currency, // USD/GBP etc
amount: baseCurrencyBuyAmount,
onAmountChange: onBaseCurrencyBuyAmountChange,
- presetAmounts: tradeConfig.presetAmounts,
+ presetAmounts: tradeConfig.buyTokenPresetAmounts,
unitEthExchangeRate: ethToCurrencyRate,
toEth: ethBuyAmount,
},
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useSellTrade.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useSellTrade.ts
new file mode 100644
index 00000000000..d674eef2e16
--- /dev/null
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useSellTrade.ts
@@ -0,0 +1,121 @@
+import { notifyError, notifySuccess } from 'controllers/app/notifications';
+import { useState } from 'react';
+import useSellTokenMutation from 'state/api/launchPad/sellToken';
+import {
+ useCreateTokenTradeMutation,
+ useGetERC20BalanceQuery,
+} from 'state/api/tokens';
+import { UseSellTradeProps } from './types';
+
+const useSellTrade = ({
+ chainNode,
+ commonFeePercentage,
+ selectedAddress,
+ tokenCommunity,
+ tradeConfig,
+ onTradeComplete,
+}: UseSellTradeProps) => {
+ const [tokenSellAmount, setTokenSellAmount] = useState(0); // can be fractional
+
+ const { mutateAsync: createTokenTrade, isLoading: isCreatingTokenTrade } =
+ useCreateTokenTradeMutation();
+
+ const { mutateAsync: sellToken, isLoading: isSellingToken } =
+ useSellTokenMutation();
+
+ const {
+ data: selectedAddressTokenBalance = `0.0`,
+ isLoading: isLoadingUserTokenBalance,
+ } = useGetERC20BalanceQuery({
+ nodeRpc: tokenCommunity?.ChainNode?.url || '',
+ tokenAddress: tradeConfig.token.token_address,
+ userAddress: selectedAddress || '',
+ });
+
+ const onTokenSellAmountChange = (
+ change: React.ChangeEvent,
+ ) => {
+ const value = change.target.value;
+
+ if (value === '')
+ setTokenSellAmount(0); // TODO: fix decimal
+ // verify only numbers with decimal (optional) are present
+ else if (/^\d*(\.\d+)?$/.test(value)) {
+ setTokenSellAmount(parseFloat(value));
+ }
+ };
+
+ const handleTokenSell = async () => {
+ try {
+ // this condition wouldn't be called, but adding to avoid typescript issues
+ if (
+ !chainNode?.url ||
+ !chainNode?.ethChainId ||
+ !selectedAddress ||
+ !tokenCommunity
+ ) {
+ return;
+ }
+
+ // buy token on chain
+ const payload = {
+ chainRpc: chainNode.url,
+ ethChainId: chainNode.ethChainId,
+ amountToken: tokenSellAmount * 1e18, // amount in wei // TODO: needs fix?
+ walletAddress: selectedAddress,
+ tokenAddress: tradeConfig.token.token_address,
+ };
+ const txReceipt = await sellToken(payload);
+
+ // create token trade on db
+ await createTokenTrade({
+ eth_chain_id: chainNode?.ethChainId,
+ transaction_hash: txReceipt.transactionHash,
+ });
+
+ // update user about success
+ notifySuccess('Transactions successful!');
+
+ onTradeComplete?.();
+ } catch (e) {
+ notifyError('Failed to sell token');
+ console.log('Failed to sell token => ', e);
+ }
+ };
+
+ // flag to indicate if something is ongoing
+ const isSellActionPending =
+ isLoadingUserTokenBalance || isSellingToken || isCreatingTokenTrade;
+
+ return {
+ // Note: not exporting state setters directly, all "sell token" business logic should be done in this hook
+ amounts: {
+ invest: {
+ // not to be confused with "Base" network on ethereum
+ baseToken: {
+ amount: tokenSellAmount,
+ onAmountChange: onTokenSellAmountChange,
+ unitEthExchangeRate: 100, // TODO: hardcoded for now - blocked token pricing
+ toEth: 100, // TODO: hardcoded for now - blocked token pricing
+ },
+ insufficientFunds:
+ tokenSellAmount > parseFloat(selectedAddressTokenBalance),
+ commonPlatformFee: {
+ percentage: `${commonFeePercentage}%`,
+ eth: 100, // TODO: hardcoded for now - blocked token pricing
+ },
+ },
+ gain: {
+ eth: 100, // TODO: hardcoded for now - blocked token pricing
+ },
+ },
+ selectedAddressTokenBalance: {
+ isLoading: isLoadingUserTokenBalance,
+ value: selectedAddressTokenBalance,
+ },
+ isSellActionPending,
+ handleTokenSell,
+ };
+};
+
+export default useSellTrade;
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts
index 587a9d9473d..15b99477b29 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts
@@ -1,20 +1,15 @@
import { ExtendedCommunity } from '@hicommonwealth/schemas';
import { commonProtocol } from '@hicommonwealth/shared';
-import { notifyError, notifySuccess } from 'controllers/app/notifications';
import useRunOnceOnCondition from 'hooks/useRunOnceOnCondition';
import NodeInfo from 'models/NodeInfo';
import { useMemo, useState } from 'react';
import { useGetCommunityByIdQuery } from 'state/api/communities';
-import useSellTokenMutation from 'state/api/launchPad/sellToken';
import { fetchCachedNodes } from 'state/api/nodes';
-import {
- useCreateTokenTradeMutation,
- useGetERC20BalanceQuery,
-} from 'state/api/tokens';
import useUserStore from 'state/ui/user';
import { z } from 'zod';
import { TradingMode, UseTradeTokenFormProps } from './types';
import useBuyTrade from './useBuyTrade';
+import useSellTrade from './useSellTrade';
const COMMON_PLATFORM_FEE_PERCENTAGE = 5; // make configurable when needed
@@ -58,9 +53,6 @@ const useTradeTokenForm = ({
shouldRun: userAddresses.length > 0 && !selectedAddress,
});
- const { mutateAsync: createTokenTrade, isLoading: isCreatingTokenTrade } =
- useCreateTokenTradeMutation();
-
const onTradingModeChange = (mode: TradingMode) => {
setTradingMode(mode);
};
@@ -83,80 +75,23 @@ const useTradeTokenForm = ({
tokenCommunity: tokenCommunity as z.infer,
});
- // sell mode logic start --- {
- const [tokenSellAmount, setTokenSellAmount] = useState(0); // can be fractional
-
- const { mutateAsync: sellToken, isLoading: isSellingToken } =
- useSellTokenMutation();
-
- const handleTokenSell = async () => {
- try {
- // this condition wouldn't be called, but adding to avoid typescript issues
- if (
- !baseNode?.url ||
- !baseNode?.ethChainId ||
- !selectedAddress ||
- !tokenCommunity
- ) {
- return;
- }
-
- // buy token on chain
- const payload = {
- chainRpc: baseNode.url,
- ethChainId: baseNode.ethChainId,
- amountToken: tokenSellAmount * 1e18, // amount in wei // TODO
- walletAddress: selectedAddress,
- tokenAddress: tradeConfig.token.token_address,
- };
- const txReceipt = await sellToken(payload);
-
- // create token trade on db
- await createTokenTrade({
- eth_chain_id: baseNode?.ethChainId,
- transaction_hash: txReceipt.transactionHash,
- });
-
- // update user about success
- notifySuccess('Transactions successful!');
-
- onTradeComplete?.();
- } catch (e) {
- notifyError('Failed to sell token');
- console.log('Failed to sell token => ', e);
- }
- };
-
const {
- data: selectedAddressTokenBalance = `0.0`,
- isLoading: isLoadingUserTokenBalance,
- } = useGetERC20BalanceQuery({
- nodeRpc: tokenCommunity?.ChainNode?.url || '',
- tokenAddress: tradeConfig.token.token_address,
- userAddress: selectedAddress || '',
+ amounts: sellTradeAmounts,
+ handleTokenSell,
+ isSellActionPending,
+ selectedAddressTokenBalance,
+ } = useSellTrade({
+ chainNode: baseNode,
+ selectedAddress,
+ commonFeePercentage: COMMON_PLATFORM_FEE_PERCENTAGE,
+ tradeConfig,
+ onTradeComplete,
+ tokenCommunity: tokenCommunity as z.infer,
});
- const onTokenSellAmountChange = (
- change: React.ChangeEvent,
- ) => {
- const value = change.target.value;
-
- if (value === '')
- setTokenSellAmount(0); // TODO: fix decimal
- // verify only numbers with decimal (optional) are present
- else if (/^\d*(\.\d+)?$/.test(value)) {
- setTokenSellAmount(parseFloat(value));
- }
- };
- // sell mode logic end --- }
-
// flag to indicate if something is ongoing
const isActionPending =
- isLoadingTokenCommunity ||
- isBuyActionPending ||
- isLoadingUserTokenBalance ||
- isSellingToken ||
- isCreatingTokenTrade;
+ isLoadingTokenCommunity || isBuyActionPending || isSellActionPending;
const onCTAClick = () => {
if (isActionPending) return;
@@ -175,31 +110,12 @@ const useTradeTokenForm = ({
};
return {
- // Note: not exporting state setters directly, since some extra
- // functionality is done in most "onChange" handlers above
+ // Note: not exporting state setters directly, all "buy/sell token"
+ // business logic should be done (or exported from) in this hook
trading: {
amounts: {
buy: buyTradeAmounts,
- sell: {
- invest: {
- // not to be confused with "Base" network on ethereum
- baseToken: {
- amount: tokenSellAmount,
- onAmountChange: onTokenSellAmountChange,
- unitEthExchangeRate: 100, // TODO: hardcoded for now - blocked token pricing
- toEth: 100, // TODO: hardcoded for now - blocked token pricing
- },
- insufficientFunds:
- tokenSellAmount > parseFloat(selectedAddressTokenBalance),
- commonPlatformFee: {
- percentage: `${COMMON_PLATFORM_FEE_PERCENTAGE}%`,
- eth: 100, // TODO: hardcoded for now - blocked token pricing
- },
- },
- gain: {
- eth: 100, // TODO: hardcoded for now - blocked token pricing
- },
- },
+ sell: sellTradeAmounts,
},
mode: { value: tradingMode, onChange: onTradingModeChange },
token: tradeConfig.token,
@@ -216,8 +132,8 @@ const useTradeTokenForm = ({
isLoading: selectedAddressEthBalance.isLoading,
},
selectedToken: {
- value: selectedAddressTokenBalance,
- isLoading: isLoadingUserTokenBalance,
+ value: selectedAddressTokenBalance.value,
+ isLoading: selectedAddressTokenBalance.isLoading,
},
},
onChange: onChangeSelectedAddress,
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.tsx b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.tsx
index 0a624c4f434..859f83ed438 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.tsx
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.tsx
@@ -32,7 +32,7 @@ const TradeTokenModal = ({
tradeConfig: {
...tradeConfig,
currency: TRADING_CURRENCY,
- presetAmounts: [100, 300, 1000],
+ buyTokenPresetAmounts: [100, 300, 1000],
},
addressType: tradeConfig.addressType,
onTradeComplete: () => onModalClose?.(),
From 152ab1767d86cf83fd45ee01e469c402dca6cb82 Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Fri, 15 Nov 2024 17:30:47 +0500
Subject: [PATCH 067/227] Fix modal overflow
---
.../scripts/views/modals/TradeTokenModel/TradeTokenModal.scss | 2 ++
1 file changed, 2 insertions(+)
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.scss b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.scss
index f4863b919e8..23c1b3bceb5 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.scss
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.scss
@@ -1,6 +1,8 @@
@import '../../../../styles/shared.scss';
.TradeTokenModal {
+ overflow-y: scroll;
+
.token-info {
display: flex;
align-items: center;
From c6aad51520d113f29088f494c7eeefcb2dc809a5 Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Fri, 15 Nov 2024 17:49:43 +0500
Subject: [PATCH 068/227] Allow user to enter decimal amounts when
buying/selling tokens
---
.../TradeTokenForm/useBuyTrade.ts | 16 +++++++++-------
.../TradeTokenForm/useSellTrade.ts | 17 ++++++++---------
2 files changed, 17 insertions(+), 16 deletions(-)
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useBuyTrade.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useBuyTrade.ts
index ce37d3c03a3..9e024fbdf78 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useBuyTrade.ts
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useBuyTrade.ts
@@ -19,7 +19,10 @@ const useBuyTrade = ({
onTradeComplete,
}: UseBuyTradeProps) => {
const user = useUserStore();
- const [baseCurrencyBuyAmount, setBaseCurrencyBuyAmount] = useState(0); // can be fractional
+ const [baseCurrencyBuyAmountString, setBaseCurrencyBuyAmountString] =
+ useState('0'); // can be fractional
+ const baseCurrencyBuyAmountDecimals =
+ parseFloat(baseCurrencyBuyAmountString) || 0;
const { linkSpecificAddressToSpecificCommunity } = useJoinCommunity();
@@ -30,7 +33,7 @@ const useBuyTrade = ({
const ethToCurrencyRate = parseFloat(
ethToCurrencyRateData?.data?.data?.amount || '0.00',
);
- const ethBuyAmount = baseCurrencyBuyAmount / ethToCurrencyRate;
+ const ethBuyAmount = baseCurrencyBuyAmountDecimals / ethToCurrencyRate;
const commonPlatformFeeForBuyTradeInEth =
(commonFeePercentage / 100) * ethBuyAmount;
@@ -56,14 +59,13 @@ const useBuyTrade = ({
change: React.ChangeEvent | number,
) => {
if (typeof change == 'number') {
- setBaseCurrencyBuyAmount(change);
+ setBaseCurrencyBuyAmountString(`${change}`);
} else {
const value = change.target.value;
- if (value === '') setBaseCurrencyBuyAmount(0);
+ if (value === '') setBaseCurrencyBuyAmountString('0');
// verify only numbers with decimal (optional) are present
- else if (/^\d+(\.\d+)?$/.test(value))
- setBaseCurrencyBuyAmount(parseFloat(value));
+ else if (/^\d*\.?\d*$/.test(value)) setBaseCurrencyBuyAmountString(value);
}
};
@@ -134,7 +136,7 @@ const useBuyTrade = ({
invest: {
baseCurrency: {
name: tradeConfig.currency, // USD/GBP etc
- amount: baseCurrencyBuyAmount,
+ amount: baseCurrencyBuyAmountString,
onAmountChange: onBaseCurrencyBuyAmountChange,
presetAmounts: tradeConfig.buyTokenPresetAmounts,
unitEthExchangeRate: ethToCurrencyRate,
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useSellTrade.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useSellTrade.ts
index d674eef2e16..51516ce93ac 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useSellTrade.ts
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useSellTrade.ts
@@ -15,7 +15,9 @@ const useSellTrade = ({
tradeConfig,
onTradeComplete,
}: UseSellTradeProps) => {
- const [tokenSellAmount, setTokenSellAmount] = useState(0); // can be fractional
+ const [tokenSellAmountString, setTokenSellAmountString] =
+ useState(`0`); // can be fractional
+ const tokenSellAmountDecimals = parseFloat(tokenSellAmountString) || 0;
const { mutateAsync: createTokenTrade, isLoading: isCreatingTokenTrade } =
useCreateTokenTradeMutation();
@@ -37,12 +39,9 @@ const useSellTrade = ({
) => {
const value = change.target.value;
- if (value === '')
- setTokenSellAmount(0); // TODO: fix decimal
+ if (value === '') setTokenSellAmountString(`0`);
// verify only numbers with decimal (optional) are present
- else if (/^\d*(\.\d+)?$/.test(value)) {
- setTokenSellAmount(parseFloat(value));
- }
+ else if (/^\d*\.?\d*$/.test(value)) setTokenSellAmountString(value);
};
const handleTokenSell = async () => {
@@ -61,7 +60,7 @@ const useSellTrade = ({
const payload = {
chainRpc: chainNode.url,
ethChainId: chainNode.ethChainId,
- amountToken: tokenSellAmount * 1e18, // amount in wei // TODO: needs fix?
+ amountToken: tokenSellAmountDecimals * 1e18, // amount in wei // TODO: needs fix
walletAddress: selectedAddress,
tokenAddress: tradeConfig.token.token_address,
};
@@ -93,13 +92,13 @@ const useSellTrade = ({
invest: {
// not to be confused with "Base" network on ethereum
baseToken: {
- amount: tokenSellAmount,
+ amount: setTokenSellAmountString,
onAmountChange: onTokenSellAmountChange,
unitEthExchangeRate: 100, // TODO: hardcoded for now - blocked token pricing
toEth: 100, // TODO: hardcoded for now - blocked token pricing
},
insufficientFunds:
- tokenSellAmount > parseFloat(selectedAddressTokenBalance),
+ tokenSellAmountDecimals > parseFloat(selectedAddressTokenBalance),
commonPlatformFee: {
percentage: `${commonFeePercentage}%`,
eth: 100, // TODO: hardcoded for now - blocked token pricing
From c249a526d2cc32f6afa0ac22061506cd47c9f470 Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Fri, 15 Nov 2024 17:58:31 +0500
Subject: [PATCH 069/227] Fix types
---
.../TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx | 6 ++++--
.../modals/TradeTokenModel/TradeTokenForm/useSellTrade.ts | 2 +-
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx
index 0678e9be372..9aa70c7b760 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx
@@ -41,7 +41,9 @@ const TradeTokenForm = ({
// only use these in buy mode
if (trading.mode.value === TradingMode.Buy) {
- if (trading.amounts.buy.invest.baseCurrency.amount === 0)
+ if (
+ (parseFloat(trading.amounts.buy.invest.baseCurrency.amount) || 0) === 0
+ )
return labels.tradingAmountRequired;
if (trading.amounts.buy.invest.insufficientFunds)
return labels.insufficientFunds;
@@ -49,7 +51,7 @@ const TradeTokenForm = ({
// only use these in sell mode
if (trading.mode.value === TradingMode.Sell) {
- if (trading.amounts.sell.invest.baseToken.amount === 0)
+ if ((parseFloat(trading.amounts.sell.invest.baseToken.amount) || 0) === 0)
return labels.tradingAmountRequired;
if (trading.amounts.sell.invest.insufficientFunds)
return labels.insufficientFunds;
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useSellTrade.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useSellTrade.ts
index 51516ce93ac..c918696663c 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useSellTrade.ts
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useSellTrade.ts
@@ -92,7 +92,7 @@ const useSellTrade = ({
invest: {
// not to be confused with "Base" network on ethereum
baseToken: {
- amount: setTokenSellAmountString,
+ amount: tokenSellAmountString,
onAmountChange: onTokenSellAmountChange,
unitEthExchangeRate: 100, // TODO: hardcoded for now - blocked token pricing
toEth: 100, // TODO: hardcoded for now - blocked token pricing
From 76b4e8267060f586b3cd420381d93431a766686a Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Fri, 15 Nov 2024 18:02:34 +0500
Subject: [PATCH 070/227] Updated placeholders for amount selections
---
.../TradeTokenForm/AmountSelections/BuyAmountSelection.tsx | 2 +-
.../TradeTokenForm/AmountSelections/SellAmountSelection.tsx | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AmountSelections/BuyAmountSelection.tsx b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AmountSelections/BuyAmountSelection.tsx
index b5d57363802..7bc7c93a7d8 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AmountSelections/BuyAmountSelection.tsx
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AmountSelections/BuyAmountSelection.tsx
@@ -28,7 +28,7 @@ const BuyAmountSelection = ({ trading }: BuyAmountSelectionProps) => {
buyAmountCurrenySymbol}
trading.amounts.buy.invest.baseCurrency.onAmountChange(e)
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AmountSelections/SellAmountSelection.tsx b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AmountSelections/SellAmountSelection.tsx
index 4a1468fc68a..2bb46cfa4d8 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AmountSelections/SellAmountSelection.tsx
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AmountSelections/SellAmountSelection.tsx
@@ -11,7 +11,7 @@ const SellAmountSelection = ({ trading }: SellAmountSelectionProps) => {
trading.amounts.sell.invest.baseToken.onAmountChange(e)
From 4154b0d0a6b13296e9f55bc058f73d8506a330f5 Mon Sep 17 00:00:00 2001
From: Timothee Legros
Date: Fri, 15 Nov 2024 16:03:56 +0200
Subject: [PATCH 071/227] small fixes
---
libs/schemas/src/queries/token.schemas.ts | 9 ++++-----
.../client/scripts/state/api/tokens/fetchTokens.ts | 2 ++
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/libs/schemas/src/queries/token.schemas.ts b/libs/schemas/src/queries/token.schemas.ts
index b053fddb01f..e929ace4b1f 100644
--- a/libs/schemas/src/queries/token.schemas.ts
+++ b/libs/schemas/src/queries/token.schemas.ts
@@ -3,8 +3,11 @@ import { Token } from '../entities';
import { PaginatedResultSchema, PaginationParamsSchema } from './pagination';
export const TokenView = Token.extend({
+ community_id: z.string(),
initial_supply: z.string(),
launchpad_liquidity: z.string(),
+ latest_price: z.string().nullish(),
+ old_price: z.string().nullish(),
});
export const GetTokens = {
@@ -14,10 +17,6 @@ export const GetTokens = {
with_stats: z.boolean().optional(),
}),
output: PaginatedResultSchema.extend({
- results: TokenView.extend({
- community_id: z.string(),
- latest_price: z.string().optional(),
- old_price: z.string().optional(),
- }).array(),
+ results: TokenView.array(),
}),
};
diff --git a/packages/commonwealth/client/scripts/state/api/tokens/fetchTokens.ts b/packages/commonwealth/client/scripts/state/api/tokens/fetchTokens.ts
index c82863aad04..d26f39ed616 100644
--- a/packages/commonwealth/client/scripts/state/api/tokens/fetchTokens.ts
+++ b/packages/commonwealth/client/scripts/state/api/tokens/fetchTokens.ts
@@ -13,6 +13,7 @@ const useFetchTokensQuery = ({
order_by,
order_direction,
search,
+ with_stats = false,
enabled = true,
}: UseFetchTokensProps) => {
return trpc.token.getTokens.useInfiniteQuery(
@@ -21,6 +22,7 @@ const useFetchTokensQuery = ({
order_by,
order_direction,
search,
+ with_stats,
},
{
staleTime: FETCH_TOKENS_STALE_TIME,
From c8e5271d4304a3f8383a69a8fa7daba1242a0120 Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Fri, 15 Nov 2024 21:27:04 +0500
Subject: [PATCH 072/227] Added token to eth exchange rate query
---
.../scripts/state/api/launchPad/index.ts | 9 ++-
.../api/launchPad/tokenEthExchangeRate.ts | 57 +++++++++++++++++++
.../TradeTokenForm/useSellTrade.ts | 43 +++++++++++++-
3 files changed, 107 insertions(+), 2 deletions(-)
create mode 100644 packages/commonwealth/client/scripts/state/api/launchPad/tokenEthExchangeRate.ts
diff --git a/packages/commonwealth/client/scripts/state/api/launchPad/index.ts b/packages/commonwealth/client/scripts/state/api/launchPad/index.ts
index 566cba5330f..a49fe92cbd9 100644
--- a/packages/commonwealth/client/scripts/state/api/launchPad/index.ts
+++ b/packages/commonwealth/client/scripts/state/api/launchPad/index.ts
@@ -1,4 +1,11 @@
import useBuyTokenMutation from './buyToken';
import useLaunchTokenMutation from './launchToken';
+import useSellTokenMutation from './sellToken';
+import useTokenEthExchangeRateQuery from './tokenEthExchangeRate';
-export { useBuyTokenMutation, useLaunchTokenMutation };
+export {
+ useBuyTokenMutation,
+ useLaunchTokenMutation,
+ useSellTokenMutation,
+ useTokenEthExchangeRateQuery,
+};
diff --git a/packages/commonwealth/client/scripts/state/api/launchPad/tokenEthExchangeRate.ts b/packages/commonwealth/client/scripts/state/api/launchPad/tokenEthExchangeRate.ts
new file mode 100644
index 00000000000..bc89a5c3dc5
--- /dev/null
+++ b/packages/commonwealth/client/scripts/state/api/launchPad/tokenEthExchangeRate.ts
@@ -0,0 +1,57 @@
+import { commonProtocol } from '@hicommonwealth/shared';
+import { useQuery } from '@tanstack/react-query';
+import LaunchpadBondingCurve from 'helpers/ContractHelpers/Launchpad';
+
+interface TokenEthExchangeRateProps {
+ chainRpc: string;
+ ethChainId: number;
+ tokenAddress: string;
+ tokenAmount: number;
+ mode: 'sell' | 'buy';
+}
+
+const tokenEthExchangeRate = async ({
+ ethChainId,
+ chainRpc,
+ tokenAddress,
+ tokenAmount,
+ mode,
+}: TokenEthExchangeRateProps) => {
+ const launchPad = new LaunchpadBondingCurve(
+ commonProtocol.factoryContracts[ethChainId].lpBondingCurve,
+ commonProtocol.factoryContracts[ethChainId].launchpad,
+ tokenAddress,
+ commonProtocol.factoryContracts[ethChainId].tokenCommunityManager,
+ chainRpc,
+ );
+
+ return await launchPad.getAmountOut(
+ tokenAmount,
+ mode === 'sell' ? false : true,
+ );
+};
+
+const useTokenEthExchangeRateQuery = ({
+ ethChainId,
+ chainRpc,
+ tokenAddress,
+ tokenAmount,
+ mode,
+ enabled = true,
+}: TokenEthExchangeRateProps & { enabled?: boolean }) => {
+ return useQuery({
+ queryKey: [ethChainId, chainRpc, tokenAddress, tokenAmount, mode],
+ queryFn: () =>
+ tokenEthExchangeRate({
+ ethChainId,
+ chainRpc,
+ tokenAddress,
+ tokenAmount,
+ mode,
+ }),
+ staleTime: 1000, // 1 second
+ enabled,
+ });
+};
+
+export default useTokenEthExchangeRateQuery;
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useSellTrade.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useSellTrade.ts
index c918696663c..30911c6c53a 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useSellTrade.ts
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useSellTrade.ts
@@ -1,10 +1,14 @@
+import {
+ useSellTokenMutation,
+ useTokenEthExchangeRateQuery,
+} from 'client/scripts/state/api/launchPad';
import { notifyError, notifySuccess } from 'controllers/app/notifications';
import { useState } from 'react';
-import useSellTokenMutation from 'state/api/launchPad/sellToken';
import {
useCreateTokenTradeMutation,
useGetERC20BalanceQuery,
} from 'state/api/tokens';
+import { useDebounce } from 'usehooks-ts';
import { UseSellTradeProps } from './types';
const useSellTrade = ({
@@ -18,6 +22,10 @@ const useSellTrade = ({
const [tokenSellAmountString, setTokenSellAmountString] =
useState(`0`); // can be fractional
const tokenSellAmountDecimals = parseFloat(tokenSellAmountString) || 0;
+ const debouncedTokenSellAmountDecimals = useDebounce(
+ tokenSellAmountDecimals,
+ 500,
+ );
const { mutateAsync: createTokenTrade, isLoading: isCreatingTokenTrade } =
useCreateTokenTradeMutation();
@@ -34,6 +42,39 @@ const useSellTrade = ({
userAddress: selectedAddress || '',
});
+ const {
+ data: tokenEthSellExchangeRate = 0,
+ error: tokenEthSellExchangeRateError,
+ isLoading: isLoadingTokenEthSellExchangeRate,
+ } = useTokenEthExchangeRateQuery({
+ chainRpc: chainNode.url,
+ ethChainId: chainNode.ethChainId || 0,
+ mode: 'sell',
+ tokenAmount: debouncedTokenSellAmountDecimals * 1e18, // convert to wei
+ tokenAddress: tradeConfig.token.token_address,
+ enabled: !!(
+ chainNode?.url &&
+ chainNode?.ethChainId &&
+ selectedAddress &&
+ tokenCommunity &&
+ debouncedTokenSellAmountDecimals > 0
+ ),
+ });
+
+ // TODO: remove
+ console.log('exchange rate =>', {
+ payload: {
+ chainRpc: chainNode.url,
+ ethChainId: chainNode.ethChainId || 0,
+ mode: 'sell',
+ tokenAmount: debouncedTokenSellAmountDecimals * 1e18, // convert to wei
+ tokenAddress: tradeConfig.token.token_address,
+ },
+ tokenEthSellExchangeRate,
+ tokenEthSellExchangeRateError,
+ isLoadingTokenEthSellExchangeRate,
+ });
+
const onTokenSellAmountChange = (
change: React.ChangeEvent,
) => {
From 32f7a8c9ddc9e1fa1784a1513da508c194c1c958 Mon Sep 17 00:00:00 2001
From: ianrowan
Date: Fri, 15 Nov 2024 11:11:58 -0600
Subject: [PATCH 073/227] add sell approval
---
.../shared/src/commonProtocol/contractHelpers/Launchpad.ts | 6 +++++-
.../client/scripts/helpers/ContractHelpers/Launchpad.ts | 7 ++++++-
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/libs/shared/src/commonProtocol/contractHelpers/Launchpad.ts b/libs/shared/src/commonProtocol/contractHelpers/Launchpad.ts
index cc4415ff2d3..74b06b28e28 100644
--- a/libs/shared/src/commonProtocol/contractHelpers/Launchpad.ts
+++ b/libs/shared/src/commonProtocol/contractHelpers/Launchpad.ts
@@ -53,9 +53,13 @@ export const sellToken = async (
tokenAddress: string,
amount: number,
walletAddress: string,
+ tokenContract: any,
) => {
+ await tokenContract.methods.approve(tokenAddress, BigInt(amount)).send({
+ from: walletAddress,
+ });
const txReceipt = await contract.methods
- .sellToken(tokenAddress, amount.toFixed(0), 0)
+ .sellToken(tokenAddress, BigInt(amount), 0)
.send({ from: walletAddress });
return txReceipt;
};
diff --git a/packages/commonwealth/client/scripts/helpers/ContractHelpers/Launchpad.ts b/packages/commonwealth/client/scripts/helpers/ContractHelpers/Launchpad.ts
index 47c53f48d0e..6c58a114396 100644
--- a/packages/commonwealth/client/scripts/helpers/ContractHelpers/Launchpad.ts
+++ b/packages/commonwealth/client/scripts/helpers/ContractHelpers/Launchpad.ts
@@ -7,6 +7,7 @@ import {
sellToken,
transferLiquidity,
} from '../../../../../../libs/shared/src/commonProtocol';
+import { Erc20Abi } from './Abi/ERC20Abi';
import { LpBondingCurve } from './Abi/LpBondingCurveAbi';
import ContractBase from './ContractBase';
import { LaunchpadFactory } from './LaunchpadFactoryAbi';
@@ -83,12 +84,16 @@ class LaunchpadBondingCurve extends ContractBase {
if (!this.initialized || !this.walletEnabled) {
await this.initialize(true, chainId);
}
-
+ const tokenContract = new this.web3.eth.Contract(
+ Erc20Abi as AbiItem[],
+ this.tokenAddress,
+ );
const txReceipt = await sellToken(
this.contract,
this.tokenAddress,
amountSell,
walletAddress,
+ tokenContract,
);
return txReceipt;
}
From 4961571d21410b5273e74c5d6f4152a2c436e776 Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Fri, 15 Nov 2024 22:18:33 +0500
Subject: [PATCH 074/227] Display token pricing to eth in sell mode receipts
---
.../contractHelpers/Launchpad.ts | 2 +-
.../helpers/ContractHelpers/Launchpad.ts | 10 ++--
.../api/launchPad/tokenEthExchangeRate.ts | 2 +
.../state/api/tokens/getERC20Balance.ts | 5 +-
.../ReceiptDetails/SellReceipt.tsx | 5 +-
.../TradeTokenModel/TradeTokenForm/types.ts | 1 +
.../TradeTokenForm/useSellTrade.ts | 46 ++++++++-----------
.../TradeTokenForm/useTradeTokenForm.ts | 2 +
8 files changed, 38 insertions(+), 35 deletions(-)
diff --git a/libs/shared/src/commonProtocol/contractHelpers/Launchpad.ts b/libs/shared/src/commonProtocol/contractHelpers/Launchpad.ts
index 74b06b28e28..682e77ffa0a 100644
--- a/libs/shared/src/commonProtocol/contractHelpers/Launchpad.ts
+++ b/libs/shared/src/commonProtocol/contractHelpers/Launchpad.ts
@@ -72,7 +72,7 @@ export const getPrice = async (
isBuy: boolean,
) => {
const price = await contract.methods.getPrice(tokenAddress, amountIn, isBuy);
- return price;
+ return price.call();
};
export const getAmountIn = async (
diff --git a/packages/commonwealth/client/scripts/helpers/ContractHelpers/Launchpad.ts b/packages/commonwealth/client/scripts/helpers/ContractHelpers/Launchpad.ts
index 6c58a114396..85b783141ae 100644
--- a/packages/commonwealth/client/scripts/helpers/ContractHelpers/Launchpad.ts
+++ b/packages/commonwealth/client/scripts/helpers/ContractHelpers/Launchpad.ts
@@ -111,14 +111,18 @@ class LaunchpadBondingCurve extends ContractBase {
return txReceipt;
}
- async getAmountOut(amountIn: number, buy: boolean) {
+ async getAmountOut(amountIn: number, buy: boolean, chainId: string) {
+ if (!this.initialized || !this.walletEnabled) {
+ await this.initialize(true, chainId);
+ }
+
const amountOut = await getPrice(
- this.contractAddress,
+ this.contract,
this.tokenAddress,
amountIn,
buy,
);
- return Number(amountOut / 1e18);
+ return Number(amountOut) / 1e18;
}
}
diff --git a/packages/commonwealth/client/scripts/state/api/launchPad/tokenEthExchangeRate.ts b/packages/commonwealth/client/scripts/state/api/launchPad/tokenEthExchangeRate.ts
index bc89a5c3dc5..edf49e63664 100644
--- a/packages/commonwealth/client/scripts/state/api/launchPad/tokenEthExchangeRate.ts
+++ b/packages/commonwealth/client/scripts/state/api/launchPad/tokenEthExchangeRate.ts
@@ -28,6 +28,7 @@ const tokenEthExchangeRate = async ({
return await launchPad.getAmountOut(
tokenAmount,
mode === 'sell' ? false : true,
+ `${ethChainId}`,
);
};
@@ -50,6 +51,7 @@ const useTokenEthExchangeRateQuery = ({
mode,
}),
staleTime: 1000, // 1 second
+ cacheTime: 1000, // 1 second
enabled,
});
};
diff --git a/packages/commonwealth/client/scripts/state/api/tokens/getERC20Balance.ts b/packages/commonwealth/client/scripts/state/api/tokens/getERC20Balance.ts
index f135e8f47e8..dee62eb6e38 100644
--- a/packages/commonwealth/client/scripts/state/api/tokens/getERC20Balance.ts
+++ b/packages/commonwealth/client/scripts/state/api/tokens/getERC20Balance.ts
@@ -23,11 +23,12 @@ const useGetERC20BalanceQuery = ({
userAddress,
tokenAddress,
nodeRpc,
-}: UseGetERC20BalanceQueryProps) => {
+ enabled = true,
+}: UseGetERC20BalanceQueryProps & { enabled?: boolean }) => {
return useQuery({
queryKey: [userAddress, tokenAddress, nodeRpc],
queryFn: () => getERC20Balance({ userAddress, tokenAddress, nodeRpc }),
- enabled: !!tokenAddress && !!userAddress && !!nodeRpc,
+ enabled: !!tokenAddress && !!userAddress && !!nodeRpc && enabled,
staleTime: GET_ERC20_BALANCE_STALE_TIME,
retry: false,
});
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/ReceiptDetails/SellReceipt.tsx b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/ReceiptDetails/SellReceipt.tsx
index b5916a9a2ec..b3e3e849c4b 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/ReceiptDetails/SellReceipt.tsx
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/ReceiptDetails/SellReceipt.tsx
@@ -12,7 +12,10 @@ const SellReceipt = ({ trading }: ReceiptDetailsProps) => {
{baseTokenSymbol} to ETH rate
- {invest.baseToken.unitEthExchangeRate} {baseTokenSymbol} = 1 ETH
+ {/* if the token value is in 10 ^ -1 or greater it is displayed
+ as such, a fixed string here avoids those secnarios */}
+ {invest.baseToken.unitEthExchangeRate.toFixed(18)} {baseTokenSymbol} =
+ 1 ETH
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts
index 963f6c25fc3..7b461734479 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts
@@ -30,6 +30,7 @@ export type UseTradeTokenFormProps = {
};
export type UseBuyTradeProps = UseTradeTokenFormProps & {
+ enabled: boolean;
chainNode: NodeInfo;
tokenCommunity?: z.infer
;
selectedAddress?: string;
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useSellTrade.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useSellTrade.ts
index 30911c6c53a..aed3e21ad91 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useSellTrade.ts
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useSellTrade.ts
@@ -8,10 +8,10 @@ import {
useCreateTokenTradeMutation,
useGetERC20BalanceQuery,
} from 'state/api/tokens';
-import { useDebounce } from 'usehooks-ts';
import { UseSellTradeProps } from './types';
const useSellTrade = ({
+ enabled,
chainNode,
commonFeePercentage,
selectedAddress,
@@ -22,10 +22,6 @@ const useSellTrade = ({
const [tokenSellAmountString, setTokenSellAmountString] =
useState(`0`); // can be fractional
const tokenSellAmountDecimals = parseFloat(tokenSellAmountString) || 0;
- const debouncedTokenSellAmountDecimals = useDebounce(
- tokenSellAmountDecimals,
- 500,
- );
const { mutateAsync: createTokenTrade, isLoading: isCreatingTokenTrade } =
useCreateTokenTradeMutation();
@@ -40,40 +36,31 @@ const useSellTrade = ({
nodeRpc: tokenCommunity?.ChainNode?.url || '',
tokenAddress: tradeConfig.token.token_address,
userAddress: selectedAddress || '',
+ enabled,
});
const {
- data: tokenEthSellExchangeRate = 0,
- error: tokenEthSellExchangeRateError,
- isLoading: isLoadingTokenEthSellExchangeRate,
+ data: unitTokenToEthSellExchangeRate = 0,
+ isLoading: isLoadingUnitTokenToEthSellExchangeRate,
} = useTokenEthExchangeRateQuery({
chainRpc: chainNode.url,
ethChainId: chainNode.ethChainId || 0,
mode: 'sell',
- tokenAmount: debouncedTokenSellAmountDecimals * 1e18, // convert to wei
+ tokenAmount: 1 * 1e18, // convert to wei - get exchange rate of 1 unit token to eth
tokenAddress: tradeConfig.token.token_address,
enabled: !!(
chainNode?.url &&
chainNode?.ethChainId &&
selectedAddress &&
tokenCommunity &&
- debouncedTokenSellAmountDecimals > 0
+ enabled
),
});
- // TODO: remove
- console.log('exchange rate =>', {
- payload: {
- chainRpc: chainNode.url,
- ethChainId: chainNode.ethChainId || 0,
- mode: 'sell',
- tokenAmount: debouncedTokenSellAmountDecimals * 1e18, // convert to wei
- tokenAddress: tradeConfig.token.token_address,
- },
- tokenEthSellExchangeRate,
- tokenEthSellExchangeRateError,
- isLoadingTokenEthSellExchangeRate,
- });
+ const ethSellAmount =
+ unitTokenToEthSellExchangeRate * tokenSellAmountDecimals;
+ const commonPlatformFeeForSellTradeInEth =
+ (commonFeePercentage / 100) * ethSellAmount;
const onTokenSellAmountChange = (
change: React.ChangeEvent,
@@ -125,7 +112,10 @@ const useSellTrade = ({
// flag to indicate if something is ongoing
const isSellActionPending =
- isLoadingUserTokenBalance || isSellingToken || isCreatingTokenTrade;
+ isLoadingUserTokenBalance ||
+ isSellingToken ||
+ isCreatingTokenTrade ||
+ isLoadingUnitTokenToEthSellExchangeRate;
return {
// Note: not exporting state setters directly, all "sell token" business logic should be done in this hook
@@ -135,18 +125,18 @@ const useSellTrade = ({
baseToken: {
amount: tokenSellAmountString,
onAmountChange: onTokenSellAmountChange,
- unitEthExchangeRate: 100, // TODO: hardcoded for now - blocked token pricing
- toEth: 100, // TODO: hardcoded for now - blocked token pricing
+ unitEthExchangeRate: unitTokenToEthSellExchangeRate,
+ toEth: ethSellAmount,
},
insufficientFunds:
tokenSellAmountDecimals > parseFloat(selectedAddressTokenBalance),
commonPlatformFee: {
percentage: `${commonFeePercentage}%`,
- eth: 100, // TODO: hardcoded for now - blocked token pricing
+ eth: commonPlatformFeeForSellTradeInEth,
},
},
gain: {
- eth: 100, // TODO: hardcoded for now - blocked token pricing
+ eth: ethSellAmount - commonPlatformFeeForSellTradeInEth,
},
},
selectedAddressTokenBalance: {
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts
index 15b99477b29..d225beea826 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts
@@ -67,6 +67,7 @@ const useTradeTokenForm = ({
isBuyActionPending,
selectedAddressEthBalance,
} = useBuyTrade({
+ enabled: tradingMode === TradingMode.Buy,
chainNode: baseNode,
selectedAddress,
commonFeePercentage: COMMON_PLATFORM_FEE_PERCENTAGE,
@@ -81,6 +82,7 @@ const useTradeTokenForm = ({
isSellActionPending,
selectedAddressTokenBalance,
} = useSellTrade({
+ enabled: tradingMode === TradingMode.Sell,
chainNode: baseNode,
selectedAddress,
commonFeePercentage: COMMON_PLATFORM_FEE_PERCENTAGE,
From 41e02b1f38dc25381131a5204ee5ddc859fb1850 Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Fri, 15 Nov 2024 22:29:37 +0500
Subject: [PATCH 075/227] Display bought tokens amount in buy mode
---
.../TradeTokenForm/useBuyTrade.ts | 34 ++++++++++++++++---
.../TradeTokenForm/useSellTrade.ts | 2 +-
2 files changed, 31 insertions(+), 5 deletions(-)
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useBuyTrade.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useBuyTrade.ts
index 9e024fbdf78..b5de2ef19d5 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useBuyTrade.ts
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useBuyTrade.ts
@@ -4,13 +4,17 @@ import {
useFetchTokenUsdRateQuery,
useGetUserEthBalanceQuery,
} from 'state/api/communityStake';
-import { useBuyTokenMutation } from 'state/api/launchPad';
+import {
+ useBuyTokenMutation,
+ useTokenEthExchangeRateQuery,
+} from 'state/api/launchPad';
import { useCreateTokenTradeMutation } from 'state/api/tokens';
import useUserStore from 'state/ui/user';
import useJoinCommunity from 'views/components/SublayoutHeader/useJoinCommunity';
import { UseBuyTradeProps } from './types';
const useBuyTrade = ({
+ enabled,
tradeConfig,
chainNode,
tokenCommunity,
@@ -29,6 +33,7 @@ const useBuyTrade = ({
const { data: ethToCurrencyRateData, isLoading: isLoadingETHToCurrencyRate } =
useFetchTokenUsdRateQuery({
tokenSymbol: 'ETH',
+ enabled,
});
const ethToCurrencyRate = parseFloat(
ethToCurrencyRateData?.data?.data?.amount || '0.00',
@@ -46,7 +51,25 @@ const useBuyTrade = ({
chainRpc: tokenCommunity?.ChainNode?.url || '',
ethChainId: tokenCommunity?.ChainNode?.eth_chain_id || 0,
walletAddress: selectedAddress || '',
- apiEnabled: !!(selectedAddress && tokenCommunity),
+ apiEnabled: !!(selectedAddress && tokenCommunity && enabled),
+ });
+
+ const {
+ data: unitEthToTokenBuyExchangeRate = 0,
+ isLoading: isLoadingUnitEthToTokenBuyExchangeRate,
+ } = useTokenEthExchangeRateQuery({
+ chainRpc: chainNode.url,
+ ethChainId: chainNode.ethChainId || 0,
+ mode: 'buy',
+ tokenAmount: 1 * 1e18, // convert to wei - get exchange rate of 1 unit token to eth
+ tokenAddress: tradeConfig.token.token_address,
+ enabled: !!(
+ chainNode?.url &&
+ chainNode?.ethChainId &&
+ selectedAddress &&
+ tokenCommunity &&
+ enabled
+ ),
});
const { mutateAsync: buyToken, isLoading: isBuyingToken } =
@@ -128,7 +151,8 @@ const useBuyTrade = ({
isLoadingUserEthBalance ||
isBuyingToken ||
isLoadingETHToCurrencyRate ||
- isCreatingTokenTrade;
+ isCreatingTokenTrade ||
+ isLoadingUnitEthToTokenBuyExchangeRate;
return {
// Note: not exporting state setters directly, all "buy token" business logic should be done in this hook
@@ -149,7 +173,9 @@ const useBuyTrade = ({
},
},
gain: {
- token: 100, // TODO: hardcoded for now - blocked token pricing
+ token:
+ unitEthToTokenBuyExchangeRate *
+ (ethBuyAmount - commonPlatformFeeForBuyTradeInEth),
},
},
selectedAddressEthBalance: {
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useSellTrade.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useSellTrade.ts
index aed3e21ad91..f5c9c587235 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useSellTrade.ts
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useSellTrade.ts
@@ -88,7 +88,7 @@ const useSellTrade = ({
const payload = {
chainRpc: chainNode.url,
ethChainId: chainNode.ethChainId,
- amountToken: tokenSellAmountDecimals * 1e18, // amount in wei // TODO: needs fix
+ amountToken: tokenSellAmountDecimals * 1e18, // amount in wei
walletAddress: selectedAddress,
tokenAddress: tradeConfig.token.token_address,
};
From f1ebf1a496f8264a27c8dc14e580ba5d10144898 Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Fri, 15 Nov 2024 22:44:22 +0500
Subject: [PATCH 076/227] Added "max" preset amount when selling tokens
---
.../AmountSelections/BuyAmountSelection.tsx | 2 +-
.../AmountSelections/SellAmountSelection.tsx | 20 ++++++++++++++++++
.../ReceiptDetails/BuyReceipt.tsx | 2 +-
.../ReceiptDetails/SellReceipt.tsx | 2 +-
.../TradeTokenModel/TradeTokenForm/types.ts | 5 ++++-
.../TradeTokenForm/useBuyTrade.ts | 6 ++++--
.../TradeTokenForm/useSellTrade.ts | 21 +++++++++++++------
.../TradeTokenModel/TradeTokenModal.tsx | 1 +
8 files changed, 47 insertions(+), 12 deletions(-)
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AmountSelections/BuyAmountSelection.tsx b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AmountSelections/BuyAmountSelection.tsx
index 7bc7c93a7d8..55c50fd0bce 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AmountSelections/BuyAmountSelection.tsx
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AmountSelections/BuyAmountSelection.tsx
@@ -53,7 +53,7 @@ const BuyAmountSelection = ({ trading }: BuyAmountSelectionProps) => {
key={presetAmount}
type="amount"
label={getAmountWithCurrencySymbol(
- presetAmount,
+ presetAmount as number,
baseCurrencyName,
)}
onClick={() =>
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AmountSelections/SellAmountSelection.tsx b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AmountSelections/SellAmountSelection.tsx
index 2bb46cfa4d8..afd78844103 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AmountSelections/SellAmountSelection.tsx
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AmountSelections/SellAmountSelection.tsx
@@ -1,6 +1,7 @@
import React from 'react';
import { CWIcon } from 'views/components/component_kit/cw_icons/cw_icon';
import { CWText } from 'views/components/component_kit/cw_text';
+import { CWTag } from 'views/components/component_kit/new_designs/CWTag';
import { CWTextInput } from 'views/components/component_kit/new_designs/CWTextInput';
import { SellAmountSelectionProps } from '../types';
import './AmountSelections.scss';
@@ -25,6 +26,25 @@ const SellAmountSelection = ({ trading }: SellAmountSelectionProps) => {
{' '}
{trading.amounts.sell.gain.eth} ETH
+
+ {trading.amounts.sell.invest.baseToken.presetAmounts && (
+
+ {trading.amounts.sell.invest.baseToken.presetAmounts?.map(
+ (presetAmount) => (
+
+ trading.amounts.sell.invest.baseToken.onAmountChange(
+ presetAmount,
+ )
+ }
+ />
+ ),
+ )}
+
+ )}
);
};
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/ReceiptDetails/BuyReceipt.tsx b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/ReceiptDetails/BuyReceipt.tsx
index e012aa9e309..285e9248c8b 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/ReceiptDetails/BuyReceipt.tsx
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/ReceiptDetails/BuyReceipt.tsx
@@ -40,7 +40,7 @@ const BuyReceipt = ({ trading }: ReceiptDetailsProps) => {
- Common's Platform Fee ({invest.commonPlatformFee.percentage})
+ Fee ({invest.commonPlatformFee.percentage})
{invest.commonPlatformFee.eth} ETH
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/ReceiptDetails/SellReceipt.tsx b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/ReceiptDetails/SellReceipt.tsx
index b3e3e849c4b..7c79a7408a0 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/ReceiptDetails/SellReceipt.tsx
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/ReceiptDetails/SellReceipt.tsx
@@ -30,7 +30,7 @@ const SellReceipt = ({ trading }: ReceiptDetailsProps) => {
- Common's Platform Fee ({invest.commonPlatformFee.percentage})
+ Fee ({invest.commonPlatformFee.percentage})
{invest.commonPlatformFee.eth} ETH
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts
index 7b461734479..8037355b727 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts
@@ -20,10 +20,13 @@ export type TradingConfig = {
addressType: ChainBase;
};
+export type TokenPresetAmounts = number | 'Max';
+
export type UseTradeTokenFormProps = {
tradeConfig: TradingConfig & {
currency: SupportedCurrencies;
- buyTokenPresetAmounts?: number[];
+ buyTokenPresetAmounts?: TokenPresetAmounts[];
+ sellTokenPresetAmounts?: TokenPresetAmounts[]; // we could also do 25%, 50% etc
};
addressType?: ChainBase;
onTradeComplete?: () => void;
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useBuyTrade.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useBuyTrade.ts
index b5de2ef19d5..45bf74fe4cb 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useBuyTrade.ts
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useBuyTrade.ts
@@ -11,7 +11,7 @@ import {
import { useCreateTokenTradeMutation } from 'state/api/tokens';
import useUserStore from 'state/ui/user';
import useJoinCommunity from 'views/components/SublayoutHeader/useJoinCommunity';
-import { UseBuyTradeProps } from './types';
+import { TokenPresetAmounts, UseBuyTradeProps } from './types';
const useBuyTrade = ({
enabled,
@@ -79,10 +79,12 @@ const useBuyTrade = ({
useCreateTokenTradeMutation();
const onBaseCurrencyBuyAmountChange = (
- change: React.ChangeEvent | number,
+ change: React.ChangeEvent | TokenPresetAmounts,
) => {
if (typeof change == 'number') {
setBaseCurrencyBuyAmountString(`${change}`);
+ } else if (typeof change == 'string') {
+ // not handling string type preset amounts atm
} else {
const value = change.target.value;
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useSellTrade.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useSellTrade.ts
index f5c9c587235..b3f125e11e4 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useSellTrade.ts
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useSellTrade.ts
@@ -8,7 +8,7 @@ import {
useCreateTokenTradeMutation,
useGetERC20BalanceQuery,
} from 'state/api/tokens';
-import { UseSellTradeProps } from './types';
+import { TokenPresetAmounts, UseSellTradeProps } from './types';
const useSellTrade = ({
enabled,
@@ -63,13 +63,21 @@ const useSellTrade = ({
(commonFeePercentage / 100) * ethSellAmount;
const onTokenSellAmountChange = (
- change: React.ChangeEvent,
+ change: React.ChangeEvent | TokenPresetAmounts,
) => {
- const value = change.target.value;
+ if (typeof change == 'number') {
+ // not handling number type preset amounts atm
+ } else if (typeof change == 'string') {
+ if (change === 'Max') {
+ setTokenSellAmountString(selectedAddressTokenBalance);
+ }
+ } else {
+ const value = change.target.value;
- if (value === '') setTokenSellAmountString(`0`);
- // verify only numbers with decimal (optional) are present
- else if (/^\d*\.?\d*$/.test(value)) setTokenSellAmountString(value);
+ if (value === '') setTokenSellAmountString(`0`);
+ // verify only numbers with decimal (optional) are present
+ else if (/^\d*\.?\d*$/.test(value)) setTokenSellAmountString(value);
+ }
};
const handleTokenSell = async () => {
@@ -125,6 +133,7 @@ const useSellTrade = ({
baseToken: {
amount: tokenSellAmountString,
onAmountChange: onTokenSellAmountChange,
+ presetAmounts: tradeConfig.sellTokenPresetAmounts,
unitEthExchangeRate: unitTokenToEthSellExchangeRate,
toEth: ethSellAmount,
},
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.tsx b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.tsx
index 859f83ed438..8fc4627c467 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.tsx
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.tsx
@@ -33,6 +33,7 @@ const TradeTokenModal = ({
...tradeConfig,
currency: TRADING_CURRENCY,
buyTokenPresetAmounts: [100, 300, 1000],
+ sellTokenPresetAmounts: ['Max'],
},
addressType: tradeConfig.addressType,
onTradeComplete: () => onModalClose?.(),
From 6c86fb5f1a7ab0d7162dcc16c37eed45c0791738 Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Fri, 15 Nov 2024 22:50:30 +0500
Subject: [PATCH 077/227] Added correct loading state
---
.../TradeTokenForm/TradeTokenForm.tsx | 23 +++++++------------
.../TradeTokenForm/useBuyTrade.ts | 11 +++++----
.../TradeTokenForm/useSellTrade.ts | 9 ++++----
3 files changed, 19 insertions(+), 24 deletions(-)
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx
index 9aa70c7b760..b1cfb80e193 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/TradeTokenForm.tsx
@@ -1,7 +1,6 @@
import React, { ReactNode, useState } from 'react';
import { CWText } from 'views/components/component_kit/cw_text';
import { CWButton } from 'views/components/component_kit/new_designs/CWButton';
-import CWCircleMultiplySpinner from 'views/components/component_kit/new_designs/CWCircleMultiplySpinner';
import CWIconButton from 'views/components/component_kit/new_designs/CWIconButton';
import { CWSelectList } from 'views/components/component_kit/new_designs/CWSelectList';
import {
@@ -153,20 +152,14 @@ const TradeTokenForm = ({
Subtotal + fees
- {isReceiptDetailOpen ? (
- isActionPending ? (
-
- ) : (
- <>
- {trading.mode.value === TradingMode.Buy ? (
-
- ) : (
-
- )}
- >
- )
- ) : (
- <>>
+ {isReceiptDetailOpen && (
+ <>
+ {trading.mode.value === TradingMode.Buy ? (
+
+ ) : (
+
+ )}
+ >
)}
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useBuyTrade.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useBuyTrade.ts
index 45bf74fe4cb..bf5287c20d5 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useBuyTrade.ts
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useBuyTrade.ts
@@ -150,11 +150,12 @@ const useBuyTrade = ({
// flag to indicate if something is ongoing
const isBuyActionPending =
- isLoadingUserEthBalance ||
- isBuyingToken ||
- isLoadingETHToCurrencyRate ||
- isCreatingTokenTrade ||
- isLoadingUnitEthToTokenBuyExchangeRate;
+ enabled &&
+ (isLoadingUserEthBalance ||
+ isBuyingToken ||
+ isLoadingETHToCurrencyRate ||
+ isCreatingTokenTrade ||
+ isLoadingUnitEthToTokenBuyExchangeRate);
return {
// Note: not exporting state setters directly, all "buy token" business logic should be done in this hook
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useSellTrade.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useSellTrade.ts
index b3f125e11e4..008a121ab5b 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useSellTrade.ts
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useSellTrade.ts
@@ -120,10 +120,11 @@ const useSellTrade = ({
// flag to indicate if something is ongoing
const isSellActionPending =
- isLoadingUserTokenBalance ||
- isSellingToken ||
- isCreatingTokenTrade ||
- isLoadingUnitTokenToEthSellExchangeRate;
+ enabled &&
+ (isLoadingUserTokenBalance ||
+ isSellingToken ||
+ isCreatingTokenTrade ||
+ isLoadingUnitTokenToEthSellExchangeRate);
return {
// Note: not exporting state setters directly, all "sell token" business logic should be done in this hook
From bae33b18700974bc51cc197c265a44467c9f3611 Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Fri, 15 Nov 2024 22:51:44 +0500
Subject: [PATCH 078/227] Fix lint
---
libs/shared/src/commonProtocol/contractHelpers/Launchpad.ts | 1 +
1 file changed, 1 insertion(+)
diff --git a/libs/shared/src/commonProtocol/contractHelpers/Launchpad.ts b/libs/shared/src/commonProtocol/contractHelpers/Launchpad.ts
index 682e77ffa0a..addeb570488 100644
--- a/libs/shared/src/commonProtocol/contractHelpers/Launchpad.ts
+++ b/libs/shared/src/commonProtocol/contractHelpers/Launchpad.ts
@@ -53,6 +53,7 @@ export const sellToken = async (
tokenAddress: string,
amount: number,
walletAddress: string,
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
tokenContract: any,
) => {
await tokenContract.methods.approve(tokenAddress, BigInt(amount)).send({
From fde82f934b5555859b6bc90fe657f271c52f5ede Mon Sep 17 00:00:00 2001
From: ianrowan
Date: Fri, 15 Nov 2024 12:10:19 -0600
Subject: [PATCH 079/227] update approval address
---
.../src/commonProtocol/contractHelpers/Launchpad.ts | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/libs/shared/src/commonProtocol/contractHelpers/Launchpad.ts b/libs/shared/src/commonProtocol/contractHelpers/Launchpad.ts
index 74b06b28e28..a30a4440088 100644
--- a/libs/shared/src/commonProtocol/contractHelpers/Launchpad.ts
+++ b/libs/shared/src/commonProtocol/contractHelpers/Launchpad.ts
@@ -55,9 +55,11 @@ export const sellToken = async (
walletAddress: string,
tokenContract: any,
) => {
- await tokenContract.methods.approve(tokenAddress, BigInt(amount)).send({
- from: walletAddress,
- });
+ await tokenContract.methods
+ .approve(contract.options.address, BigInt(amount))
+ .send({
+ from: walletAddress,
+ });
const txReceipt = await contract.methods
.sellToken(tokenAddress, BigInt(amount), 0)
.send({ from: walletAddress });
From 85e11bf67c95b9dcfb0041ee38d55e4a6deb0526 Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Fri, 15 Nov 2024 23:15:23 +0500
Subject: [PATCH 080/227] Updated amount representations
---
.../AmountSelections/SellAmountSelection.tsx | 2 +-
.../ReceiptDetails/BuyReceipt.tsx | 26 ++++++++++++++-----
.../ReceiptDetails/SellReceipt.tsx | 18 ++++++-------
3 files changed, 29 insertions(+), 17 deletions(-)
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AmountSelections/SellAmountSelection.tsx b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AmountSelections/SellAmountSelection.tsx
index afd78844103..9b9e5979f0b 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AmountSelections/SellAmountSelection.tsx
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/AmountSelections/SellAmountSelection.tsx
@@ -24,7 +24,7 @@ const SellAmountSelection = ({ trading }: SellAmountSelectionProps) => {
=
{' '}
- {trading.amounts.sell.gain.eth} ETH
+ {trading.amounts.sell.gain.eth.toFixed(18)} ETH
{trading.amounts.sell.invest.baseToken.presetAmounts && (
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/ReceiptDetails/BuyReceipt.tsx b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/ReceiptDetails/BuyReceipt.tsx
index 285e9248c8b..0292230ae28 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/ReceiptDetails/BuyReceipt.tsx
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/ReceiptDetails/BuyReceipt.tsx
@@ -22,7 +22,7 @@ const BuyReceipt = ({ trading }: ReceiptDetailsProps) => {
{baseCurrencyName} to ETH rate
{isLeftSymbolCurrency ? baseCurrencySymbol : ''}{' '}
- {invest.baseCurrency.unitEthExchangeRate}
+ {invest.baseCurrency.unitEthExchangeRate.toFixed(18)}
{isRightSymbolCurrency ? baseCurrencySymbol : ''} = 1 ETH
@@ -36,19 +36,31 @@ const BuyReceipt = ({ trading }: ReceiptDetailsProps) => {
ETH bought from invested amount
- {invest.baseCurrency.toEth} ETH
+
+ {invest.baseCurrency.toEth.toFixed(18)} ETH
+
+
+
+
+ Fee ({invest.commonPlatformFee.percentage}) ETH
+
+
+ {invest.commonPlatformFee.eth.toFixed(18)} ETH
+
+ Remaining ETH
- Fee ({invest.commonPlatformFee.percentage})
+ {(invest.baseCurrency.toEth - invest.commonPlatformFee.eth).toFixed(
+ 18,
+ )}{' '}
+ ETH
- {invest.commonPlatformFee.eth} ETH
- Remaining ETH to tokens
+ Gain {trading.token.symbol} amount
- {invest.baseCurrency.toEth - invest.commonPlatformFee.eth} ETH ={' '}
- {gain.token} {trading.token.symbol}
+ {gain.token.toFixed(18)} {trading.token.symbol}
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/ReceiptDetails/SellReceipt.tsx b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/ReceiptDetails/SellReceipt.tsx
index 7c79a7408a0..5704ef13ad0 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/ReceiptDetails/SellReceipt.tsx
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/ReceiptDetails/SellReceipt.tsx
@@ -12,10 +12,8 @@ const SellReceipt = ({ trading }: ReceiptDetailsProps) => {
{baseTokenSymbol} to ETH rate
- {/* if the token value is in 10 ^ -1 or greater it is displayed
- as such, a fixed string here avoids those secnarios */}
- {invest.baseToken.unitEthExchangeRate.toFixed(18)} {baseTokenSymbol} =
- 1 ETH
+ 1 {baseTokenSymbol} ={' '}
+ {invest.baseToken.unitEthExchangeRate.toFixed(18)} ETH
@@ -25,18 +23,20 @@ const SellReceipt = ({ trading }: ReceiptDetailsProps) => {
- ETH bought from invested amount
- {invest.baseToken.toEth} ETH
+ ETH gained from invested amount
+ {invest.baseToken.toEth.toFixed(18)} ETH
- Fee ({invest.commonPlatformFee.percentage})
+ Fee ({invest.commonPlatformFee.percentage}) ETH
+
+
+ {invest.commonPlatformFee.eth.toFixed(18)} ETH
- {invest.commonPlatformFee.eth} ETH
Gain ETH amount
- {gain.eth} ETH
+ {gain.eth.toFixed(18)} ETH
);
From 9bb5afe4c15e3637670b8d806a2bb8c511f0ca1f Mon Sep 17 00:00:00 2001
From: ianrowan
Date: Fri, 15 Nov 2024 14:32:54 -0600
Subject: [PATCH 081/227] add default buy amount
---
libs/shared/src/commonProtocol/contractHelpers/Launchpad.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libs/shared/src/commonProtocol/contractHelpers/Launchpad.ts b/libs/shared/src/commonProtocol/contractHelpers/Launchpad.ts
index dcc467219b1..ac096fd3375 100644
--- a/libs/shared/src/commonProtocol/contractHelpers/Launchpad.ts
+++ b/libs/shared/src/commonProtocol/contractHelpers/Launchpad.ts
@@ -23,7 +23,7 @@ export const launchToken = async (
tokenCommunityManager,
connectorWeight,
)
- .send({ from: walletAddress, value: 0.00000011e18 });
+ .send({ from: walletAddress, value: 4.167e8 });
return txReceipt;
};
From f94f07531fd828dee355a3f5414f08db504a6b22 Mon Sep 17 00:00:00 2001
From: Timothee Legros
Date: Sat, 16 Nov 2024 16:16:27 +0200
Subject: [PATCH 082/227] fix price calculation for launchpad trades
---
.../policies/chainEventCreated/handleLaunchpadTrade.ts | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/packages/commonwealth/server/workers/commonwealthConsumer/policies/chainEventCreated/handleLaunchpadTrade.ts b/packages/commonwealth/server/workers/commonwealthConsumer/policies/chainEventCreated/handleLaunchpadTrade.ts
index 2a0ffbc6c8f..804c739f533 100644
--- a/packages/commonwealth/server/workers/commonwealthConsumer/policies/chainEventCreated/handleLaunchpadTrade.ts
+++ b/packages/commonwealth/server/workers/commonwealthConsumer/policies/chainEventCreated/handleLaunchpadTrade.ts
@@ -58,8 +58,8 @@ export async function handleLaunchpadTrade(
is_buy: isBuy,
community_token_amount: BigNumber.from(communityTokenAmount).toBigInt(),
price:
- BigNumber.from(communityTokenAmount).toBigInt() /
- BigNumber.from(ethAmount).toBigInt(),
+ BigNumber.from(ethAmount).toBigInt() /
+ BigNumber.from(communityTokenAmount).toBigInt(),
floating_supply: BigNumber.from(floatingSupply).toBigInt(),
timestamp: Number(block.timestamp),
});
From e5c74c75bcd49d43f353ee08b29ea11e87c4072e Mon Sep 17 00:00:00 2001
From: Timothee Legros
Date: Sat, 16 Nov 2024 16:41:10 +0200
Subject: [PATCH 083/227] init evm-protocols
---
libs/evm-protocols/package.json | 27 ++++++++++++++++++++++++++
libs/evm-protocols/tsconfig.build.json | 9 +++++++++
libs/evm-protocols/tsconfig.json | 4 ++++
pnpm-lock.yaml | 6 ++++++
tsconfig.json | 1 +
5 files changed, 47 insertions(+)
create mode 100644 libs/evm-protocols/package.json
create mode 100644 libs/evm-protocols/tsconfig.build.json
create mode 100644 libs/evm-protocols/tsconfig.json
diff --git a/libs/evm-protocols/package.json b/libs/evm-protocols/package.json
new file mode 100644
index 00000000000..3db305605fc
--- /dev/null
+++ b/libs/evm-protocols/package.json
@@ -0,0 +1,27 @@
+{
+ "name": "@hicommonwealth/evm-protocols",
+ "private": "true",
+ "type": "module",
+ "version": "0.1.0",
+ "description": "Web3 domain code",
+ "files": [
+ "build"
+ ],
+ "exports": {
+ ".": {
+ "default": "./build/index.js",
+ "devmode": "./src/index.ts"
+ }
+ },
+ "scripts": {
+ "build": "tsc -b ./tsconfig.build.json",
+ "clean": "rm -rf build && rm -rf coverage && find . -type f -name '*.tsbuildinfo' -exec rm {} +",
+ "check-types": "tsc --noEmit",
+ "test": "NODE_ENV=test vitest --config ../../vite.config.ts --coverage run ./test/**/*.spec.ts",
+ "lint": "NODE_OPTIONS=\"--max-old-space-size=4096\" eslint -c ../../.eslintrc.cjs './src/**/*.{ts,tsx}'",
+ "lint-diff": "NODE_OPTIONS=\"--max-old-space-size=4096\" eslint -c ../../.eslintrc-diff.cjs './src/**/*.{ts,tsx}'"
+ },
+ "dependencies": {
+ "moment": "^2.23.0"
+ }
+}
diff --git a/libs/evm-protocols/tsconfig.build.json b/libs/evm-protocols/tsconfig.build.json
new file mode 100644
index 00000000000..ae1687b715d
--- /dev/null
+++ b/libs/evm-protocols/tsconfig.build.json
@@ -0,0 +1,9 @@
+{
+ "extends": "./tsconfig.json",
+ "compilerOptions": {
+ "rootDir": "src",
+ "outDir": "build"
+ },
+ "include": ["src"],
+ "references": []
+}
diff --git a/libs/evm-protocols/tsconfig.json b/libs/evm-protocols/tsconfig.json
new file mode 100644
index 00000000000..4f4bd883433
--- /dev/null
+++ b/libs/evm-protocols/tsconfig.json
@@ -0,0 +1,4 @@
+{
+ "extends": "../tsconfig.json",
+ "references": []
+}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 1a25a985e55..6215d38a17e 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -511,6 +511,12 @@ importers:
specifier: ^8
version: 8.57.0
+ libs/evm-protocols:
+ dependencies:
+ moment:
+ specifier: ^2.23.0
+ version: 2.30.1
+
libs/evm-testing:
dependencies:
'@hicommonwealth/model':
diff --git a/tsconfig.json b/tsconfig.json
index 94a42fd711c..efbfc510a3f 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -11,6 +11,7 @@
{ "path": "libs/model/tsconfig.build.json" },
{ "path": "libs/schemas/tsconfig.build.json" },
{ "path": "libs/shared/tsconfig.build.json" },
+ { "path": "libs/evm-protocols/tsconfig.build.json" },
{ "path": "packages/commonwealth/tsconfig.build.json" },
{ "path": "packages/load-testing/tsconfig.json" }
]
From ac74220087a8bd44917b1956e3c24cb263d6efe2 Mon Sep 17 00:00:00 2001
From: KaleemNeslit
Date: Mon, 18 Nov 2024 13:14:33 +0500
Subject: [PATCH 084/227] added the background color and reduce gap
---
.../CommunityStake/VoteWeightModule/VoteWeightModule.scss | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/packages/commonwealth/client/scripts/views/components/CommunityStake/VoteWeightModule/VoteWeightModule.scss b/packages/commonwealth/client/scripts/views/components/CommunityStake/VoteWeightModule/VoteWeightModule.scss
index 94b228ccdfc..5a98a1483f8 100644
--- a/packages/commonwealth/client/scripts/views/components/CommunityStake/VoteWeightModule/VoteWeightModule.scss
+++ b/packages/commonwealth/client/scripts/views/components/CommunityStake/VoteWeightModule/VoteWeightModule.scss
@@ -3,11 +3,12 @@
.VoteWeightModule {
padding: 16px 24px;
border-bottom: 1px solid $neutral-200;
+ background-color: $primary-50;
.content {
display: flex;
flex-direction: column;
- gap: 8px;
+ gap: 2px;
.title-container {
display: flex;
From 25a789be5b91e2f55ae3bbceaefcb93316787e3d Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Mon, 18 Nov 2024 18:45:02 +0500
Subject: [PATCH 085/227] Removed extra todo
---
.../modals/TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts | 1 -
1 file changed, 1 deletion(-)
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts
index d225beea826..54a1e161b5e 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts
@@ -122,7 +122,6 @@ const useTradeTokenForm = ({
mode: { value: tradingMode, onChange: onTradingModeChange },
token: tradeConfig.token,
},
- // TODO: add presets for max amounts?
addresses: {
available: userAddresses,
default: selectedAddress,
From bb2963201b1bfe554a14593bfc1268518550f4c7 Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Mon, 18 Nov 2024 18:49:28 +0500
Subject: [PATCH 086/227] moved stale/cache time to const
---
.../scripts/state/api/launchPad/tokenEthExchangeRate.ts | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/packages/commonwealth/client/scripts/state/api/launchPad/tokenEthExchangeRate.ts b/packages/commonwealth/client/scripts/state/api/launchPad/tokenEthExchangeRate.ts
index edf49e63664..e4c4b9347dd 100644
--- a/packages/commonwealth/client/scripts/state/api/launchPad/tokenEthExchangeRate.ts
+++ b/packages/commonwealth/client/scripts/state/api/launchPad/tokenEthExchangeRate.ts
@@ -2,6 +2,8 @@ import { commonProtocol } from '@hicommonwealth/shared';
import { useQuery } from '@tanstack/react-query';
import LaunchpadBondingCurve from 'helpers/ContractHelpers/Launchpad';
+const TOKEN_ETH_EXCHANGE_TIME = 1000; // 1s
+
interface TokenEthExchangeRateProps {
chainRpc: string;
ethChainId: number;
@@ -50,8 +52,8 @@ const useTokenEthExchangeRateQuery = ({
tokenAmount,
mode,
}),
- staleTime: 1000, // 1 second
- cacheTime: 1000, // 1 second
+ staleTime: TOKEN_ETH_EXCHANGE_TIME,
+ cacheTime: TOKEN_ETH_EXCHANGE_TIME,
enabled,
});
};
From 78136547564a00f3db8593aba6ae94521859ac2b Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Mon, 18 Nov 2024 18:54:09 +0500
Subject: [PATCH 087/227] fixed modal padding
---
.../scripts/views/modals/TradeTokenModel/TradeTokenModal.scss | 1 +
1 file changed, 1 insertion(+)
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.scss b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.scss
index 23c1b3bceb5..5eecf5b3918 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.scss
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.scss
@@ -2,6 +2,7 @@
.TradeTokenModal {
overflow-y: scroll;
+ padding-left: 8px;
.token-info {
display: flex;
From be7c82e87414d79ac40a78456c655db45e9458da Mon Sep 17 00:00:00 2001
From: KaleemNeslit
Date: Mon, 18 Nov 2024 18:55:10 +0500
Subject: [PATCH 088/227] added the query to get thread count
---
libs/model/src/thread/GetThreads.query.ts | 25 ++++++++++++++++++-
libs/schemas/src/queries/thread.schemas.ts | 1 +
.../scripts/state/api/threads/fetchThreads.ts | 8 ++++--
.../pages/discussions/DiscussionsPage.tsx | 4 +--
4 files changed, 33 insertions(+), 5 deletions(-)
diff --git a/libs/model/src/thread/GetThreads.query.ts b/libs/model/src/thread/GetThreads.query.ts
index fd126e815df..5e675002355 100644
--- a/libs/model/src/thread/GetThreads.query.ts
+++ b/libs/model/src/thread/GetThreads.query.ts
@@ -243,6 +243,27 @@ export function GetThreads(): Query {
type: QueryTypes.SELECT,
},
);
+ const baseWhereClause = `
+ community_id = :community_id AND
+ deleted_at IS NULL AND
+ archived_at IS ${archived ? 'NOT' : ''} NULL
+ ${topic_id ? ' AND topic_id = :topic_id' : ''}
+ ${stage ? ' AND stage = :stage' : ''}
+ ${from_date ? ' AND T.created_at > :from_date' : ''}
+ ${to_date ? ' AND T.created_at < :to_date' : ''}
+ ${contestAddress ? ' AND id IN (SELECT * FROM "contest_ids")' : ''}
+ `;
+ const countThreadsQuery = models.sequelize.query<{ count: number }>(
+ `
+ SELECT COUNT(*) AS count
+ FROM "Threads" T
+ WHERE ${baseWhereClause}
+ `,
+ {
+ replacements,
+ type: QueryTypes.SELECT,
+ },
+ );
const numVotingThreadsQuery = models.Thread.count({
where: {
@@ -251,9 +272,10 @@ export function GetThreads(): Query {
},
});
- const [threads, numVotingThreads] = await Promise.all([
+ const [threads, numVotingThreads, countResult] = await Promise.all([
responseThreadsQuery,
numVotingThreadsQuery,
+ countThreadsQuery,
]);
return {
@@ -261,6 +283,7 @@ export function GetThreads(): Query {
page: replacements.page,
threads,
numVotingThreads,
+ threadCount: Number(countResult[0]?.count) || 0,
};
},
};
diff --git a/libs/schemas/src/queries/thread.schemas.ts b/libs/schemas/src/queries/thread.schemas.ts
index b9a442603ab..e6c3b69e427 100644
--- a/libs/schemas/src/queries/thread.schemas.ts
+++ b/libs/schemas/src/queries/thread.schemas.ts
@@ -224,6 +224,7 @@ export const GetThreads = {
limit: z.number(),
numVotingThreads: z.number(),
threads: z.array(ThreadView),
+ threadCount: z.number().optional(),
}),
};
diff --git a/packages/commonwealth/client/scripts/state/api/threads/fetchThreads.ts b/packages/commonwealth/client/scripts/state/api/threads/fetchThreads.ts
index 6f7b1f2a516..a809dbdc915 100644
--- a/packages/commonwealth/client/scripts/state/api/threads/fetchThreads.ts
+++ b/packages/commonwealth/client/scripts/state/api/threads/fetchThreads.ts
@@ -136,6 +136,7 @@ const fetchBulkThreads = (props) => {
limit: number;
page: number;
threads: Thread[];
+ threadCount: number;
};
pageParam: number | undefined;
}> => {
@@ -165,11 +166,11 @@ const fetchBulkThreads = (props) => {
}),
},
});
-
// transform the response
const transformedData = {
...res.data.result,
threads: res.data.result.threads.map((c) => new Thread(c)),
+ threadCount: res.data.result.threadCount,
};
return {
@@ -233,10 +234,13 @@ const useFetchThreadsQuery = (
{ threads: [] },
);
- return {
+ const newData = {
...chosenQueryType,
data: reducedData.threads,
+ threadCount: chosenQueryType?.data?.pages[0].data.threadCount,
};
+ console.log({ newData });
+ return newData;
}
if (isFetchActiveThreadsProps(props)) return chosenQueryType;
diff --git a/packages/commonwealth/client/scripts/views/pages/discussions/DiscussionsPage.tsx b/packages/commonwealth/client/scripts/views/pages/discussions/DiscussionsPage.tsx
index 22217596749..9630c8793f4 100644
--- a/packages/commonwealth/client/scripts/views/pages/discussions/DiscussionsPage.tsx
+++ b/packages/commonwealth/client/scripts/views/pages/discussions/DiscussionsPage.tsx
@@ -134,7 +134,7 @@ const DiscussionsPage = ({ topicName }: DiscussionsPageProps) => {
nodeEthChainId: app?.chain.meta?.ChainNode?.eth_chain_id || 0,
});
- const { fetchNextPage, data, isInitialLoading, hasNextPage } =
+ const { fetchNextPage, data, isInitialLoading, hasNextPage, threadCount } =
useFetchThreadsQuery({
communityId: communityId,
queryType: 'bulk',
@@ -283,7 +283,7 @@ const DiscussionsPage = ({ topicName }: DiscussionsPageProps) => {
isOnArchivePage
? filteredThreads.length || 0
: threads
- ? community?.lifetime_thread_count || 0
+ ? threadCount || 0
: 0
}
isIncludingSpamThreads={includeSpamThreads}
From cd5c64b07039fd4b9d61e26b0d7fa44228b706cf Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Mon, 18 Nov 2024 19:08:48 +0500
Subject: [PATCH 089/227] fix tokens list refetch
---
.../commonwealth/client/scripts/state/api/tokens/createToken.ts | 1 +
1 file changed, 1 insertion(+)
diff --git a/packages/commonwealth/client/scripts/state/api/tokens/createToken.ts b/packages/commonwealth/client/scripts/state/api/tokens/createToken.ts
index 01f133afad6..6059457ff78 100644
--- a/packages/commonwealth/client/scripts/state/api/tokens/createToken.ts
+++ b/packages/commonwealth/client/scripts/state/api/tokens/createToken.ts
@@ -10,6 +10,7 @@ const useCreateTokenMutation = () => {
user.setData({ addressSelectorSelectedAddress: undefined });
await utils.token.getTokens.invalidate();
+ await utils.token.getTokens.refetch();
},
});
};
From 9d21e7e7adaab6f0aacba1bb91f26b62b25ab26f Mon Sep 17 00:00:00 2001
From: KaleemNeslit
Date: Mon, 18 Nov 2024 19:13:53 +0500
Subject: [PATCH 090/227] fix eslint
---
.../client/scripts/state/api/threads/fetchThreads.ts | 5 ++---
.../scripts/views/pages/discussions/DiscussionsPage.tsx | 7 -------
2 files changed, 2 insertions(+), 10 deletions(-)
diff --git a/packages/commonwealth/client/scripts/state/api/threads/fetchThreads.ts b/packages/commonwealth/client/scripts/state/api/threads/fetchThreads.ts
index a809dbdc915..4adda7bf0a3 100644
--- a/packages/commonwealth/client/scripts/state/api/threads/fetchThreads.ts
+++ b/packages/commonwealth/client/scripts/state/api/threads/fetchThreads.ts
@@ -234,13 +234,12 @@ const useFetchThreadsQuery = (
{ threads: [] },
);
- const newData = {
+ const formattedData = {
...chosenQueryType,
data: reducedData.threads,
threadCount: chosenQueryType?.data?.pages[0].data.threadCount,
};
- console.log({ newData });
- return newData;
+ return formattedData;
}
if (isFetchActiveThreadsProps(props)) return chosenQueryType;
diff --git a/packages/commonwealth/client/scripts/views/pages/discussions/DiscussionsPage.tsx b/packages/commonwealth/client/scripts/views/pages/discussions/DiscussionsPage.tsx
index 9630c8793f4..0e1365cbbbb 100644
--- a/packages/commonwealth/client/scripts/views/pages/discussions/DiscussionsPage.tsx
+++ b/packages/commonwealth/client/scripts/views/pages/discussions/DiscussionsPage.tsx
@@ -25,7 +25,6 @@ import useBrowserWindow from 'hooks/useBrowserWindow';
import useManageDocumentTitle from 'hooks/useManageDocumentTitle';
import useTopicGating from 'hooks/useTopicGating';
import 'pages/discussions/index.scss';
-import { useGetCommunityByIdQuery } from 'state/api/communities';
import { useFetchCustomDomainQuery } from 'state/api/configuration';
import { useGetERC20BalanceQuery } from 'state/api/tokens';
import Permissions from 'utils/Permissions';
@@ -75,12 +74,6 @@ const DiscussionsPage = ({ topicName }: DiscussionsPageProps) => {
'dateRange',
) as ThreadTimelineFilterTypes;
- const { data: community } = useGetCommunityByIdQuery({
- id: communityId,
- enabled: !!communityId,
- includeNodeInfo: true,
- });
-
const { data: topics, isLoading: isLoadingTopics } = useFetchTopicsQuery({
communityId,
apiEnabled: !!communityId,
From 6b8473f93d4ef8e52186656cefbc920584de67f3 Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Mon, 18 Nov 2024 19:36:46 +0500
Subject: [PATCH 091/227] Update selected address balances after processing
buy/sell trade
---
.../api/launchPad/tokenEthExchangeRate.ts | 2 +-
.../TradeTokenForm/useBuyTrade.ts | 38 ++++++++++++----
.../TradeTokenForm/useSellTrade.ts | 44 ++++++++++++++-----
3 files changed, 64 insertions(+), 20 deletions(-)
diff --git a/packages/commonwealth/client/scripts/state/api/launchPad/tokenEthExchangeRate.ts b/packages/commonwealth/client/scripts/state/api/launchPad/tokenEthExchangeRate.ts
index e4c4b9347dd..38975bb7b39 100644
--- a/packages/commonwealth/client/scripts/state/api/launchPad/tokenEthExchangeRate.ts
+++ b/packages/commonwealth/client/scripts/state/api/launchPad/tokenEthExchangeRate.ts
@@ -2,7 +2,7 @@ import { commonProtocol } from '@hicommonwealth/shared';
import { useQuery } from '@tanstack/react-query';
import LaunchpadBondingCurve from 'helpers/ContractHelpers/Launchpad';
-const TOKEN_ETH_EXCHANGE_TIME = 1000; // 1s
+const TOKEN_ETH_EXCHANGE_TIME = 30 * 1000; // 30s
interface TokenEthExchangeRateProps {
chainRpc: string;
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useBuyTrade.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useBuyTrade.ts
index bf5287c20d5..8cbc5245e29 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useBuyTrade.ts
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useBuyTrade.ts
@@ -1,4 +1,5 @@
import { notifyError, notifySuccess } from 'controllers/app/notifications';
+import useRunOnceOnCondition from 'hooks/useRunOnceOnCondition';
import { useState } from 'react';
import {
useFetchTokenUsdRateQuery,
@@ -44,32 +45,53 @@ const useBuyTrade = ({
// imp: this query uses CommunityStakes helper to get eth price, but its
// a generic query so no need to initiate a separate Launchpad helper
+ const isSelectedAddressEthBalanceQueryEnabled = !!(
+ selectedAddress &&
+ tokenCommunity &&
+ enabled
+ );
const {
data: selectedAddressEthBalance = `0.0`,
isLoading: isLoadingUserEthBalance,
+ refetch: refetchEthBalance,
} = useGetUserEthBalanceQuery({
chainRpc: tokenCommunity?.ChainNode?.url || '',
ethChainId: tokenCommunity?.ChainNode?.eth_chain_id || 0,
walletAddress: selectedAddress || '',
- apiEnabled: !!(selectedAddress && tokenCommunity && enabled),
+ apiEnabled: isSelectedAddressEthBalanceQueryEnabled,
});
+ const isUnitEthToTokenBuyExchangeRateQueryEnabled = !!(
+ chainNode?.url &&
+ chainNode?.ethChainId &&
+ selectedAddress &&
+ tokenCommunity &&
+ enabled
+ );
const {
data: unitEthToTokenBuyExchangeRate = 0,
isLoading: isLoadingUnitEthToTokenBuyExchangeRate,
+ refetch: refetchEthToTokenExchangeRate,
} = useTokenEthExchangeRateQuery({
chainRpc: chainNode.url,
ethChainId: chainNode.ethChainId || 0,
mode: 'buy',
tokenAmount: 1 * 1e18, // convert to wei - get exchange rate of 1 unit token to eth
tokenAddress: tradeConfig.token.token_address,
- enabled: !!(
- chainNode?.url &&
- chainNode?.ethChainId &&
- selectedAddress &&
- tokenCommunity &&
- enabled
- ),
+ enabled: isUnitEthToTokenBuyExchangeRateQueryEnabled,
+ });
+
+ useRunOnceOnCondition({
+ callback: () => {
+ // fetch fresh rates if there are any stale values
+ refetchEthBalance().catch(console.error);
+ refetchEthToTokenExchangeRate().catch(console.error);
+ },
+ shouldRun:
+ isSelectedAddressEthBalanceQueryEnabled &&
+ !!refetchEthBalance &&
+ isUnitEthToTokenBuyExchangeRateQueryEnabled &&
+ !!refetchEthToTokenExchangeRate,
});
const { mutateAsync: buyToken, isLoading: isBuyingToken } =
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useSellTrade.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useSellTrade.ts
index 008a121ab5b..6e4117afcf1 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useSellTrade.ts
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useSellTrade.ts
@@ -1,9 +1,10 @@
+import { notifyError, notifySuccess } from 'controllers/app/notifications';
+import useRunOnceOnCondition from 'hooks/useRunOnceOnCondition';
+import { useState } from 'react';
import {
useSellTokenMutation,
useTokenEthExchangeRateQuery,
-} from 'client/scripts/state/api/launchPad';
-import { notifyError, notifySuccess } from 'controllers/app/notifications';
-import { useState } from 'react';
+} from 'state/api/launchPad';
import {
useCreateTokenTradeMutation,
useGetERC20BalanceQuery,
@@ -29,32 +30,53 @@ const useSellTrade = ({
const { mutateAsync: sellToken, isLoading: isSellingToken } =
useSellTokenMutation();
+ const isSelectedAddressTokenBalanceQueryEnabled = !!(
+ selectedAddress &&
+ tokenCommunity &&
+ enabled
+ );
const {
data: selectedAddressTokenBalance = `0.0`,
isLoading: isLoadingUserTokenBalance,
+ refetch: refetchTokenBalance,
} = useGetERC20BalanceQuery({
nodeRpc: tokenCommunity?.ChainNode?.url || '',
tokenAddress: tradeConfig.token.token_address,
userAddress: selectedAddress || '',
- enabled,
+ enabled: isSelectedAddressTokenBalanceQueryEnabled,
});
+ const isUnitTokenToEthSellExchangeRateQueryEnabled = !!(
+ chainNode?.url &&
+ chainNode?.ethChainId &&
+ selectedAddress &&
+ tokenCommunity &&
+ enabled
+ );
const {
data: unitTokenToEthSellExchangeRate = 0,
isLoading: isLoadingUnitTokenToEthSellExchangeRate,
+ refetch: refetchTokenToEthExchangeRate,
} = useTokenEthExchangeRateQuery({
chainRpc: chainNode.url,
ethChainId: chainNode.ethChainId || 0,
mode: 'sell',
tokenAmount: 1 * 1e18, // convert to wei - get exchange rate of 1 unit token to eth
tokenAddress: tradeConfig.token.token_address,
- enabled: !!(
- chainNode?.url &&
- chainNode?.ethChainId &&
- selectedAddress &&
- tokenCommunity &&
- enabled
- ),
+ enabled: isUnitTokenToEthSellExchangeRateQueryEnabled,
+ });
+
+ useRunOnceOnCondition({
+ callback: () => {
+ // fetch fresh rates if there are any stale values
+ refetchTokenBalance().catch(console.error);
+ refetchTokenToEthExchangeRate().catch(console.error);
+ },
+ shouldRun:
+ isSelectedAddressTokenBalanceQueryEnabled &&
+ !!refetchTokenBalance &&
+ isUnitTokenToEthSellExchangeRateQueryEnabled &&
+ !!refetchTokenToEthExchangeRate,
});
const ethSellAmount =
From b2d1d8396a3f55d55d95934f3f36bead1fedcdeb Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Mon, 18 Nov 2024 19:45:23 +0500
Subject: [PATCH 092/227] remove leading 0's from amount input in non-decimal
values
---
.../modals/TradeTokenModel/TradeTokenForm/useBuyTrade.ts | 6 +++++-
.../modals/TradeTokenModel/TradeTokenForm/useSellTrade.ts | 6 +++++-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useBuyTrade.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useBuyTrade.ts
index 8cbc5245e29..f1ca5913734 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useBuyTrade.ts
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useBuyTrade.ts
@@ -112,7 +112,11 @@ const useBuyTrade = ({
if (value === '') setBaseCurrencyBuyAmountString('0');
// verify only numbers with decimal (optional) are present
- else if (/^\d*\.?\d*$/.test(value)) setBaseCurrencyBuyAmountString(value);
+ else if (/^\d*\.?\d*$/.test(value)) {
+ setBaseCurrencyBuyAmountString(
+ value.includes('.') ? value : value.replace(/^0+(?!$)/, ''), // remove leading 0's from non-decimal values
+ );
+ }
}
};
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useSellTrade.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useSellTrade.ts
index 6e4117afcf1..5ad08cd3d8e 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useSellTrade.ts
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useSellTrade.ts
@@ -98,7 +98,11 @@ const useSellTrade = ({
if (value === '') setTokenSellAmountString(`0`);
// verify only numbers with decimal (optional) are present
- else if (/^\d*\.?\d*$/.test(value)) setTokenSellAmountString(value);
+ else if (/^\d*\.?\d*$/.test(value)) {
+ setTokenSellAmountString(
+ value.includes('.') ? value : value.replace(/^0+(?!$)/, ''), // remove leading 0's from non-decimal values,
+ );
+ }
}
};
From d5f3ce72f4c238ff69c7938ed63089ad3168a1f4 Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Mon, 18 Nov 2024 20:17:31 +0500
Subject: [PATCH 093/227] Updated pricing calculations
---
.../Communities/TokensList/TokensList.tsx | 108 ++++++++++++------
1 file changed, 72 insertions(+), 36 deletions(-)
diff --git a/packages/commonwealth/client/scripts/views/pages/Communities/TokensList/TokensList.tsx b/packages/commonwealth/client/scripts/views/pages/Communities/TokensList/TokensList.tsx
index 9e6dcb38711..4d2c06d064a 100644
--- a/packages/commonwealth/client/scripts/views/pages/Communities/TokensList/TokensList.tsx
+++ b/packages/commonwealth/client/scripts/views/pages/Communities/TokensList/TokensList.tsx
@@ -3,8 +3,10 @@ import { ChainBase } from '@hicommonwealth/shared';
import clsx from 'clsx';
import { useFlag } from 'hooks/useFlag';
import { navigateToCommunity, useCommonNavigate } from 'navigation/helpers';
+import numeral from 'numeral';
import React, { useState } from 'react';
import { Link } from 'react-router-dom';
+import { useFetchTokenUsdRateQuery } from 'state/api/communityStake';
import { useFetchTokensQuery } from 'state/api/tokens';
import { CWText } from 'views/components/component_kit/cw_text';
import { CWButton } from 'views/components/component_kit/new_designs/CWButton';
@@ -40,22 +42,49 @@ const TokensList = () => {
} = useFetchTokensQuery({
cursor: 1,
limit: 8,
+ with_stats: true,
enabled: tokenizedCommunityEnabled,
});
const tokens = (tokensList?.pages || []).flatMap((page) => page.results);
+ const { data: ethToCurrencyRateData, isLoading: isLoadingETHToCurrencyRate } =
+ useFetchTokenUsdRateQuery({
+ tokenSymbol: 'ETH',
+ });
+ const ethToUsdRate = parseFloat(
+ ethToCurrencyRateData?.data?.data?.amount || '0',
+ );
+
const handleFetchMoreTokens = () => {
if (hasNextPage && !isFetchingNextPage) {
fetchNextPage().catch(console.error);
}
};
+ const calculateTokenPricing = (token: z.infer) => {
+ const currentPrice = token.latest_price || '0';
+ const pricePercentage24HourChange = 1.15;
+ const marketCapCurrent = 300;
+ const marketCapGoal = numeral(
+ parseFloat((token.eth_market_cap_target * ethToUsdRate).toFixed(2)),
+ ).format('0.0a');
+ const isMarketCapGoalReached = false;
+
+ return {
+ currentPrice,
+ pricePercentage24HourChange,
+ marketCapCurrent,
+ marketCapGoal,
+ isMarketCapGoalReached,
+ };
+ };
+
if (!tokenizedCommunityEnabled) return <>>;
return (
Tokens
- {isInitialLoading ? (
+ {isInitialLoading || isLoadingETHToCurrencyRate ? (
) : tokens.length === 0 ? (
{
) : (
- {(tokens || []).map((token) => (
-
- setTokenLaunchModalConfig({
- isOpen: true,
- tradeConfig: {
- mode: TradingMode.Buy,
- token: token as z.infer,
- addressType: ChainBase.Ethereum,
- },
- })
- }
- onCardBodyClick={() =>
- navigateToCommunity({
- navigate,
- path: '',
- chain: token.community_id,
- })
- }
- />
- ))}
+ {(tokens || []).map((token) => {
+ const pricing = calculateTokenPricing(
+ token as z.infer,
+ );
+
+ return (
+ {
+ if (pricing.isMarketCapGoalReached) return;
+
+ setTokenLaunchModalConfig({
+ isOpen: true,
+ tradeConfig: {
+ mode: TradingMode.Buy,
+ token: token as z.infer,
+ addressType: ChainBase.Ethereum,
+ },
+ });
+ }}
+ onCardBodyClick={() =>
+ navigateToCommunity({
+ navigate,
+ path: '',
+ chain: token.community_id,
+ })
+ }
+ />
+ );
+ })}
)}
{isFetchingNextPage ? (
From cb93b7bb3a05b961f3f40339db831fc4f0564f83 Mon Sep 17 00:00:00 2001
From: Timothee Legros
Date: Mon, 18 Nov 2024 17:18:06 +0200
Subject: [PATCH 094/227] fix
---
libs/model/src/token/CreateLaunchpadTrade.command.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libs/model/src/token/CreateLaunchpadTrade.command.ts b/libs/model/src/token/CreateLaunchpadTrade.command.ts
index a855225935b..29d37724761 100644
--- a/libs/model/src/token/CreateLaunchpadTrade.command.ts
+++ b/libs/model/src/token/CreateLaunchpadTrade.command.ts
@@ -66,7 +66,7 @@ export function CreateLaunchpadTrade(): Command<
is_buy: result.parsedArgs.isBuy,
community_token_amount: result.parsedArgs.communityTokenAmount,
price:
- result.parsedArgs.communityTokenAmount / result.parsedArgs.ethAmount,
+ result.parsedArgs.ethAmount / result.parsedArgs.communityTokenAmount,
floating_supply: result.parsedArgs.floatingSupply,
timestamp: Number(result.block.timestamp),
});
From 9d03339da9e56ef501d72eb5c8a96b4d28202cc5 Mon Sep 17 00:00:00 2001
From: KaleemNeslit
Date: Mon, 18 Nov 2024 20:22:09 +0500
Subject: [PATCH 095/227] update the growl design for mobile
---
.../GrowlTemplate/CWGrowlTemplate.scss | 6 ++++++
.../GrowlTemplate/CWGrowlTemplate.tsx | 21 +++++++++++++++----
.../components/component_kit/cw_growl.tsx | 2 +-
.../components/component_kit/cw_growl.scss | 11 ++++++++--
4 files changed, 33 insertions(+), 7 deletions(-)
diff --git a/packages/commonwealth/client/scripts/views/components/SublayoutHeader/GrowlTemplate/CWGrowlTemplate.scss b/packages/commonwealth/client/scripts/views/components/SublayoutHeader/GrowlTemplate/CWGrowlTemplate.scss
index 7a304ab7f4a..cae7aef0471 100644
--- a/packages/commonwealth/client/scripts/views/components/SublayoutHeader/GrowlTemplate/CWGrowlTemplate.scss
+++ b/packages/commonwealth/client/scripts/views/components/SublayoutHeader/GrowlTemplate/CWGrowlTemplate.scss
@@ -53,6 +53,12 @@
gap: 1rem;
cursor: default;
+ @include smallInclusive {
+ max-width: 20rem;
+ padding: 0.5rem;
+ gap: 0.3rem;
+ }
+
.subtitle-text {
margin-top: -12px;
}
diff --git a/packages/commonwealth/client/scripts/views/components/SublayoutHeader/GrowlTemplate/CWGrowlTemplate.tsx b/packages/commonwealth/client/scripts/views/components/SublayoutHeader/GrowlTemplate/CWGrowlTemplate.tsx
index 5d297ad2a9b..c5a427ca3d9 100644
--- a/packages/commonwealth/client/scripts/views/components/SublayoutHeader/GrowlTemplate/CWGrowlTemplate.tsx
+++ b/packages/commonwealth/client/scripts/views/components/SublayoutHeader/GrowlTemplate/CWGrowlTemplate.tsx
@@ -1,3 +1,4 @@
+import useBrowserWindow from 'client/scripts/hooks/useBrowserWindow';
import React, { useState } from 'react';
import useGrowlStore from 'state/ui/growl';
import { CWCheckbox } from 'views/components/component_kit/cw_checkbox';
@@ -32,7 +33,7 @@ export const CWGrowlTemplate = ({
growlType,
}: CWGrowlTemplateProps) => {
const { setIsGrowlHidden, isGrowlHidden } = useGrowlStore();
-
+ const { isWindowSmallInclusive } = useBrowserWindow({});
const [shouldHideGrowlPermanently, setShouldHideGrowlPermanently] =
useState(false);
@@ -55,7 +56,10 @@ export const CWGrowlTemplate = ({
};
return (
-
+
{growlImage &&
}
-
+
{headerText}
-
+
{bodyText}
{buttonLink && (
diff --git a/packages/commonwealth/client/scripts/views/components/component_kit/cw_growl.tsx b/packages/commonwealth/client/scripts/views/components/component_kit/cw_growl.tsx
index 49e71bf1d6f..b11b98b786c 100644
--- a/packages/commonwealth/client/scripts/views/components/component_kit/cw_growl.tsx
+++ b/packages/commonwealth/client/scripts/views/components/component_kit/cw_growl.tsx
@@ -6,7 +6,7 @@ import { CWCard } from './cw_card';
import { getClasses } from './helpers';
import { ComponentType } from './types';
-type GrowlPosition = 'bottom-left' | 'bottom-right';
+type GrowlPosition = 'bottom-left' | 'bottom-right' | 'center';
type GrowlAttrs = {
className?: string;
diff --git a/packages/commonwealth/client/styles/components/component_kit/cw_growl.scss b/packages/commonwealth/client/styles/components/component_kit/cw_growl.scss
index 6f652aabcce..abecbd7c889 100644
--- a/packages/commonwealth/client/styles/components/component_kit/cw_growl.scss
+++ b/packages/commonwealth/client/styles/components/component_kit/cw_growl.scss
@@ -8,9 +8,9 @@ $growl-outside-right-padding: 32px; // accounts for scrollbar width
bottom: $growl-outside-bottom-padding;
display: flex;
position: fixed;
-
+ max-width: 400px;
@include smallInclusive {
- max-width: 400px;
+ max-width: 320px;
max-height: 100%;
}
@@ -21,6 +21,13 @@ $growl-outside-right-padding: 32px; // accounts for scrollbar width
&.bottom-right {
right: $growl-outside-right-padding;
}
+ &.center {
+ top: 50%;
+ left: 48%;
+ transform: translate(-50%, -50%);
+ bottom: auto;
+ right: auto;
+ }
.growl-card.Card {
padding: 0;
From b228489ac422cd67faea4c91d28a6cbce1321349 Mon Sep 17 00:00:00 2001
From: Timothee Legros
Date: Mon, 18 Nov 2024 17:34:29 +0200
Subject: [PATCH 096/227] add https:// to url
---
libs/shared/src/utils.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libs/shared/src/utils.ts b/libs/shared/src/utils.ts
index 4dd62ef140b..e077a7e3f35 100644
--- a/libs/shared/src/utils.ts
+++ b/libs/shared/src/utils.ts
@@ -98,7 +98,7 @@ export function formatBucketUrlToAssetCDN(uploadLocation: string) {
['production', 'beta'].includes(process.env.APP_ENV)
) {
const fileName = uploadLocation.split('/').pop() || '';
- return `${S3_ASSET_BUCKET_CDN}/${fileName}`;
+ return `https://${S3_ASSET_BUCKET_CDN}/${fileName}`;
}
return uploadLocation;
}
From d87b44607e7ffe3e92b9aa83702f240c786005a6 Mon Sep 17 00:00:00 2001
From: Marcin
Date: Mon, 18 Nov 2024 17:00:22 +0100
Subject: [PATCH 097/227] Show warning message
---
.../CommunitySection/CommunitySection.tsx | 2 +-
.../ContestsList/ContestCard/ContestCard.tsx | 22 +++++++++++++++++++
.../Contests/ContestsList/ContestsList.tsx | 4 +++-
3 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/packages/commonwealth/client/scripts/views/components/sidebar/CommunitySection/CommunitySection.tsx b/packages/commonwealth/client/scripts/views/components/sidebar/CommunitySection/CommunitySection.tsx
index 2626b946203..7af6c1f3ba0 100644
--- a/packages/commonwealth/client/scripts/views/components/sidebar/CommunitySection/CommunitySection.tsx
+++ b/packages/commonwealth/client/scripts/views/components/sidebar/CommunitySection/CommunitySection.tsx
@@ -103,7 +103,7 @@ export const CommunitySection = ({ showSkeleton }: CommunitySectionProps) => {
topicIdsIncludedInContest={topicIdsIncludedInContest}
/>
diff --git a/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Contests/ContestsList/ContestCard/ContestCard.tsx b/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Contests/ContestsList/ContestCard/ContestCard.tsx
index a01af7f2a5e..0eaf1b26835 100644
--- a/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Contests/ContestsList/ContestCard/ContestCard.tsx
+++ b/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Contests/ContestsList/ContestCard/ContestCard.tsx
@@ -33,6 +33,13 @@ const noFundsProps = {
iconName: 'coins' as IconName,
};
+const noUpvotesWarningProps = {
+ title: 'Upvote contests to avoid return of funds',
+ description:
+ "The prize amount will be returned to Common and then to admin's wallet if there are no upvotes",
+ iconName: 'warning' as IconName,
+};
+
interface ContestCardProps {
address: string;
name: string;
@@ -50,6 +57,7 @@ interface ContestCardProps {
isHorizontal?: boolean;
isFarcaster?: boolean;
payoutStructure?: number[];
+ hasVotes?: boolean;
}
const ContestCard = ({
@@ -69,6 +77,7 @@ const ContestCard = ({
isHorizontal = false,
isFarcaster = false,
payoutStructure,
+ hasVotes = false,
}: ContestCardProps) => {
const navigate = useCommonNavigate();
const user = useUserStore();
@@ -152,6 +161,16 @@ const ContestCard = ({
const showNoFundsInfo = isActive && (contestBalance || 0) <= 0;
+ const isLessThan24HoursLeft =
+ moment(finishDate).diff(moment(), 'hours') <= 24;
+
+ const showNoUpvotesWarning =
+ isActive &&
+ isAdmin &&
+ isLessThan24HoursLeft &&
+ (contestBalance || 0) > 0 &&
+ !hasVotes;
+
return (
) : (
<>
+ {showNoUpvotesWarning && (
+
+ )}
Current Prizes
diff --git a/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Contests/ContestsList/ContestsList.tsx b/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Contests/ContestsList/ContestsList.tsx
index dd1b9b0fa4b..c53be5b7a06 100644
--- a/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Contests/ContestsList/ContestsList.tsx
+++ b/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Contests/ContestsList/ContestsList.tsx
@@ -84,7 +84,7 @@ const ContestsList = ({
if (!displayAllRecurringContests) {
// only last contest is relevant
- const { end_time } =
+ const { end_time, score } =
sortedContests[sortedContests.length - 1] || {};
return (
@@ -108,6 +108,7 @@ const ContestsList = ({
isFarcaster={
farcasterContestEnabled && contest.is_farcaster_contest
}
+ hasVotes={(score || []).length > 0}
/>
);
} else {
@@ -134,6 +135,7 @@ const ContestsList = ({
isFarcaster={
farcasterContestEnabled && contest.is_farcaster_contest
}
+ hasVotes={(sc?.score || [])?.length > 0}
/>
));
}
From a1b4ff49718a0f4fbedd8b96be49a3e282a3548a Mon Sep 17 00:00:00 2001
From: israellund
Date: Mon, 18 Nov 2024 11:37:35 -0500
Subject: [PATCH 098/227] removed contests GTM growl
---
.../assets/img/contestsGTMGrowlImage.svg | 228 ------------------
.../client/scripts/views/Sublayout.tsx | 12 -
2 files changed, 240 deletions(-)
delete mode 100644 packages/commonwealth/client/assets/img/contestsGTMGrowlImage.svg
diff --git a/packages/commonwealth/client/assets/img/contestsGTMGrowlImage.svg b/packages/commonwealth/client/assets/img/contestsGTMGrowlImage.svg
deleted file mode 100644
index 93d649246a2..00000000000
--- a/packages/commonwealth/client/assets/img/contestsGTMGrowlImage.svg
+++ /dev/null
@@ -1,228 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/packages/commonwealth/client/scripts/views/Sublayout.tsx b/packages/commonwealth/client/scripts/views/Sublayout.tsx
index 9efad615127..6de7c482e56 100644
--- a/packages/commonwealth/client/scripts/views/Sublayout.tsx
+++ b/packages/commonwealth/client/scripts/views/Sublayout.tsx
@@ -8,7 +8,6 @@ import app from 'state';
import useSidebarStore from 'state/ui/sidebar';
import { SublayoutHeader } from 'views/components/SublayoutHeader';
import { Sidebar } from 'views/components/sidebar';
-import contestsGTMGrowlImage from '../../assets/img/contestsGTMGrowlImage.svg';
import useNecessaryEffect from '../hooks/useNecessaryEffect';
import useStickyHeader from '../hooks/useStickyHeader';
import { useAuthModalStore, useWelcomeOnboardModal } from '../state/ui/modals';
@@ -18,7 +17,6 @@ import { AdminOnboardingSlider } from './components/AdminOnboardingSlider';
import { Breadcrumbs } from './components/Breadcrumbs';
import MobileNavigation from './components/MobileNavigation';
import AuthButtons from './components/SublayoutHeader/AuthButtons';
-import { CWGrowlTemplate } from './components/SublayoutHeader/GrowlTemplate/CWGrowlTemplate';
import { UserTrainingSlider } from './components/UserTrainingSlider';
import CollapsableSidebarButton from './components/sidebar/CollapsableSidebarButton';
import { AuthModal, AuthModalType } from './modals/AuthModal';
@@ -175,16 +173,6 @@ const Sublayout = ({ children, isInsideCommunity }: SublayoutProps) => {
)}
{children}
-
Date: Mon, 18 Nov 2024 17:45:28 +0100
Subject: [PATCH 099/227] added additional condition to the warning message
---
.../ContestsList/ContestCard/ContestCard.tsx | 52 ++++++++++++-------
.../Contests/ContestsList/ContestsList.tsx | 4 +-
2 files changed, 36 insertions(+), 20 deletions(-)
diff --git a/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Contests/ContestsList/ContestCard/ContestCard.tsx b/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Contests/ContestsList/ContestCard/ContestCard.tsx
index 0eaf1b26835..e692fa8996b 100644
--- a/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Contests/ContestsList/ContestCard/ContestCard.tsx
+++ b/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Contests/ContestsList/ContestCard/ContestCard.tsx
@@ -33,13 +33,6 @@ const noFundsProps = {
iconName: 'coins' as IconName,
};
-const noUpvotesWarningProps = {
- title: 'Upvote contests to avoid return of funds',
- description:
- "The prize amount will be returned to Common and then to admin's wallet if there are no upvotes",
- iconName: 'warning' as IconName,
-};
-
interface ContestCardProps {
address: string;
name: string;
@@ -57,7 +50,13 @@ interface ContestCardProps {
isHorizontal?: boolean;
isFarcaster?: boolean;
payoutStructure?: number[];
- hasVotes?: boolean;
+ score?: {
+ creator_address?: string;
+ content_id?: string;
+ votes?: number;
+ prize?: string;
+ tickerPrize?: number;
+ }[];
}
const ContestCard = ({
@@ -77,7 +76,7 @@ const ContestCard = ({
isHorizontal = false,
isFarcaster = false,
payoutStructure,
- hasVotes = false,
+ score = [],
}: ContestCardProps) => {
const navigate = useCommonNavigate();
const user = useUserStore();
@@ -95,12 +94,13 @@ const ContestCard = ({
const { isWindowMediumSmallInclusive } = useBrowserWindow({});
- const { data: contestBalance } = useGetContestBalanceQuery({
- contestAddress: address,
- chainRpc: app.chain.meta?.ChainNode?.url || '',
- ethChainId: app.chain.meta?.ChainNode?.eth_chain_id || 0,
- isOneOff: !isRecurring,
- });
+ const { data: contestBalance, isLoading: isLoadingContestBalance } =
+ useGetContestBalanceQuery({
+ contestAddress: address,
+ chainRpc: app.chain.meta?.ChainNode?.url || '',
+ ethChainId: app.chain.meta?.ChainNode?.eth_chain_id || 0,
+ isOneOff: !isRecurring,
+ });
const prizes =
contestBalance && payoutStructure
@@ -159,17 +159,21 @@ const ContestCard = ({
copyFarcasterContestFrameUrl(address).catch(console.log);
};
- const showNoFundsInfo = isActive && (contestBalance || 0) <= 0;
+ const showNoFundsInfo =
+ isActive && !isLoadingContestBalance && (contestBalance || 0) <= 0;
const isLessThan24HoursLeft =
moment(finishDate).diff(moment(), 'hours') <= 24;
+ const hasVotes = score.length > 0;
+ const hasLessVotesThanPrizes = (payoutStructure || []).length > score.length;
+
const showNoUpvotesWarning =
isActive &&
isAdmin &&
isLessThan24HoursLeft &&
(contestBalance || 0) > 0 &&
- !hasVotes;
+ (!hasVotes || hasLessVotesThanPrizes);
return (
{showNoUpvotesWarning && (
-
+
)}
Current Prizes
diff --git a/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Contests/ContestsList/ContestsList.tsx b/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Contests/ContestsList/ContestsList.tsx
index c53be5b7a06..a393517b1ba 100644
--- a/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Contests/ContestsList/ContestsList.tsx
+++ b/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Contests/ContestsList/ContestsList.tsx
@@ -108,7 +108,7 @@ const ContestsList = ({
isFarcaster={
farcasterContestEnabled && contest.is_farcaster_contest
}
- hasVotes={(score || []).length > 0}
+ score={score || []}
/>
);
} else {
@@ -135,7 +135,7 @@ const ContestsList = ({
isFarcaster={
farcasterContestEnabled && contest.is_farcaster_contest
}
- hasVotes={(sc?.score || [])?.length > 0}
+ score={sc?.score || []}
/>
));
}
From 9d8901f1256498a8ef2d3f2155e4d816ff1a36bd Mon Sep 17 00:00:00 2001
From: Ryan Bennett
Date: Mon, 18 Nov 2024 08:55:53 -0800
Subject: [PATCH 100/227] type ifx
---
libs/schemas/src/commands/contest.schemas.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libs/schemas/src/commands/contest.schemas.ts b/libs/schemas/src/commands/contest.schemas.ts
index 75c6ffb6c9d..de1b5c54212 100644
--- a/libs/schemas/src/commands/contest.schemas.ts
+++ b/libs/schemas/src/commands/contest.schemas.ts
@@ -127,7 +127,7 @@ export const FarcasterCast = z.object({
replies: z.object({
count: z.number(),
}),
- channel: z.string().nullable(),
+ channel: z.any().nullable(),
mentioned_profiles: z.array(z.unknown()),
event_timestamp: z.string(),
});
From cf691697bba6595fdae7e521de755ab0432f305b Mon Sep 17 00:00:00 2001
From: Timothee Legros
Date: Mon, 18 Nov 2024 20:22:31 +0200
Subject: [PATCH 101/227] fix price in eth calculation
---
libs/model/src/models/launchpad_trade.ts | 2 +-
.../src/token/CreateLaunchpadTrade.command.ts | 8 +++++++-
libs/schemas/src/commands/token.schemas.ts | 1 -
libs/schemas/src/entities/launchpad.schemas.ts | 2 +-
libs/schemas/src/queries/token.schemas.ts | 7 +++----
.../20241114130329-add-trade-indexes.js | 18 ++++++++++++++++++
.../chainEventCreated/handleLaunchpadTrade.ts | 6 ++++--
7 files changed, 34 insertions(+), 10 deletions(-)
diff --git a/libs/model/src/models/launchpad_trade.ts b/libs/model/src/models/launchpad_trade.ts
index c1a73a02b1c..99592104593 100644
--- a/libs/model/src/models/launchpad_trade.ts
+++ b/libs/model/src/models/launchpad_trade.ts
@@ -41,7 +41,7 @@ export default (sequelize: Sequelize.Sequelize): LaunchpadTradeModelStatic =>
allowNull: false,
},
price: {
- type: Sequelize.DECIMAL(78, 0),
+ type: Sequelize.FLOAT,
allowNull: false,
},
floating_supply: {
diff --git a/libs/model/src/token/CreateLaunchpadTrade.command.ts b/libs/model/src/token/CreateLaunchpadTrade.command.ts
index 29d37724761..e38fe5d3407 100644
--- a/libs/model/src/token/CreateLaunchpadTrade.command.ts
+++ b/libs/model/src/token/CreateLaunchpadTrade.command.ts
@@ -58,6 +58,9 @@ export function CreateLaunchpadTrade(): Command<
throw new InvalidState('Transaction not found');
}
+ console.log(
+ `Eth amount: ${result.parsedArgs.ethAmount}, communityTokenAmount: ${result.parsedArgs.communityTokenAmount} --- ${result.parsedArgs.ethAmount / result.parsedArgs.communityTokenAmount}`,
+ );
const trade = await models.LaunchpadTrade.create({
eth_chain_id,
transaction_hash,
@@ -66,7 +69,10 @@ export function CreateLaunchpadTrade(): Command<
is_buy: result.parsedArgs.isBuy,
community_token_amount: result.parsedArgs.communityTokenAmount,
price:
- result.parsedArgs.ethAmount / result.parsedArgs.communityTokenAmount,
+ Number(
+ (result.parsedArgs.ethAmount * BigInt(1e18)) /
+ result.parsedArgs.communityTokenAmount,
+ ) / 1e18,
floating_supply: result.parsedArgs.floatingSupply,
timestamp: Number(result.block.timestamp),
});
diff --git a/libs/schemas/src/commands/token.schemas.ts b/libs/schemas/src/commands/token.schemas.ts
index 26e565f315f..a7b109c2533 100644
--- a/libs/schemas/src/commands/token.schemas.ts
+++ b/libs/schemas/src/commands/token.schemas.ts
@@ -17,7 +17,6 @@ export const CreateToken = {
export const LaunchpadTradeView = LaunchpadTrade.extend({
community_token_amount: z.string(),
- price: z.string(),
floating_supply: z.string(),
});
diff --git a/libs/schemas/src/entities/launchpad.schemas.ts b/libs/schemas/src/entities/launchpad.schemas.ts
index bf0a8f1d413..2469254378f 100644
--- a/libs/schemas/src/entities/launchpad.schemas.ts
+++ b/libs/schemas/src/entities/launchpad.schemas.ts
@@ -8,7 +8,7 @@ export const LaunchpadTrade = z.object({
trader_address: EVM_ADDRESS,
is_buy: z.boolean(),
community_token_amount: PG_ETH,
- price: PG_ETH,
+ price: z.number().describe('The amount in ETH per token'),
floating_supply: PG_ETH,
timestamp: PG_INT,
});
diff --git a/libs/schemas/src/queries/token.schemas.ts b/libs/schemas/src/queries/token.schemas.ts
index e929ace4b1f..56072f8f12f 100644
--- a/libs/schemas/src/queries/token.schemas.ts
+++ b/libs/schemas/src/queries/token.schemas.ts
@@ -3,11 +3,10 @@ import { Token } from '../entities';
import { PaginatedResultSchema, PaginationParamsSchema } from './pagination';
export const TokenView = Token.extend({
- community_id: z.string(),
initial_supply: z.string(),
launchpad_liquidity: z.string(),
- latest_price: z.string().nullish(),
- old_price: z.string().nullish(),
+ latest_price: z.number().nullish(),
+ old_price: z.number().nullish(),
});
export const GetTokens = {
@@ -17,6 +16,6 @@ export const GetTokens = {
with_stats: z.boolean().optional(),
}),
output: PaginatedResultSchema.extend({
- results: TokenView.array(),
+ results: TokenView.extend({ community_id: z.string() }).array(),
}),
};
diff --git a/packages/commonwealth/server/migrations/20241114130329-add-trade-indexes.js b/packages/commonwealth/server/migrations/20241114130329-add-trade-indexes.js
index a2ded902ae4..9272e343f07 100644
--- a/packages/commonwealth/server/migrations/20241114130329-add-trade-indexes.js
+++ b/packages/commonwealth/server/migrations/20241114130329-add-trade-indexes.js
@@ -4,6 +4,15 @@
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.sequelize.transaction(async (transaction) => {
+ await queryInterface.changeColumn(
+ 'LaunchpadTrades',
+ 'price',
+ {
+ type: Sequelize.FLOAT,
+ allowNull: false,
+ },
+ { transaction },
+ );
await queryInterface.removeIndex(
'LaunchpadTrades',
'launchpad_trades_token_address',
@@ -21,6 +30,15 @@ module.exports = {
async down(queryInterface, Sequelize) {
await queryInterface.sequelize.transaction(async (transaction) => {
+ await queryInterface.changeColumn(
+ 'LaunchpadTrades',
+ 'price',
+ {
+ type: Sequelize.NUMERIC(78, 0),
+ allowNull: false,
+ },
+ { transaction },
+ );
await queryInterface.addIndex('LaunchpadTrades', ['token_address'], {
transaction,
});
diff --git a/packages/commonwealth/server/workers/commonwealthConsumer/policies/chainEventCreated/handleLaunchpadTrade.ts b/packages/commonwealth/server/workers/commonwealthConsumer/policies/chainEventCreated/handleLaunchpadTrade.ts
index 804c739f533..7ef92a75076 100644
--- a/packages/commonwealth/server/workers/commonwealthConsumer/policies/chainEventCreated/handleLaunchpadTrade.ts
+++ b/packages/commonwealth/server/workers/commonwealthConsumer/policies/chainEventCreated/handleLaunchpadTrade.ts
@@ -58,8 +58,10 @@ export async function handleLaunchpadTrade(
is_buy: isBuy,
community_token_amount: BigNumber.from(communityTokenAmount).toBigInt(),
price:
- BigNumber.from(ethAmount).toBigInt() /
- BigNumber.from(communityTokenAmount).toBigInt(),
+ Number(
+ (BigNumber.from(ethAmount).toBigInt() * BigInt(1e18)) /
+ BigNumber.from(communityTokenAmount).toBigInt(),
+ ) / 1e18,
floating_supply: BigNumber.from(floatingSupply).toBigInt(),
timestamp: Number(block.timestamp),
});
From 2c7c0781d8178cd605dce63081e49effc9c4db8d Mon Sep 17 00:00:00 2001
From: rotorsoft
Date: Mon, 18 Nov 2024 14:14:19 -0500
Subject: [PATCH 102/227] first pass
---
libs/core/src/integration/events.schemas.ts | 1 +
libs/core/src/integration/events.ts | 4 ++
.../src/community/CreateCommunity.command.ts | 18 +++++-
libs/model/src/models/associations.ts | 10 +++
libs/model/src/models/factories.ts | 2 +
libs/model/src/models/referral.ts | 40 ++++++++++++
libs/model/src/models/utils.ts | 2 +-
.../src/user/UserReferrals.projection.ts | 34 ++++++++++
.../test/referral/referral-lifecycle.spec.ts | 63 +++++++++++++++++++
.../schemas/src/commands/community.schemas.ts | 1 +
libs/schemas/src/entities/index.ts | 1 +
libs/schemas/src/entities/referral.schemas.ts | 15 +++++
.../20241118121000-create-referral-model.js | 35 +++++++++++
13 files changed, 224 insertions(+), 2 deletions(-)
create mode 100644 libs/model/src/models/referral.ts
create mode 100644 libs/model/src/user/UserReferrals.projection.ts
create mode 100644 libs/model/test/referral/referral-lifecycle.spec.ts
create mode 100644 libs/schemas/src/entities/referral.schemas.ts
create mode 100644 packages/commonwealth/server/migrations/20241118121000-create-referral-model.js
diff --git a/libs/core/src/integration/events.schemas.ts b/libs/core/src/integration/events.schemas.ts
index 060574d48a6..0267466738d 100644
--- a/libs/core/src/integration/events.schemas.ts
+++ b/libs/core/src/integration/events.schemas.ts
@@ -57,6 +57,7 @@ export const UserMentioned = z.object({
export const CommunityCreated = z.object({
communityId: z.string(),
userId: z.string(),
+ referralLink: z.string().optional(),
});
export const SnapshotProposalCreated = z.object({
id: z.string().optional(),
diff --git a/libs/core/src/integration/events.ts b/libs/core/src/integration/events.ts
index 5fd7a4fbbdb..b546c221884 100644
--- a/libs/core/src/integration/events.ts
+++ b/libs/core/src/integration/events.ts
@@ -41,6 +41,10 @@ export enum EventNames {
}
export type EventPairs =
+ | {
+ event_name: EventNames.CommunityCreated;
+ event_payload: z.infer;
+ }
| {
event_name: EventNames.CommentCreated;
event_payload: z.infer;
diff --git a/libs/model/src/community/CreateCommunity.command.ts b/libs/model/src/community/CreateCommunity.command.ts
index 660a7d13892..c8a632ea9e5 100644
--- a/libs/model/src/community/CreateCommunity.command.ts
+++ b/libs/model/src/community/CreateCommunity.command.ts
@@ -1,4 +1,4 @@
-import { InvalidInput, type Command } from '@hicommonwealth/core';
+import { EventNames, InvalidInput, type Command } from '@hicommonwealth/core';
import * as schemas from '@hicommonwealth/schemas';
import {
ChainBase,
@@ -10,6 +10,7 @@ import {
import { Op } from 'sequelize';
import { models } from '../database';
import { mustBeSuperAdmin, mustExist } from '../middleware/guards';
+import { emitEvent } from '../utils';
import { findCompatibleAddress } from '../utils/findBaseAddress';
export const CreateCommunityErrors = {
@@ -167,6 +168,21 @@ export function CreateCommunity(): Command {
},
{ transaction },
);
+
+ await emitEvent(
+ models.Outbox,
+ [
+ {
+ event_name: EventNames.CommunityCreated,
+ event_payload: {
+ communityId: id,
+ userId: actor.user.id!.toString(),
+ referralLink: payload.referral_link,
+ },
+ },
+ ],
+ transaction,
+ );
});
// == end of command transaction boundary ==
diff --git a/libs/model/src/models/associations.ts b/libs/model/src/models/associations.ts
index a1b597a91ae..a276ccca31a 100644
--- a/libs/model/src/models/associations.ts
+++ b/libs/model/src/models/associations.ts
@@ -20,6 +20,16 @@ export const buildAssociations = (db: DB) => {
foreignKey: 'user_id',
onUpdate: 'CASCADE',
onDelete: 'CASCADE',
+ })
+ .withMany(db.Referral, {
+ foreignKey: 'referrer_id',
+ onUpdate: 'CASCADE',
+ onDelete: 'CASCADE',
+ })
+ .withMany(db.Referral, {
+ foreignKey: 'referee_id',
+ onUpdate: 'CASCADE',
+ onDelete: 'CASCADE',
});
db.Quest.withMany(db.QuestActionMeta, {
diff --git a/libs/model/src/models/factories.ts b/libs/model/src/models/factories.ts
index 23640a7ed19..88f07d1ad67 100644
--- a/libs/model/src/models/factories.ts
+++ b/libs/model/src/models/factories.ts
@@ -29,6 +29,7 @@ import Poll from './poll';
import ProfileTags from './profile_tags';
import { Quest, QuestAction, QuestActionMeta } from './quest';
import Reaction from './reaction';
+import { Referral } from './referral';
import SsoToken from './sso_token';
import StakeTransaction from './stake_transaction';
import StarredCommunity from './starred_community';
@@ -76,6 +77,7 @@ export const Factories = {
QuestAction,
QuestActionMeta,
Reaction,
+ Referral,
SsoToken,
StakeTransaction,
StarredCommunity,
diff --git a/libs/model/src/models/referral.ts b/libs/model/src/models/referral.ts
new file mode 100644
index 00000000000..d8bdf2fd962
--- /dev/null
+++ b/libs/model/src/models/referral.ts
@@ -0,0 +1,40 @@
+import * as schemas from '@hicommonwealth/schemas';
+import Sequelize from 'sequelize';
+import { z } from 'zod';
+import type { ModelInstance } from './types';
+
+export type ReferralAttributes = z.infer;
+export type ReferralInstance = ModelInstance;
+
+export const Referral = (
+ sequelize: Sequelize.Sequelize,
+): Sequelize.ModelStatic =>
+ sequelize.define(
+ 'Referral',
+ {
+ referrer_id: {
+ type: Sequelize.INTEGER,
+ allowNull: false,
+ primaryKey: true,
+ },
+ referee_id: {
+ type: Sequelize.INTEGER,
+ allowNull: false,
+ primaryKey: true,
+ },
+ event_name: {
+ type: Sequelize.STRING,
+ allowNull: false,
+ primaryKey: true,
+ },
+ event_payload: { type: Sequelize.JSONB, allowNull: false },
+ created_at: { type: Sequelize.DATE, allowNull: true, primaryKey: true },
+ },
+ {
+ timestamps: true,
+ createdAt: 'created_at',
+ updatedAt: false,
+ underscored: true,
+ tableName: 'Referrals',
+ },
+ );
diff --git a/libs/model/src/models/utils.ts b/libs/model/src/models/utils.ts
index ed37f5fddb6..855fedcc9df 100644
--- a/libs/model/src/models/utils.ts
+++ b/libs/model/src/models/utils.ts
@@ -226,9 +226,9 @@ export function mapFk(
},
rules?: RuleOptions,
) {
- const name = `${source.tableName}_${target.tableName.toLowerCase()}_fkey`;
const pk = primaryKey.map((k) => target.getAttributes()[k].field!);
const fk = foreignKey.map((k) => source.getAttributes()[k].field!);
+ const name = `${source.tableName}_${target.tableName.toLowerCase()}_${fk}_fkey`;
// console.log(
// 'mapFk:',
// `${name}(${fk.join(', ')}) -> ${target.tableName}(${pk.join(', ')})`,
diff --git a/libs/model/src/user/UserReferrals.projection.ts b/libs/model/src/user/UserReferrals.projection.ts
new file mode 100644
index 00000000000..f835a4ea121
--- /dev/null
+++ b/libs/model/src/user/UserReferrals.projection.ts
@@ -0,0 +1,34 @@
+import { Projection, events, logger } from '@hicommonwealth/core';
+import { models } from '../database';
+
+const log = logger(import.meta);
+
+const inputs = {
+ CommunityCreated: events.CommunityCreated,
+};
+
+export function UserReferrals(): Projection {
+ return {
+ inputs,
+ body: {
+ CommunityCreated: async ({ payload }) => {
+ const referral_link = payload.referralLink;
+ if (referral_link?.startsWith('ref_')) {
+ try {
+ const referrer_id = parseInt(referral_link.split('_').at(1)!);
+ models.Referral.create({
+ referrer_id,
+ referee_id: parseInt(payload.userId),
+ event_name: 'CommunityCreated',
+ event_payload: payload,
+ created_at: new Date(),
+ });
+ } catch (e) {
+ // TODO: should we do something else when we fail to create a referral?
+ e instanceof Error && log.error(e.message, e);
+ }
+ }
+ },
+ },
+ };
+}
diff --git a/libs/model/test/referral/referral-lifecycle.spec.ts b/libs/model/test/referral/referral-lifecycle.spec.ts
new file mode 100644
index 00000000000..12279f1b90d
--- /dev/null
+++ b/libs/model/test/referral/referral-lifecycle.spec.ts
@@ -0,0 +1,63 @@
+import { Actor, command, dispose } from '@hicommonwealth/core';
+import { models } from '@hicommonwealth/model';
+import { ChainNode } from '@hicommonwealth/schemas';
+import { ChainBase, ChainType } from '@hicommonwealth/shared';
+import { afterAll, beforeAll, describe, expect, it } from 'vitest';
+import { z } from 'zod';
+import { CreateCommunity } from '../../src/community';
+import { CreateReferralLink } from '../../src/user';
+import { seedCommunity } from '../utils/community-seeder';
+
+describe('Referral lifecycle', () => {
+ let admin: Actor;
+ let member: Actor;
+ let node: z.infer;
+
+ beforeAll(async () => {
+ const { node: _node, actors } = await seedCommunity({
+ roles: ['admin', 'member'],
+ });
+ admin = actors.admin;
+ member = actors.member;
+ node = _node!;
+ });
+
+ afterAll(async () => {
+ await dispose()();
+ });
+
+ it('should create a referral', async () => {
+ // admin creates a referral link
+ const referral_link = await command(CreateReferralLink(), {
+ actor: admin,
+ payload: {},
+ });
+
+ // member creates a community using the referral link
+ const id = 'test-community-with-referral-link';
+ await command(CreateCommunity(), {
+ actor: member,
+ payload: {
+ chain_node_id: node.id!,
+ id,
+ name: id,
+ type: ChainType.Chain,
+ base: ChainBase.Ethereum,
+ default_symbol: 'TEST',
+ social_links: [],
+ directory_page_enabled: false,
+ tags: [],
+ referral_link,
+ },
+ });
+
+ // drain the outbox
+
+ // get referrals
+ const referrals = await models.Referral.findAll({
+ where: { referee_id: member.user.id },
+ order: [['created_at', 'DESC']],
+ });
+ expect(referrals.length).toBe(1);
+ });
+});
diff --git a/libs/schemas/src/commands/community.schemas.ts b/libs/schemas/src/commands/community.schemas.ts
index 6fededbe76c..e77ac11ab64 100644
--- a/libs/schemas/src/commands/community.schemas.ts
+++ b/libs/schemas/src/commands/community.schemas.ts
@@ -47,6 +47,7 @@ export const CreateCommunity = {
// hidden optional params
token_name: z.string().optional(),
+ referral_link: z.string().optional(),
// deprecated params to be removed
default_symbol: z.string().max(9),
diff --git a/libs/schemas/src/entities/index.ts b/libs/schemas/src/entities/index.ts
index 6ed8ac43d6c..51cbc60f2b6 100644
--- a/libs/schemas/src/entities/index.ts
+++ b/libs/schemas/src/entities/index.ts
@@ -9,6 +9,7 @@ export * from './launchpad.schemas';
export * from './notification.schemas';
export * from './quest.schemas';
export * from './reaction.schemas';
+export * from './referral.schemas';
export * from './snapshot.schemas';
export * from './stake.schemas';
export * from './tag.schemas';
diff --git a/libs/schemas/src/entities/referral.schemas.ts b/libs/schemas/src/entities/referral.schemas.ts
new file mode 100644
index 00000000000..f14496ffa74
--- /dev/null
+++ b/libs/schemas/src/entities/referral.schemas.ts
@@ -0,0 +1,15 @@
+import z from 'zod';
+import { PG_INT } from '../utils';
+
+export const REFERRAL_EVENTS = ['CommunityCreated'] as const;
+
+export const Referral = z
+ .object({
+ referrer_id: PG_INT.describe('The user who referred'),
+ referee_id: PG_INT.describe('The user who was referred'),
+ event_name: z.enum(REFERRAL_EVENTS).describe('The name of the event'),
+ event_payload: z.any().describe('The payload of the event'),
+ created_at: z.coerce.date().optional(),
+ // TODO: add other metrics
+ })
+ .describe('Projects referral events');
diff --git a/packages/commonwealth/server/migrations/20241118121000-create-referral-model.js b/packages/commonwealth/server/migrations/20241118121000-create-referral-model.js
new file mode 100644
index 00000000000..a41b51819cc
--- /dev/null
+++ b/packages/commonwealth/server/migrations/20241118121000-create-referral-model.js
@@ -0,0 +1,35 @@
+'use strict';
+
+/** @type {import('sequelize-cli').Migration} */
+module.exports = {
+ up: async (queryInterface) => {
+ await queryInterface.sequelize.transaction(async (transaction) => {
+ await queryInterface.sequelize.query(
+ `
+ CREATE TABLE "Referrals" (
+ "referrer_id" INTEGER NOT NULL,
+ "referee_id" INTEGER NOT NULL,
+ "event_name" VARCHAR(255) NOT NULL,
+ "event_payload" JSONB NOT NULL,
+ "created_at" TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ FOREIGN KEY ("referrer_id") REFERENCES "Users" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
+ FOREIGN KEY ("referee_id") REFERENCES "Users" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
+ PRIMARY KEY ("referrer_id", "referee_id", "event_name", "created_at")
+ );
+ `,
+ { transaction },
+ );
+ });
+ },
+
+ down: async (queryInterface) => {
+ await queryInterface.sequelize.transaction(async (transaction) => {
+ await queryInterface.sequelize.query(
+ `
+ DROP TABLE "Referrals";
+ `,
+ { transaction },
+ );
+ });
+ },
+};
From 54d755d0ffbdeb8773d3c760631bb5cefad11655 Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Tue, 19 Nov 2024 01:01:19 +0500
Subject: [PATCH 103/227] Updated pricing calculations
---
.../views/components/TokenCard/TokenCard.tsx | 5 +++--
.../Communities/TokensList/TokensList.tsx | 20 +++++++++++--------
2 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/packages/commonwealth/client/scripts/views/components/TokenCard/TokenCard.tsx b/packages/commonwealth/client/scripts/views/components/TokenCard/TokenCard.tsx
index 340e7f194b1..17eb9230375 100644
--- a/packages/commonwealth/client/scripts/views/components/TokenCard/TokenCard.tsx
+++ b/packages/commonwealth/client/scripts/views/components/TokenCard/TokenCard.tsx
@@ -1,4 +1,5 @@
import clsx from 'clsx';
+import numeral from 'numeral';
import React, { ReactNode } from 'react';
import { CWIcon } from '../component_kit/cw_icons/cw_icon';
import { CWText } from '../component_kit/cw_text';
@@ -135,8 +136,8 @@ const TokenCard = ({
MCAP {currencySymbol}
- {marketCap.current} | Goal {currencySymbol}
- {marketCap.goal}
+ {numeral(marketCap.current).format('0.0a')} | Goal {currencySymbol}
+ {numeral(marketCap.goal).format('0.0a')}
{isCapped && (
diff --git a/packages/commonwealth/client/scripts/views/pages/Communities/TokensList/TokensList.tsx b/packages/commonwealth/client/scripts/views/pages/Communities/TokensList/TokensList.tsx
index 4d2c06d064a..5f46aa1ea6a 100644
--- a/packages/commonwealth/client/scripts/views/pages/Communities/TokensList/TokensList.tsx
+++ b/packages/commonwealth/client/scripts/views/pages/Communities/TokensList/TokensList.tsx
@@ -3,7 +3,6 @@ import { ChainBase } from '@hicommonwealth/shared';
import clsx from 'clsx';
import { useFlag } from 'hooks/useFlag';
import { navigateToCommunity, useCommonNavigate } from 'navigation/helpers';
-import numeral from 'numeral';
import React, { useState } from 'react';
import { Link } from 'react-router-dom';
import { useFetchTokenUsdRateQuery } from 'state/api/communityStake';
@@ -62,16 +61,21 @@ const TokensList = () => {
};
const calculateTokenPricing = (token: z.infer
) => {
- const currentPrice = token.latest_price || '0';
- const pricePercentage24HourChange = 1.15;
- const marketCapCurrent = 300;
- const marketCapGoal = numeral(
- parseFloat((token.eth_market_cap_target * ethToUsdRate).toFixed(2)),
- ).format('0.0a');
+ const currentPrice = token.latest_price || 0;
+ const currentPriceRoundingExponent = Math.floor(
+ Math.log10(Math.abs(currentPrice)),
+ );
+ const price24HrAgo = token.old_price || 0;
+ const pricePercentage24HourChange = parseFloat(
+ (((currentPrice - price24HrAgo) / price24HrAgo) * 100 || 0).toFixed(2),
+ );
+ const marketCapCurrent =
+ currentPrice * (Number(token.initial_supply) / 1e18);
+ const marketCapGoal = token.eth_market_cap_target * ethToUsdRate;
const isMarketCapGoalReached = false;
return {
- currentPrice,
+ currentPrice: `${currentPrice.toFixed(-currentPriceRoundingExponent || 2)}`,
pricePercentage24HourChange,
marketCapCurrent,
marketCapGoal,
From 85cdf4d5d09df49d3ae3640511e6675977d1fd90 Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Tue, 19 Nov 2024 01:05:00 +0500
Subject: [PATCH 104/227] Added market cap and price filter keys
---
.../views/pages/Communities/FiltersDrawer/constants.ts | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/packages/commonwealth/client/scripts/views/pages/Communities/FiltersDrawer/constants.ts b/packages/commonwealth/client/scripts/views/pages/Communities/FiltersDrawer/constants.ts
index 73693f5fa55..60bc037a217 100644
--- a/packages/commonwealth/client/scripts/views/pages/Communities/FiltersDrawer/constants.ts
+++ b/packages/commonwealth/client/scripts/views/pages/Communities/FiltersDrawer/constants.ts
@@ -31,8 +31,8 @@ export const communitySortOptionsLabelToKeysMap = {
[CommunitySortOptions.MostRecent]: getPickedKeys(
Community.pick({ created_at: true }),
)[0],
- [CommunitySortOptions.MarketCap]: '',
- [CommunitySortOptions.Price]: '',
+ [CommunitySortOptions.MarketCap]: 'market_cap_current', // TODO: might need to update based on api @Tim?
+ [CommunitySortOptions.Price]: 'latest_price',
[CommunitySortOptions.MemberCount]: getPickedKeys(
Community.pick({ profile_count: true }),
)[0],
From 1ecc122f2d4eabdc0b0793e69455e1a47dd4a145 Mon Sep 17 00:00:00 2001
From: Timothee Legros
Date: Mon, 18 Nov 2024 22:34:41 +0200
Subject: [PATCH 105/227] update initial_supply to Number type
---
libs/model/src/models/token.ts | 2 +-
libs/model/src/token/CreateToken.command.ts | 2 +-
libs/schemas/src/entities/token.schemas.ts | 6 +++---
libs/schemas/src/queries/token.schemas.ts | 1 -
.../20241114130329-add-trade-indexes.js | 18 ++++++++++++++++++
5 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/libs/model/src/models/token.ts b/libs/model/src/models/token.ts
index 52af376787d..15e35b9b166 100644
--- a/libs/model/src/models/token.ts
+++ b/libs/model/src/models/token.ts
@@ -25,7 +25,7 @@ export default (
namespace: { type: Sequelize.STRING, allowNull: false },
name: { type: Sequelize.STRING, allowNull: false },
symbol: { type: Sequelize.STRING, allowNull: false },
- initial_supply: { type: Sequelize.DECIMAL(78, 0), allowNull: false },
+ initial_supply: { type: Sequelize.INTEGER, allowNull: false },
liquidity_transferred: {
type: Sequelize.BOOLEAN,
allowNull: false,
diff --git a/libs/model/src/token/CreateToken.command.ts b/libs/model/src/token/CreateToken.command.ts
index f06e5a79236..c634ed98b69 100644
--- a/libs/model/src/token/CreateToken.command.ts
+++ b/libs/model/src/token/CreateToken.command.ts
@@ -52,7 +52,7 @@ export function CreateToken(): Command {
namespace: tokenData.parsedArgs.namespace,
name: tokenInfo.name,
symbol: tokenInfo.symbol,
- initial_supply: tokenInfo.totalSupply,
+ initial_supply: Number(tokenInfo.totalSupply / BigInt(1e18)),
liquidity_transferred: false,
launchpad_liquidity: tokenData.parsedArgs.launchpadLiquidity,
eth_market_cap_target: commonProtocol.getTargetMarketCap(),
diff --git a/libs/schemas/src/entities/token.schemas.ts b/libs/schemas/src/entities/token.schemas.ts
index ccaaefea3e4..e2794afd273 100644
--- a/libs/schemas/src/entities/token.schemas.ts
+++ b/libs/schemas/src/entities/token.schemas.ts
@@ -7,9 +7,9 @@ export const Token = z.object({
namespace: z.string().describe('Namespace associated with the token'),
name: z.string().describe('Name of the token'),
symbol: z.string().describe('Symbol of the token'),
- initial_supply: PG_ETH.describe(
- 'Initial supply of the token before deploying to uniswap',
- ),
+ initial_supply: z
+ .number()
+ .describe('Initial supply of the token before deploying to uniswap'),
liquidity_transferred: z
.boolean()
.default(false)
diff --git a/libs/schemas/src/queries/token.schemas.ts b/libs/schemas/src/queries/token.schemas.ts
index 56072f8f12f..8d3b05bd27c 100644
--- a/libs/schemas/src/queries/token.schemas.ts
+++ b/libs/schemas/src/queries/token.schemas.ts
@@ -3,7 +3,6 @@ import { Token } from '../entities';
import { PaginatedResultSchema, PaginationParamsSchema } from './pagination';
export const TokenView = Token.extend({
- initial_supply: z.string(),
launchpad_liquidity: z.string(),
latest_price: z.number().nullish(),
old_price: z.number().nullish(),
diff --git a/packages/commonwealth/server/migrations/20241114130329-add-trade-indexes.js b/packages/commonwealth/server/migrations/20241114130329-add-trade-indexes.js
index 9272e343f07..7f9e06f4708 100644
--- a/packages/commonwealth/server/migrations/20241114130329-add-trade-indexes.js
+++ b/packages/commonwealth/server/migrations/20241114130329-add-trade-indexes.js
@@ -4,6 +4,15 @@
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.sequelize.transaction(async (transaction) => {
+ await queryInterface.changeColumn(
+ 'Tokens',
+ 'initial_supply',
+ {
+ type: Sequelize.INTEGER,
+ allowNull: false,
+ },
+ { transaction },
+ );
await queryInterface.changeColumn(
'LaunchpadTrades',
'price',
@@ -30,6 +39,15 @@ module.exports = {
async down(queryInterface, Sequelize) {
await queryInterface.sequelize.transaction(async (transaction) => {
+ await queryInterface.changeColumn(
+ 'Tokens',
+ 'initial_supply',
+ {
+ type: Sequelize.NUMERIC(78, 0),
+ allowNull: false,
+ },
+ { transaction },
+ );
await queryInterface.changeColumn(
'LaunchpadTrades',
'price',
From 25ed1fe85054ba0134ed598344dd2d07171abcdb Mon Sep 17 00:00:00 2001
From: rotorsoft
Date: Mon, 18 Nov 2024 15:39:46 -0500
Subject: [PATCH 106/227] referral test
---
libs/model/test/referral/referral-lifecycle.spec.ts | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libs/model/test/referral/referral-lifecycle.spec.ts b/libs/model/test/referral/referral-lifecycle.spec.ts
index 12279f1b90d..ebec6d1b860 100644
--- a/libs/model/test/referral/referral-lifecycle.spec.ts
+++ b/libs/model/test/referral/referral-lifecycle.spec.ts
@@ -28,7 +28,7 @@ describe('Referral lifecycle', () => {
it('should create a referral', async () => {
// admin creates a referral link
- const referral_link = await command(CreateReferralLink(), {
+ const response = await command(CreateReferralLink(), {
actor: admin,
payload: {},
});
@@ -47,7 +47,7 @@ describe('Referral lifecycle', () => {
social_links: [],
directory_page_enabled: false,
tags: [],
- referral_link,
+ referral_link: response?.referral_link,
},
});
From cc53954a19fc5cb601e603ecb8bd717835b3c09a Mon Sep 17 00:00:00 2001
From: Timothee Legros
Date: Mon, 18 Nov 2024 23:04:43 +0200
Subject: [PATCH 107/227] add order by price/mcap
---
libs/model/src/token/GetTokens.query.ts | 13 +++++++++----
libs/schemas/src/queries/token.schemas.ts | 2 +-
.../pages/Communities/TokensList/TokensList.tsx | 3 +--
3 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/libs/model/src/token/GetTokens.query.ts b/libs/model/src/token/GetTokens.query.ts
index e8ccc166218..0958d870e08 100644
--- a/libs/model/src/token/GetTokens.query.ts
+++ b/libs/model/src/token/GetTokens.query.ts
@@ -21,7 +21,12 @@ export function GetTokens(): Query {
// pagination configuration
const direction = order_direction || 'DESC';
- const order_col = order_by || 'name';
+ let order_col: string = order_by || 'name';
+ if (order_by === 'market_cap' || order_by === 'price') {
+ order_col = 'trades.latest_price';
+ }
+ const includeStats = with_stats || order_col === 'trades.latest_price';
+
const offset = limit! * (cursor! - 1);
const replacements: {
search?: string;
@@ -39,7 +44,7 @@ export function GetTokens(): Query {
const sql = `
${
- with_stats
+ includeStats
? `WITH latest_trades AS (SELECT DISTINCT ON (token_address) *
FROM "LaunchpadTrades"
ORDER BY token_address, timestamp DESC),
@@ -59,12 +64,12 @@ export function GetTokens(): Query {
}
SELECT T.*,
C.id as community_id,
- ${with_stats ? 'trades.latest_price, trades.old_price,' : ''}
+ ${includeStats ? 'trades.latest_price, trades.old_price,' : ''}
count(*) OVER () AS total
FROM "Tokens" as T
JOIN "Communities" as C
ON T.namespace = C.namespace
- ${with_stats ? 'LEFT JOIN trades ON trades.token_address = T.token_address' : ''}
+ ${includeStats ? 'LEFT JOIN trades ON trades.token_address = T.token_address' : ''}
${search ? 'WHERE LOWER(T.name) LIKE :search' : ''}
ORDER BY ${order_col} :direction
LIMIT :limit OFFSET :offset
diff --git a/libs/schemas/src/queries/token.schemas.ts b/libs/schemas/src/queries/token.schemas.ts
index 8d3b05bd27c..79fa7e624b9 100644
--- a/libs/schemas/src/queries/token.schemas.ts
+++ b/libs/schemas/src/queries/token.schemas.ts
@@ -11,7 +11,7 @@ export const TokenView = Token.extend({
export const GetTokens = {
input: PaginationParamsSchema.extend({
search: z.string().optional(),
- order_by: z.enum(['name']).optional(),
+ order_by: z.enum(['name', 'price', 'market_cap']).optional(),
with_stats: z.boolean().optional(),
}),
output: PaginatedResultSchema.extend({
diff --git a/packages/commonwealth/client/scripts/views/pages/Communities/TokensList/TokensList.tsx b/packages/commonwealth/client/scripts/views/pages/Communities/TokensList/TokensList.tsx
index 5f46aa1ea6a..2e89ec28b85 100644
--- a/packages/commonwealth/client/scripts/views/pages/Communities/TokensList/TokensList.tsx
+++ b/packages/commonwealth/client/scripts/views/pages/Communities/TokensList/TokensList.tsx
@@ -69,8 +69,7 @@ const TokensList = () => {
const pricePercentage24HourChange = parseFloat(
(((currentPrice - price24HrAgo) / price24HrAgo) * 100 || 0).toFixed(2),
);
- const marketCapCurrent =
- currentPrice * (Number(token.initial_supply) / 1e18);
+ const marketCapCurrent = currentPrice * token.initial_supply;
const marketCapGoal = token.eth_market_cap_target * ethToUsdRate;
const isMarketCapGoalReached = false;
From 1425a9bb3bb64cbe3ae90617c93f0cf3c193cf5e Mon Sep 17 00:00:00 2001
From: rotorsoft
Date: Mon, 18 Nov 2024 16:06:33 -0500
Subject: [PATCH 108/227] fix test
---
.../test/referral/referral-lifecycle.spec.ts | 5 ++++-
libs/model/test/utils/community-seeder.ts | 19 +++++++++++++++++++
2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/libs/model/test/referral/referral-lifecycle.spec.ts b/libs/model/test/referral/referral-lifecycle.spec.ts
index ebec6d1b860..fccc9432243 100644
--- a/libs/model/test/referral/referral-lifecycle.spec.ts
+++ b/libs/model/test/referral/referral-lifecycle.spec.ts
@@ -41,7 +41,7 @@ describe('Referral lifecycle', () => {
chain_node_id: node.id!,
id,
name: id,
- type: ChainType.Chain,
+ type: ChainType.Offchain,
base: ChainBase.Ethereum,
default_symbol: 'TEST',
social_links: [],
@@ -52,6 +52,9 @@ describe('Referral lifecycle', () => {
});
// drain the outbox
+ // TODO: Create a testing utility to drain the outbox and push
+ // the events to the predefined event handlers ... this is a simple
+ // simulation of what the infrastructure would do in production
// get referrals
const referrals = await models.Referral.findAll({
diff --git a/libs/model/test/utils/community-seeder.ts b/libs/model/test/utils/community-seeder.ts
index 0019e57f4bd..8d788af975e 100644
--- a/libs/model/test/utils/community-seeder.ts
+++ b/libs/model/test/utils/community-seeder.ts
@@ -1,5 +1,6 @@
import { Actor } from '@hicommonwealth/core';
import * as schemas from '@hicommonwealth/schemas';
+import { ChainBase } from '@hicommonwealth/shared';
import { z } from 'zod';
import { seed, seedRecord } from '../../src/tester';
import { getSignersInfo } from './canvas-signers';
@@ -48,6 +49,24 @@ export async function seedCommunity({
isAdmin: role === 'admin',
}));
+ // seed ethereum base community
+ await seed('Community', {
+ chain_node_id: node!.id!,
+ base: ChainBase.Ethereum,
+ active: true,
+ lifetime_thread_count: 0,
+ profile_count: 1,
+ Addresses: roles.map((role, index) => {
+ return {
+ address: signerInfo[index].address,
+ user_id: users[role].id,
+ role: role === 'admin' ? 'admin' : 'member',
+ is_banned: role === 'banned',
+ verified: new Date(),
+ };
+ }),
+ });
+
const [community] = await seed('Community', {
chain_node_id: node!.id!,
namespace_address,
From 47c4d9216443eb064f2387aace5b273c5c81c41f Mon Sep 17 00:00:00 2001
From: Ryan Bennett
Date: Tue, 19 Nov 2024 04:48:44 -0800
Subject: [PATCH 109/227] add scores to card + add contest manager description
---
.../UpdateContestManagerMetadata.command.ts | 4 ++
libs/model/src/models/associations.ts | 3 +-
libs/model/src/models/contest_manager.ts | 12 +++++-
libs/schemas/src/commands/contest.schemas.ts | 2 +
libs/schemas/src/entities/topic.schemas.ts | 5 ++-
.../SignTransactionsStep.tsx | 1 +
.../farcaster/frames/contest/contestCard.tsx | 39 +++++++++++++++++--
.../20241119112521-add-contest-description.js | 14 +++++++
8 files changed, 73 insertions(+), 7 deletions(-)
create mode 100644 packages/commonwealth/server/migrations/20241119112521-add-contest-description.js
diff --git a/libs/model/src/contest/UpdateContestManagerMetadata.command.ts b/libs/model/src/contest/UpdateContestManagerMetadata.command.ts
index 800ef6c0e48..025a96a4d48 100644
--- a/libs/model/src/contest/UpdateContestManagerMetadata.command.ts
+++ b/libs/model/src/contest/UpdateContestManagerMetadata.command.ts
@@ -32,6 +32,10 @@ export function UpdateContestManagerMetadata(): Command<
contestManager.name = payload.name;
}
+ if (typeof payload.description !== 'undefined') {
+ contestManager.description = payload.description;
+ }
+
if (typeof payload.topic_id !== 'undefined') {
const topic = await models.Topic.findByPk(payload.topic_id);
if (!topic) {
diff --git a/libs/model/src/models/associations.ts b/libs/model/src/models/associations.ts
index a1b597a91ae..2f20375099c 100644
--- a/libs/model/src/models/associations.ts
+++ b/libs/model/src/models/associations.ts
@@ -85,7 +85,8 @@ export const buildAssociations = (db: DB) => {
foreignKey: 'selected_community_id',
as: 'selectedCommunity',
})
- .withMany(db.Quest, { onUpdate: 'CASCADE', onDelete: 'CASCADE' });
+ .withMany(db.Quest, { onUpdate: 'CASCADE', onDelete: 'CASCADE' })
+ .withMany(db.ContestManager, { onUpdate: 'CASCADE', onDelete: 'CASCADE' });
db.Tags.withMany(db.ProfileTags, {
foreignKey: 'tag_id',
diff --git a/libs/model/src/models/contest_manager.ts b/libs/model/src/models/contest_manager.ts
index d1160dcc1fb..49490234d23 100644
--- a/libs/model/src/models/contest_manager.ts
+++ b/libs/model/src/models/contest_manager.ts
@@ -1,9 +1,15 @@
import { ContestManager } from '@hicommonwealth/schemas';
import Sequelize from 'sequelize';
import { z } from 'zod';
+import { CommunityAttributes } from './community';
import type { ModelInstance } from './types';
-type ContestManager = ModelInstance>;
+export type ContestManagerAttributes = z.infer & {
+ // associations
+ Community?: CommunityAttributes;
+};
+
+type ContestManager = ModelInstance;
export default (
sequelize: Sequelize.Sequelize,
@@ -23,6 +29,10 @@ export default (
type: Sequelize.STRING,
allowNull: false,
},
+ description: {
+ type: Sequelize.STRING,
+ allowNull: true,
+ },
image_url: {
type: Sequelize.STRING,
allowNull: true,
diff --git a/libs/schemas/src/commands/contest.schemas.ts b/libs/schemas/src/commands/contest.schemas.ts
index 8ae6ddc4f23..2f25a9b7596 100644
--- a/libs/schemas/src/commands/contest.schemas.ts
+++ b/libs/schemas/src/commands/contest.schemas.ts
@@ -9,6 +9,7 @@ export const CreateContestManagerMetadata = {
community_id: z.string(),
contest_address: z.string().describe('On-Chain contest manager address'),
name: z.string(),
+ description: z.string().nullish(),
image_url: z.string().optional(),
funding_token_address: z
.string()
@@ -45,6 +46,7 @@ export const UpdateContestManagerMetadata = {
community_id: z.string(),
contest_address: z.string().describe('On-Chain contest manager address'),
name: z.string().optional(),
+ description: z.string().optional(),
image_url: z.string().optional(),
topic_id: PG_INT.optional(),
}),
diff --git a/libs/schemas/src/entities/topic.schemas.ts b/libs/schemas/src/entities/topic.schemas.ts
index 35b66d2ab86..901b094556a 100644
--- a/libs/schemas/src/entities/topic.schemas.ts
+++ b/libs/schemas/src/entities/topic.schemas.ts
@@ -56,6 +56,7 @@ export const ContestManager = z
contest_address: z.string().describe('On-Chain contest manager address'),
community_id: z.string(),
name: z.string(),
+ description: z.string().nullish(),
image_url: z.string().nullish(),
funding_token_address: z
.string()
@@ -98,11 +99,11 @@ export const ContestManager = z
neynar_webhook_id: z
.string()
.nullish()
- .describe('Neynar ID of the CastCreated webhook'),
+ .describe('Neynar ID of the ReplyCastCreated webhook'),
neynar_webhook_secret: z
.string()
.nullish()
- .describe('Neynar secret for the CastCreated webhook'),
+ .describe('Neynar secret for the ReplyCastCreated webhook'),
topic_id: PG_INT.nullish(),
topics: z.array(Topic).nullish(),
is_farcaster_contest: z.boolean(),
diff --git a/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Contests/ManageContest/steps/SignTransactionsStep/SignTransactionsStep.tsx b/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Contests/ManageContest/steps/SignTransactionsStep/SignTransactionsStep.tsx
index 5083d662bec..5c57f3ed3e4 100644
--- a/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Contests/ManageContest/steps/SignTransactionsStep/SignTransactionsStep.tsx
+++ b/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Contests/ManageContest/steps/SignTransactionsStep/SignTransactionsStep.tsx
@@ -147,6 +147,7 @@ const SignTransactionsStep = ({
await createContestMutation({
contest_address: contestAddress,
name: contestFormData?.contestName,
+ description: contestFormData?.contestDescription,
community_id: app.activeChainId() || '',
image_url: contestFormData?.contestImage,
funding_token_address: exchangeToken,
diff --git a/packages/commonwealth/server/farcaster/frames/contest/contestCard.tsx b/packages/commonwealth/server/farcaster/frames/contest/contestCard.tsx
index b52ef578632..41ab66dd006 100644
--- a/packages/commonwealth/server/farcaster/frames/contest/contestCard.tsx
+++ b/packages/commonwealth/server/farcaster/frames/contest/contestCard.tsx
@@ -1,7 +1,9 @@
+import { models } from '@hicommonwealth/model';
import { Button } from 'frames.js/express';
import moment from 'moment';
+import { mustExist } from 'node_modules/@hicommonwealth/model/src/middleware/guards';
+import { getContestBalance } from 'node_modules/@hicommonwealth/model/src/services/commonProtocol/contestHelper';
import React from 'react';
-import { getContestManagerScores } from 'server/farcaster/utils';
import { frames } from '../../config';
const PrizeRow = ({ index, prize }: { index: number; prize: number }) => {
@@ -38,8 +40,39 @@ export const contestCard = frames(async (ctx) => {
const contest_address = ctx.url.pathname.split('/')[1];
- const { contestManager, prizes } =
- await getContestManagerScores(contest_address);
+ const contestManager = await models.ContestManager.findOne({
+ where: {
+ contest_address: contest_address,
+ },
+ include: [
+ {
+ model: models.Community,
+ include: [
+ {
+ model: models.ChainNode.scope('withPrivateData'),
+ },
+ ],
+ },
+ ],
+ });
+ mustExist('Contest Manager', contestManager);
+
+ const chainNode = contestManager.Community!.ChainNode!;
+ const chainNodeUrl = chainNode.private_url! || chainNode.url!;
+ const contestBalance = await getContestBalance(
+ chainNodeUrl,
+ contestManager.contest_address,
+ contestManager.interval === 0,
+ );
+
+ const prizes =
+ contestBalance && contestManager.payout_structure
+ ? contestManager.payout_structure.map(
+ (percentage) =>
+ (Number(contestBalance) * (percentage / 100)) /
+ Math.pow(10, contestManager.decimals || 18),
+ )
+ : [];
return {
title: contestManager.name,
diff --git a/packages/commonwealth/server/migrations/20241119112521-add-contest-description.js b/packages/commonwealth/server/migrations/20241119112521-add-contest-description.js
new file mode 100644
index 00000000000..3e4ef1766a9
--- /dev/null
+++ b/packages/commonwealth/server/migrations/20241119112521-add-contest-description.js
@@ -0,0 +1,14 @@
+'use strict';
+
+module.exports = {
+ up: async (queryInterface, Sequelize) => {
+ await queryInterface.addColumn('ContestManagers', 'description', {
+ type: Sequelize.STRING,
+ allowNull: true,
+ });
+ },
+
+ down: async (queryInterface, Sequelize) => {
+ await queryInterface.removeColumn('ContestManagers', 'description');
+ },
+};
From 4b9fd8f4ce452d7cc94caf42288104344e887a88 Mon Sep 17 00:00:00 2001
From: Ryan Bennett
Date: Tue, 19 Nov 2024 05:00:30 -0800
Subject: [PATCH 110/227] add link to cw leaderboard
---
.../farcaster/frames/contest/contestCard.tsx | 31 +++++++++++++++++--
1 file changed, 28 insertions(+), 3 deletions(-)
diff --git a/packages/commonwealth/server/farcaster/frames/contest/contestCard.tsx b/packages/commonwealth/server/farcaster/frames/contest/contestCard.tsx
index 41ab66dd006..217b69a4ded 100644
--- a/packages/commonwealth/server/farcaster/frames/contest/contestCard.tsx
+++ b/packages/commonwealth/server/farcaster/frames/contest/contestCard.tsx
@@ -1,3 +1,4 @@
+import { config } from '@hicommonwealth/core';
import { models } from '@hicommonwealth/model';
import { Button } from 'frames.js/express';
import moment from 'moment';
@@ -97,7 +98,18 @@ export const contestCard = frames(async (ctx) => {
{contestManager.name}
- {contest_address}
+ {contestManager.description && (
+
+ {contestManager.description}
+
+ )}
+
+ {contest_address}
+
Current Prizes
{prizes.length ? (
@@ -112,8 +124,8 @@ export const contestCard = frames(async (ctx) => {
buttons: [
View Leaderboard
,
@@ -127,3 +139,16 @@ export const contestCard = frames(async (ctx) => {
],
};
});
+
+const getBaseUrl = () => {
+ switch (config.APP_ENV) {
+ case 'local':
+ return 'http://localhost:8080';
+ case 'beta':
+ return 'https://qa.commonwealth.im';
+ case 'demo':
+ return 'https://demo.commonwealth.im';
+ default:
+ return 'https://commonwealth.im';
+ }
+};
From cb3997c46481401ae4d8af145daa69d2b1024a7f Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Tue, 19 Nov 2024 18:05:38 +0500
Subject: [PATCH 111/227] Added token trading widget inside community sidebar
---
.../TokenCard/MarketCapProgress.scss | 54 +++++++++
.../TokenCard/MarketCapProgress.tsx | 46 ++++++++
.../TokenCard/PricePercentageChange.scss | 13 ++
.../TokenCard/PricePercentageChange.tsx | 43 +++++++
.../views/components/TokenCard/TokenCard.scss | 64 ----------
.../views/components/TokenCard/TokenCard.tsx | 39 ++----
.../CommunitySection/CommunitySection.tsx | 33 ++++++
.../TokenTradeWidget/TokenTradeWidget.scss | 47 ++++++++
.../TokenTradeWidget/TokenTradeWidget.tsx | 111 ++++++++++++++++++
.../TokenTradeWidgetSkeleton.tsx | 17 +++
.../TokenTradeWidget/index.ts | 1 +
.../commonwealth/client/styles/utils.scss | 4 +
12 files changed, 379 insertions(+), 93 deletions(-)
create mode 100644 packages/commonwealth/client/scripts/views/components/TokenCard/MarketCapProgress.scss
create mode 100644 packages/commonwealth/client/scripts/views/components/TokenCard/MarketCapProgress.tsx
create mode 100644 packages/commonwealth/client/scripts/views/components/TokenCard/PricePercentageChange.scss
create mode 100644 packages/commonwealth/client/scripts/views/components/TokenCard/PricePercentageChange.tsx
create mode 100644 packages/commonwealth/client/scripts/views/components/sidebar/CommunitySection/TokenTradeWidget/TokenTradeWidget.scss
create mode 100644 packages/commonwealth/client/scripts/views/components/sidebar/CommunitySection/TokenTradeWidget/TokenTradeWidget.tsx
create mode 100644 packages/commonwealth/client/scripts/views/components/sidebar/CommunitySection/TokenTradeWidget/TokenTradeWidgetSkeleton.tsx
create mode 100644 packages/commonwealth/client/scripts/views/components/sidebar/CommunitySection/TokenTradeWidget/index.ts
diff --git a/packages/commonwealth/client/scripts/views/components/TokenCard/MarketCapProgress.scss b/packages/commonwealth/client/scripts/views/components/TokenCard/MarketCapProgress.scss
new file mode 100644
index 00000000000..c3e6905654e
--- /dev/null
+++ b/packages/commonwealth/client/scripts/views/components/TokenCard/MarketCapProgress.scss
@@ -0,0 +1,54 @@
+@import '../../../../styles/shared';
+
+.MarketCapProgress {
+ padding: 8px;
+ border-radius: $border-radius-corners;
+ background-color: $neutral-50;
+ display: flex;
+ flex-direction: column;
+ gap: 4px;
+ width: 100%;
+
+ progress {
+ height: 8px;
+ width: 100%;
+ border: 1px solid $neutral-100;
+
+ &::-webkit-progress-bar {
+ background-color: $neutral-200;
+ border-radius: $border-radius-corners;
+ }
+
+ &::-webkit-progress-value {
+ background-color: $primary-400;
+ border-radius: $border-radius-corners;
+ }
+
+ &.isCapped {
+ &::-webkit-progress-value {
+ background-color: $green-500 !important;
+ }
+ }
+ }
+
+ .prices {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ gap: 4px;
+
+ .caps {
+ word-spacing: 2px;
+ width: fit-content;
+ }
+
+ .token-capped-icon {
+ border-radius: 50%;
+ background-color: $green-500;
+ color: $white;
+ padding: 3px;
+ height: 20px;
+ width: 20px;
+ }
+ }
+}
diff --git a/packages/commonwealth/client/scripts/views/components/TokenCard/MarketCapProgress.tsx b/packages/commonwealth/client/scripts/views/components/TokenCard/MarketCapProgress.tsx
new file mode 100644
index 00000000000..a325a3ec590
--- /dev/null
+++ b/packages/commonwealth/client/scripts/views/components/TokenCard/MarketCapProgress.tsx
@@ -0,0 +1,46 @@
+import clsx from 'clsx';
+import { currencyNameToSymbolMap, SupportedCurrencies } from 'helpers/currency';
+import React from 'react';
+import { CWIcon } from '../component_kit/cw_icons/cw_icon';
+import { CWText } from '../component_kit/cw_text';
+import './MarketCapProgress.scss';
+
+interface MarketCapProgressProps {
+ currency?: SupportedCurrencies;
+ marketCap: { current: number; goal: number };
+ onBodyClick?: (e: React.MouseEvent) => void;
+}
+
+const MarketCapProgress = ({
+ currency = SupportedCurrencies.USD,
+ marketCap,
+ onBodyClick,
+}: MarketCapProgressProps) => {
+ const currencySymbol = currencyNameToSymbolMap[currency];
+ const isCapped = marketCap.current === marketCap.goal;
+ const progressPercentage = Math.floor(
+ (marketCap.current / marketCap.goal) * 100,
+ );
+
+ return (
+
+
+
+
+ MCAP {currencySymbol}
+ {marketCap.current} | Goal {currencySymbol}
+ {marketCap.goal}
+
+ {isCapped && (
+
+ )}
+
+
+ );
+};
+
+export default MarketCapProgress;
diff --git a/packages/commonwealth/client/scripts/views/components/TokenCard/PricePercentageChange.scss b/packages/commonwealth/client/scripts/views/components/TokenCard/PricePercentageChange.scss
new file mode 100644
index 00000000000..2cd720eb515
--- /dev/null
+++ b/packages/commonwealth/client/scripts/views/components/TokenCard/PricePercentageChange.scss
@@ -0,0 +1,13 @@
+@import '../../../../styles/shared';
+
+.PricePercentageChange {
+ width: fit-content;
+
+ &.negative {
+ color: $rorange-500;
+ }
+
+ &.positive {
+ color: $green-600;
+ }
+}
diff --git a/packages/commonwealth/client/scripts/views/components/TokenCard/PricePercentageChange.tsx b/packages/commonwealth/client/scripts/views/components/TokenCard/PricePercentageChange.tsx
new file mode 100644
index 00000000000..5c7c74d53a0
--- /dev/null
+++ b/packages/commonwealth/client/scripts/views/components/TokenCard/PricePercentageChange.tsx
@@ -0,0 +1,43 @@
+import clsx from 'clsx';
+import React from 'react';
+import { CWText } from '../component_kit/cw_text';
+import './PricePercentageChange.scss';
+
+interface PricePercentageChangeProps {
+ pricePercentage24HourChange: number;
+ alignment?: 'left' | 'right';
+ className?: string;
+}
+
+const PricePercentageChange = ({
+ pricePercentage24HourChange,
+ alignment = 'right',
+ className,
+}: PricePercentageChangeProps) => {
+ return (
+
+ = 0 },
+ )}
+ type="caption"
+ >
+ {pricePercentage24HourChange >= 0 ? '+' : ''}
+ {pricePercentage24HourChange}%
+ {' '}
+ 24hr
+
+ );
+};
+
+export default PricePercentageChange;
diff --git a/packages/commonwealth/client/scripts/views/components/TokenCard/TokenCard.scss b/packages/commonwealth/client/scripts/views/components/TokenCard/TokenCard.scss
index e7b3ef658db..02f243f0e8b 100644
--- a/packages/commonwealth/client/scripts/views/components/TokenCard/TokenCard.scss
+++ b/packages/commonwealth/client/scripts/views/components/TokenCard/TokenCard.scss
@@ -41,70 +41,6 @@
.col {
display: flex;
flex-direction: column;
-
- .price-change {
- width: fit-content;
- &.negative {
- color: $rorange-500;
- }
-
- &.positive {
- color: $green-600;
- }
- }
- }
- }
-
- .market-cap {
- padding: 8px;
- border-radius: $border-radius-corners;
- background-color: $neutral-50;
- display: flex;
- flex-direction: column;
- gap: 4px;
- width: 100%;
-
- progress {
- height: 8px;
- width: 100%;
- border: 1px solid $neutral-100;
-
- &::-webkit-progress-bar {
- background-color: $neutral-200;
- border-radius: $border-radius-corners;
- }
-
- &::-webkit-progress-value {
- background-color: $primary-400;
- border-radius: $border-radius-corners;
- }
-
- &.isCapped {
- &::-webkit-progress-value {
- background-color: $green-500 !important;
- }
- }
- }
-
- .prices {
- display: flex;
- justify-content: center;
- align-items: center;
- gap: 4px;
-
- .caps {
- word-spacing: 2px;
- width: fit-content;
- }
-
- .token-capped-icon {
- border-radius: 50%;
- background-color: $green-500;
- color: $white;
- padding: 3px;
- height: 20px;
- width: 20px;
- }
}
}
diff --git a/packages/commonwealth/client/scripts/views/components/TokenCard/TokenCard.tsx b/packages/commonwealth/client/scripts/views/components/TokenCard/TokenCard.tsx
index 340e7f194b1..4f258a328fe 100644
--- a/packages/commonwealth/client/scripts/views/components/TokenCard/TokenCard.tsx
+++ b/packages/commonwealth/client/scripts/views/components/TokenCard/TokenCard.tsx
@@ -1,16 +1,17 @@
import clsx from 'clsx';
+import { currencyNameToSymbolMap, SupportedCurrencies } from 'helpers/currency';
import React, { ReactNode } from 'react';
-import { CWIcon } from '../component_kit/cw_icons/cw_icon';
import { CWText } from '../component_kit/cw_text';
import { CWButton } from '../component_kit/new_designs/CWButton';
import { CWTooltip } from '../component_kit/new_designs/CWTooltip';
+import MarketCapProgress from './MarketCapProgress';
import './TokenCard.scss';
interface TokenCardProps {
name: string;
symbol: string;
iconURL: string;
- currency?: 'USD';
+ currency?: SupportedCurrencies;
marketCap: { current: number; goal: number };
price: string;
pricePercentage24HourChange: number;
@@ -20,17 +21,13 @@ interface TokenCardProps {
onCardBodyClick?: () => void;
}
-const currentNameToSymbol = {
- USD: '$',
-};
-
const MAX_CHARS_FOR_LABELS = 9;
const TokenCard = ({
name,
symbol,
iconURL,
- currency = 'USD',
+ currency = SupportedCurrencies.USD,
marketCap,
price,
pricePercentage24HourChange,
@@ -39,11 +36,7 @@ const TokenCard = ({
onCardBodyClick,
onCTAClick,
}: TokenCardProps) => {
- const currencySymbol = currentNameToSymbol[currency];
- const isCapped = marketCap.current === marketCap.goal;
- const progressPercentage = Math.floor(
- (marketCap.current / marketCap.goal) * 100,
- );
+ const currencySymbol = currencyNameToSymbolMap[currency];
const handleBodyClick = (e: React.MouseEvent) =>
e.target === e.currentTarget && onCardBodyClick?.();
@@ -126,23 +119,11 @@ const TokenCard = ({
{/* market cap row */}
-
-
-
-
- MCAP {currencySymbol}
- {marketCap.current} | Goal {currencySymbol}
- {marketCap.goal}
-
- {isCapped && (
-
- )}
-
-
+
{/* action cta */}
{
+ const tokenizedCommunityEnabled = useFlag('tokenizedCommunity');
+
const user = useUserStore();
const {
selectedAddress,
@@ -52,6 +58,26 @@ export const CommunitySection = ({ showSkeleton }: CommunitySectionProps) => {
const { isContestAvailable, isContestDataLoading, contestsData } =
useCommunityContests();
+ // TODO: need api to get token per community;
+ const communityToken = {
+ token_address: '0xa40d9517de7e6536ccbbf6df45a1ad12fe2d040c',
+ namespace: 'TikTokTulipMania',
+ name: 'TikTokTulipMania',
+ symbol: 'TTTMN',
+ initial_supply: '1000000000000000000000000000',
+ liquidity_transferred: false,
+ launchpad_liquidity: '430000000000000000000000000',
+ eth_market_cap_target: 29.447347142468825,
+ icon_url:
+ 'https://s3.amazonaws.com/local.assets/de0e4788-8abe-436b-84cc-7f83a2f6cb5f.png',
+ // eslint-disable-next-line max-len
+ description: `TikTokTulipMania: Because nothing says "investment" like fleeting trends and historical economic collapses. Dive in, it's only pixels! 🌷💸`,
+ created_at: '2024-11-18T19:28:15.103Z',
+ updated_at: '2024-11-18T19:28:15.103Z',
+ community_id: 'tiktoktulipmania-tttmn-community',
+ } as unknown as z.infer;
+ const isLoadingToken = false;
+
const { data: domain } = useFetchCustomDomainQuery();
const topicIdsIncludedInContest = getUniqueTopicIdsIncludedInActiveContest(
@@ -92,6 +118,13 @@ export const CommunitySection = ({ showSkeleton }: CommunitySectionProps) => {
>
)}
+ {tokenizedCommunityEnabled && communityToken && (
+
+ )}
+
{isAdmin && (
diff --git a/packages/commonwealth/client/scripts/views/components/sidebar/CommunitySection/TokenTradeWidget/TokenTradeWidget.scss b/packages/commonwealth/client/scripts/views/components/sidebar/CommunitySection/TokenTradeWidget/TokenTradeWidget.scss
new file mode 100644
index 00000000000..a26a0454efd
--- /dev/null
+++ b/packages/commonwealth/client/scripts/views/components/sidebar/CommunitySection/TokenTradeWidget/TokenTradeWidget.scss
@@ -0,0 +1,47 @@
+@import '../../../../../../styles/shared';
+
+.TokenTradeWidget {
+ display: flex;
+ flex-direction: column;
+ gap: 4px;
+ padding: 12px;
+
+ .header {
+ display: flex;
+ flex-direction: row;
+ gap: 8px;
+ align-items: center;
+ color: $neutral-500 !important;
+
+ .Text {
+ color: $neutral-500 !important;
+ letter-spacing: 0.5Øpx;
+ }
+ }
+
+ .pad-8 {
+ padding: 0px 8px;
+ }
+
+ .action-btns {
+ display: grid;
+ grid-template-columns: 1fr 1fr;
+ gap: 8px;
+ width: 100%;
+ padding: 8px;
+
+ button {
+ text-transform: capitalize;
+ }
+
+ .btn-border {
+ &:focus-within {
+ border-width: 1px !important;
+ padding: 0 !important;
+ }
+
+ margin: 0 !important;
+ margin-top: auto;
+ }
+ }
+}
diff --git a/packages/commonwealth/client/scripts/views/components/sidebar/CommunitySection/TokenTradeWidget/TokenTradeWidget.tsx b/packages/commonwealth/client/scripts/views/components/sidebar/CommunitySection/TokenTradeWidget/TokenTradeWidget.tsx
new file mode 100644
index 00000000000..f92d29c7491
--- /dev/null
+++ b/packages/commonwealth/client/scripts/views/components/sidebar/CommunitySection/TokenTradeWidget/TokenTradeWidget.tsx
@@ -0,0 +1,111 @@
+import { TokenView } from '@hicommonwealth/schemas';
+import { ChainBase } from '@hicommonwealth/shared';
+import React, { useState } from 'react';
+import TradeTokenModal from 'views/modals/TradeTokenModel';
+import { TradingMode } from 'views/modals/TradeTokenModel/TradeTokenForm';
+import { z } from 'zod';
+import MarketCapProgress from '../../../TokenCard/MarketCapProgress';
+import PricePercentageChange from '../../../TokenCard/PricePercentageChange';
+import { CWDivider } from '../../../component_kit/cw_divider';
+import { CWIconButton } from '../../../component_kit/cw_icon_button';
+import { CWText } from '../../../component_kit/cw_text';
+import { CWButton } from '../../../component_kit/new_designs/CWButton';
+import './TokenTradeWidget.scss';
+import { TokenTradeWidgetSkeleton } from './TokenTradeWidgetSkeleton';
+
+interface TokenTradeWidgetProps {
+ showSkeleton: boolean;
+ token: z.infer;
+}
+
+export const TokenTradeWidget = ({
+ showSkeleton,
+ token,
+}: TokenTradeWidgetProps) => {
+ const currentPrice = (token as any).latest_price || 0; // TODO: fix type
+ const price24HrAgo = (token as any).old_price || 0; // TODO: fix type
+ const pricePercentage24HourChange = parseFloat(
+ (((currentPrice - price24HrAgo) / price24HrAgo) * 100 || 0).toFixed(2),
+ );
+
+ const [isWidgetExpanded, setIsWidgetExpanded] = useState(true);
+ const [tokenLaunchModalConfig, setTokenLaunchModalConfig] = useState<{
+ isOpen: boolean;
+ tradeConfig?: {
+ mode: TradingMode;
+ token: z.infer;
+ addressType: ChainBase;
+ };
+ }>({ isOpen: false, tradeConfig: undefined });
+
+ const handleCTAClick = (mode: TradingMode) => {
+ setTokenLaunchModalConfig({
+ isOpen: true,
+ tradeConfig: {
+ mode,
+ token,
+ addressType: ChainBase.Ethereum,
+ },
+ });
+ };
+
+ if (showSkeleton) {
+ return ;
+ }
+
+ return (
+
+
+ setIsWidgetExpanded((e) => !e)}
+ />
+
+ Token
+
+
+
+ {isWidgetExpanded && (
+ <>
+
+ {token.symbol} {(token as any).latest_price || '$10.68'}
+
+
+
+
+
+ {[TradingMode.Buy, TradingMode.Sell].map((mode) => (
+ handleCTAClick(mode)}
+ />
+ ))}
+
+ >
+ )}
+ {tokenLaunchModalConfig.tradeConfig && (
+ setTokenLaunchModalConfig({ isOpen: false })}
+ />
+ )}
+
+
+ );
+};
diff --git a/packages/commonwealth/client/scripts/views/components/sidebar/CommunitySection/TokenTradeWidget/TokenTradeWidgetSkeleton.tsx b/packages/commonwealth/client/scripts/views/components/sidebar/CommunitySection/TokenTradeWidget/TokenTradeWidgetSkeleton.tsx
new file mode 100644
index 00000000000..1a1c314762c
--- /dev/null
+++ b/packages/commonwealth/client/scripts/views/components/sidebar/CommunitySection/TokenTradeWidget/TokenTradeWidgetSkeleton.tsx
@@ -0,0 +1,17 @@
+import React from 'react';
+import { Skeleton } from '../../../Skeleton';
+import './TokenTradeWidget';
+
+export const TokenTradeWidgetSkeleton = () => {
+ return (
+
+ );
+};
diff --git a/packages/commonwealth/client/scripts/views/components/sidebar/CommunitySection/TokenTradeWidget/index.ts b/packages/commonwealth/client/scripts/views/components/sidebar/CommunitySection/TokenTradeWidget/index.ts
new file mode 100644
index 00000000000..4f4a5a79402
--- /dev/null
+++ b/packages/commonwealth/client/scripts/views/components/sidebar/CommunitySection/TokenTradeWidget/index.ts
@@ -0,0 +1 @@
+export * from './TokenTradeWidget';
diff --git a/packages/commonwealth/client/styles/utils.scss b/packages/commonwealth/client/styles/utils.scss
index 4edcbdc749b..e14fb175131 100644
--- a/packages/commonwealth/client/styles/utils.scss
+++ b/packages/commonwealth/client/styles/utils.scss
@@ -2,6 +2,10 @@
margin: auto !important;
}
+.mr-auto {
+ margin-right: auto !important;
+}
+
.ml-auto {
margin-left: auto !important;
}
From 28e01436a70209e67e297ed620381dfb1dd2a668 Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Tue, 19 Nov 2024 18:21:40 +0500
Subject: [PATCH 112/227] Updated price rounding calculation
---
.../views/pages/Communities/TokensList/TokensList.tsx | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/packages/commonwealth/client/scripts/views/pages/Communities/TokensList/TokensList.tsx b/packages/commonwealth/client/scripts/views/pages/Communities/TokensList/TokensList.tsx
index 2e89ec28b85..a7b3200a13c 100644
--- a/packages/commonwealth/client/scripts/views/pages/Communities/TokensList/TokensList.tsx
+++ b/packages/commonwealth/client/scripts/views/pages/Communities/TokensList/TokensList.tsx
@@ -62,9 +62,10 @@ const TokensList = () => {
const calculateTokenPricing = (token: z.infer) => {
const currentPrice = token.latest_price || 0;
- const currentPriceRoundingExponent = Math.floor(
- Math.log10(Math.abs(currentPrice)),
- );
+ const currentPriceRoundingExponent =
+ currentPrice !== 0
+ ? Math.floor(Math.log10(Math.abs(currentPrice)))
+ : currentPrice;
const price24HrAgo = token.old_price || 0;
const pricePercentage24HourChange = parseFloat(
(((currentPrice - price24HrAgo) / price24HrAgo) * 100 || 0).toFixed(2),
From 3211e3ab3f8244680177f584a1748afc11278888 Mon Sep 17 00:00:00 2001
From: rotorsoft
Date: Tue, 19 Nov 2024 08:33:08 -0500
Subject: [PATCH 113/227] fix projection
---
libs/model/src/user/UserReferrals.projection.ts | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/libs/model/src/user/UserReferrals.projection.ts b/libs/model/src/user/UserReferrals.projection.ts
index f835a4ea121..30309758b3f 100644
--- a/libs/model/src/user/UserReferrals.projection.ts
+++ b/libs/model/src/user/UserReferrals.projection.ts
@@ -16,7 +16,7 @@ export function UserReferrals(): Projection {
if (referral_link?.startsWith('ref_')) {
try {
const referrer_id = parseInt(referral_link.split('_').at(1)!);
- models.Referral.create({
+ await models.Referral.create({
referrer_id,
referee_id: parseInt(payload.userId),
event_name: 'CommunityCreated',
@@ -25,7 +25,9 @@ export function UserReferrals(): Projection {
});
} catch (e) {
// TODO: should we do something else when we fail to create a referral?
- e instanceof Error && log.error(e.message, e);
+ // Logging the error will allows us to manually fix the issue
+ e instanceof Error &&
+ log.error('Failed to project referral', e, payload);
}
}
},
From fb312e3d7f48d7495137749b44411e9918e186a9 Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Tue, 19 Nov 2024 18:37:43 +0500
Subject: [PATCH 114/227] Hooked filters with updated get tokens call
---
.../views/pages/Communities/Communities.tsx | 24 ++++++++++++++---
.../Communities/FiltersDrawer/constants.ts | 4 +--
.../Communities/TokensList/TokensList.tsx | 26 ++++++++++++++++++-
3 files changed, 47 insertions(+), 7 deletions(-)
diff --git a/packages/commonwealth/client/scripts/views/pages/Communities/Communities.tsx b/packages/commonwealth/client/scripts/views/pages/Communities/Communities.tsx
index 248b4691ce8..29a449e9950 100644
--- a/packages/commonwealth/client/scripts/views/pages/Communities/Communities.tsx
+++ b/packages/commonwealth/client/scripts/views/pages/Communities/Communities.tsx
@@ -81,9 +81,25 @@ const CommunitiesPage = () => {
} = useFetchCommunitiesQuery({
limit: 50,
include_node_info: true,
- order_by:
- communitySortOptionsLabelToKeysMap[filters.withCommunitySortBy || ''] ||
- 'lifetime_thread_count',
+ order_by: (() => {
+ if (
+ filters.withCommunitySortBy &&
+ [
+ CommunitySortOptions.MemberCount,
+ CommunitySortOptions.ThreadCount,
+ CommunitySortOptions.MostRecent,
+ ].includes(filters.withCommunitySortBy)
+ ) {
+ return (
+ (communitySortOptionsLabelToKeysMap[
+ filters.withCommunitySortBy
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ ] as any) || 'lifetime_thread_count'
+ );
+ }
+
+ return 'lifetime_thread_count';
+ })(),
order_direction:
sortOrderLabelsToDirectionsMap[filters.withCommunitySortOrder || ''] ||
'DESC',
@@ -305,7 +321,7 @@ const CommunitiesPage = () => {
-
+
{tokenizedCommunityEnabled && Communities }
{isLoading && communitiesList.length === 0 ? (
diff --git a/packages/commonwealth/client/scripts/views/pages/Communities/FiltersDrawer/constants.ts b/packages/commonwealth/client/scripts/views/pages/Communities/FiltersDrawer/constants.ts
index 60bc037a217..cdfd76fcf2a 100644
--- a/packages/commonwealth/client/scripts/views/pages/Communities/FiltersDrawer/constants.ts
+++ b/packages/commonwealth/client/scripts/views/pages/Communities/FiltersDrawer/constants.ts
@@ -31,8 +31,8 @@ export const communitySortOptionsLabelToKeysMap = {
[CommunitySortOptions.MostRecent]: getPickedKeys(
Community.pick({ created_at: true }),
)[0],
- [CommunitySortOptions.MarketCap]: 'market_cap_current', // TODO: might need to update based on api @Tim?
- [CommunitySortOptions.Price]: 'latest_price',
+ [CommunitySortOptions.MarketCap]: 'market_cap', // this field doesn't exist on the tokens schema = hardcoding string
+ [CommunitySortOptions.Price]: 'price', // this field doesn't exist on the tokens schema = hardcoding string
[CommunitySortOptions.MemberCount]: getPickedKeys(
Community.pick({ profile_count: true }),
)[0],
diff --git a/packages/commonwealth/client/scripts/views/pages/Communities/TokensList/TokensList.tsx b/packages/commonwealth/client/scripts/views/pages/Communities/TokensList/TokensList.tsx
index a7b3200a13c..dde8c632640 100644
--- a/packages/commonwealth/client/scripts/views/pages/Communities/TokensList/TokensList.tsx
+++ b/packages/commonwealth/client/scripts/views/pages/Communities/TokensList/TokensList.tsx
@@ -14,13 +14,22 @@ import TradeTokenModal from 'views/modals/TradeTokenModel';
import { TradingMode } from 'views/modals/TradeTokenModel/TradeTokenForm/types';
import { z } from 'zod';
import TokenCard from '../../../components/TokenCard';
+import {
+ CommunityFilters,
+ CommunitySortOptions,
+ communitySortOptionsLabelToKeysMap,
+} from '../FiltersDrawer';
import './TokensList.scss';
const TokenWithCommunity = TokenView.extend({
community_id: z.string(),
});
-const TokensList = () => {
+type TokensListProps = {
+ filters: CommunityFilters;
+};
+
+const TokensList = ({ filters }: TokensListProps) => {
const navigate = useCommonNavigate();
const tokenizedCommunityEnabled = useFlag('tokenizedCommunity');
const [tokenLaunchModalConfig, setTokenLaunchModalConfig] = useState<{
@@ -42,6 +51,21 @@ const TokensList = () => {
cursor: 1,
limit: 8,
with_stats: true,
+ order_by: (() => {
+ if (
+ filters.withCommunitySortBy &&
+ [CommunitySortOptions.MarketCap, CommunitySortOptions.Price].includes(
+ filters.withCommunitySortBy,
+ )
+ ) {
+ return communitySortOptionsLabelToKeysMap[
+ filters.withCommunitySortBy
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ ] as any;
+ }
+
+ return undefined;
+ })(),
enabled: tokenizedCommunityEnabled,
});
const tokens = (tokensList?.pages || []).flatMap((page) => page.results);
From b05fbe2d253ce04b9d4c806f9801a24a9bd76328 Mon Sep 17 00:00:00 2001
From: Timothee Legros
Date: Tue, 19 Nov 2024 16:46:46 +0200
Subject: [PATCH 115/227] fix ordering query
---
libs/model/src/token/GetTokens.query.ts | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libs/model/src/token/GetTokens.query.ts b/libs/model/src/token/GetTokens.query.ts
index 0958d870e08..5389f1a93f4 100644
--- a/libs/model/src/token/GetTokens.query.ts
+++ b/libs/model/src/token/GetTokens.query.ts
@@ -71,7 +71,7 @@ export function GetTokens(): Query {
ON T.namespace = C.namespace
${includeStats ? 'LEFT JOIN trades ON trades.token_address = T.token_address' : ''}
${search ? 'WHERE LOWER(T.name) LIKE :search' : ''}
- ORDER BY ${order_col} :direction
+ ORDER BY ${order_col} ${direction}
LIMIT :limit OFFSET :offset
`;
@@ -86,6 +86,7 @@ export function GetTokens(): Query {
replacements,
type: QueryTypes.SELECT,
nest: true,
+ logging: console.log,
});
return schemas.buildPaginatedResponse(
From 82086f559ad9da4208b62d1df1bda43c1ddf47b9 Mon Sep 17 00:00:00 2001
From: Marcin
Date: Tue, 19 Nov 2024 15:53:08 +0100
Subject: [PATCH 116/227] fix abi
---
.../src/commonProtocol/abis/contestAbi.ts | 20 +++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/libs/shared/src/commonProtocol/abis/contestAbi.ts b/libs/shared/src/commonProtocol/abis/contestAbi.ts
index 89be46cde6d..35a068802f3 100644
--- a/libs/shared/src/commonProtocol/abis/contestAbi.ts
+++ b/libs/shared/src/commonProtocol/abis/contestAbi.ts
@@ -339,6 +339,26 @@ export const contestAbi = [
stateMutability: 'view',
type: 'function',
},
+ {
+ inputs: [],
+ name: 'contestLength',
+ outputs: [
+ {
+ internalType: 'uint256',
+ name: '',
+ type: 'uint256',
+ },
+ ],
+ stateMutability: 'view',
+ type: 'function',
+ },
+ {
+ inputs: [],
+ name: 'endContest',
+ outputs: [],
+ stateMutability: 'nonpayable',
+ type: 'function',
+ },
{
inputs: [],
name: 'newContest',
From d018f1335c49740fe46af276f18ccc766f8c4246 Mon Sep 17 00:00:00 2001
From: Marcin
Date: Tue, 19 Nov 2024 16:04:31 +0100
Subject: [PATCH 117/227] added flag
---
.../Contests/ContestsList/ContestCard/ContestCard.tsx | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Contests/ContestsList/ContestCard/ContestCard.tsx b/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Contests/ContestsList/ContestCard/ContestCard.tsx
index e692fa8996b..5c342416dc0 100644
--- a/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Contests/ContestsList/ContestCard/ContestCard.tsx
+++ b/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Contests/ContestsList/ContestCard/ContestCard.tsx
@@ -168,7 +168,12 @@ const ContestCard = ({
const hasVotes = score.length > 0;
const hasLessVotesThanPrizes = (payoutStructure || []).length > score.length;
+ // TODO remove this flag during the bacakend
+ // implementation in https://github.com/hicommonwealth/commonwealth/issues/9922
+ const showNoUpvotesWarningFlag = false;
+
const showNoUpvotesWarning =
+ showNoUpvotesWarningFlag &&
isActive &&
isAdmin &&
isLessThan24HoursLeft &&
From db9973ca57e47891bb4a224bc4cf4b8f1fec6d7e Mon Sep 17 00:00:00 2001
From: kassad
Date: Tue, 19 Nov 2024 07:30:24 -0800
Subject: [PATCH 118/227] Fixed profile count
---
libs/model/src/community/JoinCommunity.command.ts | 9 ++++-----
.../20241119145300-recompute-profile-counts.js | 13 +++++++++++++
.../server/util/verifySessionSignature.ts | 9 +++++++++
3 files changed, 26 insertions(+), 5 deletions(-)
create mode 100644 packages/commonwealth/server/migrations/20241119145300-recompute-profile-counts.js
diff --git a/libs/model/src/community/JoinCommunity.command.ts b/libs/model/src/community/JoinCommunity.command.ts
index 3c387b15898..d5baa55c1af 100644
--- a/libs/model/src/community/JoinCommunity.command.ts
+++ b/libs/model/src/community/JoinCommunity.command.ts
@@ -3,7 +3,6 @@ import * as schemas from '@hicommonwealth/schemas';
import { ChainBase, addressSwapper } from '@hicommonwealth/shared';
import { models } from '../database';
import { mustExist } from '../middleware/guards';
-import { incrementProfileCount } from '../utils';
import { findCompatibleAddress } from '../utils/findBaseAddress';
export const JoinCommunityErrors = {
@@ -102,11 +101,11 @@ export function JoinCommunity(): Command {
{ transaction },
);
- await incrementProfileCount(
- community.id,
- actor.user.id!,
+ await models.Community.increment('profile_count', {
+ by: 1,
+ where: { id: community_id },
transaction,
- );
+ });
return created.id!;
},
diff --git a/packages/commonwealth/server/migrations/20241119145300-recompute-profile-counts.js b/packages/commonwealth/server/migrations/20241119145300-recompute-profile-counts.js
new file mode 100644
index 00000000000..ca4d36ef3fc
--- /dev/null
+++ b/packages/commonwealth/server/migrations/20241119145300-recompute-profile-counts.js
@@ -0,0 +1,13 @@
+'use strict';
+
+/** @type {import('sequelize-cli').Migration} */
+module.exports = {
+ async up(queryInterface, Sequelize) {
+ await queryInterface.sequelize.query(`
+ UPDATE "Communities" C
+ SET profile_count = (SELECT COUNT(DISTINCT (user_id)) FROM "Addresses" WHERE community_id = C.id);
+ `);
+ },
+
+ async down(queryInterface, Sequelize) {},
+};
diff --git a/packages/commonwealth/server/util/verifySessionSignature.ts b/packages/commonwealth/server/util/verifySessionSignature.ts
index dcc44cb2604..746aa72d65c 100644
--- a/packages/commonwealth/server/util/verifySessionSignature.ts
+++ b/packages/commonwealth/server/util/verifySessionSignature.ts
@@ -91,8 +91,17 @@ const verifySessionSignature = async (
});
if (!user || !user.id) throw new Error('Failed to create user');
addressModel.user_id = user!.id;
+
+ await addressModel.save();
+ return;
}
}
+
+ // user already exists but new community joined
+ await incrementProfileCount(
+ addressModel.community_id!,
+ addressModel.user_id!,
+ );
} else {
// mark the address as verified
addressModel.verification_token_expires = null;
From c55bf4972a8b76cf95d69aca696b3f18d44a3588 Mon Sep 17 00:00:00 2001
From: rotorsoft
Date: Tue, 19 Nov 2024 10:33:21 -0500
Subject: [PATCH 119/227] add drain util
---
libs/model/src/user/index.ts | 1 +
.../test/referral/referral-lifecycle.spec.ts | 11 ++++-------
libs/model/test/utils/index.ts | 3 +++
libs/model/test/utils/outbox-drain.ts | 19 +++++++++++++++++++
4 files changed, 27 insertions(+), 7 deletions(-)
create mode 100644 libs/model/test/utils/index.ts
create mode 100644 libs/model/test/utils/outbox-drain.ts
diff --git a/libs/model/src/user/index.ts b/libs/model/src/user/index.ts
index 0a8ce0e5bd7..43c06a2e6c0 100644
--- a/libs/model/src/user/index.ts
+++ b/libs/model/src/user/index.ts
@@ -8,3 +8,4 @@ export * from './GetUserAddresses.query';
export * from './GetUserProfile.query';
export * from './SearchUserProfiles.query';
export * from './UpdateUser.command';
+export * from './UserReferrals.projection';
diff --git a/libs/model/test/referral/referral-lifecycle.spec.ts b/libs/model/test/referral/referral-lifecycle.spec.ts
index fccc9432243..f6b15436ac0 100644
--- a/libs/model/test/referral/referral-lifecycle.spec.ts
+++ b/libs/model/test/referral/referral-lifecycle.spec.ts
@@ -1,12 +1,12 @@
import { Actor, command, dispose } from '@hicommonwealth/core';
-import { models } from '@hicommonwealth/model';
import { ChainNode } from '@hicommonwealth/schemas';
import { ChainBase, ChainType } from '@hicommonwealth/shared';
import { afterAll, beforeAll, describe, expect, it } from 'vitest';
import { z } from 'zod';
import { CreateCommunity } from '../../src/community';
-import { CreateReferralLink } from '../../src/user';
-import { seedCommunity } from '../utils/community-seeder';
+import { models } from '../../src/database';
+import { CreateReferralLink, UserReferrals } from '../../src/user';
+import { drainOutbox, seedCommunity } from '../utils';
describe('Referral lifecycle', () => {
let admin: Actor;
@@ -51,10 +51,7 @@ describe('Referral lifecycle', () => {
},
});
- // drain the outbox
- // TODO: Create a testing utility to drain the outbox and push
- // the events to the predefined event handlers ... this is a simple
- // simulation of what the infrastructure would do in production
+ await drainOutbox(['CommunityCreated'], UserReferrals());
// get referrals
const referrals = await models.Referral.findAll({
diff --git a/libs/model/test/utils/index.ts b/libs/model/test/utils/index.ts
new file mode 100644
index 00000000000..f010d02c1c2
--- /dev/null
+++ b/libs/model/test/utils/index.ts
@@ -0,0 +1,3 @@
+export * from './canvas-signers';
+export * from './community-seeder';
+export * from './outbox-drain';
diff --git a/libs/model/test/utils/outbox-drain.ts b/libs/model/test/utils/outbox-drain.ts
new file mode 100644
index 00000000000..3aeb26f98af
--- /dev/null
+++ b/libs/model/test/utils/outbox-drain.ts
@@ -0,0 +1,19 @@
+import { Events, Projection, events } from '@hicommonwealth/core';
+import { ZodUndefined } from 'zod';
+
+type EventSchemas = typeof events;
+
+/**
+ * Drains the outbox: Simulates the outbox being drained by the infrastructure and
+ * pushing the events to a projection
+ */
+export async function drainOutbox(
+ events: E[],
+ projection: Projection<{ [Name in E]: EventSchemas[Name] }, ZodUndefined>,
+ from?: Date,
+) {
+ // TODO: implement this
+ // loads events from outbox starting from ?? a minute ago
+ // pushes events to projection
+ // ignore errors??? this is for testing only
+}
From e322b00cee1280987f3ed80d173f3a90fd892b8d Mon Sep 17 00:00:00 2001
From: rotorsoft
Date: Tue, 19 Nov 2024 10:46:05 -0500
Subject: [PATCH 120/227] avoid list warnings
---
libs/model/test/utils/outbox-drain.ts | 1 +
1 file changed, 1 insertion(+)
diff --git a/libs/model/test/utils/outbox-drain.ts b/libs/model/test/utils/outbox-drain.ts
index 3aeb26f98af..6a01fe270c5 100644
--- a/libs/model/test/utils/outbox-drain.ts
+++ b/libs/model/test/utils/outbox-drain.ts
@@ -16,4 +16,5 @@ export async function drainOutbox(
// loads events from outbox starting from ?? a minute ago
// pushes events to projection
// ignore errors??? this is for testing only
+ console.log(events, projection, from);
}
From 884a04b4f72d4a09f2188711f15054443cb33e56 Mon Sep 17 00:00:00 2001
From: Marcin
Date: Tue, 19 Nov 2024 16:54:44 +0100
Subject: [PATCH 121/227] wire up FE to BE
---
.../state/api/contests/getFarcasterCasts.ts | 87 ++-----------------
.../views/pages/ContestPage/ContestPage.tsx | 59 +++++--------
2 files changed, 28 insertions(+), 118 deletions(-)
diff --git a/packages/commonwealth/client/scripts/state/api/contests/getFarcasterCasts.ts b/packages/commonwealth/client/scripts/state/api/contests/getFarcasterCasts.ts
index 1840628dff6..2f71dec1696 100644
--- a/packages/commonwealth/client/scripts/state/api/contests/getFarcasterCasts.ts
+++ b/packages/commonwealth/client/scripts/state/api/contests/getFarcasterCasts.ts
@@ -1,93 +1,18 @@
-import { useInfiniteQuery } from '@tanstack/react-query';
import { SortType } from 'views/pages/ContestPage/ContestPage';
-
-const FARCASTER_CASTS_STALE_TIME = 30 * 1_000; // 30 s
+import { trpc } from '../../../utils/trpcClient';
interface FetchFarcasterCastsProps {
- contestAddress: string;
+ contest_address: string;
selectedSort: SortType;
- pageParam?: number;
}
-const mock = [
- 'https://warpcast.com/kugusha.eth/0x64be20bf',
- 'https://warpcast.com/antimofm.eth/0xd082a36c',
- 'https://warpcast.com/linda/0xa72c0daa',
- 'https://warpcast.com/jacob/0x8653763f',
-];
-
-// list of 40 mock data, with generated likes and index
-const entries = Array.from({ length: 40 }, () => ({
- url: mock[Math.floor(Math.random() * mock.length)],
- like: Math.floor(Math.random() * 100),
-})).map((el, i) => ({ ...el, id: i }));
-
-type ResType = {
- data: { url: string; id: number; like: number }[];
- currentPage: number;
- nextPage: number | null;
- previousPage: number | null;
- totalPages: number;
-};
-
-const fakeApi = ({
- pageParam,
- selectedSort,
-}: FetchFarcasterCastsProps): Promise => {
- const pageSize = 5;
- const totalItems = entries.length;
-
- const sortedEntries = entries.sort((a, b) => {
- return selectedSort === SortType.DESC ? b.like - a.like : a.like - b.like;
- });
-
- const currentPage = pageParam || 1;
- const startIndex = (currentPage - 1) * pageSize;
- const endIndex = Math.min(startIndex + pageSize, totalItems);
- const currentPageItems = sortedEntries.slice(startIndex, endIndex);
- const nextPage = endIndex < totalItems ? currentPage + 1 : null;
- const previousPage = currentPage > 1 ? currentPage - 1 : null;
- const totalPages = Math.ceil(totalItems / pageSize);
-
- return new Promise((resolve) =>
- setTimeout(
- () =>
- resolve({
- data: currentPageItems,
- currentPage,
- nextPage,
- previousPage,
- totalPages,
- }),
- 1000,
- ),
- );
-};
-
-const fetchFarcasterCasts = async ({
- pageParam = 0,
- selectedSort,
- contestAddress,
-}: FetchFarcasterCastsProps): Promise => {
- return await fakeApi({ pageParam, selectedSort, contestAddress });
-};
-
const useFetchFarcasterCastsQuery = ({
- contestAddress,
+ contest_address,
selectedSort,
}: FetchFarcasterCastsProps) => {
- return useInfiniteQuery({
- queryKey: ['farcasterCasts', contestAddress, selectedSort],
- queryFn: ({ pageParam = 1 }) =>
- fetchFarcasterCasts({ pageParam, selectedSort, contestAddress }),
- getNextPageParam: (lastPage) => {
- const nextPageNum = lastPage.currentPage + 1;
- if (nextPageNum <= lastPage.totalPages) {
- return nextPageNum;
- }
- return undefined;
- },
- staleTime: FARCASTER_CASTS_STALE_TIME,
+ return trpc.contest.getFarcasterCasts.useQuery({
+ contest_address,
+ sort_by: selectedSort,
});
};
diff --git a/packages/commonwealth/client/scripts/views/pages/ContestPage/ContestPage.tsx b/packages/commonwealth/client/scripts/views/pages/ContestPage/ContestPage.tsx
index ab5a0582216..a97f871fefe 100644
--- a/packages/commonwealth/client/scripts/views/pages/ContestPage/ContestPage.tsx
+++ b/packages/commonwealth/client/scripts/views/pages/ContestPage/ContestPage.tsx
@@ -1,34 +1,32 @@
import moment from 'moment';
-import React, { useEffect, useState } from 'react';
+import React, { useState } from 'react';
import { FarcasterEmbed } from 'react-farcaster-embed/dist/client';
import 'react-farcaster-embed/dist/styles.css';
-import { useInView } from 'react-intersection-observer';
+import useFetchFarcasterCastsQuery from 'state/api/contests/getFarcasterCasts';
import { Select } from 'views/components/Select';
+import { Skeleton } from 'views/components/Skeleton';
import { CWText } from 'views/components/component_kit/cw_text';
import CWPageLayout from 'views/components/component_kit/new_designs/CWPageLayout';
import { PageNotFound } from 'views/pages/404';
import ContestCard from 'views/pages/CommunityManagement/Contests/ContestsList/ContestCard';
import useCommunityContests from 'views/pages/CommunityManagement/Contests/useCommunityContests';
-import { useFetchFarcasterCastsQuery } from 'state/api/contests';
-import { Skeleton } from 'views/components/Skeleton';
-import CWCircleRingSpinner from 'views/components/component_kit/new_designs/CWCircleRingSpinner';
import './ContestPage.scss';
export enum SortType {
- DESC = 'desc',
- ASC = 'asc',
+ Likes = 'likes',
+ Recent = 'recent',
}
const sortOptions = [
{
- value: SortType.DESC,
- label: 'Descending',
+ value: SortType.Likes,
+ label: 'Most Liked',
},
{
- value: SortType.ASC,
- label: 'Ascending',
+ value: SortType.Recent,
+ label: 'Most Recent',
},
];
@@ -40,22 +38,16 @@ const ContestPage = ({ contestAddress }: ContestPageProps) => {
const { getContestByAddress, isContestDataLoading } = useCommunityContests();
const contest = getContestByAddress(contestAddress);
- const [ref, inView] = useInView();
-
- const [selectedSort, setSelectedSort] = useState(sortOptions[0].value);
+ const [selectedSort, setSelectedSort] = useState(
+ sortOptions[0].value,
+ );
- const { data, isLoading, isFetchingNextPage, fetchNextPage, hasNextPage } =
+ const { data: farcasterCasts, isLoading: isFarcasterCastsLoading } =
useFetchFarcasterCastsQuery({
- contestAddress,
+ contest_address: contestAddress,
selectedSort,
});
- useEffect(() => {
- if (inView && !isFetchingNextPage && hasNextPage) {
- fetchNextPage().catch(console.log);
- }
- }, [fetchNextPage, hasNextPage, inView, isFetchingNextPage]);
-
if (!isContestDataLoading && !contest) {
return ;
}
@@ -91,12 +83,12 @@ const ContestPage = ({ contestAddress }: ContestPageProps) => {
)}
- {isLoading ? (
+ {isFarcasterCastsLoading ? (
<>
>
- ) : data?.pages?.[0].data?.length === 0 ? (
+ ) : !farcasterCasts?.length ? (
No entries for the contest yet
) : (
<>
@@ -113,20 +105,13 @@ const ContestPage = ({ contestAddress }: ContestPageProps) => {
/>
- {data?.pages.map((page) => (
-
- {page.data.map((entry) => (
-
- Likes: {entry.like}
-
-
- ))}
-
+ {farcasterCasts[0].replies?.map((entry) => (
+
))}
-
- {isFetchingNextPage && }
-
-
>
)}
From dc49dc815373ace28ac99dafaa3894973faf0d14 Mon Sep 17 00:00:00 2001
From: Timothee Legros
Date: Tue, 19 Nov 2024 18:20:08 +0200
Subject: [PATCH 122/227] add GetToken
---
libs/model/src/token/GetToken.query.ts | 64 +++++++++++++++++++++++
libs/model/src/token/GetTokens.query.ts | 5 +-
libs/model/src/token/index.ts | 1 +
libs/schemas/src/queries/token.schemas.ts | 8 +++
packages/commonwealth/server/api/token.ts | 1 +
5 files changed, 76 insertions(+), 3 deletions(-)
create mode 100644 libs/model/src/token/GetToken.query.ts
diff --git a/libs/model/src/token/GetToken.query.ts b/libs/model/src/token/GetToken.query.ts
new file mode 100644
index 00000000000..0dfaa2041d5
--- /dev/null
+++ b/libs/model/src/token/GetToken.query.ts
@@ -0,0 +1,64 @@
+import { InvalidState, type Query } from '@hicommonwealth/core';
+import * as schemas from '@hicommonwealth/schemas';
+import { QueryTypes } from 'sequelize';
+import { z } from 'zod';
+import { models } from '../database';
+import { mustExist } from '../middleware/guards';
+
+export function GetToken(): Query {
+ return {
+ ...schemas.GetToken,
+ auth: [],
+ secure: false,
+ body: async ({ payload }) => {
+ const { community_id, with_stats } = payload;
+
+ const community = await models.Community.findOne({
+ where: {
+ id: community_id,
+ },
+ });
+ mustExist('Community', community);
+
+ if (!community.namespace) {
+ throw new InvalidState('Community namespace is not set');
+ }
+
+ const sql = `
+ ${
+ with_stats
+ ? `WITH latest_trades AS (SELECT DISTINCT ON (token_address) *
+ FROM "LaunchpadTrades"
+ ORDER BY token_address, timestamp DESC),
+ older_trades AS (SELECT DISTINCT ON (token_address) *
+ FROM "LaunchpadTrades"
+ WHERE timestamp >=
+ (SELECT EXTRACT(EPOCH FROM CURRENT_TIMESTAMP - INTERVAL '24 hours'))
+ ORDER BY token_address, timestamp ASC),
+ trades AS (SELECT lt.token_address,
+ lt.price as latest_price,
+ ot.price as old_price
+ FROM latest_trades lt
+ LEFT JOIN
+ older_trades ot ON lt.token_address = ot.token_address)`
+ : ''
+ }
+ SELECT T.*${with_stats ? ', trades.latest_price, trades.old_price' : ''}
+ FROM "Tokens" as T
+ WHERE T.namespace = :namespace;
+ `;
+
+ const token = await models.sequelize.query<
+ z.infer
+ >(sql, {
+ replacements: {
+ namespace: community.namespace,
+ },
+ type: QueryTypes.SELECT,
+ });
+ if (!token || !Array.isArray(token) || token.length !== 1) return;
+
+ return token[0];
+ },
+ };
+}
diff --git a/libs/model/src/token/GetTokens.query.ts b/libs/model/src/token/GetTokens.query.ts
index 5389f1a93f4..99f6353bdac 100644
--- a/libs/model/src/token/GetTokens.query.ts
+++ b/libs/model/src/token/GetTokens.query.ts
@@ -79,14 +79,13 @@ export function GetTokens(): Query {
z.infer & {
total?: number;
community_id: string;
- latest_price?: string;
- old_price?: string;
+ latest_price?: number;
+ old_price?: number;
}
>(sql, {
replacements,
type: QueryTypes.SELECT,
nest: true,
- logging: console.log,
});
return schemas.buildPaginatedResponse(
diff --git a/libs/model/src/token/index.ts b/libs/model/src/token/index.ts
index a9b097af0ec..a8f4af9ab6e 100644
--- a/libs/model/src/token/index.ts
+++ b/libs/model/src/token/index.ts
@@ -1,3 +1,4 @@
export * from './CreateLaunchpadTrade.command';
export * from './CreateToken.command';
+export * from './GetToken.query';
export * from './GetTokens.query';
diff --git a/libs/schemas/src/queries/token.schemas.ts b/libs/schemas/src/queries/token.schemas.ts
index 79fa7e624b9..8903742ea5f 100644
--- a/libs/schemas/src/queries/token.schemas.ts
+++ b/libs/schemas/src/queries/token.schemas.ts
@@ -18,3 +18,11 @@ export const GetTokens = {
results: TokenView.extend({ community_id: z.string() }).array(),
}),
};
+
+export const GetToken = {
+ input: z.object({
+ community_id: z.string(),
+ with_stats: z.boolean().optional(),
+ }),
+ output: z.union([TokenView, z.undefined()]),
+};
diff --git a/packages/commonwealth/server/api/token.ts b/packages/commonwealth/server/api/token.ts
index 3ad83c8ab60..c99abc0a29d 100644
--- a/packages/commonwealth/server/api/token.ts
+++ b/packages/commonwealth/server/api/token.ts
@@ -8,4 +8,5 @@ export const trpcRouter = trpc.router({
),
createToken: trpc.command(Token.CreateToken, trpc.Tag.Token),
getTokens: trpc.query(Token.GetTokens, trpc.Tag.Token),
+ getToken: trpc.query(Token.GetToken, trpc.Tag.Token),
});
From 61360995a6923174ddf8a53f9b010bacdb4e171f Mon Sep 17 00:00:00 2001
From: Timothee Legros
Date: Tue, 19 Nov 2024 18:35:08 +0200
Subject: [PATCH 123/227] fix unit test
---
libs/model/test/launchpad/launchpad.spec.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libs/model/test/launchpad/launchpad.spec.ts b/libs/model/test/launchpad/launchpad.spec.ts
index 3a1fac53029..d8f53b742b1 100644
--- a/libs/model/test/launchpad/launchpad.spec.ts
+++ b/libs/model/test/launchpad/launchpad.spec.ts
@@ -111,7 +111,7 @@ describe('Launchpad Lifecycle', () => {
trader_address: '0x2cE1F5d4f84B583Ab320cAc0948AddE52a131FBE',
is_buy: true,
community_token_amount: '534115082271506067334',
- price: '2507151',
+ price: 3.98859030778e-7,
floating_supply: '535115082271506067334',
timestamp: 1731523956,
});
From e16ac97e7ae9e430448f89edd7b0e609f1c22a89 Mon Sep 17 00:00:00 2001
From: Timothee Legros
Date: Tue, 19 Nov 2024 18:43:29 +0200
Subject: [PATCH 124/227] remove log
---
libs/model/src/token/CreateLaunchpadTrade.command.ts | 3 ---
1 file changed, 3 deletions(-)
diff --git a/libs/model/src/token/CreateLaunchpadTrade.command.ts b/libs/model/src/token/CreateLaunchpadTrade.command.ts
index e38fe5d3407..2f752e61348 100644
--- a/libs/model/src/token/CreateLaunchpadTrade.command.ts
+++ b/libs/model/src/token/CreateLaunchpadTrade.command.ts
@@ -58,9 +58,6 @@ export function CreateLaunchpadTrade(): Command<
throw new InvalidState('Transaction not found');
}
- console.log(
- `Eth amount: ${result.parsedArgs.ethAmount}, communityTokenAmount: ${result.parsedArgs.communityTokenAmount} --- ${result.parsedArgs.ethAmount / result.parsedArgs.communityTokenAmount}`,
- );
const trade = await models.LaunchpadTrade.create({
eth_chain_id,
transaction_hash,
From bb446b0a3c316c7ea7f5d0729b659672ac798994 Mon Sep 17 00:00:00 2001
From: rotorsoft
Date: Tue, 19 Nov 2024 12:00:28 -0500
Subject: [PATCH 125/227] implement drain
---
.../src/user/UserReferrals.projection.ts | 27 ++++++----------
.../test/referral/referral-lifecycle.spec.ts | 14 ++++++--
libs/model/test/utils/outbox-drain.ts | 32 +++++++++++++++----
3 files changed, 46 insertions(+), 27 deletions(-)
diff --git a/libs/model/src/user/UserReferrals.projection.ts b/libs/model/src/user/UserReferrals.projection.ts
index 30309758b3f..7a47c275f9a 100644
--- a/libs/model/src/user/UserReferrals.projection.ts
+++ b/libs/model/src/user/UserReferrals.projection.ts
@@ -1,8 +1,6 @@
-import { Projection, events, logger } from '@hicommonwealth/core';
+import { Projection, events } from '@hicommonwealth/core';
import { models } from '../database';
-const log = logger(import.meta);
-
const inputs = {
CommunityCreated: events.CommunityCreated,
};
@@ -14,21 +12,14 @@ export function UserReferrals(): Projection {
CommunityCreated: async ({ payload }) => {
const referral_link = payload.referralLink;
if (referral_link?.startsWith('ref_')) {
- try {
- const referrer_id = parseInt(referral_link.split('_').at(1)!);
- await models.Referral.create({
- referrer_id,
- referee_id: parseInt(payload.userId),
- event_name: 'CommunityCreated',
- event_payload: payload,
- created_at: new Date(),
- });
- } catch (e) {
- // TODO: should we do something else when we fail to create a referral?
- // Logging the error will allows us to manually fix the issue
- e instanceof Error &&
- log.error('Failed to project referral', e, payload);
- }
+ const referrer_id = parseInt(referral_link.split('_').at(1)!);
+ await models.Referral.create({
+ referrer_id,
+ referee_id: parseInt(payload.userId),
+ event_name: 'CommunityCreated',
+ event_payload: payload,
+ created_at: new Date(),
+ });
}
},
},
diff --git a/libs/model/test/referral/referral-lifecycle.spec.ts b/libs/model/test/referral/referral-lifecycle.spec.ts
index f6b15436ac0..529e1f4d82a 100644
--- a/libs/model/test/referral/referral-lifecycle.spec.ts
+++ b/libs/model/test/referral/referral-lifecycle.spec.ts
@@ -51,13 +51,23 @@ describe('Referral lifecycle', () => {
},
});
- await drainOutbox(['CommunityCreated'], UserReferrals());
+ await drainOutbox(['CommunityCreated'], UserReferrals);
// get referrals
+ // TODO: use query after implementing it
const referrals = await models.Referral.findAll({
where: { referee_id: member.user.id },
- order: [['created_at', 'DESC']],
});
+
expect(referrals.length).toBe(1);
+ expect(referrals[0].toJSON()).toMatchObject({
+ referrer_id: admin.user.id,
+ referee_id: member.user.id,
+ event_name: 'CommunityCreated',
+ event_payload: {
+ userId: member.user.id?.toString(),
+ communityId: id,
+ },
+ });
});
});
diff --git a/libs/model/test/utils/outbox-drain.ts b/libs/model/test/utils/outbox-drain.ts
index 6a01fe270c5..1168bca0786 100644
--- a/libs/model/test/utils/outbox-drain.ts
+++ b/libs/model/test/utils/outbox-drain.ts
@@ -1,5 +1,8 @@
-import { Events, Projection, events } from '@hicommonwealth/core';
+import { Events, Projection, events, handleEvent } from '@hicommonwealth/core';
+import { delay } from '@hicommonwealth/shared';
+import { Op } from 'sequelize';
import { ZodUndefined } from 'zod';
+import { models } from '../../src/database';
type EventSchemas = typeof events;
@@ -9,12 +12,27 @@ type EventSchemas = typeof events;
*/
export async function drainOutbox(
events: E[],
- projection: Projection<{ [Name in E]: EventSchemas[Name] }, ZodUndefined>,
+ factory: () => Projection<{ [Name in E]: EventSchemas[Name] }, ZodUndefined>,
from?: Date,
) {
- // TODO: implement this
- // loads events from outbox starting from ?? a minute ago
- // pushes events to projection
- // ignore errors??? this is for testing only
- console.log(events, projection, from);
+ const drained = await models.Outbox.findAll({
+ where: {
+ event_name: {
+ [Op.in]: events,
+ },
+ created_at: {
+ [Op.gte]: from ?? new Date(Date.now() - 1000 * 60 * 60 * 24 * 7),
+ },
+ },
+ });
+ const projection = factory();
+ for await (const { event_name, event_payload } of drained) {
+ handleEvent(projection, {
+ name: event_name,
+ payload: event_payload,
+ });
+ console.log(`>>> ${event_name} >>> ${factory.name}`);
+ }
+ // take a breather
+ await delay(500);
}
From 91590e12e29d4ec92f99ef417dc93e742606442b Mon Sep 17 00:00:00 2001
From: rotorsoft
Date: Tue, 19 Nov 2024 12:06:05 -0500
Subject: [PATCH 126/227] fix await
---
libs/model/test/utils/outbox-drain.ts | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libs/model/test/utils/outbox-drain.ts b/libs/model/test/utils/outbox-drain.ts
index 1168bca0786..4eab47b9d41 100644
--- a/libs/model/test/utils/outbox-drain.ts
+++ b/libs/model/test/utils/outbox-drain.ts
@@ -26,8 +26,8 @@ export async function drainOutbox(
},
});
const projection = factory();
- for await (const { event_name, event_payload } of drained) {
- handleEvent(projection, {
+ for (const { event_name, event_payload } of drained) {
+ await handleEvent(projection, {
name: event_name,
payload: event_payload,
});
From 35eec35220cfde272aaafa5f2fcced31dbc88c24 Mon Sep 17 00:00:00 2001
From: israellund
Date: Tue, 19 Nov 2024 13:13:55 -0500
Subject: [PATCH 127/227] made changes to stop undefined length error when
loading communities
---
packages/commonwealth/client/scripts/hooks/useTopicGating.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/packages/commonwealth/client/scripts/hooks/useTopicGating.ts b/packages/commonwealth/client/scripts/hooks/useTopicGating.ts
index 5eb80c682c1..7dd80f017ec 100644
--- a/packages/commonwealth/client/scripts/hooks/useTopicGating.ts
+++ b/packages/commonwealth/client/scripts/hooks/useTopicGating.ts
@@ -33,7 +33,7 @@ const useTopicGating = ({
acc.push(current);
// IMP: this logic can break if `PermissionEnum` or the `GroupPermissions`
// schema is changed substantially and might not give off a ts issue.
- } else if (current.permissions.length > existing.permissions.length) {
+ } else if (current?.permissions?.length > existing?.permissions?.length) {
// Replace with the current item if it has a longer permission string
const index = acc.indexOf(existing);
acc[index] = current;
From 6de243eff6c57f66f0d6353c0a6fdeb7c7d1c3bd Mon Sep 17 00:00:00 2001
From: Timothee Legros
Date: Tue, 19 Nov 2024 20:28:20 +0200
Subject: [PATCH 128/227] fix community deletion in relation to contests
---
.../src/community/DeleteCommunity.command.ts | 3 +-
libs/model/src/models/associations.ts | 2 +
.../20241119175513-add-cascade-delete.js | 62 +++++++++++++++++++
3 files changed, 66 insertions(+), 1 deletion(-)
create mode 100644 packages/commonwealth/server/migrations/20241119175513-add-cascade-delete.js
diff --git a/libs/model/src/community/DeleteCommunity.command.ts b/libs/model/src/community/DeleteCommunity.command.ts
index a990b21162c..490b7a7aa9a 100644
--- a/libs/model/src/community/DeleteCommunity.command.ts
+++ b/libs/model/src/community/DeleteCommunity.command.ts
@@ -108,14 +108,15 @@ export function DeleteCommunity(): Command {
const communityIdModels: ModelStatic<
ModelInstance<{ community_id: string }>
>[] = [
+ models.ContestManager,
models.CommunityAlert,
models.CommunityStake,
models.DiscordBotConfig,
- models.Topic,
models.Webhook,
models.Vote,
models.Poll,
models.Thread,
+ models.Topic,
models.StarredCommunity,
models.Group,
models.Address,
diff --git a/libs/model/src/models/associations.ts b/libs/model/src/models/associations.ts
index a1b597a91ae..2f71aaef9be 100644
--- a/libs/model/src/models/associations.ts
+++ b/libs/model/src/models/associations.ts
@@ -128,11 +128,13 @@ export const buildAssociations = (db: DB) => {
db.ContestManager.withMany(db.Contest, {
foreignKey: 'contest_address',
asMany: 'contests',
+ onDelete: 'CASCADE',
});
db.Contest.withMany(db.ContestAction, {
foreignKey: ['contest_address', 'contest_id'],
asMany: 'actions',
+ onDelete: 'CASCADE',
});
db.CommunityStake.withMany(db.StakeTransaction, {
diff --git a/packages/commonwealth/server/migrations/20241119175513-add-cascade-delete.js b/packages/commonwealth/server/migrations/20241119175513-add-cascade-delete.js
new file mode 100644
index 00000000000..2d9504870ce
--- /dev/null
+++ b/packages/commonwealth/server/migrations/20241119175513-add-cascade-delete.js
@@ -0,0 +1,62 @@
+'use strict';
+
+/** @type {import('sequelize-cli').Migration} */
+module.exports = {
+ async up(queryInterface, Sequelize) {
+ await queryInterface.sequelize.transaction(async (t) => {
+ await queryInterface.sequelize.query(
+ `
+ ALTER TABLE "ContestActions"
+ DROP CONSTRAINT "ContestActions_contests_fkey",
+ ADD CONSTRAINT "ContestActions_contests_fkey"
+ FOREIGN KEY (contest_address, contest_id)
+ REFERENCES "Contests" (contest_address, contest_id)
+ ON UPDATE NO ACTION
+ ON DELETE CASCADE;
+ `,
+ { transaction: t },
+ );
+
+ await queryInterface.sequelize.query(
+ `
+ ALTER TABLE "Contests"
+ DROP CONSTRAINT "Contests_contestmanagers_fkey",
+ ADD CONSTRAINT "Contests_contestmanagers_fkey"
+ FOREIGN KEY (contest_address)
+ REFERENCES "ContestManagers" (contest_address)
+ ON UPDATE NO ACTION
+ ON DELETE CASCADE;
+ `,
+ { transaction: t },
+ );
+ });
+ },
+
+ async down(queryInterface, Sequelize) {
+ await queryInterface.sequelize.transaction(async (t) => {
+ await queryInterface.sequelize.query(
+ `
+ ALTER TABLE "ContestActions"
+ DROP CONSTRAINT "ContestActions_contests_fkey",
+ ADD CONSTRAINT "ContestActions_contests_fkey"
+ FOREIGN KEY (contest_address, contest_id)
+ REFERENCES "Contests" (contest_address, contest_id)
+ ON DELETE NO ACTION;
+ `,
+ { transaction: t },
+ );
+
+ await queryInterface.sequelize.query(
+ `
+ ALTER TABLE "Contests"
+ DROP CONSTRAINT "Contests_contestmanagers_fkey",
+ ADD CONSTRAINT "Contests_contestmanagers_fkey"
+ FOREIGN KEY (contest_address)
+ REFERENCES "ContestManagers" (contest_address)
+ ON DELETE NO ACTION;
+ `,
+ { transaction: t },
+ );
+ });
+ },
+};
From e0955568418c4aa4e67d4ca2dfe0a920804883b1 Mon Sep 17 00:00:00 2001
From: Ryan Bennett
Date: Tue, 19 Nov 2024 11:45:00 -0800
Subject: [PATCH 129/227] fix improts
---
.../farcaster/frames/contest/contestCard.tsx | 35 ++++++++++++++++---
1 file changed, 30 insertions(+), 5 deletions(-)
diff --git a/packages/commonwealth/server/farcaster/frames/contest/contestCard.tsx b/packages/commonwealth/server/farcaster/frames/contest/contestCard.tsx
index 217b69a4ded..c52092e0acb 100644
--- a/packages/commonwealth/server/farcaster/frames/contest/contestCard.tsx
+++ b/packages/commonwealth/server/farcaster/frames/contest/contestCard.tsx
@@ -1,9 +1,7 @@
import { config } from '@hicommonwealth/core';
-import { models } from '@hicommonwealth/model';
+import { commonProtocol, models } from '@hicommonwealth/model';
import { Button } from 'frames.js/express';
import moment from 'moment';
-import { mustExist } from 'node_modules/@hicommonwealth/model/src/middleware/guards';
-import { getContestBalance } from 'node_modules/@hicommonwealth/model/src/services/commonProtocol/contestHelper';
import React from 'react';
import { frames } from '../../config';
@@ -56,11 +54,38 @@ export const contestCard = frames(async (ctx) => {
},
],
});
- mustExist('Contest Manager', contestManager);
+
+ if (!contestManager) {
+ return {
+ title: 'N/A',
+ image: (
+
+ ),
+ };
+ }
const chainNode = contestManager.Community!.ChainNode!;
const chainNodeUrl = chainNode.private_url! || chainNode.url!;
- const contestBalance = await getContestBalance(
+ const contestBalance = await commonProtocol.contestHelper.getContestBalance(
chainNodeUrl,
contestManager.contest_address,
contestManager.interval === 0,
From 55610a4110052fea44e3500ad7e19bffe1d5c9f2 Mon Sep 17 00:00:00 2001
From: Ryan Bennett
Date: Tue, 19 Nov 2024 11:52:35 -0800
Subject: [PATCH 130/227] update docs
---
common_knowledge/Farcaster-Contests.md | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/common_knowledge/Farcaster-Contests.md b/common_knowledge/Farcaster-Contests.md
index bb844dee659..bc95210aadc 100644
--- a/common_knowledge/Farcaster-Contests.md
+++ b/common_knowledge/Farcaster-Contests.md
@@ -34,7 +34,8 @@ Add these env vars to your .env file. Fill in the API key (ask a dev) and your o
```
FLAG_FARCASTER_CONTEST=true
-NEYNAR_API_KEY=
+NEYNAR_API_KEY=
+NEYNAR_CAST_CREATED_WEBHOOK_SECRET=
NEYNAR_REPLY_WEBHOOK_URL=https://YOUR_NGROK_DOMAIN/api/integration/farcaster/ReplyCastCreated
FARCASTER_ACTION_URL=https://YOUR_NGROK_DOMAIN/api/integration/farcaster/CastUpvoteAction
FARCASTER_NGROK_DOMAIN=https://YOUR_NGROK_DOMAIN
From 57c5d14def13fee913dd4f432f7f6d99b650a631 Mon Sep 17 00:00:00 2001
From: Ryan Bennett
Date: Wed, 20 Nov 2024 02:17:15 -0800
Subject: [PATCH 131/227] move query to seperate file
---
libs/model/src/contest/GetContest.query.ts | 32 +++++++++++++++++++
libs/model/src/contest/index.ts | 1 +
libs/schemas/src/queries/contests.schemas.ts | 6 ++--
.../farcaster/frames/contest/contestCard.tsx | 22 ++++---------
4 files changed, 43 insertions(+), 18 deletions(-)
create mode 100644 libs/model/src/contest/GetContest.query.ts
diff --git a/libs/model/src/contest/GetContest.query.ts b/libs/model/src/contest/GetContest.query.ts
new file mode 100644
index 00000000000..13d1dd74056
--- /dev/null
+++ b/libs/model/src/contest/GetContest.query.ts
@@ -0,0 +1,32 @@
+import { Query } from '@hicommonwealth/core';
+import * as schemas from '@hicommonwealth/schemas';
+import { models } from '../database';
+
+export function GetContest(): Query {
+ return {
+ ...schemas.GetContest,
+ auth: [],
+ secure: false,
+ body: async ({ payload }) => {
+ const include = payload.with_chain_node
+ ? [
+ {
+ model: models.Community,
+ include: [
+ {
+ model: models.ChainNode.scope('withPrivateData'),
+ },
+ ],
+ },
+ ]
+ : [];
+ const contestManager = await models.ContestManager.findOne({
+ where: {
+ contest_address: payload.contest_address,
+ },
+ include,
+ });
+ return contestManager;
+ },
+ };
+}
diff --git a/libs/model/src/contest/index.ts b/libs/model/src/contest/index.ts
index 760687a1f3d..445d9d5cf11 100644
--- a/libs/model/src/contest/index.ts
+++ b/libs/model/src/contest/index.ts
@@ -6,6 +6,7 @@ export * from './FarcasterReplyCastCreatedWebhook.command';
export * from './FarcasterUpvoteAction.command';
export * from './GetActiveContestManagers.query';
export * from './GetAllContests.query';
+export * from './GetContest.query';
export * from './GetContestLog.query';
export * from './GetFarcasterContestCasts';
export * from './GetFarcasterUpvoteActionMetadata.query';
diff --git a/libs/schemas/src/queries/contests.schemas.ts b/libs/schemas/src/queries/contests.schemas.ts
index b734feddf9c..9624129b359 100644
--- a/libs/schemas/src/queries/contests.schemas.ts
+++ b/libs/schemas/src/queries/contests.schemas.ts
@@ -21,15 +21,17 @@ export const GetAllContests = {
contest_address: z.string().optional(),
contest_id: z.number().int().optional(),
running: z.boolean().optional().describe('Only active contests'),
+ with_chain_node: z.string().optional(),
}),
output: z.array(ContestResults),
};
export const GetContest = {
input: z.object({
- contest_address: z.string().optional(),
+ contest_address: z.string(),
+ with_chain_node: z.boolean().optional(),
}),
- output: z.object({}).merge(ContestManager),
+ output: ContestManager.nullish(),
};
export const GetActiveContestManagers = {
diff --git a/packages/commonwealth/server/farcaster/frames/contest/contestCard.tsx b/packages/commonwealth/server/farcaster/frames/contest/contestCard.tsx
index c52092e0acb..76784ce3a27 100644
--- a/packages/commonwealth/server/farcaster/frames/contest/contestCard.tsx
+++ b/packages/commonwealth/server/farcaster/frames/contest/contestCard.tsx
@@ -1,7 +1,8 @@
-import { config } from '@hicommonwealth/core';
-import { commonProtocol, models } from '@hicommonwealth/model';
+import { command, config } from '@hicommonwealth/core';
+import { commonProtocol } from '@hicommonwealth/model';
import { Button } from 'frames.js/express';
import moment from 'moment';
+import { GetContest } from 'node_modules/@hicommonwealth/model/src/contest';
import React from 'react';
import { frames } from '../../config';
@@ -39,20 +40,9 @@ export const contestCard = frames(async (ctx) => {
const contest_address = ctx.url.pathname.split('/')[1];
- const contestManager = await models.ContestManager.findOne({
- where: {
- contest_address: contest_address,
- },
- include: [
- {
- model: models.Community,
- include: [
- {
- model: models.ChainNode.scope('withPrivateData'),
- },
- ],
- },
- ],
+ const contestManager = await command(GetContest(), {
+ actor: { user: { email: '' } },
+ payload: { contest_address, with_chain_node: true },
});
if (!contestManager) {
From be8c7d1c79012e8f8f5ee86d3bf616baf4a855b3 Mon Sep 17 00:00:00 2001
From: Ryan Bennett
Date: Wed, 20 Nov 2024 02:39:03 -0800
Subject: [PATCH 132/227] fix import
---
libs/schemas/src/queries/contests.schemas.ts | 8 ++++++--
.../server/farcaster/frames/contest/contestCard.tsx | 5 ++---
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/libs/schemas/src/queries/contests.schemas.ts b/libs/schemas/src/queries/contests.schemas.ts
index 9624129b359..49ab365057f 100644
--- a/libs/schemas/src/queries/contests.schemas.ts
+++ b/libs/schemas/src/queries/contests.schemas.ts
@@ -1,5 +1,5 @@
import { z } from 'zod';
-import { ContestManager } from '../entities';
+import { ChainNode, Community, ContestManager } from '../entities';
import { Contest, ContestAction } from '../projections';
import { PG_INT } from '../utils';
@@ -31,7 +31,11 @@ export const GetContest = {
contest_address: z.string(),
with_chain_node: z.boolean().optional(),
}),
- output: ContestManager.nullish(),
+ output: ContestManager.extend({
+ Community: Community.extend({
+ ChainNode: ChainNode.nullish(),
+ }).nullish(),
+ }).nullish(),
};
export const GetActiveContestManagers = {
diff --git a/packages/commonwealth/server/farcaster/frames/contest/contestCard.tsx b/packages/commonwealth/server/farcaster/frames/contest/contestCard.tsx
index 76784ce3a27..2352588c9c2 100644
--- a/packages/commonwealth/server/farcaster/frames/contest/contestCard.tsx
+++ b/packages/commonwealth/server/farcaster/frames/contest/contestCard.tsx
@@ -1,8 +1,7 @@
import { command, config } from '@hicommonwealth/core';
-import { commonProtocol } from '@hicommonwealth/model';
+import { Contest, commonProtocol } from '@hicommonwealth/model';
import { Button } from 'frames.js/express';
import moment from 'moment';
-import { GetContest } from 'node_modules/@hicommonwealth/model/src/contest';
import React from 'react';
import { frames } from '../../config';
@@ -40,7 +39,7 @@ export const contestCard = frames(async (ctx) => {
const contest_address = ctx.url.pathname.split('/')[1];
- const contestManager = await command(GetContest(), {
+ const contestManager = await command(Contest.GetContest(), {
actor: { user: { email: '' } },
payload: { contest_address, with_chain_node: true },
});
From 0ad4b787dd2b80001a4010919026c705c8bb1571 Mon Sep 17 00:00:00 2001
From: Marcin
Date: Wed, 20 Nov 2024 11:45:45 +0100
Subject: [PATCH 133/227] add prizes frame
---
.../farcaster/frames/contest/contestCard.tsx | 73 ++--------
.../frames/contest/contestPrizes.tsx | 134 ++++++++++++++++++
.../server/farcaster/frames/contest/index.ts | 3 +-
.../commonwealth/server/farcaster/router.tsx | 2 +
4 files changed, 149 insertions(+), 63 deletions(-)
create mode 100644 packages/commonwealth/server/farcaster/frames/contest/contestPrizes.tsx
diff --git a/packages/commonwealth/server/farcaster/frames/contest/contestCard.tsx b/packages/commonwealth/server/farcaster/frames/contest/contestCard.tsx
index c52092e0acb..ff765f4b6da 100644
--- a/packages/commonwealth/server/farcaster/frames/contest/contestCard.tsx
+++ b/packages/commonwealth/server/farcaster/frames/contest/contestCard.tsx
@@ -1,42 +1,11 @@
import { config } from '@hicommonwealth/core';
-import { commonProtocol, models } from '@hicommonwealth/model';
+import { models } from '@hicommonwealth/model';
import { Button } from 'frames.js/express';
-import moment from 'moment';
import React from 'react';
-import { frames } from '../../config';
-const PrizeRow = ({ index, prize }: { index: number; prize: number }) => {
- return (
-
-
- {moment.localeData().ordinal(index + 1)} Prize
-
-
- ETH {prize}
-
-
- );
-};
+import { frames } from '../../config';
export const contestCard = frames(async (ctx) => {
- // here we would need to be able to fetch data related to contest eg
- // image, title, description, prizes
- // check designs https://www.figma.com/design/NNqlhNPHvn0O96TCBIi6WU/Contests?node-id=960-3689&t=8ogN11dhaRqJP8ET-1
-
const contest_address = ctx.url.pathname.split('/')[1];
const contestManager = await models.ContestManager.findOne({
@@ -83,23 +52,6 @@ export const contestCard = frames(async (ctx) => {
};
}
- const chainNode = contestManager.Community!.ChainNode!;
- const chainNodeUrl = chainNode.private_url! || chainNode.url!;
- const contestBalance = await commonProtocol.contestHelper.getContestBalance(
- chainNodeUrl,
- contestManager.contest_address,
- contestManager.interval === 0,
- );
-
- const prizes =
- contestBalance && contestManager.payout_structure
- ? contestManager.payout_structure.map(
- (percentage) =>
- (Number(contestBalance) * (percentage / 100)) /
- Math.pow(10, contestManager.decimals || 18),
- )
- : [];
-
return {
title: contestManager.name,
image: (
@@ -133,17 +85,7 @@ export const contestCard = frames(async (ctx) => {
)}
- {contest_address}
-
- Current Prizes
-
- {prizes.length ? (
- prizes.map((prize, index) => (
-
- ))
- ) : (
- Contest has no prizes yet.
- )}
+ Check prizes below 👇
),
buttons: [
@@ -152,7 +94,14 @@ export const contestCard = frames(async (ctx) => {
action="link"
target={`${getBaseUrl()}/${contestManager.community_id}/contests/${contestManager.contest_address}`}
>
- View Leaderboard
+ Leaderboard
+ ,
+
+ Prizes
,
{
+ return (
+
+
+ {moment.localeData().ordinal(index + 1)} Prize
+
+
+ ETH {prize}
+
+
+ );
+};
+
+export const contestPrizes = frames(async (ctx) => {
+ const contest_address = ctx.url.pathname.split('/')[1];
+
+ const contestManager = await models.ContestManager.findOne({
+ where: {
+ contest_address: contest_address,
+ },
+ include: [
+ {
+ model: models.Community,
+ include: [
+ {
+ model: models.ChainNode.scope('withPrivateData'),
+ },
+ ],
+ },
+ ],
+ });
+
+ if (!contestManager) {
+ return {
+ title: 'N/A',
+ image: (
+
+ ),
+ };
+ }
+
+ const chainNode = contestManager.Community!.ChainNode!;
+ const chainNodeUrl = chainNode.private_url! || chainNode.url!;
+ const contestBalance = await commonProtocol.contestHelper.getContestBalance(
+ chainNodeUrl,
+ contestManager.contest_address,
+ contestManager.interval === 0,
+ );
+
+ const prizes =
+ contestBalance && contestBalance !== '0' && contestManager.payout_structure
+ ? contestManager.payout_structure.map(
+ (percentage) =>
+ (Number(contestBalance) * (percentage / 100)) /
+ Math.pow(10, contestManager.decimals || 18),
+ )
+ : [];
+
+ return {
+ title: contestManager.name,
+ image: (
+
+
Current Prizes
+
+ {prizes.length ? (
+ prizes.map((prize, index) => (
+
+ ))
+ ) : (
+
Contest has no prizes yet.
+ )}
+
+ ),
+ buttons: [
+
+ Back
+ ,
+ ],
+ };
+});
diff --git a/packages/commonwealth/server/farcaster/frames/contest/index.ts b/packages/commonwealth/server/farcaster/frames/contest/index.ts
index 7161cc14820..1c12ecbbd92 100644
--- a/packages/commonwealth/server/farcaster/frames/contest/index.ts
+++ b/packages/commonwealth/server/farcaster/frames/contest/index.ts
@@ -1,5 +1,6 @@
import { checkEligibility } from './checkEligibility';
import { contestCard } from './contestCard';
+import { contestPrizes } from './contestPrizes';
import { viewLeaderboard } from './viewLeaderboard';
-export { checkEligibility, contestCard, viewLeaderboard };
+export { checkEligibility, contestCard, contestPrizes, viewLeaderboard };
diff --git a/packages/commonwealth/server/farcaster/router.tsx b/packages/commonwealth/server/farcaster/router.tsx
index 8ee5ab79aa8..6595e4ca157 100644
--- a/packages/commonwealth/server/farcaster/router.tsx
+++ b/packages/commonwealth/server/farcaster/router.tsx
@@ -2,6 +2,7 @@ import express from 'express';
import {
checkEligibility,
contestCard,
+ contestPrizes,
viewLeaderboard,
} from './frames/contest';
import { resultGame, startGame } from './frames/gameExample';
@@ -11,6 +12,7 @@ const farcasterRouter = express.Router();
// WARNING: do not change these paths because cloudflare may route to it
farcasterRouter.get('/:contest_address/contestCard', contestCard);
farcasterRouter.post('/:contest_address/contestCard', contestCard);
+farcasterRouter.post('/:contest_address/contestPrizes', contestPrizes);
farcasterRouter.post('/:contest_address/viewLeaderboard', viewLeaderboard);
farcasterRouter.post('/:contest_address/checkEligibility', checkEligibility);
From f2091f2975878d23cd29bc207a9995127853fa11 Mon Sep 17 00:00:00 2001
From: Marcin
Date: Wed, 20 Nov 2024 11:51:28 +0100
Subject: [PATCH 134/227] cleanup
---
.../server/farcaster/frames/contest/index.ts | 3 +-
.../frames/contest/viewLeaderboard.tsx | 116 ------------------
.../farcaster/frames/gameExample/index.ts | 4 -
.../frames/gameExample/resultGame.tsx | 50 --------
.../frames/gameExample/startGame.tsx | 21 ----
.../commonwealth/server/farcaster/router.tsx | 13 +-
.../commonwealth/server/farcaster/utils.tsx | 85 -------------
7 files changed, 2 insertions(+), 290 deletions(-)
delete mode 100644 packages/commonwealth/server/farcaster/frames/contest/viewLeaderboard.tsx
delete mode 100644 packages/commonwealth/server/farcaster/frames/gameExample/index.ts
delete mode 100644 packages/commonwealth/server/farcaster/frames/gameExample/resultGame.tsx
delete mode 100644 packages/commonwealth/server/farcaster/frames/gameExample/startGame.tsx
diff --git a/packages/commonwealth/server/farcaster/frames/contest/index.ts b/packages/commonwealth/server/farcaster/frames/contest/index.ts
index 1c12ecbbd92..b8d2006e5d0 100644
--- a/packages/commonwealth/server/farcaster/frames/contest/index.ts
+++ b/packages/commonwealth/server/farcaster/frames/contest/index.ts
@@ -1,6 +1,5 @@
import { checkEligibility } from './checkEligibility';
import { contestCard } from './contestCard';
import { contestPrizes } from './contestPrizes';
-import { viewLeaderboard } from './viewLeaderboard';
-export { checkEligibility, contestCard, contestPrizes, viewLeaderboard };
+export { checkEligibility, contestCard, contestPrizes };
diff --git a/packages/commonwealth/server/farcaster/frames/contest/viewLeaderboard.tsx b/packages/commonwealth/server/farcaster/frames/contest/viewLeaderboard.tsx
deleted file mode 100644
index 5cacca8fb3b..00000000000
--- a/packages/commonwealth/server/farcaster/frames/contest/viewLeaderboard.tsx
+++ /dev/null
@@ -1,116 +0,0 @@
-import { error } from 'frames.js/core';
-import { Button } from 'frames.js/express';
-import React from 'react';
-import { frames } from '../../config';
-import { getInvertedColor, getLeaderboard, getRandomColor } from '../../utils';
-
-const randomColor = getRandomColor();
-const invertedColor = getInvertedColor(randomColor);
-
-export const viewLeaderboard = frames(async (ctx) => {
- const fromMain = ctx.searchParams.fromMain;
-
- let leaderboardEntries;
-
- try {
- leaderboardEntries = await getLeaderboard();
- } catch (err) {
- console.log('error', err);
- return error('Something went wrong');
- }
-
- const noEntries = leaderboardEntries.length === 0;
- const entry = leaderboardEntries[0];
-
- const contest_address = ctx.url.pathname.split('/')[1];
-
- return {
- image: (
-
- {noEntries ? (
-
No entries yet
- ) : (
-
-
- {entry.nickname.charAt(0).toUpperCase()}
-
-
-
- {entry.nickname}
-
-
-
{entry.text}
-
{entry.likes} Likes
-
- )}
-
- ),
- buttons: [
- ...(noEntries
- ? []
- : [
- ...(fromMain
- ? []
- : [
-
- ◀
- ,
- ]),
-
- ▶
- ,
- ]),
-
- View Cast
- ,
- ],
- };
-});
diff --git a/packages/commonwealth/server/farcaster/frames/gameExample/index.ts b/packages/commonwealth/server/farcaster/frames/gameExample/index.ts
deleted file mode 100644
index 29197ff35c2..00000000000
--- a/packages/commonwealth/server/farcaster/frames/gameExample/index.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-import { resultGame } from './resultGame';
-import { startGame } from './startGame';
-
-export { resultGame, startGame };
diff --git a/packages/commonwealth/server/farcaster/frames/gameExample/resultGame.tsx b/packages/commonwealth/server/farcaster/frames/gameExample/resultGame.tsx
deleted file mode 100644
index dc30177cac5..00000000000
--- a/packages/commonwealth/server/farcaster/frames/gameExample/resultGame.tsx
+++ /dev/null
@@ -1,50 +0,0 @@
-import { Button } from 'frames.js/express';
-import React from 'react';
-import { frames } from '../../config';
-import { CardWithText } from '../../utils';
-
-export const resultGame = frames(async (ctx) => {
- const rand = Math.floor(Math.random() * 3);
- const choices = ['Rock', 'Paper', 'Scissors'];
- const userChoice = choices[(Number(ctx.pressedButton?.index) || 1) - 1];
- const computerChoice = choices[rand];
- let msg = '';
-
- if (userChoice === computerChoice) {
- msg = 'Draw ⚖️';
- }
-
- if (
- (userChoice === 'Rock' && computerChoice === 'Scissors') ||
- (userChoice === 'Paper' && computerChoice === 'Rock') ||
- (userChoice === 'Scissors' && computerChoice === 'Paper')
- ) {
- msg = 'You win 🏆';
- }
-
- if (
- (userChoice === 'Rock' && computerChoice === 'Paper') ||
- (userChoice === 'Paper' && computerChoice === 'Scissors') ||
- (userChoice === 'Scissors' && computerChoice === 'Rock')
- ) {
- msg = 'You lose 😩';
- }
-
- const color = msg.includes('Draw')
- ? 'lightgray'
- : msg.includes('win')
- ? 'lightgreen'
- : 'lightpink';
-
- return {
- image: CardWithText({
- text: `${userChoice} vs ${computerChoice}: ${msg}`,
- color,
- }),
- buttons: [
-
- Play again 🔄
- ,
- ],
- };
-});
diff --git a/packages/commonwealth/server/farcaster/frames/gameExample/startGame.tsx b/packages/commonwealth/server/farcaster/frames/gameExample/startGame.tsx
deleted file mode 100644
index 8420d119c4a..00000000000
--- a/packages/commonwealth/server/farcaster/frames/gameExample/startGame.tsx
+++ /dev/null
@@ -1,21 +0,0 @@
-import { Button } from 'frames.js/express';
-import React from 'react';
-import { frames } from '../../config';
-import { CardWithText } from '../../utils';
-
-export const startGame = frames(async () => {
- return {
- image: CardWithText({ text: 'Choose your weapon 🥊' }),
- buttons: [
-
- Rock 🪨
- ,
-
- Paper 📄
- ,
-
- Scissors ✂️
- ,
- ],
- };
-});
diff --git a/packages/commonwealth/server/farcaster/router.tsx b/packages/commonwealth/server/farcaster/router.tsx
index 6595e4ca157..a7c4701d413 100644
--- a/packages/commonwealth/server/farcaster/router.tsx
+++ b/packages/commonwealth/server/farcaster/router.tsx
@@ -1,11 +1,5 @@
import express from 'express';
-import {
- checkEligibility,
- contestCard,
- contestPrizes,
- viewLeaderboard,
-} from './frames/contest';
-import { resultGame, startGame } from './frames/gameExample';
+import { checkEligibility, contestCard, contestPrizes } from './frames/contest';
const farcasterRouter = express.Router();
@@ -13,11 +7,6 @@ const farcasterRouter = express.Router();
farcasterRouter.get('/:contest_address/contestCard', contestCard);
farcasterRouter.post('/:contest_address/contestCard', contestCard);
farcasterRouter.post('/:contest_address/contestPrizes', contestPrizes);
-farcasterRouter.post('/:contest_address/viewLeaderboard', viewLeaderboard);
farcasterRouter.post('/:contest_address/checkEligibility', checkEligibility);
-farcasterRouter.get('/:contest_address/game', startGame);
-farcasterRouter.post('/:contest_address/game', startGame);
-farcasterRouter.post('/:contest_address/result', resultGame);
-
export default farcasterRouter;
diff --git a/packages/commonwealth/server/farcaster/utils.tsx b/packages/commonwealth/server/farcaster/utils.tsx
index ea576eae558..b0055f40d0a 100644
--- a/packages/commonwealth/server/farcaster/utils.tsx
+++ b/packages/commonwealth/server/farcaster/utils.tsx
@@ -3,49 +3,6 @@ import { Contest, config } from '@hicommonwealth/model';
import { NeynarAPIClient } from '@neynar/nodejs-sdk';
import React from 'react';
-// This might not be needed in the future but for now reduces the amount of boilerplate
-export const CardWithText = ({
- text,
- color,
- element,
-}: {
- text?: string;
- color?: string;
- element?: React.ReactNode;
-}) => {
- return (
-
-
- {element || text}
-
-
- );
-};
-
export const circleCheckIcon = (
);
-export const fakeApiCall = async ({
- result,
- error,
-}: {
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- result?: any;
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- error?: any;
-}) => {
- return new Promise((resolve, reject) => {
- setTimeout(() => {
- if (!error) {
- return resolve(result);
- }
-
- if (Math.random() > 0.5) {
- return resolve(result);
- } else {
- return reject(error);
- }
- }, 1000);
- });
-};
-
-export const getLeaderboard = () => {
- const sortedList = Array.from({ length: 10 }, (_, index) => ({
- nickname: `Author${index + 1}`,
- text: `This is entry text ${index + 1}`,
- likes: Math.floor(Math.random() * 100),
- }))
- .sort((a, b) => b.likes - a.likes)
- .slice(0, 5);
-
- return fakeApiCall({ result: sortedList });
-};
-
-export const getRandomColor = () =>
- Math.floor(Math.random() * 16777215).toString(16);
-
-export const getInvertedColor = (randomColor: string) =>
- (parseInt(randomColor, 16) ^ 16777215).toString(16);
-
export const getFarcasterUser = async (fid: number) => {
const client = new NeynarAPIClient(config.CONTESTS.NEYNAR_API_KEY!);
const farcasterUser = await client.fetchBulkUsers([fid]);
From f605a2ba2d675a3963a2c7c2cc45dee491178171 Mon Sep 17 00:00:00 2001
From: Marcin
Date: Wed, 20 Nov 2024 12:16:13 +0100
Subject: [PATCH 135/227] add ticker
---
.../frames/contest/contestPrizes.tsx | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/packages/commonwealth/server/farcaster/frames/contest/contestPrizes.tsx b/packages/commonwealth/server/farcaster/frames/contest/contestPrizes.tsx
index 47b2d4deac8..4c0b2b367c3 100644
--- a/packages/commonwealth/server/farcaster/frames/contest/contestPrizes.tsx
+++ b/packages/commonwealth/server/farcaster/frames/contest/contestPrizes.tsx
@@ -4,7 +4,15 @@ import moment from 'moment';
import React from 'react';
import { frames } from '../../config';
-const PrizeRow = ({ index, prize }: { index: number; prize: number }) => {
+const PrizeRow = ({
+ index,
+ prize,
+ ticker = 'ETH',
+}: {
+ index: number;
+ prize: number;
+ ticker?: string;
+}) => {
return (
{
textShadow: '0px 0px 3px white',
}}
>
- ETH {prize}
+ {ticker} {prize}
);
@@ -114,7 +122,12 @@ export const contestPrizes = frames(async (ctx) => {
{prizes.length ? (
prizes.map((prize, index) => (
-
+
))
) : (
Contest has no prizes yet.
From ca52d8bc085d01e3fbc8d88a7925b01b9c9534ff Mon Sep 17 00:00:00 2001
From: Marcin
Date: Wed, 20 Nov 2024 12:44:51 +0100
Subject: [PATCH 136/227] fix editing contest
---
libs/model/src/contest/GetAllContests.query.ts | 2 ++
.../Contests/ContestsList/ContestCard/ContestCard.tsx | 7 ++++++-
.../steps/DetailsFormStep/DetailsFormStep.tsx | 1 +
.../Contests/ManageContest/useManageContestForm.ts | 1 +
4 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/libs/model/src/contest/GetAllContests.query.ts b/libs/model/src/contest/GetAllContests.query.ts
index 168310de252..4c1a128d1a7 100644
--- a/libs/model/src/contest/GetAllContests.query.ts
+++ b/libs/model/src/contest/GetAllContests.query.ts
@@ -26,6 +26,7 @@ select
cm.created_at,
cm.name,
cm.image_url,
+ cm.description,
cm.funding_token_address,
cm.prize_percentage,
cm.payout_structure,
@@ -84,6 +85,7 @@ group by
cm.created_at,
cm.name,
cm.image_url,
+ cm.description,
cm.funding_token_address,
cm.prize_percentage,
cm.payout_structure,
diff --git a/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Contests/ContestsList/ContestCard/ContestCard.tsx b/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Contests/ContestsList/ContestCard/ContestCard.tsx
index 5c342416dc0..af4ce900dbb 100644
--- a/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Contests/ContestsList/ContestCard/ContestCard.tsx
+++ b/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Contests/ContestsList/ContestCard/ContestCard.tsx
@@ -22,6 +22,7 @@ import { SharePopoverOld } from 'views/components/share_popover_old';
import { capDecimals } from 'views/modals/ManageCommunityStakeModal/utils';
import { openConfirmation } from 'views/modals/confirmation_modal';
+import { ContestType } from '../../types';
import { copyFarcasterContestFrameUrl, isContestActive } from '../../utils';
import ContestAlert from '../ContestAlert';
import ContestCountdown from '../ContestCountdown';
@@ -142,7 +143,11 @@ const ContestCard = ({
};
const handleEditContest = () => {
- navigate(`/manage/contests/${address}`);
+ navigate(
+ `/manage/contests/${address}${
+ isFarcaster ? `?type=${ContestType.Farcaster}` : ''
+ }`,
+ );
};
const handleLeaderboardClick = () => {
diff --git a/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Contests/ManageContest/steps/DetailsFormStep/DetailsFormStep.tsx b/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Contests/ManageContest/steps/DetailsFormStep/DetailsFormStep.tsx
index ad19005bf40..1025bbdf942 100644
--- a/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Contests/ManageContest/steps/DetailsFormStep/DetailsFormStep.tsx
+++ b/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Contests/ManageContest/steps/DetailsFormStep/DetailsFormStep.tsx
@@ -214,6 +214,7 @@ const DetailsFormStep = ({
contest_address: contestAddress,
name: values.contestName,
image_url: values.contestImage,
+ description: values.contestDescription,
});
goBack();
diff --git a/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Contests/ManageContest/useManageContestForm.ts b/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Contests/ManageContest/useManageContestForm.ts
index 67d1f701a7d..b4f49bc7240 100644
--- a/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Contests/ManageContest/useManageContestForm.ts
+++ b/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Contests/ManageContest/useManageContestForm.ts
@@ -34,6 +34,7 @@ const useManageContestForm = ({
setContestFormData({
contestName: contestData.name,
contestImage: contestData.image_url!,
+ contestDescription: contestData.description ?? '',
contestTopic: {
value: contestData.topics[0]?.id,
label: contestData.topics[0]?.name,
From e828a99a94af679a9f4630725fad5f562c9704a5 Mon Sep 17 00:00:00 2001
From: Marcin
Date: Wed, 20 Nov 2024 12:48:48 +0100
Subject: [PATCH 137/227] fix line height
---
.../server/farcaster/frames/contest/contestCard.tsx | 2 ++
1 file changed, 2 insertions(+)
diff --git a/packages/commonwealth/server/farcaster/frames/contest/contestCard.tsx b/packages/commonwealth/server/farcaster/frames/contest/contestCard.tsx
index 3484a46e4d2..7173f3c4cdc 100644
--- a/packages/commonwealth/server/farcaster/frames/contest/contestCard.tsx
+++ b/packages/commonwealth/server/farcaster/frames/contest/contestCard.tsx
@@ -58,6 +58,7 @@ export const contestCard = frames(async (ctx) => {
>
@@ -68,6 +69,7 @@ export const contestCard = frames(async (ctx) => {
{contestManager.description}
From 69b1a592fd5b7914b79a8ed486ba34bfcdddd623 Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Wed, 20 Nov 2024 17:13:15 +0500
Subject: [PATCH 138/227] Added query to get token by community id
---
.../state/api/tokens/getTokenByCommunityId.ts | 28 +++++++++++++++++
.../client/scripts/state/api/tokens/index.ts | 2 ++
.../CommunitySection/CommunitySection.tsx | 31 ++++++-------------
3 files changed, 39 insertions(+), 22 deletions(-)
create mode 100644 packages/commonwealth/client/scripts/state/api/tokens/getTokenByCommunityId.ts
diff --git a/packages/commonwealth/client/scripts/state/api/tokens/getTokenByCommunityId.ts b/packages/commonwealth/client/scripts/state/api/tokens/getTokenByCommunityId.ts
new file mode 100644
index 00000000000..6ffe7f76144
--- /dev/null
+++ b/packages/commonwealth/client/scripts/state/api/tokens/getTokenByCommunityId.ts
@@ -0,0 +1,28 @@
+import { GetToken } from '@hicommonwealth/schemas';
+import { trpc } from 'utils/trpcClient';
+import { z } from 'zod';
+
+const FETCH_TOKEN_STALE_TIME = 60 * 3_000; // 3 mins
+
+type UseFetchTokensProps = z.infer & {
+ enabled?: boolean;
+};
+
+const useGetTokenByCommunityId = ({
+ community_id,
+ with_stats = true,
+ enabled,
+}: UseFetchTokensProps) => {
+ return trpc.token.getToken.useInfiniteQuery(
+ {
+ community_id,
+ with_stats,
+ },
+ {
+ staleTime: FETCH_TOKEN_STALE_TIME,
+ enabled,
+ },
+ );
+};
+
+export default useGetTokenByCommunityId;
diff --git a/packages/commonwealth/client/scripts/state/api/tokens/index.ts b/packages/commonwealth/client/scripts/state/api/tokens/index.ts
index ecc6cd75596..ee076807a53 100644
--- a/packages/commonwealth/client/scripts/state/api/tokens/index.ts
+++ b/packages/commonwealth/client/scripts/state/api/tokens/index.ts
@@ -3,6 +3,7 @@ import useCreateTokenTradeMutation from './createTokenTrade';
import useFetchTokensQuery from './fetchTokens';
import useGetERC20BalanceQuery from './getERC20Balance';
import useTokenBalanceQuery from './getTokenBalance';
+import useGetTokenByCommunityId from './getTokenByCommunityId';
import useTokenMetadataQuery from './getTokenMetadata';
export {
@@ -10,6 +11,7 @@ export {
useCreateTokenTradeMutation,
useFetchTokensQuery,
useGetERC20BalanceQuery,
+ useGetTokenByCommunityId,
useTokenBalanceQuery,
useTokenMetadataQuery,
};
diff --git a/packages/commonwealth/client/scripts/views/components/sidebar/CommunitySection/CommunitySection.tsx b/packages/commonwealth/client/scripts/views/components/sidebar/CommunitySection/CommunitySection.tsx
index 234a2973ffe..063a416421c 100644
--- a/packages/commonwealth/client/scripts/views/components/sidebar/CommunitySection/CommunitySection.tsx
+++ b/packages/commonwealth/client/scripts/views/components/sidebar/CommunitySection/CommunitySection.tsx
@@ -1,10 +1,10 @@
-import { TokenView } from '@hicommonwealth/schemas';
import 'components/sidebar/CommunitySection/CommunitySection.scss';
import { findDenominationString } from 'helpers/findDenomination';
import { useFlag } from 'hooks/useFlag';
import React from 'react';
import app from 'state';
import { useFetchCustomDomainQuery } from 'state/api/configuration';
+import { useGetTokenByCommunityId } from 'state/api/tokens';
import { useCommunityAlertsQuery } from 'state/api/trpc/subscription/useCommunityAlertsQuery';
import useUserStore from 'state/ui/user';
import {
@@ -17,7 +17,6 @@ import { getUniqueTopicIdsIncludedInActiveContest } from 'views/components/sideb
import { SubscriptionButton } from 'views/components/subscription_button';
import ManageCommunityStakeModal from 'views/modals/ManageCommunityStakeModal/ManageCommunityStakeModal';
import useCommunityContests from 'views/pages/CommunityManagement/Contests/useCommunityContests';
-import { z } from 'zod';
import useManageCommunityStakeModalStore from '../../../../state/ui/modals/manageCommunityStakeModal';
import Permissions from '../../../../utils/Permissions';
import AccountConnectionIndicator from '../AccountConnectionIndicator';
@@ -58,28 +57,16 @@ export const CommunitySection = ({ showSkeleton }: CommunitySectionProps) => {
const { isContestAvailable, isContestDataLoading, contestsData } =
useCommunityContests();
- // TODO: need api to get token per community;
- const communityToken = {
- token_address: '0xa40d9517de7e6536ccbbf6df45a1ad12fe2d040c',
- namespace: 'TikTokTulipMania',
- name: 'TikTokTulipMania',
- symbol: 'TTTMN',
- initial_supply: '1000000000000000000000000000',
- liquidity_transferred: false,
- launchpad_liquidity: '430000000000000000000000000',
- eth_market_cap_target: 29.447347142468825,
- icon_url:
- 'https://s3.amazonaws.com/local.assets/de0e4788-8abe-436b-84cc-7f83a2f6cb5f.png',
- // eslint-disable-next-line max-len
- description: `TikTokTulipMania: Because nothing says "investment" like fleeting trends and historical economic collapses. Dive in, it's only pixels! 🌷💸`,
- created_at: '2024-11-18T19:28:15.103Z',
- updated_at: '2024-11-18T19:28:15.103Z',
- community_id: 'tiktoktulipmania-tttmn-community',
- } as unknown as z.infer;
- const isLoadingToken = false;
-
const { data: domain } = useFetchCustomDomainQuery();
+ const communityId = app.activeChainId() || '';
+ const { data: communityToken, isLoading: isLoadingToken } =
+ useGetTokenByCommunityId({
+ community_id: communityId,
+ with_stats: true,
+ enabled: !!communityId,
+ });
+
const topicIdsIncludedInContest = getUniqueTopicIdsIncludedInActiveContest(
contestsData.all,
);
From 08745429625f534a7dedbd803498d5d334d35a1b Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Wed, 20 Nov 2024 18:07:40 +0500
Subject: [PATCH 139/227] Prevent user from leaving trades modal when any
action is pending
---
.../views/modals/TradeTokenModel/TradeTokenModal.tsx | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.tsx b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.tsx
index 8fc4627c467..cf9872d92c6 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.tsx
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenModal.tsx
@@ -1,4 +1,5 @@
import { SupportedCurrencies } from 'helpers/currency';
+import useBeforeUnload from 'hooks/useBeforeUnload';
import React from 'react';
import { CWText } from '../../components/component_kit/cw_text';
import {
@@ -40,10 +41,12 @@ const TradeTokenModal = ({
},
);
+ useBeforeUnload(isActionPending);
+
return (
onModalClose?.()}
+ onClose={() => !isActionPending && onModalClose?.()}
size="medium"
className="TradeTokenModal"
content={
@@ -57,7 +60,7 @@ const TradeTokenModal = ({
)}
}
- onModalClose={() => onModalClose?.()}
+ onModalClose={() => !isActionPending && onModalClose?.()}
/>
Date: Wed, 20 Nov 2024 18:08:48 +0500
Subject: [PATCH 140/227] Only show draft clear message when there are more
than 1 token drafts
---
.../IdeaLaunchpad/QuickTokenLaunchForm/QuickTokenLaunchForm.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/packages/commonwealth/client/scripts/views/pages/Communities/IdeaLaunchpad/QuickTokenLaunchForm/QuickTokenLaunchForm.tsx b/packages/commonwealth/client/scripts/views/pages/Communities/IdeaLaunchpad/QuickTokenLaunchForm/QuickTokenLaunchForm.tsx
index 5c524629d7f..0b9154a6f8f 100644
--- a/packages/commonwealth/client/scripts/views/pages/Communities/IdeaLaunchpad/QuickTokenLaunchForm/QuickTokenLaunchForm.tsx
+++ b/packages/commonwealth/client/scripts/views/pages/Communities/IdeaLaunchpad/QuickTokenLaunchForm/QuickTokenLaunchForm.tsx
@@ -306,7 +306,7 @@ export const QuickTokenLaunchForm = ({
};
const handleSubmit = (tokenInfo: FormSubmitValues) => {
- if (tokenIdeas.length > 0) {
+ if (tokenIdeas.length > 1) {
// if there are multiple drafts, then confirm from user if they want to proceed with
// active draft and discard the others
triggerDiscardExtraTokenDraftsConfirmation(() =>
From 6a2e0ff6cfccecb5c2a0a781bdf7ac54ef6b5605 Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Wed, 20 Nov 2024 18:10:31 +0500
Subject: [PATCH 141/227] Require auth before opening quick token launch form
---
.../useDeferredConditionTriggerCallback.ts | 59 +++++++++++++++++++
.../IdeaLaunchpad/IdeaLaunchpad.tsx | 40 +++++++++++--
2 files changed, 95 insertions(+), 4 deletions(-)
create mode 100644 packages/commonwealth/client/scripts/hooks/useDeferredConditionTriggerCallback.ts
diff --git a/packages/commonwealth/client/scripts/hooks/useDeferredConditionTriggerCallback.ts b/packages/commonwealth/client/scripts/hooks/useDeferredConditionTriggerCallback.ts
new file mode 100644
index 00000000000..17225a69d0f
--- /dev/null
+++ b/packages/commonwealth/client/scripts/hooks/useDeferredConditionTriggerCallback.ts
@@ -0,0 +1,59 @@
+import { useCallback, useEffect, useRef } from 'react';
+
+type UseDeferredConditionTriggerCallbackProps = {
+ shouldRunTrigger?: boolean;
+};
+
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
+type AllowAny = any; // we could get any type of args for a callback and its args/params so need to allow any
+
+// Usecase: When a UI element triggers a callback with args, but we want to run it only when an async condition
+// is satisfied. Example: If a button's callback should only run when user is logged in, but at current state
+// user is logged out, we can register the button callback with any args it passes and set `shouldRunTrigger` to
+// `true` or call the `trigger` method whenever the user login state becomes true to run the original callback.
+const useDeferredConditionTriggerCallback = ({
+ shouldRunTrigger,
+}: UseDeferredConditionTriggerCallbackProps) => {
+ const isRunning = useRef(false);
+ const registeredCallbackRef = useRef<(args: AllowAny) => void | undefined>();
+ const registeredCallbackArgsRef = useRef();
+
+ const cleanup = useCallback(() => {
+ registeredCallbackRef.current = undefined;
+ registeredCallbackArgsRef.current = undefined;
+ isRunning.current = false;
+ }, []);
+
+ const trigger = useCallback(() => {
+ if (registeredCallbackRef.current && !isRunning.current) {
+ isRunning.current = true;
+ registeredCallbackRef.current(registeredCallbackArgsRef.current);
+ cleanup();
+ }
+ }, [cleanup]);
+
+ const register = ({
+ cb,
+ args,
+ }: {
+ cb: (args: AllowAny) => void;
+ args?: AllowAny;
+ }) => {
+ registeredCallbackRef.current = cb;
+ registeredCallbackArgsRef.current = args;
+ };
+
+ useEffect(() => {
+ if (shouldRunTrigger) {
+ trigger();
+ }
+ }, [shouldRunTrigger, trigger]);
+
+ return {
+ register,
+ trigger,
+ cleanup,
+ };
+};
+
+export default useDeferredConditionTriggerCallback;
diff --git a/packages/commonwealth/client/scripts/views/pages/Communities/IdeaLaunchpad/IdeaLaunchpad.tsx b/packages/commonwealth/client/scripts/views/pages/Communities/IdeaLaunchpad/IdeaLaunchpad.tsx
index 3c65a7ba54e..4463ccbd8e4 100644
--- a/packages/commonwealth/client/scripts/views/pages/Communities/IdeaLaunchpad/IdeaLaunchpad.tsx
+++ b/packages/commonwealth/client/scripts/views/pages/Communities/IdeaLaunchpad/IdeaLaunchpad.tsx
@@ -1,9 +1,15 @@
+import { ChainBase } from '@hicommonwealth/shared';
+import useDeferredConditionTriggerCallback from 'hooks/useDeferredConditionTriggerCallback';
import { useFlag } from 'hooks/useFlag';
import React, { useState } from 'react';
+import useUserStore from 'state/ui/user';
+import { AuthModal } from 'views/modals/AuthModal';
import LaunchIdeaCard from '../../../components/LaunchIdeaCard';
import TokenLaunchDrawer from './TokenLaunchDrawer';
const IdeaLaunchpad = () => {
+ const user = useUserStore();
+ const [isAuthModalOpen, setIsAuthModalOpen] = useState(false);
const tokenizedCommunityEnabled = useFlag('tokenizedCommunity');
const [initialIdeaPrompt, setInitialIdeaPrompt] = useState();
@@ -11,17 +17,38 @@ const IdeaLaunchpad = () => {
useState(false);
const [isTokenLaunchDrawerOpen, setIsTokenLaunchDrawerOpen] = useState(false);
+ const { register, trigger } = useDeferredConditionTriggerCallback({
+ shouldRunTrigger: user.isLoggedIn,
+ });
+
+ const openAuthModalOrTriggerCallback = () => {
+ if (user.isLoggedIn) {
+ trigger();
+ } else {
+ setIsAuthModalOpen(!user.isLoggedIn);
+ }
+ };
+
if (!tokenizedCommunityEnabled) return <>>;
return (
<>
{
- setInitialIdeaPrompt(ideaPrompt);
- setShouldGenerateIdeaOnDrawerOpen(true);
- setIsTokenLaunchDrawerOpen(true);
+ register({
+ cb: (prompt: string) => {
+ setInitialIdeaPrompt(prompt);
+ setShouldGenerateIdeaOnDrawerOpen(true);
+ setIsTokenLaunchDrawerOpen(true);
+ },
+ args: ideaPrompt,
+ });
+ openAuthModalOrTriggerCallback();
+ }}
+ onTokenLaunchClick={() => {
+ register({ cb: () => setIsTokenLaunchDrawerOpen(true) });
+ openAuthModalOrTriggerCallback();
}}
- onTokenLaunchClick={() => setIsTokenLaunchDrawerOpen(true)}
/>
{
initialIdeaPrompt={initialIdeaPrompt}
generateIdeaOnMount={shouldGenerateIdeaOnDrawerOpen}
/>
+ setIsAuthModalOpen(false)}
+ showWalletsFor={ChainBase.Ethereum}
+ />
>
);
};
From 2470dff31080cc5f1f8f7bcce14ee1e1c40591b5 Mon Sep 17 00:00:00 2001
From: Marcin
Date: Wed, 20 Nov 2024 14:17:01 +0100
Subject: [PATCH 142/227] fix ci
---
libs/model/test/contest/contests-projection-lifecycle.spec.ts | 1 +
1 file changed, 1 insertion(+)
diff --git a/libs/model/test/contest/contests-projection-lifecycle.spec.ts b/libs/model/test/contest/contests-projection-lifecycle.spec.ts
index 974e04f45b2..41cd4c4f0b0 100644
--- a/libs/model/test/contest/contests-projection-lifecycle.spec.ts
+++ b/libs/model/test/contest/contests-projection-lifecycle.spec.ts
@@ -351,6 +351,7 @@ describe('Contests projection lifecycle', () => {
payout_structure,
funding_token_address,
image_url,
+ description: null,
interval,
ticker,
decimals,
From b56997d05e1c5d78d83c949f3ed5131f2278bace Mon Sep 17 00:00:00 2001
From: rotorsoft
Date: Wed, 20 Nov 2024 10:40:09 -0500
Subject: [PATCH 143/227] upgrade node 22 and pnpm
---
.github/workflows/CI.yml | 20 +-
README.md | 28 ++-
libs/adapters/src/trpc/utils.ts | 5 +-
libs/core/src/integration/outbox.schema.ts | 202 ++++--------------
libs/eslint-plugin/package.json | 2 +-
libs/model/src/user/UpdateUser.command.ts | 9 +-
libs/shared/src/canvas/runtime/node.ts | 4 +-
package.json | 4 +-
.../scripts/controllers/chain/cosmos/chain.ts | 2 +-
.../chain/cosmos/gov/govgen/utils-v1beta1.ts | 12 +-
.../chain/cosmos/gov/v1/utils-v1.ts | 12 +-
.../chain/cosmos/gov/v1beta1/utils-v1beta1.ts | 12 +-
.../Integrations/Webhooks/Webhooks.tsx | 2 +-
.../server/workers/messageRelayer/relay.ts | 3 +-
packages/load-testing/package.json | 2 +-
15 files changed, 104 insertions(+), 215 deletions(-)
diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml
index ac03b1b392a..86893c6950b 100644
--- a/.github/workflows/CI.yml
+++ b/.github/workflows/CI.yml
@@ -33,7 +33,7 @@ jobs:
timeout-minutes: 20
strategy:
matrix:
- node: [ 20 ]
+ node: [ 22 ]
services:
postgres:
@@ -91,7 +91,7 @@ jobs:
timeout-minutes: 30
strategy:
matrix:
- node: [ 20 ]
+ node: [ 22 ]
services:
postgres:
@@ -150,7 +150,7 @@ jobs:
timeout-minutes: 10
strategy:
matrix:
- node: [ 20 ]
+ node: [ 22 ]
services:
postgres:
@@ -203,7 +203,7 @@ jobs:
timeout-minutes: 10
strategy:
matrix:
- node: [ 20 ]
+ node: [ 22 ]
steps:
- uses: actions/checkout@v4
@@ -223,7 +223,7 @@ jobs:
timeout-minutes: 10
strategy:
matrix:
- node: [ 20 ]
+ node: [ 22 ]
steps:
- uses: actions/checkout@v4
@@ -266,7 +266,7 @@ jobs:
timeout-minutes: 10
strategy:
matrix:
- node: [ 20 ]
+ node: [ 22 ]
steps:
- uses: actions/checkout@v4
@@ -296,7 +296,7 @@ jobs:
timeout-minutes: 20
strategy:
matrix:
- node: [ 20 ]
+ node: [ 22 ]
services:
postgres:
@@ -344,7 +344,7 @@ jobs:
timeout-minutes: 20
strategy:
matrix:
- node: [ 20 ]
+ node: [ 22 ]
services:
postgres:
@@ -403,7 +403,7 @@ jobs:
timeout-minutes: 10
strategy:
matrix:
- node: [ 20 ]
+ node: [ 22 ]
services:
postgres:
@@ -445,7 +445,7 @@ jobs:
if: always()
strategy:
matrix:
- node: [ 20 ]
+ node: [ 22 ]
steps:
- name: Coveralls Finished
diff --git a/README.md b/README.md
index 03a395659c8..eb606bae701 100644
--- a/README.md
+++ b/README.md
@@ -6,50 +6,64 @@
### Prerequisites
-- Node.js (version 20.X)
+- Node.js (version 22.x)
- PNPM
- Docker
### Steps
1. Clone the repository:
+
```bash
git clone https://github.com/hicommonwealth/commonwealth.git
```
+
2. Navigate to the project directory:
+
```bash
cd commonwealth
```
+
3. Install dependencies:
+
```bash
pnpm install
```
+
4. Set up environment variables:
+
```bash
cp .env.example .env
```
+
5. Run external services (postgresql, redis, rabbitmq):
+
```bash
docker-compose up -d
```
+
6. Run the database migrations:
+
```bash
pnpm migrate-db
```
+
7. Start the server:
+
```bash
pnpm run start
```
-The API server runs on http://localhost:3000/ and you can test it by making a request to
-http://localhost:3000/api/health. It should respond with
+The API server runs on and you can test it by making a request to
+. It should respond with
+
```json
{
"status": "ok"
}
```
-The client is served from http://localhost:8080/.
+The client is served from .
### Side Notes
@@ -57,15 +71,18 @@ Some features of the application require additional API keys.
While the app will still function without them, certain functionalities may be limited.
Required for openAI image generation:
+
- OPENAI_ORGANIZATION
- OPENAI_API_KEY
Required for chain features on EVM chains (groups, stake, contests):
+
- ETH_ALCHEMY_API_KEY
Ensure these keys are set up in your environment variables to fully utilize all features of the application.
# Scripts
+
- `pnpm start-all`
- Starts ALL the microservices in different processes. Requires a RabbitMQ instance/connection to function properly.
- `pnpm start-apps`
@@ -75,9 +92,8 @@ Ensure these keys are set up in your environment variables to fully utilize all
- Starts a local RabbitMQ instance using Docker.
- Run this in a separate terminal and pair it with the `pnpm start-all` command to get a fully functional app.
- `pnpm start-redis`
- - make sure to have `REDIS_URL=redis://localhost:6379` in your .env file
+ - make sure to have `REDIS_URL=redis://localhost:6379` in your .env file
- Starts a local redis instance using Docker, it will start redis on its default port 6379
- `pnpm load-db [optional-dump-name]`
- Loads the default `latest.dump` or the `optional-dump-name` into the database
- Only available in the `commonwealth` and `chain-events` packages
-
diff --git a/libs/adapters/src/trpc/utils.ts b/libs/adapters/src/trpc/utils.ts
index cfc138dcf6f..34268f130cb 100644
--- a/libs/adapters/src/trpc/utils.ts
+++ b/libs/adapters/src/trpc/utils.ts
@@ -36,7 +36,8 @@ export const toExpress = (router: OpenApiRouter) =>
req,
res,
}),
- onError: ({ path, error }) => logError(path, error),
+ onError: ({ path, error }: { path?: string; error: TRPCError }) =>
+ logError(path, error),
});
// used for REST like routes (External)
@@ -47,7 +48,7 @@ const toOpenApiExpress = (router: OpenApiRouter) =>
req,
res,
}),
- onError: ({ path, error }: { path: string; error: TRPCError }) =>
+ onError: ({ path, error }: { path?: string; error: TRPCError }) =>
logError(path, error),
responseMeta: undefined,
maxBodySize: undefined,
diff --git a/libs/core/src/integration/outbox.schema.ts b/libs/core/src/integration/outbox.schema.ts
index 5605365b806..08646726714 100644
--- a/libs/core/src/integration/outbox.schema.ts
+++ b/libs/core/src/integration/outbox.schema.ts
@@ -1,7 +1,6 @@
import { PG_INT } from '@hicommonwealth/schemas';
-import z from 'zod';
-import { EventNames } from './events';
-import * as events from './events.schemas';
+import { z } from 'zod';
+import { EventNames as E, events as P } from './events';
const BaseOutboxProperties = z.object({
event_id: PG_INT.optional(),
@@ -10,161 +9,42 @@ const BaseOutboxProperties = z.object({
updated_at: z.coerce.date().optional(),
});
-export const Outbox = z.union([
- z
- .object({
- event_name: z.literal(EventNames.ThreadCreated),
- event_payload: events.ThreadCreated,
- })
- .merge(BaseOutboxProperties),
- z
- .object({
- event_name: z.literal(EventNames.CommentCreated),
- event_payload: events.CommentCreated,
- })
- .merge(BaseOutboxProperties),
- z
- .object({
- event_name: z.literal(EventNames.GroupCreated),
- event_payload: events.GroupCreated,
- })
- .merge(BaseOutboxProperties),
- z
- .object({
- event_name: z.literal(EventNames.CommunityCreated),
- event_payload: events.CommunityCreated,
- })
- .merge(BaseOutboxProperties),
- z
- .object({
- event_name: z.literal(EventNames.SnapshotProposalCreated),
- event_payload: events.SnapshotProposalCreated,
- })
- .merge(BaseOutboxProperties),
- z
- .object({
- event_name: z.literal(EventNames.ThreadUpvoted),
- event_payload: events.ThreadUpvoted,
- })
- .merge(BaseOutboxProperties),
- z
- .object({
- event_name: z.literal(EventNames.DiscordMessageCreated),
- event_payload: events.DiscordMessageCreated,
- })
- .merge(BaseOutboxProperties),
- z
- .object({
- event_name: z.literal(EventNames.ChainEventCreated),
- event_payload: events.ChainEventCreated,
- })
- .merge(BaseOutboxProperties),
- z
- .object({
- event_name: z.literal(EventNames.UserMentioned),
- event_payload: events.UserMentioned,
- })
- .merge(BaseOutboxProperties),
- z
- .object({
- event_name: z.literal(EventNames.RecurringContestManagerDeployed),
- event_payload: events.RecurringContestManagerDeployed,
- })
- .merge(BaseOutboxProperties),
- z
- .object({
- event_name: z.literal(EventNames.OneOffContestManagerDeployed),
- event_payload: events.OneOffContestManagerDeployed,
- })
- .merge(BaseOutboxProperties),
- z
- .object({
- event_name: z.literal(EventNames.ContestStarted),
- event_payload: events.ContestStarted,
- })
- .merge(BaseOutboxProperties),
- z
- .object({
- event_name: z.literal(EventNames.ContestContentAdded),
- event_payload: events.ContestContentAdded,
- })
- .merge(BaseOutboxProperties),
- z
- .object({
- event_name: z.literal(EventNames.ContestContentUpvoted),
- event_payload: events.ContestContentUpvoted,
- })
- .merge(BaseOutboxProperties),
- z
- .object({
- event_name: z.literal(EventNames.SubscriptionPreferencesUpdated),
- event_payload: events.SubscriptionPreferencesUpdated,
- })
- .merge(BaseOutboxProperties),
- z
- .object({
- event_name: z.literal(EventNames.CommentUpvoted),
- event_payload: events.CommentUpvoted,
- })
- .merge(BaseOutboxProperties),
- z
- .object({
- event_name: z.literal(EventNames.FarcasterCastCreated),
- event_payload: events.FarcasterCastCreated,
- })
- .merge(BaseOutboxProperties),
- z
- .object({
- event_name: z.literal(EventNames.FarcasterReplyCastCreated),
- event_payload: events.FarcasterReplyCastCreated,
- })
- .merge(BaseOutboxProperties),
- z
- .object({
- event_name: z.literal(EventNames.FarcasterVoteCreated),
- event_payload: events.FarcasterVoteCreated,
- })
- .merge(BaseOutboxProperties),
- z
- .object({
- event_name: z.literal(EventNames.DiscordThreadCreated),
- event_payload: events.DiscordThreadCreated,
- })
- .merge(BaseOutboxProperties),
- z
- .object({
- event_name: z.literal(EventNames.DiscordThreadBodyUpdated),
- event_payload: events.DiscordThreadBodyUpdated,
- })
- .merge(BaseOutboxProperties),
- z
- .object({
- event_name: z.literal(EventNames.DiscordThreadTitleUpdated),
- event_payload: events.DiscordThreadTitleUpdated,
- })
- .merge(BaseOutboxProperties),
- z
- .object({
- event_name: z.literal(EventNames.DiscordThreadDeleted),
- event_payload: events.DiscordThreadDeleted,
- })
- .merge(BaseOutboxProperties),
- z
- .object({
- event_name: z.literal(EventNames.DiscordThreadCommentCreated),
- event_payload: events.DiscordThreadCommentCreated,
- })
- .merge(BaseOutboxProperties),
- z
- .object({
- event_name: z.literal(EventNames.DiscordThreadCommentUpdated),
- event_payload: events.DiscordThreadCommentUpdated,
- })
- .merge(BaseOutboxProperties),
- z
- .object({
- event_name: z.literal(EventNames.DiscordThreadCommentDeleted),
- event_payload: events.DiscordThreadCommentDeleted,
- })
- .merge(BaseOutboxProperties),
-]);
+const outboxEvents = {
+ [E.ChainEventCreated]: P.ChainEventCreated,
+ [E.CommentCreated]: P.CommentCreated,
+ [E.CommentUpvoted]: P.CommentUpvoted,
+ [E.CommunityCreated]: P.CommunityCreated,
+ [E.ContestContentAdded]: P.ContestContentAdded,
+ [E.ContestContentUpvoted]: P.ContestContentUpvoted,
+ [E.ContestStarted]: P.ContestStarted,
+ [E.DiscordMessageCreated]: P.DiscordMessageCreated,
+ [E.DiscordThreadBodyUpdated]: P.DiscordThreadBodyUpdated,
+ [E.DiscordThreadCommentCreated]: P.DiscordThreadCommentCreated,
+ [E.DiscordThreadCommentDeleted]: P.DiscordThreadCommentDeleted,
+ [E.DiscordThreadCommentUpdated]: P.DiscordThreadCommentUpdated,
+ [E.DiscordThreadCreated]: P.DiscordThreadCreated,
+ [E.DiscordThreadDeleted]: P.DiscordThreadDeleted,
+ [E.DiscordThreadTitleUpdated]: P.DiscordThreadTitleUpdated,
+ [E.FarcasterCastCreated]: P.FarcasterCastCreated,
+ [E.FarcasterReplyCastCreated]: P.FarcasterReplyCastCreated,
+ [E.FarcasterVoteCreated]: P.FarcasterVoteCreated,
+ [E.GroupCreated]: P.GroupCreated,
+ [E.OneOffContestManagerDeployed]: P.OneOffContestManagerDeployed,
+ [E.RecurringContestManagerDeployed]: P.RecurringContestManagerDeployed,
+ [E.SnapshotProposalCreated]: P.SnapshotProposalCreated,
+ [E.SubscriptionPreferencesUpdated]: P.SubscriptionPreferencesUpdated,
+ [E.ThreadCreated]: P.ThreadCreated,
+ [E.ThreadUpvoted]: P.ThreadUpvoted,
+ [E.UserMentioned]: P.UserMentioned,
+} as const;
+
+export const Outbox = z.union(
+ Object.entries(outboxEvents).map(([event_name, event_payload]) =>
+ z
+ .object({
+ event_name: z.literal(event_name as keyof typeof outboxEvents),
+ event_payload,
+ })
+ .merge(BaseOutboxProperties),
+ ) as unknown as readonly [z.ZodTypeAny, z.ZodTypeAny, ...z.ZodTypeAny[]],
+);
diff --git a/libs/eslint-plugin/package.json b/libs/eslint-plugin/package.json
index de592616956..104fea274b0 100644
--- a/libs/eslint-plugin/package.json
+++ b/libs/eslint-plugin/package.json
@@ -13,6 +13,6 @@
"eslint": "^8"
},
"engines": {
- "node": "20.x"
+ "node": "22.x"
}
}
diff --git a/libs/model/src/user/UpdateUser.command.ts b/libs/model/src/user/UpdateUser.command.ts
index 23c6b759d26..e8fc23ee994 100644
--- a/libs/model/src/user/UpdateUser.command.ts
+++ b/libs/model/src/user/UpdateUser.command.ts
@@ -62,9 +62,12 @@ export function UpdateUser(): Command {
});
const tags_delta = tag_ids
- ? getDelta({ tag_ids: user.ProfileTags?.map((t) => t.tag_id) } ?? [], {
- tag_ids,
- })
+ ? getDelta(
+ { tag_ids: user.ProfileTags?.map((t) => t.tag_id) },
+ {
+ tag_ids,
+ },
+ )
: {};
const update_user = Object.keys(user_delta).length;
diff --git a/libs/shared/src/canvas/runtime/node.ts b/libs/shared/src/canvas/runtime/node.ts
index 7c0f79fa839..0e3b6dfe186 100644
--- a/libs/shared/src/canvas/runtime/node.ts
+++ b/libs/shared/src/canvas/runtime/node.ts
@@ -22,7 +22,9 @@ export const startCanvasNode = async (config: {
process.env.FEDERATION_LISTEN_ADDRESS ?? '/ip4/127.0.0.1/tcp/8090/ws';
const privateKey = config.LIBP2P_PRIVATE_KEY
- ? privateKeyFromProtobuf(Buffer.from(config.LIBP2P_PRIVATE_KEY, 'base64'))
+ ? privateKeyFromProtobuf(
+ new Uint8Array(Buffer.from(config.LIBP2P_PRIVATE_KEY, 'base64')),
+ )
: await generateKeyPair('Ed25519');
let pgConnectionConfig: ConnectionConfig | undefined = undefined;
diff --git a/package.json b/package.json
index 982a424349a..9c4bf423b04 100644
--- a/package.json
+++ b/package.json
@@ -6,7 +6,7 @@
"url": "git+https://github.com/hicommonwealth/commonwealth.git"
},
"type": "module",
- "packageManager": "pnpm@9.10.0",
+ "packageManager": "pnpm@9.14.2",
"scripts": {
"build": "chmod u+x scripts/build.sh && ./scripts/build.sh",
"docker-build-commonwealth": "docker build -f Dockerfile.commonwealth_base --tag commonwealth:latest .",
@@ -147,6 +147,6 @@
"esbuild-darwin-64": "^0.15.12"
},
"engines": {
- "node": "20.x"
+ "node": "22.x"
}
}
diff --git a/packages/commonwealth/client/scripts/controllers/chain/cosmos/chain.ts b/packages/commonwealth/client/scripts/controllers/chain/cosmos/chain.ts
index dff834cf3d8..648ed63a131 100644
--- a/packages/commonwealth/client/scripts/controllers/chain/cosmos/chain.ts
+++ b/packages/commonwealth/client/scripts/controllers/chain/cosmos/chain.ts
@@ -271,7 +271,7 @@ class CosmosChain implements IChainModule {
} else if (cosm.isDeliverTxSuccess(result)) {
const txHash = result.transactionHash;
const txResult = await this._tmClient.tx({
- hash: Buffer.from(txHash, 'hex'),
+ hash: new Uint8Array(Buffer.from(txHash, 'hex')),
});
return txResult.result.events;
} else {
diff --git a/packages/commonwealth/client/scripts/controllers/chain/cosmos/gov/govgen/utils-v1beta1.ts b/packages/commonwealth/client/scripts/controllers/chain/cosmos/gov/govgen/utils-v1beta1.ts
index 3f45457dd6a..ac961301f2d 100644
--- a/packages/commonwealth/client/scripts/controllers/chain/cosmos/gov/govgen/utils-v1beta1.ts
+++ b/packages/commonwealth/client/scripts/controllers/chain/cosmos/gov/govgen/utils-v1beta1.ts
@@ -146,14 +146,10 @@ export const getCompletedProposalsV1Beta1 = async (
};
const sortProposals = (proposals: Proposal[]): ICosmosProposal[] => {
- // @ts-expect-error StrictNullChecks
- return (
- proposals
- .map((p) => msgToIProposal(p))
- .filter((p) => !!p)
- // @ts-expect-error StrictNullChecks
- .sort((p1, p2) => +p2.identifier - +p1.identifier)
- );
+ return proposals
+ .map((p) => msgToIProposal(p))
+ .filter((p): p is ICosmosProposal => !!p)
+ .sort((p1, p2) => +p2.identifier - +p1.identifier);
};
export const msgToIProposal = (p: Proposal): ICosmosProposal | null => {
diff --git a/packages/commonwealth/client/scripts/controllers/chain/cosmos/gov/v1/utils-v1.ts b/packages/commonwealth/client/scripts/controllers/chain/cosmos/gov/v1/utils-v1.ts
index 20aa7e27061..72de164f2e7 100644
--- a/packages/commonwealth/client/scripts/controllers/chain/cosmos/gov/v1/utils-v1.ts
+++ b/packages/commonwealth/client/scripts/controllers/chain/cosmos/gov/v1/utils-v1.ts
@@ -104,14 +104,10 @@ export const getCompletedProposalsV1 = async (
export const sortProposalsV1 = (
proposals: ProposalSDKType[],
): ICosmosProposal[] => {
- // @ts-expect-error StrictNullChecks
- return (
- proposals
- .map((p) => propToIProposal(p))
- .filter((p) => !!p)
- // @ts-expect-error StrictNullChecks
- .sort((p1, p2) => +p2.identifier - +p1.identifier)
- );
+ return proposals
+ .map((p) => propToIProposal(p))
+ .filter((p): p is ICosmosProposal => !!p)
+ .sort((p1, p2) => +p2!.identifier - +p1!.identifier);
};
export const propToIProposal = (p: ProposalSDKType): ICosmosProposal | null => {
diff --git a/packages/commonwealth/client/scripts/controllers/chain/cosmos/gov/v1beta1/utils-v1beta1.ts b/packages/commonwealth/client/scripts/controllers/chain/cosmos/gov/v1beta1/utils-v1beta1.ts
index 5ddd7740184..ea71b8c007b 100644
--- a/packages/commonwealth/client/scripts/controllers/chain/cosmos/gov/v1beta1/utils-v1beta1.ts
+++ b/packages/commonwealth/client/scripts/controllers/chain/cosmos/gov/v1beta1/utils-v1beta1.ts
@@ -150,14 +150,10 @@ export const getCompletedProposalsV1Beta1 = async (
};
const sortProposals = (proposals: Proposal[]): ICosmosProposal[] => {
- // @ts-expect-error StrictNullChecks
- return (
- proposals
- .map((p) => msgToIProposal(p))
- .filter((p) => !!p)
- // @ts-expect-error StrictNullChecks
- .sort((p1, p2) => +p2.identifier - +p1.identifier)
- );
+ return proposals
+ .map((p) => msgToIProposal(p))
+ .filter((p): p is ICosmosProposal => !!p)
+ .sort((p1, p2) => +p2.identifier - +p1.identifier);
};
export const msgToIProposal = (p: Proposal): ICosmosProposal | null => {
diff --git a/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Integrations/Webhooks/Webhooks.tsx b/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Integrations/Webhooks/Webhooks.tsx
index fce0e29ef51..5f20c6fe8ca 100644
--- a/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Integrations/Webhooks/Webhooks.tsx
+++ b/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Integrations/Webhooks/Webhooks.tsx
@@ -58,7 +58,7 @@ const Webhooks = () => {
useNecessaryEffect(() => {
if (!isLoadingWebhooks && existingWebhooks) {
- const currentWebhooks = ([...existingWebhooks] || []).map((hookData) => ({
+ const currentWebhooks = [...existingWebhooks].map((hookData) => ({
value: hookData.url,
canDelete: true,
canConfigure: true,
diff --git a/packages/commonwealth/server/workers/messageRelayer/relay.ts b/packages/commonwealth/server/workers/messageRelayer/relay.ts
index a4b3c585a54..fbf54cda314 100644
--- a/packages/commonwealth/server/workers/messageRelayer/relay.ts
+++ b/packages/commonwealth/server/workers/messageRelayer/relay.ts
@@ -45,8 +45,7 @@ export async function relay(broker: Broker, models: DB): Promise {
});
break;
}
- // @ts-expect-error StrictNullChecks
- publishedEventIds.push(event.event_id);
+ publishedEventIds.push(event.event_id!);
stats().incrementBy(
'messageRelayerPublished',
publishedEventIds.length,
diff --git a/packages/load-testing/package.json b/packages/load-testing/package.json
index 862f8704305..3d1b61a546e 100644
--- a/packages/load-testing/package.json
+++ b/packages/load-testing/package.json
@@ -12,7 +12,7 @@
"stop": "docker compose -p load-testing down"
},
"engines": {
- "node": "20.x"
+ "node": "22.x"
},
"keywords": [],
"author": "",
From a6dcacc8a7cea48f19211744a55d826cd6456577 Mon Sep 17 00:00:00 2001
From: Timothee Legros
Date: Wed, 20 Nov 2024 18:05:53 +0200
Subject: [PATCH 144/227] move ABIs again
---
.../src}/abis/communityStakesAbi.ts | 0
.../src}/abis/contestAbi.ts | 0
.../src}/abis/erc20Abi.ts | 0
.../src}/abis/feeManagerAbi.ts | 0
.../src}/abis/launchpadFactoryAbi.ts | 0
.../src}/abis/lpBondingCurveAbi.ts | 0
.../src}/abis/namespaceAbi.ts | 0
.../src}/abis/namespaceFactoryAbi.ts | 0
.../src}/abis/reservationHookAbi.ts | 0
.../src}/abis/tokenCommunityManagerAbi.ts | 0
libs/evm-protocols/src/index.ts | 10 +++++++
libs/model/package.json | 1 +
.../services/commonProtocol/contestHelper.ts | 15 ++++++-----
.../commonProtocol/contractHelpers.ts | 6 ++---
.../commonProtocol/launchpadHelpers.ts | 10 +++----
libs/model/tsconfig.build.json | 3 ++-
libs/model/tsconfig.json | 3 ++-
libs/shared/src/commonProtocol/index.ts | 10 -------
.../ContractHelpers/CommunityStakes.tsx | 4 +--
.../helpers/ContractHelpers/Contest.ts | 11 +++++---
.../helpers/ContractHelpers/ERC20Helper.ts | 4 +--
.../helpers/ContractHelpers/Launchpad.ts | 16 +++++++-----
.../ContractHelpers/NamespaceFactory.ts | 13 +++++++---
packages/commonwealth/package.json | 1 +
packages/commonwealth/tsconfig.build.json | 3 ++-
packages/commonwealth/tsconfig.json | 3 ++-
pnpm-lock.yaml | 26 ++++++++++++-------
27 files changed, 81 insertions(+), 58 deletions(-)
rename libs/{shared/src/commonProtocol => evm-protocols/src}/abis/communityStakesAbi.ts (100%)
rename libs/{shared/src/commonProtocol => evm-protocols/src}/abis/contestAbi.ts (100%)
rename libs/{shared/src/commonProtocol => evm-protocols/src}/abis/erc20Abi.ts (100%)
rename libs/{shared/src/commonProtocol => evm-protocols/src}/abis/feeManagerAbi.ts (100%)
rename libs/{shared/src/commonProtocol => evm-protocols/src}/abis/launchpadFactoryAbi.ts (100%)
rename libs/{shared/src/commonProtocol => evm-protocols/src}/abis/lpBondingCurveAbi.ts (100%)
rename libs/{shared/src/commonProtocol => evm-protocols/src}/abis/namespaceAbi.ts (100%)
rename libs/{shared/src/commonProtocol => evm-protocols/src}/abis/namespaceFactoryAbi.ts (100%)
rename libs/{shared/src/commonProtocol => evm-protocols/src}/abis/reservationHookAbi.ts (100%)
rename libs/{shared/src/commonProtocol => evm-protocols/src}/abis/tokenCommunityManagerAbi.ts (100%)
create mode 100644 libs/evm-protocols/src/index.ts
diff --git a/libs/shared/src/commonProtocol/abis/communityStakesAbi.ts b/libs/evm-protocols/src/abis/communityStakesAbi.ts
similarity index 100%
rename from libs/shared/src/commonProtocol/abis/communityStakesAbi.ts
rename to libs/evm-protocols/src/abis/communityStakesAbi.ts
diff --git a/libs/shared/src/commonProtocol/abis/contestAbi.ts b/libs/evm-protocols/src/abis/contestAbi.ts
similarity index 100%
rename from libs/shared/src/commonProtocol/abis/contestAbi.ts
rename to libs/evm-protocols/src/abis/contestAbi.ts
diff --git a/libs/shared/src/commonProtocol/abis/erc20Abi.ts b/libs/evm-protocols/src/abis/erc20Abi.ts
similarity index 100%
rename from libs/shared/src/commonProtocol/abis/erc20Abi.ts
rename to libs/evm-protocols/src/abis/erc20Abi.ts
diff --git a/libs/shared/src/commonProtocol/abis/feeManagerAbi.ts b/libs/evm-protocols/src/abis/feeManagerAbi.ts
similarity index 100%
rename from libs/shared/src/commonProtocol/abis/feeManagerAbi.ts
rename to libs/evm-protocols/src/abis/feeManagerAbi.ts
diff --git a/libs/shared/src/commonProtocol/abis/launchpadFactoryAbi.ts b/libs/evm-protocols/src/abis/launchpadFactoryAbi.ts
similarity index 100%
rename from libs/shared/src/commonProtocol/abis/launchpadFactoryAbi.ts
rename to libs/evm-protocols/src/abis/launchpadFactoryAbi.ts
diff --git a/libs/shared/src/commonProtocol/abis/lpBondingCurveAbi.ts b/libs/evm-protocols/src/abis/lpBondingCurveAbi.ts
similarity index 100%
rename from libs/shared/src/commonProtocol/abis/lpBondingCurveAbi.ts
rename to libs/evm-protocols/src/abis/lpBondingCurveAbi.ts
diff --git a/libs/shared/src/commonProtocol/abis/namespaceAbi.ts b/libs/evm-protocols/src/abis/namespaceAbi.ts
similarity index 100%
rename from libs/shared/src/commonProtocol/abis/namespaceAbi.ts
rename to libs/evm-protocols/src/abis/namespaceAbi.ts
diff --git a/libs/shared/src/commonProtocol/abis/namespaceFactoryAbi.ts b/libs/evm-protocols/src/abis/namespaceFactoryAbi.ts
similarity index 100%
rename from libs/shared/src/commonProtocol/abis/namespaceFactoryAbi.ts
rename to libs/evm-protocols/src/abis/namespaceFactoryAbi.ts
diff --git a/libs/shared/src/commonProtocol/abis/reservationHookAbi.ts b/libs/evm-protocols/src/abis/reservationHookAbi.ts
similarity index 100%
rename from libs/shared/src/commonProtocol/abis/reservationHookAbi.ts
rename to libs/evm-protocols/src/abis/reservationHookAbi.ts
diff --git a/libs/shared/src/commonProtocol/abis/tokenCommunityManagerAbi.ts b/libs/evm-protocols/src/abis/tokenCommunityManagerAbi.ts
similarity index 100%
rename from libs/shared/src/commonProtocol/abis/tokenCommunityManagerAbi.ts
rename to libs/evm-protocols/src/abis/tokenCommunityManagerAbi.ts
diff --git a/libs/evm-protocols/src/index.ts b/libs/evm-protocols/src/index.ts
new file mode 100644
index 00000000000..1dd1157d596
--- /dev/null
+++ b/libs/evm-protocols/src/index.ts
@@ -0,0 +1,10 @@
+export * from './abis/communityStakesAbi';
+export * from './abis/contestAbi';
+export * from './abis/erc20Abi';
+export * from './abis/feeManagerAbi';
+export * from './abis/launchpadFactoryAbi';
+export * from './abis/lpBondingCurveAbi';
+export * from './abis/namespaceAbi';
+export * from './abis/namespaceFactoryAbi';
+export * from './abis/reservationHookAbi';
+export * from './abis/tokenCommunityManagerAbi';
diff --git a/libs/model/package.json b/libs/model/package.json
index e3a88ec989b..b3075184914 100644
--- a/libs/model/package.json
+++ b/libs/model/package.json
@@ -36,6 +36,7 @@
"@hicommonwealth/core": "workspace:*",
"@hicommonwealth/schemas": "workspace:*",
"@hicommonwealth/shared": "workspace:*",
+ "@hicommonwealth/evm-protocols": "workspace:*",
"@neynar/nodejs-sdk": "^1.55.0",
"@solana/spl-token": "^0.4.6",
"@solana/web3.js": "^1.91.6",
diff --git a/libs/model/src/services/commonProtocol/contestHelper.ts b/libs/model/src/services/commonProtocol/contestHelper.ts
index c94e9012f19..ff79e8ce263 100644
--- a/libs/model/src/services/commonProtocol/contestHelper.ts
+++ b/libs/model/src/services/commonProtocol/contestHelper.ts
@@ -1,4 +1,5 @@
import { AppError } from '@hicommonwealth/core';
+import { contestAbi, feeManagerAbi } from '@hicommonwealth/evm-protocols';
import { commonProtocol } from '@hicommonwealth/shared';
import { Mutex } from 'async-mutex';
import Web3, { PayableCallOptions } from 'web3';
@@ -50,7 +51,7 @@ const addContent = async (
web3 = await createWeb3Provider(rpcNodeUrl);
}
const contestInstance = new web3.eth.Contract(
- commonProtocol.contestAbi as AbiItem[],
+ contestAbi as AbiItem[],
contest,
);
@@ -112,7 +113,7 @@ const voteContent = async (
web3 = await createWeb3Provider(rpcNodeUrl);
}
const contestInstance = new web3.eth.Contract(
- commonProtocol.contestAbi as AbiItem[],
+ contestAbi as AbiItem[],
contest,
);
@@ -152,7 +153,7 @@ export const getContestStatus = async (
): Promise => {
const web3 = new Web3(rpcNodeUrl);
const contestInstance = new web3.eth.Contract(
- commonProtocol.contestAbi as AbiItem[],
+ contestAbi as AbiItem[],
contest,
);
@@ -189,7 +190,7 @@ export const getContestScore = async (
): Promise => {
const web3 = new Web3(rpcNodeUrl);
const contestInstance = new web3.eth.Contract(
- commonProtocol.contestAbi as AbiItem[],
+ contestAbi as AbiItem[],
contest,
);
@@ -242,7 +243,7 @@ export const getContestBalance = async (
const web3 = new Web3(rpcNodeUrl);
const contestInstance = new web3.eth.Contract(
- commonProtocol.contestAbi as AbiItem[],
+ contestAbi as AbiItem[],
contest,
);
@@ -250,7 +251,7 @@ export const getContestBalance = async (
contestInstance,
contest,
web3,
- commonProtocol.feeManagerAbi,
+ feeManagerAbi,
oneOff,
);
@@ -335,7 +336,7 @@ export const rollOverContest = async (
return nonceMutex.runExclusive(async () => {
const web3 = await createWeb3Provider(rpcNodeUrl);
const contestInstance = new web3.eth.Contract(
- commonProtocol.contestAbi as AbiItem[],
+ contestAbi as AbiItem[],
contest,
);
diff --git a/libs/model/src/services/commonProtocol/contractHelpers.ts b/libs/model/src/services/commonProtocol/contractHelpers.ts
index 5d8705402d6..eab8ee68a74 100644
--- a/libs/model/src/services/commonProtocol/contractHelpers.ts
+++ b/libs/model/src/services/commonProtocol/contractHelpers.ts
@@ -1,4 +1,5 @@
import { AppError } from '@hicommonwealth/core';
+import { contestAbi } from '@hicommonwealth/evm-protocols';
import {
BalanceSourceType,
ZERO_ADDRESS,
@@ -96,10 +97,7 @@ export const getTokenAttributes = async (
const web3 = new Web3(rpcNodeUrl);
let addr = address;
if (fetchFromContest) {
- const contest = new web3.eth.Contract(
- commonProtocol.contestAbi as AbiItem[],
- address,
- );
+ const contest = new web3.eth.Contract(contestAbi as AbiItem[], address);
addr = await contest.methods.contestToken().call();
}
if (addr === ZERO_ADDRESS) {
diff --git a/libs/model/src/services/commonProtocol/launchpadHelpers.ts b/libs/model/src/services/commonProtocol/launchpadHelpers.ts
index b168c6e8acb..67f75cd6bc0 100644
--- a/libs/model/src/services/commonProtocol/launchpadHelpers.ts
+++ b/libs/model/src/services/commonProtocol/launchpadHelpers.ts
@@ -1,4 +1,5 @@
import { logger } from '@hicommonwealth/core';
+import { erc20Abi, lpBondingCurveAbi } from '@hicommonwealth/evm-protocols';
import {
deployedNamespaceEventSignature,
launchpadTokenRegisteredEventSignature,
@@ -147,10 +148,7 @@ export async function getErc20TokenInfo({
tokenAddress: string;
}): Promise<{ name: string; symbol: string; totalSupply: bigint }> {
const web3 = new Web3(rpc);
- const erc20Contract = new web3.eth.Contract(
- commonProtocol.erc20Abi,
- tokenAddress,
- );
+ const erc20Contract = new web3.eth.Contract(erc20Abi, tokenAddress);
const [name, symbol, totalSupply] = await Promise.all([
erc20Contract.methods.name().call(),
erc20Contract.methods.symbol().call(),
@@ -174,7 +172,7 @@ export async function transferLiquidityToUniswap({
}) {
const web3 = await createWeb3Provider(rpc);
const contract = new web3.eth.Contract(
- commonProtocol.lpBondingCurveAbi,
+ lpBondingCurveAbi,
lpBondingCurveAddress,
);
await commonProtocol.transferLiquidity(
@@ -203,7 +201,7 @@ export async function getToken({
}> {
const web3 = new Web3(rpc);
const contract = new web3.eth.Contract(
- commonProtocol.lpBondingCurveAbi,
+ lpBondingCurveAbi,
lpBondingCurveAddress,
);
return await contract.methods.tokens(tokenAddress).call();
diff --git a/libs/model/tsconfig.build.json b/libs/model/tsconfig.build.json
index 6ce85684795..92f27eaca0a 100644
--- a/libs/model/tsconfig.build.json
+++ b/libs/model/tsconfig.build.json
@@ -9,6 +9,7 @@
{ "path": "../core/tsconfig.build.json" },
{ "path": "../chains/tsconfig.build.json" },
{ "path": "../schemas/tsconfig.build.json" },
- { "path": "../shared/tsconfig.build.json" }
+ { "path": "../shared/tsconfig.build.json" },
+ { "path": "../evm-protocols/tsconfig.build.json" }
]
}
diff --git a/libs/model/tsconfig.json b/libs/model/tsconfig.json
index af83fb9562d..8af05261479 100644
--- a/libs/model/tsconfig.json
+++ b/libs/model/tsconfig.json
@@ -4,6 +4,7 @@
{ "path": "../core/tsconfig.build.json" },
{ "path": "../chains/tsconfig.build.json" },
{ "path": "../schemas/tsconfig.build.json" },
- { "path": "../shared/tsconfig.build.json" }
+ { "path": "../shared/tsconfig.build.json" },
+ { "path": "../evm-protocols/tsconfig.build.json" }
]
}
diff --git a/libs/shared/src/commonProtocol/index.ts b/libs/shared/src/commonProtocol/index.ts
index 3a98d720f1e..9b276a5a8cf 100644
--- a/libs/shared/src/commonProtocol/index.ts
+++ b/libs/shared/src/commonProtocol/index.ts
@@ -1,13 +1,3 @@
-export * from './abis/communityStakesAbi';
-export * from './abis/contestAbi';
-export * from './abis/erc20Abi';
-export * from './abis/feeManagerAbi';
-export * from './abis/launchpadFactoryAbi';
-export * from './abis/lpBondingCurveAbi';
-export * from './abis/namespaceAbi';
-export * from './abis/namespaceFactoryAbi';
-export * from './abis/reservationHookAbi';
-export * from './abis/tokenCommunityManagerAbi';
export * from './chainConfig';
export * from './contractHelpers/Contest';
export * from './contractHelpers/Launchpad';
diff --git a/packages/commonwealth/client/scripts/helpers/ContractHelpers/CommunityStakes.tsx b/packages/commonwealth/client/scripts/helpers/ContractHelpers/CommunityStakes.tsx
index 94c5b773c01..6e353a4a6a8 100644
--- a/packages/commonwealth/client/scripts/helpers/ContractHelpers/CommunityStakes.tsx
+++ b/packages/commonwealth/client/scripts/helpers/ContractHelpers/CommunityStakes.tsx
@@ -1,4 +1,4 @@
-import { commonProtocol } from '@hicommonwealth/shared';
+import { communityStakesAbi } from '@hicommonwealth/evm-protocols';
import { toBigInt } from 'web3-utils';
import ContractBase from './ContractBase';
import NamespaceFactory from './NamespaceFactory';
@@ -21,7 +21,7 @@ class CommunityStakes extends ContractBase {
rpc: string,
chainId?: string,
) {
- super(contractAddress, commonProtocol.communityStakesAbi, rpc);
+ super(contractAddress, communityStakesAbi, rpc);
this.namespaceFactoryAddress = factoryAddress;
this.chainId = chainId;
}
diff --git a/packages/commonwealth/client/scripts/helpers/ContractHelpers/Contest.ts b/packages/commonwealth/client/scripts/helpers/ContractHelpers/Contest.ts
index 4f9f094df68..6caf0bfceb1 100644
--- a/packages/commonwealth/client/scripts/helpers/ContractHelpers/Contest.ts
+++ b/packages/commonwealth/client/scripts/helpers/ContractHelpers/Contest.ts
@@ -1,3 +1,8 @@
+import {
+ contestAbi,
+ erc20Abi,
+ feeManagerAbi,
+} from '@hicommonwealth/evm-protocols';
import { ZERO_ADDRESS, commonProtocol } from '@hicommonwealth/shared';
import { AbiItem, TransactionReceipt } from 'web3';
import ContractBase from './ContractBase';
@@ -10,7 +15,7 @@ class Contest extends ContractBase {
namespaceFactory: NamespaceFactory;
constructor(contractAddress: string, factoryAddress: string, rpc: string) {
- super(contractAddress, commonProtocol.contestAbi, rpc);
+ super(contractAddress, contestAbi, rpc);
this.namespaceFactoryAddress = factoryAddress;
}
@@ -199,7 +204,7 @@ class Contest extends ContractBase {
}
} else {
const token = new this.web3.eth.Contract(
- commonProtocol.erc20Abi as unknown as AbiItem[],
+ erc20Abi as unknown as AbiItem[],
tokenAddress,
);
const decimals = await token.methods.decimals().call();
@@ -241,7 +246,7 @@ class Contest extends ContractBase {
this.contract,
this.contractAddress,
this.web3,
- commonProtocol.feeManagerAbi,
+ feeManagerAbi,
oneOff,
);
return parseInt(contestBalance, 10);
diff --git a/packages/commonwealth/client/scripts/helpers/ContractHelpers/ERC20Helper.ts b/packages/commonwealth/client/scripts/helpers/ContractHelpers/ERC20Helper.ts
index 9fe0cfe6464..3c84522cdd5 100644
--- a/packages/commonwealth/client/scripts/helpers/ContractHelpers/ERC20Helper.ts
+++ b/packages/commonwealth/client/scripts/helpers/ContractHelpers/ERC20Helper.ts
@@ -1,9 +1,9 @@
-import { commonProtocol } from '@hicommonwealth/shared';
+import { erc20Abi } from '@hicommonwealth/evm-protocols';
import ContractBase from './ContractBase';
class ERC20Helper extends ContractBase {
constructor(contractAddress: string, rpc: string) {
- super(contractAddress, commonProtocol.erc20Abi, rpc);
+ super(contractAddress, erc20Abi, rpc);
}
async getBalance(userAddress: string): Promise {
if (!this.initialized) {
diff --git a/packages/commonwealth/client/scripts/helpers/ContractHelpers/Launchpad.ts b/packages/commonwealth/client/scripts/helpers/ContractHelpers/Launchpad.ts
index 40ff17258f5..5e2c8fd3ac0 100644
--- a/packages/commonwealth/client/scripts/helpers/ContractHelpers/Launchpad.ts
+++ b/packages/commonwealth/client/scripts/helpers/ContractHelpers/Launchpad.ts
@@ -1,4 +1,8 @@
-import { commonProtocol } from '@hicommonwealth/shared';
+import {
+ erc20Abi,
+ launchpadFactoryAbi,
+ lpBondingCurveAbi,
+} from '@hicommonwealth/evm-protocols';
import { Contract } from 'web3';
import { AbiItem } from 'web3-utils';
import {
@@ -13,7 +17,7 @@ import ContractBase from './ContractBase';
class LaunchpadBondingCurve extends ContractBase {
tokenAddress: string;
launchpadFactoryAddress: string;
- launchpadFactory: Contract;
+ launchpadFactory: Contract;
tokenCommunityManager: string;
constructor(
@@ -23,7 +27,7 @@ class LaunchpadBondingCurve extends ContractBase {
tokenCommunityManager: string,
rpc: string,
) {
- super(bondingCurveAddress, commonProtocol.lpBondingCurveAbi, rpc);
+ super(bondingCurveAddress, lpBondingCurveAbi, rpc);
this.tokenAddress = tokenAddress;
this.launchpadFactoryAddress = launchpadFactoryAddress;
this.tokenCommunityManager = tokenCommunityManager;
@@ -35,9 +39,9 @@ class LaunchpadBondingCurve extends ContractBase {
): Promise {
await super.initialize(withWallet, chainId);
this.launchpadFactory = new this.web3.eth.Contract(
- commonProtocol.launchpadFactoryAbi as AbiItem[],
+ launchpadFactoryAbi as AbiItem[],
this.launchpadFactoryAddress,
- ) as unknown as Contract;
+ ) as unknown as Contract;
}
async launchToken(
@@ -85,7 +89,7 @@ class LaunchpadBondingCurve extends ContractBase {
await this.initialize(true, chainId);
}
const tokenContract = new this.web3.eth.Contract(
- commonProtocol.erc20Abi as unknown as AbiItem[],
+ erc20Abi as unknown as AbiItem[],
this.tokenAddress,
);
const txReceipt = await sellToken(
diff --git a/packages/commonwealth/client/scripts/helpers/ContractHelpers/NamespaceFactory.ts b/packages/commonwealth/client/scripts/helpers/ContractHelpers/NamespaceFactory.ts
index ae8d72ccb1d..82baba1c47b 100644
--- a/packages/commonwealth/client/scripts/helpers/ContractHelpers/NamespaceFactory.ts
+++ b/packages/commonwealth/client/scripts/helpers/ContractHelpers/NamespaceFactory.ts
@@ -1,4 +1,9 @@
-import { ZERO_ADDRESS, commonProtocol } from '@hicommonwealth/shared';
+import {
+ namespaceAbi,
+ namespaceFactoryAbi,
+ reservationHookAbi,
+} from '@hicommonwealth/evm-protocols';
+import { ZERO_ADDRESS } from '@hicommonwealth/shared';
import { TransactionReceipt } from 'web3';
import { AbiItem } from 'web3-utils';
import ContractBase from './ContractBase';
@@ -14,7 +19,7 @@ class NamespaceFactory extends ContractBase {
* @param factoryAddress the address of the active factory to use
*/
constructor(factoryAddress: string, rpc: string) {
- super(factoryAddress, commonProtocol.namespaceFactoryAbi, rpc);
+ super(factoryAddress, namespaceFactoryAbi, rpc);
}
/**
@@ -29,7 +34,7 @@ class NamespaceFactory extends ContractBase {
const addr = await this.contract.methods.reservationHook().call();
if (addr.toLowerCase() !== ZERO_ADDRESS) {
this.reservationHook = new this.web3.eth.Contract(
- commonProtocol.reservationHookAbi as AbiItem[],
+ reservationHookAbi as AbiItem[],
addr,
);
}
@@ -320,7 +325,7 @@ class NamespaceFactory extends ContractBase {
}
const namespaceAddr = await this.getNamespaceAddress(namespace);
const namespaceContract = new this.web3.eth.Contract(
- commonProtocol.namespaceAbi,
+ namespaceAbi,
namespaceAddr,
);
const balance = await namespaceContract.methods
diff --git a/packages/commonwealth/package.json b/packages/commonwealth/package.json
index 1c6da29276b..3bd4d4c98ea 100644
--- a/packages/commonwealth/package.json
+++ b/packages/commonwealth/package.json
@@ -114,6 +114,7 @@
"@hicommonwealth/schemas": "workspace:*",
"@hicommonwealth/shared": "workspace:*",
"@hicommonwealth/sitemaps": "workspace:*",
+ "@hicommonwealth/evm-protocols": "workspace:*",
"@hookform/resolvers": "^3.3.1",
"@ipld/dag-json": "^10.2.0",
"@keplr-wallet/types": "^0.12.23",
diff --git a/packages/commonwealth/tsconfig.build.json b/packages/commonwealth/tsconfig.build.json
index fb4f8e40744..2d69d565454 100644
--- a/packages/commonwealth/tsconfig.build.json
+++ b/packages/commonwealth/tsconfig.build.json
@@ -16,6 +16,7 @@
{ "path": "../../libs/schemas/tsconfig.build.json" },
{ "path": "../../libs/shared/tsconfig.build.json" },
{ "path": "../../libs/evm-testing/tsconfig.build.json" },
- { "path": "../../libs/sitemaps/tsconfig.build.json" }
+ { "path": "../../libs/sitemaps/tsconfig.build.json" },
+ { "path": "../../libs/evm-protocols/tsconfig.build.json" }
]
}
diff --git a/packages/commonwealth/tsconfig.json b/packages/commonwealth/tsconfig.json
index 1ba4cc23005..d834f937f79 100644
--- a/packages/commonwealth/tsconfig.json
+++ b/packages/commonwealth/tsconfig.json
@@ -31,6 +31,7 @@
{ "path": "../../libs/schemas/tsconfig.build.json" },
{ "path": "../../libs/shared/tsconfig.build.json" },
{ "path": "../../libs/evm-testing/tsconfig.build.json" },
- { "path": "../../libs/sitemaps/tsconfig.build.json" }
+ { "path": "../../libs/sitemaps/tsconfig.build.json" },
+ { "path": "../../libs/evm-protocols/tsconfig.build.json" }
]
}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index a7585a54605..0ef9c5b29fc 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -607,6 +607,9 @@ importers:
'@hicommonwealth/core':
specifier: workspace:*
version: link:../core
+ '@hicommonwealth/evm-protocols':
+ specifier: workspace:*
+ version: link:../evm-protocols
'@hicommonwealth/schemas':
specifier: workspace:*
version: link:../schemas
@@ -904,6 +907,9 @@ importers:
'@hicommonwealth/core':
specifier: workspace:*
version: link:../../libs/core
+ '@hicommonwealth/evm-protocols':
+ specifier: workspace:*
+ version: link:../../libs/evm-protocols
'@hicommonwealth/evm-testing':
specifier: workspace:*
version: link:../../libs/evm-testing
@@ -16873,8 +16879,8 @@ snapshots:
'@aws-crypto/sha1-browser': 3.0.0
'@aws-crypto/sha256-browser': 3.0.0
'@aws-crypto/sha256-js': 3.0.0
- '@aws-sdk/client-sso-oidc': 3.577.0
- '@aws-sdk/client-sts': 3.577.0(@aws-sdk/client-sso-oidc@3.577.0)
+ '@aws-sdk/client-sso-oidc': 3.577.0(@aws-sdk/client-sts@3.577.0)
+ '@aws-sdk/client-sts': 3.577.0
'@aws-sdk/core': 3.576.0
'@aws-sdk/credential-provider-node': 3.577.0(@aws-sdk/client-sso-oidc@3.577.0)(@aws-sdk/client-sts@3.577.0)
'@aws-sdk/middleware-bucket-endpoint': 3.577.0
@@ -16931,11 +16937,11 @@ snapshots:
transitivePeerDependencies:
- aws-crt
- '@aws-sdk/client-sso-oidc@3.577.0':
+ '@aws-sdk/client-sso-oidc@3.577.0(@aws-sdk/client-sts@3.577.0)':
dependencies:
'@aws-crypto/sha256-browser': 3.0.0
'@aws-crypto/sha256-js': 3.0.0
- '@aws-sdk/client-sts': 3.577.0(@aws-sdk/client-sso-oidc@3.577.0)
+ '@aws-sdk/client-sts': 3.577.0
'@aws-sdk/core': 3.576.0
'@aws-sdk/credential-provider-node': 3.577.0(@aws-sdk/client-sso-oidc@3.577.0)(@aws-sdk/client-sts@3.577.0)
'@aws-sdk/middleware-host-header': 3.577.0
@@ -16974,6 +16980,7 @@ snapshots:
'@smithy/util-utf8': 3.0.0
tslib: 2.7.0
transitivePeerDependencies:
+ - '@aws-sdk/client-sts'
- aws-crt
'@aws-sdk/client-sso@3.577.0':
@@ -17019,11 +17026,11 @@ snapshots:
transitivePeerDependencies:
- aws-crt
- '@aws-sdk/client-sts@3.577.0(@aws-sdk/client-sso-oidc@3.577.0)':
+ '@aws-sdk/client-sts@3.577.0':
dependencies:
'@aws-crypto/sha256-browser': 3.0.0
'@aws-crypto/sha256-js': 3.0.0
- '@aws-sdk/client-sso-oidc': 3.577.0
+ '@aws-sdk/client-sso-oidc': 3.577.0(@aws-sdk/client-sts@3.577.0)
'@aws-sdk/core': 3.576.0
'@aws-sdk/credential-provider-node': 3.577.0(@aws-sdk/client-sso-oidc@3.577.0)(@aws-sdk/client-sts@3.577.0)
'@aws-sdk/middleware-host-header': 3.577.0
@@ -17062,7 +17069,6 @@ snapshots:
'@smithy/util-utf8': 3.0.0
tslib: 2.7.0
transitivePeerDependencies:
- - '@aws-sdk/client-sso-oidc'
- aws-crt
'@aws-sdk/core@3.576.0':
@@ -17096,7 +17102,7 @@ snapshots:
'@aws-sdk/credential-provider-ini@3.577.0(@aws-sdk/client-sso-oidc@3.577.0)(@aws-sdk/client-sts@3.577.0)':
dependencies:
- '@aws-sdk/client-sts': 3.577.0(@aws-sdk/client-sso-oidc@3.577.0)
+ '@aws-sdk/client-sts': 3.577.0
'@aws-sdk/credential-provider-env': 3.577.0
'@aws-sdk/credential-provider-process': 3.577.0
'@aws-sdk/credential-provider-sso': 3.577.0(@aws-sdk/client-sso-oidc@3.577.0)
@@ -17153,7 +17159,7 @@ snapshots:
'@aws-sdk/credential-provider-web-identity@3.577.0(@aws-sdk/client-sts@3.577.0)':
dependencies:
- '@aws-sdk/client-sts': 3.577.0(@aws-sdk/client-sso-oidc@3.577.0)
+ '@aws-sdk/client-sts': 3.577.0
'@aws-sdk/types': 3.577.0
'@smithy/property-provider': 3.0.0
'@smithy/types': 3.0.0
@@ -17291,7 +17297,7 @@ snapshots:
'@aws-sdk/token-providers@3.577.0(@aws-sdk/client-sso-oidc@3.577.0)':
dependencies:
- '@aws-sdk/client-sso-oidc': 3.577.0
+ '@aws-sdk/client-sso-oidc': 3.577.0(@aws-sdk/client-sts@3.577.0)
'@aws-sdk/types': 3.577.0
'@smithy/property-provider': 3.0.0
'@smithy/shared-ini-file-loader': 3.0.0
From fe1f023a6bb9817c7cf35c9bbeb13aef5fad85ed Mon Sep 17 00:00:00 2001
From: rotorsoft
Date: Wed, 20 Nov 2024 11:19:09 -0500
Subject: [PATCH 145/227] update nvmrc
---
.nvmrc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.nvmrc b/.nvmrc
index 9a2a0e219c9..53d1c14db37 100644
--- a/.nvmrc
+++ b/.nvmrc
@@ -1 +1 @@
-v20
+v22
From 6aa11f3a5a1202d84aad3f1030fba82693c53740 Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Wed, 20 Nov 2024 21:33:36 +0500
Subject: [PATCH 146/227] Integrated token api inside communities
---
libs/model/src/token/GetToken.query.ts | 1 +
.../client/scripts/helpers/launchpad.ts | 28 +++++++++++++
.../state/api/tokens/getTokenByCommunityId.ts | 2 +-
.../CommunitySection/CommunitySection.tsx | 4 +-
.../TokenTradeWidget/TokenTradeWidget.tsx | 41 ++++++++++++-------
.../TradeTokenModel/TradeTokenForm/types.ts | 2 +-
.../Communities/TokensList/TokensList.tsx | 25 +----------
7 files changed, 62 insertions(+), 41 deletions(-)
create mode 100644 packages/commonwealth/client/scripts/helpers/launchpad.ts
diff --git a/libs/model/src/token/GetToken.query.ts b/libs/model/src/token/GetToken.query.ts
index 0dfaa2041d5..6ee4731cfa5 100644
--- a/libs/model/src/token/GetToken.query.ts
+++ b/libs/model/src/token/GetToken.query.ts
@@ -45,6 +45,7 @@ export function GetToken(): Query {
}
SELECT T.*${with_stats ? ', trades.latest_price, trades.old_price' : ''}
FROM "Tokens" as T
+ ${with_stats ? 'LEFT JOIN trades ON trades.token_address = T.token_address' : ''}
WHERE T.namespace = :namespace;
`;
diff --git a/packages/commonwealth/client/scripts/helpers/launchpad.ts b/packages/commonwealth/client/scripts/helpers/launchpad.ts
new file mode 100644
index 00000000000..8c73dff8b63
--- /dev/null
+++ b/packages/commonwealth/client/scripts/helpers/launchpad.ts
@@ -0,0 +1,28 @@
+import { TokenView } from '@hicommonwealth/schemas';
+import { z } from 'zod';
+
+export const calculateTokenPricing = (
+ token: z.infer,
+ ethToUsdRate: number,
+) => {
+ const currentPrice = token.latest_price || 0;
+ const currentPriceRoundingExponent =
+ currentPrice !== 0
+ ? Math.floor(Math.log10(Math.abs(currentPrice)))
+ : currentPrice;
+ const price24HrAgo = token.old_price || 0;
+ const pricePercentage24HourChange = parseFloat(
+ (((currentPrice - price24HrAgo) / price24HrAgo) * 100 || 0).toFixed(2),
+ );
+ const marketCapCurrent = currentPrice * token.initial_supply;
+ const marketCapGoal = token.eth_market_cap_target * ethToUsdRate;
+ const isMarketCapGoalReached = false;
+
+ return {
+ currentPrice: `${currentPrice.toFixed(-currentPriceRoundingExponent || 2)}`,
+ pricePercentage24HourChange,
+ marketCapCurrent,
+ marketCapGoal,
+ isMarketCapGoalReached,
+ };
+};
diff --git a/packages/commonwealth/client/scripts/state/api/tokens/getTokenByCommunityId.ts b/packages/commonwealth/client/scripts/state/api/tokens/getTokenByCommunityId.ts
index 6ffe7f76144..caf96141057 100644
--- a/packages/commonwealth/client/scripts/state/api/tokens/getTokenByCommunityId.ts
+++ b/packages/commonwealth/client/scripts/state/api/tokens/getTokenByCommunityId.ts
@@ -13,7 +13,7 @@ const useGetTokenByCommunityId = ({
with_stats = true,
enabled,
}: UseFetchTokensProps) => {
- return trpc.token.getToken.useInfiniteQuery(
+ return trpc.token.getToken.useQuery(
{
community_id,
with_stats,
diff --git a/packages/commonwealth/client/scripts/views/components/sidebar/CommunitySection/CommunitySection.tsx b/packages/commonwealth/client/scripts/views/components/sidebar/CommunitySection/CommunitySection.tsx
index 7d650fc0bb8..92eca6391fe 100644
--- a/packages/commonwealth/client/scripts/views/components/sidebar/CommunitySection/CommunitySection.tsx
+++ b/packages/commonwealth/client/scripts/views/components/sidebar/CommunitySection/CommunitySection.tsx
@@ -1,3 +1,4 @@
+import { TokenView } from '@hicommonwealth/schemas';
import 'components/sidebar/CommunitySection/CommunitySection.scss';
import { findDenominationString } from 'helpers/findDenomination';
import { useFlag } from 'hooks/useFlag';
@@ -17,6 +18,7 @@ import { getUniqueTopicIdsIncludedInActiveContest } from 'views/components/sideb
import { SubscriptionButton } from 'views/components/subscription_button';
import ManageCommunityStakeModal from 'views/modals/ManageCommunityStakeModal/ManageCommunityStakeModal';
import useCommunityContests from 'views/pages/CommunityManagement/Contests/useCommunityContests';
+import { z } from 'zod';
import useManageCommunityStakeModalStore from '../../../../state/ui/modals/manageCommunityStakeModal';
import Permissions from '../../../../utils/Permissions';
import AccountConnectionIndicator from '../AccountConnectionIndicator';
@@ -108,7 +110,7 @@ export const CommunitySection = ({ showSkeleton }: CommunitySectionProps) => {
{tokenizedCommunityEnabled && communityToken && (
}
/>
)}
diff --git a/packages/commonwealth/client/scripts/views/components/sidebar/CommunitySection/TokenTradeWidget/TokenTradeWidget.tsx b/packages/commonwealth/client/scripts/views/components/sidebar/CommunitySection/TokenTradeWidget/TokenTradeWidget.tsx
index f92d29c7491..ea9e3989820 100644
--- a/packages/commonwealth/client/scripts/views/components/sidebar/CommunitySection/TokenTradeWidget/TokenTradeWidget.tsx
+++ b/packages/commonwealth/client/scripts/views/components/sidebar/CommunitySection/TokenTradeWidget/TokenTradeWidget.tsx
@@ -1,8 +1,14 @@
import { TokenView } from '@hicommonwealth/schemas';
import { ChainBase } from '@hicommonwealth/shared';
+import { calculateTokenPricing } from 'helpers/launchpad';
import React, { useState } from 'react';
+import app from 'state';
+import { useFetchTokenUsdRateQuery } from 'state/api/communityStake';
import TradeTokenModal from 'views/modals/TradeTokenModel';
-import { TradingMode } from 'views/modals/TradeTokenModel/TradeTokenForm';
+import {
+ TokenWithCommunity,
+ TradingMode,
+} from 'views/modals/TradeTokenModel/TradeTokenForm';
import { z } from 'zod';
import MarketCapProgress from '../../../TokenCard/MarketCapProgress';
import PricePercentageChange from '../../../TokenCard/PricePercentageChange';
@@ -22,34 +28,37 @@ export const TokenTradeWidget = ({
showSkeleton,
token,
}: TokenTradeWidgetProps) => {
- const currentPrice = (token as any).latest_price || 0; // TODO: fix type
- const price24HrAgo = (token as any).old_price || 0; // TODO: fix type
- const pricePercentage24HourChange = parseFloat(
- (((currentPrice - price24HrAgo) / price24HrAgo) * 100 || 0).toFixed(2),
- );
-
const [isWidgetExpanded, setIsWidgetExpanded] = useState(true);
const [tokenLaunchModalConfig, setTokenLaunchModalConfig] = useState<{
isOpen: boolean;
tradeConfig?: {
mode: TradingMode;
- token: z.infer;
+ token: z.infer;
addressType: ChainBase;
};
}>({ isOpen: false, tradeConfig: undefined });
+ const { data: ethToCurrencyRateData, isLoading: isLoadingETHToCurrencyRate } =
+ useFetchTokenUsdRateQuery({
+ tokenSymbol: 'ETH',
+ });
+ const ethToUsdRate = parseFloat(
+ ethToCurrencyRateData?.data?.data?.amount || '0',
+ );
+ const tokenPricing = calculateTokenPricing(token, ethToUsdRate);
+
const handleCTAClick = (mode: TradingMode) => {
setTokenLaunchModalConfig({
isOpen: true,
tradeConfig: {
mode,
- token,
+ token: { ...token, community_id: app.activeChainId() || '' },
addressType: ChainBase.Ethereum,
},
});
};
- if (showSkeleton) {
+ if (showSkeleton || isLoadingETHToCurrencyRate) {
return ;
}
@@ -69,18 +78,20 @@ export const TokenTradeWidget = ({
{isWidgetExpanded && (
<>
- {token.symbol} {(token as any).latest_price || '$10.68'}
+ {token.symbol} {tokenPricing.currentPrice}
@@ -101,7 +112,7 @@ export const TokenTradeWidget = ({
{tokenLaunchModalConfig.tradeConfig && (
setTokenLaunchModalConfig({ isOpen: false })}
/>
)}
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts
index 8037355b727..dadf7f017e6 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/types.ts
@@ -10,7 +10,7 @@ export enum TradingMode {
Sell = 'sell',
}
-const TokenWithCommunity = TokenView.extend({
+export const TokenWithCommunity = TokenView.extend({
community_id: z.string(),
});
diff --git a/packages/commonwealth/client/scripts/views/pages/Communities/TokensList/TokensList.tsx b/packages/commonwealth/client/scripts/views/pages/Communities/TokensList/TokensList.tsx
index dde8c632640..a093607c927 100644
--- a/packages/commonwealth/client/scripts/views/pages/Communities/TokensList/TokensList.tsx
+++ b/packages/commonwealth/client/scripts/views/pages/Communities/TokensList/TokensList.tsx
@@ -1,6 +1,7 @@
import { TokenView } from '@hicommonwealth/schemas';
import { ChainBase } from '@hicommonwealth/shared';
import clsx from 'clsx';
+import { calculateTokenPricing } from 'helpers/launchpad';
import { useFlag } from 'hooks/useFlag';
import { navigateToCommunity, useCommonNavigate } from 'navigation/helpers';
import React, { useState } from 'react';
@@ -84,29 +85,6 @@ const TokensList = ({ filters }: TokensListProps) => {
}
};
- const calculateTokenPricing = (token: z.infer) => {
- const currentPrice = token.latest_price || 0;
- const currentPriceRoundingExponent =
- currentPrice !== 0
- ? Math.floor(Math.log10(Math.abs(currentPrice)))
- : currentPrice;
- const price24HrAgo = token.old_price || 0;
- const pricePercentage24HourChange = parseFloat(
- (((currentPrice - price24HrAgo) / price24HrAgo) * 100 || 0).toFixed(2),
- );
- const marketCapCurrent = currentPrice * token.initial_supply;
- const marketCapGoal = token.eth_market_cap_target * ethToUsdRate;
- const isMarketCapGoalReached = false;
-
- return {
- currentPrice: `${currentPrice.toFixed(-currentPriceRoundingExponent || 2)}`,
- pricePercentage24HourChange,
- marketCapCurrent,
- marketCapGoal,
- isMarketCapGoalReached,
- };
- };
-
if (!tokenizedCommunityEnabled) return <>>;
return (
@@ -131,6 +109,7 @@ const TokensList = ({ filters }: TokensListProps) => {
{(tokens || []).map((token) => {
const pricing = calculateTokenPricing(
token as z.infer,
+ ethToUsdRate,
);
return (
From 2b0e99dcd8a950806b97d99df83708b85f74c817 Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Wed, 20 Nov 2024 21:43:43 +0500
Subject: [PATCH 147/227] Updated token pricing calculations to show values in
usd
---
.../client/scripts/helpers/launchpad.ts | 20 ++++++++++---------
.../views/components/TokenCard/TokenCard.tsx | 16 ++++-----------
.../TokenTradeWidget/TokenTradeWidget.tsx | 12 ++++++++---
3 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/packages/commonwealth/client/scripts/helpers/launchpad.ts b/packages/commonwealth/client/scripts/helpers/launchpad.ts
index 8c73dff8b63..9054a1de211 100644
--- a/packages/commonwealth/client/scripts/helpers/launchpad.ts
+++ b/packages/commonwealth/client/scripts/helpers/launchpad.ts
@@ -5,21 +5,23 @@ export const calculateTokenPricing = (
token: z.infer,
ethToUsdRate: number,
) => {
- const currentPrice = token.latest_price || 0;
- const currentPriceRoundingExponent =
- currentPrice !== 0
- ? Math.floor(Math.log10(Math.abs(currentPrice)))
- : currentPrice;
- const price24HrAgo = token.old_price || 0;
+ const currentPrice = (token.latest_price || 0) * ethToUsdRate;
+ const price24HrAgo = (token.old_price || 0) * ethToUsdRate;
+ const priceChange = (currentPrice - price24HrAgo) / price24HrAgo;
const pricePercentage24HourChange = parseFloat(
- (((currentPrice - price24HrAgo) / price24HrAgo) * 100 || 0).toFixed(2),
+ (
+ (priceChange === Number.POSITIVE_INFINITY ||
+ priceChange === Number.NEGATIVE_INFINITY
+ ? 0
+ : priceChange) * 100 || 0
+ ).toFixed(2),
);
- const marketCapCurrent = currentPrice * token.initial_supply;
+ const marketCapCurrent = currentPrice * (token.initial_supply * ethToUsdRate);
const marketCapGoal = token.eth_market_cap_target * ethToUsdRate;
const isMarketCapGoalReached = false;
return {
- currentPrice: `${currentPrice.toFixed(-currentPriceRoundingExponent || 2)}`,
+ currentPrice: `${currentPrice.toFixed(8)}`,
pricePercentage24HourChange,
marketCapCurrent,
marketCapGoal,
diff --git a/packages/commonwealth/client/scripts/views/components/TokenCard/TokenCard.tsx b/packages/commonwealth/client/scripts/views/components/TokenCard/TokenCard.tsx
index 4f258a328fe..aca643e0f1b 100644
--- a/packages/commonwealth/client/scripts/views/components/TokenCard/TokenCard.tsx
+++ b/packages/commonwealth/client/scripts/views/components/TokenCard/TokenCard.tsx
@@ -5,6 +5,7 @@ import { CWText } from '../component_kit/cw_text';
import { CWButton } from '../component_kit/new_designs/CWButton';
import { CWTooltip } from '../component_kit/new_designs/CWTooltip';
import MarketCapProgress from './MarketCapProgress';
+import PricePercentageChange from './PricePercentageChange';
import './TokenCard.scss';
interface TokenCardProps {
@@ -103,18 +104,9 @@ const TokenCard = ({
{price}
- = 0 },
- )}
- type="caption"
- >
- {pricePercentage24HourChange >= 0 ? '+' : ''}
- {pricePercentage24HourChange}%
- {' '}
- 24hr
+
diff --git a/packages/commonwealth/client/scripts/views/components/sidebar/CommunitySection/TokenTradeWidget/TokenTradeWidget.tsx b/packages/commonwealth/client/scripts/views/components/sidebar/CommunitySection/TokenTradeWidget/TokenTradeWidget.tsx
index ea9e3989820..9cb3f7f4c58 100644
--- a/packages/commonwealth/client/scripts/views/components/sidebar/CommunitySection/TokenTradeWidget/TokenTradeWidget.tsx
+++ b/packages/commonwealth/client/scripts/views/components/sidebar/CommunitySection/TokenTradeWidget/TokenTradeWidget.tsx
@@ -1,5 +1,6 @@
import { TokenView } from '@hicommonwealth/schemas';
import { ChainBase } from '@hicommonwealth/shared';
+import { currencyNameToSymbolMap, SupportedCurrencies } from 'helpers/currency';
import { calculateTokenPricing } from 'helpers/launchpad';
import React, { useState } from 'react';
import app from 'state';
@@ -10,24 +11,28 @@ import {
TradingMode,
} from 'views/modals/TradeTokenModel/TradeTokenForm';
import { z } from 'zod';
-import MarketCapProgress from '../../../TokenCard/MarketCapProgress';
-import PricePercentageChange from '../../../TokenCard/PricePercentageChange';
import { CWDivider } from '../../../component_kit/cw_divider';
import { CWIconButton } from '../../../component_kit/cw_icon_button';
import { CWText } from '../../../component_kit/cw_text';
import { CWButton } from '../../../component_kit/new_designs/CWButton';
+import MarketCapProgress from '../../../TokenCard/MarketCapProgress';
+import PricePercentageChange from '../../../TokenCard/PricePercentageChange';
import './TokenTradeWidget.scss';
import { TokenTradeWidgetSkeleton } from './TokenTradeWidgetSkeleton';
interface TokenTradeWidgetProps {
showSkeleton: boolean;
token: z.infer;
+ currency?: SupportedCurrencies;
}
export const TokenTradeWidget = ({
showSkeleton,
token,
+ currency = SupportedCurrencies.USD,
}: TokenTradeWidgetProps) => {
+ const currencySymbol = currencyNameToSymbolMap[currency];
+
const [isWidgetExpanded, setIsWidgetExpanded] = useState(true);
const [tokenLaunchModalConfig, setTokenLaunchModalConfig] = useState<{
isOpen: boolean;
@@ -78,7 +83,8 @@ export const TokenTradeWidget = ({
{isWidgetExpanded && (
<>
- {token.symbol} {tokenPricing.currentPrice}
+ {token.symbol} {currencySymbol}
+ {tokenPricing.currentPrice}
Date: Wed, 20 Nov 2024 22:43:43 +0500
Subject: [PATCH 148/227] Fix mcap calculation
---
packages/commonwealth/client/scripts/helpers/launchpad.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/packages/commonwealth/client/scripts/helpers/launchpad.ts b/packages/commonwealth/client/scripts/helpers/launchpad.ts
index 9054a1de211..fe4ea95c975 100644
--- a/packages/commonwealth/client/scripts/helpers/launchpad.ts
+++ b/packages/commonwealth/client/scripts/helpers/launchpad.ts
@@ -16,7 +16,7 @@ export const calculateTokenPricing = (
: priceChange) * 100 || 0
).toFixed(2),
);
- const marketCapCurrent = currentPrice * (token.initial_supply * ethToUsdRate);
+ const marketCapCurrent = currentPrice * token.initial_supply;
const marketCapGoal = token.eth_market_cap_target * ethToUsdRate;
const isMarketCapGoalReached = false;
From cd048999046ad5760bde5cff6f2c560527f4a124 Mon Sep 17 00:00:00 2001
From: rotorsoft
Date: Wed, 20 Nov 2024 12:48:50 -0500
Subject: [PATCH 149/227] first pass
---
libs/model/src/models/associations.ts | 2 +
libs/model/src/user/GetUserReferrals.query.ts | 51 +++++++++++++++++++
.../test/referral/referral-lifecycle.spec.ts | 32 ++++++++----
libs/model/test/utils/outbox-drain.ts | 8 +--
libs/schemas/src/entities/referral.schemas.ts | 15 ++++++
libs/schemas/src/queries/user.schemas.ts | 17 +++++++
6 files changed, 112 insertions(+), 13 deletions(-)
create mode 100644 libs/model/src/user/GetUserReferrals.query.ts
diff --git a/libs/model/src/models/associations.ts b/libs/model/src/models/associations.ts
index 65e64fe15b6..f9b8ee54bb1 100644
--- a/libs/model/src/models/associations.ts
+++ b/libs/model/src/models/associations.ts
@@ -23,11 +23,13 @@ export const buildAssociations = (db: DB) => {
})
.withMany(db.Referral, {
foreignKey: 'referrer_id',
+ asOne: 'referrer',
onUpdate: 'CASCADE',
onDelete: 'CASCADE',
})
.withMany(db.Referral, {
foreignKey: 'referee_id',
+ asOne: 'referee',
onUpdate: 'CASCADE',
onDelete: 'CASCADE',
});
diff --git a/libs/model/src/user/GetUserReferrals.query.ts b/libs/model/src/user/GetUserReferrals.query.ts
new file mode 100644
index 00000000000..8a471aeac19
--- /dev/null
+++ b/libs/model/src/user/GetUserReferrals.query.ts
@@ -0,0 +1,51 @@
+import { type Query } from '@hicommonwealth/core';
+import * as schemas from '@hicommonwealth/schemas';
+import { z } from 'zod';
+import { models } from '../database';
+
+export function GetUserReferrals(): Query {
+ return {
+ ...schemas.GetUserReferrals,
+ auth: [],
+ secure: true,
+ body: async ({ actor, payload }) => {
+ // only super admin can get referrals for all users
+ const id =
+ actor.user.isAdmin && payload.user_id ? payload.user_id : actor.user.id;
+
+ const referrals = await models.Referral.findAll({
+ where: { referrer_id: id },
+ include: [
+ {
+ model: models.User,
+ as: 'referrer',
+ attributes: ['id', 'profile'],
+ },
+ {
+ model: models.User,
+ as: 'referee',
+ attributes: ['id', 'profile'],
+ },
+ ],
+ });
+
+ // format view
+ return referrals.map(
+ (r) =>
+ ({
+ referrer: {
+ id: r.referrer_id,
+ profile: r.referrer!.profile,
+ },
+ referee: {
+ id: r.referee_id,
+ profile: r.referee!.profile,
+ },
+ event_name: r.event_name,
+ event_payload: r.event_payload,
+ created_at: r.created_at,
+ }) as z.infer,
+ );
+ },
+ };
+}
diff --git a/libs/model/test/referral/referral-lifecycle.spec.ts b/libs/model/test/referral/referral-lifecycle.spec.ts
index 529e1f4d82a..50643b7e8b3 100644
--- a/libs/model/test/referral/referral-lifecycle.spec.ts
+++ b/libs/model/test/referral/referral-lifecycle.spec.ts
@@ -1,10 +1,10 @@
-import { Actor, command, dispose } from '@hicommonwealth/core';
+import { Actor, command, dispose, query } from '@hicommonwealth/core';
import { ChainNode } from '@hicommonwealth/schemas';
import { ChainBase, ChainType } from '@hicommonwealth/shared';
+import { GetUserReferrals } from 'model/src/user/GetUserReferrals.query';
import { afterAll, beforeAll, describe, expect, it } from 'vitest';
import { z } from 'zod';
import { CreateCommunity } from '../../src/community';
-import { models } from '../../src/database';
import { CreateReferralLink, UserReferrals } from '../../src/user';
import { drainOutbox, seedCommunity } from '../utils';
@@ -54,15 +54,29 @@ describe('Referral lifecycle', () => {
await drainOutbox(['CommunityCreated'], UserReferrals);
// get referrals
- // TODO: use query after implementing it
- const referrals = await models.Referral.findAll({
- where: { referee_id: member.user.id },
+ const referrals = await query(GetUserReferrals(), {
+ actor: admin,
+ payload: {},
});
- expect(referrals.length).toBe(1);
- expect(referrals[0].toJSON()).toMatchObject({
- referrer_id: admin.user.id,
- referee_id: member.user.id,
+ expect(referrals?.length).toBe(1);
+
+ const ref = referrals!.at(0)!;
+ expect(ref).toMatchObject({
+ referrer: {
+ id: admin.user.id,
+ profile: {
+ name: 'admin',
+ avatar_url: ref.referrer.profile.avatar_url,
+ },
+ },
+ referee: {
+ id: member.user.id,
+ profile: {
+ name: 'member',
+ avatar_url: ref.referee.profile.avatar_url,
+ },
+ },
event_name: 'CommunityCreated',
event_payload: {
userId: member.user.id?.toString(),
diff --git a/libs/model/test/utils/outbox-drain.ts b/libs/model/test/utils/outbox-drain.ts
index 4eab47b9d41..5b8790bd552 100644
--- a/libs/model/test/utils/outbox-drain.ts
+++ b/libs/model/test/utils/outbox-drain.ts
@@ -1,5 +1,4 @@
import { Events, Projection, events, handleEvent } from '@hicommonwealth/core';
-import { delay } from '@hicommonwealth/shared';
import { Op } from 'sequelize';
import { ZodUndefined } from 'zod';
import { models } from '../../src/database';
@@ -24,6 +23,7 @@ export async function drainOutbox(
[Op.gte]: from ?? new Date(Date.now() - 1000 * 60 * 60 * 24 * 7),
},
},
+ order: [['created_at', 'ASC']],
});
const projection = factory();
for (const { event_name, event_payload } of drained) {
@@ -31,8 +31,8 @@ export async function drainOutbox(
name: event_name,
payload: event_payload,
});
- console.log(`>>> ${event_name} >>> ${factory.name}`);
+ console.log(
+ `>>> ${event_name} >>> ${factory.name} >>> ${JSON.stringify(event_payload)}`,
+ );
}
- // take a breather
- await delay(500);
}
diff --git a/libs/schemas/src/entities/referral.schemas.ts b/libs/schemas/src/entities/referral.schemas.ts
index f14496ffa74..09be58d7ee4 100644
--- a/libs/schemas/src/entities/referral.schemas.ts
+++ b/libs/schemas/src/entities/referral.schemas.ts
@@ -1,5 +1,6 @@
import z from 'zod';
import { PG_INT } from '../utils';
+import { UserProfile } from './user.schemas';
export const REFERRAL_EVENTS = ['CommunityCreated'] as const;
@@ -11,5 +12,19 @@ export const Referral = z
event_payload: z.any().describe('The payload of the event'),
created_at: z.coerce.date().optional(),
// TODO: add other metrics
+
+ // associations
+ referrer: z
+ .object({
+ id: PG_INT,
+ profile: UserProfile,
+ })
+ .optional(),
+ referee: z
+ .object({
+ id: PG_INT,
+ profile: UserProfile,
+ })
+ .optional(),
})
.describe('Projects referral events');
diff --git a/libs/schemas/src/queries/user.schemas.ts b/libs/schemas/src/queries/user.schemas.ts
index f297d343f9a..eb034c92997 100644
--- a/libs/schemas/src/queries/user.schemas.ts
+++ b/libs/schemas/src/queries/user.schemas.ts
@@ -1,5 +1,6 @@
import { ChainBase, Roles } from '@hicommonwealth/shared';
import { z } from 'zod';
+import { Referral } from '../entities';
import { Tags } from '../entities/tag.schemas';
import { UserProfile } from '../entities/user.schemas';
import { PG_INT } from '../utils';
@@ -81,3 +82,19 @@ export const GetUserAddresses = {
}),
),
};
+
+export const ReferralView = Referral.extend({
+ referrer: z.object({
+ id: PG_INT,
+ profile: UserProfile,
+ }),
+ referee: z.object({
+ id: PG_INT,
+ profile: UserProfile,
+ }),
+});
+
+export const GetUserReferrals = {
+ input: z.object({ user_id: PG_INT.optional() }),
+ output: z.array(ReferralView),
+};
From 966e72cc09611c3e6b45e9ceeb6bfa5008ce7ebc Mon Sep 17 00:00:00 2001
From: israellund
Date: Wed, 20 Nov 2024 12:57:10 -0500
Subject: [PATCH 150/227] added litepaper growl and updated growl functionality
---
.../client/assets/img/litepaperGrowlImage.svg | 160 ++++++++++++++++++
.../client/scripts/views/Sublayout.tsx | 12 ++
.../GrowlTemplate/CWGrowlTemplate.scss | 4 +
.../GrowlTemplate/CWGrowlTemplate.tsx | 4 +-
4 files changed, 179 insertions(+), 1 deletion(-)
create mode 100644 packages/commonwealth/client/assets/img/litepaperGrowlImage.svg
diff --git a/packages/commonwealth/client/assets/img/litepaperGrowlImage.svg b/packages/commonwealth/client/assets/img/litepaperGrowlImage.svg
new file mode 100644
index 00000000000..48f4ff633b0
--- /dev/null
+++ b/packages/commonwealth/client/assets/img/litepaperGrowlImage.svg
@@ -0,0 +1,160 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/packages/commonwealth/client/scripts/views/Sublayout.tsx b/packages/commonwealth/client/scripts/views/Sublayout.tsx
index 6de7c482e56..5ab1af5353a 100644
--- a/packages/commonwealth/client/scripts/views/Sublayout.tsx
+++ b/packages/commonwealth/client/scripts/views/Sublayout.tsx
@@ -8,6 +8,7 @@ import app from 'state';
import useSidebarStore from 'state/ui/sidebar';
import { SublayoutHeader } from 'views/components/SublayoutHeader';
import { Sidebar } from 'views/components/sidebar';
+import litepaperGrowlImage from '../../assets/img/litepaperGrowlImage.svg';
import useNecessaryEffect from '../hooks/useNecessaryEffect';
import useStickyHeader from '../hooks/useStickyHeader';
import { useAuthModalStore, useWelcomeOnboardModal } from '../state/ui/modals';
@@ -17,6 +18,7 @@ import { AdminOnboardingSlider } from './components/AdminOnboardingSlider';
import { Breadcrumbs } from './components/Breadcrumbs';
import MobileNavigation from './components/MobileNavigation';
import AuthButtons from './components/SublayoutHeader/AuthButtons';
+import { CWGrowlTemplate } from './components/SublayoutHeader/GrowlTemplate/CWGrowlTemplate';
import { UserTrainingSlider } from './components/UserTrainingSlider';
import CollapsableSidebarButton from './components/sidebar/CollapsableSidebarButton';
import { AuthModal, AuthModalType } from './modals/AuthModal';
@@ -173,6 +175,16 @@ const Sublayout = ({ children, isInsideCommunity }: SublayoutProps) => {
)}
{children}
+
{
const { setIsGrowlHidden, isGrowlHidden } = useGrowlStore();
@@ -60,7 +62,7 @@ export const CWGrowlTemplate = ({
{growlImage && }
From 1b9748dce7ab18f53eb87e4ec90ef26b51805ab2 Mon Sep 17 00:00:00 2001
From: Timothee Legros
Date: Wed, 20 Nov 2024 20:00:49 +0200
Subject: [PATCH 151/227] move event signatures
---
libs/core/package.json | 1 +
.../core/src/integration/chain-event.utils.ts | 34 ++---------
libs/core/src/integration/events.utils.ts | 15 +----
libs/core/tsconfig.build.json | 9 ++-
libs/core/tsconfig.json | 9 ++-
.../src/event-registry/eventSignatures.ts | 59 +++++++++++++++++++
libs/evm-protocols/src/index.ts | 1 +
.../chain-events/ChainEventCreated.command.ts | 5 +-
libs/model/src/chainEventSignatures.ts | 17 ------
libs/model/src/contest/Contests.projection.ts | 9 +--
libs/model/src/index.ts | 1 -
.../commonProtocol/launchpadHelpers.ts | 5 +-
.../commonProtocol/newNamespaceValidator.ts | 6 +-
.../chainEventCreatedPolicy.ts | 6 +-
.../workers/evmChainEvents/nodeProcessing.ts | 6 +-
.../knock/eventHandlers/chainEventCreated.ts | 4 +-
.../knock/chainEventCreated.spec.ts | 7 +--
pnpm-lock.yaml | 3 +
18 files changed, 105 insertions(+), 92 deletions(-)
create mode 100644 libs/evm-protocols/src/event-registry/eventSignatures.ts
delete mode 100644 libs/model/src/chainEventSignatures.ts
diff --git a/libs/core/package.json b/libs/core/package.json
index 80f72701015..03f914245b5 100644
--- a/libs/core/package.json
+++ b/libs/core/package.json
@@ -23,6 +23,7 @@
},
"dependencies": {
"@hicommonwealth/schemas": "workspace:*",
+ "@hicommonwealth/evm-protocols": "workspace:*",
"dotenv": "^16.0.3",
"ethers": "5.7.2",
"lodash": "^4.17.21",
diff --git a/libs/core/src/integration/chain-event.utils.ts b/libs/core/src/integration/chain-event.utils.ts
index 0a4d92491dc..4e8972620ef 100644
--- a/libs/core/src/integration/chain-event.utils.ts
+++ b/libs/core/src/integration/chain-event.utils.ts
@@ -1,4 +1,8 @@
import { EventNames, EventPairs } from '@hicommonwealth/core';
+import {
+ EvmEventSignature,
+ EvmEventSignatures,
+} from '@hicommonwealth/evm-protocols';
import { ETHERS_BIG_NUMBER, EVM_ADDRESS } from '@hicommonwealth/schemas';
import { BigNumber } from 'ethers';
import { decodeLog } from 'web3-eth-abi';
@@ -8,39 +12,11 @@ import { z } from 'zod';
* To add a new chain-event:
* 1. Add the event signature to EvmEventSignatures
* 2. Create a Zod schema for the Common equivalent of the parsed event and add it to ChainEventSchemas
- * 3.Add the Event inputs ABI to EvmEventAbis
+ * 3. Add the Event inputs ABI to EvmEventAbis
* 4. Create a mapping function that implements the EventMapper type
* 5. Add the new mapper to the EvmMappers object
*/
-export const EvmEventSignatures = {
- NamespaceFactory: {
- NamespaceDeployed:
- '0x8870ba2202802ce285ce6bead5ac915b6dc2d35c8a9d6f96fa56de9de12829d5',
- ContestManagerDeployed:
- '0x990f533044dbc89b838acde9cd2c72c400999871cf8f792d731edcae15ead693',
- },
- Contests: {
- ContentAdded:
- '0x2f0d66b98c7708890a982e2194479b066a117a6f9a8f418f7f14c6001965b78b',
- RecurringContestStarted:
- '0x32391ebd47fc736bb885d21a45d95c3da80aef6987aa90a5c6e747e9bc755bc9',
- RecurringContestVoterVoted:
- '0x68d40dd5e34d499a209946f8e381c1258bdeff6dea4e96e9ab921da385c03667',
- SingleContestStarted:
- '0x002817006cf5e3f9ac0de6817ca39830ac7e731a4949a59e4ac3c8bef988b20c',
- SingleContestVoterVoted:
- '0xba2ce2b4fab99c4186fd3e0a8e93ffb61e332d0c4709bd01d01e7ac60631437a',
- },
- CommunityStake: {
- Trade: '0xfc13c9a8a9a619ac78b803aecb26abdd009182411d51a986090f82519d88a89e',
- },
-} as const;
-
-type Values = T[keyof T];
-type NestedValues = Values<{ [K in keyof T]: Values }>;
-export type EvmEventSignature = NestedValues;
-
// Event Inputs can be found in the contract ABI by filtering the objects by type = 'event' e.g.:
// for (const obj of abi) {
// if (obj.type === 'event') console.log(obj)
diff --git a/libs/core/src/integration/events.utils.ts b/libs/core/src/integration/events.utils.ts
index 2419d9bc487..00e2ea2a25a 100644
--- a/libs/core/src/integration/events.utils.ts
+++ b/libs/core/src/integration/events.utils.ts
@@ -1,3 +1,4 @@
+import { ChainEventSigs } from '@hicommonwealth/evm-protocols';
import { ETHERS_BIG_NUMBER, EVM_ADDRESS } from '@hicommonwealth/schemas';
import { BigNumber } from 'ethers';
import type { Result } from 'ethers/lib/utils';
@@ -50,20 +51,6 @@ type EvmMapper = {
};
};
-export const ChainEventSigs = {
- NewContest:
- 'address contest, address namespace, uint256 interval, bool oneOff' as const,
- NewRecurringContestStarted:
- 'uint256 indexed contestId, uint256 startTime, uint256 endTime' as const,
- NewSingleContestStarted: 'uint256 startTime, uint256 endTime' as const,
- ContentAdded:
- 'uint256 indexed contentId, address indexed creator, string url' as const,
- VoterVotedRecurring:
- 'address indexed voter, uint256 indexed contentId, uint256 contestId, uint256 votingPower' as const,
- VoterVotedOneOff:
- 'address indexed voter, uint256 indexed contentId, uint256 votingPower' as const,
-};
-
const RecurringContestManagerDeployedMapper: EvmMapper<
typeof ChainEventSigs.NewContest,
typeof RecurringContestManagerDeployed
diff --git a/libs/core/tsconfig.build.json b/libs/core/tsconfig.build.json
index 3e57d8e874f..77131d915d8 100644
--- a/libs/core/tsconfig.build.json
+++ b/libs/core/tsconfig.build.json
@@ -5,5 +5,12 @@
"outDir": "build"
},
"include": ["src"],
- "references": [{ "path": "../schemas/tsconfig.build.json" }]
+ "references": [
+ {
+ "path": "../schemas/tsconfig.build.json"
+ },
+ {
+ "path": "../evm-protocols/tsconfig.build.json"
+ }
+ ]
}
diff --git a/libs/core/tsconfig.json b/libs/core/tsconfig.json
index 62720b2bb66..cb209686887 100644
--- a/libs/core/tsconfig.json
+++ b/libs/core/tsconfig.json
@@ -1,4 +1,11 @@
{
"extends": "../tsconfig.json",
- "references": [{ "path": "../schemas/tsconfig.build.json" }]
+ "references": [
+ {
+ "path": "../schemas/tsconfig.build.json"
+ },
+ {
+ "path": "../evm-protocols/tsconfig.build.json"
+ }
+ ]
}
diff --git a/libs/evm-protocols/src/event-registry/eventSignatures.ts b/libs/evm-protocols/src/event-registry/eventSignatures.ts
new file mode 100644
index 00000000000..f4a23fd4cb4
--- /dev/null
+++ b/libs/evm-protocols/src/event-registry/eventSignatures.ts
@@ -0,0 +1,59 @@
+export const deployedNamespaceEventSignature =
+ '0x8870ba2202802ce285ce6bead5ac915b6dc2d35c8a9d6f96fa56de9de12829d5';
+
+export const communityStakeTradeEventSignature =
+ '0xfc13c9a8a9a619ac78b803aecb26abdd009182411d51a986090f82519d88a89e';
+
+export const launchpadTokenLaunchedEventSignature =
+ '0xd7ca5dc2f8c6bb37c3a4de2a81499b25f8ca8bbb3082010244fe747077d0f6cc';
+
+export const launchpadTradeEventSignature =
+ '0x9adcf0ad0cda63c4d50f26a48925cf6405df27d422a39c456b5f03f661c82982';
+
+export const launchpadTokenRegisteredEventSignature =
+ '0xc2fe88a1a3c1957424571593960b97f158a519d0aa4cef9e13a247c64f1f4c35';
+
+export const communityNamespaceCreatedEventSignature =
+ '0xa16d784cb6c784b621c7877ce80495765ed32ca0b3dba2ef467116a435f125fd';
+
+export const ChainEventSigs = {
+ NewContest:
+ 'address contest, address namespace, uint256 interval, bool oneOff' as const,
+ NewRecurringContestStarted:
+ 'uint256 indexed contestId, uint256 startTime, uint256 endTime' as const,
+ NewSingleContestStarted: 'uint256 startTime, uint256 endTime' as const,
+ ContentAdded:
+ 'uint256 indexed contentId, address indexed creator, string url' as const,
+ VoterVotedRecurring:
+ 'address indexed voter, uint256 indexed contentId, uint256 contestId, uint256 votingPower' as const,
+ VoterVotedOneOff:
+ 'address indexed voter, uint256 indexed contentId, uint256 votingPower' as const,
+};
+
+export const EvmEventSignatures = {
+ NamespaceFactory: {
+ NamespaceDeployed:
+ '0x8870ba2202802ce285ce6bead5ac915b6dc2d35c8a9d6f96fa56de9de12829d5',
+ ContestManagerDeployed:
+ '0x990f533044dbc89b838acde9cd2c72c400999871cf8f792d731edcae15ead693',
+ },
+ Contests: {
+ ContentAdded:
+ '0x2f0d66b98c7708890a982e2194479b066a117a6f9a8f418f7f14c6001965b78b',
+ RecurringContestStarted:
+ '0x32391ebd47fc736bb885d21a45d95c3da80aef6987aa90a5c6e747e9bc755bc9',
+ RecurringContestVoterVoted:
+ '0x68d40dd5e34d499a209946f8e381c1258bdeff6dea4e96e9ab921da385c03667',
+ SingleContestStarted:
+ '0x002817006cf5e3f9ac0de6817ca39830ac7e731a4949a59e4ac3c8bef988b20c',
+ SingleContestVoterVoted:
+ '0xba2ce2b4fab99c4186fd3e0a8e93ffb61e332d0c4709bd01d01e7ac60631437a',
+ },
+ CommunityStake: {
+ Trade: '0xfc13c9a8a9a619ac78b803aecb26abdd009182411d51a986090f82519d88a89e',
+ },
+} as const;
+
+type Values = T[keyof T];
+type NestedValues = Values<{ [K in keyof T]: Values }>;
+export type EvmEventSignature = NestedValues;
diff --git a/libs/evm-protocols/src/index.ts b/libs/evm-protocols/src/index.ts
index 1dd1157d596..af1fcdad9fe 100644
--- a/libs/evm-protocols/src/index.ts
+++ b/libs/evm-protocols/src/index.ts
@@ -8,3 +8,4 @@ export * from './abis/namespaceAbi';
export * from './abis/namespaceFactoryAbi';
export * from './abis/reservationHookAbi';
export * from './abis/tokenCommunityManagerAbi';
+export * from './event-registry/eventSignatures';
diff --git a/libs/model/src/chain-events/ChainEventCreated.command.ts b/libs/model/src/chain-events/ChainEventCreated.command.ts
index c3cdeb9e737..304f6567815 100644
--- a/libs/model/src/chain-events/ChainEventCreated.command.ts
+++ b/libs/model/src/chain-events/ChainEventCreated.command.ts
@@ -1,9 +1,8 @@
+import { parseEvmEvent, type Command } from '@hicommonwealth/core';
import {
EvmEventSignature,
EvmEventSignatures,
- parseEvmEvent,
- type Command,
-} from '@hicommonwealth/core';
+} from '@hicommonwealth/evm-protocols';
import {
config,
emitEvent,
diff --git a/libs/model/src/chainEventSignatures.ts b/libs/model/src/chainEventSignatures.ts
deleted file mode 100644
index aab7928d388..00000000000
--- a/libs/model/src/chainEventSignatures.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-export const deployedNamespaceEventSignature =
- '0x8870ba2202802ce285ce6bead5ac915b6dc2d35c8a9d6f96fa56de9de12829d5';
-
-export const communityStakeTradeEventSignature =
- '0xfc13c9a8a9a619ac78b803aecb26abdd009182411d51a986090f82519d88a89e';
-
-export const launchpadTokenLaunchedEventSignature =
- '0xd7ca5dc2f8c6bb37c3a4de2a81499b25f8ca8bbb3082010244fe747077d0f6cc';
-
-export const launchpadTradeEventSignature =
- '0x9adcf0ad0cda63c4d50f26a48925cf6405df27d422a39c456b5f03f661c82982';
-
-export const launchpadTokenRegisteredEventSignature =
- '0xc2fe88a1a3c1957424571593960b97f158a519d0aa4cef9e13a247c64f1f4c35';
-
-export const communityNamespaceCreatedEventSignature =
- '0xa16d784cb6c784b621c7877ce80495765ed32ca0b3dba2ef467116a435f125fd';
diff --git a/libs/model/src/contest/Contests.projection.ts b/libs/model/src/contest/Contests.projection.ts
index d8961ae3859..e192526ffa0 100644
--- a/libs/model/src/contest/Contests.projection.ts
+++ b/libs/model/src/contest/Contests.projection.ts
@@ -1,11 +1,6 @@
import { BigNumber } from '@ethersproject/bignumber';
-import {
- EvmEventSignatures,
- InvalidState,
- Projection,
- events,
- logger,
-} from '@hicommonwealth/core';
+import { InvalidState, Projection, events, logger } from '@hicommonwealth/core';
+import { EvmEventSignatures } from '@hicommonwealth/evm-protocols';
import { ContestScore } from '@hicommonwealth/schemas';
import { QueryTypes } from 'sequelize';
import { z } from 'zod';
diff --git a/libs/model/src/index.ts b/libs/model/src/index.ts
index 6183e4cdcaa..88bf9e92443 100644
--- a/libs/model/src/index.ts
+++ b/libs/model/src/index.ts
@@ -30,7 +30,6 @@ export type { E2E_TestEntities } from './tester';
export * as middleware from './middleware';
// Internals - Should not be exported once we finish the migrations to models
-export * from './chainEventSignatures';
export * from './config';
export * from './database';
export * from './models';
diff --git a/libs/model/src/services/commonProtocol/launchpadHelpers.ts b/libs/model/src/services/commonProtocol/launchpadHelpers.ts
index 67f75cd6bc0..ccb00153141 100644
--- a/libs/model/src/services/commonProtocol/launchpadHelpers.ts
+++ b/libs/model/src/services/commonProtocol/launchpadHelpers.ts
@@ -1,10 +1,11 @@
import { logger } from '@hicommonwealth/core';
-import { erc20Abi, lpBondingCurveAbi } from '@hicommonwealth/evm-protocols';
import {
deployedNamespaceEventSignature,
+ erc20Abi,
launchpadTokenRegisteredEventSignature,
launchpadTradeEventSignature,
-} from '@hicommonwealth/model';
+ lpBondingCurveAbi,
+} from '@hicommonwealth/evm-protocols';
import { commonProtocol } from '@hicommonwealth/shared';
import { Web3 } from 'web3';
import { createWeb3Provider } from './utils';
diff --git a/libs/model/src/services/commonProtocol/newNamespaceValidator.ts b/libs/model/src/services/commonProtocol/newNamespaceValidator.ts
index ecf76147299..aea35ca02f7 100644
--- a/libs/model/src/services/commonProtocol/newNamespaceValidator.ts
+++ b/libs/model/src/services/commonProtocol/newNamespaceValidator.ts
@@ -1,8 +1,6 @@
import { AppError, ServerError } from '@hicommonwealth/core';
-import {
- communityNamespaceCreatedEventSignature,
- models,
-} from '@hicommonwealth/model';
+import { communityNamespaceCreatedEventSignature } from '@hicommonwealth/evm-protocols';
+import { models } from '@hicommonwealth/model';
import { BalanceSourceType, commonProtocol } from '@hicommonwealth/shared';
import Web3 from 'web3';
import { CommunityAttributes } from '../../models';
diff --git a/packages/commonwealth/server/workers/commonwealthConsumer/policies/chainEventCreated/chainEventCreatedPolicy.ts b/packages/commonwealth/server/workers/commonwealthConsumer/policies/chainEventCreated/chainEventCreatedPolicy.ts
index 05b627da04f..fb16e924fb2 100644
--- a/packages/commonwealth/server/workers/commonwealthConsumer/policies/chainEventCreated/chainEventCreatedPolicy.ts
+++ b/packages/commonwealth/server/workers/commonwealthConsumer/policies/chainEventCreated/chainEventCreatedPolicy.ts
@@ -6,14 +6,12 @@ import {
logger,
} from '@hicommonwealth/core';
import {
- Token,
communityStakeTradeEventSignature,
deployedNamespaceEventSignature,
launchpadTokenLaunchedEventSignature,
launchpadTradeEventSignature,
- middleware,
- models,
-} from '@hicommonwealth/model';
+} from '@hicommonwealth/evm-protocols';
+import { Token, middleware, models } from '@hicommonwealth/model';
import { ZodUndefined } from 'zod';
import { handleCommunityStakeTrades } from './handleCommunityStakeTrades';
import { handleLaunchpadTrade } from './handleLaunchpadTrade';
diff --git a/packages/commonwealth/server/workers/evmChainEvents/nodeProcessing.ts b/packages/commonwealth/server/workers/evmChainEvents/nodeProcessing.ts
index a6f545e09f0..37976ba40b2 100644
--- a/packages/commonwealth/server/workers/evmChainEvents/nodeProcessing.ts
+++ b/packages/commonwealth/server/workers/evmChainEvents/nodeProcessing.ts
@@ -1,10 +1,8 @@
import {
- ChainEventSigs,
ContestContentAdded,
ContestContentUpvoted,
ContestStarted,
EventNames,
- EvmEventSignatures,
OneOffContestManagerDeployed,
RecurringContestManagerDeployed,
events as coreEvents,
@@ -12,6 +10,10 @@ import {
parseEvmEventToContestEvent,
stats,
} from '@hicommonwealth/core';
+import {
+ ChainEventSigs,
+ EvmEventSignatures,
+} from '@hicommonwealth/evm-protocols';
import { DB, emitEvent } from '@hicommonwealth/model';
import { ethers } from 'ethers';
import { z } from 'zod';
diff --git a/packages/commonwealth/server/workers/knock/eventHandlers/chainEventCreated.ts b/packages/commonwealth/server/workers/knock/eventHandlers/chainEventCreated.ts
index bf0fd2e925e..ce770bcc8dc 100644
--- a/packages/commonwealth/server/workers/knock/eventHandlers/chainEventCreated.ts
+++ b/packages/commonwealth/server/workers/knock/eventHandlers/chainEventCreated.ts
@@ -2,8 +2,8 @@ import { EventHandler, logger } from '@hicommonwealth/core';
import {
communityStakeTradeEventSignature,
deployedNamespaceEventSignature,
- models,
-} from '@hicommonwealth/model';
+} from '@hicommonwealth/evm-protocols';
+import { models } from '@hicommonwealth/model';
import z from 'zod';
import { handleCommunityStakeTrades } from './chainEvents/handleCommunityStakeTrades';
diff --git a/packages/commonwealth/test/integration/knock/chainEventCreated.spec.ts b/packages/commonwealth/test/integration/knock/chainEventCreated.spec.ts
index f05c526e24f..2fb66aa7593 100644
--- a/packages/commonwealth/test/integration/knock/chainEventCreated.spec.ts
+++ b/packages/commonwealth/test/integration/knock/chainEventCreated.spec.ts
@@ -9,11 +9,8 @@ import {
disposeAdapter,
notificationsProvider,
} from '@hicommonwealth/core';
-import {
- communityStakeTradeEventSignature,
- models,
- tester,
-} from '@hicommonwealth/model';
+import { communityStakeTradeEventSignature } from '@hicommonwealth/evm-protocols';
+import { models, tester } from '@hicommonwealth/model';
import * as schemas from '@hicommonwealth/schemas';
import { BalanceType } from '@hicommonwealth/shared';
import chai, { expect } from 'chai';
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 0ef9c5b29fc..5614cd2c907 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -455,6 +455,9 @@ importers:
libs/core:
dependencies:
+ '@hicommonwealth/evm-protocols':
+ specifier: workspace:*
+ version: link:../evm-protocols
'@hicommonwealth/schemas':
specifier: workspace:*
version: link:../schemas
From 1ba932e5edf493d44d04413ff1803ab124d47759 Mon Sep 17 00:00:00 2001
From: Ryan Bennett
Date: Wed, 20 Nov 2024 10:09:05 -0800
Subject: [PATCH 152/227] add button to install farcaster action
---
.../server/farcaster/frames/contest/contestCard.tsx | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/packages/commonwealth/server/farcaster/frames/contest/contestCard.tsx b/packages/commonwealth/server/farcaster/frames/contest/contestCard.tsx
index 7173f3c4cdc..2f8da787ef2 100644
--- a/packages/commonwealth/server/farcaster/frames/contest/contestCard.tsx
+++ b/packages/commonwealth/server/farcaster/frames/contest/contestCard.tsx
@@ -1,5 +1,5 @@
-import { command, config } from '@hicommonwealth/core';
-import { Contest } from '@hicommonwealth/model';
+import { config, query } from '@hicommonwealth/core';
+import { Contest, config as modelConfig } from '@hicommonwealth/model';
import { Button } from 'frames.js/express';
import React from 'react';
@@ -8,7 +8,7 @@ import { frames } from '../../config';
export const contestCard = frames(async (ctx) => {
const contest_address = ctx.url.pathname.split('/')[1];
- const contestManager = await command(Contest.GetContest(), {
+ const contestManager = await query(Contest.GetContest(), {
actor: { user: { email: '' } },
payload: { contest_address, with_chain_node: true },
});
@@ -101,6 +101,9 @@ export const contestCard = frames(async (ctx) => {
>
Check Eligibility
,
+
+ Install Upvote Action
+ ,
],
};
});
@@ -117,3 +120,7 @@ const getBaseUrl = () => {
return 'https://commonwealth.im';
}
};
+
+export const getActionInstallUrl = () =>
+ // eslint-disable-next-line max-len
+ `https://warpcast.com/~/add-cast-action?actionType=post&name=Upvote+Content&icon=thumbsup&postUrl=${modelConfig.CONTESTS.FARCASTER_ACTION_URL}`;
From 56ef6547e1b808b5eb8d51c6bb45b592690e3305 Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Wed, 20 Nov 2024 23:24:28 +0500
Subject: [PATCH 153/227] Added todo for post-launchpad token trade
---
packages/commonwealth/client/scripts/helpers/launchpad.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/packages/commonwealth/client/scripts/helpers/launchpad.ts b/packages/commonwealth/client/scripts/helpers/launchpad.ts
index fe4ea95c975..78d9edecff3 100644
--- a/packages/commonwealth/client/scripts/helpers/launchpad.ts
+++ b/packages/commonwealth/client/scripts/helpers/launchpad.ts
@@ -18,7 +18,7 @@ export const calculateTokenPricing = (
);
const marketCapCurrent = currentPrice * token.initial_supply;
const marketCapGoal = token.eth_market_cap_target * ethToUsdRate;
- const isMarketCapGoalReached = false;
+ const isMarketCapGoalReached = false; // TODO: https://github.com/hicommonwealth/commonwealth/issues/9887
return {
currentPrice: `${currentPrice.toFixed(8)}`,
From c2176b5142c35c74e9619c531a423563d5d1db35 Mon Sep 17 00:00:00 2001
From: israellund
Date: Wed, 20 Nov 2024 13:32:17 -0500
Subject: [PATCH 154/227] X now shows on All/Overview model desktop and mobile
---
.../client/scripts/views/pages/discussions/DiscussionsPage.tsx | 1 +
1 file changed, 1 insertion(+)
diff --git a/packages/commonwealth/client/scripts/views/pages/discussions/DiscussionsPage.tsx b/packages/commonwealth/client/scripts/views/pages/discussions/DiscussionsPage.tsx
index 22217596749..ff9eb028d88 100644
--- a/packages/commonwealth/client/scripts/views/pages/discussions/DiscussionsPage.tsx
+++ b/packages/commonwealth/client/scripts/views/pages/discussions/DiscussionsPage.tsx
@@ -403,6 +403,7 @@ const DiscussionsPage = ({ topicName }: DiscussionsPageProps) => {
bodyText="'Overview' page has been merged with the 'All' page"
buttonText="test"
growlType="discussion"
+ blackCloseButton
/>
>
);
From b0c1b5539e7ba9322757d3623cec6dc5ce9332f9 Mon Sep 17 00:00:00 2001
From: Timothee Legros
Date: Wed, 20 Nov 2024 20:49:27 +0200
Subject: [PATCH 155/227] move `shared/commonProtocol` to `libs/evm-protocols`
---
libs/evm-protocols/package.json | 2 ++
.../src/commonProtocol/chainConfig.ts | 0
.../commonProtocol/contractHelpers/Contest.ts | 0
.../contractHelpers/Launchpad.ts | 0
.../src/commonProtocol/index.ts | 0
.../src/commonProtocol/utils.ts | 0
libs/evm-protocols/src/index.ts | 1 +
.../test/commonProtocol.spec.ts | 2 +-
libs/evm-protocols/tsconfig.build.json | 2 +-
libs/evm-protocols/tsconfig.json | 2 +-
libs/evm-testing/src/sdk/communityStake.ts | 14 ++++++--------
libs/evm-testing/src/sdk/namespaceFactory.ts | 4 ++--
.../chain-events/ChainEventCreated.command.ts | 2 +-
.../CreateStakeTransaction.command.ts | 2 +-
.../communityStakeConfigValidator.ts | 2 +-
.../services/commonProtocol/contestHelper.ts | 7 +++++--
.../services/commonProtocol/contractHelpers.ts | 8 ++------
.../commonProtocol/launchpadHelpers.ts | 2 +-
.../commonProtocol/newNamespaceValidator.ts | 7 +++++--
libs/model/src/services/stakeHelper.ts | 3 ++-
.../src/services/tokenBalanceCache/types.ts | 3 ++-
.../src/token/CreateLaunchpadTrade.command.ts | 2 +-
libs/model/src/token/CreateToken.command.ts | 2 +-
.../test/community/stake-transaction.spec.ts | 3 ++-
.../contests-projection-lifecycle.spec.ts | 3 ++-
libs/model/test/launchpad/launchpad.spec.ts | 3 ++-
libs/schemas/package.json | 1 +
libs/schemas/src/commands/contest.schemas.ts | 2 +-
.../src/entities/contest-manager.schemas.ts | 3 ++-
libs/schemas/src/entities/topic.schemas.ts | 3 ++-
libs/schemas/tsconfig.build.json | 5 ++++-
libs/schemas/tsconfig.json | 5 ++++-
libs/shared/src/index.ts | 1 -
.../scripts/helpers/ContractHelpers/Contest.ts | 3 ++-
.../helpers/ContractHelpers/Launchpad.ts | 18 ++++++------------
.../state/api/communityStake/buyStake.ts | 2 +-
.../state/api/communityStake/getBuyPrice.ts | 2 +-
.../state/api/communityStake/getSellPrice.ts | 2 +-
.../api/communityStake/getUserEthBalance.ts | 2 +-
.../api/communityStake/getUserStakeBalance.ts | 2 +-
.../state/api/communityStake/sellStake.ts | 2 +-
.../contests/deployRecurringContestOnchain.ts | 2 +-
.../deploySingleERC20ContestOnchain.ts | 2 +-
.../state/api/contests/fundContestOnchain.ts | 2 +-
.../state/api/contests/getContestBalance.ts | 2 +-
.../scripts/state/api/launchPad/buyToken.ts | 2 +-
.../scripts/state/api/launchPad/launchToken.ts | 2 +-
.../scripts/state/api/launchPad/sellToken.ts | 2 +-
.../api/launchPad/tokenEthExchangeRate.ts | 2 +-
.../AdminOnboardingSlider.tsx | 3 ++-
.../CommunityInformationForm/constants.ts | 2 +-
.../CommunityStake/useCommunityStake.ts | 2 +-
.../StakeExchangeForm/StakeExchangeForm.tsx | 2 +-
.../hooks/useStakeExchange.ts | 2 +-
.../TradeTokenForm/useTradeTokenForm.ts | 2 +-
.../Contests/ManageContest/ManageContest.tsx | 2 +-
.../SignTransactionsStep.tsx | 6 +++---
.../StakeIntegration/StakeIntegration.tsx | 2 +-
.../useLaunchCommunityStake.tsx | 2 +-
.../CommunityStakeStep/useNamespaceFactory.ts | 2 +-
.../CommunityInformationStep.tsx | 3 ++-
.../LaunchToken/useCreateTokenCommunity.ts | 2 +-
.../chainEventCreated/handleLaunchpadTrade.ts | 7 +++----
.../test/devnet/evm/evmChainEvents.spec.ts | 8 ++------
.../test/integration/evmChainEvents/util.ts | 3 ++-
pnpm-lock.yaml | 17 +++++++++++++----
66 files changed, 115 insertions(+), 97 deletions(-)
rename libs/{shared => evm-protocols}/src/commonProtocol/chainConfig.ts (100%)
rename libs/{shared => evm-protocols}/src/commonProtocol/contractHelpers/Contest.ts (100%)
rename libs/{shared => evm-protocols}/src/commonProtocol/contractHelpers/Launchpad.ts (100%)
rename libs/{shared => evm-protocols}/src/commonProtocol/index.ts (100%)
rename libs/{shared => evm-protocols}/src/commonProtocol/utils.ts (100%)
rename libs/{shared => evm-protocols}/test/commonProtocol.spec.ts (95%)
diff --git a/libs/evm-protocols/package.json b/libs/evm-protocols/package.json
index 3db305605fc..816b0d27896 100644
--- a/libs/evm-protocols/package.json
+++ b/libs/evm-protocols/package.json
@@ -22,6 +22,8 @@
"lint-diff": "NODE_OPTIONS=\"--max-old-space-size=4096\" eslint -c ../../.eslintrc-diff.cjs './src/**/*.{ts,tsx}'"
},
"dependencies": {
+ "@hicommonwealth/shared": "workspace:*",
+ "@ethersproject/bignumber": "^5.7.0",
"moment": "^2.23.0"
}
}
diff --git a/libs/shared/src/commonProtocol/chainConfig.ts b/libs/evm-protocols/src/commonProtocol/chainConfig.ts
similarity index 100%
rename from libs/shared/src/commonProtocol/chainConfig.ts
rename to libs/evm-protocols/src/commonProtocol/chainConfig.ts
diff --git a/libs/shared/src/commonProtocol/contractHelpers/Contest.ts b/libs/evm-protocols/src/commonProtocol/contractHelpers/Contest.ts
similarity index 100%
rename from libs/shared/src/commonProtocol/contractHelpers/Contest.ts
rename to libs/evm-protocols/src/commonProtocol/contractHelpers/Contest.ts
diff --git a/libs/shared/src/commonProtocol/contractHelpers/Launchpad.ts b/libs/evm-protocols/src/commonProtocol/contractHelpers/Launchpad.ts
similarity index 100%
rename from libs/shared/src/commonProtocol/contractHelpers/Launchpad.ts
rename to libs/evm-protocols/src/commonProtocol/contractHelpers/Launchpad.ts
diff --git a/libs/shared/src/commonProtocol/index.ts b/libs/evm-protocols/src/commonProtocol/index.ts
similarity index 100%
rename from libs/shared/src/commonProtocol/index.ts
rename to libs/evm-protocols/src/commonProtocol/index.ts
diff --git a/libs/shared/src/commonProtocol/utils.ts b/libs/evm-protocols/src/commonProtocol/utils.ts
similarity index 100%
rename from libs/shared/src/commonProtocol/utils.ts
rename to libs/evm-protocols/src/commonProtocol/utils.ts
diff --git a/libs/evm-protocols/src/index.ts b/libs/evm-protocols/src/index.ts
index af1fcdad9fe..cf9dc82c0e1 100644
--- a/libs/evm-protocols/src/index.ts
+++ b/libs/evm-protocols/src/index.ts
@@ -8,4 +8,5 @@ export * from './abis/namespaceAbi';
export * from './abis/namespaceFactoryAbi';
export * from './abis/reservationHookAbi';
export * from './abis/tokenCommunityManagerAbi';
+export * as commonProtocol from './commonProtocol';
export * from './event-registry/eventSignatures';
diff --git a/libs/shared/test/commonProtocol.spec.ts b/libs/evm-protocols/test/commonProtocol.spec.ts
similarity index 95%
rename from libs/shared/test/commonProtocol.spec.ts
rename to libs/evm-protocols/test/commonProtocol.spec.ts
index 421ae3e5c90..4a68f21ce8c 100644
--- a/libs/shared/test/commonProtocol.spec.ts
+++ b/libs/evm-protocols/test/commonProtocol.spec.ts
@@ -1,5 +1,5 @@
-import { calculateVoteWeight } from 'shared/src/commonProtocol';
import { describe, expect, it } from 'vitest';
+import { calculateVoteWeight } from '../src/commonProtocol';
describe('commonProtocol', () => {
describe('calculateVoteWeight', () => {
diff --git a/libs/evm-protocols/tsconfig.build.json b/libs/evm-protocols/tsconfig.build.json
index ae1687b715d..5e3d942f39d 100644
--- a/libs/evm-protocols/tsconfig.build.json
+++ b/libs/evm-protocols/tsconfig.build.json
@@ -5,5 +5,5 @@
"outDir": "build"
},
"include": ["src"],
- "references": []
+ "references": [{ "path": "../shared/tsconfig.build.json" }]
}
diff --git a/libs/evm-protocols/tsconfig.json b/libs/evm-protocols/tsconfig.json
index 4f4bd883433..002c12c4ae4 100644
--- a/libs/evm-protocols/tsconfig.json
+++ b/libs/evm-protocols/tsconfig.json
@@ -1,4 +1,4 @@
{
"extends": "../tsconfig.json",
- "references": []
+ "references": [{ "path": "../shared/tsconfig.build.json" }]
}
diff --git a/libs/evm-testing/src/sdk/communityStake.ts b/libs/evm-testing/src/sdk/communityStake.ts
index 4f3a3f0c8c2..2f6872b9630 100644
--- a/libs/evm-testing/src/sdk/communityStake.ts
+++ b/libs/evm-testing/src/sdk/communityStake.ts
@@ -1,11 +1,11 @@
-import { factoryContracts } from 'shared/src/commonProtocol';
+import { commonProtocol as cp } from '@hicommonwealth/evm-protocols';
import { AbiFragment, Contract } from 'web3';
import { community_stake } from '../utils/contracts';
import { NamespaceFactory } from './namespaceFactory';
import { SdkBase } from './sdkBase';
export class CommunityStake extends SdkBase {
- public address: string = factoryContracts[84532].communityStake;
+ public address: string = cp.factoryContracts[84532].communityStake;
public contract: Contract = community_stake(
this.address,
this.web3,
@@ -27,9 +27,8 @@ export class CommunityStake extends SdkBase {
accountIndex?: number,
): Promise<{ block: number }> {
const account = (await this.getAccounts())[accountIndex ?? 0];
- const namespaceAddress = await this.namespaceFactory.getNamespaceAddress(
- name,
- );
+ const namespaceAddress =
+ await this.namespaceFactory.getNamespaceAddress(name);
const totalPrice: string = await this.contract.methods
.getBuyPriceAfterFee(namespaceAddress, id.toString(), amount.toString())
.call();
@@ -56,9 +55,8 @@ export class CommunityStake extends SdkBase {
accountIndex?: number,
): Promise<{ block: number }> {
const account = (await this.getAccounts())[accountIndex ?? 0];
- const namespaceAddress = await this.namespaceFactory.getNamespaceAddress(
- name,
- );
+ const namespaceAddress =
+ await this.namespaceFactory.getNamespaceAddress(name);
const txReceipt = await this.contract.methods
.sellStake(namespaceAddress, id.toString(), amount.toString())
.send({
diff --git a/libs/evm-testing/src/sdk/namespaceFactory.ts b/libs/evm-testing/src/sdk/namespaceFactory.ts
index 720f29b2581..22d41c9d0cc 100644
--- a/libs/evm-testing/src/sdk/namespaceFactory.ts
+++ b/libs/evm-testing/src/sdk/namespaceFactory.ts
@@ -1,4 +1,4 @@
-import { factoryContracts } from 'shared/src/commonProtocol';
+import { commonProtocol as cp } from '@hicommonwealth/evm-protocols';
import { AbiFragment, Contract } from 'web3';
import { namespace_factory } from '../utils/contracts';
import { SdkBase } from './sdkBase';
@@ -7,7 +7,7 @@ const TOPIC_LOG =
'0x990f533044dbc89b838acde9cd2c72c400999871cf8f792d731edcae15ead693';
export class NamespaceFactory extends SdkBase {
- public address: string = factoryContracts[84532].factory;
+ public address: string = cp.factoryContracts[84532].factory;
public contract: Contract = namespace_factory(
this.address,
this.web3,
diff --git a/libs/model/src/chain-events/ChainEventCreated.command.ts b/libs/model/src/chain-events/ChainEventCreated.command.ts
index 304f6567815..4c6c941813d 100644
--- a/libs/model/src/chain-events/ChainEventCreated.command.ts
+++ b/libs/model/src/chain-events/ChainEventCreated.command.ts
@@ -2,6 +2,7 @@ import { parseEvmEvent, type Command } from '@hicommonwealth/core';
import {
EvmEventSignature,
EvmEventSignatures,
+ commonProtocol as cp,
} from '@hicommonwealth/evm-protocols';
import {
config,
@@ -10,7 +11,6 @@ import {
models,
} from '@hicommonwealth/model';
import * as schemas from '@hicommonwealth/schemas';
-import { commonProtocol as cp } from '@hicommonwealth/shared';
import { Hmac, createHmac } from 'crypto';
// TODO: how do we handle chain re-orgs
diff --git a/libs/model/src/community/CreateStakeTransaction.command.ts b/libs/model/src/community/CreateStakeTransaction.command.ts
index 372e0b17ad5..a39068d24fc 100644
--- a/libs/model/src/community/CreateStakeTransaction.command.ts
+++ b/libs/model/src/community/CreateStakeTransaction.command.ts
@@ -1,6 +1,6 @@
import type { Command } from '@hicommonwealth/core';
+import { commonProtocol } from '@hicommonwealth/evm-protocols';
import * as schemas from '@hicommonwealth/schemas';
-import { commonProtocol } from '@hicommonwealth/shared';
import Web3 from 'web3';
import { models } from '../database';
import { mustExist } from '../middleware/guards';
diff --git a/libs/model/src/services/commonProtocol/communityStakeConfigValidator.ts b/libs/model/src/services/commonProtocol/communityStakeConfigValidator.ts
index 981a8d25869..0af7efb367d 100644
--- a/libs/model/src/services/commonProtocol/communityStakeConfigValidator.ts
+++ b/libs/model/src/services/commonProtocol/communityStakeConfigValidator.ts
@@ -1,6 +1,6 @@
import { AppError, ServerError } from '@hicommonwealth/core';
+import { commonProtocol } from '@hicommonwealth/evm-protocols';
import { models } from '@hicommonwealth/model';
-import { commonProtocol } from '@hicommonwealth/shared';
import Web3, { AbiFunctionFragment } from 'web3';
import { CommunityAttributes } from '../../models/community';
diff --git a/libs/model/src/services/commonProtocol/contestHelper.ts b/libs/model/src/services/commonProtocol/contestHelper.ts
index ff79e8ce263..0c3227a3d2a 100644
--- a/libs/model/src/services/commonProtocol/contestHelper.ts
+++ b/libs/model/src/services/commonProtocol/contestHelper.ts
@@ -1,6 +1,9 @@
import { AppError } from '@hicommonwealth/core';
-import { contestAbi, feeManagerAbi } from '@hicommonwealth/evm-protocols';
-import { commonProtocol } from '@hicommonwealth/shared';
+import {
+ commonProtocol,
+ contestAbi,
+ feeManagerAbi,
+} from '@hicommonwealth/evm-protocols';
import { Mutex } from 'async-mutex';
import Web3, { PayableCallOptions } from 'web3';
import { AbiItem } from 'web3-utils';
diff --git a/libs/model/src/services/commonProtocol/contractHelpers.ts b/libs/model/src/services/commonProtocol/contractHelpers.ts
index eab8ee68a74..f3dfeed75ae 100644
--- a/libs/model/src/services/commonProtocol/contractHelpers.ts
+++ b/libs/model/src/services/commonProtocol/contractHelpers.ts
@@ -1,10 +1,6 @@
import { AppError } from '@hicommonwealth/core';
-import { contestAbi } from '@hicommonwealth/evm-protocols';
-import {
- BalanceSourceType,
- ZERO_ADDRESS,
- commonProtocol,
-} from '@hicommonwealth/shared';
+import { commonProtocol, contestAbi } from '@hicommonwealth/evm-protocols';
+import { BalanceSourceType, ZERO_ADDRESS } from '@hicommonwealth/shared';
import Web3 from 'web3';
import { AbiItem } from 'web3-utils';
diff --git a/libs/model/src/services/commonProtocol/launchpadHelpers.ts b/libs/model/src/services/commonProtocol/launchpadHelpers.ts
index ccb00153141..f613b46551f 100644
--- a/libs/model/src/services/commonProtocol/launchpadHelpers.ts
+++ b/libs/model/src/services/commonProtocol/launchpadHelpers.ts
@@ -1,12 +1,12 @@
import { logger } from '@hicommonwealth/core';
import {
+ commonProtocol,
deployedNamespaceEventSignature,
erc20Abi,
launchpadTokenRegisteredEventSignature,
launchpadTradeEventSignature,
lpBondingCurveAbi,
} from '@hicommonwealth/evm-protocols';
-import { commonProtocol } from '@hicommonwealth/shared';
import { Web3 } from 'web3';
import { createWeb3Provider } from './utils';
diff --git a/libs/model/src/services/commonProtocol/newNamespaceValidator.ts b/libs/model/src/services/commonProtocol/newNamespaceValidator.ts
index aea35ca02f7..fa44a80e287 100644
--- a/libs/model/src/services/commonProtocol/newNamespaceValidator.ts
+++ b/libs/model/src/services/commonProtocol/newNamespaceValidator.ts
@@ -1,7 +1,10 @@
import { AppError, ServerError } from '@hicommonwealth/core';
-import { communityNamespaceCreatedEventSignature } from '@hicommonwealth/evm-protocols';
+import {
+ commonProtocol,
+ communityNamespaceCreatedEventSignature,
+} from '@hicommonwealth/evm-protocols';
import { models } from '@hicommonwealth/model';
-import { BalanceSourceType, commonProtocol } from '@hicommonwealth/shared';
+import { BalanceSourceType } from '@hicommonwealth/shared';
import Web3 from 'web3';
import { CommunityAttributes } from '../../models';
import { equalEvmAddresses } from '../../utils';
diff --git a/libs/model/src/services/stakeHelper.ts b/libs/model/src/services/stakeHelper.ts
index 4cb34769115..6e2dceb93b3 100644
--- a/libs/model/src/services/stakeHelper.ts
+++ b/libs/model/src/services/stakeHelper.ts
@@ -1,6 +1,7 @@
import { InvalidState } from '@hicommonwealth/core';
+import { commonProtocol } from '@hicommonwealth/evm-protocols';
import { TopicWeightedVoting } from '@hicommonwealth/schemas';
-import { BalanceSourceType, commonProtocol } from '@hicommonwealth/shared';
+import { BalanceSourceType } from '@hicommonwealth/shared';
import { BigNumber } from 'ethers';
import { tokenBalanceCache } from '.';
import { config } from '../config';
diff --git a/libs/model/src/services/tokenBalanceCache/types.ts b/libs/model/src/services/tokenBalanceCache/types.ts
index 19911ef5a13..8ca26174495 100644
--- a/libs/model/src/services/tokenBalanceCache/types.ts
+++ b/libs/model/src/services/tokenBalanceCache/types.ts
@@ -1,4 +1,5 @@
-import { BalanceSourceType, commonProtocol } from '@hicommonwealth/shared';
+import { commonProtocol } from '@hicommonwealth/evm-protocols';
+import { BalanceSourceType } from '@hicommonwealth/shared';
import { ChainNodeInstance } from '../../models/chain_node';
export type Balances = { [address: string]: string };
diff --git a/libs/model/src/token/CreateLaunchpadTrade.command.ts b/libs/model/src/token/CreateLaunchpadTrade.command.ts
index 2f752e61348..0a7b5d01730 100644
--- a/libs/model/src/token/CreateLaunchpadTrade.command.ts
+++ b/libs/model/src/token/CreateLaunchpadTrade.command.ts
@@ -1,6 +1,6 @@
import { Command, InvalidState } from '@hicommonwealth/core';
+import { commonProtocol } from '@hicommonwealth/evm-protocols';
import * as schemas from '@hicommonwealth/schemas';
-import { commonProtocol } from '@hicommonwealth/shared';
import z from 'zod';
import { models } from '../database';
import { mustExist } from '../middleware/guards';
diff --git a/libs/model/src/token/CreateToken.command.ts b/libs/model/src/token/CreateToken.command.ts
index c634ed98b69..deb9a4f5f07 100644
--- a/libs/model/src/token/CreateToken.command.ts
+++ b/libs/model/src/token/CreateToken.command.ts
@@ -1,7 +1,7 @@
import { InvalidState, type Command } from '@hicommonwealth/core';
+import { commonProtocol } from '@hicommonwealth/evm-protocols';
import * as schemas from '@hicommonwealth/schemas';
import { TokenView } from '@hicommonwealth/schemas';
-import { commonProtocol } from '@hicommonwealth/shared';
import z from 'zod';
import { models } from '../database';
import { authRoles } from '../middleware';
diff --git a/libs/model/test/community/stake-transaction.spec.ts b/libs/model/test/community/stake-transaction.spec.ts
index febedaf4544..b3fcd7d09aa 100644
--- a/libs/model/test/community/stake-transaction.spec.ts
+++ b/libs/model/test/community/stake-transaction.spec.ts
@@ -1,5 +1,6 @@
import { Actor, command, dispose, query } from '@hicommonwealth/core';
-import { BalanceType, commonProtocol } from '@hicommonwealth/shared';
+import { commonProtocol } from '@hicommonwealth/evm-protocols';
+import { BalanceType } from '@hicommonwealth/shared';
import chai, { expect } from 'chai';
import chaiAsPromised from 'chai-as-promised';
import { seed } from 'model/src/tester';
diff --git a/libs/model/test/contest/contests-projection-lifecycle.spec.ts b/libs/model/test/contest/contests-projection-lifecycle.spec.ts
index 974e04f45b2..bfda70b9851 100644
--- a/libs/model/test/contest/contests-projection-lifecycle.spec.ts
+++ b/libs/model/test/contest/contests-projection-lifecycle.spec.ts
@@ -7,9 +7,10 @@ import {
handleEvent,
query,
} from '@hicommonwealth/core';
+import { commonProtocol } from '@hicommonwealth/evm-protocols';
import { models } from '@hicommonwealth/model';
import { ContestResults } from '@hicommonwealth/schemas';
-import { AbiType, commonProtocol, delay } from '@hicommonwealth/shared';
+import { AbiType, delay } from '@hicommonwealth/shared';
import chai, { expect } from 'chai';
import chaiAsPromised from 'chai-as-promised';
import Sinon from 'sinon';
diff --git a/libs/model/test/launchpad/launchpad.spec.ts b/libs/model/test/launchpad/launchpad.spec.ts
index 46f944a9ae7..fe73ed16262 100644
--- a/libs/model/test/launchpad/launchpad.spec.ts
+++ b/libs/model/test/launchpad/launchpad.spec.ts
@@ -1,6 +1,7 @@
import { Actor, command, dispose } from '@hicommonwealth/core';
+import { commonProtocol } from '@hicommonwealth/evm-protocols';
import { config, equalEvmAddresses } from '@hicommonwealth/model';
-import { BalanceType, commonProtocol } from '@hicommonwealth/shared';
+import { BalanceType } from '@hicommonwealth/shared';
import chai, { expect } from 'chai';
import chaiAsPromised from 'chai-as-promised';
import { seed } from 'model/src/tester';
diff --git a/libs/schemas/package.json b/libs/schemas/package.json
index 63351ab173c..fbb5721cd43 100644
--- a/libs/schemas/package.json
+++ b/libs/schemas/package.json
@@ -23,6 +23,7 @@
},
"dependencies": {
"@hicommonwealth/shared": "workspace:*",
+ "@hicommonwealth/evm-protocols": "workspace:*",
"moment": "^2.23.0",
"zod": "^3.22.4"
},
diff --git a/libs/schemas/src/commands/contest.schemas.ts b/libs/schemas/src/commands/contest.schemas.ts
index 2f25a9b7596..6e26fcef5d6 100644
--- a/libs/schemas/src/commands/contest.schemas.ts
+++ b/libs/schemas/src/commands/contest.schemas.ts
@@ -1,4 +1,4 @@
-import { commonProtocol } from '@hicommonwealth/shared';
+import { commonProtocol } from '@hicommonwealth/evm-protocols';
import z from 'zod';
import { AuthContext } from '../context';
import { ContestManager } from '../entities';
diff --git a/libs/schemas/src/entities/contest-manager.schemas.ts b/libs/schemas/src/entities/contest-manager.schemas.ts
index 3a657c4e47f..ca697ddf956 100644
--- a/libs/schemas/src/entities/contest-manager.schemas.ts
+++ b/libs/schemas/src/entities/contest-manager.schemas.ts
@@ -1,4 +1,5 @@
-import { MAX_SCHEMA_INT, commonProtocol } from '@hicommonwealth/shared';
+import { commonProtocol } from '@hicommonwealth/evm-protocols';
+import { MAX_SCHEMA_INT } from '@hicommonwealth/shared';
import { z } from 'zod';
import { Contest } from '../projections';
import { PG_INT } from '../utils';
diff --git a/libs/schemas/src/entities/topic.schemas.ts b/libs/schemas/src/entities/topic.schemas.ts
index 901b094556a..d76eae56fd7 100644
--- a/libs/schemas/src/entities/topic.schemas.ts
+++ b/libs/schemas/src/entities/topic.schemas.ts
@@ -1,4 +1,5 @@
-import { MAX_SCHEMA_INT, commonProtocol } from '@hicommonwealth/shared';
+import { commonProtocol } from '@hicommonwealth/evm-protocols';
+import { MAX_SCHEMA_INT } from '@hicommonwealth/shared';
import { z } from 'zod';
import { Contest } from '../projections';
import { PG_INT } from '../utils';
diff --git a/libs/schemas/tsconfig.build.json b/libs/schemas/tsconfig.build.json
index 5e3d942f39d..3335fc4999f 100644
--- a/libs/schemas/tsconfig.build.json
+++ b/libs/schemas/tsconfig.build.json
@@ -5,5 +5,8 @@
"outDir": "build"
},
"include": ["src"],
- "references": [{ "path": "../shared/tsconfig.build.json" }]
+ "references": [
+ { "path": "../shared/tsconfig.build.json" },
+ { "path": "../evm-protocols/tsconfig.build.json" }
+ ]
}
diff --git a/libs/schemas/tsconfig.json b/libs/schemas/tsconfig.json
index 002c12c4ae4..a234793401d 100644
--- a/libs/schemas/tsconfig.json
+++ b/libs/schemas/tsconfig.json
@@ -1,4 +1,7 @@
{
"extends": "../tsconfig.json",
- "references": [{ "path": "../shared/tsconfig.build.json" }]
+ "references": [
+ { "path": "../shared/tsconfig.build.json" },
+ { "path": "../evm-protocols/tsconfig.build.json" }
+ ]
}
diff --git a/libs/shared/src/index.ts b/libs/shared/src/index.ts
index a259f3dc735..790ef52464f 100644
--- a/libs/shared/src/index.ts
+++ b/libs/shared/src/index.ts
@@ -1,5 +1,4 @@
export * from './canvas';
-export * as commonProtocol from './commonProtocol';
export * from './constants';
export * from './errors';
export * from './regex';
diff --git a/packages/commonwealth/client/scripts/helpers/ContractHelpers/Contest.ts b/packages/commonwealth/client/scripts/helpers/ContractHelpers/Contest.ts
index 6caf0bfceb1..f2e8e179a86 100644
--- a/packages/commonwealth/client/scripts/helpers/ContractHelpers/Contest.ts
+++ b/packages/commonwealth/client/scripts/helpers/ContractHelpers/Contest.ts
@@ -1,9 +1,10 @@
import {
+ commonProtocol,
contestAbi,
erc20Abi,
feeManagerAbi,
} from '@hicommonwealth/evm-protocols';
-import { ZERO_ADDRESS, commonProtocol } from '@hicommonwealth/shared';
+import { ZERO_ADDRESS } from '@hicommonwealth/shared';
import { AbiItem, TransactionReceipt } from 'web3';
import ContractBase from './ContractBase';
import NamespaceFactory from './NamespaceFactory';
diff --git a/packages/commonwealth/client/scripts/helpers/ContractHelpers/Launchpad.ts b/packages/commonwealth/client/scripts/helpers/ContractHelpers/Launchpad.ts
index 5e2c8fd3ac0..c3b78ff0ffb 100644
--- a/packages/commonwealth/client/scripts/helpers/ContractHelpers/Launchpad.ts
+++ b/packages/commonwealth/client/scripts/helpers/ContractHelpers/Launchpad.ts
@@ -1,17 +1,11 @@
import {
+ commonProtocol as cp,
erc20Abi,
launchpadFactoryAbi,
lpBondingCurveAbi,
} from '@hicommonwealth/evm-protocols';
import { Contract } from 'web3';
import { AbiItem } from 'web3-utils';
-import {
- buyToken,
- getPrice,
- launchToken,
- sellToken,
- transferLiquidity,
-} from '../../../../../../libs/shared/src/commonProtocol';
import ContractBase from './ContractBase';
class LaunchpadBondingCurve extends ContractBase {
@@ -55,7 +49,7 @@ class LaunchpadBondingCurve extends ContractBase {
await this.initialize(true, chainId);
}
- const txReceipt = await launchToken(
+ const txReceipt = await cp.launchToken(
this.launchpadFactory,
name,
symbol,
@@ -75,7 +69,7 @@ class LaunchpadBondingCurve extends ContractBase {
await this.initialize(true, chainId);
}
- const txReceipt = await buyToken(
+ const txReceipt = await cp.buyToken(
this.contract,
this.tokenAddress,
walletAddress,
@@ -92,7 +86,7 @@ class LaunchpadBondingCurve extends ContractBase {
erc20Abi as unknown as AbiItem[],
this.tokenAddress,
);
- const txReceipt = await sellToken(
+ const txReceipt = await cp.sellToken(
this.contract,
this.tokenAddress,
amountSell,
@@ -107,7 +101,7 @@ class LaunchpadBondingCurve extends ContractBase {
await this.initialize(true);
}
- const txReceipt = await transferLiquidity(
+ const txReceipt = await cp.transferLiquidity(
this.contract,
this.tokenAddress,
walletAddress,
@@ -120,7 +114,7 @@ class LaunchpadBondingCurve extends ContractBase {
await this.initialize(true, chainId);
}
- const amountOut = await getPrice(
+ const amountOut = await cp.getPrice(
this.contract,
this.tokenAddress,
amountIn,
diff --git a/packages/commonwealth/client/scripts/state/api/communityStake/buyStake.ts b/packages/commonwealth/client/scripts/state/api/communityStake/buyStake.ts
index 5ad12e638e4..f9bad2aca01 100644
--- a/packages/commonwealth/client/scripts/state/api/communityStake/buyStake.ts
+++ b/packages/commonwealth/client/scripts/state/api/communityStake/buyStake.ts
@@ -1,4 +1,4 @@
-import { commonProtocol } from '@hicommonwealth/shared';
+import { commonProtocol } from '@hicommonwealth/evm-protocols';
import { useMutation } from '@tanstack/react-query';
import { ContractMethods, queryClient } from 'state/api/config';
import { setActiveAccountOnTransactionSuccess } from 'views/modals/ManageCommunityStakeModal/utils';
diff --git a/packages/commonwealth/client/scripts/state/api/communityStake/getBuyPrice.ts b/packages/commonwealth/client/scripts/state/api/communityStake/getBuyPrice.ts
index 1abeb8b250b..5063c45bc4d 100644
--- a/packages/commonwealth/client/scripts/state/api/communityStake/getBuyPrice.ts
+++ b/packages/commonwealth/client/scripts/state/api/communityStake/getBuyPrice.ts
@@ -1,4 +1,4 @@
-import { commonProtocol } from '@hicommonwealth/shared';
+import { commonProtocol } from '@hicommonwealth/evm-protocols';
import { useQuery } from '@tanstack/react-query';
import { ContractMethods } from 'state/api/config';
import { lazyLoadCommunityStakes } from '../../../helpers/ContractHelpers/LazyCommunityStakes';
diff --git a/packages/commonwealth/client/scripts/state/api/communityStake/getSellPrice.ts b/packages/commonwealth/client/scripts/state/api/communityStake/getSellPrice.ts
index 7af11e27781..6e8be29752f 100644
--- a/packages/commonwealth/client/scripts/state/api/communityStake/getSellPrice.ts
+++ b/packages/commonwealth/client/scripts/state/api/communityStake/getSellPrice.ts
@@ -1,4 +1,4 @@
-import { commonProtocol } from '@hicommonwealth/shared';
+import { commonProtocol } from '@hicommonwealth/evm-protocols';
import { useQuery } from '@tanstack/react-query';
import { ContractMethods } from 'state/api/config';
import { lazyLoadCommunityStakes } from '../../../helpers/ContractHelpers/LazyCommunityStakes';
diff --git a/packages/commonwealth/client/scripts/state/api/communityStake/getUserEthBalance.ts b/packages/commonwealth/client/scripts/state/api/communityStake/getUserEthBalance.ts
index 062d70d2b48..2c001823e75 100644
--- a/packages/commonwealth/client/scripts/state/api/communityStake/getUserEthBalance.ts
+++ b/packages/commonwealth/client/scripts/state/api/communityStake/getUserEthBalance.ts
@@ -1,4 +1,4 @@
-import { commonProtocol } from '@hicommonwealth/shared';
+import { commonProtocol } from '@hicommonwealth/evm-protocols';
import { useQuery } from '@tanstack/react-query';
import { ContractMethods } from 'state/api/config';
import { lazyLoadCommunityStakes } from '../../../helpers/ContractHelpers/LazyCommunityStakes';
diff --git a/packages/commonwealth/client/scripts/state/api/communityStake/getUserStakeBalance.ts b/packages/commonwealth/client/scripts/state/api/communityStake/getUserStakeBalance.ts
index f594ec203fd..7e60e1decb5 100644
--- a/packages/commonwealth/client/scripts/state/api/communityStake/getUserStakeBalance.ts
+++ b/packages/commonwealth/client/scripts/state/api/communityStake/getUserStakeBalance.ts
@@ -1,4 +1,4 @@
-import { commonProtocol } from '@hicommonwealth/shared';
+import { commonProtocol } from '@hicommonwealth/evm-protocols';
import { useQuery } from '@tanstack/react-query';
import { ContractMethods } from 'state/api/config';
import { lazyLoadCommunityStakes } from '../../../helpers/ContractHelpers/LazyCommunityStakes';
diff --git a/packages/commonwealth/client/scripts/state/api/communityStake/sellStake.ts b/packages/commonwealth/client/scripts/state/api/communityStake/sellStake.ts
index 251d1748f69..f92742b1e43 100644
--- a/packages/commonwealth/client/scripts/state/api/communityStake/sellStake.ts
+++ b/packages/commonwealth/client/scripts/state/api/communityStake/sellStake.ts
@@ -1,4 +1,4 @@
-import { commonProtocol } from '@hicommonwealth/shared';
+import { commonProtocol } from '@hicommonwealth/evm-protocols';
import { useMutation } from '@tanstack/react-query';
import { ContractMethods, queryClient } from 'state/api/config';
import { setActiveAccountOnTransactionSuccess } from 'views/modals/ManageCommunityStakeModal/utils';
diff --git a/packages/commonwealth/client/scripts/state/api/contests/deployRecurringContestOnchain.ts b/packages/commonwealth/client/scripts/state/api/contests/deployRecurringContestOnchain.ts
index 28e8761595e..fe7963acfb3 100644
--- a/packages/commonwealth/client/scripts/state/api/contests/deployRecurringContestOnchain.ts
+++ b/packages/commonwealth/client/scripts/state/api/contests/deployRecurringContestOnchain.ts
@@ -1,6 +1,6 @@
import { useMutation } from '@tanstack/react-query';
-import { commonProtocol } from '@hicommonwealth/shared';
+import { commonProtocol } from '@hicommonwealth/evm-protocols';
import Contest from 'helpers/ContractHelpers/Contest';
interface DeployRecurringContestOnchainProps {
diff --git a/packages/commonwealth/client/scripts/state/api/contests/deploySingleERC20ContestOnchain.ts b/packages/commonwealth/client/scripts/state/api/contests/deploySingleERC20ContestOnchain.ts
index aecc3eba5e6..54a112e2716 100644
--- a/packages/commonwealth/client/scripts/state/api/contests/deploySingleERC20ContestOnchain.ts
+++ b/packages/commonwealth/client/scripts/state/api/contests/deploySingleERC20ContestOnchain.ts
@@ -1,6 +1,6 @@
import { useMutation } from '@tanstack/react-query';
-import { commonProtocol } from '@hicommonwealth/shared';
+import { commonProtocol } from '@hicommonwealth/evm-protocols';
import Contest from 'helpers/ContractHelpers/Contest';
export interface DeploySingleERC20ContestOnchainProps {
diff --git a/packages/commonwealth/client/scripts/state/api/contests/fundContestOnchain.ts b/packages/commonwealth/client/scripts/state/api/contests/fundContestOnchain.ts
index 7c9307f202e..1d931ebab1f 100644
--- a/packages/commonwealth/client/scripts/state/api/contests/fundContestOnchain.ts
+++ b/packages/commonwealth/client/scripts/state/api/contests/fundContestOnchain.ts
@@ -1,6 +1,6 @@
import { useMutation } from '@tanstack/react-query';
-import { commonProtocol } from '@hicommonwealth/shared';
+import { commonProtocol } from '@hicommonwealth/evm-protocols';
import Contest from 'helpers/ContractHelpers/Contest';
import { ContractMethods, queryClient } from 'state/api/config';
diff --git a/packages/commonwealth/client/scripts/state/api/contests/getContestBalance.ts b/packages/commonwealth/client/scripts/state/api/contests/getContestBalance.ts
index c58841b719d..ca8b6b110e3 100644
--- a/packages/commonwealth/client/scripts/state/api/contests/getContestBalance.ts
+++ b/packages/commonwealth/client/scripts/state/api/contests/getContestBalance.ts
@@ -1,4 +1,4 @@
-import { commonProtocol } from '@hicommonwealth/shared';
+import { commonProtocol } from '@hicommonwealth/evm-protocols';
import { useQuery } from '@tanstack/react-query';
import Contest from 'helpers/ContractHelpers/Contest';
import { ContractMethods } from 'state/api/config';
diff --git a/packages/commonwealth/client/scripts/state/api/launchPad/buyToken.ts b/packages/commonwealth/client/scripts/state/api/launchPad/buyToken.ts
index 19ce4340f0a..3cd37b2dd8e 100644
--- a/packages/commonwealth/client/scripts/state/api/launchPad/buyToken.ts
+++ b/packages/commonwealth/client/scripts/state/api/launchPad/buyToken.ts
@@ -1,4 +1,4 @@
-import { commonProtocol } from '@hicommonwealth/shared';
+import { commonProtocol } from '@hicommonwealth/evm-protocols';
import { useMutation } from '@tanstack/react-query';
import LaunchpadBondingCurve from 'helpers/ContractHelpers/Launchpad';
diff --git a/packages/commonwealth/client/scripts/state/api/launchPad/launchToken.ts b/packages/commonwealth/client/scripts/state/api/launchPad/launchToken.ts
index b7a603aeb19..8a8bd0223b5 100644
--- a/packages/commonwealth/client/scripts/state/api/launchPad/launchToken.ts
+++ b/packages/commonwealth/client/scripts/state/api/launchPad/launchToken.ts
@@ -1,4 +1,4 @@
-import { commonProtocol } from '@hicommonwealth/shared';
+import { commonProtocol } from '@hicommonwealth/evm-protocols';
import { useMutation } from '@tanstack/react-query';
import LaunchpadBondingCurve from 'helpers/ContractHelpers/Launchpad';
diff --git a/packages/commonwealth/client/scripts/state/api/launchPad/sellToken.ts b/packages/commonwealth/client/scripts/state/api/launchPad/sellToken.ts
index 5868e83d7a3..2e0e9d8a740 100644
--- a/packages/commonwealth/client/scripts/state/api/launchPad/sellToken.ts
+++ b/packages/commonwealth/client/scripts/state/api/launchPad/sellToken.ts
@@ -1,4 +1,4 @@
-import { commonProtocol } from '@hicommonwealth/shared';
+import { commonProtocol } from '@hicommonwealth/evm-protocols';
import { useMutation } from '@tanstack/react-query';
import LaunchpadBondingCurve from 'helpers/ContractHelpers/Launchpad';
diff --git a/packages/commonwealth/client/scripts/state/api/launchPad/tokenEthExchangeRate.ts b/packages/commonwealth/client/scripts/state/api/launchPad/tokenEthExchangeRate.ts
index 38975bb7b39..3576740c989 100644
--- a/packages/commonwealth/client/scripts/state/api/launchPad/tokenEthExchangeRate.ts
+++ b/packages/commonwealth/client/scripts/state/api/launchPad/tokenEthExchangeRate.ts
@@ -1,4 +1,4 @@
-import { commonProtocol } from '@hicommonwealth/shared';
+import { commonProtocol } from '@hicommonwealth/evm-protocols';
import { useQuery } from '@tanstack/react-query';
import LaunchpadBondingCurve from 'helpers/ContractHelpers/Launchpad';
diff --git a/packages/commonwealth/client/scripts/views/components/AdminOnboardingSlider/AdminOnboardingSlider.tsx b/packages/commonwealth/client/scripts/views/components/AdminOnboardingSlider/AdminOnboardingSlider.tsx
index f11539a3c5e..0a202ee2289 100644
--- a/packages/commonwealth/client/scripts/views/components/AdminOnboardingSlider/AdminOnboardingSlider.tsx
+++ b/packages/commonwealth/client/scripts/views/components/AdminOnboardingSlider/AdminOnboardingSlider.tsx
@@ -1,4 +1,5 @@
-import { ChainBase, commonProtocol } from '@hicommonwealth/shared';
+import { commonProtocol } from '@hicommonwealth/evm-protocols';
+import { ChainBase } from '@hicommonwealth/shared';
import shape1Url from 'assets/img/shapes/shape1.svg';
import shape3Url from 'assets/img/shapes/shape3.svg';
import shape4Url from 'assets/img/shapes/shape4.svg';
diff --git a/packages/commonwealth/client/scripts/views/components/CommunityInformationForm/constants.ts b/packages/commonwealth/client/scripts/views/components/CommunityInformationForm/constants.ts
index 52d75eb3d6d..0620037a4a9 100644
--- a/packages/commonwealth/client/scripts/views/components/CommunityInformationForm/constants.ts
+++ b/packages/commonwealth/client/scripts/views/components/CommunityInformationForm/constants.ts
@@ -1,4 +1,4 @@
-import { commonProtocol } from '@hicommonwealth/shared';
+import { commonProtocol } from '@hicommonwealth/evm-protocols';
import NodeInfo from 'models/NodeInfo';
import { fetchCachedNodes } from 'state/api/nodes';
diff --git a/packages/commonwealth/client/scripts/views/components/CommunityStake/useCommunityStake.ts b/packages/commonwealth/client/scripts/views/components/CommunityStake/useCommunityStake.ts
index 5f181f5d00e..2793a39a1e4 100644
--- a/packages/commonwealth/client/scripts/views/components/CommunityStake/useCommunityStake.ts
+++ b/packages/commonwealth/client/scripts/views/components/CommunityStake/useCommunityStake.ts
@@ -1,4 +1,4 @@
-import { commonProtocol } from '@hicommonwealth/shared';
+import { commonProtocol } from '@hicommonwealth/evm-protocols';
import app from 'state';
import {
useFetchCommunityStakeQuery,
diff --git a/packages/commonwealth/client/scripts/views/modals/ManageCommunityStakeModal/StakeExchangeForm/StakeExchangeForm.tsx b/packages/commonwealth/client/scripts/views/modals/ManageCommunityStakeModal/StakeExchangeForm/StakeExchangeForm.tsx
index 49b49b09903..684d0f2ea1f 100644
--- a/packages/commonwealth/client/scripts/views/modals/ManageCommunityStakeModal/StakeExchangeForm/StakeExchangeForm.tsx
+++ b/packages/commonwealth/client/scripts/views/modals/ManageCommunityStakeModal/StakeExchangeForm/StakeExchangeForm.tsx
@@ -1,4 +1,4 @@
-import { commonProtocol } from '@hicommonwealth/shared';
+import { commonProtocol } from '@hicommonwealth/evm-protocols';
import { saveToClipboard } from 'client/scripts/utils/clipboard';
import clsx from 'clsx';
import { findDenominationIcon } from 'helpers/findDenomination';
diff --git a/packages/commonwealth/client/scripts/views/modals/ManageCommunityStakeModal/hooks/useStakeExchange.ts b/packages/commonwealth/client/scripts/views/modals/ManageCommunityStakeModal/hooks/useStakeExchange.ts
index 09aa07faa9c..afbfa70a1aa 100644
--- a/packages/commonwealth/client/scripts/views/modals/ManageCommunityStakeModal/hooks/useStakeExchange.ts
+++ b/packages/commonwealth/client/scripts/views/modals/ManageCommunityStakeModal/hooks/useStakeExchange.ts
@@ -1,4 +1,4 @@
-import { commonProtocol } from '@hicommonwealth/shared';
+import { commonProtocol } from '@hicommonwealth/evm-protocols';
import app from 'state';
import {
useFetchTokenUsdRateQuery,
diff --git a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts
index 54a1e161b5e..f1fe0ee51aa 100644
--- a/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts
+++ b/packages/commonwealth/client/scripts/views/modals/TradeTokenModel/TradeTokenForm/useTradeTokenForm.ts
@@ -1,5 +1,5 @@
+import { commonProtocol } from '@hicommonwealth/evm-protocols';
import { ExtendedCommunity } from '@hicommonwealth/schemas';
-import { commonProtocol } from '@hicommonwealth/shared';
import useRunOnceOnCondition from 'hooks/useRunOnceOnCondition';
import NodeInfo from 'models/NodeInfo';
import { useMemo, useState } from 'react';
diff --git a/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Contests/ManageContest/ManageContest.tsx b/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Contests/ManageContest/ManageContest.tsx
index 14e1369e809..fb5fad345a5 100644
--- a/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Contests/ManageContest/ManageContest.tsx
+++ b/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Contests/ManageContest/ManageContest.tsx
@@ -1,4 +1,4 @@
-import { commonProtocol } from '@hicommonwealth/shared';
+import { commonProtocol } from '@hicommonwealth/evm-protocols';
import React, { useState } from 'react';
import { useSearchParams } from 'react-router-dom';
import app from 'state';
diff --git a/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Contests/ManageContest/steps/SignTransactionsStep/SignTransactionsStep.tsx b/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Contests/ManageContest/steps/SignTransactionsStep/SignTransactionsStep.tsx
index 5c57f3ed3e4..053a9583ba6 100644
--- a/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Contests/ManageContest/steps/SignTransactionsStep/SignTransactionsStep.tsx
+++ b/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Contests/ManageContest/steps/SignTransactionsStep/SignTransactionsStep.tsx
@@ -1,9 +1,9 @@
-import React, { useState } from 'react';
-
-import { commonProtocol, ZERO_ADDRESS } from '@hicommonwealth/shared';
+import { commonProtocol } from '@hicommonwealth/evm-protocols';
+import { ZERO_ADDRESS } from '@hicommonwealth/shared';
import useAppStatus from 'hooks/useAppStatus';
import { useBrowserAnalyticsTrack } from 'hooks/useBrowserAnalyticsTrack';
import { useFlag } from 'hooks/useFlag';
+import React, { useState } from 'react';
import {
BaseMixpanelPayload,
MixpanelContestEvents,
diff --git a/packages/commonwealth/client/scripts/views/pages/CommunityManagement/StakeIntegration/StakeIntegration.tsx b/packages/commonwealth/client/scripts/views/pages/CommunityManagement/StakeIntegration/StakeIntegration.tsx
index 4c87a70be31..4a88bf67534 100644
--- a/packages/commonwealth/client/scripts/views/pages/CommunityManagement/StakeIntegration/StakeIntegration.tsx
+++ b/packages/commonwealth/client/scripts/views/pages/CommunityManagement/StakeIntegration/StakeIntegration.tsx
@@ -1,5 +1,5 @@
+import { commonProtocol } from '@hicommonwealth/evm-protocols';
import { TopicWeightedVoting } from '@hicommonwealth/schemas';
-import { commonProtocol } from '@hicommonwealth/shared';
import clsx from 'clsx';
import { notifyError } from 'controllers/app/notifications';
import AddressInfo from 'models/AddressInfo';
diff --git a/packages/commonwealth/client/scripts/views/pages/CreateCommunity/steps/CommunityStakeStep/SignStakeTransactions/useLaunchCommunityStake.tsx b/packages/commonwealth/client/scripts/views/pages/CreateCommunity/steps/CommunityStakeStep/SignStakeTransactions/useLaunchCommunityStake.tsx
index 87df3ac4ef3..58f21bbc935 100644
--- a/packages/commonwealth/client/scripts/views/pages/CreateCommunity/steps/CommunityStakeStep/SignStakeTransactions/useLaunchCommunityStake.tsx
+++ b/packages/commonwealth/client/scripts/views/pages/CreateCommunity/steps/CommunityStakeStep/SignStakeTransactions/useLaunchCommunityStake.tsx
@@ -1,4 +1,4 @@
-import { commonProtocol } from '@hicommonwealth/shared';
+import { commonProtocol } from '@hicommonwealth/evm-protocols';
import { useBrowserAnalyticsTrack } from 'hooks/useBrowserAnalyticsTrack';
import { useState } from 'react';
import {
diff --git a/packages/commonwealth/client/scripts/views/pages/CreateCommunity/steps/CommunityStakeStep/useNamespaceFactory.ts b/packages/commonwealth/client/scripts/views/pages/CreateCommunity/steps/CommunityStakeStep/useNamespaceFactory.ts
index 735c92e839e..e95173b1aad 100644
--- a/packages/commonwealth/client/scripts/views/pages/CreateCommunity/steps/CommunityStakeStep/useNamespaceFactory.ts
+++ b/packages/commonwealth/client/scripts/views/pages/CreateCommunity/steps/CommunityStakeStep/useNamespaceFactory.ts
@@ -1,4 +1,4 @@
-import { commonProtocol } from '@hicommonwealth/shared';
+import { commonProtocol } from '@hicommonwealth/evm-protocols';
import NamespaceFactory from 'helpers/ContractHelpers/NamespaceFactory';
import { useFetchNodesQuery } from 'state/api/nodes';
diff --git a/packages/commonwealth/client/scripts/views/pages/LaunchToken/steps/CommunityInformationStep/CommunityInformationStep.tsx b/packages/commonwealth/client/scripts/views/pages/LaunchToken/steps/CommunityInformationStep/CommunityInformationStep.tsx
index 4485e71d8e0..113b38380a4 100644
--- a/packages/commonwealth/client/scripts/views/pages/LaunchToken/steps/CommunityInformationStep/CommunityInformationStep.tsx
+++ b/packages/commonwealth/client/scripts/views/pages/LaunchToken/steps/CommunityInformationStep/CommunityInformationStep.tsx
@@ -1,4 +1,5 @@
-import { ChainBase, commonProtocol } from '@hicommonwealth/shared';
+import { commonProtocol } from '@hicommonwealth/evm-protocols';
+import { ChainBase } from '@hicommonwealth/shared';
import { notifyError } from 'controllers/app/notifications';
import useAppStatus from 'hooks/useAppStatus';
import { useBrowserAnalyticsTrack } from 'hooks/useBrowserAnalyticsTrack';
diff --git a/packages/commonwealth/client/scripts/views/pages/LaunchToken/useCreateTokenCommunity.ts b/packages/commonwealth/client/scripts/views/pages/LaunchToken/useCreateTokenCommunity.ts
index 8e716b93e81..3ba6786140e 100644
--- a/packages/commonwealth/client/scripts/views/pages/LaunchToken/useCreateTokenCommunity.ts
+++ b/packages/commonwealth/client/scripts/views/pages/LaunchToken/useCreateTokenCommunity.ts
@@ -1,4 +1,4 @@
-import { commonProtocol } from '@hicommonwealth/shared';
+import { commonProtocol } from '@hicommonwealth/evm-protocols';
import AddressInfo from 'models/AddressInfo';
import NodeInfo from 'models/NodeInfo';
import { useState } from 'react';
diff --git a/packages/commonwealth/server/workers/commonwealthConsumer/policies/chainEventCreated/handleLaunchpadTrade.ts b/packages/commonwealth/server/workers/commonwealthConsumer/policies/chainEventCreated/handleLaunchpadTrade.ts
index 7ef92a75076..310b66a8d3d 100644
--- a/packages/commonwealth/server/workers/commonwealthConsumer/policies/chainEventCreated/handleLaunchpadTrade.ts
+++ b/packages/commonwealth/server/workers/commonwealthConsumer/policies/chainEventCreated/handleLaunchpadTrade.ts
@@ -1,6 +1,6 @@
import { events, LaunchpadTrade } from '@hicommonwealth/core';
+import { commonProtocol as cp } from '@hicommonwealth/evm-protocols';
import { commonProtocol, models } from '@hicommonwealth/model';
-import { commonProtocol as sharedCommonProtocol } from '@hicommonwealth/shared';
import { BigNumber } from 'ethers';
import Web3 from 'web3';
import { z } from 'zod';
@@ -68,9 +68,8 @@ export async function handleLaunchpadTrade(
}
const lpBondingCurveAddress =
- sharedCommonProtocol.factoryContracts[
- chainNode!.eth_chain_id as sharedCommonProtocol.ValidChains
- ].lpBondingCurve!;
+ cp.factoryContracts[chainNode!.eth_chain_id as cp.ValidChains]
+ .lpBondingCurve!;
if (
!token.liquidity_transferred &&
diff --git a/packages/commonwealth/test/devnet/evm/evmChainEvents.spec.ts b/packages/commonwealth/test/devnet/evm/evmChainEvents.spec.ts
index 7d1e30252de..521e04d9e2b 100644
--- a/packages/commonwealth/test/devnet/evm/evmChainEvents.spec.ts
+++ b/packages/commonwealth/test/devnet/evm/evmChainEvents.spec.ts
@@ -1,5 +1,6 @@
import { Log } from '@ethersproject/providers';
import { ChainEventCreated, dispose, EventNames } from '@hicommonwealth/core';
+import { commonProtocol } from '@hicommonwealth/evm-protocols';
import {
CommunityStake,
communityStakesAbi,
@@ -14,12 +15,7 @@ import {
hashAbi,
models,
} from '@hicommonwealth/model';
-import {
- AbiType,
- BalanceType,
- commonProtocol,
- delay,
-} from '@hicommonwealth/shared';
+import { AbiType, BalanceType, delay } from '@hicommonwealth/shared';
import { Anvil } from '@viem/anvil';
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
import { z } from 'zod';
diff --git a/packages/commonwealth/test/integration/evmChainEvents/util.ts b/packages/commonwealth/test/integration/evmChainEvents/util.ts
index ff8f3575616..841972fe190 100644
--- a/packages/commonwealth/test/integration/evmChainEvents/util.ts
+++ b/packages/commonwealth/test/integration/evmChainEvents/util.ts
@@ -1,3 +1,4 @@
+import { commonProtocol } from '@hicommonwealth/evm-protocols';
import {
communityStakesAbi,
localRpc,
@@ -10,7 +11,7 @@ import {
hashAbi,
models,
} from '@hicommonwealth/model';
-import { BalanceType, commonProtocol } from '@hicommonwealth/shared';
+import { BalanceType } from '@hicommonwealth/shared';
const namespaceDeployedSignature =
'0x8870ba2202802ce285ce6bead5ac915b6dc2d35c8a9d6f96fa56de9de12829d5';
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 5614cd2c907..4061f7c88c0 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -519,6 +519,12 @@ importers:
libs/evm-protocols:
dependencies:
+ '@ethersproject/bignumber':
+ specifier: ^5.7.0
+ version: 5.7.0
+ '@hicommonwealth/shared':
+ specifier: workspace:*
+ version: link:../shared
moment:
specifier: ^2.23.0
version: 2.30.1
@@ -713,6 +719,9 @@ importers:
libs/schemas:
dependencies:
+ '@hicommonwealth/evm-protocols':
+ specifier: workspace:*
+ version: link:../evm-protocols
'@hicommonwealth/shared':
specifier: workspace:*
version: link:../shared
@@ -31652,7 +31661,7 @@ snapshots:
iron-webcrypto: 1.1.1
ohash: 1.1.4
radix3: 1.1.2
- ufo: 1.5.3
+ ufo: 1.5.4
uncrypto: 0.1.3
unenv: 1.10.0
transitivePeerDependencies:
@@ -33041,7 +33050,7 @@ snapshots:
node-forge: 1.3.1
pathe: 1.1.2
std-env: 3.7.0
- ufo: 1.5.3
+ ufo: 1.5.4
untun: 0.1.3
uqr: 0.1.2
transitivePeerDependencies:
@@ -34683,7 +34692,7 @@ snapshots:
dependencies:
destr: 2.0.3
node-fetch-native: 1.6.4
- ufo: 1.5.3
+ ufo: 1.5.4
ohash@1.1.4: {}
@@ -38687,7 +38696,7 @@ snapshots:
web3-eth-iban@1.5.2:
dependencies:
- bn.js: 4.12.0
+ bn.js: 4.12.1
web3-utils: 1.5.2
web3-eth-iban@4.0.7:
From f9033c3f3381eb754120a7f15a80ca6ca85366be Mon Sep 17 00:00:00 2001
From: Timothee Legros
Date: Wed, 20 Nov 2024 20:52:47 +0200
Subject: [PATCH 156/227] move `shared/commonProtocol` to `libs/evm-protocols`
---
.../src/{commonProtocol => common-protocol}/chainConfig.ts | 0
.../contractHelpers/Contest.ts | 0
.../contractHelpers/Launchpad.ts | 0
.../src/{commonProtocol => common-protocol}/index.ts | 0
.../src/{commonProtocol => common-protocol}/utils.ts | 0
libs/evm-protocols/src/index.ts | 2 +-
libs/evm-protocols/test/commonProtocol.spec.ts | 2 +-
7 files changed, 2 insertions(+), 2 deletions(-)
rename libs/evm-protocols/src/{commonProtocol => common-protocol}/chainConfig.ts (100%)
rename libs/evm-protocols/src/{commonProtocol => common-protocol}/contractHelpers/Contest.ts (100%)
rename libs/evm-protocols/src/{commonProtocol => common-protocol}/contractHelpers/Launchpad.ts (100%)
rename libs/evm-protocols/src/{commonProtocol => common-protocol}/index.ts (100%)
rename libs/evm-protocols/src/{commonProtocol => common-protocol}/utils.ts (100%)
diff --git a/libs/evm-protocols/src/commonProtocol/chainConfig.ts b/libs/evm-protocols/src/common-protocol/chainConfig.ts
similarity index 100%
rename from libs/evm-protocols/src/commonProtocol/chainConfig.ts
rename to libs/evm-protocols/src/common-protocol/chainConfig.ts
diff --git a/libs/evm-protocols/src/commonProtocol/contractHelpers/Contest.ts b/libs/evm-protocols/src/common-protocol/contractHelpers/Contest.ts
similarity index 100%
rename from libs/evm-protocols/src/commonProtocol/contractHelpers/Contest.ts
rename to libs/evm-protocols/src/common-protocol/contractHelpers/Contest.ts
diff --git a/libs/evm-protocols/src/commonProtocol/contractHelpers/Launchpad.ts b/libs/evm-protocols/src/common-protocol/contractHelpers/Launchpad.ts
similarity index 100%
rename from libs/evm-protocols/src/commonProtocol/contractHelpers/Launchpad.ts
rename to libs/evm-protocols/src/common-protocol/contractHelpers/Launchpad.ts
diff --git a/libs/evm-protocols/src/commonProtocol/index.ts b/libs/evm-protocols/src/common-protocol/index.ts
similarity index 100%
rename from libs/evm-protocols/src/commonProtocol/index.ts
rename to libs/evm-protocols/src/common-protocol/index.ts
diff --git a/libs/evm-protocols/src/commonProtocol/utils.ts b/libs/evm-protocols/src/common-protocol/utils.ts
similarity index 100%
rename from libs/evm-protocols/src/commonProtocol/utils.ts
rename to libs/evm-protocols/src/common-protocol/utils.ts
diff --git a/libs/evm-protocols/src/index.ts b/libs/evm-protocols/src/index.ts
index cf9dc82c0e1..273a70e8acc 100644
--- a/libs/evm-protocols/src/index.ts
+++ b/libs/evm-protocols/src/index.ts
@@ -8,5 +8,5 @@ export * from './abis/namespaceAbi';
export * from './abis/namespaceFactoryAbi';
export * from './abis/reservationHookAbi';
export * from './abis/tokenCommunityManagerAbi';
-export * as commonProtocol from './commonProtocol';
+export * as commonProtocol from './common-protocol';
export * from './event-registry/eventSignatures';
diff --git a/libs/evm-protocols/test/commonProtocol.spec.ts b/libs/evm-protocols/test/commonProtocol.spec.ts
index 4a68f21ce8c..42811427747 100644
--- a/libs/evm-protocols/test/commonProtocol.spec.ts
+++ b/libs/evm-protocols/test/commonProtocol.spec.ts
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest';
-import { calculateVoteWeight } from '../src/commonProtocol';
+import { calculateVoteWeight } from '../src/common-protocol';
describe('commonProtocol', () => {
describe('calculateVoteWeight', () => {
From c3a25f0f7b933dae8957f50389868c418f60fe2e Mon Sep 17 00:00:00 2001
From: Timothee Legros
Date: Wed, 20 Nov 2024 23:43:58 +0200
Subject: [PATCH 157/227] event registry object init
---
libs/evm-protocols/src/event-registry/eventRegistry.ts | 1 +
1 file changed, 1 insertion(+)
create mode 100644 libs/evm-protocols/src/event-registry/eventRegistry.ts
diff --git a/libs/evm-protocols/src/event-registry/eventRegistry.ts b/libs/evm-protocols/src/event-registry/eventRegistry.ts
new file mode 100644
index 00000000000..21e2bdd19db
--- /dev/null
+++ b/libs/evm-protocols/src/event-registry/eventRegistry.ts
@@ -0,0 +1 @@
+export const EventRegistry = {};
From 280d60456c627d3e9931c72071c9e199a3553710 Mon Sep 17 00:00:00 2001
From: israellund
Date: Wed, 20 Nov 2024 17:01:11 -0500
Subject: [PATCH 158/227] committing to change branches
---
.../scripts/views/modals/edit_topic_modal.tsx | 20 +++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/packages/commonwealth/client/scripts/views/modals/edit_topic_modal.tsx b/packages/commonwealth/client/scripts/views/modals/edit_topic_modal.tsx
index 1d26bb172f5..3e825f0f10c 100644
--- a/packages/commonwealth/client/scripts/views/modals/edit_topic_modal.tsx
+++ b/packages/commonwealth/client/scripts/views/modals/edit_topic_modal.tsx
@@ -55,6 +55,25 @@ export const EditTopicModal = ({
featuredInSidebarProp,
);
const [name, setName] = useState(nameProp);
+ // const [characterCount, setCharacterCount] = useState(0);
+ console.log('this is description', description);
+ // const getCharacterCount = (delta) => {
+ // if (!delta || !delta.ops) {
+ // return 0;
+ // }
+ // return delta.ops.reduce((count, op) => {
+ // if (typeof op.insert === 'string') {
+ // const cleanedText = op.insert.replace(/\n$/, '');
+ // return count + cleanedText.length;
+ // }
+ // return count;
+ // }, 0);
+ // };
+
+ // useEffect(() => {
+ // const count = getCharacterCount(description);
+ // setCharacterCount(count);
+ // }, [description]);
const handleSaveChanges = async () => {
setIsSaving(true);
@@ -175,6 +194,7 @@ export const EditTopicModal = ({
})}
isDisabled={!!topic.archived_at}
/>
+ Character count: /250
Date: Wed, 20 Nov 2024 17:22:22 -0500
Subject: [PATCH 159/227] first pass
---
libs/model/src/config.ts | 5 +++-
libs/model/src/models/contract_abi.ts | 15 ++--------
libs/model/src/models/evmEventSource.ts | 5 ++--
libs/model/src/tester/bootstrap.ts | 29 ++++++++-----------
libs/model/src/tester/seed.ts | 2 +-
libs/model/src/tester/seedDb.ts | 4 +--
.../contests-projection-lifecycle.spec.ts | 19 +++++-------
.../test/email/digest-email-lifecycle.spec.ts | 2 +-
.../test/reaction/reaction-lifecycle.spec.ts | 2 +-
libs/model/test/seed/model.spec.ts | 2 +-
libs/model/test/seed/seed.spec.ts | 8 ++---
.../comment-subscription-lifecycle.spec.ts | 3 +-
.../community-alerts-lifecycle.spec.ts | 2 +-
...subscription-preferences-lifecycle.spec.ts | 1 +
.../thread-subscription-lifecycle.spec.ts | 3 +-
.../test/util-tests/getCommentDepth.spec.ts | 2 +-
libs/schemas/src/entities/contract.schemas.ts | 11 +++++++
libs/schemas/src/index.ts | 1 +
.../commonwealth/scripts/bootstrapTestDb.ts | 22 ++------------
packages/commonwealth/server-test.ts | 6 ++--
.../devnet/cosmos/proposalTxEthermint.spec.ts | 4 +--
.../test/devnet/cosmos/proposalTxV1.spec.ts | 2 +-
.../devnet/cosmos/proposalTxV1beta1.spec.ts | 4 +--
.../cosmos/tokenBalanceFetching.spec.ts | 2 +-
.../test/devnet/evm/evmChainEvents.spec.ts | 2 ++
.../devnet/evm/tokenBalanceFetching.spec.ts | 2 +-
.../commonwealth/test/e2e/utils/e2eUtils.ts | 2 +-
.../test/integration/api/chainNodes.spec.ts | 2 +-
.../integration/api/communityStake.spec.ts | 2 +-
.../test/integration/api/cosmosCache.spec.ts | 2 +-
.../integration/api/createComment.spec.ts | 2 +-
.../integration/api/createReactions.spec.ts | 2 +-
.../integration/api/getAddressProfile.spec.ts | 2 +-
.../api/getRelatedCommunities.spec.ts | 2 +-
.../test/integration/api/getRoles.spec.ts | 2 +-
.../test/integration/api/index.spec.ts | 2 +-
.../test/integration/api/linking.spec.ts | 2 +-
.../test/integration/api/polls.spec.ts | 2 +-
.../integration/api/thread.update.spec.ts | 2 +-
.../integration/api/threads-query.spec.ts | 2 +-
.../integration/api/updatecommunity.spec.ts | 2 +-
.../integration/api/upgradeMember.spec.ts | 2 +-
.../test/integration/api/user.spec.ts | 2 +-
.../integration/api/userDashboard.spec.ts | 2 +-
.../api/validationMiddleware.spec.ts | 2 +-
.../integration/api/verifyAddress.spec.ts | 2 +-
.../test/integration/databaseCleaner.spec.ts | 2 +-
.../evmChainEvents/getEventSources.spec.ts | 2 +-
.../scheduleNodeProcessing.spec.ts | 2 +-
.../test/integration/evmChainEvents/util.ts | 2 ++
.../messageRelayer/messageRelayer.spec.ts | 2 +-
.../messageRelayer/pgListener.spec.ts | 2 +-
.../integration/messageRelayer/relay.spec.ts | 2 +-
vite.config.ts | 23 ++++++++++-----
54 files changed, 113 insertions(+), 124 deletions(-)
diff --git a/libs/model/src/config.ts b/libs/model/src/config.ts
index e54f5253a4f..0611462913d 100644
--- a/libs/model/src/config.ts
+++ b/libs/model/src/config.ts
@@ -41,7 +41,10 @@ const {
OPENAI_ORGANIZATION,
} = process.env;
-const NAME = target.NODE_ENV === 'test' ? 'common_test' : 'commonwealth';
+const NAME =
+ target.NODE_ENV === 'test'
+ ? `common_test_${process.env.VITEST_POOL_ID ?? ''}`
+ : 'commonwealth';
const DEFAULTS = {
JWT_SECRET: 'my secret',
diff --git a/libs/model/src/models/contract_abi.ts b/libs/model/src/models/contract_abi.ts
index 1058c7bd6b4..cac1d346606 100644
--- a/libs/model/src/models/contract_abi.ts
+++ b/libs/model/src/models/contract_abi.ts
@@ -1,19 +1,10 @@
-import type { AbiType } from '@hicommonwealth/shared';
+import { ContractAbi } from '@hicommonwealth/schemas';
import Sequelize from 'sequelize'; // must use "* as" to avoid scope errors
+import { z } from 'zod';
import { hashAbi } from '../utils/utils';
import type { ModelInstance } from './types';
-export type ContractAbiAttributes = {
- id?: number;
- nickname?: string;
- abi: AbiType;
- abi_hash?: string;
- verified?: boolean;
- created_at?: Date;
- updated_at?: Date;
-};
-
-export type ContractAbiInstance = ModelInstance;
+export type ContractAbiInstance = ModelInstance>;
export default (
sequelize: Sequelize.Sequelize,
diff --git a/libs/model/src/models/evmEventSource.ts b/libs/model/src/models/evmEventSource.ts
index 0b693aa2d44..8a5d7c252ba 100644
--- a/libs/model/src/models/evmEventSource.ts
+++ b/libs/model/src/models/evmEventSource.ts
@@ -1,6 +1,7 @@
+import { ContractAbi } from '@hicommonwealth/schemas';
import Sequelize from 'sequelize';
+import { z } from 'zod';
import { ChainNodeAttributes } from './chain_node';
-import { ContractAbiAttributes } from './contract_abi';
import { ModelInstance } from './types';
export type EvmEventSourceAttributes = {
@@ -14,7 +15,7 @@ export type EvmEventSourceAttributes = {
active?: boolean;
abi_id: number;
- ContractAbi?: ContractAbiAttributes;
+ ContractAbi?: z.infer;
ChainNode?: ChainNodeAttributes;
};
diff --git a/libs/model/src/tester/bootstrap.ts b/libs/model/src/tester/bootstrap.ts
index ba287812681..1015b463e9a 100644
--- a/libs/model/src/tester/bootstrap.ts
+++ b/libs/model/src/tester/bootstrap.ts
@@ -1,4 +1,3 @@
-import { dispose } from '@hicommonwealth/core';
import path from 'path';
import { QueryTypes, Sequelize } from 'sequelize';
import { SequelizeStorage, Umzug } from 'umzug';
@@ -10,7 +9,7 @@ import { buildDb, syncDb, type DB } from '../models';
* creating a fresh instance if it doesn't exist.
* @param name db name
*/
-export const verify_db = async (name: string): Promise => {
+const verify_db = async (name: string): Promise => {
let pg: Sequelize | undefined = undefined;
try {
pg = new Sequelize({
@@ -44,7 +43,7 @@ export const verify_db = async (name: string): Promise => {
* Executes migrations on existing sequelize instance
* @param sequelize sequelize instance
*/
-export const migrate_db = async (sequelize: Sequelize) => {
+const migrate_db = async (sequelize: Sequelize) => {
const umzug = new Umzug({
// TODO: move sequelize config and migrations to libs/model
migrations: {
@@ -75,7 +74,7 @@ export const migrate_db = async (sequelize: Sequelize) => {
* Truncates all tables
* @param db database models
*/
-export const truncate_db = async (db?: DB) => {
+const truncate_db = async (db?: DB) => {
if (!db) return;
try {
const tables = Object.values(db.sequelize.models)
@@ -202,29 +201,28 @@ export const get_info_schema = async (
return tables;
};
-// NOTE: the db variable is not shared between Vitest test suites. This is only useful
-// so that the db object does not need to be rebuilt for every to bootstrap_testing from within
-// a single test suite
let db: DB | undefined = undefined;
let bootstrapLock: Promise | undefined = undefined;
-async function _bootstrap_testing(filename: string): Promise {
+async function _bootstrap_testing(): Promise {
if (!db) {
+ const db_name = config.DB.NAME;
try {
- await verify_db(config.DB.NAME);
+ await verify_db(db_name);
db = buildDb(
new Sequelize({
dialect: 'postgres',
- database: config.DB.NAME,
+ database: db_name,
username: 'commonwealth',
password: 'edgeware',
logging: false,
}),
);
await syncDb(db);
- console.log('Database synced:', filename);
+ await truncate_db(db);
+ console.log(`Bootstrapped [${db_name}]`);
} catch (e) {
- console.error('Error bootstrapping test db:', e);
+ console.error(`Error bootstrapping: ${db_name}`, e);
throw e;
}
}
@@ -237,17 +235,14 @@ async function _bootstrap_testing(filename: string): Promise {
* @param truncate when true, truncates all tables in model
* @returns synchronized sequelize db instance
*/
-export const bootstrap_testing = async (meta: ImportMeta): Promise => {
- const filename = path.basename(meta.filename);
+export const bootstrap_testing = async (): Promise => {
if (bootstrapLock) {
return await bootstrapLock;
}
- bootstrapLock = _bootstrap_testing(filename);
+ bootstrapLock = _bootstrap_testing();
try {
return await bootstrapLock;
} finally {
bootstrapLock = undefined;
}
};
-
-config.NODE_ENV === 'test' && dispose(async () => truncate_db(db));
diff --git a/libs/model/src/tester/seed.ts b/libs/model/src/tester/seed.ts
index ebc500eda7e..554dd4fa5b3 100644
--- a/libs/model/src/tester/seed.ts
+++ b/libs/model/src/tester/seed.ts
@@ -62,7 +62,7 @@ export async function seed(
values?: DeepPartial>,
options: SeedOptions = { mock: true },
): Promise<[z.infer<(typeof schemas)[T]> | undefined, State[]]> {
- const db = await bootstrap_testing(import.meta);
+ const db = await bootstrap_testing();
const records: State[] = [];
await _seed(db![name], values ?? {}, options, records, 0);
diff --git a/libs/model/src/tester/seedDb.ts b/libs/model/src/tester/seedDb.ts
index d69dbe2a878..8bce92a8492 100644
--- a/libs/model/src/tester/seedDb.ts
+++ b/libs/model/src/tester/seedDb.ts
@@ -18,9 +18,9 @@ import { bootstrap_testing } from './bootstrap';
* such as associated IDs and seed values. Additionally, not all tests require every
* entity to be seeded, so focus should be on seeding only what is explicitly needed.
*/
-export const seedDb = async (meta: ImportMeta) => {
+export const seedDb = async () => {
try {
- const models = await bootstrap_testing(meta);
+ const models = await bootstrap_testing();
await models.User.bulkCreate(
[{ email: 'drewstone329@gmail.com' }, { email: 'temp@gmail.com' }].map(
diff --git a/libs/model/test/contest/contests-projection-lifecycle.spec.ts b/libs/model/test/contest/contests-projection-lifecycle.spec.ts
index 974e04f45b2..70a03751a1a 100644
--- a/libs/model/test/contest/contests-projection-lifecycle.spec.ts
+++ b/libs/model/test/contest/contests-projection-lifecycle.spec.ts
@@ -21,7 +21,7 @@ import {
contestHelper,
contractHelpers,
} from '../../src/services/commonProtocol';
-import { bootstrap_testing, seed } from '../../src/tester';
+import { seed } from '../../src/tester';
chai.use(chaiAsPromised);
@@ -67,30 +67,25 @@ describe('Contests projection lifecycle', () => {
getContestScore = Sinon.stub(contestHelper, 'getContestScore');
getContestStatus = Sinon.stub(contestHelper, 'getContestStatus');
- // TODO: add ContractAbi to seeder aggregates and replace direct model calls below to avoid calling this here
- await bootstrap_testing(import.meta);
-
try {
- const recurringContestAbi = await models.ContractAbi.create({
+ const [recurringContestAbi] = await seed('ContractAbi', {
id: 700,
abi: [] as AbiType,
nickname: 'RecurringContest',
abi_hash: 'hash1',
+ verified: true,
});
- const singleContestAbi = await models.ContractAbi.create({
+ const [singleContestAbi] = await seed('ContractAbi', {
id: 701,
abi: [] as AbiType,
nickname: 'SingleContest',
abi_hash: 'hash2',
+ verified: true,
});
const [chain] = await seed('ChainNode', {
contracts: [
- {
- abi_id: recurringContestAbi.id,
- },
- {
- abi_id: singleContestAbi.id,
- },
+ { abi_id: recurringContestAbi!.id },
+ { abi_id: singleContestAbi!.id },
],
url: 'https://test',
private_url: 'https://test',
diff --git a/libs/model/test/email/digest-email-lifecycle.spec.ts b/libs/model/test/email/digest-email-lifecycle.spec.ts
index 223c5693aec..882c235ff0a 100644
--- a/libs/model/test/email/digest-email-lifecycle.spec.ts
+++ b/libs/model/test/email/digest-email-lifecycle.spec.ts
@@ -2,10 +2,10 @@ import { ExternalServiceUserIds, dispose, query } from '@hicommonwealth/core';
import { models } from '@hicommonwealth/model';
import { Community } from '@hicommonwealth/schemas';
import { expect } from 'chai';
-import { seed } from 'model/src/tester';
import { afterAll, afterEach, beforeAll, describe, test } from 'vitest';
import { z } from 'zod';
import { GetDigestEmailDataQuery } from '../../src/emails';
+import { seed } from '../../src/tester';
import { generateThreads } from './util';
describe('Digest email lifecycle', () => {
diff --git a/libs/model/test/reaction/reaction-lifecycle.spec.ts b/libs/model/test/reaction/reaction-lifecycle.spec.ts
index dd906ab636e..15ba0c20194 100644
--- a/libs/model/test/reaction/reaction-lifecycle.spec.ts
+++ b/libs/model/test/reaction/reaction-lifecycle.spec.ts
@@ -1,8 +1,8 @@
import { dispose } from '@hicommonwealth/core';
import { expect } from 'chai';
-import { seed } from 'model/src/tester';
import { afterAll, beforeAll, describe, test } from 'vitest';
import { models } from '../../src/database';
+import { seed } from '../../src/tester';
describe('Reactions lifecycle', () => {
const addressId = 555;
diff --git a/libs/model/test/seed/model.spec.ts b/libs/model/test/seed/model.spec.ts
index c8e0a0d08e0..e44115918fe 100644
--- a/libs/model/test/seed/model.spec.ts
+++ b/libs/model/test/seed/model.spec.ts
@@ -11,7 +11,7 @@ import {
} from '../../src/tester';
const generateSchemas = async () => {
- const model = await bootstrap_testing(import.meta);
+ const model = await bootstrap_testing();
const migration = await create_db_from_migrations('common_migrated_test');
// TODO: resolve remaining conflicts!!!
diff --git a/libs/model/test/seed/seed.spec.ts b/libs/model/test/seed/seed.spec.ts
index 8212f3b20b3..04e0e4c2068 100644
--- a/libs/model/test/seed/seed.spec.ts
+++ b/libs/model/test/seed/seed.spec.ts
@@ -9,10 +9,10 @@ import {
import chai, { expect } from 'chai';
import chaiAsPromised from 'chai-as-promised';
import { Model, ValidationError, type ModelStatic } from 'sequelize';
-import { afterAll, beforeAll, describe, test } from 'vitest';
+import { afterAll, describe, test } from 'vitest';
import z from 'zod';
import { models } from '../../src/database';
-import { SeedOptions, bootstrap_testing, seed } from '../../src/tester';
+import { SeedOptions, seed } from '../../src/tester';
chai.use(chaiAsPromised);
@@ -48,10 +48,6 @@ async function testSeed(
describe('Seed functions', () => {
let shouldExit = true;
- beforeAll(async () => {
- await bootstrap_testing(import.meta);
- });
-
afterAll(async () => {
await dispose()();
});
diff --git a/libs/model/test/subscription/comment-subscription-lifecycle.spec.ts b/libs/model/test/subscription/comment-subscription-lifecycle.spec.ts
index e92ec68c30e..8faaf0ae528 100644
--- a/libs/model/test/subscription/comment-subscription-lifecycle.spec.ts
+++ b/libs/model/test/subscription/comment-subscription-lifecycle.spec.ts
@@ -2,7 +2,6 @@ import { Actor, command, dispose, query } from '@hicommonwealth/core';
import * as schemas from '@hicommonwealth/schemas';
import { BalanceType } from '@hicommonwealth/shared';
import { expect } from 'chai';
-import { seed } from 'model/src/tester';
import { afterAll, afterEach, beforeAll, describe, test } from 'vitest';
import z from 'zod';
import { models } from '../../src/database';
@@ -11,11 +10,13 @@ import {
DeleteCommentSubscription,
GetCommentSubscriptions,
} from '../../src/subscription';
+import { seed } from '../../src/tester';
describe('Comment subscription lifecycle', () => {
let actor: Actor;
let commentOne: z.infer | undefined;
let commentTwo: z.infer | undefined;
+
beforeAll(async () => {
const [user] = await seed('User', {
isAdmin: false,
diff --git a/libs/model/test/subscription/community-alerts-lifecycle.spec.ts b/libs/model/test/subscription/community-alerts-lifecycle.spec.ts
index 0cc1c3d7a1c..cadfe3e5e8f 100644
--- a/libs/model/test/subscription/community-alerts-lifecycle.spec.ts
+++ b/libs/model/test/subscription/community-alerts-lifecycle.spec.ts
@@ -2,7 +2,6 @@ import { Actor, command, dispose, query } from '@hicommonwealth/core';
import * as schemas from '@hicommonwealth/schemas';
import { BalanceType } from '@hicommonwealth/shared';
import { expect } from 'chai';
-import { seed } from 'model/src/tester';
import { afterAll, afterEach, beforeAll, describe, test } from 'vitest';
import z from 'zod';
import { models } from '../../src/database';
@@ -11,6 +10,7 @@ import {
DeleteCommunityAlerts,
GetCommunityAlerts,
} from '../../src/subscription';
+import { seed } from '../../src/tester';
describe('Community alerts lifecycle', () => {
let actor: Actor;
diff --git a/libs/model/test/subscription/subscription-preferences-lifecycle.spec.ts b/libs/model/test/subscription/subscription-preferences-lifecycle.spec.ts
index fdf91cfe248..13c908cde2b 100644
--- a/libs/model/test/subscription/subscription-preferences-lifecycle.spec.ts
+++ b/libs/model/test/subscription/subscription-preferences-lifecycle.spec.ts
@@ -17,6 +17,7 @@ import { seed } from '../../src/tester';
describe('Subscription preferences lifecycle', () => {
let actor: Actor;
+
beforeAll(async () => {
const [user] = await seed('User', {
isAdmin: false,
diff --git a/libs/model/test/subscription/thread-subscription-lifecycle.spec.ts b/libs/model/test/subscription/thread-subscription-lifecycle.spec.ts
index 121c1b54a26..fd1fa5fcc8e 100644
--- a/libs/model/test/subscription/thread-subscription-lifecycle.spec.ts
+++ b/libs/model/test/subscription/thread-subscription-lifecycle.spec.ts
@@ -2,7 +2,6 @@ import { Actor, command, dispose, query } from '@hicommonwealth/core';
import * as schemas from '@hicommonwealth/schemas';
import { BalanceType } from '@hicommonwealth/shared';
import { expect } from 'chai';
-import { seed } from 'model/src/tester';
import { afterAll, afterEach, beforeAll, describe, test } from 'vitest';
import z from 'zod';
import { models } from '../../src/database';
@@ -11,11 +10,13 @@ import {
DeleteThreadSubscription,
GetThreadSubscriptions,
} from '../../src/subscription';
+import { seed } from '../../src/tester';
describe('Thread subscription lifecycle', () => {
let actor: Actor;
let threadOne: z.infer | undefined;
let threadTwo: z.infer | undefined;
+
beforeAll(async () => {
const [user] = await seed('User', {
isAdmin: false,
diff --git a/libs/model/test/util-tests/getCommentDepth.spec.ts b/libs/model/test/util-tests/getCommentDepth.spec.ts
index 60e66c78d04..b433b998c84 100644
--- a/libs/model/test/util-tests/getCommentDepth.spec.ts
+++ b/libs/model/test/util-tests/getCommentDepth.spec.ts
@@ -16,7 +16,7 @@ describe('getCommentDepth', () => {
const maxDepth = 8;
beforeAll(async () => {
- await tester.seedDb(import.meta);
+ await tester.seedDb();
const address = await models.Address.findOne({
where: {
community_id,
diff --git a/libs/schemas/src/entities/contract.schemas.ts b/libs/schemas/src/entities/contract.schemas.ts
index e1380c3873c..4c4801c2181 100644
--- a/libs/schemas/src/entities/contract.schemas.ts
+++ b/libs/schemas/src/entities/contract.schemas.ts
@@ -25,3 +25,14 @@ export const Contract = z.object({
created_at: z.coerce.date().optional(),
updated_at: z.coerce.date().optional(),
});
+
+export const ContractAbi = z.object({
+ id: PG_INT,
+ abi: z.record(z.string(), z.unknown()).array(),
+ abi_hash: z.string().max(255).nullish(),
+ nickname: z.string().max(255).nullish(),
+ verified: z.boolean().default(false).nullish(),
+
+ created_at: z.coerce.date().optional(),
+ updated_at: z.coerce.date().optional(),
+});
diff --git a/libs/schemas/src/index.ts b/libs/schemas/src/index.ts
index c2d03a88737..55da399ab95 100644
--- a/libs/schemas/src/index.ts
+++ b/libs/schemas/src/index.ts
@@ -22,6 +22,7 @@ export type Aggregates = Extract<
| 'GroupPermission'
| 'Tags'
| 'CommunityTags'
+ | 'ContractAbi'
>;
export * from './commands';
diff --git a/packages/commonwealth/scripts/bootstrapTestDb.ts b/packages/commonwealth/scripts/bootstrapTestDb.ts
index 3019d10ef5e..1e5b9680364 100644
--- a/packages/commonwealth/scripts/bootstrapTestDb.ts
+++ b/packages/commonwealth/scripts/bootstrapTestDb.ts
@@ -1,27 +1,9 @@
import { dispose } from '@hicommonwealth/core';
-import { buildDb, config, syncDb, tester } from '@hicommonwealth/model';
-import { Sequelize } from 'sequelize';
+import { tester } from '@hicommonwealth/model';
async function main() {
console.log('Bootstrapping test db...');
- try {
- await tester.verify_db(config.DB.NAME);
- const db = buildDb(
- new Sequelize({
- dialect: 'postgres',
- database: config.DB.NAME,
- username: 'commonwealth',
- password: 'edgeware',
- logging: false,
- }),
- );
- await syncDb(db);
- console.log('Bootstrapping test db...DONE!');
- } catch (e) {
- console.log('Bootstrapping test db...FAIL!');
- console.error(e);
- await dispose()('ERROR', true);
- }
+ await tester.bootstrap_testing();
await dispose()('EXIT', true);
}
void main();
diff --git a/packages/commonwealth/server-test.ts b/packages/commonwealth/server-test.ts
index 21bb255c561..aa28088e4e1 100644
--- a/packages/commonwealth/server-test.ts
+++ b/packages/commonwealth/server-test.ts
@@ -25,19 +25,18 @@ export type TestServer = {
models: DB;
seeder: ModelSeeder;
e2eTestEntities: E2E_TestEntities;
- truncate: () => Promise;
};
/**
* Creates local test server connected to test db and seeder utils
* @returns test server
*/
-export const testServer = async (meta: ImportMeta): Promise => {
+export const testServer = async (): Promise => {
// bootstrap test adapters
cache({
adapter: new RedisCache('redis://localhost:6379'),
});
- const db = await tester.seedDb(meta);
+ const db = await tester.seedDb();
const app = express();
const { server, cacheDecorator } = await main(app, db, {
port: 8081,
@@ -57,6 +56,5 @@ export const testServer = async (meta: ImportMeta): Promise => {
models: db,
seeder,
e2eTestEntities,
- truncate: () => tester.truncate_db(db),
};
};
diff --git a/packages/commonwealth/test/devnet/cosmos/proposalTxEthermint.spec.ts b/packages/commonwealth/test/devnet/cosmos/proposalTxEthermint.spec.ts
index 1991aac9092..a8366905e16 100644
--- a/packages/commonwealth/test/devnet/cosmos/proposalTxEthermint.spec.ts
+++ b/packages/commonwealth/test/devnet/cosmos/proposalTxEthermint.spec.ts
@@ -89,7 +89,7 @@ describe('Proposal Transaction Tests - ethermint chain (evmos-dev-local)', () =>
const lcdUrl = `http://localhost:8080/cosmosAPI/v1/${id}`;
beforeAll(async () => {
- await tester.seedDb(import.meta);
+ await tester.seedDb();
const tm = await getTMClient(rpcUrl);
rpc = await getRPCClient(tm);
const { signerAddress } = await setupTestSigner(lcdUrl);
@@ -175,7 +175,7 @@ describe('Proposal Transaction Tests - ethermint chain (evmos-dev-local)', () =>
describe('Ethermint Governance v1beta1 util Tests', () => {
describe('getActiveProposals', () => {
beforeAll(async () => {
- await tester.seedDb(import.meta);
+ await tester.seedDb();
});
afterAll(async () => {
diff --git a/packages/commonwealth/test/devnet/cosmos/proposalTxV1.spec.ts b/packages/commonwealth/test/devnet/cosmos/proposalTxV1.spec.ts
index 4aae2434ff7..8873480d34d 100644
--- a/packages/commonwealth/test/devnet/cosmos/proposalTxV1.spec.ts
+++ b/packages/commonwealth/test/devnet/cosmos/proposalTxV1.spec.ts
@@ -41,7 +41,7 @@ describe('Proposal Transaction Tests - gov v1 chain using cosmJs signer (csdk-v1
let signer: string;
beforeAll(async () => {
- await tester.seedDb(import.meta);
+ await tester.seedDb();
lcd = await getLCDClient(lcdUrl);
const { signerAddress } = await setupTestSigner(rpcUrl);
signer = signerAddress;
diff --git a/packages/commonwealth/test/devnet/cosmos/proposalTxV1beta1.spec.ts b/packages/commonwealth/test/devnet/cosmos/proposalTxV1beta1.spec.ts
index 20e771ebf08..44ec352ee89 100644
--- a/packages/commonwealth/test/devnet/cosmos/proposalTxV1beta1.spec.ts
+++ b/packages/commonwealth/test/devnet/cosmos/proposalTxV1beta1.spec.ts
@@ -36,7 +36,7 @@ describe('Proposal Transaction Tests - gov v1beta1 chain (csdk-beta-local)', ()
const rpcUrlBeta = `http://localhost:8080/cosmosAPI/${betaId}`;
beforeAll(async () => {
- await tester.seedDb(import.meta);
+ await tester.seedDb();
const tm = await getTMClient(rpcUrlBeta);
rpc = await getRPCClient(tm);
const { signerAddress } = await setupTestSigner(rpcUrlBeta);
@@ -177,7 +177,7 @@ describe('Proposal Transaction Tests - gov v1beta1 chain (csdk-beta-local)', ()
describe('Cosmos Governance v1beta1 util Tests', () => {
beforeAll(async () => {
- await tester.seedDb(import.meta);
+ await tester.seedDb();
});
afterAll(async () => {
diff --git a/packages/commonwealth/test/devnet/cosmos/tokenBalanceFetching.spec.ts b/packages/commonwealth/test/devnet/cosmos/tokenBalanceFetching.spec.ts
index 570fdd3e480..1895f5b74fe 100644
--- a/packages/commonwealth/test/devnet/cosmos/tokenBalanceFetching.spec.ts
+++ b/packages/commonwealth/test/devnet/cosmos/tokenBalanceFetching.spec.ts
@@ -136,7 +136,7 @@ describe('Token Balance Cache Cosmos Tests', { timeout: 30_000 }, function () {
};
beforeAll(async () => {
- models = await tester.seedDb(import.meta);
+ models = await tester.seedDb();
cache({
adapter: new RedisCache('redis://localhost:6379'),
});
diff --git a/packages/commonwealth/test/devnet/evm/evmChainEvents.spec.ts b/packages/commonwealth/test/devnet/evm/evmChainEvents.spec.ts
index 7d1e30252de..14df8a4159a 100644
--- a/packages/commonwealth/test/devnet/evm/evmChainEvents.spec.ts
+++ b/packages/commonwealth/test/devnet/evm/evmChainEvents.spec.ts
@@ -340,11 +340,13 @@ describe('EVM Chain Events Devnet Tests', () => {
max_ce_block_range: -1,
});
const namespaceAbiInstance = await models.ContractAbi.create({
+ id: 1,
abi: namespaceFactoryAbi,
nickname: 'NamespaceFactory',
abi_hash: hashAbi(namespaceFactoryAbi),
});
const stakesAbiInstance = await models.ContractAbi.create({
+ id: 2,
abi: communityStakesAbi,
nickname: 'CommunityStakes',
abi_hash: hashAbi(communityStakesAbi),
diff --git a/packages/commonwealth/test/devnet/evm/tokenBalanceFetching.spec.ts b/packages/commonwealth/test/devnet/evm/tokenBalanceFetching.spec.ts
index 40d39d80696..3ab86b31afa 100644
--- a/packages/commonwealth/test/devnet/evm/tokenBalanceFetching.spec.ts
+++ b/packages/commonwealth/test/devnet/evm/tokenBalanceFetching.spec.ts
@@ -94,7 +94,7 @@ describe('Token Balance Cache EVM Tests', { timeout: 160_000 }, function () {
beforeAll(async () => {
anvil = await getAnvil(1);
- models = await tester.seedDb(import.meta);
+ models = await tester.seedDb();
cache({
adapter: new RedisCache('redis://localhost:6379'),
});
diff --git a/packages/commonwealth/test/e2e/utils/e2eUtils.ts b/packages/commonwealth/test/e2e/utils/e2eUtils.ts
index bf7aaed66d6..c68f312058c 100644
--- a/packages/commonwealth/test/e2e/utils/e2eUtils.ts
+++ b/packages/commonwealth/test/e2e/utils/e2eUtils.ts
@@ -14,7 +14,7 @@ export type E2E_Seeder = E2E_TestEntities & {
const buildSeeder = async (): Promise => {
// This connection is used to speed up tests, so we don't need to load in all the models with the associated
// imports. This can only be used with raw sql queries.
- const testDb = await tester.bootstrap_testing(import.meta);
+ const testDb = await tester.bootstrap_testing();
const testAddress = '0x0bad5AA8Adf8bA82198D133F9Bb5a48A638FCe88';
const e2eEntities = await tester.e2eTestEntities(testDb);
diff --git a/packages/commonwealth/test/integration/api/chainNodes.spec.ts b/packages/commonwealth/test/integration/api/chainNodes.spec.ts
index 5b63422e73a..97c3f23205f 100644
--- a/packages/commonwealth/test/integration/api/chainNodes.spec.ts
+++ b/packages/commonwealth/test/integration/api/chainNodes.spec.ts
@@ -10,7 +10,7 @@ describe('ChainNode Tests', () => {
let models: DB;
beforeAll(async () => {
- models = await tester.seedDb(import.meta);
+ models = await tester.seedDb();
});
afterAll(async () => {
diff --git a/packages/commonwealth/test/integration/api/communityStake.spec.ts b/packages/commonwealth/test/integration/api/communityStake.spec.ts
index 4c8ed555d49..bd95f072faf 100644
--- a/packages/commonwealth/test/integration/api/communityStake.spec.ts
+++ b/packages/commonwealth/test/integration/api/communityStake.spec.ts
@@ -33,7 +33,7 @@ describe('POST communityStakes Tests', () => {
let server: TestServer;
beforeAll(async () => {
- server = await testServer(import.meta);
+ server = await testServer();
});
afterAll(async () => {
diff --git a/packages/commonwealth/test/integration/api/cosmosCache.spec.ts b/packages/commonwealth/test/integration/api/cosmosCache.spec.ts
index d170d001b48..053c90be91b 100644
--- a/packages/commonwealth/test/integration/api/cosmosCache.spec.ts
+++ b/packages/commonwealth/test/integration/api/cosmosCache.spec.ts
@@ -43,7 +43,7 @@ describe('Cosmos Cache', () => {
}
beforeAll(async () => {
- server = await testServer(import.meta);
+ server = await testServer();
await cache().ready();
});
diff --git a/packages/commonwealth/test/integration/api/createComment.spec.ts b/packages/commonwealth/test/integration/api/createComment.spec.ts
index 9e952cff42d..2dfae635dc8 100644
--- a/packages/commonwealth/test/integration/api/createComment.spec.ts
+++ b/packages/commonwealth/test/integration/api/createComment.spec.ts
@@ -63,7 +63,7 @@ describe('createComment Integration Tests', () => {
};
beforeAll(async () => {
- server = await testServer(import.meta);
+ server = await testServer();
});
afterAll(async () => {
diff --git a/packages/commonwealth/test/integration/api/createReactions.spec.ts b/packages/commonwealth/test/integration/api/createReactions.spec.ts
index 27a1a748bb7..fb3630748fa 100644
--- a/packages/commonwealth/test/integration/api/createReactions.spec.ts
+++ b/packages/commonwealth/test/integration/api/createReactions.spec.ts
@@ -51,7 +51,7 @@ describe('createReaction Integration Tests', () => {
};
beforeAll(async () => {
- server = await testServer(import.meta);
+ server = await testServer();
const res = await server.seeder.createAndVerifyAddress(
{ chain: communityId },
diff --git a/packages/commonwealth/test/integration/api/getAddressProfile.spec.ts b/packages/commonwealth/test/integration/api/getAddressProfile.spec.ts
index d47b42a2990..6193e11d4b3 100644
--- a/packages/commonwealth/test/integration/api/getAddressProfile.spec.ts
+++ b/packages/commonwealth/test/integration/api/getAddressProfile.spec.ts
@@ -8,7 +8,7 @@ describe('getAddressProfile tests', () => {
let server: TestServer;
beforeAll(async () => {
- server = await testServer(import.meta);
+ server = await testServer();
});
afterAll(async () => {
diff --git a/packages/commonwealth/test/integration/api/getRelatedCommunities.spec.ts b/packages/commonwealth/test/integration/api/getRelatedCommunities.spec.ts
index 900679bb610..91221c9b1c3 100644
--- a/packages/commonwealth/test/integration/api/getRelatedCommunities.spec.ts
+++ b/packages/commonwealth/test/integration/api/getRelatedCommunities.spec.ts
@@ -8,7 +8,7 @@ describe('GetRelatedCommunities Tests', async () => {
let models: DB;
beforeAll(async () => {
- models = await tester.seedDb(import.meta);
+ models = await tester.seedDb();
});
afterAll(async () => {
diff --git a/packages/commonwealth/test/integration/api/getRoles.spec.ts b/packages/commonwealth/test/integration/api/getRoles.spec.ts
index 6ca1e3fc46e..a5ccddd0100 100644
--- a/packages/commonwealth/test/integration/api/getRoles.spec.ts
+++ b/packages/commonwealth/test/integration/api/getRoles.spec.ts
@@ -15,7 +15,7 @@ describe('get roles Integration Tests', () => {
let server: TestServer;
beforeAll(async () => {
- server = await testServer(import.meta);
+ server = await testServer();
});
afterAll(async () => {
diff --git a/packages/commonwealth/test/integration/api/index.spec.ts b/packages/commonwealth/test/integration/api/index.spec.ts
index b551eacf72f..759cf70c800 100644
--- a/packages/commonwealth/test/integration/api/index.spec.ts
+++ b/packages/commonwealth/test/integration/api/index.spec.ts
@@ -19,7 +19,7 @@ describe('API Tests', () => {
let server: TestServer;
beforeAll(async () => {
- server = await testServer(import.meta);
+ server = await testServer();
});
afterAll(async () => {
diff --git a/packages/commonwealth/test/integration/api/linking.spec.ts b/packages/commonwealth/test/integration/api/linking.spec.ts
index 038682dcac0..c3bf74609d7 100644
--- a/packages/commonwealth/test/integration/api/linking.spec.ts
+++ b/packages/commonwealth/test/integration/api/linking.spec.ts
@@ -57,7 +57,7 @@ describe('Linking Tests', () => {
const link5 = { source: LinkSource.Proposal, identifier: '4' };
beforeAll(async () => {
- server = await testServer(import.meta);
+ server = await testServer();
const topic = await server.models.Topic.findOne({
where: {
diff --git a/packages/commonwealth/test/integration/api/polls.spec.ts b/packages/commonwealth/test/integration/api/polls.spec.ts
index 82d91fa64a1..d72aa328fd6 100644
--- a/packages/commonwealth/test/integration/api/polls.spec.ts
+++ b/packages/commonwealth/test/integration/api/polls.spec.ts
@@ -34,7 +34,7 @@ describe('Polls', () => {
let server: TestServer;
beforeAll(async () => {
- server = await testServer(import.meta);
+ server = await testServer();
const topic = await server.models.Topic.findOne({
where: {
diff --git a/packages/commonwealth/test/integration/api/thread.update.spec.ts b/packages/commonwealth/test/integration/api/thread.update.spec.ts
index e0d1bade034..5295350db29 100644
--- a/packages/commonwealth/test/integration/api/thread.update.spec.ts
+++ b/packages/commonwealth/test/integration/api/thread.update.spec.ts
@@ -48,7 +48,7 @@ describe('Thread Patch Update', () => {
let server: TestServer;
beforeAll(async () => {
- server = await testServer(import.meta);
+ server = await testServer();
const adminRes = await server.seeder.createAndVerifyAddress(
{ chain },
diff --git a/packages/commonwealth/test/integration/api/threads-query.spec.ts b/packages/commonwealth/test/integration/api/threads-query.spec.ts
index 0c38046ca72..21be5ecd099 100644
--- a/packages/commonwealth/test/integration/api/threads-query.spec.ts
+++ b/packages/commonwealth/test/integration/api/threads-query.spec.ts
@@ -19,7 +19,7 @@ describe('Thread queries', () => {
let models: DB;
beforeAll(async () => {
- models = await tester.seedDb(import.meta);
+ models = await tester.seedDb();
});
afterAll(async () => {
diff --git a/packages/commonwealth/test/integration/api/updatecommunity.spec.ts b/packages/commonwealth/test/integration/api/updatecommunity.spec.ts
index 737a88f2a13..c99eecd191b 100644
--- a/packages/commonwealth/test/integration/api/updatecommunity.spec.ts
+++ b/packages/commonwealth/test/integration/api/updatecommunity.spec.ts
@@ -36,7 +36,7 @@ describe('Update Community/Chain Tests', () => {
let server: TestServer;
beforeAll(async () => {
- server = await testServer(import.meta);
+ server = await testServer();
// get logged in address/user with JWT
const result = await server.seeder.createAndVerifyAddress(
diff --git a/packages/commonwealth/test/integration/api/upgradeMember.spec.ts b/packages/commonwealth/test/integration/api/upgradeMember.spec.ts
index 0e53faff6ca..9711f925d6b 100644
--- a/packages/commonwealth/test/integration/api/upgradeMember.spec.ts
+++ b/packages/commonwealth/test/integration/api/upgradeMember.spec.ts
@@ -15,7 +15,7 @@ describe('upgradeMember Integration Tests', () => {
let server: TestServer;
beforeAll(async () => {
- server = await testServer(import.meta);
+ server = await testServer();
});
afterAll(async () => {
diff --git a/packages/commonwealth/test/integration/api/user.spec.ts b/packages/commonwealth/test/integration/api/user.spec.ts
index 840fbfbec71..009357608d4 100644
--- a/packages/commonwealth/test/integration/api/user.spec.ts
+++ b/packages/commonwealth/test/integration/api/user.spec.ts
@@ -17,7 +17,7 @@ describe('User Model Routes', () => {
let server: TestServer;
beforeAll(async () => {
- server = await testServer(import.meta);
+ server = await testServer();
});
afterAll(async () => {
diff --git a/packages/commonwealth/test/integration/api/userDashboard.spec.ts b/packages/commonwealth/test/integration/api/userDashboard.spec.ts
index ff7746b04fe..e1abfa1541f 100644
--- a/packages/commonwealth/test/integration/api/userDashboard.spec.ts
+++ b/packages/commonwealth/test/integration/api/userDashboard.spec.ts
@@ -43,7 +43,7 @@ describe('User Dashboard API', () => {
let server: TestServer;
beforeAll(async () => {
- server = await testServer(import.meta);
+ server = await testServer();
const topic = await server.models.Topic.findOne({
where: {
diff --git a/packages/commonwealth/test/integration/api/validationMiddleware.spec.ts b/packages/commonwealth/test/integration/api/validationMiddleware.spec.ts
index 8af03b52067..d0e3b5a9e9c 100644
--- a/packages/commonwealth/test/integration/api/validationMiddleware.spec.ts
+++ b/packages/commonwealth/test/integration/api/validationMiddleware.spec.ts
@@ -31,7 +31,7 @@ describe('DatabaseValidationService Tests', () => {
let server: TestServer;
beforeAll(async function () {
- server = await testServer(import.meta);
+ server = await testServer();
console.log('Database reset');
databaseValidationService = new DatabaseValidationService(server.models);
let res = await server.seeder.createAndVerifyAddress({ chain }, 'Alice');
diff --git a/packages/commonwealth/test/integration/api/verifyAddress.spec.ts b/packages/commonwealth/test/integration/api/verifyAddress.spec.ts
index a77d28d216b..7d28dc2895b 100644
--- a/packages/commonwealth/test/integration/api/verifyAddress.spec.ts
+++ b/packages/commonwealth/test/integration/api/verifyAddress.spec.ts
@@ -22,7 +22,7 @@ describe('Verify Address Routes', () => {
const chain_id = '1';
beforeAll(async () => {
- server = await testServer(import.meta);
+ server = await testServer();
sessionSigner = new SIWESigner({ chainId: parseInt(chain_id) });
const { payload } = await sessionSigner.newSession(CANVAS_TOPIC);
diff --git a/packages/commonwealth/test/integration/databaseCleaner.spec.ts b/packages/commonwealth/test/integration/databaseCleaner.spec.ts
index 9b4a7402abb..0efc39c23ee 100644
--- a/packages/commonwealth/test/integration/databaseCleaner.spec.ts
+++ b/packages/commonwealth/test/integration/databaseCleaner.spec.ts
@@ -26,7 +26,7 @@ describe('DatabaseCleaner Tests', async () => {
let models: DB;
beforeAll(async () => {
- models = await tester.seedDb(import.meta);
+ models = await tester.seedDb();
});
afterAll(async () => {
diff --git a/packages/commonwealth/test/integration/evmChainEvents/getEventSources.spec.ts b/packages/commonwealth/test/integration/evmChainEvents/getEventSources.spec.ts
index 5c7f708a812..24d07606111 100644
--- a/packages/commonwealth/test/integration/evmChainEvents/getEventSources.spec.ts
+++ b/packages/commonwealth/test/integration/evmChainEvents/getEventSources.spec.ts
@@ -15,7 +15,7 @@ describe('getEventSources', () => {
let stakesAbiInstance: ContractAbiInstance;
beforeAll(async () => {
- await tester.bootstrap_testing(import.meta);
+ await tester.bootstrap_testing();
const res = await createEventSources();
namespaceAbiInstance = res.namespaceAbiInstance;
stakesAbiInstance = res.stakesAbiInstance;
diff --git a/packages/commonwealth/test/integration/evmChainEvents/scheduleNodeProcessing.spec.ts b/packages/commonwealth/test/integration/evmChainEvents/scheduleNodeProcessing.spec.ts
index e7974ef1332..8e1778bb644 100644
--- a/packages/commonwealth/test/integration/evmChainEvents/scheduleNodeProcessing.spec.ts
+++ b/packages/commonwealth/test/integration/evmChainEvents/scheduleNodeProcessing.spec.ts
@@ -22,7 +22,7 @@ describe('scheduleNodeProcessing', () => {
let stakesAbiInstance: ContractAbiInstance;
beforeAll(async () => {
- await tester.bootstrap_testing(import.meta);
+ await tester.bootstrap_testing();
});
afterAll(async () => {
diff --git a/packages/commonwealth/test/integration/evmChainEvents/util.ts b/packages/commonwealth/test/integration/evmChainEvents/util.ts
index ff8f3575616..7a38144fdb8 100644
--- a/packages/commonwealth/test/integration/evmChainEvents/util.ts
+++ b/packages/commonwealth/test/integration/evmChainEvents/util.ts
@@ -31,11 +31,13 @@ export async function createEventSources(): Promise<{
max_ce_block_range: -1,
});
const namespaceAbiInstance = await models.ContractAbi.create({
+ id: 1,
abi: namespaceFactoryAbi,
nickname: 'NamespaceFactory',
abi_hash: hashAbi(namespaceFactoryAbi),
});
const stakesAbiInstance = await models.ContractAbi.create({
+ id: 2,
abi: communityStakesAbi,
nickname: 'CommunityStakes',
abi_hash: hashAbi(communityStakesAbi),
diff --git a/packages/commonwealth/test/integration/messageRelayer/messageRelayer.spec.ts b/packages/commonwealth/test/integration/messageRelayer/messageRelayer.spec.ts
index 7f40826a886..453b01d689b 100644
--- a/packages/commonwealth/test/integration/messageRelayer/messageRelayer.spec.ts
+++ b/packages/commonwealth/test/integration/messageRelayer/messageRelayer.spec.ts
@@ -12,7 +12,7 @@ import { testOutboxEvents } from './util';
describe('messageRelayer', { timeout: 20_000 }, () => {
beforeAll(async () => {
- await tester.bootstrap_testing(import.meta);
+ await tester.bootstrap_testing();
});
afterEach(async () => {
diff --git a/packages/commonwealth/test/integration/messageRelayer/pgListener.spec.ts b/packages/commonwealth/test/integration/messageRelayer/pgListener.spec.ts
index 481db284aa9..494e84b1583 100644
--- a/packages/commonwealth/test/integration/messageRelayer/pgListener.spec.ts
+++ b/packages/commonwealth/test/integration/messageRelayer/pgListener.spec.ts
@@ -13,7 +13,7 @@ describe.skip('pgListener', { timeout: 10_000 }, () => {
let client: Client;
beforeAll(async () => {
- await tester.bootstrap_testing(import.meta);
+ await tester.bootstrap_testing();
client = await setupListener();
});
diff --git a/packages/commonwealth/test/integration/messageRelayer/relay.spec.ts b/packages/commonwealth/test/integration/messageRelayer/relay.spec.ts
index cd200ee922f..440213d0e0f 100644
--- a/packages/commonwealth/test/integration/messageRelayer/relay.spec.ts
+++ b/packages/commonwealth/test/integration/messageRelayer/relay.spec.ts
@@ -7,7 +7,7 @@ import { testOutboxEvents } from './util';
describe('relay', () => {
beforeAll(async () => {
- await tester.bootstrap_testing(import.meta);
+ await tester.bootstrap_testing();
});
afterEach(async () => {
diff --git a/vite.config.ts b/vite.config.ts
index a33e953845f..995a62ad0e0 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -1,21 +1,30 @@
///
-
import * as dotenv from 'dotenv';
import { defineConfig } from 'vite';
import tsconfigPaths from 'vite-tsconfig-paths';
dotenv.config();
-const pkg = process.env.npm_package_name!;
-const parallel = !['@hicommonwealth/model', 'commonwealth'].includes(pkg);
-
-console.log('vitest:', pkg, 'parallel:', parallel);
-
export default defineConfig({
plugins: [tsconfigPaths()],
test: {
+ poolMatchGlobs: [
+ ['**/community-alerts-lifecycle.spec.ts', 'forks'],
+ ['**/*-lifecycle.spec.ts', 'threads'],
+ ['**/*.spec.ts', 'forks'],
+ ],
+ poolOptions: {
+ threads: {
+ minThreads: 1,
+ maxThreads: 5,
+ },
+ forks: {
+ minForks: 1,
+ maxForks: 1,
+ },
+ },
sequence: { concurrent: false },
- fileParallelism: parallel,
+ reporters: ['default'],
coverage: {
provider: 'istanbul',
reporter:
From 059bf45ec3405b4c52d30876fe4ce1150cd6ec8c Mon Sep 17 00:00:00 2001
From: Timothee Legros
Date: Thu, 21 Nov 2024 00:29:38 +0200
Subject: [PATCH 160/227] poll schemas
---
libs/schemas/src/commands/poll.schemas.ts | 12 ++++++++
libs/schemas/src/entities/poll.schemas.ts | 36 +++++++++++++++++++++++
2 files changed, 48 insertions(+)
create mode 100644 libs/schemas/src/commands/poll.schemas.ts
diff --git a/libs/schemas/src/commands/poll.schemas.ts b/libs/schemas/src/commands/poll.schemas.ts
new file mode 100644
index 00000000000..1a4f84ff501
--- /dev/null
+++ b/libs/schemas/src/commands/poll.schemas.ts
@@ -0,0 +1,12 @@
+import { z } from 'zod';
+import { Vote } from '../entities/poll.schemas';
+import { PG_INT } from '../utils';
+
+export const CreatePollVote = {
+ input: z.object({
+ thread_id: PG_INT,
+ pollId: z.number(),
+ option: z.string(),
+ }),
+ output: Vote,
+};
diff --git a/libs/schemas/src/entities/poll.schemas.ts b/libs/schemas/src/entities/poll.schemas.ts
index e69de29bb2d..1120e573962 100644
--- a/libs/schemas/src/entities/poll.schemas.ts
+++ b/libs/schemas/src/entities/poll.schemas.ts
@@ -0,0 +1,36 @@
+import { z } from 'zod';
+import { Community } from '../entities/community.schemas';
+import { Thread } from '../entities/thread.schemas';
+import { PG_INT } from '../utils';
+
+const _vote = z.object({
+ id: PG_INT.optional(),
+ poll_id: z.number(),
+ option: z.string(),
+ address: z.string(),
+ author_community_id: z.string(),
+ community_id: z.string(),
+ created_at: z.coerce.date().optional(),
+ updated_at: z.coerce.date().optional(),
+});
+
+export const Poll = z.object({
+ id: PG_INT.optional(),
+ community_id: z.string(),
+ thread_id: z.number(),
+ prompt: z.string(),
+ options: z.string(),
+ ends_at: z.coerce.date(),
+ created_at: z.coerce.date().optional(),
+ updated_at: z.coerce.date().optional(),
+
+ // associations
+ Thread: Thread.optional(),
+ Community: Community.optional(),
+ votes: _vote.optional(),
+});
+
+export const Vote = _vote.extend({
+ // associations
+ poll: Poll.optional(),
+});
From 3934f280fa62dd95b965374d6caae51bb1dcf428 Mon Sep 17 00:00:00 2001
From: israellund
Date: Wed, 20 Nov 2024 17:44:51 -0500
Subject: [PATCH 161/227] added char count to edit topic modal
---
.../scripts/views/modals/edit_topic_modal.tsx | 60 ++++++++++++-------
.../ManageTopicsSection.tsx | 1 -
.../styles/modals/edit_topic_modal.scss | 19 +++---
3 files changed, 51 insertions(+), 29 deletions(-)
diff --git a/packages/commonwealth/client/scripts/views/modals/edit_topic_modal.tsx b/packages/commonwealth/client/scripts/views/modals/edit_topic_modal.tsx
index 3e825f0f10c..91f7cd8135c 100644
--- a/packages/commonwealth/client/scripts/views/modals/edit_topic_modal.tsx
+++ b/packages/commonwealth/client/scripts/views/modals/edit_topic_modal.tsx
@@ -1,5 +1,5 @@
import { pluralizeWithoutNumberPrefix } from 'helpers';
-import React, { useState } from 'react';
+import React, { useEffect, useMemo, useState } from 'react';
import type { Topic } from '../../models/Topic';
import { useCommonNavigate } from '../../navigation/helpers';
import app from '../../state';
@@ -20,6 +20,7 @@ import { openConfirmation } from './confirmation_modal';
import { notifySuccess } from 'controllers/app/notifications';
import { DeltaStatic } from 'quill';
+import { MessageRow } from 'views/components/component_kit/new_designs/CWTextInput/MessageRow';
import '../../../styles/modals/edit_topic_modal.scss';
import { CWText } from '../components/component_kit/cw_text';
import { ReactQuillEditor } from '../components/react_quill_editor';
@@ -55,25 +56,34 @@ export const EditTopicModal = ({
featuredInSidebarProp,
);
const [name, setName] = useState(nameProp);
- // const [characterCount, setCharacterCount] = useState(0);
- console.log('this is description', description);
- // const getCharacterCount = (delta) => {
- // if (!delta || !delta.ops) {
- // return 0;
- // }
- // return delta.ops.reduce((count, op) => {
- // if (typeof op.insert === 'string') {
- // const cleanedText = op.insert.replace(/\n$/, '');
- // return count + cleanedText.length;
- // }
- // return count;
- // }, 0);
- // };
+ const [characterCount, setCharacterCount] = useState(0);
+ const [descErrorMsg, setDescErrorMsg] = useState(null);
- // useEffect(() => {
- // const count = getCharacterCount(description);
- // setCharacterCount(count);
- // }, [description]);
+ const getCharacterCount = (delta) => {
+ if (!delta || !delta.ops) {
+ return 0;
+ }
+ return delta.ops.reduce((count, op) => {
+ if (typeof op.insert === 'string') {
+ const cleanedText = op.insert.replace(/\n$/, '');
+ return count + cleanedText.length;
+ }
+ return count;
+ }, 0);
+ };
+
+ useEffect(() => {
+ const count = getCharacterCount(description);
+ setCharacterCount(count);
+ }, [description]);
+
+ useMemo(() => {
+ if ((description?.ops || [])?.[0]?.insert?.length > 250) {
+ setDescErrorMsg('Description must be 250 characters or less');
+ } else {
+ setDescErrorMsg(null);
+ }
+ }, [description]);
const handleSaveChanges = async () => {
setIsSaving(true);
@@ -194,7 +204,15 @@ export const EditTopicModal = ({
})}
isDisabled={!!topic.archived_at}
/>
- Character count: /250
+
+ Character count: {characterCount}/250
+
+ statusMessage={descErrorMsg}
+ hasFeedback={!!descErrorMsg}
+ validationStatus={descErrorMsg ? 'failure' : undefined}
+ />
+
{errorMsg && (
diff --git a/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Topics/TopicDetails/ManageTopicsSection/ManageTopicsSection.tsx b/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Topics/TopicDetails/ManageTopicsSection/ManageTopicsSection.tsx
index 2560a2bf7ac..4d9abe4254a 100644
--- a/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Topics/TopicDetails/ManageTopicsSection/ManageTopicsSection.tsx
+++ b/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Topics/TopicDetails/ManageTopicsSection/ManageTopicsSection.tsx
@@ -81,7 +81,6 @@ export const ManageTopicsSection = () => {
includeArchivedTopics: true,
apiEnabled: !!communityId,
});
- console.log('rawTopics => ', rawTopics);
const { mutateAsync: updateFeaturedTopicsOrder } =
useUpdateFeaturedTopicsOrderMutation();
diff --git a/packages/commonwealth/client/styles/modals/edit_topic_modal.scss b/packages/commonwealth/client/styles/modals/edit_topic_modal.scss
index 4f1b8c5d2a3..3906352004c 100644
--- a/packages/commonwealth/client/styles/modals/edit_topic_modal.scss
+++ b/packages/commonwealth/client/styles/modals/edit_topic_modal.scss
@@ -10,6 +10,12 @@
overflow: auto;
}
+ .char-error-row {
+ display: flex;
+ flex-direction: row;
+ justify-content: space-between;
+ }
+
.EditTopicModalFooter {
display: flex;
flex-direction: column;
@@ -23,12 +29,11 @@
margin-right: auto;
}
}
-
- .error-message {
- display: block;
- align-items: center;
- text-align: end;
- margin-top: 0;
- }
+ // .error-message {
+ // display: block;
+ // align-items: center;
+ // text-align: end;
+ // margin-top: 0;
+ // }
}
}
From 608e304c30a4955bee774e875cfef654e36f0633 Mon Sep 17 00:00:00 2001
From: israellund
Date: Wed, 20 Nov 2024 17:45:29 -0500
Subject: [PATCH 162/227] deleted commented code
---
.../commonwealth/client/styles/modals/edit_topic_modal.scss | 6 ------
1 file changed, 6 deletions(-)
diff --git a/packages/commonwealth/client/styles/modals/edit_topic_modal.scss b/packages/commonwealth/client/styles/modals/edit_topic_modal.scss
index 3906352004c..15072cf5432 100644
--- a/packages/commonwealth/client/styles/modals/edit_topic_modal.scss
+++ b/packages/commonwealth/client/styles/modals/edit_topic_modal.scss
@@ -29,11 +29,5 @@
margin-right: auto;
}
}
- // .error-message {
- // display: block;
- // align-items: center;
- // text-align: end;
- // margin-top: 0;
- // }
}
}
From c102b889e51e55b606a6f452d7b74b42f684a40d Mon Sep 17 00:00:00 2001
From: israellund
Date: Wed, 20 Nov 2024 17:57:00 -0500
Subject: [PATCH 163/227] added error-message back into css my bad
---
.../commonwealth/client/styles/modals/edit_topic_modal.scss | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/packages/commonwealth/client/styles/modals/edit_topic_modal.scss b/packages/commonwealth/client/styles/modals/edit_topic_modal.scss
index 15072cf5432..1eaee5b9140 100644
--- a/packages/commonwealth/client/styles/modals/edit_topic_modal.scss
+++ b/packages/commonwealth/client/styles/modals/edit_topic_modal.scss
@@ -29,5 +29,11 @@
margin-right: auto;
}
}
+ .error-message {
+ display: block;
+ align-items: center;
+ text-align: end;
+ margin-top: 0;
+ }
}
}
From 7212366e4c945c6356aa488eb6fd6b149521346f Mon Sep 17 00:00:00 2001
From: Ryan Bennett
Date: Wed, 20 Nov 2024 15:04:54 -0800
Subject: [PATCH 164/227] fix contest worker lifecycle test
---
.../PerformContestRollovers.command.ts | 4 +-
.../contest-worker-policy-lifecycle.spec.ts | 232 ++++++++++++++++++
.../contest-worker-policy.spec.ts | 179 --------------
3 files changed, 234 insertions(+), 181 deletions(-)
create mode 100644 libs/model/test/contest-worker/contest-worker-policy-lifecycle.spec.ts
delete mode 100644 libs/model/test/contest-worker/contest-worker-policy.spec.ts
diff --git a/libs/model/src/contest/PerformContestRollovers.command.ts b/libs/model/src/contest/PerformContestRollovers.command.ts
index 7bb66979ea3..59e0b8b51e0 100644
--- a/libs/model/src/contest/PerformContestRollovers.command.ts
+++ b/libs/model/src/contest/PerformContestRollovers.command.ts
@@ -40,7 +40,7 @@ export function PerformContestRollovers(): Command<
GROUP BY contest_address)) co
ON co.contest_address = cm.contest_address
AND (
- cm.interval = 0 AND cm.ended IS NOT TRUE
+ (cm.interval = 0 AND cm.ended IS NOT TRUE)
OR
cm.interval > 0
)
@@ -88,7 +88,7 @@ export function PerformContestRollovers(): Command<
);
// clean up neynar webhooks when farcaster contest ends
- if (interval === 0 && neynar_webhook_id) {
+ if (neynar_webhook_id) {
try {
const client = new NeynarAPIClient(
config.CONTESTS.NEYNAR_API_KEY!,
diff --git a/libs/model/test/contest-worker/contest-worker-policy-lifecycle.spec.ts b/libs/model/test/contest-worker/contest-worker-policy-lifecycle.spec.ts
new file mode 100644
index 00000000000..9b696676f27
--- /dev/null
+++ b/libs/model/test/contest-worker/contest-worker-policy-lifecycle.spec.ts
@@ -0,0 +1,232 @@
+import { expect } from 'chai';
+import Sinon from 'sinon';
+
+import { Actor, command, dispose, EventNames } from '@hicommonwealth/core';
+import { literal } from 'sequelize';
+import { afterAll, beforeAll, describe, test } from 'vitest';
+import { commonProtocol, Contest, emitEvent, models } from '../../src';
+import { Contests } from '../../src/contest';
+import { ContestWorker } from '../../src/policies';
+import { bootstrap_testing, seed } from '../../src/tester';
+import { drainOutbox } from '../utils/outbox-drain';
+
+describe('Contest Worker Policy Lifecycle', () => {
+ const addressId = 444;
+ const address = '0x0';
+ const communityId = 'ethhh';
+ const threadId = 888;
+ const threadTitle = 'Hello There';
+ const contestAddress = '0x1';
+ const contestId = 0;
+ const contentId = 1;
+ let topicId: number = 0;
+
+ beforeAll(async () => {
+ await bootstrap_testing(import.meta);
+
+ const [chainNode] = await seed('ChainNode', { contracts: [] });
+ const [user] = await seed(
+ 'User',
+ {
+ isAdmin: false,
+ selected_community_id: undefined,
+ },
+ //{ mock: true, log: true },
+ );
+ const [community] = await seed('Community', {
+ id: communityId,
+ chain_node_id: chainNode!.id,
+ lifetime_thread_count: 0,
+ profile_count: 1,
+ Addresses: [
+ {
+ id: addressId,
+ user_id: user!.id,
+ address,
+ role: 'member',
+ },
+ ],
+ topics: [
+ {
+ id: topicId,
+ name: 'hello',
+ community_id: communityId,
+ group_ids: [],
+ },
+ ],
+ contest_managers: [
+ {
+ contest_address: contestAddress,
+ cancelled: false,
+ ended: false,
+ is_farcaster_contest: false,
+ topic_id: topicId,
+ interval: 0,
+ contests: [
+ {
+ contest_address: contestAddress,
+ contest_id: contestId,
+ start_time: new Date(),
+ end_time: new Date(new Date().getTime() + 60 * 60 * 1000),
+ score: [],
+ },
+ ],
+ },
+ ],
+ });
+ expect(community!.contest_managers!.length).to.eq(1);
+ expect(community!.contest_managers![0].contests!.length).to.eq(1);
+ await seed('Thread', {
+ id: threadId,
+ community_id: communityId,
+ address_id: addressId,
+ topic_id: topicId,
+ deleted_at: undefined,
+ pinned: false,
+ read_only: false,
+ reaction_weights_sum: '0',
+ });
+ });
+
+ afterAll(async () => {
+ Sinon.restore();
+ await dispose()();
+ });
+
+ test('Handle ThreadCreated, ThreadUpvoted and Rollover', async () => {
+ const addContentStub = Sinon.stub(
+ commonProtocol.contestHelper,
+ 'addContentBatch',
+ ).resolves([]);
+
+ await emitEvent(models.Outbox, [
+ {
+ event_name: EventNames.ThreadCreated,
+ event_payload: {
+ id: threadId,
+ community_id: communityId,
+ address_id: addressId,
+ title: threadTitle,
+ created_by: address,
+ canvas_signed_data: '',
+ canvas_msg_id: '',
+ kind: '',
+ stage: '',
+ body: '',
+ view_count: 0,
+ reaction_count: 0,
+ reaction_weights_sum: '0',
+ comment_count: 0,
+ deleted_at: undefined,
+ pinned: false,
+ read_only: false,
+ topic_id: topicId,
+ contestManagers: [
+ {
+ contest_address: contestAddress,
+ },
+ ],
+ },
+ },
+ ]);
+
+ await drainOutbox(['ThreadCreated'], ContestWorker);
+
+ expect(addContentStub.called, 'addContent was not called').to.be.true;
+
+ const voteContentStub = Sinon.stub(
+ commonProtocol.contestHelper,
+ 'voteContentBatch',
+ ).resolves([]);
+
+ await emitEvent(models.Outbox, [
+ {
+ event_name: EventNames.ContestContentAdded,
+ event_payload: {
+ content_id: 0,
+ content_url: '/ethhh/discussion/888',
+ contest_address: contestAddress,
+ creator_address: address,
+ },
+ },
+ ]);
+
+ await drainOutbox(['ContestContentAdded'], Contests);
+
+ const contentProjection = await models.ContestAction.findOne({
+ where: {
+ action: 'added',
+ contest_address: contestAddress,
+ contest_id: contestId,
+ content_url: '/ethhh/discussion/888',
+ },
+ });
+
+ expect(contentProjection).to.exist;
+
+ await emitEvent(models.Outbox, [
+ {
+ event_name: EventNames.ThreadUpvoted,
+ event_payload: {
+ community_id: communityId,
+ address_id: addressId,
+ reaction: 'like',
+ thread_id: threadId,
+ topic_id: topicId,
+ contestManagers: [{ contest_address: contestAddress }],
+ },
+ },
+ ]);
+
+ await drainOutbox(['ThreadUpvoted'], ContestWorker);
+
+ expect(voteContentStub.called, 'voteContent was not called').to.be.true;
+
+ command(
+ Contest.PerformContestRollovers(),
+ {
+ actor: {} as Actor,
+ payload: { id: '' },
+ },
+ false,
+ );
+
+ const contestManagerBeforeContestEnded =
+ await models.ContestManager.findByPk(contestAddress);
+ expect(
+ contestManagerBeforeContestEnded!.ended,
+ 'contest should not be rolled over yet',
+ ).to.be.false;
+
+ // simulate contest has ended
+ await models.Contest.update(
+ {
+ start_time: literal(`NOW() - INTERVAL '10 seconds'`),
+ end_time: literal(`NOW() - INTERVAL '5 seconds'`),
+ },
+ {
+ where: {
+ contest_address: contestAddress,
+ contest_id: contestId,
+ },
+ },
+ );
+
+ await command(
+ Contest.PerformContestRollovers(),
+ {
+ actor: {} as Actor,
+ payload: { id: '' },
+ },
+ false,
+ );
+
+ const contestManagerAfterContestEnded =
+ await models.ContestManager.findByPk(contestAddress);
+
+ expect(
+ contestManagerAfterContestEnded!.ended,
+ 'contest should have rolled over',
+ ).to.be.true;
+ });
+});
diff --git a/libs/model/test/contest-worker/contest-worker-policy.spec.ts b/libs/model/test/contest-worker/contest-worker-policy.spec.ts
deleted file mode 100644
index b0a0f210601..00000000000
--- a/libs/model/test/contest-worker/contest-worker-policy.spec.ts
+++ /dev/null
@@ -1,179 +0,0 @@
-import { expect } from 'chai';
-import Sinon from 'sinon';
-
-import { dispose, handleEvent } from '@hicommonwealth/core';
-import { afterAll, beforeAll, describe, test } from 'vitest';
-import { commonProtocol, models } from '../../src';
-import { ContestWorker } from '../../src/policies';
-import { seed } from '../../src/tester';
-
-describe('Contest Worker Policy', () => {
- const addressId = 444;
- const address = '0x0';
- const communityId = 'ethhh';
- const threadId = 888;
- const threadTitle = 'Hello There';
- const contestAddress = '0x1';
- let topicId: number = 0;
-
- beforeAll(async () => {
- const [chainNode] = await seed('ChainNode', { contracts: [] });
- const [user] = await seed(
- 'User',
- {
- isAdmin: false,
- selected_community_id: undefined,
- },
- //{ mock: true, log: true },
- );
- const [community] = await seed('Community', {
- id: communityId,
- chain_node_id: chainNode!.id,
- lifetime_thread_count: 0,
- profile_count: 1,
- Addresses: [
- {
- id: addressId,
- user_id: user!.id,
- address,
- role: 'member',
- },
- ],
- contest_managers: [
- {
- contest_address: contestAddress,
- cancelled: false,
- topics: [
- {
- name: 'zzz',
- },
- ],
- },
- ],
- });
- topicId = community!.contest_managers![0].topics![0].id!;
- expect(topicId, 'seeded topic not assigned to contest manager').to.exist;
- await seed('Thread', {
- id: threadId,
- community_id: communityId,
- address_id: addressId,
- topic_id: topicId,
- deleted_at: undefined,
- pinned: false,
- read_only: false,
- });
- });
-
- afterAll(async () => {
- Sinon.restore();
- await dispose()();
- });
-
- // TODO: fix this test
- test.skip('Policy should handle ThreadCreated and ThreadUpvoted events', async () => {
- {
- const addContentStub = Sinon.stub(
- commonProtocol.contestHelper,
- 'addContentBatch',
- ).resolves([]);
-
- await handleEvent(
- ContestWorker(),
- {
- name: 'ThreadCreated',
- payload: {
- id: threadId,
- community_id: communityId,
- address_id: addressId,
- title: threadTitle,
- created_by: address,
- canvas_signed_data: '',
- canvas_msg_id: '',
- kind: '',
- stage: '',
- body: '',
- view_count: 0,
- reaction_count: 0,
- reaction_weights_sum: '0',
- comment_count: 0,
- deleted_at: undefined,
- pinned: false,
- read_only: false,
- topic_id: topicId,
- },
- },
- true,
- );
-
- expect(addContentStub.called, 'addContent was not called').to.be.true;
- const fnArgs = addContentStub.args[0];
- expect(fnArgs[1]).to.equal(
- contestAddress,
- 'addContent called with wrong contractAddress',
- );
- expect(fnArgs[2]).to.equal(
- [address],
- 'addContent called with wrong userAddress',
- );
- expect(fnArgs[3]).to.equal(
- '/ethhh/discussion/888',
- 'addContent called with wrong contentUrl',
- );
- }
-
- {
- const voteContentStub = Sinon.stub(
- commonProtocol.contestHelper,
- 'voteContentBatch',
- ).resolves([]);
-
- const contestId = 2;
- const contentId = 199;
-
- const contest = await models.Contest.create({
- contest_address: contestAddress,
- contest_id: contestId,
- start_time: new Date(),
- end_time: new Date(),
- score: [],
- });
-
- await models.ContestAction.create({
- contest_address: contestAddress,
- contest_id: contest.contest_id,
- content_id: contentId,
- actor_address: address,
- action: 'added',
- content_url: '/ethhh/discussion/888',
- thread_id: threadId,
- thread_title: threadTitle,
- voting_power: '10',
- created_at: new Date(),
- });
-
- await handleEvent(ContestWorker(), {
- name: 'ThreadUpvoted',
- payload: {
- community_id: communityId,
- address_id: addressId,
- reaction: 'like',
- thread_id: threadId,
- },
- });
-
- const fnArgs = voteContentStub.args[0];
- expect(fnArgs[1]).to.equal(
- contestAddress,
- 'voteContent called with wrong contractAddress',
- );
- expect(fnArgs[2]).to.equal(
- [address],
- 'voteContent called with wrong userAddress',
- );
- // expect(fnArgs[3]).to.equal(
- // contentId.toString(),
- // 'voteContent called with wrong contentId',
- // );
- }
- });
-});
From ca07c7e0f6e779310ca53faf35b4e3cabdb37aee Mon Sep 17 00:00:00 2001
From: Timothee Legros
Date: Thu, 21 Nov 2024 01:05:37 +0200
Subject: [PATCH 165/227] auth schemas/func + schema fixes + init
createPollVote.command.ts
---
libs/model/src/middleware/auth.ts | 57 +++++++++++++++++--
libs/model/src/models/poll.ts | 23 +-------
libs/model/src/models/vote.ts | 17 +-----
libs/model/src/poll/createPollVote.command.ts | 0
libs/schemas/src/commands/index.ts | 1 +
libs/schemas/src/commands/poll.schemas.ts | 2 +
libs/schemas/src/context.ts | 11 +++-
libs/schemas/src/entities/index.ts | 1 +
8 files changed, 73 insertions(+), 39 deletions(-)
create mode 100644 libs/model/src/poll/createPollVote.command.ts
diff --git a/libs/model/src/middleware/auth.ts b/libs/model/src/middleware/auth.ts
index 52335755815..ba96b4acb87 100644
--- a/libs/model/src/middleware/auth.ts
+++ b/libs/model/src/middleware/auth.ts
@@ -3,6 +3,7 @@ import {
Context,
InvalidActor,
InvalidInput,
+ InvalidState,
} from '@hicommonwealth/core';
import {
Address,
@@ -12,6 +13,8 @@ import {
CommentContextInput,
Group,
GroupPermissionAction,
+ PollContext,
+ PollContextInput,
ReactionContext,
ReactionContextInput,
ThreadContext,
@@ -81,7 +84,7 @@ async function findThread(
thread,
author_address_id: thread.address_id,
community_id: thread.community_id,
- topic_id: thread.topic_id ?? undefined,
+ topic_id: thread.topic_id,
is_collaborator,
};
}
@@ -117,6 +120,17 @@ async function findReaction(
};
}
+async function findPoll(actor: Actor, poll_id: number) {
+ const poll = await models.Poll.findOne({
+ where: { id: poll_id },
+ });
+ if (!poll) {
+ throw new InvalidInput('Must provide a valid poll id to authorize');
+ }
+
+ return poll;
+}
+
async function findAddress(
actor: Actor,
community_id: string,
@@ -206,9 +220,11 @@ async function hasTopicPermissions(
}
>(
`
- SELECT g.*, gp.topic_id, gp.allowed_actions
- FROM "Groups" as g JOIN "GroupPermissions" gp ON g.id = gp.group_id
- WHERE g.community_id = :community_id AND gp.topic_id = :topic_id
+ SELECT g.*, gp.topic_id, gp.allowed_actions
+ FROM "Groups" as g
+ JOIN "GroupPermissions" gp ON g.id = gp.group_id
+ WHERE g.community_id = :community_id
+ AND gp.topic_id = :topic_id
`,
{
type: QueryTypes.SELECT,
@@ -499,3 +515,36 @@ export function authReaction() {
await mustBeAuthorized(ctx, { author: true });
};
}
+
+export function authPoll({ action }: AggregateAuthOptions) {
+ return async (ctx: Context) => {
+ const poll = await findPoll(ctx.actor, ctx.payload.poll_id);
+ const threadAuth = await findThread(ctx.actor, poll.thread_id, false);
+ const { address, is_author } = await findAddress(
+ ctx.actor,
+ threadAuth.community_id,
+ ['admin', 'moderator', 'member'],
+ );
+
+ if (threadAuth.thread.archived_at)
+ throw new InvalidState('Thread is archived');
+ (ctx as { context: PollContext }).context = {
+ address,
+ is_author,
+ poll,
+ poll_id: poll.id!,
+ community_id: threadAuth.community_id,
+ thread: threadAuth.thread,
+ };
+
+ await mustBeAuthorized(ctx, {
+ author: true,
+ permissions: action
+ ? {
+ topic_id: threadAuth.topic_id,
+ action: 'UPDATE_POLL',
+ }
+ : undefined,
+ });
+ };
+}
diff --git a/libs/model/src/models/poll.ts b/libs/model/src/models/poll.ts
index a5aa3586dcb..7b07e2f1ebc 100644
--- a/libs/model/src/models/poll.ts
+++ b/libs/model/src/models/poll.ts
@@ -1,26 +1,9 @@
+import { Poll } from '@hicommonwealth/schemas';
import Sequelize from 'sequelize';
-import type { CommunityAttributes } from './community';
-import type { ThreadAttributes } from './thread';
+import { z } from 'zod';
import type { ModelInstance } from './types';
-import type { VoteAttributes } from './vote';
-export type PollAttributes = {
- id: number;
- community_id: string;
- thread_id: number;
- prompt: string;
- options: string;
- ends_at: Date;
-
- created_at?: Date;
- updated_at?: Date;
- last_commented_on?: Date;
-
- // associations
- Thread?: ThreadAttributes;
- Community?: CommunityAttributes;
- votes?: VoteAttributes[];
-};
+export type PollAttributes = z.infer;
export type PollInstance = ModelInstance;
diff --git a/libs/model/src/models/vote.ts b/libs/model/src/models/vote.ts
index ab3d58e0a3d..02e2926bfcc 100644
--- a/libs/model/src/models/vote.ts
+++ b/libs/model/src/models/vote.ts
@@ -1,20 +1,9 @@
+import { Vote } from '@hicommonwealth/schemas';
import Sequelize from 'sequelize';
-import type { PollAttributes } from './poll';
+import { z } from 'zod';
import type { ModelInstance } from './types';
-export type VoteAttributes = {
- poll_id: number;
- option: string;
- address: string;
- author_community_id: string;
- community_id: string;
- id?: number;
- created_at?: Date;
- updated_at?: Date;
-
- // associations
- poll?: PollAttributes;
-};
+export type VoteAttributes = z.infer;
export type VoteInstance = ModelInstance;
diff --git a/libs/model/src/poll/createPollVote.command.ts b/libs/model/src/poll/createPollVote.command.ts
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/libs/schemas/src/commands/index.ts b/libs/schemas/src/commands/index.ts
index a5388556672..72d235b79a9 100644
--- a/libs/schemas/src/commands/index.ts
+++ b/libs/schemas/src/commands/index.ts
@@ -6,6 +6,7 @@ export * from './community.schemas';
export * from './contest.schemas';
export * from './discord.schemas';
export * from './load-testing.schemas';
+export * from './poll.schemas';
export * from './quest.schemas';
export * from './snapshot.schemas';
export * from './subscription.schemas';
diff --git a/libs/schemas/src/commands/poll.schemas.ts b/libs/schemas/src/commands/poll.schemas.ts
index 1a4f84ff501..074883474cf 100644
--- a/libs/schemas/src/commands/poll.schemas.ts
+++ b/libs/schemas/src/commands/poll.schemas.ts
@@ -1,3 +1,4 @@
+import { PollContext } from '@hicommonwealth/schemas';
import { z } from 'zod';
import { Vote } from '../entities/poll.schemas';
import { PG_INT } from '../utils';
@@ -9,4 +10,5 @@ export const CreatePollVote = {
option: z.string(),
}),
output: Vote,
+ context: PollContext,
};
diff --git a/libs/schemas/src/context.ts b/libs/schemas/src/context.ts
index a4975ba9ca2..ff7784bdf6e 100644
--- a/libs/schemas/src/context.ts
+++ b/libs/schemas/src/context.ts
@@ -1,5 +1,5 @@
import { z } from 'zod';
-import { Address, Comment, Reaction, Thread, Topic } from './entities';
+import { Address, Comment, Poll, Reaction, Thread, Topic } from './entities';
// Input schemas for authorization context
export const AuthContextInput = z.object({ community_id: z.string() });
@@ -10,6 +10,7 @@ export const ReactionContextInput = z.object({
community_id: z.string(),
reaction_id: z.number(),
});
+export const PollContextInput = z.object({ poll_id: z.number() });
/**
* Base authorization context
@@ -77,3 +78,11 @@ export const ReactionContext = z.object({
reaction: Reaction,
});
export type ReactionContext = z.infer;
+
+export const PollContext = z.object({
+ ...AuthContext.shape,
+ ...PollContextInput.shape,
+ poll: Poll,
+ thread: Thread,
+});
+export type PollContext = z.infer;
diff --git a/libs/schemas/src/entities/index.ts b/libs/schemas/src/entities/index.ts
index 51cbc60f2b6..ba186a09bb5 100644
--- a/libs/schemas/src/entities/index.ts
+++ b/libs/schemas/src/entities/index.ts
@@ -7,6 +7,7 @@ export * from './group-permission.schemas';
export * from './group.schemas';
export * from './launchpad.schemas';
export * from './notification.schemas';
+export * from './poll.schemas';
export * from './quest.schemas';
export * from './reaction.schemas';
export * from './referral.schemas';
From b82122b28ed764251d9f5b82e0970ca64b2ad885 Mon Sep 17 00:00:00 2001
From: Ryan Bennett
Date: Wed, 20 Nov 2024 15:39:28 -0800
Subject: [PATCH 166/227] add contest check command
---
.../src/contest/CheckContests.command.ts | 70 +++++++++++++++++++
.../contest/GetActiveContestManagers.query.ts | 13 ++--
libs/schemas/src/commands/contest.schemas.ts | 5 ++
libs/schemas/src/queries/contests.schemas.ts | 5 +-
4 files changed, 87 insertions(+), 6 deletions(-)
create mode 100644 libs/model/src/contest/CheckContests.command.ts
diff --git a/libs/model/src/contest/CheckContests.command.ts b/libs/model/src/contest/CheckContests.command.ts
new file mode 100644
index 00000000000..48298603f33
--- /dev/null
+++ b/libs/model/src/contest/CheckContests.command.ts
@@ -0,0 +1,70 @@
+import { Actor, logger, query, type Command } from '@hicommonwealth/core';
+import * as schemas from '@hicommonwealth/schemas';
+import Web3 from 'web3';
+import { config } from '../config';
+import { createOnchainContestVote } from '../policies/contest-utils';
+import { GetActiveContestManagers } from './GetActiveContestManagers.query';
+
+const log = logger(import.meta);
+
+const getPrivateWalletAddress = () => {
+ const web3 = new Web3();
+ const privateKey = config.WEB3.PRIVATE_KEY;
+ const account = web3.eth.accounts.privateKeyToAccount(privateKey);
+ const publicAddress = account.address;
+ return publicAddress;
+};
+
+export function CheckContests(): Command {
+ return {
+ ...schemas.CheckContests,
+ auth: [],
+ body: async () => {
+ const activeContestManagers = await query(GetActiveContestManagers(), {
+ actor: {} as Actor,
+ payload: {},
+ });
+ // find active contests that have content with no upvotes and will end in one hour
+ const contestsWithoutVote = activeContestManagers!.filter(
+ (contestManager) =>
+ contestManager.actions.some((action) => action.action === 'added') &&
+ !contestManager.actions.some(
+ (action) => action.action === 'upvoted',
+ ) &&
+ Date.now() - contestManager.end_time.getTime() < 1000 * 60 * 60,
+ );
+
+ const promises = contestsWithoutVote.map(async (contestManager) => {
+ // add onchain vote to the first content
+ const firstContent = contestManager.actions.find(
+ (action) => action.action === 'added',
+ );
+
+ await createOnchainContestVote({
+ contestManagers: [
+ {
+ url: contestManager.url,
+ contest_address: contestManager.contest_address,
+ content_id: firstContent!.content_id,
+ },
+ ],
+ content_url: firstContent!.content_url!,
+ author_address: getPrivateWalletAddress(),
+ });
+ });
+
+ const promiseResults = await Promise.allSettled(promises);
+
+ const errors = promiseResults
+ .filter(({ status }) => status === 'rejected')
+ .map(
+ (result) =>
+ (result as PromiseRejectedResult).reason || '',
+ );
+
+ if (errors.length > 0) {
+ log.warn(`CheckContests: failed with errors: ${errors.join(', ')}"`);
+ }
+ },
+ };
+}
diff --git a/libs/model/src/contest/GetActiveContestManagers.query.ts b/libs/model/src/contest/GetActiveContestManagers.query.ts
index a2d6e9e3b42..6cf838f1091 100644
--- a/libs/model/src/contest/GetActiveContestManagers.query.ts
+++ b/libs/model/src/contest/GetActiveContestManagers.query.ts
@@ -20,6 +20,7 @@ export function GetActiveContestManagers(): Query<
url: string;
private_url: string;
contest_address: string;
+ end_time: string;
max_contest_id: number;
actions: Array>;
}>(
@@ -29,6 +30,7 @@ export function GetActiveContestManagers(): Query<
cn.url,
cm.contest_address,
co.max_contest_id,
+ co.end_time,
COALESCE(JSON_AGG(ca) FILTER (WHERE ca IS NOT NULL), '[]'::json) as actions
FROM "Communities" c
JOIN "ChainNodes" cn ON c.chain_node_id = cn.id
@@ -44,9 +46,11 @@ export function GetActiveContestManagers(): Query<
ca.created_at > co.start_time AND
ca.created_at < co.end_time
)
- WHERE cm.topic_id = :topic_id
- AND cm.community_id = :community_id
- AND cm.cancelled IS NOT TRUE
+ WHERE
+ cm.cancelled IS NOT TRUE
+ AND cm.ended IS NOT TRUE
+ ${payload.topic_id ? 'AND cm.topic_id = :topic_id' : ''}
+ ${payload.community_id ? 'AND cm.community_id = :community_id' : ''}
AND (
cm.interval = 0 AND NOW() < co.end_time
OR
@@ -57,7 +61,7 @@ export function GetActiveContestManagers(): Query<
{
type: QueryTypes.SELECT,
replacements: {
- topic_id: payload.topic_id!,
+ topic_id: payload.topic_id,
community_id: payload.community_id,
},
},
@@ -67,6 +71,7 @@ export function GetActiveContestManagers(): Query<
eth_chain_id: r.eth_chain_id,
url: getChainNodeUrl(r),
contest_address: r.contest_address,
+ end_time: new Date(r.end_time),
max_contest_id: r.max_contest_id,
actions: r.actions,
}));
diff --git a/libs/schemas/src/commands/contest.schemas.ts b/libs/schemas/src/commands/contest.schemas.ts
index 2f25a9b7596..1fc3ef4462f 100644
--- a/libs/schemas/src/commands/contest.schemas.ts
+++ b/libs/schemas/src/commands/contest.schemas.ts
@@ -83,6 +83,11 @@ export const PerformContestRollovers = {
output: z.object({}),
};
+export const CheckContests = {
+ input: z.object({ id: z.string() }),
+ output: z.object({}),
+};
+
export const FarcasterCast = z.object({
object: z.string(),
hash: z.string(),
diff --git a/libs/schemas/src/queries/contests.schemas.ts b/libs/schemas/src/queries/contests.schemas.ts
index 49ab365057f..d53d89a73ec 100644
--- a/libs/schemas/src/queries/contests.schemas.ts
+++ b/libs/schemas/src/queries/contests.schemas.ts
@@ -40,8 +40,8 @@ export const GetContest = {
export const GetActiveContestManagers = {
input: z.object({
- community_id: z.string(),
- topic_id: z.number(),
+ community_id: z.string().optional(),
+ topic_id: z.number().optional(),
}),
output: z.array(
z.object({
@@ -49,6 +49,7 @@ export const GetActiveContestManagers = {
url: z.string(),
contest_address: z.string(),
max_contest_id: z.number(),
+ end_time: z.coerce.date(),
actions: z.array(ContestAction),
}),
),
From e184cb85eaec9774e90ee2d317d2447d3acce300 Mon Sep 17 00:00:00 2001
From: Timothee Legros
Date: Thu, 21 Nov 2024 01:39:44 +0200
Subject: [PATCH 167/227] complete CreatePollVote.command + add to internal
router
---
libs/adapters/src/trpc/middleware.ts | 1 +
libs/model/src/index.ts | 1 +
libs/model/src/middleware/auth.ts | 2 +-
libs/model/src/middleware/guards.ts | 13 +++++-
libs/model/src/poll/createPollVote.command.ts | 45 +++++++++++++++++++
libs/model/src/poll/index.ts | 1 +
libs/schemas/src/commands/poll.schemas.ts | 2 +-
.../server/api/internal-router.ts | 2 +
packages/commonwealth/server/api/poll.ts | 10 +++++
9 files changed, 74 insertions(+), 3 deletions(-)
create mode 100644 libs/model/src/poll/index.ts
create mode 100644 packages/commonwealth/server/api/poll.ts
diff --git a/libs/adapters/src/trpc/middleware.ts b/libs/adapters/src/trpc/middleware.ts
index 259fc7cdc34..86362c8f479 100644
--- a/libs/adapters/src/trpc/middleware.ts
+++ b/libs/adapters/src/trpc/middleware.ts
@@ -51,6 +51,7 @@ export enum Tag {
DiscordBot = 'DiscordBot',
Token = 'Token',
Contest = 'Contest',
+ Poll = 'Poll',
}
export type Commit = (
diff --git a/libs/model/src/index.ts b/libs/model/src/index.ts
index 6183e4cdcaa..77f5100d405 100644
--- a/libs/model/src/index.ts
+++ b/libs/model/src/index.ts
@@ -7,6 +7,7 @@ export * as DiscordBot from './discordBot';
export * as Email from './emails';
export * as Feed from './feed';
export * as LoadTest from './load-testing';
+export * as Poll from './poll';
export * as Reaction from './reaction';
export * as Snapshot from './snapshot';
export * as Subscription from './subscription';
diff --git a/libs/model/src/middleware/auth.ts b/libs/model/src/middleware/auth.ts
index ba96b4acb87..06ea7c8056f 100644
--- a/libs/model/src/middleware/auth.ts
+++ b/libs/model/src/middleware/auth.ts
@@ -542,7 +542,7 @@ export function authPoll({ action }: AggregateAuthOptions) {
permissions: action
? {
topic_id: threadAuth.topic_id,
- action: 'UPDATE_POLL',
+ action,
}
: undefined,
});
diff --git a/libs/model/src/middleware/guards.ts b/libs/model/src/middleware/guards.ts
index 6f250ac8777..56b82b8761f 100644
--- a/libs/model/src/middleware/guards.ts
+++ b/libs/model/src/middleware/guards.ts
@@ -7,10 +7,11 @@ import {
import {
AuthContext,
CommentContext,
+ PollContext,
ThreadContext,
} from '@hicommonwealth/schemas';
import moment from 'moment';
-import type { AddressInstance, ThreadInstance } from '../models';
+import type { AddressInstance, PollInstance, ThreadInstance } from '../models';
const log = logger(import.meta);
@@ -116,6 +117,16 @@ export function mustBeAuthorizedComment(
};
}
+export function mustBeAuthorizedPoll(actor: Actor, context?: PollContext) {
+ if (!context?.address) throw new InvalidActor(actor, 'Not authorized');
+ if (!context?.poll) throw new InvalidActor(actor, 'Not authorized poll');
+ return context as PollContext & {
+ address: AddressInstance;
+ poll: PollInstance;
+ thread: ThreadInstance;
+ };
+}
+
/**
* Guards for starting and ending dates to be in a valid date range
* @param start_date start date
diff --git a/libs/model/src/poll/createPollVote.command.ts b/libs/model/src/poll/createPollVote.command.ts
index e69de29bb2d..e43da0550e2 100644
--- a/libs/model/src/poll/createPollVote.command.ts
+++ b/libs/model/src/poll/createPollVote.command.ts
@@ -0,0 +1,45 @@
+import { Command, InvalidState } from '@hicommonwealth/core';
+import * as schemas from '@hicommonwealth/schemas';
+import moment from 'moment/moment';
+import { models } from '../database';
+import { authPoll } from '../middleware';
+import { mustBeAuthorizedPoll } from '../middleware/guards';
+
+export const CreateVotePollErrors = {
+ InvalidOption: 'Invalid response option',
+ PollingClosed: 'Polling already finished',
+};
+
+export function CreatePollVote(): Command {
+ return {
+ ...schemas.CreatePollVote,
+ auth: [
+ authPoll({
+ action: 'UPDATE_POLL',
+ }),
+ ],
+ body: async ({ actor, payload, context }) => {
+ const { poll, address } = mustBeAuthorizedPoll(actor, context);
+ if (
+ !poll.ends_at &&
+ moment(poll.ends_at).utc().isBefore(moment().utc())
+ ) {
+ throw new InvalidState(CreateVotePollErrors.PollingClosed);
+ }
+
+ // TODO: migrate this to be JSONB array of strings in the DB
+ let options = JSON.parse(poll.options);
+ if (!options.includes(payload.option)) {
+ throw new InvalidState(CreateVotePollErrors.InvalidOption);
+ }
+
+ return models.Vote.create({
+ poll_id: payload.poll_id,
+ address: address.address,
+ author_community_id: address.community_id,
+ community_id: poll.community_id,
+ option: payload.option,
+ });
+ },
+ };
+}
diff --git a/libs/model/src/poll/index.ts b/libs/model/src/poll/index.ts
new file mode 100644
index 00000000000..e951132e97b
--- /dev/null
+++ b/libs/model/src/poll/index.ts
@@ -0,0 +1 @@
+export * from './createPollVote.command';
diff --git a/libs/schemas/src/commands/poll.schemas.ts b/libs/schemas/src/commands/poll.schemas.ts
index 074883474cf..9b7693bd2e1 100644
--- a/libs/schemas/src/commands/poll.schemas.ts
+++ b/libs/schemas/src/commands/poll.schemas.ts
@@ -6,7 +6,7 @@ import { PG_INT } from '../utils';
export const CreatePollVote = {
input: z.object({
thread_id: PG_INT,
- pollId: z.number(),
+ poll_id: z.number(),
option: z.string(),
}),
output: Vote,
diff --git a/packages/commonwealth/server/api/internal-router.ts b/packages/commonwealth/server/api/internal-router.ts
index a923252487c..b901477c594 100644
--- a/packages/commonwealth/server/api/internal-router.ts
+++ b/packages/commonwealth/server/api/internal-router.ts
@@ -10,6 +10,7 @@ import * as email from './emails';
import * as feed from './feed';
import * as integrations from './integrations';
import * as loadTest from './load-test';
+import * as poll from './poll';
import * as subscription from './subscription';
import * as superAdmin from './super-admin';
import * as thread from './thread';
@@ -32,6 +33,7 @@ const api = {
superAdmin: superAdmin.trpcRouter,
discordBot: discordBot.trpcRouter,
token: token.trpcRouter,
+ poll: poll.trpcRouter,
};
if (config.NOTIFICATIONS.FLAG_KNOCK_INTEGRATION_ENABLED) {
diff --git a/packages/commonwealth/server/api/poll.ts b/packages/commonwealth/server/api/poll.ts
new file mode 100644
index 00000000000..2235fe61b49
--- /dev/null
+++ b/packages/commonwealth/server/api/poll.ts
@@ -0,0 +1,10 @@
+import { trpc } from '@hicommonwealth/adapters';
+import { Poll } from '@hicommonwealth/model';
+import { MixpanelCommunityInteractionEvent } from '../../shared/analytics/types';
+
+export const trpcRouter = trpc.router({
+ createPollVote: trpc.command(Poll.CreatePollVote, trpc.Tag.Poll, [
+ MixpanelCommunityInteractionEvent.SUBMIT_VOTE,
+ ({ community_id }) => ({ community_id }),
+ ]),
+});
From 92b36cdee955b432e79ba81e0b0744e7160feb0c Mon Sep 17 00:00:00 2001
From: israellund
Date: Thu, 21 Nov 2024 08:26:41 -0500
Subject: [PATCH 168/227] made requested changes in edit topic modal and
CreateTopicSection
---
.../client/scripts/views/modals/edit_topic_modal.tsx | 7 +++----
.../CreateTopicsSection/CreateTopicSection.tsx | 7 +++----
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/packages/commonwealth/client/scripts/views/modals/edit_topic_modal.tsx b/packages/commonwealth/client/scripts/views/modals/edit_topic_modal.tsx
index 91f7cd8135c..82f19991a0e 100644
--- a/packages/commonwealth/client/scripts/views/modals/edit_topic_modal.tsx
+++ b/packages/commonwealth/client/scripts/views/modals/edit_topic_modal.tsx
@@ -1,5 +1,5 @@
import { pluralizeWithoutNumberPrefix } from 'helpers';
-import React, { useEffect, useMemo, useState } from 'react';
+import React, { useEffect, useState } from 'react';
import type { Topic } from '../../models/Topic';
import { useCommonNavigate } from '../../navigation/helpers';
import app from '../../state';
@@ -77,7 +77,7 @@ export const EditTopicModal = ({
setCharacterCount(count);
}, [description]);
- useMemo(() => {
+ useEffect(() => {
if ((description?.ops || [])?.[0]?.insert?.length > 250) {
setDescErrorMsg('Description must be 250 characters or less');
} else {
@@ -207,8 +207,7 @@ export const EditTopicModal = ({
Character count: {characterCount}/250
- statusMessage={descErrorMsg}
+ statusMessage={descErrorMsg || ''}
hasFeedback={!!descErrorMsg}
validationStatus={descErrorMsg ? 'failure' : undefined}
/>
diff --git a/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Topics/TopicDetails/CreateTopicsSection/CreateTopicSection.tsx b/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Topics/TopicDetails/CreateTopicsSection/CreateTopicSection.tsx
index 75c6b111f4e..c0f8b390dd7 100644
--- a/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Topics/TopicDetails/CreateTopicsSection/CreateTopicSection.tsx
+++ b/packages/commonwealth/client/scripts/views/pages/CommunityManagement/Topics/TopicDetails/CreateTopicsSection/CreateTopicSection.tsx
@@ -1,6 +1,6 @@
import useBrowserWindow from 'hooks/useBrowserWindow';
import { DeltaStatic } from 'quill';
-import React, { useEffect, useMemo, useState } from 'react';
+import React, { useEffect, useState } from 'react';
import app from 'state';
import { useFetchTopicsQuery } from 'state/api/topics';
import { CWCheckbox } from 'views/components/component_kit/cw_checkbox';
@@ -85,7 +85,7 @@ export const CreateTopicSection = ({
return ['success', 'Valid topic name'];
};
- useMemo(() => {
+ useEffect(() => {
if ((descriptionDelta?.ops || [])?.[0]?.insert?.length > 250) {
setDescErrorMsg('Description must be 250 characters or less');
} else {
@@ -160,8 +160,7 @@ export const CreateTopicSection = ({
- statusMessage={descErrorMsg}
+ statusMessage={descErrorMsg || ''}
hasFeedback={!!descErrorMsg}
validationStatus={descErrorMsg ? 'failure' : undefined}
/>
From 41746678826b618d93dc3fd492396b05f4d273b7 Mon Sep 17 00:00:00 2001
From: Malik Zulqurnain
Date: Thu, 21 Nov 2024 18:42:38 +0500
Subject: [PATCH 169/227] Added fractional value display
---
.../client/scripts/helpers/launchpad.ts | 2 +-
.../FractionalValue/FractionalValue.scss | 12 ++++
.../FractionalValue/FractionalValue.tsx | 38 ++++++++++++
.../components/FractionalValue/helpers.tsx | 60 +++++++++++++++++++
.../views/components/FractionalValue/index.ts | 3 +
.../views/components/TokenCard/TokenCard.tsx | 10 +++-
.../components/component_kit/cw_text.tsx | 2 +-
7 files changed, 123 insertions(+), 4 deletions(-)
create mode 100644 packages/commonwealth/client/scripts/views/components/FractionalValue/FractionalValue.scss
create mode 100644 packages/commonwealth/client/scripts/views/components/FractionalValue/FractionalValue.tsx
create mode 100644 packages/commonwealth/client/scripts/views/components/FractionalValue/helpers.tsx
create mode 100644 packages/commonwealth/client/scripts/views/components/FractionalValue/index.ts
diff --git a/packages/commonwealth/client/scripts/helpers/launchpad.ts b/packages/commonwealth/client/scripts/helpers/launchpad.ts
index 78d9edecff3..394b832e726 100644
--- a/packages/commonwealth/client/scripts/helpers/launchpad.ts
+++ b/packages/commonwealth/client/scripts/helpers/launchpad.ts
@@ -21,7 +21,7 @@ export const calculateTokenPricing = (
const isMarketCapGoalReached = false; // TODO: https://github.com/hicommonwealth/commonwealth/issues/9887
return {
- currentPrice: `${currentPrice.toFixed(8)}`,
+ currentPrice: parseFloat(`${currentPrice.toFixed(8)}`),
pricePercentage24HourChange,
marketCapCurrent,
marketCapGoal,
diff --git a/packages/commonwealth/client/scripts/views/components/FractionalValue/FractionalValue.scss b/packages/commonwealth/client/scripts/views/components/FractionalValue/FractionalValue.scss
new file mode 100644
index 00000000000..6d3d1ac2a35
--- /dev/null
+++ b/packages/commonwealth/client/scripts/views/components/FractionalValue/FractionalValue.scss
@@ -0,0 +1,12 @@
+@import '../../../../styles/shared';
+
+.FractionalValue {
+ height: fit-content;
+
+ sub {
+ all: unset;
+ font-size: 75%;
+ vertical-align: baseline;
+ margin-top: 5%;
+ }
+}
diff --git a/packages/commonwealth/client/scripts/views/components/FractionalValue/FractionalValue.tsx b/packages/commonwealth/client/scripts/views/components/FractionalValue/FractionalValue.tsx
new file mode 100644
index 00000000000..e51571ea60d
--- /dev/null
+++ b/packages/commonwealth/client/scripts/views/components/FractionalValue/FractionalValue.tsx
@@ -0,0 +1,38 @@
+import clsx from 'clsx';
+import React from 'react';
+import { CWText, TextStyleProps } from '../component_kit/cw_text';
+import './FractionalValue.scss';
+import { formatFractionalValue } from './helpers';
+
+type FractionalValueProps = {
+ value: number;
+} & TextStyleProps;
+
+const FractionalValue = ({
+ value,
+ className,
+ ...rest
+}: FractionalValueProps) => {
+ const formattedValue = formatFractionalValue(value);
+ console.log('x => ', {
+ original: value,
+ formatted: formattedValue,
+ });
+
+ return (
+
+ {typeof formattedValue === 'string' ||
+ typeof formattedValue === 'number' ? (
+ formattedValue
+ ) : (
+ <>
+ 0.0
+ {formattedValue.decimal0Count - 1}
+ {formattedValue.valueAfterDecimal0s}
+ >
+ )}
+
+ );
+};
+
+export default FractionalValue;
diff --git a/packages/commonwealth/client/scripts/views/components/FractionalValue/helpers.tsx b/packages/commonwealth/client/scripts/views/components/FractionalValue/helpers.tsx
new file mode 100644
index 00000000000..77dba2a28b6
--- /dev/null
+++ b/packages/commonwealth/client/scripts/views/components/FractionalValue/helpers.tsx
@@ -0,0 +1,60 @@
+function isInScientificNotation(value: number) {
+ return value.toString().toLowerCase().includes('e');
+}
+
+function getExponent(value: number) {
+ // return the exponent part from a scientific notation value ex: return 7 from 8e-7
+ const scientificNotation = value.toExponential();
+ const parts = scientificNotation.split('e-');
+ return parseInt(parts[1]);
+}
+
+export function formatFractionalValue(value: number) {
+ const displayZerosAfterDecimal = 2;
+
+ // if the number is in scientific notation, calculate fractional subscript value
+ if (isInScientificNotation(value)) {
+ const exponent = Math.abs(getExponent(value));
+ const valueBeforeExponent = value.toString().split('e-')[0];
+ return {
+ valueAfterDecimal0s: parseInt(valueBeforeExponent),
+ decimal0Count: exponent,
+ };
+ }
+
+ // if the number is a decimal less than 1, calculate fractional subscript value
+ if (value.toString().includes('.') && value < 1) {
+ const valueWith7Decimals = parseFloat(value.toFixed(7));
+
+ const decimalPart = valueWith7Decimals.toString()?.split('.')?.[1];
+
+ // find concurrent non-0 digits after decimal
+ const decimal0Count = decimalPart.search(/[^0]/);
+
+ // if there are no decimal 0's after the decimal point then display number
+ // with 2 decimal places ex: 0.111111 would become 0.11
+ if (decimal0Count === 0) {
+ return value.toFixed(2);
+ }
+
+ // display the original value if these decimal 0 count values are allowed
+ // ex: 0.00111 would become 0.001
+ if (displayZerosAfterDecimal === decimal0Count) {
+ return valueWith7Decimals.toFixed(3);
+ }
+
+ // get the digits after the leading zeros (get max 3 digits)
+ const valueAfterDecimal0s = decimalPart.slice(
+ decimal0Count,
+ decimal0Count + 4,
+ );
+
+ return {
+ valueAfterDecimal0s: parseInt(valueAfterDecimal0s), // avoid leading zeros by converting to int
+ decimal0Count: decimal0Count,
+ };
+ }
+
+ // get 2 decimal places for values >= 1
+ return value.toFixed(2);
+}
diff --git a/packages/commonwealth/client/scripts/views/components/FractionalValue/index.ts b/packages/commonwealth/client/scripts/views/components/FractionalValue/index.ts
new file mode 100644
index 00000000000..4e9231a2d9c
--- /dev/null
+++ b/packages/commonwealth/client/scripts/views/components/FractionalValue/index.ts
@@ -0,0 +1,3 @@
+import FractionalValue from './FractionalValue';
+
+export default FractionalValue;
diff --git a/packages/commonwealth/client/scripts/views/components/TokenCard/TokenCard.tsx b/packages/commonwealth/client/scripts/views/components/TokenCard/TokenCard.tsx
index aca643e0f1b..5bcea28d1e9 100644
--- a/packages/commonwealth/client/scripts/views/components/TokenCard/TokenCard.tsx
+++ b/packages/commonwealth/client/scripts/views/components/TokenCard/TokenCard.tsx
@@ -4,6 +4,7 @@ import React, { ReactNode } from 'react';
import { CWText } from '../component_kit/cw_text';
import { CWButton } from '../component_kit/new_designs/CWButton';
import { CWTooltip } from '../component_kit/new_designs/CWTooltip';
+import FractionalValue from '../FractionalValue';
import MarketCapProgress from './MarketCapProgress';
import PricePercentageChange from './PricePercentageChange';
import './TokenCard.scss';
@@ -14,7 +15,7 @@ interface TokenCardProps {
iconURL: string;
currency?: SupportedCurrencies;
marketCap: { current: number; goal: number };
- price: string;
+ price: number;
pricePercentage24HourChange: number;
mode: 'buy' | 'swap';
className?: string;
@@ -101,7 +102,12 @@ const TokenCard = ({
{currencySymbol}
- {price}
+
Date: Thu, 21 Nov 2024 18:48:25 +0500
Subject: [PATCH 170/227] Display full fractional value inside tooltip
---
.../FractionalValue/FractionalValue.tsx | 26 ++++++++++++-------
.../TokenTradeWidget/TokenTradeWidget.tsx | 7 ++++-
2 files changed, 23 insertions(+), 10 deletions(-)
diff --git a/packages/commonwealth/client/scripts/views/components/FractionalValue/FractionalValue.tsx b/packages/commonwealth/client/scripts/views/components/FractionalValue/FractionalValue.tsx
index e51571ea60d..76da1e5dc3d 100644
--- a/packages/commonwealth/client/scripts/views/components/FractionalValue/FractionalValue.tsx
+++ b/packages/commonwealth/client/scripts/views/components/FractionalValue/FractionalValue.tsx
@@ -1,6 +1,7 @@
import clsx from 'clsx';
import React from 'react';
import { CWText, TextStyleProps } from '../component_kit/cw_text';
+import { CWTooltip } from '../component_kit/new_designs/CWTooltip';
import './FractionalValue.scss';
import { formatFractionalValue } from './helpers';
@@ -14,10 +15,6 @@ const FractionalValue = ({
...rest
}: FractionalValueProps) => {
const formattedValue = formatFractionalValue(value);
- console.log('x => ', {
- original: value,
- formatted: formattedValue,
- });
return (
@@ -25,11 +22,22 @@ const FractionalValue = ({
typeof formattedValue === 'number' ? (
formattedValue
) : (
- <>
- 0.0
- {formattedValue.decimal0Count - 1}
- {formattedValue.valueAfterDecimal0s}
- >
+ `0`)
+ .join('')}${formattedValue.valueAfterDecimal0s}`}
+ renderTrigger={(handleInteraction) => (
+
+ 0.0
+ {formattedValue.decimal0Count - 1}
+ {formattedValue.valueAfterDecimal0s}
+
+ )}
+ />
)}
);
diff --git a/packages/commonwealth/client/scripts/views/components/sidebar/CommunitySection/TokenTradeWidget/TokenTradeWidget.tsx b/packages/commonwealth/client/scripts/views/components/sidebar/CommunitySection/TokenTradeWidget/TokenTradeWidget.tsx
index 9cb3f7f4c58..67708619798 100644
--- a/packages/commonwealth/client/scripts/views/components/sidebar/CommunitySection/TokenTradeWidget/TokenTradeWidget.tsx
+++ b/packages/commonwealth/client/scripts/views/components/sidebar/CommunitySection/TokenTradeWidget/TokenTradeWidget.tsx
@@ -15,6 +15,7 @@ import { CWDivider } from '../../../component_kit/cw_divider';
import { CWIconButton } from '../../../component_kit/cw_icon_button';
import { CWText } from '../../../component_kit/cw_text';
import { CWButton } from '../../../component_kit/new_designs/CWButton';
+import FractionalValue from '../../../FractionalValue';
import MarketCapProgress from '../../../TokenCard/MarketCapProgress';
import PricePercentageChange from '../../../TokenCard/PricePercentageChange';
import './TokenTradeWidget.scss';
@@ -84,7 +85,11 @@ export const TokenTradeWidget = ({
<>
{token.symbol} {currencySymbol}
- {tokenPricing.currentPrice}
+
Date: Thu, 21 Nov 2024 18:52:09 +0500
Subject: [PATCH 171/227] Fix value alignment
---
.../FractionalValue/FractionalValue.scss | 4 ++++
.../TokenTradeWidget/TokenTradeWidget.tsx | 17 +++++++++++------
2 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/packages/commonwealth/client/scripts/views/components/FractionalValue/FractionalValue.scss b/packages/commonwealth/client/scripts/views/components/FractionalValue/FractionalValue.scss
index 6d3d1ac2a35..764672a18e2 100644
--- a/packages/commonwealth/client/scripts/views/components/FractionalValue/FractionalValue.scss
+++ b/packages/commonwealth/client/scripts/views/components/FractionalValue/FractionalValue.scss
@@ -3,6 +3,10 @@
.FractionalValue {
height: fit-content;
+ span {
+ all: inherit;
+ }
+
sub {
all: unset;
font-size: 75%;
diff --git a/packages/commonwealth/client/scripts/views/components/sidebar/CommunitySection/TokenTradeWidget/TokenTradeWidget.tsx b/packages/commonwealth/client/scripts/views/components/sidebar/CommunitySection/TokenTradeWidget/TokenTradeWidget.tsx
index 67708619798..bb88f2bddb6 100644
--- a/packages/commonwealth/client/scripts/views/components/sidebar/CommunitySection/TokenTradeWidget/TokenTradeWidget.tsx
+++ b/packages/commonwealth/client/scripts/views/components/sidebar/CommunitySection/TokenTradeWidget/TokenTradeWidget.tsx
@@ -84,12 +84,17 @@ export const TokenTradeWidget = ({
{isWidgetExpanded && (
<>
- {token.symbol} {currencySymbol}
-
+
+ {token.symbol}
+
+
+ {currencySymbol}
+
+
Date: Thu, 21 Nov 2024 11:46:07 -0500
Subject: [PATCH 172/227] configure sequelize reconnect after vitest hooks
---
libs/model/src/config.ts | 5 +---
libs/model/src/database.ts | 51 +++++++++++++++++++++-------------
libs/model/src/tester/seed.ts | 1 -
libs/model/src/vitest.setup.ts | 18 ++++++++++++
vite.config.ts | 3 +-
5 files changed, 52 insertions(+), 26 deletions(-)
create mode 100644 libs/model/src/vitest.setup.ts
diff --git a/libs/model/src/config.ts b/libs/model/src/config.ts
index 0611462913d..e54f5253a4f 100644
--- a/libs/model/src/config.ts
+++ b/libs/model/src/config.ts
@@ -41,10 +41,7 @@ const {
OPENAI_ORGANIZATION,
} = process.env;
-const NAME =
- target.NODE_ENV === 'test'
- ? `common_test_${process.env.VITEST_POOL_ID ?? ''}`
- : 'commonwealth';
+const NAME = target.NODE_ENV === 'test' ? 'common_test' : 'commonwealth';
const DEFAULTS = {
JWT_SECRET: 'my secret',
diff --git a/libs/model/src/database.ts b/libs/model/src/database.ts
index 791c3e3da8e..ade98c0bc9b 100644
--- a/libs/model/src/database.ts
+++ b/libs/model/src/database.ts
@@ -1,27 +1,38 @@
import { logger } from '@hicommonwealth/core';
import { Sequelize } from 'sequelize';
import { config } from './config';
-import { buildDb } from './models';
+import { DB, buildDb } from './models';
const log = logger(import.meta);
-export const sequelize = new Sequelize(config.DB.URI, {
- // disable string operators (https://github.com/sequelize/sequelize/issues/8417)
- // operatorsAliases: false,
- logging: config.DB.TRACE ? (msg) => log.trace(msg) : false,
- dialectOptions:
- config.NODE_ENV !== 'production' || config.DB.NO_SSL
- ? { requestTimeout: 40000 }
- : config.DB.URI ===
- 'postgresql://commonwealth:edgeware@localhost/commonwealth'
- ? { requestTimeout: 40000, ssl: false }
- : { requestTimeout: 40000, ssl: { rejectUnauthorized: false } },
- pool: {
- max: 10,
- min: 0,
- acquire: 40000,
- idle: 40000,
- },
-});
+let sequelize: Sequelize;
+let models: DB;
-export const models = buildDb(sequelize);
+function connect_sequelize() {
+ if (sequelize) sequelize.close();
+
+ sequelize = new Sequelize(config.DB.URI, {
+ // disable string operators (https://github.com/sequelize/sequelize/issues/8417)
+ // operatorsAliases: false,
+ logging: config.DB.TRACE ? (msg) => log.trace(msg) : false,
+ dialectOptions:
+ config.NODE_ENV !== 'production' || config.DB.NO_SSL
+ ? { requestTimeout: 40000 }
+ : config.DB.URI ===
+ 'postgresql://commonwealth:edgeware@localhost/commonwealth'
+ ? { requestTimeout: 40000, ssl: false }
+ : { requestTimeout: 40000, ssl: { rejectUnauthorized: false } },
+ pool: {
+ max: 10,
+ min: 0,
+ acquire: 40000,
+ idle: 40000,
+ },
+ });
+ models = buildDb(sequelize);
+ return { sequelize, models };
+}
+
+connect_sequelize();
+
+export { connect_sequelize, models, sequelize };
diff --git a/libs/model/src/tester/seed.ts b/libs/model/src/tester/seed.ts
index 554dd4fa5b3..17567aadb59 100644
--- a/libs/model/src/tester/seed.ts
+++ b/libs/model/src/tester/seed.ts
@@ -63,7 +63,6 @@ export async function seed(
options: SeedOptions = { mock: true },
): Promise<[z.infer<(typeof schemas)[T]> | undefined, State[]]> {
const db = await bootstrap_testing();
-
const records: State[] = [];
await _seed(db![name], values ?? {}, options, records, 0);
return [records.at(0) as any, records];
diff --git a/libs/model/src/vitest.setup.ts b/libs/model/src/vitest.setup.ts
new file mode 100644
index 00000000000..c0f615846b2
--- /dev/null
+++ b/libs/model/src/vitest.setup.ts
@@ -0,0 +1,18 @@
+import path from 'path';
+import { beforeAll } from 'vitest';
+
+beforeAll(async ({ name }) => {
+ const lcsuite = name.includes('-lifecycle');
+ if (lcsuite) {
+ const suite_name = path.basename(name, '.spec.ts');
+ const suite_db = 'test_' + suite_name.replace(/-/g, '_');
+
+ const { config } = await import('./config');
+ config.DB.NAME = suite_db;
+ config.DB.URI = `postgresql://commonwealth:edgeware@localhost/${suite_db}`;
+
+ const { connect_sequelize } = await import('./database');
+ const { sequelize } = connect_sequelize();
+ console.log(`LC-SUITE: ${suite_name} => ${sequelize.config.database}`);
+ }
+});
diff --git a/vite.config.ts b/vite.config.ts
index 995a62ad0e0..782f0db3234 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -1,5 +1,6 @@
///
import * as dotenv from 'dotenv';
+import path from 'path';
import { defineConfig } from 'vite';
import tsconfigPaths from 'vite-tsconfig-paths';
@@ -8,8 +9,8 @@ dotenv.config();
export default defineConfig({
plugins: [tsconfigPaths()],
test: {
+ setupFiles: [path.resolve(__dirname, './libs/model/src/vitest.setup.ts')],
poolMatchGlobs: [
- ['**/community-alerts-lifecycle.spec.ts', 'forks'],
['**/*-lifecycle.spec.ts', 'threads'],
['**/*.spec.ts', 'forks'],
],
From 9759fbf742bec8c93aa816d381cb2ee8e2cb6f87 Mon Sep 17 00:00:00 2001
From: rotorsoft
Date: Thu, 21 Nov 2024 11:55:13 -0500
Subject: [PATCH 173/227] fix lints
---
libs/model/src/database.ts | 2 +-
libs/model/src/token/GetToken.query.ts | 26 +++++++++++++-------------
2 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/libs/model/src/database.ts b/libs/model/src/database.ts
index ade98c0bc9b..aff09be02d9 100644
--- a/libs/model/src/database.ts
+++ b/libs/model/src/database.ts
@@ -9,7 +9,7 @@ let sequelize: Sequelize;
let models: DB;
function connect_sequelize() {
- if (sequelize) sequelize.close();
+ if (sequelize) void sequelize.close();
sequelize = new Sequelize(config.DB.URI, {
// disable string operators (https://github.com/sequelize/sequelize/issues/8417)
diff --git a/libs/model/src/token/GetToken.query.ts b/libs/model/src/token/GetToken.query.ts
index 0dfaa2041d5..6303fd9dcae 100644
--- a/libs/model/src/token/GetToken.query.ts
+++ b/libs/model/src/token/GetToken.query.ts
@@ -28,19 +28,19 @@ export function GetToken(): Query {
${
with_stats
? `WITH latest_trades AS (SELECT DISTINCT ON (token_address) *
- FROM "LaunchpadTrades"
- ORDER BY token_address, timestamp DESC),
- older_trades AS (SELECT DISTINCT ON (token_address) *
- FROM "LaunchpadTrades"
- WHERE timestamp >=
- (SELECT EXTRACT(EPOCH FROM CURRENT_TIMESTAMP - INTERVAL '24 hours'))
- ORDER BY token_address, timestamp ASC),
- trades AS (SELECT lt.token_address,
- lt.price as latest_price,
- ot.price as old_price
- FROM latest_trades lt
- LEFT JOIN
- older_trades ot ON lt.token_address = ot.token_address)`
+ FROM "LaunchpadTrades"
+ ORDER BY token_address, timestamp DESC),
+ older_trades AS (SELECT DISTINCT ON (token_address) *
+ FROM "LaunchpadTrades"
+ WHERE timestamp >=
+ (SELECT EXTRACT(EPOCH FROM CURRENT_TIMESTAMP - INTERVAL '24 hours'))
+ ORDER BY token_address, timestamp ASC),
+ trades AS (SELECT lt.token_address,
+ lt.price as latest_price,
+ ot.price as old_price
+ FROM latest_trades lt
+ LEFT JOIN
+ older_trades ot ON lt.token_address = ot.token_address)`
: ''
}
SELECT T.*${with_stats ? ', trades.latest_price, trades.old_price' : ''}
From 92872d281002019ab39f9be81014057b5d47f1ab Mon Sep 17 00:00:00 2001
From: rotorsoft
Date: Thu, 21 Nov 2024 12:00:14 -0500
Subject: [PATCH 174/227] skip seed test
---
libs/model/test/seed/seed.spec.ts | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libs/model/test/seed/seed.spec.ts b/libs/model/test/seed/seed.spec.ts
index 04e0e4c2068..4598ab65fee 100644
--- a/libs/model/test/seed/seed.spec.ts
+++ b/libs/model/test/seed/seed.spec.ts
@@ -45,7 +45,8 @@ async function testSeed(
return data;
}
-describe('Seed functions', () => {
+// skip for now, seeds are being widely used in lifecycle tests
+describe.skip('Seed functions', () => {
let shouldExit = true;
afterAll(async () => {
From ba67ede2f00c8d4dc11eae612b3b6218e5c22cdd Mon Sep 17 00:00:00 2001
From: Timothee Legros
Date: Thu, 21 Nov 2024 19:46:48 +0200
Subject: [PATCH 175/227] auto-add UPDATE_POLL permission
---
.../src/community/CreateGroup.command.ts | 23 +++++++++++++------
.../src/community/UpdateGroup.command.ts | 7 +++++-
2 files changed, 22 insertions(+), 8 deletions(-)
diff --git a/libs/model/src/community/CreateGroup.command.ts b/libs/model/src/community/CreateGroup.command.ts
index fe956c2878a..6e8a79d9908 100644
--- a/libs/model/src/community/CreateGroup.command.ts
+++ b/libs/model/src/community/CreateGroup.command.ts
@@ -1,5 +1,6 @@
import { InvalidInput, type Command } from '@hicommonwealth/core';
import * as schemas from '@hicommonwealth/schemas';
+import { PermissionEnum } from '@hicommonwealth/schemas';
import { Op } from 'sequelize';
import { models, sequelize } from '../database';
import { authRoles } from '../middleware';
@@ -70,13 +71,21 @@ export function CreateGroup(): Command {
if (group.id) {
// add topic level interaction permissions for current group
- const groupPermissions = (payload.topics || []).map((t) => ({
- group_id: group.id!,
- topic_id: t.id,
- allowed_actions: sequelize.literal(
- `ARRAY[${t.permissions.map((p) => `'${p}'`).join(', ')}]::"enum_GroupPermissions_allowed_actions"[]`,
- ) as unknown as schemas.PermissionEnum[],
- }));
+ const groupPermissions = (payload.topics || []).map((t) => {
+ const permissions = t.permissions;
+ // Enable UPDATE_POLL by default for all group permissions
+ // TODO: remove once client supports selecting the UPDATE_POLL permission
+ permissions.push(PermissionEnum.UPDATE_POLL);
+ return {
+ group_id: group.id!,
+ topic_id: t.id,
+ allowed_actions: sequelize.literal(
+ `ARRAY[${permissions
+ .map((p) => `'${p}'`)
+ .join(', ')}]::"enum_GroupPermissions_allowed_actions"[]`,
+ ) as unknown as schemas.PermissionEnum[],
+ };
+ });
await models.GroupPermission.bulkCreate(groupPermissions, {
transaction,
});
diff --git a/libs/model/src/community/UpdateGroup.command.ts b/libs/model/src/community/UpdateGroup.command.ts
index 1ffe2923925..157a78131ef 100644
--- a/libs/model/src/community/UpdateGroup.command.ts
+++ b/libs/model/src/community/UpdateGroup.command.ts
@@ -1,5 +1,6 @@
import { InvalidInput, type Command } from '@hicommonwealth/core';
import * as schemas from '@hicommonwealth/schemas';
+import { PermissionEnum } from '@hicommonwealth/schemas';
import { Op } from 'sequelize';
import { models, sequelize } from '../database';
import { authRoles } from '../middleware';
@@ -90,10 +91,14 @@ export function UpdateGroup(): Command {
// update topic level interaction permissions for current group
await Promise.all(
(payload.topics || [])?.map(async (t) => {
+ const permissions = t.permissions;
+ if (!permissions.includes(PermissionEnum.UPDATE_POLL)) {
+ permissions.push(PermissionEnum.UPDATE_POLL);
+ }
if (group.id) {
await models.GroupPermission.update(
{
- allowed_actions: t.permissions,
+ allowed_actions: permissions,
},
{
where: {
From a8ea84e464d7236505e5e32c26bf17f816fce365 Mon Sep 17 00:00:00 2001
From: Ryan Bennett
Date: Thu, 21 Nov 2024 09:55:22 -0800
Subject: [PATCH 176/227] rename mainnet solana chain node
---
.../providers/getSolanaBalances.ts | 2 +-
...20241121174549-solana-mainnet-chain-rename.js | 16 ++++++++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)
create mode 100644 packages/commonwealth/server/migrations/20241121174549-solana-mainnet-chain-rename.js
diff --git a/libs/model/src/services/tokenBalanceCache/providers/getSolanaBalances.ts b/libs/model/src/services/tokenBalanceCache/providers/getSolanaBalances.ts
index f3c3d49fbb1..00c0703dcb7 100644
--- a/libs/model/src/services/tokenBalanceCache/providers/getSolanaBalances.ts
+++ b/libs/model/src/services/tokenBalanceCache/providers/getSolanaBalances.ts
@@ -15,7 +15,7 @@ export async function getSolanaBalances(
const chainNode = await models.ChainNode.scope('withPrivateData').findOne({
where: {
balance_type: 'solana',
- name: 'Solana (Mainnet Beta)',
+ name: 'Solana Mainnet',
},
});
if (!chainNode) {
diff --git a/packages/commonwealth/server/migrations/20241121174549-solana-mainnet-chain-rename.js b/packages/commonwealth/server/migrations/20241121174549-solana-mainnet-chain-rename.js
new file mode 100644
index 00000000000..3b0fd6bc0ae
--- /dev/null
+++ b/packages/commonwealth/server/migrations/20241121174549-solana-mainnet-chain-rename.js
@@ -0,0 +1,16 @@
+'use strict';
+
+/** @type {import('sequelize-cli').Migration} */
+module.exports = {
+ async up(queryInterface, Sequelize) {
+ await queryInterface.sequelize.query(
+ `UPDATE "ChainNodes" SET name = 'Solana Mainnet' WHERE name = 'Solana (Mainnet Beta)'`,
+ );
+ },
+
+ async down(queryInterface, Sequelize) {
+ await queryInterface.sequelize.query(
+ `UPDATE "ChainNodes" SET name = 'Solana (Mainnet Beta)' WHERE name = 'Solana Mainnet'`,
+ );
+ },
+};
From e63d95cdb30b491870baaf59290d24dbb16ed686 Mon Sep 17 00:00:00 2001
From: Timothee Legros
Date: Thu, 21 Nov 2024 20:00:02 +0200
Subject: [PATCH 177/227] remove old poll vote handler
---
.../scripts/state/api/polls/votePoll.ts | 49 +-------
.../pages/view_thread/ThreadPollCard.tsx | 8 +-
.../controllers/server_polls_controller.ts | 11 --
.../server_polls_methods/update_poll_vote.ts | 116 ------------------
.../routes/polls/update_poll_vote_handler.ts | 36 ------
.../commonwealth/server/routing/router.ts | 9 --
6 files changed, 9 insertions(+), 220 deletions(-)
delete mode 100644 packages/commonwealth/server/controllers/server_polls_methods/update_poll_vote.ts
delete mode 100644 packages/commonwealth/server/routes/polls/update_poll_vote_handler.ts
diff --git a/packages/commonwealth/client/scripts/state/api/polls/votePoll.ts b/packages/commonwealth/client/scripts/state/api/polls/votePoll.ts
index 84fac418d94..e5b217be7e7 100644
--- a/packages/commonwealth/client/scripts/state/api/polls/votePoll.ts
+++ b/packages/commonwealth/client/scripts/state/api/polls/votePoll.ts
@@ -1,48 +1,11 @@
-import { useMutation } from '@tanstack/react-query';
-import axios from 'axios';
-import { ApiEndpoints, queryClient, SERVER_URL } from 'state/api/config';
-import { userStore } from 'state/ui/user';
+import { ApiEndpoints, queryClient } from 'state/api/config';
+import { trpc } from 'utils/trpcClient';
-interface VotePollProps {
- pollId: number;
- communityId: string;
- authorCommunityId: string;
- address: string;
- selectedOption: string;
-}
-
-const votePoll = async ({
- pollId,
- communityId,
- authorCommunityId,
- address,
- selectedOption,
-}: VotePollProps) => {
- const response = await axios.put(`${SERVER_URL}/polls/${pollId}/votes`, {
- poll_id: pollId,
- chain_id: communityId,
- author_chain: authorCommunityId,
- option: selectedOption,
- address,
- jwt: userStore.getState().jwt,
- });
-
- return response.data.result;
-};
-
-interface UseVotePollMutationProps {
- threadId: number;
-}
-
-const useVotePollMutation = ({ threadId }: UseVotePollMutationProps) => {
- return useMutation({
- mutationFn: votePoll,
- onSuccess: async (_, variables) => {
+const useVotePollMutation = ({ threadId }: { threadId: number }) => {
+ return trpc.poll.createPollVote.useMutation({
+ onSuccess: async (data) => {
await queryClient.invalidateQueries({
- queryKey: [
- ApiEndpoints.fetchThreadPolls(threadId),
- variables.communityId,
- ],
+ queryKey: [ApiEndpoints.fetchThreadPolls(threadId), data.community_id],
});
},
});
diff --git a/packages/commonwealth/client/scripts/views/pages/view_thread/ThreadPollCard.tsx b/packages/commonwealth/client/scripts/views/pages/view_thread/ThreadPollCard.tsx
index 07c04b09c60..f61bb0f6130 100644
--- a/packages/commonwealth/client/scripts/views/pages/view_thread/ThreadPollCard.tsx
+++ b/packages/commonwealth/client/scripts/views/pages/view_thread/ThreadPollCard.tsx
@@ -83,11 +83,9 @@ export const ThreadPollCard = ({
try {
await votePoll({
- pollId: votedPoll.id,
- communityId: votedPoll.communityId,
- authorCommunityId: user.activeAccount?.community?.id || '',
- address: user.activeAccount?.address || '',
- selectedOption,
+ thread_id: votedPoll.threadId,
+ poll_id: votedPoll.id,
+ option: selectedOption,
});
} catch (err) {
console.error(err);
diff --git a/packages/commonwealth/server/controllers/server_polls_controller.ts b/packages/commonwealth/server/controllers/server_polls_controller.ts
index ab1450bb3a8..108bf66e1d0 100644
--- a/packages/commonwealth/server/controllers/server_polls_controller.ts
+++ b/packages/commonwealth/server/controllers/server_polls_controller.ts
@@ -10,11 +10,6 @@ import {
GetPollVotesResult,
__getPollVotes,
} from './server_polls_methods/get_poll_votes';
-import {
- UpdatePollVoteOptions,
- UpdatePollVoteResult,
- __updatePollVote,
-} from './server_polls_methods/update_poll_vote';
/**
* Implements methods related to polls
@@ -32,10 +27,4 @@ export class ServerPollsController {
): Promise {
return __getPollVotes.call(this, options);
}
-
- async updatePollVote(
- options: UpdatePollVoteOptions,
- ): Promise {
- return __updatePollVote.call(this, options);
- }
}
diff --git a/packages/commonwealth/server/controllers/server_polls_methods/update_poll_vote.ts b/packages/commonwealth/server/controllers/server_polls_methods/update_poll_vote.ts
deleted file mode 100644
index eea21157db1..00000000000
--- a/packages/commonwealth/server/controllers/server_polls_methods/update_poll_vote.ts
+++ /dev/null
@@ -1,116 +0,0 @@
-import { PermissionEnum } from '@hicommonwealth/schemas';
-import moment from 'moment';
-
-import { AppError, ServerError } from '@hicommonwealth/core';
-import {
- AddressInstance,
- UserInstance,
- VoteAttributes,
-} from '@hicommonwealth/model';
-import { MixpanelCommunityInteractionEvent } from '../../../shared/analytics/types';
-import { validateTopicGroupsMembership } from '../../util/requirementsModule/validateTopicGroupsMembership';
-import { TrackOptions } from '../server_analytics_controller';
-import { ServerPollsController } from '../server_polls_controller';
-
-export const Errors = {
- NoPoll: 'No corresponding poll found',
- NoThread: 'No corresponding thread found',
- InvalidUser: 'Invalid user',
- InvalidOption: 'Invalid response option',
- PollingClosed: 'Polling already finished',
- BalanceCheckFailed: 'Could not verify user token balance',
- InsufficientTokenBalance: 'Insufficient token balance',
- ParseError: 'Failed to parse poll options',
-};
-
-export type UpdatePollVoteOptions = {
- user: UserInstance;
- address: AddressInstance;
- pollId: number;
- option: string;
-};
-
-export type UpdatePollVoteResult = [VoteAttributes, TrackOptions];
-
-export async function __updatePollVote(
- this: ServerPollsController,
- { user, address, pollId, option }: UpdatePollVoteOptions,
-): Promise {
- const poll = await this.models.Poll.findOne({
- where: { id: pollId },
- });
- if (!poll) {
- throw new AppError(Errors.NoPoll);
- }
- if (!poll.ends_at && moment(poll.ends_at).utc().isBefore(moment().utc())) {
- throw new AppError(Errors.PollingClosed);
- }
-
- // Ensure user has passed a valid poll response
- const pollOptions = (() => {
- try {
- return JSON.parse(poll.options);
- } catch (err) {
- throw new AppError(Errors.ParseError);
- }
- })();
-
- const selectedOption = pollOptions.find((o: string) => o === option);
- if (!selectedOption) {
- throw new AppError(Errors.InvalidOption);
- }
-
- const thread = await this.models.Thread.findOne({
- where: { id: poll.thread_id },
- });
- if (!thread) {
- throw new AppError(Errors.NoThread);
- }
-
- try {
- // check token balance threshold if needed
- const { isValid } = await validateTopicGroupsMembership(
- this.models,
- thread.topic_id,
- poll.community_id,
- address,
- PermissionEnum.UPDATE_POLL,
- );
- if (!isValid) {
- throw new AppError(Errors.InsufficientTokenBalance);
- }
- } catch (e) {
- throw new ServerError(Errors.BalanceCheckFailed, e);
- }
-
- const vote = await this.models.sequelize.transaction(async (transaction) => {
- const voteData: Partial = {
- poll_id: poll.id,
- address: address.address,
- author_community_id: address.community_id,
- community_id: poll.community_id,
- };
- // delete existing votes
- await this.models.Vote.destroy({
- where: voteData,
- transaction,
- });
- // create new vote
- return this.models.Vote.create(
- // @ts-expect-error StrictNullChecks
- {
- ...voteData,
- option: selectedOption,
- },
- { transaction },
- );
- });
-
- const analyticsOptions = {
- event: MixpanelCommunityInteractionEvent.SUBMIT_VOTE,
- community: poll.community_id,
- userId: user.id,
- };
-
- return [vote.toJSON(), analyticsOptions];
-}
diff --git a/packages/commonwealth/server/routes/polls/update_poll_vote_handler.ts b/packages/commonwealth/server/routes/polls/update_poll_vote_handler.ts
deleted file mode 100644
index ca5e7899a60..00000000000
--- a/packages/commonwealth/server/routes/polls/update_poll_vote_handler.ts
+++ /dev/null
@@ -1,36 +0,0 @@
-import { VoteAttributes } from '@hicommonwealth/model';
-import { ServerControllers } from '../../routing/router';
-import { TypedRequest, TypedResponse, success } from '../../types';
-
-type UpdatePollVoteParams = {
- id: string;
-};
-type UpdatePollBody = {
- option: string;
-};
-type UpdatePollVoteResponse = VoteAttributes;
-
-export const updatePollVoteHandler = async (
- controllers: ServerControllers,
- // @ts-expect-error StrictNullChecks
- req: TypedRequest,
- res: TypedResponse,
-) => {
- // @ts-expect-error StrictNullChecks
- const { id: pollId } = req.params;
- // @ts-expect-error StrictNullChecks
- const { option } = req.body;
-
- const [vote, analyticsOptions] = await controllers.polls.updatePollVote({
- // @ts-expect-error StrictNullChecks
- user: req.user,
- // @ts-expect-error StrictNullChecks
- address: req.address,
- pollId: parseInt(pollId, 10),
- option,
- });
-
- controllers.analytics.track(analyticsOptions, req).catch(console.error);
-
- return success(res, vote);
-};
diff --git a/packages/commonwealth/server/routing/router.ts b/packages/commonwealth/server/routing/router.ts
index 12e8f60bbb7..52281ed8864 100644
--- a/packages/commonwealth/server/routing/router.ts
+++ b/packages/commonwealth/server/routing/router.ts
@@ -86,7 +86,6 @@ import { getGroupsHandler } from '../routes/groups/get_groups_handler';
import { refreshMembershipHandler } from '../routes/groups/refresh_membership_handler';
import { deletePollHandler } from '../routes/polls/delete_poll_handler';
import { getPollVotesHandler } from '../routes/polls/get_poll_votes_handler';
-import { updatePollVoteHandler } from '../routes/polls/update_poll_vote_handler';
import { getTagsHandler } from '../routes/tags/get_tags_handler';
import { createThreadPollHandler } from '../routes/threads/create_thread_poll_handler';
import { getThreadPollsHandler } from '../routes/threads/get_thread_polls_handler';
@@ -298,14 +297,6 @@ function setupRouter(
databaseValidationService.validateAuthor,
deletePollHandler.bind(this, serverControllers),
);
- registerRoute(
- router,
- 'put',
- '/polls/:id/votes',
- passport.authenticate('jwt', { session: false }),
- databaseValidationService.validateAuthor,
- updatePollVoteHandler.bind(this, serverControllers),
- );
registerRoute(
router,
'get',
From 12fd1dc95bfbae9e36bcd1a935c6de98aecd0c57 Mon Sep 17 00:00:00 2001
From: Timothee Legros
Date: Thu, 21 Nov 2024 20:27:07 +0200
Subject: [PATCH 178/227] fix test
---
.../test/integration/api/polls.spec.ts | 111 ++++++------------
1 file changed, 35 insertions(+), 76 deletions(-)
diff --git a/packages/commonwealth/test/integration/api/polls.spec.ts b/packages/commonwealth/test/integration/api/polls.spec.ts
index 82d91fa64a1..2a15ee64801 100644
--- a/packages/commonwealth/test/integration/api/polls.spec.ts
+++ b/packages/commonwealth/test/integration/api/polls.spec.ts
@@ -5,7 +5,8 @@ import type {
Session,
Signature,
} from '@canvas-js/interfaces';
-import { dispose } from '@hicommonwealth/core';
+import { command, dispose } from '@hicommonwealth/core';
+import { Poll } from '@hicommonwealth/model';
import chai from 'chai';
import chaiHttp from 'chai-http';
import jwt from 'jsonwebtoken';
@@ -20,6 +21,7 @@ describe('Polls', () => {
const chain = 'ethereum';
let userJWT: string;
+ let userId: number;
let userAddress: string;
let userDid: `did:${string}`;
let userSession: {
@@ -50,6 +52,7 @@ describe('Polls', () => {
'Alice',
);
userAddress = userRes.address;
+ userId = parseInt(userRes.user_id);
userDid = userRes.did;
userJWT = jwt.sign(
{ id: userRes.user_id, email: userRes.email },
@@ -115,46 +118,42 @@ describe('Polls', () => {
});
test('should fail to cast a vote with invalid option', async () => {
- const data = {
- option: 'optionC',
- };
-
- const res = await chai.request
- .agent(server.app)
- .put(`/api/polls/${pollId}/votes`)
- .set('Accept', 'application/json')
- .send({
- author_chain: chain,
- chain: chain,
- address: userAddress,
- jwt: userJWT,
- ...data,
+ try {
+ const res = await command(Poll.CreatePollVote(), {
+ actor: {
+ user: {
+ id: userId,
+ email: 'test@common.xyz',
+ },
+ address: userAddress,
+ },
+ payload: {
+ poll_id: pollId,
+ thread_id: threadId,
+ option: 'optionC',
+ },
});
-
- expect(res.status).to.equal(400);
+ expect.fail();
+ } catch (e) {}
});
test('should cast a vote', async () => {
- const data = {
- option: 'optionA',
- };
-
- const res = await chai.request
- .agent(server.app)
- .put(`/api/polls/${pollId}/votes`)
- .set('Accept', 'application/json')
- .send({
- author_chain: chain,
- chain: chain,
+ const res = await command(Poll.CreatePollVote(), {
+ actor: {
+ user: {
+ id: userId,
+ email: 'test@common.xyz',
+ },
address: userAddress,
- jwt: userJWT,
- ...data,
- });
-
- expect(res.status).to.equal(200);
- expect(res.body.result).to.contain({
- option: data.option,
+ },
+ payload: {
+ poll_id: pollId,
+ thread_id: threadId,
+ option: 'optionA',
+ },
});
+ expect(res).to.not.be.undefined;
+ expect(res?.id).to.not.be.undefined;
});
test('should get thread polls, response shows poll and vote', async () => {
@@ -176,46 +175,6 @@ describe('Polls', () => {
);
});
- test('should recast vote', async () => {
- const data = {
- option: 'optionB',
- };
-
- const res = await chai.request
- .agent(server.app)
- .put(`/api/polls/${pollId}/votes`)
- .set('Accept', 'application/json')
- .send({
- author_chain: chain,
- chain: chain,
- address: userAddress,
- jwt: userJWT,
- ...data,
- });
-
- expect(res.status).to.equal(200);
- expect(res.body.result).to.contain({
- option: data.option,
- });
- });
-
- test('should get thread polls, response shows updated poll and vote', async () => {
- const res = await chai.request
- .agent(server.app)
- .get(`/api/threads/${threadId}/polls`)
- .set('Accept', 'application/json')
- .query({
- chain: chain,
- });
-
- expect(res.status).to.equal(200);
- expect(res.body.result[0].votes[0]).to.have.property('option', 'optionB');
- expect(res.body.result[0].votes[0]).to.have.property(
- 'address',
- userAddress,
- );
- });
-
test('should get thread poll votes', async () => {
const res = await chai.request
.agent(server.app)
@@ -226,7 +185,7 @@ describe('Polls', () => {
});
expect(res.status).to.equal(200);
- expect(res.body.result[0]).to.have.property('option', 'optionB');
+ expect(res.body.result[0]).to.have.property('option', 'optionA');
expect(res.body.result[0]).to.have.property('address', userAddress);
});
From e71f187a6e2c6d392875758e5d90a8d27e5836fe Mon Sep 17 00:00:00 2001
From: Timothee Legros
Date: Thu, 21 Nov 2024 20:28:01 +0200
Subject: [PATCH 179/227] lint
---
libs/model/src/poll/createPollVote.command.ts | 2 +-
libs/model/src/token/GetToken.query.ts | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/libs/model/src/poll/createPollVote.command.ts b/libs/model/src/poll/createPollVote.command.ts
index e43da0550e2..5fcc1a24eab 100644
--- a/libs/model/src/poll/createPollVote.command.ts
+++ b/libs/model/src/poll/createPollVote.command.ts
@@ -28,7 +28,7 @@ export function CreatePollVote(): Command {
}
// TODO: migrate this to be JSONB array of strings in the DB
- let options = JSON.parse(poll.options);
+ const options = JSON.parse(poll.options);
if (!options.includes(payload.option)) {
throw new InvalidState(CreateVotePollErrors.InvalidOption);
}
diff --git a/libs/model/src/token/GetToken.query.ts b/libs/model/src/token/GetToken.query.ts
index 0dfaa2041d5..b73560ad807 100644
--- a/libs/model/src/token/GetToken.query.ts
+++ b/libs/model/src/token/GetToken.query.ts
@@ -33,6 +33,7 @@ export function GetToken(): Query {
older_trades AS (SELECT DISTINCT ON (token_address) *
FROM "LaunchpadTrades"
WHERE timestamp >=
+ -- eslint-disable-next-line max-len
(SELECT EXTRACT(EPOCH FROM CURRENT_TIMESTAMP - INTERVAL '24 hours'))
ORDER BY token_address, timestamp ASC),
trades AS (SELECT lt.token_address,
From a80cf4d7aa322fdeb0aa33560b0c88a0aaa28bb1 Mon Sep 17 00:00:00 2001
From: rotorsoft
Date: Thu, 21 Nov 2024 13:43:09 -0500
Subject: [PATCH 180/227] fix vitest config
---
vite.config.ts | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/vite.config.ts b/vite.config.ts
index 782f0db3234..f3cba4a15b4 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -11,8 +11,9 @@ export default defineConfig({
test: {
setupFiles: [path.resolve(__dirname, './libs/model/src/vitest.setup.ts')],
poolMatchGlobs: [
- ['**/*-lifecycle.spec.ts', 'threads'],
- ['**/*.spec.ts', 'forks'],
+ ['**/libs/model/**/*-lifecycle.spec.ts', 'threads'],
+ ['**/libs/model/**/*.spec.ts', 'forks'],
+ ['**/commonwealth/**/*.spec.ts', 'forks'],
],
poolOptions: {
threads: {
@@ -27,6 +28,8 @@ export default defineConfig({
sequence: { concurrent: false },
reporters: ['default'],
coverage: {
+ include: ['src/**/*.ts'],
+ exclude: ['src/**/*.d.ts', '**/migrations/**', '**/node_modules/**'],
provider: 'istanbul',
reporter:
process.env.CI === 'true'
From 764395441da8900f290842e57883587ed74adedc Mon Sep 17 00:00:00 2001
From: Timothee Legros
Date: Thu, 21 Nov 2024 21:02:14 +0200
Subject: [PATCH 181/227] lint
---
packages/commonwealth/test/integration/api/polls.spec.ts | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/packages/commonwealth/test/integration/api/polls.spec.ts b/packages/commonwealth/test/integration/api/polls.spec.ts
index 2a15ee64801..9068f2b14e7 100644
--- a/packages/commonwealth/test/integration/api/polls.spec.ts
+++ b/packages/commonwealth/test/integration/api/polls.spec.ts
@@ -119,7 +119,7 @@ describe('Polls', () => {
test('should fail to cast a vote with invalid option', async () => {
try {
- const res = await command(Poll.CreatePollVote(), {
+ await command(Poll.CreatePollVote(), {
actor: {
user: {
id: userId,
@@ -134,6 +134,7 @@ describe('Polls', () => {
},
});
expect.fail();
+ // eslint-disable-next-line no-empty
} catch (e) {}
});
From 7d49680693f8b97dcc95987de35a5d4d428c499e Mon Sep 17 00:00:00 2001
From: Timothee Legros
Date: Thu, 21 Nov 2024 21:02:21 +0200
Subject: [PATCH 182/227] lint
---
libs/model/src/token/GetToken.query.ts | 29 +++++++++++++-------------
1 file changed, 15 insertions(+), 14 deletions(-)
diff --git a/libs/model/src/token/GetToken.query.ts b/libs/model/src/token/GetToken.query.ts
index b73560ad807..f9d656fc06b 100644
--- a/libs/model/src/token/GetToken.query.ts
+++ b/libs/model/src/token/GetToken.query.ts
@@ -28,20 +28,21 @@ export function GetToken(): Query {
${
with_stats
? `WITH latest_trades AS (SELECT DISTINCT ON (token_address) *
- FROM "LaunchpadTrades"
- ORDER BY token_address, timestamp DESC),
- older_trades AS (SELECT DISTINCT ON (token_address) *
- FROM "LaunchpadTrades"
- WHERE timestamp >=
- -- eslint-disable-next-line max-len
- (SELECT EXTRACT(EPOCH FROM CURRENT_TIMESTAMP - INTERVAL '24 hours'))
- ORDER BY token_address, timestamp ASC),
- trades AS (SELECT lt.token_address,
- lt.price as latest_price,
- ot.price as old_price
- FROM latest_trades lt
- LEFT JOIN
- older_trades ot ON lt.token_address = ot.token_address)`
+ FROM "LaunchpadTrades"
+ ORDER BY token_address, timestamp DESC),
+ older_trades AS (SELECT DISTINCT ON (token_address) *
+ FROM "LaunchpadTrades"
+ WHERE timestamp >=
+ (SELECT EXTRACT(
+ EPOCH FROM CURRENT_TIMESTAMP - INTERVAL '24 hours'
+ ))
+ ORDER BY token_address, timestamp ASC),
+ trades AS (SELECT lt.token_address,
+ lt.price as latest_price,
+ ot.price as old_price
+ FROM latest_trades lt
+ LEFT JOIN
+ older_trades ot ON lt.token_address = ot.token_address)`
: ''
}
SELECT T.*${with_stats ? ', trades.latest_price, trades.old_price' : ''}
From 2dfb7d174b0cba54199cc66f511c23d92e30ec07 Mon Sep 17 00:00:00 2001
From: rotorsoft
Date: Thu, 21 Nov 2024 14:06:18 -0500
Subject: [PATCH 183/227] skip test
---
packages/commonwealth/test/devnet/evm/evmChainEvents.spec.ts | 5 ++++-
vite.config.ts | 1 -
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/packages/commonwealth/test/devnet/evm/evmChainEvents.spec.ts b/packages/commonwealth/test/devnet/evm/evmChainEvents.spec.ts
index 14df8a4159a..b58e4a9c1f0 100644
--- a/packages/commonwealth/test/devnet/evm/evmChainEvents.spec.ts
+++ b/packages/commonwealth/test/devnet/evm/evmChainEvents.spec.ts
@@ -328,7 +328,10 @@ describe('EVM Chain Events Devnet Tests', () => {
).toBeTruthy();
});
});
- describe('EVM Chain Events End to End Tests', () => {
+
+ // @timolegros this test is having db conflicts with other test
+ // should we check if chain node exists before creating it?
+ describe.skip('EVM Chain Events End to End Tests', () => {
let chainNode: ChainNodeInstance;
beforeAll(async () => {
diff --git a/vite.config.ts b/vite.config.ts
index f3cba4a15b4..58841f7397c 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -26,7 +26,6 @@ export default defineConfig({
},
},
sequence: { concurrent: false },
- reporters: ['default'],
coverage: {
include: ['src/**/*.ts'],
exclude: ['src/**/*.d.ts', '**/migrations/**', '**/node_modules/**'],
From 29f6795a9263625937dd79b4d3492b65ecb53901 Mon Sep 17 00:00:00 2001
From: rotorsoft
Date: Thu, 21 Nov 2024 14:25:33 -0500
Subject: [PATCH 184/227] update docker file
---
Dockerfile.datadog | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Dockerfile.datadog b/Dockerfile.datadog
index c95692b5e70..03c2b383db3 100644
--- a/Dockerfile.datadog
+++ b/Dockerfile.datadog
@@ -1,4 +1,4 @@
-FROM node:20-slim AS datadog-base
+FROM node:22-slim AS datadog-base
# Install Datadog dependencies
RUN apt-get update && apt-get install -y gnupg apt-transport-https gpg-agent curl ca-certificates
From 1836b341e8bbb20a43b22ea210aac8f1ec466a30 Mon Sep 17 00:00:00 2001
From: Ryan Bennett
Date: Thu, 21 Nov 2024 11:52:29 -0800
Subject: [PATCH 185/227] fix test for check contest
---
.../src/contest/CheckContests.command.ts | 3 +-
.../contest/GetActiveContestManagers.query.ts | 10 +-
libs/model/src/contest/index.ts | 1 +
.../model/test/contest/check-contests.spec.ts | 207 ++++++++++++++++++
.../contest-worker-policy-lifecycle.spec.ts | 2 -
.../commonwealthConsumer.ts | 37 +++-
6 files changed, 244 insertions(+), 16 deletions(-)
create mode 100644 libs/model/test/contest/check-contests.spec.ts
rename libs/model/test/{contest-worker => contest}/contest-worker-policy-lifecycle.spec.ts (97%)
diff --git a/libs/model/src/contest/CheckContests.command.ts b/libs/model/src/contest/CheckContests.command.ts
index 48298603f33..514813f1f7c 100644
--- a/libs/model/src/contest/CheckContests.command.ts
+++ b/libs/model/src/contest/CheckContests.command.ts
@@ -1,5 +1,6 @@
import { Actor, logger, query, type Command } from '@hicommonwealth/core';
import * as schemas from '@hicommonwealth/schemas';
+import moment from 'moment';
import Web3 from 'web3';
import { config } from '../config';
import { createOnchainContestVote } from '../policies/contest-utils';
@@ -31,7 +32,7 @@ export function CheckContests(): Command {
!contestManager.actions.some(
(action) => action.action === 'upvoted',
) &&
- Date.now() - contestManager.end_time.getTime() < 1000 * 60 * 60,
+ moment(contestManager.end_time).diff(moment(), 'minutes') < 60,
);
const promises = contestsWithoutVote.map(async (contestManager) => {
diff --git a/libs/model/src/contest/GetActiveContestManagers.query.ts b/libs/model/src/contest/GetActiveContestManagers.query.ts
index 6cf838f1091..64be3e3e301 100644
--- a/libs/model/src/contest/GetActiveContestManagers.query.ts
+++ b/libs/model/src/contest/GetActiveContestManagers.query.ts
@@ -42,10 +42,10 @@ export function GetActiveContestManagers(): Query<
FROM "Contests"
GROUP BY contest_address) co ON cm.contest_address = co.contest_address
LEFT JOIN "ContestActions" ca on (
- ca.contest_address = cm.contest_address AND
- ca.created_at > co.start_time AND
- ca.created_at < co.end_time
- )
+ ca.contest_address = cm.contest_address AND
+ ca.created_at > co.start_time AND
+ ca.created_at < co.end_time
+ )
WHERE
cm.cancelled IS NOT TRUE
AND cm.ended IS NOT TRUE
@@ -56,7 +56,7 @@ export function GetActiveContestManagers(): Query<
OR
cm.interval > 0
)
- GROUP BY cn.eth_chain_id, cn.private_url, cn.url, cm.contest_address, co.max_contest_id
+ GROUP BY cn.eth_chain_id, cn.private_url, cn.url, cm.contest_address, co.max_contest_id, co.end_time
`,
{
type: QueryTypes.SELECT,
diff --git a/libs/model/src/contest/index.ts b/libs/model/src/contest/index.ts
index 445d9d5cf11..8bc5ddd9e89 100644
--- a/libs/model/src/contest/index.ts
+++ b/libs/model/src/contest/index.ts
@@ -1,4 +1,5 @@
export * from './CancelContestManagerMetadata.command';
+export * from './CheckContests.command';
export * from './Contests.projection';
export * from './CreateContestManagerMetadata.command';
export * from './FarcasterCastCreatedWebhook.command';
diff --git a/libs/model/test/contest/check-contests.spec.ts b/libs/model/test/contest/check-contests.spec.ts
new file mode 100644
index 00000000000..a9ef66d3a13
--- /dev/null
+++ b/libs/model/test/contest/check-contests.spec.ts
@@ -0,0 +1,207 @@
+import Sinon from 'sinon';
+
+import { Actor, command, dispose, EventNames } from '@hicommonwealth/core';
+import {
+ commonProtocol,
+ ContestWorker,
+ emitEvent,
+ models,
+} from '@hicommonwealth/model';
+import { expect } from 'chai';
+import { Contests } from 'model/src/contest';
+import { CheckContests } from 'model/src/contest/CheckContests.command';
+import { literal } from 'sequelize';
+import { afterAll, beforeAll, describe, test } from 'vitest';
+import { bootstrap_testing, seed } from '../../src/tester';
+import { drainOutbox } from '../utils';
+
+describe('Check Contests', () => {
+ const addressId = 444;
+ const address = '0x0';
+ const communityId = 'ethhh';
+ const threadId = 888;
+ const threadTitle = 'Hello There';
+ const contestAddress = '0x1';
+ const contestId = 0;
+ const contentId = 1;
+ let topicId: number = 0;
+
+ beforeAll(async () => {
+ await bootstrap_testing(import.meta);
+
+ const [chainNode] = await seed('ChainNode', { contracts: [] });
+ const [user] = await seed(
+ 'User',
+ {
+ isAdmin: false,
+ selected_community_id: undefined,
+ },
+ //{ mock: true, log: true },
+ );
+ const [community] = await seed('Community', {
+ id: communityId,
+ chain_node_id: chainNode!.id,
+ lifetime_thread_count: 0,
+ profile_count: 1,
+ Addresses: [
+ {
+ id: addressId,
+ user_id: user!.id,
+ address,
+ role: 'member',
+ },
+ ],
+ topics: [
+ {
+ id: topicId,
+ name: 'hello',
+ community_id: communityId,
+ group_ids: [],
+ },
+ ],
+ contest_managers: [
+ {
+ contest_address: contestAddress,
+ cancelled: false,
+ ended: false,
+ is_farcaster_contest: false,
+ topic_id: topicId,
+ interval: 0,
+ contests: [
+ {
+ contest_address: contestAddress,
+ contest_id: contestId,
+ start_time: new Date(),
+ end_time: new Date(new Date().getTime() + 60 * 60 * 1000),
+ score: [],
+ },
+ ],
+ },
+ ],
+ });
+ await seed('Thread', {
+ id: threadId,
+ community_id: communityId,
+ address_id: addressId,
+ topic_id: topicId,
+ deleted_at: undefined,
+ pinned: false,
+ read_only: false,
+ reaction_weights_sum: '0',
+ });
+ });
+
+ afterAll(async () => {
+ Sinon.restore();
+ await dispose()();
+ });
+
+ test('Should add onchain vote to unvoted contest', async () => {
+ const addContentStub = Sinon.stub(
+ commonProtocol.contestHelper,
+ 'addContentBatch',
+ ).resolves([]);
+
+ await emitEvent(models.Outbox, [
+ {
+ event_name: EventNames.ThreadCreated,
+ event_payload: {
+ id: threadId,
+ community_id: communityId,
+ address_id: addressId,
+ title: threadTitle,
+ created_by: address,
+ canvas_signed_data: '',
+ canvas_msg_id: '',
+ kind: '',
+ stage: '',
+ body: '',
+ view_count: 0,
+ reaction_count: 0,
+ reaction_weights_sum: '0',
+ comment_count: 0,
+ deleted_at: undefined,
+ pinned: false,
+ read_only: false,
+ topic_id: topicId,
+ contestManagers: [
+ {
+ contest_address: contestAddress,
+ },
+ ],
+ },
+ },
+ ]);
+
+ await drainOutbox(['ThreadCreated'], ContestWorker);
+
+ expect(addContentStub.called, 'addContent was not called').to.be.true;
+
+ await emitEvent(models.Outbox, [
+ {
+ event_name: EventNames.ContestContentAdded,
+ event_payload: {
+ content_id: 0,
+ content_url: '/ethhh/discussion/888',
+ contest_address: contestAddress,
+ creator_address: address,
+ },
+ },
+ ]);
+
+ await drainOutbox(['ContestContentAdded'], Contests);
+
+ const voteContentStub = Sinon.stub(
+ commonProtocol.contestHelper,
+ 'voteContentBatch',
+ ).resolves([]);
+
+ // simulate contest will end in 2 hours
+ await models.Contest.update(
+ {
+ end_time: literal(`NOW() + INTERVAL '2 hours'`),
+ },
+ {
+ where: {
+ contest_address: contestAddress,
+ contest_id: contestId,
+ },
+ },
+ );
+
+ await command(CheckContests(), {
+ actor: {} as Actor,
+ payload: { id: '' },
+ });
+
+ expect(voteContentStub.called, 'vote should not be cast yet').to.be.false;
+
+ // simulate contest will end in less than 1 hour
+ await models.Contest.update(
+ {
+ end_time: literal(`NOW() + INTERVAL '50 minutes'`),
+ },
+ {
+ where: {
+ contest_address: contestAddress,
+ contest_id: contestId,
+ },
+ },
+ );
+
+ await command(CheckContests(), {
+ actor: {} as Actor,
+ payload: { id: '' },
+ });
+
+ expect(voteContentStub.called, 'vote should have been cast').to.be.true;
+ expect(
+ voteContentStub.args[0][1].startsWith('0x'),
+ 'using valid wallet address',
+ ).to.be.true;
+ expect(voteContentStub.args[0][1]).has.length(
+ 42,
+ 'using valid wallet address',
+ );
+ });
+});
diff --git a/libs/model/test/contest-worker/contest-worker-policy-lifecycle.spec.ts b/libs/model/test/contest/contest-worker-policy-lifecycle.spec.ts
similarity index 97%
rename from libs/model/test/contest-worker/contest-worker-policy-lifecycle.spec.ts
rename to libs/model/test/contest/contest-worker-policy-lifecycle.spec.ts
index 9b696676f27..860d676c24b 100644
--- a/libs/model/test/contest-worker/contest-worker-policy-lifecycle.spec.ts
+++ b/libs/model/test/contest/contest-worker-policy-lifecycle.spec.ts
@@ -74,8 +74,6 @@ describe('Contest Worker Policy Lifecycle', () => {
},
],
});
- expect(community!.contest_managers!.length).to.eq(1);
- expect(community!.contest_managers![0].contests!.length).to.eq(1);
await seed('Thread', {
id: threadId,
community_id: communityId,
diff --git a/packages/commonwealth/server/workers/commonwealthConsumer/commonwealthConsumer.ts b/packages/commonwealth/server/workers/commonwealthConsumer/commonwealthConsumer.ts
index e7d9612d410..6a058409e04 100644
--- a/packages/commonwealth/server/workers/commonwealthConsumer/commonwealthConsumer.ts
+++ b/packages/commonwealth/server/workers/commonwealthConsumer/commonwealthConsumer.ts
@@ -142,16 +142,37 @@ export async function setupCommonwealthConsumer(): Promise {
function startRolloverLoop() {
log.info('Starting rollover loop');
+ const loop = async () => {
+ try {
+ await command(
+ Contest.CheckContests(),
+ {
+ actor: {} as Actor,
+ payload: { id: '' },
+ },
+ false,
+ );
+ } catch (err) {
+ log.error(err);
+ }
+
+ try {
+ await command(
+ Contest.PerformContestRollovers(),
+ {
+ actor: {} as Actor,
+ payload: { id: '' },
+ },
+ false,
+ );
+ } catch (err) {
+ log.error(err);
+ }
+ };
+
// TODO: move to external service triggered via scheduler?
setInterval(() => {
- command(
- Contest.PerformContestRollovers(),
- {
- actor: {} as Actor,
- payload: { id: '' },
- },
- false,
- ).catch(console.error);
+ loop();
}, 1_000 * 60);
}
From 8673db7c18f030af8a6171b71f0e06875eb7c281 Mon Sep 17 00:00:00 2001
From: Ryan Bennett
Date: Thu, 21 Nov 2024 11:59:48 -0800
Subject: [PATCH 186/227] lint
---
libs/model/test/contest/check-contests.spec.ts | 5 ++---
.../test/contest/contest-worker-policy-lifecycle.spec.ts | 5 ++---
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/libs/model/test/contest/check-contests.spec.ts b/libs/model/test/contest/check-contests.spec.ts
index a9ef66d3a13..72dfb6520dd 100644
--- a/libs/model/test/contest/check-contests.spec.ts
+++ b/libs/model/test/contest/check-contests.spec.ts
@@ -23,8 +23,7 @@ describe('Check Contests', () => {
const threadTitle = 'Hello There';
const contestAddress = '0x1';
const contestId = 0;
- const contentId = 1;
- let topicId: number = 0;
+ const topicId: number = 0;
beforeAll(async () => {
await bootstrap_testing(import.meta);
@@ -38,7 +37,7 @@ describe('Check Contests', () => {
},
//{ mock: true, log: true },
);
- const [community] = await seed('Community', {
+ await seed('Community', {
id: communityId,
chain_node_id: chainNode!.id,
lifetime_thread_count: 0,
diff --git a/libs/model/test/contest/contest-worker-policy-lifecycle.spec.ts b/libs/model/test/contest/contest-worker-policy-lifecycle.spec.ts
index 860d676c24b..64bebcc7472 100644
--- a/libs/model/test/contest/contest-worker-policy-lifecycle.spec.ts
+++ b/libs/model/test/contest/contest-worker-policy-lifecycle.spec.ts
@@ -18,8 +18,7 @@ describe('Contest Worker Policy Lifecycle', () => {
const threadTitle = 'Hello There';
const contestAddress = '0x1';
const contestId = 0;
- const contentId = 1;
- let topicId: number = 0;
+ const topicId: number = 0;
beforeAll(async () => {
await bootstrap_testing(import.meta);
@@ -33,7 +32,7 @@ describe('Contest Worker Policy Lifecycle', () => {
},
//{ mock: true, log: true },
);
- const [community] = await seed('Community', {
+ await seed('Community', {
id: communityId,
chain_node_id: chainNode!.id,
lifetime_thread_count: 0,
From 228bf08b212897745a952a0c17bc83038e4bae48 Mon Sep 17 00:00:00 2001
From: Ryan Bennett
Date: Thu, 21 Nov 2024 12:06:49 -0800
Subject: [PATCH 187/227] verbose log err
---
libs/model/src/contest/CheckContests.command.ts | 2 +-
libs/model/src/contest/PerformContestRollovers.command.ts | 6 ++----
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/libs/model/src/contest/CheckContests.command.ts b/libs/model/src/contest/CheckContests.command.ts
index 514813f1f7c..6fd47cfe03d 100644
--- a/libs/model/src/contest/CheckContests.command.ts
+++ b/libs/model/src/contest/CheckContests.command.ts
@@ -64,7 +64,7 @@ export function CheckContests(): Command {
);
if (errors.length > 0) {
- log.warn(`CheckContests: failed with errors: ${errors.join(', ')}"`);
+ log.error(`CheckContests: failed with errors: ${errors.join(', ')}"`);
}
},
};
diff --git a/libs/model/src/contest/PerformContestRollovers.command.ts b/libs/model/src/contest/PerformContestRollovers.command.ts
index 59e0b8b51e0..eb27a26456b 100644
--- a/libs/model/src/contest/PerformContestRollovers.command.ts
+++ b/libs/model/src/contest/PerformContestRollovers.command.ts
@@ -122,10 +122,8 @@ export function PerformContestRollovers(): Command<
);
if (errors.length > 0) {
- log.warn(
- `GetAllContests performContestRollovers: failed with errors: ${errors.join(
- ', ',
- )}"`,
+ log.error(
+ `PerformContestRollovers: failed with errors: ${errors.join(', ')}"`,
);
}
},
From 917975d674124ecab800ecf6637d245ad4454029 Mon Sep 17 00:00:00 2001
From: Ryan Bennett
Date: Thu, 21 Nov 2024 12:17:46 -0800
Subject: [PATCH 188/227] add burner private key for CI
---
.github/workflows/CI.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml
index ac03b1b392a..74da2d11a48 100644
--- a/.github/workflows/CI.yml
+++ b/.github/workflows/CI.yml
@@ -7,7 +7,7 @@ env:
NODE_ENV: 'test'
ROLLBAR_ENV: 'GitHubCI'
TEST_WITHOUT_LOGS: 'true'
- PRIVATE_KEY: 'web3-pk'
+ PRIVATE_KEY: '83c65f24efbc8f4bc54ad425e897fc3ea01f760d5e71671a30eacb075ebe2313'
USES_DOCKER_PGSQL: true
PORT: 8080
REDIS_URL: redis://localhost:6379
From 9be67d3d884627e3ce116fa4fe34315d61ef1478 Mon Sep 17 00:00:00 2001
From: rotorsoft
Date: Thu, 21 Nov 2024 15:18:35 -0500
Subject: [PATCH 189/227] try a different strategy
---
libs/model/src/database.ts | 2 --
libs/model/src/vitest.setup.ts | 7 ++++---
.../test/devnet/evm/evmChainEvents.spec.ts | 5 +----
vite.config.ts | 17 ++++++-----------
4 files changed, 11 insertions(+), 20 deletions(-)
diff --git a/libs/model/src/database.ts b/libs/model/src/database.ts
index aff09be02d9..992ae0295c4 100644
--- a/libs/model/src/database.ts
+++ b/libs/model/src/database.ts
@@ -9,8 +9,6 @@ let sequelize: Sequelize;
let models: DB;
function connect_sequelize() {
- if (sequelize) void sequelize.close();
-
sequelize = new Sequelize(config.DB.URI, {
// disable string operators (https://github.com/sequelize/sequelize/issues/8417)
// operatorsAliases: false,
diff --git a/libs/model/src/vitest.setup.ts b/libs/model/src/vitest.setup.ts
index c0f615846b2..183e89c1ce7 100644
--- a/libs/model/src/vitest.setup.ts
+++ b/libs/model/src/vitest.setup.ts
@@ -11,8 +11,9 @@ beforeAll(async ({ name }) => {
config.DB.NAME = suite_db;
config.DB.URI = `postgresql://commonwealth:edgeware@localhost/${suite_db}`;
- const { connect_sequelize } = await import('./database');
- const { sequelize } = connect_sequelize();
- console.log(`LC-SUITE: ${suite_name} => ${sequelize.config.database}`);
+ const { sequelize, connect_sequelize } = await import('./database');
+ await sequelize.close();
+ const { sequelize: vite_sequelize } = await connect_sequelize();
+ console.log(`LC-SUITE: ${suite_name} => ${vite_sequelize.config.database}`);
}
});
diff --git a/packages/commonwealth/test/devnet/evm/evmChainEvents.spec.ts b/packages/commonwealth/test/devnet/evm/evmChainEvents.spec.ts
index b58e4a9c1f0..14df8a4159a 100644
--- a/packages/commonwealth/test/devnet/evm/evmChainEvents.spec.ts
+++ b/packages/commonwealth/test/devnet/evm/evmChainEvents.spec.ts
@@ -328,10 +328,7 @@ describe('EVM Chain Events Devnet Tests', () => {
).toBeTruthy();
});
});
-
- // @timolegros this test is having db conflicts with other test
- // should we check if chain node exists before creating it?
- describe.skip('EVM Chain Events End to End Tests', () => {
+ describe('EVM Chain Events End to End Tests', () => {
let chainNode: ChainNodeInstance;
beforeAll(async () => {
diff --git a/vite.config.ts b/vite.config.ts
index 58841f7397c..816ecd25ba3 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -11,20 +11,15 @@ export default defineConfig({
test: {
setupFiles: [path.resolve(__dirname, './libs/model/src/vitest.setup.ts')],
poolMatchGlobs: [
- ['**/libs/model/**/*-lifecycle.spec.ts', 'threads'],
- ['**/libs/model/**/*.spec.ts', 'forks'],
- ['**/commonwealth/**/*.spec.ts', 'forks'],
+ // lifecycle tests in forks pool (uses node:child_process)
+ ['**/libs/model/**/*-lifecycle.spec.ts', 'forks'],
+ // everything else runs in threads pool
],
poolOptions: {
- threads: {
- minThreads: 1,
- maxThreads: 5,
- },
- forks: {
- minForks: 1,
- maxForks: 1,
- },
+ threads: { minThreads: 1, maxThreads: 1 },
+ forks: { minForks: 1, maxForks: 5 },
},
+ maxConcurrency: 1,
sequence: { concurrent: false },
coverage: {
include: ['src/**/*.ts'],
From e23133d109e9afa6392d2c00813f00d0828f70e1 Mon Sep 17 00:00:00 2001
From: Ryan Bennett
Date: Thu, 21 Nov 2024 12:25:31 -0800
Subject: [PATCH 190/227] fix key
---
.github/workflows/CI.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml
index 74da2d11a48..3ff3cdf25a3 100644
--- a/.github/workflows/CI.yml
+++ b/.github/workflows/CI.yml
@@ -7,7 +7,7 @@ env:
NODE_ENV: 'test'
ROLLBAR_ENV: 'GitHubCI'
TEST_WITHOUT_LOGS: 'true'
- PRIVATE_KEY: '83c65f24efbc8f4bc54ad425e897fc3ea01f760d5e71671a30eacb075ebe2313'
+ PRIVATE_KEY: '0x83c65f24efbc8f4bc54ad425e897fc3ea01f760d5e71671a30eacb075ebe2313'
USES_DOCKER_PGSQL: true
PORT: 8080
REDIS_URL: redis://localhost:6379
From 95583ddb0ae5754438fc547890ab69e31506d776 Mon Sep 17 00:00:00 2001
From: rotorsoft
Date: Thu, 21 Nov 2024 15:29:05 -0500
Subject: [PATCH 191/227] fix lints
---
libs/model/src/vitest.setup.ts | 2 +-
vite.config.ts | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/libs/model/src/vitest.setup.ts b/libs/model/src/vitest.setup.ts
index 183e89c1ce7..285ee47071b 100644
--- a/libs/model/src/vitest.setup.ts
+++ b/libs/model/src/vitest.setup.ts
@@ -13,7 +13,7 @@ beforeAll(async ({ name }) => {
const { sequelize, connect_sequelize } = await import('./database');
await sequelize.close();
- const { sequelize: vite_sequelize } = await connect_sequelize();
+ const { sequelize: vite_sequelize } = connect_sequelize();
console.log(`LC-SUITE: ${suite_name} => ${vite_sequelize.config.database}`);
}
});
diff --git a/vite.config.ts b/vite.config.ts
index 816ecd25ba3..7097748096a 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -19,7 +19,7 @@ export default defineConfig({
threads: { minThreads: 1, maxThreads: 1 },
forks: { minForks: 1, maxForks: 5 },
},
- maxConcurrency: 1,
+ fileParallelism: process.env.npm_package_name === '@hicommonwealth/model',
sequence: { concurrent: false },
coverage: {
include: ['src/**/*.ts'],
From b077d5391774f892cd6cc4ba4b276bf8bba5b4f9 Mon Sep 17 00:00:00 2001
From: Ryan Bennett
Date: Thu, 21 Nov 2024 12:34:52 -0800
Subject: [PATCH 192/227] lint
---
.../server/workers/commonwealthConsumer/commonwealthConsumer.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/packages/commonwealth/server/workers/commonwealthConsumer/commonwealthConsumer.ts b/packages/commonwealth/server/workers/commonwealthConsumer/commonwealthConsumer.ts
index 6a058409e04..f697c64a144 100644
--- a/packages/commonwealth/server/workers/commonwealthConsumer/commonwealthConsumer.ts
+++ b/packages/commonwealth/server/workers/commonwealthConsumer/commonwealthConsumer.ts
@@ -172,7 +172,7 @@ function startRolloverLoop() {
// TODO: move to external service triggered via scheduler?
setInterval(() => {
- loop();
+ loop().catch(console.error);
}, 1_000 * 60);
}
From 766b89994ed20e6df2471e12ecb827e8ac3672a9 Mon Sep 17 00:00:00 2001
From: rotorsoft
Date: Thu, 21 Nov 2024 15:40:36 -0500
Subject: [PATCH 193/227] fix test
---
packages/commonwealth/test/devnet/evm/evmChainEvents.spec.ts | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/packages/commonwealth/test/devnet/evm/evmChainEvents.spec.ts b/packages/commonwealth/test/devnet/evm/evmChainEvents.spec.ts
index 14df8a4159a..c82eaefa845 100644
--- a/packages/commonwealth/test/devnet/evm/evmChainEvents.spec.ts
+++ b/packages/commonwealth/test/devnet/evm/evmChainEvents.spec.ts
@@ -21,6 +21,7 @@ import {
delay,
} from '@hicommonwealth/shared';
import { Anvil } from '@viem/anvil';
+import { bootstrap_testing } from 'node_modules/@hicommonwealth/model/src/tester';
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
import { z } from 'zod';
import {
@@ -332,6 +333,10 @@ describe('EVM Chain Events Devnet Tests', () => {
let chainNode: ChainNodeInstance;
beforeAll(async () => {
+ // bootstrapping here to reset the db
+ // and avoid conflicts with other tests using same chain
+ await bootstrap_testing();
+
chainNode = await models.ChainNode.create({
url: localRpc,
balance_type: BalanceType.Ethereum,
From 366580b6a4eab04ebe9800187ec33c35fc4219f4 Mon Sep 17 00:00:00 2001
From: Ryan Bennett
Date: Thu, 21 Nov 2024 13:11:07 -0800
Subject: [PATCH 194/227] move to policy
---
libs/core/src/integration/events.schemas.ts | 4 +
libs/core/src/integration/events.ts | 10 +
.../src/contest/CheckContests.command.ts | 71 -------
.../PerformContestRollovers.command.ts | 131 -------------
libs/model/src/contest/index.ts | 2 -
.../src/policies/ContestWorker.policy.ts | 182 +++++++++++++++++-
.../model/test/contest/check-contests.spec.ts | 15 +-
.../contest-worker-policy-lifecycle.spec.ts | 28 +--
.../commonwealthConsumer.ts | 28 +--
9 files changed, 222 insertions(+), 249 deletions(-)
delete mode 100644 libs/model/src/contest/CheckContests.command.ts
delete mode 100644 libs/model/src/contest/PerformContestRollovers.command.ts
diff --git a/libs/core/src/integration/events.schemas.ts b/libs/core/src/integration/events.schemas.ts
index 0267466738d..3b00244c3de 100644
--- a/libs/core/src/integration/events.schemas.ts
+++ b/libs/core/src/integration/events.schemas.ts
@@ -262,3 +262,7 @@ export const FarcasterReplyCastCreated = FarcasterCast.describe(
export const FarcasterVoteCreated = FarcasterAction.extend({
contest_address: z.string(),
}).describe('When a farcaster action is initiated on a cast reply');
+
+export const CheckContests = z.object({});
+
+export const RolloverContests = z.object({});
diff --git a/libs/core/src/integration/events.ts b/libs/core/src/integration/events.ts
index b546c221884..72771fe6581 100644
--- a/libs/core/src/integration/events.ts
+++ b/libs/core/src/integration/events.ts
@@ -35,6 +35,8 @@ export enum EventNames {
FarcasterCastCreated = 'FarcasterCastCreated',
FarcasterReplyCastCreated = 'FarcasterReplyCastCreated',
FarcasterVoteCreated = 'FarcasterVoteCreated',
+ CheckContests = 'CheckContests',
+ RolloverContests = 'RolloverContests',
// Preferences
SubscriptionPreferencesUpdated = 'SubscriptionPreferencesUpdated',
@@ -113,6 +115,14 @@ export type EventPairs =
event_name: EventNames.FarcasterVoteCreated;
event_payload: z.infer;
}
+ | {
+ event_name: EventNames.CheckContests;
+ event_payload: z.infer;
+ }
+ | {
+ event_name: EventNames.RolloverContests;
+ event_payload: z.infer;
+ }
| {
event_name: EventNames.DiscordThreadCreated;
event_payload: z.infer;
diff --git a/libs/model/src/contest/CheckContests.command.ts b/libs/model/src/contest/CheckContests.command.ts
deleted file mode 100644
index 6fd47cfe03d..00000000000
--- a/libs/model/src/contest/CheckContests.command.ts
+++ /dev/null
@@ -1,71 +0,0 @@
-import { Actor, logger, query, type Command } from '@hicommonwealth/core';
-import * as schemas from '@hicommonwealth/schemas';
-import moment from 'moment';
-import Web3 from 'web3';
-import { config } from '../config';
-import { createOnchainContestVote } from '../policies/contest-utils';
-import { GetActiveContestManagers } from './GetActiveContestManagers.query';
-
-const log = logger(import.meta);
-
-const getPrivateWalletAddress = () => {
- const web3 = new Web3();
- const privateKey = config.WEB3.PRIVATE_KEY;
- const account = web3.eth.accounts.privateKeyToAccount(privateKey);
- const publicAddress = account.address;
- return publicAddress;
-};
-
-export function CheckContests(): Command {
- return {
- ...schemas.CheckContests,
- auth: [],
- body: async () => {
- const activeContestManagers = await query(GetActiveContestManagers(), {
- actor: {} as Actor,
- payload: {},
- });
- // find active contests that have content with no upvotes and will end in one hour
- const contestsWithoutVote = activeContestManagers!.filter(
- (contestManager) =>
- contestManager.actions.some((action) => action.action === 'added') &&
- !contestManager.actions.some(
- (action) => action.action === 'upvoted',
- ) &&
- moment(contestManager.end_time).diff(moment(), 'minutes') < 60,
- );
-
- const promises = contestsWithoutVote.map(async (contestManager) => {
- // add onchain vote to the first content
- const firstContent = contestManager.actions.find(
- (action) => action.action === 'added',
- );
-
- await createOnchainContestVote({
- contestManagers: [
- {
- url: contestManager.url,
- contest_address: contestManager.contest_address,
- content_id: firstContent!.content_id,
- },
- ],
- content_url: firstContent!.content_url!,
- author_address: getPrivateWalletAddress(),
- });
- });
-
- const promiseResults = await Promise.allSettled(promises);
-
- const errors = promiseResults
- .filter(({ status }) => status === 'rejected')
- .map(
- (result) =>
- (result as PromiseRejectedResult).reason || '',
- );
-
- if (errors.length > 0) {
- log.error(`CheckContests: failed with errors: ${errors.join(', ')}"`);
- }
- },
- };
-}
diff --git a/libs/model/src/contest/PerformContestRollovers.command.ts b/libs/model/src/contest/PerformContestRollovers.command.ts
deleted file mode 100644
index eb27a26456b..00000000000
--- a/libs/model/src/contest/PerformContestRollovers.command.ts
+++ /dev/null
@@ -1,131 +0,0 @@
-import { logger, type Command } from '@hicommonwealth/core';
-import * as schemas from '@hicommonwealth/schemas';
-import { NeynarAPIClient } from '@neynar/nodejs-sdk';
-import { QueryTypes } from 'sequelize';
-import { config } from '../config';
-import { models } from '../database';
-import { rollOverContest } from '../services/commonProtocol/contestHelper';
-import { getChainNodeUrl } from '../utils/utils';
-
-const log = logger(import.meta);
-
-export function PerformContestRollovers(): Command<
- typeof schemas.PerformContestRollovers
-> {
- return {
- ...schemas.PerformContestRollovers,
- auth: [],
- body: async () => {
- const contestManagersWithEndedContest = await models.sequelize.query<{
- contest_address: string;
- interval: number;
- ended: boolean;
- url: string;
- private_url: string;
- neynar_webhook_id?: string;
- }>(
- `
- SELECT cm.contest_address,
- cm.interval,
- cm.ended,
- cm.neynar_webhook_id,
- co.end_time,
- cn.private_url,
- cn.url
- FROM "ContestManagers" cm
- JOIN (SELECT *
- FROM "Contests"
- WHERE (contest_address, contest_id) IN (SELECT contest_address, MAX(contest_id) AS contest_id
- FROM "Contests"
- GROUP BY contest_address)) co
- ON co.contest_address = cm.contest_address
- AND (
- (cm.interval = 0 AND cm.ended IS NOT TRUE)
- OR
- cm.interval > 0
- )
- AND NOW() > co.end_time
- AND cm.cancelled IS NOT TRUE
- JOIN "Communities" cu ON cm.community_id = cu.id
- JOIN "ChainNodes" cn ON cu.chain_node_id = cn.id;
- `,
- {
- type: QueryTypes.SELECT,
- raw: true,
- },
- );
-
- const contestRolloverPromises = contestManagersWithEndedContest.map(
- async ({
- url,
- private_url,
- contest_address,
- interval,
- ended,
- neynar_webhook_id,
- }) => {
- log.info(`ROLLOVER: ${contest_address}`);
-
- if (interval === 0 && !ended) {
- // preemptively mark as ended so that rollover
- // is not attempted again after failure
- await models.ContestManager.update(
- {
- ended: true,
- },
- {
- where: {
- contest_address,
- },
- },
- );
- }
-
- await rollOverContest(
- getChainNodeUrl({ url, private_url }),
- contest_address,
- interval === 0,
- );
-
- // clean up neynar webhooks when farcaster contest ends
- if (neynar_webhook_id) {
- try {
- const client = new NeynarAPIClient(
- config.CONTESTS.NEYNAR_API_KEY!,
- );
- await client.deleteWebhook(neynar_webhook_id);
- await models.ContestManager.update(
- {
- neynar_webhook_id: null,
- neynar_webhook_secret: null,
- },
- {
- where: {
- contest_address,
- },
- },
- );
- } catch (err) {
- log.warn(`failed to delete neynar webhook: ${neynar_webhook_id}`);
- }
- }
- },
- );
-
- const promiseResults = await Promise.allSettled(contestRolloverPromises);
-
- const errors = promiseResults
- .filter(({ status }) => status === 'rejected')
- .map(
- (result) =>
- (result as PromiseRejectedResult).reason || '',
- );
-
- if (errors.length > 0) {
- log.error(
- `PerformContestRollovers: failed with errors: ${errors.join(', ')}"`,
- );
- }
- },
- };
-}
diff --git a/libs/model/src/contest/index.ts b/libs/model/src/contest/index.ts
index 8bc5ddd9e89..10c0ec7082f 100644
--- a/libs/model/src/contest/index.ts
+++ b/libs/model/src/contest/index.ts
@@ -1,5 +1,4 @@
export * from './CancelContestManagerMetadata.command';
-export * from './CheckContests.command';
export * from './Contests.projection';
export * from './CreateContestManagerMetadata.command';
export * from './FarcasterCastCreatedWebhook.command';
@@ -11,5 +10,4 @@ export * from './GetContest.query';
export * from './GetContestLog.query';
export * from './GetFarcasterContestCasts';
export * from './GetFarcasterUpvoteActionMetadata.query';
-export * from './PerformContestRollovers.command';
export * from './UpdateContestManagerMetadata.command';
diff --git a/libs/model/src/policies/ContestWorker.policy.ts b/libs/model/src/policies/ContestWorker.policy.ts
index 12139e17a4c..d90cb6b744d 100644
--- a/libs/model/src/policies/ContestWorker.policy.ts
+++ b/libs/model/src/policies/ContestWorker.policy.ts
@@ -1,6 +1,11 @@
import { Actor, events, logger, Policy } from '@hicommonwealth/core';
+import { NeynarAPIClient } from '@neynar/nodejs-sdk';
+import moment from 'moment';
import { QueryTypes } from 'sequelize';
-import { Contest, models } from '..';
+import Web3 from 'web3';
+import { config, Contest, models } from '..';
+import { GetActiveContestManagers } from '../contest';
+import { rollOverContest } from '../services/commonProtocol/contestHelper';
import { buildThreadContentUrl, getChainNodeUrl } from '../utils';
import {
createOnchainContestContent,
@@ -12,6 +17,16 @@ const log = logger(import.meta);
const inputs = {
ThreadCreated: events.ThreadCreated,
ThreadUpvoted: events.ThreadUpvoted,
+ CheckContests: events.CheckContests,
+ RolloverContests: events.RolloverContests,
+};
+
+const getPrivateWalletAddress = () => {
+ const web3 = new Web3();
+ const privateKey = config.WEB3.PRIVATE_KEY;
+ const account = web3.eth.accounts.privateKeyToAccount(privateKey);
+ const publicAddress = account.address;
+ return publicAddress;
};
export function ContestWorker(): Policy {
@@ -129,6 +144,171 @@ export function ContestWorker(): Policy {
author_address: payload.address!,
});
},
+ CheckContests: async ({ payload }) => {
+ const activeContestManagers = await GetActiveContestManagers().body({
+ actor: {} as Actor,
+ payload: {},
+ });
+ // find active contests that have content with no upvotes and will end in one hour
+ const contestsWithoutVote = activeContestManagers!.filter(
+ (contestManager) =>
+ contestManager.actions.some(
+ (action) => action.action === 'added',
+ ) &&
+ !contestManager.actions.some(
+ (action) => action.action === 'upvoted',
+ ) &&
+ moment(contestManager.end_time).diff(moment(), 'minutes') < 60,
+ );
+
+ const promises = contestsWithoutVote.map(async (contestManager) => {
+ // add onchain vote to the first content
+ const firstContent = contestManager.actions.find(
+ (action) => action.action === 'added',
+ );
+
+ await createOnchainContestVote({
+ contestManagers: [
+ {
+ url: contestManager.url,
+ contest_address: contestManager.contest_address,
+ content_id: firstContent!.content_id,
+ },
+ ],
+ content_url: firstContent!.content_url!,
+ author_address: getPrivateWalletAddress(),
+ });
+ });
+
+ const promiseResults = await Promise.allSettled(promises);
+
+ const errors = promiseResults
+ .filter(({ status }) => status === 'rejected')
+ .map(
+ (result) =>
+ (result as PromiseRejectedResult).reason || '',
+ );
+
+ if (errors.length > 0) {
+ log.error(`CheckContests: failed with errors: ${errors.join(', ')}"`);
+ }
+ },
+ RolloverContests: async ({ payload }) => {
+ const contestManagersWithEndedContest = await models.sequelize.query<{
+ contest_address: string;
+ interval: number;
+ ended: boolean;
+ url: string;
+ private_url: string;
+ neynar_webhook_id?: string;
+ }>(
+ `
+ SELECT cm.contest_address,
+ cm.interval,
+ cm.ended,
+ cm.neynar_webhook_id,
+ co.end_time,
+ cn.private_url,
+ cn.url
+ FROM "ContestManagers" cm
+ JOIN (SELECT *
+ FROM "Contests"
+ WHERE (contest_address, contest_id) IN (SELECT contest_address, MAX(contest_id) AS contest_id
+ FROM "Contests"
+ GROUP BY contest_address)) co
+ ON co.contest_address = cm.contest_address
+ AND (
+ (cm.interval = 0 AND cm.ended IS NOT TRUE)
+ OR
+ cm.interval > 0
+ )
+ AND NOW() > co.end_time
+ AND cm.cancelled IS NOT TRUE
+ JOIN "Communities" cu ON cm.community_id = cu.id
+ JOIN "ChainNodes" cn ON cu.chain_node_id = cn.id;
+ `,
+ {
+ type: QueryTypes.SELECT,
+ raw: true,
+ },
+ );
+
+ const contestRolloverPromises = contestManagersWithEndedContest.map(
+ async ({
+ url,
+ private_url,
+ contest_address,
+ interval,
+ ended,
+ neynar_webhook_id,
+ }) => {
+ log.info(`ROLLOVER: ${contest_address}`);
+
+ if (interval === 0 && !ended) {
+ // preemptively mark as ended so that rollover
+ // is not attempted again after failure
+ await models.ContestManager.update(
+ {
+ ended: true,
+ },
+ {
+ where: {
+ contest_address,
+ },
+ },
+ );
+ }
+
+ await rollOverContest(
+ getChainNodeUrl({ url, private_url }),
+ contest_address,
+ interval === 0,
+ );
+
+ // clean up neynar webhooks when farcaster contest ends
+ if (neynar_webhook_id) {
+ try {
+ const client = new NeynarAPIClient(
+ config.CONTESTS.NEYNAR_API_KEY!,
+ );
+ await client.deleteWebhook(neynar_webhook_id);
+ await models.ContestManager.update(
+ {
+ neynar_webhook_id: null,
+ neynar_webhook_secret: null,
+ },
+ {
+ where: {
+ contest_address,
+ },
+ },
+ );
+ } catch (err) {
+ log.warn(
+ `failed to delete neynar webhook: ${neynar_webhook_id}`,
+ );
+ }
+ }
+ },
+ );
+
+ const promiseResults = await Promise.allSettled(
+ contestRolloverPromises,
+ );
+
+ const errors = promiseResults
+ .filter(({ status }) => status === 'rejected')
+ .map(
+ (result) =>
+ (result as PromiseRejectedResult).reason || '',
+ );
+
+ if (errors.length > 0) {
+ log.error(
+ `PerformContestRollovers: failed with errors: ${errors.join(', ')}"`,
+ );
+ }
+ },
},
};
}
diff --git a/libs/model/test/contest/check-contests.spec.ts b/libs/model/test/contest/check-contests.spec.ts
index 72dfb6520dd..0fdd2aa3cdc 100644
--- a/libs/model/test/contest/check-contests.spec.ts
+++ b/libs/model/test/contest/check-contests.spec.ts
@@ -1,6 +1,6 @@
import Sinon from 'sinon';
-import { Actor, command, dispose, EventNames } from '@hicommonwealth/core';
+import { dispose, EventNames, handleEvent } from '@hicommonwealth/core';
import {
commonProtocol,
ContestWorker,
@@ -9,7 +9,6 @@ import {
} from '@hicommonwealth/model';
import { expect } from 'chai';
import { Contests } from 'model/src/contest';
-import { CheckContests } from 'model/src/contest/CheckContests.command';
import { literal } from 'sequelize';
import { afterAll, beforeAll, describe, test } from 'vitest';
import { bootstrap_testing, seed } from '../../src/tester';
@@ -168,9 +167,9 @@ describe('Check Contests', () => {
},
);
- await command(CheckContests(), {
- actor: {} as Actor,
- payload: { id: '' },
+ await handleEvent(ContestWorker(), {
+ name: EventNames.CheckContests,
+ payload: {},
});
expect(voteContentStub.called, 'vote should not be cast yet').to.be.false;
@@ -188,9 +187,9 @@ describe('Check Contests', () => {
},
);
- await command(CheckContests(), {
- actor: {} as Actor,
- payload: { id: '' },
+ await handleEvent(ContestWorker(), {
+ name: EventNames.CheckContests,
+ payload: {},
});
expect(voteContentStub.called, 'vote should have been cast').to.be.true;
diff --git a/libs/model/test/contest/contest-worker-policy-lifecycle.spec.ts b/libs/model/test/contest/contest-worker-policy-lifecycle.spec.ts
index 64bebcc7472..9fe68070621 100644
--- a/libs/model/test/contest/contest-worker-policy-lifecycle.spec.ts
+++ b/libs/model/test/contest/contest-worker-policy-lifecycle.spec.ts
@@ -1,10 +1,10 @@
import { expect } from 'chai';
import Sinon from 'sinon';
-import { Actor, command, dispose, EventNames } from '@hicommonwealth/core';
+import { dispose, EventNames, handleEvent } from '@hicommonwealth/core';
import { literal } from 'sequelize';
import { afterAll, beforeAll, describe, test } from 'vitest';
-import { commonProtocol, Contest, emitEvent, models } from '../../src';
+import { commonProtocol, emitEvent, models } from '../../src';
import { Contests } from '../../src/contest';
import { ContestWorker } from '../../src/policies';
import { bootstrap_testing, seed } from '../../src/tester';
@@ -179,14 +179,10 @@ describe('Contest Worker Policy Lifecycle', () => {
expect(voteContentStub.called, 'voteContent was not called').to.be.true;
- command(
- Contest.PerformContestRollovers(),
- {
- actor: {} as Actor,
- payload: { id: '' },
- },
- false,
- );
+ await handleEvent(ContestWorker(), {
+ name: EventNames.RolloverContests,
+ payload: {},
+ });
const contestManagerBeforeContestEnded =
await models.ContestManager.findByPk(contestAddress);
@@ -209,14 +205,10 @@ describe('Contest Worker Policy Lifecycle', () => {
},
);
- await command(
- Contest.PerformContestRollovers(),
- {
- actor: {} as Actor,
- payload: { id: '' },
- },
- false,
- );
+ await handleEvent(ContestWorker(), {
+ name: EventNames.RolloverContests,
+ payload: {},
+ });
const contestManagerAfterContestEnded =
await models.ContestManager.findByPk(contestAddress);
diff --git a/packages/commonwealth/server/workers/commonwealthConsumer/commonwealthConsumer.ts b/packages/commonwealth/server/workers/commonwealthConsumer/commonwealthConsumer.ts
index f697c64a144..1f8eb63faf6 100644
--- a/packages/commonwealth/server/workers/commonwealthConsumer/commonwealthConsumer.ts
+++ b/packages/commonwealth/server/workers/commonwealthConsumer/commonwealthConsumer.ts
@@ -8,11 +8,11 @@ import {
startHealthCheckLoop,
} from '@hicommonwealth/adapters';
import {
- Actor,
Broker,
BrokerSubscriptions,
+ EventNames,
broker,
- command,
+ handleEvent,
logger,
stats,
} from '@hicommonwealth/core';
@@ -144,27 +144,19 @@ function startRolloverLoop() {
const loop = async () => {
try {
- await command(
- Contest.CheckContests(),
- {
- actor: {} as Actor,
- payload: { id: '' },
- },
- false,
- );
+ await handleEvent(ContestWorker(), {
+ name: EventNames.CheckContests,
+ payload: {},
+ });
} catch (err) {
log.error(err);
}
try {
- await command(
- Contest.PerformContestRollovers(),
- {
- actor: {} as Actor,
- payload: { id: '' },
- },
- false,
- );
+ await handleEvent(ContestWorker(), {
+ name: EventNames.RolloverContests,
+ payload: {},
+ });
} catch (err) {
log.error(err);
}
From 3de6fdc780edb0eff3aad910f9dfae01db09b8c5 Mon Sep 17 00:00:00 2001
From: Ryan Bennett
Date: Thu, 21 Nov 2024 13:16:18 -0800
Subject: [PATCH 195/227] fix type
---
libs/core/src/integration/outbox.schema.ts | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/libs/core/src/integration/outbox.schema.ts b/libs/core/src/integration/outbox.schema.ts
index 5605365b806..8d6e0ae44cb 100644
--- a/libs/core/src/integration/outbox.schema.ts
+++ b/libs/core/src/integration/outbox.schema.ts
@@ -125,6 +125,18 @@ export const Outbox = z.union([
event_payload: events.FarcasterVoteCreated,
})
.merge(BaseOutboxProperties),
+ z
+ .object({
+ event_name: z.literal(EventNames.CheckContests),
+ event_payload: events.CheckContests,
+ })
+ .merge(BaseOutboxProperties),
+ z
+ .object({
+ event_name: z.literal(EventNames.RolloverContests),
+ event_payload: events.RolloverContests,
+ })
+ .merge(BaseOutboxProperties),
z
.object({
event_name: z.literal(EventNames.DiscordThreadCreated),
From 923a527d8a7cf031bae1c20dcd478895e9567a66 Mon Sep 17 00:00:00 2001
From: Ryan Bennett
Date: Thu, 21 Nov 2024 13:18:13 -0800
Subject: [PATCH 196/227] lint
---
libs/model/src/policies/ContestWorker.policy.ts | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libs/model/src/policies/ContestWorker.policy.ts b/libs/model/src/policies/ContestWorker.policy.ts
index d90cb6b744d..419d56365b3 100644
--- a/libs/model/src/policies/ContestWorker.policy.ts
+++ b/libs/model/src/policies/ContestWorker.policy.ts
@@ -144,7 +144,7 @@ export function ContestWorker(): Policy {
author_address: payload.address!,
});
},
- CheckContests: async ({ payload }) => {
+ CheckContests: async () => {
const activeContestManagers = await GetActiveContestManagers().body({
actor: {} as Actor,
payload: {},
@@ -193,7 +193,7 @@ export function ContestWorker(): Policy {
log.error(`CheckContests: failed with errors: ${errors.join(', ')}"`);
}
},
- RolloverContests: async ({ payload }) => {
+ RolloverContests: async () => {
const contestManagersWithEndedContest = await models.sequelize.query<{
contest_address: string;
interval: number;
From 6cb91a989d44d676997202d5311e17a854334dac Mon Sep 17 00:00:00 2001
From: Ryan Bennett
Date: Thu, 21 Nov 2024 13:23:14 -0800
Subject: [PATCH 197/227] remove schemas
---
libs/schemas/src/commands/contest.schemas.ts | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/libs/schemas/src/commands/contest.schemas.ts b/libs/schemas/src/commands/contest.schemas.ts
index 1fc3ef4462f..d4268422795 100644
--- a/libs/schemas/src/commands/contest.schemas.ts
+++ b/libs/schemas/src/commands/contest.schemas.ts
@@ -78,16 +78,6 @@ export const ResumeContestManagerMetadata = {
context: AuthContext,
};
-export const PerformContestRollovers = {
- input: z.object({ id: z.string() }),
- output: z.object({}),
-};
-
-export const CheckContests = {
- input: z.object({ id: z.string() }),
- output: z.object({}),
-};
-
export const FarcasterCast = z.object({
object: z.string(),
hash: z.string(),
From 05f009174697d80457ad1b616e8f3087bba347b1 Mon Sep 17 00:00:00 2001
From: Ryan Bennett
Date: Thu, 21 Nov 2024 13:40:14 -0800
Subject: [PATCH 198/227] types
---
libs/core/src/integration/events.ts | 8 --------
libs/core/src/integration/outbox.schema.ts | 12 ------------
2 files changed, 20 deletions(-)
diff --git a/libs/core/src/integration/events.ts b/libs/core/src/integration/events.ts
index 72771fe6581..47558f6566c 100644
--- a/libs/core/src/integration/events.ts
+++ b/libs/core/src/integration/events.ts
@@ -115,14 +115,6 @@ export type EventPairs =
event_name: EventNames.FarcasterVoteCreated;
event_payload: z.infer;
}
- | {
- event_name: EventNames.CheckContests;
- event_payload: z.infer;
- }
- | {
- event_name: EventNames.RolloverContests;
- event_payload: z.infer;
- }
| {
event_name: EventNames.DiscordThreadCreated;
event_payload: z.infer;
diff --git a/libs/core/src/integration/outbox.schema.ts b/libs/core/src/integration/outbox.schema.ts
index 8d6e0ae44cb..5605365b806 100644
--- a/libs/core/src/integration/outbox.schema.ts
+++ b/libs/core/src/integration/outbox.schema.ts
@@ -125,18 +125,6 @@ export const Outbox = z.union([
event_payload: events.FarcasterVoteCreated,
})
.merge(BaseOutboxProperties),
- z
- .object({
- event_name: z.literal(EventNames.CheckContests),
- event_payload: events.CheckContests,
- })
- .merge(BaseOutboxProperties),
- z
- .object({
- event_name: z.literal(EventNames.RolloverContests),
- event_payload: events.RolloverContests,
- })
- .merge(BaseOutboxProperties),
z
.object({
event_name: z.literal(EventNames.DiscordThreadCreated),
From a3fda6de6929eeba77888a463ff413cd9214b0f0 Mon Sep 17 00:00:00 2001
From: Timothee Legros
Date: Fri, 22 Nov 2024 02:24:28 +0200
Subject: [PATCH 199/227] create EventRegistry
---
.../core/src/integration/chain-event.utils.ts | 422 ------------------
libs/core/src/integration/index.ts | 1 -
.../src/common-protocol/chainConfig.ts | 12 +-
.../src/event-registry/eventRegistry.ts | 121 ++++-
.../src/event-registry/eventSignatures.ts | 7 +
.../chain-events/ChainEventCreated.command.ts | 50 +--
.../src/token/CreateLaunchpadTrade.command.ts | 2 +-
.../chainEventCreated/handleLaunchpadTrade.ts | 18 +-
8 files changed, 172 insertions(+), 461 deletions(-)
delete mode 100644 libs/core/src/integration/chain-event.utils.ts
diff --git a/libs/core/src/integration/chain-event.utils.ts b/libs/core/src/integration/chain-event.utils.ts
deleted file mode 100644
index 4e8972620ef..00000000000
--- a/libs/core/src/integration/chain-event.utils.ts
+++ /dev/null
@@ -1,422 +0,0 @@
-import { EventNames, EventPairs } from '@hicommonwealth/core';
-import {
- EvmEventSignature,
- EvmEventSignatures,
-} from '@hicommonwealth/evm-protocols';
-import { ETHERS_BIG_NUMBER, EVM_ADDRESS } from '@hicommonwealth/schemas';
-import { BigNumber } from 'ethers';
-import { decodeLog } from 'web3-eth-abi';
-import { z } from 'zod';
-
-/**
- * To add a new chain-event:
- * 1. Add the event signature to EvmEventSignatures
- * 2. Create a Zod schema for the Common equivalent of the parsed event and add it to ChainEventSchemas
- * 3. Add the Event inputs ABI to EvmEventAbis
- * 4. Create a mapping function that implements the EventMapper type
- * 5. Add the new mapper to the EvmMappers object
- */
-
-// Event Inputs can be found in the contract ABI by filtering the objects by type = 'event' e.g.:
-// for (const obj of abi) {
-// if (obj.type === 'event') console.log(obj)
-// }
-// WARN: adding explicit types to this variable breaks DecodedEvmEvent log type for some reason
-export const EvmEventAbis = {
- [EvmEventSignatures.CommunityStake.Trade]: [
- {
- name: 'trader',
- type: 'address',
- indexed: false,
- internalType: 'address',
- },
- {
- name: 'namespace',
- type: 'address',
- indexed: false,
- internalType: 'address',
- },
- {
- name: 'isBuy',
- type: 'bool',
- indexed: false,
- internalType: 'bool',
- },
- {
- name: 'communityTokenAmount',
- type: 'uint256',
- indexed: false,
- internalType: 'uint256',
- },
- {
- name: 'ethAmount',
- type: 'uint256',
- indexed: false,
- internalType: 'uint256',
- },
- {
- name: 'protocolEthAmount',
- type: 'uint256',
- indexed: false,
- internalType: 'uint256',
- },
- {
- name: 'nameSpaceEthAmount',
- type: 'uint256',
- indexed: false,
- internalType: 'uint256',
- },
- {
- name: 'supply',
- type: 'uint256',
- indexed: false,
- internalType: 'uint256',
- },
- {
- name: 'exchangeToken',
- type: 'address',
- indexed: false,
- internalType: 'address',
- },
- ] as const,
- [EvmEventSignatures.NamespaceFactory.NamespaceDeployed]: [
- {
- name: 'name',
- type: 'string',
- indexed: false,
- internalType: 'string',
- },
- {
- name: '_feeManager',
- type: 'address',
- indexed: false,
- internalType: 'address',
- },
- {
- name: '_signature',
- type: 'bytes',
- indexed: false,
- internalType: 'bytes',
- },
- {
- name: '_namespaceDeployer',
- type: 'address',
- indexed: false,
- internalType: 'address',
- },
- ] as const,
- [EvmEventSignatures.NamespaceFactory.ContestManagerDeployed]: [
- {
- name: 'contest',
- type: 'address',
- indexed: false,
- internalType: 'address',
- },
- {
- name: 'namespace',
- type: 'address',
- indexed: false,
- internalType: 'address',
- },
- {
- name: 'interval',
- type: 'uint256',
- indexed: false,
- internalType: 'uint256',
- },
- {
- name: 'oneOff',
- type: 'bool',
- indexed: false,
- internalType: 'bool',
- },
- ] as const,
- [EvmEventSignatures.Contests.RecurringContestStarted]: [
- {
- name: 'contestId',
- type: 'uint256',
- indexed: true,
- internalType: 'uint256',
- },
- {
- name: 'startTime',
- type: 'uint256',
- indexed: false,
- internalType: 'uint256',
- },
- {
- name: 'endTime',
- type: 'uint256',
- indexed: false,
- internalType: 'uint256',
- },
- ] as const,
- [EvmEventSignatures.Contests.SingleContestStarted]: [
- {
- name: 'startTime',
- type: 'uint256',
- indexed: false,
- internalType: 'uint256',
- },
- {
- name: 'endTime',
- type: 'uint256',
- indexed: false,
- internalType: 'uint256',
- },
- ] as const,
- [EvmEventSignatures.Contests.ContentAdded]: [
- {
- name: 'contentId',
- type: 'uint256',
- indexed: true,
- internalType: 'uint256',
- },
- {
- name: 'creator',
- type: 'address',
- indexed: true,
- internalType: 'address',
- },
- {
- name: 'url',
- type: 'string',
- indexed: false,
- internalType: 'string',
- },
- ] as const,
- [EvmEventSignatures.Contests.RecurringContestVoterVoted]: [
- {
- name: 'voter',
- type: 'address',
- indexed: true,
- internalType: 'address',
- },
- {
- name: 'contentId',
- type: 'uint256',
- indexed: true,
- internalType: 'uint256',
- },
- {
- name: 'contestId',
- type: 'uint256',
- indexed: false,
- internalType: 'uint256',
- },
- {
- name: 'votingPower',
- type: 'uint256',
- indexed: false,
- internalType: 'uint256',
- },
- ] as const,
- [EvmEventSignatures.Contests.SingleContestVoterVoted]: [
- {
- name: 'voter',
- type: 'address',
- indexed: true,
- internalType: 'address',
- },
- {
- name: 'contentId',
- type: 'uint256',
- indexed: true,
- internalType: 'uint256',
- },
- {
- name: 'votingPower',
- type: 'uint256',
- indexed: false,
- internalType: 'uint256',
- },
- ] as const,
-};
-
-type AbiTypeToTS = T extends 'address'
- ? z.infer
- : T extends 'uint256'
- ? z.infer
- : T extends 'bool'
- ? boolean
- : never;
-
-type Transform> = {
- [K in T[number] as K['name']]: AbiTypeToTS;
-};
-
-type DecodedEvmEvent = Transform<
- (typeof EvmEventAbis)[Signature]
->;
-
-// EvmMapper maps chain event args as input to a zod event schema type as output
-type EvmMapper = {
- signature: Signature;
- condition?: (obj: DecodedEvmEvent) => boolean;
- mapEvmToSchema: (
- contestAddress: string,
- decodedEvmEvent: DecodedEvmEvent,
- ) => EventPairs;
-};
-
-const RecurringContestManagerDeployedMapper: EvmMapper<
- typeof EvmEventSignatures.NamespaceFactory.ContestManagerDeployed
-> = {
- signature: EvmEventSignatures.NamespaceFactory.ContestManagerDeployed,
- condition: (evmInput) => !evmInput.oneOff,
- mapEvmToSchema: (
- contestAddress,
- { contest, namespace, interval, oneOff: _ },
- ) => ({
- event_name: EventNames.RecurringContestManagerDeployed,
- event_payload: {
- contest_address: contest,
- namespace: namespace,
- interval: BigNumber.from(interval).toNumber(),
- },
- }),
-};
-
-const OneOffContestManagerDeployedMapper: EvmMapper<
- typeof EvmEventSignatures.NamespaceFactory.ContestManagerDeployed
-> = {
- signature: EvmEventSignatures.NamespaceFactory.ContestManagerDeployed,
- condition: (evmInput) => evmInput.oneOff,
- mapEvmToSchema: (
- contestAddress,
- { contest, namespace, interval, oneOff: _ },
- ) => ({
- event_name: EventNames.OneOffContestManagerDeployed,
- event_payload: {
- contest_address: contest,
- namespace: namespace,
- length: BigNumber.from(interval).toNumber(),
- },
- }),
-};
-
-const SingleContestStartedMapper: EvmMapper<
- typeof EvmEventSignatures.Contests.SingleContestStarted
-> = {
- signature: EvmEventSignatures.Contests.SingleContestStarted,
- mapEvmToSchema: (contestAddress, { startTime, endTime }) => ({
- event_name: EventNames.ContestStarted,
- event_payload: {
- contest_address: contestAddress!,
- contest_id: 0,
- start_time: new Date(BigNumber.from(startTime).toNumber() * 1000),
- end_time: new Date(BigNumber.from(endTime).toNumber() * 1000),
- },
- }),
-};
-
-const RecurringContestStartedMapper: EvmMapper<
- typeof EvmEventSignatures.Contests.RecurringContestStarted
-> = {
- signature: EvmEventSignatures.Contests.RecurringContestStarted,
- mapEvmToSchema: (contestAddress, { contestId, startTime, endTime }) => ({
- event_name: EventNames.ContestStarted,
- event_payload: {
- contest_address: contestAddress!,
- contest_id: BigNumber.from(contestId).toNumber(),
- start_time: new Date(BigNumber.from(startTime).toNumber() * 1000),
- end_time: new Date(BigNumber.from(endTime).toNumber() * 1000),
- },
- }),
-};
-
-const ContestContentAddedMapper: EvmMapper<
- typeof EvmEventSignatures.Contests.ContentAdded
-> = {
- signature: EvmEventSignatures.Contests.ContentAdded,
- mapEvmToSchema: (contestAddress, { contentId, creator, url }) => ({
- event_name: EventNames.ContestContentAdded,
- event_payload: {
- contest_address: contestAddress!,
- content_id: BigNumber.from(contentId).toNumber(),
- creator_address: creator,
- content_url: url,
- },
- }),
-};
-
-const RecurringContestContentUpvotedMapper: EvmMapper<
- typeof EvmEventSignatures.Contests.RecurringContestVoterVoted
-> = {
- signature: EvmEventSignatures.Contests.RecurringContestVoterVoted,
- mapEvmToSchema: (
- contestAddress,
- { contestId, contentId, voter, votingPower },
- ) => ({
- event_name: EventNames.ContestContentUpvoted,
- event_payload: {
- contest_address: contestAddress!,
- contest_id: BigNumber.from(contestId).toNumber(),
- content_id: BigNumber.from(contentId).toNumber(),
- voter_address: voter,
- voting_power: BigNumber.from(votingPower).toString(),
- },
- }),
-};
-
-const SingleContestContentUpvotedMapper: EvmMapper<
- typeof EvmEventSignatures.Contests.SingleContestVoterVoted
-> = {
- signature: EvmEventSignatures.Contests.SingleContestVoterVoted,
- mapEvmToSchema: (contestAddress, { contentId, voter, votingPower }) => ({
- event_name: EventNames.ContestContentUpvoted,
- event_payload: {
- contest_address: contestAddress!,
- contest_id: BigNumber.from(0).toNumber(),
- content_id: BigNumber.from(contentId).toNumber(),
- voter_address: voter,
- voting_power: BigNumber.from(votingPower).toString(),
- },
- }),
-};
-
-const EvmMappers = {
- [EvmEventSignatures.NamespaceFactory.NamespaceDeployed]: null,
- [EvmEventSignatures.CommunityStake.Trade]: null,
- [RecurringContestManagerDeployedMapper.signature]: [
- RecurringContestManagerDeployedMapper,
- OneOffContestManagerDeployedMapper,
- ],
- [SingleContestStartedMapper.signature]: SingleContestStartedMapper,
- [RecurringContestStartedMapper.signature]: RecurringContestStartedMapper,
- [ContestContentAddedMapper.signature]: ContestContentAddedMapper,
- [RecurringContestContentUpvotedMapper.signature]:
- RecurringContestContentUpvotedMapper,
- [SingleContestContentUpvotedMapper.signature]:
- SingleContestContentUpvotedMapper,
-};
-
-export const parseEvmEvent = (
- contractAddress: string,
- eventSignature: EvmEventSignature,
- data: string,
- topics: string | Array,
-) => {
- const m = EvmMappers[eventSignature];
- if (!m) {
- throw new Error(
- `Failed find EvmMapper for event with contract address ${contractAddress} and even signature ${eventSignature}`,
- );
- }
- const mappers: EvmMapper[] = Array.isArray(m) ? m : [m];
- for (const mapper of mappers) {
- // spread operator removes the Readonly type which decodeLog function does not accept
- const decodedParams = decodeLog(
- [...EvmEventAbis[eventSignature]],
- data,
- topics,
- ) as unknown as DecodedEvmEvent;
- if (!mapper.condition || mapper.condition(decodedParams)) {
- return mapper.mapEvmToSchema(contractAddress, decodedParams);
- }
- }
-
- throw new Error(
- `Failed find EvmMapper for event with contract address ${contractAddress} and even signature ${eventSignature}`,
- );
-};
diff --git a/libs/core/src/integration/index.ts b/libs/core/src/integration/index.ts
index cb08988679e..c925a428640 100644
--- a/libs/core/src/integration/index.ts
+++ b/libs/core/src/integration/index.ts
@@ -1,5 +1,4 @@
export * from './chain-event.schemas';
-export * from './chain-event.utils';
export * from './email.schemas';
export * from './events';
export * from './events.schemas';
diff --git a/libs/evm-protocols/src/common-protocol/chainConfig.ts b/libs/evm-protocols/src/common-protocol/chainConfig.ts
index c05c686d5e2..760793304b0 100644
--- a/libs/evm-protocols/src/common-protocol/chainConfig.ts
+++ b/libs/evm-protocols/src/common-protocol/chainConfig.ts
@@ -14,9 +14,7 @@ export const STAKE_ID = 2;
export const CONTEST_VOTER_SHARE = 0;
export const CONTEST_FEE_SHARE = 100;
-// Requires a live contract for each enum chain. Add address of factory here on new deploy.
-// WARNING: ADD THE CONTRACT IN EvmEventSources TABLE VIA MIGRATION IF ADDING HERE!
-export const factoryContracts: {
+type factoryContractsType = {
[key in ValidChains]: {
factory: string;
communityStake: string;
@@ -25,7 +23,11 @@ export const factoryContracts: {
tokenCommunityManager?: string;
chainId: number;
};
-} = {
+};
+
+// Requires a live contract for each enum chain. Add address of factory here on new deploy.
+// WARNING: ADD THE CONTRACT IN EvmEventSources TABLE VIA MIGRATION IF ADDING HERE!
+export const factoryContracts = {
[ValidChains.Sepolia]: {
factory: '0xEAB6373E6a722EeC8A65Fd38b014d8B81d5Bc1d4',
communityStake: '0xf6C1B02257f0Ac4Af5a1FADd2dA8E37EC5f9E5fd',
@@ -69,4 +71,4 @@ export const factoryContracts: {
communityStake: '0xcc752fd15A7Dd0d5301b6A626316E7211352Cf62',
chainId: 42161,
},
-};
+} as const satisfies factoryContractsType;
diff --git a/libs/evm-protocols/src/event-registry/eventRegistry.ts b/libs/evm-protocols/src/event-registry/eventRegistry.ts
index 21e2bdd19db..450aace7246 100644
--- a/libs/evm-protocols/src/event-registry/eventRegistry.ts
+++ b/libs/evm-protocols/src/event-registry/eventRegistry.ts
@@ -1 +1,120 @@
-export const EventRegistry = {};
+import {
+ communityStakesAbi,
+ EvmEventSignature,
+ EvmEventSignatures,
+ launchpadFactoryAbi,
+ lpBondingCurveAbi,
+ namespaceFactoryAbi,
+ tokenCommunityManagerAbi,
+} from '@hicommonwealth/evm-protocols';
+import { factoryContracts, ValidChains } from '../common-protocol';
+
+type ContractAddresses = {
+ [key in ValidChains]:
+ | (typeof factoryContracts)[key]['factory']
+ | (typeof factoryContracts)[key]['communityStake']
+ | (key extends keyof typeof factoryContracts
+ ? 'launchpad' extends keyof (typeof factoryContracts)[key]
+ ? (typeof factoryContracts)[key]['launchpad']
+ : never
+ : never)
+ | (key extends keyof typeof factoryContracts
+ ? 'lpBondingCurve' extends keyof (typeof factoryContracts)[key]
+ ? (typeof factoryContracts)[key]['lpBondingCurve']
+ : never
+ : never)
+ | (key extends keyof typeof factoryContracts
+ ? 'tokenCommunityManager' extends keyof (typeof factoryContracts)[key]
+ ? (typeof factoryContracts)[key]['tokenCommunityManager']
+ : never
+ : never);
+};
+
+export type EventRegistryType = {
+ [key in ValidChains]: {
+ [address in ContractAddresses[key]]: {
+ abi: Readonly>;
+ eventSignatures: Array;
+ };
+ };
+};
+
+const namespaceFactorySource = {
+ abi: namespaceFactoryAbi,
+ eventSignatures: [
+ EvmEventSignatures.NamespaceFactory.ContestManagerDeployed,
+ EvmEventSignatures.NamespaceFactory.NamespaceDeployed,
+ ],
+};
+
+const communityStakesSource = {
+ abi: communityStakesAbi,
+ eventSignatures: [EvmEventSignatures.CommunityStake.Trade],
+};
+
+const launchpadSource = {
+ abi: launchpadFactoryAbi,
+ eventSignatures: [EvmEventSignatures.Launchpad.TokenLaunched],
+};
+
+const lpBondingCurveSource = {
+ abi: lpBondingCurveAbi,
+ eventSignatures: [EvmEventSignatures.Launchpad.Trade],
+};
+
+const tokenCommunityManagerSource = {
+ abi: tokenCommunityManagerAbi,
+ eventSignatures: [],
+};
+
+/**
+ * Note that this object does not contain details for contracts deployed by users
+ * at runtime. Those contracts remain in the EvmEventSources table.
+ */
+export const EventRegistry = {
+ [ValidChains.Base]: {
+ [factoryContracts[ValidChains.Base].factory]: namespaceFactorySource,
+ [factoryContracts[ValidChains.Base].communityStake]: communityStakesSource,
+ },
+ [ValidChains.SepoliaBase]: {
+ [factoryContracts[ValidChains.SepoliaBase].factory]: namespaceFactorySource,
+ [factoryContracts[ValidChains.SepoliaBase].communityStake]:
+ communityStakesSource,
+ [factoryContracts[ValidChains.SepoliaBase].launchpad]: launchpadSource,
+ [factoryContracts[ValidChains.SepoliaBase].lpBondingCurve]:
+ lpBondingCurveSource,
+ [factoryContracts[ValidChains.SepoliaBase].tokenCommunityManager]:
+ tokenCommunityManagerSource,
+ },
+ [ValidChains.Sepolia]: {
+ [factoryContracts[ValidChains.Sepolia].factory]: namespaceFactorySource,
+ [factoryContracts[ValidChains.Sepolia].communityStake]:
+ communityStakesSource,
+ },
+ [ValidChains.Blast]: {
+ [factoryContracts[ValidChains.Blast].factory]: namespaceFactorySource,
+ [factoryContracts[ValidChains.Blast].communityStake]: communityStakesSource,
+ },
+ [ValidChains.Linea]: {
+ [factoryContracts[ValidChains.Linea].factory]: namespaceFactorySource,
+ [factoryContracts[ValidChains.Linea].communityStake]: communityStakesSource,
+ },
+ [ValidChains.Optimism]: {
+ [factoryContracts[ValidChains.Optimism].factory]: namespaceFactorySource,
+ [factoryContracts[ValidChains.Optimism].communityStake]:
+ communityStakesSource,
+ },
+ [ValidChains.Mainnet]: {
+ [factoryContracts[ValidChains.Mainnet].factory]: namespaceFactorySource,
+ [factoryContracts[ValidChains.Mainnet].communityStake]:
+ communityStakesSource,
+ },
+ [ValidChains.Arbitrum]: {
+ [factoryContracts[ValidChains.Arbitrum].factory]: namespaceFactorySource,
+ [factoryContracts[ValidChains.Arbitrum].communityStake]:
+ communityStakesSource,
+ },
+} as const satisfies EventRegistryType;
+
+const x =
+ EventRegistry[84532]['0xc6e7B0AdDf35AE4a5A65bb3bCb78D11Db6c8fB8F'].abi;
diff --git a/libs/evm-protocols/src/event-registry/eventSignatures.ts b/libs/evm-protocols/src/event-registry/eventSignatures.ts
index f4a23fd4cb4..6ca2776e23c 100644
--- a/libs/evm-protocols/src/event-registry/eventSignatures.ts
+++ b/libs/evm-protocols/src/event-registry/eventSignatures.ts
@@ -52,6 +52,13 @@ export const EvmEventSignatures = {
CommunityStake: {
Trade: '0xfc13c9a8a9a619ac78b803aecb26abdd009182411d51a986090f82519d88a89e',
},
+ Launchpad: {
+ TokenLaunched:
+ '0xd7ca5dc2f8c6bb37c3a4de2a81499b25f8ca8bbb3082010244fe747077d0f6cc',
+ Trade: '0x9adcf0ad0cda63c4d50f26a48925cf6405df27d422a39c456b5f03f661c82982',
+ TokenRegistered:
+ '0xc2fe88a1a3c1957424571593960b97f158a519d0aa4cef9e13a247c64f1f4c35',
+ },
} as const;
type Values = T[keyof T];
diff --git a/libs/model/src/chain-events/ChainEventCreated.command.ts b/libs/model/src/chain-events/ChainEventCreated.command.ts
index 4c6c941813d..724ebe9bfc5 100644
--- a/libs/model/src/chain-events/ChainEventCreated.command.ts
+++ b/libs/model/src/chain-events/ChainEventCreated.command.ts
@@ -1,15 +1,9 @@
-import { parseEvmEvent, type Command } from '@hicommonwealth/core';
+import { type Command } from '@hicommonwealth/core';
import {
- EvmEventSignature,
EvmEventSignatures,
commonProtocol as cp,
} from '@hicommonwealth/evm-protocols';
-import {
- config,
- emitEvent,
- equalEvmAddresses,
- models,
-} from '@hicommonwealth/model';
+import { config, equalEvmAddresses, models } from '@hicommonwealth/model';
import * as schemas from '@hicommonwealth/schemas';
import { Hmac, createHmac } from 'crypto';
@@ -114,14 +108,15 @@ export function ChainEventCreated(): Command {
contractAddress,
)
) {
- events.push(
- parseEvmEvent(
- contractAddress,
- eventSignature as EvmEventSignature,
- log.data,
- log.topics,
- ),
- );
+ events
+ .push
+ // parseEvmEvent(
+ // contractAddress,
+ // eventSignature as EvmEventSignature,
+ // log.data,
+ // log.topics,
+ // ),
+ ();
} else if (
// Contests
Object.values(EvmEventSignatures.Contests).includes(
@@ -137,21 +132,22 @@ export function ChainEventCreated(): Command {
);
if (matchingContestContract) {
- events.push(
- parseEvmEvent(
- contractAddress,
- eventSignature as EvmEventSignature,
- log.data,
- log.topics,
- ),
- );
+ events
+ .push
+ // parseEvmEvent(
+ // contractAddress,
+ // eventSignature as EvmEventSignature,
+ // log.data,
+ // log.topics,
+ // ),
+ ();
}
}
}
- if (events.length > 0) {
- await emitEvent(models.Outbox, events);
- }
+ // if (events.length > 0) {
+ // await emitEvent(models.Outbox, events);
+ // }
},
};
}
diff --git a/libs/model/src/token/CreateLaunchpadTrade.command.ts b/libs/model/src/token/CreateLaunchpadTrade.command.ts
index 0a7b5d01730..245d9dd2a54 100644
--- a/libs/model/src/token/CreateLaunchpadTrade.command.ts
+++ b/libs/model/src/token/CreateLaunchpadTrade.command.ts
@@ -9,7 +9,7 @@ import { getLaunchpadTradeTransaction } from '../services/commonProtocol/launchp
const launchpadEthChainIds = Object.values(
commonProtocol.factoryContracts,
).reduce((acc, contract) => {
- if (contract.launchpad) {
+ if ('launchpad' in contract) {
acc.push(contract.chainId);
}
return acc;
diff --git a/packages/commonwealth/server/workers/commonwealthConsumer/policies/chainEventCreated/handleLaunchpadTrade.ts b/packages/commonwealth/server/workers/commonwealthConsumer/policies/chainEventCreated/handleLaunchpadTrade.ts
index 310b66a8d3d..fac891f3cf1 100644
--- a/packages/commonwealth/server/workers/commonwealthConsumer/policies/chainEventCreated/handleLaunchpadTrade.ts
+++ b/packages/commonwealth/server/workers/commonwealthConsumer/policies/chainEventCreated/handleLaunchpadTrade.ts
@@ -1,10 +1,12 @@
-import { events, LaunchpadTrade } from '@hicommonwealth/core';
+import { events, LaunchpadTrade, logger } from '@hicommonwealth/core';
import { commonProtocol as cp } from '@hicommonwealth/evm-protocols';
import { commonProtocol, models } from '@hicommonwealth/model';
import { BigNumber } from 'ethers';
import Web3 from 'web3';
import { z } from 'zod';
+const log = logger(import.meta);
+
export async function handleLaunchpadTrade(
event: z.infer,
) {
@@ -67,9 +69,17 @@ export async function handleLaunchpadTrade(
});
}
- const lpBondingCurveAddress =
- cp.factoryContracts[chainNode!.eth_chain_id as cp.ValidChains]
- .lpBondingCurve!;
+ const contracts =
+ cp.factoryContracts[chainNode!.eth_chain_id as cp.ValidChains];
+ let lpBondingCurveAddress: string;
+ if ('lpBondingCurve' in contracts) {
+ lpBondingCurveAddress = contracts.lpBondingCurve;
+ } else {
+ log.error('No lpBondingCurve address found for chain', undefined, {
+ eth_chain_id: chainNode.eth_chain_id,
+ });
+ return;
+ }
if (
!token.liquidity_transferred &&
From b925e33cb95e21cc93a9df528f0c58e88e0df56c Mon Sep 17 00:00:00 2001
From: Timothee Legros
Date: Fri, 22 Nov 2024 02:44:10 +0200
Subject: [PATCH 200/227] consolidate event signatures
---
.../src/event-registry/eventRegistry.ts | 3 ---
.../src/event-registry/eventSignatures.ts | 17 ++---------------
.../commonProtocol/launchpadHelpers.ts | 15 +++++++++------
.../commonProtocol/newNamespaceValidator.ts | 7 +++++--
.../CreateCommunity/useCreateCommunity.ts | 3 ++-
.../chainEventCreatedPolicy.ts | 18 ++++++++----------
.../knock/eventHandlers/chainEventCreated.ts | 11 +++++------
.../knock/chainEventCreated.spec.ts | 10 +++++-----
8 files changed, 36 insertions(+), 48 deletions(-)
diff --git a/libs/evm-protocols/src/event-registry/eventRegistry.ts b/libs/evm-protocols/src/event-registry/eventRegistry.ts
index 450aace7246..94b84d3dbcf 100644
--- a/libs/evm-protocols/src/event-registry/eventRegistry.ts
+++ b/libs/evm-protocols/src/event-registry/eventRegistry.ts
@@ -115,6 +115,3 @@ export const EventRegistry = {
communityStakesSource,
},
} as const satisfies EventRegistryType;
-
-const x =
- EventRegistry[84532]['0xc6e7B0AdDf35AE4a5A65bb3bCb78D11Db6c8fB8F'].abi;
diff --git a/libs/evm-protocols/src/event-registry/eventSignatures.ts b/libs/evm-protocols/src/event-registry/eventSignatures.ts
index 6ca2776e23c..0fc8709988a 100644
--- a/libs/evm-protocols/src/event-registry/eventSignatures.ts
+++ b/libs/evm-protocols/src/event-registry/eventSignatures.ts
@@ -1,21 +1,6 @@
-export const deployedNamespaceEventSignature =
- '0x8870ba2202802ce285ce6bead5ac915b6dc2d35c8a9d6f96fa56de9de12829d5';
-
export const communityStakeTradeEventSignature =
'0xfc13c9a8a9a619ac78b803aecb26abdd009182411d51a986090f82519d88a89e';
-export const launchpadTokenLaunchedEventSignature =
- '0xd7ca5dc2f8c6bb37c3a4de2a81499b25f8ca8bbb3082010244fe747077d0f6cc';
-
-export const launchpadTradeEventSignature =
- '0x9adcf0ad0cda63c4d50f26a48925cf6405df27d422a39c456b5f03f661c82982';
-
-export const launchpadTokenRegisteredEventSignature =
- '0xc2fe88a1a3c1957424571593960b97f158a519d0aa4cef9e13a247c64f1f4c35';
-
-export const communityNamespaceCreatedEventSignature =
- '0xa16d784cb6c784b621c7877ce80495765ed32ca0b3dba2ef467116a435f125fd';
-
export const ChainEventSigs = {
NewContest:
'address contest, address namespace, uint256 interval, bool oneOff' as const,
@@ -36,6 +21,8 @@ export const EvmEventSignatures = {
'0x8870ba2202802ce285ce6bead5ac915b6dc2d35c8a9d6f96fa56de9de12829d5',
ContestManagerDeployed:
'0x990f533044dbc89b838acde9cd2c72c400999871cf8f792d731edcae15ead693',
+ CommunityNamespaceCreated:
+ '0xa16d784cb6c784b621c7877ce80495765ed32ca0b3dba2ef467116a435f125fd',
},
Contests: {
ContentAdded:
diff --git a/libs/model/src/services/commonProtocol/launchpadHelpers.ts b/libs/model/src/services/commonProtocol/launchpadHelpers.ts
index f613b46551f..32e2d350fe7 100644
--- a/libs/model/src/services/commonProtocol/launchpadHelpers.ts
+++ b/libs/model/src/services/commonProtocol/launchpadHelpers.ts
@@ -1,10 +1,8 @@
import { logger } from '@hicommonwealth/core';
import {
commonProtocol,
- deployedNamespaceEventSignature,
erc20Abi,
- launchpadTokenRegisteredEventSignature,
- launchpadTradeEventSignature,
+ EvmEventSignatures,
lpBondingCurveAbi,
} from '@hicommonwealth/evm-protocols';
import { Web3 } from 'web3';
@@ -30,7 +28,7 @@ export async function getLaunchpadTradeTransaction({
const tradeLog = txReceipt.logs.find((l) => {
if (l.topics && l.topics.length > 0) {
- return l.topics[0].toString() === launchpadTradeEventSignature;
+ return l.topics[0].toString() === EvmEventSignatures.Launchpad.Trade;
}
return false;
});
@@ -83,7 +81,10 @@ export async function getTokenCreatedTransaction({
const deployedNamespaceLog = txReceipt.logs.find((l) => {
if (l.topics && l.topics.length > 0) {
- return l.topics[0].toString() === deployedNamespaceEventSignature;
+ return (
+ l.topics[0].toString() ===
+ EvmEventSignatures.NamespaceFactory.NamespaceDeployed
+ );
}
return false;
});
@@ -103,7 +104,9 @@ export async function getTokenCreatedTransaction({
const tokenRegisteredLog = txReceipt.logs.find((l) => {
if (l.topics && l.topics.length > 0) {
- return l.topics[0].toString() === launchpadTokenRegisteredEventSignature;
+ return (
+ l.topics[0].toString() === EvmEventSignatures.Launchpad.TokenRegistered
+ );
}
return false;
});
diff --git a/libs/model/src/services/commonProtocol/newNamespaceValidator.ts b/libs/model/src/services/commonProtocol/newNamespaceValidator.ts
index fa44a80e287..f015c356606 100644
--- a/libs/model/src/services/commonProtocol/newNamespaceValidator.ts
+++ b/libs/model/src/services/commonProtocol/newNamespaceValidator.ts
@@ -1,7 +1,7 @@
import { AppError, ServerError } from '@hicommonwealth/core';
import {
+ EvmEventSignatures,
commonProtocol,
- communityNamespaceCreatedEventSignature,
} from '@hicommonwealth/evm-protocols';
import { models } from '@hicommonwealth/model';
import { BalanceSourceType } from '@hicommonwealth/shared';
@@ -83,7 +83,10 @@ export const validateNamespace = async (
// only emitted in token launch flows (launchpad)
const communityNamespaceCreatedLog = txReceipt.logs.find((l) => {
if (l.topics && l.topics.length > 0) {
- return l.topics[0].toString() === communityNamespaceCreatedEventSignature;
+ return (
+ l.topics[0].toString() ===
+ EvmEventSignatures.NamespaceFactory.CommunityNamespaceCreated
+ );
}
return false;
});
diff --git a/packages/commonwealth/client/scripts/views/pages/CreateCommunity/useCreateCommunity.ts b/packages/commonwealth/client/scripts/views/pages/CreateCommunity/useCreateCommunity.ts
index 1f4120681b4..529ef3b45b4 100644
--- a/packages/commonwealth/client/scripts/views/pages/CreateCommunity/useCreateCommunity.ts
+++ b/packages/commonwealth/client/scripts/views/pages/CreateCommunity/useCreateCommunity.ts
@@ -1,3 +1,4 @@
+import { commonProtocol as cp } from '@hicommonwealth/evm-protocols';
import AddressInfo from 'models/AddressInfo';
import { useState } from 'react';
import { chainIdsWithStakeEnabled } from 'views/components/CommunityInformationForm/constants';
@@ -42,7 +43,7 @@ const useCreateCommunity = () => {
].includes(createCommunityStep);
const isSupportedChainSelected = chainIdsWithStakeEnabled.includes(
- parseInt(selectedChainId || ''),
+ parseInt(selectedChainId || '') as cp.ValidChains,
);
const showCommunityStakeStep =
diff --git a/packages/commonwealth/server/workers/commonwealthConsumer/policies/chainEventCreated/chainEventCreatedPolicy.ts b/packages/commonwealth/server/workers/commonwealthConsumer/policies/chainEventCreated/chainEventCreatedPolicy.ts
index fb16e924fb2..8f495bcba59 100644
--- a/packages/commonwealth/server/workers/commonwealthConsumer/policies/chainEventCreated/chainEventCreatedPolicy.ts
+++ b/packages/commonwealth/server/workers/commonwealthConsumer/policies/chainEventCreated/chainEventCreatedPolicy.ts
@@ -5,12 +5,7 @@ import {
events,
logger,
} from '@hicommonwealth/core';
-import {
- communityStakeTradeEventSignature,
- deployedNamespaceEventSignature,
- launchpadTokenLaunchedEventSignature,
- launchpadTradeEventSignature,
-} from '@hicommonwealth/evm-protocols';
+import { EvmEventSignatures } from '@hicommonwealth/evm-protocols';
import { Token, middleware, models } from '@hicommonwealth/model';
import { ZodUndefined } from 'zod';
import { handleCommunityStakeTrades } from './handleCommunityStakeTrades';
@@ -23,11 +18,13 @@ export const processChainEventCreated: EventHandler<
ZodUndefined
> = async ({ payload }) => {
if (
- payload.eventSource.eventSignature === communityStakeTradeEventSignature
+ payload.eventSource.eventSignature ===
+ EvmEventSignatures.CommunityStake.Trade
) {
await handleCommunityStakeTrades(models, payload);
} else if (
- payload.eventSource.eventSignature === launchpadTokenLaunchedEventSignature
+ payload.eventSource.eventSignature ===
+ EvmEventSignatures.Launchpad.TokenLaunched
) {
await command(Token.CreateToken(), {
actor: middleware.systemActor({}),
@@ -38,11 +35,12 @@ export const processChainEventCreated: EventHandler<
},
});
} else if (
- payload.eventSource.eventSignature === deployedNamespaceEventSignature
+ payload.eventSource.eventSignature ===
+ EvmEventSignatures.NamespaceFactory.NamespaceDeployed
) {
log.info('Implementation not defined', { payload });
} else if (
- payload.eventSource.eventSignature === launchpadTradeEventSignature
+ payload.eventSource.eventSignature === EvmEventSignatures.Launchpad.Trade
) {
await handleLaunchpadTrade(payload);
} else {
diff --git a/packages/commonwealth/server/workers/knock/eventHandlers/chainEventCreated.ts b/packages/commonwealth/server/workers/knock/eventHandlers/chainEventCreated.ts
index ce770bcc8dc..dd2654ab282 100644
--- a/packages/commonwealth/server/workers/knock/eventHandlers/chainEventCreated.ts
+++ b/packages/commonwealth/server/workers/knock/eventHandlers/chainEventCreated.ts
@@ -1,8 +1,5 @@
import { EventHandler, logger } from '@hicommonwealth/core';
-import {
- communityStakeTradeEventSignature,
- deployedNamespaceEventSignature,
-} from '@hicommonwealth/evm-protocols';
+import { EvmEventSignatures } from '@hicommonwealth/evm-protocols';
import { models } from '@hicommonwealth/model';
import z from 'zod';
import { handleCommunityStakeTrades } from './chainEvents/handleCommunityStakeTrades';
@@ -16,11 +13,13 @@ export const processChainEventCreated: EventHandler<
typeof output
> = async ({ payload }) => {
if (
- payload.eventSource.eventSignature === communityStakeTradeEventSignature
+ payload.eventSource.eventSignature ===
+ EvmEventSignatures.CommunityStake.Trade
) {
return await handleCommunityStakeTrades(models, payload);
} else if (
- payload.eventSource.eventSignature === deployedNamespaceEventSignature
+ payload.eventSource.eventSignature ===
+ EvmEventSignatures.NamespaceFactory.NamespaceDeployed
) {
log.info('Implementation not defined', { payload });
return false;
diff --git a/packages/commonwealth/test/integration/knock/chainEventCreated.spec.ts b/packages/commonwealth/test/integration/knock/chainEventCreated.spec.ts
index 2fb66aa7593..2fdd6ea48d9 100644
--- a/packages/commonwealth/test/integration/knock/chainEventCreated.spec.ts
+++ b/packages/commonwealth/test/integration/knock/chainEventCreated.spec.ts
@@ -9,7 +9,7 @@ import {
disposeAdapter,
notificationsProvider,
} from '@hicommonwealth/core';
-import { communityStakeTradeEventSignature } from '@hicommonwealth/evm-protocols';
+import { EvmEventSignatures } from '@hicommonwealth/evm-protocols';
import { models, tester } from '@hicommonwealth/model';
import * as schemas from '@hicommonwealth/schemas';
import { BalanceType } from '@hicommonwealth/shared';
@@ -98,7 +98,7 @@ describe('chainEventCreated Event Handler', () => {
name: EventNames.ChainEventCreated,
payload: {
eventSource: {
- eventSignature: communityStakeTradeEventSignature,
+ eventSignature: EvmEventSignatures.CommunityStake.Trade,
},
parsedArgs: ['0x1', '0xunsupported', true],
} as unknown as z.infer,
@@ -116,7 +116,7 @@ describe('chainEventCreated Event Handler', () => {
name: EventNames.ChainEventCreated,
payload: {
eventSource: {
- eventSignature: communityStakeTradeEventSignature,
+ eventSignature: EvmEventSignatures.CommunityStake.Trade,
},
parsedArgs: ['0x1', namespaceAddress, true],
} as unknown as z.infer,
@@ -142,7 +142,7 @@ describe('chainEventCreated Event Handler', () => {
name: EventNames.ChainEventCreated,
payload: {
eventSource: {
- eventSignature: communityStakeTradeEventSignature,
+ eventSignature: EvmEventSignatures.CommunityStake.Trade,
},
parsedArgs: ['0x1', namespaceAddress, true],
} as unknown as z.infer,
@@ -181,7 +181,7 @@ describe('chainEventCreated Event Handler', () => {
name: EventNames.ChainEventCreated,
payload: {
eventSource: {
- eventSignature: communityStakeTradeEventSignature,
+ eventSignature: EvmEventSignatures.CommunityStake.Trade,
},
parsedArgs: ['0x1', namespaceAddress, true],
} as unknown as z.infer