diff --git a/packages/ui-components/src/__tests__/transactionStore.test.ts b/packages/ui-components/src/__tests__/transactionStore.test.ts index 666acc68a..4ce078091 100644 --- a/packages/ui-components/src/__tests__/transactionStore.test.ts +++ b/packages/ui-components/src/__tests__/transactionStore.test.ts @@ -106,7 +106,8 @@ describe('transactionStore', () => { deploymentCalldata: mockDeploymentCalldata, orderbookAddress: mockOrderbookAddress as `0x${string}`, chainId: 1, - subgraphUrl: 'test.com' + subgraphUrl: 'test.com', + network: 'flare' }); expect(get(transactionStore).status).toBe(TransactionStatus.PENDING_SUBGRAPH); @@ -122,7 +123,8 @@ describe('transactionStore', () => { deploymentCalldata: '0x', orderbookAddress: mockOrderbookAddress as `0x${string}`, chainId: 1, - subgraphUrl: 'test.com' + subgraphUrl: 'test.com', + network: 'flare' }); expect(get(transactionStore).status).toBe(TransactionStatus.ERROR); @@ -141,7 +143,8 @@ describe('transactionStore', () => { deploymentCalldata: '0x', orderbookAddress: mockOrderbookAddress as `0x${string}`, chainId: 1, - subgraphUrl: 'test.com' + subgraphUrl: 'test.com', + network: 'flare' }); expect(get(transactionStore).status).toBe(TransactionStatus.ERROR); @@ -161,7 +164,8 @@ describe('transactionStore', () => { deploymentCalldata: '0x', orderbookAddress: mockOrderbookAddress as `0x${string}`, chainId: 1, - subgraphUrl: 'test.com' + subgraphUrl: 'test.com', + network: 'flare' }); expect(get(transactionStore).status).toBe(TransactionStatus.ERROR); @@ -178,7 +182,8 @@ describe('transactionStore', () => { deploymentCalldata: '0x', orderbookAddress: mockOrderbookAddress as `0x${string}`, chainId: 1, - subgraphUrl: 'test.com' + subgraphUrl: 'test.com', + network: 'flare' }); expect(get(transactionStore).status).toBe(TransactionStatus.ERROR); @@ -196,7 +201,8 @@ describe('transactionStore', () => { deploymentCalldata: '0x', orderbookAddress: mockOrderbookAddress as `0x${string}`, chainId: 1, - subgraphUrl: 'test.com' + subgraphUrl: 'test.com', + network: 'flare' }); expect(get(transactionStore).status).toBe(TransactionStatus.ERROR); @@ -222,7 +228,8 @@ describe('transactionStore', () => { deploymentCalldata: '0x', orderbookAddress: mockOrderbookAddress as `0x${string}`, chainId: 1, - subgraphUrl: 'test.com' + subgraphUrl: 'test.com', + network: 'flare' }); expect(sendTransaction).toHaveBeenCalledTimes(3); // 2 approvals + 1 deployment diff --git a/packages/ui-components/src/lib/stores/transactionStore.ts b/packages/ui-components/src/lib/stores/transactionStore.ts index 423b4a9bc..909a348d5 100644 --- a/packages/ui-components/src/lib/stores/transactionStore.ts +++ b/packages/ui-components/src/lib/stores/transactionStore.ts @@ -146,23 +146,23 @@ const transactionStore = () => { status: TransactionStatus.PENDING_SUBGRAPH, message: 'Waiting for new Order to be indexed...' })); - console.log(network) + console.log(network); let attempts = 0; const interval: NodeJS.Timeout = setInterval(async () => { attempts++; - console.log("attempts", attempts) + console.log('attempts', attempts); const addOrders = await getTransactionAddOrders(subgraphUrl, txHash); if (attempts >= 10) { update((state) => ({ ...state, - message: 'The subgraph took too long to respond. Please check again later.', + message: 'The subgraph took too long to respond. Please check again later.' })); clearInterval(interval); return transactionError(TransactionErrorMessage.TIMEOUT); } else if (addOrders.length > 0) { - console.log(addOrders) + console.log(addOrders); clearInterval(interval); return transactionSuccess(txHash, '', addOrders[0].order.id, network); } @@ -195,7 +195,12 @@ const transactionStore = () => { status: TransactionStatus.PENDING_DEPLOYMENT, message: 'Confirming transaction...' })); - const transactionSuccess = (hash: string, message?: string, newOrderId?: string, network?: string) => { + const transactionSuccess = ( + hash: string, + message?: string, + newOrderId?: string, + network?: string + ) => { update((state) => ({ ...state, status: TransactionStatus.SUCCESS, @@ -220,7 +225,7 @@ const transactionStore = () => { orderbookAddress, chainId, subgraphUrl, - network + network }: DeploymentTransactionArgs) => { try { await switchChain(config, { chainId }); @@ -261,7 +266,7 @@ const transactionStore = () => { try { awaitDeployTx(hash); await waitForTransactionReceipt(config, { hash }); - return awaitNewOrderIndexing(subgraphUrl, hash, network); + return awaitNewOrderIndexing(subgraphUrl, hash, network); } catch { return transactionError(TransactionErrorMessage.DEPLOYMENT_FAILED); } diff --git a/packages/webapp/src/lib/components/TransactionModal.svelte b/packages/webapp/src/lib/components/TransactionModal.svelte index 04bd8731e..182fe024a 100644 --- a/packages/webapp/src/lib/components/TransactionModal.svelte +++ b/packages/webapp/src/lib/components/TransactionModal.svelte @@ -79,7 +79,7 @@ {:else}