genlayer-js 0.18.5 → 0.18.6

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
 
2
2
 
3
+ ## 0.18.6 (2025-12-04)
4
+
5
+
6
+ ### Features
7
+
8
+ * Fetch epoch zero minimum duration ([#126](https://github.com/genlayerlabs/genlayer-js/issues/126)) ([89c2261](https://github.com/genlayerlabs/genlayer-js/commit/89c22611d6bf70e83d02f5922ba3e18d912abb2d))
9
+
3
10
  ## 0.18.5 (2025-12-03)
4
11
 
5
12
  ## 0.18.4 (2025-11-11)
@@ -2,10 +2,10 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkTBF5WZHLcjs = require('../chunk-TBF5WZHL.cjs');
5
+ var _chunkQAAO2WJLcjs = require('../chunk-QAAO2WJL.cjs');
6
6
  require('../chunk-75ZPJI57.cjs');
7
7
 
8
8
 
9
9
 
10
10
 
11
- exports.localnet = _chunkTBF5WZHLcjs.localnet; exports.studionet = _chunkTBF5WZHLcjs.studionet; exports.testnetAsimov = _chunkTBF5WZHLcjs.testnetAsimov;
11
+ exports.localnet = _chunkQAAO2WJLcjs.localnet; exports.studionet = _chunkQAAO2WJLcjs.studionet; exports.testnetAsimov = _chunkQAAO2WJLcjs.testnetAsimov;
@@ -2,7 +2,7 @@ import {
2
2
  localnet,
3
3
  studionet,
4
4
  testnetAsimov
5
- } from "../chunk-NZI52PRP.js";
5
+ } from "../chunk-KVHGQTAI.js";
6
6
  import "../chunk-MLKGABMK.js";
7
7
  export {
8
8
  localnet,
@@ -8333,6 +8333,13 @@ var STAKING_ABI = [
8333
8333
  inputs: [],
8334
8334
  outputs: [{ name: "", type: "uint256" }]
8335
8335
  },
8336
+ {
8337
+ name: "epochZeroMinDuration",
8338
+ type: "function",
8339
+ stateMutability: "view",
8340
+ inputs: [],
8341
+ outputs: [{ name: "", type: "uint256" }]
8342
+ },
8336
8343
  {
8337
8344
  name: "getQuarantinedValidators",
8338
8345
  type: "function",
@@ -8333,6 +8333,13 @@ var STAKING_ABI = [
8333
8333
  inputs: [],
8334
8334
  outputs: [{ name: "", type: "uint256" }]
8335
8335
  },
8336
+ {
8337
+ name: "epochZeroMinDuration",
8338
+ type: "function",
8339
+ stateMutability: "view",
8340
+ inputs: [],
8341
+ outputs: [{ name: "", type: "uint256" }]
8342
+ },
8336
8343
  {
8337
8344
  name: "getQuarantinedValidators",
8338
8345
  type: "function",
@@ -749,6 +749,15 @@ declare const STAKING_ABI: readonly [{
749
749
  readonly name: "";
750
750
  readonly type: "uint256";
751
751
  }];
752
+ }, {
753
+ readonly name: "epochZeroMinDuration";
754
+ readonly type: "function";
755
+ readonly stateMutability: "view";
756
+ readonly inputs: readonly [];
757
+ readonly outputs: readonly [{
758
+ readonly name: "";
759
+ readonly type: "uint256";
760
+ }];
752
761
  }, {
753
762
  readonly name: "getQuarantinedValidators";
754
763
  readonly type: "function";
@@ -749,6 +749,15 @@ declare const STAKING_ABI: readonly [{
749
749
  readonly name: "";
750
750
  readonly type: "uint256";
751
751
  }];
752
+ }, {
753
+ readonly name: "epochZeroMinDuration";
754
+ readonly type: "function";
755
+ readonly stateMutability: "view";
756
+ readonly inputs: readonly [];
757
+ readonly outputs: readonly [{
758
+ readonly name: "";
759
+ readonly type: "uint256";
760
+ }];
752
761
  }, {
753
762
  readonly name: "getQuarantinedValidators";
754
763
  readonly type: "function";
package/dist/index.cjs CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var _chunkTBF5WZHLcjs = require('./chunk-TBF5WZHL.cjs');
8
+ var _chunkQAAO2WJLcjs = require('./chunk-QAAO2WJL.cjs');
9
9
 
10
10
 
11
11
 
@@ -31,7 +31,7 @@ var _viem = require('viem');
31
31
  function accountActions(client) {
32
32
  return {
33
33
  fundAccount: async ({ address, amount }) => {
34
- if (_optionalChain([client, 'access', _ => _.chain, 'optionalAccess', _2 => _2.id]) !== _chunkTBF5WZHLcjs.localnet.id) {
34
+ if (_optionalChain([client, 'access', _ => _.chain, 'optionalAccess', _2 => _2.id]) !== _chunkQAAO2WJLcjs.localnet.id) {
35
35
  throw new Error("Client is not connected to the localnet");
36
36
  }
37
37
  return client.request({
@@ -415,8 +415,8 @@ function serialize(data) {
415
415
  // src/abi/index.ts
416
416
  var abi_exports = {};
417
417
  _chunk75ZPJI57cjs.__export.call(void 0, abi_exports, {
418
- STAKING_ABI: () => _chunkTBF5WZHLcjs.STAKING_ABI,
419
- VALIDATOR_WALLET_ABI: () => _chunkTBF5WZHLcjs.VALIDATOR_WALLET_ABI,
418
+ STAKING_ABI: () => _chunkQAAO2WJLcjs.STAKING_ABI,
419
+ VALIDATOR_WALLET_ABI: () => _chunkQAAO2WJLcjs.VALIDATOR_WALLET_ABI,
420
420
  calldata: () => calldata,
421
421
  transactions: () => transactions
422
422
  });
@@ -516,7 +516,7 @@ function _toJsonSafeDeep(value, seen) {
516
516
  var contractActions = (client, publicClient) => {
517
517
  return {
518
518
  getContractCode: async (address) => {
519
- if (client.chain.id !== _chunkTBF5WZHLcjs.localnet.id) {
519
+ if (client.chain.id !== _chunkQAAO2WJLcjs.localnet.id) {
520
520
  throw new Error("Getting contract code is not supported on this network");
521
521
  }
522
522
  const result = await client.request({
@@ -527,7 +527,7 @@ var contractActions = (client, publicClient) => {
527
527
  return new TextDecoder().decode(codeBytes);
528
528
  },
529
529
  getContractSchema: async (address) => {
530
- if (client.chain.id !== _chunkTBF5WZHLcjs.localnet.id) {
530
+ if (client.chain.id !== _chunkQAAO2WJLcjs.localnet.id) {
531
531
  throw new Error("Contract schema is not supported on this network");
532
532
  }
533
533
  const schema = await client.request({
@@ -537,7 +537,7 @@ var contractActions = (client, publicClient) => {
537
537
  return schema;
538
538
  },
539
539
  getContractSchemaForCode: async (contractCode) => {
540
- if (client.chain.id !== _chunkTBF5WZHLcjs.localnet.id) {
540
+ if (client.chain.id !== _chunkQAAO2WJLcjs.localnet.id) {
541
541
  throw new Error("Contract schema is not supported on this network");
542
542
  }
543
543
  const schema = await client.request({
@@ -1054,7 +1054,7 @@ var receiptActions = (client, publicClient) => ({
1054
1054
  const requestedStatus = _chunkW4V73RPNcjs.transactionsStatusNameToNumber[status];
1055
1055
  if (transactionStatusString === requestedStatus || status === "ACCEPTED" /* ACCEPTED */ && _chunkW4V73RPNcjs.isDecidedState.call(void 0, transactionStatusString)) {
1056
1056
  let finalTransaction = transaction;
1057
- if (client.chain.id === _chunkTBF5WZHLcjs.localnet.id) {
1057
+ if (client.chain.id === _chunkQAAO2WJLcjs.localnet.id) {
1058
1058
  finalTransaction = decodeLocalnetTransaction(transaction);
1059
1059
  }
1060
1060
  if (!fullTransaction) {
@@ -1119,9 +1119,9 @@ var snapID = {
1119
1119
 
1120
1120
  // src/wallet/connect.ts
1121
1121
  var networks = {
1122
- localnet: _chunkTBF5WZHLcjs.localnet,
1123
- studionet: _chunkTBF5WZHLcjs.studionet,
1124
- testnetAsimov: _chunkTBF5WZHLcjs.testnetAsimov
1122
+ localnet: _chunkQAAO2WJLcjs.localnet,
1123
+ studionet: _chunkQAAO2WJLcjs.studionet,
1124
+ testnetAsimov: _chunkQAAO2WJLcjs.testnetAsimov
1125
1125
  };
1126
1126
  var connect = async (client, network = "studionet", snapSource = "npm") => {
1127
1127
  if (!window.ethereum) {
@@ -1335,7 +1335,7 @@ var stakingActions = (client, publicClient) => {
1335
1335
  const address = getStakingAddress();
1336
1336
  return _viem.getContract.call(void 0, {
1337
1337
  address,
1338
- abi: _chunkTBF5WZHLcjs.STAKING_ABI,
1338
+ abi: _chunkQAAO2WJLcjs.STAKING_ABI,
1339
1339
  client: { public: publicClient, wallet: client }
1340
1340
  });
1341
1341
  };
@@ -1343,7 +1343,7 @@ var stakingActions = (client, publicClient) => {
1343
1343
  const address = getStakingAddress();
1344
1344
  return _viem.getContract.call(void 0, {
1345
1345
  address,
1346
- abi: _chunkTBF5WZHLcjs.STAKING_ABI,
1346
+ abi: _chunkQAAO2WJLcjs.STAKING_ABI,
1347
1347
  client: publicClient
1348
1348
  });
1349
1349
  };
@@ -1352,11 +1352,11 @@ var stakingActions = (client, publicClient) => {
1352
1352
  const amount = parseStakingAmount(options.amount);
1353
1353
  const stakingAddress = getStakingAddress();
1354
1354
  const data = options.operator ? _viem.encodeFunctionData.call(void 0, {
1355
- abi: _chunkTBF5WZHLcjs.STAKING_ABI,
1355
+ abi: _chunkQAAO2WJLcjs.STAKING_ABI,
1356
1356
  functionName: "validatorJoin",
1357
1357
  args: [options.operator]
1358
1358
  }) : _viem.encodeFunctionData.call(void 0, {
1359
- abi: _chunkTBF5WZHLcjs.STAKING_ABI,
1359
+ abi: _chunkQAAO2WJLcjs.STAKING_ABI,
1360
1360
  functionName: "validatorJoin"
1361
1361
  });
1362
1362
  const result = await executeWrite({ to: stakingAddress, data, value: amount });
@@ -1365,7 +1365,7 @@ var stakingActions = (client, publicClient) => {
1365
1365
  let eventFound = false;
1366
1366
  for (const log of receipt.logs) {
1367
1367
  try {
1368
- const decoded = _viem.decodeEventLog.call(void 0, { abi: _chunkTBF5WZHLcjs.STAKING_ABI, data: log.data, topics: log.topics });
1368
+ const decoded = _viem.decodeEventLog.call(void 0, { abi: _chunkQAAO2WJLcjs.STAKING_ABI, data: log.data, topics: log.topics });
1369
1369
  if (decoded.eventName === "ValidatorJoin") {
1370
1370
  validatorWallet = decoded.args.validator;
1371
1371
  eventFound = true;
@@ -1392,7 +1392,7 @@ var stakingActions = (client, publicClient) => {
1392
1392
  validatorDeposit: async (options) => {
1393
1393
  const amount = parseStakingAmount(options.amount);
1394
1394
  const data = _viem.encodeFunctionData.call(void 0, {
1395
- abi: _chunkTBF5WZHLcjs.STAKING_ABI,
1395
+ abi: _chunkQAAO2WJLcjs.STAKING_ABI,
1396
1396
  functionName: "validatorDeposit"
1397
1397
  });
1398
1398
  return executeWrite({ to: getStakingAddress(), data, value: amount });
@@ -1400,7 +1400,7 @@ var stakingActions = (client, publicClient) => {
1400
1400
  validatorExit: async (options) => {
1401
1401
  const shares = typeof options.shares === "string" ? BigInt(options.shares) : options.shares;
1402
1402
  const data = _viem.encodeFunctionData.call(void 0, {
1403
- abi: _chunkTBF5WZHLcjs.STAKING_ABI,
1403
+ abi: _chunkQAAO2WJLcjs.STAKING_ABI,
1404
1404
  functionName: "validatorExit",
1405
1405
  args: [shares]
1406
1406
  });
@@ -1412,7 +1412,7 @@ var stakingActions = (client, publicClient) => {
1412
1412
  }
1413
1413
  const validatorAddress = _optionalChain([options, 'optionalAccess', _58 => _58.validator]) || client.account.address;
1414
1414
  const data = _viem.encodeFunctionData.call(void 0, {
1415
- abi: _chunkTBF5WZHLcjs.STAKING_ABI,
1415
+ abi: _chunkQAAO2WJLcjs.STAKING_ABI,
1416
1416
  functionName: "validatorClaim",
1417
1417
  args: [validatorAddress]
1418
1418
  });
@@ -1421,7 +1421,7 @@ var stakingActions = (client, publicClient) => {
1421
1421
  },
1422
1422
  validatorPrime: async (options) => {
1423
1423
  const data = _viem.encodeFunctionData.call(void 0, {
1424
- abi: _chunkTBF5WZHLcjs.STAKING_ABI,
1424
+ abi: _chunkQAAO2WJLcjs.STAKING_ABI,
1425
1425
  functionName: "validatorPrime",
1426
1426
  args: [options.validator]
1427
1427
  });
@@ -1429,7 +1429,7 @@ var stakingActions = (client, publicClient) => {
1429
1429
  },
1430
1430
  setOperator: async (options) => {
1431
1431
  const data = _viem.encodeFunctionData.call(void 0, {
1432
- abi: _chunkTBF5WZHLcjs.VALIDATOR_WALLET_ABI,
1432
+ abi: _chunkQAAO2WJLcjs.VALIDATOR_WALLET_ABI,
1433
1433
  functionName: "setOperator",
1434
1434
  args: [options.operator]
1435
1435
  });
@@ -1445,7 +1445,7 @@ var stakingActions = (client, publicClient) => {
1445
1445
  }
1446
1446
  }
1447
1447
  const data = _viem.encodeFunctionData.call(void 0, {
1448
- abi: _chunkTBF5WZHLcjs.VALIDATOR_WALLET_ABI,
1448
+ abi: _chunkQAAO2WJLcjs.VALIDATOR_WALLET_ABI,
1449
1449
  functionName: "setIdentity",
1450
1450
  args: [
1451
1451
  options.moniker,
@@ -1464,7 +1464,7 @@ var stakingActions = (client, publicClient) => {
1464
1464
  delegatorJoin: async (options) => {
1465
1465
  const amount = parseStakingAmount(options.amount);
1466
1466
  const data = _viem.encodeFunctionData.call(void 0, {
1467
- abi: _chunkTBF5WZHLcjs.STAKING_ABI,
1467
+ abi: _chunkQAAO2WJLcjs.STAKING_ABI,
1468
1468
  functionName: "delegatorJoin",
1469
1469
  args: [options.validator]
1470
1470
  });
@@ -1480,7 +1480,7 @@ var stakingActions = (client, publicClient) => {
1480
1480
  delegatorExit: async (options) => {
1481
1481
  const shares = typeof options.shares === "string" ? BigInt(options.shares) : options.shares;
1482
1482
  const data = _viem.encodeFunctionData.call(void 0, {
1483
- abi: _chunkTBF5WZHLcjs.STAKING_ABI,
1483
+ abi: _chunkQAAO2WJLcjs.STAKING_ABI,
1484
1484
  functionName: "delegatorExit",
1485
1485
  args: [options.validator, shares]
1486
1486
  });
@@ -1492,7 +1492,7 @@ var stakingActions = (client, publicClient) => {
1492
1492
  }
1493
1493
  const delegatorAddress = options.delegator || client.account.address;
1494
1494
  const data = _viem.encodeFunctionData.call(void 0, {
1495
- abi: _chunkTBF5WZHLcjs.STAKING_ABI,
1495
+ abi: _chunkQAAO2WJLcjs.STAKING_ABI,
1496
1496
  functionName: "delegatorClaim",
1497
1497
  args: [delegatorAddress, options.validator]
1498
1498
  });
@@ -1510,7 +1510,7 @@ var stakingActions = (client, publicClient) => {
1510
1510
  }
1511
1511
  const walletContract = _viem.getContract.call(void 0, {
1512
1512
  address: validator,
1513
- abi: _chunkTBF5WZHLcjs.VALIDATOR_WALLET_ABI,
1513
+ abi: _chunkQAAO2WJLcjs.VALIDATOR_WALLET_ABI,
1514
1514
  client: publicClient
1515
1515
  });
1516
1516
  const [view, owner, operator, identityRaw, currentEpoch] = await Promise.all([
@@ -1636,12 +1636,22 @@ var stakingActions = (client, publicClient) => {
1636
1636
  },
1637
1637
  getEpochInfo: async () => {
1638
1638
  const contract = getReadOnlyStakingContract();
1639
- const [epoch, validatorMinStake, delegatorMinStake, activeCount, epochMinDuration, epochOdd, epochEven] = await Promise.all([
1639
+ const [
1640
+ epoch,
1641
+ validatorMinStake,
1642
+ delegatorMinStake,
1643
+ activeCount,
1644
+ epochMinDuration,
1645
+ epochZeroMinDuration,
1646
+ epochOdd,
1647
+ epochEven
1648
+ ] = await Promise.all([
1640
1649
  contract.read.epoch(),
1641
1650
  contract.read.validatorMinStake(),
1642
1651
  contract.read.delegatorMinStake(),
1643
1652
  contract.read.activeValidatorsCount(),
1644
1653
  contract.read.epochMinDuration(),
1654
+ contract.read.epochZeroMinDuration(),
1645
1655
  contract.read.epochOdd(),
1646
1656
  contract.read.epochEven()
1647
1657
  ]);
@@ -1650,7 +1660,8 @@ var stakingActions = (client, publicClient) => {
1650
1660
  const currentEpochEnd = currentEpochData.end > 0n ? new Date(Number(currentEpochData.end) * 1e3) : null;
1651
1661
  let nextEpochEstimate = null;
1652
1662
  if (!currentEpochEnd) {
1653
- const estimatedEndMs = Number(currentEpochData.start + epochMinDuration) * 1e3;
1663
+ const duration = epoch === 0n ? epochZeroMinDuration : epochMinDuration;
1664
+ const estimatedEndMs = Number(currentEpochData.start + duration) * 1e3;
1654
1665
  nextEpochEstimate = new Date(estimatedEndMs);
1655
1666
  }
1656
1667
  return {
@@ -1712,7 +1723,7 @@ var stakingActions = (client, publicClient) => {
1712
1723
  function chainActions(client) {
1713
1724
  return {
1714
1725
  initializeConsensusSmartContract: async (forceReset = false) => {
1715
- if (_optionalChain([client, 'access', _59 => _59.chain, 'optionalAccess', _60 => _60.id]) === _chunkTBF5WZHLcjs.testnetAsimov.id) {
1726
+ if (_optionalChain([client, 'access', _59 => _59.chain, 'optionalAccess', _60 => _60.id]) === _chunkQAAO2WJLcjs.testnetAsimov.id) {
1716
1727
  return;
1717
1728
  }
1718
1729
  if (!forceReset && _optionalChain([client, 'access', _61 => _61.chain, 'access', _62 => _62.consensusMainContract, 'optionalAccess', _63 => _63.address]) && _optionalChain([client, 'access', _64 => _64.chain, 'access', _65 => _65.consensusMainContract, 'optionalAccess', _66 => _66.abi])) {
@@ -1785,8 +1796,8 @@ var getCustomTransportConfig = (config) => {
1785
1796
  }
1786
1797
  };
1787
1798
  };
1788
- var createClient = (config = { chain: _chunkTBF5WZHLcjs.localnet }) => {
1789
- const chainConfig = config.chain || _chunkTBF5WZHLcjs.localnet;
1799
+ var createClient = (config = { chain: _chunkQAAO2WJLcjs.localnet }) => {
1800
+ const chainConfig = config.chain || _chunkQAAO2WJLcjs.localnet;
1790
1801
  if (config.endpoint) {
1791
1802
  chainConfig.rpcUrls.default.http = [config.endpoint];
1792
1803
  }
@@ -1847,4 +1858,4 @@ var createAccount = (accountPrivateKey) => {
1847
1858
 
1848
1859
 
1849
1860
 
1850
- exports.abi = abi_exports; exports.chains = _chunkTBF5WZHLcjs.chains_exports; exports.createAccount = createAccount; exports.createClient = createClient; exports.decodeInputData = decodeInputData; exports.decodeLocalnetTransaction = decodeLocalnetTransaction; exports.decodeTransaction = decodeTransaction; exports.formatStakingAmount = formatStakingAmount; exports.generatePrivateKey = generatePrivateKey; exports.parseStakingAmount = parseStakingAmount; exports.simplifyTransactionReceipt = simplifyTransactionReceipt;
1861
+ exports.abi = abi_exports; exports.chains = _chunkQAAO2WJLcjs.chains_exports; exports.createAccount = createAccount; exports.createClient = createClient; exports.decodeInputData = decodeInputData; exports.decodeLocalnetTransaction = decodeLocalnetTransaction; exports.decodeTransaction = decodeTransaction; exports.formatStakingAmount = formatStakingAmount; exports.generatePrivateKey = generatePrivateKey; exports.parseStakingAmount = parseStakingAmount; exports.simplifyTransactionReceipt = simplifyTransactionReceipt;
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as viem from 'viem';
2
2
  import { Account, Address, Hex } from 'viem';
3
3
  import { G as GenLayerChain } from './chains-B7B7UXdn.cjs';
4
- import { G as GenLayerClient, D as DecodedDeployData, a as DecodedCallData, b as GenLayerRawTransaction, c as GenLayerTransaction, C as CalldataEncodable, T as TransactionDataElement, S as STAKING_ABI, V as VALIDATOR_WALLET_ABI } from './index-Dfaw9WiR.cjs';
4
+ import { G as GenLayerClient, D as DecodedDeployData, a as DecodedCallData, b as GenLayerRawTransaction, c as GenLayerTransaction, C as CalldataEncodable, T as TransactionDataElement, S as STAKING_ABI, V as VALIDATOR_WALLET_ABI } from './index-3leEwFoq.cjs';
5
5
  import * as abitype from 'abitype';
6
6
  import * as viem__types_types_authorization from 'viem/_types/types/authorization';
7
7
  import * as viem_accounts from 'viem/accounts';
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as viem from 'viem';
2
2
  import { Account, Address, Hex } from 'viem';
3
3
  import { G as GenLayerChain } from './chains-B7B7UXdn.js';
4
- import { G as GenLayerClient, D as DecodedDeployData, a as DecodedCallData, b as GenLayerRawTransaction, c as GenLayerTransaction, C as CalldataEncodable, T as TransactionDataElement, S as STAKING_ABI, V as VALIDATOR_WALLET_ABI } from './index-DPyenUTZ.js';
4
+ import { G as GenLayerClient, D as DecodedDeployData, a as DecodedCallData, b as GenLayerRawTransaction, c as GenLayerTransaction, C as CalldataEncodable, T as TransactionDataElement, S as STAKING_ABI, V as VALIDATOR_WALLET_ABI } from './index-BBh1NZjP.js';
5
5
  import * as abitype from 'abitype';
6
6
  import * as viem__types_types_authorization from 'viem/_types/types/authorization';
7
7
  import * as viem_accounts from 'viem/accounts';
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  localnet,
6
6
  studionet,
7
7
  testnetAsimov
8
- } from "./chunk-NZI52PRP.js";
8
+ } from "./chunk-KVHGQTAI.js";
9
9
  import {
10
10
  CalldataAddress,
11
11
  isDecidedState,
@@ -1636,12 +1636,22 @@ var stakingActions = (client, publicClient) => {
1636
1636
  },
1637
1637
  getEpochInfo: async () => {
1638
1638
  const contract = getReadOnlyStakingContract();
1639
- const [epoch, validatorMinStake, delegatorMinStake, activeCount, epochMinDuration, epochOdd, epochEven] = await Promise.all([
1639
+ const [
1640
+ epoch,
1641
+ validatorMinStake,
1642
+ delegatorMinStake,
1643
+ activeCount,
1644
+ epochMinDuration,
1645
+ epochZeroMinDuration,
1646
+ epochOdd,
1647
+ epochEven
1648
+ ] = await Promise.all([
1640
1649
  contract.read.epoch(),
1641
1650
  contract.read.validatorMinStake(),
1642
1651
  contract.read.delegatorMinStake(),
1643
1652
  contract.read.activeValidatorsCount(),
1644
1653
  contract.read.epochMinDuration(),
1654
+ contract.read.epochZeroMinDuration(),
1645
1655
  contract.read.epochOdd(),
1646
1656
  contract.read.epochEven()
1647
1657
  ]);
@@ -1650,7 +1660,8 @@ var stakingActions = (client, publicClient) => {
1650
1660
  const currentEpochEnd = currentEpochData.end > 0n ? new Date(Number(currentEpochData.end) * 1e3) : null;
1651
1661
  let nextEpochEstimate = null;
1652
1662
  if (!currentEpochEnd) {
1653
- const estimatedEndMs = Number(currentEpochData.start + epochMinDuration) * 1e3;
1663
+ const duration = epoch === 0n ? epochZeroMinDuration : epochMinDuration;
1664
+ const estimatedEndMs = Number(currentEpochData.start + duration) * 1e3;
1654
1665
  nextEpochEstimate = new Date(estimatedEndMs);
1655
1666
  }
1656
1667
  return {
@@ -1,3 +1,3 @@
1
1
  export { Account, Address } from 'viem';
2
- export { I as BannedValidatorInfo, d as CalldataAddress, C as CalldataEncodable, i as ContractMethod, h as ContractMethodBase, f as ContractParamsArraySchemaElement, g as ContractParamsSchema, j as ContractSchema, o as DECIDED_STATES, a as DecodedCallData, D as DecodedDeployData, a3 as DelegatorClaimOptions, a2 as DelegatorExitOptions, a1 as DelegatorJoinOptions, R as DelegatorJoinResult, K as EpochData, L as EpochInfo, G as GenLayerClient, e as GenLayerMethod, b as GenLayerRawTransaction, c as GenLayerTransaction, H as Hash, M as MethodDescription, N as Network, P as PendingDeposit, F as PendingWithdrawal, a0 as SetIdentityOptions, $ as SetOperatorOptions, y as SnapSource, J as StakeInfo, a4 as StakingActions, z as StakingContract, O as StakingTransactionResult, k as TransactionHash, x as TransactionHashVariant, m as TransactionResult, r as TransactionResultNameToNumber, l as TransactionStatus, w as TransactionType, Z as ValidatorClaimOptions, X as ValidatorDepositOptions, Y as ValidatorExitOptions, B as ValidatorIdentity, E as ValidatorInfo, U as ValidatorJoinOptions, Q as ValidatorJoinResult, _ as ValidatorPrimeOptions, A as ValidatorView, s as VoteType, W as WithdrawalCommit, p as isDecidedState, q as transactionResultNumberToName, n as transactionsStatusNameToNumber, t as transactionsStatusNumberToName, u as voteTypeNameToNumber, v as voteTypeNumberToName } from '../index-Dfaw9WiR.cjs';
2
+ export { I as BannedValidatorInfo, d as CalldataAddress, C as CalldataEncodable, i as ContractMethod, h as ContractMethodBase, f as ContractParamsArraySchemaElement, g as ContractParamsSchema, j as ContractSchema, o as DECIDED_STATES, a as DecodedCallData, D as DecodedDeployData, a3 as DelegatorClaimOptions, a2 as DelegatorExitOptions, a1 as DelegatorJoinOptions, R as DelegatorJoinResult, K as EpochData, L as EpochInfo, G as GenLayerClient, e as GenLayerMethod, b as GenLayerRawTransaction, c as GenLayerTransaction, H as Hash, M as MethodDescription, N as Network, P as PendingDeposit, F as PendingWithdrawal, a0 as SetIdentityOptions, $ as SetOperatorOptions, y as SnapSource, J as StakeInfo, a4 as StakingActions, z as StakingContract, O as StakingTransactionResult, k as TransactionHash, x as TransactionHashVariant, m as TransactionResult, r as TransactionResultNameToNumber, l as TransactionStatus, w as TransactionType, Z as ValidatorClaimOptions, X as ValidatorDepositOptions, Y as ValidatorExitOptions, B as ValidatorIdentity, E as ValidatorInfo, U as ValidatorJoinOptions, Q as ValidatorJoinResult, _ as ValidatorPrimeOptions, A as ValidatorView, s as VoteType, W as WithdrawalCommit, p as isDecidedState, q as transactionResultNumberToName, n as transactionsStatusNameToNumber, t as transactionsStatusNumberToName, u as voteTypeNameToNumber, v as voteTypeNumberToName } from '../index-3leEwFoq.cjs';
3
3
  export { G as GenLayerChain } from '../chains-B7B7UXdn.cjs';
@@ -1,3 +1,3 @@
1
1
  export { Account, Address } from 'viem';
2
- export { I as BannedValidatorInfo, d as CalldataAddress, C as CalldataEncodable, i as ContractMethod, h as ContractMethodBase, f as ContractParamsArraySchemaElement, g as ContractParamsSchema, j as ContractSchema, o as DECIDED_STATES, a as DecodedCallData, D as DecodedDeployData, a3 as DelegatorClaimOptions, a2 as DelegatorExitOptions, a1 as DelegatorJoinOptions, R as DelegatorJoinResult, K as EpochData, L as EpochInfo, G as GenLayerClient, e as GenLayerMethod, b as GenLayerRawTransaction, c as GenLayerTransaction, H as Hash, M as MethodDescription, N as Network, P as PendingDeposit, F as PendingWithdrawal, a0 as SetIdentityOptions, $ as SetOperatorOptions, y as SnapSource, J as StakeInfo, a4 as StakingActions, z as StakingContract, O as StakingTransactionResult, k as TransactionHash, x as TransactionHashVariant, m as TransactionResult, r as TransactionResultNameToNumber, l as TransactionStatus, w as TransactionType, Z as ValidatorClaimOptions, X as ValidatorDepositOptions, Y as ValidatorExitOptions, B as ValidatorIdentity, E as ValidatorInfo, U as ValidatorJoinOptions, Q as ValidatorJoinResult, _ as ValidatorPrimeOptions, A as ValidatorView, s as VoteType, W as WithdrawalCommit, p as isDecidedState, q as transactionResultNumberToName, n as transactionsStatusNameToNumber, t as transactionsStatusNumberToName, u as voteTypeNameToNumber, v as voteTypeNumberToName } from '../index-DPyenUTZ.js';
2
+ export { I as BannedValidatorInfo, d as CalldataAddress, C as CalldataEncodable, i as ContractMethod, h as ContractMethodBase, f as ContractParamsArraySchemaElement, g as ContractParamsSchema, j as ContractSchema, o as DECIDED_STATES, a as DecodedCallData, D as DecodedDeployData, a3 as DelegatorClaimOptions, a2 as DelegatorExitOptions, a1 as DelegatorJoinOptions, R as DelegatorJoinResult, K as EpochData, L as EpochInfo, G as GenLayerClient, e as GenLayerMethod, b as GenLayerRawTransaction, c as GenLayerTransaction, H as Hash, M as MethodDescription, N as Network, P as PendingDeposit, F as PendingWithdrawal, a0 as SetIdentityOptions, $ as SetOperatorOptions, y as SnapSource, J as StakeInfo, a4 as StakingActions, z as StakingContract, O as StakingTransactionResult, k as TransactionHash, x as TransactionHashVariant, m as TransactionResult, r as TransactionResultNameToNumber, l as TransactionStatus, w as TransactionType, Z as ValidatorClaimOptions, X as ValidatorDepositOptions, Y as ValidatorExitOptions, B as ValidatorIdentity, E as ValidatorInfo, U as ValidatorJoinOptions, Q as ValidatorJoinResult, _ as ValidatorPrimeOptions, A as ValidatorView, s as VoteType, W as WithdrawalCommit, p as isDecidedState, q as transactionResultNumberToName, n as transactionsStatusNameToNumber, t as transactionsStatusNumberToName, u as voteTypeNameToNumber, v as voteTypeNumberToName } from '../index-BBh1NZjP.js';
3
3
  export { G as GenLayerChain } from '../chains-B7B7UXdn.js';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "genlayer-js",
3
3
  "type": "module",
4
- "version": "0.18.5",
4
+ "version": "0.18.6",
5
5
  "description": "GenLayer JavaScript SDK",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -293,6 +293,13 @@ export const STAKING_ABI = [
293
293
  inputs: [],
294
294
  outputs: [{name: "", type: "uint256"}],
295
295
  },
296
+ {
297
+ name: "epochZeroMinDuration",
298
+ type: "function",
299
+ stateMutability: "view",
300
+ inputs: [],
301
+ outputs: [{name: "", type: "uint256"}],
302
+ },
296
303
  {
297
304
  name: "getQuarantinedValidators",
298
305
  type: "function",
@@ -513,16 +513,25 @@ export const stakingActions = (
513
513
  getEpochInfo: async (): Promise<EpochInfo> => {
514
514
  const contract = getReadOnlyStakingContract();
515
515
 
516
- const [epoch, validatorMinStake, delegatorMinStake, activeCount, epochMinDuration, epochOdd, epochEven] =
517
- await Promise.all([
518
- contract.read.epoch() as Promise<bigint>,
519
- contract.read.validatorMinStake() as Promise<bigint>,
520
- contract.read.delegatorMinStake() as Promise<bigint>,
521
- contract.read.activeValidatorsCount() as Promise<bigint>,
522
- contract.read.epochMinDuration() as Promise<bigint>,
523
- contract.read.epochOdd() as Promise<any>,
524
- contract.read.epochEven() as Promise<any>,
525
- ]);
516
+ const [
517
+ epoch,
518
+ validatorMinStake,
519
+ delegatorMinStake,
520
+ activeCount,
521
+ epochMinDuration,
522
+ epochZeroMinDuration,
523
+ epochOdd,
524
+ epochEven,
525
+ ] = await Promise.all([
526
+ contract.read.epoch() as Promise<bigint>,
527
+ contract.read.validatorMinStake() as Promise<bigint>,
528
+ contract.read.delegatorMinStake() as Promise<bigint>,
529
+ contract.read.activeValidatorsCount() as Promise<bigint>,
530
+ contract.read.epochMinDuration() as Promise<bigint>,
531
+ contract.read.epochZeroMinDuration() as Promise<bigint>,
532
+ contract.read.epochOdd() as Promise<any>,
533
+ contract.read.epochEven() as Promise<any>,
534
+ ]);
526
535
 
527
536
  // Current epoch data (even epochs use epochEven, odd use epochOdd)
528
537
  const currentEpochData = epoch % 2n === 0n ? epochEven : epochOdd;
@@ -530,9 +539,11 @@ export const stakingActions = (
530
539
  const currentEpochEnd = currentEpochData.end > 0n ? new Date(Number(currentEpochData.end) * 1000) : null;
531
540
 
532
541
  // Estimate next epoch: current start + min duration (if epoch hasn't ended)
542
+ // Epoch 0 uses epochZeroMinDuration, all other epochs use epochMinDuration
533
543
  let nextEpochEstimate: Date | null = null;
534
544
  if (!currentEpochEnd) {
535
- const estimatedEndMs = Number(currentEpochData.start + epochMinDuration) * 1000;
545
+ const duration = epoch === 0n ? epochZeroMinDuration : epochMinDuration;
546
+ const estimatedEndMs = Number(currentEpochData.start + duration) * 1000;
536
547
  nextEpochEstimate = new Date(estimatedEndMs);
537
548
  }
538
549