@gurge/sdk 0.3.30 → 0.3.31
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/data-structures/Hinkal/hinkalWithdraw.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalWithdraw.mjs +34 -40
- package/common/src/functions/pre-transaction/buildCommitmentValidationData.cjs +1 -1
- package/common/src/functions/pre-transaction/buildCommitmentValidationData.mjs +38 -40
- package/common/src/functions/pre-transaction/outputUtxoProcessing.cjs +1 -1
- package/common/src/functions/pre-transaction/outputUtxoProcessing.mjs +19 -20
- package/common/src/functions/snarkjs/constructGeneralZkProof.cjs +1 -1
- package/common/src/functions/snarkjs/constructGeneralZkProof.mjs +71 -74
- package/common/src/functions/utils/bigint-math.utils.d.ts +0 -2
- package/common/src/webworker/package.json +1 -1
- package/common/src/webworker/viteWorkerURL.constant.cjs +3 -3
- package/common/src/webworker/viteWorkerURL.constant.mjs +3 -3
- package/package.json +1 -1
- package/sdk/package.json.cjs +1 -1
- package/sdk/package.json.mjs +1 -1
- package/common/src/functions/utils/hinkalTiming.utils.cjs +0 -1
- package/common/src/functions/utils/hinkalTiming.utils.d.ts +0 -5
- package/common/src/functions/utils/hinkalTiming.utils.mjs +0 -16
|
@@ -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(`../../functions/utils/time.utils.cjs`),a=require(`../../types/external-action.types.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/
|
|
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(`../../functions/utils/time.utils.cjs`),a=require(`../../types/external-action.types.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/transactCallDirect.cjs`),g=require(`../../functions/web3/functionCalls/transactCallRelayer.cjs`),_=require(`../../functions/web3/functionCalls/transactCallDirectTron.cjs`),v=require(`../../functions/pre-transaction/merge-with-fee-structure.cjs`);var y=async(e,t,n,r)=>{let a=[...await c.addPaddingToUtxos(e,t,n,r)],o=[],s=i.getCurrentTimeInSeconds().toString();for(let t=0;t<n.length;t+=1){let{outputUtxos:n}=l.outputUtxoProcessing(e.userKeys,a[t],r[t],s);o.push(n)}return{inputUtxosArray:a,outputUtxosArray:o}},b=async(i,c,l,b,x,S,C,w)=>{let T=s.validateAndGetChainId(c),E=e.isTronLike(T),D=o.addressToHexFormat(await i.getEthereumAddressByChain(T)),O=c.map(e=>e.erc20TokenAddress),k=await u.modifyVolatileTokenAmountChanges(T,c,l),A=c[0];if(!A)throw Error(`Deposit Action: No Token Found`);let j;if(!x){let e=C??await f.getFeeStructure(T,S,O,a.ExternalActionId.Transact);j=await p.calculateModifiedFeeStructure(T,A,-k[0],e),await v.mergeWithFeeStructure(T,O,k,j)}let M={externalActionId:0n,externalAddress:o.addressToHexFormat(b),externalActionMetadata:`0x00`},[N,{inputUtxosArray:P,outputUtxosArray:F}]=await Promise.all([i.getRandomRelay(T,!0),y(i,T,O,k)]);if(!x&&!N)throw Error(r.transactionErrorCodes.RELAYER_NOT_AVAILABLE);let{zkCallData:I,circomData:L,dimData:R,commitmentValidationData:z}=await m.constructZkProof(i.merkleTreeHinkalByChain[T],P,F,i.userKeys,M.externalActionId,M.externalAddress,M.externalActionMetadata,i.generateProofRemotely,j??n.zeroFeeStructure,x?t.zeroAddress:N,T,void 0,void 0,x?D:void 0),B=E&&x?void 0:await o.reorderZkCallData(E,I,R,L);if(x){if(!A)throw Error(`Withdraw Action: No Token Found`);return E?await _.transactCallDirectTron(i,T,k[0],A,I,L,R):await h.transactCallDirect(i,T,k[0],A,I,L,R)}return await g.transactCallRelayer(T,I,R,L,z,void 0,void 0,d.constructAdminData(w,T,O,k,D),B)};exports.hinkalWithdraw=b;
|
|
@@ -7,54 +7,48 @@ import { ExternalActionId as a } from "../../types/external-action.types.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";
|
|
9
9
|
import { addPaddingToUtxos as l } from "../../functions/web3/events/getShieldedBalance.mjs";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { getFeeStructure as m } from "../../functions/pre-transaction/getFeeStructure.mjs";
|
|
10
|
+
import { outputUtxoProcessing as u } from "../../functions/pre-transaction/outputUtxoProcessing.mjs";
|
|
11
|
+
import { modifyVolatileTokenAmountChanges as d } from "../../functions/pre-transaction/getVolatileTransferAmount.mjs";
|
|
12
|
+
import { constructAdminData as f } from "../../functions/pre-transaction/constructAdminData.mjs";
|
|
13
|
+
import { getFeeStructure as p } from "../../functions/pre-transaction/getFeeStructure.mjs";
|
|
15
14
|
import "../../functions/pre-transaction/index.mjs";
|
|
16
|
-
import { calculateModifiedFeeStructure as
|
|
17
|
-
import { constructZkProof as
|
|
18
|
-
import { transactCallDirect as
|
|
19
|
-
import { transactCallRelayer as
|
|
20
|
-
import { transactCallDirectTron as
|
|
21
|
-
import { mergeWithFeeStructure as
|
|
15
|
+
import { calculateModifiedFeeStructure as m } from "../../functions/utils/fees.utils.mjs";
|
|
16
|
+
import { constructZkProof as h } from "../../functions/snarkjs/constructGeneralZkProof.mjs";
|
|
17
|
+
import { transactCallDirect as g } from "../../functions/web3/functionCalls/transactCallDirect.mjs";
|
|
18
|
+
import { transactCallRelayer as _ } from "../../functions/web3/functionCalls/transactCallRelayer.mjs";
|
|
19
|
+
import { transactCallDirectTron as v } from "../../functions/web3/functionCalls/transactCallDirectTron.mjs";
|
|
20
|
+
import { mergeWithFeeStructure as y } from "../../functions/pre-transaction/merge-with-fee-structure.mjs";
|
|
22
21
|
//#region libs/shared/common/src/data-structures/Hinkal/hinkalWithdraw.ts
|
|
23
|
-
var
|
|
24
|
-
let a =
|
|
25
|
-
a.log("padding-done", { inputCounts: o.map((e) => e.length) });
|
|
26
|
-
let s = [], c = i().toString();
|
|
22
|
+
var b = async (e, t, n, r) => {
|
|
23
|
+
let a = [...await l(e, t, n, r)], o = [], s = i().toString();
|
|
27
24
|
for (let t = 0; t < n.length; t += 1) {
|
|
28
|
-
let { outputUtxos: n } =
|
|
29
|
-
|
|
25
|
+
let { outputUtxos: n } = u(e.userKeys, a[t], r[t], s);
|
|
26
|
+
o.push(n);
|
|
30
27
|
}
|
|
31
|
-
return
|
|
32
|
-
inputUtxosArray:
|
|
33
|
-
outputUtxosArray:
|
|
28
|
+
return {
|
|
29
|
+
inputUtxosArray: a,
|
|
30
|
+
outputUtxosArray: o
|
|
34
31
|
};
|
|
35
|
-
},
|
|
36
|
-
let
|
|
37
|
-
if (!
|
|
38
|
-
let
|
|
39
|
-
if (!
|
|
40
|
-
let e =
|
|
41
|
-
|
|
32
|
+
}, x = async (i, l, u, x, S, C, w, T) => {
|
|
33
|
+
let E = c(l), D = e(E), O = o(await i.getEthereumAddressByChain(E)), k = l.map((e) => e.erc20TokenAddress), A = await d(E, l, u), j = l[0];
|
|
34
|
+
if (!j) throw Error("Deposit Action: No Token Found");
|
|
35
|
+
let M;
|
|
36
|
+
if (!S) {
|
|
37
|
+
let e = w ?? await p(E, C, k, a.Transact);
|
|
38
|
+
M = await m(E, j, -A[0], e), await y(E, k, A, M);
|
|
42
39
|
}
|
|
43
|
-
let
|
|
40
|
+
let N = {
|
|
44
41
|
externalActionId: 0n,
|
|
45
|
-
externalAddress: o(
|
|
42
|
+
externalAddress: o(x),
|
|
46
43
|
externalActionMetadata: "0x00"
|
|
47
|
-
}, [
|
|
48
|
-
if (!
|
|
49
|
-
let
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
if (!M) throw Error("Withdraw Action: No Token Found");
|
|
54
|
-
return O ? await y(i, D, j[0], M, z, B, V) : await _(i, D, j[0], M, z, B, V);
|
|
44
|
+
}, [P, { inputUtxosArray: F, outputUtxosArray: I }] = await Promise.all([i.getRandomRelay(E, !0), b(i, E, k, A)]);
|
|
45
|
+
if (!S && !P) throw Error(r.RELAYER_NOT_AVAILABLE);
|
|
46
|
+
let { zkCallData: L, circomData: R, dimData: z, commitmentValidationData: B } = await h(i.merkleTreeHinkalByChain[E], F, I, i.userKeys, N.externalActionId, N.externalAddress, N.externalActionMetadata, i.generateProofRemotely, M ?? n, S ? t : P, E, void 0, void 0, S ? O : void 0), V = D && S ? void 0 : await s(D, L, z, R);
|
|
47
|
+
if (S) {
|
|
48
|
+
if (!j) throw Error("Withdraw Action: No Token Found");
|
|
49
|
+
return D ? await v(i, E, A[0], j, L, R, z) : await g(i, E, A[0], j, L, R, z);
|
|
55
50
|
}
|
|
56
|
-
|
|
57
|
-
return G.log("done", { txHash: K }), K;
|
|
51
|
+
return await _(E, L, z, R, B, void 0, void 0, f(T, E, k, A, O), V);
|
|
58
52
|
};
|
|
59
53
|
//#endregion
|
|
60
|
-
export {
|
|
54
|
+
export { x as hinkalWithdraw };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../../constants/chains.constants.cjs`),t=require(`../../data-structures/crypto-keys/keys.cjs`),n=require(`../utils/solanaMint.utils.cjs`),r=require(`../
|
|
1
|
+
const e=require(`../../constants/chains.constants.cjs`),t=require(`../../data-structures/crypto-keys/keys.cjs`),n=require(`../utils/solanaMint.utils.cjs`),r=require(`../snarkjs/common.snarkjs.cjs`),i=require(`../../webworker/worker.registry.cjs`),a=require(`../../webworker/performTaskWithWorker.cjs`),o=require(`../../webworker/zkProofWorker/zkProofWorker.types.cjs`);var s=async(s,c,l,u)=>{if(r.hasOnlyZeroAmounts(u))return;let d=e.isSolanaLike(s),f=u.map(e=>e.map(e=>e.amount.toString())),p=u.map(e=>e.map(e=>e.timeStamp)),m=u.map(e=>e.map(e=>r.getUtxoCircuitInRandomization(e))),h=u.map(e=>e.map(e=>e.getConstructableParams())),g=u.map(e=>e.map(e=>e.amount===0n?`0`:BigInt(e.getCommitment()).toString())),_=await a.performTaskWithWorker({type:i.WorkerVariant.ZKProof,payload:{type:o.ZKProofWorkerActionType.BUILD_IN_NULLIFIERS,data:{inputUtxosSerialized:h}}}),v=c.getShieldedPrivateKey(),y=c.getSpendingKeyPair().pubSpendingBJJPoint,b=d?l.map(e=>{let{compressedAddress:t}=n.formatMintAddress(e);return BigInt(t).toString()}):l.map(e=>BigInt(e).toString());u.forEach((e,n)=>{e.forEach((e,r)=>{let i=e.getStealthAddress(),a=e.spendingPublicKey??y,o=e.isNewStyle&&e.H0?t.UserKeys.getStealthAddressNewStyle(e.H0,v,a):t.UserKeys.getStealthAddress(BigInt(e.randomization),v);if(BigInt(i).toString()!==BigInt(o).toString())throw Error(`Commitment validation stealth mismatch at tokenIdx=${n}, utxoIdx=${r}`)})});let x={nullifyingPrivateKey:v,spendingPublicKey:y,erc20TokenAddresses:b,inAmounts:f,inRandomizations:m,inH0Ax:u.map(e=>e.map(e=>r.getUtxoCircuitH0Coords(e)[0].toString())),inH0Ay:u.map(e=>e.map(e=>r.getUtxoCircuitH0Coords(e)[1].toString())),isNewStyle:u.map(e=>e.map(e=>!!e.isNewStyle)),inTimeStamps:p,inCommitments:g,inNullifiers:_};if(!(!l.length||!u[0]?.length))return{tokenAddresses:b,inAmounts:f,inTimeStamps:p,inRandomizations:m,inCommitments:g,inNullifiers:_,verifierName:`commitmentCalculator${l.length}x${u[0].length}`,commitmentInput:x}},c=(e,t)=>{if(!(!e||!t))return{tokenAddresses:e.tokenAddresses,inAmounts:e.inAmounts,inTimeStamps:e.inTimeStamps,inRandomizations:e.inRandomizations,inCommitments:e.inCommitments,inNullifiers:e.inNullifiers,proof:{a:t.zkCallData[0],b:t.zkCallData[1],c:t.zkCallData[2]}}};exports.buildCommitmentValidationData=s,exports.buildCommitmentValidationDataFromProof=c;
|
|
@@ -1,55 +1,53 @@
|
|
|
1
1
|
import { isSolanaLike as e } from "../../constants/chains.constants.mjs";
|
|
2
2
|
import { UserKeys as t } from "../../data-structures/crypto-keys/keys.mjs";
|
|
3
3
|
import { formatMintAddress as n } from "../utils/solanaMint.utils.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { ZKProofWorkerActionType as l } from "../../webworker/zkProofWorker/zkProofWorker.types.mjs";
|
|
4
|
+
import { getUtxoCircuitH0Coords as r, getUtxoCircuitInRandomization as i, hasOnlyZeroAmounts as a } from "../snarkjs/common.snarkjs.mjs";
|
|
5
|
+
import { WorkerVariant as o } from "../../webworker/worker.registry.mjs";
|
|
6
|
+
import { performTaskWithWorker as s } from "../../webworker/performTaskWithWorker.mjs";
|
|
7
|
+
import { ZKProofWorkerActionType as c } from "../../webworker/zkProofWorker/zkProofWorker.types.mjs";
|
|
9
8
|
//#region libs/shared/common/src/functions/pre-transaction/buildCommitmentValidationData.ts
|
|
10
|
-
var
|
|
11
|
-
if (
|
|
12
|
-
let
|
|
13
|
-
type:
|
|
9
|
+
var l = async (l, u, d, f) => {
|
|
10
|
+
if (a(f)) return;
|
|
11
|
+
let p = e(l), m = f.map((e) => e.map((e) => e.amount.toString())), h = f.map((e) => e.map((e) => e.timeStamp)), g = f.map((e) => e.map((e) => i(e))), _ = f.map((e) => e.map((e) => e.getConstructableParams())), v = f.map((e) => e.map((e) => e.amount === 0n ? "0" : BigInt(e.getCommitment()).toString())), y = await s({
|
|
12
|
+
type: o.ZKProof,
|
|
14
13
|
payload: {
|
|
15
|
-
type:
|
|
16
|
-
data: { inputUtxosSerialized:
|
|
14
|
+
type: c.BUILD_IN_NULLIFIERS,
|
|
15
|
+
data: { inputUtxosSerialized: _ }
|
|
17
16
|
}
|
|
18
|
-
}),
|
|
17
|
+
}), b = u.getShieldedPrivateKey(), x = u.getSpendingKeyPair().pubSpendingBJJPoint, S = p ? d.map((e) => {
|
|
19
18
|
let { compressedAddress: t } = n(e);
|
|
20
19
|
return BigInt(t).toString();
|
|
21
|
-
}) :
|
|
22
|
-
|
|
20
|
+
}) : d.map((e) => BigInt(e).toString());
|
|
21
|
+
f.forEach((e, n) => {
|
|
23
22
|
e.forEach((e, r) => {
|
|
24
|
-
|
|
25
|
-
let i = e.getStealthAddress(), a = e.spendingPublicKey ?? S, o = e.isNewStyle && e.H0 ? t.getStealthAddressNewStyle(e.H0, x, a) : t.getStealthAddress(BigInt(e.randomization), x);
|
|
23
|
+
let i = e.getStealthAddress(), a = e.spendingPublicKey ?? x, o = e.isNewStyle && e.H0 ? t.getStealthAddressNewStyle(e.H0, b, a) : t.getStealthAddress(BigInt(e.randomization), b);
|
|
26
24
|
if (BigInt(i).toString() !== BigInt(o).toString()) throw Error(`Commitment validation stealth mismatch at tokenIdx=${n}, utxoIdx=${r}`);
|
|
27
25
|
});
|
|
28
|
-
})
|
|
29
|
-
let
|
|
30
|
-
nullifyingPrivateKey:
|
|
31
|
-
spendingPublicKey:
|
|
32
|
-
erc20TokenAddresses:
|
|
33
|
-
inAmounts:
|
|
34
|
-
inRandomizations:
|
|
35
|
-
inH0Ax:
|
|
36
|
-
inH0Ay:
|
|
37
|
-
isNewStyle:
|
|
38
|
-
inTimeStamps:
|
|
39
|
-
inCommitments:
|
|
40
|
-
inNullifiers:
|
|
26
|
+
});
|
|
27
|
+
let C = {
|
|
28
|
+
nullifyingPrivateKey: b,
|
|
29
|
+
spendingPublicKey: x,
|
|
30
|
+
erc20TokenAddresses: S,
|
|
31
|
+
inAmounts: m,
|
|
32
|
+
inRandomizations: g,
|
|
33
|
+
inH0Ax: f.map((e) => e.map((e) => r(e)[0].toString())),
|
|
34
|
+
inH0Ay: f.map((e) => e.map((e) => r(e)[1].toString())),
|
|
35
|
+
isNewStyle: f.map((e) => e.map((e) => !!e.isNewStyle)),
|
|
36
|
+
inTimeStamps: h,
|
|
37
|
+
inCommitments: v,
|
|
38
|
+
inNullifiers: y
|
|
41
39
|
};
|
|
42
|
-
if (!(!
|
|
43
|
-
tokenAddresses:
|
|
44
|
-
inAmounts:
|
|
45
|
-
inTimeStamps:
|
|
46
|
-
inRandomizations:
|
|
47
|
-
inCommitments:
|
|
48
|
-
inNullifiers:
|
|
49
|
-
verifierName: `commitmentCalculator${
|
|
50
|
-
commitmentInput:
|
|
40
|
+
if (!(!d.length || !f[0]?.length)) return {
|
|
41
|
+
tokenAddresses: S,
|
|
42
|
+
inAmounts: m,
|
|
43
|
+
inTimeStamps: h,
|
|
44
|
+
inRandomizations: g,
|
|
45
|
+
inCommitments: v,
|
|
46
|
+
inNullifiers: y,
|
|
47
|
+
verifierName: `commitmentCalculator${d.length}x${f[0].length}`,
|
|
48
|
+
commitmentInput: C
|
|
51
49
|
};
|
|
52
|
-
},
|
|
50
|
+
}, u = (e, t) => {
|
|
53
51
|
if (!(!e || !t)) return {
|
|
54
52
|
tokenAddresses: e.tokenAddresses,
|
|
55
53
|
inAmounts: e.inAmounts,
|
|
@@ -65,4 +63,4 @@ var u = async (u, d, f, p) => {
|
|
|
65
63
|
};
|
|
66
64
|
};
|
|
67
65
|
//#endregion
|
|
68
|
-
export {
|
|
66
|
+
export { l as buildCommitmentValidationData, u as buildCommitmentValidationDataFromProof };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../utils/amounts.utils.cjs`),t=require(`../../error-handling/error-codes.constants.cjs`),n=require(`../../data-structures/utxo/Utxo.cjs`)
|
|
1
|
+
const e=require(`../utils/amounts.utils.cjs`),t=require(`../../error-handling/error-codes.constants.cjs`),n=require(`../../data-structures/utxo/Utxo.cjs`);var r=(r,i,a,o,s=!0,c,l)=>{let u=e.countTotalAmountInUtxos(i),{erc20TokenAddress:d,mintAddress:f}=i[0];if(s&&a<0n&&u+a<0n)throw Error(t.transactionErrorCodes.INSUFFICIENT_FUNDS_TO_TRANSACT);let p=[new n.Utxo({amount:e.bigintMax(u+a,0n),erc20TokenAddress:d,mintAddress:f,nullifyingKey:r.getShieldedPrivateKey(),timeStamp:o,spendingPublicKey:r.getSpendingKeyPair().pubSpendingBJJPoint,isNewStyle:!0})];if(c!==void 0&&l!==void 0){let[e,t,r,,i]=c.split(`,`);p.push(new n.Utxo({amount:l,erc20TokenAddress:d,mintAddress:f,H0:[BigInt(t),BigInt(r)],stealthAddress:e,encryptionKey:i,timeStamp:o,isNewStyle:!0}))}return{outputUtxos:p}};exports.outputUtxoProcessing=r;
|
|
@@ -1,34 +1,33 @@
|
|
|
1
1
|
import { bigintMax as e, countTotalAmountInUtxos as t } from "../utils/amounts.utils.mjs";
|
|
2
2
|
import { transactionErrorCodes as n } from "../../error-handling/error-codes.constants.mjs";
|
|
3
3
|
import { Utxo as r } from "../../data-structures/utxo/Utxo.mjs";
|
|
4
|
-
import { createRnDeltaTiming as i } from "../utils/hinkalTiming.utils.mjs";
|
|
5
4
|
//#region libs/shared/common/src/functions/pre-transaction/outputUtxoProcessing.ts
|
|
6
|
-
var
|
|
7
|
-
let
|
|
8
|
-
if (
|
|
9
|
-
let
|
|
10
|
-
amount: e(
|
|
11
|
-
erc20TokenAddress:
|
|
12
|
-
mintAddress:
|
|
13
|
-
nullifyingKey:
|
|
14
|
-
timeStamp:
|
|
15
|
-
spendingPublicKey:
|
|
5
|
+
var i = (i, a, o, s, c = !0, l, u) => {
|
|
6
|
+
let d = t(a), { erc20TokenAddress: f, mintAddress: p } = a[0];
|
|
7
|
+
if (c && o < 0n && d + o < 0n) throw Error(n.INSUFFICIENT_FUNDS_TO_TRANSACT);
|
|
8
|
+
let m = [new r({
|
|
9
|
+
amount: e(d + o, 0n),
|
|
10
|
+
erc20TokenAddress: f,
|
|
11
|
+
mintAddress: p,
|
|
12
|
+
nullifyingKey: i.getShieldedPrivateKey(),
|
|
13
|
+
timeStamp: s,
|
|
14
|
+
spendingPublicKey: i.getSpendingKeyPair().pubSpendingBJJPoint,
|
|
16
15
|
isNewStyle: !0
|
|
17
16
|
})];
|
|
18
|
-
if (
|
|
19
|
-
let [e, t, n, , i] =
|
|
20
|
-
|
|
21
|
-
amount:
|
|
22
|
-
erc20TokenAddress:
|
|
23
|
-
mintAddress:
|
|
17
|
+
if (l !== void 0 && u !== void 0) {
|
|
18
|
+
let [e, t, n, , i] = l.split(",");
|
|
19
|
+
m.push(new r({
|
|
20
|
+
amount: u,
|
|
21
|
+
erc20TokenAddress: f,
|
|
22
|
+
mintAddress: p,
|
|
24
23
|
H0: [BigInt(t), BigInt(n)],
|
|
25
24
|
stealthAddress: e,
|
|
26
25
|
encryptionKey: i,
|
|
27
|
-
timeStamp:
|
|
26
|
+
timeStamp: s,
|
|
28
27
|
isNewStyle: !0
|
|
29
28
|
}));
|
|
30
29
|
}
|
|
31
|
-
return { outputUtxos:
|
|
30
|
+
return { outputUtxos: m };
|
|
32
31
|
};
|
|
33
32
|
//#endregion
|
|
34
|
-
export {
|
|
33
|
+
export { i as outputUtxoProcessing };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../../constants/chains.constants.cjs`),t=require(`../../constants/protocol.constants.cjs`),
|
|
1
|
+
const e=require(`../../constants/chains.constants.cjs`),t=require(`../../constants/protocol.constants.cjs`),n=require(`../../crypto/poseidon.cjs`),r=require(`../web3/etherFunctions.cjs`),i=require(`../../data-structures/crypto-keys/keys.cjs`),a=require(`../utils/time.utils.cjs`),o=require(`../../types/external-action.types.cjs`),s=require(`../../error-handling/logger.cjs`),c=require(`../utils/bit.operations.cjs`),l=require(`./common.snarkjs.cjs`),ee=require(`./signedMessageHash.cjs`),u=require(`./generateCircomData.cjs`),te=require(`../../data-structures/AccountActions/AccountActions.cjs`),d=require(`./generateMainAndCommitmentZkProof.cjs`),f=require(`./getMerkleTreeSiblingsAndRootHashes.cjs`),p=require(`../private-wallet/emporium.helpers.cjs`);var m=async(m,h,g,_,v,y,b,x,S,C=t.zeroAddress,w=e.chainIds.localhost,T=h.map(()=>!1),E=void 0,D,O)=>{let k=l.getZkProofVerifierName(h,g),A=l.calcAmountChanges(h,g),j=h.map(e=>e[0].erc20TokenAddress),M=l.calcEncryptedOutputs(g),N=t.defaultSignatureData,P=_.getShieldedPrivateKey(),{pubSpendingBJJPoint:F}=_.getSpendingKeyPair(),I=l.calcStealthAddressStructure(i.UserKeys.findCorrectRandomization(r.randomBigInt(31),P),P,_.getSpendingKeyPair().pubSpendingBJJPoint),{inCommitmentSiblings:ne,inCommitmentSiblingSides:re,rootHashHinkal:L,inNullifiers:R}=await f.getDataFromWorkers(w,m,h.map(e=>e.map(e=>e.getConstructableParams()))),z=l.buildOutCommitments(g),B=r.randomBigInt(31),V=n.poseidonFunction(B),H=BigInt(g.length>0?g[0][0].timeStamp:a.getCurrentTimeInSeconds()),U={rootHashHinkal:L,spendingPublicKey:F,nullifyingPrivateKey:P,erc20TokenAddresses:j,amountChanges:A,inAmounts:h.map(e=>e.map(e=>e.amount.toString())),inRandomizations:h.map(e=>e.map(e=>l.getUtxoCircuitInRandomization(e))),inH0Ax:h.map(e=>e.map(e=>l.getUtxoCircuitH0Coords(e)[0].toString())),inH0Ay:h.map(e=>e.map(e=>l.getUtxoCircuitH0Coords(e)[1].toString())),isNewStyle:h.map(e=>e.map(e=>!!e.isNewStyle)),inTimeStamps:h.map(e=>e.map(e=>e.timeStamp)),inNullifiers:R,inCommitmentSiblings:ne,inCommitmentSiblingSides:re,outAmounts:g.map(e=>e.map(e=>e.amount.toString())),outTimeStamp:H,outPublicKeys:g.map(e=>e.map(e=>e.getStealthAddress())),outCommitments:z,calldataHash:0n,messageSeed:B,H0Ax:c.takeOffHighestBit(I.extraRandomization),H0Ay:I.H0},W=l.calcPublicSignalCount(k,U.erc20TokenAddresses,U.amountChanges,U.inNullifiers,U.outCommitments),G=l.calcAmountChanges(h,g,!0),K=l.getSlippageValues(G);s.Logger.log({publicSignalCount:W});let q=Array.isArray(b)?b:[b],J=e.getOnchainChainId(w),Y=O?te.AccountActions.getSignerAddressFromPrivateKey(J,O):void 0,X=v===o.ExternalActionId.Emporium?await p.encodeEmporiumMetadata(w,y??t.zeroAddress,O,q,V,Y):await p.encodeEmporiumMetadata(w,t.zeroAddress,void 0,v===0n?[]:q,V,t.zeroAddress);U.calldataHash=l.createCallDataHash(W,C,y,v,X,M,E,K,T,S,N,D);let Z=ee.computeSignedMessageHashEvm({rootHashHinkal:L,erc20TokenAddresses:j,amountChanges:A,outTimeStamp:H,inNullifiers:R,outCommitments:z,calldataHash:U.calldataHash,message:V,outH1Ay:I.H1,H0Ax:U.H0Ax,H0Ay:I.H0}),{R8:Q,S:ie}=_.signEddsa(Z);U.eddsaSignature=[Q[0],Q[1],ie],U.signedMessageHash=Z;let $=k.startsWith(`mainEVMCircuitMin0`),ae={outTimeStamp:H,calldataHash:U.calldataHash,messageSeed:B},{zkCallData:oe,commitmentValidationData:se}=await d.generateMainAndCommitmentZkProof(w,_,j,h,k,$?ae:U,x);return{zkCallData:oe,circomData:u.generateCircomData(z,R,L,G,j,g,M,W,v,y,X,C,U.calldataHash,I,T,E,$?Number(H):void 0,K,S,N,D),dimData:{tokenNumber:h.length,nullifierAmount:h.length>0?h[0].length:0,outputAmount:g.length>0?g[0].length:0},encryptedOutputs:M,commitmentValidationData:se}};exports.constructZkProof=m;
|
|
@@ -1,85 +1,82 @@
|
|
|
1
1
|
import { chainIds as e, getOnchainChainId as t } from "../../constants/chains.constants.mjs";
|
|
2
2
|
import { defaultSignatureData as ee, zeroAddress as n } from "../../constants/protocol.constants.mjs";
|
|
3
|
-
import { poseidonFunction as
|
|
4
|
-
import { randomBigInt as
|
|
5
|
-
import { UserKeys as
|
|
6
|
-
import { getCurrentTimeInSeconds as
|
|
7
|
-
import { ExternalActionId as
|
|
8
|
-
import { Logger as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { buildOutCommitments as se, calcAmountChanges as a, calcEncryptedOutputs as o, calcPublicSignalCount as s, calcStealthAddressStructure as c, createCallDataHash as l, getSlippageValues as ce, getUtxoCircuitH0Coords as u, getUtxoCircuitInRandomization as le, getZkProofVerifierName as ue } from "./common.snarkjs.mjs";
|
|
3
|
+
import { poseidonFunction as te } from "../../crypto/poseidon.mjs";
|
|
4
|
+
import { randomBigInt as r } from "../web3/etherFunctions.mjs";
|
|
5
|
+
import { UserKeys as i } from "../../data-structures/crypto-keys/keys.mjs";
|
|
6
|
+
import { getCurrentTimeInSeconds as a } from "../utils/time.utils.mjs";
|
|
7
|
+
import { ExternalActionId as o } from "../../types/external-action.types.mjs";
|
|
8
|
+
import { Logger as s } from "../../error-handling/logger.mjs";
|
|
9
|
+
import { takeOffHighestBit as ne } from "../utils/bit.operations.mjs";
|
|
10
|
+
import { buildOutCommitments as re, calcAmountChanges as c, calcEncryptedOutputs as ie, calcPublicSignalCount as ae, calcStealthAddressStructure as oe, createCallDataHash as se, getSlippageValues as ce, getUtxoCircuitH0Coords as l, getUtxoCircuitInRandomization as le, getZkProofVerifierName as ue } from "./common.snarkjs.mjs";
|
|
12
11
|
import { computeSignedMessageHashEvm as de } from "./signedMessageHash.mjs";
|
|
13
12
|
import { generateCircomData as fe } from "./generateCircomData.mjs";
|
|
14
|
-
import { AccountActions as
|
|
15
|
-
import { generateMainAndCommitmentZkProof as
|
|
16
|
-
import { getDataFromWorkers as
|
|
17
|
-
import { encodeEmporiumMetadata as
|
|
13
|
+
import { AccountActions as u } from "../../data-structures/AccountActions/AccountActions.mjs";
|
|
14
|
+
import { generateMainAndCommitmentZkProof as d } from "./generateMainAndCommitmentZkProof.mjs";
|
|
15
|
+
import { getDataFromWorkers as f } from "./getMerkleTreeSiblingsAndRootHashes.mjs";
|
|
16
|
+
import { encodeEmporiumMetadata as p } from "../private-wallet/emporium.helpers.mjs";
|
|
18
17
|
//#region libs/shared/common/src/functions/snarkjs/constructGeneralZkProof.ts
|
|
19
|
-
var
|
|
20
|
-
let O =
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
outPublicKeys: h.map((e) => e.map((e) => e.getStealthAddress())),
|
|
40
|
-
outCommitments: V,
|
|
18
|
+
var m = async (m, h, g, _, v, y, b, pe, x, S = n, C = e.localhost, w = h.map(() => !1), T = void 0, E, D) => {
|
|
19
|
+
let O = ue(h, g), k = c(h, g), A = h.map((e) => e[0].erc20TokenAddress), j = ie(g), M = ee, N = _.getShieldedPrivateKey(), { pubSpendingBJJPoint: P } = _.getSpendingKeyPair(), F = oe(i.findCorrectRandomization(r(31), N), N, _.getSpendingKeyPair().pubSpendingBJJPoint), { inCommitmentSiblings: I, inCommitmentSiblingSides: L, rootHashHinkal: R, inNullifiers: z } = await f(C, m, h.map((e) => e.map((e) => e.getConstructableParams()))), B = re(g), V = r(31), H = te(V), U = BigInt(g.length > 0 ? g[0][0].timeStamp : a()), W = {
|
|
20
|
+
rootHashHinkal: R,
|
|
21
|
+
spendingPublicKey: P,
|
|
22
|
+
nullifyingPrivateKey: N,
|
|
23
|
+
erc20TokenAddresses: A,
|
|
24
|
+
amountChanges: k,
|
|
25
|
+
inAmounts: h.map((e) => e.map((e) => e.amount.toString())),
|
|
26
|
+
inRandomizations: h.map((e) => e.map((e) => le(e))),
|
|
27
|
+
inH0Ax: h.map((e) => e.map((e) => l(e)[0].toString())),
|
|
28
|
+
inH0Ay: h.map((e) => e.map((e) => l(e)[1].toString())),
|
|
29
|
+
isNewStyle: h.map((e) => e.map((e) => !!e.isNewStyle)),
|
|
30
|
+
inTimeStamps: h.map((e) => e.map((e) => e.timeStamp)),
|
|
31
|
+
inNullifiers: z,
|
|
32
|
+
inCommitmentSiblings: I,
|
|
33
|
+
inCommitmentSiblingSides: L,
|
|
34
|
+
outAmounts: g.map((e) => e.map((e) => e.amount.toString())),
|
|
35
|
+
outTimeStamp: U,
|
|
36
|
+
outPublicKeys: g.map((e) => e.map((e) => e.getStealthAddress())),
|
|
37
|
+
outCommitments: B,
|
|
41
38
|
calldataHash: 0n,
|
|
42
|
-
messageSeed:
|
|
43
|
-
H0Ax:
|
|
44
|
-
H0Ay:
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
let
|
|
48
|
-
|
|
49
|
-
let
|
|
50
|
-
rootHashHinkal:
|
|
51
|
-
erc20TokenAddresses:
|
|
52
|
-
amountChanges:
|
|
53
|
-
outTimeStamp:
|
|
54
|
-
inNullifiers:
|
|
55
|
-
outCommitments:
|
|
56
|
-
calldataHash:
|
|
57
|
-
message:
|
|
58
|
-
outH1Ay:
|
|
59
|
-
H0Ax:
|
|
60
|
-
H0Ay:
|
|
61
|
-
}), { R8:
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
],
|
|
67
|
-
let
|
|
68
|
-
outTimeStamp:
|
|
69
|
-
calldataHash:
|
|
70
|
-
messageSeed:
|
|
71
|
-
}, { zkCallData:
|
|
72
|
-
return
|
|
73
|
-
zkCallData:
|
|
74
|
-
circomData: fe(
|
|
39
|
+
messageSeed: V,
|
|
40
|
+
H0Ax: ne(F.extraRandomization),
|
|
41
|
+
H0Ay: F.H0
|
|
42
|
+
}, G = ae(O, W.erc20TokenAddresses, W.amountChanges, W.inNullifiers, W.outCommitments), K = c(h, g, !0), q = ce(K);
|
|
43
|
+
s.log({ publicSignalCount: G });
|
|
44
|
+
let J = Array.isArray(b) ? b : [b], me = t(C), he = D ? u.getSignerAddressFromPrivateKey(me, D) : void 0, Y = v === o.Emporium ? await p(C, y ?? n, D, J, H, he) : await p(C, n, void 0, v === 0n ? [] : J, H, n);
|
|
45
|
+
W.calldataHash = se(G, S, y, v, Y, j, T, q, w, x, M, E);
|
|
46
|
+
let X = de({
|
|
47
|
+
rootHashHinkal: R,
|
|
48
|
+
erc20TokenAddresses: A,
|
|
49
|
+
amountChanges: k,
|
|
50
|
+
outTimeStamp: U,
|
|
51
|
+
inNullifiers: z,
|
|
52
|
+
outCommitments: B,
|
|
53
|
+
calldataHash: W.calldataHash,
|
|
54
|
+
message: H,
|
|
55
|
+
outH1Ay: F.H1,
|
|
56
|
+
H0Ax: W.H0Ax,
|
|
57
|
+
H0Ay: F.H0
|
|
58
|
+
}), { R8: Z, S: ge } = _.signEddsa(X);
|
|
59
|
+
W.eddsaSignature = [
|
|
60
|
+
Z[0],
|
|
61
|
+
Z[1],
|
|
62
|
+
ge
|
|
63
|
+
], W.signedMessageHash = X;
|
|
64
|
+
let Q = O.startsWith("mainEVMCircuitMin0"), $ = {
|
|
65
|
+
outTimeStamp: U,
|
|
66
|
+
calldataHash: W.calldataHash,
|
|
67
|
+
messageSeed: V
|
|
68
|
+
}, { zkCallData: _e, commitmentValidationData: ve } = await d(C, _, A, h, O, Q ? $ : W, pe);
|
|
69
|
+
return {
|
|
70
|
+
zkCallData: _e,
|
|
71
|
+
circomData: fe(B, z, R, K, A, g, j, G, v, y, Y, S, W.calldataHash, F, w, T, Q ? Number(U) : void 0, q, x, M, E),
|
|
75
72
|
dimData: {
|
|
76
|
-
tokenNumber:
|
|
77
|
-
nullifierAmount:
|
|
78
|
-
outputAmount:
|
|
73
|
+
tokenNumber: h.length,
|
|
74
|
+
nullifierAmount: h.length > 0 ? h[0].length : 0,
|
|
75
|
+
outputAmount: g.length > 0 ? g[0].length : 0
|
|
79
76
|
},
|
|
80
|
-
encryptedOutputs:
|
|
81
|
-
commitmentValidationData:
|
|
77
|
+
encryptedOutputs: j,
|
|
78
|
+
commitmentValidationData: ve
|
|
82
79
|
};
|
|
83
80
|
};
|
|
84
81
|
//#endregion
|
|
85
|
-
export {
|
|
82
|
+
export { m as constructZkProof };
|
|
@@ -1,4 +1,2 @@
|
|
|
1
1
|
export declare const mod: (value: bigint, m?: bigint) => bigint;
|
|
2
|
-
export declare const modpow: (b: bigint, e: bigint, m: bigint) => bigint;
|
|
3
|
-
/** Modular inverse via extended Euclidean algorithm (much faster than Fermat modpow on RN). */
|
|
4
2
|
export declare const modInverse: (value: bigint, m?: bigint) => bigint;
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
var e = /* @__PURE__ */ ((r) => (r.ZKProof = "ZKProof", r.SnarkJS = "SnarkJS", r.UTXO = "UTXO", r))(e || {});
|
|
15
15
|
|
|
16
16
|
const n = async () => ({
|
|
17
|
-
[e.ZKProof]: await getWorkerURL(domain + '/0.3.
|
|
18
|
-
[e.SnarkJS]: await getWorkerURL(domain + '/0.3.
|
|
19
|
-
[e.UTXO]: await getWorkerURL(domain + '/0.3.
|
|
17
|
+
[e.ZKProof]: await getWorkerURL(domain + '/0.3.31/' + 'zkProofWorkerLauncher.js'),
|
|
18
|
+
[e.SnarkJS]: await getWorkerURL(domain + '/0.3.31/' + 'snarkjsWorkerLauncher.js'),
|
|
19
|
+
[e.UTXO]: await getWorkerURL(domain + '/0.3.31/' + 'utxoWorkerLauncher.js'),
|
|
20
20
|
});
|
|
21
21
|
exports.getWorkerViteURL = n;
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
var e = /* @__PURE__ */ ((r) => (r.ZKProof = "ZKProof", r.SnarkJS = "SnarkJS", r.UTXO = "UTXO", r))(e || {});
|
|
15
15
|
|
|
16
16
|
const n = async () => ({
|
|
17
|
-
[e.ZKProof]: await getWorkerURL(domain + '/0.3.
|
|
18
|
-
[e.SnarkJS]: await getWorkerURL(domain + '/0.3.
|
|
19
|
-
[e.UTXO]: await getWorkerURL(domain + '/0.3.
|
|
17
|
+
[e.ZKProof]: await getWorkerURL(domain + '/0.3.31/' + 'zkProofWorkerLauncher.js'),
|
|
18
|
+
[e.SnarkJS]: await getWorkerURL(domain + '/0.3.31/' + 'snarkjsWorkerLauncher.js'),
|
|
19
|
+
[e.UTXO]: await getWorkerURL(domain + '/0.3.31/' + 'utxoWorkerLauncher.js'),
|
|
20
20
|
});
|
|
21
21
|
export { n as getWorkerViteURL };
|
package/package.json
CHANGED
package/sdk/package.json.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e={name:`@gurge/sdk`,version:`0.3.
|
|
1
|
+
var e={name:`@gurge/sdk`,version:`0.3.30`,homepage:`hinkal.io`,author:{name:`Hinkal Protocol`},keywords:[`blockchain`,`privacy`,`zero-knowledge`,`stealth addresses`],exports:{".":{types:`./index.d.ts`,"react-native":`./index.cjs`,import:`./index.mjs`,default:`./index.cjs`},"./providers/WagmiProviderAdapter":{types:`./providers/WagmiProviderAdapter.d.ts`,"react-native":`./providers/WagmiProviderAdapter.cjs`,import:`./providers/WagmiProviderAdapter.mjs`,default:`./providers/WagmiProviderAdapter.cjs`},"./providers/EthersProviderAdapter":{types:`./providers/EthersProviderAdapter.d.ts`,"react-native":`./providers/EthersProviderAdapter.cjs`,import:`./providers/EthersProviderAdapter.mjs`,default:`./providers/EthersProviderAdapter.cjs`},"./providers/TronProviderAdapter":{types:`./providers/TronProviderAdapter.d.ts`,"react-native":`./providers/TronProviderAdapter.cjs`,import:`./providers/TronProviderAdapter.mjs`,default:`./providers/TronProviderAdapter.cjs`},"./providers/SolanaProviderAdapter":{types:`./providers/SolanaProviderAdapter.d.ts`,"react-native":`./providers/SolanaProviderAdapter.cjs`,import:`./providers/SolanaProviderAdapter.mjs`,default:`./providers/SolanaProviderAdapter.cjs`},"./providers/prepareEthersHinkal":{types:`./providers/prepareEthersHinkal.d.ts`,"react-native":`./providers/prepareEthersHinkal.cjs`,import:`./providers/prepareEthersHinkal.mjs`,default:`./providers/prepareEthersHinkal.cjs`},"./providers/prepareWagmiHinkal":{types:`./providers/prepareWagmiHinkal.d.ts`,"react-native":`./providers/prepareWagmiHinkal.cjs`,import:`./providers/prepareWagmiHinkal.mjs`,default:`./providers/prepareWagmiHinkal.cjs`},"./providers/prepareTronHinkal":{types:`./providers/prepareTronHinkal.d.ts`,"react-native":`./providers/prepareTronHinkal.cjs`,import:`./providers/prepareTronHinkal.mjs`,default:`./providers/prepareTronHinkal.cjs`},"./providers/prepareSolanaHinkal":{types:`./providers/prepareSolanaHinkal.d.ts`,"react-native":`./providers/prepareSolanaHinkal.cjs`,import:`./providers/prepareSolanaHinkal.mjs`,default:`./providers/prepareSolanaHinkal.cjs`},"./react-native/HinkalWebViewWorker":{types:`./react-native/HinkalWebViewWorker.d.ts`,"react-native":`./react-native/HinkalWebViewWorker.cjs`,import:`./react-native/HinkalWebViewWorker.mjs`,default:`./react-native/HinkalWebViewWorker.cjs`},"./react-native/metro-config":`./react-native/metro-config.js`,"./react-native/shims/*":`./react-native/shims/*`},types:`./index.d.ts`,scripts:{prebuild:`nx prebuild:workers`,build:`nx build`,lint:`nx lint`,test:`nx test`},devDependencies:{nx:`22.6.4`,vite:`^8.0.4`,"vite-plugin-dts":`^4.5.4`,"vite-tsconfig-paths":`^6.1.1`},dependencies:{"@coral-xyz/anchor":`^0.31.0`,"@solana/spl-token":`^0.4.14`,"@solana/web3.js":`^1.98.4`,"@solana/wallet-adapter-react":`^0.15.39`,axios:`^1.15.0`,"async-mutex":`^0.4.0`,bs58:`^6.0.0`,buffer:`6.0.3`,"circomlibjs-hinkal-fork":`^0.0.10`,dotenv:`^16.4.5`,ethers:`^6.15.0`,"idb-keyval":`6.2.1`,multiformats:`^9.4.2`,snarkjs:`0.7.5`,"libsodium-wrappers":`^0.8.2`,lodash:`^4.17.21`,tweetnacl:`^1.0.3`,process:`0.11.10`,"ua-parser-js":`^1.0.37`,uuid:`^9.0.1`,"node-forge":`^1.3.1`,"poseidon-lite":`^0.3.0`,tronweb:`^6.2.0`},peerDependencies:{wagmi:`2.13.3`,"@walletconnect/utils":`^2.17.2`,react:`*`,"react-native":`*`,"react-native-webview":`*`},peerDependenciesMeta:{wagmi:{optional:!0},"@walletconnect/utils":{optional:!0},react:{optional:!0},"react-native":{optional:!0},"react-native-webview":{optional:!0}}};exports.default=e;
|
package/sdk/package.json.mjs
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require(`../../constants/vite.constants.cjs`);var t=t=>{let n=Date.now(),r=n;return{log(i,a){if(!e.isReactNative)return;let o=Date.now();console.log(`[HinkalRnDelta] at=${o} [${t}] ${i}`,{ms:o-r,totalMs:o-n,...a}),r=o}}};exports.createRnDeltaTiming=t;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/** RN withdraw profiling — no-op on web. */
|
|
2
|
-
export declare const logRnDelta: (scope: string, phase: string, extra?: Record<string, unknown>) => void;
|
|
3
|
-
export declare const createRnDeltaTiming: (scope: string) => {
|
|
4
|
-
log(phase: string, extra?: Record<string, unknown>): void;
|
|
5
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { isReactNative as e } from "../../constants/vite.constants.mjs";
|
|
2
|
-
//#region libs/shared/common/src/functions/utils/hinkalTiming.utils.ts
|
|
3
|
-
var t = (t) => {
|
|
4
|
-
let n = Date.now(), r = n;
|
|
5
|
-
return { log(i, a) {
|
|
6
|
-
if (!e) return;
|
|
7
|
-
let o = Date.now();
|
|
8
|
-
console.log(`[HinkalRnDelta] at=${o} [${t}] ${i}`, {
|
|
9
|
-
ms: o - r,
|
|
10
|
-
totalMs: o - n,
|
|
11
|
-
...a
|
|
12
|
-
}), r = o;
|
|
13
|
-
} };
|
|
14
|
-
};
|
|
15
|
-
//#endregion
|
|
16
|
-
export { t as createRnDeltaTiming };
|