Skip to content

Commit 0644874

Browse files
Merge pull request #1478 from trilitech/fix-operations-without-originated-contract
Fix failed origination tile rendering
2 parents d344522 + 90dd2bb commit 0644874

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

apps/desktop/src/components/OperationTile/OriginationTile.test.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ describe("<OriginationTile />", () => {
5959
);
6060
expect(screen.getByTestId("title")).toHaveTextContent("Contract Origination");
6161
});
62+
63+
it("shows a contract origination title if operation failed and there is no contract", () => {
64+
render(fixture(contextValue, originationFixture({ originatedContract: undefined })), {
65+
store,
66+
});
67+
expect(screen.getByTestId("title")).toHaveTextContent("Contract Origination");
68+
});
6269
});
6370
});
6471

apps/desktop/src/components/OperationTile/OriginationTile.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { AddressPill } from "../AddressPill/AddressPill";
1414

1515
export const OriginationTile = ({ operation }: { operation: OriginationOperation }) => {
1616
const isMultisig =
17-
operation.originatedContract.codeHash === CODE_HASH &&
17+
operation.originatedContract?.codeHash === CODE_HASH &&
1818
operation.originatedContract.typeHash === TYPE_HASH;
1919

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

packages/tzkt/src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ export type TransactionOperation = CommonOperationFields & {
151151

152152
export type OriginationOperation = CommonOperationFields & {
153153
type: "origination";
154-
originatedContract: {
154+
originatedContract?: {
155155
address: RawPkh;
156156
codeHash: number;
157157
typeHash: number;

0 commit comments

Comments
 (0)