@rango-dev/wallets-react 0.26.1-next.3 → 0.27.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/dist/index.js +1 -1
- package/dist/index.js.map +4 -4
- package/dist/legacy/constants.d.ts +2 -0
- package/dist/legacy/constants.d.ts.map +1 -0
- package/dist/legacy/helpers.d.ts +6 -2
- package/dist/legacy/helpers.d.ts.map +1 -1
- package/dist/legacy/types.d.ts +4 -12
- package/dist/legacy/types.d.ts.map +1 -1
- package/dist/legacy/useAutoConnect.d.ts +4 -5
- package/dist/legacy/useAutoConnect.d.ts.map +1 -1
- package/dist/legacy/useLegacyProviders.d.ts +1 -5
- package/dist/legacy/useLegacyProviders.d.ts.map +1 -1
- package/dist/wallets-react.build.json +1 -1
- package/package.json +7 -15
- package/src/legacy/constants.ts +1 -0
- package/src/legacy/helpers.ts +92 -17
- package/src/legacy/types.ts +6 -14
- package/src/legacy/useAutoConnect.ts +16 -8
- package/src/legacy/useLegacyProviders.ts +7 -45
- package/src/provider.tsx +3 -3
- package/dist/hub/autoConnect.d.ts +0 -9
- package/dist/hub/autoConnect.d.ts.map +0 -1
- package/dist/hub/constants.d.ts +0 -3
- package/dist/hub/constants.d.ts.map +0 -1
- package/dist/hub/helpers.d.ts +0 -19
- package/dist/hub/helpers.d.ts.map +0 -1
- package/dist/hub/lastConnectedWallets.d.ts +0 -16
- package/dist/hub/lastConnectedWallets.d.ts.map +0 -1
- package/dist/hub/mod.d.ts +0 -3
- package/dist/hub/mod.d.ts.map +0 -1
- package/dist/hub/types.d.ts +0 -4
- package/dist/hub/types.d.ts.map +0 -1
- package/dist/hub/useHubAdapter.d.ts +0 -10
- package/dist/hub/useHubAdapter.d.ts.map +0 -1
- package/dist/hub/useHubRefs.d.ts +0 -7
- package/dist/hub/useHubRefs.d.ts.map +0 -1
- package/dist/hub/utils.d.ts +0 -38
- package/dist/hub/utils.d.ts.map +0 -1
- package/dist/legacy/autoConnect.d.ts +0 -8
- package/dist/legacy/autoConnect.d.ts.map +0 -1
- package/dist/legacy/mod.d.ts +0 -5
- package/dist/legacy/mod.d.ts.map +0 -1
- package/dist/legacy/utils.d.ts +0 -3
- package/dist/legacy/utils.d.ts.map +0 -1
- package/dist/test-utils/env.d.ts +0 -7
- package/dist/test-utils/env.d.ts.map +0 -1
- package/dist/test-utils/fixtures.d.ts +0 -14
- package/dist/test-utils/fixtures.d.ts.map +0 -1
- package/dist/useProviders.d.ts +0 -4
- package/dist/useProviders.d.ts.map +0 -1
- package/src/hub/autoConnect.ts +0 -186
- package/src/hub/constants.ts +0 -2
- package/src/hub/helpers.ts +0 -67
- package/src/hub/lastConnectedWallets.ts +0 -117
- package/src/hub/mod.ts +0 -2
- package/src/hub/types.ts +0 -12
- package/src/hub/useHubAdapter.ts +0 -337
- package/src/hub/useHubRefs.ts +0 -41
- package/src/hub/utils.ts +0 -389
- package/src/legacy/autoConnect.ts +0 -78
- package/src/legacy/mod.ts +0 -13
- package/src/legacy/utils.ts +0 -7
- package/src/test-utils/env.ts +0 -10
- package/src/test-utils/fixtures.ts +0 -238
- package/src/useProviders.ts +0 -120
package/package.json
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/wallets-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"source": "./src/index.ts",
|
|
7
7
|
"main": "./dist/index.js",
|
|
8
8
|
"exports": {
|
|
9
|
-
".":
|
|
10
|
-
"types": "./dist/index.d.ts",
|
|
11
|
-
"default": "./dist/index.js"
|
|
12
|
-
}
|
|
9
|
+
".": "./dist/index.js"
|
|
13
10
|
},
|
|
11
|
+
"typings": "dist/index.d.ts",
|
|
14
12
|
"files": [
|
|
15
13
|
"dist",
|
|
16
14
|
"src"
|
|
@@ -20,9 +18,7 @@
|
|
|
20
18
|
"ts-check": "tsc --declaration --emitDeclarationOnly -p ./tsconfig.json",
|
|
21
19
|
"clean": "rimraf dist",
|
|
22
20
|
"format": "prettier --write '{.,src}/**/*.{ts,tsx}'",
|
|
23
|
-
"lint": "eslint \"**/*.{ts,tsx}\" --ignore-path ../../.eslintignore"
|
|
24
|
-
"test": "vitest",
|
|
25
|
-
"coverage": "vitest run --coverage"
|
|
21
|
+
"lint": "eslint \"**/*.{ts,tsx}\" --ignore-path ../../.eslintignore"
|
|
26
22
|
},
|
|
27
23
|
"peerDependencies": {
|
|
28
24
|
"@types/react": "^17.0.0 || ^18.0.0",
|
|
@@ -30,15 +26,11 @@
|
|
|
30
26
|
"react-dom": "^17.0.0 || ^18.0.0"
|
|
31
27
|
},
|
|
32
28
|
"dependencies": {
|
|
33
|
-
"@rango-dev/wallets-core": "^0.40.
|
|
34
|
-
"@rango-dev/wallets-shared": "^0.
|
|
29
|
+
"@rango-dev/wallets-core": "^0.40.0",
|
|
30
|
+
"@rango-dev/wallets-shared": "^0.41.0",
|
|
35
31
|
"rango-types": "^0.1.74"
|
|
36
32
|
},
|
|
37
|
-
"devDependencies": {
|
|
38
|
-
"@types/react": "^18.0.25",
|
|
39
|
-
"@types/react-dom": "^18.0.25"
|
|
40
|
-
},
|
|
41
33
|
"publishConfig": {
|
|
42
34
|
"access": "public"
|
|
43
35
|
}
|
|
44
|
-
}
|
|
36
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const LAST_CONNECTED_WALLETS = 'last-connected-wallets';
|
package/src/legacy/helpers.ts
CHANGED
|
@@ -6,15 +6,15 @@ import type {
|
|
|
6
6
|
} from './types.js';
|
|
7
7
|
import type {
|
|
8
8
|
LegacyOptions as Options,
|
|
9
|
+
LegacyWallet as Wallet,
|
|
9
10
|
LegacyEventHandler as WalletEventHandler,
|
|
10
11
|
LegacyState as WalletState,
|
|
11
12
|
} from '@rango-dev/wallets-core/legacy';
|
|
12
|
-
import type { WalletType } from '@rango-dev/wallets-shared';
|
|
13
|
+
import type { WalletConfig, WalletType } from '@rango-dev/wallets-shared';
|
|
13
14
|
|
|
14
15
|
import { Persistor } from '@rango-dev/wallets-core/legacy';
|
|
15
16
|
|
|
16
|
-
import {
|
|
17
|
-
import { LastConnectedWalletsFromStorage } from '../hub/lastConnectedWallets.js';
|
|
17
|
+
import { LAST_CONNECTED_WALLETS } from './constants.js';
|
|
18
18
|
|
|
19
19
|
export function choose(wallets: any[], type: WalletType): any | null {
|
|
20
20
|
return wallets.find((wallet) => wallet.type === type) || null;
|
|
@@ -109,22 +109,26 @@ export async function tryPersistWallet({
|
|
|
109
109
|
getState: (walletType: WalletType) => WalletState;
|
|
110
110
|
}) {
|
|
111
111
|
if (walletActions.canEagerConnect) {
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
);
|
|
115
|
-
const lastConnectedWallets = lastConnectedWalletsFromStorage.list();
|
|
116
|
-
const walletAlreadyPersisted = !!lastConnectedWallets[type];
|
|
112
|
+
const persistor = new Persistor<string[]>();
|
|
113
|
+
const wallets = persistor.getItem(LAST_CONNECTED_WALLETS);
|
|
117
114
|
|
|
118
115
|
/*
|
|
119
116
|
*If on the last attempt we are unable to eagerly connect to any wallet and the user connects any wallet manualy,
|
|
120
117
|
*persistance will be outdated and will need to be removed.
|
|
121
118
|
*/
|
|
122
|
-
|
|
119
|
+
const shouldClearPersistance = wallets?.find(
|
|
120
|
+
(walletType) => !getState(walletType).connected
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
if (shouldClearPersistance) {
|
|
123
124
|
clearPersistance();
|
|
124
125
|
}
|
|
125
126
|
|
|
126
|
-
|
|
127
|
-
|
|
127
|
+
const walletAlreadyPersisted = !!wallets?.find((wallet) => wallet === type);
|
|
128
|
+
if (wallets && !walletAlreadyPersisted) {
|
|
129
|
+
persistor.setItem(LAST_CONNECTED_WALLETS, wallets.concat(type));
|
|
130
|
+
} else {
|
|
131
|
+
persistor.setItem(LAST_CONNECTED_WALLETS, [type]);
|
|
128
132
|
}
|
|
129
133
|
}
|
|
130
134
|
}
|
|
@@ -137,21 +141,92 @@ export function tryRemoveWalletFromPersistance({
|
|
|
137
141
|
walletActions: WalletActions;
|
|
138
142
|
}) {
|
|
139
143
|
if (walletActions.canEagerConnect) {
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
)
|
|
143
|
-
|
|
144
|
+
const persistor = new Persistor<string[]>();
|
|
145
|
+
const wallets = persistor.getItem(LAST_CONNECTED_WALLETS);
|
|
146
|
+
if (wallets) {
|
|
147
|
+
persistor.setItem(
|
|
148
|
+
LAST_CONNECTED_WALLETS,
|
|
149
|
+
wallets.filter((wallet) => wallet !== type)
|
|
150
|
+
);
|
|
151
|
+
}
|
|
144
152
|
}
|
|
145
153
|
}
|
|
146
154
|
|
|
147
155
|
export function clearPersistance() {
|
|
148
156
|
const persistor = new Persistor<string[]>();
|
|
149
|
-
const wallets = persistor.getItem(
|
|
157
|
+
const wallets = persistor.getItem(LAST_CONNECTED_WALLETS);
|
|
150
158
|
if (wallets) {
|
|
151
|
-
persistor.removeItem(
|
|
159
|
+
persistor.removeItem(LAST_CONNECTED_WALLETS);
|
|
152
160
|
}
|
|
153
161
|
}
|
|
154
162
|
|
|
163
|
+
/*
|
|
164
|
+
*If a wallet has multiple providers and one of them can be eagerly connected,
|
|
165
|
+
*then the whole wallet will support it at that point and we try to connect to that wallet as usual in eagerConnect method.
|
|
166
|
+
*/
|
|
167
|
+
export async function autoConnect(
|
|
168
|
+
wallets: WalletProviders,
|
|
169
|
+
getWalletInstance: (wallet: {
|
|
170
|
+
actions: WalletActions;
|
|
171
|
+
config: WalletConfig;
|
|
172
|
+
}) => Wallet<any>
|
|
173
|
+
) {
|
|
174
|
+
const persistor = new Persistor<string[]>();
|
|
175
|
+
const lastConnectedWallets = persistor.getItem(LAST_CONNECTED_WALLETS);
|
|
176
|
+
if (lastConnectedWallets && lastConnectedWallets.length) {
|
|
177
|
+
const connect_promises: {
|
|
178
|
+
walletType: WalletType;
|
|
179
|
+
eagerConnect: () => Promise<any>;
|
|
180
|
+
}[] = [];
|
|
181
|
+
lastConnectedWallets.forEach((walletType) => {
|
|
182
|
+
const wallet = wallets.get(walletType);
|
|
183
|
+
|
|
184
|
+
if (!!wallet) {
|
|
185
|
+
const walletInstance = getWalletInstance(wallet);
|
|
186
|
+
connect_promises.push({
|
|
187
|
+
walletType,
|
|
188
|
+
eagerConnect: walletInstance.eagerConnect.bind(walletInstance),
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
const result = await Promise.allSettled(
|
|
194
|
+
connect_promises.map(async ({ eagerConnect }) => eagerConnect())
|
|
195
|
+
);
|
|
196
|
+
|
|
197
|
+
const canRestoreAnyConnection = !!result.find(
|
|
198
|
+
({ status }) => status === 'fulfilled'
|
|
199
|
+
);
|
|
200
|
+
|
|
201
|
+
/*
|
|
202
|
+
*After successfully connecting to at least one wallet,
|
|
203
|
+
*we will removing the other wallets from persistence.
|
|
204
|
+
*If we are unable to connect to any wallet,
|
|
205
|
+
*the persistence will not be removed and the eager connection will be retried with another page load.
|
|
206
|
+
*/
|
|
207
|
+
if (canRestoreAnyConnection) {
|
|
208
|
+
const walletsToRemoveFromPersistance: WalletType[] = [];
|
|
209
|
+
result.forEach((settleResult, index) => {
|
|
210
|
+
const { status } = settleResult;
|
|
211
|
+
|
|
212
|
+
if (status === 'rejected') {
|
|
213
|
+
walletsToRemoveFromPersistance.push(
|
|
214
|
+
connect_promises[index].walletType
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
if (walletsToRemoveFromPersistance.length) {
|
|
220
|
+
persistor.setItem(
|
|
221
|
+
LAST_CONNECTED_WALLETS,
|
|
222
|
+
lastConnectedWallets.filter(
|
|
223
|
+
(walletType) => !walletsToRemoveFromPersistance.includes(walletType)
|
|
224
|
+
)
|
|
225
|
+
);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
155
230
|
/*
|
|
156
231
|
*Our event handler includes an internal state updater, and a notifier
|
|
157
232
|
*for the outside listener.
|
package/src/legacy/types.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { ProviderInfo, VersionedProviders } from '@rango-dev/wallets-core';
|
|
2
1
|
import type {
|
|
3
|
-
|
|
2
|
+
LegacyNamespaceData as NamespaceData,
|
|
4
3
|
LegacyNetwork as Network,
|
|
5
4
|
LegacyEventHandler as WalletEventHandler,
|
|
6
5
|
LegacyWalletInfo as WalletInfo,
|
|
@@ -22,16 +21,12 @@ export type ConnectResult = {
|
|
|
22
21
|
|
|
23
22
|
export type Providers = { [type in WalletType]?: any };
|
|
24
23
|
|
|
25
|
-
export type ExtendedWalletInfo = WalletInfo & {
|
|
26
|
-
properties?: ProviderInfo['properties'];
|
|
27
|
-
isHub?: boolean;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
24
|
export type ProviderContext = {
|
|
31
25
|
connect(
|
|
32
26
|
type: WalletType,
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
network?: Network,
|
|
28
|
+
namespaces?: NamespaceData[]
|
|
29
|
+
): Promise<ConnectResult>;
|
|
35
30
|
disconnect(type: WalletType): Promise<void>;
|
|
36
31
|
disconnectAll(): Promise<PromiseSettledResult<any>[]>;
|
|
37
32
|
state(type: WalletType): WalletState;
|
|
@@ -45,7 +40,7 @@ export type ProviderContext = {
|
|
|
45
40
|
*/
|
|
46
41
|
providers(): Providers;
|
|
47
42
|
getSigners(type: WalletType): Promise<SignerFactory>;
|
|
48
|
-
getWalletInfo(type: WalletType):
|
|
43
|
+
getWalletInfo(type: WalletType): WalletInfo;
|
|
49
44
|
suggestAndConnect(type: WalletType, network: Network): Promise<ConnectResult>;
|
|
50
45
|
};
|
|
51
46
|
|
|
@@ -53,10 +48,7 @@ export type ProviderProps = PropsWithChildren<{
|
|
|
53
48
|
onUpdateState?: WalletEventHandler;
|
|
54
49
|
allBlockChains?: BlockchainMeta[];
|
|
55
50
|
autoConnect?: boolean;
|
|
56
|
-
providers:
|
|
57
|
-
configs?: {
|
|
58
|
-
isExperimentalEnabled?: boolean;
|
|
59
|
-
};
|
|
51
|
+
providers: ProviderInterface[];
|
|
60
52
|
}>;
|
|
61
53
|
|
|
62
54
|
export enum Events {
|
|
@@ -1,23 +1,31 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { GetWalletInstance } from './hooks.js';
|
|
2
|
+
import type { ProviderProps, WalletProviders } from './types.js';
|
|
2
3
|
|
|
3
4
|
import { useEffect, useRef } from 'react';
|
|
4
5
|
|
|
5
|
-
import {
|
|
6
|
+
import { autoConnect } from './helpers.js';
|
|
6
7
|
|
|
7
8
|
export function useAutoConnect(
|
|
8
9
|
props: Pick<ProviderProps, 'allBlockChains' | 'autoConnect'> & {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*/
|
|
12
|
-
autoConnectHandler: () => void;
|
|
10
|
+
wallets: WalletProviders;
|
|
11
|
+
getWalletInstanceFromLegacy: GetWalletInstance;
|
|
13
12
|
}
|
|
14
13
|
) {
|
|
15
14
|
const autoConnectInitiated = useRef(false);
|
|
16
15
|
|
|
16
|
+
// Running auto connect on instances
|
|
17
17
|
useEffect(() => {
|
|
18
|
-
|
|
18
|
+
const shouldTryAutoConnect =
|
|
19
|
+
props.allBlockChains &&
|
|
20
|
+
props.allBlockChains.length &&
|
|
21
|
+
props.autoConnect &&
|
|
22
|
+
!autoConnectInitiated.current;
|
|
23
|
+
|
|
24
|
+
if (shouldTryAutoConnect) {
|
|
19
25
|
autoConnectInitiated.current = true;
|
|
20
|
-
|
|
26
|
+
void (async () => {
|
|
27
|
+
await autoConnect(props.wallets, props.getWalletInstanceFromLegacy);
|
|
28
|
+
})();
|
|
21
29
|
}
|
|
22
30
|
}, [props.autoConnect, props.allBlockChains]);
|
|
23
31
|
}
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
import type { ProviderContext, ProviderProps } from './types.js';
|
|
2
|
-
import type {
|
|
3
|
-
LegacyNamespaceInputForConnect,
|
|
4
|
-
LegacyNamespaceInputWithDiscoverMode,
|
|
5
|
-
LegacyProviderInterface,
|
|
6
|
-
} from '@rango-dev/wallets-core/legacy';
|
|
7
2
|
import type { WalletType } from '@rango-dev/wallets-shared';
|
|
8
3
|
|
|
9
4
|
import { useEffect, useReducer } from 'react';
|
|
10
5
|
|
|
11
|
-
import { autoConnect } from './autoConnect.js';
|
|
12
6
|
import {
|
|
13
7
|
availableWallets,
|
|
14
8
|
checkWalletProviders,
|
|
@@ -23,13 +17,7 @@ import {
|
|
|
23
17
|
import { useInitializers } from './hooks.js';
|
|
24
18
|
import { useAutoConnect } from './useAutoConnect.js';
|
|
25
19
|
|
|
26
|
-
export
|
|
27
|
-
providers: LegacyProviderInterface[];
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export function useLegacyProviders(
|
|
31
|
-
props: LegacyProviderProps
|
|
32
|
-
): ProviderContext {
|
|
20
|
+
export function useLegacyProviders(props: ProviderProps): ProviderContext {
|
|
33
21
|
const [providersState, dispatch] = useReducer(stateReducer, {});
|
|
34
22
|
|
|
35
23
|
// Get (or add) wallet instance (`provider`s will be wrapped in a `Wallet`)
|
|
@@ -42,48 +30,22 @@ export function useLegacyProviders(
|
|
|
42
30
|
const wallets = checkWalletProviders(listOfProviders);
|
|
43
31
|
|
|
44
32
|
useAutoConnect({
|
|
33
|
+
wallets,
|
|
45
34
|
allBlockChains: props.allBlockChains,
|
|
46
35
|
autoConnect: props.autoConnect,
|
|
47
|
-
|
|
36
|
+
getWalletInstanceFromLegacy: getWalletInstance,
|
|
48
37
|
});
|
|
49
38
|
|
|
50
39
|
// Final API we put in context and it will be available to use for users.
|
|
40
|
+
// eslint-disable-next-line react/jsx-no-constructed-context-values
|
|
51
41
|
const api: ProviderContext = {
|
|
52
|
-
async connect(type, namespaces) {
|
|
42
|
+
async connect(type, network, namespaces) {
|
|
53
43
|
const wallet = wallets.get(type);
|
|
54
44
|
if (!wallet) {
|
|
55
45
|
throw new Error(`You should add ${type} to provider first.`);
|
|
56
46
|
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Discover mode has a meaning in hub, so we are considering whenever a namespace with DISCOVER_MODE reaches here,
|
|
60
|
-
* we can ignore it and don't pass it to provider.
|
|
61
|
-
*/
|
|
62
|
-
const namespacesForConnect = namespaces?.filter(
|
|
63
|
-
(
|
|
64
|
-
ns
|
|
65
|
-
): ns is Exclude<
|
|
66
|
-
LegacyNamespaceInputForConnect,
|
|
67
|
-
LegacyNamespaceInputWithDiscoverMode
|
|
68
|
-
> => {
|
|
69
|
-
return ns.namespace !== 'DISCOVER_MODE';
|
|
70
|
-
}
|
|
71
|
-
);
|
|
72
|
-
// Legacy providers doesn't implemented multiple namespaces, so it will always be one value.
|
|
73
|
-
let network = undefined;
|
|
74
|
-
if (namespaces && namespaces.length > 0) {
|
|
75
|
-
/*
|
|
76
|
-
* This may not be safe in cases there are two `network` for namespaces, the first one will be picked always.
|
|
77
|
-
* But since legacy provider only accepts one value, it shouldn't be happened when we are using legacy mode.
|
|
78
|
-
*/
|
|
79
|
-
network = namespaces.find((ns) => !!ns.network)?.network;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
47
|
const walletInstance = getWalletInstance(wallet);
|
|
83
|
-
const result = await walletInstance.connect(
|
|
84
|
-
network,
|
|
85
|
-
namespacesForConnect
|
|
86
|
-
);
|
|
48
|
+
const result = await walletInstance.connect(network, namespaces);
|
|
87
49
|
if (props.autoConnect) {
|
|
88
50
|
void tryPersistWallet({
|
|
89
51
|
type,
|
|
@@ -92,7 +54,7 @@ export function useLegacyProviders(
|
|
|
92
54
|
});
|
|
93
55
|
}
|
|
94
56
|
|
|
95
|
-
return
|
|
57
|
+
return result;
|
|
96
58
|
},
|
|
97
59
|
async disconnect(type) {
|
|
98
60
|
const wallet = wallets.get(type);
|
package/src/provider.tsx
CHANGED
|
@@ -3,13 +3,13 @@ import type { ProviderProps } from './legacy/types.js';
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
|
|
5
5
|
import { WalletContext } from './legacy/context.js';
|
|
6
|
-
import {
|
|
6
|
+
import { useLegacyProviders } from './legacy/useLegacyProviders.js';
|
|
7
7
|
|
|
8
8
|
function Provider(props: ProviderProps) {
|
|
9
|
-
const
|
|
9
|
+
const legacyApi = useLegacyProviders(props);
|
|
10
10
|
|
|
11
11
|
return (
|
|
12
|
-
<WalletContext.Provider value={
|
|
12
|
+
<WalletContext.Provider value={legacyApi}>
|
|
13
13
|
{props.children}
|
|
14
14
|
</WalletContext.Provider>
|
|
15
15
|
);
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { UseAdapterParams } from './useHubAdapter.js';
|
|
2
|
-
import type { Hub } from '@rango-dev/wallets-core';
|
|
3
|
-
import type { LegacyProviderInterface } from '@rango-dev/wallets-core/legacy';
|
|
4
|
-
export declare function autoConnect(deps: {
|
|
5
|
-
getHub: () => Hub;
|
|
6
|
-
allBlockChains: UseAdapterParams['allBlockChains'];
|
|
7
|
-
getLegacyProvider: (type: string) => LegacyProviderInterface;
|
|
8
|
-
}): Promise<void>;
|
|
9
|
-
//# sourceMappingURL=autoConnect.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"autoConnect.d.ts","sourceRoot":"","sources":["../../src/hub/autoConnect.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,KAAK,EAEV,uBAAuB,EACxB,MAAM,gCAAgC,CAAC;AA2FxC,wBAAsB,WAAW,CAAC,IAAI,EAAE;IACtC,MAAM,EAAE,MAAM,GAAG,CAAC;IAClB,cAAc,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;IACnD,iBAAiB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,uBAAuB,CAAC;CAC9D,GAAG,OAAO,CAAC,IAAI,CAAC,CAoFhB"}
|
package/dist/hub/constants.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/hub/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,6BAA6B,2BAA2B,CAAC;AACtE,eAAO,MAAM,0BAA0B,kCAAkC,CAAC"}
|
package/dist/hub/helpers.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { AllProxiedNamespaces } from './types.js';
|
|
2
|
-
import type { Accounts, AccountsWithActiveChain } from '@rango-dev/wallets-core/namespaces/common';
|
|
3
|
-
import { CAIP } from '@rango-dev/wallets-core/utils';
|
|
4
|
-
export declare function mapCaipNamespaceToLegacyNetworkName(chainId: CAIP.ChainIdParams | string): string;
|
|
5
|
-
/**
|
|
6
|
-
* CAIP's accountId has a format like this: eip155:1:0xab16a96D359eC26a11e2C2b3d8f8B8942d5Bfcdb
|
|
7
|
-
* Legacy format is something like this: ETH:0xab16a96D359eC26a11e2C2b3d8f8B8942d5Bfcdb
|
|
8
|
-
* This function will try to convert this two format.
|
|
9
|
-
*
|
|
10
|
-
* @see https://github.com/ChainAgnostic/CAIPs/blob/main/CAIPs/caip-10.md
|
|
11
|
-
*/
|
|
12
|
-
export declare function fromAccountIdToLegacyAddressFormat(account: string): string;
|
|
13
|
-
/**
|
|
14
|
-
* Getting a list of (lazy) promises and run them one after another.
|
|
15
|
-
*/
|
|
16
|
-
export declare function sequentiallyRun<T extends () => Promise<unknown>>(promises: Array<T>): Promise<Array<T extends () => Promise<infer R> ? R : never>>;
|
|
17
|
-
export declare function isConnectResultEvm(result: Awaited<ReturnType<AllProxiedNamespaces['connect']>>): result is AccountsWithActiveChain;
|
|
18
|
-
export declare function isConnectResultSolana(result: Awaited<ReturnType<AllProxiedNamespaces['connect']>>): result is Accounts;
|
|
19
|
-
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/hub/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,KAAK,EACV,QAAQ,EACR,uBAAuB,EACxB,MAAM,2CAA2C,CAAC;AAGnD,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAErD,wBAAgB,mCAAmC,CACjD,OAAO,EAAE,IAAI,CAAC,aAAa,GAAG,MAAM,GACnC,MAAM,CAeR;AAED;;;;;;GAMG;AACH,wBAAgB,kCAAkC,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAI1E;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,CAAC,SAAS,MAAM,OAAO,CAAC,OAAO,CAAC,EACpE,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,GACjB,OAAO,CAAC,KAAK,CAAC,CAAC,SAAS,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,CAQ9D;AAED,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC,oBAAoB,CAAC,SAAS,CAAC,CAAC,CAAC,GAC3D,MAAM,IAAI,uBAAuB,CAEnC;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC,oBAAoB,CAAC,SAAS,CAAC,CAAC,CAAC,GAC3D,MAAM,IAAI,QAAQ,CAEpB"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export interface LastConnectedWalletsStorage {
|
|
2
|
-
[providerId: string]: string[];
|
|
3
|
-
}
|
|
4
|
-
export type LegacyLastConnectedWalletsStorage = string[];
|
|
5
|
-
/**
|
|
6
|
-
* We are doing some certain actions on storage for `last-connected-wallets` key.
|
|
7
|
-
* This class helps us to define them in one place and also it has support for both legacy and hub.
|
|
8
|
-
*/
|
|
9
|
-
export declare class LastConnectedWalletsFromStorage {
|
|
10
|
-
#private;
|
|
11
|
-
constructor(storageKey: string);
|
|
12
|
-
addWallet(providerId: string, namespaces: string[]): void;
|
|
13
|
-
removeWallets(providerIds?: string[]): void;
|
|
14
|
-
list(): LastConnectedWalletsStorage;
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=lastConnectedWallets.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lastConnectedWallets.d.ts","sourceRoot":"","sources":["../../src/hub/lastConnectedWallets.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,2BAA2B;IAC1C,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAChC;AAED,MAAM,MAAM,iCAAiC,GAAG,MAAM,EAAE,CAAC;AAEzD;;;GAGG;AACH,qBAAa,+BAA+B;;gBAG9B,UAAU,EAAE,MAAM;IAI9B,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,IAAI;IAQzD,aAAa,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI;IAQ3C,IAAI,IAAI,2BAA2B;CA4EpC"}
|
package/dist/hub/mod.d.ts
DELETED
package/dist/hub/mod.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/hub/mod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/hub/types.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { CommonNamespaces, FindProxiedNamespace, ProviderInfo } from '@rango-dev/wallets-core';
|
|
2
|
-
export type AllProxiedNamespaces = FindProxiedNamespace<keyof CommonNamespaces, CommonNamespaces>;
|
|
3
|
-
export type ExtensionLink = keyof ProviderInfo['extensions'];
|
|
4
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/hub/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/hub/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,oBAAoB,EACpB,YAAY,EACb,MAAM,yBAAyB,CAAC;AAEjC,MAAM,MAAM,oBAAoB,GAAG,oBAAoB,CACrD,MAAM,gBAAgB,EACtB,gBAAgB,CACjB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,MAAM,YAAY,CAAC,YAAY,CAAC,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Provider } from '@rango-dev/wallets-core';
|
|
2
|
-
import type { VersionedProviders } from '@rango-dev/wallets-core/utils';
|
|
3
|
-
import { type ProviderContext, type ProviderProps } from '../legacy/mod.js';
|
|
4
|
-
export type UseAdapterParams = Omit<ProviderProps, 'providers'> & {
|
|
5
|
-
providers: Provider[];
|
|
6
|
-
/** This is only will be used to access some parts of the legacy provider that doesn't exists in Hub. */
|
|
7
|
-
allVersionedProviders: VersionedProviders[];
|
|
8
|
-
};
|
|
9
|
-
export declare function useHubAdapter(params: UseAdapterParams): ProviderContext;
|
|
10
|
-
//# sourceMappingURL=useHubAdapter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useHubAdapter.d.ts","sourceRoot":"","sources":["../../src/hub/useHubAdapter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAGxD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAMxE,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,aAAa,EACnB,MAAM,kBAAkB,CAAC;AAe1B,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,aAAa,EAAE,WAAW,CAAC,GAAG;IAChE,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,wGAAwG;IACxG,qBAAqB,EAAE,kBAAkB,EAAE,CAAC;CAC7C,CAAC;AAEF,wBAAgB,aAAa,CAAC,MAAM,EAAE,gBAAgB,GAAG,eAAe,CA2SvE"}
|
package/dist/hub/useHubRefs.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { Provider, Store } from '@rango-dev/wallets-core';
|
|
2
|
-
import { Hub } from '@rango-dev/wallets-core';
|
|
3
|
-
export declare function useHubRefs(providers: Provider[]): {
|
|
4
|
-
getStore: () => Store;
|
|
5
|
-
getHub: () => Hub;
|
|
6
|
-
};
|
|
7
|
-
//# sourceMappingURL=useHubRefs.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useHubRefs.d.ts","sourceRoot":"","sources":["../../src/hub/useHubRefs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,EAAe,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAG3D,wBAAgB,UAAU,CAAC,SAAS,EAAE,QAAQ,EAAE;;kBAe3B,GAAG;EAoBvB"}
|
package/dist/hub/utils.d.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { AllProxiedNamespaces } from './types.js';
|
|
2
|
-
import type { ConnectResult, ProviderProps } from '../legacy/mod.js';
|
|
3
|
-
import type { Hub, Provider, State } from '@rango-dev/wallets-core';
|
|
4
|
-
import type { LegacyNamespaceInputForConnect, LegacyProviderInterface, LegacyEventHandler as WalletEventHandler } from '@rango-dev/wallets-core/legacy';
|
|
5
|
-
import type { Namespace } from '@rango-dev/wallets-core/namespaces/common';
|
|
6
|
-
import { type VersionedProviders } from '@rango-dev/wallets-core/utils';
|
|
7
|
-
import { type AddEthereumChainParameter } from '@rango-dev/wallets-shared';
|
|
8
|
-
import { type BlockchainMeta } from 'rango-types';
|
|
9
|
-
export declare function separateLegacyAndHubProviders(providers: VersionedProviders[], options?: {
|
|
10
|
-
isExperimentalEnabled?: boolean;
|
|
11
|
-
}): [LegacyProviderInterface[], Provider[]];
|
|
12
|
-
export declare function findProviderByType(providers: Provider[], type: string): Provider | undefined;
|
|
13
|
-
/**
|
|
14
|
-
* We will call this function on hub's `subscribe`.
|
|
15
|
-
* it will check states and will emit legacy events for backward compatibility.
|
|
16
|
-
*/
|
|
17
|
-
export declare function checkHubStateAndTriggerEvents(hub: Hub, currentState: State, previousState: State, onUpdateState: WalletEventHandler, allProviders: VersionedProviders[], allBlockChains: ProviderProps['allBlockChains']): void;
|
|
18
|
-
/**
|
|
19
|
-
* For backward compatibility, there is an special namespace called DISCOVER_MODE.
|
|
20
|
-
* Alongside `DISCOVER_MODE`, `network` will be set as well. here we are manually matching networks to namespaces.
|
|
21
|
-
* This will help us keep the legacy interface and have what hub needs as well.
|
|
22
|
-
*/
|
|
23
|
-
export declare function discoverNamespace(network: string): Namespace;
|
|
24
|
-
export declare function getLegacyProvider(allProviders: VersionedProviders[], type: string): LegacyProviderInterface;
|
|
25
|
-
/**
|
|
26
|
-
* In legacy mode, for those who have switch network functionality (like evm), we are using an enum for network names
|
|
27
|
-
* this enum only has meaning for us, and when we are going to connect an instance (e.g. window.ethereum) we should pass chain id.
|
|
28
|
-
*/
|
|
29
|
-
export declare function convertNamespaceNetworkToEvmChainId(namespace: LegacyNamespaceInputForConnect, meta: BlockchainMeta[]): AddEthereumChainParameter | undefined;
|
|
30
|
-
/**
|
|
31
|
-
* We are passing an string for chain id (e.g. ETH, POLYGON), but wallet's instances (e.g. window.ethereum) needs chainId (e.g. 0x1).
|
|
32
|
-
* This function will help us to map these strings to proper hex ids.
|
|
33
|
-
*
|
|
34
|
-
* If you need same functionality for other blockchain types (e.g. Cosmos), You can make a separate function and add it here.
|
|
35
|
-
*/
|
|
36
|
-
export declare function tryConvertNamespaceNetworkToChainInfo(namespace: LegacyNamespaceInputForConnect, meta: BlockchainMeta[]): string | AddEthereumChainParameter | undefined;
|
|
37
|
-
export declare function transformHubResultToLegacyResult(res: Awaited<ReturnType<AllProxiedNamespaces['connect']>>): ConnectResult;
|
|
38
|
-
//# sourceMappingURL=utils.d.ts.map
|
package/dist/hub/utils.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/hub/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,KAAK,EACV,8BAA8B,EAC9B,uBAAuB,EACvB,kBAAkB,IAAI,kBAAkB,EACzC,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2CAA2C,CAAC;AAO3E,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EACL,KAAK,yBAAyB,EAG/B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,KAAK,cAAc,EAAmB,MAAM,aAAa,CAAC;AASnE,wBAAgB,6BAA6B,CAC3C,SAAS,EAAE,kBAAkB,EAAE,EAC/B,OAAO,CAAC,EAAE;IAAE,qBAAqB,CAAC,EAAE,OAAO,CAAA;CAAE,GAC5C,CAAC,uBAAuB,EAAE,EAAE,QAAQ,EAAE,CAAC,CA0BzC;AAED,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,QAAQ,EAAE,EACrB,IAAI,EAAE,MAAM,GACX,QAAQ,GAAG,SAAS,CAEtB;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAC3C,GAAG,EAAE,GAAG,EACR,YAAY,EAAE,KAAK,EACnB,aAAa,EAAE,KAAK,EACpB,aAAa,EAAE,kBAAkB,EACjC,YAAY,EAAE,kBAAkB,EAAE,EAClC,cAAc,EAAE,aAAa,CAAC,gBAAgB,CAAC,GAC9C,IAAI,CAgJN;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CA0E5D;AAED,wBAAgB,iBAAiB,CAC/B,YAAY,EAAE,kBAAkB,EAAE,EAClC,IAAI,EAAE,MAAM,GACX,uBAAuB,CAgBzB;AAED;;;GAGG;AACH,wBAAgB,mCAAmC,CACjD,SAAS,EAAE,8BAA8B,EACzC,IAAI,EAAE,cAAc,EAAE,yCAUvB;AAED;;;;;GAKG;AACH,wBAAgB,qCAAqC,CACnD,SAAS,EAAE,8BAA8B,EACzC,IAAI,EAAE,cAAc,EAAE,GACrB,MAAM,GAAG,yBAAyB,GAAG,SAAS,CAMhD;AAED,wBAAgB,gCAAgC,CAC9C,GAAG,EAAE,OAAO,CAAC,UAAU,CAAC,oBAAoB,CAAC,SAAS,CAAC,CAAC,CAAC,GACxD,aAAa,CAoBf"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { WalletActions, WalletProviders } from './types.js';
|
|
2
|
-
import type { LegacyWallet as Wallet } from '@rango-dev/wallets-core/legacy';
|
|
3
|
-
import type { WalletConfig } from '@rango-dev/wallets-shared';
|
|
4
|
-
export declare function autoConnect(wallets: WalletProviders, getWalletInstance: (wallet: {
|
|
5
|
-
actions: WalletActions;
|
|
6
|
-
config: WalletConfig;
|
|
7
|
-
}) => Wallet<any>): Promise<void>;
|
|
8
|
-
//# sourceMappingURL=autoConnect.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"autoConnect.d.ts","sourceRoot":"","sources":["../../src/legacy/autoConnect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,IAAI,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,KAAK,EAAE,YAAY,EAAc,MAAM,2BAA2B,CAAC;AAU1E,wBAAsB,WAAW,CAC/B,OAAO,EAAE,eAAe,EACxB,iBAAiB,EAAE,CAAC,MAAM,EAAE;IAC1B,OAAO,EAAE,aAAa,CAAC;IACvB,MAAM,EAAE,YAAY,CAAC;CACtB,KAAK,MAAM,CAAC,GAAG,CAAC,iBA4DlB"}
|
package/dist/legacy/mod.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export type { ProviderProps, ProviderContext, ConnectResult, ExtendedWalletInfo, } from './types.js';
|
|
2
|
-
export { LEGACY_LAST_CONNECTED_WALLETS, HUB_LAST_CONNECTED_WALLETS, } from '../hub/constants.js';
|
|
3
|
-
export { WalletContext } from './context.js';
|
|
4
|
-
export { useLegacyProviders } from './useLegacyProviders.js';
|
|
5
|
-
//# sourceMappingURL=mod.d.ts.map
|
package/dist/legacy/mod.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/legacy/mod.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,aAAa,EACb,eAAe,EACf,aAAa,EACb,kBAAkB,GACnB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,6BAA6B,EAC7B,0BAA0B,GAC3B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC"}
|
package/dist/legacy/utils.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/legacy/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,IAAI,CAAC,aAAa,EAAE,gBAAgB,GAAG,aAAa,CAAC,GAC3D,OAAO,CAET"}
|
package/dist/test-utils/env.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Detecting wether our code is running in a test environment or not.
|
|
3
|
-
*
|
|
4
|
-
* Note: This is only useful when HappyDOM or jsdom has been added to test runner.
|
|
5
|
-
*/
|
|
6
|
-
export declare function isRunningInTestEnvironmentWithDom(): boolean;
|
|
7
|
-
//# sourceMappingURL=env.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/test-utils/env.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,iCAAiC,IAAI,OAAO,CAE3D"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { LegacyProviderInterface } from '@rango-dev/wallets-core/legacy';
|
|
2
|
-
import type { BlockchainMeta, GenericSigner } from 'rango-types';
|
|
3
|
-
import type { EvmTransaction } from 'rango-types/mainApi';
|
|
4
|
-
export declare const legacyAddress = "0x000000000000000000000000000000000000dead";
|
|
5
|
-
export declare class MockEvmSigner implements GenericSigner<EvmTransaction> {
|
|
6
|
-
signMessage(_msg: string, _address: string, _chainId: string | null): Promise<string>;
|
|
7
|
-
signAndSendTx(_tx: EvmTransaction, _address: string, _chainId: string | null): Promise<{
|
|
8
|
-
hash: string;
|
|
9
|
-
response?: any;
|
|
10
|
-
}>;
|
|
11
|
-
}
|
|
12
|
-
export declare const legacyProvider: LegacyProviderInterface;
|
|
13
|
-
export declare const blockchainsMeta: BlockchainMeta[];
|
|
14
|
-
//# sourceMappingURL=fixtures.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../src/test-utils/fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAI1D,eAAO,MAAM,aAAa,+CAA+C,CAAC;AAE1E,qBAAa,aAAc,YAAW,aAAa,CAAC,cAAc,CAAC;IAC3D,WAAW,CACf,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GAAG,IAAI,GACtB,OAAO,CAAC,MAAM,CAAC;IAGZ,aAAa,CACjB,GAAG,EAAE,cAAc,EACnB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GAAG,IAAI,GACtB,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,GAAG,CAAA;KAAE,CAAC;CAK7C;AAED,eAAO,MAAM,cAAc,EAAE,uBA0C5B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,cAAc,EAsK3C,CAAC"}
|
package/dist/useProviders.d.ts
DELETED