@rango-dev/widget-embedded 0.60.2-next.1 → 0.60.2-next.10

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.60.2-next.1",
3
+ "version": "0.60.2-next.10",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "source": "./src/index.ts",
@@ -27,16 +27,16 @@
27
27
  "@hub3js/std": "^0.1.1",
28
28
  "@lingui/core": "4.2.1",
29
29
  "@lingui/react": "4.2.1",
30
- "@rango-dev/logging-core": "^0.12.1",
31
- "@rango-dev/provider-all": "^0.62.2-next.1",
30
+ "@rango-dev/logging-core": "^0.12.2-next.0",
31
+ "@rango-dev/provider-all": "^0.62.2-next.6",
32
32
  "@rango-dev/queue-manager-core": "^0.33.0",
33
- "@rango-dev/queue-manager-rango-preset": "^0.62.1-next.1",
33
+ "@rango-dev/queue-manager-rango-preset": "^0.62.1-next.5",
34
34
  "@rango-dev/queue-manager-react": "^0.33.0",
35
35
  "@rango-dev/signer-solana": "^0.48.0",
36
- "@rango-dev/ui": "^0.63.1-next.1",
37
- "@rango-dev/wallets-core": "^0.59.1-next.0",
38
- "@rango-dev/wallets-react": "^0.46.1-next.1",
39
- "@rango-dev/wallets-shared": "^0.60.1-next.1",
36
+ "@rango-dev/ui": "^0.63.1-next.4",
37
+ "@rango-dev/wallets-core": "^0.59.1-next.2",
38
+ "@rango-dev/wallets-react": "^0.46.1-next.4",
39
+ "@rango-dev/wallets-shared": "^0.60.1-next.3",
40
40
  "bignumber.js": "^9.1.1",
41
41
  "copy-to-clipboard": "^3.3.3",
42
42
  "crypto-browserify": "^3.12.1",
@@ -13,10 +13,10 @@ import React from 'react';
13
13
 
14
14
  import { DEFAULT_TOKEN_IMAGE_SRC } from '../../constants/customTokens';
15
15
  import { getContainer } from '../../utils/common';
16
+ import { createTokenExplorerUrl } from '../../utils/meta';
16
17
  import { WatermarkedModal } from '../common/WatermarkedModal';
17
18
 
18
19
  import { CUSTOM_TOKEN_LEARN_MORE_LINK } from './CustomTokenModal.constants';
19
- import { generateExplorerLink } from './CustomTokenModal.helpers';
20
20
  import {
21
21
  Container,
22
22
  FlexCenteredContainer,
@@ -29,7 +29,12 @@ const MAX_SYMBOL_LENGTH_THRESHOLD = 9;
29
29
  export function CustomTokenModal(props: PropTypes) {
30
30
  const { open, onClose, token, onExit, onSubmitClick, blockchain } = props;
31
31
 
32
- const explorerLink = generateExplorerLink(token.address, blockchain);
32
+ const explorerLink = token.address
33
+ ? createTokenExplorerUrl({
34
+ contractAddress: token.address,
35
+ blockchainMeta: blockchain,
36
+ })
37
+ : undefined;
33
38
 
34
39
  const onClickLearnMore = () =>
35
40
  window.open(CUSTOM_TOKEN_LEARN_MORE_LINK, '_blank');
@@ -25,7 +25,7 @@ import { useAppStore } from '../../store/AppStore';
25
25
  import { useQuoteStore } from '../../store/quote';
26
26
  import { createTintsAndShades } from '../../utils/colors';
27
27
  import { getContainer } from '../../utils/common';
28
- import { findBlockchain } from '../../utils/meta';
28
+ import { createTokenExplorerUrl, findBlockchain } from '../../utils/meta';
29
29
  import { formatBalance } from '../../utils/wallets';
30
30
  import { ImportCustomToken } from '../ImportCustomToken';
31
31
 
@@ -81,8 +81,7 @@ const renderDesc = (props: RenderDescProps) => {
81
81
  <div
82
82
  className={`${tokenAddressStyles()} ${
83
83
  !name && tokenWithoutNameStyles()
84
- }`}
85
- >
84
+ }`}>
86
85
  {length > 10
87
86
  ? `${address.slice(0, 5)}...${address.slice(length - 6, length)}`
88
87
  : address}{' '}
@@ -91,8 +90,7 @@ const renderDesc = (props: RenderDescProps) => {
91
90
  href={url}
92
91
  target="_blank"
93
92
  rel="nofollow noreferrer"
94
- onClick={(e) => e.stopPropagation()}
95
- >
93
+ onClick={(e) => e.stopPropagation()}>
96
94
  <ExternalLinkIcon size={12} />
97
95
  </StyledLink>
98
96
  </div>
@@ -153,8 +151,7 @@ export function TokenList(props: PropTypes) {
153
151
  type="primary"
154
152
  size="small"
155
153
  className="widget-token-list-item-import-btn"
156
- onClick={handleClick}
157
- >
154
+ onClick={handleClick}>
158
155
  <Typography variant="body" size="xsmall" color="background">
159
156
  {t('import')}
160
157
  </Typography>
@@ -187,8 +184,7 @@ export function TokenList(props: PropTypes) {
187
184
  <Typography
188
185
  variant="body"
189
186
  className={usdValueStyles()}
190
- size="xsmall"
191
- >
187
+ size="xsmall">
192
188
  {`$${tokenBalance.usdValue}`}
193
189
  </Typography>
194
190
  )}
@@ -266,6 +262,13 @@ export function TokenList(props: PropTypes) {
266
262
  }
267
263
  };
268
264
 
265
+ const url = address
266
+ ? createTokenExplorerUrl({
267
+ contractAddress: address,
268
+ blockchainMeta: blockchain,
269
+ })
270
+ : undefined;
271
+
269
272
  return (
270
273
  <ListItemContainer>
271
274
  <StyledListItemButton
@@ -306,8 +309,7 @@ export function TokenList(props: PropTypes) {
306
309
  <TagTitle
307
310
  variant="body"
308
311
  size="xsmall"
309
- css={customCssForTagTitle}
310
- >
312
+ css={customCssForTagTitle}>
311
313
  {token.blockchain}
312
314
  </TagTitle>
313
315
  </Tag>
@@ -321,16 +323,17 @@ export function TokenList(props: PropTypes) {
321
323
  ) : undefined
322
324
  }
323
325
  description={
324
- typeof token !== 'string' && !!blockchain.info && !!address
326
+ typeof token !== 'string' &&
327
+ !!blockchain.info &&
328
+ !!address &&
329
+ !!url
325
330
  ? renderDesc({
326
331
  address,
327
332
  token,
328
333
  customCssForTag,
329
334
  customCssForTagTitle,
330
335
  name: token.name,
331
- url: blockchain.info.addressUrl
332
- .split('{wallet}')
333
- .join(address),
336
+ url,
334
337
  })
335
338
  : token.name || undefined
336
339
  }
@@ -161,7 +161,7 @@ export function Detached(props: PropTypes) {
161
161
  <MessageBox
162
162
  type="info"
163
163
  title={i18n.t(`Connect {wallet}`, {
164
- wallet: targetWallet.type,
164
+ wallet: targetWallet.title,
165
165
  })}
166
166
  description={i18n.t(
167
167
  'This wallet supports multiple chains. Choose which chains you’d like to connect or disconnect.'
@@ -109,6 +109,9 @@ function Main(props: PropsWithChildren<PropTypes>) {
109
109
  [WalletTypes.TON_CONNECT]: {
110
110
  provider: { manifestUrl: config.tonConnect?.manifestUrl },
111
111
  },
112
+ [WalletTypes.TREZOR]: {
113
+ provider: { manifest: config.trezorManifest },
114
+ },
112
115
  },
113
116
  }}>
114
117
  {props.children}
@@ -93,9 +93,6 @@ function generateProviders(config: WidgetConfig) {
93
93
  options?.walletConnectListedDesktopWalletLink,
94
94
  },
95
95
  selectedProviders: config.wallets,
96
- trezor: options?.trezorManifest
97
- ? { manifest: options.trezorManifest }
98
- : undefined,
99
96
  tonConnect: options?.tonConnect?.manifestUrl
100
97
  ? { manifestUrl: options?.tonConnect.manifestUrl }
101
98
  : undefined,
package/src/utils/meta.ts CHANGED
@@ -70,3 +70,16 @@ export function isValidTokenAddress(
70
70
  const valid = regex.filter((r) => new RegExp(r).test(address)).length > 0;
71
71
  return valid;
72
72
  }
73
+
74
+ export function createTokenExplorerUrl(params: {
75
+ contractAddress: string;
76
+ blockchainMeta: BlockchainMeta;
77
+ }): string | undefined {
78
+ const { contractAddress, blockchainMeta } = params;
79
+
80
+ if (blockchainMeta.info?.tokenUrl) {
81
+ return blockchainMeta.info.tokenUrl.replace('{address}', contractAddress);
82
+ }
83
+
84
+ return blockchainMeta.info?.addressUrl.replace('{wallet}', contractAddress);
85
+ }
@@ -23,6 +23,7 @@ import {
23
23
  import { legacyReadAccountAddress as readAccountAddress } from '@rango-dev/wallets-core/legacy';
24
24
  import {
25
25
  detectInstallLink,
26
+ HYPERLIQUID_SIGN_NETWORK,
26
27
  isEvmAddress,
27
28
  Networks,
28
29
  } from '@rango-dev/wallets-shared';
@@ -223,6 +224,14 @@ export function prepareAccountsForWalletStore(
223
224
  */
224
225
  addAccount(network, address.toLowerCase());
225
226
  });
227
+
228
+ const shouldAddHyperliquidAccount = evmChainsSupportedByWallet.includes(
229
+ HYPERLIQUID_SIGN_NETWORK
230
+ );
231
+
232
+ if (shouldAddHyperliquidAccount) {
233
+ addAccount(Networks.HYPERLIQUID, address.toLowerCase());
234
+ }
226
235
  }
227
236
  } else {
228
237
  addAccount(network, address);
@@ -1,3 +0,0 @@
1
- import type { BlockchainMeta } from 'rango-types';
2
- export declare function generateExplorerLink(address: string | null, blockchain: BlockchainMeta): string;
3
- //# sourceMappingURL=CustomTokenModal.helpers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CustomTokenModal.helpers.d.ts","sourceRoot":"","sources":["../../../src/components/CustomTokenModal/CustomTokenModal.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,GAAG,IAAI,EACtB,UAAU,EAAE,cAAc,GACzB,MAAM,CAQR"}
@@ -1,14 +0,0 @@
1
- import type { BlockchainMeta } from 'rango-types';
2
-
3
- export function generateExplorerLink(
4
- address: string | null,
5
- blockchain: BlockchainMeta
6
- ): string {
7
- const explorerLinkPattern = blockchain.info?.addressUrl;
8
-
9
- if (!explorerLinkPattern || !address) {
10
- return '';
11
- }
12
-
13
- return explorerLinkPattern.replace('{wallet}', address);
14
- }