@hinkal/common 0.3.6 → 0.3.8
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/README.md +1 -0
- package/common/src/API/API.cjs +1 -1
- package/common/src/API/API.d.ts +6 -5
- package/common/src/API/API.mjs +75 -74
- package/common/src/API/admin-calls.cjs +1 -1
- package/common/src/API/admin-calls.d.ts +1 -1
- package/common/src/API/admin-calls.mjs +3 -1
- package/common/src/API/callLifiAPI.d.ts +1 -0
- package/common/src/API/callNearIntentsAPI.cjs +1 -1
- package/common/src/API/callNearIntentsAPI.mjs +2 -2
- package/common/src/API/callRelayer.cjs +1 -1
- package/common/src/API/callRelayer.d.ts +32 -1
- package/common/src/API/callRelayer.mjs +7 -1
- package/common/src/API/enclaveUtxoCalls.cjs +1 -1
- package/common/src/API/enclaveUtxoCalls.d.ts +16 -16
- package/common/src/API/enclaveUtxoCalls.mjs +3 -3
- package/common/src/API/evm-rpc-fallback.cjs +1 -0
- package/common/src/API/evm-rpc-fallback.d.ts +1 -0
- package/common/src/API/evm-rpc-fallback.mjs +17 -0
- package/common/src/API/evm-token-assets.cjs +1 -0
- package/common/src/API/evm-token-assets.d.ts +8 -0
- package/common/src/API/evm-token-assets.mjs +20 -0
- package/common/src/API/index.cjs +1 -1
- package/common/src/API/index.d.ts +1 -0
- package/common/src/API/index.mjs +1 -0
- package/common/src/API/route-config.cjs +1 -0
- package/common/src/API/route-config.d.ts +1 -0
- package/common/src/API/route-config.mjs +26 -0
- package/common/src/API/solana-nft-assets.cjs +1 -0
- package/common/src/API/solana-nft-assets.d.ts +1 -0
- package/common/src/API/solana-nft-assets.mjs +11 -0
- package/common/src/API/solana-priority-fee.cjs +1 -0
- package/common/src/API/solana-priority-fee.d.ts +3 -0
- package/common/src/API/solana-priority-fee.mjs +20 -0
- package/common/src/API/solana-rpc-fallback.cjs +1 -0
- package/common/src/API/solana-rpc-fallback.d.ts +1 -0
- package/common/src/API/solana-rpc-fallback.mjs +13 -0
- package/common/src/API/temporaryWalletCalls.cjs +1 -1
- package/common/src/API/temporaryWalletCalls.d.ts +0 -4
- package/common/src/API/temporaryWalletCalls.mjs +1 -5
- package/common/src/constants/balance.constants.d.ts +2 -0
- package/common/src/constants/bridging.constants.d.ts +1 -0
- package/common/src/constants/chains.constants.cjs +1 -1
- package/common/src/constants/chains.constants.d.ts +0 -3
- package/common/src/constants/chains.constants.mjs +33 -54
- package/common/src/constants/coingecko.constants.cjs +1 -1
- package/common/src/constants/coingecko.constants.mjs +1 -1
- package/common/src/constants/contracts.constants.cjs +1 -1
- package/common/src/constants/contracts.constants.d.ts +1 -0
- package/common/src/constants/contracts.constants.mjs +19 -15
- package/common/src/constants/deploy-data/deploy-data-arbMainnet.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-arbMainnet.json.mjs +3 -2
- package/common/src/constants/deploy-data/deploy-data-arcTestnet.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-arcTestnet.json.mjs +3 -2
- package/common/src/constants/deploy-data/deploy-data-base.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-base.json.mjs +3 -2
- package/common/src/constants/deploy-data/deploy-data-bnbMainnet.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-bnbMainnet.json.mjs +3 -2
- package/common/src/constants/deploy-data/deploy-data-ethMainnet.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-ethMainnet.json.mjs +3 -2
- package/common/src/constants/deploy-data/deploy-data-optimism.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-optimism.json.mjs +7 -6
- package/common/src/constants/deploy-data/deploy-data-polygon.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-polygon.json.mjs +3 -2
- package/common/src/constants/deploy-data/deploy-data-tempo.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-tempo.json.mjs +3 -2
- package/common/src/constants/deploy-data/shared-deploy-data-evm.json.cjs +1 -1
- package/common/src/constants/deploy-data/shared-deploy-data-evm.json.mjs +18 -1
- package/common/src/constants/deploy-data/shared-deploy-data-solana.json.cjs +1 -1
- package/common/src/constants/deploy-data/shared-deploy-data-solana.json.mjs +1 -1
- package/common/src/constants/okx.constants.d.ts +1 -0
- package/common/src/constants/protocol.constants.cjs +2 -2
- package/common/src/constants/protocol.constants.d.ts +4 -1
- package/common/src/constants/protocol.constants.mjs +3 -8
- package/common/src/constants/server.constants.cjs +1 -1
- package/common/src/constants/server.constants.d.ts +7 -2
- package/common/src/constants/server.constants.mjs +8 -3
- package/common/src/constants/vite.constants.cjs +1 -1
- package/common/src/constants/vite.constants.mjs +5 -23
- package/common/src/data-structures/ApprovalDBs/EventsPublicApprovalsDB.d.ts +1 -2
- package/common/src/data-structures/Hinkal/Hinkal.cjs +1 -1
- package/common/src/data-structures/Hinkal/Hinkal.d.ts +4 -4
- package/common/src/data-structures/Hinkal/Hinkal.mjs +39 -39
- package/common/src/data-structures/Hinkal/IHinkal.d.ts +4 -4
- package/common/src/data-structures/Hinkal/hinkalActionReceive.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalActionReceive.mjs +11 -9
- package/common/src/data-structures/Hinkal/hinkalBridgePrivateToPrivate.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalBridgePrivateToPrivate.d.ts +2 -1
- package/common/src/data-structures/Hinkal/hinkalBridgePrivateToPrivate.mjs +81 -90
- package/common/src/data-structures/Hinkal/hinkalClaimUtxo.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalClaimUtxo.d.ts +1 -1
- package/common/src/data-structures/Hinkal/hinkalClaimUtxo.mjs +3 -5
- package/common/src/data-structures/Hinkal/hinkalDepositAndBridge.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalDepositAndBridge.mjs +100 -104
- package/common/src/data-structures/Hinkal/hinkalDepositAndWithdraw.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalDepositAndWithdraw.d.ts +1 -1
- package/common/src/data-structures/Hinkal/hinkalDepositAndWithdraw.mjs +86 -93
- package/common/src/data-structures/Hinkal/hinkalDepositOnChainUtxos.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalDepositOnChainUtxos.d.ts +20 -7
- package/common/src/data-structures/Hinkal/hinkalDepositOnChainUtxos.mjs +51 -39
- package/common/src/data-structures/Hinkal/hinkalPrivateWallet.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalPrivateWallet.mjs +2 -2
- package/common/src/data-structures/Hinkal/hinkalProxyToPrivate.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalProxyToPrivate.mjs +15 -13
- package/common/src/data-structures/Hinkal/hinkalSolanaClaimUtxo.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaClaimUtxo.d.ts +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaClaimUtxo.mjs +3 -5
- package/common/src/data-structures/Hinkal/hinkalSolanaDeposit.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaDeposit.mjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.d.ts +2 -2
- package/common/src/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.mjs +88 -121
- package/common/src/data-structures/Hinkal/hinkalSolanaProxySend.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaProxySend.mjs +1 -3
- package/common/src/data-structures/Hinkal/hinkalSolanaProxyShield.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaProxyShield.d.ts +24 -2
- package/common/src/data-structures/Hinkal/hinkalSolanaProxyShield.mjs +77 -58
- package/common/src/data-structures/Hinkal/hinkalSolanaProxySwap.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaProxySwap.mjs +1 -3
- package/common/src/data-structures/Hinkal/hinkalSolanaSponsoredProxySend.d.ts +5 -0
- package/common/src/data-structures/Hinkal/hinkalSolanaSponsoredShield.cjs +1 -0
- package/common/src/data-structures/Hinkal/hinkalSolanaSponsoredShield.d.ts +8 -0
- package/common/src/data-structures/Hinkal/hinkalSolanaSponsoredShield.mjs +31 -0
- package/common/src/data-structures/Hinkal/hinkalSolanaTransact.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaTransact.mjs +44 -42
- package/common/src/data-structures/Hinkal/hinkalSolanaWithdraw.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaWithdraw.d.ts +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaWithdraw.mjs +29 -24
- package/common/src/data-structures/Hinkal/hinkalSwap.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSwap.d.ts +1 -1
- package/common/src/data-structures/Hinkal/hinkalSwap.mjs +27 -24
- package/common/src/data-structures/Hinkal/hinkalTransact.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalTransact.mjs +73 -56
- package/common/src/data-structures/Hinkal/hinkalWithdraw.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalWithdraw.d.ts +1 -1
- package/common/src/data-structures/Hinkal/hinkalWithdraw.mjs +21 -18
- package/common/src/data-structures/Hinkal/hinkalWithdrawStuckUtxos.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalWithdrawStuckUtxos.mjs +19 -18
- package/common/src/data-structures/Hinkal/index.d.ts +2 -0
- package/common/src/data-structures/Hinkal/resetMerkleTrees.cjs +1 -1
- package/common/src/data-structures/Hinkal/resetMerkleTrees.mjs +2 -2
- package/common/src/data-structures/TokenDBs/AlchemyPublicTokensDB.cjs +1 -1
- package/common/src/data-structures/TokenDBs/AlchemyPublicTokensDB.d.ts +0 -1
- package/common/src/data-structures/TokenDBs/AlchemyPublicTokensDB.mjs +55 -119
- package/common/src/data-structures/crypto-keys/decodeUTXO.cjs +1 -1
- package/common/src/data-structures/crypto-keys/decodeUTXO.mjs +11 -61
- package/common/src/data-structures/event-service/evm/BlockchainEventEmitter.cjs +1 -1
- package/common/src/data-structures/event-service/evm/BlockchainEventEmitter.d.ts +2 -0
- package/common/src/data-structures/event-service/evm/BlockchainEventEmitter.mjs +41 -27
- package/common/src/data-structures/merkle-tree/MerkleTree.cjs +1 -1
- package/common/src/data-structures/merkle-tree/MerkleTree.d.ts +1 -0
- package/common/src/data-structures/merkle-tree/MerkleTree.mjs +3 -0
- package/common/src/error-handling/get-error.message.cjs +1 -1
- package/common/src/error-handling/get-error.message.mjs +1 -4
- package/common/src/functions/index.cjs +1 -1
- package/common/src/functions/index.mjs +9 -6
- package/common/src/functions/pre-transaction/calculateSolanaNullifierCount.cjs +1 -1
- package/common/src/functions/pre-transaction/calculateSolanaNullifierCount.mjs +2 -3
- package/common/src/functions/pre-transaction/index.cjs +1 -1
- package/common/src/functions/pre-transaction/index.d.ts +1 -0
- package/common/src/functions/pre-transaction/index.mjs +1 -1
- package/common/src/functions/pre-transaction/merge-with-fee-structure-emporium.cjs +1 -1
- package/common/src/functions/pre-transaction/merge-with-fee-structure-emporium.mjs +2 -2
- package/common/src/functions/pre-transaction/sendV0Transaction.cjs +2 -2
- package/common/src/functions/pre-transaction/sendV0Transaction.d.ts +5 -2
- package/common/src/functions/pre-transaction/sendV0Transaction.mjs +4 -4
- package/common/src/functions/pre-transaction/solanaTransfer.utils.cjs +1 -1
- package/common/src/functions/pre-transaction/solanaTransfer.utils.mjs +16 -15
- package/common/src/functions/pre-transaction/speculativeUtxo.cjs +1 -0
- package/common/src/functions/pre-transaction/speculativeUtxo.d.ts +9 -0
- package/common/src/functions/pre-transaction/speculativeUtxo.mjs +19 -0
- package/common/src/functions/private-wallet/emporium.helpers.cjs +1 -1
- package/common/src/functions/private-wallet/emporium.helpers.d.ts +9 -2
- package/common/src/functions/private-wallet/emporium.helpers.mjs +93 -74
- package/common/src/functions/snarkjs/common.snarkjs.cjs +1 -1
- package/common/src/functions/snarkjs/common.snarkjs.d.ts +1 -0
- package/common/src/functions/snarkjs/common.snarkjs.mjs +36 -32
- package/common/src/functions/snarkjs/constant.cjs +1 -1
- package/common/src/functions/snarkjs/constant.d.ts +48 -0
- package/common/src/functions/snarkjs/constant.mjs +48 -0
- package/common/src/functions/snarkjs/constructGeneralZkProof.cjs +1 -1
- package/common/src/functions/snarkjs/constructGeneralZkProof.d.ts +1 -1
- package/common/src/functions/snarkjs/constructGeneralZkProof.mjs +75 -71
- package/common/src/functions/snarkjs/constructSolanaZkProof.cjs +1 -1
- package/common/src/functions/snarkjs/constructSolanaZkProof.d.ts +1 -1
- package/common/src/functions/snarkjs/constructSolanaZkProof.mjs +27 -27
- package/common/src/functions/snarkjs/constructTxEnclave.cjs +1 -1
- package/common/src/functions/snarkjs/constructTxEnclave.mjs +8 -3
- package/common/src/functions/snarkjs/fetchOnChainRootHashes.cjs +1 -1
- package/common/src/functions/snarkjs/fetchOnChainRootHashes.mjs +10 -21
- package/common/src/functions/snarkjs/getMerkleTreeSiblingsAndRootHashes.cjs +1 -1
- package/common/src/functions/snarkjs/getMerkleTreeSiblingsAndRootHashes.d.ts +2 -2
- package/common/src/functions/snarkjs/getMerkleTreeSiblingsAndRootHashes.mjs +3 -3
- package/common/src/functions/snarkjs/signedMessageHash.cjs +1 -1
- package/common/src/functions/snarkjs/signedMessageHash.d.ts +4 -0
- package/common/src/functions/snarkjs/signedMessageHash.mjs +27 -18
- package/common/src/functions/utils/addresses.cjs +1 -1
- package/common/src/functions/utils/addresses.mjs +19 -12
- package/common/src/functions/utils/bridge-arrival.utils.cjs +1 -0
- package/common/src/functions/utils/bridge-arrival.utils.d.ts +1 -0
- package/common/src/functions/utils/bridge-arrival.utils.mjs +15 -0
- package/common/src/functions/utils/bridge-claimable-utxo.utils.cjs +1 -0
- package/common/src/functions/utils/bridge-claimable-utxo.utils.d.ts +19 -0
- package/common/src/functions/utils/bridge-claimable-utxo.utils.mjs +24 -0
- package/common/src/functions/utils/bridge-claimable.utils.d.ts +2 -3
- package/common/src/functions/utils/create-provider.cjs +1 -1
- package/common/src/functions/utils/create-provider.d.ts +9 -2
- package/common/src/functions/utils/create-provider.mjs +42 -9
- package/common/src/functions/utils/deposit-claimable.utils.cjs +1 -1
- package/common/src/functions/utils/deposit-claimable.utils.d.ts +2 -5
- package/common/src/functions/utils/deposit-claimable.utils.mjs +1 -6
- package/common/src/functions/utils/enclave-utxo-storage.cjs +1 -1
- package/common/src/functions/utils/enclave-utxo-storage.d.ts +4 -8
- package/common/src/functions/utils/enclave-utxo-storage.mjs +13 -2
- package/common/src/functions/utils/fees.utils.cjs +1 -1
- package/common/src/functions/utils/fees.utils.d.ts +2 -0
- package/common/src/functions/utils/fees.utils.mjs +15 -6
- package/common/src/functions/utils/getUtxosFromReceipt.utils.cjs +1 -1
- package/common/src/functions/utils/getUtxosFromReceipt.utils.d.ts +1 -1
- package/common/src/functions/utils/getUtxosFromReceipt.utils.mjs +5 -51
- package/common/src/functions/utils/getUtxosFromReceiptSolana.cjs +1 -1
- package/common/src/functions/utils/getUtxosFromReceiptSolana.mjs +7 -23
- package/common/src/functions/utils/index.cjs +1 -1
- package/common/src/functions/utils/index.d.ts +6 -0
- package/common/src/functions/utils/index.mjs +10 -4
- package/common/src/functions/utils/nearIntents.utils.cjs +1 -1
- package/common/src/functions/utils/nearIntents.utils.mjs +27 -13
- package/common/src/functions/utils/publicBalance.utils.cjs +1 -1
- package/common/src/functions/utils/publicBalance.utils.d.ts +0 -1
- package/common/src/functions/utils/publicBalance.utils.mjs +35 -22
- package/common/src/functions/utils/recovery-balance.utils.cjs +1 -0
- package/common/src/functions/utils/recovery-balance.utils.d.ts +2 -0
- package/common/src/functions/utils/recovery-balance.utils.mjs +1 -0
- package/common/src/functions/utils/solana-program.utils.cjs +1 -0
- package/common/src/functions/utils/solana-program.utils.d.ts +3 -0
- package/common/src/functions/utils/solana-program.utils.mjs +17 -0
- package/common/src/functions/utils/solana-sponsored.utils.cjs +1 -0
- package/common/src/functions/utils/solana-sponsored.utils.d.ts +22 -0
- package/common/src/functions/utils/solana-sponsored.utils.mjs +30 -0
- package/common/src/functions/utils/solanaMint.utils.cjs +1 -1
- package/common/src/functions/utils/solanaMint.utils.d.ts +7 -0
- package/common/src/functions/utils/solanaMint.utils.mjs +18 -8
- package/common/src/functions/utils/sponsored-shield.utils.cjs +1 -0
- package/common/src/functions/utils/sponsored-shield.utils.d.ts +3 -0
- package/common/src/functions/utils/sponsored-shield.utils.mjs +3 -0
- package/common/src/functions/utils/temp-wallet.utils.cjs +1 -1
- package/common/src/functions/utils/temp-wallet.utils.d.ts +5 -4
- package/common/src/functions/utils/temp-wallet.utils.mjs +35 -14
- package/common/src/functions/utils/transfer-claimable.utils.cjs +1 -1
- package/common/src/functions/utils/transfer-claimable.utils.d.ts +1 -2
- package/common/src/functions/utils/transfer-claimable.utils.mjs +2 -5
- package/common/src/functions/utils/tron.utils.cjs +1 -1
- package/common/src/functions/utils/tron.utils.d.ts +2 -2
- package/common/src/functions/utils/tron.utils.mjs +19 -18
- package/common/src/functions/utils/tronSimulation.utils.cjs +1 -1
- package/common/src/functions/utils/tronSimulation.utils.mjs +4 -6
- package/common/src/functions/utils/tx-confirmation.utils.cjs +1 -1
- package/common/src/functions/utils/tx-confirmation.utils.mjs +1 -1
- package/common/src/functions/web3/events/getInputUtxosEnclave.cjs +1 -1
- package/common/src/functions/web3/events/getInputUtxosEnclave.mjs +15 -25
- package/common/src/functions/web3/functionCalls/submitProof.cjs +1 -1
- package/common/src/functions/web3/functionCalls/submitProof.mjs +6 -6
- package/common/src/functions/web3/functionCalls/transactCallRelayer.cjs +1 -1
- package/common/src/functions/web3/functionCalls/transactCallRelayer.d.ts +2 -2
- package/common/src/functions/web3/functionCalls/transactCallRelayer.mjs +8 -6
- package/common/src/functions/web3/getContractMetadata.cjs +1 -1
- package/common/src/functions/web3/getContractMetadata.mjs +1 -1
- package/common/src/functions/web3/getPublicAddressBalance.cjs +1 -1
- package/common/src/functions/web3/getPublicAddressBalance.d.ts +1 -2
- package/common/src/functions/web3/getPublicAddressBalance.mjs +6 -5
- package/common/src/functions/web3/index.cjs +1 -1
- package/common/src/functions/web3/index.d.ts +1 -1
- package/common/src/functions/web3/index.mjs +1 -1
- package/common/src/providers/SolanaProviderAdapter.cjs +1 -1
- package/common/src/providers/SolanaProviderAdapter.mjs +1 -2
- package/common/src/providers/WagmiProviderAdapter.cjs +1 -1
- package/common/src/providers/WagmiProviderAdapter.mjs +35 -38
- package/common/src/types/bridging-tx.types.d.ts +1 -4
- package/common/src/types/cache.types.cjs +1 -1
- package/common/src/types/cache.types.d.ts +0 -1
- package/common/src/types/cache.types.mjs +1 -1
- package/common/src/types/ethereum-network.types.cjs +1 -1
- package/common/src/types/ethereum-network.types.d.ts +9 -7
- package/common/src/types/ethereum-network.types.mjs +1 -1
- package/common/src/types/external-action.types.cjs +1 -1
- package/common/src/types/external-action.types.d.ts +1 -0
- package/common/src/types/external-action.types.mjs +1 -1
- package/common/src/types/index.cjs +1 -1
- package/common/src/types/index.d.ts +1 -1
- package/common/src/types/index.mjs +1 -1
- package/common/src/types/pay-activities.types.d.ts +3 -1
- package/common/src/types/remote-tx-build.types.d.ts +23 -0
- package/common/src/types/scheduled-transactions.types.d.ts +4 -12
- package/common/src/types/solana.types.cjs +1 -0
- package/common/src/types/solana.types.d.ts +5 -0
- package/common/src/types/solana.types.mjs +6 -0
- package/common/src/types/temp-wallet.types.d.ts +9 -0
- package/common/src/types/token.types.d.ts +1 -0
- package/common/src/webworker/logError-RKYfeI6h.js +2 -0
- package/common/src/webworker/package.json +20 -20
- package/common/src/webworker/snarkjsWorker/snarkjsWorkerLauncher.ts?worker&url.cjs +1 -1
- package/common/src/webworker/snarkjsWorker/snarkjsWorkerLauncher.ts?worker&url.mjs +1 -1
- package/common/src/webworker/snarkjsWorkerNode.cjs +1 -1
- package/common/src/webworker/utxoWorker/utxoWorkerLauncher.ts?worker&url.cjs +1 -1
- package/common/src/webworker/utxoWorker/utxoWorkerLauncher.ts?worker&url.mjs +1 -1
- package/common/src/webworker/utxoWorkerNode.cjs +1 -1
- package/common/src/webworker/viteWorkerURL.constant.cjs +28 -1
- package/common/src/webworker/viteWorkerURL.constant.mjs +27 -13
- package/common/src/webworker/workerProxy-COB7g4Qc.js +1 -0
- package/common/src/webworker/zkProofWorker/zkProofWorkerLauncher.ts?worker&url.cjs +1 -1
- package/common/src/webworker/zkProofWorker/zkProofWorkerLauncher.ts?worker&url.mjs +1 -1
- package/common/src/webworker/zkProofWorkerNode.cjs +1 -1
- package/package.json +20 -20
- package/services/Hinkal.cjs +1 -1
- package/services/Hinkal.d.ts +2 -2
- package/services/Hinkal.mjs +3 -3
- package/types/IHinkal.d.ts +2 -2
- package/assets/snarkjsWorkerLauncher-SrStwJvX.js +0 -1
- package/assets/snarkjsWorkerLogic-DtIjisbE.js +0 -132
- package/assets/utxoWorkerLauncher-CIBeBAML.js +0 -1
- package/assets/utxoWorkerLogic-C8R4GSaf.js +0 -199
- package/assets/zkProofWorkerLauncher-DfwteloJ.js +0 -1
- package/assets/zkProofWorkerLogic-CY9y6rOV.js +0 -199
- package/common/src/API/deposit-and-withdraw-status-calls.cjs +0 -1
- package/common/src/API/deposit-and-withdraw-status-calls.d.ts +0 -21
- package/common/src/API/deposit-and-withdraw-status-calls.mjs +0 -13
- package/common/src/data-structures/Hinkal/hinkalTronDepositToSelf.cjs +0 -1
- package/common/src/data-structures/Hinkal/hinkalTronDepositToSelf.d.ts +0 -8
- package/common/src/data-structures/Hinkal/hinkalTronDepositToSelf.mjs +0 -30
- package/common/src/data-structures/Hinkal/prepareTronDepositToSelf.cjs +0 -1
- package/common/src/data-structures/Hinkal/prepareTronDepositToSelf.mjs +0 -31
- package/common/src/functions/pre-transaction/waitForDepositedUtxosInMerkleTree.cjs +0 -1
- package/common/src/functions/pre-transaction/waitForDepositedUtxosInMerkleTree.mjs +0 -29
- package/common/src/functions/utils/enum.utils.cjs +0 -1
- package/common/src/functions/utils/enum.utils.mjs +0 -12
- package/common/src/functions/web3/getSolanaPriorityFee.cjs +0 -1
- package/common/src/functions/web3/getSolanaPriorityFee.d.ts +0 -3
- package/common/src/functions/web3/getSolanaPriorityFee.mjs +0 -26
- package/common/src/types/scheduled-transactions.types.cjs +0 -1
- package/common/src/types/scheduled-transactions.types.mjs +0 -6
- package/common/src/webworker/logError-Dex6ch32.js +0 -2
- package/common/src/webworker/workerProxy-BuJUMCQ4.js +0 -1
|
@@ -1,16 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { getNonLocalhostChainId as e } from "../../../constants/chains.constants.mjs";
|
|
2
|
+
import { ContractType as t } from "../../../types/ethereum-network.types.mjs";
|
|
3
|
+
import { Logger as n } from "../../../error-handling/logger.mjs";
|
|
4
|
+
import { getDepositOnChainUtxosAddress as r } from "../../../constants/contracts.constants.mjs";
|
|
5
|
+
import { getContractWithFetcherByChainId as i } from "../../../functions/web3/getContractMetadata.mjs";
|
|
6
|
+
import { getProviderFromContract as a } from "../../../functions/utils/getSignerFromContract.mjs";
|
|
7
|
+
import { getSequence as o, resolveSync as s } from "../../../functions/utils/resolve-sync.utils.mjs";
|
|
8
|
+
import { blockReorgDepth as c } from "../../../constants/reorg-depths.constants.mjs";
|
|
9
|
+
import { BlockchainEvent as l } from "../../BlockchainEvent/BlockchainEvent.mjs";
|
|
10
|
+
import { ethers as u } from "ethers";
|
|
7
11
|
//#region libs/shared/common/src/data-structures/event-service/evm/BlockchainEventEmitter.ts
|
|
8
|
-
var
|
|
12
|
+
var d = class {
|
|
9
13
|
RETRY_MIN_PAGE_SIZE = 100;
|
|
10
14
|
MAX_RETRIES = 20;
|
|
11
15
|
_chainId;
|
|
12
16
|
contract;
|
|
13
17
|
_latestBlockNumber;
|
|
18
|
+
_blockedUtxosContract;
|
|
14
19
|
_initialBlockNumber;
|
|
15
20
|
onEventsProcessed;
|
|
16
21
|
eventProcessors = /* @__PURE__ */ new Set();
|
|
@@ -47,45 +52,54 @@ var s = class {
|
|
|
47
52
|
requireReady() {
|
|
48
53
|
if (!this._isReady) throw Error("Not ready");
|
|
49
54
|
}
|
|
50
|
-
async getEventsForSingleContract(e, t, n, r = 0) {
|
|
55
|
+
async getEventsForSingleContract(e, t, n, r = 0, i = "*") {
|
|
51
56
|
try {
|
|
52
|
-
return (await e.queryFilter(
|
|
53
|
-
} catch (
|
|
57
|
+
return (await e.queryFilter(i, t, n)).filter((e) => e instanceof u.EventLog);
|
|
58
|
+
} catch (a) {
|
|
54
59
|
if (r < this.MAX_RETRIES && n - t > this.RETRY_MIN_PAGE_SIZE) {
|
|
55
|
-
let
|
|
56
|
-
return [...
|
|
60
|
+
let a = Math.floor((t + n) / 2), o = await this.getEventsForSingleContract(e, t, a, r + 1, i), s = await this.getEventsForSingleContract(e, a + 1, n, r + 1, i);
|
|
61
|
+
return [...o, ...s];
|
|
57
62
|
}
|
|
58
|
-
throw
|
|
63
|
+
throw a;
|
|
59
64
|
}
|
|
60
65
|
}
|
|
66
|
+
get blockedUtxosContract() {
|
|
67
|
+
if (this._blockedUtxosContract === void 0) {
|
|
68
|
+
let n = e(this._chainId);
|
|
69
|
+
this._blockedUtxosContract = r(n) ? i(n, t.DepositOnChainUtxosContract) : null;
|
|
70
|
+
}
|
|
71
|
+
return this._blockedUtxosContract ?? void 0;
|
|
72
|
+
}
|
|
61
73
|
addEventProcessorFunction(e) {
|
|
62
74
|
if (this._isReady) throw Error("Can't add event processor after event emitter initialized");
|
|
63
75
|
this.eventProcessors.add(e);
|
|
64
76
|
}
|
|
65
77
|
async getEventsInRange(e, t) {
|
|
66
78
|
let n = [];
|
|
67
|
-
return await
|
|
79
|
+
return await s(o(e, t, this.maxPageSize).map(({ from: e, to: t }) => async () => {
|
|
68
80
|
let r = await this.getEventsForSingleContract(this.contract, e, t);
|
|
69
81
|
n.push(...r);
|
|
70
|
-
|
|
82
|
+
let i = this.blockedUtxosContract;
|
|
83
|
+
i && n.push(...await this.getEventsForSingleContract(i, e, t, 0, "BlockedUtxosCreated"));
|
|
84
|
+
})), n.map((e) => l.fromEthers(e));
|
|
71
85
|
}
|
|
72
86
|
async getLastBlockNumberForEventRequest() {
|
|
73
|
-
let e = await
|
|
87
|
+
let e = await a(this.contract).getBlockNumber();
|
|
74
88
|
if (!this.isServer) return e;
|
|
75
|
-
let { chainId:
|
|
76
|
-
return Math.max(this.latestBlockNumber, e -
|
|
89
|
+
let { chainId: t } = await a(this.contract).getNetwork();
|
|
90
|
+
return Math.max(this.latestBlockNumber, e - c[Number(t)] + 1);
|
|
77
91
|
}
|
|
78
|
-
async retrieveEvents(
|
|
92
|
+
async retrieveEvents(e, t = !1) {
|
|
79
93
|
return this.requireReady(), await this.eventsFetchingMutex.runExclusive(async () => {
|
|
80
94
|
try {
|
|
81
|
-
if (this.inProgress && !
|
|
95
|
+
if (this.inProgress && !t) return !1;
|
|
82
96
|
this.inProgress = !0;
|
|
83
|
-
let
|
|
84
|
-
if (
|
|
85
|
-
let r = await this.getEventsInRange(
|
|
86
|
-
return await this.processEvents(r,
|
|
87
|
-
} catch (
|
|
88
|
-
return
|
|
97
|
+
let n = await this.getLastBlockNumberForEventRequest();
|
|
98
|
+
if (n < e) return this.inProgress = !1, !1;
|
|
99
|
+
let r = await this.getEventsInRange(e, n);
|
|
100
|
+
return await this.processEvents(r, n), this._latestBlockNumber = n, this.inProgress = !1, !0;
|
|
101
|
+
} catch (e) {
|
|
102
|
+
return n.error("retrieveEvents error", e), this.inProgress = !1, !1;
|
|
89
103
|
}
|
|
90
104
|
});
|
|
91
105
|
}
|
|
@@ -95,4 +109,4 @@ var s = class {
|
|
|
95
109
|
}
|
|
96
110
|
};
|
|
97
111
|
//#endregion
|
|
98
|
-
export {
|
|
112
|
+
export { d as BlockchainEventEmitter };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../../constants/protocol.constants.cjs`),t=require(`../../error-handling/logError.cjs`),n=require(`./MerkleTreeIncompleteError.cjs`);var r=class r{tree;count;index;reverseTree;static createWithData(e,t,n,i,a,o,s){return new r(a,o,s,e,t,n,i)}static create(t,n,i=e.MERKLE_LEVELS){return new r(t,i,n)}createReverseTree(){let e=new Map;for(let t=this.getStartIndex();t<this.getStartIndex()+this.count;t+=1n){let n=this.tree.get(t);n!==void 0&&e.set(n,t)}return e}constructor(e,t,n,r,i,a,o){this.hashFunction=e,this.levels=t,this.defaultNodeValue=n,this.tree=r??new Map,this.count=o??0n,this.index=a??2n**(t-1n),i?this.reverseTree=i:this.reverseTree=this.createReverseTree()}getStartIndex(){return 2n**(this.levels-1n)}logarithm2(e){let t=0n;for(;2n**t<e;)t+=1n;return t}bigIntMax(e,t){return e>t?e:t}forceInsert(e,t){if(t<this.getStartIndex())throw RangeError();this.tree.set(t,e),this.reverseTree.set(e,t);let n=this.index-this.getStartIndex(),r=this.logarithm2(n),i=t;for(let e=1n;e<=r;e+=1n){i/=2n;let e=this.hashFunction(this.tree.get(i*2n)||this.defaultNodeValue,this.tree.get(i*2n+1n)||this.defaultNodeValue);this.tree.set(i,e)}}insert(e,n){let r=!1;this.tree.has(n)&&(r=!0,t.logError(`Editing commitment index: ${n} `)),r||(this.count+=1n),this.index=this.bigIntMax(this.index,n+1n),this.forceInsert(e,n)}remove(e){this.forceInsert(this.defaultNodeValue,e)}completenessCheck(){if(this.count!==this.index-this.getStartIndex())throw new n.MerkleTreeIncompleteError}getRootHash(){this.completenessCheck();for(let e=1n;e<2n**this.levels;e*=2n)if(this.tree.get(e))return this.tree.get(e);return this.defaultNodeValue}getMerkleData(){return this.completenessCheck(),new Map(this.tree)}getValue(e){return this.tree.get(e)}getSiblingIndex(e){return e===1n?1n:e%2n==1n?e-1n:e+1n}getSiblingHashesForVerification(e){this.completenessCheck();let t=this.reverseTree.get(e);if(t===void 0)return Array(25).fill(0n);let n=[];for(;t!==0n;)n.push(this.tree.get(this.getSiblingIndex(t))??this.defaultNodeValue),t/=2n;return n.slice(0,25)}getSiblingSides(e){this.completenessCheck();let t=this.reverseTree.get(e);if(t===void 0)return Array(25).fill(0n);let n=[];for(;t!==0n;){let e=t%2n==0n?0n:1n;n.push(e),t/=2n}return n.slice(0,25)}toJSON(){let{tree:e,reverseTree:t,count:n,index:r}=this;return{tree:Object.fromEntries(e),reverseTree:Object.fromEntries(t),count:n.toString(),index:r.toString()}}toJSONLite(){let{tree:e,count:t,index:n}=this;return{tree:Object.fromEntries(e),count:t.toString(),index:n.toString()}}clone(){return r.createWithData(new Map(this.tree),new Map(this.reverseTree),this.index,this.count,this.hashFunction,this.levels,this.defaultNodeValue)}getIndex(){return this.index}getInsertionSiblingData(e){let t=[],n=[],r=e;for(;r!==0n;)t.push(this.tree.get(this.getSiblingIndex(r))??this.defaultNodeValue),n.push(r%2n==0n?0n:1n),r/=2n;return{siblings:t.slice(0,25),sides:n.slice(0,25)}}};exports.MerkleTree=r;
|
|
1
|
+
const e=require(`../../constants/protocol.constants.cjs`),t=require(`../../error-handling/logError.cjs`),n=require(`./MerkleTreeIncompleteError.cjs`);var r=class r{tree;count;index;reverseTree;static createWithData(e,t,n,i,a,o,s){return new r(a,o,s,e,t,n,i)}static create(t,n,i=e.MERKLE_LEVELS){return new r(t,i,n)}createReverseTree(){let e=new Map;for(let t=this.getStartIndex();t<this.getStartIndex()+this.count;t+=1n){let n=this.tree.get(t);n!==void 0&&e.set(n,t)}return e}constructor(e,t,n,r,i,a,o){this.hashFunction=e,this.levels=t,this.defaultNodeValue=n,this.tree=r??new Map,this.count=o??0n,this.index=a??2n**(t-1n),i?this.reverseTree=i:this.reverseTree=this.createReverseTree()}getStartIndex(){return 2n**(this.levels-1n)}logarithm2(e){let t=0n;for(;2n**t<e;)t+=1n;return t}bigIntMax(e,t){return e>t?e:t}forceInsert(e,t){if(t<this.getStartIndex())throw RangeError();this.tree.set(t,e),this.reverseTree.set(e,t);let n=this.index-this.getStartIndex(),r=this.logarithm2(n),i=t;for(let e=1n;e<=r;e+=1n){i/=2n;let e=this.hashFunction(this.tree.get(i*2n)||this.defaultNodeValue,this.tree.get(i*2n+1n)||this.defaultNodeValue);this.tree.set(i,e)}}insert(e,n){let r=!1;this.tree.has(n)&&(r=!0,t.logError(`Editing commitment index: ${n} `)),r||(this.count+=1n),this.index=this.bigIntMax(this.index,n+1n),this.forceInsert(e,n)}remove(e){this.forceInsert(this.defaultNodeValue,e)}completenessCheck(){if(this.count!==this.index-this.getStartIndex())throw new n.MerkleTreeIncompleteError}getRootHash(){this.completenessCheck();for(let e=1n;e<2n**this.levels;e*=2n)if(this.tree.get(e))return this.tree.get(e);return this.defaultNodeValue}getMerkleData(){return this.completenessCheck(),new Map(this.tree)}getValue(e){return this.tree.get(e)}contains(e){return this.reverseTree.has(e)}getSiblingIndex(e){return e===1n?1n:e%2n==1n?e-1n:e+1n}getSiblingHashesForVerification(e){this.completenessCheck();let t=this.reverseTree.get(e);if(t===void 0)return Array(25).fill(0n);let n=[];for(;t!==0n;)n.push(this.tree.get(this.getSiblingIndex(t))??this.defaultNodeValue),t/=2n;return n.slice(0,25)}getSiblingSides(e){this.completenessCheck();let t=this.reverseTree.get(e);if(t===void 0)return Array(25).fill(0n);let n=[];for(;t!==0n;){let e=t%2n==0n?0n:1n;n.push(e),t/=2n}return n.slice(0,25)}toJSON(){let{tree:e,reverseTree:t,count:n,index:r}=this;return{tree:Object.fromEntries(e),reverseTree:Object.fromEntries(t),count:n.toString(),index:r.toString()}}toJSONLite(){let{tree:e,count:t,index:n}=this;return{tree:Object.fromEntries(e),count:t.toString(),index:n.toString()}}clone(){return r.createWithData(new Map(this.tree),new Map(this.reverseTree),this.index,this.count,this.hashFunction,this.levels,this.defaultNodeValue)}getIndex(){return this.index}getInsertionSiblingData(e){let t=[],n=[],r=e;for(;r!==0n;)t.push(this.tree.get(this.getSiblingIndex(r))??this.defaultNodeValue),n.push(r%2n==0n?0n:1n),r/=2n;return{siblings:t.slice(0,25),sides:n.slice(0,25)}}};exports.MerkleTree=r;
|
|
@@ -63,6 +63,7 @@ export declare class MerkleTree<T> {
|
|
|
63
63
|
getRootHash(): T | undefined;
|
|
64
64
|
getMerkleData(): Map<bigint, T>;
|
|
65
65
|
getValue(index: bigint): T | undefined;
|
|
66
|
+
contains(value: T): boolean;
|
|
66
67
|
getSiblingIndex(index: bigint): bigint;
|
|
67
68
|
/**
|
|
68
69
|
* get sibling hashes needed by main.circom
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./error-codes.constants.cjs`),t=require(`./customErrors/ErrorWithAmount.cjs`),n=require(`./customErrors/FeeOverTransactionValueError.cjs`),r=require(`./types.cjs`),i=require(`./customErrors/customErrors.helpers.cjs`);require(`./customErrors/index.cjs`);const a=require(`../types/transaction.types.cjs`);require(`../types/index.cjs`);const o=require(`./isInsufficientFundsError.cjs`);var s=(e,t)=>{let n=t.reduce((e,t)=>{if(!(typeof e!=`object`||!e||!(t in e)))return e[t]},e);return typeof n==`string`&&n?n:void 0},c=e=>{if(typeof e==`object`&&e){let t=s(e,[`response`,`data`,`message`])??s(e,[`response`,`data`,`detail`])??s(e,[`data`,`message`])??s(e,[`data`,`detail`]);if(t)return t;if(`message`in e&&typeof e.message==`string`&&e.message)return e.message;if(`error`in e&&typeof e.error==`string`&&e.error)return e.error}if(e instanceof Error)return e.message;if(typeof e==`string`)return e},l=t=>{switch(t){case r.ErrorCategory.DEPOSIT:return`Deposit failed`;case r.ErrorCategory.SWAP:return`Swap failed`;case r.ErrorCategory.BRIDGE:return`Bridge failed`;case r.ErrorCategory.WITHDRAW:return`Send failed`;case r.ErrorCategory.Fund:return`Unshield failed`;case r.ErrorCategory.Receive:return`Shield failed`;case r.ErrorCategory.DappTransaction:return`DApp transaction failed`;case r.ErrorCategory.Approve:return`Approval failed`;default:return e.transactionErrorCodes.UNKNOWN}},u=(r,a)=>{if(r instanceof n.FeeOverTransactionValueError)return i.getGenericFeeOverTransactionValueErrorMessage(r,a);if(r instanceof t.ErrorWithAmount)
|
|
1
|
+
const e=require(`./error-codes.constants.cjs`),t=require(`./customErrors/ErrorWithAmount.cjs`),n=require(`./customErrors/FeeOverTransactionValueError.cjs`),r=require(`./types.cjs`),i=require(`./customErrors/customErrors.helpers.cjs`);require(`./customErrors/index.cjs`);const a=require(`../types/transaction.types.cjs`);require(`../types/index.cjs`);const o=require(`./isInsufficientFundsError.cjs`);var s=(e,t)=>{let n=t.reduce((e,t)=>{if(!(typeof e!=`object`||!e||!(t in e)))return e[t]},e);return typeof n==`string`&&n?n:void 0},c=e=>{if(typeof e==`object`&&e){let t=s(e,[`response`,`data`,`message`])??s(e,[`response`,`data`,`detail`])??s(e,[`data`,`message`])??s(e,[`data`,`detail`]);if(t)return t;if(`message`in e&&typeof e.message==`string`&&e.message)return e.message;if(`error`in e&&typeof e.error==`string`&&e.error)return e.error}if(e instanceof Error)return e.message;if(typeof e==`string`)return e},l=t=>{switch(t){case r.ErrorCategory.DEPOSIT:return`Deposit failed`;case r.ErrorCategory.SWAP:return`Swap failed`;case r.ErrorCategory.BRIDGE:return`Bridge failed`;case r.ErrorCategory.WITHDRAW:return`Send failed`;case r.ErrorCategory.Fund:return`Unshield failed`;case r.ErrorCategory.Receive:return`Shield failed`;case r.ErrorCategory.DappTransaction:return`DApp transaction failed`;case r.ErrorCategory.Approve:return`Approval failed`;default:return e.transactionErrorCodes.UNKNOWN}},u=(r,a)=>{if(r instanceof n.FeeOverTransactionValueError)return i.getGenericFeeOverTransactionValueErrorMessage(r,a);if(r instanceof t.ErrorWithAmount)return r.message;let s=c(r);if(s&&o.isInsufficientFundsError(s))return e.insufficientResourcesErrorCodes.INSUFFICIENT_FUNDS;if(s){let t=s.toLowerCase(),n=Object.keys(e.transactionErrorCodes).find(n=>t===e.transactionErrorCodes[n].toLowerCase());if(n&&n in e.UserFriendlyErrorCodes)return e.UserFriendlyErrorCodes[n];let r=Object.entries(e.transactionErrorCodes).find(([e,n])=>t.includes(n.toLowerCase()));if(r)return e.UserFriendlyErrorCodes[r[0]]??r[1];if(Object.values(e.DIRECTLY_SHOW_MESSAGE_ERROR_CODES).find(e=>t.includes(e.toLowerCase())))return s}return a?l(a):e.transactionErrorCodes.UNKNOWN},d=(e,t)=>{let n;switch(t){case a.TransactionRequestType.Send:case a.TransactionRequestType.ProxySend:n=r.ErrorCategory.WITHDRAW;break;case a.TransactionRequestType.SwapTokens:case a.TransactionRequestType.ProxySwapTokens:n=r.ErrorCategory.SWAP;break;case a.TransactionRequestType.ReceiveFromShieldedAccount:n=r.ErrorCategory.Receive;break;case a.TransactionRequestType.Fund:n=r.ErrorCategory.Fund;break;case a.TransactionRequestType.PrivateTransactionFromProxy:n=r.ErrorCategory.DappTransaction;break;default:n=void 0;break}return u(e,n)};exports.extractMessage=c,exports.getErrorMessage=u,exports.getErrorMessageFromTransactionRequest=d;
|
|
@@ -44,10 +44,7 @@ var u = (e, t) => {
|
|
|
44
44
|
}
|
|
45
45
|
}, p = (o, c) => {
|
|
46
46
|
if (o instanceof a) return s(o, c);
|
|
47
|
-
if (o instanceof i)
|
|
48
|
-
let { amount: e, message: t } = o;
|
|
49
|
-
return `${t} ${e}`;
|
|
50
|
-
}
|
|
47
|
+
if (o instanceof i) return o.message;
|
|
51
48
|
let u = d(o);
|
|
52
49
|
if (u && l(u)) return n.INSUFFICIENT_FUNDS;
|
|
53
50
|
if (u) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`./utils/abi.utils.cjs`),require(`./utils/serialize.utils.cjs`),require(`./utils/caseInsensitive.utils.cjs`),require(`./utils/amounts.utils.cjs`),require(`./web3/etherFunctions.cjs`),require(`./utils/time.utils.cjs`),require(`./utils/upToDateState.cjs`),require(`./utils/cacheFunctions.cjs`),require(`./utils/enclaveHandshakeService.cjs`),require(`./utils/encryptInputForEnclave.cjs`),require(`./utils/solanaMint.utils.cjs`),require(`./utils/serialize-utxos.utils.cjs`),require(`./utils/customEnclaveFunctionsRegister.cjs`),require(`./utils/addresses.cjs`),require(`./utils/tron.utils.cjs`),require(`./web3/events/getInputUtxoAndBalance.cjs`),require(`./utils/legacyKeys.cjs`),require(`./utils/auth.utils.cjs`),require(`./utils/string.utils.cjs`),require(`./utils/token-check.utils.cjs`),require(`./utils/map.utils.cjs`),require(`./utils/mutexes.utils.cjs`),require(`./utils/erc20tokenFunctions.cjs`),require(`./web3/events/getShieldedBalance.cjs`),require(`./pre-transaction/outputUtxoProcessing.cjs`),require(`./utils/external-action.utils.cjs`),require(`./snarkjs/common.snarkjs.cjs`),require(`./pre-transaction/solana.cjs`),require(`./snarkjs/signedMessageHash.cjs`),require(`./pre-transaction/process-gas-estimates.cjs`),require(`./pre-transaction/getVolatileTransferAmount.cjs`),require(`./pre-transaction/constructAdminData.cjs`),require(`./utils/create-provider.cjs`),require(`./pre-transaction/calculateSolanaNullifierCount.cjs`),require(`./pre-transaction/convert-okx-instructions.cjs`),require(`./
|
|
1
|
+
require(`./utils/abi.utils.cjs`),require(`./utils/serialize.utils.cjs`),require(`./utils/caseInsensitive.utils.cjs`),require(`./utils/amounts.utils.cjs`),require(`./web3/etherFunctions.cjs`),require(`./utils/time.utils.cjs`),require(`./utils/upToDateState.cjs`),require(`./utils/cacheFunctions.cjs`),require(`./utils/encodeTokenWithId.cjs`),require(`./utils/enclaveHandshakeService.cjs`),require(`./utils/encryptInputForEnclave.cjs`),require(`./utils/solanaMint.utils.cjs`),require(`./utils/serialize-utxos.utils.cjs`),require(`./utils/customEnclaveFunctionsRegister.cjs`),require(`./utils/addresses.cjs`),require(`./utils/tron.utils.cjs`),require(`./web3/events/getInputUtxoAndBalance.cjs`),require(`./utils/legacyKeys.cjs`),require(`./utils/auth.utils.cjs`),require(`./utils/string.utils.cjs`),require(`./utils/token-check.utils.cjs`),require(`./utils/map.utils.cjs`),require(`./utils/mutexes.utils.cjs`),require(`./utils/erc20tokenFunctions.cjs`),require(`./web3/events/getShieldedBalance.cjs`),require(`./pre-transaction/outputUtxoProcessing.cjs`),require(`./utils/external-action.utils.cjs`),require(`./snarkjs/common.snarkjs.cjs`),require(`./pre-transaction/solana.cjs`),require(`./snarkjs/signedMessageHash.cjs`),require(`./pre-transaction/process-gas-estimates.cjs`),require(`./pre-transaction/getVolatileTransferAmount.cjs`),require(`./pre-transaction/constructAdminData.cjs`),require(`./utils/create-provider.cjs`),require(`./pre-transaction/calculateSolanaNullifierCount.cjs`),require(`./pre-transaction/convert-okx-instructions.cjs`),require(`./utils/process.utils.cjs`),require(`./pre-transaction/sendV0Transaction.cjs`),require(`./utils/bytes32.utils.cjs`),require(`./pre-transaction/getFeeStructure.cjs`),require(`./pre-transaction/getExternalSwapAddress.cjs`),require(`./pre-transaction/speculativeUtxo.cjs`),require(`./pre-transaction/buildCommitmentValidationData.cjs`),require(`./pre-transaction/index.cjs`),require(`./snarkjs/generateZkProof.cjs`),require(`./snarkjs/generateMainAndCommitmentZkProof.cjs`),require(`./web3/getContractMetadata.cjs`),require(`./utils/solana-program.utils.cjs`),require(`./snarkjs/fetchOnChainRootHashes.cjs`),require(`./utils/getContractAddress.cjs`),require(`./private-wallet/emporium.helpers.cjs`),require(`./snarkjs/constructGeneralZkProof.cjs`),require(`./utils/getSignerFromContract.cjs`),require(`./utils/tronSimulation.utils.cjs`),require(`./utils/resolve-sync.utils.cjs`),require(`./utils/reloadPage.cjs`),require(`./utils/cacheDevice.utils.cjs`),require(`./utils/involves-permit2-op.cjs`),require(`./utils/convertEmporiumOpToCallInfo.cjs`),require(`./utils/getRecipientInfoFromUserKeys.cjs`),require(`./utils/publicBalance.utils.cjs`),require(`./utils/postToOffscreen.cjs`),require(`./utils/fees.utils.cjs`),require(`./utils/proxyAvatar.utils.cjs`),require(`./utils/enclave-utxo-storage.cjs`),require(`./utils/enclave-signature-storage.cjs`),require(`./utils/tx-confirmation.utils.cjs`),require(`./utils/bridge-arrival.utils.cjs`),require(`./utils/solana-sponsored.utils.cjs`),require(`./utils/temp-wallet.utils.cjs`),require(`./utils/mnemonics.cjs`),require(`./utils/nearIntents.utils.cjs`),require(`./utils/index.cjs`),require(`./web3/lifiAPI.cjs`),require(`./web3/okxAPI.cjs`),require(`./web3/index.cjs`),require(`./snarkjs/constructSolanaZkProof.cjs`),require(`./snarkjs/index.cjs`),require(`./private-wallet/emporium.swap.helpers.cjs`),require(`./private-wallet/index.cjs`),require(`./auto-deposit-back-helpers/get-tokens-to-deposit-back.cjs`),require(`./auto-deposit-back-helpers/get-gas-token-records.cjs`),require(`./auto-deposit-back-helpers/select-gas-token.cjs`),require(`./auto-deposit-back-helpers/update-hinkal.cjs`),require(`./auto-deposit-back-helpers/index.cjs`);
|
|
@@ -6,6 +6,7 @@ import "./web3/etherFunctions.mjs";
|
|
|
6
6
|
import "./utils/time.utils.mjs";
|
|
7
7
|
import "./utils/upToDateState.mjs";
|
|
8
8
|
import "./utils/cacheFunctions.mjs";
|
|
9
|
+
import "./utils/encodeTokenWithId.mjs";
|
|
9
10
|
import "./utils/enclaveHandshakeService.mjs";
|
|
10
11
|
import "./utils/encryptInputForEnclave.mjs";
|
|
11
12
|
import "./utils/solanaMint.utils.mjs";
|
|
@@ -33,37 +34,39 @@ import "./pre-transaction/constructAdminData.mjs";
|
|
|
33
34
|
import "./utils/create-provider.mjs";
|
|
34
35
|
import "./pre-transaction/calculateSolanaNullifierCount.mjs";
|
|
35
36
|
import "./pre-transaction/convert-okx-instructions.mjs";
|
|
36
|
-
import "./web3/getSolanaPriorityFee.mjs";
|
|
37
37
|
import "./utils/process.utils.mjs";
|
|
38
38
|
import "./pre-transaction/sendV0Transaction.mjs";
|
|
39
39
|
import "./utils/bytes32.utils.mjs";
|
|
40
40
|
import "./pre-transaction/getFeeStructure.mjs";
|
|
41
41
|
import "./pre-transaction/getExternalSwapAddress.mjs";
|
|
42
|
-
import "./pre-transaction/
|
|
42
|
+
import "./pre-transaction/speculativeUtxo.mjs";
|
|
43
43
|
import "./pre-transaction/buildCommitmentValidationData.mjs";
|
|
44
44
|
import "./pre-transaction/index.mjs";
|
|
45
45
|
import "./snarkjs/generateZkProof.mjs";
|
|
46
46
|
import "./snarkjs/generateMainAndCommitmentZkProof.mjs";
|
|
47
|
+
import "./web3/getContractMetadata.mjs";
|
|
48
|
+
import "./utils/solana-program.utils.mjs";
|
|
47
49
|
import "./snarkjs/fetchOnChainRootHashes.mjs";
|
|
48
50
|
import "./utils/getContractAddress.mjs";
|
|
49
51
|
import "./private-wallet/emporium.helpers.mjs";
|
|
50
52
|
import "./snarkjs/constructGeneralZkProof.mjs";
|
|
51
53
|
import "./utils/getSignerFromContract.mjs";
|
|
52
54
|
import "./utils/tronSimulation.utils.mjs";
|
|
53
|
-
import "./utils/tx-confirmation.utils.mjs";
|
|
54
|
-
import "./utils/getUtxosFromReceipt.utils.mjs";
|
|
55
|
-
import "./utils/getRecipientInfoFromUserKeys.mjs";
|
|
56
55
|
import "./utils/resolve-sync.utils.mjs";
|
|
57
56
|
import "./utils/reloadPage.mjs";
|
|
58
57
|
import "./utils/cacheDevice.utils.mjs";
|
|
59
58
|
import "./utils/involves-permit2-op.mjs";
|
|
60
59
|
import "./utils/convertEmporiumOpToCallInfo.mjs";
|
|
60
|
+
import "./utils/getRecipientInfoFromUserKeys.mjs";
|
|
61
61
|
import "./utils/publicBalance.utils.mjs";
|
|
62
62
|
import "./utils/postToOffscreen.mjs";
|
|
63
|
-
import "./utils/getUtxosFromReceiptSolana.mjs";
|
|
64
63
|
import "./utils/fees.utils.mjs";
|
|
65
64
|
import "./utils/proxyAvatar.utils.mjs";
|
|
65
|
+
import "./utils/enclave-utxo-storage.mjs";
|
|
66
66
|
import "./utils/enclave-signature-storage.mjs";
|
|
67
|
+
import "./utils/tx-confirmation.utils.mjs";
|
|
68
|
+
import "./utils/bridge-arrival.utils.mjs";
|
|
69
|
+
import "./utils/solana-sponsored.utils.mjs";
|
|
67
70
|
import "./utils/temp-wallet.utils.mjs";
|
|
68
71
|
import "./utils/mnemonics.mjs";
|
|
69
72
|
import "./utils/nearIntents.utils.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../constants/chains.constants.cjs`),t=require(`../../error-handling/logger.cjs`),n=require(`../web3/events/getShieldedBalance.cjs`),r=require(`./solana.cjs`),i=require(`../utils/create-provider.cjs`),a=require(`../snarkjs/constructTxEnclave.cjs`);let o=require(`@solana/web3.js`);var s=6,c=async(c,l,u,d)=>{if(!e.isSolanaLike(l)||u.length===0||d.length===0)return 0;if(c.generateProofRemotely)try{return await a.estimateNullifiersEnclaveCall(c,{chainId:l,mintAddresses:u,amountChanges:d})}catch(e){return t.Logger.error(`calculateSolanaNullifierCount: enclave estimate failed, charging maximum rent`,e),s}let f;try{f=(await n.addPaddingToUtxos(c,l,u,d,6)).flat().filter(e=>e.amount!==0n)}catch(e){return t.Logger.log(`Error during getting inputUtxos locally:`,e),s}if(f.length===0)return 0;try{let{
|
|
1
|
+
require(`../../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../constants/chains.constants.cjs`),t=require(`../../error-handling/logger.cjs`),n=require(`../web3/events/getShieldedBalance.cjs`),r=require(`./solana.cjs`),i=require(`../utils/create-provider.cjs`),a=require(`../snarkjs/constructTxEnclave.cjs`);let o=require(`@solana/web3.js`);var s=6,c=async(c,l,u,d)=>{if(!e.isSolanaLike(l)||u.length===0||d.length===0)return 0;if(c.generateProofRemotely)try{return await a.estimateNullifiersEnclaveCall(c,{chainId:l,mintAddresses:u,amountChanges:d})}catch(e){return t.Logger.error(`calculateSolanaNullifierCount: enclave estimate failed, charging maximum rent`,e),s}let f;try{f=(await n.addPaddingToUtxos(c,l,u,d,6)).flat().filter(e=>e.amount!==0n)}catch(e){return t.Logger.log(`Error during getting inputUtxos locally:`,e),s}if(f.length===0)return 0;try{let{contractData:t,rpcUrl:n}=e.networkRegistry[l],{originalDeployer:a,hinkalIdl:s}=t;if(!a)throw Error(`Original deployer not found for chain ID`);if(!s)throw Error(`Hinkal IDL not found for chain ID`);let c=i.createCustomSolanaConnection(n),u=new o.PublicKey(a),d=new o.PublicKey(s.address),p=f.map(e=>r.getNullifierAccount(BigInt(e.getNullifier()),u,d));return(await c.getMultipleAccountsInfo(p)).filter(e=>e===null).length}catch(e){return t.Logger.error(`calculateSolanaNullifierCount: nullifier probe failed, charging for every note`,e),f.length}};exports.calculateSolanaNullifierCount=c;
|
|
@@ -25,11 +25,10 @@ var c = 6, l = async (l, u, d, f) => {
|
|
|
25
25
|
}
|
|
26
26
|
if (p.length === 0) return 0;
|
|
27
27
|
try {
|
|
28
|
-
let {
|
|
29
|
-
if (!e) throw Error("RPC URL not found for chain ID");
|
|
28
|
+
let { contractData: e, rpcUrl: n } = t[u], { originalDeployer: r, hinkalIdl: o } = e;
|
|
30
29
|
if (!r) throw Error("Original deployer not found for chain ID");
|
|
31
30
|
if (!o) throw Error("Hinkal IDL not found for chain ID");
|
|
32
|
-
let c = a(
|
|
31
|
+
let c = a(n), l = new s(r), d = new s(o.address), f = p.map((e) => i(BigInt(e.getNullifier()), l, d));
|
|
33
32
|
return (await c.getMultipleAccountsInfo(f)).filter((e) => e === null).length;
|
|
34
33
|
} catch (e) {
|
|
35
34
|
return n.error("calculateSolanaNullifierCount: nullifier probe failed, charging for every note", e), p.length;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`./outputUtxoProcessing.cjs`),require(`./solana.cjs`),require(`./process-gas-estimates.cjs`),require(`./getVolatileTransferAmount.cjs`),require(`./constructAdminData.cjs`),require(`./calculateSolanaNullifierCount.cjs`),require(`./addressTableLookup.cjs`),require(`./convert-okx-instructions.cjs`),require(`./sendV0Transaction.cjs`),require(`./store-proof.cjs`),require(`./sendInitNullifiersTransaction.cjs`),require(`./store-instructions.cjs`),require(`./ensureAmountChanges.cjs`),require(`./getFeeStructure.cjs`),require(`./getExternalSwapAddress.cjs`),require(`./
|
|
1
|
+
require(`./outputUtxoProcessing.cjs`),require(`./solana.cjs`),require(`./process-gas-estimates.cjs`),require(`./getVolatileTransferAmount.cjs`),require(`./constructAdminData.cjs`),require(`./calculateSolanaNullifierCount.cjs`),require(`./addressTableLookup.cjs`),require(`./convert-okx-instructions.cjs`),require(`./sendV0Transaction.cjs`),require(`./store-proof.cjs`),require(`./sendInitNullifiersTransaction.cjs`),require(`./store-instructions.cjs`),require(`./ensureAmountChanges.cjs`),require(`./getFeeStructure.cjs`),require(`./getExternalSwapAddress.cjs`),require(`./speculativeUtxo.cjs`),require(`./buildCommitmentValidationData.cjs`);
|
|
@@ -13,5 +13,5 @@ import "./store-instructions.mjs";
|
|
|
13
13
|
import "./ensureAmountChanges.mjs";
|
|
14
14
|
import "./getFeeStructure.mjs";
|
|
15
15
|
import "./getExternalSwapAddress.mjs";
|
|
16
|
-
import "./
|
|
16
|
+
import "./speculativeUtxo.mjs";
|
|
17
17
|
import "./buildCommitmentValidationData.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../../constants/protocol.constants.cjs`),t=require(`../utils/amounts.utils.cjs`),n=require(`../../types/ethereum-network.types.cjs`),r=require(`../private-wallet/emporium.helpers.cjs`),i=require(`./merge-with-fee-structure.cjs`),a=require(`../web3/getPublicAddressBalance.cjs`);var o=async(o,s,c,l,u,d,f,p)=>{let m=0n,h=p<0n?p:0n,g=await a.getPublicAddressBalance(
|
|
1
|
+
const e=require(`../../constants/protocol.constants.cjs`),t=require(`../utils/amounts.utils.cjs`),n=require(`../../types/ethereum-network.types.cjs`),r=require(`../private-wallet/emporium.helpers.cjs`),i=require(`./merge-with-fee-structure.cjs`),a=require(`../web3/getPublicAddressBalance.cjs`);var o=async(o,s,c,l,u,d,f,p)=>{let m=0n,h=p<0n?p:0n,g=await a.getPublicAddressBalance(s,f.feeToken,c)+h;m=g<0?f.flatFee:t.maxBigInt(f.flatFee-g,0n),m!==0n&&(await i.mergeWithFeeStructure(s,u,d,{...f,flatFee:m}),l.push(r.createTransferToEmporiumOp(f.feeToken===e.zeroAddress?void 0:o.getContractWithFetcherByChainId(s,n.ContractType.ERC20Contract,f.feeToken),c,m,!1)))};exports.mergeWithFeeStructureEmporium=o;
|
|
@@ -6,11 +6,11 @@ import { mergeWithFeeStructure as i } from "./merge-with-fee-structure.mjs";
|
|
|
6
6
|
import { getPublicAddressBalance as a } from "../web3/getPublicAddressBalance.mjs";
|
|
7
7
|
//#region libs/shared/common/src/functions/pre-transaction/merge-with-fee-structure-emporium.ts
|
|
8
8
|
var o = async (o, s, c, l, u, d, f, p) => {
|
|
9
|
-
let m = 0n, h = p < 0n ? p : 0n, g = await a(
|
|
9
|
+
let m = 0n, h = p < 0n ? p : 0n, g = await a(s, f.feeToken, c) + h;
|
|
10
10
|
m = g < 0 ? f.flatFee : t(f.flatFee - g, 0n), m !== 0n && (await i(s, u, d, {
|
|
11
11
|
...f,
|
|
12
12
|
flatFee: m
|
|
13
|
-
}), l.push(r(f.feeToken === e ? void 0 : o.
|
|
13
|
+
}), l.push(r(f.feeToken === e ? void 0 : o.getContractWithFetcherByChainId(s, n.ERC20Contract, f.feeToken), c, m, !1)));
|
|
14
14
|
};
|
|
15
15
|
//#endregion
|
|
16
16
|
export { o as mergeWithFeeStructureEmporium };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
require(`../../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../utils/serialize.utils.cjs`),t=require(`../../constants/protocol.constants.cjs`),n=require(`../../error-handling/logger.cjs`),r=require(`../../data-structures/AccountActions/AccountActions.cjs`),i=require(`../../types/fee.types.cjs`),a=require(
|
|
2
|
-
`);n.Logger.error(`Solana transaction failed on-chain`,{signature:r,error:i,logs:t.meta.logMessages});let o=r?` (signature: ${r})`:``;throw Error(a?`Solana transaction failed on-chain${o}: ${i}\n${a}`:`Solana transaction failed on-chain${o}: ${i}`)}},h=async(e,n,r,i,o,s=!1)=>{if(r.some(e=>e.programId.equals(c.ComputeBudgetProgram.programId)))return r.map(e=>e.programId.equals(c.ComputeBudgetProgram.programId)&&e.data[0]===2?c.ComputeBudgetProgram.setComputeUnitLimit({units:t.MAX_COMPUTE_UNIT_LIMIT}):e);let l=r.filter(e=>!e.programId.equals(c.ComputeBudgetProgram.programId)),u=await f(e,n,l,i,s),d=c.ComputeBudgetProgram.setComputeUnitLimit({units:u}),m=
|
|
1
|
+
require(`../../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../utils/serialize.utils.cjs`),t=require(`../../constants/protocol.constants.cjs`),n=require(`../../error-handling/logger.cjs`),r=require(`../../data-structures/AccountActions/AccountActions.cjs`),i=require(`../../types/fee.types.cjs`),a=require(`../../API/solana-priority-fee.cjs`),o=require(`../utils/process.utils.cjs`),s=require(`../../error-handling/retrySolanaError.cjs`);let c=require(`@solana/web3.js`);require(`@solana/spl-token`);var l=5e3,u=6e4,d=async(e,t,n=`confirmed`)=>await o.pollForValue(()=>e.getTransaction(t,{commitment:n,maxSupportedTransactionVersion:0}),{timeoutMs:u,intervalMs:l})??null,f=async(r,i,a,o,s=!1)=>{try{let{blockhash:l}=await r.getLatestBlockhash(),u=new c.VersionedTransaction(new c.TransactionMessage({payerKey:i,recentBlockhash:l,instructions:[c.ComputeBudgetProgram.setComputeUnitLimit({units:t.MAX_COMPUTE_UNIT_LIMIT}),...s?[c.ComputeBudgetProgram.requestHeapFrame({bytes:t.MAX_SOLANA_HEAP_FRAME_BYTES})]:[],...a]}).compileToV0Message(o)),d=await r.simulateTransaction(u,{sigVerify:!1,replaceRecentBlockhash:!0});d.value.err&&n.Logger.error(`Solana compute-unit simulation failed:`,{error:e.safeJsonStringify(d.value.err),logs:d.value.logs});let{unitsConsumed:f}=d.value;if(!f)return t.MAX_COMPUTE_UNIT_LIMIT;let p=Math.ceil(f*(1+t.COMPUTE_UNIT_PADDING_PERCENTAGE));return Math.max(t.MIN_COMPUTE_UNIT_LIMIT,Math.min(p,t.MAX_COMPUTE_UNIT_LIMIT))}catch(e){return n.Logger.error(`Solana compute-unit estimation threw:`,e),t.MAX_COMPUTE_UNIT_LIMIT}},p=(e,t,n,r)=>{let i=new Set;return t&&i.add(t.toBase58()),n?.forEach(e=>i.add(e.toBase58())),e.forEach(e=>{i.add(e.programId.toBase58()),e.keys.forEach(e=>{i.add(e.pubkey.toBase58())})}),r&&r.forEach(e=>{i.add(e.key.toBase58()),e.state.addresses.forEach(e=>{i.add(e.toBase58())})}),[...i].map(e=>new c.PublicKey(e))},m=(t,r)=>{if(!t)throw Error(`Failed to fetch Solana transaction details for signature${r?` ${r}`:``}`);if(t.meta?.err){let i=e.safeJsonStringify(t.meta.err),a=t.meta.logMessages?.join(`
|
|
2
|
+
`);n.Logger.error(`Solana transaction failed on-chain`,{signature:r,error:i,logs:t.meta.logMessages});let o=r?` (signature: ${r})`:``;throw Error(a?`Solana transaction failed on-chain${o}: ${i}\n${a}`:`Solana transaction failed on-chain${o}: ${i}`)}},h=async(e,n,r,i,o,s=!1)=>{if(r.some(e=>e.programId.equals(c.ComputeBudgetProgram.programId)))return r.map(e=>e.programId.equals(c.ComputeBudgetProgram.programId)&&e.data[0]===2?c.ComputeBudgetProgram.setComputeUnitLimit({units:t.MAX_COMPUTE_UNIT_LIMIT}):e);let l=r.filter(e=>!e.programId.equals(c.ComputeBudgetProgram.programId)),u=await f(e,n,l,i,s),d=c.ComputeBudgetProgram.setComputeUnitLimit({units:u}),m=await a.getSolanaPriorityFeeFromServer(p(l,n,[c.ComputeBudgetProgram.programId],i),o);return[d,...m>0?[c.ComputeBudgetProgram.setComputeUnitPrice({microLamports:m})]:[],...s?[c.ComputeBudgetProgram.requestHeapFrame({bytes:t.MAX_SOLANA_HEAP_FRAME_BYTES})]:[],...l]},g=async({connection:e,chainId:t,subAccount:n,payerPublicKey:a,instructions:o,lookupTableAccounts:l})=>{let u=r.AccountActions.getPrivateKeyFromSubAccount(t,n);if(!u)throw Error(`Private key is not available`);for(let t=0;t<10;t+=1){let n=t===9;try{let t=await h(e,a,o,l,n?i.SolanaPriorityFeeMode.HIGH:i.SolanaPriorityFeeMode.RECOMMENDED),{blockhash:s,lastValidBlockHeight:f}=await e.getLatestBlockhash(),p=new c.VersionedTransaction(new c.TransactionMessage({payerKey:a,recentBlockhash:s,instructions:t}).compileToV0Message(l)),g=await r.AccountActions.sendAndSignSolanaTransactionFromPrivateKey(e,u,p,!0);return await e.confirmTransaction({signature:g,blockhash:s,lastValidBlockHeight:f},`confirmed`),m(await d(e,g),g),g}catch(e){if(s.shouldRetryForSolanaError(e)&&!n)continue;throw e}}throw Error(`Failed to send proxy v0 transaction due to expired blockheight after all retries`)};exports.estimateComputeUnitLimit=f,exports.fetchSolanaTransaction=d,exports.getAccountsFromInstructions=p,exports.handleSolanaTransactionError=m,exports.sendProxyV0Transaction=g;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { AddressLookupTableAccount, Connection, Finality, Keypair, PublicKey, TransactionInstruction, VersionedTransactionResponse } from '@solana/web3.js';
|
|
1
|
+
import { AddressLookupTableAccount, Connection, Finality, Keypair, PublicKey, TransactionInstruction, VersionedTransaction, VersionedTransactionResponse } from '@solana/web3.js';
|
|
2
2
|
import { SubAccount } from '../../types/proxy.types';
|
|
3
3
|
export declare const fetchSolanaTransaction: (connection: Connection, signature: string, finality?: Finality) => Promise<VersionedTransactionResponse | null>;
|
|
4
4
|
export declare const estimateComputeUnitLimit: (connection: Connection, payerKey: PublicKey, instructions: TransactionInstruction[], lookupTableAccounts?: AddressLookupTableAccount[], requestHeapFrame?: boolean) => Promise<number>;
|
|
5
5
|
export declare const getAccountsFromInstructions: (instructions: TransactionInstruction[], payerKey?: PublicKey, additionalAccounts?: PublicKey[], lookupTableAccounts?: AddressLookupTableAccount[]) => PublicKey[];
|
|
6
|
+
export declare const handleSolanaTransactionError: (transactionResponse: VersionedTransactionResponse | null, signature?: string) => void;
|
|
6
7
|
export declare const sendV0Transaction: (connection: Connection, instructions: TransactionInstruction[], payer: Keypair, signers: Keypair[], lookupTableAccounts?: AddressLookupTableAccount[], requestHeapFrame?: boolean) => Promise<string>;
|
|
8
|
+
export declare const sendSignedV0Transaction: (connection: Connection, transaction: VersionedTransaction) => Promise<string>;
|
|
7
9
|
export declare const ensureAtaExists: (connection: Connection, payer: Keypair, mintPubkey: PublicKey | null, owner: PublicKey) => Promise<PublicKey | null>;
|
|
8
10
|
type SendProxyV0TransactionParams = {
|
|
9
11
|
connection: Connection;
|
|
@@ -14,5 +16,6 @@ type SendProxyV0TransactionParams = {
|
|
|
14
16
|
lookupTableAccounts?: AddressLookupTableAccount[];
|
|
15
17
|
};
|
|
16
18
|
export declare const sendProxyV0Transaction: ({ connection, chainId, subAccount, payerPublicKey, instructions, lookupTableAccounts, }: SendProxyV0TransactionParams) => Promise<string>;
|
|
17
|
-
export declare const
|
|
19
|
+
export declare const buildProxyV0Transaction: (connection: Connection, signerPublicKey: PublicKey, instructions: TransactionInstruction[], lookupTableAccounts?: AddressLookupTableAccount[], feePayerPublicKey?: PublicKey) => Promise<VersionedTransaction>;
|
|
20
|
+
export declare const serializeProxyV0Transaction: (connection: Connection, signerPublicKey: PublicKey, instructions: TransactionInstruction[], lookupTableAccounts?: AddressLookupTableAccount[], feePayerPublicKey?: PublicKey) => Promise<string>;
|
|
18
21
|
export {};
|
|
@@ -3,7 +3,7 @@ import { COMPUTE_UNIT_PADDING_PERCENTAGE as t, MAX_COMPUTE_UNIT_LIMIT as n, MAX_
|
|
|
3
3
|
import { Logger as a } from "../../error-handling/logger.mjs";
|
|
4
4
|
import { AccountActions as o } from "../../data-structures/AccountActions/AccountActions.mjs";
|
|
5
5
|
import { SolanaPriorityFeeMode as s } from "../../types/fee.types.mjs";
|
|
6
|
-
import {
|
|
6
|
+
import { getSolanaPriorityFeeFromServer as c } from "../../API/solana-priority-fee.mjs";
|
|
7
7
|
import { pollForValue as l } from "../utils/process.utils.mjs";
|
|
8
8
|
import { shouldRetryForSolanaError as u } from "../../error-handling/retrySolanaError.mjs";
|
|
9
9
|
import { ComputeBudgetProgram as d, PublicKey as f, TransactionMessage as p, VersionedTransaction as m } from "@solana/web3.js";
|
|
@@ -65,10 +65,10 @@ var h = 5e3, g = 6e4, _ = async (e, t, n = "confirmed") => await l(() => e.getTr
|
|
|
65
65
|
}
|
|
66
66
|
}, x = async (e, t, i, a, o, s = !1) => {
|
|
67
67
|
if (i.some((e) => e.programId.equals(d.programId))) return i.map((e) => e.programId.equals(d.programId) && e.data[0] === 2 ? d.setComputeUnitLimit({ units: n }) : e);
|
|
68
|
-
let l = i.filter((e) => !e.programId.equals(d.programId)), u = await v(e, t, l, a, s), f = d.setComputeUnitLimit({ units: u }), p =
|
|
68
|
+
let l = i.filter((e) => !e.programId.equals(d.programId)), u = await v(e, t, l, a, s), f = d.setComputeUnitLimit({ units: u }), p = await c(y(l, t, [d.programId], a), o);
|
|
69
69
|
return [
|
|
70
70
|
f,
|
|
71
|
-
d.setComputeUnitPrice({ microLamports: p }),
|
|
71
|
+
...p > 0 ? [d.setComputeUnitPrice({ microLamports: p })] : [],
|
|
72
72
|
...s ? [d.requestHeapFrame({ bytes: r })] : [],
|
|
73
73
|
...l
|
|
74
74
|
];
|
|
@@ -96,4 +96,4 @@ var h = 5e3, g = 6e4, _ = async (e, t, n = "confirmed") => await l(() => e.getTr
|
|
|
96
96
|
throw Error("Failed to send proxy v0 transaction due to expired blockheight after all retries");
|
|
97
97
|
};
|
|
98
98
|
//#endregion
|
|
99
|
-
export { v as estimateComputeUnitLimit, _ as fetchSolanaTransaction, y as getAccountsFromInstructions, S as sendProxyV0Transaction };
|
|
99
|
+
export { v as estimateComputeUnitLimit, _ as fetchSolanaTransaction, y as getAccountsFromInstructions, b as handleSolanaTransactionError, S as sendProxyV0Transaction };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../../../../_virtual/_rolldown/runtime.cjs`),require(`../../constants/protocol.constants.cjs`);
|
|
1
|
+
require(`../../../../_virtual/_rolldown/runtime.cjs`),require(`../../constants/protocol.constants.cjs`);const e=require(`../utils/solanaMint.utils.cjs`);let t=require(`@solana/web3.js`),n=require(`@solana/spl-token`);var r=async(r,i,a,o,s)=>{let{erc20TokenAddress:c,is2022Program:l,decimals:u}=o,d=[];if(c===`11111111111111111111111111111111`)return d.push(t.SystemProgram.transfer({fromPubkey:i,toPubkey:a,lamports:Number(s)})),{instructions:d,programId:t.SystemProgram.programId};let f=e.getSolanaTokenProgramId(l),p=new t.PublicKey(c),m=await(0,n.getAssociatedTokenAddress)(p,i,!0,f),h=await(0,n.getAssociatedTokenAddress)(p,a,!0,f);return await r.getAccountInfo(h)||d.push((0,n.createAssociatedTokenAccountInstruction)(i,h,a,p,f)),l?d.push((0,n.createTransferCheckedInstruction)(m,p,h,i,s,u,[],f)):d.push((0,n.createTransferInstruction)(m,h,i,s,[],f)),{instructions:d,programId:f}};exports.buildSolanaTransferInstructions=r;
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import "../../constants/protocol.constants.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { getSolanaTokenProgramId as e } from "../utils/solanaMint.utils.mjs";
|
|
3
|
+
import { PublicKey as t, SystemProgram as n } from "@solana/web3.js";
|
|
4
|
+
import { createAssociatedTokenAccountInstruction as r, createTransferCheckedInstruction as i, createTransferInstruction as a, getAssociatedTokenAddress as o } from "@solana/spl-token";
|
|
4
5
|
//#region libs/shared/common/src/functions/pre-transaction/solanaTransfer.utils.ts
|
|
5
|
-
var
|
|
6
|
-
let { erc20TokenAddress:
|
|
7
|
-
if (
|
|
8
|
-
fromPubkey:
|
|
9
|
-
toPubkey:
|
|
10
|
-
lamports: Number(
|
|
6
|
+
var s = async (s, c, l, u, d) => {
|
|
7
|
+
let { erc20TokenAddress: f, is2022Program: p, decimals: m } = u, h = [];
|
|
8
|
+
if (f === "11111111111111111111111111111111") return h.push(n.transfer({
|
|
9
|
+
fromPubkey: c,
|
|
10
|
+
toPubkey: l,
|
|
11
|
+
lamports: Number(d)
|
|
11
12
|
})), {
|
|
12
|
-
instructions:
|
|
13
|
-
programId:
|
|
13
|
+
instructions: h,
|
|
14
|
+
programId: n.programId
|
|
14
15
|
};
|
|
15
|
-
let
|
|
16
|
-
return await
|
|
17
|
-
instructions:
|
|
18
|
-
programId:
|
|
16
|
+
let g = e(p), _ = new t(f), v = await o(_, c, !0, g), y = await o(_, l, !0, g);
|
|
17
|
+
return await s.getAccountInfo(y) || h.push(r(c, y, l, _, g)), p ? h.push(i(v, _, y, c, d, m, [], g)) : h.push(a(v, y, c, d, [], g)), {
|
|
18
|
+
instructions: h,
|
|
19
|
+
programId: g
|
|
19
20
|
};
|
|
20
21
|
};
|
|
21
22
|
//#endregion
|
|
22
|
-
export {
|
|
23
|
+
export { s as buildSolanaTransferInstructions };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=e=>({amount:e.amount.toString(),erc20TokenAddress:e.erc20TokenAddress,mintAddress:e.mintAddress??``,timeStamp:e.timeStamp,stealthAddress:BigInt(e.getStealthAddress()).toString(),isBlocked:e.isBlocked,H0:[(e.H0?.[0]??0n).toString(),(e.H0?.[1]??0n).toString()]}),t=(e,t,n)=>{let r=n.map(BigInt),i=r.filter(t=>e.contains(t)).length;if(i>0&&i!==r.length)throw Error(`Only some pending leaves are already in the Merkle tree`);let a=e;return i!==r.length&&(a=e.clone(),r.forEach(e=>a.insert(e,a.getIndex()))),t.flat().forEach(e=>{if(e.amount>0n&&!a.contains(BigInt(e.getCommitment())))throw Error(`Input commitment ${e.getCommitment()} is not in the speculative Merkle tree`)}),a};exports.speculativeMerkleTree=t,exports.toSpeculativeUtxo=e;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { MerkleTree } from '../../data-structures/merkle-tree';
|
|
2
|
+
import { Utxo } from '../../data-structures/utxo/Utxo';
|
|
3
|
+
import { SpeculativeUtxo } from '../../types/remote-tx-build.types';
|
|
4
|
+
export declare const toSpeculativeUtxo: (utxo: Utxo) => SpeculativeUtxo;
|
|
5
|
+
/**
|
|
6
|
+
* The tree to prove against while the deposit that creates `pendingLeaves` is still in flight:
|
|
7
|
+
* the live tree with those leaves appended, or the live tree itself once the indexer caught up.
|
|
8
|
+
*/
|
|
9
|
+
export declare const speculativeMerkleTree: (merkleTree: MerkleTree<bigint>, inputUtxosArray: Utxo[][], pendingCommitments: string[]) => MerkleTree<bigint>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region libs/shared/common/src/functions/pre-transaction/speculativeUtxo.ts
|
|
2
|
+
var e = (e) => ({
|
|
3
|
+
amount: e.amount.toString(),
|
|
4
|
+
erc20TokenAddress: e.erc20TokenAddress,
|
|
5
|
+
mintAddress: e.mintAddress ?? "",
|
|
6
|
+
timeStamp: e.timeStamp,
|
|
7
|
+
stealthAddress: BigInt(e.getStealthAddress()).toString(),
|
|
8
|
+
isBlocked: e.isBlocked,
|
|
9
|
+
H0: [(e.H0?.[0] ?? 0n).toString(), (e.H0?.[1] ?? 0n).toString()]
|
|
10
|
+
}), t = (e, t, n) => {
|
|
11
|
+
let r = n.map(BigInt), i = r.filter((t) => e.contains(t)).length;
|
|
12
|
+
if (i > 0 && i !== r.length) throw Error("Only some pending leaves are already in the Merkle tree");
|
|
13
|
+
let a = e;
|
|
14
|
+
return i !== r.length && (a = e.clone(), r.forEach((e) => a.insert(e, a.getIndex()))), t.flat().forEach((e) => {
|
|
15
|
+
if (e.amount > 0n && !a.contains(BigInt(e.getCommitment()))) throw Error(`Input commitment ${e.getCommitment()} is not in the speculative Merkle tree`);
|
|
16
|
+
}), a;
|
|
17
|
+
};
|
|
18
|
+
//#endregion
|
|
19
|
+
export { t as speculativeMerkleTree, e as toSpeculativeUtxo };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../constants/chains.constants.cjs`),t=require(`../../constants/protocol.constants.cjs`),n=require(`../utils/caseInsensitive.utils.cjs`),r=require(`../../types/ethereum-network.types.cjs`),i=require(`../../error-handling/logger.cjs`),a=require(`../utils/create-provider.cjs`),o=require(`../../data-structures/AccountActions/AccountActions.cjs`),s=require(`../utils/getContractAddress.cjs`);let
|
|
1
|
+
require(`../../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../constants/chains.constants.cjs`),t=require(`../../constants/protocol.constants.cjs`),n=require(`../utils/caseInsensitive.utils.cjs`),r=require(`../../types/ethereum-network.types.cjs`),i=require(`../../error-handling/logger.cjs`),a=require(`../utils/create-provider.cjs`),o=require(`../../data-structures/AccountActions/AccountActions.cjs`),s=require(`../web3/getContractMetadata.cjs`),c=require(`../utils/getContractAddress.cjs`);let l=require(`ethers`);var u=e=>{if(typeof e.target==`string`)return e.target;if(e.address)return e.address;throw Error(`Contract address not found`)},d=`tuple(address endpoint, bool invokeWallet, uint128 value, bytes callData)`,f=`tuple(uint8 v, bytes32 r, bytes32 s, address signerAddress, ${d}[] ops, uint256 maxFee, uint256 deadline)`,p=1200,m=e=>{let[t]=l.ethers.AbiCoder.defaultAbiCoder().decode([d],e);return{endpoint:t.endpoint,invokeWallet:t.invokeWallet,value:BigInt(t.value),callData:t.callData}},h=({contract:e,func:t,args:n,callDataString:r,invokeWallet:i,value:a})=>{let o,s=r??`0x`;if(typeof e==`object`){if(o=u(e),r?.length&&r?.length>0)throw Error(`If function and args are providedm no calldata is needed`);t&&n&&!r&&(s=e.interface.encodeFunctionData(t,n))}else o=e;return l.ethers.AbiCoder.defaultAbiCoder().encode([d],[{endpoint:o,invokeWallet:!!i,value:a??0n,callData:s}])},g=async(n,r,i,a,s,c,u)=>{let d=e.getOnchainChainId(n),h=a.map(m),g=0n,_=i&&c?await(async()=>{if(u===void 0)throw Error(`maxFee required if making tx from emporium`);return g=BigInt(Math.floor(Date.now()/1e3)+p),o.AccountActions.signTypedDataFromPrivateKey(d,i,{name:`Emporium`,version:`1.0.0`,chainId:d,verifyingContract:r},{EmporiumSignature:[{name:`message`,type:`uint256`},{name:`ops`,type:`EmporiumOperation[]`},{name:`maxFee`,type:`uint256`},{name:`deadline`,type:`uint256`}],EmporiumOperation:[{name:`endpoint`,type:`address`},{name:`invokeWallet`,type:`bool`},{name:`value`,type:`uint128`},{name:`callData`,type:`bytes`}]},{message:s,ops:h,maxFee:u,deadline:g})})():void 0,{v,r:y,s:b}=_?l.ethers.Signature.from(_):{v:0,r:l.ethers.ZeroHash,s:l.ethers.ZeroHash};return l.ethers.AbiCoder.defaultAbiCoder().encode([f],[{v,r:y,s:b,signerAddress:c??t.zeroAddress,ops:h,maxFee:u??0n,deadline:g}])},_=(e,t,n,r)=>h(e?{contract:e,func:`transfer`,args:[t,n],invokeWallet:r}:{contract:t,value:n,invokeWallet:r}),v=(e,i,a,o,s)=>{let l=e.getContractWithFetcherByChainId(i,r.ContractType.HinkalContract);return a.map((a,u)=>_(n.caseInsensitiveEqual(a,t.zeroAddress)?void 0:e.getContractWithFetcherByChainId(i,r.ContractType.ERC20Contract,a),s??c.getContractAddress(l),o[u],!0))},y=(e,t,n,r)=>h({contract:e,func:`approve`,args:[t,n],invokeWallet:r}),b=(e,i,a,o,c,l,u)=>{let d=[];for(let o=0;o<i.length;o+=1){let c=i[o],u=n.caseInsensitiveEqual(c,t.zeroAddress)?void 0:s.getContractWithFetcherByChainId(e,r.ContractType.ERC20Contract,c);d.push(_(u,l,a[o],!1))}if(u)for(let i=0;i<o.length;i+=1){let a=o[i];if(!n.caseInsensitiveEqual(a,t.zeroAddress)){let t=s.getContractWithFetcherByChainId(e,r.ContractType.ERC20Contract,a);d.push(y(t,u,c[i],!0))}}return d},x=(e,r,i,a,o,s,c,l)=>{let u=[],d=[o],f=[s];l.nativeFee>0n&&!n.caseInsensitiveEqual(o,t.zeroAddress)&&(d.push(t.zeroAddress),f.push(l.nativeFee));let p=b(r,d,f,[o],[c],i,a);u.push(...p);let m=l.nativeFee;return n.caseInsensitiveEqual(o,t.zeroAddress)&&(m+=c),u.push(h({contract:a,callDataString:l.calldata,value:m>0n?m:void 0,invokeWallet:!0})),u},S=`0xef0100`,C=async(e,t)=>{try{let n=a.createJsonRpcProvider(e),r=await n.getCode(t);if(r===`0x`||!r)return{delegated:!1,implementation:void 0,nonce:void 0};if(r.toLowerCase().startsWith(S)&&r.length===48){let e=`0x${r.slice(8)}`,i=await n.getTransactionCount(t);return{delegated:!0,implementation:l.ethers.getAddress(e),nonce:i}}else throw Error(`checkEOAWithDelegation: It is a contract`)}catch(e){throw i.Logger.error(`checkEOAWithDelegation error`,{error:e}),e}},w=r=>{let{hinkalWalletAddress:i}=e.networkRegistry[r].contractData;if(!i||n.caseInsensitiveEqual(i,t.zeroAddress))throw Error(`Hinkal Wallet Address is not set`);return i},T=async(t,r)=>{if(t===e.chainIds.localhost||!r)return;let i=e.getOnchainChainId(t),{delegated:a,implementation:s}=await C(t,o.AccountActions.getSignerAddressFromPrivateKey(t,r)),c=w(t);if(!a||!n.caseInsensitiveEqual(s,c)){let e=await o.AccountActions.authorizeDelegation(i,r,c);return{v:e.signature.v.toString(),r:e.signature.r,s:e.signature.s,nonce:e.nonce.toString(),address:c,chainId:String(i)}}};exports.checkEOAWithDelegation=C,exports.createApproveEmporiumOp=y,exports.createLifiBridgeOps=x,exports.createTransaferEmporiumOpsBatch=v,exports.createTransferToEmporiumOp=_,exports.emporiumOp=h,exports.encodeEmporiumMetadata=g,exports.generateFundAndApproveOps=b,exports.getAuthorizationDataIfNeeded=T;
|
|
@@ -19,18 +19,25 @@ export declare const emporiumOp: ({ contract, func, args, callDataString, invoke
|
|
|
19
19
|
invokeWallet?: boolean;
|
|
20
20
|
value?: bigint;
|
|
21
21
|
}) => string;
|
|
22
|
-
export declare const encodeEmporiumMetadata: (chainId: number, emporiumAddress: string, privateKey: string | undefined, ops: string[], emporiumMessage?: bigint, signerAddress?: string) => Promise<string>;
|
|
22
|
+
export declare const encodeEmporiumMetadata: (chainId: number, emporiumAddress: string, privateKey: string | undefined, ops: string[], emporiumMessage?: bigint, signerAddress?: string, maxFee?: bigint) => Promise<string>;
|
|
23
23
|
export declare const decodeEmporiumMetadata: (metadata: string) => {
|
|
24
24
|
v: number;
|
|
25
25
|
r: string;
|
|
26
26
|
s: string;
|
|
27
27
|
signerAddress: string;
|
|
28
28
|
ops: string[];
|
|
29
|
+
maxFee: bigint;
|
|
30
|
+
deadline: bigint;
|
|
29
31
|
};
|
|
32
|
+
export declare const signEmporiumCancelMessage: (chainId: number, emporiumAddress: string, privateKey: string, emporiumMessage: bigint) => Promise<{
|
|
33
|
+
v: number;
|
|
34
|
+
r: string;
|
|
35
|
+
s: string;
|
|
36
|
+
}>;
|
|
30
37
|
export declare const createTransferToEmporiumOp: (tokenContract: EncodableContract | undefined, to: string, amount: bigint, invokeWallet: boolean) => string;
|
|
31
38
|
export declare const createTransaferEmporiumOpsBatch: (hinkal: IHinkal, chainId: number, erc20TokenAddresses: string[], amounts: bigint[], to?: string) => string[];
|
|
32
39
|
export declare const createApproveEmporiumOp: (tokenContract: EncodableContract, to: string, amount: bigint, invokeWallet: boolean) => string;
|
|
33
|
-
export declare const generateFundAndApproveOps: (
|
|
40
|
+
export declare const generateFundAndApproveOps: (chainId: number, erc20AddressesToFund: string[], fundAmounts: bigint[], approveTokenAddresses: string[], approveAmounts: bigint[], walletAddress: string, spenderAddress: string | undefined) => string[];
|
|
34
41
|
export declare const createLifiBridgeOps: (hinkal: IHinkal, chainId: number, fromAddress: string, lifiRouterAddress: string, tokenAddress: string, fundAmount: bigint, bridgeAmount: bigint, quote: BridgeQuote) => string[];
|
|
35
42
|
export declare const checkEOAWithDelegation: (chainId: number, eoaAddress: string) => Promise<{
|
|
36
43
|
delegated: boolean;
|