@gurge/sdk 0.3.27 → 0.3.29
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/common/src/crypto/BabyJubRN.cjs +1 -0
- package/common/src/crypto/BabyJubRN.d.ts +2 -0
- package/common/src/crypto/BabyJubRN.mjs +66 -0
- package/common/src/crypto/EddsaRN.cjs +1 -0
- package/common/src/crypto/EddsaRN.mjs +41 -0
- package/common/src/crypto/babyJub.cjs +1 -1
- package/common/src/crypto/babyJub.mjs +6 -12
- package/common/src/crypto/eddsa.cjs +1 -1
- package/common/src/crypto/eddsa.mjs +6 -12
- package/common/src/crypto/poseidon.cjs +1 -1
- package/common/src/crypto/poseidon.mjs +6 -12
- package/common/src/crypto/preProcessing.cjs +1 -1
- package/common/src/crypto/preProcessing.mjs +13 -23
- package/common/src/data-structures/Hinkal/handleAutoDepositBack.cjs +1 -1
- package/common/src/data-structures/Hinkal/handleAutoDepositBack.mjs +9 -9
- package/common/src/data-structures/Hinkal/hinkalClaimUtxo.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalClaimUtxo.mjs +6 -6
- package/common/src/data-structures/Hinkal/hinkalDeposit.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalDeposit.mjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalDepositAndBridge.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalDepositAndBridge.mjs +18 -18
- package/common/src/data-structures/Hinkal/hinkalDepositAndWithdraw.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalDepositAndWithdraw.mjs +17 -17
- package/common/src/data-structures/Hinkal/hinkalPrivateWallet.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalPrivateWallet.mjs +13 -13
- package/common/src/data-structures/Hinkal/hinkalSolanaClaimUtxo.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaClaimUtxo.mjs +11 -11
- package/common/src/data-structures/Hinkal/hinkalSolanaDeposit.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaDeposit.mjs +14 -14
- package/common/src/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.mjs +51 -51
- package/common/src/data-structures/Hinkal/hinkalSolanaSwap.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaSwap.mjs +51 -51
- package/common/src/data-structures/Hinkal/hinkalSolanaTransfer.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaTransfer.mjs +20 -20
- package/common/src/data-structures/Hinkal/hinkalSolanaWithdraw.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaWithdraw.mjs +19 -19
- package/common/src/data-structures/Hinkal/hinkalSwap.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSwap.mjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalTransfer.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalTransfer.mjs +9 -9
- package/common/src/data-structures/Hinkal/hinkalWithdraw.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalWithdraw.d.ts +3 -1
- package/common/src/data-structures/Hinkal/hinkalWithdraw.mjs +29 -34
- package/common/src/data-structures/Hinkal/hinkalWithdrawStuckUtxos.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalWithdrawStuckUtxos.mjs +33 -33
- package/common/src/data-structures/Hinkal/prepareDepositOnChainUtxosZkProof.cjs +1 -1
- package/common/src/data-structures/Hinkal/prepareDepositOnChainUtxosZkProof.mjs +1 -1
- package/common/src/data-structures/MultiThreadedUtxoUtils/MultiThreadedUtxoUtils.cjs +1 -1
- package/common/src/data-structures/MultiThreadedUtxoUtils/MultiThreadedUtxoUtils.mjs +26 -42
- package/common/src/data-structures/crypto-keys/decodeUTXO.cjs +1 -1
- package/common/src/data-structures/crypto-keys/decodeUTXO.mjs +7 -7
- package/common/src/data-structures/crypto-keys/encryptDecryptUtxo.cjs +1 -1
- package/common/src/data-structures/crypto-keys/encryptDecryptUtxo.mjs +1 -1
- package/common/src/data-structures/utxo/Utxo.cjs +1 -1
- package/common/src/data-structures/utxo/Utxo.d.ts +0 -1
- package/common/src/data-structures/utxo/Utxo.mjs +6 -19
- package/common/src/functions/index.cjs +1 -1
- package/common/src/functions/index.mjs +4 -3
- package/common/src/functions/pre-transaction/buildCommitmentValidationData.cjs +1 -1
- package/common/src/functions/pre-transaction/buildCommitmentValidationData.mjs +46 -87
- package/common/src/functions/pre-transaction/outputUtxoProcessing.cjs +1 -1
- package/common/src/functions/pre-transaction/outputUtxoProcessing.d.ts +2 -2
- package/common/src/functions/pre-transaction/outputUtxoProcessing.mjs +23 -28
- package/common/src/functions/private-wallet/emporium.swap.helpers.cjs +1 -1
- package/common/src/functions/private-wallet/emporium.swap.helpers.mjs +14 -14
- package/common/src/functions/snarkjs/common.snarkjs.cjs +1 -1
- package/common/src/functions/snarkjs/common.snarkjs.mjs +7 -7
- package/common/src/functions/snarkjs/constructGeneralZkProof.cjs +1 -1
- package/common/src/functions/snarkjs/constructGeneralZkProof.mjs +57 -61
- package/common/src/functions/snarkjs/constructSolanaZkProof.cjs +1 -1
- package/common/src/functions/snarkjs/constructSolanaZkProof.mjs +60 -60
- package/common/src/functions/snarkjs/verifyCommitmentValidationData.cjs +1 -1
- package/common/src/functions/snarkjs/verifyCommitmentValidationData.mjs +1 -1
- package/common/src/functions/utils/bigint-math.utils.cjs +1 -1
- package/common/src/functions/utils/bigint-math.utils.d.ts +2 -0
- package/common/src/functions/utils/bigint-math.utils.mjs +18 -1
- package/common/src/functions/utils/buildClaimableDepositPlan.cjs +1 -1
- package/common/src/functions/utils/buildClaimableDepositPlan.mjs +1 -1
- package/common/src/functions/utils/getUtxosFromReceipt.utils.cjs +1 -1
- package/common/src/functions/utils/getUtxosFromReceipt.utils.mjs +1 -1
- package/common/src/functions/utils/getUtxosFromReceiptSolana.cjs +1 -1
- package/common/src/functions/utils/getUtxosFromReceiptSolana.mjs +4 -4
- package/common/src/functions/utils/hinkalTiming.utils.cjs +1 -1
- package/common/src/functions/utils/hinkalTiming.utils.d.ts +3 -9
- package/common/src/functions/utils/hinkalTiming.utils.mjs +13 -18
- package/common/src/functions/utils/index.cjs +1 -1
- package/common/src/functions/utils/index.mjs +3 -3
- package/common/src/functions/web3/events/getInputUtxoAndBalance.cjs +1 -1
- package/common/src/functions/web3/events/getInputUtxoAndBalance.mjs +71 -122
- package/common/src/functions/web3/events/getShieldedBalance.cjs +1 -1
- package/common/src/functions/web3/events/getShieldedBalance.mjs +64 -64
- package/common/src/functions/web3/functionCalls/transactCallRelayer.cjs +1 -1
- package/common/src/functions/web3/functionCalls/transactCallRelayer.mjs +42 -42
- package/common/src/types/index.cjs +1 -1
- package/common/src/types/index.mjs +1 -1
- package/common/src/webworker/logError-D8yBaP96.js +2 -0
- package/common/src/webworker/package.json +1 -1
- package/common/src/webworker/performTaskWithWorker.cjs +1 -1
- package/common/src/webworker/performTaskWithWorker.mjs +17 -18
- package/common/src/webworker/utxoWorker/utxoWorkerLauncher.ts?worker&url.cjs +1 -1
- package/common/src/webworker/utxoWorker/utxoWorkerLauncher.ts?worker&url.mjs +1 -1
- package/common/src/webworker/utxoWorkerNode.cjs +1 -1
- package/common/src/webworker/viteWorkerURL.constant.cjs +3 -4
- package/common/src/webworker/viteWorkerURL.constant.d.ts +0 -1
- package/common/src/webworker/viteWorkerURL.constant.mjs +3 -4
- package/common/src/webworker/zkProofWorker/zkProofWorkerLauncher.ts?worker&url.cjs +1 -1
- package/common/src/webworker/zkProofWorker/zkProofWorkerLauncher.ts?worker&url.mjs +1 -1
- package/common/src/webworker/zkProofWorkerNode.cjs +1 -1
- package/package.json +1 -1
- package/react-native/HinkalWebViewWorker.cjs +4 -76
- package/react-native/HinkalWebViewWorker.mjs +49 -152
- package/react-native/bridge/HinkalRNWorker.cjs +1 -1
- package/react-native/bridge/HinkalRNWorker.d.ts +0 -1
- package/react-native/bridge/HinkalRNWorker.mjs +11 -16
- package/react-native/shims/circomlibjs-hinkal-fork.js +2 -2
- package/react-native/shims/circomlibjs.js +2 -2
- package/react-native/workerCDNUrls.cjs +1 -1
- package/react-native/workerCDNUrls.d.ts +0 -1
- package/react-native/workerCDNUrls.mjs +2 -2
- package/sdk/package.json.cjs +1 -1
- package/sdk/package.json.mjs +1 -1
- package/common/src/crypto/rnCryptoBridge.cjs +0 -1
- package/common/src/crypto/rnCryptoBridge.d.ts +0 -8
- package/common/src/crypto/rnCryptoBridge.mjs +0 -10
- package/common/src/crypto/rnUtxoCrypto.cjs +0 -1
- package/common/src/crypto/rnUtxoCrypto.d.ts +0 -25
- package/common/src/crypto/rnUtxoCrypto.mjs +0 -74
- package/common/src/functions/utils/utxoPadding.utils.cjs +0 -1
- package/common/src/functions/utils/utxoPadding.utils.d.ts +0 -2
- package/common/src/functions/utils/utxoPadding.utils.mjs +0 -14
- package/common/src/webworker/cryptoWorker/cryptoWorker.types.cjs +0 -1
- package/common/src/webworker/cryptoWorker/cryptoWorker.types.d.ts +0 -51
- package/common/src/webworker/cryptoWorker/cryptoWorker.types.mjs +0 -6
- package/common/src/webworker/cryptoWorker/cryptoWorkerLauncher.d.ts +0 -1
- package/common/src/webworker/cryptoWorker/cryptoWorkerLogic.d.ts +0 -2
- package/common/src/webworker/logError-Dy_GXEF5.js +0 -2
- package/react-native/bridge/RnWebViewCryptoBridge.cjs +0 -1
- package/react-native/bridge/RnWebViewCryptoBridge.d.ts +0 -7
- package/react-native/bridge/RnWebViewCryptoBridge.mjs +0 -49
|
@@ -1,109 +1,58 @@
|
|
|
1
1
|
import { isSolanaLike as e, isTronLike as t } from "../../../constants/chains.constants.mjs";
|
|
2
2
|
import { caseInsensitiveEqual as n } from "../../utils/caseInsensitive.utils.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { createRnDeltaTiming as h } from "../../utils/hinkalTiming.utils.mjs";
|
|
14
|
-
import { Mutex as g } from "async-mutex";
|
|
3
|
+
import { Utxo as r } from "../../../data-structures/utxo/Utxo.mjs";
|
|
4
|
+
import { checkAddressNotUpdated as i } from "../../utils/upToDateState.mjs";
|
|
5
|
+
import { getHinkalCache as a, resetCache as o, setHinkalCache as s } from "../../utils/cacheFunctions.mjs";
|
|
6
|
+
import { encodeTokenWithId as c } from "../../utils/encodeTokenWithId.mjs";
|
|
7
|
+
import { formatMintAddress as l } from "../../utils/solanaMint.utils.mjs";
|
|
8
|
+
import { getInputUtxosEnclave as u } from "./getInputUtxosEnclave.mjs";
|
|
9
|
+
import { hashEthereumAddress as d } from "../../utils/addresses.mjs";
|
|
10
|
+
import { getScheduledTransactionsNullifierIndexes as f } from "../../../API/scheduled-transactions-calls.mjs";
|
|
11
|
+
import { addressToHexFormat as p } from "../../utils/tron.utils.mjs";
|
|
12
|
+
import { Mutex as m } from "async-mutex";
|
|
15
13
|
//#region libs/shared/common/src/functions/web3/events/getInputUtxoAndBalance.ts
|
|
16
|
-
var
|
|
17
|
-
if (e.allowParallelBalanceLocalDecryption) return t();
|
|
18
|
-
let n = h("utxoPrep.mutex");
|
|
19
|
-
return _.isLocked() && n.log("waiting-for-lock"), _.runExclusive(async () => {
|
|
20
|
-
n.log("lock-acquired");
|
|
21
|
-
try {
|
|
22
|
-
return await t();
|
|
23
|
-
} finally {
|
|
24
|
-
n.log("lock-released");
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
}, y = async (e, t, n, r, i, o, s, l, u) => v(e, async () => {
|
|
28
|
-
let d = h("utxoPrep.decrypt");
|
|
14
|
+
var h = new m(), g = async (e, t) => e.allowParallelBalanceLocalDecryption ? t() : h.runExclusive(t), _ = async (e, t, n, r, a, o, c, l, u) => g(e, async () => {
|
|
29
15
|
u += 1;
|
|
30
|
-
let
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
await a(e, r), _.log("during-decrypt"), c({
|
|
39
|
-
lastOutput: p,
|
|
40
|
-
encryptedOutputs: g
|
|
41
|
-
}, e, n, i), d.log("cache-write", { encryptedOutputs: g.length });
|
|
42
|
-
let v = await e.utxoUtils.buildBatchProcess(g, t, n);
|
|
43
|
-
return d.log("buildBatchProcess-done", { utxoCount: v.length }), v;
|
|
44
|
-
}), b = async (e, t, n, r) => {
|
|
45
|
-
let { utxos: i, encryptedOutputs: a, lastOutput: o } = await d(e, n, t);
|
|
46
|
-
return c({
|
|
16
|
+
let d = o.slice(u), { lastOutput: f, additionalEncryptedOutputs: p } = await e.utxoUtils.batchProcess(d, l, t, n), m = [...c, ...p];
|
|
17
|
+
return await i(e, r), s({
|
|
18
|
+
lastOutput: f,
|
|
19
|
+
encryptedOutputs: m
|
|
20
|
+
}, e, n, a), await e.utxoUtils.buildBatchProcess(m, t, n);
|
|
21
|
+
}), v = async (e, t, n, r) => {
|
|
22
|
+
let { utxos: i, encryptedOutputs: a, lastOutput: o } = await u(e, n, t);
|
|
23
|
+
return s({
|
|
47
24
|
encryptedOutputs: a,
|
|
48
25
|
lastOutput: o
|
|
49
26
|
}, e, n, r), i;
|
|
50
|
-
},
|
|
27
|
+
}, y = async (e, t, n, r, i, a, o, s, c) => {
|
|
51
28
|
try {
|
|
52
|
-
return await
|
|
29
|
+
return await v(e, t, n, i);
|
|
53
30
|
} catch {
|
|
54
|
-
return
|
|
31
|
+
return _(e, t, n, r, i, a, o, s, c);
|
|
55
32
|
}
|
|
56
|
-
},
|
|
33
|
+
}, b = (e) => {
|
|
57
34
|
if (Array.isArray(e)) return e;
|
|
58
35
|
if (e !== void 0) return [e];
|
|
59
|
-
},
|
|
60
|
-
for (e.sort((e, t) => e.amount <= t.amount ? 1 : -1); e.length < t || e.length > t && e.length < 6;) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
let
|
|
79
|
-
u.log("cache.read", { cachedEncryptedOutputs: v.length });
|
|
80
|
-
let S = h("wallet.checkAddress");
|
|
81
|
-
await a(e, d), S.log("before-decrypt");
|
|
82
|
-
let w = b !== "", T = _.findIndex((e) => e.value === b);
|
|
83
|
-
u.log("findLastOutputIndex", {
|
|
84
|
-
hinkalOutputs: _.length,
|
|
85
|
-
lastOutputIndex: T
|
|
86
|
-
});
|
|
87
|
-
let E = T > -1, D = !w && T === -1, O = e.areMerkleTreeUpdatesDisabled(), k = !O && (E || !c && D), A = !O && c && D, j = !k && !A;
|
|
88
|
-
u.log("branch", {
|
|
89
|
-
decryptLocally: k,
|
|
90
|
-
decryptRemotely: A,
|
|
91
|
-
useCache: j,
|
|
92
|
-
outputsSlice: T > -1 ? _.length - (T + 1) : 0
|
|
93
|
-
});
|
|
94
|
-
let M = [];
|
|
95
|
-
k ? (M = await y(e, p, t, d, f, _, v, b, T), u.log("decryptLocally-done", { utxoCount: M.length })) : A ? (M = await x(e, p, t, d, f, _, v, b, T), u.log("decryptRemotely-done", { utxoCount: M.length })) : j && (M = await e.utxoUtils.buildBatchProcess(v, p, t), u.log("useCache-buildBatchProcess-done", { utxoCount: M.length }));
|
|
96
|
-
let N = h("wallet.checkAddress");
|
|
97
|
-
await a(e, d), N.log("after-decrypt");
|
|
98
|
-
let P = await C(e, M, g);
|
|
99
|
-
u.log("filterSpentUtxos", {
|
|
100
|
-
allUtxos: M.length,
|
|
101
|
-
inputUtxos: P.length
|
|
102
|
-
});
|
|
103
|
-
let F = l ? P.filter((e) => e.isBlocked) : P.filter((e) => !e.isBlocked);
|
|
104
|
-
return u.log("done", { inputUtxos: F.length }), { inputUtxos: F };
|
|
105
|
-
}, E = async ({ hinkal: e, chainId: n, passedShieldedPublicKey: r = void 0, ethAddress: i = void 0, resetCacheBefore: a = !1, allowRemoteDecryption: o = !1 }) => {
|
|
106
|
-
let s = i ?? await e.getEthereumAddressByChain(n), c = f(t(n) ? m(s) : s), { inputUtxos: l } = await T({
|
|
36
|
+
}, x = async (e, t, n) => await e.utxoUtils.batchFilterUtxosWithNullifier(t, n), S = (e, t, n, i, a, o, s, c) => {
|
|
37
|
+
for (e.sort((e, t) => e.amount <= t.amount ? 1 : -1); e.length < t || e.length > t && e.length < 6;) if (e.push(new r({
|
|
38
|
+
amount: 0n,
|
|
39
|
+
erc20TokenAddress: o,
|
|
40
|
+
mintAddress: c,
|
|
41
|
+
nullifyingKey: i,
|
|
42
|
+
spendingPublicKey: a,
|
|
43
|
+
isNewStyle: !0
|
|
44
|
+
})), n) for (; e.length > 6;) e.splice(e.length - 1);
|
|
45
|
+
}, C = async ({ hinkal: e, chainId: t, passedShieldedPublicKey: n = void 0, ethAddress: r = void 0, resetCacheBefore: s = !1, allowRemoteDecryption: c = !1, useBlockedUtxos: l = !1 }) => {
|
|
46
|
+
let u = r ?? await e.getEthereumAddress(), d = n ?? e.userKeys.getShieldedPublicKey(), { userKeys: f } = e, p = e.encryptedOutputsByChain[t], m = e.nullifiersByChain[t], h = Array.from(p);
|
|
47
|
+
s && o(e, t, d);
|
|
48
|
+
let { encryptedOutputs: g, lastOutput: v } = a(e, t, d);
|
|
49
|
+
await i(e, u);
|
|
50
|
+
let b = v !== "", S = h.findIndex((e) => e.value === v), C = S > -1, w = !b && S === -1, T = e.areMerkleTreeUpdatesDisabled(), E = !T && (C || !c && w), D = !T && c && w, O = !E && !D, k = [];
|
|
51
|
+
E ? k = await _(e, f, t, u, d, h, g, v, S) : D ? k = await y(e, f, t, u, d, h, g, v, S) : O && (k = await e.utxoUtils.buildBatchProcess(g, f, t)), await i(e, u);
|
|
52
|
+
let A = await x(e, k, m);
|
|
53
|
+
return { inputUtxos: l ? A.filter((e) => e.isBlocked) : A.filter((e) => !e.isBlocked) };
|
|
54
|
+
}, w = async ({ hinkal: e, chainId: n, passedShieldedPublicKey: r = void 0, ethAddress: i = void 0, resetCacheBefore: a = !1, allowRemoteDecryption: o = !1 }) => {
|
|
55
|
+
let s = i ?? await e.getEthereumAddressByChain(n), c = d(t(n) ? p(s) : s), { inputUtxos: l } = await C({
|
|
107
56
|
hinkal: e,
|
|
108
57
|
chainId: n,
|
|
109
58
|
passedShieldedPublicKey: r,
|
|
@@ -113,51 +62,51 @@ var _ = new g(), v = async (e, t) => {
|
|
|
113
62
|
useBlockedUtxos: !0
|
|
114
63
|
});
|
|
115
64
|
if (!l.length) return { inputUtxos: [] };
|
|
116
|
-
let { indexes: u } = await
|
|
65
|
+
let { indexes: u } = await f({
|
|
117
66
|
hashedEthereumAddress: c,
|
|
118
67
|
nullifiers: l.map((e) => e.getNullifier())
|
|
119
68
|
});
|
|
120
69
|
return { inputUtxos: u.map((e) => l[e]).filter((e) => !!e) };
|
|
121
|
-
},
|
|
122
|
-
let
|
|
70
|
+
}, T = async ({ hinkal: t, tokenWithId: r, minInput: i = 2, sliceIfMore6: a = !0, chainId: o, passedShieldedPrivateKey: s = void 0, passedShieldedPublicKey: u = void 0, ethAddress: d = void 0, resetCacheBefore: f = !1, ensuredTokensWithId: p, allowRemoteDecryption: m = !1, useBlockedUtxos: h = !1 }) => {
|
|
71
|
+
let g = s ?? t.userKeys.getShieldedPrivateKey(), _ = t.userKeys.getSpendingKeyPair().pubSpendingBJJPoint, { inputUtxos: v } = h ? await w({
|
|
123
72
|
hinkal: t,
|
|
124
|
-
chainId:
|
|
125
|
-
ethAddress:
|
|
126
|
-
passedShieldedPrivateKey:
|
|
127
|
-
resetCacheBefore:
|
|
128
|
-
allowRemoteDecryption:
|
|
129
|
-
}) : await
|
|
73
|
+
chainId: o,
|
|
74
|
+
ethAddress: d,
|
|
75
|
+
passedShieldedPrivateKey: s,
|
|
76
|
+
resetCacheBefore: f,
|
|
77
|
+
allowRemoteDecryption: m
|
|
78
|
+
}) : await C({
|
|
130
79
|
hinkal: t,
|
|
131
|
-
tokenWithId:
|
|
132
|
-
minInput:
|
|
133
|
-
sliceIfMore6:
|
|
134
|
-
chainId:
|
|
135
|
-
passedShieldedPrivateKey:
|
|
136
|
-
passedShieldedPublicKey:
|
|
137
|
-
ethAddress:
|
|
138
|
-
resetCacheBefore:
|
|
139
|
-
allowRemoteDecryption:
|
|
140
|
-
}),
|
|
141
|
-
|
|
142
|
-
let t = e.getTokenAddress(
|
|
143
|
-
if (
|
|
144
|
-
let r =
|
|
80
|
+
tokenWithId: r,
|
|
81
|
+
minInput: i,
|
|
82
|
+
sliceIfMore6: a,
|
|
83
|
+
chainId: o,
|
|
84
|
+
passedShieldedPrivateKey: s,
|
|
85
|
+
passedShieldedPublicKey: u,
|
|
86
|
+
ethAddress: d,
|
|
87
|
+
resetCacheBefore: f,
|
|
88
|
+
allowRemoteDecryption: m
|
|
89
|
+
}), y = b(r), x = /* @__PURE__ */ new Map();
|
|
90
|
+
v.forEach((e) => {
|
|
91
|
+
let t = e.getTokenAddress(o);
|
|
92
|
+
if (y && !y.some((e) => n(e.erc20TokenAddress, t))) return;
|
|
93
|
+
let r = c(o, {
|
|
145
94
|
erc20TokenAddress: t,
|
|
146
95
|
tokenId: 0
|
|
147
96
|
}), i = x.get(r) ?? [];
|
|
148
97
|
x.set(r, [...i, e]);
|
|
149
|
-
}),
|
|
150
|
-
let t =
|
|
98
|
+
}), p?.forEach((e) => {
|
|
99
|
+
let t = c(o, {
|
|
151
100
|
erc20TokenAddress: e.erc20TokenAddress,
|
|
152
101
|
tokenId: 0
|
|
153
102
|
});
|
|
154
103
|
x.set(t, x.get(t) ?? []);
|
|
155
104
|
});
|
|
156
105
|
for (let [t, n] of x) {
|
|
157
|
-
let r = t.split("-")[0],
|
|
158
|
-
|
|
106
|
+
let r = t.split("-")[0], s = Number(t.split("-")[1]), c = e(o), u = c ? r : void 0;
|
|
107
|
+
S(n, i, a, g, _, c ? l(r).compressedAddress.toLowerCase() : r.toLowerCase(), s, u);
|
|
159
108
|
}
|
|
160
109
|
return x;
|
|
161
110
|
};
|
|
162
111
|
//#endregion
|
|
163
|
-
export {
|
|
112
|
+
export { y as attemptGetInputUtxosRemotely, C as getInputUtxoAndBalance, w as getInputUtxoAndBalanceOfStuckUtxos, T as getInputUtxoAndBalancePerToken, v as getInputUtxosRemotely };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../../../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../../constants/vite.constants.cjs`),t=require(`../../../constants/chains.constants.cjs`),n=require(`../../utils/caseInsensitive.utils.cjs`),r=require(`../../../error-handling/error-codes.constants.cjs`),i=require(`../etherFunctions.cjs`),a=require(`../../../
|
|
1
|
+
require(`../../../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../../constants/vite.constants.cjs`),t=require(`../../../constants/chains.constants.cjs`),n=require(`../../utils/caseInsensitive.utils.cjs`),r=require(`../../../error-handling/error-codes.constants.cjs`),i=require(`../etherFunctions.cjs`),a=require(`../../../data-structures/utxo/Utxo.cjs`),o=require(`../../../error-handling/customErrors/ErrorWithAmount.cjs`);require(`../../../error-handling/customErrors/index.cjs`);const s=require(`../../utils/encodeTokenWithId.cjs`),c=require(`../../utils/solanaMint.utils.cjs`),l=require(`./getInputUtxoAndBalance.cjs`),u=require(`../../../data-structures/TokenDBs/PrivateTokensDB.cjs`),d=require(`../../utils/map.utils.cjs`),f=require(`../../utils/mutexes.utils.cjs`),p=require(`../../utils/erc20tokenFunctions.cjs`);let m=require(`async-mutex`);var h=async(t,r,i,a,o,s=!1,c,h=!1,g=!1)=>d.getOrCreateMapValue(t.balanceFetchingMutexByChain,r,()=>new m.Mutex).runExclusive(async()=>f.getChainBalanceFetchingMutex(r).runShared(async()=>{let{inputUtxos:d}=g?await l.getInputUtxoAndBalanceOfStuckUtxos({hinkal:t,chainId:r,ethAddress:o,passedShieldedPrivateKey:i,resetCacheBefore:s,allowRemoteDecryption:c}):await l.getInputUtxoAndBalance({hinkal:t,sliceIfMore6:!1,chainId:r,passedShieldedPrivateKey:i,passedShieldedPublicKey:a,ethAddress:o,resetCacheBefore:s,allowRemoteDecryption:c});h&&e.isExtension&&await u.privateTokensDB.fetchAndUpdatePrivateTokens(d.map(e=>e.getTokenAddress(r)).filter(e=>e!==void 0),r,o);let f=(e.isExtension?await u.privateTokensDB.getPrivateTokens(r,o):await p.getErc20TokensForChainAPI(r)).map(e=>({token:e,balance:d.reduce((t,i)=>{let a=e.erc20TokenAddress;return n.caseInsensitiveEqual(a,i.getTokenAddress(r))?t+i.amount:t},0n),timestamp:d.filter(t=>n.caseInsensitiveEqual(t.getTokenAddress(r),e.erc20TokenAddress))[0]?.timeStamp,nfts:[]})),m=new Map;return f.forEach(e=>{m.set(e.token.erc20TokenAddress.toLowerCase(),e)}),m})),g=async(e,n,u,d,f=6,m=u.map(()=>0),h=!1,g=!1)=>{let{userKeys:_}=e,v=_.getSpendingKeyPair().pubSpendingBJJPoint,y=[],b=[];if(u.length===0)return[];if(h){for(let e=0;e<u.length;e+=1){let r=t.isSolanaLike(n),i=r?u[e]:void 0,o=r?c.formatMintAddress(u[e]).compressedAddress:u[e];y.push(Array.from({length:f},()=>new a.Utxo({amount:0n,erc20TokenAddress:o,mintAddress:i,nullifyingKey:_.getShieldedPrivateKey(),spendingPublicKey:v,isNewStyle:!0})))}return y}let x=await l.getInputUtxoAndBalancePerToken({hinkal:e,sliceIfMore6:!1,ensuredTokensWithId:u.map((e,t)=>({erc20TokenAddress:u[t],tokenId:m[t]})),allowRemoteDecryption:e.generateProofRemotely,useBlockedUtxos:g,chainId:n}),S=0;for(let e=0;e<u.length;e+=1){let t=x.get(s.encodeTokenWithId(n,{erc20TokenAddress:u[e],tokenId:m[e]}))??[];if(!t)throw Error(`Missing utxos for token`);S=Math.max(t.length,S),b.push(t)}if(S===2)return b;for(let[e,s]of b.entries())if(s.length>f){let t=s.slice(0,f),a=t.reduce((e,t)=>e+t.amount,0n);if(d[e]<0n&&a<-d[e]){let t=await p.getErc20TokenFromAPI(n,u[e]);if(!t)throw Error(`Token not found`);let s=t.decimals===18?6:2,c=Number(i.getAmountWithPrecision(a,t,s));throw new o.ErrorWithAmount(c,`${r.DIRECTLY_SHOW_MESSAGE_ERROR_CODES.UTXO_LIMITATIONS}. Please try again with ${c} ${t.symbol}, including gas fees.`)}y.push(t)}else if(s.length<=f){let r=[...s],i=f-s.length;for(;i>0;){--i;let o=t.isSolanaLike(n),s=o?u[e]:void 0,l=o?c.formatMintAddress(u[e]).compressedAddress:u[e];r.push(new a.Utxo({amount:0n,erc20TokenAddress:l,mintAddress:s,nullifyingKey:_.getShieldedPrivateKey(),spendingPublicKey:v,isNewStyle:!0}))}y.push(r)}return y};exports.addPaddingToUtxos=g,exports.getShieldedBalance=h;
|
|
@@ -3,28 +3,27 @@ import { isSolanaLike as t } from "../../../constants/chains.constants.mjs";
|
|
|
3
3
|
import { caseInsensitiveEqual as n } from "../../utils/caseInsensitive.utils.mjs";
|
|
4
4
|
import { DIRECTLY_SHOW_MESSAGE_ERROR_CODES as r } from "../../../error-handling/error-codes.constants.mjs";
|
|
5
5
|
import { getAmountWithPrecision as i } from "../etherFunctions.mjs";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { ErrorWithAmount as s } from "../../../error-handling/customErrors/ErrorWithAmount.mjs";
|
|
6
|
+
import { Utxo as a } from "../../../data-structures/utxo/Utxo.mjs";
|
|
7
|
+
import { ErrorWithAmount as o } from "../../../error-handling/customErrors/ErrorWithAmount.mjs";
|
|
9
8
|
import "../../../error-handling/customErrors/index.mjs";
|
|
10
|
-
import { encodeTokenWithId as
|
|
11
|
-
import { formatMintAddress as
|
|
12
|
-
import { getInputUtxoAndBalance as
|
|
13
|
-
import { privateTokensDB as
|
|
14
|
-
import { getOrCreateMapValue as
|
|
15
|
-
import { getChainBalanceFetchingMutex as
|
|
16
|
-
import { getErc20TokenFromAPI as
|
|
17
|
-
import { Mutex as
|
|
9
|
+
import { encodeTokenWithId as s } from "../../utils/encodeTokenWithId.mjs";
|
|
10
|
+
import { formatMintAddress as c } from "../../utils/solanaMint.utils.mjs";
|
|
11
|
+
import { getInputUtxoAndBalance as l, getInputUtxoAndBalanceOfStuckUtxos as u, getInputUtxoAndBalancePerToken as d } from "./getInputUtxoAndBalance.mjs";
|
|
12
|
+
import { privateTokensDB as f } from "../../../data-structures/TokenDBs/PrivateTokensDB.mjs";
|
|
13
|
+
import { getOrCreateMapValue as p } from "../../utils/map.utils.mjs";
|
|
14
|
+
import { getChainBalanceFetchingMutex as m } from "../../utils/mutexes.utils.mjs";
|
|
15
|
+
import { getErc20TokenFromAPI as h, getErc20TokensForChainAPI as g } from "../../utils/erc20tokenFunctions.mjs";
|
|
16
|
+
import { Mutex as _ } from "async-mutex";
|
|
18
17
|
//#region libs/shared/common/src/functions/web3/events/getShieldedBalance.ts
|
|
19
|
-
var
|
|
20
|
-
let { inputUtxos:
|
|
18
|
+
var v = async (t, r, i, a, o, s = !1, c, d = !1, h = !1) => p(t.balanceFetchingMutexByChain, r, () => new _()).runExclusive(async () => m(r).runShared(async () => {
|
|
19
|
+
let { inputUtxos: p } = h ? await u({
|
|
21
20
|
hinkal: t,
|
|
22
21
|
chainId: r,
|
|
23
22
|
ethAddress: o,
|
|
24
23
|
passedShieldedPrivateKey: i,
|
|
25
24
|
resetCacheBefore: s,
|
|
26
25
|
allowRemoteDecryption: c
|
|
27
|
-
}) : await
|
|
26
|
+
}) : await l({
|
|
28
27
|
hinkal: t,
|
|
29
28
|
sliceIfMore6: !1,
|
|
30
29
|
chainId: r,
|
|
@@ -34,81 +33,82 @@ var y = async (t, r, i, a, o, s = !1, c, l = !1, f = !1) => m(t.balanceFetchingM
|
|
|
34
33
|
resetCacheBefore: s,
|
|
35
34
|
allowRemoteDecryption: c
|
|
36
35
|
});
|
|
37
|
-
|
|
38
|
-
let
|
|
36
|
+
d && e && await f.fetchAndUpdatePrivateTokens(p.map((e) => e.getTokenAddress(r)).filter((e) => e !== void 0), r, o);
|
|
37
|
+
let m = (e ? await f.getPrivateTokens(r, o) : await g(r)).map((e) => ({
|
|
39
38
|
token: e,
|
|
40
|
-
balance:
|
|
39
|
+
balance: p.reduce((t, i) => {
|
|
41
40
|
let a = e.erc20TokenAddress;
|
|
42
41
|
return n(a, i.getTokenAddress(r)) ? t + i.amount : t;
|
|
43
42
|
}, 0n),
|
|
44
|
-
timestamp:
|
|
43
|
+
timestamp: p.filter((t) => n(t.getTokenAddress(r), e.erc20TokenAddress))[0]?.timeStamp,
|
|
45
44
|
nfts: []
|
|
46
|
-
})),
|
|
47
|
-
return
|
|
48
|
-
|
|
49
|
-
}),
|
|
50
|
-
})),
|
|
51
|
-
let { userKeys:
|
|
52
|
-
if (
|
|
53
|
-
if (
|
|
54
|
-
for (let e = 0; e <
|
|
55
|
-
let r = t(n), i = r ?
|
|
56
|
-
|
|
45
|
+
})), _ = /* @__PURE__ */ new Map();
|
|
46
|
+
return m.forEach((e) => {
|
|
47
|
+
_.set(e.token.erc20TokenAddress.toLowerCase(), e);
|
|
48
|
+
}), _;
|
|
49
|
+
})), y = async (e, n, l, u, f = 6, p = l.map(() => 0), m = !1, g = !1) => {
|
|
50
|
+
let { userKeys: _ } = e, v = _.getSpendingKeyPair().pubSpendingBJJPoint, y = [], b = [];
|
|
51
|
+
if (l.length === 0) return [];
|
|
52
|
+
if (m) {
|
|
53
|
+
for (let e = 0; e < l.length; e += 1) {
|
|
54
|
+
let r = t(n), i = r ? l[e] : void 0, o = r ? c(l[e]).compressedAddress : l[e];
|
|
55
|
+
y.push(Array.from({ length: f }, () => new a({
|
|
57
56
|
amount: 0n,
|
|
58
|
-
erc20TokenAddress:
|
|
57
|
+
erc20TokenAddress: o,
|
|
59
58
|
mintAddress: i,
|
|
60
|
-
nullifyingKey:
|
|
61
|
-
spendingPublicKey:
|
|
59
|
+
nullifyingKey: _.getShieldedPrivateKey(),
|
|
60
|
+
spendingPublicKey: v,
|
|
62
61
|
isNewStyle: !0
|
|
63
|
-
}));
|
|
62
|
+
})));
|
|
64
63
|
}
|
|
65
|
-
return
|
|
64
|
+
return y;
|
|
66
65
|
}
|
|
67
|
-
let
|
|
66
|
+
let x = await d({
|
|
68
67
|
hinkal: e,
|
|
69
68
|
sliceIfMore6: !1,
|
|
70
|
-
ensuredTokensWithId:
|
|
71
|
-
erc20TokenAddress:
|
|
72
|
-
tokenId:
|
|
69
|
+
ensuredTokensWithId: l.map((e, t) => ({
|
|
70
|
+
erc20TokenAddress: l[t],
|
|
71
|
+
tokenId: p[t]
|
|
73
72
|
})),
|
|
74
73
|
allowRemoteDecryption: e.generateProofRemotely,
|
|
75
|
-
useBlockedUtxos:
|
|
74
|
+
useBlockedUtxos: g,
|
|
76
75
|
chainId: n
|
|
77
|
-
}),
|
|
78
|
-
for (let e = 0; e <
|
|
79
|
-
let t =
|
|
80
|
-
erc20TokenAddress:
|
|
81
|
-
tokenId:
|
|
76
|
+
}), S = 0;
|
|
77
|
+
for (let e = 0; e < l.length; e += 1) {
|
|
78
|
+
let t = x.get(s(n, {
|
|
79
|
+
erc20TokenAddress: l[e],
|
|
80
|
+
tokenId: p[e]
|
|
82
81
|
})) ?? [];
|
|
83
82
|
if (!t) throw Error("Missing utxos for token");
|
|
84
|
-
|
|
83
|
+
S = Math.max(t.length, S), b.push(t);
|
|
85
84
|
}
|
|
86
|
-
if (
|
|
87
|
-
for (let [e,
|
|
88
|
-
let t =
|
|
89
|
-
if (
|
|
90
|
-
let t = await
|
|
85
|
+
if (S === 2) return b;
|
|
86
|
+
for (let [e, s] of b.entries()) if (s.length > f) {
|
|
87
|
+
let t = s.slice(0, f), a = t.reduce((e, t) => e + t.amount, 0n);
|
|
88
|
+
if (u[e] < 0n && a < -u[e]) {
|
|
89
|
+
let t = await h(n, l[e]);
|
|
91
90
|
if (!t) throw Error("Token not found");
|
|
92
|
-
let
|
|
93
|
-
throw new
|
|
91
|
+
let s = t.decimals === 18 ? 6 : 2, c = Number(i(a, t, s));
|
|
92
|
+
throw new o(c, `${r.UTXO_LIMITATIONS}. Please try again with ${c} ${t.symbol}, including gas fees.`);
|
|
94
93
|
}
|
|
95
|
-
|
|
96
|
-
} else if (
|
|
97
|
-
let r = [...
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
94
|
+
y.push(t);
|
|
95
|
+
} else if (s.length <= f) {
|
|
96
|
+
let r = [...s], i = f - s.length;
|
|
97
|
+
for (; i > 0;) {
|
|
98
|
+
--i;
|
|
99
|
+
let o = t(n), s = o ? l[e] : void 0, u = o ? c(l[e]).compressedAddress : l[e];
|
|
100
|
+
r.push(new a({
|
|
101
101
|
amount: 0n,
|
|
102
|
-
erc20TokenAddress:
|
|
102
|
+
erc20TokenAddress: u,
|
|
103
103
|
mintAddress: s,
|
|
104
|
-
nullifyingKey:
|
|
105
|
-
spendingPublicKey:
|
|
104
|
+
nullifyingKey: _.getShieldedPrivateKey(),
|
|
105
|
+
spendingPublicKey: v,
|
|
106
106
|
isNewStyle: !0
|
|
107
107
|
}));
|
|
108
108
|
}
|
|
109
|
-
|
|
109
|
+
y.push(r);
|
|
110
110
|
}
|
|
111
|
-
return
|
|
111
|
+
return y;
|
|
112
112
|
};
|
|
113
113
|
//#endregion
|
|
114
|
-
export {
|
|
114
|
+
export { y as addPaddingToUtxos, v as getShieldedBalance };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(
|
|
1
|
+
const e=require(`../../../error-handling/customErrors/ErrorWithTx.cjs`),t=require(`../../../constants/server.constants.cjs`),n=require(`../../../API/getServerURL.cjs`),r=require(`../../../data-structures/http/HttpClient.cjs`),i=require(`../../../API/callRelayer.cjs`),a=require(`../../snarkjs/common.snarkjs.cjs`);require(`../../../error-handling/index.cjs`),require(`../../snarkjs/index.cjs`);var o=t=>{if(t.status===`success`)return t.message;throw t.message&&t.error?new e.ErrorWithRelayerTransaction(t.error,t.message):Error(t.error)},s=async(e,t,n,r,s,c,l,u,d)=>{let f=a.serializeCircomData(r);return o(await i.callRelayerTransactAPI({chainId:e,a:t[0],b:t[1],c:t[2],dimData:n,circomData:f,withUniswapWorkAround:c,authorizationData:l,adminData:u,tronProofSignature:d,commitmentValidationData:s}))},c=async e=>o(await r.httpClient.post(`${n.RELAYER_URL}${t.RELAYER_CONFIG.SOLANA_TRANSACT}`,e)),l=e=>{if(e.status===`success`)return e.message.scheduleId;throw Error(e.error||`Batch transaction failed`)},u=async(e,t,n,r,o,s)=>{let c=t.map(e=>a.serializeCircomData(e.circomData));return l(await i.callRelayerTransactBatchAPI({chainId:e,transactions:t.map((t,n)=>({chainId:e,a:t.zkCallData[0],b:t.zkCallData[1],c:t.zkCallData[2],dimData:t.dimData,circomData:c[n],commitmentValidationData:t.commitmentValidationData,withUniswapWorkAround:t.withUniswapWorkAround,authorizationData:t.authorizationData,adminData:t.adminData,recipientAddress:t.recipientAddress,tronProofSignature:t.tronProofSignature})),txCompletionTime:r,hashedEthereumAddress:n,ref:o,hashedDashboardAccountId:s}))},d=async(e,t,n,r,a,o)=>l(await i.callRelayerSolanaTransactBatchAPI({chainId:e,transactions:t,hashedEthereumAddress:n,txCompletionTime:r,ref:a,hashedDashboardAccountId:o}));exports.solanaTransactCallRelayer=c,exports.solanaTransactCallRelayerBatch=d,exports.transactCallRelayer=s,exports.transactCallRelayerBatch=u;
|
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { ErrorWithRelayerTransaction as e } from "../../../error-handling/customErrors/ErrorWithTx.mjs";
|
|
2
|
+
import { RELAYER_CONFIG as t } from "../../../constants/server.constants.mjs";
|
|
3
|
+
import { RELAYER_URL as n } from "../../../API/getServerURL.mjs";
|
|
4
|
+
import { httpClient as r } from "../../../data-structures/http/HttpClient.mjs";
|
|
5
|
+
import { callRelayerSolanaTransactBatchAPI as i, callRelayerTransactAPI as a, callRelayerTransactBatchAPI as o } from "../../../API/callRelayer.mjs";
|
|
6
|
+
import { serializeCircomData as s } from "../../snarkjs/common.snarkjs.mjs";
|
|
7
7
|
import "../../../error-handling/index.mjs";
|
|
8
8
|
import "../../snarkjs/index.mjs";
|
|
9
9
|
//#region libs/shared/common/src/functions/web3/functionCalls/transactCallRelayer.ts
|
|
10
|
-
var c = (
|
|
11
|
-
if (
|
|
12
|
-
throw
|
|
13
|
-
}, l = async (t, n, r, i,
|
|
14
|
-
let f =
|
|
15
|
-
return c(await
|
|
16
|
-
chainId:
|
|
17
|
-
a:
|
|
18
|
-
b:
|
|
19
|
-
c:
|
|
20
|
-
dimData:
|
|
10
|
+
var c = (t) => {
|
|
11
|
+
if (t.status === "success") return t.message;
|
|
12
|
+
throw t.message && t.error ? new e(t.error, t.message) : Error(t.error);
|
|
13
|
+
}, l = async (e, t, n, r, i, o, l, u, d) => {
|
|
14
|
+
let f = s(r);
|
|
15
|
+
return c(await a({
|
|
16
|
+
chainId: e,
|
|
17
|
+
a: t[0],
|
|
18
|
+
b: t[1],
|
|
19
|
+
c: t[2],
|
|
20
|
+
dimData: n,
|
|
21
21
|
circomData: f,
|
|
22
|
-
withUniswapWorkAround:
|
|
22
|
+
withUniswapWorkAround: o,
|
|
23
23
|
authorizationData: l,
|
|
24
24
|
adminData: u,
|
|
25
25
|
tronProofSignature: d,
|
|
26
|
-
commitmentValidationData:
|
|
26
|
+
commitmentValidationData: i
|
|
27
27
|
}));
|
|
28
|
-
}, u = async (e) => c(await
|
|
28
|
+
}, u = async (e) => c(await r.post(`${n}${t.SOLANA_TRANSACT}`, e)), d = (e) => {
|
|
29
29
|
if (e.status === "success") return e.message.scheduleId;
|
|
30
30
|
throw Error(e.error || "Batch transaction failed");
|
|
31
|
-
}, f = async (t, n, r, i, a
|
|
32
|
-
let c =
|
|
33
|
-
return d(await
|
|
34
|
-
chainId:
|
|
35
|
-
transactions:
|
|
36
|
-
chainId:
|
|
37
|
-
a:
|
|
38
|
-
b:
|
|
39
|
-
c:
|
|
40
|
-
dimData:
|
|
31
|
+
}, f = async (e, t, n, r, i, a) => {
|
|
32
|
+
let c = t.map((e) => s(e.circomData));
|
|
33
|
+
return d(await o({
|
|
34
|
+
chainId: e,
|
|
35
|
+
transactions: t.map((t, n) => ({
|
|
36
|
+
chainId: e,
|
|
37
|
+
a: t.zkCallData[0],
|
|
38
|
+
b: t.zkCallData[1],
|
|
39
|
+
c: t.zkCallData[2],
|
|
40
|
+
dimData: t.dimData,
|
|
41
41
|
circomData: c[n],
|
|
42
|
-
commitmentValidationData:
|
|
43
|
-
withUniswapWorkAround:
|
|
44
|
-
authorizationData:
|
|
45
|
-
adminData:
|
|
46
|
-
recipientAddress:
|
|
47
|
-
tronProofSignature:
|
|
42
|
+
commitmentValidationData: t.commitmentValidationData,
|
|
43
|
+
withUniswapWorkAround: t.withUniswapWorkAround,
|
|
44
|
+
authorizationData: t.authorizationData,
|
|
45
|
+
adminData: t.adminData,
|
|
46
|
+
recipientAddress: t.recipientAddress,
|
|
47
|
+
tronProofSignature: t.tronProofSignature
|
|
48
48
|
})),
|
|
49
|
-
txCompletionTime:
|
|
50
|
-
hashedEthereumAddress:
|
|
51
|
-
ref:
|
|
52
|
-
hashedDashboardAccountId:
|
|
49
|
+
txCompletionTime: r,
|
|
50
|
+
hashedEthereumAddress: n,
|
|
51
|
+
ref: i,
|
|
52
|
+
hashedDashboardAccountId: a
|
|
53
53
|
}));
|
|
54
|
-
}, p = async (e, t, n, r,
|
|
54
|
+
}, p = async (e, t, n, r, a, o) => d(await i({
|
|
55
55
|
chainId: e,
|
|
56
56
|
transactions: t,
|
|
57
57
|
hashedEthereumAddress: n,
|
|
58
58
|
txCompletionTime: r,
|
|
59
|
-
ref:
|
|
59
|
+
ref: a,
|
|
60
60
|
hashedDashboardAccountId: o
|
|
61
61
|
}));
|
|
62
62
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`./chains.types.cjs`),require(`./hinkal.types.cjs`),require(`./circom-data.types.cjs`),require(`./
|
|
1
|
+
require(`./chains.types.cjs`),require(`./hinkal.types.cjs`),require(`./circom-data.types.cjs`),require(`./ethereum-network.types.cjs`),require(`./external-action.types.cjs`),require(`./token.types.cjs`),require(`./transactions.types.cjs`),require(`./admin.types.cjs`),require(`./activities.types.cjs`),require(`./transaction.types.cjs`),require(`./balances.types.cjs`),require(`./cache.types.cjs`),require(`./new-rewards.type.cjs`),require(`./eip5792.types.cjs`),require(`./offscreen.types.cjs`),require(`./scheduled-transactions.types.cjs`),require(`./events.types.cjs`),require(`./schedule.types.cjs`);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "./chains.types.mjs";
|
|
2
2
|
import "./hinkal.types.mjs";
|
|
3
3
|
import "./circom-data.types.mjs";
|
|
4
|
-
import "./external-action.types.mjs";
|
|
5
4
|
import "./ethereum-network.types.mjs";
|
|
5
|
+
import "./external-action.types.mjs";
|
|
6
6
|
import "./token.types.mjs";
|
|
7
7
|
import "./transactions.types.mjs";
|
|
8
8
|
import "./admin.types.mjs";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=require(`./workerProxy-DPeuP2Mg.js`);let t=require(`buffer`),n=require(`process`);n=e.u(n);let r=require(`circomlibjs-hinkal-fork`),i=require(`@noble/hashes/blake1.js`),a=require(`ethers`),o=require(`poseidon-lite`);o=e.u(o);let s=require(`libsodium-wrappers`);s=e.u(s);let c=require(`@solana/web3.js`),l=require(`bs58`);l=e.u(l);let u=require(`tweetnacl`);u=e.u(u);let d=require(`tronweb`);`${`00`.repeat(20)}`;var f=21888242871839275222246405745257275088548364400416034343698204186575808495617n,p=f/2n,m=200n;`${`00`.repeat(32)}`;var h=(e,t=f)=>{let n=e%t;return n>=0n?n:n+t},g=(e,t=f)=>{let n=1n,r=0n,i=h(e,t),a=t;if(i===0n)throw Error(`Division by zero`);for(;i>1n;){let e=a%i,t=a/i;a=i,i=e;let o=r-n*t;r=n,n=o}return n<0n?n+t:n},_={p:f,zero:0n,one:1n,e:e=>h(BigInt(e)),add:(e,t)=>h(e+t),sub:(e,t)=>h(e-t),mul:(e,t)=>h(e*t),div:(e,t)=>{if(t===0n)throw Error(`Division by zero in BabyJub field`);return h(e*g(t))},toString:e=>h(e).toString()},v={X:_.zero,Y:_.one,Z:_.one,T:_.zero},y=e=>{let t=_.e(e[0]),n=_.e(e[1]);return{X:t,Y:n,Z:_.one,T:_.mul(t,n)}},b=e=>{let t=g(e.Z);return[_.mul(e.X,t),_.mul(e.Y,t)]},x=_.e(`168700`),S=_.e(`168696`),C=(e,t)=>{let n=_.mul(e.X,t.X),r=_.mul(e.Y,t.Y),i=_.mul(_.mul(e.T,t.T),S),a=_.mul(e.Z,t.Z),o=_.sub(_.mul(_.add(e.X,e.Y),_.add(t.X,t.Y)),_.add(n,r)),s=_.sub(a,i),c=_.add(a,i),l=_.sub(r,_.mul(x,n));return{X:_.mul(o,s),Y:_.mul(c,l),T:_.mul(o,l),Z:_.mul(s,c)}},ee=e=>{let t=_.mul(e.X,e.X),n=_.mul(e.Y,e.Y),r=_.mul(_.mul(e.Z,e.Z),2n),i=_.mul(x,t),a=_.sub(_.mul(_.add(e.X,e.Y),_.add(e.X,e.Y)),_.add(t,n)),o=_.add(i,n),s=_.sub(o,r),c=_.sub(i,n);return{X:_.mul(a,s),Y:_.mul(o,c),T:_.mul(a,c),Z:_.mul(s,o)}},w=class{static A=x;static D=S;F=_;A=x;D=S;Base8=[_.e(`5299619240641551281634865583518297030282874472190772894086521144482721001553`),_.e(`16950150798460657717958625567821834550301663161624707787222815936182638968203`)];addPoint(e,t){return b(C(y(e),y(t)))}mulPointEscalar(e,t){let n=v,r=y(e),i=BigInt(t);for(;i!==0n;)i%2n==1n&&(n=C(n,r)),r=ee(r),i/=2n;return b(n)}},T=new class{babyjub=void 0;async init(){this.babyjub||=e.o?new w:await(0,r.buildBabyjub)()}getJub(){return this.babyjub}},E=()=>T.getJub();function D(e){return typeof e==`object`&&`toBigInt`in e?e.toBigInt():BigInt(e)}var O=()=>{let e=e=>{let t=o[`poseidon${e.length}`];if(!t)throw Error(`Poseidon: arity ${e.length} not supported (1..16)`);return t(e.map(e=>BigInt(e)))};return e.F={toString:e=>BigInt(e).toString()},e},k=new class{poseidon=void 0;async init(){this.poseidon||=e.o?O():await(0,r.buildPoseidon)()}getPoseidon(){return this.poseidon}};function A(...e){let t=k.getPoseidon();return D(t.F.toString(t(e)))}var j=(...e)=>{let t=k.getPoseidon();return a.ethers.toBeHex(t.F.toString(t([...e])))},M=21888242871839275222246405745257275088614511777268538073601725287587578984328n/8n,N=(e,t=0,n=e.length-t)=>{let r=0n;for(let i=n-1;i>=0;--i)r=(r<<8n)+BigInt(e[t+i]);return r},P=(e,t,n,r)=>{let i=h(n);for(let n=0;n<r;n+=1)e[t+n]=Number(i&255n),i>>=8n},F=e=>h(e,M),I=e=>{let t=new Uint8Array(e);return t[0]&=248,t[31]&=127,t[31]|=64,t},te=class{constructor(e,t){this.babyJub=e,this.poseidon=t}prv2pub(e){let t=N(I((0,i.blake512)(e).slice(0,32)),0,32);return this.babyJub.mulPointEscalar(this.babyJub.Base8,t/8n)}signPoseidon(e,t){let n=I((0,i.blake512)(e)),r=N(n,0,32),a=this.babyJub.mulPointEscalar(this.babyJub.Base8,r/8n),o=new Uint8Array(64);o.set(n.slice(32),0),P(o,32,t,32);let s=F(N((0,i.blake512)(o),0,64)),c=this.babyJub.mulPointEscalar(this.babyJub.Base8,s),l=this.poseidon([c[0],c[1],a[0],a[1],t]);return{R8:c,S:F(s+F(h(BigInt(this.poseidon.F.toString(l)))*r))}}},ne=async()=>(await k.init(),await T.init(),new te(T.getJub(),k.getPoseidon())),L=new class{eddsa=void 0;async init(){this.eddsa||=e.o?await ne():await(0,r.buildEddsa)()}getEddsa(){return this.eddsa}},R=()=>L.getEddsa(),z=async(e=!1)=>{(typeof window<`u`||typeof self<`u`)&&(typeof window<`u`&&(window.global=window),globalThis.Buffer=t.Buffer,globalThis.process=n.default),await Promise.all([s.default.ready,k.init(),T.init(),...e?[]:[L.init()]])},B=class{inMemoryCache=new Map;constructor(e){e&&this.mergeWithSerialized(e)}getInMemory(e){return this.inMemoryCache.get(e)??void 0}setInMemory(e,t){this.inMemoryCache.set(e,t)}mergeWithSerialized(t){Object.entries(t).forEach(([t,n])=>{this.set(t,e.c(n))})}},V=class extends B{isAttached=!1;get(e){return this.getInMemory(e)}set(e,t){this.setInMemory(e,t)}serialize(){return Object.fromEntries([...this.inMemoryCache].map(([t,n])=>[t,e.l(n)]))}attach(t){if(this.isAttached)throw Error(`can't reattach cache device`);return this.isAttached=!0,(...n)=>{let r=e.l(n),i=this.get(r);if(i!==void 0)return i;let a=t(...n);return this.set(r,a),a}}},H=e=>{if(e<0n||e>=21888242871839275222246405745257275088548364400416034343698204186575808495617n)throw RangeError();return e>p},U=e=>H(e)?1n:0n,W=new V,G=new V,K=new V,q=class{signature;nullifyingKey;PREFIX_FOR_SPENDING_PAIR=`1`;PREFIX_FOR_NULLIFYING_PAIR=`2`;constructor(e,t){this.signature=e,this.nullifyingKey=t}getSignature(){return this.requireSignature(),this.signature}setSignature(e){this.signature=e}requireSignature(){if(!this.signature)throw Error(`No signature provided`)}requireKeyMaterial(){if(!this.signature&&!this.nullifyingKey)throw Error(`No signature or private key provided`)}verifyTronMessage(e,t){return this.requireSignature(),t===d.Trx.verifyMessageV2(e,this.signature)}getShieldedPrivateKey=()=>(this.requireKeyMaterial(),this.nullifyingKey||=a.ethers.keccak256(this.signature),this.nullifyingKey);getShieldedPublicKey=()=>(this.requireKeyMaterial(),j(this.getShieldedPrivateKey()));getSpendingKeyPair=()=>{this.requireSignature();let e=R(),t=E(),n=j(this.PREFIX_FOR_SPENDING_PAIR,this.getSignature()),r=Buffer.from(a.ethers.getBytes(n)),i=e.prv2pub(r);return{privSpendingKey:n,pubSpendingBJJPoint:[BigInt(t.F.toString(i[0])),BigInt(t.F.toString(i[1]))]}};signEddsa=e=>{this.requireSignature();let t=E(),n=R(),r=Buffer.from(a.ethers.getBytes(this.getSpendingKeyPair().privSpendingKey)),i=t.F.e(e),o=n.signPoseidon(r,i);return{R8:[BigInt(t.F.toString(o.R8[0])),BigInt(t.F.toString(o.R8[1]))],S:BigInt(o.S)}};getShieldedPrivateKeyFromNonce=e=>{this.requireKeyMaterial();let t=j(e,this.getShieldedPrivateKey(),this.getShieldedPublicKey());return a.ethers.keccak256(a.ethers.toUtf8Bytes(`hinkal-offchain-shielded-key:${t}`))};getClaimableSignatureFromNonce=e=>{this.requireKeyMaterial();let t=j(e,this.getShieldedPrivateKey(),this.getShieldedPublicKey());return a.ethers.keccak256(a.ethers.toUtf8Bytes(`hinkal-claimable-utxo-signature:${t}`))};getDerivedEthereumAddress=()=>(this.requireKeyMaterial(),new a.ethers.Wallet(this.getShieldedPrivateKey()).address);getDerivedSolanaPublicKey=()=>(this.requireKeyMaterial(),c.Keypair.fromSeed(a.ethers.getBytes(this.getShieldedPrivateKey())).publicKey.toBase58());getNearIntentsAccountId=()=>{this.requireKeyMaterial();let e=c.Keypair.fromSeed(a.ethers.getBytes(this.getShieldedPrivateKey()));return a.ethers.hexlify(e.publicKey.toBytes()).slice(2)};getNearIntentsKeyPairString=()=>{this.requireKeyMaterial();let e=c.Keypair.fromSeed(a.ethers.getBytes(this.getShieldedPrivateKey()));return`ed25519:${l.default.encode(e.secretKey)}`};getSignerPrivateKeyFromNonce=e=>{this.requireKeyMaterial();let t=j(e,this.getShieldedPrivateKey(),this.getShieldedPublicKey());return a.ethers.keccak256(a.ethers.toUtf8Bytes(t))};getSignerSolanaPrivateKeyFromNonce=e=>{let t=this.getSignerPrivateKeyFromNonce(e),n=a.ethers.getBytes(t),r=c.Keypair.fromSeed(n);return l.default.encode(r.secretKey)};verifyMessage(e){return this.requireSignature(),a.ethers.verifyMessage(e,this.signature)}verifySolanaMessage(e,t){this.requireSignature();let n=new TextEncoder().encode(e),r=a.ethers.getBytes(this.signature),i=new c.PublicKey(t).toBytes();return u.default.sign.detached.verify(n,r,i)}static getRandomizedStealthPairOld=G.attach((e,t)=>{let n=E(),r=e*(BigInt(t)%f)%f,i=n.mulPointEscalar(n.Base8,e),a=n.mulPointEscalar(n.Base8,r);return{H0:[BigInt(n.F.toString(i[0])),BigInt(n.F.toString(i[1]))],H1:[BigInt(n.F.toString(a[0])),BigInt(n.F.toString(a[1]))]}});static getRandomizedStealthPair=W.attach((e,t)=>{let n=E(),r=BigInt(t)%f,i=n.mulPointEscalar(n.Base8,e),a=n.mulPointEscalar(i,r);return{H0:[BigInt(n.F.toString(i[0])),BigInt(n.F.toString(i[1]))],H1:[BigInt(n.F.toString(a[0])),BigInt(n.F.toString(a[1]))]}});static getStealthAddressCompressedPoints=(e,t)=>{let{H0:n,H1:r}=this.getRandomizedStealthPairOld(e,t),[i,a]=[n,r].map(e=>BigInt(e[1])+2n**255n*U(e[0]));return{h0:i,h1:a}};static checkSignature=(e,t,n,r)=>{let{h0:i,h1:a}=this.getStealthAddressCompressedPoints(e,r);return t===i&&n===a};static getStealthAddress=K.attach((e,t)=>{let{H0:n,H1:r}=this.getRandomizedStealthPairOld(e,t);return j(2n*U(n[0])+U(r[0]),n[1],r[1])});static getH1FromH0=(e,t)=>{let n=E(),r=BigInt(t)%f,i=[n.F.e(e[0]),n.F.e(e[1])],a=n.mulPointEscalar(i,r);return[BigInt(n.F.toString(a[0])),BigInt(n.F.toString(a[1]))]};static verifyStealthPair=(e,t,n,r=!0)=>{let i=this.getH1FromH0(e,n);return r?i[1]===t[1]:i===t};static getStealthAddressNewStyle=(e,t,n)=>{if(n?.length!==2)throw Error(`Spending public key must be an array of 2 elements`);let r=this.getH1FromH0(e,t);return j(2n*U(e[0])+U(r[0]),e[1],r[1],n[0],n[1],t)};static findCorrectRandomization(e,t){if(!t)throw Error(`No Private Shielded Key Provided`);let n=BigInt(t)%f,r,i,a=0n;do r=e*10n**a%f,i=r*n%f,a+=1n;while(i>=2n**253n||r>=2n**253n);return r}static getH0FromRandomization=e=>{let t=E(),n=t.mulPointEscalar(t.Base8,e);return[BigInt(t.F.toString(n[0])),BigInt(t.F.toString(n[1]))]};static findH0(e,t){if(!t)return;let{H0:n}=this.getRandomizedStealthPair(e,t);return n}static getEncryptionKeyPair=e=>{let t=s.default.crypto_box_seed_keypair(a.ethers.getBytes(e));return{privateKey:a.ethers.hexlify(t.privateKey),publicKey:a.ethers.hexlify(t.publicKey)}};getAccessKey=()=>(this.requireKeyMaterial(),j(this.getShieldedPrivateKey(),this.getShieldedPublicKey()));getBackendToken=()=>(this.requireKeyMaterial(),j(this.getAccessKey(),this.getShieldedPublicKey()))},J={CANNOT_CERTIFY_FOR_PAST_WEEK:`Certification for the past week is not available`,CYCLICAL_REFERRALS_FORBIDDEN:`Cyclical referrals are forbidden`,USER_IS_UNRANKED:`Please certify transactions to see rank`},Y={WC_NO_MATCHING_KEY:`creating the transaction failed
|
|
2
|
+
version`,CONNECTION_PROBLEM:`Failed to connect wallet. Please try again.`,REQUEST_PENDING:`request of type 'wallet_requestpermissions' already pending for origin`},X={INSUFFICIENT_FUNDS:`Insufficient funds`,INSUFFICIENT_FUNDS_WITHDRAW:`Not enough funds to withdraw`,INSUFFICIENT_FUNDS_TRANSFER:`Not enough funds to transfer`,INSUFFICIENT_FUNDS_TO_TRANSACT:`Not enough funds to transact`,INSUFFICIENT_FUNDS_GAS:`Insufficient funds for gas * price`,INSUFFICIENT_TRON_BALANCE_FOR_FEE:`Insufficient TRX balance to cover transfer amount and transaction fee reserve`,INSUFFICIENT_SOL_BALANCE:`Insufficient SOL balance`},re={GAS_PRICE_EXCEEDS_AUTOSHIELD_LIMIT:`Skipped shielding due to gas fee exceeding your limit.`,AUTO_SHIELD_INSUFFICIENT_GAS:`Auto-Shield skipped due to insufficient gas.`};({...J,...Y,...X,...re});var ie=e=>BigInt(a.ethers.hexlify(a.ethers.randomBytes(e))),ae=()=>Math.floor(Date.now()/1e3),Z=class t{amount;erc20TokenAddress;mintAddress;timeStamp;nullifyingKey;spendingPublicKey;randomization;H0;stealthAddress;encryptionKey;commitment;nullifier;isBlocked;isNewStyle;constructor({amount:e,erc20TokenAddress:t,mintAddress:n,timeStamp:r,nullifyingKey:i,spendingPublicKey:a,randomization:o,H0:s,stealthAddress:c,encryptionKey:l,commitment:u=void 0,nullifier:d=void 0,isBlocked:f=!1,isNewStyle:p=!1}){this.amount=e,this.erc20TokenAddress=t,this.mintAddress=n,this.timeStamp=r??ae().toString(),this.nullifyingKey=i,this.spendingPublicKey=a,this.randomization=o??(i?q.findCorrectRandomization(ie(31),i):void 0),this.H0=s??(p&&this.randomization?q.findH0(this.randomization,i):void 0),this.stealthAddress=c,this.encryptionKey=l,this.commitment=u,this.nullifier=d,this.isBlocked=f,this.isNewStyle=p}static createFrom(e,n){return new t({...e.getConstructableParams(),nullifier:void 0,commitment:void 0,...n})}getConstructableParams(){return{amount:this.amount,erc20TokenAddress:this.erc20TokenAddress,mintAddress:this.mintAddress,timeStamp:this.timeStamp,nullifyingKey:this.nullifyingKey,spendingPublicKey:this.spendingPublicKey,randomization:this.randomization,H0:this.H0,stealthAddress:this.stealthAddress,encryptionKey:this.encryptionKey,commitment:this.commitment,nullifier:this.nullifier,isBlocked:this.isBlocked,isNewStyle:this.isNewStyle}}getBasicUtxoParams(){return{amount:this.amount,erc20TokenAddress:this.erc20TokenAddress,mintAddress:this.mintAddress,timeStamp:this.timeStamp,randomization:this.randomization,H0:this.H0,stealthAddress:this.stealthAddress,commitment:this.commitment,nullifier:this.nullifier,isBlocked:this.isBlocked,isNewStyle:this.isNewStyle}}getCommitment(){if(!this.commitment){let e=[this.amount,this.erc20TokenAddress,BigInt(this.getStealthAddress()),this.timeStamp];this.commitment=j(...e)}return this.commitment}getNullifier(){if(!this.nullifier){if(!this.nullifyingKey)throw Error(`No Nullifiers if private key is not provided`);let e=this.getCommitment(),t=j(this.nullifyingKey,e);this.nullifier=j(e,t)}return this.nullifier}getStealthAddress(){if(!this.stealthAddress){if(!this.nullifyingKey)throw Error(`No stealth address in UTXO if private key is not provided`);if(this.isNewStyle){if(!this.H0)throw Error(`No H0 point provided`);this.stealthAddress=q.getStealthAddressNewStyle(this.H0,this.nullifyingKey,this.spendingPublicKey)}else{if(!this.randomization)throw Error(`No randomization provided`);this.stealthAddress=q.getStealthAddress(this.randomization,this.nullifyingKey)}}return this.stealthAddress}getTokenAddress(t){let n=e.r(t)?this.mintAddress:this.erc20TokenAddress;if(!n)throw Error(`No token address provided`);return n}getEncryptionKey(){if(!this.nullifyingKey){if(!this.encryptionKey)throw Error(`No encryption key provided in UTXO`);return this.encryptionKey}return q.getEncryptionKeyPair(this.nullifyingKey).publicKey}},oe=()=>s.default.crypto_box_SEALBYTES+s.default.crypto_secretbox_KEYBYTES,Q=e=>{let t=s.default.crypto_secretbox_NONCEBYTES,n=oe(),r=0,i=e[r];r+=1;let a=e.slice(r,r+t);r+=t;let o=[];for(let t=0;t<i;t+=1)o.push(e.slice(r,r+n)),r+=n;return{nonce:a,sealedKeys:o,ciphertext:e.slice(r)}},se=(e,t,n,r)=>{let{nonce:i,sealedKeys:o,ciphertext:c}=Q(e),l=s.default.crypto_box_seal_open(o[r],a.ethers.getBytes(n),a.ethers.getBytes(t)),u=s.default.crypto_secretbox_open_easy(c,i,l);return Buffer.from(u)},ce=(e,t,n)=>{let r=s.default.crypto_box_seal_open(e,a.ethers.getBytes(n),a.ethers.getBytes(t));return Buffer.from(r)},le=54912,ue=2,de=e=>e[0]*256+e[1],$=(e,t)=>{let{privateKey:n,publicKey:r}=q.getEncryptionKeyPair(t.getShieldedPrivateKey()),i=de(e)===le?se(e.slice(ue),n,r,0):ce(e,n,r),a=Buffer.from(i).toString(`utf-8`).split(`0x`).filter(e=>e.length!==0),o=e=>BigInt(`0x${e}`),s=e=>`0x${e}`,l=a.length>=8,u=l&&o(a[5])===1n,d=l?8:6,f=a[d]?s(a[d]):void 0,p=f?new c.PublicKey(Buffer.from(f.slice(2),`hex`)).toString():void 0;return{amount:o(a[0]),erc20TokenAddress:s(a[1]),randomization:o(a[2]),stealthAddress:s(a[3]),nullifyingKey:t.getShieldedPrivateKey(),timeStamp:o(a[4]).toString(),isNewStyle:u,...u?{H0:[o(a[6]),o(a[7])]}:{},mintAddress:p}},fe=(e,t)=>new Z($(e,t)),pe=e=>e&2n**255n-1n,me=e=>e>>255n&1n,he=(...t)=>{e.a&&console.log(...t)};Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return $}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return K}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return fe}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return W}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return me}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return pe}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return he}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return z}});
|