@rango-dev/widget-embedded 0.17.1-next.31 → 0.17.1-next.32

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rango-dev/widget-embedded",
3
- "version": "0.17.1-next.31",
3
+ "version": "0.17.1-next.32",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "source": "./src/index.ts",
@@ -25,7 +25,7 @@
25
25
  "@rango-dev/queue-manager-core": "^0.22.1-next.3",
26
26
  "@rango-dev/queue-manager-rango-preset": "^0.22.1-next.12",
27
27
  "@rango-dev/queue-manager-react": "^0.22.1-next.3",
28
- "@rango-dev/ui": "^0.22.1-next.18",
28
+ "@rango-dev/ui": "^0.22.1-next.19",
29
29
  "@rango-dev/wallets-react": "^0.8.1-next.6",
30
30
  "@rango-dev/wallets-shared": "^0.21.1-next.6",
31
31
  "bignumber.js": "^9.1.1",
@@ -1,30 +1,36 @@
1
1
  import type { WalletStateContentProps } from './SwapDetailsModal.types';
2
2
 
3
- import { MessageBox, Wallet, WalletState } from '@rango-dev/ui';
3
+ import { MessageBox, Wallet } from '@rango-dev/ui';
4
4
  import { useWallets } from '@rango-dev/wallets-react';
5
5
  import React from 'react';
6
6
 
7
7
  import { getContainer } from '../../utils/common';
8
+ import { mapStatusToWalletState } from '../../utils/wallets';
8
9
 
9
10
  import { WalletContainer } from './SwapDetailsModal.styles';
10
11
 
11
12
  export const WalletStateContent = (props: WalletStateContentProps) => {
12
13
  const { type, title, currentStepWallet, message, showWalletButton } = props;
13
- const { connect, getWalletInfo, state: walletState } = useWallets();
14
+ const { connect, getWalletInfo, state } = useWallets();
14
15
  const walletType = currentStepWallet?.walletType;
15
- const isConnected = walletType && walletState(walletType).connected;
16
- const state = isConnected ? WalletState.CONNECTED : WalletState.DISCONNECTED;
16
+ const walletState = walletType
17
+ ? mapStatusToWalletState(state(walletType))
18
+ : null;
19
+ const walletInfo = walletType ? getWalletInfo(walletType) : null;
20
+ const shouldShowWallet =
21
+ showWalletButton && !!walletType && !!walletState && !!walletInfo;
17
22
  return (
18
23
  <>
19
24
  <MessageBox type={type} title={title} description={message} />
20
- {showWalletButton && walletType && (
25
+ {shouldShowWallet && (
21
26
  <WalletContainer>
22
27
  <Wallet
23
28
  container={getContainer()}
24
- title={getWalletInfo(walletType).name}
25
- image={getWalletInfo(walletType).img}
29
+ title={walletInfo.name}
30
+ image={walletInfo.img}
26
31
  type={walletType}
27
- state={state}
32
+ state={walletState}
33
+ link={walletInfo.installLink}
28
34
  onClick={async () => connect(walletType)}
29
35
  />
30
36
  </WalletContainer>