@hinkal/common 0.3.5 → 0.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/common/src/API/API.cjs +1 -1
- package/common/src/API/API.d.ts +6 -5
- package/common/src/API/API.mjs +75 -74
- package/common/src/API/admin-calls.cjs +1 -1
- package/common/src/API/admin-calls.d.ts +1 -1
- package/common/src/API/admin-calls.mjs +3 -1
- package/common/src/API/callLifiAPI.d.ts +1 -0
- package/common/src/API/callNearIntentsAPI.cjs +1 -1
- package/common/src/API/callNearIntentsAPI.mjs +2 -2
- package/common/src/API/callRelayer.cjs +1 -1
- package/common/src/API/callRelayer.d.ts +32 -1
- package/common/src/API/callRelayer.mjs +7 -1
- package/common/src/API/enclaveUtxoCalls.cjs +1 -1
- package/common/src/API/enclaveUtxoCalls.d.ts +16 -16
- package/common/src/API/enclaveUtxoCalls.mjs +3 -3
- package/common/src/API/evm-rpc-fallback.cjs +1 -0
- package/common/src/API/evm-rpc-fallback.d.ts +1 -0
- package/common/src/API/evm-rpc-fallback.mjs +17 -0
- package/common/src/API/evm-token-assets.cjs +1 -0
- package/common/src/API/evm-token-assets.d.ts +8 -0
- package/common/src/API/evm-token-assets.mjs +20 -0
- package/common/src/API/index.cjs +1 -1
- package/common/src/API/index.d.ts +1 -0
- package/common/src/API/index.mjs +1 -0
- package/common/src/API/route-config.cjs +1 -0
- package/common/src/API/route-config.d.ts +1 -0
- package/common/src/API/route-config.mjs +26 -0
- package/common/src/API/solana-nft-assets.cjs +1 -0
- package/common/src/API/solana-nft-assets.d.ts +1 -0
- package/common/src/API/solana-nft-assets.mjs +11 -0
- package/common/src/API/solana-priority-fee.cjs +1 -0
- package/common/src/API/solana-priority-fee.d.ts +3 -0
- package/common/src/API/solana-priority-fee.mjs +20 -0
- package/common/src/API/solana-rpc-fallback.cjs +1 -0
- package/common/src/API/solana-rpc-fallback.d.ts +1 -0
- package/common/src/API/solana-rpc-fallback.mjs +13 -0
- package/common/src/API/temporaryWalletCalls.cjs +1 -1
- package/common/src/API/temporaryWalletCalls.d.ts +0 -4
- package/common/src/API/temporaryWalletCalls.mjs +1 -5
- package/common/src/constants/balance.constants.d.ts +2 -0
- package/common/src/constants/bridging.constants.d.ts +1 -0
- package/common/src/constants/chains.constants.cjs +1 -1
- package/common/src/constants/chains.constants.d.ts +0 -3
- package/common/src/constants/chains.constants.mjs +33 -54
- package/common/src/constants/coingecko.constants.cjs +1 -1
- package/common/src/constants/coingecko.constants.mjs +1 -1
- package/common/src/constants/contracts.constants.cjs +1 -1
- package/common/src/constants/contracts.constants.d.ts +1 -0
- package/common/src/constants/contracts.constants.mjs +19 -15
- package/common/src/constants/deploy-data/deploy-data-arbMainnet.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-arbMainnet.json.mjs +3 -2
- package/common/src/constants/deploy-data/deploy-data-arcTestnet.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-arcTestnet.json.mjs +3 -2
- package/common/src/constants/deploy-data/deploy-data-base.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-base.json.mjs +3 -2
- package/common/src/constants/deploy-data/deploy-data-bnbMainnet.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-bnbMainnet.json.mjs +3 -2
- package/common/src/constants/deploy-data/deploy-data-ethMainnet.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-ethMainnet.json.mjs +3 -2
- package/common/src/constants/deploy-data/deploy-data-optimism.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-optimism.json.mjs +7 -6
- package/common/src/constants/deploy-data/deploy-data-polygon.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-polygon.json.mjs +3 -2
- package/common/src/constants/deploy-data/deploy-data-tempo.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-tempo.json.mjs +3 -2
- package/common/src/constants/deploy-data/shared-deploy-data-evm.json.cjs +1 -1
- package/common/src/constants/deploy-data/shared-deploy-data-evm.json.mjs +18 -1
- package/common/src/constants/deploy-data/shared-deploy-data-solana.json.cjs +1 -1
- package/common/src/constants/deploy-data/shared-deploy-data-solana.json.mjs +1 -1
- package/common/src/constants/okx.constants.d.ts +1 -0
- package/common/src/constants/protocol.constants.cjs +2 -2
- package/common/src/constants/protocol.constants.d.ts +4 -1
- package/common/src/constants/protocol.constants.mjs +3 -8
- package/common/src/constants/server.constants.cjs +1 -1
- package/common/src/constants/server.constants.d.ts +7 -2
- package/common/src/constants/server.constants.mjs +8 -3
- package/common/src/constants/vite.constants.cjs +1 -1
- package/common/src/constants/vite.constants.mjs +5 -23
- package/common/src/data-structures/ApprovalDBs/EventsPublicApprovalsDB.d.ts +1 -2
- package/common/src/data-structures/Hinkal/Hinkal.cjs +1 -1
- package/common/src/data-structures/Hinkal/Hinkal.d.ts +4 -4
- package/common/src/data-structures/Hinkal/Hinkal.mjs +39 -39
- package/common/src/data-structures/Hinkal/IHinkal.d.ts +4 -4
- package/common/src/data-structures/Hinkal/hinkalActionReceive.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalActionReceive.mjs +11 -9
- package/common/src/data-structures/Hinkal/hinkalBridgePrivateToPrivate.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalBridgePrivateToPrivate.d.ts +2 -1
- package/common/src/data-structures/Hinkal/hinkalBridgePrivateToPrivate.mjs +81 -90
- package/common/src/data-structures/Hinkal/hinkalClaimUtxo.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalClaimUtxo.d.ts +1 -1
- package/common/src/data-structures/Hinkal/hinkalClaimUtxo.mjs +3 -5
- package/common/src/data-structures/Hinkal/hinkalDepositAndBridge.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalDepositAndBridge.mjs +100 -104
- package/common/src/data-structures/Hinkal/hinkalDepositAndWithdraw.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalDepositAndWithdraw.d.ts +1 -1
- package/common/src/data-structures/Hinkal/hinkalDepositAndWithdraw.mjs +86 -93
- package/common/src/data-structures/Hinkal/hinkalDepositOnChainUtxos.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalDepositOnChainUtxos.d.ts +20 -7
- package/common/src/data-structures/Hinkal/hinkalDepositOnChainUtxos.mjs +51 -39
- package/common/src/data-structures/Hinkal/hinkalPrivateWallet.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalPrivateWallet.mjs +2 -2
- package/common/src/data-structures/Hinkal/hinkalProxyToPrivate.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalProxyToPrivate.mjs +15 -13
- package/common/src/data-structures/Hinkal/hinkalSolanaClaimUtxo.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaClaimUtxo.d.ts +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaClaimUtxo.mjs +3 -5
- package/common/src/data-structures/Hinkal/hinkalSolanaDeposit.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaDeposit.mjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.d.ts +2 -2
- package/common/src/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.mjs +88 -121
- package/common/src/data-structures/Hinkal/hinkalSolanaProxySend.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaProxySend.mjs +1 -3
- package/common/src/data-structures/Hinkal/hinkalSolanaProxyShield.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaProxyShield.d.ts +24 -2
- package/common/src/data-structures/Hinkal/hinkalSolanaProxyShield.mjs +77 -58
- package/common/src/data-structures/Hinkal/hinkalSolanaProxySwap.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaProxySwap.mjs +1 -3
- package/common/src/data-structures/Hinkal/hinkalSolanaSponsoredProxySend.d.ts +5 -0
- package/common/src/data-structures/Hinkal/hinkalSolanaSponsoredShield.cjs +1 -0
- package/common/src/data-structures/Hinkal/hinkalSolanaSponsoredShield.d.ts +8 -0
- package/common/src/data-structures/Hinkal/hinkalSolanaSponsoredShield.mjs +31 -0
- package/common/src/data-structures/Hinkal/hinkalSolanaTransact.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaTransact.mjs +44 -42
- package/common/src/data-structures/Hinkal/hinkalSolanaWithdraw.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaWithdraw.d.ts +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaWithdraw.mjs +29 -24
- package/common/src/data-structures/Hinkal/hinkalSwap.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSwap.d.ts +1 -1
- package/common/src/data-structures/Hinkal/hinkalSwap.mjs +27 -24
- package/common/src/data-structures/Hinkal/hinkalTransact.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalTransact.mjs +73 -56
- package/common/src/data-structures/Hinkal/hinkalWithdraw.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalWithdraw.d.ts +1 -1
- package/common/src/data-structures/Hinkal/hinkalWithdraw.mjs +21 -18
- package/common/src/data-structures/Hinkal/hinkalWithdrawStuckUtxos.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalWithdrawStuckUtxos.mjs +19 -18
- package/common/src/data-structures/Hinkal/index.d.ts +2 -0
- package/common/src/data-structures/Hinkal/resetMerkleTrees.cjs +1 -1
- package/common/src/data-structures/Hinkal/resetMerkleTrees.mjs +2 -2
- package/common/src/data-structures/TokenDBs/AlchemyPublicTokensDB.cjs +1 -1
- package/common/src/data-structures/TokenDBs/AlchemyPublicTokensDB.d.ts +0 -1
- package/common/src/data-structures/TokenDBs/AlchemyPublicTokensDB.mjs +55 -119
- package/common/src/data-structures/crypto-keys/decodeUTXO.cjs +1 -1
- package/common/src/data-structures/crypto-keys/decodeUTXO.mjs +11 -61
- package/common/src/data-structures/event-service/evm/BlockchainEventEmitter.cjs +1 -1
- package/common/src/data-structures/event-service/evm/BlockchainEventEmitter.d.ts +2 -0
- package/common/src/data-structures/event-service/evm/BlockchainEventEmitter.mjs +41 -27
- package/common/src/data-structures/merkle-tree/MerkleTree.cjs +1 -1
- package/common/src/data-structures/merkle-tree/MerkleTree.d.ts +1 -0
- package/common/src/data-structures/merkle-tree/MerkleTree.mjs +3 -0
- package/common/src/error-handling/get-error.message.cjs +1 -1
- package/common/src/error-handling/get-error.message.mjs +1 -4
- package/common/src/functions/index.cjs +1 -1
- package/common/src/functions/index.mjs +9 -6
- package/common/src/functions/pre-transaction/calculateSolanaNullifierCount.cjs +1 -1
- package/common/src/functions/pre-transaction/calculateSolanaNullifierCount.mjs +2 -3
- package/common/src/functions/pre-transaction/index.cjs +1 -1
- package/common/src/functions/pre-transaction/index.d.ts +1 -0
- package/common/src/functions/pre-transaction/index.mjs +1 -1
- package/common/src/functions/pre-transaction/merge-with-fee-structure-emporium.cjs +1 -1
- package/common/src/functions/pre-transaction/merge-with-fee-structure-emporium.mjs +2 -2
- package/common/src/functions/pre-transaction/sendV0Transaction.cjs +2 -2
- package/common/src/functions/pre-transaction/sendV0Transaction.d.ts +5 -2
- package/common/src/functions/pre-transaction/sendV0Transaction.mjs +4 -4
- package/common/src/functions/pre-transaction/solanaTransfer.utils.cjs +1 -1
- package/common/src/functions/pre-transaction/solanaTransfer.utils.mjs +16 -15
- package/common/src/functions/pre-transaction/speculativeUtxo.cjs +1 -0
- package/common/src/functions/pre-transaction/speculativeUtxo.d.ts +9 -0
- package/common/src/functions/pre-transaction/speculativeUtxo.mjs +19 -0
- package/common/src/functions/private-wallet/emporium.helpers.cjs +1 -1
- package/common/src/functions/private-wallet/emporium.helpers.d.ts +9 -2
- package/common/src/functions/private-wallet/emporium.helpers.mjs +93 -74
- package/common/src/functions/snarkjs/common.snarkjs.cjs +1 -1
- package/common/src/functions/snarkjs/common.snarkjs.d.ts +1 -0
- package/common/src/functions/snarkjs/common.snarkjs.mjs +36 -32
- package/common/src/functions/snarkjs/constant.cjs +1 -1
- package/common/src/functions/snarkjs/constant.d.ts +48 -0
- package/common/src/functions/snarkjs/constant.mjs +48 -0
- package/common/src/functions/snarkjs/constructGeneralZkProof.cjs +1 -1
- package/common/src/functions/snarkjs/constructGeneralZkProof.d.ts +1 -1
- package/common/src/functions/snarkjs/constructGeneralZkProof.mjs +75 -71
- package/common/src/functions/snarkjs/constructSolanaZkProof.cjs +1 -1
- package/common/src/functions/snarkjs/constructSolanaZkProof.d.ts +1 -1
- package/common/src/functions/snarkjs/constructSolanaZkProof.mjs +27 -27
- package/common/src/functions/snarkjs/constructTxEnclave.cjs +1 -1
- package/common/src/functions/snarkjs/constructTxEnclave.mjs +8 -3
- package/common/src/functions/snarkjs/fetchOnChainRootHashes.cjs +1 -1
- package/common/src/functions/snarkjs/fetchOnChainRootHashes.mjs +10 -21
- package/common/src/functions/snarkjs/getMerkleTreeSiblingsAndRootHashes.cjs +1 -1
- package/common/src/functions/snarkjs/getMerkleTreeSiblingsAndRootHashes.d.ts +2 -2
- package/common/src/functions/snarkjs/getMerkleTreeSiblingsAndRootHashes.mjs +3 -3
- package/common/src/functions/snarkjs/signedMessageHash.cjs +1 -1
- package/common/src/functions/snarkjs/signedMessageHash.d.ts +4 -0
- package/common/src/functions/snarkjs/signedMessageHash.mjs +27 -18
- package/common/src/functions/utils/addresses.cjs +1 -1
- package/common/src/functions/utils/addresses.mjs +19 -12
- package/common/src/functions/utils/bridge-arrival.utils.cjs +1 -0
- package/common/src/functions/utils/bridge-arrival.utils.d.ts +1 -0
- package/common/src/functions/utils/bridge-arrival.utils.mjs +15 -0
- package/common/src/functions/utils/bridge-claimable-utxo.utils.cjs +1 -0
- package/common/src/functions/utils/bridge-claimable-utxo.utils.d.ts +19 -0
- package/common/src/functions/utils/bridge-claimable-utxo.utils.mjs +24 -0
- package/common/src/functions/utils/bridge-claimable.utils.d.ts +2 -3
- package/common/src/functions/utils/create-provider.cjs +1 -1
- package/common/src/functions/utils/create-provider.d.ts +9 -2
- package/common/src/functions/utils/create-provider.mjs +42 -9
- package/common/src/functions/utils/deposit-claimable.utils.cjs +1 -1
- package/common/src/functions/utils/deposit-claimable.utils.d.ts +2 -5
- package/common/src/functions/utils/deposit-claimable.utils.mjs +1 -6
- package/common/src/functions/utils/enclave-utxo-storage.cjs +1 -1
- package/common/src/functions/utils/enclave-utxo-storage.d.ts +4 -8
- package/common/src/functions/utils/enclave-utxo-storage.mjs +13 -2
- package/common/src/functions/utils/fees.utils.cjs +1 -1
- package/common/src/functions/utils/fees.utils.d.ts +2 -0
- package/common/src/functions/utils/fees.utils.mjs +15 -6
- package/common/src/functions/utils/getUtxosFromReceipt.utils.cjs +1 -1
- package/common/src/functions/utils/getUtxosFromReceipt.utils.d.ts +1 -1
- package/common/src/functions/utils/getUtxosFromReceipt.utils.mjs +5 -51
- package/common/src/functions/utils/getUtxosFromReceiptSolana.cjs +1 -1
- package/common/src/functions/utils/getUtxosFromReceiptSolana.mjs +7 -23
- package/common/src/functions/utils/index.cjs +1 -1
- package/common/src/functions/utils/index.d.ts +6 -0
- package/common/src/functions/utils/index.mjs +10 -4
- package/common/src/functions/utils/nearIntents.utils.cjs +1 -1
- package/common/src/functions/utils/nearIntents.utils.mjs +27 -13
- package/common/src/functions/utils/publicBalance.utils.cjs +1 -1
- package/common/src/functions/utils/publicBalance.utils.d.ts +0 -1
- package/common/src/functions/utils/publicBalance.utils.mjs +35 -22
- package/common/src/functions/utils/recovery-balance.utils.cjs +1 -0
- package/common/src/functions/utils/recovery-balance.utils.d.ts +2 -0
- package/common/src/functions/utils/recovery-balance.utils.mjs +1 -0
- package/common/src/functions/utils/solana-program.utils.cjs +1 -0
- package/common/src/functions/utils/solana-program.utils.d.ts +3 -0
- package/common/src/functions/utils/solana-program.utils.mjs +17 -0
- package/common/src/functions/utils/solana-sponsored.utils.cjs +1 -0
- package/common/src/functions/utils/solana-sponsored.utils.d.ts +22 -0
- package/common/src/functions/utils/solana-sponsored.utils.mjs +30 -0
- package/common/src/functions/utils/solanaMint.utils.cjs +1 -1
- package/common/src/functions/utils/solanaMint.utils.d.ts +7 -0
- package/common/src/functions/utils/solanaMint.utils.mjs +18 -8
- package/common/src/functions/utils/sponsored-shield.utils.cjs +1 -0
- package/common/src/functions/utils/sponsored-shield.utils.d.ts +3 -0
- package/common/src/functions/utils/sponsored-shield.utils.mjs +3 -0
- package/common/src/functions/utils/temp-wallet.utils.cjs +1 -1
- package/common/src/functions/utils/temp-wallet.utils.d.ts +5 -4
- package/common/src/functions/utils/temp-wallet.utils.mjs +35 -14
- package/common/src/functions/utils/transfer-claimable.utils.cjs +1 -1
- package/common/src/functions/utils/transfer-claimable.utils.d.ts +1 -2
- package/common/src/functions/utils/transfer-claimable.utils.mjs +2 -5
- package/common/src/functions/utils/tron.utils.cjs +1 -1
- package/common/src/functions/utils/tron.utils.d.ts +2 -2
- package/common/src/functions/utils/tron.utils.mjs +19 -18
- package/common/src/functions/utils/tronSimulation.utils.cjs +1 -1
- package/common/src/functions/utils/tronSimulation.utils.mjs +4 -6
- package/common/src/functions/utils/tx-confirmation.utils.cjs +1 -1
- package/common/src/functions/utils/tx-confirmation.utils.mjs +1 -1
- package/common/src/functions/web3/events/getInputUtxosEnclave.cjs +1 -1
- package/common/src/functions/web3/events/getInputUtxosEnclave.mjs +15 -25
- package/common/src/functions/web3/functionCalls/submitProof.cjs +1 -1
- package/common/src/functions/web3/functionCalls/submitProof.mjs +6 -6
- package/common/src/functions/web3/functionCalls/transactCallRelayer.cjs +1 -1
- package/common/src/functions/web3/functionCalls/transactCallRelayer.d.ts +2 -2
- package/common/src/functions/web3/functionCalls/transactCallRelayer.mjs +8 -6
- package/common/src/functions/web3/getContractMetadata.cjs +1 -1
- package/common/src/functions/web3/getContractMetadata.mjs +1 -1
- package/common/src/functions/web3/getPublicAddressBalance.cjs +1 -1
- package/common/src/functions/web3/getPublicAddressBalance.d.ts +1 -2
- package/common/src/functions/web3/getPublicAddressBalance.mjs +6 -5
- package/common/src/functions/web3/index.cjs +1 -1
- package/common/src/functions/web3/index.d.ts +1 -1
- package/common/src/functions/web3/index.mjs +1 -1
- package/common/src/providers/SolanaProviderAdapter.cjs +1 -1
- package/common/src/providers/SolanaProviderAdapter.mjs +1 -2
- package/common/src/providers/WagmiProviderAdapter.cjs +1 -1
- package/common/src/providers/WagmiProviderAdapter.mjs +35 -38
- package/common/src/types/bridging-tx.types.d.ts +1 -4
- package/common/src/types/cache.types.cjs +1 -1
- package/common/src/types/cache.types.d.ts +0 -1
- package/common/src/types/cache.types.mjs +1 -1
- package/common/src/types/ethereum-network.types.cjs +1 -1
- package/common/src/types/ethereum-network.types.d.ts +9 -7
- package/common/src/types/ethereum-network.types.mjs +1 -1
- package/common/src/types/external-action.types.cjs +1 -1
- package/common/src/types/external-action.types.d.ts +1 -0
- package/common/src/types/external-action.types.mjs +1 -1
- package/common/src/types/index.cjs +1 -1
- package/common/src/types/index.d.ts +1 -1
- package/common/src/types/index.mjs +1 -1
- package/common/src/types/pay-activities.types.d.ts +3 -1
- package/common/src/types/remote-tx-build.types.d.ts +23 -0
- package/common/src/types/scheduled-transactions.types.d.ts +4 -12
- package/common/src/types/solana.types.cjs +1 -0
- package/common/src/types/solana.types.d.ts +5 -0
- package/common/src/types/solana.types.mjs +6 -0
- package/common/src/types/temp-wallet.types.d.ts +9 -0
- package/common/src/types/token.types.d.ts +1 -0
- package/common/src/webworker/logError-RKYfeI6h.js +2 -0
- package/common/src/webworker/package.json +21 -19
- package/common/src/webworker/snarkjsWorker/snarkjsWorkerLauncher.ts?worker&url.cjs +1 -1
- package/common/src/webworker/snarkjsWorker/snarkjsWorkerLauncher.ts?worker&url.mjs +1 -1
- package/common/src/webworker/snarkjsWorkerNode.cjs +1 -1
- package/common/src/webworker/utxoWorker/utxoWorkerLauncher.ts?worker&url.cjs +1 -1
- package/common/src/webworker/utxoWorker/utxoWorkerLauncher.ts?worker&url.mjs +1 -1
- package/common/src/webworker/utxoWorkerNode.cjs +1 -1
- package/common/src/webworker/viteWorkerURL.constant.cjs +28 -1
- package/common/src/webworker/viteWorkerURL.constant.mjs +27 -13
- package/common/src/webworker/workerProxy-COB7g4Qc.js +1 -0
- package/common/src/webworker/zkProofWorker/zkProofWorkerLauncher.ts?worker&url.cjs +1 -1
- package/common/src/webworker/zkProofWorker/zkProofWorkerLauncher.ts?worker&url.mjs +1 -1
- package/common/src/webworker/zkProofWorkerNode.cjs +1 -1
- package/package.json +25 -23
- package/services/Hinkal.cjs +1 -1
- package/services/Hinkal.d.ts +2 -2
- package/services/Hinkal.mjs +3 -3
- package/types/IHinkal.d.ts +2 -2
- package/assets/snarkjsWorkerLauncher-SrStwJvX.js +0 -1
- package/assets/snarkjsWorkerLogic-DtIjisbE.js +0 -132
- package/assets/utxoWorkerLauncher-CIBeBAML.js +0 -1
- package/assets/utxoWorkerLogic-C8R4GSaf.js +0 -199
- package/assets/zkProofWorkerLauncher-DfwteloJ.js +0 -1
- package/assets/zkProofWorkerLogic-CY9y6rOV.js +0 -199
- package/common/src/API/deposit-and-withdraw-status-calls.cjs +0 -1
- package/common/src/API/deposit-and-withdraw-status-calls.d.ts +0 -21
- package/common/src/API/deposit-and-withdraw-status-calls.mjs +0 -13
- package/common/src/data-structures/Hinkal/hinkalTronDepositToSelf.cjs +0 -1
- package/common/src/data-structures/Hinkal/hinkalTronDepositToSelf.d.ts +0 -8
- package/common/src/data-structures/Hinkal/hinkalTronDepositToSelf.mjs +0 -30
- package/common/src/data-structures/Hinkal/prepareTronDepositToSelf.cjs +0 -1
- package/common/src/data-structures/Hinkal/prepareTronDepositToSelf.mjs +0 -31
- package/common/src/functions/pre-transaction/waitForDepositedUtxosInMerkleTree.cjs +0 -1
- package/common/src/functions/pre-transaction/waitForDepositedUtxosInMerkleTree.mjs +0 -29
- package/common/src/functions/utils/enum.utils.cjs +0 -1
- package/common/src/functions/utils/enum.utils.mjs +0 -12
- package/common/src/functions/web3/getSolanaPriorityFee.cjs +0 -1
- package/common/src/functions/web3/getSolanaPriorityFee.d.ts +0 -3
- package/common/src/functions/web3/getSolanaPriorityFee.mjs +0 -26
- package/common/src/types/scheduled-transactions.types.cjs +0 -1
- package/common/src/types/scheduled-transactions.types.mjs +0 -6
- package/common/src/webworker/logError-Dex6ch32.js +0 -2
- package/common/src/webworker/workerProxy-BuJUMCQ4.js +0 -1
|
@@ -5,6 +5,7 @@ import "./amounts.utils.mjs";
|
|
|
5
5
|
import "./time.utils.mjs";
|
|
6
6
|
import "./upToDateState.mjs";
|
|
7
7
|
import "./cacheFunctions.mjs";
|
|
8
|
+
import "./encodeTokenWithId.mjs";
|
|
8
9
|
import "./enclaveHandshakeService.mjs";
|
|
9
10
|
import "./encryptInputForEnclave.mjs";
|
|
10
11
|
import "./solanaMint.utils.mjs";
|
|
@@ -33,15 +34,13 @@ import "../pre-transaction/sendV0Transaction.mjs";
|
|
|
33
34
|
import "./bytes32.utils.mjs";
|
|
34
35
|
import "../pre-transaction/getFeeStructure.mjs";
|
|
35
36
|
import "../pre-transaction/getExternalSwapAddress.mjs";
|
|
36
|
-
import "../pre-transaction/
|
|
37
|
+
import "../pre-transaction/speculativeUtxo.mjs";
|
|
37
38
|
import "../pre-transaction/buildCommitmentValidationData.mjs";
|
|
38
39
|
import "../pre-transaction/index.mjs";
|
|
40
|
+
import "./solana-program.utils.mjs";
|
|
39
41
|
import "./getContractAddress.mjs";
|
|
40
42
|
import "./getSignerFromContract.mjs";
|
|
41
43
|
import "./tronSimulation.utils.mjs";
|
|
42
|
-
import "./tx-confirmation.utils.mjs";
|
|
43
|
-
import "./getUtxosFromReceipt.utils.mjs";
|
|
44
|
-
import "./getRecipientInfoFromUserKeys.mjs";
|
|
45
44
|
import "./resolve-domain-address.mjs";
|
|
46
45
|
import "./resolve-sync.utils.mjs";
|
|
47
46
|
import "./convertIntegrationProviderToExternalActionId.mjs";
|
|
@@ -52,6 +51,7 @@ import "./cacheDevice.utils.mjs";
|
|
|
52
51
|
import "./getBlockExplorerUrl.mjs";
|
|
53
52
|
import "./involves-permit2-op.mjs";
|
|
54
53
|
import "./convertEmporiumOpToCallInfo.mjs";
|
|
54
|
+
import "./getRecipientInfoFromUserKeys.mjs";
|
|
55
55
|
import "./publicBalance.utils.mjs";
|
|
56
56
|
import "./rpc-int-encode.mjs";
|
|
57
57
|
import "./walletBalances.utils.mjs";
|
|
@@ -62,17 +62,22 @@ import "./postToOffscreen.mjs";
|
|
|
62
62
|
import "./solanaSendPreflight.utils.mjs";
|
|
63
63
|
import "./voidWallets.utils.mjs";
|
|
64
64
|
import "./prepareHinkal.mjs";
|
|
65
|
+
import "./getUtxosFromReceipt.utils.mjs";
|
|
65
66
|
import "./getUtxosFromReceiptSolana.mjs";
|
|
66
67
|
import "./fees.utils.mjs";
|
|
68
|
+
import "./recovery-balance.utils.mjs";
|
|
67
69
|
import "./proxyAvatar.utils.mjs";
|
|
68
70
|
import "./enclave-utxo-storage.mjs";
|
|
69
71
|
import "./enclave-signature-storage.mjs";
|
|
72
|
+
import "./tx-confirmation.utils.mjs";
|
|
70
73
|
import "./buildClaimableDepositPlan.mjs";
|
|
71
74
|
import "./deposit-claimable.utils.mjs";
|
|
72
75
|
import "./formatter.mjs";
|
|
73
76
|
import "./transfer-claimable.utils.mjs";
|
|
77
|
+
import "./bridge-arrival.utils.mjs";
|
|
74
78
|
import "./bridge-flow.utils.mjs";
|
|
75
79
|
import "./bridge-claimable.utils.mjs";
|
|
80
|
+
import "./solana-sponsored.utils.mjs";
|
|
76
81
|
import "./temp-wallet.utils.mjs";
|
|
77
82
|
import "./dispatchBalanceRefreshes.mjs";
|
|
78
83
|
import "./lifi.utils.mjs";
|
|
@@ -83,3 +88,4 @@ import "./nearIntents.utils.mjs";
|
|
|
83
88
|
import "./enclaveSessionSigning.mjs";
|
|
84
89
|
import "./validateWalletAddress.mjs";
|
|
85
90
|
import "./waasStamp.mjs";
|
|
91
|
+
import "./sponsored-shield.utils.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../../constants/chains.constants.cjs`)
|
|
1
|
+
const e=require(`../../constants/chains.constants.cjs`),t=require(`../../constants/protocol.constants.cjs`),n=require(`./caseInsensitive.utils.cjs`),r=require(`./addresses.cjs`),i=require(`./tron.utils.cjs`),a=require(`../../types/external-action.types.cjs`);require(`./erc20tokenFunctions.cjs`);const o=require(`../pre-transaction/getFeeStructure.cjs`),s=require(`../../constants/bridging.constants.cjs`),c=require(`../../API/callNearIntentsAPI.cjs`);var l=(t,n)=>{if(!n||!e.isTronLike(t))return n;try{return i.addressToHexFormat(n)}catch{return n}},u=async(e,t)=>{let i=s.NEAR_INTENTS_BLOCKCHAIN_BY_CHAIN_ID[e];if(!i)throw Error(`NEAR Intents does not support chain ${e}`);let a=(await c.getNearIntentsTokens()).filter(e=>e.blockchain===i),o=r.isNativePlaceholderAddress(t)?a.find(e=>!e.contractAddress):a.find(r=>r.contractAddress&&n.caseInsensitiveEqual(l(e,r.contractAddress),t));if(!o)throw Error(`No NEAR Intents asset for token ${t} on chain ${e}`);return o.assetId},d=(e,n,r)=>o.getFeeStructure(e,n.erc20TokenAddress,[n.erc20TokenAddress],a.ExternalActionId.Transact,[],t.HINKAL_PRIVATE_SEND_VARIABLE_RATE,{mintTo:n.erc20TokenAddress,recipient:r,nullifierCount:n.erc20TokenAddress===`11111111111111111111111111111111`?0:1});exports.buildNearBridgeFeeStructure=d,exports.resolveNearAssetId=u;
|
|
@@ -1,17 +1,31 @@
|
|
|
1
|
-
import "../../constants/chains.constants.mjs";
|
|
2
|
-
import { HINKAL_PRIVATE_SEND_VARIABLE_RATE as
|
|
3
|
-
import "./
|
|
4
|
-
import "./
|
|
5
|
-
import {
|
|
1
|
+
import { isTronLike as e } from "../../constants/chains.constants.mjs";
|
|
2
|
+
import { HINKAL_PRIVATE_SEND_VARIABLE_RATE as t } from "../../constants/protocol.constants.mjs";
|
|
3
|
+
import { caseInsensitiveEqual as n } from "./caseInsensitive.utils.mjs";
|
|
4
|
+
import { isNativePlaceholderAddress as r } from "./addresses.mjs";
|
|
5
|
+
import { addressToHexFormat as i } from "./tron.utils.mjs";
|
|
6
|
+
import { ExternalActionId as a } from "../../types/external-action.types.mjs";
|
|
6
7
|
import "./erc20tokenFunctions.mjs";
|
|
7
|
-
import { getFeeStructure as
|
|
8
|
-
import "../../constants/bridging.constants.mjs";
|
|
9
|
-
import "../../API/callNearIntentsAPI.mjs";
|
|
8
|
+
import { getFeeStructure as o } from "../pre-transaction/getFeeStructure.mjs";
|
|
9
|
+
import { NEAR_INTENTS_BLOCKCHAIN_BY_CHAIN_ID as s } from "../../constants/bridging.constants.mjs";
|
|
10
|
+
import { getNearIntentsTokens as c } from "../../API/callNearIntentsAPI.mjs";
|
|
10
11
|
//#region libs/shared/common/src/functions/utils/nearIntents.utils.ts
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
var l = (t, n) => {
|
|
13
|
+
if (!n || !e(t)) return n;
|
|
14
|
+
try {
|
|
15
|
+
return i(n);
|
|
16
|
+
} catch {
|
|
17
|
+
return n;
|
|
18
|
+
}
|
|
19
|
+
}, u = async (e, t) => {
|
|
20
|
+
let i = s[e];
|
|
21
|
+
if (!i) throw Error(`NEAR Intents does not support chain ${e}`);
|
|
22
|
+
let a = (await c()).filter((e) => e.blockchain === i), o = r(t) ? a.find((e) => !e.contractAddress) : a.find((r) => r.contractAddress && n(l(e, r.contractAddress), t));
|
|
23
|
+
if (!o) throw Error(`No NEAR Intents asset for token ${t} on chain ${e}`);
|
|
24
|
+
return o.assetId;
|
|
25
|
+
}, d = (e, n, r) => o(e, n.erc20TokenAddress, [n.erc20TokenAddress], a.Transact, [], t, {
|
|
26
|
+
mintTo: n.erc20TokenAddress,
|
|
27
|
+
recipient: r,
|
|
28
|
+
nullifierCount: n.erc20TokenAddress === "11111111111111111111111111111111" ? 0 : 1
|
|
15
29
|
});
|
|
16
30
|
//#endregion
|
|
17
|
-
export {
|
|
31
|
+
export { d as buildNearBridgeFeeStructure, u as resolveNearAssetId };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../../../../_virtual/_rolldown/runtime.cjs`)
|
|
1
|
+
require(`../../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../constants/chains.constants.cjs`),t=require(`../../constants/protocol.constants.cjs`);require(`../../data-structures/http/index.cjs`);const n=require(`./solanaMint.utils.cjs`),r=require(`./addresses.cjs`),i=require(`../../error-handling/logger.cjs`),a=require(`./erc20tokenFunctions.cjs`),o=require(`./create-provider.cjs`);require(`../../externalABIs/index.cjs`);const s=require(`../../externalABIs/swapAbi.cjs`);require(`./ipfs.cjs`),require(`../../data-structures/IndexedDB/key-val-store.cjs`);let c=require(`ethers`),l=require(`@solana/web3.js`);var u=async(e,n,r)=>{try{let i=r.erc20TokenAddress,a,o=new c.ethers.Contract(r.erc20TokenAddress,s.ERC20ABI,e);a=i===t.zeroAddress?await e.getBalance(n):await o?.balanceOf(n);let l=a;return l<=0n?null:{token:r,balance:l}}catch{return null}},d=async(e,t,r)=>{if(r.erc20TokenAddress===`11111111111111111111111111111111`)return BigInt(await e.getBalance(t));let i=await n.getSolanaAtaAddress(r,t);if(!await e.getAccountInfo(i))return 0n;let a=await e.getTokenAccountBalance(i);return BigInt(a.value.amount)},f=async(n,u,f)=>{try{if(e.isSolanaLike(n)){if(!r.isValidSolanaPublicKey(u))return null;let{rpcUrl:t}=e.networkRegistry[n],i=o.createCustomSolanaConnection(t),s=new l.PublicKey(u);if(f===`11111111111111111111111111111111`)return BigInt(await i.getBalance(s));let c=await a.getErc20TokenFromAPI(n,f);return c?d(i,s,c):null}let i=o.createJsonRpcProvider(n),p=new c.ethers.Contract(f,s.ERC20ABI,i),m;return m=f===t.zeroAddress?await i.getBalance(u):await p?.balanceOf(u),m}catch{return i.Logger.error(`Failed to fetch public balance for address ${u}`),null}};exports.getPublicBalance=u,exports.getPublicBalanceByTokenAddress=f;
|
|
@@ -3,5 +3,4 @@ import { ERC20Token, TokenBalance } from '../../types/token.types';
|
|
|
3
3
|
export declare const getPublicBalance: (provider: ethers.JsonRpcProvider, ethereumAddress: string, token: ERC20Token) => Promise<TokenBalance | null>;
|
|
4
4
|
export declare const getPublicBalancesOfTokens: (chainId: number, ethereumAddress: string, tokens?: ERC20Token[]) => Promise<TokenBalance[]>;
|
|
5
5
|
export declare const getPublicBalanceByTokenAddress: (chainId: number, ethereumAddress: string, tokenAddress: string) => Promise<bigint | null>;
|
|
6
|
-
export declare const getPublicTransactionCount: (chainId: number, address: string) => Promise<number>;
|
|
7
6
|
export declare const getSolanaPublicBalances: (chainId: number, ethereumAddress: string, tokensToUpdate: ERC20Token[]) => Promise<TokenBalance[]>;
|
|
@@ -1,37 +1,50 @@
|
|
|
1
|
-
import "../../constants/chains.constants.mjs";
|
|
2
|
-
import { zeroAddress as
|
|
1
|
+
import { isSolanaLike as e, networkRegistry as t } from "../../constants/chains.constants.mjs";
|
|
2
|
+
import { zeroAddress as n } from "../../constants/protocol.constants.mjs";
|
|
3
3
|
import "../../data-structures/http/index.mjs";
|
|
4
|
-
import "./
|
|
5
|
-
import {
|
|
6
|
-
import "
|
|
7
|
-
import {
|
|
4
|
+
import { getSolanaAtaAddress as r } from "./solanaMint.utils.mjs";
|
|
5
|
+
import { isValidSolanaPublicKey as i } from "./addresses.mjs";
|
|
6
|
+
import { Logger as a } from "../../error-handling/logger.mjs";
|
|
7
|
+
import { getErc20TokenFromAPI as o } from "./erc20tokenFunctions.mjs";
|
|
8
|
+
import { createCustomSolanaConnection as s, createJsonRpcProvider as c } from "./create-provider.mjs";
|
|
8
9
|
import "../../externalABIs/index.mjs";
|
|
9
|
-
import { ERC20ABI as
|
|
10
|
+
import { ERC20ABI as l } from "../../externalABIs/swapAbi.mjs";
|
|
10
11
|
import "./ipfs.mjs";
|
|
11
12
|
import "../../data-structures/IndexedDB/key-val-store.mjs";
|
|
12
|
-
import { ethers as
|
|
13
|
-
import "@solana/web3.js";
|
|
14
|
-
import "@solana/spl-token";
|
|
13
|
+
import { ethers as u } from "ethers";
|
|
14
|
+
import { PublicKey as d } from "@solana/web3.js";
|
|
15
15
|
//#region libs/shared/common/src/functions/utils/publicBalance.utils.ts
|
|
16
|
-
var
|
|
16
|
+
var f = async (e, t, r) => {
|
|
17
17
|
try {
|
|
18
|
-
let
|
|
19
|
-
|
|
20
|
-
let
|
|
21
|
-
return
|
|
22
|
-
token:
|
|
23
|
-
balance:
|
|
18
|
+
let i = r.erc20TokenAddress, a, o = new u.Contract(r.erc20TokenAddress, l, e);
|
|
19
|
+
a = i === n ? await e.getBalance(t) : await o?.balanceOf(t);
|
|
20
|
+
let s = a;
|
|
21
|
+
return s <= 0n ? null : {
|
|
22
|
+
token: r,
|
|
23
|
+
balance: s
|
|
24
24
|
};
|
|
25
25
|
} catch {
|
|
26
26
|
return null;
|
|
27
27
|
}
|
|
28
|
-
},
|
|
28
|
+
}, p = async (e, t, n) => {
|
|
29
|
+
if (n.erc20TokenAddress === "11111111111111111111111111111111") return BigInt(await e.getBalance(t));
|
|
30
|
+
let i = await r(n, t);
|
|
31
|
+
if (!await e.getAccountInfo(i)) return 0n;
|
|
32
|
+
let a = await e.getTokenAccountBalance(i);
|
|
33
|
+
return BigInt(a.value.amount);
|
|
34
|
+
}, m = async (r, f, m) => {
|
|
29
35
|
try {
|
|
30
|
-
|
|
31
|
-
|
|
36
|
+
if (e(r)) {
|
|
37
|
+
if (!i(f)) return null;
|
|
38
|
+
let { rpcUrl: e } = t[r], n = s(e), a = new d(f);
|
|
39
|
+
if (m === "11111111111111111111111111111111") return BigInt(await n.getBalance(a));
|
|
40
|
+
let c = await o(r, m);
|
|
41
|
+
return c ? p(n, a, c) : null;
|
|
42
|
+
}
|
|
43
|
+
let a = c(r), h = new u.Contract(m, l, a), g;
|
|
44
|
+
return g = m === n ? await a.getBalance(f) : await h?.balanceOf(f), g;
|
|
32
45
|
} catch {
|
|
33
|
-
return
|
|
46
|
+
return a.error(`Failed to fetch public balance for address ${f}`), null;
|
|
34
47
|
}
|
|
35
48
|
};
|
|
36
49
|
//#endregion
|
|
37
|
-
export {
|
|
50
|
+
export { f as getPublicBalance, m as getPublicBalanceByTokenAddress };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require(`../../data-structures/token-price-fetcher/TokenChecker.cjs`);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "../../data-structures/token-price-fetcher/TokenChecker.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require(`../../../../_virtual/_rolldown/runtime.cjs`);let e=require(`@solana/web3.js`),t=require(`@coral-xyz/anchor`);var n=()=>{let t=e.Keypair.generate();return{publicKey:t.publicKey,payer:t,signTransaction:async e=>e,signAllTransactions:async e=>e}},r=(e,r)=>new t.Program(r,new t.AnchorProvider(e,n(),{preflightCommitment:`confirmed`,commitment:`confirmed`}));exports.createReadOnlySolanaProgram=r;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Keypair as e } from "@solana/web3.js";
|
|
2
|
+
import { AnchorProvider as t, Program as n } from "@coral-xyz/anchor";
|
|
3
|
+
//#region libs/shared/common/src/functions/utils/solana-program.utils.ts
|
|
4
|
+
var r = () => {
|
|
5
|
+
let t = e.generate();
|
|
6
|
+
return {
|
|
7
|
+
publicKey: t.publicKey,
|
|
8
|
+
payer: t,
|
|
9
|
+
signTransaction: async (e) => e,
|
|
10
|
+
signAllTransactions: async (e) => e
|
|
11
|
+
};
|
|
12
|
+
}, i = (e, i) => new n(i, new t(e, r(), {
|
|
13
|
+
preflightCommitment: "confirmed",
|
|
14
|
+
commitment: "confirmed"
|
|
15
|
+
}));
|
|
16
|
+
//#endregion
|
|
17
|
+
export { i as createReadOnlySolanaProgram };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require(`../../../../_virtual/_rolldown/runtime.cjs`),require(`../../constants/protocol.constants.cjs`),require(`./solanaMint.utils.cjs`);const e=require(`../../API/API.cjs`),t=require(`../../data-structures/AccountActions/AccountActions.cjs`);let n=require(`@solana/web3.js`);require(`@solana/spl-token`);var r=async({chainId:r,tempSubAccount:i,intent:a})=>{let o=i.solanaPrivateKey??i.privateKey;if(!o)throw Error(`No signing key available for Solana sponsored transaction`);let s=await e.API.callRelayerSolanaSponsoredBuildAPI({...a,chainId:r});if(s.status!==`success`||!s.serializedTx||!s.ticketId)throw Error(s.error||`Solana sponsored transaction could not be built`);let c=n.VersionedTransaction.deserialize(Buffer.from(s.serializedTx,`base64`));t.AccountActions.signSolanaTransactionFromPrivateKey(r,o,c);let l=await e.API.callRelayerSolanaSponsoredSubmitAPI({chainId:r,ticketId:s.ticketId,serializedTx:Buffer.from(c.serialize()).toString(`base64`)});if(l.status!==`success`||!l.txHash)throw Error(l.error||`Solana sponsored transaction failed`);return{txHash:l.txHash,feeWei:BigInt(s.fee??`0`)}};exports.sendSolanaSponsoredTx=r;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Connection, PublicKey, TransactionInstruction } from '@solana/web3.js';
|
|
2
|
+
import { SolanaSponsoredBuildRequestBody } from '../../API/callRelayer';
|
|
3
|
+
import { SubAccount } from '../../types/proxy.types';
|
|
4
|
+
import { ERC20Token } from '../../types/token.types';
|
|
5
|
+
interface SolanaAtaEntry {
|
|
6
|
+
ata: PublicKey;
|
|
7
|
+
instruction?: TransactionInstruction;
|
|
8
|
+
}
|
|
9
|
+
interface SendSolanaSponsoredTxParams {
|
|
10
|
+
chainId: number;
|
|
11
|
+
tempSubAccount: SubAccount;
|
|
12
|
+
intent: Omit<SolanaSponsoredBuildRequestBody, 'chainId'>;
|
|
13
|
+
}
|
|
14
|
+
export declare const buildCreateSolanaAtaInstructionsIfMissing: (connection: Connection, payer: PublicKey, owners: PublicKey[], token: ERC20Token) => Promise<SolanaAtaEntry[] | undefined>;
|
|
15
|
+
export declare const buildSolanaRootBucketPrefund: (connection: Connection, relayerPubkey: PublicKey, rootBucketCurrent: PublicKey, rootInsertCount: number) => Promise<TransactionInstruction>;
|
|
16
|
+
export declare const buildCloseSolanaAtaInstruction: (token: ERC20Token, ata: PublicKey, owner: PublicKey, rentRecipient: PublicKey) => TransactionInstruction;
|
|
17
|
+
export declare const buildSolanaTokenTransferInstruction: (token: ERC20Token, fromAta: PublicKey, toAta: PublicKey, owner: PublicKey, amount: bigint) => TransactionInstruction;
|
|
18
|
+
export declare const sendSolanaSponsoredTx: ({ chainId, tempSubAccount, intent, }: SendSolanaSponsoredTxParams) => Promise<{
|
|
19
|
+
txHash: string;
|
|
20
|
+
feeWei: bigint;
|
|
21
|
+
}>;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import "../../constants/protocol.constants.mjs";
|
|
2
|
+
import "./solanaMint.utils.mjs";
|
|
3
|
+
import { API as e } from "../../API/API.mjs";
|
|
4
|
+
import { AccountActions as t } from "../../data-structures/AccountActions/AccountActions.mjs";
|
|
5
|
+
import { VersionedTransaction as n } from "@solana/web3.js";
|
|
6
|
+
import "@solana/spl-token";
|
|
7
|
+
//#region libs/shared/common/src/functions/utils/solana-sponsored.utils.ts
|
|
8
|
+
var r = async ({ chainId: r, tempSubAccount: i, intent: a }) => {
|
|
9
|
+
let o = i.solanaPrivateKey ?? i.privateKey;
|
|
10
|
+
if (!o) throw Error("No signing key available for Solana sponsored transaction");
|
|
11
|
+
let s = await e.callRelayerSolanaSponsoredBuildAPI({
|
|
12
|
+
...a,
|
|
13
|
+
chainId: r
|
|
14
|
+
});
|
|
15
|
+
if (s.status !== "success" || !s.serializedTx || !s.ticketId) throw Error(s.error || "Solana sponsored transaction could not be built");
|
|
16
|
+
let c = n.deserialize(Buffer.from(s.serializedTx, "base64"));
|
|
17
|
+
t.signSolanaTransactionFromPrivateKey(r, o, c);
|
|
18
|
+
let l = await e.callRelayerSolanaSponsoredSubmitAPI({
|
|
19
|
+
chainId: r,
|
|
20
|
+
ticketId: s.ticketId,
|
|
21
|
+
serializedTx: Buffer.from(c.serialize()).toString("base64")
|
|
22
|
+
});
|
|
23
|
+
if (l.status !== "success" || !l.txHash) throw Error(l.error || "Solana sponsored transaction failed");
|
|
24
|
+
return {
|
|
25
|
+
txHash: l.txHash,
|
|
26
|
+
feeWei: BigInt(s.fee ?? "0")
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
//#endregion
|
|
30
|
+
export { r as sendSolanaSponsoredTx };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../crypto/poseidon.cjs`);let t=require(`ethers`),n=require(`@solana/web3.js`);var r=e=>{let n=e.toBytes();return BigInt(t.ethers.hexlify(n))},
|
|
1
|
+
require(`../../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../crypto/poseidon.cjs`);let t=require(`ethers`),n=require(`@solana/web3.js`),r=require(`@solana/spl-token`);var i=e=>e?r.TOKEN_2022_PROGRAM_ID:r.TOKEN_PROGRAM_ID,a=(e,t)=>(0,r.getAssociatedTokenAddress)(new n.PublicKey(e.erc20TokenAddress),t,!0,i(e.is2022Program)),o=e=>{let n=e.toBytes();return BigInt(t.ethers.hexlify(n))},s=t=>{let r=typeof t==`string`?new n.PublicKey(t):t,i=o(r),a=i/2n**128n,s=i%2n**128n;return{mintAccountPart1:a,mintAccountPart2:s,compressedAddress:e.poseidonHash(a,s),mintPublicKey:r}},c=e=>{if(!e)return;let r=t.ethers.getBytes(e);if(r.length!==32)return;let i=new n.PublicKey(r),a=i.toBase58(),{compressedAddress:o}=s(i);return{mintBase58:a,compressedAddress:o}};exports.convertPublicKeyToBigint=o,exports.formatMintAddress=s,exports.getSolanaAtaAddress=a,exports.getSolanaTokenProgramId=i,exports.normalizeSolanaMintAddress=c;
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import { PublicKey } from '@solana/web3.js';
|
|
2
|
+
import { ERC20Token } from '../../types/token.types';
|
|
2
3
|
type FormattedMintAddress = {
|
|
3
4
|
mintAccountPart1: bigint;
|
|
4
5
|
mintAccountPart2: bigint;
|
|
5
6
|
compressedAddress: string;
|
|
6
7
|
mintPublicKey: PublicKey;
|
|
7
8
|
};
|
|
9
|
+
export declare const getSolanaTokenProgramId: (is2022Program?: boolean) => PublicKey;
|
|
10
|
+
export declare const getSolanaAtaAddress: (token: ERC20Token, owner: PublicKey) => Promise<PublicKey>;
|
|
8
11
|
export declare const convertPublicKeyToBigint: (key: PublicKey) => bigint;
|
|
9
12
|
export declare const formatMintAddress: (mint: PublicKey | string) => FormattedMintAddress;
|
|
13
|
+
export declare const normalizeSolanaMintAddress: (mintHex?: string) => {
|
|
14
|
+
mintBase58: string;
|
|
15
|
+
compressedAddress: string;
|
|
16
|
+
} | undefined;
|
|
10
17
|
export {};
|
|
@@ -1,18 +1,28 @@
|
|
|
1
1
|
import { poseidonHash as e } from "../../crypto/poseidon.mjs";
|
|
2
2
|
import { ethers as t } from "ethers";
|
|
3
3
|
import { PublicKey as n } from "@solana/web3.js";
|
|
4
|
+
import { TOKEN_2022_PROGRAM_ID as r, TOKEN_PROGRAM_ID as i, getAssociatedTokenAddress as a } from "@solana/spl-token";
|
|
4
5
|
//#region libs/shared/common/src/functions/utils/solanaMint.utils.ts
|
|
5
|
-
var r = (e) => {
|
|
6
|
+
var o = (e) => e ? r : i, s = (e, t) => a(new n(e.erc20TokenAddress), t, !0, o(e.is2022Program)), c = (e) => {
|
|
6
7
|
let n = e.toBytes();
|
|
7
8
|
return BigInt(t.hexlify(n));
|
|
8
|
-
},
|
|
9
|
-
let
|
|
9
|
+
}, l = (t) => {
|
|
10
|
+
let r = typeof t == "string" ? new n(t) : t, i = c(r), a = i / 2n ** 128n, o = i % 2n ** 128n;
|
|
10
11
|
return {
|
|
11
|
-
mintAccountPart1:
|
|
12
|
-
mintAccountPart2:
|
|
13
|
-
compressedAddress: e(
|
|
14
|
-
mintPublicKey:
|
|
12
|
+
mintAccountPart1: a,
|
|
13
|
+
mintAccountPart2: o,
|
|
14
|
+
compressedAddress: e(a, o),
|
|
15
|
+
mintPublicKey: r
|
|
16
|
+
};
|
|
17
|
+
}, u = (e) => {
|
|
18
|
+
if (!e) return;
|
|
19
|
+
let r = t.getBytes(e);
|
|
20
|
+
if (r.length !== 32) return;
|
|
21
|
+
let i = new n(r), a = i.toBase58(), { compressedAddress: o } = l(i);
|
|
22
|
+
return {
|
|
23
|
+
mintBase58: a,
|
|
24
|
+
compressedAddress: o
|
|
15
25
|
};
|
|
16
26
|
};
|
|
17
27
|
//#endregion
|
|
18
|
-
export {
|
|
28
|
+
export { c as convertPublicKeyToBigint, l as formatMintAddress, s as getSolanaAtaAddress, o as getSolanaTokenProgramId, u as normalizeSolanaMintAddress };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require(`../../constants/chains.constants.cjs`),require(`../pre-transaction/solana.cjs`),require(`@solana/web3.js`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../../data-structures/AccountActions/AccountActions.cjs`),
|
|
1
|
+
const e=require(`../../constants/chains.constants.cjs`),t=require(`./tron.utils.cjs`),n=require(`../../data-structures/AccountActions/AccountActions.cjs`),r=require(`./proxyAvatar.utils.cjs`);var i=e=>({index:Number(e),name:`Hinkal Bridge Temp Wallet`,createdAt:new Date().toISOString(),isHidden:!1,isFavorite:!1,isImported:!1,iconIndex:r.getRandomProxyAvatarIndex()}),a=(r,i)=>{if(e.isSolanaLike(r)){let e=n.AccountActions.getSolanaPrivateKeyFromEvmPrivateKey(i);return{address:n.AccountActions.getSolanaSignerFromPrivateKey(e).publicKey.toString(),privateKey:e}}let a=n.AccountActions.getSignerAddressFromPrivateKey(r,i);return{address:e.isTronLike(r)?t.evmHexToTronBase58Address(a):a,privateKey:i}},o=(e,t,n)=>a(t,e.userKeys.getSignerPrivateKeyFromNonce(n)),s=(e,t,n)=>({...i(e),privateKey:t,ethAddress:n}),c=(e,t,n)=>({...i(e),solanaPrivateKey:t,solanaAddress:n}),l=(t,n,{address:r,privateKey:i})=>e.isSolanaLike(n)?c(t,i,r):s(t,i,r),u=(e,t,n)=>l(n,t,o(e,t,n)),d=(e,t,n,r)=>{let i=e.userKeys.getSignerPrivateKeyFromNonce(r),o=a(t,i),s=a(n,i);return{sourceSubAccount:l(r,t,o),destinationSubAccount:l(r,n,s)}};exports.buildSolanaTempSubAccount=c,exports.buildTempSubAccount=s,exports.buildTempSubAccountForChain=u,exports.deriveBridgeTempWallets=d,exports.deriveTempWallet=o;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { IHinkal } from '../../data-structures/Hinkal/IHinkal';
|
|
2
2
|
import { SubAccount } from '../../types/proxy.types';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
ethAddress: string;
|
|
6
|
-
};
|
|
3
|
+
import { BridgeTempWallets, DerivedTempWallet } from '../../types/temp-wallet.types';
|
|
4
|
+
export declare const deriveTempWallet: (hinkal: IHinkal, chainId: number, nonce: bigint) => DerivedTempWallet;
|
|
7
5
|
export declare const buildTempSubAccount: (nonce: bigint, privateKey: string, ethAddress: string) => SubAccount;
|
|
6
|
+
export declare const buildSolanaTempSubAccount: (nonce: bigint, solanaPrivateKey: string, solanaAddress: string) => SubAccount;
|
|
7
|
+
export declare const buildTempSubAccountForChain: (hinkal: IHinkal, chainId: number, nonce: bigint) => SubAccount;
|
|
8
|
+
export declare const deriveBridgeTempWallets: (hinkal: IHinkal, sourceChainId: number, destinationChainId: number, nonce: bigint) => BridgeTempWallets;
|
|
@@ -1,22 +1,43 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { isSolanaLike as e, isTronLike as t } from "../../constants/chains.constants.mjs";
|
|
2
|
+
import { evmHexToTronBase58Address as n } from "./tron.utils.mjs";
|
|
3
|
+
import { AccountActions as r } from "../../data-structures/AccountActions/AccountActions.mjs";
|
|
4
|
+
import { getRandomProxyAvatarIndex as i } from "./proxyAvatar.utils.mjs";
|
|
3
5
|
//#region libs/shared/common/src/functions/utils/temp-wallet.utils.ts
|
|
4
|
-
var
|
|
5
|
-
let i = t.userKeys.getSignerPrivateKeyFromNonce(r);
|
|
6
|
-
return {
|
|
7
|
-
privateKey: i,
|
|
8
|
-
ethAddress: e.getSignerAddressFromPrivateKey(n, i)
|
|
9
|
-
};
|
|
10
|
-
}, r = (e, n, r) => ({
|
|
6
|
+
var a = (e) => ({
|
|
11
7
|
index: Number(e),
|
|
12
8
|
name: "Hinkal Bridge Temp Wallet",
|
|
13
9
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14
10
|
isHidden: !1,
|
|
15
11
|
isFavorite: !1,
|
|
16
|
-
privateKey: n,
|
|
17
|
-
ethAddress: r,
|
|
18
12
|
isImported: !1,
|
|
19
|
-
iconIndex:
|
|
20
|
-
})
|
|
13
|
+
iconIndex: i()
|
|
14
|
+
}), o = (i, a) => {
|
|
15
|
+
if (e(i)) {
|
|
16
|
+
let e = r.getSolanaPrivateKeyFromEvmPrivateKey(a);
|
|
17
|
+
return {
|
|
18
|
+
address: r.getSolanaSignerFromPrivateKey(e).publicKey.toString(),
|
|
19
|
+
privateKey: e
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
let o = r.getSignerAddressFromPrivateKey(i, a);
|
|
23
|
+
return {
|
|
24
|
+
address: t(i) ? n(o) : o,
|
|
25
|
+
privateKey: a
|
|
26
|
+
};
|
|
27
|
+
}, s = (e, t, n) => o(t, e.userKeys.getSignerPrivateKeyFromNonce(n)), c = (e, t, n) => ({
|
|
28
|
+
...a(e),
|
|
29
|
+
privateKey: t,
|
|
30
|
+
ethAddress: n
|
|
31
|
+
}), l = (e, t, n) => ({
|
|
32
|
+
...a(e),
|
|
33
|
+
solanaPrivateKey: t,
|
|
34
|
+
solanaAddress: n
|
|
35
|
+
}), u = (t, n, { address: r, privateKey: i }) => e(n) ? l(t, i, r) : c(t, i, r), d = (e, t, n) => u(n, t, s(e, t, n)), f = (e, t, n, r) => {
|
|
36
|
+
let i = e.userKeys.getSignerPrivateKeyFromNonce(r), a = o(t, i), s = o(n, i);
|
|
37
|
+
return {
|
|
38
|
+
sourceSubAccount: u(r, t, a),
|
|
39
|
+
destinationSubAccount: u(r, n, s)
|
|
40
|
+
};
|
|
41
|
+
};
|
|
21
42
|
//#endregion
|
|
22
|
-
export {
|
|
43
|
+
export { l as buildSolanaTempSubAccount, c as buildTempSubAccount, d as buildTempSubAccountForChain, f as deriveBridgeTempWallets, s as deriveTempWallet };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`./
|
|
1
|
+
require(`./token-check.utils.cjs`),require(`../../error-handling/index.cjs`),require(`../../constants/index.cjs`),require(`../../data-structures/crypto-keys/index.cjs`),require(`./getRecipientInfoFromUserKeys.cjs`),require(`./enclave-utxo-storage.cjs`),require(`./tx-confirmation.utils.cjs`);
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { ErrorWithIndex } from '../../error-handling';
|
|
2
2
|
import { PrivateSendAllocation } from '../../API';
|
|
3
|
-
import { AdminTransactionType, ERC20Token, FeeStructure,
|
|
3
|
+
import { AdminTransactionType, ERC20Token, FeeStructure, RecipientRequest } from '../../types';
|
|
4
4
|
import { IHinkal } from '../../data-structures/Hinkal/IHinkal';
|
|
5
5
|
export declare const transferClaimableUtxos: (hinkal: IHinkal, token: ERC20Token, recipients: RecipientRequest[], allocations: PrivateSendAllocation[], baseNonce: bigint, feeToken?: string, feeStructure?: FeeStructure, action?: AdminTransactionType) => Promise<{
|
|
6
|
-
pendingEnclaveUtxos: PendingEnclaveUtxo[];
|
|
7
6
|
txHashes: string[];
|
|
8
7
|
failedRecipientErrorMessage: ErrorWithIndex | undefined;
|
|
9
8
|
}>;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import "./solanaMint.utils.mjs";
|
|
2
1
|
import "./token-check.utils.mjs";
|
|
3
2
|
import "../../error-handling/index.mjs";
|
|
4
|
-
import "../pre-transaction/index.mjs";
|
|
5
3
|
import "../../constants/index.mjs";
|
|
6
|
-
import "./tx-confirmation.utils.mjs";
|
|
7
|
-
import "./getUtxosFromReceipt.utils.mjs";
|
|
8
4
|
import "../../data-structures/crypto-keys/index.mjs";
|
|
9
5
|
import "./getRecipientInfoFromUserKeys.mjs";
|
|
10
|
-
import "./
|
|
6
|
+
import "./enclave-utxo-storage.mjs";
|
|
7
|
+
import "./tx-confirmation.utils.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../constants/chains.constants.cjs`),t=require(`../../constants/protocol.constants.cjs`),n=require(`../snarkjs/constant.cjs`),r=require(`../../data-structures/http/HttpClient.cjs`);let i=require(`ethers`),a=require(`tronweb`);var o=2000n,s=e=>{let t=e.trim(),n=t.startsWith(`0x`)?t.slice(2):t;if(!/^[0-9a-fA-F]{64}$/.test(n))throw Error(`Tron private key must be 32 bytes (64 hex characters), with or without 0x prefix`);return n},c=(t,n)=>{let
|
|
1
|
+
require(`../../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../constants/chains.constants.cjs`),t=require(`../../constants/protocol.constants.cjs`),n=require(`../snarkjs/constant.cjs`),r=require(`../../data-structures/http/HttpClient.cjs`);let i=require(`ethers`),a=require(`tronweb`);var o=2000n,s=e=>{let t=e.trim(),n=t.startsWith(`0x`)?t.slice(2):t;if(!/^[0-9a-fA-F]{64}$/.test(n))throw Error(`Tron private key must be 32 bytes (64 hex characters), with or without 0x prefix`);return n},c=(t,n)=>{let{rpcUrl:r}=e.networkRegistry[t],i=n?s(n):void 0,o=i?new a.TronWeb({fullHost:r,privateKey:i}):new a.TronWeb({fullHost:r});return n||o.setAddress(`T9yD14Nj9j7xAB4dbGeiX9h8unkKHxuWwb`),o},l=e=>e?.startsWith(`T`)?e:a.TronWeb.address.fromHex(e),u=e=>e.startsWith(`0x`)?l(e):e,d=e=>{if(e.startsWith(`0x`))return e;if(e.startsWith(`41`))return e.replace(`41`,`0x`);if(e.startsWith(`T`))return d(a.TronWeb.address.toHex(e));throw Error(`Failed to convert address to hex format`)},f=t=>{if(t===e.chainIds.tronNile)return`https://nile.trongrid.io`;if(t===e.chainIds.tronMainnet)return`https://api.trongrid.io`;throw Error(`Unsupported Tron chain for wallet RPC: ${t}`)},p=(e,t)=>e.map(e=>Array.isArray(e)?p(e,t):t(e)),m=(e,t,n)=>{let r=new i.ethers.Interface(e);if(!r.getFunction(t))throw Error(`${t} ABI is missing for Tron call data creation`);let a=p(n,e=>typeof e==`string`&&e.startsWith(`T`)?d(e):e);return r.encodeFunctionData(t,a)},h=(e,t,n)=>e?BigInt(Math.max((e[t]??0)-(e[n]??0),0)):0n,g=(e,t)=>{let n=e.find(e=>e.key===t);if(!n||typeof n.value!=`number`)throw Error(`Missing Tron chain parameter: ${t}`);return BigInt(n.value)},_=async e=>{let t=`${f(e)}/wallet/getchainparameters`,n=await r.httpClient.post(t,{});if(!n?.chainParameter?.length)throw Error(`Failed to fetch Tron chain parameters from wallet RPC`);return n.chainParameter},v=async(e,t)=>{let n=`${f(e)}/wallet/getaccountresource`,i=d(t),a=i.startsWith(`0x`)?`41${i.slice(2)}`:i;return await r.httpClient.post(n,{address:a,visible:!1})},y=async(e,n,r,i,a,s)=>{let c={input:a,callValue:Number(s),feeLimit:t.TRON_DEFAULT_FEE_LIMIT_SUN},[l,u]=await Promise.all([e.transactionBuilder.estimateEnergy(r,``,c,[],i),e.transactionBuilder.triggerConstantContract(r,``,c,[],i)]),d=await _(n),f=g(d,`getEnergyFee`),p=g(d,`getTransactionFee`),m=await v(n,i),y=BigInt(l?.energy_required??u?.energy_used??0),b=h(m,`EnergyLimit`,`EnergyUsed`),x=(y>b?y-b:0n)*f,S=BigInt(Math.ceil((u?.transaction?.raw_data_hex?.length??0)/2)),C=h(m,`freeNetLimit`,`freeNetUsed`)+h(m,`NetLimit`,`NetUsed`),w=x+(S>C?S-C:0n)*p,T=w+w*o/10000n;return T>BigInt(1e9)?BigInt(t.TRON_DEFAULT_FEE_LIMIT_SUN):T},b=e=>{let t=e[0].map(BigInt),n=e[1][0].map(BigInt),r=e[1][1].map(BigInt),i=e[2].map(BigInt),a=e[3].map(BigInt);return{a:t,b:[[n[1],n[0]],[r[1],r[0]]],c:i,publicSignals:a}},x=(e,t)=>{let n=i.ethers.AbiCoder.defaultAbiCoder().encode([`uint16`,`uint16`,`uint16`,`uint256`],[e.tokenNumber,e.nullifierAmount,e.outputAmount,t]);return BigInt(i.ethers.keccak256(n))},S=async(e,t,a,o,s,c,l,u=!1)=>{let d=x(s,c),f=e.map(String),p=a.map(String),m=o.map(String),h={chainId:l,a:f,b:[t[0].map(String),t[1].map(String)],c:p,inputs:m,verifier_id:String(d),tokenNumber:s.tokenNumber,nullifierAmount:s.nullifierAmount,outputAmount:s.outputAmount,skipLock:u},g=await r.httpClient.post(`${n.ENCLAVE_URL}/sign-proof`,h),{v:_,r:v,s:y}=i.ethers.Signature.from(g.signature.trim());return{v:_,r:v,s:y}},C=e=>{if(e.newRootHash===void 0)throw Error(`circomData.newRootHash is required for Tron transactions`);if(e.insertedLeafIndex===void 0)throw Error(`circomData.insertedLeafIndex is required for Tron transactions`);return[e.rootHashHinkal,e.rootHashHinkalIndex,e.erc20TokenAddresses,e.amountChanges,e.newRootHash,e.inputNullifiers,e.outCommitments,e.encryptedOutputs,e.slippageValues,[e.feeStructure.feeToken,e.feeStructure.flatFee,e.feeStructure.variableRate],e.timeStamp,e.calldataHash,e.emporiumMessage,e.publicSignalCount,e.relay,[e.externalActionData.externalAddress,e.externalActionData.externalActionId,e.externalActionData.externalActionMetadata],[e.hookData.preHookContract,e.hookData.postHookContract,e.hookData.preHookMetadata,e.hookData.postHookMetadata],e.originalSender,e.extraData,e.insertedLeafIndex,e.createBlockedUtxos??!1]},w=e=>{e[1]=[[e[1][0][1],e[1][0][0]],[e[1][1][1],e[1][1][0]]]},T=async(e,t,n,r,i,a=!0,o=!1)=>{if(e){let{a:e,b:s,c,publicSignals:l}=b(t),u=await S(e,s,c,l,n,BigInt(r.externalActionData.externalActionId),i,o),d={v:u.v,r:u.r,s:u.s};return a&&w(t),d}};exports.addressToHexFormat=d,exports.circomDataToArray=C,exports.createTronCallData=m,exports.createTronWeb=c,exports.estimateTronFeeSunWithPadding=y,exports.evmHexToTronBase58Address=l,exports.fetchTronAccountResources=v,exports.fetchTronChainParameters=_,exports.generateProofSignatureRemotely=S,exports.getAvailableResource=h,exports.getChainParameterValue=g,exports.getTronWalletRpcUrl=f,exports.getVerifierId=x,exports.normalizeTronPrivateKey=s,exports.parseZkCalldata=b,exports.reorderZkCallData=T,exports.swapTronBCoordinate=w,exports.toTronBase58IfHex=u;
|
|
@@ -25,11 +25,11 @@ export declare const parseZkCalldata: (zkCallData: NewZkCallDataType) => {
|
|
|
25
25
|
publicSignals: bigint[];
|
|
26
26
|
};
|
|
27
27
|
export declare const getVerifierId: (dimensionsArg: DimDataType, externalActionId: bigint) => bigint;
|
|
28
|
-
export declare const generateProofSignatureRemotely: (a: bigint[], b: bigint[][], c: bigint[], input: bigint[], dimensionsArg: DimDataType, externalActionId: bigint, chainId: number) => Promise<{
|
|
28
|
+
export declare const generateProofSignatureRemotely: (a: bigint[], b: bigint[][], c: bigint[], input: bigint[], dimensionsArg: DimDataType, externalActionId: bigint, chainId: number, skipLock?: boolean) => Promise<{
|
|
29
29
|
v: number;
|
|
30
30
|
r: string;
|
|
31
31
|
s: string;
|
|
32
32
|
}>;
|
|
33
33
|
export declare const circomDataToArray: (circomData: CircomDataType) => (string | number | bigint | boolean | string[][] | (string | bigint)[] | undefined)[];
|
|
34
34
|
export declare const swapTronBCoordinate: (zkCallData: NewZkCallDataType) => void;
|
|
35
|
-
export declare const reorderZkCallData: (isTron: boolean, zkCallData: NewZkCallDataType, dimData: DimDataType, circomData: CircomDataType, chainId: number, modifyZkCallData?: boolean) => Promise<TronProofSignature | undefined>;
|
|
35
|
+
export declare const reorderZkCallData: (isTron: boolean, zkCallData: NewZkCallDataType, dimData: DimDataType, circomData: CircomDataType, chainId: number, modifyZkCallData?: boolean, skipLock?: boolean) => Promise<TronProofSignature | undefined>;
|
|
@@ -10,7 +10,7 @@ var s = 2000n, c = (e) => {
|
|
|
10
10
|
if (!/^[0-9a-fA-F]{64}$/.test(n)) throw Error("Tron private key must be 32 bytes (64 hex characters), with or without 0x prefix");
|
|
11
11
|
return n;
|
|
12
12
|
}, l = (e, n) => {
|
|
13
|
-
let r = t[e]
|
|
13
|
+
let { rpcUrl: r } = t[e], i = n ? c(n) : void 0, a = i ? new o({
|
|
14
14
|
fullHost: r,
|
|
15
15
|
privateKey: i
|
|
16
16
|
}) : new o({ fullHost: r });
|
|
@@ -71,22 +71,23 @@ var s = 2000n, c = (e) => {
|
|
|
71
71
|
t
|
|
72
72
|
]);
|
|
73
73
|
return BigInt(a.keccak256(n));
|
|
74
|
-
}, C = async (e, t, n, o, s, c, l) => {
|
|
75
|
-
let
|
|
74
|
+
}, C = async (e, t, n, o, s, c, l, u = !1) => {
|
|
75
|
+
let d = S(s, c), f = e.map(String), p = n.map(String), m = o.map(String), h = {
|
|
76
76
|
chainId: l,
|
|
77
|
-
a:
|
|
77
|
+
a: f,
|
|
78
78
|
b: [t[0].map(String), t[1].map(String)],
|
|
79
|
-
c:
|
|
80
|
-
inputs:
|
|
81
|
-
verifier_id: String(
|
|
79
|
+
c: p,
|
|
80
|
+
inputs: m,
|
|
81
|
+
verifier_id: String(d),
|
|
82
82
|
tokenNumber: s.tokenNumber,
|
|
83
83
|
nullifierAmount: s.nullifierAmount,
|
|
84
|
-
outputAmount: s.outputAmount
|
|
85
|
-
|
|
84
|
+
outputAmount: s.outputAmount,
|
|
85
|
+
skipLock: u
|
|
86
|
+
}, g = await i.post(`${r}/sign-proof`, h), { v: _, r: v, s: y } = a.Signature.from(g.signature.trim());
|
|
86
87
|
return {
|
|
87
|
-
v:
|
|
88
|
-
r:
|
|
89
|
-
s:
|
|
88
|
+
v: _,
|
|
89
|
+
r: v,
|
|
90
|
+
s: y
|
|
90
91
|
};
|
|
91
92
|
}, w = (e) => {
|
|
92
93
|
if (e.newRootHash === void 0) throw Error("circomData.newRootHash is required for Tron transactions");
|
|
@@ -129,14 +130,14 @@ var s = 2000n, c = (e) => {
|
|
|
129
130
|
];
|
|
130
131
|
}, T = (e) => {
|
|
131
132
|
e[1] = [[e[1][0][1], e[1][0][0]], [e[1][1][1], e[1][1][0]]];
|
|
132
|
-
}, E = async (e, t, n, r, i, a = !0) => {
|
|
133
|
+
}, E = async (e, t, n, r, i, a = !0, o = !1) => {
|
|
133
134
|
if (e) {
|
|
134
|
-
let { a: e, b:
|
|
135
|
-
v:
|
|
136
|
-
r:
|
|
137
|
-
s:
|
|
135
|
+
let { a: e, b: s, c, publicSignals: l } = x(t), u = await C(e, s, c, l, n, BigInt(r.externalActionData.externalActionId), i, o), d = {
|
|
136
|
+
v: u.v,
|
|
137
|
+
r: u.r,
|
|
138
|
+
s: u.s
|
|
138
139
|
};
|
|
139
|
-
return a && T(t),
|
|
140
|
+
return a && T(t), d;
|
|
140
141
|
}
|
|
141
142
|
};
|
|
142
143
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../../constants/chains.constants.cjs`),t=require(`../../data-structures/http/HttpClient.cjs`),n=require(`./tron.utils.cjs`);var r=async(r,i,a,o,s,c,l)=>{let u=n.addressToHexFormat(i),d=n.addressToHexFormat(c),f=e.networkRegistry[r].
|
|
1
|
+
const e=require(`../../constants/chains.constants.cjs`),t=require(`../../data-structures/http/HttpClient.cjs`),n=require(`./tron.utils.cjs`);var r=async(r,i,a,o,s,c,l)=>{let u=n.addressToHexFormat(i),d=n.addressToHexFormat(c),{rpcUrl:f}=e.networkRegistry[r],p=f.includes(`.g.alchemy.com/`)?f:`${f}/jsonrpc`,m=n.createTronCallData(o,a,s),h=await t.httpClient.post(p,{jsonrpc:`2.0`,id:1,method:`eth_call`,params:[{from:d,to:u,data:m,value:l?`0x${(l??0n).toString(16)}`:void 0},`latest`]});if(h.error){let e=h.error.message||`Unknown revert`;throw Error(`Tron Transaction Simulation reverted: ${e}`)}};exports.simulateTronTransaction=r;
|