@dynamic-labs/ethereum 0.17.13 → 0.17.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 CHANGED
@@ -1,4 +1,18 @@
1
1
 
2
+ ### [0.17.15](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.14...v0.17.15) (2023-06-28)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * **wc_v1_bridget:** disable WC v2 when WC v1 bridge is set ([#2505](https://github.com/dynamic-labs/DynamicAuth/issues/2505)) ([#2506](https://github.com/dynamic-labs/DynamicAuth/issues/2506)) ([ed7dcf2](https://github.com/dynamic-labs/DynamicAuth/commit/ed7dcf2168f5486a780933060e61eff3fe0ff59e))
8
+
9
+ ### [0.17.14](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.13...v0.17.14) (2023-06-27)
10
+
11
+
12
+ ### Features
13
+
14
+ * add support for custom walletconnect v1 bridge ([#2487](https://github.com/dynamic-labs/DynamicAuth/issues/2487)) ([#2498](https://github.com/dynamic-labs/DynamicAuth/issues/2498)) ([c050e56](https://github.com/dynamic-labs/DynamicAuth/commit/c050e569c05801f661940e7b5a76677992fa2b86))
15
+
2
16
  ### [0.17.13](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.12...v0.17.13) (2023-06-27)
3
17
 
4
18
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/ethereum",
3
- "version": "0.17.13",
3
+ "version": "0.17.15",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/dynamic-labs/DynamicAuth.git",
@@ -32,11 +32,11 @@
32
32
  "ethers": "5.7.2",
33
33
  "eventemitter3": "5.0.1",
34
34
  "buffer": "6.0.3",
35
- "@dynamic-labs/rpc-providers": "0.17.13",
36
- "@dynamic-labs/types": "0.17.13",
37
- "@dynamic-labs/utils": "0.17.13",
38
- "@dynamic-labs/wallet-book": "0.17.13",
39
- "@dynamic-labs/wallet-connector-core": "0.17.13"
35
+ "@dynamic-labs/rpc-providers": "0.17.15",
36
+ "@dynamic-labs/types": "0.17.15",
37
+ "@dynamic-labs/utils": "0.17.15",
38
+ "@dynamic-labs/wallet-book": "0.17.15",
39
+ "@dynamic-labs/wallet-connector-core": "0.17.15"
40
40
  },
41
41
  "peerDependencies": {}
42
42
  }
@@ -12,12 +12,12 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
12
12
 
13
13
  var Client__default = /*#__PURE__*/_interopDefaultLegacy(Client);
14
14
 
15
- const initClient = (name, settings) => {
15
+ const initClient = (name, bridge, settings) => {
16
16
  const storageId = `walletconnect-${name}`;
17
17
  const session = localStorage.getItem(storageId);
18
18
  const clientArgs = session
19
19
  ? { session: JSON.parse(session), storageId }
20
- : { bridge: 'https://bridge.walletconnect.org', storageId };
20
+ : { bridge, storageId };
21
21
  return new Client__default["default"](Object.assign(Object.assign({}, clientArgs), settings));
22
22
  };
23
23
  /**
@@ -2,7 +2,7 @@ import Client from '@walletconnect/client';
2
2
  import { ethers } from 'ethers';
3
3
  import { FetchPublicAddressOpts, PayloadParams, WalletEventListeners } from '@dynamic-labs/wallet-connector-core';
4
4
  import { WalletSchema } from '@dynamic-labs/wallet-book';
5
- export declare const initClient: (name: string, settings?: any) => Client;
5
+ export declare const initClient: (name: string, bridge: string, settings?: any) => Client;
6
6
  /**
7
7
  * Attach event handlers to WalletConnect events.
8
8
  */
@@ -4,12 +4,12 @@ import { Contract, ethers } from 'ethers';
4
4
  import { isSameAddress, logger, performPlatformSpecificConnectionMethod, getDeepLink } from '@dynamic-labs/wallet-connector-core';
5
5
  import { isMobile } from '@dynamic-labs/utils';
6
6
 
7
- const initClient = (name, settings) => {
7
+ const initClient = (name, bridge, settings) => {
8
8
  const storageId = `walletconnect-${name}`;
9
9
  const session = localStorage.getItem(storageId);
10
10
  const clientArgs = session
11
11
  ? { session: JSON.parse(session), storageId }
12
- : { bridge: 'https://bridge.walletconnect.org', storageId };
12
+ : { bridge, storageId };
13
13
  return new Client(Object.assign(Object.assign({}, clientArgs), settings));
14
14
  };
15
15
  /**
@@ -18,20 +18,24 @@ var WalletConnectProvider__default = /*#__PURE__*/_interopDefaultLegacy(WalletCo
18
18
 
19
19
  class WalletConnect extends EthWalletConnector.EthWalletConnector {
20
20
  constructor(_a) {
21
- var { walletName } = _a, props = _tslib.__rest(_a, ["walletName"]);
21
+ var { walletConnectV1Bridge, walletName } = _a, props = _tslib.__rest(_a, ["walletConnectV1Bridge", "walletName"]);
22
22
  super(props);
23
23
  this.supportedChains = ['EVM', 'ETH'];
24
24
  this.connectedChain = 'EVM';
25
+ this.bridge = 'https://bridge.walletconnect.org';
25
26
  this.canConnectViaQrCode = true;
26
27
  this.isWalletConnect = true;
27
28
  this.switchNetworkOnlyFromWallet = false;
28
29
  this.name = walletName;
30
+ if (walletConnectV1Bridge) {
31
+ this.bridge = walletConnectV1Bridge;
32
+ }
29
33
  }
30
34
  getClient() {
31
35
  if (this.client) {
32
36
  return this.client;
33
37
  }
34
- this.client = client.initClient(walletConnectorCore.normalizeWalletName(this.name), this.clientOptions);
38
+ this.client = client.initClient(walletConnectorCore.normalizeWalletName(this.name), this.bridge, this.clientOptions);
35
39
  return this.client;
36
40
  }
37
41
  supportsNetworkSwitching() {
@@ -4,18 +4,20 @@ import { Chain, FetchPublicAddressOpts, WalletEventListeners } from '@dynamic-la
4
4
  import { EvmNetwork } from '@dynamic-labs/types';
5
5
  import { EthWalletConnector, EthWalletConnectorOpts } from '../EthWalletConnector';
6
6
  export type WalletConnectOpts = EthWalletConnectorOpts & {
7
+ walletConnectV1Bridge: string;
7
8
  walletName: string;
8
9
  };
9
10
  export declare class WalletConnect extends EthWalletConnector {
10
11
  supportedChains: Chain[];
11
12
  connectedChain: Chain;
12
13
  name: string;
14
+ bridge: string;
13
15
  canConnectViaQrCode: boolean;
14
16
  isWalletConnect: boolean;
15
17
  switchNetworkOnlyFromWallet: boolean;
16
18
  client?: Client;
17
19
  clientOptions?: any;
18
- constructor({ walletName, ...props }: WalletConnectOpts);
20
+ constructor({ walletConnectV1Bridge, walletName, ...props }: WalletConnectOpts);
19
21
  getClient(): Client;
20
22
  supportsNetworkSwitching(): boolean;
21
23
  setupEventListeners(listeners: WalletEventListeners): void;
@@ -10,20 +10,24 @@ import { initClient, setupWalletConnectEventListeners, teardownWalletConnectEven
10
10
 
11
11
  class WalletConnect extends EthWalletConnector {
12
12
  constructor(_a) {
13
- var { walletName } = _a, props = __rest(_a, ["walletName"]);
13
+ var { walletConnectV1Bridge, walletName } = _a, props = __rest(_a, ["walletConnectV1Bridge", "walletName"]);
14
14
  super(props);
15
15
  this.supportedChains = ['EVM', 'ETH'];
16
16
  this.connectedChain = 'EVM';
17
+ this.bridge = 'https://bridge.walletconnect.org';
17
18
  this.canConnectViaQrCode = true;
18
19
  this.isWalletConnect = true;
19
20
  this.switchNetworkOnlyFromWallet = false;
20
21
  this.name = walletName;
22
+ if (walletConnectV1Bridge) {
23
+ this.bridge = walletConnectV1Bridge;
24
+ }
21
25
  }
22
26
  getClient() {
23
27
  if (this.client) {
24
28
  return this.client;
25
29
  }
26
- this.client = initClient(normalizeWalletName(this.name), this.clientOptions);
30
+ this.client = initClient(normalizeWalletName(this.name), this.bridge, this.clientOptions);
27
31
  return this.client;
28
32
  }
29
33
  supportsNetworkSwitching() {