@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
package/dist/reown/adapter.d.ts
CHANGED
@@ -17,7 +17,8 @@ type GetProfileResult = {
|
|
17
17
|
profileName: string;
|
18
18
|
};
|
19
19
|
export declare class HederaAdapter extends AdapterBlueprint {
|
20
|
-
|
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 {};
|
package/dist/reown/adapter.js
CHANGED
@@ -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
|
-
|
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
|
-
|
21
|
-
|
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