@hinkal/common 0.2.19 → 0.2.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/API/API.cjs +1 -1
- package/API/API.d.ts +6 -1
- package/API/API.mjs +48 -41
- package/API/enclaveCalls.cjs +1 -1
- package/API/enclaveCalls.mjs +5 -4
- package/API/index.d.ts +1 -0
- package/API/proxyAccountsCalls.cjs +1 -1
- package/API/proxyAccountsCalls.d.ts +7 -2
- package/API/proxyAccountsCalls.mjs +26 -20
- package/API/temporaryWalletCalls.cjs +1 -0
- package/API/temporaryWalletCalls.d.ts +13 -0
- package/API/temporaryWalletCalls.mjs +20 -0
- package/API/unspent-utxos-calls.cjs +1 -1
- package/API/unspent-utxos-calls.d.ts +1 -1
- package/API/unspent-utxos-calls.mjs +16 -14
- package/README.md +36 -13
- package/constants/chains.constants.cjs +1 -1
- package/constants/chains.constants.d.ts +1 -1
- package/constants/chains.constants.mjs +69 -51
- package/constants/deploy-data/deploy-data-solana.json.cjs +1 -1
- package/constants/deploy-data/deploy-data-solana.json.mjs +28 -2
- package/constants/kyc.constants.cjs +1 -1
- package/constants/kyc.constants.mjs +39 -40
- package/constants/mediaUrls.constants.cjs +1 -1
- package/constants/mediaUrls.constants.d.ts +1 -0
- package/constants/mediaUrls.constants.mjs +2 -1
- package/constants/server.constants.cjs +1 -1
- package/constants/server.constants.d.ts +6 -1
- package/constants/server.constants.mjs +37 -32
- package/constants/token-data/polygonRegistry.json.cjs +1 -1
- package/constants/token-data/polygonRegistry.json.mjs +4 -4
- package/constants/token-data/polygonRegistryFixed.json.cjs +1 -1
- package/constants/token-data/polygonRegistryFixed.json.mjs +4 -4
- package/data-structures/AccountActions/AccountActions.cjs +1 -0
- package/data-structures/AccountActions/AccountActions.d.ts +18 -0
- package/data-structures/AccountActions/AccountActions.mjs +78 -0
- package/data-structures/AccountActions/index.d.ts +1 -0
- package/data-structures/ApprovalDBs/EventsPublicApprovalsDB.cjs +1 -1
- package/data-structures/ApprovalDBs/EventsPublicApprovalsDB.mjs +68 -71
- package/data-structures/BlockchainEvent/BlockchainEvent.cjs +1 -0
- package/data-structures/BlockchainEvent/BlockchainEvent.d.ts +14 -0
- package/data-structures/BlockchainEvent/BlockchainEvent.mjs +41 -0
- package/data-structures/Hinkal/Hinkal.cjs +1 -1
- package/data-structures/Hinkal/Hinkal.d.ts +14 -8
- package/data-structures/Hinkal/Hinkal.mjs +215 -179
- package/data-structures/Hinkal/IHinkal.d.ts +9 -6
- package/data-structures/Hinkal/handleAutoDepositBack.cjs +1 -1
- package/data-structures/Hinkal/handleAutoDepositBack.mjs +47 -48
- package/data-structures/Hinkal/hinkalActionReceive.cjs +1 -1
- package/data-structures/Hinkal/hinkalActionReceive.mjs +25 -22
- package/data-structures/Hinkal/hinkalCheckTokenRegistry.cjs +1 -1
- package/data-structures/Hinkal/hinkalCheckTokenRegistry.mjs +12 -12
- package/data-structures/Hinkal/hinkalDeposit.cjs +1 -1
- package/data-structures/Hinkal/hinkalDeposit.mjs +63 -63
- package/data-structures/Hinkal/hinkalDepositAndWithdraw.cjs +1 -1
- package/data-structures/Hinkal/hinkalDepositAndWithdraw.mjs +60 -147
- package/data-structures/Hinkal/hinkalDepositOnChainUtxos.cjs +1 -0
- package/data-structures/Hinkal/hinkalDepositOnChainUtxos.d.ts +4 -0
- package/data-structures/Hinkal/hinkalDepositOnChainUtxos.mjs +103 -0
- package/data-structures/Hinkal/hinkalDepostAndBridge.cjs +1 -0
- package/data-structures/Hinkal/hinkalDepostAndBridge.d.ts +4 -0
- package/data-structures/Hinkal/hinkalDepostAndBridge.mjs +214 -0
- package/data-structures/Hinkal/hinkalGetZkMeProvider.cjs +1 -1
- package/data-structures/Hinkal/hinkalGetZkMeProvider.mjs +4 -4
- package/data-structures/Hinkal/hinkalPrivateWallet.cjs +1 -1
- package/data-structures/Hinkal/hinkalPrivateWallet.d.ts +2 -2
- package/data-structures/Hinkal/hinkalPrivateWallet.mjs +103 -99
- package/data-structures/Hinkal/hinkalProxySwap.cjs +1 -1
- package/data-structures/Hinkal/hinkalProxySwap.mjs +44 -41
- package/data-structures/Hinkal/hinkalProxyToPrivate.cjs +1 -1
- package/data-structures/Hinkal/hinkalProxyToPrivate.mjs +31 -28
- package/data-structures/Hinkal/hinkalSignSubAccount.cjs +1 -1
- package/data-structures/Hinkal/hinkalSignSubAccount.mjs +16 -13
- package/data-structures/Hinkal/hinkalSolanaDeposit.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaDeposit.mjs +34 -34
- package/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.mjs +67 -65
- package/data-structures/Hinkal/hinkalSolanaProxySend.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaProxySend.mjs +35 -32
- package/data-structures/Hinkal/hinkalSolanaProxyShield.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaProxyShield.mjs +59 -56
- package/data-structures/Hinkal/hinkalSolanaProxySwap.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaProxySwap.mjs +35 -32
- package/data-structures/Hinkal/hinkalSolanaSwap.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaSwap.mjs +10 -10
- package/data-structures/Hinkal/hinkalSolanaWithdraw.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaWithdraw.mjs +25 -25
- package/data-structures/Hinkal/hinkalSwap.cjs +1 -1
- package/data-structures/Hinkal/hinkalSwap.mjs +34 -30
- package/data-structures/Hinkal/hinkalTransfer.cjs +1 -1
- package/data-structures/Hinkal/hinkalTransfer.mjs +43 -39
- package/data-structures/Hinkal/hinkalWithdraw.cjs +1 -1
- package/data-structures/Hinkal/hinkalWithdraw.mjs +47 -43
- package/data-structures/Hinkal/hinkalWithdrawStuckUtxos.cjs +1 -1
- package/data-structures/Hinkal/hinkalWithdrawStuckUtxos.mjs +50 -46
- package/data-structures/Hinkal/resetMerkleTrees.cjs +1 -1
- package/data-structures/Hinkal/resetMerkleTrees.mjs +36 -34
- package/data-structures/IndexedDB/activity-db.cjs +1 -1
- package/data-structures/IndexedDB/activity-db.d.ts +1 -0
- package/data-structures/IndexedDB/activity-db.mjs +86 -70
- package/data-structures/IndexedDB/balances-db.cjs +1 -1
- package/data-structures/IndexedDB/balances-db.mjs +33 -30
- package/data-structures/IndexedDB/contact-db.cjs +1 -1
- package/data-structures/IndexedDB/contact-db.mjs +9 -6
- package/data-structures/PublicBalance/PublicBalanceWatcher.cjs +1 -0
- package/data-structures/PublicBalance/PublicBalanceWatcher.d.ts +20 -0
- package/data-structures/PublicBalance/PublicBalanceWatcher.mjs +124 -0
- package/data-structures/PublicBalance/SolanaPublicBalancerWatcher.cjs +1 -0
- package/data-structures/PublicBalance/SolanaPublicBalancerWatcher.d.ts +15 -0
- package/data-structures/PublicBalance/SolanaPublicBalancerWatcher.mjs +64 -0
- package/data-structures/PublicBalance/index.d.ts +2 -0
- package/data-structures/TokenDBs/EventsPublicTokensDB.cjs +1 -1
- package/data-structures/TokenDBs/EventsPublicTokensDB.mjs +77 -78
- package/data-structures/crypto-keys/keys.cjs +1 -1
- package/data-structures/crypto-keys/keys.d.ts +0 -11
- package/data-structures/crypto-keys/keys.mjs +47 -107
- package/data-structures/event-service/evm/AbstractAccessTokenSnapshotService.cjs +1 -1
- package/data-structures/event-service/evm/AbstractAccessTokenSnapshotService.d.ts +3 -2
- package/data-structures/event-service/evm/AbstractAccessTokenSnapshotService.mjs +9 -9
- package/data-structures/event-service/evm/AbstractApprovalsSnapshotService.cjs +1 -1
- package/data-structures/event-service/evm/AbstractApprovalsSnapshotService.d.ts +3 -2
- package/data-structures/event-service/evm/AbstractApprovalsSnapshotService.mjs +5 -5
- package/data-structures/event-service/evm/AbstractCommitmentsSnapshotService.cjs +1 -1
- package/data-structures/event-service/evm/AbstractCommitmentsSnapshotService.d.ts +3 -2
- package/data-structures/event-service/evm/AbstractCommitmentsSnapshotService.mjs +6 -6
- package/data-structures/event-service/evm/AbstractEventService.cjs +1 -1
- package/data-structures/event-service/evm/AbstractEventService.d.ts +3 -2
- package/data-structures/event-service/evm/AbstractEventService.mjs +16 -19
- package/data-structures/event-service/evm/AbstractNullifierSnapshotService.cjs +1 -1
- package/data-structures/event-service/evm/AbstractNullifierSnapshotService.d.ts +3 -3
- package/data-structures/event-service/evm/AbstractNullifierSnapshotService.mjs +6 -5
- package/data-structures/event-service/evm/AbstractSnapshotService.d.ts +1 -1
- package/data-structures/event-service/evm/BlockchainEventEmitter.cjs +1 -1
- package/data-structures/event-service/evm/BlockchainEventEmitter.d.ts +7 -4
- package/data-structures/event-service/evm/BlockchainEventEmitter.mjs +35 -34
- package/data-structures/event-service/evm/ClientBlockchainEventEmitter.cjs +1 -0
- package/data-structures/event-service/evm/ClientBlockchainEventEmitter.d.ts +11 -0
- package/data-structures/event-service/evm/ClientBlockchainEventEmitter.mjs +21 -0
- package/data-structures/event-service/evm/PollingBlockchainEventEmitter.cjs +1 -0
- package/data-structures/event-service/evm/PollingBlockchainEventEmitter.d.ts +6 -0
- package/data-structures/event-service/evm/PollingBlockchainEventEmitter.mjs +16 -0
- package/data-structures/event-service/helpers/ClientEventHelper.cjs +1 -0
- package/data-structures/event-service/helpers/ClientEventHelper.d.ts +11 -0
- package/data-structures/event-service/helpers/ClientEventHelper.mjs +26 -0
- package/data-structures/event-service/helpers/PollingEventHelper.cjs +1 -0
- package/data-structures/event-service/helpers/PollingEventHelper.d.ts +5 -0
- package/data-structures/event-service/helpers/PollingEventHelper.mjs +14 -0
- package/data-structures/event-service/index.d.ts +4 -0
- package/data-structures/event-service/solana/AbstractSolanaAccessTokenSnapshotService.cjs +1 -1
- package/data-structures/event-service/solana/AbstractSolanaAccessTokenSnapshotService.d.ts +3 -2
- package/data-structures/event-service/solana/AbstractSolanaAccessTokenSnapshotService.mjs +6 -6
- package/data-structures/event-service/solana/AbstractSolanaCommitmentsSnapshotService.cjs +1 -1
- package/data-structures/event-service/solana/AbstractSolanaCommitmentsSnapshotService.d.ts +4 -3
- package/data-structures/event-service/solana/AbstractSolanaCommitmentsSnapshotService.mjs +8 -8
- package/data-structures/event-service/solana/AbstractSolanaEventService.cjs +1 -1
- package/data-structures/event-service/solana/AbstractSolanaEventService.d.ts +3 -10
- package/data-structures/event-service/solana/AbstractSolanaEventService.mjs +5 -5
- package/data-structures/event-service/solana/AbstractSolanaNullifierSnapshotService.cjs +1 -1
- package/data-structures/event-service/solana/AbstractSolanaNullifierSnapshotService.d.ts +3 -2
- package/data-structures/event-service/solana/AbstractSolanaNullifierSnapshotService.mjs +1 -1
- package/data-structures/event-service/solana/AbstractSolanaSnapshotService.d.ts +1 -1
- package/data-structures/event-service/solana/ClientSolanaBlockchainEventEmitter.cjs +1 -0
- package/data-structures/event-service/solana/ClientSolanaBlockchainEventEmitter.d.ts +11 -0
- package/data-structures/event-service/solana/ClientSolanaBlockchainEventEmitter.mjs +22 -0
- package/data-structures/event-service/solana/PollingSolanaBlockchainEventEmitter.cjs +1 -0
- package/data-structures/event-service/solana/PollingSolanaBlockchainEventEmitter.d.ts +6 -0
- package/data-structures/event-service/solana/PollingSolanaBlockchainEventEmitter.mjs +16 -0
- package/data-structures/event-service/solana/SolanaBlockchainEventEmitter.cjs +1 -1
- package/data-structures/event-service/solana/SolanaBlockchainEventEmitter.d.ts +8 -14
- package/data-structures/event-service/solana/SolanaBlockchainEventEmitter.mjs +68 -67
- package/data-structures/index.d.ts +3 -0
- package/data-structures/snapshot/evm-snapshots/ClientAccessTokenSnapshotService.cjs +1 -1
- package/data-structures/snapshot/evm-snapshots/ClientAccessTokenSnapshotService.mjs +5 -2
- package/data-structures/snapshot/evm-snapshots/ClientApprovalsSnapshotService.cjs +1 -1
- package/data-structures/snapshot/evm-snapshots/ClientApprovalsSnapshotService.mjs +5 -2
- package/data-structures/snapshot/evm-snapshots/ClientCommitmentsSnapshotService.cjs +1 -1
- package/data-structures/snapshot/evm-snapshots/ClientCommitmentsSnapshotService.mjs +5 -2
- package/data-structures/snapshot/evm-snapshots/ClientNullifierSnapshotService.cjs +1 -1
- package/data-structures/snapshot/evm-snapshots/ClientNullifierSnapshotService.mjs +5 -2
- package/data-structures/snapshot/solana-snapshots/ClientSolanaAccessTokenSnapshotService.cjs +1 -1
- package/data-structures/snapshot/solana-snapshots/ClientSolanaAccessTokenSnapshotService.mjs +5 -2
- package/data-structures/snapshot/solana-snapshots/ClientSolanaCommitmentsSnapshotService.cjs +1 -1
- package/data-structures/snapshot/solana-snapshots/ClientSolanaCommitmentsSnapshotService.mjs +5 -2
- package/data-structures/snapshot/solana-snapshots/ClientSolanaNullifierSnapshotService.cjs +1 -1
- package/data-structures/snapshot/solana-snapshots/ClientSolanaNullifierSnapshotService.mjs +5 -2
- package/data-structures/utxo/Utxo.cjs +1 -1
- package/data-structures/utxo/Utxo.d.ts +1 -0
- package/data-structures/utxo/Utxo.mjs +18 -4
- package/error-handling/error-codes.constants.cjs +1 -1
- package/error-handling/error-codes.constants.mjs +2 -2
- package/functions/pre-transaction/getSolanaCalldataHash.cjs +1 -1
- package/functions/pre-transaction/getSolanaCalldataHash.mjs +22 -22
- package/functions/pre-transaction/sendV0Transaction.cjs +1 -1
- package/functions/pre-transaction/sendV0Transaction.mjs +53 -50
- package/functions/pre-transaction/solana.cjs +1 -1
- package/functions/pre-transaction/solana.mjs +93 -93
- package/functions/private-wallet/emporium.helpers.cjs +1 -1
- package/functions/private-wallet/emporium.helpers.d.ts +3 -2
- package/functions/private-wallet/emporium.helpers.mjs +118 -93
- package/functions/snarkjs/constructEmporiumProof.cjs +1 -1
- package/functions/snarkjs/constructEmporiumProof.d.ts +1 -2
- package/functions/snarkjs/constructEmporiumProof.mjs +89 -89
- package/functions/snarkjs/constructSolanaZkProof.cjs +1 -1
- package/functions/snarkjs/constructSolanaZkProof.mjs +6 -2
- package/functions/utils/bytes32.utils.cjs +1 -1
- package/functions/utils/bytes32.utils.mjs +8 -7
- package/functions/utils/create-provider.cjs +1 -1
- package/functions/utils/create-provider.d.ts +1 -1
- package/functions/utils/create-provider.mjs +13 -9
- package/functions/utils/index.d.ts +0 -1
- package/functions/utils/prepareHinkal.cjs +1 -1
- package/functions/utils/prepareHinkal.d.ts +6 -7
- package/functions/utils/prepareHinkal.mjs +45 -53
- package/functions/utils/publicBalance.utils.cjs +1 -1
- package/functions/utils/publicBalance.utils.mjs +49 -54
- package/functions/utils/socket.utils.cjs +1 -0
- package/functions/utils/socket.utils.d.ts +1 -0
- package/functions/utils/socket.utils.mjs +12 -0
- package/functions/utils/string.utils.cjs +1 -1
- package/functions/utils/string.utils.d.ts +1 -0
- package/functions/utils/string.utils.mjs +18 -14
- package/functions/utils/walletBalances.utils.cjs +1 -1
- package/functions/utils/walletBalances.utils.d.ts +1 -1
- package/functions/utils/walletBalances.utils.mjs +4 -4
- package/functions/web3/crypto.cjs +1 -0
- package/functions/web3/crypto.d.ts +1 -0
- package/functions/web3/crypto.mjs +7 -0
- package/functions/web3/events/getApprovedBalance.cjs +1 -1
- package/functions/web3/events/getApprovedBalance.mjs +14 -14
- package/functions/web3/events/getInputUtxoAndBalance.cjs +1 -1
- package/functions/web3/events/getInputUtxoAndBalance.mjs +61 -59
- package/functions/web3/events/getTransactionLogEvents.cjs +1 -1
- package/functions/web3/events/getTransactionLogEvents.mjs +32 -32
- package/functions/web3/fetchSolanaMerkleTreeRootHash.cjs +1 -1
- package/functions/web3/fetchSolanaMerkleTreeRootHash.mjs +6 -3
- package/functions/web3/functionCalls/approveToken.cjs +1 -1
- package/functions/web3/functionCalls/approveToken.mjs +17 -17
- package/functions/web3/functionCalls/transactCallDirect.cjs +1 -1
- package/functions/web3/functionCalls/transactCallDirect.mjs +16 -16
- package/functions/web3/functionCalls/transactCallRelayer.cjs +1 -1
- package/functions/web3/functionCalls/transactCallRelayer.mjs +13 -11
- package/functions/web3/getContractMetadata.cjs +1 -1
- package/functions/web3/getContractMetadata.mjs +17 -22
- package/functions/web3/getTokenHolder.cjs +1 -1
- package/functions/web3/getTokenHolder.mjs +20 -20
- package/functions/web3/index.d.ts +1 -0
- package/index.cjs +1 -1
- package/index.mjs +913 -890
- package/package.json +3 -2
- package/providers/EthersProviderAdapter.cjs +1 -1
- package/providers/EthersProviderAdapter.mjs +2 -5
- package/providers/prepareEthersHinkal.cjs +1 -1
- package/providers/prepareEthersHinkal.mjs +11 -4
- package/providers/prepareWagmiHinkal.cjs +1 -1
- package/providers/prepareWagmiHinkal.mjs +11 -4
- package/types/activities.types.d.ts +2 -0
- package/types/bridging-tx.types.d.ts +17 -0
- package/types/cache.types.cjs +1 -1
- package/types/cache.types.d.ts +5 -1
- package/types/cache.types.mjs +1 -1
- package/types/ethereum-network.types.d.ts +1 -0
- package/types/events.types.cjs +1 -0
- package/types/events.types.d.ts +9 -0
- package/types/events.types.mjs +5 -0
- package/types/index.d.ts +2 -0
- package/types/proxy.types.d.ts +11 -4
- package/types/sandbox.types.d.ts +2 -0
- package/types/solana.types.d.ts +8 -0
- package/types/token.types.d.ts +5 -0
- package/webworker/snarkjsWorker/snarkjsWorkerLauncher.cjs +1 -1
- package/webworker/snarkjsWorker/snarkjsWorkerLauncher.mjs +1 -1
- package/webworker/utxoWorker/utxoWorkerLauncher.cjs +1 -1
- package/webworker/utxoWorker/utxoWorkerLauncher.mjs +1 -1
- package/webworker/zkProofWorker/zkProofWorkerLauncher.cjs +1 -1
- package/webworker/zkProofWorker/zkProofWorkerLauncher.mjs +1 -1
- package/functions/kyc/authentoHelper.cjs +0 -1
- package/functions/kyc/authentoHelper.d.ts +0 -12
- package/functions/kyc/authentoHelper.mjs +0 -30
- package/functions/utils/get-hinkal-approvals.cjs +0 -1
- package/functions/utils/get-hinkal-approvals.d.ts +0 -3
- package/functions/utils/get-hinkal-approvals.mjs +0 -38
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ethers as B } from "ethers";
|
|
2
|
+
import { EventType as D } from "../../types/hinkal.types.mjs";
|
|
2
3
|
import { ContractType as w } from "../../types/ethereum-network.types.mjs";
|
|
3
|
-
import { hinkalCheckSolanaTokenRegistry as
|
|
4
|
-
import { checkHinkalAccessToken as
|
|
5
|
-
import { getShieldedBalance as
|
|
6
|
-
import { UserKeys as
|
|
7
|
-
import { hinkalDeposit as
|
|
8
|
-
import { hinkalDepositAndWithdraw as
|
|
9
|
-
import { hinkalSolanaDeposit as
|
|
10
|
-
import { hinkalSwap as
|
|
11
|
-
import { hinkalWithdraw as
|
|
12
|
-
import { hinkalWithdrawStuckUtxos as
|
|
13
|
-
import { resetMerkleTrees as
|
|
14
|
-
import { MerkleTree as
|
|
15
|
-
import "
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { WALLET_SUPPORTED_CHAINS as u, networkRegistry as k, isSolanaLike as h } from "../../constants/chains.constants.mjs";
|
|
4
|
+
import { hinkalCheckSolanaTokenRegistry as F } from "./hinkalCheckSolanaTokenRegistry.mjs";
|
|
5
|
+
import { checkHinkalAccessToken as b } from "../../functions/web3/functionCalls/accessTokenCalls.mjs";
|
|
6
|
+
import { getShieldedBalance as U } from "../../functions/web3/events/getShieldedBalance.mjs";
|
|
7
|
+
import { UserKeys as P } from "../crypto-keys/keys.mjs";
|
|
8
|
+
import { hinkalDeposit as W, hinkalDepositForOther as K } from "./hinkalDeposit.mjs";
|
|
9
|
+
import { hinkalDepositAndWithdraw as x } from "./hinkalDepositAndWithdraw.mjs";
|
|
10
|
+
import { hinkalSolanaDeposit as L, hinkalSolanaDepositForOther as N, hinkalSolanaMultiPaymentDeposit as O } from "./hinkalSolanaDeposit.mjs";
|
|
11
|
+
import { hinkalSwap as z } from "./hinkalSwap.mjs";
|
|
12
|
+
import { hinkalWithdraw as _ } from "./hinkalWithdraw.mjs";
|
|
13
|
+
import { hinkalWithdrawStuckUtxos as I } from "./hinkalWithdrawStuckUtxos.mjs";
|
|
14
|
+
import { resetMerkleTrees as j } from "./resetMerkleTrees.mjs";
|
|
15
|
+
import { MerkleTree as T } from "../merkle-tree/MerkleTree.mjs";
|
|
16
|
+
import { transactionErrorCodes as $ } from "../../error-handling/error-codes.constants.mjs";
|
|
17
|
+
import { poseidonFunction as M } from "../../crypto/poseidon.mjs";
|
|
18
|
+
import { WALLET_SUPPORTED_CHAINS as k, chainIds as u, isSolanaLike as l, networkRegistry as A } from "../../constants/chains.constants.mjs";
|
|
19
19
|
import "../../API/getServerURL.mjs";
|
|
20
20
|
import "axios";
|
|
21
21
|
import "../../constants/coingecko.constants.mjs";
|
|
22
22
|
import "../../constants/server.constants.mjs";
|
|
23
23
|
import "../http/HttpClient.mjs";
|
|
24
|
-
import { API as
|
|
24
|
+
import { API as S } from "../../API/API.mjs";
|
|
25
25
|
import "../../API/tenderly.api.mjs";
|
|
26
26
|
import "../../constants/token-data/index.mjs";
|
|
27
27
|
import "../../constants/contracts.constants.mjs";
|
|
28
|
-
import { supportedPassportLinks as
|
|
29
|
-
import { isExtension as
|
|
28
|
+
import { supportedPassportLinks as q } from "../../constants/kyc.constants.mjs";
|
|
29
|
+
import { isExtension as J } from "../../constants/vite.constants.mjs";
|
|
30
30
|
import "../../constants/reorg-depths.constants.mjs";
|
|
31
31
|
import "../../constants/addresses.constants.mjs";
|
|
32
32
|
import "../../constants/token.limits.constants.mjs";
|
|
@@ -34,21 +34,21 @@ import "../../constants/presale.constants.mjs";
|
|
|
34
34
|
import "../../constants/activity.constants.mjs";
|
|
35
35
|
import "../../constants/tasks.constants.mjs";
|
|
36
36
|
import "../../constants/events.constants.mjs";
|
|
37
|
-
import { reloadPage as
|
|
38
|
-
import { MultiThreadedUtxoUtils as
|
|
39
|
-
import { hinkalPrivateWallet as
|
|
40
|
-
import { createCacheDevice as
|
|
41
|
-
import { getContractWithFetcherByChainId as
|
|
42
|
-
import { getRecipientInfo as
|
|
43
|
-
import { getApprovedBalance as
|
|
44
|
-
import { hinkalSignSubAccount as
|
|
45
|
-
import { hinkalCheckTokenRegistry as
|
|
46
|
-
import { hinkalActionReceive as
|
|
47
|
-
import { privateTokensDB as
|
|
37
|
+
import { reloadPage as Q } from "../../functions/utils/reloadPage.mjs";
|
|
38
|
+
import { MultiThreadedUtxoUtils as V } from "../MultiThreadedUtxoUtils/MultiThreadedUtxoUtils.mjs";
|
|
39
|
+
import { hinkalPrivateWallet as X } from "./hinkalPrivateWallet.mjs";
|
|
40
|
+
import { createCacheDevice as Y } from "../../functions/utils/cacheDevice.utils.mjs";
|
|
41
|
+
import { getContractWithFetcherByChainId as Z } from "../../functions/web3/getContractMetadata.mjs";
|
|
42
|
+
import { getRecipientInfo as G } from "./hinkalGetRecipientInfo.mjs";
|
|
43
|
+
import { getApprovedBalance as ee, getApprovedUtxos as te, getApprovedUtxosForToken as re } from "../../functions/web3/events/getApprovedBalance.mjs";
|
|
44
|
+
import { hinkalSignSubAccount as ie } from "./hinkalSignSubAccount.mjs";
|
|
45
|
+
import { hinkalCheckTokenRegistry as ae } from "./hinkalCheckTokenRegistry.mjs";
|
|
46
|
+
import { hinkalActionReceive as oe } from "./hinkalActionReceive.mjs";
|
|
47
|
+
import { privateTokensDB as ne } from "../TokenDBs/PrivateTokensDB.mjs";
|
|
48
48
|
import "idb-keyval";
|
|
49
|
-
import { getErc20TokensForChain as
|
|
49
|
+
import { getErc20TokensForChain as se } from "../../functions/utils/erc20tokenFunctions.mjs";
|
|
50
50
|
import "multiformats";
|
|
51
|
-
import { PublicKey as
|
|
51
|
+
import { PublicKey as y } from "@solana/web3.js";
|
|
52
52
|
import "@solana/spl-token";
|
|
53
53
|
import { validateAndGetChainId as m } from "../../functions/utils/token-check.utils.mjs";
|
|
54
54
|
import "async-mutex";
|
|
@@ -56,32 +56,39 @@ import "../../functions/utils/convertIntegrationProviderToExternalActionId.mjs";
|
|
|
56
56
|
import "../../types/circom-data.types.mjs";
|
|
57
57
|
import "../../types/transactions.types.mjs";
|
|
58
58
|
import "../../types/activities.types.mjs";
|
|
59
|
-
import { getMerkleAccountPublicKey as
|
|
59
|
+
import { getMerkleAccountPublicKey as he, getAccessTokenMerkleAccountPublicKey as le } from "../../functions/pre-transaction/solana.mjs";
|
|
60
|
+
import "ethers-v6h";
|
|
61
|
+
import "tweetnacl";
|
|
62
|
+
import "bs58";
|
|
60
63
|
import "@coral-xyz/anchor";
|
|
64
|
+
import "buffer";
|
|
61
65
|
import "../../functions/utils/userAgent.mjs";
|
|
62
66
|
import "libsodium-wrappers";
|
|
63
67
|
import "circomlibjs-hinkal-fork";
|
|
64
68
|
import "process";
|
|
65
|
-
import "buffer";
|
|
66
69
|
import "../../providers/EthersProviderAdapter.mjs";
|
|
67
|
-
import "
|
|
70
|
+
import { SolanaProviderAdapter as pe } from "../../providers/SolanaProviderAdapter.mjs";
|
|
71
|
+
import "../../functions/web3/events/getInputUtxoAndBalance.mjs";
|
|
68
72
|
import "../../functions/web3/getTokenHolder.mjs";
|
|
69
|
-
import
|
|
70
|
-
import {
|
|
71
|
-
import {
|
|
72
|
-
import {
|
|
73
|
-
import {
|
|
74
|
-
import {
|
|
75
|
-
import {
|
|
73
|
+
import "node-forge";
|
|
74
|
+
import { createTransaferEmporiumOpsBatch as ce } from "../../functions/private-wallet/emporium.helpers.mjs";
|
|
75
|
+
import { hinkalProoflessDeposit as de } from "./hinkalProoflessDeposit.mjs";
|
|
76
|
+
import { hinkalProxySwap as me } from "./hinkalProxySwap.mjs";
|
|
77
|
+
import { hinkalMultiSendPrivateRecipients as ge } from "./hinkalMultiSend.mjs";
|
|
78
|
+
import { hinkalTransfer as fe } from "./hinkalTransfer.mjs";
|
|
79
|
+
import { hinkalProxyToPrivate as ue } from "./hinkalProxyToPrivate.mjs";
|
|
80
|
+
import { hinkalSolanaDepositAndWithdraw as ve } from "./hinkalSolanaDepositAndWithdraw.mjs";
|
|
76
81
|
import { hinkalSolanaWithdraw as ye } from "./hinkalSolanaWithdraw.mjs";
|
|
77
|
-
import { hinkalSolanaTransfer as
|
|
78
|
-
import { hinkalSolanaSwap as
|
|
79
|
-
import { hinkalSolanaProxySend as
|
|
80
|
-
import { hinkalSolanaProxySwap as
|
|
81
|
-
import { hinkalSolanaProxyShield as
|
|
82
|
-
import { fetchSolanaMerkleTreeRootHash as
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
import { hinkalSolanaTransfer as Pe } from "./hinkalSolanaTransfer.mjs";
|
|
83
|
+
import { hinkalSolanaSwap as ke } from "./hinkalSolanaSwap.mjs";
|
|
84
|
+
import { hinkalSolanaProxySend as Ae } from "./hinkalSolanaProxySend.mjs";
|
|
85
|
+
import { hinkalSolanaProxySwap as we } from "./hinkalSolanaProxySwap.mjs";
|
|
86
|
+
import { hinkalSolanaProxyShield as R } from "./hinkalSolanaProxyShield.mjs";
|
|
87
|
+
import { fetchSolanaMerkleTreeRootHash as E } from "../../functions/web3/fetchSolanaMerkleTreeRootHash.mjs";
|
|
88
|
+
import { hinkalDepositAndBridge as Se } from "./hinkalDepostAndBridge.mjs";
|
|
89
|
+
class or {
|
|
90
|
+
ethereumProviderAdapter;
|
|
91
|
+
solanaProviderAdapter;
|
|
85
92
|
userKeys;
|
|
86
93
|
signingMessage = "Login to Hinkal Protocol";
|
|
87
94
|
privateTransferSigningMessage = "Login to Hinkal's Private Transfer App";
|
|
@@ -99,40 +106,50 @@ class Vt {
|
|
|
99
106
|
generateProofRemotely;
|
|
100
107
|
disableMerkleTreeUpdates;
|
|
101
108
|
constructor(e) {
|
|
102
|
-
this.userKeys = new
|
|
103
|
-
this.merkleTreeHinkalByChain[t] =
|
|
104
|
-
}), this.generateProofRemotely = e?.generateProofRemotely ?? !1, this.utxoUtils = new
|
|
109
|
+
this.userKeys = new P(void 0), k.forEach((t) => {
|
|
110
|
+
this.merkleTreeHinkalByChain[t] = T.create(M, 0n), this.merkleTreeAccessTokenByChain[t] = T.create(M, 0n), this.nullifiersByChain[t] = /* @__PURE__ */ new Set(), this.encryptedOutputsByChain[t] = [], this.approvalsByChain[t] = /* @__PURE__ */ new Map();
|
|
111
|
+
}), this.generateProofRemotely = e?.generateProofRemotely ?? !1, this.utxoUtils = new V(), this.cacheDevice = Y(e), this.disableMerkleTreeUpdates = e?.disableMerkleTreeUpdates ?? !1;
|
|
105
112
|
}
|
|
106
113
|
async initProviderAdapter(e, t) {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
await
|
|
114
|
+
const r = t instanceof pe;
|
|
115
|
+
await this.updateProviderAdapter(r ? u.solanaMainnet : u.ethMainnet, t), r ? this.solanaProviderAdapter?.initConnector(e) : this.ethereumProviderAdapter?.initConnector(e);
|
|
116
|
+
const i = await this.connectAndPatchProvider(r, e);
|
|
117
|
+
await t.init(i), await this.setListeners();
|
|
110
118
|
}
|
|
111
119
|
async initUserKeys(e = !1) {
|
|
112
120
|
const t = e ? this.privateTransferSigningMessage : this.signingMessage;
|
|
113
|
-
this.userKeys = new
|
|
121
|
+
this.userKeys = new P(await this.getProviderAdapter().signMessage(t));
|
|
114
122
|
}
|
|
115
123
|
async initUserKeysWithPassword(e) {
|
|
116
|
-
this.userKeys = new
|
|
124
|
+
this.userKeys = new P(e);
|
|
125
|
+
}
|
|
126
|
+
async initUserKeysFromSeedPhrases(e) {
|
|
127
|
+
const t = e.join(" "), r = B.utils.toUtf8Bytes(t), i = B.utils.keccak256(r);
|
|
128
|
+
this.userKeys = new P(i);
|
|
117
129
|
}
|
|
118
130
|
async resetMerkle(e) {
|
|
119
131
|
if (this.disableMerkleTreeUpdates)
|
|
120
132
|
return;
|
|
121
|
-
(e?.every((r) => this.isSelectedNetworkSupported(r)) ?? !0) && await
|
|
133
|
+
(e?.every((r) => this.isSelectedNetworkSupported(r)) ?? !0) && await j(this, e);
|
|
122
134
|
}
|
|
123
|
-
|
|
124
|
-
|
|
135
|
+
// If chainId is not provided, use the ethereum provider, if it is initialized. In other case, use the solana provider.
|
|
136
|
+
getProviderAdapter(e) {
|
|
137
|
+
const t = e ?? (this.ethereumProviderAdapter ? u.ethMainnet : u.solanaMainnet), r = l(t) ? this.solanaProviderAdapter : this.ethereumProviderAdapter;
|
|
138
|
+
if (!r)
|
|
125
139
|
throw new Error("ProviderAdapter is not initialized");
|
|
126
|
-
return
|
|
140
|
+
return r;
|
|
141
|
+
}
|
|
142
|
+
getSupportedChains() {
|
|
143
|
+
return this.ethereumProviderAdapter && this.solanaProviderAdapter ? k : this.ethereumProviderAdapter ? k.filter((e) => !l(e)) : this.solanaProviderAdapter ? k.filter((e) => l(e)) : [];
|
|
127
144
|
}
|
|
128
145
|
async waitForTransaction(e, t, r = 1) {
|
|
129
|
-
return !!await this.
|
|
146
|
+
return !!await this.getProviderAdapter(e).waitForTransaction(e, t, r);
|
|
130
147
|
}
|
|
131
148
|
getContract(e, t, r = void 0) {
|
|
132
|
-
return this.getProviderAdapter().getContract(e, t, r);
|
|
149
|
+
return this.getProviderAdapter(e).getContract(e, t, r);
|
|
133
150
|
}
|
|
134
151
|
getContractWithFetcherByChainId(e, t, r = void 0) {
|
|
135
|
-
return
|
|
152
|
+
return Z(e, t, r);
|
|
136
153
|
}
|
|
137
154
|
async signMessage(e) {
|
|
138
155
|
return await this.getProviderAdapter().signMessage(e);
|
|
@@ -141,42 +158,51 @@ class Vt {
|
|
|
141
158
|
return await this.getProviderAdapter().signTypedData(e, t, r);
|
|
142
159
|
}
|
|
143
160
|
async signWithSubAccount(e, t, r, i) {
|
|
144
|
-
return
|
|
161
|
+
return ie(e, t, r, i);
|
|
145
162
|
}
|
|
146
163
|
getContractWithSigner(e, t, r = "") {
|
|
147
|
-
return this.getProviderAdapter().getContractWithSigner(e, t, r);
|
|
164
|
+
return this.getProviderAdapter(e).getContractWithSigner(e, t, r);
|
|
148
165
|
}
|
|
149
166
|
getContractWithFetcher(e, t, r = "") {
|
|
150
|
-
return this.getProviderAdapter().getContractWithFetcher(e, t, r);
|
|
167
|
+
return this.getProviderAdapter(e).getContractWithFetcher(e, t, r);
|
|
151
168
|
}
|
|
152
169
|
isSelectedNetworkSupported(e) {
|
|
153
|
-
return !!
|
|
170
|
+
return !!A[e];
|
|
154
171
|
}
|
|
155
172
|
async switchNetwork(e) {
|
|
156
173
|
try {
|
|
157
174
|
await this.getProviderAdapter().switchNetwork(e);
|
|
158
175
|
} catch {
|
|
159
|
-
throw new Error(
|
|
176
|
+
throw new Error($.FAILED_TO_SWITCH_NETWORKS);
|
|
160
177
|
}
|
|
161
178
|
}
|
|
162
|
-
isPermitterAvailable() {
|
|
163
|
-
return this.getProviderAdapter().isPermitterAvailable();
|
|
179
|
+
isPermitterAvailable(e) {
|
|
180
|
+
return this.getProviderAdapter(e).isPermitterAvailable();
|
|
164
181
|
}
|
|
165
|
-
async connectAndPatchProvider(e) {
|
|
166
|
-
return await this.getProviderAdapter(
|
|
182
|
+
async connectAndPatchProvider(e, t) {
|
|
183
|
+
return await this.getProviderAdapter(
|
|
184
|
+
e ? u.solanaMainnet : u.ethMainnet
|
|
185
|
+
).connectAndPatchProvider(t);
|
|
167
186
|
}
|
|
168
187
|
async disconnectFromConnector() {
|
|
169
|
-
await this.
|
|
188
|
+
await this.ethereumProviderAdapter?.disconnectFromConnector(), await this.solanaProviderAdapter?.disconnectFromConnector();
|
|
170
189
|
}
|
|
171
|
-
async updateProviderAdapter(e) {
|
|
190
|
+
async updateProviderAdapter(e, t) {
|
|
172
191
|
try {
|
|
173
|
-
this.
|
|
174
|
-
} catch (
|
|
175
|
-
throw console.error(
|
|
192
|
+
l(e) ? (this.solanaProviderAdapter && this.solanaProviderAdapter.release(), this.solanaProviderAdapter = t) : (this.ethereumProviderAdapter && this.ethereumProviderAdapter.release(), this.ethereumProviderAdapter = t);
|
|
193
|
+
} catch (r) {
|
|
194
|
+
throw console.error(r), Error("updateProviderAdapter failed, please try again.");
|
|
176
195
|
}
|
|
177
196
|
}
|
|
178
197
|
async setListeners() {
|
|
179
|
-
this.
|
|
198
|
+
this.ethereumProviderAdapter?.setChainEventListener({
|
|
199
|
+
onAccountChanged: () => {
|
|
200
|
+
this.onAccountChanged();
|
|
201
|
+
},
|
|
202
|
+
onChainChanged: (e) => {
|
|
203
|
+
this.onChainChanged(e);
|
|
204
|
+
}
|
|
205
|
+
}), this.solanaProviderAdapter?.setChainEventListener({
|
|
180
206
|
onAccountChanged: () => {
|
|
181
207
|
this.onAccountChanged();
|
|
182
208
|
},
|
|
@@ -186,18 +212,18 @@ class Vt {
|
|
|
186
212
|
});
|
|
187
213
|
}
|
|
188
214
|
async onAccountChanged() {
|
|
189
|
-
await this.
|
|
190
|
-
const e =
|
|
215
|
+
await this.ethereumProviderAdapter?.onAccountChanged(), await this.solanaProviderAdapter?.onAccountChanged();
|
|
216
|
+
const e = D.AccountChanged;
|
|
191
217
|
typeof document < "u" ? document?.dispatchEvent(new Event(e)) : process?.emit("message", e, void 0);
|
|
192
218
|
}
|
|
193
219
|
async onChainChanged(e) {
|
|
194
|
-
e ? await this.getProviderAdapter().onChainChanged(e) : (await this.disconnectFromConnector(),
|
|
220
|
+
e ? await this.getProviderAdapter(e).onChainChanged(e) : (await this.disconnectFromConnector(), Q());
|
|
195
221
|
}
|
|
196
|
-
async monitorConnectedAddress() {
|
|
197
|
-
await
|
|
222
|
+
async monitorConnectedAddress(e) {
|
|
223
|
+
await S.monitor(await this.getEthereumAddressByChain(e));
|
|
198
224
|
}
|
|
199
225
|
async getBalances(e, t, r, i, a = !1, o, n = !1) {
|
|
200
|
-
return
|
|
226
|
+
return U(
|
|
201
227
|
this,
|
|
202
228
|
e,
|
|
203
229
|
t,
|
|
@@ -210,10 +236,10 @@ class Vt {
|
|
|
210
236
|
);
|
|
211
237
|
}
|
|
212
238
|
async getApprovedBalances(e, t = !1, r = !1) {
|
|
213
|
-
return
|
|
239
|
+
return ee(this, e, t, r);
|
|
214
240
|
}
|
|
215
241
|
async getTotalBalance(e, t, r, i = !1, a, o = !1) {
|
|
216
|
-
const n = r ?? await this.
|
|
242
|
+
const n = r ?? await this.getEthereumAddressByChain(e), s = t ?? this.userKeys, h = await this.getBalances(
|
|
217
243
|
e,
|
|
218
244
|
s.getShieldedPrivateKey(),
|
|
219
245
|
s.getShieldedPublicKey(),
|
|
@@ -221,49 +247,49 @@ class Vt {
|
|
|
221
247
|
i,
|
|
222
248
|
a,
|
|
223
249
|
o
|
|
224
|
-
),
|
|
225
|
-
return g.forEach((
|
|
226
|
-
const
|
|
227
|
-
token:
|
|
228
|
-
balance: (
|
|
229
|
-
timestamp:
|
|
230
|
-
nfts:
|
|
250
|
+
), p = !l(e) && !o ? await this.getApprovedBalances(e, i, a) : /* @__PURE__ */ new Map(), g = J ? await ne.getPrivateTokens(e, n) : se(e), d = [];
|
|
251
|
+
return g.forEach((c) => {
|
|
252
|
+
const f = c.erc20TokenAddress.toLowerCase(), v = h.get(f), C = p.get(f), H = {
|
|
253
|
+
token: c,
|
|
254
|
+
balance: (v?.balance ?? 0n) + (C?.balance ?? 0n),
|
|
255
|
+
timestamp: v?.timestamp || C?.timestamp || "0",
|
|
256
|
+
nfts: v?.nfts || []
|
|
231
257
|
};
|
|
232
|
-
d.push(
|
|
258
|
+
d.push(H);
|
|
233
259
|
}), d;
|
|
234
260
|
}
|
|
235
261
|
async getStuckShieldedBalances(e, t) {
|
|
236
262
|
return (await this.getTotalBalance(e, void 0, t, !1, !1, !0)).filter((i) => i.balance > 0n);
|
|
237
263
|
}
|
|
238
264
|
getSupportedPassportLinks() {
|
|
239
|
-
return
|
|
265
|
+
return q;
|
|
240
266
|
}
|
|
241
267
|
checkAccessToken(e) {
|
|
242
|
-
return
|
|
268
|
+
return b(this, e);
|
|
243
269
|
}
|
|
244
270
|
async getHinkalTreeRootHash(e) {
|
|
245
|
-
if (
|
|
246
|
-
const { hinkalIdl: r, hinkalAddress: i, originalDeployer: a } =
|
|
271
|
+
if (l(e)) {
|
|
272
|
+
const { hinkalIdl: r, hinkalAddress: i, originalDeployer: a } = A[e].contractData;
|
|
247
273
|
if (!r || !i || !a)
|
|
248
274
|
throw new Error(`Missing Solana configuration for chain ${e}`);
|
|
249
|
-
const o = new
|
|
250
|
-
return
|
|
275
|
+
const o = new y(a), n = new y(i), s = he(n, o), h = this.getSolanaProgram(r);
|
|
276
|
+
return E(h, s);
|
|
251
277
|
}
|
|
252
278
|
return this.getContractWithFetcherByChainId(e, w.HinkalContract).getRootHash();
|
|
253
279
|
}
|
|
254
280
|
async getAccessTokenTreeRootHash(e) {
|
|
255
|
-
if (
|
|
256
|
-
const { hinkalIdl: r, hinkalAddress: i, originalDeployer: a } =
|
|
281
|
+
if (l(e)) {
|
|
282
|
+
const { hinkalIdl: r, hinkalAddress: i, originalDeployer: a } = A[e].contractData;
|
|
257
283
|
if (!r || !i || !a)
|
|
258
284
|
throw new Error(`Missing Solana configuration for chain ${e}`);
|
|
259
|
-
const o = new
|
|
260
|
-
return
|
|
285
|
+
const o = new y(a), n = new y(i), s = le(n, o), h = this.getSolanaProgram(r);
|
|
286
|
+
return E(h, s);
|
|
261
287
|
}
|
|
262
288
|
return this.getContractWithFetcherByChainId(e, w.AccessTokenContract).getRootHash();
|
|
263
289
|
}
|
|
264
290
|
async resetMerkleTreesIfNecessary() {
|
|
265
291
|
const t = (await Promise.all(
|
|
266
|
-
|
|
292
|
+
this.getSupportedChains().map(async (r) => {
|
|
267
293
|
const [i, a] = await Promise.all([
|
|
268
294
|
this.getHinkalTreeRootHash(r),
|
|
269
295
|
this.getAccessTokenTreeRootHash(r)
|
|
@@ -274,7 +300,7 @@ class Vt {
|
|
|
274
300
|
t.length > 0 && (console.log("resetting merkle tree in resetMerkleTreesIfNecessary for chains:", t), await this.resetMerkle(t));
|
|
275
301
|
}
|
|
276
302
|
async getEventsFromHinkal() {
|
|
277
|
-
const e =
|
|
303
|
+
const e = this.getSupportedChains().flatMap((t) => [
|
|
278
304
|
this.accessTokenSnapshotServiceByChain[t]?.retrieveEventsFromLatestBlock(),
|
|
279
305
|
this.commitmentsSnapshotServiceByChain[t]?.retrieveEventsFromLatestBlock(),
|
|
280
306
|
this.nullifierSnapshotServiceByChain[t]?.retrieveEventsFromLatestBlock(),
|
|
@@ -282,65 +308,72 @@ class Vt {
|
|
|
282
308
|
]);
|
|
283
309
|
await Promise.all(e);
|
|
284
310
|
}
|
|
285
|
-
getEthereumAddress() {
|
|
286
|
-
|
|
311
|
+
async getEthereumAddress() {
|
|
312
|
+
const e = this.ethereumProviderAdapter ?? this.solanaProviderAdapter;
|
|
313
|
+
if (!e)
|
|
314
|
+
throw new Error("No provider adapter initialized");
|
|
315
|
+
return e.getAddress();
|
|
316
|
+
}
|
|
317
|
+
getEthereumAddressByChain(e) {
|
|
318
|
+
return this.getProviderAdapter(e).getAddress();
|
|
287
319
|
}
|
|
288
320
|
async getRandomRelay(e, t = !1) {
|
|
289
|
-
return (await
|
|
321
|
+
return (await S.getIdleRelay(e, t)).relay;
|
|
290
322
|
}
|
|
291
323
|
getGasPrice(e) {
|
|
292
|
-
|
|
324
|
+
const t = this.getProviderAdapter(e);
|
|
325
|
+
if (!t)
|
|
293
326
|
throw new Error("Illegal State of providerAdapter in Hinkal: no providerAdapter initialized");
|
|
294
|
-
return
|
|
327
|
+
return t.getGasPrice(e);
|
|
295
328
|
}
|
|
296
329
|
getAPI() {
|
|
297
|
-
return
|
|
330
|
+
return S;
|
|
298
331
|
}
|
|
299
332
|
snapshotsClearInterval() {
|
|
300
|
-
|
|
333
|
+
this.getSupportedChains().forEach((e) => {
|
|
301
334
|
this.commitmentsSnapshotServiceByChain[e]?.intervalClear(), this.accessTokenSnapshotServiceByChain[e]?.intervalClear(), this.nullifierSnapshotServiceByChain[e]?.intervalClear(), this.approvalsSnapshotServiceByChain[e]?.intervalClear();
|
|
302
335
|
});
|
|
303
336
|
}
|
|
304
337
|
checkTokenRegistry(e, t, r) {
|
|
305
|
-
if (
|
|
338
|
+
if (l(e)) {
|
|
306
339
|
const {
|
|
307
340
|
hinkalIdl: a,
|
|
308
341
|
hinkalAddress: o,
|
|
309
342
|
originalDeployer: n
|
|
310
|
-
} =
|
|
343
|
+
} = A[e].contractData;
|
|
311
344
|
if (!a || !o || !n)
|
|
312
345
|
throw new Error("missing solana data");
|
|
313
|
-
const s = this.getSolanaProgram(a),
|
|
314
|
-
return
|
|
346
|
+
const s = this.getSolanaProgram(a), h = new y(n);
|
|
347
|
+
return F(s, h, t, r);
|
|
315
348
|
}
|
|
316
349
|
const i = this.getContractWithFetcher(e, w.HinkalHelperContract);
|
|
317
|
-
return
|
|
350
|
+
return ae(i, t, r);
|
|
318
351
|
}
|
|
319
352
|
getRecipientInfo() {
|
|
320
|
-
return
|
|
353
|
+
return G(this);
|
|
321
354
|
}
|
|
322
355
|
getApprovedUtxos(e, t = !1) {
|
|
323
|
-
return
|
|
356
|
+
return te(this, e, t);
|
|
324
357
|
}
|
|
325
358
|
getApprovedUtxosForToken(e, t, r = !1) {
|
|
326
|
-
return
|
|
359
|
+
return re(this, e, t, r);
|
|
327
360
|
}
|
|
328
361
|
async deposit(e, t) {
|
|
329
|
-
return
|
|
362
|
+
return W(this, e, t);
|
|
330
363
|
}
|
|
331
364
|
async depositForOther(e, t, r) {
|
|
332
|
-
return
|
|
365
|
+
return K(this, e, t, r);
|
|
333
366
|
}
|
|
334
367
|
async depositAndWithdraw(e, t, r, i, a) {
|
|
335
368
|
const o = m([e]);
|
|
336
|
-
return
|
|
369
|
+
return l(o) ? ve(
|
|
337
370
|
this,
|
|
338
371
|
e,
|
|
339
372
|
t,
|
|
340
373
|
r,
|
|
341
374
|
i,
|
|
342
375
|
a
|
|
343
|
-
) :
|
|
376
|
+
) : x(
|
|
344
377
|
this,
|
|
345
378
|
e,
|
|
346
379
|
t,
|
|
@@ -349,35 +382,38 @@ class Vt {
|
|
|
349
382
|
a
|
|
350
383
|
);
|
|
351
384
|
}
|
|
385
|
+
async depositAndBridge(e, t, r, i) {
|
|
386
|
+
return Se(this, e, t, r, i);
|
|
387
|
+
}
|
|
352
388
|
async prooflessDeposit(e, t, r) {
|
|
353
|
-
return
|
|
389
|
+
return de(this, e, t, r);
|
|
354
390
|
}
|
|
355
391
|
getSolanaProgram(e) {
|
|
356
|
-
if (!this.
|
|
392
|
+
if (!this.solanaProviderAdapter)
|
|
357
393
|
throw new Error("No provider adapter initialized");
|
|
358
|
-
if (!("getSolanaProgram" in this.
|
|
394
|
+
if (!("getSolanaProgram" in this.solanaProviderAdapter))
|
|
359
395
|
throw new Error("Current provider adapter is not a Solana provider adapter");
|
|
360
|
-
return this.
|
|
396
|
+
return this.solanaProviderAdapter.getSolanaProgram(e);
|
|
361
397
|
}
|
|
362
398
|
getSolanaPublicKey() {
|
|
363
|
-
if (!this.
|
|
399
|
+
if (!this.solanaProviderAdapter)
|
|
364
400
|
throw new Error("No provider adapter initialized");
|
|
365
|
-
if (!("getSolanaPublicKey" in this.
|
|
401
|
+
if (!("getSolanaPublicKey" in this.solanaProviderAdapter))
|
|
366
402
|
throw new Error("Current provider adapter is not a Solana provider adapter");
|
|
367
|
-
return this.
|
|
403
|
+
return this.solanaProviderAdapter.getSolanaPublicKey();
|
|
368
404
|
}
|
|
369
405
|
async depositSolana(e, t) {
|
|
370
|
-
return
|
|
406
|
+
return L(this, e, t);
|
|
371
407
|
}
|
|
372
408
|
async depositSolanaForOther(e, t, r) {
|
|
373
|
-
return
|
|
409
|
+
return N(this, e, t, r);
|
|
374
410
|
}
|
|
375
411
|
async solanaMultiPaymentDeposit(e, t) {
|
|
376
|
-
return
|
|
412
|
+
return O(this, e, t);
|
|
377
413
|
}
|
|
378
414
|
async transfer(e, t, r, i, a, o, n = !1) {
|
|
379
415
|
const s = m(e);
|
|
380
|
-
return
|
|
416
|
+
return l(s) ? Pe(
|
|
381
417
|
this,
|
|
382
418
|
e,
|
|
383
419
|
t,
|
|
@@ -385,7 +421,7 @@ class Vt {
|
|
|
385
421
|
i,
|
|
386
422
|
a,
|
|
387
423
|
n
|
|
388
|
-
) :
|
|
424
|
+
) : fe(
|
|
389
425
|
this,
|
|
390
426
|
e,
|
|
391
427
|
t,
|
|
@@ -397,8 +433,8 @@ class Vt {
|
|
|
397
433
|
);
|
|
398
434
|
}
|
|
399
435
|
async withdraw(e, t, r, i, a, o, n, s = !1) {
|
|
400
|
-
const
|
|
401
|
-
return h
|
|
436
|
+
const h = m(e);
|
|
437
|
+
return l(h) ? ye(
|
|
402
438
|
this,
|
|
403
439
|
e,
|
|
404
440
|
t,
|
|
@@ -406,7 +442,7 @@ class Vt {
|
|
|
406
442
|
a,
|
|
407
443
|
o,
|
|
408
444
|
s
|
|
409
|
-
) :
|
|
445
|
+
) : _(
|
|
410
446
|
this,
|
|
411
447
|
e,
|
|
412
448
|
t,
|
|
@@ -419,11 +455,11 @@ class Vt {
|
|
|
419
455
|
);
|
|
420
456
|
}
|
|
421
457
|
async withdrawStuckUtxos(e, t) {
|
|
422
|
-
return
|
|
458
|
+
return I(this, e, t);
|
|
423
459
|
}
|
|
424
|
-
async swap(e, t, r, i, a, o, n, s = !1,
|
|
425
|
-
const
|
|
426
|
-
return
|
|
460
|
+
async swap(e, t, r, i, a, o, n, s = !1, h = !1) {
|
|
461
|
+
const p = m(e);
|
|
462
|
+
return l(p) ? this.swapSolana(e, t, i, a, o, s) : z(
|
|
427
463
|
this,
|
|
428
464
|
e,
|
|
429
465
|
t,
|
|
@@ -433,18 +469,18 @@ class Vt {
|
|
|
433
469
|
o,
|
|
434
470
|
n,
|
|
435
471
|
s,
|
|
436
|
-
|
|
472
|
+
h
|
|
437
473
|
);
|
|
438
474
|
}
|
|
439
475
|
async swapSolana(e, t, r, i, a, o = !1) {
|
|
440
|
-
const n = JSON.parse(r), s = BigInt(n.swapperAccountSalt), { instructionLists:
|
|
441
|
-
return
|
|
476
|
+
const n = JSON.parse(r), s = BigInt(n.swapperAccountSalt), { instructionLists: h, addressLookupTableAccount: p } = n.data;
|
|
477
|
+
return ke(
|
|
442
478
|
this,
|
|
443
479
|
e,
|
|
444
480
|
t,
|
|
445
481
|
s,
|
|
482
|
+
h,
|
|
446
483
|
p,
|
|
447
|
-
c,
|
|
448
484
|
i,
|
|
449
485
|
a,
|
|
450
486
|
o
|
|
@@ -454,7 +490,7 @@ class Vt {
|
|
|
454
490
|
if (!a)
|
|
455
491
|
throw new Error("subAccount is required");
|
|
456
492
|
const s = m(e);
|
|
457
|
-
return
|
|
493
|
+
return l(s) ? R(this, e[0], t[0], a, void 0, n) : oe(
|
|
458
494
|
this,
|
|
459
495
|
e,
|
|
460
496
|
t,
|
|
@@ -465,8 +501,8 @@ class Vt {
|
|
|
465
501
|
n
|
|
466
502
|
);
|
|
467
503
|
}
|
|
468
|
-
async actionPrivateWallet(e, t, r, i, a, o, n, s,
|
|
469
|
-
return
|
|
504
|
+
async actionPrivateWallet(e, t, r, i, a, o, n, s, h, p, g = !1, d, c, f, v = !1) {
|
|
505
|
+
return X(
|
|
470
506
|
this,
|
|
471
507
|
e,
|
|
472
508
|
t,
|
|
@@ -476,18 +512,18 @@ class Vt {
|
|
|
476
512
|
o,
|
|
477
513
|
n,
|
|
478
514
|
s,
|
|
515
|
+
h,
|
|
479
516
|
p,
|
|
480
|
-
c,
|
|
481
517
|
g,
|
|
482
518
|
d,
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
519
|
+
c,
|
|
520
|
+
f,
|
|
521
|
+
v
|
|
486
522
|
);
|
|
487
523
|
}
|
|
488
|
-
async proxySwap(e, t, r, i, a, o, n, s,
|
|
489
|
-
const
|
|
490
|
-
return
|
|
524
|
+
async proxySwap(e, t, r, i, a, o, n, s, h = !1, p, g, d = !1) {
|
|
525
|
+
const c = m(e);
|
|
526
|
+
return l(c) ? we(
|
|
491
527
|
this,
|
|
492
528
|
e,
|
|
493
529
|
t,
|
|
@@ -496,7 +532,7 @@ class Vt {
|
|
|
496
532
|
n,
|
|
497
533
|
s,
|
|
498
534
|
d
|
|
499
|
-
) :
|
|
535
|
+
) : me(
|
|
500
536
|
this,
|
|
501
537
|
e,
|
|
502
538
|
t,
|
|
@@ -506,22 +542,22 @@ class Vt {
|
|
|
506
542
|
o,
|
|
507
543
|
n,
|
|
508
544
|
s,
|
|
545
|
+
h,
|
|
509
546
|
p,
|
|
510
|
-
c,
|
|
511
547
|
g,
|
|
512
548
|
d
|
|
513
549
|
);
|
|
514
550
|
}
|
|
515
551
|
async proxyToPrivate(e, t, r, i, a, o, n, s = !1) {
|
|
516
|
-
const
|
|
517
|
-
return h
|
|
552
|
+
const h = m(e);
|
|
553
|
+
return l(h) ? R(
|
|
518
554
|
this,
|
|
519
555
|
e[0],
|
|
520
556
|
t[0],
|
|
521
557
|
r,
|
|
522
558
|
i,
|
|
523
559
|
s
|
|
524
|
-
) :
|
|
560
|
+
) : ue(
|
|
525
561
|
this,
|
|
526
562
|
e,
|
|
527
563
|
t,
|
|
@@ -534,25 +570,25 @@ class Vt {
|
|
|
534
570
|
);
|
|
535
571
|
}
|
|
536
572
|
async proxySend(e, t, r, i, a, o, n, s = !1) {
|
|
537
|
-
const
|
|
538
|
-
if (h
|
|
539
|
-
return
|
|
540
|
-
const
|
|
573
|
+
const h = m(e);
|
|
574
|
+
if (l(h))
|
|
575
|
+
return Ae(e[0], t[0], r, i, s);
|
|
576
|
+
const p = ce(
|
|
541
577
|
this,
|
|
542
|
-
|
|
543
|
-
e.map((
|
|
578
|
+
h,
|
|
579
|
+
e.map((c) => c.erc20TokenAddress),
|
|
544
580
|
t,
|
|
545
581
|
i
|
|
546
|
-
), g = e.map((
|
|
547
|
-
token:
|
|
548
|
-
amount: -1n * t[
|
|
582
|
+
), g = e.map((c, f) => ({
|
|
583
|
+
token: c,
|
|
584
|
+
amount: -1n * t[f]
|
|
549
585
|
}));
|
|
550
586
|
return await this.actionPrivateWallet(
|
|
551
|
-
|
|
587
|
+
h,
|
|
552
588
|
[],
|
|
553
589
|
[],
|
|
554
590
|
[],
|
|
555
|
-
|
|
591
|
+
p,
|
|
556
592
|
g,
|
|
557
593
|
r,
|
|
558
594
|
a,
|
|
@@ -566,7 +602,7 @@ class Vt {
|
|
|
566
602
|
);
|
|
567
603
|
}
|
|
568
604
|
async multiSendPrivateRecipients(e, t, r) {
|
|
569
|
-
return
|
|
605
|
+
return ge(this, e, t, r);
|
|
570
606
|
}
|
|
571
607
|
areMerkleTreeUpdatesDisabled() {
|
|
572
608
|
return this.disableMerkleTreeUpdates;
|
|
@@ -576,5 +612,5 @@ class Vt {
|
|
|
576
612
|
}
|
|
577
613
|
}
|
|
578
614
|
export {
|
|
579
|
-
|
|
615
|
+
or as Hinkal
|
|
580
616
|
};
|