@tezos-x/octez.connect-dapp 5.0.2 → 5.0.4
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 +1 -1
- package/dist/cjs/dapp-client/DAppClient.d.ts +4 -3
- package/dist/cjs/dapp-client/DAppClient.js +17 -12
- package/dist/cjs/dapp-client/DAppClient.js.map +1 -1
- package/dist/cjs/dapp-client/DAppClientOptions.d.ts +11 -9
- package/dist/cjs/dapp-client/DAppClientOptions.js.map +1 -1
- package/dist/cjs/events.js +3 -2
- package/dist/cjs/events.js.map +1 -1
- package/dist/esm/dapp-client/DAppClient.d.ts +4 -3
- package/dist/esm/dapp-client/DAppClient.js +18 -13
- package/dist/esm/dapp-client/DAppClient.js.map +1 -1
- package/dist/esm/dapp-client/DAppClientOptions.d.ts +11 -9
- package/dist/esm/dapp-client/DAppClientOptions.js.map +1 -1
- package/dist/esm/events.js +3 -2
- package/dist/esm/events.js.map +1 -1
- package/dist/octez.connect.dapp.min.js +1 -1
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -20,4 +20,4 @@ This package is published from the Trilitech-maintained octez.connect repository
|
|
|
20
20
|
## Notes
|
|
21
21
|
|
|
22
22
|
- Trilitech publishes these packages under the `@tezos-x/octez.connect-*` scope
|
|
23
|
-
- Release notes
|
|
23
|
+
- Release notes live on the [GitHub Releases page](https://github.com/trilitech/octez.connect/releases); package policy lives in [CONTRIBUTING.md](https://github.com/trilitech/octez.connect/blob/master/CONTRIBUTING.md) and [MAINTAINERS.md](https://github.com/trilitech/octez.connect/blob/master/MAINTAINERS.md)
|
|
@@ -40,9 +40,10 @@ export declare class DAppClient extends Client {
|
|
|
40
40
|
protected wcProjectId?: string;
|
|
41
41
|
protected wcRelayUrl?: string;
|
|
42
42
|
/**
|
|
43
|
-
* WalletConnect is
|
|
44
|
-
*
|
|
45
|
-
*
|
|
43
|
+
* WalletConnect is enabled by default (as in 4.8.x) using the shared
|
|
44
|
+
* DEFAULT_WALLETCONNECT_PROJECT_ID unless `walletConnectOptions` overrides it.
|
|
45
|
+
* Set `disableWalletConnect: true` to opt out. When false, no WC transport is
|
|
46
|
+
* built, listened to, or offered for pairing.
|
|
46
47
|
*/
|
|
47
48
|
protected isWalletConnectEnabled: boolean;
|
|
48
49
|
private isGetActiveAccountHandled;
|
|
@@ -44,11 +44,12 @@ class DAppClient extends octez_connect_core_1.Client {
|
|
|
44
44
|
super(Object.assign({ storage: config && config.storage ? config.storage : new octez_connect_core_1.LocalStorage() }, config));
|
|
45
45
|
this.events = new events_1.BeaconEventHandler();
|
|
46
46
|
/**
|
|
47
|
-
* WalletConnect is
|
|
48
|
-
*
|
|
49
|
-
*
|
|
47
|
+
* WalletConnect is enabled by default (as in 4.8.x) using the shared
|
|
48
|
+
* DEFAULT_WALLETCONNECT_PROJECT_ID unless `walletConnectOptions` overrides it.
|
|
49
|
+
* Set `disableWalletConnect: true` to opt out. When false, no WC transport is
|
|
50
|
+
* built, listened to, or offered for pairing.
|
|
50
51
|
*/
|
|
51
|
-
this.isWalletConnectEnabled =
|
|
52
|
+
this.isWalletConnectEnabled = true;
|
|
52
53
|
this.isGetActiveAccountHandled = false;
|
|
53
54
|
this.openRequestsOtherTabs = new Set();
|
|
54
55
|
/**
|
|
@@ -69,12 +70,15 @@ class DAppClient extends octez_connect_core_1.Client {
|
|
|
69
70
|
this.debounceSetActiveAccount = false;
|
|
70
71
|
this.multiTabChannel = new octez_connect_core_1.MultiTabChannel('octez.connect-sdk-channel', this.onBCMessageHandler.bind(this), this.onElectedLeaderhandler.bind(this));
|
|
71
72
|
this.description = config.description;
|
|
72
|
-
// WalletConnect is
|
|
73
|
-
//
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
// WalletConnect is enabled BY DEFAULT (as in 4.8.x) with the shared
|
|
74
|
+
// ecosystem projectId, so dApps don't have to register with WalletConnect
|
|
75
|
+
// Cloud to offer WC wallets (e.g. Kukai Mobile) — the free tier covers the
|
|
76
|
+
// ecosystem's volume. `walletConnectOptions` overrides the projectId/relay,
|
|
77
|
+
// `disableWalletConnect: true` opts out entirely (e.g. environments where
|
|
78
|
+
// the WC provider cannot run, see #32).
|
|
79
|
+
this.isWalletConnectEnabled = !config.disableWalletConnect;
|
|
76
80
|
this.wcProjectId = this.isWalletConnectEnabled
|
|
77
|
-
? ((_a = config.walletConnectOptions) === null || _a === void 0 ? void 0 : _a.projectId) ||
|
|
81
|
+
? ((_a = config.walletConnectOptions) === null || _a === void 0 ? void 0 : _a.projectId) || octez_connect_core_1.DEFAULT_WALLETCONNECT_PROJECT_ID
|
|
78
82
|
: undefined;
|
|
79
83
|
this.wcRelayUrl = this.isWalletConnectEnabled ? (_b = config.walletConnectOptions) === null || _b === void 0 ? void 0 : _b.relayUrl : undefined;
|
|
80
84
|
this.featuredWallets = config.featuredWallets;
|
|
@@ -444,8 +448,8 @@ class DAppClient extends octez_connect_core_1.Client {
|
|
|
444
448
|
yield this.addListener(this.postMessageTransport);
|
|
445
449
|
this.p2pTransport = new DappP2PTransport_1.DappP2PTransport(this.name, keyPair, this.storage, this.matrixNodes, this.iconUrl, this.appUrl);
|
|
446
450
|
yield this.addListener(this.p2pTransport);
|
|
447
|
-
// WalletConnect is
|
|
448
|
-
//
|
|
451
|
+
// WalletConnect is on by default; skip building/listening the transport
|
|
452
|
+
// only when explicitly disabled via disableWalletConnect (#32).
|
|
449
453
|
if (this.isWalletConnectEnabled) {
|
|
450
454
|
const wcOptions = {
|
|
451
455
|
projectId: this.wcProjectId,
|
|
@@ -603,7 +607,8 @@ class DAppClient extends octez_connect_core_1.Client {
|
|
|
603
607
|
}
|
|
604
608
|
else {
|
|
605
609
|
// The persisted active account was paired over WalletConnect but WC
|
|
606
|
-
//
|
|
610
|
+
// has since been disabled (`disableWalletConnect`, #32) or failed to
|
|
611
|
+
// initialize, so there is no matching transport to
|
|
607
612
|
// restore. Without this branch none of the conditions above call
|
|
608
613
|
// resolve() and the init promise created above never settles, so
|
|
609
614
|
// init() (and every later call awaiting it) hangs forever. Resolve on
|