@taquito/beacon-wallet 19.2.1-beta.2 → 19.2.1

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,9 @@ 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
+ this.client.subscribeToEvent(beacon_dapp_1.BeaconEvent.ACTIVE_ACCOUNT_SET, (data) => __awaiter(this, void 0, void 0, function* () {
32
+ this.account = data;
33
+ }));
31
34
  }
32
35
  validateRequiredScopesOrFail(permissionScopes, requiredScopes) {
33
36
  const mandatoryScope = new Set(requiredScopes);
@@ -47,21 +50,19 @@ class BeaconWallet {
47
50
  }
48
51
  getPKH() {
49
52
  return __awaiter(this, void 0, void 0, function* () {
50
- const account = yield this.client.getActiveAccount();
51
- if (!account) {
53
+ if (!this.account) {
52
54
  throw new errors_1.BeaconWalletNotInitialized();
53
55
  }
54
- return account.address;
56
+ return this.account.address;
55
57
  });
56
58
  }
57
59
  getPK() {
58
60
  var _a;
59
61
  return __awaiter(this, void 0, void 0, function* () {
60
- const account = yield this.client.getActiveAccount();
61
- if (!account) {
62
+ if (!this.account) {
62
63
  throw new errors_1.BeaconWalletNotInitialized();
63
64
  }
64
- return (_a = account.publicKey) !== null && _a !== void 0 ? _a : '';
65
+ return (_a = this.account.publicKey) !== null && _a !== void 0 ? _a : '';
65
66
  });
66
67
  }
67
68
  mapTransferParamsToWalletParams(params) {
@@ -149,11 +150,10 @@ class BeaconWallet {
149
150
  }
150
151
  sendOperations(params) {
151
152
  return __awaiter(this, void 0, void 0, function* () {
152
- const account = yield this.client.getActiveAccount();
153
- if (!account) {
153
+ if (!this.account) {
154
154
  throw new errors_1.BeaconWalletNotInitialized();
155
155
  }
156
- const permissions = account.scopes;
156
+ const permissions = this.account.scopes;
157
157
  this.validateRequiredScopesOrFail(permissions, [beacon_dapp_1.PermissionScope.OPERATION_REQUEST]);
158
158
  const { transactionHash } = yield this.client.requestOperation({ operationDetails: params });
159
159
  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": "06c78f51d36ac42cd51e4fc747ebceb5df3cd19b",
7
- "version": "19.2.1-beta.2"
6
+ "commitHash": "2e05f6f865be17a1b367b284542b24ffa9823271",
7
+ "version": "19.2.1"
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": "06c78f51d36ac42cd51e4fc747ebceb5df3cd19b",
67
- "version": "19.2.1-beta.2"
66
+ "commitHash": "2e05f6f865be17a1b367b284542b24ffa9823271",
67
+ "version": "19.2.1"
68
68
  };
69
69
 
70
70
  /**
@@ -74,6 +74,9 @@ const VERSION = {
74
74
  class BeaconWallet {
75
75
  constructor(options) {
76
76
  this.client = getDAppClientInstance(options);
77
+ this.client.subscribeToEvent(BeaconEvent.ACTIVE_ACCOUNT_SET, (data) => __awaiter(this, void 0, void 0, function* () {
78
+ this.account = data;
79
+ }));
77
80
  }
78
81
  validateRequiredScopesOrFail(permissionScopes, requiredScopes) {
79
82
  const mandatoryScope = new Set(requiredScopes);
@@ -93,21 +96,19 @@ class BeaconWallet {
93
96
  }
94
97
  getPKH() {
95
98
  return __awaiter(this, void 0, void 0, function* () {
96
- const account = yield this.client.getActiveAccount();
97
- if (!account) {
99
+ if (!this.account) {
98
100
  throw new BeaconWalletNotInitialized();
99
101
  }
100
- return account.address;
102
+ return this.account.address;
101
103
  });
102
104
  }
103
105
  getPK() {
104
106
  var _a;
105
107
  return __awaiter(this, void 0, void 0, function* () {
106
- const account = yield this.client.getActiveAccount();
107
- if (!account) {
108
+ if (!this.account) {
108
109
  throw new BeaconWalletNotInitialized();
109
110
  }
110
- return (_a = account.publicKey) !== null && _a !== void 0 ? _a : '';
111
+ return (_a = this.account.publicKey) !== null && _a !== void 0 ? _a : '';
111
112
  });
112
113
  }
113
114
  mapTransferParamsToWalletParams(params) {
@@ -195,11 +196,10 @@ class BeaconWallet {
195
196
  }
196
197
  sendOperations(params) {
197
198
  return __awaiter(this, void 0, void 0, function* () {
198
- const account = yield this.client.getActiveAccount();
199
- if (!account) {
199
+ if (!this.account) {
200
200
  throw new BeaconWalletNotInitialized();
201
201
  }
202
- const permissions = account.scopes;
202
+ const permissions = this.account.scopes;
203
203
  this.validateRequiredScopesOrFail(permissions, [PermissionScope.OPERATION_REQUEST]);
204
204
  const { transactionHash } = yield this.client.requestOperation({ operationDetails: params });
205
205
  return transactionHash;
@@ -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": "06c78f51d36ac42cd51e4fc747ebceb5df3cd19b",
67
- "version": "19.2.1-beta.2"
66
+ "commitHash": "2e05f6f865be17a1b367b284542b24ffa9823271",
67
+ "version": "19.2.1"
68
68
  };
69
69
 
70
70
  /**
@@ -74,6 +74,9 @@
74
74
  class BeaconWallet {
75
75
  constructor(options) {
76
76
  this.client = beaconDapp.getDAppClientInstance(options);
77
+ this.client.subscribeToEvent(beaconDapp.BeaconEvent.ACTIVE_ACCOUNT_SET, (data) => __awaiter(this, void 0, void 0, function* () {
78
+ this.account = data;
79
+ }));
77
80
  }
78
81
  validateRequiredScopesOrFail(permissionScopes, requiredScopes) {
79
82
  const mandatoryScope = new Set(requiredScopes);
@@ -93,21 +96,19 @@
93
96
  }
94
97
  getPKH() {
95
98
  return __awaiter(this, void 0, void 0, function* () {
96
- const account = yield this.client.getActiveAccount();
97
- if (!account) {
99
+ if (!this.account) {
98
100
  throw new BeaconWalletNotInitialized();
99
101
  }
100
- return account.address;
102
+ return this.account.address;
101
103
  });
102
104
  }
103
105
  getPK() {
104
106
  var _a;
105
107
  return __awaiter(this, void 0, void 0, function* () {
106
- const account = yield this.client.getActiveAccount();
107
- if (!account) {
108
+ if (!this.account) {
108
109
  throw new BeaconWalletNotInitialized();
109
110
  }
110
- return (_a = account.publicKey) !== null && _a !== void 0 ? _a : '';
111
+ return (_a = this.account.publicKey) !== null && _a !== void 0 ? _a : '';
111
112
  });
112
113
  }
113
114
  mapTransferParamsToWalletParams(params) {
@@ -195,11 +196,10 @@
195
196
  }
196
197
  sendOperations(params) {
197
198
  return __awaiter(this, void 0, void 0, function* () {
198
- const account = yield this.client.getActiveAccount();
199
- if (!account) {
199
+ if (!this.account) {
200
200
  throw new BeaconWalletNotInitialized();
201
201
  }
202
- const permissions = account.scopes;
202
+ const permissions = this.account.scopes;
203
203
  this.validateRequiredScopesOrFail(permissions, [beaconDapp.PermissionScope.OPERATION_REQUEST]);
204
204
  const { transactionHash } = yield this.client.requestOperation({ operationDetails: params });
205
205
  return transactionHash;
@@ -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 } 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": "19.2.1-beta.2",
3
+ "version": "19.2.1",
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.2-beta.4",
71
- "@taquito/core": "^19.2.1-beta.2",
72
- "@taquito/taquito": "^19.2.1-beta.2"
70
+ "@airgap/beacon-dapp": "^4.2.2",
71
+ "@taquito/core": "^19.2.1",
72
+ "@taquito/taquito": "^19.2.1"
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": "5b9e3029baaef495f4ae8377dfb82dcd225c26f9"
106
+ "gitHead": "3b9dbecb374ffd8136f494ae0817b2d1d530f8d9"
107
107
  }