@exodus/web3-ethereum 8.4.0 → 9.0.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.
|
@@ -9,7 +9,7 @@ interface EthereumProviderEvents {
|
|
|
9
9
|
}
|
|
10
10
|
export declare class EthereumProvider extends BaseProvider<EthereumProviderEvents> {
|
|
11
11
|
#private;
|
|
12
|
-
constructor({ accountsObservable, storage, supportedChainIds, transport, getDefaultChainId, }: Deps);
|
|
12
|
+
constructor({ accountsObservable, storage, storageKeyPrefix, supportedChainIds, transport, getDefaultChainId, }: Deps);
|
|
13
13
|
protected _callRpcMethod<Params, Response>(method: string, params: Params): Promise<Response>;
|
|
14
14
|
isConnected(): boolean;
|
|
15
15
|
request: (args: RequestArguments) => Promise<unknown>;
|
package/lib/provider/provider.js
CHANGED
|
@@ -11,12 +11,15 @@ export class EthereumProvider extends BaseProvider {
|
|
|
11
11
|
#chainId = null;
|
|
12
12
|
#accounts = [];
|
|
13
13
|
#selectedAddress = null;
|
|
14
|
-
constructor({ accountsObservable, storage, supportedChainIds, transport, getDefaultChainId, }) {
|
|
14
|
+
constructor({ accountsObservable, storage, storageKeyPrefix, supportedChainIds, transport, getDefaultChainId, }) {
|
|
15
15
|
if (!supportedChainIds?.length) {
|
|
16
16
|
throw new Error('At least one supported chain must be provided');
|
|
17
17
|
}
|
|
18
|
+
if (!storageKeyPrefix) {
|
|
19
|
+
throw new Error('"storageKeyPrefix" must be provided');
|
|
20
|
+
}
|
|
18
21
|
super({ transport });
|
|
19
|
-
this.#storage = createStorageWrapper(storage);
|
|
22
|
+
this.#storage = createStorageWrapper(storage, storageKeyPrefix);
|
|
20
23
|
this.#supportedChainIds = supportedChainIds
|
|
21
24
|
.map((chainId) => chainId.toLowerCase())
|
|
22
25
|
.sort();
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ProviderStorage } from './types.js';
|
|
2
2
|
import type { Storage } from '@exodus/web3-types';
|
|
3
|
-
export declare function createStorageWrapper(storage: Storage): ProviderStorage;
|
|
3
|
+
export declare function createStorageWrapper(storage: Storage, storageKeyPrefix: string): ProviderStorage;
|
package/lib/provider/storage.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export function createStorageWrapper(storage, storageKeyPrefix) {
|
|
2
|
+
const chainIdKey = `${storageKeyPrefix}:ethereum:chainId`;
|
|
3
3
|
async function getChainId() {
|
|
4
4
|
try {
|
|
5
5
|
return await storage.getItem(chainIdKey);
|
package/lib/provider/types.d.ts
CHANGED
|
@@ -33,6 +33,7 @@ export declare type JsonRpcCallback = (error: Error | null, result?: JsonRpcResu
|
|
|
33
33
|
export declare type Deps = BaseProviderDeps & {
|
|
34
34
|
accountsObservable: Observable;
|
|
35
35
|
storage: Storage;
|
|
36
|
+
storageKeyPrefix?: string;
|
|
36
37
|
supportedChainIds: string[];
|
|
37
38
|
getDefaultChainId?: () => Promise<string | null>;
|
|
38
39
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/web3-ethereum",
|
|
3
3
|
"description": "Apps connectivity library for EVM-compatible chains.",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "9.0.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"module": "lib/index.js",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"@exodus/assets": "^8.0.72"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "8a63b2eaf2e1b184b0d8556ac2010d1c95e37742"
|
|
55
55
|
}
|