@hinkal/common 0.2.17 → 0.2.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/API/API.cjs +1 -1
- package/API/API.d.ts +8 -13
- package/API/API.mjs +86 -94
- package/API/admin-calls.cjs +1 -1
- package/API/admin-calls.d.ts +1 -1
- package/API/admin-calls.mjs +4 -4
- package/API/callLifiAPI.cjs +1 -1
- package/API/callLifiAPI.d.ts +1 -1
- package/API/callLifiAPI.mjs +5 -5
- package/API/callMonitor.cjs +1 -1
- package/API/callMonitor.d.ts +1 -1
- package/API/callMonitor.mjs +7 -7
- package/API/callOdosAPI.cjs +1 -1
- package/API/callOdosAPI.mjs +11 -11
- package/API/callOkxAPI.cjs +1 -1
- package/API/callOkxAPI.d.ts +1 -1
- package/API/callOkxAPI.mjs +5 -5
- package/API/callOneInchAPI.cjs +1 -1
- package/API/callOneInchAPI.mjs +10 -11
- package/API/callRelayer.cjs +1 -1
- package/API/callRelayer.d.ts +6 -3
- package/API/callRelayer.mjs +11 -11
- package/API/checkRisk.cjs +1 -1
- package/API/checkRisk.d.ts +1 -1
- package/API/checkRisk.mjs +4 -4
- package/API/fetchCommitmentsCache.cjs +1 -1
- package/API/fetchCommitmentsCache.mjs +9 -9
- package/API/get-token-data.cjs +1 -1
- package/API/get-token-data.d.ts +1 -1
- package/API/get-token-data.mjs +5 -5
- package/API/get-token-price-chart-data.cjs +1 -0
- package/API/get-token-price-chart-data.d.ts +16 -0
- package/API/get-token-price-chart-data.mjs +13 -0
- package/API/getGasEstimates.cjs +1 -1
- package/API/getGasEstimates.mjs +9 -9
- package/API/getServerURL.cjs +1 -1
- package/API/getServerURL.d.ts +3 -3
- package/API/getServerURL.mjs +51 -67
- package/API/getTokenPrice.cjs +1 -1
- package/API/getTokenPrice.d.ts +5 -0
- package/API/getTokenPrice.mjs +14 -7
- package/API/getWebsiteURL.d.ts +1 -1
- package/API/index.d.ts +0 -3
- package/API/is-tx-stateless.cjs +1 -1
- package/API/is-tx-stateless.d.ts +1 -1
- package/API/is-tx-stateless.mjs +10 -12
- package/API/kycCalls.cjs +1 -1
- package/API/kycCalls.d.ts +4 -8
- package/API/kycCalls.mjs +23 -26
- package/API/onrampCalls.cjs +1 -0
- package/API/onrampCalls.d.ts +20 -0
- package/API/onrampCalls.mjs +15 -0
- package/API/proxyAccountsCalls.cjs +1 -1
- package/API/proxyAccountsCalls.d.ts +2 -2
- package/API/proxyAccountsCalls.mjs +19 -19
- package/API/relayCalls.cjs +1 -1
- package/API/relayCalls.mjs +4 -4
- package/API/scheduled-transactions-calls.cjs +1 -1
- package/API/scheduled-transactions-calls.d.ts +1 -1
- package/API/scheduled-transactions-calls.mjs +4 -4
- package/API/simulate-batch-tx.cjs +1 -1
- package/API/simulate-batch-tx.d.ts +2 -2
- package/API/simulate-batch-tx.mjs +7 -6
- package/API/solana-calls.cjs +1 -1
- package/API/solana-calls.d.ts +6 -3
- package/API/solana-calls.mjs +15 -15
- package/API/token-calls.cjs +1 -1
- package/API/token-calls.mjs +6 -5
- package/API/unspent-utxos-calls.cjs +1 -1
- package/API/unspent-utxos-calls.d.ts +1 -1
- package/API/unspent-utxos-calls.mjs +15 -18
- package/README.md +237 -61
- package/constants/addresses.constants.cjs +1 -1
- package/constants/addresses.constants.d.ts +0 -1
- package/constants/addresses.constants.mjs +7 -8
- package/constants/chains.constants.cjs +1 -1
- package/constants/chains.constants.d.ts +0 -5
- package/constants/chains.constants.mjs +21 -26
- package/constants/coingecko.constants.cjs +1 -1
- package/constants/coingecko.constants.d.ts +1 -0
- package/constants/coingecko.constants.mjs +11 -10
- package/constants/contracts.constants.cjs +1 -1
- package/constants/contracts.constants.mjs +34 -41
- package/constants/function-signatures.constants.cjs +1 -1
- package/constants/function-signatures.constants.d.ts +0 -1
- package/constants/function-signatures.constants.mjs +3 -4
- package/constants/mediaUrls.constants.cjs +1 -1
- package/constants/mediaUrls.constants.d.ts +2 -0
- package/constants/mediaUrls.constants.mjs +3 -1
- package/constants/mystery-boxes.constants.d.ts +0 -0
- package/constants/permit2.constants.cjs +1 -1
- package/constants/permit2.constants.d.ts +0 -1
- package/constants/permit2.constants.mjs +10 -11
- package/constants/server.constants.cjs +1 -1
- package/constants/server.constants.d.ts +14 -122
- package/constants/server.constants.mjs +44 -152
- package/constants/token-data/ethMainnetRegistry.json.cjs +1 -1
- package/constants/token-data/ethMainnetRegistry.json.mjs +0 -24
- package/constants/token-data/ethMainnetRegistryFixed.json.cjs +1 -1
- package/constants/token-data/ethMainnetRegistryFixed.json.mjs +0 -24
- package/constants/token-data/index.d.ts +32 -88
- package/constants/token-data/localhostRegistry.json.cjs +1 -1
- package/constants/token-data/localhostRegistry.json.mjs +0 -26
- package/constants/token-data/popularTokens.constants.cjs +1 -1
- package/constants/token-data/popularTokens.constants.mjs +0 -1
- package/constants/vite.constants.cjs +1 -1
- package/constants/vite.constants.mjs +36 -13
- package/data-structures/Hinkal/Hinkal.cjs +1 -1
- package/data-structures/Hinkal/Hinkal.d.ts +34 -49
- package/data-structures/Hinkal/Hinkal.mjs +238 -301
- package/data-structures/Hinkal/IHinkal.d.ts +33 -48
- package/data-structures/Hinkal/handleAutoDepositBack.cjs +1 -1
- package/data-structures/Hinkal/handleAutoDepositBack.d.ts +1 -1
- package/data-structures/Hinkal/handleAutoDepositBack.mjs +42 -42
- package/data-structures/Hinkal/hinkalActionReceive.cjs +1 -1
- package/data-structures/Hinkal/hinkalActionReceive.mjs +25 -23
- package/data-structures/Hinkal/hinkalCheckTokenRegistry.cjs +1 -1
- package/data-structures/Hinkal/hinkalCheckTokenRegistry.mjs +9 -9
- package/data-structures/Hinkal/hinkalDeposit.cjs +1 -1
- package/data-structures/Hinkal/hinkalDeposit.mjs +95 -93
- package/data-structures/Hinkal/hinkalDepositAndWithdraw.cjs +1 -1
- package/data-structures/Hinkal/hinkalDepositAndWithdraw.mjs +147 -133
- package/data-structures/Hinkal/hinkalGetZkMeProvider.cjs +1 -1
- package/data-structures/Hinkal/hinkalGetZkMeProvider.mjs +1 -2
- package/data-structures/Hinkal/hinkalPrivateWallet.cjs +1 -1
- package/data-structures/Hinkal/hinkalPrivateWallet.d.ts +1 -1
- package/data-structures/Hinkal/hinkalPrivateWallet.mjs +107 -115
- package/data-structures/Hinkal/hinkalProoflessDeposit.cjs +1 -1
- package/data-structures/Hinkal/hinkalProoflessDeposit.mjs +36 -34
- package/data-structures/Hinkal/hinkalProxySwap.cjs +1 -1
- package/data-structures/Hinkal/hinkalProxySwap.mjs +34 -33
- package/data-structures/Hinkal/hinkalProxyToPrivate.cjs +1 -1
- package/data-structures/Hinkal/hinkalProxyToPrivate.d.ts +1 -1
- package/data-structures/Hinkal/hinkalProxyToPrivate.mjs +26 -24
- package/data-structures/Hinkal/hinkalSignSubAccount.cjs +1 -1
- package/data-structures/Hinkal/hinkalSignSubAccount.d.ts +1 -2
- package/data-structures/Hinkal/hinkalSignSubAccount.mjs +8 -9
- package/data-structures/Hinkal/hinkalSolanaDeposit.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaDeposit.d.ts +4 -3
- package/data-structures/Hinkal/hinkalSolanaDeposit.mjs +86 -97
- package/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.d.ts +2 -1
- package/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.mjs +146 -146
- package/data-structures/Hinkal/hinkalSolanaProxySend.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaProxySend.d.ts +2 -3
- package/data-structures/Hinkal/hinkalSolanaProxySend.mjs +38 -38
- package/data-structures/Hinkal/hinkalSolanaProxyShield.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaProxyShield.mjs +57 -56
- package/data-structures/Hinkal/hinkalSolanaProxySwap.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaProxySwap.d.ts +1 -1
- package/data-structures/Hinkal/hinkalSolanaProxySwap.mjs +59 -58
- package/data-structures/Hinkal/hinkalSolanaSwap.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaSwap.d.ts +1 -1
- package/data-structures/Hinkal/hinkalSolanaSwap.mjs +83 -79
- package/data-structures/Hinkal/hinkalSolanaTransfer.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaTransfer.d.ts +1 -1
- package/data-structures/Hinkal/hinkalSolanaTransfer.mjs +49 -48
- package/data-structures/Hinkal/hinkalSolanaWithdraw.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaWithdraw.d.ts +2 -1
- package/data-structures/Hinkal/hinkalSolanaWithdraw.mjs +67 -64
- package/data-structures/Hinkal/hinkalSwap.cjs +1 -1
- package/data-structures/Hinkal/hinkalSwap.d.ts +1 -1
- package/data-structures/Hinkal/hinkalSwap.mjs +75 -87
- package/data-structures/Hinkal/hinkalTransfer.cjs +1 -1
- package/data-structures/Hinkal/hinkalTransfer.d.ts +1 -1
- package/data-structures/Hinkal/hinkalTransfer.mjs +55 -58
- package/data-structures/Hinkal/hinkalWithdraw.cjs +1 -1
- package/data-structures/Hinkal/hinkalWithdraw.mjs +80 -82
- package/data-structures/Hinkal/hinkalWithdrawStuckUtxos.cjs +1 -1
- package/data-structures/Hinkal/hinkalWithdrawStuckUtxos.d.ts +2 -2
- package/data-structures/Hinkal/hinkalWithdrawStuckUtxos.mjs +87 -90
- package/data-structures/Hinkal/resetMerkleTrees.cjs +1 -1
- package/data-structures/Hinkal/resetMerkleTrees.d.ts +1 -1
- package/data-structures/Hinkal/resetMerkleTrees.mjs +105 -53
- package/data-structures/IndexedDB/activity-db.cjs +1 -1
- package/data-structures/IndexedDB/activity-db.mjs +7 -7
- package/data-structures/IndexedDB/balances-db.cjs +1 -1
- package/data-structures/IndexedDB/balances-db.mjs +8 -8
- package/data-structures/IndexedDB/contact-db.cjs +1 -1
- package/data-structures/IndexedDB/contact-db.mjs +10 -10
- package/data-structures/IndexedDB/signatures-db.cjs +1 -1
- package/data-structures/IndexedDB/signatures-db.mjs +25 -40
- package/data-structures/TokenDBs/EventsPublicTokensDB.cjs +1 -1
- package/data-structures/TokenDBs/EventsPublicTokensDB.mjs +10 -11
- package/data-structures/TokenDBs/token-visibility-db.cjs +1 -1
- package/data-structures/TokenDBs/token-visibility-db.mjs +22 -36
- package/data-structures/crypto-keys/encryptDecryptUtxo.cjs +1 -1
- package/data-structures/crypto-keys/encryptDecryptUtxo.d.ts +1 -1
- package/data-structures/crypto-keys/encryptDecryptUtxo.mjs +14 -14
- package/data-structures/event-service/evm/AbstractEventService.cjs +1 -1
- package/data-structures/event-service/evm/AbstractEventService.d.ts +1 -0
- package/data-structures/event-service/evm/AbstractEventService.mjs +7 -4
- package/data-structures/event-service/evm/AbstractSnapshotService.cjs +1 -1
- package/data-structures/event-service/evm/AbstractSnapshotService.d.ts +0 -1
- package/data-structures/event-service/evm/AbstractSnapshotService.mjs +3 -4
- package/data-structures/event-service/evm/BlockchainEventEmitter.cjs +1 -1
- package/data-structures/event-service/evm/BlockchainEventEmitter.d.ts +3 -1
- package/data-structures/event-service/evm/BlockchainEventEmitter.mjs +17 -14
- package/data-structures/event-service/solana/AbstractSolanaEventService.cjs +1 -1
- package/data-structures/event-service/solana/AbstractSolanaEventService.d.ts +1 -0
- package/data-structures/event-service/solana/AbstractSolanaEventService.mjs +9 -6
- package/data-structures/event-service/solana/AbstractSolanaSnapshotService.cjs +1 -1
- package/data-structures/event-service/solana/AbstractSolanaSnapshotService.d.ts +0 -1
- package/data-structures/event-service/solana/AbstractSolanaSnapshotService.mjs +1 -2
- package/data-structures/event-service/solana/SolanaBlockchainEventEmitter.cjs +1 -1
- package/data-structures/event-service/solana/SolanaBlockchainEventEmitter.d.ts +3 -2
- package/data-structures/event-service/solana/SolanaBlockchainEventEmitter.mjs +42 -45
- package/data-structures/provider-adapter/IProviderAdapter.d.ts +8 -13
- package/data-structures/snapshot/evm-snapshots/ClientAccessTokenSnapshotService.cjs +1 -1
- package/data-structures/snapshot/evm-snapshots/ClientAccessTokenSnapshotService.mjs +3 -4
- package/data-structures/snapshot/evm-snapshots/ClientApprovalsSnapshotService.cjs +1 -1
- package/data-structures/snapshot/evm-snapshots/ClientApprovalsSnapshotService.mjs +3 -4
- package/data-structures/snapshot/evm-snapshots/ClientCommitmentsSnapshotService.cjs +1 -1
- package/data-structures/snapshot/evm-snapshots/ClientCommitmentsSnapshotService.mjs +3 -4
- package/data-structures/snapshot/evm-snapshots/ClientNullifierSnapshotService.cjs +1 -1
- package/data-structures/snapshot/evm-snapshots/ClientNullifierSnapshotService.mjs +3 -4
- package/data-structures/snapshot/solana-snapshots/ClientSolanaAccessTokenSnapshotService.cjs +1 -1
- package/data-structures/snapshot/solana-snapshots/ClientSolanaAccessTokenSnapshotService.mjs +3 -4
- package/data-structures/snapshot/solana-snapshots/ClientSolanaCommitmentsSnapshotService.cjs +1 -1
- package/data-structures/snapshot/solana-snapshots/ClientSolanaCommitmentsSnapshotService.mjs +2 -4
- package/data-structures/snapshot/solana-snapshots/ClientSolanaNullifierSnapshotService.cjs +1 -1
- package/data-structures/snapshot/solana-snapshots/ClientSolanaNullifierSnapshotService.mjs +3 -4
- package/data-structures/utxo/Utxo.cjs +1 -1
- package/data-structures/utxo/Utxo.d.ts +1 -7
- package/data-structures/utxo/Utxo.mjs +26 -36
- package/error-handling/error-codes.constants.cjs +1 -1
- package/error-handling/error-codes.constants.d.ts +3 -0
- package/error-handling/error-codes.constants.mjs +5 -2
- package/error-handling/get-error.message.cjs +1 -1
- package/error-handling/get-error.message.mjs +21 -27
- package/error-handling/index.d.ts +0 -1
- package/functions/index.d.ts +0 -1
- package/functions/kyc/zkMeHelper.cjs +1 -1
- package/functions/kyc/zkMeHelper.mjs +18 -17
- package/functions/pre-transaction/constructAdminData.cjs +1 -1
- package/functions/pre-transaction/constructAdminData.d.ts +2 -2
- package/functions/pre-transaction/constructAdminData.mjs +12 -18
- package/functions/pre-transaction/getExternalSwapAddress.cjs +1 -1
- package/functions/pre-transaction/getExternalSwapAddress.d.ts +1 -2
- package/functions/pre-transaction/getExternalSwapAddress.mjs +8 -8
- package/functions/pre-transaction/getFlatFees.cjs +1 -1
- package/functions/pre-transaction/getFlatFees.mjs +22 -30
- package/functions/pre-transaction/getVolatileTransferAmount.cjs +1 -1
- package/functions/pre-transaction/getVolatileTransferAmount.mjs +21 -36
- package/functions/pre-transaction/merge-with-fee-structure-emporium.cjs +1 -1
- package/functions/pre-transaction/merge-with-fee-structure-emporium.d.ts +1 -1
- package/functions/pre-transaction/merge-with-fee-structure-emporium.mjs +17 -17
- package/functions/pre-transaction/outputApprovalDataProcessing.cjs +1 -1
- package/functions/pre-transaction/outputApprovalDataProcessing.d.ts +1 -9
- package/functions/pre-transaction/outputApprovalDataProcessing.mjs +19 -34
- package/functions/pre-transaction/shouldPatchAccessTokenMerkleTree.cjs +1 -1
- package/functions/pre-transaction/shouldPatchAccessTokenMerkleTree.d.ts +1 -1
- package/functions/pre-transaction/shouldPatchAccessTokenMerkleTree.mjs +4 -4
- package/functions/pre-transaction/solana-public-signals.cjs +1 -1
- package/functions/pre-transaction/solana-public-signals.d.ts +1 -0
- package/functions/pre-transaction/solana-public-signals.mjs +29 -26
- package/functions/pre-transaction/solana.cjs +1 -1
- package/functions/pre-transaction/solana.d.ts +2 -1
- package/functions/pre-transaction/solana.mjs +60 -51
- package/functions/private-wallet/emporium.helpers.cjs +1 -1
- package/functions/private-wallet/emporium.helpers.d.ts +3 -5
- package/functions/private-wallet/emporium.helpers.mjs +95 -135
- package/functions/private-wallet/emporium.swap.helpers.cjs +1 -1
- package/functions/private-wallet/emporium.swap.helpers.d.ts +1 -4
- package/functions/private-wallet/emporium.swap.helpers.mjs +100 -102
- package/functions/snarkjs/common.snarkjs.cjs +1 -1
- package/functions/snarkjs/common.snarkjs.d.ts +1 -1
- package/functions/snarkjs/common.snarkjs.mjs +64 -64
- package/functions/snarkjs/constructEmporiumProof.cjs +1 -1
- package/functions/snarkjs/constructEmporiumProof.d.ts +2 -2
- package/functions/snarkjs/constructEmporiumProof.mjs +1 -1
- package/functions/snarkjs/constructGeneralZkProof.cjs +1 -1
- package/functions/snarkjs/constructGeneralZkProof.d.ts +2 -3
- package/functions/snarkjs/constructGeneralZkProof.mjs +117 -121
- package/functions/snarkjs/constructSolanaZkProof.cjs +1 -1
- package/functions/snarkjs/constructSolanaZkProof.d.ts +1 -1
- package/functions/snarkjs/constructSolanaZkProof.mjs +54 -59
- package/functions/snarkjs/fetchMerkleTreeSiblings.cjs +1 -1
- package/functions/snarkjs/fetchMerkleTreeSiblings.mjs +11 -10
- package/functions/snarkjs/generateCircomData.d.ts +1 -1
- package/functions/utils/addresses.cjs +1 -1
- package/functions/utils/addresses.d.ts +1 -0
- package/functions/utils/addresses.mjs +13 -12
- package/functions/utils/cacheFunctions.cjs +1 -1
- package/functions/utils/cacheFunctions.mjs +2 -2
- package/functions/utils/enum.utils.cjs +1 -0
- package/functions/utils/enum.utils.mjs +14 -0
- package/functions/utils/erc20tokenFunctions.cjs +1 -1
- package/functions/utils/erc20tokenFunctions.d.ts +0 -1
- package/functions/utils/erc20tokenFunctions.mjs +22 -29
- package/functions/utils/get-hinkal-approvals.cjs +1 -1
- package/functions/utils/get-hinkal-approvals.d.ts +1 -1
- package/functions/utils/get-hinkal-approvals.mjs +16 -16
- package/functions/utils/getDataFromTransaction.d.ts +3 -3
- package/functions/utils/getUtxosFromReceipt.utils.cjs +1 -1
- package/functions/utils/getUtxosFromReceipt.utils.d.ts +1 -1
- package/functions/utils/getUtxosFromReceipt.utils.mjs +11 -11
- package/functions/utils/involves-permit2-op.cjs +1 -1
- package/functions/utils/involves-permit2-op.d.ts +0 -1
- package/functions/utils/involves-permit2-op.mjs +4 -6
- package/functions/utils/mutexes.utils.cjs +1 -1
- package/functions/utils/mutexes.utils.d.ts +1 -1
- package/functions/utils/mutexes.utils.mjs +3 -3
- package/functions/utils/nftTokenFunctions.cjs +1 -1
- package/functions/utils/nftTokenFunctions.mjs +8 -23
- package/functions/utils/prepareHinkal.cjs +1 -1
- package/functions/utils/prepareHinkal.d.ts +0 -6
- package/functions/utils/prepareHinkal.mjs +41 -60
- package/functions/utils/token-check.utils.cjs +1 -1
- package/functions/utils/token-check.utils.d.ts +3 -0
- package/functions/utils/token-check.utils.mjs +18 -7
- package/functions/utils/upToDateState.cjs +1 -1
- package/functions/utils/upToDateState.d.ts +1 -1
- package/functions/utils/upToDateState.mjs +4 -4
- package/functions/utils/walletBalances.utils.cjs +1 -1
- package/functions/utils/walletBalances.utils.d.ts +1 -16
- package/functions/utils/walletBalances.utils.mjs +4 -35
- package/functions/web3/events/getApprovedBalance.cjs +1 -1
- package/functions/web3/events/getApprovedBalance.d.ts +3 -4
- package/functions/web3/events/getApprovedBalance.mjs +39 -44
- package/functions/web3/events/getInputUtxoAndBalance.cjs +1 -1
- package/functions/web3/events/getInputUtxoAndBalance.d.ts +1 -1
- package/functions/web3/events/getInputUtxoAndBalance.mjs +114 -121
- package/functions/web3/events/getInputUtxosEnclave.d.ts +1 -1
- package/functions/web3/events/getShieldedBalance.cjs +2 -2
- package/functions/web3/events/getShieldedBalance.d.ts +1 -1
- package/functions/web3/events/getShieldedBalance.mjs +71 -70
- package/functions/web3/events/getTransactionLogEvents.cjs +1 -1
- package/functions/web3/events/getTransactionLogEvents.mjs +7 -7
- package/functions/web3/fetchSolanaMerkleTreeRootHash.cjs +1 -1
- package/functions/web3/fetchSolanaMerkleTreeRootHash.mjs +7 -7
- package/functions/web3/functionCalls/accessTokenCalls.cjs +1 -1
- package/functions/web3/functionCalls/accessTokenCalls.d.ts +1 -6
- package/functions/web3/functionCalls/accessTokenCalls.mjs +12 -21
- package/functions/web3/functionCalls/approveToken.cjs +1 -1
- package/functions/web3/functionCalls/approveToken.d.ts +1 -1
- package/functions/web3/functionCalls/approveToken.mjs +71 -63
- package/functions/web3/functionCalls/approveTokensToHinkal.cjs +1 -1
- package/functions/web3/functionCalls/approveTokensToHinkal.d.ts +1 -1
- package/functions/web3/functionCalls/approveTokensToHinkal.mjs +6 -6
- package/functions/web3/functionCalls/estimateGasRelayer.cjs +1 -1
- package/functions/web3/functionCalls/estimateGasRelayer.d.ts +1 -2
- package/functions/web3/functionCalls/estimateGasRelayer.mjs +10 -10
- package/functions/web3/functionCalls/recoverTransactionFromError.cjs +1 -0
- package/functions/web3/functionCalls/recoverTransactionFromError.d.ts +2 -0
- package/functions/web3/functionCalls/recoverTransactionFromError.mjs +23 -0
- package/functions/web3/functionCalls/transactCallDirect.cjs +1 -1
- package/functions/web3/functionCalls/transactCallDirect.d.ts +1 -1
- package/functions/web3/functionCalls/transactCallDirect.mjs +45 -36
- package/functions/web3/functionCalls/transactCallRelayer.cjs +1 -1
- package/functions/web3/functionCalls/transactCallRelayer.d.ts +1 -1
- package/functions/web3/functionCalls/transactCallRelayer.mjs +44 -43
- package/functions/web3/getPublicAddressBalance.cjs +1 -1
- package/functions/web3/getPublicAddressBalance.d.ts +1 -1
- package/functions/web3/getPublicAddressBalance.mjs +6 -6
- package/functions/web3/getTokenHolder.cjs +1 -1
- package/functions/web3/getTokenHolder.mjs +8 -8
- package/functions/web3/lifiAPI.cjs +1 -1
- package/functions/web3/lifiAPI.d.ts +1 -1
- package/functions/web3/lifiAPI.mjs +12 -12
- package/functions/web3/odosAPI.cjs +1 -1
- package/functions/web3/odosAPI.mjs +6 -19
- package/functions/web3/okxAPI.cjs +1 -1
- package/functions/web3/okxAPI.mjs +22 -22
- package/functions/web3/oneInchAPI.cjs +1 -1
- package/functions/web3/oneInchAPI.mjs +7 -20
- package/functions/web3/runContractFunction.cjs +1 -1
- package/functions/web3/runContractFunction.mjs +38 -56
- package/functions/web3/uniswapAPI.cjs +1 -1
- package/functions/web3/uniswapAPI.mjs +22 -34
- package/index.cjs +1 -1
- package/index.mjs +937 -967
- package/package.json +2 -2
- package/providers/EthersProviderAdapter.cjs +1 -1
- package/providers/EthersProviderAdapter.d.ts +10 -17
- package/providers/EthersProviderAdapter.mjs +48 -76
- package/providers/SolanaProviderAdapter.cjs +1 -1
- package/providers/SolanaProviderAdapter.d.ts +7 -11
- package/providers/SolanaProviderAdapter.mjs +16 -31
- package/providers/WagmiProviderAdapter.cjs +1 -1
- package/providers/WagmiProviderAdapter.d.ts +11 -17
- package/providers/WagmiProviderAdapter.mjs +86 -117
- package/providers/prepareEthersHinkal.cjs +1 -1
- package/providers/prepareEthersHinkal.mjs +6 -7
- package/providers/prepareWagmiHinkal.cjs +1 -1
- package/providers/prepareWagmiHinkal.mjs +5 -5
- package/types/TransactionSimulator.types.d.ts +2 -9
- package/types/admin.types.cjs +1 -1
- package/types/admin.types.d.ts +3 -7
- package/types/admin.types.mjs +2 -2
- package/types/balances.types.d.ts +0 -1
- package/types/cache.types.cjs +1 -1
- package/types/cache.types.d.ts +2 -3
- package/types/cache.types.mjs +1 -1
- package/types/coingecko.types.d.ts +5 -0
- package/types/ethereum-network.types.cjs +1 -1
- package/types/ethereum-network.types.d.ts +1 -8
- package/types/ethereum-network.types.mjs +1 -1
- package/types/external-action.types.cjs +1 -1
- package/types/external-action.types.d.ts +0 -1
- package/types/external-action.types.mjs +1 -1
- package/types/hinkal.types.cjs +1 -1
- package/types/hinkal.types.d.ts +1 -7
- package/types/hinkal.types.mjs +22 -23
- package/types/index.d.ts +1 -3
- package/types/onramp.types.cjs +1 -0
- package/types/onramp.types.d.ts +58 -0
- package/types/onramp.types.mjs +4 -0
- package/types/proxy.types.d.ts +1 -0
- package/types/sandbox.types.cjs +1 -1
- package/types/sandbox.types.d.ts +8 -39
- package/types/sandbox.types.mjs +2 -2
- package/types/session.types.d.ts +2 -0
- package/types/solana.types.d.ts +3 -0
- package/types/token-prices.types.cjs +1 -1
- package/types/token-prices.types.d.ts +7 -0
- package/types/token-prices.types.mjs +4 -2
- package/types/transactions.types.cjs +1 -1
- package/types/transactions.types.d.ts +6 -4
- package/types/transactions.types.mjs +4 -3
- package/webworker/snarkjsWorker/snarkjsWorkerLauncher.cjs +1 -1
- package/webworker/snarkjsWorker/snarkjsWorkerLauncher.mjs +1 -1
- package/webworker/utxoWorker/utxoWorkerLauncher.cjs +1 -1
- package/webworker/utxoWorker/utxoWorkerLauncher.mjs +1 -1
- package/webworker/zkProofWorker/zkProofWorkerLauncher.cjs +1 -1
- package/webworker/zkProofWorker/zkProofWorkerLauncher.mjs +1 -1
- package/API/ai-calls.cjs +0 -1
- package/API/ai-calls.d.ts +0 -17
- package/API/ai-calls.mjs +0 -21
- package/API/duneAPI.cjs +0 -1
- package/API/duneAPI.d.ts +0 -11
- package/API/duneAPI.mjs +0 -25
- package/API/getBridgeProtocols.cjs +0 -1
- package/API/getBridgeProtocols.d.ts +0 -7
- package/API/getBridgeProtocols.mjs +0 -8
- package/API/getLifiStatus.cjs +0 -1
- package/API/getLifiStatus.d.ts +0 -24
- package/API/getLifiStatus.mjs +0 -15
- package/API/getRelayerURL.cjs +0 -1
- package/API/getRelayerURL.d.ts +0 -1
- package/API/getRelayerURL.mjs +0 -10
- package/API/passwordCalls.cjs +0 -1
- package/API/passwordCalls.d.ts +0 -9
- package/API/passwordCalls.mjs +0 -13
- package/API/restoreSnapshots.cjs +0 -1
- package/API/restoreSnapshots.d.ts +0 -1
- package/API/restoreSnapshots.mjs +0 -10
- package/data-structures/Hinkal/hinkalActionFundApproveAndTransact.cjs +0 -1
- package/data-structures/Hinkal/hinkalActionFundApproveAndTransact.d.ts +0 -7
- package/data-structures/Hinkal/hinkalActionFundApproveAndTransact.mjs +0 -42
- package/data-structures/Hinkal/hinkalActionStake.d.ts +0 -3
- package/data-structures/Hinkal/hinkalApprove.cjs +0 -1
- package/data-structures/Hinkal/hinkalApprove.d.ts +0 -3
- package/data-structures/Hinkal/hinkalApprove.mjs +0 -115
- package/data-structures/Hinkal/hinkalInsideTransact.cjs +0 -1
- package/data-structures/Hinkal/hinkalInsideTransact.d.ts +0 -4
- package/data-structures/Hinkal/hinkalInsideTransact.mjs +0 -121
- package/error-handling/handleErrorRestore.cjs +0 -1
- package/error-handling/handleErrorRestore.d.ts +0 -2
- package/error-handling/handleErrorRestore.mjs +0 -11
- package/functions/staking/index.cjs +0 -1
- package/functions/staking/index.d.ts +0 -11
- package/functions/staking/index.mjs +0 -42
- package/functions/utils/replaceAddressInCalldata.cjs +0 -1
- package/functions/utils/replaceAddressInCalldata.d.ts +0 -1
- package/functions/utils/replaceAddressInCalldata.mjs +0 -7
- package/functions/web3/functionCalls/inHinkalApprovalCalls.cjs +0 -1
- package/functions/web3/functionCalls/inHinkalApprovalCalls.d.ts +0 -5
- package/functions/web3/functionCalls/inHinkalApprovalCalls.mjs +0 -32
- package/types/bridging.types.d.ts +0 -29
- package/types/duneAPI.types.d.ts +0 -9
- package/types/hinkal.stake.types.cjs +0 -1
- package/types/hinkal.stake.types.d.ts +0 -11
- package/types/hinkal.stake.types.mjs +0 -4
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { ethers as
|
|
2
|
-
import { recoverAuthorizationData as
|
|
1
|
+
import { ethers as n } from "ethers-v6h";
|
|
2
|
+
import { recoverAuthorizationData as y } from "../../private-wallet/emporium.helpers.mjs";
|
|
3
3
|
import { networkRegistry as i } from "../../../constants/chains.constants.mjs";
|
|
4
|
-
const
|
|
5
|
-
const { hinkalAddress: m, hinkalABI:
|
|
6
|
-
let r = { from:
|
|
4
|
+
const g = async (o, t, c, e, s) => {
|
|
5
|
+
const { hinkalAddress: m, hinkalABI: p } = i[o].contractData, f = new n.JsonRpcProvider(i[o].fetchRpcUrl), h = new n.Contract(m, p, f), l = "transact";
|
|
6
|
+
let r = { from: e.relay };
|
|
7
7
|
if (s) {
|
|
8
|
-
const
|
|
9
|
-
|
|
8
|
+
const a = y(s);
|
|
9
|
+
a && (r = { ...r, authorizationList: [a], type: 4 });
|
|
10
10
|
}
|
|
11
|
-
return await
|
|
11
|
+
return await h[l].estimateGas(
|
|
12
12
|
t[0],
|
|
13
13
|
t[1],
|
|
14
14
|
t[2],
|
|
15
15
|
c,
|
|
16
|
-
|
|
16
|
+
e,
|
|
17
17
|
r
|
|
18
18
|
);
|
|
19
19
|
};
|
|
20
20
|
export {
|
|
21
|
-
|
|
21
|
+
g as estimateGasRelayer
|
|
22
22
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../../utils/time.utils.cjs");require("../../../types/circom-data.types.cjs");const s=require("../../../types/transactions.types.cjs");require("../../../types/activities.types.cjs");const n=1*1e3,u=30*1e3,l=async(t,e,i=0)=>{if((await t.getTransactionReceipt(e))?.status!==s.TransactionReceiptStatus.Succeeded)return;i>0&&await t.waitForTransaction(e,i);const c=u/n;let r=null;for(let a=0;a<c;a+=1){try{if(r=await t.getTransaction(e),r)break}catch{}a<c-1&&await o.waitLittle(n)}return r??void 0};exports.recoverTransactionFromError=l;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { waitLittle as n } from "../../utils/time.utils.mjs";
|
|
2
|
+
import "../../../types/circom-data.types.mjs";
|
|
3
|
+
import { TransactionReceiptStatus as s } from "../../../types/transactions.types.mjs";
|
|
4
|
+
import "../../../types/activities.types.mjs";
|
|
5
|
+
const c = 1 * 1e3, m = 30 * 1e3, L = async (t, e, i = 0) => {
|
|
6
|
+
if ((await t.getTransactionReceipt(e))?.status !== s.Succeeded)
|
|
7
|
+
return;
|
|
8
|
+
i > 0 && await t.waitForTransaction(e, i);
|
|
9
|
+
const o = m / c;
|
|
10
|
+
let a = null;
|
|
11
|
+
for (let r = 0; r < o; r += 1) {
|
|
12
|
+
try {
|
|
13
|
+
if (a = await t.getTransaction(e), a)
|
|
14
|
+
break;
|
|
15
|
+
} catch {
|
|
16
|
+
}
|
|
17
|
+
r < o - 1 && await n(c);
|
|
18
|
+
}
|
|
19
|
+
return a ?? void 0;
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
L as recoverTransactionFromError
|
|
23
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("../../../constants/protocol.constants.cjs"),F=require("../../../types/ethereum-network.types.cjs"),S=require("../../utils/time.utils.cjs"),_=require("./approveTokensToHinkal.cjs"),z=require("./constructBatchCall.cjs"),G=require("./recoverTransactionFromError.cjs"),L=async(e,o,i,d,s,v,A,q,b)=>{const n=Array.isArray(i)?i:[i],r=Array.isArray(d)?d:[d];if(n.length!==r.length)throw new Error("token and amount length mismatch");const g=e.getContractWithSigner(o,F.ContractType.HinkalContract),B=await e.getEthereumAddress(),T=q??g,a=b??g,w="transact",y=r.findIndex(({erc20TokenAddress:t})=>t===x.zeroAddress),H=r.some(({erc20TokenAddress:t})=>t!==x.zeroAddress),l=y===-1?0n:n[y],u=e.getProviderAdapter();if(H&&await u.supportsBatchCall?.(o)&&u.sendBatchCallsTransaction){const t=r.map(E=>E.erc20TokenAddress),p=z.buildApproveAndTransactCalls(t,n,T.address,a,s,A,v,l);return await u.sendBatchCallsTransaction(o,p)}await _.approveTokensToHinkal(e,o,T,r,n);const C={value:l>0n?BigInt(l).toString():void 0};let c;const f=[s[0],s[1],s[2],A,v,{...C,from:B}];try{c=(await a.estimateGas[w](...f)).toNumber()}catch(t){console.log("hinkalDeposit: gas estimation error",{err:t})}const k=c&&c>=0?Math.ceil(c*12/10):void 0;C.gasLimit=k,await S.waitLittle();let h;try{h=await a[w](...f)}catch(t){if(!t?.transactionHash)throw t;const{provider:p}=a,m=await G.recoverTransactionFromError(p,t.transactionHash);if(!m)throw t;h=m}return h};exports.transactCallDirect=L;
|
|
@@ -3,4 +3,4 @@ import { IHinkal } from '../../../data-structures/Hinkal/IHinkal';
|
|
|
3
3
|
import { CircomDataBaseType, DimDataType } from '../../../types/circom-data.types';
|
|
4
4
|
import { ERC20Token } from '../../../types/token.types';
|
|
5
5
|
import { NewZkCallDataType } from '../../../types/snark.types';
|
|
6
|
-
export declare const transactCallDirect: (hinkal: IHinkal, amount: bigint | bigint[], tokenToApprove: ERC20Token | ERC20Token[], newZkCallData: NewZkCallDataType, circomData: CircomDataBaseType, dimData: DimDataType, contractApproval?: ethers.Contract, contractTransaction?: ethers.Contract) => Promise<any>;
|
|
6
|
+
export declare const transactCallDirect: (hinkal: IHinkal, chainId: number, amount: bigint | bigint[], tokenToApprove: ERC20Token | ERC20Token[], newZkCallData: NewZkCallDataType, circomData: CircomDataBaseType, dimData: DimDataType, contractApproval?: ethers.Contract, contractTransaction?: ethers.Contract) => Promise<any>;
|
|
@@ -1,51 +1,60 @@
|
|
|
1
|
-
import { zeroAddress as
|
|
2
|
-
import { ContractType as
|
|
3
|
-
import { waitLittle as
|
|
4
|
-
import { approveTokensToHinkal as
|
|
5
|
-
import { buildApproveAndTransactCalls as
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { zeroAddress as y } from "../../../constants/protocol.constants.mjs";
|
|
2
|
+
import { ContractType as L } from "../../../types/ethereum-network.types.mjs";
|
|
3
|
+
import { waitLittle as S } from "../../utils/time.utils.mjs";
|
|
4
|
+
import { approveTokensToHinkal as k } from "./approveTokensToHinkal.mjs";
|
|
5
|
+
import { buildApproveAndTransactCalls as z } from "./constructBatchCall.mjs";
|
|
6
|
+
import { recoverTransactionFromError as M } from "./recoverTransactionFromError.mjs";
|
|
7
|
+
const J = async (o, s, i, d, e, g, v, B, H) => {
|
|
8
|
+
const a = Array.isArray(i) ? i : [i], r = Array.isArray(d) ? d : [d];
|
|
9
|
+
if (a.length !== r.length)
|
|
9
10
|
throw new Error("token and amount length mismatch");
|
|
10
|
-
const
|
|
11
|
-
if (
|
|
12
|
-
const t =
|
|
11
|
+
const f = o.getContractWithSigner(s, L.HinkalContract), b = await o.getEthereumAddress(), w = B ?? f, n = H ?? f, u = "transact", C = r.findIndex(({ erc20TokenAddress: t }) => t === y), E = r.some(({ erc20TokenAddress: t }) => t !== y), m = C === -1 ? 0n : a[C], l = o.getProviderAdapter();
|
|
12
|
+
if (E && await l.supportsBatchCall?.(s) && l.sendBatchCallsTransaction) {
|
|
13
|
+
const t = r.map((G) => G.erc20TokenAddress), h = z(
|
|
13
14
|
t,
|
|
14
15
|
a,
|
|
15
|
-
|
|
16
|
-
s,
|
|
16
|
+
w.address,
|
|
17
17
|
n,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
e,
|
|
19
|
+
v,
|
|
20
|
+
g,
|
|
21
|
+
m
|
|
21
22
|
);
|
|
22
|
-
return await l.sendBatchCallsTransaction(
|
|
23
|
+
return await l.sendBatchCallsTransaction(s, h);
|
|
23
24
|
}
|
|
24
|
-
await
|
|
25
|
-
const
|
|
26
|
-
value:
|
|
25
|
+
await k(o, s, w, r, a);
|
|
26
|
+
const T = {
|
|
27
|
+
value: m > 0n ? BigInt(m).toString() : void 0
|
|
27
28
|
};
|
|
28
|
-
let
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
{ ...
|
|
29
|
+
let c;
|
|
30
|
+
const x = [
|
|
31
|
+
e[0],
|
|
32
|
+
e[1],
|
|
33
|
+
e[2],
|
|
34
|
+
v,
|
|
35
|
+
g,
|
|
36
|
+
{ ...T, from: b }
|
|
36
37
|
];
|
|
37
38
|
try {
|
|
38
|
-
|
|
39
|
-
signerAddress: await s.signer.getAddress(),
|
|
40
|
-
chainIdHinkal: r.getCurrentChainId(),
|
|
41
|
-
ethersNetwork: await s.provider.getNetwork()
|
|
42
|
-
});
|
|
39
|
+
c = (await n.estimateGas[u](...x)).toNumber();
|
|
43
40
|
} catch (t) {
|
|
44
41
|
console.log("hinkalDeposit: gas estimation error", { err: t });
|
|
45
42
|
}
|
|
46
|
-
const
|
|
47
|
-
|
|
43
|
+
const F = c && c >= 0 ? Math.ceil(c * 12 / 10) : void 0;
|
|
44
|
+
T.gasLimit = F, await S();
|
|
45
|
+
let p;
|
|
46
|
+
try {
|
|
47
|
+
p = await n[u](...x);
|
|
48
|
+
} catch (t) {
|
|
49
|
+
if (!t?.transactionHash)
|
|
50
|
+
throw t;
|
|
51
|
+
const { provider: h } = n, A = await M(h, t.transactionHash);
|
|
52
|
+
if (!A)
|
|
53
|
+
throw t;
|
|
54
|
+
p = A;
|
|
55
|
+
}
|
|
56
|
+
return p;
|
|
48
57
|
};
|
|
49
58
|
export {
|
|
50
|
-
|
|
59
|
+
J as transactCallDirect
|
|
51
60
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../../../error-handling/error-codes.constants.cjs");require("ethers");const y=require("../../../error-handling/customErrors/ErrorWithTx.cjs");require("../../../types/circom-data.types.cjs");require("../../../types/transactions.types.cjs");require("../../../types/activities.types.cjs");
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../../../error-handling/error-codes.constants.cjs");require("ethers");const y=require("../../../error-handling/customErrors/ErrorWithTx.cjs");require("../../../types/circom-data.types.cjs");require("../../../types/transactions.types.cjs");require("../../../types/activities.types.cjs");require("../../../constants/vite.constants.cjs");const u=require("../../../API/callRelayer.cjs");require("../../../constants/chains.constants.cjs");require("circomlibjs-hinkal-fork");require("../../../data-structures/crypto-keys/keys.cjs");const l=require("../../snarkjs/common.snarkjs.cjs");require("node-forge");require("libsodium-wrappers");const R=require("../../../data-structures/http/HttpClient.cjs");require("axios");require("../../../constants/token-data/index.cjs");require("idb-keyval");require("@solana/web3.js");require("../../utils/convertIntegrationProviderToExternalActionId.cjs");const C=require("../../../constants/server.constants.cjs"),w=require("../../../API/getServerURL.cjs");require("@coral-xyz/anchor");require("@solana/spl-token");require("../../../constants/contracts.constants.cjs");require("../../../constants/kyc.constants.cjs");require("../../../constants/coingecko.constants.cjs");require("../../../constants/reorg-depths.constants.cjs");require("../../../constants/addresses.constants.cjs");require("../../../constants/token.limits.constants.cjs");require("../../../constants/presale.constants.cjs");require("../../../constants/activity.constants.cjs");require("../../../constants/tasks.constants.cjs");require("../../../constants/events.constants.cjs");require("../../utils/userAgent.cjs");require("multiformats");require("async-mutex");require("../../../API/tenderly.api.cjs");require("process");require("buffer");require("../../../providers/EthersProviderAdapter.cjs");require("ethers-v6h");const q=r=>{if(r.status==="success")return r.message;throw r.message&&r.error?new y.ErrorWithRelayerTransaction(r.error,r.message):new Error(r.error)},D=async(r,a,t,i,c,s,o,e)=>{const n=l.serializeCircomData(i),h=await u.callRelayerTransactAPI({chainId:r,a:a[0],b:a[1],c:a[2],dimData:t,circomData:n,withPrivateMempool:c,withUniswapWorkAround:s,authorizationData:o,adminData:e});return q(h)},T=async r=>{const a=await R.httpClient.post(`${w.RELAYER_URL}${C.RELAYER_CONFIG.SOLANA_TRANSACT}`,r);return q(a)},m=r=>{if(r.status==="success")return r.message.scheduleId;throw new Error(r.error||"Batch transaction failed")},d=async(r,a,t,i)=>{const c=a.map(e=>l.serializeCircomData(e.circomData)),s={chainId:r,transactions:a.map((e,n)=>({chainId:r,a:e.zkCallData[0],b:e.zkCallData[1],c:e.zkCallData[2],dimData:e.dimData,circomData:c[n],withPrivateMempool:e.withPrivateMempool,withUniswapWorkAround:e.withUniswapWorkAround,authorizationData:e.authorizationData,adminData:e.adminData})),txCompletionTime:i,hashedEthereumAddress:t},o=await u.callRelayerTransactBatchAPI(s);return m(o)},A=async(r,a,t,i)=>{const c={chainId:r,transactions:a,hashedEthereumAddress:t,txCompletionTime:i},s=await u.callRelayerSolanaTransactBatchAPI(c);return m(s)};exports.solanaTransactCallRelayer=T;exports.solanaTransactCallRelayerBatch=A;exports.transactCallRelayer=D;exports.transactCallRelayerBatch=d;
|
|
@@ -6,7 +6,7 @@ export interface RelayerResponseInterface {
|
|
|
6
6
|
error?: string;
|
|
7
7
|
}
|
|
8
8
|
export declare const transactCallRelayer: (chainId: number, newZkCallData: NewZkCallDataType, dimData: DimDataType, circomData: CircomDataBaseType, withPrivateMempool?: boolean, withUniswapWorkAround?: boolean, authorizationData?: AuthorizationData, adminData?: AdminDataType) => Promise<RelayerTransaction>;
|
|
9
|
-
export declare const solanaTransactCallRelayer: (
|
|
9
|
+
export declare const solanaTransactCallRelayer: (body: SolanaTransactionBody) => Promise<RelayerTransaction>;
|
|
10
10
|
export interface RelayerBatchResponseInterface {
|
|
11
11
|
status: string;
|
|
12
12
|
message: {
|
|
@@ -1,36 +1,31 @@
|
|
|
1
1
|
import "../../../error-handling/error-codes.constants.mjs";
|
|
2
2
|
import "ethers";
|
|
3
|
-
import { ErrorWithRelayerTransaction as
|
|
3
|
+
import { ErrorWithRelayerTransaction as h } from "../../../error-handling/customErrors/ErrorWithTx.mjs";
|
|
4
4
|
import "../../../types/circom-data.types.mjs";
|
|
5
5
|
import "../../../types/transactions.types.mjs";
|
|
6
6
|
import "../../../types/activities.types.mjs";
|
|
7
|
-
import
|
|
8
|
-
import "../../../API/
|
|
9
|
-
import { httpClient as y } from "../../../data-structures/http/HttpClient.mjs";
|
|
10
|
-
import "axios";
|
|
7
|
+
import "../../../constants/vite.constants.mjs";
|
|
8
|
+
import { callRelayerTransactAPI as w, callRelayerTransactBatchAPI as D, callRelayerSolanaTransactBatchAPI as A } from "../../../API/callRelayer.mjs";
|
|
11
9
|
import "../../../constants/chains.constants.mjs";
|
|
12
10
|
import "circomlibjs-hinkal-fork";
|
|
13
|
-
import "libsodium-wrappers";
|
|
14
|
-
import "process";
|
|
15
|
-
import "buffer";
|
|
16
|
-
import "../../../constants/vite.constants.mjs";
|
|
17
|
-
import "../../../constants/save-depths.mjs";
|
|
18
|
-
import "../../../constants/reorg-depths.constants.mjs";
|
|
19
|
-
import "../../utils/mutexes.utils.mjs";
|
|
20
|
-
import "@coral-xyz/anchor";
|
|
21
|
-
import "@solana/web3.js";
|
|
22
11
|
import "../../../data-structures/crypto-keys/keys.mjs";
|
|
23
|
-
import { callRelayerTransactAPI as A, callRelayerTransactBatchAPI as D, callRelayerSolanaTransactBatchAPI as d } from "../../../API/callRelayer.mjs";
|
|
24
12
|
import { serializeCircomData as n } from "../../snarkjs/common.snarkjs.mjs";
|
|
25
13
|
import "node-forge";
|
|
14
|
+
import "libsodium-wrappers";
|
|
15
|
+
import { httpClient as d } from "../../../data-structures/http/HttpClient.mjs";
|
|
16
|
+
import "axios";
|
|
26
17
|
import "../../../constants/token-data/index.mjs";
|
|
27
18
|
import "idb-keyval";
|
|
19
|
+
import "@solana/web3.js";
|
|
28
20
|
import "../../utils/convertIntegrationProviderToExternalActionId.mjs";
|
|
29
|
-
import {
|
|
21
|
+
import { RELAYER_CONFIG as y } from "../../../constants/server.constants.mjs";
|
|
22
|
+
import { RELAYER_URL as R } from "../../../API/getServerURL.mjs";
|
|
23
|
+
import "@coral-xyz/anchor";
|
|
30
24
|
import "@solana/spl-token";
|
|
31
25
|
import "../../../constants/contracts.constants.mjs";
|
|
32
26
|
import "../../../constants/kyc.constants.mjs";
|
|
33
27
|
import "../../../constants/coingecko.constants.mjs";
|
|
28
|
+
import "../../../constants/reorg-depths.constants.mjs";
|
|
34
29
|
import "../../../constants/addresses.constants.mjs";
|
|
35
30
|
import "../../../constants/token.limits.constants.mjs";
|
|
36
31
|
import "../../../constants/presale.constants.mjs";
|
|
@@ -39,40 +34,44 @@ import "../../../constants/tasks.constants.mjs";
|
|
|
39
34
|
import "../../../constants/events.constants.mjs";
|
|
40
35
|
import "../../utils/userAgent.mjs";
|
|
41
36
|
import "multiformats";
|
|
37
|
+
import "async-mutex";
|
|
42
38
|
import "../../../API/tenderly.api.mjs";
|
|
39
|
+
import "process";
|
|
40
|
+
import "buffer";
|
|
41
|
+
import "../../../providers/EthersProviderAdapter.mjs";
|
|
43
42
|
import "ethers-v6h";
|
|
44
43
|
const e = (t) => {
|
|
45
44
|
if (t.status === "success")
|
|
46
45
|
return t.message;
|
|
47
|
-
throw t.message && t.error ? new
|
|
48
|
-
},
|
|
49
|
-
const p = n(i),
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
46
|
+
throw t.message && t.error ? new h(t.error, t.message) : new Error(t.error);
|
|
47
|
+
}, pt = async (t, a, o, i, c, m, s, r) => {
|
|
48
|
+
const p = n(i), u = await w({
|
|
49
|
+
chainId: t,
|
|
50
|
+
a: a[0],
|
|
51
|
+
b: a[1],
|
|
52
|
+
c: a[2],
|
|
53
|
+
dimData: o,
|
|
54
54
|
circomData: p,
|
|
55
55
|
withPrivateMempool: c,
|
|
56
56
|
withUniswapWorkAround: m,
|
|
57
57
|
authorizationData: s,
|
|
58
58
|
adminData: r
|
|
59
59
|
});
|
|
60
|
-
return e(
|
|
61
|
-
},
|
|
62
|
-
const a = await
|
|
63
|
-
`${f(t)}${w.SOLANA_TRANSACT}`,
|
|
64
|
-
o
|
|
65
|
-
);
|
|
60
|
+
return e(u);
|
|
61
|
+
}, nt = async (t) => {
|
|
62
|
+
const a = await d.post(`${R}${y.SOLANA_TRANSACT}`, t);
|
|
66
63
|
return e(a);
|
|
67
64
|
}, l = (t) => {
|
|
68
65
|
if (t.status === "success")
|
|
69
66
|
return t.message.scheduleId;
|
|
70
67
|
throw new Error(t.error || "Batch transaction failed");
|
|
71
|
-
},
|
|
72
|
-
const c =
|
|
68
|
+
}, et = async (t, a, o, i) => {
|
|
69
|
+
const c = a.map(
|
|
73
70
|
(r) => n(r.circomData)
|
|
74
71
|
), m = {
|
|
75
|
-
|
|
72
|
+
chainId: t,
|
|
73
|
+
transactions: a.map((r, p) => ({
|
|
74
|
+
chainId: t,
|
|
76
75
|
a: r.zkCallData[0],
|
|
77
76
|
b: r.zkCallData[1],
|
|
78
77
|
c: r.zkCallData[2],
|
|
@@ -80,23 +79,25 @@ const e = (t) => {
|
|
|
80
79
|
circomData: c[p],
|
|
81
80
|
withPrivateMempool: r.withPrivateMempool,
|
|
82
81
|
withUniswapWorkAround: r.withUniswapWorkAround,
|
|
83
|
-
authorizationData: r.authorizationData
|
|
82
|
+
authorizationData: r.authorizationData,
|
|
83
|
+
adminData: r.adminData
|
|
84
84
|
})),
|
|
85
85
|
txCompletionTime: i,
|
|
86
|
-
hashedEthereumAddress:
|
|
87
|
-
}, s = await D(
|
|
86
|
+
hashedEthereumAddress: o
|
|
87
|
+
}, s = await D(m);
|
|
88
88
|
return l(s);
|
|
89
|
-
},
|
|
90
|
-
const m = await
|
|
91
|
-
|
|
92
|
-
|
|
89
|
+
}, lt = async (t, a, o, i) => {
|
|
90
|
+
const m = await A({
|
|
91
|
+
chainId: t,
|
|
92
|
+
transactions: a,
|
|
93
|
+
hashedEthereumAddress: o,
|
|
93
94
|
txCompletionTime: i
|
|
94
95
|
});
|
|
95
96
|
return l(m);
|
|
96
97
|
};
|
|
97
98
|
export {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
99
|
+
nt as solanaTransactCallRelayer,
|
|
100
|
+
lt as solanaTransactCallRelayerBatch,
|
|
101
|
+
pt as transactCallRelayer,
|
|
102
|
+
et as transactCallRelayerBatch
|
|
102
103
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../../constants/protocol.constants.cjs"),c=require("../../types/ethereum-network.types.cjs"),i=async(n,o,t,e)=>{const r=n.getContractWithFetcher(o,c.ContractType.ERC20Contract,t);return t===a.zeroAddress?(await r.provider.getBalance(e)).toBigInt():(await r.balanceOf(e)).toBigInt()};exports.getPublicAddressBalance=i;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { type IHinkal } from '../../data-structures/Hinkal/IHinkal';
|
|
2
|
-
export declare const getPublicAddressBalance: (hinkal: IHinkal, tokenAddress: string, ethereumAddress: string) => Promise<bigint>;
|
|
2
|
+
export declare const getPublicAddressBalance: (hinkal: IHinkal, chainId: number, tokenAddress: string, ethereumAddress: string) => Promise<bigint>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { zeroAddress as
|
|
2
|
-
import { ContractType as
|
|
3
|
-
const
|
|
4
|
-
const a = o.getContractWithFetcher(
|
|
5
|
-
return t ===
|
|
1
|
+
import { zeroAddress as c } from "../../constants/protocol.constants.mjs";
|
|
2
|
+
import { ContractType as e } from "../../types/ethereum-network.types.mjs";
|
|
3
|
+
const p = async (o, n, t, r) => {
|
|
4
|
+
const a = o.getContractWithFetcher(n, e.ERC20Contract, t);
|
|
5
|
+
return t === c ? (await a.provider.getBalance(r)).toBigInt() : (await a.balanceOf(r)).toBigInt();
|
|
6
6
|
};
|
|
7
7
|
export {
|
|
8
|
-
|
|
8
|
+
p as getPublicAddressBalance
|
|
9
9
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("ethers"),o=require("../../constants/chains.constants.cjs"),h=require("../../externalABIs/index.cjs"),c=require("../../data-structures/http/HttpClient.cjs");require("axios");require("idb-keyval");const p=require("../utils/create-provider.cjs");require("../../constants/token-data/index.cjs");require("../../error-handling/error-codes.constants.cjs");require("../utils/convertIntegrationProviderToExternalActionId.cjs");require("../../types/circom-data.types.cjs");require("../../types/transactions.types.cjs");require("../../types/activities.types.cjs");require("circomlibjs-hinkal-fork");require("../../data-structures/crypto-keys/keys.cjs");require("../../constants/server.constants.cjs");require("../../
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("ethers"),o=require("../../constants/chains.constants.cjs"),h=require("../../externalABIs/index.cjs"),c=require("../../data-structures/http/HttpClient.cjs");require("axios");require("idb-keyval");const p=require("../utils/create-provider.cjs");require("../../constants/token-data/index.cjs");require("../../error-handling/error-codes.constants.cjs");require("../utils/convertIntegrationProviderToExternalActionId.cjs");require("../../types/circom-data.types.cjs");require("../../types/transactions.types.cjs");require("../../types/activities.types.cjs");require("circomlibjs-hinkal-fork");require("../../data-structures/crypto-keys/keys.cjs");require("../../constants/server.constants.cjs");require("../../API/getServerURL.cjs");require("../../constants/vite.constants.cjs");require("@solana/web3.js");require("@coral-xyz/anchor");require("@solana/spl-token");require("../../constants/contracts.constants.cjs");require("../../constants/kyc.constants.cjs");require("../../constants/coingecko.constants.cjs");require("../../constants/reorg-depths.constants.cjs");require("../../constants/addresses.constants.cjs");require("../../constants/token.limits.constants.cjs");require("../../constants/presale.constants.cjs");require("../../constants/activity.constants.cjs");require("../../constants/tasks.constants.cjs");require("../../constants/events.constants.cjs");require("../utils/userAgent.cjs");require("libsodium-wrappers");require("multiformats");require("async-mutex");require("../../API/tenderly.api.cjs");require("process");require("buffer");require("../../providers/EthersProviderAdapter.cjs");const a={[o.chainIds.base]:"base",[o.chainIds.optimism]:"optimism",[o.chainIds.arbMainnet]:"arbitrum",[o.chainIds.polygon]:"polygon",[o.chainIds.ethMainnet]:"eth"},k=async(e,r)=>{const i=`https://${a[e]}.blockscout.com/api?module=token&action=getTokenHolders&contractaddress=${r}&page=0&offset=10`,{result:q}=await c.httpClient.get(i),{fetchRpcUrl:n}=o.networkRegistry[e];if(!n)throw new Error("RPC URL not found for the specified chain ID");const l=p.createCustomRpcProvider(n),d=new u.ethers.Contract(r,h.ERC20ABI,l);for(const{address:s}of q)if((await d.balanceOf(s)).toBigInt()!==0n)return s},m=async(e,r)=>{const t=`https://api.routescan.io/v2/network/mainnet/evm/${e}/etherscan/api?module=token&action=tokenholderlist&contractaddress=${r}&page=1&offset=10&apikey=YourApiKeyToken`,{result:i}=await c.httpClient.get(t);return i.at(0)?.TokenHolderAddress},f=async(e,r)=>{try{if(!(e in a))throw new Error("Chain is not supported by blockscout");const t=await k(e,r);if(!t||!u.ethers.utils.isAddress(t))throw new Error("Token holder not found in blockscout");return t}catch{return await m(e,r)}};exports.getTokenHolder=f;
|
|
@@ -14,20 +14,15 @@ import "../../types/activities.types.mjs";
|
|
|
14
14
|
import "circomlibjs-hinkal-fork";
|
|
15
15
|
import "../../data-structures/crypto-keys/keys.mjs";
|
|
16
16
|
import "../../constants/server.constants.mjs";
|
|
17
|
-
import "../../constants/vite.constants.mjs";
|
|
18
17
|
import "../../API/getServerURL.mjs";
|
|
19
|
-
import "
|
|
20
|
-
import "process";
|
|
21
|
-
import "buffer";
|
|
22
|
-
import "../../constants/save-depths.mjs";
|
|
23
|
-
import "../../constants/reorg-depths.constants.mjs";
|
|
24
|
-
import "../utils/mutexes.utils.mjs";
|
|
25
|
-
import "@coral-xyz/anchor";
|
|
18
|
+
import "../../constants/vite.constants.mjs";
|
|
26
19
|
import "@solana/web3.js";
|
|
20
|
+
import "@coral-xyz/anchor";
|
|
27
21
|
import "@solana/spl-token";
|
|
28
22
|
import "../../constants/contracts.constants.mjs";
|
|
29
23
|
import "../../constants/kyc.constants.mjs";
|
|
30
24
|
import "../../constants/coingecko.constants.mjs";
|
|
25
|
+
import "../../constants/reorg-depths.constants.mjs";
|
|
31
26
|
import "../../constants/addresses.constants.mjs";
|
|
32
27
|
import "../../constants/token.limits.constants.mjs";
|
|
33
28
|
import "../../constants/presale.constants.mjs";
|
|
@@ -35,8 +30,13 @@ import "../../constants/activity.constants.mjs";
|
|
|
35
30
|
import "../../constants/tasks.constants.mjs";
|
|
36
31
|
import "../../constants/events.constants.mjs";
|
|
37
32
|
import "../utils/userAgent.mjs";
|
|
33
|
+
import "libsodium-wrappers";
|
|
38
34
|
import "multiformats";
|
|
35
|
+
import "async-mutex";
|
|
39
36
|
import "../../API/tenderly.api.mjs";
|
|
37
|
+
import "process";
|
|
38
|
+
import "buffer";
|
|
39
|
+
import "../../providers/EthersProviderAdapter.mjs";
|
|
40
40
|
const c = {
|
|
41
41
|
[i.base]: "base",
|
|
42
42
|
[i.optimism]: "optimism",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../../error-handling/error-codes.constants.cjs"),l=require("../../API/callLifiAPI.cjs"),d=require("./etherFunctions.cjs"),f=require("../../constants/protocol.constants.cjs"),m=async(e,o,i,s,a,n)=>{try{const r=d.getAmountInWei(e,i),c={fromChain:e.chainId,toChain:o.chainId,fromToken:e.erc20TokenAddress,toToken:o.erc20TokenAddress,fromAddress:a,fromAmount:r.toString(),order:"FASTEST",slippage:s,...n&&{toAddress:n}},{lifiResponse:t}=await l.callLifiAPI(c);return{lifiDataValue:t.transactionRequest.data,outSwapAmountValue:BigInt(t.estimate.toAmount),extraNativeTokenFee:e.erc20TokenAddress===f.zeroAddress?BigInt(t.transactionRequest.value)-r:BigInt(t.transactionRequest.value)}}catch{throw Error(u.transactionErrorCodes.NO_LIFI_PRICE)}};exports.getLifiPrice=m;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ERC20Token } from '../../types/token.types';
|
|
2
|
-
export declare const getLifiPrice: (
|
|
2
|
+
export declare const getLifiPrice: (inSwapToken: ERC20Token, outSwapToken: ERC20Token, inSwapAmount: string, bridgingSlippage: number, fromAddress: string, toAddress?: string) => Promise<{
|
|
3
3
|
lifiDataValue: string;
|
|
4
4
|
outSwapAmountValue: bigint;
|
|
5
5
|
extraNativeTokenFee: bigint;
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { transactionErrorCodes as
|
|
2
|
-
import { callLifiAPI as
|
|
3
|
-
import { getAmountInWei as
|
|
4
|
-
import { zeroAddress as
|
|
5
|
-
const
|
|
1
|
+
import { transactionErrorCodes as m } from "../../error-handling/error-codes.constants.mjs";
|
|
2
|
+
import { callLifiAPI as u } from "../../API/callLifiAPI.mjs";
|
|
3
|
+
import { getAmountInWei as f } from "./etherFunctions.mjs";
|
|
4
|
+
import { zeroAddress as d } from "../../constants/protocol.constants.mjs";
|
|
5
|
+
const h = async (t, o, i, a, s, n) => {
|
|
6
6
|
try {
|
|
7
|
-
const e =
|
|
7
|
+
const e = f(t, i), c = {
|
|
8
8
|
fromChain: t.chainId,
|
|
9
9
|
toChain: o.chainId,
|
|
10
10
|
fromToken: t.erc20TokenAddress,
|
|
11
11
|
toToken: o.erc20TokenAddress,
|
|
12
|
-
fromAddress:
|
|
12
|
+
fromAddress: s,
|
|
13
13
|
fromAmount: e.toString(),
|
|
14
14
|
order: "FASTEST",
|
|
15
15
|
// TO BE DECIDED
|
|
16
|
-
slippage:
|
|
16
|
+
slippage: a,
|
|
17
17
|
...n && { toAddress: n }
|
|
18
|
-
}, { lifiResponse: r } = await
|
|
18
|
+
}, { lifiResponse: r } = await u(c);
|
|
19
19
|
return {
|
|
20
20
|
lifiDataValue: r.transactionRequest.data,
|
|
21
21
|
outSwapAmountValue: BigInt(r.estimate.toAmount),
|
|
22
|
-
extraNativeTokenFee: t.erc20TokenAddress ===
|
|
22
|
+
extraNativeTokenFee: t.erc20TokenAddress === d ? BigInt(r.transactionRequest.value) - e : BigInt(r.transactionRequest.value)
|
|
23
23
|
};
|
|
24
24
|
} catch {
|
|
25
|
-
throw Error(
|
|
25
|
+
throw Error(m.NO_LIFI_PRICE);
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
28
|
export {
|
|
29
|
-
|
|
29
|
+
h as getLifiPrice
|
|
30
30
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../../API/callOdosAPI.cjs");require("../../constants/token-data/index.cjs");const n=require("../../constants/chains.constants.cjs"),d=require("../../constants/protocol.constants.cjs");require("../../constants/contracts.constants.cjs");require("../../constants/kyc.constants.cjs");require("../../constants/server.constants.cjs");require("../../constants/vite.constants.cjs");require("../../constants/coingecko.constants.cjs");require("../../constants/reorg-depths.constants.cjs");require("../../constants/addresses.constants.cjs");require("../../constants/token.limits.constants.cjs");require("../../constants/presale.constants.cjs");require("../../constants/activity.constants.cjs");require("../../constants/tasks.constants.cjs");require("../../constants/events.constants.cjs");const q=require("../../error-handling/error-codes.constants.cjs"),l=require("./etherFunctions.cjs");require("../../types/circom-data.types.cjs");require("../../types/transactions.types.cjs");require("../../types/activities.types.cjs");const A=async(r,e,t,u,i=.7)=>{try{const o={chainId:r!==31337?r:n.localhostNetwork,inputTokens:[{tokenAddress:e?.wrappedErc20TokenAddress??e.erc20TokenAddress,amount:l.getAmountInWei(e,u).toString()}],outputTokens:[{tokenAddress:t?.wrappedErc20TokenAddress??t.erc20TokenAddress,proportion:1}],userAddr:n.networkRegistry[r].contractData.odosExternalActionInstanceAddress||d.zeroAddress,slippageLimitPercent:i,disableRFQs:!0},{odosResponse:s,status:c}=await a.callOdosAPI(r,o);if(c!=="success")throw Error("Odos API Fetch Error");return{outSwapAmountValue:BigInt(s.outputTokens[0].amount),odosDataValue:s.transaction.data}}catch(o){throw console.log({error:o}),Error(q.transactionErrorCodes.NO_ODOS_PRICE)}};exports.getOdosPrice=A;
|
|
@@ -19,27 +19,14 @@ import { getAmountInWei as A } from "./etherFunctions.mjs";
|
|
|
19
19
|
import "../../types/circom-data.types.mjs";
|
|
20
20
|
import "../../types/transactions.types.mjs";
|
|
21
21
|
import "../../types/activities.types.mjs";
|
|
22
|
-
|
|
23
|
-
import "../../data-structures/http/HttpClient.mjs";
|
|
24
|
-
import "axios";
|
|
25
|
-
import "ethers";
|
|
26
|
-
import "circomlibjs-hinkal-fork";
|
|
27
|
-
import "libsodium-wrappers";
|
|
28
|
-
import "process";
|
|
29
|
-
import "buffer";
|
|
30
|
-
import "../../constants/save-depths.mjs";
|
|
31
|
-
import "../utils/mutexes.utils.mjs";
|
|
32
|
-
import "@coral-xyz/anchor";
|
|
33
|
-
import "@solana/web3.js";
|
|
34
|
-
import "../../data-structures/crypto-keys/keys.mjs";
|
|
35
|
-
const S = async (r, o, s, e, p = 0.7) => {
|
|
22
|
+
const z = async (r, o, s, i, p = 0.7) => {
|
|
36
23
|
try {
|
|
37
24
|
const t = {
|
|
38
25
|
chainId: r !== 31337 ? r : d,
|
|
39
26
|
inputTokens: [
|
|
40
27
|
{
|
|
41
28
|
tokenAddress: o?.wrappedErc20TokenAddress ?? o.erc20TokenAddress,
|
|
42
|
-
amount: A(o,
|
|
29
|
+
amount: A(o, i).toString()
|
|
43
30
|
}
|
|
44
31
|
],
|
|
45
32
|
outputTokens: [
|
|
@@ -52,20 +39,20 @@ const S = async (r, o, s, e, p = 0.7) => {
|
|
|
52
39
|
slippageLimitPercent: p,
|
|
53
40
|
disableRFQs: !0
|
|
54
41
|
// sometimes swap fails because of RFQs
|
|
55
|
-
}, { odosResponse:
|
|
42
|
+
}, { odosResponse: e, status: m } = await n(
|
|
56
43
|
r,
|
|
57
44
|
t
|
|
58
45
|
);
|
|
59
46
|
if (m !== "success")
|
|
60
47
|
throw Error("Odos API Fetch Error");
|
|
61
48
|
return {
|
|
62
|
-
outSwapAmountValue: BigInt(
|
|
63
|
-
odosDataValue:
|
|
49
|
+
outSwapAmountValue: BigInt(e.outputTokens[0].amount),
|
|
50
|
+
odosDataValue: e.transaction.data
|
|
64
51
|
};
|
|
65
52
|
} catch (t) {
|
|
66
53
|
throw console.log({ error: t }), Error(u.NO_ODOS_PRICE);
|
|
67
54
|
}
|
|
68
55
|
};
|
|
69
56
|
export {
|
|
70
|
-
|
|
57
|
+
z as getOdosPrice
|
|
71
58
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@solana/web3.js"),d=require("./etherFunctions.cjs"),g=require("../../constants/chains.constants.cjs"),b=require("../pre-transaction/solana.cjs"),I=require("../../API/callOkxAPI.cjs"),w=(o,r,n,s,c=.7)=>({amount:`${n}`,chainIndex:"501",fromTokenAddress:o.toString(),toTokenAddress:r.toString(),userWalletAddress:s,slippagePercent:`${c}`,directRoute:!0}),q=async(o,r,n,s,c=.5,i,a)=>{if(!g.isSolanaLike(o))throw new Error("OKX is only supported on Solana");const u=d.randomBigInt(31),p=d.getAmountInWei(r,s),{hinkalAddress:A,originalDeployer:l}=g.networkRegistry[o].contractData;if(!l)throw new Error("No original deployer configured for Solana program");if(a&&!i)throw new Error("Proxy wallet address is required");const S=new e.PublicKey(A),P=new e.PublicKey(l),k=a&&i?new e.PublicKey(i):b.getSwapperAccountPublicKeyFromSalt(S,P,u),y=new e.PublicKey(r.erc20TokenAddress),K=new e.PublicKey(n.erc20TokenAddress),m=w(y,K,p,k.toString(),c),{okxResponse:t,status:f}=await I.callOkxAPI({quote:m});if(f!=="success")throw Error("OKX API Fetch Error");if(t.code!=="0")throw new Error(`OKX API error: ${t.msg}`);const O=BigInt(t.data.routerResult.toTokenAmount),h=JSON.stringify({...t,swapperAccountSalt:u.toString()});return{outSwapAmountValue:O,okxDataValue:h}};exports.createOKXQuote=w;exports.getOKXPrice=q;
|