@rango-dev/widget-embedded 0.0.0-experimental-e022ed95-20260421 → 0.0.0-experimental-82bcc5d9-20260608
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 +34 -0
- package/dist/components/AppRoutes.d.ts +1 -2
- package/dist/components/AppRoutes.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/WalletList.d.ts.map +1 -1
- package/dist/components/CustomDestination/CustomDestination.styles.d.ts +4 -4
- package/dist/components/CustomDestination/CustomDestination.styles.d.ts.map +1 -1
- package/dist/components/CustomTokenModal/CustomTokenModal.d.ts.map +1 -1
- package/dist/components/CustomTokenModal/CustomTokenModal.styles.d.ts +169 -169
- package/dist/components/CustomTokenModal/CustomTokenModal.styles.d.ts.map +1 -1
- package/dist/components/FilterSelector/FilterSelector.style.d.ts +1 -1
- package/dist/components/FilterSelector/FilterSelector.style.d.ts.map +1 -1
- package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts +1 -1
- package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts.map +1 -1
- package/dist/components/NamespaceItem/NamespaceItem.styles.d.ts +1 -1
- package/dist/components/NamespaceItem/NamespaceItem.styles.d.ts.map +1 -1
- package/dist/components/Quote/Quote.styles.d.ts +171 -171
- package/dist/components/Quote/Quote.styles.d.ts.map +1 -1
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts +169 -169
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts.map +1 -1
- package/dist/components/RefreshModal/RefreshModal.styles.d.ts +168 -168
- package/dist/components/RefreshModal/RefreshModal.styles.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.styles.d.ts +1 -1
- package/dist/components/SwapDetails/SwapDetails.styles.d.ts.map +1 -1
- package/dist/components/SwapMetrics/SwapMetrics.styles.d.ts +1 -1
- package/dist/components/SwapMetrics/SwapMetrics.styles.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.styles.d.ts +2 -2
- package/dist/components/TokenList/TokenList.styles.d.ts.map +1 -1
- package/dist/components/WalletStatefulConnect/DerivationPath.helpers.d.ts +1 -1
- package/dist/components/WalletStatefulConnect/DerivationPath.helpers.d.ts.map +1 -1
- package/dist/components/WalletStatefulConnect/DerivationPath.styles.d.ts +169 -169
- package/dist/components/WalletStatefulConnect/DerivationPath.styles.d.ts.map +1 -1
- package/dist/components/WalletStatefulConnect/Detached.types.d.ts +1 -1
- package/dist/components/WalletStatefulConnect/Detached.types.d.ts.map +1 -1
- package/dist/components/WalletStatefulConnect/Namespaces.styles.d.ts +168 -168
- package/dist/components/WalletStatefulConnect/Namespaces.styles.d.ts.map +1 -1
- package/dist/components/WalletStatefulConnect/Namespaces.types.d.ts +2 -2
- package/dist/components/WalletStatefulConnect/Namespaces.types.d.ts.map +1 -1
- package/dist/components/WalletStatefulConnect/index.d.ts +0 -1
- package/dist/components/WalletStatefulConnect/index.d.ts.map +1 -1
- package/dist/constants/index.d.ts +0 -1
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/constants/wallets.d.ts +1 -2
- package/dist/constants/wallets.d.ts.map +1 -1
- package/dist/containers/Inputs/Inputs.d.ts.map +1 -1
- package/dist/containers/Wallets/Wallets.d.ts.map +1 -1
- package/dist/containers/WidgetProvider/WidgetProvider.d.ts.map +1 -1
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.constants.d.ts.map +1 -1
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.mock.d.ts.map +1 -1
- package/dist/hooks/useStatefulConnect/useStatefulConnect.d.ts +1 -1
- package/dist/hooks/useStatefulConnect/useStatefulConnect.d.ts.map +1 -1
- package/dist/hooks/useStatefulConnect/useStatefulConnect.state.d.ts +1 -1
- package/dist/hooks/useStatefulConnect/useStatefulConnect.state.d.ts.map +1 -1
- package/dist/hooks/useStatefulConnect/useStatefulConnect.types.d.ts +1 -1
- package/dist/hooks/useStatefulConnect/useStatefulConnect.types.d.ts.map +1 -1
- package/dist/hooks/useWalletList.d.ts.map +1 -1
- package/dist/hooks/useWalletProviders/useWalletProviders.d.ts +1 -1
- package/dist/hooks/useWalletProviders/useWalletProviders.helpers.d.ts +1 -1
- package/dist/hooks/useWalletProviders/useWalletProviders.helpers.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +4 -4
- package/dist/store/quote.d.ts.map +1 -1
- package/dist/store/slices/config.d.ts +1 -1
- package/dist/store/slices/config.d.ts.map +1 -1
- package/dist/store/slices/wallets.d.ts +1 -1
- package/dist/store/slices/wallets.d.ts.map +1 -1
- package/dist/store/utils/wallets.d.ts +3 -3
- package/dist/store/utils/wallets.d.ts.map +1 -1
- package/dist/test-utils/fixtures.d.ts.map +1 -1
- package/dist/types/config.d.ts +1 -1
- package/dist/types/config.d.ts.map +1 -1
- package/dist/utils/common.d.ts.map +1 -1
- package/dist/utils/configs.d.ts.map +1 -1
- package/dist/utils/env.d.ts +12 -0
- package/dist/utils/env.d.ts.map +1 -0
- package/dist/utils/meta.d.ts +4 -0
- package/dist/utils/meta.d.ts.map +1 -1
- package/dist/utils/numbers.d.ts.map +1 -1
- package/dist/utils/providers.d.ts +2 -1
- package/dist/utils/providers.d.ts.map +1 -1
- package/dist/utils/sanitizers.d.ts +15 -0
- package/dist/utils/sanitizers.d.ts.map +1 -1
- package/dist/utils/wallets.d.ts +0 -2
- package/dist/utils/wallets.d.ts.map +1 -1
- package/dist/widget-embedded.build.json +1 -1
- package/package.json +22 -10
- package/src/components/ConfirmWalletsModal/WalletList.tsx +16 -166
- package/src/components/CustomTokenModal/CustomTokenModal.tsx +7 -2
- package/src/components/StatefulConnectModal/StatefulConnectModal.tsx +1 -1
- package/src/components/TokenList/TokenList.tsx +11 -8
- package/src/components/WalletStatefulConnect/DerivationPath.helpers.ts +1 -1
- package/src/components/WalletStatefulConnect/Detached.tsx +1 -1
- package/src/components/WalletStatefulConnect/Detached.types.ts +1 -1
- package/src/components/WalletStatefulConnect/Namespaces.tsx +1 -1
- package/src/components/WalletStatefulConnect/Namespaces.types.tsx +2 -2
- package/src/components/WalletStatefulConnect/index.ts +0 -1
- package/src/constants/index.ts +0 -1
- package/src/constants/wallets.ts +1 -3
- package/src/containers/Inputs/Inputs.tsx +2 -7
- package/src/containers/Wallets/Wallets.tsx +6 -0
- package/src/containers/WidgetProvider/WidgetProvider.tsx +3 -2
- package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.constants.ts +1 -1
- package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.mock.ts +45 -3262
- package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.test.ts +26 -228
- package/src/hooks/useStatefulConnect/useStatefulConnect.state.ts +1 -1
- package/src/hooks/useStatefulConnect/useStatefulConnect.ts +1 -1
- package/src/hooks/useStatefulConnect/useStatefulConnect.types.ts +1 -1
- package/src/hooks/useWalletList.ts +6 -29
- package/src/hooks/useWalletProviders/useWalletProviders.helpers.ts +1 -1
- package/src/store/quote.ts +2 -1
- package/src/store/slices/config.ts +2 -2
- package/src/store/slices/data.test.ts +1 -1
- package/src/store/slices/wallets.ts +25 -12
- package/src/store/utils/wallets.ts +5 -5
- package/src/test-utils/fixtures.ts +1 -39
- package/src/types/config.ts +1 -1
- package/src/utils/common.ts +0 -1
- package/src/utils/configs.ts +2 -3
- package/src/utils/env.ts +28 -0
- package/src/utils/meta.ts +13 -0
- package/src/utils/numbers.ts +4 -0
- package/src/utils/providers.ts +2 -2
- package/src/utils/sanitizers.test.ts +43 -0
- package/src/utils/sanitizers.ts +26 -0
- package/src/utils/wallets.ts +0 -32
- package/dist/components/CustomTokenModal/CustomTokenModal.helpers.d.ts +0 -3
- package/dist/components/CustomTokenModal/CustomTokenModal.helpers.d.ts.map +0 -1
- package/dist/components/WalletStatefulConnect/ExperimentalChain.d.ts +0 -9
- package/dist/components/WalletStatefulConnect/ExperimentalChain.d.ts.map +0 -1
- package/dist/components/WalletStatefulConnect/ExperimentalChainStatus.d.ts +0 -4
- package/dist/components/WalletStatefulConnect/ExperimentalChainStatus.d.ts.map +0 -1
- package/dist/components/WalletStatefulConnect/ExperimentalChainStatus.helpers.d.ts +0 -8
- package/dist/components/WalletStatefulConnect/ExperimentalChainStatus.helpers.d.ts.map +0 -1
- package/dist/components/WalletStatefulConnect/ExperimentalChainStatus.types.d.ts +0 -6
- package/dist/components/WalletStatefulConnect/ExperimentalChainStatus.types.d.ts.map +0 -1
- package/src/components/CustomTokenModal/CustomTokenModal.helpers.ts +0 -19
- package/src/components/WalletStatefulConnect/ExperimentalChain.tsx +0 -39
- package/src/components/WalletStatefulConnect/ExperimentalChainStatus.helpers.ts +0 -53
- package/src/components/WalletStatefulConnect/ExperimentalChainStatus.tsx +0 -36
- package/src/components/WalletStatefulConnect/ExperimentalChainStatus.types.ts +0 -5
package/src/utils/common.ts
CHANGED
|
@@ -237,7 +237,6 @@ export const isBlockchainTypeInCategory = (
|
|
|
237
237
|
case BlockchainCategories.OTHER:
|
|
238
238
|
return (
|
|
239
239
|
blockchainType !== TransactionType.TRANSFER &&
|
|
240
|
-
blockchainType !== TransactionType.COSMOS &&
|
|
241
240
|
blockchainType !== TransactionType.EVM
|
|
242
241
|
);
|
|
243
242
|
default:
|
package/src/utils/configs.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { Tokens, WidgetVariant } from '../types';
|
|
2
2
|
import type { Asset, BlockchainMeta, Token } from 'rango-sdk';
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import { getApiKeyFromEnvOrNotSet } from './env';
|
|
6
5
|
import { areTokensEqual } from './wallets';
|
|
7
6
|
|
|
8
7
|
export interface Configs {
|
|
@@ -17,7 +16,7 @@ type TokensConfig =
|
|
|
17
16
|
};
|
|
18
17
|
|
|
19
18
|
let configs: Configs = {
|
|
20
|
-
API_KEY:
|
|
19
|
+
API_KEY: getApiKeyFromEnvOrNotSet(),
|
|
21
20
|
};
|
|
22
21
|
|
|
23
22
|
export function getConfig(name: keyof Configs) {
|
package/src/utils/env.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export function getApiKeyFromEnv(): string | undefined {
|
|
2
|
+
// NOTE: parcel doesn't support for dynamic keys, so we have to do it statically.
|
|
3
|
+
return process.env.REACT_APP_RANGO_API_KEY;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* This is useful when the api key is mandatory and nothing works corectly without api key.
|
|
8
|
+
* You need to first fallback to user's input (widget config), then you can use this to try to find from envs (e.g. widget/app or widget/playground)
|
|
9
|
+
* Then throw an runtime error to panic the program.
|
|
10
|
+
*/
|
|
11
|
+
export function getApiKeyFromEnvOrThrow() {
|
|
12
|
+
// NOTE: parcel doesn't support for dynamic keys, so we have to do it statically.
|
|
13
|
+
const value = getApiKeyFromEnv();
|
|
14
|
+
if (value) {
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
throw new Error(
|
|
19
|
+
'Ensure you have set REACT_APP_RANGO_API_KEY in your env variables.'
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* You can use this whenever you want to use the api key in initialize process, but mark the key explictly as not set to debug more easily since you should never reach there.
|
|
25
|
+
*/
|
|
26
|
+
export function getApiKeyFromEnvOrNotSet(): string {
|
|
27
|
+
return getApiKeyFromEnv() || 'NOT_SET';
|
|
28
|
+
}
|
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
|
+
}
|
package/src/utils/numbers.ts
CHANGED
package/src/utils/providers.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { WidgetConfig } from '../types';
|
|
2
2
|
import type { LegacyProviderInterface } from '@rango-dev/wallets-core/legacy';
|
|
3
3
|
|
|
4
|
+
import { Provider } from '@hub3js/core';
|
|
4
5
|
import {
|
|
5
6
|
defineVersions,
|
|
6
7
|
pickVersion,
|
|
7
|
-
Provider,
|
|
8
8
|
type VersionedProviders,
|
|
9
|
-
} from '@
|
|
9
|
+
} from '@hub3js/core/utils';
|
|
10
10
|
|
|
11
11
|
export interface ProvidersOptions {
|
|
12
12
|
walletConnectProjectId?: WidgetConfig['walletConnectProjectId'];
|
|
@@ -4,6 +4,7 @@ import { describe, expect, test } from 'vitest';
|
|
|
4
4
|
import {
|
|
5
5
|
ensureLeadingZeroForDecimal,
|
|
6
6
|
formatThousandsWithCommas,
|
|
7
|
+
parseNumericValue,
|
|
7
8
|
removeLeadingZeros,
|
|
8
9
|
replaceSpacesWithDash,
|
|
9
10
|
stripTrailingZeros,
|
|
@@ -119,4 +120,46 @@ describe('check sanitization behaviors', () => {
|
|
|
119
120
|
expect(stripTrailingZeros('1000')).toBe('1000');
|
|
120
121
|
});
|
|
121
122
|
});
|
|
123
|
+
|
|
124
|
+
describe('parseNumericValue', () => {
|
|
125
|
+
test('removes commas and keeps digits', () => {
|
|
126
|
+
expect(parseNumericValue('300,222')).toBe('300222');
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
test('removes letters and keeps only the first decimal', () => {
|
|
130
|
+
expect(parseNumericValue('12a3.4b5')).toBe('123.45');
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
test('removes extra dots and keeps the first one', () => {
|
|
134
|
+
expect(parseNumericValue('1.2.3.4')).toBe('1.234');
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
test('keeps a leading decimal', () => {
|
|
138
|
+
expect(parseNumericValue('.5')).toBe('.5');
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
test('removes symbols and letters', () => {
|
|
142
|
+
expect(parseNumericValue('$1,2a3.4!')).toBe('123.4');
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
test('returns empty string if no digits', () => {
|
|
146
|
+
expect(parseNumericValue('abc!@#')).toBe('');
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
test('handles empty string', () => {
|
|
150
|
+
expect(parseNumericValue('')).toBe('');
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
test('keeps only the first dot if string starts with multiple dots', () => {
|
|
154
|
+
expect(parseNumericValue('...123.45')).toBe('.12345');
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
test('handles string with only dots', () => {
|
|
158
|
+
expect(parseNumericValue('....')).toBe('.');
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
test('handles string with digits only', () => {
|
|
162
|
+
expect(parseNumericValue('123456')).toBe('123456');
|
|
163
|
+
});
|
|
164
|
+
});
|
|
122
165
|
});
|
package/src/utils/sanitizers.ts
CHANGED
|
@@ -39,3 +39,29 @@ export function stripTrailingZeros(input: string): string {
|
|
|
39
39
|
const s = input.replace(/(\.\d*?[1-9])0+$/, '$1');
|
|
40
40
|
return s.replace(/\.0+$/, '');
|
|
41
41
|
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Normalize a numeric input string by removing all non-numeric characters
|
|
45
|
+
* except digits and a single decimal separator.
|
|
46
|
+
*
|
|
47
|
+
* This function:
|
|
48
|
+
* - strips letters, spaces, commas, and symbols
|
|
49
|
+
* - preserves digits (`0–9`)
|
|
50
|
+
* - keeps only the first `.` as the decimal point
|
|
51
|
+
*
|
|
52
|
+
* @example "300,222" → "300222"
|
|
53
|
+
* @example "12a3.4b5" → "123.45"
|
|
54
|
+
* @example "1.2.3.4" → "1.234"
|
|
55
|
+
* @example ".5" → ".5"
|
|
56
|
+
*/
|
|
57
|
+
export function parseNumericValue(value: string): string {
|
|
58
|
+
value = value
|
|
59
|
+
// 1. Remove everything except digits and dots
|
|
60
|
+
.replace(/[^\d.]/g, '')
|
|
61
|
+
// 2. Keep only the first dot
|
|
62
|
+
.replace(/\./g, (_, offset, string) =>
|
|
63
|
+
string.indexOf('.') === offset ? '.' : ''
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
return value;
|
|
67
|
+
}
|
package/src/utils/wallets.ts
CHANGED
|
@@ -23,13 +23,10 @@ import {
|
|
|
23
23
|
import { legacyReadAccountAddress as readAccountAddress } from '@rango-dev/wallets-core/legacy';
|
|
24
24
|
import {
|
|
25
25
|
detectInstallLink,
|
|
26
|
-
getCosmosExperimentalChainInfo,
|
|
27
26
|
isEvmAddress,
|
|
28
|
-
KEPLR_COMPATIBLE_WALLETS,
|
|
29
27
|
Networks,
|
|
30
28
|
} from '@rango-dev/wallets-shared';
|
|
31
29
|
import BigNumber from 'bignumber.js';
|
|
32
|
-
import { isCosmosBlockchain } from 'rango-types';
|
|
33
30
|
|
|
34
31
|
import { ZERO } from '../constants/numbers';
|
|
35
32
|
import {
|
|
@@ -314,35 +311,6 @@ function numberWithThousandSeparator(number: string | number): string {
|
|
|
314
311
|
return parts.join('.');
|
|
315
312
|
}
|
|
316
313
|
|
|
317
|
-
export const isExperimentalChain = (
|
|
318
|
-
blockchains: BlockchainMeta[],
|
|
319
|
-
wallet: string
|
|
320
|
-
): boolean => {
|
|
321
|
-
const cosmosExperimentalChainInfo = getCosmosExperimentalChainInfo(
|
|
322
|
-
Object.entries(blockchains)
|
|
323
|
-
.map(([, blockchainMeta]) => blockchainMeta)
|
|
324
|
-
.filter(isCosmosBlockchain)
|
|
325
|
-
);
|
|
326
|
-
return (
|
|
327
|
-
cosmosExperimentalChainInfo &&
|
|
328
|
-
!!cosmosExperimentalChainInfo[wallet]?.experimental
|
|
329
|
-
);
|
|
330
|
-
};
|
|
331
|
-
|
|
332
|
-
export const getKeplrCompatibleConnectedWallets = (
|
|
333
|
-
selectableWallets: Wallet[]
|
|
334
|
-
): WalletType[] => {
|
|
335
|
-
const connectedWalletTypes = new Set(
|
|
336
|
-
selectableWallets.map((wallet) => {
|
|
337
|
-
return wallet.walletType;
|
|
338
|
-
})
|
|
339
|
-
);
|
|
340
|
-
|
|
341
|
-
return KEPLR_COMPATIBLE_WALLETS.filter((compatibleWallet) =>
|
|
342
|
-
connectedWalletTypes.has(compatibleWallet)
|
|
343
|
-
);
|
|
344
|
-
};
|
|
345
|
-
|
|
346
314
|
function representAmountInNumber(amount: string, decimals: number): string {
|
|
347
315
|
return new BigNumber(amount).shiftedBy(-decimals).toFixed();
|
|
348
316
|
}
|
|
@@ -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,CAaR"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExperimentalChain.d.ts","sourceRoot":"","sources":["../../../src/components/WalletStatefulConnect/ExperimentalChain.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,UAAU,SAAS;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,SAAS,qBA4BjD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExperimentalChainStatus.d.ts","sourceRoot":"","sources":["../../../src/components/WalletStatefulConnect/ExperimentalChainStatus.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAGjE,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,SAAS,qBAsBvD"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { PropTypes } from './ExperimentalChainStatus.types';
|
|
2
|
-
import type { MessageType } from '@rango-dev/ui';
|
|
3
|
-
export declare function generateMessageByStatus(status: PropTypes['status'], blockchainDisplayName: string | undefined): {
|
|
4
|
-
type: MessageType;
|
|
5
|
-
title: string;
|
|
6
|
-
description: string;
|
|
7
|
-
};
|
|
8
|
-
//# sourceMappingURL=ExperimentalChainStatus.helpers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExperimentalChainStatus.helpers.d.ts","sourceRoot":"","sources":["../../../src/components/WalletStatefulConnect/ExperimentalChainStatus.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAIjD,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,EAC3B,qBAAqB,EAAE,MAAM,GAAG,SAAS,GACxC;IACD,IAAI,EAAE,WAAW,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;CACrB,CAwCA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExperimentalChainStatus.types.d.ts","sourceRoot":"","sources":["../../../src/components/WalletStatefulConnect/ExperimentalChainStatus.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,aAAa,GAAG,WAAW,GAAG,UAAU,CAAC;IACjD,KAAK,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { BlockchainMeta } from 'rango-types';
|
|
2
|
-
|
|
3
|
-
export function generateExplorerLink(
|
|
4
|
-
address: string | null,
|
|
5
|
-
blockchain: BlockchainMeta
|
|
6
|
-
): string {
|
|
7
|
-
// We don't have Cosmos explorer url in API.
|
|
8
|
-
if (blockchain.type === 'COSMOS') {
|
|
9
|
-
return '';
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const explorerLinkPattern = blockchain.info?.addressUrl;
|
|
13
|
-
|
|
14
|
-
if (!explorerLinkPattern || !address) {
|
|
15
|
-
return '';
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
return explorerLinkPattern.replace('{wallet}', address);
|
|
19
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { i18n } from '@lingui/core';
|
|
2
|
-
import { Button, Divider, MessageBox } from '@rango-dev/ui';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
|
|
5
|
-
interface PropTypes {
|
|
6
|
-
displayName?: string;
|
|
7
|
-
onConfirm: () => void;
|
|
8
|
-
id: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function ExperimentalChain(props: PropTypes) {
|
|
12
|
-
const { displayName, onConfirm, id } = props;
|
|
13
|
-
|
|
14
|
-
return (
|
|
15
|
-
<MessageBox
|
|
16
|
-
id={id}
|
|
17
|
-
title={i18n.t({
|
|
18
|
-
id: 'Add {blockchainDisplayName} Chain',
|
|
19
|
-
values: { blockchainDisplayName: displayName },
|
|
20
|
-
})}
|
|
21
|
-
type="warning"
|
|
22
|
-
description={i18n.t({
|
|
23
|
-
id: 'Would you like to add the {blockchainDisplayName} experimental chain to your wallet?',
|
|
24
|
-
values: { blockchainDisplayName: displayName },
|
|
25
|
-
})}>
|
|
26
|
-
<Divider size={18} />
|
|
27
|
-
<Divider size={32} />
|
|
28
|
-
<Button
|
|
29
|
-
id="widget-experimental-chain-confirm-btn"
|
|
30
|
-
onClick={onConfirm}
|
|
31
|
-
variant="outlined"
|
|
32
|
-
type="primary"
|
|
33
|
-
fullWidth
|
|
34
|
-
size="large">
|
|
35
|
-
{i18n.t('Confirm')}
|
|
36
|
-
</Button>
|
|
37
|
-
</MessageBox>
|
|
38
|
-
);
|
|
39
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import type { PropTypes } from './ExperimentalChainStatus.types';
|
|
2
|
-
import type { MessageType } from '@rango-dev/ui';
|
|
3
|
-
|
|
4
|
-
import { i18n } from '@lingui/core';
|
|
5
|
-
|
|
6
|
-
export function generateMessageByStatus(
|
|
7
|
-
status: PropTypes['status'],
|
|
8
|
-
blockchainDisplayName: string | undefined
|
|
9
|
-
): {
|
|
10
|
-
type: MessageType;
|
|
11
|
-
title: string;
|
|
12
|
-
description: string;
|
|
13
|
-
} {
|
|
14
|
-
switch (status) {
|
|
15
|
-
case 'in-progress':
|
|
16
|
-
return {
|
|
17
|
-
type: 'loading',
|
|
18
|
-
title: i18n.t({
|
|
19
|
-
id: 'Add {blockchainDisplayName} Chain',
|
|
20
|
-
values: { blockchainDisplayName },
|
|
21
|
-
}),
|
|
22
|
-
description: i18n.t({
|
|
23
|
-
id: 'Please approve the experimental chain pop-up in your wallet.',
|
|
24
|
-
values: { blockchainDisplayName },
|
|
25
|
-
}),
|
|
26
|
-
};
|
|
27
|
-
case 'completed':
|
|
28
|
-
return {
|
|
29
|
-
type: 'success',
|
|
30
|
-
title: i18n.t({
|
|
31
|
-
id: '{blockchainDisplayName} Chain Added',
|
|
32
|
-
values: { blockchainDisplayName },
|
|
33
|
-
}),
|
|
34
|
-
description: i18n.t({
|
|
35
|
-
id: 'The {blockchainDisplayName} chain has been successfully added to your wallet.',
|
|
36
|
-
values: { blockchainDisplayName },
|
|
37
|
-
}),
|
|
38
|
-
};
|
|
39
|
-
case 'rejected':
|
|
40
|
-
return {
|
|
41
|
-
type: 'error',
|
|
42
|
-
title: i18n.t('Request Rejected'),
|
|
43
|
-
description: i18n.t({
|
|
44
|
-
id: "You've rejected adding {blockchainDisplayName} chain to your wallet.",
|
|
45
|
-
values: { blockchainDisplayName },
|
|
46
|
-
}),
|
|
47
|
-
};
|
|
48
|
-
default:
|
|
49
|
-
throw new Error(
|
|
50
|
-
`Showing information about an experimentation chain status needs to be defined first. status: ${status}`
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { PropTypes } from './ExperimentalChainStatus.types';
|
|
2
|
-
|
|
3
|
-
import { Image, MessageBox } from '@rango-dev/ui';
|
|
4
|
-
import React from 'react';
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
LogoContainer,
|
|
8
|
-
Spinner,
|
|
9
|
-
WalletImageContainer,
|
|
10
|
-
} from '../ConfirmWalletsModal/WalletList.styles';
|
|
11
|
-
|
|
12
|
-
import { generateMessageByStatus } from './ExperimentalChainStatus.helpers';
|
|
13
|
-
|
|
14
|
-
export function ExperimentalChainStatus(props: PropTypes) {
|
|
15
|
-
const { status, displayName, image } = props;
|
|
16
|
-
const data = generateMessageByStatus(status, displayName);
|
|
17
|
-
const hasImage = status == 'in-progress';
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<MessageBox
|
|
21
|
-
type={data.type}
|
|
22
|
-
title={data.title}
|
|
23
|
-
description={data.description}
|
|
24
|
-
icon={
|
|
25
|
-
hasImage ? (
|
|
26
|
-
<LogoContainer>
|
|
27
|
-
<WalletImageContainer>
|
|
28
|
-
<Image src={image} size={45} />
|
|
29
|
-
</WalletImageContainer>
|
|
30
|
-
<Spinner />
|
|
31
|
-
</LogoContainer>
|
|
32
|
-
) : undefined
|
|
33
|
-
}
|
|
34
|
-
/>
|
|
35
|
-
);
|
|
36
|
-
}
|