@hinkal/common 0.2.8 → 0.2.10
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/API/API.cjs +1 -1
- package/API/API.d.ts +2 -1
- package/API/API.mjs +27 -26
- package/API/kycCalls.cjs +1 -1
- package/API/kycCalls.d.ts +4 -0
- package/API/kycCalls.mjs +15 -11
- package/constants/rewards.constants.cjs +1 -1
- package/constants/rewards.constants.d.ts +1 -0
- package/constants/rewards.constants.mjs +9 -8
- package/constants/server.constants.cjs +1 -1
- package/constants/server.constants.d.ts +1 -0
- package/constants/server.constants.mjs +5 -4
- package/data-structures/event-service/AbstractEventService.cjs +1 -1
- package/data-structures/event-service/AbstractEventService.mjs +42 -30
- package/data-structures/snapshot/ClientAccessTokenSnapshotService.cjs +1 -1
- package/data-structures/snapshot/ClientAccessTokenSnapshotService.mjs +10 -5
- package/data-structures/snapshot/ClientCommitmentsSnapshotService.cjs +1 -1
- package/data-structures/snapshot/ClientCommitmentsSnapshotService.mjs +10 -5
- package/data-structures/snapshot/ClientNullifierSnapshotService.cjs +1 -1
- package/data-structures/snapshot/ClientNullifierSnapshotService.mjs +8 -3
- package/error-handling/error-codes.constants.cjs +1 -1
- package/error-handling/error-codes.constants.mjs +13 -13
- package/functions/web3/events/getShieldedBalance.cjs +2 -2
- package/functions/web3/events/getShieldedBalance.mjs +66 -58
- package/index.cjs +1 -1
- package/index.mjs +469 -468
- package/package.json +2 -1
- package/types/rewards.types.cjs +1 -1
- package/types/rewards.types.d.ts +4 -3
- package/types/rewards.types.mjs +12 -12
- package/webworker/snarkjsWorker/snarkjsWorkerLauncher.cjs +1 -1
- package/webworker/snarkjsWorker/snarkjsWorkerLauncher.mjs +1 -1
- package/webworker/snarkjsWorker/snarkjsWorkerLogic.cjs +1 -1
- package/webworker/snarkjsWorker/snarkjsWorkerLogic.mjs +26 -21
package/API/API.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./referralProgramCalls.cjs"),r=require("./rewardsPointsCalls.cjs"),s=require("./userVerifyTransactions.cjs"),n=require("./relayCalls.cjs"),o=require("./passwordCalls.cjs"),a=require("./getTokenPrice.cjs"),t=require("./kycCalls.cjs"),c=require("./callOdosAPI.cjs"),g=require("./dataServerCalls.cjs"),i=require("./HinkalPointsCalls.cjs"),d={getUserKycStatus:t.getUserKycStatus,setAiPriseVerificationUrl:t.setAiPriseVerificationUrl,getAccessTokenSignature:t.getAccessTokenSignature,getReclaimVerificationRequest:t.getReclaimVerificationRequest,getZkMeAccessToken:t.getZkMeAccessToken,userHasAccessToken:t.userHasAccessToken,afterKycCall:t.afterKycCall,getTokenPrice:a.getTokenPrice,getTokenPriceEth:a.getTokenPriceEth,getTokenPrices:a.getTokenPrices,getOdosPriceForToken:c.getOdosPriceForToken,getActiveCode:e.getActiveCode,updateActiveCode:e.updateActiveCode,getWeeklyReferralCodes:e.getWeeklyReferralCodes,getReferralCodes:e.getReferralCodes,addReferralCode:e.addReferralCode,getLpProgram:e.getLpProgram,addNickname:r.addNickname,getNickname:r.getNickname,userGetLatestCertifiedHashes:s.userGetLatestCertifiedHashes,userGetTransactions:s.userGetTransactions,userVerifyTransactions:s.userVerifyTransactions,points:r.points,leaderboard:r.leaderboard,seasonLeaderboard:r.seasonLeaderboard,getIdleRelay:n.getIdleRelay,userHasPassword:o.userHasPassword,userRegisterPassword:o.userRegisterPassword,getRewardsHistory:e.getRewardsHistory,setRewardsReceivingData:e.setRewardsReceivingData,getRewardsReceivingData:e.getRewardsReceivingData,getUserPoints:g.getUserPoints,getLimitedAnonymityStakingPoints:i.getLimitedAnonymityStakingPoints,getUserAnonymityStakingPoints:i.getUserAnonymityStakingPoints,getUserAnonymityStakingReferralPoints:i.getUserAnonymityStakingReferralPoints};exports.API=d;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./referralProgramCalls.cjs"),r=require("./rewardsPointsCalls.cjs"),s=require("./userVerifyTransactions.cjs"),n=require("./relayCalls.cjs"),o=require("./passwordCalls.cjs"),a=require("./getTokenPrice.cjs"),t=require("./kycCalls.cjs"),c=require("./callOdosAPI.cjs"),g=require("./dataServerCalls.cjs"),i=require("./HinkalPointsCalls.cjs"),d={getUserKycStatus:t.getUserKycStatus,setAiPriseVerificationUrl:t.setAiPriseVerificationUrl,getAccessTokenSignature:t.getAccessTokenSignature,getReclaimVerificationRequest:t.getReclaimVerificationRequest,getZkMeAccessToken:t.getZkMeAccessToken,userHasAccessToken:t.userHasAccessToken,afterKycCall:t.afterKycCall,userHasReclaim:t.userHasReclaim,getTokenPrice:a.getTokenPrice,getTokenPriceEth:a.getTokenPriceEth,getTokenPrices:a.getTokenPrices,getOdosPriceForToken:c.getOdosPriceForToken,getActiveCode:e.getActiveCode,updateActiveCode:e.updateActiveCode,getWeeklyReferralCodes:e.getWeeklyReferralCodes,getReferralCodes:e.getReferralCodes,addReferralCode:e.addReferralCode,getLpProgram:e.getLpProgram,addNickname:r.addNickname,getNickname:r.getNickname,userGetLatestCertifiedHashes:s.userGetLatestCertifiedHashes,userGetTransactions:s.userGetTransactions,userVerifyTransactions:s.userVerifyTransactions,points:r.points,leaderboard:r.leaderboard,seasonLeaderboard:r.seasonLeaderboard,getIdleRelay:n.getIdleRelay,userHasPassword:o.userHasPassword,userRegisterPassword:o.userRegisterPassword,getRewardsHistory:e.getRewardsHistory,setRewardsReceivingData:e.setRewardsReceivingData,getRewardsReceivingData:e.getRewardsReceivingData,getUserPoints:g.getUserPoints,getLimitedAnonymityStakingPoints:i.getLimitedAnonymityStakingPoints,getUserAnonymityStakingPoints:i.getUserAnonymityStakingPoints,getUserAnonymityStakingReferralPoints:i.getUserAnonymityStakingReferralPoints};exports.API=d;
|
package/API/API.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { userGetLatestCertifiedHashes, userGetTransactions, userVerifyTransactio
|
|
|
4
4
|
import { getIdleRelay } from './relayCalls';
|
|
5
5
|
import { userHasPassword, userRegisterPassword } from './passwordCalls';
|
|
6
6
|
import { getTokenPrice, getTokenPriceEth, getTokenPrices } from './getTokenPrice';
|
|
7
|
-
import { afterKycCall, getAccessTokenSignature, getReclaimVerificationRequest, getUserKycStatus, getZkMeAccessToken, setAiPriseVerificationUrl, userHasAccessToken } from './kycCalls';
|
|
7
|
+
import { afterKycCall, getAccessTokenSignature, getReclaimVerificationRequest, getUserKycStatus, getZkMeAccessToken, setAiPriseVerificationUrl, userHasAccessToken, userHasReclaim } from './kycCalls';
|
|
8
8
|
import { getOdosPriceForToken } from './callOdosAPI';
|
|
9
9
|
import { getUserPoints } from './dataServerCalls';
|
|
10
10
|
import { getLimitedAnonymityStakingPoints, getUserAnonymityStakingPoints, getUserAnonymityStakingReferralPoints } from './HinkalPointsCalls';
|
|
@@ -44,5 +44,6 @@ export type IAPI = {
|
|
|
44
44
|
getLimitedAnonymityStakingPoints: typeof getLimitedAnonymityStakingPoints;
|
|
45
45
|
getUserAnonymityStakingPoints: typeof getUserAnonymityStakingPoints;
|
|
46
46
|
getUserAnonymityStakingReferralPoints: typeof getUserAnonymityStakingReferralPoints;
|
|
47
|
+
userHasReclaim: typeof userHasReclaim;
|
|
47
48
|
};
|
|
48
49
|
export declare const API: IAPI;
|
package/API/API.mjs
CHANGED
|
@@ -1,59 +1,60 @@
|
|
|
1
|
-
import { getActiveCode as e, updateActiveCode as
|
|
2
|
-
import { addNickname as
|
|
3
|
-
import { userGetLatestCertifiedHashes as p, userGetTransactions as
|
|
4
|
-
import { getIdleRelay as
|
|
1
|
+
import { getActiveCode as e, updateActiveCode as r, getWeeklyReferralCodes as t, getReferralCodes as o, addReferralCode as i, getLpProgram as s, getRewardsHistory as a, setRewardsReceivingData as n, getRewardsReceivingData as m } from "./referralProgramCalls.mjs";
|
|
2
|
+
import { addNickname as g, getNickname as c, points as d, leaderboard as f, seasonLeaderboard as k } from "./rewardsPointsCalls.mjs";
|
|
3
|
+
import { userGetLatestCertifiedHashes as p, userGetTransactions as R, userVerifyTransactions as l } from "./userVerifyTransactions.mjs";
|
|
4
|
+
import { getIdleRelay as P } from "./relayCalls.mjs";
|
|
5
5
|
import { userHasPassword as y, userRegisterPassword as u } from "./passwordCalls.mjs";
|
|
6
6
|
import { getTokenPrice as A, getTokenPriceEth as T, getTokenPrices as C } from "./getTokenPrice.mjs";
|
|
7
|
-
import { getUserKycStatus as w, setAiPriseVerificationUrl as
|
|
8
|
-
import { getOdosPriceForToken as
|
|
9
|
-
import { getUserPoints as
|
|
10
|
-
import { getLimitedAnonymityStakingPoints as
|
|
11
|
-
const
|
|
7
|
+
import { getUserKycStatus as w, setAiPriseVerificationUrl as H, getAccessTokenSignature as S, getReclaimVerificationRequest as U, getZkMeAccessToken as v, userHasAccessToken as L, afterKycCall as V, userHasReclaim as b } from "./kycCalls.mjs";
|
|
8
|
+
import { getOdosPriceForToken as h } from "./callOdosAPI.mjs";
|
|
9
|
+
import { getUserPoints as D } from "./dataServerCalls.mjs";
|
|
10
|
+
import { getLimitedAnonymityStakingPoints as G, getUserAnonymityStakingPoints as I, getUserAnonymityStakingReferralPoints as K } from "./HinkalPointsCalls.mjs";
|
|
11
|
+
const z = {
|
|
12
12
|
// KYC
|
|
13
13
|
getUserKycStatus: w,
|
|
14
|
-
setAiPriseVerificationUrl:
|
|
15
|
-
getAccessTokenSignature:
|
|
16
|
-
getReclaimVerificationRequest:
|
|
17
|
-
getZkMeAccessToken:
|
|
14
|
+
setAiPriseVerificationUrl: H,
|
|
15
|
+
getAccessTokenSignature: S,
|
|
16
|
+
getReclaimVerificationRequest: U,
|
|
17
|
+
getZkMeAccessToken: v,
|
|
18
18
|
userHasAccessToken: L,
|
|
19
19
|
afterKycCall: V,
|
|
20
|
+
userHasReclaim: b,
|
|
20
21
|
// Prices
|
|
21
22
|
getTokenPrice: A,
|
|
22
23
|
getTokenPriceEth: T,
|
|
23
24
|
getTokenPrices: C,
|
|
24
|
-
getOdosPriceForToken:
|
|
25
|
+
getOdosPriceForToken: h,
|
|
25
26
|
// Referral Codes
|
|
26
27
|
getActiveCode: e,
|
|
27
|
-
updateActiveCode:
|
|
28
|
-
getWeeklyReferralCodes:
|
|
28
|
+
updateActiveCode: r,
|
|
29
|
+
getWeeklyReferralCodes: t,
|
|
29
30
|
getReferralCodes: o,
|
|
30
31
|
addReferralCode: i,
|
|
31
32
|
getLpProgram: s,
|
|
32
33
|
// Rewards Points
|
|
33
|
-
addNickname:
|
|
34
|
+
addNickname: g,
|
|
34
35
|
getNickname: c,
|
|
35
36
|
// Transaction Verifications
|
|
36
37
|
userGetLatestCertifiedHashes: p,
|
|
37
|
-
userGetTransactions:
|
|
38
|
-
userVerifyTransactions:
|
|
38
|
+
userGetTransactions: R,
|
|
39
|
+
userVerifyTransactions: l,
|
|
39
40
|
points: d,
|
|
40
41
|
leaderboard: f,
|
|
41
42
|
seasonLeaderboard: k,
|
|
42
43
|
// relay
|
|
43
|
-
getIdleRelay:
|
|
44
|
+
getIdleRelay: P,
|
|
44
45
|
// password
|
|
45
46
|
userHasPassword: y,
|
|
46
47
|
userRegisterPassword: u,
|
|
47
48
|
getRewardsHistory: a,
|
|
48
49
|
setRewardsReceivingData: n,
|
|
49
|
-
getRewardsReceivingData:
|
|
50
|
+
getRewardsReceivingData: m,
|
|
50
51
|
// points
|
|
51
|
-
getUserPoints:
|
|
52
|
+
getUserPoints: D,
|
|
52
53
|
// AnonymityStakingPoints
|
|
53
|
-
getLimitedAnonymityStakingPoints:
|
|
54
|
-
getUserAnonymityStakingPoints:
|
|
55
|
-
getUserAnonymityStakingReferralPoints:
|
|
54
|
+
getLimitedAnonymityStakingPoints: G,
|
|
55
|
+
getUserAnonymityStakingPoints: I,
|
|
56
|
+
getUserAnonymityStakingReferralPoints: K
|
|
56
57
|
};
|
|
57
58
|
export {
|
|
58
|
-
|
|
59
|
+
z as API
|
|
59
60
|
};
|
package/API/kycCalls.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("axios"),a=require("../constants/server.constants.cjs"),c=require("./getServerURL.cjs");async function i(e,t){return(await r.post(`${c.getServerURL(e)}${a.API_CONFIG.ROUTES.checkKycStatus}`,{ethereumAddress:t})).data}async function o(e,t,s,n){return(await r.post(`${c.getServerURL(e)}${a.API_CONFIG.ROUTES.startUserVerification}`,{ethereumAddress:t,verificationSessionId:s,verificationType:n})).data}async function u(e,t,s){return(await r.post(`${c.getServerURL(e)}${a.API_CONFIG.ROUTES.getUserSignature}`,{ethereumAddress:t,accessKey:s})).data}async function g(e,t,s,n){return(await r.post(`${c.getServerURL(e)}${a.API_CONFIG.ROUTES.startReclaimVerification}`,{ethereumAddress:s,providerId:t,userSignature:n})).data}const R=async e=>(await r.get(`${c.getServerURL(e)}${a.API_CONFIG.ROUTES.zkMeAccessToken}`)).data.accessToken,S=async(e,t)=>(await r.get(`${c.getServerURL(e)}${a.API_CONFIG.ROUTES.userHasAccessToken(t)}`)).data,U=async(e,t,s)=>(await r.post(`${c.getServerURL(e)}${a.API_CONFIG.ROUTES.afterKycCall}`,{ethereumAddress:t,hasAccessTokenOnAnyChain:s})).data,A=async(e,t,s)=>(await r.post(`${c.getServerURL(e)}${a.API_CONFIG.ROUTES.userHasReclaim}`,{ethereumAddress:t,hasReclaimPassport:s})).data;exports.afterKycCall=U;exports.getAccessTokenSignature=u;exports.getReclaimVerificationRequest=g;exports.getUserKycStatus=i;exports.getZkMeAccessToken=R;exports.setAiPriseVerificationUrl=o;exports.userHasAccessToken=S;exports.userHasReclaim=A;
|
package/API/kycCalls.d.ts
CHANGED
|
@@ -23,4 +23,8 @@ type IAfterKycCall = {
|
|
|
23
23
|
updated: boolean;
|
|
24
24
|
};
|
|
25
25
|
export declare const afterKycCall: (chainId: number, ethereumAddress: string, hasAccessTokenOnAnyChain: boolean) => Promise<IAfterKycCall>;
|
|
26
|
+
type IUserHasReclaiml = {
|
|
27
|
+
updated: boolean;
|
|
28
|
+
};
|
|
29
|
+
export declare const userHasReclaim: (chainId: number, ethereumAddress: string, hasReclaimPassport: boolean) => Promise<IUserHasReclaiml>;
|
|
26
30
|
export {};
|
package/API/kycCalls.mjs
CHANGED
|
@@ -6,35 +6,39 @@ async function $(t, e) {
|
|
|
6
6
|
ethereumAddress: e
|
|
7
7
|
})).data;
|
|
8
8
|
}
|
|
9
|
-
async function
|
|
9
|
+
async function p(t, e, a, c) {
|
|
10
10
|
return (await s.post(`${n(t)}${r.ROUTES.startUserVerification}`, {
|
|
11
11
|
ethereumAddress: e,
|
|
12
12
|
verificationSessionId: a,
|
|
13
13
|
verificationType: c
|
|
14
14
|
})).data;
|
|
15
15
|
}
|
|
16
|
-
async function
|
|
16
|
+
async function R(t, e, a) {
|
|
17
17
|
return (await s.post(`${n(t)}${r.ROUTES.getUserSignature}`, { ethereumAddress: e, accessKey: a })).data;
|
|
18
18
|
}
|
|
19
|
-
async function
|
|
19
|
+
async function T(t, e, a, c) {
|
|
20
20
|
return (await s.post(`${n(t)}${r.ROUTES.startReclaimVerification}`, {
|
|
21
21
|
ethereumAddress: a,
|
|
22
22
|
providerId: e,
|
|
23
23
|
userSignature: c
|
|
24
24
|
})).data;
|
|
25
25
|
}
|
|
26
|
-
const
|
|
26
|
+
const f = async (t) => (await s.get(`${n(t)}${r.ROUTES.zkMeAccessToken}`)).data.accessToken, S = async (t, e) => (await s.get(
|
|
27
27
|
`${n(t)}${r.ROUTES.userHasAccessToken(e)}`
|
|
28
|
-
)).data,
|
|
28
|
+
)).data, U = async (t, e, a) => (await s.post(`${n(t)}${r.ROUTES.afterKycCall}`, {
|
|
29
29
|
ethereumAddress: e,
|
|
30
30
|
hasAccessTokenOnAnyChain: a
|
|
31
|
+
})).data, y = async (t, e, a) => (await s.post(`${n(t)}${r.ROUTES.userHasReclaim}`, {
|
|
32
|
+
ethereumAddress: e,
|
|
33
|
+
hasReclaimPassport: a
|
|
31
34
|
})).data;
|
|
32
35
|
export {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
U as afterKycCall,
|
|
37
|
+
R as getAccessTokenSignature,
|
|
38
|
+
T as getReclaimVerificationRequest,
|
|
36
39
|
$ as getUserKycStatus,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
f as getZkMeAccessToken,
|
|
41
|
+
p as setAiPriseVerificationUrl,
|
|
42
|
+
S as userHasAccessToken,
|
|
43
|
+
y as userHasReclaim
|
|
40
44
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../types/circom-data.types.cjs");require("../types/transactions.types.cjs");const e=require("../types/rewards.types.cjs");require("../types/curve.types.cjs");const r=["USDC"],t="https://hinkal-team.gitbook.io/hinkal/users/rebates/referral-program",o="https://hinkal-team.gitbook.io/hinkal/users/rewards/points",s="https://hinkal-team.gitbook.io/hinkal/users/rebates/lp-program",i=3,a=9,n={10:2,50:1.6,100:1.2},
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../types/circom-data.types.cjs");require("../types/transactions.types.cjs");const e=require("../types/rewards.types.cjs");require("../types/curve.types.cjs");const r=["USDC"],t="https://hinkal-team.gitbook.io/hinkal/users/rebates/referral-program",o="https://hinkal-team.gitbook.io/hinkal/users/rewards/points",s="https://hinkal-team.gitbook.io/hinkal/users/rebates/lp-program",i=3,a=9,n={10:2,50:1.6,100:1.2},E=7,S=1e3,l=1e4,_={[e.RafflePrizeType.Silver]:1e4,[e.RafflePrizeType.Gold]:2e4};exports.ACCESS_TOKEN_MINTING_POINTS=S;exports.ACCESS_TOKEN_RECLAIM_POINTS=l;exports.CERTIFICATION_DISABLE_WEEK=E;exports.REWARD_RECEIVABLE_TOKEN_SYMBOLS=r;exports.RafflePrizePoints=_;exports.boostAmounts=n;exports.lpLink=s;exports.lpProgramStartWeek=i;exports.pointsLink=o;exports.raffleProgramStartWeek=a;exports.referralLink=t;
|
|
@@ -11,6 +11,7 @@ export declare const boostAmounts: {
|
|
|
11
11
|
};
|
|
12
12
|
export declare const CERTIFICATION_DISABLE_WEEK = 7;
|
|
13
13
|
export declare const ACCESS_TOKEN_MINTING_POINTS = 1000;
|
|
14
|
+
export declare const ACCESS_TOKEN_RECLAIM_POINTS = 10000;
|
|
14
15
|
export declare const RafflePrizePoints: {
|
|
15
16
|
Silver: number;
|
|
16
17
|
Gold: number;
|
|
@@ -2,26 +2,27 @@ import "../types/circom-data.types.mjs";
|
|
|
2
2
|
import "../types/transactions.types.mjs";
|
|
3
3
|
import { RafflePrizeType as t } from "../types/rewards.types.mjs";
|
|
4
4
|
import "../types/curve.types.mjs";
|
|
5
|
-
const i = ["USDC"],
|
|
5
|
+
const i = ["USDC"], n = "https://hinkal-team.gitbook.io/hinkal/users/rebates/referral-program", a = "https://hinkal-team.gitbook.io/hinkal/users/rewards/points", l = "https://hinkal-team.gitbook.io/hinkal/users/rebates/lp-program", p = 3, k = 9, E = {
|
|
6
6
|
10: 2,
|
|
7
7
|
// if in the top 10
|
|
8
8
|
50: 1.6,
|
|
9
9
|
// if in top 50 but not in top 10
|
|
10
10
|
100: 1.2
|
|
11
11
|
// and so on
|
|
12
|
-
},
|
|
12
|
+
}, m = 7, S = 1e3, c = 1e4, _ = {
|
|
13
13
|
[t.Silver]: 1e4,
|
|
14
14
|
[t.Gold]: 2e4
|
|
15
15
|
};
|
|
16
16
|
export {
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
S as ACCESS_TOKEN_MINTING_POINTS,
|
|
18
|
+
c as ACCESS_TOKEN_RECLAIM_POINTS,
|
|
19
|
+
m as CERTIFICATION_DISABLE_WEEK,
|
|
19
20
|
i as REWARD_RECEIVABLE_TOKEN_SYMBOLS,
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
_ as RafflePrizePoints,
|
|
22
|
+
E as boostAmounts,
|
|
22
23
|
l as lpLink,
|
|
23
24
|
p as lpProgramStartWeek,
|
|
24
|
-
|
|
25
|
+
a as pointsLink,
|
|
25
26
|
k as raffleProgramStartWeek,
|
|
26
|
-
|
|
27
|
+
n as referralLink
|
|
27
28
|
};
|
|
@@ -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",startReclaimVerification:"/start-reclaim-verification",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",userGetLatestCertifiedHashes:e=>`/user-get-latest-certified-hashes/${e}`,userGetHasCerified:e=>`/user-get-has-certified/${e}`,userGetTransactions:(e,n,i)=>`/user-get-transactions/${e}/${n}/${i}`,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:"/season-leaderboard",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",getLastCertifyTime:e=>`/get-last-certify-time/${e}`,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"},
|
|
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",startReclaimVerification:"/start-reclaim-verification",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",userHasReclaim:"/user-has-reclaim",restoreSnapshots:"/snapshots/restore",beefyGraphAPI:"/BeefyGraphData",monitor:"/monitor",checkRisk:e=>`/check-risk/${e}`,userVerifyTransactions:"/user-verify-transactions",userGetLatestCertifiedHashes:e=>`/user-get-latest-certified-hashes/${e}`,userGetHasCerified:e=>`/user-get-has-certified/${e}`,userGetTransactions:(e,n,i)=>`/user-get-transactions/${e}/${n}/${i}`,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:"/season-leaderboard",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",getLastCertifyTime:e=>`/get-last-certify-time/${e}`,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"},u={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"},k={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"},S={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"},m={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=m;exports.PLAYGROUND_SERVER_URLS=k;exports.PLAYGROUND_URL=a;exports.RELAYER_CONFIG=d;exports.RELAYER_URLS=y;exports.SERVER_URLS=g;exports.STAGING_RELAYER_URLS=S;exports.STAGING_SERVER_URLS=u;exports.STAGING_URL=t;
|
|
@@ -15,6 +15,7 @@ export declare const API_CONFIG: {
|
|
|
15
15
|
axelarGasEstimate: (sourceChainName: string, destChainName: string, sourceChainToken: string, accessKey: string) => string;
|
|
16
16
|
userHasAccessToken: (accessKey: string) => string;
|
|
17
17
|
afterKycCall: string;
|
|
18
|
+
userHasReclaim: string;
|
|
18
19
|
restoreSnapshots: string;
|
|
19
20
|
beefyGraphAPI: string;
|
|
20
21
|
monitor: string;
|
|
@@ -14,6 +14,7 @@ const s = (e, t) => `${e}${t !== void 0 ? `?week=${t}` : ""}`, l = {
|
|
|
14
14
|
axelarGasEstimate: (e, t, i, o) => `/axelarGasEstimate/${e}/${t}/${i}/${o}`,
|
|
15
15
|
userHasAccessToken: (e) => `/user-has-access-token/${e}`,
|
|
16
16
|
afterKycCall: "/after-kyc-callback",
|
|
17
|
+
userHasReclaim: "/user-has-reclaim",
|
|
17
18
|
restoreSnapshots: "/snapshots/restore",
|
|
18
19
|
beefyGraphAPI: "/BeefyGraphData",
|
|
19
20
|
monitor: "/monitor",
|
|
@@ -92,7 +93,7 @@ const s = (e, t) => `${e}${t !== void 0 ? `?week=${t}` : ""}`, l = {
|
|
|
92
93
|
optimism: "https://optimism.server.hinkal.pro",
|
|
93
94
|
base: "https://base.server.hinkal.pro",
|
|
94
95
|
localhost: "http://localhost:7072"
|
|
95
|
-
},
|
|
96
|
+
}, u = {
|
|
96
97
|
polygon: `${a}:7072`,
|
|
97
98
|
arbMainnet: `${a}:7070`,
|
|
98
99
|
ethMainnet: `${a}:7080`,
|
|
@@ -101,7 +102,7 @@ const s = (e, t) => `${e}${t !== void 0 ? `?week=${t}` : ""}`, l = {
|
|
|
101
102
|
optimism: `${a}:7082`,
|
|
102
103
|
base: `${a}:7084`,
|
|
103
104
|
localhost: "http://localhost:7072"
|
|
104
|
-
},
|
|
105
|
+
}, y = {
|
|
105
106
|
polygon: `${n}:7072`,
|
|
106
107
|
arbMainnet: `${n}:7070`,
|
|
107
108
|
ethMainnet: `${n}:7080`,
|
|
@@ -145,12 +146,12 @@ export {
|
|
|
145
146
|
h as DATA_SERVER_URL_LOCAL,
|
|
146
147
|
c as DATA_SERVER_URL_PRODUCTION,
|
|
147
148
|
R as PLAYGROUND_RELAYER_URLS,
|
|
148
|
-
|
|
149
|
+
y as PLAYGROUND_SERVER_URLS,
|
|
149
150
|
n as PLAYGROUND_URL,
|
|
150
151
|
d as RELAYER_CONFIG,
|
|
151
152
|
m as RELAYER_URLS,
|
|
152
153
|
k as SERVER_URLS,
|
|
153
154
|
$ as STAGING_RELAYER_URLS,
|
|
154
|
-
|
|
155
|
+
u as STAGING_SERVER_URLS,
|
|
155
156
|
a as STAGING_URL
|
|
156
157
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../../constants/reorg-depths.constants.cjs"),o=require("../../functions/utils/resolve-sync.utils.cjs");require("ethers");require("axios");require("../../constants/chains.constants.cjs");require("../../constants/vite.constants.cjs");require("../../types/circom-data.types.cjs");require("../../types/transactions.types.cjs");require("../../types/curve.types.cjs");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("process");require("buffer");const v=require("../../error-handling/logError.cjs");class g{contract;eventConfig;_latestBlockNumber;maxPageSize;isReady=!1;_onNewEvent;isServer;intervalId;inProgress;constructor(e,r,t,s,n){this.contract=e,this.eventConfig=r,this._latestBlockNumber=t,this.maxPageSize=n,this.isServer=s,this.inProgress=!1}get latestBlockNumber(){return this._latestBlockNumber}set onNewEvent(e){this._onNewEvent=e}intervalClear(){this.isReady=!1,this._onNewEvent=void 0,clearInterval(this.intervalId)}async init(){if(this.isReady)throw new Error("Already initialized");this.isReady=!0,await this.retrieveEvents(this._latestBlockNumber+1),this.intervalId=setInterval(async()=>{await this.retrieveEvents(this.latestBlockNumber)},3500)}requireReady(){if(!this.isReady)throw new Error("Not ready")}emitNewEvent(e){this._onNewEvent?.(e)}getLastBlockNumberForEventRequest=async()=>{const e=await this.contract.provider.getBlockNumber();if(!this.isServer)return e;const{chainId:r}=await this.contract.provider.getNetwork();return Math.max(this.latestBlockNumber,e-u.blockReorgDepth[r]+1)};async retrieveEvents(e,r=!1){try{if(this.requireReady(),this.inProgress&&!r)return!1;this.inProgress=!0;const t=await this.getLastBlockNumberForEventRequest();if(t<e)return this.inProgress=!1,!1;const s=o.getSequence(e,t,this.maxPageSize);return await o.resolveSync(s.map(({from:n,to:i})=>async()=>{const c=await this.contract.queryFilter(this.contract.filters[this.eventConfig.name](),n,i);let a=[];c.length>0&&(a=await this.processEventsPage(c)),this._latestBlockNumber=i,await this.afterEventsAccepted(),a.length>0&&this.emitNewEvent()})),this.inProgress=!1,!0}catch(t){return v.logError("retrieveEvents error:",{err:t}),this.inProgress=!1,!1}}async processEventsPage(e){const r=[];return await o.resolveSync(e.map(t=>async()=>{const{args:s,blockNumber:n}=t;if(!s)throw new Error("Wrong event structure");const i=this.mapEvent(s);await this.acceptEvent(i,n)&&r.push(i)})),r}handleEvent=async(...e)=>{const{args:r}=this.eventConfig,{blockNumber:t}=e[e.length-1],s=e.slice(0,r.length),n=r.reduce((a,l,h)=>(a[l]=s[h],a),{});if(!t)throw new Error("Wrong event structure");const i=this.mapEvent(n);if(!await this.acceptEvent(i,t))throw new Error("Failed to retrieve events");this._latestBlockNumber=t,await this.afterEventsAccepted(),this.emitNewEvent(i)}}exports.AbstractEventService=g;
|
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
import { blockReorgDepth as v } from "../../constants/reorg-depths.constants.mjs";
|
|
2
|
-
import { getSequence as
|
|
3
|
-
|
|
2
|
+
import { getSequence as m, resolveSync as c } from "../../functions/utils/resolve-sync.utils.mjs";
|
|
3
|
+
import "ethers";
|
|
4
|
+
import "axios";
|
|
5
|
+
import "../../constants/chains.constants.mjs";
|
|
6
|
+
import "../../constants/vite.constants.mjs";
|
|
7
|
+
import "../../types/circom-data.types.mjs";
|
|
8
|
+
import "../../types/transactions.types.mjs";
|
|
9
|
+
import "../../types/curve.types.mjs";
|
|
10
|
+
import "circomlibjs-hinkal-fork";
|
|
11
|
+
import "libsodium-wrappers";
|
|
12
|
+
import "process";
|
|
13
|
+
import "buffer";
|
|
14
|
+
import { logError as u } from "../../error-handling/logError.mjs";
|
|
15
|
+
class q {
|
|
4
16
|
contract;
|
|
5
17
|
eventConfig;
|
|
6
18
|
_latestBlockNumber;
|
|
@@ -11,8 +23,8 @@ class g {
|
|
|
11
23
|
intervalId;
|
|
12
24
|
inProgress;
|
|
13
25
|
// to remove race conditions
|
|
14
|
-
constructor(e, t, s,
|
|
15
|
-
this.contract = e, this.eventConfig =
|
|
26
|
+
constructor(e, r, t, s, n) {
|
|
27
|
+
this.contract = e, this.eventConfig = r, this._latestBlockNumber = t, this.maxPageSize = n, this.isServer = s, this.inProgress = !1;
|
|
16
28
|
}
|
|
17
29
|
get latestBlockNumber() {
|
|
18
30
|
return this._latestBlockNumber;
|
|
@@ -41,55 +53,55 @@ class g {
|
|
|
41
53
|
const e = await this.contract.provider.getBlockNumber();
|
|
42
54
|
if (!this.isServer)
|
|
43
55
|
return e;
|
|
44
|
-
const { chainId:
|
|
45
|
-
return Math.max(this.latestBlockNumber, e - v[
|
|
56
|
+
const { chainId: r } = await this.contract.provider.getNetwork();
|
|
57
|
+
return Math.max(this.latestBlockNumber, e - v[r] + 1);
|
|
46
58
|
};
|
|
47
|
-
async retrieveEvents(e,
|
|
59
|
+
async retrieveEvents(e, r = !1) {
|
|
48
60
|
try {
|
|
49
|
-
if (this.requireReady(), this.inProgress && !
|
|
61
|
+
if (this.requireReady(), this.inProgress && !r)
|
|
50
62
|
return !1;
|
|
51
63
|
this.inProgress = !0;
|
|
52
|
-
const
|
|
53
|
-
if (
|
|
64
|
+
const t = await this.getLastBlockNumberForEventRequest();
|
|
65
|
+
if (t < e)
|
|
54
66
|
return this.inProgress = !1, !1;
|
|
55
|
-
const
|
|
56
|
-
return await
|
|
57
|
-
|
|
58
|
-
const
|
|
67
|
+
const s = m(e, t, this.maxPageSize);
|
|
68
|
+
return await c(
|
|
69
|
+
s.map(({ from: n, to: i }) => async () => {
|
|
70
|
+
const o = await this.contract.queryFilter(
|
|
59
71
|
this.contract.filters[this.eventConfig.name](),
|
|
60
72
|
n,
|
|
61
73
|
i
|
|
62
74
|
);
|
|
63
75
|
let a = [];
|
|
64
|
-
|
|
76
|
+
o.length > 0 && (a = await this.processEventsPage(o)), this._latestBlockNumber = i, await this.afterEventsAccepted(), a.length > 0 && this.emitNewEvent();
|
|
65
77
|
})
|
|
66
78
|
), this.inProgress = !1, !0;
|
|
67
|
-
} catch {
|
|
68
|
-
return this.inProgress = !1, !1;
|
|
79
|
+
} catch (t) {
|
|
80
|
+
return u("retrieveEvents error:", { err: t }), this.inProgress = !1, !1;
|
|
69
81
|
}
|
|
70
82
|
}
|
|
71
83
|
async processEventsPage(e) {
|
|
72
|
-
const
|
|
73
|
-
return await
|
|
74
|
-
e.map((
|
|
75
|
-
const { args:
|
|
76
|
-
if (!
|
|
84
|
+
const r = [];
|
|
85
|
+
return await c(
|
|
86
|
+
e.map((t) => async () => {
|
|
87
|
+
const { args: s, blockNumber: n } = t;
|
|
88
|
+
if (!s)
|
|
77
89
|
throw new Error("Wrong event structure");
|
|
78
|
-
const i = this.mapEvent(
|
|
79
|
-
await this.acceptEvent(i, n) &&
|
|
90
|
+
const i = this.mapEvent(s);
|
|
91
|
+
await this.acceptEvent(i, n) && r.push(i);
|
|
80
92
|
})
|
|
81
|
-
),
|
|
93
|
+
), r;
|
|
82
94
|
}
|
|
83
95
|
handleEvent = async (...e) => {
|
|
84
|
-
const { args:
|
|
85
|
-
if (!
|
|
96
|
+
const { args: r } = this.eventConfig, { blockNumber: t } = e[e.length - 1], s = e.slice(0, r.length), n = r.reduce((a, h, l) => (a[h] = s[l], a), {});
|
|
97
|
+
if (!t)
|
|
86
98
|
throw new Error("Wrong event structure");
|
|
87
99
|
const i = this.mapEvent(n);
|
|
88
|
-
if (!await this.acceptEvent(i,
|
|
100
|
+
if (!await this.acceptEvent(i, t))
|
|
89
101
|
throw new Error("Failed to retrieve events");
|
|
90
|
-
this._latestBlockNumber =
|
|
102
|
+
this._latestBlockNumber = t, await this.afterEventsAccepted(), this.emitNewEvent(i);
|
|
91
103
|
};
|
|
92
104
|
}
|
|
93
105
|
export {
|
|
94
|
-
|
|
106
|
+
q as AbstractEventService
|
|
95
107
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../event-service/AbstractAccessTokenSnapshotService.cjs");require("ethers");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("process");require("buffer");require("../../constants/vite.constants.cjs");require("../../constants/reorg-depths.constants.cjs");const t=require("../../API/fetchCommitmentsCache.cjs");class c extends s.AbstractAccessTokenSnapshotService{constructor(r,e){super(r,0,!1,e)}async fetchSnapshot(){const{chainId:r}=await this.contract.provider.getNetwork(),e=await t.fetchAccessTokenSnapshot(r);if(e.accessTokenContractAddress!==this.contract.address||e.chainId!==r)throw Error("Commitment Snapshot: incorrect contract or chain id");return{latestBlockNumber:e.latestBlockNumber,merkleTree:e.merkleTree,senderAddresses:e.senderAddresses,senderAddressIndexMap:e.senderAddressIndexMap}}persistSnapshot(r){return Promise.resolve()}}exports.ClientAccessTokenSnapshotService=c;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../event-service/AbstractAccessTokenSnapshotService.cjs");require("ethers");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("process");require("buffer");require("../../constants/vite.constants.cjs");require("../../constants/reorg-depths.constants.cjs");require("axios");require("../../constants/chains.constants.cjs");require("../../types/circom-data.types.cjs");require("../../types/transactions.types.cjs");require("../../types/curve.types.cjs");const t=require("../../API/fetchCommitmentsCache.cjs");class c extends s.AbstractAccessTokenSnapshotService{constructor(r,e){super(r,0,!1,e)}async fetchSnapshot(){const{chainId:r}=await this.contract.provider.getNetwork(),e=await t.fetchAccessTokenSnapshot(r);if(e.accessTokenContractAddress!==this.contract.address||e.chainId!==r)throw Error("Commitment Snapshot: incorrect contract or chain id");return{latestBlockNumber:e.latestBlockNumber,merkleTree:e.merkleTree,senderAddresses:e.senderAddresses,senderAddressIndexMap:e.senderAddressIndexMap}}persistSnapshot(r){return Promise.resolve()}}exports.ClientAccessTokenSnapshotService=c;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AbstractAccessTokenSnapshotService as
|
|
1
|
+
import { AbstractAccessTokenSnapshotService as t } from "../event-service/AbstractAccessTokenSnapshotService.mjs";
|
|
2
2
|
import "ethers";
|
|
3
3
|
import "circomlibjs-hinkal-fork";
|
|
4
4
|
import "libsodium-wrappers";
|
|
@@ -6,13 +6,18 @@ import "process";
|
|
|
6
6
|
import "buffer";
|
|
7
7
|
import "../../constants/vite.constants.mjs";
|
|
8
8
|
import "../../constants/reorg-depths.constants.mjs";
|
|
9
|
-
import
|
|
10
|
-
|
|
9
|
+
import "axios";
|
|
10
|
+
import "../../constants/chains.constants.mjs";
|
|
11
|
+
import "../../types/circom-data.types.mjs";
|
|
12
|
+
import "../../types/transactions.types.mjs";
|
|
13
|
+
import "../../types/curve.types.mjs";
|
|
14
|
+
import { fetchAccessTokenSnapshot as s } from "../../API/fetchCommitmentsCache.mjs";
|
|
15
|
+
class u extends t {
|
|
11
16
|
constructor(r, e) {
|
|
12
17
|
super(r, 0, !1, e);
|
|
13
18
|
}
|
|
14
19
|
async fetchSnapshot() {
|
|
15
|
-
const { chainId: r } = await this.contract.provider.getNetwork(), e = await
|
|
20
|
+
const { chainId: r } = await this.contract.provider.getNetwork(), e = await s(r);
|
|
16
21
|
if (e.accessTokenContractAddress !== this.contract.address || e.chainId !== r)
|
|
17
22
|
throw Error("Commitment Snapshot: incorrect contract or chain id");
|
|
18
23
|
return {
|
|
@@ -27,5 +32,5 @@ class k extends s {
|
|
|
27
32
|
}
|
|
28
33
|
}
|
|
29
34
|
export {
|
|
30
|
-
|
|
35
|
+
u as ClientAccessTokenSnapshotService
|
|
31
36
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("ethers");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("process");require("buffer");require("../../constants/vite.constants.cjs");require("../../constants/reorg-depths.constants.cjs");const r=require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("ethers");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("process");require("buffer");require("../../constants/vite.constants.cjs");require("../../constants/reorg-depths.constants.cjs");require("axios");require("../../constants/chains.constants.cjs");require("../../types/circom-data.types.cjs");require("../../types/transactions.types.cjs");require("../../types/curve.types.cjs");const r=require("../../API/fetchCommitmentsCache.cjs"),i=require("../event-service/AbstractCommitmentsSnapshotService.cjs");class s extends i.AbstractCommitmentsSnapshotService{constructor(t,e){super(t,0,!1,e)}async fetchSnapshot(){const{chainId:t}=await this.contract.provider.getNetwork(),e=await r.fetchCommitmentsSnapshot(t);if(e.hinkalAddress!==this.contract.address||e.chainId!==t)throw Error("Commitment Snapshot: incorrect contract or chain id");return{latestBlockNumber:e.latestBlockNumber,merkleTree:e.merkleTree,encryptedOutputs:e.encryptedOutputs}}persistSnapshot(t){return Promise.resolve()}}exports.ClientCommitmentsSnapshotService=s;
|
|
@@ -5,14 +5,19 @@ import "process";
|
|
|
5
5
|
import "buffer";
|
|
6
6
|
import "../../constants/vite.constants.mjs";
|
|
7
7
|
import "../../constants/reorg-depths.constants.mjs";
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
|
|
8
|
+
import "axios";
|
|
9
|
+
import "../../constants/chains.constants.mjs";
|
|
10
|
+
import "../../types/circom-data.types.mjs";
|
|
11
|
+
import "../../types/transactions.types.mjs";
|
|
12
|
+
import "../../types/curve.types.mjs";
|
|
13
|
+
import { fetchCommitmentsSnapshot as e } from "../../API/fetchCommitmentsCache.mjs";
|
|
14
|
+
import { AbstractCommitmentsSnapshotService as o } from "../event-service/AbstractCommitmentsSnapshotService.mjs";
|
|
15
|
+
class v extends o {
|
|
11
16
|
constructor(r, t) {
|
|
12
17
|
super(r, 0, !1, t);
|
|
13
18
|
}
|
|
14
19
|
async fetchSnapshot() {
|
|
15
|
-
const { chainId: r } = await this.contract.provider.getNetwork(), t = await
|
|
20
|
+
const { chainId: r } = await this.contract.provider.getNetwork(), t = await e(r);
|
|
16
21
|
if (t.hinkalAddress !== this.contract.address || t.chainId !== r)
|
|
17
22
|
throw Error("Commitment Snapshot: incorrect contract or chain id");
|
|
18
23
|
return {
|
|
@@ -26,5 +31,5 @@ class u extends e {
|
|
|
26
31
|
}
|
|
27
32
|
}
|
|
28
33
|
export {
|
|
29
|
-
|
|
34
|
+
v as ClientCommitmentsSnapshotService
|
|
30
35
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("ethers");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("process");require("buffer");require("../../constants/vite.constants.cjs");require("../../constants/reorg-depths.constants.cjs");const i=require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("ethers");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("process");require("buffer");require("../../constants/vite.constants.cjs");require("../../constants/reorg-depths.constants.cjs");require("axios");require("../../constants/chains.constants.cjs");require("../../types/circom-data.types.cjs");require("../../types/transactions.types.cjs");require("../../types/curve.types.cjs");const i=require("../../API/fetchNullifiers.cjs"),t=require("../event-service/AbstractNullifierSnapshotService.cjs");class s extends t.AbstractNullifierSnapshotService{constructor(e,r){super(e,0,!1,r)}async fetchSnapshot(){const{chainId:e}=await this.contract.provider.getNetwork(),r=await i.fetchNullifiers(e);return{latestBlockNumber:r.latestBlockNumber,nullifiers:r.nullifiers}}persistSnapshot(e){return Promise.resolve()}}exports.ClientNullifierSnapshotService=s;
|
|
@@ -5,9 +5,14 @@ import "process";
|
|
|
5
5
|
import "buffer";
|
|
6
6
|
import "../../constants/vite.constants.mjs";
|
|
7
7
|
import "../../constants/reorg-depths.constants.mjs";
|
|
8
|
-
import
|
|
8
|
+
import "axios";
|
|
9
|
+
import "../../constants/chains.constants.mjs";
|
|
10
|
+
import "../../types/circom-data.types.mjs";
|
|
11
|
+
import "../../types/transactions.types.mjs";
|
|
12
|
+
import "../../types/curve.types.mjs";
|
|
9
13
|
import { fetchNullifiers as i } from "../../API/fetchNullifiers.mjs";
|
|
10
|
-
|
|
14
|
+
import { AbstractNullifierSnapshotService as o } from "../event-service/AbstractNullifierSnapshotService.mjs";
|
|
15
|
+
class b extends o {
|
|
11
16
|
constructor(t, r) {
|
|
12
17
|
super(t, 0, !1, r);
|
|
13
18
|
}
|
|
@@ -23,5 +28,5 @@ class h extends e {
|
|
|
23
28
|
}
|
|
24
29
|
}
|
|
25
30
|
export {
|
|
26
|
-
|
|
31
|
+
b as ClientNullifierSnapshotService
|
|
27
32
|
};
|