* 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>
30 lines
1.1 KiB
TypeScript
30 lines
1.1 KiB
TypeScript
import { DepositStatus } from '@vegaprotocol/types';
|
|
import {
|
|
useDepositBusEventSubscription,
|
|
useVegaWallet,
|
|
} from '@vegaprotocol/wallet';
|
|
import { useEthTransactionStore } from './use-ethereum-transaction-store';
|
|
|
|
export const useEthTransactionUpdater = () => {
|
|
const { pubKey } = useVegaWallet();
|
|
const updateDeposit = useEthTransactionStore((state) => state.updateDeposit);
|
|
const variables = { partyId: pubKey || '' };
|
|
const skip = !pubKey;
|
|
useDepositBusEventSubscription({
|
|
variables,
|
|
skip,
|
|
onData: ({ data: result }) =>
|
|
result.data?.busEvents?.forEach((event) => {
|
|
if (
|
|
event.event.__typename === 'Deposit' &&
|
|
// Note there is a bug in data node where the subscription is not emitted when the status
|
|
// changes from 'Open' to 'Finalized' as a result the deposit UI will hang in a pending state right now
|
|
// https://github.com/vegaprotocol/data-node/issues/460
|
|
event.event.status === DepositStatus.STATUS_FINALIZED
|
|
) {
|
|
updateDeposit(event.event);
|
|
}
|
|
}),
|
|
});
|
|
};
|