Skip to content

Commit 4b6cf20

Browse files
committed
feat: show app update label
1 parent f8877e4 commit 4b6cf20

File tree

5 files changed

+16
-2
lines changed

5 files changed

+16
-2
lines changed

src/features/transactions-graph/components/horizontal.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ function VectorLabelText({ type }: { type: LabelType }) {
6363
if (type === LabelType.PaymentTransferRemainder || type === LabelType.AssetTransferRemainder) return <span>Remainder</span>
6464
if (type === LabelType.AppCall) return <span>App Call</span>
6565
if (type === LabelType.AppCreate) return <span>App Create</span>
66+
if (type === LabelType.AppUpdate) return <span>App Update</span>
6667
if (type === LabelType.AssetCreate) return <span>Asset Create</span>
6768
if (type === LabelType.AssetReconfigure)
6869
return (

src/features/transactions-graph/mappers/horizontals.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,12 @@ const getAppCallTransactionRepresentations = (
114114
verticalId: verticals.find((c) => c.type === 'Application' && transaction.applicationId === c.applicationId)?.id ?? -1,
115115
}
116116

117-
const type = transaction.subType === AppCallTransactionSubType.Create ? LabelType.AppCreate : LabelType.AppCall
117+
const type =
118+
transaction.subType === AppCallTransactionSubType.Create
119+
? LabelType.AppCreate
120+
: transaction.subType === AppCallTransactionSubType.Update
121+
? LabelType.AppUpdate
122+
: LabelType.AppCall
118123
return [asTransactionGraphRepresentation(from, to, { type })]
119124
}
120125

src/features/transactions-graph/models/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export enum LabelType {
3636
AssetTransferRemainder = 'AssetTransferRemainder',
3737
AppCall = 'AppCall',
3838
AppCreate = 'AppCreate',
39+
AppUpdate = 'AppUpdate',
3940
AssetCreate = 'AssetCreate',
4041
AssetReconfigure = 'AssetReconfigure',
4142
AssetDestroy = 'AssetDestroy',
@@ -68,6 +69,7 @@ export type Label =
6869
| { type: LabelType.Clawback; asset: AsyncMaybeAtom<AssetSummary>; amount: number | bigint }
6970
| { type: LabelType.AppCall }
7071
| { type: LabelType.AppCreate }
72+
| { type: LabelType.AppUpdate }
7173
| { type: LabelType.AssetCreate }
7274
| { type: LabelType.AssetReconfigure }
7375
| { type: LabelType.AssetDestroy }

src/features/transactions/mappers/app-call-transaction-mappers.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ const mapCommonAppCallTransactionProperties = (
5454
indexPrefix?: string
5555
) => {
5656
invariant(transactionResult.applicationTransaction, 'application-transaction is not set')
57+
5758
const isCreate = !transactionResult.applicationTransaction.applicationId
5859
const onCompletion = asAppCallOnComplete(transactionResult.applicationTransaction.onCompletion)
5960
const isOpUp =
@@ -68,7 +69,11 @@ const mapCommonAppCallTransactionProperties = (
6869
return {
6970
...mapCommonTransactionProperties(transactionResult),
7071
type: TransactionType.AppCall,
71-
subType: isCreate ? AppCallTransactionSubType.Create : undefined,
72+
subType: isCreate
73+
? AppCallTransactionSubType.Create
74+
: onCompletion === AppCallOnComplete.Update
75+
? AppCallTransactionSubType.Update
76+
: undefined,
7277
isOpUp,
7378
applicationId: transactionResult.applicationTransaction.applicationId
7479
? transactionResult.applicationTransaction.applicationId

src/features/transactions/models/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ export type LocalStateDelta = RawLocalStateDelta | DecodedLocalStateDelta
160160

161161
export enum AppCallTransactionSubType {
162162
Create = 'Create',
163+
Update = 'Update',
163164
}
164165

165166
export type BaseAppCallTransaction = CommonTransactionProperties & {

0 commit comments

Comments
 (0)