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

[CFE-483]: Feat(pages) - update my publish module to support lcd endpoint #940

Merged
merged 11 commits into from
Jun 6, 2024
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Features

- [#940](https://github.com/alleslabs/celatone-frontend/pull/940) Support my published modules page lite version with LCD endpoint
- [#949](https://github.com/alleslabs/celatone-frontend/pull/949) Support lite version for instantited by me
- [#948](https://github.com/alleslabs/celatone-frontend/pull/948) Support lite version for past txs
- [#923](https://github.com/alleslabs/celatone-frontend/pull/923) Add get txs by contact and account addr lcd
Expand Down
2 changes: 1 addition & 1 deletion src/config/chain/initia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const INITIA_CHAIN_CONFIGS: ChainConfigs = {
gasPrice: {
tokenPerGas: 0.151,
denom:
"l2/ad2344d0c17127cc6bce67e360f43cd6c5fa09a7b5f6f9b7b80f9dc3e0c4876e",
"l2/aee375e9d0b181f0d9d3a49f9a3d1d6b05d62b0ac81f8c92b9282afa4213d884",
},
gasAdjustment: 1.5,
maxGasLimit: 25_000_000,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/module/ModuleCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useMemo } from "react";
import { AppLink } from "../AppLink";
import { CustomIcon } from "../icon";
import { AmpEvent, track } from "lib/amplitude";
import { useVerifyModule } from "lib/services/move/moduleService";
import { useVerifyModule } from "lib/services/move";
import type { BechAddr, IndexedModule, Option } from "lib/types";

import { CountBadge } from "./CountBadge";
Expand Down
2 changes: 1 addition & 1 deletion src/lib/pages/account-details/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { InvalidState } from "lib/components/state";
import { UserDocsLink } from "lib/components/UserDocsLink";
import { useFormatAddresses } from "lib/hooks/useFormatAddresses";
import { useAccountData } from "lib/services/accountService";
import { useModulesByAddress } from "lib/services/move/moduleService";
import { useModulesByAddress } from "lib/services/move";
import { useResourcesByAddress } from "lib/services/move/resourceService";
import { useNftsCountByAccount } from "lib/services/nft";
import type { Addr, BechAddr, HexAddr, Option } from "lib/types";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { FileState } from "..";
import { ComponentLoader } from "lib/components/ComponentLoader";
import { DropZone } from "lib/components/dropzone";
import { UploadCard } from "lib/components/upload/UploadCard";
import { useDecodeScript } from "lib/services/move/moduleService";
import { useDecodeScript } from "lib/services/move";
import type { ExposedFunction, Option } from "lib/types";

const DEFAULT_TEMP_FILE = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { useEffect, useState } from "react";
import { ModuleEmptyState } from "../common";
import { useConvertHexAddress } from "lib/app-provider";
import { CustomIcon } from "lib/components/icon";
import { useModulesByAddressLcd } from "lib/services/move/moduleService";
import { useModulesByAddressLcd } from "lib/services/move/";
import type { BechAddr, HexAddr, IndexedModule, Option } from "lib/types";
import { isHexWalletAddress } from "lib/utils";

Expand Down Expand Up @@ -54,7 +54,7 @@ export const ModuleSelectDrawer = ({
refetchOnWindowFocus: false,
enabled: false,
retry: false,
onSuccess: (data) => setModules(data),
onSuccess: ({ items }) => setModules(items),
},
});

Expand Down
2 changes: 1 addition & 1 deletion src/lib/pages/interact/component/form/ViewArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { SubmitButton } from "lib/components/button";
import { CustomIcon } from "lib/components/icon";
import JsonReadOnly from "lib/components/json/JsonReadOnly";
import { DEFAULT_RPC_ERROR } from "lib/data";
import { useFunctionView } from "lib/services/move/moduleService";
import { useFunctionView } from "lib/services/move";
import type {
AbiFormData,
ExposedFunction,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/pages/interact/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const useSearchModules = ({
refetchOnWindowFocus: false,
enabled: false,
retry: false,
onSuccess: onModulesSuccess,
onSuccess: ({ items }) => onModulesSuccess(items),
onError,
},
});
Expand Down
5 changes: 1 addition & 4 deletions src/lib/pages/interact/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ import { ModuleSourceCode } from "lib/components/module";
import PageContainer from "lib/components/PageContainer";
import { PageHeader } from "lib/components/PageHeader";
import { useOpenNewTab } from "lib/hooks";
import {
useModuleByAddressLcd,
useVerifyModule,
} from "lib/services/move/moduleService";
import { useModuleByAddressLcd, useVerifyModule } from "lib/services/move";
import type { Addr, ExposedFunction, IndexedModule } from "lib/types";
import { getFirstQueryParam } from "lib/utils";

Expand Down
2 changes: 1 addition & 1 deletion src/lib/pages/module-details/components/ModuleInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Flex, Heading, Text } from "@chakra-ui/react";

import { CustomIcon } from "lib/components/icon";
import { ModuleSourceCode } from "lib/components/module";
import type { ModuleVerificationInternal } from "lib/services/move/module";
import type { ModuleVerificationInternal } from "lib/services/types";
import type {
HexAddr,
Nullable,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { TableContainer } from "@chakra-ui/react";
import { useMobile } from "lib/app-provider";
import { Loading } from "lib/components/Loading";
import { MobileTableContainer } from "lib/components/table";
import type { ModuleHistory } from "lib/services/move/module";
import type { ModuleHistory } from "lib/services/types";
import type { Option } from "lib/types";

import { PublishedEventsTableHeader } from "./PublishedEventsTableHeader";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
MobileLabel,
RemarkRender,
} from "lib/components/table";
import type { ModuleHistory } from "lib/services/move/module";
import type { ModuleHistory } from "lib/services/types";
import { dateFromNow, formatUTC } from "lib/utils";

import { PolicyChanges } from "./PublishedEventsTableRow";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { capitalize } from "lodash";
import { ExplorerLink } from "lib/components/ExplorerLink";
import { CustomIcon } from "lib/components/icon";
import { RemarkRender, TableRow } from "lib/components/table";
import type { ModuleHistory } from "lib/services/move/module";
import type { ModuleHistory } from "lib/services/types";
import { dateFromNow, formatUTC } from "lib/utils";

interface PublishedEventsTableRowProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Pagination } from "lib/components/pagination";
import { usePaginator } from "lib/components/pagination/usePaginator";
import { EmptyState, ErrorFetching } from "lib/components/state";
import { ViewMore } from "lib/components/table";
import { useModuleHistories } from "lib/services/move/moduleService";
import { useModuleHistories } from "lib/services/move";
import type { HexAddr, Option } from "lib/types";

import { PublishedEventsTable } from "./PublishedEventsTable";
Expand Down
2 changes: 1 addition & 1 deletion src/lib/pages/module-details/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
useModuleData,
useModuleTableCounts,
useVerifyModule,
} from "lib/services/move/moduleService";
} from "lib/services/move";

import {
FunctionTypeTabs,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,32 @@
import { useMemo, useState } from "react";

import { useCurrentChain } from "lib/app-provider";
import { useCurrentChain, useTierConfig } from "lib/app-provider";
import InputWithIcon from "lib/components/InputWithIcon";
import {
DisconnectedState,
EmptyState,
ErrorFetching,
} from "lib/components/state";
import { ModulesTable } from "lib/components/table";
import { useModulesByAddress } from "lib/services/move/moduleService";
import { useModulesByAddress, useModulesByAddressLcd } from "lib/services/move";
import type { ModuleInfo, Option } from "lib/types";

export const MyPublishedModulesTable = () => {
const [keyword, setKeyword] = useState("");
const { address } = useCurrentChain();
const isFullTier = useTierConfig() === "full";

const fullData = useModulesByAddress(address, isFullTier);
const liteData = useModulesByAddressLcd({
evilpeach marked this conversation as resolved.
Show resolved Hide resolved
address,
options: { enabled: !isFullTier },
});

const {
data,
isFetching: isModulesLoading,
error,
} = useModulesByAddress(address);
} = isFullTier ? fullData : liteData;

const filteredPublishedModules: Option<ModuleInfo[]> = useMemo(() => {
if (!keyword) return data?.items;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/pages/publish-module/components/UploadModuleCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import { DropZone } from "lib/components/dropzone";
import { CustomIcon } from "lib/components/icon";
import { Tooltip } from "lib/components/Tooltip";
import { UploadCard } from "lib/components/upload/UploadCard";
import { useDecodeModule } from "lib/services/move/moduleService";
import type { DecodeModuleQueryResponse } from "lib/services/move/moduleService";
import { useDecodeModule } from "lib/services/move";
import type { DecodeModuleQueryResponse } from "lib/services/types";
import type { Option, UpgradePolicy } from "lib/types";

const DEFAULT_TEMP_FILE = {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/pages/publish-module/formConstants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { DecodeModuleQueryResponse } from "lib/services/move/moduleService";
import type { DecodeModuleQueryResponse } from "lib/services/types";
import type { Option } from "lib/types";
import { UpgradePolicy } from "lib/types";

Expand Down
2 changes: 1 addition & 1 deletion src/lib/pages/publish-module/publish.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { EstimatedFeeRender } from "lib/components/EstimatedFeeRender";
import { CustomIcon } from "lib/components/icon";
import PageContainer from "lib/components/PageContainer";
import { useTxBroadcast } from "lib/hooks";
import type { DecodeModuleQueryResponse } from "lib/services/move/moduleService";
import type { DecodeModuleQueryResponse } from "lib/services/types";
import type { Option } from "lib/types";
import { composePublishMsg } from "lib/utils";

Expand Down
2 changes: 1 addition & 1 deletion src/lib/pages/publish-module/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { DecodeModuleQueryResponse } from "lib/services/move/moduleService";
import type { DecodeModuleQueryResponse } from "lib/services/types";
import type { BechAddr20, Option } from "lib/types";
import { UpgradePolicy } from "lib/types";
import { bech32AddressToHex, truncate, unpadHexAddress } from "lib/utils";
Expand Down
2 changes: 1 addition & 1 deletion src/lib/services/move/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export * from "./moduleService";
export * from "./poolService";
export * from "./resourceService";
export * from "./module";
Loading
Loading