@rango-dev/widget-embedded 0.1.10-next.95 → 0.1.10-next.98
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
- package/dist/pages/SwapDetailsPage.d.ts.map +1 -1
- package/dist/widget-embedded.cjs.development.js +11 -5
- package/dist/widget-embedded.cjs.development.js.map +1 -1
- package/dist/widget-embedded.cjs.production.min.js +11 -5
- package/dist/widget-embedded.cjs.production.min.js.map +1 -1
- package/dist/widget-embedded.esm.js +11 -5
- package/dist/widget-embedded.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/pages/ConfirmSwapPage.tsx +5 -1
- package/src/pages/SwapDetailsPage.tsx +12 -7
package/package.json
CHANGED
|
@@ -39,7 +39,11 @@ export function ConfirmSwapPage() {
|
|
|
39
39
|
onConfirm={() => {
|
|
40
40
|
confirmSwap?.().then((swap) => {
|
|
41
41
|
if (swap) {
|
|
42
|
-
manager?.create(
|
|
42
|
+
manager?.create(
|
|
43
|
+
'swap',
|
|
44
|
+
{ swapDetails: swap },
|
|
45
|
+
{ id: swap.requestId }
|
|
46
|
+
);
|
|
43
47
|
setSelectedSwap(swap.requestId);
|
|
44
48
|
navigate(navigationRoutes.swaps + `/${swap.requestId}`, {
|
|
45
49
|
replace: true,
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { useManager } from '@rango-dev/queue-manager-react';
|
|
3
|
-
import { SwapHistory } from '@rango-dev/ui';
|
|
4
2
|
import { navigationRoutes } from '../constants/navigationRoutes';
|
|
3
|
+
import useCopyToClipboard from '../hooks/useCopyToClipboard';
|
|
4
|
+
import { useManager } from '@rango-dev/queue-manager-react';
|
|
5
5
|
import { useNavigateBack } from '../hooks/useNavigateBack';
|
|
6
6
|
import { getPendingSwaps } from '../utils/queue';
|
|
7
|
+
import { SwapHistory } from '@rango-dev/ui';
|
|
7
8
|
import { useUiStore } from '../store/ui';
|
|
8
|
-
import
|
|
9
|
+
import { cancelSwap } from '@rango-dev/queue-manager-rango-preset';
|
|
9
10
|
|
|
10
11
|
export function SwapDetailsPage() {
|
|
11
12
|
const selectedSwapRequestId = useUiStore.use.selectedSwapRequestId();
|
|
@@ -16,18 +17,22 @@ export function SwapDetailsPage() {
|
|
|
16
17
|
const pendingSwaps = getPendingSwaps(manager);
|
|
17
18
|
const selectedSwap = pendingSwaps.find(
|
|
18
19
|
({ swap }) => swap.requestId === selectedSwapRequestId
|
|
19
|
-
)
|
|
20
|
+
);
|
|
20
21
|
|
|
22
|
+
//TODO: implement swap cancellation (move queueManager logic to queueManager/rango-preset)
|
|
23
|
+
const onCancel = () => {
|
|
24
|
+
const swap = selectedSwap ? manager?.get(selectedSwap.id) : undefined;
|
|
25
|
+
if (swap) cancelSwap(swap);
|
|
26
|
+
};
|
|
21
27
|
return (
|
|
22
28
|
<SwapHistory
|
|
23
29
|
onBack={navigateBackFrom.bind(null, navigationRoutes.swapDetails)}
|
|
24
30
|
//todo: move PendingSwap type to rango-types
|
|
25
31
|
//@ts-ignore
|
|
26
|
-
pendingSwap={selectedSwap}
|
|
32
|
+
pendingSwap={selectedSwap?.swap}
|
|
27
33
|
onCopy={handleCopy}
|
|
28
34
|
isCopied={isCopied}
|
|
29
|
-
|
|
30
|
-
onCancel={(requestId) => console.log(requestId)}
|
|
35
|
+
onCancel={onCancel}
|
|
31
36
|
/>
|
|
32
37
|
);
|
|
33
38
|
}
|