Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add gov, open btn config #540

Merged
merged 5 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Improvements

- [#540](https://github.com/alleslabs/celatone-frontend/pull/540) Add open proposal configuration
- [#532](https://github.com/alleslabs/celatone-frontend/pull/532) Implement new Amplitude structure
- [#538](https://github.com/alleslabs/celatone-frontend/pull/538) Add empty state in query and execute with json schema
- [#537](https://github.com/alleslabs/celatone-frontend/pull/537) Change json schema select widget null option wording for readability
Expand Down
4 changes: 2 additions & 2 deletions src/config/chain/neutron.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const NEUTRON_CHAIN_CONFIGS: ChainConfigs = {
enabled: true,
},
gov: {
enabled: true,
enabled: false,
},
},
gas: {
Expand Down Expand Up @@ -70,7 +70,7 @@ export const NEUTRON_CHAIN_CONFIGS: ChainConfigs = {
enabled: false,
},
gov: {
enabled: true,
enabled: false,
},
},
gas: {
Expand Down
6 changes: 6 additions & 0 deletions src/config/chain/osmosis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ export const OSMOSIS_CHAIN_CONFIGS: ChainConfigs = {
},
gov: {
enabled: true,
disableStoreCodeProposal: true,
disableWhitelistProposal: true,
},
},
gas: {
Expand Down Expand Up @@ -74,6 +76,8 @@ export const OSMOSIS_CHAIN_CONFIGS: ChainConfigs = {
},
gov: {
enabled: true,
disableWhitelistProposal: true,
disableStoreCodeProposal: true,
},
},
gas: {
Expand Down Expand Up @@ -117,6 +121,8 @@ export const OSMOSIS_CHAIN_CONFIGS: ChainConfigs = {
},
gov: {
enabled: true,
disableWhitelistProposal: true,
disableStoreCodeProposal: true,
},
},
gas: {
Expand Down
2 changes: 1 addition & 1 deletion src/config/chain/sei.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const SEI_CHAIN_CONFIGS: ChainConfigs = {
maxGasLimit: 25_000_000,
},
explorerLink: {
validator: "",
validator: "https://mintscan.io/sei/validators",
proposal: "",
},
extra: {
Expand Down
4 changes: 2 additions & 2 deletions src/config/chain/terra.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const TERRA_CHAIN_CONFIGS: ChainConfigs = {
},
gov: {
enabled: true,
disableOpenProposal: true,
hideOpenProposal: true,
},
},
gas: {
Expand Down Expand Up @@ -73,7 +73,7 @@ export const TERRA_CHAIN_CONFIGS: ChainConfigs = {
},
gov: {
enabled: true,
disableOpenProposal: true,
hideOpenProposal: true,
},
},
gas: {
Expand Down
3 changes: 2 additions & 1 deletion src/config/chain/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ type PublicProjectConfig = { enabled: boolean };
type GovConfig =
| {
enabled: true;
disableOpenProposal?: boolean;
hideOpenProposal?: boolean;
disableWhitelistProposal?: boolean;
disableStoreCodeProposal?: boolean;
}
| {
Expand Down
16 changes: 11 additions & 5 deletions src/lib/components/button/NewProposalButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ export const NewProposalButton = () => {
// const isPermissionless =
// govParams?.uploadAccess.permission === AccessConfigPermission.EVERYBODY;

if (govConfig.enabled && govConfig.disableOpenProposal) return null;
if (govConfig.enabled && govConfig.hideOpenProposal) return null;

const disableWhitelist =
(govConfig.enabled && govConfig.disableWhitelistProposal) ?? false;
const disableStoreCode =
(govConfig.enabled && govConfig.disableStoreCodeProposal) ?? false;

return (
<Menu>
Expand All @@ -28,8 +33,9 @@ export const NewProposalButton = () => {
Create New Proposal
</MenuButton>
<MenuList>
{govConfig.enabled && !govConfig.disableStoreCodeProposal && (
<Tooltip label="Coming soon!" hidden={!disableStoreCode}>
<MenuItem
isDisabled={disableStoreCode}
icon={<CustomIcon name="code" color="gray.600" />}
onClick={() => {
navigate({
Expand All @@ -39,7 +45,7 @@ export const NewProposalButton = () => {
>
To Store Code
</MenuItem>
)}
</Tooltip>
{/* <MenuItem
icon={<CustomIcon name="contract-address" color="gray.600"/>}
onClick={() => {
Expand All @@ -57,9 +63,9 @@ export const NewProposalButton = () => {
: undefined
}
> */}
<Tooltip label="Coming soon!">
<Tooltip label="Coming soon!" hidden={!disableWhitelist}>
<MenuItem
isDisabled
isDisabled={disableWhitelist}
icon={<CustomIcon name="admin" color="gray.600" />}
onClick={() => {
navigate({
Expand Down
8 changes: 3 additions & 5 deletions src/lib/pages/proposal/whitelist/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import {
useCelatoneApp,
useCurrentChain,
useFabricateFee,
useInternalNavigate,
useSimulateFeeQuery,
useSubmitWhitelistProposalTx,
useWasmConfig,
Expand Down Expand Up @@ -67,7 +66,6 @@ const ProposalToWhitelist = () => {
trackUseSubmitProposal,
} = useTrack();
const router = useRouter();
const navigate = useInternalNavigate();
const { constants } = useCelatoneApp();
const getMaxLengthError = useGetMaxLengthError();
const { address: walletAddress = "" } = useCurrentChain();
Expand Down Expand Up @@ -231,11 +229,10 @@ const ProposalToWhitelist = () => {
}, [minDeposit, reset]);

useEffect(() => {
navigate({ pathname: "/", replace: true });
if (router.isReady) {
track(AmpEvent.TO_PROPOSAL_TO_WHITELIST);
}
}, [router.isReady, navigate, track]);
}, [router.isReady, track]);

return (
<>
Expand Down Expand Up @@ -369,10 +366,11 @@ const ProposalToWhitelist = () => {
h="56px"
variant="outline-gray"
size="lg"
p={0}
disabled={fields.length <= 1}
onClick={() => remove(idx)}
>
<CustomIcon name="delete" />
<CustomIcon name="delete" boxSize={4} />
</Button>
</Flex>
))}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/pages/stored-codes/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const StoredCodes = observer(() => {
{govConfig.enabled &&
!(
govConfig.disableStoreCodeProposal ||
govConfig.disableOpenProposal
govConfig.hideOpenProposal
) && <ProposalButton />}
</>
) : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const generateReceipts = (
{ msgBody, log }: Omit<TxMsgData, "assetInfos">,
getAddressType: (address: string) => AddressReturnType,
assetInfos: Option<{ [key: string]: AssetInfo }>
// eslint-disable-next-line sonarjs/cognitive-complexity
): Option<TxReceipt | null | false>[] => {
const { "@type": type, ...body } = msgBody;

Expand Down Expand Up @@ -72,14 +73,14 @@ export const generateReceipts = (
permissionAddresses={
details.instantiate_permission.address
? [details.instantiate_permission.address]
: details.instantiate_permission.addresses
: details.instantiate_permission.addresses ?? []
}
/>
<ViewPermissionAddresses
permissionAddresses={
details.instantiate_permission.address
? [details.instantiate_permission.address]
: details.instantiate_permission.addresses
: details.instantiate_permission.addresses ?? []
}
amptrackSection="tx_msg_receipts"
/>
Expand Down
3 changes: 2 additions & 1 deletion src/lib/utils/tx/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ export interface MsgUnknownDetails extends MsgBaseDetails {
interface InstantiatePermissionResponse {
permission: AccessConfigPermission;
address: Addr;
addresses: Addr[];
// Remark: addresses will undefined in case of Cosmos SDK v0.26
addresses?: Addr[];
}

// cosmwasm/wasm
Expand Down
Loading