@airgap/wallet 0.13.45-beta.2 → 0.13.45-beta.3

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.
@@ -1,204 +1,90 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
- return new (P || (P = Promise))(function (resolve, reject) {
20
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
- step((generator = generator.apply(thisArg, _arguments || [])).next());
24
- });
25
- };
26
- var __generator = (this && this.__generator) || function (thisArg, body) {
27
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
- function verb(n) { return function (v) { return step([n, v]); }; }
30
- function step(op) {
31
- if (f) throw new TypeError("Generator is already executing.");
32
- while (_) try {
33
- 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;
34
- if (y = 0, t) op = [op[0] & 2, t.value];
35
- switch (op[0]) {
36
- case 0: case 1: t = op; break;
37
- case 4: _.label++; return { value: op[1], done: false };
38
- case 5: _.label++; y = op[1]; op = [0]; continue;
39
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
- default:
41
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
- if (t[2]) _.ops.pop();
46
- _.trys.pop(); continue;
47
- }
48
- op = body.call(thisArg, _);
49
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
- }
52
- };
53
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
54
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
55
4
  };
56
5
  Object.defineProperty(exports, "__esModule", { value: true });
57
6
  exports.AirGapCoinWallet = exports.TimeInterval = void 0;
58
- var coinlib_core_1 = require("@airgap/coinlib-core");
59
- var bignumber_1 = __importDefault(require("@airgap/coinlib-core/dependencies/src/bignumber.js-9.0.0/bignumber"));
60
- var module_kit_1 = require("@airgap/module-kit");
61
- var protocol_1 = require("@airgap/module-kit/utils/protocol");
62
- var AirGapOnlineWallet_1 = require("./AirGapOnlineWallet");
7
+ const coinlib_core_1 = require("@airgap/coinlib-core");
8
+ const bignumber_1 = __importDefault(require("@airgap/coinlib-core/dependencies/src/bignumber.js-9.0.0/bignumber"));
9
+ const module_kit_1 = require("@airgap/module-kit");
10
+ const protocol_1 = require("@airgap/module-kit/utils/protocol");
11
+ const AirGapOnlineWallet_1 = require("./AirGapOnlineWallet");
63
12
  var TimeInterval;
64
13
  (function (TimeInterval) {
65
14
  TimeInterval["HOURS"] = "24h";
66
15
  TimeInterval["DAYS"] = "7d";
67
16
  TimeInterval["MONTH"] = "30d";
68
- })(TimeInterval = exports.TimeInterval || (exports.TimeInterval = {}));
69
- var AirGapCoinWallet = /** @class */ (function (_super) {
70
- __extends(AirGapCoinWallet, _super);
71
- function AirGapCoinWallet() {
72
- return _super !== null && _super.apply(this, arguments) || this;
73
- }
74
- AirGapCoinWallet.prototype.getCurrentBalance = function () {
17
+ })(TimeInterval || (exports.TimeInterval = TimeInterval = {}));
18
+ class AirGapCoinWallet extends AirGapOnlineWallet_1.AirGapOnlineWallet {
19
+ getCurrentBalance() {
75
20
  return this.currentBalance;
76
- };
77
- AirGapCoinWallet.prototype.setCurrentBalance = function (balance) {
21
+ }
22
+ setCurrentBalance(balance) {
78
23
  this.currentBalance = balance;
79
- };
80
- AirGapCoinWallet.prototype.getCurrentMarketPrice = function () {
24
+ }
25
+ getCurrentMarketPrice() {
81
26
  return this.currentMarketPrice;
82
- };
83
- AirGapCoinWallet.prototype.setCurrentMarketPrice = function (marketPrice) {
84
- return __awaiter(this, void 0, void 0, function () {
85
- var networkType;
86
- return __generator(this, function (_a) {
87
- switch (_a.label) {
88
- case 0: return [4 /*yield*/, this.protocol.getNetwork()];
89
- case 1:
90
- networkType = (_a.sent()).type;
91
- this.currentMarketPrice = networkType === 'mainnet' ? marketPrice : new bignumber_1.default(0);
92
- return [2 /*return*/];
93
- }
94
- });
95
- });
96
- };
97
- AirGapCoinWallet.prototype._synchronize = function () {
98
- return __awaiter(this, void 0, void 0, function () {
99
- var _a, balance, marketPrice;
100
- return __generator(this, function (_b) {
101
- switch (_b.label) {
102
- case 0: return [4 /*yield*/, Promise.all([this.balanceOf(), this.fetchCurrentMarketPrice()])];
103
- case 1:
104
- _a = _b.sent(), balance = _a[0], marketPrice = _a[1];
105
- this.setCurrentBalance(balance);
106
- return [4 /*yield*/, this.setCurrentMarketPrice(marketPrice)];
107
- case 2:
108
- _b.sent();
109
- return [2 /*return*/];
110
- }
111
- });
112
- });
113
- };
114
- AirGapCoinWallet.prototype.reset = function () {
27
+ }
28
+ async setCurrentMarketPrice(marketPrice) {
29
+ const networkType = (await this.protocol.getNetwork()).type;
30
+ this.currentMarketPrice = networkType === 'mainnet' ? marketPrice : new bignumber_1.default(0);
31
+ }
32
+ async _synchronize() {
33
+ const [balance, marketPrice] = await Promise.all([this.balanceOf(), this.fetchCurrentMarketPrice()]);
34
+ this.setCurrentBalance(balance);
35
+ await this.setCurrentMarketPrice(marketPrice);
36
+ }
37
+ reset() {
115
38
  this.currentBalance = undefined;
116
39
  this.currentMarketPrice = undefined;
117
- };
118
- AirGapCoinWallet.prototype.fetchCurrentMarketPrice = function (baseSymbol) {
119
- if (baseSymbol === void 0) { baseSymbol = 'USD'; }
120
- return __awaiter(this, void 0, void 0, function () {
121
- var marketPrice;
122
- return __generator(this, function (_a) {
123
- switch (_a.label) {
124
- case 0: return [4 /*yield*/, this.priceService.getCurrentMarketPrice(this.protocol, baseSymbol)];
125
- case 1:
126
- marketPrice = _a.sent();
127
- return [4 /*yield*/, this.setCurrentMarketPrice(marketPrice)];
128
- case 2:
129
- _a.sent();
130
- return [2 /*return*/, marketPrice];
131
- }
132
- });
133
- });
134
- };
135
- AirGapCoinWallet.prototype.balanceOf = function () {
136
- return __awaiter(this, void 0, void 0, function () {
137
- var protocolMetadata, protocolIdentifier, balance, _a, result;
138
- return __generator(this, function (_b) {
139
- switch (_b.label) {
140
- case 0: return [4 /*yield*/, this.protocol.getMetadata()];
141
- case 1:
142
- protocolMetadata = _b.sent();
143
- protocolIdentifier = protocolMetadata.identifier;
144
- if (!((protocolIdentifier === coinlib_core_1.MainProtocolSymbols.BTC ||
145
- protocolIdentifier === coinlib_core_1.MainProtocolSymbols.BTC_SEGWIT ||
146
- protocolIdentifier === coinlib_core_1.MainProtocolSymbols.BTC_TAPROOT ||
147
- protocolIdentifier === coinlib_core_1.MainProtocolSymbols.GRS) &&
148
- this.publicKey.type === 'xpub' &&
149
- (0, module_kit_1.isBip32Protocol)(this.protocol))) return [3 /*break*/, 3];
150
- return [4 /*yield*/, this.protocol.getBalanceOfPublicKey(this.publicKey)];
151
- case 2:
152
- // TODO: Remove and test
153
- /*
154
- We should remove this if BTC also uses blockbook. (And change the order of the if/else below)
155
-
156
- The problem is that we have addresses cached for all protocols. But blockbook (grs) doesn't allow
157
- multiple addresses to be checked at once, so we need to xPub key there (or we would do 100s of requests).
158
-
159
- We can also not simply change the order of the following if/else, because then it would use the xPub method for
160
- BTC as well, which results in the addresses being derived again, which causes massive lags in the apps.
161
- */
162
- balance = _b.sent();
163
- return [3 /*break*/, 12];
164
- case 3:
165
- if (!((this.addresses.length > 0 && (0, protocol_1.canFetchDataForAddress)(this.protocol)) || (0, protocol_1.canFetchDataForMultipleAddresses)(this.protocol))) return [3 /*break*/, 8];
166
- if (!(0, protocol_1.canFetchDataForMultipleAddresses)(this.protocol)) return [3 /*break*/, 5];
167
- return [4 /*yield*/, this.protocol.getBalanceOfAddresses(this.addressesToCheck())];
168
- case 4:
169
- _a = _b.sent();
170
- return [3 /*break*/, 7];
171
- case 5: return [4 /*yield*/, this.protocol.getBalanceOfAddress(this.addressesToCheck()[0])];
172
- case 6:
173
- _a = _b.sent();
174
- _b.label = 7;
175
- case 7:
176
- balance = _a;
177
- return [3 /*break*/, 12];
178
- case 8:
179
- if (!(this.publicKey.type === 'xpub')) return [3 /*break*/, 10];
180
- if (!(0, module_kit_1.isBip32Protocol)(this.protocol)) {
181
- // This *should* never happen because of how the constructor is typed, but the compiler doesn't know it.
182
- // TODO: check if there's a way to tell the compiler here that `publicKey: ExtendedPublicKey => protocol: AirGapOnlineExtendedProtocol`
183
- throw this.xpubRequiresExtendedProtocolError();
184
- }
185
- return [4 /*yield*/, this.protocol.getBalanceOfPublicKey(this.publicKey)];
186
- case 9:
187
- balance = _b.sent();
188
- return [3 /*break*/, 12];
189
- case 10: return [4 /*yield*/, this.protocol.getBalanceOfPublicKey(this.publicKey)];
190
- case 11:
191
- balance = _b.sent();
192
- _b.label = 12;
193
- case 12:
194
- result = new bignumber_1.default((0, module_kit_1.newAmount)(balance.total).blockchain(protocolMetadata.units).value);
195
- this.setCurrentBalance(result);
196
- return [2 /*return*/, result];
197
- }
198
- });
199
- });
200
- };
201
- return AirGapCoinWallet;
202
- }(AirGapOnlineWallet_1.AirGapOnlineWallet));
40
+ }
41
+ async fetchCurrentMarketPrice(baseSymbol = 'USD') {
42
+ const marketPrice = await this.priceService.getCurrentMarketPrice(this.protocol, baseSymbol);
43
+ await this.setCurrentMarketPrice(marketPrice);
44
+ return marketPrice;
45
+ }
46
+ async balanceOf() {
47
+ const protocolMetadata = await this.protocol.getMetadata();
48
+ const protocolIdentifier = protocolMetadata.identifier;
49
+ let balance;
50
+ if ((protocolIdentifier === coinlib_core_1.MainProtocolSymbols.BTC ||
51
+ protocolIdentifier === coinlib_core_1.MainProtocolSymbols.BTC_SEGWIT ||
52
+ protocolIdentifier === coinlib_core_1.MainProtocolSymbols.BTC_TAPROOT ||
53
+ protocolIdentifier === coinlib_core_1.MainProtocolSymbols.GRS) &&
54
+ this.publicKey.type === 'xpub' &&
55
+ (0, module_kit_1.isBip32Protocol)(this.protocol)) {
56
+ // TODO: Remove and test
57
+ /*
58
+ We should remove this if BTC also uses blockbook. (And change the order of the if/else below)
59
+
60
+ The problem is that we have addresses cached for all protocols. But blockbook (grs) doesn't allow
61
+ multiple addresses to be checked at once, so we need to xPub key there (or we would do 100s of requests).
62
+
63
+ We can also not simply change the order of the following if/else, because then it would use the xPub method for
64
+ BTC as well, which results in the addresses being derived again, which causes massive lags in the apps.
65
+ */
66
+ balance = await this.protocol.getBalanceOfPublicKey(this.publicKey);
67
+ }
68
+ else if ((this.addresses.length > 0 && (0, protocol_1.canFetchDataForAddress)(this.protocol)) || (0, protocol_1.canFetchDataForMultipleAddresses)(this.protocol)) {
69
+ balance = (0, protocol_1.canFetchDataForMultipleAddresses)(this.protocol)
70
+ ? await this.protocol.getBalanceOfAddresses(this.addressesToCheck())
71
+ : await this.protocol.getBalanceOfAddress(this.addressesToCheck()[0]);
72
+ }
73
+ else if (this.publicKey.type === 'xpub') {
74
+ if (!(0, module_kit_1.isBip32Protocol)(this.protocol)) {
75
+ // This *should* never happen because of how the constructor is typed, but the compiler doesn't know it.
76
+ // TODO: check if there's a way to tell the compiler here that `publicKey: ExtendedPublicKey => protocol: AirGapOnlineExtendedProtocol`
77
+ throw this.xpubRequiresExtendedProtocolError();
78
+ }
79
+ balance = await this.protocol.getBalanceOfPublicKey(this.publicKey);
80
+ }
81
+ else {
82
+ balance = await this.protocol.getBalanceOfPublicKey(this.publicKey);
83
+ }
84
+ const result = new bignumber_1.default((0, module_kit_1.newAmount)(balance.total).blockchain(protocolMetadata.units).value);
85
+ this.setCurrentBalance(result);
86
+ return result;
87
+ }
88
+ }
203
89
  exports.AirGapCoinWallet = AirGapCoinWallet;
204
90
  //# sourceMappingURL=AirGapCoinWallet.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AirGapCoinWallet.js","sourceRoot":"","sources":["../../../src/wallet/online/AirGapCoinWallet.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAA0D;AAC1D,iHAA0F;AAC1F,iDAA8G;AAC9G,8DAA4G;AAE5G,2DAAyD;AAEzD,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,6BAAa,CAAA;IACb,2BAAW,CAAA;IACX,6BAAa,CAAA;AACf,CAAC,EAJW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAIvB;AAED;IAEU,oCAAqB;IAF/B;;IAwFA,CAAC;IAnFQ,4CAAiB,GAAxB;QACE,OAAO,IAAI,CAAC,cAAc,CAAA;IAC5B,CAAC;IAEM,4CAAiB,GAAxB,UAAyB,OAA8B;QACrD,IAAI,CAAC,cAAc,GAAG,OAAO,CAAA;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AAI,CAAC,SAAS,CAAC,CAAA;QACrE,CAAC;QAED,MAAM,MAAM,GAAc,IAAI,mBAAS,CAAC,IAAA,sBAAS,EAAC,OAAO,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAA;QAE1G,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAA;QAE9B,OAAO,MAAM,CAAA;IACf,CAAC;CACF;AAxFD,4CAwFC"}
@@ -1,182 +1,70 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
- return new (P || (P = Promise))(function (resolve, reject) {
20
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
- step((generator = generator.apply(thisArg, _arguments || [])).next());
24
- });
25
- };
26
- var __generator = (this && this.__generator) || function (thisArg, body) {
27
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
- function verb(n) { return function (v) { return step([n, v]); }; }
30
- function step(op) {
31
- if (f) throw new TypeError("Generator is already executing.");
32
- while (_) try {
33
- 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;
34
- if (y = 0, t) op = [op[0] & 2, t.value];
35
- switch (op[0]) {
36
- case 0: case 1: t = op; break;
37
- case 4: _.label++; return { value: op[1], done: false };
38
- case 5: _.label++; y = op[1]; op = [0]; continue;
39
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
- default:
41
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
- if (t[2]) _.ops.pop();
46
- _.trys.pop(); continue;
47
- }
48
- op = body.call(thisArg, _);
49
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
- }
52
- };
53
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
54
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
55
4
  };
56
5
  Object.defineProperty(exports, "__esModule", { value: true });
57
6
  exports.AirGapNFTWallet = void 0;
58
- var bignumber_1 = __importDefault(require("@airgap/coinlib-core/dependencies/src/bignumber.js-9.0.0/bignumber"));
59
- var module_kit_1 = require("@airgap/module-kit");
60
- var AirGapOnlineWallet_1 = require("./AirGapOnlineWallet");
61
- var AirGapNFTWallet = /** @class */ (function (_super) {
62
- __extends(AirGapNFTWallet, _super);
63
- function AirGapNFTWallet() {
64
- var _this = _super !== null && _super.apply(this, arguments) || this;
65
- _this.currentBalance = {};
66
- _this.currentMarketPrice = {};
67
- return _this;
7
+ const bignumber_1 = __importDefault(require("@airgap/coinlib-core/dependencies/src/bignumber.js-9.0.0/bignumber"));
8
+ const module_kit_1 = require("@airgap/module-kit");
9
+ const AirGapOnlineWallet_1 = require("./AirGapOnlineWallet");
10
+ class AirGapNFTWallet extends AirGapOnlineWallet_1.AirGapOnlineWallet {
11
+ constructor() {
12
+ super(...arguments);
13
+ this.currentBalance = {};
14
+ this.currentMarketPrice = {};
68
15
  }
69
- AirGapNFTWallet.prototype.getCurrentBalance = function (assetID) {
16
+ getCurrentBalance(assetID) {
70
17
  return this.currentBalance[assetID];
71
- };
72
- AirGapNFTWallet.prototype.setCurrentBalance = function (balance, assetID) {
18
+ }
19
+ setCurrentBalance(balance, assetID) {
73
20
  this.currentBalance[assetID] = balance;
74
- };
75
- AirGapNFTWallet.prototype.getCurrentMarketPrice = function (assetID) {
21
+ }
22
+ getCurrentMarketPrice(assetID) {
76
23
  return this.currentMarketPrice[assetID];
77
- };
78
- AirGapNFTWallet.prototype.setCurrentMarketPrice = function (marketPrice, assetID) {
79
- return __awaiter(this, void 0, void 0, function () {
80
- var networkType;
81
- return __generator(this, function (_a) {
82
- switch (_a.label) {
83
- case 0: return [4 /*yield*/, this.protocol.getNetwork()];
84
- case 1:
85
- networkType = (_a.sent()).type;
86
- this.currentMarketPrice[assetID] = networkType === 'mainnet' ? marketPrice : new bignumber_1.default(0);
87
- return [2 /*return*/];
88
- }
89
- });
90
- });
91
- };
92
- AirGapNFTWallet.prototype.synchronize = function (assetsID) {
93
- if (assetsID === void 0) { assetsID = []; }
94
- return __awaiter(this, void 0, void 0, function () {
95
- return __generator(this, function (_a) {
96
- return [2 /*return*/, _super.prototype.synchronize.call(this, assetsID)];
97
- });
98
- });
99
- };
100
- AirGapNFTWallet.prototype._synchronize = function (assetIDs) {
101
- if (assetIDs === void 0) { assetIDs = []; }
102
- return __awaiter(this, void 0, void 0, function () {
103
- var _this = this;
104
- return __generator(this, function (_a) {
105
- switch (_a.label) {
106
- case 0: return [4 /*yield*/, Promise.all(assetIDs.map(function (assetID) { return __awaiter(_this, void 0, void 0, function () {
107
- var _a, balance, marketPrice;
108
- return __generator(this, function (_b) {
109
- switch (_b.label) {
110
- case 0: return [4 /*yield*/, Promise.all([this.balanceOf(assetID), this.fetchCurrentMarketPrice(assetID)])];
111
- case 1:
112
- _a = _b.sent(), balance = _a[0], marketPrice = _a[1];
113
- this.setCurrentBalance(balance, assetID);
114
- return [4 /*yield*/, this.setCurrentMarketPrice(marketPrice, assetID)];
115
- case 2:
116
- _b.sent();
117
- return [2 /*return*/];
118
- }
119
- });
120
- }); }))];
121
- case 1:
122
- _a.sent();
123
- return [2 /*return*/];
124
- }
125
- });
126
- });
127
- };
128
- AirGapNFTWallet.prototype.reset = function () {
24
+ }
25
+ async setCurrentMarketPrice(marketPrice, assetID) {
26
+ const networkType = (await this.protocol.getNetwork()).type;
27
+ this.currentMarketPrice[assetID] = networkType === 'mainnet' ? marketPrice : new bignumber_1.default(0);
28
+ }
29
+ async synchronize(assetsID = []) {
30
+ return super.synchronize(assetsID);
31
+ }
32
+ async _synchronize(assetIDs = []) {
33
+ await Promise.all(assetIDs.map(async (assetID) => {
34
+ const [balance, marketPrice] = await Promise.all([this.balanceOf(assetID), this.fetchCurrentMarketPrice(assetID)]);
35
+ this.setCurrentBalance(balance, assetID);
36
+ await this.setCurrentMarketPrice(marketPrice, assetID);
37
+ }));
38
+ }
39
+ reset() {
129
40
  this.currentBalance = {};
130
41
  this.currentMarketPrice = {};
131
- };
132
- AirGapNFTWallet.prototype.fetchCurrentMarketPrice = function (assetID, _baseSymbol) {
133
- if (_baseSymbol === void 0) { _baseSymbol = 'USD'; }
134
- return __awaiter(this, void 0, void 0, function () {
135
- var result;
136
- return __generator(this, function (_a) {
137
- switch (_a.label) {
138
- case 0:
139
- result = new bignumber_1.default(0);
140
- return [4 /*yield*/, this.setCurrentMarketPrice(result, assetID)];
141
- case 1:
142
- _a.sent();
143
- return [2 /*return*/, result];
144
- }
145
- });
146
- });
147
- };
148
- AirGapNFTWallet.prototype.balanceOf = function (assetID) {
149
- return __awaiter(this, void 0, void 0, function () {
150
- var protocolMetadata, balance, result;
151
- return __generator(this, function (_a) {
152
- switch (_a.label) {
153
- case 0: return [4 /*yield*/, this.protocol.getMetadata()];
154
- case 1:
155
- protocolMetadata = _a.sent();
156
- if (!(this.publicKey.type === 'xpub')) return [3 /*break*/, 3];
157
- if (!(0, module_kit_1.isBip32Protocol)(this.protocol)) {
158
- // This *should* never happen because of how the constructor is typed, but the compiler doesn't know it.
159
- // TODO: check if there's a way to tell the compiler here that `publicKey: ExtendedPublicKey => protocol: AirGapOnlineExtendedProtocol`
160
- throw this.xpubRequiresExtendedProtocolError();
161
- }
162
- return [4 /*yield*/, this.protocol.getBalanceOfPublicKey(this.publicKey /* { assetID } */)];
163
- case 2:
164
- // TODO: handle assetID
165
- balance = _a.sent();
166
- return [3 /*break*/, 5];
167
- case 3: return [4 /*yield*/, this.protocol.getBalanceOfPublicKey(this.publicKey /* { addressIndex: this.addressIndex, assetID } */)];
168
- case 4:
169
- balance = _a.sent();
170
- _a.label = 5;
171
- case 5:
172
- result = new bignumber_1.default((0, module_kit_1.newAmount)(balance.total).blockchain(protocolMetadata.units).value);
173
- this.setCurrentBalance(result, assetID);
174
- return [2 /*return*/, result];
175
- }
176
- });
177
- });
178
- };
179
- return AirGapNFTWallet;
180
- }(AirGapOnlineWallet_1.AirGapOnlineWallet));
42
+ }
43
+ async fetchCurrentMarketPrice(assetID, _baseSymbol = 'USD') {
44
+ // TODO
45
+ const result = new bignumber_1.default(0);
46
+ await this.setCurrentMarketPrice(result, assetID);
47
+ return result;
48
+ }
49
+ async balanceOf(assetID) {
50
+ const protocolMetadata = await this.protocol.getMetadata();
51
+ let balance;
52
+ if (this.publicKey.type === 'xpub') {
53
+ if (!(0, module_kit_1.isBip32Protocol)(this.protocol)) {
54
+ // This *should* never happen because of how the constructor is typed, but the compiler doesn't know it.
55
+ // TODO: check if there's a way to tell the compiler here that `publicKey: ExtendedPublicKey => protocol: AirGapOnlineExtendedProtocol`
56
+ throw this.xpubRequiresExtendedProtocolError();
57
+ }
58
+ // TODO: handle assetID
59
+ balance = await this.protocol.getBalanceOfPublicKey(this.publicKey /* { assetID } */);
60
+ }
61
+ else {
62
+ balance = await this.protocol.getBalanceOfPublicKey(this.publicKey /* { addressIndex: this.addressIndex, assetID } */);
63
+ }
64
+ const result = new bignumber_1.default((0, module_kit_1.newAmount)(balance.total).blockchain(protocolMetadata.units).value);
65
+ this.setCurrentBalance(result, assetID);
66
+ return result;
67
+ }
68
+ }
181
69
  exports.AirGapNFTWallet = AirGapNFTWallet;
182
70
  //# sourceMappingURL=AirGapNFTWallet.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AirGapNFTWallet.js","sourceRoot":"","sources":["../../../src/wallet/online/AirGapNFTWallet.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iHAA0F;AAC1F,iDAA8G;AAE9G,2DAAyD;AAEzD;IAEU,mCAAqB;IAF/B;QAAA,qEA0EC;QAvES,oBAAc,GAA0C,EAAE,CAAA;QAU1D,wBAAkB,GAA0C,EAAE,CAAA;;IA6DxE,CAAC;IArEQ,2CAAiB,GAAxB,UAAyB,OAAe;QACtC,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAA;IACrC,CAAC;IAEM,2CAAiB,GAAxB,UAAyB,OAA8B,EAAE,OAAe;QACtE,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,GAAG,OAAO,CAAA;IACxC,CAAC;IAIM,+CAAqB,GAA5B,UAA6B,OAAe;QAC1C,OAAO,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAA;IACzC,CAAC;IAEY,+CAAqB,GAAlC,UAAmC,WAAkC,EAAE,OAAe;;;;;4BAC/D,qBAAM,IAAI,C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