Skip to content

Commit

Permalink
creates 'package published' field
Browse files Browse the repository at this point in the history
  • Loading branch information
apburnie committed Jun 23, 2022
1 parent c680c3d commit 6f8896d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type TxnState = CertifiedTransaction & {
txError: string;
mutated: SuiObjectRef[];
created: SuiObjectRef[];
published?: string;
timestamp_ms: number;
};
// TODO: update state to include Call types
Expand Down Expand Up @@ -107,6 +108,10 @@ const transformTransactionResponse = (
txObj: TransactionEffectsResponse,
id: string
): TxnState => {
const getPublishedPackageId = (
txObj: TransactionEffectsResponse
): string | undefined =>
txObj.effects.events?.find((x) => 'publish' in x)?.publish?.packageId;
return {
...txObj.certificate,
status: getExecutionStatusType(txObj),
Expand All @@ -117,6 +122,7 @@ const transformTransactionResponse = (
mutated: getCreatedOrMutatedData(txObj.effects, 'mutated'),
created: getCreatedOrMutatedData(txObj.effects, 'created'),
timestamp_ms: txObj.timestamp_ms,
published: getPublishedPackageId(txObj),
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ export type DataType = CertifiedTransaction & {
txError: string;
mutated: SuiObjectRef[];
created: SuiObjectRef[];
published?: string;
timestamp_ms: number;
};
12 changes: 12 additions & 0 deletions explorer/client/src/pages/transaction-result/TransactionView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ type TxDataProps = CertifiedTransaction & {
txError: string;
mutated: SuiObjectRef[];
created: SuiObjectRef[];
published?: string;
};

// Generate an Arr of Obj with Label and Value
Expand Down Expand Up @@ -77,6 +78,17 @@ function formatTxResponse(tx: TxDataProps, txId: string) {
label: 'Transaction Signature',
value: tx.txSignature,
},
...(tx.published
? [
{
label: 'Package Published',
category: 'objects',
value: tx.published,
list: false,
link: true,
},
]
: []),
...(tx.mutated?.length
? [
{
Expand Down

0 comments on commit 6f8896d

Please sign in to comment.