Skip to content

Commit

Permalink
Merge pull request #1170 from alleslabs/release/v1.9.2
Browse files Browse the repository at this point in the history
Cut release v1.9.2
  • Loading branch information
evilpeach authored Oct 25, 2024
2 parents 92ec347 + 611d01e commit 89b1f7d
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 43 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## v1.9.2

### Improvements

- [#1169](https://github.com/alleslabs/celatone-frontend/pull/1169) Fix minor bugs
- [#1168](https://github.com/alleslabs/celatone-frontend/pull/1168) Normalized voting power by 1e6 for Initia
- [#1162](https://github.com/alleslabs/celatone-frontend/pull/1162) Proxy move verify through celatone verification api first

## v1.9.1

### Improvements
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "celatone",
"version": "1.9.1",
"version": "1.9.2",
"author": "Alles Labs",
"contributors": [
{
Expand Down
3 changes: 0 additions & 3 deletions src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,3 @@ export const CELATONE_VERIFICATION_API =

export const INITIA_MOVE_DECODER =
process.env.NEXT_PUBLIC_INITIA_MOVE_DECODER ?? "";

export const INITIA_MOVE_VERIFIER =
process.env.NEXT_PUBLIC_INITIA_MOVE_VERIFIER ?? "";
4 changes: 2 additions & 2 deletions src/lib/components/action-msg/SingleMsg.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const SingleMsg = ({
token={token}
// TODO: add `ampCopierSection` later
/>
{tokens.length > 1 && (
{tokens.length > 1 && index < tokens.length - 1 && (
<>
{index < tokens.length - 2 ? (
<Text>,</Text>
Expand All @@ -59,7 +59,7 @@ export const SingleMsg = ({
)}
</Flex>
))}
{/* Tags */}
{/* Tags */}
{tags?.map((tag, index: number) => (
<Tag
variant="gray"
Expand Down
17 changes: 11 additions & 6 deletions src/lib/model/account/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,19 @@ export const calBonded = (
) => {
if (!totalDelegations || !totalUnbondings) return undefined;

return Object.keys(totalDelegations).reduce<Record<string, TokenWithValue>>(
(total, denom) => ({
const totalBonded = Object.entries(totalDelegations).reduce<
Record<string, TokenWithValue>
>(
(total, [denom, token]) => ({
...total,
[denom]: addTokenWithValue(
totalUnbondings[denom],
totalDelegations[denom]
),
[denom]: addTokenWithValue(totalUnbondings[denom], token),
}),
{}
);

Object.entries(totalUnbondings).forEach(([denom, token]) => {
if (!totalBonded[denom]) totalBonded[denom] = token;
});

return totalBonded;
};
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ export const SelectFunctionSection = ({
/>
<Flex
gap={6}
h={{ base: "auto", md: maxHeight }}
minH={{ base: 40, md: "auto" }}
h={{ base: "calc(100% - 125px)", md: maxHeight }}
minH={{ md: "auto" }}
>
<Flex
flex={{ base: 1, md: 0.5 }}
Expand All @@ -137,7 +137,7 @@ export const SelectFunctionSection = ({
/>
</Flex>
)}
<Flex direction="column" gap={3} overflow="scroll">
<Flex direction="column" gap={3} overflow="scroll" pb={4}>
<RenderFunctions
exposedFnsLength={module.viewFunctions.length}
filtered={filteredView}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/pages/interact/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ const InteractBody = ({
onOpen={onOpen}
/>
)}
<Box px={{ base: "16px", md: "48px" }}>
<Box pt="32px">
<ModuleSourceCode
verificationData={verificationData}
moveVerifyStatus={moveVerifyStatus}
Expand Down
26 changes: 21 additions & 5 deletions src/lib/services/verification/move/api.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import axios from "axios";

import { INITIA_MOVE_VERIFIER } from "env";
import { CELATONE_VERIFICATION_API } from "env";
import type {
MoveVerifyByTaskIdResponse,
MoveVerifyInfoResponse,
Expand All @@ -20,35 +20,51 @@ export const submitMoveVerify = async (
formData: FormData
): Promise<SubmitMoveVerifyResponse> =>
axios
.post(`${INITIA_MOVE_VERIFIER}/contracts/verify`, formData, {
.post(`${CELATONE_VERIFICATION_API}/move/initia-verify`, formData, {
headers: {
"Content-Type": "multipart/form-data",
},
})
.then(({ data }) => parseWithError(zSubmitMoveVerifyResponse, data));

export const getMoveVerifyByTaskId = async (
chainId: string,
taskId: string
): Promise<MoveVerifyByTaskIdResponse> =>
axios
.get(`${INITIA_MOVE_VERIFIER}/contracts/task/${encodeURI(taskId)}`)
.get(
`${CELATONE_VERIFICATION_API}/move/initia-task-info/${encodeURI(taskId)}`,
{
params: { chainId },
}
)
.then(({ data }) => parseWithError(zMoveVerifyByTaskIdResponse, data));

export const getMoveVerifyInfo = async (
chainId: string,
address: Addr,
moduleName: string
): Promise<Nullable<MoveVerifyInfoResponse>> =>
axios
.get(
`${INITIA_MOVE_VERIFIER}/contracts/verify/${encodeURI(address)}/${encodeURI(moduleName)}`
`${CELATONE_VERIFICATION_API}/move/initia-verify-infos/${encodeURI(address)}/${encodeURI(moduleName)}`,
{
params: { chainId },
}
)
.then(({ data }) => parseWithError(zMoveVerifyInfoResponse, data));

export const getMoveVerifyInfosByAddress = async (
chainId: string,
address: Addr
): Promise<MoveVerifyInfosByAddressResponse> =>
axios
.get(`${INITIA_MOVE_VERIFIER}/contracts/${encodeURI(address)}`)
.get(
`${CELATONE_VERIFICATION_API}/move/initia-verify-infos/${encodeURI(address)}`,
{
params: { chainId },
}
)
.then(({ data }) =>
parseWithError(zMoveVerifyInfosByAddressResponse, data)
);
44 changes: 22 additions & 22 deletions src/lib/services/verification/move/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useMutation, useQueries, useQuery } from "@tanstack/react-query";
import type { UseQueryResult } from "@tanstack/react-query";
import { useMutation, useQueries, useQuery } from "@tanstack/react-query";

import { CELATONE_QUERY_KEYS, useInitiaL1 } from "lib/app-provider";
import { CELATONE_QUERY_KEYS, useCelatoneApp } from "lib/app-provider";
import type {
MoveVerifyByTaskIdResponse,
MoveVerifyInfoResponse,
Expand All @@ -25,17 +25,16 @@ export const useMoveVerifyTaskInfos = (
taskIds: string[],
onSuccess?: (data: MoveVerifyByTaskIdResponse) => void
) => {
const isInitiaL1 = useInitiaL1({ shouldRedirect: false });
const { currentChainId } = useCelatoneApp();

return useQueries({
queries: taskIds.map((taskId) => ({
queryKey: [
CELATONE_QUERY_KEYS.MOVE_VERIFY_TASK_BY_TASK_ID,
currentChainId,
taskId,
isInitiaL1,
],
queryFn: () => getMoveVerifyByTaskId(taskId),
enabled: isInitiaL1,
queryFn: () => getMoveVerifyByTaskId(currentChainId, taskId),
retry: 0,
refetchOnWindowFocus: false,
keepPreviousData: true,
Expand All @@ -48,13 +47,13 @@ export const useMoveVerifyTaskInfo = (
taskId: string,
enabled = true
): UseQueryResult<MoveVerifyByTaskIdResponse> => {
const isInitiaL1 = useInitiaL1({ shouldRedirect: false });
const { currentChainId } = useCelatoneApp();

return useQuery(
[CELATONE_QUERY_KEYS.MOVE_VERIFY_TASK_BY_TASK_ID, taskId, isInitiaL1],
() => getMoveVerifyByTaskId(taskId),
[CELATONE_QUERY_KEYS.MOVE_VERIFY_TASK_BY_TASK_ID, currentChainId, taskId],
() => getMoveVerifyByTaskId(currentChainId, taskId),
{
enabled: enabled && isInitiaL1,
enabled,
retry: 0,
refetchOnWindowFocus: false,
keepPreviousData: true,
Expand All @@ -66,19 +65,19 @@ export const useMoveVerifyInfo = (
address: Option<Addr>,
moduleName: Option<string>
): UseQueryResult<MoveVerifyInfoResponse> => {
const isInitiaL1 = useInitiaL1({ shouldRedirect: false });
const { currentChainId } = useCelatoneApp();

return useQuery(
[CELATONE_QUERY_KEYS.MOVE_VERIFY_INFO, address, moduleName, isInitiaL1],
[CELATONE_QUERY_KEYS.MOVE_VERIFY_INFO, currentChainId, address, moduleName],
() => {
if (!address || !moduleName)
throw new Error(
"address or module name is undefined (useMoveVerifyInfo)"
);
return getMoveVerifyInfo(address, moduleName);
return getMoveVerifyInfo(currentChainId, address, moduleName);
},
{
enabled: isInitiaL1,
enabled: Boolean(address && moduleName),
retry: 0,
refetchOnWindowFocus: false,
keepPreviousData: true,
Expand All @@ -90,18 +89,18 @@ export const useMoveVerifyInfos = (
moduleInfos: { address: HexAddr; moduleName: string }[],
enabled = true
) => {
const isInitiaL1 = useInitiaL1({ shouldRedirect: false });
const { currentChainId } = useCelatoneApp();

return useQueries({
queries: moduleInfos.map(({ address, moduleName }) => ({
queryKey: [
CELATONE_QUERY_KEYS.MOVE_VERIFY_INFO,
currentChainId,
address,
moduleName,
isInitiaL1,
],
queryFn: () => getMoveVerifyInfo(address, moduleName),
enabled: enabled && isInitiaL1,
queryFn: () => getMoveVerifyInfo(currentChainId, address, moduleName),
enabled,
retry: 0,
refetchOnWindowFocus: false,
keepPreviousData: true,
Expand All @@ -112,16 +111,17 @@ export const useMoveVerifyInfos = (
export const useMoveVerifyInfosByAddress = (
address: Option<Addr>
): UseQueryResult<MoveVerifyInfosByAddressResponse> => {
const isInitiaL1 = useInitiaL1({ shouldRedirect: false });
const { currentChainId } = useCelatoneApp();

return useQuery(
[CELATONE_QUERY_KEYS.MOVE_VERIFY_INFOS_BY_ADDRESS, address, isInitiaL1],
[CELATONE_QUERY_KEYS.MOVE_VERIFY_INFOS_BY_ADDRESS, currentChainId, address],
() => {
if (!address)
throw new Error("address is undefined (useMoveVerifyInfosByAddress)");
return getMoveVerifyInfosByAddress(address);
return getMoveVerifyInfosByAddress(currentChainId, address);
},
{
enabled: Boolean(address) && isInitiaL1,
enabled: Boolean(address),
retry: 0,
refetchOnWindowFocus: false,
keepPreviousData: true,
Expand Down

0 comments on commit 89b1f7d

Please sign in to comment.