From a831d5148d2ec7d920706e25511355eaf3a56f01 Mon Sep 17 00:00:00 2001 From: catalinfaurpaul Date: Wed, 25 Oct 2023 09:56:40 +0300 Subject: [PATCH] add support for codeHash for each contract upgrade --- src/common/indexer/entities/sc.deploy.ts | 2 ++ src/endpoints/accounts/account.service.ts | 1 + src/endpoints/accounts/entities/contract.upgrades.ts | 4 ++++ 3 files changed, 7 insertions(+) diff --git a/src/common/indexer/entities/sc.deploy.ts b/src/common/indexer/entities/sc.deploy.ts index c744522ee..38a5ea424 100644 --- a/src/common/indexer/entities/sc.deploy.ts +++ b/src/common/indexer/entities/sc.deploy.ts @@ -2,6 +2,7 @@ export interface ScDeploy { address: string; contract: string; deployTxHash: string; + initialCodeHash: string; deployer: string; timestamp: number; upgrades: ScDeployUpgrade[]; @@ -10,5 +11,6 @@ export interface ScDeploy { export interface ScDeployUpgrade { upgrader: string; upgradeTxHash: string; + codeHash: string; timestamp: number; } diff --git a/src/endpoints/accounts/account.service.ts b/src/endpoints/accounts/account.service.ts index ca244196b..b9ba011b4 100644 --- a/src/endpoints/accounts/account.service.ts +++ b/src/endpoints/accounts/account.service.ts @@ -585,6 +585,7 @@ export class AccountService { const upgrades = details.upgrades.map(item => ApiUtils.mergeObjects(new ContractUpgrades(), { address: item.upgrader, txHash: item.upgradeTxHash, + codeHash: item.codeHash, timestamp: item.timestamp, })).sortedDescending(item => item.timestamp); diff --git a/src/endpoints/accounts/entities/contract.upgrades.ts b/src/endpoints/accounts/entities/contract.upgrades.ts index fd0024720..996d9e32d 100644 --- a/src/endpoints/accounts/entities/contract.upgrades.ts +++ b/src/endpoints/accounts/entities/contract.upgrades.ts @@ -14,6 +14,10 @@ export class ContractUpgrades { @ApiProperty({ type: String, nullable: true, example: '1c8c6b2148f25621fa2c798a2c9a184df61fdd1991aa0af7ea01eb7b89025d2a' }) txHash: string = ''; + @Field(() => String, { description: 'CodeHash details.' }) + @ApiProperty({ type: String, nullable: true, example: '1c8c6b2148f25621fa2c798a2c9a184df61fdd1991aa0af7ea01eb7b89025d2a' }) + codeHash: string = ''; + @Field(() => Float, { description: 'Timestamp details.' }) @ApiProperty({ type: Number, nullable: true, example: '1638577452' }) timestamp: number = 0;