From 7bf3d3c76c20bcaf8ce9bb063bd94cdedaa37a1c Mon Sep 17 00:00:00 2001 From: Petar Todorovic Date: Fri, 15 Aug 2025 13:56:12 +0200 Subject: [PATCH] feat: schema changes --- packages/api-hooks/package.json | 2 +- packages/api-hooks/src/api/index.msw.ts | 14 ++++++++++++++ .../api-hooks/src/api/schemas/createOAVDto.ts | 8 ++++++++ .../api-hooks/src/api/schemas/eRCStandards.ts | 9 +++++++++ packages/api-hooks/src/api/schemas/index.ts | 5 +++++ .../src/api/schemas/oAVResponseDto.ts | 18 ++++++++++++++++++ .../src/api/schemas/oAVStrategyDto.ts | 6 ++++++ packages/api-hooks/src/api/schemas/team.ts | 2 ++ packages/api-hooks/src/api/schemas/teamDto.ts | 1 + .../src/api/schemas/transactionFormat.ts | 1 + .../api-hooks/src/api/schemas/updateOAVDto.ts | 8 ++++++++ .../api-hooks/src/api/schemas/validatorDto.ts | 3 +++ .../src/api/schemas/yieldMetadataDto.ts | 2 ++ 13 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 packages/api-hooks/src/api/schemas/createOAVDto.ts create mode 100644 packages/api-hooks/src/api/schemas/eRCStandards.ts create mode 100644 packages/api-hooks/src/api/schemas/oAVResponseDto.ts create mode 100644 packages/api-hooks/src/api/schemas/oAVStrategyDto.ts create mode 100644 packages/api-hooks/src/api/schemas/updateOAVDto.ts diff --git a/packages/api-hooks/package.json b/packages/api-hooks/package.json index ac1bdb6..a413250 100644 --- a/packages/api-hooks/package.json +++ b/packages/api-hooks/package.json @@ -1,7 +1,7 @@ { "name": "@stakekit/api-hooks", "description": "React hooks for StakeKit API", - "version": "0.0.108", + "version": "0.0.109", "type": "module", "types": "./dist/index.d.ts", "main": "./dist/index.js", diff --git a/packages/api-hooks/src/api/index.msw.ts b/packages/api-hooks/src/api/index.msw.ts index a477658..e4e0e18 100644 --- a/packages/api-hooks/src/api/index.msw.ts +++ b/packages/api-hooks/src/api/index.msw.ts @@ -4,6 +4,7 @@ import { ActionStatus, ActionTypes, BalanceTypes, + ERCStandards, FeeConfigurationStatus, GasMode, HealthStatus, @@ -2469,6 +2470,10 @@ export const getYieldV2ControllerGetYieldByIdResponseMock = ( })), undefined, ]), + supportedStandards: faker.helpers.arrayElement([ + faker.helpers.arrayElements(Object.values(ERCStandards)), + undefined, + ]), supportsLedgerWalletApi: faker.helpers.arrayElement([ faker.datatype.boolean(), undefined, @@ -2594,6 +2599,7 @@ export const getYieldV2ControllerGetYieldByIdResponseMock = ( undefined, ]), image: faker.helpers.arrayElement([faker.word.sample(), undefined]), + marketCap: faker.helpers.arrayElement([faker.word.sample(), undefined]), minimumStake: faker.helpers.arrayElement([faker.word.sample(), undefined]), name: faker.helpers.arrayElement([faker.word.sample(), undefined]), nominatorCount: faker.helpers.arrayElement([ @@ -2620,6 +2626,8 @@ export const getYieldV2ControllerGetYieldByIdResponseMock = ( faker.number.int({ min: undefined, max: undefined }), undefined, ]), + subnetName: faker.helpers.arrayElement([faker.word.sample(), undefined]), + tokenSymbol: faker.helpers.arrayElement([faker.word.sample(), undefined]), votingPower: faker.helpers.arrayElement([ faker.number.int({ min: undefined, max: undefined }), undefined, @@ -2656,6 +2664,7 @@ export const getYieldV2ControllerFindYieldValidatorsResponseMock = ( undefined, ]), image: faker.helpers.arrayElement([faker.word.sample(), undefined]), + marketCap: faker.helpers.arrayElement([faker.word.sample(), undefined]), minimumStake: faker.helpers.arrayElement([ faker.word.sample(), undefined, @@ -2691,6 +2700,8 @@ export const getYieldV2ControllerFindYieldValidatorsResponseMock = ( faker.number.int({ min: undefined, max: undefined }), undefined, ]), + subnetName: faker.helpers.arrayElement([faker.word.sample(), undefined]), + tokenSymbol: faker.helpers.arrayElement([faker.word.sample(), undefined]), votingPower: faker.helpers.arrayElement([ faker.number.int({ min: undefined, max: undefined }), undefined, @@ -2727,6 +2738,7 @@ export const getYieldV2ControllerFindValidatorsResponseMock = ( undefined, ]), image: faker.helpers.arrayElement([faker.word.sample(), undefined]), + marketCap: faker.helpers.arrayElement([faker.word.sample(), undefined]), minimumStake: faker.helpers.arrayElement([ faker.word.sample(), undefined, @@ -2762,6 +2774,8 @@ export const getYieldV2ControllerFindValidatorsResponseMock = ( faker.number.int({ min: undefined, max: undefined }), undefined, ]), + subnetName: faker.helpers.arrayElement([faker.word.sample(), undefined]), + tokenSymbol: faker.helpers.arrayElement([faker.word.sample(), undefined]), votingPower: faker.helpers.arrayElement([ faker.number.int({ min: undefined, max: undefined }), undefined, diff --git a/packages/api-hooks/src/api/schemas/createOAVDto.ts b/packages/api-hooks/src/api/schemas/createOAVDto.ts new file mode 100644 index 0000000..38c861c --- /dev/null +++ b/packages/api-hooks/src/api/schemas/createOAVDto.ts @@ -0,0 +1,8 @@ +import type { OAVStrategyDto } from './oAVStrategyDto'; + +export interface CreateOAVDto { + /** vOAV Integration ID (must be an existing vOAV integration from core) */ + integrationId: string; + /** Array of strategies with weights and APYs */ + strategies: OAVStrategyDto[]; +} diff --git a/packages/api-hooks/src/api/schemas/eRCStandards.ts b/packages/api-hooks/src/api/schemas/eRCStandards.ts new file mode 100644 index 0000000..bca2675 --- /dev/null +++ b/packages/api-hooks/src/api/schemas/eRCStandards.ts @@ -0,0 +1,9 @@ +export type ERCStandards = (typeof ERCStandards)[keyof typeof ERCStandards]; + +// eslint-disable-next-line @typescript-eslint/no-redeclare +export const ERCStandards = { + ERC20: 'ERC20', + ERC4626: 'ERC4626', + ERC721: 'ERC721', + ERC1155: 'ERC1155', +} as const; diff --git a/packages/api-hooks/src/api/schemas/index.ts b/packages/api-hooks/src/api/schemas/index.ts index f08ebf1..af8469c 100644 --- a/packages/api-hooks/src/api/schemas/index.ts +++ b/packages/api-hooks/src/api/schemas/index.ts @@ -51,6 +51,7 @@ export * from './createFeeConfigurationDto'; export * from './createFeeConfigurationDtoV2'; export * from './createKeyDto'; export * from './createMasterBannedRegionDto'; +export * from './createOAVDto'; export * from './createPayoutAddressDto'; export * from './createProjectDto'; export * from './createTeamDto'; @@ -72,6 +73,7 @@ export * from './deleteBannedRegionsDto'; export * from './deleteEnabledYieldsDto'; export * from './deleteMasterBannedRegionsDto'; export * from './durationArgumentOptionsDto'; +export * from './eRCStandards'; export * from './enabledYieldDto'; export * from './evmEIP1559GasArgsDto'; export * from './evmEIP1559GasArgsDtoType'; @@ -106,6 +108,8 @@ export * from './masterBannedYieldDto'; export * from './masterBannedYieldDtoTagsItem'; export * from './networks'; export * from './notFoundDto'; +export * from './oAVResponseDto'; +export * from './oAVStrategyDto'; export * from './payoutAddressDto'; export * from './pendingActionArgumentsDto'; export * from './pendingActionConstraintAmountDto'; @@ -185,6 +189,7 @@ export * from './unauthorizedDto'; export * from './updateCustomUriDto'; export * from './updateFeeConfigurationDto'; export * from './updateKeyDto'; +export * from './updateOAVDto'; export * from './updatePayoutAddressDto'; export * from './updateProjectDto'; export * from './updateTeamDto'; diff --git a/packages/api-hooks/src/api/schemas/oAVResponseDto.ts b/packages/api-hooks/src/api/schemas/oAVResponseDto.ts new file mode 100644 index 0000000..665ef67 --- /dev/null +++ b/packages/api-hooks/src/api/schemas/oAVResponseDto.ts @@ -0,0 +1,18 @@ +import type { OAVStrategyDto } from './oAVStrategyDto'; + +export interface OAVResponseDto { + /** Creation timestamp */ + createdAt: string; + /** Unique identifier */ + id: string; + /** Integration ID for the OAV */ + integrationId: string; + /** Whether the OAV is active */ + isActive: boolean; + /** Project ID */ + projectId: string; + /** Array of strategies with yield IDs and weights */ + strategies: OAVStrategyDto[]; + /** Last update timestamp */ + updatedAt: string; +} diff --git a/packages/api-hooks/src/api/schemas/oAVStrategyDto.ts b/packages/api-hooks/src/api/schemas/oAVStrategyDto.ts new file mode 100644 index 0000000..3d17f6b --- /dev/null +++ b/packages/api-hooks/src/api/schemas/oAVStrategyDto.ts @@ -0,0 +1,6 @@ +export interface OAVStrategyDto { + /** Weight percentage for this strategy (greater than 0, up to 100) */ + weight: number; + /** Yield ID for the strategy */ + yieldId: string; +} diff --git a/packages/api-hooks/src/api/schemas/team.ts b/packages/api-hooks/src/api/schemas/team.ts index 96cfef8..84af222 100644 --- a/packages/api-hooks/src/api/schemas/team.ts +++ b/packages/api-hooks/src/api/schemas/team.ts @@ -10,6 +10,8 @@ export interface Team { deletedAt: string | null; id: string; name: string; + /** Whether the team can access OAV functionality */ + oavEnabled: boolean; providerId: string | null; serviceConditionsAcceptedAt: string | null; type: TeamType; diff --git a/packages/api-hooks/src/api/schemas/teamDto.ts b/packages/api-hooks/src/api/schemas/teamDto.ts index ddd8cad..59da9ef 100644 --- a/packages/api-hooks/src/api/schemas/teamDto.ts +++ b/packages/api-hooks/src/api/schemas/teamDto.ts @@ -10,5 +10,6 @@ export interface TeamDto { deletedAt: string | null; id: string; name: string; + oavEnabled: boolean; serviceConditionsAcceptedAt: string | null; } diff --git a/packages/api-hooks/src/api/schemas/transactionFormat.ts b/packages/api-hooks/src/api/schemas/transactionFormat.ts index ec006ac..95e20d6 100644 --- a/packages/api-hooks/src/api/schemas/transactionFormat.ts +++ b/packages/api-hooks/src/api/schemas/transactionFormat.ts @@ -4,4 +4,5 @@ export type TransactionFormat = // eslint-disable-next-line @typescript-eslint/no-redeclare export const TransactionFormat = { raw: 'raw', + default: 'default', } as const; diff --git a/packages/api-hooks/src/api/schemas/updateOAVDto.ts b/packages/api-hooks/src/api/schemas/updateOAVDto.ts new file mode 100644 index 0000000..5b478cc --- /dev/null +++ b/packages/api-hooks/src/api/schemas/updateOAVDto.ts @@ -0,0 +1,8 @@ +import type { OAVStrategyDto } from './oAVStrategyDto'; + +export interface UpdateOAVDto { + /** Whether the OAV is active */ + isActive?: boolean; + /** Array of strategies with weights and APYs */ + strategies?: OAVStrategyDto[]; +} diff --git a/packages/api-hooks/src/api/schemas/validatorDto.ts b/packages/api-hooks/src/api/schemas/validatorDto.ts index 5238df7..2da7201 100644 --- a/packages/api-hooks/src/api/schemas/validatorDto.ts +++ b/packages/api-hooks/src/api/schemas/validatorDto.ts @@ -6,6 +6,7 @@ export interface ValidatorDto { commission?: number; endDate?: string; image?: string; + marketCap?: string; minimumStake?: string; name?: string; nominatorCount?: number; @@ -17,6 +18,8 @@ export interface ValidatorDto { stakedBalance?: string; status: ValidatorStatusTypes; subnetId?: number; + subnetName?: string; + tokenSymbol?: string; votingPower?: number; website?: string; } diff --git a/packages/api-hooks/src/api/schemas/yieldMetadataDto.ts b/packages/api-hooks/src/api/schemas/yieldMetadataDto.ts index d879def..4ce36f3 100644 --- a/packages/api-hooks/src/api/schemas/yieldMetadataDto.ts +++ b/packages/api-hooks/src/api/schemas/yieldMetadataDto.ts @@ -6,6 +6,7 @@ import type { YieldProviderDto } from './yieldProviderDto'; import type { YieldRevshareDto } from './yieldRevshareDto'; import type { RewardClaiming } from './rewardClaiming'; import type { RewardSchedule } from './rewardSchedule'; +import type { ERCStandards } from './eRCStandards'; import type { YieldType } from './yieldType'; export interface YieldMetadataDto { @@ -25,6 +26,7 @@ export interface YieldMetadataDto { rewardClaiming: RewardClaiming; rewardSchedule: RewardSchedule; rewardTokens?: TokenDto[]; + supportedStandards?: ERCStandards[]; supportsLedgerWalletApi?: boolean; supportsMultipleValidators?: boolean; token: TokenDto;