@dynamic-labs/ethereum 2.0.0-alpha.24 → 2.0.0-alpha.25
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 +7 -0
- package/package.json +8 -8
- package/src/coinbase/coinbase.cjs +0 -5
- package/src/coinbase/coinbase.d.ts +1 -1
- package/src/coinbase/coinbase.js +0 -5
- package/src/injected/InjectedWalletBase.cjs +17 -5
- package/src/injected/InjectedWalletBase.js +17 -5
- package/src/injected/Zerion.d.ts +2 -15
- package/src/injected/fetchInjectedWalletConnectors.cjs +22 -0
- package/src/injected/fetchInjectedWalletConnectors.js +22 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
|
|
2
|
+
## [2.0.0-alpha.25](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.24...v2.0.0-alpha.25) (2024-04-04)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* add in-app browser deeplink for metamask ([#5176](https://github.com/dynamic-labs/DynamicAuth/issues/5176)) ([02ce607](https://github.com/dynamic-labs/DynamicAuth/commit/02ce6077ed0deeaefc7a62ee91ff72f5bce2b327)), closes [#5123](https://github.com/dynamic-labs/DynamicAuth/issues/5123)
|
|
8
|
+
|
|
2
9
|
## [2.0.0-alpha.24](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.23...v2.0.0-alpha.24) (2024-04-03)
|
|
3
10
|
|
|
4
11
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/ethereum",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.25",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -30,13 +30,13 @@
|
|
|
30
30
|
"@walletconnect/ethereum-provider": "2.11.2",
|
|
31
31
|
"eventemitter3": "5.0.1",
|
|
32
32
|
"buffer": "6.0.3",
|
|
33
|
-
"@dynamic-labs/rpc-provider-ethereum": "2.0.0-alpha.
|
|
34
|
-
"@dynamic-labs/turnkey": "2.0.0-alpha.
|
|
35
|
-
"@dynamic-labs/types": "2.0.0-alpha.
|
|
36
|
-
"@dynamic-labs/utils": "2.0.0-alpha.
|
|
37
|
-
"@dynamic-labs/viem-utils": "2.0.0-alpha.
|
|
38
|
-
"@dynamic-labs/wallet-book": "2.0.0-alpha.
|
|
39
|
-
"@dynamic-labs/wallet-connector-core": "2.0.0-alpha.
|
|
33
|
+
"@dynamic-labs/rpc-provider-ethereum": "2.0.0-alpha.25",
|
|
34
|
+
"@dynamic-labs/turnkey": "2.0.0-alpha.25",
|
|
35
|
+
"@dynamic-labs/types": "2.0.0-alpha.25",
|
|
36
|
+
"@dynamic-labs/utils": "2.0.0-alpha.25",
|
|
37
|
+
"@dynamic-labs/viem-utils": "2.0.0-alpha.25",
|
|
38
|
+
"@dynamic-labs/wallet-book": "2.0.0-alpha.25",
|
|
39
|
+
"@dynamic-labs/wallet-connector-core": "2.0.0-alpha.25",
|
|
40
40
|
"stream": "0.0.2"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
@@ -6,14 +6,9 @@ var _tslib = require('../../_virtual/_tslib.cjs');
|
|
|
6
6
|
var viem = require('viem');
|
|
7
7
|
var walletBook = require('@dynamic-labs/wallet-book');
|
|
8
8
|
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
9
|
-
require('../polyfills.cjs');
|
|
10
|
-
require('@dynamic-labs/turnkey');
|
|
11
|
-
require('@dynamic-labs/utils');
|
|
12
9
|
var ethProviderHelper = require('../ethProviderHelper.cjs');
|
|
13
10
|
var EthWalletConnector = require('../EthWalletConnector.cjs');
|
|
14
|
-
require('../walletConnect/walletConnect.cjs');
|
|
15
11
|
var client = require('./client/client.cjs');
|
|
16
|
-
require('@dynamic-labs/rpc-provider-ethereum');
|
|
17
12
|
|
|
18
13
|
class Coinbase extends EthWalletConnector.EthWalletConnector {
|
|
19
14
|
constructor(_a) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Chain, GetAddressOpts } from '@dynamic-labs/wallet-connector-core';
|
|
2
|
-
import { EthProviderHelper } from '
|
|
2
|
+
import { EthProviderHelper } from '../ethProviderHelper';
|
|
3
3
|
import { EthWalletConnector, EthWalletConnectorOpts } from '../EthWalletConnector';
|
|
4
4
|
type CoinbaseOpts = EthWalletConnectorOpts & {
|
|
5
5
|
appLogoUrl?: string;
|
package/src/coinbase/coinbase.js
CHANGED
|
@@ -2,14 +2,9 @@ import { __rest, __awaiter } from '../../_virtual/_tslib.js';
|
|
|
2
2
|
import { createWalletClient, custom } from 'viem';
|
|
3
3
|
import { findWalletBookWallet } from '@dynamic-labs/wallet-book';
|
|
4
4
|
import { eventListenerHandlers } from '@dynamic-labs/wallet-connector-core';
|
|
5
|
-
import '../polyfills.js';
|
|
6
|
-
import '@dynamic-labs/turnkey';
|
|
7
|
-
import '@dynamic-labs/utils';
|
|
8
5
|
import { EthProviderHelper } from '../ethProviderHelper.js';
|
|
9
6
|
import { EthWalletConnector } from '../EthWalletConnector.js';
|
|
10
|
-
import '../walletConnect/walletConnect.js';
|
|
11
7
|
import { getCoinbaseProvider, getAddress, signMessage, killCoinbaseSession } from './client/client.js';
|
|
12
|
-
import '@dynamic-labs/rpc-provider-ethereum';
|
|
13
8
|
|
|
14
9
|
class Coinbase extends EthWalletConnector {
|
|
15
10
|
constructor(_a) {
|
|
@@ -26,12 +26,24 @@ class InjectedWalletBase extends EthWalletConnector.EthWalletConnector {
|
|
|
26
26
|
return this.ethProviderHelper;
|
|
27
27
|
}
|
|
28
28
|
getMobileOrInstalledWallet() {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
var _a, _b;
|
|
30
|
+
if (!this.wallet) {
|
|
31
|
+
this.wallet = walletBook.findWalletBookWallet(this.walletBook, this.key);
|
|
32
|
+
}
|
|
33
|
+
if (this.isInstalledOnBrowser()) {
|
|
34
|
+
return this;
|
|
35
|
+
}
|
|
36
|
+
if (((_b = (_a = this.wallet) === null || _a === void 0 ? void 0 : _a.mobile) === null || _b === void 0 ? void 0 : _b.inAppBrowser) &&
|
|
37
|
+
this.constructorProps.deepLinkPreference !== 'universal') {
|
|
38
|
+
return this;
|
|
39
|
+
}
|
|
40
|
+
// this is the case where the wallet is not installed on the browser and
|
|
41
|
+
// it does not support WalletConnect. in this case, the SDK will instruct
|
|
42
|
+
// the user to download the wallet extension
|
|
43
|
+
if (!this.walletConnectorFallback) {
|
|
44
|
+
return this;
|
|
33
45
|
}
|
|
34
|
-
return this;
|
|
46
|
+
return new walletConnect.WalletConnect(Object.assign(Object.assign({}, this.constructorProps), { walletName: this.name }));
|
|
35
47
|
}
|
|
36
48
|
setupEventListeners() {
|
|
37
49
|
const provider = this.getWalletClient();
|
|
@@ -24,12 +24,24 @@ class InjectedWalletBase extends EthWalletConnector {
|
|
|
24
24
|
return this.ethProviderHelper;
|
|
25
25
|
}
|
|
26
26
|
getMobileOrInstalledWallet() {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
var _a, _b;
|
|
28
|
+
if (!this.wallet) {
|
|
29
|
+
this.wallet = findWalletBookWallet(this.walletBook, this.key);
|
|
30
|
+
}
|
|
31
|
+
if (this.isInstalledOnBrowser()) {
|
|
32
|
+
return this;
|
|
33
|
+
}
|
|
34
|
+
if (((_b = (_a = this.wallet) === null || _a === void 0 ? void 0 : _a.mobile) === null || _b === void 0 ? void 0 : _b.inAppBrowser) &&
|
|
35
|
+
this.constructorProps.deepLinkPreference !== 'universal') {
|
|
36
|
+
return this;
|
|
37
|
+
}
|
|
38
|
+
// this is the case where the wallet is not installed on the browser and
|
|
39
|
+
// it does not support WalletConnect. in this case, the SDK will instruct
|
|
40
|
+
// the user to download the wallet extension
|
|
41
|
+
if (!this.walletConnectorFallback) {
|
|
42
|
+
return this;
|
|
31
43
|
}
|
|
32
|
-
return this;
|
|
44
|
+
return new WalletConnect(Object.assign(Object.assign({}, this.constructorProps), { walletName: this.name }));
|
|
33
45
|
}
|
|
34
46
|
setupEventListeners() {
|
|
35
47
|
const provider = this.getWalletClient();
|
package/src/injected/Zerion.d.ts
CHANGED
|
@@ -1,23 +1,10 @@
|
|
|
1
|
+
import { WalletSchema } from '@dynamic-labs/wallet-book';
|
|
1
2
|
import { EthWalletConnectorOpts } from '../EthWalletConnector';
|
|
2
3
|
import InjectedWalletBase from './InjectedWalletBase';
|
|
3
4
|
export declare class Zerion extends InjectedWalletBase {
|
|
4
5
|
name: string;
|
|
5
6
|
overrideKey: string;
|
|
6
|
-
wallet:
|
|
7
|
-
eip6963Config: {
|
|
8
|
-
rdns: string;
|
|
9
|
-
};
|
|
10
|
-
filterFromWalletConnect: boolean;
|
|
11
|
-
injectedConfig: {
|
|
12
|
-
chain: string;
|
|
13
|
-
extensionLocators: {
|
|
14
|
-
flag: string;
|
|
15
|
-
value: boolean;
|
|
16
|
-
}[];
|
|
17
|
-
windowLocations: string[];
|
|
18
|
-
}[];
|
|
19
|
-
name: string;
|
|
20
|
-
};
|
|
7
|
+
wallet: WalletSchema;
|
|
21
8
|
constructor(props: EthWalletConnectorOpts);
|
|
22
9
|
isInstalledOnBrowser(): boolean;
|
|
23
10
|
}
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var _tslib = require('../../_virtual/_tslib.cjs');
|
|
6
|
+
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
5
7
|
var InjectedWalletBase = require('./InjectedWalletBase.cjs');
|
|
6
8
|
var PhantomEvm = require('./PhantomEvm.cjs');
|
|
7
9
|
var ExodusEvm = require('./ExodusEvm.cjs');
|
|
@@ -39,6 +41,26 @@ const fetchInjectedWalletConnector = ({ walletBook, }) => {
|
|
|
39
41
|
// this is the key from the wallet book entry so that we don't purely rely on the normalized name
|
|
40
42
|
this.overrideKey = key;
|
|
41
43
|
}
|
|
44
|
+
getAddress() {
|
|
45
|
+
const _super = Object.create(null, {
|
|
46
|
+
getAddress: { get: () => super.getAddress }
|
|
47
|
+
});
|
|
48
|
+
var _a;
|
|
49
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
if (this.isInstalledOnBrowser()) {
|
|
51
|
+
return _super.getAddress.call(this);
|
|
52
|
+
}
|
|
53
|
+
const inAppBrowserBase = (_a = this.wallet.mobile) === null || _a === void 0 ? void 0 : _a.inAppBrowser;
|
|
54
|
+
if (!inAppBrowserBase) {
|
|
55
|
+
const error = new Error(`No inAppBrowserBase found for ${this.name}.`);
|
|
56
|
+
walletConnectorCore.logger.error(error.message);
|
|
57
|
+
throw error;
|
|
58
|
+
}
|
|
59
|
+
const cleanedTargetUrl = window.location.href.replace('https://', '');
|
|
60
|
+
window.location.href = `${inAppBrowserBase}/${cleanedTargetUrl}`;
|
|
61
|
+
return undefined;
|
|
62
|
+
});
|
|
63
|
+
}
|
|
42
64
|
};
|
|
43
65
|
});
|
|
44
66
|
};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { __awaiter } from '../../_virtual/_tslib.js';
|
|
2
|
+
import { logger } from '@dynamic-labs/wallet-connector-core';
|
|
1
3
|
import InjectedWalletBase from './InjectedWalletBase.js';
|
|
2
4
|
import { PhantomEvm } from './PhantomEvm.js';
|
|
3
5
|
import { ExodusEvm } from './ExodusEvm.js';
|
|
@@ -35,6 +37,26 @@ const fetchInjectedWalletConnector = ({ walletBook, }) => {
|
|
|
35
37
|
// this is the key from the wallet book entry so that we don't purely rely on the normalized name
|
|
36
38
|
this.overrideKey = key;
|
|
37
39
|
}
|
|
40
|
+
getAddress() {
|
|
41
|
+
const _super = Object.create(null, {
|
|
42
|
+
getAddress: { get: () => super.getAddress }
|
|
43
|
+
});
|
|
44
|
+
var _a;
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
if (this.isInstalledOnBrowser()) {
|
|
47
|
+
return _super.getAddress.call(this);
|
|
48
|
+
}
|
|
49
|
+
const inAppBrowserBase = (_a = this.wallet.mobile) === null || _a === void 0 ? void 0 : _a.inAppBrowser;
|
|
50
|
+
if (!inAppBrowserBase) {
|
|
51
|
+
const error = new Error(`No inAppBrowserBase found for ${this.name}.`);
|
|
52
|
+
logger.error(error.message);
|
|
53
|
+
throw error;
|
|
54
|
+
}
|
|
55
|
+
const cleanedTargetUrl = window.location.href.replace('https://', '');
|
|
56
|
+
window.location.href = `${inAppBrowserBase}/${cleanedTargetUrl}`;
|
|
57
|
+
return undefined;
|
|
58
|
+
});
|
|
59
|
+
}
|
|
38
60
|
};
|
|
39
61
|
});
|
|
40
62
|
};
|