@dynamic-labs/ethereum 4.0.0-alpha.13 → 4.0.0-alpha.15
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/CHANGELOG.md +4 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +8 -8
- package/src/ethProviderHelper.cjs +17 -7
- package/src/ethProviderHelper.d.ts +4 -2
- package/src/ethProviderHelper.js +17 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
|
|
2
|
+
## [4.0.0-alpha.15](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.14...v4.0.0-alpha.15) (2024-10-19)
|
|
3
|
+
|
|
4
|
+
## [4.0.0-alpha.14](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.13...v4.0.0-alpha.14) (2024-10-18)
|
|
5
|
+
|
|
2
6
|
## [4.0.0-alpha.13](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.12...v4.0.0-alpha.13) (2024-10-18)
|
|
3
7
|
|
|
4
8
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/ethereum",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.15",
|
|
4
4
|
"description": "A React SDK for implementing wallet web3 authentication and authorization to your website.",
|
|
5
5
|
"author": "Dynamic Labs, Inc.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,13 +23,13 @@
|
|
|
23
23
|
"@walletconnect/types": "2.10.6",
|
|
24
24
|
"eventemitter3": "5.0.1",
|
|
25
25
|
"buffer": "6.0.3",
|
|
26
|
-
"@dynamic-labs/assert-package-version": "4.0.0-alpha.
|
|
27
|
-
"@dynamic-labs/embedded-wallet-evm": "4.0.0-alpha.
|
|
28
|
-
"@dynamic-labs/ethereum-core": "4.0.0-alpha.
|
|
29
|
-
"@dynamic-labs/types": "4.0.0-alpha.
|
|
30
|
-
"@dynamic-labs/utils": "4.0.0-alpha.
|
|
31
|
-
"@dynamic-labs/wallet-book": "4.0.0-alpha.
|
|
32
|
-
"@dynamic-labs/wallet-connector-core": "4.0.0-alpha.
|
|
26
|
+
"@dynamic-labs/assert-package-version": "4.0.0-alpha.15",
|
|
27
|
+
"@dynamic-labs/embedded-wallet-evm": "4.0.0-alpha.15",
|
|
28
|
+
"@dynamic-labs/ethereum-core": "4.0.0-alpha.15",
|
|
29
|
+
"@dynamic-labs/types": "4.0.0-alpha.15",
|
|
30
|
+
"@dynamic-labs/utils": "4.0.0-alpha.15",
|
|
31
|
+
"@dynamic-labs/wallet-book": "4.0.0-alpha.15",
|
|
32
|
+
"@dynamic-labs/wallet-connector-core": "4.0.0-alpha.15"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"viem": "^2.7.6"
|
|
@@ -12,15 +12,18 @@ var ethereumCore = require('@dynamic-labs/ethereum-core');
|
|
|
12
12
|
class EthProviderHelper {
|
|
13
13
|
constructor(wallet, connector) {
|
|
14
14
|
this.wallet = wallet;
|
|
15
|
-
this.
|
|
15
|
+
this._connector = connector;
|
|
16
|
+
}
|
|
17
|
+
get connector() {
|
|
18
|
+
if (!this._connector) {
|
|
19
|
+
throw new Error('Connect not provided to EthProviderHelper');
|
|
20
|
+
}
|
|
21
|
+
return this._connector;
|
|
16
22
|
}
|
|
17
23
|
getInstalledProvider() {
|
|
18
|
-
const
|
|
19
|
-
if (
|
|
20
|
-
|
|
21
|
-
if (eip6963Provider) {
|
|
22
|
-
return eip6963Provider;
|
|
23
|
-
}
|
|
24
|
+
const eip6963Provider = this.getEip6963Provider();
|
|
25
|
+
if (eip6963Provider) {
|
|
26
|
+
return eip6963Provider;
|
|
24
27
|
}
|
|
25
28
|
const config = this.getInjectedConfig();
|
|
26
29
|
if (!config ||
|
|
@@ -29,6 +32,13 @@ class EthProviderHelper {
|
|
|
29
32
|
return undefined;
|
|
30
33
|
return this.installedProviderLookup(config.extensionLocators);
|
|
31
34
|
}
|
|
35
|
+
getEip6963Provider() {
|
|
36
|
+
const eip6963Config = this.getEip6963Config();
|
|
37
|
+
if (eip6963Config) {
|
|
38
|
+
return this.eip6963ProviderLookup(eip6963Config.rdns);
|
|
39
|
+
}
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
32
42
|
getEip6963Config() {
|
|
33
43
|
if (!this.wallet || !this.wallet.eip6963Config)
|
|
34
44
|
return;
|
|
@@ -5,9 +5,11 @@ import { IEthereum, ExtensionLocator } from './types';
|
|
|
5
5
|
import { InjectedWalletBase } from './injected/InjectedWalletBase';
|
|
6
6
|
export declare class EthProviderHelper {
|
|
7
7
|
private wallet;
|
|
8
|
-
private
|
|
9
|
-
constructor(wallet: WalletSchema, connector
|
|
8
|
+
private _connector;
|
|
9
|
+
constructor(wallet: WalletSchema, connector?: InjectedWalletBase);
|
|
10
|
+
private get connector();
|
|
10
11
|
getInstalledProvider(): IEthereum | undefined;
|
|
12
|
+
getEip6963Provider(): IEthereum | undefined;
|
|
11
13
|
getEip6963Config(): {
|
|
12
14
|
rdns: string;
|
|
13
15
|
} | undefined;
|
package/src/ethProviderHelper.js
CHANGED
|
@@ -8,15 +8,18 @@ import { chainsMap } from '@dynamic-labs/ethereum-core';
|
|
|
8
8
|
class EthProviderHelper {
|
|
9
9
|
constructor(wallet, connector) {
|
|
10
10
|
this.wallet = wallet;
|
|
11
|
-
this.
|
|
11
|
+
this._connector = connector;
|
|
12
|
+
}
|
|
13
|
+
get connector() {
|
|
14
|
+
if (!this._connector) {
|
|
15
|
+
throw new Error('Connect not provided to EthProviderHelper');
|
|
16
|
+
}
|
|
17
|
+
return this._connector;
|
|
12
18
|
}
|
|
13
19
|
getInstalledProvider() {
|
|
14
|
-
const
|
|
15
|
-
if (
|
|
16
|
-
|
|
17
|
-
if (eip6963Provider) {
|
|
18
|
-
return eip6963Provider;
|
|
19
|
-
}
|
|
20
|
+
const eip6963Provider = this.getEip6963Provider();
|
|
21
|
+
if (eip6963Provider) {
|
|
22
|
+
return eip6963Provider;
|
|
20
23
|
}
|
|
21
24
|
const config = this.getInjectedConfig();
|
|
22
25
|
if (!config ||
|
|
@@ -25,6 +28,13 @@ class EthProviderHelper {
|
|
|
25
28
|
return undefined;
|
|
26
29
|
return this.installedProviderLookup(config.extensionLocators);
|
|
27
30
|
}
|
|
31
|
+
getEip6963Provider() {
|
|
32
|
+
const eip6963Config = this.getEip6963Config();
|
|
33
|
+
if (eip6963Config) {
|
|
34
|
+
return this.eip6963ProviderLookup(eip6963Config.rdns);
|
|
35
|
+
}
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
28
38
|
getEip6963Config() {
|
|
29
39
|
if (!this.wallet || !this.wallet.eip6963Config)
|
|
30
40
|
return;
|