Skip to content

Commit

Permalink
Fix failed origination tile rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
serjonya-trili committed Jul 10, 2024
1 parent d344522 commit 00db00c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ describe("<OriginationTile />", () => {
);
expect(screen.getByTestId("title")).toHaveTextContent("Contract Origination");
});

it("shows a contract origination title if operation failed and there is no contract", () => {
render(fixture(contextValue, originationFixture({ originatedContract: undefined })), {
store,
});
expect(screen.getByTestId("title")).toHaveTextContent("Contract Origination");
});
});
});

Expand Down
4 changes: 2 additions & 2 deletions apps/desktop/src/components/OperationTile/OriginationTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import { AddressPill } from "../AddressPill/AddressPill";

export const OriginationTile = ({ operation }: { operation: OriginationOperation }) => {
const isMultisig =
operation.originatedContract.codeHash === CODE_HASH &&
operation.originatedContract.typeHash === TYPE_HASH;
operation.originatedContract?.codeHash === CODE_HASH &&
operation.originatedContract?.typeHash === TYPE_HASH;

const contractTitle = isMultisig ? "Multisig Account Created" : "Contract Origination";

Expand Down
2 changes: 1 addition & 1 deletion packages/tzkt/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export type TransactionOperation = CommonOperationFields & {

export type OriginationOperation = CommonOperationFields & {
type: "origination";
originatedContract: {
originatedContract?: {
address: RawPkh;
codeHash: number;
typeHash: number;
Expand Down

0 comments on commit 00db00c

Please sign in to comment.