@rango-dev/widget-embedded 0.41.2-next.10 → 0.41.2-next.11
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/package.json
CHANGED
|
@@ -171,7 +171,7 @@ export function SwapDetails(props: SwapDetailsProps) {
|
|
|
171
171
|
])
|
|
172
172
|
: undefined;
|
|
173
173
|
|
|
174
|
-
const stepMessage = getSwapMessages(swap, currentStep);
|
|
174
|
+
const stepMessage = getSwapMessages(swap, currentStep, getWalletInfo);
|
|
175
175
|
const steps = getSteps({
|
|
176
176
|
swap,
|
|
177
177
|
switchNetwork,
|
package/src/utils/swap.ts
CHANGED
|
@@ -9,6 +9,7 @@ import type {
|
|
|
9
9
|
SwapButtonState,
|
|
10
10
|
Wallet,
|
|
11
11
|
} from '../types';
|
|
12
|
+
import type { ExtendedWalletInfo } from '@rango-dev/wallets-react';
|
|
12
13
|
import type { WalletType } from '@rango-dev/wallets-shared';
|
|
13
14
|
import type {
|
|
14
15
|
BestRouteRequest,
|
|
@@ -22,6 +23,7 @@ import type { PendingSwap, PendingSwapStep } from 'rango-types';
|
|
|
22
23
|
|
|
23
24
|
import { i18n } from '@lingui/core';
|
|
24
25
|
import {
|
|
26
|
+
getRelatedWalletOrNull,
|
|
25
27
|
type RouteEvent,
|
|
26
28
|
RouteEventType,
|
|
27
29
|
type StepEvent,
|
|
@@ -666,7 +668,8 @@ export function isNetworkStatusInWarningState(
|
|
|
666
668
|
|
|
667
669
|
export function getSwapMessages(
|
|
668
670
|
pendingSwap: PendingSwap,
|
|
669
|
-
currentStep: PendingSwapStep | null
|
|
671
|
+
currentStep: PendingSwapStep | null,
|
|
672
|
+
getWalletInfo?: (type: WalletType) => ExtendedWalletInfo
|
|
670
673
|
): {
|
|
671
674
|
shortMessage: string;
|
|
672
675
|
detailedMessage: { content: string; long: boolean };
|
|
@@ -685,10 +688,20 @@ export function getSwapMessages(
|
|
|
685
688
|
if (networkWarningState) {
|
|
686
689
|
message = pendingSwap.networkStatusExtraMessage || '';
|
|
687
690
|
detailedMessage = pendingSwap.networkStatusExtraMessageDetail || '';
|
|
691
|
+
|
|
692
|
+
const currentStepWallet = currentStep
|
|
693
|
+
? getRelatedWalletOrNull(pendingSwap, currentStep)
|
|
694
|
+
: null;
|
|
695
|
+
const walletType = currentStepWallet?.walletType;
|
|
696
|
+
const walletName = walletType ? getWalletInfo?.(walletType)?.name : null;
|
|
688
697
|
// eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check
|
|
689
698
|
switch (currentStep?.networkStatus) {
|
|
690
699
|
case PendingSwapNetworkStatus.WaitingForConnectingWallet:
|
|
691
|
-
message =
|
|
700
|
+
message = walletName
|
|
701
|
+
? i18n.t('Connect {wallet}', {
|
|
702
|
+
wallet: walletName,
|
|
703
|
+
})
|
|
704
|
+
: message;
|
|
692
705
|
break;
|
|
693
706
|
case PendingSwapNetworkStatus.WaitingForQueue:
|
|
694
707
|
message =
|