@rango-dev/widget-embedded 0.28.1 → 0.28.2-next.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/CHANGELOG.md +4 -0
- package/dist/components/BlockchainList/BlockchainList.helpers.d.ts +1 -2
- package/dist/components/BlockchainList/BlockchainList.helpers.d.ts.map +1 -1
- package/dist/constants/fonts.d.ts +5 -0
- package/dist/constants/fonts.d.ts.map +1 -1
- package/dist/containers/WidgetProvider/WidgetProvider.d.ts.map +1 -1
- package/dist/globalStyles.d.ts.map +1 -1
- package/dist/hooks/useFontLoader.d.ts +5 -0
- package/dist/hooks/useFontLoader.d.ts.map +1 -0
- package/dist/hooks/useTheme.d.ts.map +1 -1
- package/dist/index.d.ts +2 -1
- 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/types/config.d.ts +5 -1
- package/dist/types/config.d.ts.map +1 -1
- package/dist/utils/common.d.ts +3 -0
- package/dist/utils/common.d.ts.map +1 -1
- package/dist/utils/configs.d.ts +0 -1
- package/dist/utils/configs.d.ts.map +1 -1
- package/dist/utils/wallets.d.ts +2 -0
- package/dist/utils/wallets.d.ts.map +1 -1
- package/package.json +8 -7
- package/src/components/BlockchainList/BlockchainList.helpers.ts +6 -25
- package/src/components/ConfirmWalletsModal/ConfirmWallets.styles.ts +4 -4
- package/src/components/HeaderButtons/HeaderButtons.styles.ts +1 -1
- package/src/components/Quote/Quote.styles.ts +1 -1
- package/src/components/Slippage/Slippage.tsx +1 -1
- package/src/constants/fonts.ts +84 -0
- package/src/containers/WidgetProvider/WidgetProvider.tsx +20 -2
- package/src/globalStyles.ts +1 -3
- package/src/hooks/useBootstrap/useBootstrap.ts +1 -1
- package/src/hooks/useFontLoader.ts +40 -0
- package/src/hooks/useTheme.ts +1 -1
- package/src/index.ts +2 -0
- package/src/pages/SelectBlockchainPage.tsx +3 -3
- package/src/pages/WalletsPage.tsx +34 -2
- package/src/types/config.ts +6 -1
- package/src/utils/common.ts +29 -0
- package/src/utils/configs.ts +0 -1
- package/src/utils/wallets.ts +53 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WalletsPage.d.ts","sourceRoot":"","sources":["../../src/pages/WalletsPage.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"WalletsPage.d.ts","sourceRoot":"","sources":["../../src/pages/WalletsPage.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAkCxC,eAAO,MAAM,mBAAmB,OAAQ,CAAC;AACzC,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAExC,wBAAgB,WAAW,sBAyH1B"}
|
package/dist/types/config.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ export type WidgetColors = {
|
|
|
25
25
|
* radius, width, and height.
|
|
26
26
|
* @property {'auto' | 'light' | 'dark'} mode - The mode property is used to specify the default theme for
|
|
27
27
|
* the widget.
|
|
28
|
-
* @property {string} fontFamily - The font family to be used in the widget.
|
|
28
|
+
* @property {string} fontFamily - The font family to be used in the widget. If you want to do this, include the font of your choice in your HTML file.
|
|
29
29
|
* @property {{ light?: WidgetColors; dark?: WidgetColors }} colors - The `colors` property is a sub-property of the `WidgetTheme` object that
|
|
30
30
|
* defines the color scheme for the widget. It is of type `Colors`, which is likely another object that
|
|
31
31
|
* contains specific color values for various parts of the widget (e.g. background color, text color,
|
|
@@ -102,6 +102,9 @@ export type BlockchainAndTokenConfig = {
|
|
|
102
102
|
[blockchain: string]: Tokens;
|
|
103
103
|
};
|
|
104
104
|
};
|
|
105
|
+
export type SignersConfig = {
|
|
106
|
+
customSolanaRPC?: string;
|
|
107
|
+
};
|
|
105
108
|
/**
|
|
106
109
|
* `Features`
|
|
107
110
|
*
|
|
@@ -196,5 +199,6 @@ export type WidgetConfig = {
|
|
|
196
199
|
features?: Features;
|
|
197
200
|
variant?: WidgetVariant;
|
|
198
201
|
enableCentralizedSwappers?: boolean;
|
|
202
|
+
signers?: SignersConfig;
|
|
199
203
|
};
|
|
200
204
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAEvC,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,UAAU,GAAG,eAAe,CAAC;AAErE;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,YAAY,CAAC;AAClD,MAAM,MAAM,YAAY,GAAG;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,YAAY,CAAC;QAAC,IAAI,CAAC,EAAE,YAAY,CAAA;KAAE,CAAC;IACvD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM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ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Token } from 'rango-sdk';
|
|
2
|
+
import { TransactionType } from 'rango-sdk';
|
|
2
3
|
export declare function removeDuplicateFrom<T>(array: T[]): T[];
|
|
3
4
|
export declare function areEqual(array1: (number | string)[], array2: (number | string)[]): boolean;
|
|
4
5
|
export declare function debounce(fn: Function, time: number): (...args: any) => void;
|
|
@@ -8,4 +9,6 @@ export declare function startWithText(text: string, searchText: string): boolean
|
|
|
8
9
|
export declare const getContainer: () => HTMLElement;
|
|
9
10
|
export declare const getExpanded: () => HTMLElement;
|
|
10
11
|
export declare function compareWithSearchFor(tokenA: Token, tokenB: Token, searchFor?: string): number;
|
|
12
|
+
export declare const isBlockchainTypeInCategory: (blockchainType: TransactionType, category: string) => boolean;
|
|
13
|
+
export declare const getFontUrlByName: (fontName: string) => string | undefined;
|
|
11
14
|
//# sourceMappingURL=common.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/utils/common.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/utils/common.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAGvC,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAY5C,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAEtD;AAED,wBAAgB,QAAQ,CACtB,MAAM,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,EAC3B,MAAM,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,WAK5B;AAED,wBAAgB,QAAQ,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,aAGvB,GAAG,UAS9B;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAGtE;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAEnE;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAEvE;AAED,eAAO,MAAM,YAAY,mBACyC,CAAC;AAEnE,eAAO,MAAM,WAAW,mBAC8C,CAAC;AAsDvE,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,KAAK,EACb,MAAM,EAAE,KAAK,EACb,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CA0GR;AAED,eAAO,MAAM,0BAA0B,mBACrB,eAAe,YACrB,MAAM,KACf,OAeF,CAAC;AAEF,eAAO,MAAM,gBAAgB,aAAc,MAAM,uBAGhD,CAAC"}
|
package/dist/utils/configs.d.ts
CHANGED
|
@@ -15,7 +15,6 @@ export declare function setConfig(name: keyof Configs, value: any): any;
|
|
|
15
15
|
export declare function initConfig(nextConfigs: Configs): Configs;
|
|
16
16
|
export declare const DEFAULT_PRIMARY_RADIUS = 20;
|
|
17
17
|
export declare const DEFAULT_SECONDARY_RADIUS = 25;
|
|
18
|
-
export declare const DEFAULT_FONT_FAMILY = "Roboto";
|
|
19
18
|
export declare const THEME_CLASS_NAME_PREFIX = "theme-widget";
|
|
20
19
|
export declare const isTokenExcludedInConfig: (token: Token | null, tokensConfig?: TokensConfig) => boolean;
|
|
21
20
|
export declare const isBlockchainExcludedInConfig: (blockchain: BlockchainMeta | null, blockchainsConfig?: string[]) => boolean | null | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configs.d.ts","sourceRoot":"","sources":["../../src/utils/configs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,KAAK,EAA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E3C,eAAO,MAAM,uBAAuB,iBAAiB,CAAC;AAEtD,eAAO,MAAM,uBAAuB,UAC3B,KAAK,GAAG,IAAI,iBACJ,YAAY,YAe5B,CAAC;AAEF,eAAO,MAAM,4BAA4B,eAC3B,cAAc,GAAG,IAAI,sBACb,MAAM,EAAE,+BAO7B,CAAC;AAEF,eAAO,MAAM,mBAAmB,kBACf,OAAO,sBACF,OAAO,YACjB,aAAa,YAMxB,CAAC"}
|
package/dist/utils/wallets.d.ts
CHANGED
|
@@ -33,4 +33,6 @@ export declare function createTokenHash(token: Asset): TokenHash;
|
|
|
33
33
|
export declare function makeTokensBalance(connectedWallets: ConnectedWallet[]): TokensBalance;
|
|
34
34
|
export declare const isFetchingBalance: (connectedWallets: ConnectedWallet[], blockchain: string) => boolean;
|
|
35
35
|
export declare function hashWalletsState(walletsInfo: ModalWalletInfo[]): string;
|
|
36
|
+
export declare function filterBlockchainsByWalletTypes(wallets: ModalWalletInfo[], blockchains: BlockchainMeta[]): BlockchainMeta[];
|
|
37
|
+
export declare function filterWalletsByCategory(wallets: WalletInfoWithNamespaces[], category: string): WalletInfoWithNamespaces[];
|
|
36
38
|
//# sourceMappingURL=wallets.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallets.d.ts","sourceRoot":"","sources":["../../src/utils/wallets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,KAAK,EACV,OAAO,EACP,aAAa,EACb,SAAS,EACT,aAAa,EACb,MAAM,EACN,wBAAwB,EACzB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,UAAU,IAAI,eAAe,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,KAAK,EACV,KAAK,EACL,OAAO,EACP,UAAU,EACV,WAAW,EACX,UAAU,EAEX,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":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,UAAU,CAAC,EACzB,KAAK,EACL,gBAAgB,EAChB,UAAU,GACX,EAAE;IACD,gBAAgB,EAAE,eAAe,EAAE,CAAC;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf,GAAG,MAAM,GAAG,SAAS,CAMrB;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS,CAEvD;AAED,wBAAgB,iBAAiB,CAAC,gBAAgB,EAAE,eAAe,EAAE,iBAmCpE;AAED,eAAO,MAAM,iBAAiB,qBACV,eAAe,EAAE,cACvB,MAAM,YAIjB,CAAC;AAEJ,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,eAAe,EAAE,UAE9D;AAED,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,eAAe,EAAE,EAC1B,WAAW,EAAE,cAAc,EAAE,oBAa9B;AAED,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,wBAAwB,EAAE,EACnC,QAAQ,EAAE,MAAM,8BAcjB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/widget-embedded",
|
|
3
|
-
"version": "0.28.
|
|
3
|
+
"version": "0.28.2-next.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -24,14 +24,15 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@lingui/core": "4.2.1",
|
|
26
26
|
"@lingui/react": "4.2.1",
|
|
27
|
-
"@rango-dev/logging-core": "^0.3.0",
|
|
28
|
-
"@rango-dev/provider-all": "^0.33.
|
|
27
|
+
"@rango-dev/logging-core": "^0.3.1-next.0",
|
|
28
|
+
"@rango-dev/provider-all": "^0.33.2-next.0",
|
|
29
29
|
"@rango-dev/queue-manager-core": "^0.26.0",
|
|
30
|
-
"@rango-dev/queue-manager-rango-preset": "^0.33.
|
|
30
|
+
"@rango-dev/queue-manager-rango-preset": "^0.33.2-next.0",
|
|
31
31
|
"@rango-dev/queue-manager-react": "^0.26.0",
|
|
32
|
-
"@rango-dev/
|
|
33
|
-
"@rango-dev/
|
|
34
|
-
"@rango-dev/wallets-
|
|
32
|
+
"@rango-dev/signer-solana": "^0.28.1-next.1",
|
|
33
|
+
"@rango-dev/ui": "^0.34.1-next.2",
|
|
34
|
+
"@rango-dev/wallets-react": "^0.19.1-next.0",
|
|
35
|
+
"@rango-dev/wallets-shared": "^0.33.1-next.0",
|
|
35
36
|
"bignumber.js": "^9.1.1",
|
|
36
37
|
"copy-to-clipboard": "^3.3.3",
|
|
37
38
|
"dayjs": "^1.11.7",
|
|
@@ -1,35 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { type BlockchainMeta, TransactionType } from 'rango-sdk';
|
|
1
|
+
import { type BlockchainMeta } from 'rango-sdk';
|
|
3
2
|
|
|
4
|
-
import { containsText } from '../../utils/common';
|
|
5
|
-
|
|
6
|
-
export const filterByType = (
|
|
7
|
-
blockchain: BlockchainMeta,
|
|
8
|
-
type: string
|
|
9
|
-
): boolean => {
|
|
10
|
-
switch (type) {
|
|
11
|
-
case BlockchainCategories.ALL:
|
|
12
|
-
return true;
|
|
13
|
-
case BlockchainCategories.UTXO:
|
|
14
|
-
return blockchain.type === TransactionType.TRANSFER;
|
|
15
|
-
case BlockchainCategories.OTHER:
|
|
16
|
-
return (
|
|
17
|
-
blockchain.type !== TransactionType.TRANSFER &&
|
|
18
|
-
blockchain.type !== TransactionType.COSMOS &&
|
|
19
|
-
blockchain.type !== TransactionType.EVM
|
|
20
|
-
);
|
|
21
|
-
default:
|
|
22
|
-
return blockchain.type === type;
|
|
23
|
-
}
|
|
24
|
-
};
|
|
3
|
+
import { containsText, isBlockchainTypeInCategory } from '../../utils/common';
|
|
25
4
|
|
|
26
5
|
export const filterBlockchains = (
|
|
27
6
|
list: BlockchainMeta[],
|
|
28
7
|
searchedFor: string,
|
|
29
|
-
|
|
8
|
+
blockchainCategory: string
|
|
30
9
|
) =>
|
|
31
10
|
list
|
|
32
|
-
.filter((blockchain) =>
|
|
11
|
+
.filter((blockchain) =>
|
|
12
|
+
isBlockchainTypeInCategory(blockchain.type, blockchainCategory)
|
|
13
|
+
)
|
|
33
14
|
.filter(
|
|
34
15
|
(blockchain) =>
|
|
35
16
|
containsText(blockchain.name, searchedFor) ||
|
|
@@ -34,7 +34,7 @@ export const WalletButton = styled('button', {
|
|
|
34
34
|
position: 'relative',
|
|
35
35
|
|
|
36
36
|
'&:hover': {
|
|
37
|
-
$$color: '$colors$
|
|
37
|
+
$$color: '$colors$secondary100',
|
|
38
38
|
[`.${darkTheme} &`]: {
|
|
39
39
|
$$color: '$colors$neutral100',
|
|
40
40
|
},
|
|
@@ -42,7 +42,7 @@ export const WalletButton = styled('button', {
|
|
|
42
42
|
},
|
|
43
43
|
|
|
44
44
|
'&:focus-visible': {
|
|
45
|
-
$$color: '$colors$
|
|
45
|
+
$$color: '$colors$secondary100',
|
|
46
46
|
[`.${darkTheme} &`]: {
|
|
47
47
|
$$color: '$colors$info700',
|
|
48
48
|
},
|
|
@@ -138,14 +138,14 @@ export const CustomDestinationButton = styled('div', {
|
|
|
138
138
|
borderBottomRightRadius: '0',
|
|
139
139
|
borderBottomLeftRadius: '0',
|
|
140
140
|
'&:hover': {
|
|
141
|
-
$$color: '$colors$
|
|
141
|
+
$$color: '$colors$secondary100',
|
|
142
142
|
[`.${darkTheme} &`]: {
|
|
143
143
|
$$color: '$colors$neutral100',
|
|
144
144
|
},
|
|
145
145
|
backgroundColor: '$$color',
|
|
146
146
|
},
|
|
147
147
|
'&:focus-visible': {
|
|
148
|
-
$$background: '$colors$
|
|
148
|
+
$$background: '$colors$secondary100',
|
|
149
149
|
[`.${darkTheme} &`]: {
|
|
150
150
|
$$background: '$colors$info700',
|
|
151
151
|
},
|
package/src/constants/fonts.ts
CHANGED
|
@@ -1 +1,85 @@
|
|
|
1
1
|
export const DEFAULT_FONT_FAMILY = 'Roboto';
|
|
2
|
+
|
|
3
|
+
export const SUPPORTED_FONTS = [
|
|
4
|
+
{
|
|
5
|
+
name: 'Roboto',
|
|
6
|
+
value: 'Roboto',
|
|
7
|
+
url: '',
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
name: 'Times New Roman',
|
|
11
|
+
value: 'Times New Roman',
|
|
12
|
+
url: 'https://fonts.cdnfonts.com/css/times-new-roman',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
name: 'Arial',
|
|
16
|
+
value: 'Arial',
|
|
17
|
+
url: '',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: 'Open Sans',
|
|
21
|
+
value: 'Open Sans',
|
|
22
|
+
url: 'https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300..800;1,300..800&display=swap',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: 'Noto Sans',
|
|
26
|
+
value: 'Noto Sans',
|
|
27
|
+
url: 'https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,100..900;1,100..900&display=swap',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: 'Montserrat',
|
|
31
|
+
value: 'Montserrat',
|
|
32
|
+
url: 'https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: 'Poppins',
|
|
36
|
+
value: 'Poppins',
|
|
37
|
+
url: 'https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: 'Roboto Condensed',
|
|
41
|
+
value: 'Roboto Condensed',
|
|
42
|
+
url: 'https://fonts.googleapis.com/css2?family=Roboto+Condensed:ital,wght@0,100..900;1,100..900&display=swap',
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
{
|
|
46
|
+
name: 'Roboto Mono',
|
|
47
|
+
value: 'Roboto Mono',
|
|
48
|
+
url: 'https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,100..700;1,100..700&display=swap',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: 'Oswald',
|
|
52
|
+
value: 'Oswald',
|
|
53
|
+
url: 'https://fonts.googleapis.com/css2?family=Oswald:wght@200..700&display=swap',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: 'Raleway',
|
|
57
|
+
value: 'Raleway',
|
|
58
|
+
url: 'https://fonts.googleapis.com/css2?family=Raleway:ital,wght@0,100..900;1,100..900&display=swap',
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: 'Sedan',
|
|
62
|
+
value: 'Sedan',
|
|
63
|
+
url: 'https://fonts.googleapis.com/css2?family=Sedan:ital@0;1&display=swap',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: 'Inter',
|
|
67
|
+
value: 'Inter',
|
|
68
|
+
url: 'https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap',
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: 'Rubik',
|
|
72
|
+
value: 'Rubik',
|
|
73
|
+
url: 'https://fonts.googleapis.com/css2?family=Rubik:ital,wght@0,300..900;1,300..900&display=swap',
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
name: 'Lora',
|
|
77
|
+
value: 'Lora',
|
|
78
|
+
url: 'https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400..700;1,400..700&display=swap',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: 'Barlow Condensed',
|
|
82
|
+
value: 'Barlow Condensed',
|
|
83
|
+
url: 'https://fonts.googleapis.com/css2?family=Barlow+Condensed:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap',
|
|
84
|
+
},
|
|
85
|
+
];
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { PropTypes } from './WidgetProvider.types';
|
|
2
2
|
import type { PropsWithChildren } from 'react';
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import { setSolanaSignerConfig } from '@rango-dev/signer-solana';
|
|
5
|
+
import React, { useEffect } from 'react';
|
|
5
6
|
|
|
6
7
|
import { DEFAULT_BASE_URL, RANGO_PUBLIC_API_KEY } from '../../constants';
|
|
8
|
+
import useFontLoader from '../../hooks/useFontLoader';
|
|
7
9
|
import QueueManager from '../../QueueManager';
|
|
8
10
|
import { initConfig } from '../../utils/configs';
|
|
9
11
|
import { WidgetWallets } from '../Wallets';
|
|
@@ -12,13 +14,29 @@ import { WidgetInfo } from '../WidgetInfo';
|
|
|
12
14
|
export function WidgetProvider(props: PropsWithChildren<PropTypes>) {
|
|
13
15
|
const { onUpdateState, config } = props;
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
const fontFamily = props.config?.theme?.fontFamily;
|
|
18
|
+
|
|
19
|
+
const { handleLoadCustomFont } = useFontLoader();
|
|
20
|
+
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
if (fontFamily) {
|
|
23
|
+
handleLoadCustomFont(fontFamily);
|
|
24
|
+
}
|
|
25
|
+
}, [fontFamily]);
|
|
26
|
+
|
|
27
|
+
useEffect(() => {
|
|
16
28
|
initConfig({
|
|
17
29
|
API_KEY: config?.apiKey || RANGO_PUBLIC_API_KEY,
|
|
18
30
|
BASE_URL: config?.apiUrl || DEFAULT_BASE_URL,
|
|
19
31
|
});
|
|
20
32
|
}, [config.apiKey, config.apiUrl]);
|
|
21
33
|
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
if (props.config?.signers?.customSolanaRPC) {
|
|
36
|
+
setSolanaSignerConfig('customRPC', props.config.signers.customSolanaRPC);
|
|
37
|
+
}
|
|
38
|
+
}, [props.config?.signers?.customSolanaRPC]);
|
|
39
|
+
|
|
22
40
|
return (
|
|
23
41
|
<WidgetWallets config={config} onUpdateState={onUpdateState}>
|
|
24
42
|
<QueueManager apiKey={config.apiKey}>
|
package/src/globalStyles.ts
CHANGED
|
@@ -2,8 +2,6 @@ import { globalCss } from '@rango-dev/ui';
|
|
|
2
2
|
|
|
3
3
|
export const globalFont = () =>
|
|
4
4
|
globalCss({
|
|
5
|
-
'@import':
|
|
5
|
+
'@import':
|
|
6
6
|
"url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap')",
|
|
7
|
-
"url('https://fonts.cdnfonts.com/css/times-new-roman')",
|
|
8
|
-
],
|
|
9
7
|
})();
|
|
@@ -16,8 +16,8 @@ import { useForceAutoConnect } from '../useForceAutoConnect';
|
|
|
16
16
|
import { useSubscribeToWidgetEvents } from '../useSubscribeToWidgetEvents';
|
|
17
17
|
|
|
18
18
|
export function useBootstrap() {
|
|
19
|
-
globalFont();
|
|
20
19
|
useForceAutoConnect();
|
|
20
|
+
globalFont();
|
|
21
21
|
useSubscribeToWidgetEvents();
|
|
22
22
|
const blockchains = useAppStore().blockchains();
|
|
23
23
|
const { canSwitchNetworkTo } = useWallets();
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import { getFontUrlByName } from '../utils/common';
|
|
4
|
+
/*
|
|
5
|
+
*TODO:
|
|
6
|
+
* Loading fonts from JS has a downside and it is the bundle needs to be downloaded and executed first which means after sometime font will be added to <head /> and it causes a layoutshift each time.
|
|
7
|
+
* We've added Roboto into <head /> since it's the default font. the downside here is it will load roboto anyway even dApp has set fontFamily other than Roboto which causes an unneccerary downloand (Roboto).
|
|
8
|
+
* We decided to go with the second one and it can be solved in future by split these types of configs into a separate js file and let it to be loaded with a more priority than the main bundle. it should be also cached which imrpove user experience after first load.
|
|
9
|
+
*/
|
|
10
|
+
const useFontLoader = () => {
|
|
11
|
+
const [fontLink, setFontLink] = useState<HTMLLinkElement | null>(null);
|
|
12
|
+
|
|
13
|
+
const loadFont = (fontUrl: string) => {
|
|
14
|
+
const link = document.createElement('link');
|
|
15
|
+
link.href = fontUrl;
|
|
16
|
+
link.rel = 'stylesheet';
|
|
17
|
+
document.head.appendChild(link);
|
|
18
|
+
return link;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const unloadFont = () => {
|
|
22
|
+
if (fontLink) {
|
|
23
|
+
document.head.removeChild(fontLink);
|
|
24
|
+
setFontLink(null);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const handleLoadCustomFont = (fontName: string) => {
|
|
29
|
+
unloadFont(); // Remove previous font
|
|
30
|
+
const fontUrl = getFontUrlByName(fontName);
|
|
31
|
+
if (fontUrl) {
|
|
32
|
+
const newFontLink = loadFont(fontUrl);
|
|
33
|
+
setFontLink(newFontLink);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
return { handleLoadCustomFont };
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export default useFontLoader;
|
package/src/hooks/useTheme.ts
CHANGED
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
} from '@rango-dev/ui';
|
|
7
7
|
import { useEffect, useState } from 'react';
|
|
8
8
|
|
|
9
|
+
import { DEFAULT_FONT_FAMILY } from '../constants/fonts';
|
|
9
10
|
import { useAppStore } from '../store/AppStore';
|
|
10
11
|
import { type WidgetTheme } from '../types';
|
|
11
12
|
import {
|
|
12
|
-
DEFAULT_FONT_FAMILY,
|
|
13
13
|
DEFAULT_PRIMARY_RADIUS,
|
|
14
14
|
DEFAULT_SECONDARY_RADIUS,
|
|
15
15
|
} from '../utils/configs';
|
package/src/index.ts
CHANGED
|
@@ -59,6 +59,7 @@ import { Networks, WalletTypes } from '@rango-dev/wallets-shared';
|
|
|
59
59
|
import { PendingSwapNetworkStatus } from 'rango-types';
|
|
60
60
|
|
|
61
61
|
import { WIDGET_UI_ID as UI_ID } from './constants';
|
|
62
|
+
import { SUPPORTED_FONTS } from './constants/fonts';
|
|
62
63
|
import { WidgetWallets } from './containers/Wallets';
|
|
63
64
|
import { Widget } from './containers/Widget';
|
|
64
65
|
import { useWidget } from './containers/WidgetInfo';
|
|
@@ -113,6 +114,7 @@ export {
|
|
|
113
114
|
StepExecutionEventStatus,
|
|
114
115
|
StepExecutionBlockedEventStatus,
|
|
115
116
|
UI_ID,
|
|
117
|
+
SUPPORTED_FONTS,
|
|
116
118
|
};
|
|
117
119
|
|
|
118
120
|
// Internal type exports for Rango
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { i18n } from '@lingui/core';
|
|
2
2
|
import {
|
|
3
3
|
Divider,
|
|
4
|
-
|
|
4
|
+
getCategoriesCount,
|
|
5
5
|
SelectableCategoryList,
|
|
6
6
|
} from '@rango-dev/ui';
|
|
7
7
|
import React, { useState } from 'react';
|
|
@@ -30,9 +30,9 @@ export function SelectBlockchainPage(props: PropTypes) {
|
|
|
30
30
|
type,
|
|
31
31
|
});
|
|
32
32
|
|
|
33
|
-
const
|
|
33
|
+
const activeCategoriesCount = getCategoriesCount(blockchains);
|
|
34
34
|
|
|
35
|
-
const showCategory =
|
|
35
|
+
const showCategory = activeCategoriesCount !== 1;
|
|
36
36
|
|
|
37
37
|
return (
|
|
38
38
|
<Layout
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import type { Namespace, WalletType } from '@rango-dev/wallets-shared';
|
|
2
2
|
|
|
3
3
|
import { i18n } from '@lingui/core';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
Divider,
|
|
6
|
+
getCategoriesCount,
|
|
7
|
+
SelectableCategoryList,
|
|
8
|
+
styled,
|
|
9
|
+
Typography,
|
|
10
|
+
Wallet,
|
|
11
|
+
WalletState,
|
|
12
|
+
} from '@rango-dev/ui';
|
|
5
13
|
import React, { useState } from 'react';
|
|
6
14
|
|
|
7
15
|
import { Layout, PageContainer } from '../components/Layout';
|
|
@@ -11,6 +19,10 @@ import { useWalletList } from '../hooks/useWalletList';
|
|
|
11
19
|
import { useAppStore } from '../store/AppStore';
|
|
12
20
|
import { useUiStore } from '../store/ui';
|
|
13
21
|
import { getContainer } from '../utils/common';
|
|
22
|
+
import {
|
|
23
|
+
filterBlockchainsByWalletTypes,
|
|
24
|
+
filterWalletsByCategory,
|
|
25
|
+
} from '../utils/wallets';
|
|
14
26
|
|
|
15
27
|
interface NamespacesModalState {
|
|
16
28
|
providerType: string;
|
|
@@ -37,6 +49,9 @@ export const TIME_TO_IGNORE_MODAL = 300;
|
|
|
37
49
|
|
|
38
50
|
export function WalletsPage() {
|
|
39
51
|
const { fetchStatus: fetchMetaStatus } = useAppStore();
|
|
52
|
+
const [blockchainCategory, setBlockchainCategory] = useState<string>('ALL');
|
|
53
|
+
const blockchains = useAppStore().blockchains();
|
|
54
|
+
|
|
40
55
|
const [openModal, setOpenModal] = useState(false);
|
|
41
56
|
const [namespacesModalState, setNamespacesModalState] =
|
|
42
57
|
useState<NamespacesModalState | null>(null);
|
|
@@ -74,17 +89,34 @@ export function WalletsPage() {
|
|
|
74
89
|
const selectedWalletState =
|
|
75
90
|
selectedWallet?.state || WalletState.NOT_INSTALLED;
|
|
76
91
|
|
|
92
|
+
const filteredBlockchains = filterBlockchainsByWalletTypes(list, blockchains);
|
|
93
|
+
const activeCategoriesCount = getCategoriesCount(filteredBlockchains);
|
|
94
|
+
const showCategory = activeCategoriesCount !== 1;
|
|
95
|
+
|
|
96
|
+
const filteredWallets = filterWalletsByCategory(list, blockchainCategory);
|
|
97
|
+
|
|
77
98
|
return (
|
|
78
99
|
<Layout
|
|
79
100
|
header={{
|
|
80
101
|
title: i18n.t('Connect Wallets'),
|
|
81
102
|
}}>
|
|
82
103
|
<Container>
|
|
104
|
+
{showCategory && (
|
|
105
|
+
<>
|
|
106
|
+
<SelectableCategoryList
|
|
107
|
+
setCategory={setBlockchainCategory}
|
|
108
|
+
category={blockchainCategory}
|
|
109
|
+
blockchains={filteredBlockchains}
|
|
110
|
+
isLoading={fetchMetaStatus === 'loading'}
|
|
111
|
+
/>
|
|
112
|
+
<Divider size={24} />
|
|
113
|
+
</>
|
|
114
|
+
)}
|
|
83
115
|
<Typography variant="title" size="xmedium" align="center">
|
|
84
116
|
{i18n.t('Choose a wallet to connect.')}
|
|
85
117
|
</Typography>
|
|
86
118
|
<ListContainer>
|
|
87
|
-
{
|
|
119
|
+
{filteredWallets.map((wallet, index) => {
|
|
88
120
|
const key = `wallet-${index}-${wallet.type}`;
|
|
89
121
|
return (
|
|
90
122
|
<Wallet
|
package/src/types/config.ts
CHANGED
|
@@ -28,7 +28,7 @@ export type WidgetColors = {
|
|
|
28
28
|
* radius, width, and height.
|
|
29
29
|
* @property {'auto' | 'light' | 'dark'} mode - The mode property is used to specify the default theme for
|
|
30
30
|
* the widget.
|
|
31
|
-
* @property {string} fontFamily - The font family to be used in the widget.
|
|
31
|
+
* @property {string} fontFamily - The font family to be used in the widget. If you want to do this, include the font of your choice in your HTML file.
|
|
32
32
|
* @property {{ light?: WidgetColors; dark?: WidgetColors }} colors - The `colors` property is a sub-property of the `WidgetTheme` object that
|
|
33
33
|
* defines the color scheme for the widget. It is of type `Colors`, which is likely another object that
|
|
34
34
|
* contains specific color values for various parts of the widget (e.g. background color, text color,
|
|
@@ -103,6 +103,10 @@ export type BlockchainAndTokenConfig = {
|
|
|
103
103
|
tokens?: Asset[] | { [blockchain: string]: Tokens };
|
|
104
104
|
};
|
|
105
105
|
|
|
106
|
+
export type SignersConfig = {
|
|
107
|
+
customSolanaRPC?: string;
|
|
108
|
+
};
|
|
109
|
+
|
|
106
110
|
/**
|
|
107
111
|
* `Features`
|
|
108
112
|
*
|
|
@@ -209,4 +213,5 @@ export type WidgetConfig = {
|
|
|
209
213
|
features?: Features;
|
|
210
214
|
variant?: WidgetVariant;
|
|
211
215
|
enableCentralizedSwappers?: boolean;
|
|
216
|
+
signers?: SignersConfig;
|
|
212
217
|
};
|
package/src/utils/common.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { Token } from 'rango-sdk';
|
|
2
2
|
|
|
3
|
+
import { BlockchainCategories } from '@rango-dev/ui';
|
|
4
|
+
import { TransactionType } from 'rango-sdk';
|
|
5
|
+
|
|
3
6
|
import { WIDGET_UI_ID } from '../constants';
|
|
7
|
+
import { SUPPORTED_FONTS } from '../constants/fonts';
|
|
4
8
|
import {
|
|
5
9
|
MIN_LENGTH_SYMBOL_CONTAINS,
|
|
6
10
|
MIN_LENGTH_SYMBOL_START_WITH,
|
|
@@ -218,3 +222,28 @@ export function compareWithSearchFor(
|
|
|
218
222
|
|
|
219
223
|
return 0;
|
|
220
224
|
}
|
|
225
|
+
|
|
226
|
+
export const isBlockchainTypeInCategory = (
|
|
227
|
+
blockchainType: TransactionType,
|
|
228
|
+
category: string
|
|
229
|
+
): boolean => {
|
|
230
|
+
switch (category) {
|
|
231
|
+
case BlockchainCategories.ALL:
|
|
232
|
+
return true;
|
|
233
|
+
case BlockchainCategories.UTXO:
|
|
234
|
+
return blockchainType === TransactionType.TRANSFER;
|
|
235
|
+
case BlockchainCategories.OTHER:
|
|
236
|
+
return (
|
|
237
|
+
blockchainType !== TransactionType.TRANSFER &&
|
|
238
|
+
blockchainType !== TransactionType.COSMOS &&
|
|
239
|
+
blockchainType !== TransactionType.EVM
|
|
240
|
+
);
|
|
241
|
+
default:
|
|
242
|
+
return blockchainType === category;
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
export const getFontUrlByName = (fontName: string) => {
|
|
247
|
+
const font = SUPPORTED_FONTS.find((font) => font.value === fontName);
|
|
248
|
+
return font?.url;
|
|
249
|
+
};
|
package/src/utils/configs.ts
CHANGED