@satrush/api 0.1.14 → 0.1.15

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
@@ -1271,6 +1271,82 @@ var getRoundsResponseTransformer = async (data) => {
1271
1271
  data.data = data.data.map((item) => roundHistoryDtoSchemaResponseTransformer(item));
1272
1272
  return data;
1273
1273
  };
1274
+ var roundDeploymentDtoSchemaResponseTransformer = (data) => {
1275
+ if (data.btcEarned) {
1276
+ data.btcEarned = u64DtoSchemaResponseTransformer(data.btcEarned);
1277
+ }
1278
+ data.deployedAt = new Date(data.deployedAt);
1279
+ data.deployedUsdAmount = u64DtoSchemaResponseTransformer(data.deployedUsdAmount);
1280
+ data.hashrateEarned = u64DtoSchemaResponseTransformer(data.hashrateEarned);
1281
+ data.satsSharesEarned = u64DtoSchemaResponseTransformer(data.satsSharesEarned);
1282
+ if (data.settledAt) {
1283
+ data.settledAt = new Date(data.settledAt);
1284
+ }
1285
+ data.totalUsdStakeAmount = u64DtoSchemaResponseTransformer(data.totalUsdStakeAmount);
1286
+ data.usdEarned = u64DtoSchemaResponseTransformer(data.usdEarned);
1287
+ if (data.winningUsdStakeAmount) {
1288
+ data.winningUsdStakeAmount = u64DtoSchemaResponseTransformer(data.winningUsdStakeAmount);
1289
+ }
1290
+ return data;
1291
+ };
1292
+ var roundDetailsDtoSchemaResponseTransformer = (data) => {
1293
+ data.deployedAt = new Date(data.deployedAt);
1294
+ data.deployments = data.deployments.map((item) => roundDeploymentDtoSchemaResponseTransformer(item));
1295
+ if (data.epochFeeUsd) {
1296
+ data.epochFeeUsd = u64DtoSchemaResponseTransformer(data.epochFeeUsd);
1297
+ }
1298
+ if (data.oneBtcFeeUsd) {
1299
+ data.oneBtcFeeUsd = u64DtoSchemaResponseTransformer(data.oneBtcFeeUsd);
1300
+ }
1301
+ if (data.protocolFeeUsd) {
1302
+ data.protocolFeeUsd = u64DtoSchemaResponseTransformer(data.protocolFeeUsd);
1303
+ }
1304
+ if (data.settledAt) {
1305
+ data.settledAt = new Date(data.settledAt);
1306
+ }
1307
+ if (data.startedAt) {
1308
+ data.startedAt = new Date(data.startedAt);
1309
+ }
1310
+ if (data.strikeBonusBtc) {
1311
+ data.strikeBonusBtc = u64DtoSchemaResponseTransformer(data.strikeBonusBtc);
1312
+ }
1313
+ if (data.strikeBonusUsd) {
1314
+ data.strikeBonusUsd = u64DtoSchemaResponseTransformer(data.strikeBonusUsd);
1315
+ }
1316
+ if (data.strikeEpochBtc) {
1317
+ data.strikeEpochBtc = u64DtoSchemaResponseTransformer(data.strikeEpochBtc);
1318
+ }
1319
+ if (data.strikeEpochUsd) {
1320
+ data.strikeEpochUsd = u64DtoSchemaResponseTransformer(data.strikeEpochUsd);
1321
+ }
1322
+ if (data.strikeFeeUsd) {
1323
+ data.strikeFeeUsd = u64DtoSchemaResponseTransformer(data.strikeFeeUsd);
1324
+ }
1325
+ if (data.strikeReserveBtc) {
1326
+ data.strikeReserveBtc = u64DtoSchemaResponseTransformer(data.strikeReserveBtc);
1327
+ }
1328
+ if (data.strikeReserveUsd) {
1329
+ data.strikeReserveUsd = u64DtoSchemaResponseTransformer(data.strikeReserveUsd);
1330
+ }
1331
+ if (data.strikeSeedFromReserveBtc) {
1332
+ data.strikeSeedFromReserveBtc = u64DtoSchemaResponseTransformer(data.strikeSeedFromReserveBtc);
1333
+ }
1334
+ if (data.strikeSeedFromReserveUsd) {
1335
+ data.strikeSeedFromReserveUsd = u64DtoSchemaResponseTransformer(data.strikeSeedFromReserveUsd);
1336
+ }
1337
+ data.totalDeployedUsd = u64DtoSchemaResponseTransformer(data.totalDeployedUsd);
1338
+ if (data.totalPotBtc) {
1339
+ data.totalPotBtc = u64DtoSchemaResponseTransformer(data.totalPotBtc);
1340
+ }
1341
+ if (data.totalPotUsd) {
1342
+ data.totalPotUsd = u64DtoSchemaResponseTransformer(data.totalPotUsd);
1343
+ }
1344
+ return data;
1345
+ };
1346
+ var getRoundResponseTransformer = async (data) => {
1347
+ data.data = roundDetailsDtoSchemaResponseTransformer(data.data);
1348
+ return data;
1349
+ };
1274
1350
  var publicAutomationDtoSchemaResponseTransformer = (data) => {
1275
1351
  data.perRoundUsdAmount = u64DtoSchemaResponseTransformer(data.perRoundUsdAmount);
1276
1352
  data.remainingUsdAmount = u64DtoSchemaResponseTransformer(data.remainingUsdAmount);
@@ -1594,6 +1670,12 @@ var zPricesDto = z.object({
1594
1670
  sat: z.number()
1595
1671
  });
1596
1672
  var zPubkeyDto = z.string().regex(/^[1-9A-HJ-NP-Za-km-z]+$/);
1673
+ var zRoundDetailsApiError404Error = z.object({
1674
+ code: z.enum(["not_found"])
1675
+ });
1676
+ var zRoundDetailsApiError500Error = z.object({
1677
+ code: z.enum(["internal"])
1678
+ });
1597
1679
  var zRoundHistoryStateDto = z.enum([
1598
1680
  "pending",
1599
1681
  "active",
@@ -2109,6 +2191,139 @@ var zProfileDto = z.object({
2109
2191
  oneBtcVaultEntries: z.array(zOneBtcVaultEntryDto),
2110
2192
  unsettledDeployments: z.array(zPublicDeploymentDto)
2111
2193
  });
2194
+ var zRoundDeploymentDto = z.object({
2195
+ authority: zPubkeyDto,
2196
+ btcEarned: z.optional(z.union([
2197
+ z.null(),
2198
+ zU64Dto
2199
+ ])),
2200
+ btcEarnedUsd: z.optional(z.union([
2201
+ z.number(),
2202
+ z.null()
2203
+ ])),
2204
+ deployedAt: z.preprocess((value) => value instanceof Date ? value.toISOString() : value, z.iso.datetime()),
2205
+ deployedUsdAmount: zU64Dto,
2206
+ deployment: zPubkeyDto,
2207
+ hashrateEarned: zU64Dto,
2208
+ isAutomation: z.boolean(),
2209
+ isWon: z.optional(z.union([
2210
+ z.boolean(),
2211
+ z.null()
2212
+ ])),
2213
+ satsSharesEarned: zU64Dto,
2214
+ selectedTiles: z.optional(z.union([
2215
+ z.int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
2216
+ z.null()
2217
+ ])),
2218
+ settledAt: z.optional(z.union([
2219
+ z.preprocess((value) => value instanceof Date ? value.toISOString() : value, z.iso.datetime()),
2220
+ z.null()
2221
+ ])),
2222
+ totalUsdStakeAmount: zU64Dto,
2223
+ usdEarned: zU64Dto,
2224
+ winningUsdStakeAmount: z.optional(z.union([
2225
+ z.null(),
2226
+ zU64Dto
2227
+ ]))
2228
+ });
2229
+ var zRoundDetailsDto = z.object({
2230
+ address: zPubkeyDto,
2231
+ deployedAt: z.preprocess((value) => value instanceof Date ? value.toISOString() : value, z.iso.datetime()),
2232
+ deployments: z.array(zRoundDeploymentDto),
2233
+ epochFeeUsd: z.optional(z.union([
2234
+ z.null(),
2235
+ zU64Dto
2236
+ ])),
2237
+ id: z.int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
2238
+ isHashrateBoosted: z.optional(z.union([
2239
+ z.boolean(),
2240
+ z.null()
2241
+ ])),
2242
+ isSatStrike: z.optional(z.union([
2243
+ z.boolean(),
2244
+ z.null()
2245
+ ])),
2246
+ minersCount: z.int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
2247
+ oneBtcFeeUsd: z.optional(z.union([
2248
+ z.null(),
2249
+ zU64Dto
2250
+ ])),
2251
+ protocolFeeUsd: z.optional(z.union([
2252
+ z.null(),
2253
+ zU64Dto
2254
+ ])),
2255
+ settledAt: z.optional(z.union([
2256
+ z.preprocess((value) => value instanceof Date ? value.toISOString() : value, z.iso.datetime()),
2257
+ z.null()
2258
+ ])),
2259
+ settledMiners: z.int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
2260
+ startedAt: z.optional(z.union([
2261
+ z.preprocess((value) => value instanceof Date ? value.toISOString() : value, z.iso.datetime()),
2262
+ z.null()
2263
+ ])),
2264
+ state: zRoundHistoryStateDto,
2265
+ strikeBonusBtc: z.optional(z.union([
2266
+ z.null(),
2267
+ zU64Dto
2268
+ ])),
2269
+ strikeBonusCombinedUsd: z.optional(z.union([
2270
+ z.number(),
2271
+ z.null()
2272
+ ])),
2273
+ strikeBonusUsd: z.optional(z.union([
2274
+ z.null(),
2275
+ zU64Dto
2276
+ ])),
2277
+ strikeEpochBtc: z.optional(z.union([
2278
+ z.null(),
2279
+ zU64Dto
2280
+ ])),
2281
+ strikeEpochUsd: z.optional(z.union([
2282
+ z.null(),
2283
+ zU64Dto
2284
+ ])),
2285
+ strikeFeeUsd: z.optional(z.union([
2286
+ z.null(),
2287
+ zU64Dto
2288
+ ])),
2289
+ strikeReserveBtc: z.optional(z.union([
2290
+ z.null(),
2291
+ zU64Dto
2292
+ ])),
2293
+ strikeReserveUsd: z.optional(z.union([
2294
+ z.null(),
2295
+ zU64Dto
2296
+ ])),
2297
+ strikeSeedFromReserveBtc: z.optional(z.union([
2298
+ z.null(),
2299
+ zU64Dto
2300
+ ])),
2301
+ strikeSeedFromReserveUsd: z.optional(z.union([
2302
+ z.null(),
2303
+ zU64Dto
2304
+ ])),
2305
+ totalDeployedUsd: zU64Dto,
2306
+ totalPotBtc: z.optional(z.union([
2307
+ z.null(),
2308
+ zU64Dto
2309
+ ])),
2310
+ totalPotCombinedUsd: z.optional(z.union([
2311
+ z.number(),
2312
+ z.null()
2313
+ ])),
2314
+ totalPotUsd: z.optional(z.union([
2315
+ z.null(),
2316
+ zU64Dto
2317
+ ])),
2318
+ winnersCount: z.optional(z.union([
2319
+ z.int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
2320
+ z.null()
2321
+ ])),
2322
+ winningTile: z.optional(z.union([
2323
+ z.int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
2324
+ z.null()
2325
+ ]))
2326
+ });
2112
2327
  var zRoundHistoryDto = z.object({
2113
2328
  id: z.int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
2114
2329
  isHashrateBoosted: z.optional(z.union([
@@ -2584,6 +2799,16 @@ var zGetRoundsData = z.object({
2584
2799
  var zGetRoundsResponse = z.object({
2585
2800
  data: z.array(zRoundHistoryDto)
2586
2801
  });
2802
+ var zGetRoundData = z.object({
2803
+ body: z.optional(z.never()),
2804
+ path: z.object({
2805
+ id: z.int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" })
2806
+ }),
2807
+ query: z.optional(z.never())
2808
+ });
2809
+ var zGetRoundResponse = z.object({
2810
+ data: zRoundDetailsDto
2811
+ });
2587
2812
  var zSseData = z.object({
2588
2813
  body: z.optional(z.never()),
2589
2814
  path: z.optional(z.never()),
@@ -2901,6 +3126,20 @@ var SatrushBackendSdk = class _SatrushBackendSdk extends HeyApiClient {
2901
3126
  ...params
2902
3127
  });
2903
3128
  }
3129
+ /**
3130
+ * Request round details
3131
+ */
3132
+ getRound(parameters, options) {
3133
+ const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "id" }] }]);
3134
+ return (options?.client ?? this.client).get({
3135
+ requestValidator: async (data) => await zGetRoundData.parseAsync(data),
3136
+ responseTransformer: getRoundResponseTransformer,
3137
+ responseValidator: async (data) => await zGetRoundResponse.parseAsync(data),
3138
+ url: "/v1/rounds/{id}",
3139
+ ...options,
3140
+ ...params
3141
+ });
3142
+ }
2904
3143
  /**
2905
3144
  * Subscribe for SSE stream
2906
3145
  */
@@ -3170,6 +3409,8 @@ export {
3170
3409
  zGetOneBtcIterationParticipantsData,
3171
3410
  zGetOneBtcIterationParticipantsResponse,
3172
3411
  zGetOneBtcIterationResponse,
3412
+ zGetRoundData,
3413
+ zGetRoundResponse,
3173
3414
  zGetRoundsData,
3174
3415
  zGetRoundsPlayedLeaderboardData,
3175
3416
  zGetRoundsPlayedLeaderboardResponse,
@@ -3223,6 +3464,10 @@ export {
3223
3464
  zPubkeyDto,
3224
3465
  zPublicAutomationDto,
3225
3466
  zPublicDeploymentDto,
3467
+ zRoundDeploymentDto,
3468
+ zRoundDetailsApiError404Error,
3469
+ zRoundDetailsApiError500Error,
3470
+ zRoundDetailsDto,
3226
3471
  zRoundDto,
3227
3472
  zRoundHistoryDto,
3228
3473
  zRoundHistoryStateDto,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@satrush/api",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
4
4
  "private": false,
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",