From e6c24c8b42a5e971f3ebdde292c24965028a5f90 Mon Sep 17 00:00:00 2001 From: RanaBug Date: Wed, 12 Mar 2025 16:40:41 +0000 Subject: [PATCH] revert and removing gettign transaction hash within send function --- CHANGELOG.md | 8 +- .../hooks/useEtherspotTransactions.test.js | 214 ++---------------- package.json | 2 +- .../EtherspotTransactionKitContext.tsx | 2 +- ...EtherspotTransactionKitContextProvider.tsx | 53 +---- src/types/EtherspotTransactionKit.ts | 1 - 6 files changed, 34 insertions(+), 246 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 60aef74..c380593 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ # Changelog -## [1.0.3] - 2025-02-19 +## [1.0.4] - 2025-03-12 + +### Added Changes + +- Remove `transactionHash` to `send()` in `EtherspotTransactionKitContextProvider`. + +## [1.0.3] - 2025-03-12 ### Added Changes diff --git a/__tests__/hooks/useEtherspotTransactions.test.js b/__tests__/hooks/useEtherspotTransactions.test.js index aecef43..af996e4 100644 --- a/__tests__/hooks/useEtherspotTransactions.test.js +++ b/__tests__/hooks/useEtherspotTransactions.test.js @@ -4,7 +4,6 @@ import { act } from 'react'; import { createWalletClient, http, parseEther, toHex } from 'viem'; import { privateKeyToAccount } from 'viem/accounts'; import { sepolia } from 'viem/chains'; - import { EtherspotBatch, EtherspotBatches, @@ -13,7 +12,6 @@ import { EtherspotTransactionKit, useEtherspotTransactions, } from '../../src'; - const randomWallet = privateKeyToAccount( `0x${crypto.getRandomValues(new Uint8Array(32)).reduce((acc, byte) => acc + byte.toString(16).padStart(2, '0'), '')}` ); @@ -30,7 +28,6 @@ const TestSingleBatchComponent = () => ( ); - const abi = { inputs: [ { internalType: 'address', name: 'to', type: 'address' }, @@ -41,7 +38,6 @@ const abi = { stateMutability: 'nonpayable', type: 'function', }; - jest.mock('@etherspot/data-utils', () => ({ DataUtils: jest.fn().mockImplementation(() => ({ getAccountBalances: jest.fn(({ chainId, account }) => { @@ -50,10 +46,8 @@ jest.mock('@etherspot/data-utils', () => ({ defaultAccountAddress, otherAccountAddress, } = require('../../__mocks__/@etherspot/modular-sdk'); - const tokenBalance = parseEther('420'); const nativeAssetBalance = parseEther('0'); - const token = { token: '0x', balance: tokenBalance, @@ -64,26 +58,21 @@ jest.mock('@etherspot/data-utils', () => ({ balance: nativeAssetBalance, superBalance: nativeAssetBalance, }; - if (chainId !== 1) { return { items: [nativeAsset] }; } - if (account === defaultAccountAddress) { return { items: [nativeAsset, token] }; } - if (account === otherAccountAddress) { return { items: [nativeAsset, { ...token, balance: parseEther('69') }], }; } - return { items: [] }; }), })), })); - describe('useEtherspotTransactions()', () => { beforeEach(() => { jest.clearAllMocks(); @@ -130,11 +119,9 @@ describe('useEtherspotTransactions()', () => { {children} ); - const { result: { current }, } = renderHook(() => useEtherspotTransactions(), { wrapper }); - expect(current.batches.length).toBe(5); expect(current.batches[0].batches.length).toBe(1); expect(current.batches[0].batches[0].chainId).toBe(123); @@ -157,7 +144,6 @@ describe('useEtherspotTransactions()', () => { api_key: 'someApiKey', }); }); - it('throws an error if within ', () => { const wrapper = ({ children }) => ( @@ -177,12 +163,10 @@ describe('useEtherspotTransactions()', () => { {children} ); - expect(() => renderHook(() => useEtherspotTransactions(), { wrapper }) ).toThrow(' cannot be inside '); }); - it('throws an error if within ', () => { const wrapper = ({ children }) => ( @@ -204,12 +188,10 @@ describe('useEtherspotTransactions()', () => { {children} ); - expect(() => renderHook(() => useEtherspotTransactions(), { wrapper }) ).toThrow(' cannot be inside '); }); - it('throws an error if rendered without ', () => { expect(() => render( @@ -221,7 +203,6 @@ describe('useEtherspotTransactions()', () => { ) ).toThrow('No parent '); }); - it('throws an error if rendered without ', () => { expect(() => render( @@ -231,7 +212,6 @@ describe('useEtherspotTransactions()', () => { ) ).toThrow('No parent '); }); - it('throws an error if rendered without ', () => { expect(() => render( @@ -241,7 +221,6 @@ describe('useEtherspotTransactions()', () => { ) ).toThrow('No parent '); }); - it('single grouped batches estimate returns cost and send returns userOp hash successfully', async () => { const wrapper = ({ children }) => ( @@ -273,21 +252,16 @@ describe('useEtherspotTransactions()', () => { {children} ); - const { result } = renderHook(() => useEtherspotTransactions(), { wrapper, }); - expect(result.current.isEstimating).toBe(false); - let estimatePromise; act(() => { estimatePromise = result.current.estimate(); }); - await waitFor(() => expect(result.current.isEstimating).toBe(true)); await waitFor(() => expect(result.current.isEstimating).toBe(false)); - const estimated = await estimatePromise; expect(result.current.containsEstimatingError).toBe(false); expect(BigNumber.isBigNumber(estimated[0].estimatedBatches[0].cost)).toBe( @@ -299,31 +273,17 @@ describe('useEtherspotTransactions()', () => { expect(result.current.isSending).toBe(false); - // Mocking the timeout during the send operation - jest.useFakeTimers(); - let sendPromise; act(() => { sendPromise = result.current.send(); }); await waitFor(() => expect(result.current.isSending).toBe(true)); - - // Simulate 30 seconds timeout - jest.advanceTimersByTime(30000); - - await waitFor( - () => { - expect(result.current.isSending).toBe(false); - }, - { timeout: 31000 } - ); // Increase timeout slightly to cover the full timeout + await waitFor(() => expect(result.current.isSending).toBe(false)); const sent = await sendPromise; expect(result.current.containsSendingError).toBe(false); expect(sent[0].sentBatches[0].userOpHash).toBe('0x7c'); - - jest.useRealTimers(); }); it('estimates and sends single grouped batches without calling estimate', async () => { @@ -357,34 +317,24 @@ describe('useEtherspotTransactions()', () => { {children} ); - const { result } = renderHook(() => useEtherspotTransactions(), { wrapper, }); expect(result.current.isSending).toBe(false); - jest.useFakeTimers(); - let sendPromise; act(() => { sendPromise = result.current.send(); }); await waitFor(() => expect(result.current.isSending).toBe(true)); - - jest.advanceTimersByTime(30000); - - await waitFor(() => expect(result.current.isSending).toBe(false), { - timeout: 31000, - }); + await waitFor(() => expect(result.current.isSending).toBe(false)); const sent = await sendPromise; expect(result.current.containsSendingError).toBe(false); expect(sent[0].estimatedBatches[0].cost.toString()).toBe('350000000000000'); expect(sent[0].sentBatches[0].userOpHash).toBe('0x7c'); - - jest.useRealTimers(); }); it('estimates and sends multiple grouped batches with skipped and with no batches', async () => { @@ -436,27 +386,19 @@ describe('useEtherspotTransactions()', () => { {children} ); - const { result } = renderHook(() => useEtherspotTransactions(), { wrapper, }); expect(result.current.isEstimating).toBe(false); - jest.useFakeTimers(); - let estimatePromise; act(() => { estimatePromise = result.current.estimate(); }); await waitFor(() => expect(result.current.isEstimating).toBe(true)); - - jest.advanceTimersByTime(30000); - - await waitFor(() => expect(result.current.isEstimating).toBe(false), { - timeout: 31000, - }); + await waitFor(() => expect(result.current.isEstimating).toBe(false)); const estimated = await estimatePromise; expect(result.current.containsEstimatingError).toBe(false); @@ -470,21 +412,14 @@ describe('useEtherspotTransactions()', () => { expect(estimated[2].estimatedBatches[0].cost.toString()).toBe( '250000000000000' ); - expect(result.current.isSending).toBe(false); - let sendPromise; act(() => { sendPromise = result.current.send(); }); await waitFor(() => expect(result.current.isSending).toBe(true)); - - jest.advanceTimersByTime(30000); - - await waitFor(() => expect(result.current.isSending).toBe(false), { - timeout: 31000, - }); + await waitFor(() => expect(result.current.isSending).toBe(false)); const sent = await sendPromise; expect(result.current.containsSendingError).toBe(false); @@ -492,8 +427,6 @@ describe('useEtherspotTransactions()', () => { expect(sent[0].sentBatches[1].userOpHash).toBe('0x7d'); expect(sent[1].sentBatches.length).toBe(0); // has skip prop expect(sent[2].sentBatches[0].userOpHash).toBe('0x46'); - - jest.useRealTimers(); }); it('estimates and sends multiple grouped batches with paymaster', async () => { @@ -532,27 +465,19 @@ describe('useEtherspotTransactions()', () => { {children} ); - const { result } = renderHook(() => useEtherspotTransactions(), { wrapper, }); expect(result.current.isEstimating).toBe(false); - jest.useFakeTimers(); - let estimatePromise; act(() => { estimatePromise = result.current.estimate(); }); await waitFor(() => expect(result.current.isEstimating).toBe(true)); - - jest.advanceTimersByTime(30000); - - await waitFor(() => expect(result.current.isEstimating).toBe(false), { - timeout: 31000, - }); + await waitFor(() => expect(result.current.isEstimating).toBe(false)); const estimated = await estimatePromise; expect(result.current.containsEstimatingError).toBe(false); @@ -562,28 +487,19 @@ describe('useEtherspotTransactions()', () => { expect(estimated[1].estimatedBatches[0].cost.toString()).toBe( '650000000000000' ); - expect(result.current.isSending).toBe(false); - let sendPromise; act(() => { sendPromise = result.current.send(); }); await waitFor(() => expect(result.current.isSending).toBe(true)); - - jest.advanceTimersByTime(30000); - - await waitFor(() => expect(result.current.isSending).toBe(false), { - timeout: 31000, - }); + await waitFor(() => expect(result.current.isSending).toBe(false)); const sent = await sendPromise; expect(result.current.containsSendingError).toBe(false); expect(sent[0].sentBatches[0].userOpHash).toBe('0x7c'); expect(sent[1].sentBatches[0].userOpHash).toBe('0x46'); - - jest.useRealTimers(); }); it('estimates and sends multiple grouped batches with matching chain IDs', async () => { @@ -634,27 +550,19 @@ describe('useEtherspotTransactions()', () => { {children} ); - const { result } = renderHook(() => useEtherspotTransactions(), { wrapper, }); expect(result.current.isEstimating).toBe(false); - jest.useFakeTimers(); - let estimatePromise; act(() => { estimatePromise = result.current.estimate(); }); await waitFor(() => expect(result.current.isEstimating).toBe(true)); - - jest.advanceTimersByTime(30000); - - await waitFor(() => expect(result.current.isEstimating).toBe(false), { - timeout: 31000, - }); + await waitFor(() => expect(result.current.isEstimating).toBe(false)); const estimated = await estimatePromise; expect(result.current.containsEstimatingError).toBe(false); @@ -670,21 +578,14 @@ describe('useEtherspotTransactions()', () => { expect(estimated[2].estimatedBatches[0].cost.toString()).toBe( '650000000000000' ); - expect(result.current.isSending).toBe(false); - let sendPromise; act(() => { sendPromise = result.current.send(); }); await waitFor(() => expect(result.current.isSending).toBe(true)); - - jest.advanceTimersByTime(30000); - - await waitFor(() => expect(result.current.isSending).toBe(false), { - timeout: 31000, - }); + await waitFor(() => expect(result.current.isSending).toBe(false)); const sent = await sendPromise; expect(result.current.containsSendingError).toBe(false); @@ -692,14 +593,11 @@ describe('useEtherspotTransactions()', () => { expect(sent[0].sentBatches[1].userOpHash).toBe('0x7e'); expect(sent[1].sentBatches[0].userOpHash).toBe('0x46'); expect(sent[2].sentBatches[0].userOpHash).toBe('0x7d'); - - jest.useRealTimers(); }); it('estimates and calls onEstimated for each batch group', async () => { const onEstimated1 = jest.fn((estimated) => estimated); const onEstimated2 = jest.fn((estimated) => estimated); - const wrapper = ({ children }) => (
@@ -745,27 +643,19 @@ describe('useEtherspotTransactions()', () => { {children} ); - const { result } = renderHook(() => useEtherspotTransactions(), { wrapper, }); expect(result.current.isEstimating).toBe(false); - jest.useFakeTimers(); - let estimatePromise; act(() => { estimatePromise = result.current.estimate(); }); await waitFor(() => expect(result.current.isEstimating).toBe(true)); - - jest.advanceTimersByTime(30000); - - await waitFor(() => expect(result.current.isEstimating).toBe(false), { - timeout: 31000, - }); + await waitFor(() => expect(result.current.isEstimating).toBe(false)); const estimated = await estimatePromise; expect(result.current.containsEstimatingError).toBe(false); @@ -777,14 +667,11 @@ describe('useEtherspotTransactions()', () => { expect(onEstimated2.mock.calls[0][0]).toStrictEqual( estimated[1].estimatedBatches ); - - jest.useRealTimers(); }); it('sends and calls onSent for each batch group', async () => { const onSent1 = jest.fn((sent) => sent); const onSent2 = jest.fn((sent) => sent); - const wrapper = ({ children }) => (
@@ -830,27 +717,19 @@ describe('useEtherspotTransactions()', () => { {children} ); - const { result } = renderHook(() => useEtherspotTransactions(), { wrapper, }); expect(result.current.isSending).toBe(false); - jest.useFakeTimers(); - let sendPromise; act(() => { sendPromise = result.current.send(); }); await waitFor(() => expect(result.current.isSending).toBe(true)); - - jest.advanceTimersByTime(30000); - - await waitFor(() => expect(result.current.isSending).toBe(false), { - timeout: 31000, - }); + await waitFor(() => expect(result.current.isSending).toBe(false)); const sent = await sendPromise; @@ -858,14 +737,11 @@ describe('useEtherspotTransactions()', () => { expect(onSent2).toBeCalledTimes(1); expect(onSent1.mock.calls[0][0]).toStrictEqual(sent[0].sentBatches); expect(onSent2.mock.calls[0][0]).toStrictEqual(sent[1].sentBatches); - - jest.useRealTimers(); }); it('estimates and returns error messages for each batch group', async () => { const onEstimated1 = jest.fn((estimated) => estimated); const onEstimated2 = jest.fn((estimated) => estimated); - const wrapper = ({ children }) => (
@@ -908,27 +784,19 @@ describe('useEtherspotTransactions()', () => { {children} ); - const { result } = renderHook(() => useEtherspotTransactions(), { wrapper, }); expect(result.current.isEstimating).toBe(false); - jest.useFakeTimers(); - let estimatePromise; act(() => { estimatePromise = result.current.estimate(); }); await waitFor(() => expect(result.current.isEstimating).toBe(true)); - - jest.advanceTimersByTime(30000); - - await waitFor(() => expect(result.current.isEstimating).toBe(false), { - timeout: 31000, - }); + await waitFor(() => expect(result.current.isEstimating).toBe(false)); const estimated = await estimatePromise; expect(result.current.containsEstimatingError).toBe(true); @@ -944,14 +812,11 @@ describe('useEtherspotTransactions()', () => { expect(onEstimated2.mock.calls[0][0]).toStrictEqual( estimated[1].estimatedBatches ); - - jest.useRealTimers(); }); it('estimates successfully and returns error messages on send for each batch group', async () => { const onSent1 = jest.fn((sent) => sent); const onSent2 = jest.fn((sent) => sent); - const wrapper = ({ children }) => (
@@ -990,27 +855,19 @@ describe('useEtherspotTransactions()', () => { {children} ); - const { result } = renderHook(() => useEtherspotTransactions(), { wrapper, }); expect(result.current.isEstimating).toBe(false); - jest.useFakeTimers(); - let estimatePromise; act(() => { estimatePromise = result.current.estimate(); }); await waitFor(() => expect(result.current.isEstimating).toBe(true)); - - jest.advanceTimersByTime(30000); - - await waitFor(() => expect(result.current.isEstimating).toBe(false), { - timeout: 31000, - }); + await waitFor(() => expect(result.current.isEstimating).toBe(false)); const estimated = await estimatePromise; expect(result.current.containsEstimatingError).toBe(false); @@ -1020,21 +877,14 @@ describe('useEtherspotTransactions()', () => { expect(estimated[1].estimatedBatches[0].cost.toString()).toBe( '250000000000000' ); - expect(result.current.isSending).toBe(false); - let sendPromise; act(() => { sendPromise = result.current.send(); }); await waitFor(() => expect(result.current.isSending).toBe(true)); - - jest.advanceTimersByTime(30000); - - await waitFor(() => expect(result.current.isSending).toBe(false), { - timeout: 31000, - }); + await waitFor(() => expect(result.current.isSending).toBe(false)); const sent = await sendPromise; @@ -1047,15 +897,12 @@ describe('useEtherspotTransactions()', () => { ); expect(onSent1.mock.calls[0][0]).toStrictEqual(sent[0].sentBatches); expect(onSent2.mock.calls[0][0]).toStrictEqual(sent[1].sentBatches); - - jest.useRealTimers(); }); it('estimates valid and returns error messages for invalid batch group by ID', async () => { const onEstimated1 = jest.fn((estimated) => estimated); const onEstimated2 = jest.fn((estimated) => estimated); const onEstimated3 = jest.fn((estimated) => estimated); - const wrapper = ({ children }) => (
@@ -1105,27 +952,19 @@ describe('useEtherspotTransactions()', () => { {children} ); - const { result } = renderHook(() => useEtherspotTransactions(), { wrapper, }); expect(result.current.isEstimating).toBe(false); - jest.useFakeTimers(); - let estimatePromise; act(() => { estimatePromise = result.current.estimate(['test-id-1']); }); await waitFor(() => expect(result.current.isEstimating).toBe(true)); - - jest.advanceTimersByTime(30000); - - await waitFor(() => expect(result.current.isEstimating).toBe(false), { - timeout: 31000, - }); + await waitFor(() => expect(result.current.isEstimating).toBe(false)); const estimated1 = await estimatePromise; expect(result.current.containsEstimatingError).toBe(true); @@ -1136,15 +975,12 @@ describe('useEtherspotTransactions()', () => { expect(onEstimated1.mock.calls[0][0]).toStrictEqual( estimated1[0].estimatedBatches ); - act(() => { estimatePromise = result.current.estimate(['test-id-2', 'test-id-3']); }); await waitFor(() => expect(result.current.isEstimating).toBe(true)); - await waitFor(() => expect(result.current.isEstimating).toBe(false), { - timeout: 31000, - }); + await waitFor(() => expect(result.current.isEstimating).toBe(false)); const estimated2 = await estimatePromise; expect(result.current.containsEstimatingError).toBe(false); @@ -1161,15 +997,12 @@ describe('useEtherspotTransactions()', () => { expect(onEstimated3.mock.calls[0][0]).toStrictEqual( estimated2[1].estimatedBatches ); - - jest.useRealTimers(); }); it('sends valid and returns error messages for invalid batch group by ID', async () => { const onSent1 = jest.fn((estimated) => estimated); const onSent2 = jest.fn((estimated) => estimated); const onSent3 = jest.fn((estimated) => estimated); - const wrapper = ({ children }) => (
@@ -1219,27 +1052,19 @@ describe('useEtherspotTransactions()', () => { {children} ); - const { result } = renderHook(() => useEtherspotTransactions(), { wrapper, }); expect(result.current.isSending).toBe(false); - jest.useFakeTimers(); - let sendPromise; act(() => { sendPromise = result.current.send(['test-id-1']); }); await waitFor(() => expect(result.current.isSending).toBe(true)); - - jest.advanceTimersByTime(30000); - - await waitFor(() => expect(result.current.isSending).toBe(false), { - timeout: 31000, - }); + await waitFor(() => expect(result.current.isSending).toBe(false)); const sent1 = await sendPromise; expect(sent1.length).toBe(1); @@ -1248,15 +1073,12 @@ describe('useEtherspotTransactions()', () => { 'Transaction reverted: chain too hot' ); expect(onSent1.mock.calls[0][0]).toStrictEqual(sent1[0].sentBatches); - act(() => { sendPromise = result.current.send(['test-id-2', 'test-id-3']); }); await waitFor(() => expect(result.current.isSending).toBe(true)); - await waitFor(() => expect(result.current.isSending).toBe(false), { - timeout: 31000, - }); + await waitFor(() => expect(result.current.isSending).toBe(false)); const sent2 = await sendPromise; expect(sent2.length).toBe(2); @@ -1265,7 +1087,5 @@ describe('useEtherspotTransactions()', () => { expect(sent2[1].sentBatches[0].userOpHash).toBe('0x47'); expect(onSent2.mock.calls[0][0]).toStrictEqual(sent2[0].sentBatches); expect(onSent3.mock.calls[0][0]).toStrictEqual(sent2[1].sentBatches); - - jest.useRealTimers(); }); }); diff --git a/package.json b/package.json index 3ecf93b..be631c6 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@etherspot/transaction-kit", "description": "React Etherspot Transaction Kit", - "version": "1.0.3", + "version": "1.0.4", "main": "dist/cjs/index.js", "scripts": { "rollup:build": "NODE_OPTIONS=--max-old-space-size=8192 rollup -c --bundleConfigAsCjs", diff --git a/src/contexts/EtherspotTransactionKitContext.tsx b/src/contexts/EtherspotTransactionKitContext.tsx index 2b82ad5..6e43bdc 100644 --- a/src/contexts/EtherspotTransactionKitContext.tsx +++ b/src/contexts/EtherspotTransactionKitContext.tsx @@ -16,7 +16,7 @@ export interface IEtherspotTransactionKitContext { send: (batchesIds?: string[]) => Promise; getTransactionHash: ( userOpHash: string, - batchId: number, + batchId?: number, timeout?: number, retryInterval?: number ) => Promise; diff --git a/src/providers/EtherspotTransactionKitContextProvider.tsx b/src/providers/EtherspotTransactionKitContextProvider.tsx index 43124a9..a3c5cf4 100644 --- a/src/providers/EtherspotTransactionKitContextProvider.tsx +++ b/src/providers/EtherspotTransactionKitContextProvider.tsx @@ -212,44 +212,7 @@ const EtherspotTransactionKitContextProvider = ({ estimatedBatch.userOp ); - // get transaction hash or userOp receipt... - let userOpsReceipt; - const timeout = Date.now() + 30 * 1000; // 30 seconds timeout - - try { - while (!userOpsReceipt && Date.now() < timeout) { - await new Promise((resolve) => { - setTimeout(resolve, 2000); - }); // Retry every 2 sec - - try { - userOpsReceipt = - await etherspotModulaSdk.getUserOpReceipt(userOpHash); - } catch (error) { - console.error( - 'Error fetching transaction hash. Please check if the transaction has gone through, or try to send the transaction again:', - error - ); - } - } - - if (!userOpsReceipt) { - console.warn( - 'Failed to get the transaction hash within 30 seconds. Please check if the transaction has gone through, or try to send the transaction again.' - ); - } - } catch (e) { - console.error( - 'Unexpected error while fetching the transaction hash. Please check if the transaction has gone through, or try to send the transaction again:', - e - ); - } - - sentBatches.push({ - ...estimatedBatch, - userOpHash, - transactionHash: userOpsReceipt, - }); + sentBatches.push({ ...estimatedBatch, userOpHash }); } catch (e) { const errorMessage = parseEtherspotErrorMessage( e, @@ -280,25 +243,25 @@ const EtherspotTransactionKitContextProvider = ({ const getTransactionHash = async ( userOpHash: string, - batchId: number, - timeout: number = 30 * 1000, - retryInterval: number = 2000 + batchId?: number, + timeout: number = 30 * 1000, // Default to 30 sec + retryInterval: number = 2000 // Default to 2 sec ): Promise => { const etherspotModulaSdk = await getSdk(batchId); let transactionHash = null; - const timeoutTotal = Date.now() + timeout; // 30 seconds timeout + const timeoutTotal = Date.now() + timeout; // Timeout duration while (!transactionHash && Date.now() < timeoutTotal) { await new Promise((resolve) => { setTimeout(resolve, retryInterval); - }); // Retry every 2 sec + }); // Retry every retryInterval ms try { transactionHash = await etherspotModulaSdk.getUserOpReceipt(userOpHash); } catch (error) { console.error( - 'Error fetching transaction hash. Please try again:', + 'Error fetching transaction hash. Please check if the transaction has gone through, or try to send the transaction again:', error ); } @@ -306,7 +269,7 @@ const EtherspotTransactionKitContextProvider = ({ if (!transactionHash) { console.warn( - 'Failed to get the transaction hash within 30 seconds. Please try again' + 'Failed to get the transaction hash within time limit. Please try again' ); } diff --git a/src/types/EtherspotTransactionKit.ts b/src/types/EtherspotTransactionKit.ts index d930369..793b995 100644 --- a/src/types/EtherspotTransactionKit.ts +++ b/src/types/EtherspotTransactionKit.ts @@ -35,7 +35,6 @@ export interface EstimatedBatch extends IBatch { export interface SentBatch extends EstimatedBatch { errorMessage?: string; userOpHash?: string; - transactionHash?: string; } export interface IBatches {