@hinkal/common 0.2.9 → 0.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/API/API.d.mts +49 -0
- package/API/HinkalPointsCalls.d.mts +20 -0
- package/API/callBeefyGraphAPI.d.mts +2 -0
- package/API/callCurveAPI.d.mts +9 -0
- package/API/callMonitor.d.mts +1 -0
- package/API/callOdosAPI.d.mts +63 -0
- package/API/callOneInchAPI.d.mts +18 -0
- package/API/callRelayer.d.mts +10 -0
- package/API/checkRisk.d.mts +1 -0
- package/API/dataServerCalls.d.mts +2 -0
- package/API/duneAPI.d.mts +11 -0
- package/API/fetchCommitmentsCache.d.mts +20 -0
- package/API/fetchNullifiers.d.mts +5 -0
- package/API/getAxelarGasEstimate.d.mts +5 -0
- package/API/getCoingeckoPrice.d.mts +22 -0
- package/API/getConnextReceiveFee.d.mts +2 -0
- package/API/getGasEstimates.d.mts +9 -0
- package/API/getRelayerURL.d.mts +1 -0
- package/API/getServerURL.d.mts +2 -0
- package/API/getTokenPrice.d.mts +16 -0
- package/API/index.d.mts +14 -0
- package/API/kycCalls.d.mts +30 -0
- package/API/passwordCalls.d.mts +9 -0
- package/API/referralProgramCalls.d.mts +36 -0
- package/API/relayCalls.d.mts +5 -0
- package/API/restoreSnapshots.d.mts +1 -0
- package/API/rewardsPointsCalls.d.mts +13 -0
- package/API/userVerifyTransactions.d.mts +19 -0
- package/constants/assets.constants.d.mts +13 -0
- package/constants/axelar.constants.d.mts +5 -0
- package/constants/backend.constants.d.mts +11 -0
- package/constants/beefy.registry.d.mts +8 -0
- package/constants/chains.constants.d.mts +36 -0
- package/constants/coingecko.constants.d.mts +13 -0
- package/constants/contracts.constants.d.mts +119 -0
- package/constants/crvCvx.registry.d.mts +20 -0
- package/constants/crvDynamic.registry.d.mts +1 -0
- package/constants/deploy-data/index.d.mts +11 -0
- package/constants/fees.constants.d.mts +11 -0
- package/constants/index.d.mts +20 -0
- package/constants/kyc.constants.d.mts +28 -0
- package/constants/lido.constants.d.mts +10 -0
- package/constants/pendle.registry.d.mts +21 -0
- package/constants/protocol.constants.d.mts +18 -0
- package/constants/reorg-depths.constants.d.mts +3 -0
- package/constants/rewards.constants.d.mts +19 -0
- package/constants/server.constants.d.mts +155 -0
- package/constants/token-data/ERC20Registry.d.mts +3 -0
- package/constants/token-data/index.d.mts +976 -0
- package/constants/token-data/popularTokens.constants.d.mts +3 -0
- package/constants/token-data/tokenPricing.consts.d.mts +5 -0
- package/constants/vite.constants.d.mts +14 -0
- package/crypto/babyJub.d.mts +16 -0
- package/crypto/index.d.mts +3 -0
- package/crypto/poseidon.d.mts +15 -0
- package/crypto/preProcessing.d.mts +1 -0
- package/data-structures/Hinkal/Hinkal.d.mts +100 -0
- package/data-structures/Hinkal/IHinkal.d.mts +93 -0
- package/data-structures/Hinkal/hinkalActionBeefy.d.mts +3 -0
- package/data-structures/Hinkal/hinkalActionConvex.d.mts +12 -0
- package/data-structures/Hinkal/hinkalActionCurve.d.mts +12 -0
- package/data-structures/Hinkal/hinkalActionLidoEth.d.mts +4 -0
- package/data-structures/Hinkal/hinkalActionPendle.d.mts +3 -0
- package/data-structures/Hinkal/hinkalActionPendleLP.d.mts +7 -0
- package/data-structures/Hinkal/hinkalActionStake.d.mts +3 -0
- package/data-structures/Hinkal/hinkalActionVolatile.d.mts +3 -0
- package/data-structures/Hinkal/hinkalDeposit.d.mts +3 -0
- package/data-structures/Hinkal/hinkalGetRecipientInfo.d.mts +2 -0
- package/data-structures/Hinkal/hinkalGetZkMeProvider.d.mts +3 -0
- package/data-structures/Hinkal/hinkalPrivateWallet.d.mts +2 -0
- package/data-structures/Hinkal/hinkalSwap.d.mts +3 -0
- package/data-structures/Hinkal/hinkalTransfer.d.mts +1 -0
- package/data-structures/Hinkal/hinkalWithdraw.d.mts +2 -0
- package/data-structures/Hinkal/index.d.mts +12 -0
- package/data-structures/Hinkal/resetMerkleTrees.d.mts +2 -0
- package/data-structures/MultiThreadedUtxoUtils/MultiThreadedUtxoUtils.d.mts +20 -0
- package/data-structures/ValueCache/ValueCache.d.mts +10 -0
- package/data-structures/ValueCache/index.d.mts +1 -0
- package/data-structures/cacheDevices/BaseCacheDevice.d.mts +8 -0
- package/data-structures/cacheDevices/FileCacheDevice.d.mts +9 -0
- package/data-structures/cacheDevices/LocalStorageCacheDevice.d.mts +7 -0
- package/data-structures/cacheDevices/index.d.mts +2 -0
- package/data-structures/crypto-keys/decodeUTXO.d.mts +14 -0
- package/data-structures/crypto-keys/encryptDecryptUtxo.d.mts +18 -0
- package/data-structures/crypto-keys/index.d.mts +4 -0
- package/data-structures/crypto-keys/keyUtils.d.mts +2 -0
- package/data-structures/crypto-keys/keys.d.mts +58 -0
- package/data-structures/custom-token-registry/CustomTokenRegistry.d.mts +13 -0
- package/data-structures/event-service/AbstractAccessTokenSnapshotService.d.mts +35 -0
- package/data-structures/event-service/AbstractCommitmentsSnapshotService.d.mts +30 -0
- package/data-structures/event-service/AbstractEventService.cjs +1 -1
- package/data-structures/event-service/AbstractEventService.d.mts +31 -0
- package/data-structures/event-service/AbstractEventService.mjs +42 -30
- package/data-structures/event-service/AbstractNullifierSnapshotService.d.mts +22 -0
- package/data-structures/event-service/AbstractSnapshotService.d.mts +23 -0
- package/data-structures/event-service/index.d.mts +5 -0
- package/data-structures/index.d.mts +13 -0
- package/data-structures/merkle-tree/MerkleTree.d.mts +78 -0
- package/data-structures/merkle-tree/MerkleTreeIncompleteError.d.mts +3 -0
- package/data-structures/merkle-tree/getPatchedAccessTokenMerkleTree.d.mts +3 -0
- package/data-structures/merkle-tree/index.d.mts +3 -0
- package/data-structures/provider-adapter/IProviderAdapter.d.mts +35 -0
- package/data-structures/snapshot/ClientAccessTokenSnapshotService.cjs +1 -1
- package/data-structures/snapshot/ClientAccessTokenSnapshotService.d.mts +7 -0
- package/data-structures/snapshot/ClientAccessTokenSnapshotService.mjs +10 -5
- package/data-structures/snapshot/ClientCommitmentsSnapshotService.cjs +1 -1
- package/data-structures/snapshot/ClientCommitmentsSnapshotService.d.mts +7 -0
- package/data-structures/snapshot/ClientCommitmentsSnapshotService.mjs +10 -5
- package/data-structures/snapshot/ClientNullifierSnapshotService.cjs +1 -1
- package/data-structures/snapshot/ClientNullifierSnapshotService.d.mts +7 -0
- package/data-structures/snapshot/ClientNullifierSnapshotService.mjs +8 -3
- package/data-structures/token-price-fetcher/TokenChecker.d.mts +20 -0
- package/data-structures/token-price-fetcher/index.d.mts +1 -0
- package/data-structures/transactions-manager/TransactionsManager.d.mts +27 -0
- package/data-structures/transactions-manager/history/getBeefyData.d.mts +3 -0
- package/data-structures/transactions-manager/history/getConvexData.d.mts +6 -0
- package/data-structures/transactions-manager/history/getCurveData.d.mts +6 -0
- package/data-structures/transactions-manager/history/getDepositData.d.mts +2 -0
- package/data-structures/transactions-manager/history/getLidoData.d.mts +10 -0
- package/data-structures/transactions-manager/history/getPendleData.d.mts +3 -0
- package/data-structures/transactions-manager/history/getSwapData.d.mts +3 -0
- package/data-structures/transactions-manager/history/getTxDetails.d.mts +3 -0
- package/data-structures/transactions-manager/history/getVolatileData.d.mts +32 -0
- package/data-structures/transactions-manager/history/history.types.d.mts +95 -0
- package/data-structures/transactions-manager/history/history.utils.d.mts +8 -0
- package/data-structures/transactions-manager/index.d.mts +2 -0
- package/data-structures/utxo/Utxo.d.mts +63 -0
- package/data-structures/volatile-helper/VolatileHelper.d.mts +57 -0
- package/data-structures/volatile-helper/index.d.mts +1 -0
- package/error-handling/customErrors/ErrorWithAmount.d.mts +4 -0
- package/error-handling/customErrors/FeeOverTransactionValueError.d.mts +9 -0
- package/error-handling/customErrors/customErrors.helpers.d.mts +5 -0
- package/error-handling/customErrors/index.d.mts +3 -0
- package/error-handling/error-codes.constants.cjs +1 -1
- package/error-handling/error-codes.constants.d.mts +181 -0
- package/error-handling/error-codes.constants.mjs +13 -13
- package/error-handling/get-error.message.d.mts +3 -0
- package/error-handling/handleErrorRestore.d.mts +2 -0
- package/error-handling/index.d.mts +7 -0
- package/error-handling/logError.d.mts +1 -0
- package/error-handling/types.d.mts +5 -0
- package/externalABIs/BUSD.d.mts +38 -0
- package/externalABIs/DAI.d.mts +45 -0
- package/externalABIs/ERC20.d.mts +1 -0
- package/externalABIs/SanctionsList.d.mts +35 -0
- package/externalABIs/USDC.d.mts +28 -0
- package/externalABIs/USDR.d.mts +28 -0
- package/externalABIs/USDR3CRV.d.mts +49 -0
- package/externalABIs/USDT.d.mts +41 -0
- package/externalABIs/WETH.d.mts +38 -0
- package/externalABIs/amToken.d.mts +28 -0
- package/externalABIs/crvFRAX.d.mts +38 -0
- package/externalABIs/index.d.mts +323 -0
- package/externalABIs/swapAbi.d.mts +77 -0
- package/functions/index.d.mts +14 -0
- package/functions/kyc/aiPriseHelper.d.mts +0 -0
- package/functions/kyc/authentoHelper.d.mts +12 -0
- package/functions/kyc/index.d.mts +3 -0
- package/functions/kyc/openDefaultPassportWindow.d.mts +1 -0
- package/functions/kyc/passportHelper.d.mts +3 -0
- package/functions/kyc/zkMeHelper.d.mts +4 -0
- package/functions/pre-transaction/getFlatFees.d.mts +12 -0
- package/functions/pre-transaction/index.d.mts +5 -0
- package/functions/pre-transaction/interaction-to-action.d.mts +2 -0
- package/functions/pre-transaction/outputUtxoProcessing.d.mts +5 -0
- package/functions/pre-transaction/process-gas-estimates.d.mts +5 -0
- package/functions/pre-transaction/processAmountChanges.d.mts +12 -0
- package/functions/private-wallet/emporium.helpers.d.mts +5 -0
- package/functions/private-wallet/index.d.mts +2 -0
- package/functions/private-wallet/opProducer.d.mts +5 -0
- package/functions/protocols/convex.protocols.d.mts +1 -0
- package/functions/protocols/curve.protocols.d.mts +1 -0
- package/functions/protocols/index.d.mts +3 -0
- package/functions/protocols/pendle.helpers.d.mts +8 -0
- package/functions/snarkjs/common.snarkjs.d.mts +22 -0
- package/functions/snarkjs/constant.d.mts +151 -0
- package/functions/snarkjs/constructEmporiumProof.d.mts +10 -0
- package/functions/snarkjs/constructGeneralZkProof.d.mts +12 -0
- package/functions/snarkjs/generateCircomData.d.mts +4 -0
- package/functions/snarkjs/generateZkProof.d.mts +5 -0
- package/functions/snarkjs/generateZkProofEnclave.d.mts +5 -0
- package/functions/snarkjs/generateZkProofSelf.d.mts +5 -0
- package/functions/snarkjs/getZKFiles.d.mts +2 -0
- package/functions/snarkjs/index.d.mts +4 -0
- package/functions/staking/index.d.mts +11 -0
- package/functions/utils/amounts.utils.d.mts +21 -0
- package/functions/utils/axelar.utils.d.mts +2 -0
- package/functions/utils/cacheDevice.utils.d.mts +3 -0
- package/functions/utils/cacheFunctions.d.mts +17 -0
- package/functions/utils/caseInsensitive.utils.d.mts +3 -0
- package/functions/utils/convertIntegrationProviderToExternalActionId.d.mts +2 -0
- package/functions/utils/create-provider.d.mts +2 -0
- package/functions/utils/enum.utils.d.mts +9 -0
- package/functions/utils/erc20tokenFunctions.d.mts +4 -0
- package/functions/utils/evmNetworkFunctions.d.mts +4 -0
- package/functions/utils/external-action.utils.d.mts +8 -0
- package/functions/utils/getDataFromTransaction.d.mts +45 -0
- package/functions/utils/index.d.mts +21 -0
- package/functions/utils/memoize.utils.d.mts +1 -0
- package/functions/utils/nickname.utils.d.mts +1 -0
- package/functions/utils/process.utils.d.mts +7 -0
- package/functions/utils/reloadPage.d.mts +1 -0
- package/functions/utils/requireEnv.d.mts +1 -0
- package/functions/utils/resolve-sync.utils.d.mts +6 -0
- package/functions/utils/serialize.utils.d.mts +1 -0
- package/functions/utils/string.utils.d.mts +8 -0
- package/functions/utils/time.utils.d.mts +1 -0
- package/functions/utils/userAgent.d.mts +2 -0
- package/functions/utils/volatile-patcher.utils.d.mts +1 -0
- package/functions/web3/etherFunctions.d.mts +20 -0
- package/functions/web3/events/balanceChangedHandler.d.mts +1 -0
- package/functions/web3/events/getInputUtxoAndBalance.d.mts +24 -0
- package/functions/web3/events/getShieldedBalance.cjs +2 -2
- package/functions/web3/events/getShieldedBalance.d.mts +18 -0
- package/functions/web3/events/getShieldedBalance.mjs +66 -58
- package/functions/web3/events/index.d.mts +4 -0
- package/functions/web3/events/web3RetrieveEvents.d.mts +14 -0
- package/functions/web3/functionCalls/accessTokenCalls.d.mts +6 -0
- package/functions/web3/functionCalls/approveToken.d.mts +4 -0
- package/functions/web3/functionCalls/estimateGasRelayer.d.mts +4 -0
- package/functions/web3/functionCalls/getRootHash.d.mts +2 -0
- package/functions/web3/functionCalls/relayFunctions.d.mts +17 -0
- package/functions/web3/functionCalls/transactCallDirect.d.mts +6 -0
- package/functions/web3/functionCalls/transactCallRelayer.d.mts +7 -0
- package/functions/web3/getContractMetadata.d.mts +5 -0
- package/functions/web3/index.d.mts +6 -0
- package/functions/web3/odosAPI.d.mts +5 -0
- package/functions/web3/oneInchAPI.d.mts +5 -0
- package/functions/web3/runContractFunction.d.mts +15 -0
- package/functions/web3/uniswapAPI.d.mts +16 -0
- package/index.d.mts +8 -0
- package/package.json +42 -11
- package/providers/EthersProviderAdapter.d.mts +39 -0
- package/providers/WagmiProviderAdapter.d.mts +46 -0
- package/providers/exportProviers.d.mts +3 -0
- package/providers/prepareEthersHinkal.d.mts +4 -0
- package/providers/prepareWagmiHinkal.d.mts +3 -0
- package/types/API.types.d.mts +23 -0
- package/types/ICacheDevice.d.mts +4 -0
- package/types/IMultiThreadedUtxoUtils.d.mts +8 -0
- package/types/admin.types.d.mts +22 -0
- package/types/axelar.types.d.mts +14 -0
- package/types/beefy.types.d.mts +11 -0
- package/types/big-intable.types.d.mts +2 -0
- package/types/circom-data.types.d.mts +70 -0
- package/types/coingecko.types.d.mts +8 -0
- package/types/commitments.types.d.mts +26 -0
- package/types/connext.types.d.mts +13 -0
- package/types/crypto.types.d.mts +7 -0
- package/types/curve.types.d.mts +133 -0
- package/types/duneAPI.types.d.mts +9 -0
- package/types/ethereum-network.types.d.mts +142 -0
- package/types/external-action.types.d.mts +28 -0
- package/types/hinkal.stake.types.d.mts +11 -0
- package/types/hinkal.types.d.mts +150 -0
- package/types/hinkalTvl.types.d.mts +4 -0
- package/types/index.d.mts +27 -0
- package/types/kyc.types.d.mts +39 -0
- package/types/pendle.api.types.d.mts +233 -0
- package/types/pendle.types.d.mts +222 -0
- package/types/relayer.types.d.mts +25 -0
- package/types/remote-proof.types.d.mts +15 -0
- package/types/rewards.types.d.mts +230 -0
- package/types/slippage.types.d.mts +15 -0
- package/types/snark.types.d.mts +40 -0
- package/types/time.types.d.mts +31 -0
- package/types/token.types.d.mts +36 -0
- package/types/transactions.types.d.mts +55 -0
- package/webworker/performTaskWithWorker.d.mts +5 -0
- package/webworker/snarkjsWorker/snarkjsWorker.types.d.mts +14 -0
- package/webworker/snarkjsWorker/snarkjsWorkerLauncher.d.mts +1 -0
- package/webworker/snarkjsWorker/snarkjsWorkerLogic.d.mts +10 -0
- package/webworker/utxoWorker/utxoWorker.types.d.mts +29 -0
- package/webworker/utxoWorker/utxoWorkerLauncher.d.mts +1 -0
- package/webworker/utxoWorker/utxoWorkerLogic.d.mts +8 -0
- package/webworker/viteWorkerURL.constant.d.mts +9 -0
- package/webworker/worker.registry.d.mts +10 -0
- package/webworker/worker.types.d.mts +33 -0
- package/webworker/workerErrorHandler.d.mts +1 -0
- package/webworker/workerFactory.d.mts +7 -0
- package/webworker/workerProxy.d.mts +40 -0
- package/webworker/zkProofWorker/zkProofWorker.types.d.mts +38 -0
- package/webworker/zkProofWorker/zkProofWorkerLauncher.d.mts +1 -0
- package/webworker/zkProofWorker/zkProofWorkerLogic.d.mts +8 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export * from './amounts.utils';
|
|
2
|
+
export * from './cacheFunctions';
|
|
3
|
+
export * from './create-provider';
|
|
4
|
+
export * from './external-action.utils';
|
|
5
|
+
export * from './erc20tokenFunctions';
|
|
6
|
+
export * from './requireEnv';
|
|
7
|
+
export * from './resolve-sync.utils';
|
|
8
|
+
export * from './convertIntegrationProviderToExternalActionId';
|
|
9
|
+
export * from '../pre-transaction';
|
|
10
|
+
export * from './evmNetworkFunctions';
|
|
11
|
+
export * from './axelar.utils';
|
|
12
|
+
export * from './userAgent';
|
|
13
|
+
export * from './getDataFromTransaction';
|
|
14
|
+
export * from './reloadPage';
|
|
15
|
+
export * from './string.utils';
|
|
16
|
+
export * from './nickname.utils';
|
|
17
|
+
export * from './caseInsensitive.utils';
|
|
18
|
+
export * from './time.utils';
|
|
19
|
+
export * from './volatile-patcher.utils';
|
|
20
|
+
export * from './cacheDevice.utils';
|
|
21
|
+
export * from './process.utils';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const memoizeFunc: <T extends any[], R>(fn: (...args: T) => R) => (...args: T) => R;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isNicknameValid: (input: string) => boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** pause execution for a number of miliseconds */
|
|
2
|
+
export declare const wait: (miliseconds: number) => Promise<unknown>;
|
|
3
|
+
/** only call function once with a given number of milliseconds
|
|
4
|
+
* Ex: let debounceMyFunc = debounce(myFunc, 1000);
|
|
5
|
+
* debounceMyFunc(); debounceMyFunc();
|
|
6
|
+
*/
|
|
7
|
+
export declare function debounce(func: (...args: any[]) => void, debounceForMs: number): (...args: any[]) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const reloadPage: () => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const requireEnv: (environmentVariableName: string) => string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const resolveSync: (promiseFns: (() => Promise<any>)[]) => Promise<void>;
|
|
2
|
+
export declare const getSequence: (fromBlockNumber: number, lastBlockNumber: number, maxPageSize: number | undefined) => {
|
|
3
|
+
from: number;
|
|
4
|
+
to: number;
|
|
5
|
+
}[];
|
|
6
|
+
export declare const promisify: (callback: () => Promise<any>, timeout?: number) => Promise<unknown>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CustomJSONStringify: (args: any) => string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Capitalize the first letter of each word
|
|
2
|
+
* "This is an example" => "This Is An Example"
|
|
3
|
+
*/
|
|
4
|
+
export declare function toTitleCase(str: string): string;
|
|
5
|
+
/** Capitalize the first letter of a string */
|
|
6
|
+
export declare function capitalizeFirstLetter(str: string): string;
|
|
7
|
+
/** Returns true if a value is null, undefined, or an empty object, array (length 0), or string (e.g. '') */
|
|
8
|
+
export declare function isNullOrEmpty(obj: unknown): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const waitLittle: (time?: number) => Promise<unknown>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const patchRegistry: (chainId: number) => Promise<void>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ERC20Token } from '../../types/token.types';
|
|
2
|
+
export declare const ethToWei: (amount: string) => bigint;
|
|
3
|
+
export declare const randomBigInt: (numberfOfBytes: number) => bigint;
|
|
4
|
+
export declare const getAmountInToken: (token: ERC20Token, amount: bigint) => string;
|
|
5
|
+
export declare const getAmountInWei: (token: ERC20Token, amount: string) => bigint;
|
|
6
|
+
/**
|
|
7
|
+
* Convert a decimal number into bigint through string method and return a bigint and number of decimal places.
|
|
8
|
+
* @param decimal
|
|
9
|
+
* @returns a tuple of [ theBigInt, numberOfDecimalPlaces]
|
|
10
|
+
*/
|
|
11
|
+
export declare const toBigIntWithDecimals: (decimal: number) => [bigint, number];
|
|
12
|
+
/** Return getAmountInWei or 0 if error */
|
|
13
|
+
export declare const getAmountInWeiOrZero: (token: ERC20Token, amount: string) => bigint;
|
|
14
|
+
export declare const getAmountWithPrecision: (balance: bigint, token: ERC20Token, precision: number) => string;
|
|
15
|
+
export declare const calculateDollarValue: (token: ERC20Token, tokenAmount: bigint, tokenPriceDollar: number, precision: number) => {
|
|
16
|
+
totalValueDollarsBigInt: bigint;
|
|
17
|
+
precision: number;
|
|
18
|
+
};
|
|
19
|
+
/** Returns same as getAmountWithPrecision but '0' if empty */
|
|
20
|
+
export declare const getAmountWithPrecisionOrZero: (token: ERC20Token | undefined, amount: bigint | undefined) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const balanceChangedHandler: () => void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { IHinkal } from '../../../data-structures/Hinkal/IHinkal';
|
|
2
|
+
import { UserKeys } from '../../../data-structures/crypto-keys/keys';
|
|
3
|
+
import { Utxo } from '../../../data-structures/utxo/Utxo';
|
|
4
|
+
import { EncryptedOutputWithSign } from '../../../types/commitments.types';
|
|
5
|
+
interface IGetInputUtxos {
|
|
6
|
+
hinkal: IHinkal;
|
|
7
|
+
erc20TokenAddress?: string;
|
|
8
|
+
minInput?: number;
|
|
9
|
+
sliceIfMore6?: boolean;
|
|
10
|
+
tokenId?: number;
|
|
11
|
+
}
|
|
12
|
+
export declare const getInputUtxosFromEncryptedOutputs: (hinkal: IHinkal, encryptedOutputs: EncryptedOutputWithSign[], userKeys: UserKeys, erc20TokenAddress?: string, tokenId?: number) => Promise<Utxo[]>;
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @param hinkal instance of the hinkal class
|
|
16
|
+
* @param erc20TokenAddress erc20 token address
|
|
17
|
+
* @param minInput min number of input UTXOs
|
|
18
|
+
* @param sliceIfMore6 max upper bound on input UTXOs controller
|
|
19
|
+
* @returns UTXOs for particular erc20 token address
|
|
20
|
+
*/
|
|
21
|
+
export declare const getInputUtxoAndBalance: ({ hinkal, erc20TokenAddress, minInput, sliceIfMore6, tokenId, }: IGetInputUtxos) => Promise<{
|
|
22
|
+
inputUtxos: Utxo[];
|
|
23
|
+
}>;
|
|
24
|
+
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("async-mutex"),q=require("../../../constants/token-data/ERC20Registry.cjs"),I=require("../../utils/erc20tokenFunctions.cjs"),
|
|
2
|
-
Please try again with ${g.symbol}`;throw new
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("async-mutex"),q=require("../../../constants/token-data/ERC20Registry.cjs"),I=require("../../utils/erc20tokenFunctions.cjs"),f=require("../../utils/caseInsensitive.utils.cjs"),k=require("../../utils/volatile-patcher.utils.cjs"),w=require("../../../data-structures/utxo/Utxo.cjs"),U=require("../../../data-structures/custom-token-registry/CustomTokenRegistry.cjs"),x=require("../../../data-structures/volatile-helper/VolatileHelper.cjs"),P=require("../etherFunctions.cjs"),b=require("../../../error-handling/customErrors/ErrorWithAmount.cjs"),y=require("./getInputUtxoAndBalance.cjs"),E=new A.Mutex,S=async a=>{const i=await E.acquire();try{const{inputUtxos:r}=await y.getInputUtxoAndBalance({hinkal:a,sliceIfMore6:!1}),s=a.getCurrentChainId(),u=[...q.getERC20Registry(s),...U.customTokenRegistry.getCustomTokens(s)];await k.patchRegistry(s);const h=u.map(e=>({token:e,balance:r.reduce((t,c)=>{const n=e.isVolatile?e.sharedAddress:e.erc20TokenAddress;return f.caseInsensitiveEqual(n,c.erc20TokenAddress)?t+c.amount:t},0n),timestamp:r.filter(t=>f.caseInsensitiveEqual(t.erc20TokenAddress,e.erc20TokenAddress))[0]?.timeStamp,nfts:r.filter(t=>f.caseInsensitiveEqual(t.erc20TokenAddress,e.erc20TokenAddress)&&t.tokenId!==0).map(t=>({tokenId:t.tokenId,timestamp:t.timeStamp}))}));return await Promise.all(h.map(async e=>{if(!e.token.isVolatile)return e;e.token?.sharedAddress||console.log("VolatileToken must have a corresponding sharedAddress");let t=0n;return e.balance>0n&&(t=await x.VolatileHelper.getVolatileTokenBalance(s,e.token.sharedAddress,e.balance)),{...e,balance:BigInt(t)}}))}catch(r){console.log("Error while processing shielded balance:",r)}finally{i()}return[]},v=async(a,i,r,s=6,u=i.map(()=>0),h=!1)=>{const{userKeys:p}=a,e=[],t=[];let c=0;for(let n=0;n<i.length;n+=1)if(h===!1){const{inputUtxos:o}=await y.getInputUtxoAndBalance({hinkal:a,erc20TokenAddress:i[n],tokenId:u[n],sliceIfMore6:!1});c=Math.max(o.length,c),t.push(o)}else t.push([]);return c===2?t:(t.forEach((n,o)=>{if(n.length>s){const l=n.slice(0,s),d=l.reduce((g,m)=>g+m.amount,0n);if(r[o]<0n&&d<-r[o]){const g=I.getERC20Token(i[o],a.getCurrentChainId()),m=Number(P.getAmountWithPrecision(d,g,2)),T=`Unfortunately your transaction did not go through due to UTXOs limitations.
|
|
2
|
+
Please try again with ${g.symbol}`;throw new b.ErrorWithAmount(m,T)}e.push(l)}else if(n.length<=s){const l=[...n];let d=s-n.length;for(;d>0;)d-=1,l.push(new w.Utxo({amount:0n,erc20TokenAddress:i[o],shieldedPrivateKey:p.getShieldedPrivateKey(),tokenId:u[o]}));e.push(l)}}),e)};exports.addPaddingToUtxos=v;exports.getShieldedBalance=S;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { TokenBalance } from '../../../types/token.types';
|
|
2
|
+
import { Utxo } from '../../../data-structures/utxo/Utxo';
|
|
3
|
+
import { IHinkal } from '../../../data-structures/Hinkal/IHinkal';
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @param UserKeys to access user's encryption keys
|
|
7
|
+
* @returns shielded balance
|
|
8
|
+
*/
|
|
9
|
+
export declare const getShieldedBalance: (hinkal: IHinkal) => Promise<TokenBalance[]>;
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* @param hinkal hinkal instance to get userKeys
|
|
13
|
+
* @param erc20Addresses array of erc20 tokens
|
|
14
|
+
* @param amountChanges array of token amounts
|
|
15
|
+
* @param maxInput to pad until maxInput number
|
|
16
|
+
* @returns return padded UTXOs for every erc20 token
|
|
17
|
+
*/
|
|
18
|
+
export declare const addPaddingToUtxos: (hinkal: IHinkal, erc20Addresses: string[], amountChanges: bigint[], maxInput?: number, tokenIds?: number[], forceEmptyUtxos?: boolean) => Promise<Utxo[][]>;
|
|
@@ -1,82 +1,90 @@
|
|
|
1
1
|
import { Mutex as A } from "async-mutex";
|
|
2
2
|
import { getERC20Registry as w } from "../../../constants/token-data/ERC20Registry.mjs";
|
|
3
3
|
import { getERC20Token as k } from "../../utils/erc20tokenFunctions.mjs";
|
|
4
|
-
import { caseInsensitiveEqual as
|
|
4
|
+
import { caseInsensitiveEqual as u } from "../../utils/caseInsensitive.utils.mjs";
|
|
5
5
|
import { patchRegistry as I } from "../../utils/volatile-patcher.utils.mjs";
|
|
6
6
|
import { Utxo as U } from "../../../data-structures/utxo/Utxo.mjs";
|
|
7
|
-
import { customTokenRegistry as
|
|
8
|
-
import { VolatileHelper as
|
|
7
|
+
import { customTokenRegistry as b } from "../../../data-structures/custom-token-registry/CustomTokenRegistry.mjs";
|
|
8
|
+
import { VolatileHelper as P } from "../../../data-structures/volatile-helper/VolatileHelper.mjs";
|
|
9
9
|
import { getAmountWithPrecision as x } from "../etherFunctions.mjs";
|
|
10
10
|
import { ErrorWithAmount as S } from "../../../error-handling/customErrors/ErrorWithAmount.mjs";
|
|
11
|
-
import { getInputUtxoAndBalance as
|
|
11
|
+
import { getInputUtxoAndBalance as y } from "./getInputUtxoAndBalance.mjs";
|
|
12
12
|
const C = new A(), O = async (i) => {
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
e.balance
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
|
|
13
|
+
const a = await C.acquire();
|
|
14
|
+
try {
|
|
15
|
+
const { inputUtxos: s } = await y({ hinkal: i, sliceIfMore6: !1 }), r = i.getCurrentChainId(), m = [...w(r), ...b.getCustomTokens(r)];
|
|
16
|
+
await I(r);
|
|
17
|
+
const p = m.map((e) => ({
|
|
18
|
+
token: e,
|
|
19
|
+
balance: s.reduce((t, d) => {
|
|
20
|
+
const o = e.isVolatile ? e.sharedAddress : e.erc20TokenAddress;
|
|
21
|
+
return u(o, d.erc20TokenAddress) ? t + d.amount : t;
|
|
22
|
+
}, 0n),
|
|
23
|
+
timestamp: s.filter(
|
|
24
|
+
(t) => u(t.erc20TokenAddress, e.erc20TokenAddress)
|
|
25
|
+
)[0]?.timeStamp,
|
|
26
|
+
nfts: s.filter(
|
|
27
|
+
(t) => u(t.erc20TokenAddress, e.erc20TokenAddress) && t.tokenId !== 0
|
|
28
|
+
).map((t) => ({ tokenId: t.tokenId, timestamp: t.timeStamp }))
|
|
29
|
+
}));
|
|
30
|
+
return await Promise.all(
|
|
31
|
+
p.map(async (e) => {
|
|
32
|
+
if (!e.token.isVolatile)
|
|
33
|
+
return e;
|
|
34
|
+
e.token?.sharedAddress || console.log("VolatileToken must have a corresponding sharedAddress");
|
|
35
|
+
let t = 0n;
|
|
36
|
+
return e.balance > 0n && (t = await P.getVolatileTokenBalance(
|
|
37
|
+
r,
|
|
38
|
+
e.token.sharedAddress,
|
|
39
|
+
e.balance
|
|
40
|
+
)), {
|
|
41
|
+
...e,
|
|
42
|
+
balance: BigInt(t)
|
|
43
|
+
};
|
|
44
|
+
})
|
|
45
|
+
);
|
|
46
|
+
} catch (s) {
|
|
47
|
+
console.log("Error while processing shielded balance:", s);
|
|
48
|
+
} finally {
|
|
49
|
+
a();
|
|
50
|
+
}
|
|
51
|
+
return [];
|
|
52
|
+
}, X = async (i, a, s, r = 6, m = a.map(() => 0), p = !1) => {
|
|
53
|
+
const { userKeys: g } = i, e = [], t = [];
|
|
46
54
|
let d = 0;
|
|
47
|
-
for (let o = 0; o <
|
|
55
|
+
for (let o = 0; o < a.length; o += 1)
|
|
48
56
|
if (p === !1) {
|
|
49
|
-
const { inputUtxos:
|
|
57
|
+
const { inputUtxos: n } = await y({
|
|
50
58
|
hinkal: i,
|
|
51
|
-
erc20TokenAddress:
|
|
52
|
-
tokenId:
|
|
59
|
+
erc20TokenAddress: a[o],
|
|
60
|
+
tokenId: m[o],
|
|
53
61
|
sliceIfMore6: !1
|
|
54
62
|
});
|
|
55
|
-
d = Math.max(
|
|
63
|
+
d = Math.max(n.length, d), t.push(n);
|
|
56
64
|
} else
|
|
57
65
|
t.push([]);
|
|
58
|
-
return d === 2 ? t : (t.forEach((o,
|
|
59
|
-
if (o.length >
|
|
60
|
-
const
|
|
61
|
-
if (
|
|
62
|
-
const f = k(n
|
|
66
|
+
return d === 2 ? t : (t.forEach((o, n) => {
|
|
67
|
+
if (o.length > r) {
|
|
68
|
+
const l = o.slice(0, r), c = l.reduce((f, h) => f + h.amount, 0n);
|
|
69
|
+
if (s[n] < 0n && c < -s[n]) {
|
|
70
|
+
const f = k(a[n], i.getCurrentChainId()), h = Number(x(c, f, 2)), T = `Unfortunately your transaction did not go through due to UTXOs limitations.
|
|
63
71
|
Please try again with ${f.symbol}`;
|
|
64
|
-
throw new S(h,
|
|
72
|
+
throw new S(h, T);
|
|
65
73
|
}
|
|
66
|
-
e.push(
|
|
67
|
-
} else if (o.length <=
|
|
68
|
-
const
|
|
69
|
-
let
|
|
70
|
-
for (;
|
|
71
|
-
|
|
74
|
+
e.push(l);
|
|
75
|
+
} else if (o.length <= r) {
|
|
76
|
+
const l = [...o];
|
|
77
|
+
let c = r - o.length;
|
|
78
|
+
for (; c > 0; )
|
|
79
|
+
c -= 1, l.push(
|
|
72
80
|
new U({
|
|
73
81
|
amount: 0n,
|
|
74
|
-
erc20TokenAddress: n
|
|
75
|
-
shieldedPrivateKey:
|
|
76
|
-
tokenId:
|
|
82
|
+
erc20TokenAddress: a[n],
|
|
83
|
+
shieldedPrivateKey: g.getShieldedPrivateKey(),
|
|
84
|
+
tokenId: m[n]
|
|
77
85
|
})
|
|
78
86
|
);
|
|
79
|
-
e.push(
|
|
87
|
+
e.push(l);
|
|
80
88
|
}
|
|
81
89
|
}), e);
|
|
82
90
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Contract, ethers } from 'ethers';
|
|
2
|
+
/**
|
|
3
|
+
* to get contract events
|
|
4
|
+
* @param eventName to retrieve specific events
|
|
5
|
+
* @param eventArgs event arguments
|
|
6
|
+
* @returns array of the specific events
|
|
7
|
+
*/
|
|
8
|
+
export declare const retrieveEvents: (hinkalContract: ethers.Contract, eventName: string, ...eventArgs: unknown[]) => Promise<ethers.Event[]>;
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* @param web3Provider instance to get hinkal contract
|
|
12
|
+
* @returns array of deposit timestamps in JS new Date format
|
|
13
|
+
*/
|
|
14
|
+
export declare const getDepositEvents: (hinkalContract: Contract, erc20TokenAddress: string) => Promise<Date[]>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ethers } from 'ethers';
|
|
2
|
+
import { IHinkal } from '../../../data-structures/Hinkal/IHinkal';
|
|
3
|
+
import { AxelarMigrationInfo, SignatureData } from '../../../types';
|
|
4
|
+
export declare const checkHinkalAccessToken: (hinkal: IHinkal) => Promise<any>;
|
|
5
|
+
export declare const mintAccessToken: (hinkal: IHinkal, signatureData: SignatureData) => Promise<ethers.ContractTransaction>;
|
|
6
|
+
export declare const mintTokenCrossChain: (hinkal: IHinkal, signatureData: SignatureData, axelarMigrationInfos: AxelarMigrationInfo[]) => Promise<ethers.ContractTransaction>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ethers } from 'ethers';
|
|
2
|
+
import { IHinkal } from '../../../data-structures/Hinkal/IHinkal';
|
|
3
|
+
import { ERC20Token } from '../../../types/token.types';
|
|
4
|
+
export declare const approveTokenToHinkal: (hinkal: IHinkal, contractToApprove: ethers.Contract, amount: bigint, token: ERC20Token) => Promise<Uint8Array | undefined>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { IHinkal } from '../../../data-structures/Hinkal/IHinkal';
|
|
2
|
+
import { CircomDataType, DimDataType } from '../../../types/circom-data.types';
|
|
3
|
+
import { NewZkCallDataType } from '../../../types/snark.types';
|
|
4
|
+
export declare const estimateGasRelayer: (hinkal: IHinkal, newZkCallData: NewZkCallDataType, dimData: DimDataType, circomData: CircomDataType) => Promise<bigint>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ethers } from 'ethers';
|
|
2
|
+
export interface RelayEntryData {
|
|
3
|
+
relayAddress: string;
|
|
4
|
+
url: string;
|
|
5
|
+
priority: number;
|
|
6
|
+
}
|
|
7
|
+
export interface RelayEntryWithIndex extends RelayEntryData {
|
|
8
|
+
lowerIndex: number;
|
|
9
|
+
}
|
|
10
|
+
export declare const getRelayPercentage: (contract: ethers.Contract) => Promise<bigint>;
|
|
11
|
+
export declare const chooseRandomRelay: (entries: RelayEntryData[]) => {
|
|
12
|
+
lowerIndex: number;
|
|
13
|
+
relayAddress: string;
|
|
14
|
+
url: string;
|
|
15
|
+
priority: number;
|
|
16
|
+
};
|
|
17
|
+
export declare const getRelay: (hinkalHelperContract: ethers.Contract) => Promise<RelayEntryWithIndex>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ethers } from 'ethers';
|
|
2
|
+
import { IHinkal } from '../../../data-structures/Hinkal/IHinkal';
|
|
3
|
+
import { CircomDataType, DimDataType } from '../../../types/circom-data.types';
|
|
4
|
+
import { ERC20Token } from '../../../types/token.types';
|
|
5
|
+
import { NewZkCallDataType } from '../../../types/snark.types';
|
|
6
|
+
export declare const transactCallDirect: (hinkal: IHinkal, amount: bigint, tokenToApprove: ERC20Token, newZkCallData: NewZkCallDataType, circomData: CircomDataType, dimData: DimDataType, contractApproval?: ethers.Contract, contractTransaction?: ethers.Contract, hasAccessToken?: boolean) => Promise<any>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CircomDataType, DimDataType, NewZkCallDataType, RelayerTransaction } from '../../../types';
|
|
2
|
+
export interface RelayerResponseInterface {
|
|
3
|
+
status: string;
|
|
4
|
+
message: RelayerTransaction;
|
|
5
|
+
error?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const transactCallRelayer: (chainId: number, newZkCallData: NewZkCallDataType, dimData: DimDataType, circomData: CircomDataType, withPrivateMempool?: boolean) => Promise<RelayerTransaction>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ContractMetadata, ContractType } from '../../types/ethereum-network.types';
|
|
2
|
+
import { ethers } from 'ethers';
|
|
3
|
+
export declare const getContractMetadata: (contractType: ContractType, chainId: number) => ContractMetadata;
|
|
4
|
+
export declare const getContract: (contractType: ContractType, chainId: number, contractAddress?: string) => ethers.Contract;
|
|
5
|
+
export declare const getContractWithFetcherByChainId: (chainId: number, contractType: ContractType, contractAddress?: undefined) => ethers.Contract;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BigNumber, ethers } from 'ethers';
|
|
2
|
+
interface IRunTransaction {
|
|
3
|
+
contractFunction: ethers.ContractFunction;
|
|
4
|
+
args: unknown[];
|
|
5
|
+
gasLimit?: number;
|
|
6
|
+
gasPrice?: BigNumber;
|
|
7
|
+
confirmations?: number;
|
|
8
|
+
waitTime?: number;
|
|
9
|
+
nonce?: number;
|
|
10
|
+
}
|
|
11
|
+
interface IRunContractFunction extends IRunTransaction {
|
|
12
|
+
provider: ethers.providers.Provider;
|
|
13
|
+
}
|
|
14
|
+
export declare const runContractFunction: ({ provider, contractFunction, args, gasLimit, nonce, confirmations, }: IRunContractFunction) => Promise<ethers.ContractReceipt>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Contract } from 'ethers';
|
|
2
|
+
import { ERC20Token } from '../../types';
|
|
3
|
+
import { IHinkal } from '../../data-structures/Hinkal/IHinkal';
|
|
4
|
+
interface PoolAndFee {
|
|
5
|
+
poolAddress: string;
|
|
6
|
+
fee: number;
|
|
7
|
+
token1Balance: bigint;
|
|
8
|
+
}
|
|
9
|
+
export declare const searchPoolAndFee: (token1Contract: Contract, factory: Contract, token0Address: string, token1Address: string) => Promise<PoolAndFee>;
|
|
10
|
+
export declare const getUniswapPriceHelper: (hinkal: IHinkal, chainId: number, token0: ERC20Token, token1: ERC20Token, fee: number, inSwapAmount: bigint) => Promise<bigint>;
|
|
11
|
+
export declare const getUniswapFee: (hinkal: IHinkal, chainId: number, token0: ERC20Token, token1: ERC20Token) => Promise<number>;
|
|
12
|
+
export declare const getUniswapPrice: (hinkal: IHinkal, chainId: number, inSwapAmount: string, inSwapToken: ERC20Token, outSwapToken: ERC20Token) => Promise<{
|
|
13
|
+
tokenPrice: bigint;
|
|
14
|
+
poolFee: string;
|
|
15
|
+
}>;
|
|
16
|
+
export {};
|
package/index.d.mts
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hinkal/common",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.11",
|
|
4
4
|
"homepage": "hinkal.pro",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Hinkal Protocol"
|
|
@@ -13,26 +13,57 @@
|
|
|
13
13
|
],
|
|
14
14
|
"exports": {
|
|
15
15
|
".": {
|
|
16
|
-
"import":
|
|
17
|
-
|
|
16
|
+
"import": {
|
|
17
|
+
"types": "./index.d.mts",
|
|
18
|
+
"default": "./index.mjs"
|
|
19
|
+
},
|
|
20
|
+
"require": {
|
|
21
|
+
"types": "./index.d.ts",
|
|
22
|
+
"default": "./index.cjs"
|
|
23
|
+
}
|
|
18
24
|
},
|
|
19
25
|
"./providers/EthersProviderAdapter": {
|
|
20
|
-
"import":
|
|
21
|
-
|
|
26
|
+
"import": {
|
|
27
|
+
"types": "./providers/EthersProviderAdapter.d.mts",
|
|
28
|
+
"default": "./providers/EthersProviderAdapter.mjs"
|
|
29
|
+
},
|
|
30
|
+
"require": {
|
|
31
|
+
"types": "./providers/EthersProviderAdapter.d.ts",
|
|
32
|
+
"default": "./providers/EthersProviderAdapter.cjs"
|
|
33
|
+
}
|
|
22
34
|
},
|
|
23
35
|
"./providers/WagmiProviderAdapter": {
|
|
24
|
-
"import":
|
|
25
|
-
|
|
36
|
+
"import": {
|
|
37
|
+
"types": "./providers/WagmiProviderAdapter.d.mts",
|
|
38
|
+
"default": "./providers/WagmiProviderAdapter.mjs"
|
|
39
|
+
},
|
|
40
|
+
"require": {
|
|
41
|
+
"types:": "./providers/WagmiProviderAdapter.d.ts",
|
|
42
|
+
"default": "./providers/WagmiProviderAdapter.cjs"
|
|
43
|
+
}
|
|
26
44
|
},
|
|
27
45
|
"./providers/prepareEthersHinkal": {
|
|
28
|
-
"import":
|
|
29
|
-
|
|
46
|
+
"import": {
|
|
47
|
+
"types": "./providers/prepareEthersHinkal.d.mts",
|
|
48
|
+
"default": "./providers/prepareEthersHinkal.mjs"
|
|
49
|
+
},
|
|
50
|
+
"require": {
|
|
51
|
+
"types": "./providers/prepareEthersHinkal.d.ts",
|
|
52
|
+
"default": "./providers/prepareEthersHinkal.cjs"
|
|
53
|
+
}
|
|
30
54
|
},
|
|
31
55
|
"./providers/prepareWagmiHinkal": {
|
|
32
|
-
"import":
|
|
33
|
-
|
|
56
|
+
"import": {
|
|
57
|
+
"types": "./providers/prepareWagmiHinkal.d.mts",
|
|
58
|
+
"default": "./providers/prepareWagmiHinkal.mjs"
|
|
59
|
+
},
|
|
60
|
+
"require": {
|
|
61
|
+
"types": "./providers/prepareWagmiHinkal.d.ts",
|
|
62
|
+
"default": "./providers/prepareWagmiHinkal.cjs"
|
|
63
|
+
}
|
|
34
64
|
}
|
|
35
65
|
},
|
|
66
|
+
"types": "./index.d.ts",
|
|
36
67
|
"scripts": {
|
|
37
68
|
"prebuild": "nx prebuild:workers",
|
|
38
69
|
"build": "nx build",
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { IProviderAdapter } from '../data-structures/provider-adapter/IProviderAdapter';
|
|
2
|
+
import { ContractMetadata, ContractType, EthereumNetwork } from '../types/ethereum-network.types';
|
|
3
|
+
import { ethers, Signer } from 'ethers';
|
|
4
|
+
export declare class EthersProviderAdapter implements IProviderAdapter<Signer> {
|
|
5
|
+
signer: Signer | undefined;
|
|
6
|
+
chainId: number | undefined;
|
|
7
|
+
private originalProvider;
|
|
8
|
+
private fetchProvider;
|
|
9
|
+
initConnector(): void;
|
|
10
|
+
initSigner(signer: Signer): void;
|
|
11
|
+
requireSigner(): void;
|
|
12
|
+
init(chainId?: number): Promise<void>;
|
|
13
|
+
disconnectFromConnector(): Promise<void>;
|
|
14
|
+
connectToConnector(): Promise<number>;
|
|
15
|
+
waitForTransaction(transactionHash: string, confirmations: number): Promise<boolean>;
|
|
16
|
+
signMessage(message: string): Promise<string>;
|
|
17
|
+
signTypedData(domain: ethers.TypedDataDomain, types: Record<string, ethers.TypedDataField[]>, value: Record<string, unknown>): Promise<string>;
|
|
18
|
+
getSelectedNetwork: () => EthereumNetwork | undefined;
|
|
19
|
+
switchNetwork(): Promise<void>;
|
|
20
|
+
private createFetchProvider;
|
|
21
|
+
getAddress(): Promise<string>;
|
|
22
|
+
setChainEventListener(): void;
|
|
23
|
+
onAccountChanged(): Promise<unknown>;
|
|
24
|
+
onChainChanged(chainId?: number): Promise<unknown>;
|
|
25
|
+
release(): void;
|
|
26
|
+
private parseChainIdParam;
|
|
27
|
+
getContractMetadata(contractType: ContractType, chainId?: number): ContractMetadata;
|
|
28
|
+
getContract(contractType: ContractType, contractAddress?: undefined, chainId?: number): ethers.Contract;
|
|
29
|
+
getContractWithSigner(contract: ContractType, contractAddress?: undefined): ethers.Contract;
|
|
30
|
+
getContractWithFetcher(contract: ContractType, contractAddress?: undefined): ethers.Contract;
|
|
31
|
+
getContractWithFetcherForEthereum(contract: ContractType, contractAddress?: undefined): ethers.Contract;
|
|
32
|
+
sendTransaction(tx: ethers.providers.TransactionRequest): Promise<ethers.providers.TransactionResponse>;
|
|
33
|
+
connectAndPatchProvider(): Promise<number>;
|
|
34
|
+
isPermitterAvailable(): boolean;
|
|
35
|
+
getGasPrice(): Promise<bigint>;
|
|
36
|
+
}
|
|
37
|
+
export declare const ethersProvierAdapter: EthersProviderAdapter;
|
|
38
|
+
declare const _default: <T = unknown>() => IProviderAdapter<T>;
|
|
39
|
+
export default _default;
|