genlayer-js 0.11.0 → 0.11.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.
@@ -188,23 +188,25 @@ const _decodeLocalnetTransaction = (tx: GenLayerTransaction): GenLayerTransactio
188
188
  try {
189
189
  const leaderReceipt = tx.consensus_data?.leader_receipt;
190
190
  if (leaderReceipt) {
191
- if (leaderReceipt.result && typeof leaderReceipt.result === "string") {
192
- leaderReceipt.result = resultToUserFriendlyJson(leaderReceipt.result);
193
- }
194
- if (leaderReceipt.calldata && typeof leaderReceipt.calldata === "string") {
195
- leaderReceipt.calldata = {
196
- base64: leaderReceipt.calldata as string,
197
- ...calldataToUserFriendlyJson(b64ToArray(leaderReceipt.calldata as string)),
198
- };
199
- }
200
- if (leaderReceipt.eq_outputs) {
201
- leaderReceipt.eq_outputs = Object.fromEntries(
202
- Object.entries(leaderReceipt.eq_outputs).map(([key, value]) => {
203
- const decodedValue = new TextDecoder().decode(b64ToArray(String(value)));
204
- return [key, resultToUserFriendlyJson(decodedValue)];
205
- }),
206
- );
207
- }
191
+ const receipts = Array.isArray(leaderReceipt) ? leaderReceipt : [leaderReceipt];
192
+ receipts.forEach((receipt) => {
193
+ if (receipt.result && typeof receipt.result === "string") {
194
+ receipt.result = resultToUserFriendlyJson(receipt.result);
195
+ }
196
+ if (receipt.calldata && typeof receipt.calldata === "string") {
197
+ receipt.calldata = {
198
+ base64: receipt.calldata as string,
199
+ ...calldataToUserFriendlyJson(b64ToArray(receipt.calldata as string)),
200
+ };
201
+ }
202
+ if (receipt.eq_outputs) {
203
+ receipt.eq_outputs = Object.fromEntries(
204
+ Object.entries(receipt.eq_outputs).map(([key, value]) => {
205
+ return [key, resultToUserFriendlyJson(String(value))];
206
+ }),
207
+ );
208
+ }
209
+ });
208
210
  }
209
211
  if (tx.data?.calldata && typeof tx.data.calldata === "string") {
210
212
  tx.data.calldata = {
@@ -241,7 +241,7 @@ export type GenLayerTransaction = {
241
241
  pending_transactions: unknown[];
242
242
  vote: string;
243
243
  result: string;
244
- };
244
+ }[];
245
245
  validators?: Record<string, unknown>[];
246
246
  votes?: Record<string, string>;
247
247
  };