@rango-dev/widget-embedded 0.35.1-next.3 → 0.36.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/components/NoResult/NoResult.helpers.d.ts +1 -1
- package/dist/components/NoResult/NoResult.helpers.d.ts.map +1 -1
- package/dist/components/SameTokensWarning/SameTokensWarning.d.ts +3 -0
- package/dist/components/SameTokensWarning/SameTokensWarning.d.ts.map +1 -0
- package/dist/components/SameTokensWarning/SameTokensWarning.styles.d.ts +161 -0
- package/dist/components/SameTokensWarning/SameTokensWarning.styles.d.ts.map +1 -0
- package/dist/components/SameTokensWarning/index.d.ts +2 -0
- package/dist/components/SameTokensWarning/index.d.ts.map +1 -0
- package/dist/containers/Wallets/Wallets.d.ts.map +1 -1
- package/dist/hooks/useWalletList.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +4 -4
- package/dist/pages/Home.d.ts.map +1 -1
- package/dist/store/slices/config.d.ts.map +1 -1
- package/dist/types/config.d.ts +10 -0
- package/dist/types/config.d.ts.map +1 -1
- package/dist/utils/providers.d.ts +1 -0
- package/dist/utils/providers.d.ts.map +1 -1
- package/dist/widget-embedded.build.json +1 -1
- package/package.json +7 -7
- package/src/components/NoResult/NoResult.helpers.ts +2 -5
- package/src/components/SameTokensWarning/SameTokensWarning.styles.ts +7 -0
- package/src/components/SameTokensWarning/SameTokensWarning.tsx +31 -0
- package/src/components/SameTokensWarning/index.ts +1 -0
- package/src/containers/Wallets/Wallets.tsx +1 -0
- package/src/hooks/useWalletList.ts +1 -0
- package/src/pages/Home.tsx +3 -0
- package/src/store/slices/config.ts +4 -0
- package/src/types/config.ts +11 -0
- package/src/utils/providers.ts +4 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/widget-embedded",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.36.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -25,15 +25,15 @@
|
|
|
25
25
|
"@lingui/core": "4.2.1",
|
|
26
26
|
"@lingui/react": "4.2.1",
|
|
27
27
|
"@rango-dev/logging-core": "^0.6.0",
|
|
28
|
-
"@rango-dev/provider-all": "^0.
|
|
28
|
+
"@rango-dev/provider-all": "^0.40.0",
|
|
29
29
|
"@rango-dev/queue-manager-core": "^0.27.0",
|
|
30
|
-
"@rango-dev/queue-manager-rango-preset": "^0.
|
|
30
|
+
"@rango-dev/queue-manager-rango-preset": "^0.40.0",
|
|
31
31
|
"@rango-dev/queue-manager-react": "^0.27.0",
|
|
32
|
-
"@rango-dev/signer-solana": "^0.
|
|
33
|
-
"@rango-dev/ui": "^0.
|
|
32
|
+
"@rango-dev/signer-solana": "^0.35.0",
|
|
33
|
+
"@rango-dev/ui": "^0.42.0",
|
|
34
34
|
"@rango-dev/wallets-core": "^0.40.0",
|
|
35
|
-
"@rango-dev/wallets-react": "^0.
|
|
36
|
-
"@rango-dev/wallets-shared": "^0.
|
|
35
|
+
"@rango-dev/wallets-react": "^0.26.0",
|
|
36
|
+
"@rango-dev/wallets-shared": "^0.40.0",
|
|
37
37
|
"bignumber.js": "^9.1.1",
|
|
38
38
|
"copy-to-clipboard": "^3.3.3",
|
|
39
39
|
"dayjs": "^1.11.7",
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import type { Info } from './NoResult.types';
|
|
2
|
+
import type { NoResultError, QuoteRequestFailed } from '../../types';
|
|
2
3
|
|
|
3
4
|
import { i18n } from '@lingui/core';
|
|
4
5
|
|
|
5
6
|
import { errorMessages } from '../../constants/errors';
|
|
6
|
-
import {
|
|
7
|
-
type NoResultError,
|
|
8
|
-
QuoteErrorType,
|
|
9
|
-
type QuoteRequestFailed,
|
|
10
|
-
} from '../../types';
|
|
7
|
+
import { QuoteErrorType } from '../../types';
|
|
11
8
|
|
|
12
9
|
const SMALL_NO_ROUTE__ICON_SIZE = 24;
|
|
13
10
|
const LARGE_NO_ROUTE_ICON_SIZE = 60;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { i18n } from '@lingui/core';
|
|
2
|
+
import { Alert, Divider, NoRouteIcon, Typography } from '@rango-dev/ui';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
import { useQuoteStore } from '../../store/quote';
|
|
6
|
+
import { areTokensEqual } from '../../utils/wallets';
|
|
7
|
+
|
|
8
|
+
import { Container } from './SameTokensWarning.styles';
|
|
9
|
+
|
|
10
|
+
export function SameTokensWarning() {
|
|
11
|
+
const { fromToken, toToken } = useQuoteStore();
|
|
12
|
+
const showWarningMessage =
|
|
13
|
+
!!fromToken && !!toToken && areTokensEqual(fromToken, toToken);
|
|
14
|
+
|
|
15
|
+
return showWarningMessage ? (
|
|
16
|
+
<Container>
|
|
17
|
+
<Divider size={10} />
|
|
18
|
+
<NoRouteIcon size={24} color="gray" />
|
|
19
|
+
<Divider size={4} />
|
|
20
|
+
<Typography variant="title" size={'small'}>
|
|
21
|
+
{i18n.t('No Routes Found')}
|
|
22
|
+
</Typography>
|
|
23
|
+
<Divider size={4} />
|
|
24
|
+
<Alert
|
|
25
|
+
title={i18n.t('You cannot use the same token for From and To.')}
|
|
26
|
+
type={'warning'}
|
|
27
|
+
variant="alarm"
|
|
28
|
+
/>
|
|
29
|
+
</Container>
|
|
30
|
+
) : null;
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SameTokensWarning } from './SameTokensWarning';
|
|
@@ -44,6 +44,7 @@ function Main(props: PropsWithChildren<PropTypes>) {
|
|
|
44
44
|
const walletOptions: ProvidersOptions = {
|
|
45
45
|
walletConnectProjectId: config?.walletConnectProjectId,
|
|
46
46
|
trezorManifest: config?.trezorManifest,
|
|
47
|
+
tonConnect: config.tonConnect,
|
|
47
48
|
walletConnectListedDesktopWalletLink:
|
|
48
49
|
props.config.__UNSTABLE_OR_INTERNAL__
|
|
49
50
|
?.walletConnectListedDesktopWalletLink,
|
|
@@ -56,6 +56,7 @@ export function useWalletList(params?: Params): API {
|
|
|
56
56
|
walletConnectProjectId: config?.walletConnectProjectId,
|
|
57
57
|
walletConnectListedDesktopWalletLink:
|
|
58
58
|
config.__UNSTABLE_OR_INTERNAL__?.walletConnectListedDesktopWalletLink,
|
|
59
|
+
tonConnect: config.tonConnect,
|
|
59
60
|
}) || ALL_SUPPORTED_WALLETS;
|
|
60
61
|
|
|
61
62
|
let wallets = mapWalletTypesToWalletInfo(
|
package/src/pages/Home.tsx
CHANGED
|
@@ -9,6 +9,7 @@ import { useNavigate } from 'react-router-dom';
|
|
|
9
9
|
import { HeaderButtons } from '../components/HeaderButtons';
|
|
10
10
|
import { Layout, PageContainer } from '../components/Layout';
|
|
11
11
|
import { QuoteWarningsAndErrors } from '../components/QuoteWarningsAndErrors';
|
|
12
|
+
import { SameTokensWarning } from '../components/SameTokensWarning';
|
|
12
13
|
import { navigationRoutes } from '../constants/navigationRoutes';
|
|
13
14
|
import { ExpandedQuotes } from '../containers/ExpandedQuotes';
|
|
14
15
|
import { Inputs } from '../containers/Inputs';
|
|
@@ -123,6 +124,7 @@ export function Home() {
|
|
|
123
124
|
setSelectedQuote(quote);
|
|
124
125
|
}
|
|
125
126
|
};
|
|
127
|
+
|
|
126
128
|
return (
|
|
127
129
|
<MainContainer>
|
|
128
130
|
<Layout
|
|
@@ -226,6 +228,7 @@ export function Home() {
|
|
|
226
228
|
/>
|
|
227
229
|
</>
|
|
228
230
|
) : null}
|
|
231
|
+
<SameTokensWarning />
|
|
229
232
|
</PageContainer>
|
|
230
233
|
</Layout>
|
|
231
234
|
{isExpandable ? (
|
|
@@ -17,6 +17,10 @@ export const DEFAULT_CONFIG: WidgetConfig = {
|
|
|
17
17
|
appUrl: 'https://widget.rango.exchange/',
|
|
18
18
|
email: 'hi+trezorwidget@rango.exchange',
|
|
19
19
|
},
|
|
20
|
+
tonConnect: {
|
|
21
|
+
manifestUrl:
|
|
22
|
+
'https://raw.githubusercontent.com/rango-exchange/rango-types/main/assets/manifests/tonconnect-manifest.json',
|
|
23
|
+
},
|
|
20
24
|
};
|
|
21
25
|
|
|
22
26
|
interface IframeConfigs {
|
package/src/types/config.ts
CHANGED
|
@@ -170,6 +170,15 @@ export type TrezorManifest = {
|
|
|
170
170
|
email: string;
|
|
171
171
|
};
|
|
172
172
|
|
|
173
|
+
/**
|
|
174
|
+
*
|
|
175
|
+
* @property {string} manifestUrl - The URL of the TON Connect [manifest]{@link https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest}, containing the Dapp metadata to be displayed in the user’s wallet.
|
|
176
|
+
*
|
|
177
|
+
*/
|
|
178
|
+
export type TonConnectConfig = {
|
|
179
|
+
manifestUrl?: string;
|
|
180
|
+
};
|
|
181
|
+
|
|
173
182
|
/**
|
|
174
183
|
* The type WidgetConfig defines the configuration options for a widget, including API key, affiliate
|
|
175
184
|
* reference, amount, blockchain and token configurations, liquidity sources, wallet types, language,
|
|
@@ -185,6 +194,7 @@ export type TrezorManifest = {
|
|
|
185
194
|
* exchange.It can also used to limit source swap blockchains/tokens to some limited ones.
|
|
186
195
|
* @property {TrezorManifest} trezorManifest - Trezor Connect Manifest requires that you,
|
|
187
196
|
* as a Trezor Connect integrator,share your e-mail and application url.
|
|
197
|
+
* @property {TonConnectConfig} tonConnect - Configuration for TON Connect compatible providers like MyTonWallet.
|
|
188
198
|
* @property {BlockchainAndTokenConfig} to - The "to" property is an optional property of type
|
|
189
199
|
* "BlockchainAndTokenConfig" that specifies the default blockchain and token to which the user wants to
|
|
190
200
|
* exchange.It can also used to limit destination swap blockchains/tokens to some limited ones.
|
|
@@ -237,6 +247,7 @@ export type WidgetConfig = {
|
|
|
237
247
|
title?: string;
|
|
238
248
|
walletConnectProjectId?: string;
|
|
239
249
|
trezorManifest?: TrezorManifest;
|
|
250
|
+
tonConnect?: TonConnectConfig;
|
|
240
251
|
affiliate?: WidgetAffiliate;
|
|
241
252
|
amount?: number;
|
|
242
253
|
from?: BlockchainAndTokenConfig;
|
package/src/utils/providers.ts
CHANGED
|
@@ -9,6 +9,7 @@ export interface ProvidersOptions {
|
|
|
9
9
|
WidgetConfig['__UNSTABLE_OR_INTERNAL__']
|
|
10
10
|
>['walletConnectListedDesktopWalletLink'];
|
|
11
11
|
trezorManifest: WidgetConfig['trezorManifest'];
|
|
12
|
+
tonConnect: WidgetConfig['tonConnect'];
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
/**
|
|
@@ -31,6 +32,9 @@ export function matchAndGenerateProviders(
|
|
|
31
32
|
trezor: options?.trezorManifest
|
|
32
33
|
? { manifest: options.trezorManifest }
|
|
33
34
|
: undefined,
|
|
35
|
+
tonConnect: options?.tonConnect?.manifestUrl
|
|
36
|
+
? { manifestUrl: options?.tonConnect.manifestUrl }
|
|
37
|
+
: undefined,
|
|
34
38
|
});
|
|
35
39
|
|
|
36
40
|
if (providers) {
|