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>
58 lines
1.6 KiB
TypeScript
58 lines
1.6 KiB
TypeScript
import { WithdrawalFeedback } from '@vegaprotocol/withdraws';
|
|
import { OrderFeedback } from '@vegaprotocol/orders';
|
|
|
|
import {
|
|
VegaDialog,
|
|
VegaTxStatus,
|
|
isWithdrawTransaction,
|
|
isOrderCancellationTransaction,
|
|
isOrderSubmissionTransaction,
|
|
isOrderAmendmentTransaction,
|
|
} from '@vegaprotocol/wallet';
|
|
import type { VegaStoredTxState } from '@vegaprotocol/wallet';
|
|
import { useEthWithdrawApprovalsStore } from '@vegaprotocol/web3';
|
|
|
|
export const VegaTransaction = ({
|
|
transaction,
|
|
}: {
|
|
transaction: VegaStoredTxState;
|
|
}) => {
|
|
const createEthWithdrawalApproval = useEthWithdrawApprovalsStore(
|
|
(state) => state.create
|
|
);
|
|
if (isWithdrawTransaction(transaction.body)) {
|
|
if (
|
|
transaction.status === VegaTxStatus.Complete &&
|
|
transaction.withdrawal
|
|
) {
|
|
return (
|
|
<WithdrawalFeedback
|
|
transaction={transaction}
|
|
withdrawal={transaction.withdrawal}
|
|
availableTimestamp={null}
|
|
submitWithdraw={() => {
|
|
if (!transaction?.withdrawal) {
|
|
return;
|
|
}
|
|
createEthWithdrawalApproval(
|
|
transaction.withdrawal,
|
|
transaction.withdrawalApproval
|
|
);
|
|
}}
|
|
/>
|
|
);
|
|
}
|
|
} else if (
|
|
(isOrderCancellationTransaction(transaction.body) ||
|
|
isOrderSubmissionTransaction(transaction.body) ||
|
|
isOrderAmendmentTransaction(transaction.body)) &&
|
|
transaction.status === VegaTxStatus.Complete &&
|
|
transaction.order
|
|
) {
|
|
return (
|
|
<OrderFeedback transaction={transaction} order={transaction.order} />
|
|
);
|
|
}
|
|
return <VegaDialog transaction={transaction} />;
|
|
};
|