@taquito/beacon-wallet 20.0.0-beta.0 → 20.0.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.
@@ -28,6 +28,10 @@ Object.defineProperty(exports, "MissingRequiredScopes", { enumerable: true, get:
28
28
  class BeaconWallet {
29
29
  constructor(options) {
30
30
  this.client = (0, beacon_dapp_1.getDAppClientInstance)(options);
31
+ // Subscribe to the active account set event, this will update when there are account changes happening in the dApp
32
+ this.client.subscribeToEvent(beacon_dapp_1.BeaconEvent.ACTIVE_ACCOUNT_SET, (data) => __awaiter(this, void 0, void 0, function* () {
33
+ this.account = data;
34
+ }));
31
35
  }
32
36
  validateRequiredScopesOrFail(permissionScopes, requiredScopes) {
33
37
  const mandatoryScope = new Set(requiredScopes);
@@ -47,21 +51,19 @@ class BeaconWallet {
47
51
  }
48
52
  getPKH() {
49
53
  return __awaiter(this, void 0, void 0, function* () {
50
- const account = yield this.client.getActiveAccount();
51
- if (!account) {
54
+ if (!this.account) {
52
55
  throw new errors_1.BeaconWalletNotInitialized();
53
56
  }
54
- return account.address;
57
+ return this.account.address;
55
58
  });
56
59
  }
57
60
  getPK() {
58
61
  var _a;
59
62
  return __awaiter(this, void 0, void 0, function* () {
60
- const account = yield this.client.getActiveAccount();
61
- if (!account) {
63
+ if (!this.account) {
62
64
  throw new errors_1.BeaconWalletNotInitialized();
63
65
  }
64
- return (_a = account.publicKey) !== null && _a !== void 0 ? _a : '';
66
+ return (_a = this.account.publicKey) !== null && _a !== void 0 ? _a : '';
65
67
  });
66
68
  }
67
69
  mapTransferParamsToWalletParams(params) {
@@ -191,11 +193,10 @@ class BeaconWallet {
191
193
  }
192
194
  sendOperations(params) {
193
195
  return __awaiter(this, void 0, void 0, function* () {
194
- const account = yield this.client.getActiveAccount();
195
- if (!account) {
196
+ if (!this.account) {
196
197
  throw new errors_1.BeaconWalletNotInitialized();
197
198
  }
198
- const permissions = account.scopes;
199
+ const permissions = this.account.scopes;
199
200
  this.validateRequiredScopesOrFail(permissions, [beacon_dapp_1.PermissionScope.OPERATION_REQUEST]);
200
201
  const { transactionHash } = yield this.client.requestOperation({ operationDetails: params });
201
202
  return transactionHash;
@@ -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": "0ef631853ccfda5c5faed584f16069f34085817e",
7
- "version": "20.0.0-beta.0"
6
+ "commitHash": "45fea4a361f29598063e448574800220c4687001",
7
+ "version": "20.0.0"
8
8
  };
@@ -1,4 +1,4 @@
1
- import { getDAppClientInstance, SigningType, PermissionScope } from '@airgap/beacon-dapp';
1
+ import { getDAppClientInstance, BeaconEvent, SigningType, PermissionScope } from '@airgap/beacon-dapp';
2
2
  import { PermissionDeniedError, UnsupportedActionError } from '@taquito/core';
3
3
  import toBuffer from 'typedarray-to-buffer';
4
4
  import { createTransferOperation, createIncreasePaidStorageOperation, createOriginationOperation, createSetDelegateOperation } from '@taquito/taquito';
@@ -63,8 +63,8 @@ class MissingRequiredScopes extends PermissionDeniedError {
63
63
 
64
64
  // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN!
65
65
  const VERSION = {
66
- "commitHash": "0ef631853ccfda5c5faed584f16069f34085817e",
67
- "version": "20.0.0-beta.0"
66
+ "commitHash": "45fea4a361f29598063e448574800220c4687001",
67
+ "version": "20.0.0"
68
68
  };
69
69
 
70
70
  /**
@@ -74,6 +74,10 @@ const VERSION = {
74
74
  class BeaconWallet {
75
75
  constructor(options) {
76
76
  this.client = getDAppClientInstance(options);
77
+ // Subscribe to the active account set event, this will update when there are account changes happening in the dApp
78
+ this.client.subscribeToEvent(BeaconEvent.ACTIVE_ACCOUNT_SET, (data) => __awaiter(this, void 0, void 0, function* () {
79
+ this.account = data;
80
+ }));
77
81
  }
78
82
  validateRequiredScopesOrFail(permissionScopes, requiredScopes) {
79
83
  const mandatoryScope = new Set(requiredScopes);
@@ -93,21 +97,19 @@ class BeaconWallet {
93
97
  }
94
98
  getPKH() {
95
99
  return __awaiter(this, void 0, void 0, function* () {
96
- const account = yield this.client.getActiveAccount();
97
- if (!account) {
100
+ if (!this.account) {
98
101
  throw new BeaconWalletNotInitialized();
99
102
  }
100
- return account.address;
103
+ return this.account.address;
101
104
  });
102
105
  }
103
106
  getPK() {
104
107
  var _a;
105
108
  return __awaiter(this, void 0, void 0, function* () {
106
- const account = yield this.client.getActiveAccount();
107
- if (!account) {
109
+ if (!this.account) {
108
110
  throw new BeaconWalletNotInitialized();
109
111
  }
110
- return (_a = account.publicKey) !== null && _a !== void 0 ? _a : '';
112
+ return (_a = this.account.publicKey) !== null && _a !== void 0 ? _a : '';
111
113
  });
112
114
  }
113
115
  mapTransferParamsToWalletParams(params) {
@@ -237,11 +239,10 @@ class BeaconWallet {
237
239
  }
238
240
  sendOperations(params) {
239
241
  return __awaiter(this, void 0, void 0, function* () {
240
- const account = yield this.client.getActiveAccount();
241
- if (!account) {
242
+ if (!this.account) {
242
243
  throw new BeaconWalletNotInitialized();
243
244
  }
244
- const permissions = account.scopes;
245
+ const permissions = this.account.scopes;
245
246
  this.validateRequiredScopesOrFail(permissions, [PermissionScope.OPERATION_REQUEST]);
246
247
  const { transactionHash } = yield this.client.requestOperation({ operationDetails: params });
247
248
  return transactionHash;
@@ -1 +1 @@
1
- {"version":3,"file":"taquito-beacon-wallet.es6.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"taquito-beacon-wallet.es6.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -63,8 +63,8 @@
63
63
 
64
64
  // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN!
65
65
  const VERSION = {
66
- "commitHash": "0ef631853ccfda5c5faed584f16069f34085817e",
67
- "version": "20.0.0-beta.0"
66
+ "commitHash": "45fea4a361f29598063e448574800220c4687001",
67
+ "version": "20.0.0"
68
68
  };
69
69
 
70
70
  /**
@@ -74,6 +74,10 @@
74
74
  class BeaconWallet {
75
75
  constructor(options) {
76
76
  this.client = beaconDapp.getDAppClientInstance(options);
77
+ // Subscribe to the active account set event, this will update when there are account changes happening in the dApp
78
+ this.client.subscribeToEvent(beaconDapp.BeaconEvent.ACTIVE_ACCOUNT_SET, (data) => __awaiter(this, void 0, void 0, function* () {
79
+ this.account = data;
80
+ }));
77
81
  }
78
82
  validateRequiredScopesOrFail(permissionScopes, requiredScopes) {
79
83
  const mandatoryScope = new Set(requiredScopes);
@@ -93,21 +97,19 @@
93
97
  }
94
98
  getPKH() {
95
99
  return __awaiter(this, void 0, void 0, function* () {
96
- const account = yield this.client.getActiveAccount();
97
- if (!account) {
100
+ if (!this.account) {
98
101
  throw new BeaconWalletNotInitialized();
99
102
  }
100
- return account.address;
103
+ return this.account.address;
101
104
  });
102
105
  }
103
106
  getPK() {
104
107
  var _a;
105
108
  return __awaiter(this, void 0, void 0, function* () {
106
- const account = yield this.client.getActiveAccount();
107
- if (!account) {
109
+ if (!this.account) {
108
110
  throw new BeaconWalletNotInitialized();
109
111
  }
110
- return (_a = account.publicKey) !== null && _a !== void 0 ? _a : '';
112
+ return (_a = this.account.publicKey) !== null && _a !== void 0 ? _a : '';
111
113
  });
112
114
  }
113
115
  mapTransferParamsToWalletParams(params) {
@@ -237,11 +239,10 @@
237
239
  }
238
240
  sendOperations(params) {
239
241
  return __awaiter(this, void 0, void 0, function* () {
240
- const account = yield this.client.getActiveAccount();
241
- if (!account) {
242
+ if (!this.account) {
242
243
  throw new BeaconWalletNotInitialized();
243
244
  }
244
- const permissions = account.scopes;
245
+ const permissions = this.account.scopes;
245
246
  this.validateRequiredScopesOrFail(permissions, [beaconDapp.PermissionScope.OPERATION_REQUEST]);
246
247
  const { transactionHash } = yield this.client.requestOperation({ operationDetails: params });
247
248
  return transactionHash;
@@ -1 +1 @@
1
- {"version":3,"file":"taquito-beacon-wallet.umd.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"taquito-beacon-wallet.umd.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -2,12 +2,13 @@
2
2
  * @packageDocumentation
3
3
  * @module @taquito/beacon-wallet
4
4
  */
5
- import { DAppClient, DAppClientOptions, RequestPermissionInput } from '@airgap/beacon-dapp';
5
+ import { DAppClient, DAppClientOptions, RequestPermissionInput, AccountInfo } from '@airgap/beacon-dapp';
6
6
  import { WalletDelegateParams, WalletIncreasePaidStorageParams, WalletOriginateParams, WalletProvider, WalletTransferParams, WalletStakeParams, WalletUnstakeParams, WalletFinalizeUnstakeParams } from '@taquito/taquito';
7
7
  export { VERSION } from './version';
8
8
  export { BeaconWalletNotInitialized, MissingRequiredScopes } from './errors';
9
9
  export declare class BeaconWallet implements WalletProvider {
10
10
  client: DAppClient;
11
+ account: AccountInfo | undefined;
11
12
  constructor(options: DAppClientOptions);
12
13
  private validateRequiredScopesOrFail;
13
14
  requestPermissions(request?: RequestPermissionInput): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taquito/beacon-wallet",
3
- "version": "20.0.0-beta.0",
3
+ "version": "20.0.0",
4
4
  "description": "Beacon wallet provider",
5
5
  "keywords": [
6
6
  "tezos",
@@ -67,9 +67,9 @@
67
67
  ]
68
68
  },
69
69
  "dependencies": {
70
- "@airgap/beacon-dapp": "^4.2.1",
71
- "@taquito/core": "^20.0.0-beta.0",
72
- "@taquito/taquito": "^20.0.0-beta.0"
70
+ "@airgap/beacon-dapp": "^4.2.2",
71
+ "@taquito/core": "^20.0.0",
72
+ "@taquito/taquito": "^20.0.0"
73
73
  },
74
74
  "devDependencies": {
75
75
  "@types/bluebird": "^3.5.40",
@@ -103,5 +103,5 @@
103
103
  "webpack": "^5.89.0",
104
104
  "webpack-cli": "^5.1.4"
105
105
  },
106
- "gitHead": "88980709574468fad5e4e7d63d34e1d71accf550"
106
+ "gitHead": "4871f03155be8dfce81ff24cb45fe0e3049c7646"
107
107
  }