@wishknish/knishio-client-js 0.8.2 → 0.9.0
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 +29 -102
- package/dist/client.cjs.js.map +1 -1
- package/dist/client.es.mjs +786 -758
- package/dist/client.es.mjs.map +1 -1
- package/dist/client.iife.js +29 -102
- package/dist/client.iife.js.map +1 -1
- package/package.json +1 -1
- package/src/KnishIOClient.js +112 -46
- package/src/Molecule.js +36 -30
- package/src/Wallet.js +86 -3
- package/src/index.js +0 -4
- package/src/libraries/urql/UrqlClientWrapper.js +88 -0
- package/src/mutation/MutationTransferTokens.js +18 -0
- package/src/query/QueryUserActivity.js +0 -151
- package/src/response/ResponseQueryUserActivity.js +0 -79
package/dist/client.es.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var Q = (o, e, t) =>
|
|
1
|
+
var tn = Object.defineProperty;
|
|
2
|
+
var nn = (o, e, t) => e in o ? tn(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
|
|
3
|
+
var Q = (o, e, t) => nn(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 sn, fetchExchange as rn, subscriptionExchange as on, createClient as an } from "@urql/core";
|
|
6
|
+
import { createClient as ln } from "graphql-ws";
|
|
7
|
+
import { pipe as cn, map as un, subscribe as hn } 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,7 +75,7 @@ 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 Be(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);
|
|
@@ -85,7 +85,7 @@ function st(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 dn(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 hn(o, e, t, n, s) {
|
|
|
98
98
|
}
|
|
99
99
|
return a || "0";
|
|
100
100
|
}
|
|
101
|
-
function dn(o) {
|
|
102
|
-
return qt.toHex(o, {});
|
|
103
|
-
}
|
|
104
101
|
function pn(o) {
|
|
105
|
-
return
|
|
102
|
+
return Wt.toHex(o, {});
|
|
106
103
|
}
|
|
107
104
|
function fn(o) {
|
|
108
|
-
|
|
109
|
-
return btoa(String.fromCharCode.apply(null, e));
|
|
105
|
+
return Wt.toUint8Array(o);
|
|
110
106
|
}
|
|
111
107
|
function mn(o) {
|
|
108
|
+
const e = fn(o);
|
|
109
|
+
return btoa(String.fromCharCode.apply(null, e));
|
|
110
|
+
}
|
|
111
|
+
function yn(o) {
|
|
112
112
|
const e = new Uint8Array(atob(o).split("").map((t) => t.charCodeAt(0)));
|
|
113
|
-
return
|
|
113
|
+
return pn(e);
|
|
114
114
|
}
|
|
115
115
|
function Ve(o) {
|
|
116
116
|
return /^[A-F0-9]+$/i.test(o);
|
|
117
117
|
}
|
|
118
|
-
function
|
|
118
|
+
function gn(o) {
|
|
119
119
|
return (typeof o == "number" || typeof o == "string" && o.trim() !== "") && !isNaN(o);
|
|
120
120
|
}
|
|
121
|
-
let
|
|
121
|
+
let de = class {
|
|
122
122
|
/**
|
|
123
123
|
* Normalizes the meta array into the standard {key: ..., value: ...} format
|
|
124
124
|
*
|
|
@@ -155,10 +155,10 @@ let pe = class {
|
|
|
155
155
|
return t;
|
|
156
156
|
}
|
|
157
157
|
};
|
|
158
|
-
function gn(o, e) {
|
|
159
|
-
return o.length ? [o.slice(0, e)].concat(gn(o.slice(e), e)) : [];
|
|
160
|
-
}
|
|
161
158
|
function bn(o, e) {
|
|
159
|
+
return o.length ? [o.slice(0, e)].concat(bn(o.slice(e), e)) : [];
|
|
160
|
+
}
|
|
161
|
+
function wn(o, e) {
|
|
162
162
|
let t, n, s;
|
|
163
163
|
const r = [Array, Date, Number, String, Boolean], i = Object.prototype.toString;
|
|
164
164
|
for (e = e || [], t = 0; t < e.length; t += 2)
|
|
@@ -168,11 +168,11 @@ function bn(o, e) {
|
|
|
168
168
|
i.call(o) === i.call(s = new r[t](o)) && (n = t ? s : []);
|
|
169
169
|
e.push(o, n);
|
|
170
170
|
for (t in o)
|
|
171
|
-
e.hasOwnProperty.call(o, t) && (n[t] =
|
|
171
|
+
e.hasOwnProperty.call(o, t) && (n[t] = wn(o[t], e));
|
|
172
172
|
}
|
|
173
173
|
return n || o;
|
|
174
174
|
}
|
|
175
|
-
function
|
|
175
|
+
function kn(...o) {
|
|
176
176
|
return [].concat(...o.map((e, t) => {
|
|
177
177
|
const n = o.slice(0);
|
|
178
178
|
n.splice(t, 1);
|
|
@@ -180,7 +180,7 @@ function wn(...o) {
|
|
|
180
180
|
return e.filter((r) => !s.includes(r));
|
|
181
181
|
}));
|
|
182
182
|
}
|
|
183
|
-
function
|
|
183
|
+
function me(...o) {
|
|
184
184
|
return o.reduce((e, t) => e.filter((n) => t.includes(n)));
|
|
185
185
|
}
|
|
186
186
|
class rt {
|
|
@@ -218,7 +218,7 @@ class rt {
|
|
|
218
218
|
})) {
|
|
219
219
|
const i = r.map((a) => a.key);
|
|
220
220
|
this.policy[s] || (this.policy[s] = {});
|
|
221
|
-
for (const a of
|
|
221
|
+
for (const a of kn(e, i))
|
|
222
222
|
this.policy[s][a] || (this.policy[s][a] = s === "write" && !["characters", "pubkey"].includes(a) ? ["self"] : ["all"]);
|
|
223
223
|
}
|
|
224
224
|
}
|
|
@@ -243,7 +243,7 @@ class P {
|
|
|
243
243
|
* @param {object|array} meta
|
|
244
244
|
*/
|
|
245
245
|
constructor(e = []) {
|
|
246
|
-
this.meta =
|
|
246
|
+
this.meta = de.normalizeMeta(e);
|
|
247
247
|
}
|
|
248
248
|
/**
|
|
249
249
|
*
|
|
@@ -251,7 +251,7 @@ class P {
|
|
|
251
251
|
* @returns {AtomMeta}
|
|
252
252
|
*/
|
|
253
253
|
merge(e) {
|
|
254
|
-
return this.meta = Array.from(/* @__PURE__ */ new Set([...this.meta, ...
|
|
254
|
+
return this.meta = Array.from(/* @__PURE__ */ new Set([...this.meta, ...de.normalizeMeta(e)])), this;
|
|
255
255
|
}
|
|
256
256
|
/**
|
|
257
257
|
*
|
|
@@ -419,7 +419,7 @@ class oe {
|
|
|
419
419
|
return oe.structure(this);
|
|
420
420
|
}
|
|
421
421
|
}
|
|
422
|
-
class
|
|
422
|
+
class _n extends oe {
|
|
423
423
|
constructor({
|
|
424
424
|
position: e = null,
|
|
425
425
|
walletAddress: t = null,
|
|
@@ -437,8 +437,8 @@ class kn extends oe {
|
|
|
437
437
|
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;
|
|
438
438
|
}
|
|
439
439
|
}
|
|
440
|
-
const
|
|
441
|
-
4:
|
|
440
|
+
const qe = {
|
|
441
|
+
4: _n
|
|
442
442
|
};
|
|
443
443
|
class g {
|
|
444
444
|
/**
|
|
@@ -471,7 +471,7 @@ class g {
|
|
|
471
471
|
index: h = null,
|
|
472
472
|
version: p = null
|
|
473
473
|
}) {
|
|
474
|
-
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 ?
|
|
474
|
+
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 ? de.normalizeMeta(u) : [], this.index = h, this.otsFragment = l, this.createdAt = String(+/* @__PURE__ */ new Date()), p !== null && Object.prototype.hasOwnProperty.call(qe, p) && (this.version = String(p));
|
|
475
475
|
}
|
|
476
476
|
/**
|
|
477
477
|
*
|
|
@@ -650,8 +650,8 @@ class g {
|
|
|
650
650
|
if (!(r instanceof g))
|
|
651
651
|
throw new ae();
|
|
652
652
|
return r;
|
|
653
|
-
}), s.every((r) => r.version && Object.prototype.hasOwnProperty.call(
|
|
654
|
-
n.update(JSON.stringify(s.map((r) =>
|
|
653
|
+
}), s.every((r) => r.version && Object.prototype.hasOwnProperty.call(qe, r.version)))
|
|
654
|
+
n.update(JSON.stringify(s.map((r) => qe[r.version].create(r).view())));
|
|
655
655
|
else {
|
|
656
656
|
const r = String(e.length);
|
|
657
657
|
let i = [];
|
|
@@ -666,7 +666,7 @@ class g {
|
|
|
666
666
|
case "array":
|
|
667
667
|
return n.getHash("ARRAYBUFFER", { outputLen: 256 });
|
|
668
668
|
default:
|
|
669
|
-
return
|
|
669
|
+
return dn(n.getHash("HEX", { outputLen: 256 }), 16, 17, "0123456789abcdef", "0123456789abcdefg").padStart(64, "0");
|
|
670
670
|
}
|
|
671
671
|
}
|
|
672
672
|
static jsonSerialization(e, t) {
|
|
@@ -687,7 +687,7 @@ class g {
|
|
|
687
687
|
* Get aggregated meta from stored normalized ones
|
|
688
688
|
*/
|
|
689
689
|
aggregatedMeta() {
|
|
690
|
-
return
|
|
690
|
+
return de.aggregateMeta(this.meta);
|
|
691
691
|
}
|
|
692
692
|
/**
|
|
693
693
|
*
|
|
@@ -714,21 +714,21 @@ function nt(o = null, e = 2048) {
|
|
|
714
714
|
} else
|
|
715
715
|
return st(e);
|
|
716
716
|
}
|
|
717
|
-
function
|
|
717
|
+
function pe(o, e = null) {
|
|
718
718
|
const t = new L("SHAKE256", "TEXT");
|
|
719
719
|
return t.update(o), t.getHash("HEX", { outputLen: 256 });
|
|
720
720
|
}
|
|
721
|
-
function
|
|
721
|
+
function ze(o, e) {
|
|
722
722
|
const t = new L("SHAKE256", "TEXT");
|
|
723
723
|
return t.update(o), t.getHash("HEX", { outputLen: e });
|
|
724
724
|
}
|
|
725
|
-
function
|
|
725
|
+
function He({
|
|
726
726
|
molecularHash: o = null,
|
|
727
727
|
index: e = null
|
|
728
728
|
}) {
|
|
729
|
-
return o !== null && e !== null ?
|
|
729
|
+
return o !== null && e !== null ? pe(String(o) + String(e), "generateBatchId") : st(64);
|
|
730
730
|
}
|
|
731
|
-
class
|
|
731
|
+
class fe {
|
|
732
732
|
/**
|
|
733
733
|
*
|
|
734
734
|
* @param id
|
|
@@ -745,7 +745,7 @@ class me {
|
|
|
745
745
|
*/
|
|
746
746
|
static createFromGraphQL(e) {
|
|
747
747
|
let t = e.metas || {};
|
|
748
|
-
return t.length && (t = JSON.parse(t), t || (t = {})), new
|
|
748
|
+
return t.length && (t = JSON.parse(t), t || (t = {})), new fe(
|
|
749
749
|
e.id,
|
|
750
750
|
e.name,
|
|
751
751
|
t
|
|
@@ -757,7 +757,7 @@ class me {
|
|
|
757
757
|
* @returns {TokenUnit}
|
|
758
758
|
*/
|
|
759
759
|
static createFromDB(e) {
|
|
760
|
-
return new
|
|
760
|
+
return new fe(
|
|
761
761
|
e[0],
|
|
762
762
|
e[1],
|
|
763
763
|
e.length > 2 ? e[2] : {}
|
|
@@ -795,7 +795,7 @@ class me {
|
|
|
795
795
|
};
|
|
796
796
|
}
|
|
797
797
|
}
|
|
798
|
-
class
|
|
798
|
+
class Je extends x {
|
|
799
799
|
/**
|
|
800
800
|
* Class constructor
|
|
801
801
|
*
|
|
@@ -807,39 +807,39 @@ class ze extends x {
|
|
|
807
807
|
super(e, t, n), this.name = "WalletCredentialException";
|
|
808
808
|
}
|
|
809
809
|
}
|
|
810
|
-
const Ce = /* @__PURE__ */ BigInt(2 ** 32 - 1),
|
|
811
|
-
function _n(o, e = !1) {
|
|
812
|
-
return e ? { h: Number(o & Ce), l: Number(o >> ct & Ce) } : { h: Number(o >> ct & Ce) | 0, l: Number(o & Ce) | 0 };
|
|
813
|
-
}
|
|
810
|
+
const Ce = /* @__PURE__ */ BigInt(2 ** 32 - 1), lt = /* @__PURE__ */ BigInt(32);
|
|
814
811
|
function Sn(o, e = !1) {
|
|
812
|
+
return e ? { h: Number(o & Ce), l: Number(o >> lt & Ce) } : { h: Number(o >> lt & Ce) | 0, l: Number(o & Ce) | 0 };
|
|
813
|
+
}
|
|
814
|
+
function $n(o, e = !1) {
|
|
815
815
|
const t = o.length;
|
|
816
816
|
let n = new Uint32Array(t), s = new Uint32Array(t);
|
|
817
817
|
for (let r = 0; r < t; r++) {
|
|
818
|
-
const { h: i, l: a } =
|
|
818
|
+
const { h: i, l: a } = Sn(o[r], e);
|
|
819
819
|
[n[r], s[r]] = [i, a];
|
|
820
820
|
}
|
|
821
821
|
return [n, s];
|
|
822
822
|
}
|
|
823
|
-
const
|
|
823
|
+
const An = (o, e, t) => o << t | e >>> 32 - t, vn = (o, e, t) => e << t | o >>> 32 - t, xn = (o, e, t) => e << t - 32 | o >>> 64 - t, In = (o, e, t) => o << t - 32 | e >>> 64 - t;
|
|
824
824
|
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
825
|
-
function
|
|
825
|
+
function Mn(o) {
|
|
826
826
|
return o instanceof Uint8Array || ArrayBuffer.isView(o) && o.constructor.name === "Uint8Array";
|
|
827
827
|
}
|
|
828
|
-
function
|
|
828
|
+
function ct(o, e = "") {
|
|
829
829
|
if (!Number.isSafeInteger(o) || o < 0) {
|
|
830
830
|
const t = e && `"${e}" `;
|
|
831
831
|
throw new Error(`${t}expected integer >= 0, got ${o}`);
|
|
832
832
|
}
|
|
833
833
|
}
|
|
834
834
|
function D(o, e, t = "") {
|
|
835
|
-
const n =
|
|
835
|
+
const n = Mn(o), s = o == null ? void 0 : o.length, r = e !== void 0;
|
|
836
836
|
if (!n || r && s !== e) {
|
|
837
837
|
const i = t && `"${t}" `, a = r ? ` of length ${e}` : "", c = n ? `length=${s}` : `type=${typeof o}`;
|
|
838
838
|
throw new Error(i + "expected Uint8Array" + a + ", got " + c);
|
|
839
839
|
}
|
|
840
840
|
return o;
|
|
841
841
|
}
|
|
842
|
-
function
|
|
842
|
+
function ut(o, e = !0) {
|
|
843
843
|
if (o.destroyed)
|
|
844
844
|
throw new Error("Hash instance has been destroyed");
|
|
845
845
|
if (e && o.finished)
|
|
@@ -851,28 +851,28 @@ function Tn(o, e) {
|
|
|
851
851
|
if (o.length < t)
|
|
852
852
|
throw new Error('"digestInto() output" expected to be of length >=' + t);
|
|
853
853
|
}
|
|
854
|
-
function
|
|
854
|
+
function Ut(o) {
|
|
855
855
|
return new Uint32Array(o.buffer, o.byteOffset, Math.floor(o.byteLength / 4));
|
|
856
856
|
}
|
|
857
|
-
function
|
|
857
|
+
function Bt(...o) {
|
|
858
858
|
for (let e = 0; e < o.length; e++)
|
|
859
859
|
o[e].fill(0);
|
|
860
860
|
}
|
|
861
|
-
const
|
|
862
|
-
function
|
|
861
|
+
const Cn = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
|
862
|
+
function En(o) {
|
|
863
863
|
return o << 24 & 4278190080 | o << 8 & 16711680 | o >>> 8 & 65280 | o >>> 24 & 255;
|
|
864
864
|
}
|
|
865
|
-
function
|
|
865
|
+
function On(o) {
|
|
866
866
|
for (let e = 0; e < o.length; e++)
|
|
867
|
-
o[e] =
|
|
867
|
+
o[e] = En(o[e]);
|
|
868
868
|
return o;
|
|
869
869
|
}
|
|
870
|
-
const
|
|
871
|
-
function
|
|
870
|
+
const ht = Cn ? (o) => o : On;
|
|
871
|
+
function Ht(o, e = {}) {
|
|
872
872
|
const t = (s, r) => o(r).update(s).digest(), n = o(void 0);
|
|
873
873
|
return t.outputLen = n.outputLen, t.blockLen = n.blockLen, t.create = (s) => o(s), Object.assign(t, e), Object.freeze(t);
|
|
874
874
|
}
|
|
875
|
-
function
|
|
875
|
+
function Rn(o = 32) {
|
|
876
876
|
const e = typeof globalThis == "object" ? globalThis.crypto : null;
|
|
877
877
|
if (typeof (e == null ? void 0 : e.getRandomValues) != "function")
|
|
878
878
|
throw new Error("crypto.getRandomValues must be defined");
|
|
@@ -880,28 +880,28 @@ function On(o = 32) {
|
|
|
880
880
|
}
|
|
881
881
|
const Ne = (o) => ({
|
|
882
882
|
oid: Uint8Array.from([6, 9, 96, 134, 72, 1, 101, 3, 4, 2, o])
|
|
883
|
-
}),
|
|
884
|
-
for (let o = 0, e =
|
|
885
|
-
[t, n] = [n, (2 * t + 3 * n) % 5],
|
|
886
|
-
let s =
|
|
883
|
+
}), qn = BigInt(0), ye = BigInt(1), Wn = BigInt(2), Un = BigInt(7), Bn = BigInt(256), Hn = BigInt(113), Pt = [], Kt = [], Nt = [];
|
|
884
|
+
for (let o = 0, e = ye, t = 1, n = 0; o < 24; o++) {
|
|
885
|
+
[t, n] = [n, (2 * t + 3 * n) % 5], Pt.push(2 * (5 * n + t)), Kt.push((o + 1) * (o + 2) / 2 % 64);
|
|
886
|
+
let s = qn;
|
|
887
887
|
for (let r = 0; r < 7; r++)
|
|
888
|
-
e = (e <<
|
|
889
|
-
|
|
888
|
+
e = (e << ye ^ (e >> Un) * Hn) % Bn, e & Wn && (s ^= ye << (ye << BigInt(r)) - ye);
|
|
889
|
+
Nt.push(s);
|
|
890
890
|
}
|
|
891
|
-
const
|
|
892
|
-
function
|
|
891
|
+
const Ft = $n(Nt, !0), Pn = Ft[0], Kn = Ft[1], dt = (o, e, t) => t > 32 ? xn(o, e, t) : An(o, e, t), pt = (o, e, t) => t > 32 ? In(o, e, t) : vn(o, e, t);
|
|
892
|
+
function Nn(o, e = 24) {
|
|
893
893
|
const t = new Uint32Array(10);
|
|
894
894
|
for (let n = 24 - e; n < 24; n++) {
|
|
895
895
|
for (let i = 0; i < 10; i++)
|
|
896
896
|
t[i] = o[i] ^ o[i + 10] ^ o[i + 20] ^ o[i + 30] ^ o[i + 40];
|
|
897
897
|
for (let i = 0; i < 10; i += 2) {
|
|
898
|
-
const a = (i + 8) % 10, c = (i + 2) % 10, u = t[c], l = t[c + 1], h =
|
|
898
|
+
const a = (i + 8) % 10, c = (i + 2) % 10, u = t[c], l = t[c + 1], h = dt(u, l, 1) ^ t[a], p = pt(u, l, 1) ^ t[a + 1];
|
|
899
899
|
for (let d = 0; d < 50; d += 10)
|
|
900
900
|
o[i + d] ^= h, o[i + d + 1] ^= p;
|
|
901
901
|
}
|
|
902
902
|
let s = o[2], r = o[3];
|
|
903
903
|
for (let i = 0; i < 24; i++) {
|
|
904
|
-
const a =
|
|
904
|
+
const a = Kt[i], c = dt(s, r, a), u = pt(s, r, a), l = Pt[i];
|
|
905
905
|
s = o[l], r = o[l + 1], o[l] = c, o[l + 1] = u;
|
|
906
906
|
}
|
|
907
907
|
for (let i = 0; i < 50; i += 10) {
|
|
@@ -910,9 +910,9 @@ function Kn(o, e = 24) {
|
|
|
910
910
|
for (let a = 0; a < 10; a++)
|
|
911
911
|
o[i + a] ^= ~t[(a + 2) % 10] & t[(a + 4) % 10];
|
|
912
912
|
}
|
|
913
|
-
o[0] ^=
|
|
913
|
+
o[0] ^= Pn[n], o[1] ^= Kn[n];
|
|
914
914
|
}
|
|
915
|
-
|
|
915
|
+
Bt(t);
|
|
916
916
|
}
|
|
917
917
|
class Fe {
|
|
918
918
|
// NOTE: we accept arguments in bytes instead of bits here.
|
|
@@ -928,18 +928,18 @@ class Fe {
|
|
|
928
928
|
Q(this, "outputLen");
|
|
929
929
|
Q(this, "enableXOF", !1);
|
|
930
930
|
Q(this, "rounds");
|
|
931
|
-
if (this.blockLen = e, this.suffix = t, this.outputLen = n, this.enableXOF = s, this.rounds = r,
|
|
931
|
+
if (this.blockLen = e, this.suffix = t, this.outputLen = n, this.enableXOF = s, this.rounds = r, ct(n, "outputLen"), !(0 < e && e < 200))
|
|
932
932
|
throw new Error("only keccak-f1600 function is supported");
|
|
933
|
-
this.state = new Uint8Array(200), this.state32 =
|
|
933
|
+
this.state = new Uint8Array(200), this.state32 = Ut(this.state);
|
|
934
934
|
}
|
|
935
935
|
clone() {
|
|
936
936
|
return this._cloneInto();
|
|
937
937
|
}
|
|
938
938
|
keccak() {
|
|
939
|
-
|
|
939
|
+
ht(this.state32), Nn(this.state32, this.rounds), ht(this.state32), this.posOut = 0, this.pos = 0;
|
|
940
940
|
}
|
|
941
941
|
update(e) {
|
|
942
|
-
|
|
942
|
+
ut(this), D(e);
|
|
943
943
|
const { blockLen: t, state: n } = this, s = e.length;
|
|
944
944
|
for (let r = 0; r < s; ) {
|
|
945
945
|
const i = Math.min(t - this.pos, s - r);
|
|
@@ -957,7 +957,7 @@ class Fe {
|
|
|
957
957
|
e[n] ^= t, (t & 128) !== 0 && n === s - 1 && this.keccak(), e[s - 1] ^= 128, this.keccak();
|
|
958
958
|
}
|
|
959
959
|
writeInto(e) {
|
|
960
|
-
|
|
960
|
+
ut(this, !1), D(e), this.finish();
|
|
961
961
|
const t = this.state, { blockLen: n } = this;
|
|
962
962
|
for (let s = 0, r = e.length; s < r; ) {
|
|
963
963
|
this.posOut >= n && this.keccak();
|
|
@@ -972,7 +972,7 @@ class Fe {
|
|
|
972
972
|
return this.writeInto(e);
|
|
973
973
|
}
|
|
974
974
|
xof(e) {
|
|
975
|
-
return
|
|
975
|
+
return ct(e), this.xofInto(new Uint8Array(e));
|
|
976
976
|
}
|
|
977
977
|
digestInto(e) {
|
|
978
978
|
if (Tn(e, this), this.finished)
|
|
@@ -983,49 +983,49 @@ class Fe {
|
|
|
983
983
|
return this.digestInto(new Uint8Array(this.outputLen));
|
|
984
984
|
}
|
|
985
985
|
destroy() {
|
|
986
|
-
this.destroyed = !0,
|
|
986
|
+
this.destroyed = !0, Bt(this.state);
|
|
987
987
|
}
|
|
988
988
|
_cloneInto(e) {
|
|
989
989
|
const { blockLen: t, suffix: n, outputLen: s, rounds: r, enableXOF: i } = this;
|
|
990
990
|
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;
|
|
991
991
|
}
|
|
992
992
|
}
|
|
993
|
-
const
|
|
993
|
+
const Lt = (o, e, t, n = {}) => Ht(() => new Fe(e, o, t), n), Fn = /* @__PURE__ */ Lt(
|
|
994
994
|
6,
|
|
995
995
|
136,
|
|
996
996
|
32,
|
|
997
997
|
/* @__PURE__ */ Ne(8)
|
|
998
|
-
),
|
|
998
|
+
), Ln = /* @__PURE__ */ Lt(
|
|
999
999
|
6,
|
|
1000
1000
|
72,
|
|
1001
1001
|
64,
|
|
1002
1002
|
/* @__PURE__ */ Ne(10)
|
|
1003
|
-
),
|
|
1003
|
+
), Qt = (o, e, t, n = {}) => Ht((s = {}) => new Fe(e, o, s.dkLen === void 0 ? t : s.dkLen, !0), n), Qn = /* @__PURE__ */ Qt(31, 168, 16, /* @__PURE__ */ Ne(11)), jt = /* @__PURE__ */ Qt(31, 136, 32, /* @__PURE__ */ Ne(12));
|
|
1004
1004
|
function it(o) {
|
|
1005
1005
|
if (!Number.isSafeInteger(o) || o < 0 || o > 4294967295)
|
|
1006
1006
|
throw new Error("wrong u32 integer:" + o);
|
|
1007
1007
|
return o;
|
|
1008
1008
|
}
|
|
1009
|
-
function
|
|
1009
|
+
function Dt(o) {
|
|
1010
1010
|
return it(o), (o & o - 1) === 0 && o !== 0;
|
|
1011
1011
|
}
|
|
1012
|
-
function
|
|
1012
|
+
function Vt(o, e) {
|
|
1013
1013
|
it(o);
|
|
1014
1014
|
let t = 0;
|
|
1015
1015
|
for (let n = 0; n < e; n++, o >>>= 1)
|
|
1016
1016
|
t = t << 1 | o & 1;
|
|
1017
1017
|
return t;
|
|
1018
1018
|
}
|
|
1019
|
-
function
|
|
1019
|
+
function zt(o) {
|
|
1020
1020
|
return it(o), 31 - Math.clz32(o);
|
|
1021
1021
|
}
|
|
1022
|
-
function
|
|
1022
|
+
function ft(o) {
|
|
1023
1023
|
const e = o.length;
|
|
1024
|
-
if (e < 2 || !
|
|
1024
|
+
if (e < 2 || !Dt(e))
|
|
1025
1025
|
throw new Error("n must be a power of 2 and greater than 1. Got " + e);
|
|
1026
|
-
const t =
|
|
1026
|
+
const t = zt(e);
|
|
1027
1027
|
for (let n = 0; n < e; n++) {
|
|
1028
|
-
const s =
|
|
1028
|
+
const s = Vt(n, t);
|
|
1029
1029
|
if (n < s) {
|
|
1030
1030
|
const r = o[n];
|
|
1031
1031
|
o[n] = o[s], o[s] = r;
|
|
@@ -1033,32 +1033,32 @@ function mt(o) {
|
|
|
1033
1033
|
}
|
|
1034
1034
|
return o;
|
|
1035
1035
|
}
|
|
1036
|
-
const
|
|
1037
|
-
const { N: t, roots: n, dit: s, invertButterflies: r = !1, skipStages: i = 0, brp: a = !0 } = e, c =
|
|
1038
|
-
if (!
|
|
1036
|
+
const mt = (o, e) => {
|
|
1037
|
+
const { N: t, roots: n, dit: s, invertButterflies: r = !1, skipStages: i = 0, brp: a = !0 } = e, c = zt(t);
|
|
1038
|
+
if (!Dt(t))
|
|
1039
1039
|
throw new Error("FFT: Polynomial size should be power of two");
|
|
1040
1040
|
const u = s !== r;
|
|
1041
1041
|
return (l) => {
|
|
1042
1042
|
if (l.length !== t)
|
|
1043
1043
|
throw new Error("FFT: wrong Polynomial length");
|
|
1044
|
-
s && a &&
|
|
1044
|
+
s && a && ft(l);
|
|
1045
1045
|
for (let h = 0, p = 1; h < c - i; h++) {
|
|
1046
1046
|
const d = s ? h + 1 + i : c - h, b = 1 << d, A = b >> 1, O = t >> d;
|
|
1047
1047
|
for (let f = 0; f < t; f += b)
|
|
1048
1048
|
for (let m = 0, w = p++; m < A; m++) {
|
|
1049
|
-
const
|
|
1049
|
+
const T = r ? s ? t - w : w : m * O, k = f + m, $ = f + m + A, v = n[T], I = l[$], _ = l[k];
|
|
1050
1050
|
if (u) {
|
|
1051
1051
|
const U = o.mul(I, v);
|
|
1052
1052
|
l[k] = o.add(_, U), l[$] = o.sub(_, U);
|
|
1053
1053
|
} else r ? (l[k] = o.add(I, _), l[$] = o.mul(o.sub(I, _), v)) : (l[k] = o.add(_, I), l[$] = o.mul(o.sub(_, I), v));
|
|
1054
1054
|
}
|
|
1055
1055
|
}
|
|
1056
|
-
return !s && a &&
|
|
1056
|
+
return !s && a && ft(l), l;
|
|
1057
1057
|
};
|
|
1058
1058
|
};
|
|
1059
1059
|
/*! noble-post-quantum - MIT License (c) 2024 Paul Miller (paulmillr.com) */
|
|
1060
|
-
const
|
|
1061
|
-
function
|
|
1060
|
+
const yt = Rn;
|
|
1061
|
+
function Ge(o, e) {
|
|
1062
1062
|
if (o.length !== e.length)
|
|
1063
1063
|
return !1;
|
|
1064
1064
|
let t = 0;
|
|
@@ -1066,10 +1066,10 @@ function Je(o, e) {
|
|
|
1066
1066
|
t |= o[n] ^ e[n];
|
|
1067
1067
|
return t === 0;
|
|
1068
1068
|
}
|
|
1069
|
-
function
|
|
1069
|
+
function jn(o) {
|
|
1070
1070
|
return Uint8Array.from(o);
|
|
1071
1071
|
}
|
|
1072
|
-
function
|
|
1072
|
+
function We(o, ...e) {
|
|
1073
1073
|
const t = (s) => typeof s == "number" ? s : s.bytesLen, n = e.reduce((s, r) => s + t(r), 0);
|
|
1074
1074
|
return {
|
|
1075
1075
|
bytesLen: n,
|
|
@@ -1092,7 +1092,7 @@ function Ue(o, ...e) {
|
|
|
1092
1092
|
}
|
|
1093
1093
|
};
|
|
1094
1094
|
}
|
|
1095
|
-
function
|
|
1095
|
+
function Xe(o, e) {
|
|
1096
1096
|
const t = e * o.bytesLen;
|
|
1097
1097
|
return {
|
|
1098
1098
|
bytesLen: t,
|
|
@@ -1115,7 +1115,7 @@ function Ge(o, e) {
|
|
|
1115
1115
|
}
|
|
1116
1116
|
};
|
|
1117
1117
|
}
|
|
1118
|
-
function
|
|
1118
|
+
function X(...o) {
|
|
1119
1119
|
for (const e of o)
|
|
1120
1120
|
if (Array.isArray(e))
|
|
1121
1121
|
for (const t of e)
|
|
@@ -1123,11 +1123,11 @@ function G(...o) {
|
|
|
1123
1123
|
else
|
|
1124
1124
|
e.fill(0);
|
|
1125
1125
|
}
|
|
1126
|
-
function
|
|
1126
|
+
function gt(o) {
|
|
1127
1127
|
return (1 << o) - 1;
|
|
1128
1128
|
}
|
|
1129
1129
|
/*! noble-post-quantum - MIT License (c) 2024 Paul Miller (paulmillr.com) */
|
|
1130
|
-
const
|
|
1130
|
+
const Dn = (o) => {
|
|
1131
1131
|
const { newPoly: e, N: t, Q: n, F: s, ROOT_OF_UNITY: r, brvBits: i } = o, a = (f, m = n) => {
|
|
1132
1132
|
const w = f % m | 0;
|
|
1133
1133
|
return (w >= 0 ? w | 0 : m + w | 0) | 0;
|
|
@@ -1138,8 +1138,8 @@ const jn = (o) => {
|
|
|
1138
1138
|
function u() {
|
|
1139
1139
|
const f = e(t);
|
|
1140
1140
|
for (let m = 0; m < t; m++) {
|
|
1141
|
-
const w =
|
|
1142
|
-
f[m] = Number(
|
|
1141
|
+
const w = Vt(m, i), T = BigInt(r) ** BigInt(w) % BigInt(n);
|
|
1142
|
+
f[m] = Number(T) | 0;
|
|
1143
1143
|
}
|
|
1144
1144
|
return f;
|
|
1145
1145
|
}
|
|
@@ -1156,7 +1156,7 @@ const jn = (o) => {
|
|
|
1156
1156
|
invertButterflies: !0,
|
|
1157
1157
|
skipStages: 1,
|
|
1158
1158
|
brp: !1
|
|
1159
|
-
}, d =
|
|
1159
|
+
}, d = mt(h, { dit: !1, ...p }), b = mt(h, { dit: !0, ...p });
|
|
1160
1160
|
return { mod: a, smod: c, nttZetas: l, NTT: {
|
|
1161
1161
|
encode: (f) => d(f),
|
|
1162
1162
|
decode: (f) => {
|
|
@@ -1166,14 +1166,14 @@ const jn = (o) => {
|
|
|
1166
1166
|
return f;
|
|
1167
1167
|
}
|
|
1168
1168
|
}, bitsCoder: (f, m) => {
|
|
1169
|
-
const w =
|
|
1169
|
+
const w = gt(f), T = f * (t / 8);
|
|
1170
1170
|
return {
|
|
1171
|
-
bytesLen:
|
|
1171
|
+
bytesLen: T,
|
|
1172
1172
|
encode: (k) => {
|
|
1173
|
-
const $ = new Uint8Array(
|
|
1173
|
+
const $ = new Uint8Array(T);
|
|
1174
1174
|
for (let v = 0, I = 0, _ = 0, U = 0; v < k.length; v++)
|
|
1175
1175
|
for (I |= (m.encode(k[v]) & w) << _, _ += f; _ >= 8; _ -= 8, I >>= 8)
|
|
1176
|
-
$[U++] = I &
|
|
1176
|
+
$[U++] = I & gt(_);
|
|
1177
1177
|
return $;
|
|
1178
1178
|
},
|
|
1179
1179
|
decode: (k) => {
|
|
@@ -1185,7 +1185,7 @@ const jn = (o) => {
|
|
|
1185
1185
|
}
|
|
1186
1186
|
};
|
|
1187
1187
|
} };
|
|
1188
|
-
},
|
|
1188
|
+
}, Vn = (o) => (e, t) => {
|
|
1189
1189
|
t || (t = o.blockLen);
|
|
1190
1190
|
const n = new Uint8Array(e.length + 2);
|
|
1191
1191
|
n.set(e);
|
|
@@ -1195,21 +1195,21 @@ const jn = (o) => {
|
|
|
1195
1195
|
stats: () => ({ calls: a, xofs: c }),
|
|
1196
1196
|
get: (u, l) => (n[s + 0] = u, n[s + 1] = l, i.destroy(), i = o.create({}).update(n), a++, () => (c++, i.xofInto(r))),
|
|
1197
1197
|
clean: () => {
|
|
1198
|
-
i.destroy(),
|
|
1198
|
+
i.destroy(), X(r, n);
|
|
1199
1199
|
}
|
|
1200
1200
|
};
|
|
1201
|
-
},
|
|
1201
|
+
}, zn = /* @__PURE__ */ Vn(Qn);
|
|
1202
1202
|
/*! noble-post-quantum - MIT License (c) 2024 Paul Miller (paulmillr.com) */
|
|
1203
|
-
const F = 256, le = 3329,
|
|
1203
|
+
const F = 256, le = 3329, Jn = 3303, Gn = 17, { mod: $e, nttZetas: Xn, NTT: ne, bitsCoder: Zn } = Dn({
|
|
1204
1204
|
N: F,
|
|
1205
1205
|
Q: le,
|
|
1206
|
-
F:
|
|
1207
|
-
ROOT_OF_UNITY:
|
|
1206
|
+
F: Jn,
|
|
1207
|
+
ROOT_OF_UNITY: Gn,
|
|
1208
1208
|
newPoly: (o) => new Uint16Array(o),
|
|
1209
1209
|
brvBits: 7
|
|
1210
|
-
}),
|
|
1210
|
+
}), Yn = {
|
|
1211
1211
|
768: { N: F, Q: le, K: 3, ETA1: 2, ETA2: 2, du: 10, dv: 4, RBGstrength: 192 }
|
|
1212
|
-
},
|
|
1212
|
+
}, es = (o) => {
|
|
1213
1213
|
if (o >= 12)
|
|
1214
1214
|
return { encode: (t) => t, decode: (t) => t };
|
|
1215
1215
|
const e = 2 ** (o - 1);
|
|
@@ -1219,29 +1219,29 @@ const F = 256, le = 3329, zn = 3303, Jn = 17, { mod: $e, nttZetas: Gn, NTT: ne,
|
|
|
1219
1219
|
// const decompress = (i: number) => round((Q / 2 ** d) * i);
|
|
1220
1220
|
decode: (t) => t * le + e >>> o
|
|
1221
1221
|
};
|
|
1222
|
-
},
|
|
1222
|
+
}, ge = (o) => Zn(o, es(o));
|
|
1223
1223
|
function se(o, e) {
|
|
1224
1224
|
for (let t = 0; t < F; t++)
|
|
1225
1225
|
o[t] = $e(o[t] + e[t]);
|
|
1226
1226
|
}
|
|
1227
|
-
function
|
|
1227
|
+
function ts(o, e) {
|
|
1228
1228
|
for (let t = 0; t < F; t++)
|
|
1229
1229
|
o[t] = $e(o[t] - e[t]);
|
|
1230
1230
|
}
|
|
1231
|
-
function
|
|
1231
|
+
function ns(o, e, t, n, s) {
|
|
1232
1232
|
const r = $e(e * n * s + o * t), i = $e(o * n + e * t);
|
|
1233
1233
|
return { c0: r, c1: i };
|
|
1234
1234
|
}
|
|
1235
1235
|
function Ee(o, e) {
|
|
1236
1236
|
for (let t = 0; t < F / 2; t++) {
|
|
1237
|
-
let n =
|
|
1237
|
+
let n = Xn[64 + (t >> 1)];
|
|
1238
1238
|
t & 1 && (n = -n);
|
|
1239
|
-
const { c0: s, c1: r } =
|
|
1239
|
+
const { c0: s, c1: r } = ns(o[2 * t + 0], o[2 * t + 1], e[2 * t + 0], e[2 * t + 1], n);
|
|
1240
1240
|
o[2 * t + 0] = s, o[2 * t + 1] = r;
|
|
1241
1241
|
}
|
|
1242
1242
|
return o;
|
|
1243
1243
|
}
|
|
1244
|
-
function
|
|
1244
|
+
function bt(o) {
|
|
1245
1245
|
const e = new Uint16Array(F);
|
|
1246
1246
|
for (let t = 0; t < F; ) {
|
|
1247
1247
|
const n = o();
|
|
@@ -1254,8 +1254,8 @@ function wt(o) {
|
|
|
1254
1254
|
}
|
|
1255
1255
|
return e;
|
|
1256
1256
|
}
|
|
1257
|
-
function
|
|
1258
|
-
const s = o(n * F / 4, e, t), r = new Uint16Array(F), i =
|
|
1257
|
+
function be(o, e, t, n) {
|
|
1258
|
+
const s = o(n * F / 4, e, t), r = new Uint16Array(F), i = Ut(s);
|
|
1259
1259
|
let a = 0;
|
|
1260
1260
|
for (let c = 0, u = 0, l = 0, h = 0; c < i.length; c++) {
|
|
1261
1261
|
let p = i[c];
|
|
@@ -1266,8 +1266,8 @@ function we(o, e, t, n) {
|
|
|
1266
1266
|
throw new Error(`sampleCBD: leftover bits: ${a}`);
|
|
1267
1267
|
return r;
|
|
1268
1268
|
}
|
|
1269
|
-
const
|
|
1270
|
-
const { K: e, PRF: t, XOF: n, HASH512: s, ETA1: r, ETA2: i, du: a, dv: c } = o, u =
|
|
1269
|
+
const ss = (o) => {
|
|
1270
|
+
const { K: e, PRF: t, XOF: n, HASH512: s, ETA1: r, ETA2: i, du: a, dv: c } = o, u = ge(1), l = ge(c), h = ge(a), p = We("publicKey", Xe(ge(12), e), 32), d = Xe(ge(12), e), b = We("ciphertext", Xe(h, e), l), A = We("seed", 32, 32);
|
|
1271
1271
|
return {
|
|
1272
1272
|
secretCoder: d,
|
|
1273
1273
|
lengths: {
|
|
@@ -1279,15 +1279,15 @@ const ns = (o) => {
|
|
|
1279
1279
|
D(O, 32, "seed");
|
|
1280
1280
|
const f = new Uint8Array(33);
|
|
1281
1281
|
f.set(O), f[32] = e;
|
|
1282
|
-
const m = s(f), [w,
|
|
1282
|
+
const m = s(f), [w, T] = A.decode(m), k = [], $ = [];
|
|
1283
1283
|
for (let _ = 0; _ < e; _++)
|
|
1284
|
-
k.push(ne.encode(
|
|
1284
|
+
k.push(ne.encode(be(t, T, _, r)));
|
|
1285
1285
|
const v = n(w);
|
|
1286
1286
|
for (let _ = 0; _ < e; _++) {
|
|
1287
|
-
const U = ne.encode(
|
|
1287
|
+
const U = ne.encode(be(t, T, e + _, r));
|
|
1288
1288
|
for (let R = 0; R < e; R++) {
|
|
1289
|
-
const
|
|
1290
|
-
se(U, Ee(
|
|
1289
|
+
const ue = bt(v.get(R, _));
|
|
1290
|
+
se(U, Ee(ue, k[R]));
|
|
1291
1291
|
}
|
|
1292
1292
|
$.push(U);
|
|
1293
1293
|
}
|
|
@@ -1296,37 +1296,37 @@ const ns = (o) => {
|
|
|
1296
1296
|
publicKey: p.encode([$, w]),
|
|
1297
1297
|
secretKey: d.encode(k)
|
|
1298
1298
|
};
|
|
1299
|
-
return
|
|
1299
|
+
return X(w, T, k, $, f, m), I;
|
|
1300
1300
|
},
|
|
1301
1301
|
encrypt: (O, f, m) => {
|
|
1302
|
-
const [w,
|
|
1302
|
+
const [w, T] = p.decode(O), k = [];
|
|
1303
1303
|
for (let R = 0; R < e; R++)
|
|
1304
|
-
k.push(ne.encode(
|
|
1305
|
-
const $ = n(
|
|
1304
|
+
k.push(ne.encode(be(t, m, R, r)));
|
|
1305
|
+
const $ = n(T), v = new Uint16Array(F), I = [];
|
|
1306
1306
|
for (let R = 0; R < e; R++) {
|
|
1307
|
-
const
|
|
1308
|
-
for (let
|
|
1309
|
-
const
|
|
1310
|
-
se(De, Ee(
|
|
1307
|
+
const ue = be(t, m, e + R, i), De = new Uint16Array(F);
|
|
1308
|
+
for (let Te = 0; Te < e; Te++) {
|
|
1309
|
+
const en = bt($.get(R, Te));
|
|
1310
|
+
se(De, Ee(en, k[Te]));
|
|
1311
1311
|
}
|
|
1312
|
-
se(
|
|
1312
|
+
se(ue, ne.decode(De)), I.push(ue), se(v, Ee(w[R], k[R])), X(De);
|
|
1313
1313
|
}
|
|
1314
1314
|
$.clean();
|
|
1315
|
-
const _ =
|
|
1315
|
+
const _ = be(t, m, 2 * e, i);
|
|
1316
1316
|
se(_, ne.decode(v));
|
|
1317
1317
|
const U = u.decode(f);
|
|
1318
|
-
return se(U, _),
|
|
1318
|
+
return se(U, _), X(w, k, v, _), b.encode([I, U]);
|
|
1319
1319
|
},
|
|
1320
1320
|
decrypt: (O, f) => {
|
|
1321
|
-
const [m, w] = b.decode(O),
|
|
1321
|
+
const [m, w] = b.decode(O), T = d.decode(f), k = new Uint16Array(F);
|
|
1322
1322
|
for (let $ = 0; $ < e; $++)
|
|
1323
|
-
se(k, Ee(
|
|
1324
|
-
return
|
|
1323
|
+
se(k, Ee(T[$], ne.encode(m[$])));
|
|
1324
|
+
return ts(w, ne.decode(k)), X(k, T, m), u.encode(w);
|
|
1325
1325
|
}
|
|
1326
1326
|
};
|
|
1327
1327
|
};
|
|
1328
|
-
function
|
|
1329
|
-
const e =
|
|
1328
|
+
function rs(o) {
|
|
1329
|
+
const e = ss(o), { HASH256: t, HASH512: n, KDF: s } = o, { secretCoder: r, lengths: i } = e, a = We("secretKey", i.secretKey, i.publicKey, 32, 32), c = 32, u = 64;
|
|
1330
1330
|
return {
|
|
1331
1331
|
info: { type: "ml-kem" },
|
|
1332
1332
|
lengths: {
|
|
@@ -1336,46 +1336,46 @@ function ss(o) {
|
|
|
1336
1336
|
msgRand: c,
|
|
1337
1337
|
secretKey: a.bytesLen
|
|
1338
1338
|
},
|
|
1339
|
-
keygen: (l =
|
|
1339
|
+
keygen: (l = yt(u)) => {
|
|
1340
1340
|
D(l, u, "seed");
|
|
1341
1341
|
const { publicKey: h, secretKey: p } = e.keygen(l.subarray(0, 32)), d = t(h), b = a.encode([p, h, d, l.subarray(32)]);
|
|
1342
|
-
return
|
|
1342
|
+
return X(p, d), { publicKey: h, secretKey: b };
|
|
1343
1343
|
},
|
|
1344
1344
|
getPublicKey: (l) => {
|
|
1345
1345
|
const [h, p] = a.decode(l);
|
|
1346
1346
|
return Uint8Array.from(p);
|
|
1347
1347
|
},
|
|
1348
|
-
encapsulate: (l, h =
|
|
1348
|
+
encapsulate: (l, h = yt(c)) => {
|
|
1349
1349
|
D(l, i.publicKey, "publicKey"), D(h, c, "message");
|
|
1350
|
-
const p = l.subarray(0, 384 * o.K), d = r.encode(r.decode(
|
|
1351
|
-
if (!
|
|
1352
|
-
throw
|
|
1353
|
-
|
|
1350
|
+
const p = l.subarray(0, 384 * o.K), d = r.encode(r.decode(jn(p)));
|
|
1351
|
+
if (!Ge(d, p))
|
|
1352
|
+
throw X(d), new Error("ML-KEM.encapsulate: wrong publicKey modulus");
|
|
1353
|
+
X(d);
|
|
1354
1354
|
const b = n.create().update(h).update(t(l)).digest(), A = e.encrypt(l, h, b.subarray(32, 64));
|
|
1355
|
-
return
|
|
1355
|
+
return X(b.subarray(32)), { cipherText: A, sharedSecret: b.subarray(0, 32) };
|
|
1356
1356
|
},
|
|
1357
1357
|
decapsulate: (l, h) => {
|
|
1358
1358
|
D(h, a.bytesLen, "secretKey"), D(l, i.cipherText, "cipherText");
|
|
1359
1359
|
const p = a.bytesLen - 96, d = p + 32, b = t(h.subarray(p / 2, d));
|
|
1360
|
-
if (!
|
|
1360
|
+
if (!Ge(b, h.subarray(d, d + 32)))
|
|
1361
1361
|
throw new Error("invalid secretKey: hash check failed");
|
|
1362
|
-
const [A, O, f, m] = a.decode(h), w = e.decrypt(l, A),
|
|
1363
|
-
return
|
|
1362
|
+
const [A, O, f, m] = a.decode(h), w = e.decrypt(l, A), T = n.create().update(w).update(f).digest(), k = T.subarray(0, 32), $ = e.encrypt(O, w, T.subarray(32, 64)), v = Ge(l, $), I = s.create({ dkLen: 32 }).update(m).update(l).digest();
|
|
1363
|
+
return X(w, $, v ? I : k), v ? k : I;
|
|
1364
1364
|
}
|
|
1365
1365
|
};
|
|
1366
1366
|
}
|
|
1367
|
-
function
|
|
1368
|
-
return
|
|
1369
|
-
}
|
|
1370
|
-
const
|
|
1371
|
-
HASH256:
|
|
1372
|
-
HASH512:
|
|
1373
|
-
KDF:
|
|
1374
|
-
XOF:
|
|
1375
|
-
PRF:
|
|
1376
|
-
},
|
|
1377
|
-
...
|
|
1378
|
-
...
|
|
1367
|
+
function is(o, e, t) {
|
|
1368
|
+
return jt.create({ dkLen: o }).update(e).update(new Uint8Array([t])).digest();
|
|
1369
|
+
}
|
|
1370
|
+
const os = {
|
|
1371
|
+
HASH256: Fn,
|
|
1372
|
+
HASH512: Ln,
|
|
1373
|
+
KDF: jt,
|
|
1374
|
+
XOF: zn,
|
|
1375
|
+
PRF: is
|
|
1376
|
+
}, Ze = /* @__PURE__ */ rs({
|
|
1377
|
+
...os,
|
|
1378
|
+
...Yn[768]
|
|
1379
1379
|
});
|
|
1380
1380
|
class S {
|
|
1381
1381
|
/**
|
|
@@ -1398,7 +1398,7 @@ class S {
|
|
|
1398
1398
|
batchId: i = null,
|
|
1399
1399
|
characters: a = null
|
|
1400
1400
|
}) {
|
|
1401
|
-
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 ||
|
|
1401
|
+
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 || pe(e, "Wallet::constructor"), this.position = this.position || S.generatePosition(), this.key = S.generateKey({
|
|
1402
1402
|
secret: e,
|
|
1403
1403
|
token: this.token,
|
|
1404
1404
|
position: this.position
|
|
@@ -1423,8 +1423,8 @@ class S {
|
|
|
1423
1423
|
}) {
|
|
1424
1424
|
let i = null;
|
|
1425
1425
|
if (!e && !t)
|
|
1426
|
-
throw new
|
|
1427
|
-
return e && !t && (i = S.generatePosition(), t =
|
|
1426
|
+
throw new Je();
|
|
1427
|
+
return e && !t && (i = S.generatePosition(), t = pe(e, "Wallet::create")), new S({
|
|
1428
1428
|
secret: e,
|
|
1429
1429
|
bundle: t,
|
|
1430
1430
|
token: n,
|
|
@@ -1451,7 +1451,7 @@ class S {
|
|
|
1451
1451
|
static getTokenUnits(e) {
|
|
1452
1452
|
const t = [];
|
|
1453
1453
|
return e.forEach((n) => {
|
|
1454
|
-
t.push(
|
|
1454
|
+
t.push(fe.createFromDB(n));
|
|
1455
1455
|
}), t;
|
|
1456
1456
|
}
|
|
1457
1457
|
/**
|
|
@@ -1468,10 +1468,10 @@ class S {
|
|
|
1468
1468
|
position: n
|
|
1469
1469
|
}) {
|
|
1470
1470
|
if (!e)
|
|
1471
|
-
throw new
|
|
1471
|
+
throw new Je("Wallet::generateKey() - Secret is required!");
|
|
1472
1472
|
if (!n)
|
|
1473
|
-
throw new
|
|
1474
|
-
const s = Ve(e) ? e :
|
|
1473
|
+
throw new Je("Wallet::generateKey() - Position is required!");
|
|
1474
|
+
const s = Ve(e) ? e : ze(e, 1024), r = Ve(n) ? n : ze(n, 256), a = BigInt(`0x${s}`) + BigInt(`0x${r}`), c = new L("SHAKE256", "TEXT");
|
|
1475
1475
|
c.update(a.toString(16)), t && c.update(t);
|
|
1476
1476
|
const u = new L("SHAKE256", "TEXT");
|
|
1477
1477
|
return u.update(c.getHash("HEX", { outputLen: 8192 })), u.getHash("HEX", { outputLen: 8192 });
|
|
@@ -1483,7 +1483,7 @@ class S {
|
|
|
1483
1483
|
* @return {string}
|
|
1484
1484
|
*/
|
|
1485
1485
|
static generateAddress(e) {
|
|
1486
|
-
const t =
|
|
1486
|
+
const t = Be(e, 128), n = new L("SHAKE256", "TEXT");
|
|
1487
1487
|
for (const r in t) {
|
|
1488
1488
|
let i = t[r];
|
|
1489
1489
|
for (let a = 1; a <= 16; a++) {
|
|
@@ -1510,7 +1510,7 @@ class S {
|
|
|
1510
1510
|
const e = nt(this.key, 128), t = new Uint8Array(64);
|
|
1511
1511
|
for (let r = 0; r < 64; r++)
|
|
1512
1512
|
t[r] = parseInt(e.substr(r * 2, 2), 16);
|
|
1513
|
-
const { publicKey: n, secretKey: s } =
|
|
1513
|
+
const { publicKey: n, secretKey: s } = Ze.keygen(t);
|
|
1514
1514
|
this.pubkey = this.serializeKey(n), this.privkey = s;
|
|
1515
1515
|
}
|
|
1516
1516
|
serializeKey(e) {
|
|
@@ -1580,6 +1580,27 @@ class S {
|
|
|
1580
1580
|
e.includes(i.id) ? s.push(i) : r.push(i);
|
|
1581
1581
|
}), this.tokenUnits = s, n !== null && (n.tokenUnits = s), t.tokenUnits = r;
|
|
1582
1582
|
}
|
|
1583
|
+
/**
|
|
1584
|
+
* Split token units across MULTIPLE recipients (WP line 544).
|
|
1585
|
+
*
|
|
1586
|
+
* The source retains the SENT union (all units leaving), each recipient gets its own subset,
|
|
1587
|
+
* and the remainder gets the KEPT units (those not assigned to any recipient). Mirrors
|
|
1588
|
+
* splitUnits() but N-way: the source's tokenUnits become the union (not a single recipient's
|
|
1589
|
+
* subset) so the source atom carries the full SENT set the validator reads as the authority.
|
|
1590
|
+
*
|
|
1591
|
+
* @param {array[]} recipientUnitLists - array of unit-id arrays, parallel to recipientWallets
|
|
1592
|
+
* @param {Wallet[]} recipientWallets
|
|
1593
|
+
* @param {Wallet} remainderWallet
|
|
1594
|
+
*/
|
|
1595
|
+
splitUnitsMulti(e, t, n) {
|
|
1596
|
+
const s = /* @__PURE__ */ new Set();
|
|
1597
|
+
e.forEach((r) => {
|
|
1598
|
+
r.forEach((i) => s.add(i));
|
|
1599
|
+
}), s.size !== 0 && (t.forEach((r, i) => {
|
|
1600
|
+
const a = e[i];
|
|
1601
|
+
r.tokenUnits = this.tokenUnits.filter((c) => a.includes(c.id));
|
|
1602
|
+
}), n.tokenUnits = this.tokenUnits.filter((r) => !s.has(r.id)), this.tokenUnits = this.tokenUnits.filter((r) => s.has(r.id)));
|
|
1603
|
+
}
|
|
1583
1604
|
/**
|
|
1584
1605
|
* Create a remainder wallet from the source one
|
|
1585
1606
|
*
|
|
@@ -1612,42 +1633,77 @@ class S {
|
|
|
1612
1633
|
sourceWallet: e,
|
|
1613
1634
|
isRemainder: t = !1
|
|
1614
1635
|
}) {
|
|
1615
|
-
e.batchId && (this.batchId = t ? e.batchId :
|
|
1636
|
+
e.batchId && (this.batchId = t ? e.batchId : He({}));
|
|
1616
1637
|
}
|
|
1617
1638
|
async encryptMessage(e, t) {
|
|
1618
|
-
const n = JSON.stringify(e), s = new TextEncoder().encode(n), r = this.deserializeKey(t), { cipherText: i, sharedSecret: a } =
|
|
1639
|
+
const n = JSON.stringify(e), s = new TextEncoder().encode(n), r = this.deserializeKey(t), { cipherText: i, sharedSecret: a } = Ze.encapsulate(r), c = await this.encryptWithSharedSecret(s, a);
|
|
1619
1640
|
return {
|
|
1620
1641
|
cipherText: this.serializeKey(i),
|
|
1621
1642
|
encryptedMessage: this.serializeKey(c)
|
|
1622
1643
|
};
|
|
1623
1644
|
}
|
|
1624
1645
|
async decryptMessage(e) {
|
|
1646
|
+
const t = await this._mlkemDecryptToString(e);
|
|
1647
|
+
return t === null ? null : JSON.parse(t);
|
|
1648
|
+
}
|
|
1649
|
+
/**
|
|
1650
|
+
* ML-KEM768 decapsulate + AES-256-GCM decrypt → the RAW decrypted UTF-8 string
|
|
1651
|
+
* (no JSON.parse). Shared by {@link decryptMessage} (which JSON.parses the result)
|
|
1652
|
+
* and the PQ CipherHash transport ({@link decryptMyMessageML768}, which needs the raw
|
|
1653
|
+
* response JSON text). PQ-transport Phase E (cycle 163).
|
|
1654
|
+
*/
|
|
1655
|
+
async _mlkemDecryptToString(e) {
|
|
1625
1656
|
const { cipherText: t, encryptedMessage: n } = e;
|
|
1626
1657
|
let s;
|
|
1627
1658
|
try {
|
|
1628
|
-
s =
|
|
1629
|
-
} catch (
|
|
1630
|
-
return console.error("Wallet::decryptMessage() - Decapsulation failed",
|
|
1659
|
+
s = Ze.decapsulate(this.deserializeKey(t), this.privkey);
|
|
1660
|
+
} catch (a) {
|
|
1661
|
+
return console.error("Wallet::decryptMessage() - Decapsulation failed", a), console.info("Wallet::decryptMessage() - my public key", this.pubkey), null;
|
|
1631
1662
|
}
|
|
1632
1663
|
let r;
|
|
1633
1664
|
try {
|
|
1634
1665
|
r = this.deserializeKey(n);
|
|
1635
|
-
} catch (
|
|
1636
|
-
return console.warn("Wallet::decryptMessage() - Deserialization failed",
|
|
1666
|
+
} catch (a) {
|
|
1667
|
+
return console.warn("Wallet::decryptMessage() - Deserialization failed", a), console.info("Wallet::decryptMessage() - my public key", this.pubkey), console.info("Wallet::decryptMessage() - our shared secret", s), null;
|
|
1637
1668
|
}
|
|
1638
1669
|
let i;
|
|
1639
1670
|
try {
|
|
1640
1671
|
i = await this.decryptWithSharedSecret(r, s);
|
|
1641
|
-
} catch (
|
|
1642
|
-
return console.warn("Wallet::decryptMessage() - Decryption failed",
|
|
1672
|
+
} catch (a) {
|
|
1673
|
+
return console.warn("Wallet::decryptMessage() - Decryption failed", a), console.info("Wallet::decryptMessage() - my public key", this.pubkey), console.info("Wallet::decryptMessage() - our shared secret", s), console.info("Wallet::decryptMessage() - deserialized encrypted message", r), null;
|
|
1643
1674
|
}
|
|
1644
|
-
let a;
|
|
1645
1675
|
try {
|
|
1646
|
-
|
|
1647
|
-
} catch (
|
|
1648
|
-
return console.warn("Wallet::decryptMessage() - Decoding failed",
|
|
1676
|
+
return new TextDecoder().decode(i);
|
|
1677
|
+
} catch (a) {
|
|
1678
|
+
return console.warn("Wallet::decryptMessage() - Decoding failed", a), console.info("Wallet::decryptMessage() - my public key", this.pubkey), console.info("Wallet::decryptMessage() - our shared secret", s), console.info("Wallet::decryptMessage() - deserialized encrypted message", r), console.info("Wallet::decryptMessage() - decrypted Uint8Array", i), null;
|
|
1649
1679
|
}
|
|
1650
|
-
|
|
1680
|
+
}
|
|
1681
|
+
/**
|
|
1682
|
+
* Multi-recipient map key for a public key: `Base64_standard(SHAKE256(pubkey_utf8, 8 bytes))`
|
|
1683
|
+
* — matches the validator's `hash_share` and the other SDKs' `hashShare`/`shortHash`.
|
|
1684
|
+
* `shake256(pubkey, 64)` = 64 bits = 8 bytes, hex; hex-decode → standard base64. PQ Phase E.
|
|
1685
|
+
*/
|
|
1686
|
+
hashShare(e) {
|
|
1687
|
+
const t = ze(e, 64), n = Uint8Array.from(t.match(/.{2}/g).map((s) => parseInt(s, 16)));
|
|
1688
|
+
return this.serializeKey(n);
|
|
1689
|
+
}
|
|
1690
|
+
/**
|
|
1691
|
+
* Post-quantum (ML-KEM768) `CipherHash` request envelope: a stringified single-recipient
|
|
1692
|
+
* map `{ "<hashShare(recipientPubkey)>": {cipherText, encryptedMessage} }` (object-valued,
|
|
1693
|
+
* via {@link encryptMessage}). Matches the Rust validator's CipherHash handler. PQ Phase E.
|
|
1694
|
+
*/
|
|
1695
|
+
async encryptStringML768(e, t) {
|
|
1696
|
+
const n = await this.encryptMessage(e, t);
|
|
1697
|
+
return JSON.stringify({ [this.hashShare(t)]: n });
|
|
1698
|
+
}
|
|
1699
|
+
/**
|
|
1700
|
+
* Decrypt a `CipherHash` response map addressed to THIS wallet's ML-KEM pubkey
|
|
1701
|
+
* (`hashShare(this.pubkey)`) → the RAW decrypted GraphQL response JSON text (NOT JSON.parsed;
|
|
1702
|
+
* it replaces the HTTP response body for the normal parser). `null` if no entry / decrypt fails.
|
|
1703
|
+
*/
|
|
1704
|
+
async decryptMyMessageML768(e) {
|
|
1705
|
+
const t = e[this.hashShare(this.pubkey)];
|
|
1706
|
+
return t ? this._mlkemDecryptToString(t) : null;
|
|
1651
1707
|
}
|
|
1652
1708
|
async encryptWithSharedSecret(e, t) {
|
|
1653
1709
|
const n = crypto.getRandomValues(new Uint8Array(12)), s = { name: "AES-GCM", iv: n }, r = await crypto.subtle.importKey(
|
|
@@ -1684,7 +1740,7 @@ class S {
|
|
|
1684
1740
|
return new Uint8Array(i);
|
|
1685
1741
|
}
|
|
1686
1742
|
}
|
|
1687
|
-
class
|
|
1743
|
+
class we extends x {
|
|
1688
1744
|
/**
|
|
1689
1745
|
* Class constructor
|
|
1690
1746
|
*
|
|
@@ -1696,7 +1752,7 @@ class ke extends x {
|
|
|
1696
1752
|
super(e, t, n), this.name = "AtomIndexException";
|
|
1697
1753
|
}
|
|
1698
1754
|
}
|
|
1699
|
-
class
|
|
1755
|
+
class as extends x {
|
|
1700
1756
|
/**
|
|
1701
1757
|
* Class constructor
|
|
1702
1758
|
*
|
|
@@ -1708,7 +1764,7 @@ class os extends x {
|
|
|
1708
1764
|
super(e, t, n), this.name = "MolecularHashMismatchException";
|
|
1709
1765
|
}
|
|
1710
1766
|
}
|
|
1711
|
-
class
|
|
1767
|
+
class ls extends x {
|
|
1712
1768
|
/**
|
|
1713
1769
|
* Class constructor
|
|
1714
1770
|
*
|
|
@@ -1720,7 +1776,7 @@ class as extends x {
|
|
|
1720
1776
|
super(e, t, n), this.name = "MolecularHashMissingException";
|
|
1721
1777
|
}
|
|
1722
1778
|
}
|
|
1723
|
-
class
|
|
1779
|
+
class wt extends x {
|
|
1724
1780
|
/**
|
|
1725
1781
|
* Class constructor
|
|
1726
1782
|
*
|
|
@@ -1732,7 +1788,7 @@ class kt extends x {
|
|
|
1732
1788
|
super(e, t, n), this.name = "PolicyInvalidException";
|
|
1733
1789
|
}
|
|
1734
1790
|
}
|
|
1735
|
-
class
|
|
1791
|
+
class Jt extends x {
|
|
1736
1792
|
/**
|
|
1737
1793
|
* Class constructor
|
|
1738
1794
|
*
|
|
@@ -1744,7 +1800,7 @@ class zt extends x {
|
|
|
1744
1800
|
super(e, t, n), this.name = "SignatureMalformedException";
|
|
1745
1801
|
}
|
|
1746
1802
|
}
|
|
1747
|
-
class
|
|
1803
|
+
class cs extends x {
|
|
1748
1804
|
/**
|
|
1749
1805
|
* Class constructor
|
|
1750
1806
|
*
|
|
@@ -1756,7 +1812,7 @@ class ls extends x {
|
|
|
1756
1812
|
super(e, t, n), this.name = "SignatureMismatchException";
|
|
1757
1813
|
}
|
|
1758
1814
|
}
|
|
1759
|
-
class
|
|
1815
|
+
class G extends x {
|
|
1760
1816
|
/**
|
|
1761
1817
|
* Class constructor
|
|
1762
1818
|
*
|
|
@@ -1768,7 +1824,7 @@ class Y extends x {
|
|
|
1768
1824
|
super(e, t, n), this.name = "TransferBalanceException";
|
|
1769
1825
|
}
|
|
1770
1826
|
}
|
|
1771
|
-
class
|
|
1827
|
+
class ke extends x {
|
|
1772
1828
|
/**
|
|
1773
1829
|
* Class constructor
|
|
1774
1830
|
*
|
|
@@ -1780,7 +1836,7 @@ class _e extends x {
|
|
|
1780
1836
|
super(e, t, n), this.name = "TransferMalformedException";
|
|
1781
1837
|
}
|
|
1782
1838
|
}
|
|
1783
|
-
class
|
|
1839
|
+
class kt extends x {
|
|
1784
1840
|
/**
|
|
1785
1841
|
* @param {string} message
|
|
1786
1842
|
* @param {string|null} fileName
|
|
@@ -1790,7 +1846,7 @@ class _t extends x {
|
|
|
1790
1846
|
super(e, t, n), this.name = "TransferMismatchedException";
|
|
1791
1847
|
}
|
|
1792
1848
|
}
|
|
1793
|
-
class
|
|
1849
|
+
class _t extends x {
|
|
1794
1850
|
/**
|
|
1795
1851
|
* Class constructor
|
|
1796
1852
|
*
|
|
@@ -1802,7 +1858,7 @@ class St extends x {
|
|
|
1802
1858
|
super(e, t, n), this.name = "TransferRemainderException";
|
|
1803
1859
|
}
|
|
1804
1860
|
}
|
|
1805
|
-
class
|
|
1861
|
+
class us extends x {
|
|
1806
1862
|
/**
|
|
1807
1863
|
* Class constructor
|
|
1808
1864
|
*
|
|
@@ -1850,7 +1906,7 @@ class re extends x {
|
|
|
1850
1906
|
super(e, t, n), this.name = "WrongTokenTypeException";
|
|
1851
1907
|
}
|
|
1852
1908
|
}
|
|
1853
|
-
class
|
|
1909
|
+
class Ue extends x {
|
|
1854
1910
|
/**
|
|
1855
1911
|
* @param {string|null} message
|
|
1856
1912
|
* @param {string|null} fileName
|
|
@@ -1860,7 +1916,7 @@ class Be extends x {
|
|
|
1860
1916
|
super(e, t, n), this.name = "BatchIdException";
|
|
1861
1917
|
}
|
|
1862
1918
|
}
|
|
1863
|
-
class
|
|
1919
|
+
class St {
|
|
1864
1920
|
constructor(e = {}) {
|
|
1865
1921
|
for (const t in e)
|
|
1866
1922
|
this[`__${t}`] = e[t];
|
|
@@ -1939,7 +1995,7 @@ class Se {
|
|
|
1939
1995
|
* @param {string} amount
|
|
1940
1996
|
*/
|
|
1941
1997
|
set amount(e) {
|
|
1942
|
-
if (!
|
|
1998
|
+
if (!gn(e))
|
|
1943
1999
|
throw new ee("Parameter amount should be a string containing numbers");
|
|
1944
2000
|
this.__amount = e;
|
|
1945
2001
|
}
|
|
@@ -1962,7 +2018,7 @@ class Se {
|
|
|
1962
2018
|
* @param {Meta|object} meta
|
|
1963
2019
|
*/
|
|
1964
2020
|
set meta(e) {
|
|
1965
|
-
this.__meta = e instanceof
|
|
2021
|
+
this.__meta = e instanceof St ? e : St.toObject(e);
|
|
1966
2022
|
}
|
|
1967
2023
|
/**
|
|
1968
2024
|
*
|
|
@@ -2010,31 +2066,31 @@ class Se {
|
|
|
2010
2066
|
* @return {boolean}
|
|
2011
2067
|
*/
|
|
2012
2068
|
isMeta() {
|
|
2013
|
-
return
|
|
2069
|
+
return me(Object.keys(this.toJSON()), ["action", "metaId", "metaType", "meta"]).length === 4 && this._is("meta");
|
|
2014
2070
|
}
|
|
2015
2071
|
/**
|
|
2016
2072
|
* @return {boolean}
|
|
2017
2073
|
*/
|
|
2018
2074
|
isCollect() {
|
|
2019
|
-
return
|
|
2075
|
+
return me(Object.keys(this.toJSON()), ["action", "address", "token", "amount", "comparison"]).length === 5 && this._is("collect");
|
|
2020
2076
|
}
|
|
2021
2077
|
/**
|
|
2022
2078
|
* @return {boolean}
|
|
2023
2079
|
*/
|
|
2024
2080
|
isBuffer() {
|
|
2025
|
-
return
|
|
2081
|
+
return me(Object.keys(this.toJSON()), ["action", "address", "token", "amount", "comparison"]).length === 5 && this._is("buffer");
|
|
2026
2082
|
}
|
|
2027
2083
|
/**
|
|
2028
2084
|
* @return {boolean}
|
|
2029
2085
|
*/
|
|
2030
2086
|
isRemit() {
|
|
2031
|
-
return
|
|
2087
|
+
return me(Object.keys(this.toJSON()), ["action", "token", "amount"]).length === 3 && this._is("remit");
|
|
2032
2088
|
}
|
|
2033
2089
|
/**
|
|
2034
2090
|
* @return {boolean}
|
|
2035
2091
|
*/
|
|
2036
2092
|
isBurn() {
|
|
2037
|
-
return
|
|
2093
|
+
return me(Object.keys(this.toJSON()), ["action", "token", "amount", "comparison"]).length === 4 && this._is("burn");
|
|
2038
2094
|
}
|
|
2039
2095
|
/**
|
|
2040
2096
|
* @param {string} type
|
|
@@ -2046,7 +2102,7 @@ class Se {
|
|
|
2046
2102
|
return this.__action.toLowerCase() === e.toLowerCase();
|
|
2047
2103
|
}
|
|
2048
2104
|
}
|
|
2049
|
-
class
|
|
2105
|
+
class Ye {
|
|
2050
2106
|
/**
|
|
2051
2107
|
*
|
|
2052
2108
|
* @param key
|
|
@@ -2095,7 +2151,7 @@ class Ae {
|
|
|
2095
2151
|
callback: t = []
|
|
2096
2152
|
}) {
|
|
2097
2153
|
for (const n of e)
|
|
2098
|
-
if (!(n instanceof
|
|
2154
|
+
if (!(n instanceof Ye))
|
|
2099
2155
|
throw new Pe();
|
|
2100
2156
|
for (const n of t)
|
|
2101
2157
|
if (!(n instanceof Se))
|
|
@@ -2107,7 +2163,7 @@ class Ae {
|
|
|
2107
2163
|
* @param {Condition[]|{}} condition
|
|
2108
2164
|
*/
|
|
2109
2165
|
set comparison(e) {
|
|
2110
|
-
this.__condition.push(e instanceof
|
|
2166
|
+
this.__condition.push(e instanceof Ye ? e : Ye.toObject(e));
|
|
2111
2167
|
}
|
|
2112
2168
|
/**
|
|
2113
2169
|
* @param {Callback[]|{}} callback
|
|
@@ -2143,7 +2199,7 @@ class Ae {
|
|
|
2143
2199
|
};
|
|
2144
2200
|
}
|
|
2145
2201
|
}
|
|
2146
|
-
class
|
|
2202
|
+
class M {
|
|
2147
2203
|
/**
|
|
2148
2204
|
* Initialize the Dot utility with the given object and key path
|
|
2149
2205
|
* @param {object|array} obj - The object or array to traverse
|
|
@@ -2209,12 +2265,12 @@ class ve {
|
|
|
2209
2265
|
*/
|
|
2210
2266
|
constructor(e) {
|
|
2211
2267
|
if (e.molecularHash === null)
|
|
2212
|
-
throw new
|
|
2268
|
+
throw new ls();
|
|
2213
2269
|
if (!e.atoms.length)
|
|
2214
2270
|
throw new ae();
|
|
2215
2271
|
for (const t of e.atoms)
|
|
2216
2272
|
if (t.index === null)
|
|
2217
|
-
throw new
|
|
2273
|
+
throw new we();
|
|
2218
2274
|
this.molecule = e;
|
|
2219
2275
|
}
|
|
2220
2276
|
/**
|
|
@@ -2244,14 +2300,14 @@ class ve {
|
|
|
2244
2300
|
if (e.isotope === "V" && e.batchId !== null) {
|
|
2245
2301
|
const t = this.molecule.getIsotopes("V"), n = t[t.length - 1];
|
|
2246
2302
|
if (e.batchId !== n.batchId)
|
|
2247
|
-
throw new
|
|
2303
|
+
throw new Ue();
|
|
2248
2304
|
for (const s of t)
|
|
2249
2305
|
if (s.batchId === null)
|
|
2250
|
-
throw new
|
|
2306
|
+
throw new Ue();
|
|
2251
2307
|
}
|
|
2252
2308
|
return !0;
|
|
2253
2309
|
}
|
|
2254
|
-
throw new
|
|
2310
|
+
throw new Ue();
|
|
2255
2311
|
}
|
|
2256
2312
|
/**
|
|
2257
2313
|
*
|
|
@@ -2262,7 +2318,7 @@ class ve {
|
|
|
2262
2318
|
if (e.token !== "USER")
|
|
2263
2319
|
throw new re(`Check::isotopeI() - "${e.token}" is not a valid Token slug for "${e.isotope}" isotope Atoms!`);
|
|
2264
2320
|
if (e.index === 0)
|
|
2265
|
-
throw new
|
|
2321
|
+
throw new we(`Check::isotopeI() - Isotope "${e.isotope}" Atoms must have a non-zero index!`);
|
|
2266
2322
|
}
|
|
2267
2323
|
return !0;
|
|
2268
2324
|
}
|
|
@@ -2275,7 +2331,7 @@ class ve {
|
|
|
2275
2331
|
if (e.token !== "AUTH")
|
|
2276
2332
|
throw new re(`Check::isotopeU() - "${e.token}" is not a valid Token slug for "${e.isotope}" isotope Atoms!`);
|
|
2277
2333
|
if (e.index !== 0)
|
|
2278
|
-
throw new
|
|
2334
|
+
throw new we(`Check::isotopeU() - Isotope "${e.isotope}" Atoms must have an index equal to 0!`);
|
|
2279
2335
|
}
|
|
2280
2336
|
return !0;
|
|
2281
2337
|
}
|
|
@@ -2290,7 +2346,7 @@ class ve {
|
|
|
2290
2346
|
throw new H();
|
|
2291
2347
|
if (t.token !== "USER")
|
|
2292
2348
|
throw new re(`Check::isotopeM() - "${t.token}" is not a valid Token slug for "${t.isotope}" isotope Atoms!`);
|
|
2293
|
-
const n =
|
|
2349
|
+
const n = de.aggregateMeta(t.meta);
|
|
2294
2350
|
for (const s of e) {
|
|
2295
2351
|
let r = n[s];
|
|
2296
2352
|
if (r) {
|
|
@@ -2298,10 +2354,10 @@ class ve {
|
|
|
2298
2354
|
for (const [i, a] of Object.entries(r))
|
|
2299
2355
|
if (!e.includes(i)) {
|
|
2300
2356
|
if (!Object.keys(n).includes(i))
|
|
2301
|
-
throw new
|
|
2357
|
+
throw new wt(`${i} is missing from the meta.`);
|
|
2302
2358
|
for (const c of a)
|
|
2303
2359
|
if (!S.isBundleHash(c) && !["all", "self"].includes(c))
|
|
2304
|
-
throw new
|
|
2360
|
+
throw new wt(`${c} does not correspond to the format of the policy.`);
|
|
2305
2361
|
}
|
|
2306
2362
|
}
|
|
2307
2363
|
}
|
|
@@ -2317,7 +2373,7 @@ class ve {
|
|
|
2317
2373
|
if (e.token !== "USER")
|
|
2318
2374
|
throw new re(`Check::isotopeC() - "${e.token}" is not a valid Token slug for "${e.isotope}" isotope Atoms!`);
|
|
2319
2375
|
if (e.index !== 0)
|
|
2320
|
-
throw new
|
|
2376
|
+
throw new we(`Check::isotopeC() - Isotope "${e.isotope}" Atoms must have an index equal to 0!`);
|
|
2321
2377
|
}
|
|
2322
2378
|
return !0;
|
|
2323
2379
|
}
|
|
@@ -2339,7 +2395,7 @@ class ve {
|
|
|
2339
2395
|
if (e.token !== "USER")
|
|
2340
2396
|
throw new re(`Check::isotopeT() - "${e.token}" is not a valid Token slug for "${e.isotope}" isotope Atoms!`);
|
|
2341
2397
|
if (e.index !== 0)
|
|
2342
|
-
throw new
|
|
2398
|
+
throw new we(`Check::isotopeT() - Isotope "${e.isotope}" Atoms must have an index equal to 0!`);
|
|
2343
2399
|
}
|
|
2344
2400
|
return !0;
|
|
2345
2401
|
}
|
|
@@ -2417,7 +2473,7 @@ class ve {
|
|
|
2417
2473
|
throw new H("Check::isotopeB() - B-isotope atoms must have a metaId!");
|
|
2418
2474
|
const s = Number(n.value);
|
|
2419
2475
|
if (Number.isNaN(s))
|
|
2420
|
-
throw new
|
|
2476
|
+
throw new ke("Check::isotopeB() - B-isotope atom value is not a valid number!");
|
|
2421
2477
|
}
|
|
2422
2478
|
const t = this.molecule.getIsotopes("V");
|
|
2423
2479
|
if (t.length > 0) {
|
|
@@ -2447,9 +2503,9 @@ class ve {
|
|
|
2447
2503
|
throw new H("Check::isotopeF() - F-isotope atoms must have a metaId!");
|
|
2448
2504
|
const s = Number(n.value);
|
|
2449
2505
|
if (Number.isNaN(s))
|
|
2450
|
-
throw new
|
|
2506
|
+
throw new ke("Check::isotopeF() - F-isotope atom value is not a valid number!");
|
|
2451
2507
|
if (s < 0)
|
|
2452
|
-
throw new
|
|
2508
|
+
throw new ke("Check::isotopeF() - F-isotope atom value must not be negative!");
|
|
2453
2509
|
}
|
|
2454
2510
|
const t = this.molecule.getIsotopes("V");
|
|
2455
2511
|
if (t.length > 0) {
|
|
@@ -2476,9 +2532,9 @@ class ve {
|
|
|
2476
2532
|
if (!n && s.isotope === "V" && t.length === 2) {
|
|
2477
2533
|
const a = t[t.length - 1];
|
|
2478
2534
|
if (s.token !== a.token)
|
|
2479
|
-
throw new
|
|
2535
|
+
throw new kt();
|
|
2480
2536
|
if (a.value < 0)
|
|
2481
|
-
throw new
|
|
2537
|
+
throw new ke();
|
|
2482
2538
|
if (Number(s.value) + Number(a.value) !== 0)
|
|
2483
2539
|
throw new Oe();
|
|
2484
2540
|
return !0;
|
|
@@ -2492,12 +2548,12 @@ class ve {
|
|
|
2492
2548
|
if (i = c.value * 1, Number.isNaN(i))
|
|
2493
2549
|
throw new TypeError('Invalid isotope "V" values');
|
|
2494
2550
|
if (c.token !== s.token)
|
|
2495
|
-
throw new
|
|
2551
|
+
throw new kt();
|
|
2496
2552
|
if (a > 0) {
|
|
2497
2553
|
if (i < 0)
|
|
2498
|
-
throw new
|
|
2554
|
+
throw new ke();
|
|
2499
2555
|
if (c.walletAddress === s.walletAddress)
|
|
2500
|
-
throw new
|
|
2556
|
+
throw new us();
|
|
2501
2557
|
}
|
|
2502
2558
|
r += i;
|
|
2503
2559
|
}
|
|
@@ -2508,11 +2564,11 @@ class ve {
|
|
|
2508
2564
|
throw new TypeError('Invalid isotope "V" values');
|
|
2509
2565
|
const a = Number(e.balance) + i;
|
|
2510
2566
|
if (a < 0)
|
|
2511
|
-
throw new
|
|
2567
|
+
throw new G();
|
|
2512
2568
|
if (!n && a !== r)
|
|
2513
|
-
throw new
|
|
2569
|
+
throw new _t();
|
|
2514
2570
|
} else if (i !== 0)
|
|
2515
|
-
throw new
|
|
2571
|
+
throw new _t();
|
|
2516
2572
|
return !0;
|
|
2517
2573
|
}
|
|
2518
2574
|
/**
|
|
@@ -2524,7 +2580,7 @@ class ve {
|
|
|
2524
2580
|
if (this.molecule.molecularHash !== g.hashAtoms({
|
|
2525
2581
|
atoms: this.molecule.atoms
|
|
2526
2582
|
}))
|
|
2527
|
-
throw new
|
|
2583
|
+
throw new as();
|
|
2528
2584
|
return !0;
|
|
2529
2585
|
}
|
|
2530
2586
|
/**
|
|
@@ -2541,9 +2597,9 @@ class ve {
|
|
|
2541
2597
|
).reduce(
|
|
2542
2598
|
(p, d) => p + d
|
|
2543
2599
|
);
|
|
2544
|
-
if (t.length !== 2048 && (t =
|
|
2545
|
-
throw new
|
|
2546
|
-
const n =
|
|
2600
|
+
if (t.length !== 2048 && (t = yn(t), t.length !== 2048))
|
|
2601
|
+
throw new Jt();
|
|
2602
|
+
const n = Be(t, 128);
|
|
2547
2603
|
let s = "";
|
|
2548
2604
|
for (const p in n) {
|
|
2549
2605
|
let d = n[p];
|
|
@@ -2557,9 +2613,9 @@ class ve {
|
|
|
2557
2613
|
a.update(i);
|
|
2558
2614
|
const c = a.getHash("HEX", { outputLen: 256 }), u = this.molecule.atoms[0];
|
|
2559
2615
|
let l = u.walletAddress;
|
|
2560
|
-
const h =
|
|
2561
|
-
if (h && (l =
|
|
2562
|
-
throw new
|
|
2616
|
+
const h = M.get(u.aggregatedMeta(), "signingWallet");
|
|
2617
|
+
if (h && (l = M.get(JSON.parse(h), "address")), c !== l)
|
|
2618
|
+
throw new cs();
|
|
2563
2619
|
return !0;
|
|
2564
2620
|
}
|
|
2565
2621
|
/**
|
|
@@ -2645,7 +2701,7 @@ class ve {
|
|
|
2645
2701
|
}
|
|
2646
2702
|
}
|
|
2647
2703
|
}
|
|
2648
|
-
class
|
|
2704
|
+
class he extends x {
|
|
2649
2705
|
/**
|
|
2650
2706
|
* Class constructor
|
|
2651
2707
|
*
|
|
@@ -2657,7 +2713,7 @@ class ue extends x {
|
|
|
2657
2713
|
super(e, t, n), this.name = "BalanceInsufficientException";
|
|
2658
2714
|
}
|
|
2659
2715
|
}
|
|
2660
|
-
class
|
|
2716
|
+
class $t extends x {
|
|
2661
2717
|
/**
|
|
2662
2718
|
* Class constructor
|
|
2663
2719
|
*
|
|
@@ -2689,7 +2745,7 @@ class z {
|
|
|
2689
2745
|
version: i = null,
|
|
2690
2746
|
continuIdPosition: a = null
|
|
2691
2747
|
}) {
|
|
2692
|
-
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.continuIdPosition = a, this.atoms = [], this.parentHashes = [], i !== null && Object.prototype.hasOwnProperty.call(
|
|
2748
|
+
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.continuIdPosition = a, this.atoms = [], this.parentHashes = [], i !== null && Object.prototype.hasOwnProperty.call(qe, i) && (this.version = String(i)), (s || n) && (this.remainderWallet = s || S.create({
|
|
2693
2749
|
secret: e,
|
|
2694
2750
|
bundle: t,
|
|
2695
2751
|
token: n.token,
|
|
@@ -2899,7 +2955,7 @@ class z {
|
|
|
2899
2955
|
fuseToken(e, t) {
|
|
2900
2956
|
const n = e.length;
|
|
2901
2957
|
if (this.sourceWallet.balance - n < 0)
|
|
2902
|
-
throw new
|
|
2958
|
+
throw new he();
|
|
2903
2959
|
return this.addAtom(g.create({
|
|
2904
2960
|
isotope: "V",
|
|
2905
2961
|
wallet: this.sourceWallet,
|
|
@@ -2930,9 +2986,9 @@ class z {
|
|
|
2930
2986
|
walletBundle: t = null
|
|
2931
2987
|
}) {
|
|
2932
2988
|
if (e < 0)
|
|
2933
|
-
throw new
|
|
2989
|
+
throw new $t("Molecule::burnToken() - Amount to burn must be positive!");
|
|
2934
2990
|
if (this.sourceWallet.balance - e < 0)
|
|
2935
|
-
throw new
|
|
2991
|
+
throw new he();
|
|
2936
2992
|
const n = new S({
|
|
2937
2993
|
bundle: "0000000000000000000000000000000000000000000000000000000000000000",
|
|
2938
2994
|
token: this.sourceWallet.token
|
|
@@ -2968,7 +3024,7 @@ class z {
|
|
|
2968
3024
|
units: t = []
|
|
2969
3025
|
}) {
|
|
2970
3026
|
if (e < 0)
|
|
2971
|
-
throw new
|
|
3027
|
+
throw new $t("Molecule::replenishToken() - Amount to replenish must be positive!");
|
|
2972
3028
|
if (t.length) {
|
|
2973
3029
|
t = S.getTokenUnits(t), this.remainderWallet.tokenUnits = this.sourceWallet.tokenUnits;
|
|
2974
3030
|
for (const n of t)
|
|
@@ -3001,7 +3057,7 @@ class z {
|
|
|
3001
3057
|
amount: t
|
|
3002
3058
|
}) {
|
|
3003
3059
|
if (this.sourceWallet.balance - t < 0)
|
|
3004
|
-
throw new
|
|
3060
|
+
throw new he();
|
|
3005
3061
|
return this.addAtom(g.create({
|
|
3006
3062
|
isotope: "V",
|
|
3007
3063
|
wallet: this.sourceWallet,
|
|
@@ -3021,42 +3077,45 @@ class z {
|
|
|
3021
3077
|
})), this;
|
|
3022
3078
|
}
|
|
3023
3079
|
/**
|
|
3024
|
-
*
|
|
3025
|
-
*
|
|
3026
|
-
*
|
|
3080
|
+
* Multi-recipient value transfer (WP line 544: one molecule funds N recipients).
|
|
3081
|
+
*
|
|
3082
|
+
* Builds 1 source atom (full-balance debit, carrying the SENT union of all units) + one atom
|
|
3083
|
+
* per recipient (its amount + its own units, walletBundle-bonded) + 1 remainder atom (the KEPT
|
|
3084
|
+
* change). Conservation: -balance + Σ amounts + (balance - Σ amounts) == 0.
|
|
3027
3085
|
*
|
|
3028
|
-
*
|
|
3029
|
-
*
|
|
3086
|
+
* Per-unit (stackable) routing is layered by calling Wallet.splitUnitsMulti(...) BEFORE this —
|
|
3087
|
+
* it sets the source's tokenUnits to the union, each recipient's to its subset, and the
|
|
3088
|
+
* remainder's to the kept units. The single-recipient initValue() is the N=1 special case.
|
|
3089
|
+
*
|
|
3090
|
+
* @param {Wallet[]} recipientWallets
|
|
3091
|
+
* @param {number[]} amounts - parallel to recipientWallets
|
|
3030
3092
|
* @return {Molecule}
|
|
3031
3093
|
*/
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3094
|
+
initValues({
|
|
3095
|
+
recipientWallets: e,
|
|
3096
|
+
amounts: t
|
|
3035
3097
|
}) {
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
throw new ue();
|
|
3040
|
-
const n = this.sourceWallet.batchId || he({});
|
|
3098
|
+
const n = t.reduce((s, r) => s + Number(r), 0);
|
|
3099
|
+
if (this.sourceWallet.balance - n < 0)
|
|
3100
|
+
throw new he();
|
|
3041
3101
|
return this.addAtom(g.create({
|
|
3042
3102
|
isotope: "V",
|
|
3043
3103
|
wallet: this.sourceWallet,
|
|
3044
|
-
value: -
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
})
|
|
3104
|
+
value: -this.sourceWallet.balance
|
|
3105
|
+
})), e.forEach((s, r) => {
|
|
3106
|
+
this.addAtom(g.create({
|
|
3107
|
+
isotope: "V",
|
|
3108
|
+
wallet: s,
|
|
3109
|
+
value: t[r],
|
|
3110
|
+
metaType: "walletBundle",
|
|
3111
|
+
metaId: s.bundle
|
|
3112
|
+
}));
|
|
3113
|
+
}), this.addAtom(g.create({
|
|
3054
3114
|
isotope: "V",
|
|
3055
3115
|
wallet: this.remainderWallet,
|
|
3056
|
-
value: this.sourceWallet.balance -
|
|
3116
|
+
value: this.sourceWallet.balance - n,
|
|
3057
3117
|
metaType: "walletBundle",
|
|
3058
|
-
metaId: this.remainderWallet.bundle
|
|
3059
|
-
batchId: n
|
|
3118
|
+
metaId: this.remainderWallet.bundle
|
|
3060
3119
|
})), this;
|
|
3061
3120
|
}
|
|
3062
3121
|
/**
|
|
@@ -3069,7 +3128,7 @@ class z {
|
|
|
3069
3128
|
tradeRates: t
|
|
3070
3129
|
}) {
|
|
3071
3130
|
if (this.sourceWallet.balance - e < 0)
|
|
3072
|
-
throw new
|
|
3131
|
+
throw new he();
|
|
3073
3132
|
const n = S.create({
|
|
3074
3133
|
secret: this.secret,
|
|
3075
3134
|
bundle: this.bundle,
|
|
@@ -3108,7 +3167,7 @@ class z {
|
|
|
3108
3167
|
for (const r of Object.values(e || {}))
|
|
3109
3168
|
n += r;
|
|
3110
3169
|
if (this.sourceWallet.balance - n < 0)
|
|
3111
|
-
throw new
|
|
3170
|
+
throw new he();
|
|
3112
3171
|
const s = new P();
|
|
3113
3172
|
t && s.setSigningWallet(t), this.addAtom(g.create({
|
|
3114
3173
|
isotope: "B",
|
|
@@ -3123,7 +3182,7 @@ class z {
|
|
|
3123
3182
|
isotope: "V",
|
|
3124
3183
|
token: this.sourceWallet.token,
|
|
3125
3184
|
value: i,
|
|
3126
|
-
batchId: this.sourceWallet.batchId ?
|
|
3185
|
+
batchId: this.sourceWallet.batchId ? He({}) : null,
|
|
3127
3186
|
metaType: "walletBundle",
|
|
3128
3187
|
metaId: r
|
|
3129
3188
|
}));
|
|
@@ -3231,7 +3290,7 @@ class z {
|
|
|
3231
3290
|
}) {
|
|
3232
3291
|
const s = {
|
|
3233
3292
|
code: n,
|
|
3234
|
-
hash:
|
|
3293
|
+
hash: pe(t.trim(), "Molecule::initIdentifierCreation")
|
|
3235
3294
|
};
|
|
3236
3295
|
return this.addAtom(g.create({
|
|
3237
3296
|
isotope: "C",
|
|
@@ -3370,19 +3429,19 @@ class z {
|
|
|
3370
3429
|
}) {
|
|
3371
3430
|
if (this.atoms.length === 0 || this.atoms.filter((d) => !(d instanceof g)).length !== 0)
|
|
3372
3431
|
throw new ae();
|
|
3373
|
-
!t && !this.bundle && (this.bundle = e ||
|
|
3432
|
+
!t && !this.bundle && (this.bundle = e || pe(this.secret, "Molecule::sign")), this.molecularHash = g.hashAtoms({
|
|
3374
3433
|
atoms: this.atoms
|
|
3375
3434
|
});
|
|
3376
3435
|
const s = this.atoms[0];
|
|
3377
3436
|
let r = s.position;
|
|
3378
|
-
const i =
|
|
3379
|
-
if (i && (r =
|
|
3380
|
-
throw new
|
|
3437
|
+
const i = M.get(s.aggregatedMeta(), "signingWallet");
|
|
3438
|
+
if (i && (r = M.get(JSON.parse(i), "position")), !r)
|
|
3439
|
+
throw new Jt("Signing wallet must have a position!");
|
|
3381
3440
|
const a = S.generateKey({
|
|
3382
3441
|
secret: this.secret,
|
|
3383
3442
|
token: s.token,
|
|
3384
3443
|
position: s.position
|
|
3385
|
-
}), c =
|
|
3444
|
+
}), c = Be(a, 128), u = this.normalizedHash();
|
|
3386
3445
|
let l = "";
|
|
3387
3446
|
for (const d in c) {
|
|
3388
3447
|
let b = c[d];
|
|
@@ -3390,8 +3449,8 @@ class z {
|
|
|
3390
3449
|
b = new L("SHAKE256", "TEXT").update(b).getHash("HEX", { outputLen: 512 });
|
|
3391
3450
|
l += b;
|
|
3392
3451
|
}
|
|
3393
|
-
n && (l =
|
|
3394
|
-
const h =
|
|
3452
|
+
n && (l = mn(l));
|
|
3453
|
+
const h = Be(l, Math.ceil(l.length / this.atoms.length));
|
|
3395
3454
|
let p = null;
|
|
3396
3455
|
for (let d = 0, b = h.length; d < b; d++)
|
|
3397
3456
|
this.atoms[d].otsFragment = h[d], p = this.atoms[d].position;
|
|
@@ -3664,7 +3723,7 @@ class xe {
|
|
|
3664
3723
|
}
|
|
3665
3724
|
}
|
|
3666
3725
|
const et = 10 ** 18;
|
|
3667
|
-
class
|
|
3726
|
+
class ce {
|
|
3668
3727
|
/**
|
|
3669
3728
|
* @param {number} value
|
|
3670
3729
|
* @return {number}
|
|
@@ -3679,7 +3738,7 @@ class de {
|
|
|
3679
3738
|
* @return {number}
|
|
3680
3739
|
*/
|
|
3681
3740
|
static cmp(e, t, n = !1) {
|
|
3682
|
-
const s =
|
|
3741
|
+
const s = ce.val(e) * et, r = ce.val(t) * et;
|
|
3683
3742
|
return Math.abs(s - r) < 1 ? 0 : s > r ? 1 : -1;
|
|
3684
3743
|
}
|
|
3685
3744
|
/**
|
|
@@ -3688,7 +3747,7 @@ class de {
|
|
|
3688
3747
|
* @return {boolean}
|
|
3689
3748
|
*/
|
|
3690
3749
|
static equal(e, t) {
|
|
3691
|
-
return
|
|
3750
|
+
return ce.cmp(e, t) === 0;
|
|
3692
3751
|
}
|
|
3693
3752
|
}
|
|
3694
3753
|
class te extends x {
|
|
@@ -3715,7 +3774,7 @@ class Ke extends x {
|
|
|
3715
3774
|
super(e, t, n), this.name = "UnauthenticatedException";
|
|
3716
3775
|
}
|
|
3717
3776
|
}
|
|
3718
|
-
|
|
3777
|
+
let C = class {
|
|
3719
3778
|
/**
|
|
3720
3779
|
* Class constructor
|
|
3721
3780
|
*
|
|
@@ -3730,8 +3789,8 @@ class C {
|
|
|
3730
3789
|
}) {
|
|
3731
3790
|
if (this.dataKey = n, this.errorKey = "exception", this.$__payload = null, this.$__query = e, this.$__originResponse = t, this.$__response = t, typeof this.$__response > "u" || this.$__response === null)
|
|
3732
3791
|
throw new te();
|
|
3733
|
-
if (
|
|
3734
|
-
const s =
|
|
3792
|
+
if (M.has(this.$__response, this.errorKey)) {
|
|
3793
|
+
const s = M.get(this.$__response, this.errorKey);
|
|
3735
3794
|
throw String(s).includes("Unauthenticated") ? new Ke() : new te();
|
|
3736
3795
|
}
|
|
3737
3796
|
if (this.$__response.errors && Array.isArray(this.$__response.errors) && this.$__response.errors.length > 0) {
|
|
@@ -3753,9 +3812,9 @@ class C {
|
|
|
3753
3812
|
return this.response();
|
|
3754
3813
|
if (!this.response().data)
|
|
3755
3814
|
throw new te("Response has no data field");
|
|
3756
|
-
if (!
|
|
3815
|
+
if (!M.has(this.response(), this.dataKey))
|
|
3757
3816
|
throw new te(`Missing expected field: ${this.dataKey}`);
|
|
3758
|
-
return
|
|
3817
|
+
return M.get(this.response(), this.dataKey);
|
|
3759
3818
|
}
|
|
3760
3819
|
/**
|
|
3761
3820
|
* @return {object}
|
|
@@ -3897,8 +3956,8 @@ class C {
|
|
|
3897
3956
|
else
|
|
3898
3957
|
return this;
|
|
3899
3958
|
}
|
|
3900
|
-
}
|
|
3901
|
-
class
|
|
3959
|
+
};
|
|
3960
|
+
class N {
|
|
3902
3961
|
/**
|
|
3903
3962
|
* @param {UrqlClientWrapper} graphQLClient
|
|
3904
3963
|
* @param {KnishIOClient} knishIOClient
|
|
@@ -4008,7 +4067,7 @@ class K {
|
|
|
4008
4067
|
return {};
|
|
4009
4068
|
}
|
|
4010
4069
|
}
|
|
4011
|
-
class
|
|
4070
|
+
class hs extends C {
|
|
4012
4071
|
/**
|
|
4013
4072
|
* Class constructor
|
|
4014
4073
|
*
|
|
@@ -4039,7 +4098,7 @@ class us extends C {
|
|
|
4039
4098
|
}), 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;
|
|
4040
4099
|
}
|
|
4041
4100
|
}
|
|
4042
|
-
class
|
|
4101
|
+
class ds extends N {
|
|
4043
4102
|
/**
|
|
4044
4103
|
* @param {UrqlClientWrapper} graphQLClient
|
|
4045
4104
|
* @param {KnishIOClient} knishIOClient
|
|
@@ -4073,13 +4132,13 @@ class hs extends K {
|
|
|
4073
4132
|
* @return {ResponseContinuId}
|
|
4074
4133
|
*/
|
|
4075
4134
|
createResponse(e) {
|
|
4076
|
-
return new
|
|
4135
|
+
return new hs({
|
|
4077
4136
|
query: this,
|
|
4078
4137
|
json: e
|
|
4079
4138
|
});
|
|
4080
4139
|
}
|
|
4081
4140
|
}
|
|
4082
|
-
class
|
|
4141
|
+
class ps extends C {
|
|
4083
4142
|
/**
|
|
4084
4143
|
* Class constructor
|
|
4085
4144
|
*
|
|
@@ -4107,11 +4166,11 @@ class ds extends C {
|
|
|
4107
4166
|
return null;
|
|
4108
4167
|
const t = {};
|
|
4109
4168
|
return e.forEach((n) => {
|
|
4110
|
-
n.metas =
|
|
4169
|
+
n.metas = de.aggregateMeta(n.metas), t[n.bundleHash] = n;
|
|
4111
4170
|
}), t;
|
|
4112
4171
|
}
|
|
4113
4172
|
}
|
|
4114
|
-
class
|
|
4173
|
+
class fs extends N {
|
|
4115
4174
|
/**
|
|
4116
4175
|
* @param {UrqlClientWrapper} graphQLClient
|
|
4117
4176
|
* @param {KnishIOClient} knishIOClient
|
|
@@ -4138,7 +4197,7 @@ class ps extends K {
|
|
|
4138
4197
|
* @return {ResponseWalletBundle}
|
|
4139
4198
|
*/
|
|
4140
4199
|
createResponse(e) {
|
|
4141
|
-
return new
|
|
4200
|
+
return new ps({
|
|
4142
4201
|
query: this,
|
|
4143
4202
|
json: e
|
|
4144
4203
|
});
|
|
@@ -4186,7 +4245,7 @@ class Le extends C {
|
|
|
4186
4245
|
characters: e.characters
|
|
4187
4246
|
}), 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)
|
|
4188
4247
|
for (const s of e.tokenUnits)
|
|
4189
|
-
n.tokenUnits.push(
|
|
4248
|
+
n.tokenUnits.push(fe.createFromGraphQL(s));
|
|
4190
4249
|
if (e.tradeRates.length)
|
|
4191
4250
|
for (const s of e.tradeRates)
|
|
4192
4251
|
n.tradeRates[s.tokenSlug] = s.amount;
|
|
@@ -4219,7 +4278,7 @@ class Le extends C {
|
|
|
4219
4278
|
return this.getWallets();
|
|
4220
4279
|
}
|
|
4221
4280
|
}
|
|
4222
|
-
class
|
|
4281
|
+
class ms extends N {
|
|
4223
4282
|
/**
|
|
4224
4283
|
* @param {UrqlClientWrapper} graphQLClient
|
|
4225
4284
|
* @param {KnishIOClient} knishIOClient
|
|
@@ -4267,7 +4326,7 @@ class fs extends K {
|
|
|
4267
4326
|
});
|
|
4268
4327
|
}
|
|
4269
4328
|
}
|
|
4270
|
-
class
|
|
4329
|
+
class ys extends C {
|
|
4271
4330
|
/**
|
|
4272
4331
|
* Class constructor
|
|
4273
4332
|
*
|
|
@@ -4296,7 +4355,7 @@ class ms extends C {
|
|
|
4296
4355
|
});
|
|
4297
4356
|
}
|
|
4298
4357
|
}
|
|
4299
|
-
class
|
|
4358
|
+
class gs extends N {
|
|
4300
4359
|
/**
|
|
4301
4360
|
* @param {UrqlClientWrapper} graphQLClient
|
|
4302
4361
|
* @param {KnishIOClient} knishIOClient
|
|
@@ -4331,13 +4390,13 @@ class ys extends K {
|
|
|
4331
4390
|
* @return {ResponseBalance}
|
|
4332
4391
|
*/
|
|
4333
4392
|
createResponse(e) {
|
|
4334
|
-
return new
|
|
4393
|
+
return new ys({
|
|
4335
4394
|
query: this,
|
|
4336
4395
|
json: e
|
|
4337
4396
|
});
|
|
4338
4397
|
}
|
|
4339
4398
|
}
|
|
4340
|
-
class
|
|
4399
|
+
class bs extends C {
|
|
4341
4400
|
/**
|
|
4342
4401
|
* Class constructor
|
|
4343
4402
|
*
|
|
@@ -4371,7 +4430,7 @@ class gs extends C {
|
|
|
4371
4430
|
return n.instances && (t.instances = n.instances), n.instanceCount && (t.instanceCount = n.instanceCount), n.paginatorInfo && (t.paginatorInfo = n.paginatorInfo), t;
|
|
4372
4431
|
}
|
|
4373
4432
|
}
|
|
4374
|
-
class At extends
|
|
4433
|
+
class At extends N {
|
|
4375
4434
|
/**
|
|
4376
4435
|
* @param {UrqlClientWrapper} graphQLClient
|
|
4377
4436
|
* @param {KnishIOClient} knishIOClient
|
|
@@ -4440,13 +4499,13 @@ class At extends K {
|
|
|
4440
4499
|
* @return {ResponseMetaType}
|
|
4441
4500
|
*/
|
|
4442
4501
|
createResponse(e) {
|
|
4443
|
-
return new
|
|
4502
|
+
return new bs({
|
|
4444
4503
|
query: this,
|
|
4445
4504
|
json: e
|
|
4446
4505
|
});
|
|
4447
4506
|
}
|
|
4448
4507
|
}
|
|
4449
|
-
class Ie extends
|
|
4508
|
+
class Ie extends N {
|
|
4450
4509
|
/**
|
|
4451
4510
|
* @param {UrqlClientWrapper} graphQLClient
|
|
4452
4511
|
* @param {KnishIOClient} knishIOClient
|
|
@@ -4527,7 +4586,7 @@ class Ie extends K {
|
|
|
4527
4586
|
return t.dataKey = "data.Batch", t;
|
|
4528
4587
|
}
|
|
4529
4588
|
}
|
|
4530
|
-
class
|
|
4589
|
+
class ws extends N {
|
|
4531
4590
|
/**
|
|
4532
4591
|
* @param {UrqlClientWrapper} graphQLClient
|
|
4533
4592
|
* @param {KnishIOClient} knishIOClient
|
|
@@ -4574,7 +4633,7 @@ class V extends C {
|
|
|
4574
4633
|
* Initialize response object with payload data
|
|
4575
4634
|
*/
|
|
4576
4635
|
init() {
|
|
4577
|
-
const e =
|
|
4636
|
+
const e = M.get(this.data(), "payload");
|
|
4578
4637
|
try {
|
|
4579
4638
|
this.$__payload = Object.prototype.toString.call(e) === "[object String]" ? JSON.parse(e) : e;
|
|
4580
4639
|
} catch {
|
|
@@ -4597,7 +4656,7 @@ class V extends C {
|
|
|
4597
4656
|
if (!e)
|
|
4598
4657
|
return null;
|
|
4599
4658
|
const t = new z({});
|
|
4600
|
-
return t.molecularHash =
|
|
4659
|
+
return t.molecularHash = M.get(e, "molecularHash"), t.status = M.get(e, "status"), t.createdAt = M.get(e, "createdAt"), t;
|
|
4601
4660
|
}
|
|
4602
4661
|
/**
|
|
4603
4662
|
* Returns whether molecule was accepted or not
|
|
@@ -4613,7 +4672,7 @@ class V extends C {
|
|
|
4613
4672
|
* @return {string}
|
|
4614
4673
|
*/
|
|
4615
4674
|
status() {
|
|
4616
|
-
return
|
|
4675
|
+
return M.get(this.data(), "status", "rejected");
|
|
4617
4676
|
}
|
|
4618
4677
|
/**
|
|
4619
4678
|
* Returns the reason for rejection
|
|
@@ -4621,7 +4680,7 @@ class V extends C {
|
|
|
4621
4680
|
* @return {string}
|
|
4622
4681
|
*/
|
|
4623
4682
|
reason() {
|
|
4624
|
-
return
|
|
4683
|
+
return M.get(this.data(), "reason", "Invalid response from server");
|
|
4625
4684
|
}
|
|
4626
4685
|
/**
|
|
4627
4686
|
* Returns payload object
|
|
@@ -4632,7 +4691,7 @@ class V extends C {
|
|
|
4632
4691
|
return this.$__payload;
|
|
4633
4692
|
}
|
|
4634
4693
|
}
|
|
4635
|
-
class Qe extends
|
|
4694
|
+
class Qe extends N {
|
|
4636
4695
|
/**
|
|
4637
4696
|
* Creates a new Request for the given parameters
|
|
4638
4697
|
*
|
|
@@ -4747,7 +4806,7 @@ class W extends Qe {
|
|
|
4747
4806
|
return this.$__molecule;
|
|
4748
4807
|
}
|
|
4749
4808
|
}
|
|
4750
|
-
class
|
|
4809
|
+
class ks extends V {
|
|
4751
4810
|
/**
|
|
4752
4811
|
* return the authorization key
|
|
4753
4812
|
*
|
|
@@ -4755,9 +4814,9 @@ class ws extends V {
|
|
|
4755
4814
|
* @return {*}
|
|
4756
4815
|
*/
|
|
4757
4816
|
payloadKey(e) {
|
|
4758
|
-
if (!
|
|
4817
|
+
if (!M.has(this.payload(), e))
|
|
4759
4818
|
throw new te(`ResponseRequestAuthorization::payloadKey() - '${e}' key was not found in the payload!`);
|
|
4760
|
-
return
|
|
4819
|
+
return M.get(this.payload(), e);
|
|
4761
4820
|
}
|
|
4762
4821
|
/**
|
|
4763
4822
|
* Returns the auth token
|
|
@@ -4808,7 +4867,7 @@ class ws extends V {
|
|
|
4808
4867
|
return this.payloadKey("key");
|
|
4809
4868
|
}
|
|
4810
4869
|
}
|
|
4811
|
-
class
|
|
4870
|
+
class _s extends W {
|
|
4812
4871
|
/**
|
|
4813
4872
|
*
|
|
4814
4873
|
* @param {object} meta
|
|
@@ -4823,15 +4882,15 @@ class ks extends W {
|
|
|
4823
4882
|
* @return {ResponseRequestAuthorization}
|
|
4824
4883
|
*/
|
|
4825
4884
|
createResponse(e) {
|
|
4826
|
-
return new
|
|
4885
|
+
return new ks({
|
|
4827
4886
|
query: this,
|
|
4828
4887
|
json: e
|
|
4829
4888
|
});
|
|
4830
4889
|
}
|
|
4831
4890
|
}
|
|
4832
|
-
class
|
|
4891
|
+
class Ss extends V {
|
|
4833
4892
|
}
|
|
4834
|
-
class
|
|
4893
|
+
class $s extends W {
|
|
4835
4894
|
/**
|
|
4836
4895
|
* @param {Wallet|null} recipientWallet
|
|
4837
4896
|
* @param {number|null} amount
|
|
@@ -4857,15 +4916,15 @@ class Ss extends W {
|
|
|
4857
4916
|
* @return {ResponseCreateToken}
|
|
4858
4917
|
*/
|
|
4859
4918
|
createResponse(e) {
|
|
4860
|
-
return new
|
|
4919
|
+
return new Ss({
|
|
4861
4920
|
query: this,
|
|
4862
4921
|
json: e
|
|
4863
4922
|
});
|
|
4864
4923
|
}
|
|
4865
4924
|
}
|
|
4866
|
-
class
|
|
4925
|
+
class As extends V {
|
|
4867
4926
|
}
|
|
4868
|
-
class
|
|
4927
|
+
class vs extends W {
|
|
4869
4928
|
/**
|
|
4870
4929
|
* Fills a Molecule with the appropriate atoms and prepares for broadcast
|
|
4871
4930
|
*
|
|
@@ -4900,13 +4959,13 @@ class As extends W {
|
|
|
4900
4959
|
* @return {ResponseRequestTokens}
|
|
4901
4960
|
*/
|
|
4902
4961
|
createResponse(e) {
|
|
4903
|
-
return new
|
|
4962
|
+
return new As({
|
|
4904
4963
|
query: this,
|
|
4905
4964
|
json: e
|
|
4906
4965
|
});
|
|
4907
4966
|
}
|
|
4908
4967
|
}
|
|
4909
|
-
class
|
|
4968
|
+
class xs extends V {
|
|
4910
4969
|
/**
|
|
4911
4970
|
* Returns result of the transfer
|
|
4912
4971
|
*
|
|
@@ -4920,7 +4979,7 @@ class vs extends V {
|
|
|
4920
4979
|
return e.reason = typeof t.reason > "u" ? "Invalid response from server" : t.reason, e.status = typeof t.status > "u" ? "rejected" : t.status, e;
|
|
4921
4980
|
}
|
|
4922
4981
|
}
|
|
4923
|
-
class
|
|
4982
|
+
class vt extends W {
|
|
4924
4983
|
/**
|
|
4925
4984
|
* Fills the Molecule with provided wallet and amount data
|
|
4926
4985
|
*
|
|
@@ -4936,6 +4995,21 @@ class xs extends W {
|
|
|
4936
4995
|
amount: t
|
|
4937
4996
|
}), this.$__molecule.sign({}), this.$__molecule.check(this.$__molecule.sourceWallet);
|
|
4938
4997
|
}
|
|
4998
|
+
/**
|
|
4999
|
+
* Fills the Molecule for a MULTI-recipient transfer (WP line 544)
|
|
5000
|
+
*
|
|
5001
|
+
* @param {Wallet[]} recipientWallets
|
|
5002
|
+
* @param {number[]} amounts - parallel to recipientWallets
|
|
5003
|
+
*/
|
|
5004
|
+
fillMoleculeMulti({
|
|
5005
|
+
recipientWallets: e,
|
|
5006
|
+
amounts: t
|
|
5007
|
+
}) {
|
|
5008
|
+
this.$__molecule.initValues({
|
|
5009
|
+
recipientWallets: e,
|
|
5010
|
+
amounts: t
|
|
5011
|
+
}), this.$__molecule.sign({}), this.$__molecule.check(this.$__molecule.sourceWallet);
|
|
5012
|
+
}
|
|
4939
5013
|
/**
|
|
4940
5014
|
* Builds a Response object out of a JSON string
|
|
4941
5015
|
*
|
|
@@ -4943,7 +5017,7 @@ class xs extends W {
|
|
|
4943
5017
|
* @return {ResponseTransferTokens}
|
|
4944
5018
|
*/
|
|
4945
5019
|
createResponse(e) {
|
|
4946
|
-
return new
|
|
5020
|
+
return new xs({
|
|
4947
5021
|
query: this,
|
|
4948
5022
|
json: e
|
|
4949
5023
|
});
|
|
@@ -4951,7 +5025,7 @@ class xs extends W {
|
|
|
4951
5025
|
}
|
|
4952
5026
|
class Is extends V {
|
|
4953
5027
|
}
|
|
4954
|
-
class
|
|
5028
|
+
class Ms extends W {
|
|
4955
5029
|
fillMolecule({
|
|
4956
5030
|
type: e,
|
|
4957
5031
|
contact: t,
|
|
@@ -4976,7 +5050,7 @@ class Ts extends W {
|
|
|
4976
5050
|
});
|
|
4977
5051
|
}
|
|
4978
5052
|
}
|
|
4979
|
-
class
|
|
5053
|
+
class Ts extends V {
|
|
4980
5054
|
}
|
|
4981
5055
|
class Cs extends W {
|
|
4982
5056
|
/**
|
|
@@ -5004,7 +5078,7 @@ class Cs extends W {
|
|
|
5004
5078
|
* @return {ResponseClaimShadowWallet}
|
|
5005
5079
|
*/
|
|
5006
5080
|
createResponse(e) {
|
|
5007
|
-
return new
|
|
5081
|
+
return new Ts({
|
|
5008
5082
|
query: this,
|
|
5009
5083
|
json: e
|
|
5010
5084
|
});
|
|
@@ -5135,7 +5209,7 @@ class Bs extends C {
|
|
|
5135
5209
|
* @return {*}
|
|
5136
5210
|
*/
|
|
5137
5211
|
success() {
|
|
5138
|
-
return
|
|
5212
|
+
return M.get(this.data(), "set");
|
|
5139
5213
|
}
|
|
5140
5214
|
/**
|
|
5141
5215
|
* Returns message
|
|
@@ -5143,7 +5217,7 @@ class Bs extends C {
|
|
|
5143
5217
|
* @return {*}
|
|
5144
5218
|
*/
|
|
5145
5219
|
message() {
|
|
5146
|
-
return
|
|
5220
|
+
return M.get(this.data(), "message");
|
|
5147
5221
|
}
|
|
5148
5222
|
}
|
|
5149
5223
|
class Hs extends Qe {
|
|
@@ -5242,9 +5316,9 @@ class Ns extends C {
|
|
|
5242
5316
|
* @return {*}
|
|
5243
5317
|
*/
|
|
5244
5318
|
payloadKey(e) {
|
|
5245
|
-
if (!
|
|
5319
|
+
if (!M.has(this.payload(), e))
|
|
5246
5320
|
throw new te(`ResponseAuthorizationGuest::payloadKey() - '${e}' key is not found in the payload!`);
|
|
5247
|
-
return
|
|
5321
|
+
return M.get(this.payload(), e);
|
|
5248
5322
|
}
|
|
5249
5323
|
/**
|
|
5250
5324
|
* Returns the auth token
|
|
@@ -5323,7 +5397,7 @@ class Fs extends Qe {
|
|
|
5323
5397
|
});
|
|
5324
5398
|
}
|
|
5325
5399
|
}
|
|
5326
|
-
class
|
|
5400
|
+
class xt extends x {
|
|
5327
5401
|
/**
|
|
5328
5402
|
* Class constructor
|
|
5329
5403
|
*
|
|
@@ -5347,7 +5421,7 @@ class Ls extends x {
|
|
|
5347
5421
|
super(e, t, n), this.name = "StackableUnitDecimalsException";
|
|
5348
5422
|
}
|
|
5349
5423
|
}
|
|
5350
|
-
class
|
|
5424
|
+
class _e extends x {
|
|
5351
5425
|
/**
|
|
5352
5426
|
* Class constructor
|
|
5353
5427
|
*
|
|
@@ -5647,7 +5721,7 @@ class Gs extends C {
|
|
|
5647
5721
|
return t;
|
|
5648
5722
|
}
|
|
5649
5723
|
}
|
|
5650
|
-
class Xs extends
|
|
5724
|
+
class Xs extends N {
|
|
5651
5725
|
/**
|
|
5652
5726
|
* @param {UrqlClientWrapper} graphQLClient
|
|
5653
5727
|
* @param {KnishIOClient} knishIOClient
|
|
@@ -5675,126 +5749,7 @@ class Xs extends K {
|
|
|
5675
5749
|
});
|
|
5676
5750
|
}
|
|
5677
5751
|
}
|
|
5678
|
-
class Zs extends
|
|
5679
|
-
/**
|
|
5680
|
-
* Class constructor
|
|
5681
|
-
*
|
|
5682
|
-
* @param {Query} query
|
|
5683
|
-
* @param {object} json
|
|
5684
|
-
*/
|
|
5685
|
-
constructor({
|
|
5686
|
-
query: e,
|
|
5687
|
-
json: t
|
|
5688
|
-
}) {
|
|
5689
|
-
super({
|
|
5690
|
-
query: e,
|
|
5691
|
-
json: t,
|
|
5692
|
-
dataKey: "data.UserActivity"
|
|
5693
|
-
});
|
|
5694
|
-
}
|
|
5695
|
-
payload() {
|
|
5696
|
-
const e = JSON.parse(JSON.stringify(this.data()));
|
|
5697
|
-
if (e.instances)
|
|
5698
|
-
for (const t of e.instances)
|
|
5699
|
-
t.jsonData = JSON.parse(t.jsonData);
|
|
5700
|
-
return e;
|
|
5701
|
-
}
|
|
5702
|
-
}
|
|
5703
|
-
class Ys extends K {
|
|
5704
|
-
/**
|
|
5705
|
-
* @param {UrqlClientWrapper} graphQLClient
|
|
5706
|
-
* @param {KnishIOClient} knishIOClient
|
|
5707
|
-
*/
|
|
5708
|
-
constructor(e, t) {
|
|
5709
|
-
super(e, t), this.$__query = E`query UserActivity (
|
|
5710
|
-
$bundleHash:String,
|
|
5711
|
-
$metaType: String,
|
|
5712
|
-
$metaId: String,
|
|
5713
|
-
$ipAddress: String,
|
|
5714
|
-
$browser: String,
|
|
5715
|
-
$osCpu: String,
|
|
5716
|
-
$resolution: String,
|
|
5717
|
-
$timeZone: String,
|
|
5718
|
-
$countBy: [CountByUserActivity],
|
|
5719
|
-
$interval: span
|
|
5720
|
-
) {
|
|
5721
|
-
UserActivity (
|
|
5722
|
-
bundleHash: $bundleHash,
|
|
5723
|
-
metaType: $metaType,
|
|
5724
|
-
metaId: $metaId,
|
|
5725
|
-
ipAddress: $ipAddress,
|
|
5726
|
-
browser: $browser,
|
|
5727
|
-
osCpu: $osCpu,
|
|
5728
|
-
resolution: $resolution,
|
|
5729
|
-
timeZone: $timeZone,
|
|
5730
|
-
countBy: $countBy,
|
|
5731
|
-
interval: $interval
|
|
5732
|
-
) {
|
|
5733
|
-
createdAt,
|
|
5734
|
-
bundleHash,
|
|
5735
|
-
metaType,
|
|
5736
|
-
metaId,
|
|
5737
|
-
instances {
|
|
5738
|
-
bundleHash,
|
|
5739
|
-
metaType,
|
|
5740
|
-
metaId,
|
|
5741
|
-
jsonData,
|
|
5742
|
-
createdAt,
|
|
5743
|
-
updatedAt
|
|
5744
|
-
},
|
|
5745
|
-
instanceCount {
|
|
5746
|
-
...SubFields,
|
|
5747
|
-
...Recursive
|
|
5748
|
-
}
|
|
5749
|
-
}
|
|
5750
|
-
}
|
|
5751
|
-
|
|
5752
|
-
fragment SubFields on InstanceCountType {
|
|
5753
|
-
id,
|
|
5754
|
-
count
|
|
5755
|
-
}
|
|
5756
|
-
|
|
5757
|
-
fragment Recursive on InstanceCountType {
|
|
5758
|
-
instances {
|
|
5759
|
-
...SubFields
|
|
5760
|
-
instances {
|
|
5761
|
-
...SubFields,
|
|
5762
|
-
instances {
|
|
5763
|
-
...SubFields
|
|
5764
|
-
instances {
|
|
5765
|
-
...SubFields
|
|
5766
|
-
instances {
|
|
5767
|
-
...SubFields
|
|
5768
|
-
instances {
|
|
5769
|
-
...SubFields
|
|
5770
|
-
instances {
|
|
5771
|
-
...SubFields
|
|
5772
|
-
instances {
|
|
5773
|
-
...SubFields
|
|
5774
|
-
}
|
|
5775
|
-
}
|
|
5776
|
-
}
|
|
5777
|
-
}
|
|
5778
|
-
}
|
|
5779
|
-
}
|
|
5780
|
-
}
|
|
5781
|
-
}
|
|
5782
|
-
}`;
|
|
5783
|
-
}
|
|
5784
|
-
/**
|
|
5785
|
-
* Returns a Response object
|
|
5786
|
-
*
|
|
5787
|
-
* @param {object} json
|
|
5788
|
-
* @return {ResponseQueryUserActivity}
|
|
5789
|
-
*/
|
|
5790
|
-
createResponse(e) {
|
|
5791
|
-
return new Zs({
|
|
5792
|
-
query: this,
|
|
5793
|
-
json: e
|
|
5794
|
-
});
|
|
5795
|
-
}
|
|
5796
|
-
}
|
|
5797
|
-
class er extends K {
|
|
5752
|
+
class Zs extends N {
|
|
5798
5753
|
/**
|
|
5799
5754
|
* @param {UrqlClientWrapper} graphQLClient
|
|
5800
5755
|
* @param {KnishIOClient} knishIOClient
|
|
@@ -5825,7 +5780,7 @@ class er extends K {
|
|
|
5825
5780
|
});
|
|
5826
5781
|
}
|
|
5827
5782
|
}
|
|
5828
|
-
class
|
|
5783
|
+
class It extends x {
|
|
5829
5784
|
/**
|
|
5830
5785
|
* Class constructor
|
|
5831
5786
|
*
|
|
@@ -5837,7 +5792,7 @@ class xt extends x {
|
|
|
5837
5792
|
super(e, t, n), this.name = "AuthorizationRejectedException";
|
|
5838
5793
|
}
|
|
5839
5794
|
}
|
|
5840
|
-
class
|
|
5795
|
+
class Ys extends C {
|
|
5841
5796
|
/**
|
|
5842
5797
|
* Class constructor
|
|
5843
5798
|
*
|
|
@@ -5885,7 +5840,7 @@ class tr extends C {
|
|
|
5885
5840
|
return t;
|
|
5886
5841
|
}
|
|
5887
5842
|
}
|
|
5888
|
-
class
|
|
5843
|
+
class Mt extends N {
|
|
5889
5844
|
/**
|
|
5890
5845
|
* @param {UrqlClientWrapper} graphQLClient
|
|
5891
5846
|
* @param {KnishIOClient} knishIOClient
|
|
@@ -6001,7 +5956,7 @@ class It extends K {
|
|
|
6001
5956
|
values: f,
|
|
6002
5957
|
value: m,
|
|
6003
5958
|
metaTypes: w,
|
|
6004
|
-
metaType:
|
|
5959
|
+
metaType: T,
|
|
6005
5960
|
metaIds: k,
|
|
6006
5961
|
metaId: $,
|
|
6007
5962
|
indexes: v,
|
|
@@ -6010,7 +5965,7 @@ class It extends K {
|
|
|
6010
5965
|
latest: U,
|
|
6011
5966
|
queryArgs: R
|
|
6012
5967
|
}) {
|
|
6013
|
-
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)), b && (d = d || [], d.push(b)), O && (A = A || [], A.push(O)), m && (f = f || [], f.push(m)),
|
|
5968
|
+
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)), b && (d = d || [], d.push(b)), O && (A = A || [], A.push(O)), m && (f = f || [], f.push(m)), T && (w = w || [], w.push(T)), $ && (k = k || [], k.push($)), I && (v = v || [], v.push(I)), {
|
|
6014
5969
|
molecularHashes: e,
|
|
6015
5970
|
bundleHashes: n,
|
|
6016
5971
|
positions: r,
|
|
@@ -6035,13 +5990,13 @@ class It extends K {
|
|
|
6035
5990
|
* @return {ResponseAtom}
|
|
6036
5991
|
*/
|
|
6037
5992
|
createResponse(e) {
|
|
6038
|
-
return new
|
|
5993
|
+
return new Ys({
|
|
6039
5994
|
query: this,
|
|
6040
5995
|
json: e
|
|
6041
5996
|
});
|
|
6042
5997
|
}
|
|
6043
5998
|
}
|
|
6044
|
-
class
|
|
5999
|
+
class er extends C {
|
|
6045
6000
|
/**
|
|
6046
6001
|
* Class constructor
|
|
6047
6002
|
*
|
|
@@ -6066,7 +6021,7 @@ class nr extends C {
|
|
|
6066
6021
|
return e && e.callback ? JSON.parse(e.callback) : null;
|
|
6067
6022
|
}
|
|
6068
6023
|
}
|
|
6069
|
-
class
|
|
6024
|
+
class tr extends N {
|
|
6070
6025
|
/**
|
|
6071
6026
|
* @param {UrqlClientWrapper} graphQLClient
|
|
6072
6027
|
* @param {KnishIOClient} knishIOClient
|
|
@@ -6092,13 +6047,13 @@ class sr extends K {
|
|
|
6092
6047
|
* @return {ResponsePolicy}
|
|
6093
6048
|
*/
|
|
6094
6049
|
createResponse(e) {
|
|
6095
|
-
return new
|
|
6050
|
+
return new er({
|
|
6096
6051
|
query: this,
|
|
6097
6052
|
json: e
|
|
6098
6053
|
});
|
|
6099
6054
|
}
|
|
6100
6055
|
}
|
|
6101
|
-
class
|
|
6056
|
+
class nr extends C {
|
|
6102
6057
|
/**
|
|
6103
6058
|
* Class constructor
|
|
6104
6059
|
*
|
|
@@ -6127,7 +6082,7 @@ class rr extends C {
|
|
|
6127
6082
|
return n.instances && (t.instances = n.instances), n.instanceCount && (t.instanceCount = n.instanceCount), n.paginatorInfo && (t.paginatorInfo = n.paginatorInfo), t;
|
|
6128
6083
|
}
|
|
6129
6084
|
}
|
|
6130
|
-
class Tt extends
|
|
6085
|
+
class Tt extends N {
|
|
6131
6086
|
/**
|
|
6132
6087
|
* @param {UrqlClientWrapper} graphQLClient
|
|
6133
6088
|
* @param {KnishIOClient} knishIOClient
|
|
@@ -6213,7 +6168,7 @@ class Tt extends K {
|
|
|
6213
6168
|
* @return {ResponseMetaTypeViaAtom}
|
|
6214
6169
|
*/
|
|
6215
6170
|
createResponse(e) {
|
|
6216
|
-
return new
|
|
6171
|
+
return new nr({
|
|
6217
6172
|
query: this,
|
|
6218
6173
|
json: e
|
|
6219
6174
|
});
|
|
@@ -6320,7 +6275,7 @@ class ot extends C {
|
|
|
6320
6275
|
};
|
|
6321
6276
|
}
|
|
6322
6277
|
}
|
|
6323
|
-
class
|
|
6278
|
+
class Ct extends N {
|
|
6324
6279
|
/**
|
|
6325
6280
|
* @param {UrqlClientWrapper} graphQLClient
|
|
6326
6281
|
* @param {KnishIOClient} knishIOClient
|
|
@@ -6433,7 +6388,7 @@ class Mt extends K {
|
|
|
6433
6388
|
});
|
|
6434
6389
|
}
|
|
6435
6390
|
}
|
|
6436
|
-
class
|
|
6391
|
+
class sr extends C {
|
|
6437
6392
|
/**
|
|
6438
6393
|
* Class constructor
|
|
6439
6394
|
*
|
|
@@ -6469,7 +6424,7 @@ class ir extends C {
|
|
|
6469
6424
|
return !e || !Array.isArray(e) || e.length === 0 ? null : e;
|
|
6470
6425
|
}
|
|
6471
6426
|
}
|
|
6472
|
-
class
|
|
6427
|
+
class Et extends N {
|
|
6473
6428
|
/**
|
|
6474
6429
|
* @param {UrqlClientWrapper} graphQLClient
|
|
6475
6430
|
* @param {KnishIOClient} knishIOClient
|
|
@@ -6513,15 +6468,15 @@ class Ct extends K {
|
|
|
6513
6468
|
* @return {ResponseEmbeddingStatus}
|
|
6514
6469
|
*/
|
|
6515
6470
|
createResponse(e) {
|
|
6516
|
-
return new
|
|
6471
|
+
return new sr({
|
|
6517
6472
|
query: this,
|
|
6518
6473
|
json: e
|
|
6519
6474
|
});
|
|
6520
6475
|
}
|
|
6521
6476
|
}
|
|
6522
|
-
class
|
|
6477
|
+
class rr extends V {
|
|
6523
6478
|
}
|
|
6524
|
-
class
|
|
6479
|
+
class ir extends W {
|
|
6525
6480
|
/**
|
|
6526
6481
|
*
|
|
6527
6482
|
* @param {string} metaType
|
|
@@ -6549,13 +6504,13 @@ class ar extends W {
|
|
|
6549
6504
|
* @return {ResponseCreateRule}
|
|
6550
6505
|
*/
|
|
6551
6506
|
createResponse(e) {
|
|
6552
|
-
return new
|
|
6507
|
+
return new rr({
|
|
6553
6508
|
query: this,
|
|
6554
6509
|
json: e
|
|
6555
6510
|
});
|
|
6556
6511
|
}
|
|
6557
6512
|
}
|
|
6558
|
-
class
|
|
6513
|
+
class or extends W {
|
|
6559
6514
|
/**
|
|
6560
6515
|
* Fills the Molecule with provided wallet and amount data
|
|
6561
6516
|
*
|
|
@@ -6572,7 +6527,7 @@ class lr extends W {
|
|
|
6572
6527
|
}), this.$__molecule.sign({}), this.$__molecule.check(this.$__molecule.sourceWallet);
|
|
6573
6528
|
}
|
|
6574
6529
|
}
|
|
6575
|
-
class
|
|
6530
|
+
class ar extends W {
|
|
6576
6531
|
/**
|
|
6577
6532
|
*
|
|
6578
6533
|
* @param recipients
|
|
@@ -6588,7 +6543,7 @@ class cr extends W {
|
|
|
6588
6543
|
}), this.$__molecule.sign({}), this.$__molecule.check(this.$__molecule.sourceWallet);
|
|
6589
6544
|
}
|
|
6590
6545
|
}
|
|
6591
|
-
function
|
|
6546
|
+
function Z(o, e, t, n) {
|
|
6592
6547
|
return new (t || (t = Promise))((function(s, r) {
|
|
6593
6548
|
function i(u) {
|
|
6594
6549
|
try {
|
|
@@ -6613,7 +6568,7 @@ function X(o, e, t, n) {
|
|
|
6613
6568
|
c((n = n.apply(o, [])).next());
|
|
6614
6569
|
}));
|
|
6615
6570
|
}
|
|
6616
|
-
function
|
|
6571
|
+
function Y(o, e) {
|
|
6617
6572
|
var t, n, s, r, i = { label: 0, sent: function() {
|
|
6618
6573
|
if (1 & s[0]) throw s[1];
|
|
6619
6574
|
return s[1];
|
|
@@ -6672,10 +6627,10 @@ function Z(o, e) {
|
|
|
6672
6627
|
};
|
|
6673
6628
|
}
|
|
6674
6629
|
}
|
|
6675
|
-
var q = { exclude: [], include: [], logging: !0 },
|
|
6676
|
-
typeof window < "u" && (
|
|
6677
|
-
},
|
|
6678
|
-
return Object.fromEntries(Object.entries(
|
|
6630
|
+
var q = { exclude: [], include: [], logging: !0 }, Gt = {}, lr = { timeout: "true" }, J = function(o, e) {
|
|
6631
|
+
typeof window < "u" && (Gt[o] = e);
|
|
6632
|
+
}, cr = function() {
|
|
6633
|
+
return Object.fromEntries(Object.entries(Gt).filter((function(o) {
|
|
6679
6634
|
var e, t = o[0];
|
|
6680
6635
|
return !(!((e = q == null ? void 0 : q.exclude) === null || e === void 0) && e.includes(t));
|
|
6681
6636
|
})).filter((function(o) {
|
|
@@ -6689,7 +6644,7 @@ var q = { exclude: [], include: [], logging: !0 }, Jt = {}, ur = { timeout: "tru
|
|
|
6689
6644
|
return [o[0], (0, o[1])()];
|
|
6690
6645
|
})));
|
|
6691
6646
|
};
|
|
6692
|
-
function
|
|
6647
|
+
function Re(o) {
|
|
6693
6648
|
return o ^= o >>> 16, o = Math.imul(o, 2246822507), o ^= o >>> 13, o = Math.imul(o, 3266489909), (o ^= o >>> 16) >>> 0;
|
|
6694
6649
|
}
|
|
6695
6650
|
var B = new Uint32Array([597399067, 2869860233, 951274213, 2716044179]);
|
|
@@ -6740,42 +6695,42 @@ function at(o, e) {
|
|
|
6740
6695
|
u[0] = u[0] ^ l[0] << 0, u[0] = Math.imul(u[0], B[0]), u[0] = j(u[0], 15), u[0] = Math.imul(u[0], B[1]), i[0] = i[0] ^ u[0];
|
|
6741
6696
|
}
|
|
6742
6697
|
})(o, n), (function(r, i) {
|
|
6743
|
-
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] =
|
|
6698
|
+
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;
|
|
6744
6699
|
})(o, n);
|
|
6745
6700
|
var s = new Uint8Array(n.buffer);
|
|
6746
6701
|
return Array.from(s).map((function(r) {
|
|
6747
6702
|
return r.toString(16).padStart(2, "0");
|
|
6748
6703
|
})).join("");
|
|
6749
6704
|
}
|
|
6750
|
-
function
|
|
6705
|
+
function ur(o, e) {
|
|
6751
6706
|
return new Promise((function(t) {
|
|
6752
6707
|
setTimeout((function() {
|
|
6753
6708
|
return t(e);
|
|
6754
6709
|
}), o);
|
|
6755
6710
|
}));
|
|
6756
6711
|
}
|
|
6757
|
-
function
|
|
6712
|
+
function hr(o, e, t) {
|
|
6758
6713
|
return Promise.all(o.map((function(n) {
|
|
6759
|
-
return Promise.race([n,
|
|
6714
|
+
return Promise.race([n, ur(e, t)]);
|
|
6760
6715
|
})));
|
|
6761
6716
|
}
|
|
6762
|
-
var
|
|
6763
|
-
function
|
|
6764
|
-
return
|
|
6717
|
+
var dr = "0.19.1";
|
|
6718
|
+
function pr() {
|
|
6719
|
+
return dr;
|
|
6765
6720
|
}
|
|
6766
|
-
function
|
|
6767
|
-
return
|
|
6721
|
+
function Xt() {
|
|
6722
|
+
return Z(this, void 0, void 0, (function() {
|
|
6768
6723
|
var o, e, t, n, s;
|
|
6769
|
-
return
|
|
6724
|
+
return Y(this, (function(r) {
|
|
6770
6725
|
switch (r.label) {
|
|
6771
6726
|
case 0:
|
|
6772
|
-
return r.trys.push([0, 2, , 3]), o =
|
|
6727
|
+
return r.trys.push([0, 2, , 3]), o = cr(), e = Object.keys(o), [4, hr(Object.values(o), (q == null ? void 0 : q.timeout) || 1e3, lr)];
|
|
6773
6728
|
case 1:
|
|
6774
6729
|
return t = r.sent(), n = t.filter((function(i) {
|
|
6775
6730
|
return i !== void 0;
|
|
6776
6731
|
})), s = {}, n.forEach((function(i, a) {
|
|
6777
6732
|
s[e[a]] = i;
|
|
6778
|
-
})), [2,
|
|
6733
|
+
})), [2, Zt(s, q.exclude || [], q.include || [], "")];
|
|
6779
6734
|
case 2:
|
|
6780
6735
|
throw r.sent();
|
|
6781
6736
|
case 3:
|
|
@@ -6784,7 +6739,7 @@ function Gt() {
|
|
|
6784
6739
|
}));
|
|
6785
6740
|
}));
|
|
6786
6741
|
}
|
|
6787
|
-
function
|
|
6742
|
+
function Zt(o, e, t, n) {
|
|
6788
6743
|
n === void 0 && (n = "");
|
|
6789
6744
|
for (var s = {}, r = function(u, l) {
|
|
6790
6745
|
var h = n + u + ".";
|
|
@@ -6796,7 +6751,7 @@ function Xt(o, e, t, n) {
|
|
|
6796
6751
|
}));
|
|
6797
6752
|
p && !d || (s[u] = l);
|
|
6798
6753
|
} else {
|
|
6799
|
-
var b =
|
|
6754
|
+
var b = Zt(l, e, t, h);
|
|
6800
6755
|
Object.keys(b).length > 0 && (s[u] = b);
|
|
6801
6756
|
}
|
|
6802
6757
|
}, i = 0, a = Object.entries(o); i < a.length; i++) {
|
|
@@ -6805,21 +6760,21 @@ function Xt(o, e, t, n) {
|
|
|
6805
6760
|
}
|
|
6806
6761
|
return s;
|
|
6807
6762
|
}
|
|
6808
|
-
function
|
|
6809
|
-
return
|
|
6763
|
+
function fr(o) {
|
|
6764
|
+
return Z(this, void 0, void 0, (function() {
|
|
6810
6765
|
var e, t;
|
|
6811
|
-
return
|
|
6766
|
+
return Y(this, (function(n) {
|
|
6812
6767
|
switch (n.label) {
|
|
6813
6768
|
case 0:
|
|
6814
|
-
return n.trys.push([0, 2, , 3]), [4,
|
|
6769
|
+
return n.trys.push([0, 2, , 3]), [4, Xt()];
|
|
6815
6770
|
case 1:
|
|
6816
6771
|
return e = n.sent(), t = at(JSON.stringify(e)), Math.random() < 1e-3 && q.logging && (function(s, r) {
|
|
6817
|
-
|
|
6772
|
+
Z(this, void 0, void 0, (function() {
|
|
6818
6773
|
var i, a;
|
|
6819
|
-
return
|
|
6774
|
+
return Y(this, (function(c) {
|
|
6820
6775
|
switch (c.label) {
|
|
6821
6776
|
case 0:
|
|
6822
|
-
if (i = "https://logging.thumbmarkjs.com/v1/log", a = { thumbmark: s, components: r, version:
|
|
6777
|
+
if (i = "https://logging.thumbmarkjs.com/v1/log", a = { thumbmark: s, components: r, version: pr() }, sessionStorage.getItem("_tmjs_l")) return [3, 4];
|
|
6823
6778
|
sessionStorage.setItem("_tmjs_l", "1"), c.label = 1;
|
|
6824
6779
|
case 1:
|
|
6825
6780
|
return c.trys.push([1, 3, , 4]), [4, fetch(i, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(a) })];
|
|
@@ -6840,19 +6795,19 @@ function yr(o) {
|
|
|
6840
6795
|
}));
|
|
6841
6796
|
}));
|
|
6842
6797
|
}
|
|
6843
|
-
function
|
|
6798
|
+
function mr(o) {
|
|
6844
6799
|
for (var e = 0, t = 0; t < o.length; ++t) e += Math.abs(o[t]);
|
|
6845
6800
|
return e;
|
|
6846
6801
|
}
|
|
6847
|
-
function
|
|
6802
|
+
function Yt(o, e, t) {
|
|
6848
6803
|
for (var n = [], s = 0; s < o[0].data.length; s++) {
|
|
6849
6804
|
for (var r = [], i = 0; i < o.length; i++) r.push(o[i].data[s]);
|
|
6850
|
-
n.push(
|
|
6805
|
+
n.push(yr(r));
|
|
6851
6806
|
}
|
|
6852
6807
|
var a = new Uint8ClampedArray(n);
|
|
6853
6808
|
return new ImageData(a, e, t);
|
|
6854
6809
|
}
|
|
6855
|
-
function
|
|
6810
|
+
function yr(o) {
|
|
6856
6811
|
if (o.length === 0) return 0;
|
|
6857
6812
|
for (var e = {}, t = 0, n = o; t < n.length; t++)
|
|
6858
6813
|
e[r = n[t]] = (e[r] || 0) + 1;
|
|
@@ -6860,7 +6815,7 @@ function br(o) {
|
|
|
6860
6815
|
for (var r in e) e[r] > e[s] && (s = parseInt(r, 10));
|
|
6861
6816
|
return s;
|
|
6862
6817
|
}
|
|
6863
|
-
function
|
|
6818
|
+
function Me() {
|
|
6864
6819
|
if (typeof navigator > "u") return { name: "unknown", version: "unknown" };
|
|
6865
6820
|
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++) {
|
|
6866
6821
|
var s = n[t], r = o.match(s);
|
|
@@ -6869,15 +6824,15 @@ function Te() {
|
|
|
6869
6824
|
return { name: "unknown", version: "unknown" };
|
|
6870
6825
|
}
|
|
6871
6826
|
J("audio", (function() {
|
|
6872
|
-
return
|
|
6873
|
-
return
|
|
6827
|
+
return Z(this, void 0, void 0, (function() {
|
|
6828
|
+
return Y(this, (function(o) {
|
|
6874
6829
|
return [2, new Promise((function(e, t) {
|
|
6875
6830
|
try {
|
|
6876
6831
|
var n = new (window.OfflineAudioContext || window.webkitOfflineAudioContext)(1, 5e3, 44100), s = n.createBufferSource(), r = n.createOscillator();
|
|
6877
6832
|
r.frequency.value = 1e3;
|
|
6878
6833
|
var i, a = n.createDynamicsCompressor();
|
|
6879
6834
|
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) {
|
|
6880
|
-
i = c.renderedBuffer.getChannelData(0), e({ sampleHash:
|
|
6835
|
+
i = c.renderedBuffer.getChannelData(0), e({ sampleHash: mr(i), oscillator: r.type, maxChannels: n.destination.maxChannelCount, channelCountMode: s.channelCountMode });
|
|
6881
6836
|
}, n.startRendering();
|
|
6882
6837
|
} catch (c) {
|
|
6883
6838
|
console.error("Error creating audio fingerprint:", c), t(c);
|
|
@@ -6886,14 +6841,14 @@ J("audio", (function() {
|
|
|
6886
6841
|
}));
|
|
6887
6842
|
}));
|
|
6888
6843
|
}));
|
|
6889
|
-
var
|
|
6890
|
-
|
|
6844
|
+
var gr = Me().name !== "SamsungBrowser" ? 1 : 3, Ot = 280, Rt = 20;
|
|
6845
|
+
Me().name != "Firefox" && J("canvas", (function() {
|
|
6891
6846
|
return document.createElement("canvas").getContext("2d"), new Promise((function(o) {
|
|
6892
|
-
var e = Array.from({ length:
|
|
6847
|
+
var e = Array.from({ length: gr }, (function() {
|
|
6893
6848
|
return (function() {
|
|
6894
6849
|
var t = document.createElement("canvas"), n = t.getContext("2d");
|
|
6895
6850
|
if (!n) return new ImageData(1, 1);
|
|
6896
|
-
t.width =
|
|
6851
|
+
t.width = Ot, t.height = Rt;
|
|
6897
6852
|
var s = n.createLinearGradient(0, 0, t.width, t.height);
|
|
6898
6853
|
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);
|
|
6899
6854
|
var r = "Random Text WMwmil10Oo";
|
|
@@ -6902,15 +6857,15 @@ Te().name != "Firefox" && J("canvas", (function() {
|
|
|
6902
6857
|
return i;
|
|
6903
6858
|
})();
|
|
6904
6859
|
}));
|
|
6905
|
-
o({ commonImageDataHash: at(
|
|
6860
|
+
o({ commonImageDataHash: at(Yt(e, Ot, Rt).data.toString()).toString() });
|
|
6906
6861
|
}));
|
|
6907
6862
|
}));
|
|
6908
|
-
var tt,
|
|
6909
|
-
function
|
|
6863
|
+
var tt, br = ["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"], wr = ["monospace", "sans-serif", "serif"];
|
|
6864
|
+
function qt(o, e) {
|
|
6910
6865
|
if (!o) throw new Error("Canvas context not supported");
|
|
6911
6866
|
return o.font, o.font = "72px ".concat(e), o.measureText("WwMmLli0Oo").width;
|
|
6912
6867
|
}
|
|
6913
|
-
function
|
|
6868
|
+
function kr() {
|
|
6914
6869
|
var o, e = document.createElement("canvas"), t = (o = e.getContext("webgl")) !== null && o !== void 0 ? o : e.getContext("experimental-webgl");
|
|
6915
6870
|
if (t && "getParameter" in t) try {
|
|
6916
6871
|
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() };
|
|
@@ -6926,11 +6881,11 @@ function Sr() {
|
|
|
6926
6881
|
}
|
|
6927
6882
|
return "undefined";
|
|
6928
6883
|
}
|
|
6929
|
-
function
|
|
6884
|
+
function _r() {
|
|
6930
6885
|
var o = new Float32Array(1), e = new Uint8Array(o.buffer);
|
|
6931
6886
|
return o[0] = 1 / 0, o[0] = o[0] - o[0], e[3];
|
|
6932
6887
|
}
|
|
6933
|
-
function
|
|
6888
|
+
function Sr(o, e) {
|
|
6934
6889
|
var t = {};
|
|
6935
6890
|
return e.forEach((function(n) {
|
|
6936
6891
|
var s = (function(r) {
|
|
@@ -6952,7 +6907,7 @@ function Ar(o, e) {
|
|
|
6952
6907
|
s && (t[n] = s);
|
|
6953
6908
|
})), t;
|
|
6954
6909
|
}
|
|
6955
|
-
function
|
|
6910
|
+
function $r() {
|
|
6956
6911
|
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"] };
|
|
6957
6912
|
return Object.keys(e).forEach((function(t) {
|
|
6958
6913
|
e[t].forEach((function(n) {
|
|
@@ -6960,7 +6915,7 @@ function vr() {
|
|
|
6960
6915
|
}));
|
|
6961
6916
|
})), o;
|
|
6962
6917
|
}
|
|
6963
|
-
function
|
|
6918
|
+
function Ar() {
|
|
6964
6919
|
if (window.location.protocol === "https:" && typeof window.ApplePaySession == "function") try {
|
|
6965
6920
|
for (var o = window.ApplePaySession.supportsVersion, e = 15; e > 0; e--) if (o(e)) return e;
|
|
6966
6921
|
} catch {
|
|
@@ -6968,15 +6923,15 @@ function xr() {
|
|
|
6968
6923
|
}
|
|
6969
6924
|
return 0;
|
|
6970
6925
|
}
|
|
6971
|
-
|
|
6926
|
+
Me().name != "Firefox" && J("fonts", (function() {
|
|
6972
6927
|
var o = this;
|
|
6973
6928
|
return new Promise((function(e, t) {
|
|
6974
6929
|
try {
|
|
6975
6930
|
(function(n) {
|
|
6976
6931
|
var s;
|
|
6977
|
-
|
|
6932
|
+
Z(this, void 0, void 0, (function() {
|
|
6978
6933
|
var r, i, a;
|
|
6979
|
-
return
|
|
6934
|
+
return Y(this, (function(c) {
|
|
6980
6935
|
switch (c.label) {
|
|
6981
6936
|
case 0:
|
|
6982
6937
|
return document.body ? [3, 2] : [4, (u = 50, new Promise((function(h) {
|
|
@@ -6995,13 +6950,13 @@ Te().name != "Firefox" && J("fonts", (function() {
|
|
|
6995
6950
|
}));
|
|
6996
6951
|
})((function(n) {
|
|
6997
6952
|
var s = n.iframe;
|
|
6998
|
-
return
|
|
6953
|
+
return Z(o, void 0, void 0, (function() {
|
|
6999
6954
|
var r, i, a, c;
|
|
7000
|
-
return
|
|
7001
|
-
return r = s.createElement("canvas"), i = r.getContext("2d"), a =
|
|
7002
|
-
return
|
|
7003
|
-
})), c = {},
|
|
7004
|
-
var h =
|
|
6955
|
+
return Y(this, (function(u) {
|
|
6956
|
+
return r = s.createElement("canvas"), i = r.getContext("2d"), a = wr.map((function(l) {
|
|
6957
|
+
return qt(i, l);
|
|
6958
|
+
})), c = {}, br.forEach((function(l) {
|
|
6959
|
+
var h = qt(i, l);
|
|
7005
6960
|
a.includes(h) || (c[l] = h);
|
|
7006
6961
|
})), e(c), [2];
|
|
7007
6962
|
}));
|
|
@@ -7014,21 +6969,21 @@ Te().name != "Firefox" && J("fonts", (function() {
|
|
|
7014
6969
|
})), J("hardware", (function() {
|
|
7015
6970
|
return new Promise((function(o, e) {
|
|
7016
6971
|
var t = navigator.deviceMemory !== void 0 ? navigator.deviceMemory : 0, n = window.performance && window.performance.memory ? window.performance.memory : 0;
|
|
7017
|
-
o({ videocard:
|
|
6972
|
+
o({ videocard: kr(), architecture: _r(), deviceMemory: t.toString() || "undefined", jsHeapSizeLimit: n.jsHeapSizeLimit || 0 });
|
|
7018
6973
|
}));
|
|
7019
6974
|
})), J("locales", (function() {
|
|
7020
6975
|
return new Promise((function(o) {
|
|
7021
6976
|
o({ languages: navigator.language, timezone: Intl.DateTimeFormat().resolvedOptions().timeZone });
|
|
7022
6977
|
}));
|
|
7023
6978
|
})), J("permissions", (function() {
|
|
7024
|
-
return
|
|
6979
|
+
return Z(this, void 0, void 0, (function() {
|
|
7025
6980
|
var o;
|
|
7026
|
-
return
|
|
6981
|
+
return Y(this, (function(e) {
|
|
7027
6982
|
return tt = (q == null ? void 0 : q.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: (q == null ? void 0 : q.retries) || 3 }, (function() {
|
|
7028
6983
|
return (function() {
|
|
7029
|
-
return
|
|
6984
|
+
return Z(this, void 0, void 0, (function() {
|
|
7030
6985
|
var t, n, s, r, i;
|
|
7031
|
-
return
|
|
6986
|
+
return Y(this, (function(a) {
|
|
7032
6987
|
switch (a.label) {
|
|
7033
6988
|
case 0:
|
|
7034
6989
|
t = {}, n = 0, s = tt, a.label = 1;
|
|
@@ -7050,7 +7005,7 @@ Te().name != "Firefox" && J("fonts", (function() {
|
|
|
7050
7005
|
}));
|
|
7051
7006
|
})();
|
|
7052
7007
|
})), [2, Promise.all(o).then((function(t) {
|
|
7053
|
-
return
|
|
7008
|
+
return Sr(t, tt);
|
|
7054
7009
|
}))];
|
|
7055
7010
|
}));
|
|
7056
7011
|
}));
|
|
@@ -7065,23 +7020,23 @@ Te().name != "Firefox" && J("fonts", (function() {
|
|
|
7065
7020
|
}));
|
|
7066
7021
|
})), J("screen", (function() {
|
|
7067
7022
|
return new Promise((function(o) {
|
|
7068
|
-
o({ is_touchscreen: navigator.maxTouchPoints > 0, maxTouchPoints: navigator.maxTouchPoints, colorDepth: screen.colorDepth, mediaMatches:
|
|
7023
|
+
o({ is_touchscreen: navigator.maxTouchPoints > 0, maxTouchPoints: navigator.maxTouchPoints, colorDepth: screen.colorDepth, mediaMatches: $r() });
|
|
7069
7024
|
}));
|
|
7070
7025
|
})), J("system", (function() {
|
|
7071
7026
|
return new Promise((function(o) {
|
|
7072
|
-
var e =
|
|
7073
|
-
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:
|
|
7027
|
+
var e = Me();
|
|
7028
|
+
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: Ar() });
|
|
7074
7029
|
}));
|
|
7075
7030
|
}));
|
|
7076
|
-
var
|
|
7031
|
+
var K, vr = Me().name !== "SamsungBrowser" ? 1 : 3, y = null;
|
|
7077
7032
|
J("webgl", (function() {
|
|
7078
|
-
return
|
|
7033
|
+
return Z(this, void 0, void 0, (function() {
|
|
7079
7034
|
var o;
|
|
7080
|
-
return
|
|
7081
|
-
typeof document < "u" && ((
|
|
7035
|
+
return Y(this, (function(e) {
|
|
7036
|
+
typeof document < "u" && ((K = document.createElement("canvas")).width = 200, K.height = 100, y = K.getContext("webgl"));
|
|
7082
7037
|
try {
|
|
7083
7038
|
if (!y) throw new Error("WebGL not supported");
|
|
7084
|
-
return o = Array.from({ length:
|
|
7039
|
+
return o = Array.from({ length: vr }, (function() {
|
|
7085
7040
|
return (function() {
|
|
7086
7041
|
try {
|
|
7087
7042
|
if (!y) throw new Error("WebGL not supported");
|
|
@@ -7105,21 +7060,21 @@ J("webgl", (function() {
|
|
|
7105
7060
|
y.useProgram(i);
|
|
7106
7061
|
for (var a = 137, c = new Float32Array(4 * a), u = 2 * Math.PI / a, l = 0; l < a; l++) {
|
|
7107
7062
|
var h = l * u;
|
|
7108
|
-
c[4 * l] = 0, c[4 * l + 1] = 0, c[4 * l + 2] = Math.cos(h) * (
|
|
7063
|
+
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);
|
|
7109
7064
|
}
|
|
7110
7065
|
var p = y.createBuffer();
|
|
7111
7066
|
y.bindBuffer(y.ARRAY_BUFFER, p), y.bufferData(y.ARRAY_BUFFER, c, y.STATIC_DRAW);
|
|
7112
7067
|
var d = y.getAttribLocation(i, "position");
|
|
7113
|
-
y.enableVertexAttribArray(d), y.vertexAttribPointer(d, 2, y.FLOAT, !1, 0, 0), y.viewport(0, 0,
|
|
7114
|
-
var b = new Uint8ClampedArray(
|
|
7115
|
-
return y.readPixels(0, 0,
|
|
7068
|
+
y.enableVertexAttribArray(d), y.vertexAttribPointer(d, 2, y.FLOAT, !1, 0, 0), y.viewport(0, 0, K.width, K.height), y.clearColor(0, 0, 0, 1), y.clear(y.COLOR_BUFFER_BIT), y.drawArrays(y.LINES, 0, 2 * a);
|
|
7069
|
+
var b = new Uint8ClampedArray(K.width * K.height * 4);
|
|
7070
|
+
return y.readPixels(0, 0, K.width, K.height, y.RGBA, y.UNSIGNED_BYTE, b), new ImageData(b, K.width, K.height);
|
|
7116
7071
|
} catch {
|
|
7117
7072
|
return new ImageData(1, 1);
|
|
7118
7073
|
} finally {
|
|
7119
7074
|
y && (y.bindBuffer(y.ARRAY_BUFFER, null), y.useProgram(null), y.viewport(0, 0, y.drawingBufferWidth, y.drawingBufferHeight), y.clearColor(0, 0, 0, 0));
|
|
7120
7075
|
}
|
|
7121
7076
|
})();
|
|
7122
|
-
})), [2, { commonImageHash: at(
|
|
7077
|
+
})), [2, { commonImageHash: at(Yt(o, K.width, K.height).data.toString()).toString() }];
|
|
7123
7078
|
} catch {
|
|
7124
7079
|
return [2, { webgl: "unsupported" }];
|
|
7125
7080
|
}
|
|
@@ -7133,34 +7088,43 @@ var ie = function(o, e, t, n) {
|
|
|
7133
7088
|
return r * s;
|
|
7134
7089
|
};
|
|
7135
7090
|
J("math", (function() {
|
|
7136
|
-
return
|
|
7137
|
-
return
|
|
7091
|
+
return Z(void 0, void 0, void 0, (function() {
|
|
7092
|
+
return Y(this, (function(o) {
|
|
7138
7093
|
return [2, { acos: Math.acos(0.5), asin: ie(Math.asin, -1, 1, 97), atan: ie(Math.atan, -1, 1, 97), cos: ie(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: ie(Math.sin, -Math.PI, Math.PI, 97), sinh: ie(Math.sinh, -9 / 7, 7 / 9, 97), sqrt: Math.sqrt(2), tan: ie(Math.tan, 0, 2 * Math.PI, 97), tanh: ie(Math.tanh, -9 / 7, 7 / 9, 97) }];
|
|
7139
7094
|
}));
|
|
7140
7095
|
}));
|
|
7141
7096
|
}));
|
|
7142
|
-
|
|
7097
|
+
const xr = "query ( $Hash: String! ) { CipherHash ( Hash: $Hash ) { hash } }";
|
|
7098
|
+
function Ir(o) {
|
|
7099
|
+
const e = (o || "").match(/\b(query|mutation|subscription)\b/i), t = e ? e[1].toLowerCase() : "query", n = (o || "").indexOf("{"), s = n >= 0 ? o.slice(n + 1).match(/[A-Za-z_][A-Za-z0-9_]*/) : null;
|
|
7100
|
+
return { type: t, name: s ? s[0] : "" };
|
|
7101
|
+
}
|
|
7102
|
+
class Mr {
|
|
7143
7103
|
constructor({ serverUri: e, socket: t = null, encrypt: n = !1 }) {
|
|
7144
7104
|
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();
|
|
7145
7105
|
}
|
|
7146
7106
|
createUrqlClient({ serverUri: e, socket: t, encrypt: n }) {
|
|
7147
|
-
const s = [
|
|
7107
|
+
const s = [sn, rn];
|
|
7148
7108
|
if (t && t.socketUri) {
|
|
7149
|
-
const r =
|
|
7109
|
+
const r = ln({
|
|
7150
7110
|
url: t.socketUri,
|
|
7151
7111
|
connectionParams: () => ({
|
|
7152
7112
|
authToken: this.$__authToken
|
|
7153
7113
|
})
|
|
7154
7114
|
});
|
|
7155
|
-
s.push(
|
|
7115
|
+
s.push(on({
|
|
7156
7116
|
forwardSubscription: (i) => ({
|
|
7157
7117
|
subscribe: (a) => ({ unsubscribe: r.subscribe(i, a) })
|
|
7158
7118
|
})
|
|
7159
7119
|
}));
|
|
7160
7120
|
}
|
|
7161
|
-
return
|
|
7121
|
+
return an({
|
|
7162
7122
|
url: e,
|
|
7163
7123
|
exchanges: s,
|
|
7124
|
+
// PQ-transport Phase E: when encryption is on, route fetch through the CipherHash
|
|
7125
|
+
// wrapper (encrypt the request body to the validator's ML-KEM pubkey, decrypt the
|
|
7126
|
+
// response). Undefined → urql uses the global fetch (plaintext).
|
|
7127
|
+
...n ? { fetch: (r, i) => this.cipherFetch(r, i) } : {},
|
|
7164
7128
|
fetchOptions: () => ({
|
|
7165
7129
|
headers: {
|
|
7166
7130
|
"X-Auth-Token": this.$__authToken
|
|
@@ -7170,6 +7134,50 @@ class Tr {
|
|
|
7170
7134
|
})
|
|
7171
7135
|
});
|
|
7172
7136
|
}
|
|
7137
|
+
/**
|
|
7138
|
+
* Whether an outgoing GraphQL request body should be wrapped in CipherHash. Bypass (plaintext):
|
|
7139
|
+
* introspection `__schema`, `ContinuId`, the `AccessToken` mutation, and the U-isotope
|
|
7140
|
+
* `ProposeMolecule` (auth bootstrap — the key exchange itself can't be encrypted). Mirrors the
|
|
7141
|
+
* Kotlin/validator bypass set.
|
|
7142
|
+
*/
|
|
7143
|
+
shouldEncrypt(e) {
|
|
7144
|
+
let t;
|
|
7145
|
+
try {
|
|
7146
|
+
t = JSON.parse(e);
|
|
7147
|
+
} catch {
|
|
7148
|
+
return !1;
|
|
7149
|
+
}
|
|
7150
|
+
const { type: n, name: s } = Ir(t.query);
|
|
7151
|
+
return !(n === "query" && (s === "__schema" || s === "ContinuId") || n === "mutation" && s === "AccessToken" || n === "mutation" && s === "ProposeMolecule" && (t.variables && t.variables.molecule && t.variables.molecule.atoms && t.variables.molecule.atoms[0] && t.variables.molecule.atoms[0].isotope) === "U");
|
|
7152
|
+
}
|
|
7153
|
+
/**
|
|
7154
|
+
* Custom `fetch` that wraps a GraphQL request in the ML-KEM CipherHash envelope and decrypts the
|
|
7155
|
+
* response (PQ-transport Phase E). Operates on the raw POST body (mirrors Kotlin's
|
|
7156
|
+
* encryptBody/decryptBody). Reads the CURRENT client wallet + validator pubkey from auth.
|
|
7157
|
+
*/
|
|
7158
|
+
async cipherFetch(e, t) {
|
|
7159
|
+
const n = this.getWallet(), s = this.getPubKey();
|
|
7160
|
+
let r = !1, i = t;
|
|
7161
|
+
if (n && s && t && typeof t.body == "string" && this.shouldEncrypt(t.body)) {
|
|
7162
|
+
const d = await n.encryptStringML768(t.body, s);
|
|
7163
|
+
i = { ...t, body: JSON.stringify({ query: xr, variables: { Hash: d } }) }, r = !0;
|
|
7164
|
+
}
|
|
7165
|
+
const a = await fetch(e, i);
|
|
7166
|
+
if (!r)
|
|
7167
|
+
return a;
|
|
7168
|
+
const c = await a.text(), u = { status: a.status, statusText: a.statusText, headers: a.headers };
|
|
7169
|
+
let l;
|
|
7170
|
+
try {
|
|
7171
|
+
l = JSON.parse(c);
|
|
7172
|
+
} catch {
|
|
7173
|
+
return new Response(c, u);
|
|
7174
|
+
}
|
|
7175
|
+
const h = l && l.data && l.data.CipherHash && l.data.CipherHash.hash;
|
|
7176
|
+
if (typeof h != "string")
|
|
7177
|
+
return new Response(c, u);
|
|
7178
|
+
const p = await n.decryptMyMessageML768(JSON.parse(h));
|
|
7179
|
+
return new Response(p ?? c, u);
|
|
7180
|
+
}
|
|
7173
7181
|
setAuthData({ token: e, pubkey: t, wallet: n }) {
|
|
7174
7182
|
this.$__authToken = e, this.$__pubkey = t, this.$__wallet = n, this.$__client = this.createUrqlClient({
|
|
7175
7183
|
serverUri: this.serverUri,
|
|
@@ -7216,12 +7224,12 @@ class Tr {
|
|
|
7216
7224
|
return this.formatResponse(i);
|
|
7217
7225
|
}
|
|
7218
7226
|
subscribe(e, t) {
|
|
7219
|
-
const { query: n, variables: s, operationName: r } = e, i =
|
|
7227
|
+
const { query: n, variables: s, operationName: r } = e, i = cn(
|
|
7220
7228
|
this.$__client.subscription(n, s),
|
|
7221
|
-
|
|
7229
|
+
un((a) => {
|
|
7222
7230
|
t(this.formatResponse(a));
|
|
7223
7231
|
}),
|
|
7224
|
-
|
|
7232
|
+
hn(() => {
|
|
7225
7233
|
})
|
|
7226
7234
|
);
|
|
7227
7235
|
return this.$__subscriptionManager.set(r, i), {
|
|
@@ -7289,7 +7297,7 @@ class Tr {
|
|
|
7289
7297
|
});
|
|
7290
7298
|
}
|
|
7291
7299
|
}
|
|
7292
|
-
class
|
|
7300
|
+
class Ur {
|
|
7293
7301
|
/**
|
|
7294
7302
|
* Class constructor
|
|
7295
7303
|
*
|
|
@@ -7343,7 +7351,7 @@ class Wr {
|
|
|
7343
7351
|
const u = this.$__uris[c];
|
|
7344
7352
|
this.$__authTokenObjects[u] = null;
|
|
7345
7353
|
}
|
|
7346
|
-
this.log("info", `KnishIOClient::initialize() - Initializing new Knish.IO client session for SDK version ${r}...`), this.$__client = s || new
|
|
7354
|
+
this.log("info", `KnishIOClient::initialize() - Initializing new Knish.IO client session for SDK version ${r}...`), this.$__client = s || new Mr({
|
|
7347
7355
|
socket: {
|
|
7348
7356
|
socketUri: null,
|
|
7349
7357
|
appKey: "knishio",
|
|
@@ -7506,7 +7514,7 @@ class Wr {
|
|
|
7506
7514
|
* @returns {string}
|
|
7507
7515
|
*/
|
|
7508
7516
|
hashSecret(e, t = null) {
|
|
7509
|
-
return this.log("info", `KnishIOClient::hashSecret(${t ? `source: ${t}` : ""}) - Computing wallet bundle from secret...`),
|
|
7517
|
+
return this.log("info", `KnishIOClient::hashSecret(${t ? `source: ${t}` : ""}) - Computing wallet bundle from secret...`), pe(e);
|
|
7510
7518
|
}
|
|
7511
7519
|
/**
|
|
7512
7520
|
* Retrieves the stored secret for this session
|
|
@@ -7542,10 +7550,10 @@ class Wr {
|
|
|
7542
7550
|
* @returns {Promise<string>} A promise that resolves to the device fingerprint as a string.
|
|
7543
7551
|
*/
|
|
7544
7552
|
getFingerprint() {
|
|
7545
|
-
return
|
|
7553
|
+
return fr();
|
|
7546
7554
|
}
|
|
7547
7555
|
getFingerprintData() {
|
|
7548
|
-
return
|
|
7556
|
+
return Xt();
|
|
7549
7557
|
}
|
|
7550
7558
|
/**
|
|
7551
7559
|
* Retrieves this session's wallet used for signing the next Molecule
|
|
@@ -7707,7 +7715,7 @@ class Wr {
|
|
|
7707
7715
|
bundle: t = null,
|
|
7708
7716
|
type: n = "regular"
|
|
7709
7717
|
}) {
|
|
7710
|
-
const s = this.createQuery(
|
|
7718
|
+
const s = this.createQuery(gs);
|
|
7711
7719
|
return this.executeQuery(s, {
|
|
7712
7720
|
bundleHash: t || this.getBundle(),
|
|
7713
7721
|
token: e,
|
|
@@ -7730,10 +7738,10 @@ class Wr {
|
|
|
7730
7738
|
token: e,
|
|
7731
7739
|
type: n
|
|
7732
7740
|
})).payload();
|
|
7733
|
-
if (s === null ||
|
|
7734
|
-
throw new
|
|
7741
|
+
if (s === null || ce.cmp(s.balance, t) < 0)
|
|
7742
|
+
throw new G();
|
|
7735
7743
|
if (!s.position || !s.address)
|
|
7736
|
-
throw new
|
|
7744
|
+
throw new G("Source wallet can not be a shadow wallet.");
|
|
7737
7745
|
return s;
|
|
7738
7746
|
}
|
|
7739
7747
|
/**
|
|
@@ -7865,7 +7873,7 @@ class Wr {
|
|
|
7865
7873
|
}) {
|
|
7866
7874
|
this.log("info", `KnishIOClient::queryMeta() - Querying metaType: ${e}, metaId: ${t}...`);
|
|
7867
7875
|
let f, m;
|
|
7868
|
-
return p ? (f = this.createQuery(
|
|
7876
|
+
return p ? (f = this.createQuery(Ct), m = Ct.createVariables({
|
|
7869
7877
|
metaType: e,
|
|
7870
7878
|
metaId: t,
|
|
7871
7879
|
key: n,
|
|
@@ -7961,7 +7969,7 @@ class Wr {
|
|
|
7961
7969
|
}) {
|
|
7962
7970
|
if (this.log("info", `KnishIOClient::queryEmbeddingStatus() - Checking embedding status for metaType: ${e || "(bulk)"}...`), !await this.hasQueryField("embeddingStatus"))
|
|
7963
7971
|
return this.log("warn", "KnishIOClient::queryEmbeddingStatus() - Server does not support embeddingStatus query. Returning null."), null;
|
|
7964
|
-
const r = this.createQuery(
|
|
7972
|
+
const r = this.createQuery(Et), i = Et.createVariables({ metaType: e, metaId: t, instances: n });
|
|
7965
7973
|
return this.executeQuery(r, i);
|
|
7966
7974
|
}
|
|
7967
7975
|
/**
|
|
@@ -7989,7 +7997,7 @@ class Wr {
|
|
|
7989
7997
|
batchId: e
|
|
7990
7998
|
}) {
|
|
7991
7999
|
this.log("info", `KnishIOClient::queryBatchHistory() - Querying cascading meta instances for batchId: ${e}...`);
|
|
7992
|
-
const t = this.createQuery(
|
|
8000
|
+
const t = this.createQuery(ws);
|
|
7993
8001
|
return await this.executeQuery(t, {
|
|
7994
8002
|
batchId: e
|
|
7995
8003
|
});
|
|
@@ -8049,7 +8057,7 @@ class Wr {
|
|
|
8049
8057
|
values: f,
|
|
8050
8058
|
value: m,
|
|
8051
8059
|
metaTypes: w,
|
|
8052
|
-
metaType:
|
|
8060
|
+
metaType: T,
|
|
8053
8061
|
metaIds: k,
|
|
8054
8062
|
metaId: $,
|
|
8055
8063
|
indexes: v,
|
|
@@ -8062,8 +8070,8 @@ class Wr {
|
|
|
8062
8070
|
}
|
|
8063
8071
|
}) {
|
|
8064
8072
|
this.log("info", "KnishIOClient::queryAtom() - Querying atom instances");
|
|
8065
|
-
const
|
|
8066
|
-
return await this.executeQuery(
|
|
8073
|
+
const ue = this.createQuery(Mt);
|
|
8074
|
+
return await this.executeQuery(ue, Mt.createVariables({
|
|
8067
8075
|
molecularHashes: e,
|
|
8068
8076
|
molecularHash: t,
|
|
8069
8077
|
bundleHashes: n,
|
|
@@ -8083,7 +8091,7 @@ class Wr {
|
|
|
8083
8091
|
values: f,
|
|
8084
8092
|
value: m,
|
|
8085
8093
|
metaTypes: w,
|
|
8086
|
-
metaType:
|
|
8094
|
+
metaType: T,
|
|
8087
8095
|
metaIds: k,
|
|
8088
8096
|
metaId: $,
|
|
8089
8097
|
indexes: v,
|
|
@@ -8130,48 +8138,6 @@ class Wr {
|
|
|
8130
8138
|
metaId: n
|
|
8131
8139
|
});
|
|
8132
8140
|
}
|
|
8133
|
-
/**
|
|
8134
|
-
* Queries user activity based on the provided parameters.
|
|
8135
|
-
*
|
|
8136
|
-
* @param {string} bundleHash - The bundle hash.
|
|
8137
|
-
* @param {string} metaType - The meta type.
|
|
8138
|
-
* @param {string} metaId - The meta ID.
|
|
8139
|
-
* @param {string} ipAddress - The IP address.
|
|
8140
|
-
* @param {string} browser - The browser.
|
|
8141
|
-
* @param {string} osCpu - The operating system and CPU.
|
|
8142
|
-
* @param {string} resolution - The screen resolution.
|
|
8143
|
-
* @param {string} timeZone - The time zone.
|
|
8144
|
-
* @param {string} countBy - The count by parameter.
|
|
8145
|
-
* @param {string} interval - The interval parameter.
|
|
8146
|
-
*
|
|
8147
|
-
* @returns {Promise<ResponseQueryUserActivity>} The result of the query.
|
|
8148
|
-
*/
|
|
8149
|
-
async queryUserActivity({
|
|
8150
|
-
bundleHash: e,
|
|
8151
|
-
metaType: t,
|
|
8152
|
-
metaId: n,
|
|
8153
|
-
ipAddress: s,
|
|
8154
|
-
browser: r,
|
|
8155
|
-
osCpu: i,
|
|
8156
|
-
resolution: a,
|
|
8157
|
-
timeZone: c,
|
|
8158
|
-
countBy: u,
|
|
8159
|
-
interval: l
|
|
8160
|
-
}) {
|
|
8161
|
-
const h = this.createQuery(Ys);
|
|
8162
|
-
return await this.executeQuery(h, {
|
|
8163
|
-
bundleHash: e,
|
|
8164
|
-
metaType: t,
|
|
8165
|
-
metaId: n,
|
|
8166
|
-
ipAddress: s,
|
|
8167
|
-
browser: r,
|
|
8168
|
-
osCpu: i,
|
|
8169
|
-
resolution: a,
|
|
8170
|
-
timeZone: c,
|
|
8171
|
-
countBy: u,
|
|
8172
|
-
interval: l
|
|
8173
|
-
});
|
|
8174
|
-
}
|
|
8175
8141
|
/**
|
|
8176
8142
|
* Builds and executes a molecule to declare an active session for the given MetaType
|
|
8177
8143
|
*
|
|
@@ -8233,12 +8199,12 @@ class Wr {
|
|
|
8233
8199
|
batchId: s = null,
|
|
8234
8200
|
units: r = []
|
|
8235
8201
|
}) {
|
|
8236
|
-
const i =
|
|
8237
|
-
if (i === "stackable" && (n.batchId = s ||
|
|
8238
|
-
if (
|
|
8202
|
+
const i = M.get(n || {}, "fungibility");
|
|
8203
|
+
if (i === "stackable" && (n.batchId = s || He({})), ["nonfungible", "stackable"].includes(i) && r.length > 0) {
|
|
8204
|
+
if (M.get(n || {}, "decimals") > 0)
|
|
8239
8205
|
throw new Ls();
|
|
8240
8206
|
if (t > 0)
|
|
8241
|
-
throw new
|
|
8207
|
+
throw new _e();
|
|
8242
8208
|
t = r.length, n.splittable = 1, n.decimals = 0, n.tokenUnits = JSON.stringify(r);
|
|
8243
8209
|
}
|
|
8244
8210
|
const a = new S({
|
|
@@ -8247,7 +8213,7 @@ class Wr {
|
|
|
8247
8213
|
token: e,
|
|
8248
8214
|
batchId: s
|
|
8249
8215
|
}), c = await this.createMoleculeMutation({
|
|
8250
|
-
mutationClass:
|
|
8216
|
+
mutationClass: $s
|
|
8251
8217
|
});
|
|
8252
8218
|
return c.fillMolecule({
|
|
8253
8219
|
recipientWallet: a,
|
|
@@ -8272,7 +8238,7 @@ class Wr {
|
|
|
8272
8238
|
}) {
|
|
8273
8239
|
const r = await this.createMoleculeMutation(
|
|
8274
8240
|
{
|
|
8275
|
-
mutationClass:
|
|
8241
|
+
mutationClass: ir,
|
|
8276
8242
|
molecule: await this.createMolecule({
|
|
8277
8243
|
secret: this.getSecret()
|
|
8278
8244
|
})
|
|
@@ -8376,7 +8342,7 @@ class Wr {
|
|
|
8376
8342
|
code: n
|
|
8377
8343
|
}) {
|
|
8378
8344
|
const s = await this.createMoleculeMutation({
|
|
8379
|
-
mutationClass:
|
|
8345
|
+
mutationClass: Ms
|
|
8380
8346
|
});
|
|
8381
8347
|
return s.fillMolecule({
|
|
8382
8348
|
type: e,
|
|
@@ -8442,7 +8408,7 @@ class Wr {
|
|
|
8442
8408
|
metaType: e,
|
|
8443
8409
|
metaId: t
|
|
8444
8410
|
}) {
|
|
8445
|
-
const n = this.createQuery(
|
|
8411
|
+
const n = this.createQuery(tr);
|
|
8446
8412
|
return await this.executeQuery(n, {
|
|
8447
8413
|
metaType: e,
|
|
8448
8414
|
metaId: t
|
|
@@ -8464,7 +8430,7 @@ class Wr {
|
|
|
8464
8430
|
unspent: n = !0
|
|
8465
8431
|
}) {
|
|
8466
8432
|
this.log("info", `KnishIOClient::queryWallets() - Querying wallets${e ? ` for ${e}` : ""}...`);
|
|
8467
|
-
const s = this.createQuery(
|
|
8433
|
+
const s = this.createQuery(ms);
|
|
8468
8434
|
return this.executeQuery(s, {
|
|
8469
8435
|
bundleHash: e || this.getBundle(),
|
|
8470
8436
|
token: t,
|
|
@@ -8486,7 +8452,7 @@ class Wr {
|
|
|
8486
8452
|
raw: n = !1
|
|
8487
8453
|
}) {
|
|
8488
8454
|
this.log("info", `KnishIOClient::queryBundle() - Querying wallet bundle metadata${e ? ` for ${e}` : ""}...`), e || (e = this.getBundle()), typeof e == "string" && (e = [e]);
|
|
8489
|
-
const s = this.createQuery(
|
|
8455
|
+
const s = this.createQuery(fs);
|
|
8490
8456
|
return this.executeQuery(s, { bundleHashes: e }).then((r) => n ? r : r.payload());
|
|
8491
8457
|
}
|
|
8492
8458
|
/**
|
|
@@ -8498,7 +8464,7 @@ class Wr {
|
|
|
8498
8464
|
async queryContinuId({
|
|
8499
8465
|
bundle: e
|
|
8500
8466
|
}) {
|
|
8501
|
-
const t = this.createQuery(
|
|
8467
|
+
const t = this.createQuery(ds);
|
|
8502
8468
|
return this.executeQuery(t, {
|
|
8503
8469
|
bundle: e
|
|
8504
8470
|
});
|
|
@@ -8530,14 +8496,14 @@ class Wr {
|
|
|
8530
8496
|
}) {
|
|
8531
8497
|
let a, c;
|
|
8532
8498
|
r = r || {};
|
|
8533
|
-
const u = this.createQuery(
|
|
8499
|
+
const u = this.createQuery(Zs), l = await this.executeQuery(u, {
|
|
8534
8500
|
slug: e
|
|
8535
|
-
}), h =
|
|
8501
|
+
}), h = M.get(l.data(), "0.fungibility") === "stackable";
|
|
8536
8502
|
if (!h && i !== null)
|
|
8537
|
-
throw new
|
|
8538
|
-
if (h && i === null && (i =
|
|
8503
|
+
throw new Ue("Expected Batch ID = null for non-stackable tokens.");
|
|
8504
|
+
if (h && i === null && (i = He({})), s.length > 0) {
|
|
8539
8505
|
if (n > 0)
|
|
8540
|
-
throw new
|
|
8506
|
+
throw new _e();
|
|
8541
8507
|
n = s.length, r.tokenUnits = JSON.stringify(s);
|
|
8542
8508
|
}
|
|
8543
8509
|
t ? (Object.prototype.toString.call(t) === "[object String]" && (S.isBundleHash(t) ? (a = "walletBundle", c = t) : t = S.create({
|
|
@@ -8545,7 +8511,7 @@ class Wr {
|
|
|
8545
8511
|
token: e
|
|
8546
8512
|
})), t instanceof S && (a = "wallet", r.position = t.position, r.bundle = t.bundle, c = t.address)) : (a = "walletBundle", c = this.getBundle());
|
|
8547
8513
|
const p = await this.createMoleculeMutation({
|
|
8548
|
-
mutationClass:
|
|
8514
|
+
mutationClass: vs
|
|
8549
8515
|
});
|
|
8550
8516
|
return p.fillMolecule({
|
|
8551
8517
|
token: e,
|
|
@@ -8592,10 +8558,10 @@ class Wr {
|
|
|
8592
8558
|
}) {
|
|
8593
8559
|
const t = await this.queryWallets({ token: e });
|
|
8594
8560
|
if (!t || !Array.isArray(t))
|
|
8595
|
-
throw new
|
|
8561
|
+
throw new xt();
|
|
8596
8562
|
t.forEach((s) => {
|
|
8597
8563
|
if (!s.isShadow())
|
|
8598
|
-
throw new
|
|
8564
|
+
throw new xt();
|
|
8599
8565
|
});
|
|
8600
8566
|
const n = [];
|
|
8601
8567
|
for (const s of t)
|
|
@@ -8631,14 +8597,14 @@ class Wr {
|
|
|
8631
8597
|
}) {
|
|
8632
8598
|
if (s.length > 0) {
|
|
8633
8599
|
if (n > 0)
|
|
8634
|
-
throw new
|
|
8600
|
+
throw new _e();
|
|
8635
8601
|
n = s.length;
|
|
8636
8602
|
}
|
|
8637
8603
|
if (i === null && (i = await this.querySourceWallet({
|
|
8638
8604
|
token: t,
|
|
8639
8605
|
amount: n
|
|
8640
|
-
})), i === null ||
|
|
8641
|
-
throw new
|
|
8606
|
+
})), i === null || ce.cmp(i.balance, n) < 0)
|
|
8607
|
+
throw new G();
|
|
8642
8608
|
const a = S.create({
|
|
8643
8609
|
bundle: e,
|
|
8644
8610
|
token: t
|
|
@@ -8656,7 +8622,7 @@ class Wr {
|
|
|
8656
8622
|
sourceWallet: i,
|
|
8657
8623
|
remainderWallet: c
|
|
8658
8624
|
}), l = await this.createMoleculeMutation({
|
|
8659
|
-
mutationClass:
|
|
8625
|
+
mutationClass: vt,
|
|
8660
8626
|
molecule: u
|
|
8661
8627
|
});
|
|
8662
8628
|
return l.fillMolecule({
|
|
@@ -8664,6 +8630,70 @@ class Wr {
|
|
|
8664
8630
|
amount: n
|
|
8665
8631
|
}), await this.executeQuery(l);
|
|
8666
8632
|
}
|
|
8633
|
+
/**
|
|
8634
|
+
* Transfers tokens from one source wallet to MULTIPLE recipients in a single molecule.
|
|
8635
|
+
*
|
|
8636
|
+
* One molecule funds N recipients (WP line 544: "utilizing the sender's Wallet to fund multiple
|
|
8637
|
+
* recipients with one transaction"). Each recipient receives its own amount and, for stackable
|
|
8638
|
+
* tokens, its own subset of token units. The source is fully drained and the unsent change
|
|
8639
|
+
* returns via the remainder atom (UTXO), so the V-atoms conserve. Single-recipient transfers
|
|
8640
|
+
* should keep using transferToken(); this is its N-recipient generalization.
|
|
8641
|
+
*
|
|
8642
|
+
* @param {Object} options - The transfer options.
|
|
8643
|
+
* @param {string} options.token - The token to transfer.
|
|
8644
|
+
* @param {Array} options.recipients - [{ bundleHash, amount?, units?, batchId? }] per recipient.
|
|
8645
|
+
* @param {Object} [options.sourceWallet=null] - The source wallet; queried if not provided.
|
|
8646
|
+
*
|
|
8647
|
+
* @returns {Promise} - A Promise that resolves to the transaction result.
|
|
8648
|
+
*
|
|
8649
|
+
* @throws {StackableUnitAmountException} - If a recipient provides both amount and units.
|
|
8650
|
+
* @throws {TransferBalanceException} - If the source wallet does not have enough balance.
|
|
8651
|
+
*/
|
|
8652
|
+
async transferTokens({
|
|
8653
|
+
token: e,
|
|
8654
|
+
recipients: t,
|
|
8655
|
+
sourceWallet: n = null
|
|
8656
|
+
}) {
|
|
8657
|
+
const s = t.map((l) => {
|
|
8658
|
+
const h = l.units || [];
|
|
8659
|
+
if (h.length > 0) {
|
|
8660
|
+
if (l.amount > 0)
|
|
8661
|
+
throw new _e();
|
|
8662
|
+
return h.length;
|
|
8663
|
+
}
|
|
8664
|
+
return l.amount || 0;
|
|
8665
|
+
}), r = s.reduce((l, h) => l + h, 0);
|
|
8666
|
+
if (n === null && (n = await this.querySourceWallet({
|
|
8667
|
+
token: e,
|
|
8668
|
+
amount: r
|
|
8669
|
+
})), n === null || ce.cmp(n.balance, r) < 0)
|
|
8670
|
+
throw new G();
|
|
8671
|
+
const i = t.map((l) => {
|
|
8672
|
+
const h = S.create({
|
|
8673
|
+
bundle: l.bundleHash,
|
|
8674
|
+
token: e
|
|
8675
|
+
});
|
|
8676
|
+
return l.batchId !== void 0 && l.batchId !== null ? h.batchId = l.batchId : h.initBatchId({
|
|
8677
|
+
sourceWallet: n
|
|
8678
|
+
}), h;
|
|
8679
|
+
}), a = n.createRemainder(this.getSecret());
|
|
8680
|
+
n.splitUnitsMulti(
|
|
8681
|
+
t.map((l) => l.units || []),
|
|
8682
|
+
i,
|
|
8683
|
+
a
|
|
8684
|
+
);
|
|
8685
|
+
const c = await this.createMolecule({
|
|
8686
|
+
sourceWallet: n,
|
|
8687
|
+
remainderWallet: a
|
|
8688
|
+
}), u = await this.createMoleculeMutation({
|
|
8689
|
+
mutationClass: vt,
|
|
8690
|
+
molecule: c
|
|
8691
|
+
});
|
|
8692
|
+
return u.fillMoleculeMulti({
|
|
8693
|
+
recipientWallets: i,
|
|
8694
|
+
amounts: s
|
|
8695
|
+
}), await this.executeQuery(u);
|
|
8696
|
+
}
|
|
8667
8697
|
/**
|
|
8668
8698
|
* Deposits buffer token into the source wallet.
|
|
8669
8699
|
*
|
|
@@ -8689,7 +8719,7 @@ class Wr {
|
|
|
8689
8719
|
sourceWallet: s,
|
|
8690
8720
|
remainderWallet: r
|
|
8691
8721
|
}), a = await this.createMoleculeMutation({
|
|
8692
|
-
mutationClass:
|
|
8722
|
+
mutationClass: or,
|
|
8693
8723
|
molecule: i
|
|
8694
8724
|
});
|
|
8695
8725
|
return a.fillMolecule({
|
|
@@ -8722,7 +8752,7 @@ class Wr {
|
|
|
8722
8752
|
sourceWallet: n,
|
|
8723
8753
|
remainderWallet: r
|
|
8724
8754
|
}), a = await this.createMoleculeMutation({
|
|
8725
|
-
mutationClass:
|
|
8755
|
+
mutationClass: ar,
|
|
8726
8756
|
molecule: i
|
|
8727
8757
|
}), c = {};
|
|
8728
8758
|
return c[this.getBundle()] = t, a.fillMolecule({
|
|
@@ -8752,7 +8782,7 @@ class Wr {
|
|
|
8752
8782
|
const r = s.createRemainder(this.getSecret());
|
|
8753
8783
|
if (n.length > 0) {
|
|
8754
8784
|
if (t > 0)
|
|
8755
|
-
throw new
|
|
8785
|
+
throw new _e();
|
|
8756
8786
|
t = n.length, s.splitUnits(
|
|
8757
8787
|
n,
|
|
8758
8788
|
r
|
|
@@ -8787,7 +8817,7 @@ class Wr {
|
|
|
8787
8817
|
sourceWallet: s = null
|
|
8788
8818
|
}) {
|
|
8789
8819
|
if (s === null && (s = (await this.queryBalance({ token: e })).payload()), !s)
|
|
8790
|
-
throw new
|
|
8820
|
+
throw new G("Source wallet is missing or invalid.");
|
|
8791
8821
|
const r = s.createRemainder(this.getSecret()), i = await this.createMolecule({
|
|
8792
8822
|
sourceWallet: s,
|
|
8793
8823
|
remainderWallet: r
|
|
@@ -8821,17 +8851,17 @@ class Wr {
|
|
|
8821
8851
|
sourceWallet: r = null
|
|
8822
8852
|
}) {
|
|
8823
8853
|
if (r === null && (r = (await this.queryBalance({ token: t })).payload()), r === null)
|
|
8824
|
-
throw new
|
|
8854
|
+
throw new G("Source wallet is missing or invalid.");
|
|
8825
8855
|
if (!r.tokenUnits || !r.tokenUnits.length)
|
|
8826
|
-
throw new
|
|
8856
|
+
throw new G("Source wallet does not have token units.");
|
|
8827
8857
|
if (!s.length)
|
|
8828
|
-
throw new
|
|
8858
|
+
throw new G("Fused token unit list is empty.");
|
|
8829
8859
|
const i = [];
|
|
8830
8860
|
r.tokenUnits.forEach((h) => {
|
|
8831
8861
|
i.push(h.id);
|
|
8832
8862
|
}), s.forEach((h) => {
|
|
8833
8863
|
if (!i.includes(h))
|
|
8834
|
-
throw new
|
|
8864
|
+
throw new G(`Fused token unit ID = ${h} does not found in the source wallet.`);
|
|
8835
8865
|
});
|
|
8836
8866
|
const a = S.create({
|
|
8837
8867
|
bundle: e,
|
|
@@ -8839,7 +8869,7 @@ class Wr {
|
|
|
8839
8869
|
});
|
|
8840
8870
|
a.initBatchId({ sourceWallet: r });
|
|
8841
8871
|
const c = r.createRemainder(this.getSecret());
|
|
8842
|
-
r.splitUnits(s, c), typeof n == "string" && (n = new
|
|
8872
|
+
r.splitUnits(s, c), typeof n == "string" && (n = new fe(n, n, {})), n.metas.fusedTokenUnits = r.getTokenUnitsData(), a.tokenUnits = [n];
|
|
8843
8873
|
const u = await this.createMolecule({
|
|
8844
8874
|
sourceWallet: r,
|
|
8845
8875
|
remainderWallet: c
|
|
@@ -8882,7 +8912,7 @@ class Wr {
|
|
|
8882
8912
|
}, n);
|
|
8883
8913
|
this.setAuthToken(a);
|
|
8884
8914
|
} else
|
|
8885
|
-
throw new
|
|
8915
|
+
throw new It(`KnishIOClient::requestGuestAuthToken() - Authorization attempt rejected by ledger. Reason: ${i.reason()}`);
|
|
8886
8916
|
return i;
|
|
8887
8917
|
}
|
|
8888
8918
|
/**
|
|
@@ -8904,22 +8934,22 @@ class Wr {
|
|
|
8904
8934
|
secret: e,
|
|
8905
8935
|
sourceWallet: n
|
|
8906
8936
|
}), r = await this.createMoleculeMutation({
|
|
8907
|
-
mutationClass:
|
|
8937
|
+
mutationClass: _s,
|
|
8908
8938
|
molecule: s
|
|
8909
|
-
});
|
|
8910
|
-
r.fillMolecule({ meta:
|
|
8911
|
-
const
|
|
8912
|
-
if (
|
|
8913
|
-
const
|
|
8914
|
-
token:
|
|
8915
|
-
expiresAt:
|
|
8916
|
-
pubkey:
|
|
8917
|
-
encrypt:
|
|
8939
|
+
}), i = { encrypt: t ? "true" : "false" };
|
|
8940
|
+
n.pubkey && (i.walletPubkey = n.pubkey), r.fillMolecule({ meta: i });
|
|
8941
|
+
const a = await r.execute({});
|
|
8942
|
+
if (a.success()) {
|
|
8943
|
+
const c = xe.create({
|
|
8944
|
+
token: a.token(),
|
|
8945
|
+
expiresAt: a.expiresAt(),
|
|
8946
|
+
pubkey: a.pubKey(),
|
|
8947
|
+
encrypt: a.encrypt()
|
|
8918
8948
|
}, n);
|
|
8919
|
-
this.setAuthToken(
|
|
8949
|
+
this.setAuthToken(c);
|
|
8920
8950
|
} else
|
|
8921
|
-
throw new
|
|
8922
|
-
return
|
|
8951
|
+
throw new It(`KnishIOClient::requestProfileAuthToken() - Authorization attempt rejected by ledger. Reason: ${a.reason()}`);
|
|
8952
|
+
return a;
|
|
8923
8953
|
}
|
|
8924
8954
|
/**
|
|
8925
8955
|
* Request an auth token (guest or profile)
|
|
@@ -8990,7 +9020,7 @@ class Wr {
|
|
|
8990
9020
|
}
|
|
8991
9021
|
}
|
|
8992
9022
|
}
|
|
8993
|
-
class
|
|
9023
|
+
class Br extends C {
|
|
8994
9024
|
/**
|
|
8995
9025
|
* Class constructor
|
|
8996
9026
|
*
|
|
@@ -9038,9 +9068,9 @@ class Ur extends C {
|
|
|
9038
9068
|
* @return {*}
|
|
9039
9069
|
*/
|
|
9040
9070
|
payloadKey(e) {
|
|
9041
|
-
if (!
|
|
9071
|
+
if (!M.has(this.payload(), e))
|
|
9042
9072
|
throw new te(`ResponseAuthorizationGuest::payloadKey() - '${e}' key is not found in the payload!`);
|
|
9043
|
-
return
|
|
9073
|
+
return M.get(this.payload(), e);
|
|
9044
9074
|
}
|
|
9045
9075
|
/**
|
|
9046
9076
|
* Returns the auth token
|
|
@@ -9061,121 +9091,119 @@ class Ur extends C {
|
|
|
9061
9091
|
}
|
|
9062
9092
|
export {
|
|
9063
9093
|
g as Atom,
|
|
9064
|
-
|
|
9094
|
+
we as AtomIndexException,
|
|
9065
9095
|
P as AtomMeta,
|
|
9066
9096
|
ae as AtomsMissingException,
|
|
9067
9097
|
xe as AuthToken,
|
|
9068
|
-
|
|
9069
|
-
|
|
9070
|
-
|
|
9098
|
+
It as AuthorizationRejectedException,
|
|
9099
|
+
he as BalanceInsufficientException,
|
|
9100
|
+
Ue as BatchIdException,
|
|
9071
9101
|
ve as CheckMolecule,
|
|
9072
9102
|
ee as CodeException,
|
|
9073
|
-
|
|
9074
|
-
|
|
9103
|
+
ce as Decimal,
|
|
9104
|
+
M as Dot,
|
|
9075
9105
|
te as InvalidResponseException,
|
|
9076
|
-
|
|
9077
|
-
|
|
9106
|
+
Ur as KnishIOClient,
|
|
9107
|
+
de as Meta,
|
|
9078
9108
|
H as MetaMissingException,
|
|
9079
|
-
|
|
9080
|
-
|
|
9109
|
+
as as MolecularHashMismatchException,
|
|
9110
|
+
ls as MolecularHashMissingException,
|
|
9081
9111
|
z as Molecule,
|
|
9082
9112
|
Qe as Mutation,
|
|
9083
9113
|
Js as MutationActiveSession,
|
|
9084
9114
|
Us as MutationAppendRequest,
|
|
9085
9115
|
Cs as MutationClaimShadowWallet,
|
|
9086
|
-
|
|
9116
|
+
Ms as MutationCreateIdentifier,
|
|
9087
9117
|
Os as MutationCreateMeta,
|
|
9088
|
-
|
|
9089
|
-
|
|
9118
|
+
ir as MutationCreateRule,
|
|
9119
|
+
$s as MutationCreateToken,
|
|
9090
9120
|
Ks as MutationCreateWallet,
|
|
9091
|
-
|
|
9121
|
+
or as MutationDepositBufferToken,
|
|
9092
9122
|
Hs as MutationLinkIdentifier,
|
|
9093
9123
|
qs as MutationPeering,
|
|
9094
9124
|
W as MutationProposeMolecule,
|
|
9095
|
-
|
|
9125
|
+
_s as MutationRequestAuthorization,
|
|
9096
9126
|
Fs as MutationRequestAuthorizationGuest,
|
|
9097
|
-
|
|
9098
|
-
|
|
9099
|
-
|
|
9100
|
-
|
|
9101
|
-
|
|
9127
|
+
vs as MutationRequestTokens,
|
|
9128
|
+
vt as MutationTransferTokens,
|
|
9129
|
+
ar as MutationWithdrawBufferToken,
|
|
9130
|
+
$t as NegativeAmountException,
|
|
9131
|
+
wt as PolicyInvalidException,
|
|
9102
9132
|
rt as PolicyMeta,
|
|
9103
|
-
|
|
9133
|
+
N as Query,
|
|
9104
9134
|
Xs as QueryActiveSession,
|
|
9105
|
-
|
|
9106
|
-
|
|
9135
|
+
Mt as QueryAtom,
|
|
9136
|
+
gs as QueryBalance,
|
|
9107
9137
|
Ie as QueryBatch,
|
|
9108
|
-
|
|
9109
|
-
|
|
9110
|
-
|
|
9138
|
+
ws as QueryBatchHistory,
|
|
9139
|
+
ds as QueryContinuId,
|
|
9140
|
+
Et as QueryEmbeddingStatus,
|
|
9111
9141
|
At as QueryMetaType,
|
|
9112
9142
|
Tt as QueryMetaTypeViaAtom,
|
|
9113
|
-
|
|
9114
|
-
|
|
9115
|
-
|
|
9116
|
-
|
|
9117
|
-
|
|
9118
|
-
fs as QueryWalletList,
|
|
9143
|
+
Ct as QueryMetaTypeViaMolecule,
|
|
9144
|
+
tr as QueryPolicy,
|
|
9145
|
+
Zs as QueryToken,
|
|
9146
|
+
fs as QueryWalletBundle,
|
|
9147
|
+
ms as QueryWalletList,
|
|
9119
9148
|
C as Response,
|
|
9120
9149
|
zs as ResponseActiveSession,
|
|
9121
9150
|
Ws as ResponseAppendRequest,
|
|
9122
|
-
|
|
9123
|
-
|
|
9124
|
-
|
|
9125
|
-
|
|
9126
|
-
|
|
9151
|
+
Ys as ResponseAtom,
|
|
9152
|
+
Br as ResponseAuthorizationGuest,
|
|
9153
|
+
ys as ResponseBalance,
|
|
9154
|
+
Ts as ResponseClaimShadowWallet,
|
|
9155
|
+
hs as ResponseContinuId,
|
|
9127
9156
|
Is as ResponseCreateIdentifier,
|
|
9128
9157
|
Es as ResponseCreateMeta,
|
|
9129
|
-
|
|
9130
|
-
|
|
9158
|
+
rr as ResponseCreateRule,
|
|
9159
|
+
Ss as ResponseCreateToken,
|
|
9131
9160
|
Ps as ResponseCreateWallet,
|
|
9132
|
-
|
|
9161
|
+
sr as ResponseEmbeddingStatus,
|
|
9133
9162
|
Bs as ResponseLinkIdentifier,
|
|
9134
|
-
|
|
9135
|
-
|
|
9163
|
+
bs as ResponseMetaType,
|
|
9164
|
+
nr as ResponseMetaTypeViaAtom,
|
|
9136
9165
|
ot as ResponseMetaTypeViaMolecule,
|
|
9137
9166
|
Rs as ResponsePeering,
|
|
9138
|
-
|
|
9167
|
+
er as ResponsePolicy,
|
|
9139
9168
|
V as ResponseProposeMolecule,
|
|
9140
9169
|
Gs as ResponseQueryActiveSession,
|
|
9141
|
-
|
|
9142
|
-
ws as ResponseRequestAuthorization,
|
|
9170
|
+
ks as ResponseRequestAuthorization,
|
|
9143
9171
|
Ns as ResponseRequestAuthorizationGuest,
|
|
9144
|
-
|
|
9145
|
-
|
|
9146
|
-
|
|
9172
|
+
As as ResponseRequestTokens,
|
|
9173
|
+
xs as ResponseTransferTokens,
|
|
9174
|
+
ps as ResponseWalletBundle,
|
|
9147
9175
|
Le as ResponseWalletList,
|
|
9148
|
-
|
|
9149
|
-
|
|
9150
|
-
|
|
9176
|
+
Jt as SignatureMalformedException,
|
|
9177
|
+
cs as SignatureMismatchException,
|
|
9178
|
+
_e as StackableUnitAmountException,
|
|
9151
9179
|
Ls as StackableUnitDecimalsException,
|
|
9152
|
-
|
|
9153
|
-
|
|
9154
|
-
|
|
9155
|
-
|
|
9156
|
-
|
|
9157
|
-
|
|
9180
|
+
fe as TokenUnit,
|
|
9181
|
+
G as TransferBalanceException,
|
|
9182
|
+
ke as TransferMalformedException,
|
|
9183
|
+
kt as TransferMismatchedException,
|
|
9184
|
+
_t as TransferRemainderException,
|
|
9185
|
+
us as TransferToSelfException,
|
|
9158
9186
|
Oe as TransferUnbalancedException,
|
|
9159
9187
|
Ke as UnauthenticatedException,
|
|
9160
9188
|
S as Wallet,
|
|
9161
|
-
|
|
9189
|
+
xt as WalletShadowException,
|
|
9162
9190
|
re as WrongTokenTypeException,
|
|
9163
|
-
|
|
9164
|
-
|
|
9165
|
-
|
|
9166
|
-
|
|
9167
|
-
|
|
9168
|
-
|
|
9169
|
-
|
|
9170
|
-
|
|
9171
|
-
|
|
9191
|
+
yn as base64ToHex,
|
|
9192
|
+
pn as bufferToHexString,
|
|
9193
|
+
dn as charsetBaseConvert,
|
|
9194
|
+
bn as chunkArray,
|
|
9195
|
+
Be as chunkSubstr,
|
|
9196
|
+
wn as deepCloning,
|
|
9197
|
+
kn as diff,
|
|
9198
|
+
He as generateBatchId,
|
|
9199
|
+
pe as generateBundleHash,
|
|
9172
9200
|
nt as generateSecret,
|
|
9173
|
-
|
|
9174
|
-
|
|
9175
|
-
|
|
9201
|
+
fn as hexStringToBuffer,
|
|
9202
|
+
mn as hexToBase64,
|
|
9203
|
+
me as intersect,
|
|
9176
9204
|
Ve as isHex,
|
|
9177
|
-
|
|
9205
|
+
gn as isNumeric,
|
|
9178
9206
|
st as randomString,
|
|
9179
|
-
|
|
9207
|
+
ze as shake256
|
|
9180
9208
|
};
|
|
9181
9209
|
//# sourceMappingURL=client.es.mjs.map
|