@hinkal/common 0.1.28 → 0.1.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/constants/server.constants.cjs +1 -1
  2. package/constants/server.constants.mjs +30 -30
  3. package/crypto/babyJub.cjs +1 -1
  4. package/crypto/babyJub.d.ts +1 -1
  5. package/crypto/babyJub.mjs +5 -6
  6. package/crypto/poseidon.cjs +1 -1
  7. package/crypto/poseidon.d.ts +1 -1
  8. package/crypto/poseidon.mjs +10 -11
  9. package/crypto/preProcessing.cjs +1 -1
  10. package/crypto/preProcessing.mjs +11 -7
  11. package/data-structures/crypto-keys/encryptDecryptUtxo.cjs +1 -1
  12. package/data-structures/crypto-keys/encryptDecryptUtxo.mjs +31 -32
  13. package/data-structures/transactions-manager/TransactionsManager.cjs +1 -1
  14. package/data-structures/transactions-manager/TransactionsManager.mjs +6 -7
  15. package/functions/snarkjs/common.snarkjs.cjs +1 -1
  16. package/functions/snarkjs/common.snarkjs.mjs +22 -23
  17. package/functions/staking/index.cjs +1 -1
  18. package/functions/staking/index.mjs +17 -18
  19. package/functions/utils/resolve-sync.utils.cjs +1 -1
  20. package/functions/utils/resolve-sync.utils.d.ts +1 -0
  21. package/functions/utils/resolve-sync.utils.mjs +12 -3
  22. package/index.cjs +1 -1
  23. package/index.mjs +207 -206
  24. package/package.json +1 -1
  25. package/providers/Wagmiv1ProviderAdapter.d.ts +1 -1
  26. package/webworker/snarkjsWorker/snarkjsWorkerLauncher.cjs +1 -1
  27. package/webworker/snarkjsWorker/snarkjsWorkerLauncher.mjs +1 -1
  28. package/webworker/utxoWorker/utxoWorkerLauncher.cjs +1 -1
  29. package/webworker/utxoWorker/utxoWorkerLauncher.mjs +1 -1
  30. package/webworker/utxoWorker/utxoWorkerLogic.cjs +1 -1
  31. package/webworker/utxoWorker/utxoWorkerLogic.mjs +26 -27
  32. package/webworker/zkProofWorker/zkProofWorkerLauncher.cjs +1 -1
  33. package/webworker/zkProofWorker/zkProofWorkerLauncher.mjs +1 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=(e,n)=>`${e}${n!==void 0?`?week=${n}`:""}`,l={ROUTES:{checkKycStatus:"/check-kyc-status",getUserSignature:"/signature-request",startUserVerification:"/start-aiprise-verification",zkMeAccessToken:"/zkMeAccessToken",getCommitmentsSnapshot:"/snapshots/commitments",getAccessTokenSnapshot:"/snapshots/access-tokens",callOdosAPI:"/OdosSwapData",callOneInchAPI:"/OneInchSwapData",getOdosPriceForToken:e=>`/getOdosPriceForToken/${e}`,getNullifiers:"/snapshots/nullifiers",axelarGasEstimate:(e,n,i,o)=>`/axelarGasEstimate/${e}/${n}/${i}/${o}`,userHasAccessToken:e=>`/user-has-access-token/${e}`,afterKycCall:"/after-kyc-callback",restoreSnapshots:"/snapshots/restore",beefyGraphAPI:"/BeefyGraphData",monitor:"/monitor",checkRisk:e=>`/check-risk/${e}`,userVerifyTransactions:"/user-verify-transactions",verificationStartDate:e=>`/verification-start-date/${e}`,userGetTransactions:(e,n)=>`/user-get-transactions/${e}/${n}`,getActiveCode:e=>`/get-active-code/${e}`,updateActiveCode:"/update-active-code",getWeeklyReferralCodes:(e,n)=>`/get-weekly-referral-codes/${e}/${n}`,getReferralCodes:e=>s(`/get-referral-codes/${e}`),getRewardsHistory:e=>`/get-rewards-history/${e}`,addReferralCode:"/update-referral-code",getLpProgram:e=>s(`/getLpProgram/${e}`),points:(e,n)=>`/points/${e}/${n}`,leaderboard:e=>`/leaderboard/${e}`,setRewardsReceivingData:"/set-user-rewards-receiving-data",getRewardsReceivingData:e=>`/get-user-rewards-receiving-data/${e}`,seasonLeaderboard:e=>`/season-leaderboard/${e}`,getUserAnonymityStakingPoints:e=>`/hinkal-points/${e}`,getLimitedAnonymityStakingPoints:e=>`/hinkal-points/limited/${e}`,getUserAnonymityStakingReferralPoints:e=>`/hinkal-referral-codes-info/${e}`,userHasPassword:e=>`/user-has-password/${e}`,userRegisterPassword:"/user-register-password",getNickname:e=>`/get-nickname/${e}`,addNickname:"/update-nickname",getLidoDefiData:"lido/defi",getLidoStats:"lido/stats",getLidoEthStats:"lido/eth-stats",getLidoDiscount:"lido/discount",getLidoRequestTime:"lido/request-time",getLidoMaticReward:"lido/matic-rewards",pendleAddLiquiditySingleToken:"pendle/addLiquiditySingleToken",pendleAddLiquiditySingleSy:"pendle/addLiquiditySingleSy",pendleAddLiquiditySinglePt:"pendle/addLiquiditySinglePt",pendleAddLiquidityDualTokenAndPt:"pendle/addLiquidityDualTokenAndPt",pendleAddLiquidityDualSyAndPt:"pendle/addLiquidityDualSyAndPt",pendleAddLiquiditySingleTokenKeepYt:"pendle/addLiquiditySingleTokenKeepYt",pendleRemoveLiquiditySingleToken:"pendle/removeLiquiditySingleToken",pendleRemoveLiquiditySingleSy:"pendle/removeLiquiditySingleSy",pendleRemoveLiquiditySinglePt:"pendle/removeLiquiditySinglePt",pendleRemoveLiquidityDualTokenAndPt:"pendle/removeLiquidityDualTokenAndPt",pendleRemoveLiquidityDualSyAndPt:"pendle/removeLiquidityDualSyAndPt",pendleMintPyFromToken:"pendle/mintPyFromToken",pendlRedeemPyToToken:"pendle/redeemPyToToken",removeLiquidityDualTokenAndPt:"pendle/removeLiquidityDualTokenAndPt",removeLiquiditySinglePt:"pendle/removeLiquiditySinglePt",pendleSwapExactTokenForYT:"pendle/swapExactTokenForYt",pendleSwapExactTokenForPt:"pendle/swapExactTokenForPt",pendleSwapExactPtForToken:"pendle/swapExactPtForToken",pendleSwapExactPtForYt:"pendle/swapExactPtForYt",pendleSwapExactYtForToken:"pendle/swapExactYtForToken",pendleSwapExactYtForPt:"pendle/swapExactYtForPt",pendleSyTokenInOut:"pendle/syTokenInOut",connextReceiveFee:(e,n)=>`/connextEstimateReceive/${e}/${n}`,stakedYield:"/staked-yield",getPublicWalletInformation:e=>`/get-public-wallet-data/${e}`}},d={getGasEstimate:(e,n,i,o,r)=>`/gas-estimation/${e}/${o}/${n}/${i}/${r}`,getTokenPrice:"/get-token-price",getTokenPriceEth:e=>`/get-token-price-in-eth/${e}`,getTokenPrices:"/get-token-prices",TRANSACT:"/general-transact",getIdleRelay:"/get-idle-relay"},p={getUserPoints:e=>`/user-points/${e}`},t="http://ec2-54-241-116-187.us-west-1.compute.amazonaws.com",a="http://ec2-18-144-10-166.us-west-1.compute.amazonaws.com",c="https://ethMainnet-data-server.hinkal.pro",R="http://localhost",h=7090,g={polygon:"https://polygon.server.hinkal.pro",arbMainnet:"https://arbMainnet.server.hinkal.pro",ethMainnet:"https://ethMainnet.server.hinkal.pro",bnbMainnet:"https://bnbMainnet.server.hinkal.pro",avalanche:"https://avalanche.server.hinkal.pro",optimism:"https://optimism.server.hinkal.pro",base:"https://base.server.hinkal.pro",localhost:"http://localhost:7072"},k={polygon:`${t}:7072`,arbMainnet:`${t}:7070`,ethMainnet:`${t}:7080`,bnbMainnet:`${t}:7076`,avalanche:`${t}:7078`,optimism:`${t}:7082`,base:`${t}:7084`,localhost:"http://localhost:7072"},S={polygon:`${a}:7072`,arbMainnet:`${a}:7070`,ethMainnet:`${a}:7080`,bnbMainnet:`${a}:7076`,avalanche:`${a}:7078`,optimism:`${a}:7082`,base:`${a}:7084`,localhost:"http://localhost:7072"},y={polygon:"https://polygon.relayer.hinkal.pro",arbMainnet:"https://arbMainnet.relayer.hinkal.pro",ethMainnet:"https://ethMainnet.relayer.hinkal.pro",bnbMainnet:"https://bnbMainnet.relayer.hinkal.pro",avalanche:"https://avalanche.relayer.hinkal.pro",optimism:"https://optimism.relayer.hinkal.pro",base:"https://base.relayer.hinkal.pro",localhost:"http://localhost:7073"},u={polygon:`${t}:7073`,arbMainnet:`${t}:7071`,ethMainnet:`${t}:7081`,bnbMainnet:`${t}:7077`,avalanche:`${t}:7079`,optimism:`${t}:7083`,base:`${t}:7085`,localhost:"http://localhost:7073"},L={polygon:`${a}:7073`,arbMainnet:`${a}:7071`,ethMainnet:`${a}:7081`,bnbMainnet:`${a}:7077`,avalanche:`${a}:7079`,optimism:`${a}:7083`,base:`${a}:7085`,localhost:"http://localhost:7073"};exports.API_CONFIG=l;exports.DATA_SERVER_CONFIG=p;exports.DATA_SERVER_PORT=h;exports.DATA_SERVER_URL_LOCAL=R;exports.DATA_SERVER_URL_PRODUCTION=c;exports.PLAYGROUND_RELAYER_URLS=L;exports.PLAYGROUND_SERVER_URLS=S;exports.PLAYGROUND_URL=a;exports.RELAYER_CONFIG=d;exports.RELAYER_URLS=y;exports.SERVER_URLS=g;exports.STAGING_RELAYER_URLS=u;exports.STAGING_SERVER_URLS=k;exports.STAGING_URL=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=(e,n)=>`${e}`,l={ROUTES:{checkKycStatus:"/check-kyc-status",getUserSignature:"/signature-request",startUserVerification:"/start-aiprise-verification",zkMeAccessToken:"/zkMeAccessToken",getCommitmentsSnapshot:"/snapshots/commitments",getAccessTokenSnapshot:"/snapshots/access-tokens",callOdosAPI:"/OdosSwapData",callOneInchAPI:"/OneInchSwapData",getOdosPriceForToken:e=>`/getOdosPriceForToken/${e}`,getNullifiers:"/snapshots/nullifiers",axelarGasEstimate:(e,n,i,o)=>`/axelarGasEstimate/${e}/${n}/${i}/${o}`,userHasAccessToken:e=>`/user-has-access-token/${e}`,afterKycCall:"/after-kyc-callback",restoreSnapshots:"/snapshots/restore",beefyGraphAPI:"/BeefyGraphData",monitor:"/monitor",checkRisk:e=>`/check-risk/${e}`,userVerifyTransactions:"/user-verify-transactions",verificationStartDate:e=>`/verification-start-date/${e}`,userGetTransactions:(e,n)=>`/user-get-transactions/${e}/${n}`,getActiveCode:e=>`/get-active-code/${e}`,updateActiveCode:"/update-active-code",getWeeklyReferralCodes:(e,n)=>`/get-weekly-referral-codes/${e}/${n}`,getReferralCodes:e=>s(`/get-referral-codes/${e}`),getRewardsHistory:e=>`/get-rewards-history/${e}`,addReferralCode:"/update-referral-code",getLpProgram:e=>s(`/getLpProgram/${e}`),points:(e,n)=>`/points/${e}/${n}`,leaderboard:e=>`/leaderboard/${e}`,setRewardsReceivingData:"/set-user-rewards-receiving-data",getRewardsReceivingData:e=>`/get-user-rewards-receiving-data/${e}`,seasonLeaderboard:e=>`/season-leaderboard/${e}`,getUserAnonymityStakingPoints:e=>`/hinkal-points/${e}`,getLimitedAnonymityStakingPoints:e=>`/hinkal-points/limited/${e}`,getUserAnonymityStakingReferralPoints:e=>`/hinkal-referral-codes-info/${e}`,userHasPassword:e=>`/user-has-password/${e}`,userRegisterPassword:"/user-register-password",getNickname:e=>`/get-nickname/${e}`,addNickname:"/update-nickname",getLidoDefiData:"lido/defi",getLidoStats:"lido/stats",getLidoEthStats:"lido/eth-stats",getLidoDiscount:"lido/discount",getLidoRequestTime:"lido/request-time",getLidoMaticReward:"lido/matic-rewards",pendleAddLiquiditySingleToken:"pendle/addLiquiditySingleToken",pendleAddLiquiditySingleSy:"pendle/addLiquiditySingleSy",pendleAddLiquiditySinglePt:"pendle/addLiquiditySinglePt",pendleAddLiquidityDualTokenAndPt:"pendle/addLiquidityDualTokenAndPt",pendleAddLiquidityDualSyAndPt:"pendle/addLiquidityDualSyAndPt",pendleAddLiquiditySingleTokenKeepYt:"pendle/addLiquiditySingleTokenKeepYt",pendleRemoveLiquiditySingleToken:"pendle/removeLiquiditySingleToken",pendleRemoveLiquiditySingleSy:"pendle/removeLiquiditySingleSy",pendleRemoveLiquiditySinglePt:"pendle/removeLiquiditySinglePt",pendleRemoveLiquidityDualTokenAndPt:"pendle/removeLiquidityDualTokenAndPt",pendleRemoveLiquidityDualSyAndPt:"pendle/removeLiquidityDualSyAndPt",pendleMintPyFromToken:"pendle/mintPyFromToken",pendlRedeemPyToToken:"pendle/redeemPyToToken",removeLiquidityDualTokenAndPt:"pendle/removeLiquidityDualTokenAndPt",removeLiquiditySinglePt:"pendle/removeLiquiditySinglePt",pendleSwapExactTokenForYT:"pendle/swapExactTokenForYt",pendleSwapExactTokenForPt:"pendle/swapExactTokenForPt",pendleSwapExactPtForToken:"pendle/swapExactPtForToken",pendleSwapExactPtForYt:"pendle/swapExactPtForYt",pendleSwapExactYtForToken:"pendle/swapExactYtForToken",pendleSwapExactYtForPt:"pendle/swapExactYtForPt",pendleSyTokenInOut:"pendle/syTokenInOut",connextReceiveFee:(e,n)=>`/connextEstimateReceive/${e}/${n}`,stakedYield:"/staked-yield",getPublicWalletInformation:e=>`/get-public-wallet-data/${e}`}},d={getGasEstimate:(e,n,i,o,r)=>`/gas-estimation/${e}/${o}/${n}/${i}/${r}`,getTokenPrice:"/get-token-price",getTokenPriceEth:e=>`/get-token-price-in-eth/${e}`,getTokenPrices:"/get-token-prices",TRANSACT:"/general-transact",getIdleRelay:"/get-idle-relay"},p={getUserPoints:e=>`/user-points/${e}`},t="http://ec2-54-241-116-187.us-west-1.compute.amazonaws.com",a="http://ec2-18-144-10-166.us-west-1.compute.amazonaws.com",c="https://ethMainnet-data-server.hinkal.pro",R="http://localhost",h=7090,g={polygon:"https://polygon.server.hinkal.pro",arbMainnet:"https://arbMainnet.server.hinkal.pro",ethMainnet:"https://ethMainnet.server.hinkal.pro",bnbMainnet:"https://bnbMainnet.server.hinkal.pro",avalanche:"https://avalanche.server.hinkal.pro",optimism:"https://optimism.server.hinkal.pro",base:"https://base.server.hinkal.pro",localhost:"http://localhost:7072"},k={polygon:`${t}:7072`,arbMainnet:`${t}:7070`,ethMainnet:`${t}:7080`,bnbMainnet:`${t}:7076`,avalanche:`${t}:7078`,optimism:`${t}:7082`,base:`${t}:7084`,localhost:"http://localhost:7072"},S={polygon:`${a}:7072`,arbMainnet:`${a}:7070`,ethMainnet:`${a}:7080`,bnbMainnet:`${a}:7076`,avalanche:`${a}:7078`,optimism:`${a}:7082`,base:`${a}:7084`,localhost:"http://localhost:7072"},y={polygon:"https://polygon.relayer.hinkal.pro",arbMainnet:"https://arbMainnet.relayer.hinkal.pro",ethMainnet:"https://ethMainnet.relayer.hinkal.pro",bnbMainnet:"https://bnbMainnet.relayer.hinkal.pro",avalanche:"https://avalanche.relayer.hinkal.pro",optimism:"https://optimism.relayer.hinkal.pro",base:"https://base.relayer.hinkal.pro",localhost:"http://localhost:7073"},u={polygon:`${t}:7073`,arbMainnet:`${t}:7071`,ethMainnet:`${t}:7081`,bnbMainnet:`${t}:7077`,avalanche:`${t}:7079`,optimism:`${t}:7083`,base:`${t}:7085`,localhost:"http://localhost:7073"},L={polygon:`${a}:7073`,arbMainnet:`${a}:7071`,ethMainnet:`${a}:7081`,bnbMainnet:`${a}:7077`,avalanche:`${a}:7079`,optimism:`${a}:7083`,base:`${a}:7085`,localhost:"http://localhost:7073"};exports.API_CONFIG=l;exports.DATA_SERVER_CONFIG=p;exports.DATA_SERVER_PORT=h;exports.DATA_SERVER_URL_LOCAL=R;exports.DATA_SERVER_URL_PRODUCTION=c;exports.PLAYGROUND_RELAYER_URLS=L;exports.PLAYGROUND_SERVER_URLS=S;exports.PLAYGROUND_URL=a;exports.RELAYER_CONFIG=d;exports.RELAYER_URLS=y;exports.SERVER_URLS=g;exports.STAGING_RELAYER_URLS=u;exports.STAGING_SERVER_URLS=k;exports.STAGING_URL=t;
@@ -1,4 +1,4 @@
1
- const s = (e, t) => `${e}${t !== void 0 ? `?week=${t}` : ""}`, l = {
1
+ const s = (e, n) => `${e}`, l = {
2
2
  ROUTES: {
3
3
  checkKycStatus: "/check-kyc-status",
4
4
  getUserSignature: "/signature-request",
@@ -10,7 +10,7 @@ const s = (e, t) => `${e}${t !== void 0 ? `?week=${t}` : ""}`, l = {
10
10
  callOneInchAPI: "/OneInchSwapData",
11
11
  getOdosPriceForToken: (e) => `/getOdosPriceForToken/${e}`,
12
12
  getNullifiers: "/snapshots/nullifiers",
13
- axelarGasEstimate: (e, t, i, o) => `/axelarGasEstimate/${e}/${t}/${i}/${o}`,
13
+ axelarGasEstimate: (e, n, i, o) => `/axelarGasEstimate/${e}/${n}/${i}/${o}`,
14
14
  userHasAccessToken: (e) => `/user-has-access-token/${e}`,
15
15
  afterKycCall: "/after-kyc-callback",
16
16
  restoreSnapshots: "/snapshots/restore",
@@ -19,15 +19,15 @@ const s = (e, t) => `${e}${t !== void 0 ? `?week=${t}` : ""}`, l = {
19
19
  checkRisk: (e) => `/check-risk/${e}`,
20
20
  userVerifyTransactions: "/user-verify-transactions",
21
21
  verificationStartDate: (e) => `/verification-start-date/${e}`,
22
- userGetTransactions: (e, t) => `/user-get-transactions/${e}/${t}`,
22
+ userGetTransactions: (e, n) => `/user-get-transactions/${e}/${n}`,
23
23
  getActiveCode: (e) => `/get-active-code/${e}`,
24
24
  updateActiveCode: "/update-active-code",
25
- getWeeklyReferralCodes: (e, t) => `/get-weekly-referral-codes/${e}/${t}`,
25
+ getWeeklyReferralCodes: (e, n) => `/get-weekly-referral-codes/${e}/${n}`,
26
26
  getReferralCodes: (e) => s(`/get-referral-codes/${e}`),
27
27
  getRewardsHistory: (e) => `/get-rewards-history/${e}`,
28
28
  addReferralCode: "/update-referral-code",
29
29
  getLpProgram: (e) => s(`/getLpProgram/${e}`),
30
- points: (e, t) => `/points/${e}/${t}`,
30
+ points: (e, n) => `/points/${e}/${n}`,
31
31
  leaderboard: (e) => `/leaderboard/${e}`,
32
32
  setRewardsReceivingData: "/set-user-rewards-receiving-data",
33
33
  getRewardsReceivingData: (e) => `/get-user-rewards-receiving-data/${e}`,
@@ -67,12 +67,12 @@ const s = (e, t) => `${e}${t !== void 0 ? `?week=${t}` : ""}`, l = {
67
67
  pendleSwapExactYtForToken: "pendle/swapExactYtForToken",
68
68
  pendleSwapExactYtForPt: "pendle/swapExactYtForPt",
69
69
  pendleSyTokenInOut: "pendle/syTokenInOut",
70
- connextReceiveFee: (e, t) => `/connextEstimateReceive/${e}/${t}`,
70
+ connextReceiveFee: (e, n) => `/connextEstimateReceive/${e}/${n}`,
71
71
  stakedYield: "/staked-yield",
72
72
  getPublicWalletInformation: (e) => `/get-public-wallet-data/${e}`
73
73
  }
74
74
  }, d = {
75
- getGasEstimate: (e, t, i, o, r) => `/gas-estimation/${e}/${o}/${t}/${i}/${r}`,
75
+ getGasEstimate: (e, n, i, o, r) => `/gas-estimation/${e}/${o}/${n}/${i}/${r}`,
76
76
  getTokenPrice: "/get-token-price",
77
77
  getTokenPriceEth: (e) => `/get-token-price-in-eth/${e}`,
78
78
  getTokenPrices: "/get-token-prices",
@@ -80,7 +80,7 @@ const s = (e, t) => `${e}${t !== void 0 ? `?week=${t}` : ""}`, l = {
80
80
  getIdleRelay: "/get-idle-relay"
81
81
  }, p = {
82
82
  getUserPoints: (e) => `/user-points/${e}`
83
- }, a = "http://ec2-54-241-116-187.us-west-1.compute.amazonaws.com", n = "http://ec2-18-144-10-166.us-west-1.compute.amazonaws.com", c = "https://ethMainnet-data-server.hinkal.pro", h = "http://localhost", g = 7090, k = {
83
+ }, t = "http://ec2-54-241-116-187.us-west-1.compute.amazonaws.com", a = "http://ec2-18-144-10-166.us-west-1.compute.amazonaws.com", c = "https://ethMainnet-data-server.hinkal.pro", h = "http://localhost", k = 7090, g = {
84
84
  polygon: "https://polygon.server.hinkal.pro",
85
85
  arbMainnet: "https://arbMainnet.server.hinkal.pro",
86
86
  ethMainnet: "https://ethMainnet.server.hinkal.pro",
@@ -90,6 +90,15 @@ const s = (e, t) => `${e}${t !== void 0 ? `?week=${t}` : ""}`, l = {
90
90
  base: "https://base.server.hinkal.pro",
91
91
  localhost: "http://localhost:7072"
92
92
  }, y = {
93
+ polygon: `${t}:7072`,
94
+ arbMainnet: `${t}:7070`,
95
+ ethMainnet: `${t}:7080`,
96
+ bnbMainnet: `${t}:7076`,
97
+ avalanche: `${t}:7078`,
98
+ optimism: `${t}:7082`,
99
+ base: `${t}:7084`,
100
+ localhost: "http://localhost:7072"
101
+ }, u = {
93
102
  polygon: `${a}:7072`,
94
103
  arbMainnet: `${a}:7070`,
95
104
  ethMainnet: `${a}:7080`,
@@ -98,15 +107,6 @@ const s = (e, t) => `${e}${t !== void 0 ? `?week=${t}` : ""}`, l = {
98
107
  optimism: `${a}:7082`,
99
108
  base: `${a}:7084`,
100
109
  localhost: "http://localhost:7072"
101
- }, u = {
102
- polygon: `${n}:7072`,
103
- arbMainnet: `${n}:7070`,
104
- ethMainnet: `${n}:7080`,
105
- bnbMainnet: `${n}:7076`,
106
- avalanche: `${n}:7078`,
107
- optimism: `${n}:7082`,
108
- base: `${n}:7084`,
109
- localhost: "http://localhost:7072"
110
110
  }, m = {
111
111
  polygon: "https://polygon.relayer.hinkal.pro",
112
112
  arbMainnet: "https://arbMainnet.relayer.hinkal.pro",
@@ -117,6 +117,15 @@ const s = (e, t) => `${e}${t !== void 0 ? `?week=${t}` : ""}`, l = {
117
117
  base: "https://base.relayer.hinkal.pro",
118
118
  localhost: "http://localhost:7073"
119
119
  }, $ = {
120
+ polygon: `${t}:7073`,
121
+ arbMainnet: `${t}:7071`,
122
+ ethMainnet: `${t}:7081`,
123
+ bnbMainnet: `${t}:7077`,
124
+ avalanche: `${t}:7079`,
125
+ optimism: `${t}:7083`,
126
+ base: `${t}:7085`,
127
+ localhost: "http://localhost:7073"
128
+ }, S = {
120
129
  polygon: `${a}:7073`,
121
130
  arbMainnet: `${a}:7071`,
122
131
  ethMainnet: `${a}:7081`,
@@ -125,29 +134,20 @@ const s = (e, t) => `${e}${t !== void 0 ? `?week=${t}` : ""}`, l = {
125
134
  optimism: `${a}:7083`,
126
135
  base: `${a}:7085`,
127
136
  localhost: "http://localhost:7073"
128
- }, S = {
129
- polygon: `${n}:7073`,
130
- arbMainnet: `${n}:7071`,
131
- ethMainnet: `${n}:7081`,
132
- bnbMainnet: `${n}:7077`,
133
- avalanche: `${n}:7079`,
134
- optimism: `${n}:7083`,
135
- base: `${n}:7085`,
136
- localhost: "http://localhost:7073"
137
137
  };
138
138
  export {
139
139
  l as API_CONFIG,
140
140
  p as DATA_SERVER_CONFIG,
141
- g as DATA_SERVER_PORT,
141
+ k as DATA_SERVER_PORT,
142
142
  h as DATA_SERVER_URL_LOCAL,
143
143
  c as DATA_SERVER_URL_PRODUCTION,
144
144
  S as PLAYGROUND_RELAYER_URLS,
145
145
  u as PLAYGROUND_SERVER_URLS,
146
- n as PLAYGROUND_URL,
146
+ a as PLAYGROUND_URL,
147
147
  d as RELAYER_CONFIG,
148
148
  m as RELAYER_URLS,
149
- k as SERVER_URLS,
149
+ g as SERVER_URLS,
150
150
  $ as STAGING_RELAYER_URLS,
151
151
  y as STAGING_SERVER_URLS,
152
- a as STAGING_URL
152
+ t as STAGING_URL
153
153
  };
@@ -1 +1 @@
1
- "use strict";var o=Object.create;var i=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var c=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty;var y=(b,t,e,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let u of s(t))!l.call(b,u)&&u!==e&&i(b,u,{get:()=>t[u],enumerable:!(a=r(t,u))||a.enumerable});return b};var j=(b,t,e)=>(e=b!=null?o(c(b)):{},y(t||!b||!b.__esModule?i(e,"default",{value:b,enumerable:!0}):e,b));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class d{babyjub=void 0;async init(){const t=await import("circomlibjs");this.babyjub=await t.buildBabyjub()}getJub(){return this.babyjub}}const n=new d,J=()=>n.getJub();exports.babyJubInstance=J;exports.jubHolder=n;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class u{babyjub=void 0;async init(t){this.babyjub||(this.babyjub=await t.buildBabyjub())}getJub(){return this.babyjub}}const b=new u,e=()=>b.getJub();exports.babyJubInstance=e;exports.jubHolder=b;
@@ -1,6 +1,6 @@
1
1
  declare class JubHolder {
2
2
  private babyjub;
3
- init(): Promise<void>;
3
+ init(circom: any): Promise<void>;
4
4
  getJub(): any;
5
5
  }
6
6
  export declare const jubHolder: JubHolder;
@@ -1,15 +1,14 @@
1
1
  class t {
2
2
  babyjub = void 0;
3
- async init() {
4
- const b = await import("circomlibjs");
5
- this.babyjub = await b.buildBabyjub();
3
+ async init(b) {
4
+ this.babyjub || (this.babyjub = await b.buildBabyjub());
6
5
  }
7
6
  getJub() {
8
7
  return this.babyjub;
9
8
  }
10
9
  }
11
- const a = new t(), i = () => a.getJub();
10
+ const u = new t(), e = () => u.getJub();
12
11
  export {
13
- i as babyJubInstance,
14
- a as jubHolder
12
+ e as babyJubInstance,
13
+ u as jubHolder
15
14
  };
@@ -1 +1 @@
1
- "use strict";var d=Object.create;var r=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var p=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty;var g=(n,o,e,s)=>{if(o&&typeof o=="object"||typeof o=="function")for(let i of u(o))!a.call(n,i)&&i!==e&&r(n,i,{get:()=>o[i],enumerable:!(s=c(o,i))||s.enumerable});return n};var l=(n,o,e)=>(e=n!=null?d(p(n)):{},g(o||!n||!n.__esModule?r(e,"default",{value:n,enumerable:!0}):e,n));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("ethers"),H=require("../functions/utils/amounts.utils.cjs");class P{poseidon=void 0;async init(){const o=await import("circomlibjs");this.poseidon=await o.buildPoseidon()}getPoseidon(){return this.poseidon}}const t=new P;function b(...n){const o=t.getPoseidon();return H.toBigInt(o.F.toString(o(n)))}const h=(...n)=>{const o=t.getPoseidon();return m.BigNumber.from(o.F.toString(o([...n]))).toHexString()};exports.poseidonFunction=b;exports.poseidonHash=h;exports.poseidonHolder=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("ethers"),t=require("../functions/utils/amounts.utils.cjs");class s{poseidon=void 0;async init(o){this.poseidon||(this.poseidon=await o.buildPoseidon())}getPoseidon(){return this.poseidon}}const n=new s;function r(...e){const o=n.getPoseidon();return t.toBigInt(o.F.toString(o(e)))}const d=(...e)=>{const o=n.getPoseidon();return i.BigNumber.from(o.F.toString(o([...e]))).toHexString()};exports.poseidonFunction=r;exports.poseidonHash=d;exports.poseidonHolder=n;
@@ -1,6 +1,6 @@
1
1
  declare class PoseidonHolder {
2
2
  private poseidon;
3
- init(): Promise<void>;
3
+ init(circom: any): Promise<void>;
4
4
  getPoseidon(): any;
5
5
  }
6
6
  export declare const poseidonHolder: PoseidonHolder;
@@ -2,25 +2,24 @@ import { BigNumber as t } from "ethers";
2
2
  import { toBigInt as e } from "../functions/utils/amounts.utils.mjs";
3
3
  class s {
4
4
  poseidon = void 0;
5
- async init() {
6
- const o = await import("circomlibjs");
7
- this.poseidon = await o.buildPoseidon();
5
+ async init(o) {
6
+ this.poseidon || (this.poseidon = await o.buildPoseidon());
8
7
  }
9
8
  getPoseidon() {
10
9
  return this.poseidon;
11
10
  }
12
11
  }
13
- const n = new s();
14
- function p(...i) {
15
- const o = n.getPoseidon();
16
- return e(o.F.toString(o(i)));
12
+ const i = new s();
13
+ function p(...n) {
14
+ const o = i.getPoseidon();
15
+ return e(o.F.toString(o(n)));
17
16
  }
18
- const c = (...i) => {
19
- const o = n.getPoseidon();
20
- return t.from(o.F.toString(o([...i]))).toHexString();
17
+ const c = (...n) => {
18
+ const o = i.getPoseidon();
19
+ return t.from(o.F.toString(o([...n]))).toHexString();
21
20
  };
22
21
  export {
23
22
  p as poseidonFunction,
24
23
  c as poseidonHash,
25
- n as poseidonHolder
24
+ i as poseidonHolder
26
25
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./babyJub.cjs"),o=require("./poseidon.cjs"),i=require("libsodium-wrappers"),s=require("process"),n=require("buffer");let e=!1;const t=async()=>{e||(typeof window<"u"&&(window.global=window,globalThis.Buffer=n.Buffer,globalThis.process=s),await Promise.all([i.ready,o.poseidonHolder.init(),r.jubHolder.init()]),e=!0)};exports.preProcessing=t;
1
+ "use strict";var c=Object.create;var s=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var u=Object.getPrototypeOf,f=Object.prototype.hasOwnProperty;var p=(e,o,r,n)=>{if(o&&typeof o=="object"||typeof o=="function")for(let i of l(o))!f.call(e,i)&&i!==r&&s(e,i,{get:()=>o[i],enumerable:!(n=d(o,i))||n.enumerable});return e};var a=(e,o,r)=>(r=e!=null?c(u(e)):{},p(o||!e||!e.__esModule?s(r,"default",{value:e,enumerable:!0}):r,e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("./babyJub.cjs"),g=require("./poseidon.cjs"),w=require("libsodium-wrappers"),y=require("process"),m=require("buffer");let t=!1;const h=async()=>{t||((typeof window<"u"||typeof WorkerGlobalScope<"u")&&(typeof window<"u"&&(window.global=window),globalThis.Buffer=m.Buffer,globalThis.process=y),import("circomlibjs").then(e=>Promise.all([w.ready,g.poseidonHolder.init(e),b.jubHolder.init(e)])).then(()=>{t=!0}).catch(e=>{console.log("circomlibjs import error",{error:e})}))};exports.preProcessing=h;
@@ -1,12 +1,16 @@
1
- import { jubHolder as r } from "./babyJub.mjs";
1
+ import { jubHolder as e } from "./babyJub.mjs";
2
2
  import { poseidonHolder as i } from "./poseidon.mjs";
3
- import e from "libsodium-wrappers";
4
- import s from "process";
3
+ import n from "libsodium-wrappers";
4
+ import t from "process";
5
5
  import { Buffer as f } from "buffer";
6
- let o = !1;
7
- const p = async () => {
8
- o || (typeof window < "u" && (window.global = window, globalThis.Buffer = f, globalThis.process = s), await Promise.all([e.ready, i.init(), r.init()]), o = !0);
6
+ let r = !1;
7
+ const c = async () => {
8
+ r || ((typeof window < "u" || typeof WorkerGlobalScope < "u") && (typeof window < "u" && (window.global = window), globalThis.Buffer = f, globalThis.process = t), import("circomlibjs").then((o) => Promise.all([n.ready, i.init(o), e.init(o)])).then(() => {
9
+ r = !0;
10
+ }).catch((o) => {
11
+ console.log("circomlibjs import error", { error: o });
12
+ }));
9
13
  };
10
14
  export {
11
- p as preProcessing
15
+ c as preProcessing
12
16
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("ethers"),l=require("libsodium-wrappers"),u=require("../utxo/Utxo.cjs"),p=require("./keys.cjs");var t={};const h=(e,i)=>{const o=[t.from(r.ethers.utils.hexlify(i?0n:e.amount)),t.from(r.ethers.utils.hexlify(e.erc20TokenAddress)),t.from(r.ethers.utils.hexlify(e.randomization)),t.from(e.getStealthAddress()),t.from(r.ethers.utils.hexlify(BigInt(e.timeStamp)))];e.tokenId>0&&o.push(t.from(r.ethers.utils.hexlify(e.tokenId)));const a=t.concat(o);return l.crypto_box_seal(a,r.ethers.utils.arrayify(e.getEncryptionKey()))},f=(e,i)=>{const{publicKey:o,privateKey:a}=p.UserKeys.getEncryptionKeyPair(i.getShieldedPrivateKey()),y=l.crypto_box_seal_open(e,r.ethers.utils.arrayify(o),r.ethers.utils.arrayify(a)),s=t.from(y).toString("utf-8").split("0x").filter(n=>n.length!==0).map((n,d)=>{let c;return[0,2,4,5].includes(d)?c=BigInt(`0x${n}`):[1,3].includes(d)&&(c=`0x${n}`),c});return{amount:s[0],erc20TokenAddress:s[1],randomization:s[2],stealthAddress:s[3],shieldedPrivateKey:i.getShieldedPrivateKey(),timeStamp:s[4].toString(),tokenId:s[5]?Number(s[5]):0}},m=(e,i)=>new u.Utxo(f(e,i));exports.decryptUtxo=m;exports.decryptUtxoConstructorArgs=f;exports.encryptUtxo=h;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("ethers"),y=require("libsodium-wrappers"),l=require("../utxo/Utxo.cjs"),u=require("./keys.cjs"),p=(e,s)=>{const i=[Buffer.from(t.ethers.utils.hexlify(s?0n:e.amount)),Buffer.from(t.ethers.utils.hexlify(e.erc20TokenAddress)),Buffer.from(t.ethers.utils.hexlify(e.randomization)),Buffer.from(e.getStealthAddress()),Buffer.from(t.ethers.utils.hexlify(BigInt(e.timeStamp)))];e.tokenId>0&&i.push(Buffer.from(t.ethers.utils.hexlify(e.tokenId)));const n=Buffer.concat(i);return y.crypto_box_seal(n,t.ethers.utils.arrayify(e.getEncryptionKey()))},d=(e,s)=>{const{publicKey:i,privateKey:n}=u.UserKeys.getEncryptionKeyPair(s.getShieldedPrivateKey()),c=y.crypto_box_seal_open(e,t.ethers.utils.arrayify(i),t.ethers.utils.arrayify(n)),r=Buffer.from(c).toString("utf-8").split("0x").filter(o=>o.length!==0).map((o,a)=>{let f;return[0,2,4,5].includes(a)?f=BigInt(`0x${o}`):[1,3].includes(a)&&(f=`0x${o}`),f});return{amount:r[0],erc20TokenAddress:r[1],randomization:r[2],stealthAddress:r[3],shieldedPrivateKey:s.getShieldedPrivateKey(),timeStamp:r[4].toString(),tokenId:r[5]?Number(r[5]):0}},h=(e,s)=>new l.Utxo(d(e,s));exports.decryptUtxo=h;exports.decryptUtxoConstructorArgs=d;exports.encryptUtxo=p;
@@ -1,41 +1,40 @@
1
- import { ethers as r } from "ethers";
1
+ import { ethers as t } from "ethers";
2
2
  import l from "libsodium-wrappers";
3
3
  import { Utxo as c } from "../utxo/Utxo.mjs";
4
- import { UserKeys as m } from "./keys.mjs";
5
- var e = {};
6
- const K = (t, o) => {
7
- const n = [
8
- e.from(r.utils.hexlify(o ? 0n : t.amount)),
9
- e.from(r.utils.hexlify(t.erc20TokenAddress)),
10
- e.from(r.utils.hexlify(t.randomization)),
11
- e.from(t.getStealthAddress()),
12
- e.from(r.utils.hexlify(BigInt(t.timeStamp)))
4
+ import { UserKeys as d } from "./keys.mjs";
5
+ const B = (e, i) => {
6
+ const o = [
7
+ Buffer.from(t.utils.hexlify(i ? 0n : e.amount)),
8
+ Buffer.from(t.utils.hexlify(e.erc20TokenAddress)),
9
+ Buffer.from(t.utils.hexlify(e.randomization)),
10
+ Buffer.from(e.getStealthAddress()),
11
+ Buffer.from(t.utils.hexlify(BigInt(e.timeStamp)))
13
12
  ];
14
- t.tokenId > 0 && n.push(e.from(r.utils.hexlify(t.tokenId)));
15
- const a = e.concat(n);
16
- return l.crypto_box_seal(a, r.utils.arrayify(t.getEncryptionKey()));
17
- }, p = (t, o) => {
18
- const { publicKey: n, privateKey: a } = m.getEncryptionKeyPair(o.getShieldedPrivateKey()), y = l.crypto_box_seal_open(
19
- t,
20
- r.utils.arrayify(n),
21
- r.utils.arrayify(a)
22
- ), i = e.from(y).toString("utf-8").split("0x").filter((s) => s.length !== 0).map((s, d) => {
23
- let f;
24
- return [0, 2, 4, 5].includes(d) ? f = BigInt(`0x${s}`) : [1, 3].includes(d) && (f = `0x${s}`), f;
13
+ e.tokenId > 0 && o.push(Buffer.from(t.utils.hexlify(e.tokenId)));
14
+ const n = Buffer.concat(o);
15
+ return l.crypto_box_seal(n, t.utils.arrayify(e.getEncryptionKey()));
16
+ }, m = (e, i) => {
17
+ const { publicKey: o, privateKey: n } = d.getEncryptionKeyPair(i.getShieldedPrivateKey()), a = l.crypto_box_seal_open(
18
+ e,
19
+ t.utils.arrayify(o),
20
+ t.utils.arrayify(n)
21
+ ), r = Buffer.from(a).toString("utf-8").split("0x").filter((f) => f.length !== 0).map((f, y) => {
22
+ let s;
23
+ return [0, 2, 4, 5].includes(y) ? s = BigInt(`0x${f}`) : [1, 3].includes(y) && (s = `0x${f}`), s;
25
24
  });
26
25
  return {
27
- amount: i[0],
28
- erc20TokenAddress: i[1],
29
- randomization: i[2],
30
- stealthAddress: i[3],
31
- shieldedPrivateKey: o.getShieldedPrivateKey(),
32
- timeStamp: i[4].toString(),
33
- tokenId: i[5] ? Number(i[5]) : 0
26
+ amount: r[0],
27
+ erc20TokenAddress: r[1],
28
+ randomization: r[2],
29
+ stealthAddress: r[3],
30
+ shieldedPrivateKey: i.getShieldedPrivateKey(),
31
+ timeStamp: r[4].toString(),
32
+ tokenId: r[5] ? Number(r[5]) : 0
34
33
  // tokenId
35
34
  };
36
- }, S = (t, o) => new c(p(t, o));
35
+ }, x = (e, i) => new c(m(e, i));
37
36
  export {
38
- S as decryptUtxo,
39
- p as decryptUtxoConstructorArgs,
40
- K as encryptUtxo
37
+ x as decryptUtxo,
38
+ m as decryptUtxoConstructorArgs,
39
+ B as encryptUtxo
41
40
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("../../constants/chains.constants.cjs");require("../../constants/vite.constants.cjs");require("axios");require("../../constants/coingecko.constants.cjs");const g=require("../../API/API.cjs");require("ethers");require("../../types/curve.types.cjs");const A=require("../../constants/contracts.constants.cjs");require("../../constants/kyc.constants.cjs");require("../../constants/axelar.constants.cjs");require("../../constants/rewards.constants.cjs");require("../../constants/reorg-depths.constants.cjs");const k=require("../../functions/snarkjs/generateZkProof.cjs");require("../../types/circom-data.types.cjs");const I=require("../../types/transactions.types.cjs"),q=require("../../types/time.types.cjs"),x=require("./history/getTxDetails.cjs"),P=require("../../error-handling/error-codes.constants.cjs"),C=require("../crypto-keys/keys.cjs"),w=require("../crypto-keys/encryptDecryptUtxo.cjs"),p=require("../../functions/utils/getDataFromTransaction.cjs"),S=require("../../functions/utils/cacheFunctions.cjs");var v={};class H{circuitSize=50;hinkalContract;init(e){this.hinkalContract=e}requireInit(){if(!this.hinkalContract)throw Error("TransactionsManager not initialized")}filterOwnTransactions=async(e,r,t,a)=>{const{transactMethodId:s,transactWithExternalActionMethodId:n,hinkalInterface:i}=A.getHinkalParameters(T.getNonLocalhostChainId(e)),c=o=>"decodedInput"in o,l=r.filter(o=>o.methodId===s||o.methodId===n).map(o=>c(o)?o:{...o,decodedInput:p.decodeTxInput(i,o.input),status:o.isError==="0"?"SUCCESS":"FAILURE"}),h=t.getShieldedPrivateKey();return l.filter(o=>{try{if(c(o)){if(w.decryptUtxo(v.from(o.decodedInput.encryptedOutputs[0].slice(2),"hex"),t),!a&&o.methodId===s){const{extraRandomization:f,H0:y,H1:m}=o.decodedInput.stealthAddressStructure;return C.UserKeys.checkSignature(f,y,m,h)}return!0}return!1}catch{return!1}})};saveTxsInStorage=(e,r,t,a)=>{const s=t.getShieldedPublicKey();return S.saveTxsCache(e,r,s,this.hinkalContract.address,a)};loadTxsFromStorage=async(e,r)=>{const t=r.getShieldedPublicKey();return await S.loadTxsCache(e,t,this.hinkalContract.address)};getAllTransactions=async(e,r,t)=>{if(t){const{transactions:i}=await g.API.userGetTransactions(e,t);return i}const{decodedTxs:a,lastHash:s}=await this.loadTxsFromStorage(e,r),{transactions:n}=await g.API.userGetTransactions(e,t,s);return[...n,...a]};getHinkalHistoryBase=async(e,r,t,a=!1)=>{this.requireInit();const s=await this.getAllTransactions(e,r,t)??[];s.sort((i,c)=>c.timeStamp-i.timeStamp);const n=await this.filterOwnTransactions(e,s,r,a);return!t&&s.length>0&&await this.saveTxsInStorage(n,e,r,s[0].hash),n};getHinkalHistory=async(e,r)=>{const t=await this.getHinkalHistoryBase(e,r,void 0,!0),a=p.decodeTxLogs(e,t);return await Promise.all(a.map(async n=>({...n,status:n.status,details:await x.getTxDetails(e,n.decodedInput,n.utxosArray)})))};sortInBatches=e=>{const r=[];let t=0,a=0;e.forEach(i=>{t===0&&r.push([]),r[a].push(i),t+=1,t===this.circuitSize&&(t=0,a+=1)});const s=r[r.length-1],n=s.length;if(n<this.circuitSize){const i=this.circuitSize-n,c=new Array(i).fill(I.emptyDecodedTx);r[r.length-1]=s.concat(c)}return r};generateTransactionsProof=async(e,r,t)=>{const a=this.sortInBatches(r),s=new Array(a.length).fill([]);for(let n=0;n<a.length;n+=1){const i=a[n].map(d=>d.decodedInput.stealthAddressStructure),c=i.map(d=>d.extraRandomization),u=i.map(d=>d.stealthAddress);console.log({extraRandomizations:c,stealthAddresses:u});const l={shieldedPrivateKey:t,extraRandomizations:c,stealthAddresses:u};console.log({chainId:e,input:l});const{zkCallData:h}=await k.generateZkProof(e,"transactionsProver",l);console.log({zkCallData:h}),s[n]=h}return{zkCallDataArray:s}};userVerifyTransactions=async(e,r,t,a,s,n)=>await g.API.userVerifyTransactions(e,r,t,a,s,n);processAndSendTransactionsForVerification=async(e,r,t,a)=>{this.requireInit();const s=q.getCurrentWeek(),n=a?s-1:s;console.log("retrieving transactions in processAndSendTransactionsForVerification",{week:n});const i=await this.getHinkalHistoryBase(e,r,n);console.log("retrieved transactions",i);let c=[],u=[];i.length>0&&({zkCallDataArray:u}=await this.generateTransactionsProof(e,i,r.getShieldedPrivateKey()),c=i.map(y=>y.hash));const l=r.getBackendToken(),{trade:h,transactions:d,lockedDeposit:o,verification:f}=await this.userVerifyTransactions(e,c,u,l,t,n);return{trade:h,transactions:d,lockedDeposit:o,verification:f}};multiProcessAndSendTransactionsForVerification=async(e,r)=>{console.log("Multi Certify Starts");const t=T.chainIdsByType[T.EthereumNetworkType.Mainnet];let a=!0;for(let s=0;s<t.length;s+=1)try{const{hasCertified:n}=await g.API.verificationStartDate(t[s],r);if(console.log(`certification status for chain ${t[s]} is ${n}`),n)continue;const{trade:i,transactions:c,lockedDeposit:u,verification:l}=await this.processAndSendTransactionsForVerification(t[s],e,r,!0);if(console.log({chainId:t[s],trade:i,totalTransactions:c,lockedDeposit:u,verification:l}),a=a&&l,!a)break}catch(n){console.log(`current chain ${t[s]} certification error`,{err:n}),a=!1;break}if(!a)throw Error(P.transactionErrorCodes.MULTI_VERIFICATION_FAILED);return!0}}exports.TransactionsManager=H;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("../../constants/chains.constants.cjs");require("../../constants/vite.constants.cjs");require("axios");require("../../constants/coingecko.constants.cjs");const f=require("../../API/API.cjs");require("ethers");require("../../types/curve.types.cjs");const A=require("../../constants/contracts.constants.cjs");require("../../constants/kyc.constants.cjs");require("../../constants/axelar.constants.cjs");require("../../constants/rewards.constants.cjs");require("../../constants/reorg-depths.constants.cjs");const k=require("../../functions/snarkjs/generateZkProof.cjs");require("../../types/circom-data.types.cjs");const I=require("../../types/transactions.types.cjs"),q=require("../../types/time.types.cjs"),x=require("./history/getTxDetails.cjs"),P=require("../../error-handling/error-codes.constants.cjs"),C=require("../crypto-keys/keys.cjs"),w=require("../crypto-keys/encryptDecryptUtxo.cjs"),p=require("../../functions/utils/getDataFromTransaction.cjs"),S=require("../../functions/utils/cacheFunctions.cjs");class v{circuitSize=50;hinkalContract;init(e){this.hinkalContract=e}requireInit(){if(!this.hinkalContract)throw Error("TransactionsManager not initialized")}filterOwnTransactions=async(e,r,t,a)=>{const{transactMethodId:s,transactWithExternalActionMethodId:n,hinkalInterface:i}=A.getHinkalParameters(T.getNonLocalhostChainId(e)),c=o=>"decodedInput"in o,l=r.filter(o=>o.methodId===s||o.methodId===n).map(o=>c(o)?o:{...o,decodedInput:p.decodeTxInput(i,o.input),status:o.isError==="0"?"SUCCESS":"FAILURE"}),h=t.getShieldedPrivateKey();return l.filter(o=>{try{if(c(o)){if(w.decryptUtxo(Buffer.from(o.decodedInput.encryptedOutputs[0].slice(2),"hex"),t),!a&&o.methodId===s){const{extraRandomization:g,H0:y,H1:m}=o.decodedInput.stealthAddressStructure;return C.UserKeys.checkSignature(g,y,m,h)}return!0}return!1}catch{return!1}})};saveTxsInStorage=(e,r,t,a)=>{const s=t.getShieldedPublicKey();return S.saveTxsCache(e,r,s,this.hinkalContract.address,a)};loadTxsFromStorage=async(e,r)=>{const t=r.getShieldedPublicKey();return await S.loadTxsCache(e,t,this.hinkalContract.address)};getAllTransactions=async(e,r,t)=>{if(t){const{transactions:i}=await f.API.userGetTransactions(e,t);return i}const{decodedTxs:a,lastHash:s}=await this.loadTxsFromStorage(e,r),{transactions:n}=await f.API.userGetTransactions(e,t,s);return[...n,...a]};getHinkalHistoryBase=async(e,r,t,a=!1)=>{this.requireInit();const s=await this.getAllTransactions(e,r,t)??[];s.sort((i,c)=>c.timeStamp-i.timeStamp);const n=await this.filterOwnTransactions(e,s,r,a);return!t&&s.length>0&&await this.saveTxsInStorage(n,e,r,s[0].hash),n};getHinkalHistory=async(e,r)=>{const t=await this.getHinkalHistoryBase(e,r,void 0,!0),a=p.decodeTxLogs(e,t);return await Promise.all(a.map(async n=>({...n,status:n.status,details:await x.getTxDetails(e,n.decodedInput,n.utxosArray)})))};sortInBatches=e=>{const r=[];let t=0,a=0;e.forEach(i=>{t===0&&r.push([]),r[a].push(i),t+=1,t===this.circuitSize&&(t=0,a+=1)});const s=r[r.length-1],n=s.length;if(n<this.circuitSize){const i=this.circuitSize-n,c=new Array(i).fill(I.emptyDecodedTx);r[r.length-1]=s.concat(c)}return r};generateTransactionsProof=async(e,r,t)=>{const a=this.sortInBatches(r),s=new Array(a.length).fill([]);for(let n=0;n<a.length;n+=1){const i=a[n].map(d=>d.decodedInput.stealthAddressStructure),c=i.map(d=>d.extraRandomization),u=i.map(d=>d.stealthAddress);console.log({extraRandomizations:c,stealthAddresses:u});const l={shieldedPrivateKey:t,extraRandomizations:c,stealthAddresses:u};console.log({chainId:e,input:l});const{zkCallData:h}=await k.generateZkProof(e,"transactionsProver",l);console.log({zkCallData:h}),s[n]=h}return{zkCallDataArray:s}};userVerifyTransactions=async(e,r,t,a,s,n)=>await f.API.userVerifyTransactions(e,r,t,a,s,n);processAndSendTransactionsForVerification=async(e,r,t,a)=>{this.requireInit();const s=q.getCurrentWeek(),n=a?s-1:s;console.log("retrieving transactions in processAndSendTransactionsForVerification",{week:n});const i=await this.getHinkalHistoryBase(e,r,n);console.log("retrieved transactions",i);let c=[],u=[];i.length>0&&({zkCallDataArray:u}=await this.generateTransactionsProof(e,i,r.getShieldedPrivateKey()),c=i.map(y=>y.hash));const l=r.getBackendToken(),{trade:h,transactions:d,lockedDeposit:o,verification:g}=await this.userVerifyTransactions(e,c,u,l,t,n);return{trade:h,transactions:d,lockedDeposit:o,verification:g}};multiProcessAndSendTransactionsForVerification=async(e,r)=>{console.log("Multi Certify Starts");const t=T.chainIdsByType[T.EthereumNetworkType.Mainnet];let a=!0;for(let s=0;s<t.length;s+=1)try{const{hasCertified:n}=await f.API.verificationStartDate(t[s],r);if(console.log(`certification status for chain ${t[s]} is ${n}`),n)continue;const{trade:i,transactions:c,lockedDeposit:u,verification:l}=await this.processAndSendTransactionsForVerification(t[s],e,r,!0);if(console.log({chainId:t[s],trade:i,totalTransactions:c,lockedDeposit:u,verification:l}),a=a&&l,!a)break}catch(n){console.log(`current chain ${t[s]} certification error`,{err:n}),a=!1;break}if(!a)throw Error(P.transactionErrorCodes.MULTI_VERIFICATION_FAILED);return!0}}exports.TransactionsManager=v;
@@ -16,12 +16,11 @@ import { emptyDecodedTx as I } from "../../types/transactions.types.mjs";
16
16
  import { getCurrentWeek as x } from "../../types/time.types.mjs";
17
17
  import { getTxDetails as w } from "./history/getTxDetails.mjs";
18
18
  import { transactionErrorCodes as C } from "../../error-handling/error-codes.constants.mjs";
19
- import { UserKeys as v } from "../crypto-keys/keys.mjs";
20
- import { decryptUtxo as P } from "../crypto-keys/encryptDecryptUtxo.mjs";
19
+ import { UserKeys as P } from "../crypto-keys/keys.mjs";
20
+ import { decryptUtxo as v } from "../crypto-keys/encryptDecryptUtxo.mjs";
21
21
  import { decodeTxInput as H, decodeTxLogs as z } from "../../functions/utils/getDataFromTransaction.mjs";
22
22
  import { saveTxsCache as E, loadTxsCache as b } from "../../functions/utils/cacheFunctions.mjs";
23
- var F = {};
24
- class et {
23
+ class rt {
25
24
  circuitSize = 50;
26
25
  hinkalContract;
27
26
  init(r) {
@@ -44,9 +43,9 @@ class et {
44
43
  return l.filter((o) => {
45
44
  try {
46
45
  if (c(o)) {
47
- if (P(F.from(o.decodedInput.encryptedOutputs[0].slice(2), "hex"), t), !n && o.methodId === a) {
46
+ if (v(Buffer.from(o.decodedInput.encryptedOutputs[0].slice(2), "hex"), t), !n && o.methodId === a) {
48
47
  const { extraRandomization: f, H0: p, H1: g } = o.decodedInput.stealthAddressStructure;
49
- return v.checkSignature(f, p, g, u);
48
+ return P.checkSignature(f, p, g, u);
50
49
  }
51
50
  return !0;
52
51
  }
@@ -182,5 +181,5 @@ class et {
182
181
  };
183
182
  }
184
183
  export {
185
- et as TransactionsManager
184
+ rt as TransactionsManager
186
185
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("ethers"),u=require("../../constants/protocol.constants.cjs"),c=require("../../data-structures/crypto-keys/keys.cjs"),h=require("../../data-structures/crypto-keys/encryptDecryptUtxo.cjs"),S=require("../../types/circom-data.types.cjs"),m=require("../utils/external-action.utils.cjs");var A={};const C=(t,e)=>t.map((r,n)=>r.map(s=>e[n]?"0":s.getNullifier())),p=(t,e)=>t.map((r,n)=>r.map(s=>e[n]?"0":s.getCommitment())),f=(t,e,r=!1)=>{const n=[];for(let s=0;s<t.length;s+=1){let a=0n,l=0n;for(let i=0;i<t[s].length;i+=1)a+=t[s][i].amount;for(let i=0;i<e[s].length;i+=1)l+=e[s][i].amount;l-a<0?r?n.push(l-a):n.push(u.CIRCOM_P+(l-a)):n.push(l-a)}return n},b=(t,e)=>{const r=[[""]];for(let n=0;n<t.length;n+=1)n>0&&r.push([""]),t[n].forEach((s,a)=>{r[n][a]=`0x${A.from(h.encryptUtxo(s,e)).toString("hex")}`});return r},H=(t,e)=>{const r=[];for(let s=0;s<t.length;s+=1){r.push([]);for(let a=0;a<t[s].length;a+=1)r[s][a]=e.getSiblingHashesForVerification(BigInt(t[s][a].getCommitment())).map(l=>l.toString())}const n=[];for(let s=0;s<t.length;s+=1){n.push([]);for(let a=0;a<t[s].length;a+=1)n[s][a]=e.getSiblingSides(BigInt(t[s][a].getCommitment())).map(l=>l.toString())}return{inCommitmentSiblings:r,inCommitmentSiblingSides:n}},y=(t,e)=>{const r=e.getSiblingHashesForVerification(BigInt(t.getAccessKey())).map(s=>s.toString()),n=e.getSiblingSides(BigInt(t.getAccessKey())).map(s=>s.toString());return{accessTokenSiblings:r,accessTokenSiblingSides:n}},I=t=>{const e={...t};return e.amountChanges=t.amountChanges.map(r=>r.toString()),e.calldataHash=t.calldataHash.toString(),e.rootHashAccessToken=t.rootHashAccessToken?.toString(),e.stealthAddressStructure.extraRandomization=t.stealthAddressStructure.extraRandomization.toString(),e.stealthAddressStructure.stealthAddress=t.stealthAddressStructure.stealthAddress.toString(),e.stealthAddressStructure.H0=t.stealthAddressStructure.H0.toString(),e.stealthAddressStructure.H1=t.stealthAddressStructure.H1.toString(),e.rootHashHinkal=t.rootHashHinkal?.toString(),e.externalActionId=t.externalActionId?.toString(),e.flatFees=t.flatFees.map(r=>r.toString()),e},k=t=>{const e={...t};return e.amountChanges=t.amountChanges.map(r=>BigInt(r)),e.calldataHash=BigInt(t.calldataHash),e.rootHashAccessToken=BigInt(t.rootHashAccessToken),e.rootHashHinkal=BigInt(t.rootHashHinkal),e.externalActionId=BigInt(t.externalActionId),e},B=(t,e,r,n,s,a,l,i)=>{const d=Object.values(i||S.defaultHookData),g=o.ethers.utils.defaultAbiCoder.encode(["uint16","address","address","uint256","bytes","tuple(address, address, bytes, bytes)","bytes[][]","uint256[]"],[t,e,r,typeof n=="bigint"?n:m.getExternalActionIdHash(n),s,d,a,l]);return BigInt(o.ethers.utils.keccak256(g))%u.CIRCOM_P},O=t=>t.startsWith("swapperMO")||t.startsWith("swapperME")?2:t.startsWith("swapperMW")?1:0,T=(t,e,r,n,s,a)=>{const l=O(t);return 9+e.length+r.length+n.flat().length+s.length+l+a},_=(t,e)=>{const{h0:r,h1:n}=c.UserKeys.getStealthAddressCompressedPoints(t,e),s=BigInt(c.UserKeys.getStealthAddress(t,e));return{extraRandomization:t,H0:r,H1:n,stealthAddress:s}};exports.buildInNullifiers=C;exports.buildOutCommitments=p;exports.calcAccessTokenSiblingsAndSides=y;exports.calcAmountChanges=f;exports.calcCommitmentsSiblingAndSides=H;exports.calcEncryptedOutputs=b;exports.calcPublicSignalCount=T;exports.calcStealthAddressStructure=_;exports.createCallDataHash=B;exports.deserializeCircomData=k;exports.serializeCircomData=I;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("ethers"),u=require("../../constants/protocol.constants.cjs"),c=require("../../data-structures/crypto-keys/keys.cjs"),h=require("../../data-structures/crypto-keys/encryptDecryptUtxo.cjs"),S=require("../../types/circom-data.types.cjs"),m=require("../utils/external-action.utils.cjs"),A=(t,e)=>t.map((r,n)=>r.map(s=>e[n]?"0":s.getNullifier())),C=(t,e)=>t.map((r,n)=>r.map(s=>e[n]?"0":s.getCommitment())),p=(t,e,r=!1)=>{const n=[];for(let s=0;s<t.length;s+=1){let l=0n,a=0n;for(let i=0;i<t[s].length;i+=1)l+=t[s][i].amount;for(let i=0;i<e[s].length;i+=1)a+=e[s][i].amount;a-l<0?r?n.push(a-l):n.push(u.CIRCOM_P+(a-l)):n.push(a-l)}return n},b=(t,e)=>{const r=[[""]];for(let n=0;n<t.length;n+=1)n>0&&r.push([""]),t[n].forEach((s,l)=>{r[n][l]=`0x${Buffer.from(h.encryptUtxo(s,e)).toString("hex")}`});return r},f=(t,e)=>{const r=[];for(let s=0;s<t.length;s+=1){r.push([]);for(let l=0;l<t[s].length;l+=1)r[s][l]=e.getSiblingHashesForVerification(BigInt(t[s][l].getCommitment())).map(a=>a.toString())}const n=[];for(let s=0;s<t.length;s+=1){n.push([]);for(let l=0;l<t[s].length;l+=1)n[s][l]=e.getSiblingSides(BigInt(t[s][l].getCommitment())).map(a=>a.toString())}return{inCommitmentSiblings:r,inCommitmentSiblingSides:n}},H=(t,e)=>{const r=e.getSiblingHashesForVerification(BigInt(t.getAccessKey())).map(s=>s.toString()),n=e.getSiblingSides(BigInt(t.getAccessKey())).map(s=>s.toString());return{accessTokenSiblings:r,accessTokenSiblingSides:n}},y=t=>{const e={...t};return e.amountChanges=t.amountChanges.map(r=>r.toString()),e.calldataHash=t.calldataHash.toString(),e.rootHashAccessToken=t.rootHashAccessToken?.toString(),e.stealthAddressStructure.extraRandomization=t.stealthAddressStructure.extraRandomization.toString(),e.stealthAddressStructure.stealthAddress=t.stealthAddressStructure.stealthAddress.toString(),e.stealthAddressStructure.H0=t.stealthAddressStructure.H0.toString(),e.stealthAddressStructure.H1=t.stealthAddressStructure.H1.toString(),e.rootHashHinkal=t.rootHashHinkal?.toString(),e.externalActionId=t.externalActionId?.toString(),e.flatFees=t.flatFees.map(r=>r.toString()),e},I=t=>{const e={...t};return e.amountChanges=t.amountChanges.map(r=>BigInt(r)),e.calldataHash=BigInt(t.calldataHash),e.rootHashAccessToken=BigInt(t.rootHashAccessToken),e.rootHashHinkal=BigInt(t.rootHashHinkal),e.externalActionId=BigInt(t.externalActionId),e},k=(t,e,r,n,s,l,a,i)=>{const d=Object.values(i||S.defaultHookData),g=o.ethers.utils.defaultAbiCoder.encode(["uint16","address","address","uint256","bytes","tuple(address, address, bytes, bytes)","bytes[][]","uint256[]"],[t,e,r,typeof n=="bigint"?n:m.getExternalActionIdHash(n),s,d,l,a]);return BigInt(o.ethers.utils.keccak256(g))%u.CIRCOM_P},B=t=>t.startsWith("swapperMO")||t.startsWith("swapperME")?2:t.startsWith("swapperMW")?1:0,O=(t,e,r,n,s,l)=>{const a=B(t);return 9+e.length+r.length+n.flat().length+s.length+a+l},T=(t,e)=>{const{h0:r,h1:n}=c.UserKeys.getStealthAddressCompressedPoints(t,e),s=BigInt(c.UserKeys.getStealthAddress(t,e));return{extraRandomization:t,H0:r,H1:n,stealthAddress:s}};exports.buildInNullifiers=A;exports.buildOutCommitments=C;exports.calcAccessTokenSiblingsAndSides=H;exports.calcAmountChanges=p;exports.calcCommitmentsSiblingAndSides=f;exports.calcEncryptedOutputs=b;exports.calcPublicSignalCount=O;exports.calcStealthAddressStructure=T;exports.createCallDataHash=k;exports.deserializeCircomData=I;exports.serializeCircomData=y;
@@ -4,8 +4,7 @@ import { UserKeys as g } from "../../data-structures/crypto-keys/keys.mjs";
4
4
  import { encryptUtxo as h } from "../../data-structures/crypto-keys/encryptDecryptUtxo.mjs";
5
5
  import { defaultHookData as S } from "../../types/circom-data.types.mjs";
6
6
  import { getExternalActionIdHash as m } from "../utils/external-action.utils.mjs";
7
- var f = {};
8
- const B = (t, e) => t.map((r, n) => r.map((s) => e[n] ? "0" : s.getNullifier())), y = (t, e) => t.map((r, n) => r.map((s) => e[n] ? "0" : s.getCommitment())), O = (t, e, r = !1) => {
7
+ const k = (t, e) => t.map((r, n) => r.map((s) => e[n] ? "0" : s.getNullifier())), B = (t, e) => t.map((r, n) => r.map((s) => e[n] ? "0" : s.getCommitment())), y = (t, e, r = !1) => {
9
8
  const n = [];
10
9
  for (let s = 0; s < t.length; s += 1) {
11
10
  let o = 0n, l = 0n;
@@ -16,14 +15,14 @@ const B = (t, e) => t.map((r, n) => r.map((s) => e[n] ? "0" : s.getNullifier()))
16
15
  l - o < 0 ? r ? n.push(l - o) : n.push(u + (l - o)) : n.push(l - o);
17
16
  }
18
17
  return n;
19
- }, T = (t, e) => {
18
+ }, O = (t, e) => {
20
19
  const r = [[""]];
21
20
  for (let n = 0; n < t.length; n += 1)
22
21
  n > 0 && r.push([""]), t[n].forEach((s, o) => {
23
- r[n][o] = `0x${f.from(h(s, e)).toString("hex")}`;
22
+ r[n][o] = `0x${Buffer.from(h(s, e)).toString("hex")}`;
24
23
  });
25
24
  return r;
26
- }, j = (t, e) => {
25
+ }, T = (t, e) => {
27
26
  const r = [];
28
27
  for (let s = 0; s < t.length; s += 1) {
29
28
  r.push([]);
@@ -37,16 +36,16 @@ const B = (t, e) => t.map((r, n) => r.map((s) => e[n] ? "0" : s.getNullifier()))
37
36
  n[s][o] = e.getSiblingSides(BigInt(t[s][o].getCommitment())).map((l) => l.toString());
38
37
  }
39
38
  return { inCommitmentSiblings: r, inCommitmentSiblingSides: n };
40
- }, E = (t, e) => {
39
+ }, j = (t, e) => {
41
40
  const r = e.getSiblingHashesForVerification(BigInt(t.getAccessKey())).map((s) => s.toString()), n = e.getSiblingSides(BigInt(t.getAccessKey())).map((s) => s.toString());
42
41
  return { accessTokenSiblings: r, accessTokenSiblingSides: n };
43
- }, F = (t) => {
42
+ }, E = (t) => {
44
43
  const e = { ...t };
45
44
  return e.amountChanges = t.amountChanges.map((r) => r.toString()), e.calldataHash = t.calldataHash.toString(), e.rootHashAccessToken = t.rootHashAccessToken?.toString(), e.stealthAddressStructure.extraRandomization = t.stealthAddressStructure.extraRandomization.toString(), e.stealthAddressStructure.stealthAddress = t.stealthAddressStructure.stealthAddress.toString(), e.stealthAddressStructure.H0 = t.stealthAddressStructure.H0.toString(), e.stealthAddressStructure.H1 = t.stealthAddressStructure.H1.toString(), e.rootHashHinkal = t.rootHashHinkal?.toString(), e.externalActionId = t.externalActionId?.toString(), e.flatFees = t.flatFees.map((r) => r.toString()), e;
46
- }, M = (t) => {
45
+ }, F = (t) => {
47
46
  const e = { ...t };
48
47
  return e.amountChanges = t.amountChanges.map((r) => BigInt(r)), e.calldataHash = BigInt(t.calldataHash), e.rootHashAccessToken = BigInt(t.rootHashAccessToken), e.rootHashHinkal = BigInt(t.rootHashHinkal), e.externalActionId = BigInt(t.externalActionId), e;
49
- }, W = (t, e, r, n, s, o, l, a) => {
48
+ }, M = (t, e, r, n, s, o, l, a) => {
50
49
  const d = Object.values(a || S), c = i.utils.defaultAbiCoder.encode(
51
50
  [
52
51
  "uint16",
@@ -70,10 +69,10 @@ const B = (t, e) => t.map((r, n) => r.map((s) => e[n] ? "0" : s.getNullifier()))
70
69
  ]
71
70
  );
72
71
  return BigInt(i.utils.keccak256(c)) % u;
73
- }, p = (t) => t.startsWith("swapperMO") || t.startsWith("swapperME") ? 2 : t.startsWith("swapperMW") ? 1 : 0, w = (t, e, r, n, s, o) => {
74
- const l = p(t);
72
+ }, f = (t) => t.startsWith("swapperMO") || t.startsWith("swapperME") ? 2 : t.startsWith("swapperMW") ? 1 : 0, W = (t, e, r, n, s, o) => {
73
+ const l = f(t);
75
74
  return 9 + e.length + r.length + n.flat().length + s.length + l + o;
76
- }, z = (t, e) => {
75
+ }, w = (t, e) => {
77
76
  const { h0: r, h1: n } = g.getStealthAddressCompressedPoints(t, e), s = BigInt(g.getStealthAddress(t, e));
78
77
  return {
79
78
  extraRandomization: t,
@@ -83,15 +82,15 @@ const B = (t, e) => t.map((r, n) => r.map((s) => e[n] ? "0" : s.getNullifier()))
83
82
  };
84
83
  };
85
84
  export {
86
- B as buildInNullifiers,
87
- y as buildOutCommitments,
88
- E as calcAccessTokenSiblingsAndSides,
89
- O as calcAmountChanges,
90
- j as calcCommitmentsSiblingAndSides,
91
- T as calcEncryptedOutputs,
92
- w as calcPublicSignalCount,
93
- z as calcStealthAddressStructure,
94
- W as createCallDataHash,
95
- M as deserializeCircomData,
96
- F as serializeCircomData
85
+ k as buildInNullifiers,
86
+ B as buildOutCommitments,
87
+ j as calcAccessTokenSiblingsAndSides,
88
+ y as calcAmountChanges,
89
+ T as calcCommitmentsSiblingAndSides,
90
+ O as calcEncryptedOutputs,
91
+ W as calcPublicSignalCount,
92
+ w as calcStealthAddressStructure,
93
+ M as createCallDataHash,
94
+ F as deserializeCircomData,
95
+ E as serializeCircomData
97
96
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("ethers"),p=require("../../data-structures/crypto-keys/keys.cjs"),c=require("libsodium-wrappers"),d=require("../../crypto/poseidon.cjs");require("process");require("buffer");var s={};const f=(e,t,r)=>{const a=i.ethers.utils.defaultAbiCoder.encode(["uint256","address"],[e,t]),n=c.crypto_box_seal(a,i.ethers.utils.arrayify(r));return`0x${s.from(n).toString("hex")}`},S=(e,t)=>{const r=s.from(e.slice(2),"hex"),{publicKey:a,privateKey:n}=p.UserKeys.getEncryptionKeyPair(t.getShieldedPrivateKey());try{const o=c.crypto_box_seal_open(r,i.ethers.utils.arrayify(a),i.ethers.utils.arrayify(n)),u=s.from(o).toString("utf-8"),[l,y]=i.ethers.utils.defaultAbiCoder.decode(["uint256","address"],u);return{stakeBlinding:l.toBigInt(),stakedTokenRecipient:y}}catch{console.log("failed to decrypt");return}},k=(e,t,r,a,n,o)=>BigInt(d.poseidonHash(...[e,t,r,a,n,o].map(BigInt))),g=(e,t)=>d.poseidonHash(e,t),h=(e,t,r,a,n)=>i.ethers.utils.defaultAbiCoder.encode(["uint8","uint256","address","bytes","bytes"],[e,t,r,a,n]);exports.calculateStakeNullifier=g;exports.createStakeCommitment=k;exports.decryptStake=S;exports.encodeHStakeMetadata=h;exports.encryptStake=f;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("ethers"),y=require("../../data-structures/crypto-keys/keys.cjs"),s=require("libsodium-wrappers"),c=require("../../crypto/poseidon.cjs");require("process");require("buffer");const f=(e,t,r)=>{const n=i.ethers.utils.defaultAbiCoder.encode(["uint256","address"],[e,t]),a=s.crypto_box_seal(n,i.ethers.utils.arrayify(r));return`0x${Buffer.from(a).toString("hex")}`},p=(e,t)=>{const r=Buffer.from(e.slice(2),"hex"),{publicKey:n,privateKey:a}=y.UserKeys.getEncryptionKeyPair(t.getShieldedPrivateKey());try{const o=s.crypto_box_seal_open(r,i.ethers.utils.arrayify(n),i.ethers.utils.arrayify(a)),d=Buffer.from(o).toString("utf-8"),[u,l]=i.ethers.utils.defaultAbiCoder.decode(["uint256","address"],d);return{stakeBlinding:u.toBigInt(),stakedTokenRecipient:l}}catch{console.log("failed to decrypt");return}},S=(e,t,r,n,a,o)=>BigInt(c.poseidonHash(...[e,t,r,n,a,o].map(BigInt))),k=(e,t)=>c.poseidonHash(e,t),g=(e,t,r,n,a)=>i.ethers.utils.defaultAbiCoder.encode(["uint8","uint256","address","bytes","bytes"],[e,t,r,n,a]);exports.calculateStakeNullifier=k;exports.createStakeCommitment=S;exports.decryptStake=p;exports.encodeHStakeMetadata=g;exports.encryptStake=f;