@otoplo/wallet-common 0.1.3 → 0.1.5
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.d.ts +1 -1
- package/dist/index.js +140 -141
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/utils/seed.ts +4 -5
package/dist/index.d.ts
CHANGED
|
@@ -1068,7 +1068,7 @@ export declare const useWalletNotifications: () => AppNotification[];
|
|
|
1068
1068
|
|
|
1069
1069
|
export declare const useWeb3Notifications: () => AppNotification[];
|
|
1070
1070
|
|
|
1071
|
-
export declare function validateAndDecryptMnemonic(encSeed: string, password: string): Promise<string |
|
|
1071
|
+
export declare function validateAndDecryptMnemonic(encSeed: string, password: string): Promise<string | false>;
|
|
1072
1072
|
|
|
1073
1073
|
export declare const VAULT_FIRST_BLOCK = 274710;
|
|
1074
1074
|
|
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,28 @@ 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
|
-
|
|
969
|
-
return De(
|
|
967
|
+
function pe(a, e) {
|
|
968
|
+
return De(a, e, { t: 2, m: 19456, p: 1, dkLen: 32 });
|
|
970
969
|
}
|
|
971
|
-
async function
|
|
970
|
+
async function Ft(a, e) {
|
|
972
971
|
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
972
|
return y.bufferToBase64(r);
|
|
974
973
|
}
|
|
975
|
-
async function
|
|
974
|
+
async function Je(a, e) {
|
|
976
975
|
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
976
|
return y.bufferToUtf8(r);
|
|
978
977
|
}
|
|
979
|
-
async function
|
|
978
|
+
async function Gt(a, e) {
|
|
980
979
|
try {
|
|
981
980
|
if (a) {
|
|
982
|
-
const t = await
|
|
983
|
-
if (t &&
|
|
981
|
+
const t = await Je(a, e);
|
|
982
|
+
if (t && qe(t))
|
|
984
983
|
return t;
|
|
985
984
|
}
|
|
986
985
|
return !1;
|
|
@@ -998,13 +997,13 @@ const ge = {
|
|
|
998
997
|
cad: "C$",
|
|
999
998
|
chf: "Fr"
|
|
1000
999
|
}, ye = Object.keys(ge);
|
|
1001
|
-
async function
|
|
1000
|
+
async function ze() {
|
|
1002
1001
|
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
1002
|
if (!e.ok)
|
|
1004
1003
|
throw new Error("Failed to fetch price");
|
|
1005
1004
|
return (await e.json()).nexacoin || {};
|
|
1006
1005
|
}
|
|
1007
|
-
function
|
|
1006
|
+
function qt(a) {
|
|
1008
1007
|
return ge[a] || a;
|
|
1009
1008
|
}
|
|
1010
1009
|
function me() {
|
|
@@ -1013,30 +1012,30 @@ function me() {
|
|
|
1013
1012
|
a[e] = { value: 0, change: 0 };
|
|
1014
1013
|
}), a;
|
|
1015
1014
|
}
|
|
1016
|
-
function
|
|
1015
|
+
function We() {
|
|
1017
1016
|
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
1017
|
}
|
|
1019
|
-
function
|
|
1020
|
-
const a =
|
|
1018
|
+
function je() {
|
|
1019
|
+
const a = We();
|
|
1021
1020
|
return U.sha256ripemd160(a.toBuffer());
|
|
1022
1021
|
}
|
|
1023
|
-
function
|
|
1022
|
+
function $e(a) {
|
|
1024
1023
|
return A.empty().add(a.toBuffer());
|
|
1025
1024
|
}
|
|
1026
|
-
function
|
|
1027
|
-
const e =
|
|
1025
|
+
function Xe(a) {
|
|
1026
|
+
const e = $e(a);
|
|
1028
1027
|
return U.sha256ripemd160(e.toBuffer());
|
|
1029
1028
|
}
|
|
1030
|
-
function
|
|
1029
|
+
function Ye(a) {
|
|
1031
1030
|
return a.map((e) => e <= 16 ? J.smallInt(e) : z.fromNumber(e).toScriptNumBuffer());
|
|
1032
1031
|
}
|
|
1033
|
-
function
|
|
1032
|
+
function Ze(a, e) {
|
|
1034
1033
|
if (e.length !== 2)
|
|
1035
1034
|
return;
|
|
1036
|
-
const t =
|
|
1035
|
+
const t = je(), s = Xe(a), n = Ye(e);
|
|
1037
1036
|
return b.fromScriptTemplate(t, s, n).toString();
|
|
1038
1037
|
}
|
|
1039
|
-
class
|
|
1038
|
+
class Jt {
|
|
1040
1039
|
walletDb;
|
|
1041
1040
|
keyManager;
|
|
1042
1041
|
providers;
|
|
@@ -1161,7 +1160,7 @@ class Wt {
|
|
|
1161
1160
|
});
|
|
1162
1161
|
}
|
|
1163
1162
|
}
|
|
1164
|
-
class
|
|
1163
|
+
class zt {
|
|
1165
1164
|
rostrumService;
|
|
1166
1165
|
keyManager;
|
|
1167
1166
|
assetService;
|
|
@@ -1301,8 +1300,8 @@ class jt {
|
|
|
1301
1300
|
}
|
|
1302
1301
|
}
|
|
1303
1302
|
}
|
|
1304
|
-
const
|
|
1305
|
-
class
|
|
1303
|
+
const Qe = 274710, et = "0014461ad25081cb0119d034385ff154c8d3ad6bdd76";
|
|
1304
|
+
class tt {
|
|
1306
1305
|
rostrumService;
|
|
1307
1306
|
keyManager;
|
|
1308
1307
|
constructor(e, t) {
|
|
@@ -1335,16 +1334,16 @@ class st {
|
|
|
1335
1334
|
}), n;
|
|
1336
1335
|
}
|
|
1337
1336
|
async checkVaultsForAddress(e) {
|
|
1338
|
-
const t = /* @__PURE__ */ new Set(), s = await this.rostrumService.getTransactionsHistory(e,
|
|
1337
|
+
const t = /* @__PURE__ */ new Set(), s = await this.rostrumService.getTransactionsHistory(e, Qe);
|
|
1339
1338
|
for (const n of s) {
|
|
1340
|
-
const o = (await this.rostrumService.getTransaction(n.tx_hash)).vout.filter((r) => r.scriptPubKey.hex.startsWith(
|
|
1339
|
+
const o = (await this.rostrumService.getTransaction(n.tx_hash)).vout.filter((r) => r.scriptPubKey.hex.startsWith(et));
|
|
1341
1340
|
for (const r of o)
|
|
1342
1341
|
t.add(r.scriptPubKey.hex);
|
|
1343
1342
|
}
|
|
1344
1343
|
return t;
|
|
1345
1344
|
}
|
|
1346
1345
|
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 =
|
|
1346
|
+
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
1347
|
return n != u ? void 0 : {
|
|
1349
1348
|
address: n,
|
|
1350
1349
|
block: o,
|
|
@@ -1359,7 +1358,7 @@ class st {
|
|
|
1359
1358
|
}
|
|
1360
1359
|
class N {
|
|
1361
1360
|
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
|
|
1361
|
+
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
1362
|
}
|
|
1364
1363
|
static GAP_LIMIT = 20;
|
|
1365
1364
|
static DEBOUNCE_MS = 1e3;
|
|
@@ -1721,12 +1720,12 @@ class N {
|
|
|
1721
1720
|
return e.type == f.MAIN;
|
|
1722
1721
|
}
|
|
1723
1722
|
}
|
|
1724
|
-
const
|
|
1723
|
+
const st = {
|
|
1725
1724
|
isWalletExist: !1,
|
|
1726
1725
|
isAuthorized: !1
|
|
1727
1726
|
}, we = M({
|
|
1728
1727
|
name: "auth",
|
|
1729
|
-
initialState:
|
|
1728
|
+
initialState: st,
|
|
1730
1729
|
reducers: {
|
|
1731
1730
|
setWalletExist: (a, e) => {
|
|
1732
1731
|
a.isWalletExist = e.payload;
|
|
@@ -1735,12 +1734,12 @@ const at = {
|
|
|
1735
1734
|
a.isAuthorized = e.payload;
|
|
1736
1735
|
}
|
|
1737
1736
|
}
|
|
1738
|
-
}),
|
|
1737
|
+
}), Wt = we.actions, at = we.reducer, nt = {
|
|
1739
1738
|
modalType: null,
|
|
1740
1739
|
currentRequest: null
|
|
1741
1740
|
}, ve = M({
|
|
1742
1741
|
name: "dappModal",
|
|
1743
|
-
initialState:
|
|
1742
|
+
initialState: nt,
|
|
1744
1743
|
reducers: {
|
|
1745
1744
|
showRequest(a, e) {
|
|
1746
1745
|
a.modalType = e.payload.type, a.currentRequest = e.payload;
|
|
@@ -1749,24 +1748,24 @@ const at = {
|
|
|
1749
1748
|
a.modalType = null, a.currentRequest = null;
|
|
1750
1749
|
}
|
|
1751
1750
|
}
|
|
1752
|
-
}),
|
|
1751
|
+
}), jt = ve.actions, it = ve.reducer, rt = {
|
|
1753
1752
|
counter: 0,
|
|
1754
1753
|
loading: !1
|
|
1755
1754
|
}, Ae = M({
|
|
1756
1755
|
name: "loader",
|
|
1757
|
-
initialState:
|
|
1756
|
+
initialState: rt,
|
|
1758
1757
|
reducers: {
|
|
1759
1758
|
setLoader: (a, e) => {
|
|
1760
1759
|
const t = e.payload.loading ? a.counter + 1 : Math.max(0, a.counter - 1);
|
|
1761
1760
|
a.counter = t, a.loading = t > 0, a.text = e.payload.text;
|
|
1762
1761
|
}
|
|
1763
1762
|
}
|
|
1764
|
-
}),
|
|
1763
|
+
}), $t = Ae.actions, ot = Ae.reducer, ct = {
|
|
1765
1764
|
wallet: {},
|
|
1766
1765
|
web3: {}
|
|
1767
1766
|
}, Se = M({
|
|
1768
1767
|
name: "notifications",
|
|
1769
|
-
initialState:
|
|
1768
|
+
initialState: ct,
|
|
1770
1769
|
reducers: {
|
|
1771
1770
|
addNotification: (a, e) => {
|
|
1772
1771
|
e.payload.type == "wallet" ? a.wallet[e.payload.id] = e.payload : e.payload.type == "web3" && (a.web3[e.payload.id] = e.payload);
|
|
@@ -1778,16 +1777,16 @@ const at = {
|
|
|
1778
1777
|
e.payload === "wallet" ? a.wallet = {} : e.payload === "web3" ? a.web3 = {} : e.payload === "all" && (a.wallet = {}, a.web3 = {});
|
|
1779
1778
|
}
|
|
1780
1779
|
}
|
|
1781
|
-
}),
|
|
1780
|
+
}), Xt = Se.actions, dt = Se.reducer, ut = {
|
|
1782
1781
|
status: "Offline",
|
|
1783
1782
|
height: 0,
|
|
1784
1783
|
price: me(),
|
|
1785
1784
|
hasNetwork: !0,
|
|
1786
1785
|
isSuspended: !1
|
|
1787
|
-
}, ce =
|
|
1786
|
+
}, ce = Ve("status/fetchPrice", async () => {
|
|
1788
1787
|
const a = me();
|
|
1789
1788
|
try {
|
|
1790
|
-
const e = await
|
|
1789
|
+
const e = await ze();
|
|
1791
1790
|
Object.keys(e).forEach((t) => {
|
|
1792
1791
|
a[t] = {
|
|
1793
1792
|
value: e[t],
|
|
@@ -1799,7 +1798,7 @@ const at = {
|
|
|
1799
1798
|
return a;
|
|
1800
1799
|
}), be = M({
|
|
1801
1800
|
name: "status",
|
|
1802
|
-
initialState:
|
|
1801
|
+
initialState: ut,
|
|
1803
1802
|
reducers: {
|
|
1804
1803
|
setHeight: (a, e) => {
|
|
1805
1804
|
e.payload > 0 && (a.status = "Online"), a.height = e.payload;
|
|
@@ -1821,7 +1820,7 @@ const at = {
|
|
|
1821
1820
|
console.error(t.error.message);
|
|
1822
1821
|
});
|
|
1823
1822
|
}
|
|
1824
|
-
}),
|
|
1823
|
+
}), Yt = be.actions, lt = be.reducer, ht = {
|
|
1825
1824
|
isAuthorized: !1,
|
|
1826
1825
|
selectedAccount: g,
|
|
1827
1826
|
accounts: {
|
|
@@ -1842,7 +1841,7 @@ const at = {
|
|
|
1842
1841
|
nftsUpdateTrigger: 0
|
|
1843
1842
|
}, ke = M({
|
|
1844
1843
|
name: "wallet",
|
|
1845
|
-
initialState:
|
|
1844
|
+
initialState: ht,
|
|
1846
1845
|
reducers: {
|
|
1847
1846
|
setInitLoad: (a, e) => {
|
|
1848
1847
|
a.initLoad = e.payload;
|
|
@@ -1898,108 +1897,108 @@ const at = {
|
|
|
1898
1897
|
a.accounts[e.payload.accountId].sessions = {};
|
|
1899
1898
|
}
|
|
1900
1899
|
}
|
|
1901
|
-
}),
|
|
1902
|
-
loader:
|
|
1903
|
-
dapp:
|
|
1904
|
-
status:
|
|
1905
|
-
wallet:
|
|
1906
|
-
auth:
|
|
1907
|
-
notifications:
|
|
1908
|
-
}, w =
|
|
1900
|
+
}), Zt = ke.actions, ft = ke.reducer, Qt = {
|
|
1901
|
+
loader: ot,
|
|
1902
|
+
dapp: it,
|
|
1903
|
+
status: lt,
|
|
1904
|
+
wallet: ft,
|
|
1905
|
+
auth: at,
|
|
1906
|
+
notifications: dt
|
|
1907
|
+
}, 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
1908
|
[(a) => a.notifications.wallet],
|
|
1910
1909
|
(a) => Object.values(a).sort((e, t) => t.createdAt - e.createdAt)
|
|
1911
1910
|
), Ie = j(
|
|
1912
1911
|
[(a) => a.notifications.web3],
|
|
1913
1912
|
(a) => Object.values(a).sort((e, t) => t.createdAt - e.createdAt)
|
|
1914
|
-
),
|
|
1913
|
+
), pt = j(
|
|
1915
1914
|
[Te, Ie],
|
|
1916
1915
|
(a, e) => [...a, ...e].sort((t, s) => s.createdAt - t.createdAt)
|
|
1917
|
-
),
|
|
1916
|
+
), us = () => w(Te), ls = () => w(Ie), hs = () => w(pt);
|
|
1918
1917
|
export {
|
|
1919
1918
|
f as AccountType,
|
|
1920
|
-
|
|
1919
|
+
Ht as AssetService,
|
|
1921
1920
|
V as AssetType,
|
|
1922
|
-
|
|
1923
|
-
|
|
1921
|
+
Pt as KVStore,
|
|
1922
|
+
Dt as KeyManager,
|
|
1924
1923
|
m as KeySpace,
|
|
1925
1924
|
g as MAIN_WALLET_ID,
|
|
1926
1925
|
ne as MAX_INT64,
|
|
1927
1926
|
he as RostrumService,
|
|
1928
|
-
|
|
1927
|
+
Jt as SessionManager,
|
|
1929
1928
|
_ as SessionRequestType,
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1929
|
+
Kt as TransactionService,
|
|
1930
|
+
zt as TransactionTransformer,
|
|
1931
|
+
He as VAULT_FIRST_BLOCK,
|
|
1932
|
+
It as VAULT_SCRIPT_PREFIX,
|
|
1933
|
+
Ut as WalletCache,
|
|
1934
|
+
Ot as WalletDB,
|
|
1936
1935
|
N as WalletManager,
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1936
|
+
Wt as authActions,
|
|
1937
|
+
at as authReducer,
|
|
1938
|
+
Bt as capitalizeFirstLetter,
|
|
1940
1939
|
ye as currencies,
|
|
1941
1940
|
$ as currentTimestamp,
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1941
|
+
jt as dappModalActions,
|
|
1942
|
+
it as dappModalReducer,
|
|
1943
|
+
Ft as encryptMnemonic,
|
|
1944
|
+
Et as estimateDateByFutureBlock,
|
|
1945
|
+
Fe as fetchAssetBlob,
|
|
1946
|
+
Le as fetchAssetDoc,
|
|
1947
|
+
Vt as fetchNiftyNFT,
|
|
1949
1948
|
ce as fetchPrice,
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1949
|
+
Lt as generateNewMnemonic,
|
|
1950
|
+
Ze as generateVaultAddress,
|
|
1951
|
+
$e as generateVaultConstraint,
|
|
1952
|
+
Ye as generateVaultVisibleArgs,
|
|
1954
1953
|
R as getAddressBuffer,
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1954
|
+
qt as getCurrencySymbol,
|
|
1955
|
+
Nt as getExplorerUrl,
|
|
1956
|
+
_t as getFileMediaType,
|
|
1957
|
+
Ct as getFileMimeType,
|
|
1958
|
+
ze as getNexaPrices,
|
|
1960
1959
|
fe as getNiftyToken,
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1960
|
+
Xe as getVaultConstraintHash,
|
|
1961
|
+
We as getVaultTemplate,
|
|
1962
|
+
je as getVaultTemplateHash,
|
|
1964
1963
|
me as initializePrices,
|
|
1965
|
-
|
|
1966
|
-
|
|
1964
|
+
xt as isGenesisHashValid,
|
|
1965
|
+
qe as isMnemonicValid,
|
|
1967
1966
|
q as isNiftySubgroup,
|
|
1968
1967
|
C as isNullOrEmpty,
|
|
1969
1968
|
T as isTestnet,
|
|
1970
1969
|
F as isValidNexaAddress,
|
|
1971
1970
|
x as keyPathToString,
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1971
|
+
$t as loaderActions,
|
|
1972
|
+
ot as loaderReducer,
|
|
1973
|
+
Xt as notificationsActions,
|
|
1974
|
+
dt as notificationsReducer,
|
|
1975
|
+
Rt as parseTokenDataUrl,
|
|
1976
|
+
Qt as sharedReducers,
|
|
1977
|
+
Yt as statusActions,
|
|
1978
|
+
lt as statusReducer,
|
|
1979
|
+
Ke as stringToKeyPath,
|
|
1981
1980
|
re as sumBalance,
|
|
1982
1981
|
G as sumTokensBalance,
|
|
1983
1982
|
D as tokenAmountToAssetAmount,
|
|
1984
1983
|
ie as tokenHexToAddr,
|
|
1985
1984
|
S as tokenIdToHex,
|
|
1986
1985
|
oe as transformTokenIconUrl,
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
1986
|
+
Mt as truncateStringMiddle,
|
|
1987
|
+
ss as useAccount,
|
|
1988
|
+
hs as useAllNotifications,
|
|
1989
|
+
es as useAuth,
|
|
1990
|
+
ts as useBlockHeight,
|
|
1991
|
+
cs as useDAppSession,
|
|
1992
|
+
ns as useLastAccountId,
|
|
1993
|
+
is as useMainReceiveAddress,
|
|
1994
|
+
as as useSelectedAccount,
|
|
1995
|
+
os as useTokenBalance,
|
|
1996
|
+
ds as useVaults,
|
|
1997
|
+
rs as useWalletBalance,
|
|
1998
|
+
us as useWalletNotifications,
|
|
1999
|
+
ls as useWeb3Notifications,
|
|
2000
|
+
Gt as validateAndDecryptMnemonic,
|
|
2001
|
+
Zt as walletActions,
|
|
2002
|
+
ft as walletReducer
|
|
2004
2003
|
};
|
|
2005
2004
|
//# sourceMappingURL=index.js.map
|