Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions lib/opengradient/contracts/teeRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import TEERegistryAbi from './abi/TEERegistry.json';
import { ethDevnetProvider } from './providers';

export const TEE_REGISTRY_ADDRESS = '0x4e72238852f3c918f4E4e57AeC9280dDB0c80248';
export const TEE_REGISTRY_ADDRESS = '0x703cB174AEadB35D611858369B4b1111dC9Abda6';

const contract = new ethers.Contract(TEE_REGISTRY_ADDRESS, TEERegistryAbi, ethDevnetProvider);

Expand Down Expand Up @@ -50,8 +50,8 @@
approvedPCRs: number;
}

export const getTEETypes = async(): Promise<Array<TEETypeInfo>> => {
const [ typeIds, infos ] = await contract.getTEETypes();
export const getTEETypes = async (): Promise<Array<TEETypeInfo>> => {

Check failure on line 53 in lib/opengradient/contracts/teeRegistry.ts

View workflow job for this annotation

GitHub Actions / Code quality

Unexpected space before function parentheses
const [typeIds, infos] = await contract.getTEETypes();

Check failure on line 54 in lib/opengradient/contracts/teeRegistry.ts

View workflow job for this annotation

GitHub Actions / Code quality

A space is required before ']'

Check failure on line 54 in lib/opengradient/contracts/teeRegistry.ts

View workflow job for this annotation

GitHub Actions / Code quality

A space is required after '['

return (typeIds as Array<number>).map((typeId: number, i: number) => ({
typeId: Number(typeId),
Expand All @@ -74,42 +74,42 @@
lastHeartbeatAt: BigInt(raw.lastHeartbeatAt as ethers.BigNumberish),
});

export const getTEEsByType = async(teeType: number): Promise<Array<string>> => {
export const getTEEsByType = async (teeType: number): Promise<Array<string>> => {

Check failure on line 77 in lib/opengradient/contracts/teeRegistry.ts

View workflow job for this annotation

GitHub Actions / Code quality

Unexpected space before function parentheses
const teeIds = await contract.getTEEsByType(teeType);
return (teeIds as Array<string>).map(String);
};

export const getEnabledTEEs = async(teeType: number): Promise<Array<string>> => {
export const getEnabledTEEs = async (teeType: number): Promise<Array<string>> => {

Check failure on line 82 in lib/opengradient/contracts/teeRegistry.ts

View workflow job for this annotation

GitHub Actions / Code quality

Unexpected space before function parentheses
const teeIds = await contract.getEnabledTEEs(teeType);
return (teeIds as Array<string>).map(String);
};

export const getTEE = async(teeId: string): Promise<TEEInfo> => {
export const getTEE = async (teeId: string): Promise<TEEInfo> => {

Check failure on line 87 in lib/opengradient/contracts/teeRegistry.ts

View workflow job for this annotation

GitHub Actions / Code quality

Unexpected space before function parentheses
const raw = await contract.getTEE(teeId);
return parseTEEInfo(teeId, raw);
};

export const isTEEActive = async(teeId: string): Promise<boolean> => {
export const isTEEActive = async (teeId: string): Promise<boolean> => {

Check failure on line 92 in lib/opengradient/contracts/teeRegistry.ts

View workflow job for this annotation

GitHub Actions / Code quality

Unexpected space before function parentheses
return contract.isTEEActive(teeId);
};

export const getApprovedPCRs = async(): Promise<Array<{ pcrHash: string; teeType: number }>> => {
export const getApprovedPCRs = async (): Promise<Array<{ pcrHash: string; teeType: number }>> => {

Check failure on line 96 in lib/opengradient/contracts/teeRegistry.ts

View workflow job for this annotation

GitHub Actions / Code quality

Unexpected space before function parentheses
const pcrs = await contract.getApprovedPCRs();
return (pcrs as Array<{ pcrHash: string; teeType: number }>).map((p) => ({
pcrHash: String(p.pcrHash),
teeType: Number(p.teeType),
}));
};

export const getHeartbeatMaxAge = async(): Promise<bigint> => {
export const getHeartbeatMaxAge = async (): Promise<bigint> => {

Check failure on line 104 in lib/opengradient/contracts/teeRegistry.ts

View workflow job for this annotation

GitHub Actions / Code quality

Unexpected space before function parentheses
const maxAge = await contract.heartbeatMaxAge();
return BigInt(maxAge);
};

/**
* Fetch full registry overview: types, nodes per type with status, and global stats.
*/
export const getTEERegistryOverview = async(): Promise<{
export const getTEERegistryOverview = async (): Promise<{

Check failure on line 112 in lib/opengradient/contracts/teeRegistry.ts

View workflow job for this annotation

GitHub Actions / Code quality

Unexpected space before function parentheses
types: Array<TEETypeSummary>;
stats: TEERegistryStats;
nodesByType: Record<number, Array<TEENodeWithStatus>>;
Expand All @@ -135,7 +135,7 @@
let totalEnabled = 0;

for (const teeType of types) {
const [ allIds, enabledIds ] = await Promise.all([
const [allIds, enabledIds] = await Promise.all([
getTEEsByType(teeType.typeId),
getEnabledTEEs(teeType.typeId),
]);
Expand All @@ -144,8 +144,8 @@

// Fetch details for all TEEs of this type
const nodes: Array<TEENodeWithStatus> = [];
const teeDetailsPromises = allIds.map(async(teeId) => {
const [ teeInfo, active ] = await Promise.all([
const teeDetailsPromises = allIds.map(async (teeId) => {
const [teeInfo, active] = await Promise.all([
getTEE(teeId),
isTEEActive(teeId).catch(() => false),
]);
Expand Down Expand Up @@ -187,4 +187,4 @@
};
};

export const TEE_REGISTRY_QUERY_KEY = [ 'opengradient', 'teeRegistry' ];
export const TEE_REGISTRY_QUERY_KEY = ['opengradient', 'teeRegistry'];
Loading