genlayer-js 0.21.1 → 0.21.2

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.
@@ -3,11 +3,11 @@
3
3
 
4
4
 
5
5
 
6
- var _chunkTCAQ6AVFcjs = require('../chunk-TCAQ6AVF.cjs');
6
+ var _chunkCX76PQR5cjs = require('../chunk-CX76PQR5.cjs');
7
7
  require('../chunk-75ZPJI57.cjs');
8
8
 
9
9
 
10
10
 
11
11
 
12
12
 
13
- exports.localnet = _chunkTCAQ6AVFcjs.localnet; exports.studionet = _chunkTCAQ6AVFcjs.studionet; exports.testnetAsimov = _chunkTCAQ6AVFcjs.testnetAsimov; exports.testnetBradbury = _chunkTCAQ6AVFcjs.testnetBradbury;
13
+ exports.localnet = _chunkCX76PQR5cjs.localnet; exports.studionet = _chunkCX76PQR5cjs.studionet; exports.testnetAsimov = _chunkCX76PQR5cjs.testnetAsimov; exports.testnetBradbury = _chunkCX76PQR5cjs.testnetBradbury;
@@ -3,7 +3,7 @@ import {
3
3
  studionet,
4
4
  testnetAsimov,
5
5
  testnetBradbury
6
- } from "../chunk-5KRGDGMO.js";
6
+ } from "../chunk-T3O6IXYQ.js";
7
7
  import "../chunk-MLKGABMK.js";
8
8
  export {
9
9
  localnet,
@@ -9518,8 +9518,7 @@ var STAKING_ABI = [
9518
9518
  ];
9519
9519
 
9520
9520
  // src/chains/testnetAsimov.ts
9521
- var TESTNET_JSON_RPC_URL = "https://zksync-os-testnet-genlayer.zksync.dev";
9522
- var TESTNET_WS_URL = "wss://zksync-os-testnet-genlayer.zksync.dev/ws";
9521
+ var TESTNET_JSON_RPC_URL = "http://34.12.136.220:9151";
9523
9522
  var STAKING_CONTRACT = {
9524
9523
  address: "0x63Fa5E0bb10fb6fA98F44726C5518223F767687A",
9525
9524
  abi: STAKING_ABI
@@ -13501,8 +13500,7 @@ var testnetAsimov = _viem.defineChain.call(void 0, {
13501
13500
  name: "Genlayer Asimov Testnet",
13502
13501
  rpcUrls: {
13503
13502
  default: {
13504
- http: [TESTNET_JSON_RPC_URL],
13505
- webSocket: [TESTNET_WS_URL]
13503
+ http: [TESTNET_JSON_RPC_URL]
13506
13504
  }
13507
13505
  },
13508
13506
  nativeCurrency: {
@@ -13526,8 +13524,7 @@ var testnetAsimov = _viem.defineChain.call(void 0, {
13526
13524
 
13527
13525
  // src/chains/testnetBradbury.ts
13528
13526
 
13529
- var TESTNET_JSON_RPC_URL2 = "https://zksync-os-testnet-genlayer.zksync.dev";
13530
- var TESTNET_WS_URL2 = "wss://zksync-os-testnet-genlayer.zksync.dev/ws";
13527
+ var TESTNET_JSON_RPC_URL2 = "http://34.91.102.53:9151";
13531
13528
  var STAKING_CONTRACT2 = {
13532
13529
  address: "0x4A4449E617F8D10FDeD0b461CadEf83939E821A5",
13533
13530
  abi: STAKING_ABI
@@ -16855,8 +16852,7 @@ var testnetBradbury = _viem.defineChain.call(void 0, {
16855
16852
  name: "Genlayer Bradbury Testnet",
16856
16853
  rpcUrls: {
16857
16854
  default: {
16858
- http: [TESTNET_JSON_RPC_URL2],
16859
- webSocket: [TESTNET_WS_URL2]
16855
+ http: [TESTNET_JSON_RPC_URL2]
16860
16856
  }
16861
16857
  },
16862
16858
  nativeCurrency: {
@@ -9518,8 +9518,7 @@ var STAKING_ABI = [
9518
9518
  ];
9519
9519
 
9520
9520
  // src/chains/testnetAsimov.ts
9521
- var TESTNET_JSON_RPC_URL = "https://zksync-os-testnet-genlayer.zksync.dev";
9522
- var TESTNET_WS_URL = "wss://zksync-os-testnet-genlayer.zksync.dev/ws";
9521
+ var TESTNET_JSON_RPC_URL = "http://34.12.136.220:9151";
9523
9522
  var STAKING_CONTRACT = {
9524
9523
  address: "0x63Fa5E0bb10fb6fA98F44726C5518223F767687A",
9525
9524
  abi: STAKING_ABI
@@ -13501,8 +13500,7 @@ var testnetAsimov = defineChain3({
13501
13500
  name: "Genlayer Asimov Testnet",
13502
13501
  rpcUrls: {
13503
13502
  default: {
13504
- http: [TESTNET_JSON_RPC_URL],
13505
- webSocket: [TESTNET_WS_URL]
13503
+ http: [TESTNET_JSON_RPC_URL]
13506
13504
  }
13507
13505
  },
13508
13506
  nativeCurrency: {
@@ -13526,8 +13524,7 @@ var testnetAsimov = defineChain3({
13526
13524
 
13527
13525
  // src/chains/testnetBradbury.ts
13528
13526
  import { defineChain as defineChain4 } from "viem";
13529
- var TESTNET_JSON_RPC_URL2 = "https://zksync-os-testnet-genlayer.zksync.dev";
13530
- var TESTNET_WS_URL2 = "wss://zksync-os-testnet-genlayer.zksync.dev/ws";
13527
+ var TESTNET_JSON_RPC_URL2 = "http://34.91.102.53:9151";
13531
13528
  var STAKING_CONTRACT2 = {
13532
13529
  address: "0x4A4449E617F8D10FDeD0b461CadEf83939E821A5",
13533
13530
  abi: STAKING_ABI
@@ -16855,8 +16852,7 @@ var testnetBradbury = defineChain4({
16855
16852
  name: "Genlayer Bradbury Testnet",
16856
16853
  rpcUrls: {
16857
16854
  default: {
16858
- http: [TESTNET_JSON_RPC_URL2],
16859
- webSocket: [TESTNET_WS_URL2]
16855
+ http: [TESTNET_JSON_RPC_URL2]
16860
16856
  }
16861
16857
  },
16862
16858
  nativeCurrency: {
package/dist/index.cjs CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
 
8
8
 
9
- var _chunkTCAQ6AVFcjs = require('./chunk-TCAQ6AVF.cjs');
9
+ var _chunkCX76PQR5cjs = require('./chunk-CX76PQR5.cjs');
10
10
 
11
11
 
12
12
 
@@ -32,7 +32,7 @@ var _viem = require('viem');
32
32
  function accountActions(client) {
33
33
  return {
34
34
  fundAccount: async ({ address, amount }) => {
35
- if (_optionalChain([client, 'access', _ => _.chain, 'optionalAccess', _2 => _2.id]) !== _chunkTCAQ6AVFcjs.localnet.id) {
35
+ if (_optionalChain([client, 'access', _ => _.chain, 'optionalAccess', _2 => _2.id]) !== _chunkCX76PQR5cjs.localnet.id) {
36
36
  throw new Error("Client is not connected to the localnet");
37
37
  }
38
38
  return client.request({
@@ -416,8 +416,8 @@ function serialize(data) {
416
416
  // src/abi/index.ts
417
417
  var abi_exports = {};
418
418
  _chunk75ZPJI57cjs.__export.call(void 0, abi_exports, {
419
- STAKING_ABI: () => _chunkTCAQ6AVFcjs.STAKING_ABI,
420
- VALIDATOR_WALLET_ABI: () => _chunkTCAQ6AVFcjs.VALIDATOR_WALLET_ABI,
419
+ STAKING_ABI: () => _chunkCX76PQR5cjs.STAKING_ABI,
420
+ VALIDATOR_WALLET_ABI: () => _chunkCX76PQR5cjs.VALIDATOR_WALLET_ABI,
421
421
  calldata: () => calldata,
422
422
  transactions: () => transactions
423
423
  });
@@ -517,7 +517,7 @@ function _toJsonSafeDeep(value, seen) {
517
517
  var contractActions = (client, publicClient) => {
518
518
  return {
519
519
  getContractCode: async (address) => {
520
- if (client.chain.id !== _chunkTCAQ6AVFcjs.localnet.id) {
520
+ if (client.chain.id !== _chunkCX76PQR5cjs.localnet.id) {
521
521
  throw new Error("Getting contract code is not supported on this network");
522
522
  }
523
523
  const result = await client.request({
@@ -528,7 +528,7 @@ var contractActions = (client, publicClient) => {
528
528
  return new TextDecoder().decode(codeBytes);
529
529
  },
530
530
  getContractSchema: async (address) => {
531
- if (client.chain.id !== _chunkTCAQ6AVFcjs.localnet.id) {
531
+ if (client.chain.id !== _chunkCX76PQR5cjs.localnet.id) {
532
532
  throw new Error("Contract schema is not supported on this network");
533
533
  }
534
534
  const schema = await client.request({
@@ -538,7 +538,7 @@ var contractActions = (client, publicClient) => {
538
538
  return schema;
539
539
  },
540
540
  getContractSchemaForCode: async (contractCode) => {
541
- if (client.chain.id !== _chunkTCAQ6AVFcjs.localnet.id) {
541
+ if (client.chain.id !== _chunkCX76PQR5cjs.localnet.id) {
542
542
  throw new Error("Contract schema is not supported on this network");
543
543
  }
544
544
  const schema = await client.request({
@@ -1006,36 +1006,37 @@ var decodeInputData = (rlpEncodedAppData, recipient) => {
1006
1006
  }
1007
1007
  };
1008
1008
  var decodeTransaction = (tx) => {
1009
- const txDataDecoded = decodeInputData(tx.txData, tx.recipient);
1009
+ const txData = _nullishCoalesce(tx.txData, () => ( tx.txCalldata));
1010
+ const numOfInitialValidators = _nullishCoalesce(tx.numOfInitialValidators, () => ( tx.initialRotations));
1011
+ const txDataDecoded = decodeInputData(txData, tx.recipient);
1010
1012
  const decodedTx = {
1011
1013
  ...tx,
1012
- txData: tx.txData,
1014
+ txData,
1013
1015
  txDataDecoded,
1014
- currentTimestamp: _nullishCoalesce(_optionalChain([tx, 'access', _38 => _38.currentTimestamp, 'optionalAccess', _39 => _39.toString, 'call', _40 => _40()]), () => ( "0")),
1015
- // Bradbury uses `initialRotations`; older chains use `numOfInitialValidators`
1016
- numOfInitialValidators: _nullishCoalesce(_optionalChain([(_nullishCoalesce(tx.numOfInitialValidators, () => ( tx.initialRotations))), 'optionalAccess', _41 => _41.toString, 'call', _42 => _42()]), () => ( "0")),
1017
- txSlot: _nullishCoalesce(_optionalChain([tx, 'access', _43 => _43.txSlot, 'optionalAccess', _44 => _44.toString, 'call', _45 => _45()]), () => ( "0")),
1018
- createdTimestamp: _nullishCoalesce(_optionalChain([tx, 'access', _46 => _46.createdTimestamp, 'optionalAccess', _47 => _47.toString, 'call', _48 => _48()]), () => ( "0")),
1019
- lastVoteTimestamp: _nullishCoalesce(_optionalChain([tx, 'access', _49 => _49.lastVoteTimestamp, 'optionalAccess', _50 => _50.toString, 'call', _51 => _51()]), () => ( "0")),
1020
- queuePosition: _nullishCoalesce(_optionalChain([tx, 'access', _52 => _52.queuePosition, 'optionalAccess', _53 => _53.toString, 'call', _54 => _54()]), () => ( "0")),
1021
- numOfRounds: _nullishCoalesce(_optionalChain([tx, 'access', _55 => _55.numOfRounds, 'optionalAccess', _56 => _56.toString, 'call', _57 => _57()]), () => ( "0")),
1016
+ currentTimestamp: tx.currentTimestamp.toString(),
1017
+ numOfInitialValidators: _nullishCoalesce(_optionalChain([numOfInitialValidators, 'optionalAccess', _38 => _38.toString, 'call', _39 => _39()]), () => ( "0")),
1018
+ txSlot: tx.txSlot.toString(),
1019
+ createdTimestamp: tx.createdTimestamp.toString(),
1020
+ lastVoteTimestamp: tx.lastVoteTimestamp.toString(),
1021
+ queuePosition: tx.queuePosition.toString(),
1022
+ numOfRounds: tx.numOfRounds.toString(),
1022
1023
  readStateBlockRange: {
1023
1024
  ...tx.readStateBlockRange,
1024
- activationBlock: _nullishCoalesce(_optionalChain([tx, 'access', _58 => _58.readStateBlockRange, 'optionalAccess', _59 => _59.activationBlock, 'optionalAccess', _60 => _60.toString, 'call', _61 => _61()]), () => ( "0")),
1025
- processingBlock: _nullishCoalesce(_optionalChain([tx, 'access', _62 => _62.readStateBlockRange, 'optionalAccess', _63 => _63.processingBlock, 'optionalAccess', _64 => _64.toString, 'call', _65 => _65()]), () => ( "0")),
1026
- proposalBlock: _nullishCoalesce(_optionalChain([tx, 'access', _66 => _66.readStateBlockRange, 'optionalAccess', _67 => _67.proposalBlock, 'optionalAccess', _68 => _68.toString, 'call', _69 => _69()]), () => ( "0"))
1025
+ activationBlock: _nullishCoalesce(_optionalChain([tx, 'access', _40 => _40.readStateBlockRange, 'optionalAccess', _41 => _41.activationBlock, 'optionalAccess', _42 => _42.toString, 'call', _43 => _43()]), () => ( "0")),
1026
+ processingBlock: _nullishCoalesce(_optionalChain([tx, 'access', _44 => _44.readStateBlockRange, 'optionalAccess', _45 => _45.processingBlock, 'optionalAccess', _46 => _46.toString, 'call', _47 => _47()]), () => ( "0")),
1027
+ proposalBlock: _nullishCoalesce(_optionalChain([tx, 'access', _48 => _48.readStateBlockRange, 'optionalAccess', _49 => _49.proposalBlock, 'optionalAccess', _50 => _50.toString, 'call', _51 => _51()]), () => ( "0"))
1027
1028
  },
1028
1029
  statusName: _chunkW4V73RPNcjs.transactionsStatusNumberToName[String(tx.status)],
1029
1030
  resultName: _chunkW4V73RPNcjs.transactionResultNumberToName[String(tx.result)],
1030
1031
  lastRound: {
1031
1032
  ...tx.lastRound,
1032
- round: _nullishCoalesce(_optionalChain([tx, 'access', _70 => _70.lastRound, 'optionalAccess', _71 => _71.round, 'optionalAccess', _72 => _72.toString, 'call', _73 => _73()]), () => ( "0")),
1033
- leaderIndex: _nullishCoalesce(_optionalChain([tx, 'access', _74 => _74.lastRound, 'optionalAccess', _75 => _75.leaderIndex, 'optionalAccess', _76 => _76.toString, 'call', _77 => _77()]), () => ( "0")),
1034
- votesCommitted: _nullishCoalesce(_optionalChain([tx, 'access', _78 => _78.lastRound, 'optionalAccess', _79 => _79.votesCommitted, 'optionalAccess', _80 => _80.toString, 'call', _81 => _81()]), () => ( "0")),
1035
- votesRevealed: _nullishCoalesce(_optionalChain([tx, 'access', _82 => _82.lastRound, 'optionalAccess', _83 => _83.votesRevealed, 'optionalAccess', _84 => _84.toString, 'call', _85 => _85()]), () => ( "0")),
1036
- appealBond: _nullishCoalesce(_optionalChain([tx, 'access', _86 => _86.lastRound, 'optionalAccess', _87 => _87.appealBond, 'optionalAccess', _88 => _88.toString, 'call', _89 => _89()]), () => ( "0")),
1037
- rotationsLeft: _nullishCoalesce(_optionalChain([tx, 'access', _90 => _90.lastRound, 'optionalAccess', _91 => _91.rotationsLeft, 'optionalAccess', _92 => _92.toString, 'call', _93 => _93()]), () => ( "0")),
1038
- validatorVotesName: (_nullishCoalesce(_optionalChain([tx, 'access', _94 => _94.lastRound, 'optionalAccess', _95 => _95.validatorVotes]), () => ( []))).map(
1033
+ round: _nullishCoalesce(_optionalChain([tx, 'access', _52 => _52.lastRound, 'optionalAccess', _53 => _53.round, 'optionalAccess', _54 => _54.toString, 'call', _55 => _55()]), () => ( "0")),
1034
+ leaderIndex: _nullishCoalesce(_optionalChain([tx, 'access', _56 => _56.lastRound, 'optionalAccess', _57 => _57.leaderIndex, 'optionalAccess', _58 => _58.toString, 'call', _59 => _59()]), () => ( "0")),
1035
+ votesCommitted: _nullishCoalesce(_optionalChain([tx, 'access', _60 => _60.lastRound, 'optionalAccess', _61 => _61.votesCommitted, 'optionalAccess', _62 => _62.toString, 'call', _63 => _63()]), () => ( "0")),
1036
+ votesRevealed: _nullishCoalesce(_optionalChain([tx, 'access', _64 => _64.lastRound, 'optionalAccess', _65 => _65.votesRevealed, 'optionalAccess', _66 => _66.toString, 'call', _67 => _67()]), () => ( "0")),
1037
+ appealBond: _nullishCoalesce(_optionalChain([tx, 'access', _68 => _68.lastRound, 'optionalAccess', _69 => _69.appealBond, 'optionalAccess', _70 => _70.toString, 'call', _71 => _71()]), () => ( "0")),
1038
+ rotationsLeft: _nullishCoalesce(_optionalChain([tx, 'access', _72 => _72.lastRound, 'optionalAccess', _73 => _73.rotationsLeft, 'optionalAccess', _74 => _74.toString, 'call', _75 => _75()]), () => ( "0")),
1039
+ validatorVotesName: (_nullishCoalesce(_optionalChain([tx, 'access', _76 => _76.lastRound, 'optionalAccess', _77 => _77.validatorVotes]), () => ( []))).map(
1039
1040
  (vote) => _chunkW4V73RPNcjs.voteTypeNumberToName[String(vote)]
1040
1041
  )
1041
1042
  }
@@ -1117,7 +1118,7 @@ var simplifyTransactionReceipt = (tx) => {
1117
1118
  var decodeLocalnetTransaction = (tx) => {
1118
1119
  if (!tx.data) return tx;
1119
1120
  try {
1120
- const leaderReceipt = _optionalChain([tx, 'access', _96 => _96.consensus_data, 'optionalAccess', _97 => _97.leader_receipt]);
1121
+ const leaderReceipt = _optionalChain([tx, 'access', _78 => _78.consensus_data, 'optionalAccess', _79 => _79.leader_receipt]);
1121
1122
  if (leaderReceipt) {
1122
1123
  const receipts = Array.isArray(leaderReceipt) ? leaderReceipt : [leaderReceipt];
1123
1124
  receipts.forEach((receipt) => {
@@ -1148,7 +1149,7 @@ var decodeLocalnetTransaction = (tx) => {
1148
1149
  }
1149
1150
  });
1150
1151
  }
1151
- if (_optionalChain([tx, 'access', _98 => _98.data, 'optionalAccess', _99 => _99.calldata]) && typeof tx.data.calldata === "string") {
1152
+ if (_optionalChain([tx, 'access', _80 => _80.data, 'optionalAccess', _81 => _81.calldata]) && typeof tx.data.calldata === "string") {
1152
1153
  tx.data.calldata = {
1153
1154
  base64: tx.data.calldata,
1154
1155
  ...calldataToUserFriendlyJson(b64ToArray(tx.data.calldata))
@@ -1179,7 +1180,7 @@ var receiptActions = (client, publicClient) => ({
1179
1180
  const requestedStatus = _chunkW4V73RPNcjs.transactionsStatusNameToNumber[status];
1180
1181
  if (transactionStatusString === requestedStatus || status === "ACCEPTED" /* ACCEPTED */ && _chunkW4V73RPNcjs.isDecidedState.call(void 0, transactionStatusString)) {
1181
1182
  let finalTransaction = transaction;
1182
- if (client.chain.id === _chunkTCAQ6AVFcjs.localnet.id) {
1183
+ if (client.chain.id === _chunkCX76PQR5cjs.localnet.id) {
1183
1184
  finalTransaction = decodeLocalnetTransaction(transaction);
1184
1185
  }
1185
1186
  if (!fullTransaction) {
@@ -1210,8 +1211,8 @@ var transactionActions = (client, publicClient) => ({
1210
1211
  return decodeLocalnetTransaction(transaction2);
1211
1212
  }
1212
1213
  const transaction = await publicClient.readContract({
1213
- address: _optionalChain([client, 'access', _100 => _100.chain, 'access', _101 => _101.consensusDataContract, 'optionalAccess', _102 => _102.address]),
1214
- abi: _optionalChain([client, 'access', _103 => _103.chain, 'access', _104 => _104.consensusDataContract, 'optionalAccess', _105 => _105.abi]),
1214
+ address: _optionalChain([client, 'access', _82 => _82.chain, 'access', _83 => _83.consensusDataContract, 'optionalAccess', _84 => _84.address]),
1215
+ abi: _optionalChain([client, 'access', _85 => _85.chain, 'access', _86 => _86.consensusDataContract, 'optionalAccess', _87 => _87.abi]),
1215
1216
  functionName: "getTransactionData",
1216
1217
  args: [
1217
1218
  hash,
@@ -1250,7 +1251,7 @@ var transactionActions = (client, publicClient) => ({
1250
1251
  },
1251
1252
  estimateTransactionGas: async (transactionParams) => {
1252
1253
  const formattedParams = {
1253
- from: transactionParams.from || _optionalChain([client, 'access', _106 => _106.account, 'optionalAccess', _107 => _107.address]),
1254
+ from: transactionParams.from || _optionalChain([client, 'access', _88 => _88.account, 'optionalAccess', _89 => _89.address]),
1254
1255
  to: transactionParams.to,
1255
1256
  data: transactionParams.data || "0x",
1256
1257
  value: transactionParams.value ? `0x${transactionParams.value.toString(16)}` : "0x0"
@@ -1271,10 +1272,10 @@ var snapID = {
1271
1272
 
1272
1273
  // src/wallet/connect.ts
1273
1274
  var networks = {
1274
- localnet: _chunkTCAQ6AVFcjs.localnet,
1275
- studionet: _chunkTCAQ6AVFcjs.studionet,
1276
- testnetAsimov: _chunkTCAQ6AVFcjs.testnetAsimov,
1277
- testnetBradbury: _chunkTCAQ6AVFcjs.testnetBradbury
1275
+ localnet: _chunkCX76PQR5cjs.localnet,
1276
+ studionet: _chunkCX76PQR5cjs.studionet,
1277
+ testnetAsimov: _chunkCX76PQR5cjs.testnetAsimov,
1278
+ testnetBradbury: _chunkCX76PQR5cjs.testnetBradbury
1278
1279
  };
1279
1280
  var connect = async (client, network = "studionet", snapSource = "npm") => {
1280
1281
  if (!window.ethereum) {
@@ -1293,7 +1294,7 @@ var connect = async (client, network = "studionet", snapSource = "npm") => {
1293
1294
  chainName: selectedNetwork.name,
1294
1295
  rpcUrls: selectedNetwork.rpcUrls.default.http,
1295
1296
  nativeCurrency: selectedNetwork.nativeCurrency,
1296
- blockExplorerUrls: [_optionalChain([selectedNetwork, 'access', _108 => _108.blockExplorers, 'optionalAccess', _109 => _109.default, 'access', _110 => _110.url])]
1297
+ blockExplorerUrls: [_optionalChain([selectedNetwork, 'access', _90 => _90.blockExplorers, 'optionalAccess', _91 => _91.default, 'access', _92 => _92.url])]
1297
1298
  };
1298
1299
  const currentChainId = await window.ethereum.request({ method: "eth_chainId" });
1299
1300
  if (currentChainId !== chainIdHex) {
@@ -1327,10 +1328,10 @@ var metamaskClient = async (snapSource = "npm") => {
1327
1328
  }
1328
1329
  const isFlask = async () => {
1329
1330
  try {
1330
- const clientVersion = await _optionalChain([window, 'access', _111 => _111.ethereum, 'optionalAccess', _112 => _112.request, 'call', _113 => _113({
1331
+ const clientVersion = await _optionalChain([window, 'access', _93 => _93.ethereum, 'optionalAccess', _94 => _94.request, 'call', _95 => _95({
1331
1332
  method: "web3_clientVersion"
1332
1333
  })]);
1333
- return _optionalChain([clientVersion, 'optionalAccess', _114 => _114.includes, 'call', _115 => _115("flask")]);
1334
+ return _optionalChain([clientVersion, 'optionalAccess', _96 => _96.includes, 'call', _97 => _97("flask")]);
1334
1335
  } catch (error) {
1335
1336
  console.error("Error detecting Flask:", error);
1336
1337
  return false;
@@ -1338,7 +1339,7 @@ var metamaskClient = async (snapSource = "npm") => {
1338
1339
  };
1339
1340
  const installedSnaps = async () => {
1340
1341
  try {
1341
- return await _optionalChain([window, 'access', _116 => _116.ethereum, 'optionalAccess', _117 => _117.request, 'call', _118 => _118({
1342
+ return await _optionalChain([window, 'access', _98 => _98.ethereum, 'optionalAccess', _99 => _99.request, 'call', _100 => _100({
1342
1343
  method: "wallet_getSnaps"
1343
1344
  })]);
1344
1345
  } catch (error) {
@@ -1390,7 +1391,7 @@ function formatStakingAmount(amount) {
1390
1391
  // src/staking/actions.ts
1391
1392
  var FALLBACK_GAS = 1000000n;
1392
1393
  var GAS_BUFFER_MULTIPLIER = 2n;
1393
- var COMBINED_ERROR_ABI = [..._chunkTCAQ6AVFcjs.STAKING_ABI, ..._chunkTCAQ6AVFcjs.VALIDATOR_WALLET_ABI];
1394
+ var COMBINED_ERROR_ABI = [..._chunkCX76PQR5cjs.STAKING_ABI, ..._chunkCX76PQR5cjs.VALIDATOR_WALLET_ABI];
1394
1395
  function extractRevertReason(err) {
1395
1396
  if (err instanceof _viem.BaseError) {
1396
1397
  const rawError = err.walk((e) => e instanceof _viem.RawContractError);
@@ -1425,7 +1426,7 @@ function extractRevertReason(err) {
1425
1426
  }
1426
1427
  const revertError = err.walk((e) => e instanceof _viem.ContractFunctionRevertedError);
1427
1428
  if (revertError instanceof _viem.ContractFunctionRevertedError) {
1428
- if (_optionalChain([revertError, 'access', _119 => _119.data, 'optionalAccess', _120 => _120.errorName])) {
1429
+ if (_optionalChain([revertError, 'access', _101 => _101.data, 'optionalAccess', _102 => _102.errorName])) {
1429
1430
  return revertError.data.errorName;
1430
1431
  }
1431
1432
  return revertError.reason || "Unknown reason";
@@ -1513,7 +1514,7 @@ var stakingActions = (client, publicClient) => {
1513
1514
  };
1514
1515
  const getStakingAddress = () => {
1515
1516
  const stakingConfig = client.chain.stakingContract;
1516
- if (!_optionalChain([stakingConfig, 'optionalAccess', _121 => _121.address]) || stakingConfig.address === "0x0000000000000000000000000000000000000000") {
1517
+ if (!_optionalChain([stakingConfig, 'optionalAccess', _103 => _103.address]) || stakingConfig.address === "0x0000000000000000000000000000000000000000") {
1517
1518
  throw new Error("Staking is not supported on studio-based networks. Use testnet-asimov for staking operations.");
1518
1519
  }
1519
1520
  return stakingConfig.address;
@@ -1522,7 +1523,7 @@ var stakingActions = (client, publicClient) => {
1522
1523
  const address = getStakingAddress();
1523
1524
  return _viem.getContract.call(void 0, {
1524
1525
  address,
1525
- abi: _chunkTCAQ6AVFcjs.STAKING_ABI,
1526
+ abi: _chunkCX76PQR5cjs.STAKING_ABI,
1526
1527
  client: { public: publicClient, wallet: client }
1527
1528
  });
1528
1529
  };
@@ -1530,7 +1531,7 @@ var stakingActions = (client, publicClient) => {
1530
1531
  const address = getStakingAddress();
1531
1532
  return _viem.getContract.call(void 0, {
1532
1533
  address,
1533
- abi: _chunkTCAQ6AVFcjs.STAKING_ABI,
1534
+ abi: _chunkCX76PQR5cjs.STAKING_ABI,
1534
1535
  client: publicClient
1535
1536
  });
1536
1537
  };
@@ -1539,11 +1540,11 @@ var stakingActions = (client, publicClient) => {
1539
1540
  const amount = parseStakingAmount(options.amount);
1540
1541
  const stakingAddress = getStakingAddress();
1541
1542
  const data = options.operator ? _viem.encodeFunctionData.call(void 0, {
1542
- abi: _chunkTCAQ6AVFcjs.STAKING_ABI,
1543
+ abi: _chunkCX76PQR5cjs.STAKING_ABI,
1543
1544
  functionName: "validatorJoin",
1544
1545
  args: [options.operator]
1545
1546
  }) : _viem.encodeFunctionData.call(void 0, {
1546
- abi: _chunkTCAQ6AVFcjs.STAKING_ABI,
1547
+ abi: _chunkCX76PQR5cjs.STAKING_ABI,
1547
1548
  functionName: "validatorJoin"
1548
1549
  });
1549
1550
  const result = await executeWrite({ to: stakingAddress, data, value: amount });
@@ -1552,7 +1553,7 @@ var stakingActions = (client, publicClient) => {
1552
1553
  let eventFound = false;
1553
1554
  for (const log of receipt.logs) {
1554
1555
  try {
1555
- const decoded = _viem.decodeEventLog.call(void 0, { abi: _chunkTCAQ6AVFcjs.STAKING_ABI, data: log.data, topics: log.topics });
1556
+ const decoded = _viem.decodeEventLog.call(void 0, { abi: _chunkCX76PQR5cjs.STAKING_ABI, data: log.data, topics: log.topics });
1556
1557
  if (decoded.eventName === "ValidatorJoin") {
1557
1558
  validatorWallet = decoded.args.validator;
1558
1559
  eventFound = true;
@@ -1579,7 +1580,7 @@ var stakingActions = (client, publicClient) => {
1579
1580
  validatorDeposit: async (options) => {
1580
1581
  const amount = parseStakingAmount(options.amount);
1581
1582
  const data = _viem.encodeFunctionData.call(void 0, {
1582
- abi: _chunkTCAQ6AVFcjs.STAKING_ABI,
1583
+ abi: _chunkCX76PQR5cjs.STAKING_ABI,
1583
1584
  functionName: "validatorDeposit"
1584
1585
  });
1585
1586
  return executeWrite({ to: getStakingAddress(), data, value: amount });
@@ -1587,19 +1588,19 @@ var stakingActions = (client, publicClient) => {
1587
1588
  validatorExit: async (options) => {
1588
1589
  const shares = typeof options.shares === "string" ? BigInt(options.shares) : options.shares;
1589
1590
  const data = _viem.encodeFunctionData.call(void 0, {
1590
- abi: _chunkTCAQ6AVFcjs.STAKING_ABI,
1591
+ abi: _chunkCX76PQR5cjs.STAKING_ABI,
1591
1592
  functionName: "validatorExit",
1592
1593
  args: [shares]
1593
1594
  });
1594
1595
  return executeWrite({ to: getStakingAddress(), data });
1595
1596
  },
1596
1597
  validatorClaim: async (options) => {
1597
- if (!_optionalChain([options, 'optionalAccess', _122 => _122.validator]) && !client.account) {
1598
+ if (!_optionalChain([options, 'optionalAccess', _104 => _104.validator]) && !client.account) {
1598
1599
  throw new Error("Either provide validator address or initialize client with an account");
1599
1600
  }
1600
- const validatorAddress = _optionalChain([options, 'optionalAccess', _123 => _123.validator]) || client.account.address;
1601
+ const validatorAddress = _optionalChain([options, 'optionalAccess', _105 => _105.validator]) || client.account.address;
1601
1602
  const data = _viem.encodeFunctionData.call(void 0, {
1602
- abi: _chunkTCAQ6AVFcjs.STAKING_ABI,
1603
+ abi: _chunkCX76PQR5cjs.STAKING_ABI,
1603
1604
  functionName: "validatorClaim",
1604
1605
  args: [validatorAddress]
1605
1606
  });
@@ -1608,7 +1609,7 @@ var stakingActions = (client, publicClient) => {
1608
1609
  },
1609
1610
  validatorPrime: async (options) => {
1610
1611
  const data = _viem.encodeFunctionData.call(void 0, {
1611
- abi: _chunkTCAQ6AVFcjs.STAKING_ABI,
1612
+ abi: _chunkCX76PQR5cjs.STAKING_ABI,
1612
1613
  functionName: "validatorPrime",
1613
1614
  args: [options.validator]
1614
1615
  });
@@ -1616,7 +1617,7 @@ var stakingActions = (client, publicClient) => {
1616
1617
  },
1617
1618
  setOperator: async (options) => {
1618
1619
  const data = _viem.encodeFunctionData.call(void 0, {
1619
- abi: _chunkTCAQ6AVFcjs.VALIDATOR_WALLET_ABI,
1620
+ abi: _chunkCX76PQR5cjs.VALIDATOR_WALLET_ABI,
1620
1621
  functionName: "setOperator",
1621
1622
  args: [options.operator]
1622
1623
  });
@@ -1632,7 +1633,7 @@ var stakingActions = (client, publicClient) => {
1632
1633
  }
1633
1634
  }
1634
1635
  const data = _viem.encodeFunctionData.call(void 0, {
1635
- abi: _chunkTCAQ6AVFcjs.VALIDATOR_WALLET_ABI,
1636
+ abi: _chunkCX76PQR5cjs.VALIDATOR_WALLET_ABI,
1636
1637
  functionName: "setIdentity",
1637
1638
  args: [
1638
1639
  options.moniker,
@@ -1651,7 +1652,7 @@ var stakingActions = (client, publicClient) => {
1651
1652
  delegatorJoin: async (options) => {
1652
1653
  const amount = parseStakingAmount(options.amount);
1653
1654
  const data = _viem.encodeFunctionData.call(void 0, {
1654
- abi: _chunkTCAQ6AVFcjs.STAKING_ABI,
1655
+ abi: _chunkCX76PQR5cjs.STAKING_ABI,
1655
1656
  functionName: "delegatorJoin",
1656
1657
  args: [options.validator]
1657
1658
  });
@@ -1667,7 +1668,7 @@ var stakingActions = (client, publicClient) => {
1667
1668
  delegatorExit: async (options) => {
1668
1669
  const shares = typeof options.shares === "string" ? BigInt(options.shares) : options.shares;
1669
1670
  const data = _viem.encodeFunctionData.call(void 0, {
1670
- abi: _chunkTCAQ6AVFcjs.STAKING_ABI,
1671
+ abi: _chunkCX76PQR5cjs.STAKING_ABI,
1671
1672
  functionName: "delegatorExit",
1672
1673
  args: [options.validator, shares]
1673
1674
  });
@@ -1679,7 +1680,7 @@ var stakingActions = (client, publicClient) => {
1679
1680
  }
1680
1681
  const delegatorAddress = options.delegator || client.account.address;
1681
1682
  const data = _viem.encodeFunctionData.call(void 0, {
1682
- abi: _chunkTCAQ6AVFcjs.STAKING_ABI,
1683
+ abi: _chunkCX76PQR5cjs.STAKING_ABI,
1683
1684
  functionName: "delegatorClaim",
1684
1685
  args: [delegatorAddress, options.validator]
1685
1686
  });
@@ -1697,7 +1698,7 @@ var stakingActions = (client, publicClient) => {
1697
1698
  }
1698
1699
  const walletContract = _viem.getContract.call(void 0, {
1699
1700
  address: validator,
1700
- abi: _chunkTCAQ6AVFcjs.VALIDATOR_WALLET_ABI,
1701
+ abi: _chunkCX76PQR5cjs.VALIDATOR_WALLET_ABI,
1701
1702
  client: publicClient
1702
1703
  });
1703
1704
  const [view, owner, operator, identityRaw, currentEpoch] = await Promise.all([
@@ -1992,8 +1993,8 @@ var getCustomTransportConfig = (config, chainConfig) => {
1992
1993
  }
1993
1994
  };
1994
1995
  };
1995
- var createClient = (config = { chain: _chunkTCAQ6AVFcjs.localnet }) => {
1996
- const chainConfig = config.chain || _chunkTCAQ6AVFcjs.localnet;
1996
+ var createClient = (config = { chain: _chunkCX76PQR5cjs.localnet }) => {
1997
+ const chainConfig = config.chain || _chunkCX76PQR5cjs.localnet;
1997
1998
  if (config.endpoint) {
1998
1999
  chainConfig.rpcUrls.default.http = [config.endpoint];
1999
2000
  }
@@ -2130,4 +2131,4 @@ function validateValueAgainstType(value, type) {
2130
2131
 
2131
2132
 
2132
2133
 
2133
- exports.abi = abi_exports; exports.buildGenVmPositionalArgs = buildGenVmPositionalArgs; exports.chains = _chunkTCAQ6AVFcjs.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;
2134
+ exports.abi = abi_exports; exports.buildGenVmPositionalArgs = buildGenVmPositionalArgs; exports.chains = _chunkCX76PQR5cjs.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.js CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  studionet,
7
7
  testnetAsimov,
8
8
  testnetBradbury
9
- } from "./chunk-5KRGDGMO.js";
9
+ } from "./chunk-T3O6IXYQ.js";
10
10
  import {
11
11
  CalldataAddress,
12
12
  isDecidedState,
@@ -1006,19 +1006,20 @@ var decodeInputData = (rlpEncodedAppData, recipient) => {
1006
1006
  }
1007
1007
  };
1008
1008
  var decodeTransaction = (tx) => {
1009
- const txDataDecoded = decodeInputData(tx.txData, tx.recipient);
1009
+ const txData = tx.txData ?? tx.txCalldata;
1010
+ const numOfInitialValidators = tx.numOfInitialValidators ?? tx.initialRotations;
1011
+ const txDataDecoded = decodeInputData(txData, tx.recipient);
1010
1012
  const decodedTx = {
1011
1013
  ...tx,
1012
- txData: tx.txData,
1014
+ txData,
1013
1015
  txDataDecoded,
1014
- currentTimestamp: tx.currentTimestamp?.toString() ?? "0",
1015
- // Bradbury uses `initialRotations`; older chains use `numOfInitialValidators`
1016
- numOfInitialValidators: (tx.numOfInitialValidators ?? tx.initialRotations)?.toString() ?? "0",
1017
- txSlot: tx.txSlot?.toString() ?? "0",
1018
- createdTimestamp: tx.createdTimestamp?.toString() ?? "0",
1019
- lastVoteTimestamp: tx.lastVoteTimestamp?.toString() ?? "0",
1020
- queuePosition: tx.queuePosition?.toString() ?? "0",
1021
- numOfRounds: tx.numOfRounds?.toString() ?? "0",
1016
+ currentTimestamp: tx.currentTimestamp.toString(),
1017
+ numOfInitialValidators: numOfInitialValidators?.toString() ?? "0",
1018
+ txSlot: tx.txSlot.toString(),
1019
+ createdTimestamp: tx.createdTimestamp.toString(),
1020
+ lastVoteTimestamp: tx.lastVoteTimestamp.toString(),
1021
+ queuePosition: tx.queuePosition.toString(),
1022
+ numOfRounds: tx.numOfRounds.toString(),
1022
1023
  readStateBlockRange: {
1023
1024
  ...tx.readStateBlockRange,
1024
1025
  activationBlock: tx.readStateBlockRange?.activationBlock?.toString() ?? "0",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "genlayer-js",
3
3
  "type": "module",
4
- "version": "0.21.1",
4
+ "version": "0.21.2",
5
5
  "description": "GenLayer JavaScript SDK",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",