@dynamic-labs/ethereum 1.3.0 → 1.3.1
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 +9 -0
- package/package.json +8 -7
- package/src/coinbase/coinbase.cjs +2 -2
- package/src/coinbase/coinbase.d.ts +1 -1
- package/src/coinbase/coinbase.js +2 -2
- package/src/ethProviderHelper.cjs +6 -1
- package/src/ethProviderHelper.d.ts +2 -1
- package/src/ethProviderHelper.js +6 -1
- package/src/injected/InjectedWalletBase.cjs +2 -2
- package/src/injected/InjectedWalletBase.d.ts +1 -1
- package/src/injected/InjectedWalletBase.js +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
|
|
2
|
+
### [1.3.1](https://github.com/dynamic-labs/DynamicAuth/compare/v1.3.0...v1.3.1) (2024-03-08)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* pass account and chain to walletClient ([#4865](https://github.com/dynamic-labs/DynamicAuth/issues/4865)) ([#4905](https://github.com/dynamic-labs/DynamicAuth/issues/4905)) ([0f4e79f](https://github.com/dynamic-labs/DynamicAuth/commit/0f4e79ff36f8a3ef63c59bb9f80429cdefbe7307))
|
|
8
|
+
* update btckit network conversion for signpsbt to use correct network ([#4882](https://github.com/dynamic-labs/DynamicAuth/issues/4882)) ([3c14f55](https://github.com/dynamic-labs/DynamicAuth/commit/3c14f55f6e37718a095752d0e04bfbac45fee75c))
|
|
9
|
+
* better auth state handling when logged in with disabled wallets ([#4862](https://github.com/dynamic-labs/DynamicAuth/issues/4862)) ([8cc2a1c](https://github.com/dynamic-labs/DynamicAuth/commit/8cc2a1c4f31cf6acb61d814a3410c5e77da21c50))
|
|
10
|
+
|
|
2
11
|
## [1.3.0](https://github.com/dynamic-labs/DynamicAuth/compare/v1.2.0...v1.3.0) (2024-03-05)
|
|
3
12
|
|
|
4
13
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/ethereum",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -32,12 +32,13 @@
|
|
|
32
32
|
"@walletconnect/universal-provider": "2.10.6",
|
|
33
33
|
"eventemitter3": "5.0.1",
|
|
34
34
|
"buffer": "6.0.3",
|
|
35
|
-
"@dynamic-labs/rpc-providers": "1.3.
|
|
36
|
-
"@dynamic-labs/turnkey": "1.3.
|
|
37
|
-
"@dynamic-labs/types": "1.3.
|
|
38
|
-
"@dynamic-labs/utils": "1.3.
|
|
39
|
-
"@dynamic-labs/
|
|
40
|
-
"@dynamic-labs/wallet-
|
|
35
|
+
"@dynamic-labs/rpc-providers": "1.3.1",
|
|
36
|
+
"@dynamic-labs/turnkey": "1.3.1",
|
|
37
|
+
"@dynamic-labs/types": "1.3.1",
|
|
38
|
+
"@dynamic-labs/utils": "1.3.1",
|
|
39
|
+
"@dynamic-labs/viem-utils": "1.3.1",
|
|
40
|
+
"@dynamic-labs/wallet-book": "1.3.1",
|
|
41
|
+
"@dynamic-labs/wallet-connector-core": "1.3.1",
|
|
41
42
|
"stream": "0.0.2"
|
|
42
43
|
},
|
|
43
44
|
"peerDependencies": {
|
|
@@ -45,10 +45,10 @@ class Coinbase extends EthWalletConnector.EthWalletConnector {
|
|
|
45
45
|
return;
|
|
46
46
|
this.teardownEventListeners = setupResponse.tearDownEventListeners;
|
|
47
47
|
}
|
|
48
|
-
getWalletClient() {
|
|
48
|
+
getWalletClient(chainId) {
|
|
49
49
|
var _a;
|
|
50
50
|
if (this.isInstalledOnBrowser()) {
|
|
51
|
-
return (_a = this.ethProviderHelper) === null || _a === void 0 ? void 0 : _a.findWalletClient();
|
|
51
|
+
return (_a = this.ethProviderHelper) === null || _a === void 0 ? void 0 : _a.findWalletClient(chainId);
|
|
52
52
|
}
|
|
53
53
|
return viem.createWalletClient({
|
|
54
54
|
transport: viem.custom(client.getCoinbaseProvider({
|
|
@@ -14,7 +14,7 @@ export declare class Coinbase extends EthWalletConnector {
|
|
|
14
14
|
ethProviderHelper: EthProviderHelper | undefined;
|
|
15
15
|
constructor({ appName, appLogoUrl, evmNetworks, ...props }: CoinbaseOpts);
|
|
16
16
|
setupEventListeners(): void;
|
|
17
|
-
getWalletClient(): {
|
|
17
|
+
getWalletClient(chainId?: string): {
|
|
18
18
|
account: import("viem").Account | undefined;
|
|
19
19
|
batch?: {
|
|
20
20
|
multicall?: boolean | {
|
package/src/coinbase/coinbase.js
CHANGED
|
@@ -41,10 +41,10 @@ class Coinbase extends EthWalletConnector {
|
|
|
41
41
|
return;
|
|
42
42
|
this.teardownEventListeners = setupResponse.tearDownEventListeners;
|
|
43
43
|
}
|
|
44
|
-
getWalletClient() {
|
|
44
|
+
getWalletClient(chainId) {
|
|
45
45
|
var _a;
|
|
46
46
|
if (this.isInstalledOnBrowser()) {
|
|
47
|
-
return (_a = this.ethProviderHelper) === null || _a === void 0 ? void 0 : _a.findWalletClient();
|
|
47
|
+
return (_a = this.ethProviderHelper) === null || _a === void 0 ? void 0 : _a.findWalletClient(chainId);
|
|
48
48
|
}
|
|
49
49
|
return createWalletClient({
|
|
50
50
|
transport: custom(getCoinbaseProvider({
|
|
@@ -4,8 +4,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var _tslib = require('../_virtual/_tslib.cjs');
|
|
6
6
|
var viem = require('viem');
|
|
7
|
+
var accounts = require('viem/accounts');
|
|
7
8
|
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
8
9
|
var utils = require('@dynamic-labs/utils');
|
|
10
|
+
var viemUtils = require('@dynamic-labs/viem-utils');
|
|
9
11
|
var eip6963Provider = require('./eip6963Provider.cjs');
|
|
10
12
|
|
|
11
13
|
class EthProviderHelper {
|
|
@@ -75,12 +77,14 @@ class EthProviderHelper {
|
|
|
75
77
|
findProvider() {
|
|
76
78
|
return this.getInstalledProvider();
|
|
77
79
|
}
|
|
78
|
-
findWalletClient() {
|
|
80
|
+
findWalletClient(chainId) {
|
|
79
81
|
const provider = this.findProvider();
|
|
80
82
|
if (!provider) {
|
|
81
83
|
return undefined;
|
|
82
84
|
}
|
|
83
85
|
return viem.createWalletClient({
|
|
86
|
+
account: this.account,
|
|
87
|
+
chain: chainId ? viemUtils.chainsMap[chainId] : undefined,
|
|
84
88
|
transport: viem.custom(provider),
|
|
85
89
|
});
|
|
86
90
|
}
|
|
@@ -98,6 +102,7 @@ class EthProviderHelper {
|
|
|
98
102
|
try {
|
|
99
103
|
const [lowercaseAddress] = yield client.requestAddresses();
|
|
100
104
|
const publicAddress = viem.getAddress(lowercaseAddress);
|
|
105
|
+
this.account = accounts.toAccount(publicAddress);
|
|
101
106
|
return publicAddress;
|
|
102
107
|
}
|
|
103
108
|
catch (err) {
|
|
@@ -4,6 +4,7 @@ import { WalletSchema } from '@dynamic-labs/wallet-book';
|
|
|
4
4
|
import { IEthereum, ProviderFlag } from './types';
|
|
5
5
|
export declare class EthProviderHelper {
|
|
6
6
|
private wallet;
|
|
7
|
+
private account;
|
|
7
8
|
constructor(wallet: WalletSchema);
|
|
8
9
|
getInstalledProvider(): IEthereum | undefined;
|
|
9
10
|
getEip6963Config(): {
|
|
@@ -27,7 +28,7 @@ export declare class EthProviderHelper {
|
|
|
27
28
|
eip6963ProviderLookup(rdns: string): IEthereum | undefined;
|
|
28
29
|
isInstalledHelper(): boolean;
|
|
29
30
|
findProvider(): IEthereum | undefined;
|
|
30
|
-
findWalletClient(): WalletClient | undefined;
|
|
31
|
+
findWalletClient(chainId?: string): WalletClient | undefined;
|
|
31
32
|
fetchPublicAddress(): Promise<Hex | undefined>;
|
|
32
33
|
fetchPublicAddressWithProvider(client: WalletClient): Promise<Hex | undefined>;
|
|
33
34
|
signMessage(messageToSign: string): Promise<string | undefined>;
|
package/src/ethProviderHelper.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { __awaiter } from '../_virtual/_tslib.js';
|
|
2
2
|
import { createWalletClient, custom, getAddress } from 'viem';
|
|
3
|
+
import { toAccount } from 'viem/accounts';
|
|
3
4
|
import { ProviderLookup, eventListenerHandlers, logger } from '@dynamic-labs/wallet-connector-core';
|
|
4
5
|
import { getProvidersFromWindow } from '@dynamic-labs/utils';
|
|
6
|
+
import { chainsMap } from '@dynamic-labs/viem-utils';
|
|
5
7
|
import { Eip6963ProviderSingleton } from './eip6963Provider.js';
|
|
6
8
|
|
|
7
9
|
class EthProviderHelper {
|
|
@@ -71,12 +73,14 @@ class EthProviderHelper {
|
|
|
71
73
|
findProvider() {
|
|
72
74
|
return this.getInstalledProvider();
|
|
73
75
|
}
|
|
74
|
-
findWalletClient() {
|
|
76
|
+
findWalletClient(chainId) {
|
|
75
77
|
const provider = this.findProvider();
|
|
76
78
|
if (!provider) {
|
|
77
79
|
return undefined;
|
|
78
80
|
}
|
|
79
81
|
return createWalletClient({
|
|
82
|
+
account: this.account,
|
|
83
|
+
chain: chainId ? chainsMap[chainId] : undefined,
|
|
80
84
|
transport: custom(provider),
|
|
81
85
|
});
|
|
82
86
|
}
|
|
@@ -94,6 +98,7 @@ class EthProviderHelper {
|
|
|
94
98
|
try {
|
|
95
99
|
const [lowercaseAddress] = yield client.requestAddresses();
|
|
96
100
|
const publicAddress = getAddress(lowercaseAddress);
|
|
101
|
+
this.account = toAccount(publicAddress);
|
|
97
102
|
return publicAddress;
|
|
98
103
|
}
|
|
99
104
|
catch (err) {
|
|
@@ -51,9 +51,9 @@ class InjectedWalletBase extends EthWalletConnector.EthWalletConnector {
|
|
|
51
51
|
const { tearDownEventListeners } = ethProviderHelper._setupEventListeners(this);
|
|
52
52
|
this.teardownEventListeners = tearDownEventListeners;
|
|
53
53
|
}
|
|
54
|
-
getWalletClient() {
|
|
54
|
+
getWalletClient(chainId) {
|
|
55
55
|
var _a;
|
|
56
|
-
return (_a = this.getEthProviderHelper()) === null || _a === void 0 ? void 0 : _a.findWalletClient();
|
|
56
|
+
return (_a = this.getEthProviderHelper()) === null || _a === void 0 ? void 0 : _a.findWalletClient(chainId);
|
|
57
57
|
}
|
|
58
58
|
isInstalledOnBrowser() {
|
|
59
59
|
var _a;
|
|
@@ -14,7 +14,7 @@ declare abstract class InjectedWalletBase extends EthWalletConnector {
|
|
|
14
14
|
getEthProviderHelper(): EthProviderHelper | undefined;
|
|
15
15
|
getMobileOrInstalledWallet(): InjectedWalletBase;
|
|
16
16
|
setupEventListeners(): void;
|
|
17
|
-
getWalletClient(): WalletClient | undefined;
|
|
17
|
+
getWalletClient(chainId?: string): WalletClient | undefined;
|
|
18
18
|
isInstalledOnBrowser(): boolean;
|
|
19
19
|
fetchPublicAddress(): Promise<string | undefined>;
|
|
20
20
|
connect(): Promise<void>;
|
|
@@ -49,9 +49,9 @@ class InjectedWalletBase extends EthWalletConnector {
|
|
|
49
49
|
const { tearDownEventListeners } = ethProviderHelper._setupEventListeners(this);
|
|
50
50
|
this.teardownEventListeners = tearDownEventListeners;
|
|
51
51
|
}
|
|
52
|
-
getWalletClient() {
|
|
52
|
+
getWalletClient(chainId) {
|
|
53
53
|
var _a;
|
|
54
|
-
return (_a = this.getEthProviderHelper()) === null || _a === void 0 ? void 0 : _a.findWalletClient();
|
|
54
|
+
return (_a = this.getEthProviderHelper()) === null || _a === void 0 ? void 0 : _a.findWalletClient(chainId);
|
|
55
55
|
}
|
|
56
56
|
isInstalledOnBrowser() {
|
|
57
57
|
var _a;
|