@rango-dev/wallets-react 0.47.1-next.3 → 0.47.1-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.
- package/dist/helpers/index.js +1 -1
- package/dist/helpers/index.js.map +3 -3
- package/dist/hub/useHubAdapter.d.ts.map +1 -1
- package/dist/hub/utils.d.ts +0 -1
- package/dist/hub/utils.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +3 -3
- package/package.json +12 -12
- package/src/hub/useHubAdapter.ts +17 -9
- package/src/hub/utils.ts +1 -16
- package/dist/wallets-react.build.json +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/wallets-react",
|
|
3
|
-
"version": "0.47.1-next.
|
|
3
|
+
"version": "0.47.1-next.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"helpers"
|
|
22
22
|
],
|
|
23
23
|
"scripts": {
|
|
24
|
-
"build": "
|
|
24
|
+
"build": "yarn run rangutopia library build --inputs src/index.ts,src/helpers/index.ts",
|
|
25
25
|
"ts-check": "tsc --declaration --emitDeclarationOnly -p ./tsconfig.json",
|
|
26
26
|
"clean": "rimraf dist",
|
|
27
27
|
"format": "prettier --write '{.,src}/**/*.{ts,tsx}'",
|
|
@@ -35,16 +35,16 @@
|
|
|
35
35
|
"react-dom": "^17.0.0 || ^18.0.0"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@hub3js/core": "^0.61.
|
|
39
|
-
"@hub3js/evm": "^0.3.
|
|
40
|
-
"@hub3js/namespaces": "^0.2.
|
|
41
|
-
"@hub3js/solana": "^0.3.
|
|
42
|
-
"@hub3js/std": "^0.2.
|
|
43
|
-
"@hub3js/sui": "^0.2.
|
|
44
|
-
"@hub3js/tvm": "^0.2.
|
|
45
|
-
"@rango-dev/logging-core": "^0.13.0",
|
|
46
|
-
"@rango-dev/wallets-core": "^0.60.1-next.
|
|
47
|
-
"@rango-dev/wallets-shared": "^0.61.1-next.
|
|
38
|
+
"@hub3js/core": "^0.61.1",
|
|
39
|
+
"@hub3js/evm": "^0.3.3",
|
|
40
|
+
"@hub3js/namespaces": "^0.2.5",
|
|
41
|
+
"@hub3js/solana": "^0.3.3",
|
|
42
|
+
"@hub3js/std": "^0.2.3",
|
|
43
|
+
"@hub3js/sui": "^0.2.3",
|
|
44
|
+
"@hub3js/tvm": "^0.2.3",
|
|
45
|
+
"@rango-dev/logging-core": "^0.13.1-next.0",
|
|
46
|
+
"@rango-dev/wallets-core": "^0.60.1-next.4",
|
|
47
|
+
"@rango-dev/wallets-shared": "^0.61.1-next.5",
|
|
48
48
|
"caip": "^1.1.1",
|
|
49
49
|
"rango-types": "^0.5.0",
|
|
50
50
|
"ts-results": "^3.3.0"
|
package/src/hub/useHubAdapter.ts
CHANGED
|
@@ -6,7 +6,12 @@ import type { Accounts, AccountsWithActiveChain } from '@hub3js/std/types';
|
|
|
6
6
|
import type { LegacyNamespaceInputForConnect } from '@rango-dev/wallets-core/legacy';
|
|
7
7
|
|
|
8
8
|
import { utils } from '@hub3js/evm';
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
getSupportedChainsFromNamespace,
|
|
11
|
+
getSupportedChainsFromProvider,
|
|
12
|
+
type WalletInfo,
|
|
13
|
+
type WalletType,
|
|
14
|
+
} from '@rango-dev/wallets-shared';
|
|
10
15
|
import { useEffect, useRef, useState } from 'react';
|
|
11
16
|
import { Ok, Result } from 'ts-results';
|
|
12
17
|
|
|
@@ -22,7 +27,6 @@ import { createQueue, fromAccountIdToLegacyAddressFormat } from './helpers.js';
|
|
|
22
27
|
import { LastConnectedWalletsFromStorage } from './lastConnectedWallets.js';
|
|
23
28
|
import { useHubRefs } from './useHubRefs.js';
|
|
24
29
|
import {
|
|
25
|
-
getSupportedChainsFromProvider,
|
|
26
30
|
isEvmNamespace,
|
|
27
31
|
isSolanaNamespace,
|
|
28
32
|
isUtxoNamespace,
|
|
@@ -182,21 +186,25 @@ export function useHubAdapter(params: UseAdapterParams): ProviderContext {
|
|
|
182
186
|
if (!dataRef.current.allBlockChains) {
|
|
183
187
|
throw new Error(`Blockchains are not available`);
|
|
184
188
|
}
|
|
185
|
-
const providerSupportedChainsOfNamespace = namespacesProperty?.value.data
|
|
186
|
-
.find(
|
|
187
|
-
(providerNamespace) => providerNamespace.value === namespace.namespace
|
|
188
|
-
)
|
|
189
|
-
?.getSupportedChains(dataRef.current.allBlockChains);
|
|
190
189
|
|
|
191
|
-
|
|
190
|
+
const namespaceMeta = namespacesProperty?.value.data.find(
|
|
191
|
+
(providerNamespace) => providerNamespace.value === namespace.namespace
|
|
192
|
+
);
|
|
193
|
+
|
|
194
|
+
if (!namespaceMeta) {
|
|
192
195
|
throw new Error(
|
|
193
196
|
`NamespaceMeta is not defined for requested namespace: ${namespace.namespace}`
|
|
194
197
|
);
|
|
195
198
|
}
|
|
196
199
|
|
|
200
|
+
const supportedChains = getSupportedChainsFromNamespace(
|
|
201
|
+
namespaceMeta,
|
|
202
|
+
dataRef.current.allBlockChains
|
|
203
|
+
);
|
|
204
|
+
|
|
197
205
|
return proxiedNamespace.canSwitchNetwork({
|
|
198
206
|
network,
|
|
199
|
-
supportedChains
|
|
207
|
+
supportedChains,
|
|
200
208
|
});
|
|
201
209
|
},
|
|
202
210
|
async connect(type, namespaces) {
|
package/src/hub/utils.ts
CHANGED
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
type AddEthereumChainParameter,
|
|
21
21
|
convertEvmBlockchainMetaToEvmChainInfo,
|
|
22
22
|
getBlockChainNameFromId,
|
|
23
|
+
getSupportedChainsFromProvider,
|
|
23
24
|
type WalletType,
|
|
24
25
|
} from '@rango-dev/wallets-shared';
|
|
25
26
|
import { AccountId } from 'caip';
|
|
@@ -77,22 +78,6 @@ const lastConnectedWalletsFromStorage = new LastConnectedWalletsFromStorage(
|
|
|
77
78
|
HUB_LAST_CONNECTED_WALLETS
|
|
78
79
|
);
|
|
79
80
|
|
|
80
|
-
export function getSupportedChainsFromProvider(
|
|
81
|
-
provider: Provider,
|
|
82
|
-
allBlockChains: ProviderProps['allBlockChains']
|
|
83
|
-
) {
|
|
84
|
-
const namespacesProperty = provider
|
|
85
|
-
.info()
|
|
86
|
-
?.metadata.properties?.find((property) => property.name === 'namespaces');
|
|
87
|
-
|
|
88
|
-
const supportedChains =
|
|
89
|
-
namespacesProperty?.value.data.flatMap((namespace) =>
|
|
90
|
-
namespace.getSupportedChains(allBlockChains || [])
|
|
91
|
-
) || [];
|
|
92
|
-
|
|
93
|
-
return supportedChains;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
81
|
export function mapHubEventsToLegacy(
|
|
97
82
|
hub: Hub,
|
|
98
83
|
event: Event,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"inputs":{"src/hub/constants.ts":{"bytes":146,"imports":[],"format":"esm"},"src/hub/lastConnectedWallets.ts":{"bytes":5496,"imports":[{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"src/hub/constants.ts","kind":"import-statement","original":"./constants.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/helpers.ts":{"bytes":4652,"imports":[{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"src/hub/constants.ts","kind":"import-statement","original":"../hub/constants.js"},{"path":"src/hub/lastConnectedWallets.ts","kind":"import-statement","original":"../hub/lastConnectedWallets.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/context.ts":{"bytes":960,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"src/helpers.ts":{"bytes":1271,"imports":[{"path":"@rango-dev/logging-core","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/autoConnect.ts":{"bytes":2046,"imports":[{"path":"src/hub/lastConnectedWallets.ts","kind":"import-statement","original":"../hub/lastConnectedWallets.js"},{"path":"src/legacy/mod.ts","kind":"import-statement","original":"./mod.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/hooks.ts":{"bytes":1545,"imports":[{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"src/legacy/context.ts","kind":"import-statement","original":"./context.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/utils.ts":{"bytes":230,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/useAutoConnect.ts":{"bytes":628,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"src/legacy/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/useLegacyProviders.ts":{"bytes":7639,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"src/legacy/autoConnect.ts","kind":"import-statement","original":"./autoConnect.js"},{"path":"src/legacy/helpers.ts","kind":"import-statement","original":"./helpers.js"},{"path":"src/legacy/hooks.ts","kind":"import-statement","original":"./hooks.js"},{"path":"src/legacy/useAutoConnect.ts","kind":"import-statement","original":"./useAutoConnect.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/mod.ts":{"bytes":321,"imports":[{"path":"src/hub/constants.ts","kind":"import-statement","original":"../hub/constants.js"},{"path":"src/legacy/context.ts","kind":"import-statement","original":"./context.js"},{"path":"src/legacy/useLegacyProviders.ts","kind":"import-statement","original":"./useLegacyProviders.js"}],"format":"esm"},"src/hub/helpers.ts":{"bytes":5376,"imports":[{"path":"@hub3js/tvm","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/namespaces/tron","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/namespaces/utxo","kind":"import-statement","external":true},{"path":"caip","kind":"import-statement","external":true},{"path":"ts-results","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/hub/utils.ts":{"bytes":11741,"imports":[{"path":"@hub3js/core/utils","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"caip","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"src/legacy/mod.ts","kind":"import-statement","original":"../legacy/mod.js"},{"path":"src/hub/helpers.ts","kind":"import-statement","original":"./helpers.js"},{"path":"src/hub/lastConnectedWallets.ts","kind":"import-statement","original":"./lastConnectedWallets.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/hub/autoConnect.ts":{"bytes":8562,"imports":[{"path":"@hub3js/core","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"ts-results","kind":"import-statement","external":true},{"path":"src/legacy/mod.ts","kind":"import-statement","original":"../legacy/mod.js"},{"path":"src/hub/helpers.ts","kind":"import-statement","original":"./helpers.js"},{"path":"src/hub/lastConnectedWallets.ts","kind":"import-statement","original":"./lastConnectedWallets.js"},{"path":"src/hub/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/hub/useHubRefs.ts":{"bytes":1249,"imports":[{"path":"@hub3js/core","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"src/hub/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/hub/useHubAdapter.ts":{"bytes":17266,"imports":[{"path":"@hub3js/evm","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"ts-results","kind":"import-statement","external":true},{"path":"src/legacy/mod.ts","kind":"import-statement","original":"../legacy/mod.js"},{"path":"src/legacy/useAutoConnect.ts","kind":"import-statement","original":"../legacy/useAutoConnect.js"},{"path":"src/hub/autoConnect.ts","kind":"import-statement","original":"./autoConnect.js"},{"path":"src/hub/helpers.ts","kind":"import-statement","original":"./helpers.js"},{"path":"src/hub/lastConnectedWallets.ts","kind":"import-statement","original":"./lastConnectedWallets.js"},{"path":"src/hub/useHubRefs.ts","kind":"import-statement","original":"./useHubRefs.js"},{"path":"src/hub/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/hub/mod.ts":{"bytes":162,"imports":[{"path":"src/hub/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"src/hub/useHubAdapter.ts","kind":"import-statement","original":"./useHubAdapter.js"}],"format":"esm"},"src/useProviders.ts":{"bytes":3734,"imports":[{"path":"src/helpers.ts","kind":"import-statement","original":"./helpers.js"},{"path":"src/hub/mod.ts","kind":"import-statement","original":"./hub/mod.js"},{"path":"src/legacy/mod.ts","kind":"import-statement","original":"./legacy/mod.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/provider.tsx":{"bytes":405,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"src/legacy/context.ts","kind":"import-statement","original":"./legacy/context.js"},{"path":"src/useProviders.ts","kind":"import-statement","original":"./useProviders.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/types.ts":{"bytes":5959,"imports":[{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":173,"imports":[{"path":"src/legacy/helpers.ts","kind":"import-statement","original":"./legacy/helpers.js"},{"path":"src/provider.tsx","kind":"import-statement","original":"./provider.js"},{"path":"src/legacy/hooks.ts","kind":"import-statement","original":"./legacy/hooks.js"},{"path":"src/legacy/types.ts","kind":"import-statement","original":"./legacy/types.js"}],"format":"esm"},"src/helpers/index.ts":{"bytes":55,"imports":[{"path":"src/hub/mod.ts","kind":"import-statement","original":"../hub/mod.js"}],"format":"esm"}},"outputs":{"dist/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":118451},"dist/index.js":{"imports":[{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@rango-dev/logging-core","kind":"import-statement","external":true},{"path":"@hub3js/core/utils","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"caip","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@hub3js/tvm","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/namespaces/tron","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/namespaces/utxo","kind":"import-statement","external":true},{"path":"caip","kind":"import-statement","external":true},{"path":"ts-results","kind":"import-statement","external":true},{"path":"@hub3js/evm","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"ts-results","kind":"import-statement","external":true},{"path":"@hub3js/core","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"ts-results","kind":"import-statement","external":true},{"path":"@hub3js/core","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true}],"exports":["Events","Provider","availableWallets","checkWalletProviders","choose","clearPersistance","connectedWallets","defaultWalletState","isAsync","makeEventHandler","needsCheckInstallation","stateReducer","tryPersistWallet","tryRemoveWalletFromPersistance","useWallets"],"entryPoint":"src/index.ts","inputs":{"src/legacy/helpers.ts":{"bytesInOutput":1401},"src/hub/constants.ts":{"bytesInOutput":65},"src/hub/lastConnectedWallets.ts":{"bytesInOutput":1311},"src/index.ts":{"bytesInOutput":0},"src/provider.tsx":{"bytesInOutput":133},"src/legacy/context.ts":{"bytesInOutput":465},"src/helpers.ts":{"bytesInOutput":490},"src/hub/utils.ts":{"bytesInOutput":3485},"src/legacy/mod.ts":{"bytesInOutput":0},"src/legacy/useLegacyProviders.ts":{"bytesInOutput":2309},"src/legacy/autoConnect.ts":{"bytesInOutput":395},"src/legacy/hooks.ts":{"bytesInOutput":460},"src/legacy/useAutoConnect.ts":{"bytesInOutput":197},"src/legacy/utils.ts":{"bytesInOutput":94},"src/hub/helpers.ts":{"bytesInOutput":1989},"src/hub/mod.ts":{"bytesInOutput":0},"src/hub/useHubAdapter.ts":{"bytesInOutput":6209},"src/hub/autoConnect.ts":{"bytesInOutput":2198},"src/hub/useHubRefs.ts":{"bytesInOutput":486},"src/useProviders.ts":{"bytesInOutput":1031},"src/legacy/types.ts":{"bytesInOutput":63}},"bytes":23220},"dist/helpers/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":73377},"dist/helpers/index.js":{"imports":[{"path":"@hub3js/core/utils","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"caip","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@hub3js/tvm","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/namespaces/tron","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/namespaces/utxo","kind":"import-statement","external":true},{"path":"caip","kind":"import-statement","external":true},{"path":"ts-results","kind":"import-statement","external":true},{"path":"@hub3js/evm","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"ts-results","kind":"import-statement","external":true},{"path":"@hub3js/core","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"ts-results","kind":"import-statement","external":true},{"path":"@hub3js/core","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}],"exports":["getAllLegacyProviders"],"entryPoint":"src/helpers/index.ts","inputs":{"src/hub/utils.ts":{"bytesInOutput":473},"src/hub/constants.ts":{"bytesInOutput":65},"src/legacy/mod.ts":{"bytesInOutput":0},"src/legacy/context.ts":{"bytesInOutput":461},"src/legacy/useLegacyProviders.ts":{"bytesInOutput":52},"src/hub/lastConnectedWallets.ts":{"bytesInOutput":1311},"src/legacy/helpers.ts":{"bytesInOutput":59},"src/legacy/hooks.ts":{"bytesInOutput":109},"src/legacy/useAutoConnect.ts":{"bytesInOutput":48},"src/hub/helpers.ts":{"bytesInOutput":479},"src/hub/mod.ts":{"bytesInOutput":0},"src/hub/useHubAdapter.ts":{"bytesInOutput":180},"src/hub/autoConnect.ts":{"bytesInOutput":165},"src/hub/useHubRefs.ts":{"bytesInOutput":86},"src/helpers/index.ts":{"bytesInOutput":0}},"bytes":3637}}}
|