@hashgraph/hedera-wallet-connect 2.0.3-canary.2d3a595.0 → 2.0.4-canary.f71fa76.0

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/README.md CHANGED
@@ -215,7 +215,6 @@ createAppKit({
215
215
 
216
216
  - [Hashpack](https://hashpack.app/)
217
217
  - [Kabila](https://wallet.kabila.app/)
218
- - [Blade](https://bladewallet.io/)
219
218
  - [Dropp](https://dropp.cc/)
220
219
 
221
220
  # Upgrading from v1 to v2
@@ -17,7 +17,8 @@ type GetProfileResult = {
17
17
  profileName: string;
18
18
  };
19
19
  export declare class HederaAdapter extends AdapterBlueprint {
20
- constructor(params: AdapterBlueprint.Params);
20
+ private namespaceMode;
21
+ constructor(params: HederaAdapter.Params);
21
22
  setUniversalProvider(universalProvider: UniversalProvider): Promise<void>;
22
23
  connect(params: AdapterBlueprint.ConnectParams): Promise<AdapterBlueprint.ConnectResult>;
23
24
  disconnect(_params?: AdapterBlueprint.DisconnectParams): Promise<AdapterBlueprint.DisconnectResult>;
@@ -50,4 +51,9 @@ export declare class HederaAdapter extends AdapterBlueprint {
50
51
  getWalletConnectProvider(): UniversalProvider;
51
52
  walletGetAssets(_params: AdapterBlueprint.WalletGetAssetsParams): Promise<AdapterBlueprint.WalletGetAssetsResponse>;
52
53
  }
54
+ export declare namespace HederaAdapter {
55
+ type Params = AdapterBlueprint.Params & {
56
+ namespaceMode?: 'optional' | 'required';
57
+ };
58
+ }
53
59
  export {};
@@ -23,12 +23,15 @@ export class HederaAdapter extends AdapterBlueprint {
23
23
  }
24
24
  }
25
25
  super(Object.assign({}, params));
26
+ this.namespaceMode = 'optional';
27
+ this.namespaceMode = params.namespaceMode || 'optional';
26
28
  }
27
29
  async setUniversalProvider(universalProvider) {
28
30
  this.addConnector(new HederaConnector({
29
31
  provider: universalProvider,
30
32
  caipNetworks: this.getCaipNetworks() || [],
31
33
  namespace: this.namespace,
34
+ namespaceMode: this.namespaceMode,
32
35
  }));
33
36
  }
34
37
  async connect(params) {
@@ -10,7 +10,8 @@ export declare class HederaConnector implements ChainAdapterConnector {
10
10
  readonly chain: ChainNamespace;
11
11
  provider: UniversalProvider;
12
12
  protected caipNetworks: CaipNetwork[];
13
- constructor({ provider, caipNetworks, namespace }: HederaConnector.Options);
13
+ protected namespaceMode: 'optional' | 'required';
14
+ constructor({ provider, caipNetworks, namespace, namespaceMode, }: HederaConnector.Options);
14
15
  get chains(): CaipNetwork[];
15
16
  connectWalletConnect(): Promise<{
16
17
  clientId: string;
@@ -24,6 +25,7 @@ export declare namespace HederaConnector {
24
25
  provider: UniversalProvider;
25
26
  caipNetworks: CaipNetwork[];
26
27
  namespace: 'hedera' | 'eip155';
28
+ namespaceMode?: 'optional' | 'required';
27
29
  };
28
30
  }
29
31
  export {};
@@ -2,7 +2,7 @@ import { ConstantsUtil } from '@reown/appkit-common';
2
2
  import { PresetsUtil } from '@reown/appkit-utils';
3
3
  import { createNamespaces } from '../utils';
4
4
  export class HederaConnector {
5
- constructor({ provider, caipNetworks, namespace }) {
5
+ constructor({ provider, caipNetworks, namespace, namespaceMode = 'optional', }) {
6
6
  this.id = ConstantsUtil.CONNECTOR_ID.WALLET_CONNECT;
7
7
  this.name = PresetsUtil.ConnectorNamesMap[ConstantsUtil.CONNECTOR_ID.WALLET_CONNECT];
8
8
  this.type = 'WALLET_CONNECT';
@@ -10,6 +10,7 @@ export class HederaConnector {
10
10
  this.caipNetworks = caipNetworks;
11
11
  this.provider = provider;
12
12
  this.chain = namespace;
13
+ this.namespaceMode = namespaceMode;
13
14
  }
14
15
  get chains() {
15
16
  return this.caipNetworks;
@@ -17,9 +18,11 @@ export class HederaConnector {
17
18
  async connectWalletConnect() {
18
19
  const isAuthenticated = await this.authenticate();
19
20
  if (!isAuthenticated) {
20
- await this.provider.connect({
21
- optionalNamespaces: createNamespaces(this.caipNetworks),
22
- });
21
+ const namespaces = createNamespaces(this.caipNetworks);
22
+ const connectParams = this.namespaceMode === 'required'
23
+ ? { requiredNamespaces: namespaces }
24
+ : { optionalNamespaces: namespaces };
25
+ await this.provider.connect(connectParams);
23
26
  }
24
27
  return {
25
28
  clientId: await this.provider.client.core.crypto.getClientId(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hashgraph/hedera-wallet-connect",
3
- "version": "2.0.3-canary.2d3a595.0",
3
+ "version": "2.0.4-canary.f71fa76.0",
4
4
  "description": "A library to facilitate integrating Hedera with WalletConnect",
5
5
  "repository": {
6
6
  "type": "git",