Skip to content

Commit 5e67278

Browse files
committed
fix result and userOp hash for batches
1 parent 66b5373 commit 5e67278

5 files changed

Lines changed: 118 additions & 47 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## [2.1.3] - 2025-01-27
4+
5+
### Fixes
6+
7+
- Fixed `sendBatches()` and `estimateBatches()` return values to correctly return batch results with `chainGroups` and `userOpHash` data.
8+
39
## [2.1.2] - 2025-01-27
410

511
### Added Changes

__tests__/EtherspotTransactionKit.test.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -963,7 +963,7 @@ describe('EtherspotTransactionKit', () => {
963963
const result = await transactionKit.estimateBatches();
964964
expect(result.isEstimatedSuccessfully).toBe(true);
965965
expect(result.batches['batch1']).toBeDefined();
966-
expect(result.batches['batch1']).toHaveLength(2);
966+
expect(result.batches['batch1'].transactions).toHaveLength(2);
967967
});
968968

969969
it('should return error for estimating non-existent batch', async () => {
@@ -974,8 +974,12 @@ describe('EtherspotTransactionKit', () => {
974974
onlyBatchNames: ['doesnotexist'],
975975
});
976976
expect(result.isEstimatedSuccessfully).toBe(false);
977-
// For non-existent batches, the result should be empty
978-
expect(Object.keys(result.batches)).toHaveLength(0);
977+
// For non-existent batches, the result should contain an error entry
978+
expect(result.batches['doesnotexist']).toBeDefined();
979+
expect(result.batches['doesnotexist'].errorMessage).toBeDefined();
980+
expect(result.batches['doesnotexist'].isEstimatedSuccessfully).toBe(
981+
false
982+
);
979983
});
980984

981985
it('should throw if no provider in estimateBatches', async () => {

lib/TransactionKit.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2343,7 +2343,7 @@ export class EtherspotTransactionKit implements IInitial {
23432343
if (batchesToEstimate.length === 0) {
23442344
log('estimateBatches(): No batches to estimate', this.debugMode);
23452345
this.isEstimating = false;
2346-
return { ...result, ...this };
2346+
return result;
23472347
}
23482348

23492349
// ========================================================================
@@ -2756,7 +2756,7 @@ export class EtherspotTransactionKit implements IInitial {
27562756
this.containsEstimatingError = !result.isEstimatedSuccessfully;
27572757
this.isEstimating = false;
27582758

2759-
return { ...result, ...this };
2759+
return result;
27602760
} else {
27612761
// ========================================================================
27622762
// MODULAR MODE: Use Etherspot SDK for estimation
@@ -3062,7 +3062,7 @@ export class EtherspotTransactionKit implements IInitial {
30623062
this.containsEstimatingError = !result.isEstimatedSuccessfully;
30633063
this.isEstimating = false;
30643064

3065-
return { ...result, ...this };
3065+
return result;
30663066
}
30673067
}
30683068

@@ -4215,7 +4215,7 @@ export class EtherspotTransactionKit implements IInitial {
42154215
this.containsSendingError = !result.isSentSuccessfully;
42164216
this.isSending = false;
42174217

4218-
return { ...result, ...this };
4218+
return result;
42194219
}
42204220
}
42214221

0 commit comments

Comments
 (0)