@dynamic-labs/ethereum 2.1.0-alpha.31 → 2.1.0-alpha.32
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 +16 -0
- package/package.json +8 -8
- package/src/coinbase/coinbase.cjs +4 -0
- package/src/coinbase/coinbase.d.ts +1 -0
- package/src/coinbase/coinbase.js +4 -0
- package/src/coinbase/helpers.cjs +10 -7
- package/src/coinbase/helpers.js +10 -7
- package/src/ethProviderHelper.cjs +2 -2
- package/src/ethProviderHelper.d.ts +2 -2
- package/src/ethProviderHelper.js +2 -2
- package/src/types.d.ts +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
|
|
2
|
+
## [2.1.0-alpha.32](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.31...v2.1.0-alpha.32) (2024-06-04)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* favor base mainnet when using coinbase sdk ([#5834](https://github.com/dynamic-labs/DynamicAuth/issues/5834)) ([fee5294](https://github.com/dynamic-labs/DynamicAuth/commit/fee529461e6b033938d3ec044c139f5efcb24f6d))
|
|
8
|
+
* open OKX deep link for Bitcoin ([#5818](https://github.com/dynamic-labs/DynamicAuth/issues/5818)) ([c33e93c](https://github.com/dynamic-labs/DynamicAuth/commit/c33e93c81b384d8cd91b3bd0414dd9ea669405c4))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* change Bitget Wallet to Bitget ([#5824](https://github.com/dynamic-labs/DynamicAuth/issues/5824)) ([23b8813](https://github.com/dynamic-labs/DynamicAuth/commit/23b8813e233be07392f5a3e283226b238b9fd99b))
|
|
14
|
+
* coinbase isInstalled ([#5821](https://github.com/dynamic-labs/DynamicAuth/issues/5821)) ([d0e5a37](https://github.com/dynamic-labs/DynamicAuth/commit/d0e5a37c6dd0cb6b85a5704767c93d495aa22854))
|
|
15
|
+
* filter window.solana in solProviderHelper if no extensionLocators are set ([#5819](https://github.com/dynamic-labs/DynamicAuth/issues/5819)) ([ca098ad](https://github.com/dynamic-labs/DynamicAuth/commit/ca098adb787365f9969c1a1f853d3c65ddd40d54))
|
|
16
|
+
* only send ordinal address if only one address retrieved from btc wallet ([#5817](https://github.com/dynamic-labs/DynamicAuth/issues/5817)) ([d54cef4](https://github.com/dynamic-labs/DynamicAuth/commit/d54cef424368b804fde0a4e607fefce22877a304))
|
|
17
|
+
|
|
2
18
|
## [2.1.0-alpha.31](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.30...v2.1.0-alpha.31) (2024-05-31)
|
|
3
19
|
|
|
4
20
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/ethereum",
|
|
3
|
-
"version": "2.1.0-alpha.
|
|
3
|
+
"version": "2.1.0-alpha.32",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
|
|
@@ -31,13 +31,13 @@
|
|
|
31
31
|
"@walletconnect/ethereum-provider": "2.11.2",
|
|
32
32
|
"eventemitter3": "5.0.1",
|
|
33
33
|
"buffer": "6.0.3",
|
|
34
|
-
"@dynamic-labs/rpc-provider-ethereum": "2.1.0-alpha.
|
|
35
|
-
"@dynamic-labs/turnkey": "2.1.0-alpha.
|
|
36
|
-
"@dynamic-labs/types": "2.1.0-alpha.
|
|
37
|
-
"@dynamic-labs/utils": "2.1.0-alpha.
|
|
38
|
-
"@dynamic-labs/viem-utils": "2.1.0-alpha.
|
|
39
|
-
"@dynamic-labs/wallet-book": "2.1.0-alpha.
|
|
40
|
-
"@dynamic-labs/wallet-connector-core": "2.1.0-alpha.
|
|
34
|
+
"@dynamic-labs/rpc-provider-ethereum": "2.1.0-alpha.32",
|
|
35
|
+
"@dynamic-labs/turnkey": "2.1.0-alpha.32",
|
|
36
|
+
"@dynamic-labs/types": "2.1.0-alpha.32",
|
|
37
|
+
"@dynamic-labs/utils": "2.1.0-alpha.32",
|
|
38
|
+
"@dynamic-labs/viem-utils": "2.1.0-alpha.32",
|
|
39
|
+
"@dynamic-labs/wallet-book": "2.1.0-alpha.32",
|
|
40
|
+
"@dynamic-labs/wallet-connector-core": "2.1.0-alpha.32",
|
|
41
41
|
"stream": "0.0.2"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
@@ -45,6 +45,10 @@ class Coinbase extends EthWalletConnector.EthWalletConnector {
|
|
|
45
45
|
}
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
|
+
isInstalledOnBrowser() {
|
|
49
|
+
var _a;
|
|
50
|
+
return Boolean((_a = window === null || window === void 0 ? void 0 : window.coinbaseWalletExtension) === null || _a === void 0 ? void 0 : _a.isCoinbaseWallet);
|
|
51
|
+
}
|
|
48
52
|
getAddress() {
|
|
49
53
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
50
54
|
const [address] = yield this.coinbaseProvider.request({
|
|
@@ -11,6 +11,7 @@ export declare class Coinbase extends EthWalletConnector {
|
|
|
11
11
|
private coinbaseProvider;
|
|
12
12
|
constructor({ appName, appLogoUrl, evmNetworks, coinbaseWalletPreference, ...props }: CoinbaseOpts);
|
|
13
13
|
getConnectedAccounts(): Promise<string[]>;
|
|
14
|
+
isInstalledOnBrowser(): boolean;
|
|
14
15
|
getAddress(): Promise<string | undefined>;
|
|
15
16
|
signMessage(messageToSign: string): Promise<string | undefined>;
|
|
16
17
|
setupEventListeners(): void;
|
package/src/coinbase/coinbase.js
CHANGED
|
@@ -41,6 +41,10 @@ class Coinbase extends EthWalletConnector {
|
|
|
41
41
|
}
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
|
+
isInstalledOnBrowser() {
|
|
45
|
+
var _a;
|
|
46
|
+
return Boolean((_a = window === null || window === void 0 ? void 0 : window.coinbaseWalletExtension) === null || _a === void 0 ? void 0 : _a.isCoinbaseWallet);
|
|
47
|
+
}
|
|
44
48
|
getAddress() {
|
|
45
49
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46
50
|
const [address] = yield this.coinbaseProvider.request({
|
package/src/coinbase/helpers.cjs
CHANGED
|
@@ -8,16 +8,19 @@ var walletSdk = require('@coinbase/wallet-sdk');
|
|
|
8
8
|
// storing a reference to the coinbase provider because the provider methods work better when
|
|
9
9
|
// they are called on the same instance
|
|
10
10
|
let coinbaseProvider;
|
|
11
|
+
const baseSepolia = 84532;
|
|
12
|
+
const baseMainnet = 8453;
|
|
11
13
|
const getCoinbaseProvider = ({ opts: { appLogoUrl, appName, evmNetworks, walletPreference } = {}, }) => {
|
|
12
|
-
// favoring base sepolia since that is the only chain that works for now
|
|
13
|
-
// when coinbase launches in mainnet, customers can simply disable the base sepolia chain
|
|
14
|
-
// from their dynamic settings, and everything will still work
|
|
15
|
-
const hasBaseSepolia = evmNetworks === null || evmNetworks === void 0 ? void 0 : evmNetworks.some((network) => network.chainId === 84532);
|
|
16
14
|
const appChainIds = evmNetworks === null || evmNetworks === void 0 ? void 0 : evmNetworks.map((network) => Number(network.chainId));
|
|
15
|
+
// just brings base sepolia to the front of the list, because that is treated as the default chain
|
|
16
|
+
const hasBaseSepolia = evmNetworks === null || evmNetworks === void 0 ? void 0 : evmNetworks.some((network) => network.chainId === baseSepolia);
|
|
17
17
|
if (hasBaseSepolia) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
appChainIds === null || appChainIds === void 0 ? void 0 : appChainIds.sort((a, b) => a === baseSepolia ? -1 : b === baseSepolia ? 1 : 0);
|
|
19
|
+
}
|
|
20
|
+
// just brings base mainnet to the front, because that that is treated as the default chain
|
|
21
|
+
const hasBaseMainnet = evmNetworks === null || evmNetworks === void 0 ? void 0 : evmNetworks.some((network) => network.chainId === baseMainnet);
|
|
22
|
+
if (hasBaseMainnet) {
|
|
23
|
+
appChainIds === null || appChainIds === void 0 ? void 0 : appChainIds.sort((a, b) => a === baseMainnet ? -1 : b === baseMainnet ? 1 : 0);
|
|
21
24
|
}
|
|
22
25
|
if (!coinbaseProvider) {
|
|
23
26
|
const coinbaseSdk = new walletSdk.CoinbaseWalletSDK({
|
package/src/coinbase/helpers.js
CHANGED
|
@@ -4,16 +4,19 @@ import { CoinbaseWalletSDK } from '@coinbase/wallet-sdk';
|
|
|
4
4
|
// storing a reference to the coinbase provider because the provider methods work better when
|
|
5
5
|
// they are called on the same instance
|
|
6
6
|
let coinbaseProvider;
|
|
7
|
+
const baseSepolia = 84532;
|
|
8
|
+
const baseMainnet = 8453;
|
|
7
9
|
const getCoinbaseProvider = ({ opts: { appLogoUrl, appName, evmNetworks, walletPreference } = {}, }) => {
|
|
8
|
-
// favoring base sepolia since that is the only chain that works for now
|
|
9
|
-
// when coinbase launches in mainnet, customers can simply disable the base sepolia chain
|
|
10
|
-
// from their dynamic settings, and everything will still work
|
|
11
|
-
const hasBaseSepolia = evmNetworks === null || evmNetworks === void 0 ? void 0 : evmNetworks.some((network) => network.chainId === 84532);
|
|
12
10
|
const appChainIds = evmNetworks === null || evmNetworks === void 0 ? void 0 : evmNetworks.map((network) => Number(network.chainId));
|
|
11
|
+
// just brings base sepolia to the front of the list, because that is treated as the default chain
|
|
12
|
+
const hasBaseSepolia = evmNetworks === null || evmNetworks === void 0 ? void 0 : evmNetworks.some((network) => network.chainId === baseSepolia);
|
|
13
13
|
if (hasBaseSepolia) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
appChainIds === null || appChainIds === void 0 ? void 0 : appChainIds.sort((a, b) => a === baseSepolia ? -1 : b === baseSepolia ? 1 : 0);
|
|
15
|
+
}
|
|
16
|
+
// just brings base mainnet to the front, because that that is treated as the default chain
|
|
17
|
+
const hasBaseMainnet = evmNetworks === null || evmNetworks === void 0 ? void 0 : evmNetworks.some((network) => network.chainId === baseMainnet);
|
|
18
|
+
if (hasBaseMainnet) {
|
|
19
|
+
appChainIds === null || appChainIds === void 0 ? void 0 : appChainIds.sort((a, b) => a === baseMainnet ? -1 : b === baseMainnet ? 1 : 0);
|
|
17
20
|
}
|
|
18
21
|
if (!coinbaseProvider) {
|
|
19
22
|
const coinbaseSdk = new CoinbaseWalletSDK({
|
|
@@ -63,9 +63,9 @@ class EthProviderHelper {
|
|
|
63
63
|
}
|
|
64
64
|
return providers;
|
|
65
65
|
}
|
|
66
|
-
installedProviderLookup(
|
|
66
|
+
installedProviderLookup(extensionLocators) {
|
|
67
67
|
const allInstalledProviders = this.installedProviders();
|
|
68
|
-
return walletConnectorCore.ProviderLookup(allInstalledProviders,
|
|
68
|
+
return walletConnectorCore.ProviderLookup(allInstalledProviders, extensionLocators);
|
|
69
69
|
}
|
|
70
70
|
eip6963ProviderLookup(rdns) {
|
|
71
71
|
var _a;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Hex, WalletClient } from 'viem';
|
|
2
2
|
import { ProviderCondition, WalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
3
3
|
import { WalletSchema } from '@dynamic-labs/wallet-book';
|
|
4
|
-
import { IEthereum,
|
|
4
|
+
import { IEthereum, ExtensionLocator } from './types';
|
|
5
5
|
import { EthWalletConnector } from '.';
|
|
6
6
|
export declare class EthProviderHelper {
|
|
7
7
|
private wallet;
|
|
@@ -25,7 +25,7 @@ export declare class EthProviderHelper {
|
|
|
25
25
|
windowLocations?: string[] | undefined;
|
|
26
26
|
} | undefined;
|
|
27
27
|
installedProviders(): IEthereum[];
|
|
28
|
-
installedProviderLookup(
|
|
28
|
+
installedProviderLookup(extensionLocators: Array<ProviderCondition<ExtensionLocator>>): IEthereum | undefined;
|
|
29
29
|
eip6963ProviderLookup(rdns: string): IEthereum | undefined;
|
|
30
30
|
isInstalledHelper(): boolean;
|
|
31
31
|
findProvider(): IEthereum | undefined;
|
package/src/ethProviderHelper.js
CHANGED
|
@@ -59,9 +59,9 @@ class EthProviderHelper {
|
|
|
59
59
|
}
|
|
60
60
|
return providers;
|
|
61
61
|
}
|
|
62
|
-
installedProviderLookup(
|
|
62
|
+
installedProviderLookup(extensionLocators) {
|
|
63
63
|
const allInstalledProviders = this.installedProviders();
|
|
64
|
-
return ProviderLookup(allInstalledProviders,
|
|
64
|
+
return ProviderLookup(allInstalledProviders, extensionLocators);
|
|
65
65
|
}
|
|
66
66
|
eip6963ProviderLookup(rdns) {
|
|
67
67
|
var _a;
|
package/src/types.d.ts
CHANGED
|
@@ -17,15 +17,15 @@ declare global {
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
export type IEthereum = {
|
|
20
|
-
[key in
|
|
20
|
+
[key in ExtensionLocator]: boolean;
|
|
21
21
|
} & {
|
|
22
22
|
providers?: object[];
|
|
23
23
|
request: <T extends string>(params: {
|
|
24
24
|
method: T;
|
|
25
25
|
} | object) => Promise<T extends 'eth_requestAccounts' ? [string] : object>;
|
|
26
26
|
} & EventEmitter;
|
|
27
|
-
export type
|
|
28
|
-
export type EthProviderCondition = ProviderCondition<
|
|
27
|
+
export type ExtensionLocator = 'isDawn' | 'isBraveWallet' | 'isCoinbaseWallet' | 'isFrame' | 'isGamestop' | 'isMetaMask' | 'isExodus' | 'isOpera' | 'isBlocto' | 'isTrustWallet' | 'isZerion' | 'isPhantom' | 'isSuperb' | 'isRabby' | 'isOkxWallet';
|
|
28
|
+
export type EthProviderCondition = ProviderCondition<ExtensionLocator>;
|
|
29
29
|
export type Provider = () => PublicClient | undefined;
|
|
30
30
|
export type ExternalProviderEventEmitter = PublicClient & {
|
|
31
31
|
on: (event: string, listener: (...args: Array<any>) => unknown) => void;
|