@wishknish/knishio-client-js 0.7.4 → 0.7.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/client.cjs.js +81 -27
- package/dist/client.cjs.js.map +1 -1
- package/dist/client.es.mjs +1256 -767
- package/dist/client.es.mjs.map +1 -1
- package/dist/client.iife.js +81 -27
- package/dist/client.iife.js.map +1 -1
- package/package.json +1 -1
- package/src/KnishIOClient.js +47 -2
- package/src/Molecule.js +102 -14
- package/src/Wallet.js +48 -1
- package/src/index.js +6 -0
- package/src/libraries/CheckMolecule.js +211 -5
- package/src/query/QueryMetaTypeViaMolecule.js +223 -0
- package/src/response/ResponseContinuId.js +1 -1
- package/src/response/ResponseMetaTypeViaMolecule.js +210 -0
- package/src/response/ResponseWalletList.js +1 -1
package/dist/client.es.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
1
|
+
var Yt = Object.defineProperty;
|
|
2
|
+
var en = (o, e, t) => e in o ? Yt(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
|
|
3
|
+
var j = (o, e, t) => en(o, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
import L from "jssha";
|
|
5
|
-
import { gql as E, cacheExchange as
|
|
6
|
-
import { createClient as
|
|
7
|
-
import { pipe as
|
|
5
|
+
import { gql as E, cacheExchange as tn, fetchExchange as nn, subscriptionExchange as sn, createClient as rn } from "@urql/core";
|
|
6
|
+
import { createClient as on } from "graphql-ws";
|
|
7
|
+
import { pipe as an, map as ln } from "wonka";
|
|
8
8
|
typeof self > "u" && (global.self = global);
|
|
9
|
-
class
|
|
9
|
+
class Wt {
|
|
10
10
|
/**
|
|
11
11
|
* Converts the given buffer to a string containing its hexadecimal representation.
|
|
12
12
|
*
|
|
@@ -75,17 +75,17 @@ String.prototype.toCamelCase || (String.prototype.toCamelCase = function() {
|
|
|
75
75
|
String.prototype.toSnakeCase || (String.prototype.toSnakeCase = function() {
|
|
76
76
|
return this.replace(/[A-Z]/g, (o) => `_${o.toLowerCase()}`);
|
|
77
77
|
});
|
|
78
|
-
function
|
|
78
|
+
function He(o, e) {
|
|
79
79
|
const t = Math.ceil(o.length / e), n = [];
|
|
80
80
|
for (let s = 0, r = 0; s < t; ++s, r += e)
|
|
81
81
|
n[s] = o.substr(r, e);
|
|
82
82
|
return n;
|
|
83
83
|
}
|
|
84
|
-
function
|
|
84
|
+
function nt(o = 256, e = "abcdef0123456789") {
|
|
85
85
|
let t = new Uint8Array(o);
|
|
86
86
|
return t = crypto.getRandomValues(t), t = t.map((n) => e.charCodeAt(n % e.length)), String.fromCharCode.apply(null, t);
|
|
87
87
|
}
|
|
88
|
-
function
|
|
88
|
+
function cn(o, e, t, n, s) {
|
|
89
89
|
if (n = n || "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz~`!@#$%^&*()-_=+[{]}\\|;:'\",<.>/?¿¡", s = s || n, e > n.length || t > s.length)
|
|
90
90
|
return console.warn("Strings::charsetBaseConvert() - Can't convert", o, "to base", t, "greater than symbol table length. src-table:", n.length, "dest-table:", s.length), !1;
|
|
91
91
|
let i = BigInt(0);
|
|
@@ -98,27 +98,27 @@ function sn(o, e, t, n, s) {
|
|
|
98
98
|
}
|
|
99
99
|
return a || "0";
|
|
100
100
|
}
|
|
101
|
-
function
|
|
102
|
-
return
|
|
101
|
+
function un(o) {
|
|
102
|
+
return Wt.toHex(o, {});
|
|
103
103
|
}
|
|
104
|
-
function
|
|
105
|
-
return
|
|
104
|
+
function hn(o) {
|
|
105
|
+
return Wt.toUint8Array(o);
|
|
106
106
|
}
|
|
107
|
-
function
|
|
108
|
-
const e =
|
|
107
|
+
function dn(o) {
|
|
108
|
+
const e = hn(o);
|
|
109
109
|
return btoa(String.fromCharCode.apply(null, e));
|
|
110
110
|
}
|
|
111
|
-
function
|
|
111
|
+
function pn(o) {
|
|
112
112
|
const e = new Uint8Array(atob(o).split("").map((t) => t.charCodeAt(0)));
|
|
113
|
-
return
|
|
113
|
+
return un(e);
|
|
114
114
|
}
|
|
115
|
-
function
|
|
115
|
+
function De(o) {
|
|
116
116
|
return /^[A-F0-9]+$/i.test(o);
|
|
117
117
|
}
|
|
118
|
-
function
|
|
118
|
+
function fn(o) {
|
|
119
119
|
return (typeof o == "number" || typeof o == "string" && o.trim() !== "") && !isNaN(o);
|
|
120
120
|
}
|
|
121
|
-
let
|
|
121
|
+
let pe = class {
|
|
122
122
|
/**
|
|
123
123
|
* Normalizes the meta array into the standard {key: ..., value: ...} format
|
|
124
124
|
*
|
|
@@ -155,7 +155,7 @@ let he = class {
|
|
|
155
155
|
return t;
|
|
156
156
|
}
|
|
157
157
|
};
|
|
158
|
-
function
|
|
158
|
+
function mn(...o) {
|
|
159
159
|
return [].concat(...o.map((e, t) => {
|
|
160
160
|
const n = o.slice(0);
|
|
161
161
|
n.splice(t, 1);
|
|
@@ -163,17 +163,17 @@ function un(...o) {
|
|
|
163
163
|
return e.filter((r) => !s.includes(r));
|
|
164
164
|
}));
|
|
165
165
|
}
|
|
166
|
-
function
|
|
166
|
+
function ye(...o) {
|
|
167
167
|
return o.reduce((e, t) => e.filter((n) => t.includes(n)));
|
|
168
168
|
}
|
|
169
|
-
class
|
|
169
|
+
class st {
|
|
170
170
|
/**
|
|
171
171
|
*
|
|
172
172
|
* @param policy
|
|
173
173
|
* @param metaKeys
|
|
174
174
|
*/
|
|
175
175
|
constructor(e = {}, t = {}) {
|
|
176
|
-
this.policy =
|
|
176
|
+
this.policy = st.normalizePolicy(e), this.fillDefault(t);
|
|
177
177
|
}
|
|
178
178
|
/**
|
|
179
179
|
*
|
|
@@ -201,7 +201,7 @@ class Ze {
|
|
|
201
201
|
})) {
|
|
202
202
|
const i = r.map((a) => a.key);
|
|
203
203
|
this.policy[s] || (this.policy[s] = {});
|
|
204
|
-
for (const a of
|
|
204
|
+
for (const a of mn(e, i))
|
|
205
205
|
this.policy[s][a] || (this.policy[s][a] = s === "write" && !["characters", "pubkey"].includes(a) ? ["self"] : ["all"]);
|
|
206
206
|
}
|
|
207
207
|
}
|
|
@@ -220,13 +220,13 @@ class Ze {
|
|
|
220
220
|
return JSON.stringify(this.get());
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
|
-
class
|
|
223
|
+
class P {
|
|
224
224
|
/**
|
|
225
225
|
*
|
|
226
226
|
* @param {object|array} meta
|
|
227
227
|
*/
|
|
228
228
|
constructor(e = []) {
|
|
229
|
-
this.meta =
|
|
229
|
+
this.meta = pe.normalizeMeta(e);
|
|
230
230
|
}
|
|
231
231
|
/**
|
|
232
232
|
*
|
|
@@ -234,7 +234,7 @@ class H {
|
|
|
234
234
|
* @returns {AtomMeta}
|
|
235
235
|
*/
|
|
236
236
|
merge(e) {
|
|
237
|
-
return this.meta = Array.from(/* @__PURE__ */ new Set([...this.meta, ...
|
|
237
|
+
return this.meta = Array.from(/* @__PURE__ */ new Set([...this.meta, ...pe.normalizeMeta(e)])), this;
|
|
238
238
|
}
|
|
239
239
|
/**
|
|
240
240
|
*
|
|
@@ -303,7 +303,7 @@ class H {
|
|
|
303
303
|
* @returns {AtomMeta}
|
|
304
304
|
*/
|
|
305
305
|
addPolicy(e) {
|
|
306
|
-
const t = new
|
|
306
|
+
const t = new st(e, Object.keys(this.meta));
|
|
307
307
|
return this.merge({
|
|
308
308
|
policy: t.toJson()
|
|
309
309
|
}), this;
|
|
@@ -402,7 +402,7 @@ class ie {
|
|
|
402
402
|
return ie.structure(this);
|
|
403
403
|
}
|
|
404
404
|
}
|
|
405
|
-
class
|
|
405
|
+
class yn extends ie {
|
|
406
406
|
constructor({
|
|
407
407
|
position: e = null,
|
|
408
408
|
walletAddress: t = null,
|
|
@@ -420,8 +420,8 @@ class hn extends ie {
|
|
|
420
420
|
super(), this.position = e, this.walletAddress = t, this.isotope = n, this.token = s, this.value = r, this.batchId = i, this.metaType = a, this.metaId = c, this.meta = u, this.index = l, this.createdAt = h, this.version = p;
|
|
421
421
|
}
|
|
422
422
|
}
|
|
423
|
-
const
|
|
424
|
-
4:
|
|
423
|
+
const Ue = {
|
|
424
|
+
4: yn
|
|
425
425
|
};
|
|
426
426
|
class g {
|
|
427
427
|
/**
|
|
@@ -454,7 +454,7 @@ class g {
|
|
|
454
454
|
index: h = null,
|
|
455
455
|
version: p = null
|
|
456
456
|
}) {
|
|
457
|
-
this.position = e, this.walletAddress = t, this.isotope = n, this.token = s, this.value = r !== null ? String(r) : null, this.batchId = i, this.metaType = a, this.metaId = c, this.meta = u ?
|
|
457
|
+
this.position = e, this.walletAddress = t, this.isotope = n, this.token = s, this.value = r !== null ? String(r) : null, this.batchId = i, this.metaType = a, this.metaId = c, this.meta = u ? pe.normalizeMeta(u) : [], this.index = h, this.otsFragment = l, this.createdAt = String(+/* @__PURE__ */ new Date()), p !== null && Object.prototype.hasOwnProperty.call(Ue, p) && (this.version = String(p));
|
|
458
458
|
}
|
|
459
459
|
/**
|
|
460
460
|
*
|
|
@@ -503,7 +503,7 @@ class g {
|
|
|
503
503
|
meta: i = null,
|
|
504
504
|
batchId: a = null
|
|
505
505
|
}) {
|
|
506
|
-
return i || (i = new
|
|
506
|
+
return i || (i = new P()), i instanceof P || (i = new P(i)), t && (i.setAtomWallet(t), a || (a = t.batchId)), new g({
|
|
507
507
|
position: t ? t.position : null,
|
|
508
508
|
walletAddress: t ? t.address : null,
|
|
509
509
|
isotope: e,
|
|
@@ -633,8 +633,8 @@ class g {
|
|
|
633
633
|
if (!(r instanceof g))
|
|
634
634
|
throw new ae();
|
|
635
635
|
return r;
|
|
636
|
-
}), s.every((r) => r.version && Object.prototype.hasOwnProperty.call(
|
|
637
|
-
n.update(JSON.stringify(s.map((r) =>
|
|
636
|
+
}), s.every((r) => r.version && Object.prototype.hasOwnProperty.call(Ue, r.version)))
|
|
637
|
+
n.update(JSON.stringify(s.map((r) => Ue[r.version].create(r).view())));
|
|
638
638
|
else {
|
|
639
639
|
const r = String(e.length);
|
|
640
640
|
let i = [];
|
|
@@ -649,7 +649,7 @@ class g {
|
|
|
649
649
|
case "array":
|
|
650
650
|
return n.getHash("ARRAYBUFFER", { outputLen: 256 });
|
|
651
651
|
default:
|
|
652
|
-
return
|
|
652
|
+
return cn(n.getHash("HEX", { outputLen: 256 }), 16, 17, "0123456789abcdef", "0123456789abcdefg").padStart(64, "0");
|
|
653
653
|
}
|
|
654
654
|
}
|
|
655
655
|
static jsonSerialization(e, t) {
|
|
@@ -670,7 +670,7 @@ class g {
|
|
|
670
670
|
* Get aggregated meta from stored normalized ones
|
|
671
671
|
*/
|
|
672
672
|
aggregatedMeta() {
|
|
673
|
-
return
|
|
673
|
+
return pe.aggregateMeta(this.meta);
|
|
674
674
|
}
|
|
675
675
|
/**
|
|
676
676
|
*
|
|
@@ -690,28 +690,28 @@ class g {
|
|
|
690
690
|
return e;
|
|
691
691
|
}
|
|
692
692
|
}
|
|
693
|
-
function
|
|
693
|
+
function tt(o = null, e = 2048) {
|
|
694
694
|
if (o) {
|
|
695
695
|
const t = new L("SHAKE256", "TEXT");
|
|
696
696
|
return t.update(o), t.getHash("HEX", { outputLen: e * 2 });
|
|
697
697
|
} else
|
|
698
|
-
return
|
|
698
|
+
return nt(e);
|
|
699
699
|
}
|
|
700
|
-
function
|
|
700
|
+
function fe(o, e = null) {
|
|
701
701
|
const t = new L("SHAKE256", "TEXT");
|
|
702
702
|
return t.update(o), t.getHash("HEX", { outputLen: 256 });
|
|
703
703
|
}
|
|
704
|
-
function
|
|
704
|
+
function lt(o, e) {
|
|
705
705
|
const t = new L("SHAKE256", "TEXT");
|
|
706
706
|
return t.update(o), t.getHash("HEX", { outputLen: e });
|
|
707
707
|
}
|
|
708
|
-
function
|
|
708
|
+
function he({
|
|
709
709
|
molecularHash: o = null,
|
|
710
710
|
index: e = null
|
|
711
711
|
}) {
|
|
712
|
-
return o !== null && e !== null ?
|
|
712
|
+
return o !== null && e !== null ? fe(String(o) + String(e), "generateBatchId") : nt(64);
|
|
713
713
|
}
|
|
714
|
-
class
|
|
714
|
+
class me {
|
|
715
715
|
/**
|
|
716
716
|
*
|
|
717
717
|
* @param id
|
|
@@ -728,7 +728,7 @@ class ke {
|
|
|
728
728
|
*/
|
|
729
729
|
static createFromGraphQL(e) {
|
|
730
730
|
let t = e.metas || {};
|
|
731
|
-
return t.length && (t = JSON.parse(t), t || (t = {})), new
|
|
731
|
+
return t.length && (t = JSON.parse(t), t || (t = {})), new me(
|
|
732
732
|
e.id,
|
|
733
733
|
e.name,
|
|
734
734
|
t
|
|
@@ -740,7 +740,7 @@ class ke {
|
|
|
740
740
|
* @returns {TokenUnit}
|
|
741
741
|
*/
|
|
742
742
|
static createFromDB(e) {
|
|
743
|
-
return new
|
|
743
|
+
return new me(
|
|
744
744
|
e[0],
|
|
745
745
|
e[1],
|
|
746
746
|
e.length > 2 ? e[2] : {}
|
|
@@ -778,7 +778,7 @@ class ke {
|
|
|
778
778
|
};
|
|
779
779
|
}
|
|
780
780
|
}
|
|
781
|
-
class
|
|
781
|
+
class Ve extends x {
|
|
782
782
|
/**
|
|
783
783
|
* Class constructor
|
|
784
784
|
*
|
|
@@ -790,101 +790,101 @@ class dn extends x {
|
|
|
790
790
|
super(e, t, n), this.name = "WalletCredentialException";
|
|
791
791
|
}
|
|
792
792
|
}
|
|
793
|
-
const
|
|
794
|
-
function
|
|
795
|
-
return e ? { h: Number(o &
|
|
793
|
+
const Ce = /* @__PURE__ */ BigInt(2 ** 32 - 1), ct = /* @__PURE__ */ BigInt(32);
|
|
794
|
+
function gn(o, e = !1) {
|
|
795
|
+
return e ? { h: Number(o & Ce), l: Number(o >> ct & Ce) } : { h: Number(o >> ct & Ce) | 0, l: Number(o & Ce) | 0 };
|
|
796
796
|
}
|
|
797
|
-
function
|
|
797
|
+
function wn(o, e = !1) {
|
|
798
798
|
const t = o.length;
|
|
799
799
|
let n = new Uint32Array(t), s = new Uint32Array(t);
|
|
800
800
|
for (let r = 0; r < t; r++) {
|
|
801
|
-
const { h: i, l: a } =
|
|
801
|
+
const { h: i, l: a } = gn(o[r], e);
|
|
802
802
|
[n[r], s[r]] = [i, a];
|
|
803
803
|
}
|
|
804
804
|
return [n, s];
|
|
805
805
|
}
|
|
806
|
-
const
|
|
806
|
+
const bn = (o, e, t) => o << t | e >>> 32 - t, kn = (o, e, t) => e << t | o >>> 32 - t, Sn = (o, e, t) => e << t - 32 | o >>> 64 - t, _n = (o, e, t) => o << t - 32 | e >>> 64 - t;
|
|
807
807
|
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
808
|
-
function
|
|
808
|
+
function $n(o) {
|
|
809
809
|
return o instanceof Uint8Array || ArrayBuffer.isView(o) && o.constructor.name === "Uint8Array";
|
|
810
810
|
}
|
|
811
|
-
function
|
|
811
|
+
function ut(o, e = "") {
|
|
812
812
|
if (!Number.isSafeInteger(o) || o < 0) {
|
|
813
813
|
const t = e && `"${e}" `;
|
|
814
814
|
throw new Error(`${t}expected integer >0, got ${o}`);
|
|
815
815
|
}
|
|
816
816
|
}
|
|
817
817
|
function D(o, e, t = "") {
|
|
818
|
-
const n =
|
|
818
|
+
const n = $n(o), s = o == null ? void 0 : o.length, r = e !== void 0;
|
|
819
819
|
if (!n || r && s !== e) {
|
|
820
820
|
const i = t && `"${t}" `, a = r ? ` of length ${e}` : "", c = n ? `length=${s}` : `type=${typeof o}`;
|
|
821
821
|
throw new Error(i + "expected Uint8Array" + a + ", got " + c);
|
|
822
822
|
}
|
|
823
823
|
return o;
|
|
824
824
|
}
|
|
825
|
-
function
|
|
825
|
+
function ht(o, e = !0) {
|
|
826
826
|
if (o.destroyed)
|
|
827
827
|
throw new Error("Hash instance has been destroyed");
|
|
828
828
|
if (e && o.finished)
|
|
829
829
|
throw new Error("Hash#digest() has already been called");
|
|
830
830
|
}
|
|
831
|
-
function
|
|
831
|
+
function An(o, e) {
|
|
832
832
|
D(o, void 0, "digestInto() output");
|
|
833
833
|
const t = e.outputLen;
|
|
834
834
|
if (o.length < t)
|
|
835
835
|
throw new Error('"digestInto() output" expected to be of length >=' + t);
|
|
836
836
|
}
|
|
837
|
-
function
|
|
837
|
+
function Rt(o) {
|
|
838
838
|
return new Uint32Array(o.buffer, o.byteOffset, Math.floor(o.byteLength / 4));
|
|
839
839
|
}
|
|
840
|
-
function
|
|
840
|
+
function Ut(...o) {
|
|
841
841
|
for (let e = 0; e < o.length; e++)
|
|
842
842
|
o[e].fill(0);
|
|
843
843
|
}
|
|
844
|
-
const
|
|
845
|
-
function
|
|
844
|
+
const vn = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
|
845
|
+
function xn(o) {
|
|
846
846
|
return o << 24 & 4278190080 | o << 8 & 16711680 | o >>> 8 & 65280 | o >>> 24 & 255;
|
|
847
847
|
}
|
|
848
|
-
function
|
|
848
|
+
function In(o) {
|
|
849
849
|
for (let e = 0; e < o.length; e++)
|
|
850
|
-
o[e] =
|
|
850
|
+
o[e] = xn(o[e]);
|
|
851
851
|
return o;
|
|
852
852
|
}
|
|
853
|
-
const
|
|
854
|
-
function
|
|
853
|
+
const dt = vn ? (o) => o : In;
|
|
854
|
+
function Bt(o, e = {}) {
|
|
855
855
|
const t = (s, r) => o(r).update(s).digest(), n = o(void 0);
|
|
856
856
|
return t.outputLen = n.outputLen, t.blockLen = n.blockLen, t.create = (s) => o(s), Object.assign(t, e), Object.freeze(t);
|
|
857
857
|
}
|
|
858
|
-
function
|
|
858
|
+
function Tn(o = 32) {
|
|
859
859
|
const e = typeof globalThis == "object" ? globalThis.crypto : null;
|
|
860
860
|
if (typeof (e == null ? void 0 : e.getRandomValues) != "function")
|
|
861
861
|
throw new Error("crypto.getRandomValues must be defined");
|
|
862
862
|
return e.getRandomValues(new Uint8Array(o));
|
|
863
863
|
}
|
|
864
|
-
const
|
|
864
|
+
const Ne = (o) => ({
|
|
865
865
|
oid: Uint8Array.from([6, 9, 96, 134, 72, 1, 101, 3, 4, 2, o])
|
|
866
|
-
}),
|
|
867
|
-
for (let o = 0, e =
|
|
868
|
-
[t, n] = [n, (2 * t + 3 * n) % 5],
|
|
869
|
-
let s =
|
|
866
|
+
}), Mn = BigInt(0), ge = BigInt(1), Cn = BigInt(2), En = BigInt(7), On = BigInt(256), Wn = BigInt(113), qt = [], Ht = [], Pt = [];
|
|
867
|
+
for (let o = 0, e = ge, t = 1, n = 0; o < 24; o++) {
|
|
868
|
+
[t, n] = [n, (2 * t + 3 * n) % 5], qt.push(2 * (5 * n + t)), Ht.push((o + 1) * (o + 2) / 2 % 64);
|
|
869
|
+
let s = Mn;
|
|
870
870
|
for (let r = 0; r < 7; r++)
|
|
871
|
-
e = (e <<
|
|
872
|
-
|
|
871
|
+
e = (e << ge ^ (e >> En) * Wn) % On, e & Cn && (s ^= ge << (ge << BigInt(r)) - ge);
|
|
872
|
+
Pt.push(s);
|
|
873
873
|
}
|
|
874
|
-
const
|
|
875
|
-
function
|
|
874
|
+
const Kt = wn(Pt, !0), Rn = Kt[0], Un = Kt[1], pt = (o, e, t) => t > 32 ? Sn(o, e, t) : bn(o, e, t), ft = (o, e, t) => t > 32 ? _n(o, e, t) : kn(o, e, t);
|
|
875
|
+
function Bn(o, e = 24) {
|
|
876
876
|
const t = new Uint32Array(10);
|
|
877
877
|
for (let n = 24 - e; n < 24; n++) {
|
|
878
878
|
for (let i = 0; i < 10; i++)
|
|
879
879
|
t[i] = o[i] ^ o[i + 10] ^ o[i + 20] ^ o[i + 30] ^ o[i + 40];
|
|
880
880
|
for (let i = 0; i < 10; i += 2) {
|
|
881
|
-
const a = (i + 8) % 10, c = (i + 2) % 10, u = t[c], l = t[c + 1], h =
|
|
881
|
+
const a = (i + 8) % 10, c = (i + 2) % 10, u = t[c], l = t[c + 1], h = pt(u, l, 1) ^ t[a], p = ft(u, l, 1) ^ t[a + 1];
|
|
882
882
|
for (let d = 0; d < 50; d += 10)
|
|
883
883
|
o[i + d] ^= h, o[i + d + 1] ^= p;
|
|
884
884
|
}
|
|
885
885
|
let s = o[2], r = o[3];
|
|
886
886
|
for (let i = 0; i < 24; i++) {
|
|
887
|
-
const a =
|
|
887
|
+
const a = Ht[i], c = pt(s, r, a), u = ft(s, r, a), l = qt[i];
|
|
888
888
|
s = o[l], r = o[l + 1], o[l] = c, o[l + 1] = u;
|
|
889
889
|
}
|
|
890
890
|
for (let i = 0; i < 50; i += 10) {
|
|
@@ -893,36 +893,36 @@ function On(o, e = 24) {
|
|
|
893
893
|
for (let a = 0; a < 10; a++)
|
|
894
894
|
o[i + a] ^= ~t[(a + 2) % 10] & t[(a + 4) % 10];
|
|
895
895
|
}
|
|
896
|
-
o[0] ^=
|
|
896
|
+
o[0] ^= Rn[n], o[1] ^= Un[n];
|
|
897
897
|
}
|
|
898
|
-
|
|
898
|
+
Ut(t);
|
|
899
899
|
}
|
|
900
|
-
class
|
|
900
|
+
class Fe {
|
|
901
901
|
// NOTE: we accept arguments in bytes instead of bits here.
|
|
902
902
|
constructor(e, t, n, s = !1, r = 24) {
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
if (this.blockLen = e, this.suffix = t, this.outputLen = n, this.enableXOF = s, this.rounds = r,
|
|
903
|
+
j(this, "state");
|
|
904
|
+
j(this, "pos", 0);
|
|
905
|
+
j(this, "posOut", 0);
|
|
906
|
+
j(this, "finished", !1);
|
|
907
|
+
j(this, "state32");
|
|
908
|
+
j(this, "destroyed", !1);
|
|
909
|
+
j(this, "blockLen");
|
|
910
|
+
j(this, "suffix");
|
|
911
|
+
j(this, "outputLen");
|
|
912
|
+
j(this, "enableXOF", !1);
|
|
913
|
+
j(this, "rounds");
|
|
914
|
+
if (this.blockLen = e, this.suffix = t, this.outputLen = n, this.enableXOF = s, this.rounds = r, ut(n, "outputLen"), !(0 < e && e < 200))
|
|
915
915
|
throw new Error("only keccak-f1600 function is supported");
|
|
916
|
-
this.state = new Uint8Array(200), this.state32 =
|
|
916
|
+
this.state = new Uint8Array(200), this.state32 = Rt(this.state);
|
|
917
917
|
}
|
|
918
918
|
clone() {
|
|
919
919
|
return this._cloneInto();
|
|
920
920
|
}
|
|
921
921
|
keccak() {
|
|
922
|
-
|
|
922
|
+
dt(this.state32), Bn(this.state32, this.rounds), dt(this.state32), this.posOut = 0, this.pos = 0;
|
|
923
923
|
}
|
|
924
924
|
update(e) {
|
|
925
|
-
|
|
925
|
+
ht(this), D(e);
|
|
926
926
|
const { blockLen: t, state: n } = this, s = e.length;
|
|
927
927
|
for (let r = 0; r < s; ) {
|
|
928
928
|
const i = Math.min(t - this.pos, s - r);
|
|
@@ -940,7 +940,7 @@ class Pe {
|
|
|
940
940
|
e[n] ^= t, (t & 128) !== 0 && n === s - 1 && this.keccak(), e[s - 1] ^= 128, this.keccak();
|
|
941
941
|
}
|
|
942
942
|
writeInto(e) {
|
|
943
|
-
|
|
943
|
+
ht(this, !1), D(e), this.finish();
|
|
944
944
|
const t = this.state, { blockLen: n } = this;
|
|
945
945
|
for (let s = 0, r = e.length; s < r; ) {
|
|
946
946
|
this.posOut >= n && this.keccak();
|
|
@@ -955,10 +955,10 @@ class Pe {
|
|
|
955
955
|
return this.writeInto(e);
|
|
956
956
|
}
|
|
957
957
|
xof(e) {
|
|
958
|
-
return
|
|
958
|
+
return ut(e), this.xofInto(new Uint8Array(e));
|
|
959
959
|
}
|
|
960
960
|
digestInto(e) {
|
|
961
|
-
if (
|
|
961
|
+
if (An(e, this), this.finished)
|
|
962
962
|
throw new Error("digest() was already called");
|
|
963
963
|
return this.writeInto(e), this.destroy(), e;
|
|
964
964
|
}
|
|
@@ -966,49 +966,49 @@ class Pe {
|
|
|
966
966
|
return this.digestInto(new Uint8Array(this.outputLen));
|
|
967
967
|
}
|
|
968
968
|
destroy() {
|
|
969
|
-
this.destroyed = !0,
|
|
969
|
+
this.destroyed = !0, Ut(this.state);
|
|
970
970
|
}
|
|
971
971
|
_cloneInto(e) {
|
|
972
972
|
const { blockLen: t, suffix: n, outputLen: s, rounds: r, enableXOF: i } = this;
|
|
973
|
-
return e || (e = new
|
|
973
|
+
return e || (e = new Fe(t, n, s, i, r)), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = r, e.suffix = n, e.outputLen = s, e.enableXOF = i, e.destroyed = this.destroyed, e;
|
|
974
974
|
}
|
|
975
975
|
}
|
|
976
|
-
const
|
|
976
|
+
const Nt = (o, e, t, n = {}) => Bt(() => new Fe(e, o, t), n), qn = /* @__PURE__ */ Nt(
|
|
977
977
|
6,
|
|
978
978
|
136,
|
|
979
979
|
32,
|
|
980
|
-
/* @__PURE__ */
|
|
981
|
-
),
|
|
980
|
+
/* @__PURE__ */ Ne(8)
|
|
981
|
+
), Hn = /* @__PURE__ */ Nt(
|
|
982
982
|
6,
|
|
983
983
|
72,
|
|
984
984
|
64,
|
|
985
|
-
/* @__PURE__ */
|
|
986
|
-
),
|
|
987
|
-
function
|
|
985
|
+
/* @__PURE__ */ Ne(10)
|
|
986
|
+
), Ft = (o, e, t, n = {}) => Bt((s = {}) => new Fe(e, o, s.dkLen === void 0 ? t : s.dkLen, !0), n), Pn = /* @__PURE__ */ Ft(31, 168, 16, /* @__PURE__ */ Ne(11)), Lt = /* @__PURE__ */ Ft(31, 136, 32, /* @__PURE__ */ Ne(12));
|
|
987
|
+
function rt(o) {
|
|
988
988
|
if (!Number.isSafeInteger(o) || o < 0 || o > 4294967295)
|
|
989
989
|
throw new Error("wrong u32 integer:" + o);
|
|
990
990
|
return o;
|
|
991
991
|
}
|
|
992
|
-
function
|
|
993
|
-
return
|
|
992
|
+
function jt(o) {
|
|
993
|
+
return rt(o), (o & o - 1) === 0 && o !== 0;
|
|
994
994
|
}
|
|
995
|
-
function
|
|
996
|
-
|
|
995
|
+
function Qt(o, e) {
|
|
996
|
+
rt(o);
|
|
997
997
|
let t = 0;
|
|
998
998
|
for (let n = 0; n < e; n++, o >>>= 1)
|
|
999
999
|
t = t << 1 | o & 1;
|
|
1000
1000
|
return t;
|
|
1001
1001
|
}
|
|
1002
|
-
function
|
|
1003
|
-
return
|
|
1002
|
+
function Dt(o) {
|
|
1003
|
+
return rt(o), 31 - Math.clz32(o);
|
|
1004
1004
|
}
|
|
1005
|
-
function
|
|
1005
|
+
function mt(o) {
|
|
1006
1006
|
const e = o.length;
|
|
1007
|
-
if (e < 2 || !
|
|
1007
|
+
if (e < 2 || !jt(e))
|
|
1008
1008
|
throw new Error("n must be a power of 2 and greater than 1. Got " + e);
|
|
1009
|
-
const t =
|
|
1009
|
+
const t = Dt(e);
|
|
1010
1010
|
for (let n = 0; n < e; n++) {
|
|
1011
|
-
const s =
|
|
1011
|
+
const s = Qt(n, t);
|
|
1012
1012
|
if (n < s) {
|
|
1013
1013
|
const r = o[n];
|
|
1014
1014
|
o[n] = o[s], o[s] = r;
|
|
@@ -1016,32 +1016,32 @@ function ct(o) {
|
|
|
1016
1016
|
}
|
|
1017
1017
|
return o;
|
|
1018
1018
|
}
|
|
1019
|
-
const
|
|
1020
|
-
const { N: t, roots: n, dit: s, invertButterflies: r = !1, skipStages: i = 0, brp: a = !0 } = e, c =
|
|
1021
|
-
if (!
|
|
1019
|
+
const yt = (o, e) => {
|
|
1020
|
+
const { N: t, roots: n, dit: s, invertButterflies: r = !1, skipStages: i = 0, brp: a = !0 } = e, c = Dt(t);
|
|
1021
|
+
if (!jt(t))
|
|
1022
1022
|
throw new Error("FFT: Polynomial size should be power of two");
|
|
1023
1023
|
const u = s !== r;
|
|
1024
1024
|
return (l) => {
|
|
1025
1025
|
if (l.length !== t)
|
|
1026
1026
|
throw new Error("FFT: wrong Polynomial length");
|
|
1027
|
-
s && a &&
|
|
1027
|
+
s && a && mt(l);
|
|
1028
1028
|
for (let h = 0, p = 1; h < c - i; h++) {
|
|
1029
|
-
const d = s ? h + 1 + i : c - h, w = 1 << d,
|
|
1030
|
-
for (let
|
|
1031
|
-
for (let y = 0, b = p++; y <
|
|
1032
|
-
const M = r ? s ? t - b : b : y * T, k =
|
|
1029
|
+
const d = s ? h + 1 + i : c - h, w = 1 << d, A = w >> 1, T = t >> d;
|
|
1030
|
+
for (let f = 0; f < t; f += w)
|
|
1031
|
+
for (let y = 0, b = p++; y < A; y++) {
|
|
1032
|
+
const M = r ? s ? t - b : b : y * T, k = f + y, $ = f + y + A, v = n[M], I = l[$], S = l[k];
|
|
1033
1033
|
if (u) {
|
|
1034
|
-
const
|
|
1035
|
-
l[k] = o.add(
|
|
1036
|
-
} else r ? (l[k] = o.add(I,
|
|
1034
|
+
const B = o.mul(I, v);
|
|
1035
|
+
l[k] = o.add(S, B), l[$] = o.sub(S, B);
|
|
1036
|
+
} else r ? (l[k] = o.add(I, S), l[$] = o.mul(o.sub(I, S), v)) : (l[k] = o.add(S, I), l[$] = o.mul(o.sub(S, I), v));
|
|
1037
1037
|
}
|
|
1038
1038
|
}
|
|
1039
|
-
return !s && a &&
|
|
1039
|
+
return !s && a && mt(l), l;
|
|
1040
1040
|
};
|
|
1041
1041
|
};
|
|
1042
1042
|
/*! noble-post-quantum - MIT License (c) 2024 Paul Miller (paulmillr.com) */
|
|
1043
|
-
const
|
|
1044
|
-
function
|
|
1043
|
+
const gt = Tn;
|
|
1044
|
+
function ze(o, e) {
|
|
1045
1045
|
if (o.length !== e.length)
|
|
1046
1046
|
return !1;
|
|
1047
1047
|
let t = 0;
|
|
@@ -1049,10 +1049,10 @@ function je(o, e) {
|
|
|
1049
1049
|
t |= o[n] ^ e[n];
|
|
1050
1050
|
return t === 0;
|
|
1051
1051
|
}
|
|
1052
|
-
function
|
|
1052
|
+
function Kn(o) {
|
|
1053
1053
|
return Uint8Array.from(o);
|
|
1054
1054
|
}
|
|
1055
|
-
function
|
|
1055
|
+
function Be(o, ...e) {
|
|
1056
1056
|
const t = (s) => typeof s == "number" ? s : s.bytesLen, n = e.reduce((s, r) => s + t(r), 0);
|
|
1057
1057
|
return {
|
|
1058
1058
|
bytesLen: n,
|
|
@@ -1075,7 +1075,7 @@ function Oe(o, ...e) {
|
|
|
1075
1075
|
}
|
|
1076
1076
|
};
|
|
1077
1077
|
}
|
|
1078
|
-
function
|
|
1078
|
+
function Je(o, e) {
|
|
1079
1079
|
const t = e * o.bytesLen;
|
|
1080
1080
|
return {
|
|
1081
1081
|
bytesLen: t,
|
|
@@ -1106,31 +1106,31 @@ function G(...o) {
|
|
|
1106
1106
|
else
|
|
1107
1107
|
e.fill(0);
|
|
1108
1108
|
}
|
|
1109
|
-
function
|
|
1109
|
+
function wt(o) {
|
|
1110
1110
|
return (1 << o) - 1;
|
|
1111
1111
|
}
|
|
1112
1112
|
/*! noble-post-quantum - MIT License (c) 2024 Paul Miller (paulmillr.com) */
|
|
1113
|
-
const
|
|
1114
|
-
const { newPoly: e, N: t, Q: n, F: s, ROOT_OF_UNITY: r, brvBits: i } = o, a = (
|
|
1115
|
-
const b =
|
|
1113
|
+
const Nn = (o) => {
|
|
1114
|
+
const { newPoly: e, N: t, Q: n, F: s, ROOT_OF_UNITY: r, brvBits: i } = o, a = (f, y = n) => {
|
|
1115
|
+
const b = f % y | 0;
|
|
1116
1116
|
return (b >= 0 ? b | 0 : y + b | 0) | 0;
|
|
1117
|
-
}, c = (
|
|
1118
|
-
const b = a(
|
|
1117
|
+
}, c = (f, y = n) => {
|
|
1118
|
+
const b = a(f, y) | 0;
|
|
1119
1119
|
return (b > y >> 1 ? b - y | 0 : b) | 0;
|
|
1120
1120
|
};
|
|
1121
1121
|
function u() {
|
|
1122
|
-
const
|
|
1122
|
+
const f = e(t);
|
|
1123
1123
|
for (let y = 0; y < t; y++) {
|
|
1124
|
-
const b =
|
|
1125
|
-
|
|
1124
|
+
const b = Qt(y, i), M = BigInt(r) ** BigInt(b) % BigInt(n);
|
|
1125
|
+
f[y] = Number(M) | 0;
|
|
1126
1126
|
}
|
|
1127
|
-
return
|
|
1127
|
+
return f;
|
|
1128
1128
|
}
|
|
1129
1129
|
const l = u(), h = {
|
|
1130
|
-
add: (
|
|
1131
|
-
sub: (
|
|
1132
|
-
mul: (
|
|
1133
|
-
inv: (
|
|
1130
|
+
add: (f, y) => a((f | 0) + (y | 0)) | 0,
|
|
1131
|
+
sub: (f, y) => a((f | 0) - (y | 0)) | 0,
|
|
1132
|
+
mul: (f, y) => a((f | 0) * (y | 0)) | 0,
|
|
1133
|
+
inv: (f) => {
|
|
1134
1134
|
throw new Error("not implemented");
|
|
1135
1135
|
}
|
|
1136
1136
|
}, p = {
|
|
@@ -1139,36 +1139,36 @@ const Bn = (o) => {
|
|
|
1139
1139
|
invertButterflies: !0,
|
|
1140
1140
|
skipStages: 1,
|
|
1141
1141
|
brp: !1
|
|
1142
|
-
}, d =
|
|
1142
|
+
}, d = yt(h, { dit: !1, ...p }), w = yt(h, { dit: !0, ...p });
|
|
1143
1143
|
return { mod: a, smod: c, nttZetas: l, NTT: {
|
|
1144
|
-
encode: (
|
|
1145
|
-
decode: (
|
|
1146
|
-
w(
|
|
1147
|
-
for (let y = 0; y <
|
|
1148
|
-
|
|
1149
|
-
return
|
|
1144
|
+
encode: (f) => d(f),
|
|
1145
|
+
decode: (f) => {
|
|
1146
|
+
w(f);
|
|
1147
|
+
for (let y = 0; y < f.length; y++)
|
|
1148
|
+
f[y] = a(s * f[y]);
|
|
1149
|
+
return f;
|
|
1150
1150
|
}
|
|
1151
|
-
}, bitsCoder: (
|
|
1152
|
-
const b =
|
|
1151
|
+
}, bitsCoder: (f, y) => {
|
|
1152
|
+
const b = wt(f), M = f * (t / 8);
|
|
1153
1153
|
return {
|
|
1154
1154
|
bytesLen: M,
|
|
1155
1155
|
encode: (k) => {
|
|
1156
|
-
const
|
|
1157
|
-
for (let v = 0, I = 0,
|
|
1158
|
-
for (I |= (y.encode(k[v]) & b) <<
|
|
1159
|
-
|
|
1160
|
-
return
|
|
1156
|
+
const $ = new Uint8Array(M);
|
|
1157
|
+
for (let v = 0, I = 0, S = 0, B = 0; v < k.length; v++)
|
|
1158
|
+
for (I |= (y.encode(k[v]) & b) << S, S += f; S >= 8; S -= 8, I >>= 8)
|
|
1159
|
+
$[B++] = I & wt(S);
|
|
1160
|
+
return $;
|
|
1161
1161
|
},
|
|
1162
1162
|
decode: (k) => {
|
|
1163
|
-
const
|
|
1164
|
-
for (let v = 0, I = 0,
|
|
1165
|
-
for (I |= k[v] <<
|
|
1166
|
-
|
|
1167
|
-
return
|
|
1163
|
+
const $ = e(t);
|
|
1164
|
+
for (let v = 0, I = 0, S = 0, B = 0; v < k.length; v++)
|
|
1165
|
+
for (I |= k[v] << S, S += 8; S >= f; S -= f, I >>= f)
|
|
1166
|
+
$[B++] = y.decode(I & b);
|
|
1167
|
+
return $;
|
|
1168
1168
|
}
|
|
1169
1169
|
};
|
|
1170
1170
|
} };
|
|
1171
|
-
},
|
|
1171
|
+
}, Fn = (o) => (e, t) => {
|
|
1172
1172
|
t || (t = o.blockLen);
|
|
1173
1173
|
const n = new Uint8Array(e.length + 2);
|
|
1174
1174
|
n.set(e);
|
|
@@ -1181,18 +1181,18 @@ const Bn = (o) => {
|
|
|
1181
1181
|
i.destroy(), G(r, n);
|
|
1182
1182
|
}
|
|
1183
1183
|
};
|
|
1184
|
-
},
|
|
1184
|
+
}, Ln = /* @__PURE__ */ Fn(Pn);
|
|
1185
1185
|
/*! noble-post-quantum - MIT License (c) 2024 Paul Miller (paulmillr.com) */
|
|
1186
|
-
const
|
|
1187
|
-
N:
|
|
1186
|
+
const F = 256, le = 3329, jn = 3303, Qn = 17, { mod: $e, nttZetas: Dn, NTT: te, bitsCoder: Vn } = Nn({
|
|
1187
|
+
N: F,
|
|
1188
1188
|
Q: le,
|
|
1189
|
-
F:
|
|
1190
|
-
ROOT_OF_UNITY:
|
|
1189
|
+
F: jn,
|
|
1190
|
+
ROOT_OF_UNITY: Qn,
|
|
1191
1191
|
newPoly: (o) => new Uint16Array(o),
|
|
1192
1192
|
brvBits: 7
|
|
1193
|
-
}),
|
|
1194
|
-
768: { N:
|
|
1195
|
-
},
|
|
1193
|
+
}), zn = {
|
|
1194
|
+
768: { N: F, Q: le, K: 3, ETA1: 2, ETA2: 2, du: 10, dv: 4, RBGstrength: 192 }
|
|
1195
|
+
}, Jn = (o) => {
|
|
1196
1196
|
if (o >= 12)
|
|
1197
1197
|
return { encode: (t) => t, decode: (t) => t };
|
|
1198
1198
|
const e = 2 ** (o - 1);
|
|
@@ -1202,55 +1202,55 @@ const K = 256, le = 3329, Kn = 3303, Nn = 17, { mod: _e, nttZetas: Ln, NTT: te,
|
|
|
1202
1202
|
// const decompress = (i: number) => round((Q / 2 ** d) * i);
|
|
1203
1203
|
decode: (t) => t * le + e >>> o
|
|
1204
1204
|
};
|
|
1205
|
-
},
|
|
1205
|
+
}, we = (o) => Vn(o, Jn(o));
|
|
1206
1206
|
function ne(o, e) {
|
|
1207
|
-
for (let t = 0; t <
|
|
1208
|
-
o[t] =
|
|
1207
|
+
for (let t = 0; t < F; t++)
|
|
1208
|
+
o[t] = $e(o[t] + e[t]);
|
|
1209
1209
|
}
|
|
1210
|
-
function
|
|
1211
|
-
for (let t = 0; t <
|
|
1212
|
-
o[t] =
|
|
1210
|
+
function Gn(o, e) {
|
|
1211
|
+
for (let t = 0; t < F; t++)
|
|
1212
|
+
o[t] = $e(o[t] - e[t]);
|
|
1213
1213
|
}
|
|
1214
|
-
function
|
|
1215
|
-
const r =
|
|
1214
|
+
function Xn(o, e, t, n, s) {
|
|
1215
|
+
const r = $e(e * n * s + o * t), i = $e(o * n + e * t);
|
|
1216
1216
|
return { c0: r, c1: i };
|
|
1217
1217
|
}
|
|
1218
|
-
function
|
|
1219
|
-
for (let t = 0; t <
|
|
1220
|
-
let n =
|
|
1218
|
+
function Ee(o, e) {
|
|
1219
|
+
for (let t = 0; t < F / 2; t++) {
|
|
1220
|
+
let n = Dn[64 + (t >> 1)];
|
|
1221
1221
|
t & 1 && (n = -n);
|
|
1222
|
-
const { c0: s, c1: r } =
|
|
1222
|
+
const { c0: s, c1: r } = Xn(o[2 * t + 0], o[2 * t + 1], e[2 * t + 0], e[2 * t + 1], n);
|
|
1223
1223
|
o[2 * t + 0] = s, o[2 * t + 1] = r;
|
|
1224
1224
|
}
|
|
1225
1225
|
return o;
|
|
1226
1226
|
}
|
|
1227
|
-
function
|
|
1228
|
-
const e = new Uint16Array(
|
|
1229
|
-
for (let t = 0; t <
|
|
1227
|
+
function bt(o) {
|
|
1228
|
+
const e = new Uint16Array(F);
|
|
1229
|
+
for (let t = 0; t < F; ) {
|
|
1230
1230
|
const n = o();
|
|
1231
1231
|
if (n.length % 3)
|
|
1232
1232
|
throw new Error("SampleNTT: unaligned block");
|
|
1233
|
-
for (let s = 0; t <
|
|
1233
|
+
for (let s = 0; t < F && s + 3 <= n.length; s += 3) {
|
|
1234
1234
|
const r = (n[s + 0] >> 0 | n[s + 1] << 8) & 4095, i = (n[s + 1] >> 4 | n[s + 2] << 4) & 4095;
|
|
1235
|
-
r < le && (e[t++] = r), t <
|
|
1235
|
+
r < le && (e[t++] = r), t < F && i < le && (e[t++] = i);
|
|
1236
1236
|
}
|
|
1237
1237
|
}
|
|
1238
1238
|
return e;
|
|
1239
1239
|
}
|
|
1240
|
-
function
|
|
1241
|
-
const s = o(n *
|
|
1240
|
+
function be(o, e, t, n) {
|
|
1241
|
+
const s = o(n * F / 4, e, t), r = new Uint16Array(F), i = Rt(s);
|
|
1242
1242
|
let a = 0;
|
|
1243
1243
|
for (let c = 0, u = 0, l = 0, h = 0; c < i.length; c++) {
|
|
1244
1244
|
let p = i[c];
|
|
1245
1245
|
for (let d = 0; d < 32; d++)
|
|
1246
|
-
l += p & 1, p >>= 1, a += 1, a === n ? (h = l, l = 0) : a === 2 * n && (r[u++] =
|
|
1246
|
+
l += p & 1, p >>= 1, a += 1, a === n ? (h = l, l = 0) : a === 2 * n && (r[u++] = $e(h - l), l = 0, a = 0);
|
|
1247
1247
|
}
|
|
1248
1248
|
if (a)
|
|
1249
1249
|
throw new Error(`sampleCBD: leftover bits: ${a}`);
|
|
1250
1250
|
return r;
|
|
1251
1251
|
}
|
|
1252
|
-
const
|
|
1253
|
-
const { K: e, PRF: t, XOF: n, HASH512: s, ETA1: r, ETA2: i, du: a, dv: c } = o, u =
|
|
1252
|
+
const Zn = (o) => {
|
|
1253
|
+
const { K: e, PRF: t, XOF: n, HASH512: s, ETA1: r, ETA2: i, du: a, dv: c } = o, u = we(1), l = we(c), h = we(a), p = Be("publicKey", Je(we(12), e), 32), d = Je(we(12), e), w = Be("ciphertext", Je(h, e), l), A = Be("seed", 32, 32);
|
|
1254
1254
|
return {
|
|
1255
1255
|
secretCoder: d,
|
|
1256
1256
|
lengths: {
|
|
@@ -1260,56 +1260,56 @@ const zn = (o) => {
|
|
|
1260
1260
|
},
|
|
1261
1261
|
keygen: (T) => {
|
|
1262
1262
|
D(T, 32, "seed");
|
|
1263
|
-
const
|
|
1264
|
-
|
|
1265
|
-
const y = s(
|
|
1266
|
-
for (let
|
|
1267
|
-
k.push(te.encode(
|
|
1263
|
+
const f = new Uint8Array(33);
|
|
1264
|
+
f.set(T), f[32] = e;
|
|
1265
|
+
const y = s(f), [b, M] = A.decode(y), k = [], $ = [];
|
|
1266
|
+
for (let S = 0; S < e; S++)
|
|
1267
|
+
k.push(te.encode(be(t, M, S, r)));
|
|
1268
1268
|
const v = n(b);
|
|
1269
|
-
for (let
|
|
1270
|
-
const
|
|
1271
|
-
for (let
|
|
1272
|
-
const ce =
|
|
1273
|
-
ne(
|
|
1269
|
+
for (let S = 0; S < e; S++) {
|
|
1270
|
+
const B = te.encode(be(t, M, e + S, r));
|
|
1271
|
+
for (let W = 0; W < e; W++) {
|
|
1272
|
+
const ce = bt(v.get(W, S));
|
|
1273
|
+
ne(B, Ee(ce, k[W]));
|
|
1274
1274
|
}
|
|
1275
|
-
|
|
1275
|
+
$.push(B);
|
|
1276
1276
|
}
|
|
1277
1277
|
v.clean();
|
|
1278
1278
|
const I = {
|
|
1279
|
-
publicKey: p.encode([
|
|
1279
|
+
publicKey: p.encode([$, b]),
|
|
1280
1280
|
secretKey: d.encode(k)
|
|
1281
1281
|
};
|
|
1282
|
-
return G(b, M, k,
|
|
1282
|
+
return G(b, M, k, $, f, y), I;
|
|
1283
1283
|
},
|
|
1284
|
-
encrypt: (T,
|
|
1284
|
+
encrypt: (T, f, y) => {
|
|
1285
1285
|
const [b, M] = p.decode(T), k = [];
|
|
1286
|
-
for (let
|
|
1287
|
-
k.push(te.encode(
|
|
1288
|
-
const
|
|
1289
|
-
for (let
|
|
1290
|
-
const ce =
|
|
1291
|
-
for (let
|
|
1292
|
-
const
|
|
1293
|
-
ne(
|
|
1286
|
+
for (let W = 0; W < e; W++)
|
|
1287
|
+
k.push(te.encode(be(t, y, W, r)));
|
|
1288
|
+
const $ = n(M), v = new Uint16Array(F), I = [];
|
|
1289
|
+
for (let W = 0; W < e; W++) {
|
|
1290
|
+
const ce = be(t, y, e + W, i), Qe = new Uint16Array(F);
|
|
1291
|
+
for (let Me = 0; Me < e; Me++) {
|
|
1292
|
+
const Zt = bt($.get(W, Me));
|
|
1293
|
+
ne(Qe, Ee(Zt, k[Me]));
|
|
1294
1294
|
}
|
|
1295
|
-
ne(ce, te.decode(
|
|
1295
|
+
ne(ce, te.decode(Qe)), I.push(ce), ne(v, Ee(b[W], k[W])), G(Qe);
|
|
1296
1296
|
}
|
|
1297
|
-
|
|
1298
|
-
const
|
|
1299
|
-
ne(
|
|
1300
|
-
const
|
|
1301
|
-
return ne(
|
|
1297
|
+
$.clean();
|
|
1298
|
+
const S = be(t, y, 2 * e, i);
|
|
1299
|
+
ne(S, te.decode(v));
|
|
1300
|
+
const B = u.decode(f);
|
|
1301
|
+
return ne(B, S), G(b, k, v, S), w.encode([I, B]);
|
|
1302
1302
|
},
|
|
1303
|
-
decrypt: (T,
|
|
1304
|
-
const [y, b] = w.decode(T), M = d.decode(
|
|
1305
|
-
for (let
|
|
1306
|
-
ne(k,
|
|
1307
|
-
return
|
|
1303
|
+
decrypt: (T, f) => {
|
|
1304
|
+
const [y, b] = w.decode(T), M = d.decode(f), k = new Uint16Array(F);
|
|
1305
|
+
for (let $ = 0; $ < e; $++)
|
|
1306
|
+
ne(k, Ee(M[$], te.encode(y[$])));
|
|
1307
|
+
return Gn(b, te.decode(k)), G(k, M, y), u.encode(b);
|
|
1308
1308
|
}
|
|
1309
1309
|
};
|
|
1310
1310
|
};
|
|
1311
|
-
function
|
|
1312
|
-
const e =
|
|
1311
|
+
function Yn(o) {
|
|
1312
|
+
const e = Zn(o), { HASH256: t, HASH512: n, KDF: s } = o, { secretCoder: r, lengths: i } = e, a = Be("secretKey", i.secretKey, i.publicKey, 32, 32), c = 32, u = 64;
|
|
1313
1313
|
return {
|
|
1314
1314
|
info: { type: "ml-kem" },
|
|
1315
1315
|
lengths: {
|
|
@@ -1319,7 +1319,7 @@ function Jn(o) {
|
|
|
1319
1319
|
msgRand: c,
|
|
1320
1320
|
secretKey: a.bytesLen
|
|
1321
1321
|
},
|
|
1322
|
-
keygen: (l =
|
|
1322
|
+
keygen: (l = gt(u)) => {
|
|
1323
1323
|
D(l, u, "seed");
|
|
1324
1324
|
const { publicKey: h, secretKey: p } = e.keygen(l.subarray(0, 32)), d = t(h), w = a.encode([p, h, d, l.subarray(32)]);
|
|
1325
1325
|
return G(p, d), { publicKey: h, secretKey: w };
|
|
@@ -1328,39 +1328,39 @@ function Jn(o) {
|
|
|
1328
1328
|
const [h, p] = a.decode(l);
|
|
1329
1329
|
return Uint8Array.from(p);
|
|
1330
1330
|
},
|
|
1331
|
-
encapsulate: (l, h =
|
|
1331
|
+
encapsulate: (l, h = gt(c)) => {
|
|
1332
1332
|
D(l, i.publicKey, "publicKey"), D(h, c, "message");
|
|
1333
|
-
const p = l.subarray(0, 384 * o.K), d = r.encode(r.decode(
|
|
1334
|
-
if (!
|
|
1333
|
+
const p = l.subarray(0, 384 * o.K), d = r.encode(r.decode(Kn(p)));
|
|
1334
|
+
if (!ze(d, p))
|
|
1335
1335
|
throw G(d), new Error("ML-KEM.encapsulate: wrong publicKey modulus");
|
|
1336
1336
|
G(d);
|
|
1337
|
-
const w = n.create().update(h).update(t(l)).digest(),
|
|
1338
|
-
return G(w.subarray(32)), { cipherText:
|
|
1337
|
+
const w = n.create().update(h).update(t(l)).digest(), A = e.encrypt(l, h, w.subarray(32, 64));
|
|
1338
|
+
return G(w.subarray(32)), { cipherText: A, sharedSecret: w.subarray(0, 32) };
|
|
1339
1339
|
},
|
|
1340
1340
|
decapsulate: (l, h) => {
|
|
1341
1341
|
D(h, a.bytesLen, "secretKey"), D(l, i.cipherText, "cipherText");
|
|
1342
1342
|
const p = a.bytesLen - 96, d = p + 32, w = t(h.subarray(p / 2, d));
|
|
1343
|
-
if (!
|
|
1343
|
+
if (!ze(w, h.subarray(d, d + 32)))
|
|
1344
1344
|
throw new Error("invalid secretKey: hash check failed");
|
|
1345
|
-
const [
|
|
1346
|
-
return G(b,
|
|
1345
|
+
const [A, T, f, y] = a.decode(h), b = e.decrypt(l, A), M = n.create().update(b).update(f).digest(), k = M.subarray(0, 32), $ = e.encrypt(T, b, M.subarray(32, 64)), v = ze(l, $), I = s.create({ dkLen: 32 }).update(y).update(l).digest();
|
|
1346
|
+
return G(b, $, v ? I : k), v ? k : I;
|
|
1347
1347
|
}
|
|
1348
1348
|
};
|
|
1349
1349
|
}
|
|
1350
|
-
function
|
|
1351
|
-
return
|
|
1352
|
-
}
|
|
1353
|
-
const
|
|
1354
|
-
HASH256:
|
|
1355
|
-
HASH512:
|
|
1356
|
-
KDF:
|
|
1357
|
-
XOF:
|
|
1358
|
-
PRF:
|
|
1359
|
-
},
|
|
1360
|
-
...
|
|
1361
|
-
...
|
|
1350
|
+
function es(o, e, t) {
|
|
1351
|
+
return Lt.create({ dkLen: o }).update(e).update(new Uint8Array([t])).digest();
|
|
1352
|
+
}
|
|
1353
|
+
const ts = {
|
|
1354
|
+
HASH256: qn,
|
|
1355
|
+
HASH512: Hn,
|
|
1356
|
+
KDF: Lt,
|
|
1357
|
+
XOF: Ln,
|
|
1358
|
+
PRF: es
|
|
1359
|
+
}, Ge = /* @__PURE__ */ Yn({
|
|
1360
|
+
...ts,
|
|
1361
|
+
...zn[768]
|
|
1362
1362
|
});
|
|
1363
|
-
class
|
|
1363
|
+
class _ {
|
|
1364
1364
|
/**
|
|
1365
1365
|
* Class constructor
|
|
1366
1366
|
*
|
|
@@ -1381,11 +1381,11 @@ class S {
|
|
|
1381
1381
|
batchId: i = null,
|
|
1382
1382
|
characters: a = null
|
|
1383
1383
|
}) {
|
|
1384
|
-
this.token = n, this.balance = 0, this.molecules = {}, this.key = null, this.privkey = null, this.pubkey = null, this.tokenUnits = [], this.tradeRates = {}, this.address = s, this.position = r, this.bundle = t, this.batchId = i, this.characters = a, e && (this.bundle = this.bundle ||
|
|
1384
|
+
this.token = n, this.balance = "0", this.molecules = {}, this.key = null, this.privkey = null, this.pubkey = null, this.tokenUnits = [], this.tradeRates = {}, this.address = s, this.position = r, this.bundle = t, this.batchId = i, this.characters = a, e && (this.bundle = this.bundle || fe(e, "Wallet::constructor"), this.position = this.position || _.generatePosition(), this.key = _.generateKey({
|
|
1385
1385
|
secret: e,
|
|
1386
1386
|
token: this.token,
|
|
1387
1387
|
position: this.position
|
|
1388
|
-
}), this.address = this.address ||
|
|
1388
|
+
}), this.address = this.address || _.generateAddress(this.key), this.characters = this.characters || "BASE64", this.initializeMLKEM());
|
|
1389
1389
|
}
|
|
1390
1390
|
/**
|
|
1391
1391
|
* Creates a new Wallet instance
|
|
@@ -1406,8 +1406,8 @@ class S {
|
|
|
1406
1406
|
}) {
|
|
1407
1407
|
let i = null;
|
|
1408
1408
|
if (!e && !t)
|
|
1409
|
-
throw new
|
|
1410
|
-
return e && !t && (i =
|
|
1409
|
+
throw new Ve();
|
|
1410
|
+
return e && !t && (i = _.generatePosition(), t = fe(e, "Wallet::create")), new _({
|
|
1411
1411
|
secret: e,
|
|
1412
1412
|
bundle: t,
|
|
1413
1413
|
token: n,
|
|
@@ -1423,7 +1423,7 @@ class S {
|
|
|
1423
1423
|
* @return {boolean}
|
|
1424
1424
|
*/
|
|
1425
1425
|
static isBundleHash(e) {
|
|
1426
|
-
return typeof e != "string" ? !1 : e.length === 64 &&
|
|
1426
|
+
return typeof e != "string" ? !1 : e.length === 64 && De(e);
|
|
1427
1427
|
}
|
|
1428
1428
|
/**
|
|
1429
1429
|
* Get formatted token units from the raw data
|
|
@@ -1434,7 +1434,7 @@ class S {
|
|
|
1434
1434
|
static getTokenUnits(e) {
|
|
1435
1435
|
const t = [];
|
|
1436
1436
|
return e.forEach((n) => {
|
|
1437
|
-
t.push(
|
|
1437
|
+
t.push(me.createFromDB(n));
|
|
1438
1438
|
}), t;
|
|
1439
1439
|
}
|
|
1440
1440
|
/**
|
|
@@ -1450,7 +1450,11 @@ class S {
|
|
|
1450
1450
|
token: t,
|
|
1451
1451
|
position: n
|
|
1452
1452
|
}) {
|
|
1453
|
-
|
|
1453
|
+
if (!e)
|
|
1454
|
+
throw new Ve("Wallet::generateKey() - Secret is required!");
|
|
1455
|
+
if (!n)
|
|
1456
|
+
throw new Ve("Wallet::generateKey() - Position is required!");
|
|
1457
|
+
const s = De(e) ? e : lt(e, 1024), r = De(n) ? n : lt(n, 256), a = BigInt(`0x${s}`) + BigInt(`0x${r}`), c = new L("SHAKE256", "TEXT");
|
|
1454
1458
|
c.update(a.toString(16)), t && c.update(t);
|
|
1455
1459
|
const u = new L("SHAKE256", "TEXT");
|
|
1456
1460
|
return u.update(c.getHash("HEX", { outputLen: 8192 })), u.getHash("HEX", { outputLen: 8192 });
|
|
@@ -1462,7 +1466,7 @@ class S {
|
|
|
1462
1466
|
* @return {string}
|
|
1463
1467
|
*/
|
|
1464
1468
|
static generateAddress(e) {
|
|
1465
|
-
const t =
|
|
1469
|
+
const t = He(e, 128), n = new L("SHAKE256", "TEXT");
|
|
1466
1470
|
for (const r in t) {
|
|
1467
1471
|
let i = t[r];
|
|
1468
1472
|
for (let a = 1; a <= 16; a++) {
|
|
@@ -1480,16 +1484,16 @@ class S {
|
|
|
1480
1484
|
* @returns {string}
|
|
1481
1485
|
*/
|
|
1482
1486
|
static generatePosition(e = 64) {
|
|
1483
|
-
return
|
|
1487
|
+
return nt(e, "abcdef0123456789");
|
|
1484
1488
|
}
|
|
1485
1489
|
/**
|
|
1486
1490
|
* Initializes the ML-KEM key pair
|
|
1487
1491
|
*/
|
|
1488
1492
|
initializeMLKEM() {
|
|
1489
|
-
const e =
|
|
1493
|
+
const e = tt(this.key, 128), t = new Uint8Array(64);
|
|
1490
1494
|
for (let r = 0; r < 64; r++)
|
|
1491
1495
|
t[r] = parseInt(e.substr(r * 2, 2), 16);
|
|
1492
|
-
const { publicKey: n, secretKey: s } =
|
|
1496
|
+
const { publicKey: n, secretKey: s } = Ge.keygen(t);
|
|
1493
1497
|
this.pubkey = this.serializeKey(n), this.privkey = s;
|
|
1494
1498
|
}
|
|
1495
1499
|
serializeKey(e) {
|
|
@@ -1499,6 +1503,41 @@ class S {
|
|
|
1499
1503
|
const t = atob(e);
|
|
1500
1504
|
return new Uint8Array(t.length).map((n, s) => t.charCodeAt(s));
|
|
1501
1505
|
}
|
|
1506
|
+
/**
|
|
1507
|
+
* Returns balance as a Number for arithmetic operations.
|
|
1508
|
+
* WARNING: Precision loss for values > 2^53.
|
|
1509
|
+
*
|
|
1510
|
+
* @return {number}
|
|
1511
|
+
*/
|
|
1512
|
+
balanceAsNumber() {
|
|
1513
|
+
return Number(this.balance);
|
|
1514
|
+
}
|
|
1515
|
+
/**
|
|
1516
|
+
* Returns balance as a BigInt for precision-safe integer arithmetic.
|
|
1517
|
+
* Truncates any fractional component.
|
|
1518
|
+
*
|
|
1519
|
+
* @return {bigint}
|
|
1520
|
+
*/
|
|
1521
|
+
balanceAsBigInt() {
|
|
1522
|
+
const e = String(this.balance), t = e.includes(".") ? e.split(".")[0] : e;
|
|
1523
|
+
return BigInt(t || "0");
|
|
1524
|
+
}
|
|
1525
|
+
/**
|
|
1526
|
+
* Sets balance from a BigInt value
|
|
1527
|
+
*
|
|
1528
|
+
* @param {bigint} value
|
|
1529
|
+
*/
|
|
1530
|
+
setBalanceBigInt(e) {
|
|
1531
|
+
this.balance = e.toString();
|
|
1532
|
+
}
|
|
1533
|
+
/**
|
|
1534
|
+
* Sets balance from a Number value, storing as String
|
|
1535
|
+
*
|
|
1536
|
+
* @param {number} value
|
|
1537
|
+
*/
|
|
1538
|
+
setBalanceNumber(e) {
|
|
1539
|
+
this.balance = String(e);
|
|
1540
|
+
}
|
|
1502
1541
|
/**
|
|
1503
1542
|
*
|
|
1504
1543
|
* @returns {*[]}
|
|
@@ -1530,7 +1569,7 @@ class S {
|
|
|
1530
1569
|
* @param secret
|
|
1531
1570
|
*/
|
|
1532
1571
|
createRemainder(e) {
|
|
1533
|
-
const t =
|
|
1572
|
+
const t = _.create({
|
|
1534
1573
|
secret: e,
|
|
1535
1574
|
token: this.token,
|
|
1536
1575
|
characters: this.characters
|
|
@@ -1556,10 +1595,10 @@ class S {
|
|
|
1556
1595
|
sourceWallet: e,
|
|
1557
1596
|
isRemainder: t = !1
|
|
1558
1597
|
}) {
|
|
1559
|
-
e.batchId && (this.batchId = t ? e.batchId :
|
|
1598
|
+
e.batchId && (this.batchId = t ? e.batchId : he({}));
|
|
1560
1599
|
}
|
|
1561
1600
|
async encryptMessage(e, t) {
|
|
1562
|
-
const n = JSON.stringify(e), s = new TextEncoder().encode(n), r = this.deserializeKey(t), { cipherText: i, sharedSecret: a } =
|
|
1601
|
+
const n = JSON.stringify(e), s = new TextEncoder().encode(n), r = this.deserializeKey(t), { cipherText: i, sharedSecret: a } = Ge.encapsulate(r), c = await this.encryptWithSharedSecret(s, a);
|
|
1563
1602
|
return {
|
|
1564
1603
|
cipherText: this.serializeKey(i),
|
|
1565
1604
|
encryptedMessage: this.serializeKey(c)
|
|
@@ -1569,7 +1608,7 @@ class S {
|
|
|
1569
1608
|
const { cipherText: t, encryptedMessage: n } = e;
|
|
1570
1609
|
let s;
|
|
1571
1610
|
try {
|
|
1572
|
-
s =
|
|
1611
|
+
s = Ge.decapsulate(this.deserializeKey(t), this.privkey);
|
|
1573
1612
|
} catch (c) {
|
|
1574
1613
|
return console.error("Wallet::decryptMessage() - Decapsulation failed", c), console.info("Wallet::decryptMessage() - my public key", this.pubkey), null;
|
|
1575
1614
|
}
|
|
@@ -1628,7 +1667,7 @@ class S {
|
|
|
1628
1667
|
return new Uint8Array(i);
|
|
1629
1668
|
}
|
|
1630
1669
|
}
|
|
1631
|
-
class
|
|
1670
|
+
class ke extends x {
|
|
1632
1671
|
/**
|
|
1633
1672
|
* Class constructor
|
|
1634
1673
|
*
|
|
@@ -1640,7 +1679,7 @@ class ge extends x {
|
|
|
1640
1679
|
super(e, t, n), this.name = "AtomIndexException";
|
|
1641
1680
|
}
|
|
1642
1681
|
}
|
|
1643
|
-
class
|
|
1682
|
+
class ns extends x {
|
|
1644
1683
|
/**
|
|
1645
1684
|
* Class constructor
|
|
1646
1685
|
*
|
|
@@ -1652,7 +1691,7 @@ class Zn extends x {
|
|
|
1652
1691
|
super(e, t, n), this.name = "MolecularHashMismatchException";
|
|
1653
1692
|
}
|
|
1654
1693
|
}
|
|
1655
|
-
class
|
|
1694
|
+
class ss extends x {
|
|
1656
1695
|
/**
|
|
1657
1696
|
* Class constructor
|
|
1658
1697
|
*
|
|
@@ -1664,7 +1703,7 @@ class Yn extends x {
|
|
|
1664
1703
|
super(e, t, n), this.name = "MolecularHashMissingException";
|
|
1665
1704
|
}
|
|
1666
1705
|
}
|
|
1667
|
-
class
|
|
1706
|
+
class kt extends x {
|
|
1668
1707
|
/**
|
|
1669
1708
|
* Class constructor
|
|
1670
1709
|
*
|
|
@@ -1676,7 +1715,7 @@ class ft extends x {
|
|
|
1676
1715
|
super(e, t, n), this.name = "PolicyInvalidException";
|
|
1677
1716
|
}
|
|
1678
1717
|
}
|
|
1679
|
-
class
|
|
1718
|
+
class Vt extends x {
|
|
1680
1719
|
/**
|
|
1681
1720
|
* Class constructor
|
|
1682
1721
|
*
|
|
@@ -1688,7 +1727,7 @@ class Lt extends x {
|
|
|
1688
1727
|
super(e, t, n), this.name = "SignatureMalformedException";
|
|
1689
1728
|
}
|
|
1690
1729
|
}
|
|
1691
|
-
class
|
|
1730
|
+
class rs extends x {
|
|
1692
1731
|
/**
|
|
1693
1732
|
* Class constructor
|
|
1694
1733
|
*
|
|
@@ -1712,7 +1751,7 @@ class Y extends x {
|
|
|
1712
1751
|
super(e, t, n), this.name = "TransferBalanceException";
|
|
1713
1752
|
}
|
|
1714
1753
|
}
|
|
1715
|
-
class
|
|
1754
|
+
class Se extends x {
|
|
1716
1755
|
/**
|
|
1717
1756
|
* Class constructor
|
|
1718
1757
|
*
|
|
@@ -1724,7 +1763,7 @@ class mt extends x {
|
|
|
1724
1763
|
super(e, t, n), this.name = "TransferMalformedException";
|
|
1725
1764
|
}
|
|
1726
1765
|
}
|
|
1727
|
-
class
|
|
1766
|
+
class St extends x {
|
|
1728
1767
|
/**
|
|
1729
1768
|
* @param {string} message
|
|
1730
1769
|
* @param {string|null} fileName
|
|
@@ -1734,7 +1773,7 @@ class yt extends x {
|
|
|
1734
1773
|
super(e, t, n), this.name = "TransferMismatchedException";
|
|
1735
1774
|
}
|
|
1736
1775
|
}
|
|
1737
|
-
class
|
|
1776
|
+
class _t extends x {
|
|
1738
1777
|
/**
|
|
1739
1778
|
* Class constructor
|
|
1740
1779
|
*
|
|
@@ -1746,7 +1785,7 @@ class gt extends x {
|
|
|
1746
1785
|
super(e, t, n), this.name = "TransferRemainderException";
|
|
1747
1786
|
}
|
|
1748
1787
|
}
|
|
1749
|
-
class
|
|
1788
|
+
class is extends x {
|
|
1750
1789
|
/**
|
|
1751
1790
|
* Class constructor
|
|
1752
1791
|
*
|
|
@@ -1758,7 +1797,7 @@ class ts extends x {
|
|
|
1758
1797
|
super(e, t, n), this.name = "TransferToSelfException";
|
|
1759
1798
|
}
|
|
1760
1799
|
}
|
|
1761
|
-
class
|
|
1800
|
+
class Oe extends x {
|
|
1762
1801
|
/**
|
|
1763
1802
|
* Class constructor
|
|
1764
1803
|
*
|
|
@@ -1770,7 +1809,7 @@ class ns extends x {
|
|
|
1770
1809
|
super(e, t, n), this.name = "TransferUnbalancedException";
|
|
1771
1810
|
}
|
|
1772
1811
|
}
|
|
1773
|
-
class
|
|
1812
|
+
class H extends x {
|
|
1774
1813
|
/**
|
|
1775
1814
|
* Class constructor
|
|
1776
1815
|
*
|
|
@@ -1794,7 +1833,7 @@ class se extends x {
|
|
|
1794
1833
|
super(e, t, n), this.name = "WrongTokenTypeException";
|
|
1795
1834
|
}
|
|
1796
1835
|
}
|
|
1797
|
-
class
|
|
1836
|
+
class qe extends x {
|
|
1798
1837
|
/**
|
|
1799
1838
|
* @param {string|null} message
|
|
1800
1839
|
* @param {string|null} fileName
|
|
@@ -1804,7 +1843,7 @@ class Re extends x {
|
|
|
1804
1843
|
super(e, t, n), this.name = "BatchIdException";
|
|
1805
1844
|
}
|
|
1806
1845
|
}
|
|
1807
|
-
class
|
|
1846
|
+
class $t {
|
|
1808
1847
|
constructor({}) {
|
|
1809
1848
|
const e = arguments[0];
|
|
1810
1849
|
for (const t in e)
|
|
@@ -1824,7 +1863,7 @@ class wt {
|
|
|
1824
1863
|
return e;
|
|
1825
1864
|
}
|
|
1826
1865
|
}
|
|
1827
|
-
class
|
|
1866
|
+
class Pe extends x {
|
|
1828
1867
|
/**
|
|
1829
1868
|
* Class constructor
|
|
1830
1869
|
*
|
|
@@ -1846,7 +1885,7 @@ class ee extends x {
|
|
|
1846
1885
|
super(e, t, n), this.name = "CodeException";
|
|
1847
1886
|
}
|
|
1848
1887
|
}
|
|
1849
|
-
class
|
|
1888
|
+
class _e {
|
|
1850
1889
|
/**
|
|
1851
1890
|
*
|
|
1852
1891
|
* @param {string} action
|
|
@@ -1869,7 +1908,7 @@ class be {
|
|
|
1869
1908
|
comparison: c = null
|
|
1870
1909
|
}) {
|
|
1871
1910
|
if (s && (this.meta = s), !e)
|
|
1872
|
-
throw new
|
|
1911
|
+
throw new Pe('Callback structure violated, missing mandatory "action" parameter.');
|
|
1873
1912
|
this.__metaId = n, this.__metaType = t, this.__action = e, this.__address = r, this.__token = i, this.__amount = a, this.__comparison = c;
|
|
1874
1913
|
}
|
|
1875
1914
|
/**
|
|
@@ -1884,7 +1923,7 @@ class be {
|
|
|
1884
1923
|
* @param {string} amount
|
|
1885
1924
|
*/
|
|
1886
1925
|
set amount(e) {
|
|
1887
|
-
if (!
|
|
1926
|
+
if (!fn(e))
|
|
1888
1927
|
throw new ee("Parameter amount should be a string containing numbers");
|
|
1889
1928
|
this.__amount = e;
|
|
1890
1929
|
}
|
|
@@ -1907,7 +1946,7 @@ class be {
|
|
|
1907
1946
|
* @param {Meta|object} meta
|
|
1908
1947
|
*/
|
|
1909
1948
|
set meta(e) {
|
|
1910
|
-
this.__meta = e instanceof
|
|
1949
|
+
this.__meta = e instanceof $t ? e : $t.toObject(e);
|
|
1911
1950
|
}
|
|
1912
1951
|
/**
|
|
1913
1952
|
*
|
|
@@ -1930,7 +1969,7 @@ class be {
|
|
|
1930
1969
|
* @return Callback
|
|
1931
1970
|
*/
|
|
1932
1971
|
static toObject(e) {
|
|
1933
|
-
const t = new
|
|
1972
|
+
const t = new _e({
|
|
1934
1973
|
action: e.action
|
|
1935
1974
|
});
|
|
1936
1975
|
return e.metaType && (t.metaType = e.metaType), e.metaId && (t.metaId = e.metaId), e.meta && (t.meta = e.meta), e.address && (t.address = e.address), e.token && (t.token = e.token), e.amount && (t.amount = e.amount), e.comparison && (t.comparison = e.comparison), t;
|
|
@@ -1955,31 +1994,31 @@ class be {
|
|
|
1955
1994
|
* @return {boolean}
|
|
1956
1995
|
*/
|
|
1957
1996
|
isMeta() {
|
|
1958
|
-
return
|
|
1997
|
+
return ye(Object.keys(this.toJSON()), ["action", "metaId", "metaType", "meta"]).length === 4 && this._is("meta");
|
|
1959
1998
|
}
|
|
1960
1999
|
/**
|
|
1961
2000
|
* @return {boolean}
|
|
1962
2001
|
*/
|
|
1963
2002
|
isCollect() {
|
|
1964
|
-
return
|
|
2003
|
+
return ye(Object.keys(this.toJSON()), ["action", "address", "token", "amount", "comparison"]).length === 5 && this._is("collect");
|
|
1965
2004
|
}
|
|
1966
2005
|
/**
|
|
1967
2006
|
* @return {boolean}
|
|
1968
2007
|
*/
|
|
1969
2008
|
isBuffer() {
|
|
1970
|
-
return
|
|
2009
|
+
return ye(Object.keys(this.toJSON()), ["action", "address", "token", "amount", "comparison"]).length === 5 && this._is("buffer");
|
|
1971
2010
|
}
|
|
1972
2011
|
/**
|
|
1973
2012
|
* @return {boolean}
|
|
1974
2013
|
*/
|
|
1975
2014
|
isRemit() {
|
|
1976
|
-
return
|
|
2015
|
+
return ye(Object.keys(this.toJSON()), ["action", "token", "amount"]).length === 3 && this._is("remit");
|
|
1977
2016
|
}
|
|
1978
2017
|
/**
|
|
1979
2018
|
* @return {boolean}
|
|
1980
2019
|
*/
|
|
1981
2020
|
isBurn() {
|
|
1982
|
-
return
|
|
2021
|
+
return ye(Object.keys(this.toJSON()), ["action", "token", "amount", "comparison"]).length === 4 && this._is("burn");
|
|
1983
2022
|
}
|
|
1984
2023
|
/**
|
|
1985
2024
|
* @param {string} type
|
|
@@ -1991,7 +2030,7 @@ class be {
|
|
|
1991
2030
|
return this.__action.toLowerCase() === e.toLowerCase();
|
|
1992
2031
|
}
|
|
1993
2032
|
}
|
|
1994
|
-
class
|
|
2033
|
+
class Xe {
|
|
1995
2034
|
/**
|
|
1996
2035
|
*
|
|
1997
2036
|
* @param key
|
|
@@ -2004,7 +2043,7 @@ class Ve {
|
|
|
2004
2043
|
comparison: n
|
|
2005
2044
|
}) {
|
|
2006
2045
|
if ([e, t, n].some((s) => !s))
|
|
2007
|
-
throw new
|
|
2046
|
+
throw new Pe("Condition::constructor( { key, value, comparison } ) - not all class parameters are initialised!");
|
|
2008
2047
|
this.__key = e, this.__value = t, this.__comparison = n;
|
|
2009
2048
|
}
|
|
2010
2049
|
/**
|
|
@@ -2029,7 +2068,7 @@ class Ve {
|
|
|
2029
2068
|
};
|
|
2030
2069
|
}
|
|
2031
2070
|
}
|
|
2032
|
-
class
|
|
2071
|
+
class Ae {
|
|
2033
2072
|
/**
|
|
2034
2073
|
*
|
|
2035
2074
|
* @param {Condition[]} condition
|
|
@@ -2040,11 +2079,11 @@ class Se {
|
|
|
2040
2079
|
callback: t = []
|
|
2041
2080
|
}) {
|
|
2042
2081
|
for (const n of e)
|
|
2043
|
-
if (!(n instanceof
|
|
2044
|
-
throw new
|
|
2082
|
+
if (!(n instanceof Xe))
|
|
2083
|
+
throw new Pe();
|
|
2045
2084
|
for (const n of t)
|
|
2046
|
-
if (!(n instanceof
|
|
2047
|
-
throw new
|
|
2085
|
+
if (!(n instanceof _e))
|
|
2086
|
+
throw new Pe();
|
|
2048
2087
|
this.__condition = e, this.__callback = t;
|
|
2049
2088
|
}
|
|
2050
2089
|
/**
|
|
@@ -2052,13 +2091,13 @@ class Se {
|
|
|
2052
2091
|
* @param {Condition[]|{}} condition
|
|
2053
2092
|
*/
|
|
2054
2093
|
set comparison(e) {
|
|
2055
|
-
this.__condition.push(e instanceof
|
|
2094
|
+
this.__condition.push(e instanceof Xe ? e : Xe.toObject(e));
|
|
2056
2095
|
}
|
|
2057
2096
|
/**
|
|
2058
2097
|
* @param {Callback[]|{}} callback
|
|
2059
2098
|
*/
|
|
2060
2099
|
set callback(e) {
|
|
2061
|
-
this.__callback.push(e instanceof
|
|
2100
|
+
this.__callback.push(e instanceof _e ? e : _e.toObject(e));
|
|
2062
2101
|
}
|
|
2063
2102
|
/**
|
|
2064
2103
|
*
|
|
@@ -2068,10 +2107,10 @@ class Se {
|
|
|
2068
2107
|
*/
|
|
2069
2108
|
static toObject(e) {
|
|
2070
2109
|
if (!e.condition)
|
|
2071
|
-
throw new
|
|
2110
|
+
throw new H("Rule::toObject() - Incorrect rule format! There is no condition field.");
|
|
2072
2111
|
if (!e.callback)
|
|
2073
|
-
throw new
|
|
2074
|
-
const t = new
|
|
2112
|
+
throw new H("Rule::toObject() - Incorrect rule format! There is no callback field.");
|
|
2113
|
+
const t = new Ae({});
|
|
2075
2114
|
for (const n of e.condition)
|
|
2076
2115
|
t.comparison = n;
|
|
2077
2116
|
for (const n of e.callback)
|
|
@@ -2147,19 +2186,19 @@ class C {
|
|
|
2147
2186
|
return r[Number.isInteger(c) ? c : a] = n, e;
|
|
2148
2187
|
}
|
|
2149
2188
|
}
|
|
2150
|
-
class
|
|
2189
|
+
class ve {
|
|
2151
2190
|
/**
|
|
2152
2191
|
*
|
|
2153
2192
|
* @param molecule
|
|
2154
2193
|
*/
|
|
2155
2194
|
constructor(e) {
|
|
2156
2195
|
if (e.molecularHash === null)
|
|
2157
|
-
throw new
|
|
2196
|
+
throw new ss();
|
|
2158
2197
|
if (!e.atoms.length)
|
|
2159
2198
|
throw new ae();
|
|
2160
2199
|
for (const t of e.atoms)
|
|
2161
2200
|
if (t.index === null)
|
|
2162
|
-
throw new
|
|
2201
|
+
throw new ke();
|
|
2163
2202
|
this.molecule = e;
|
|
2164
2203
|
}
|
|
2165
2204
|
/**
|
|
@@ -2168,7 +2207,7 @@ class ss {
|
|
|
2168
2207
|
* @returns {false|*|boolean}
|
|
2169
2208
|
*/
|
|
2170
2209
|
verify(e) {
|
|
2171
|
-
return this.molecularHash() && this.ots() && this.batchId() && this.continuId() && this.isotopeM() && this.isotopeT() && this.isotopeC() && this.isotopeU() && this.isotopeI() && this.isotopeR() && this.isotopeP() && this.isotopeA() && this.isotopeV(e);
|
|
2210
|
+
return this.molecularHash() && this.ots() && this.batchId() && this.continuId() && this.isotopeM() && this.isotopeT() && this.isotopeC() && this.isotopeU() && this.isotopeI() && this.isotopeR() && this.isotopeP() && this.isotopeA() && this.isotopeB() && this.isotopeF() && this.isotopeV(e);
|
|
2172
2211
|
}
|
|
2173
2212
|
/**
|
|
2174
2213
|
*
|
|
@@ -2189,14 +2228,14 @@ class ss {
|
|
|
2189
2228
|
if (e.isotope === "V" && e.batchId !== null) {
|
|
2190
2229
|
const t = this.molecule.getIsotopes("V"), n = t[t.length - 1];
|
|
2191
2230
|
if (e.batchId !== n.batchId)
|
|
2192
|
-
throw new
|
|
2231
|
+
throw new qe();
|
|
2193
2232
|
for (const s of t)
|
|
2194
2233
|
if (s.batchId === null)
|
|
2195
|
-
throw new
|
|
2234
|
+
throw new qe();
|
|
2196
2235
|
}
|
|
2197
2236
|
return !0;
|
|
2198
2237
|
}
|
|
2199
|
-
throw new
|
|
2238
|
+
throw new qe();
|
|
2200
2239
|
}
|
|
2201
2240
|
/**
|
|
2202
2241
|
*
|
|
@@ -2207,7 +2246,7 @@ class ss {
|
|
|
2207
2246
|
if (e.token !== "USER")
|
|
2208
2247
|
throw new se(`Check::isotopeI() - "${e.token}" is not a valid Token slug for "${e.isotope}" isotope Atoms!`);
|
|
2209
2248
|
if (e.index === 0)
|
|
2210
|
-
throw new
|
|
2249
|
+
throw new ke(`Check::isotopeI() - Isotope "${e.isotope}" Atoms must have a non-zero index!`);
|
|
2211
2250
|
}
|
|
2212
2251
|
return !0;
|
|
2213
2252
|
}
|
|
@@ -2220,7 +2259,7 @@ class ss {
|
|
|
2220
2259
|
if (e.token !== "AUTH")
|
|
2221
2260
|
throw new se(`Check::isotopeU() - "${e.token}" is not a valid Token slug for "${e.isotope}" isotope Atoms!`);
|
|
2222
2261
|
if (e.index !== 0)
|
|
2223
|
-
throw new
|
|
2262
|
+
throw new ke(`Check::isotopeU() - Isotope "${e.isotope}" Atoms must have an index equal to 0!`);
|
|
2224
2263
|
}
|
|
2225
2264
|
return !0;
|
|
2226
2265
|
}
|
|
@@ -2232,10 +2271,10 @@ class ss {
|
|
|
2232
2271
|
const e = ["readPolicy", "writePolicy"];
|
|
2233
2272
|
for (const t of this.molecule.getIsotopes("M")) {
|
|
2234
2273
|
if (t.meta.length < 1)
|
|
2235
|
-
throw new
|
|
2274
|
+
throw new H();
|
|
2236
2275
|
if (t.token !== "USER")
|
|
2237
2276
|
throw new se(`Check::isotopeM() - "${t.token}" is not a valid Token slug for "${t.isotope}" isotope Atoms!`);
|
|
2238
|
-
const n =
|
|
2277
|
+
const n = pe.aggregateMeta(t.meta);
|
|
2239
2278
|
for (const s of e) {
|
|
2240
2279
|
let r = n[s];
|
|
2241
2280
|
if (r) {
|
|
@@ -2243,10 +2282,10 @@ class ss {
|
|
|
2243
2282
|
for (const [i, a] of Object.entries(r))
|
|
2244
2283
|
if (!e.includes(i)) {
|
|
2245
2284
|
if (!Object.keys(n).includes(i))
|
|
2246
|
-
throw new
|
|
2285
|
+
throw new kt(`${i} is missing from the meta.`);
|
|
2247
2286
|
for (const c of a)
|
|
2248
|
-
if (!
|
|
2249
|
-
throw new
|
|
2287
|
+
if (!_.isBundleHash(c) && !["all", "self"].includes(c))
|
|
2288
|
+
throw new kt(`${c} does not correspond to the format of the policy.`);
|
|
2250
2289
|
}
|
|
2251
2290
|
}
|
|
2252
2291
|
}
|
|
@@ -2262,7 +2301,7 @@ class ss {
|
|
|
2262
2301
|
if (e.token !== "USER")
|
|
2263
2302
|
throw new se(`Check::isotopeC() - "${e.token}" is not a valid Token slug for "${e.isotope}" isotope Atoms!`);
|
|
2264
2303
|
if (e.index !== 0)
|
|
2265
|
-
throw new
|
|
2304
|
+
throw new ke(`Check::isotopeC() - Isotope "${e.isotope}" Atoms must have an index equal to 0!`);
|
|
2266
2305
|
}
|
|
2267
2306
|
return !0;
|
|
2268
2307
|
}
|
|
@@ -2276,15 +2315,15 @@ class ss {
|
|
|
2276
2315
|
if (String(e.metaType).toLowerCase() === "wallet") {
|
|
2277
2316
|
for (const s of ["position", "bundle"])
|
|
2278
2317
|
if (!Object.prototype.hasOwnProperty.call(t, s) || !t[s])
|
|
2279
|
-
throw new
|
|
2318
|
+
throw new H(`Check::isotopeT() - Required meta field "${s}" is missing!`);
|
|
2280
2319
|
}
|
|
2281
2320
|
for (const s of ["token"])
|
|
2282
2321
|
if (!Object.prototype.hasOwnProperty.call(t, s) || !t[s])
|
|
2283
|
-
throw new
|
|
2322
|
+
throw new H(`Check::isotopeT() - Required meta field "${s}" is missing!`);
|
|
2284
2323
|
if (e.token !== "USER")
|
|
2285
2324
|
throw new se(`Check::isotopeT() - "${e.token}" is not a valid Token slug for "${e.isotope}" isotope Atoms!`);
|
|
2286
2325
|
if (e.index !== 0)
|
|
2287
|
-
throw new
|
|
2326
|
+
throw new ke(`Check::isotopeT() - Isotope "${e.isotope}" Atoms must have an index equal to 0!`);
|
|
2288
2327
|
}
|
|
2289
2328
|
return !0;
|
|
2290
2329
|
}
|
|
@@ -2298,16 +2337,16 @@ class ss {
|
|
|
2298
2337
|
if (t.policy) {
|
|
2299
2338
|
const n = JSON.parse(t.policy);
|
|
2300
2339
|
if (!Object.keys(n).every((s) => ["read", "write"].includes(s)))
|
|
2301
|
-
throw new
|
|
2340
|
+
throw new H("Check::isotopeR() - Mixing rules with politics!");
|
|
2302
2341
|
}
|
|
2303
2342
|
if (t.rule) {
|
|
2304
2343
|
const n = JSON.parse(t.rule);
|
|
2305
2344
|
if (!Array.isArray(n))
|
|
2306
|
-
throw new
|
|
2345
|
+
throw new H("Check::isotopeR() - Incorrect rule format!");
|
|
2307
2346
|
for (const s of n)
|
|
2308
|
-
|
|
2347
|
+
Ae.toObject(s);
|
|
2309
2348
|
if (n.length < 1)
|
|
2310
|
-
throw new
|
|
2349
|
+
throw new H("Check::isotopeR() - No rules!");
|
|
2311
2350
|
}
|
|
2312
2351
|
}
|
|
2313
2352
|
return !0;
|
|
@@ -2323,7 +2362,7 @@ class ss {
|
|
|
2323
2362
|
throw new se(`Check::isotopeP() - "${e.token}" is not a valid Token slug for "${e.isotope}" isotope Atoms!`);
|
|
2324
2363
|
const t = e.aggregatedMeta();
|
|
2325
2364
|
if (!Object.prototype.hasOwnProperty.call(t, "peerHost") || !t.peerHost)
|
|
2326
|
-
throw new
|
|
2365
|
+
throw new H('Check::isotopeP() - Required meta field "peerHost" is missing!');
|
|
2327
2366
|
}
|
|
2328
2367
|
return !0;
|
|
2329
2368
|
}
|
|
@@ -2337,12 +2376,74 @@ class ss {
|
|
|
2337
2376
|
if (e.token !== "USER")
|
|
2338
2377
|
throw new se(`Check::isotopeA() - "${e.token}" is not a valid Token slug for "${e.isotope}" isotope Atoms!`);
|
|
2339
2378
|
if (!e.metaType)
|
|
2340
|
-
throw new
|
|
2379
|
+
throw new H('Check::isotopeA() - Required field "metaType" is missing!');
|
|
2341
2380
|
if (!e.metaId)
|
|
2342
|
-
throw new
|
|
2381
|
+
throw new H('Check::isotopeA() - Required field "metaId" is missing!');
|
|
2343
2382
|
const t = e.aggregatedMeta();
|
|
2344
2383
|
if (!Object.prototype.hasOwnProperty.call(t, "action") || !t.action)
|
|
2345
|
-
throw new
|
|
2384
|
+
throw new H('Check::isotopeA() - Required meta field "action" is missing!');
|
|
2385
|
+
}
|
|
2386
|
+
return !0;
|
|
2387
|
+
}
|
|
2388
|
+
/**
|
|
2389
|
+
* Validates B-isotope (Buffer/Exchange) atoms
|
|
2390
|
+
*
|
|
2391
|
+
* @returns {boolean}
|
|
2392
|
+
*/
|
|
2393
|
+
isotopeB() {
|
|
2394
|
+
const e = this.molecule.getIsotopes("B");
|
|
2395
|
+
if (e.length === 0)
|
|
2396
|
+
return !0;
|
|
2397
|
+
for (const n of e) {
|
|
2398
|
+
if (!n.metaType || n.metaType !== "walletBundle")
|
|
2399
|
+
throw new H('Check::isotopeB() - B-isotope atoms must have metaType "walletBundle"!');
|
|
2400
|
+
if (!n.metaId)
|
|
2401
|
+
throw new H("Check::isotopeB() - B-isotope atoms must have a metaId!");
|
|
2402
|
+
const s = Number(n.value);
|
|
2403
|
+
if (Number.isNaN(s))
|
|
2404
|
+
throw new Se("Check::isotopeB() - B-isotope atom value is not a valid number!");
|
|
2405
|
+
}
|
|
2406
|
+
const t = this.molecule.getIsotopes("V");
|
|
2407
|
+
if (t.length > 0) {
|
|
2408
|
+
let n = 0;
|
|
2409
|
+
for (const s of [...t, ...e]) {
|
|
2410
|
+
const r = Number(s.value);
|
|
2411
|
+
Number.isNaN(r) || (n += r);
|
|
2412
|
+
}
|
|
2413
|
+
if (n !== 0)
|
|
2414
|
+
throw new Oe("Check::isotopeB() - V+B atom values do not balance to zero!");
|
|
2415
|
+
}
|
|
2416
|
+
return !0;
|
|
2417
|
+
}
|
|
2418
|
+
/**
|
|
2419
|
+
* Validates F-isotope (Fusion/NFT) atoms
|
|
2420
|
+
*
|
|
2421
|
+
* @returns {boolean}
|
|
2422
|
+
*/
|
|
2423
|
+
isotopeF() {
|
|
2424
|
+
const e = this.molecule.getIsotopes("F");
|
|
2425
|
+
if (e.length === 0)
|
|
2426
|
+
return !0;
|
|
2427
|
+
for (const n of e) {
|
|
2428
|
+
if (!n.metaType || n.metaType !== "walletBundle")
|
|
2429
|
+
throw new H('Check::isotopeF() - F-isotope atoms must have metaType "walletBundle"!');
|
|
2430
|
+
if (!n.metaId)
|
|
2431
|
+
throw new H("Check::isotopeF() - F-isotope atoms must have a metaId!");
|
|
2432
|
+
const s = Number(n.value);
|
|
2433
|
+
if (Number.isNaN(s))
|
|
2434
|
+
throw new Se("Check::isotopeF() - F-isotope atom value is not a valid number!");
|
|
2435
|
+
if (s < 0)
|
|
2436
|
+
throw new Se("Check::isotopeF() - F-isotope atom value must not be negative!");
|
|
2437
|
+
}
|
|
2438
|
+
const t = this.molecule.getIsotopes("V");
|
|
2439
|
+
if (t.length > 0) {
|
|
2440
|
+
let n = 0;
|
|
2441
|
+
for (const s of [...t, ...e]) {
|
|
2442
|
+
const r = Number(s.value);
|
|
2443
|
+
Number.isNaN(r) || (n += r);
|
|
2444
|
+
}
|
|
2445
|
+
if (n !== 0)
|
|
2446
|
+
throw new Oe("Check::isotopeF() - V+F atom values do not balance to zero!");
|
|
2346
2447
|
}
|
|
2347
2448
|
return !0;
|
|
2348
2449
|
}
|
|
@@ -2355,45 +2456,47 @@ class ss {
|
|
|
2355
2456
|
const t = this.molecule.getIsotopes("V");
|
|
2356
2457
|
if (t.length === 0)
|
|
2357
2458
|
return !0;
|
|
2358
|
-
const n = this.molecule.atoms[0];
|
|
2359
|
-
if (n.isotope === "V" && t.length === 2) {
|
|
2360
|
-
const
|
|
2361
|
-
if (
|
|
2362
|
-
throw new
|
|
2363
|
-
if (
|
|
2364
|
-
throw new
|
|
2459
|
+
const n = this.molecule.getIsotopes("B").length > 0 || this.molecule.getIsotopes("F").length > 0, s = this.molecule.atoms[0];
|
|
2460
|
+
if (!n && s.isotope === "V" && t.length === 2) {
|
|
2461
|
+
const a = t[t.length - 1];
|
|
2462
|
+
if (s.token !== a.token)
|
|
2463
|
+
throw new St();
|
|
2464
|
+
if (a.value < 0)
|
|
2465
|
+
throw new Se();
|
|
2466
|
+
if (Number(s.value) + Number(a.value) !== 0)
|
|
2467
|
+
throw new Oe();
|
|
2365
2468
|
return !0;
|
|
2366
2469
|
}
|
|
2367
|
-
let
|
|
2368
|
-
for (const
|
|
2369
|
-
if (Object.prototype.hasOwnProperty.call(this.molecule.atoms,
|
|
2370
|
-
const
|
|
2371
|
-
if (
|
|
2470
|
+
let r = 0, i = 0;
|
|
2471
|
+
for (const a in this.molecule.atoms)
|
|
2472
|
+
if (Object.prototype.hasOwnProperty.call(this.molecule.atoms, a)) {
|
|
2473
|
+
const c = this.molecule.atoms[a];
|
|
2474
|
+
if (c.isotope !== "V")
|
|
2372
2475
|
continue;
|
|
2373
|
-
if (
|
|
2476
|
+
if (i = c.value * 1, Number.isNaN(i))
|
|
2374
2477
|
throw new TypeError('Invalid isotope "V" values');
|
|
2375
|
-
if (
|
|
2376
|
-
throw new
|
|
2377
|
-
if (
|
|
2378
|
-
if (
|
|
2379
|
-
throw new
|
|
2380
|
-
if (
|
|
2381
|
-
throw new
|
|
2478
|
+
if (c.token !== s.token)
|
|
2479
|
+
throw new St();
|
|
2480
|
+
if (a > 0) {
|
|
2481
|
+
if (i < 0)
|
|
2482
|
+
throw new Se();
|
|
2483
|
+
if (c.walletAddress === s.walletAddress)
|
|
2484
|
+
throw new is();
|
|
2382
2485
|
}
|
|
2383
|
-
|
|
2486
|
+
r += i;
|
|
2384
2487
|
}
|
|
2385
|
-
if (
|
|
2386
|
-
throw new
|
|
2488
|
+
if (!n && r !== 0)
|
|
2489
|
+
throw new Oe();
|
|
2387
2490
|
if (e) {
|
|
2388
|
-
if (
|
|
2491
|
+
if (i = s.value * 1, Number.isNaN(i))
|
|
2389
2492
|
throw new TypeError('Invalid isotope "V" values');
|
|
2390
|
-
const
|
|
2391
|
-
if (
|
|
2493
|
+
const a = Number(e.balance) + i;
|
|
2494
|
+
if (a < 0)
|
|
2392
2495
|
throw new Y();
|
|
2393
|
-
if (
|
|
2394
|
-
throw new
|
|
2395
|
-
} else if (
|
|
2396
|
-
throw new
|
|
2496
|
+
if (!n && a !== r)
|
|
2497
|
+
throw new _t();
|
|
2498
|
+
} else if (i !== 0)
|
|
2499
|
+
throw new _t();
|
|
2397
2500
|
return !0;
|
|
2398
2501
|
}
|
|
2399
2502
|
/**
|
|
@@ -2405,7 +2508,7 @@ class ss {
|
|
|
2405
2508
|
if (this.molecule.molecularHash !== g.hashAtoms({
|
|
2406
2509
|
atoms: this.molecule.atoms
|
|
2407
2510
|
}))
|
|
2408
|
-
throw new
|
|
2511
|
+
throw new ns();
|
|
2409
2512
|
return !0;
|
|
2410
2513
|
}
|
|
2411
2514
|
/**
|
|
@@ -2422,13 +2525,13 @@ class ss {
|
|
|
2422
2525
|
).reduce(
|
|
2423
2526
|
(p, d) => p + d
|
|
2424
2527
|
);
|
|
2425
|
-
if (t.length !== 2048 && (t =
|
|
2426
|
-
throw new
|
|
2427
|
-
const n =
|
|
2528
|
+
if (t.length !== 2048 && (t = pn(t), t.length !== 2048))
|
|
2529
|
+
throw new Vt();
|
|
2530
|
+
const n = He(t, 128);
|
|
2428
2531
|
let s = "";
|
|
2429
2532
|
for (const p in n) {
|
|
2430
2533
|
let d = n[p];
|
|
2431
|
-
for (let w = 0,
|
|
2534
|
+
for (let w = 0, A = 8 + e[p]; w < A; w++)
|
|
2432
2535
|
d = new L("SHAKE256", "TEXT").update(d).getHash("HEX", { outputLen: 512 });
|
|
2433
2536
|
s += d;
|
|
2434
2537
|
}
|
|
@@ -2440,11 +2543,93 @@ class ss {
|
|
|
2440
2543
|
let l = u.walletAddress;
|
|
2441
2544
|
const h = C.get(u.aggregatedMeta(), "signingWallet");
|
|
2442
2545
|
if (h && (l = C.get(JSON.parse(h), "address")), c !== l)
|
|
2443
|
-
throw new
|
|
2546
|
+
throw new rs();
|
|
2444
2547
|
return !0;
|
|
2445
2548
|
}
|
|
2549
|
+
/**
|
|
2550
|
+
* Converts server-side molecule data (from GraphQL meta query responses)
|
|
2551
|
+
* into a Molecule instance suitable for verification via CheckMolecule.
|
|
2552
|
+
*
|
|
2553
|
+
* Handles field mapping differences between server and client:
|
|
2554
|
+
* - tokenSlug → token
|
|
2555
|
+
* - metasJson (JSON string) → meta (array of {key, value})
|
|
2556
|
+
* - bundleHash → bundle
|
|
2557
|
+
*
|
|
2558
|
+
* @param {object} serverData - Molecule data from GraphQL response
|
|
2559
|
+
* @param {string} serverData.molecularHash
|
|
2560
|
+
* @param {string} serverData.bundleHash
|
|
2561
|
+
* @param {string|null} serverData.cellSlug
|
|
2562
|
+
* @param {string|null} serverData.status
|
|
2563
|
+
* @param {string|null} serverData.createdAt
|
|
2564
|
+
* @param {array} serverData.atoms - Array of server-format atom objects
|
|
2565
|
+
* @return {Molecule}
|
|
2566
|
+
*/
|
|
2567
|
+
static fromServerData({
|
|
2568
|
+
molecularHash: e,
|
|
2569
|
+
bundleHash: t,
|
|
2570
|
+
cellSlug: n = null,
|
|
2571
|
+
status: s = null,
|
|
2572
|
+
createdAt: r = null,
|
|
2573
|
+
atoms: i = []
|
|
2574
|
+
}) {
|
|
2575
|
+
const a = i.map((c) => {
|
|
2576
|
+
let u = [];
|
|
2577
|
+
if (c.metasJson)
|
|
2578
|
+
try {
|
|
2579
|
+
const l = JSON.parse(c.metasJson);
|
|
2580
|
+
Array.isArray(l) ? u = l : l && typeof l == "object" && (u = Object.entries(l).map(([h, p]) => ({ key: h, value: p })));
|
|
2581
|
+
} catch {
|
|
2582
|
+
u = [];
|
|
2583
|
+
}
|
|
2584
|
+
return {
|
|
2585
|
+
position: c.position || null,
|
|
2586
|
+
walletAddress: c.walletAddress || null,
|
|
2587
|
+
isotope: c.isotope || null,
|
|
2588
|
+
token: c.tokenSlug || c.token || null,
|
|
2589
|
+
value: c.value != null ? String(c.value) : null,
|
|
2590
|
+
batchId: c.batchId || null,
|
|
2591
|
+
metaType: c.metaType || null,
|
|
2592
|
+
metaId: c.metaId || null,
|
|
2593
|
+
meta: u,
|
|
2594
|
+
index: c.index != null ? c.index : null,
|
|
2595
|
+
otsFragment: c.otsFragment || null,
|
|
2596
|
+
createdAt: c.createdAt || null
|
|
2597
|
+
};
|
|
2598
|
+
});
|
|
2599
|
+
return z.fromJSON({
|
|
2600
|
+
molecularHash: e,
|
|
2601
|
+
bundle: t,
|
|
2602
|
+
cellSlug: n,
|
|
2603
|
+
status: s,
|
|
2604
|
+
createdAt: r,
|
|
2605
|
+
atoms: a
|
|
2606
|
+
});
|
|
2607
|
+
}
|
|
2608
|
+
/**
|
|
2609
|
+
* Verifies a molecule reconstructed from server-side GraphQL data.
|
|
2610
|
+
* Returns an object with verification result and any error details.
|
|
2611
|
+
*
|
|
2612
|
+
* @param {object} moleculeData - Server molecule data (same format as fromServerData)
|
|
2613
|
+
* @return {{ molecularHash: string, verified: boolean, error: string|null }}
|
|
2614
|
+
*/
|
|
2615
|
+
static verifyFromServerData(e) {
|
|
2616
|
+
try {
|
|
2617
|
+
const t = ve.fromServerData(e);
|
|
2618
|
+
return new ve(t).verify(), {
|
|
2619
|
+
molecularHash: e.molecularHash,
|
|
2620
|
+
verified: !0,
|
|
2621
|
+
error: null
|
|
2622
|
+
};
|
|
2623
|
+
} catch (t) {
|
|
2624
|
+
return {
|
|
2625
|
+
molecularHash: e.molecularHash || null,
|
|
2626
|
+
verified: !1,
|
|
2627
|
+
error: t.message || String(t)
|
|
2628
|
+
};
|
|
2629
|
+
}
|
|
2630
|
+
}
|
|
2446
2631
|
}
|
|
2447
|
-
class
|
|
2632
|
+
class ue extends x {
|
|
2448
2633
|
/**
|
|
2449
2634
|
* Class constructor
|
|
2450
2635
|
*
|
|
@@ -2456,7 +2641,7 @@ class we extends x {
|
|
|
2456
2641
|
super(e, t, n), this.name = "BalanceInsufficientException";
|
|
2457
2642
|
}
|
|
2458
2643
|
}
|
|
2459
|
-
class
|
|
2644
|
+
class Ze extends x {
|
|
2460
2645
|
/**
|
|
2461
2646
|
* Class constructor
|
|
2462
2647
|
*
|
|
@@ -2468,7 +2653,7 @@ class bt extends x {
|
|
|
2468
2653
|
super(e, t, n), this.name = "NegativeAmountException";
|
|
2469
2654
|
}
|
|
2470
2655
|
}
|
|
2471
|
-
class
|
|
2656
|
+
class z {
|
|
2472
2657
|
/**
|
|
2473
2658
|
* Class constructor
|
|
2474
2659
|
*
|
|
@@ -2487,7 +2672,7 @@ class J {
|
|
|
2487
2672
|
cellSlug: r = null,
|
|
2488
2673
|
version: i = null
|
|
2489
2674
|
}) {
|
|
2490
|
-
this.status = null, this.molecularHash = null, this.createdAt = String(+/* @__PURE__ */ new Date()), this.cellSlugOrigin = this.cellSlug = r, this.secret = e, this.bundle = t, this.sourceWallet = n, this.atoms = [], i !== null && Object.prototype.hasOwnProperty.call(
|
|
2675
|
+
this.status = null, this.molecularHash = null, this.createdAt = String(+/* @__PURE__ */ new Date()), this.cellSlugOrigin = this.cellSlug = r, this.secret = e, this.bundle = t, this.sourceWallet = n, this.atoms = [], this.parentHashes = [], i !== null && Object.prototype.hasOwnProperty.call(Ue, i) && (this.version = String(i)), (s || n) && (this.remainderWallet = s || _.create({
|
|
2491
2676
|
secret: e,
|
|
2492
2677
|
bundle: t,
|
|
2493
2678
|
token: n.token,
|
|
@@ -2495,6 +2680,15 @@ class J {
|
|
|
2495
2680
|
characters: n.characters
|
|
2496
2681
|
}));
|
|
2497
2682
|
}
|
|
2683
|
+
/**
|
|
2684
|
+
* Sets parent molecular hashes for DAG linkage
|
|
2685
|
+
*
|
|
2686
|
+
* @param {string[]} hashes - Array of parent molecular hash strings
|
|
2687
|
+
* @return {Molecule} this instance for chaining
|
|
2688
|
+
*/
|
|
2689
|
+
withParentHashes(e) {
|
|
2690
|
+
return this.parentHashes = Array.isArray(e) ? [...e] : [], this;
|
|
2691
|
+
}
|
|
2498
2692
|
/**
|
|
2499
2693
|
* Returns the cell slug delimiter
|
|
2500
2694
|
*
|
|
@@ -2530,7 +2724,7 @@ class J {
|
|
|
2530
2724
|
* @throws {AtomsMissingException}
|
|
2531
2725
|
*/
|
|
2532
2726
|
static jsonToObject(e) {
|
|
2533
|
-
const t = Object.assign(new
|
|
2727
|
+
const t = Object.assign(new z({}), JSON.parse(e)), n = Object.keys(new z({}));
|
|
2534
2728
|
if (!Array.isArray(t.atoms))
|
|
2535
2729
|
throw new ae();
|
|
2536
2730
|
for (const s in Object.keys(t.atoms)) {
|
|
@@ -2609,7 +2803,7 @@ class J {
|
|
|
2609
2803
|
* @returns {*[]}
|
|
2610
2804
|
*/
|
|
2611
2805
|
getIsotopes(e) {
|
|
2612
|
-
return
|
|
2806
|
+
return z.isotopeFilter(e, this.atoms);
|
|
2613
2807
|
}
|
|
2614
2808
|
/**
|
|
2615
2809
|
* Generates the next atomic index
|
|
@@ -2617,7 +2811,7 @@ class J {
|
|
|
2617
2811
|
* @return {number}
|
|
2618
2812
|
*/
|
|
2619
2813
|
generateIndex() {
|
|
2620
|
-
return
|
|
2814
|
+
return z.generateNextAtomIndex(this.atoms);
|
|
2621
2815
|
}
|
|
2622
2816
|
/**
|
|
2623
2817
|
* Fills a Molecule's properties with the provided object
|
|
@@ -2642,7 +2836,7 @@ class J {
|
|
|
2642
2836
|
* @return {Molecule}
|
|
2643
2837
|
*/
|
|
2644
2838
|
addContinuIdAtom() {
|
|
2645
|
-
(!this.remainderWallet || this.remainderWallet.token !== "USER") && (this.remainderWallet =
|
|
2839
|
+
(!this.remainderWallet || this.remainderWallet.token !== "USER") && (this.remainderWallet = _.create({
|
|
2646
2840
|
secret: this.secret,
|
|
2647
2841
|
bundle: this.bundle
|
|
2648
2842
|
}));
|
|
@@ -2652,7 +2846,7 @@ class J {
|
|
|
2652
2846
|
wallet: this.remainderWallet,
|
|
2653
2847
|
metaType: "walletBundle",
|
|
2654
2848
|
metaId: this.remainderWallet.bundle,
|
|
2655
|
-
meta: new
|
|
2849
|
+
meta: new P(e)
|
|
2656
2850
|
})), this;
|
|
2657
2851
|
}
|
|
2658
2852
|
/**
|
|
@@ -2670,9 +2864,9 @@ class J {
|
|
|
2670
2864
|
meta: n = {},
|
|
2671
2865
|
policy: s = {}
|
|
2672
2866
|
}) {
|
|
2673
|
-
const r = new
|
|
2867
|
+
const r = new P(n);
|
|
2674
2868
|
r.addPolicy(s);
|
|
2675
|
-
const i =
|
|
2869
|
+
const i = _.create({
|
|
2676
2870
|
secret: this.secret,
|
|
2677
2871
|
bundle: this.sourceWallet.bundle,
|
|
2678
2872
|
token: "USER"
|
|
@@ -2694,7 +2888,7 @@ class J {
|
|
|
2694
2888
|
fuseToken(e, t) {
|
|
2695
2889
|
const n = e.length;
|
|
2696
2890
|
if (this.sourceWallet.balance - n < 0)
|
|
2697
|
-
throw new
|
|
2891
|
+
throw new ue();
|
|
2698
2892
|
return this.addAtom(g.create({
|
|
2699
2893
|
isotope: "V",
|
|
2700
2894
|
wallet: this.sourceWallet,
|
|
@@ -2725,9 +2919,9 @@ class J {
|
|
|
2725
2919
|
walletBundle: t = null
|
|
2726
2920
|
}) {
|
|
2727
2921
|
if (e < 0)
|
|
2728
|
-
throw new
|
|
2922
|
+
throw new Ze("Molecule::burnToken() - Amount to burn must be positive!");
|
|
2729
2923
|
if (this.sourceWallet.balance - e < 0)
|
|
2730
|
-
throw new
|
|
2924
|
+
throw new ue();
|
|
2731
2925
|
return this.addAtom(g.create({
|
|
2732
2926
|
isotope: "V",
|
|
2733
2927
|
wallet: this.sourceWallet,
|
|
@@ -2753,22 +2947,22 @@ class J {
|
|
|
2753
2947
|
units: t = []
|
|
2754
2948
|
}) {
|
|
2755
2949
|
if (e < 0)
|
|
2756
|
-
throw new
|
|
2950
|
+
throw new Ze("Molecule::replenishToken() - Amount to replenish must be positive!");
|
|
2757
2951
|
if (t.length) {
|
|
2758
|
-
t =
|
|
2952
|
+
t = _.getTokenUnits(t), this.remainderWallet.tokenUnits = this.sourceWallet.tokenUnits;
|
|
2759
2953
|
for (const n of t)
|
|
2760
2954
|
this.remainderWallet.tokenUnits.push(n);
|
|
2761
|
-
this.remainderWallet.balance = this.remainderWallet.tokenUnits.length, this.sourceWallet.tokenUnits = t, this.sourceWallet.balance = this.sourceWallet.tokenUnits.length;
|
|
2955
|
+
this.remainderWallet.balance = String(this.remainderWallet.tokenUnits.length), this.sourceWallet.tokenUnits = t, this.sourceWallet.balance = String(this.sourceWallet.tokenUnits.length);
|
|
2762
2956
|
} else
|
|
2763
|
-
this.remainderWallet.balance = this.sourceWallet.balance + e, this.sourceWallet.balance = e;
|
|
2957
|
+
this.remainderWallet.balance = String(Number(this.sourceWallet.balance) + e), this.sourceWallet.balance = String(e);
|
|
2764
2958
|
return this.addAtom(g.create({
|
|
2765
2959
|
isotope: "V",
|
|
2766
2960
|
wallet: this.sourceWallet,
|
|
2767
|
-
value: this.sourceWallet.balance
|
|
2961
|
+
value: Number(this.sourceWallet.balance)
|
|
2768
2962
|
})), this.addAtom(g.create({
|
|
2769
2963
|
isotope: "V",
|
|
2770
2964
|
wallet: this.remainderWallet,
|
|
2771
|
-
value: this.remainderWallet.balance,
|
|
2965
|
+
value: Number(this.remainderWallet.balance),
|
|
2772
2966
|
metaType: "walletBundle",
|
|
2773
2967
|
metaId: this.remainderWallet.bundle
|
|
2774
2968
|
})), this;
|
|
@@ -2786,7 +2980,7 @@ class J {
|
|
|
2786
2980
|
amount: t
|
|
2787
2981
|
}) {
|
|
2788
2982
|
if (this.sourceWallet.balance - t < 0)
|
|
2789
|
-
throw new
|
|
2983
|
+
throw new ue();
|
|
2790
2984
|
return this.addAtom(g.create({
|
|
2791
2985
|
isotope: "V",
|
|
2792
2986
|
wallet: this.sourceWallet,
|
|
@@ -2805,6 +2999,45 @@ class J {
|
|
|
2805
2999
|
metaId: this.remainderWallet.bundle
|
|
2806
3000
|
})), this;
|
|
2807
3001
|
}
|
|
3002
|
+
/**
|
|
3003
|
+
* Creates a stackable V-isotope transfer with 3 atoms:
|
|
3004
|
+
* source debit, recipient credit, remainder.
|
|
3005
|
+
* Propagates batchId from source wallet.
|
|
3006
|
+
*
|
|
3007
|
+
* @param {Wallet} recipientWallet - wallet receiving the tokens
|
|
3008
|
+
* @param {number} amount - amount to transfer
|
|
3009
|
+
* @return {Molecule}
|
|
3010
|
+
*/
|
|
3011
|
+
addStackableTransfer({
|
|
3012
|
+
recipientWallet: e,
|
|
3013
|
+
amount: t
|
|
3014
|
+
}) {
|
|
3015
|
+
if (t <= 0)
|
|
3016
|
+
throw new Ze("Molecule::addStackableTransfer() - Amount must be positive!");
|
|
3017
|
+
if (this.sourceWallet.balance - t < 0)
|
|
3018
|
+
throw new ue();
|
|
3019
|
+
const n = this.sourceWallet.batchId || he({});
|
|
3020
|
+
return this.addAtom(g.create({
|
|
3021
|
+
isotope: "V",
|
|
3022
|
+
wallet: this.sourceWallet,
|
|
3023
|
+
value: -t,
|
|
3024
|
+
batchId: n
|
|
3025
|
+
})), this.addAtom(g.create({
|
|
3026
|
+
isotope: "V",
|
|
3027
|
+
wallet: e,
|
|
3028
|
+
value: t,
|
|
3029
|
+
metaType: "walletBundle",
|
|
3030
|
+
metaId: e.bundle,
|
|
3031
|
+
batchId: he({})
|
|
3032
|
+
})), this.addAtom(g.create({
|
|
3033
|
+
isotope: "V",
|
|
3034
|
+
wallet: this.remainderWallet,
|
|
3035
|
+
value: this.sourceWallet.balance - t,
|
|
3036
|
+
metaType: "walletBundle",
|
|
3037
|
+
metaId: this.remainderWallet.bundle,
|
|
3038
|
+
batchId: n
|
|
3039
|
+
})), this;
|
|
3040
|
+
}
|
|
2808
3041
|
/**
|
|
2809
3042
|
*
|
|
2810
3043
|
* @param amount
|
|
@@ -2815,8 +3048,8 @@ class J {
|
|
|
2815
3048
|
tradeRates: t
|
|
2816
3049
|
}) {
|
|
2817
3050
|
if (this.sourceWallet.balance - e < 0)
|
|
2818
|
-
throw new
|
|
2819
|
-
const n =
|
|
3051
|
+
throw new ue();
|
|
3052
|
+
const n = _.create({
|
|
2820
3053
|
secret: this.secret,
|
|
2821
3054
|
bundle: this.bundle,
|
|
2822
3055
|
token: this.sourceWallet.token,
|
|
@@ -2854,8 +3087,8 @@ class J {
|
|
|
2854
3087
|
for (const [r, i] of Object.entries(e || {}))
|
|
2855
3088
|
n += i;
|
|
2856
3089
|
if (this.sourceWallet.balance - n < 0)
|
|
2857
|
-
throw new
|
|
2858
|
-
const s = new
|
|
3090
|
+
throw new ue();
|
|
3091
|
+
const s = new P();
|
|
2859
3092
|
t && s.setSigningWallet(t), this.addAtom(g.create({
|
|
2860
3093
|
isotope: "B",
|
|
2861
3094
|
wallet: this.sourceWallet,
|
|
@@ -2869,7 +3102,7 @@ class J {
|
|
|
2869
3102
|
isotope: "V",
|
|
2870
3103
|
token: this.sourceWallet.token,
|
|
2871
3104
|
value: i,
|
|
2872
|
-
batchId: this.sourceWallet.batchId ?
|
|
3105
|
+
batchId: this.sourceWallet.batchId ? he({}) : null,
|
|
2873
3106
|
metaType: "walletBundle",
|
|
2874
3107
|
metaId: r
|
|
2875
3108
|
}));
|
|
@@ -2894,7 +3127,7 @@ class J {
|
|
|
2894
3127
|
amount: t,
|
|
2895
3128
|
meta: n
|
|
2896
3129
|
}) {
|
|
2897
|
-
const s = new
|
|
3130
|
+
const s = new P(n);
|
|
2898
3131
|
return s.setMetaWallet(e), this.addAtom(g.create({
|
|
2899
3132
|
isotope: "C",
|
|
2900
3133
|
wallet: this.sourceWallet,
|
|
@@ -2921,8 +3154,8 @@ class J {
|
|
|
2921
3154
|
}) {
|
|
2922
3155
|
const r = [];
|
|
2923
3156
|
for (const a of n)
|
|
2924
|
-
r.push(a instanceof
|
|
2925
|
-
const i = new
|
|
3157
|
+
r.push(a instanceof Ae ? a : Ae.toObject(a));
|
|
3158
|
+
const i = new P({
|
|
2926
3159
|
rule: JSON.stringify(r)
|
|
2927
3160
|
});
|
|
2928
3161
|
return i.addPolicy(s), this.addAtom(g.create({
|
|
@@ -2941,7 +3174,7 @@ class J {
|
|
|
2941
3174
|
* @return {Molecule}
|
|
2942
3175
|
*/
|
|
2943
3176
|
initWalletCreation(e, t = null) {
|
|
2944
|
-
t || (t = new
|
|
3177
|
+
t || (t = new P()), t.setMetaWallet(e);
|
|
2945
3178
|
const n = g.create({
|
|
2946
3179
|
isotope: "C",
|
|
2947
3180
|
wallet: this.sourceWallet,
|
|
@@ -2958,7 +3191,7 @@ class J {
|
|
|
2958
3191
|
* @param wallet
|
|
2959
3192
|
*/
|
|
2960
3193
|
initShadowWalletClaim(e) {
|
|
2961
|
-
const t = new
|
|
3194
|
+
const t = new P().setShadowWalletClaim(!0);
|
|
2962
3195
|
return this.initWalletCreation(e, t);
|
|
2963
3196
|
}
|
|
2964
3197
|
/**
|
|
@@ -2977,14 +3210,14 @@ class J {
|
|
|
2977
3210
|
}) {
|
|
2978
3211
|
const s = {
|
|
2979
3212
|
code: n,
|
|
2980
|
-
hash:
|
|
3213
|
+
hash: fe(t.trim(), "Molecule::initIdentifierCreation")
|
|
2981
3214
|
};
|
|
2982
3215
|
return this.addAtom(g.create({
|
|
2983
3216
|
isotope: "C",
|
|
2984
3217
|
wallet: this.sourceWallet,
|
|
2985
3218
|
metaType: "identifier",
|
|
2986
3219
|
metaId: e,
|
|
2987
|
-
meta: new
|
|
3220
|
+
meta: new P(s)
|
|
2988
3221
|
})), this.addContinuIdAtom(), this;
|
|
2989
3222
|
}
|
|
2990
3223
|
/**
|
|
@@ -3007,7 +3240,7 @@ class J {
|
|
|
3007
3240
|
wallet: this.sourceWallet,
|
|
3008
3241
|
metaType: t,
|
|
3009
3242
|
metaId: n,
|
|
3010
|
-
meta: new
|
|
3243
|
+
meta: new P(e)
|
|
3011
3244
|
})), s && Object.keys(s).length > 0 && this.addPolicyAtom({
|
|
3012
3245
|
metaType: t,
|
|
3013
3246
|
metaId: n,
|
|
@@ -3029,7 +3262,7 @@ class J {
|
|
|
3029
3262
|
wallet: this.sourceWallet,
|
|
3030
3263
|
metaType: "walletBundle",
|
|
3031
3264
|
metaId: this.bundle,
|
|
3032
|
-
meta: new
|
|
3265
|
+
meta: new P({ peerHost: e })
|
|
3033
3266
|
})), this.addContinuIdAtom(), this;
|
|
3034
3267
|
}
|
|
3035
3268
|
/**
|
|
@@ -3052,7 +3285,7 @@ class J {
|
|
|
3052
3285
|
wallet: this.sourceWallet,
|
|
3053
3286
|
metaType: e,
|
|
3054
3287
|
metaId: t,
|
|
3055
|
-
meta: new
|
|
3288
|
+
meta: new P({ action: n, ...s })
|
|
3056
3289
|
})), this.addContinuIdAtom(), this;
|
|
3057
3290
|
}
|
|
3058
3291
|
/**
|
|
@@ -3081,7 +3314,7 @@ class J {
|
|
|
3081
3314
|
value: t,
|
|
3082
3315
|
metaType: n,
|
|
3083
3316
|
metaId: s,
|
|
3084
|
-
meta: new
|
|
3317
|
+
meta: new P(r),
|
|
3085
3318
|
batchId: i
|
|
3086
3319
|
})), this.addContinuIdAtom(), this;
|
|
3087
3320
|
}
|
|
@@ -3096,7 +3329,7 @@ class J {
|
|
|
3096
3329
|
return this.addAtom(g.create({
|
|
3097
3330
|
isotope: "U",
|
|
3098
3331
|
wallet: this.sourceWallet,
|
|
3099
|
-
meta: new
|
|
3332
|
+
meta: new P(e)
|
|
3100
3333
|
})), this.addContinuIdAtom(), this;
|
|
3101
3334
|
}
|
|
3102
3335
|
/**
|
|
@@ -3116,33 +3349,46 @@ class J {
|
|
|
3116
3349
|
}) {
|
|
3117
3350
|
if (this.atoms.length === 0 || this.atoms.filter((d) => !(d instanceof g)).length !== 0)
|
|
3118
3351
|
throw new ae();
|
|
3119
|
-
!t && !this.bundle && (this.bundle = e ||
|
|
3352
|
+
!t && !this.bundle && (this.bundle = e || fe(this.secret, "Molecule::sign")), this.molecularHash = g.hashAtoms({
|
|
3120
3353
|
atoms: this.atoms
|
|
3121
3354
|
});
|
|
3122
3355
|
const s = this.atoms[0];
|
|
3123
3356
|
let r = s.position;
|
|
3124
3357
|
const i = C.get(s.aggregatedMeta(), "signingWallet");
|
|
3125
3358
|
if (i && (r = C.get(JSON.parse(i), "position")), !r)
|
|
3126
|
-
throw new
|
|
3127
|
-
const a =
|
|
3359
|
+
throw new Vt("Signing wallet must have a position!");
|
|
3360
|
+
const a = _.generateKey({
|
|
3128
3361
|
secret: this.secret,
|
|
3129
3362
|
token: s.token,
|
|
3130
3363
|
position: s.position
|
|
3131
|
-
}), c =
|
|
3364
|
+
}), c = He(a, 128), u = this.normalizedHash();
|
|
3132
3365
|
let l = "";
|
|
3133
3366
|
for (const d in c) {
|
|
3134
3367
|
let w = c[d];
|
|
3135
|
-
for (let
|
|
3368
|
+
for (let A = 0, T = 8 - u[d]; A < T; A++)
|
|
3136
3369
|
w = new L("SHAKE256", "TEXT").update(w).getHash("HEX", { outputLen: 512 });
|
|
3137
3370
|
l += w;
|
|
3138
3371
|
}
|
|
3139
|
-
n && (l =
|
|
3140
|
-
const h =
|
|
3372
|
+
n && (l = dn(l));
|
|
3373
|
+
const h = He(l, Math.ceil(l.length / this.atoms.length));
|
|
3141
3374
|
let p = null;
|
|
3142
3375
|
for (let d = 0, w = h.length; d < w; d++)
|
|
3143
3376
|
this.atoms[d].otsFragment = h[d], p = this.atoms[d].position;
|
|
3144
3377
|
return p;
|
|
3145
3378
|
}
|
|
3379
|
+
/**
|
|
3380
|
+
* Synchronous signing — identical to sign() since all operations are CPU-bound.
|
|
3381
|
+
* Provided for API parity with Rust SDK's sign_sync().
|
|
3382
|
+
*
|
|
3383
|
+
* @param {object} options
|
|
3384
|
+
* @param {string|null} options.bundle
|
|
3385
|
+
* @param {boolean} options.anonymous
|
|
3386
|
+
* @param {boolean} options.compressed
|
|
3387
|
+
* @return {string|null}
|
|
3388
|
+
*/
|
|
3389
|
+
signSync(e = {}) {
|
|
3390
|
+
return this.sign(e);
|
|
3391
|
+
}
|
|
3146
3392
|
/**
|
|
3147
3393
|
* Returns the base cell slug portion
|
|
3148
3394
|
*
|
|
@@ -3181,11 +3427,11 @@ class J {
|
|
|
3181
3427
|
includeOtsFragments: n
|
|
3182
3428
|
}))
|
|
3183
3429
|
};
|
|
3184
|
-
return t && (s.cellSlugOrigin = this.cellSlugOrigin, s.version = this.version, this.sourceWallet && (s.sourceWallet = {
|
|
3430
|
+
return this.parentHashes && this.parentHashes.length > 0 && (s.parentHashes = this.parentHashes), t && (s.cellSlugOrigin = this.cellSlugOrigin, s.version = this.version, this.sourceWallet && (s.sourceWallet = {
|
|
3185
3431
|
address: this.sourceWallet.address,
|
|
3186
3432
|
position: this.sourceWallet.position,
|
|
3187
3433
|
token: this.sourceWallet.token,
|
|
3188
|
-
balance: this.sourceWallet.balance || 0,
|
|
3434
|
+
balance: this.sourceWallet.balance || "0",
|
|
3189
3435
|
bundle: this.sourceWallet.bundle,
|
|
3190
3436
|
batchId: this.sourceWallet.batchId || null,
|
|
3191
3437
|
characters: this.sourceWallet.characters || "BASE64",
|
|
@@ -3197,7 +3443,7 @@ class J {
|
|
|
3197
3443
|
address: this.remainderWallet.address,
|
|
3198
3444
|
position: this.remainderWallet.position,
|
|
3199
3445
|
token: this.remainderWallet.token,
|
|
3200
|
-
balance: this.remainderWallet.balance || 0,
|
|
3446
|
+
balance: this.remainderWallet.balance || "0",
|
|
3201
3447
|
bundle: this.remainderWallet.bundle,
|
|
3202
3448
|
batchId: this.remainderWallet.batchId || null,
|
|
3203
3449
|
characters: this.remainderWallet.characters || "BASE64",
|
|
@@ -3232,33 +3478,33 @@ class J {
|
|
|
3232
3478
|
const r = typeof e == "string" ? JSON.parse(e) : e;
|
|
3233
3479
|
if (s && (!r.molecularHash || !Array.isArray(r.atoms)))
|
|
3234
3480
|
throw new Error("Invalid molecule data: missing molecularHash or atoms array");
|
|
3235
|
-
const i = new
|
|
3481
|
+
const i = new z({
|
|
3236
3482
|
secret: null,
|
|
3237
3483
|
bundle: r.bundle || null,
|
|
3238
3484
|
cellSlug: r.cellSlug || null,
|
|
3239
3485
|
version: r.version || null
|
|
3240
3486
|
});
|
|
3241
|
-
return i.status = r.status, i.molecularHash = r.molecularHash, i.createdAt = r.createdAt || String(+/* @__PURE__ */ new Date()), i.cellSlugOrigin = r.cellSlugOrigin, Array.isArray(r.atoms) && (i.atoms = r.atoms.map((a, c) => {
|
|
3487
|
+
return i.status = r.status, i.molecularHash = r.molecularHash, i.createdAt = r.createdAt || String(+/* @__PURE__ */ new Date()), i.cellSlugOrigin = r.cellSlugOrigin, i.parentHashes = Array.isArray(r.parentHashes) ? [...r.parentHashes] : [], Array.isArray(r.atoms) && (i.atoms = r.atoms.map((a, c) => {
|
|
3242
3488
|
try {
|
|
3243
3489
|
return g.fromJSON(a);
|
|
3244
3490
|
} catch (u) {
|
|
3245
3491
|
throw new Error(`Failed to reconstruct atom ${c}: ${u.message}`);
|
|
3246
3492
|
}
|
|
3247
|
-
})), n && (r.sourceWallet && (i.sourceWallet = new
|
|
3493
|
+
})), n && (r.sourceWallet && (i.sourceWallet = new _({
|
|
3248
3494
|
secret: null,
|
|
3249
3495
|
token: r.sourceWallet.token,
|
|
3250
3496
|
position: r.sourceWallet.position,
|
|
3251
3497
|
bundle: r.sourceWallet.bundle,
|
|
3252
3498
|
batchId: r.sourceWallet.batchId,
|
|
3253
3499
|
characters: r.sourceWallet.characters
|
|
3254
|
-
}), i.sourceWallet.balance = r.sourceWallet.balance
|
|
3500
|
+
}), i.sourceWallet.balance = String(r.sourceWallet.balance != null ? r.sourceWallet.balance : 0), i.sourceWallet.address = r.sourceWallet.address, r.sourceWallet.pubkey && (i.sourceWallet.pubkey = r.sourceWallet.pubkey), i.sourceWallet.tokenUnits = r.sourceWallet.tokenUnits || [], i.sourceWallet.tradeRates = r.sourceWallet.tradeRates || {}, i.sourceWallet.molecules = r.sourceWallet.molecules || {}), r.remainderWallet && (i.remainderWallet = new _({
|
|
3255
3501
|
secret: null,
|
|
3256
3502
|
token: r.remainderWallet.token,
|
|
3257
3503
|
position: r.remainderWallet.position,
|
|
3258
3504
|
bundle: r.remainderWallet.bundle,
|
|
3259
3505
|
batchId: r.remainderWallet.batchId,
|
|
3260
3506
|
characters: r.remainderWallet.characters
|
|
3261
|
-
}), i.remainderWallet.balance = r.remainderWallet.balance
|
|
3507
|
+
}), i.remainderWallet.balance = String(r.remainderWallet.balance != null ? r.remainderWallet.balance : 0), i.remainderWallet.address = r.remainderWallet.address, r.remainderWallet.pubkey && (i.remainderWallet.pubkey = r.remainderWallet.pubkey), i.remainderWallet.tokenUnits = r.remainderWallet.tokenUnits || [], i.remainderWallet.tradeRates = r.remainderWallet.tradeRates || {}, i.remainderWallet.molecules = r.remainderWallet.molecules || {})), i;
|
|
3262
3508
|
} catch (r) {
|
|
3263
3509
|
throw new Error(`Molecule deserialization failed: ${r.message}`);
|
|
3264
3510
|
}
|
|
@@ -3269,7 +3515,7 @@ class J {
|
|
|
3269
3515
|
* @param senderWallet
|
|
3270
3516
|
*/
|
|
3271
3517
|
check(e = null) {
|
|
3272
|
-
return new
|
|
3518
|
+
return new ve(this).verify(e);
|
|
3273
3519
|
}
|
|
3274
3520
|
/**
|
|
3275
3521
|
* Convert Hm to numeric notation via EnumerateMolecule(Hm)
|
|
@@ -3277,17 +3523,17 @@ class J {
|
|
|
3277
3523
|
* @returns {Array}
|
|
3278
3524
|
*/
|
|
3279
3525
|
normalizedHash() {
|
|
3280
|
-
return
|
|
3526
|
+
return z.normalize(z.enumerate(this.molecularHash));
|
|
3281
3527
|
}
|
|
3282
3528
|
}
|
|
3283
|
-
const
|
|
3284
|
-
class
|
|
3529
|
+
const Ye = 10 ** 18;
|
|
3530
|
+
class de {
|
|
3285
3531
|
/**
|
|
3286
3532
|
* @param {number} value
|
|
3287
3533
|
* @return {number}
|
|
3288
3534
|
*/
|
|
3289
3535
|
static val(e) {
|
|
3290
|
-
return Math.abs(e *
|
|
3536
|
+
return Math.abs(e * Ye) < 1 ? 0 : e;
|
|
3291
3537
|
}
|
|
3292
3538
|
/**
|
|
3293
3539
|
* @param {number} value1
|
|
@@ -3296,7 +3542,7 @@ class ue {
|
|
|
3296
3542
|
* @return {number}
|
|
3297
3543
|
*/
|
|
3298
3544
|
static cmp(e, t, n = !1) {
|
|
3299
|
-
const s =
|
|
3545
|
+
const s = de.val(e) * Ye, r = de.val(t) * Ye;
|
|
3300
3546
|
return Math.abs(s - r) < 1 ? 0 : s > r ? 1 : -1;
|
|
3301
3547
|
}
|
|
3302
3548
|
/**
|
|
@@ -3305,10 +3551,10 @@ class ue {
|
|
|
3305
3551
|
* @return {boolean}
|
|
3306
3552
|
*/
|
|
3307
3553
|
static equal(e, t) {
|
|
3308
|
-
return
|
|
3554
|
+
return de.cmp(e, t) === 0;
|
|
3309
3555
|
}
|
|
3310
3556
|
}
|
|
3311
|
-
class
|
|
3557
|
+
class xe {
|
|
3312
3558
|
/**
|
|
3313
3559
|
*
|
|
3314
3560
|
* @param {string} token
|
|
@@ -3331,7 +3577,7 @@ class $e {
|
|
|
3331
3577
|
* @returns {AuthToken}
|
|
3332
3578
|
*/
|
|
3333
3579
|
static create(e, t) {
|
|
3334
|
-
const n = new
|
|
3580
|
+
const n = new xe(e);
|
|
3335
3581
|
return n.setWallet(t), n;
|
|
3336
3582
|
}
|
|
3337
3583
|
/**
|
|
@@ -3341,13 +3587,13 @@ class $e {
|
|
|
3341
3587
|
* @return {AuthToken}
|
|
3342
3588
|
*/
|
|
3343
3589
|
static restore(e, t) {
|
|
3344
|
-
const n = new
|
|
3590
|
+
const n = new _({
|
|
3345
3591
|
secret: t,
|
|
3346
3592
|
token: "AUTH",
|
|
3347
3593
|
position: e.wallet.position,
|
|
3348
3594
|
characters: e.wallet.characters
|
|
3349
3595
|
});
|
|
3350
|
-
return
|
|
3596
|
+
return xe.create({
|
|
3351
3597
|
token: e.token,
|
|
3352
3598
|
expiresAt: e.expiresAt,
|
|
3353
3599
|
pubkey: e.pubkey,
|
|
@@ -3436,7 +3682,7 @@ class oe extends x {
|
|
|
3436
3682
|
super(e, t, n), this.name = "InvalidResponseException";
|
|
3437
3683
|
}
|
|
3438
3684
|
}
|
|
3439
|
-
class
|
|
3685
|
+
class Ke extends x {
|
|
3440
3686
|
/**
|
|
3441
3687
|
* Class constructor
|
|
3442
3688
|
*
|
|
@@ -3448,7 +3694,7 @@ class Be extends x {
|
|
|
3448
3694
|
super(e, t, n), this.name = "UnauthenticatedException";
|
|
3449
3695
|
}
|
|
3450
3696
|
}
|
|
3451
|
-
class
|
|
3697
|
+
class O {
|
|
3452
3698
|
/**
|
|
3453
3699
|
* Class constructor
|
|
3454
3700
|
*
|
|
@@ -3465,11 +3711,11 @@ class W {
|
|
|
3465
3711
|
throw new oe();
|
|
3466
3712
|
if (C.has(this.$__response, this.errorKey)) {
|
|
3467
3713
|
const s = C.get(this.$__response, this.errorKey);
|
|
3468
|
-
throw String(s).includes("Unauthenticated") ? new
|
|
3714
|
+
throw String(s).includes("Unauthenticated") ? new Ke() : new oe();
|
|
3469
3715
|
}
|
|
3470
3716
|
if (this.$__response.errors && Array.isArray(this.$__response.errors) && this.$__response.errors.length > 0) {
|
|
3471
3717
|
const s = this.$__response.errors[0].message || "Unknown GraphQL error";
|
|
3472
|
-
throw s.includes("Unauthenticated") ? new
|
|
3718
|
+
throw s.includes("Unauthenticated") ? new Ke() : new oe(`GraphQL Error: ${s}`);
|
|
3473
3719
|
}
|
|
3474
3720
|
this.init();
|
|
3475
3721
|
}
|
|
@@ -3663,7 +3909,7 @@ class N {
|
|
|
3663
3909
|
* @return {Response}
|
|
3664
3910
|
*/
|
|
3665
3911
|
createResponse(e) {
|
|
3666
|
-
return new
|
|
3912
|
+
return new O({
|
|
3667
3913
|
query: this,
|
|
3668
3914
|
json: e
|
|
3669
3915
|
});
|
|
@@ -3705,7 +3951,7 @@ class N {
|
|
|
3705
3951
|
return this.$__response = await this.createResponseRaw(s), this.$__response;
|
|
3706
3952
|
} catch (s) {
|
|
3707
3953
|
if (s.name === "AbortError")
|
|
3708
|
-
return this.knishIOClient.log("warn", "Query was cancelled"), new
|
|
3954
|
+
return this.knishIOClient.log("warn", "Query was cancelled"), new O({
|
|
3709
3955
|
query: this,
|
|
3710
3956
|
json: { data: null, errors: [{ message: "Query was cancelled" }] }
|
|
3711
3957
|
});
|
|
@@ -3741,7 +3987,7 @@ class N {
|
|
|
3741
3987
|
return {};
|
|
3742
3988
|
}
|
|
3743
3989
|
}
|
|
3744
|
-
class
|
|
3990
|
+
class os extends O {
|
|
3745
3991
|
/**
|
|
3746
3992
|
* Class constructor
|
|
3747
3993
|
*
|
|
@@ -3766,13 +4012,13 @@ class rs extends W {
|
|
|
3766
4012
|
payload() {
|
|
3767
4013
|
let e = null;
|
|
3768
4014
|
const t = this.data();
|
|
3769
|
-
return t && (e = new
|
|
4015
|
+
return t && (e = new _({
|
|
3770
4016
|
secret: null,
|
|
3771
4017
|
token: t.tokenSlug
|
|
3772
|
-
}), e.address = t.address, e.position = t.position, e.bundle = t.bundleHash, e.batchId = t.batchId, e.characters = t.characters, e.pubkey = t.pubkey, e.balance = t.amount
|
|
4018
|
+
}), e.address = t.address, e.position = t.position, e.bundle = t.bundleHash, e.batchId = t.batchId, e.characters = t.characters, e.pubkey = t.pubkey, e.balance = String(t.amount != null ? t.amount : 0)), e;
|
|
3773
4019
|
}
|
|
3774
4020
|
}
|
|
3775
|
-
class
|
|
4021
|
+
class as extends N {
|
|
3776
4022
|
/**
|
|
3777
4023
|
* @param {UrqlClientWrapper} graphQLClient
|
|
3778
4024
|
* @param {KnishIOClient} knishIOClient
|
|
@@ -3799,13 +4045,13 @@ class is extends N {
|
|
|
3799
4045
|
* @return {ResponseContinuId}
|
|
3800
4046
|
*/
|
|
3801
4047
|
createResponse(e) {
|
|
3802
|
-
return new
|
|
4048
|
+
return new os({
|
|
3803
4049
|
query: this,
|
|
3804
4050
|
json: e
|
|
3805
4051
|
});
|
|
3806
4052
|
}
|
|
3807
4053
|
}
|
|
3808
|
-
class
|
|
4054
|
+
class ls extends O {
|
|
3809
4055
|
/**
|
|
3810
4056
|
* Class constructor
|
|
3811
4057
|
*
|
|
@@ -3833,11 +4079,11 @@ class os extends W {
|
|
|
3833
4079
|
return null;
|
|
3834
4080
|
const t = {};
|
|
3835
4081
|
return e.forEach((n) => {
|
|
3836
|
-
n.metas =
|
|
4082
|
+
n.metas = pe.aggregateMeta(n.metas), t[n.bundleHash] = n;
|
|
3837
4083
|
}), t;
|
|
3838
4084
|
}
|
|
3839
4085
|
}
|
|
3840
|
-
class
|
|
4086
|
+
class cs extends N {
|
|
3841
4087
|
/**
|
|
3842
4088
|
* @param {UrqlClientWrapper} graphQLClient
|
|
3843
4089
|
* @param {KnishIOClient} knishIOClient
|
|
@@ -3864,13 +4110,13 @@ class as extends N {
|
|
|
3864
4110
|
* @return {ResponseWalletBundle}
|
|
3865
4111
|
*/
|
|
3866
4112
|
createResponse(e) {
|
|
3867
|
-
return new
|
|
4113
|
+
return new ls({
|
|
3868
4114
|
query: this,
|
|
3869
4115
|
json: e
|
|
3870
4116
|
});
|
|
3871
4117
|
}
|
|
3872
4118
|
}
|
|
3873
|
-
class
|
|
4119
|
+
class Le extends O {
|
|
3874
4120
|
/**
|
|
3875
4121
|
* Class constructor
|
|
3876
4122
|
*
|
|
@@ -3899,12 +4145,12 @@ class Ke extends W {
|
|
|
3899
4145
|
secret: t = null
|
|
3900
4146
|
}) {
|
|
3901
4147
|
let n;
|
|
3902
|
-
if (e.position === null || typeof e.position > "u" ? n =
|
|
4148
|
+
if (e.position === null || typeof e.position > "u" ? n = _.create({
|
|
3903
4149
|
bundle: e.bundleHash,
|
|
3904
4150
|
token: e.tokenSlug,
|
|
3905
4151
|
batchId: e.batchId,
|
|
3906
4152
|
characters: e.characters
|
|
3907
|
-
}) : (n = new
|
|
4153
|
+
}) : (n = new _({
|
|
3908
4154
|
secret: t,
|
|
3909
4155
|
token: e.tokenSlug,
|
|
3910
4156
|
position: e.position,
|
|
@@ -3912,11 +4158,11 @@ class Ke extends W {
|
|
|
3912
4158
|
characters: e.characters
|
|
3913
4159
|
}), n.address = e.address, n.bundle = e.bundleHash), e.token && (n.tokenName = e.token.name, n.tokenAmount = e.token.amount, n.tokenSupply = e.token.supply, n.tokenFungibility = e.token.fungibility), e.tokenUnits.length)
|
|
3914
4160
|
for (const s of e.tokenUnits)
|
|
3915
|
-
n.tokenUnits.push(
|
|
4161
|
+
n.tokenUnits.push(me.createFromGraphQL(s));
|
|
3916
4162
|
if (e.tradeRates.length)
|
|
3917
4163
|
for (const s of e.tradeRates)
|
|
3918
4164
|
n.tradeRates[s.tokenSlug] = s.amount;
|
|
3919
|
-
return n.balance =
|
|
4165
|
+
return n.balance = String(e.amount != null ? e.amount : 0), n.pubkey = e.pubkey, n.createdAt = e.createdAt, n;
|
|
3920
4166
|
}
|
|
3921
4167
|
/**
|
|
3922
4168
|
* Returns a list of Wallet class instances
|
|
@@ -3930,7 +4176,7 @@ class Ke extends W {
|
|
|
3930
4176
|
return null;
|
|
3931
4177
|
const n = [];
|
|
3932
4178
|
for (const s of t)
|
|
3933
|
-
n.push(
|
|
4179
|
+
n.push(Le.toClientWallet({
|
|
3934
4180
|
data: s,
|
|
3935
4181
|
secret: e
|
|
3936
4182
|
}));
|
|
@@ -3945,7 +4191,7 @@ class Ke extends W {
|
|
|
3945
4191
|
return this.getWallets();
|
|
3946
4192
|
}
|
|
3947
4193
|
}
|
|
3948
|
-
class
|
|
4194
|
+
class us extends N {
|
|
3949
4195
|
/**
|
|
3950
4196
|
* @param {UrqlClientWrapper} graphQLClient
|
|
3951
4197
|
* @param {KnishIOClient} knishIOClient
|
|
@@ -3987,13 +4233,13 @@ class ls extends N {
|
|
|
3987
4233
|
* @return {ResponseWalletList}
|
|
3988
4234
|
*/
|
|
3989
4235
|
createResponse(e) {
|
|
3990
|
-
return new
|
|
4236
|
+
return new Le({
|
|
3991
4237
|
query: this,
|
|
3992
4238
|
json: e
|
|
3993
4239
|
});
|
|
3994
4240
|
}
|
|
3995
4241
|
}
|
|
3996
|
-
class
|
|
4242
|
+
class hs extends O {
|
|
3997
4243
|
/**
|
|
3998
4244
|
* Class constructor
|
|
3999
4245
|
*
|
|
@@ -4017,12 +4263,12 @@ class cs extends W {
|
|
|
4017
4263
|
*/
|
|
4018
4264
|
payload() {
|
|
4019
4265
|
let e = this.data();
|
|
4020
|
-
return Array.isArray(e) && (e = e.length > 0 ? e[0] : null), !e || !e.bundleHash || !e.tokenSlug ? null :
|
|
4266
|
+
return Array.isArray(e) && (e = e.length > 0 ? e[0] : null), !e || !e.bundleHash || !e.tokenSlug ? null : Le.toClientWallet({
|
|
4021
4267
|
data: e
|
|
4022
4268
|
});
|
|
4023
4269
|
}
|
|
4024
4270
|
}
|
|
4025
|
-
class
|
|
4271
|
+
class ds extends N {
|
|
4026
4272
|
/**
|
|
4027
4273
|
* @param {UrqlClientWrapper} graphQLClient
|
|
4028
4274
|
* @param {KnishIOClient} knishIOClient
|
|
@@ -4057,13 +4303,13 @@ class us extends N {
|
|
|
4057
4303
|
* @return {ResponseBalance}
|
|
4058
4304
|
*/
|
|
4059
4305
|
createResponse(e) {
|
|
4060
|
-
return new
|
|
4306
|
+
return new hs({
|
|
4061
4307
|
query: this,
|
|
4062
4308
|
json: e
|
|
4063
4309
|
});
|
|
4064
4310
|
}
|
|
4065
4311
|
}
|
|
4066
|
-
class
|
|
4312
|
+
class ps extends O {
|
|
4067
4313
|
/**
|
|
4068
4314
|
* Class constructor
|
|
4069
4315
|
*
|
|
@@ -4097,7 +4343,7 @@ class hs extends W {
|
|
|
4097
4343
|
return n.instances && (t.instances = n.instances), n.instanceCount && (t.instanceCount = n.instanceCount), n.paginatorInfo && (t.paginatorInfo = n.paginatorInfo), t;
|
|
4098
4344
|
}
|
|
4099
4345
|
}
|
|
4100
|
-
class
|
|
4346
|
+
class At extends N {
|
|
4101
4347
|
/**
|
|
4102
4348
|
* @param {UrqlClientWrapper} graphQLClient
|
|
4103
4349
|
* @param {KnishIOClient} knishIOClient
|
|
@@ -4166,13 +4412,13 @@ class kt extends N {
|
|
|
4166
4412
|
* @return {ResponseMetaType}
|
|
4167
4413
|
*/
|
|
4168
4414
|
createResponse(e) {
|
|
4169
|
-
return new
|
|
4415
|
+
return new ps({
|
|
4170
4416
|
query: this,
|
|
4171
4417
|
json: e
|
|
4172
4418
|
});
|
|
4173
4419
|
}
|
|
4174
4420
|
}
|
|
4175
|
-
class
|
|
4421
|
+
class Ie extends N {
|
|
4176
4422
|
/**
|
|
4177
4423
|
* @param {UrqlClientWrapper} graphQLClient
|
|
4178
4424
|
* @param {KnishIOClient} knishIOClient
|
|
@@ -4180,9 +4426,9 @@ class Ae extends N {
|
|
|
4180
4426
|
constructor(e, t) {
|
|
4181
4427
|
super(e, t), this.$__query = E`query( $batchId: String ) {
|
|
4182
4428
|
Batch( batchId: $batchId ) {
|
|
4183
|
-
${
|
|
4429
|
+
${Ie.getFields()},
|
|
4184
4430
|
children {
|
|
4185
|
-
${
|
|
4431
|
+
${Ie.getFields()}
|
|
4186
4432
|
}
|
|
4187
4433
|
}
|
|
4188
4434
|
}`;
|
|
@@ -4246,14 +4492,14 @@ class Ae extends N {
|
|
|
4246
4492
|
* @return {Response}
|
|
4247
4493
|
*/
|
|
4248
4494
|
createResponse(e) {
|
|
4249
|
-
const t = new
|
|
4495
|
+
const t = new O({
|
|
4250
4496
|
query: this,
|
|
4251
4497
|
json: e
|
|
4252
4498
|
});
|
|
4253
4499
|
return t.dataKey = "data.Batch", t;
|
|
4254
4500
|
}
|
|
4255
4501
|
}
|
|
4256
|
-
class
|
|
4502
|
+
class fs extends N {
|
|
4257
4503
|
/**
|
|
4258
4504
|
* @param {UrqlClientWrapper} graphQLClient
|
|
4259
4505
|
* @param {KnishIOClient} knishIOClient
|
|
@@ -4261,7 +4507,7 @@ class ds extends N {
|
|
|
4261
4507
|
constructor(e, t) {
|
|
4262
4508
|
super(e, t), this.$__query = E`query( $batchId: String ) {
|
|
4263
4509
|
BatchHistory( batchId: $batchId ) {
|
|
4264
|
-
${
|
|
4510
|
+
${Ie.getFields()}
|
|
4265
4511
|
}
|
|
4266
4512
|
}`;
|
|
4267
4513
|
}
|
|
@@ -4272,14 +4518,14 @@ class ds extends N {
|
|
|
4272
4518
|
* @return {Response}
|
|
4273
4519
|
*/
|
|
4274
4520
|
createResponse(e) {
|
|
4275
|
-
const t = new
|
|
4521
|
+
const t = new O({
|
|
4276
4522
|
query: this,
|
|
4277
4523
|
json: e
|
|
4278
4524
|
});
|
|
4279
4525
|
return t.dataKey = "data.BatchHistory", t;
|
|
4280
4526
|
}
|
|
4281
4527
|
}
|
|
4282
|
-
class V extends
|
|
4528
|
+
class V extends O {
|
|
4283
4529
|
/**
|
|
4284
4530
|
* Class constructor
|
|
4285
4531
|
*
|
|
@@ -4322,7 +4568,7 @@ class V extends W {
|
|
|
4322
4568
|
const e = this.data();
|
|
4323
4569
|
if (!e)
|
|
4324
4570
|
return null;
|
|
4325
|
-
const t = new
|
|
4571
|
+
const t = new z({});
|
|
4326
4572
|
return t.molecularHash = C.get(e, "molecularHash"), t.status = C.get(e, "status"), t.createdAt = C.get(e, "createdAt"), t;
|
|
4327
4573
|
}
|
|
4328
4574
|
/**
|
|
@@ -4358,7 +4604,7 @@ class V extends W {
|
|
|
4358
4604
|
return this.$__payload;
|
|
4359
4605
|
}
|
|
4360
4606
|
}
|
|
4361
|
-
class
|
|
4607
|
+
class it extends N {
|
|
4362
4608
|
/**
|
|
4363
4609
|
* Creates a new Request for the given parameters
|
|
4364
4610
|
*
|
|
@@ -4391,7 +4637,7 @@ class et extends N {
|
|
|
4391
4637
|
return this.$__response = await this.createResponseRaw(r), this.$__response;
|
|
4392
4638
|
} catch (s) {
|
|
4393
4639
|
if (s.name === "AbortError")
|
|
4394
|
-
return this.knishIOClient.log("warn", "Mutation was cancelled"), new
|
|
4640
|
+
return this.knishIOClient.log("warn", "Mutation was cancelled"), new O({
|
|
4395
4641
|
query: this,
|
|
4396
4642
|
json: { data: null, errors: [{ message: "Mutation was cancelled" }] }
|
|
4397
4643
|
});
|
|
@@ -4402,7 +4648,7 @@ class et extends N {
|
|
|
4402
4648
|
return {};
|
|
4403
4649
|
}
|
|
4404
4650
|
}
|
|
4405
|
-
class U extends
|
|
4651
|
+
class U extends it {
|
|
4406
4652
|
/**
|
|
4407
4653
|
* @param {UrqlClientWrapper} graphQLClient
|
|
4408
4654
|
* @param {KnishIOClient} knishIOClient
|
|
@@ -4473,7 +4719,7 @@ class U extends et {
|
|
|
4473
4719
|
return this.$__molecule;
|
|
4474
4720
|
}
|
|
4475
4721
|
}
|
|
4476
|
-
class
|
|
4722
|
+
class ms extends V {
|
|
4477
4723
|
/**
|
|
4478
4724
|
* return the authorization key
|
|
4479
4725
|
*
|
|
@@ -4516,7 +4762,7 @@ class ps extends V {
|
|
|
4516
4762
|
return this.payloadKey("key");
|
|
4517
4763
|
}
|
|
4518
4764
|
}
|
|
4519
|
-
class
|
|
4765
|
+
class ys extends U {
|
|
4520
4766
|
/**
|
|
4521
4767
|
*
|
|
4522
4768
|
* @param {object} meta
|
|
@@ -4531,15 +4777,15 @@ class fs extends U {
|
|
|
4531
4777
|
* @return {ResponseRequestAuthorization}
|
|
4532
4778
|
*/
|
|
4533
4779
|
createResponse(e) {
|
|
4534
|
-
return new
|
|
4780
|
+
return new ms({
|
|
4535
4781
|
query: this,
|
|
4536
4782
|
json: e
|
|
4537
4783
|
});
|
|
4538
4784
|
}
|
|
4539
4785
|
}
|
|
4540
|
-
class
|
|
4786
|
+
class gs extends V {
|
|
4541
4787
|
}
|
|
4542
|
-
class
|
|
4788
|
+
class ws extends U {
|
|
4543
4789
|
/**
|
|
4544
4790
|
* @param {Wallet|null} recipientWallet
|
|
4545
4791
|
* @param {number|null} amount
|
|
@@ -4565,15 +4811,15 @@ class ys extends U {
|
|
|
4565
4811
|
* @return {ResponseCreateToken}
|
|
4566
4812
|
*/
|
|
4567
4813
|
createResponse(e) {
|
|
4568
|
-
return new
|
|
4814
|
+
return new gs({
|
|
4569
4815
|
query: this,
|
|
4570
4816
|
json: e
|
|
4571
4817
|
});
|
|
4572
4818
|
}
|
|
4573
4819
|
}
|
|
4574
|
-
class
|
|
4820
|
+
class bs extends V {
|
|
4575
4821
|
}
|
|
4576
|
-
class
|
|
4822
|
+
class ks extends U {
|
|
4577
4823
|
/**
|
|
4578
4824
|
* Fills a Molecule with the appropriate atoms and prepares for broadcast
|
|
4579
4825
|
*
|
|
@@ -4608,13 +4854,13 @@ class ws extends U {
|
|
|
4608
4854
|
* @return {ResponseRequestTokens}
|
|
4609
4855
|
*/
|
|
4610
4856
|
createResponse(e) {
|
|
4611
|
-
return new
|
|
4857
|
+
return new bs({
|
|
4612
4858
|
query: this,
|
|
4613
4859
|
json: e
|
|
4614
4860
|
});
|
|
4615
4861
|
}
|
|
4616
4862
|
}
|
|
4617
|
-
class
|
|
4863
|
+
class Ss extends V {
|
|
4618
4864
|
/**
|
|
4619
4865
|
* Returns result of the transfer
|
|
4620
4866
|
*
|
|
@@ -4628,7 +4874,7 @@ class bs extends V {
|
|
|
4628
4874
|
return e.reason = typeof t.reason > "u" ? "Invalid response from server" : t.reason, e.status = typeof t.status > "u" ? "rejected" : t.status, e;
|
|
4629
4875
|
}
|
|
4630
4876
|
}
|
|
4631
|
-
class
|
|
4877
|
+
class _s extends U {
|
|
4632
4878
|
/**
|
|
4633
4879
|
* Fills the Molecule with provided wallet and amount data
|
|
4634
4880
|
*
|
|
@@ -4651,15 +4897,15 @@ class ks extends U {
|
|
|
4651
4897
|
* @return {ResponseTransferTokens}
|
|
4652
4898
|
*/
|
|
4653
4899
|
createResponse(e) {
|
|
4654
|
-
return new
|
|
4900
|
+
return new Ss({
|
|
4655
4901
|
query: this,
|
|
4656
4902
|
json: e
|
|
4657
4903
|
});
|
|
4658
4904
|
}
|
|
4659
4905
|
}
|
|
4660
|
-
class
|
|
4906
|
+
class $s extends V {
|
|
4661
4907
|
}
|
|
4662
|
-
class
|
|
4908
|
+
class As extends U {
|
|
4663
4909
|
fillMolecule({
|
|
4664
4910
|
type: e,
|
|
4665
4911
|
contact: t,
|
|
@@ -4678,15 +4924,15 @@ class Ss extends U {
|
|
|
4678
4924
|
* @return {ResponseCreateIdentifier}
|
|
4679
4925
|
*/
|
|
4680
4926
|
createResponse(e) {
|
|
4681
|
-
return new
|
|
4927
|
+
return new $s({
|
|
4682
4928
|
query: this,
|
|
4683
4929
|
json: e
|
|
4684
4930
|
});
|
|
4685
4931
|
}
|
|
4686
4932
|
}
|
|
4687
|
-
class
|
|
4933
|
+
class vs extends V {
|
|
4688
4934
|
}
|
|
4689
|
-
class
|
|
4935
|
+
class xs extends U {
|
|
4690
4936
|
/**
|
|
4691
4937
|
* Class constructor
|
|
4692
4938
|
*
|
|
@@ -4697,7 +4943,7 @@ class As extends U {
|
|
|
4697
4943
|
token: e,
|
|
4698
4944
|
batchId: t = null
|
|
4699
4945
|
}) {
|
|
4700
|
-
const n =
|
|
4946
|
+
const n = _.create({
|
|
4701
4947
|
secret: this.$__molecule.secret,
|
|
4702
4948
|
bundle: this.$__molecule.bundle,
|
|
4703
4949
|
token: e,
|
|
@@ -4712,15 +4958,15 @@ class As extends U {
|
|
|
4712
4958
|
* @return {ResponseClaimShadowWallet}
|
|
4713
4959
|
*/
|
|
4714
4960
|
createResponse(e) {
|
|
4715
|
-
return new
|
|
4961
|
+
return new vs({
|
|
4716
4962
|
query: this,
|
|
4717
4963
|
json: e
|
|
4718
4964
|
});
|
|
4719
4965
|
}
|
|
4720
4966
|
}
|
|
4721
|
-
class
|
|
4967
|
+
class Is extends V {
|
|
4722
4968
|
}
|
|
4723
|
-
class
|
|
4969
|
+
class Ts extends U {
|
|
4724
4970
|
/**
|
|
4725
4971
|
* Fills a molecule with an appropriate metadata atom
|
|
4726
4972
|
*
|
|
@@ -4749,15 +4995,15 @@ class xs extends U {
|
|
|
4749
4995
|
* @return {ResponseCreateMeta}
|
|
4750
4996
|
*/
|
|
4751
4997
|
createResponse(e) {
|
|
4752
|
-
return new
|
|
4998
|
+
return new Is({
|
|
4753
4999
|
query: this,
|
|
4754
5000
|
json: e
|
|
4755
5001
|
});
|
|
4756
5002
|
}
|
|
4757
5003
|
}
|
|
4758
|
-
class
|
|
5004
|
+
class Ms extends V {
|
|
4759
5005
|
}
|
|
4760
|
-
class
|
|
5006
|
+
class Cs extends U {
|
|
4761
5007
|
/**
|
|
4762
5008
|
* Fills a molecule with a P-isotope peering atom
|
|
4763
5009
|
*
|
|
@@ -4777,15 +5023,15 @@ class Ms extends U {
|
|
|
4777
5023
|
* @return {ResponsePeering}
|
|
4778
5024
|
*/
|
|
4779
5025
|
createResponse(e) {
|
|
4780
|
-
return new
|
|
5026
|
+
return new Ms({
|
|
4781
5027
|
query: this,
|
|
4782
5028
|
json: e
|
|
4783
5029
|
});
|
|
4784
5030
|
}
|
|
4785
5031
|
}
|
|
4786
|
-
class
|
|
5032
|
+
class Es extends V {
|
|
4787
5033
|
}
|
|
4788
|
-
class
|
|
5034
|
+
class Os extends U {
|
|
4789
5035
|
/**
|
|
4790
5036
|
* Fills a molecule with an A-isotope append request atom
|
|
4791
5037
|
*
|
|
@@ -4814,15 +5060,15 @@ class Cs extends U {
|
|
|
4814
5060
|
* @return {ResponseAppendRequest}
|
|
4815
5061
|
*/
|
|
4816
5062
|
createResponse(e) {
|
|
4817
|
-
return new
|
|
5063
|
+
return new Es({
|
|
4818
5064
|
query: this,
|
|
4819
5065
|
json: e
|
|
4820
5066
|
});
|
|
4821
5067
|
}
|
|
4822
5068
|
}
|
|
4823
|
-
class
|
|
5069
|
+
class Ws extends V {
|
|
4824
5070
|
}
|
|
4825
|
-
class
|
|
5071
|
+
class Rs extends U {
|
|
4826
5072
|
fillMolecule(e) {
|
|
4827
5073
|
this.$__molecule.initWalletCreation(e), this.$__molecule.sign({}), this.$__molecule.check();
|
|
4828
5074
|
}
|
|
@@ -4833,13 +5079,13 @@ class Os extends U {
|
|
|
4833
5079
|
* @return {ResponseCreateWallet}
|
|
4834
5080
|
*/
|
|
4835
5081
|
createResponse(e) {
|
|
4836
|
-
return new
|
|
5082
|
+
return new Ws({
|
|
4837
5083
|
query: this,
|
|
4838
5084
|
json: e
|
|
4839
5085
|
});
|
|
4840
5086
|
}
|
|
4841
5087
|
}
|
|
4842
|
-
class
|
|
5088
|
+
class Us extends O {
|
|
4843
5089
|
/**
|
|
4844
5090
|
* Class constructor
|
|
4845
5091
|
*
|
|
@@ -4923,7 +5169,7 @@ class Rs extends W {
|
|
|
4923
5169
|
return this.payloadKey("encrypt");
|
|
4924
5170
|
}
|
|
4925
5171
|
}
|
|
4926
|
-
class
|
|
5172
|
+
class Bs extends it {
|
|
4927
5173
|
/**
|
|
4928
5174
|
* @param {UrqlClientWrapper} graphQLClient
|
|
4929
5175
|
* @param {KnishIOClient} knishIOClient
|
|
@@ -4944,13 +5190,13 @@ class Ws extends et {
|
|
|
4944
5190
|
* @return {ResponseRequestAuthorizationGuest}
|
|
4945
5191
|
*/
|
|
4946
5192
|
createResponse(e) {
|
|
4947
|
-
return new
|
|
5193
|
+
return new Us({
|
|
4948
5194
|
query: this,
|
|
4949
5195
|
json: e
|
|
4950
5196
|
});
|
|
4951
5197
|
}
|
|
4952
5198
|
}
|
|
4953
|
-
class
|
|
5199
|
+
class vt extends x {
|
|
4954
5200
|
/**
|
|
4955
5201
|
* Class constructor
|
|
4956
5202
|
*
|
|
@@ -4962,7 +5208,7 @@ class _t extends x {
|
|
|
4962
5208
|
super(e, t, n), this.name = "WalletShadowException";
|
|
4963
5209
|
}
|
|
4964
5210
|
}
|
|
4965
|
-
class
|
|
5211
|
+
class qs extends x {
|
|
4966
5212
|
/**
|
|
4967
5213
|
* Class constructor
|
|
4968
5214
|
*
|
|
@@ -4974,7 +5220,7 @@ class Us extends x {
|
|
|
4974
5220
|
super(e, t, n), this.name = "StackableUnitDecimalsException";
|
|
4975
5221
|
}
|
|
4976
5222
|
}
|
|
4977
|
-
class
|
|
5223
|
+
class We extends x {
|
|
4978
5224
|
/**
|
|
4979
5225
|
* Class constructor
|
|
4980
5226
|
*
|
|
@@ -4986,7 +5232,7 @@ class Te extends x {
|
|
|
4986
5232
|
super(e, t, n), this.name = "StackableUnitAmountException";
|
|
4987
5233
|
}
|
|
4988
5234
|
}
|
|
4989
|
-
class
|
|
5235
|
+
class je {
|
|
4990
5236
|
/**
|
|
4991
5237
|
*
|
|
4992
5238
|
* @param {UrqlClientWrapper} graphQLClient
|
|
@@ -5056,7 +5302,7 @@ class Ne {
|
|
|
5056
5302
|
return this.$__variables;
|
|
5057
5303
|
}
|
|
5058
5304
|
}
|
|
5059
|
-
class
|
|
5305
|
+
class Hs extends je {
|
|
5060
5306
|
constructor(e) {
|
|
5061
5307
|
super(e), this.$__subscribe = E`
|
|
5062
5308
|
subscription onCreateMolecule ( $bundle: String! ) {
|
|
@@ -5106,7 +5352,7 @@ class qs extends Ne {
|
|
|
5106
5352
|
`;
|
|
5107
5353
|
}
|
|
5108
5354
|
}
|
|
5109
|
-
class
|
|
5355
|
+
class Ps extends je {
|
|
5110
5356
|
constructor(e) {
|
|
5111
5357
|
super(e), this.$__subscribe = E`
|
|
5112
5358
|
subscription onWalletStatus ( $bundle: String!, $token: String! ) {
|
|
@@ -5120,7 +5366,7 @@ class Bs extends Ne {
|
|
|
5120
5366
|
`;
|
|
5121
5367
|
}
|
|
5122
5368
|
}
|
|
5123
|
-
class
|
|
5369
|
+
class Ks extends je {
|
|
5124
5370
|
constructor(e) {
|
|
5125
5371
|
super(e), this.$__subscribe = E`
|
|
5126
5372
|
subscription onActiveWallet ( $bundle: String! ) {
|
|
@@ -5163,7 +5409,7 @@ class Hs extends Ne {
|
|
|
5163
5409
|
`;
|
|
5164
5410
|
}
|
|
5165
5411
|
}
|
|
5166
|
-
class
|
|
5412
|
+
class Ns extends je {
|
|
5167
5413
|
constructor(e) {
|
|
5168
5414
|
super(e), this.$__subscribe = E`
|
|
5169
5415
|
subscription onActiveUser ( $metaType: String!, $metaId: String! ) {
|
|
@@ -5178,7 +5424,7 @@ class Ps extends Ne {
|
|
|
5178
5424
|
}`;
|
|
5179
5425
|
}
|
|
5180
5426
|
}
|
|
5181
|
-
class
|
|
5427
|
+
class Fs extends O {
|
|
5182
5428
|
/**
|
|
5183
5429
|
* Class constructor
|
|
5184
5430
|
*
|
|
@@ -5196,7 +5442,7 @@ class Ks extends W {
|
|
|
5196
5442
|
});
|
|
5197
5443
|
}
|
|
5198
5444
|
}
|
|
5199
|
-
class
|
|
5445
|
+
class Ls extends it {
|
|
5200
5446
|
/**
|
|
5201
5447
|
* @param {UrqlClientWrapper} graphQLClient
|
|
5202
5448
|
* @param {KnishIOClient} knishIOClient
|
|
@@ -5239,13 +5485,13 @@ class Ns extends et {
|
|
|
5239
5485
|
* @return {ResponseActiveSession}
|
|
5240
5486
|
*/
|
|
5241
5487
|
createResponse(e) {
|
|
5242
|
-
return new
|
|
5488
|
+
return new Fs({
|
|
5243
5489
|
query: this,
|
|
5244
5490
|
json: e
|
|
5245
5491
|
});
|
|
5246
5492
|
}
|
|
5247
5493
|
}
|
|
5248
|
-
class
|
|
5494
|
+
class js extends O {
|
|
5249
5495
|
/**
|
|
5250
5496
|
* Class constructor
|
|
5251
5497
|
*
|
|
@@ -5274,7 +5520,7 @@ class Ls extends W {
|
|
|
5274
5520
|
return t;
|
|
5275
5521
|
}
|
|
5276
5522
|
}
|
|
5277
|
-
class
|
|
5523
|
+
class Qs extends N {
|
|
5278
5524
|
/**
|
|
5279
5525
|
* @param {UrqlClientWrapper} graphQLClient
|
|
5280
5526
|
* @param {KnishIOClient} knishIOClient
|
|
@@ -5296,13 +5542,13 @@ class Fs extends N {
|
|
|
5296
5542
|
* @return {ResponseQueryActiveSession}
|
|
5297
5543
|
*/
|
|
5298
5544
|
createResponse(e) {
|
|
5299
|
-
return new
|
|
5545
|
+
return new js({
|
|
5300
5546
|
query: this,
|
|
5301
5547
|
json: e
|
|
5302
5548
|
});
|
|
5303
5549
|
}
|
|
5304
5550
|
}
|
|
5305
|
-
class
|
|
5551
|
+
class Ds extends O {
|
|
5306
5552
|
/**
|
|
5307
5553
|
* Class constructor
|
|
5308
5554
|
*
|
|
@@ -5327,7 +5573,7 @@ class js extends W {
|
|
|
5327
5573
|
return e;
|
|
5328
5574
|
}
|
|
5329
5575
|
}
|
|
5330
|
-
class
|
|
5576
|
+
class Vs extends N {
|
|
5331
5577
|
/**
|
|
5332
5578
|
* @param {UrqlClientWrapper} graphQLClient
|
|
5333
5579
|
* @param {KnishIOClient} knishIOClient
|
|
@@ -5415,13 +5661,13 @@ class Qs extends N {
|
|
|
5415
5661
|
* @return {ResponseQueryUserActivity}
|
|
5416
5662
|
*/
|
|
5417
5663
|
createResponse(e) {
|
|
5418
|
-
return new
|
|
5664
|
+
return new Ds({
|
|
5419
5665
|
query: this,
|
|
5420
5666
|
json: e
|
|
5421
5667
|
});
|
|
5422
5668
|
}
|
|
5423
5669
|
}
|
|
5424
|
-
class
|
|
5670
|
+
class zs extends N {
|
|
5425
5671
|
/**
|
|
5426
5672
|
* @param {UrqlClientWrapper} graphQLClient
|
|
5427
5673
|
* @param {KnishIOClient} knishIOClient
|
|
@@ -5445,14 +5691,14 @@ class Ds extends N {
|
|
|
5445
5691
|
* @returns {Response}
|
|
5446
5692
|
*/
|
|
5447
5693
|
createResponse(e) {
|
|
5448
|
-
return new
|
|
5694
|
+
return new O({
|
|
5449
5695
|
query: this,
|
|
5450
5696
|
json: e,
|
|
5451
5697
|
dataKey: "data.Token"
|
|
5452
5698
|
});
|
|
5453
5699
|
}
|
|
5454
5700
|
}
|
|
5455
|
-
class
|
|
5701
|
+
class xt extends x {
|
|
5456
5702
|
/**
|
|
5457
5703
|
* Class constructor
|
|
5458
5704
|
*
|
|
@@ -5464,7 +5710,7 @@ class St extends x {
|
|
|
5464
5710
|
super(e, t, n), this.name = "AuthorizationRejectedException";
|
|
5465
5711
|
}
|
|
5466
5712
|
}
|
|
5467
|
-
class
|
|
5713
|
+
class Js extends O {
|
|
5468
5714
|
/**
|
|
5469
5715
|
* Class constructor
|
|
5470
5716
|
*
|
|
@@ -5512,7 +5758,7 @@ class Vs extends W {
|
|
|
5512
5758
|
return t;
|
|
5513
5759
|
}
|
|
5514
5760
|
}
|
|
5515
|
-
class
|
|
5761
|
+
class It extends N {
|
|
5516
5762
|
/**
|
|
5517
5763
|
* @param {UrqlClientWrapper} graphQLClient
|
|
5518
5764
|
* @param {KnishIOClient} knishIOClient
|
|
@@ -5623,21 +5869,21 @@ class $t extends N {
|
|
|
5623
5869
|
tokenSlug: p,
|
|
5624
5870
|
cellSlugs: d,
|
|
5625
5871
|
cellSlug: w,
|
|
5626
|
-
batchIds:
|
|
5872
|
+
batchIds: A,
|
|
5627
5873
|
batchId: T,
|
|
5628
|
-
values:
|
|
5874
|
+
values: f,
|
|
5629
5875
|
value: y,
|
|
5630
5876
|
metaTypes: b,
|
|
5631
5877
|
metaType: M,
|
|
5632
5878
|
metaIds: k,
|
|
5633
|
-
metaId:
|
|
5879
|
+
metaId: $,
|
|
5634
5880
|
indexes: v,
|
|
5635
5881
|
index: I,
|
|
5636
|
-
filter:
|
|
5637
|
-
latest:
|
|
5638
|
-
queryArgs:
|
|
5882
|
+
filter: S,
|
|
5883
|
+
latest: B,
|
|
5884
|
+
queryArgs: W
|
|
5639
5885
|
}) {
|
|
5640
|
-
return t && (e = e || [], e.push(t)), s && (n = n || [], n.push(s)), i && (r = r || [], r.push(i)), c && (a = a || [], a.push(c)), l && (u = u || [], u.push(l)), p && (h = h || [], h.push(p)), w && (d = d || [], d.push(w)), T && (
|
|
5886
|
+
return t && (e = e || [], e.push(t)), s && (n = n || [], n.push(s)), i && (r = r || [], r.push(i)), c && (a = a || [], a.push(c)), l && (u = u || [], u.push(l)), p && (h = h || [], h.push(p)), w && (d = d || [], d.push(w)), T && (A = A || [], A.push(T)), y && (f = f || [], f.push(y)), M && (b = b || [], b.push(M)), $ && (k = k || [], k.push($)), I && (v = v || [], v.push(I)), {
|
|
5641
5887
|
molecularHashes: e,
|
|
5642
5888
|
bundleHashes: n,
|
|
5643
5889
|
positions: r,
|
|
@@ -5645,14 +5891,14 @@ class $t extends N {
|
|
|
5645
5891
|
isotopes: u,
|
|
5646
5892
|
tokenSlugs: h,
|
|
5647
5893
|
cellSlugs: d,
|
|
5648
|
-
batchIds:
|
|
5649
|
-
values:
|
|
5894
|
+
batchIds: A,
|
|
5895
|
+
values: f,
|
|
5650
5896
|
metaTypes: b,
|
|
5651
5897
|
metaIds: k,
|
|
5652
5898
|
indexes: v,
|
|
5653
|
-
filter:
|
|
5654
|
-
latest:
|
|
5655
|
-
queryArgs:
|
|
5899
|
+
filter: S,
|
|
5900
|
+
latest: B,
|
|
5901
|
+
queryArgs: W
|
|
5656
5902
|
};
|
|
5657
5903
|
}
|
|
5658
5904
|
/**
|
|
@@ -5662,13 +5908,13 @@ class $t extends N {
|
|
|
5662
5908
|
* @return {ResponseAtom}
|
|
5663
5909
|
*/
|
|
5664
5910
|
createResponse(e) {
|
|
5665
|
-
return new
|
|
5911
|
+
return new Js({
|
|
5666
5912
|
query: this,
|
|
5667
5913
|
json: e
|
|
5668
5914
|
});
|
|
5669
5915
|
}
|
|
5670
5916
|
}
|
|
5671
|
-
class
|
|
5917
|
+
class Gs extends O {
|
|
5672
5918
|
/**
|
|
5673
5919
|
* Class constructor
|
|
5674
5920
|
*
|
|
@@ -5693,7 +5939,7 @@ class zs extends W {
|
|
|
5693
5939
|
return e && e.callback ? JSON.parse(e.callback) : null;
|
|
5694
5940
|
}
|
|
5695
5941
|
}
|
|
5696
|
-
class
|
|
5942
|
+
class Xs extends N {
|
|
5697
5943
|
/**
|
|
5698
5944
|
* @param {UrqlClientWrapper} graphQLClient
|
|
5699
5945
|
* @param {KnishIOClient} knishIOClient
|
|
@@ -5719,13 +5965,13 @@ class Js extends N {
|
|
|
5719
5965
|
* @return {ResponsePolicy}
|
|
5720
5966
|
*/
|
|
5721
5967
|
createResponse(e) {
|
|
5722
|
-
return new
|
|
5968
|
+
return new Gs({
|
|
5723
5969
|
query: this,
|
|
5724
5970
|
json: e
|
|
5725
5971
|
});
|
|
5726
5972
|
}
|
|
5727
5973
|
}
|
|
5728
|
-
class
|
|
5974
|
+
class Zs extends O {
|
|
5729
5975
|
/**
|
|
5730
5976
|
* Class constructor
|
|
5731
5977
|
*
|
|
@@ -5754,7 +6000,7 @@ class Gs extends W {
|
|
|
5754
6000
|
return n.instances && (t.instances = n.instances), n.instanceCount && (t.instanceCount = n.instanceCount), n.paginatorInfo && (t.paginatorInfo = n.paginatorInfo), t;
|
|
5755
6001
|
}
|
|
5756
6002
|
}
|
|
5757
|
-
class
|
|
6003
|
+
class Tt extends N {
|
|
5758
6004
|
/**
|
|
5759
6005
|
* @param {UrqlClientWrapper} graphQLClient
|
|
5760
6006
|
* @param {KnishIOClient} knishIOClient
|
|
@@ -5840,15 +6086,229 @@ class At extends N {
|
|
|
5840
6086
|
* @return {ResponseMetaTypeViaAtom}
|
|
5841
6087
|
*/
|
|
5842
6088
|
createResponse(e) {
|
|
5843
|
-
return new
|
|
6089
|
+
return new Zs({
|
|
5844
6090
|
query: this,
|
|
5845
6091
|
json: e
|
|
5846
6092
|
});
|
|
5847
6093
|
}
|
|
5848
6094
|
}
|
|
5849
|
-
class
|
|
6095
|
+
class ot extends O {
|
|
6096
|
+
/**
|
|
6097
|
+
* Class constructor
|
|
6098
|
+
*
|
|
6099
|
+
* @param {Query} query
|
|
6100
|
+
* @param {object} json
|
|
6101
|
+
*/
|
|
6102
|
+
constructor({
|
|
6103
|
+
query: e,
|
|
6104
|
+
json: t
|
|
6105
|
+
}) {
|
|
6106
|
+
super({
|
|
6107
|
+
query: e,
|
|
6108
|
+
json: t,
|
|
6109
|
+
dataKey: "data.MetaTypeViaAtom"
|
|
6110
|
+
});
|
|
6111
|
+
}
|
|
6112
|
+
/**
|
|
6113
|
+
* Extracts metas from a molecule's atoms' metasJson for a specific instance.
|
|
6114
|
+
* Filters atoms by matching metaType and metaId, then parses metasJson.
|
|
6115
|
+
*
|
|
6116
|
+
* @param {object} molecule - Molecule data with atoms array
|
|
6117
|
+
* @param {string} metaType - Instance meta type to filter by
|
|
6118
|
+
* @param {string} metaId - Instance meta ID to filter by
|
|
6119
|
+
* @return {Array<{molecularHash: string, position: string, key: string, value: string, createdAt: string}>}
|
|
6120
|
+
*/
|
|
6121
|
+
static extractMetasFromMolecule(e, t, n) {
|
|
6122
|
+
if (!e || !e.atoms)
|
|
6123
|
+
return [];
|
|
6124
|
+
const s = [];
|
|
6125
|
+
for (const r of e.atoms) {
|
|
6126
|
+
if (r.metaType !== t || r.metaId !== n || !r.metasJson)
|
|
6127
|
+
continue;
|
|
6128
|
+
let i;
|
|
6129
|
+
try {
|
|
6130
|
+
if (i = JSON.parse(r.metasJson), !Array.isArray(i))
|
|
6131
|
+
continue;
|
|
6132
|
+
} catch {
|
|
6133
|
+
continue;
|
|
6134
|
+
}
|
|
6135
|
+
for (const a of i)
|
|
6136
|
+
s.push({
|
|
6137
|
+
molecularHash: e.molecularHash,
|
|
6138
|
+
position: r.position,
|
|
6139
|
+
key: a.key,
|
|
6140
|
+
value: a.value,
|
|
6141
|
+
createdAt: r.createdAt
|
|
6142
|
+
});
|
|
6143
|
+
}
|
|
6144
|
+
return s;
|
|
6145
|
+
}
|
|
6146
|
+
/**
|
|
6147
|
+
* Returns meta type instance results with metas synthesized from molecule data.
|
|
6148
|
+
* Produces the same payload format as ResponseMetaType and ResponseMetaTypeViaAtom:
|
|
6149
|
+
* { instances, instanceCount, paginatorInfo }
|
|
6150
|
+
*
|
|
6151
|
+
* @return {null|{instances: Array, instanceCount: Array, paginatorInfo: object}}
|
|
6152
|
+
*/
|
|
6153
|
+
payload() {
|
|
6154
|
+
const e = this.data();
|
|
6155
|
+
if (!e || e.length === 0)
|
|
6156
|
+
return null;
|
|
6157
|
+
const t = {
|
|
6158
|
+
instances: {},
|
|
6159
|
+
instanceCount: {},
|
|
6160
|
+
paginatorInfo: {}
|
|
6161
|
+
}, n = e.pop();
|
|
6162
|
+
return n.instances && (t.instances = n.instances.map((s) => {
|
|
6163
|
+
let r = s.metas;
|
|
6164
|
+
return (!r || r.length === 0) && (r = ot.extractMetasFromMolecule(
|
|
6165
|
+
s.molecule,
|
|
6166
|
+
s.metaType,
|
|
6167
|
+
s.metaId
|
|
6168
|
+
)), {
|
|
6169
|
+
...s,
|
|
6170
|
+
metas: r
|
|
6171
|
+
};
|
|
6172
|
+
})), n.instanceCount && (t.instanceCount = n.instanceCount), n.paginatorInfo && (t.paginatorInfo = n.paginatorInfo), t;
|
|
6173
|
+
}
|
|
6174
|
+
/**
|
|
6175
|
+
* Verifies the cryptographic integrity of all molecules associated
|
|
6176
|
+
* with meta instances in this response. For each instance, reconstructs
|
|
6177
|
+
* the molecule from server data and runs CheckMolecule.verify() to validate
|
|
6178
|
+
* the molecular hash and OTS signature.
|
|
6179
|
+
*
|
|
6180
|
+
* @return {{ verified: boolean, molecules: Array<{ molecularHash: string, verified: boolean, error: string|null }> }}
|
|
6181
|
+
*/
|
|
6182
|
+
verifyIntegrity() {
|
|
6183
|
+
var s;
|
|
6184
|
+
const e = [], t = this.data();
|
|
6185
|
+
if (!t || t.length === 0)
|
|
6186
|
+
return { verified: !0, molecules: e };
|
|
6187
|
+
const n = ((s = t[t.length - 1]) == null ? void 0 : s.instances) || [];
|
|
6188
|
+
for (const r of n)
|
|
6189
|
+
r.molecule && e.push(ve.verifyFromServerData(r.molecule));
|
|
6190
|
+
return {
|
|
6191
|
+
verified: e.length === 0 || e.every((r) => r.verified),
|
|
6192
|
+
molecules: e
|
|
6193
|
+
};
|
|
6194
|
+
}
|
|
5850
6195
|
}
|
|
5851
|
-
class
|
|
6196
|
+
class Mt extends N {
|
|
6197
|
+
/**
|
|
6198
|
+
* @param {UrqlClientWrapper} graphQLClient
|
|
6199
|
+
* @param {KnishIOClient} knishIOClient
|
|
6200
|
+
*/
|
|
6201
|
+
constructor(e, t) {
|
|
6202
|
+
super(e, t), this.$__query = E`query ($metaTypes: [String!], $metaIds: [String!], $values: [String!], $keys: [String!], $latest: Boolean, $filter: [MetaFilter!], $queryArgs: QueryArgs, $countBy: String, $atomValues: [String!], $cellSlugs: [String!] ) {
|
|
6203
|
+
MetaTypeViaAtom(
|
|
6204
|
+
metaTypes: $metaTypes
|
|
6205
|
+
metaIds: $metaIds
|
|
6206
|
+
atomValues: $atomValues
|
|
6207
|
+
cellSlugs: $cellSlugs
|
|
6208
|
+
filter: $filter,
|
|
6209
|
+
latest: $latest,
|
|
6210
|
+
queryArgs: $queryArgs
|
|
6211
|
+
countBy: $countBy
|
|
6212
|
+
) {
|
|
6213
|
+
metaType,
|
|
6214
|
+
instanceCount {
|
|
6215
|
+
key,
|
|
6216
|
+
value
|
|
6217
|
+
},
|
|
6218
|
+
instances {
|
|
6219
|
+
metaType,
|
|
6220
|
+
metaId,
|
|
6221
|
+
createdAt,
|
|
6222
|
+
metas( values: $values, keys: $keys ) {
|
|
6223
|
+
molecularHash,
|
|
6224
|
+
position,
|
|
6225
|
+
key,
|
|
6226
|
+
value,
|
|
6227
|
+
createdAt
|
|
6228
|
+
},
|
|
6229
|
+
molecule {
|
|
6230
|
+
molecularHash,
|
|
6231
|
+
bundleHash,
|
|
6232
|
+
cellSlug,
|
|
6233
|
+
status,
|
|
6234
|
+
createdAt,
|
|
6235
|
+
atoms {
|
|
6236
|
+
position,
|
|
6237
|
+
walletAddress,
|
|
6238
|
+
isotope,
|
|
6239
|
+
tokenSlug,
|
|
6240
|
+
value,
|
|
6241
|
+
batchId,
|
|
6242
|
+
metaType,
|
|
6243
|
+
metaId,
|
|
6244
|
+
index,
|
|
6245
|
+
createdAt,
|
|
6246
|
+
otsFragment,
|
|
6247
|
+
metasJson
|
|
6248
|
+
}
|
|
6249
|
+
}
|
|
6250
|
+
},
|
|
6251
|
+
paginatorInfo {
|
|
6252
|
+
currentPage,
|
|
6253
|
+
total
|
|
6254
|
+
}
|
|
6255
|
+
}
|
|
6256
|
+
}`;
|
|
6257
|
+
}
|
|
6258
|
+
/**
|
|
6259
|
+
* Builds a GraphQL-friendly variables object based on input fields
|
|
6260
|
+
*
|
|
6261
|
+
* @param {string|array|null} metaType
|
|
6262
|
+
* @param {string|array|null} metaId
|
|
6263
|
+
* @param {string|null} key
|
|
6264
|
+
* @param {string|null} value
|
|
6265
|
+
* @param {array|null} values
|
|
6266
|
+
* @param {array|null} keys
|
|
6267
|
+
* @param {array|null} atomValues
|
|
6268
|
+
* @param {boolean|null} latest
|
|
6269
|
+
* @param {array|null} filter
|
|
6270
|
+
* @param {object|null} queryArgs
|
|
6271
|
+
* @param {string|null} countBy
|
|
6272
|
+
* @param {string|null} cellSlug
|
|
6273
|
+
* @return {{}}
|
|
6274
|
+
*/
|
|
6275
|
+
static createVariables({
|
|
6276
|
+
metaType: e = null,
|
|
6277
|
+
metaId: t = null,
|
|
6278
|
+
key: n = null,
|
|
6279
|
+
value: s = null,
|
|
6280
|
+
keys: r = null,
|
|
6281
|
+
values: i = null,
|
|
6282
|
+
atomValues: a = null,
|
|
6283
|
+
latest: c = null,
|
|
6284
|
+
filter: u = null,
|
|
6285
|
+
queryArgs: l = null,
|
|
6286
|
+
countBy: h = null,
|
|
6287
|
+
cellSlug: p = null
|
|
6288
|
+
}) {
|
|
6289
|
+
const d = {};
|
|
6290
|
+
return a && (d.atomValues = a), r && (d.keys = r), i && (d.values = i), e && (d.metaTypes = typeof e == "string" ? [e] : e), t && (d.metaIds = typeof t == "string" ? [t] : t), p && (d.cellSlugs = typeof p == "string" ? [p] : p), h && (d.countBy = h), u && (d.filter = u), n && s && (d.filter = d.filter || [], d.filter.push({
|
|
6291
|
+
key: n,
|
|
6292
|
+
value: s,
|
|
6293
|
+
comparison: "="
|
|
6294
|
+
})), d.latest = c === !0, l && ((typeof l.limit > "u" || l.limit === 0) && (l.limit = "*"), d.queryArgs = l), d;
|
|
6295
|
+
}
|
|
6296
|
+
/**
|
|
6297
|
+
* Returns a Response object
|
|
6298
|
+
*
|
|
6299
|
+
* @param {object} json
|
|
6300
|
+
* @return {ResponseMetaTypeViaMolecule}
|
|
6301
|
+
*/
|
|
6302
|
+
createResponse(e) {
|
|
6303
|
+
return new ot({
|
|
6304
|
+
query: this,
|
|
6305
|
+
json: e
|
|
6306
|
+
});
|
|
6307
|
+
}
|
|
6308
|
+
}
|
|
6309
|
+
class Ys extends V {
|
|
6310
|
+
}
|
|
6311
|
+
class er extends U {
|
|
5852
6312
|
/**
|
|
5853
6313
|
*
|
|
5854
6314
|
* @param {string} metaType
|
|
@@ -5876,13 +6336,13 @@ class Zs extends U {
|
|
|
5876
6336
|
* @return {ResponseCreateRule}
|
|
5877
6337
|
*/
|
|
5878
6338
|
createResponse(e) {
|
|
5879
|
-
return new
|
|
6339
|
+
return new Ys({
|
|
5880
6340
|
query: this,
|
|
5881
6341
|
json: e
|
|
5882
6342
|
});
|
|
5883
6343
|
}
|
|
5884
6344
|
}
|
|
5885
|
-
class
|
|
6345
|
+
class tr extends U {
|
|
5886
6346
|
/**
|
|
5887
6347
|
* Fills the Molecule with provided wallet and amount data
|
|
5888
6348
|
*
|
|
@@ -5899,7 +6359,7 @@ class Ys extends U {
|
|
|
5899
6359
|
}), this.$__molecule.sign({}), this.$__molecule.check(this.$__molecule.sourceWallet);
|
|
5900
6360
|
}
|
|
5901
6361
|
}
|
|
5902
|
-
class
|
|
6362
|
+
class nr extends U {
|
|
5903
6363
|
/**
|
|
5904
6364
|
*
|
|
5905
6365
|
* @param recipients
|
|
@@ -5999,10 +6459,10 @@ function Z(o, e) {
|
|
|
5999
6459
|
};
|
|
6000
6460
|
}
|
|
6001
6461
|
}
|
|
6002
|
-
var R = { exclude: [], include: [], logging: !0 },
|
|
6003
|
-
typeof window < "u" && (
|
|
6004
|
-
},
|
|
6005
|
-
return Object.fromEntries(Object.entries(
|
|
6462
|
+
var R = { exclude: [], include: [], logging: !0 }, zt = {}, sr = { timeout: "true" }, J = function(o, e) {
|
|
6463
|
+
typeof window < "u" && (zt[o] = e);
|
|
6464
|
+
}, rr = function() {
|
|
6465
|
+
return Object.fromEntries(Object.entries(zt).filter((function(o) {
|
|
6006
6466
|
var e, t = o[0];
|
|
6007
6467
|
return !(!((e = R == null ? void 0 : R.exclude) === null || e === void 0) && e.includes(t));
|
|
6008
6468
|
})).filter((function(o) {
|
|
@@ -6016,21 +6476,21 @@ var R = { exclude: [], include: [], logging: !0 }, Ft = {}, tr = { timeout: "tru
|
|
|
6016
6476
|
return [o[0], (0, o[1])()];
|
|
6017
6477
|
})));
|
|
6018
6478
|
};
|
|
6019
|
-
function
|
|
6479
|
+
function Re(o) {
|
|
6020
6480
|
return o ^= o >>> 16, o = Math.imul(o, 2246822507), o ^= o >>> 13, o = Math.imul(o, 3266489909), (o ^= o >>> 16) >>> 0;
|
|
6021
6481
|
}
|
|
6022
|
-
var
|
|
6023
|
-
function
|
|
6482
|
+
var q = new Uint32Array([597399067, 2869860233, 951274213, 2716044179]);
|
|
6483
|
+
function Q(o, e) {
|
|
6024
6484
|
return o << e | o >>> 32 - e;
|
|
6025
6485
|
}
|
|
6026
|
-
function
|
|
6486
|
+
function at(o, e) {
|
|
6027
6487
|
var t;
|
|
6028
6488
|
if (e === void 0 && (e = 0), e = e ? 0 | e : 0, typeof o == "string" && (t = o, o = new TextEncoder().encode(t).buffer), !(o instanceof ArrayBuffer)) throw new TypeError("Expected key to be ArrayBuffer or string");
|
|
6029
6489
|
var n = new Uint32Array([e, e, e, e]);
|
|
6030
6490
|
(function(r, i) {
|
|
6031
6491
|
for (var a = r.byteLength / 16 | 0, c = new Uint32Array(r, 0, 4 * a), u = 0; u < a; u++) {
|
|
6032
6492
|
var l = c.subarray(4 * u, 4 * (u + 1));
|
|
6033
|
-
l[0] = Math.imul(l[0],
|
|
6493
|
+
l[0] = Math.imul(l[0], q[0]), l[0] = Q(l[0], 15), l[0] = Math.imul(l[0], q[1]), i[0] = i[0] ^ l[0], i[0] = Q(i[0], 19), i[0] = i[0] + i[1], i[0] = Math.imul(i[0], 5) + 1444728091, l[1] = Math.imul(l[1], q[1]), l[1] = Q(l[1], 16), l[1] = Math.imul(l[1], q[2]), i[1] = i[1] ^ l[1], i[1] = Q(i[1], 17), i[1] = i[1] + i[2], i[1] = Math.imul(i[1], 5) + 197830471, l[2] = Math.imul(l[2], q[2]), l[2] = Q(l[2], 17), l[2] = Math.imul(l[2], q[3]), i[2] = i[2] ^ l[2], i[2] = Q(i[2], 15), i[2] = i[2] + i[3], i[2] = Math.imul(i[2], 5) + 2530024501, l[3] = Math.imul(l[3], q[3]), l[3] = Q(l[3], 18), l[3] = Math.imul(l[3], q[0]), i[3] = i[3] ^ l[3], i[3] = Q(i[3], 13), i[3] = i[3] + i[0], i[3] = Math.imul(i[3], 5) + 850148119;
|
|
6034
6494
|
}
|
|
6035
6495
|
})(o, n), (function(r, i) {
|
|
6036
6496
|
var a = r.byteLength / 16 | 0, c = r.byteLength % 16, u = new Uint32Array(4), l = new Uint8Array(r, 16 * a, c);
|
|
@@ -6040,7 +6500,7 @@ function tt(o, e) {
|
|
|
6040
6500
|
case 14:
|
|
6041
6501
|
u[3] = u[3] ^ l[13] << 8;
|
|
6042
6502
|
case 13:
|
|
6043
|
-
u[3] = u[3] ^ l[12] << 0, u[3] = Math.imul(u[3],
|
|
6503
|
+
u[3] = u[3] ^ l[12] << 0, u[3] = Math.imul(u[3], q[3]), u[3] = Q(u[3], 18), u[3] = Math.imul(u[3], q[0]), i[3] = i[3] ^ u[3];
|
|
6044
6504
|
case 12:
|
|
6045
6505
|
u[2] = u[2] ^ l[11] << 24;
|
|
6046
6506
|
case 11:
|
|
@@ -6048,7 +6508,7 @@ function tt(o, e) {
|
|
|
6048
6508
|
case 10:
|
|
6049
6509
|
u[2] = u[2] ^ l[9] << 8;
|
|
6050
6510
|
case 9:
|
|
6051
|
-
u[2] = u[2] ^ l[8] << 0, u[2] = Math.imul(u[2],
|
|
6511
|
+
u[2] = u[2] ^ l[8] << 0, u[2] = Math.imul(u[2], q[2]), u[2] = Q(u[2], 17), u[2] = Math.imul(u[2], q[3]), i[2] = i[2] ^ u[2];
|
|
6052
6512
|
case 8:
|
|
6053
6513
|
u[1] = u[1] ^ l[7] << 24;
|
|
6054
6514
|
case 7:
|
|
@@ -6056,7 +6516,7 @@ function tt(o, e) {
|
|
|
6056
6516
|
case 6:
|
|
6057
6517
|
u[1] = u[1] ^ l[5] << 8;
|
|
6058
6518
|
case 5:
|
|
6059
|
-
u[1] = u[1] ^ l[4] << 0, u[1] = Math.imul(u[1],
|
|
6519
|
+
u[1] = u[1] ^ l[4] << 0, u[1] = Math.imul(u[1], q[1]), u[1] = Q(u[1], 16), u[1] = Math.imul(u[1], q[2]), i[1] = i[1] ^ u[1];
|
|
6060
6520
|
case 4:
|
|
6061
6521
|
u[0] = u[0] ^ l[3] << 24;
|
|
6062
6522
|
case 3:
|
|
@@ -6064,45 +6524,45 @@ function tt(o, e) {
|
|
|
6064
6524
|
case 2:
|
|
6065
6525
|
u[0] = u[0] ^ l[1] << 8;
|
|
6066
6526
|
case 1:
|
|
6067
|
-
u[0] = u[0] ^ l[0] << 0, u[0] = Math.imul(u[0],
|
|
6527
|
+
u[0] = u[0] ^ l[0] << 0, u[0] = Math.imul(u[0], q[0]), u[0] = Q(u[0], 15), u[0] = Math.imul(u[0], q[1]), i[0] = i[0] ^ u[0];
|
|
6068
6528
|
}
|
|
6069
6529
|
})(o, n), (function(r, i) {
|
|
6070
|
-
i[0] = i[0] ^ r.byteLength, i[1] = i[1] ^ r.byteLength, i[2] = i[2] ^ r.byteLength, i[3] = i[3] ^ r.byteLength, i[0] = i[0] + i[1] | 0, i[0] = i[0] + i[2] | 0, i[0] = i[0] + i[3] | 0, i[1] = i[1] + i[0] | 0, i[2] = i[2] + i[0] | 0, i[3] = i[3] + i[0] | 0, i[0] =
|
|
6530
|
+
i[0] = i[0] ^ r.byteLength, i[1] = i[1] ^ r.byteLength, i[2] = i[2] ^ r.byteLength, i[3] = i[3] ^ r.byteLength, i[0] = i[0] + i[1] | 0, i[0] = i[0] + i[2] | 0, i[0] = i[0] + i[3] | 0, i[1] = i[1] + i[0] | 0, i[2] = i[2] + i[0] | 0, i[3] = i[3] + i[0] | 0, i[0] = Re(i[0]), i[1] = Re(i[1]), i[2] = Re(i[2]), i[3] = Re(i[3]), i[0] = i[0] + i[1] | 0, i[0] = i[0] + i[2] | 0, i[0] = i[0] + i[3] | 0, i[1] = i[1] + i[0] | 0, i[2] = i[2] + i[0] | 0, i[3] = i[3] + i[0] | 0;
|
|
6071
6531
|
})(o, n);
|
|
6072
6532
|
var s = new Uint8Array(n.buffer);
|
|
6073
6533
|
return Array.from(s).map((function(r) {
|
|
6074
6534
|
return r.toString(16).padStart(2, "0");
|
|
6075
6535
|
})).join("");
|
|
6076
6536
|
}
|
|
6077
|
-
function
|
|
6537
|
+
function ir(o, e) {
|
|
6078
6538
|
return new Promise((function(t) {
|
|
6079
6539
|
setTimeout((function() {
|
|
6080
6540
|
return t(e);
|
|
6081
6541
|
}), o);
|
|
6082
6542
|
}));
|
|
6083
6543
|
}
|
|
6084
|
-
function
|
|
6544
|
+
function or(o, e, t) {
|
|
6085
6545
|
return Promise.all(o.map((function(n) {
|
|
6086
|
-
return Promise.race([n,
|
|
6546
|
+
return Promise.race([n, ir(e, t)]);
|
|
6087
6547
|
})));
|
|
6088
6548
|
}
|
|
6089
|
-
var
|
|
6090
|
-
function
|
|
6091
|
-
return
|
|
6549
|
+
var ar = "0.19.1";
|
|
6550
|
+
function lr() {
|
|
6551
|
+
return ar;
|
|
6092
6552
|
}
|
|
6093
|
-
function
|
|
6553
|
+
function Jt() {
|
|
6094
6554
|
return X(this, void 0, void 0, (function() {
|
|
6095
6555
|
var o, e, t, n, s;
|
|
6096
6556
|
return Z(this, (function(r) {
|
|
6097
6557
|
switch (r.label) {
|
|
6098
6558
|
case 0:
|
|
6099
|
-
return r.trys.push([0, 2, , 3]), o =
|
|
6559
|
+
return r.trys.push([0, 2, , 3]), o = rr(), e = Object.keys(o), [4, or(Object.values(o), (R == null ? void 0 : R.timeout) || 1e3, sr)];
|
|
6100
6560
|
case 1:
|
|
6101
6561
|
return t = r.sent(), n = t.filter((function(i) {
|
|
6102
6562
|
return i !== void 0;
|
|
6103
6563
|
})), s = {}, n.forEach((function(i, a) {
|
|
6104
6564
|
s[e[a]] = i;
|
|
6105
|
-
})), [2,
|
|
6565
|
+
})), [2, Gt(s, R.exclude || [], R.include || [], "")];
|
|
6106
6566
|
case 2:
|
|
6107
6567
|
throw r.sent();
|
|
6108
6568
|
case 3:
|
|
@@ -6111,19 +6571,19 @@ function jt() {
|
|
|
6111
6571
|
}));
|
|
6112
6572
|
}));
|
|
6113
6573
|
}
|
|
6114
|
-
function
|
|
6574
|
+
function Gt(o, e, t, n) {
|
|
6115
6575
|
n === void 0 && (n = "");
|
|
6116
6576
|
for (var s = {}, r = function(u, l) {
|
|
6117
6577
|
var h = n + u + ".";
|
|
6118
6578
|
if (typeof l != "object" || Array.isArray(l)) {
|
|
6119
|
-
var p = e.some((function(
|
|
6120
|
-
return h.startsWith(
|
|
6121
|
-
})), d = t.some((function(
|
|
6122
|
-
return h.startsWith(
|
|
6579
|
+
var p = e.some((function(A) {
|
|
6580
|
+
return h.startsWith(A);
|
|
6581
|
+
})), d = t.some((function(A) {
|
|
6582
|
+
return h.startsWith(A);
|
|
6123
6583
|
}));
|
|
6124
6584
|
p && !d || (s[u] = l);
|
|
6125
6585
|
} else {
|
|
6126
|
-
var w =
|
|
6586
|
+
var w = Gt(l, e, t, h);
|
|
6127
6587
|
Object.keys(w).length > 0 && (s[u] = w);
|
|
6128
6588
|
}
|
|
6129
6589
|
}, i = 0, a = Object.entries(o); i < a.length; i++) {
|
|
@@ -6132,21 +6592,21 @@ function Qt(o, e, t, n) {
|
|
|
6132
6592
|
}
|
|
6133
6593
|
return s;
|
|
6134
6594
|
}
|
|
6135
|
-
function
|
|
6595
|
+
function cr(o) {
|
|
6136
6596
|
return X(this, void 0, void 0, (function() {
|
|
6137
6597
|
var e, t;
|
|
6138
6598
|
return Z(this, (function(n) {
|
|
6139
6599
|
switch (n.label) {
|
|
6140
6600
|
case 0:
|
|
6141
|
-
return n.trys.push([0, 2, , 3]), [4,
|
|
6601
|
+
return n.trys.push([0, 2, , 3]), [4, Jt()];
|
|
6142
6602
|
case 1:
|
|
6143
|
-
return e = n.sent(), t =
|
|
6603
|
+
return e = n.sent(), t = at(JSON.stringify(e)), Math.random() < 1e-3 && R.logging && (function(s, r) {
|
|
6144
6604
|
X(this, void 0, void 0, (function() {
|
|
6145
6605
|
var i, a;
|
|
6146
6606
|
return Z(this, (function(c) {
|
|
6147
6607
|
switch (c.label) {
|
|
6148
6608
|
case 0:
|
|
6149
|
-
if (i = "https://logging.thumbmarkjs.com/v1/log", a = { thumbmark: s, components: r, version:
|
|
6609
|
+
if (i = "https://logging.thumbmarkjs.com/v1/log", a = { thumbmark: s, components: r, version: lr() }, sessionStorage.getItem("_tmjs_l")) return [3, 4];
|
|
6150
6610
|
sessionStorage.setItem("_tmjs_l", "1"), c.label = 1;
|
|
6151
6611
|
case 1:
|
|
6152
6612
|
return c.trys.push([1, 3, , 4]), [4, fetch(i, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(a) })];
|
|
@@ -6167,19 +6627,19 @@ function ar(o) {
|
|
|
6167
6627
|
}));
|
|
6168
6628
|
}));
|
|
6169
6629
|
}
|
|
6170
|
-
function
|
|
6630
|
+
function ur(o) {
|
|
6171
6631
|
for (var e = 0, t = 0; t < o.length; ++t) e += Math.abs(o[t]);
|
|
6172
6632
|
return e;
|
|
6173
6633
|
}
|
|
6174
|
-
function
|
|
6634
|
+
function Xt(o, e, t) {
|
|
6175
6635
|
for (var n = [], s = 0; s < o[0].data.length; s++) {
|
|
6176
6636
|
for (var r = [], i = 0; i < o.length; i++) r.push(o[i].data[s]);
|
|
6177
|
-
n.push(
|
|
6637
|
+
n.push(hr(r));
|
|
6178
6638
|
}
|
|
6179
6639
|
var a = new Uint8ClampedArray(n);
|
|
6180
6640
|
return new ImageData(a, e, t);
|
|
6181
6641
|
}
|
|
6182
|
-
function
|
|
6642
|
+
function hr(o) {
|
|
6183
6643
|
if (o.length === 0) return 0;
|
|
6184
6644
|
for (var e = {}, t = 0, n = o; t < n.length; t++)
|
|
6185
6645
|
e[r = n[t]] = (e[r] || 0) + 1;
|
|
@@ -6187,7 +6647,7 @@ function cr(o) {
|
|
|
6187
6647
|
for (var r in e) e[r] > e[s] && (s = parseInt(r, 10));
|
|
6188
6648
|
return s;
|
|
6189
6649
|
}
|
|
6190
|
-
function
|
|
6650
|
+
function Te() {
|
|
6191
6651
|
if (typeof navigator > "u") return { name: "unknown", version: "unknown" };
|
|
6192
6652
|
for (var o = navigator.userAgent, e = { Edg: "Edge", OPR: "Opera" }, t = 0, n = [/(?<name>Edge|Edg)\/(?<version>\d+(?:\.\d+)?)/, /(?<name>(?:Chrome|Chromium|OPR|Opera|Vivaldi|Brave))\/(?<version>\d+(?:\.\d+)?)/, /(?<name>(?:Firefox|Waterfox|Iceweasel|IceCat))\/(?<version>\d+(?:\.\d+)?)/, /(?<name>Safari)\/(?<version>\d+(?:\.\d+)?)/, /(?<name>MSIE|Trident|IEMobile).+?(?<version>\d+(?:\.\d+)?)/, /(?<name>[A-Za-z]+)\/(?<version>\d+(?:\.\d+)?)/, /(?<name>SamsungBrowser)\/(?<version>\d+(?:\.\d+)?)/]; t < n.length; t++) {
|
|
6193
6653
|
var s = n[t], r = o.match(s);
|
|
@@ -6195,7 +6655,7 @@ function ve() {
|
|
|
6195
6655
|
}
|
|
6196
6656
|
return { name: "unknown", version: "unknown" };
|
|
6197
6657
|
}
|
|
6198
|
-
|
|
6658
|
+
J("audio", (function() {
|
|
6199
6659
|
return X(this, void 0, void 0, (function() {
|
|
6200
6660
|
return Z(this, (function(o) {
|
|
6201
6661
|
return [2, new Promise((function(e, t) {
|
|
@@ -6204,7 +6664,7 @@ z("audio", (function() {
|
|
|
6204
6664
|
r.frequency.value = 1e3;
|
|
6205
6665
|
var i, a = n.createDynamicsCompressor();
|
|
6206
6666
|
a.threshold.value = -50, a.knee.value = 40, a.ratio.value = 12, a.attack.value = 0, a.release.value = 0.2, r.connect(a), a.connect(n.destination), r.start(), n.oncomplete = function(c) {
|
|
6207
|
-
i = c.renderedBuffer.getChannelData(0), e({ sampleHash:
|
|
6667
|
+
i = c.renderedBuffer.getChannelData(0), e({ sampleHash: ur(i), oscillator: r.type, maxChannels: n.destination.maxChannelCount, channelCountMode: s.channelCountMode });
|
|
6208
6668
|
}, n.startRendering();
|
|
6209
6669
|
} catch (c) {
|
|
6210
6670
|
console.error("Error creating audio fingerprint:", c), t(c);
|
|
@@ -6213,14 +6673,14 @@ z("audio", (function() {
|
|
|
6213
6673
|
}));
|
|
6214
6674
|
}));
|
|
6215
6675
|
}));
|
|
6216
|
-
var
|
|
6217
|
-
|
|
6676
|
+
var dr = Te().name !== "SamsungBrowser" ? 1 : 3, Ct = 280, Et = 20;
|
|
6677
|
+
Te().name != "Firefox" && J("canvas", (function() {
|
|
6218
6678
|
return document.createElement("canvas").getContext("2d"), new Promise((function(o) {
|
|
6219
|
-
var e = Array.from({ length:
|
|
6679
|
+
var e = Array.from({ length: dr }, (function() {
|
|
6220
6680
|
return (function() {
|
|
6221
6681
|
var t = document.createElement("canvas"), n = t.getContext("2d");
|
|
6222
6682
|
if (!n) return new ImageData(1, 1);
|
|
6223
|
-
t.width =
|
|
6683
|
+
t.width = Ct, t.height = Et;
|
|
6224
6684
|
var s = n.createLinearGradient(0, 0, t.width, t.height);
|
|
6225
6685
|
s.addColorStop(0, "red"), s.addColorStop(0.16666666666666666, "orange"), s.addColorStop(0.3333333333333333, "yellow"), s.addColorStop(0.5, "green"), s.addColorStop(0.6666666666666666, "blue"), s.addColorStop(0.8333333333333334, "indigo"), s.addColorStop(1, "violet"), n.fillStyle = s, n.fillRect(0, 0, t.width, t.height);
|
|
6226
6686
|
var r = "Random Text WMwmil10Oo";
|
|
@@ -6229,15 +6689,15 @@ ve().name != "Firefox" && z("canvas", (function() {
|
|
|
6229
6689
|
return i;
|
|
6230
6690
|
})();
|
|
6231
6691
|
}));
|
|
6232
|
-
o({ commonImageDataHash:
|
|
6692
|
+
o({ commonImageDataHash: at(Xt(e, Ct, Et).data.toString()).toString() });
|
|
6233
6693
|
}));
|
|
6234
6694
|
}));
|
|
6235
|
-
var
|
|
6236
|
-
function
|
|
6695
|
+
var et, pr = ["Arial", "Arial Black", "Arial Narrow", "Arial Rounded MT", "Arimo", "Archivo", "Barlow", "Bebas Neue", "Bitter", "Bookman", "Calibri", "Cabin", "Candara", "Century", "Century Gothic", "Comic Sans MS", "Constantia", "Courier", "Courier New", "Crimson Text", "DM Mono", "DM Sans", "DM Serif Display", "DM Serif Text", "Dosis", "Droid Sans", "Exo", "Fira Code", "Fira Sans", "Franklin Gothic Medium", "Garamond", "Geneva", "Georgia", "Gill Sans", "Helvetica", "Impact", "Inconsolata", "Indie Flower", "Inter", "Josefin Sans", "Karla", "Lato", "Lexend", "Lucida Bright", "Lucida Console", "Lucida Sans Unicode", "Manrope", "Merriweather", "Merriweather Sans", "Montserrat", "Myriad", "Noto Sans", "Nunito", "Nunito Sans", "Open Sans", "Optima", "Orbitron", "Oswald", "Pacifico", "Palatino", "Perpetua", "PT Sans", "PT Serif", "Poppins", "Prompt", "Public Sans", "Quicksand", "Rajdhani", "Recursive", "Roboto", "Roboto Condensed", "Rockwell", "Rubik", "Segoe Print", "Segoe Script", "Segoe UI", "Sora", "Source Sans Pro", "Space Mono", "Tahoma", "Taviraj", "Times", "Times New Roman", "Titillium Web", "Trebuchet MS", "Ubuntu", "Varela Round", "Verdana", "Work Sans"], fr = ["monospace", "sans-serif", "serif"];
|
|
6696
|
+
function Ot(o, e) {
|
|
6237
6697
|
if (!o) throw new Error("Canvas context not supported");
|
|
6238
6698
|
return o.font, o.font = "72px ".concat(e), o.measureText("WwMmLli0Oo").width;
|
|
6239
6699
|
}
|
|
6240
|
-
function
|
|
6700
|
+
function mr() {
|
|
6241
6701
|
var o, e = document.createElement("canvas"), t = (o = e.getContext("webgl")) !== null && o !== void 0 ? o : e.getContext("experimental-webgl");
|
|
6242
6702
|
if (t && "getParameter" in t) try {
|
|
6243
6703
|
var n = (t.getParameter(t.VENDOR) || "").toString(), s = (t.getParameter(t.RENDERER) || "").toString(), r = { vendor: n, renderer: s, version: (t.getParameter(t.VERSION) || "").toString(), shadingLanguageVersion: (t.getParameter(t.SHADING_LANGUAGE_VERSION) || "").toString() };
|
|
@@ -6253,11 +6713,11 @@ function pr() {
|
|
|
6253
6713
|
}
|
|
6254
6714
|
return "undefined";
|
|
6255
6715
|
}
|
|
6256
|
-
function
|
|
6716
|
+
function yr() {
|
|
6257
6717
|
var o = new Float32Array(1), e = new Uint8Array(o.buffer);
|
|
6258
6718
|
return o[0] = 1 / 0, o[0] = o[0] - o[0], e[3];
|
|
6259
6719
|
}
|
|
6260
|
-
function
|
|
6720
|
+
function gr(o, e) {
|
|
6261
6721
|
var t = {};
|
|
6262
6722
|
return e.forEach((function(n) {
|
|
6263
6723
|
var s = (function(r) {
|
|
@@ -6279,7 +6739,7 @@ function mr(o, e) {
|
|
|
6279
6739
|
s && (t[n] = s);
|
|
6280
6740
|
})), t;
|
|
6281
6741
|
}
|
|
6282
|
-
function
|
|
6742
|
+
function wr() {
|
|
6283
6743
|
var o = [], e = { "prefers-contrast": ["high", "more", "low", "less", "forced", "no-preference"], "any-hover": ["hover", "none"], "any-pointer": ["none", "coarse", "fine"], pointer: ["none", "coarse", "fine"], hover: ["hover", "none"], update: ["fast", "slow"], "inverted-colors": ["inverted", "none"], "prefers-reduced-motion": ["reduce", "no-preference"], "prefers-reduced-transparency": ["reduce", "no-preference"], scripting: ["none", "initial-only", "enabled"], "forced-colors": ["active", "none"] };
|
|
6284
6744
|
return Object.keys(e).forEach((function(t) {
|
|
6285
6745
|
e[t].forEach((function(n) {
|
|
@@ -6287,7 +6747,7 @@ function yr() {
|
|
|
6287
6747
|
}));
|
|
6288
6748
|
})), o;
|
|
6289
6749
|
}
|
|
6290
|
-
function
|
|
6750
|
+
function br() {
|
|
6291
6751
|
if (window.location.protocol === "https:" && typeof window.ApplePaySession == "function") try {
|
|
6292
6752
|
for (var o = window.ApplePaySession.supportsVersion, e = 15; e > 0; e--) if (o(e)) return e;
|
|
6293
6753
|
} catch {
|
|
@@ -6295,7 +6755,7 @@ function gr() {
|
|
|
6295
6755
|
}
|
|
6296
6756
|
return 0;
|
|
6297
6757
|
}
|
|
6298
|
-
|
|
6758
|
+
Te().name != "Firefox" && J("fonts", (function() {
|
|
6299
6759
|
var o = this;
|
|
6300
6760
|
return new Promise((function(e, t) {
|
|
6301
6761
|
try {
|
|
@@ -6325,10 +6785,10 @@ ve().name != "Firefox" && z("fonts", (function() {
|
|
|
6325
6785
|
return X(o, void 0, void 0, (function() {
|
|
6326
6786
|
var r, i, a, c;
|
|
6327
6787
|
return Z(this, (function(u) {
|
|
6328
|
-
return r = s.createElement("canvas"), i = r.getContext("2d"), a =
|
|
6329
|
-
return
|
|
6330
|
-
})), c = {},
|
|
6331
|
-
var h =
|
|
6788
|
+
return r = s.createElement("canvas"), i = r.getContext("2d"), a = fr.map((function(l) {
|
|
6789
|
+
return Ot(i, l);
|
|
6790
|
+
})), c = {}, pr.forEach((function(l) {
|
|
6791
|
+
var h = Ot(i, l);
|
|
6332
6792
|
a.includes(h) || (c[l] = h);
|
|
6333
6793
|
})), e(c), [2];
|
|
6334
6794
|
}));
|
|
@@ -6338,27 +6798,27 @@ ve().name != "Firefox" && z("fonts", (function() {
|
|
|
6338
6798
|
t({ error: "unsupported" });
|
|
6339
6799
|
}
|
|
6340
6800
|
}));
|
|
6341
|
-
})),
|
|
6801
|
+
})), J("hardware", (function() {
|
|
6342
6802
|
return new Promise((function(o, e) {
|
|
6343
6803
|
var t = navigator.deviceMemory !== void 0 ? navigator.deviceMemory : 0, n = window.performance && window.performance.memory ? window.performance.memory : 0;
|
|
6344
|
-
o({ videocard:
|
|
6804
|
+
o({ videocard: mr(), architecture: yr(), deviceMemory: t.toString() || "undefined", jsHeapSizeLimit: n.jsHeapSizeLimit || 0 });
|
|
6345
6805
|
}));
|
|
6346
|
-
})),
|
|
6806
|
+
})), J("locales", (function() {
|
|
6347
6807
|
return new Promise((function(o) {
|
|
6348
6808
|
o({ languages: navigator.language, timezone: Intl.DateTimeFormat().resolvedOptions().timeZone });
|
|
6349
6809
|
}));
|
|
6350
|
-
})),
|
|
6810
|
+
})), J("permissions", (function() {
|
|
6351
6811
|
return X(this, void 0, void 0, (function() {
|
|
6352
6812
|
var o;
|
|
6353
6813
|
return Z(this, (function(e) {
|
|
6354
|
-
return
|
|
6814
|
+
return et = (R == null ? void 0 : R.permissions_to_check) || ["accelerometer", "accessibility", "accessibility-events", "ambient-light-sensor", "background-fetch", "background-sync", "bluetooth", "camera", "clipboard-read", "clipboard-write", "device-info", "display-capture", "gyroscope", "geolocation", "local-fonts", "magnetometer", "microphone", "midi", "nfc", "notifications", "payment-handler", "persistent-storage", "push", "speaker", "storage-access", "top-level-storage-access", "window-management", "query"], o = Array.from({ length: (R == null ? void 0 : R.retries) || 3 }, (function() {
|
|
6355
6815
|
return (function() {
|
|
6356
6816
|
return X(this, void 0, void 0, (function() {
|
|
6357
6817
|
var t, n, s, r, i;
|
|
6358
6818
|
return Z(this, (function(a) {
|
|
6359
6819
|
switch (a.label) {
|
|
6360
6820
|
case 0:
|
|
6361
|
-
t = {}, n = 0, s =
|
|
6821
|
+
t = {}, n = 0, s = et, a.label = 1;
|
|
6362
6822
|
case 1:
|
|
6363
6823
|
if (!(n < s.length)) return [3, 6];
|
|
6364
6824
|
r = s[n], a.label = 2;
|
|
@@ -6377,11 +6837,11 @@ ve().name != "Firefox" && z("fonts", (function() {
|
|
|
6377
6837
|
}));
|
|
6378
6838
|
})();
|
|
6379
6839
|
})), [2, Promise.all(o).then((function(t) {
|
|
6380
|
-
return
|
|
6840
|
+
return gr(t, et);
|
|
6381
6841
|
}))];
|
|
6382
6842
|
}));
|
|
6383
6843
|
}));
|
|
6384
|
-
})),
|
|
6844
|
+
})), J("plugins", (function() {
|
|
6385
6845
|
var o = [];
|
|
6386
6846
|
if (navigator.plugins) for (var e = 0; e < navigator.plugins.length; e++) {
|
|
6387
6847
|
var t = navigator.plugins[e];
|
|
@@ -6390,28 +6850,28 @@ ve().name != "Firefox" && z("fonts", (function() {
|
|
|
6390
6850
|
return new Promise((function(n) {
|
|
6391
6851
|
n({ plugins: o });
|
|
6392
6852
|
}));
|
|
6393
|
-
})),
|
|
6853
|
+
})), J("screen", (function() {
|
|
6394
6854
|
return new Promise((function(o) {
|
|
6395
|
-
o({ is_touchscreen: navigator.maxTouchPoints > 0, maxTouchPoints: navigator.maxTouchPoints, colorDepth: screen.colorDepth, mediaMatches:
|
|
6855
|
+
o({ is_touchscreen: navigator.maxTouchPoints > 0, maxTouchPoints: navigator.maxTouchPoints, colorDepth: screen.colorDepth, mediaMatches: wr() });
|
|
6396
6856
|
}));
|
|
6397
|
-
})),
|
|
6857
|
+
})), J("system", (function() {
|
|
6398
6858
|
return new Promise((function(o) {
|
|
6399
|
-
var e =
|
|
6400
|
-
o({ platform: window.navigator.platform, cookieEnabled: window.navigator.cookieEnabled, productSub: navigator.productSub, product: navigator.product, useragent: navigator.userAgent, hardwareConcurrency: navigator.hardwareConcurrency, browser: { name: e.name, version: e.version }, applePayVersion:
|
|
6859
|
+
var e = Te();
|
|
6860
|
+
o({ platform: window.navigator.platform, cookieEnabled: window.navigator.cookieEnabled, productSub: navigator.productSub, product: navigator.product, useragent: navigator.userAgent, hardwareConcurrency: navigator.hardwareConcurrency, browser: { name: e.name, version: e.version }, applePayVersion: br() });
|
|
6401
6861
|
}));
|
|
6402
6862
|
}));
|
|
6403
|
-
var
|
|
6404
|
-
|
|
6863
|
+
var K, kr = Te().name !== "SamsungBrowser" ? 1 : 3, m = null;
|
|
6864
|
+
J("webgl", (function() {
|
|
6405
6865
|
return X(this, void 0, void 0, (function() {
|
|
6406
6866
|
var o;
|
|
6407
6867
|
return Z(this, (function(e) {
|
|
6408
|
-
typeof document < "u" && ((
|
|
6868
|
+
typeof document < "u" && ((K = document.createElement("canvas")).width = 200, K.height = 100, m = K.getContext("webgl"));
|
|
6409
6869
|
try {
|
|
6410
|
-
if (!
|
|
6411
|
-
return o = Array.from({ length:
|
|
6870
|
+
if (!m) throw new Error("WebGL not supported");
|
|
6871
|
+
return o = Array.from({ length: kr }, (function() {
|
|
6412
6872
|
return (function() {
|
|
6413
6873
|
try {
|
|
6414
|
-
if (!
|
|
6874
|
+
if (!m) throw new Error("WebGL not supported");
|
|
6415
6875
|
var t = `
|
|
6416
6876
|
attribute vec2 position;
|
|
6417
6877
|
void main() {
|
|
@@ -6422,31 +6882,31 @@ z("webgl", (function() {
|
|
|
6422
6882
|
void main() {
|
|
6423
6883
|
gl_FragColor = vec4(0.812, 0.195, 0.553, 0.921); // Set line color
|
|
6424
6884
|
}
|
|
6425
|
-
`, s =
|
|
6885
|
+
`, s = m.createShader(m.VERTEX_SHADER), r = m.createShader(m.FRAGMENT_SHADER);
|
|
6426
6886
|
if (!s || !r) throw new Error("Failed to create shaders");
|
|
6427
|
-
if (
|
|
6428
|
-
if (
|
|
6429
|
-
var i =
|
|
6887
|
+
if (m.shaderSource(s, t), m.shaderSource(r, n), m.compileShader(s), !m.getShaderParameter(s, m.COMPILE_STATUS)) throw new Error("Vertex shader compilation failed: " + m.getShaderInfoLog(s));
|
|
6888
|
+
if (m.compileShader(r), !m.getShaderParameter(r, m.COMPILE_STATUS)) throw new Error("Fragment shader compilation failed: " + m.getShaderInfoLog(r));
|
|
6889
|
+
var i = m.createProgram();
|
|
6430
6890
|
if (!i) throw new Error("Failed to create shader program");
|
|
6431
|
-
if (
|
|
6432
|
-
|
|
6891
|
+
if (m.attachShader(i, s), m.attachShader(i, r), m.linkProgram(i), !m.getProgramParameter(i, m.LINK_STATUS)) throw new Error("Shader program linking failed: " + m.getProgramInfoLog(i));
|
|
6892
|
+
m.useProgram(i);
|
|
6433
6893
|
for (var a = 137, c = new Float32Array(4 * a), u = 2 * Math.PI / a, l = 0; l < a; l++) {
|
|
6434
6894
|
var h = l * u;
|
|
6435
|
-
c[4 * l] = 0, c[4 * l + 1] = 0, c[4 * l + 2] = Math.cos(h) * (
|
|
6895
|
+
c[4 * l] = 0, c[4 * l + 1] = 0, c[4 * l + 2] = Math.cos(h) * (K.width / 2), c[4 * l + 3] = Math.sin(h) * (K.height / 2);
|
|
6436
6896
|
}
|
|
6437
|
-
var p =
|
|
6438
|
-
|
|
6439
|
-
var d =
|
|
6440
|
-
|
|
6441
|
-
var w = new Uint8ClampedArray(
|
|
6442
|
-
return
|
|
6897
|
+
var p = m.createBuffer();
|
|
6898
|
+
m.bindBuffer(m.ARRAY_BUFFER, p), m.bufferData(m.ARRAY_BUFFER, c, m.STATIC_DRAW);
|
|
6899
|
+
var d = m.getAttribLocation(i, "position");
|
|
6900
|
+
m.enableVertexAttribArray(d), m.vertexAttribPointer(d, 2, m.FLOAT, !1, 0, 0), m.viewport(0, 0, K.width, K.height), m.clearColor(0, 0, 0, 1), m.clear(m.COLOR_BUFFER_BIT), m.drawArrays(m.LINES, 0, 2 * a);
|
|
6901
|
+
var w = new Uint8ClampedArray(K.width * K.height * 4);
|
|
6902
|
+
return m.readPixels(0, 0, K.width, K.height, m.RGBA, m.UNSIGNED_BYTE, w), new ImageData(w, K.width, K.height);
|
|
6443
6903
|
} catch {
|
|
6444
6904
|
return new ImageData(1, 1);
|
|
6445
6905
|
} finally {
|
|
6446
|
-
|
|
6906
|
+
m && (m.bindBuffer(m.ARRAY_BUFFER, null), m.useProgram(null), m.viewport(0, 0, m.drawingBufferWidth, m.drawingBufferHeight), m.clearColor(0, 0, 0, 0));
|
|
6447
6907
|
}
|
|
6448
6908
|
})();
|
|
6449
|
-
})), [2, { commonImageHash:
|
|
6909
|
+
})), [2, { commonImageHash: at(Xt(o, K.width, K.height).data.toString()).toString() }];
|
|
6450
6910
|
} catch {
|
|
6451
6911
|
return [2, { webgl: "unsupported" }];
|
|
6452
6912
|
}
|
|
@@ -6459,33 +6919,33 @@ var re = function(o, e, t, n) {
|
|
|
6459
6919
|
r += o(e + (i + 0.5) * s);
|
|
6460
6920
|
return r * s;
|
|
6461
6921
|
};
|
|
6462
|
-
|
|
6922
|
+
J("math", (function() {
|
|
6463
6923
|
return X(void 0, void 0, void 0, (function() {
|
|
6464
6924
|
return Z(this, (function(o) {
|
|
6465
6925
|
return [2, { acos: Math.acos(0.5), asin: re(Math.asin, -1, 1, 97), atan: re(Math.atan, -1, 1, 97), cos: re(Math.cos, 0, Math.PI, 97), cosh: Math.cosh(9 / 7), e: Math.E, largeCos: Math.cos(1e20), largeSin: Math.sin(1e20), largeTan: Math.tan(1e20), log: Math.log(1e3), pi: Math.PI, sin: re(Math.sin, -Math.PI, Math.PI, 97), sinh: re(Math.sinh, -9 / 7, 7 / 9, 97), sqrt: Math.sqrt(2), tan: re(Math.tan, 0, 2 * Math.PI, 97), tanh: re(Math.tanh, -9 / 7, 7 / 9, 97) }];
|
|
6466
6926
|
}));
|
|
6467
6927
|
}));
|
|
6468
6928
|
}));
|
|
6469
|
-
class
|
|
6929
|
+
class Sr {
|
|
6470
6930
|
constructor({ serverUri: e, socket: t = null, encrypt: n = !1 }) {
|
|
6471
6931
|
this.$__client = this.createUrqlClient({ serverUri: e, socket: t, encrypt: n }), this.$__authToken = "", this.$__pubkey = null, this.$__wallet = null, this.serverUri = e, this.soketi = t, this.cipherLink = !!n, this.$__subscriptionManager = /* @__PURE__ */ new Map();
|
|
6472
6932
|
}
|
|
6473
6933
|
createUrqlClient({ serverUri: e, socket: t, encrypt: n }) {
|
|
6474
|
-
const s = [
|
|
6934
|
+
const s = [tn, nn];
|
|
6475
6935
|
if (t && t.socketUri) {
|
|
6476
|
-
const r =
|
|
6936
|
+
const r = on({
|
|
6477
6937
|
url: t.socketUri,
|
|
6478
6938
|
connectionParams: () => ({
|
|
6479
6939
|
authToken: this.$__authToken
|
|
6480
6940
|
})
|
|
6481
6941
|
});
|
|
6482
|
-
s.push(
|
|
6942
|
+
s.push(sn({
|
|
6483
6943
|
forwardSubscription: (i) => ({
|
|
6484
6944
|
subscribe: (a) => ({ unsubscribe: r.subscribe(i, a) })
|
|
6485
6945
|
})
|
|
6486
6946
|
}));
|
|
6487
6947
|
}
|
|
6488
|
-
return
|
|
6948
|
+
return rn({
|
|
6489
6949
|
url: e,
|
|
6490
6950
|
exchanges: s,
|
|
6491
6951
|
fetchOptions: () => ({
|
|
@@ -6513,9 +6973,9 @@ class br {
|
|
|
6513
6973
|
return this.formatResponse(s);
|
|
6514
6974
|
}
|
|
6515
6975
|
subscribe(e, t) {
|
|
6516
|
-
const { query: n, variables: s, operationName: r } = e, { unsubscribe: i } =
|
|
6976
|
+
const { query: n, variables: s, operationName: r } = e, { unsubscribe: i } = an(
|
|
6517
6977
|
this.$__client.subscription(n, s),
|
|
6518
|
-
|
|
6978
|
+
ln((a) => {
|
|
6519
6979
|
t(this.formatResponse(a));
|
|
6520
6980
|
})
|
|
6521
6981
|
).subscribe(() => {
|
|
@@ -6585,7 +7045,7 @@ class br {
|
|
|
6585
7045
|
});
|
|
6586
7046
|
}
|
|
6587
7047
|
}
|
|
6588
|
-
class
|
|
7048
|
+
class Tr {
|
|
6589
7049
|
/**
|
|
6590
7050
|
* Class constructor
|
|
6591
7051
|
*
|
|
@@ -6636,7 +7096,7 @@ class xr {
|
|
|
6636
7096
|
const c = this.$__uris[a];
|
|
6637
7097
|
this.$__authTokenObjects[c] = null;
|
|
6638
7098
|
}
|
|
6639
|
-
this.log("info", `KnishIOClient::initialize() - Initializing new Knish.IO client session for SDK version ${r}...`), this.$__client = s || new
|
|
7099
|
+
this.log("info", `KnishIOClient::initialize() - Initializing new Knish.IO client session for SDK version ${r}...`), this.$__client = s || new Sr({
|
|
6640
7100
|
socket: {
|
|
6641
7101
|
socketUri: null,
|
|
6642
7102
|
appKey: "knishio",
|
|
@@ -6770,7 +7230,7 @@ class xr {
|
|
|
6770
7230
|
* @returns {string}
|
|
6771
7231
|
*/
|
|
6772
7232
|
hashSecret(e, t = null) {
|
|
6773
|
-
return this.log("info", `KnishIOClient::hashSecret(${t ? `source: ${t}` : ""}) - Computing wallet bundle from secret...`),
|
|
7233
|
+
return this.log("info", `KnishIOClient::hashSecret(${t ? `source: ${t}` : ""}) - Computing wallet bundle from secret...`), fe(e);
|
|
6774
7234
|
}
|
|
6775
7235
|
/**
|
|
6776
7236
|
* Retrieves the stored secret for this session
|
|
@@ -6779,7 +7239,7 @@ class xr {
|
|
|
6779
7239
|
*/
|
|
6780
7240
|
getSecret() {
|
|
6781
7241
|
if (!this.hasSecret())
|
|
6782
|
-
throw new
|
|
7242
|
+
throw new Ke("KnishIOClient::getSecret() - Unable to find a stored secret! Have you set a secret?");
|
|
6783
7243
|
return this.$__secret;
|
|
6784
7244
|
}
|
|
6785
7245
|
/**
|
|
@@ -6797,7 +7257,7 @@ class xr {
|
|
|
6797
7257
|
*/
|
|
6798
7258
|
getBundle() {
|
|
6799
7259
|
if (!this.hasBundle())
|
|
6800
|
-
throw new
|
|
7260
|
+
throw new Ke("KnishIOClient::getBundle() - Unable to find a stored bundle! Have you set a secret?");
|
|
6801
7261
|
return this.$__bundle;
|
|
6802
7262
|
}
|
|
6803
7263
|
/**
|
|
@@ -6806,10 +7266,10 @@ class xr {
|
|
|
6806
7266
|
* @returns {Promise<string>} A promise that resolves to the device fingerprint as a string.
|
|
6807
7267
|
*/
|
|
6808
7268
|
getFingerprint() {
|
|
6809
|
-
return
|
|
7269
|
+
return cr();
|
|
6810
7270
|
}
|
|
6811
7271
|
getFingerprintData() {
|
|
6812
|
-
return
|
|
7272
|
+
return Jt();
|
|
6813
7273
|
}
|
|
6814
7274
|
/**
|
|
6815
7275
|
* Retrieves this session's wallet used for signing the next Molecule
|
|
@@ -6820,11 +7280,11 @@ class xr {
|
|
|
6820
7280
|
let e = (await this.queryContinuId({
|
|
6821
7281
|
bundle: this.getBundle()
|
|
6822
7282
|
})).payload();
|
|
6823
|
-
return e ? e.key =
|
|
7283
|
+
return e ? e.key = _.generateKey({
|
|
6824
7284
|
secret: this.getSecret(),
|
|
6825
7285
|
token: e.token,
|
|
6826
7286
|
position: e.position
|
|
6827
|
-
}) : e = new
|
|
7287
|
+
}) : e = new _({
|
|
6828
7288
|
secret: this.getSecret()
|
|
6829
7289
|
}), e;
|
|
6830
7290
|
}
|
|
@@ -6851,13 +7311,13 @@ class xr {
|
|
|
6851
7311
|
sourceWallet: n = null,
|
|
6852
7312
|
remainderWallet: s = null
|
|
6853
7313
|
}) {
|
|
6854
|
-
return this.log("info", "KnishIOClient::createMolecule() - Creating a new molecule..."), e = e || this.getSecret(), t = t || this.getBundle(), !n && this.lastMoleculeQuery && this.getRemainderWallet().token === "USER" && this.lastMoleculeQuery.response() && this.lastMoleculeQuery.response().success() && (n = this.getRemainderWallet()), n === null && (n = await this.getSourceWallet()), this.remainderWallet = s ||
|
|
7314
|
+
return this.log("info", "KnishIOClient::createMolecule() - Creating a new molecule..."), e = e || this.getSecret(), t = t || this.getBundle(), !n && this.lastMoleculeQuery && this.getRemainderWallet().token === "USER" && this.lastMoleculeQuery.response() && this.lastMoleculeQuery.response().success() && (n = this.getRemainderWallet()), n === null && (n = await this.getSourceWallet()), this.remainderWallet = s || _.create({
|
|
6855
7315
|
secret: e,
|
|
6856
7316
|
bundle: t,
|
|
6857
7317
|
token: "USER",
|
|
6858
7318
|
batchId: n.batchId,
|
|
6859
7319
|
characters: n.characters
|
|
6860
|
-
}), new
|
|
7320
|
+
}), new z({
|
|
6861
7321
|
secret: e,
|
|
6862
7322
|
sourceWallet: n,
|
|
6863
7323
|
remainderWallet: this.getRemainderWallet(),
|
|
@@ -6958,7 +7418,7 @@ class xr {
|
|
|
6958
7418
|
bundle: t = null,
|
|
6959
7419
|
type: n = "regular"
|
|
6960
7420
|
}) {
|
|
6961
|
-
const s = this.createQuery(
|
|
7421
|
+
const s = this.createQuery(ds);
|
|
6962
7422
|
return this.executeQuery(s, {
|
|
6963
7423
|
bundleHash: t || this.getBundle(),
|
|
6964
7424
|
token: e,
|
|
@@ -6981,7 +7441,7 @@ class xr {
|
|
|
6981
7441
|
token: e,
|
|
6982
7442
|
type: n
|
|
6983
7443
|
})).payload();
|
|
6984
|
-
if (s === null ||
|
|
7444
|
+
if (s === null || de.cmp(s.balance, t) < 0)
|
|
6985
7445
|
throw new Y();
|
|
6986
7446
|
if (!s.position || !s.address)
|
|
6987
7447
|
throw new Y("Source wallet can not be a shadow wallet.");
|
|
@@ -6996,7 +7456,7 @@ class xr {
|
|
|
6996
7456
|
bundle: e,
|
|
6997
7457
|
closure: t
|
|
6998
7458
|
}) {
|
|
6999
|
-
return await this.createSubscribe(
|
|
7459
|
+
return await this.createSubscribe(Hs).execute({
|
|
7000
7460
|
variables: {
|
|
7001
7461
|
bundle: e || this.getBundle()
|
|
7002
7462
|
},
|
|
@@ -7018,7 +7478,7 @@ class xr {
|
|
|
7018
7478
|
}) {
|
|
7019
7479
|
if (!t)
|
|
7020
7480
|
throw new ee(`${this.constructor.name}::subscribeWalletStatus() - Token parameter is required!`);
|
|
7021
|
-
return this.createSubscribe(
|
|
7481
|
+
return this.createSubscribe(Ps).execute({
|
|
7022
7482
|
variables: {
|
|
7023
7483
|
bundle: e || this.getBundle(),
|
|
7024
7484
|
token: t
|
|
@@ -7037,7 +7497,7 @@ class xr {
|
|
|
7037
7497
|
bundle: e,
|
|
7038
7498
|
closure: t
|
|
7039
7499
|
}) {
|
|
7040
|
-
return this.createSubscribe(
|
|
7500
|
+
return this.createSubscribe(Ks).execute({
|
|
7041
7501
|
variables: {
|
|
7042
7502
|
bundle: e || this.getBundle()
|
|
7043
7503
|
},
|
|
@@ -7057,7 +7517,7 @@ class xr {
|
|
|
7057
7517
|
metaId: t,
|
|
7058
7518
|
closure: n
|
|
7059
7519
|
}) {
|
|
7060
|
-
return this.createSubscribe(
|
|
7520
|
+
return this.createSubscribe(Ns).execute({
|
|
7061
7521
|
variables: {
|
|
7062
7522
|
metaType: e,
|
|
7063
7523
|
metaId: t
|
|
@@ -7090,10 +7550,11 @@ class xr {
|
|
|
7090
7550
|
* @param {string|null} count
|
|
7091
7551
|
* @param {string|null} countBy
|
|
7092
7552
|
* @param {boolean} throughAtom
|
|
7553
|
+
* @param {boolean} throughMolecule
|
|
7093
7554
|
* @param {array|null} values
|
|
7094
7555
|
* @param {array|null} keys
|
|
7095
7556
|
* @param {array|null} atomValues
|
|
7096
|
-
* @return {Promise<ResponseMetaType>}
|
|
7557
|
+
* @return {Promise<ResponseMetaType|ResponseMetaTypeViaAtom|ResponseMetaTypeViaMolecule>}
|
|
7097
7558
|
*/
|
|
7098
7559
|
queryMeta({
|
|
7099
7560
|
metaType: e,
|
|
@@ -7107,13 +7568,27 @@ class xr {
|
|
|
7107
7568
|
count: u = null,
|
|
7108
7569
|
countBy: l = null,
|
|
7109
7570
|
throughAtom: h = !0,
|
|
7110
|
-
|
|
7111
|
-
|
|
7112
|
-
|
|
7571
|
+
throughMolecule: p = !1,
|
|
7572
|
+
values: d = null,
|
|
7573
|
+
keys: w = null,
|
|
7574
|
+
atomValues: A = null
|
|
7113
7575
|
}) {
|
|
7114
7576
|
this.log("info", `KnishIOClient::queryMeta() - Querying metaType: ${e}, metaId: ${t}...`);
|
|
7115
|
-
let
|
|
7116
|
-
return
|
|
7577
|
+
let T, f;
|
|
7578
|
+
return p ? (T = this.createQuery(Mt), f = Mt.createVariables({
|
|
7579
|
+
metaType: e,
|
|
7580
|
+
metaId: t,
|
|
7581
|
+
key: n,
|
|
7582
|
+
value: s,
|
|
7583
|
+
latest: r,
|
|
7584
|
+
filter: a,
|
|
7585
|
+
queryArgs: c,
|
|
7586
|
+
countBy: l,
|
|
7587
|
+
values: d,
|
|
7588
|
+
keys: w,
|
|
7589
|
+
atomValues: A,
|
|
7590
|
+
cellSlug: this.getCellSlug()
|
|
7591
|
+
})) : h ? (T = this.createQuery(Tt), f = Tt.createVariables({
|
|
7117
7592
|
metaType: e,
|
|
7118
7593
|
metaId: t,
|
|
7119
7594
|
key: n,
|
|
@@ -7122,11 +7597,11 @@ class xr {
|
|
|
7122
7597
|
filter: a,
|
|
7123
7598
|
queryArgs: c,
|
|
7124
7599
|
countBy: l,
|
|
7125
|
-
values:
|
|
7126
|
-
keys:
|
|
7127
|
-
atomValues:
|
|
7600
|
+
values: d,
|
|
7601
|
+
keys: w,
|
|
7602
|
+
atomValues: A,
|
|
7128
7603
|
cellSlug: this.getCellSlug()
|
|
7129
|
-
})) : (
|
|
7604
|
+
})) : (T = this.createQuery(At), f = At.createVariables({
|
|
7130
7605
|
metaType: e,
|
|
7131
7606
|
metaId: t,
|
|
7132
7607
|
key: n,
|
|
@@ -7137,7 +7612,19 @@ class xr {
|
|
|
7137
7612
|
count: u,
|
|
7138
7613
|
countBy: l,
|
|
7139
7614
|
cellSlug: this.getCellSlug()
|
|
7140
|
-
})), this.executeQuery(
|
|
7615
|
+
})), this.executeQuery(T, f);
|
|
7616
|
+
}
|
|
7617
|
+
/**
|
|
7618
|
+
* Queries meta assets and verifies cryptographic integrity of associated molecules.
|
|
7619
|
+
* Returns the same response as queryMeta(), with an additional `integrity` field on the payload
|
|
7620
|
+
* containing verification results for each molecule.
|
|
7621
|
+
*
|
|
7622
|
+
* @param {object} params - Same parameters as queryMeta()
|
|
7623
|
+
* @return {Promise<ResponseMetaType|ResponseMetaTypeViaAtom|ResponseMetaTypeViaMolecule>}
|
|
7624
|
+
*/
|
|
7625
|
+
async queryMetaVerified(e) {
|
|
7626
|
+
const t = await this.queryMeta(e), n = t.payload();
|
|
7627
|
+
return n && (n.integrity = t.verifyIntegrity()), t;
|
|
7141
7628
|
}
|
|
7142
7629
|
/**
|
|
7143
7630
|
* Query batch to get cascading meta instances by batchID
|
|
@@ -7149,7 +7636,7 @@ class xr {
|
|
|
7149
7636
|
batchId: e
|
|
7150
7637
|
}) {
|
|
7151
7638
|
this.log("info", `KnishIOClient::queryBatch() - Querying cascading meta instances for batchId: ${e}...`);
|
|
7152
|
-
const t = this.createQuery(
|
|
7639
|
+
const t = this.createQuery(Ie);
|
|
7153
7640
|
return await this.executeQuery(t, {
|
|
7154
7641
|
batchId: e
|
|
7155
7642
|
});
|
|
@@ -7164,7 +7651,7 @@ class xr {
|
|
|
7164
7651
|
batchId: e
|
|
7165
7652
|
}) {
|
|
7166
7653
|
this.log("info", `KnishIOClient::queryBatchHistory() - Querying cascading meta instances for batchId: ${e}...`);
|
|
7167
|
-
const t = this.createQuery(
|
|
7654
|
+
const t = this.createQuery(fs);
|
|
7168
7655
|
return await this.executeQuery(t, {
|
|
7169
7656
|
batchId: e
|
|
7170
7657
|
});
|
|
@@ -7219,26 +7706,26 @@ class xr {
|
|
|
7219
7706
|
tokenSlug: p,
|
|
7220
7707
|
cellSlugs: d,
|
|
7221
7708
|
cellSlug: w,
|
|
7222
|
-
batchIds:
|
|
7709
|
+
batchIds: A,
|
|
7223
7710
|
batchId: T,
|
|
7224
|
-
values:
|
|
7711
|
+
values: f,
|
|
7225
7712
|
value: y,
|
|
7226
7713
|
metaTypes: b,
|
|
7227
7714
|
metaType: M,
|
|
7228
7715
|
metaIds: k,
|
|
7229
|
-
metaId:
|
|
7716
|
+
metaId: $,
|
|
7230
7717
|
indexes: v,
|
|
7231
7718
|
index: I,
|
|
7232
|
-
filter:
|
|
7233
|
-
latest:
|
|
7234
|
-
queryArgs:
|
|
7719
|
+
filter: S,
|
|
7720
|
+
latest: B,
|
|
7721
|
+
queryArgs: W = {
|
|
7235
7722
|
limit: 15,
|
|
7236
7723
|
offset: 1
|
|
7237
7724
|
}
|
|
7238
7725
|
}) {
|
|
7239
7726
|
this.log("info", "KnishIOClient::queryAtom() - Querying atom instances");
|
|
7240
|
-
const ce = this.createQuery(
|
|
7241
|
-
return await this.executeQuery(ce,
|
|
7727
|
+
const ce = this.createQuery(It);
|
|
7728
|
+
return await this.executeQuery(ce, It.createVariables({
|
|
7242
7729
|
molecularHashes: e,
|
|
7243
7730
|
molecularHash: t,
|
|
7244
7731
|
bundleHashes: n,
|
|
@@ -7253,19 +7740,19 @@ class xr {
|
|
|
7253
7740
|
tokenSlug: p,
|
|
7254
7741
|
cellSlugs: d,
|
|
7255
7742
|
cellSlug: w,
|
|
7256
|
-
batchIds:
|
|
7743
|
+
batchIds: A,
|
|
7257
7744
|
batchId: T,
|
|
7258
|
-
values:
|
|
7745
|
+
values: f,
|
|
7259
7746
|
value: y,
|
|
7260
7747
|
metaTypes: b,
|
|
7261
7748
|
metaType: M,
|
|
7262
7749
|
metaIds: k,
|
|
7263
|
-
metaId:
|
|
7750
|
+
metaId: $,
|
|
7264
7751
|
indexes: v,
|
|
7265
7752
|
index: I,
|
|
7266
|
-
filter:
|
|
7267
|
-
latest:
|
|
7268
|
-
queryArgs:
|
|
7753
|
+
filter: S,
|
|
7754
|
+
latest: B,
|
|
7755
|
+
queryArgs: W
|
|
7269
7756
|
}));
|
|
7270
7757
|
}
|
|
7271
7758
|
/**
|
|
@@ -7277,11 +7764,11 @@ class xr {
|
|
|
7277
7764
|
async createWallet({
|
|
7278
7765
|
token: e
|
|
7279
7766
|
}) {
|
|
7280
|
-
const t = new
|
|
7767
|
+
const t = new _({
|
|
7281
7768
|
secret: this.getSecret(),
|
|
7282
7769
|
token: e
|
|
7283
7770
|
}), n = await this.createMoleculeMutation({
|
|
7284
|
-
mutationClass:
|
|
7771
|
+
mutationClass: Rs
|
|
7285
7772
|
});
|
|
7286
7773
|
return n.fillMolecule(t), await this.executeQuery(n);
|
|
7287
7774
|
}
|
|
@@ -7298,7 +7785,7 @@ class xr {
|
|
|
7298
7785
|
metaType: t,
|
|
7299
7786
|
metaId: n
|
|
7300
7787
|
}) {
|
|
7301
|
-
const s = this.createQuery(
|
|
7788
|
+
const s = this.createQuery(Qs);
|
|
7302
7789
|
return await this.executeQuery(s, {
|
|
7303
7790
|
bundleHash: e,
|
|
7304
7791
|
metaType: t,
|
|
@@ -7333,7 +7820,7 @@ class xr {
|
|
|
7333
7820
|
countBy: u,
|
|
7334
7821
|
interval: l
|
|
7335
7822
|
}) {
|
|
7336
|
-
const h = this.createQuery(
|
|
7823
|
+
const h = this.createQuery(Vs);
|
|
7337
7824
|
return await this.executeQuery(h, {
|
|
7338
7825
|
bundleHash: e,
|
|
7339
7826
|
metaType: t,
|
|
@@ -7373,7 +7860,7 @@ class xr {
|
|
|
7373
7860
|
timeZone: c,
|
|
7374
7861
|
json: u = {}
|
|
7375
7862
|
}) {
|
|
7376
|
-
const l = this.createQuery(
|
|
7863
|
+
const l = this.createQuery(Ls);
|
|
7377
7864
|
return await this.executeQuery(l, {
|
|
7378
7865
|
bundleHash: e,
|
|
7379
7866
|
metaType: t,
|
|
@@ -7409,20 +7896,20 @@ class xr {
|
|
|
7409
7896
|
units: r = []
|
|
7410
7897
|
}) {
|
|
7411
7898
|
const i = C.get(n || {}, "fungibility");
|
|
7412
|
-
if (i === "stackable" && (n.batchId = s ||
|
|
7899
|
+
if (i === "stackable" && (n.batchId = s || he({})), ["nonfungible", "stackable"].includes(i) && r.length > 0) {
|
|
7413
7900
|
if (C.get(n || {}, "decimals") > 0)
|
|
7414
|
-
throw new
|
|
7901
|
+
throw new qs();
|
|
7415
7902
|
if (t > 0)
|
|
7416
|
-
throw new
|
|
7903
|
+
throw new We();
|
|
7417
7904
|
t = r.length, n.splittable = 1, n.decimals = 0, n.tokenUnits = JSON.stringify(r);
|
|
7418
7905
|
}
|
|
7419
|
-
const a = new
|
|
7906
|
+
const a = new _({
|
|
7420
7907
|
secret: this.getSecret(),
|
|
7421
7908
|
bundle: this.getBundle(),
|
|
7422
7909
|
token: e,
|
|
7423
7910
|
batchId: s
|
|
7424
7911
|
}), c = await this.createMoleculeMutation({
|
|
7425
|
-
mutationClass:
|
|
7912
|
+
mutationClass: ws
|
|
7426
7913
|
});
|
|
7427
7914
|
return c.fillMolecule({
|
|
7428
7915
|
recipientWallet: a,
|
|
@@ -7447,7 +7934,7 @@ class xr {
|
|
|
7447
7934
|
}) {
|
|
7448
7935
|
const r = await this.createMoleculeMutation(
|
|
7449
7936
|
{
|
|
7450
|
-
mutationClass:
|
|
7937
|
+
mutationClass: er,
|
|
7451
7938
|
molecule: await this.createMolecule({
|
|
7452
7939
|
secret: this.getSecret(),
|
|
7453
7940
|
sourceWallet: await this.getSourceWallet()
|
|
@@ -7478,7 +7965,7 @@ class xr {
|
|
|
7478
7965
|
}) {
|
|
7479
7966
|
const r = await this.createMoleculeMutation(
|
|
7480
7967
|
{
|
|
7481
|
-
mutationClass:
|
|
7968
|
+
mutationClass: Ts,
|
|
7482
7969
|
molecule: await this.createMolecule({
|
|
7483
7970
|
secret: this.getSecret(),
|
|
7484
7971
|
sourceWallet: await this.getSourceWallet()
|
|
@@ -7502,7 +7989,7 @@ class xr {
|
|
|
7502
7989
|
host: e
|
|
7503
7990
|
}) {
|
|
7504
7991
|
const t = await this.createMoleculeMutation({
|
|
7505
|
-
mutationClass:
|
|
7992
|
+
mutationClass: Cs,
|
|
7506
7993
|
molecule: await this.createMolecule({
|
|
7507
7994
|
secret: this.getSecret(),
|
|
7508
7995
|
sourceWallet: await this.getSourceWallet()
|
|
@@ -7528,7 +8015,7 @@ class xr {
|
|
|
7528
8015
|
meta: s = {}
|
|
7529
8016
|
}) {
|
|
7530
8017
|
const r = await this.createMoleculeMutation({
|
|
7531
|
-
mutationClass:
|
|
8018
|
+
mutationClass: Os,
|
|
7532
8019
|
molecule: await this.createMolecule({
|
|
7533
8020
|
secret: this.getSecret(),
|
|
7534
8021
|
sourceWallet: await this.getSourceWallet()
|
|
@@ -7555,7 +8042,7 @@ class xr {
|
|
|
7555
8042
|
code: n
|
|
7556
8043
|
}) {
|
|
7557
8044
|
const s = await this.createMoleculeMutation({
|
|
7558
|
-
mutationClass:
|
|
8045
|
+
mutationClass: As
|
|
7559
8046
|
});
|
|
7560
8047
|
return s.fillMolecule({
|
|
7561
8048
|
type: e,
|
|
@@ -7603,7 +8090,7 @@ class xr {
|
|
|
7603
8090
|
metaType: e,
|
|
7604
8091
|
metaId: t
|
|
7605
8092
|
}) {
|
|
7606
|
-
const n = this.createQuery(
|
|
8093
|
+
const n = this.createQuery(Xs);
|
|
7607
8094
|
return await this.executeQuery(n, {
|
|
7608
8095
|
metaType: e,
|
|
7609
8096
|
metaId: t
|
|
@@ -7625,7 +8112,7 @@ class xr {
|
|
|
7625
8112
|
unspent: n = !0
|
|
7626
8113
|
}) {
|
|
7627
8114
|
this.log("info", `KnishIOClient::queryWallets() - Querying wallets${e ? ` for ${e}` : ""}...`);
|
|
7628
|
-
const s = this.createQuery(
|
|
8115
|
+
const s = this.createQuery(us);
|
|
7629
8116
|
return this.executeQuery(s, {
|
|
7630
8117
|
bundleHash: e || this.getBundle(),
|
|
7631
8118
|
tokenSlug: t,
|
|
@@ -7647,7 +8134,7 @@ class xr {
|
|
|
7647
8134
|
raw: n = !1
|
|
7648
8135
|
}) {
|
|
7649
8136
|
this.log("info", `KnishIOClient::queryBundle() - Querying wallet bundle metadata${e ? ` for ${e}` : ""}...`), e || (e = this.getBundle()), typeof e == "string" && (e = [e]);
|
|
7650
|
-
const s = this.createQuery(
|
|
8137
|
+
const s = this.createQuery(cs);
|
|
7651
8138
|
return this.executeQuery(s, { bundleHashes: e }).then((r) => n ? r : r.payload());
|
|
7652
8139
|
}
|
|
7653
8140
|
/**
|
|
@@ -7659,7 +8146,7 @@ class xr {
|
|
|
7659
8146
|
async queryContinuId({
|
|
7660
8147
|
bundle: e
|
|
7661
8148
|
}) {
|
|
7662
|
-
const t = this.createQuery(
|
|
8149
|
+
const t = this.createQuery(as);
|
|
7663
8150
|
return this.executeQuery(t, {
|
|
7664
8151
|
bundle: e
|
|
7665
8152
|
});
|
|
@@ -7691,22 +8178,22 @@ class xr {
|
|
|
7691
8178
|
}) {
|
|
7692
8179
|
let a, c;
|
|
7693
8180
|
r = r || {};
|
|
7694
|
-
const u = this.createQuery(
|
|
8181
|
+
const u = this.createQuery(zs), l = await this.executeQuery(u, {
|
|
7695
8182
|
slug: e
|
|
7696
8183
|
}), h = C.get(l.data(), "0.fungibility") === "stackable";
|
|
7697
8184
|
if (!h && i !== null)
|
|
7698
|
-
throw new
|
|
7699
|
-
if (h && i === null && (i =
|
|
8185
|
+
throw new qe("Expected Batch ID = null for non-stackable tokens.");
|
|
8186
|
+
if (h && i === null && (i = he({})), s.length > 0) {
|
|
7700
8187
|
if (n > 0)
|
|
7701
|
-
throw new
|
|
8188
|
+
throw new We();
|
|
7702
8189
|
n = s.length, r.tokenUnits = JSON.stringify(s);
|
|
7703
8190
|
}
|
|
7704
|
-
t ? (Object.prototype.toString.call(t) === "[object String]" && (
|
|
8191
|
+
t ? (Object.prototype.toString.call(t) === "[object String]" && (_.isBundleHash(t) ? (a = "walletBundle", c = t) : t = _.create({
|
|
7705
8192
|
secret: t,
|
|
7706
8193
|
token: e
|
|
7707
|
-
})), t instanceof
|
|
8194
|
+
})), t instanceof _ && (a = "wallet", r.position = t.position, r.bundle = t.bundle, c = t.address)) : (a = "walletBundle", c = this.getBundle());
|
|
7708
8195
|
const p = await this.createMoleculeMutation({
|
|
7709
|
-
mutationClass:
|
|
8196
|
+
mutationClass: ks
|
|
7710
8197
|
});
|
|
7711
8198
|
return p.fillMolecule({
|
|
7712
8199
|
token: e,
|
|
@@ -7732,7 +8219,7 @@ class xr {
|
|
|
7732
8219
|
molecule: n = null
|
|
7733
8220
|
}) {
|
|
7734
8221
|
const s = await this.createMoleculeMutation({
|
|
7735
|
-
mutationClass:
|
|
8222
|
+
mutationClass: xs,
|
|
7736
8223
|
molecule: n
|
|
7737
8224
|
});
|
|
7738
8225
|
return s.fillMolecule({
|
|
@@ -7753,10 +8240,10 @@ class xr {
|
|
|
7753
8240
|
}) {
|
|
7754
8241
|
const t = await this.queryWallets({ token: e });
|
|
7755
8242
|
if (!t || !Array.isArray(t))
|
|
7756
|
-
throw new
|
|
8243
|
+
throw new vt();
|
|
7757
8244
|
t.forEach((s) => {
|
|
7758
8245
|
if (!s.isShadow())
|
|
7759
|
-
throw new
|
|
8246
|
+
throw new vt();
|
|
7760
8247
|
});
|
|
7761
8248
|
const n = [];
|
|
7762
8249
|
for (const s of t)
|
|
@@ -7792,15 +8279,15 @@ class xr {
|
|
|
7792
8279
|
}) {
|
|
7793
8280
|
if (s.length > 0) {
|
|
7794
8281
|
if (n > 0)
|
|
7795
|
-
throw new
|
|
8282
|
+
throw new We();
|
|
7796
8283
|
n = s.length;
|
|
7797
8284
|
}
|
|
7798
8285
|
if (i === null && (i = await this.querySourceWallet({
|
|
7799
8286
|
token: t,
|
|
7800
8287
|
amount: n
|
|
7801
|
-
})), i === null ||
|
|
8288
|
+
})), i === null || de.cmp(i.balance, n) < 0)
|
|
7802
8289
|
throw new Y();
|
|
7803
|
-
const a =
|
|
8290
|
+
const a = _.create({
|
|
7804
8291
|
bundle: e,
|
|
7805
8292
|
token: t
|
|
7806
8293
|
});
|
|
@@ -7817,7 +8304,7 @@ class xr {
|
|
|
7817
8304
|
sourceWallet: i,
|
|
7818
8305
|
remainderWallet: c
|
|
7819
8306
|
}), l = await this.createMoleculeMutation({
|
|
7820
|
-
mutationClass:
|
|
8307
|
+
mutationClass: _s,
|
|
7821
8308
|
molecule: u
|
|
7822
8309
|
});
|
|
7823
8310
|
return l.fillMolecule({
|
|
@@ -7850,7 +8337,7 @@ class xr {
|
|
|
7850
8337
|
sourceWallet: s,
|
|
7851
8338
|
remainderWallet: r
|
|
7852
8339
|
}), a = await this.createMoleculeMutation({
|
|
7853
|
-
mutationClass:
|
|
8340
|
+
mutationClass: tr,
|
|
7854
8341
|
molecule: i
|
|
7855
8342
|
});
|
|
7856
8343
|
return a.fillMolecule({
|
|
@@ -7883,7 +8370,7 @@ class xr {
|
|
|
7883
8370
|
sourceWallet: n,
|
|
7884
8371
|
remainderWallet: r
|
|
7885
8372
|
}), a = await this.createMoleculeMutation({
|
|
7886
|
-
mutationClass:
|
|
8373
|
+
mutationClass: nr,
|
|
7887
8374
|
molecule: i
|
|
7888
8375
|
}), c = {};
|
|
7889
8376
|
return c[this.getBundle()] = t, a.fillMolecule({
|
|
@@ -7913,7 +8400,7 @@ class xr {
|
|
|
7913
8400
|
const r = s.createRemainder(this.getSecret());
|
|
7914
8401
|
if (n.length > 0) {
|
|
7915
8402
|
if (t > 0)
|
|
7916
|
-
throw new
|
|
8403
|
+
throw new We();
|
|
7917
8404
|
t = n.length, s.splitUnits(
|
|
7918
8405
|
n,
|
|
7919
8406
|
r
|
|
@@ -7994,13 +8481,13 @@ class xr {
|
|
|
7994
8481
|
if (!i.includes(h))
|
|
7995
8482
|
throw new Y(`Fused token unit ID = ${h} does not found in the source wallet.`);
|
|
7996
8483
|
});
|
|
7997
|
-
const a =
|
|
8484
|
+
const a = _.create({
|
|
7998
8485
|
bundle: e,
|
|
7999
8486
|
token: t
|
|
8000
8487
|
});
|
|
8001
8488
|
a.initBatchId({ sourceWallet: r });
|
|
8002
8489
|
const c = r.createRemainder(this.getSecret());
|
|
8003
|
-
r.splitUnits(s, c), n.metas.fusedTokenUnits = r.getTokenUnitsData(), a.tokenUnits = [n];
|
|
8490
|
+
r.splitUnits(s, c), typeof n == "string" && (n = new me(n, n, {})), n.metas.fusedTokenUnits = r.getTokenUnitsData(), a.tokenUnits = [n];
|
|
8004
8491
|
const u = await this.createMolecule({
|
|
8005
8492
|
sourceWallet: r,
|
|
8006
8493
|
remainderWallet: c
|
|
@@ -8026,16 +8513,16 @@ class xr {
|
|
|
8026
8513
|
encrypt: t
|
|
8027
8514
|
}) {
|
|
8028
8515
|
this.setCellSlug(e);
|
|
8029
|
-
const n = new
|
|
8030
|
-
secret:
|
|
8516
|
+
const n = new _({
|
|
8517
|
+
secret: tt(await this.getFingerprint()),
|
|
8031
8518
|
token: "AUTH"
|
|
8032
|
-
}), s = await this.createQuery(
|
|
8519
|
+
}), s = await this.createQuery(Bs), r = {
|
|
8033
8520
|
cellSlug: e,
|
|
8034
8521
|
pubkey: n.pubkey,
|
|
8035
8522
|
encrypt: t
|
|
8036
8523
|
}, i = await s.execute({ variables: r });
|
|
8037
8524
|
if (i.success()) {
|
|
8038
|
-
const a =
|
|
8525
|
+
const a = xe.create({
|
|
8039
8526
|
token: i.token(),
|
|
8040
8527
|
expiresAt: i.time(),
|
|
8041
8528
|
pubkey: i.pubKey(),
|
|
@@ -8043,7 +8530,7 @@ class xr {
|
|
|
8043
8530
|
}, n);
|
|
8044
8531
|
this.setAuthToken(a);
|
|
8045
8532
|
} else
|
|
8046
|
-
throw new
|
|
8533
|
+
throw new xt(`KnishIOClient::requestGuestAuthToken() - Authorization attempt rejected by ledger. Reason: ${i.reason()}`);
|
|
8047
8534
|
return i;
|
|
8048
8535
|
}
|
|
8049
8536
|
/**
|
|
@@ -8058,20 +8545,20 @@ class xr {
|
|
|
8058
8545
|
encrypt: t
|
|
8059
8546
|
}) {
|
|
8060
8547
|
this.setSecret(e);
|
|
8061
|
-
const n = new
|
|
8548
|
+
const n = new _({
|
|
8062
8549
|
secret: e,
|
|
8063
8550
|
token: "AUTH"
|
|
8064
8551
|
}), s = await this.createMolecule({
|
|
8065
8552
|
secret: e,
|
|
8066
8553
|
sourceWallet: n
|
|
8067
8554
|
}), r = await this.createMoleculeMutation({
|
|
8068
|
-
mutationClass:
|
|
8555
|
+
mutationClass: ys,
|
|
8069
8556
|
molecule: s
|
|
8070
8557
|
});
|
|
8071
8558
|
r.fillMolecule({ meta: { encrypt: t ? "true" : "false" } });
|
|
8072
8559
|
const i = await r.execute({});
|
|
8073
8560
|
if (i.success()) {
|
|
8074
|
-
const a =
|
|
8561
|
+
const a = xe.create({
|
|
8075
8562
|
token: i.token(),
|
|
8076
8563
|
expiresAt: i.time(),
|
|
8077
8564
|
pubkey: i.pubKey(),
|
|
@@ -8079,7 +8566,7 @@ class xr {
|
|
|
8079
8566
|
}, n);
|
|
8080
8567
|
this.setAuthToken(a);
|
|
8081
8568
|
} else
|
|
8082
|
-
throw new
|
|
8569
|
+
throw new xt(`KnishIOClient::requestProfileAuthToken() - Authorization attempt rejected by ledger. Reason: ${i.reason()}`);
|
|
8083
8570
|
return i;
|
|
8084
8571
|
}
|
|
8085
8572
|
/**
|
|
@@ -8099,7 +8586,7 @@ class xr {
|
|
|
8099
8586
|
}) {
|
|
8100
8587
|
if (this.$__serverSdkVersion < 3)
|
|
8101
8588
|
return this.log("warn", "KnishIOClient::authorize() - Server SDK version does not require an authorization..."), null;
|
|
8102
|
-
e === null && t && (e =
|
|
8589
|
+
e === null && t && (e = tt(t)), n && this.setCellSlug(n), this.$__authInProcess = !0;
|
|
8103
8590
|
let r;
|
|
8104
8591
|
return e ? r = await this.requestProfileAuthToken({
|
|
8105
8592
|
secret: e,
|
|
@@ -8153,24 +8640,26 @@ class xr {
|
|
|
8153
8640
|
}
|
|
8154
8641
|
export {
|
|
8155
8642
|
g as Atom,
|
|
8156
|
-
|
|
8157
|
-
|
|
8158
|
-
|
|
8159
|
-
|
|
8160
|
-
|
|
8161
|
-
|
|
8162
|
-
|
|
8163
|
-
|
|
8164
|
-
|
|
8165
|
-
|
|
8166
|
-
|
|
8167
|
-
|
|
8168
|
-
|
|
8169
|
-
|
|
8170
|
-
|
|
8171
|
-
|
|
8172
|
-
|
|
8173
|
-
|
|
8174
|
-
|
|
8643
|
+
Tr as KnishIOClient,
|
|
8644
|
+
pe as Meta,
|
|
8645
|
+
z as Molecule,
|
|
8646
|
+
Os as MutationAppendRequest,
|
|
8647
|
+
Cs as MutationPeering,
|
|
8648
|
+
Mt as QueryMetaTypeViaMolecule,
|
|
8649
|
+
Es as ResponseAppendRequest,
|
|
8650
|
+
ot as ResponseMetaTypeViaMolecule,
|
|
8651
|
+
Ms as ResponsePeering,
|
|
8652
|
+
_ as Wallet,
|
|
8653
|
+
pn as base64ToHex,
|
|
8654
|
+
un as bufferToHexString,
|
|
8655
|
+
cn as charsetBaseConvert,
|
|
8656
|
+
He as chunkSubstr,
|
|
8657
|
+
fe as generateBundleHash,
|
|
8658
|
+
tt as generateSecret,
|
|
8659
|
+
hn as hexStringToBuffer,
|
|
8660
|
+
dn as hexToBase64,
|
|
8661
|
+
De as isHex,
|
|
8662
|
+
nt as randomString,
|
|
8663
|
+
lt as shake256
|
|
8175
8664
|
};
|
|
8176
8665
|
//# sourceMappingURL=client.es.mjs.map
|