@otoplo/wallet-common 0.1.4 → 0.1.6
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 +140 -140
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/utils/seed.ts +5 -3
package/dist/index.js
CHANGED
|
@@ -4,41 +4,40 @@ import { mnemonicToSeedSync as _e, generateMnemonic as Ce, validateMnemonic as P
|
|
|
4
4
|
import Oe from "jszip";
|
|
5
5
|
import { DAppProvider as Ue } from "wallet-comms-sdk";
|
|
6
6
|
import { gcm as de } from "@noble/ciphers/aes.js";
|
|
7
|
-
import {
|
|
8
|
-
import { sha256 as Ve } from "@noble/hashes/sha2.js";
|
|
7
|
+
import { argon2idAsync as De } from "@noble/hashes/argon2.js";
|
|
9
8
|
import { wordlist as ue } from "@scure/bip39/wordlists/english.js";
|
|
10
|
-
import { createSlice as M, createAsyncThunk as
|
|
11
|
-
import { useSelector as
|
|
12
|
-
const g = -1, ne = 9223372036854775807n,
|
|
9
|
+
import { createSlice as M, createAsyncThunk as Ve, createSelector as j } from "@reduxjs/toolkit";
|
|
10
|
+
import { useSelector as Re } from "react-redux";
|
|
11
|
+
const g = -1, ne = 9223372036854775807n, He = 274710, It = "0014461ad25081cb0119d034385ff154c8d3ad6bdd76";
|
|
13
12
|
function T() {
|
|
14
13
|
return k.defaultNetwork == k.testnet;
|
|
15
14
|
}
|
|
16
|
-
function
|
|
15
|
+
function xt(a) {
|
|
17
16
|
return T() ? a == "508c843a4b98fb25f57cf9ebafb245a5c16468f06519cdd467059a91e7b79d52" : a == "edc7144fe1ba4edd0edf35d7eea90f6cb1dba42314aa85da8207e97c5339c801";
|
|
18
17
|
}
|
|
19
18
|
function F(a, e = E.PayToScriptTemplate) {
|
|
20
19
|
return b.isValid(a, k.defaultNetwork, e);
|
|
21
20
|
}
|
|
22
|
-
function
|
|
21
|
+
function Nt() {
|
|
23
22
|
return `https://${T() ? "testnet-" : ""}explorer.nexa.org`;
|
|
24
23
|
}
|
|
25
24
|
function $() {
|
|
26
25
|
return Math.floor(Date.now() / 1e3);
|
|
27
26
|
}
|
|
28
|
-
function
|
|
27
|
+
function Et(a, e) {
|
|
29
28
|
const t = (e - a) * 2, s = /* @__PURE__ */ new Date();
|
|
30
29
|
return s.setMinutes(s.getMinutes() + t), s.toLocaleDateString();
|
|
31
30
|
}
|
|
32
31
|
function C(a) {
|
|
33
32
|
return !a || a.length === 0;
|
|
34
33
|
}
|
|
35
|
-
function
|
|
34
|
+
function Mt(a, e = 0) {
|
|
36
35
|
if (!a || a.length <= e)
|
|
37
36
|
return a || "";
|
|
38
37
|
const t = "...", s = Math.floor((e - t.length) / 2), n = a.slice(0, s), i = a.slice(a.length - s);
|
|
39
38
|
return n + t + i;
|
|
40
39
|
}
|
|
41
|
-
function
|
|
40
|
+
function Bt(a) {
|
|
42
41
|
return a.length === 0 ? "" : a.charAt(0).toUpperCase() + a.substring(1);
|
|
43
42
|
}
|
|
44
43
|
function R(a) {
|
|
@@ -89,19 +88,19 @@ const le = {
|
|
|
89
88
|
".wav": { media: "audio", mime: "audio/wav" },
|
|
90
89
|
".m4a": { media: "audio", mime: "audio/mp4" }
|
|
91
90
|
};
|
|
92
|
-
function
|
|
91
|
+
function _t(a) {
|
|
93
92
|
const e = a.lastIndexOf(".");
|
|
94
93
|
if (e === -1) return "unknown";
|
|
95
94
|
const t = a.slice(e).toLowerCase();
|
|
96
95
|
return le[t]?.media ?? "unknown";
|
|
97
96
|
}
|
|
98
|
-
function
|
|
97
|
+
function Ct(a) {
|
|
99
98
|
const e = a.lastIndexOf(".");
|
|
100
99
|
if (e === -1) return "application/octet-stream";
|
|
101
100
|
const t = a.slice(e).toLowerCase();
|
|
102
101
|
return le[t]?.mime ?? "application/octet-stream";
|
|
103
102
|
}
|
|
104
|
-
class
|
|
103
|
+
class Pt {
|
|
105
104
|
getPrefix() {
|
|
106
105
|
return T() ? "testnet-" : "";
|
|
107
106
|
}
|
|
@@ -187,7 +186,7 @@ class Ut {
|
|
|
187
186
|
}
|
|
188
187
|
}
|
|
189
188
|
var f = /* @__PURE__ */ ((a) => (a[a.MAIN = 0] = "MAIN", a[a.VAULT = 1] = "VAULT", a[a.DAPP = 2] = "DAPP", a))(f || {}), m = /* @__PURE__ */ ((a) => (a[a.RECEIVE = 0] = "RECEIVE", a[a.CHANGE = 1] = "CHANGE", a))(m || {}), _ = /* @__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 || {});
|
|
190
|
-
class
|
|
189
|
+
class Ot {
|
|
191
190
|
store;
|
|
192
191
|
updateCallback;
|
|
193
192
|
constructor(e) {
|
|
@@ -361,7 +360,7 @@ class Dt {
|
|
|
361
360
|
return this.store.upsertVault(t);
|
|
362
361
|
}
|
|
363
362
|
}
|
|
364
|
-
class
|
|
363
|
+
class Ut {
|
|
365
364
|
walletDb;
|
|
366
365
|
tokens = /* @__PURE__ */ new Map();
|
|
367
366
|
nfts = /* @__PURE__ */ new Map();
|
|
@@ -529,7 +528,7 @@ class he {
|
|
|
529
528
|
function x(a, e, t) {
|
|
530
529
|
return `${a}'/${e}/${t}`;
|
|
531
530
|
}
|
|
532
|
-
function
|
|
531
|
+
function Ke(a) {
|
|
533
532
|
const e = a.split("/");
|
|
534
533
|
return {
|
|
535
534
|
account: parseInt(e[0].replace("'", "")),
|
|
@@ -537,7 +536,7 @@ function Le(a) {
|
|
|
537
536
|
index: parseInt(e[2])
|
|
538
537
|
};
|
|
539
538
|
}
|
|
540
|
-
class
|
|
539
|
+
class Dt {
|
|
541
540
|
seed;
|
|
542
541
|
masterKey;
|
|
543
542
|
accountKeys = /* @__PURE__ */ new Map();
|
|
@@ -558,7 +557,7 @@ class Rt {
|
|
|
558
557
|
const t = typeof e == "string" ? e : x(e.account, e.type, e.index);
|
|
559
558
|
let s = this.walletKeys.get(t);
|
|
560
559
|
if (!s) {
|
|
561
|
-
const { account: n, type: i, index: o } = typeof e == "string" ?
|
|
560
|
+
const { account: n, type: i, index: o } = typeof e == "string" ? Ke(e) : e;
|
|
562
561
|
s = this.getAccountKey(n).deriveChild(i, !1).deriveChild(o, !1), this.walletKeys.set(t, s);
|
|
563
562
|
}
|
|
564
563
|
return s;
|
|
@@ -575,8 +574,8 @@ function fe() {
|
|
|
575
574
|
decimals: 0
|
|
576
575
|
};
|
|
577
576
|
}
|
|
578
|
-
function
|
|
579
|
-
return Y(
|
|
577
|
+
function Vt(a) {
|
|
578
|
+
return Y(Ge() + a, "raw");
|
|
580
579
|
}
|
|
581
580
|
function q(a) {
|
|
582
581
|
try {
|
|
@@ -586,22 +585,22 @@ function q(a) {
|
|
|
586
585
|
return !1;
|
|
587
586
|
}
|
|
588
587
|
}
|
|
589
|
-
function
|
|
588
|
+
function Le(a) {
|
|
590
589
|
return a = X(a), Y(a, "json");
|
|
591
590
|
}
|
|
592
|
-
function
|
|
591
|
+
function Fe(a) {
|
|
593
592
|
return a = X(a), Y(a, "raw");
|
|
594
593
|
}
|
|
595
594
|
function oe(a, e) {
|
|
596
595
|
return a && typeof a == "string" ? a.startsWith("http") ? a.replace("http://", "https://") : a.startsWith("ipfs://") ? a : `${new URL(e).origin}${a}` : "";
|
|
597
596
|
}
|
|
598
|
-
function
|
|
597
|
+
function Rt(a) {
|
|
599
598
|
return a ? X(a) : null;
|
|
600
599
|
}
|
|
601
600
|
function X(a, e = "https://ipfs.nebula.markets/") {
|
|
602
601
|
return a?.startsWith("ipfs://") ? e + a.substring(7) : a;
|
|
603
602
|
}
|
|
604
|
-
function
|
|
603
|
+
function Ge() {
|
|
605
604
|
return `https://${T() ? "testnet." : ""}niftyart.cash/_public/`;
|
|
606
605
|
}
|
|
607
606
|
async function Y(a, e) {
|
|
@@ -618,7 +617,7 @@ async function Y(a, e) {
|
|
|
618
617
|
throw new Error(`Unexpected Error: ${t}`);
|
|
619
618
|
}
|
|
620
619
|
}
|
|
621
|
-
class
|
|
620
|
+
class Ht {
|
|
622
621
|
walletDb;
|
|
623
622
|
rostrumService;
|
|
624
623
|
walletCache;
|
|
@@ -639,13 +638,13 @@ class Lt {
|
|
|
639
638
|
if (O.isSubgroup(n) && (i = new b(O.getParentGroupId(n), k.defaultNetwork, E.GroupIdAddress).toString()), s.document_url)
|
|
640
639
|
try {
|
|
641
640
|
if (s.op_return_id == I.NRC1) {
|
|
642
|
-
const c = await
|
|
641
|
+
const c = await Fe(s.document_url), u = (await Oe.loadAsync(c)).file("info.json");
|
|
643
642
|
if (u) {
|
|
644
643
|
const l = await u.async("string"), h = JSON.parse(l);
|
|
645
644
|
o = oe(h[0]?.icon, s.document_url);
|
|
646
645
|
}
|
|
647
646
|
} else {
|
|
648
|
-
const c = await
|
|
647
|
+
const c = await Le(s.document_url);
|
|
649
648
|
o = oe(c[0]?.icon, s.document_url);
|
|
650
649
|
}
|
|
651
650
|
} catch (c) {
|
|
@@ -740,7 +739,7 @@ class Lt {
|
|
|
740
739
|
}
|
|
741
740
|
}
|
|
742
741
|
}
|
|
743
|
-
class
|
|
742
|
+
class Kt {
|
|
744
743
|
rostrumService;
|
|
745
744
|
keyManager;
|
|
746
745
|
walletDb;
|
|
@@ -759,7 +758,7 @@ class Ft {
|
|
|
759
758
|
return { txs: i, lastHeight: s };
|
|
760
759
|
}
|
|
761
760
|
async fetchVaultTransactions(e) {
|
|
762
|
-
const t = await this.rostrumService.getTransactionsHistory(e,
|
|
761
|
+
const t = await this.rostrumService.getTransactionsHistory(e, He), s = [];
|
|
763
762
|
for (const n of t) {
|
|
764
763
|
const i = this.classifyTransaction(n.tx_hash, [e]);
|
|
765
764
|
s.push(i);
|
|
@@ -959,28 +958,29 @@ class Ft {
|
|
|
959
958
|
return JSON.stringify(t, null, 2);
|
|
960
959
|
}
|
|
961
960
|
}
|
|
962
|
-
function
|
|
961
|
+
function Lt(a = 12) {
|
|
963
962
|
return Ce(ue, a === 24 ? 256 : 128);
|
|
964
963
|
}
|
|
965
|
-
function
|
|
964
|
+
function qe(a) {
|
|
966
965
|
return Pe(a, ue);
|
|
967
966
|
}
|
|
968
967
|
async function pe(a, e) {
|
|
969
|
-
|
|
968
|
+
const t = performance.now(), s = await De(a, e, { t: 2, m: 19456, p: 1, dkLen: 32 });
|
|
969
|
+
return console.log(performance.now() - t), s;
|
|
970
970
|
}
|
|
971
|
-
async function
|
|
971
|
+
async function Ft(a, e) {
|
|
972
972
|
const t = y.getRandomBuffer(16), s = y.getRandomBuffer(12), n = y.utf8ToBuffer(a), i = await pe(e, t), o = de(i, s).encrypt(n), r = y.concat([t, s, o]);
|
|
973
973
|
return y.bufferToBase64(r);
|
|
974
974
|
}
|
|
975
|
-
async function
|
|
975
|
+
async function Je(a, e) {
|
|
976
976
|
const t = y.base64ToBuffer(a), s = t.subarray(0, 16), n = t.subarray(16, 28), i = t.subarray(28), o = await pe(e, s), r = de(o, n).decrypt(i);
|
|
977
977
|
return y.bufferToUtf8(r);
|
|
978
978
|
}
|
|
979
|
-
async function
|
|
979
|
+
async function Gt(a, e) {
|
|
980
980
|
try {
|
|
981
981
|
if (a) {
|
|
982
|
-
const t = await
|
|
983
|
-
if (t &&
|
|
982
|
+
const t = await Je(a, e);
|
|
983
|
+
if (t && qe(t))
|
|
984
984
|
return t;
|
|
985
985
|
}
|
|
986
986
|
return !1;
|
|
@@ -998,13 +998,13 @@ const ge = {
|
|
|
998
998
|
cad: "C$",
|
|
999
999
|
chf: "Fr"
|
|
1000
1000
|
}, ye = Object.keys(ge);
|
|
1001
|
-
async function
|
|
1001
|
+
async function ze() {
|
|
1002
1002
|
const a = ye.join(","), e = await fetch(`https://api.coingecko.com/api/v3/simple/price?ids=nexacoin&include_24hr_change=true&vs_currencies=${a}`);
|
|
1003
1003
|
if (!e.ok)
|
|
1004
1004
|
throw new Error("Failed to fetch price");
|
|
1005
1005
|
return (await e.json()).nexacoin || {};
|
|
1006
1006
|
}
|
|
1007
|
-
function
|
|
1007
|
+
function qt(a) {
|
|
1008
1008
|
return ge[a] || a;
|
|
1009
1009
|
}
|
|
1010
1010
|
function me() {
|
|
@@ -1013,30 +1013,30 @@ function me() {
|
|
|
1013
1013
|
a[e] = { value: 0, change: 0 };
|
|
1014
1014
|
}), a;
|
|
1015
1015
|
}
|
|
1016
|
-
function
|
|
1016
|
+
function We() {
|
|
1017
1017
|
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);
|
|
1018
1018
|
}
|
|
1019
|
-
function
|
|
1020
|
-
const a =
|
|
1019
|
+
function je() {
|
|
1020
|
+
const a = We();
|
|
1021
1021
|
return U.sha256ripemd160(a.toBuffer());
|
|
1022
1022
|
}
|
|
1023
|
-
function
|
|
1023
|
+
function $e(a) {
|
|
1024
1024
|
return A.empty().add(a.toBuffer());
|
|
1025
1025
|
}
|
|
1026
|
-
function
|
|
1027
|
-
const e =
|
|
1026
|
+
function Xe(a) {
|
|
1027
|
+
const e = $e(a);
|
|
1028
1028
|
return U.sha256ripemd160(e.toBuffer());
|
|
1029
1029
|
}
|
|
1030
|
-
function
|
|
1030
|
+
function Ye(a) {
|
|
1031
1031
|
return a.map((e) => e <= 16 ? J.smallInt(e) : z.fromNumber(e).toScriptNumBuffer());
|
|
1032
1032
|
}
|
|
1033
|
-
function
|
|
1033
|
+
function Ze(a, e) {
|
|
1034
1034
|
if (e.length !== 2)
|
|
1035
1035
|
return;
|
|
1036
|
-
const t =
|
|
1036
|
+
const t = je(), s = Xe(a), n = Ye(e);
|
|
1037
1037
|
return b.fromScriptTemplate(t, s, n).toString();
|
|
1038
1038
|
}
|
|
1039
|
-
class
|
|
1039
|
+
class Jt {
|
|
1040
1040
|
walletDb;
|
|
1041
1041
|
keyManager;
|
|
1042
1042
|
providers;
|
|
@@ -1161,7 +1161,7 @@ class Wt {
|
|
|
1161
1161
|
});
|
|
1162
1162
|
}
|
|
1163
1163
|
}
|
|
1164
|
-
class
|
|
1164
|
+
class zt {
|
|
1165
1165
|
rostrumService;
|
|
1166
1166
|
keyManager;
|
|
1167
1167
|
assetService;
|
|
@@ -1301,8 +1301,8 @@ class jt {
|
|
|
1301
1301
|
}
|
|
1302
1302
|
}
|
|
1303
1303
|
}
|
|
1304
|
-
const
|
|
1305
|
-
class
|
|
1304
|
+
const Qe = 274710, et = "0014461ad25081cb0119d034385ff154c8d3ad6bdd76";
|
|
1305
|
+
class tt {
|
|
1306
1306
|
rostrumService;
|
|
1307
1307
|
keyManager;
|
|
1308
1308
|
constructor(e, t) {
|
|
@@ -1335,16 +1335,16 @@ class st {
|
|
|
1335
1335
|
}), n;
|
|
1336
1336
|
}
|
|
1337
1337
|
async checkVaultsForAddress(e) {
|
|
1338
|
-
const t = /* @__PURE__ */ new Set(), s = await this.rostrumService.getTransactionsHistory(e,
|
|
1338
|
+
const t = /* @__PURE__ */ new Set(), s = await this.rostrumService.getTransactionsHistory(e, Qe);
|
|
1339
1339
|
for (const n of s) {
|
|
1340
|
-
const o = (await this.rostrumService.getTransaction(n.tx_hash)).vout.filter((r) => r.scriptPubKey.hex.startsWith(
|
|
1340
|
+
const o = (await this.rostrumService.getTransaction(n.tx_hash)).vout.filter((r) => r.scriptPubKey.hex.startsWith(et));
|
|
1341
1341
|
for (const r of o)
|
|
1342
1342
|
t.add(r.scriptPubKey.hex);
|
|
1343
1343
|
}
|
|
1344
1344
|
return t;
|
|
1345
1345
|
}
|
|
1346
1346
|
parseVaultDetails(e) {
|
|
1347
|
-
const t = A.fromHex(e), s = new Ee().writeVarLengthBuf(t.toBuffer()).toBuffer(), n = new b(s).toString(), i = t.getVisibleArgs(), o = z.fromScriptNumBuffer(i.chunks[0].buf).toNumber(), r = J.isSmallIntOp(i.chunks[1].opcodenum) ? J.decodeOP_N(i.chunks[1].opcodenum) : z.fromScriptNumBuffer(i.chunks[1].buf).toNumber(), c = [o, r], d = this.keyManager.getKey({ account: f.VAULT, type: m.RECEIVE, index: r }), u =
|
|
1347
|
+
const t = A.fromHex(e), s = new Ee().writeVarLengthBuf(t.toBuffer()).toBuffer(), n = new b(s).toString(), i = t.getVisibleArgs(), o = z.fromScriptNumBuffer(i.chunks[0].buf).toNumber(), r = J.isSmallIntOp(i.chunks[1].opcodenum) ? J.decodeOP_N(i.chunks[1].opcodenum) : z.fromScriptNumBuffer(i.chunks[1].buf).toNumber(), c = [o, r], d = this.keyManager.getKey({ account: f.VAULT, type: m.RECEIVE, index: r }), u = Ze(d.publicKey, c);
|
|
1348
1348
|
return n != u ? void 0 : {
|
|
1349
1349
|
address: n,
|
|
1350
1350
|
block: o,
|
|
@@ -1359,7 +1359,7 @@ class st {
|
|
|
1359
1359
|
}
|
|
1360
1360
|
class N {
|
|
1361
1361
|
constructor(e, t, s, n, i, o, r) {
|
|
1362
|
-
this.keyManager = e, this.kvStore = t, this.walletDb = s, this.rostrumService = n, this.assetService = i, this.transactionService = o, this.sessionManager = r, this.discoveryService = new
|
|
1362
|
+
this.keyManager = e, this.kvStore = t, this.walletDb = s, this.rostrumService = n, this.assetService = i, this.transactionService = o, this.sessionManager = r, this.discoveryService = new tt(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
1363
|
}
|
|
1364
1364
|
static GAP_LIMIT = 20;
|
|
1365
1365
|
static DEBOUNCE_MS = 1e3;
|
|
@@ -1721,12 +1721,12 @@ class N {
|
|
|
1721
1721
|
return e.type == f.MAIN;
|
|
1722
1722
|
}
|
|
1723
1723
|
}
|
|
1724
|
-
const
|
|
1724
|
+
const st = {
|
|
1725
1725
|
isWalletExist: !1,
|
|
1726
1726
|
isAuthorized: !1
|
|
1727
1727
|
}, we = M({
|
|
1728
1728
|
name: "auth",
|
|
1729
|
-
initialState:
|
|
1729
|
+
initialState: st,
|
|
1730
1730
|
reducers: {
|
|
1731
1731
|
setWalletExist: (a, e) => {
|
|
1732
1732
|
a.isWalletExist = e.payload;
|
|
@@ -1735,12 +1735,12 @@ const at = {
|
|
|
1735
1735
|
a.isAuthorized = e.payload;
|
|
1736
1736
|
}
|
|
1737
1737
|
}
|
|
1738
|
-
}),
|
|
1738
|
+
}), Wt = we.actions, at = we.reducer, nt = {
|
|
1739
1739
|
modalType: null,
|
|
1740
1740
|
currentRequest: null
|
|
1741
1741
|
}, ve = M({
|
|
1742
1742
|
name: "dappModal",
|
|
1743
|
-
initialState:
|
|
1743
|
+
initialState: nt,
|
|
1744
1744
|
reducers: {
|
|
1745
1745
|
showRequest(a, e) {
|
|
1746
1746
|
a.modalType = e.payload.type, a.currentRequest = e.payload;
|
|
@@ -1749,24 +1749,24 @@ const at = {
|
|
|
1749
1749
|
a.modalType = null, a.currentRequest = null;
|
|
1750
1750
|
}
|
|
1751
1751
|
}
|
|
1752
|
-
}),
|
|
1752
|
+
}), jt = ve.actions, it = ve.reducer, rt = {
|
|
1753
1753
|
counter: 0,
|
|
1754
1754
|
loading: !1
|
|
1755
1755
|
}, Ae = M({
|
|
1756
1756
|
name: "loader",
|
|
1757
|
-
initialState:
|
|
1757
|
+
initialState: rt,
|
|
1758
1758
|
reducers: {
|
|
1759
1759
|
setLoader: (a, e) => {
|
|
1760
1760
|
const t = e.payload.loading ? a.counter + 1 : Math.max(0, a.counter - 1);
|
|
1761
1761
|
a.counter = t, a.loading = t > 0, a.text = e.payload.text;
|
|
1762
1762
|
}
|
|
1763
1763
|
}
|
|
1764
|
-
}),
|
|
1764
|
+
}), $t = Ae.actions, ot = Ae.reducer, ct = {
|
|
1765
1765
|
wallet: {},
|
|
1766
1766
|
web3: {}
|
|
1767
1767
|
}, Se = M({
|
|
1768
1768
|
name: "notifications",
|
|
1769
|
-
initialState:
|
|
1769
|
+
initialState: ct,
|
|
1770
1770
|
reducers: {
|
|
1771
1771
|
addNotification: (a, e) => {
|
|
1772
1772
|
e.payload.type == "wallet" ? a.wallet[e.payload.id] = e.payload : e.payload.type == "web3" && (a.web3[e.payload.id] = e.payload);
|
|
@@ -1778,16 +1778,16 @@ const at = {
|
|
|
1778
1778
|
e.payload === "wallet" ? a.wallet = {} : e.payload === "web3" ? a.web3 = {} : e.payload === "all" && (a.wallet = {}, a.web3 = {});
|
|
1779
1779
|
}
|
|
1780
1780
|
}
|
|
1781
|
-
}),
|
|
1781
|
+
}), Xt = Se.actions, dt = Se.reducer, ut = {
|
|
1782
1782
|
status: "Offline",
|
|
1783
1783
|
height: 0,
|
|
1784
1784
|
price: me(),
|
|
1785
1785
|
hasNetwork: !0,
|
|
1786
1786
|
isSuspended: !1
|
|
1787
|
-
}, ce =
|
|
1787
|
+
}, ce = Ve("status/fetchPrice", async () => {
|
|
1788
1788
|
const a = me();
|
|
1789
1789
|
try {
|
|
1790
|
-
const e = await
|
|
1790
|
+
const e = await ze();
|
|
1791
1791
|
Object.keys(e).forEach((t) => {
|
|
1792
1792
|
a[t] = {
|
|
1793
1793
|
value: e[t],
|
|
@@ -1799,7 +1799,7 @@ const at = {
|
|
|
1799
1799
|
return a;
|
|
1800
1800
|
}), be = M({
|
|
1801
1801
|
name: "status",
|
|
1802
|
-
initialState:
|
|
1802
|
+
initialState: ut,
|
|
1803
1803
|
reducers: {
|
|
1804
1804
|
setHeight: (a, e) => {
|
|
1805
1805
|
e.payload > 0 && (a.status = "Online"), a.height = e.payload;
|
|
@@ -1821,7 +1821,7 @@ const at = {
|
|
|
1821
1821
|
console.error(t.error.message);
|
|
1822
1822
|
});
|
|
1823
1823
|
}
|
|
1824
|
-
}),
|
|
1824
|
+
}), Yt = be.actions, lt = be.reducer, ht = {
|
|
1825
1825
|
isAuthorized: !1,
|
|
1826
1826
|
selectedAccount: g,
|
|
1827
1827
|
accounts: {
|
|
@@ -1842,7 +1842,7 @@ const at = {
|
|
|
1842
1842
|
nftsUpdateTrigger: 0
|
|
1843
1843
|
}, ke = M({
|
|
1844
1844
|
name: "wallet",
|
|
1845
|
-
initialState:
|
|
1845
|
+
initialState: ht,
|
|
1846
1846
|
reducers: {
|
|
1847
1847
|
setInitLoad: (a, e) => {
|
|
1848
1848
|
a.initLoad = e.payload;
|
|
@@ -1898,108 +1898,108 @@ const at = {
|
|
|
1898
1898
|
a.accounts[e.payload.accountId].sessions = {};
|
|
1899
1899
|
}
|
|
1900
1900
|
}
|
|
1901
|
-
}),
|
|
1902
|
-
loader:
|
|
1903
|
-
dapp:
|
|
1904
|
-
status:
|
|
1905
|
-
wallet:
|
|
1906
|
-
auth:
|
|
1907
|
-
notifications:
|
|
1908
|
-
}, w =
|
|
1901
|
+
}), Zt = ke.actions, ft = ke.reducer, Qt = {
|
|
1902
|
+
loader: ot,
|
|
1903
|
+
dapp: it,
|
|
1904
|
+
status: lt,
|
|
1905
|
+
wallet: ft,
|
|
1906
|
+
auth: at,
|
|
1907
|
+
notifications: dt
|
|
1908
|
+
}, w = Re.withTypes(), es = () => w((a) => a.auth), ts = () => w((a) => a.status.height), ss = (a) => w((e) => e.wallet.accounts[a]), as = () => w((a) => a.wallet.selectedAccount), ns = () => w((a) => Math.max(...Object.keys(a.wallet.accounts).map(Number))), is = (a) => w((e) => e.wallet.accounts[a].address), rs = (a) => w((e) => e.wallet.accounts[a].balance), os = (a, e) => w((t) => t.wallet.accounts[a].tokensBalance[e]), cs = (a, e) => w((t) => t.wallet.accounts[a].sessions[e]), ds = () => w((a) => a.wallet.vaults), Te = j(
|
|
1909
1909
|
[(a) => a.notifications.wallet],
|
|
1910
1910
|
(a) => Object.values(a).sort((e, t) => t.createdAt - e.createdAt)
|
|
1911
1911
|
), Ie = j(
|
|
1912
1912
|
[(a) => a.notifications.web3],
|
|
1913
1913
|
(a) => Object.values(a).sort((e, t) => t.createdAt - e.createdAt)
|
|
1914
|
-
),
|
|
1914
|
+
), pt = j(
|
|
1915
1915
|
[Te, Ie],
|
|
1916
1916
|
(a, e) => [...a, ...e].sort((t, s) => s.createdAt - t.createdAt)
|
|
1917
|
-
),
|
|
1917
|
+
), us = () => w(Te), ls = () => w(Ie), hs = () => w(pt);
|
|
1918
1918
|
export {
|
|
1919
1919
|
f as AccountType,
|
|
1920
|
-
|
|
1920
|
+
Ht as AssetService,
|
|
1921
1921
|
V as AssetType,
|
|
1922
|
-
|
|
1923
|
-
|
|
1922
|
+
Pt as KVStore,
|
|
1923
|
+
Dt as KeyManager,
|
|
1924
1924
|
m as KeySpace,
|
|
1925
1925
|
g as MAIN_WALLET_ID,
|
|
1926
1926
|
ne as MAX_INT64,
|
|
1927
1927
|
he as RostrumService,
|
|
1928
|
-
|
|
1928
|
+
Jt as SessionManager,
|
|
1929
1929
|
_ as SessionRequestType,
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1930
|
+
Kt as TransactionService,
|
|
1931
|
+
zt as TransactionTransformer,
|
|
1932
|
+
He as VAULT_FIRST_BLOCK,
|
|
1933
|
+
It as VAULT_SCRIPT_PREFIX,
|
|
1934
|
+
Ut as WalletCache,
|
|
1935
|
+
Ot as WalletDB,
|
|
1936
1936
|
N as WalletManager,
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1937
|
+
Wt as authActions,
|
|
1938
|
+
at as authReducer,
|
|
1939
|
+
Bt as capitalizeFirstLetter,
|
|
1940
1940
|
ye as currencies,
|
|
1941
1941
|
$ as currentTimestamp,
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1942
|
+
jt as dappModalActions,
|
|
1943
|
+
it as dappModalReducer,
|
|
1944
|
+
Ft as encryptMnemonic,
|
|
1945
|
+
Et as estimateDateByFutureBlock,
|
|
1946
|
+
Fe as fetchAssetBlob,
|
|
1947
|
+
Le as fetchAssetDoc,
|
|
1948
|
+
Vt as fetchNiftyNFT,
|
|
1949
1949
|
ce as fetchPrice,
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1950
|
+
Lt as generateNewMnemonic,
|
|
1951
|
+
Ze as generateVaultAddress,
|
|
1952
|
+
$e as generateVaultConstraint,
|
|
1953
|
+
Ye as generateVaultVisibleArgs,
|
|
1954
1954
|
R as getAddressBuffer,
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1955
|
+
qt as getCurrencySymbol,
|
|
1956
|
+
Nt as getExplorerUrl,
|
|
1957
|
+
_t as getFileMediaType,
|
|
1958
|
+
Ct as getFileMimeType,
|
|
1959
|
+
ze as getNexaPrices,
|
|
1960
1960
|
fe as getNiftyToken,
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1961
|
+
Xe as getVaultConstraintHash,
|
|
1962
|
+
We as getVaultTemplate,
|
|
1963
|
+
je as getVaultTemplateHash,
|
|
1964
1964
|
me as initializePrices,
|
|
1965
|
-
|
|
1966
|
-
|
|
1965
|
+
xt as isGenesisHashValid,
|
|
1966
|
+
qe as isMnemonicValid,
|
|
1967
1967
|
q as isNiftySubgroup,
|
|
1968
1968
|
C as isNullOrEmpty,
|
|
1969
1969
|
T as isTestnet,
|
|
1970
1970
|
F as isValidNexaAddress,
|
|
1971
1971
|
x as keyPathToString,
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1972
|
+
$t as loaderActions,
|
|
1973
|
+
ot as loaderReducer,
|
|
1974
|
+
Xt as notificationsActions,
|
|
1975
|
+
dt as notificationsReducer,
|
|
1976
|
+
Rt as parseTokenDataUrl,
|
|
1977
|
+
Qt as sharedReducers,
|
|
1978
|
+
Yt as statusActions,
|
|
1979
|
+
lt as statusReducer,
|
|
1980
|
+
Ke as stringToKeyPath,
|
|
1981
1981
|
re as sumBalance,
|
|
1982
1982
|
G as sumTokensBalance,
|
|
1983
1983
|
D as tokenAmountToAssetAmount,
|
|
1984
1984
|
ie as tokenHexToAddr,
|
|
1985
1985
|
S as tokenIdToHex,
|
|
1986
1986
|
oe as transformTokenIconUrl,
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
1987
|
+
Mt as truncateStringMiddle,
|
|
1988
|
+
ss as useAccount,
|
|
1989
|
+
hs as useAllNotifications,
|
|
1990
|
+
es as useAuth,
|
|
1991
|
+
ts as useBlockHeight,
|
|
1992
|
+
cs as useDAppSession,
|
|
1993
|
+
ns as useLastAccountId,
|
|
1994
|
+
is as useMainReceiveAddress,
|
|
1995
|
+
as as useSelectedAccount,
|
|
1996
|
+
os as useTokenBalance,
|
|
1997
|
+
ds as useVaults,
|
|
1998
|
+
rs as useWalletBalance,
|
|
1999
|
+
us as useWalletNotifications,
|
|
2000
|
+
ls as useWeb3Notifications,
|
|
2001
|
+
Gt as validateAndDecryptMnemonic,
|
|
2002
|
+
Zt as walletActions,
|
|
2003
|
+
ft as walletReducer
|
|
2004
2004
|
};
|
|
2005
2005
|
//# sourceMappingURL=index.js.map
|