Skip to content

Commit

Permalink
Merge pull request #1478 from trilitech/fix-operations-without-origin…
Browse files Browse the repository at this point in the history
…ated-contract

Fix failed origination tile rendering
  • Loading branch information
serjonya-trili authored Jul 10, 2024
2 parents d344522 + 90dd2bb commit 0644874
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { AddressPill } from "../AddressPill/AddressPill";

export const OriginationTile = ({ operation }: { operation: OriginationOperation }) => {
const isMultisig =
operation.originatedContract.codeHash === CODE_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 0644874

Please sign in to comment.