@rango-dev/widget-embedded 0.64.4-next.3 → 0.64.4-next.5

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.
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/store/slices/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAEV,kCAAkC,EACnC,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,QAAQ,CAAC;AAC1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AA6B7C,eAAO,MAAM,cAAc,EAAE,kCAe5B,CAAC;AAEF,UAAU,aAAa;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,UAAU,YAAY;IACpB,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC7B;AAUD,MAAM,WAAW,WAAW;IAE1B,MAAM,EAAE,kCAAkC,CAAC;IAC3C,YAAY,EAAE,YAAY,CAAC;IAC3B,gBAAgB,EAAE,MAAM,OAAO,CAAC;IAChC,mBAAmB,EAAE,MAAM,MAAM,EAAE,CAAC;IACpC,2BAA2B,EAAE,MAAM,MAAM,EAAE,CAAC;IAC5C,uBAAuB,EAAE,MAAM,OAAO,CAAC;IACvC,YAAY,EAAE,CAAC,MAAM,EAAE,kCAAkC,KAAK,IAAI,CAAC;IACnE,kBAAkB,EAAE,CAAC,CAAC,SAAS,MAAM,YAAY,EAC/C,IAAI,EAAE,CAAC,EACP,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,KACnB,IAAI,CAAC;IAEV,MAAM,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/B,YAAY,EAAE,CAAC,CAAC,SAAS,MAAM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,YAAY,EAC/C,IAAI,EAAE,CAAC,EACP,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,KACnB,IAAI,CAAC;IAEV,MAAM,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/B,YAAY,EAAE,CAAC,CAAC,SAAS,MAAM,aAAa,EAC1C,IAAI,EAAE,CAAC,EACP,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,KACpB,IAAI,CAAC;IACV,YAAY,EAAE,QAAQ,EAAE,CAAC;IACzB,oBAAoB,EAAE,MAAM,IAAI,CAAC;IACjC,qBAAqB,EAAE,MAAM,QAAQ,EAAE,CAAC;CACzC;AAqCD,eAAO,MAAM,iBAAiB,EAAE,2BAA2B,CACzD,kCAAkC,EAClC,WAAW,GAAG,aAAa,GAAG,SAAS,EACvC,WAAW,CA4HZ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rango-dev/widget-embedded",
3
- "version": "0.64.4-next.3",
3
+ "version": "0.64.4-next.5",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "source": "./src/index.ts",
@@ -24,18 +24,18 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@hub3js/core": "^0.63.0",
27
- "@hub3js/namespaces": "^0.6.0",
27
+ "@hub3js/namespaces": "^0.7.0",
28
28
  "@lingui/core": "4.2.1",
29
29
  "@lingui/react": "4.2.1",
30
- "@rango-dev/internal-blockchains": "^0.2.2-next.1",
30
+ "@rango-dev/internal-blockchains": "^0.2.2-next.2",
31
31
  "@rango-dev/logging-core": "^0.15.1-next.0",
32
- "@rango-dev/provider-all": "^0.66.4-next.3",
32
+ "@rango-dev/provider-all": "^0.66.4-next.5",
33
33
  "@rango-dev/queue-manager-core": "^0.35.1-next.0",
34
- "@rango-dev/queue-manager-rango-preset": "^0.65.2-next.2",
34
+ "@rango-dev/queue-manager-rango-preset": "^0.65.2-next.3",
35
35
  "@rango-dev/queue-manager-react": "^0.35.1-next.0",
36
36
  "@rango-dev/signer-solana": "^0.50.1-next.1",
37
- "@rango-dev/ui": "^0.66.2-next.2",
38
- "@rango-dev/wallets-react": "^0.49.2-next.2",
37
+ "@rango-dev/ui": "^0.66.2-next.3",
38
+ "@rango-dev/wallets-react": "^0.49.2-next.3",
39
39
  "bignumber.js": "^9.1.1",
40
40
  "copy-to-clipboard": "^3.3.3",
41
41
  "crypto-browserify": "^3.12.1",
@@ -6,7 +6,7 @@ import { Events } from '@rango-dev/wallets-react';
6
6
  /*
7
7
  * propagate updates for Dapps using external wallets
8
8
  *
9
- * Note: to take more control over the public interface and wallets-core interface (which may be changed) we use this layer
9
+ * Note: to take more control over the public interface and `@hub3js/core` interface (which may be changed) we use this layer
10
10
  */
11
11
  export function propagateEvents(
12
12
  cb: OnUpdateState,
@@ -47,7 +47,7 @@ export interface UseStatefulConnect {
47
47
  * This hook maintains state of wallet and checks if additional information
48
48
  * is required to call the `connect` method of `core` package properly.
49
49
  *
50
- * The final goal is running `runConnect` which calls `wallets/core`'s `connect` method.
50
+ * The final goal is running `runConnect` which calls `@hub3js/core`'s `connect` method.
51
51
  * But sometimes it needs to get more information like what namespace it should be connected to,
52
52
  * or what derivation path should be used for.
53
53
  *
@@ -14,7 +14,6 @@ import {
14
14
 
15
15
  import { cacheService } from '../../services/cacheService';
16
16
  import {
17
- configWalletsToWalletName,
18
17
  matchAndGenerateProviders,
19
18
  type ProvidersOptions,
20
19
  } from '../../utils/providers';
@@ -41,14 +40,6 @@ export const DEFAULT_CONFIG: WidgetConfigWithoutLegacyProviders = {
41
40
  excludeLiquiditySources: true,
42
41
  customDestination: true,
43
42
  variant: 'default',
44
- trezorManifest: {
45
- appUrl: 'https://widget.rango.exchange/',
46
- email: 'hi+trezorwidget@rango.exchange',
47
- },
48
- tonConnect: {
49
- manifestUrl:
50
- 'https://raw.githubusercontent.com/rango-exchange/assets/refs/heads/main/manifests/tonconnect/manifest.json',
51
- },
52
43
  };
53
44
 
54
45
  interface IframeConfigs {
@@ -97,20 +88,33 @@ function generateProviders(
97
88
  const allProviders = getAllProviders();
98
89
  const allBuiltProviders = allProviders.map((build) => build());
99
90
 
100
- const providerNames = configWalletsToWalletName(allBuiltProviders);
91
+ return allBuiltProviders.filter((provider) =>
92
+ hasRequiredConfig(provider.id, config)
93
+ );
94
+ }
101
95
 
102
- const filteredProviders = allBuiltProviders.filter((_, index) => {
103
- if (
104
- providerNames[index] === WalletTypes.LEDGER_WALLET &&
105
- (!config.ledgerWallet?.apiKey || !config.ledgerWallet?.dAppIdentifier)
106
- ) {
107
- return false;
108
- }
96
+ const REQUIRED_CONFIG_BY_WALLET: Partial<
97
+ Record<string, keyof WidgetConfigWithoutLegacyProviders>
98
+ > = {
99
+ [WalletTypes.LEDGER_WALLET]: 'ledgerWallet',
100
+ [WalletTypes.TREZOR]: 'trezorManifest',
101
+ [WalletTypes.TON_CONNECT]: 'tonConnect',
102
+ [WalletTypes.WALLET_CONNECT_2]: 'walletConnectProjectId',
103
+ };
109
104
 
105
+ function hasRequiredConfig(
106
+ walletId: string,
107
+ config: WidgetConfigWithoutLegacyProviders
108
+ ): boolean {
109
+ const requiredKey = REQUIRED_CONFIG_BY_WALLET[walletId];
110
+ if (!requiredKey || config[requiredKey]) {
110
111
  return true;
111
- });
112
+ }
112
113
 
113
- return filteredProviders;
114
+ console.warn(
115
+ `${walletId} is listed in config wallets but ${requiredKey} config is not provided!`
116
+ );
117
+ return false;
114
118
  }
115
119
 
116
120
  export const createConfigSlice: StateCreatorWithInitialData<