@hinkal/common 0.1.66 → 0.1.67

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/index.mjs CHANGED
@@ -5,7 +5,7 @@ import { getBeefyHistoricalChartData as c } from "./API/callBeefyGraphAPI.mjs";
5
5
  import { callRelayerTransactAPI as x } from "./API/callRelayer.mjs";
6
6
  import { getAxelarGasEstimate as A } from "./API/getAxelarGasEstimate.mjs";
7
7
  import { getGasEstimates as y } from "./API/getGasEstimates.mjs";
8
- import { getTokenPrice as P, getTokenPriceEth as T, getTokenPrices as k } from "./API/getTokenPrice.mjs";
8
+ import { getTokenPrice as T, getTokenPriceEth as P, getTokenPrices as k } from "./API/getTokenPrice.mjs";
9
9
  import { checkRisk as C } from "./API/checkRisk.mjs";
10
10
  import { getIdleRelay as E } from "./API/relayCalls.mjs";
11
11
  import { API as b } from "./API/API.mjs";
@@ -28,7 +28,7 @@ import { networkRegistry as ce } from "./constants/token-data/polygonRegistry.js
28
28
  import { networkRegistry as xe } from "./constants/token-data/avalancheRegistry.json.mjs";
29
29
  import { networkRegistry as Ae } from "./constants/token-data/optimismRegistry.json.mjs";
30
30
  import { networkRegistry as ye } from "./constants/token-data/baseRegistry.json.mjs";
31
- import { networkRegistry as Pe } from "./constants/token-data/localhostRegistry.json.mjs";
31
+ import { networkRegistry as Te } from "./constants/token-data/localhostRegistry.json.mjs";
32
32
  import { PopularTokenSymbols as ke } from "./constants/token-data/popularTokens.constants.mjs";
33
33
  import { getERC20Registry as Ce, getFixedRegistry as Ie } from "./constants/token-data/ERC20Registry.mjs";
34
34
  import { default as he } from "./constants/deploy-data/deploy-data-bnbMainnet.json.mjs";
@@ -43,12 +43,12 @@ import { default as Ge } from "./constants/deploy-data/deploy-data-axelar1.json.
43
43
  import { default as Ye } from "./constants/deploy-data/deploy-data-axelar2.json.mjs";
44
44
  import { EthereumNetworkType as Ze, chainIds as qe, chainIdsByType as Qe, crossChainAccessTokenNetworks as je, getNonLocalhostChainId as Xe, isLocalNetwork as Je, isOptimismBedrockLike as $e, isOptimismEcotoneLike as er, isOptimismLike as rr, localhostNetwork as or, networkRegistry as tr } from "./constants/chains.constants.mjs";
45
45
  import { HINKAL_EXTERNAL_ACTION_FEE as ir, HINKAL_UNIVERSAL_FEE as sr, getAmountAfterRelayAndFlatFees as nr, getAmountAfterRelayAndFlatFeesAndSlippage as pr, getAmountAfterRelayFee as mr, getAmountAfterSlippage as lr, getAmountWithoutFee as fr, getHinkalFeeRateInBeeps as cr, getRelayFee as dr, getSlippageFee as xr } from "./constants/fees.constants.mjs";
46
- import { contractMetadataMapping as Ar, getHinkalParameters as ur, uniswapV2PoolData as yr, uniswapV3FactoryData as Rr, uniswapV3PoolData as Pr, uniswapV3QuoterData as Tr } from "./constants/contracts.constants.mjs";
46
+ import { contractMetadataMapping as Ar, getHinkalParameters as ur, uniswapV2PoolData as yr, uniswapV3FactoryData as Rr, uniswapV3PoolData as Tr, uniswapV3QuoterData as Pr } from "./constants/contracts.constants.mjs";
47
47
  import { AIPRISE_KYB_TEMPLATE_ID_PROD as Sr, AIPRISE_KYC_TEMPLATE_ID_PROD as Cr, RECLAIM_MESSAGE_TO_SIGN as Ir, ReclaimPassports as Er, StandardPassports as hr, SupportedPassports as br, aipriseBaseOnboardingProductionUrl as Dr, aipriseBaseOnboardingSandboxUrl as vr, supportedPassportLinks as Lr } from "./constants/kyc.constants.mjs";
48
48
  import { API_CONFIG as _r, DATA_SERVER_CONFIG as Fr, DATA_SERVER_PORT as Mr, DATA_SERVER_URL_LOCAL as Ur, DATA_SERVER_URL_PRODUCTION as Br, PLAYGROUND_RELAYER_URLS as Nr, PLAYGROUND_SERVER_URLS as Or, PLAYGROUND_URL as Vr, RELAYER_CONFIG as Wr, RELAYER_URLS as Hr, SERVER_URLS as Gr, STAGING_RELAYER_URLS as Kr, STAGING_SERVER_URLS as Yr, STAGING_URL as zr } from "./constants/server.constants.mjs";
49
49
  import { DEPLOYMENT_MODE as qr, deploymentMode as Qr, isDevelopment as jr, isNode as Xr, isNotClientProduction as Jr, isNotProduction as $r, isPlayground as eo, isStaging as ro, isWebpack as oo } from "./constants/vite.constants.mjs";
50
50
  import { CIRCOM_P as ao, CIRCOM_P_HALF as io, beefyChainIds as so, crvSymbol as no, curveWithdrawGasTokenAddress as po, curveZeroAddress as mo, cvxSymbol as lo, ethVolatileAddress as fo, oneInchZeroAddress as co, ownerPublicKey as xo, permitSignatureValidFor as go, signaturePhrase as Ao, threePoolSymbol as uo, zeroAddress as yo } from "./constants/protocol.constants.mjs";
51
- import { COINGECKO_API_KEY as Po, CoinGeckoChainLabels as To, coingeckoPriceUrl as ko, coingeckoPriceUrl2 as So, coingeckoTokenListUrl as Co, getCoingeckoIdForNativeTokens as Io, getCoingeckoPlatform as Eo, proCoingeckoUrl as ho, proHeader as bo } from "./constants/coingecko.constants.mjs";
51
+ import { COINGECKO_API_KEY as To, CoinGeckoChainLabels as Po, coingeckoPriceUrl as ko, coingeckoPriceUrl2 as So, coingeckoTokenListUrl as Co, getCoingeckoIdForNativeTokens as Io, getCoingeckoPlatform as Eo, proCoingeckoUrl as ho, proHeader as bo } from "./constants/coingecko.constants.mjs";
52
52
  import { AxelarRegistry as vo } from "./constants/axelar.constants.mjs";
53
53
  import { NETWORKS as wo, getGasStationUrl as _o } from "./constants/backend.constants.mjs";
54
54
  import { arbMainnetCrvCvxRegistry as Mo, avalancheCrvCvxRegistry as Uo, baseCrvCvxRegistry as Bo, ethCrvCvxRegistry as No, getCrvCvxWithChainId as Oo, optimismCrvCvxRegistry as Vo, polygonCrvCvxRegistry as Wo } from "./constants/crvCvx.registry.mjs";
@@ -57,7 +57,7 @@ import { ethSymbol as Yo, lidoStEthContractAddress as zo, lidoStMaticAddress as
57
57
  import { ACCESS_TOKEN_MINTING_POINTS as ot, CERTIFICATION_DISABLE_WEEK as tt, REWARD_RECEIVABLE_TOKEN_SYMBOLS as at, RafflePrizePoints as it, boostAmounts as st, lpLink as nt, lpProgramStartWeek as pt, pointsLink as mt, raffleProgramStartWeek as lt, referralLink as ft } from "./constants/rewards.constants.mjs";
58
58
  import { blockReorgDepth as dt } from "./constants/reorg-depths.constants.mjs";
59
59
  import { ethBeefyRegistry as gt, getBeefyRegistryWithChainId as At } from "./constants/beefy.registry.mjs";
60
- import { arbPendleRegistry as yt, bnbPendleRegistry as Rt, ethPendleRegistry as Pt, findSyAddress as Tt, getPendleRegistryWithChainId as kt, getYtTokensWithChainId as St, isYtToken as Ct, optimismPendleRegistry as It } from "./constants/pendle.registry.mjs";
60
+ import { arbPendleRegistry as yt, bnbPendleRegistry as Rt, ethPendleRegistry as Tt, findSyAddress as Pt, getPendleRegistryWithChainId as kt, getYtTokensWithChainId as St, isYtToken as Ct, optimismPendleRegistry as It } from "./constants/pendle.registry.mjs";
61
61
  import { poseidonFunction as ht, poseidonHash as bt, poseidonHolder as Dt } from "./crypto/poseidon.mjs";
62
62
  import { babyJubInstance as Lt, jubHolder as wt } from "./crypto/babyJub.mjs";
63
63
  import { preProcessing as Ft } from "./crypto/preProcessing.mjs";
@@ -76,7 +76,7 @@ import { hinkalSwap as ca } from "./data-structures/Hinkal/hinkalSwap.mjs";
76
76
  import { hinkalTransfer as xa } from "./data-structures/Hinkal/hinkalTransfer.mjs";
77
77
  import { hinkalWithdraw as Aa } from "./data-structures/Hinkal/hinkalWithdraw.mjs";
78
78
  import { hinkalPrivateWallet as ya } from "./data-structures/Hinkal/hinkalPrivateWallet.mjs";
79
- import { resetMerkleTrees as Pa } from "./data-structures/Hinkal/resetMerkleTrees.mjs";
79
+ import { resetMerkleTrees as Ta } from "./data-structures/Hinkal/resetMerkleTrees.mjs";
80
80
  import { MerkleTree as ka } from "./data-structures/merkle-tree/MerkleTree.mjs";
81
81
  import { MerkleTreeIncompleteError as Ca } from "./data-structures/merkle-tree/MerkleTreeIncompleteError.mjs";
82
82
  import { AbstractAccessTokenSnapshotService as Ea } from "./data-structures/event-service/AbstractAccessTokenSnapshotService.mjs";
@@ -101,7 +101,7 @@ import { checkErrorForSnapshotRestore as ci } from "./error-handling/handleError
101
101
  import { logError as xi } from "./error-handling/logError.mjs";
102
102
  import { ErrorCategory as Ai } from "./error-handling/types.mjs";
103
103
  import { abi as yi } from "./externalABIs/amToken.mjs";
104
- import { abi as Pi } from "./externalABIs/BeefyVaultAbi.json.mjs";
104
+ import { abi as Ti } from "./externalABIs/BeefyVaultAbi.json.mjs";
105
105
  import { abi as ki } from "./externalABIs/BUSD.mjs";
106
106
  import { abi as Ci } from "./externalABIs/CurveReadingWrapperAbi.json.mjs";
107
107
  import { abi as Ei } from "./externalABIs/CurveWrappedMainPool.json.mjs";
@@ -127,7 +127,7 @@ import { abi as ls } from "./externalABIs/BabPassport.json.mjs";
127
127
  import { abi as cs } from "./externalABIs/GalxePassport.json.mjs";
128
128
  import { default as xs } from "./externalABIs/OptimismGasPriceOracle.json.mjs";
129
129
  import { checkHinkalAccessToken as As, mintAccessToken as us, mintTokenCrossChain as ys } from "./functions/web3/functionCalls/accessTokenCalls.mjs";
130
- import { openPassportWindow as Ps } from "./functions/kyc/passportHelper.mjs";
130
+ import { openPassportWindow as Ts } from "./functions/kyc/passportHelper.mjs";
131
131
  import { openDefaultPassportWindow as ks } from "./functions/kyc/openDefaultPassportWindow.mjs";
132
132
  import { absBigInt as Cs, beepsToPercentage as Is, bigintApplySugar as Es, bigintMax as hs, calculateAmountUsingBeeps as bs, calculateSum as Ds, fixDecimalsAmount as vs, getValueFirstNDigit as Ls, minBigInt as ws, toBigInt as _s, toBigIntOrUndefined as Fs, toCommaSeparatedNumberString as Ms, toInt as Us, toNumberOrUndefined as Bs, trimLeadingZeros as Ns, truncateTo18DecimalPlaces as Os } from "./functions/utils/amounts.utils.mjs";
133
133
  import { getFilePath as Ws, getHinkalCache as Hs, loadTxsCache as Gs, resetCache as Ks, saveTxsCache as Ys, setHinkalCache as zs } from "./functions/utils/cacheFunctions.mjs";
@@ -140,7 +140,7 @@ import { convertIntegrationProviderToExternalActionId as dn } from "./functions/
140
140
  import { getInteractionFromAction as gn } from "./functions/pre-transaction/interaction-to-action.mjs";
141
141
  import { outputUtxoProcessing as un } from "./functions/pre-transaction/outputUtxoProcessing.mjs";
142
142
  import { processGasEstimates as Rn } from "./functions/pre-transaction/process-gas-estimates.mjs";
143
- import { processAmountChanges as Tn } from "./functions/pre-transaction/processAmountChanges.mjs";
143
+ import { processAmountChanges as Pn } from "./functions/pre-transaction/processAmountChanges.mjs";
144
144
  import { getFlatFees as Sn } from "./functions/pre-transaction/getFlatFees.mjs";
145
145
  import { getNetworkObject as In, getNetworkType as En } from "./functions/utils/evmNetworkFunctions.mjs";
146
146
  import { getAxelarMigrationInfo as bn } from "./functions/utils/axelar.utils.mjs";
@@ -157,7 +157,7 @@ import { debounce as op, wait as tp } from "./functions/utils/process.utils.mjs"
157
157
  import { calculateDollarValue as ip, ethToWei as sp, getAmountInToken as np, getAmountInWei as pp, getAmountInWeiOrZero as mp, getAmountWithPrecision as lp, getAmountWithPrecisionOrZero as fp, randomBigInt as cp, toBigIntWithDecimals as dp } from "./functions/web3/etherFunctions.mjs";
158
158
  import { getInputUtxoAndBalance as gp, getInputUtxosFromEncryptedOutputs as Ap } from "./functions/web3/events/getInputUtxoAndBalance.mjs";
159
159
  import { addPaddingToUtxos as yp, getShieldedBalance as Rp } from "./functions/web3/events/getShieldedBalance.mjs";
160
- import { getDepositEvents as Tp, retrieveEvents as kp } from "./functions/web3/events/web3RetrieveEvents.mjs";
160
+ import { getDepositEvents as Pp, retrieveEvents as kp } from "./functions/web3/events/web3RetrieveEvents.mjs";
161
161
  import { balanceChangedHandler as Cp } from "./functions/web3/events/balanceChangedHandler.mjs";
162
162
  import { getUniswapFee as Ep, getUniswapPrice as hp, getUniswapPriceHelper as bp, searchPoolAndFee as Dp } from "./functions/web3/uniswapAPI.mjs";
163
163
  import { getOdosPrice as Lp } from "./functions/web3/odosAPI.mjs";
@@ -172,21 +172,22 @@ import { getCVX as tm } from "./functions/protocols/convex.protocols.mjs";
172
172
  import { determinePendleSwapType as im, determinePendleSwapTypeApiRoute as sm, erc20TokenFromPendleAsset as nm, getAssetTypeFromPendleMarket as pm, getTokenIndexForPendleFlatFee as mm } from "./functions/protocols/pendle.helpers.mjs";
173
173
  import { calculateStakeNullifier as fm, createStakeCommitment as cm, decryptStake as dm, encodeHStakeMetadata as xm, encryptStake as gm } from "./functions/staking/index.mjs";
174
174
  import { emporiumOp as um, encodeEmporiumMetadata as ym } from "./functions/private-wallet/emporium.helpers.mjs";
175
- import { OpType as Pm, produceOp as Tm } from "./functions/private-wallet/opProducer.mjs";
175
+ import { OpType as Tm, produceOp as Pm } from "./functions/private-wallet/opProducer.mjs";
176
176
  import { dataBeefyApiConfig as Sm, isBeefyDeposit as Cm } from "./types/beefy.types.mjs";
177
177
  import { defaultHookData as Em, defaultHookDataArray as hm, defaultStealthAddressStructure as bm, emptyStealthAddressStructure as Dm } from "./types/circom-data.types.mjs";
178
178
  import { ContractType as Lm } from "./types/ethereum-network.types.mjs";
179
179
  import { ExternalActionId as _m } from "./types/external-action.types.mjs";
180
- import { BeefyAction as Mm, ConvexAction as Um, CurveAction as Bm, EventType as Nm, INTERACTION as Om, IntegrationProvider as Vm, LidoAction as Wm, LidoVariant as Hm, PendleAction as Gm, PendleLPAction as Km, StakeProvider as Ym, VolatileAction as zm } from "./types/hinkal.types.mjs";
181
- import { KycVerificationResult as qm, KycVerificationStatus as Qm, Passports as jm, VERIFICATION_TYPE as Xm, VerificationTypes as Jm } from "./types/kyc.types.mjs";
182
- import { ApprovalType as el } from "./types/token.types.mjs";
183
- import { SlippageType as ol, slippageLevels as tl } from "./types/slippage.types.mjs";
184
- import { emptyDecodedTx as il } from "./types/transactions.types.mjs";
185
- import { MONTHS as nl, dayInMilliseconds as pl, divideMonthOnIntervals as ml, getCurrentWeek as ll, getDateFromWeek as fl, getNextDay as cl, getWeekTimestamps as dl, hasCertificationPeriodExpired as xl, hourInMilliseconds as gl, isWeekCurrent as Al, minuteInMilliseconds as ul, parseWeek as yl, secondInMilliseconds as Rl, toDateString as Pl, weekInMilliseconds as Tl } from "./types/time.types.mjs";
186
- import { BonusType as Sl, CertifyType as Cl, LP_TIER as Il, PaymentStatus as El, PointType as hl, RafflePrizeType as bl, RewardPage as Dl, RewardsHistoryDistribution as vl, RewardsHistoryEligibility as Ll, RewardsHistorySnapshots as wl, RewardsHistoryStatuses as _l, RewardsPageTabs as Fl, TIER_LEVEL as Ml, Timeline as Ul, emptyUserPointsBreakdown as Bl, emptyUserPointsResponse as Nl } from "./types/rewards.types.mjs";
187
- import { PendleAssetType as Vl, PendleChains as Wl, PendleDashboardTabs as Hl, PendleEarnTabs as Gl, PendleMarketTransactionTypes as Kl, PendlePoolManualTabs as Yl, PendlePoolTabs as zl, PendlePoolZapTabs as Zl, PendleSwapType as ql, PendleTabs as Ql, PendleTradeGeneralTabs as jl, PendleTradeTabs as Xl } from "./types/pendle.types.mjs";
188
- import { StatType as $l, UpperTabPossibleValues as ef, curveNetworkNames as rf, curvePools as of } from "./types/curve.types.mjs";
189
- import { HinkalStakeMode as af } from "./types/hinkal.stake.types.mjs";
180
+ import { BeefyAction as Mm, ConvexAction as Um, CurveAction as Bm, EventType as Nm, HinkalStakeAction as Om, INTERACTION as Vm, IntegrationProvider as Wm, LidoAction as Hm, LidoVariant as Gm, PendleAction as Km, PendleLPAction as Ym, StakeProvider as zm, VolatileAction as Zm } from "./types/hinkal.types.mjs";
181
+ import { KycVerificationResult as Qm, KycVerificationStatus as jm, Passports as Xm, VERIFICATION_TYPE as Jm, VerificationTypes as $m } from "./types/kyc.types.mjs";
182
+ import { ApprovalType as rl } from "./types/token.types.mjs";
183
+ import { SlippageType as tl, slippageLevels as al } from "./types/slippage.types.mjs";
184
+ import { emptyDecodedTx as sl } from "./types/transactions.types.mjs";
185
+ import { MONTHS as pl, dayInMilliseconds as ml, divideMonthOnIntervals as ll, getCurrentWeek as fl, getDateFromWeek as cl, getNextDay as dl, getWeekTimestamps as xl, hasCertificationPeriodExpired as gl, hourInMilliseconds as Al, isWeekCurrent as ul, minuteInMilliseconds as yl, parseWeek as Rl, secondInMilliseconds as Tl, toDateString as Pl, weekInMilliseconds as kl } from "./types/time.types.mjs";
186
+ import { BonusType as Cl, CertifyType as Il, LP_TIER as El, PaymentStatus as hl, PointType as bl, RafflePrizeType as Dl, RewardPage as vl, RewardsHistoryDistribution as Ll, RewardsHistoryEligibility as wl, RewardsHistorySnapshots as _l, RewardsHistoryStatuses as Fl, RewardsPageTabs as Ml, TIER_LEVEL as Ul, Timeline as Bl, emptyUserPointsBreakdown as Nl, emptyUserPointsResponse as Ol } from "./types/rewards.types.mjs";
187
+ import { PendleAssetType as Wl, PendleChains as Hl, PendleDashboardTabs as Gl, PendleEarnTabs as Kl, PendleMarketTransactionTypes as Yl, PendlePoolManualTabs as zl, PendlePoolTabs as Zl, PendlePoolZapTabs as ql, PendleSwapType as Ql, PendleTabs as jl, PendleTradeGeneralTabs as Xl, PendleTradeTabs as Jl } from "./types/pendle.types.mjs";
188
+ import { StatType as ef, UpperTabPossibleValues as rf, curveNetworkNames as of, curvePools as tf } from "./types/curve.types.mjs";
189
+ import { HinkalStakeMode as sf } from "./types/hinkal.stake.types.mjs";
190
+ import { AdminActionType as pf, AdminDetailedActionType as mf } from "./types/admin.types.mjs";
190
191
  export {
191
192
  ot as ACCESS_TOKEN_MINTING_POINTS,
192
193
  Sr as AIPRISE_KYB_TEMPLATE_ID_PROD,
@@ -198,20 +199,22 @@ export {
198
199
  Fa as AbstractEventService,
199
200
  va as AbstractNullifierSnapshotService,
200
201
  wa as AbstractSnapshotService,
202
+ pf as AdminActionType,
203
+ mf as AdminDetailedActionType,
201
204
  yi as AmTokenABI,
202
- el as ApprovalType,
205
+ rl as ApprovalType,
203
206
  vo as AxelarRegistry,
204
207
  ki as BUSDABI,
205
208
  ls as BabABI,
206
209
  Mm as BeefyAction,
207
- Pi as BeefyVaultABI,
208
- Sl as BonusType,
210
+ Ti as BeefyVaultABI,
211
+ Cl as BonusType,
209
212
  tt as CERTIFICATION_DISABLE_WEEK,
210
213
  ao as CIRCOM_P,
211
214
  io as CIRCOM_P_HALF,
212
- Po as COINGECKO_API_KEY,
213
- Cl as CertifyType,
214
- To as CoinGeckoChainLabels,
215
+ To as COINGECKO_API_KEY,
216
+ Il as CertifyType,
217
+ Po as CoinGeckoChainLabels,
215
218
  Lm as ContractType,
216
219
  Um as ConvexAction,
217
220
  Bm as CurveAction,
@@ -234,68 +237,69 @@ export {
234
237
  ir as HINKAL_EXTERNAL_ACTION_FEE,
235
238
  sr as HINKAL_UNIVERSAL_FEE,
236
239
  $t as Hinkal,
237
- af as HinkalStakeMode,
240
+ Om as HinkalStakeAction,
241
+ sf as HinkalStakeMode,
238
242
  V as IMAGE_PATHS,
239
- Om as INTERACTION,
243
+ Vm as INTERACTION,
240
244
  qi as ISwapRouterABI,
241
- Vm as IntegrationProvider,
242
- qm as KycVerificationResult,
243
- Qm as KycVerificationStatus,
244
- Il as LP_TIER,
245
- Wm as LidoAction,
246
- Hm as LidoVariant,
245
+ Wm as IntegrationProvider,
246
+ Qm as KycVerificationResult,
247
+ jm as KycVerificationStatus,
248
+ El as LP_TIER,
249
+ Hm as LidoAction,
250
+ Gm as LidoVariant,
247
251
  $a as LocalStorageCacheDevice,
248
- nl as MONTHS,
252
+ pl as MONTHS,
249
253
  ka as MerkleTree,
250
254
  Ca as MerkleTreeIncompleteError,
251
255
  Qa as MultiThreadedUtxoUtils,
252
256
  wo as NETWORKS,
253
- Pm as OpType,
257
+ Tm as OpType,
254
258
  Nr as PLAYGROUND_RELAYER_URLS,
255
259
  Or as PLAYGROUND_SERVER_URLS,
256
260
  Vr as PLAYGROUND_URL,
257
- jm as Passports,
258
- El as PaymentStatus,
259
- Gm as PendleAction,
260
- Vl as PendleAssetType,
261
- Wl as PendleChains,
262
- Hl as PendleDashboardTabs,
263
- Gl as PendleEarnTabs,
264
- Km as PendleLPAction,
265
- Kl as PendleMarketTransactionTypes,
266
- Yl as PendlePoolManualTabs,
267
- zl as PendlePoolTabs,
268
- Zl as PendlePoolZapTabs,
269
- ql as PendleSwapType,
270
- Ql as PendleTabs,
271
- jl as PendleTradeGeneralTabs,
272
- Xl as PendleTradeTabs,
273
- hl as PointType,
261
+ Xm as Passports,
262
+ hl as PaymentStatus,
263
+ Km as PendleAction,
264
+ Wl as PendleAssetType,
265
+ Hl as PendleChains,
266
+ Gl as PendleDashboardTabs,
267
+ Kl as PendleEarnTabs,
268
+ Ym as PendleLPAction,
269
+ Yl as PendleMarketTransactionTypes,
270
+ zl as PendlePoolManualTabs,
271
+ Zl as PendlePoolTabs,
272
+ ql as PendlePoolZapTabs,
273
+ Ql as PendleSwapType,
274
+ jl as PendleTabs,
275
+ Xl as PendleTradeGeneralTabs,
276
+ Jl as PendleTradeTabs,
277
+ bl as PointType,
274
278
  ke as PopularTokenSymbols,
275
279
  Ir as RECLAIM_MESSAGE_TO_SIGN,
276
280
  Wr as RELAYER_CONFIG,
277
281
  Hr as RELAYER_URLS,
278
282
  at as REWARD_RECEIVABLE_TOKEN_SYMBOLS,
279
283
  it as RafflePrizePoints,
280
- bl as RafflePrizeType,
284
+ Dl as RafflePrizeType,
281
285
  Er as ReclaimPassports,
282
- Dl as RewardPage,
283
- vl as RewardsHistoryDistribution,
284
- Ll as RewardsHistoryEligibility,
285
- wl as RewardsHistorySnapshots,
286
- _l as RewardsHistoryStatuses,
287
- Fl as RewardsPageTabs,
286
+ vl as RewardPage,
287
+ Ll as RewardsHistoryDistribution,
288
+ wl as RewardsHistoryEligibility,
289
+ _l as RewardsHistorySnapshots,
290
+ Fl as RewardsHistoryStatuses,
291
+ Ml as RewardsPageTabs,
288
292
  Gr as SERVER_URLS,
289
293
  Kr as STAGING_RELAYER_URLS,
290
294
  Yr as STAGING_SERVER_URLS,
291
295
  zr as STAGING_URL,
292
- ol as SlippageType,
293
- Ym as StakeProvider,
296
+ tl as SlippageType,
297
+ zm as StakeProvider,
294
298
  hr as StandardPassports,
295
- $l as StatType,
299
+ ef as StatType,
296
300
  br as SupportedPassports,
297
- Ml as TIER_LEVEL,
298
- Ul as Timeline,
301
+ Ul as TIER_LEVEL,
302
+ Bl as Timeline,
299
303
  Va as TokenChecker,
300
304
  Ka as TransactionType,
301
305
  Ha as TransactionsManager,
@@ -303,14 +307,14 @@ export {
303
307
  Hi as USDR3CRVABI,
304
308
  Vi as USDRABI,
305
309
  Ki as USDTABI,
306
- ef as UpperTabPossibleValues,
310
+ rf as UpperTabPossibleValues,
307
311
  si as UserFriendlyErrorCodes,
308
312
  qt as UserKeys,
309
313
  Ua as Utxo,
310
- Xm as VERIFICATION_TYPE,
314
+ Jm as VERIFICATION_TYPE,
311
315
  Ut as ValueCache,
312
- Jm as VerificationTypes,
313
- zm as VolatileAction,
316
+ $m as VerificationTypes,
317
+ Zm as VolatileAction,
314
318
  Za as VolatileHelper,
315
319
  zi as WETHABI,
316
320
  Nt as abiDecodeUtxo,
@@ -381,15 +385,15 @@ export {
381
385
  cm as createStakeCommitment,
382
386
  je as crossChainAccessTokenNetworks,
383
387
  no as crvSymbol,
384
- rf as curveNetworkNames,
385
- of as curvePools,
388
+ of as curveNetworkNames,
389
+ tf as curvePools,
386
390
  po as curveWithdrawGasTokenAddress,
387
391
  mo as curveZeroAddress,
388
392
  Na as customTokenRegistry,
389
393
  lo as cvxSymbol,
390
394
  bi as daiABI,
391
395
  Sm as dataBeefyApiConfig,
392
- pl as dayInMilliseconds,
396
+ ml as dayInMilliseconds,
393
397
  op as debounce,
394
398
  js as decodeMetadata,
395
399
  _n as decodeTxInput,
@@ -407,12 +411,12 @@ export {
407
411
  Mn as deserializeDecodedTxs,
408
412
  im as determinePendleSwapType,
409
413
  sm as determinePendleSwapTypeApiRoute,
410
- ml as divideMonthOnIntervals,
414
+ ll as divideMonthOnIntervals,
411
415
  um as emporiumOp,
412
- il as emptyDecodedTx,
416
+ sl as emptyDecodedTx,
413
417
  Dm as emptyStealthAddressStructure,
414
- Bl as emptyUserPointsBreakdown,
415
- Nl as emptyUserPointsResponse,
418
+ Nl as emptyUserPointsBreakdown,
419
+ Ol as emptyUserPointsResponse,
416
420
  ym as encodeEmporiumMetadata,
417
421
  xm as encodeHStakeMetadata,
418
422
  gm as encryptStake,
@@ -423,14 +427,14 @@ export {
423
427
  Le as ethMainnetData,
424
428
  se as ethMainnetRegistry,
425
429
  z as ethMainnetRegistryFixed,
426
- Pt as ethPendleRegistry,
430
+ Tt as ethPendleRegistry,
427
431
  Yo as ethSymbol,
428
432
  sp as ethToWei,
429
433
  fo as ethVolatileAddress,
430
434
  Ya as externalActionToTransactionType,
431
435
  mi as extractMessage,
432
436
  Fi as factoryABI,
433
- Tt as findSyAddress,
437
+ Pt as findSyAddress,
434
438
  vs as fixDecimalsAmount,
435
439
  $p as generateZkProof,
436
440
  Xs as getActionFromMetadata,
@@ -460,12 +464,12 @@ export {
460
464
  n as getCoingeckoPrices,
461
465
  p as getCoingeckoTokenList,
462
466
  Oo as getCrvCvxWithChainId,
463
- ll as getCurrentWeek,
467
+ fl as getCurrentWeek,
464
468
  v as getCurvePools,
465
469
  L as getCurvePoolsforPriceFetching,
466
470
  o as getDataServerURL,
467
- fl as getDateFromWeek,
468
- Tp as getDepositEvents,
471
+ cl as getDateFromWeek,
472
+ Pp as getDepositEvents,
469
473
  Ce as getERC20Registry,
470
474
  on as getERC20Token,
471
475
  tn as getERC20TokenBySymbol,
@@ -490,7 +494,7 @@ export {
490
494
  gn as getInteractionFromAction,
491
495
  In as getNetworkObject,
492
496
  En as getNetworkType,
493
- cl as getNextDay,
497
+ dl as getNextDay,
494
498
  Xe as getNonLocalhostChainId,
495
499
  Lp as getOdosPrice,
496
500
  _p as getOneInchPrice,
@@ -503,16 +507,16 @@ export {
503
507
  Rp as getShieldedBalance,
504
508
  xr as getSlippageFee,
505
509
  mm as getTokenIndexForPendleFlatFee,
506
- P as getTokenPrice,
507
- T as getTokenPriceEth,
510
+ T as getTokenPrice,
511
+ P as getTokenPriceEth,
508
512
  k as getTokenPrices,
509
513
  Ep as getUniswapFee,
510
514
  hp as getUniswapPrice,
511
515
  bp as getUniswapPriceHelper,
512
516
  Ls as getValueFirstNDigit,
513
- dl as getWeekTimestamps,
517
+ xl as getWeekTimestamps,
514
518
  St as getYtTokensWithChainId,
515
- xl as hasCertificationPeriodExpired,
519
+ gl as hasCertificationPeriodExpired,
516
520
  ra as hinkalActionBeefy,
517
521
  ta as hinkalActionConvex,
518
522
  ia as hinkalActionCurve,
@@ -523,7 +527,7 @@ export {
523
527
  ca as hinkalSwap,
524
528
  xa as hinkalTransfer,
525
529
  Aa as hinkalWithdraw,
526
- gl as hourInMilliseconds,
530
+ Al as hourInMilliseconds,
527
531
  Cm as isBeefyDeposit,
528
532
  Xt as isCircomNegative,
529
533
  jr as isDevelopment,
@@ -539,7 +543,7 @@ export {
539
543
  eo as isPlayground,
540
544
  ro as isStaging,
541
545
  oo as isWebpack,
542
- Al as isWeekCurrent,
546
+ ul as isWeekCurrent,
543
547
  Ct as isYtToken,
544
548
  wt as jubHolder,
545
549
  ji as lidoStEthAbi,
@@ -555,7 +559,7 @@ export {
555
559
  Gs as loadTxsCache,
556
560
  We as localhostData,
557
561
  or as localhostNetwork,
558
- Pe as localhostRegistry,
562
+ Te as localhostRegistry,
559
563
  xi as logError,
560
564
  Zn as lowerCaseIncludes,
561
565
  qn as lowerCaseStartsWith,
@@ -567,11 +571,11 @@ export {
567
571
  ws as minBigInt,
568
572
  us as mintAccessToken,
569
573
  ys as mintTokenCrossChain,
570
- ul as minuteInMilliseconds,
574
+ yl as minuteInMilliseconds,
571
575
  tr as networkRegistry,
572
576
  co as oneInchZeroAddress,
573
577
  ks as openDefaultPassportWindow,
574
- Ps as openPassportWindow,
578
+ Ts as openPassportWindow,
575
579
  Vo as optimismCrvCvxRegistry,
576
580
  _e as optimismData,
577
581
  xs as optimismGasPriceOracleAbi,
@@ -580,7 +584,7 @@ export {
580
584
  oe as optimismRegistryFixed,
581
585
  un as outputUtxoProcessing,
582
586
  xo as ownerPublicKey,
583
- yl as parseWeek,
587
+ Rl as parseWeek,
584
588
  Jn as patchRegistry,
585
589
  go as permitSignatureValidFor,
586
590
  os as poLidoNftAbi,
@@ -596,9 +600,9 @@ export {
596
600
  Ft as preProcessing,
597
601
  ho as proCoingeckoUrl,
598
602
  bo as proHeader,
599
- Tn as processAmountChanges,
603
+ Pn as processAmountChanges,
600
604
  Rn as processGasEstimates,
601
- Tm as produceOp,
605
+ Pm as produceOp,
602
606
  ln as promisify,
603
607
  wi as quoterV2ABI,
604
608
  lt as raffleProgramStartWeek,
@@ -607,7 +611,7 @@ export {
607
611
  Nn as reloadPage,
608
612
  nn as requireEnv,
609
613
  Ks as resetCache,
610
- Pa as resetMerkleTrees,
614
+ Ta as resetMerkleTrees,
611
615
  fn as resolveSync,
612
616
  ai as rethrowKnownGasErrorIfPossible,
613
617
  kp as retrieveEvents,
@@ -615,12 +619,12 @@ export {
615
619
  Ui as sanctionsListABI,
616
620
  Ys as saveTxsCache,
617
621
  Dp as searchPoolAndFee,
618
- Rl as secondInMilliseconds,
622
+ Tl as secondInMilliseconds,
619
623
  Xp as serializeCircomData,
620
624
  Un as serializeDecodedTxs,
621
625
  zs as setHinkalCache,
622
626
  Ao as signaturePhrase,
623
- tl as slippageLevels,
627
+ al as slippageLevels,
624
628
  $o as stMaticSymbol,
625
629
  Lr as supportedPassportLinks,
626
630
  uo as threePoolSymbol,
@@ -638,15 +642,15 @@ export {
638
642
  Os as truncateTo18DecimalPlaces,
639
643
  yr as uniswapV2PoolData,
640
644
  Rr as uniswapV3FactoryData,
641
- Pr as uniswapV3PoolData,
642
- Tr as uniswapV3QuoterData,
645
+ Tr as uniswapV3PoolData,
646
+ Pr as uniswapV3QuoterData,
643
647
  H as urlForBeefyVaultTokens,
644
648
  G as urlForBeefyVaultTotalInUSD,
645
649
  K as urlForRegularTokenPricesInBeefy,
646
650
  tp as wait,
647
651
  jn as waitLittle,
648
652
  Ln as walletSupported,
649
- Tl as weekInMilliseconds,
653
+ kl as weekInMilliseconds,
650
654
  et as wstEthSymbol,
651
655
  yo as zeroAddress
652
656
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hinkal/common",
3
- "version": "0.1.66",
3
+ "version": "0.1.67",
4
4
  "homepage": "hinkal.pro",
5
5
  "author": {
6
6
  "name": "Hinkal Protocol"
@@ -24,10 +24,18 @@
24
24
  "import": "./providers/Wagmiv1ProviderAdapter.mjs",
25
25
  "require": "./providers/Wagmiv1ProviderAdapter.cjs"
26
26
  },
27
+ "./providers/Wagmiv2ProviderAdapter": {
28
+ "import": "./providers/Wagmiv2ProviderAdapter.mjs",
29
+ "require": "./providers/Wagmiv2ProviderAdapter.cjs"
30
+ },
27
31
  "./providers/prepareEthersHinkal": {
28
32
  "import": "./providers/prepareEthersHinkal.mjs",
29
33
  "require": "./providers/prepareEthersHinkal.cjs"
30
34
  },
35
+ "./providers/prepareWagmiv2Hinkal": {
36
+ "import": "./providers/prepareWagmiv2Hinkal.mjs",
37
+ "require": "./providers/prepareWagmiv2Hinkal.cjs"
38
+ },
31
39
  "./providers/prepareWagmiv1Hinkal": {
32
40
  "import": "./providers/prepareWagmiv1Hinkal.mjs",
33
41
  "require": "./providers/prepareWagmiv1Hinkal.cjs"
@@ -60,11 +68,15 @@
60
68
  "uuid": "^9.0.1"
61
69
  },
62
70
  "peerDependencies": {
63
- "ethers": "5.x",
64
- "@wagmi/core": "^1.4.8"
71
+ "wagmi": "^1.4.8",
72
+ "wagmi2": "npm:wagmi@^2.12.24",
73
+ "ethers": "5.x"
65
74
  },
66
75
  "peerDependenciesMeta": {
67
- "@wagmi/core": {
76
+ "wagmi": {
77
+ "optional": true
78
+ },
79
+ "wagmi2": {
68
80
  "optional": true
69
81
  }
70
82
  }
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("../constants/chains.constants.cjs"),d=require("../constants/contracts.constants.cjs"),a=require("../error-handling/error-codes.constants.cjs"),c=require("ethers"),o=require("@wagmi/core");class h{connector;chainId;originalProvider;fetchProvider;signer;chainEventListener;unsubscribeFns=[];initConnector(t){this.connector=t}requireConnector(){if(!this.connector)throw Error("No Connector In Provider Adapter")}async init(t){this.requireConnector(),t&&(this.chainId=t),this.originalProvider=await this.connector.getProvider(),this.fetchProvider=this.createFetchProvider()??this.originalProvider,this.fetchProvider===this.originalProvider&&console.warn("fetchProvider not available");const r=await this.connector.getWalletClient();this.signer=await this.walletClientToSigner(r,this.chainId)}async disconnectFromConnector(){this.release(),await o.disconnect()}async connectToConnector(t){const{isConnected:r}=o.getAccount();r&&await this.disconnectFromConnector();try{return(await o.connect({connector:t})).chain.id}catch{throw new Error(a.transactionErrorCodes.CONNECTION_FAILED)}}async waitForTransaction(t,r){if((await this.fetchProvider?.waitForTransaction(t,r))?.status)return!0;throw Error(a.transactionErrorCodes.TRANSACTION_NOT_CONFIRMED)}async signMessage(t){const r=await o.signMessage({message:t});if(!r)throw new Error(a.transactionErrorCodes.SIGNING_FAILED);if(r.includes("error"))throw new Error(a.transactionErrorCodes.SIGNATURE_UNSUPPORTED_PERSONAL_SIGN);return r}async signTypedData(t,r,e){return this.signer._signTypedData(t,r,e)}getSelectedNetwork=()=>{if(!this.chainId)throw new Error("Illegal state: no chaindId");return i.networkRegistry[this.chainId]};async switchNetwork(t){return o.switchNetwork({chainId:t.chainId})}createFetchProvider(){try{const r=i.networkRegistry[this.chainId]?.fetchRpcUrl;return r?r.includes("wss")?new c.providers.WebSocketProvider(r):new c.providers.StaticJsonRpcProvider(r):void 0}catch(t){console.log("create Fetch Provider error",t);return}}async getAddress(){const{address:t}=o.getAccount();if(!t)throw new Error("IllegalState");return c.utils.getAddress(t)}setChainEventListener(t){this.chainEventListener=t,this.chainEventListener&&(this.unsubscribeFns.push(o.watchAccount(r=>{if(!this.chainEventListener){console.warn("chainEventListener is not set");return}this.chainEventListener.onAccountChanged()})),this.unsubscribeFns.push(o.watchNetwork(r=>{if(!this.chainEventListener){console.warn("chainEventListener is not set");return}this.chainEventListener.onChainChanged(r.chain?.id)})))}onAccountChanged(){return this.init()}onChainChanged(t){return this.init(t)}release(){this.removeListeners()}removeListeners(){this.unsubscribeFns.forEach(t=>t()),this.unsubscribeFns=[]}getContractMetadata(t,r){const e=r??this.chainId;if(!e)throw new Error("No chainId provided in context");const n=i.networkRegistry[e];if(!n)throw new Error(a.transactionErrorCodes.UNSUPPORTED_NETWORK);const s=d.contractMetadataMapping[t];if(!s)throw new Error(`Unsupported contractType: ${t}`);return s(n.contractData)}getContract(t,r=void 0,e){const n=this.getContractMetadata(t,e);if(!n.abi)throw new Error(`No ABI configured for contractType: ${t}`);if(n.address&&r)throw new Error(`Overriding address is not supported for contractType: ${t}`);const s=n.address??r;if(!s)throw new Error(`No contractAddress configured for contractType: ${t}`);return new c.ethers.Contract(s,n.abi)}getContractWithSigner(t,r=void 0){if(!this.signer)throw new Error("IllegalState: no signer");return this.getContract(t,r).connect(this.signer)}getContractWithFetcher(t,r=void 0){if(!this.fetchProvider)throw new Error("fetchProvider not initialized");return this.getContract(t,r).connect(this.fetchProvider)}getContractWithFetcherForEthereum(t,r=void 0){const e=this.chainId===i.chainIds.localhost&&i.localhostNetwork===i.chainIds.ethMainnet?i.chainIds.localhost:i.chainIds.ethMainnet;return this.getContract(t,r).connect(new c.ethers.providers.StaticJsonRpcProvider(i.networkRegistry[e].fetchRpcUrl))}async sendTransaction(t){if(!this.signer)throw new Error("IllegalState: no signer");return await this.signer.sendTransaction(t)}async patchExternalProvider(t){const r=await t.getProvider();let e;if(r instanceof c.ethers.providers.Web3Provider?e=r.provider:e=r,"isWalletConnect"in e){const n=await t.getChainId();e.http=e.setHttpProvider?.(n)}}async connectAndPatchProvider(t){const r=await this.connectToConnector(t);return await this.patchExternalProvider(t),r}isPermitterAvailable(){return!!this.getSelectedNetwork()?.contractData?.permitterAddress}async getGasPrice(){const t=await this.fetchProvider?.getGasPrice();if(!t)throw Error("Could not fetch gas price in getGasPrice");return t.toBigInt()}async walletClientToSigner(t,r){const{account:e,transport:n}=t,s={chainId:r,name:""};return new c.providers.Web3Provider(n,s).getSigner(e.address)}}const w=new h,g=()=>new h;exports.Wagmiv1ProviderAdapter=h;exports.default=g;exports.wagmiv1ProvierAdapter=w;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("../constants/chains.constants.cjs"),d=require("../constants/contracts.constants.cjs"),a=require("../error-handling/error-codes.constants.cjs"),c=require("ethers"),o=require("../node_modules/@wagmi/core/dist/chunk-TSH6VVF4.cjs");class h{connector;chainId;originalProvider;fetchProvider;signer;chainEventListener;unsubscribeFns=[];initConnector(t){this.connector=t}requireConnector(){if(!this.connector)throw Error("No Connector In Provider Adapter")}async init(t){this.requireConnector(),t&&(this.chainId=t),this.originalProvider=await this.connector.getProvider(),this.fetchProvider=this.createFetchProvider()??this.originalProvider,this.fetchProvider===this.originalProvider&&console.warn("fetchProvider not available");const r=await this.connector.getWalletClient();this.signer=await this.walletClientToSigner(r,this.chainId)}async disconnectFromConnector(){this.release(),await o.disconnect()}async connectToConnector(t){const{isConnected:r}=o.getAccount();r&&await this.disconnectFromConnector();try{return(await o.connect({connector:t})).chain.id}catch{throw new Error(a.transactionErrorCodes.CONNECTION_FAILED)}}async waitForTransaction(t,r){if((await this.fetchProvider?.waitForTransaction(t,r))?.status)return!0;throw Error(a.transactionErrorCodes.TRANSACTION_NOT_CONFIRMED)}async signMessage(t){const r=await o.signMessage({message:t});if(!r)throw new Error(a.transactionErrorCodes.SIGNING_FAILED);if(r.includes("error"))throw new Error(a.transactionErrorCodes.SIGNATURE_UNSUPPORTED_PERSONAL_SIGN);return r}async signTypedData(t,r,e){return this.signer._signTypedData(t,r,e)}getSelectedNetwork=()=>{if(!this.chainId)throw new Error("Illegal state: no chaindId");return i.networkRegistry[this.chainId]};async switchNetwork(t){return o.switchNetwork({chainId:t.chainId})}createFetchProvider(){try{const r=i.networkRegistry[this.chainId]?.fetchRpcUrl;return r?r.includes("wss")?new c.providers.WebSocketProvider(r):new c.providers.StaticJsonRpcProvider(r):void 0}catch(t){console.log("create Fetch Provider error",t);return}}async getAddress(){const{address:t}=o.getAccount();if(!t)throw new Error("IllegalState");return c.utils.getAddress(t)}setChainEventListener(t){this.chainEventListener=t,this.chainEventListener&&(this.unsubscribeFns.push(o.watchAccount(r=>{if(!this.chainEventListener){console.warn("chainEventListener is not set");return}this.chainEventListener.onAccountChanged()})),this.unsubscribeFns.push(o.watchNetwork(r=>{if(!this.chainEventListener){console.warn("chainEventListener is not set");return}this.chainEventListener.onChainChanged(r.chain?.id)})))}onAccountChanged(){return this.init()}onChainChanged(t){return this.init(t)}release(){this.removeListeners()}removeListeners(){this.unsubscribeFns.forEach(t=>t()),this.unsubscribeFns=[]}getContractMetadata(t,r){const e=r??this.chainId;if(!e)throw new Error("No chainId provided in context");const n=i.networkRegistry[e];if(!n)throw new Error(a.transactionErrorCodes.UNSUPPORTED_NETWORK);const s=d.contractMetadataMapping[t];if(!s)throw new Error(`Unsupported contractType: ${t}`);return s(n.contractData)}getContract(t,r=void 0,e){const n=this.getContractMetadata(t,e);if(!n.abi)throw new Error(`No ABI configured for contractType: ${t}`);if(n.address&&r)throw new Error(`Overriding address is not supported for contractType: ${t}`);const s=n.address??r;if(!s)throw new Error(`No contractAddress configured for contractType: ${t}`);return new c.ethers.Contract(s,n.abi)}getContractWithSigner(t,r=void 0){if(!this.signer)throw new Error("IllegalState: no signer");return this.getContract(t,r).connect(this.signer)}getContractWithFetcher(t,r=void 0){if(!this.fetchProvider)throw new Error("fetchProvider not initialized");return this.getContract(t,r).connect(this.fetchProvider)}getContractWithFetcherForEthereum(t,r=void 0){const e=this.chainId===i.chainIds.localhost&&i.localhostNetwork===i.chainIds.ethMainnet?i.chainIds.localhost:i.chainIds.ethMainnet;return this.getContract(t,r).connect(new c.ethers.providers.StaticJsonRpcProvider(i.networkRegistry[e].fetchRpcUrl))}async sendTransaction(t){if(!this.signer)throw new Error("IllegalState: no signer");return await this.signer.sendTransaction(t)}async patchExternalProvider(t){const r=await t.getProvider();let e;if(r instanceof c.ethers.providers.Web3Provider?e=r.provider:e=r,"isWalletConnect"in e){const n=await t.getChainId();e.http=e.setHttpProvider?.(n)}}async connectAndPatchProvider(t){const r=await this.connectToConnector(t);return await this.patchExternalProvider(t),r}isPermitterAvailable(){return!!this.getSelectedNetwork()?.contractData?.permitterAddress}async getGasPrice(){const t=await this.fetchProvider?.getGasPrice();if(!t)throw Error("Could not fetch gas price in getGasPrice");return t.toBigInt()}async walletClientToSigner(t,r){const{account:e,transport:n}=t,s={chainId:r,name:""};return new c.providers.Web3Provider(n,s).getSigner(e.address)}}const w=new h,g=()=>new h;exports.Wagmiv1ProviderAdapter=h;exports.default=g;exports.wagmiv1ProvierAdapter=w;
@@ -2,7 +2,7 @@ import { networkRegistry as s, chainIds as c, localhostNetwork as l } from "../c
2
2
  import { contractMetadataMapping as g } from "../constants/contracts.constants.mjs";
3
3
  import { transactionErrorCodes as o } from "../error-handling/error-codes.constants.mjs";
4
4
  import { providers as a, utils as v, ethers as h } from "ethers";
5
- import { disconnect as u, getAccount as d, connect as f, signMessage as p, switchNetwork as P, watchAccount as C, watchNetwork as E } from "@wagmi/core";
5
+ import { disconnect as u, getAccount as d, connect as f, signMessage as p, switchNetwork as P, watchAccount as C, watchNetwork as E } from "../node_modules/@wagmi/core/dist/chunk-TSH6VVF4.mjs";
6
6
  class w {
7
7
  connector;
8
8
  chainId;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("../constants/chains.constants.cjs"),d=require("../constants/contracts.constants.cjs"),a=require("../error-handling/error-codes.constants.cjs"),s=require("ethers"),g=require("wagmi2"),c=require("wagmi2/actions");class h{connector;chainId;originalProvider;fetchProvider;signer;chainEventListener;config;unsubscribeFns=[];initConnector(r){this.connector=r}requireConnector(){if(!this.connector)throw Error("No Connector In Provider Adapter")}initConfig(r){this.config=r}async init(r){this.requireConnector(),r&&(this.chainId=r),this.originalProvider=await this.connector.getProvider(),this.fetchProvider=this.createFetchProvider()??this.originalProvider,this.fetchProvider===this.originalProvider&&console.warn("fetchProvider not available");const t=await this.connector.getProvider(),e=await this.connector.getAccounts();this.signer=await this.walletClientToSigner({transport:t,account:e[0]},this.chainId)}async disconnectFromConnector(){if(!this.config)throw new Error("No Config In Provider Adapter");this.release(),await c.disconnect(this.config)}async connectToConnector(r){if(!this.config)throw new Error("No Config In Provider Adapter");try{return(await c.connect(this.config,{connector:r})).chainId}catch(t){if(t instanceof g.ConnectorAlreadyConnectedError)return r.getChainId();throw console.log(t),new Error(a.transactionErrorCodes.CONNECTION_FAILED)}}async waitForTransaction(r,t){if((await this.fetchProvider?.waitForTransaction(r,t))?.status)return!0;throw Error(a.transactionErrorCodes.TRANSACTION_NOT_CONFIRMED)}async signMessage(r){if(!this.config)throw new Error("No Config In Provider Adapter");const t=await c.signMessage(this.config,{message:r});if(!t)throw new Error(a.transactionErrorCodes.SIGNING_FAILED);if(t.includes("error"))throw new Error(a.transactionErrorCodes.SIGNATURE_UNSUPPORTED_PERSONAL_SIGN);return t}async signTypedData(r,t,e){return this.signer._signTypedData(r,t,e)}getSelectedNetwork=()=>{if(!this.chainId)throw new Error("Illegal state: no chaindId");return i.networkRegistry[this.chainId]};async switchNetwork(r){if(!this.config)throw new Error("No Config In Provider Adapter");return c.switchChain(this.config,{chainId:r.chainId})}createFetchProvider(){try{const t=i.networkRegistry[this.chainId]?.fetchRpcUrl;return t?t.includes("wss")?new s.providers.WebSocketProvider(t):new s.providers.StaticJsonRpcProvider(t):void 0}catch(r){console.log("create Fetch Provider error",r);return}}async getAddress(){if(!this.config)throw new Error("No Config In Provider Adapter");const{address:r}=c.getAccount(this.config);if(!r)throw new Error("IllegalState");return s.utils.getAddress(r)}setChainEventListener(r){if(!this.config)throw new Error("No Config In Provider Adapter");this.chainEventListener=r,this.chainEventListener&&(this.unsubscribeFns.push(c.watchAccount(this.config,{onChange:({address:t},{address:e})=>{if(!this.chainEventListener){console.warn("chainEventListener is not set");return}console.log("Account changed"),t!==e&&(console.log("Account changed"),this.chainEventListener.onAccountChanged())}})),this.unsubscribeFns.push(c.watchChainId(this.config,{onChange:t=>{if(!this.chainEventListener){console.warn("chainEventListener is not set");return}console.log("Chain ID changed!",t),this.chainEventListener.onChainChanged(t)}})))}onAccountChanged(){return this.init()}onChainChanged(r){return this.init(r)}release(){this.removeListeners()}removeListeners(){this.unsubscribeFns.forEach(r=>r()),this.unsubscribeFns=[]}getContractMetadata(r,t){const e=t??this.chainId;if(!e)throw new Error("No chainId provided in context");const n=i.networkRegistry[e];if(!n)throw new Error(a.transactionErrorCodes.UNSUPPORTED_NETWORK);const o=d.contractMetadataMapping[r];if(!o)throw new Error(`Unsupported contractType: ${r}`);return o(n.contractData)}getContract(r,t=void 0,e){const n=this.getContractMetadata(r,e);if(!n.abi)throw new Error(`No ABI configured for contractType: ${r}`);if(n.address&&t)throw new Error(`Overriding address is not supported for contractType: ${r}`);const o=n.address??t;if(!o)throw new Error(`No contractAddress configured for contractType: ${r}`);return new s.ethers.Contract(o,n.abi)}getContractWithSigner(r,t=void 0){if(!this.signer)throw new Error("IllegalState: no signer");return this.getContract(r,t).connect(this.signer)}getContractWithFetcher(r,t=void 0){if(!this.fetchProvider)throw new Error("fetchProvider not initialized");return this.getContract(r,t).connect(this.fetchProvider)}getContractWithFetcherForEthereum(r,t=void 0){const e=this.chainId===i.chainIds.localhost&&i.localhostNetwork===i.chainIds.ethMainnet?i.chainIds.localhost:i.chainIds.ethMainnet;return this.getContract(r,t).connect(new s.ethers.providers.StaticJsonRpcProvider(i.networkRegistry[e].fetchRpcUrl))}async sendTransaction(r){if(!this.signer)throw new Error("IllegalState: no signer");return await this.signer.sendTransaction(r)}async patchExternalProvider(r){const t=await r.getProvider();let e;if(t instanceof s.ethers.providers.Web3Provider?e=t.provider:e=t,"isWalletConnect"in e){const n=await r.getChainId();e.http=e.setHttpProvider?.(n)}}async connectAndPatchProvider(r){const t=await this.connectToConnector(r);return await this.patchExternalProvider(r),t}isPermitterAvailable(){return!!this.getSelectedNetwork()?.contractData?.permitterAddress}async getGasPrice(){const r=await this.fetchProvider?.getGasPrice();if(!r)throw Error("Could not fetch gas price in getGasPrice");return r.toBigInt()}async walletClientToSigner(r,t){const{account:e,transport:n}=r,o={chainId:t,name:""};return new s.providers.Web3Provider(n,o).getSigner(e)}}const w=new h,v=()=>new h;exports.Wagmiv2ProviderAdapter=h;exports.default=v;exports.wagmiv2ProviderAdapter=w;
@@ -0,0 +1,46 @@
1
+ import { ChainEventListener, IProviderAdapter } from '../data-structures/provider-adapter/IProviderAdapter';
2
+ import { ContractMetadata, ContractType, EthereumNetwork } from '../types/ethereum-network.types';
3
+ import { ethers } from 'ethers';
4
+ import { type Connector } from 'wagmi2';
5
+ export declare class Wagmiv2ProviderAdapter implements IProviderAdapter<Connector> {
6
+ private connector;
7
+ chainId: number | undefined;
8
+ private originalProvider;
9
+ private fetchProvider;
10
+ private signer;
11
+ private chainEventListener?;
12
+ private config?;
13
+ private unsubscribeFns;
14
+ initConnector(connector: Connector): void;
15
+ requireConnector(): void;
16
+ initConfig(config: any): void;
17
+ init(chainId?: number): Promise<void>;
18
+ disconnectFromConnector(): Promise<void>;
19
+ connectToConnector(connector: Connector): Promise<number>;
20
+ waitForTransaction(transactionHash: string, confirmations: number): Promise<boolean>;
21
+ signMessage(message: string): Promise<string>;
22
+ signTypedData(domain: ethers.TypedDataDomain, types: Record<string, ethers.TypedDataField[]>, value: Record<string, unknown>): Promise<string>;
23
+ getSelectedNetwork: () => EthereumNetwork | undefined;
24
+ switchNetwork(network: EthereumNetwork): Promise<any>;
25
+ private createFetchProvider;
26
+ getAddress(): Promise<string>;
27
+ setChainEventListener(chainEventListener: ChainEventListener): void;
28
+ onAccountChanged(): Promise<unknown>;
29
+ onChainChanged(chainId?: number): Promise<unknown>;
30
+ release(): void;
31
+ private removeListeners;
32
+ getContractMetadata(contractType: ContractType, chainId?: number): ContractMetadata;
33
+ getContract(contractType: ContractType, contractAddress?: undefined, chainId?: number): ethers.Contract;
34
+ getContractWithSigner(contract: ContractType, contractAddress?: undefined): ethers.Contract;
35
+ getContractWithFetcher(contract: ContractType, contractAddress?: undefined): ethers.Contract;
36
+ getContractWithFetcherForEthereum(contract: ContractType, contractAddress?: undefined): ethers.Contract;
37
+ sendTransaction(tx: ethers.providers.TransactionRequest): Promise<ethers.providers.TransactionResponse>;
38
+ patchExternalProvider(connector: Connector): Promise<void>;
39
+ connectAndPatchProvider(connector: Connector): Promise<number>;
40
+ isPermitterAvailable(): boolean;
41
+ getGasPrice(): Promise<bigint>;
42
+ walletClientToSigner(walletClient: any, chainId: number): Promise<ethers.providers.JsonRpcSigner>;
43
+ }
44
+ export declare const wagmiv2ProviderAdapter: Wagmiv2ProviderAdapter;
45
+ declare const _default: <T = unknown>() => IProviderAdapter<T>;
46
+ export default _default;