@taquito/beacon-wallet 11.0.2 → 11.2.0-beta-RC.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/dist/lib/taquito-beacon-wallet.js +93 -230
- package/dist/lib/taquito-beacon-wallet.js.map +1 -1
- package/dist/lib/version.js +2 -4
- package/dist/lib/version.js.map +1 -1
- package/dist/taquito-beacon-wallet.es6.js +184 -0
- package/dist/taquito-beacon-wallet.es6.js.map +1 -0
- package/dist/taquito-beacon-wallet.umd.js +96 -237
- package/dist/taquito-beacon-wallet.umd.js.map +1 -1
- package/dist/types/taquito-beacon-wallet.d.ts +3 -4
- package/package.json +23 -24
- package/dist/taquito-beacon-wallet.es5.js +0 -325
- package/dist/taquito-beacon-wallet.es5.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@airgap/beacon-sdk'), require('@taquito/taquito')) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define(['exports', '@airgap/beacon-sdk', '@taquito/taquito'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.taquitoBeaconWallet = {}, global.
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.taquitoBeaconWallet = {}, global.beacon, global.taquito));
|
|
5
5
|
})(this, (function (exports, beaconSdk, taquito) { 'use strict';
|
|
6
6
|
|
|
7
7
|
/*! *****************************************************************************
|
|
@@ -27,220 +27,103 @@
|
|
|
27
27
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
28
28
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
29
29
|
});
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function __generator(thisArg, body) {
|
|
33
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
34
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
35
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
36
|
-
function step(op) {
|
|
37
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
38
|
-
while (_) try {
|
|
39
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
40
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
41
|
-
switch (op[0]) {
|
|
42
|
-
case 0: case 1: t = op; break;
|
|
43
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
44
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
45
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
46
|
-
default:
|
|
47
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
48
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
49
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
50
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
51
|
-
if (t[2]) _.ops.pop();
|
|
52
|
-
_.trys.pop(); continue;
|
|
53
|
-
}
|
|
54
|
-
op = body.call(thisArg, _);
|
|
55
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
56
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function __values(o) {
|
|
61
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
62
|
-
if (m) return m.call(o);
|
|
63
|
-
if (o && typeof o.length === "number") return {
|
|
64
|
-
next: function () {
|
|
65
|
-
if (o && i >= o.length) o = void 0;
|
|
66
|
-
return { value: o && o[i++], done: !o };
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
70
30
|
}
|
|
71
31
|
|
|
72
32
|
// IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN!
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
"
|
|
76
|
-
|
|
77
|
-
};
|
|
78
|
-
/* tslint:enable */
|
|
33
|
+
const VERSION = {
|
|
34
|
+
"commitHash": "e03d983c780c7f96d8291ddd1251ea82f4581858",
|
|
35
|
+
"version": "11.2.0-beta-RC.0"
|
|
36
|
+
};
|
|
79
37
|
|
|
80
38
|
/**
|
|
81
39
|
* @packageDocumentation
|
|
82
40
|
* @module @taquito/beacon-wallet
|
|
83
41
|
*/
|
|
84
|
-
|
|
85
|
-
|
|
42
|
+
class BeaconWalletNotInitialized extends Error {
|
|
43
|
+
constructor() {
|
|
44
|
+
super('You need to initialize BeaconWallet by calling beaconWallet.requestPermissions first');
|
|
86
45
|
this.name = 'BeaconWalletNotInitialized';
|
|
87
|
-
this.message = 'You need to initialize BeaconWallet by calling beaconWallet.requestPermissions first';
|
|
88
46
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
47
|
+
}
|
|
48
|
+
class MissingRequiredScopes extends Error {
|
|
49
|
+
constructor(requiredScopes) {
|
|
50
|
+
super(`Required permissions scopes were not granted: ${requiredScopes.join(',')}`);
|
|
93
51
|
this.requiredScopes = requiredScopes;
|
|
94
52
|
this.name = 'MissingRequiredScopes';
|
|
95
|
-
this.message = "Required permissions scopes were not granted: " + requiredScopes.join(',');
|
|
96
53
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
function BeaconWallet(options) {
|
|
54
|
+
}
|
|
55
|
+
class BeaconWallet {
|
|
56
|
+
constructor(options) {
|
|
101
57
|
this.client = new beaconSdk.DAppClient(options);
|
|
102
58
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
var scope = permissionScopes_1_1.value;
|
|
109
|
-
if (mandatoryScope.has(scope)) {
|
|
110
|
-
mandatoryScope.delete(scope);
|
|
111
|
-
}
|
|
59
|
+
validateRequiredScopesOrFail(permissionScopes, requiredScopes) {
|
|
60
|
+
const mandatoryScope = new Set(requiredScopes);
|
|
61
|
+
for (const scope of permissionScopes) {
|
|
62
|
+
if (mandatoryScope.has(scope)) {
|
|
63
|
+
mandatoryScope.delete(scope);
|
|
112
64
|
}
|
|
113
65
|
}
|
|
114
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
115
|
-
finally {
|
|
116
|
-
try {
|
|
117
|
-
if (permissionScopes_1_1 && !permissionScopes_1_1.done && (_a = permissionScopes_1.return)) _a.call(permissionScopes_1);
|
|
118
|
-
}
|
|
119
|
-
finally { if (e_1) throw e_1.error; }
|
|
120
|
-
}
|
|
121
66
|
if (mandatoryScope.size > 0) {
|
|
122
67
|
throw new MissingRequiredScopes(Array.from(mandatoryScope));
|
|
123
68
|
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
127
|
-
|
|
128
|
-
switch (_a.label) {
|
|
129
|
-
case 0: return [4 /*yield*/, this.client.requestPermissions(request)];
|
|
130
|
-
case 1:
|
|
131
|
-
_a.sent();
|
|
132
|
-
return [2 /*return*/];
|
|
133
|
-
}
|
|
134
|
-
});
|
|
69
|
+
}
|
|
70
|
+
requestPermissions(request) {
|
|
71
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
72
|
+
yield this.client.requestPermissions(request);
|
|
135
73
|
});
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
account = _a.sent();
|
|
145
|
-
if (!account) {
|
|
146
|
-
throw new BeaconWalletNotInitialized();
|
|
147
|
-
}
|
|
148
|
-
return [2 /*return*/, account.address];
|
|
149
|
-
}
|
|
150
|
-
});
|
|
74
|
+
}
|
|
75
|
+
getPKH() {
|
|
76
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
77
|
+
const account = yield this.client.getActiveAccount();
|
|
78
|
+
if (!account) {
|
|
79
|
+
throw new BeaconWalletNotInitialized();
|
|
80
|
+
}
|
|
81
|
+
return account.address;
|
|
151
82
|
});
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
case 3:
|
|
166
|
-
walletParams = _c.sent();
|
|
167
|
-
return [3 /*break*/, 6];
|
|
168
|
-
case 4:
|
|
169
|
-
err_1 = _c.sent();
|
|
170
|
-
return [4 /*yield*/, this.client.hideUI()];
|
|
171
|
-
case 5:
|
|
172
|
-
_c.sent();
|
|
173
|
-
throw err_1;
|
|
174
|
-
case 6:
|
|
175
|
-
_a = this.removeDefaultParams;
|
|
176
|
-
_b = [walletParams];
|
|
177
|
-
return [4 /*yield*/, taquito.createTransferOperation(this.formatParameters(walletParams))];
|
|
178
|
-
case 7: return [2 /*return*/, _a.apply(this, _b.concat([_c.sent()]))];
|
|
179
|
-
}
|
|
180
|
-
});
|
|
83
|
+
}
|
|
84
|
+
mapTransferParamsToWalletParams(params) {
|
|
85
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
86
|
+
let walletParams;
|
|
87
|
+
yield this.client.showPrepare();
|
|
88
|
+
try {
|
|
89
|
+
walletParams = yield params();
|
|
90
|
+
}
|
|
91
|
+
catch (err) {
|
|
92
|
+
yield this.client.hideUI();
|
|
93
|
+
throw err;
|
|
94
|
+
}
|
|
95
|
+
return this.removeDefaultParams(walletParams, yield taquito.createTransferOperation(this.formatParameters(walletParams)));
|
|
181
96
|
});
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
case 3:
|
|
196
|
-
walletParams = _c.sent();
|
|
197
|
-
return [3 /*break*/, 6];
|
|
198
|
-
case 4:
|
|
199
|
-
err_2 = _c.sent();
|
|
200
|
-
return [4 /*yield*/, this.client.hideUI()];
|
|
201
|
-
case 5:
|
|
202
|
-
_c.sent();
|
|
203
|
-
throw err_2;
|
|
204
|
-
case 6:
|
|
205
|
-
_a = this.removeDefaultParams;
|
|
206
|
-
_b = [walletParams];
|
|
207
|
-
return [4 /*yield*/, taquito.createOriginationOperation(this.formatParameters(walletParams))];
|
|
208
|
-
case 7: return [2 /*return*/, _a.apply(this, _b.concat([_c.sent()]))];
|
|
209
|
-
}
|
|
210
|
-
});
|
|
97
|
+
}
|
|
98
|
+
mapOriginateParamsToWalletParams(params) {
|
|
99
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
100
|
+
let walletParams;
|
|
101
|
+
yield this.client.showPrepare();
|
|
102
|
+
try {
|
|
103
|
+
walletParams = yield params();
|
|
104
|
+
}
|
|
105
|
+
catch (err) {
|
|
106
|
+
yield this.client.hideUI();
|
|
107
|
+
throw err;
|
|
108
|
+
}
|
|
109
|
+
return this.removeDefaultParams(walletParams, yield taquito.createOriginationOperation(this.formatParameters(walletParams)));
|
|
211
110
|
});
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
case 3:
|
|
226
|
-
walletParams = _c.sent();
|
|
227
|
-
return [3 /*break*/, 6];
|
|
228
|
-
case 4:
|
|
229
|
-
err_3 = _c.sent();
|
|
230
|
-
return [4 /*yield*/, this.client.hideUI()];
|
|
231
|
-
case 5:
|
|
232
|
-
_c.sent();
|
|
233
|
-
throw err_3;
|
|
234
|
-
case 6:
|
|
235
|
-
_a = this.removeDefaultParams;
|
|
236
|
-
_b = [walletParams];
|
|
237
|
-
return [4 /*yield*/, taquito.createSetDelegateOperation(this.formatParameters(walletParams))];
|
|
238
|
-
case 7: return [2 /*return*/, _a.apply(this, _b.concat([_c.sent()]))];
|
|
239
|
-
}
|
|
240
|
-
});
|
|
111
|
+
}
|
|
112
|
+
mapDelegateParamsToWalletParams(params) {
|
|
113
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
114
|
+
let walletParams;
|
|
115
|
+
yield this.client.showPrepare();
|
|
116
|
+
try {
|
|
117
|
+
walletParams = yield params();
|
|
118
|
+
}
|
|
119
|
+
catch (err) {
|
|
120
|
+
yield this.client.hideUI();
|
|
121
|
+
throw err;
|
|
122
|
+
}
|
|
123
|
+
return this.removeDefaultParams(walletParams, yield taquito.createSetDelegateOperation(this.formatParameters(walletParams)));
|
|
241
124
|
});
|
|
242
|
-
}
|
|
243
|
-
|
|
125
|
+
}
|
|
126
|
+
formatParameters(params) {
|
|
244
127
|
if (params.fee) {
|
|
245
128
|
params.fee = params.fee.toString();
|
|
246
129
|
}
|
|
@@ -251,8 +134,8 @@
|
|
|
251
134
|
params.gasLimit = params.gasLimit.toString();
|
|
252
135
|
}
|
|
253
136
|
return params;
|
|
254
|
-
}
|
|
255
|
-
|
|
137
|
+
}
|
|
138
|
+
removeDefaultParams(params, operatedParams) {
|
|
256
139
|
// If fee, storageLimit or gasLimit is undefined by user
|
|
257
140
|
// in case of beacon wallet, dont override it by
|
|
258
141
|
// defaults.
|
|
@@ -266,63 +149,39 @@
|
|
|
266
149
|
delete operatedParams.gas_limit;
|
|
267
150
|
}
|
|
268
151
|
return operatedParams;
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
}
|
|
281
|
-
permissions = account.scopes;
|
|
282
|
-
this.validateRequiredScopesOrFail(permissions, [beaconSdk.PermissionScope.OPERATION_REQUEST]);
|
|
283
|
-
return [4 /*yield*/, this.client.requestOperation({ operationDetails: params })];
|
|
284
|
-
case 2:
|
|
285
|
-
transactionHash = (_a.sent()).transactionHash;
|
|
286
|
-
return [2 /*return*/, transactionHash];
|
|
287
|
-
}
|
|
288
|
-
});
|
|
152
|
+
}
|
|
153
|
+
sendOperations(params) {
|
|
154
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
155
|
+
const account = yield this.client.getActiveAccount();
|
|
156
|
+
if (!account) {
|
|
157
|
+
throw new BeaconWalletNotInitialized();
|
|
158
|
+
}
|
|
159
|
+
const permissions = account.scopes;
|
|
160
|
+
this.validateRequiredScopesOrFail(permissions, [beaconSdk.PermissionScope.OPERATION_REQUEST]);
|
|
161
|
+
const { transactionHash } = yield this.client.requestOperation({ operationDetails: params });
|
|
162
|
+
return transactionHash;
|
|
289
163
|
});
|
|
290
|
-
}
|
|
164
|
+
}
|
|
291
165
|
/**
|
|
292
166
|
*
|
|
293
167
|
* @description Removes all beacon values from the storage. After using this method, this instance is no longer usable.
|
|
294
168
|
* You will have to instanciate a new BeaconWallet.
|
|
295
169
|
*/
|
|
296
|
-
|
|
297
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
298
|
-
|
|
299
|
-
switch (_a.label) {
|
|
300
|
-
case 0: return [4 /*yield*/, this.client.destroy()];
|
|
301
|
-
case 1:
|
|
302
|
-
_a.sent();
|
|
303
|
-
return [2 /*return*/];
|
|
304
|
-
}
|
|
305
|
-
});
|
|
170
|
+
disconnect() {
|
|
171
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
172
|
+
yield this.client.destroy();
|
|
306
173
|
});
|
|
307
|
-
}
|
|
174
|
+
}
|
|
308
175
|
/**
|
|
309
176
|
*
|
|
310
177
|
* @description This method removes the active account from local storage by setting it to undefined.
|
|
311
178
|
*/
|
|
312
|
-
|
|
313
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
314
|
-
|
|
315
|
-
switch (_a.label) {
|
|
316
|
-
case 0: return [4 /*yield*/, this.client.setActiveAccount()];
|
|
317
|
-
case 1:
|
|
318
|
-
_a.sent();
|
|
319
|
-
return [2 /*return*/];
|
|
320
|
-
}
|
|
321
|
-
});
|
|
179
|
+
clearActiveAccount() {
|
|
180
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
181
|
+
yield this.client.setActiveAccount();
|
|
322
182
|
});
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
}());
|
|
183
|
+
}
|
|
184
|
+
}
|
|
326
185
|
|
|
327
186
|
exports.BeaconWallet = BeaconWallet;
|
|
328
187
|
exports.BeaconWalletNotInitialized = BeaconWalletNotInitialized;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taquito-beacon-wallet.umd.js","sources":["../src/version.ts","../src/taquito-beacon-wallet.ts"],"sourcesContent":["\n// IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN!\
|
|
1
|
+
{"version":3,"file":"taquito-beacon-wallet.umd.js","sources":["../src/version.ts","../src/taquito-beacon-wallet.ts"],"sourcesContent":["\n// IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN!\nexport const VERSION = {\n \"commitHash\": \"e03d983c780c7f96d8291ddd1251ea82f4581858\",\n \"version\": \"11.2.0-beta-RC.0\"\n};\n","/**\n * @packageDocumentation\n * @module @taquito/beacon-wallet\n */\n\nimport {\n DAppClient,\n DAppClientOptions,\n RequestPermissionInput,\n PermissionScope,\n} from '@airgap/beacon-sdk';\n\nimport {\n createOriginationOperation,\n createSetDelegateOperation,\n createTransferOperation,\n WalletDelegateParams,\n WalletOriginateParams,\n WalletProvider,\n WalletTransferParams,\n} from '@taquito/taquito';\n\nexport { VERSION } from './version';\n\nexport class BeaconWalletNotInitialized extends Error {\n name = 'BeaconWalletNotInitialized';\n\n constructor() {\n super('You need to initialize BeaconWallet by calling beaconWallet.requestPermissions first');\n }\n}\n\nexport class MissingRequiredScopes extends Error {\n name = 'MissingRequiredScopes';\n\n constructor(public requiredScopes: PermissionScope[]) {\n super(`Required permissions scopes were not granted: ${requiredScopes.join(',')}`);\n }\n}\n\nexport class BeaconWallet implements WalletProvider {\n public client: DAppClient;\n\n constructor(options: DAppClientOptions) {\n this.client = new DAppClient(options);\n }\n\n private validateRequiredScopesOrFail(\n permissionScopes: PermissionScope[],\n requiredScopes: PermissionScope[]\n ) {\n const mandatoryScope = new Set(requiredScopes);\n\n for (const scope of permissionScopes) {\n if (mandatoryScope.has(scope)) {\n mandatoryScope.delete(scope);\n }\n }\n\n if (mandatoryScope.size > 0) {\n throw new MissingRequiredScopes(Array.from(mandatoryScope));\n }\n }\n\n async requestPermissions(request?: RequestPermissionInput) {\n await this.client.requestPermissions(request);\n }\n\n async getPKH() {\n const account = await this.client.getActiveAccount();\n if (!account) {\n throw new BeaconWalletNotInitialized();\n }\n return account.address;\n }\n\n async mapTransferParamsToWalletParams(params: () => Promise<WalletTransferParams>) {\n let walletParams: WalletTransferParams;\n await this.client.showPrepare();\n try {\n walletParams = await params();\n } catch (err) {\n await this.client.hideUI();\n throw err;\n }\n return this.removeDefaultParams(\n walletParams,\n await createTransferOperation(this.formatParameters(walletParams))\n );\n }\n\n async mapOriginateParamsToWalletParams(params: () => Promise<WalletOriginateParams>) {\n let walletParams: WalletOriginateParams;\n await this.client.showPrepare();\n try {\n walletParams = await params();\n } catch (err) {\n await this.client.hideUI();\n throw err;\n }\n return this.removeDefaultParams(\n walletParams,\n await createOriginationOperation(this.formatParameters(walletParams))\n );\n }\n\n async mapDelegateParamsToWalletParams(params: () => Promise<WalletDelegateParams>) {\n let walletParams: WalletDelegateParams;\n await this.client.showPrepare();\n try {\n walletParams = await params();\n } catch (err) {\n await this.client.hideUI();\n throw err;\n }\n return this.removeDefaultParams(\n walletParams,\n await createSetDelegateOperation(this.formatParameters(walletParams))\n );\n }\n\n formatParameters(params: any) {\n if (params.fee) {\n params.fee = params.fee.toString();\n }\n if (params.storageLimit) {\n params.storageLimit = params.storageLimit.toString();\n }\n if (params.gasLimit) {\n params.gasLimit = params.gasLimit.toString();\n }\n return params;\n }\n\n removeDefaultParams(\n params: WalletTransferParams | WalletOriginateParams | WalletDelegateParams,\n operatedParams: any\n ) {\n // If fee, storageLimit or gasLimit is undefined by user\n // in case of beacon wallet, dont override it by\n // defaults.\n if (!params.fee) {\n delete operatedParams.fee;\n }\n if (!params.storageLimit) {\n delete operatedParams.storage_limit;\n }\n if (!params.gasLimit) {\n delete operatedParams.gas_limit;\n }\n return operatedParams;\n }\n\n async sendOperations(params: any[]) {\n const account = await this.client.getActiveAccount();\n if (!account) {\n throw new BeaconWalletNotInitialized();\n }\n const permissions = account.scopes;\n this.validateRequiredScopesOrFail(permissions, [PermissionScope.OPERATION_REQUEST]);\n\n const { transactionHash } = await this.client.requestOperation({ operationDetails: params });\n return transactionHash;\n }\n\n /**\n *\n * @description Removes all beacon values from the storage. After using this method, this instance is no longer usable.\n * You will have to instanciate a new BeaconWallet.\n */\n async disconnect() {\n await this.client.destroy();\n }\n\n /**\n *\n * @description This method removes the active account from local storage by setting it to undefined.\n */\n async clearActiveAccount() {\n await this.client.setActiveAccount();\n }\n}\n"],"names":["DAppClient","createTransferOperation","createOriginationOperation","createSetDelegateOperation","PermissionScope"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IACA;UACa,OAAO,GAAG;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C,CAAC;gBAC7F,OAAO,eAAe,CAAC;aACxB;SAAA;;;;;;QAOK,UAAU;;gBACd,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;aAC7B;SAAA;;;;;QAMK,kBAAkB;;gBACtB,MAAM,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAAE,CAAC;aACtC;SAAA;;;;;;;;;;;;;;"}
|
|
@@ -5,14 +5,13 @@
|
|
|
5
5
|
import { DAppClient, DAppClientOptions, RequestPermissionInput, PermissionScope } from '@airgap/beacon-sdk';
|
|
6
6
|
import { WalletDelegateParams, WalletOriginateParams, WalletProvider, WalletTransferParams } from '@taquito/taquito';
|
|
7
7
|
export { VERSION } from './version';
|
|
8
|
-
export declare class BeaconWalletNotInitialized
|
|
8
|
+
export declare class BeaconWalletNotInitialized extends Error {
|
|
9
9
|
name: string;
|
|
10
|
-
|
|
10
|
+
constructor();
|
|
11
11
|
}
|
|
12
|
-
export declare class MissingRequiredScopes
|
|
12
|
+
export declare class MissingRequiredScopes extends Error {
|
|
13
13
|
requiredScopes: PermissionScope[];
|
|
14
14
|
name: string;
|
|
15
|
-
message: string;
|
|
16
15
|
constructor(requiredScopes: PermissionScope[]);
|
|
17
16
|
}
|
|
18
17
|
export declare class BeaconWallet implements WalletProvider {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taquito/beacon-wallet",
|
|
3
|
-
"version": "11.0.
|
|
3
|
+
"version": "11.2.0-beta-RC.0",
|
|
4
4
|
"description": "Beacon wallet provider",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"tezos",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"websocket"
|
|
9
9
|
],
|
|
10
10
|
"main": "dist/taquito-beacon-wallet.umd.js",
|
|
11
|
-
"module": "dist/taquito-beacon-wallet.
|
|
11
|
+
"module": "dist/taquito-beacon-wallet.es6.js",
|
|
12
12
|
"typings": "dist/types/taquito-beacon-wallet.d.ts",
|
|
13
13
|
"files": [
|
|
14
14
|
"signature.json",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"precommit": "lint-staged",
|
|
32
32
|
"prebuild": "rimraf dist",
|
|
33
33
|
"version-stamp": "node ../taquito/version-stamping.js",
|
|
34
|
-
"build": "
|
|
35
|
-
"start": "
|
|
34
|
+
"build": "tsc --project ./tsconfig.prod.json --module commonjs && rollup -c rollup.config.ts ",
|
|
35
|
+
"start": "rollup -c rollup.config.ts -w"
|
|
36
36
|
},
|
|
37
37
|
"lint-staged": {
|
|
38
38
|
"{src,test}/**/*.ts": [
|
|
@@ -61,40 +61,39 @@
|
|
|
61
61
|
]
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@airgap/beacon-sdk": "^2.3.
|
|
65
|
-
"@taquito/taquito": "^11.0.
|
|
66
|
-
"@taquito/utils": "^11.0.2"
|
|
64
|
+
"@airgap/beacon-sdk": "^2.3.9",
|
|
65
|
+
"@taquito/taquito": "^11.2.0-beta-RC.0"
|
|
67
66
|
},
|
|
68
67
|
"devDependencies": {
|
|
69
|
-
"@types/
|
|
68
|
+
"@types/bluebird": "^3.5.36",
|
|
69
|
+
"@types/chrome": "0.0.171",
|
|
70
70
|
"@types/jest": "^26.0.23",
|
|
71
71
|
"@types/libsodium-wrappers": "0.7.8",
|
|
72
|
-
"@types/node": "^
|
|
73
|
-
"@types/ws": "^
|
|
74
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
75
|
-
"@typescript-eslint/parser": "^
|
|
72
|
+
"@types/node": "^17.0.0",
|
|
73
|
+
"@types/ws": "^8.2.2",
|
|
74
|
+
"@typescript-eslint/eslint-plugin": "^5.7.0",
|
|
75
|
+
"@typescript-eslint/parser": "^5.7.0",
|
|
76
76
|
"colors": "^1.4.0",
|
|
77
|
-
"coveralls": "^3.1.
|
|
77
|
+
"coveralls": "^3.1.1",
|
|
78
78
|
"cross-env": "^7.0.3",
|
|
79
|
-
"eslint": "^
|
|
79
|
+
"eslint": "^8.5.0",
|
|
80
80
|
"jest": "^26.6.3",
|
|
81
81
|
"jest-config": "^26.6.3",
|
|
82
|
-
"lint-staged": "^
|
|
82
|
+
"lint-staged": "^12.1.2",
|
|
83
83
|
"lodash.camelcase": "^4.3.0",
|
|
84
|
-
"prettier": "^2.
|
|
85
|
-
"prompt": "^1.
|
|
86
|
-
"replace-in-file": "^6.2
|
|
84
|
+
"prettier": "^2.5.1",
|
|
85
|
+
"prompt": "^1.2.0",
|
|
86
|
+
"replace-in-file": "^6.3.2",
|
|
87
87
|
"rimraf": "^3.0.2",
|
|
88
|
-
"rollup": "^2.
|
|
88
|
+
"rollup": "^2.61.1",
|
|
89
89
|
"rollup-plugin-json": "^4.0.0",
|
|
90
90
|
"rollup-plugin-sourcemaps": "^0.6.3",
|
|
91
|
-
"rollup-plugin-typescript2": "^0.
|
|
91
|
+
"rollup-plugin-typescript2": "^0.31.1",
|
|
92
92
|
"shelljs": "^0.8.4",
|
|
93
93
|
"ts-jest": "^26.4.4",
|
|
94
|
-
"ts-node": "^10.
|
|
95
|
-
"
|
|
96
|
-
"tslint-config-standard": "^9.0.0",
|
|
94
|
+
"ts-node": "^10.4.0",
|
|
95
|
+
"ts-toolbelt": "^9.6.0",
|
|
97
96
|
"typescript": "~4.1.5"
|
|
98
97
|
},
|
|
99
|
-
"gitHead": "
|
|
98
|
+
"gitHead": "7cc9152cdad01bacca4a1b682c7cb0a33a24f544"
|
|
100
99
|
}
|