@rango-dev/widget-embedded 0.29.1-next.9 → 0.30.0
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/QueueManager.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +6 -0
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/WalletList.d.ts.map +1 -1
- package/dist/components/NotificationContent/NotificationContent.d.ts.map +1 -1
- package/dist/components/Quote/Quote.d.ts.map +1 -1
- package/dist/components/Quote/Quote.styles.d.ts +1 -1
- package/dist/components/Quote/QuoteCostDetails.d.ts.map +1 -1
- package/dist/components/RefreshModal/RefreshModal.styles.d.ts +1 -1
- package/dist/components/SearchInput/SearchInput.types.d.ts +2 -0
- package/dist/components/SearchInput/SearchInput.types.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.helpers.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.WalletState.d.ts.map +1 -1
- package/dist/components/WalletDerivationPathModal/WalletDerivationPathModal.d.ts +4 -0
- package/dist/components/WalletDerivationPathModal/WalletDerivationPathModal.d.ts.map +1 -0
- package/dist/components/WalletDerivationPathModal/WalletDerivationPathModal.styles.d.ts +325 -0
- package/dist/components/WalletDerivationPathModal/WalletDerivationPathModal.styles.d.ts.map +1 -0
- package/dist/components/WalletDerivationPathModal/WalletDerivationPathModal.types.d.ts +10 -0
- package/dist/components/WalletDerivationPathModal/WalletDerivationPathModal.types.d.ts.map +1 -0
- package/dist/components/WalletDerivationPathModal/index.d.ts +2 -0
- package/dist/components/WalletDerivationPathModal/index.d.ts.map +1 -0
- package/dist/components/WalletNamespacesModal/WalletNamespacesModal.d.ts.map +1 -1
- package/dist/components/WalletNamespacesModal/WalletNamespacesModal.types.d.ts +1 -1
- package/dist/components/WalletNamespacesModal/WalletNamespacesModal.types.d.ts.map +1 -1
- package/dist/constants/namespaces.d.ts +8 -0
- package/dist/constants/namespaces.d.ts.map +1 -0
- package/dist/constants/quote.d.ts +2 -1
- package/dist/constants/quote.d.ts.map +1 -1
- package/dist/constants/routing.d.ts +0 -1
- package/dist/constants/routing.d.ts.map +1 -1
- package/dist/containers/Wallets/Wallets.d.ts.map +1 -1
- package/dist/containers/WidgetInfo/WidgetInfo.d.ts.map +1 -1
- package/dist/containers/WidgetInfo/WidgetInfo.types.d.ts +3 -1
- package/dist/containers/WidgetInfo/WidgetInfo.types.d.ts.map +1 -1
- package/dist/hooks/useBootstrap/useBootstrap.d.ts.map +1 -1
- package/dist/hooks/useSubscribeToWidgetEvents/useSubscribeToWidgetEvents.d.ts.map +1 -1
- package/dist/hooks/useSyncStoresWithConfig.d.ts.map +1 -1
- package/dist/hooks/useWalletList.d.ts +4 -3
- package/dist/hooks/useWalletList.d.ts.map +1 -1
- package/dist/hooks/useWalletProviders/index.d.ts +2 -0
- package/dist/hooks/useWalletProviders/index.d.ts.map +1 -0
- package/dist/hooks/{useWalletProviders.d.ts → useWalletProviders/useWalletProviders.d.ts} +2 -2
- package/dist/hooks/useWalletProviders/useWalletProviders.d.ts.map +1 -0
- package/dist/hooks/useWalletProviders/useWalletProviders.helpers.d.ts +3 -0
- package/dist/hooks/useWalletProviders/useWalletProviders.helpers.d.ts.map +1 -0
- package/dist/hooks/useWidgetEvents/index.d.ts +2 -0
- package/dist/hooks/useWidgetEvents/index.d.ts.map +1 -0
- package/dist/hooks/useWidgetEvents/useWidgetEvents.d.ts +3 -0
- package/dist/hooks/useWidgetEvents/useWidgetEvents.d.ts.map +1 -0
- package/dist/index.d.ts +16 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +4 -4
- package/dist/pages/WalletsPage.d.ts.map +1 -1
- package/dist/services/eventEmitter.d.ts +4 -0
- package/dist/services/eventEmitter.d.ts.map +1 -0
- package/dist/store/notification.d.ts.map +1 -1
- package/dist/store/quote.d.ts +2 -1
- package/dist/store/quote.d.ts.map +1 -1
- package/dist/store/slices/config.d.ts.map +1 -1
- package/dist/store/slices/settings.d.ts.map +1 -1
- package/dist/store/wallets.d.ts.map +1 -1
- package/dist/types/config.d.ts +7 -2
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/event.d.ts +68 -0
- package/dist/types/event.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/wallets.d.ts +2 -1
- package/dist/types/wallets.d.ts.map +1 -1
- package/dist/utils/common.d.ts +2 -2
- package/dist/utils/common.d.ts.map +1 -1
- package/dist/utils/meta.d.ts +1 -0
- package/dist/utils/meta.d.ts.map +1 -1
- package/dist/utils/numbers.d.ts +0 -1
- package/dist/utils/numbers.d.ts.map +1 -1
- package/dist/utils/providers.d.ts +1 -0
- package/dist/utils/providers.d.ts.map +1 -1
- package/dist/utils/wallets.d.ts +4 -4
- package/dist/utils/wallets.d.ts.map +1 -1
- package/dist/widget-embedded.build.json +1 -1
- package/package.json +8 -8
- package/src/QueueManager.tsx +4 -0
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +19 -9
- package/src/components/ConfirmWalletsModal/WalletList.tsx +81 -14
- package/src/components/HistoryGroupedList/HistoryGroupedList.tsx +5 -5
- package/src/components/NotificationContent/NotificationContent.tsx +12 -113
- package/src/components/Quote/Quote.tsx +24 -34
- package/src/components/Quote/QuoteCostDetails.tsx +10 -9
- package/src/components/SearchInput/SearchInput.types.ts +2 -0
- package/src/components/SwapDetails/SwapDetails.Placeholder.tsx +1 -1
- package/src/components/SwapDetails/SwapDetails.helpers.tsx +8 -10
- package/src/components/SwapDetails/SwapDetails.tsx +10 -11
- package/src/components/SwapDetailsModal/SwapDetailsModal.WalletState.tsx +77 -11
- package/src/components/TokenList/TokenList.tsx +5 -5
- package/src/components/WalletDerivationPathModal/WalletDerivationPathModal.styles.ts +17 -0
- package/src/components/WalletDerivationPathModal/WalletDerivationPathModal.tsx +154 -0
- package/src/components/WalletDerivationPathModal/WalletDerivationPathModal.types.tsx +10 -0
- package/src/components/WalletDerivationPathModal/index.ts +1 -0
- package/src/components/WalletNamespacesModal/WalletNamespacesModal.tsx +9 -6
- package/src/components/WalletNamespacesModal/WalletNamespacesModal.types.tsx +1 -1
- package/src/constants/namespaces.ts +62 -0
- package/src/constants/quote.ts +11 -9
- package/src/constants/routing.ts +0 -2
- package/src/containers/Inputs/Inputs.tsx +5 -5
- package/src/containers/Wallets/Wallets.tsx +1 -0
- package/src/containers/WidgetInfo/WidgetInfo.tsx +3 -0
- package/src/containers/WidgetInfo/WidgetInfo.types.ts +3 -1
- package/src/hooks/useBootstrap/useBootstrap.ts +4 -0
- package/src/hooks/useSubscribeToWidgetEvents/useSubscribeToWidgetEvents.ts +8 -10
- package/src/hooks/useSyncStoresWithConfig.ts +3 -1
- package/src/hooks/useWalletList.ts +12 -5
- package/src/hooks/useWalletProviders/index.ts +1 -0
- package/src/hooks/useWalletProviders/useWalletProviders.helpers.ts +14 -0
- package/src/hooks/{useWalletProviders.ts → useWalletProviders/useWalletProviders.ts} +11 -5
- package/src/hooks/useWidgetEvents/index.ts +1 -0
- package/src/hooks/useWidgetEvents/useWidgetEvents.ts +9 -0
- package/src/index.ts +26 -2
- package/src/pages/WalletsPage.tsx +85 -19
- package/src/services/eventEmitter.ts +11 -0
- package/src/store/notification.ts +3 -1
- package/src/store/quote.ts +70 -5
- package/src/store/slices/config.ts +4 -0
- package/src/store/slices/settings.ts +4 -1
- package/src/store/wallets.ts +194 -173
- package/src/types/config.ts +8 -4
- package/src/types/event.ts +89 -0
- package/src/types/index.ts +1 -0
- package/src/types/wallets.ts +2 -1
- package/src/utils/common.ts +2 -2
- package/src/utils/meta.ts +8 -0
- package/src/utils/numbers.ts +0 -12
- package/src/utils/providers.ts +4 -0
- package/src/utils/wallets.ts +7 -5
- package/dist/components/NotificationContent/NotificationContent.styles.d.ts +0 -1559
- package/dist/components/NotificationContent/NotificationContent.styles.d.ts.map +0 -1
- package/dist/components/NotificationContent/NotificationNotFound.d.ts +0 -3
- package/dist/components/NotificationContent/NotificationNotFound.d.ts.map +0 -1
- package/dist/hooks/useWalletProviders.d.ts.map +0 -1
- package/src/components/NotificationContent/NotificationContent.styles.ts +0 -63
- package/src/components/NotificationContent/NotificationNotFound.tsx +0 -17
package/src/types/index.ts
CHANGED
package/src/types/wallets.ts
CHANGED
|
@@ -24,7 +24,8 @@ export type TokensBalance = {
|
|
|
24
24
|
[key: TokenHash]: Balance;
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
export type
|
|
27
|
+
export type WalletInfoWithExtra = WalletInfo & {
|
|
28
28
|
namespaces?: Namespace[];
|
|
29
29
|
singleNamespace?: boolean;
|
|
30
|
+
needsDerivationPath?: boolean;
|
|
30
31
|
};
|
package/src/utils/common.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { WalletInfoWithExtra } from '../types';
|
|
2
2
|
import type { Token } from 'rango-sdk';
|
|
3
3
|
|
|
4
4
|
import { BlockchainCategories, WalletState } from '@rango-dev/ui';
|
|
@@ -250,7 +250,7 @@ export const getFontUrlByName = (fontName: string) => {
|
|
|
250
250
|
};
|
|
251
251
|
|
|
252
252
|
export function isSingleWalletActive(
|
|
253
|
-
wallets:
|
|
253
|
+
wallets: WalletInfoWithExtra[],
|
|
254
254
|
multiWallets?: boolean
|
|
255
255
|
) {
|
|
256
256
|
const atLeastOneWalletIsConnected = !!wallets.find(
|
package/src/utils/meta.ts
CHANGED
|
@@ -16,6 +16,14 @@ export function getBlockchainShortNameFor(
|
|
|
16
16
|
?.shortName;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
export function getBlockchainImage(
|
|
20
|
+
blockchainName: string,
|
|
21
|
+
blockchains: BlockchainMeta[]
|
|
22
|
+
): string | undefined {
|
|
23
|
+
return blockchains.find((blockchain) => blockchain.name === blockchainName)
|
|
24
|
+
?.logo;
|
|
25
|
+
}
|
|
26
|
+
|
|
19
27
|
export function getSwapperDisplayName(
|
|
20
28
|
swapperId: string,
|
|
21
29
|
swappers: SwapperMeta[]
|
package/src/utils/numbers.ts
CHANGED
|
@@ -4,8 +4,6 @@ import type { BestRouteResponse } from 'rango-sdk';
|
|
|
4
4
|
|
|
5
5
|
import { BigNumber } from 'bignumber.js';
|
|
6
6
|
|
|
7
|
-
import { TOOLTIP_DECIMALS } from '../constants/routing';
|
|
8
|
-
|
|
9
7
|
/*
|
|
10
8
|
* if time > 1h -> rounded with 5 minutes precision
|
|
11
9
|
* if time < 1h -> rounded with 15 seconds precision
|
|
@@ -127,13 +125,3 @@ export const containsText = (text: string, searchText: string) =>
|
|
|
127
125
|
|
|
128
126
|
export const isPositiveNumber = (text?: string) =>
|
|
129
127
|
!!text && parseFloat(text) > 0;
|
|
130
|
-
10;
|
|
131
|
-
|
|
132
|
-
export function formatTooltipNumbers(
|
|
133
|
-
number: BigNumber | string | number | null | undefined
|
|
134
|
-
) {
|
|
135
|
-
return numberToString(number, TOOLTIP_DECIMALS, TOOLTIP_DECIMALS).replace(
|
|
136
|
-
/(?:\.0*|(\.\d+?)0*)$/,
|
|
137
|
-
'$1'
|
|
138
|
-
);
|
|
139
|
-
}
|
package/src/utils/providers.ts
CHANGED
|
@@ -8,6 +8,7 @@ export interface ProvidersOptions {
|
|
|
8
8
|
walletConnectListedDesktopWalletLink?: NonNullable<
|
|
9
9
|
WidgetConfig['__UNSTABLE_OR_INTERNAL__']
|
|
10
10
|
>['walletConnectListedDesktopWalletLink'];
|
|
11
|
+
trezorManifest: WidgetConfig['trezorManifest'];
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
/**
|
|
@@ -27,6 +28,9 @@ export function matchAndGenerateProviders(
|
|
|
27
28
|
options?.walletConnectListedDesktopWalletLink,
|
|
28
29
|
},
|
|
29
30
|
selectedProviders: providers,
|
|
31
|
+
trezor: options?.trezorManifest
|
|
32
|
+
? { manifest: options.trezorManifest }
|
|
33
|
+
: undefined,
|
|
30
34
|
});
|
|
31
35
|
|
|
32
36
|
if (providers) {
|
package/src/utils/wallets.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type {
|
|
|
5
5
|
SelectedQuote,
|
|
6
6
|
TokensBalance,
|
|
7
7
|
Wallet,
|
|
8
|
-
|
|
8
|
+
WalletInfoWithExtra,
|
|
9
9
|
} from '../types';
|
|
10
10
|
import type { WalletInfo as ModalWalletInfo } from '@rango-dev/ui';
|
|
11
11
|
import type {
|
|
@@ -68,7 +68,7 @@ export function mapWalletTypesToWalletInfo(
|
|
|
68
68
|
getWalletInfo: (type: WalletType) => WalletInfo,
|
|
69
69
|
list: WalletType[],
|
|
70
70
|
chain?: string
|
|
71
|
-
):
|
|
71
|
+
): WalletInfoWithExtra[] {
|
|
72
72
|
return list
|
|
73
73
|
.filter((wallet) => !EXCLUDED_WALLETS.includes(wallet as WalletTypes))
|
|
74
74
|
.filter((wallet) => {
|
|
@@ -96,6 +96,7 @@ export function mapWalletTypesToWalletInfo(
|
|
|
96
96
|
namespaces,
|
|
97
97
|
singleNamespace,
|
|
98
98
|
supportedChains,
|
|
99
|
+
needsDerivationPath,
|
|
99
100
|
} = getWalletInfo(type);
|
|
100
101
|
const blockchainTypes = removeDuplicateFrom(
|
|
101
102
|
supportedChains.map((item) => item.type)
|
|
@@ -112,6 +113,7 @@ export function mapWalletTypesToWalletInfo(
|
|
|
112
113
|
namespaces,
|
|
113
114
|
singleNamespace,
|
|
114
115
|
blockchainTypes,
|
|
116
|
+
needsDerivationPath,
|
|
115
117
|
};
|
|
116
118
|
});
|
|
117
119
|
}
|
|
@@ -434,8 +436,8 @@ export function areTokensEqual(
|
|
|
434
436
|
}
|
|
435
437
|
|
|
436
438
|
export function sortWalletsBasedOnConnectionState(
|
|
437
|
-
wallets:
|
|
438
|
-
):
|
|
439
|
+
wallets: WalletInfoWithExtra[]
|
|
440
|
+
): WalletInfoWithExtra[] {
|
|
439
441
|
return wallets.sort(
|
|
440
442
|
(a, b) =>
|
|
441
443
|
Number(b.state === WalletStatus.CONNECTED) -
|
|
@@ -549,7 +551,7 @@ export function filterBlockchainsByWalletTypes(
|
|
|
549
551
|
}
|
|
550
552
|
|
|
551
553
|
export function filterWalletsByCategory(
|
|
552
|
-
wallets:
|
|
554
|
+
wallets: WalletInfoWithExtra[],
|
|
553
555
|
category: string
|
|
554
556
|
) {
|
|
555
557
|
if (category === BlockchainCategories.ALL) {
|