87e1f9998e
* feat: add eth and vega transaction stores feat: replace useStoredEthereumTransaction with useEthTransactionManager feat: add event bus subsciption to vega transaction store feat: handle order cancellation feat: rename Deposit, Order and Withdraw status field to be unique Revert "feat: rename Deposit, Order and Withdraw status field to be unique" This reverts commit f0b314d53fb3ada6fbebaba4fd1e5af6f38beaed. feat: split transaction update subscription feat: handle order and deposit transaction feat: handle withdrawal creation through transaction store feat: handle withdraw approval feat: handle panding withdrawls, add createdAt feat: handle transaction toast/dialog dismissal feat: add use vega transaction store tests feat: add use vega transaction store tests feat: add use vega transaction menager tests feat: add use vega transaction menager tests feat: add use vega transaction updater tests feat: improve use vega transaction updater tests feat: add use eth transaction store feat: add use eth withdraw approvals store feat: add use eth transaction updater tests fixed tests * feat: toasts feat: toasts feat: toasts * feat: add use eth withdraw approval manager tests * feat: add use eth transaction manager tests * feat: add use eth transaction manager tests * feat: add useEthWithdrawApprovalsManager tests * feat: remove Web3Container react container from CreateWithdrawalDialog * feat: remove Web3Container react container around TransactionsHandler * feat: remove unnecessary async from PendingWithdrawalsTable * feat: remove comments from WithdrawalFeedback * fixed z-index issue * cypress Co-authored-by: Bartłomiej Głownia <bglownia@gmail.com>
39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
import type { ApolloClient } from '@apollo/client';
|
|
import type { VegaStoredTxState } from './use-vega-transaction-store';
|
|
import type {
|
|
WithdrawalApprovalQuery,
|
|
WithdrawalApprovalQueryVariables,
|
|
} from './__generated__/WithdrawalApproval';
|
|
import { WithdrawalApprovalDocument } from './__generated__/WithdrawalApproval';
|
|
|
|
export const waitForWithdrawalApproval = (
|
|
withdrawalId: string,
|
|
client: ApolloClient<object>
|
|
) =>
|
|
new Promise<NonNullable<VegaStoredTxState['withdrawalApproval']>>(
|
|
(resolve) => {
|
|
const interval = setInterval(async () => {
|
|
try {
|
|
const res = await client.query<
|
|
WithdrawalApprovalQuery,
|
|
WithdrawalApprovalQueryVariables
|
|
>({
|
|
query: WithdrawalApprovalDocument,
|
|
variables: { withdrawalId },
|
|
fetchPolicy: 'network-only',
|
|
});
|
|
|
|
if (
|
|
res.data.erc20WithdrawalApproval &&
|
|
res.data.erc20WithdrawalApproval.signatures.length > 2
|
|
) {
|
|
clearInterval(interval);
|
|
resolve(res.data.erc20WithdrawalApproval);
|
|
}
|
|
} catch (err) {
|
|
// no op as the query will error until the approval is created
|
|
}
|
|
}, 1000);
|
|
}
|
|
);
|