@rango-dev/wallets-react 0.30.2-next.1 → 0.30.2-next.11
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/helpers.d.ts +8 -0
- package/dist/hub/helpers.d.ts.map +1 -1
- package/dist/hub/lastConnectedWallets.d.ts.map +1 -1
- package/dist/hub/useHubAdapter.d.ts +2 -1
- package/dist/hub/useHubAdapter.d.ts.map +1 -1
- package/dist/hub/useHubRefs.d.ts.map +1 -1
- package/dist/hub/utils.d.ts +8 -2
- package/dist/hub/utils.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +3 -3
- package/dist/legacy/types.d.ts +6 -2
- package/dist/legacy/types.d.ts.map +1 -1
- package/dist/legacy/useLegacyProviders.d.ts.map +1 -1
- package/dist/wallets-react.build.json +1 -1
- package/package.json +4 -4
- package/src/hub/helpers.ts +56 -0
- package/src/hub/lastConnectedWallets.ts +24 -5
- package/src/hub/useHubAdapter.ts +58 -31
- package/src/hub/useHubRefs.ts +4 -7
- package/src/hub/utils.ts +50 -26
- package/src/legacy/context.ts +10 -10
- package/src/legacy/types.ts +6 -2
- package/src/legacy/useLegacyProviders.ts +5 -2
- package/src/useProviders.ts +5 -5
|
@@ -19,6 +19,9 @@ import {
|
|
|
19
19
|
import { useInitializers } from './hooks.js';
|
|
20
20
|
import { useAutoConnect } from './useAutoConnect.js';
|
|
21
21
|
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23
|
+
type ProviderType = any;
|
|
24
|
+
|
|
22
25
|
export type LegacyProviderProps = Omit<ProviderProps, 'providers'> & {
|
|
23
26
|
providers: LegacyProviderInterface[];
|
|
24
27
|
};
|
|
@@ -86,7 +89,7 @@ export function useLegacyProviders(
|
|
|
86
89
|
}
|
|
87
90
|
},
|
|
88
91
|
async disconnectAll() {
|
|
89
|
-
const disconnect_promises: Promise<
|
|
92
|
+
const disconnect_promises: Promise<void>[] = [];
|
|
90
93
|
|
|
91
94
|
/*
|
|
92
95
|
* When a wallet is initializing, a record will be added to `providersState`
|
|
@@ -134,7 +137,7 @@ export function useLegacyProviders(
|
|
|
134
137
|
: false;
|
|
135
138
|
},
|
|
136
139
|
providers() {
|
|
137
|
-
const providers: { [type in WalletType]?:
|
|
140
|
+
const providers: { [type in WalletType]?: ProviderType } = {};
|
|
138
141
|
availableWallets(providersState).forEach((type) => {
|
|
139
142
|
const wallet = wallets.get(type);
|
|
140
143
|
if (wallet) {
|
package/src/useProviders.ts
CHANGED
|
@@ -42,18 +42,18 @@ function useProviders(props: ProviderProps) {
|
|
|
42
42
|
}
|
|
43
43
|
return legacyApi.canSwitchNetworkTo(type, network);
|
|
44
44
|
},
|
|
45
|
-
async connect(type,
|
|
45
|
+
async connect(type, namespaces): Promise<ConnectResult[]> {
|
|
46
46
|
const hubProvider = findProviderByType(hubProviders, type);
|
|
47
47
|
if (hubProvider) {
|
|
48
|
-
return await hubApi.connect(type,
|
|
48
|
+
return await hubApi.connect(type, namespaces);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
return await legacyApi.connect(type,
|
|
51
|
+
return await legacyApi.connect(type, namespaces);
|
|
52
52
|
},
|
|
53
|
-
async disconnect(type): Promise<void> {
|
|
53
|
+
async disconnect(type, namespaces): Promise<void> {
|
|
54
54
|
const hubProvider = findProviderByType(hubProviders, type);
|
|
55
55
|
if (hubProvider) {
|
|
56
|
-
return await hubApi.disconnect(type);
|
|
56
|
+
return await hubApi.disconnect(type, namespaces);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
return await legacyApi.disconnect(type);
|