@gurge/sdk 0.3.150 → 0.3.151
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 +43 -29
- package/common/src/API/API.cjs +1 -1
- package/common/src/API/API.d.ts +21 -46
- package/common/src/API/API.mjs +96 -121
- 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.cjs +1 -1
- package/common/src/API/callLifiAPI.d.ts +4 -0
- package/common/src/API/callLifiAPI.mjs +7 -2
- 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 +36 -1
- package/common/src/API/callRelayer.mjs +7 -1
- package/common/src/API/dashboardAccountMemberCalls.cjs +1 -1
- package/common/src/API/dashboardAccountMemberCalls.d.ts +15 -0
- package/common/src/API/dashboardAccountMemberCalls.mjs +5 -2
- package/common/src/API/dashboardPayoutCalls.cjs +1 -1
- package/common/src/API/dashboardPayoutCalls.d.ts +2 -1
- package/common/src/API/dashboardPayoutCalls.mjs +4 -1
- package/common/src/API/dashboardTransactionCalls.cjs +1 -1
- package/common/src/API/dashboardTransactionCalls.d.ts +4 -1
- package/common/src/API/dashboardTransactionCalls.mjs +2 -2
- package/common/src/API/enclaveRecipientInfoCalls.d.ts +0 -2
- package/common/src/API/enclaveSignatureCalls.cjs +1 -1
- package/common/src/API/enclaveSignatureCalls.d.ts +2 -1
- package/common/src/API/enclaveSignatureCalls.mjs +5 -8
- package/common/src/API/enclaveUtxoCalls.cjs +1 -1
- package/common/src/API/enclaveUtxoCalls.d.ts +40 -27
- package/common/src/API/enclaveUtxoCalls.mjs +16 -17
- 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.d.ts +8 -0
- package/common/src/API/getOdosPriceForToken.cjs +1 -0
- package/common/src/API/getOdosPriceForToken.d.ts +1 -0
- package/common/src/API/getOdosPriceForToken.mjs +14 -0
- package/common/src/API/getWebsiteURL.d.ts +1 -3
- package/common/src/API/index.cjs +1 -1
- package/common/src/API/index.d.ts +2 -3
- package/common/src/API/index.mjs +4 -5
- package/common/src/API/payoutNotificationStateCalls.cjs +1 -0
- package/common/src/API/payoutNotificationStateCalls.d.ts +10 -0
- package/common/src/API/payoutNotificationStateCalls.mjs +10 -0
- package/common/src/API/privateSendRecipientInfoCalls.cjs +1 -1
- package/common/src/API/privateSendRecipientInfoCalls.d.ts +3 -6
- package/common/src/API/privateSendRecipientInfoCalls.mjs +12 -6
- package/common/src/API/proxyAccountsCalls.cjs +1 -1
- package/common/src/API/proxyAccountsCalls.d.ts +2 -3
- package/common/src/API/proxyAccountsCalls.mjs +11 -10
- package/common/src/API/rewardsUserCalls.cjs +1 -1
- package/common/src/API/rewardsUserCalls.d.ts +1 -40
- package/common/src/API/rewardsUserCalls.mjs +2 -10
- 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/scheduled-transactions-calls.cjs +1 -1
- package/common/src/API/scheduled-transactions-calls.d.ts +2 -5
- package/common/src/API/scheduled-transactions-calls.mjs +2 -6
- package/common/src/API/solana-nft-assets.d.ts +1 -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 +3 -5
- package/common/src/API/temporaryWalletCalls.mjs +8 -9
- package/common/src/API/tenderly.api.cjs +1 -1
- package/common/src/API/tenderly.api.d.ts +5 -10
- package/common/src/API/tenderly.api.mjs +1 -1
- package/common/src/API/weeklyAnalyticCalls.cjs +1 -1
- package/common/src/API/weeklyAnalyticCalls.d.ts +1 -11
- package/common/src/API/weeklyAnalyticCalls.mjs +2 -5
- package/common/src/constants/addresses.constants.cjs +1 -1
- package/common/src/constants/addresses.constants.d.ts +4 -46
- package/common/src/constants/addresses.constants.mjs +19 -60
- package/common/src/constants/balance.constants.cjs +1 -0
- package/common/src/constants/balance.constants.d.ts +3 -0
- package/common/src/constants/balance.constants.mjs +4 -0
- package/common/src/constants/bridging.constants.cjs +1 -1
- package/common/src/constants/bridging.constants.d.ts +10 -0
- package/common/src/constants/bridging.constants.mjs +2 -1
- package/common/src/constants/chains.constants.cjs +1 -1
- package/common/src/constants/chains.constants.d.ts +21 -19
- package/common/src/constants/chains.constants.mjs +175 -198
- package/common/src/constants/coingecko.constants.cjs +1 -1
- package/common/src/constants/coingecko.constants.d.ts +3 -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 -109
- package/common/src/constants/contracts.constants.mjs +16 -34
- package/common/src/constants/deploy-data/deploy-data-arbMainnet.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-arbMainnet.json.mjs +8 -9
- package/common/src/constants/deploy-data/deploy-data-arcTestnet.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-arcTestnet.json.mjs +7 -6
- package/common/src/constants/deploy-data/deploy-data-base.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-base.json.mjs +8 -9
- package/common/src/constants/deploy-data/deploy-data-bnbMainnet.json.cjs +1 -0
- package/common/src/constants/deploy-data/deploy-data-bnbMainnet.json.mjs +12 -0
- package/common/src/constants/deploy-data/deploy-data-ethMainnet.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-ethMainnet.json.mjs +8 -9
- package/common/src/constants/deploy-data/deploy-data-localhost.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-localhost.json.mjs +0 -3
- package/common/src/constants/deploy-data/deploy-data-optimism.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-optimism.json.mjs +8 -9
- package/common/src/constants/deploy-data/deploy-data-optimismTest.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-optimismTest.json.mjs +5 -9
- package/common/src/constants/deploy-data/deploy-data-polygon.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-polygon.json.mjs +8 -9
- package/common/src/constants/deploy-data/deploy-data-sepoliaTestnet.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-sepoliaTestnet.json.mjs +0 -1
- package/common/src/constants/deploy-data/deploy-data-solana.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-solana.json.mjs +2 -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 +7 -7
- package/common/src/constants/deploy-data/deploy-data-tronMainnet.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-tronMainnet.json.mjs +2 -4
- package/common/src/constants/deploy-data/deploy-data-tronNile.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-tronNile.json.mjs +2 -4
- package/common/src/constants/deploy-data/index.cjs +1 -1
- package/common/src/constants/deploy-data/index.d.ts +2 -1
- package/common/src/constants/deploy-data/index.mjs +16 -15
- 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 +36 -45
- 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/deploy-data/shared-deploy-data-tron.json.cjs +1 -1
- package/common/src/constants/deploy-data/shared-deploy-data-tron.json.mjs +2 -46
- package/common/src/constants/enclaveAuth.constants.d.ts +5 -0
- package/common/src/constants/events.constants.cjs +1 -1
- package/common/src/constants/events.constants.mjs +1 -15
- package/common/src/constants/fees.constants.cjs +1 -1
- package/common/src/constants/fees.constants.mjs +2 -2
- package/common/src/constants/index.cjs +1 -1
- package/common/src/constants/index.d.ts +1 -3
- package/common/src/constants/index.mjs +1 -1
- package/common/src/constants/lifi.constants.cjs +1 -1
- package/common/src/constants/lifi.constants.mjs +6 -3
- package/common/src/constants/mediaUrls.constants.d.ts +0 -1
- package/common/src/constants/okx.constants.d.ts +1 -0
- package/common/src/constants/pay.constants.d.ts +1 -0
- package/common/src/constants/protocol.constants.cjs +2 -1
- package/common/src/constants/protocol.constants.d.ts +22 -12
- package/common/src/constants/protocol.constants.mjs +3 -15
- package/common/src/constants/server.constants.cjs +1 -1
- package/common/src/constants/server.constants.d.ts +14 -36
- package/common/src/constants/server.constants.mjs +19 -49
- package/common/src/constants/tokens.constants.cjs +1 -1
- package/common/src/constants/tokens.constants.d.ts +1 -0
- package/common/src/constants/tokens.constants.mjs +4 -1
- package/common/src/constants/tx-confirmation.constants.cjs +1 -1
- package/common/src/constants/tx-confirmation.constants.d.ts +1 -0
- package/common/src/constants/tx-confirmation.constants.mjs +2 -2
- package/common/src/crypto/ecdh-sealed-keys.cjs +1 -1
- package/common/src/crypto/ecdh-sealed-keys.mjs +17 -2
- package/common/src/crypto/index.cjs +1 -1
- package/common/src/crypto/index.d.ts +0 -1
- package/common/src/crypto/index.mjs +1 -2
- 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 +18 -23
- package/common/src/data-structures/Hinkal/Hinkal.mjs +142 -174
- package/common/src/data-structures/Hinkal/IHinkal.d.ts +18 -24
- package/common/src/data-structures/Hinkal/handleAutoDepositBack.cjs +1 -1
- package/common/src/data-structures/Hinkal/handleAutoDepositBack.d.ts +1 -1
- package/common/src/data-structures/Hinkal/handleAutoDepositBack.mjs +36 -35
- package/common/src/data-structures/Hinkal/hinkalActionReceive.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalActionReceive.mjs +13 -11
- package/common/src/data-structures/Hinkal/hinkalBridgePrivateToPrivate.cjs +1 -0
- package/common/src/data-structures/Hinkal/hinkalBridgePrivateToPrivate.d.ts +6 -0
- package/common/src/data-structures/Hinkal/hinkalBridgePrivateToPrivate.mjs +100 -0
- 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 +40 -50
- package/common/src/data-structures/Hinkal/hinkalDeposit.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalDeposit.d.ts +1 -0
- package/common/src/data-structures/Hinkal/hinkalDeposit.mjs +50 -119
- package/common/src/data-structures/Hinkal/hinkalDepositAndBridge.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalDepositAndBridge.d.ts +2 -2
- package/common/src/data-structures/Hinkal/hinkalDepositAndBridge.mjs +113 -109
- package/common/src/data-structures/Hinkal/hinkalDepositAndWithdraw.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalDepositAndWithdraw.d.ts +3 -2
- package/common/src/data-structures/Hinkal/hinkalDepositAndWithdraw.mjs +98 -64
- 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 +50 -48
- package/common/src/data-structures/Hinkal/hinkalNearDepositAndBridge.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalNearDepositAndBridge.mjs +8 -3
- package/common/src/data-structures/Hinkal/hinkalPalEvmDeposit.d.ts +1 -1
- package/common/src/data-structures/Hinkal/hinkalPalTronDepositPrepare.d.ts +2 -2
- package/common/src/data-structures/Hinkal/hinkalPrivateWallet.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalPrivateWallet.mjs +50 -38
- package/common/src/data-structures/Hinkal/hinkalProoflessDeposit.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalProoflessDeposit.d.ts +2 -3
- package/common/src/data-structures/Hinkal/hinkalProoflessDeposit.mjs +52 -117
- package/common/src/data-structures/Hinkal/hinkalProoflessDeposit.utils.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalProoflessDeposit.utils.d.ts +3 -0
- package/common/src/data-structures/Hinkal/hinkalProoflessDeposit.utils.mjs +26 -32
- package/common/src/data-structures/Hinkal/hinkalProxySend.cjs +1 -0
- package/common/src/data-structures/Hinkal/hinkalProxySend.d.ts +6 -0
- package/common/src/data-structures/Hinkal/hinkalProxySend.mjs +16 -0
- package/common/src/data-structures/Hinkal/hinkalProxySwap.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalProxySwap.d.ts +1 -1
- package/common/src/data-structures/Hinkal/hinkalProxySwap.mjs +13 -12
- package/common/src/data-structures/Hinkal/hinkalProxyToPrivate.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalProxyToPrivate.mjs +19 -17
- 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 +50 -79
- package/common/src/data-structures/Hinkal/hinkalSolanaDeposit.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaDeposit.d.ts +2 -2
- package/common/src/data-structures/Hinkal/hinkalSolanaDeposit.mjs +47 -51
- package/common/src/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.d.ts +8 -4
- package/common/src/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.mjs +115 -133
- package/common/src/data-structures/Hinkal/hinkalSolanaProoflessDeposit.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaProoflessDeposit.d.ts +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaProoflessDeposit.mjs +16 -12
- 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 +82 -56
- package/common/src/data-structures/Hinkal/hinkalSolanaProxySwap.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaProxySwap.d.ts +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaProxySwap.mjs +11 -13
- 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 +32 -0
- package/common/src/data-structures/Hinkal/hinkalSolanaSwap.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaSwap.mjs +58 -79
- package/common/src/data-structures/Hinkal/hinkalSolanaTransact.cjs +1 -0
- package/common/src/data-structures/Hinkal/hinkalSolanaTransact.d.ts +3 -0
- package/common/src/data-structures/Hinkal/hinkalSolanaTransact.mjs +119 -0
- package/common/src/data-structures/Hinkal/hinkalSolanaTransfer.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaTransfer.d.ts +2 -30
- package/common/src/data-structures/Hinkal/hinkalSolanaTransfer.mjs +46 -77
- 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 +46 -57
- 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 +32 -32
- package/common/src/data-structures/Hinkal/hinkalTransact.cjs +1 -0
- package/common/src/data-structures/Hinkal/hinkalTransact.d.ts +3 -0
- package/common/src/data-structures/Hinkal/hinkalTransact.mjs +106 -0
- package/common/src/data-structures/Hinkal/hinkalTransfer.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalTransfer.mjs +39 -44
- 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 +38 -49
- package/common/src/data-structures/Hinkal/hinkalWithdrawStuckUtxos.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalWithdrawStuckUtxos.mjs +160 -102
- package/common/src/data-structures/Hinkal/index.d.ts +2 -1
- package/common/src/data-structures/Hinkal/prepareTronDepositToSelf.d.ts +27 -0
- package/common/src/data-structures/Hinkal/resetMerkleTrees.cjs +1 -1
- package/common/src/data-structures/Hinkal/resetMerkleTrees.mjs +7 -6
- package/common/src/data-structures/IndexedDB/activity-db.cjs +1 -1
- package/common/src/data-structures/IndexedDB/activity-db.mjs +34 -34
- package/common/src/data-structures/IndexedDB/contact-db.cjs +1 -1
- package/common/src/data-structures/IndexedDB/contact-db.d.ts +0 -1
- package/common/src/data-structures/IndexedDB/contact-db.mjs +14 -28
- package/common/src/data-structures/IndexedDB/index.cjs +1 -1
- package/common/src/data-structures/IndexedDB/index.d.ts +1 -0
- package/common/src/data-structures/IndexedDB/index.mjs +1 -0
- package/common/src/data-structures/IndexedDB/key-val-store.cjs +1 -1
- package/common/src/data-structures/IndexedDB/key-val-store.d.ts +2 -0
- package/common/src/data-structures/IndexedDB/key-val-store.mjs +14 -0
- package/common/src/data-structures/IndexedDB/pay-activity-db.cjs +1 -1
- package/common/src/data-structures/IndexedDB/pay-activity-db.mjs +43 -1
- package/common/src/data-structures/IndexedDB/private-balances-db.cjs +1 -1
- package/common/src/data-structures/IndexedDB/private-balances-db.d.ts +1 -0
- package/common/src/data-structures/IndexedDB/private-balances-db.mjs +3 -0
- package/common/src/data-structures/IndexedDB/scheduled-transactions-db.cjs +1 -0
- package/common/src/data-structures/IndexedDB/scheduled-transactions-db.d.ts +11 -0
- package/common/src/data-structures/IndexedDB/scheduled-transactions-db.mjs +34 -0
- package/common/src/data-structures/IndexedDB/signatures-db.cjs +1 -1
- package/common/src/data-structures/IndexedDB/signatures-db.mjs +11 -11
- package/common/src/data-structures/MultiThreadedUtxoUtils/MultiThreadedUtxoUtils.cjs +1 -1
- package/common/src/data-structures/MultiThreadedUtxoUtils/MultiThreadedUtxoUtils.d.ts +1 -0
- package/common/src/data-structures/MultiThreadedUtxoUtils/MultiThreadedUtxoUtils.mjs +29 -26
- package/common/src/data-structures/TokenDBs/AlchemyPublicTokensDB.d.ts +0 -1
- package/common/src/data-structures/TokenDBs/PrivateTokensDB.cjs +1 -1
- package/common/src/data-structures/TokenDBs/PrivateTokensDB.mjs +17 -18
- package/common/src/data-structures/TokenDBs/TronPublicTokensDB.d.ts +1 -0
- package/common/src/data-structures/WalletManager/WalletManager.d.ts +1 -0
- package/common/src/data-structures/cacheDevices/BaseCacheDevice.cjs +1 -1
- package/common/src/data-structures/cacheDevices/BaseCacheDevice.d.ts +1 -0
- package/common/src/data-structures/cacheDevices/BaseCacheDevice.mjs +3 -0
- package/common/src/data-structures/cacheDevices/FileCacheDevice.cjs +1 -1
- package/common/src/data-structures/cacheDevices/FileCacheDevice.d.ts +3 -0
- package/common/src/data-structures/cacheDevices/FileCacheDevice.mjs +12 -3
- package/common/src/data-structures/crypto-keys/decodeUTXO.cjs +1 -1
- package/common/src/data-structures/crypto-keys/decodeUTXO.d.ts +9 -9
- package/common/src/data-structures/crypto-keys/decodeUTXO.mjs +11 -71
- package/common/src/data-structures/crypto-keys/encryptDecryptUtxo.cjs +1 -1
- package/common/src/data-structures/crypto-keys/encryptDecryptUtxo.d.ts +2 -3
- package/common/src/data-structures/crypto-keys/encryptDecryptUtxo.mjs +39 -23
- package/common/src/data-structures/crypto-keys/keys.cjs +1 -1
- package/common/src/data-structures/crypto-keys/keys.d.ts +13 -27
- package/common/src/data-structures/crypto-keys/keys.mjs +64 -79
- package/common/src/data-structures/event-service/evm/BlockchainEventEmitter.cjs +1 -1
- package/common/src/data-structures/event-service/evm/BlockchainEventEmitter.d.ts +3 -2
- package/common/src/data-structures/event-service/evm/BlockchainEventEmitter.mjs +46 -38
- package/common/src/data-structures/event-service/evm/ClientBlockchainEventEmitter.cjs +1 -1
- package/common/src/data-structures/event-service/evm/ClientBlockchainEventEmitter.d.ts +1 -1
- package/common/src/data-structures/event-service/evm/ClientBlockchainEventEmitter.mjs +2 -2
- package/common/src/data-structures/event-service/solana/AbstractSolanaCommitmentsSnapshotService.cjs +1 -1
- package/common/src/data-structures/event-service/solana/AbstractSolanaCommitmentsSnapshotService.mjs +27 -23
- package/common/src/data-structures/merkle-tree/MerkleTree.cjs +1 -1
- package/common/src/data-structures/merkle-tree/MerkleTree.d.ts +11 -0
- package/common/src/data-structures/merkle-tree/MerkleTree.mjs +12 -1
- package/common/src/data-structures/private-balances/HinkalPrivateBalanceController.cjs +1 -1
- package/common/src/data-structures/private-balances/HinkalPrivateBalanceController.d.ts +4 -0
- package/common/src/data-structures/private-balances/HinkalPrivateBalanceController.mjs +100 -86
- package/common/src/data-structures/provider-adapter/IProviderAdapter.d.ts +1 -5
- package/common/src/data-structures/token-price-fetcher/TokenChecker.cjs +1 -1
- package/common/src/data-structures/token-price-fetcher/TokenChecker.d.ts +1 -0
- package/common/src/data-structures/token-price-fetcher/TokenChecker.mjs +5 -3
- package/common/src/data-structures/utxo/Utxo.cjs +1 -1
- package/common/src/data-structures/utxo/Utxo.d.ts +1 -4
- package/common/src/data-structures/utxo/Utxo.mjs +7 -17
- package/common/src/error-handling/error-codes.constants.cjs +2 -2
- package/common/src/error-handling/error-codes.constants.d.ts +14 -14
- package/common/src/error-handling/error-codes.constants.mjs +30 -32
- package/common/src/error-handling/get-error.message.cjs +1 -1
- package/common/src/error-handling/get-error.message.mjs +28 -18
- package/common/src/error-handling/index.cjs +1 -1
- package/common/src/error-handling/index.d.ts +1 -0
- package/common/src/error-handling/index.mjs +1 -0
- package/common/src/externalABIs/index.cjs +1 -1
- package/common/src/externalABIs/index.d.ts +1 -113
- package/common/src/externalABIs/index.mjs +2 -6
- package/common/src/functions/auto-deposit-back-helpers/get-gas-token-records.cjs +1 -1
- package/common/src/functions/auto-deposit-back-helpers/get-gas-token-records.mjs +7 -6
- package/common/src/functions/auto-deposit-back-helpers/select-gas-token.cjs +1 -1
- package/common/src/functions/auto-deposit-back-helpers/select-gas-token.mjs +8 -8
- package/common/src/functions/index.cjs +1 -1
- package/common/src/functions/index.d.ts +0 -1
- package/common/src/functions/index.mjs +21 -20
- package/common/src/functions/pre-transaction/buildCommitmentValidationData.cjs +1 -1
- package/common/src/functions/pre-transaction/buildCommitmentValidationData.mjs +36 -38
- package/common/src/functions/pre-transaction/calculateSolanaNullifierCount.cjs +1 -1
- package/common/src/functions/pre-transaction/calculateSolanaNullifierCount.mjs +38 -5
- package/common/src/functions/pre-transaction/ensureAmountChanges.cjs +1 -1
- package/common/src/functions/pre-transaction/ensureAmountChanges.mjs +3 -10
- package/common/src/functions/pre-transaction/getExternalSwapAddress.cjs +1 -1
- package/common/src/functions/pre-transaction/getExternalSwapAddress.mjs +2 -18
- package/common/src/functions/pre-transaction/getSolanaCalldataHash.cjs +1 -1
- package/common/src/functions/pre-transaction/getSolanaCalldataHash.d.ts +1 -1
- package/common/src/functions/pre-transaction/getSolanaCalldataHash.mjs +11 -10
- package/common/src/functions/pre-transaction/getVolatileTransferAmount.cjs +1 -1
- package/common/src/functions/pre-transaction/getVolatileTransferAmount.mjs +1 -1
- package/common/src/functions/pre-transaction/index.cjs +1 -1
- package/common/src/functions/pre-transaction/index.d.ts +2 -2
- package/common/src/functions/pre-transaction/index.mjs +2 -3
- 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/outputUtxoProcessing.cjs +1 -1
- package/common/src/functions/pre-transaction/outputUtxoProcessing.d.ts +2 -1
- package/common/src/functions/pre-transaction/outputUtxoProcessing.mjs +19 -18
- 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/solana-public-signals.d.ts +1 -0
- package/common/src/functions/pre-transaction/solana.cjs +1 -1
- package/common/src/functions/pre-transaction/solana.d.ts +13 -0
- package/common/src/functions/pre-transaction/solana.mjs +46 -21
- 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/pre-transaction/store-proof.cjs +1 -1
- package/common/src/functions/pre-transaction/store-proof.d.ts +1 -1
- package/common/src/functions/pre-transaction/store-proof.mjs +1 -0
- package/common/src/functions/private-wallet/emporium.helpers.cjs +1 -1
- package/common/src/functions/private-wallet/emporium.helpers.d.ts +9 -3
- package/common/src/functions/private-wallet/emporium.helpers.mjs +116 -72
- package/common/src/functions/private-wallet/emporium.swap.helpers.cjs +1 -1
- package/common/src/functions/private-wallet/emporium.swap.helpers.d.ts +0 -1
- package/common/src/functions/private-wallet/emporium.swap.helpers.mjs +38 -80
- package/common/src/functions/private-wallet/index.cjs +1 -1
- package/common/src/functions/private-wallet/index.d.ts +0 -1
- package/common/src/functions/private-wallet/index.mjs +0 -1
- package/common/src/functions/snarkjs/common.snarkjs.cjs +1 -1
- package/common/src/functions/snarkjs/common.snarkjs.d.ts +4 -4
- package/common/src/functions/snarkjs/common.snarkjs.mjs +104 -65
- package/common/src/functions/snarkjs/constant.cjs +1 -1
- package/common/src/functions/snarkjs/constant.d.ts +231 -144
- package/common/src/functions/snarkjs/constant.mjs +231 -145
- 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 +85 -69
- package/common/src/functions/snarkjs/constructSignatureFromMnemonicProofInput.cjs +1 -0
- package/common/src/functions/snarkjs/constructSignatureFromMnemonicProofInput.d.ts +7 -0
- package/common/src/functions/snarkjs/constructSignatureFromMnemonicProofInput.mjs +2 -0
- package/common/src/functions/snarkjs/constructSolanaZkProof.cjs +1 -1
- package/common/src/functions/snarkjs/constructSolanaZkProof.d.ts +4 -1
- package/common/src/functions/snarkjs/constructSolanaZkProof.mjs +62 -61
- package/common/src/functions/snarkjs/constructTxEnclave.cjs +1 -0
- package/common/src/functions/snarkjs/constructTxEnclave.d.ts +34 -0
- package/common/src/functions/snarkjs/constructTxEnclave.mjs +95 -0
- package/common/src/functions/snarkjs/constructTxEnclaveVerify.cjs +1 -0
- package/common/src/functions/snarkjs/constructTxEnclaveVerify.d.ts +5 -0
- package/common/src/functions/snarkjs/constructTxEnclaveVerify.mjs +295 -0
- package/common/src/functions/snarkjs/fetchMerkleTreeSiblings.d.ts +1 -3
- package/common/src/functions/snarkjs/fetchOnChainRootHashes.cjs +1 -1
- package/common/src/functions/snarkjs/fetchOnChainRootHashes.d.ts +1 -0
- package/common/src/functions/snarkjs/fetchOnChainRootHashes.mjs +16 -18
- package/common/src/functions/snarkjs/fetchTronInsertionSiblings.cjs +1 -0
- package/common/src/functions/snarkjs/fetchTronInsertionSiblings.d.ts +7 -0
- package/common/src/functions/snarkjs/fetchTronInsertionSiblings.mjs +13 -0
- package/common/src/functions/snarkjs/generateCircomData.cjs +1 -1
- package/common/src/functions/snarkjs/generateCircomData.d.ts +1 -1
- package/common/src/functions/snarkjs/generateCircomData.mjs +41 -31
- package/common/src/functions/snarkjs/generateMainAndCommitmentZkProof.cjs +1 -1
- package/common/src/functions/snarkjs/generateMainAndCommitmentZkProof.d.ts +1 -1
- package/common/src/functions/snarkjs/generateMainAndCommitmentZkProof.mjs +7 -7
- package/common/src/functions/snarkjs/generateSignatureFromMnemonicProof.cjs +1 -0
- package/common/src/functions/snarkjs/generateSignatureFromMnemonicProof.d.ts +2 -0
- package/common/src/functions/snarkjs/generateSignatureFromMnemonicProof.mjs +3 -0
- package/common/src/functions/snarkjs/generateZkProof.cjs +1 -1
- package/common/src/functions/snarkjs/generateZkProof.d.ts +1 -1
- package/common/src/functions/snarkjs/generateZkProof.mjs +9 -16
- package/common/src/functions/snarkjs/getMerkleTreeSiblingsAndRootHashes.cjs +1 -1
- package/common/src/functions/snarkjs/getMerkleTreeSiblingsAndRootHashes.d.ts +4 -2
- package/common/src/functions/snarkjs/getMerkleTreeSiblingsAndRootHashes.mjs +19 -13
- package/common/src/functions/snarkjs/getZKFiles.cjs +1 -1
- package/common/src/functions/snarkjs/getZKFiles.mjs +9 -3
- package/common/src/functions/snarkjs/index.cjs +1 -1
- package/common/src/functions/snarkjs/index.d.ts +2 -0
- package/common/src/functions/snarkjs/index.mjs +2 -0
- package/common/src/functions/snarkjs/signedMessageHash.cjs +1 -1
- package/common/src/functions/snarkjs/signedMessageHash.d.ts +16 -0
- package/common/src/functions/snarkjs/signedMessageHash.mjs +36 -7
- package/common/src/functions/snarkjs/verifySignedEnclaveResponse.cjs +1 -0
- package/common/src/functions/snarkjs/verifySignedEnclaveResponse.d.ts +1 -0
- package/common/src/functions/snarkjs/verifySignedEnclaveResponse.mjs +11 -0
- package/common/src/functions/utils/addresses.cjs +1 -1
- package/common/src/functions/utils/addresses.d.ts +2 -1
- package/common/src/functions/utils/addresses.mjs +30 -21
- 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 +16 -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.cjs +1 -0
- package/common/src/functions/utils/bridge-claimable.utils.d.ts +15 -0
- package/common/src/functions/utils/bridge-claimable.utils.mjs +3 -0
- package/common/src/functions/utils/bridge-flow.utils.cjs +1 -0
- package/common/src/functions/utils/bridge-flow.utils.d.ts +4 -0
- package/common/src/functions/utils/bridge-flow.utils.mjs +2 -0
- package/common/src/functions/utils/buildClaimableDepositPlan.d.ts +3 -2
- package/common/src/functions/utils/convertEmporiumOpToCallInfo.cjs +1 -1
- package/common/src/functions/utils/convertEmporiumOpToCallInfo.mjs +5 -10
- package/common/src/functions/utils/convertIntegrationProviderToExternalActionId.cjs +1 -1
- package/common/src/functions/utils/convertIntegrationProviderToExternalActionId.mjs +1 -1
- 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 +45 -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 +3 -6
- package/common/src/functions/utils/enclave-recipient-info-storage.cjs +1 -1
- package/common/src/functions/utils/enclave-recipient-info-storage.d.ts +4 -1
- package/common/src/functions/utils/enclave-recipient-info-storage.mjs +1 -0
- package/common/src/functions/utils/enclave-signature-storage.cjs +1 -1
- package/common/src/functions/utils/enclave-signature-storage.d.ts +1 -1
- package/common/src/functions/utils/enclave-signature-storage.mjs +3 -3
- package/common/src/functions/utils/enclave-utxo-storage.cjs +1 -1
- package/common/src/functions/utils/enclave-utxo-storage.d.ts +6 -7
- package/common/src/functions/utils/enclave-utxo-storage.mjs +16 -2
- package/common/src/functions/utils/enclaveSessionSigning.cjs +1 -0
- package/common/src/functions/utils/enclaveSessionSigning.d.ts +16 -0
- package/common/src/functions/utils/enclaveSessionSigning.mjs +2 -0
- package/common/src/functions/utils/encodeTokenWithId.cjs +1 -1
- package/common/src/functions/utils/encodeTokenWithId.d.ts +1 -2
- package/common/src/functions/utils/encodeTokenWithId.mjs +2 -5
- package/common/src/functions/utils/encryptInputForEnclave.cjs +1 -1
- package/common/src/functions/utils/encryptInputForEnclave.d.ts +8 -0
- package/common/src/functions/utils/encryptInputForEnclave.mjs +43 -23
- package/common/src/functions/utils/erc20tokenFunctions.cjs +1 -1
- package/common/src/functions/utils/erc20tokenFunctions.mjs +2 -15
- package/common/src/functions/utils/fees.utils.cjs +1 -1
- package/common/src/functions/utils/fees.utils.d.ts +3 -0
- package/common/src/functions/utils/fees.utils.mjs +42 -29
- package/common/src/functions/utils/formatter.d.ts +2 -0
- package/common/src/functions/utils/getDataFromTransaction.d.ts +4 -3
- package/common/src/functions/utils/getRecipientInfoFromUserKeys.cjs +1 -1
- package/common/src/functions/utils/getRecipientInfoFromUserKeys.mjs +2 -3
- 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 +2 -26
- package/common/src/functions/utils/getUtxosFromReceiptSolana.cjs +1 -1
- package/common/src/functions/utils/getUtxosFromReceiptSolana.mjs +7 -24
- package/common/src/functions/utils/index.cjs +1 -1
- package/common/src/functions/utils/index.d.ts +17 -3
- package/common/src/functions/utils/index.mjs +27 -13
- package/common/src/functions/utils/ipfs.d.ts +2 -3
- package/common/src/functions/utils/legacyKeys.cjs +1 -0
- package/common/src/functions/utils/legacyKeys.d.ts +10 -0
- package/common/src/functions/utils/legacyKeys.mjs +8 -0
- package/common/src/functions/utils/lifi.utils.d.ts +3 -0
- package/common/src/functions/utils/mnemonics.cjs +1 -1
- package/common/src/functions/utils/mnemonics.mjs +4 -6
- 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/networks.utils.d.ts +1 -0
- package/common/src/functions/utils/prepareHinkal.cjs +1 -1
- package/common/src/functions/utils/prepareHinkal.d.ts +1 -3
- package/common/src/functions/utils/prepareHinkal.mjs +2 -1
- package/common/src/functions/utils/process.utils.cjs +1 -1
- package/common/src/functions/utils/process.utils.d.ts +0 -1
- package/common/src/functions/utils/process.utils.mjs +2 -11
- package/common/src/functions/utils/proxyAvatar.utils.cjs +1 -0
- package/common/src/functions/utils/proxyAvatar.utils.mjs +3 -0
- 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 +37 -23
- 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/resolve-domain-address.cjs +1 -0
- package/common/src/functions/utils/resolve-domain-address.d.ts +4 -0
- package/common/src/functions/utils/resolve-domain-address.mjs +3 -0
- package/common/src/functions/utils/serialize-utxos.utils.cjs +1 -1
- package/common/src/functions/utils/serialize-utxos.utils.mjs +6 -4
- 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 -0
- package/common/src/functions/utils/temp-wallet.utils.d.ts +8 -0
- package/common/src/functions/utils/temp-wallet.utils.mjs +43 -0
- package/common/src/functions/utils/temporary-wallet-recovery.utils.cjs +1 -0
- package/common/src/functions/utils/temporary-wallet-recovery.utils.d.ts +7 -0
- package/common/src/functions/utils/temporary-wallet-recovery.utils.mjs +10 -0
- 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 +1 -4
- package/common/src/functions/utils/tron.utils.cjs +1 -1
- package/common/src/functions/utils/tron.utils.d.ts +5 -14
- package/common/src/functions/utils/tron.utils.mjs +89 -152
- 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.d.ts +1 -0
- package/common/src/functions/utils/tx-confirmation.utils.mjs +16 -13
- package/common/src/functions/utils/validateWalletAddress.cjs +1 -0
- package/common/src/functions/utils/validateWalletAddress.d.ts +1 -0
- package/common/src/functions/utils/validateWalletAddress.mjs +2 -0
- package/common/src/functions/utils/voidWallets.utils.cjs +1 -0
- package/common/src/functions/utils/voidWallets.utils.d.ts +4 -0
- package/common/src/functions/utils/voidWallets.utils.mjs +1 -0
- package/common/src/functions/utils/waasStamp.cjs +1 -0
- package/common/src/functions/utils/waasStamp.d.ts +5 -0
- package/common/src/functions/utils/waasStamp.mjs +2 -0
- package/common/src/functions/web3/connectors.utils.d.ts +1 -0
- package/common/src/functions/web3/etherFunctions.d.ts +1 -0
- package/common/src/functions/web3/events/getInputUtxoAndBalance.cjs +1 -1
- package/common/src/functions/web3/events/getInputUtxoAndBalance.d.ts +5 -12
- package/common/src/functions/web3/events/getInputUtxoAndBalance.mjs +50 -61
- package/common/src/functions/web3/events/getInputUtxosEnclave.cjs +1 -1
- package/common/src/functions/web3/events/getInputUtxosEnclave.d.ts +4 -3
- package/common/src/functions/web3/events/getInputUtxosEnclave.mjs +42 -35
- package/common/src/functions/web3/events/getShieldedBalance.cjs +1 -1
- package/common/src/functions/web3/events/getShieldedBalance.d.ts +4 -4
- package/common/src/functions/web3/events/getShieldedBalance.mjs +109 -93
- package/common/src/functions/web3/fetchSolanaMerkleTreeRootHash.cjs +1 -1
- package/common/src/functions/web3/fetchSolanaMerkleTreeRootHash.mjs +9 -6
- package/common/src/functions/web3/functionCalls/approveToken.cjs +1 -1
- package/common/src/functions/web3/functionCalls/approveToken.d.ts +1 -1
- package/common/src/functions/web3/functionCalls/approveToken.mjs +21 -107
- package/common/src/functions/web3/functionCalls/constructBatchCall.cjs +1 -1
- package/common/src/functions/web3/functionCalls/constructBatchCall.d.ts +2 -2
- package/common/src/functions/web3/functionCalls/constructBatchCall.mjs +23 -18
- package/common/src/functions/web3/functionCalls/submitProof.cjs +1 -0
- package/common/src/functions/web3/functionCalls/submitProof.d.ts +5 -0
- package/common/src/functions/web3/functionCalls/submitProof.mjs +26 -0
- package/common/src/functions/web3/functionCalls/transactCallDirectTron.cjs +1 -1
- package/common/src/functions/web3/functionCalls/transactCallDirectTron.d.ts +7 -3
- package/common/src/functions/web3/functionCalls/transactCallDirectTron.mjs +81 -53
- package/common/src/functions/web3/functionCalls/transactCallRelayer.cjs +1 -1
- package/common/src/functions/web3/functionCalls/transactCallRelayer.d.ts +8 -13
- package/common/src/functions/web3/functionCalls/transactCallRelayer.mjs +12 -8
- 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/getTokenHolder.cjs +1 -1
- package/common/src/functions/web3/getTokenHolder.mjs +3 -2
- package/common/src/functions/web3/index.cjs +1 -1
- package/common/src/functions/web3/index.d.ts +1 -4
- package/common/src/functions/web3/index.mjs +1 -4
- package/common/src/functions/web3/lifiAPI.cjs +1 -1
- package/common/src/functions/web3/lifiAPI.mjs +38 -7
- package/common/src/providers/EthersProviderAdapter.cjs +1 -1
- package/common/src/providers/EthersProviderAdapter.d.ts +0 -1
- package/common/src/providers/EthersProviderAdapter.mjs +0 -3
- package/common/src/providers/SolanaProviderAdapter.cjs +1 -1
- package/common/src/providers/SolanaProviderAdapter.d.ts +1 -5
- package/common/src/providers/SolanaProviderAdapter.mjs +4 -11
- package/common/src/providers/TronProviderAdapter.cjs +1 -1
- package/common/src/providers/TronProviderAdapter.d.ts +0 -1
- package/common/src/providers/TronProviderAdapter.mjs +7 -4
- package/common/src/providers/WagmiProviderAdapter.cjs +1 -1
- package/common/src/providers/WagmiProviderAdapter.d.ts +0 -1
- package/common/src/providers/WagmiProviderAdapter.mjs +32 -39
- package/common/src/types/API.types.d.ts +0 -4
- package/common/src/types/WeeklyAnalytics.types.d.ts +1 -26
- package/common/src/types/activities.types.cjs +1 -1
- package/common/src/types/activities.types.d.ts +0 -9
- package/common/src/types/activities.types.mjs +1 -1
- package/common/src/types/admin.types.cjs +1 -1
- package/common/src/types/admin.types.d.ts +4 -1
- package/common/src/types/admin.types.mjs +1 -1
- package/common/src/types/bridging-tx.types.d.ts +26 -3
- package/common/src/types/cache.types.cjs +1 -1
- package/common/src/types/cache.types.d.ts +4 -3
- package/common/src/types/cache.types.mjs +1 -1
- package/common/src/types/circom-data.types.cjs +1 -1
- package/common/src/types/circom-data.types.d.ts +32 -27
- package/common/src/types/circom-data.types.mjs +1 -1
- package/common/src/types/commitments.types.d.ts +2 -0
- package/common/src/types/dashboard-account.d.ts +15 -0
- package/common/src/types/dashboard-payout.types.d.ts +1 -0
- package/common/src/types/dashboard-transaction.types.d.ts +3 -0
- package/common/src/types/enclaveApi.types.d.ts +77 -0
- package/common/src/types/ethereum-network.types.cjs +1 -1
- package/common/src/types/ethereum-network.types.d.ts +13 -29
- package/common/src/types/ethereum-network.types.mjs +1 -1
- package/common/src/types/events.types.d.ts +1 -0
- package/common/src/types/external-action.types.cjs +1 -1
- package/common/src/types/external-action.types.d.ts +4 -7
- package/common/src/types/external-action.types.mjs +1 -1
- package/common/src/types/hinkal.types.cjs +1 -1
- package/common/src/types/hinkal.types.d.ts +12 -29
- package/common/src/types/hinkal.types.mjs +12 -20
- package/common/src/types/index.cjs +1 -1
- package/common/src/types/index.d.ts +6 -5
- package/common/src/types/index.mjs +3 -2
- package/common/src/types/near-intents.types.d.ts +2 -0
- package/common/src/types/new-rewards.type.d.ts +0 -70
- package/common/src/types/offscreen.types.cjs +1 -1
- package/common/src/types/offscreen.types.d.ts +0 -1
- package/common/src/types/offscreen.types.mjs +1 -1
- package/common/src/types/pay-activities.types.d.ts +24 -4
- package/common/src/types/payout-notification.types.d.ts +11 -0
- package/common/src/types/proxy-progress.types.d.ts +5 -0
- package/common/src/types/remote-proof.types.d.ts +5 -6
- package/common/src/types/remote-tx-build.types.d.ts +298 -0
- package/common/src/types/scheduled-transactions.types.d.ts +25 -12
- package/common/src/types/snark.types.d.ts +1 -3
- package/common/src/types/solana-transact.types.cjs +1 -0
- package/common/src/types/solana-transact.types.d.ts +35 -0
- package/common/src/types/solana-transact.types.mjs +6 -0
- package/common/src/types/solana.types.cjs +1 -0
- package/common/src/types/solana.types.d.ts +12 -3
- package/common/src/types/solana.types.mjs +6 -0
- package/common/src/types/temp-wallet.types.d.ts +9 -0
- package/common/src/types/tenderly.api.types.d.ts +70 -0
- package/common/src/types/token.types.cjs +1 -1
- package/common/src/types/token.types.d.ts +10 -0
- package/common/src/types/token.types.mjs +2 -2
- package/common/src/types/transact.types.cjs +1 -0
- package/common/src/types/transact.types.d.ts +53 -0
- package/common/src/types/transact.types.mjs +6 -0
- package/common/src/types/transaction.types.d.ts +0 -1
- package/common/src/types/transactions.types.d.ts +0 -1
- package/common/src/webworker/logError-ScFy7p5w.js +2 -0
- package/common/src/webworker/package.json +26 -25
- 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/utxoWorker.types.d.ts +4 -2
- 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 +3 -3
- package/common/src/webworker/viteWorkerURL.constant.mjs +3 -3
- package/common/src/webworker/workerProxy-B_eSl85g.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/index.cjs +1 -1
- package/index.mjs +1 -1
- package/internal/swapApi.cjs +1 -1
- package/internal/swapApi.d.ts +3 -3
- package/internal/swapApi.mjs +22 -25
- package/package.json +26 -25
- package/providers/prepareEthersHinkal.cjs +1 -1
- package/providers/prepareEthersHinkal.d.ts +1 -0
- package/providers/prepareEthersHinkal.mjs +2 -2
- package/providers/prepareSolanaHinkal.cjs +1 -1
- package/providers/prepareSolanaHinkal.d.ts +1 -0
- package/providers/prepareSolanaHinkal.mjs +2 -2
- package/providers/prepareTronHinkal.cjs +1 -1
- package/providers/prepareTronHinkal.d.ts +1 -0
- package/providers/prepareTronHinkal.mjs +2 -2
- package/providers/prepareWagmiHinkal.cjs +1 -1
- package/providers/prepareWagmiHinkal.d.ts +1 -0
- package/providers/prepareWagmiHinkal.mjs +2 -2
- package/services/Hinkal.cjs +1 -1
- package/services/Hinkal.d.ts +16 -10
- package/services/Hinkal.mjs +29 -17
- package/types/IHinkal.d.ts +16 -10
- package/types/swap.types.d.ts +3 -20
- package/common/src/API/accessCodeCalls.cjs +0 -1
- package/common/src/API/accessCodeCalls.d.ts +0 -23
- package/common/src/API/accessCodeCalls.mjs +0 -13
- package/common/src/API/brotherhoodCalls.cjs +0 -1
- package/common/src/API/brotherhoodCalls.d.ts +0 -82
- package/common/src/API/brotherhoodCalls.mjs +0 -17
- package/common/src/API/callOdosAPI.cjs +0 -1
- package/common/src/API/callOdosAPI.d.ts +0 -63
- package/common/src/API/callOdosAPI.mjs +0 -18
- package/common/src/API/callOneInchAPI.cjs +0 -1
- package/common/src/API/callOneInchAPI.d.ts +0 -18
- package/common/src/API/callOneInchAPI.mjs +0 -13
- 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/API/generate-trading-points.cjs +0 -1
- package/common/src/API/generate-trading-points.d.ts +0 -27
- package/common/src/API/generate-trading-points.mjs +0 -23
- package/common/src/API/getAnyRecipientInfo.d.ts +0 -1
- package/common/src/API/leaderboardCalls.cjs +0 -1
- package/common/src/API/leaderboardCalls.d.ts +0 -14
- package/common/src/API/leaderboardCalls.mjs +0 -8
- package/common/src/API/referralsCalls.cjs +0 -1
- package/common/src/API/referralsCalls.d.ts +0 -22
- package/common/src/API/referralsCalls.mjs +0 -11
- package/common/src/API/send-telegram-callback.cjs +0 -1
- package/common/src/API/send-telegram-callback.d.ts +0 -7
- package/common/src/API/send-telegram-callback.mjs +0 -11
- package/common/src/constants/mystery-boxes.constants.d.ts +0 -0
- package/common/src/constants/price-impact.constants.d.ts +0 -2
- package/common/src/constants/rewards.constants.d.ts +0 -15
- package/common/src/constants/tasks.constants.cjs +0 -1
- package/common/src/constants/tasks.constants.d.ts +0 -9
- package/common/src/constants/tasks.constants.mjs +0 -124
- package/common/src/crypto/ecdh-dual-path.cjs +0 -1
- package/common/src/crypto/ecdh-dual-path.d.ts +0 -13
- package/common/src/crypto/ecdh-dual-path.mjs +0 -6
- package/common/src/data-structures/Hinkal/hinkalMultiSend.cjs +0 -1
- package/common/src/data-structures/Hinkal/hinkalMultiSend.d.ts +0 -3
- package/common/src/data-structures/Hinkal/hinkalMultiSend.mjs +0 -12
- package/common/src/data-structures/Hinkal/hinkalProoflessDepositViaWrapper.cjs +0 -1
- package/common/src/data-structures/Hinkal/hinkalProoflessDepositViaWrapper.d.ts +0 -6
- package/common/src/data-structures/Hinkal/hinkalProoflessDepositViaWrapper.mjs +0 -128
- package/common/src/data-structures/Hinkal/prepareDepositOnChainUtxosZkProof.cjs +0 -1
- package/common/src/data-structures/Hinkal/prepareDepositOnChainUtxosZkProof.d.ts +0 -22
- package/common/src/data-structures/Hinkal/prepareDepositOnChainUtxosZkProof.mjs +0 -34
- package/common/src/data-structures/TokenDBs/AlchemyPublicTokensDB.cjs +0 -1
- package/common/src/data-structures/TokenDBs/AlchemyPublicTokensDB.mjs +0 -172
- package/common/src/data-structures/TokenDBs/ArcPublicTokensDB.cjs +0 -1
- package/common/src/data-structures/TokenDBs/ArcPublicTokensDB.mjs +0 -94
- package/common/src/data-structures/TokenDBs/EventsPublicTokensDB.cjs +0 -1
- package/common/src/data-structures/TokenDBs/EventsPublicTokensDB.mjs +0 -134
- package/common/src/data-structures/TokenDBs/PublicTokensDB.cjs +0 -1
- package/common/src/data-structures/TokenDBs/PublicTokensDB.mjs +0 -32
- package/common/src/data-structures/TokenDBs/TempoPublicTokensDB.cjs +0 -1
- package/common/src/data-structures/TokenDBs/TempoPublicTokensDB.mjs +0 -41
- package/common/src/data-structures/TokenDBs/TronPublicTokensDB.cjs +0 -1
- package/common/src/data-structures/TokenDBs/TronPublicTokensDB.mjs +0 -47
- package/common/src/data-structures/TokenDBs/index.cjs +0 -1
- package/common/src/data-structures/TokenDBs/index.mjs +0 -6
- package/common/src/externalABIs/IQuoterV2.json.cjs +0 -1
- package/common/src/externalABIs/IQuoterV2.json.mjs +0 -203
- package/common/src/externalABIs/ISwapRouter.json.cjs +0 -1
- package/common/src/externalABIs/ISwapRouter.json.mjs +0 -537
- package/common/src/externalABIs/IUniswapV3Factory.json.cjs +0 -1
- package/common/src/externalABIs/IUniswapV3Factory.json.mjs +0 -188
- package/common/src/externalABIs/IUniswapV3Pool.json.cjs +0 -1
- package/common/src/externalABIs/IUniswapV3Pool.json.mjs +0 -938
- package/common/src/externalABIs/UniswapV2PoolAbi.json.cjs +0 -1
- package/common/src/externalABIs/UniswapV2PoolAbi.json.mjs +0 -78
- package/common/src/functions/pre-transaction/interaction-to-action.cjs +0 -1
- package/common/src/functions/pre-transaction/interaction-to-action.d.ts +0 -2
- package/common/src/functions/pre-transaction/interaction-to-action.mjs +0 -1
- package/common/src/functions/pre-transaction/recipientUtxoProcessing.cjs +0 -1
- package/common/src/functions/pre-transaction/recipientUtxoProcessing.d.ts +0 -3
- package/common/src/functions/pre-transaction/recipientUtxoProcessing.mjs +0 -32
- package/common/src/functions/pre-transaction/waitForDepositedUtxosInMerkleTree.cjs +0 -1
- package/common/src/functions/pre-transaction/waitForDepositedUtxosInMerkleTree.mjs +0 -29
- package/common/src/functions/private-wallet/opProducer.cjs +0 -1
- package/common/src/functions/private-wallet/opProducer.d.ts +0 -5
- package/common/src/functions/private-wallet/opProducer.mjs +0 -3
- package/common/src/functions/snarkjs/generateZkProofEnclave.cjs +0 -1
- package/common/src/functions/snarkjs/generateZkProofEnclave.d.ts +0 -5
- package/common/src/functions/snarkjs/generateZkProofEnclave.mjs +0 -27
- package/common/src/functions/utils/bit.operations.cjs +0 -1
- package/common/src/functions/utils/bit.operations.d.ts +0 -3
- package/common/src/functions/utils/bit.operations.mjs +0 -4
- package/common/src/functions/utils/get-signature-header.cjs +0 -1
- package/common/src/functions/utils/get-signature-header.d.ts +0 -5
- package/common/src/functions/utils/get-signature-header.mjs +0 -4
- package/common/src/functions/utils/ipfs.cjs +0 -1
- package/common/src/functions/utils/ipfs.mjs +0 -1
- package/common/src/functions/utils/reloadPage.cjs +0 -1
- package/common/src/functions/utils/reloadPage.mjs +0 -4
- 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/functions/web3/odosAPI.cjs +0 -1
- package/common/src/functions/web3/odosAPI.d.ts +0 -5
- package/common/src/functions/web3/odosAPI.mjs +0 -35
- package/common/src/functions/web3/oneInchAPI.cjs +0 -1
- package/common/src/functions/web3/oneInchAPI.d.ts +0 -5
- package/common/src/functions/web3/oneInchAPI.mjs +0 -34
- package/common/src/functions/web3/uniswapAPI.cjs +0 -1
- package/common/src/functions/web3/uniswapAPI.d.ts +0 -16
- package/common/src/functions/web3/uniswapAPI.mjs +0 -60
- package/common/src/types/brotherhood-user.types.d.ts +0 -11
- package/common/src/types/crypto.types.d.ts +0 -8
- package/common/src/types/generatePoints.d.ts +0 -14
- package/common/src/types/new-rewards.type.cjs +0 -1
- package/common/src/types/new-rewards.type.mjs +0 -10
- package/common/src/types/referral.types.d.ts +0 -12
- package/common/src/types/rewards.types.d.ts +0 -34
- package/common/src/types/scheduled-transactions.types.cjs +0 -1
- package/common/src/types/scheduled-transactions.types.mjs +0 -6
- package/common/src/types/token-with-id.types.d.ts +0 -4
- package/common/src/webworker/logError-CZYZ3oyV.js +0 -2
- package/common/src/webworker/workerProxy-DPeuP2Mg.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FeeStructure, LoginMessageMode } from '../../types/hinkal.types';
|
|
1
|
+
import { FeeStructure, LoginMessageMode, ProoflessFeeStructure } from '../../types/hinkal.types';
|
|
2
2
|
import { ContractType, EthereumNetwork } from '../../types/ethereum-network.types';
|
|
3
3
|
import { EncryptedOutputWithSign } from '../../types/commitments.types';
|
|
4
4
|
import { ExternalActionId } from '../../types/external-action.types';
|
|
@@ -17,7 +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 {
|
|
20
|
+
import { PrivateBridgeRecipient, PrivateBridgeResult, PublicBridgeRecipient } from '../../types/bridging-tx.types';
|
|
21
21
|
import { NearBridgeParams, NearBridgeResult } from '../../types/near-intents.types';
|
|
22
22
|
import { PrivateBalancesState } from '../../types/balances.types';
|
|
23
23
|
import { Utxo } from '../utxo/Utxo';
|
|
@@ -26,21 +26,19 @@ import { DepositAndSendExtendedResult } from '../../types/scheduled-transactions
|
|
|
26
26
|
import { Mutex } from 'async-mutex';
|
|
27
27
|
export interface IHinkal<ConnectorType = unknown> {
|
|
28
28
|
userKeys: UserKeys;
|
|
29
|
-
|
|
30
|
-
readonly privateTransferSigningMessage: string;
|
|
31
|
-
readonly allowParallelBalanceLocalDecryption: boolean;
|
|
29
|
+
legacySignature?: string;
|
|
32
30
|
merkleTreeHinkalByChain: Record<number, MerkleTree<bigint>>;
|
|
33
31
|
nullifiersByChain: Record<number, Set<string>>;
|
|
34
32
|
encryptedOutputsByChain: Record<number, EncryptedOutputWithSign[]>;
|
|
35
33
|
commitmentsSnapshotServiceByChain: Record<number, ClientCommitmentsSnapshotService | ClientSolanaCommitmentsSnapshotService | undefined>;
|
|
36
34
|
nullifierSnapshotServiceByChain: Record<number, ClientNullifierSnapshotService | ClientSolanaNullifierSnapshotService | undefined>;
|
|
37
|
-
generateProofRemotely: boolean;
|
|
38
35
|
utxoUtils: IMultiThreadedUtxoUtils;
|
|
39
36
|
cacheDevice: ICacheDevice;
|
|
37
|
+
generateProofRemotely: boolean;
|
|
40
38
|
balanceFetchingMutexByChain: Map<number, Mutex>;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
getStuckShieldedBalances(
|
|
39
|
+
readonly allowParallelBalanceLocalDecryption: boolean;
|
|
40
|
+
getTotalBalances(chainIds: number[], userKeys?: UserKeys, ethAddress?: string, resetCacheBefore?: boolean, updateTokensListBefore?: boolean, useBlockedUtxos?: boolean): Promise<Map<number, TokenBalance[]>>;
|
|
41
|
+
getStuckShieldedBalances(chainIds: number[], userKeys?: UserKeys, ethAddress?: string, resetCacheBefore?: boolean, updateTokensListBefore?: boolean): Promise<Map<number, TokenBalance[]>>;
|
|
44
42
|
privateBalancesWithUSD: PrivateBalancesState;
|
|
45
43
|
onPrivateBalancesWithUSDChange(callback: (state: PrivateBalancesState) => void): () => void;
|
|
46
44
|
getSupportedChains(): number[];
|
|
@@ -57,34 +55,32 @@ export interface IHinkal<ConnectorType = unknown> {
|
|
|
57
55
|
getRecipientInfo(): string;
|
|
58
56
|
deposit(erc20Tokens: ERC20Token[], amountChanges: bigint[], preEstimateGas?: boolean, returnTxData?: boolean): Promise<ethers.TransactionResponse | ethers.TransactionRequest | string | TronWebTypes.Transaction<TronWebTypes.TriggerSmartContract>>;
|
|
59
57
|
depositForOther(erc20Tokens: ERC20Token[], amountChanges: bigint[], recepinetInfo: string, preEstimateGas?: boolean, returnTxData?: boolean, action?: AdminTransactionType): Promise<ethers.TransactionResponse | ethers.TransactionRequest | string | TronWebTypes.Transaction<TronWebTypes.TriggerSmartContract>>;
|
|
60
|
-
claimUtxo(erc20Token: ERC20Token, utxo: Utxo,
|
|
58
|
+
claimUtxo(erc20Token: ERC20Token, utxo: Utxo, claimableSignature: string, feeStructureOverride?: FeeStructure): Promise<string>;
|
|
61
59
|
depositAndWithdraw(erc20Token: ERC20Token, recipientAmounts: bigint[], recipientAddresses: string[], txCompletionTime?: number, feeStructureOverride?: FeeStructure, ref?: string, action?: AdminTransactionType, dashboardAccountId?: string, preEstimateGas?: boolean): Promise<DepositAndSendExtendedResult>;
|
|
62
|
-
depositAndBridge(erc20Token: ERC20Token, recipientBridges:
|
|
60
|
+
depositAndBridge(erc20Token: ERC20Token, recipientBridges: PublicBridgeRecipient[], txCompletionTime?: number, feeStructureOverride?: FeeStructure, ref?: string, action?: AdminTransactionType, dashboardAccountId?: string, preEstimateGas?: boolean): Promise<DepositAndSendExtendedResult>;
|
|
61
|
+
bridgePrivateToPrivate(sourceToken: ERC20Token, destToken: ERC20Token, amount: string, recipient: PrivateBridgeRecipient, slippage?: number, feeToken?: string, feeStructureOverride?: FeeStructure, action?: AdminTransactionType): Promise<PrivateBridgeResult>;
|
|
63
62
|
checkSendTransactionStatus(scheduleId: string): Promise<ScheduledTransactionByIdResponse>;
|
|
64
63
|
nearDepositAndBridge(erc20Token: ERC20Token, recipientAmounts: bigint[], recipientAddresses: string[], params: NearBridgeParams, txCompletionTime?: number, feeStructureOverride?: FeeStructure, ref?: string, action?: AdminTransactionType, dashboardAccountId?: string): Promise<NearBridgeResult>;
|
|
65
|
-
prooflessDeposit(erc20Tokens: ERC20Token[], amountChanges: bigint[], stealthAddressStructures?: StealthAddressStructure[], action?: AdminTransactionType, returnTxData?: boolean): Promise<string | ethers.TransactionRequest | TronWebTypes.Transaction<TronWebTypes.TriggerSmartContract>>;
|
|
66
|
-
prooflessDepositWithPublicFee(erc20Token: ERC20Token, amounts: bigint[], stealthAddressStructures: StealthAddressStructure[], feeAmount: bigint, action?: AdminTransactionType): Promise<string>;
|
|
64
|
+
prooflessDeposit(erc20Tokens: ERC20Token[], amountChanges: bigint[], stealthAddressStructures?: StealthAddressStructure[], recipientEncryptionKeys?: string[], createBlockedUtxos?: boolean, feeStructure?: ProoflessFeeStructure, orderId?: string, action?: AdminTransactionType, returnTxData?: boolean): Promise<string | ethers.TransactionRequest | TronWebTypes.Transaction<TronWebTypes.TriggerSmartContract>>;
|
|
67
65
|
getSolanaProgram(idl: Idl): Program;
|
|
68
66
|
getSolanaPublicKey(): PublicKey;
|
|
69
67
|
depositSolana(amount: bigint, token: ERC20Token): Promise<string>;
|
|
70
68
|
depositSolanaForOther(amount: bigint, token: ERC20Token, recipientInfo: string, returnTxData?: boolean, action?: AdminTransactionType): Promise<string>;
|
|
71
69
|
transfer(erc20Tokens: ERC20Token[], amountChanges: bigint[], recipientAddress: string, feeToken?: string, feeStructureOverride?: FeeStructure, action?: AdminTransactionType): Promise<string>;
|
|
72
|
-
withdraw(erc20Tokens: ERC20Token[], deltaAmounts: bigint[], recipientAddress: string, isRelayerOff: boolean, feeToken?: string, feeStructureOverride?: FeeStructure, action?: AdminTransactionType): Promise<ethers.TransactionResponse | string>;
|
|
70
|
+
withdraw(erc20Tokens: ERC20Token[], deltaAmounts: bigint[], recipientAddress: string, isRelayerOff: boolean, feeToken?: string, feeStructureOverride?: FeeStructure, variableRateOverride?: bigint, action?: AdminTransactionType): Promise<ethers.TransactionResponse | string>;
|
|
73
71
|
withdrawStuckUtxos(erc20Token: ERC20Token, recipientAddress: string): Promise<string[]>;
|
|
74
|
-
swap(erc20Tokens: ERC20Token[], deltaAmounts: bigint[], externalActionId: ExternalActionId, swapData: string, feeToken?: string, feeStructureOverride?: FeeStructure, action?: AdminTransactionType): Promise<string>;
|
|
72
|
+
swap(erc20Tokens: ERC20Token[], deltaAmounts: bigint[], externalActionId: ExternalActionId, swapData: string, feeToken?: string, feeStructureOverride?: FeeStructure, slippagePercentage?: number, action?: AdminTransactionType): Promise<string>;
|
|
75
73
|
getProviderAdapter(chainId?: number): IProviderAdapter;
|
|
76
74
|
getTronWeb(): TronWeb;
|
|
77
75
|
getSigningMessage(mode?: LoginMessageMode): string;
|
|
78
76
|
signHinkalMessage(mode?: LoginMessageMode): Promise<string>;
|
|
79
|
-
signSolanaLedgerMessage(): Promise<
|
|
80
|
-
signature: string;
|
|
81
|
-
txMessageForSolanaLedger: string;
|
|
82
|
-
}>;
|
|
77
|
+
signSolanaLedgerMessage(): Promise<string>;
|
|
83
78
|
initUserKeys(mode?: LoginMessageMode): Promise<void>;
|
|
84
79
|
initUserKeysWithSignature(signature: string): void;
|
|
80
|
+
initUserKeysWithNullifyingKey(nullifyingKey: string): void;
|
|
85
81
|
initUserKeysFromSeedPhrases(seedPhrases: string[]): Promise<void>;
|
|
86
|
-
initUserKeysWithEnclaveSignature(signInMode?: LoginMessageMode): Promise<
|
|
87
|
-
storeAndGetInitialSignature(authSignature: string
|
|
82
|
+
initUserKeysWithEnclaveSignature(signInMode?: LoginMessageMode): Promise<void>;
|
|
83
|
+
storeAndGetInitialSignature(authSignature: string): Promise<string>;
|
|
88
84
|
initProviderAdapter(connector: ConnectorType, providerAdapter: IProviderAdapter<ConnectorType>): Promise<void>;
|
|
89
85
|
disconnectFromConnector(): Promise<void>;
|
|
90
86
|
resetProviderAdapters(): Promise<void>;
|
|
@@ -97,16 +93,14 @@ export interface IHinkal<ConnectorType = unknown> {
|
|
|
97
93
|
isSelectedNetworkSupported(chainId: number): boolean;
|
|
98
94
|
switchNetwork(network: EthereumNetwork): Promise<unknown>;
|
|
99
95
|
monitorConnectedAddress(chainId: number): Promise<void>;
|
|
100
|
-
isPermitterAvailable(chainId: number): boolean;
|
|
101
96
|
signMessage(message: string): Promise<string>;
|
|
102
97
|
signTypedData(domain: ethers.TypedDataDomain, types: Record<string, ethers.TypedDataField[]>, value: Record<string, unknown>): Promise<string>;
|
|
103
98
|
signWithSubAccount(chainId: number, messageToSign: string | undefined, typedData: TypedData | undefined, subAccount: SubAccount): Promise<string>;
|
|
104
99
|
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): Promise<string>;
|
|
105
100
|
actionReceive(erc20Tokens: ERC20Token[], deltaAmounts: bigint[], feeTokens?: string, feeStructureOverride?: FeeStructure, subAccount?: SubAccount, action?: AdminTransactionType): Promise<string>;
|
|
106
|
-
proxySwap(erc20Tokens: ERC20Token[], deltaAmounts: bigint[], externalActionId: ExternalActionId, swapData: string, isTheSameChainSwap: boolean, subAccount: SubAccount, feeToken?: string, feeStructureOverride?: FeeStructure, autoDepositBack?: boolean, maxGasInDollar?: string, action?: AdminTransactionType): Promise<string>;
|
|
101
|
+
proxySwap(erc20Tokens: ERC20Token[], deltaAmounts: bigint[], externalActionId: ExternalActionId, swapData: string, isTheSameChainSwap: boolean, subAccount: SubAccount, feeToken?: string, feeStructureOverride?: FeeStructure, autoDepositBack?: boolean, maxGasInDollar?: string, bridgedToken?: ERC20Token, bridgedTokenAmount?: bigint, action?: AdminTransactionType): Promise<string>;
|
|
107
102
|
proxyToPrivate(erc20Tokens: ERC20Token[], deltaAmountsBase: bigint[], subAccount: SubAccount, recipientInfo: string, feeToken?: string, feeStructureOverride?: FeeStructure, action?: AdminTransactionType): Promise<string>;
|
|
108
103
|
proxySend(erc20Tokens: ERC20Token[], amounts: bigint[], subAccount: SubAccount, recipientAddress: string, feeToken?: string, feeStructureOverride?: FeeStructure, action?: AdminTransactionType): Promise<string>;
|
|
109
|
-
multiSendPrivateRecipients(erc20Tokens: ERC20Token[], amounts: bigint[], extendedRecipientInfos?: string[]): Promise<string>;
|
|
110
104
|
areMerkleTreeUpdatesDisabled(): boolean;
|
|
111
105
|
updateMerkleTreeUpdates(value: boolean): void;
|
|
112
106
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../../constants/chains.constants.cjs`),t=require(`../../functions/utils/caseInsensitive.utils.cjs`),n=require(`../../error-handling/error-codes.constants.cjs`),r=require(`../../functions/web3/etherFunctions.cjs`),i=require(`../../functions/utils/time.utils.cjs`),a=require(`../../error-handling/customErrors/ErrorWithTx.cjs`),o=require(`../../types/external-action.types.cjs`),
|
|
1
|
+
const e=require(`../../constants/chains.constants.cjs`),t=require(`../../functions/utils/caseInsensitive.utils.cjs`),n=require(`../../error-handling/error-codes.constants.cjs`),r=require(`../../functions/web3/etherFunctions.cjs`),i=require(`../../functions/utils/time.utils.cjs`),a=require(`../../error-handling/customErrors/ErrorWithTx.cjs`),o=require(`../../error-handling/logger.cjs`),s=require(`../../types/external-action.types.cjs`),c=require(`../../types/transactions.types.cjs`),l=require(`../../types/admin.types.cjs`),u=require(`../../types/activities.types.cjs`),d=require(`../../types/transaction.types.cjs`),f=require(`../../types/offscreen.types.cjs`);require(`../../types/index.cjs`);const ee=require(`../../API/API.cjs`),p=require(`../../functions/utils/erc20tokenFunctions.cjs`),m=require(`../../error-handling/get-error.message.cjs`);require(`../../error-handling/index.cjs`);const h=require(`../../functions/pre-transaction/getVolatileTransferAmount.cjs`),g=require(`../../functions/utils/create-provider.cjs`),_=require(`../../functions/pre-transaction/getFeeStructure.cjs`),v=require(`../../functions/private-wallet/emporium.helpers.cjs`),y=require(`../../functions/utils/convertEmporiumOpToCallInfo.cjs`),b=require(`../../functions/utils/postToOffscreen.cjs`),x=require(`../../functions/utils/fees.utils.cjs`),S=require(`../../functions/auto-deposit-back-helpers/get-tokens-to-deposit-back.cjs`),C=require(`../../functions/auto-deposit-back-helpers/get-gas-token-records.cjs`),w=require(`../../functions/auto-deposit-back-helpers/select-gas-token.cjs`),T=require(`../../functions/auto-deposit-back-helpers/update-hinkal.cjs`);require(`../../functions/index.cjs`);const E=require(`../IndexedDB/activity-db.cjs`);require(`../IndexedDB/index.cjs`);var D=3*1e3,O=13*1e3,k=async(k,A,j,M,N,P,F,I)=>{if(!j||F.length===0)return;let L;try{let a=g.createJsonRpcProvider(A);await i.waitLittle(A===e.chainIds.ethMainnet?O:D);let o=await S.getTokensToDepositBack(F,N,j,a);if(!o.length){b.postToOffscreen(f.MessagesFromOffscreen.AutoShieldTxStatus,{message:n.transactionErrorCodes.AUTO_SHIELD_SKIPPED});return}let d=(await p.getErc20TokensBySymbolsFromAPI(await x.getGasTokenSymbols(A),A)).filter(e=>e!==void 0),{prices:m}=await ee.API.getTokenPrices(A,d.map(e=>e.erc20TokenAddress)),R=new Map(m.map((e,t)=>[d[t].erc20TokenAddress.toLowerCase(),e])),z=o.map(({token:e})=>e),B=o.map(({balance:e})=>e),V=z.map(({erc20TokenAddress:e})=>e),H=v.createTransaferEmporiumOpsBatch(k,A,V,await h.modifyVolatileTokenAmountChanges(A,z,B,j)),U=await _.getFeeStructure(A,N,V,s.ExternalActionId.Emporium,H.map(e=>y.convertEmporiumOpToCallInfo(e,j,A))),{flatFee:W}=U??{},G=await p.getErc20TokenFromAPI(A,U.feeToken);if(!G)return;let K=r.getAmountInToken(G,W),q=(R.get(G.erc20TokenAddress.toLowerCase())??0)*Number(K),J=await w.selectGasToken(N,q,A,z,H,await C.getGasTokenRecords(d,A,k,j,a,R),U,V,j);if(!J)return;let{feeToken:Y,feeStructure:X}=J??{};if(P&&Number(P)<q){b.postToOffscreen(f.MessagesFromOffscreen.AutoShieldTxStatus,{message:n.gasErrorCodes.GAS_PRICE_EXCEEDS_AUTOSHIELD_LIMIT});return}let Z=z.findIndex(e=>t.caseInsensitiveEqual(e.erc20TokenAddress,Y));Z!==-1&&(B[Z]-=X?.flatFee??0n);let{hinkalAddress:Q}=e.networkRegistry[A].contractData,$={activityType:u.ActivityTypes.AUTO_SHIELD,chainId:A,from:j,to:Q,gasInDollar:q.toString(),tokensReceive:z.map((e,t)=>({amount:r.getAmountInToken(e,B[t]),token:e}))};if(L=await E.activityStorage.saveTxRequest($),b.postToOffscreen(f.MessagesFromOffscreen.AutoShieldTxStatus,{status:c.TransactionStatus.Loading}),I)T.updateHinkal(A,k,I.inputNullifiers?.flat(),I.outCommitments?.flat(),I.encryptedOutputs?.flat());else if(!k.generateProofRemotely)throw Error(`Circomdata should be passed if tx is done locally`);let te={id:0,success:!0,txHash:await k.actionReceive(z,B,Y,X,M,l.AdminTransactionType.AutoShield)};await E.activityStorage.updatePendingTransactions(te,L),b.postToOffscreen(f.MessagesFromOffscreen.AutoShieldTxStatus,{status:c.TransactionStatus.Confirmed,activityRequest:$})}catch(e){let t;e instanceof a.ErrorWithRelayerTransaction&&(t=e.txHash);let n={error:e,id:0,success:!1,...t?{erroredTx:t}:{}};L&&await E.activityStorage.updatePendingTransactions(n,L),b.postToOffscreen(f.MessagesFromOffscreen.AutoShieldTxStatus,{status:c.TransactionStatus.Failed,error:m.getErrorMessageFromTransactionRequest(e,d.TransactionRequestType.ReceiveFromShieldedAccount)}),o.Logger.error(`Error in auto deposit back:`,e)}};exports.handleAutoDepositBack=k;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { IHinkal } from './IHinkal';
|
|
2
2
|
import { CircomDataType, SubAccount, TokenChanges } from '../../types';
|
|
3
|
-
export declare const handleAutoDepositBack: (hinkal: IHinkal, chainId: number, walletAddress: string | undefined, subAccount: SubAccount, feeToken: string | undefined, maxGasInDollar: string | undefined, emporiumTokenChanges: TokenChanges<bigint>[], circomData
|
|
3
|
+
export declare const handleAutoDepositBack: (hinkal: IHinkal, chainId: number, walletAddress: string | undefined, subAccount: SubAccount, feeToken: string | undefined, maxGasInDollar: string | undefined, emporiumTokenChanges: TokenChanges<bigint>[], circomData?: CircomDataType) => Promise<void>;
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import { chainIds as e, networkRegistry as t } from "../../constants/chains.constants.mjs";
|
|
2
2
|
import { caseInsensitiveEqual as n } from "../../functions/utils/caseInsensitive.utils.mjs";
|
|
3
|
-
import { gasErrorCodes as
|
|
4
|
-
import { getAmountInToken as
|
|
5
|
-
import { waitLittle as
|
|
3
|
+
import { gasErrorCodes as r, transactionErrorCodes as i } from "../../error-handling/error-codes.constants.mjs";
|
|
4
|
+
import { getAmountInToken as a } from "../../functions/web3/etherFunctions.mjs";
|
|
5
|
+
import { waitLittle as ee } from "../../functions/utils/time.utils.mjs";
|
|
6
6
|
import { ErrorWithRelayerTransaction as o } from "../../error-handling/customErrors/ErrorWithTx.mjs";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
7
|
+
import { Logger as s } from "../../error-handling/logger.mjs";
|
|
8
|
+
import { ExternalActionId as c } from "../../types/external-action.types.mjs";
|
|
9
|
+
import { TransactionStatus as l } from "../../types/transactions.types.mjs";
|
|
10
|
+
import { AdminTransactionType as u } from "../../types/admin.types.mjs";
|
|
11
|
+
import { ActivityTypes as d } from "../../types/activities.types.mjs";
|
|
12
|
+
import { TransactionRequestType as f } from "../../types/transaction.types.mjs";
|
|
13
|
+
import { MessagesFromOffscreen as p } from "../../types/offscreen.types.mjs";
|
|
13
14
|
import "../../types/index.mjs";
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import { getErrorMessageFromTransactionRequest as g } from "../../error-handling/get-error.message.mjs";
|
|
15
|
+
import { API as m } from "../../API/API.mjs";
|
|
16
|
+
import { getErc20TokenFromAPI as h, getErc20TokensBySymbolsFromAPI as g } from "../../functions/utils/erc20tokenFunctions.mjs";
|
|
17
|
+
import { getErrorMessageFromTransactionRequest as _ } from "../../error-handling/get-error.message.mjs";
|
|
18
18
|
import "../../error-handling/index.mjs";
|
|
19
|
-
import { modifyVolatileTokenAmountChanges as
|
|
19
|
+
import { modifyVolatileTokenAmountChanges as te } from "../../functions/pre-transaction/getVolatileTransferAmount.mjs";
|
|
20
20
|
import { createJsonRpcProvider as v } from "../../functions/utils/create-provider.mjs";
|
|
21
21
|
import { getFeeStructure as y } from "../../functions/pre-transaction/getFeeStructure.mjs";
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
22
|
+
import { createTransaferEmporiumOpsBatch as b } from "../../functions/private-wallet/emporium.helpers.mjs";
|
|
23
|
+
import { convertEmporiumOpToCallInfo as x } from "../../functions/utils/convertEmporiumOpToCallInfo.mjs";
|
|
24
|
+
import { postToOffscreen as S } from "../../functions/utils/postToOffscreen.mjs";
|
|
25
|
+
import { getGasTokenSymbols as C } from "../../functions/utils/fees.utils.mjs";
|
|
26
26
|
import { getTokensToDepositBack as w } from "../../functions/auto-deposit-back-helpers/get-tokens-to-deposit-back.mjs";
|
|
27
27
|
import { getGasTokenRecords as T } from "../../functions/auto-deposit-back-helpers/get-gas-token-records.mjs";
|
|
28
28
|
import { selectGasToken as E } from "../../functions/auto-deposit-back-helpers/select-gas-token.mjs";
|
|
@@ -36,42 +36,43 @@ var k = 3 * 1e3, ne = 13 * 1e3, A = async (A, j, M, N, P, F, I, L) => {
|
|
|
36
36
|
let R;
|
|
37
37
|
try {
|
|
38
38
|
let o = v(j);
|
|
39
|
-
await
|
|
40
|
-
let
|
|
41
|
-
if (!
|
|
42
|
-
|
|
39
|
+
await ee(j === e.ethMainnet ? ne : k);
|
|
40
|
+
let s = await w(I, P, M, o);
|
|
41
|
+
if (!s.length) {
|
|
42
|
+
S(p.AutoShieldTxStatus, { message: i.AUTO_SHIELD_SKIPPED });
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
|
-
let
|
|
45
|
+
let f = (await g(await C(j), j)).filter((e) => e !== void 0), { prices: _ } = await m.getTokenPrices(j, f.map((e) => e.erc20TokenAddress)), z = new Map(_.map((e, t) => [f[t].erc20TokenAddress.toLowerCase(), e])), B = s.map(({ token: e }) => e), V = s.map(({ balance: e }) => e), H = B.map(({ erc20TokenAddress: e }) => e), U = b(A, j, H, await te(j, B, V, M)), W = await y(j, P, H, c.Emporium, U.map((e) => x(e, M, j))), { flatFee: G } = W ?? {}, K = await h(j, W.feeToken);
|
|
46
46
|
if (!K) return;
|
|
47
|
-
let q =
|
|
47
|
+
let q = a(K, G), J = (z.get(K.erc20TokenAddress.toLowerCase()) ?? 0) * Number(q), Y = await E(P, J, j, B, U, await T(f, j, A, M, o, z), W, H, M);
|
|
48
48
|
if (!Y) return;
|
|
49
49
|
let { feeToken: X, feeStructure: Z } = Y ?? {};
|
|
50
50
|
if (F && Number(F) < J) {
|
|
51
|
-
|
|
51
|
+
S(p.AutoShieldTxStatus, { message: r.GAS_PRICE_EXCEEDS_AUTOSHIELD_LIMIT });
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
54
|
let Q = B.findIndex((e) => n(e.erc20TokenAddress, X));
|
|
55
55
|
Q !== -1 && (V[Q] -= Z?.flatFee ?? 0n);
|
|
56
56
|
let { hinkalAddress: re } = t[j].contractData, $ = {
|
|
57
|
-
activityType:
|
|
57
|
+
activityType: d.AUTO_SHIELD,
|
|
58
58
|
chainId: j,
|
|
59
59
|
from: M,
|
|
60
60
|
to: re,
|
|
61
61
|
gasInDollar: J.toString(),
|
|
62
62
|
tokensReceive: B.map((e, t) => ({
|
|
63
|
-
amount:
|
|
63
|
+
amount: a(e, V[t]),
|
|
64
64
|
token: e
|
|
65
65
|
}))
|
|
66
66
|
};
|
|
67
|
-
R = await O.saveTxRequest($),
|
|
67
|
+
if (R = await O.saveTxRequest($), S(p.AutoShieldTxStatus, { status: l.Loading }), L) D(j, A, L.inputNullifiers?.flat(), L.outCommitments?.flat(), L.encryptedOutputs?.flat());
|
|
68
|
+
else if (!A.generateProofRemotely) throw Error("Circomdata should be passed if tx is done locally");
|
|
68
69
|
let ie = {
|
|
69
70
|
id: 0,
|
|
70
71
|
success: !0,
|
|
71
|
-
txHash: await A.actionReceive(B, V, X, Z, N,
|
|
72
|
+
txHash: await A.actionReceive(B, V, X, Z, N, u.AutoShield)
|
|
72
73
|
};
|
|
73
|
-
await O.updatePendingTransactions(ie, R),
|
|
74
|
-
status:
|
|
74
|
+
await O.updatePendingTransactions(ie, R), S(p.AutoShieldTxStatus, {
|
|
75
|
+
status: l.Confirmed,
|
|
75
76
|
activityRequest: $
|
|
76
77
|
});
|
|
77
78
|
} catch (e) {
|
|
@@ -83,10 +84,10 @@ var k = 3 * 1e3, ne = 13 * 1e3, A = async (A, j, M, N, P, F, I, L) => {
|
|
|
83
84
|
success: !1,
|
|
84
85
|
...t ? { erroredTx: t } : {}
|
|
85
86
|
};
|
|
86
|
-
R && await O.updatePendingTransactions(n, R),
|
|
87
|
-
status:
|
|
88
|
-
error:
|
|
89
|
-
}),
|
|
87
|
+
R && await O.updatePendingTransactions(n, R), S(p.AutoShieldTxStatus, {
|
|
88
|
+
status: l.Failed,
|
|
89
|
+
error: _(e, f.ReceiveFromShieldedAccount)
|
|
90
|
+
}), s.error("Error in auto deposit back:", e);
|
|
90
91
|
}
|
|
91
92
|
};
|
|
92
93
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../../types/external-action.types.cjs`),t=require(`../../functions/utils/token-check.utils.cjs`),n=require(`../../functions/pre-transaction/getVolatileTransferAmount.cjs`),r=require(`../AccountActions/AccountActions.cjs`),i=require(`../../functions/pre-transaction/getFeeStructure.cjs`),a=require(`../../functions/utils/convertEmporiumOpToCallInfo.cjs`),
|
|
1
|
+
require(`../../constants/protocol.constants.cjs`);const e=require(`../../types/external-action.types.cjs`),t=require(`../../functions/utils/token-check.utils.cjs`),n=require(`../../functions/pre-transaction/getVolatileTransferAmount.cjs`),r=require(`../AccountActions/AccountActions.cjs`),i=require(`../../functions/pre-transaction/getFeeStructure.cjs`),a=require(`../../functions/private-wallet/emporium.helpers.cjs`),o=require(`../../functions/utils/convertEmporiumOpToCallInfo.cjs`),s=require(`../../functions/utils/fees.utils.cjs`);var c=async(c,l,u,d,f,p,m)=>{if(!p)throw Error(`hinkalActionReceive: subAccount should be provided`);if(!d)throw Error(`Fee token is required in hinkalActionReceive`);let h=t.validateAndGetChainId(l),g=r.AccountActions.getAddressFromSubAccount(h,p);if(!g)throw Error(`Public account address is not available`);let _=l.map(e=>e.erc20TokenAddress),v=await n.modifyVolatileTokenAmountChanges(h,l,u,g),y=a.createTransaferEmporiumOpsBatch(c,h,_,v),b=await s.calculateModifiedFeeStructureForTokens(h,l,v,f??await i.getFeeStructure(h,d,_,e.ExternalActionId.Emporium,y.map(e=>o.convertEmporiumOpToCallInfo(e,g,h)),25n)),x=l.map((e,t)=>({token:e,amount:-1n*v[t]}));return c.actionPrivateWallet(h,l,v,v.map(()=>!1),y,x,p,d,b,void 0,void 0,void 0,m,void 0)};exports.hinkalActionReceive=c;
|
|
@@ -1,21 +1,23 @@
|
|
|
1
|
+
import "../../constants/protocol.constants.mjs";
|
|
1
2
|
import { ExternalActionId as e } from "../../types/external-action.types.mjs";
|
|
2
3
|
import { validateAndGetChainId as t } from "../../functions/utils/token-check.utils.mjs";
|
|
3
4
|
import { modifyVolatileTokenAmountChanges as n } from "../../functions/pre-transaction/getVolatileTransferAmount.mjs";
|
|
4
5
|
import { AccountActions as r } from "../AccountActions/AccountActions.mjs";
|
|
5
6
|
import { getFeeStructure as i } from "../../functions/pre-transaction/getFeeStructure.mjs";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
7
|
+
import { createTransaferEmporiumOpsBatch as a } from "../../functions/private-wallet/emporium.helpers.mjs";
|
|
8
|
+
import { convertEmporiumOpToCallInfo as o } from "../../functions/utils/convertEmporiumOpToCallInfo.mjs";
|
|
9
|
+
import { calculateModifiedFeeStructureForTokens as s } from "../../functions/utils/fees.utils.mjs";
|
|
8
10
|
//#region libs/shared/common/src/data-structures/Hinkal/hinkalActionReceive.ts
|
|
9
|
-
var
|
|
10
|
-
if (!
|
|
11
|
-
if (!
|
|
12
|
-
let
|
|
13
|
-
if (!
|
|
14
|
-
let
|
|
11
|
+
var c = async (c, l, u, d, f, p, m) => {
|
|
12
|
+
if (!p) throw Error("hinkalActionReceive: subAccount should be provided");
|
|
13
|
+
if (!d) throw Error("Fee token is required in hinkalActionReceive");
|
|
14
|
+
let h = t(l), g = r.getAddressFromSubAccount(h, p);
|
|
15
|
+
if (!g) throw Error("Public account address is not available");
|
|
16
|
+
let _ = l.map((e) => e.erc20TokenAddress), v = await n(h, l, u, g), y = a(c, h, _, v), b = await s(h, l, v, f ?? await i(h, d, _, e.Emporium, y.map((e) => o(e, g, h)), 25n)), x = l.map((e, t) => ({
|
|
15
17
|
token: e,
|
|
16
|
-
amount: -1n *
|
|
18
|
+
amount: -1n * v[t]
|
|
17
19
|
}));
|
|
18
|
-
return
|
|
20
|
+
return c.actionPrivateWallet(h, l, v, v.map(() => !1), y, x, p, d, b, void 0, void 0, void 0, m, void 0);
|
|
19
21
|
};
|
|
20
22
|
//#endregion
|
|
21
|
-
export {
|
|
23
|
+
export { c as hinkalActionReceive };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`../../constants/chains.constants.cjs`),t=require(`../../constants/protocol.constants.cjs`),n=require(`../../functions/utils/caseInsensitive.utils.cjs`),r=require(`../../error-handling/error-codes.constants.cjs`),i=require(`../../functions/web3/etherFunctions.cjs`),a=require(`../../functions/utils/addresses.cjs`),o=require(`../../types/external-action.types.cjs`),s=require(`../../types/token.types.cjs`),c=require(`../../API/API.cjs`),l=require(`../../functions/utils/erc20tokenFunctions.cjs`),u=require(`../AccountActions/AccountActions.cjs`),d=require(`../../functions/pre-transaction/getFeeStructure.cjs`),f=require(`../../functions/private-wallet/emporium.helpers.cjs`),p=require(`../../constants/addresses.constants.cjs`),m=require(`../../constants/bridging.constants.cjs`),h=require(`../../functions/utils/convertEmporiumOpToCallInfo.cjs`),g=require(`../../functions/utils/fees.utils.cjs`),_=require(`../../functions/utils/enclave-utxo-storage.cjs`),v=require(`../../functions/utils/bridge-arrival.utils.cjs`),y=require(`../../functions/utils/temp-wallet.utils.cjs`),b=require(`../../API/callNearIntentsAPI.cjs`),x=require(`../../functions/utils/nearIntents.utils.cjs`),S=require(`../../functions/web3/lifiAPI.cjs`),C=require(`../../functions/utils/bridge-claimable-utxo.utils.cjs`);var w=async(e,r,d,m,h,g,_,v)=>{let{chainId:b}=r,x=d.chainId,C=r.erc20TokenAddress,w=p.SWAP_ROUTER_ADDRESSES[o.ExternalActionId.Lifi][b];if(!w)throw Error(`LIFI not configured for chain ${b}`);let T=i.randomBigInt(6),{sourceSubAccount:E,destinationSubAccount:D}=y.deriveBridgeTempWallets(e,b,x,T),O=u.AccountActions.getAddressFromSubAccount(b,E),k=u.AccountActions.getAddressFromSubAccount(x,D);if(!O||!k)throw Error(`Missing temp wallet address for LIFI bridge`);let{lifiDataValue:A,outSwapAmountValue:j,extraNativeTokenFee:M}=await S.getLifiPrice(r,d,m,h,O,k),N={calldata:A,expectedAmount:j,nativeFee:M},P=i.getAmountInWei(r,m),F=Array.from(new Set([b,x])),I=a.hashEthereumAddress(await e.getEthereumAddress());await Promise.all(F.map(e=>c.API.addTemporaryWalletNonce(e,I,Number(T),s.TemporaryWalletRecoveryDestination.Confidential)));let L=n.caseInsensitiveEqual(C,t.zeroAddress),R=N.nativeFee>0n&&!L,z=L?P+N.nativeFee:P,B=[r],V=[-z];if(R){let e=await l.getErc20TokenFromAPI(b,t.zeroAddress);if(!e)throw Error(`Native token not found for bridge fee`);B.push(e),V.push(-N.nativeFee)}let H=f.createLifiBridgeOps(e,b,O,w,C,z,P,N),U=B.map((e,t)=>({token:e,amount:V[t]}));return{tempSubAccount:D,sourceTxHash:await e.actionPrivateWallet(b,B,V,V.map(()=>!1),H,U,E,g??C,_,void 0,!1,void 0,v,void 0),expectedAmount:N.expectedAmount}},T=async(e,t,n,r,o,l,d,f)=>{let p=n.chainId,h=i.randomBigInt(6),g=y.buildTempSubAccountForChain(e,p,h),_=u.AccountActions.getAddressFromSubAccount(p,g);if(!_)throw Error(`Missing temp wallet address for NEAR bridge`);let v=a.hashEthereumAddress(await e.getEthereumAddress());await c.API.addTemporaryWalletNonce(p,v,Number(h),s.TemporaryWalletRecoveryDestination.Confidential);let[S,C]=await Promise.all([x.resolveNearAssetId(t.chainId,t.erc20TokenAddress),x.resolveNearAssetId(p,n.erc20TokenAddress)]),w=i.getAmountInWei(t,r),T=new Date(Date.now()+m.NEAR_BRIDGE_QUOTE_DEADLINE_BUFFER_MS).toISOString(),{quote:E}=await b.getNearIntentsQuote({dry:!1,swapType:`EXACT_INPUT`,slippageTolerance:Math.round(o*1e4)||100,originAsset:S,depositType:`ORIGIN_CHAIN`,destinationAsset:C,amount:w.toString(),recipient:_,recipientType:`DESTINATION_CHAIN`,refundTo:e.userKeys.getNearIntentsAccountId(),refundType:`INTENTS`,deadline:T});if(!E.depositAddress)throw Error(`NEAR Intents quote returned no deposit address`);let D=await e.withdraw([t],[-w],E.depositAddress,!1,l??t.erc20TokenAddress,d,void 0,f);return{tempSubAccount:g,sourceTxHash:typeof D==`string`?D:D.hash,expectedAmount:BigInt(E.amountOut)}},E=async(n,i,a,s,c)=>{let l=i.chainId,p=i.erc20TokenAddress,m=u.AccountActions.getAddressFromSubAccount(l,a);if(!m)throw Error(`Missing temp wallet address for bridge shield`);let{recipientInfo:v,claimable:y}=C.resolveBridgeRecipient(n,c);if(y&&await _.storeClaimableKeyInEnclave(await n.getEthereumAddressByChain(l),y.ethAddress,y.keys.getShieldedPrivateKey(),l,y.signature,n.userKeys.getSignature()),e.isSolanaLike(l))return C.hinkalSolanaShieldBridged(n,i,a,s,v,t.HINKAL_SHIELD_VARIABLE_RATE);let b=f.createTransaferEmporiumOpsBatch(n,l,[p],[s]),x=await g.calculateModifiedFeeStructure(l,i,s,await d.getFeeStructure(l,p,[p],o.ExternalActionId.Emporium,b.map(e=>h.convertEmporiumOpToCallInfo(e,m,l)),t.HINKAL_PRIVATE_SEND_VARIABLE_RATE)),S=s-g.calculateTotalFee(s,x);if(S<=0n)throw Error(r.transactionErrorCodes.INSUFFICIENT_FUNDS_TO_TRANSACT);return{destTxHash:await n.proxyToPrivate([i],[S],a,v,x.feeToken,x),shieldedAmount:S}},D=async(t,n,r,i,a,o=m.DEFAULT_BRIDGING_SLIPPAGE_DECIMAL,s,c,l)=>{let{tempSubAccount:d,sourceTxHash:f,expectedAmount:p}=e.isNearIntentsBridgeSource(n.chainId)?await T(t,n,r,i,o,s,c,l):await w(t,n,r,i,o,s,c,l),h=u.AccountActions.getAddressFromSubAccount(r.chainId,d);if(!h)throw Error(`Missing temp wallet address for bridge`);let{destTxHash:g,shieldedAmount:_}=await E(t,r,d,await v.waitForBridgeArrival(r.chainId,h,r.erc20TokenAddress,p,o),a);return{sourceTxHash:f,destTxHash:g,destinationTokenAmount:_.toString()}};exports.hinkalBridgePrivateToPrivate=D;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AdminTransactionType } from '../../types/admin.types';
|
|
2
|
+
import { PrivateBridgeRecipient, PrivateBridgeResult } from '../../types/bridging-tx.types';
|
|
3
|
+
import { FeeStructure } from '../../types/hinkal.types';
|
|
4
|
+
import { ERC20Token } from '../../types/token.types';
|
|
5
|
+
import { IHinkal } from './IHinkal';
|
|
6
|
+
export declare const hinkalBridgePrivateToPrivate: (hinkal: IHinkal, sourceToken: ERC20Token, destToken: ERC20Token, amount: string, recipient: PrivateBridgeRecipient, slippage?: number, feeToken?: string, feeStructureOverride?: FeeStructure, action?: AdminTransactionType) => Promise<PrivateBridgeResult>;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { isNearIntentsBridgeSource as e, isSolanaLike as t } from "../../constants/chains.constants.mjs";
|
|
2
|
+
import { HINKAL_PRIVATE_SEND_VARIABLE_RATE as n, HINKAL_SHIELD_VARIABLE_RATE as r, zeroAddress as i } from "../../constants/protocol.constants.mjs";
|
|
3
|
+
import { caseInsensitiveEqual as a } from "../../functions/utils/caseInsensitive.utils.mjs";
|
|
4
|
+
import { transactionErrorCodes as o } from "../../error-handling/error-codes.constants.mjs";
|
|
5
|
+
import { getAmountInWei as s, randomBigInt as c } from "../../functions/web3/etherFunctions.mjs";
|
|
6
|
+
import { hashEthereumAddress as l } from "../../functions/utils/addresses.mjs";
|
|
7
|
+
import { ExternalActionId as u } from "../../types/external-action.types.mjs";
|
|
8
|
+
import { TemporaryWalletRecoveryDestination as d } from "../../types/token.types.mjs";
|
|
9
|
+
import { API as f } from "../../API/API.mjs";
|
|
10
|
+
import { getErc20TokenFromAPI as p } from "../../functions/utils/erc20tokenFunctions.mjs";
|
|
11
|
+
import { AccountActions as m } from "../AccountActions/AccountActions.mjs";
|
|
12
|
+
import { getFeeStructure as h } from "../../functions/pre-transaction/getFeeStructure.mjs";
|
|
13
|
+
import { createLifiBridgeOps as g, createTransaferEmporiumOpsBatch as _ } from "../../functions/private-wallet/emporium.helpers.mjs";
|
|
14
|
+
import { SWAP_ROUTER_ADDRESSES as v } from "../../constants/addresses.constants.mjs";
|
|
15
|
+
import { DEFAULT_BRIDGING_SLIPPAGE_DECIMAL as y, NEAR_BRIDGE_QUOTE_DEADLINE_BUFFER_MS as b } from "../../constants/bridging.constants.mjs";
|
|
16
|
+
import { convertEmporiumOpToCallInfo as x } from "../../functions/utils/convertEmporiumOpToCallInfo.mjs";
|
|
17
|
+
import { calculateModifiedFeeStructure as S, calculateTotalFee as C } from "../../functions/utils/fees.utils.mjs";
|
|
18
|
+
import { storeClaimableKeyInEnclave as w } from "../../functions/utils/enclave-utxo-storage.mjs";
|
|
19
|
+
import { waitForBridgeArrival as T } from "../../functions/utils/bridge-arrival.utils.mjs";
|
|
20
|
+
import { buildTempSubAccountForChain as E, deriveBridgeTempWallets as D } from "../../functions/utils/temp-wallet.utils.mjs";
|
|
21
|
+
import { getNearIntentsQuote as O } from "../../API/callNearIntentsAPI.mjs";
|
|
22
|
+
import { resolveNearAssetId as k } from "../../functions/utils/nearIntents.utils.mjs";
|
|
23
|
+
import { getLifiPrice as A } from "../../functions/web3/lifiAPI.mjs";
|
|
24
|
+
import { hinkalSolanaShieldBridged as j, resolveBridgeRecipient as M } from "../../functions/utils/bridge-claimable-utxo.utils.mjs";
|
|
25
|
+
//#region libs/shared/common/src/data-structures/Hinkal/hinkalBridgePrivateToPrivate.ts
|
|
26
|
+
var N = async (e, t, n, r, o, h, _, y) => {
|
|
27
|
+
let { chainId: b } = t, x = n.chainId, S = t.erc20TokenAddress, C = v[u.Lifi][b];
|
|
28
|
+
if (!C) throw Error(`LIFI not configured for chain ${b}`);
|
|
29
|
+
let w = c(6), { sourceSubAccount: T, destinationSubAccount: E } = D(e, b, x, w), O = m.getAddressFromSubAccount(b, T), k = m.getAddressFromSubAccount(x, E);
|
|
30
|
+
if (!O || !k) throw Error("Missing temp wallet address for LIFI bridge");
|
|
31
|
+
let { lifiDataValue: j, outSwapAmountValue: M, extraNativeTokenFee: N } = await A(t, n, r, o, O, k), P = {
|
|
32
|
+
calldata: j,
|
|
33
|
+
expectedAmount: M,
|
|
34
|
+
nativeFee: N
|
|
35
|
+
}, F = s(t, r), I = Array.from(new Set([b, x])), L = l(await e.getEthereumAddress());
|
|
36
|
+
await Promise.all(I.map((e) => f.addTemporaryWalletNonce(e, L, Number(w), d.Confidential)));
|
|
37
|
+
let R = a(S, i), z = P.nativeFee > 0n && !R, B = R ? F + P.nativeFee : F, V = [t], H = [-B];
|
|
38
|
+
if (z) {
|
|
39
|
+
let e = await p(b, i);
|
|
40
|
+
if (!e) throw Error("Native token not found for bridge fee");
|
|
41
|
+
V.push(e), H.push(-P.nativeFee);
|
|
42
|
+
}
|
|
43
|
+
let U = g(e, b, O, C, S, B, F, P), W = V.map((e, t) => ({
|
|
44
|
+
token: e,
|
|
45
|
+
amount: H[t]
|
|
46
|
+
}));
|
|
47
|
+
return {
|
|
48
|
+
tempSubAccount: E,
|
|
49
|
+
sourceTxHash: await e.actionPrivateWallet(b, V, H, H.map(() => !1), U, W, T, h ?? S, _, void 0, !1, void 0, y, void 0),
|
|
50
|
+
expectedAmount: P.expectedAmount
|
|
51
|
+
};
|
|
52
|
+
}, P = async (e, t, n, r, i, a, o, u) => {
|
|
53
|
+
let p = n.chainId, h = c(6), g = E(e, p, h), _ = m.getAddressFromSubAccount(p, g);
|
|
54
|
+
if (!_) throw Error("Missing temp wallet address for NEAR bridge");
|
|
55
|
+
let v = l(await e.getEthereumAddress());
|
|
56
|
+
await f.addTemporaryWalletNonce(p, v, Number(h), d.Confidential);
|
|
57
|
+
let [y, x] = await Promise.all([k(t.chainId, t.erc20TokenAddress), k(p, n.erc20TokenAddress)]), S = s(t, r), C = new Date(Date.now() + b).toISOString(), { quote: w } = await O({
|
|
58
|
+
dry: !1,
|
|
59
|
+
swapType: "EXACT_INPUT",
|
|
60
|
+
slippageTolerance: Math.round(i * 1e4) || 100,
|
|
61
|
+
originAsset: y,
|
|
62
|
+
depositType: "ORIGIN_CHAIN",
|
|
63
|
+
destinationAsset: x,
|
|
64
|
+
amount: S.toString(),
|
|
65
|
+
recipient: _,
|
|
66
|
+
recipientType: "DESTINATION_CHAIN",
|
|
67
|
+
refundTo: e.userKeys.getNearIntentsAccountId(),
|
|
68
|
+
refundType: "INTENTS",
|
|
69
|
+
deadline: C
|
|
70
|
+
});
|
|
71
|
+
if (!w.depositAddress) throw Error("NEAR Intents quote returned no deposit address");
|
|
72
|
+
let T = await e.withdraw([t], [-S], w.depositAddress, !1, a ?? t.erc20TokenAddress, o, void 0, u);
|
|
73
|
+
return {
|
|
74
|
+
tempSubAccount: g,
|
|
75
|
+
sourceTxHash: typeof T == "string" ? T : T.hash,
|
|
76
|
+
expectedAmount: BigInt(w.amountOut)
|
|
77
|
+
};
|
|
78
|
+
}, F = async (e, i, a, s, c) => {
|
|
79
|
+
let l = i.chainId, d = i.erc20TokenAddress, f = m.getAddressFromSubAccount(l, a);
|
|
80
|
+
if (!f) throw Error("Missing temp wallet address for bridge shield");
|
|
81
|
+
let { recipientInfo: p, claimable: g } = M(e, c);
|
|
82
|
+
if (g && await w(await e.getEthereumAddressByChain(l), g.ethAddress, g.keys.getShieldedPrivateKey(), l, g.signature, e.userKeys.getSignature()), t(l)) return j(e, i, a, s, p, r);
|
|
83
|
+
let v = _(e, l, [d], [s]), y = await S(l, i, s, await h(l, d, [d], u.Emporium, v.map((e) => x(e, f, l)), n)), b = s - C(s, y);
|
|
84
|
+
if (b <= 0n) throw Error(o.INSUFFICIENT_FUNDS_TO_TRANSACT);
|
|
85
|
+
return {
|
|
86
|
+
destTxHash: await e.proxyToPrivate([i], [b], a, p, y.feeToken, y),
|
|
87
|
+
shieldedAmount: b
|
|
88
|
+
};
|
|
89
|
+
}, I = async (t, n, r, i, a, o = y, s, c, l) => {
|
|
90
|
+
let { tempSubAccount: u, sourceTxHash: d, expectedAmount: f } = e(n.chainId) ? await P(t, n, r, i, o, s, c, l) : await N(t, n, r, i, o, s, c, l), p = m.getAddressFromSubAccount(r.chainId, u);
|
|
91
|
+
if (!p) throw Error("Missing temp wallet address for bridge");
|
|
92
|
+
let { destTxHash: h, shieldedAmount: g } = await F(t, r, u, await T(r.chainId, p, r.erc20TokenAddress, f, o), a);
|
|
93
|
+
return {
|
|
94
|
+
sourceTxHash: d,
|
|
95
|
+
destTxHash: h,
|
|
96
|
+
destinationTokenAmount: g.toString()
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
//#endregion
|
|
100
|
+
export { I as hinkalBridgePrivateToPrivate };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../../constants/
|
|
1
|
+
const e=require(`../../constants/protocol.constants.cjs`),t=require(`../../functions/utils/caseInsensitive.utils.cjs`),n=require(`../../error-handling/error-codes.constants.cjs`),r=require(`../crypto-keys/keys.cjs`),i=require(`../utxo/Utxo.cjs`),a=require(`../../types/external-action.types.cjs`),o=require(`../../types/transact.types.cjs`),s=require(`../../functions/utils/token-check.utils.cjs`),c=require(`../../functions/pre-transaction/getFeeStructure.cjs`),l=require(`./hinkalTransact.cjs`);var u=async(u,d,f,p,m)=>{let h=s.validateAndGetChainId([d]),g=d.erc20TokenAddress;if(!t.caseInsensitiveEqual(g,f.erc20TokenAddress))throw Error(`Off-chain UTXO token mismatch`);let _=new r.UserKeys(p),v=_.getShieldedPrivateKey();if(f.nullifyingKey&&BigInt(f.nullifyingKey)!==BigInt(v))throw Error(`Claimable UTXO key mismatch`);let y=u.getRecipientInfo(),b=i.Utxo.createFrom(f,{nullifyingKey:v}),x=m??await c.getFeeStructure(h,g,[g],a.ExternalActionId.Transact);if(!t.caseInsensitiveEqual(x.feeToken,g))throw Error(`Claim fee token mismatch: fee must be paid from claimed UTXO token`);let S=x.variableRate>0n?x.variableRate:e.HINKAL_PRIVATE_SEND_VARIABLE_RATE;if(b.amount<=x.flatFee)throw Error(n.transactionErrorCodes.INSUFFICIENT_FUNDS_TO_TRANSACT);let C=b.amount-x.flatFee,w=C*S/10000n,T=C-w;if(T<=0n)throw Error(n.transactionErrorCodes.RECIPIENT_AMOUNT_INVALID);let E={feeToken:x.feeToken,flatFee:x.flatFee+w,variableRate:0n},D=[-b.amount],O=await u.getRandomRelay(h,!0);if(!O)throw Error(n.transactionErrorCodes.RELAYER_NOT_AVAILABLE);return l.hinkalTransact(u,{chainId:h,erc20Addresses:[g],amountChanges:D,externalAddress:O,feeStructure:E,relay:O,recipientAddress:[y],recipientAmounts:[[T]],inputUtxos:[[b]],userKeys:_,submit:{mode:o.SubmitMode.Relayer}})};exports.hinkalClaimUtxo=u;
|
|
@@ -2,4 +2,4 @@ import { ERC20Token } from '../../types/token.types';
|
|
|
2
2
|
import { IHinkal } from './IHinkal';
|
|
3
3
|
import { FeeStructure } from '../../types/hinkal.types';
|
|
4
4
|
import { Utxo } from '../utxo/Utxo';
|
|
5
|
-
export declare const hinkalClaimUtxo: (hinkal: IHinkal, erc20Token: ERC20Token, utxo: Utxo,
|
|
5
|
+
export declare const hinkalClaimUtxo: (hinkal: IHinkal, erc20Token: ERC20Token, utxo: Utxo, claimableSignature: string, feeStructureOverride?: FeeStructure) => Promise<string>;
|
|
@@ -1,54 +1,44 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { outputUtxoProcessing as d } from "../../functions/pre-transaction/outputUtxoProcessing.mjs";
|
|
12
|
-
import { getFeeStructure as f } from "../../functions/pre-transaction/getFeeStructure.mjs";
|
|
13
|
-
import { constructZkProof as p } from "../../functions/snarkjs/constructGeneralZkProof.mjs";
|
|
14
|
-
import { transactCallRelayer as m } from "../../functions/web3/functionCalls/transactCallRelayer.mjs";
|
|
1
|
+
import { HINKAL_PRIVATE_SEND_VARIABLE_RATE as e } from "../../constants/protocol.constants.mjs";
|
|
2
|
+
import { caseInsensitiveEqual as t } from "../../functions/utils/caseInsensitive.utils.mjs";
|
|
3
|
+
import { transactionErrorCodes as n } from "../../error-handling/error-codes.constants.mjs";
|
|
4
|
+
import { UserKeys as r } from "../crypto-keys/keys.mjs";
|
|
5
|
+
import { Utxo as i } from "../utxo/Utxo.mjs";
|
|
6
|
+
import { ExternalActionId as a } from "../../types/external-action.types.mjs";
|
|
7
|
+
import { SubmitMode as o } from "../../types/transact.types.mjs";
|
|
8
|
+
import { validateAndGetChainId as s } from "../../functions/utils/token-check.utils.mjs";
|
|
9
|
+
import { getFeeStructure as c } from "../../functions/pre-transaction/getFeeStructure.mjs";
|
|
10
|
+
import { hinkalTransact as l } from "./hinkalTransact.mjs";
|
|
15
11
|
//#region libs/shared/common/src/data-structures/Hinkal/hinkalClaimUtxo.ts
|
|
16
|
-
var
|
|
17
|
-
let
|
|
18
|
-
if (!
|
|
19
|
-
let
|
|
20
|
-
if (
|
|
21
|
-
let
|
|
22
|
-
if (
|
|
23
|
-
let
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
isNewStyle: !0
|
|
31
|
-
} : { isNewStyle: !1 }
|
|
32
|
-
}), k = v ?? await f(b, S, [S], s.Transact);
|
|
33
|
-
if (!n(k.feeToken, S)) throw Error("Claim fee token mismatch: fee must be paid from claimed UTXO token");
|
|
34
|
-
let A = k.variableRate > 0n ? k.variableRate : t;
|
|
35
|
-
if (D.amount <= k.flatFee) throw Error(r.INSUFFICIENT_FUNDS_TO_TRANSACT);
|
|
36
|
-
let j = D.amount - k.flatFee, M = j * A / 10000n, N = j - M;
|
|
37
|
-
if (N <= 0n) throw Error(r.RECIPIENT_AMOUNT_INVALID);
|
|
38
|
-
let P = {
|
|
39
|
-
feeToken: k.feeToken,
|
|
40
|
-
flatFee: k.flatFee + M,
|
|
12
|
+
var u = async (u, d, f, p, m) => {
|
|
13
|
+
let h = s([d]), g = d.erc20TokenAddress;
|
|
14
|
+
if (!t(g, f.erc20TokenAddress)) throw Error("Off-chain UTXO token mismatch");
|
|
15
|
+
let _ = new r(p), v = _.getShieldedPrivateKey();
|
|
16
|
+
if (f.nullifyingKey && BigInt(f.nullifyingKey) !== BigInt(v)) throw Error("Claimable UTXO key mismatch");
|
|
17
|
+
let y = u.getRecipientInfo(), b = i.createFrom(f, { nullifyingKey: v }), x = m ?? await c(h, g, [g], a.Transact);
|
|
18
|
+
if (!t(x.feeToken, g)) throw Error("Claim fee token mismatch: fee must be paid from claimed UTXO token");
|
|
19
|
+
let S = x.variableRate > 0n ? x.variableRate : e;
|
|
20
|
+
if (b.amount <= x.flatFee) throw Error(n.INSUFFICIENT_FUNDS_TO_TRANSACT);
|
|
21
|
+
let C = b.amount - x.flatFee, w = C * S / 10000n, T = C - w;
|
|
22
|
+
if (T <= 0n) throw Error(n.RECIPIENT_AMOUNT_INVALID);
|
|
23
|
+
let E = {
|
|
24
|
+
feeToken: x.feeToken,
|
|
25
|
+
flatFee: x.flatFee + w,
|
|
41
26
|
variableRate: 0n
|
|
42
|
-
},
|
|
43
|
-
if (!
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
27
|
+
}, D = [-b.amount], O = await u.getRandomRelay(h, !0);
|
|
28
|
+
if (!O) throw Error(n.RELAYER_NOT_AVAILABLE);
|
|
29
|
+
return l(u, {
|
|
30
|
+
chainId: h,
|
|
31
|
+
erc20Addresses: [g],
|
|
32
|
+
amountChanges: D,
|
|
33
|
+
externalAddress: O,
|
|
34
|
+
feeStructure: E,
|
|
35
|
+
relay: O,
|
|
36
|
+
recipientAddress: [y],
|
|
37
|
+
recipientAmounts: [[T]],
|
|
38
|
+
inputUtxos: [[b]],
|
|
39
|
+
userKeys: _,
|
|
40
|
+
submit: { mode: o.Relayer }
|
|
41
|
+
});
|
|
52
42
|
};
|
|
53
43
|
//#endregion
|
|
54
|
-
export {
|
|
44
|
+
export { u as hinkalClaimUtxo };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../../
|
|
1
|
+
const e=require(`../../error-handling/error-codes.constants.cjs`),t=require(`../../functions/utils/tron.utils.cjs`),n=require(`../../functions/utils/addresses.cjs`),r=require(`../../types/transact.types.cjs`),i=require(`../../functions/utils/token-check.utils.cjs`),a=require(`../../functions/pre-transaction/constructAdminData.cjs`),o=require(`./hinkalTransact.cjs`),s=require(`../../API/admin-calls.cjs`);var c=async(e,n,a,s=!0,c=!1)=>{let l=i.validateAndGetChainId(n);return o.hinkalTransact(e,{chainId:l,erc20Addresses:n.map(e=>e.erc20TokenAddress),amountChanges:a,externalAddress:t.addressToHexFormat(await e.getEthereumAddressByChain(l)),submit:{mode:r.SubmitMode.Self,erc20Tokens:n,approvalAmounts:a,preEstimateGas:s,returnTxData:c}})},l=async(c,l,u,d,f=!0,p=!1,m)=>{if(d.length===0)throw Error(`recipientInfos must not be empty`);if(u.length!==d.length)throw Error(`amountsByRecipient must have one entry per recipientInfo`);let h=i.validateAndGetChainId(l),g=l.map(e=>e.erc20TokenAddress);d.forEach((t,r)=>{if(!n.isValidPrivateAddress(t))throw Error(e.transactionErrorCodes.RECIPIENT_FORMAT_INCORRECT);if(u[r].length!==g.length)throw Error(`Each amountsByRecipient entry must have one amount per erc20Token`)});let _=g.map((e,t)=>u.reduce((e,n)=>e+n[t],0n)),v=t.addressToHexFormat(await c.getEthereumAddressByChain(h)),y=await o.hinkalTransact(c,{chainId:h,erc20Addresses:g,amountChanges:_.map(()=>0n),externalAddress:v,recipientAddress:d,recipientAmounts:u,forceEmptyUtxos:!0,submit:{mode:r.SubmitMode.Self,erc20Tokens:l,approvalAmounts:_,preEstimateGas:f,returnTxData:p}});return s.emitTxPublicData(a.constructAdminData(m,h,g,_,await c.getEthereumAddress())),y},u=async(e,t,n,r,i=!0,a=!1,o)=>l(e,t,[n],[r],i,a,o);exports.hinkalDeposit=c,exports.hinkalDepositForOther=u;
|