@otoplo/wallet-common 0.4.7 → 0.5.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.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Address as e, AddressType as t, BNExtended as n, BufferUtils as r, BufferWriter as i, CommonUtils as a, HDPrivateKey as o, Hash as s, Networks as c, Opcode as l, Output as u, OutputSighashType as d, Script as f, ScriptFactory as ee, ScriptOpcode as p, SighashType as m, Transaction as h, TransactionBuilder as g, TxSigner as _, UnitUtils as v } from "libnexa-ts";
1
+ import { Address as e, AddressType as t, BufferUtils as n, BufferWriter as r, CommonUtils as i, HDPrivateKey as a, Hash as o, Networks as s, Opcode as c, Output as l, OutputSighashType as u, Script as d, ScriptFactory as ee, ScriptNum as f, ScriptOpcode as p, SighashType as m, Transaction as h, TransactionBuilder as g, TxSigner as _, UnitUtils as v } from "libnexa-ts";
2
2
  import y from "js-big-decimal";
3
3
  import { ConnectionStatus as te, ElectrumClient as ne, TransportScheme as b } from "@otoplo/electrum-client";
4
4
  import { generateMnemonic as re, mnemonicToSeedSync as ie, validateMnemonic as ae } from "@scure/bip39";
@@ -50,13 +50,13 @@ var S = /* @__PURE__ */ function(e) {
50
50
  }
51
51
  }, E = Object.keys(T);
52
52
  function D() {
53
- return c.defaultNetwork == c.testnet;
53
+ return s.defaultNetwork == s.testnet;
54
54
  }
55
55
  function le(e) {
56
56
  return D() ? e == "508c843a4b98fb25f57cf9ebafb245a5c16468f06519cdd467059a91e7b79d52" : e == "edc7144fe1ba4edd0edf35d7eea90f6cb1dba42314aa85da8207e97c5339c801";
57
57
  }
58
58
  function O(n, r = t.PayToScriptTemplate) {
59
- return e.isValid(n, c.defaultNetwork, r);
59
+ return e.isValid(n, s.defaultNetwork, r);
60
60
  }
61
61
  function ue() {
62
62
  return `https://${D() ? "testnet-" : ""}explorer.nexa.org`;
@@ -76,13 +76,13 @@ function fe(e) {
76
76
  return e.length === 0 ? "" : e.charAt(0).toUpperCase() + e.substring(1);
77
77
  }
78
78
  function j(t) {
79
- return a.isHexa(t) ? r.hexToBuffer(t) : e.fromString(t).data;
79
+ return i.isHexa(t) ? n.hexToBuffer(t) : e.fromString(t).data;
80
80
  }
81
81
  function M(e) {
82
- return a.isHexa(e) ? e : r.bufferToHex(j(e));
82
+ return i.isHexa(e) ? e : n.bufferToHex(j(e));
83
83
  }
84
84
  function pe(n) {
85
- return a.isHexa(n) ? new e(j(n), c.defaultNetwork, t.GroupIdAddress).toString() : n;
85
+ return i.isHexa(n) ? new e(j(n), s.defaultNetwork, t.GroupIdAddress).toString() : n;
86
86
  }
87
87
  function N(e) {
88
88
  return e == null || e === "" ? "" : BigInt(e) <= 0n ? "0" : e.toString();
@@ -602,7 +602,10 @@ var z = class {
602
602
  }
603
603
  reset() {
604
604
  if (!this.seed) throw Error("KeysManager not initialized");
605
- this.masterKey = o.fromSeed(this.seed).deriveChild(44, !0).deriveChild(29223, !0), this.accountKeys.clear(), this.walletKeys.clear();
605
+ this.masterKey = a.fromSeed(this.seed).deriveChild(44, !0).deriveChild(29223, !0), this.accountKeys.clear(), this.walletKeys.clear();
606
+ }
607
+ clear() {
608
+ this.seed = void 0, this.masterKey = void 0, this.accountKeys.clear(), this.walletKeys.clear();
606
609
  }
607
610
  getAccountKey(e) {
608
611
  let t = this.accountKeys.get(e);
@@ -616,6 +619,7 @@ var z = class {
616
619
  }).privateKey.toAddress().toString();
617
620
  }
618
621
  getKey(e) {
622
+ if (!this.seed) throw Error("KeysManager not initialized");
619
623
  let t = typeof e == "string" ? e : L(e.account, e.type, e.index), n = this.walletKeys.get(t);
620
624
  if (!n) {
621
625
  let { account: r, type: i, index: a } = typeof e == "string" ? R(e) : e;
@@ -625,10 +629,10 @@ var z = class {
625
629
  }
626
630
  };
627
631
  // src/utils/asset.ts
628
- function Se(e, t) {
632
+ function B(e, t) {
629
633
  return e && typeof e == "string" ? e.startsWith("http") ? e.replace("http://", "https://") : e.startsWith("ipfs://") ? e : `${new URL(t).origin}${e}` : "";
630
634
  }
631
- function B(e) {
635
+ function Se(e) {
632
636
  return e ? Ce(e) : null;
633
637
  }
634
638
  function Ce(e, t = "https://ipfs.nebula.markets/") {
@@ -753,35 +757,35 @@ var we = class {
753
757
  throw Error(`Unexpected Error: ${e}`);
754
758
  }
755
759
  }
756
- }, W = 274710, Te = "0014461ad25081cb0119d034385ff154c8d3ad6bdd76";
760
+ }, W = 274710;
757
761
  function G() {
758
- return f.empty().add(l.OP_FROMALTSTACK).add(l.OP_DROP).add(l.OP_FROMALTSTACK).add(l.OP_CHECKLOCKTIMEVERIFY).add(l.OP_DROP).add(l.OP_FROMALTSTACK).add(l.OP_CHECKSIGVERIFY);
762
+ return d.empty().add(c.OP_FROMALTSTACK).add(c.OP_DROP).add(c.OP_FROMALTSTACK).add(c.OP_CHECKLOCKTIMEVERIFY).add(c.OP_DROP).add(c.OP_FROMALTSTACK).add(c.OP_CHECKSIGVERIFY);
759
763
  }
760
764
  function K() {
761
765
  let e = G();
762
- return s.sha256ripemd160(e.toBuffer());
766
+ return o.sha256ripemd160(e.toBuffer());
763
767
  }
764
768
  function q(e) {
765
- return f.empty().add(e.toBuffer());
769
+ return d.empty().add(e.toBuffer());
766
770
  }
767
771
  function J(e) {
768
772
  let t = q(e);
769
- return s.sha256ripemd160(t.toBuffer());
773
+ return o.sha256ripemd160(t.toBuffer());
770
774
  }
771
775
  function Y(e) {
772
- return e.map((e) => e <= 16 ? p.smallInt(e) : n.fromNumber(e).toScriptNumBuffer());
776
+ return e.map((e) => e <= 16 ? p.smallInt(e) : f.encode(e));
773
777
  }
774
778
  function X(t, n) {
775
779
  if (n.length !== 2) return;
776
780
  let r = K(), i = J(t), a = Y(n);
777
781
  return e.fromScriptTemplate(r, i, a).toString();
778
782
  }
779
- function Ee(e, t) {
783
+ function Te(e, t) {
780
784
  let n = (t - e) * 2, r = /* @__PURE__ */ new Date();
781
785
  return r.setMinutes(r.getMinutes() + n), r.toLocaleDateString();
782
786
  }
783
787
  // src/services/transaction.ts
784
- var De = class {
788
+ var Ee = class {
785
789
  constructor(e, t, n) {
786
790
  this.MAX_INPUTS_OUTPUTS = 250, this.rostrumService = e, this.keyManager = t, this.walletDb = n;
787
791
  }
@@ -968,7 +972,7 @@ var De = class {
968
972
  }
969
973
  };
970
974
  // src/utils/seed.ts
971
- function Oe(e = 12) {
975
+ function De(e = 12) {
972
976
  return re(x, e === 24 ? 256 : 128);
973
977
  }
974
978
  function Z(e) {
@@ -986,28 +990,28 @@ async function Q(e, t) {
986
990
  length: 256
987
991
  }, !1, ["encrypt", "decrypt"]);
988
992
  }
989
- async function ke(e, t) {
990
- let n = r.utf8ToBuffer(t), i = r.getRandomBuffer(16), a = r.getRandomBuffer(12), o = r.utf8ToBuffer(e), s = await Q(n, i), c = await crypto.subtle.encrypt({
993
+ async function Oe(e, t) {
994
+ let r = n.utf8ToBuffer(t), i = n.getRandomBuffer(16), a = n.getRandomBuffer(12), o = n.utf8ToBuffer(e), s = await Q(r, i), c = await crypto.subtle.encrypt({
991
995
  name: "AES-GCM",
992
996
  iv: new Uint8Array(a)
993
- }, s, new Uint8Array(o)), l = r.concat([
997
+ }, s, new Uint8Array(o)), l = n.concat([
994
998
  i,
995
999
  a,
996
1000
  new Uint8Array(c)
997
1001
  ]);
998
- return r.bufferToBase64(l);
1002
+ return n.bufferToBase64(l);
999
1003
  }
1000
- async function Ae(e, t) {
1001
- let n = r.utf8ToBuffer(t), i = r.base64ToBuffer(e), a = i.slice(0, 16), o = i.slice(16, 28), s = i.slice(28), c = await Q(n, a), l = await crypto.subtle.decrypt({
1004
+ async function ke(e, t) {
1005
+ let r = n.utf8ToBuffer(t), i = n.base64ToBuffer(e), a = i.slice(0, 16), o = i.slice(16, 28), s = i.slice(28), c = await Q(r, a), l = await crypto.subtle.decrypt({
1002
1006
  name: "AES-GCM",
1003
1007
  iv: o
1004
1008
  }, c, s);
1005
- return r.bufferToUtf8(new Uint8Array(l));
1009
+ return n.bufferToUtf8(new Uint8Array(l));
1006
1010
  }
1007
- async function je(e, t) {
1011
+ async function Ae(e, t) {
1008
1012
  try {
1009
1013
  if (e) {
1010
- let n = await Ae(e, t);
1014
+ let n = await ke(e, t);
1011
1015
  if (n && Z(n)) return n;
1012
1016
  }
1013
1017
  return !1;
@@ -1016,7 +1020,7 @@ async function je(e, t) {
1016
1020
  }
1017
1021
  }
1018
1022
  // src/services/session.ts
1019
- var Me = class {
1023
+ var je = class {
1020
1024
  constructor(e, t) {
1021
1025
  this.walletDb = e, this.keyManager = t, this.providers = /* @__PURE__ */ new Map(), this.handlers = /* @__PURE__ */ new Map(), this.removeOnClose = !0;
1022
1026
  }
@@ -1152,7 +1156,7 @@ var Me = class {
1152
1156
  address: e.address,
1153
1157
  pubkey: this.keyManager.getKey(t).publicKey.toString(),
1154
1158
  blockchain: "nexa",
1155
- network: c.defaultNetwork.name,
1159
+ network: s.defaultNetwork.name,
1156
1160
  capabilities: {
1157
1161
  addToken: !0,
1158
1162
  sendTransaction: !0,
@@ -1162,7 +1166,7 @@ var Me = class {
1162
1166
  };
1163
1167
  });
1164
1168
  }
1165
- }, Ne = class {
1169
+ }, Me = class {
1166
1170
  constructor(e, t, n) {
1167
1171
  this.rostrumService = e, this.keyManager = t, this.assetService = n;
1168
1172
  }
@@ -1200,18 +1204,18 @@ var Me = class {
1200
1204
  await Promise.all(t);
1201
1205
  }
1202
1206
  async processInput(e, t) {
1203
- let n = e.txDetails.tx.inputs[t], i = await this.rostrumService.getUtxo(r.bufferToHex(n.outpoint));
1207
+ let r = e.txDetails.tx.inputs[t], i = await this.rostrumService.getUtxo(n.bufferToHex(r.outpoint));
1204
1208
  if (i.status == "spent") throw Error("Input UTXO is already spent.");
1205
- if (n.output = new u(i.amount, i.scriptpubkey), n.output.address == e.address) {
1206
- let r = i.token_id_hex || "NEXA";
1209
+ if (r.output = new l(i.amount, i.scriptpubkey), r.output.address == e.address) {
1210
+ let n = i.token_id_hex || "NEXA";
1207
1211
  e.myInputs.set(t, {
1208
1212
  address: e.address,
1209
1213
  nexaAmount: i.amount.toString(),
1210
- assetId: r,
1214
+ assetId: n,
1211
1215
  assetAmount: N(i.group_quantity) || i.amount.toString()
1212
- }), e.involvedAssets.add(r), n.scriptSig.isEmpty() && e.inputsToSign.add(t);
1216
+ }), e.involvedAssets.add(n), r.scriptSig.isEmpty() && e.inputsToSign.add(t);
1213
1217
  }
1214
- n.scriptSig.findPlaceholder() > 0 && e.inputsToSign.add(t);
1218
+ r.scriptSig.findPlaceholder() > 0 && e.inputsToSign.add(t);
1215
1219
  }
1216
1220
  processOutputs(e) {
1217
1221
  for (let t = 0; t < e.txDetails.tx.outputs.length; t++) {
@@ -1232,34 +1236,34 @@ var Me = class {
1232
1236
  let n = e.txDetails.tx.inputs[t], r = this.validateAndGetSubscript(n);
1233
1237
  if (n.scriptSig.isEmpty()) {
1234
1238
  e.allMyOutputsCovered = !0;
1235
- let i = _.sign(e.txDetails.tx, t, m.ALL, r, e.privateKey).toTxFormat(), a = f.empty().add(e.privateKey.publicKey.toBuffer());
1236
- n.scriptSig = ee.buildScriptTemplateIn(void 0, a, f.empty().add(i));
1239
+ let i = _.sign(e.txDetails.tx, t, m.ALL, r, e.privateKey).toTxFormat(), a = d.empty().add(e.privateKey.publicKey.toBuffer());
1240
+ n.scriptSig = ee.buildScriptTemplateIn(void 0, a, d.empty().add(i));
1237
1241
  } else {
1238
1242
  let i = n.scriptSig.findPlaceholder(), a = n.scriptSig.chunks[i].buf.subarray(64), o = m.fromBuffer(a);
1239
1243
  this.processSignatureCoverage(e, o);
1240
1244
  let s = _.sign(e.txDetails.tx, t, o, r, e.privateKey).toTxFormat(a);
1241
- n.scriptSig.replaceChunk(i, f.empty().add(s));
1245
+ n.scriptSig.replaceChunk(i, d.empty().add(s));
1242
1246
  }
1243
1247
  }
1244
1248
  if (!e.allMyOutputsCovered) throw Error("Some of interested outputs are not covered by signatures.");
1245
1249
  }
1246
1250
  validateAndGetSubscript(e) {
1247
1251
  if (e.output.scriptPubKey.isPublicKeyTemplateOut()) {
1248
- if (e.scriptSig.isEmpty() || e.scriptSig.isPublicKeyTemplateIn()) return f.empty().add(l.OP_FROMALTSTACK).add(l.OP_CHECKSIGVERIFY);
1252
+ if (e.scriptSig.isEmpty() || e.scriptSig.isPublicKeyTemplateIn()) return d.empty().add(c.OP_FROMALTSTACK).add(c.OP_CHECKSIGVERIFY);
1249
1253
  throw Error("Invalid input script type.");
1250
1254
  }
1251
1255
  if (e.output.scriptPubKey.isScriptTemplateOut()) {
1252
1256
  if (!e.scriptSig.isScriptTemplateIn()) throw Error("Unsupported input script type.");
1253
- let t = e.output.scriptPubKey.getTemplateHash(), n = e.scriptSig.chunks[0].buf;
1254
- if (r.equals(t, s.sha256ripemd160(n)) || r.equals(t, s.sha256sha256(n))) return f.fromBuffer(n);
1257
+ let t = e.output.scriptPubKey.getTemplateHash(), r = e.scriptSig.chunks[0].buf;
1258
+ if (n.equals(t, o.sha256ripemd160(r)) || n.equals(t, o.sha256sha256(r))) return d.fromBuffer(r);
1255
1259
  throw Error("Invalid input script template.");
1256
1260
  }
1257
1261
  throw Error("Unsupported prevout script type.");
1258
1262
  }
1259
1263
  processSignatureCoverage(e, t) {
1260
1264
  if (!e.allMyOutputsCovered) {
1261
- if (t.outType == d.TWO) e.coveredOutputs.add(t.outData[0]), e.coveredOutputs.add(t.outData[1]), this.checkSignatureCoverage(e);
1262
- else if (t.outType == d.FIRSTN) {
1265
+ if (t.outType == u.TWO) e.coveredOutputs.add(t.outData[0]), e.coveredOutputs.add(t.outData[1]), this.checkSignatureCoverage(e);
1266
+ else if (t.outType == u.FIRSTN) {
1263
1267
  let n = t.outData[0];
1264
1268
  for (let t = 0; t < n; t++) e.coveredOutputs.add(t);
1265
1269
  this.checkSignatureCoverage(e);
@@ -1287,7 +1291,7 @@ var Me = class {
1287
1291
  t !== "NEXA" && (n.asset = await this.assetService.getAssetInfo(t)), n.amount > 0n ? e.txDetails.receive.push(n) : n.amount < 0n && e.txDetails.send.push(n);
1288
1292
  }
1289
1293
  }
1290
- }, $ = 5, Pe = class {
1294
+ }, $ = 5, Ne = class {
1291
1295
  constructor(e, t) {
1292
1296
  this.rostrumService = e, this.keyManager = t;
1293
1297
  }
@@ -1310,30 +1314,30 @@ var Me = class {
1310
1314
  }), t;
1311
1315
  }
1312
1316
  async checkForVaults() {
1313
- let e = /* @__PURE__ */ new Set(), t = r.bufferToHex(K()), n = 0;
1314
- for (let i = 0; n < $; i += $) {
1315
- let a = await Promise.all(Array.from({ length: $ }, (e, n) => {
1317
+ let e = /* @__PURE__ */ new Set(), t = n.bufferToHex(K()), r = 0;
1318
+ for (let i = 0; r < $; i += $) {
1319
+ let a = await Promise.all(Array.from({ length: $ }, (e, r) => {
1316
1320
  let a = this.keyManager.getKey({
1317
1321
  account: S.VAULT,
1318
1322
  type: C.RECEIVE,
1319
- index: i + n
1320
- }), o = r.bufferToHex(J(a.publicKey));
1323
+ index: i + r
1324
+ }), o = n.bufferToHex(J(a.publicKey));
1321
1325
  return this.rostrumService.listTemplateScripts(t, o);
1322
1326
  }));
1323
- for (let t of a) t.length === 0 ? n++ : (n = 0, t.forEach((t) => e.add(t.scriptpubkey)));
1327
+ for (let t of a) t.length === 0 ? r++ : (r = 0, t.forEach((t) => e.add(t.scriptpubkey)));
1324
1328
  }
1325
1329
  return e;
1326
1330
  }
1327
1331
  parseVaultDetails(t) {
1328
- let r = f.fromHex(t), a = new i().writeVarLengthBuf(r.toBuffer()).toBuffer(), o = new e(a).toString(), s = r.getVisibleArgs(), c = n.fromScriptNumBuffer(s.chunks[0].buf).toNumber(), l = p.isSmallIntOp(s.chunks[1].opcodenum) ? p.decodeOP_N(s.chunks[1].opcodenum) : n.fromScriptNumBuffer(s.chunks[1].buf).toNumber(), u = [c, l];
1329
- if (o == X(this.keyManager.getKey({
1332
+ let n = d.fromHex(t), i = new r().writeVarLengthBuf(n.toBuffer()).toBuffer(), a = new e(i).toString(), o = n.getVisibleArgs(), s = Number(f.decode(o.chunks[0].buf)), c = p.isSmallIntOp(o.chunks[1].opcodenum) ? p.decodeOP_N(o.chunks[1].opcodenum) : Number(f.decode(o.chunks[1].buf)), l = [s, c];
1333
+ if (a == X(this.keyManager.getKey({
1330
1334
  account: S.VAULT,
1331
1335
  type: C.RECEIVE,
1332
- index: l
1333
- }).publicKey, u)) return {
1334
- address: o,
1335
- block: c,
1336
- idx: l,
1336
+ index: c
1337
+ }).publicKey, l)) return {
1338
+ address: a,
1339
+ block: s,
1340
+ idx: c,
1337
1341
  statusHash: "",
1338
1342
  balance: {
1339
1343
  confirmed: "0",
@@ -1344,7 +1348,7 @@ var Me = class {
1344
1348
  type: S.VAULT
1345
1349
  };
1346
1350
  }
1347
- }, Fe = class e {
1351
+ }, Pe = class e {
1348
1352
  static {
1349
1353
  this.DEBOUNCE_MS = 2e3;
1350
1354
  }
@@ -1356,7 +1360,10 @@ var Me = class {
1356
1360
  address: r,
1357
1361
  result: n
1358
1362
  });
1359
- }, this.discoveryService = new Pe(this.rostrumService, this.keyManager), this.accounts = /* @__PURE__ */ new Map(), this.accountsAddressToId = /* @__PURE__ */ new Map(), this.receiveAddresses = [], this.changeAddresses = [], this.vaults = /* @__PURE__ */ new Map(), this.pendingUpdates = /* @__PURE__ */ new Map(), this.addressResolvers = /* @__PURE__ */ new Map();
1363
+ }, this.discoveryService = new Ne(this.rostrumService, this.keyManager), this.accounts = /* @__PURE__ */ new Map(), this.accountsAddressToId = /* @__PURE__ */ new Map(), this.receiveAddresses = [], this.changeAddresses = [], this.vaults = /* @__PURE__ */ new Map(), this.pendingUpdates = /* @__PURE__ */ new Map(), this.addressResolvers = /* @__PURE__ */ new Map();
1364
+ }
1365
+ clear() {
1366
+ this.accounts.clear(), this.accountsAddressToId.clear(), this.receiveAddresses = [], this.changeAddresses = [], this.vaults.clear(), this.pendingUpdates.clear(), this.addressResolvers.clear(), this.notify({ type: "clear_wallet" });
1360
1367
  }
1361
1368
  onUpdate(e) {
1362
1369
  this.updateCallback = e;
@@ -1414,20 +1421,20 @@ var Me = class {
1414
1421
  n,
1415
1422
  r
1416
1423
  ]);
1417
- this.receiveAddresses = this.deriveAddresses(C.RECEIVE, 0, i + z.GAP_LIMIT + 1), this.changeAddresses = this.deriveAddresses(C.CHANGE, 0, a + z.GAP_LIMIT + 1), this.accounts = this.deriveAccounts(0, o < 0 ? 1 : o + 1), this.accounts.forEach((e) => this.accountsAddressToId.set(e.address, e.id)), this.vaults = s, await this.saveAddresses(this.receiveAddresses), await this.saveAddresses(this.changeAddresses), await this.saveAccounts(this.accounts), await this.saveVaults(this.vaults), this.initState(), await this.initialSync();
1424
+ this.receiveAddresses = this.deriveAddresses(C.RECEIVE, 0, i + z.GAP_LIMIT + 1), this.changeAddresses = this.deriveAddresses(C.CHANGE, 0, a + z.GAP_LIMIT + 1), this.accounts = this.deriveAccounts(0, o < 0 ? 1 : o + 1), this.accounts.forEach((e) => this.accountsAddressToId.set(e.address, e.id)), this.vaults = s, await this.saveAddresses(this.receiveAddresses), await this.saveAddresses(this.changeAddresses), await this.saveAccounts(this.accounts), await this.saveVaults(this.vaults), this.initState();
1418
1425
  }
1419
1426
  async loadWallet() {
1420
1427
  this.receiveAddresses = await this.walletDb.getReceiveAddresses(), this.changeAddresses = await this.walletDb.getChangeAddresses();
1421
1428
  let e = await this.walletDb.getAccounts();
1422
1429
  this.accounts = new Map(e.map((e) => [e.id, e])), this.accountsAddressToId = new Map(e.map((e) => [e.address, e.id]));
1423
1430
  let t = await this.walletDb.getVaults();
1424
- this.vaults = new Map(t.map((e) => [e.address, e])), this.initState(), await this.reconnectSync();
1431
+ this.vaults = new Map(t.map((e) => [e.address, e])), this.initState();
1425
1432
  }
1426
1433
  async initialSync() {
1427
- await this.subscribeAddresses(this.getAllAddresses(), !0);
1434
+ return this.subscribeAddresses(this.getAllAddresses(), !0);
1428
1435
  }
1429
1436
  async reconnectSync() {
1430
- await Promise.all([this.sessionManager.reload(this.accounts), this.subscribeAddresses(this.getAllAddresses())]);
1437
+ return Promise.all([this.sessionManager.reload(this.accounts), this.subscribeAddresses(this.getAllAddresses())]);
1431
1438
  }
1432
1439
  initState() {
1433
1440
  let e = this.getMainAddresses();
@@ -1763,7 +1770,7 @@ var Me = class {
1763
1770
  isMainAddress(e) {
1764
1771
  return e.type == S.MAIN;
1765
1772
  }
1766
- }, Ie = class e {
1773
+ }, Fe = class e {
1767
1774
  static {
1768
1775
  this.POLL_INTERVAL_MS = 12e4;
1769
1776
  }
@@ -1844,6 +1851,6 @@ var Me = class {
1844
1851
  }), a;
1845
1852
  }
1846
1853
  };
1847
- export { S as AccountType, we as AssetService, T as CURRENCIES, se as HD_WALLET_ID, z as KeyManager, C as KeySpace, ce as MAX_INT64, Ie as MarketService, xe as RostrumService, Me as SessionManager, w as SessionRequestType, De as TransactionService, Ne as TransactionTransformer, W as VAULT_FIRST_BLOCK, Te as VAULT_SCRIPT_PREFIX, be as WalletCache, ye as WalletDB, Fe as WalletManager, ve as calculateFiatValue, fe as capitalizeFirstLetter, E as currencyCodes, k as currentTimestamp, ke as encryptMnemonic, Ee as estimateDateByFutureBlock, Oe as generateNewMnemonic, X as generateVaultAddress, q as generateVaultConstraint, Y as generateVaultVisibleArgs, j as getAddressBuffer, H as getAssetFileUrl, V as getAssetMetadataUrl, ue as getExplorerUrl, me as getFileMediaType, he as getFileMimeType, J as getVaultConstraintHash, G as getVaultTemplate, K as getVaultTemplateHash, le as isGenesisHashValid, Z as isMnemonicValid, A as isNullOrEmpty, D as isTestnet, O as isValidNexaAddress, L as keyPathToString, B as parseTokenDataUrl, _e as prettifyAmount, ge as sleep, R as stringToKeyPath, P as sumBalance, F as sumTokensBalance, N as tokenAmountToAssetAmount, pe as tokenHexToAddr, M as tokenIdToHex, Se as transformTokenIconUrl, de as truncateStringMiddle, je as validateAndDecryptMnemonic };
1854
+ export { S as AccountType, we as AssetService, T as CURRENCIES, se as HD_WALLET_ID, z as KeyManager, C as KeySpace, ce as MAX_INT64, Fe as MarketService, xe as RostrumService, je as SessionManager, w as SessionRequestType, Ee as TransactionService, Me as TransactionTransformer, W as VAULT_FIRST_BLOCK, be as WalletCache, ye as WalletDB, Pe as WalletManager, ve as calculateFiatValue, fe as capitalizeFirstLetter, E as currencyCodes, k as currentTimestamp, Oe as encryptMnemonic, Te as estimateDateByFutureBlock, De as generateNewMnemonic, X as generateVaultAddress, q as generateVaultConstraint, Y as generateVaultVisibleArgs, j as getAddressBuffer, H as getAssetFileUrl, V as getAssetMetadataUrl, ue as getExplorerUrl, me as getFileMediaType, he as getFileMimeType, J as getVaultConstraintHash, G as getVaultTemplate, K as getVaultTemplateHash, le as isGenesisHashValid, Z as isMnemonicValid, A as isNullOrEmpty, D as isTestnet, O as isValidNexaAddress, L as keyPathToString, Se as parseTokenDataUrl, _e as prettifyAmount, ge as sleep, R as stringToKeyPath, P as sumBalance, F as sumTokensBalance, N as tokenAmountToAssetAmount, pe as tokenHexToAddr, M as tokenIdToHex, B as transformTokenIconUrl, de as truncateStringMiddle, Ae as validateAndDecryptMnemonic };
1848
1855
 
1849
1856
  //# sourceMappingURL=index.js.map