@hinkal/common 0.2.5 → 0.2.6
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/rewardsPointsCalls.cjs +1 -1
- package/API/rewardsPointsCalls.d.ts +3 -3
- package/API/rewardsPointsCalls.mjs +1 -3
- package/constants/deploy-data/deploy-data-optimism.json.cjs +1 -1
- package/constants/deploy-data/deploy-data-optimism.json.mjs +17 -21
- package/constants/server.constants.cjs +1 -1
- package/constants/server.constants.d.ts +3 -3
- package/constants/server.constants.mjs +1 -1
- package/data-structures/Hinkal/Hinkal.cjs +1 -1
- package/data-structures/Hinkal/Hinkal.d.ts +1 -0
- package/data-structures/Hinkal/Hinkal.mjs +30 -26
- package/data-structures/Hinkal/IHinkal.d.ts +1 -0
- package/data-structures/Hinkal/hinkalGetRecipientInfo.cjs +1 -0
- package/data-structures/Hinkal/hinkalGetRecipientInfo.d.ts +2 -0
- package/data-structures/Hinkal/hinkalGetRecipientInfo.mjs +16 -0
- package/data-structures/cacheDevices/LocalStorageCacheDevice.cjs +1 -1
- package/data-structures/cacheDevices/LocalStorageCacheDevice.d.ts +1 -1
- package/data-structures/cacheDevices/LocalStorageCacheDevice.mjs +2 -2
- package/data-structures/custom-token-registry/CustomTokenRegistry.cjs +1 -1
- package/data-structures/custom-token-registry/CustomTokenRegistry.mjs +18 -14
- package/functions/private-wallet/emporium.helpers.cjs +1 -1
- package/functions/private-wallet/emporium.helpers.d.ts +3 -8
- package/functions/private-wallet/emporium.helpers.mjs +11 -23
- package/functions/private-wallet/index.d.ts +0 -1
- package/functions/private-wallet/opProducer.cjs +1 -1
- package/functions/private-wallet/opProducer.mjs +1 -1
- package/functions/protocols/pendle.helpers.cjs +1 -1
- package/functions/protocols/pendle.helpers.mjs +14 -13
- package/functions/utils/cacheDevice.utils.cjs +1 -1
- package/functions/utils/cacheDevice.utils.mjs +8 -8
- package/functions/utils/string.utils.cjs +1 -1
- package/functions/utils/string.utils.d.ts +0 -1
- package/functions/utils/string.utils.mjs +6 -16
- package/index.cjs +1 -1
- package/index.mjs +226 -229
- package/package.json +1 -1
- package/providers/prepareEthersHinkal.cjs +1 -1
- package/providers/prepareEthersHinkal.mjs +3 -2
- package/providers/prepareWagmiHinkal.cjs +1 -1
- package/providers/prepareWagmiHinkal.mjs +3 -2
- package/types/ethereum-network.types.d.ts +0 -2
- package/types/hinkal.types.d.ts +0 -1
- package/types/rewards.types.d.ts +4 -0
- package/webworker/snarkjsWorker/snarkjsWorkerLauncher.cjs +1 -1
- package/webworker/snarkjsWorker/snarkjsWorkerLauncher.mjs +1 -1
- package/functions/private-wallet/smartContractWalletCalculator.cjs +0 -1
- package/functions/private-wallet/smartContractWalletCalculator.d.ts +0 -1
- package/functions/private-wallet/smartContractWalletCalculator.mjs +0 -20
|
@@ -6200,7 +6200,7 @@ const e = "0x41658B0DaF59Bb2FbB2D9A5249207011d2B364De", t = [
|
|
|
6200
6200
|
stateMutability: "nonpayable",
|
|
6201
6201
|
type: "function"
|
|
6202
6202
|
}
|
|
6203
|
-
],
|
|
6203
|
+
], M = "0xfCD0dFB2e8157018165AD7A11B3e072f4aFf8954", k = [
|
|
6204
6204
|
{
|
|
6205
6205
|
inputs: [
|
|
6206
6206
|
{
|
|
@@ -6512,7 +6512,7 @@ const e = "0x41658B0DaF59Bb2FbB2D9A5249207011d2B364De", t = [
|
|
|
6512
6512
|
stateMutability: "payable",
|
|
6513
6513
|
type: "receive"
|
|
6514
6514
|
}
|
|
6515
|
-
],
|
|
6515
|
+
], w = "0xbd0E2Df0D151C680499C49d06445912E74822e95", h = [
|
|
6516
6516
|
{
|
|
6517
6517
|
inputs: [
|
|
6518
6518
|
{
|
|
@@ -7356,7 +7356,7 @@ const e = "0x41658B0DaF59Bb2FbB2D9A5249207011d2B364De", t = [
|
|
|
7356
7356
|
stateMutability: "nonpayable",
|
|
7357
7357
|
type: "function"
|
|
7358
7358
|
}
|
|
7359
|
-
], C = "0xB92188976A4bbeF3008f9DD21CCf7D23Dcbae391", H = "
|
|
7359
|
+
], C = "0xB92188976A4bbeF3008f9DD21CCf7D23Dcbae391", H = "0xAEe3165436156b0C8c98A747Fa7257353dFE9EF9", S = [
|
|
7360
7360
|
{
|
|
7361
7361
|
inputs: [
|
|
7362
7362
|
{
|
|
@@ -8187,7 +8187,7 @@ const e = "0x41658B0DaF59Bb2FbB2D9A5249207011d2B364De", t = [
|
|
|
8187
8187
|
stateMutability: "payable",
|
|
8188
8188
|
type: "receive"
|
|
8189
8189
|
}
|
|
8190
|
-
],
|
|
8190
|
+
], O = {
|
|
8191
8191
|
hinkalAddress: e,
|
|
8192
8192
|
hinkalABI: t,
|
|
8193
8193
|
hinkalHelperAddress: n,
|
|
@@ -8208,49 +8208,45 @@ const e = "0x41658B0DaF59Bb2FbB2D9A5249207011d2B364De", t = [
|
|
|
8208
8208
|
BeefyExternalActionABI: f,
|
|
8209
8209
|
pendleExternalActionInstanceAddress: A,
|
|
8210
8210
|
WrappedStakedBeefyLpABI: v,
|
|
8211
|
-
volatileVaultInstanceAddress:
|
|
8212
|
-
VolatileVaultABI:
|
|
8213
|
-
volatileTokenActionInstanceAddress:
|
|
8214
|
-
VolatileTokenActionABI:
|
|
8211
|
+
volatileVaultInstanceAddress: M,
|
|
8212
|
+
VolatileVaultABI: k,
|
|
8213
|
+
volatileTokenActionInstanceAddress: w,
|
|
8214
|
+
VolatileTokenActionABI: h,
|
|
8215
8215
|
hinkalWrapperAddress: x,
|
|
8216
8216
|
HinkalWrapperABI: g,
|
|
8217
8217
|
emporiumAddress: C,
|
|
8218
|
-
|
|
8219
|
-
|
|
8220
|
-
crossChainAccessTokenManagerAddress: O,
|
|
8221
|
-
crossChainAccessTokenManagerABI: I
|
|
8218
|
+
crossChainAccessTokenManagerAddress: H,
|
|
8219
|
+
crossChainAccessTokenManagerABI: S
|
|
8222
8220
|
};
|
|
8223
8221
|
export {
|
|
8224
8222
|
f as BeefyExternalActionABI,
|
|
8225
8223
|
g as HinkalWrapperABI,
|
|
8226
|
-
|
|
8227
|
-
|
|
8224
|
+
h as VolatileTokenActionABI,
|
|
8225
|
+
k as VolatileVaultABI,
|
|
8228
8226
|
v as WrappedStakedBeefyLpABI,
|
|
8229
8227
|
u as beefyExternalActionInstanceAddress,
|
|
8230
8228
|
c as convexExternalActionABI,
|
|
8231
8229
|
T as convexExternalActionInstanceAddress,
|
|
8232
8230
|
s as crossChainAccessTokenABI,
|
|
8233
8231
|
i as crossChainAccessTokenAddress,
|
|
8234
|
-
|
|
8235
|
-
|
|
8232
|
+
S as crossChainAccessTokenManagerABI,
|
|
8233
|
+
H as crossChainAccessTokenManagerAddress,
|
|
8236
8234
|
o as curveExternalActionABI,
|
|
8237
8235
|
d as curveExternalActionInstanceAddress,
|
|
8238
8236
|
l as curveStakeExternalActionInstanceAddress,
|
|
8239
|
-
|
|
8237
|
+
O as default,
|
|
8240
8238
|
C as emporiumAddress,
|
|
8241
8239
|
t as hinkalABI,
|
|
8242
8240
|
e as hinkalAddress,
|
|
8243
8241
|
a as hinkalHelperABI,
|
|
8244
8242
|
n as hinkalHelperAddress,
|
|
8245
|
-
S as hinkalWalletBeaconAddress,
|
|
8246
|
-
H as hinkalWalletFactoryAddress,
|
|
8247
8243
|
x as hinkalWrapperAddress,
|
|
8248
8244
|
y as odosExternalActionInstanceAddress,
|
|
8249
8245
|
r as oneInchExternalActionInstanceAddress,
|
|
8250
8246
|
A as pendleExternalActionInstanceAddress,
|
|
8251
8247
|
p as uniswapExternalActionAddress,
|
|
8252
|
-
|
|
8253
|
-
|
|
8248
|
+
w as volatileTokenActionInstanceAddress,
|
|
8249
|
+
M as volatileVaultInstanceAddress,
|
|
8254
8250
|
b as wrappedStakedConvexLpABI,
|
|
8255
8251
|
m as wrappedStakedCurveLpABI
|
|
8256
8252
|
};
|
|
@@ -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:
|
|
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",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"},u={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"},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=u;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=k;exports.STAGING_URL=t;
|
|
@@ -30,11 +30,11 @@ export declare const API_CONFIG: {
|
|
|
30
30
|
getRewardsHistory: (ethereumAddress: string) => string;
|
|
31
31
|
addReferralCode: string;
|
|
32
32
|
getLpProgram: (ethereumAddress: string) => string;
|
|
33
|
-
points: (ethereumAddress: string,
|
|
34
|
-
leaderboard: (
|
|
33
|
+
points: (ethereumAddress: string, week?: number) => string;
|
|
34
|
+
leaderboard: (week?: number) => string;
|
|
35
35
|
setRewardsReceivingData: string;
|
|
36
36
|
getRewardsReceivingData: (ethereumAddress: string) => string;
|
|
37
|
-
seasonLeaderboard:
|
|
37
|
+
seasonLeaderboard: string;
|
|
38
38
|
getUserAnonymityStakingPoints: (ethereumAddress: string) => string;
|
|
39
39
|
getLimitedAnonymityStakingPoints: (ethereumAddress: string) => string;
|
|
40
40
|
getUserAnonymityStakingReferralPoints: (ethereumAddress: string) => string;
|
|
@@ -33,7 +33,7 @@ const s = (e, t) => `${e}${t !== void 0 ? `?week=${t}` : ""}`, l = {
|
|
|
33
33
|
leaderboard: (e) => `/leaderboard/${e}`,
|
|
34
34
|
setRewardsReceivingData: "/set-user-rewards-receiving-data",
|
|
35
35
|
getRewardsReceivingData: (e) => `/get-user-rewards-receiving-data/${e}`,
|
|
36
|
-
seasonLeaderboard:
|
|
36
|
+
seasonLeaderboard: "/season-leaderboard",
|
|
37
37
|
getUserAnonymityStakingPoints: (e) => `/hinkal-points/${e}`,
|
|
38
38
|
getLimitedAnonymityStakingPoints: (e) => `/hinkal-points/limited/${e}`,
|
|
39
39
|
getUserAnonymityStakingReferralPoints: (e) => `/hinkal-referral-codes-info/${e}`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../../types/hinkal.types.cjs"),h=require("../../types/ethereum-network.types.cjs"),a=require("../../functions/web3/functionCalls/accessTokenCalls.cjs"),y=require("../../functions/web3/events/getShieldedBalance.cjs"),o=require("../crypto-keys/keys.cjs"),A=require("./hinkalActionBeefy.cjs"),C=require("./hinkalActionConvex.cjs"),P=require("./hinkalActionCurve.cjs"),w=require("./hinkalActionPendle.cjs"),d=require("./hinkalDeposit.cjs"),m=require("./hinkalSwap.cjs"),T=require("./hinkalWithdraw.cjs"),q=require("./resetMerkleTrees.cjs"),l=require("../merkle-tree/MerkleTree.cjs"),u=require("../../crypto/poseidon.cjs");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("process");require("buffer");const S=require("../../constants/chains.constants.cjs"),g=require("../../error-handling/error-codes.constants.cjs"),f=require("../../API/callMonitor.cjs"),E=require("./hinkalActionLidoEth.cjs");require("../../constants/vite.constants.cjs");require("axios");require("../../constants/coingecko.constants.cjs");const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../../types/hinkal.types.cjs"),h=require("../../types/ethereum-network.types.cjs"),a=require("../../functions/web3/functionCalls/accessTokenCalls.cjs"),y=require("../../functions/web3/events/getShieldedBalance.cjs"),o=require("../crypto-keys/keys.cjs"),A=require("./hinkalActionBeefy.cjs"),C=require("./hinkalActionConvex.cjs"),P=require("./hinkalActionCurve.cjs"),w=require("./hinkalActionPendle.cjs"),d=require("./hinkalDeposit.cjs"),m=require("./hinkalSwap.cjs"),T=require("./hinkalWithdraw.cjs"),q=require("./resetMerkleTrees.cjs"),l=require("../merkle-tree/MerkleTree.cjs"),u=require("../../crypto/poseidon.cjs");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("process");require("buffer");const S=require("../../constants/chains.constants.cjs"),g=require("../../error-handling/error-codes.constants.cjs"),f=require("../../API/callMonitor.cjs"),E=require("./hinkalActionLidoEth.cjs");require("../../constants/vite.constants.cjs");require("axios");require("../../constants/coingecko.constants.cjs");const I=require("../../API/getAxelarGasEstimate.cjs"),p=require("../../API/API.cjs");require("ethers");require("../../types/curve.types.cjs");require("../../constants/token-data/index.cjs");require("../../constants/contracts.constants.cjs");const F=require("../../constants/kyc.constants.cjs");require("../../constants/axelar.constants.cjs");require("../../constants/rewards.constants.cjs");require("../../constants/reorg-depths.constants.cjs");const R=require("../transactions-manager/TransactionsManager.cjs");require("../../functions/utils/external-action.utils.cjs");require("../../types/circom-data.types.cjs");require("../../types/transactions.types.cjs");const H=require("../../functions/utils/reloadPage.cjs"),M=require("./hinkalActionVolatile.cjs"),k=require("./hinkalActionPendleLP.cjs"),W=require("../../API/getConnextReceiveFee.cjs"),L=require("./hinkalActionStake.cjs"),x=require("../MultiThreadedUtxoUtils/MultiThreadedUtxoUtils.cjs"),B=require("./hinkalPrivateWallet.cjs"),K=require("../../functions/utils/cacheFunctions.cjs"),N=require("../../functions/utils/cacheDevice.utils.cjs"),U=require("../../functions/web3/getContractMetadata.cjs"),D=require("./hinkalGetRecipientInfo.cjs");class O{providerAdapter;userKeys;signingMessage="Login to Hinkal Protocol";merkleTreeHinkal;merkleTreeAccessToken;nullifiers;encryptedOutputs;commitmentsSnapshotService;nullifierSnapshotService;accessTokenSnapshotService;transactionsManager;utxoUtils;cacheDevice;generateProofRemotely;constructor(e){this.userKeys=new o.UserKeys(void 0),this.merkleTreeHinkal=l.MerkleTree.create(u.poseidonFunction,25n,0n),this.merkleTreeAccessToken=l.MerkleTree.create(u.poseidonFunction,25n,0n),this.nullifiers=new Set,this.encryptedOutputs=[],this.transactionsManager=new R.TransactionsManager,this.generateProofRemotely=e?.generateProofRemotely??!1,this.utxoUtils=new x.MultiThreadedUtxoUtils,this.cacheDevice=N.createCacheDevice(e)}async initProviderAdapter(e,t){await this.updateProviderAdapter(t),this.providerAdapter?.initConnector(e);const r=await this.connectAndPatchProvider(e);await t.init(r),await this.setListeners()}async initUserKeys(){this.userKeys=new o.UserKeys(await this.getProviderAdapter().signMessage(this.signingMessage))}async initUserKeysWithPassword(e){this.userKeys=new o.UserKeys(e)}async resetMerkle(){this.isSelectedNetworkSupported()&&await q.resetMerkleTrees(this)}getProviderAdapter(){if(!this.providerAdapter)throw new Error("ProviderAdapter is not initialized");return this.providerAdapter}async waitForTransaction(e,t=1){return!!await this.providerAdapter?.waitForTransaction(e,t)}getContractMetadata(e,t){return this.getProviderAdapter().getContractMetadata(e,t)}getContract(e,t=void 0,r){return this.getProviderAdapter().getContract(e,t,r)}getContractWithFetcherByChainId(e,t,r=void 0){return U.getContractWithFetcherByChainId(e,t,r)}async signMessage(e){return await this.getProviderAdapter().signMessage(e)}async signTypedData(e,t,r){return await this.getProviderAdapter().signTypedData(e,t,r)}getContractWithSigner(e,t=""){return this.getProviderAdapter().getContractWithSigner(e,t)}getContractWithFetcher(e,t=""){return this.getProviderAdapter().getContractWithFetcher(e,t)}getContractWithFetcherForEthereum(e,t){return this.getProviderAdapter().getContractWithFetcherForEthereum(e,t)}isSelectedNetworkSupported(){return!!S.networkRegistry[this.getCurrentChainId()]}async switchNetwork(e){try{await this.getProviderAdapter().switchNetwork(e)}catch{throw new Error(g.transactionErrorCodes.FAILED_TO_SWITCH_NETWORKS)}}getCurrentChainId(){const{chainId:e}=this.getProviderAdapter();if(!e)throw new Error("Illegal State: no chainId");return e}getSelectedNetwork(){return this.providerAdapter?.getSelectedNetwork()}isPermitterAvailable(){return this.getProviderAdapter().isPermitterAvailable()}async connectAndPatchProvider(e){return await this.getProviderAdapter().connectAndPatchProvider(e)}async disconnectFromConnector(){await this.getProviderAdapter().disconnectFromConnector()}async updateProviderAdapter(e){try{this.providerAdapter&&this.providerAdapter.release(),this.providerAdapter=e}catch(t){throw console.error(t),Error("updateProviderAdapter failed, please try again.")}}async setListeners(){this.providerAdapter?.setChainEventListener({onAccountChanged:()=>{this.onAccountChanged()},onChainChanged:e=>{this.onChainChanged(e)}})}async onAccountChanged(){await this.getProviderAdapter().onAccountChanged();const e=c.EventType.AccountChanged;typeof document<"u"?document?.dispatchEvent(new Event(e)):process?.emit("message",e,void 0)}async onChainChanged(e){if(e){await this.getProviderAdapter().onChainChanged(e);const t=c.EventType.NetworkChange;typeof document<"u"?document.dispatchEvent(new Event(t)):process?.emit("message",t,void 0)}else await this.disconnectFromConnector(),H.reloadPage()}async monitorConnectedAddress(){f.monitor(await this.getEthereumAddress(),this.getCurrentChainId())}async getBalances(){return y.getShieldedBalance(this)}getSupportedPassportLinks(){return F.supportedPassportLinks}checkAccessToken(){return a.checkHinkalAccessToken(this)}async getAxelarEstimate(e,t,r,n){return I.getAxelarGasEstimate(e,t,r,n,this.userKeys.getAccessKey())}async getConnextReceiveFee(e,t){return W.getConnextReceiveFee(this.getCurrentChainId(),e,t)}async mintHinkalAccessToken(e){return a.mintAccessToken(this,e)}async mintHinkalAccessTokenCrossChain(e,t){return a.mintTokenCrossChain(this,e,t)}async getHinkalTreeRootHash(){return this.getContractWithFetcher(h.ContractType.HinkalContract).getRootHash()}async getAccessTokenTreeRootHash(){return this.getContractWithFetcher(h.ContractType.CrossChainAccessTokenContract).getRootHash()}async resetMerkleTreesIfNecessary(){if(!this.isSelectedNetworkSupported())throw new Error(g.transactionErrorCodes.UNSUPPORTED_NETWORK);const[e,t]=await Promise.all([this.getHinkalTreeRootHash(),this.getAccessTokenTreeRootHash()]);(e.toBigInt()!==this.merkleTreeHinkal.getRootHash()||t.toBigInt()!==this.merkleTreeAccessToken.getRootHash())&&await this.resetMerkle()}async getEventsFromHinkal(){await Promise.all([this.accessTokenSnapshotService?.retrieveEventsFromLatestBlock(),this.commitmentsSnapshotService?.retrieveEventsFromLatestBlock(),this.nullifierSnapshotService?.retrieveEventsFromLatestBlock()])}getEthereumAddress(){return this.getProviderAdapter().getAddress()}async getRandomRelay(){return(await p.API.getIdleRelay(this.getCurrentChainId())).relay}getGasPrice(){if(!this.providerAdapter?.chainId)throw new Error("Illegal State of providerAdapter in Hinkal: no chainId");return this.providerAdapter.getGasPrice()}getAPI(){return p.API}resetCache(){K.resetCache(this)}snapshotsClearInterval(){this.commitmentsSnapshotService?.intervalClear(),this.accessTokenSnapshotService?.intervalClear(),this.nullifierSnapshotService?.intervalClear()}getRecipientInfo(){return D.getRecipientInfo(this)}async deposit(e,t){return d.hinkalDeposit(this,e,t)}async depositForOther(e,t,r){return d.hinkalDepositForOther(this,e,t,r)}async withdraw(e,t,r,n,i=!1){return T.hinkalWithdraw(this,e,t,r,n,i)}async swap(e,t,r,n,i=!1,s=!1){return m.hinkalSwap(this,e,t,r,n,i,s)}async actionCurve(e,t,r,n,i,s=!1){return P.hinkalActionCurve(this,e,t,r,n,i,s)}async actionConvex(e,t,r,n,i=!1){return C.hinkalActionConvex(this,e,t,r,n,i)}async actionBeefy(e,t,r,n,i,s,v=!1){return A.hinkalActionBeefy(this,e,t,r,n,i,s,v)}async actionLido(e,t,r,n,i,s=!1){return E.hinkalActionLido(this,e,t,r,n,i,s)}async actionPendle(e,t,r,n,i=!1){return w.hinkalActionPendle(this,e,t,r,n,i)}async actionPendleLP(e,t,r,n,i=!1){return k.hinkalActionPendleLP(this,e,t,r,n,i)}async actionVolatile(e,t,r,n=!1){return M.hinkalActionVolatile(this,e,t,r,n)}async actionStake(e,t,r,n){return L.hinkalActionStake(this,e,t,r,n)}async actionPrivateWallet(e,t,r,n=[],i,s=!1){return B.hinkalPrivateWallet(this,e,t,r,n,i,s)}async getPendleLPClaimableParams(e,t){return k.hinkalGetPendleLPClaimableParams(this,e,t)}}exports.Hinkal=O;
|
|
@@ -79,6 +79,7 @@ export declare class Hinkal<ConnectorType> implements IHinkal {
|
|
|
79
79
|
getAPI(): IAPI;
|
|
80
80
|
resetCache(): void;
|
|
81
81
|
snapshotsClearInterval(): void;
|
|
82
|
+
getRecipientInfo(): string;
|
|
82
83
|
deposit(erc20Addresses: string[], amountChanges: bigint[]): Promise<ethers.ContractTransaction>;
|
|
83
84
|
depositForOther(erc20Addresses: string[], amountChanges: bigint[], recipientInfo: string): Promise<ethers.ContractTransaction>;
|
|
84
85
|
withdraw(erc20Addresses: string[], amountChanges: bigint[], recipientAddress: string, isRelayerOff: boolean, onlyGasEstimate?: boolean): Promise<ethers.ContractTransaction | RelayerTransaction | bigint>;
|
|
@@ -2,11 +2,11 @@ import { EventType as s } from "../../types/hinkal.types.mjs";
|
|
|
2
2
|
import { ContractType as c } from "../../types/ethereum-network.types.mjs";
|
|
3
3
|
import { checkHinkalAccessToken as g, mintAccessToken as u, mintTokenCrossChain as v } from "../../functions/web3/functionCalls/accessTokenCalls.mjs";
|
|
4
4
|
import { getShieldedBalance as k } from "../../functions/web3/events/getShieldedBalance.mjs";
|
|
5
|
-
import { UserKeys as
|
|
5
|
+
import { UserKeys as a } from "../crypto-keys/keys.mjs";
|
|
6
6
|
import { hinkalActionBeefy as y } from "./hinkalActionBeefy.mjs";
|
|
7
|
-
import { hinkalActionConvex as
|
|
8
|
-
import { hinkalActionCurve as
|
|
9
|
-
import { hinkalActionPendle as
|
|
7
|
+
import { hinkalActionConvex as f } from "./hinkalActionConvex.mjs";
|
|
8
|
+
import { hinkalActionCurve as A } from "./hinkalActionCurve.mjs";
|
|
9
|
+
import { hinkalActionPendle as C } from "./hinkalActionPendle.mjs";
|
|
10
10
|
import { hinkalDeposit as P, hinkalDepositForOther as w } from "./hinkalDeposit.mjs";
|
|
11
11
|
import { hinkalSwap as T } from "./hinkalSwap.mjs";
|
|
12
12
|
import { hinkalWithdraw as S } from "./hinkalWithdraw.mjs";
|
|
@@ -17,10 +17,10 @@ import "circomlibjs-hinkal-fork";
|
|
|
17
17
|
import "libsodium-wrappers";
|
|
18
18
|
import "process";
|
|
19
19
|
import "buffer";
|
|
20
|
-
import { networkRegistry as
|
|
20
|
+
import { networkRegistry as I } from "../../constants/chains.constants.mjs";
|
|
21
21
|
import { transactionErrorCodes as p } from "../../error-handling/error-codes.constants.mjs";
|
|
22
|
-
import { monitor as
|
|
23
|
-
import { hinkalActionLido as
|
|
22
|
+
import { monitor as F } from "../../API/callMonitor.mjs";
|
|
23
|
+
import { hinkalActionLido as H } from "./hinkalActionLidoEth.mjs";
|
|
24
24
|
import "../../constants/vite.constants.mjs";
|
|
25
25
|
import "axios";
|
|
26
26
|
import "../../constants/coingecko.constants.mjs";
|
|
@@ -48,7 +48,8 @@ import { hinkalPrivateWallet as U } from "./hinkalPrivateWallet.mjs";
|
|
|
48
48
|
import { resetCache as b } from "../../functions/utils/cacheFunctions.mjs";
|
|
49
49
|
import { createCacheDevice as G } from "../../functions/utils/cacheDevice.utils.mjs";
|
|
50
50
|
import { getContractWithFetcherByChainId as _ } from "../../functions/web3/getContractMetadata.mjs";
|
|
51
|
-
|
|
51
|
+
import { getRecipientInfo as j } from "./hinkalGetRecipientInfo.mjs";
|
|
52
|
+
class _e {
|
|
52
53
|
providerAdapter;
|
|
53
54
|
userKeys;
|
|
54
55
|
signingMessage = "Login to Hinkal Protocol";
|
|
@@ -64,7 +65,7 @@ class be {
|
|
|
64
65
|
cacheDevice;
|
|
65
66
|
generateProofRemotely;
|
|
66
67
|
constructor(e) {
|
|
67
|
-
this.userKeys = new
|
|
68
|
+
this.userKeys = new a(void 0), this.merkleTreeHinkal = h.create(d, 25n, 0n), this.merkleTreeAccessToken = h.create(d, 25n, 0n), this.nullifiers = /* @__PURE__ */ new Set(), this.encryptedOutputs = [], this.transactionsManager = new L(), this.generateProofRemotely = e?.generateProofRemotely ?? !1, this.utxoUtils = new D(), this.cacheDevice = G(e);
|
|
68
69
|
}
|
|
69
70
|
async initProviderAdapter(e, t) {
|
|
70
71
|
await this.updateProviderAdapter(t), this.providerAdapter?.initConnector(e);
|
|
@@ -72,10 +73,10 @@ class be {
|
|
|
72
73
|
await t.init(r), await this.setListeners();
|
|
73
74
|
}
|
|
74
75
|
async initUserKeys() {
|
|
75
|
-
this.userKeys = new
|
|
76
|
+
this.userKeys = new a(await this.getProviderAdapter().signMessage(this.signingMessage));
|
|
76
77
|
}
|
|
77
78
|
async initUserKeysWithPassword(e) {
|
|
78
|
-
this.userKeys = new
|
|
79
|
+
this.userKeys = new a(e);
|
|
79
80
|
}
|
|
80
81
|
async resetMerkle() {
|
|
81
82
|
this.isSelectedNetworkSupported() && await E(this);
|
|
@@ -113,7 +114,7 @@ class be {
|
|
|
113
114
|
return this.getProviderAdapter().getContractWithFetcherForEthereum(e, t);
|
|
114
115
|
}
|
|
115
116
|
isSelectedNetworkSupported() {
|
|
116
|
-
return !!
|
|
117
|
+
return !!I[this.getCurrentChainId()];
|
|
117
118
|
}
|
|
118
119
|
async switchNetwork(e) {
|
|
119
120
|
try {
|
|
@@ -171,7 +172,7 @@ class be {
|
|
|
171
172
|
await this.disconnectFromConnector(), M();
|
|
172
173
|
}
|
|
173
174
|
async monitorConnectedAddress() {
|
|
174
|
-
|
|
175
|
+
F(await this.getEthereumAddress(), this.getCurrentChainId());
|
|
175
176
|
}
|
|
176
177
|
async getBalances() {
|
|
177
178
|
return k(this);
|
|
@@ -242,6 +243,9 @@ class be {
|
|
|
242
243
|
snapshotsClearInterval() {
|
|
243
244
|
this.commitmentsSnapshotService?.intervalClear(), this.accessTokenSnapshotService?.intervalClear(), this.nullifierSnapshotService?.intervalClear();
|
|
244
245
|
}
|
|
246
|
+
getRecipientInfo() {
|
|
247
|
+
return j(this);
|
|
248
|
+
}
|
|
245
249
|
async deposit(e, t) {
|
|
246
250
|
return P(this, e, t);
|
|
247
251
|
}
|
|
@@ -254,7 +258,7 @@ class be {
|
|
|
254
258
|
async withdraw(e, t, r, i, n = !1) {
|
|
255
259
|
return S(this, e, t, r, i, n);
|
|
256
260
|
}
|
|
257
|
-
async swap(e, t, r, i, n = !1,
|
|
261
|
+
async swap(e, t, r, i, n = !1, o = !1) {
|
|
258
262
|
return T(
|
|
259
263
|
this,
|
|
260
264
|
e,
|
|
@@ -262,16 +266,16 @@ class be {
|
|
|
262
266
|
r,
|
|
263
267
|
i,
|
|
264
268
|
n,
|
|
265
|
-
|
|
269
|
+
o
|
|
266
270
|
);
|
|
267
271
|
}
|
|
268
|
-
async actionCurve(e, t, r, i, n,
|
|
269
|
-
return
|
|
272
|
+
async actionCurve(e, t, r, i, n, o = !1) {
|
|
273
|
+
return A(this, e, t, r, i, n, o);
|
|
270
274
|
}
|
|
271
275
|
async actionConvex(e, t, r, i, n = !1) {
|
|
272
|
-
return
|
|
276
|
+
return f(this, e, t, r, i, n);
|
|
273
277
|
}
|
|
274
|
-
async actionBeefy(e, t, r, i, n,
|
|
278
|
+
async actionBeefy(e, t, r, i, n, o, m = !1) {
|
|
275
279
|
return y(
|
|
276
280
|
this,
|
|
277
281
|
e,
|
|
@@ -279,15 +283,15 @@ class be {
|
|
|
279
283
|
r,
|
|
280
284
|
i,
|
|
281
285
|
n,
|
|
282
|
-
|
|
286
|
+
o,
|
|
283
287
|
m
|
|
284
288
|
);
|
|
285
289
|
}
|
|
286
|
-
async actionLido(e, t, r, i, n,
|
|
287
|
-
return
|
|
290
|
+
async actionLido(e, t, r, i, n, o = !1) {
|
|
291
|
+
return H(this, e, t, r, i, n, o);
|
|
288
292
|
}
|
|
289
293
|
async actionPendle(e, t, r, i, n = !1) {
|
|
290
|
-
return
|
|
294
|
+
return C(this, e, t, r, i, n);
|
|
291
295
|
}
|
|
292
296
|
async actionPendleLP(e, t, r, i, n = !1) {
|
|
293
297
|
return B(
|
|
@@ -305,13 +309,13 @@ class be {
|
|
|
305
309
|
async actionStake(e, t, r, i) {
|
|
306
310
|
return O(this, e, t, r, i);
|
|
307
311
|
}
|
|
308
|
-
async actionPrivateWallet(e, t, r, i = [], n,
|
|
309
|
-
return U(this, e, t, r, i, n,
|
|
312
|
+
async actionPrivateWallet(e, t, r, i = [], n, o = !1) {
|
|
313
|
+
return U(this, e, t, r, i, n, o);
|
|
310
314
|
}
|
|
311
315
|
async getPendleLPClaimableParams(e, t) {
|
|
312
316
|
return K(this, e, t);
|
|
313
317
|
}
|
|
314
318
|
}
|
|
315
319
|
export {
|
|
316
|
-
|
|
320
|
+
_e as Hinkal
|
|
317
321
|
};
|
|
@@ -49,6 +49,7 @@ export interface IHinkal<ConnectorType = unknown> {
|
|
|
49
49
|
getAPI(): IAPI;
|
|
50
50
|
resetCache(): void;
|
|
51
51
|
snapshotsClearInterval(): void;
|
|
52
|
+
getRecipientInfo(): string;
|
|
52
53
|
deposit(erc20Addresses: string[], amountChanges: bigint[]): Promise<ethers.ContractTransaction>;
|
|
53
54
|
depositForOther(erc20Addresses: string[], amountChanges: bigint[], recepinetInfo: string): Promise<ethers.ContractTransaction>;
|
|
54
55
|
withdraw(erc20Addresses: string[], amountChanges: bigint[], recipientAddress: string, isRelayerOff: boolean, onlyGasEstimate?: boolean): Promise<ethers.ContractTransaction | RelayerTransaction | bigint>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../utxo/Utxo.cjs");require("ethers");const d=require("../crypto-keys/keys.cjs");require("libsodium-wrappers");const a=require("../../node_modules/viem/_esm/constants/address.cjs"),u=e=>{if(!e)throw Error("No hinkal provided");const{userKeys:s}=e,t=s.getShieldedPrivateKey(),r=d.UserKeys.getEncryptionKeyPair(t).publicKey,o=new c.Utxo({amount:0n,erc20TokenAddress:a.zeroAddress,shieldedPrivateKey:t}),{randomization:n}=o,i=o.getStealthAddress();if(!n||!i||!r)throw Error("Cannot get recipient information");return`${n},${i},${r}`};exports.getRecipientInfo=u;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Utxo as d } from "../utxo/Utxo.mjs";
|
|
2
|
+
import "ethers";
|
|
3
|
+
import { UserKeys as c } from "../crypto-keys/keys.mjs";
|
|
4
|
+
import "libsodium-wrappers";
|
|
5
|
+
import { zeroAddress as p } from "../../node_modules/viem/_esm/constants/address.mjs";
|
|
6
|
+
const h = (e) => {
|
|
7
|
+
if (!e)
|
|
8
|
+
throw Error("No hinkal provided");
|
|
9
|
+
const { userKeys: s } = e, t = s.getShieldedPrivateKey(), r = c.getEncryptionKeyPair(t).publicKey, o = new d({ amount: 0n, erc20TokenAddress: p, shieldedPrivateKey: t }), { randomization: n } = o, i = o.getStealthAddress();
|
|
10
|
+
if (!n || !i || !r)
|
|
11
|
+
throw Error("Cannot get recipient information");
|
|
12
|
+
return `${n},${i},${r}`;
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
h as getRecipientInfo
|
|
16
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./BaseCacheDevice.cjs");class o extends a.BaseCacheDevice{localDataStorage;constructor(
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./BaseCacheDevice.cjs");class o extends a.BaseCacheDevice{localDataStorage;constructor(){super(),typeof localStorage<"u"&&(this.localDataStorage=localStorage)}get(e){return this.localDataStorage?this.localDataStorage.getItem(e)??void 0:this.getInMemory(e)}set(e,t){this.localDataStorage?this.localDataStorage.setItem(e,t):this.setInMemory(e,t)}}exports.LocalStorageCacheDevice=o;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseCacheDevice } from './BaseCacheDevice';
|
|
2
2
|
export declare class LocalStorageCacheDevice extends BaseCacheDevice {
|
|
3
3
|
private localDataStorage;
|
|
4
|
-
constructor(
|
|
4
|
+
constructor();
|
|
5
5
|
get(key: string): string | undefined;
|
|
6
6
|
set(key: string, value: string): void;
|
|
7
7
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BaseCacheDevice as a } from "./BaseCacheDevice.mjs";
|
|
2
2
|
class l extends a {
|
|
3
3
|
localDataStorage;
|
|
4
|
-
constructor(
|
|
5
|
-
super(),
|
|
4
|
+
constructor() {
|
|
5
|
+
super(), typeof localStorage < "u" && (this.localDataStorage = localStorage);
|
|
6
6
|
}
|
|
7
7
|
get(t) {
|
|
8
8
|
return this.localDataStorage ? this.localDataStorage.getItem(t) ?? void 0 : this.getInMemory(t);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class o{localStorageKey="tokenRegistry";tokenRegistry;constructor(){this.tokenRegistry=[]}persistRegistry(){}getCustomTokens(
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class o{localStorageKey="tokenRegistry";tokenRegistry;constructor(){if(this.tokenRegistry=[],typeof localStorage<"u"){const t=localStorage.getItem(this.localStorageKey);t&&(this.tokenRegistry=JSON.parse(t))}}persistRegistry(){typeof localStorage<"u"&&localStorage.setItem(this.localStorageKey,JSON.stringify(this.tokenRegistry))}getCustomTokens(t){return this.tokenRegistry.filter(e=>e.chainId===t)}tokenExists(t,e){return t.find(s=>s.erc20TokenAddress===e.erc20TokenAddress||s.symbol===e.symbol||s.name===e.name)}addCustomToken(t){const{chainId:e}=t,s=this.getCustomTokens(e);this.tokenExists(s,t)||this.tokenRegistry.push(t),this.persistRegistry()}removeCustomToken(t){const{chainId:e}=t,r=this.getCustomTokens(e).filter(i=>i.erc20TokenAddress!==t.erc20TokenAddress);this.tokenRegistry=r,this.persistRegistry()}}const n=new o;exports.customTokenRegistry=n;
|
|
@@ -1,29 +1,33 @@
|
|
|
1
|
-
class
|
|
1
|
+
class o {
|
|
2
2
|
localStorageKey = "tokenRegistry";
|
|
3
3
|
tokenRegistry;
|
|
4
4
|
constructor() {
|
|
5
|
-
this.tokenRegistry = []
|
|
5
|
+
if (this.tokenRegistry = [], typeof localStorage < "u") {
|
|
6
|
+
const t = localStorage.getItem(this.localStorageKey);
|
|
7
|
+
t && (this.tokenRegistry = JSON.parse(t));
|
|
8
|
+
}
|
|
6
9
|
}
|
|
7
10
|
persistRegistry() {
|
|
11
|
+
typeof localStorage < "u" && localStorage.setItem(this.localStorageKey, JSON.stringify(this.tokenRegistry));
|
|
8
12
|
}
|
|
9
|
-
getCustomTokens(
|
|
10
|
-
return this.tokenRegistry.filter((
|
|
13
|
+
getCustomTokens(t) {
|
|
14
|
+
return this.tokenRegistry.filter((s) => s.chainId === t);
|
|
11
15
|
}
|
|
12
|
-
tokenExists(
|
|
13
|
-
return
|
|
14
|
-
(e) => e.erc20TokenAddress ===
|
|
16
|
+
tokenExists(t, s) {
|
|
17
|
+
return t.find(
|
|
18
|
+
(e) => e.erc20TokenAddress === s.erc20TokenAddress || e.symbol === s.symbol || e.name === s.name
|
|
15
19
|
);
|
|
16
20
|
}
|
|
17
|
-
addCustomToken(
|
|
18
|
-
const { chainId:
|
|
19
|
-
this.tokenExists(e,
|
|
21
|
+
addCustomToken(t) {
|
|
22
|
+
const { chainId: s } = t, e = this.getCustomTokens(s);
|
|
23
|
+
this.tokenExists(e, t) || this.tokenRegistry.push(t), this.persistRegistry();
|
|
20
24
|
}
|
|
21
|
-
removeCustomToken(
|
|
22
|
-
const { chainId:
|
|
25
|
+
removeCustomToken(t) {
|
|
26
|
+
const { chainId: s } = t, r = this.getCustomTokens(s).filter((i) => i.erc20TokenAddress !== t.erc20TokenAddress);
|
|
23
27
|
this.tokenRegistry = r, this.persistRegistry();
|
|
24
28
|
}
|
|
25
29
|
}
|
|
26
|
-
const
|
|
30
|
+
const g = new o();
|
|
27
31
|
export {
|
|
28
|
-
|
|
32
|
+
g as customTokenRegistry
|
|
29
33
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("ethers"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("ethers"),d=(t,r,a,l,y)=>{let s=new Uint8Array,i=new Uint8Array;typeof t=="object"&&"address"in t?(s=e.ethers.utils.arrayify(t.address),r&&(i=e.ethers.utils.arrayify(t.interface.encodeFunctionData(r,a)))):s=e.ethers.utils.arrayify(t);const o=e.ethers.utils.arrayify([l?1:0]),n=e.ethers.utils.zeroPad(e.ethers.utils.arrayify(e.BigNumber.from(y??0n)),16),u=e.ethers.utils.concat([s,o,n,i]);return e.ethers.utils.hexlify(u)},f=(t,r)=>e.ethers.utils.defaultAbiCoder.encode(["tuple(bytes32 walletSalt, bytes[] ops)"],[{walletSalt:r??e.ethers.utils.hexlify(new Uint8Array(32)),ops:t}]);exports.emporiumOp=d;exports.encodeEmporiumMetadata=f;
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { Contract, ContractTransaction } from 'ethers';
|
|
2
|
-
export declare const emporiumOp: <ContractInstance extends Contract, ContractFunctions extends ContractInstance["functions"], ExactFunction extends { [K in keyof ContractFunctions]: ReturnType<ContractFunctions[K]> extends Promise<ContractTransaction> ? K : never; }[keyof ContractFunctions], FunctionArguments extends Parameters<ContractFunctions[ExactFunction]>>(
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
args?: (FunctionArguments extends [] ? [] : FunctionArguments) | undefined;
|
|
6
|
-
callDataString?: string | undefined;
|
|
7
|
-
invokeWallet?: boolean | undefined;
|
|
8
|
-
value?: bigint | undefined;
|
|
9
|
-
}) => string;
|
|
2
|
+
export declare const emporiumOp: <ContractInstance extends Contract, ContractFunctions extends ContractInstance["functions"], ExactFunction extends { [K in keyof ContractFunctions]: ReturnType<ContractFunctions[K]> extends Promise<ContractTransaction> ? K : never; }[keyof ContractFunctions], FunctionArguments extends Parameters<ContractFunctions[ExactFunction]>>(contract: ContractInstance | string, func?: ExactFunction, args?: FunctionArguments extends [
|
|
3
|
+
] ? [
|
|
4
|
+
] : FunctionArguments, invokeWallet?: boolean, value?: bigint) => string;
|
|
10
5
|
export declare const encodeEmporiumMetadata: (ops: string[], walletSalt?: string) => string;
|
|
@@ -1,31 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
value: d
|
|
9
|
-
}) => {
|
|
10
|
-
let y = new Uint8Array(), o = t ? e.arrayify(t) : new Uint8Array();
|
|
11
|
-
if (typeof r == "object" && "address" in r) {
|
|
12
|
-
if (y = e.arrayify(r.address), t?.length && t?.length > 0)
|
|
13
|
-
throw Error("If function and args are providedm no calldata is needed");
|
|
14
|
-
a && i && !t && (o = e.arrayify(r.interface.encodeFunctionData(a, i)));
|
|
15
|
-
} else
|
|
16
|
-
y = e.arrayify(r);
|
|
17
|
-
const s = e.arrayify([n ? 1 : 0]), f = e.zeroPad(e.arrayify(p.from(d ?? 0n)), 16), l = e.concat([y, s, f, o]);
|
|
18
|
-
return e.hexlify(l);
|
|
19
|
-
}, w = (r, a) => e.defaultAbiCoder.encode(
|
|
1
|
+
import { ethers as e, BigNumber as d } from "ethers";
|
|
2
|
+
const p = (t, i, s, r, y) => {
|
|
3
|
+
let a = new Uint8Array(), l = new Uint8Array();
|
|
4
|
+
typeof t == "object" && "address" in t ? (a = e.utils.arrayify(t.address), i && (l = e.utils.arrayify(t.interface.encodeFunctionData(i, s)))) : a = e.utils.arrayify(t);
|
|
5
|
+
const n = e.utils.arrayify([r ? 1 : 0]), o = e.utils.zeroPad(e.utils.arrayify(d.from(y ?? 0n)), 16), u = e.utils.concat([a, n, o, l]);
|
|
6
|
+
return e.utils.hexlify(u);
|
|
7
|
+
}, m = (t, i) => e.utils.defaultAbiCoder.encode(
|
|
20
8
|
["tuple(bytes32 walletSalt, bytes[] ops)"],
|
|
21
9
|
[
|
|
22
10
|
{
|
|
23
|
-
walletSalt:
|
|
24
|
-
ops:
|
|
11
|
+
walletSalt: i ?? e.utils.hexlify(new Uint8Array(32)),
|
|
12
|
+
ops: t
|
|
25
13
|
}
|
|
26
14
|
]
|
|
27
15
|
);
|
|
28
16
|
export {
|
|
29
|
-
|
|
30
|
-
|
|
17
|
+
p as emporiumOp,
|
|
18
|
+
m as encodeEmporiumMetadata
|
|
31
19
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../../externalABIs/index.cjs"),p=require("ethers"),d=require("./emporium.helpers.cjs");var o=(e=>(e[e.Erc20Token=0]="Erc20Token",e[e.Uniswap=1]="Uniswap",e))(o||{});const h=(e,c,n,i,s,a)=>{let r="";switch(e){case 0:r=t.ERC20ABI;break;case 1:r=t.ISwapRouterABI;break}if(!r)throw Error("No ABI match in produceOp");const u=new p.ethers.Contract(c,r);return d.emporiumOp(
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../../externalABIs/index.cjs"),p=require("ethers"),d=require("./emporium.helpers.cjs");var o=(e=>(e[e.Erc20Token=0]="Erc20Token",e[e.Uniswap=1]="Uniswap",e))(o||{});const h=(e,c,n,i,s,a)=>{let r="";switch(e){case 0:r=t.ERC20ABI;break;case 1:r=t.ISwapRouterABI;break}if(!r)throw Error("No ABI match in produceOp");const u=new p.ethers.Contract(c,r);return d.emporiumOp(u,n,i,s,a)};exports.OpType=o;exports.produceOp=h;
|
|
@@ -15,7 +15,7 @@ const E = (r, t, e, c, a, n) => {
|
|
|
15
15
|
if (!o)
|
|
16
16
|
throw Error("No ABI match in produceOp");
|
|
17
17
|
const i = new p.Contract(t, o);
|
|
18
|
-
return u(
|
|
18
|
+
return u(i, e, c, a, n);
|
|
19
19
|
};
|
|
20
20
|
export {
|
|
21
21
|
w as OpType,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../../constants/token-data/index.cjs");require("../../constants/chains.constants.cjs");require("../../constants/vite.constants.cjs");require("../../constants/contracts.constants.cjs");require("../../constants/kyc.constants.cjs");const o=require("../../constants/server.constants.cjs");require("../../constants/coingecko.constants.cjs");require("../../constants/axelar.constants.cjs");require("../../constants/rewards.constants.cjs");require("../../constants/reorg-depths.constants.cjs");const i=require("../utils/caseInsensitive.utils.cjs");require("../../types/circom-data.types.cjs");const s=require("../../types/hinkal.types.cjs");require("../../types/transactions.types.cjs");const n=require("../../types/pendle.types.cjs");require("../../types/curve.types.cjs");require("ethers");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("idb-keyval");require("../utils/external-action.utils.cjs");const c=require("../utils/erc20tokenFunctions.cjs");require("../utils/convertIntegrationProviderToExternalActionId.cjs");require("axios");require("process");require("buffer");require("../utils/userAgent.cjs");require("../../data-structures/volatile-helper/VolatileHelper.cjs");const T=require("../utils/enum.utils.cjs");function P(e){if(!e)return;const r=c.getERC20Token(e.address,e.chainId);if(!r?.isVolatile)return r}function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../../constants/token-data/index.cjs");require("../../constants/chains.constants.cjs");require("../../constants/vite.constants.cjs");require("../../constants/contracts.constants.cjs");require("../../constants/kyc.constants.cjs");const o=require("../../constants/server.constants.cjs");require("../../constants/coingecko.constants.cjs");require("../../constants/axelar.constants.cjs");require("../../constants/rewards.constants.cjs");require("../../constants/reorg-depths.constants.cjs");const i=require("../utils/caseInsensitive.utils.cjs");require("../../types/circom-data.types.cjs");const s=require("../../types/hinkal.types.cjs");require("../../types/transactions.types.cjs");const n=require("../../types/pendle.types.cjs");require("../../types/curve.types.cjs");require("ethers");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("idb-keyval");require("../utils/external-action.utils.cjs");const c=require("../utils/erc20tokenFunctions.cjs");require("../utils/convertIntegrationProviderToExternalActionId.cjs");require("axios");require("process");require("buffer");require("../utils/userAgent.cjs");require("../../data-structures/custom-token-registry/CustomTokenRegistry.cjs");require("../../data-structures/volatile-helper/VolatileHelper.cjs");const T=require("../utils/enum.utils.cjs");function P(e){if(!e)return;const r=c.getERC20Token(e.address,e.chainId);if(!r?.isVolatile)return r}function q(e,r){if(!e||!r)return;let t;switch(r){case n.PendleAssetType.YT:t=e?.yt;break;case n.PendleAssetType.PT:t=e?.pt;break;case n.PendleAssetType.PENDLE_LP:t=e?.lp;break;case n.PendleAssetType.SY:t=e?.sy;break;default:t=void 0;break}return t}const w=(e,r,t)=>{if(i.caseInsensitiveEqual(e.yt.address,t.erc20TokenAddress))return n.PendleSwapType.SwapExactTokenForYt;if(i.caseInsensitiveEqual(e.pt.address,t.erc20TokenAddress))return n.PendleSwapType.SwapExactTokenForPt;if(i.caseInsensitiveEqual(e.yt.address,r.erc20TokenAddress))return n.PendleSwapType.SwapExactYtForToken;if(i.caseInsensitiveEqual(e.pt.address,r.erc20TokenAddress))return n.PendleSwapType.SwapExactPtForToken},F=e=>{let r;switch(e){case n.PendleSwapType.SwapExactTokenForYt:r=o.API_CONFIG.ROUTES.pendleSwapExactTokenForYT;break;case n.PendleSwapType.SwapExactTokenForPt:r=o.API_CONFIG.ROUTES.pendleSwapExactTokenForPt;break;case n.PendleSwapType.SwapExactYtForToken:r=o.API_CONFIG.ROUTES.pendleSwapExactYtForToken;break;case n.PendleSwapType.SwapExactPtForToken:r=o.API_CONFIG.ROUTES.pendleSwapExactPtForToken;break;default:throw new Error("Cant determine Pendle Swap Type Api Route")}return r},k=(e,r,t,a)=>{if(!T.isInEnum(s.PendleAction,e))throw new Error("getTokenIndexForPendleFlatFee: Invalid Pendle Action");if(a)return t.findIndex(d=>d.toLowerCase()===a?.toLowerCase());const l=r.findIndex(d=>d>0n),p=r.length-1;if(r[p]<=0n)throw new Error("getTokenIndexForPendleFlatFee: Last token in amountChange is not > 0");let u=l;return(e===s.PendleAction.Mint||e===s.PendleAction.Redeem||e===s.PendleAction.PoolRemove)&&(u=l),u};exports.determinePendleSwapType=w;exports.determinePendleSwapTypeApiRoute=F;exports.erc20TokenFromPendleAsset=P;exports.getAssetTypeFromPendleMarket=q;exports.getTokenIndexForPendleFlatFee=k;
|