@taquito/wallet-connect 21.0.4-beta.2 → 21.0.5

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.
@@ -29,7 +29,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
29
29
  Object.defineProperty(exports, "__esModule", { value: true });
30
30
  exports.WalletConnect = void 0;
31
31
  const sign_client_1 = require("@walletconnect/sign-client");
32
- const legacy_modal_1 = require("@walletconnect/legacy-modal");
32
+ const modal_1 = require("@walletconnect/modal");
33
33
  const taquito_1 = require("@taquito/taquito");
34
34
  const utils_1 = require("@walletconnect/utils");
35
35
  const types_1 = require("./types");
@@ -37,6 +37,8 @@ const errors_1 = require("./errors");
37
37
  __exportStar(require("./errors"), exports);
38
38
  __exportStar(require("./types"), exports);
39
39
  const TEZOS_PLACEHOLDER = 'tezos';
40
+ const MAINNET_CHAINID = 'mainnet';
41
+ const GHOSTNET_CHAINID = 'ghostnet';
40
42
  /**
41
43
  * @description The `WalletConnect` class implements the `WalletProvider` interface, providing an alternative to `BeaconWallet`.
42
44
  * This package enables dapps built with Taquito to connect to wallets via the WalletConnect/Reown protocol.
@@ -44,8 +46,9 @@ const TEZOS_PLACEHOLDER = 'tezos';
44
46
  * we plan showing a list of available wallets alongside the QR code.
45
47
  */
46
48
  class WalletConnect {
47
- constructor(signClient) {
49
+ constructor(signClient, WalletConnectModal) {
48
50
  this.signClient = signClient;
51
+ this.walletConnectModal = WalletConnectModal;
49
52
  this.signClient.on('session_delete', ({ topic }) => {
50
53
  var _a;
51
54
  if (((_a = this.session) === null || _a === void 0 ? void 0 : _a.topic) === topic) {
@@ -88,8 +91,15 @@ class WalletConnect {
88
91
  */
89
92
  static init(initParams) {
90
93
  return __awaiter(this, void 0, void 0, function* () {
94
+ if (!initParams.projectId) {
95
+ throw new Error('projectId is required');
96
+ }
91
97
  const client = yield sign_client_1.default.init(initParams);
92
- return new WalletConnect(client);
98
+ const walletConnectModal = new modal_1.WalletConnectModal({
99
+ projectId: initParams.projectId,
100
+ chains: [MAINNET_CHAINID, GHOSTNET_CHAINID],
101
+ });
102
+ return new WalletConnect(client, walletConnectModal);
93
103
  });
94
104
  }
95
105
  /**
@@ -116,7 +126,13 @@ class WalletConnect {
116
126
  pairingTopic: connectParams.pairingTopic,
117
127
  });
118
128
  if (uri) {
119
- legacy_modal_1.default.open(uri, () => { }, { registryUrl: connectParams.registryUrl });
129
+ this.walletConnectModal.openModal({
130
+ uri,
131
+ chains: [
132
+ `${TEZOS_PLACEHOLDER}:${MAINNET_CHAINID}`,
133
+ `${TEZOS_PLACEHOLDER}:${GHOSTNET_CHAINID}`,
134
+ ],
135
+ });
120
136
  }
121
137
  this.session = yield approval();
122
138
  }
@@ -124,7 +140,7 @@ class WalletConnect {
124
140
  throw new errors_1.ConnectionFailed(error);
125
141
  }
126
142
  finally {
127
- legacy_modal_1.default.close();
143
+ this.walletConnectModal.closeModal();
128
144
  }
129
145
  this.validateReceivedNamespace(connectParams.permissionScope, this.session.namespaces);
130
146
  this.setDefaultAccountAndNetwork();
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
4
  // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN!
5
5
  exports.VERSION = {
6
- "commitHash": "377d231de2a593315c18d6883adde739af81fcb3",
7
- "version": "21.0.4-beta.2"
6
+ "commitHash": "e6ffa3acf4671ff5b05a0784ea773fc17da95088",
7
+ "version": "21.0.5"
8
8
  };
@@ -1,5 +1,5 @@
1
1
  import Client from '@walletconnect/sign-client';
2
- import QRCodeModal from '@walletconnect/legacy-modal';
2
+ import { WalletConnectModal } from '@walletconnect/modal';
3
3
  import { createTransferOperation, createTransferTicketOperation, createOriginationOperation, createSetDelegateOperation, createIncreasePaidStorageOperation } from '@taquito/taquito';
4
4
  import { getSdkError } from '@walletconnect/utils';
5
5
 
@@ -200,6 +200,8 @@ class PublicKeyRetrievalError extends Error {
200
200
  * @module @taquito/wallet-connect
201
201
  */
202
202
  const TEZOS_PLACEHOLDER = 'tezos';
203
+ const MAINNET_CHAINID = 'mainnet';
204
+ const GHOSTNET_CHAINID = 'ghostnet';
203
205
  /**
204
206
  * @description The `WalletConnect` class implements the `WalletProvider` interface, providing an alternative to `BeaconWallet`.
205
207
  * This package enables dapps built with Taquito to connect to wallets via the WalletConnect/Reown protocol.
@@ -207,8 +209,9 @@ const TEZOS_PLACEHOLDER = 'tezos';
207
209
  * we plan showing a list of available wallets alongside the QR code.
208
210
  */
209
211
  class WalletConnect {
210
- constructor(signClient) {
212
+ constructor(signClient, WalletConnectModal) {
211
213
  this.signClient = signClient;
214
+ this.walletConnectModal = WalletConnectModal;
212
215
  this.signClient.on('session_delete', ({ topic }) => {
213
216
  var _a;
214
217
  if (((_a = this.session) === null || _a === void 0 ? void 0 : _a.topic) === topic) {
@@ -251,8 +254,15 @@ class WalletConnect {
251
254
  */
252
255
  static init(initParams) {
253
256
  return __awaiter(this, void 0, void 0, function* () {
257
+ if (!initParams.projectId) {
258
+ throw new Error('projectId is required');
259
+ }
254
260
  const client = yield Client.init(initParams);
255
- return new WalletConnect(client);
261
+ const walletConnectModal = new WalletConnectModal({
262
+ projectId: initParams.projectId,
263
+ chains: [MAINNET_CHAINID, GHOSTNET_CHAINID],
264
+ });
265
+ return new WalletConnect(client, walletConnectModal);
256
266
  });
257
267
  }
258
268
  /**
@@ -279,7 +289,13 @@ class WalletConnect {
279
289
  pairingTopic: connectParams.pairingTopic,
280
290
  });
281
291
  if (uri) {
282
- QRCodeModal.open(uri, () => { }, { registryUrl: connectParams.registryUrl });
292
+ this.walletConnectModal.openModal({
293
+ uri,
294
+ chains: [
295
+ `${TEZOS_PLACEHOLDER}:${MAINNET_CHAINID}`,
296
+ `${TEZOS_PLACEHOLDER}:${GHOSTNET_CHAINID}`,
297
+ ],
298
+ });
283
299
  }
284
300
  this.session = yield approval();
285
301
  }
@@ -287,7 +303,7 @@ class WalletConnect {
287
303
  throw new ConnectionFailed(error);
288
304
  }
289
305
  finally {
290
- QRCodeModal.close();
306
+ this.walletConnectModal.closeModal();
291
307
  }
292
308
  this.validateReceivedNamespace(connectParams.permissionScope, this.session.namespaces);
293
309
  this.setDefaultAccountAndNetwork();
@@ -1 +1 @@
1
- {"version":3,"file":"taquito-wallet-connect.es6.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"taquito-wallet-connect.es6.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@walletconnect/sign-client'), require('@walletconnect/legacy-modal'), require('@taquito/taquito'), require('@walletconnect/utils')) :
3
- typeof define === 'function' && define.amd ? define(['exports', '@walletconnect/sign-client', '@walletconnect/legacy-modal', '@taquito/taquito', '@walletconnect/utils'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.taquitoWalletConnect = {}, global.Client, global.QRCodeModal, global.taquito, global.utils));
5
- })(this, (function (exports, Client, QRCodeModal, taquito, utils) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@walletconnect/sign-client'), require('@walletconnect/modal'), require('@taquito/taquito'), require('@walletconnect/utils')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', '@walletconnect/sign-client', '@walletconnect/modal', '@taquito/taquito', '@walletconnect/utils'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.taquitoWalletConnect = {}, global.Client, global.modal, global.taquito, global.utils));
5
+ })(this, (function (exports, Client, modal, taquito, utils) { 'use strict';
6
6
 
7
7
  /******************************************************************************
8
8
  Copyright (c) Microsoft Corporation.
@@ -201,6 +201,8 @@
201
201
  * @module @taquito/wallet-connect
202
202
  */
203
203
  const TEZOS_PLACEHOLDER = 'tezos';
204
+ const MAINNET_CHAINID = 'mainnet';
205
+ const GHOSTNET_CHAINID = 'ghostnet';
204
206
  /**
205
207
  * @description The `WalletConnect` class implements the `WalletProvider` interface, providing an alternative to `BeaconWallet`.
206
208
  * This package enables dapps built with Taquito to connect to wallets via the WalletConnect/Reown protocol.
@@ -208,8 +210,9 @@
208
210
  * we plan showing a list of available wallets alongside the QR code.
209
211
  */
210
212
  class WalletConnect {
211
- constructor(signClient) {
213
+ constructor(signClient, WalletConnectModal) {
212
214
  this.signClient = signClient;
215
+ this.walletConnectModal = WalletConnectModal;
213
216
  this.signClient.on('session_delete', ({ topic }) => {
214
217
  var _a;
215
218
  if (((_a = this.session) === null || _a === void 0 ? void 0 : _a.topic) === topic) {
@@ -252,8 +255,15 @@
252
255
  */
253
256
  static init(initParams) {
254
257
  return __awaiter(this, void 0, void 0, function* () {
258
+ if (!initParams.projectId) {
259
+ throw new Error('projectId is required');
260
+ }
255
261
  const client = yield Client.init(initParams);
256
- return new WalletConnect(client);
262
+ const walletConnectModal = new modal.WalletConnectModal({
263
+ projectId: initParams.projectId,
264
+ chains: [MAINNET_CHAINID, GHOSTNET_CHAINID],
265
+ });
266
+ return new WalletConnect(client, walletConnectModal);
257
267
  });
258
268
  }
259
269
  /**
@@ -280,7 +290,13 @@
280
290
  pairingTopic: connectParams.pairingTopic,
281
291
  });
282
292
  if (uri) {
283
- QRCodeModal.open(uri, () => { }, { registryUrl: connectParams.registryUrl });
293
+ this.walletConnectModal.openModal({
294
+ uri,
295
+ chains: [
296
+ `${TEZOS_PLACEHOLDER}:${MAINNET_CHAINID}`,
297
+ `${TEZOS_PLACEHOLDER}:${GHOSTNET_CHAINID}`,
298
+ ],
299
+ });
284
300
  }
285
301
  this.session = yield approval();
286
302
  }
@@ -288,7 +304,7 @@
288
304
  throw new ConnectionFailed(error);
289
305
  }
290
306
  finally {
291
- QRCodeModal.close();
307
+ this.walletConnectModal.closeModal();
292
308
  }
293
309
  this.validateReceivedNamespace(connectParams.permissionScope, this.session.namespaces);
294
310
  this.setDefaultAccountAndNetwork();
@@ -1 +1 @@
1
- {"version":3,"file":"taquito-wallet-connect.umd.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"taquito-wallet-connect.umd.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -4,6 +4,7 @@
4
4
  */
5
5
  import Client from '@walletconnect/sign-client';
6
6
  import { SignClientTypes, SessionTypes, PairingTypes } from '@walletconnect/types';
7
+ import { WalletConnectModal } from '@walletconnect/modal';
7
8
  import { RPCDelegateOperation, RPCOriginationOperation, RPCTransferOperation, RPCTransferTicketOperation, RPCIncreasePaidStorageOperation, WalletDelegateParams, WalletOriginateParams, WalletProvider, WalletTransferParams, WalletTransferTicketParams, WalletStakeParams, WalletUnstakeParams, WalletFinalizeUnstakeParams, WalletIncreasePaidStorageParams } from '@taquito/taquito';
8
9
  import { NetworkType, OperationParams, PermissionScopeParam } from './types';
9
10
  export { SignClientTypes, PairingTypes };
@@ -20,7 +21,8 @@ export declare class WalletConnect implements WalletProvider {
20
21
  private session;
21
22
  private activeAccount;
22
23
  private activeNetwork;
23
- constructor(signClient: Client);
24
+ private walletConnectModal;
25
+ constructor(signClient: Client, WalletConnectModal: WalletConnectModal);
24
26
  /**
25
27
  * @description Initialize a WalletConnect provider
26
28
  * (Initialize a WalletConnect client with persisted storage and a network connection)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taquito/wallet-connect",
3
- "version": "21.0.4-beta.2",
3
+ "version": "21.0.5",
4
4
  "description": "Walletconnect provider",
5
5
  "keywords": [
6
6
  "tezos",
@@ -66,8 +66,8 @@
66
66
  ]
67
67
  },
68
68
  "dependencies": {
69
- "@taquito/taquito": "^21.0.4-beta.2",
70
- "@walletconnect/legacy-modal": "^2.0.0",
69
+ "@taquito/taquito": "^21.0.5",
70
+ "@walletconnect/modal": "^2.7.0",
71
71
  "@walletconnect/sign-client": "^2.16.2",
72
72
  "@walletconnect/types": "^2.16.2",
73
73
  "@walletconnect/utils": "^2.16.2"
@@ -102,5 +102,5 @@
102
102
  "ts-toolbelt": "^9.6.0",
103
103
  "typescript": "~5.5.4"
104
104
  },
105
- "gitHead": "38d2c3ee738ba7cb16afbe8392df9d698ba3f5af"
105
+ "gitHead": "e2bb40c0569637beafd536de2520244fb6cd5541"
106
106
  }