@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
|
@@ -17,6 +17,7 @@ import { SubAccount } from '../../types/proxy.types';
|
|
|
17
17
|
import { AdminTransactionType } from '../../types/admin.types';
|
|
18
18
|
import { Idl, Program } from '@coral-xyz/anchor';
|
|
19
19
|
import { PublicKey } from '@solana/web3.js';
|
|
20
|
+
import { BridgeRecipient } from '../../types/bridging-tx.types';
|
|
20
21
|
export interface IHinkal<ConnectorType = unknown> {
|
|
21
22
|
userKeys: UserKeys;
|
|
22
23
|
readonly signingMessage: string;
|
|
@@ -39,7 +40,9 @@ export interface IHinkal<ConnectorType = unknown> {
|
|
|
39
40
|
getStuckShieldedBalances(chainId: number, ethAddress?: string): Promise<TokenBalance[]>;
|
|
40
41
|
getSupportedPassportLinks(): string[];
|
|
41
42
|
checkAccessToken(chainId: number): Promise<boolean>;
|
|
43
|
+
getSupportedChains(): number[];
|
|
42
44
|
getEthereumAddress(): Promise<string>;
|
|
45
|
+
getEthereumAddressByChain(chainId: number): Promise<string>;
|
|
43
46
|
getHinkalTreeRootHash(chainId: number): Promise<bigint>;
|
|
44
47
|
getAccessTokenTreeRootHash(chainId: number): Promise<bigint>;
|
|
45
48
|
resetMerkleTreesIfNecessary(): Promise<void>;
|
|
@@ -56,6 +59,7 @@ export interface IHinkal<ConnectorType = unknown> {
|
|
|
56
59
|
deposit(erc20Tokens: ERC20Token[], amountChanges: bigint[]): Promise<ethers.ContractTransaction>;
|
|
57
60
|
depositForOther(erc20Tokens: ERC20Token[], amountChanges: bigint[], recepinetInfo: string): Promise<ethers.ContractTransaction>;
|
|
58
61
|
depositAndWithdraw(erc20Token: ERC20Token, recipientAmounts: bigint[], recipientAddresses: string[], txCompletionTime?: number, feeStructureOverride?: FeeStructure): Promise<string>;
|
|
62
|
+
depositAndBridge(erc20Token: ERC20Token, recipientBridges: BridgeRecipient[], txCompletionTime?: number, feeStructureOverride?: FeeStructure): Promise<string>;
|
|
59
63
|
prooflessDeposit(erc20Tokens: ERC20Token[], amountChanges: bigint[], stealthAddressStructures?: StealthAddressStructure[]): Promise<ethers.ContractTransaction>;
|
|
60
64
|
getSolanaProgram(idl: Idl): Program;
|
|
61
65
|
getSolanaPublicKey(): PublicKey;
|
|
@@ -65,13 +69,12 @@ export interface IHinkal<ConnectorType = unknown> {
|
|
|
65
69
|
withdraw(erc20Tokens: ERC20Token[], deltaAmounts: bigint[], recipientAddress: string, isRelayerOff: boolean, feeToken?: string, feeStructureOverride?: FeeStructure, action?: AdminTransactionType, onlyGasEstimate?: boolean): Promise<ethers.ContractTransaction | RelayerTransaction | bigint>;
|
|
66
70
|
withdrawStuckUtxos(erc20Token: ERC20Token, recipientAddress: string): Promise<RelayerTransaction[]>;
|
|
67
71
|
swap(erc20Tokens: ERC20Token[], deltaAmounts: bigint[], externalActionId: ExternalActionId, swapData: string, feeToken?: string, feeStructureOverride?: FeeStructure, action?: AdminTransactionType, onlyGasEstimate?: boolean, withPrivateMempool?: boolean): Promise<RelayerTransaction | bigint>;
|
|
68
|
-
getProviderAdapter(): IProviderAdapter;
|
|
72
|
+
getProviderAdapter(chainId: number): IProviderAdapter;
|
|
69
73
|
initUserKeys(isPrivateTransfer?: boolean): Promise<void>;
|
|
70
74
|
initUserKeysWithPassword(password: string): Promise<void>;
|
|
75
|
+
initUserKeysFromSeedPhrases(seedPhrases: string[]): Promise<void>;
|
|
71
76
|
initProviderAdapter(connector: ConnectorType, providerAdapter: IProviderAdapter<ConnectorType>): Promise<void>;
|
|
72
|
-
connectAndPatchProvider(connector: ConnectorType): Promise<number>;
|
|
73
77
|
disconnectFromConnector(): Promise<void>;
|
|
74
|
-
updateProviderAdapter(providerAdapter: IProviderAdapter): Promise<void>;
|
|
75
78
|
setListeners(providerAdapter: IProviderAdapter): Promise<void>;
|
|
76
79
|
waitForTransaction(chainId: number, transactionHash: string, confirmations?: number): Promise<boolean>;
|
|
77
80
|
getContract(chainId: number, contractType: ContractType, contractAddress?: string): ethers.Contract;
|
|
@@ -80,12 +83,12 @@ export interface IHinkal<ConnectorType = unknown> {
|
|
|
80
83
|
getContractWithFetcherByChainId(chainId: number, contractType: ContractType, contractAddress?: string): ethers.Contract;
|
|
81
84
|
isSelectedNetworkSupported(chainId: number): boolean;
|
|
82
85
|
switchNetwork(network: EthereumNetwork): Promise<unknown>;
|
|
83
|
-
monitorConnectedAddress(): Promise<void>;
|
|
84
|
-
isPermitterAvailable(): boolean;
|
|
86
|
+
monitorConnectedAddress(chainId: number): Promise<void>;
|
|
87
|
+
isPermitterAvailable(chainId: number): boolean;
|
|
85
88
|
signMessage(message: Bytes | string): Promise<string>;
|
|
86
89
|
signTypedData(domain: ethers.TypedDataDomain, types: Record<string, ethers.TypedDataField[]>, value: Record<string, unknown>): Promise<string>;
|
|
87
90
|
signWithSubAccount(chainId: number, messageToSign: string | undefined, typedData: TypedData | undefined, subAccount: SubAccount): Promise<string>;
|
|
88
|
-
actionPrivateWallet(chainId: number,
|
|
91
|
+
actionPrivateWallet(chainId: number, erc20Tokens: ERC20Token[], deltaAmounts: bigint[], onChainCreation: boolean[], ops: string[], emporiumTokenChanges: TokenChanges<bigint>[], subAccount: SubAccount, feeToken?: string, feeStructureOverride?: FeeStructure, relayOverride?: string, autoDepositBack?: boolean, maxGasInDollar?: string, action?: AdminTransactionType, privateRecipientInfo?: PrivateRecipientInfo, onlyGasEstimate?: boolean): Promise<RelayerTransaction | bigint>;
|
|
89
92
|
actionReceive(erc20Tokens: ERC20Token[], deltaAmounts: bigint[], feeTokens?: string, feeStructureOverride?: FeeStructure, subAccount?: SubAccount, action?: AdminTransactionType, onlyGasEstimate?: boolean): Promise<RelayerTransaction | bigint>;
|
|
90
93
|
proxySwap(erc20Tokens: ERC20Token[], deltaAmounts: bigint[], externalActionId: ExternalActionId, swapData: string, isTheSameChainSwap: boolean, subAccount: SubAccount, feeToken?: string, feeStructureOverride?: FeeStructure, autoDepositBack?: boolean, maxGasInDollar?: string, action?: AdminTransactionType, onlyGasEstimate?: boolean): Promise<RelayerTransaction | bigint>;
|
|
91
94
|
proxyToPrivate(erc20Tokens: ERC20Token[], deltaAmountsBase: bigint[], subAccount: SubAccount, recipientInfo: string, feeToken?: string, feeStructureOverride?: FeeStructure, action?: AdminTransactionType, onlyGasEstimate?: boolean): Promise<RelayerTransaction | bigint>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("../../API/API.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("../../API/API.cjs"),h=require("../../error-handling/get-error.message.cjs"),P=require("../../types/external-action.types.cjs"),p=require("../../types/transactions.types.cjs"),M=require("../../types/sandbox.types.cjs"),R=require("../../functions/private-wallet/emporium.helpers.cjs");require("ethers");require("../../constants/addresses.constants.cjs");require("../../constants/chains.constants.cjs");require("../../constants/token-data/index.cjs");const H=require("../../functions/utils/caseInsensitive.utils.cjs"),I=require("../../error-handling/logger.cjs");require("idb-keyval");const L=require("../../functions/utils/create-provider.cjs"),S=require("../../functions/utils/erc20tokenFunctions.cjs");require("../../functions/utils/convertIntegrationProviderToExternalActionId.cjs");require("../../types/circom-data.types.cjs");require("../../types/activities.types.cjs");const n=require("../../types/offscreen.types.cjs");require("circomlibjs-hinkal-fork");const w=require("../../functions/web3/etherFunctions.cjs");require("../crypto-keys/keys.cjs");const D=require("../../error-handling/error-codes.constants.cjs");require("../../constants/server.constants.cjs");require("../../API/getServerURL.cjs");require("../http/HttpClient.cjs");require("axios");require("../../constants/vite.constants.cjs");const N=require("../../functions/pre-transaction/getVolatileTransferAmount.cjs");require("@solana/web3.js");require("@coral-xyz/anchor");require("@solana/spl-token");require("ethers-v6h");require("tweetnacl");require("bs58");require("buffer");require("../../constants/contracts.constants.cjs");require("../../constants/kyc.constants.cjs");require("../../constants/coingecko.constants.cjs");require("../../constants/reorg-depths.constants.cjs");require("../../constants/token.limits.constants.cjs");require("../../constants/presale.constants.cjs");require("../../constants/activity.constants.cjs");require("../../constants/tasks.constants.cjs");require("../../constants/events.constants.cjs");require("../../functions/utils/userAgent.cjs");const U=require("../../functions/utils/convertEmporiumOpToCallInfo.cjs");require("libsodium-wrappers");const V=require("../../functions/utils/publicBalance.utils.cjs");require("async-mutex");const u=require("../../functions/utils/postToOffscreen.cjs");require("process");require("../../providers/EthersProviderAdapter.cjs");require("../../functions/web3/events/getInputUtxoAndBalance.cjs");require("../../functions/web3/events/getApprovedBalance.cjs");require("../../functions/web3/getTokenHolder.cjs");const j=require("../../functions/pre-transaction/getFeeStructure.cjs"),J=async(t,r,o,k,g,T,A,i)=>{if(o)try{const s=A.filter(e=>!H.caseInsensitiveEqual(e.token.erc20TokenAddress,g)&&!S.isNFTToken(e.token)).map(e=>e.token);if(!s.length)return;const E=L.createCustomRpcProvider(r),m=await Promise.all(s.map(async e=>{const _=await V.getPublicBalance(E,o,e);return BigInt(_?.balance||0)})),d=s.map(({erc20TokenAddress:e})=>e),C=await N.modifyVolatileTokenAmountChanges(r,s,m,o),y=R.createTransaferEmporiumOpsBatch(t,r,d,C),a=await j.getFeeStructure(r,g,d,P.ExternalActionId.Emporium,y.map(e=>U.convertEmporiumOpToCallInfo(e,o,r))),c=S.getERC20Token(a.feeToken,r);if(!c)return;const O=w.getAmountInToken(c,a.flatFee),{prices:B}=await b.API.getTokenPrices(r,[c.erc20TokenAddress]),F=B[0]*Number(O);if(T&&+T<F){u.postToOffscreen(n.MessagesFromOffscreen.AutoShieldTxStatus,{message:D.gasErrorCodes.GAS_PRICE_EXCEEDS_AUTOSHIELD_LIMIT});return}u.postToOffscreen(n.MessagesFromOffscreen.AutoShieldTxStatus,{status:p.TransactionStatus.Loading});const q=i.outCommitments?.flat(),f=i.encryptedOutputs?.flat(),l=i.inputNullifiers?.flat(),v=t.merkleTreeHinkalByChain[r].getStartIndex(),x=BigInt(t.merkleTreeHinkalByChain[r].toJSON().count);(q.length!==0||f.length!==0||l.length!==0)&&(q.length!==0&&q.forEach(e=>{e==="0"||e==="0x"||t.merkleTreeHinkalByChain[r].insert(BigInt(e),v+x)}),f.length!==0&&f.forEach(e=>{e==="0"||e==="0x"||t.encryptedOutputsByChain[r].push({value:e,isPositive:!0,isBlocked:!1})}),l.length!==0&&l.forEach(e=>{e==="0"||e==="0x"||t.nullifiersByChain[r].add(e)}),t.updateMerkleTreeUpdates(!1)),await t.actionReceive(s,m,a?.feeToken,void 0,k),u.postToOffscreen(n.MessagesFromOffscreen.AutoShieldTxStatus,{status:p.TransactionStatus.Confirmed})}catch(s){u.postToOffscreen(n.MessagesFromOffscreen.AutoShieldTxStatus,{status:p.TransactionStatus.Failed,error:h.getErrorMessageFromSandboxRequest(s,M.SandboxRequestType.ReceiveFromShieldedAccount)}),I.Logger.error("Error in auto deposit back:",s)}};exports.handleAutoDepositBack=J;
|
|
@@ -1,35 +1,39 @@
|
|
|
1
|
-
import { API as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { ExternalActionId as H } from "../../types/external-action.types.mjs";
|
|
1
|
+
import { API as h } from "../../API/API.mjs";
|
|
2
|
+
import { getErrorMessageFromSandboxRequest as P } from "../../error-handling/get-error.message.mjs";
|
|
3
|
+
import { ExternalActionId as R } from "../../types/external-action.types.mjs";
|
|
5
4
|
import { TransactionStatus as l } from "../../types/transactions.types.mjs";
|
|
6
|
-
import { SandboxRequestType as
|
|
7
|
-
import { createTransaferEmporiumOpsBatch as
|
|
5
|
+
import { SandboxRequestType as H } from "../../types/sandbox.types.mjs";
|
|
6
|
+
import { createTransaferEmporiumOpsBatch as L } from "../../functions/private-wallet/emporium.helpers.mjs";
|
|
8
7
|
import "ethers";
|
|
9
8
|
import "../../constants/addresses.constants.mjs";
|
|
9
|
+
import "../../constants/chains.constants.mjs";
|
|
10
10
|
import "../../constants/token-data/index.mjs";
|
|
11
|
-
import { caseInsensitiveEqual as
|
|
12
|
-
import { Logger as
|
|
11
|
+
import { caseInsensitiveEqual as M } from "../../functions/utils/caseInsensitive.utils.mjs";
|
|
12
|
+
import { Logger as _ } from "../../error-handling/logger.mjs";
|
|
13
13
|
import "idb-keyval";
|
|
14
|
-
import { createCustomRpcProvider as
|
|
15
|
-
import { isNFTToken as
|
|
14
|
+
import { createCustomRpcProvider as q } from "../../functions/utils/create-provider.mjs";
|
|
15
|
+
import { isNFTToken as w, getERC20Token as I } from "../../functions/utils/erc20tokenFunctions.mjs";
|
|
16
16
|
import "../../functions/utils/convertIntegrationProviderToExternalActionId.mjs";
|
|
17
17
|
import "../../types/circom-data.types.mjs";
|
|
18
18
|
import "../../types/activities.types.mjs";
|
|
19
19
|
import { MessagesFromOffscreen as m } from "../../types/offscreen.types.mjs";
|
|
20
20
|
import "circomlibjs-hinkal-fork";
|
|
21
|
-
import { getAmountInToken as
|
|
21
|
+
import { getAmountInToken as N } from "../../functions/web3/etherFunctions.mjs";
|
|
22
22
|
import "../crypto-keys/keys.mjs";
|
|
23
|
-
import { gasErrorCodes as
|
|
23
|
+
import { gasErrorCodes as D } from "../../error-handling/error-codes.constants.mjs";
|
|
24
24
|
import "../../constants/server.constants.mjs";
|
|
25
25
|
import "../../API/getServerURL.mjs";
|
|
26
26
|
import "../http/HttpClient.mjs";
|
|
27
27
|
import "axios";
|
|
28
28
|
import "../../constants/vite.constants.mjs";
|
|
29
|
-
import { modifyVolatileTokenAmountChanges as
|
|
29
|
+
import { modifyVolatileTokenAmountChanges as U } from "../../functions/pre-transaction/getVolatileTransferAmount.mjs";
|
|
30
30
|
import "@solana/web3.js";
|
|
31
31
|
import "@coral-xyz/anchor";
|
|
32
32
|
import "@solana/spl-token";
|
|
33
|
+
import "ethers-v6h";
|
|
34
|
+
import "tweetnacl";
|
|
35
|
+
import "bs58";
|
|
36
|
+
import "buffer";
|
|
33
37
|
import "../../constants/contracts.constants.mjs";
|
|
34
38
|
import "../../constants/kyc.constants.mjs";
|
|
35
39
|
import "../../constants/coingecko.constants.mjs";
|
|
@@ -40,54 +44,49 @@ import "../../constants/activity.constants.mjs";
|
|
|
40
44
|
import "../../constants/tasks.constants.mjs";
|
|
41
45
|
import "../../constants/events.constants.mjs";
|
|
42
46
|
import "../../functions/utils/userAgent.mjs";
|
|
43
|
-
import { convertEmporiumOpToCallInfo as
|
|
47
|
+
import { convertEmporiumOpToCallInfo as J } from "../../functions/utils/convertEmporiumOpToCallInfo.mjs";
|
|
44
48
|
import "libsodium-wrappers";
|
|
45
|
-
import { getPublicBalance as
|
|
49
|
+
import { getPublicBalance as V } from "../../functions/utils/publicBalance.utils.mjs";
|
|
46
50
|
import "async-mutex";
|
|
47
|
-
import "../../
|
|
48
|
-
import { postToOffscreen as s } from "../../functions/utils/postToOffscreen.mjs";
|
|
51
|
+
import { postToOffscreen as p } from "../../functions/utils/postToOffscreen.mjs";
|
|
49
52
|
import "process";
|
|
50
|
-
import "buffer";
|
|
51
53
|
import "../../providers/EthersProviderAdapter.mjs";
|
|
52
|
-
import "
|
|
54
|
+
import "../../functions/web3/events/getInputUtxoAndBalance.mjs";
|
|
53
55
|
import "../../functions/web3/events/getApprovedBalance.mjs";
|
|
54
56
|
import "../../functions/web3/getTokenHolder.mjs";
|
|
55
|
-
import { getFeeStructure as
|
|
56
|
-
const
|
|
57
|
+
import { getFeeStructure as X } from "../../functions/pre-transaction/getFeeStructure.mjs";
|
|
58
|
+
const Qt = async (o, r, i, S, T, g, E, s) => {
|
|
57
59
|
if (i)
|
|
58
60
|
try {
|
|
59
|
-
const e =
|
|
61
|
+
const e = E.filter((t) => !M(t.token.erc20TokenAddress, T) && !w(t.token)).map((t) => t.token);
|
|
60
62
|
if (!e.length)
|
|
61
63
|
return;
|
|
62
|
-
const
|
|
63
|
-
if (!k)
|
|
64
|
-
throw new Error(`No RPC URL configured for chain ${r}`);
|
|
65
|
-
const A = _(k), d = await Promise.all(
|
|
64
|
+
const C = q(r), k = await Promise.all(
|
|
66
65
|
e.map(async (t) => {
|
|
67
|
-
const
|
|
68
|
-
return BigInt(
|
|
66
|
+
const b = await V(C, i, t);
|
|
67
|
+
return BigInt(b?.balance || 0);
|
|
69
68
|
})
|
|
70
|
-
),
|
|
69
|
+
), d = e.map(({ erc20TokenAddress: t }) => t), A = await U(r, e, k, i), B = L(o, r, d, A), n = await X(
|
|
71
70
|
r,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
), a =
|
|
71
|
+
T,
|
|
72
|
+
d,
|
|
73
|
+
R.Emporium,
|
|
74
|
+
B.map((t) => J(t, i, r))
|
|
75
|
+
), a = I(n.feeToken, r);
|
|
77
76
|
if (!a)
|
|
78
77
|
return;
|
|
79
|
-
const
|
|
80
|
-
if (
|
|
81
|
-
|
|
82
|
-
message:
|
|
78
|
+
const x = N(a, n.flatFee), { prices: y } = await h.getTokenPrices(r, [a.erc20TokenAddress]), v = y[0] * Number(x);
|
|
79
|
+
if (g && +g < v) {
|
|
80
|
+
p(m.AutoShieldTxStatus, {
|
|
81
|
+
message: D.GAS_PRICE_EXCEEDS_AUTOSHIELD_LIMIT
|
|
83
82
|
});
|
|
84
83
|
return;
|
|
85
84
|
}
|
|
86
|
-
|
|
87
|
-
const
|
|
88
|
-
(
|
|
89
|
-
t === "0" || t === "0x" || o.merkleTreeHinkalByChain[r].insert(BigInt(t),
|
|
90
|
-
}),
|
|
85
|
+
p(m.AutoShieldTxStatus, { status: l.Loading });
|
|
86
|
+
const u = s.outCommitments?.flat(), f = s.encryptedOutputs?.flat(), c = s.inputNullifiers?.flat(), F = o.merkleTreeHinkalByChain[r].getStartIndex(), O = BigInt(o.merkleTreeHinkalByChain[r].toJSON().count);
|
|
87
|
+
(u.length !== 0 || f.length !== 0 || c.length !== 0) && (u.length !== 0 && u.forEach((t) => {
|
|
88
|
+
t === "0" || t === "0x" || o.merkleTreeHinkalByChain[r].insert(BigInt(t), F + O);
|
|
89
|
+
}), f.length !== 0 && f.forEach((t) => {
|
|
91
90
|
t === "0" || t === "0x" || o.encryptedOutputsByChain[r].push({
|
|
92
91
|
value: t,
|
|
93
92
|
isPositive: !0,
|
|
@@ -95,14 +94,14 @@ const Kt = async (o, r, i, E, g, T, C, n) => {
|
|
|
95
94
|
});
|
|
96
95
|
}), c.length !== 0 && c.forEach((t) => {
|
|
97
96
|
t === "0" || t === "0x" || o.nullifiersByChain[r].add(t);
|
|
98
|
-
}), o.updateMerkleTreeUpdates(!1)), await o.actionReceive(e,
|
|
97
|
+
}), o.updateMerkleTreeUpdates(!1)), await o.actionReceive(e, k, n?.feeToken, void 0, S), p(m.AutoShieldTxStatus, { status: l.Confirmed });
|
|
99
98
|
} catch (e) {
|
|
100
|
-
|
|
99
|
+
p(m.AutoShieldTxStatus, {
|
|
101
100
|
status: l.Failed,
|
|
102
|
-
error:
|
|
103
|
-
}),
|
|
101
|
+
error: P(e, H.ReceiveFromShieldedAccount)
|
|
102
|
+
}), _.error("Error in auto deposit back:", e);
|
|
104
103
|
}
|
|
105
104
|
};
|
|
106
105
|
export {
|
|
107
|
-
|
|
106
|
+
Qt as handleAutoDepositBack
|
|
108
107
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("../../functions/private-wallet/emporium.helpers.cjs"),g=require("../../functions/pre-transaction/getFeeStructure.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("../../functions/private-wallet/emporium.helpers.cjs"),g=require("../../functions/pre-transaction/getFeeStructure.cjs"),q=require("../../functions/utils/convertEmporiumOpToCallInfo.cjs"),E=require("../../types/external-action.types.cjs"),w=require("../../functions/pre-transaction/getVolatileTransferAmount.cjs"),C=require("../../functions/utils/token-check.utils.cjs"),S=require("../AccountActions/AccountActions.cjs"),b=async(c,t,l,i,d,n,m,p=!1)=>{if(!n)throw Error("hinkalActionReceive: subAccount should be provided");if(!i)throw new Error("Fee token is required in hinkalActionReceive");const e=C.validateAndGetChainId(t),a=S.AccountActions.getAddressFromSubAccount(e,n);if(!a)throw Error("Public account address is not available");const s=t.map(r=>r.erc20TokenAddress),o=await w.modifyVolatileTokenAmountChanges(e,t,l,a),u=f.createTransaferEmporiumOpsBatch(c,e,s,o),A=d??await g.getFeeStructure(e,i,s,E.ExternalActionId.Emporium,u.map(r=>q.convertEmporiumOpToCallInfo(r,a,e))),v=t.map((r,h)=>({token:r,amount:-1n*o[h]}));return c.actionPrivateWallet(e,t,o,o.map(()=>!1),u,v,n,i,A,void 0,void 0,void 0,m,void 0,p)};exports.hinkalActionReceive=b;
|
|
@@ -1,43 +1,46 @@
|
|
|
1
|
-
import { createTransaferEmporiumOpsBatch as
|
|
1
|
+
import { createTransaferEmporiumOpsBatch as h } from "../../functions/private-wallet/emporium.helpers.mjs";
|
|
2
2
|
import { getFeeStructure as w } from "../../functions/pre-transaction/getFeeStructure.mjs";
|
|
3
3
|
import { convertEmporiumOpToCallInfo as E } from "../../functions/utils/convertEmporiumOpToCallInfo.mjs";
|
|
4
4
|
import { ExternalActionId as g } from "../../types/external-action.types.mjs";
|
|
5
|
-
import { modifyVolatileTokenAmountChanges as
|
|
6
|
-
import { UserKeys as C } from "../crypto-keys/keys.mjs";
|
|
5
|
+
import { modifyVolatileTokenAmountChanges as C } from "../../functions/pre-transaction/getVolatileTransferAmount.mjs";
|
|
7
6
|
import { validateAndGetChainId as I } from "../../functions/utils/token-check.utils.mjs";
|
|
8
|
-
|
|
7
|
+
import { AccountActions as b } from "../AccountActions/AccountActions.mjs";
|
|
8
|
+
const q = async (m, t, d, e, p, a, l, u = !1) => {
|
|
9
9
|
if (!a)
|
|
10
10
|
throw Error("hinkalActionReceive: subAccount should be provided");
|
|
11
|
-
if (!
|
|
11
|
+
if (!e)
|
|
12
12
|
throw new Error("Fee token is required in hinkalActionReceive");
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
const o = I(t), n = b.getAddressFromSubAccount(o, a);
|
|
14
|
+
if (!n)
|
|
15
|
+
throw Error("Public account address is not available");
|
|
16
|
+
const s = t.map((r) => r.erc20TokenAddress), i = await C(o, t, d, n), c = h(m, o, s, i), f = p ?? await w(
|
|
17
|
+
o,
|
|
18
|
+
e,
|
|
19
|
+
s,
|
|
17
20
|
g.Emporium,
|
|
18
|
-
|
|
19
|
-
),
|
|
20
|
-
token:
|
|
21
|
-
amount: -1n *
|
|
21
|
+
c.map((r) => E(r, n, o))
|
|
22
|
+
), A = t.map((r, v) => ({
|
|
23
|
+
token: r,
|
|
24
|
+
amount: -1n * i[v]
|
|
22
25
|
}));
|
|
23
26
|
return m.actionPrivateWallet(
|
|
24
|
-
|
|
25
|
-
n,
|
|
27
|
+
o,
|
|
26
28
|
t,
|
|
27
|
-
t.map(() => !1),
|
|
28
|
-
d,
|
|
29
|
-
u,
|
|
30
|
-
a,
|
|
31
29
|
i,
|
|
32
|
-
|
|
30
|
+
i.map(() => !1),
|
|
31
|
+
c,
|
|
32
|
+
A,
|
|
33
|
+
a,
|
|
34
|
+
e,
|
|
35
|
+
f,
|
|
33
36
|
void 0,
|
|
34
37
|
void 0,
|
|
35
38
|
void 0,
|
|
36
39
|
l,
|
|
37
40
|
void 0,
|
|
38
|
-
|
|
41
|
+
u
|
|
39
42
|
);
|
|
40
43
|
};
|
|
41
44
|
export {
|
|
42
|
-
|
|
45
|
+
q as hinkalActionReceive
|
|
43
46
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("ethers");require("idb-keyval");const u=require("../../constants/chains.constants.cjs"),q=require("../../functions/utils/create-provider.cjs");require("../../constants/token-data/index.cjs");require("../../error-handling/error-codes.constants.cjs");require("../../functions/utils/convertIntegrationProviderToExternalActionId.cjs");require("../../types/circom-data.types.cjs");require("../../types/transactions.types.cjs");require("../../types/activities.types.cjs");require("circomlibjs-hinkal-fork");require("../crypto-keys/keys.cjs");require("../../constants/server.constants.cjs");require("../../API/getServerURL.cjs");require("../http/HttpClient.cjs");require("axios");require("../../constants/vite.constants.cjs");require("@solana/web3.js");require("@coral-xyz/anchor");require("@solana/spl-token");require("ethers-v6h");require("tweetnacl");require("bs58");require("buffer");require("../../constants/contracts.constants.cjs");require("../../constants/kyc.constants.cjs");require("../../constants/coingecko.constants.cjs");require("../../constants/reorg-depths.constants.cjs");require("../../constants/addresses.constants.cjs");require("../../constants/token.limits.constants.cjs");require("../../constants/presale.constants.cjs");require("../../constants/activity.constants.cjs");require("../../constants/tasks.constants.cjs");require("../../constants/events.constants.cjs");require("../../functions/utils/userAgent.cjs");require("libsodium-wrappers");require("multiformats");require("../../API/enclaveCalls.cjs");require("async-mutex");require("process");require("../../providers/EthersProviderAdapter.cjs");const n=async(r,e,i)=>await r.checkTokenRegistry(e,i),a=r=>{const e=u.networkRegistry[r].contractData,i=q.createCustomRpcProvider(r);if(!e.hinkalHelperAddress||!e.hinkalHelperABI)throw Error("hinkal helpercontract data not found");return new t.ethers.Contract(e.hinkalHelperAddress,e.hinkalHelperABI,i)};exports.createHinkalHelperFromData=a;exports.hinkalCheckTokenRegistry=n;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ethers as
|
|
1
|
+
import { ethers as i } from "ethers";
|
|
2
2
|
import "idb-keyval";
|
|
3
3
|
import { networkRegistry as p } from "../../constants/chains.constants.mjs";
|
|
4
|
-
import { createCustomRpcProvider as
|
|
4
|
+
import { createCustomRpcProvider as m } from "../../functions/utils/create-provider.mjs";
|
|
5
5
|
import "../../constants/token-data/index.mjs";
|
|
6
6
|
import "../../error-handling/error-codes.constants.mjs";
|
|
7
7
|
import "../../functions/utils/convertIntegrationProviderToExternalActionId.mjs";
|
|
@@ -18,6 +18,10 @@ import "../../constants/vite.constants.mjs";
|
|
|
18
18
|
import "@solana/web3.js";
|
|
19
19
|
import "@coral-xyz/anchor";
|
|
20
20
|
import "@solana/spl-token";
|
|
21
|
+
import "ethers-v6h";
|
|
22
|
+
import "tweetnacl";
|
|
23
|
+
import "bs58";
|
|
24
|
+
import "buffer";
|
|
21
25
|
import "../../constants/contracts.constants.mjs";
|
|
22
26
|
import "../../constants/kyc.constants.mjs";
|
|
23
27
|
import "../../constants/coingecko.constants.mjs";
|
|
@@ -31,21 +35,17 @@ import "../../constants/events.constants.mjs";
|
|
|
31
35
|
import "../../functions/utils/userAgent.mjs";
|
|
32
36
|
import "libsodium-wrappers";
|
|
33
37
|
import "multiformats";
|
|
38
|
+
import "../../API/enclaveCalls.mjs";
|
|
34
39
|
import "async-mutex";
|
|
35
|
-
import "../../API/tenderly.api.mjs";
|
|
36
40
|
import "process";
|
|
37
|
-
import "buffer";
|
|
38
41
|
import "../../providers/EthersProviderAdapter.mjs";
|
|
39
|
-
const
|
|
40
|
-
const r = p[t].contractData,
|
|
41
|
-
if (!o)
|
|
42
|
-
throw new Error("RPC URL not found for the specified chain ID");
|
|
43
|
-
const i = e(o);
|
|
42
|
+
const W = async (t, r, o) => await t.checkTokenRegistry(r, o), X = (t) => {
|
|
43
|
+
const r = p[t].contractData, o = m(t);
|
|
44
44
|
if (!r.hinkalHelperAddress || !r.hinkalHelperABI)
|
|
45
45
|
throw Error("hinkal helpercontract data not found");
|
|
46
|
-
return new
|
|
46
|
+
return new i.Contract(r.hinkalHelperAddress, r.hinkalHelperABI, o);
|
|
47
47
|
};
|
|
48
48
|
export {
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
X as createHinkalHelperFromData,
|
|
50
|
+
W as hinkalCheckTokenRegistry
|
|
51
51
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("../../constants/protocol.constants.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("../../constants/protocol.constants.cjs"),I=require("../../functions/pre-transaction/outputUtxoProcessing.cjs"),C=require("../../functions/snarkjs/constructGeneralZkProof.cjs"),_=require("../../functions/web3/events/getShieldedBalance.cjs"),h=require("../../functions/web3/functionCalls/transactCallDirect.cjs"),q=require("../utxo/Utxo.cjs"),f=require("../../error-handling/error-codes.constants.cjs");require("../../types/circom-data.types.cjs");const M=require("../../types/ethereum-network.types.cjs");require("../../types/transactions.types.cjs");const S=require("../../types/admin.types.cjs");require("../../types/activities.types.cjs");const F=require("../../functions/pre-transaction/getSignatureDataForTransact.cjs"),R=require("../../functions/utils/addresses.cjs"),z=require("../../functions/pre-transaction/shouldPatchAccessTokenMerkleTree.cjs"),H=require("../../functions/utils/time.utils.cjs"),U=require("../../API/admin-calls.cjs"),k=require("../../functions/pre-transaction/constructAdminData.cjs"),K=require("../../functions/utils/token-check.utils.cjs"),B=async(t,o,r,a)=>{const{patchAccessTokenMerkleTree:e,kycRequired:s,hasAccessToken:A}=await z.shouldPatchAccessTokenMerkleTree(t,o,r,a),i=void 0,p=await t.getEthereumAddressByChain(o),d=await F.getSignatureDataForTransact(o,p,t.userKeys,s,A),c={externalActionId:0n,externalAddress:await t.getEthereumAddressByChain(o),externalActionMetadata:"0x00"};return{signatureData:d,externalActionData:c,contractTransaction:i,contractToApprove:i,patchAccessTokenMerkleTree:e}},O=async(t,o,r)=>{const a=K.validateAndGetChainId(o),e=o.map(n=>n.erc20TokenAddress),{externalActionData:s,contractTransaction:A,contractToApprove:i,patchAccessTokenMerkleTree:p,signatureData:d}=await B(t,a,e,r),c=[...await _.addPaddingToUtxos(t,a,e,r)],y=`swapperM${r.length.toString()}x${c[0].length}x1`,u=[],T=H.getCurrentTimeInSeconds().toString();for(let n=0;n<e.length;n+=1){const{outputUtxos:P}=I.outputUtxoProcessing(t.userKeys,c[n],r[n],T);u.push(P)}const{zkCallData:m,circomData:x,dimData:D}=await C.constructZkProof("v1x1",t.merkleTreeHinkalByChain[a],t.merkleTreeAccessTokenByChain[a],c,u,t.userKeys,y,s.externalActionId,s.externalAddress,s.externalActionMetadata,t.generateProofRemotely,w.zeroAddress,a,void 0,void 0,void 0,p,void 0,void 0,void 0,t.getContractWithFetcher(a,M.ContractType.HinkalHelperContract),d),v=await h.transactCallDirect(t,a,r,o,m,x,D,i,A),g=k.constructAdminData(S.AdminTransactionType.Onboarding,a,e,r,await t.getEthereumAddressByChain(a));return U.emitTxPublicData(g),v},b=async(t,o,r,a)=>{const e=K.validateAndGetChainId(o),s=o.map(l=>l.erc20TokenAddress),[A,i,p]=a.split(",");if(!R.isValidPrivateAddress(a))throw Error(f.transactionErrorCodes.RECIPIENT_FORMAT_INCORRECT);const d=s.map(l=>[new q.Utxo({amount:0n,erc20TokenAddress:l,shieldedPrivateKey:t.userKeys.getShieldedPrivateKey()}),new q.Utxo({amount:0n,erc20TokenAddress:l,shieldedPrivateKey:t.userKeys.getShieldedPrivateKey()})]),c=`swapperM${r.length.toString()}x${d[0].length}x1`,y=s.map((l,E)=>[new q.Utxo({amount:r[E],erc20TokenAddress:l,randomization:BigInt(A),stealthAddress:i,encryptionKey:p})]),{externalActionData:u,contractTransaction:T,contractToApprove:m,patchAccessTokenMerkleTree:x}=await B(t,e,s,r),{zkCallData:D,circomData:v,dimData:g}=await C.constructZkProof("v1x1",t.merkleTreeHinkalByChain[e],t.merkleTreeAccessTokenByChain[e],d,y,t.userKeys,c,u.externalActionId,u.externalAddress,u.externalActionMetadata,t.generateProofRemotely,w.zeroAddress,e,void 0,void 0,void 0,x,void 0,void 0,void 0,t.getContractWithFetcher(e,M.ContractType.HinkalHelperContract)),n=await h.transactCallDirect(t,e,r,o,D,v,g,m,T),P=k.constructAdminData(S.AdminTransactionType.PaymentLink,e,s,r,await t.getEthereumAddressByChain(e));return U.emitTxPublicData(P),n};exports.hinkalDeposit=O;exports.hinkalDepositForOther=b;
|