@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,8 +1,9 @@
|
|
|
1
|
-
import { BorshCoder as
|
|
2
|
-
import { getSequence as
|
|
1
|
+
import { BorshCoder as d, EventParser as m } from "@coral-xyz/anchor";
|
|
2
|
+
import { getSequence as v, resolveSync as p } from "../../../functions/utils/resolve-sync.utils.mjs";
|
|
3
3
|
import { Logger as l } from "../../../error-handling/logger.mjs";
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
import { BlockchainEvent as S } from "../../BlockchainEvent/BlockchainEvent.mjs";
|
|
5
|
+
const g = 1e3;
|
|
6
|
+
class _ {
|
|
6
7
|
_chainId;
|
|
7
8
|
connection;
|
|
8
9
|
programId;
|
|
@@ -13,13 +14,12 @@ class w {
|
|
|
13
14
|
maxPageSize;
|
|
14
15
|
isReady = !1;
|
|
15
16
|
isServer;
|
|
16
|
-
intervalId;
|
|
17
17
|
inProgress;
|
|
18
18
|
// to remove race conditions
|
|
19
19
|
anchorParser;
|
|
20
20
|
eventsFetchingMutex;
|
|
21
|
-
constructor(t,
|
|
22
|
-
this._chainId = t, this.connection =
|
|
21
|
+
constructor(t, s, a, e, r, c, o) {
|
|
22
|
+
this._chainId = t, this.connection = s, this.programId = a, this._initialSlot = e, this.maxPageSize = o, this.isServer = r, this.inProgress = !1, this.eventsFetchingMutex = c;
|
|
23
23
|
}
|
|
24
24
|
get chainId() {
|
|
25
25
|
return this._chainId;
|
|
@@ -29,24 +29,22 @@ class w {
|
|
|
29
29
|
}
|
|
30
30
|
setIdl(t) {
|
|
31
31
|
try {
|
|
32
|
-
const
|
|
33
|
-
this.anchorParser = new m(this.programId,
|
|
34
|
-
} catch (
|
|
35
|
-
l.error("Failed to initialize Anchor EventParser:",
|
|
32
|
+
const s = new d(t);
|
|
33
|
+
this.anchorParser = new m(this.programId, s);
|
|
34
|
+
} catch (s) {
|
|
35
|
+
l.error("Failed to initialize Anchor EventParser:", s), this.anchorParser = void 0;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
syncFromAtMost(t) {
|
|
39
39
|
(this._latestSlot === void 0 || t < this._latestSlot) && (this._latestSlot = t);
|
|
40
40
|
}
|
|
41
41
|
intervalClear() {
|
|
42
|
-
this.isReady = !1, this.eventProcessors = /* @__PURE__ */ new Set(),
|
|
42
|
+
this.isReady = !1, this.eventProcessors = /* @__PURE__ */ new Set(), this.clear();
|
|
43
43
|
}
|
|
44
44
|
async init() {
|
|
45
45
|
if (this.isReady)
|
|
46
46
|
throw new Error("Already initialized");
|
|
47
|
-
this.isReady = !0, await this.retrieveEvents(this.latestBlockNumber + 1), this.
|
|
48
|
-
await this.retrieveEvents(this.latestBlockNumber);
|
|
49
|
-
}, 3500);
|
|
47
|
+
this.isReady = !0, await this.retrieveEvents(this.latestBlockNumber + 1), await this.startUpdateListener();
|
|
50
48
|
}
|
|
51
49
|
requireReady() {
|
|
52
50
|
if (!this.isReady)
|
|
@@ -62,90 +60,93 @@ class w {
|
|
|
62
60
|
return this.isServer ? Math.max(this.latestBlockNumber, t - 32 + 1) : t;
|
|
63
61
|
}
|
|
64
62
|
// Implementation for IBlockchainEventEmitter interface (blockNumber terminology)
|
|
65
|
-
async retrieveEvents(t,
|
|
66
|
-
const
|
|
63
|
+
async retrieveEvents(t, s = !1) {
|
|
64
|
+
const a = t;
|
|
67
65
|
return this.requireReady(), await this.eventsFetchingMutex.runExclusive(async () => {
|
|
68
66
|
try {
|
|
69
|
-
if (this.inProgress && !
|
|
67
|
+
if (this.inProgress && !s)
|
|
70
68
|
return !1;
|
|
71
69
|
this.inProgress = !0;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
if (o < n)
|
|
70
|
+
const r = await this.getLastSlotForEventRequest();
|
|
71
|
+
if (r < a)
|
|
75
72
|
return this.inProgress = !1, !1;
|
|
76
|
-
const c =
|
|
77
|
-
await
|
|
78
|
-
c.map(({ from:
|
|
79
|
-
const
|
|
80
|
-
|
|
73
|
+
const c = v(a, r, this.maxPageSize), o = [];
|
|
74
|
+
await p(
|
|
75
|
+
c.map(({ from: i, to: n }) => async () => {
|
|
76
|
+
const u = await this.getProgramEvents(i, n);
|
|
77
|
+
o.push(...u);
|
|
81
78
|
})
|
|
82
79
|
);
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
return
|
|
87
|
-
} catch (i) {
|
|
88
|
-
return l.error("retrieveEvents error:", i), this.inProgress = !1, !1;
|
|
80
|
+
const h = o.map((i) => S.fromSolanaEvent(i));
|
|
81
|
+
return await this.processEvents(h), this._latestSlot = r, this.inProgress = !1, !0;
|
|
82
|
+
} catch (r) {
|
|
83
|
+
return l.error("retrieveEvents error:", r), this.inProgress = !1, !1;
|
|
89
84
|
}
|
|
90
85
|
});
|
|
91
86
|
}
|
|
92
|
-
async getProgramEvents(t,
|
|
93
|
-
const
|
|
87
|
+
async getProgramEvents(t, s) {
|
|
88
|
+
const a = [];
|
|
94
89
|
try {
|
|
95
|
-
const
|
|
96
|
-
limit:
|
|
90
|
+
const e = await this.connection.getSignaturesForAddress(this.programId, {
|
|
91
|
+
limit: g,
|
|
97
92
|
before: void 0
|
|
98
93
|
// Start from the latest
|
|
99
94
|
});
|
|
100
|
-
let
|
|
101
|
-
for (;
|
|
102
|
-
const
|
|
103
|
-
limit:
|
|
104
|
-
before:
|
|
95
|
+
let r = e.length;
|
|
96
|
+
for (; r >= g; ) {
|
|
97
|
+
const i = e[e.length - 1], n = await this.connection.getSignaturesForAddress(this.programId, {
|
|
98
|
+
limit: g,
|
|
99
|
+
before: i.signature
|
|
105
100
|
});
|
|
106
|
-
if (
|
|
101
|
+
if (n.length === 0)
|
|
107
102
|
break;
|
|
108
|
-
|
|
103
|
+
e.push(...n), r = n.length;
|
|
109
104
|
}
|
|
110
|
-
const
|
|
105
|
+
const o = e.filter((i) => i.slot >= t && i.slot <= s).map(async (i) => {
|
|
111
106
|
try {
|
|
112
|
-
const
|
|
107
|
+
const n = await this.connection.getTransaction(i.signature, {
|
|
113
108
|
commitment: "confirmed",
|
|
114
109
|
maxSupportedTransactionVersion: 0
|
|
115
110
|
});
|
|
116
|
-
return
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
111
|
+
return n && n.meta && n.meta.logMessages ? this.parseLogsForEvents(
|
|
112
|
+
n.meta.logMessages,
|
|
113
|
+
i.signature,
|
|
114
|
+
i.slot,
|
|
115
|
+
n.blockTime || null
|
|
121
116
|
) : [];
|
|
122
|
-
} catch (
|
|
123
|
-
return l.error(`Failed to get transaction ${
|
|
117
|
+
} catch (n) {
|
|
118
|
+
return l.error(`Failed to get transaction ${i.signature}:`, n), [];
|
|
124
119
|
}
|
|
125
|
-
}), h = await Promise.all(
|
|
126
|
-
|
|
127
|
-
} catch (
|
|
128
|
-
l.error("Error getting program events:",
|
|
120
|
+
}), h = await Promise.all(o);
|
|
121
|
+
a.push(...h.flat());
|
|
122
|
+
} catch (e) {
|
|
123
|
+
l.error("Error getting program events:", e);
|
|
129
124
|
}
|
|
130
|
-
return
|
|
125
|
+
return a;
|
|
131
126
|
}
|
|
132
|
-
parseLogsForEvents(t,
|
|
127
|
+
parseLogsForEvents(t, s, a, e) {
|
|
133
128
|
if (!this.anchorParser)
|
|
134
129
|
return [];
|
|
135
130
|
try {
|
|
136
|
-
return Array.from(this.anchorParser.parseLogs(t)).map(({ name:
|
|
137
|
-
signature:
|
|
138
|
-
slot:
|
|
139
|
-
blockTime:
|
|
131
|
+
return Array.from(this.anchorParser.parseLogs(t)).map(({ name: c, data: o }) => ({
|
|
132
|
+
signature: s,
|
|
133
|
+
slot: a,
|
|
134
|
+
blockTime: e || 0,
|
|
140
135
|
programId: this.programId,
|
|
141
|
-
data:
|
|
142
|
-
eventName:
|
|
136
|
+
data: o,
|
|
137
|
+
eventName: c
|
|
143
138
|
}));
|
|
144
|
-
} catch (
|
|
145
|
-
return l.error("Anchor EventParser failed; falling back to generic parsing:",
|
|
139
|
+
} catch (r) {
|
|
140
|
+
return l.error("Anchor EventParser failed; falling back to generic parsing:", r), [];
|
|
146
141
|
}
|
|
147
142
|
}
|
|
143
|
+
async processEvents(t) {
|
|
144
|
+
const a = (await Promise.all(
|
|
145
|
+
[...this.eventProcessors].map((e) => e(t))
|
|
146
|
+
)).reduce((e, r) => e + r, 0);
|
|
147
|
+
this.onEventsProcessed?.(a);
|
|
148
|
+
}
|
|
148
149
|
}
|
|
149
150
|
export {
|
|
150
|
-
|
|
151
|
+
_ as SolanaBlockchainEventEmitter
|
|
151
152
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../../event-service/evm/AbstractAccessTokenSnapshotService.cjs");require("ethers");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("process");require("buffer");require("../../../constants/vite.constants.cjs");require("../../../error-handling/error-codes.constants.cjs");require("../../../constants/save-depths.cjs");require("../../../constants/reorg-depths.constants.cjs");require("@coral-xyz/anchor");require("@solana/web3.js");require("../../../constants/chains.constants.cjs");require("../../crypto-keys/keys.cjs");const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../../event-service/evm/AbstractAccessTokenSnapshotService.cjs");require("ethers");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("process");require("buffer");require("../../../constants/vite.constants.cjs");require("../../../error-handling/error-codes.constants.cjs");require("../../../constants/save-depths.cjs");require("../../../constants/reorg-depths.constants.cjs");require("../../../constants/server.constants.cjs");require("../../../API/getServerURL.cjs");require("socket.io-client");require("@coral-xyz/anchor");require("@solana/web3.js");require("../../../constants/chains.constants.cjs");require("../../crypto-keys/keys.cjs");const i=require("../SnapshotFetcherService.cjs");class c extends t.AbstractAccessTokenSnapshotService{snapshotsService;constructor(e,s){super(e),this.snapshotsService=s}async fetchSnapshot(){const{contract:e}=this.blockchainEventEmitter,{chainId:s}=await e.provider.getNetwork();this.snapshotsService||(this.snapshotsService=new i.SnapshotFetcherService(s,e.address));const r=await this.snapshotsService.getAccessTokens();if(r.accessTokenContractAddress!==e.address||r.chainId!==s)throw Error("Commitment Snapshot: incorrect contract or chain id");return{latestBlockNumber:r.latestBlockNumber,merkleTree:r.merkleTree,senderAddresses:r.senderAddresses,senderAddressIndexMap:r.senderAddressIndexMap}}persistSnapshot(e){return Promise.resolve()}}exports.ClientAccessTokenSnapshotService=c;
|
|
@@ -8,12 +8,15 @@ import "../../../constants/vite.constants.mjs";
|
|
|
8
8
|
import "../../../error-handling/error-codes.constants.mjs";
|
|
9
9
|
import "../../../constants/save-depths.mjs";
|
|
10
10
|
import "../../../constants/reorg-depths.constants.mjs";
|
|
11
|
+
import "../../../constants/server.constants.mjs";
|
|
12
|
+
import "../../../API/getServerURL.mjs";
|
|
13
|
+
import "socket.io-client";
|
|
11
14
|
import "@coral-xyz/anchor";
|
|
12
15
|
import "@solana/web3.js";
|
|
13
16
|
import "../../../constants/chains.constants.mjs";
|
|
14
17
|
import "../../crypto-keys/keys.mjs";
|
|
15
18
|
import { SnapshotFetcherService as o } from "../SnapshotFetcherService.mjs";
|
|
16
|
-
class
|
|
19
|
+
class I extends r {
|
|
17
20
|
snapshotsService;
|
|
18
21
|
constructor(e, t) {
|
|
19
22
|
super(e), this.snapshotsService = t;
|
|
@@ -36,5 +39,5 @@ class w extends r {
|
|
|
36
39
|
}
|
|
37
40
|
}
|
|
38
41
|
export {
|
|
39
|
-
|
|
42
|
+
I as ClientAccessTokenSnapshotService
|
|
40
43
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("ethers");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("process");require("buffer");require("../../../constants/vite.constants.cjs");require("../../../error-handling/error-codes.constants.cjs");require("../../../constants/save-depths.cjs");const s=require("../../event-service/evm/AbstractApprovalsSnapshotService.cjs");require("../../../constants/reorg-depths.constants.cjs");require("@coral-xyz/anchor");require("@solana/web3.js");require("../../../constants/chains.constants.cjs");require("../../crypto-keys/keys.cjs");class a extends s.AbstractApprovalsSnapshotService{snapshotsService;constructor(r,t){super(r),this.snapshotsService=t}async fetchSnapshot(){const{contract:r}=this.blockchainEventEmitter,{chainId:t}=await r.provider.getNetwork(),e=await this.snapshotsService.getApprovals();if(!e)return{latestBlockNumber:0,approvals:{},events:[]};if(e.hinkalAddress!==r.address||e.chainId!==t)throw Error("approvalsSnapshotData Snapshot: incorrect contract or chain id");return{latestBlockNumber:e.latestBlockNumber,approvals:e.approvals,events:e.events}}persistSnapshot(r){return Promise.resolve()}}exports.ClientApprovalsSnapshotService=a;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("ethers");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("process");require("buffer");require("../../../constants/vite.constants.cjs");require("../../../error-handling/error-codes.constants.cjs");require("../../../constants/save-depths.cjs");const s=require("../../event-service/evm/AbstractApprovalsSnapshotService.cjs");require("../../../constants/reorg-depths.constants.cjs");require("../../../constants/server.constants.cjs");require("../../../API/getServerURL.cjs");require("socket.io-client");require("@coral-xyz/anchor");require("@solana/web3.js");require("../../../constants/chains.constants.cjs");require("../../crypto-keys/keys.cjs");class a extends s.AbstractApprovalsSnapshotService{snapshotsService;constructor(r,t){super(r),this.snapshotsService=t}async fetchSnapshot(){const{contract:r}=this.blockchainEventEmitter,{chainId:t}=await r.provider.getNetwork(),e=await this.snapshotsService.getApprovals();if(!e)return{latestBlockNumber:0,approvals:{},events:[]};if(e.hinkalAddress!==r.address||e.chainId!==t)throw Error("approvalsSnapshotData Snapshot: incorrect contract or chain id");return{latestBlockNumber:e.latestBlockNumber,approvals:e.approvals,events:e.events}}persistSnapshot(r){return Promise.resolve()}}exports.ClientApprovalsSnapshotService=a;
|
|
@@ -8,11 +8,14 @@ import "../../../error-handling/error-codes.constants.mjs";
|
|
|
8
8
|
import "../../../constants/save-depths.mjs";
|
|
9
9
|
import { AbstractApprovalsSnapshotService as s } from "../../event-service/evm/AbstractApprovalsSnapshotService.mjs";
|
|
10
10
|
import "../../../constants/reorg-depths.constants.mjs";
|
|
11
|
+
import "../../../constants/server.constants.mjs";
|
|
12
|
+
import "../../../API/getServerURL.mjs";
|
|
13
|
+
import "socket.io-client";
|
|
11
14
|
import "@coral-xyz/anchor";
|
|
12
15
|
import "@solana/web3.js";
|
|
13
16
|
import "../../../constants/chains.constants.mjs";
|
|
14
17
|
import "../../crypto-keys/keys.mjs";
|
|
15
|
-
class
|
|
18
|
+
class N extends s {
|
|
16
19
|
snapshotsService;
|
|
17
20
|
constructor(r, o) {
|
|
18
21
|
super(r), this.snapshotsService = o;
|
|
@@ -38,5 +41,5 @@ class A extends s {
|
|
|
38
41
|
}
|
|
39
42
|
}
|
|
40
43
|
export {
|
|
41
|
-
|
|
44
|
+
N as ClientApprovalsSnapshotService
|
|
42
45
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("ethers");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("process");require("buffer");require("../../../constants/vite.constants.cjs");require("../../../error-handling/error-codes.constants.cjs");require("../../../constants/save-depths.cjs");const t=require("../../event-service/evm/AbstractCommitmentsSnapshotService.cjs");require("../../../constants/reorg-depths.constants.cjs");require("@coral-xyz/anchor");require("@solana/web3.js");require("../../../constants/chains.constants.cjs");require("../../crypto-keys/keys.cjs");class s extends t.AbstractCommitmentsSnapshotService{snapshotsService;constructor(e,r){super(e),this.snapshotsService=r}async fetchSnapshot(){const e=await this.snapshotsService.getCommitments();return{latestBlockNumber:e.latestBlockNumber,merkleTree:e.merkleTree,encryptedOutputs:e.encryptedOutputs}}persistSnapshot(e){return Promise.resolve()}}exports.ClientCommitmentsSnapshotService=s;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("ethers");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("process");require("buffer");require("../../../constants/vite.constants.cjs");require("../../../error-handling/error-codes.constants.cjs");require("../../../constants/save-depths.cjs");const t=require("../../event-service/evm/AbstractCommitmentsSnapshotService.cjs");require("../../../constants/reorg-depths.constants.cjs");require("../../../constants/server.constants.cjs");require("../../../API/getServerURL.cjs");require("socket.io-client");require("@coral-xyz/anchor");require("@solana/web3.js");require("../../../constants/chains.constants.cjs");require("../../crypto-keys/keys.cjs");class s extends t.AbstractCommitmentsSnapshotService{snapshotsService;constructor(e,r){super(e),this.snapshotsService=r}async fetchSnapshot(){const e=await this.snapshotsService.getCommitments();return{latestBlockNumber:e.latestBlockNumber,merkleTree:e.merkleTree,encryptedOutputs:e.encryptedOutputs}}persistSnapshot(e){return Promise.resolve()}}exports.ClientCommitmentsSnapshotService=s;
|
|
@@ -8,11 +8,14 @@ import "../../../error-handling/error-codes.constants.mjs";
|
|
|
8
8
|
import "../../../constants/save-depths.mjs";
|
|
9
9
|
import { AbstractCommitmentsSnapshotService as r } from "../../event-service/evm/AbstractCommitmentsSnapshotService.mjs";
|
|
10
10
|
import "../../../constants/reorg-depths.constants.mjs";
|
|
11
|
+
import "../../../constants/server.constants.mjs";
|
|
12
|
+
import "../../../API/getServerURL.mjs";
|
|
13
|
+
import "socket.io-client";
|
|
11
14
|
import "@coral-xyz/anchor";
|
|
12
15
|
import "@solana/web3.js";
|
|
13
16
|
import "../../../constants/chains.constants.mjs";
|
|
14
17
|
import "../../crypto-keys/keys.mjs";
|
|
15
|
-
class
|
|
18
|
+
class f extends r {
|
|
16
19
|
snapshotsService;
|
|
17
20
|
constructor(t, e) {
|
|
18
21
|
super(t), this.snapshotsService = e;
|
|
@@ -30,5 +33,5 @@ class C extends r {
|
|
|
30
33
|
}
|
|
31
34
|
}
|
|
32
35
|
export {
|
|
33
|
-
|
|
36
|
+
f as ClientCommitmentsSnapshotService
|
|
34
37
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("ethers");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("process");require("buffer");require("../../../constants/vite.constants.cjs");require("../../../error-handling/error-codes.constants.cjs");require("../../../constants/save-depths.cjs");const i=require("../../event-service/evm/AbstractNullifierSnapshotService.cjs");require("../../../constants/reorg-depths.constants.cjs");require("@coral-xyz/anchor");require("@solana/web3.js");require("../../../constants/chains.constants.cjs");require("../../crypto-keys/keys.cjs");class s extends i.AbstractNullifierSnapshotService{snapshotsService;constructor(e,r){super(e),this.snapshotsService=r}async fetchSnapshot(){const e=await this.snapshotsService.getNullifiers();return{latestBlockNumber:e.latestBlockNumber,nullifiers:e.nullifiers}}persistSnapshot(e){return Promise.resolve()}}exports.ClientNullifierSnapshotService=s;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("ethers");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("process");require("buffer");require("../../../constants/vite.constants.cjs");require("../../../error-handling/error-codes.constants.cjs");require("../../../constants/save-depths.cjs");const i=require("../../event-service/evm/AbstractNullifierSnapshotService.cjs");require("../../../constants/reorg-depths.constants.cjs");require("../../../constants/server.constants.cjs");require("../../../API/getServerURL.cjs");require("socket.io-client");require("@coral-xyz/anchor");require("@solana/web3.js");require("../../../constants/chains.constants.cjs");require("../../crypto-keys/keys.cjs");class s extends i.AbstractNullifierSnapshotService{snapshotsService;constructor(e,r){super(e),this.snapshotsService=r}async fetchSnapshot(){const e=await this.snapshotsService.getNullifiers();return{latestBlockNumber:e.latestBlockNumber,nullifiers:e.nullifiers}}persistSnapshot(e){return Promise.resolve()}}exports.ClientNullifierSnapshotService=s;
|
|
@@ -8,11 +8,14 @@ import "../../../error-handling/error-codes.constants.mjs";
|
|
|
8
8
|
import "../../../constants/save-depths.mjs";
|
|
9
9
|
import { AbstractNullifierSnapshotService as i } from "../../event-service/evm/AbstractNullifierSnapshotService.mjs";
|
|
10
10
|
import "../../../constants/reorg-depths.constants.mjs";
|
|
11
|
+
import "../../../constants/server.constants.mjs";
|
|
12
|
+
import "../../../API/getServerURL.mjs";
|
|
13
|
+
import "socket.io-client";
|
|
11
14
|
import "@coral-xyz/anchor";
|
|
12
15
|
import "@solana/web3.js";
|
|
13
16
|
import "../../../constants/chains.constants.mjs";
|
|
14
17
|
import "../../crypto-keys/keys.mjs";
|
|
15
|
-
class
|
|
18
|
+
class x extends i {
|
|
16
19
|
snapshotsService;
|
|
17
20
|
constructor(t, r) {
|
|
18
21
|
super(t), this.snapshotsService = r;
|
|
@@ -29,5 +32,5 @@ class b extends i {
|
|
|
29
32
|
}
|
|
30
33
|
}
|
|
31
34
|
export {
|
|
32
|
-
|
|
35
|
+
x as ClientNullifierSnapshotService
|
|
33
36
|
};
|
package/data-structures/snapshot/solana-snapshots/ClientSolanaAccessTokenSnapshotService.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("ethers");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("process");require("buffer");require("../../../constants/vite.constants.cjs");require("../../../error-handling/error-codes.constants.cjs");require("../../../constants/save-depths.cjs");require("../../../constants/reorg-depths.constants.cjs");require("@coral-xyz/anchor");require("@solana/web3.js");require("../../../constants/chains.constants.cjs");require("../../crypto-keys/keys.cjs");const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("ethers");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("process");require("buffer");require("../../../constants/vite.constants.cjs");require("../../../error-handling/error-codes.constants.cjs");require("../../../constants/save-depths.cjs");require("../../../constants/reorg-depths.constants.cjs");require("../../../constants/server.constants.cjs");require("../../../API/getServerURL.cjs");require("socket.io-client");require("@coral-xyz/anchor");require("@solana/web3.js");require("../../../constants/chains.constants.cjs");require("../../crypto-keys/keys.cjs");const s=require("../../event-service/solana/AbstractSolanaAccessTokenSnapshotService.cjs"),t=require("../SnapshotFetcherService.cjs");class n extends s.AbstractSolanaAccessTokenSnapshotService{snapshotsService;constructor(r,e){super(r),this.snapshotsService=e}async fetchSnapshot(){const{chainId:r}=this.solanaBlockchainEventEmitter;this.snapshotsService||(this.snapshotsService=new t.SnapshotFetcherService(r,this.solanaBlockchainEventEmitter.programId.toString()));const e=await this.snapshotsService.getAccessTokens();return{latestBlockNumber:e.latestBlockNumber,merkleTree:e.merkleTree,senderAddresses:e.senderAddresses,senderAddressIndexMap:e.senderAddressIndexMap}}persistSnapshot(r){return Promise.resolve()}}exports.ClientSolanaAccessTokenSnapshotService=n;
|
package/data-structures/snapshot/solana-snapshots/ClientSolanaAccessTokenSnapshotService.mjs
CHANGED
|
@@ -7,13 +7,16 @@ import "../../../constants/vite.constants.mjs";
|
|
|
7
7
|
import "../../../error-handling/error-codes.constants.mjs";
|
|
8
8
|
import "../../../constants/save-depths.mjs";
|
|
9
9
|
import "../../../constants/reorg-depths.constants.mjs";
|
|
10
|
+
import "../../../constants/server.constants.mjs";
|
|
11
|
+
import "../../../API/getServerURL.mjs";
|
|
12
|
+
import "socket.io-client";
|
|
10
13
|
import "@coral-xyz/anchor";
|
|
11
14
|
import "@solana/web3.js";
|
|
12
15
|
import "../../../constants/chains.constants.mjs";
|
|
13
16
|
import "../../crypto-keys/keys.mjs";
|
|
14
17
|
import { AbstractSolanaAccessTokenSnapshotService as t } from "../../event-service/solana/AbstractSolanaAccessTokenSnapshotService.mjs";
|
|
15
18
|
import { SnapshotFetcherService as r } from "../SnapshotFetcherService.mjs";
|
|
16
|
-
class
|
|
19
|
+
class E extends t {
|
|
17
20
|
snapshotsService;
|
|
18
21
|
constructor(s, e) {
|
|
19
22
|
super(s), this.snapshotsService = e;
|
|
@@ -37,5 +40,5 @@ class f extends t {
|
|
|
37
40
|
}
|
|
38
41
|
}
|
|
39
42
|
export {
|
|
40
|
-
|
|
43
|
+
E as ClientSolanaAccessTokenSnapshotService
|
|
41
44
|
};
|
package/data-structures/snapshot/solana-snapshots/ClientSolanaCommitmentsSnapshotService.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("ethers");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("process");require("buffer");require("../../../constants/vite.constants.cjs");require("../../../error-handling/error-codes.constants.cjs");require("../../../constants/save-depths.cjs");require("../../../constants/reorg-depths.constants.cjs");require("@coral-xyz/anchor");const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("ethers");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("process");require("buffer");require("../../../constants/vite.constants.cjs");require("../../../error-handling/error-codes.constants.cjs");require("../../../constants/save-depths.cjs");require("../../../constants/reorg-depths.constants.cjs");require("../../../constants/server.constants.cjs");require("../../../API/getServerURL.cjs");require("socket.io-client");require("@coral-xyz/anchor");const t=require("../../event-service/solana/AbstractSolanaCommitmentsSnapshotService.cjs");require("@solana/web3.js");class s extends t.AbstractSolanaCommitmentsSnapshotService{snapshotsService;constructor(e,r){super(e),this.snapshotsService=r}async fetchSnapshot(){const e=await this.snapshotsService.getCommitments();return{latestBlockNumber:e.latestBlockNumber,merkleTree:e.merkleTree,encryptedOutputs:e.encryptedOutputs}}persistSnapshot(e){return Promise.resolve()}}exports.ClientSolanaCommitmentsSnapshotService=s;
|
package/data-structures/snapshot/solana-snapshots/ClientSolanaCommitmentsSnapshotService.mjs
CHANGED
|
@@ -7,10 +7,13 @@ import "../../../constants/vite.constants.mjs";
|
|
|
7
7
|
import "../../../error-handling/error-codes.constants.mjs";
|
|
8
8
|
import "../../../constants/save-depths.mjs";
|
|
9
9
|
import "../../../constants/reorg-depths.constants.mjs";
|
|
10
|
+
import "../../../constants/server.constants.mjs";
|
|
11
|
+
import "../../../API/getServerURL.mjs";
|
|
12
|
+
import "socket.io-client";
|
|
10
13
|
import "@coral-xyz/anchor";
|
|
11
14
|
import { AbstractSolanaCommitmentsSnapshotService as r } from "../../event-service/solana/AbstractSolanaCommitmentsSnapshotService.mjs";
|
|
12
15
|
import "@solana/web3.js";
|
|
13
|
-
class
|
|
16
|
+
class b extends r {
|
|
14
17
|
snapshotsService;
|
|
15
18
|
constructor(t, e) {
|
|
16
19
|
super(t), this.snapshotsService = e;
|
|
@@ -28,5 +31,5 @@ class d extends r {
|
|
|
28
31
|
}
|
|
29
32
|
}
|
|
30
33
|
export {
|
|
31
|
-
|
|
34
|
+
b as ClientSolanaCommitmentsSnapshotService
|
|
32
35
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("ethers");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("process");require("buffer");require("../../../constants/vite.constants.cjs");require("../../../error-handling/error-codes.constants.cjs");require("../../../constants/save-depths.cjs");require("../../../constants/reorg-depths.constants.cjs");require("@coral-xyz/anchor");const i=require("../../event-service/solana/AbstractSolanaNullifierSnapshotService.cjs");require("@solana/web3.js");require("../../../constants/chains.constants.cjs");require("../../crypto-keys/keys.cjs");class s extends i.AbstractSolanaNullifierSnapshotService{snapshotsService;constructor(e,r){super(e),this.snapshotsService=r}async fetchSnapshot(){const e=await this.snapshotsService.getNullifiers();return{latestBlockNumber:e.latestBlockNumber,nullifiers:e.nullifiers}}persistSnapshot(e){return Promise.resolve()}}exports.ClientSolanaNullifierSnapshotService=s;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("ethers");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("process");require("buffer");require("../../../constants/vite.constants.cjs");require("../../../error-handling/error-codes.constants.cjs");require("../../../constants/save-depths.cjs");require("../../../constants/reorg-depths.constants.cjs");require("../../../constants/server.constants.cjs");require("../../../API/getServerURL.cjs");require("socket.io-client");require("@coral-xyz/anchor");const i=require("../../event-service/solana/AbstractSolanaNullifierSnapshotService.cjs");require("@solana/web3.js");require("../../../constants/chains.constants.cjs");require("../../crypto-keys/keys.cjs");class s extends i.AbstractSolanaNullifierSnapshotService{snapshotsService;constructor(e,r){super(e),this.snapshotsService=r}async fetchSnapshot(){const e=await this.snapshotsService.getNullifiers();return{latestBlockNumber:e.latestBlockNumber,nullifiers:e.nullifiers}}persistSnapshot(e){return Promise.resolve()}}exports.ClientSolanaNullifierSnapshotService=s;
|
|
@@ -7,12 +7,15 @@ import "../../../constants/vite.constants.mjs";
|
|
|
7
7
|
import "../../../error-handling/error-codes.constants.mjs";
|
|
8
8
|
import "../../../constants/save-depths.mjs";
|
|
9
9
|
import "../../../constants/reorg-depths.constants.mjs";
|
|
10
|
+
import "../../../constants/server.constants.mjs";
|
|
11
|
+
import "../../../API/getServerURL.mjs";
|
|
12
|
+
import "socket.io-client";
|
|
10
13
|
import "@coral-xyz/anchor";
|
|
11
14
|
import { AbstractSolanaNullifierSnapshotService as i } from "../../event-service/solana/AbstractSolanaNullifierSnapshotService.mjs";
|
|
12
15
|
import "@solana/web3.js";
|
|
13
16
|
import "../../../constants/chains.constants.mjs";
|
|
14
17
|
import "../../crypto-keys/keys.mjs";
|
|
15
|
-
class
|
|
18
|
+
class x extends i {
|
|
16
19
|
snapshotsService;
|
|
17
20
|
constructor(t, r) {
|
|
18
21
|
super(t), this.snapshotsService = r;
|
|
@@ -29,5 +32,5 @@ class b extends i {
|
|
|
29
32
|
}
|
|
30
33
|
}
|
|
31
34
|
export {
|
|
32
|
-
|
|
35
|
+
x as ClientSolanaNullifierSnapshotService
|
|
33
36
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("../../constants/protocol.constants.cjs"),h=require("../../crypto/poseidon.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("../../constants/protocol.constants.cjs"),h=require("../../crypto/poseidon.cjs"),A=require("../../functions/web3/etherFunctions.cjs"),a=require("../crypto-keys/keys.cjs"),p=require("../../functions/utils/time.utils.cjs"),f=require("../../constants/chains.constants.cjs");class n{amount;erc20TokenAddress;mintAddress;timeStamp;tokenId;shieldedPrivateKey;randomization;stealthAddress;encryptionKey;commitment;nullifier;isBlocked;constructor({amount:t,erc20TokenAddress:e,mintAddress:o,timeStamp:i,tokenId:r,shieldedPrivateKey:s,randomization:m,stealthAddress:l,encryptionKey:c,commitment:u=void 0,nullifier:y=void 0,isBlocked:k=!1}){this.amount=t,this.erc20TokenAddress=e,this.mintAddress=o,this.timeStamp=i??p.getCurrentTimeInSeconds().toString(),this.tokenId=r??0,this.shieldedPrivateKey=s,this.randomization=m??n.findCorrectRandomization(A.randomBigInt(31),s),this.stealthAddress=l,this.encryptionKey=c,this.commitment=u,this.nullifier=y,this.isBlocked=k}static createFrom(t,e){return new n({...t.getConstructableParams(),nullifier:void 0,commitment:void 0,...e})}getConstructableParams(){return{amount:this.amount,erc20TokenAddress:this.erc20TokenAddress,mintAddress:this.mintAddress,timeStamp:this.timeStamp,shieldedPrivateKey:this.shieldedPrivateKey,randomization:this.randomization,stealthAddress:this.stealthAddress,encryptionKey:this.encryptionKey,tokenId:this.tokenId,commitment:this.commitment,nullifier:this.nullifier,isBlocked:this.isBlocked}}getBasicUtxoParams(){return{amount:this.amount,erc20TokenAddress:this.erc20TokenAddress,mintAddress:this.mintAddress,timeStamp:this.timeStamp,randomization:this.randomization,stealthAddress:this.stealthAddress,tokenId:this.tokenId,commitment:this.commitment,nullifier:this.nullifier,isBlocked:this.isBlocked}}getCommitment(){if(!this.commitment){const t=[this.amount,this.erc20TokenAddress,BigInt(this.getStealthAddress()),this.timeStamp];this.tokenId>0&&t.push(this.tokenId.toString()),this.commitment=h.poseidonHash(...t)}return this.commitment}getNullifier(){if(!this.nullifier){if(!this.shieldedPrivateKey)throw new Error("No Nullifiers if private key is not provided");const t=h.poseidonHash(this.shieldedPrivateKey,this.getCommitment());this.nullifier=h.poseidonHash(this.commitment,t)}return this.nullifier}getStealthAddress(){if(!this.stealthAddress){if(!this.shieldedPrivateKey)throw Error("No stealth address in UTXO if private key is not provided");const t=a.UserKeys.getStealthAddress(this.randomization,this.shieldedPrivateKey);this.stealthAddress=t}return this.stealthAddress}getEncryptionKey(){if(!this.shieldedPrivateKey){if(!this.encryptionKey)throw Error("No encryption key provided in UTXO");return this.encryptionKey}return a.UserKeys.getEncryptionKeyPair(this.shieldedPrivateKey).publicKey}static findCorrectRandomization(t,e){if(!e)throw Error("No Private Shielded Key Provided");const o=BigInt(e)%d.CIRCOM_P;let i,r,s=0n;do i=t*10n**s%d.CIRCOM_P,r=i*o%d.CIRCOM_P,s+=1n;while(r>=2n**253n||i>=2n**253n);return i}getTokenAddress(t){const e=f.isSolanaLike(t)?this.mintAddress:this.erc20TokenAddress;if(!e)throw new Error("No token address provided");return e}}exports.Utxo=n;
|
|
@@ -44,6 +44,7 @@ export declare class Utxo {
|
|
|
44
44
|
constructor({ amount, erc20TokenAddress, mintAddress, timeStamp, tokenId, shieldedPrivateKey, randomization, stealthAddress, encryptionKey, commitment, nullifier, isBlocked, }: IUtxoConstructor);
|
|
45
45
|
static createFrom(utxoToCreateFrom: Utxo, patch: Partial<IUtxoConstructor>): Utxo;
|
|
46
46
|
getConstructableParams(): IUtxoConstructor;
|
|
47
|
+
getBasicUtxoParams(): IUtxoConstructor;
|
|
47
48
|
/**
|
|
48
49
|
* @returns commitment hash of the UTXO instance
|
|
49
50
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CIRCOM_P as o } from "../../constants/protocol.constants.mjs";
|
|
2
2
|
import { poseidonHash as d } from "../../crypto/poseidon.mjs";
|
|
3
|
-
import { randomBigInt as
|
|
3
|
+
import { randomBigInt as y } from "../../functions/web3/etherFunctions.mjs";
|
|
4
4
|
import { UserKeys as m } from "../crypto-keys/keys.mjs";
|
|
5
5
|
import { getCurrentTimeInSeconds as A } from "../../functions/utils/time.utils.mjs";
|
|
6
6
|
import { isSolanaLike as k } from "../../constants/chains.constants.mjs";
|
|
@@ -45,10 +45,10 @@ class h {
|
|
|
45
45
|
stealthAddress: l,
|
|
46
46
|
encryptionKey: c,
|
|
47
47
|
commitment: u = void 0,
|
|
48
|
-
nullifier:
|
|
49
|
-
isBlocked:
|
|
48
|
+
nullifier: f = void 0,
|
|
49
|
+
isBlocked: p = !1
|
|
50
50
|
}) {
|
|
51
|
-
this.amount = t, this.erc20TokenAddress = e, this.mintAddress = n, this.timeStamp = i ?? A().toString(), this.tokenId = r ?? 0, this.shieldedPrivateKey = s, this.randomization = a ?? h.findCorrectRandomization(
|
|
51
|
+
this.amount = t, this.erc20TokenAddress = e, this.mintAddress = n, this.timeStamp = i ?? A().toString(), this.tokenId = r ?? 0, this.shieldedPrivateKey = s, this.randomization = a ?? h.findCorrectRandomization(y(31), s), this.stealthAddress = l, this.encryptionKey = c, this.commitment = u, this.nullifier = f, this.isBlocked = p;
|
|
52
52
|
}
|
|
53
53
|
static createFrom(t, e) {
|
|
54
54
|
return new h({
|
|
@@ -74,6 +74,20 @@ class h {
|
|
|
74
74
|
isBlocked: this.isBlocked
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
|
+
getBasicUtxoParams() {
|
|
78
|
+
return {
|
|
79
|
+
amount: this.amount,
|
|
80
|
+
erc20TokenAddress: this.erc20TokenAddress,
|
|
81
|
+
mintAddress: this.mintAddress,
|
|
82
|
+
timeStamp: this.timeStamp,
|
|
83
|
+
randomization: this.randomization,
|
|
84
|
+
stealthAddress: this.stealthAddress,
|
|
85
|
+
tokenId: this.tokenId,
|
|
86
|
+
commitment: this.commitment,
|
|
87
|
+
nullifier: this.nullifier,
|
|
88
|
+
isBlocked: this.isBlocked
|
|
89
|
+
};
|
|
90
|
+
}
|
|
77
91
|
/**
|
|
78
92
|
* @returns commitment hash of the UTXO instance
|
|
79
93
|
*/
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s={CANNOT_CERTIFY_FOR_PAST_WEEK:"Certification for the past week is not available",CYCLICAL_REFERRALS_FORBIDDEN:"Cyclical referrals are forbidden",USER_IS_UNRANKED:"Please certify transactions to see rank"},r={WC_NO_MATCHING_KEY:`creating the transaction failed
|
|
2
|
-
version`},n={WC_INVALID_URI:"Invalid WalletConnect URI. Please, try again",WC_PAIRINNG_ERROR:"Pairing failed. Check your code and retry"},a={INSUFFICIENT_FUNDS:"Insufficient funds",INSUFFICIENT_FUNDS_WITHDRAW:"Not enough funds to withdraw",INSUFFICIENT_FUNDS_TRANSFER:"Not enough funds to transfer",INSUFFICIENT_FUNDS_TO_TRANSACT:"Not enough funds to transact",INSUFFICIENT_FUNDS_GAS:"Insufficient funds for gas * price"},t={GAS_PRICE_EXCEEDS_AUTOSHIELD_LIMIT:"Gas prices too high to autoshield"},o={...s,...r,...a,...t,SOME_ERROR:"Some error has occurred. Please try again in a few minutes. If the issue persists, please report it in Discord",TOO_HIGH_AMOUNT:"ApproxParamsInvalid",NOT_ENOUGH_TOKENS:"Transfer amount exceeds balance",TRANSACTION_NOT_CONFIRMED:"The transaction was not confirmed by the network. Please, try again",RPC_PROVIDER_LIMIT_ERROR:"Non-200 status code: '429'",RELAYER_NOT_AVAILABLE:"All relayers are busy, please try in a few seconds",TRANSACTION_TIMEOUT:"Your transaction got stale. Please, try in a few seconds",CONNECT_ERROR:"Connection error",CONNECT_ERROR2:"DOMException: Failed",USER_REJECTED_TX:"Transaction rejected",USER_REJECTED_SIGN:"User rejected signing",USER_REJECTED_TRANSACTION:"user rejected transaction",USER_REJECTED_SIGN2:"User rejected the request",USER_DENIED_TRANSACTION_SIGNATURE:"User denied transaction signature.",SIGNING_FAILED:"The signing failed. Please, try again",SIGNATURE_UNSUPPORTED_CHAINS:"Details: Unsupported chains",SIGNATURE_UNSUPPORTED_CHAINS2:"User disapproved requested chains",SIGNATURE_REQUEST_EXPIRED:"Request expired. Please try again",SIGNATURE_UNSUPPORTED_PERSONAL_SIGN:"The method personal_sign does not exist",USER_DISAPPROVED_REQUESTED_METHODS:"User disapproved requested methods",INVALID_AUTHORIZATION:"The requested account and/or method has not been authorized by the user",INVALID_NULLIFIER:"Nullifier cannot be reused",SANCTIONED_ADDRESS:"Address is sanctioned",INVALID_AMOUNT:"Please, select correct amount",RECIPIENT_FORMAT_INCORRECT:"Recipient Information format is incorrect",INVALID_TOKEN:"Invalid token provided",STATE_TO_UPDATE:"Error in template Verifier_219 line: 121",HAS_TOKEN:"User already has an access token",INVALID_RECEIVER:"Receiver address doesn't match",INVALID_RELAYER:"Relayer address doesn't match",INVALID_RELAYER_FEE:"Relayer fee amount doesn't match",TIMESTAMP_STALE:"Timestamp provided does not align with current time",INVALID_ZKP:"Proof must be valid",NO_TRANSACTIONS_TO_CERTIFY:"This week, you do not have transactions to certify",RECIPIENT_AMOUNT_INVALID:"Recipient amount is invalid",UNSUPPORTED_NETWORK:"The selected network is not supported. Please switch to another network to continue.",SIG_BY_OWNER:"Signature must be signed by the owner of the contract",AMOUNT_EMPTY:"Please, specify amount",UNVERIFIED_USER:"Please, pass KYC verification",RELAYER_ISSUE:"Relayer has some issues. Try again later",RELAYER_GAS_ESTIMATE:"Relayer was not able to estimate the gas costs of tx. Please, try later",RECEIVER_EMPTY:"Please, enter recipient address",VALID_ETHEREUM_ADDRESS:"Please, input valid ethereum address",METAMASK_NOT_INSTALLED:"Please, install Metamask Wallet",VIABLE_TX:"The transaction is not viable. Please increase the swap amount to swap with Relayer",TRANSACTION_REPLACED:"transaction was replaced",TRANSACTION_REPLACED2:"replacement fee too low",TRANSACTION_CANCELED:"Transaction was cancelled. Please try again",NONCE_HIGH:"Nonce too high",WALLET_CONNECT_MATCHING_KEYS:"No matching key. keychain",UNKNOWN_PROVIDER:"Unknown provider",SAFE_ERC:"SafeERC20: low-level call failed",SAFE_ERC_APPROVE:"SafeERC20: approve from non-zero to non-zero allowance",SWAP_RELAYER_MIN:"Relayer minimum fee is not satisfied",LOW_LEVEL_CALL:"low-level delegate call failed",INTEGRAL_CURVE_ZERO:"previous integral cannot be zero",ODOS_FETCH:"Odos API Fetch Error",YOU_CANCELED_REQUEST:"You canceled the request",SLIPPAGE_LIMIT:"Slippage Limit Exceeded",SLIPPAGE_LIMIT_1:"Slippage screwed you",QUOTE_EXPIRED:"Quote has expired",REVERT_NO_STRING:"Transaction reverted without a reason string",UNISWAP_NOT_ENOUGH_LIQUIDITY:"Not Enough Liquidity",CONNECTION_FAILED:"Failed to connect",FAILED_TO_SWITCH_NETWORKS:"Failed to switch network, Please switch networks using your wallet's settings",INVALID_FROM:"Invalid from token",INVALID_TO:"Invalid to token",Invalid_Password:"Invalid password",INTERNAL_ERROR:"Internal error: please, try again",INVALID_MERKLE_ROOT:"Invalid merkle tree root",ACCESS_TOKEN_INVALID_HASH:"Access Token not minted",MERLE_TREE_SNARK:"Error in template ForceEqualIfEnabled",ERROR_MESSAGE_CHAIN_ADDRESS_CHANGED:"Chain/address changed: balance updated canceled",DECIMALS_LIMIT:"Number of decimals exceed maximum",MERKLE_TREE_INCOMPLETE:"Merkle tree is incomplete",FAIL_ESTIMATE_GAS:"Failed to estimate gas: check the transaction parameters",ODOS_SWAP_FAILED:"Odos swap call failed",ONEINCH_SWAP_FAILED:"One inch swap failed",GAS_ESTIMATION_ERROR:"Failed Gas Estimates Response",GAS_ESTIMATE_INCORRECT_PARAMETERS:"Incorrect Parameters for Gas Estimate",CONNECTIVITY_ERROR:"Request failed with status code 500",TRANSACTION_FAILED:"Transaction Failed: Revert",NO_UNISWAP_PRICE:"Cannot get Uniswap Price",NO_ODOS_PRICE:"Cannot get Odos Price",NO_ONEINCH_PRICE:"Cannot get OneInch Price",NO_LIFI_PRICE:"Cannot get LiFi Price",FEES_OVER_TRANSACTION_VALUE:"Fees are over transaction value. Please, increase the amount",GAS_STATION_NOT_AVAILABLE:"Gas Station Not Available",INBALANCE_IN_TOKEN:"Inbalance in token detected",BALANCE_EQUATION_FAILED:"Balance Diff Should be equal to sum of onchain and offchain created commitments",TOKEN_ADD_ERROR:"Error occoured while adding token. Please make sure you are adding a valid ERC-20 token",CANNOT_ESTIMATE_GAS:"transaction may require manual gas limit",NETWORK_ERROR:"Network Error",MAX_FEE_GAS_ERROR:"max fee per gas less than block base fee",CORS_ERROR:"has been blocked by CORS policy",CANNOT_ESTIMATE_GAS2:"transaction may fail or may require manual gas limit",NO_RESPONSE_PRIVATE:"No resonse from private relay",TRY_AGAIN_AFTER_TRANSACTION:"Please, try again",ALREADY_SUBSCRIBED:"User Already Subscribed",PREFERRED_TOKEN_OR_ADDRESS_MISSING:"Please, specify both the preferred token and public wallet address",SNAPSHOT_FILE_NOT_FOUND:"We are updating our servers. Please try again in some time",SAME_ADDRESS_FORBIDDEN:"You cannot recieve staked tokens on the same ethereum address",NOT_VALID_ETHEREUM_ADDRESS:"Please enter a valid Ethereum address",MUST_STAKE_AT_LEAST_ONE_ETH:"Amount too low, Please stake at least 1 ETH",OUT_OF_MEMORY:"Out of memory: Cannot allocate Wasm memory",OUT_OF_MEMORY2:"could not allocate memory",OUT_OF_MEMORY3:"out of memory",UNKNOWN:"Unknown error",SANDBOX_WRONG_REQUEST:"The requested Transaction type is not supported",INSUFFICIENT_LAMPORTS:"insufficient lamports",TOKENS_DO_NOT_BELONG_SAME_CHAIN:"Tokens belong to different chains. All tokens must belong to the same chain"},e="Not enough memory. Please, close some tabs/applications to free up memory and try again",i={USER_REJECTED_TRANSACTION:"You cancelled the transaction",SOME_ERROR:"Some error has occurred. Please try again in a few minutes. If the issue persists, please report it in Discord",TOO_HIGH_AMOUNT:"The amount you provided is too high, please adjust the amount",WC_NO_MATCHING_KEY:"Wallet Connect error. Please, try again",RPC_PROVIDER_LIMIT_ERROR:"Rate Limit: please, use different rpc provider in your wallet",INSUFFICIENT_FUNDS_GAS:"Your balance is too low to cover the transaction fees. Please add funds to proceed",INVALID_NULLIFIER:"There seems to be an issue with syncing your balance. Please press the refresh icon next to your shielded balance",STATE_TO_UPDATE:"A technical issue has occurred. Please create a ticket on Hinkal discord server",INVALID_ZKP:"The Zero Knowledge Proof provided is invalid. Please check and try again",NONCE_HIGH:"To resolve this issue, please reset your wallet in the Settings",UNKNOWN_PROVIDER:"The provider is not recognized. Please check your settings",TRANSACTION_REPLACED:"Your transaction was replaced by another. Please submit your transaction again",TRANSACTION_REPLACED2:"This transaction was replaced. Please try submitting again",TRANSACTION_TIMEOUT:"Your transaction got stale. Please, try in a few seconds",SAFE_ERC:"The selected ERC20 Token could not be transferred. Please contact the Hinkal support team",SIMULATION_FAILED:"Transaction failed during simulation:",SAFE_ERC_APPROVE:"The selected ERC20 Token could not be approved. Please contact the Hinkal support team",INTEGRAL_CURVE_ZERO:"There's an issue with the pool's staking function. Please contact the Hinkal support team for assistance",LOW_LEVEL_CALL:"A technical issue occurred. Please contact the Hinkal team for assistance",YOU_CANCELED_REQUEST:"You canceled the request",USER_REJECTED_SIGN2:"You canceled the request",USER_DENIED_TRANSACTION_SIGNATURE:"You canceled the request",ODOS_FETCH:"Current Odos price is unavailable. Please try again",ODOS_SWAP_FAILED:"Your Odos Swap transaction didn’t go through. Please try again",ONEINCH_SWAP_FAILED:"Your 1inch Swap transaction didn’t go through. Please try again",CONNECT_ERROR2:"Oops, there are connectivity issues. Please check your internet connection and try again",WALLET_CONNECT_MATCHING_KEYS:"An internal WalletConnect error occurred. Please try reconnecting",SIGNATURE_UNSUPPORTED_CHAINS:"The transaction couldn’t be signed: this network is not supported",SIGNATURE_UNSUPPORTED_CHAINS2:"The transaction couldn’t be signed: this network is not supported",SIGNATURE_UNSUPPORTED_PERSONAL_SIGN:"Your active wallet doesn't support personal signatures. Please use a different wallet",REVERT_NO_STRING:"Your transaction didn’t go through due to technical issues. Please submit a ticket on Hinkal discord server",INVALID_MERKLE_ROOT:"There's an issue with the merkle tree root. Please submit a ticket on Hinkal discord server",MERLE_TREE_SNARK:"An error occurred in the circuit processing. Please submit a ticket on Hinkal discord server",MAX_FEE_GAS_ERROR:"Your transaction was rejected due to high network congestion",MERKLE_TREE_INCOMPLETE:"A technical issue has occurred. Please submit a ticket on Hinkal discord server",CORS_ERROR:"Unable to reach the remote client. Please submit a ticket on Hinkal discord server",NETWORK_ERROR:"Connection error. Please, check back later",CONNECTIVITY_ERROR:"A connectivity issue occurred. Please check your network connection",INBALANCE_IN_TOKEN:"Your transaction didn’t go through due to price slippage. Try increasing your slippage tolerance",BALANCE_EQUATION_FAILED:"There's an issue with the balance calculation. Please adjust your transaction parameters",SLIPPAGE_LIMIT_1:"Your transaction didn’t go through due to price slippage. Adjust slippage settings and retry",CANNOT_ESTIMATE_GAS:"Unable to estimate the gas required. Please set the gas limit manually",CANNOT_ESTIMATE_GAS2:"Your transaction didn’t go through. Please try setting gas limit manually",GAS_STATION_NOT_AVAILABLE:"The Gas Station service is currently unavailable. Please submit a ticket on Hinkal discord server",TIMESTAMP_STALE:"This transaction is outdated. Please initiate a new transaction",ALREADY_SUBSCRIBED:"This email is already subscribed to the Hinkal newsletter",OUT_OF_MEMORY:e,OUT_OF_MEMORY2:e,OUT_OF_MEMORY3:e,INVALID_RECOVERY_PHRASE:"Invalid recovery phrase",PHRASES_DONT_MATCH:"Phrases do not match. You can always go back and check!",PASSWORDS_DONT_MATCH:"Passwords do not match",PASSWORD_SAME_AS_OLD:"Password cannot be the same as the old one",PASSWORD_TOO_SMALL:"Password must be at least 8 characters",PASSWORD_NOT_CORRECT:"Incorrect current password",CODE_ALREADY_USED:"This code has already been used",ACCESS_CODE_REQUIRED:"Access code is required",ACCESS_CODE_IS_ALREADY_IN_USE:"Access code is already in use",ACCESS_CODE_IS_ALREADY_IN_USE1:"Access code already in use. Import or connect existing wallet",ERROR_DURING_PHRASE_CONFIRMATION:"Error during Phrase confirmation",INSUFFICIENT_LAMPORTS:"Your SOL balance is too low to complete this transaction"};exports.UserFriendlyErrorCodes=i;exports.gasErrorCodes=t;exports.insufficientResourcesErrorCodes=a;exports.transactionErrorCodes=o;exports.walletConnectErrorCodes=n;
|
|
2
|
+
version`},n={WC_INVALID_URI:"Invalid WalletConnect URI. Please, try again",WC_PAIRINNG_ERROR:"Pairing failed. Check your code and retry"},a={INSUFFICIENT_FUNDS:"Insufficient funds",INSUFFICIENT_FUNDS_WITHDRAW:"Not enough funds to withdraw",INSUFFICIENT_FUNDS_TRANSFER:"Not enough funds to transfer",INSUFFICIENT_FUNDS_TO_TRANSACT:"Not enough funds to transact",INSUFFICIENT_FUNDS_GAS:"Insufficient funds for gas * price"},t={GAS_PRICE_EXCEEDS_AUTOSHIELD_LIMIT:"Skipped shielding due to gas fee exceeding your limit."},o={...s,...r,...a,...t,SOME_ERROR:"Some error has occurred. Please try again in a few minutes. If the issue persists, please report it in Discord",TOO_HIGH_AMOUNT:"ApproxParamsInvalid",NOT_ENOUGH_TOKENS:"Transfer amount exceeds balance",TRANSACTION_NOT_CONFIRMED:"The transaction was not confirmed by the network. Please, try again",RPC_PROVIDER_LIMIT_ERROR:"Non-200 status code: '429'",RELAYER_NOT_AVAILABLE:"All relayers are busy, please try in a few seconds",TRANSACTION_TIMEOUT:"Your transaction got stale. Please, try in a few seconds",CONNECT_ERROR:"Connection error",CONNECT_ERROR2:"DOMException: Failed",USER_REJECTED_TX:"Transaction rejected",USER_REJECTED_SIGN:"User rejected signing",USER_REJECTED_TRANSACTION:"user rejected transaction",USER_REJECTED_SIGN2:"User rejected the request",USER_DENIED_TRANSACTION_SIGNATURE:"User denied transaction signature.",SIGNING_FAILED:"The signing failed. Please, try again",SIGNATURE_UNSUPPORTED_CHAINS:"Details: Unsupported chains",SIGNATURE_UNSUPPORTED_CHAINS2:"User disapproved requested chains",SIGNATURE_REQUEST_EXPIRED:"Request expired. Please try again",SIGNATURE_UNSUPPORTED_PERSONAL_SIGN:"The method personal_sign does not exist",USER_DISAPPROVED_REQUESTED_METHODS:"User disapproved requested methods",INVALID_AUTHORIZATION:"The requested account and/or method has not been authorized by the user",INVALID_NULLIFIER:"Nullifier cannot be reused",SANCTIONED_ADDRESS:"Address is sanctioned",INVALID_AMOUNT:"Please, select correct amount",RECIPIENT_FORMAT_INCORRECT:"Recipient Information format is incorrect",INVALID_TOKEN:"Invalid token provided",STATE_TO_UPDATE:"Error in template Verifier_219 line: 121",HAS_TOKEN:"User already has an access token",INVALID_RECEIVER:"Receiver address doesn't match",INVALID_RELAYER:"Relayer address doesn't match",INVALID_RELAYER_FEE:"Relayer fee amount doesn't match",TIMESTAMP_STALE:"Timestamp provided does not align with current time",INVALID_ZKP:"Proof must be valid",NO_TRANSACTIONS_TO_CERTIFY:"This week, you do not have transactions to certify",RECIPIENT_AMOUNT_INVALID:"Recipient amount is invalid",UNSUPPORTED_NETWORK:"The selected network is not supported. Please switch to another network to continue.",SIG_BY_OWNER:"Signature must be signed by the owner of the contract",AMOUNT_EMPTY:"Please, specify amount",UNVERIFIED_USER:"Please, pass KYC verification",RELAYER_ISSUE:"Relayer has some issues. Try again later",RELAYER_GAS_ESTIMATE:"Relayer was not able to estimate the gas costs of tx. Please, try later",RECEIVER_EMPTY:"Please, enter recipient address",VALID_ETHEREUM_ADDRESS:"Please, input valid ethereum address",METAMASK_NOT_INSTALLED:"Please, install Metamask Wallet",VIABLE_TX:"The transaction is not viable. Please increase the swap amount to swap with Relayer",TRANSACTION_REPLACED:"transaction was replaced",TRANSACTION_REPLACED2:"replacement fee too low",TRANSACTION_CANCELED:"Transaction was cancelled. Please try again",NONCE_HIGH:"Nonce too high",WALLET_CONNECT_MATCHING_KEYS:"No matching key. keychain",UNKNOWN_PROVIDER:"Unknown provider",SAFE_ERC:"SafeERC20: low-level call failed",SAFE_ERC_APPROVE:"SafeERC20: approve from non-zero to non-zero allowance",SWAP_RELAYER_MIN:"Relayer minimum fee is not satisfied",LOW_LEVEL_CALL:"low-level delegate call failed",INTEGRAL_CURVE_ZERO:"previous integral cannot be zero",ODOS_FETCH:"Odos API Fetch Error",YOU_CANCELED_REQUEST:"You canceled the request",SLIPPAGE_LIMIT:"Slippage Limit Exceeded",SLIPPAGE_LIMIT_1:"Slippage screwed you",QUOTE_EXPIRED:"Quote has expired",REVERT_NO_STRING:"Transaction reverted without a reason string",UNISWAP_NOT_ENOUGH_LIQUIDITY:"Not Enough Liquidity",CONNECTION_FAILED:"Failed to connect",FAILED_TO_SWITCH_NETWORKS:"Failed to switch network, Please switch networks using your wallet's settings",INVALID_FROM:"Invalid from token",INVALID_TO:"Invalid to token",Invalid_Password:"Invalid password",INTERNAL_ERROR:"Internal error: please, try again",INVALID_MERKLE_ROOT:"Invalid merkle tree root",ACCESS_TOKEN_INVALID_HASH:"Access Token not minted",MERLE_TREE_SNARK:"Error in template ForceEqualIfEnabled",ERROR_MESSAGE_CHAIN_ADDRESS_CHANGED:"Chain/address changed: balance updated canceled",DECIMALS_LIMIT:"Number of decimals exceed maximum",MERKLE_TREE_INCOMPLETE:"Merkle tree is incomplete",FAIL_ESTIMATE_GAS:"Failed to estimate gas: check the transaction parameters",ODOS_SWAP_FAILED:"Odos swap call failed",ONEINCH_SWAP_FAILED:"One inch swap failed",GAS_ESTIMATION_ERROR:"Failed Gas Estimates Response",GAS_ESTIMATE_INCORRECT_PARAMETERS:"Incorrect Parameters for Gas Estimate",CONNECTIVITY_ERROR:"Request failed with status code 500",TRANSACTION_FAILED:"Transaction Failed: Revert",NO_UNISWAP_PRICE:"Cannot get Uniswap Price",NO_ODOS_PRICE:"Cannot get Odos Price",NO_ONEINCH_PRICE:"Cannot get OneInch Price",NO_LIFI_PRICE:"Cannot get LiFi Price",FEES_OVER_TRANSACTION_VALUE:"Fees are over transaction value. Please, increase the amount",GAS_STATION_NOT_AVAILABLE:"Gas Station Not Available",INBALANCE_IN_TOKEN:"Inbalance in token detected",BALANCE_EQUATION_FAILED:"Balance Diff Should be equal to sum of onchain and offchain created commitments",TOKEN_ADD_ERROR:"Error occoured while adding token. Please make sure you are adding a valid ERC-20 token",CANNOT_ESTIMATE_GAS:"transaction may require manual gas limit",NETWORK_ERROR:"Network Error",MAX_FEE_GAS_ERROR:"max fee per gas less than block base fee",CORS_ERROR:"has been blocked by CORS policy",CANNOT_ESTIMATE_GAS2:"transaction may fail or may require manual gas limit",NO_RESPONSE_PRIVATE:"No resonse from private relay",TRY_AGAIN_AFTER_TRANSACTION:"Please, try again",ALREADY_SUBSCRIBED:"User Already Subscribed",PREFERRED_TOKEN_OR_ADDRESS_MISSING:"Please, specify both the preferred token and public wallet address",SNAPSHOT_FILE_NOT_FOUND:"We are updating our servers. Please try again in some time",SAME_ADDRESS_FORBIDDEN:"You cannot recieve staked tokens on the same ethereum address",NOT_VALID_ETHEREUM_ADDRESS:"Please enter a valid Ethereum address",MUST_STAKE_AT_LEAST_ONE_ETH:"Amount too low, Please stake at least 1 ETH",OUT_OF_MEMORY:"Out of memory: Cannot allocate Wasm memory",OUT_OF_MEMORY2:"could not allocate memory",OUT_OF_MEMORY3:"out of memory",UNKNOWN:"Unknown error",SANDBOX_WRONG_REQUEST:"The requested Transaction type is not supported",INSUFFICIENT_LAMPORTS:"insufficient lamports",TOKENS_DO_NOT_BELONG_SAME_CHAIN:"Tokens belong to different chains. All tokens must belong to the same chain"},e="Not enough memory. Please, close some tabs/applications to free up memory and try again",i={USER_REJECTED_TRANSACTION:"You cancelled the transaction",SOME_ERROR:"Some error has occurred. Please try again in a few minutes. If the issue persists, please report it in Discord",TOO_HIGH_AMOUNT:"The amount you provided is too high, please adjust the amount",WC_NO_MATCHING_KEY:"Wallet Connect error. Please, try again",RPC_PROVIDER_LIMIT_ERROR:"Rate Limit: please, use different rpc provider in your wallet",INSUFFICIENT_FUNDS_GAS:"Your balance is too low to cover the transaction fees. Please add funds to proceed",INVALID_NULLIFIER:"There seems to be an issue with syncing your balance. Please press the refresh icon next to your shielded balance",STATE_TO_UPDATE:"A technical issue has occurred. Please create a ticket on Hinkal discord server",INVALID_ZKP:"The Zero Knowledge Proof provided is invalid. Please check and try again",NONCE_HIGH:"To resolve this issue, please reset your wallet in the Settings",UNKNOWN_PROVIDER:"The provider is not recognized. Please check your settings",TRANSACTION_REPLACED:"Your transaction was replaced by another. Please submit your transaction again",TRANSACTION_REPLACED2:"This transaction was replaced. Please try submitting again",TRANSACTION_TIMEOUT:"Your transaction got stale. Please, try in a few seconds",SAFE_ERC:"The selected ERC20 Token could not be transferred. Please contact the Hinkal support team",SIMULATION_FAILED:"Transaction failed during simulation:",SAFE_ERC_APPROVE:"The selected ERC20 Token could not be approved. Please contact the Hinkal support team",INTEGRAL_CURVE_ZERO:"There's an issue with the pool's staking function. Please contact the Hinkal support team for assistance",LOW_LEVEL_CALL:"A technical issue occurred. Please contact the Hinkal team for assistance",YOU_CANCELED_REQUEST:"You canceled the request",USER_REJECTED_SIGN2:"You canceled the request",USER_DENIED_TRANSACTION_SIGNATURE:"You canceled the request",ODOS_FETCH:"Current Odos price is unavailable. Please try again",ODOS_SWAP_FAILED:"Your Odos Swap transaction didn’t go through. Please try again",ONEINCH_SWAP_FAILED:"Your 1inch Swap transaction didn’t go through. Please try again",CONNECT_ERROR2:"Oops, there are connectivity issues. Please check your internet connection and try again",WALLET_CONNECT_MATCHING_KEYS:"An internal WalletConnect error occurred. Please try reconnecting",SIGNATURE_UNSUPPORTED_CHAINS:"The transaction couldn’t be signed: this network is not supported",SIGNATURE_UNSUPPORTED_CHAINS2:"The transaction couldn’t be signed: this network is not supported",SIGNATURE_UNSUPPORTED_PERSONAL_SIGN:"Your active wallet doesn't support personal signatures. Please use a different wallet",REVERT_NO_STRING:"Your transaction didn’t go through due to technical issues. Please submit a ticket on Hinkal discord server",INVALID_MERKLE_ROOT:"There's an issue with the merkle tree root. Please submit a ticket on Hinkal discord server",MERLE_TREE_SNARK:"An error occurred in the circuit processing. Please submit a ticket on Hinkal discord server",MAX_FEE_GAS_ERROR:"Your transaction was rejected due to high network congestion",MERKLE_TREE_INCOMPLETE:"A technical issue has occurred. Please submit a ticket on Hinkal discord server",CORS_ERROR:"Unable to reach the remote client. Please submit a ticket on Hinkal discord server",NETWORK_ERROR:"Connection error. Please, check back later",CONNECTIVITY_ERROR:"A connectivity issue occurred. Please check your network connection",INBALANCE_IN_TOKEN:"Your transaction didn’t go through due to price slippage. Try increasing your slippage tolerance",BALANCE_EQUATION_FAILED:"There's an issue with the balance calculation. Please adjust your transaction parameters",SLIPPAGE_LIMIT_1:"Your transaction didn’t go through due to price slippage. Adjust slippage settings and retry",CANNOT_ESTIMATE_GAS:"Unable to estimate the gas required. Please set the gas limit manually",CANNOT_ESTIMATE_GAS2:"Your transaction didn’t go through. Please try setting gas limit manually",GAS_STATION_NOT_AVAILABLE:"The Gas Station service is currently unavailable. Please submit a ticket on Hinkal discord server",TIMESTAMP_STALE:"This transaction is outdated. Please initiate a new transaction",ALREADY_SUBSCRIBED:"This email is already subscribed to the Hinkal newsletter",OUT_OF_MEMORY:e,OUT_OF_MEMORY2:e,OUT_OF_MEMORY3:e,INVALID_RECOVERY_PHRASE:"Invalid recovery phrase",PHRASES_DONT_MATCH:"Phrases do not match. You can go back and verify your recovery phrase.",PASSWORDS_DONT_MATCH:"Passwords do not match",PASSWORD_SAME_AS_OLD:"Password cannot be the same as the old one",PASSWORD_TOO_SMALL:"Password must be at least 8 characters",PASSWORD_NOT_CORRECT:"Incorrect current password",CODE_ALREADY_USED:"This code has already been used",ACCESS_CODE_REQUIRED:"Access code is required",ACCESS_CODE_IS_ALREADY_IN_USE:"Access code is already in use",ACCESS_CODE_IS_ALREADY_IN_USE1:"Access code already in use. Import or connect existing wallet",ERROR_DURING_PHRASE_CONFIRMATION:"Error during Phrase confirmation",INSUFFICIENT_LAMPORTS:"Your SOL balance is too low to complete this transaction"};exports.UserFriendlyErrorCodes=i;exports.gasErrorCodes=t;exports.insufficientResourcesErrorCodes=a;exports.transactionErrorCodes=o;exports.walletConnectErrorCodes=n;
|
|
@@ -15,7 +15,7 @@ version`
|
|
|
15
15
|
INSUFFICIENT_FUNDS_TO_TRANSACT: "Not enough funds to transact",
|
|
16
16
|
INSUFFICIENT_FUNDS_GAS: "Insufficient funds for gas * price"
|
|
17
17
|
}, r = {
|
|
18
|
-
GAS_PRICE_EXCEEDS_AUTOSHIELD_LIMIT: "
|
|
18
|
+
GAS_PRICE_EXCEEDS_AUTOSHIELD_LIMIT: "Skipped shielding due to gas fee exceeding your limit."
|
|
19
19
|
}, o = {
|
|
20
20
|
...a,
|
|
21
21
|
...t,
|
|
@@ -184,7 +184,7 @@ version`
|
|
|
184
184
|
OUT_OF_MEMORY2: e,
|
|
185
185
|
OUT_OF_MEMORY3: e,
|
|
186
186
|
INVALID_RECOVERY_PHRASE: "Invalid recovery phrase",
|
|
187
|
-
PHRASES_DONT_MATCH: "Phrases do not match. You can
|
|
187
|
+
PHRASES_DONT_MATCH: "Phrases do not match. You can go back and verify your recovery phrase.",
|
|
188
188
|
PASSWORDS_DONT_MATCH: "Passwords do not match",
|
|
189
189
|
PASSWORD_SAME_AS_OLD: "Password cannot be the same as the old one",
|
|
190
190
|
PASSWORD_TOO_SMALL: "Password must be at least 8 characters",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@coral-xyz/anchor"),N=require("ethers"),p=require("../../constants/protocol.constants.cjs"),I=(o,r,a,s,c,
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@coral-xyz/anchor"),N=require("ethers"),p=require("../../constants/protocol.constants.cjs"),I=(o,r,a,s,c,d,l,u)=>{const y=new t.BN(c.toString()),i=new t.BN(d.toString()),b=s.reduce((n,e)=>[...n,...new t.BN(e.length).toArray("be",8),...e],[]),g=l.reduce((n,e)=>{const A=[...new t.BN(e.programIndex).toArray("be",1),...new t.BN(e.accountIndexes.length).toArray("be",8),...e.accountIndexes,...new t.BN(e.data.length).toArray("be",8),...e.data];return[...n,...A]},[]),B=u.reduce((n,e)=>[...n,e.isWritable?1:0,...e.pubkey.toBytes()],[]),h=[o.tokenNumber,o.nullifierAmount,o.outputAmount,...r.toBytes(),...a.toBytes(),...b,...y.toArray("be",8),...i.toArray("be",8),...g,...B];return BigInt(N.ethers.utils.sha256(h))%p.CIRCOM_P};exports.getSolanaCalldataHash=I;
|