@satrush/api 0.1.15 → 0.1.17

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.
package/dist/index.js CHANGED
@@ -1152,6 +1152,21 @@ var getEpochWinnersResponseTransformer = async (data) => {
1152
1152
  data.data = data.data.map((item) => epochWinnerHistoryDtoSchemaResponseTransformer(item));
1153
1153
  return data;
1154
1154
  };
1155
+ var leaderboardPageEntryDtoSchemaResponseTransformer = (data) => {
1156
+ data.totalHashrateEarned = u64DtoSchemaResponseTransformer(data.totalHashrateEarned);
1157
+ data.totalSatsEarned = u64DtoSchemaResponseTransformer(data.totalSatsEarned);
1158
+ data.totalUsdDeployed = u64DtoSchemaResponseTransformer(data.totalUsdDeployed);
1159
+ return data;
1160
+ };
1161
+ var leaderboardPageDtoSchemaResponseTransformer = (data) => {
1162
+ data.entries = data.entries.map((item) => leaderboardPageEntryDtoSchemaResponseTransformer(item));
1163
+ data.updatedAt = new Date(data.updatedAt);
1164
+ return data;
1165
+ };
1166
+ var getLeaderboardResponseTransformer = async (data) => {
1167
+ data.data = leaderboardPageDtoSchemaResponseTransformer(data.data);
1168
+ return data;
1169
+ };
1155
1170
  var leaderboardEntryDtoSchemaResponseTransformer = (data) => {
1156
1171
  data.totalHashrateEarned = u64DtoSchemaResponseTransformer(data.totalHashrateEarned);
1157
1172
  data.totalSatsEarned = u64DtoSchemaResponseTransformer(data.totalSatsEarned);
@@ -1170,6 +1185,17 @@ var getSatsEarnedLeaderboardResponseTransformer = async (data) => {
1170
1185
  data.data = data.data.map((item) => leaderboardEntryDtoSchemaResponseTransformer(item));
1171
1186
  return data;
1172
1187
  };
1188
+ var walletLeaderboardDtoSchemaResponseTransformer = (data) => {
1189
+ data.totalHashrateEarned = u64DtoSchemaResponseTransformer(data.totalHashrateEarned);
1190
+ data.totalSatsEarned = u64DtoSchemaResponseTransformer(data.totalSatsEarned);
1191
+ data.totalUsdDeployed = u64DtoSchemaResponseTransformer(data.totalUsdDeployed);
1192
+ data.updatedAt = new Date(data.updatedAt);
1193
+ return data;
1194
+ };
1195
+ var getWalletLeaderboardResponseTransformer = async (data) => {
1196
+ data.data = walletLeaderboardDtoSchemaResponseTransformer(data.data);
1197
+ return data;
1198
+ };
1173
1199
  var oneBtcIterationHistoryDtoSchemaResponseTransformer = (data) => {
1174
1200
  if (data.endedAt) {
1175
1201
  data.endedAt = new Date(data.endedAt);
@@ -1365,6 +1391,12 @@ var i64DtoSchemaResponseTransformer = (data) => {
1365
1391
  return data;
1366
1392
  };
1367
1393
  var minerDtoSchemaResponseTransformer = (data) => {
1394
+ data.affiliatePointsEarned = u64DtoSchemaResponseTransformer(data.affiliatePointsEarned);
1395
+ data.affiliatePointsSpent = u64DtoSchemaResponseTransformer(data.affiliatePointsSpent);
1396
+ if (data.grubstakeExpiresAt) {
1397
+ data.grubstakeExpiresAt = new Date(data.grubstakeExpiresAt);
1398
+ }
1399
+ data.grubstakeUsdAmount = u64DtoSchemaResponseTransformer(data.grubstakeUsdAmount);
1368
1400
  data.hashrateAmount = u64DtoSchemaResponseTransformer(data.hashrateAmount);
1369
1401
  data.totalBtcReceived = u64DtoSchemaResponseTransformer(data.totalBtcReceived);
1370
1402
  data.totalHashrateEarned = u64DtoSchemaResponseTransformer(data.totalHashrateEarned);
@@ -1572,6 +1604,7 @@ var zEpochIterationParticipantsApiError500Error = z.object({
1572
1604
  });
1573
1605
  var zEpochStateDto = z.enum([
1574
1606
  "open",
1607
+ "sealed",
1575
1608
  "settling",
1576
1609
  "settled",
1577
1610
  "complete"
@@ -1610,6 +1643,22 @@ var zI64Dto = z.coerce.bigint().min(BigInt("-9223372036854775808"), { error: "In
1610
1643
  var zInternalErrorCodeErrorBody = z.object({
1611
1644
  code: z.enum(["internal_error"])
1612
1645
  });
1646
+ var zLeaderboardRanksDto = z.object({
1647
+ deployed: z.int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
1648
+ hashrate: z.int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
1649
+ rounds: z.int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
1650
+ satsEarned: z.int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
1651
+ score: z.int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
1652
+ streak: z.int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" })
1653
+ });
1654
+ var zLeaderboardSortDto = z.enum([
1655
+ "score",
1656
+ "deployed",
1657
+ "rounds",
1658
+ "sats_earned",
1659
+ "hashrate",
1660
+ "streak"
1661
+ ]);
1613
1662
  var zNotificationEntity = z.enum(["state_snapshot"]);
1614
1663
  var zOneBtcHistoryApiError400InvalidRange = z.object({
1615
1664
  code: z.enum(["invalid_range"])
@@ -1658,6 +1707,7 @@ var zOneBtcIterationParticipantsApiError500Error = z.object({
1658
1707
  });
1659
1708
  var zOneBtcStateDto = z.enum([
1660
1709
  "open",
1710
+ "sealed",
1661
1711
  "settled",
1662
1712
  "complete"
1663
1713
  ]);
@@ -1825,6 +1875,7 @@ var zEpochVaultEntryDto = z.object({
1825
1875
  var zEpochWinnerDto = z.object({
1826
1876
  authority: zPubkeyDto,
1827
1877
  claimed: z.boolean(),
1878
+ distributed: z.boolean(),
1828
1879
  tickets: zU64Dto
1829
1880
  });
1830
1881
  var zEpochVaultIterationDto = z.object({
@@ -1850,6 +1901,10 @@ var zEpochVaultIterationDto = z.object({
1850
1901
  z.int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
1851
1902
  z.null()
1852
1903
  ])),
1904
+ winnersDistributed: z.optional(z.union([
1905
+ z.int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
1906
+ z.null()
1907
+ ])),
1853
1908
  winnersSelected: z.optional(z.union([
1854
1909
  z.int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
1855
1910
  z.null()
@@ -1907,6 +1962,22 @@ var zLeaderboardEntryDto = z.object({
1907
1962
  totalSatsEarned: zU64Dto,
1908
1963
  totalUsdDeployed: zU64Dto
1909
1964
  });
1965
+ var zLeaderboardPageEntryDto = z.object({
1966
+ authority: zPubkeyDto,
1967
+ daysActive: z.int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
1968
+ maxStreak: z.int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
1969
+ rank: z.int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
1970
+ score: z.number(),
1971
+ totalHashrateEarned: zU64Dto,
1972
+ totalRoundsPlayed: z.int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
1973
+ totalSatsEarned: zU64Dto,
1974
+ totalUsdDeployed: zU64Dto
1975
+ });
1976
+ var zLeaderboardPageDto = z.object({
1977
+ entries: z.array(zLeaderboardPageEntryDto),
1978
+ total: z.int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
1979
+ updatedAt: z.preprocess((value) => value instanceof Date ? value.toISOString() : value, z.iso.datetime())
1980
+ });
1910
1981
  var zMinerClaimDto = z.object({
1911
1982
  authority: zPubkeyDto,
1912
1983
  btcReceived: z.optional(z.union([
@@ -1945,6 +2016,10 @@ var zMinerDeploymentDto = z.object({
1945
2016
  deployment: zPubkeyDto,
1946
2017
  hashrateEarned: zU64Dto,
1947
2018
  isAutomation: z.boolean(),
2019
+ isGrubstakeFunded: z.optional(z.union([
2020
+ z.boolean(),
2021
+ z.null()
2022
+ ])),
1948
2023
  isReload: z.optional(z.union([
1949
2024
  z.boolean(),
1950
2025
  z.null()
@@ -1967,11 +2042,30 @@ var zMinerDeploymentDto = z.object({
1967
2042
  usdEarned: zU64Dto
1968
2043
  });
1969
2044
  var zMinerDto = z.object({
2045
+ affiliate: z.optional(z.union([
2046
+ z.null(),
2047
+ zPubkeyDto
2048
+ ])),
2049
+ affiliatePointsEarned: zU64Dto,
2050
+ affiliatePointsSpent: zU64Dto,
2051
+ affiliateRateBps: z.optional(z.union([
2052
+ z.int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
2053
+ z.null()
2054
+ ])),
1970
2055
  authority: zPubkeyDto,
1971
2056
  currentStreakCount: z.int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
2057
+ grubstakeExpiresAt: z.optional(z.union([
2058
+ z.preprocess((value) => value instanceof Date ? value.toISOString() : value, z.iso.datetime()),
2059
+ z.null()
2060
+ ])),
2061
+ grubstakeUsdAmount: zU64Dto,
1972
2062
  hashrateAmount: zU64Dto,
1973
2063
  lastMinedRoundId: z.int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
1974
2064
  maxStreak: z.int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
2065
+ tag: z.optional(z.union([
2066
+ z.string(),
2067
+ z.null()
2068
+ ])),
1975
2069
  totalBtcReceived: zU64Dto,
1976
2070
  totalHashrateEarned: zU64Dto,
1977
2071
  totalRounds: z.int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
@@ -2164,6 +2258,7 @@ var zOneBtcVaultDto = z.object({
2164
2258
  var zPublicAutomationDto = z.object({
2165
2259
  address: zPubkeyDto,
2166
2260
  executedDeployments: z.int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
2261
+ isGrubstakeFunded: z.boolean(),
2167
2262
  perRoundUsdAmount: zU64Dto,
2168
2263
  reload: z.boolean(),
2169
2264
  remainingDeployments: z.int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
@@ -2206,6 +2301,10 @@ var zRoundDeploymentDto = z.object({
2206
2301
  deployment: zPubkeyDto,
2207
2302
  hashrateEarned: zU64Dto,
2208
2303
  isAutomation: z.boolean(),
2304
+ isGrubstakeFunded: z.optional(z.union([
2305
+ z.boolean(),
2306
+ z.null()
2307
+ ])),
2209
2308
  isWon: z.optional(z.union([
2210
2309
  z.boolean(),
2211
2310
  z.null()
@@ -2662,6 +2761,36 @@ var zValidationErrorCodeValidationDetailsErrorBody = z.object({
2662
2761
  errors: z.array(zFieldError)
2663
2762
  }))
2664
2763
  });
2764
+ var zWalletLeaderboardApiError400InvalidAddress = z.object({
2765
+ code: z.enum(["invalid_address"])
2766
+ });
2767
+ var zWalletLeaderboardApiError400Error = z.union([
2768
+ z.object({
2769
+ code: z.literal("invalid_address")
2770
+ }).and(zWalletLeaderboardApiError400InvalidAddress),
2771
+ z.object({
2772
+ code: z.union([
2773
+ z.literal("invalid_body"),
2774
+ z.literal("invalid_path"),
2775
+ z.literal("invalid_query")
2776
+ ])
2777
+ }).and(zBadRequestErrorCodeErrorBody)
2778
+ ]);
2779
+ var zWalletLeaderboardApiError404Error = z.object({
2780
+ code: z.enum(["not_found"])
2781
+ });
2782
+ var zWalletLeaderboardDto = z.object({
2783
+ authority: zPubkeyDto,
2784
+ daysActive: z.int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
2785
+ maxStreak: z.int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
2786
+ ranks: zLeaderboardRanksDto,
2787
+ score: z.number(),
2788
+ totalHashrateEarned: zU64Dto,
2789
+ totalRoundsPlayed: z.int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
2790
+ totalSatsEarned: zU64Dto,
2791
+ totalUsdDeployed: zU64Dto,
2792
+ updatedAt: z.preprocess((value) => value instanceof Date ? value.toISOString() : value, z.iso.datetime())
2793
+ });
2665
2794
  var zGetBoardData = z.object({
2666
2795
  body: z.optional(z.never()),
2667
2796
  path: z.optional(z.never()),
@@ -2726,6 +2855,18 @@ var zGetEpochWinnersData = z.object({
2726
2855
  var zGetEpochWinnersResponse = z.object({
2727
2856
  data: z.array(zEpochWinnerHistoryDto)
2728
2857
  });
2858
+ var zGetLeaderboardData = z.object({
2859
+ body: z.optional(z.never()),
2860
+ path: z.optional(z.never()),
2861
+ query: z.optional(z.object({
2862
+ sort: z.optional(zLeaderboardSortDto),
2863
+ offset: z.optional(z.int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" })),
2864
+ limit: z.optional(z.int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }))
2865
+ }))
2866
+ });
2867
+ var zGetLeaderboardResponse = z.object({
2868
+ data: zLeaderboardPageDto
2869
+ });
2729
2870
  var zGetHashrateEarnedLeaderboardData = z.object({
2730
2871
  body: z.optional(z.never()),
2731
2872
  path: z.optional(z.never()),
@@ -2750,6 +2891,16 @@ var zGetSatsEarnedLeaderboardData = z.object({
2750
2891
  var zGetSatsEarnedLeaderboardResponse = z.object({
2751
2892
  data: z.array(zLeaderboardEntryDto)
2752
2893
  });
2894
+ var zGetWalletLeaderboardData = z.object({
2895
+ body: z.optional(z.never()),
2896
+ path: z.object({
2897
+ address: z.string()
2898
+ }),
2899
+ query: z.optional(z.never())
2900
+ });
2901
+ var zGetWalletLeaderboardResponse = z.object({
2902
+ data: zWalletLeaderboardDto
2903
+ });
2753
2904
  var zGetOneBtcHistoryData = z.object({
2754
2905
  body: z.optional(z.never()),
2755
2906
  path: z.optional(z.never()),
@@ -3020,6 +3171,24 @@ var SatrushBackendSdk = class _SatrushBackendSdk extends HeyApiClient {
3020
3171
  ...params
3021
3172
  });
3022
3173
  }
3174
+ /**
3175
+ * Request a page of the general leaderboard
3176
+ */
3177
+ getLeaderboard(parameters, options) {
3178
+ const params = buildClientParams([parameters], [{ args: [
3179
+ { in: "query", key: "sort" },
3180
+ { in: "query", key: "offset" },
3181
+ { in: "query", key: "limit" }
3182
+ ] }]);
3183
+ return (options?.client ?? this.client).get({
3184
+ requestValidator: async (data) => await zGetLeaderboardData.parseAsync(data),
3185
+ responseTransformer: getLeaderboardResponseTransformer,
3186
+ responseValidator: async (data) => await zGetLeaderboardResponse.parseAsync(data),
3187
+ url: "/v1/leaderboard",
3188
+ ...options,
3189
+ ...params
3190
+ });
3191
+ }
3023
3192
  /**
3024
3193
  * Request the top miners by lifetime hashrate earned
3025
3194
  */
@@ -3056,6 +3225,20 @@ var SatrushBackendSdk = class _SatrushBackendSdk extends HeyApiClient {
3056
3225
  ...options
3057
3226
  });
3058
3227
  }
3228
+ /**
3229
+ * Request a wallet's general-leaderboard stats and ranks
3230
+ */
3231
+ getWalletLeaderboard(parameters, options) {
3232
+ const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "address" }] }]);
3233
+ return (options?.client ?? this.client).get({
3234
+ requestValidator: async (data) => await zGetWalletLeaderboardData.parseAsync(data),
3235
+ responseTransformer: getWalletLeaderboardResponseTransformer,
3236
+ responseValidator: async (data) => await zGetWalletLeaderboardResponse.parseAsync(data),
3237
+ url: "/v1/leaderboard/{address}",
3238
+ ...options,
3239
+ ...params
3240
+ });
3241
+ }
3059
3242
  /**
3060
3243
  * Request 1 BTC Vault history
3061
3244
  */
@@ -3276,14 +3459,24 @@ var AutomationStrategyDto = {
3276
3459
  var ClaimTypeDto = { USD: "usd", SATS: "sats" };
3277
3460
  var EpochStateDto = {
3278
3461
  OPEN: "open",
3462
+ SEALED: "sealed",
3279
3463
  SETTLING: "settling",
3280
3464
  SETTLED: "settled",
3281
3465
  COMPLETE: "complete"
3282
3466
  };
3283
3467
  var HashrateActionTypeDto = { BUY_EPOCH_TICKETS: "buy_epoch_tickets", BUY_ONE_BTC_TICKETS: "buy_one_btc_tickets" };
3468
+ var LeaderboardSortDto = {
3469
+ SCORE: "score",
3470
+ DEPLOYED: "deployed",
3471
+ ROUNDS: "rounds",
3472
+ SATS_EARNED: "sats_earned",
3473
+ HASHRATE: "hashrate",
3474
+ STREAK: "streak"
3475
+ };
3284
3476
  var NotificationEntity = { STATE_SNAPSHOT: "state_snapshot" };
3285
3477
  var OneBtcStateDto = {
3286
3478
  OPEN: "open",
3479
+ SEALED: "sealed",
3287
3480
  SETTLED: "settled",
3288
3481
  COMPLETE: "complete"
3289
3482
  };
@@ -3350,6 +3543,7 @@ export {
3350
3543
  ClaimTypeDto,
3351
3544
  EpochStateDto,
3352
3545
  HashrateActionTypeDto,
3546
+ LeaderboardSortDto,
3353
3547
  NotificationEntity,
3354
3548
  OneBtcStateDto,
3355
3549
  RoundHistoryStateDto,
@@ -3403,6 +3597,8 @@ export {
3403
3597
  zGetEpochWinnersResponse,
3404
3598
  zGetHashrateEarnedLeaderboardData,
3405
3599
  zGetHashrateEarnedLeaderboardResponse,
3600
+ zGetLeaderboardData,
3601
+ zGetLeaderboardResponse,
3406
3602
  zGetOneBtcHistoryData,
3407
3603
  zGetOneBtcHistoryResponse,
3408
3604
  zGetOneBtcIterationData,
@@ -3429,11 +3625,17 @@ export {
3429
3625
  zGetUserOneBtcEntriesResponse,
3430
3626
  zGetUserProfileData,
3431
3627
  zGetUserProfileResponse,
3628
+ zGetWalletLeaderboardData,
3629
+ zGetWalletLeaderboardResponse,
3432
3630
  zHashrateActionTypeDto,
3433
3631
  zI128Dto,
3434
3632
  zI64Dto,
3435
3633
  zInternalErrorCodeErrorBody,
3436
3634
  zLeaderboardEntryDto,
3635
+ zLeaderboardPageDto,
3636
+ zLeaderboardPageEntryDto,
3637
+ zLeaderboardRanksDto,
3638
+ zLeaderboardSortDto,
3437
3639
  zMinerClaimDto,
3438
3640
  zMinerDeploymentDto,
3439
3641
  zMinerDto,
@@ -3512,5 +3714,9 @@ export {
3512
3714
  zUserVaultEntriesApiError400InvalidWinsOnly,
3513
3715
  zUserVaultEntriesApiError500Error,
3514
3716
  zValidationErrorCodeErrorBody,
3515
- zValidationErrorCodeValidationDetailsErrorBody
3717
+ zValidationErrorCodeValidationDetailsErrorBody,
3718
+ zWalletLeaderboardApiError400Error,
3719
+ zWalletLeaderboardApiError400InvalidAddress,
3720
+ zWalletLeaderboardApiError404Error,
3721
+ zWalletLeaderboardDto
3516
3722
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@satrush/api",
3
- "version": "0.1.15",
3
+ "version": "0.1.17",
4
4
  "private": false,
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",