@otoplo/wallet-common 0.1.7 → 0.1.8
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 +223 -222
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/utils/seed.ts +6 -2
package/dist/index.js
CHANGED
|
@@ -1,61 +1,60 @@
|
|
|
1
|
-
import { AddressType as E, Networks as k, Address as b, CommonUtils as W, BufferUtils as
|
|
2
|
-
import { ElectrumClient as
|
|
3
|
-
import { mnemonicToSeedSync as
|
|
4
|
-
import
|
|
5
|
-
import { DAppProvider as
|
|
6
|
-
import { gcm as
|
|
7
|
-
import { argon2idAsync as
|
|
8
|
-
import { pbkdf2Async as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
const g = -1, ne = 9223372036854775807n, Fe = 274710, _t = "0014461ad25081cb0119d034385ff154c8d3ad6bdd76";
|
|
1
|
+
import { AddressType as E, Networks as k, Address as b, CommonUtils as W, BufferUtils as m, HDPrivateKey as Z, GroupToken as O, GroupIdType as I, TransactionBuilder as Q, Transaction as B, UnitUtils as ee, Script as A, Opcode as v, Hash as U, ScriptOpcode as J, BNExtended as z, Output as Me, TxSigner as te, SighashType as se, ScriptFactory as Be, OutputSighashType as ae, BufferWriter as _e } from "libnexa-ts";
|
|
2
|
+
import { ElectrumClient as Ce, TransportScheme as L, ConnectionStatus as Pe } from "@otoplo/electrum-client";
|
|
3
|
+
import { mnemonicToSeedSync as Oe, generateMnemonic as Ue, validateMnemonic as De } from "@scure/bip39";
|
|
4
|
+
import Ve from "jszip";
|
|
5
|
+
import { DAppProvider as Re } from "wallet-comms-sdk";
|
|
6
|
+
import { gcm as he } from "@noble/ciphers/aes.js";
|
|
7
|
+
import { argon2idAsync as ne } from "@noble/hashes/argon2.js";
|
|
8
|
+
import { pbkdf2Async as re } from "@noble/hashes/pbkdf2.js";
|
|
9
|
+
import { sha256 as ie } from "@noble/hashes/sha2.js";
|
|
10
|
+
import { wordlist as fe } from "@scure/bip39/wordlists/english.js";
|
|
11
|
+
import { createSlice as M, createAsyncThunk as He, createSelector as j } from "@reduxjs/toolkit";
|
|
12
|
+
import { useSelector as Ke } from "react-redux";
|
|
13
|
+
const g = -1, oe = 9223372036854775807n, Le = 274710, Mt = "0014461ad25081cb0119d034385ff154c8d3ad6bdd76";
|
|
15
14
|
function T() {
|
|
16
15
|
return k.defaultNetwork == k.testnet;
|
|
17
16
|
}
|
|
18
|
-
function
|
|
17
|
+
function Bt(a) {
|
|
19
18
|
return T() ? a == "508c843a4b98fb25f57cf9ebafb245a5c16468f06519cdd467059a91e7b79d52" : a == "edc7144fe1ba4edd0edf35d7eea90f6cb1dba42314aa85da8207e97c5339c801";
|
|
20
19
|
}
|
|
21
20
|
function F(a, e = E.PayToScriptTemplate) {
|
|
22
21
|
return b.isValid(a, k.defaultNetwork, e);
|
|
23
22
|
}
|
|
24
|
-
function
|
|
23
|
+
function _t() {
|
|
25
24
|
return `https://${T() ? "testnet-" : ""}explorer.nexa.org`;
|
|
26
25
|
}
|
|
27
26
|
function $() {
|
|
28
27
|
return Math.floor(Date.now() / 1e3);
|
|
29
28
|
}
|
|
30
|
-
function
|
|
29
|
+
function Ct(a, e) {
|
|
31
30
|
const t = (e - a) * 2, s = /* @__PURE__ */ new Date();
|
|
32
31
|
return s.setMinutes(s.getMinutes() + t), s.toLocaleDateString();
|
|
33
32
|
}
|
|
34
33
|
function C(a) {
|
|
35
34
|
return !a || a.length === 0;
|
|
36
35
|
}
|
|
37
|
-
function
|
|
36
|
+
function Pt(a, e = 0) {
|
|
38
37
|
if (!a || a.length <= e)
|
|
39
38
|
return a || "";
|
|
40
39
|
const t = "...", s = Math.floor((e - t.length) / 2), n = a.slice(0, s), r = a.slice(a.length - s);
|
|
41
40
|
return n + t + r;
|
|
42
41
|
}
|
|
43
|
-
function
|
|
42
|
+
function Ot(a) {
|
|
44
43
|
return a.length === 0 ? "" : a.charAt(0).toUpperCase() + a.substring(1);
|
|
45
44
|
}
|
|
46
45
|
function R(a) {
|
|
47
|
-
return W.isHexa(a) ?
|
|
46
|
+
return W.isHexa(a) ? m.hexToBuffer(a) : b.fromString(a).data;
|
|
48
47
|
}
|
|
49
48
|
function S(a) {
|
|
50
|
-
return W.isHexa(a) ? a :
|
|
49
|
+
return W.isHexa(a) ? a : m.bufferToHex(R(a));
|
|
51
50
|
}
|
|
52
|
-
function
|
|
51
|
+
function ce(a) {
|
|
53
52
|
return W.isHexa(a) ? new b(R(a), k.defaultNetwork, E.GroupIdAddress).toString() : a;
|
|
54
53
|
}
|
|
55
54
|
function D(a) {
|
|
56
55
|
return a == null || a === "" ? "" : BigInt(a) <= 0n ? "0" : a.toString();
|
|
57
56
|
}
|
|
58
|
-
function
|
|
57
|
+
function de(a) {
|
|
59
58
|
let e = BigInt(0), t = BigInt(0);
|
|
60
59
|
return a.forEach((s) => {
|
|
61
60
|
e += BigInt(s.confirmed), t += BigInt(s.unconfirmed);
|
|
@@ -68,7 +67,7 @@ function G(a) {
|
|
|
68
67
|
e[s] ? (e[s].confirmed = (BigInt(e[s].confirmed) + BigInt(t[s].confirmed)).toString(), e[s].unconfirmed = (BigInt(e[s].unconfirmed) + BigInt(t[s].unconfirmed)).toString()) : e[s] = { confirmed: BigInt(t[s].confirmed).toString(), unconfirmed: BigInt(t[s].unconfirmed).toString() };
|
|
69
68
|
}), e;
|
|
70
69
|
}
|
|
71
|
-
const
|
|
70
|
+
const pe = {
|
|
72
71
|
// Images
|
|
73
72
|
//'.svg': { media: 'image', mime: 'image/svg+xml' },
|
|
74
73
|
".gif": { media: "image", mime: "image/gif" },
|
|
@@ -91,19 +90,19 @@ const le = {
|
|
|
91
90
|
".wav": { media: "audio", mime: "audio/wav" },
|
|
92
91
|
".m4a": { media: "audio", mime: "audio/mp4" }
|
|
93
92
|
};
|
|
94
|
-
function
|
|
93
|
+
function Ut(a) {
|
|
95
94
|
const e = a.lastIndexOf(".");
|
|
96
95
|
if (e === -1) return "unknown";
|
|
97
96
|
const t = a.slice(e).toLowerCase();
|
|
98
|
-
return
|
|
97
|
+
return pe[t]?.media ?? "unknown";
|
|
99
98
|
}
|
|
100
|
-
function
|
|
99
|
+
function Dt(a) {
|
|
101
100
|
const e = a.lastIndexOf(".");
|
|
102
101
|
if (e === -1) return "application/octet-stream";
|
|
103
102
|
const t = a.slice(e).toLowerCase();
|
|
104
|
-
return
|
|
103
|
+
return pe[t]?.mime ?? "application/octet-stream";
|
|
105
104
|
}
|
|
106
|
-
class
|
|
105
|
+
class Vt {
|
|
107
106
|
getPrefix() {
|
|
108
107
|
return T() ? "testnet-" : "";
|
|
109
108
|
}
|
|
@@ -188,8 +187,8 @@ class Ht {
|
|
|
188
187
|
await this.setValue("auto-lock", `${e}`);
|
|
189
188
|
}
|
|
190
189
|
}
|
|
191
|
-
var f = /* @__PURE__ */ ((a) => (a[a.MAIN = 0] = "MAIN", a[a.VAULT = 1] = "VAULT", a[a.DAPP = 2] = "DAPP", a))(f || {}),
|
|
192
|
-
class
|
|
190
|
+
var f = /* @__PURE__ */ ((a) => (a[a.MAIN = 0] = "MAIN", a[a.VAULT = 1] = "VAULT", a[a.DAPP = 2] = "DAPP", a))(f || {}), y = /* @__PURE__ */ ((a) => (a[a.RECEIVE = 0] = "RECEIVE", a[a.CHANGE = 1] = "CHANGE", a))(y || {}), _ = /* @__PURE__ */ ((a) => (a.SignMessage = "signMessage", a.AddToken = "addToken", a.SignTransaction = "signTransaction", a.SendTransaction = "sendTransaction", a))(_ || {}), V = /* @__PURE__ */ ((a) => (a.TOKEN = "token", a.NFT = "nft", a))(V || {});
|
|
191
|
+
class Rt {
|
|
193
192
|
store;
|
|
194
193
|
updateCallback;
|
|
195
194
|
constructor(e) {
|
|
@@ -363,7 +362,7 @@ class Kt {
|
|
|
363
362
|
return this.store.upsertVault(t);
|
|
364
363
|
}
|
|
365
364
|
}
|
|
366
|
-
class
|
|
365
|
+
class Ht {
|
|
367
366
|
walletDb;
|
|
368
367
|
tokens = /* @__PURE__ */ new Map();
|
|
369
368
|
nfts = /* @__PURE__ */ new Map();
|
|
@@ -392,7 +391,7 @@ class Lt {
|
|
|
392
391
|
this.nfts.delete(S(e));
|
|
393
392
|
}
|
|
394
393
|
}
|
|
395
|
-
class
|
|
394
|
+
class ge {
|
|
396
395
|
kvStore;
|
|
397
396
|
client;
|
|
398
397
|
constructor(e) {
|
|
@@ -468,7 +467,7 @@ class he {
|
|
|
468
467
|
}
|
|
469
468
|
async connect(e) {
|
|
470
469
|
try {
|
|
471
|
-
e || (e = await this.getCurrentInstance()), this.client = new
|
|
470
|
+
e || (e = await this.getCurrentInstance()), this.client = new Ce("com.otoplo.wallet", "1.4.3", e.host, e.port, e.scheme, 45 * 1e3, 10 * 1e3), await this.client.connect();
|
|
472
471
|
} catch (t) {
|
|
473
472
|
throw t instanceof Error ? console.info(t.message) : console.error(t), t;
|
|
474
473
|
}
|
|
@@ -491,7 +490,7 @@ class he {
|
|
|
491
490
|
const t = Date.now();
|
|
492
491
|
return new Promise((s, n) => {
|
|
493
492
|
const r = () => {
|
|
494
|
-
if (this.client?.connectionStatus ==
|
|
493
|
+
if (this.client?.connectionStatus == Pe.CONNECTED)
|
|
495
494
|
return s();
|
|
496
495
|
if (Date.now() - t > e)
|
|
497
496
|
return n(new Error("Rostrum Connection timeout"));
|
|
@@ -502,7 +501,7 @@ class he {
|
|
|
502
501
|
}
|
|
503
502
|
async getCurrentInstance() {
|
|
504
503
|
const e = await this.kvStore.getRostrumParams();
|
|
505
|
-
return e ||
|
|
504
|
+
return e || ge.getPredefinedInstances()[0];
|
|
506
505
|
}
|
|
507
506
|
static getPredefinedInstances() {
|
|
508
507
|
return T() ? [
|
|
@@ -531,7 +530,7 @@ class he {
|
|
|
531
530
|
function x(a, e, t) {
|
|
532
531
|
return `${a}'/${e}/${t}`;
|
|
533
532
|
}
|
|
534
|
-
function
|
|
533
|
+
function Fe(a) {
|
|
535
534
|
const e = a.split("/");
|
|
536
535
|
return {
|
|
537
536
|
account: parseInt(e[0].replace("'", "")),
|
|
@@ -539,13 +538,13 @@ function Ge(a) {
|
|
|
539
538
|
index: parseInt(e[2])
|
|
540
539
|
};
|
|
541
540
|
}
|
|
542
|
-
class
|
|
541
|
+
class Kt {
|
|
543
542
|
seed;
|
|
544
543
|
masterKey;
|
|
545
544
|
accountKeys = /* @__PURE__ */ new Map();
|
|
546
545
|
walletKeys = /* @__PURE__ */ new Map();
|
|
547
546
|
init(e) {
|
|
548
|
-
this.seed = typeof e == "string" ?
|
|
547
|
+
this.seed = typeof e == "string" ? Oe(e) : e, this.masterKey = Z.fromSeed(this.seed).deriveChild(44, !0).deriveChild(29223, !0);
|
|
549
548
|
}
|
|
550
549
|
reset() {
|
|
551
550
|
if (!this.seed)
|
|
@@ -560,13 +559,13 @@ class Ft {
|
|
|
560
559
|
const t = typeof e == "string" ? e : x(e.account, e.type, e.index);
|
|
561
560
|
let s = this.walletKeys.get(t);
|
|
562
561
|
if (!s) {
|
|
563
|
-
const { account: n, type: r, index: o } = typeof e == "string" ?
|
|
562
|
+
const { account: n, type: r, index: o } = typeof e == "string" ? Fe(e) : e;
|
|
564
563
|
s = this.getAccountKey(n).deriveChild(r, !1).deriveChild(o, !1), this.walletKeys.set(t, s);
|
|
565
564
|
}
|
|
566
565
|
return s;
|
|
567
566
|
}
|
|
568
567
|
}
|
|
569
|
-
function
|
|
568
|
+
function me() {
|
|
570
569
|
return {
|
|
571
570
|
name: "NiftyArt",
|
|
572
571
|
ticker: "NIFTY",
|
|
@@ -577,33 +576,33 @@ function fe() {
|
|
|
577
576
|
decimals: 0
|
|
578
577
|
};
|
|
579
578
|
}
|
|
580
|
-
function
|
|
581
|
-
return Y(
|
|
579
|
+
function Lt(a) {
|
|
580
|
+
return Y(Je() + a, "raw");
|
|
582
581
|
}
|
|
583
582
|
function q(a) {
|
|
584
583
|
try {
|
|
585
584
|
const e = R(a);
|
|
586
|
-
return O.isSubgroup(e) ?
|
|
585
|
+
return O.isSubgroup(e) ? m.bufferToHex(e.subarray(0, 32)) === me().tokenIdHex : !1;
|
|
587
586
|
} catch {
|
|
588
587
|
return !1;
|
|
589
588
|
}
|
|
590
589
|
}
|
|
591
|
-
function
|
|
590
|
+
function Ge(a) {
|
|
592
591
|
return a = X(a), Y(a, "json");
|
|
593
592
|
}
|
|
594
|
-
function
|
|
593
|
+
function qe(a) {
|
|
595
594
|
return a = X(a), Y(a, "raw");
|
|
596
595
|
}
|
|
597
|
-
function
|
|
596
|
+
function ue(a, e) {
|
|
598
597
|
return a && typeof a == "string" ? a.startsWith("http") ? a.replace("http://", "https://") : a.startsWith("ipfs://") ? a : `${new URL(e).origin}${a}` : "";
|
|
599
598
|
}
|
|
600
|
-
function
|
|
599
|
+
function Ft(a) {
|
|
601
600
|
return a ? X(a) : null;
|
|
602
601
|
}
|
|
603
602
|
function X(a, e = "https://ipfs.nebula.markets/") {
|
|
604
603
|
return a?.startsWith("ipfs://") ? e + a.substring(7) : a;
|
|
605
604
|
}
|
|
606
|
-
function
|
|
605
|
+
function Je() {
|
|
607
606
|
return `https://${T() ? "testnet." : ""}niftyart.cash/_public/`;
|
|
608
607
|
}
|
|
609
608
|
async function Y(a, e) {
|
|
@@ -620,7 +619,7 @@ async function Y(a, e) {
|
|
|
620
619
|
throw new Error(`Unexpected Error: ${t}`);
|
|
621
620
|
}
|
|
622
621
|
}
|
|
623
|
-
class
|
|
622
|
+
class Gt {
|
|
624
623
|
walletDb;
|
|
625
624
|
rostrumService;
|
|
626
625
|
walletCache;
|
|
@@ -634,21 +633,21 @@ class Jt {
|
|
|
634
633
|
if (c)
|
|
635
634
|
return c;
|
|
636
635
|
}
|
|
637
|
-
const s = await this.rostrumService.getTokenGenesis(e), n =
|
|
636
|
+
const s = await this.rostrumService.getTokenGenesis(e), n = m.hexToBuffer(s.token_id_hex);
|
|
638
637
|
let r = "", o = "";
|
|
639
638
|
if (s.op_return_id == I.NRC2 || s.op_return_id == I.NRC3 || q(e))
|
|
640
639
|
return;
|
|
641
640
|
if (O.isSubgroup(n) && (r = new b(O.getParentGroupId(n), k.defaultNetwork, E.GroupIdAddress).toString()), s.document_url)
|
|
642
641
|
try {
|
|
643
642
|
if (s.op_return_id == I.NRC1) {
|
|
644
|
-
const c = await
|
|
643
|
+
const c = await qe(s.document_url), u = (await Ve.loadAsync(c)).file("info.json");
|
|
645
644
|
if (u) {
|
|
646
645
|
const l = await u.async("string"), h = JSON.parse(l);
|
|
647
|
-
o =
|
|
646
|
+
o = ue(h[0]?.icon, s.document_url);
|
|
648
647
|
}
|
|
649
648
|
} else {
|
|
650
|
-
const c = await
|
|
651
|
-
o =
|
|
649
|
+
const c = await Ge(s.document_url);
|
|
650
|
+
o = ue(c[0]?.icon, s.document_url);
|
|
652
651
|
}
|
|
653
652
|
} catch (c) {
|
|
654
653
|
console.error("Failed to load metadata", c);
|
|
@@ -679,7 +678,7 @@ class Jt {
|
|
|
679
678
|
async getAssetInfo(e) {
|
|
680
679
|
let t = await this.getTokenInfo(e);
|
|
681
680
|
return t || await this.isNftToken(e) && (t = {
|
|
682
|
-
token:
|
|
681
|
+
token: ce(e),
|
|
683
682
|
tokenIdHex: S(e),
|
|
684
683
|
decimals: 0
|
|
685
684
|
}), t;
|
|
@@ -702,7 +701,7 @@ class Jt {
|
|
|
702
701
|
const i = new b(o.subarray(0, 32), k.defaultNetwork, E.GroupIdAddress).toString(), c = await this.rostrumService.getTokenGenesis(i);
|
|
703
702
|
c?.op_return_id == I.NRC2 && await this.saveNft(e, t, r.document_url ?? "", i, s, c?.name ?? "");
|
|
704
703
|
}
|
|
705
|
-
} else q(t) && await this.saveNft(e, t, "nifty",
|
|
704
|
+
} else q(t) && await this.saveNft(e, t, "nifty", me().token, s, "");
|
|
706
705
|
}
|
|
707
706
|
async saveNft(e, t, s, n, r, o) {
|
|
708
707
|
if (s)
|
|
@@ -714,7 +713,7 @@ class Jt {
|
|
|
714
713
|
addedTime: r
|
|
715
714
|
}, c = {
|
|
716
715
|
parentGroup: n,
|
|
717
|
-
token:
|
|
716
|
+
token: ce(t),
|
|
718
717
|
tokenIdHex: t,
|
|
719
718
|
source: s,
|
|
720
719
|
collection: o
|
|
@@ -742,7 +741,7 @@ class Jt {
|
|
|
742
741
|
}
|
|
743
742
|
}
|
|
744
743
|
}
|
|
745
|
-
class
|
|
744
|
+
class qt {
|
|
746
745
|
rostrumService;
|
|
747
746
|
keyManager;
|
|
748
747
|
walletDb;
|
|
@@ -761,7 +760,7 @@ class zt {
|
|
|
761
760
|
return { txs: r, lastHeight: s };
|
|
762
761
|
}
|
|
763
762
|
async fetchVaultTransactions(e) {
|
|
764
|
-
const t = await this.rostrumService.getTransactionsHistory(e,
|
|
763
|
+
const t = await this.rostrumService.getTransactionsHistory(e, Le), s = [];
|
|
765
764
|
for (const n of t) {
|
|
766
765
|
const r = this.classifyTransaction(n.tx_hash, [e]);
|
|
767
766
|
s.push(r);
|
|
@@ -847,7 +846,7 @@ class zt {
|
|
|
847
846
|
throw new Error("Invalid Address.");
|
|
848
847
|
if (s && BigInt(t) < 1n || !s && parseInt(t) < B.DUST_AMOUNT)
|
|
849
848
|
throw new Error("The amount is too low.");
|
|
850
|
-
if (s && BigInt(t) >
|
|
849
|
+
if (s && BigInt(t) > oe || !s && parseInt(t) > B.MAX_MONEY)
|
|
851
850
|
throw new Error("The amount is too high.");
|
|
852
851
|
const r = new Q();
|
|
853
852
|
if (n && r.addData(n), s) {
|
|
@@ -935,7 +934,7 @@ class zt {
|
|
|
935
934
|
const p = this.keyManager.getKey(u.keyPath);
|
|
936
935
|
c.set(u.address, p.privateKey);
|
|
937
936
|
}
|
|
938
|
-
if (d >
|
|
937
|
+
if (d > oe)
|
|
939
938
|
throw new Error("Token inputs exceeded max amount. Consider sending in small chunks");
|
|
940
939
|
if (e.transaction.inputs.length > this.MAX_INPUTS_OUTPUTS)
|
|
941
940
|
throw new Error("Too many inputs. Consider consolidating transactions or reduce the send amount.");
|
|
@@ -961,34 +960,36 @@ class zt {
|
|
|
961
960
|
return JSON.stringify(t, null, 2);
|
|
962
961
|
}
|
|
963
962
|
}
|
|
964
|
-
function
|
|
965
|
-
return
|
|
963
|
+
function Jt(a = 12) {
|
|
964
|
+
return Ue(fe, a === 24 ? 256 : 128);
|
|
966
965
|
}
|
|
967
|
-
function
|
|
968
|
-
return
|
|
966
|
+
function ze(a) {
|
|
967
|
+
return De(a, fe);
|
|
969
968
|
}
|
|
970
|
-
async function
|
|
969
|
+
async function ye(a, e) {
|
|
971
970
|
let t = performance.now();
|
|
972
|
-
const s = await
|
|
971
|
+
const s = await ne(a, e, { t: 2, m: 19456, p: 1, dkLen: 32 });
|
|
973
972
|
console.log(performance.now() - t);
|
|
974
973
|
let n = performance.now();
|
|
975
|
-
await
|
|
974
|
+
await re(ie, a, e, { c: 21e4, dkLen: 32 }), console.log(performance.now() - n);
|
|
976
975
|
let r = performance.now();
|
|
977
|
-
|
|
976
|
+
await re(ie, a, e, { c: 1e5, dkLen: 32 }), console.log(performance.now() - r);
|
|
977
|
+
let o = performance.now();
|
|
978
|
+
return await ne(a, e, { t: 4, m: 9216, p: 1, dkLen: 32 }), console.log(performance.now() - o), s;
|
|
978
979
|
}
|
|
979
|
-
async function
|
|
980
|
-
const t =
|
|
981
|
-
return
|
|
980
|
+
async function zt(a, e) {
|
|
981
|
+
const t = m.getRandomBuffer(16), s = m.getRandomBuffer(12), n = m.utf8ToBuffer(a), r = await ye(e, t), o = he(r, s).encrypt(n), i = m.concat([t, s, o]);
|
|
982
|
+
return m.bufferToBase64(i);
|
|
982
983
|
}
|
|
983
|
-
async function
|
|
984
|
-
const t =
|
|
985
|
-
return
|
|
984
|
+
async function We(a, e) {
|
|
985
|
+
const t = m.base64ToBuffer(a), s = t.subarray(0, 16), n = t.subarray(16, 28), r = t.subarray(28), o = await ye(e, s), i = he(o, n).decrypt(r);
|
|
986
|
+
return m.bufferToUtf8(i);
|
|
986
987
|
}
|
|
987
|
-
async function
|
|
988
|
+
async function Wt(a, e) {
|
|
988
989
|
try {
|
|
989
990
|
if (a) {
|
|
990
|
-
const t = await
|
|
991
|
-
if (t &&
|
|
991
|
+
const t = await We(a, e);
|
|
992
|
+
if (t && ze(t))
|
|
992
993
|
return t;
|
|
993
994
|
}
|
|
994
995
|
return !1;
|
|
@@ -996,7 +997,7 @@ async function $t(a, e) {
|
|
|
996
997
|
return !1;
|
|
997
998
|
}
|
|
998
999
|
}
|
|
999
|
-
const
|
|
1000
|
+
const we = {
|
|
1000
1001
|
usd: "$",
|
|
1001
1002
|
eur: "€",
|
|
1002
1003
|
gbp: "£",
|
|
@@ -1005,46 +1006,46 @@ const ge = {
|
|
|
1005
1006
|
aud: "A$",
|
|
1006
1007
|
cad: "C$",
|
|
1007
1008
|
chf: "Fr"
|
|
1008
|
-
},
|
|
1009
|
-
async function
|
|
1010
|
-
const a =
|
|
1009
|
+
}, ve = Object.keys(we);
|
|
1010
|
+
async function je() {
|
|
1011
|
+
const a = ve.join(","), e = await fetch(`https://api.coingecko.com/api/v3/simple/price?ids=nexacoin&include_24hr_change=true&vs_currencies=${a}`);
|
|
1011
1012
|
if (!e.ok)
|
|
1012
1013
|
throw new Error("Failed to fetch price");
|
|
1013
1014
|
return (await e.json()).nexacoin || {};
|
|
1014
1015
|
}
|
|
1015
|
-
function
|
|
1016
|
-
return
|
|
1016
|
+
function jt(a) {
|
|
1017
|
+
return we[a] || a;
|
|
1017
1018
|
}
|
|
1018
|
-
function
|
|
1019
|
+
function Ae() {
|
|
1019
1020
|
const a = {};
|
|
1020
|
-
return
|
|
1021
|
+
return ve.forEach((e) => {
|
|
1021
1022
|
a[e] = { value: 0, change: 0 };
|
|
1022
1023
|
}), a;
|
|
1023
1024
|
}
|
|
1024
|
-
function
|
|
1025
|
+
function $e() {
|
|
1025
1026
|
return A.empty().add(v.OP_FROMALTSTACK).add(v.OP_DROP).add(v.OP_FROMALTSTACK).add(v.OP_CHECKLOCKTIMEVERIFY).add(v.OP_DROP).add(v.OP_FROMALTSTACK).add(v.OP_CHECKSIGVERIFY);
|
|
1026
1027
|
}
|
|
1027
|
-
function
|
|
1028
|
-
const a =
|
|
1028
|
+
function Xe() {
|
|
1029
|
+
const a = $e();
|
|
1029
1030
|
return U.sha256ripemd160(a.toBuffer());
|
|
1030
1031
|
}
|
|
1031
|
-
function
|
|
1032
|
+
function Ye(a) {
|
|
1032
1033
|
return A.empty().add(a.toBuffer());
|
|
1033
1034
|
}
|
|
1034
|
-
function
|
|
1035
|
-
const e =
|
|
1035
|
+
function Ze(a) {
|
|
1036
|
+
const e = Ye(a);
|
|
1036
1037
|
return U.sha256ripemd160(e.toBuffer());
|
|
1037
1038
|
}
|
|
1038
|
-
function
|
|
1039
|
+
function Qe(a) {
|
|
1039
1040
|
return a.map((e) => e <= 16 ? J.smallInt(e) : z.fromNumber(e).toScriptNumBuffer());
|
|
1040
1041
|
}
|
|
1041
|
-
function
|
|
1042
|
+
function et(a, e) {
|
|
1042
1043
|
if (e.length !== 2)
|
|
1043
1044
|
return;
|
|
1044
|
-
const t =
|
|
1045
|
+
const t = Xe(), s = Ze(a), n = Qe(e);
|
|
1045
1046
|
return b.fromScriptTemplate(t, s, n).toString();
|
|
1046
1047
|
}
|
|
1047
|
-
class
|
|
1048
|
+
class $t {
|
|
1048
1049
|
walletDb;
|
|
1049
1050
|
keyManager;
|
|
1050
1051
|
providers;
|
|
@@ -1085,7 +1086,7 @@ class Yt {
|
|
|
1085
1086
|
return;
|
|
1086
1087
|
let c;
|
|
1087
1088
|
try {
|
|
1088
|
-
c = new
|
|
1089
|
+
c = new Re(i.uri);
|
|
1089
1090
|
const d = c.getSessionInfo();
|
|
1090
1091
|
await c.connect(3e3);
|
|
1091
1092
|
const u = await c.getAppInfo(2e3);
|
|
@@ -1152,7 +1153,7 @@ class Yt {
|
|
|
1152
1153
|
this.handlers.set(r, { resolve: i, reject: c }), this.notify({ type: "new_request", request: { type: r, accountId: e.id, sessionId: s, request: o } });
|
|
1153
1154
|
});
|
|
1154
1155
|
t.onSignMessage((r) => n(_.SignMessage, r)), t.onAddToken((r) => n(_.AddToken, r)), t.onSendTransaction((r) => n(_.SendTransaction, r)), t.onSignTransaction((r) => n(_.SignTransaction, r)), t.onGetAccount(() => {
|
|
1155
|
-
const r = { account: f.DAPP, type:
|
|
1156
|
+
const r = { account: f.DAPP, type: y.RECEIVE, index: e.id };
|
|
1156
1157
|
return {
|
|
1157
1158
|
name: e.name,
|
|
1158
1159
|
address: e.address,
|
|
@@ -1169,7 +1170,7 @@ class Yt {
|
|
|
1169
1170
|
});
|
|
1170
1171
|
}
|
|
1171
1172
|
}
|
|
1172
|
-
class
|
|
1173
|
+
class Xt {
|
|
1173
1174
|
rostrumService;
|
|
1174
1175
|
keyManager;
|
|
1175
1176
|
assetService;
|
|
@@ -1210,10 +1211,10 @@ class Zt {
|
|
|
1210
1211
|
await Promise.all(t);
|
|
1211
1212
|
}
|
|
1212
1213
|
async processInput(e, t) {
|
|
1213
|
-
const s = e.txDetails.tx.inputs[t], n = await this.rostrumService.getUtxo(
|
|
1214
|
+
const s = e.txDetails.tx.inputs[t], n = await this.rostrumService.getUtxo(m.bufferToHex(s.outpoint));
|
|
1214
1215
|
if (n.status == "spent")
|
|
1215
1216
|
throw new Error("Input UTXO is already spent.");
|
|
1216
|
-
if (s.output = new
|
|
1217
|
+
if (s.output = new Me(n.amount, n.scriptpubkey), s.output.address == e.address) {
|
|
1217
1218
|
const r = n.token_id_hex || "NEXA";
|
|
1218
1219
|
e.myInputs.set(t, {
|
|
1219
1220
|
address: e.address,
|
|
@@ -1246,7 +1247,7 @@ class Zt {
|
|
|
1246
1247
|
if (s.scriptSig.isEmpty()) {
|
|
1247
1248
|
e.allMyOutputsCovered = !0;
|
|
1248
1249
|
const r = te.sign(e.txDetails.tx, t, se.ALL, n, e.privateKey).toTxFormat(), o = A.empty().add(e.privateKey.publicKey.toBuffer());
|
|
1249
|
-
s.scriptSig =
|
|
1250
|
+
s.scriptSig = Be.buildScriptTemplateIn(void 0, o, A.empty().add(r));
|
|
1250
1251
|
} else {
|
|
1251
1252
|
const r = s.scriptSig.findPlaceholder(), i = s.scriptSig.chunks[r].buf.subarray(64), c = se.fromBuffer(i);
|
|
1252
1253
|
this.processSignatureCoverage(e, c);
|
|
@@ -1267,7 +1268,7 @@ class Zt {
|
|
|
1267
1268
|
if (!e.scriptSig.isScriptTemplateIn())
|
|
1268
1269
|
throw new Error("Unsupported input script type.");
|
|
1269
1270
|
const t = e.output.scriptPubKey.getTemplateHash(), s = e.scriptSig.chunks[0].buf;
|
|
1270
|
-
if (
|
|
1271
|
+
if (m.equals(t, U.sha256ripemd160(s)) || m.equals(t, U.sha256sha256(s)))
|
|
1271
1272
|
return A.fromBuffer(s);
|
|
1272
1273
|
throw new Error("Invalid input script template.");
|
|
1273
1274
|
}
|
|
@@ -1309,8 +1310,8 @@ class Zt {
|
|
|
1309
1310
|
}
|
|
1310
1311
|
}
|
|
1311
1312
|
}
|
|
1312
|
-
const
|
|
1313
|
-
class
|
|
1313
|
+
const tt = 274710, st = "0014461ad25081cb0119d034385ff154c8d3ad6bdd76";
|
|
1314
|
+
class at {
|
|
1314
1315
|
rostrumService;
|
|
1315
1316
|
keyManager;
|
|
1316
1317
|
constructor(e, t) {
|
|
@@ -1343,16 +1344,16 @@ class nt {
|
|
|
1343
1344
|
}), n;
|
|
1344
1345
|
}
|
|
1345
1346
|
async checkVaultsForAddress(e) {
|
|
1346
|
-
const t = /* @__PURE__ */ new Set(), s = await this.rostrumService.getTransactionsHistory(e,
|
|
1347
|
+
const t = /* @__PURE__ */ new Set(), s = await this.rostrumService.getTransactionsHistory(e, tt);
|
|
1347
1348
|
for (const n of s) {
|
|
1348
|
-
const o = (await this.rostrumService.getTransaction(n.tx_hash)).vout.filter((i) => i.scriptPubKey.hex.startsWith(
|
|
1349
|
+
const o = (await this.rostrumService.getTransaction(n.tx_hash)).vout.filter((i) => i.scriptPubKey.hex.startsWith(st));
|
|
1349
1350
|
for (const i of o)
|
|
1350
1351
|
t.add(i.scriptPubKey.hex);
|
|
1351
1352
|
}
|
|
1352
1353
|
return t;
|
|
1353
1354
|
}
|
|
1354
1355
|
parseVaultDetails(e) {
|
|
1355
|
-
const t = A.fromHex(e), s = new
|
|
1356
|
+
const t = A.fromHex(e), s = new _e().writeVarLengthBuf(t.toBuffer()).toBuffer(), n = new b(s).toString(), r = t.getVisibleArgs(), o = z.fromScriptNumBuffer(r.chunks[0].buf).toNumber(), i = J.isSmallIntOp(r.chunks[1].opcodenum) ? J.decodeOP_N(r.chunks[1].opcodenum) : z.fromScriptNumBuffer(r.chunks[1].buf).toNumber(), c = [o, i], d = this.keyManager.getKey({ account: f.VAULT, type: y.RECEIVE, index: i }), u = et(d.publicKey, c);
|
|
1356
1357
|
return n != u ? void 0 : {
|
|
1357
1358
|
address: n,
|
|
1358
1359
|
block: o,
|
|
@@ -1367,7 +1368,7 @@ class nt {
|
|
|
1367
1368
|
}
|
|
1368
1369
|
class N {
|
|
1369
1370
|
constructor(e, t, s, n, r, o, i) {
|
|
1370
|
-
this.keyManager = e, this.kvStore = t, this.walletDb = s, this.rostrumService = n, this.assetService = r, this.transactionService = o, this.sessionManager = i, this.discoveryService = new
|
|
1371
|
+
this.keyManager = e, this.kvStore = t, this.walletDb = s, this.rostrumService = n, this.assetService = r, this.transactionService = o, this.sessionManager = i, this.discoveryService = new at(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();
|
|
1371
1372
|
}
|
|
1372
1373
|
static GAP_LIMIT = 20;
|
|
1373
1374
|
static DEBOUNCE_MS = 1e3;
|
|
@@ -1427,8 +1428,8 @@ class N {
|
|
|
1427
1428
|
}
|
|
1428
1429
|
async discoverWallet() {
|
|
1429
1430
|
this.notify({ type: "discover_wallet", loading: !0 });
|
|
1430
|
-
const e = this.discoveryService.discoverWalletIndex(f.MAIN,
|
|
1431
|
-
this.receiveAddresses = this.deriveAddresses(
|
|
1431
|
+
const e = this.discoveryService.discoverWalletIndex(f.MAIN, y.RECEIVE), t = this.discoveryService.discoverWalletIndex(f.MAIN, y.CHANGE), s = this.discoveryService.discoverWalletIndex(f.DAPP, y.RECEIVE), [n, r, o] = await Promise.all([e, t, s]);
|
|
1432
|
+
this.receiveAddresses = this.deriveAddresses(y.RECEIVE, 0, n + N.GAP_LIMIT), this.changeAddresses = this.deriveAddresses(y.CHANGE, 0, r + N.GAP_LIMIT), this.accounts = this.deriveAccounts(0, o + 1), this.accounts.forEach((i) => this.accountsAddressToId.set(i.address, i.id)), await this.saveAddresses(this.receiveAddresses), await this.saveAddresses(this.changeAddresses), await this.saveAccounts(this.accounts), this.initState(), await this.initialSync(), this.notify({ type: "discover_wallet", loading: !1 }), this.notify({ type: "load_wallet", loading: !1 }), await this.rescanVaults();
|
|
1432
1433
|
}
|
|
1433
1434
|
async loadWallet() {
|
|
1434
1435
|
this.receiveAddresses = await this.walletDb.getReceiveAddresses(), this.changeAddresses = await this.walletDb.getChangeAddresses();
|
|
@@ -1459,7 +1460,7 @@ class N {
|
|
|
1459
1460
|
id: g,
|
|
1460
1461
|
name: "Main Wallet",
|
|
1461
1462
|
address: this.getReceiveAddress(),
|
|
1462
|
-
balance:
|
|
1463
|
+
balance: de(e.map((t) => t.balance)),
|
|
1463
1464
|
tokensBalance: G(e.map((t) => t.tokensBalance)),
|
|
1464
1465
|
tokens: [],
|
|
1465
1466
|
sessions: {}
|
|
@@ -1601,8 +1602,8 @@ class N {
|
|
|
1601
1602
|
for (const { txs: i } of e)
|
|
1602
1603
|
for (const c of i)
|
|
1603
1604
|
t.set(c.tx_hash, c);
|
|
1604
|
-
await this.checkGapLimit(
|
|
1605
|
-
const s = this.getMainAddresses(), n =
|
|
1605
|
+
await this.checkGapLimit(y.RECEIVE), await this.checkGapLimit(y.CHANGE);
|
|
1606
|
+
const s = this.getMainAddresses(), n = de(s.map((i) => i.balance)), r = G(s.map((i) => i.tokensBalance));
|
|
1606
1607
|
this.notify({ type: "account_balance_updated", accountId: g, balance: n, tokensBalance: r }), this.notify({ type: "main_address_updated", address: this.getReceiveAddress() });
|
|
1607
1608
|
const o = this.assetService.syncNfts(g, r);
|
|
1608
1609
|
for (const i of t.values())
|
|
@@ -1636,12 +1637,12 @@ class N {
|
|
|
1636
1637
|
return e.height = s.lastHeight, await this.walletDb.saveVault(e), this.notify({ type: "vault_balance_updated", address: e.address, balance: e.balance }), { address: e, txs: s.txs };
|
|
1637
1638
|
}
|
|
1638
1639
|
async checkGapLimit(e) {
|
|
1639
|
-
const t = e ===
|
|
1640
|
+
const t = e === y.RECEIVE ? this.receiveAddresses : this.changeAddresses, s = e === y.RECEIVE ? "Receive" : "Change", n = t.filter((r) => !r.used).length;
|
|
1640
1641
|
if (n < N.GAP_LIMIT) {
|
|
1641
1642
|
const r = N.GAP_LIMIT - n, o = t[t.length - 1].idx;
|
|
1642
1643
|
console.log(`Deriving ${r} more ${s} addresses...`);
|
|
1643
1644
|
const i = this.deriveAddresses(e, o + 1, r);
|
|
1644
|
-
e ===
|
|
1645
|
+
e === y.RECEIVE ? this.receiveAddresses.push(...i) : this.changeAddresses.push(...i), await this.saveAddresses(i), await this.subscribeAddresses(i);
|
|
1645
1646
|
}
|
|
1646
1647
|
}
|
|
1647
1648
|
async addNewAccount(e, t) {
|
|
@@ -1729,12 +1730,12 @@ class N {
|
|
|
1729
1730
|
return e.type == f.MAIN;
|
|
1730
1731
|
}
|
|
1731
1732
|
}
|
|
1732
|
-
const
|
|
1733
|
+
const nt = {
|
|
1733
1734
|
isWalletExist: !1,
|
|
1734
1735
|
isAuthorized: !1
|
|
1735
|
-
},
|
|
1736
|
+
}, Se = M({
|
|
1736
1737
|
name: "auth",
|
|
1737
|
-
initialState:
|
|
1738
|
+
initialState: nt,
|
|
1738
1739
|
reducers: {
|
|
1739
1740
|
setWalletExist: (a, e) => {
|
|
1740
1741
|
a.isWalletExist = e.payload;
|
|
@@ -1743,12 +1744,12 @@ const rt = {
|
|
|
1743
1744
|
a.isAuthorized = e.payload;
|
|
1744
1745
|
}
|
|
1745
1746
|
}
|
|
1746
|
-
}),
|
|
1747
|
+
}), Yt = Se.actions, rt = Se.reducer, it = {
|
|
1747
1748
|
modalType: null,
|
|
1748
1749
|
currentRequest: null
|
|
1749
|
-
},
|
|
1750
|
+
}, be = M({
|
|
1750
1751
|
name: "dappModal",
|
|
1751
|
-
initialState:
|
|
1752
|
+
initialState: it,
|
|
1752
1753
|
reducers: {
|
|
1753
1754
|
showRequest(a, e) {
|
|
1754
1755
|
a.modalType = e.payload.type, a.currentRequest = e.payload;
|
|
@@ -1757,24 +1758,24 @@ const rt = {
|
|
|
1757
1758
|
a.modalType = null, a.currentRequest = null;
|
|
1758
1759
|
}
|
|
1759
1760
|
}
|
|
1760
|
-
}),
|
|
1761
|
+
}), Zt = be.actions, ot = be.reducer, ct = {
|
|
1761
1762
|
counter: 0,
|
|
1762
1763
|
loading: !1
|
|
1763
|
-
},
|
|
1764
|
+
}, ke = M({
|
|
1764
1765
|
name: "loader",
|
|
1765
|
-
initialState:
|
|
1766
|
+
initialState: ct,
|
|
1766
1767
|
reducers: {
|
|
1767
1768
|
setLoader: (a, e) => {
|
|
1768
1769
|
const t = e.payload.loading ? a.counter + 1 : Math.max(0, a.counter - 1);
|
|
1769
1770
|
a.counter = t, a.loading = t > 0, a.text = e.payload.text;
|
|
1770
1771
|
}
|
|
1771
1772
|
}
|
|
1772
|
-
}),
|
|
1773
|
+
}), Qt = ke.actions, dt = ke.reducer, ut = {
|
|
1773
1774
|
wallet: {},
|
|
1774
1775
|
web3: {}
|
|
1775
|
-
},
|
|
1776
|
+
}, Te = M({
|
|
1776
1777
|
name: "notifications",
|
|
1777
|
-
initialState:
|
|
1778
|
+
initialState: ut,
|
|
1778
1779
|
reducers: {
|
|
1779
1780
|
addNotification: (a, e) => {
|
|
1780
1781
|
e.payload.type == "wallet" ? a.wallet[e.payload.id] = e.payload : e.payload.type == "web3" && (a.web3[e.payload.id] = e.payload);
|
|
@@ -1786,16 +1787,16 @@ const rt = {
|
|
|
1786
1787
|
e.payload === "wallet" ? a.wallet = {} : e.payload === "web3" ? a.web3 = {} : e.payload === "all" && (a.wallet = {}, a.web3 = {});
|
|
1787
1788
|
}
|
|
1788
1789
|
}
|
|
1789
|
-
}),
|
|
1790
|
+
}), es = Te.actions, lt = Te.reducer, ht = {
|
|
1790
1791
|
status: "Offline",
|
|
1791
1792
|
height: 0,
|
|
1792
|
-
price:
|
|
1793
|
+
price: Ae(),
|
|
1793
1794
|
hasNetwork: !0,
|
|
1794
1795
|
isSuspended: !1
|
|
1795
|
-
},
|
|
1796
|
-
const a =
|
|
1796
|
+
}, le = He("status/fetchPrice", async () => {
|
|
1797
|
+
const a = Ae();
|
|
1797
1798
|
try {
|
|
1798
|
-
const e = await
|
|
1799
|
+
const e = await je();
|
|
1799
1800
|
Object.keys(e).forEach((t) => {
|
|
1800
1801
|
a[t] = {
|
|
1801
1802
|
value: e[t],
|
|
@@ -1805,9 +1806,9 @@ const rt = {
|
|
|
1805
1806
|
} catch {
|
|
1806
1807
|
}
|
|
1807
1808
|
return a;
|
|
1808
|
-
}),
|
|
1809
|
+
}), Ie = M({
|
|
1809
1810
|
name: "status",
|
|
1810
|
-
initialState:
|
|
1811
|
+
initialState: ht,
|
|
1811
1812
|
reducers: {
|
|
1812
1813
|
setHeight: (a, e) => {
|
|
1813
1814
|
e.payload > 0 && (a.status = "Online"), a.height = e.payload;
|
|
@@ -1823,13 +1824,13 @@ const rt = {
|
|
|
1823
1824
|
}
|
|
1824
1825
|
},
|
|
1825
1826
|
extraReducers: (a) => {
|
|
1826
|
-
a.addCase(
|
|
1827
|
+
a.addCase(le.fulfilled, (e, t) => {
|
|
1827
1828
|
e.price = t.payload;
|
|
1828
|
-
}).addCase(
|
|
1829
|
+
}).addCase(le.rejected, (e, t) => {
|
|
1829
1830
|
console.error(t.error.message);
|
|
1830
1831
|
});
|
|
1831
1832
|
}
|
|
1832
|
-
}),
|
|
1833
|
+
}), ts = Ie.actions, ft = Ie.reducer, pt = {
|
|
1833
1834
|
isAuthorized: !1,
|
|
1834
1835
|
selectedAccount: g,
|
|
1835
1836
|
accounts: {
|
|
@@ -1848,9 +1849,9 @@ const rt = {
|
|
|
1848
1849
|
initLoad: !0,
|
|
1849
1850
|
txUpdateTrigger: 0,
|
|
1850
1851
|
nftsUpdateTrigger: 0
|
|
1851
|
-
},
|
|
1852
|
+
}, xe = M({
|
|
1852
1853
|
name: "wallet",
|
|
1853
|
-
initialState:
|
|
1854
|
+
initialState: pt,
|
|
1854
1855
|
reducers: {
|
|
1855
1856
|
setInitLoad: (a, e) => {
|
|
1856
1857
|
a.initLoad = e.payload;
|
|
@@ -1906,108 +1907,108 @@ const rt = {
|
|
|
1906
1907
|
a.accounts[e.payload.accountId].sessions = {};
|
|
1907
1908
|
}
|
|
1908
1909
|
}
|
|
1909
|
-
}),
|
|
1910
|
-
loader:
|
|
1911
|
-
dapp:
|
|
1912
|
-
status:
|
|
1913
|
-
wallet:
|
|
1914
|
-
auth:
|
|
1915
|
-
notifications:
|
|
1916
|
-
}, w =
|
|
1910
|
+
}), ss = xe.actions, gt = xe.reducer, as = {
|
|
1911
|
+
loader: dt,
|
|
1912
|
+
dapp: ot,
|
|
1913
|
+
status: ft,
|
|
1914
|
+
wallet: gt,
|
|
1915
|
+
auth: rt,
|
|
1916
|
+
notifications: lt
|
|
1917
|
+
}, w = Ke.withTypes(), ns = () => w((a) => a.auth), rs = () => w((a) => a.status.height), is = (a) => w((e) => e.wallet.accounts[a]), os = () => w((a) => a.wallet.selectedAccount), cs = () => w((a) => Math.max(...Object.keys(a.wallet.accounts).map(Number))), ds = (a) => w((e) => e.wallet.accounts[a].address), us = (a) => w((e) => e.wallet.accounts[a].balance), ls = (a, e) => w((t) => t.wallet.accounts[a].tokensBalance[e]), hs = (a, e) => w((t) => t.wallet.accounts[a].sessions[e]), fs = () => w((a) => a.wallet.vaults), Ne = j(
|
|
1917
1918
|
[(a) => a.notifications.wallet],
|
|
1918
1919
|
(a) => Object.values(a).sort((e, t) => t.createdAt - e.createdAt)
|
|
1919
|
-
),
|
|
1920
|
+
), Ee = j(
|
|
1920
1921
|
[(a) => a.notifications.web3],
|
|
1921
1922
|
(a) => Object.values(a).sort((e, t) => t.createdAt - e.createdAt)
|
|
1922
1923
|
), mt = j(
|
|
1923
|
-
[
|
|
1924
|
+
[Ne, Ee],
|
|
1924
1925
|
(a, e) => [...a, ...e].sort((t, s) => s.createdAt - t.createdAt)
|
|
1925
|
-
),
|
|
1926
|
+
), ps = () => w(Ne), gs = () => w(Ee), ms = () => w(mt);
|
|
1926
1927
|
export {
|
|
1927
1928
|
f as AccountType,
|
|
1928
|
-
|
|
1929
|
+
Gt as AssetService,
|
|
1929
1930
|
V as AssetType,
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1931
|
+
Vt as KVStore,
|
|
1932
|
+
Kt as KeyManager,
|
|
1933
|
+
y as KeySpace,
|
|
1933
1934
|
g as MAIN_WALLET_ID,
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1935
|
+
oe as MAX_INT64,
|
|
1936
|
+
ge as RostrumService,
|
|
1937
|
+
$t as SessionManager,
|
|
1937
1938
|
_ as SessionRequestType,
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1939
|
+
qt as TransactionService,
|
|
1940
|
+
Xt as TransactionTransformer,
|
|
1941
|
+
Le as VAULT_FIRST_BLOCK,
|
|
1942
|
+
Mt as VAULT_SCRIPT_PREFIX,
|
|
1943
|
+
Ht as WalletCache,
|
|
1944
|
+
Rt as WalletDB,
|
|
1944
1945
|
N as WalletManager,
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1946
|
+
Yt as authActions,
|
|
1947
|
+
rt as authReducer,
|
|
1948
|
+
Ot as capitalizeFirstLetter,
|
|
1949
|
+
ve as currencies,
|
|
1949
1950
|
$ as currentTimestamp,
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1951
|
+
Zt as dappModalActions,
|
|
1952
|
+
ot as dappModalReducer,
|
|
1953
|
+
zt as encryptMnemonic,
|
|
1954
|
+
Ct as estimateDateByFutureBlock,
|
|
1955
|
+
qe as fetchAssetBlob,
|
|
1956
|
+
Ge as fetchAssetDoc,
|
|
1957
|
+
Lt as fetchNiftyNFT,
|
|
1958
|
+
le as fetchPrice,
|
|
1959
|
+
Jt as generateNewMnemonic,
|
|
1960
|
+
et as generateVaultAddress,
|
|
1961
|
+
Ye as generateVaultConstraint,
|
|
1962
|
+
Qe as generateVaultVisibleArgs,
|
|
1962
1963
|
R as getAddressBuffer,
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1964
|
+
jt as getCurrencySymbol,
|
|
1965
|
+
_t as getExplorerUrl,
|
|
1966
|
+
Ut as getFileMediaType,
|
|
1967
|
+
Dt as getFileMimeType,
|
|
1968
|
+
je as getNexaPrices,
|
|
1969
|
+
me as getNiftyToken,
|
|
1970
|
+
Ze as getVaultConstraintHash,
|
|
1971
|
+
$e as getVaultTemplate,
|
|
1972
|
+
Xe as getVaultTemplateHash,
|
|
1973
|
+
Ae as initializePrices,
|
|
1974
|
+
Bt as isGenesisHashValid,
|
|
1975
|
+
ze as isMnemonicValid,
|
|
1975
1976
|
q as isNiftySubgroup,
|
|
1976
1977
|
C as isNullOrEmpty,
|
|
1977
1978
|
T as isTestnet,
|
|
1978
1979
|
F as isValidNexaAddress,
|
|
1979
1980
|
x as keyPathToString,
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1981
|
+
Qt as loaderActions,
|
|
1982
|
+
dt as loaderReducer,
|
|
1983
|
+
es as notificationsActions,
|
|
1984
|
+
lt as notificationsReducer,
|
|
1985
|
+
Ft as parseTokenDataUrl,
|
|
1986
|
+
as as sharedReducers,
|
|
1987
|
+
ts as statusActions,
|
|
1988
|
+
ft as statusReducer,
|
|
1989
|
+
Fe as stringToKeyPath,
|
|
1990
|
+
de as sumBalance,
|
|
1990
1991
|
G as sumTokensBalance,
|
|
1991
1992
|
D as tokenAmountToAssetAmount,
|
|
1992
|
-
|
|
1993
|
+
ce as tokenHexToAddr,
|
|
1993
1994
|
S as tokenIdToHex,
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
1995
|
+
ue as transformTokenIconUrl,
|
|
1996
|
+
Pt as truncateStringMiddle,
|
|
1997
|
+
is as useAccount,
|
|
1998
|
+
ms as useAllNotifications,
|
|
1999
|
+
ns as useAuth,
|
|
2000
|
+
rs as useBlockHeight,
|
|
2001
|
+
hs as useDAppSession,
|
|
2002
|
+
cs as useLastAccountId,
|
|
2003
|
+
ds as useMainReceiveAddress,
|
|
2004
|
+
os as useSelectedAccount,
|
|
2005
|
+
ls as useTokenBalance,
|
|
2006
|
+
fs as useVaults,
|
|
2007
|
+
us as useWalletBalance,
|
|
2008
|
+
ps as useWalletNotifications,
|
|
2009
|
+
gs as useWeb3Notifications,
|
|
2010
|
+
Wt as validateAndDecryptMnemonic,
|
|
2011
|
+
ss as walletActions,
|
|
2012
|
+
gt as walletReducer
|
|
2012
2013
|
};
|
|
2013
2014
|
//# sourceMappingURL=index.js.map
|