genlayer-js 0.23.0 → 0.24.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/README.md CHANGED
@@ -99,13 +99,59 @@ const transactionHash = await client.writeContract({
99
99
  value: 0, // value is optional, if you want to send some native token to the contract
100
100
  });
101
101
 
102
- const receipt = await client.waitForTransactionReceipt({
103
- hash: txHash,
102
+ const receipt = await client.waitForTransactionReceipt({
103
+ hash: txHash,
104
104
  status: TransactionStatus.FINALIZED, // or ACCEPTED
105
105
  fullTransaction: false // False by default - returns simplified receipt for better readability
106
106
  })
107
107
 
108
108
  ```
109
+
110
+ ### Checking execution results
111
+
112
+ A transaction can be finalized by consensus but still have a failed execution. Always check `txExecutionResult` before reading contract state:
113
+
114
+ ```typescript
115
+ import { ExecutionResult, TransactionStatus } from "genlayer-js/types";
116
+
117
+ const receipt = await client.waitForTransactionReceipt({
118
+ hash: txHash,
119
+ status: TransactionStatus.FINALIZED,
120
+ });
121
+
122
+ if (receipt.txExecutionResultName === ExecutionResult.FINISHED_WITH_RETURN) {
123
+ // Execution succeeded — safe to read state
124
+ const result = await client.readContract({
125
+ address: contractAddress,
126
+ functionName: "get_storage",
127
+ args: [],
128
+ });
129
+ } else if (receipt.txExecutionResultName === ExecutionResult.FINISHED_WITH_ERROR) {
130
+ // Execution failed — contract state was not modified
131
+ console.error("Contract execution failed");
132
+ } else {
133
+ // NOT_VOTED — execution hasn't completed
134
+ console.warn("Execution result not yet available");
135
+ }
136
+ ```
137
+
138
+ ### Fetching emitted messages and triggered transactions
139
+
140
+ Transactions can emit messages to other contracts. These messages create new child transactions when processed:
141
+
142
+ ```typescript
143
+ const tx = await client.getTransaction({ hash: txHash });
144
+
145
+ // Messages emitted by the contract during execution
146
+ console.log(tx.messages);
147
+ // [{messageType, recipient, value, data, onAcceptance, saltNonce}, ...]
148
+
149
+ // Child transaction IDs created from those messages (separate call)
150
+ const childTxIds = await client.getTriggeredTransactionIds({ hash: txHash });
151
+ console.log(childTxIds);
152
+ // ["0xabc...", "0xdef..."]
153
+ ```
154
+
109
155
  ### Staking Operations
110
156
 
111
157
  The SDK provides staking functionality for validators and delegators on testnet-bradbury (and testnet-asimov).
@@ -108,6 +108,17 @@ var TransactionResultNameToNumber = {
108
108
  ["MAJORITY_AGREE" /* MAJORITY_AGREE */]: "6",
109
109
  ["MAJORITY_DISAGREE" /* MAJORITY_DISAGREE */]: "7"
110
110
  };
111
+ var ExecutionResult = /* @__PURE__ */ ((ExecutionResult2) => {
112
+ ExecutionResult2["NOT_VOTED"] = "NOT_VOTED";
113
+ ExecutionResult2["FINISHED_WITH_RETURN"] = "FINISHED_WITH_RETURN";
114
+ ExecutionResult2["FINISHED_WITH_ERROR"] = "FINISHED_WITH_ERROR";
115
+ return ExecutionResult2;
116
+ })(ExecutionResult || {});
117
+ var executionResultNumberToName = {
118
+ "0": "NOT_VOTED" /* NOT_VOTED */,
119
+ "1": "FINISHED_WITH_RETURN" /* FINISHED_WITH_RETURN */,
120
+ "2": "FINISHED_WITH_ERROR" /* FINISHED_WITH_ERROR */
121
+ };
111
122
  var VoteType = /* @__PURE__ */ ((VoteType2) => {
112
123
  VoteType2["NOT_VOTED"] = "NOT_VOTED";
113
124
  VoteType2["AGREE"] = "AGREE";
@@ -146,6 +157,8 @@ export {
146
157
  isDecidedState,
147
158
  transactionResultNumberToName,
148
159
  TransactionResultNameToNumber,
160
+ ExecutionResult,
161
+ executionResultNumberToName,
149
162
  VoteType,
150
163
  voteTypeNumberToName,
151
164
  voteTypeNameToNumber,
@@ -108,6 +108,17 @@ var TransactionResultNameToNumber = {
108
108
  ["MAJORITY_AGREE" /* MAJORITY_AGREE */]: "6",
109
109
  ["MAJORITY_DISAGREE" /* MAJORITY_DISAGREE */]: "7"
110
110
  };
111
+ var ExecutionResult = /* @__PURE__ */ ((ExecutionResult2) => {
112
+ ExecutionResult2["NOT_VOTED"] = "NOT_VOTED";
113
+ ExecutionResult2["FINISHED_WITH_RETURN"] = "FINISHED_WITH_RETURN";
114
+ ExecutionResult2["FINISHED_WITH_ERROR"] = "FINISHED_WITH_ERROR";
115
+ return ExecutionResult2;
116
+ })(ExecutionResult || {});
117
+ var executionResultNumberToName = {
118
+ "0": "NOT_VOTED" /* NOT_VOTED */,
119
+ "1": "FINISHED_WITH_RETURN" /* FINISHED_WITH_RETURN */,
120
+ "2": "FINISHED_WITH_ERROR" /* FINISHED_WITH_ERROR */
121
+ };
111
122
  var VoteType = /* @__PURE__ */ ((VoteType2) => {
112
123
  VoteType2["NOT_VOTED"] = "NOT_VOTED";
113
124
  VoteType2["AGREE"] = "AGREE";
@@ -150,4 +161,6 @@ var TransactionHashVariant = /* @__PURE__ */ ((TransactionHashVariant2) => {
150
161
 
151
162
 
152
163
 
153
- exports.CalldataAddress = CalldataAddress; exports.TransactionStatus = TransactionStatus; exports.TransactionResult = TransactionResult; exports.transactionsStatusNumberToName = transactionsStatusNumberToName; exports.transactionsStatusNameToNumber = transactionsStatusNameToNumber; exports.DECIDED_STATES = DECIDED_STATES; exports.isDecidedState = isDecidedState; exports.transactionResultNumberToName = transactionResultNumberToName; exports.TransactionResultNameToNumber = TransactionResultNameToNumber; exports.VoteType = VoteType; exports.voteTypeNumberToName = voteTypeNumberToName; exports.voteTypeNameToNumber = voteTypeNameToNumber; exports.TransactionHashVariant = TransactionHashVariant;
164
+
165
+
166
+ exports.CalldataAddress = CalldataAddress; exports.TransactionStatus = TransactionStatus; exports.TransactionResult = TransactionResult; exports.transactionsStatusNumberToName = transactionsStatusNumberToName; exports.transactionsStatusNameToNumber = transactionsStatusNameToNumber; exports.DECIDED_STATES = DECIDED_STATES; exports.isDecidedState = isDecidedState; exports.transactionResultNumberToName = transactionResultNumberToName; exports.TransactionResultNameToNumber = TransactionResultNameToNumber; exports.ExecutionResult = ExecutionResult; exports.executionResultNumberToName = executionResultNumberToName; exports.VoteType = VoteType; exports.voteTypeNumberToName = voteTypeNumberToName; exports.voteTypeNameToNumber = voteTypeNameToNumber; exports.TransactionHashVariant = TransactionHashVariant;
@@ -102,6 +102,16 @@ declare const TransactionResultNameToNumber: {
102
102
  MAJORITY_AGREE: string;
103
103
  MAJORITY_DISAGREE: string;
104
104
  };
105
+ declare enum ExecutionResult {
106
+ NOT_VOTED = "NOT_VOTED",
107
+ FINISHED_WITH_RETURN = "FINISHED_WITH_RETURN",
108
+ FINISHED_WITH_ERROR = "FINISHED_WITH_ERROR"
109
+ }
110
+ declare const executionResultNumberToName: {
111
+ "0": ExecutionResult;
112
+ "1": ExecutionResult;
113
+ "2": ExecutionResult;
114
+ };
105
115
  declare enum VoteType {
106
116
  NOT_VOTED = "NOT_VOTED",
107
117
  AGREE = "AGREE",
@@ -167,6 +177,8 @@ type GenLayerTransaction = {
167
177
  randomSeed?: Hash;
168
178
  result?: number;
169
179
  resultName?: TransactionResult;
180
+ txExecutionResult?: number;
181
+ txExecutionResultName?: ExecutionResult;
170
182
  data?: Record<string, unknown>;
171
183
  txData?: Hex;
172
184
  txDataDecoded?: DecodedDeployData | DecodedCallData;
@@ -225,6 +237,7 @@ type GenLayerRawTransaction = {
225
237
  lastVoteTimestamp: bigint;
226
238
  randomSeed: Hash;
227
239
  result: number;
240
+ txExecutionResult?: number;
228
241
  txData: Hex | undefined | null;
229
242
  txReceipt: Hash;
230
243
  messages: unknown[];
@@ -2873,4 +2886,4 @@ type GenLayerClient<TGenLayerChain extends GenLayerChain> = Omit<Client<Transpor
2873
2886
  }) => Promise<bigint>;
2874
2887
  } & StakingActions;
2875
2888
 
2876
- export { type ValidatorPrimeOptions as $, type ValidatorView as A, type ValidatorIdentity as B, type CalldataEncodable as C, type DecodedDeployData as D, type ValidatorInfo as E, type PendingWithdrawal as F, type GenLayerClient as G, type Hash as H, type BannedValidatorInfo as I, type StakeInfo as J, type EpochData as K, type LeaderReceipt as L, type MethodDescription as M, type Network as N, type EpochInfo as O, type PendingDeposit as P, type StakingTransactionResult as Q, type ValidatorJoinResult as R, STAKING_ABI as S, type TransactionDataElement as T, type DelegatorJoinResult as U, VALIDATOR_WALLET_ABI as V, type WithdrawalCommit as W, type ValidatorJoinOptions as X, type ValidatorDepositOptions as Y, type ValidatorExitOptions as Z, type ValidatorClaimOptions as _, type DecodedCallData as a, type SetOperatorOptions as a0, type SetIdentityOptions as a1, type DelegatorJoinOptions as a2, type DelegatorExitOptions as a3, type DelegatorClaimOptions as a4, type StakingActions as a5, type GenLayerRawTransaction as b, type GenLayerTransaction as c, type ContractSchema as d, CalldataAddress as e, type GenLayerMethod as f, type ContractParamsArraySchemaElement as g, type ContractParamsSchema as h, type ContractMethodBase as i, type ContractMethod as j, type TransactionHash as k, TransactionStatus as l, TransactionResult as m, transactionsStatusNameToNumber as n, DECIDED_STATES as o, isDecidedState as p, transactionResultNumberToName as q, TransactionResultNameToNumber as r, VoteType as s, transactionsStatusNumberToName as t, voteTypeNameToNumber as u, voteTypeNumberToName as v, type TransactionType as w, TransactionHashVariant as x, type SnapSource as y, type StakingContract as z };
2889
+ export { type ValidatorExitOptions as $, type StakingContract as A, type ValidatorView as B, type CalldataEncodable as C, type DecodedDeployData as D, ExecutionResult as E, type ValidatorIdentity as F, type GenLayerClient as G, type Hash as H, type ValidatorInfo as I, type PendingWithdrawal as J, type BannedValidatorInfo as K, type LeaderReceipt as L, type MethodDescription as M, type Network as N, type StakeInfo as O, type PendingDeposit as P, type EpochData as Q, type EpochInfo as R, STAKING_ABI as S, type TransactionDataElement as T, type StakingTransactionResult as U, VALIDATOR_WALLET_ABI as V, type WithdrawalCommit as W, type ValidatorJoinResult as X, type DelegatorJoinResult as Y, type ValidatorJoinOptions as Z, type ValidatorDepositOptions as _, type DecodedCallData as a, type ValidatorClaimOptions as a0, type ValidatorPrimeOptions as a1, type SetOperatorOptions as a2, type SetIdentityOptions as a3, type DelegatorJoinOptions as a4, type DelegatorExitOptions as a5, type DelegatorClaimOptions as a6, type StakingActions as a7, type GenLayerRawTransaction as b, type GenLayerTransaction as c, type ContractSchema as d, CalldataAddress as e, type GenLayerMethod as f, type ContractParamsArraySchemaElement as g, type ContractParamsSchema as h, type ContractMethodBase as i, type ContractMethod as j, type TransactionHash as k, TransactionStatus as l, TransactionResult as m, transactionsStatusNameToNumber as n, DECIDED_STATES as o, isDecidedState as p, transactionResultNumberToName as q, TransactionResultNameToNumber as r, executionResultNumberToName as s, transactionsStatusNumberToName as t, VoteType as u, voteTypeNumberToName as v, voteTypeNameToNumber as w, type TransactionType as x, TransactionHashVariant as y, type SnapSource as z };
@@ -102,6 +102,16 @@ declare const TransactionResultNameToNumber: {
102
102
  MAJORITY_AGREE: string;
103
103
  MAJORITY_DISAGREE: string;
104
104
  };
105
+ declare enum ExecutionResult {
106
+ NOT_VOTED = "NOT_VOTED",
107
+ FINISHED_WITH_RETURN = "FINISHED_WITH_RETURN",
108
+ FINISHED_WITH_ERROR = "FINISHED_WITH_ERROR"
109
+ }
110
+ declare const executionResultNumberToName: {
111
+ "0": ExecutionResult;
112
+ "1": ExecutionResult;
113
+ "2": ExecutionResult;
114
+ };
105
115
  declare enum VoteType {
106
116
  NOT_VOTED = "NOT_VOTED",
107
117
  AGREE = "AGREE",
@@ -167,6 +177,8 @@ type GenLayerTransaction = {
167
177
  randomSeed?: Hash;
168
178
  result?: number;
169
179
  resultName?: TransactionResult;
180
+ txExecutionResult?: number;
181
+ txExecutionResultName?: ExecutionResult;
170
182
  data?: Record<string, unknown>;
171
183
  txData?: Hex;
172
184
  txDataDecoded?: DecodedDeployData | DecodedCallData;
@@ -225,6 +237,7 @@ type GenLayerRawTransaction = {
225
237
  lastVoteTimestamp: bigint;
226
238
  randomSeed: Hash;
227
239
  result: number;
240
+ txExecutionResult?: number;
228
241
  txData: Hex | undefined | null;
229
242
  txReceipt: Hash;
230
243
  messages: unknown[];
@@ -2873,4 +2886,4 @@ type GenLayerClient<TGenLayerChain extends GenLayerChain> = Omit<Client<Transpor
2873
2886
  }) => Promise<bigint>;
2874
2887
  } & StakingActions;
2875
2888
 
2876
- export { type ValidatorPrimeOptions as $, type ValidatorView as A, type ValidatorIdentity as B, type CalldataEncodable as C, type DecodedDeployData as D, type ValidatorInfo as E, type PendingWithdrawal as F, type GenLayerClient as G, type Hash as H, type BannedValidatorInfo as I, type StakeInfo as J, type EpochData as K, type LeaderReceipt as L, type MethodDescription as M, type Network as N, type EpochInfo as O, type PendingDeposit as P, type StakingTransactionResult as Q, type ValidatorJoinResult as R, STAKING_ABI as S, type TransactionDataElement as T, type DelegatorJoinResult as U, VALIDATOR_WALLET_ABI as V, type WithdrawalCommit as W, type ValidatorJoinOptions as X, type ValidatorDepositOptions as Y, type ValidatorExitOptions as Z, type ValidatorClaimOptions as _, type DecodedCallData as a, type SetOperatorOptions as a0, type SetIdentityOptions as a1, type DelegatorJoinOptions as a2, type DelegatorExitOptions as a3, type DelegatorClaimOptions as a4, type StakingActions as a5, type GenLayerRawTransaction as b, type GenLayerTransaction as c, type ContractSchema as d, CalldataAddress as e, type GenLayerMethod as f, type ContractParamsArraySchemaElement as g, type ContractParamsSchema as h, type ContractMethodBase as i, type ContractMethod as j, type TransactionHash as k, TransactionStatus as l, TransactionResult as m, transactionsStatusNameToNumber as n, DECIDED_STATES as o, isDecidedState as p, transactionResultNumberToName as q, TransactionResultNameToNumber as r, VoteType as s, transactionsStatusNumberToName as t, voteTypeNameToNumber as u, voteTypeNumberToName as v, type TransactionType as w, TransactionHashVariant as x, type SnapSource as y, type StakingContract as z };
2889
+ export { type ValidatorExitOptions as $, type StakingContract as A, type ValidatorView as B, type CalldataEncodable as C, type DecodedDeployData as D, ExecutionResult as E, type ValidatorIdentity as F, type GenLayerClient as G, type Hash as H, type ValidatorInfo as I, type PendingWithdrawal as J, type BannedValidatorInfo as K, type LeaderReceipt as L, type MethodDescription as M, type Network as N, type StakeInfo as O, type PendingDeposit as P, type EpochData as Q, type EpochInfo as R, STAKING_ABI as S, type TransactionDataElement as T, type StakingTransactionResult as U, VALIDATOR_WALLET_ABI as V, type WithdrawalCommit as W, type ValidatorJoinResult as X, type DelegatorJoinResult as Y, type ValidatorJoinOptions as Z, type ValidatorDepositOptions as _, type DecodedCallData as a, type ValidatorClaimOptions as a0, type ValidatorPrimeOptions as a1, type SetOperatorOptions as a2, type SetIdentityOptions as a3, type DelegatorJoinOptions as a4, type DelegatorExitOptions as a5, type DelegatorClaimOptions as a6, type StakingActions as a7, type GenLayerRawTransaction as b, type GenLayerTransaction as c, type ContractSchema as d, CalldataAddress as e, type GenLayerMethod as f, type ContractParamsArraySchemaElement as g, type ContractParamsSchema as h, type ContractMethodBase as i, type ContractMethod as j, type TransactionHash as k, TransactionStatus as l, TransactionResult as m, transactionsStatusNameToNumber as n, DECIDED_STATES as o, isDecidedState as p, transactionResultNumberToName as q, TransactionResultNameToNumber as r, executionResultNumberToName as s, transactionsStatusNumberToName as t, VoteType as u, voteTypeNumberToName as v, voteTypeNameToNumber as w, type TransactionType as x, TransactionHashVariant as y, type SnapSource as z };
package/dist/index.cjs CHANGED
@@ -14,7 +14,8 @@ var _chunkNOMVZBCRcjs = require('./chunk-NOMVZBCR.cjs');
14
14
 
15
15
 
16
16
 
17
- var _chunkW4V73RPNcjs = require('./chunk-W4V73RPN.cjs');
17
+
18
+ var _chunkGJXSECNHcjs = require('./chunk-GJXSECNH.cjs');
18
19
 
19
20
 
20
21
  var _chunk75ZPJI57cjs = require('./chunk-75ZPJI57.cjs');
@@ -187,7 +188,7 @@ function encodeImpl(to, data) {
187
188
  }
188
189
  } else if (data instanceof Map) {
189
190
  encodeMap(to, data);
190
- } else if (data instanceof _chunkW4V73RPNcjs.CalldataAddress) {
191
+ } else if (data instanceof _chunkGJXSECNHcjs.CalldataAddress) {
191
192
  to.push(SPECIAL_ADDR);
192
193
  for (const c of data.bytes) {
193
194
  to.push(c);
@@ -262,7 +263,7 @@ function decodeImpl(data, index) {
262
263
  case BigInt(SPECIAL_ADDR): {
263
264
  const res = data.slice(index.i, index.i + 20);
264
265
  index.i += 20;
265
- return new (0, _chunkW4V73RPNcjs.CalldataAddress)(res);
266
+ return new (0, _chunkGJXSECNHcjs.CalldataAddress)(res);
266
267
  }
267
268
  }
268
269
  const type = Number(cur & 0xffn) & (1 << BITS_IN_TYPE) - 1;
@@ -374,7 +375,7 @@ function toStringImpl(data, to) {
374
375
  to.push("]");
375
376
  } else if (data instanceof Map) {
376
377
  toStringImplMap(data.entries(), to);
377
- } else if (data instanceof _chunkW4V73RPNcjs.CalldataAddress) {
378
+ } else if (data instanceof _chunkGJXSECNHcjs.CalldataAddress) {
378
379
  to.push("addr#");
379
380
  for (const c of data.bytes) {
380
381
  to.push(c.toString(16));
@@ -499,7 +500,7 @@ function _toJsonSafeDeep(value, seen) {
499
500
  }
500
501
  return obj;
501
502
  }
502
- if (value instanceof _chunkW4V73RPNcjs.CalldataAddress) {
503
+ if (value instanceof _chunkGJXSECNHcjs.CalldataAddress) {
503
504
  return _viem.toHex.call(void 0, value.bytes);
504
505
  }
505
506
  if (Object.getPrototypeOf(value) === Object.prototype) {
@@ -950,10 +951,23 @@ var _sendTransaction = async ({
950
951
  chainId: `0x${client.chain.id.toString(16)}`,
951
952
  ...gasPriceHex ? { gasPrice: gasPriceHex } : {}
952
953
  };
953
- return await client.request({
954
+ const evmTxHash = await client.request({
954
955
  method: "eth_sendTransaction",
955
956
  params: [formattedRequest]
956
957
  });
958
+ const externalReceipt = await publicClient.waitForTransactionReceipt({ hash: evmTxHash });
959
+ if (externalReceipt.status === "reverted") {
960
+ throw new Error("Transaction reverted");
961
+ }
962
+ const externalNewTxEvents = _viem.parseEventLogs.call(void 0, {
963
+ abi: _optionalChain([client, 'access', _50 => _50.chain, 'access', _51 => _51.consensusMainContract, 'optionalAccess', _52 => _52.abi]),
964
+ eventName: "NewTransaction",
965
+ logs: externalReceipt.logs
966
+ });
967
+ if (externalNewTxEvents.length === 0) {
968
+ throw new Error("Transaction not processed by consensus");
969
+ }
970
+ return externalNewTxEvents[0].args["txId"];
957
971
  };
958
972
  try {
959
973
  return await sendWithEncodedData(encodedData);
@@ -1070,7 +1084,7 @@ var decodeTransaction = (tx) => {
1070
1084
  txData,
1071
1085
  txDataDecoded,
1072
1086
  currentTimestamp: tx.currentTimestamp.toString(),
1073
- numOfInitialValidators: _nullishCoalesce(_optionalChain([numOfInitialValidators, 'optionalAccess', _50 => _50.toString, 'call', _51 => _51()]), () => ( "0")),
1087
+ numOfInitialValidators: _nullishCoalesce(_optionalChain([numOfInitialValidators, 'optionalAccess', _53 => _53.toString, 'call', _54 => _54()]), () => ( "0")),
1074
1088
  txSlot: tx.txSlot.toString(),
1075
1089
  createdTimestamp: tx.createdTimestamp.toString(),
1076
1090
  lastVoteTimestamp: tx.lastVoteTimestamp.toString(),
@@ -1078,22 +1092,24 @@ var decodeTransaction = (tx) => {
1078
1092
  numOfRounds: tx.numOfRounds.toString(),
1079
1093
  readStateBlockRange: {
1080
1094
  ...tx.readStateBlockRange,
1081
- activationBlock: _nullishCoalesce(_optionalChain([tx, 'access', _52 => _52.readStateBlockRange, 'optionalAccess', _53 => _53.activationBlock, 'optionalAccess', _54 => _54.toString, 'call', _55 => _55()]), () => ( "0")),
1082
- processingBlock: _nullishCoalesce(_optionalChain([tx, 'access', _56 => _56.readStateBlockRange, 'optionalAccess', _57 => _57.processingBlock, 'optionalAccess', _58 => _58.toString, 'call', _59 => _59()]), () => ( "0")),
1083
- proposalBlock: _nullishCoalesce(_optionalChain([tx, 'access', _60 => _60.readStateBlockRange, 'optionalAccess', _61 => _61.proposalBlock, 'optionalAccess', _62 => _62.toString, 'call', _63 => _63()]), () => ( "0"))
1095
+ activationBlock: _nullishCoalesce(_optionalChain([tx, 'access', _55 => _55.readStateBlockRange, 'optionalAccess', _56 => _56.activationBlock, 'optionalAccess', _57 => _57.toString, 'call', _58 => _58()]), () => ( "0")),
1096
+ processingBlock: _nullishCoalesce(_optionalChain([tx, 'access', _59 => _59.readStateBlockRange, 'optionalAccess', _60 => _60.processingBlock, 'optionalAccess', _61 => _61.toString, 'call', _62 => _62()]), () => ( "0")),
1097
+ proposalBlock: _nullishCoalesce(_optionalChain([tx, 'access', _63 => _63.readStateBlockRange, 'optionalAccess', _64 => _64.proposalBlock, 'optionalAccess', _65 => _65.toString, 'call', _66 => _66()]), () => ( "0"))
1084
1098
  },
1085
- statusName: _chunkW4V73RPNcjs.transactionsStatusNumberToName[String(tx.status)],
1086
- resultName: _chunkW4V73RPNcjs.transactionResultNumberToName[String(tx.result)],
1099
+ statusName: _chunkGJXSECNHcjs.transactionsStatusNumberToName[String(tx.status)],
1100
+ resultName: _chunkGJXSECNHcjs.transactionResultNumberToName[String(tx.result)],
1101
+ txExecutionResult: tx.txExecutionResult !== void 0 ? Number(tx.txExecutionResult) : void 0,
1102
+ txExecutionResultName: tx.txExecutionResult !== void 0 ? _chunkGJXSECNHcjs.executionResultNumberToName[String(tx.txExecutionResult)] : void 0,
1087
1103
  lastRound: {
1088
1104
  ...tx.lastRound,
1089
- round: _nullishCoalesce(_optionalChain([tx, 'access', _64 => _64.lastRound, 'optionalAccess', _65 => _65.round, 'optionalAccess', _66 => _66.toString, 'call', _67 => _67()]), () => ( "0")),
1090
- leaderIndex: _nullishCoalesce(_optionalChain([tx, 'access', _68 => _68.lastRound, 'optionalAccess', _69 => _69.leaderIndex, 'optionalAccess', _70 => _70.toString, 'call', _71 => _71()]), () => ( "0")),
1091
- votesCommitted: _nullishCoalesce(_optionalChain([tx, 'access', _72 => _72.lastRound, 'optionalAccess', _73 => _73.votesCommitted, 'optionalAccess', _74 => _74.toString, 'call', _75 => _75()]), () => ( "0")),
1092
- votesRevealed: _nullishCoalesce(_optionalChain([tx, 'access', _76 => _76.lastRound, 'optionalAccess', _77 => _77.votesRevealed, 'optionalAccess', _78 => _78.toString, 'call', _79 => _79()]), () => ( "0")),
1093
- appealBond: _nullishCoalesce(_optionalChain([tx, 'access', _80 => _80.lastRound, 'optionalAccess', _81 => _81.appealBond, 'optionalAccess', _82 => _82.toString, 'call', _83 => _83()]), () => ( "0")),
1094
- rotationsLeft: _nullishCoalesce(_optionalChain([tx, 'access', _84 => _84.lastRound, 'optionalAccess', _85 => _85.rotationsLeft, 'optionalAccess', _86 => _86.toString, 'call', _87 => _87()]), () => ( "0")),
1095
- validatorVotesName: (_nullishCoalesce(_optionalChain([tx, 'access', _88 => _88.lastRound, 'optionalAccess', _89 => _89.validatorVotes]), () => ( []))).map(
1096
- (vote) => _chunkW4V73RPNcjs.voteTypeNumberToName[String(vote)]
1105
+ round: _nullishCoalesce(_optionalChain([tx, 'access', _67 => _67.lastRound, 'optionalAccess', _68 => _68.round, 'optionalAccess', _69 => _69.toString, 'call', _70 => _70()]), () => ( "0")),
1106
+ leaderIndex: _nullishCoalesce(_optionalChain([tx, 'access', _71 => _71.lastRound, 'optionalAccess', _72 => _72.leaderIndex, 'optionalAccess', _73 => _73.toString, 'call', _74 => _74()]), () => ( "0")),
1107
+ votesCommitted: _nullishCoalesce(_optionalChain([tx, 'access', _75 => _75.lastRound, 'optionalAccess', _76 => _76.votesCommitted, 'optionalAccess', _77 => _77.toString, 'call', _78 => _78()]), () => ( "0")),
1108
+ votesRevealed: _nullishCoalesce(_optionalChain([tx, 'access', _79 => _79.lastRound, 'optionalAccess', _80 => _80.votesRevealed, 'optionalAccess', _81 => _81.toString, 'call', _82 => _82()]), () => ( "0")),
1109
+ appealBond: _nullishCoalesce(_optionalChain([tx, 'access', _83 => _83.lastRound, 'optionalAccess', _84 => _84.appealBond, 'optionalAccess', _85 => _85.toString, 'call', _86 => _86()]), () => ( "0")),
1110
+ rotationsLeft: _nullishCoalesce(_optionalChain([tx, 'access', _87 => _87.lastRound, 'optionalAccess', _88 => _88.rotationsLeft, 'optionalAccess', _89 => _89.toString, 'call', _90 => _90()]), () => ( "0")),
1111
+ validatorVotesName: (_nullishCoalesce(_optionalChain([tx, 'access', _91 => _91.lastRound, 'optionalAccess', _92 => _92.validatorVotes]), () => ( []))).map(
1112
+ (vote) => _chunkGJXSECNHcjs.voteTypeNumberToName[String(vote)]
1097
1113
  )
1098
1114
  }
1099
1115
  };
@@ -1174,7 +1190,7 @@ var simplifyTransactionReceipt = (tx) => {
1174
1190
  var decodeLocalnetTransaction = (tx) => {
1175
1191
  if (!tx.data) return tx;
1176
1192
  try {
1177
- const leaderReceipt = _optionalChain([tx, 'access', _90 => _90.consensus_data, 'optionalAccess', _91 => _91.leader_receipt]);
1193
+ const leaderReceipt = _optionalChain([tx, 'access', _93 => _93.consensus_data, 'optionalAccess', _94 => _94.leader_receipt]);
1178
1194
  if (leaderReceipt) {
1179
1195
  const receipts = Array.isArray(leaderReceipt) ? leaderReceipt : [leaderReceipt];
1180
1196
  receipts.forEach((receipt) => {
@@ -1205,7 +1221,7 @@ var decodeLocalnetTransaction = (tx) => {
1205
1221
  }
1206
1222
  });
1207
1223
  }
1208
- if (_optionalChain([tx, 'access', _92 => _92.data, 'optionalAccess', _93 => _93.calldata]) && typeof tx.data.calldata === "string") {
1224
+ if (_optionalChain([tx, 'access', _95 => _95.data, 'optionalAccess', _96 => _96.calldata]) && typeof tx.data.calldata === "string") {
1209
1225
  tx.data.calldata = {
1210
1226
  base64: tx.data.calldata,
1211
1227
  ...calldataToUserFriendlyJson(b64ToArray(tx.data.calldata))
@@ -1233,8 +1249,8 @@ var receiptActions = (client, publicClient) => ({
1233
1249
  throw new Error("Transaction not found");
1234
1250
  }
1235
1251
  const transactionStatusString = String(transaction.status);
1236
- const requestedStatus = _chunkW4V73RPNcjs.transactionsStatusNameToNumber[status];
1237
- if (transactionStatusString === requestedStatus || status === "ACCEPTED" /* ACCEPTED */ && _chunkW4V73RPNcjs.isDecidedState.call(void 0, transactionStatusString)) {
1252
+ const requestedStatus = _chunkGJXSECNHcjs.transactionsStatusNameToNumber[status];
1253
+ if (transactionStatusString === requestedStatus || status === "ACCEPTED" /* ACCEPTED */ && _chunkGJXSECNHcjs.isDecidedState.call(void 0, transactionStatusString)) {
1238
1254
  let finalTransaction = transaction;
1239
1255
  if (client.chain.id === _chunkNOMVZBCRcjs.localnet.id) {
1240
1256
  finalTransaction = decodeLocalnetTransaction(transaction);
@@ -1262,22 +1278,56 @@ var transactionActions = (client, publicClient) => ({
1262
1278
  if (client.chain.isStudio) {
1263
1279
  const transaction2 = await client.getTransaction({ hash });
1264
1280
  const localnetStatus = transaction2.status === "ACTIVATED" ? "PENDING" /* PENDING */ : transaction2.status;
1265
- transaction2.status = Number(_chunkW4V73RPNcjs.transactionsStatusNameToNumber[localnetStatus]);
1281
+ transaction2.status = Number(_chunkGJXSECNHcjs.transactionsStatusNameToNumber[localnetStatus]);
1266
1282
  transaction2.statusName = localnetStatus;
1267
1283
  return decodeLocalnetTransaction(transaction2);
1268
1284
  }
1269
- const transaction = await publicClient.readContract({
1270
- address: _optionalChain([client, 'access', _94 => _94.chain, 'access', _95 => _95.consensusDataContract, 'optionalAccess', _96 => _96.address]),
1271
- abi: _optionalChain([client, 'access', _97 => _97.chain, 'access', _98 => _98.consensusDataContract, 'optionalAccess', _99 => _99.abi]),
1272
- functionName: "getTransactionData",
1273
- args: [
1274
- hash,
1275
- Math.round((/* @__PURE__ */ new Date()).getTime() / 1e3)
1276
- // unix seconds
1277
- ]
1278
- });
1285
+ const contractAddress = _optionalChain([client, 'access', _97 => _97.chain, 'access', _98 => _98.consensusDataContract, 'optionalAccess', _99 => _99.address]);
1286
+ const contractAbi = _optionalChain([client, 'access', _100 => _100.chain, 'access', _101 => _101.consensusDataContract, 'optionalAccess', _102 => _102.abi]);
1287
+ const [txDataRaw, allDataRaw] = await Promise.all([
1288
+ publicClient.readContract({
1289
+ address: contractAddress,
1290
+ abi: contractAbi,
1291
+ functionName: "getTransactionData",
1292
+ args: [hash, Math.round((/* @__PURE__ */ new Date()).getTime() / 1e3)]
1293
+ }),
1294
+ publicClient.readContract({
1295
+ address: contractAddress,
1296
+ abi: contractAbi,
1297
+ functionName: "getTransactionAllData",
1298
+ args: [hash]
1299
+ })
1300
+ ]);
1301
+ const txData = txDataRaw;
1302
+ const [txAllData, roundsData] = allDataRaw;
1303
+ const transaction = {
1304
+ ...txData,
1305
+ txExecutionResult: Number(txAllData.txExecutionResult)
1306
+ };
1279
1307
  return decodeTransaction(transaction);
1280
1308
  },
1309
+ getTriggeredTransactionIds: async ({ hash }) => {
1310
+ if (client.chain.isStudio) {
1311
+ const tx2 = await client.getTransaction({ hash });
1312
+ return _nullishCoalesce(tx2.triggered_transactions, () => ( []));
1313
+ }
1314
+ const tx = await transactionActions(client, publicClient).getTransaction({ hash });
1315
+ const proposalBlock = BigInt(_nullishCoalesce(_optionalChain([tx, 'access', _103 => _103.readStateBlockRange, 'optionalAccess', _104 => _104.proposalBlock]), () => ( "0")));
1316
+ if (proposalBlock === BigInt(0)) return [];
1317
+ const scanRange = BigInt(100);
1318
+ const latestBlock = await publicClient.getBlockNumber();
1319
+ const toBlock = proposalBlock + scanRange < latestBlock ? proposalBlock + scanRange : latestBlock;
1320
+ const consensusAddress = _optionalChain([client, 'access', _105 => _105.chain, 'access', _106 => _106.consensusMainContract, 'optionalAccess', _107 => _107.address]);
1321
+ const internalMessageProcessedTopic = _viem.keccak256.call(void 0, _viem.stringToBytes.call(void 0, "InternalMessageProcessed(bytes32,address,address)"));
1322
+ const logs = await publicClient.getLogs({
1323
+ address: consensusAddress,
1324
+ event: void 0,
1325
+ fromBlock: proposalBlock,
1326
+ toBlock,
1327
+ topics: [internalMessageProcessedTopic, hash]
1328
+ });
1329
+ return logs.map((log) => log.topics[1]).filter(Boolean);
1330
+ },
1281
1331
  cancelTransaction: async ({ hash }) => {
1282
1332
  if (!client.chain.isStudio) {
1283
1333
  throw new Error("cancelTransaction is only available on studio-based chains (localnet/studionet)");
@@ -1307,7 +1357,7 @@ var transactionActions = (client, publicClient) => ({
1307
1357
  },
1308
1358
  estimateTransactionGas: async (transactionParams) => {
1309
1359
  const formattedParams = {
1310
- from: transactionParams.from || _optionalChain([client, 'access', _100 => _100.account, 'optionalAccess', _101 => _101.address]),
1360
+ from: transactionParams.from || _optionalChain([client, 'access', _108 => _108.account, 'optionalAccess', _109 => _109.address]),
1311
1361
  to: transactionParams.to,
1312
1362
  data: transactionParams.data || "0x",
1313
1363
  value: transactionParams.value ? `0x${transactionParams.value.toString(16)}` : "0x0"
@@ -1350,7 +1400,7 @@ var connect = async (client, network = "studionet", snapSource = "npm") => {
1350
1400
  chainName: selectedNetwork.name,
1351
1401
  rpcUrls: selectedNetwork.rpcUrls.default.http,
1352
1402
  nativeCurrency: selectedNetwork.nativeCurrency,
1353
- blockExplorerUrls: [_optionalChain([selectedNetwork, 'access', _102 => _102.blockExplorers, 'optionalAccess', _103 => _103.default, 'access', _104 => _104.url])]
1403
+ blockExplorerUrls: [_optionalChain([selectedNetwork, 'access', _110 => _110.blockExplorers, 'optionalAccess', _111 => _111.default, 'access', _112 => _112.url])]
1354
1404
  };
1355
1405
  const currentChainId = await window.ethereum.request({ method: "eth_chainId" });
1356
1406
  if (currentChainId !== chainIdHex) {
@@ -1384,10 +1434,10 @@ var metamaskClient = async (snapSource = "npm") => {
1384
1434
  }
1385
1435
  const isFlask = async () => {
1386
1436
  try {
1387
- const clientVersion = await _optionalChain([window, 'access', _105 => _105.ethereum, 'optionalAccess', _106 => _106.request, 'call', _107 => _107({
1437
+ const clientVersion = await _optionalChain([window, 'access', _113 => _113.ethereum, 'optionalAccess', _114 => _114.request, 'call', _115 => _115({
1388
1438
  method: "web3_clientVersion"
1389
1439
  })]);
1390
- return _optionalChain([clientVersion, 'optionalAccess', _108 => _108.includes, 'call', _109 => _109("flask")]);
1440
+ return _optionalChain([clientVersion, 'optionalAccess', _116 => _116.includes, 'call', _117 => _117("flask")]);
1391
1441
  } catch (error) {
1392
1442
  console.error("Error detecting Flask:", error);
1393
1443
  return false;
@@ -1395,7 +1445,7 @@ var metamaskClient = async (snapSource = "npm") => {
1395
1445
  };
1396
1446
  const installedSnaps = async () => {
1397
1447
  try {
1398
- return await _optionalChain([window, 'access', _110 => _110.ethereum, 'optionalAccess', _111 => _111.request, 'call', _112 => _112({
1448
+ return await _optionalChain([window, 'access', _118 => _118.ethereum, 'optionalAccess', _119 => _119.request, 'call', _120 => _120({
1399
1449
  method: "wallet_getSnaps"
1400
1450
  })]);
1401
1451
  } catch (error) {
@@ -1482,7 +1532,7 @@ function extractRevertReason(err) {
1482
1532
  }
1483
1533
  const revertError = err.walk((e) => e instanceof _viem.ContractFunctionRevertedError);
1484
1534
  if (revertError instanceof _viem.ContractFunctionRevertedError) {
1485
- if (_optionalChain([revertError, 'access', _113 => _113.data, 'optionalAccess', _114 => _114.errorName])) {
1535
+ if (_optionalChain([revertError, 'access', _121 => _121.data, 'optionalAccess', _122 => _122.errorName])) {
1486
1536
  return revertError.data.errorName;
1487
1537
  }
1488
1538
  return revertError.reason || "Unknown reason";
@@ -1570,7 +1620,7 @@ var stakingActions = (client, publicClient) => {
1570
1620
  };
1571
1621
  const getStakingAddress = () => {
1572
1622
  const stakingConfig = client.chain.stakingContract;
1573
- if (!_optionalChain([stakingConfig, 'optionalAccess', _115 => _115.address]) || stakingConfig.address === "0x0000000000000000000000000000000000000000") {
1623
+ if (!_optionalChain([stakingConfig, 'optionalAccess', _123 => _123.address]) || stakingConfig.address === "0x0000000000000000000000000000000000000000") {
1574
1624
  throw new Error("Staking is not supported on studio-based networks. Use testnet-asimov for staking operations.");
1575
1625
  }
1576
1626
  return stakingConfig.address;
@@ -1651,10 +1701,10 @@ var stakingActions = (client, publicClient) => {
1651
1701
  return executeWrite({ to: getStakingAddress(), data });
1652
1702
  },
1653
1703
  validatorClaim: async (options) => {
1654
- if (!_optionalChain([options, 'optionalAccess', _116 => _116.validator]) && !client.account) {
1704
+ if (!_optionalChain([options, 'optionalAccess', _124 => _124.validator]) && !client.account) {
1655
1705
  throw new Error("Either provide validator address or initialize client with an account");
1656
1706
  }
1657
- const validatorAddress = _optionalChain([options, 'optionalAccess', _117 => _117.validator]) || client.account.address;
1707
+ const validatorAddress = _optionalChain([options, 'optionalAccess', _125 => _125.validator]) || client.account.address;
1658
1708
  const data = _viem.encodeFunctionData.call(void 0, {
1659
1709
  abi: _chunkNOMVZBCRcjs.STAKING_ABI,
1660
1710
  functionName: "validatorClaim",
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-DqSbucSW.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, d as ContractSchema } from './index-DOok9G7O.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, d as ContractSchema } from './index-BJI82mwC.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-DqSbucSW.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, d as ContractSchema } from './index-DbrlrnTQ.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, d as ContractSchema } from './index-DEWwFm0_.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
@@ -9,12 +9,13 @@ import {
9
9
  } from "./chunk-C4Z24PT6.js";
10
10
  import {
11
11
  CalldataAddress,
12
+ executionResultNumberToName,
12
13
  isDecidedState,
13
14
  transactionResultNumberToName,
14
15
  transactionsStatusNameToNumber,
15
16
  transactionsStatusNumberToName,
16
17
  voteTypeNumberToName
17
- } from "./chunk-ZHBOSLFN.js";
18
+ } from "./chunk-EY35NPSE.js";
18
19
  import {
19
20
  __export
20
21
  } from "./chunk-MLKGABMK.js";
@@ -950,10 +951,23 @@ var _sendTransaction = async ({
950
951
  chainId: `0x${client.chain.id.toString(16)}`,
951
952
  ...gasPriceHex ? { gasPrice: gasPriceHex } : {}
952
953
  };
953
- return await client.request({
954
+ const evmTxHash = await client.request({
954
955
  method: "eth_sendTransaction",
955
956
  params: [formattedRequest]
956
957
  });
958
+ const externalReceipt = await publicClient.waitForTransactionReceipt({ hash: evmTxHash });
959
+ if (externalReceipt.status === "reverted") {
960
+ throw new Error("Transaction reverted");
961
+ }
962
+ const externalNewTxEvents = parseEventLogs({
963
+ abi: client.chain.consensusMainContract?.abi,
964
+ eventName: "NewTransaction",
965
+ logs: externalReceipt.logs
966
+ });
967
+ if (externalNewTxEvents.length === 0) {
968
+ throw new Error("Transaction not processed by consensus");
969
+ }
970
+ return externalNewTxEvents[0].args["txId"];
957
971
  };
958
972
  try {
959
973
  return await sendWithEncodedData(encodedData);
@@ -1084,6 +1098,8 @@ var decodeTransaction = (tx) => {
1084
1098
  },
1085
1099
  statusName: transactionsStatusNumberToName[String(tx.status)],
1086
1100
  resultName: transactionResultNumberToName[String(tx.result)],
1101
+ txExecutionResult: tx.txExecutionResult !== void 0 ? Number(tx.txExecutionResult) : void 0,
1102
+ txExecutionResultName: tx.txExecutionResult !== void 0 ? executionResultNumberToName[String(tx.txExecutionResult)] : void 0,
1087
1103
  lastRound: {
1088
1104
  ...tx.lastRound,
1089
1105
  round: tx.lastRound?.round?.toString() ?? "0",
@@ -1266,18 +1282,52 @@ var transactionActions = (client, publicClient) => ({
1266
1282
  transaction2.statusName = localnetStatus;
1267
1283
  return decodeLocalnetTransaction(transaction2);
1268
1284
  }
1269
- const transaction = await publicClient.readContract({
1270
- address: client.chain.consensusDataContract?.address,
1271
- abi: client.chain.consensusDataContract?.abi,
1272
- functionName: "getTransactionData",
1273
- args: [
1274
- hash,
1275
- Math.round((/* @__PURE__ */ new Date()).getTime() / 1e3)
1276
- // unix seconds
1277
- ]
1278
- });
1285
+ const contractAddress = client.chain.consensusDataContract?.address;
1286
+ const contractAbi = client.chain.consensusDataContract?.abi;
1287
+ const [txDataRaw, allDataRaw] = await Promise.all([
1288
+ publicClient.readContract({
1289
+ address: contractAddress,
1290
+ abi: contractAbi,
1291
+ functionName: "getTransactionData",
1292
+ args: [hash, Math.round((/* @__PURE__ */ new Date()).getTime() / 1e3)]
1293
+ }),
1294
+ publicClient.readContract({
1295
+ address: contractAddress,
1296
+ abi: contractAbi,
1297
+ functionName: "getTransactionAllData",
1298
+ args: [hash]
1299
+ })
1300
+ ]);
1301
+ const txData = txDataRaw;
1302
+ const [txAllData, roundsData] = allDataRaw;
1303
+ const transaction = {
1304
+ ...txData,
1305
+ txExecutionResult: Number(txAllData.txExecutionResult)
1306
+ };
1279
1307
  return decodeTransaction(transaction);
1280
1308
  },
1309
+ getTriggeredTransactionIds: async ({ hash }) => {
1310
+ if (client.chain.isStudio) {
1311
+ const tx2 = await client.getTransaction({ hash });
1312
+ return tx2.triggered_transactions ?? [];
1313
+ }
1314
+ const tx = await transactionActions(client, publicClient).getTransaction({ hash });
1315
+ const proposalBlock = BigInt(tx.readStateBlockRange?.proposalBlock ?? "0");
1316
+ if (proposalBlock === BigInt(0)) return [];
1317
+ const scanRange = BigInt(100);
1318
+ const latestBlock = await publicClient.getBlockNumber();
1319
+ const toBlock = proposalBlock + scanRange < latestBlock ? proposalBlock + scanRange : latestBlock;
1320
+ const consensusAddress = client.chain.consensusMainContract?.address;
1321
+ const internalMessageProcessedTopic = keccak256(stringToBytes("InternalMessageProcessed(bytes32,address,address)"));
1322
+ const logs = await publicClient.getLogs({
1323
+ address: consensusAddress,
1324
+ event: void 0,
1325
+ fromBlock: proposalBlock,
1326
+ toBlock,
1327
+ topics: [internalMessageProcessedTopic, hash]
1328
+ });
1329
+ return logs.map((log) => log.topics[1]).filter(Boolean);
1330
+ },
1281
1331
  cancelTransaction: async ({ hash }) => {
1282
1332
  if (!client.chain.isStudio) {
1283
1333
  throw new Error("cancelTransaction is only available on studio-based chains (localnet/studionet)");
@@ -12,7 +12,9 @@
12
12
 
13
13
 
14
14
 
15
- var _chunkW4V73RPNcjs = require('../chunk-W4V73RPN.cjs');
15
+
16
+
17
+ var _chunkGJXSECNHcjs = require('../chunk-GJXSECNH.cjs');
16
18
  require('../chunk-75ZPJI57.cjs');
17
19
 
18
20
 
@@ -28,4 +30,6 @@ require('../chunk-75ZPJI57.cjs');
28
30
 
29
31
 
30
32
 
31
- exports.CalldataAddress = _chunkW4V73RPNcjs.CalldataAddress; exports.DECIDED_STATES = _chunkW4V73RPNcjs.DECIDED_STATES; exports.TransactionHashVariant = _chunkW4V73RPNcjs.TransactionHashVariant; exports.TransactionResult = _chunkW4V73RPNcjs.TransactionResult; exports.TransactionResultNameToNumber = _chunkW4V73RPNcjs.TransactionResultNameToNumber; exports.TransactionStatus = _chunkW4V73RPNcjs.TransactionStatus; exports.VoteType = _chunkW4V73RPNcjs.VoteType; exports.isDecidedState = _chunkW4V73RPNcjs.isDecidedState; exports.transactionResultNumberToName = _chunkW4V73RPNcjs.transactionResultNumberToName; exports.transactionsStatusNameToNumber = _chunkW4V73RPNcjs.transactionsStatusNameToNumber; exports.transactionsStatusNumberToName = _chunkW4V73RPNcjs.transactionsStatusNumberToName; exports.voteTypeNameToNumber = _chunkW4V73RPNcjs.voteTypeNameToNumber; exports.voteTypeNumberToName = _chunkW4V73RPNcjs.voteTypeNumberToName;
33
+
34
+
35
+ exports.CalldataAddress = _chunkGJXSECNHcjs.CalldataAddress; exports.DECIDED_STATES = _chunkGJXSECNHcjs.DECIDED_STATES; exports.ExecutionResult = _chunkGJXSECNHcjs.ExecutionResult; exports.TransactionHashVariant = _chunkGJXSECNHcjs.TransactionHashVariant; exports.TransactionResult = _chunkGJXSECNHcjs.TransactionResult; exports.TransactionResultNameToNumber = _chunkGJXSECNHcjs.TransactionResultNameToNumber; exports.TransactionStatus = _chunkGJXSECNHcjs.TransactionStatus; exports.VoteType = _chunkGJXSECNHcjs.VoteType; exports.executionResultNumberToName = _chunkGJXSECNHcjs.executionResultNumberToName; exports.isDecidedState = _chunkGJXSECNHcjs.isDecidedState; exports.transactionResultNumberToName = _chunkGJXSECNHcjs.transactionResultNumberToName; exports.transactionsStatusNameToNumber = _chunkGJXSECNHcjs.transactionsStatusNameToNumber; exports.transactionsStatusNumberToName = _chunkGJXSECNHcjs.transactionsStatusNumberToName; exports.voteTypeNameToNumber = _chunkGJXSECNHcjs.voteTypeNameToNumber; exports.voteTypeNumberToName = _chunkGJXSECNHcjs.voteTypeNumberToName;
@@ -1,3 +1,3 @@
1
1
  export { Account, Address } from 'viem';
2
- export { I as BannedValidatorInfo, e as CalldataAddress, C as CalldataEncodable, j as ContractMethod, i as ContractMethodBase, g as ContractParamsArraySchemaElement, h as ContractParamsSchema, d as ContractSchema, o as DECIDED_STATES, a as DecodedCallData, D as DecodedDeployData, a4 as DelegatorClaimOptions, a3 as DelegatorExitOptions, a2 as DelegatorJoinOptions, U as DelegatorJoinResult, K as EpochData, O as EpochInfo, G as GenLayerClient, f as GenLayerMethod, b as GenLayerRawTransaction, c as GenLayerTransaction, H as Hash, L as LeaderReceipt, M as MethodDescription, N as Network, P as PendingDeposit, F as PendingWithdrawal, a1 as SetIdentityOptions, a0 as SetOperatorOptions, y as SnapSource, J as StakeInfo, a5 as StakingActions, z as StakingContract, Q as StakingTransactionResult, k as TransactionHash, x as TransactionHashVariant, m as TransactionResult, r as TransactionResultNameToNumber, l as TransactionStatus, w as TransactionType, _ as ValidatorClaimOptions, Y as ValidatorDepositOptions, Z as ValidatorExitOptions, B as ValidatorIdentity, E as ValidatorInfo, X as ValidatorJoinOptions, R 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-DOok9G7O.cjs';
2
+ export { K as BannedValidatorInfo, e as CalldataAddress, C as CalldataEncodable, j as ContractMethod, i as ContractMethodBase, g as ContractParamsArraySchemaElement, h as ContractParamsSchema, d as ContractSchema, o as DECIDED_STATES, a as DecodedCallData, D as DecodedDeployData, a6 as DelegatorClaimOptions, a5 as DelegatorExitOptions, a4 as DelegatorJoinOptions, Y as DelegatorJoinResult, Q as EpochData, R as EpochInfo, E as ExecutionResult, G as GenLayerClient, f as GenLayerMethod, b as GenLayerRawTransaction, c as GenLayerTransaction, H as Hash, L as LeaderReceipt, M as MethodDescription, N as Network, P as PendingDeposit, J as PendingWithdrawal, a3 as SetIdentityOptions, a2 as SetOperatorOptions, z as SnapSource, O as StakeInfo, a7 as StakingActions, A as StakingContract, U as StakingTransactionResult, k as TransactionHash, y as TransactionHashVariant, m as TransactionResult, r as TransactionResultNameToNumber, l as TransactionStatus, x as TransactionType, a0 as ValidatorClaimOptions, _ as ValidatorDepositOptions, $ as ValidatorExitOptions, F as ValidatorIdentity, I as ValidatorInfo, Z as ValidatorJoinOptions, X as ValidatorJoinResult, a1 as ValidatorPrimeOptions, B as ValidatorView, u as VoteType, W as WithdrawalCommit, s as executionResultNumberToName, p as isDecidedState, q as transactionResultNumberToName, n as transactionsStatusNameToNumber, t as transactionsStatusNumberToName, w as voteTypeNameToNumber, v as voteTypeNumberToName } from '../index-BJI82mwC.cjs';
3
3
  export { G as GenLayerChain } from '../chains-DqSbucSW.cjs';
@@ -1,3 +1,3 @@
1
1
  export { Account, Address } from 'viem';
2
- export { I as BannedValidatorInfo, e as CalldataAddress, C as CalldataEncodable, j as ContractMethod, i as ContractMethodBase, g as ContractParamsArraySchemaElement, h as ContractParamsSchema, d as ContractSchema, o as DECIDED_STATES, a as DecodedCallData, D as DecodedDeployData, a4 as DelegatorClaimOptions, a3 as DelegatorExitOptions, a2 as DelegatorJoinOptions, U as DelegatorJoinResult, K as EpochData, O as EpochInfo, G as GenLayerClient, f as GenLayerMethod, b as GenLayerRawTransaction, c as GenLayerTransaction, H as Hash, L as LeaderReceipt, M as MethodDescription, N as Network, P as PendingDeposit, F as PendingWithdrawal, a1 as SetIdentityOptions, a0 as SetOperatorOptions, y as SnapSource, J as StakeInfo, a5 as StakingActions, z as StakingContract, Q as StakingTransactionResult, k as TransactionHash, x as TransactionHashVariant, m as TransactionResult, r as TransactionResultNameToNumber, l as TransactionStatus, w as TransactionType, _ as ValidatorClaimOptions, Y as ValidatorDepositOptions, Z as ValidatorExitOptions, B as ValidatorIdentity, E as ValidatorInfo, X as ValidatorJoinOptions, R 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-DbrlrnTQ.js';
2
+ export { K as BannedValidatorInfo, e as CalldataAddress, C as CalldataEncodable, j as ContractMethod, i as ContractMethodBase, g as ContractParamsArraySchemaElement, h as ContractParamsSchema, d as ContractSchema, o as DECIDED_STATES, a as DecodedCallData, D as DecodedDeployData, a6 as DelegatorClaimOptions, a5 as DelegatorExitOptions, a4 as DelegatorJoinOptions, Y as DelegatorJoinResult, Q as EpochData, R as EpochInfo, E as ExecutionResult, G as GenLayerClient, f as GenLayerMethod, b as GenLayerRawTransaction, c as GenLayerTransaction, H as Hash, L as LeaderReceipt, M as MethodDescription, N as Network, P as PendingDeposit, J as PendingWithdrawal, a3 as SetIdentityOptions, a2 as SetOperatorOptions, z as SnapSource, O as StakeInfo, a7 as StakingActions, A as StakingContract, U as StakingTransactionResult, k as TransactionHash, y as TransactionHashVariant, m as TransactionResult, r as TransactionResultNameToNumber, l as TransactionStatus, x as TransactionType, a0 as ValidatorClaimOptions, _ as ValidatorDepositOptions, $ as ValidatorExitOptions, F as ValidatorIdentity, I as ValidatorInfo, Z as ValidatorJoinOptions, X as ValidatorJoinResult, a1 as ValidatorPrimeOptions, B as ValidatorView, u as VoteType, W as WithdrawalCommit, s as executionResultNumberToName, p as isDecidedState, q as transactionResultNumberToName, n as transactionsStatusNameToNumber, t as transactionsStatusNumberToName, w as voteTypeNameToNumber, v as voteTypeNumberToName } from '../index-DEWwFm0_.js';
3
3
  export { G as GenLayerChain } from '../chains-DqSbucSW.js';
@@ -1,27 +1,31 @@
1
1
  import {
2
2
  CalldataAddress,
3
3
  DECIDED_STATES,
4
+ ExecutionResult,
4
5
  TransactionHashVariant,
5
6
  TransactionResult,
6
7
  TransactionResultNameToNumber,
7
8
  TransactionStatus,
8
9
  VoteType,
10
+ executionResultNumberToName,
9
11
  isDecidedState,
10
12
  transactionResultNumberToName,
11
13
  transactionsStatusNameToNumber,
12
14
  transactionsStatusNumberToName,
13
15
  voteTypeNameToNumber,
14
16
  voteTypeNumberToName
15
- } from "../chunk-ZHBOSLFN.js";
17
+ } from "../chunk-EY35NPSE.js";
16
18
  import "../chunk-MLKGABMK.js";
17
19
  export {
18
20
  CalldataAddress,
19
21
  DECIDED_STATES,
22
+ ExecutionResult,
20
23
  TransactionHashVariant,
21
24
  TransactionResult,
22
25
  TransactionResultNameToNumber,
23
26
  TransactionStatus,
24
27
  VoteType,
28
+ executionResultNumberToName,
25
29
  isDecidedState,
26
30
  transactionResultNumberToName,
27
31
  transactionsStatusNameToNumber,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "genlayer-js",
3
3
  "type": "module",
4
- "version": "0.23.0",
4
+ "version": "0.24.0",
5
5
  "description": "GenLayer JavaScript SDK",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",