@polygonlabs/staking-api-client 1.6.0 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,9 @@
1
1
  // This file is auto-generated by @hey-api/openapi-ts
2
- import { AddValidatorV2Body, AdminCountResponse, AdminEngagementStateResponse, AdminExportResponse, AdminImportBody, AdminImportResponse, AdminSetEngagementStateBody, AdminUpsertValidatorProfileBody, AdminValidatorProfileResponse, CheckpointsSignedCursorQuery, CheckpointsSignedCursorV2Response, CheckpointsSignedCursorV3Response, CheckpointsSignedV3Response, DelegationsByUserV3Response, DelegatorsListV3Response, DelegatorUnbondsV2Response, DelegatorUnbondsV3Response, ErrorResponse, GetAllNotificationsQuery, GetAllValidatorsV2Query, GetAllValidatorsV3Query, GetAllValidatorsV3Response, GetValidatorSetV3Query, GetValidatorSetV3Response, GetValidatorV3Response, LoginV3Response, NotificationArrayResponse, NotificationsCursorQuery, NotificationsCursorResponse, SummaryV3Response, UpdateValidatorV2Body, V2DelegatorArrayResponse, V2DelegatorObjectResponse, V2MonitorResponse, V2RewardsResponse, V2ValidatorArrayResponse, V2ValidatorObjectResponse, ValidationErrorResponse } from '@polygonlabs/staking-api-schemas';
2
+ import { AddValidatorV2Body, AdminCountResponse, AdminEngagementStateResponse, AdminExportResponse, AdminImportBody, AdminImportResponse, AdminSetEngagementStateBody, AdminUpsertValidatorProfileBody, AdminValidatorProfileResponse, CheckpointsSignedCursorQuery, CheckpointsSignedCursorV2Response, CheckpointsSignedCursorV3Response, CheckpointsSignedV3Response, DelegationsByUserV3Response, DelegatorsCursorQuery, DelegatorsCursorV2Response, DelegatorsCursorV3Response, DelegatorsListV3Response, DelegatorUnbondsV2Response, DelegatorUnbondsV3Response, ErrorResponse, GetAllNotificationsQuery, GetAllValidatorsV2Query, GetAllValidatorsV3Query, GetAllValidatorsV3Response, GetValidatorSetV3Query, GetValidatorSetV3Response, GetValidatorV3Response, LoginV3Response, NotificationArrayResponse, NotificationsCursorQuery, NotificationsCursorResponse, SummaryV3Response, UpdateValidatorV2Body, V2DelegatorArrayResponse, V2DelegatorObjectResponse, V2MonitorResponse, V2RewardsResponse, V2ValidatorArrayResponse, V2ValidatorObjectResponse, ValidationErrorResponse } from '@polygonlabs/staking-api-schemas';
3
3
  import { queryOptions } from '@tanstack/react-query';
4
4
  import { z } from 'zod';
5
5
  import { client } from './client.gen.js';
6
- import { addValidatorV2 as addValidatorV22, adminExportCount as adminExportCount2, adminExportDocuments as adminExportDocuments2, adminImportDocuments as adminImportDocuments2, adminSetValidatorEngagementState as adminSetValidatorEngagementState2, adminUpsertValidatorProfile as adminUpsertValidatorProfile2, getAllDelegatorsV2 as getAllDelegatorsV22, getAllDelegatorsV3 as getAllDelegatorsV32, getAllNotificationsPageV2 as getAllNotificationsPageV22, getAllNotificationsPageV3 as getAllNotificationsPageV32, getAllNotificationsV2 as getAllNotificationsV22, getAllNotificationsV3 as getAllNotificationsV32, getAllValidatorsV2 as getAllValidatorsV22, getAllValidatorsV3 as getAllValidatorsV32, getCheckpointIntervalV2 as getCheckpointIntervalV22, getCheckpointsSignedByValidatorV2 as getCheckpointsSignedByValidatorV22, getCheckpointsSignedByValidatorV3 as getCheckpointsSignedByValidatorV32, getCheckpointsSignedPageV2 as getCheckpointsSignedPageV22, getCheckpointsSignedPageV3 as getCheckpointsSignedPageV32, getCommissionedRewardV2 as getCommissionedRewardV22, getCurrentAprV2 as getCurrentAprV22, getDelegationsByUserV2 as getDelegationsByUserV22, getDelegationsByUserV3 as getDelegationsByUserV32, getDelegatorUnbondsV2 as getDelegatorUnbondsV22, getDelegatorUnbondsV3 as getDelegatorUnbondsV32, getMissedCheckpointsByAllValidatorsV2 as getMissedCheckpointsByAllValidatorsV22, getPerformanceBenchmarkV2 as getPerformanceBenchmarkV22, getRewardsSummaryV2 as getRewardsSummaryV22, getSignerAddressListForCheckpointNumberV2 as getSignerAddressListForCheckpointNumberV22, getSignerAddressListForLatestCheckpointV2 as getSignerAddressListForLatestCheckpointV22, getSignerEthBalancesV2 as getSignerEthBalancesV22, getSummaryV3 as getSummaryV32, getTotalStakedV2 as getTotalStakedV22, getUserLoginV3 as getUserLoginV32, getValidatorByAddressV2 as getValidatorByAddressV22, getValidatorDelegatorsV2 as getValidatorDelegatorsV22, getValidatorDelegatorsV3 as getValidatorDelegatorsV32, getValidatorSetV3 as getValidatorSetV32, getValidatorV2 as getValidatorV22, getValidatorV3 as getValidatorV32, updateValidatorV2 as updateValidatorV22 } from './sdk.gen.js';
6
+ import { addValidatorV2 as addValidatorV22, adminExportCount as adminExportCount2, adminExportDocuments as adminExportDocuments2, adminImportDocuments as adminImportDocuments2, adminSetValidatorEngagementState as adminSetValidatorEngagementState2, adminUpsertValidatorProfile as adminUpsertValidatorProfile2, getAllDelegatorsPageV2 as getAllDelegatorsPageV22, getAllDelegatorsPageV3 as getAllDelegatorsPageV32, getAllDelegatorsV2 as getAllDelegatorsV22, getAllDelegatorsV3 as getAllDelegatorsV32, getAllNotificationsPageV2 as getAllNotificationsPageV22, getAllNotificationsPageV3 as getAllNotificationsPageV32, getAllNotificationsV2 as getAllNotificationsV22, getAllNotificationsV3 as getAllNotificationsV32, getAllValidatorsV2 as getAllValidatorsV22, getAllValidatorsV3 as getAllValidatorsV32, getCheckpointIntervalV2 as getCheckpointIntervalV22, getCheckpointsSignedByValidatorV2 as getCheckpointsSignedByValidatorV22, getCheckpointsSignedByValidatorV3 as getCheckpointsSignedByValidatorV32, getCheckpointsSignedPageV2 as getCheckpointsSignedPageV22, getCheckpointsSignedPageV3 as getCheckpointsSignedPageV32, getCommissionedRewardV2 as getCommissionedRewardV22, getCurrentAprV2 as getCurrentAprV22, getCurrentSpolApyV2 as getCurrentSpolApyV22, getDelegationsByUserV2 as getDelegationsByUserV22, getDelegationsByUserV3 as getDelegationsByUserV32, getDelegatorUnbondsV2 as getDelegatorUnbondsV22, getDelegatorUnbondsV3 as getDelegatorUnbondsV32, getMissedCheckpointsByAllValidatorsV2 as getMissedCheckpointsByAllValidatorsV22, getPerformanceBenchmarkV2 as getPerformanceBenchmarkV22, getRewardsSummaryV2 as getRewardsSummaryV22, getSignerAddressListForCheckpointNumberV2 as getSignerAddressListForCheckpointNumberV22, getSignerAddressListForLatestCheckpointV2 as getSignerAddressListForLatestCheckpointV22, getSignerEthBalancesV2 as getSignerEthBalancesV22, getSummaryV3 as getSummaryV32, getTotalStakedV2 as getTotalStakedV22, getUserLoginV3 as getUserLoginV32, getValidatorByAddressV2 as getValidatorByAddressV22, getValidatorDelegatorsPageV2 as getValidatorDelegatorsPageV22, getValidatorDelegatorsPageV3 as getValidatorDelegatorsPageV32, getValidatorDelegatorsV2 as getValidatorDelegatorsV22, getValidatorDelegatorsV3 as getValidatorDelegatorsV32, getValidatorSetV3 as getValidatorSetV32, getValidatorV2 as getValidatorV22, getValidatorV3 as getValidatorV32, updateValidatorV2 as updateValidatorV22 } from './sdk.gen.js';
7
7
  export const adminUpsertValidatorProfileTransformer = async (data) => await AdminValidatorProfileResponse.parseAsync(data);
8
8
  export const adminUpsertValidatorProfileErrorTransformer = async (data) => await z.union([ValidationErrorResponse, ErrorResponse]).parseAsync(data);
9
9
  /**
@@ -525,6 +525,54 @@ export const getAllDelegatorsV3 = async (options) => {
525
525
  }
526
526
  return result;
527
527
  };
528
+ export const getAllDelegatorsPageV3Transformer = async (data) => await DelegatorsCursorV3Response.parseAsync(data);
529
+ export const getAllDelegatorsPageV3ErrorTransformer = async (data) => await z.union([ValidationErrorResponse, ErrorResponse]).parseAsync(data);
530
+ export const getAllDelegatorsPageV3InputTransformer = async (input) => ({ ...input.query !== undefined ? { query: await z.encode(DelegatorsCursorQuery, input.query) } : {} });
531
+ export const getAllDelegatorsPageV3 = async (options) => {
532
+ const transformed = await getAllDelegatorsPageV3InputTransformer(options ?? {});
533
+ let result;
534
+ try {
535
+ result = await getAllDelegatorsPageV32({ ...options, ...transformed });
536
+ }
537
+ catch (err) {
538
+ if (err instanceof Error) {
539
+ throw new TransportError(err);
540
+ }
541
+ let typedErr;
542
+ try {
543
+ typedErr = await getAllDelegatorsPageV3ErrorTransformer(err);
544
+ }
545
+ catch (validationError) {
546
+ throw new ResponseValidationError(validationError, err);
547
+ }
548
+ throw typedErr;
549
+ }
550
+ const errorBearing = result;
551
+ if (typeof result === "object" && result !== null && "request" in result && "response" in result && (typeof errorBearing.error === "object" && errorBearing.error !== null)) {
552
+ if (errorBearing.error instanceof Error) {
553
+ errorBearing.error = new TransportError(errorBearing.error);
554
+ }
555
+ else {
556
+ try {
557
+ errorBearing.error = await getAllDelegatorsPageV3ErrorTransformer(errorBearing.error);
558
+ }
559
+ catch (validationError) {
560
+ errorBearing.error = new ResponseValidationError(validationError, errorBearing.error);
561
+ }
562
+ }
563
+ }
564
+ return result;
565
+ };
566
+ export const getAllDelegatorsPageV3QueryKey = (options) => createQueryKey('getAllDelegatorsPageV3', { ...options, ...options?.query !== undefined ? { query: z.encode(DelegatorsCursorQuery, options?.query) } : {} });
567
+ export const getAllDelegatorsPageV3Options = (options) => queryOptions({ queryFn: async ({ queryKey, signal }) => {
568
+ const { data } = await getAllDelegatorsPageV32({
569
+ ...options,
570
+ ...queryKey[0],
571
+ signal,
572
+ throwOnError: true
573
+ });
574
+ return data;
575
+ }, queryKey: getAllDelegatorsPageV3QueryKey(options) });
528
576
  export const getDelegationsByUserV3Transformer = async (data) => await DelegationsByUserV3Response.parseAsync(data);
529
577
  export const getDelegationsByUserV3ErrorTransformer = async (data) => await z.union([ValidationErrorResponse, ErrorResponse]).parseAsync(data);
530
578
  export const getDelegationsByUserV3 = async (options) => {
@@ -633,6 +681,54 @@ export const getValidatorDelegatorsV3 = async (options) => {
633
681
  }
634
682
  return result;
635
683
  };
684
+ export const getValidatorDelegatorsPageV3Transformer = async (data) => await DelegatorsCursorV3Response.parseAsync(data);
685
+ export const getValidatorDelegatorsPageV3ErrorTransformer = async (data) => await z.union([ValidationErrorResponse, ErrorResponse]).parseAsync(data);
686
+ export const getValidatorDelegatorsPageV3InputTransformer = async (input) => ({ ...input.query !== undefined ? { query: await z.encode(DelegatorsCursorQuery, input.query) } : {} });
687
+ export const getValidatorDelegatorsPageV3 = async (options) => {
688
+ const transformed = await getValidatorDelegatorsPageV3InputTransformer(options);
689
+ let result;
690
+ try {
691
+ result = await getValidatorDelegatorsPageV32({ ...options, ...transformed });
692
+ }
693
+ catch (err) {
694
+ if (err instanceof Error) {
695
+ throw new TransportError(err);
696
+ }
697
+ let typedErr;
698
+ try {
699
+ typedErr = await getValidatorDelegatorsPageV3ErrorTransformer(err);
700
+ }
701
+ catch (validationError) {
702
+ throw new ResponseValidationError(validationError, err);
703
+ }
704
+ throw typedErr;
705
+ }
706
+ const errorBearing = result;
707
+ if (typeof result === "object" && result !== null && "request" in result && "response" in result && (typeof errorBearing.error === "object" && errorBearing.error !== null)) {
708
+ if (errorBearing.error instanceof Error) {
709
+ errorBearing.error = new TransportError(errorBearing.error);
710
+ }
711
+ else {
712
+ try {
713
+ errorBearing.error = await getValidatorDelegatorsPageV3ErrorTransformer(errorBearing.error);
714
+ }
715
+ catch (validationError) {
716
+ errorBearing.error = new ResponseValidationError(validationError, errorBearing.error);
717
+ }
718
+ }
719
+ }
720
+ return result;
721
+ };
722
+ export const getValidatorDelegatorsPageV3QueryKey = (options) => createQueryKey('getValidatorDelegatorsPageV3', { ...options, ...options?.query !== undefined ? { query: z.encode(DelegatorsCursorQuery, options?.query) } : {} });
723
+ export const getValidatorDelegatorsPageV3Options = (options) => queryOptions({ queryFn: async ({ queryKey, signal }) => {
724
+ const { data } = await getValidatorDelegatorsPageV32({
725
+ ...options,
726
+ ...queryKey[0],
727
+ signal,
728
+ throwOnError: true
729
+ });
730
+ return data;
731
+ }, queryKey: getValidatorDelegatorsPageV3QueryKey(options) });
636
732
  export const getSummaryV3Transformer = async (data) => await SummaryV3Response.parseAsync(data);
637
733
  export const getSummaryV3ErrorTransformer = async (data) => await ErrorResponse.parseAsync(data);
638
734
  export const getSummaryV3 = async (options) => {
@@ -1113,6 +1209,54 @@ export const getAllDelegatorsV2 = async (options) => {
1113
1209
  }
1114
1210
  return result;
1115
1211
  };
1212
+ export const getAllDelegatorsPageV2Transformer = async (data) => await DelegatorsCursorV2Response.parseAsync(data);
1213
+ export const getAllDelegatorsPageV2ErrorTransformer = async (data) => await z.union([ValidationErrorResponse, ErrorResponse]).parseAsync(data);
1214
+ export const getAllDelegatorsPageV2InputTransformer = async (input) => ({ ...input.query !== undefined ? { query: await z.encode(DelegatorsCursorQuery, input.query) } : {} });
1215
+ export const getAllDelegatorsPageV2 = async (options) => {
1216
+ const transformed = await getAllDelegatorsPageV2InputTransformer(options ?? {});
1217
+ let result;
1218
+ try {
1219
+ result = await getAllDelegatorsPageV22({ ...options, ...transformed });
1220
+ }
1221
+ catch (err) {
1222
+ if (err instanceof Error) {
1223
+ throw new TransportError(err);
1224
+ }
1225
+ let typedErr;
1226
+ try {
1227
+ typedErr = await getAllDelegatorsPageV2ErrorTransformer(err);
1228
+ }
1229
+ catch (validationError) {
1230
+ throw new ResponseValidationError(validationError, err);
1231
+ }
1232
+ throw typedErr;
1233
+ }
1234
+ const errorBearing = result;
1235
+ if (typeof result === "object" && result !== null && "request" in result && "response" in result && (typeof errorBearing.error === "object" && errorBearing.error !== null)) {
1236
+ if (errorBearing.error instanceof Error) {
1237
+ errorBearing.error = new TransportError(errorBearing.error);
1238
+ }
1239
+ else {
1240
+ try {
1241
+ errorBearing.error = await getAllDelegatorsPageV2ErrorTransformer(errorBearing.error);
1242
+ }
1243
+ catch (validationError) {
1244
+ errorBearing.error = new ResponseValidationError(validationError, errorBearing.error);
1245
+ }
1246
+ }
1247
+ }
1248
+ return result;
1249
+ };
1250
+ export const getAllDelegatorsPageV2QueryKey = (options) => createQueryKey('getAllDelegatorsPageV2', { ...options, ...options?.query !== undefined ? { query: z.encode(DelegatorsCursorQuery, options?.query) } : {} });
1251
+ export const getAllDelegatorsPageV2Options = (options) => queryOptions({ queryFn: async ({ queryKey, signal }) => {
1252
+ const { data } = await getAllDelegatorsPageV22({
1253
+ ...options,
1254
+ ...queryKey[0],
1255
+ signal,
1256
+ throwOnError: true
1257
+ });
1258
+ return data;
1259
+ }, queryKey: getAllDelegatorsPageV2QueryKey(options) });
1116
1260
  export const getDelegationsByUserV2Transformer = async (data) => await V2DelegatorObjectResponse.parseAsync(data);
1117
1261
  export const getDelegationsByUserV2ErrorTransformer = async (data) => await z.union([ValidationErrorResponse, ErrorResponse]).parseAsync(data);
1118
1262
  export const getDelegationsByUserV2 = async (options) => {
@@ -1221,6 +1365,54 @@ export const getValidatorDelegatorsV2 = async (options) => {
1221
1365
  }
1222
1366
  return result;
1223
1367
  };
1368
+ export const getValidatorDelegatorsPageV2Transformer = async (data) => await DelegatorsCursorV2Response.parseAsync(data);
1369
+ export const getValidatorDelegatorsPageV2ErrorTransformer = async (data) => await z.union([ValidationErrorResponse, ErrorResponse]).parseAsync(data);
1370
+ export const getValidatorDelegatorsPageV2InputTransformer = async (input) => ({ ...input.query !== undefined ? { query: await z.encode(DelegatorsCursorQuery, input.query) } : {} });
1371
+ export const getValidatorDelegatorsPageV2 = async (options) => {
1372
+ const transformed = await getValidatorDelegatorsPageV2InputTransformer(options);
1373
+ let result;
1374
+ try {
1375
+ result = await getValidatorDelegatorsPageV22({ ...options, ...transformed });
1376
+ }
1377
+ catch (err) {
1378
+ if (err instanceof Error) {
1379
+ throw new TransportError(err);
1380
+ }
1381
+ let typedErr;
1382
+ try {
1383
+ typedErr = await getValidatorDelegatorsPageV2ErrorTransformer(err);
1384
+ }
1385
+ catch (validationError) {
1386
+ throw new ResponseValidationError(validationError, err);
1387
+ }
1388
+ throw typedErr;
1389
+ }
1390
+ const errorBearing = result;
1391
+ if (typeof result === "object" && result !== null && "request" in result && "response" in result && (typeof errorBearing.error === "object" && errorBearing.error !== null)) {
1392
+ if (errorBearing.error instanceof Error) {
1393
+ errorBearing.error = new TransportError(errorBearing.error);
1394
+ }
1395
+ else {
1396
+ try {
1397
+ errorBearing.error = await getValidatorDelegatorsPageV2ErrorTransformer(errorBearing.error);
1398
+ }
1399
+ catch (validationError) {
1400
+ errorBearing.error = new ResponseValidationError(validationError, errorBearing.error);
1401
+ }
1402
+ }
1403
+ }
1404
+ return result;
1405
+ };
1406
+ export const getValidatorDelegatorsPageV2QueryKey = (options) => createQueryKey('getValidatorDelegatorsPageV2', { ...options, ...options?.query !== undefined ? { query: z.encode(DelegatorsCursorQuery, options?.query) } : {} });
1407
+ export const getValidatorDelegatorsPageV2Options = (options) => queryOptions({ queryFn: async ({ queryKey, signal }) => {
1408
+ const { data } = await getValidatorDelegatorsPageV22({
1409
+ ...options,
1410
+ ...queryKey[0],
1411
+ signal,
1412
+ throwOnError: true
1413
+ });
1414
+ return data;
1415
+ }, queryKey: getValidatorDelegatorsPageV2QueryKey(options) });
1224
1416
  export const getSignerAddressListForLatestCheckpointV2Transformer = async (data) => await V2MonitorResponse.parseAsync(data);
1225
1417
  export const getSignerAddressListForLatestCheckpointV2ErrorTransformer = async (data) => await ErrorResponse.parseAsync(data);
1226
1418
  export const getSignerAddressListForLatestCheckpointV2 = async (options) => {
@@ -1701,4 +1893,40 @@ export const getCurrentAprV2 = async (options) => {
1701
1893
  }
1702
1894
  return result;
1703
1895
  };
1896
+ export const getCurrentSpolApyV2Transformer = async (data) => await V2RewardsResponse.parseAsync(data);
1897
+ export const getCurrentSpolApyV2ErrorTransformer = async (data) => await ErrorResponse.parseAsync(data);
1898
+ export const getCurrentSpolApyV2 = async (options) => {
1899
+ let result;
1900
+ try {
1901
+ result = await getCurrentSpolApyV22(options);
1902
+ }
1903
+ catch (err) {
1904
+ if (err instanceof Error) {
1905
+ throw new TransportError(err);
1906
+ }
1907
+ let typedErr;
1908
+ try {
1909
+ typedErr = await getCurrentSpolApyV2ErrorTransformer(err);
1910
+ }
1911
+ catch (validationError) {
1912
+ throw new ResponseValidationError(validationError, err);
1913
+ }
1914
+ throw typedErr;
1915
+ }
1916
+ const errorBearing = result;
1917
+ if (typeof result === "object" && result !== null && "request" in result && "response" in result && (typeof errorBearing.error === "object" && errorBearing.error !== null)) {
1918
+ if (errorBearing.error instanceof Error) {
1919
+ errorBearing.error = new TransportError(errorBearing.error);
1920
+ }
1921
+ else {
1922
+ try {
1923
+ errorBearing.error = await getCurrentSpolApyV2ErrorTransformer(errorBearing.error);
1924
+ }
1925
+ catch (validationError) {
1926
+ errorBearing.error = new ResponseValidationError(validationError, errorBearing.error);
1927
+ }
1928
+ }
1929
+ }
1930
+ return result;
1931
+ };
1704
1932
  //# sourceMappingURL=registry-validator.gen.js.map