Skip to content

Commit

Permalink
fix: upload instantiator form type
Browse files Browse the repository at this point in the history
  • Loading branch information
songwongtp committed Jan 2, 2024
1 parent 949e842 commit a3bc8dc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/lib/pages/instantiate/completed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ExplorerLink } from "lib/components/ExplorerLink";
import { CustomIcon } from "lib/components/icon";
import { TxReceiptRender } from "lib/components/tx";
import WasmPageContainer from "lib/components/WasmPageContainer";
import type { BechAddr20, BechAddr32 } from "lib/types";
import type { BechAddr32 } from "lib/types";
import { feeFromStr } from "lib/utils";

import type { InstantiateTxInfo } from ".";
Expand Down Expand Up @@ -102,7 +102,7 @@ const Completed = ({ txInfo }: CompletedProps) => {
subtitle="Filled information below will be saved on Celatone only and able to edit later."
contractAddress={txInfo.contractAddress as BechAddr32}
contractLabel={txInfo.contractLabel}
instantiator={txInfo.instantiator as BechAddr20}
instantiator={txInfo.instantiator}
/>
</WasmPageContainer>
);
Expand Down
7 changes: 4 additions & 3 deletions src/lib/pages/instantiate/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ import type { InstantiateResult } from "@cosmjs/cosmwasm-stargate";
import { useEffect, useState } from "react";

import { useWasmConfig } from "lib/app-provider";
import type { BechAddr20 } from "lib/types";
import { scrollToTop } from "lib/utils";

import CompletedPage from "./completed";
import InstantiatePage from "./instantiate";

export interface InstantiateTxInfo extends InstantiateResult {
contractLabel: string;
instantiator: string;
instantiator: BechAddr20;
}

const Index = () => {
Expand All @@ -24,7 +25,7 @@ const Index = () => {
gasWanted: 0,
gasUsed: 0,
contractLabel: "",
instantiator: "",
instantiator: "" as BechAddr20,
});

useEffect(() => {
Expand All @@ -38,7 +39,7 @@ const Index = () => {
onComplete={(
txResult: InstantiateResult,
contractLabel: string,
instantiator: string
instantiator: BechAddr20
) => {
setTxInfo({ ...txResult, contractLabel, instantiator });
setCompleted(true);
Expand Down
6 changes: 3 additions & 3 deletions src/lib/pages/instantiate/instantiate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import { useSchemaStore } from "lib/providers/store";
import { useTxBroadcast } from "lib/providers/tx-broadcast";
import type { CodeIdInfoResponse } from "lib/services/code";
import { useLCDCodeInfo } from "lib/services/codeService";
import type { BechAddr, ComposedMsg } from "lib/types";
import type { BechAddr, BechAddr20, ComposedMsg } from "lib/types";
import { MsgType } from "lib/types";
import {
composeMsg,
Expand Down Expand Up @@ -77,7 +77,7 @@ interface InstantiatePageProps {
onComplete: (
txResult: InstantiateResult,
contractLabel: string,
instantiator: string
instantiator: BechAddr20
) => void;
}

Expand Down Expand Up @@ -261,7 +261,7 @@ const Instantiate = ({ onComplete }: InstantiatePageProps) => {
estimatedFee,
onTxSucceed: (txResult, contractLabel) => {
setProcessing(false);
onComplete(txResult, contractLabel, address ?? "");
onComplete(txResult, contractLabel, address ?? ("" as BechAddr20));
},
onTxFailed: () => setProcessing(false),
});
Expand Down

0 comments on commit a3bc8dc

Please sign in to comment.