@gurge/sdk 0.3.26 → 0.3.27
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/rnUtxoCrypto.cjs +1 -1
- package/common/src/crypto/rnUtxoCrypto.d.ts +11 -0
- package/common/src/crypto/rnUtxoCrypto.mjs +46 -12
- 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/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/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.mjs +12 -12
- 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/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/functions/index.cjs +1 -1
- package/common/src/functions/index.mjs +3 -3
- package/common/src/functions/pre-transaction/buildCommitmentValidationData.cjs +1 -1
- package/common/src/functions/pre-transaction/buildCommitmentValidationData.mjs +13 -13
- 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 +77 -76
- 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/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/index.cjs +1 -1
- package/common/src/functions/utils/index.mjs +2 -2
- package/common/src/functions/web3/events/getInputUtxoAndBalance.cjs +1 -1
- package/common/src/functions/web3/events/getInputUtxoAndBalance.mjs +81 -80
- 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/cryptoWorker/cryptoWorker.types.cjs +1 -1
- package/common/src/webworker/cryptoWorker/cryptoWorker.types.d.ts +3 -1
- package/common/src/webworker/cryptoWorker/cryptoWorker.types.mjs +1 -1
- package/common/src/webworker/logError-Dy_GXEF5.js +2 -0
- package/common/src/webworker/package.json +1 -1
- 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 +4 -4
- package/common/src/webworker/viteWorkerURL.constant.mjs +4 -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/sdk/package.json.cjs +1 -1
- package/sdk/package.json.mjs +1 -1
- package/common/src/webworker/logError-DFS-H2t0.js +0 -2
|
@@ -3,14 +3,14 @@ import { HINKAL_PRIVATE_SEND_VARIABLE_RATE as t, solanaNativeAddress as n } from
|
|
|
3
3
|
import { transactionErrorCodes as r } from "../../error-handling/error-codes.constants.mjs";
|
|
4
4
|
import { randomBigInt as i } from "../../functions/web3/etherFunctions.mjs";
|
|
5
5
|
import { UserKeys as a } from "../crypto-keys/keys.mjs";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { ExternalActionId as o } from "../../types/external-action.types.mjs";
|
|
7
|
+
import { calcEncryptedOutputs as s } from "../../functions/snarkjs/common.snarkjs.mjs";
|
|
8
|
+
import { getCurrentTimeInSeconds as c } from "../../functions/utils/time.utils.mjs";
|
|
8
9
|
import "../../types/index.mjs";
|
|
9
|
-
import { isValidPrivateAddress as
|
|
10
|
-
import { validateAndGetChainId as
|
|
11
|
-
import { addPaddingToUtxos as
|
|
12
|
-
import { outputUtxoProcessing as
|
|
13
|
-
import { calcEncryptedOutputs as f } from "../../functions/snarkjs/common.snarkjs.mjs";
|
|
10
|
+
import { isValidPrivateAddress as l } from "../../functions/utils/addresses.mjs";
|
|
11
|
+
import { validateAndGetChainId as u } from "../../functions/utils/token-check.utils.mjs";
|
|
12
|
+
import { addPaddingToUtxos as d } from "../../functions/web3/events/getShieldedBalance.mjs";
|
|
13
|
+
import { outputUtxoProcessing as f } from "../../functions/pre-transaction/outputUtxoProcessing.mjs";
|
|
14
14
|
import { constructAdminData as p } from "../../functions/pre-transaction/constructAdminData.mjs";
|
|
15
15
|
import { ensureAmountChanges as m } from "../../functions/pre-transaction/ensureAmountChanges.mjs";
|
|
16
16
|
import { getFeeStructure as h } from "../../functions/pre-transaction/getFeeStructure.mjs";
|
|
@@ -21,35 +21,35 @@ import { solanaTransactCallRelayer as v } from "../../functions/web3/functionCal
|
|
|
21
21
|
import { ethers as y } from "ethers";
|
|
22
22
|
//#region libs/shared/common/src/data-structures/Hinkal/hinkalSolanaTransfer.ts
|
|
23
23
|
var b = async (e, t, n, r, i, a) => {
|
|
24
|
-
let
|
|
24
|
+
let o = (await d(e, t, n, r, 6))[0], s = c().toString(), { outputUtxos: l } = await f(e.userKeys, o, r[0], s, !0, i, a);
|
|
25
25
|
return {
|
|
26
|
-
inputUtxos:
|
|
26
|
+
inputUtxos: o,
|
|
27
27
|
senderUtxo: l[0],
|
|
28
28
|
recipientUtxo: l[1]
|
|
29
29
|
};
|
|
30
|
-
}, x = async (
|
|
31
|
-
if (!
|
|
32
|
-
let w =
|
|
30
|
+
}, x = async (c, d, f, v, x, S, C) => {
|
|
31
|
+
if (!l(v)) throw Error(r.RECIPIENT_FORMAT_INCORRECT);
|
|
32
|
+
let w = u(d), T = [...f], { originalDeployer: E } = e[w].contractData;
|
|
33
33
|
if (!E) throw Error("missing data");
|
|
34
|
-
let { userKeys: D, merkleTreeHinkalByChain: O } =
|
|
34
|
+
let { userKeys: D, merkleTreeHinkalByChain: O } = c, k = d.map((e) => e.erc20TokenAddress);
|
|
35
35
|
if (k.length > 1) throw Error("Solana Transfer: Only one mint address is supported");
|
|
36
|
-
let A = S ?? await h(w, x, k,
|
|
36
|
+
let A = S ?? await h(w, x, k, o.Transact, [], 5n);
|
|
37
37
|
A.variableRate ||= t;
|
|
38
38
|
let j = g(-T[0], A), M = -T[0];
|
|
39
39
|
T[0] -= j;
|
|
40
40
|
let [N, P, { inputUtxos: F, senderUtxo: I, recipientUtxo: L }] = await Promise.all([
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
b(
|
|
41
|
+
c.getRandomRelay(w, !0),
|
|
42
|
+
c.getEthereumAddressByChain(w),
|
|
43
|
+
b(c, w, k, T, v, M)
|
|
44
44
|
]);
|
|
45
45
|
if (!N) throw Error(r.RELAYER_NOT_AVAILABLE);
|
|
46
|
-
let R = a.findCorrectRandomization(i(31),
|
|
46
|
+
let R = a.findCorrectRandomization(i(31), c.userKeys.getShieldedPrivateKey()), z = {
|
|
47
47
|
tokenNumber: k.length,
|
|
48
48
|
nullifierAmount: F.length,
|
|
49
49
|
outputAmount: 2
|
|
50
|
-
}, B =
|
|
50
|
+
}, B = s([[I, L]])[0].map((e) => Array.from(y.getBytes(e)));
|
|
51
51
|
m([F], [[I]], T);
|
|
52
|
-
let { proofAArr: V, proofBArr: H, proofCArr: U, publicInputsArr: W, commitmentValidationData: G } = await _(
|
|
52
|
+
let { proofAArr: V, proofBArr: H, proofCArr: U, publicInputsArr: W, commitmentValidationData: G } = await _(c.generateProofRemotely, O[w], D, [k[0]], [F], [[I, L]], R, j, 0n, n, N, z, B, w), K = {
|
|
53
53
|
recipient: N,
|
|
54
54
|
mint: k[0] === "11111111111111111111111111111111" ? void 0 : k[0]
|
|
55
55
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../constants/chains.constants.cjs`);require(`../../constants/protocol.constants.cjs`);const t=require(`../../error-handling/error-codes.constants.cjs`),n=require(`../../functions/web3/etherFunctions.cjs`),r=require(`../crypto-keys/keys.cjs`),i=require(`../../functions/
|
|
1
|
+
require(`../../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../constants/chains.constants.cjs`);require(`../../constants/protocol.constants.cjs`);const t=require(`../../error-handling/error-codes.constants.cjs`),n=require(`../../functions/web3/etherFunctions.cjs`),r=require(`../crypto-keys/keys.cjs`),i=require(`../../types/external-action.types.cjs`),a=require(`../../functions/snarkjs/common.snarkjs.cjs`),o=require(`../../functions/utils/time.utils.cjs`);require(`../../types/index.cjs`);const s=require(`../../functions/utils/token-check.utils.cjs`),c=require(`../../functions/web3/events/getShieldedBalance.cjs`),l=require(`../../functions/pre-transaction/outputUtxoProcessing.cjs`),u=require(`../../functions/pre-transaction/constructAdminData.cjs`),d=require(`../../functions/pre-transaction/ensureAmountChanges.cjs`),f=require(`../../functions/pre-transaction/getFeeStructure.cjs`);require(`../../functions/pre-transaction/index.cjs`),require(`../../constants/index.cjs`);const p=require(`../../functions/utils/fees.utils.cjs`),m=require(`../../functions/snarkjs/constructSolanaZkProof.cjs`),h=require(`../../functions/web3/functionCalls/transactCallRelayer.cjs`);let g=require(`ethers`);var _=async(e,t,n,r)=>{let i=[...await c.addPaddingToUtxos(e,t,n,r,6)][0],a=o.getCurrentTimeInSeconds().toString(),{outputUtxos:s}=await l.outputUtxoProcessing(e.userKeys,i,r[0],a);return{inputUtxos:i,outputUtxos:s}},v=async(o,c,l,v,y,b,x)=>{let S=s.validateAndGetChainId(c),C=c.map(e=>e.erc20TokenAddress),w=c[0];if(!w)throw Error(`Solana Withdraw: No Token Found`);let{originalDeployer:T}=e.networkRegistry[S].contractData;if(!T)throw Error(`missing data`);let{userKeys:E,merkleTreeHinkalByChain:D}=o,O=b??await f.getFeeStructure(S,y,C,i.ExternalActionId.Transact),k=await p.calculateModifiedFeeStructure(S,w,-l[0],O);l[0]-=k.flatFee;let[A,{inputUtxos:j,outputUtxos:M}]=await Promise.all([o.getRandomRelay(S,!0),_(o,S,C,l)]);if(!A)throw Error(t.transactionErrorCodes.RELAYER_NOT_AVAILABLE);if(C.length>1)throw Error(`Solana Withdraw: Only one mint address is supported`);let N=r.UserKeys.findCorrectRandomization(n.randomBigInt(31),o.userKeys.getShieldedPrivateKey()),P={tokenNumber:C.length,nullifierAmount:j.length,outputAmount:M.length},F=a.calcEncryptedOutputs([M])[0][0],I=Array.from(g.ethers.getBytes(F));d.ensureAmountChanges([j],[M],l);let{proofAArr:L,proofBArr:R,proofCArr:z,publicInputsArr:B,commitmentValidationData:V}=await m.constructSolanaZkProof(o.generateProofRemotely,D[S],E,[C[0]],[j],[M],N,k.flatFee,k.variableRate,v,A,P,[I],S),H={recipient:v,mint:C[0]===`11111111111111111111111111111111`?void 0:C[0]};return h.solanaTransactCallRelayer({chainId:S,relayAddress:A,functionName:`transact`,args:{proofAArr:L,proofBArr:R,proofCArr:z,publicInputsArr:B,encryptedOutputs:[I],relayerFee:k.flatFee.toString(),dimensions:P},accounts:H,commitmentValidationData:V,adminData:u.constructAdminData(x,S,C,l,await o.getEthereumAddress())})};exports.hinkalSolanaWithdraw=v;
|
|
@@ -3,13 +3,13 @@ import "../../constants/protocol.constants.mjs";
|
|
|
3
3
|
import { transactionErrorCodes as t } from "../../error-handling/error-codes.constants.mjs";
|
|
4
4
|
import { randomBigInt as n } from "../../functions/web3/etherFunctions.mjs";
|
|
5
5
|
import { UserKeys as r } from "../crypto-keys/keys.mjs";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { ExternalActionId as i } from "../../types/external-action.types.mjs";
|
|
7
|
+
import { calcEncryptedOutputs as a } from "../../functions/snarkjs/common.snarkjs.mjs";
|
|
8
|
+
import { getCurrentTimeInSeconds as o } from "../../functions/utils/time.utils.mjs";
|
|
8
9
|
import "../../types/index.mjs";
|
|
9
|
-
import { validateAndGetChainId as
|
|
10
|
-
import { addPaddingToUtxos as
|
|
11
|
-
import { outputUtxoProcessing as
|
|
12
|
-
import { calcEncryptedOutputs as l } from "../../functions/snarkjs/common.snarkjs.mjs";
|
|
10
|
+
import { validateAndGetChainId as s } from "../../functions/utils/token-check.utils.mjs";
|
|
11
|
+
import { addPaddingToUtxos as c } from "../../functions/web3/events/getShieldedBalance.mjs";
|
|
12
|
+
import { outputUtxoProcessing as l } from "../../functions/pre-transaction/outputUtxoProcessing.mjs";
|
|
13
13
|
import { constructAdminData as u } from "../../functions/pre-transaction/constructAdminData.mjs";
|
|
14
14
|
import { ensureAmountChanges as d } from "../../functions/pre-transaction/ensureAmountChanges.mjs";
|
|
15
15
|
import { getFeeStructure as f } from "../../functions/pre-transaction/getFeeStructure.mjs";
|
|
@@ -21,28 +21,28 @@ import { solanaTransactCallRelayer as h } from "../../functions/web3/functionCal
|
|
|
21
21
|
import { ethers as g } from "ethers";
|
|
22
22
|
//#region libs/shared/common/src/data-structures/Hinkal/hinkalSolanaWithdraw.ts
|
|
23
23
|
var _ = async (e, t, n, r) => {
|
|
24
|
-
let
|
|
24
|
+
let i = [...await c(e, t, n, r, 6)][0], a = o().toString(), { outputUtxos: s } = await l(e.userKeys, i, r[0], a);
|
|
25
25
|
return {
|
|
26
|
-
inputUtxos:
|
|
27
|
-
outputUtxos:
|
|
26
|
+
inputUtxos: i,
|
|
27
|
+
outputUtxos: s
|
|
28
28
|
};
|
|
29
|
-
}, v = async (
|
|
30
|
-
let S =
|
|
29
|
+
}, v = async (o, c, l, v, y, b, x) => {
|
|
30
|
+
let S = s(c), C = c.map((e) => e.erc20TokenAddress), w = c[0];
|
|
31
31
|
if (!w) throw Error("Solana Withdraw: No Token Found");
|
|
32
32
|
let { originalDeployer: T } = e[S].contractData;
|
|
33
33
|
if (!T) throw Error("missing data");
|
|
34
|
-
let { userKeys: E, merkleTreeHinkalByChain: D } =
|
|
35
|
-
|
|
36
|
-
let [A, { inputUtxos: j, outputUtxos: M }] = await Promise.all([
|
|
34
|
+
let { userKeys: E, merkleTreeHinkalByChain: D } = o, O = b ?? await f(S, y, C, i.Transact), k = await p(S, w, -l[0], O);
|
|
35
|
+
l[0] -= k.flatFee;
|
|
36
|
+
let [A, { inputUtxos: j, outputUtxos: M }] = await Promise.all([o.getRandomRelay(S, !0), _(o, S, C, l)]);
|
|
37
37
|
if (!A) throw Error(t.RELAYER_NOT_AVAILABLE);
|
|
38
38
|
if (C.length > 1) throw Error("Solana Withdraw: Only one mint address is supported");
|
|
39
|
-
let N = r.findCorrectRandomization(n(31),
|
|
39
|
+
let N = r.findCorrectRandomization(n(31), o.userKeys.getShieldedPrivateKey()), P = {
|
|
40
40
|
tokenNumber: C.length,
|
|
41
41
|
nullifierAmount: j.length,
|
|
42
42
|
outputAmount: M.length
|
|
43
|
-
}, F =
|
|
44
|
-
d([j], [M],
|
|
45
|
-
let { proofAArr: L, proofBArr: R, proofCArr: z, publicInputsArr: B, commitmentValidationData: V } = await m(
|
|
43
|
+
}, F = a([M])[0][0], I = Array.from(g.getBytes(F));
|
|
44
|
+
d([j], [M], l);
|
|
45
|
+
let { proofAArr: L, proofBArr: R, proofCArr: z, publicInputsArr: B, commitmentValidationData: V } = await m(o.generateProofRemotely, D[S], E, [C[0]], [j], [M], N, k.flatFee, k.variableRate, v, A, P, [I], S), H = {
|
|
46
46
|
recipient: v,
|
|
47
47
|
mint: C[0] === "11111111111111111111111111111111" ? void 0 : C[0]
|
|
48
48
|
};
|
|
@@ -61,7 +61,7 @@ var _ = async (e, t, n, r) => {
|
|
|
61
61
|
},
|
|
62
62
|
accounts: H,
|
|
63
63
|
commitmentValidationData: V,
|
|
64
|
-
adminData: u(x, S, C,
|
|
64
|
+
adminData: u(x, S, C, l, await o.getEthereumAddress())
|
|
65
65
|
});
|
|
66
66
|
};
|
|
67
67
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../../constants/chains.constants.cjs`),t=require(`../../constants/protocol.constants.cjs`),n=require(`../../error-handling/error-codes.constants.cjs`),r=require(`../../
|
|
1
|
+
const e=require(`../../constants/chains.constants.cjs`),t=require(`../../constants/protocol.constants.cjs`),n=require(`../../error-handling/error-codes.constants.cjs`),r=require(`../../types/external-action.types.cjs`),i=require(`../../functions/utils/time.utils.cjs`),a=require(`../../functions/utils/addresses.cjs`),o=require(`../../functions/utils/tron.utils.cjs`),s=require(`../../functions/utils/token-check.utils.cjs`),c=require(`../../functions/web3/events/getShieldedBalance.cjs`),l=require(`../../functions/pre-transaction/outputUtxoProcessing.cjs`),u=require(`../../functions/pre-transaction/getVolatileTransferAmount.cjs`),d=require(`../../functions/pre-transaction/constructAdminData.cjs`),f=require(`../../functions/pre-transaction/getFeeStructure.cjs`);require(`../../functions/pre-transaction/index.cjs`);const p=require(`../../functions/utils/fees.utils.cjs`),m=require(`../../functions/snarkjs/constructGeneralZkProof.cjs`),h=require(`../../functions/web3/functionCalls/transactCallRelayer.cjs`),g=require(`../../functions/pre-transaction/merge-with-fee-structure.cjs`);var _=async(e,t,n,r,a,o)=>{let s=[...await c.addPaddingToUtxos(e,t,n,r)],u=[],d=i.getCurrentTimeInSeconds().toString();for(let t=0;t<n.length;t+=1){let{outputUtxos:n}=await l.outputUtxoProcessing(e.userKeys,s[t],r[t],d,!0,a,t===0?o:0n);u.push(n)}return{inputUtxosArray:s,outputUtxosArray:u}},v=async(i,c,l,v,y,b,x)=>{let S=s.validateAndGetChainId(c),C=e.isTronLike(S);if(!a.isValidPrivateAddress(v))throw Error(n.transactionErrorCodes.RECIPIENT_FORMAT_INCORRECT);let w=o.addressToHexFormat(await i.getEthereumAddressByChain(S)),T=c.map(e=>e.erc20TokenAddress),E=await u.modifyVolatileTokenAmountChanges(S,c,l),D=b??await f.getFeeStructure(S,y,T,r.ExternalActionId.Transact,[],5n);D.variableRate||=t.HINKAL_PRIVATE_SEND_VARIABLE_RATE;let O=c[0];if(!O)throw Error(`Transfer Action: No Token Found`);let k=-E[0],A=await p.calculateModifiedFeeStructure(S,O,k,D);await g.mergeWithFeeStructure(S,T,E,A);let[j,{inputUtxosArray:M,outputUtxosArray:N}]=await Promise.all([i.getRandomRelay(S,!0),_(i,S,T,E,v,k)]);if(!j)throw Error(n.transactionErrorCodes.RELAYER_NOT_AVAILABLE);let P={externalActionId:0n,externalAddress:j,externalActionMetadata:`0x00`},{zkCallData:F,circomData:I,dimData:L,commitmentValidationData:R}=await m.constructZkProof(i.merkleTreeHinkalByChain[S],M,N,i.userKeys,P.externalActionId,P.externalAddress,P.externalActionMetadata,i.generateProofRemotely,A,j,S),z=await o.reorderZkCallData(C,F,L,I);return await h.transactCallRelayer(S,F,L,I,R,void 0,void 0,d.constructAdminData(x,S,T,E,w),z)};exports.hinkalTransfer=v;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { isTronLike as e } from "../../constants/chains.constants.mjs";
|
|
2
2
|
import { HINKAL_PRIVATE_SEND_VARIABLE_RATE as t } from "../../constants/protocol.constants.mjs";
|
|
3
3
|
import { transactionErrorCodes as n } from "../../error-handling/error-codes.constants.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { ExternalActionId as r } from "../../types/external-action.types.mjs";
|
|
5
|
+
import { getCurrentTimeInSeconds as i } from "../../functions/utils/time.utils.mjs";
|
|
6
6
|
import { isValidPrivateAddress as a } from "../../functions/utils/addresses.mjs";
|
|
7
7
|
import { addressToHexFormat as o, reorderZkCallData as s } from "../../functions/utils/tron.utils.mjs";
|
|
8
8
|
import { validateAndGetChainId as c } from "../../functions/utils/token-check.utils.mjs";
|
|
@@ -17,32 +17,32 @@ import { constructZkProof as h } from "../../functions/snarkjs/constructGeneralZ
|
|
|
17
17
|
import { transactCallRelayer as g } from "../../functions/web3/functionCalls/transactCallRelayer.mjs";
|
|
18
18
|
import { mergeWithFeeStructure as _ } from "../../functions/pre-transaction/merge-with-fee-structure.mjs";
|
|
19
19
|
//#region libs/shared/common/src/data-structures/Hinkal/hinkalTransfer.ts
|
|
20
|
-
var v = async (e, t, n,
|
|
21
|
-
let s = [...await l(e, t, n,
|
|
20
|
+
var v = async (e, t, n, r, a, o) => {
|
|
21
|
+
let s = [...await l(e, t, n, r)], c = [], d = i().toString();
|
|
22
22
|
for (let t = 0; t < n.length; t += 1) {
|
|
23
|
-
let { outputUtxos: n } = await u(e.userKeys, s[t],
|
|
23
|
+
let { outputUtxos: n } = await u(e.userKeys, s[t], r[t], d, !0, a, t === 0 ? o : 0n);
|
|
24
24
|
c.push(n);
|
|
25
25
|
}
|
|
26
26
|
return {
|
|
27
27
|
inputUtxosArray: s,
|
|
28
28
|
outputUtxosArray: c
|
|
29
29
|
};
|
|
30
|
-
}, y = async (
|
|
30
|
+
}, y = async (i, l, u, y, b, x, S) => {
|
|
31
31
|
let C = c(l), w = e(C);
|
|
32
32
|
if (!a(y)) throw Error(n.RECIPIENT_FORMAT_INCORRECT);
|
|
33
|
-
let T = o(await
|
|
33
|
+
let T = o(await i.getEthereumAddressByChain(C)), E = l.map((e) => e.erc20TokenAddress), D = await d(C, l, u), O = x ?? await p(C, b, E, r.Transact, [], 5n);
|
|
34
34
|
O.variableRate ||= t;
|
|
35
35
|
let k = l[0];
|
|
36
36
|
if (!k) throw Error("Transfer Action: No Token Found");
|
|
37
37
|
let A = -D[0], j = await m(C, k, A, O);
|
|
38
38
|
await _(C, E, D, j);
|
|
39
|
-
let [M, { inputUtxosArray: N, outputUtxosArray: P }] = await Promise.all([
|
|
39
|
+
let [M, { inputUtxosArray: N, outputUtxosArray: P }] = await Promise.all([i.getRandomRelay(C, !0), v(i, C, E, D, y, A)]);
|
|
40
40
|
if (!M) throw Error(n.RELAYER_NOT_AVAILABLE);
|
|
41
41
|
let F = {
|
|
42
42
|
externalActionId: 0n,
|
|
43
43
|
externalAddress: M,
|
|
44
44
|
externalActionMetadata: "0x00"
|
|
45
|
-
}, { zkCallData: I, circomData: L, dimData: R, commitmentValidationData: z } = await h(
|
|
45
|
+
}, { zkCallData: I, circomData: L, dimData: R, commitmentValidationData: z } = await h(i.merkleTreeHinkalByChain[C], N, P, i.userKeys, F.externalActionId, F.externalAddress, F.externalActionMetadata, i.generateProofRemotely, j, M, C), B = await s(w, I, R, L);
|
|
46
46
|
return await g(C, I, R, L, z, void 0, void 0, f(S, C, E, D, T), B);
|
|
47
47
|
};
|
|
48
48
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../../constants/chains.constants.cjs`),t=require(`../../constants/protocol.constants.cjs`),n=require(`../../types/hinkal.types.cjs`),r=require(`../../error-handling/error-codes.constants.cjs`),i=require(`../../
|
|
1
|
+
const e=require(`../../constants/chains.constants.cjs`),t=require(`../../constants/protocol.constants.cjs`),n=require(`../../types/hinkal.types.cjs`),r=require(`../../error-handling/error-codes.constants.cjs`),i=require(`../../types/external-action.types.cjs`),a=require(`../../functions/utils/time.utils.cjs`),o=require(`../../functions/utils/tron.utils.cjs`),s=require(`../../functions/utils/hinkalTiming.utils.cjs`),c=require(`../../functions/utils/token-check.utils.cjs`),l=require(`../../functions/web3/events/getShieldedBalance.cjs`),u=require(`../../functions/pre-transaction/outputUtxoProcessing.cjs`),d=require(`../../functions/pre-transaction/getVolatileTransferAmount.cjs`),f=require(`../../functions/pre-transaction/constructAdminData.cjs`),p=require(`../../functions/pre-transaction/getFeeStructure.cjs`);require(`../../functions/pre-transaction/index.cjs`);const m=require(`../../functions/utils/fees.utils.cjs`),h=require(`../../functions/snarkjs/constructGeneralZkProof.cjs`),g=require(`../../functions/web3/functionCalls/transactCallDirect.cjs`),_=require(`../../functions/web3/functionCalls/transactCallRelayer.cjs`),v=require(`../../functions/web3/functionCalls/transactCallDirectTron.cjs`),y=require(`../../functions/pre-transaction/merge-with-fee-structure.cjs`);var b=async(e,t,n,r)=>{let i=[...await l.addPaddingToUtxos(e,t,n,r)],o=[],s=a.getCurrentTimeInSeconds().toString();for(let t=0;t<n.length;t+=1){let{outputUtxos:n}=await u.outputUtxoProcessing(e.userKeys,i[t],r[t],s);o.push(n)}return{inputUtxosArray:i,outputUtxosArray:o}},x=async(a,l,u,x,S,C,w,T)=>{let E=s.createRnDeltaTiming(`withdraw`),D=c.validateAndGetChainId(l),O=e.isTronLike(D),k=o.addressToHexFormat(await a.getEthereumAddressByChain(D));E.log(`wallet.getEthereumAddressByChain`);let A=l.map(e=>e.erc20TokenAddress),j=await d.modifyVolatileTokenAmountChanges(D,l,u),M=l[0];if(!M)throw Error(`Deposit Action: No Token Found`);let N;if(!S){let e=w??await p.getFeeStructure(D,C,A,i.ExternalActionId.Transact);N=await m.calculateModifiedFeeStructure(D,M,-j[0],e),await y.mergeWithFeeStructure(D,A,j,N)}let P={externalActionId:0n,externalAddress:o.addressToHexFormat(x),externalActionMetadata:`0x00`},[F,{inputUtxosArray:I,outputUtxosArray:L}]=await Promise.all([a.getRandomRelay(D,!0),b(a,D,A,j)]);if(E.log(`utxoPrep+relay`,{hasRelay:!!F}),!S&&!F)throw Error(r.transactionErrorCodes.RELAYER_NOT_AVAILABLE);let{zkCallData:R,circomData:z,dimData:B,commitmentValidationData:V}=await h.constructZkProof(a.merkleTreeHinkalByChain[D],I,L,a.userKeys,P.externalActionId,P.externalAddress,P.externalActionMetadata,a.generateProofRemotely,N??n.zeroFeeStructure,S?t.zeroAddress:F,D,void 0,void 0,S?k:void 0);E.log(`constructZkProof`);let H=O&&S?void 0:await o.reorderZkCallData(O,R,B,z);if(S){if(!M)throw Error(`Withdraw Action: No Token Found`);if(O){let e=await v.transactCallDirectTron(a,D,j[0],M,R,z,B);return E.log(`done`,{txid:e}),e}let e=await g.transactCallDirect(a,D,j[0],M,R,z,B);return E.log(`done`,{txHash:e.hash}),e}let U=await _.transactCallRelayer(D,R,B,z,V,void 0,void 0,f.constructAdminData(T,D,A,j,k),H);return E.log(`done`,{txHash:U}),U};exports.hinkalWithdraw=x;
|
|
@@ -2,8 +2,8 @@ import { isTronLike as e } from "../../constants/chains.constants.mjs";
|
|
|
2
2
|
import { zeroAddress as t } from "../../constants/protocol.constants.mjs";
|
|
3
3
|
import { zeroFeeStructure as n } from "../../types/hinkal.types.mjs";
|
|
4
4
|
import { transactionErrorCodes as r } from "../../error-handling/error-codes.constants.mjs";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { ExternalActionId as i } from "../../types/external-action.types.mjs";
|
|
6
|
+
import { getCurrentTimeInSeconds as a } from "../../functions/utils/time.utils.mjs";
|
|
7
7
|
import { addressToHexFormat as o, reorderZkCallData as s } from "../../functions/utils/tron.utils.mjs";
|
|
8
8
|
import { createRnDeltaTiming as c } from "../../functions/utils/hinkalTiming.utils.mjs";
|
|
9
9
|
import { validateAndGetChainId as l } from "../../functions/utils/token-check.utils.mjs";
|
|
@@ -21,41 +21,41 @@ import { transactCallDirectTron as y } from "../../functions/web3/functionCalls/
|
|
|
21
21
|
import { mergeWithFeeStructure as b } from "../../functions/pre-transaction/merge-with-fee-structure.mjs";
|
|
22
22
|
//#region libs/shared/common/src/data-structures/Hinkal/hinkalWithdraw.ts
|
|
23
23
|
var x = async (e, t, n, r) => {
|
|
24
|
-
let
|
|
24
|
+
let i = [...await u(e, t, n, r)], o = [], s = a().toString();
|
|
25
25
|
for (let t = 0; t < n.length; t += 1) {
|
|
26
|
-
let { outputUtxos: n } = await d(e.userKeys,
|
|
26
|
+
let { outputUtxos: n } = await d(e.userKeys, i[t], r[t], s);
|
|
27
27
|
o.push(n);
|
|
28
28
|
}
|
|
29
29
|
return {
|
|
30
|
-
inputUtxosArray:
|
|
30
|
+
inputUtxosArray: i,
|
|
31
31
|
outputUtxosArray: o
|
|
32
32
|
};
|
|
33
|
-
}, S = async (
|
|
34
|
-
let D = c("withdraw"), O = l(u), k = e(O), A = o(await
|
|
33
|
+
}, S = async (a, u, d, S, C, w, T, E) => {
|
|
34
|
+
let D = c("withdraw"), O = l(u), k = e(O), A = o(await a.getEthereumAddressByChain(O));
|
|
35
35
|
D.log("wallet.getEthereumAddressByChain");
|
|
36
36
|
let j = u.map((e) => e.erc20TokenAddress), M = await f(O, u, d), N = u[0];
|
|
37
37
|
if (!N) throw Error("Deposit Action: No Token Found");
|
|
38
38
|
let P;
|
|
39
39
|
if (!C) {
|
|
40
|
-
let e = T ?? await m(O, w, j,
|
|
40
|
+
let e = T ?? await m(O, w, j, i.Transact);
|
|
41
41
|
P = await h(O, N, -M[0], e), await b(O, j, M, P);
|
|
42
42
|
}
|
|
43
43
|
let F = {
|
|
44
44
|
externalActionId: 0n,
|
|
45
45
|
externalAddress: o(S),
|
|
46
46
|
externalActionMetadata: "0x00"
|
|
47
|
-
}, [I, { inputUtxosArray: L, outputUtxosArray: R }] = await Promise.all([
|
|
47
|
+
}, [I, { inputUtxosArray: L, outputUtxosArray: R }] = await Promise.all([a.getRandomRelay(O, !0), x(a, O, j, M)]);
|
|
48
48
|
if (D.log("utxoPrep+relay", { hasRelay: !!I }), !C && !I) throw Error(r.RELAYER_NOT_AVAILABLE);
|
|
49
|
-
let { zkCallData: z, circomData: B, dimData: V, commitmentValidationData: H } = await g(
|
|
49
|
+
let { zkCallData: z, circomData: B, dimData: V, commitmentValidationData: H } = await g(a.merkleTreeHinkalByChain[O], L, R, a.userKeys, F.externalActionId, F.externalAddress, F.externalActionMetadata, a.generateProofRemotely, P ?? n, C ? t : I, O, void 0, void 0, C ? A : void 0);
|
|
50
50
|
D.log("constructZkProof");
|
|
51
51
|
let U = k && C ? void 0 : await s(k, z, V, B);
|
|
52
52
|
if (C) {
|
|
53
53
|
if (!N) throw Error("Withdraw Action: No Token Found");
|
|
54
54
|
if (k) {
|
|
55
|
-
let e = await y(
|
|
55
|
+
let e = await y(a, O, M[0], N, z, B, V);
|
|
56
56
|
return D.log("done", { txid: e }), e;
|
|
57
57
|
}
|
|
58
|
-
let e = await _(
|
|
58
|
+
let e = await _(a, O, M[0], N, z, B, V);
|
|
59
59
|
return D.log("done", { txHash: e.hash }), e;
|
|
60
60
|
}
|
|
61
61
|
let W = await v(O, z, V, B, H, void 0, void 0, p(E, O, j, M, A), U);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../constants/chains.constants.cjs`);require(`../../constants/protocol.constants.cjs`);const t=require(`../../functions/utils/amounts.utils.cjs`),n=require(`../../error-handling/error-codes.constants.cjs`),r=require(`../../functions/web3/etherFunctions.cjs`),i=require(`../crypto-keys/keys.cjs`),a=require(`../../
|
|
1
|
+
require(`../../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../constants/chains.constants.cjs`);require(`../../constants/protocol.constants.cjs`);const t=require(`../../functions/utils/amounts.utils.cjs`),n=require(`../../error-handling/error-codes.constants.cjs`),r=require(`../../functions/web3/etherFunctions.cjs`),i=require(`../crypto-keys/keys.cjs`),a=require(`../../types/external-action.types.cjs`),o=require(`../../functions/snarkjs/common.snarkjs.cjs`),s=require(`../../functions/utils/time.utils.cjs`),c=require(`../../functions/utils/encodeTokenWithId.cjs`),l=require(`../../functions/utils/tron.utils.cjs`),u=require(`../../functions/web3/events/getInputUtxoAndBalance.cjs`),d=require(`../../functions/utils/token-check.utils.cjs`),f=require(`../../functions/web3/events/getShieldedBalance.cjs`),p=require(`../../functions/pre-transaction/outputUtxoProcessing.cjs`),m=require(`../../functions/pre-transaction/getFeeStructure.cjs`),h=require(`../../constants/tx-confirmation.constants.cjs`),g=require(`../../functions/utils/tx-confirmation.utils.cjs`),_=require(`../../functions/snarkjs/constructGeneralZkProof.cjs`),v=require(`../../functions/snarkjs/constructSolanaZkProof.cjs`),y=require(`../../functions/web3/functionCalls/transactCallRelayer.cjs`),b=require(`../../functions/pre-transaction/merge-with-fee-structure.cjs`);let x=require(`ethers`);var S=async(e,t,n,r)=>{let i=[...await f.addPaddingToUtxos(e,t,n,r,void 0,void 0,!1,!0)],a=[],o=s.getCurrentTimeInSeconds().toString();for(let t=0;t<n.length;t+=1){let{outputUtxos:n}=await p.outputUtxoProcessing(e.userKeys,i[t],r[t],o);a.push(n)}return{inputUtxosArray:i,outputUtxosArray:a}},C=async(e,t,n,r)=>{let i=[...await f.addPaddingToUtxos(e,t,n,r,6,void 0,!1,!0)][0],a=s.getCurrentTimeInSeconds().toString(),{outputUtxos:o}=await p.outputUtxoProcessing(e.userKeys,i,r[0],a);return{inputUtxos:i,outputUtxos:o}},w=async(t,r,i,o,s)=>{let c=e.isTronLike(r),u=[i.erc20TokenAddress],d=i.erc20TokenAddress,[f,p]=await Promise.all([m.getFeeStructure(r,d,u,a.ExternalActionId.Transact),t.getRandomRelay(r,!0)]);if(!p)throw Error(n.transactionErrorCodes.RELAYER_NOT_AVAILABLE);let h=l.addressToHexFormat(s),g=o-f.flatFee;if(g<=0n)throw Error(`Insufficient balance to cover fee. Balance: ${o}, Fee: ${f.flatFee}`);let v=[-g];await b.mergeWithFeeStructure(r,u,v,f);let x={externalActionId:0n,externalAddress:h,externalActionMetadata:`0x00`},{inputUtxosArray:C,outputUtxosArray:w}=await S(t,r,u,v),{zkCallData:T,circomData:E,dimData:D,commitmentValidationData:O}=await _.constructZkProof(t.merkleTreeHinkalByChain[r],C,w,t.userKeys,x.externalActionId,x.externalAddress,x.externalActionMetadata,t.generateProofRemotely,f,p,r);return{tx:await y.transactCallRelayer(r,T,D,E,O,void 0,void 0,void 0,await l.reorderZkCallData(c,T,D,E)),amountToRecipient:g}},T=async(t,s,c,l,u,d)=>{let f=[c.erc20TokenAddress],{originalDeployer:p}=e.networkRegistry[s].contractData;if(!p)throw Error(`missing data`);let{userKeys:h,merkleTreeHinkalByChain:g}=t,_=c.erc20TokenAddress,[b,S]=await Promise.all([m.getFeeStructure(s,_,f,a.ExternalActionId.Transact,void 0,void 0,{mintTo:f[0],recipient:u,nullifierCount:d}),t.getRandomRelay(s,!0)]);if(!S)throw Error(n.transactionErrorCodes.RELAYER_NOT_AVAILABLE);let w=l-b.flatFee;if(w<=0n)throw Error(`Insufficient balance to cover fee. Balance: ${l}, Fee: ${b.flatFee}`);let T=[-w];T[0]-=b.flatFee;let{inputUtxos:E,outputUtxos:D}=await C(t,s,f,T),O=i.UserKeys.findCorrectRandomization(r.randomBigInt(31),t.userKeys.getShieldedPrivateKey()),k={tokenNumber:f.length,nullifierAmount:E.length,outputAmount:D.length},A=o.calcEncryptedOutputs([D])[0][0],j=Array.from(x.ethers.getBytes(A)),{proofAArr:M,proofBArr:N,proofCArr:P,publicInputsArr:F,commitmentValidationData:I}=await v.constructSolanaZkProof(t.generateProofRemotely,g[s],h,[f[0]],[E],[D],O,b.flatFee,b.variableRate,u,S,k,[j],s),L={recipient:u,mint:f[0]===`11111111111111111111111111111111`?void 0:f[0]};return{tx:await y.solanaTransactCallRelayer({chainId:s,relayAddress:S,functionName:`transact`,args:{proofAArr:M,proofBArr:N,proofCArr:P,publicInputsArr:F,encryptedOutputs:[j],relayerFee:b.flatFee.toString(),dimensions:k},accounts:L,commitmentValidationData:I}),amountToRecipient:w}},E=async(t,n,r,i,a,o)=>e.isSolanaLike(n)?T(t,n,r,i,a,o):w(t,n,r,i,a),D=async(e,n,r)=>{let i=[],a=d.validateAndGetChainId([n]),o=c.encodeTokenWithId(a,{erc20TokenAddress:n.erc20TokenAddress,tokenId:0});for(;;){await e.resetMerkleTreesIfNecessary([a]);let s=((await u.getInputUtxoAndBalancePerToken({hinkal:e,sliceIfMore6:!1,useBlockedUtxos:!0,chainId:a,allowRemoteDecryption:e.generateProofRemotely}))?.get(o)??[]).filter(e=>e.amount>0n).sort((e,t)=>Number(t.amount-e.amount)).slice(0,6),c=t.countTotalAmountInUtxos(s);if(!c)break;let{tx:l}=await E(e,a,n,c,r,s.length);await g.waitForTransactionConfirmation(a,l,{solanaCommitment:`finalized`,evmTimeoutMs:h.RELAYER_TX_CONFIRMATION_TIMEOUT}),i.push(l)}return i};exports.hinkalWithdrawStuckUtxos=D;
|
|
@@ -4,15 +4,15 @@ import { countTotalAmountInUtxos as r } from "../../functions/utils/amounts.util
|
|
|
4
4
|
import { transactionErrorCodes as i } from "../../error-handling/error-codes.constants.mjs";
|
|
5
5
|
import { randomBigInt as a } from "../../functions/web3/etherFunctions.mjs";
|
|
6
6
|
import { UserKeys as o } from "../crypto-keys/keys.mjs";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
7
|
+
import { ExternalActionId as s } from "../../types/external-action.types.mjs";
|
|
8
|
+
import { calcEncryptedOutputs as c } from "../../functions/snarkjs/common.snarkjs.mjs";
|
|
9
|
+
import { getCurrentTimeInSeconds as l } from "../../functions/utils/time.utils.mjs";
|
|
10
|
+
import { encodeTokenWithId as u } from "../../functions/utils/encodeTokenWithId.mjs";
|
|
11
|
+
import { addressToHexFormat as d, reorderZkCallData as f } from "../../functions/utils/tron.utils.mjs";
|
|
12
|
+
import { getInputUtxoAndBalancePerToken as p } from "../../functions/web3/events/getInputUtxoAndBalance.mjs";
|
|
13
|
+
import { validateAndGetChainId as m } from "../../functions/utils/token-check.utils.mjs";
|
|
14
|
+
import { addPaddingToUtxos as h } from "../../functions/web3/events/getShieldedBalance.mjs";
|
|
15
|
+
import { outputUtxoProcessing as g } from "../../functions/pre-transaction/outputUtxoProcessing.mjs";
|
|
16
16
|
import { getFeeStructure as _ } from "../../functions/pre-transaction/getFeeStructure.mjs";
|
|
17
17
|
import { RELAYER_TX_CONFIRMATION_TIMEOUT as v } from "../../constants/tx-confirmation.constants.mjs";
|
|
18
18
|
import { waitForTransactionConfirmation as y } from "../../functions/utils/tx-confirmation.utils.mjs";
|
|
@@ -23,9 +23,9 @@ import { mergeWithFeeStructure as w } from "../../functions/pre-transaction/merg
|
|
|
23
23
|
import { ethers as T } from "ethers";
|
|
24
24
|
//#region libs/shared/common/src/data-structures/Hinkal/hinkalWithdrawStuckUtxos.ts
|
|
25
25
|
var E = async (e, t, n, r) => {
|
|
26
|
-
let i = [...await
|
|
26
|
+
let i = [...await h(e, t, n, r, void 0, void 0, !1, !0)], a = [], o = l().toString();
|
|
27
27
|
for (let t = 0; t < n.length; t += 1) {
|
|
28
|
-
let { outputUtxos: n } = await
|
|
28
|
+
let { outputUtxos: n } = await g(e.userKeys, i[t], r[t], o);
|
|
29
29
|
a.push(n);
|
|
30
30
|
}
|
|
31
31
|
return {
|
|
@@ -33,47 +33,47 @@ var E = async (e, t, n, r) => {
|
|
|
33
33
|
outputUtxosArray: a
|
|
34
34
|
};
|
|
35
35
|
}, D = async (e, t, n, r) => {
|
|
36
|
-
let i = [...await
|
|
36
|
+
let i = [...await h(e, t, n, r, 6, void 0, !1, !0)][0], a = l().toString(), { outputUtxos: o } = await g(e.userKeys, i, r[0], a);
|
|
37
37
|
return {
|
|
38
38
|
inputUtxos: i,
|
|
39
39
|
outputUtxos: o
|
|
40
40
|
};
|
|
41
41
|
}, O = async (e, n, r, a, o) => {
|
|
42
|
-
let
|
|
42
|
+
let c = t(n), l = [r.erc20TokenAddress], u = r.erc20TokenAddress, [p, m] = await Promise.all([_(n, u, l, s.Transact), e.getRandomRelay(n, !0)]);
|
|
43
43
|
if (!m) throw Error(i.RELAYER_NOT_AVAILABLE);
|
|
44
|
-
let h =
|
|
44
|
+
let h = d(o), g = a - p.flatFee;
|
|
45
45
|
if (g <= 0n) throw Error(`Insufficient balance to cover fee. Balance: ${a}, Fee: ${p.flatFee}`);
|
|
46
46
|
let v = [-g];
|
|
47
|
-
await w(n,
|
|
47
|
+
await w(n, l, v, p);
|
|
48
48
|
let y = {
|
|
49
49
|
externalActionId: 0n,
|
|
50
50
|
externalAddress: h,
|
|
51
51
|
externalActionMetadata: "0x00"
|
|
52
|
-
}, { inputUtxosArray: x, outputUtxosArray: S } = await E(e, n,
|
|
52
|
+
}, { inputUtxosArray: x, outputUtxosArray: S } = await E(e, n, l, v), { zkCallData: T, circomData: D, dimData: O, commitmentValidationData: k } = await b(e.merkleTreeHinkalByChain[n], x, S, e.userKeys, y.externalActionId, y.externalAddress, y.externalActionMetadata, e.generateProofRemotely, p, m, n);
|
|
53
53
|
return {
|
|
54
|
-
tx: await C(n, T, O, D, k, void 0, void 0, void 0, await
|
|
54
|
+
tx: await C(n, T, O, D, k, void 0, void 0, void 0, await f(c, T, O, D)),
|
|
55
55
|
amountToRecipient: g
|
|
56
56
|
};
|
|
57
|
-
}, k = async (e, t, r,
|
|
58
|
-
let
|
|
59
|
-
if (!
|
|
60
|
-
let { userKeys:
|
|
61
|
-
mintTo:
|
|
62
|
-
recipient:
|
|
63
|
-
nullifierCount:
|
|
57
|
+
}, k = async (e, t, r, l, u, d) => {
|
|
58
|
+
let f = [r.erc20TokenAddress], { originalDeployer: p } = n[t].contractData;
|
|
59
|
+
if (!p) throw Error("missing data");
|
|
60
|
+
let { userKeys: m, merkleTreeHinkalByChain: h } = e, g = r.erc20TokenAddress, [v, y] = await Promise.all([_(t, g, f, s.Transact, void 0, void 0, {
|
|
61
|
+
mintTo: f[0],
|
|
62
|
+
recipient: u,
|
|
63
|
+
nullifierCount: d
|
|
64
64
|
}), e.getRandomRelay(t, !0)]);
|
|
65
65
|
if (!y) throw Error(i.RELAYER_NOT_AVAILABLE);
|
|
66
|
-
let b =
|
|
67
|
-
if (b <= 0n) throw Error(`Insufficient balance to cover fee. Balance: ${
|
|
66
|
+
let b = l - v.flatFee;
|
|
67
|
+
if (b <= 0n) throw Error(`Insufficient balance to cover fee. Balance: ${l}, Fee: ${v.flatFee}`);
|
|
68
68
|
let C = [-b];
|
|
69
69
|
C[0] -= v.flatFee;
|
|
70
|
-
let { inputUtxos: w, outputUtxos: E } = await D(e, t,
|
|
71
|
-
tokenNumber:
|
|
70
|
+
let { inputUtxos: w, outputUtxos: E } = await D(e, t, f, C), O = o.findCorrectRandomization(a(31), e.userKeys.getShieldedPrivateKey()), k = {
|
|
71
|
+
tokenNumber: f.length,
|
|
72
72
|
nullifierAmount: w.length,
|
|
73
73
|
outputAmount: E.length
|
|
74
|
-
}, A =
|
|
75
|
-
recipient:
|
|
76
|
-
mint:
|
|
74
|
+
}, A = c([E])[0][0], j = Array.from(T.getBytes(A)), { proofAArr: M, proofBArr: N, proofCArr: P, publicInputsArr: F, commitmentValidationData: I } = await x(e.generateProofRemotely, h[t], m, [f[0]], [w], [E], O, v.flatFee, v.variableRate, u, y, k, [j], t), L = {
|
|
75
|
+
recipient: u,
|
|
76
|
+
mint: f[0] === "11111111111111111111111111111111" ? void 0 : f[0]
|
|
77
77
|
};
|
|
78
78
|
return {
|
|
79
79
|
tx: await S({
|
|
@@ -95,13 +95,13 @@ var E = async (e, t, n, r) => {
|
|
|
95
95
|
amountToRecipient: b
|
|
96
96
|
};
|
|
97
97
|
}, A = async (t, n, r, i, a, o) => e(n) ? k(t, n, r, i, a, o) : O(t, n, r, i, a), j = async (e, t, n) => {
|
|
98
|
-
let i = [], a =
|
|
98
|
+
let i = [], a = m([t]), o = u(a, {
|
|
99
99
|
erc20TokenAddress: t.erc20TokenAddress,
|
|
100
100
|
tokenId: 0
|
|
101
101
|
});
|
|
102
102
|
for (;;) {
|
|
103
103
|
await e.resetMerkleTreesIfNecessary([a]);
|
|
104
|
-
let s = ((await
|
|
104
|
+
let s = ((await p({
|
|
105
105
|
hinkal: e,
|
|
106
106
|
sliceIfMore6: !1,
|
|
107
107
|
useBlockedUtxos: !0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../constants/chains.constants.cjs`),t=require(`../../crypto/poseidon.cjs`);require(`./keys.cjs`);const n=require(
|
|
1
|
+
require(`../../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../constants/chains.constants.cjs`),t=require(`../../crypto/poseidon.cjs`);require(`./keys.cjs`);const n=require(`../../functions/utils/bit.operations.cjs`),r=require(`../utxo/Utxo.cjs`);let i=require(`ethers`),a=require(`@solana/web3.js`);var o=`solana-on-chain-utxo:`,s=8,c=e=>{if(e.length!==s)throw Error(`Expected ${s} on-chain fields, received ${e.length}`);let t=e.map((e,t)=>{let n=e instanceof Uint8Array?e:Uint8Array.from(e);if(n.length!==32)throw Error(`Expected bytes32 length 32 at position ${t}, got ${n.length}`);return`0x${Buffer.from(n).toString(`hex`)}`});return`${o}${i.ethers.AbiCoder.defaultAbiCoder().encode([`bytes32[8]`],[t])}`},l=e=>e.startsWith(o),u=e=>{if(!l(e))throw Error(`Invalid encoded Solana UTXO payload`);let[r]=i.ethers.AbiCoder.defaultAbiCoder().decode([`bytes32[8]`],e.slice(21)),o=r;if(!Array.isArray(o)||o.length!==s)throw Error(`Malformed encoded Solana UTXO payload`);let[c,u,d,f,p,m,h,g]=o,_=BigInt(c),v=BigInt(f),y=n.extractHighestBit(v)===1n,b=n.takeOffHighestBit(v),x=i.ethers.toBeHex(BigInt(p)),S=BigInt(m),C=BigInt(h),w=BigInt(g).toString(),T=Array.from(i.ethers.getBytes(u)),E=Array.from(i.ethers.getBytes(d)),D=new a.PublicKey(Uint8Array.from([...T.slice(16),...E.slice(16)])).toBase58();return{amount:_,erc20TokenAddress:t.poseidonHash(BigInt(u),BigInt(d)),mintAddress:D,randomization:b,stealthAddress:x,H0:S,H1:C,timeStamp:w,isNewStyle:y}},d=e=>{let t=i.ethers.AbiCoder.defaultAbiCoder().decode([`uint256`,`address`,`tuple(uint256, uint256, uint256, uint256)`,`uint256`,`uint256`],e),r=BigInt(t[0]),a=t[1],o=BigInt(t[2][0]),s=n.extractHighestBit(o),c=n.takeOffHighestBit(o),l=i.ethers.toBeHex(BigInt(t[2][1])),u=BigInt(t[2][2]),d=BigInt(t[2][3]),f=BigInt(t[3]).toString(),p=Number(t[4]);return{amount:r,erc20TokenAddress:a,randomization:c,isNewStyle:s===1n,stealthAddress:l,H0:u,H1:d,timeStamp:f,tokenId:p}},f=(t,n,r)=>{if(e.isSolanaLike(r)){let{amount:e,erc20TokenAddress:r,mintAddress:i,randomization:a,stealthAddress:o,timeStamp:s,isNewStyle:c,H0:l}=u(t);return{amount:e,erc20TokenAddress:r,mintAddress:i,timeStamp:s,nullifyingKey:n,stealthAddress:o,isNewStyle:c,...c?{H0:[a,l]}:{randomization:a}}}let{amount:i,erc20TokenAddress:a,timeStamp:o,randomization:s,isNewStyle:c,stealthAddress:l,H0:f}=d(t);return{amount:i,erc20TokenAddress:a,timeStamp:o,nullifyingKey:n,stealthAddress:l,isNewStyle:c,...c?{H0:[s,f]}:{randomization:s}}},p=(e,t,n)=>new r.Utxo(f(e,t,n));exports.decodeEvmUtxo=d,exports.decodeSolanaUtxo=u,exports.decodeUtxo=p,exports.decodeUtxoConstructorArgs=f,exports.encodeSolanaOnChainUtxo=c,exports.isSolanaOnChainUtxo=l;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { isSolanaLike as e } from "../../constants/chains.constants.mjs";
|
|
2
2
|
import { poseidonHash as t } from "../../crypto/poseidon.mjs";
|
|
3
3
|
import "./keys.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { extractHighestBit as n, takeOffHighestBit as r } from "../../functions/utils/bit.operations.mjs";
|
|
5
|
+
import { Utxo as i } from "../utxo/Utxo.mjs";
|
|
6
6
|
import { ethers as a } from "ethers";
|
|
7
7
|
import { PublicKey as o } from "@solana/web3.js";
|
|
8
8
|
//#region libs/shared/common/src/data-structures/crypto-keys/decodeUTXO.ts
|
|
@@ -16,9 +16,9 @@ var s = "solana-on-chain-utxo:", c = 8, l = (e) => {
|
|
|
16
16
|
return `${s}${a.AbiCoder.defaultAbiCoder().encode(["bytes32[8]"], [t])}`;
|
|
17
17
|
}, u = (e) => e.startsWith(s), d = (e) => {
|
|
18
18
|
if (!u(e)) throw Error("Invalid encoded Solana UTXO payload");
|
|
19
|
-
let [
|
|
19
|
+
let [i] = a.AbiCoder.defaultAbiCoder().decode(["bytes32[8]"], e.slice(21)), s = i;
|
|
20
20
|
if (!Array.isArray(s) || s.length !== c) throw Error("Malformed encoded Solana UTXO payload");
|
|
21
|
-
let [l, d, f, p, m, h, g, _] = s, v = BigInt(l), y = BigInt(p), b =
|
|
21
|
+
let [l, d, f, p, m, h, g, _] = s, v = BigInt(l), y = BigInt(p), b = n(y) === 1n, x = r(y), S = a.toBeHex(BigInt(m)), C = BigInt(h), w = BigInt(g), T = BigInt(_).toString(), E = Array.from(a.getBytes(d)), D = Array.from(a.getBytes(f)), O = new o(Uint8Array.from([...E.slice(16), ...D.slice(16)])).toBase58();
|
|
22
22
|
return {
|
|
23
23
|
amount: v,
|
|
24
24
|
erc20TokenAddress: t(BigInt(d), BigInt(f)),
|
|
@@ -37,9 +37,9 @@ var s = "solana-on-chain-utxo:", c = 8, l = (e) => {
|
|
|
37
37
|
"tuple(uint256, uint256, uint256, uint256)",
|
|
38
38
|
"uint256",
|
|
39
39
|
"uint256"
|
|
40
|
-
], e),
|
|
40
|
+
], e), i = BigInt(t[0]), o = t[1], s = BigInt(t[2][0]), c = n(s), l = r(s), u = a.toBeHex(BigInt(t[2][1])), d = BigInt(t[2][2]), f = BigInt(t[2][3]), p = BigInt(t[3]).toString(), m = Number(t[4]);
|
|
41
41
|
return {
|
|
42
|
-
amount:
|
|
42
|
+
amount: i,
|
|
43
43
|
erc20TokenAddress: o,
|
|
44
44
|
randomization: l,
|
|
45
45
|
isNewStyle: c === 1n,
|
|
@@ -73,6 +73,6 @@ var s = "solana-on-chain-utxo:", c = 8, l = (e) => {
|
|
|
73
73
|
isNewStyle: c,
|
|
74
74
|
...c ? { H0: [s, u] } : { randomization: s }
|
|
75
75
|
};
|
|
76
|
-
}, m = (e, t,
|
|
76
|
+
}, m = (e, t, n) => new i(p(e, t, n));
|
|
77
77
|
//#endregion
|
|
78
78
|
export { f as decodeEvmUtxo, d as decodeSolanaUtxo, m as decodeUtxo, p as decodeUtxoConstructorArgs, l as encodeSolanaOnChainUtxo, u as isSolanaOnChainUtxo };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../../../../_virtual/_rolldown/runtime.cjs`),require(`./keys.cjs`)
|
|
1
|
+
require(`../../../../_virtual/_rolldown/runtime.cjs`),require(`./keys.cjs`);const e=require(`../../crypto/ecdh-sealed-keys.cjs`);require(`../../crypto/ecdh.cjs`),require(`../utxo/Utxo.cjs`);let t=require(`ethers`),n=require(`@solana/web3.js`);var r=e=>e.startsWith(`0x`)?e:`0x${e}`,i=54912,a=e=>Uint8Array.from([Math.floor(e/256),e%256]),o=o=>{let s=[Buffer.from(t.ethers.toBeHex(o.amount)),Buffer.from(r(o.erc20TokenAddress)),Buffer.from(t.ethers.toBeHex(o.randomization??0n)),Buffer.from(r(o.getStealthAddress())),Buffer.from(t.ethers.toBeHex(BigInt(o.timeStamp))),Buffer.from(t.ethers.toBeHex(o.isNewStyle?1n:0n)),Buffer.from(t.ethers.toBeHex(o.H0?.[0]??0n)),Buffer.from(t.ethers.toBeHex(o.H0?.[1]??0n))];if(o.mintAddress){let e=new n.PublicKey(o.mintAddress),r=t.ethers.hexlify(e.toBytes());s.push(Buffer.from(r))}let c=e.encryptSealedKeys(Buffer.concat(s),[o.getEncryptionKey()]);return Buffer.concat([Buffer.from(a(i)),Buffer.from(c)])};exports.encryptUtxo=o;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./keys.mjs";
|
|
2
|
-
import "../utxo/Utxo.mjs";
|
|
3
2
|
import { encryptSealedKeys as e } from "../../crypto/ecdh-sealed-keys.mjs";
|
|
4
3
|
import "../../crypto/ecdh.mjs";
|
|
4
|
+
import "../utxo/Utxo.mjs";
|
|
5
5
|
import { ethers as t } from "ethers";
|
|
6
6
|
import { PublicKey as n } from "@solana/web3.js";
|
|
7
7
|
//#region libs/shared/common/src/data-structures/crypto-keys/encryptDecryptUtxo.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`./utils/abi.utils.cjs`),require(`./utils/serialize.utils.cjs`),require(`./utils/caseInsensitive.utils.cjs`),require(`./utils/amounts.utils.cjs`),require(`./web3/etherFunctions.cjs`),require(`./utils/time.utils.cjs`),require(`./utils/upToDateState.cjs`),require(`./utils/cacheFunctions.cjs`),require(`./utils/enclaveHandshakeService.cjs`),require(`./utils/encryptInputForEnclave.cjs`),require(`./utils/solanaMint.utils.cjs`),require(`./utils/customEnclaveFunctionsRegister.cjs`),require(`./utils/addresses.cjs`),require(`./utils/tron.utils.cjs`),require(`./web3/events/getInputUtxoAndBalance.cjs`),require(`./utils/get-signature-header.cjs`),require(`./utils/auth.utils.cjs`),require(`./utils/string.utils.cjs`),require(`./utils/token-check.utils.cjs`),require(`./utils/map.utils.cjs`),require(`./utils/mutexes.utils.cjs`),require(`./utils/erc20tokenFunctions.cjs`),require(`./web3/events/getShieldedBalance.cjs`),require(`./pre-transaction/outputUtxoProcessing.cjs`),require(`./
|
|
1
|
+
require(`./utils/abi.utils.cjs`),require(`./utils/serialize.utils.cjs`),require(`./utils/caseInsensitive.utils.cjs`),require(`./utils/amounts.utils.cjs`),require(`./web3/etherFunctions.cjs`),require(`./utils/external-action.utils.cjs`),require(`./utils/bit.operations.cjs`),require(`./snarkjs/common.snarkjs.cjs`),require(`./utils/time.utils.cjs`),require(`./utils/upToDateState.cjs`),require(`./utils/cacheFunctions.cjs`),require(`./utils/enclaveHandshakeService.cjs`),require(`./utils/encryptInputForEnclave.cjs`),require(`./utils/solanaMint.utils.cjs`),require(`./utils/customEnclaveFunctionsRegister.cjs`),require(`./utils/addresses.cjs`),require(`./utils/tron.utils.cjs`),require(`./web3/events/getInputUtxoAndBalance.cjs`),require(`./utils/get-signature-header.cjs`),require(`./utils/auth.utils.cjs`),require(`./utils/string.utils.cjs`),require(`./utils/token-check.utils.cjs`),require(`./utils/map.utils.cjs`),require(`./utils/mutexes.utils.cjs`),require(`./utils/erc20tokenFunctions.cjs`),require(`./web3/events/getShieldedBalance.cjs`),require(`./pre-transaction/outputUtxoProcessing.cjs`),require(`./pre-transaction/solana.cjs`),require(`./snarkjs/signedMessageHash.cjs`),require(`./pre-transaction/process-gas-estimates.cjs`),require(`./pre-transaction/getVolatileTransferAmount.cjs`),require(`./pre-transaction/constructAdminData.cjs`),require(`./utils/create-provider.cjs`),require(`./pre-transaction/convert-okx-instructions.cjs`),require(`./web3/getSolanaPriorityFee.cjs`),require(`./utils/process.utils.cjs`),require(`./pre-transaction/sendV0Transaction.cjs`),require(`./utils/bytes32.utils.cjs`),require(`./pre-transaction/recipientUtxoProcessing.cjs`),require(`./pre-transaction/ensureAmountChanges.cjs`),require(`./pre-transaction/getFeeStructure.cjs`),require(`./pre-transaction/waitForDepositedUtxosInMerkleTree.cjs`),require(`./pre-transaction/buildCommitmentValidationData.cjs`),require(`./pre-transaction/index.cjs`),require(`./snarkjs/generateZkProof.cjs`),require(`./snarkjs/generateMainAndCommitmentZkProof.cjs`),require(`./utils/serialize-utxos.utils.cjs`),require(`./utils/resolve-sync.utils.cjs`),require(`./utils/reloadPage.cjs`),require(`./utils/cacheDevice.utils.cjs`),require(`./utils/involves-permit2-op.cjs`),require(`./utils/convertEmporiumOpToCallInfo.cjs`),require(`./utils/getRecipientInfoFromUserKeys.cjs`),require(`./utils/publicBalance.utils.cjs`),require(`./utils/postToOffscreen.cjs`),require(`./utils/getContractAddress.cjs`),require(`./utils/getUtxosFromReceipt.utils.cjs`),require(`./utils/getUtxosFromReceiptSolana.cjs`),require(`./utils/fees.utils.cjs`),require(`./utils/enclave-signature-storage.cjs`),require(`./utils/tx-confirmation.utils.cjs`),require(`./utils/tronSimulation.utils.cjs`),require(`./utils/getSignerFromContract.cjs`),require(`./utils/mnemonics.cjs`),require(`./utils/nearIntents.utils.cjs`),require(`./utils/index.cjs`),require(`./snarkjs/fetchOnChainRootHashes.cjs`),require(`./private-wallet/emporium.helpers.cjs`),require(`./snarkjs/constructGeneralZkProof.cjs`),require(`./web3/uniswapAPI.cjs`),require(`./web3/odosAPI.cjs`),require(`./web3/oneInchAPI.cjs`),require(`./web3/okxAPI.cjs`),require(`./web3/index.cjs`),require(`./snarkjs/constructSolanaZkProof.cjs`),require(`./snarkjs/index.cjs`),require(`./private-wallet/emporium.swap.helpers.cjs`),require(`./private-wallet/index.cjs`),require(`./auto-deposit-back-helpers/get-tokens-to-deposit-back.cjs`),require(`./auto-deposit-back-helpers/get-gas-token-records.cjs`),require(`./auto-deposit-back-helpers/select-gas-token.cjs`),require(`./auto-deposit-back-helpers/update-hinkal.cjs`),require(`./auto-deposit-back-helpers/index.cjs`);
|
|
@@ -3,6 +3,9 @@ import "./utils/serialize.utils.mjs";
|
|
|
3
3
|
import "./utils/caseInsensitive.utils.mjs";
|
|
4
4
|
import "./utils/amounts.utils.mjs";
|
|
5
5
|
import "./web3/etherFunctions.mjs";
|
|
6
|
+
import "./utils/external-action.utils.mjs";
|
|
7
|
+
import "./utils/bit.operations.mjs";
|
|
8
|
+
import "./snarkjs/common.snarkjs.mjs";
|
|
6
9
|
import "./utils/time.utils.mjs";
|
|
7
10
|
import "./utils/upToDateState.mjs";
|
|
8
11
|
import "./utils/cacheFunctions.mjs";
|
|
@@ -22,9 +25,6 @@ import "./utils/mutexes.utils.mjs";
|
|
|
22
25
|
import "./utils/erc20tokenFunctions.mjs";
|
|
23
26
|
import "./web3/events/getShieldedBalance.mjs";
|
|
24
27
|
import "./pre-transaction/outputUtxoProcessing.mjs";
|
|
25
|
-
import "./utils/external-action.utils.mjs";
|
|
26
|
-
import "./utils/bit.operations.mjs";
|
|
27
|
-
import "./snarkjs/common.snarkjs.mjs";
|
|
28
28
|
import "./pre-transaction/solana.mjs";
|
|
29
29
|
import "./snarkjs/signedMessageHash.mjs";
|
|
30
30
|
import "./pre-transaction/process-gas-estimates.mjs";
|