@bze/bze-ui-kit 0.2.2 → 0.3.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.
package/dist/index.js CHANGED
@@ -125,6 +125,7 @@ __export(index_exports, {
125
125
  canDepositFromIBC: () => canDepositFromIBC,
126
126
  canSendToIBC: () => canSendToIBC,
127
127
  cancelDebounce: () => cancelDebounce,
128
+ checkAddressWonRaffle: () => checkAddressWonRaffle,
128
129
  convertToWebSocketUrl: () => convertToWebSocketUrl,
129
130
  counterpartyChainForChannel: () => counterpartyChainForChannel,
130
131
  createMarketId: () => createMarketId,
@@ -161,6 +162,10 @@ __export(index_exports, {
161
162
  getAtomOneRestURL: () => getAtomOneRestURL,
162
163
  getAtomOneRpcUrl: () => getAtomOneRpcUrl,
163
164
  getBZEUSDPrice: () => getBZEUSDPrice,
165
+ getBlockDetailsByHeight: () => getBlockDetailsByHeight,
166
+ getBlockResults: () => getBlockResults,
167
+ getBlockTimeByHeight: () => getBlockTimeByHeight,
168
+ getBurnerModuleAddress: () => getBurnerModuleAddress,
164
169
  getBurnerParams: () => getBurnerParams,
165
170
  getBurnerParamsWithClient: () => getBurnerParamsWithClient,
166
171
  getChainAddressPrefix: () => getChainAddressPrefix,
@@ -184,6 +189,7 @@ __export(index_exports, {
184
189
  getEpochsInfo: () => getEpochsInfo,
185
190
  getFactoryDenomAdminAddress: () => getFactoryDenomAdminAddress,
186
191
  getFromLocalStorage: () => getFromLocalStorage,
192
+ getHardcodedLockAddress: () => getHardcodedLockAddress,
187
193
  getHashIBCTrace: () => getHashIBCTrace,
188
194
  getHourEpochInfo: () => getHourEpochInfo,
189
195
  getIBCAssetList: () => getIBCAssetList,
@@ -206,6 +212,8 @@ __export(index_exports, {
206
212
  getMarketSellOrders: () => getMarketSellOrders,
207
213
  getMarkets: () => getMarkets,
208
214
  getMinAmount: () => getMinAmount,
215
+ getModuleAddress: () => getModuleAddress,
216
+ getNextBurning: () => getNextBurning,
209
217
  getNoOfIntervalsNeeded: () => getNoOfIntervalsNeeded,
210
218
  getNobleRestURL: () => getNobleRestURL,
211
219
  getNobleRpcUrl: () => getNobleRpcUrl,
@@ -217,6 +225,9 @@ __export(index_exports, {
217
225
  getPendingUnlockParticipants: () => getPendingUnlockParticipants,
218
226
  getPeriodicEpochEndTime: () => getPeriodicEpochEndTime,
219
227
  getPeriodicWeekEpochEndTime: () => getPeriodicWeekEpochEndTime,
228
+ getRaffleModuleAddress: () => getRaffleModuleAddress,
229
+ getRaffleWinners: () => getRaffleWinners,
230
+ getRaffles: () => getRaffles,
220
231
  getRestClient: () => getRestClient,
221
232
  getRestURL: () => getRestURL,
222
233
  getRpcURL: () => getRpcURL,
@@ -1247,6 +1258,207 @@ var getPageRequestWithLimit = (limit) => {
1247
1258
  // src/query/burner.ts
1248
1259
  var import_bzejs2 = require("@bze/bzejs");
1249
1260
  var import_pagination2 = require("@bze/bzejs/cosmos/base/query/v1beta1/pagination");
1261
+
1262
+ // src/constants/endpoints.ts
1263
+ function getRestURL() {
1264
+ return process.env.NEXT_PUBLIC_REST_URL || "";
1265
+ }
1266
+ function getRpcURL() {
1267
+ return process.env.NEXT_PUBLIC_RPC_URL || "";
1268
+ }
1269
+ function getArchwayRpcURL() {
1270
+ return process.env.NEXT_PUBLIC_RPC_URL_ARCHWAY || "";
1271
+ }
1272
+ function getOsmosisRpcUrl() {
1273
+ return process.env.NEXT_PUBLIC_RPC_URL_OSMOSIS || "";
1274
+ }
1275
+ function getNobleRpcUrl() {
1276
+ return process.env.NEXT_PUBLIC_RPC_URL_NOBLE || "";
1277
+ }
1278
+ function getJackalRpcUrl() {
1279
+ return process.env.NEXT_PUBLIC_RPC_URL_JACKAL || "";
1280
+ }
1281
+ function getOmniFlixRpcUrl() {
1282
+ return process.env.NEXT_PUBLIC_RPC_URL_FLIX || "";
1283
+ }
1284
+ function getAtomOneRpcUrl() {
1285
+ return process.env.NEXT_PUBLIC_RPC_URL_ATOMONE || "";
1286
+ }
1287
+ function getArchwayRestURL() {
1288
+ return process.env.NEXT_PUBLIC_REST_URL_ARCHWAY || "";
1289
+ }
1290
+ function getOsmosisRestURL() {
1291
+ return process.env.NEXT_PUBLIC_REST_URL_OSMOSIS || "";
1292
+ }
1293
+ function getNobleRestURL() {
1294
+ return process.env.NEXT_PUBLIC_REST_URL_NOBLE || "";
1295
+ }
1296
+ function getJackalRestURL() {
1297
+ return process.env.NEXT_PUBLIC_REST_URL_JACKAL || "";
1298
+ }
1299
+ function getOmniFlixRestURL() {
1300
+ return process.env.NEXT_PUBLIC_REST_URL_FLIX || "";
1301
+ }
1302
+ function getAtomOneRestURL() {
1303
+ return process.env.NEXT_PUBLIC_REST_URL_ATOMONE || "";
1304
+ }
1305
+ var getAggregatorHost = () => {
1306
+ var _a2;
1307
+ return (_a2 = process.env.NEXT_PUBLIC_AGG_API_HOST) != null ? _a2 : "https://getbze.com";
1308
+ };
1309
+
1310
+ // src/query/module.ts
1311
+ var MODULE_ADDRESS_KEY = "auth:module:address:";
1312
+ var MODULE_ADDRESS_CACHE_TTL = 60 * 60 * 48;
1313
+ function getHardcodedBurnerAddress() {
1314
+ return "bze1v7uw4xhrcv0vk7qp8jf9lu3hm5d8uu5yjp5qun";
1315
+ }
1316
+ function getHardcodedRaffleAddress() {
1317
+ return "bze18hsqalgwlzqavrrkfnxmrjmygwyjy8senx5tgs";
1318
+ }
1319
+ function getHardcodedLockAddress() {
1320
+ return "bze1pc5zjcvhx3e8l305zjl72grytfa30r5mdypmw4";
1321
+ }
1322
+ function getBurnerModuleAddress() {
1323
+ return getHardcodedBurnerAddress();
1324
+ }
1325
+ function getRaffleModuleAddress() {
1326
+ return getHardcodedRaffleAddress();
1327
+ }
1328
+ async function getModuleAddress(module2) {
1329
+ var _a2;
1330
+ try {
1331
+ const cacheKey = `${MODULE_ADDRESS_KEY}${module2}`;
1332
+ const localData = getFromLocalStorage(cacheKey);
1333
+ if (null !== localData) {
1334
+ return localData;
1335
+ }
1336
+ const url = getRestURL();
1337
+ const response = await fetch(`${url}/cosmos/auth/v1beta1/module_accounts/${module2}`);
1338
+ if (!response.ok) {
1339
+ return "";
1340
+ }
1341
+ const parsed = await response.json();
1342
+ const addy = (_a2 = parsed.account.base_account) == null ? void 0 : _a2.address;
1343
+ if (addy === void 0) {
1344
+ return "";
1345
+ }
1346
+ setInLocalStorage(cacheKey, addy, MODULE_ADDRESS_CACHE_TTL);
1347
+ return addy;
1348
+ } catch (e) {
1349
+ console.error(e);
1350
+ return "";
1351
+ }
1352
+ }
1353
+
1354
+ // src/query/bank.ts
1355
+ async function getAddressBalances(address) {
1356
+ try {
1357
+ const client = await getRestClient();
1358
+ const response = await client.cosmos.bank.v1beta1.spendableBalances({ address });
1359
+ return response.balances;
1360
+ } catch (e) {
1361
+ console.error("failed to get balances", e);
1362
+ return [];
1363
+ }
1364
+ }
1365
+ async function getLockedBalances() {
1366
+ try {
1367
+ const lockerAddress = getLockerAddress();
1368
+ if (!lockerAddress) {
1369
+ console.warn("Locker address not configured");
1370
+ return [];
1371
+ }
1372
+ return await getAddressBalances(lockerAddress);
1373
+ } catch (e) {
1374
+ console.error("failed to get locked balances", e);
1375
+ return [];
1376
+ }
1377
+ }
1378
+
1379
+ // src/query/epoch.ts
1380
+ var EPOCH_HOUR = "hour";
1381
+ var EPOCH_DAY = "day";
1382
+ var EPOCH_WEEK = "week";
1383
+ var EPOCHS_INFO_CACHE_KEY = "epochs:info";
1384
+ var EPOCHS_INFO_CACHE_TTL = 60 * 60;
1385
+ async function getEpochsInfo() {
1386
+ try {
1387
+ const cachedData = getFromLocalStorage(EPOCHS_INFO_CACHE_KEY);
1388
+ let shouldFetchFromEndpoint = false;
1389
+ if (cachedData !== null) {
1390
+ const cached = JSON.parse(cachedData);
1391
+ const now = (/* @__PURE__ */ new Date()).getTime();
1392
+ for (const epoch of cached.epochs) {
1393
+ if (epoch.current_epoch_start_time) {
1394
+ const startTime = new Date(epoch.current_epoch_start_time).getTime();
1395
+ const duration = getEpochDurationByIdentifier(epoch.identifier);
1396
+ const epochEndTime = startTime + duration - 15 * 1e3;
1397
+ if (now >= epochEndTime) {
1398
+ shouldFetchFromEndpoint = true;
1399
+ break;
1400
+ }
1401
+ }
1402
+ }
1403
+ if (!shouldFetchFromEndpoint) {
1404
+ return cached;
1405
+ }
1406
+ }
1407
+ const client = await getRestClient();
1408
+ const response = await client.bze.epochs.epochInfos();
1409
+ setInLocalStorage(EPOCHS_INFO_CACHE_KEY, JSON.stringify(response), EPOCHS_INFO_CACHE_TTL);
1410
+ return response;
1411
+ } catch (e) {
1412
+ console.error(e);
1413
+ return { epochs: [] };
1414
+ }
1415
+ }
1416
+ async function getCurrentEpoch(identifier) {
1417
+ const all = await getEpochsInfo();
1418
+ return all.epochs.find((item) => item.identifier === identifier);
1419
+ }
1420
+ async function getHourEpochInfo() {
1421
+ return getCurrentEpoch(EPOCH_HOUR);
1422
+ }
1423
+ async function getWeekEpochInfo() {
1424
+ return getCurrentEpoch(EPOCH_WEEK);
1425
+ }
1426
+ async function getCurrentWeekEpochEndTime() {
1427
+ return getPeriodicEpochEndTime(EPOCH_WEEK);
1428
+ }
1429
+ async function getPeriodicWeekEpochEndTime(modWeek = 1) {
1430
+ return getPeriodicEpochEndTime(EPOCH_WEEK, modWeek);
1431
+ }
1432
+ async function getPeriodicEpochEndTime(identifier, mod = 1) {
1433
+ const epoch = await getCurrentEpoch(identifier);
1434
+ if (!epoch || !epoch.current_epoch_start_time) {
1435
+ return void 0;
1436
+ }
1437
+ const current = toBigNumber(epoch.current_epoch);
1438
+ let remainingEpochs = mod - current.toNumber() % mod;
1439
+ if (remainingEpochs === mod) {
1440
+ remainingEpochs = 0;
1441
+ }
1442
+ const startAt = new Date(epoch.current_epoch_start_time);
1443
+ const duration = getEpochDurationByIdentifier(identifier);
1444
+ startAt.setTime(startAt.getTime() + duration + duration * remainingEpochs);
1445
+ return startAt;
1446
+ }
1447
+ function getEpochDurationByIdentifier(identifier) {
1448
+ const hourMs = 60 * 60 * 1e3;
1449
+ switch (identifier) {
1450
+ case EPOCH_HOUR:
1451
+ return hourMs;
1452
+ case EPOCH_DAY:
1453
+ return hourMs * 24;
1454
+ case EPOCH_WEEK:
1455
+ return hourMs * 24 * 7;
1456
+ default:
1457
+ return hourMs;
1458
+ }
1459
+ }
1460
+
1461
+ // src/query/burner.ts
1250
1462
  var BURNED_KEY = "burner:all_burned_coins";
1251
1463
  var LOCAL_CACHE_TTL = 60 * 60 * 4;
1252
1464
  var { fromPartial: QueryAllBurnedCoinsRequestFromPartial } = import_bzejs2.bze.burner.QueryAllBurnedCoinsRequest;
@@ -1292,6 +1504,33 @@ async function getAllBurnedCoins() {
1292
1504
  };
1293
1505
  }
1294
1506
  }
1507
+ var BURN_EPOCH_COUNT = 4;
1508
+ async function getNextBurning() {
1509
+ const address = getBurnerModuleAddress();
1510
+ if (address === "") {
1511
+ return void 0;
1512
+ }
1513
+ const balances = await getAddressBalances(address);
1514
+ if (balances.length === 0) {
1515
+ return void 0;
1516
+ }
1517
+ const timeFromEpoch = await getBurningTimeFromEpoch();
1518
+ if (!timeFromEpoch) {
1519
+ return void 0;
1520
+ }
1521
+ return {
1522
+ coins: balances,
1523
+ date: timeFromEpoch
1524
+ };
1525
+ }
1526
+ async function getBurningTimeFromEpoch() {
1527
+ const params = await getBurnerParams();
1528
+ let defaultBurningMod = BURN_EPOCH_COUNT;
1529
+ if (params) {
1530
+ defaultBurningMod = toBigNumber(params.periodic_burning_weeks).toNumber();
1531
+ }
1532
+ return await getPeriodicWeekEpochEndTime(defaultBurningMod);
1533
+ }
1295
1534
 
1296
1535
  // src/utils/validation.ts
1297
1536
  function isValidUrl(urlString) {
@@ -1412,54 +1651,6 @@ var isPoolSupportedByValidator = (baseDenom, quoteDenom) => {
1412
1651
  return supportedDenoms.includes(baseDenom) || supportedDenoms.includes(quoteDenom);
1413
1652
  };
1414
1653
 
1415
- // src/constants/endpoints.ts
1416
- function getRestURL() {
1417
- return process.env.NEXT_PUBLIC_REST_URL || "";
1418
- }
1419
- function getRpcURL() {
1420
- return process.env.NEXT_PUBLIC_RPC_URL || "";
1421
- }
1422
- function getArchwayRpcURL() {
1423
- return process.env.NEXT_PUBLIC_RPC_URL_ARCHWAY || "";
1424
- }
1425
- function getOsmosisRpcUrl() {
1426
- return process.env.NEXT_PUBLIC_RPC_URL_OSMOSIS || "";
1427
- }
1428
- function getNobleRpcUrl() {
1429
- return process.env.NEXT_PUBLIC_RPC_URL_NOBLE || "";
1430
- }
1431
- function getJackalRpcUrl() {
1432
- return process.env.NEXT_PUBLIC_RPC_URL_JACKAL || "";
1433
- }
1434
- function getOmniFlixRpcUrl() {
1435
- return process.env.NEXT_PUBLIC_RPC_URL_FLIX || "";
1436
- }
1437
- function getAtomOneRpcUrl() {
1438
- return process.env.NEXT_PUBLIC_RPC_URL_ATOMONE || "";
1439
- }
1440
- function getArchwayRestURL() {
1441
- return process.env.NEXT_PUBLIC_REST_URL_ARCHWAY || "";
1442
- }
1443
- function getOsmosisRestURL() {
1444
- return process.env.NEXT_PUBLIC_REST_URL_OSMOSIS || "";
1445
- }
1446
- function getNobleRestURL() {
1447
- return process.env.NEXT_PUBLIC_REST_URL_NOBLE || "";
1448
- }
1449
- function getJackalRestURL() {
1450
- return process.env.NEXT_PUBLIC_REST_URL_JACKAL || "";
1451
- }
1452
- function getOmniFlixRestURL() {
1453
- return process.env.NEXT_PUBLIC_REST_URL_FLIX || "";
1454
- }
1455
- function getAtomOneRestURL() {
1456
- return process.env.NEXT_PUBLIC_REST_URL_ATOMONE || "";
1457
- }
1458
- var getAggregatorHost = () => {
1459
- var _a2;
1460
- return (_a2 = process.env.NEXT_PUBLIC_AGG_API_HOST) != null ? _a2 : "https://getbze.com";
1461
- };
1462
-
1463
1654
  // src/constants/market.ts
1464
1655
  var EXCLUDED_MARKETS = {
1465
1656
  "factory/bze1f0qgels0eu96ev6a67znu70q7rquy9eragn8nw/ucorey/factory/bze13gzq40che93tgfm9kzmkpjamah5nj0j73pyhqk/uvdl": true,
@@ -2273,111 +2464,125 @@ async function keplrSuggestChain(chainId) {
2273
2464
  return await ((_a2 = window.keplr) == null ? void 0 : _a2.experimentalSuggestChain(await getKeplrChainInfo(chainId)));
2274
2465
  }
2275
2466
 
2276
- // src/query/bank.ts
2277
- async function getAddressBalances(address) {
2467
+ // src/query/block.ts
2468
+ var FAILOVER_BLOCKTIMES = {
2469
+ "9334084": "2023-12-07T14:30:55.034845214Z",
2470
+ "4423602": "2023-01-18T07:51:31.391193017Z",
2471
+ "4827583": "2023-02-14T03:34:27.791387761Z",
2472
+ "5149043": "2023-03-07T11:41:10.455072975Z",
2473
+ "10855457": "2024-03-17T19:41:34.031980836Z"
2474
+ };
2475
+ var BLOCK_KEY = "tendermint:block:";
2476
+ async function getBlockDetailsByHeight(height) {
2278
2477
  try {
2478
+ const cacheKey = `${BLOCK_KEY}${height}`;
2479
+ const localData = getFromLocalStorage(cacheKey);
2480
+ if (null !== localData) {
2481
+ const parsed = JSON.parse(localData);
2482
+ if (parsed) {
2483
+ return parsed;
2484
+ }
2485
+ }
2279
2486
  const client = await getRestClient();
2280
- const response = await client.cosmos.bank.v1beta1.spendableBalances({ address });
2281
- return response.balances;
2487
+ const response = await client.cosmos.base.tendermint.v1beta1.getBlockByHeight({ height: BigInt(height.toFixed(0)) });
2488
+ setInLocalStorage(cacheKey, JSON.stringify(response), 0);
2489
+ return response;
2282
2490
  } catch (e) {
2283
- console.error("failed to get balances", e);
2284
- return [];
2491
+ console.error(e);
2492
+ return {};
2285
2493
  }
2286
2494
  }
2287
- async function getLockedBalances() {
2288
- try {
2289
- const lockerAddress = getLockerAddress();
2290
- if (!lockerAddress) {
2291
- console.warn("Locker address not configured");
2292
- return [];
2495
+ async function getBlockTimeByHeight(height) {
2496
+ var _a2, _b2;
2497
+ const details = await getBlockDetailsByHeight(height);
2498
+ if (details.block_id === void 0) {
2499
+ if (height.toFixed(0) in FAILOVER_BLOCKTIMES) {
2500
+ return new Date(FAILOVER_BLOCKTIMES[height.toFixed(0)]);
2293
2501
  }
2294
- return await getAddressBalances(lockerAddress);
2295
- } catch (e) {
2296
- console.error("failed to get locked balances", e);
2297
- return [];
2298
2502
  }
2503
+ return (_b2 = (_a2 = details.block) == null ? void 0 : _a2.header) == null ? void 0 : _b2.time;
2299
2504
  }
2300
-
2301
- // src/query/epoch.ts
2302
- var EPOCH_HOUR = "hour";
2303
- var EPOCH_DAY = "day";
2304
- var EPOCH_WEEK = "week";
2305
- var EPOCHS_INFO_CACHE_KEY = "epochs:info";
2306
- var EPOCHS_INFO_CACHE_TTL = 60 * 60;
2307
- async function getEpochsInfo() {
2505
+ async function getBlockResults(height) {
2506
+ const settings = getSettings();
2507
+ const rpcUrl = settings.endpoints.rpcEndpoint.replace("wss", "https");
2508
+ const url = `${rpcUrl}/block_results?height=${height}`;
2308
2509
  try {
2309
- const cachedData = getFromLocalStorage(EPOCHS_INFO_CACHE_KEY);
2310
- let shouldFetchFromEndpoint = false;
2311
- if (cachedData !== null) {
2312
- const cached = JSON.parse(cachedData);
2313
- const now = (/* @__PURE__ */ new Date()).getTime();
2314
- for (const epoch of cached.epochs) {
2315
- if (epoch.current_epoch_start_time) {
2316
- const startTime = new Date(epoch.current_epoch_start_time).getTime();
2317
- const duration = getEpochDurationByIdentifier(epoch.identifier);
2318
- const epochEndTime = startTime + duration - 15 * 1e3;
2319
- if (now >= epochEndTime) {
2320
- shouldFetchFromEndpoint = true;
2321
- break;
2322
- }
2323
- }
2324
- }
2325
- if (!shouldFetchFromEndpoint) {
2326
- return cached;
2510
+ const response = await fetch(url, {
2511
+ method: "GET",
2512
+ headers: {
2513
+ "Content-Type": "application/json"
2327
2514
  }
2515
+ });
2516
+ if (!response.ok) {
2517
+ console.log("not ok response from RPC: ", response);
2518
+ return void 0;
2328
2519
  }
2520
+ return await response.json();
2521
+ } catch (error) {
2522
+ console.error("Failed to fetch block results:", error);
2523
+ throw error;
2524
+ }
2525
+ }
2526
+
2527
+ // src/query/raffle.ts
2528
+ async function getRaffles() {
2529
+ try {
2329
2530
  const client = await getRestClient();
2330
- const response = await client.bze.epochs.epochInfos();
2331
- setInLocalStorage(EPOCHS_INFO_CACHE_KEY, JSON.stringify(response), EPOCHS_INFO_CACHE_TTL);
2332
- return response;
2531
+ const response = await client.bze.burner.raffles();
2532
+ return response.list;
2333
2533
  } catch (e) {
2334
2534
  console.error(e);
2335
- return { epochs: [] };
2535
+ return [];
2336
2536
  }
2337
2537
  }
2338
- async function getCurrentEpoch(identifier) {
2339
- const all = await getEpochsInfo();
2340
- return all.epochs.find((item) => item.identifier === identifier);
2341
- }
2342
- async function getHourEpochInfo() {
2343
- return getCurrentEpoch(EPOCH_HOUR);
2344
- }
2345
- async function getWeekEpochInfo() {
2346
- return getCurrentEpoch(EPOCH_WEEK);
2347
- }
2348
- async function getCurrentWeekEpochEndTime() {
2349
- return getPeriodicEpochEndTime(EPOCH_WEEK);
2350
- }
2351
- async function getPeriodicWeekEpochEndTime(modWeek = 1) {
2352
- return getPeriodicEpochEndTime(EPOCH_WEEK, modWeek);
2538
+ async function getRaffleWinners(denom) {
2539
+ try {
2540
+ const client = await getRestClient();
2541
+ const response = await client.bze.burner.raffleWinners({ denom });
2542
+ return response.list;
2543
+ } catch (e) {
2544
+ console.error(e);
2545
+ return [];
2546
+ }
2353
2547
  }
2354
- async function getPeriodicEpochEndTime(identifier, mod = 1) {
2355
- const epoch = await getCurrentEpoch(identifier);
2356
- if (!epoch || !epoch.current_epoch_start_time) {
2548
+ async function checkAddressWonRaffle(address, denom, height) {
2549
+ var _a2;
2550
+ const response = {
2551
+ hasWon: false,
2552
+ amount: "0",
2553
+ denom,
2554
+ address
2555
+ };
2556
+ if (address == "" || height <= 0) {
2357
2557
  return void 0;
2358
2558
  }
2359
- const current = toBigNumber(epoch.current_epoch);
2360
- let remainingEpochs = mod - current.toNumber() % mod;
2361
- if (remainingEpochs === mod) {
2362
- remainingEpochs = 0;
2559
+ const blockResults = await getBlockResults(height);
2560
+ if (!blockResults) {
2561
+ return void 0;
2363
2562
  }
2364
- const startAt = new Date(epoch.current_epoch_start_time);
2365
- const duration = getEpochDurationByIdentifier(identifier);
2366
- startAt.setTime(startAt.getTime() + duration + duration * remainingEpochs);
2367
- return startAt;
2368
- }
2369
- function getEpochDurationByIdentifier(identifier) {
2370
- const hourMs = 60 * 60 * 1e3;
2371
- switch (identifier) {
2372
- case EPOCH_HOUR:
2373
- return hourMs;
2374
- case EPOCH_DAY:
2375
- return hourMs * 24;
2376
- case EPOCH_WEEK:
2377
- return hourMs * 24 * 7;
2378
- default:
2379
- return hourMs;
2563
+ if (!((_a2 = blockResults.result) == null ? void 0 : _a2.finalize_block_events)) {
2564
+ return void 0;
2565
+ }
2566
+ if (blockResults.result.finalize_block_events.length === 0) {
2567
+ return void 0;
2568
+ }
2569
+ const raffleEvents = blockResults.result.finalize_block_events.filter((ev) => ev.type.includes("Raffle"));
2570
+ if (!raffleEvents || raffleEvents.length === 0) {
2571
+ return void 0;
2572
+ }
2573
+ for (let i = 0; i < raffleEvents.length; i++) {
2574
+ const ev = raffleEvents[i];
2575
+ const converted = mapEventAttributes(ev.attributes);
2576
+ if ("participant" in converted && ev.type.includes("RaffleLostEvent") && converted["participant"] === address) {
2577
+ return response;
2578
+ }
2579
+ if ("winner" in converted && ev.type.includes("RaffleWinnerEvent") && converted["winner"] === address && converted["denom"] === denom) {
2580
+ response.hasWon = true;
2581
+ response.amount = converted["amount"];
2582
+ return response;
2583
+ }
2380
2584
  }
2585
+ return response;
2381
2586
  }
2382
2587
 
2383
2588
  // src/query/factory.ts
@@ -4965,6 +5170,7 @@ function SettingsToggle({ accentColor }) {
4965
5170
  canDepositFromIBC,
4966
5171
  canSendToIBC,
4967
5172
  cancelDebounce,
5173
+ checkAddressWonRaffle,
4968
5174
  convertToWebSocketUrl,
4969
5175
  counterpartyChainForChannel,
4970
5176
  createMarketId,
@@ -5001,6 +5207,10 @@ function SettingsToggle({ accentColor }) {
5001
5207
  getAtomOneRestURL,
5002
5208
  getAtomOneRpcUrl,
5003
5209
  getBZEUSDPrice,
5210
+ getBlockDetailsByHeight,
5211
+ getBlockResults,
5212
+ getBlockTimeByHeight,
5213
+ getBurnerModuleAddress,
5004
5214
  getBurnerParams,
5005
5215
  getBurnerParamsWithClient,
5006
5216
  getChainAddressPrefix,
@@ -5024,6 +5234,7 @@ function SettingsToggle({ accentColor }) {
5024
5234
  getEpochsInfo,
5025
5235
  getFactoryDenomAdminAddress,
5026
5236
  getFromLocalStorage,
5237
+ getHardcodedLockAddress,
5027
5238
  getHashIBCTrace,
5028
5239
  getHourEpochInfo,
5029
5240
  getIBCAssetList,
@@ -5046,6 +5257,8 @@ function SettingsToggle({ accentColor }) {
5046
5257
  getMarketSellOrders,
5047
5258
  getMarkets,
5048
5259
  getMinAmount,
5260
+ getModuleAddress,
5261
+ getNextBurning,
5049
5262
  getNoOfIntervalsNeeded,
5050
5263
  getNobleRestURL,
5051
5264
  getNobleRpcUrl,
@@ -5057,6 +5270,9 @@ function SettingsToggle({ accentColor }) {
5057
5270
  getPendingUnlockParticipants,
5058
5271
  getPeriodicEpochEndTime,
5059
5272
  getPeriodicWeekEpochEndTime,
5273
+ getRaffleModuleAddress,
5274
+ getRaffleWinners,
5275
+ getRaffles,
5060
5276
  getRestClient,
5061
5277
  getRestURL,
5062
5278
  getRpcURL,