@sabaaa1/common 0.1.6 → 0.1.14
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 +16 -12
- package/API/API.mjs +73 -69
- package/API/accessCodeCalls.cjs +1 -0
- package/API/accessCodeCalls.d.ts +23 -0
- package/API/accessCodeCalls.mjs +23 -0
- package/API/admin-calls.cjs +1 -1
- package/API/admin-calls.mjs +5 -7
- package/API/ai-calls.cjs +1 -1
- package/API/ai-calls.mjs +11 -10
- package/API/brotherhoodCalls.cjs +1 -1
- package/API/brotherhoodCalls.mjs +43 -69
- package/API/callLifiAPI.cjs +1 -1
- package/API/callLifiAPI.mjs +8 -7
- package/API/callOdosAPI.cjs +1 -1
- package/API/callOdosAPI.mjs +16 -16
- package/API/callOkxAPI.cjs +1 -0
- package/API/callOkxAPI.d.ts +10 -0
- package/API/callOkxAPI.mjs +13 -0
- package/API/callOneInchAPI.cjs +1 -1
- package/API/callOneInchAPI.mjs +8 -7
- package/API/callRelayer.cjs +1 -1
- package/API/callRelayer.d.ts +11 -0
- package/API/callRelayer.mjs +15 -7
- package/API/checkRisk.cjs +1 -1
- package/API/checkRisk.mjs +5 -4
- package/API/duneAPI.cjs +1 -1
- package/API/duneAPI.mjs +2 -3
- package/API/enclaveCalls.cjs +1 -1
- package/API/enclaveCalls.mjs +9 -11
- package/API/fetchCommitmentsCache.cjs +1 -1
- package/API/fetchCommitmentsCache.d.ts +2 -2
- package/API/fetchCommitmentsCache.mjs +13 -10
- package/API/generate-trading-points.cjs +1 -1
- package/API/generate-trading-points.mjs +34 -39
- package/API/get-token-data.cjs +1 -1
- package/API/get-token-data.mjs +5 -4
- package/API/getBridgeProtocols.cjs +1 -1
- package/API/getBridgeProtocols.mjs +4 -3
- package/API/getGasEstimates.cjs +1 -1
- package/API/getGasEstimates.d.ts +2 -1
- package/API/getGasEstimates.mjs +14 -16
- package/API/getLifiStatus.cjs +1 -1
- package/API/getLifiStatus.mjs +11 -10
- package/API/getRelayerURL.cjs +1 -1
- package/API/getRelayerURL.mjs +4 -4
- package/API/getServerURL.cjs +1 -1
- package/API/getServerURL.mjs +42 -36
- package/API/getTokenPrice.cjs +1 -1
- package/API/getTokenPrice.d.ts +0 -11
- package/API/getTokenPrice.mjs +8 -23
- package/API/getWebsiteURL.cjs +1 -1
- package/API/getWebsiteURL.d.ts +1 -1
- package/API/getWebsiteURL.mjs +6 -7
- package/API/index.d.ts +2 -1
- package/API/is-tx-stateless.cjs +1 -1
- package/API/is-tx-stateless.mjs +17 -22
- package/API/kycCalls.cjs +1 -1
- package/API/kycCalls.d.ts +2 -2
- package/API/kycCalls.mjs +31 -30
- package/API/leaderboardCalls.cjs +1 -1
- package/API/leaderboardCalls.mjs +11 -16
- package/API/proxyAccountsCalls.cjs +1 -1
- package/API/proxyAccountsCalls.mjs +19 -18
- package/API/referralsCalls.cjs +1 -1
- package/API/referralsCalls.mjs +16 -24
- package/API/relayCalls.cjs +1 -1
- package/API/relayCalls.mjs +6 -8
- package/API/resolve-sns.cjs +1 -0
- package/API/resolve-sns.d.ts +1 -0
- package/API/resolve-sns.mjs +12 -0
- package/API/restoreSnapshots.cjs +1 -1
- package/API/restoreSnapshots.mjs +5 -5
- package/API/rewardsUserCalls.cjs +1 -1
- package/API/rewardsUserCalls.mjs +37 -54
- package/API/seedless-calls.cjs +1 -0
- package/API/seedless-calls.d.ts +53 -0
- package/API/seedless-calls.mjs +12 -0
- package/API/send-telegram-callback.cjs +1 -1
- package/API/send-telegram-callback.mjs +9 -11
- package/API/simulate-batch-tx.cjs +1 -1
- package/API/simulate-batch-tx.mjs +11 -13
- package/API/solana-calls.cjs +1 -0
- package/API/solana-calls.d.ts +34 -0
- package/API/solana-calls.mjs +19 -0
- package/API/tenderly.api.cjs +1 -1
- package/API/tenderly.api.mjs +48 -59
- package/API/token-calls.cjs +1 -1
- package/API/token-calls.mjs +11 -13
- package/API/weeklyAnalyticCalls.cjs +1 -1
- package/API/weeklyAnalyticCalls.mjs +9 -14
- package/README.md +164 -0
- package/_virtual/_commonjsHelpers.cjs +1 -0
- package/_virtual/_commonjsHelpers.mjs +30 -0
- package/_virtual/bn.cjs +1 -0
- package/_virtual/bn.mjs +4 -0
- package/_virtual/bn2.cjs +1 -0
- package/_virtual/bn2.mjs +4 -0
- package/_virtual/common.cjs +1 -0
- package/_virtual/common.mjs +4 -0
- package/_virtual/common2.cjs +1 -0
- package/_virtual/common2.mjs +4 -0
- package/_virtual/hash.cjs +1 -0
- package/_virtual/hash.mjs +4 -0
- package/_virtual/index.cjs +1 -0
- package/_virtual/index.mjs +6 -0
- package/_virtual/index10.cjs +1 -0
- package/_virtual/index10.mjs +6 -0
- package/_virtual/index11.cjs +1 -0
- package/_virtual/index11.mjs +6 -0
- package/_virtual/index12.cjs +1 -0
- package/_virtual/index12.mjs +6 -0
- package/_virtual/index13.cjs +1 -0
- package/_virtual/index13.mjs +6 -0
- package/_virtual/index14.cjs +1 -0
- package/_virtual/index14.mjs +6 -0
- package/_virtual/index15.cjs +1 -0
- package/_virtual/index15.mjs +6 -0
- package/_virtual/index16.cjs +1 -0
- package/_virtual/index16.mjs +6 -0
- package/_virtual/index17.cjs +1 -0
- package/_virtual/index17.mjs +6 -0
- package/_virtual/index18.cjs +1 -0
- package/_virtual/index18.mjs +6 -0
- package/_virtual/index19.cjs +1 -0
- package/_virtual/index19.mjs +6 -0
- package/_virtual/index2.cjs +1 -0
- package/_virtual/index2.mjs +6 -0
- package/_virtual/index20.cjs +1 -0
- package/_virtual/index20.mjs +6 -0
- package/_virtual/index21.cjs +1 -0
- package/_virtual/index21.mjs +6 -0
- package/_virtual/index22.cjs +1 -0
- package/_virtual/index22.mjs +4 -0
- package/_virtual/index3.cjs +1 -0
- package/_virtual/index3.mjs +6 -0
- package/_virtual/index4.cjs +1 -0
- package/_virtual/index4.mjs +6 -0
- package/_virtual/index5.cjs +1 -0
- package/_virtual/index5.mjs +6 -0
- package/_virtual/index6.cjs +1 -0
- package/_virtual/index6.mjs +6 -0
- package/_virtual/index7.cjs +1 -0
- package/_virtual/index7.mjs +6 -0
- package/_virtual/index8.cjs +1 -0
- package/_virtual/index8.mjs +6 -0
- package/_virtual/index9.cjs +1 -0
- package/_virtual/index9.mjs +6 -0
- package/_virtual/inherits_browser.cjs +1 -0
- package/_virtual/inherits_browser.mjs +4 -0
- package/_virtual/ripemd.cjs +1 -0
- package/_virtual/ripemd.mjs +4 -0
- package/_virtual/scrypt.cjs +1 -0
- package/_virtual/scrypt.mjs +4 -0
- package/_virtual/sha.cjs +1 -0
- package/_virtual/sha.mjs +4 -0
- package/_virtual/sha3.cjs +1 -0
- package/_virtual/sha3.mjs +4 -0
- package/_virtual/utils.cjs +1 -0
- package/_virtual/utils.mjs +4 -0
- package/_virtual/utils2.cjs +1 -0
- package/_virtual/utils2.mjs +4 -0
- package/constants/backend.constants.cjs +1 -1
- package/constants/backend.constants.d.ts +2 -1
- package/constants/backend.constants.mjs +5 -7
- package/constants/chains.constants.cjs +1 -1
- package/constants/chains.constants.d.ts +5 -0
- package/constants/chains.constants.mjs +63 -35
- package/constants/coingecko.constants.cjs +1 -1
- package/constants/coingecko.constants.d.ts +1 -1
- package/constants/coingecko.constants.mjs +18 -11
- package/constants/contracts.constants.cjs +1 -1
- package/constants/contracts.constants.mjs +19 -15
- package/constants/deploy-data/deploy-data-arbMainnet.json.cjs +1 -1
- package/constants/deploy-data/deploy-data-arbMainnet.json.mjs +1218 -8
- package/constants/deploy-data/deploy-data-arcTestnet.json.cjs +1 -1
- package/constants/deploy-data/deploy-data-arcTestnet.json.mjs +1214 -4
- package/constants/deploy-data/deploy-data-base.json.cjs +1 -1
- package/constants/deploy-data/deploy-data-base.json.mjs +1218 -8
- package/constants/deploy-data/deploy-data-ethMainnet.json.cjs +1 -1
- package/constants/deploy-data/deploy-data-ethMainnet.json.mjs +1213 -3
- package/constants/deploy-data/deploy-data-optimism.json.cjs +1 -1
- package/constants/deploy-data/deploy-data-optimism.json.mjs +1218 -8
- package/constants/deploy-data/deploy-data-polygon.json.cjs +1 -1
- package/constants/deploy-data/deploy-data-polygon.json.mjs +1218 -8
- package/constants/deploy-data/deploy-data-solana.json.cjs +1 -0
- package/constants/deploy-data/deploy-data-solana.json.mjs +6111 -0
- package/constants/deploy-data/index.d.ts +2 -1
- package/constants/index.d.ts +1 -1
- package/constants/mediaUrls.constants.cjs +1 -1
- package/constants/mediaUrls.constants.d.ts +9 -0
- package/constants/mediaUrls.constants.mjs +13 -4
- package/constants/okx.constants.cjs +1 -0
- package/constants/okx.constants.d.ts +2 -0
- package/constants/okx.constants.mjs +5 -0
- package/constants/protocol.constants.cjs +1 -1
- package/constants/protocol.constants.d.ts +12 -1
- package/constants/protocol.constants.mjs +37 -29
- package/constants/save-depths.cjs +1 -1
- package/constants/save-depths.mjs +4 -1
- package/constants/server.constants.cjs +1 -1
- package/constants/server.constants.d.ts +23 -10
- package/constants/server.constants.mjs +102 -89
- package/constants/token-data/ERC20Registry.cjs +1 -1
- package/constants/token-data/ERC20Registry.mjs +49 -35
- package/constants/token-data/index.cjs +1 -1
- package/constants/token-data/index.d.ts +17 -1
- package/constants/token-data/index.mjs +29 -25
- package/constants/token-data/solanaLocalnetRegistry.json.cjs +1 -0
- package/constants/token-data/solanaLocalnetRegistry.json.mjs +24 -0
- package/constants/token-data/solanaMainnetRegistry.json.cjs +1 -0
- package/constants/token-data/solanaMainnetRegistry.json.mjs +560 -0
- package/data-structures/ApprovalDBs/EventsPublicApprovalsDB.cjs +1 -1
- package/data-structures/ApprovalDBs/EventsPublicApprovalsDB.mjs +41 -41
- package/data-structures/Hinkal/Hinkal.cjs +1 -1
- package/data-structures/Hinkal/Hinkal.d.ts +19 -10
- package/data-structures/Hinkal/Hinkal.mjs +290 -125
- package/data-structures/Hinkal/IHinkal.d.ts +18 -11
- package/data-structures/Hinkal/handleAutoDepositBack.cjs +1 -1
- package/data-structures/Hinkal/handleAutoDepositBack.mjs +36 -32
- package/data-structures/Hinkal/hinkalActionFundApproveAndTransact.cjs +1 -1
- package/data-structures/Hinkal/hinkalActionFundApproveAndTransact.mjs +24 -23
- package/data-structures/Hinkal/hinkalActionReceive.cjs +1 -1
- package/data-structures/Hinkal/hinkalActionReceive.mjs +13 -12
- package/data-structures/Hinkal/hinkalCheckSolanaTokenRegistry.cjs +1 -0
- package/data-structures/Hinkal/hinkalCheckSolanaTokenRegistry.d.ts +3 -0
- package/data-structures/Hinkal/hinkalCheckSolanaTokenRegistry.mjs +28 -0
- package/data-structures/Hinkal/hinkalCheckTokenRegistry.cjs +1 -1
- package/data-structures/Hinkal/hinkalCheckTokenRegistry.mjs +11 -8
- package/data-structures/Hinkal/hinkalDepositAndWithdraw.cjs +1 -0
- package/data-structures/Hinkal/hinkalDepositAndWithdraw.d.ts +4 -0
- package/data-structures/Hinkal/hinkalDepositAndWithdraw.mjs +167 -0
- package/data-structures/Hinkal/hinkalGetRecipientInfo.cjs +1 -1
- package/data-structures/Hinkal/hinkalGetRecipientInfo.d.ts +1 -1
- package/data-structures/Hinkal/hinkalGetRecipientInfo.mjs +4 -4
- package/data-structures/Hinkal/hinkalMultiSend.cjs +1 -1
- package/data-structures/Hinkal/hinkalMultiSend.mjs +6 -6
- package/data-structures/Hinkal/hinkalPrivateWallet.cjs +1 -1
- package/data-structures/Hinkal/hinkalPrivateWallet.d.ts +2 -2
- package/data-structures/Hinkal/hinkalPrivateWallet.mjs +109 -93
- package/data-structures/Hinkal/hinkalProxySwap.cjs +1 -1
- package/data-structures/Hinkal/hinkalProxySwap.mjs +23 -22
- package/data-structures/Hinkal/hinkalProxyToPrivate.cjs +1 -0
- package/data-structures/Hinkal/hinkalProxyToPrivate.d.ts +6 -0
- package/data-structures/Hinkal/hinkalProxyToPrivate.mjs +45 -0
- package/data-structures/Hinkal/hinkalSignSubAccount.cjs +1 -1
- package/data-structures/Hinkal/hinkalSignSubAccount.mjs +11 -9
- package/data-structures/Hinkal/hinkalSolanaDeposit.cjs +1 -0
- package/data-structures/Hinkal/hinkalSolanaDeposit.d.ts +4 -0
- package/data-structures/Hinkal/hinkalSolanaDeposit.mjs +133 -0
- package/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.cjs +1 -0
- package/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.d.ts +3 -0
- package/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.mjs +216 -0
- package/data-structures/Hinkal/hinkalSolanaProxySend.cjs +1 -0
- package/data-structures/Hinkal/hinkalSolanaProxySend.d.ts +6 -0
- package/data-structures/Hinkal/hinkalSolanaProxySend.mjs +55 -0
- package/data-structures/Hinkal/hinkalSolanaProxyShield.cjs +1 -0
- package/data-structures/Hinkal/hinkalSolanaProxyShield.d.ts +6 -0
- package/data-structures/Hinkal/hinkalSolanaProxyShield.mjs +99 -0
- package/data-structures/Hinkal/hinkalSolanaProxySwap.cjs +1 -0
- package/data-structures/Hinkal/hinkalSolanaProxySwap.d.ts +5 -0
- package/data-structures/Hinkal/hinkalSolanaProxySwap.mjs +96 -0
- package/data-structures/Hinkal/hinkalSolanaSwap.cjs +1 -0
- package/data-structures/Hinkal/hinkalSolanaSwap.d.ts +4 -0
- package/data-structures/Hinkal/hinkalSolanaSwap.mjs +120 -0
- package/data-structures/Hinkal/hinkalSolanaTransfer.cjs +1 -0
- package/data-structures/Hinkal/hinkalSolanaTransfer.d.ts +3 -0
- package/data-structures/Hinkal/hinkalSolanaTransfer.mjs +90 -0
- package/data-structures/Hinkal/hinkalSolanaWithdraw.cjs +1 -0
- package/data-structures/Hinkal/hinkalSolanaWithdraw.d.ts +3 -0
- package/data-structures/Hinkal/hinkalSolanaWithdraw.mjs +106 -0
- package/data-structures/Hinkal/hinkalSwap.cjs +1 -1
- package/data-structures/Hinkal/hinkalSwap.mjs +33 -27
- package/data-structures/Hinkal/hinkalTransfer.cjs +1 -1
- package/data-structures/Hinkal/hinkalTransfer.mjs +20 -14
- package/data-structures/Hinkal/hinkalWithdraw.cjs +1 -1
- package/data-structures/Hinkal/hinkalWithdraw.mjs +15 -9
- package/data-structures/Hinkal/index.d.ts +4 -0
- package/data-structures/Hinkal/resetMerkleTrees.cjs +1 -1
- package/data-structures/Hinkal/resetMerkleTrees.mjs +56 -23
- package/data-structures/IndexedDB/activity-db.cjs +1 -1
- package/data-structures/IndexedDB/activity-db.d.ts +0 -1
- package/data-structures/IndexedDB/activity-db.mjs +86 -86
- package/data-structures/IndexedDB/balances-db.cjs +1 -1
- package/data-structures/IndexedDB/balances-db.mjs +15 -12
- package/data-structures/IndexedDB/contact-db.cjs +1 -1
- package/data-structures/IndexedDB/contact-db.mjs +29 -26
- package/data-structures/IndexedDB/signatures-db.cjs +1 -1
- package/data-structures/IndexedDB/signatures-db.mjs +14 -10
- package/data-structures/MultiThreadedUtxoUtils/MultiThreadedUtxoUtils.cjs +1 -1
- package/data-structures/MultiThreadedUtxoUtils/MultiThreadedUtxoUtils.d.ts +2 -2
- package/data-structures/MultiThreadedUtxoUtils/MultiThreadedUtxoUtils.mjs +32 -31
- package/data-structures/TokenDBs/AlchemyPublicTokensDB.cjs +1 -1
- package/data-structures/TokenDBs/AlchemyPublicTokensDB.d.ts +6 -1
- package/data-structures/TokenDBs/AlchemyPublicTokensDB.mjs +154 -79
- package/data-structures/TokenDBs/EventsPublicTokensDB.cjs +1 -1
- package/data-structures/TokenDBs/EventsPublicTokensDB.mjs +24 -21
- package/data-structures/TokenDBs/PrivateTokensDB.cjs +1 -1
- package/data-structures/TokenDBs/PrivateTokensDB.mjs +39 -34
- package/data-structures/crypto-keys/decodeUTXO.cjs +1 -1
- package/data-structures/crypto-keys/decodeUTXO.d.ts +15 -3
- package/data-structures/crypto-keys/decodeUTXO.mjs +84 -26
- package/data-structures/crypto-keys/encryptDecryptUtxo.cjs +1 -1
- package/data-structures/crypto-keys/encryptDecryptUtxo.mjs +36 -30
- package/data-structures/crypto-keys/keys.cjs +1 -1
- package/data-structures/crypto-keys/keys.d.ts +19 -5
- package/data-structures/crypto-keys/keys.mjs +117 -60
- package/data-structures/event-service/evm/AbstractAccessTokenSnapshotService.cjs +1 -0
- package/data-structures/event-service/{AbstractAccessTokenSnapshotService.d.ts → evm/AbstractAccessTokenSnapshotService.d.ts} +2 -2
- package/data-structures/event-service/{AbstractAccessTokenSnapshotService.mjs → evm/AbstractAccessTokenSnapshotService.mjs} +6 -6
- package/data-structures/event-service/evm/AbstractApprovalsSnapshotService.cjs +1 -0
- package/data-structures/event-service/{AbstractApprovalsSnapshotService.d.ts → evm/AbstractApprovalsSnapshotService.d.ts} +2 -2
- package/data-structures/event-service/{AbstractApprovalsSnapshotService.mjs → evm/AbstractApprovalsSnapshotService.mjs} +2 -2
- package/data-structures/event-service/evm/AbstractCommitmentsSnapshotService.cjs +1 -0
- package/data-structures/event-service/{AbstractCommitmentsSnapshotService.d.ts → evm/AbstractCommitmentsSnapshotService.d.ts} +3 -3
- package/data-structures/event-service/{AbstractCommitmentsSnapshotService.mjs → evm/AbstractCommitmentsSnapshotService.mjs} +24 -21
- package/data-structures/event-service/evm/AbstractEventService.cjs +1 -0
- package/data-structures/event-service/{AbstractEventService.d.ts → evm/AbstractEventService.d.ts} +1 -1
- package/data-structures/event-service/evm/AbstractEventService.mjs +37 -0
- package/data-structures/event-service/{AbstractNullifierSnapshotService.d.ts → evm/AbstractNullifierSnapshotService.d.ts} +1 -1
- package/data-structures/event-service/evm/AbstractSnapshotService.cjs +1 -0
- package/data-structures/event-service/{AbstractSnapshotService.mjs → evm/AbstractSnapshotService.mjs} +1 -1
- package/data-structures/event-service/evm/BlockchainEventEmitter.cjs +1 -0
- package/data-structures/event-service/{BlockchainEventEmitter.d.ts → evm/BlockchainEventEmitter.d.ts} +2 -1
- package/data-structures/event-service/evm/BlockchainEventEmitter.mjs +89 -0
- package/data-structures/event-service/index.d.ts +13 -7
- package/data-structures/event-service/solana/AbstractSolanaAccessTokenSnapshotService.cjs +1 -0
- package/data-structures/event-service/solana/AbstractSolanaAccessTokenSnapshotService.d.ts +34 -0
- package/data-structures/event-service/solana/AbstractSolanaAccessTokenSnapshotService.mjs +87 -0
- package/data-structures/event-service/solana/AbstractSolanaCommitmentsSnapshotService.cjs +1 -0
- package/data-structures/event-service/solana/AbstractSolanaCommitmentsSnapshotService.d.ts +29 -0
- package/data-structures/event-service/solana/AbstractSolanaCommitmentsSnapshotService.mjs +96 -0
- package/data-structures/event-service/solana/AbstractSolanaEventService.cjs +1 -0
- package/data-structures/event-service/solana/AbstractSolanaEventService.d.ts +22 -0
- package/data-structures/event-service/solana/AbstractSolanaEventService.mjs +33 -0
- package/data-structures/event-service/solana/AbstractSolanaNullifierSnapshotService.cjs +1 -0
- package/data-structures/event-service/solana/AbstractSolanaNullifierSnapshotService.d.ts +21 -0
- package/data-structures/event-service/solana/AbstractSolanaNullifierSnapshotService.mjs +49 -0
- package/data-structures/event-service/solana/AbstractSolanaSnapshotService.cjs +1 -0
- package/data-structures/event-service/solana/AbstractSolanaSnapshotService.d.ts +22 -0
- package/data-structures/event-service/solana/AbstractSolanaSnapshotService.mjs +33 -0
- package/data-structures/event-service/solana/SolanaBlockchainEventEmitter.cjs +1 -0
- package/data-structures/event-service/solana/SolanaBlockchainEventEmitter.d.ts +39 -0
- package/data-structures/event-service/solana/SolanaBlockchainEventEmitter.mjs +153 -0
- package/data-structures/http/BasicHttpClient.cjs +1 -0
- package/data-structures/http/BasicHttpClient.d.ts +11 -0
- package/data-structures/http/BasicHttpClient.mjs +25 -0
- package/data-structures/http/HttpClient.cjs +1 -0
- package/data-structures/http/HttpClient.d.ts +10 -0
- package/data-structures/http/HttpClient.mjs +15 -0
- package/data-structures/http/index.d.ts +2 -0
- package/data-structures/index.d.ts +1 -0
- package/data-structures/provider-adapter/IProviderAdapter.d.ts +1 -3
- package/data-structures/snapshot/SnapshotFetcherService.d.ts +1 -1
- package/data-structures/snapshot/evm-snapshots/ClientAccessTokenSnapshotService.cjs +1 -0
- package/data-structures/snapshot/{ClientAccessTokenSnapshotService.d.ts → evm-snapshots/ClientAccessTokenSnapshotService.d.ts} +2 -2
- package/data-structures/snapshot/{ClientAccessTokenSnapshotService.mjs → evm-snapshots/ClientAccessTokenSnapshotService.mjs} +13 -9
- package/data-structures/snapshot/evm-snapshots/ClientApprovalsSnapshotService.cjs +1 -0
- package/data-structures/snapshot/{ClientApprovalsSnapshotService.d.ts → evm-snapshots/ClientApprovalsSnapshotService.d.ts} +2 -3
- package/data-structures/snapshot/evm-snapshots/ClientApprovalsSnapshotService.mjs +43 -0
- package/data-structures/snapshot/evm-snapshots/ClientCommitmentsSnapshotService.cjs +1 -0
- package/data-structures/snapshot/{ClientCommitmentsSnapshotService.d.ts → evm-snapshots/ClientCommitmentsSnapshotService.d.ts} +2 -2
- package/data-structures/snapshot/evm-snapshots/ClientCommitmentsSnapshotService.mjs +35 -0
- package/data-structures/snapshot/evm-snapshots/ClientNullifierSnapshotService.cjs +1 -0
- package/data-structures/snapshot/{ClientNullifierSnapshotService.d.ts → evm-snapshots/ClientNullifierSnapshotService.d.ts} +2 -2
- package/data-structures/snapshot/evm-snapshots/ClientNullifierSnapshotService.mjs +34 -0
- package/data-structures/snapshot/index.d.ts +7 -0
- package/data-structures/snapshot/solana-snapshots/ClientSolanaAccessTokenSnapshotService.cjs +1 -0
- package/data-structures/snapshot/solana-snapshots/ClientSolanaAccessTokenSnapshotService.d.ts +8 -0
- package/data-structures/snapshot/solana-snapshots/ClientSolanaAccessTokenSnapshotService.mjs +42 -0
- package/data-structures/snapshot/solana-snapshots/ClientSolanaCommitmentsSnapshotService.cjs +1 -0
- package/data-structures/snapshot/solana-snapshots/ClientSolanaCommitmentsSnapshotService.d.ts +8 -0
- package/data-structures/snapshot/solana-snapshots/ClientSolanaCommitmentsSnapshotService.mjs +34 -0
- package/data-structures/snapshot/solana-snapshots/ClientSolanaNullifierSnapshotService.cjs +1 -0
- package/data-structures/snapshot/solana-snapshots/ClientSolanaNullifierSnapshotService.d.ts +8 -0
- package/data-structures/snapshot/solana-snapshots/ClientSolanaNullifierSnapshotService.mjs +34 -0
- package/data-structures/token-price-fetcher/TokenChecker.cjs +1 -1
- package/data-structures/token-price-fetcher/TokenChecker.mjs +5 -4
- package/data-structures/utxo/Utxo.cjs +1 -1
- package/data-structures/utxo/Utxo.d.ts +6 -1
- package/data-structures/utxo/Utxo.mjs +37 -24
- package/error-handling/error-codes.constants.cjs +1 -1
- package/error-handling/error-codes.constants.d.ts +2 -0
- package/error-handling/error-codes.constants.mjs +4 -2
- package/functions/connectors.types.d.ts +14 -0
- package/functions/index.d.ts +1 -0
- package/functions/pre-transaction/addressTableLookup.cjs +1 -0
- package/functions/pre-transaction/addressTableLookup.d.ts +4 -0
- package/functions/pre-transaction/addressTableLookup.mjs +44 -0
- package/functions/pre-transaction/constructAdminData.cjs +1 -1
- package/functions/pre-transaction/constructAdminData.d.ts +2 -1
- package/functions/pre-transaction/constructAdminData.mjs +30 -12
- package/functions/pre-transaction/convert-okx-instructions.cjs +1 -0
- package/functions/pre-transaction/convert-okx-instructions.d.ts +12 -0
- package/functions/pre-transaction/convert-okx-instructions.mjs +30 -0
- package/functions/pre-transaction/getSolanaCalldataHash.cjs +1 -0
- package/functions/pre-transaction/getSolanaCalldataHash.d.ts +4 -0
- package/functions/pre-transaction/getSolanaCalldataHash.mjs +36 -0
- package/functions/pre-transaction/getVolatileTransferAmount.cjs +1 -1
- package/functions/pre-transaction/getVolatileTransferAmount.mjs +11 -7
- package/functions/pre-transaction/index.d.ts +10 -0
- package/functions/pre-transaction/initTokenLimitIfNeeded.cjs +1 -0
- package/functions/pre-transaction/initTokenLimitIfNeeded.d.ts +3 -0
- package/functions/pre-transaction/initTokenLimitIfNeeded.mjs +20 -0
- package/functions/pre-transaction/outputUtxoProcessing.cjs +1 -1
- package/functions/pre-transaction/outputUtxoProcessing.mjs +14 -13
- package/functions/pre-transaction/process-gas-estimates.cjs +1 -1
- package/functions/pre-transaction/process-gas-estimates.d.ts +2 -2
- package/functions/pre-transaction/process-gas-estimates.mjs +13 -12
- package/functions/pre-transaction/recipientUtxoProcessing.cjs +1 -0
- package/functions/pre-transaction/recipientUtxoProcessing.d.ts +3 -0
- package/functions/pre-transaction/recipientUtxoProcessing.mjs +36 -0
- package/functions/pre-transaction/sendInitNullifiersTransaction.cjs +1 -0
- package/functions/pre-transaction/sendInitNullifiersTransaction.d.ts +11 -0
- package/functions/pre-transaction/sendInitNullifiersTransaction.mjs +41 -0
- package/functions/pre-transaction/sendV0Transaction.cjs +1 -0
- package/functions/pre-transaction/sendV0Transaction.d.ts +22 -0
- package/functions/pre-transaction/sendV0Transaction.mjs +121 -0
- package/functions/pre-transaction/solana-public-signals.cjs +1 -0
- package/functions/pre-transaction/solana-public-signals.d.ts +19 -0
- package/functions/pre-transaction/solana-public-signals.mjs +60 -0
- package/functions/pre-transaction/solana.cjs +1 -0
- package/functions/pre-transaction/solana.d.ts +17 -0
- package/functions/pre-transaction/solana.mjs +96 -0
- package/functions/pre-transaction/solanaTransfer.utils.cjs +1 -0
- package/functions/pre-transaction/solanaTransfer.utils.d.ts +6 -0
- package/functions/pre-transaction/solanaTransfer.utils.mjs +38 -0
- package/functions/pre-transaction/store-instructions.cjs +1 -0
- package/functions/pre-transaction/store-instructions.d.ts +4 -0
- package/functions/pre-transaction/store-instructions.mjs +9 -0
- package/functions/pre-transaction/store-proof.cjs +1 -0
- package/functions/pre-transaction/store-proof.d.ts +7 -0
- package/functions/pre-transaction/store-proof.mjs +55 -0
- package/functions/private-wallet/emporium.helpers.cjs +1 -1
- package/functions/private-wallet/emporium.helpers.mjs +33 -29
- package/functions/private-wallet/emporium.swap.helpers.cjs +1 -1
- package/functions/private-wallet/emporium.swap.helpers.d.ts +1 -1
- package/functions/private-wallet/emporium.swap.helpers.mjs +79 -69
- package/functions/snarkjs/constant.cjs +1 -1
- package/functions/snarkjs/constant.d.ts +40 -0
- package/functions/snarkjs/constant.mjs +66 -23
- package/functions/snarkjs/constructEmporiumProof.cjs +1 -1
- package/functions/snarkjs/constructEmporiumProof.mjs +32 -32
- package/functions/snarkjs/constructGeneralZkProof.cjs +1 -1
- package/functions/snarkjs/constructGeneralZkProof.d.ts +1 -1
- package/functions/snarkjs/constructGeneralZkProof.mjs +63 -61
- package/functions/snarkjs/constructSolanaZkProof.cjs +1 -0
- package/functions/snarkjs/constructSolanaZkProof.d.ts +13 -0
- package/functions/snarkjs/constructSolanaZkProof.mjs +109 -0
- package/functions/snarkjs/generateCircomData.cjs +1 -1
- package/functions/snarkjs/generateCircomData.d.ts +1 -1
- package/functions/snarkjs/generateCircomData.mjs +9 -9
- package/functions/snarkjs/generateZkProofEnclave.cjs +1 -1
- package/functions/snarkjs/generateZkProofEnclave.mjs +10 -9
- package/functions/snarkjs/getZKFiles.cjs +1 -1
- package/functions/snarkjs/getZKFiles.mjs +13 -13
- package/functions/snarkjs/index.d.ts +1 -0
- package/functions/utils/addresses.cjs +1 -1
- package/functions/utils/addresses.d.ts +1 -1
- package/functions/utils/addresses.mjs +21 -17
- package/functions/utils/amounts.utils.cjs +1 -1
- package/functions/utils/amounts.utils.d.ts +1 -0
- package/functions/utils/amounts.utils.mjs +53 -40
- package/functions/utils/bytes32.utils.cjs +1 -0
- package/functions/utils/bytes32.utils.d.ts +2 -0
- package/functions/utils/bytes32.utils.mjs +10 -0
- package/functions/utils/cacheDevice.utils.cjs +1 -1
- package/functions/utils/cacheDevice.utils.mjs +2 -3
- package/functions/utils/cacheFunctions.cjs +1 -1
- package/functions/utils/cacheFunctions.mjs +53 -52
- package/functions/utils/convertIntegrationProviderToExternalActionId.cjs +1 -1
- package/functions/utils/convertIntegrationProviderToExternalActionId.mjs +1 -0
- package/functions/utils/create-provider.cjs +1 -1
- package/functions/utils/create-provider.d.ts +4 -1
- package/functions/utils/create-provider.mjs +8 -6
- package/functions/utils/encodeTokenWithId.cjs +1 -1
- package/functions/utils/encodeTokenWithId.d.ts +1 -1
- package/functions/utils/encodeTokenWithId.mjs +6 -2
- package/functions/utils/encryptInputForEnclave.cjs +1 -1
- package/functions/utils/encryptInputForEnclave.mjs +29 -28
- package/functions/utils/erc20tokenFunctions.cjs +1 -1
- package/functions/utils/erc20tokenFunctions.mjs +29 -29
- package/functions/utils/ethers-formatter.utils.cjs +1 -1
- package/functions/utils/ethers-formatter.utils.d.ts +2 -0
- package/functions/utils/ethers-formatter.utils.mjs +45 -15
- package/functions/utils/evmNetworkFunctions.cjs +1 -1
- package/functions/utils/evmNetworkFunctions.mjs +3 -4
- package/functions/utils/fees.utils.cjs +1 -1
- package/functions/utils/fees.utils.d.ts +1 -0
- package/functions/utils/fees.utils.mjs +19 -9
- package/functions/utils/get-hinkal-approvals.cjs +1 -1
- package/functions/utils/get-hinkal-approvals.mjs +1 -1
- package/functions/utils/getBlockExplorerUrl.cjs +1 -1
- package/functions/utils/getBlockExplorerUrl.mjs +2 -2
- package/functions/utils/getRecipientInfoFromUserKeys.cjs +1 -1
- package/functions/utils/getRecipientInfoFromUserKeys.d.ts +0 -1
- package/functions/utils/getRecipientInfoFromUserKeys.mjs +10 -13
- package/functions/utils/getUtxosFromReceipt.utils.cjs +1 -0
- package/functions/utils/getUtxosFromReceipt.utils.d.ts +4 -0
- package/functions/utils/getUtxosFromReceipt.utils.mjs +29 -0
- package/functions/utils/getUtxosFromReceiptSolana.cjs +1 -0
- package/functions/utils/getUtxosFromReceiptSolana.d.ts +5 -0
- package/functions/utils/getUtxosFromReceiptSolana.mjs +19 -0
- package/functions/utils/index.d.ts +5 -1
- package/functions/utils/networks.utils.cjs +1 -1
- package/functions/utils/networks.utils.mjs +2 -3
- package/functions/utils/nftTokenFunctions.cjs +1 -1
- package/functions/utils/nftTokenFunctions.mjs +8 -4
- package/functions/utils/prepareHinkal.cjs +1 -0
- package/functions/utils/prepareHinkal.d.ts +7 -1
- package/functions/utils/prepareHinkal.mjs +88 -0
- package/functions/utils/publicBalance.utils.cjs +1 -1
- package/functions/utils/publicBalance.utils.d.ts +1 -0
- package/functions/utils/publicBalance.utils.mjs +75 -45
- package/functions/utils/solanaMint.utils.cjs +1 -0
- package/functions/utils/solanaMint.utils.d.ts +10 -0
- package/functions/utils/solanaMint.utils.mjs +14 -0
- package/functions/utils/time.utils.cjs +1 -1
- package/functions/utils/time.utils.d.ts +1 -1
- package/functions/utils/time.utils.mjs +11 -11
- package/functions/utils/userAgent.cjs +1 -1
- package/functions/utils/userAgent.mjs +6 -7
- package/functions/utils/walletBalances.utils.cjs +1 -1
- package/functions/utils/walletBalances.utils.d.ts +2 -1
- package/functions/utils/walletBalances.utils.mjs +18 -17
- package/functions/web3/events/getInputUtxoAndBalance.cjs +1 -1
- package/functions/web3/events/getInputUtxoAndBalance.mjs +98 -91
- package/functions/web3/events/getInputUtxosEnclave.cjs +1 -1
- package/functions/web3/events/getInputUtxosEnclave.mjs +38 -16
- package/functions/web3/events/getShieldedBalance.cjs +2 -2
- package/functions/web3/events/getShieldedBalance.mjs +70 -62
- package/functions/web3/events/getTransactionLogEvents.cjs +1 -1
- package/functions/web3/events/getTransactionLogEvents.d.ts +3 -2
- package/functions/web3/events/getTransactionLogEvents.mjs +12 -9
- package/functions/web3/fetchSolanaMerkleTreeRootHash.cjs +1 -0
- package/functions/web3/fetchSolanaMerkleTreeRootHash.d.ts +4 -0
- package/functions/web3/fetchSolanaMerkleTreeRootHash.mjs +45 -0
- package/functions/web3/functionCalls/accessTokenCalls.cjs +1 -1
- package/functions/web3/functionCalls/accessTokenCalls.d.ts +2 -0
- package/functions/web3/functionCalls/accessTokenCalls.mjs +25 -7
- package/functions/web3/functionCalls/transactCallRelayer.cjs +1 -1
- package/functions/web3/functionCalls/transactCallRelayer.d.ts +20 -0
- package/functions/web3/functionCalls/transactCallRelayer.mjs +61 -19
- package/functions/web3/getContractMetadata.cjs +1 -1
- package/functions/web3/getContractMetadata.mjs +20 -50
- package/functions/web3/getTokenHolder.cjs +1 -1
- package/functions/web3/getTokenHolder.mjs +29 -24
- package/functions/web3/index.d.ts +2 -0
- package/functions/web3/odosAPI.cjs +1 -1
- package/functions/web3/odosAPI.mjs +11 -8
- package/functions/web3/okxAPI.cjs +1 -0
- package/functions/web3/okxAPI.d.ts +8 -0
- package/functions/web3/okxAPI.mjs +43 -0
- package/functions/web3/oneInchAPI.cjs +1 -1
- package/functions/web3/oneInchAPI.mjs +7 -4
- package/functions/web3/runContractFunction.cjs +1 -1
- package/functions/web3/runContractFunction.mjs +22 -18
- package/functions/web3/signAndSendSerializedTransaction.cjs +1 -0
- package/functions/web3/signAndSendSerializedTransaction.d.ts +2 -0
- package/functions/web3/signAndSendSerializedTransaction.mjs +11 -0
- package/functions/web3/uniswapAPI.cjs +1 -1
- package/functions/web3/uniswapAPI.mjs +7 -4
- package/index.cjs +1 -1
- package/index.mjs +922 -810
- package/package.json +12 -16
- package/providers/CustomEthersProvider.cjs +1 -0
- package/providers/{TorExternalProvider.d.ts → CustomEthersProvider.d.ts} +2 -2
- package/providers/CustomEthersProvider.mjs +29 -0
- package/providers/CustomSolanaConnection.cjs +1 -0
- package/providers/CustomSolanaConnection.d.ts +4 -0
- package/providers/CustomSolanaConnection.mjs +33 -0
- package/providers/EthersProviderAdapter.cjs +1 -1
- package/providers/EthersProviderAdapter.d.ts +1 -2
- package/providers/EthersProviderAdapter.mjs +8 -48
- package/providers/SolanaProviderAdapter.cjs +1 -0
- package/providers/SolanaProviderAdapter.d.ts +44 -0
- package/providers/SolanaProviderAdapter.mjs +125 -0
- package/providers/WagmiProviderAdapter.cjs +1 -1
- package/providers/WagmiProviderAdapter.d.ts +1 -2
- package/providers/WagmiProviderAdapter.mjs +26 -24
- package/providers/prepareEthersHinkal.cjs +1 -1
- package/providers/prepareEthersHinkal.mjs +10 -7
- package/providers/prepareWagmiHinkal.cjs +1 -1
- package/providers/prepareWagmiHinkal.mjs +9 -6
- package/types/IMultiThreadedUtxoUtils.d.ts +2 -2
- package/types/TransactionSimulator.types.d.ts +1 -0
- package/types/activities.types.cjs +1 -1
- package/types/activities.types.d.ts +1 -0
- package/types/activities.types.mjs +6 -4
- package/types/admin.types.cjs +1 -1
- package/types/admin.types.d.ts +16 -0
- package/types/admin.types.mjs +1 -1
- package/types/all-points.types.d.ts +0 -1
- package/types/cache.types.cjs +1 -1
- package/types/cache.types.d.ts +8 -1
- package/types/cache.types.mjs +1 -1
- package/types/circom-data.types.d.ts +6 -0
- package/types/commitments.types.d.ts +12 -0
- package/types/ethereum-network.types.cjs +1 -1
- package/types/ethereum-network.types.d.ts +9 -3
- package/types/ethereum-network.types.mjs +1 -1
- package/types/external-action.types.cjs +1 -1
- package/types/external-action.types.d.ts +3 -1
- package/types/external-action.types.mjs +2 -2
- package/types/hinkal.types.cjs +1 -1
- package/types/hinkal.types.d.ts +3 -2
- package/types/hinkal.types.mjs +8 -8
- package/types/http.types.d.ts +8 -0
- package/types/index.d.ts +3 -2
- package/types/new-rewards.type.d.ts +2 -9
- package/types/offscreen.types.cjs +1 -1
- package/types/offscreen.types.d.ts +2 -1
- package/types/offscreen.types.mjs +2 -2
- package/types/okx.types.d.ts +57 -0
- package/types/rewards.types.d.ts +0 -11
- package/types/sandbox.types.cjs +1 -1
- package/types/sandbox.types.d.ts +19 -2
- package/types/sandbox.types.mjs +2 -2
- package/types/solana.types.d.ts +75 -0
- package/types/token.types.d.ts +6 -0
- package/webworker/snarkjsWorker/snarkjsWorkerLauncher.cjs +1 -1
- package/webworker/snarkjsWorker/snarkjsWorkerLauncher.mjs +1 -1
- package/webworker/snarkjsWorker/snarkjsWorkerLogic.cjs +1 -1
- package/webworker/snarkjsWorker/snarkjsWorkerLogic.d.ts +0 -1
- package/webworker/snarkjsWorker/snarkjsWorkerLogic.mjs +28 -30
- package/webworker/utxoWorker/utxoWorker.types.d.ts +2 -0
- package/webworker/utxoWorker/utxoWorkerLauncher.cjs +1 -1
- package/webworker/utxoWorker/utxoWorkerLauncher.mjs +1 -1
- package/webworker/utxoWorker/utxoWorkerLogic.cjs +1 -1
- package/webworker/utxoWorker/utxoWorkerLogic.mjs +33 -31
- package/webworker/viteWorkerURL.constant.cjs +21 -1
- package/webworker/viteWorkerURL.constant.mjs +21 -12
- package/webworker/zkProofWorker/zkProofWorkerLauncher.cjs +1 -1
- package/webworker/zkProofWorker/zkProofWorkerLauncher.mjs +1 -1
- package/API/mysteryBoxesCalls.cjs +0 -1
- package/API/mysteryBoxesCalls.d.ts +0 -60
- package/API/mysteryBoxesCalls.mjs +0 -66
- package/assets/snarkjsWorkerLauncher-CWaDqRaL.js +0 -14803
- package/assets/utxoWorkerLauncher-BUhBaUSg.js +0 -115868
- package/assets/zkProofWorkerLauncher-DlWQP3l9.js +0 -115360
- package/constants/mystery-boxes.constants.cjs +0 -1
- package/constants/mystery-boxes.constants.d.ts +0 -63
- package/constants/mystery-boxes.constants.mjs +0 -355
- package/data-structures/event-service/AbstractAccessTokenSnapshotService.cjs +0 -1
- package/data-structures/event-service/AbstractApprovalsSnapshotService.cjs +0 -1
- package/data-structures/event-service/AbstractCommitmentsSnapshotService.cjs +0 -1
- package/data-structures/event-service/AbstractEventService.cjs +0 -1
- package/data-structures/event-service/AbstractEventService.mjs +0 -33
- package/data-structures/event-service/AbstractSnapshotService.cjs +0 -1
- package/data-structures/event-service/BlockchainEventEmitter.cjs +0 -1
- package/data-structures/event-service/BlockchainEventEmitter.mjs +0 -80
- package/data-structures/snapshot/ClientAccessTokenSnapshotService.cjs +0 -1
- package/data-structures/snapshot/ClientApprovalsSnapshotService.cjs +0 -1
- package/data-structures/snapshot/ClientApprovalsSnapshotService.mjs +0 -23
- package/data-structures/snapshot/ClientCommitmentsSnapshotService.cjs +0 -1
- package/data-structures/snapshot/ClientCommitmentsSnapshotService.mjs +0 -31
- package/data-structures/snapshot/ClientNullifierSnapshotService.cjs +0 -1
- package/data-structures/snapshot/ClientNullifierSnapshotService.mjs +0 -30
- package/functions/utils/mystery-box-auction.utils.cjs +0 -1
- package/functions/utils/mystery-box-auction.utils.d.ts +0 -8
- package/functions/utils/mystery-box-auction.utils.mjs +0 -51
- package/providers/TorExternalProvider.cjs +0 -1
- package/providers/TorExternalProvider.mjs +0 -29
- package/types/merch-order.types.cjs +0 -1
- package/types/merch-order.types.d.ts +0 -16
- package/types/merch-order.types.mjs +0 -4
- package/types/mystery-boxes.types.cjs +0 -1
- package/types/mystery-boxes.types.d.ts +0 -43
- package/types/mystery-boxes.types.mjs +0 -6
- /package/data-structures/event-service/{AbstractNullifierSnapshotService.cjs → evm/AbstractNullifierSnapshotService.cjs} +0 -0
- /package/data-structures/event-service/{AbstractNullifierSnapshotService.mjs → evm/AbstractNullifierSnapshotService.mjs} +0 -0
- /package/data-structures/event-service/{AbstractSnapshotService.d.ts → evm/AbstractSnapshotService.d.ts} +0 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { TOKEN_2022_PROGRAM_ID as D, TOKEN_PROGRAM_ID as x } from "@solana/spl-token";
|
|
2
|
+
import { PublicKey as p } from "@solana/web3.js";
|
|
3
|
+
import { networkRegistry as A } from "../../constants/chains.constants.mjs";
|
|
4
|
+
import { solanaNativeAddress as P } from "../../constants/protocol.constants.mjs";
|
|
5
|
+
import { formatMintAddress as N } from "../../functions/utils/solanaMint.utils.mjs";
|
|
6
|
+
import { isValidPrivateAddress as O, constructStealthAddressStructure as V } from "../../functions/utils/addresses.mjs";
|
|
7
|
+
import { transactionErrorCodes as _ } from "../../error-handling/error-codes.constants.mjs";
|
|
8
|
+
import { getStorageAccountPublicKey as v, getStorageVaultPublicKey as L, buildAnchorStealthAddressStructure as M, getTokenLimitStorageAccountPublicKey as G } from "../../functions/pre-transaction/solana.mjs";
|
|
9
|
+
import { BN as U } from "@coral-xyz/anchor";
|
|
10
|
+
import { sendProxyV0Transaction as z, serializeProxyV0Transaction as F } from "../../functions/pre-transaction/sendV0Transaction.mjs";
|
|
11
|
+
import { UserKeys as q } from "../crypto-keys/keys.mjs";
|
|
12
|
+
import { createCustomSolanaConnection as B } from "../../functions/utils/create-provider.mjs";
|
|
13
|
+
const j = async ({
|
|
14
|
+
program: o,
|
|
15
|
+
mintPublicKey: t,
|
|
16
|
+
mintAddressString: e,
|
|
17
|
+
tokenAmount: n,
|
|
18
|
+
anchorStealthStructure: s,
|
|
19
|
+
senderPublickey: i,
|
|
20
|
+
originalDeployer: r,
|
|
21
|
+
storageAccount: a,
|
|
22
|
+
storageVault: d
|
|
23
|
+
}) => {
|
|
24
|
+
const u = new U(n.toString()), l = G(o.programId, r, t), m = e === P ? null : t, c = e === P ? null : void 0;
|
|
25
|
+
return o.methods.prooflessDeposit(u, s).accounts({
|
|
26
|
+
mint: m,
|
|
27
|
+
signer: i,
|
|
28
|
+
signerAta: c,
|
|
29
|
+
originalDeployer: r,
|
|
30
|
+
storageAccount: a,
|
|
31
|
+
storageVault: d,
|
|
32
|
+
tokenLimitStorage: l,
|
|
33
|
+
storageVaultAta: c,
|
|
34
|
+
accessTokenOwner: null
|
|
35
|
+
}).instruction();
|
|
36
|
+
}, w = async (o, t, e, n, s) => {
|
|
37
|
+
const i = s ?? o.getRecipientInfo();
|
|
38
|
+
if (!O(i))
|
|
39
|
+
throw Error(_.RECIPIENT_FORMAT_INCORRECT);
|
|
40
|
+
const r = o.getCurrentChainId(), a = q.getSignerAddressFromPrivateKey(r, n.privateKey), { hinkalIdl: d, hinkalAddress: u, originalDeployer: l } = A[r].contractData;
|
|
41
|
+
if (!d)
|
|
42
|
+
throw new Error("No IDL configured for Solana program on this network");
|
|
43
|
+
if (!l)
|
|
44
|
+
throw new Error("missing original deployer");
|
|
45
|
+
const m = o.getSolanaProgram(d), c = new p(l), g = new p(u), f = new p(a), { erc20TokenAddress: I } = t, { fetchRpcUrl: S } = A[r];
|
|
46
|
+
if (!S)
|
|
47
|
+
throw new Error("RPC URL not found for the specified chain ID");
|
|
48
|
+
const E = B(S), { mintPublicKey: y } = N(I), R = y.toString(), h = v(g, c), T = L(g, c), b = V(i), k = M(b), C = await j({
|
|
49
|
+
program: m,
|
|
50
|
+
mintPublicKey: y,
|
|
51
|
+
mintAddressString: R,
|
|
52
|
+
tokenAmount: e,
|
|
53
|
+
anchorStealthStructure: k,
|
|
54
|
+
senderPublickey: f,
|
|
55
|
+
originalDeployer: c,
|
|
56
|
+
storageAccount: h,
|
|
57
|
+
storageVault: T
|
|
58
|
+
}), K = t.is2022Program ? D : x;
|
|
59
|
+
return {
|
|
60
|
+
connection: E,
|
|
61
|
+
chainId: r,
|
|
62
|
+
senderAddress: a,
|
|
63
|
+
senderPublickey: f,
|
|
64
|
+
instructions: [C],
|
|
65
|
+
storageAccount: h,
|
|
66
|
+
programId: K
|
|
67
|
+
};
|
|
68
|
+
}, er = async (o, t, e, n, s, i = !1) => {
|
|
69
|
+
if (i)
|
|
70
|
+
throw new Error("onlyGasEstimate is not supported for Solana proxy shield");
|
|
71
|
+
if (!n)
|
|
72
|
+
throw new Error("subAccount is required");
|
|
73
|
+
const { connection: r, senderPublickey: a, instructions: d, chainId: u, senderAddress: l, storageAccount: m, programId: c } = await w(o, t, e, n, s), g = s || m.toString();
|
|
74
|
+
return z({
|
|
75
|
+
connection: r,
|
|
76
|
+
chainId: u,
|
|
77
|
+
subAccount: n,
|
|
78
|
+
payerPublicKey: a,
|
|
79
|
+
instructions: d,
|
|
80
|
+
convertParams: {
|
|
81
|
+
fromAddress: l,
|
|
82
|
+
toAddress: g,
|
|
83
|
+
programAddress: c.toString()
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}, sr = async (o, t, e, n, s) => {
|
|
87
|
+
const { connection: i, senderPublickey: r, instructions: a } = await w(
|
|
88
|
+
o,
|
|
89
|
+
t,
|
|
90
|
+
e,
|
|
91
|
+
n,
|
|
92
|
+
s
|
|
93
|
+
);
|
|
94
|
+
return F(i, r, a);
|
|
95
|
+
};
|
|
96
|
+
export {
|
|
97
|
+
sr as getSolanaProxyShieldSerializedTransaction,
|
|
98
|
+
er as hinkalSolanaProxyShield
|
|
99
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("@solana/web3.js");require("../../constants/token-data/index.cjs");const k=require("../../constants/chains.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("../../functions/pre-transaction/sendV0Transaction.cjs"),I=require("../../functions/pre-transaction/getFeeStructure.cjs"),x=require("../../types/external-action.types.cjs"),E=require("../../error-handling/error-codes.constants.cjs"),K=require("../../functions/pre-transaction/solanaTransfer.utils.cjs"),C=require("../crypto-keys/keys.cjs"),R=require("../../functions/utils/create-provider.cjs"),P=async(t,o,u)=>{const a=t.getCurrentChainId(),n=C.UserKeys.getSignerAddressFromPrivateKey(a,u.privateKey),{fetchRpcUrl:s}=k.networkRegistry[a];if(!s)throw new Error("RPC URL not found for the specified chain ID");const i=R.createCustomSolanaConnection(s),y=JSON.parse(o),{addressLookupTableAccount:d,instructionLists:l}=y.data,w=await Promise.all(d.map(async r=>{const e=await i.getAddressLookupTable(new c.PublicKey(r));if(!e.value)throw new Error(`Failed to fetch lookup table: ${r}`);return e.value}));if(l.length===0)throw new Error("No instructions found");const p=l.map(r=>new c.TransactionInstruction({keys:r.accounts.map(e=>({pubkey:new c.PublicKey(e.pubkey),isSigner:e.isSigner,isWritable:e.isWritable})),programId:new c.PublicKey(r.programId),data:Buffer.from(r.data,"base64")}));return{connection:i,walletAddress:n,walletPublicKey:new c.PublicKey(n),lookupTableAccounts:w,instructions:p,instructionLists:l}},v=async(t,o,u,a,n,s,i,y=!1)=>{if(y)throw new Error("onlyGasEstimate is not supported for Solana proxy swap");const d=t.getCurrentChainId(),l=o[1],w=u[1],p=i??await I.getFeeStructure(d,s,o.map(T=>T.erc20TokenAddress),x.ExternalActionId.Emporium),r=w*p.variableRate/10000n,{connection:e,walletAddress:b,walletPublicKey:S,instructions:g,lookupTableAccounts:m,instructionLists:A}=await P(t,a,n),f=await t.getRandomRelay();if(!f)throw Error(E.transactionErrorCodes.RELAYER_NOT_AVAILABLE);const{instructions:h}=await K.buildSolanaTransferInstructions(e,S,new c.PublicKey(f),l,r);return q.sendProxyV0Transaction({connection:e,chainId:d,subAccount:n,payerPublicKey:S,instructions:[...g,...h],lookupTableAccounts:m,convertParams:{fromAddress:b,toAddress:b,programAddress:A[0].programId}})},L=async(t,o,u)=>{const{connection:a,walletPublicKey:n,instructions:s,lookupTableAccounts:i}=await P(t,o,u);return q.serializeProxyV0Transaction(a,n,s,i)};exports.getSolanaProxySwapSerializedTransaction=L;exports.hinkalSolanaProxySwap=v;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ERC20Token, RelayerTransaction, SubAccount } from '../../types';
|
|
2
|
+
import { IHinkal } from './IHinkal';
|
|
3
|
+
import { FeeStructure } from '../../types/hinkal.types';
|
|
4
|
+
export declare const hinkalSolanaProxySwap: (hinkal: IHinkal, erc20Tokens: ERC20Token[], amountChanges: bigint[], data: string, subAccount: SubAccount, feeToken?: string, feeStructureOverride?: FeeStructure, onlyGasEstimate?: boolean) => Promise<RelayerTransaction>;
|
|
5
|
+
export declare const getSolanaProxySwapSerializedTransaction: (hinkal: IHinkal, data: string, subAccount: SubAccount) => Promise<string>;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { PublicKey as l, TransactionInstruction as k } from "@solana/web3.js";
|
|
2
|
+
import "../../constants/token-data/index.mjs";
|
|
3
|
+
import { networkRegistry as E } from "../../constants/chains.constants.mjs";
|
|
4
|
+
import "../../constants/contracts.constants.mjs";
|
|
5
|
+
import "../../constants/kyc.constants.mjs";
|
|
6
|
+
import "../../constants/server.constants.mjs";
|
|
7
|
+
import "../../constants/vite.constants.mjs";
|
|
8
|
+
import "../../constants/coingecko.constants.mjs";
|
|
9
|
+
import "../../constants/reorg-depths.constants.mjs";
|
|
10
|
+
import "../../constants/addresses.constants.mjs";
|
|
11
|
+
import "../../constants/token.limits.constants.mjs";
|
|
12
|
+
import "../../constants/presale.constants.mjs";
|
|
13
|
+
import "../../constants/activity.constants.mjs";
|
|
14
|
+
import "../../constants/tasks.constants.mjs";
|
|
15
|
+
import "../../constants/events.constants.mjs";
|
|
16
|
+
import { sendProxyV0Transaction as T, serializeProxyV0Transaction as x } from "../../functions/pre-transaction/sendV0Transaction.mjs";
|
|
17
|
+
import { getFeeStructure as C } from "../../functions/pre-transaction/getFeeStructure.mjs";
|
|
18
|
+
import { ExternalActionId as R } from "../../types/external-action.types.mjs";
|
|
19
|
+
import { transactionErrorCodes as K } from "../../error-handling/error-codes.constants.mjs";
|
|
20
|
+
import { buildSolanaTransferInstructions as L } from "../../functions/pre-transaction/solanaTransfer.utils.mjs";
|
|
21
|
+
import { UserKeys as v } from "../crypto-keys/keys.mjs";
|
|
22
|
+
import { createCustomSolanaConnection as F } from "../../functions/utils/create-provider.mjs";
|
|
23
|
+
const A = async (r, e, c) => {
|
|
24
|
+
const a = r.getCurrentChainId(), n = v.getSignerAddressFromPrivateKey(a, c.privateKey), { fetchRpcUrl: i } = E[a];
|
|
25
|
+
if (!i)
|
|
26
|
+
throw new Error("RPC URL not found for the specified chain ID");
|
|
27
|
+
const s = F(i), u = JSON.parse(e), { addressLookupTableAccount: m, instructionLists: p } = u.data, d = await Promise.all(
|
|
28
|
+
m.map(async (o) => {
|
|
29
|
+
const t = await s.getAddressLookupTable(new l(o));
|
|
30
|
+
if (!t.value)
|
|
31
|
+
throw new Error(`Failed to fetch lookup table: ${o}`);
|
|
32
|
+
return t.value;
|
|
33
|
+
})
|
|
34
|
+
);
|
|
35
|
+
if (p.length === 0)
|
|
36
|
+
throw new Error("No instructions found");
|
|
37
|
+
const w = p.map((o) => new k({
|
|
38
|
+
keys: o.accounts.map((t) => ({
|
|
39
|
+
pubkey: new l(t.pubkey),
|
|
40
|
+
isSigner: t.isSigner,
|
|
41
|
+
isWritable: t.isWritable
|
|
42
|
+
})),
|
|
43
|
+
programId: new l(o.programId),
|
|
44
|
+
data: Buffer.from(o.data, "base64")
|
|
45
|
+
}));
|
|
46
|
+
return {
|
|
47
|
+
connection: s,
|
|
48
|
+
walletAddress: n,
|
|
49
|
+
walletPublicKey: new l(n),
|
|
50
|
+
lookupTableAccounts: d,
|
|
51
|
+
instructions: w,
|
|
52
|
+
instructionLists: p
|
|
53
|
+
};
|
|
54
|
+
}, rt = async (r, e, c, a, n, i, s, u = !1) => {
|
|
55
|
+
if (u)
|
|
56
|
+
throw new Error("onlyGasEstimate is not supported for Solana proxy swap");
|
|
57
|
+
const m = r.getCurrentChainId(), p = e[1], d = c[1], w = s ?? await C(
|
|
58
|
+
m,
|
|
59
|
+
i,
|
|
60
|
+
e.map((I) => I.erc20TokenAddress),
|
|
61
|
+
R.Emporium
|
|
62
|
+
), o = d * w.variableRate / 10000n, { connection: t, walletAddress: f, walletPublicKey: y, instructions: g, lookupTableAccounts: S, instructionLists: h } = await A(r, a, n), b = await r.getRandomRelay();
|
|
63
|
+
if (!b)
|
|
64
|
+
throw Error(K.RELAYER_NOT_AVAILABLE);
|
|
65
|
+
const { instructions: P } = await L(
|
|
66
|
+
t,
|
|
67
|
+
y,
|
|
68
|
+
new l(b),
|
|
69
|
+
p,
|
|
70
|
+
o
|
|
71
|
+
);
|
|
72
|
+
return T({
|
|
73
|
+
connection: t,
|
|
74
|
+
chainId: m,
|
|
75
|
+
subAccount: n,
|
|
76
|
+
payerPublicKey: y,
|
|
77
|
+
instructions: [...g, ...P],
|
|
78
|
+
lookupTableAccounts: S,
|
|
79
|
+
convertParams: {
|
|
80
|
+
fromAddress: f,
|
|
81
|
+
toAddress: f,
|
|
82
|
+
programAddress: h[0].programId
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}, nt = async (r, e, c) => {
|
|
86
|
+
const { connection: a, walletPublicKey: n, instructions: i, lookupTableAccounts: s } = await A(
|
|
87
|
+
r,
|
|
88
|
+
e,
|
|
89
|
+
c
|
|
90
|
+
);
|
|
91
|
+
return x(a, n, i, s);
|
|
92
|
+
};
|
|
93
|
+
export {
|
|
94
|
+
nt as getSolanaProxySwapSerializedTransaction,
|
|
95
|
+
rt as hinkalSolanaProxySwap
|
|
96
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../../types/circom-data.types.cjs");const oe=require("../../types/external-action.types.cjs"),y=require("../../constants/protocol.constants.cjs");require("../../types/transactions.types.cjs");require("../../types/activities.types.cjs");const ne=require("../../types/cache.types.cjs"),se=require("../../functions/web3/events/getShieldedBalance.cjs"),ce=require("../../functions/pre-transaction/outputUtxoProcessing.cjs"),ae=require("../../functions/utils/time.utils.cjs"),ie=require("../../functions/pre-transaction/getFeeStructure.cjs");require("../../node_modules/ethers/lib/utils.cjs");const ue=require("../../functions/snarkjs/common.snarkjs.cjs"),le=require("../../constants/chains.constants.cjs"),c=require("@solana/web3.js"),m=require("../../functions/pre-transaction/solana.cjs"),de=require("../../functions/snarkjs/constructSolanaZkProof.cjs"),pe=require("../utxo/Utxo.cjs"),S=require("../../functions/web3/etherFunctions.cjs"),ge=require("../../functions/pre-transaction/convert-okx-instructions.cjs"),Ae=require("../../functions/web3/functionCalls/transactCallRelayer.cjs"),ye=require("../../error-handling/error-codes.constants.cjs"),me=require("../../functions/pre-transaction/shouldPatchAccessTokenMerkleTree.cjs"),Se=require("../../_virtual/utils.cjs"),we=async(t,o,r,x,K,h,E,R=!1)=>{if(R)throw new Error("onlyGasEstimate is not supported for Solana swap");const a=t.getCurrentChainId(),w=new c.PublicKey(y.solanaNativeAddress),{hinkalAddress:v,originalDeployer:i,hinkalIdl:f}=le.networkRegistry[a].contractData;if(!i||!f)throw new Error("No IDL configured for Solana program on this network");const u=new c.PublicKey(i),l=new c.PublicKey(v),n=o.map(e=>e.erc20TokenAddress),{userKeys:P,merkleTreeAccessToken:_,merkleTreeHinkal:F}=t,N=t.getSolanaProgram(f),s=E??await ie.getFeeStructure(a,h,n,oe.ExternalActionId.Transact),{patchAccessTokenMerkleTree:O,kycRequired:U,hasAccessToken:D}=await me.shouldPatchAccessTokenMerkleTree(t,n,r);r[1]-=s.flatFee;const C=s.variableRate.toString(),B=Number(t.cacheDevice.get(ne.StorageKeys.SLIPPAGE_PERCENTAGE)??0),d=o[1],L=S.getAmountInToken(d,r[1]),M=Number(L)*B/100;r[1]-=S.getAmountInWei(d,M.toFixed(d.decimals));const p=[...await se.addPaddingToUtxos(t,n,r,6)],V=ae.getCurrentTimeInSeconds().toString(),j=t.userKeys.getShieldedPrivateKey(),g=[];for(let e=0;e<n.length;e+=1){const{outputUtxos:re}=ce.outputUtxoProcessing(t.userKeys,p[e],r[e],V,void 0,!1);g.push([re[0]])}const G=pe.Utxo.findCorrectRandomization(S.randomBigInt(31),j),q={tokenNumber:2,nullifierAmount:p[0].length,outputAmount:1},W=[!1,!0].slice(0,r.length),A=await t.getRandomRelay(!0);if(!A)throw Error(ye.transactionErrorCodes.RELAYER_NOT_AVAILABLE);const b=ue.calcEncryptedOutputs(g,!1).map(e=>[...Se.__exports.arrayify(e[0])]),T=m.getSwapperAccountPublicKey(l,u),{remainingAccounts:k,hinkalInstructions:I}=ge.convertOKXToHinkalInstructions(x,T),{proofAArr:z,proofBArr:H,proofCArr:Z,publicInputsArr:X}=await de.constructSolanaZkProof(t.generateProofRemotely,i,F,_,P,N,n,p,g,G,s.flatFee,s.variableRate,w.toString(),A,q,b,a,O,W,I,k),Y=m.getStorageAccountPublicKey(l,u),J=m.getStorageVaultPublicKey(l,u),Q=o[0].erc20TokenAddress!==y.solanaNativeAddress?new c.PublicKey(o[0].erc20TokenAddress):null,$=o[1].erc20TokenAddress!==y.solanaNativeAddress?new c.PublicKey(o[1].erc20TokenAddress):null,ee={recipient:w.toString(),storageAccount:Y.toString(),storageVault:J.toString(),swapperAccount:T.toString(),mintFrom:Q?.toString()??null,mintTo:$?.toString()??null,remainingAccounts:k.map(e=>({pubkey:e.pubkey.toString(),isSigner:e.isSigner,isWritable:e.isWritable})),addressLookupTableAccount:K},te={encryptedOutputs:b,proofAArr:z,proofBArr:H,proofCArr:Z,publicInputsArr:X,relayerFee:s.flatFee.toString(),variableRate:C,dimensions:q,hinkalInstructions:I.map(e=>({accountIndexes:[...e.accountIndexes],data:[...e.data],programIndex:e.programIndex}))};return Ae.solanaTransactCallRelayer(a,{relayAddress:A,functionName:"swap",args:te,accounts:ee,solanaAccessTokenData:!D&&U?{ethereumAddress:await t.getEthereumAddress(),accessKey:P.getAccessKey()}:void 0})};exports.hinkalSolanaSwap=we;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { FeeStructure, OKXSwapResponseInstruction } from '../../types';
|
|
2
|
+
import { IHinkal } from './IHinkal';
|
|
3
|
+
import { ERC20Token } from '../../types/token.types';
|
|
4
|
+
export declare const hinkalSolanaSwap: (hinkal: IHinkal, erc20Tokens: ERC20Token[], amountChanges: bigint[], instructionLists: OKXSwapResponseInstruction[], addressLookupTableAccount: string[], feeToken?: string, feeStructureOverride?: FeeStructure, onlyGasEstimate?: boolean) => Promise<import('../../types/relayer.types').RelayerTransaction>;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import "../../types/circom-data.types.mjs";
|
|
2
|
+
import { ExternalActionId as et } from "../../types/external-action.types.mjs";
|
|
3
|
+
import { solanaNativeAddress as A } from "../../constants/protocol.constants.mjs";
|
|
4
|
+
import "../../types/transactions.types.mjs";
|
|
5
|
+
import "../../types/activities.types.mjs";
|
|
6
|
+
import { StorageKeys as rt } from "../../types/cache.types.mjs";
|
|
7
|
+
import { addPaddingToUtxos as ot } from "../../functions/web3/events/getShieldedBalance.mjs";
|
|
8
|
+
import { outputUtxoProcessing as nt } from "../../functions/pre-transaction/outputUtxoProcessing.mjs";
|
|
9
|
+
import { getCurrentTimeInSeconds as st } from "../../functions/utils/time.utils.mjs";
|
|
10
|
+
import { getFeeStructure as at } from "../../functions/pre-transaction/getFeeStructure.mjs";
|
|
11
|
+
import "../../node_modules/ethers/lib/utils.mjs";
|
|
12
|
+
import { calcEncryptedOutputs as it } from "../../functions/snarkjs/common.snarkjs.mjs";
|
|
13
|
+
import { networkRegistry as ct } from "../../constants/chains.constants.mjs";
|
|
14
|
+
import { PublicKey as a } from "@solana/web3.js";
|
|
15
|
+
import { getSwapperAccountPublicKey as pt, getStorageAccountPublicKey as mt, getStorageVaultPublicKey as ut } from "../../functions/pre-transaction/solana.mjs";
|
|
16
|
+
import { constructSolanaZkProof as lt } from "../../functions/snarkjs/constructSolanaZkProof.mjs";
|
|
17
|
+
import { Utxo as dt } from "../utxo/Utxo.mjs";
|
|
18
|
+
import { getAmountInToken as gt, getAmountInWei as At, randomBigInt as ft } from "../../functions/web3/etherFunctions.mjs";
|
|
19
|
+
import { convertOKXToHinkalInstructions as yt } from "../../functions/pre-transaction/convert-okx-instructions.mjs";
|
|
20
|
+
import { solanaTransactCallRelayer as St } from "../../functions/web3/functionCalls/transactCallRelayer.mjs";
|
|
21
|
+
import { transactionErrorCodes as wt } from "../../error-handling/error-codes.constants.mjs";
|
|
22
|
+
import { shouldPatchAccessTokenMerkleTree as Tt } from "../../functions/pre-transaction/shouldPatchAccessTokenMerkleTree.mjs";
|
|
23
|
+
import { __exports as It } from "../../_virtual/utils.mjs";
|
|
24
|
+
const qt = async (e, o, r, k, x, E, K, R = !1) => {
|
|
25
|
+
if (R)
|
|
26
|
+
throw new Error("onlyGasEstimate is not supported for Solana swap");
|
|
27
|
+
const i = e.getCurrentChainId(), f = new a(A), { hinkalAddress: h, originalDeployer: c, hinkalIdl: y } = ct[i].contractData;
|
|
28
|
+
if (!c || !y)
|
|
29
|
+
throw new Error("No IDL configured for Solana program on this network");
|
|
30
|
+
const p = new a(c), m = new a(h), n = o.map((t) => t.erc20TokenAddress), { userKeys: S, merkleTreeAccessToken: v, merkleTreeHinkal: F } = e, N = e.getSolanaProgram(y), s = K ?? await at(i, E, n, et.Transact), { patchAccessTokenMerkleTree: D, kycRequired: O, hasAccessToken: U } = await Tt(
|
|
31
|
+
e,
|
|
32
|
+
n,
|
|
33
|
+
r
|
|
34
|
+
);
|
|
35
|
+
r[1] -= s.flatFee;
|
|
36
|
+
const L = s.variableRate.toString(), _ = Number(e.cacheDevice.get(rt.SLIPPAGE_PERCENTAGE) ?? 0), u = o[1], B = gt(u, r[1]), C = Number(B) * _ / 100;
|
|
37
|
+
r[1] -= At(u, C.toFixed(u.decimals));
|
|
38
|
+
const l = [...await ot(e, n, r, 6)], V = st().toString(), G = e.userKeys.getShieldedPrivateKey(), d = [];
|
|
39
|
+
for (let t = 0; t < n.length; t += 1) {
|
|
40
|
+
const { outputUtxos: tt } = nt(
|
|
41
|
+
e.userKeys,
|
|
42
|
+
l[t],
|
|
43
|
+
r[t],
|
|
44
|
+
V,
|
|
45
|
+
void 0,
|
|
46
|
+
!1
|
|
47
|
+
);
|
|
48
|
+
d.push([tt[0]]);
|
|
49
|
+
}
|
|
50
|
+
const W = dt.findCorrectRandomization(ft(31), G), w = {
|
|
51
|
+
tokenNumber: 2,
|
|
52
|
+
nullifierAmount: l[0].length,
|
|
53
|
+
outputAmount: 1
|
|
54
|
+
}, z = [!1, !0].slice(0, r.length), g = await e.getRandomRelay(!0);
|
|
55
|
+
if (!g)
|
|
56
|
+
throw Error(wt.RELAYER_NOT_AVAILABLE);
|
|
57
|
+
const T = it(d, !1).map((t) => [...It.arrayify(t[0])]), I = pt(m, p), { remainingAccounts: P, hinkalInstructions: b } = yt(k, I), { proofAArr: H, proofBArr: M, proofCArr: q, publicInputsArr: X } = await lt(
|
|
58
|
+
e.generateProofRemotely,
|
|
59
|
+
c,
|
|
60
|
+
F,
|
|
61
|
+
v,
|
|
62
|
+
S,
|
|
63
|
+
N,
|
|
64
|
+
n,
|
|
65
|
+
l,
|
|
66
|
+
d,
|
|
67
|
+
W,
|
|
68
|
+
s.flatFee,
|
|
69
|
+
s.variableRate,
|
|
70
|
+
f.toString(),
|
|
71
|
+
g,
|
|
72
|
+
w,
|
|
73
|
+
T,
|
|
74
|
+
i,
|
|
75
|
+
D,
|
|
76
|
+
z,
|
|
77
|
+
b,
|
|
78
|
+
P
|
|
79
|
+
), Y = mt(m, p), Z = ut(m, p), j = o[0].erc20TokenAddress !== A ? new a(o[0].erc20TokenAddress) : null, J = o[1].erc20TokenAddress !== A ? new a(o[1].erc20TokenAddress) : null, Q = {
|
|
80
|
+
recipient: f.toString(),
|
|
81
|
+
storageAccount: Y.toString(),
|
|
82
|
+
storageVault: Z.toString(),
|
|
83
|
+
swapperAccount: I.toString(),
|
|
84
|
+
mintFrom: j?.toString() ?? null,
|
|
85
|
+
mintTo: J?.toString() ?? null,
|
|
86
|
+
remainingAccounts: P.map((t) => ({
|
|
87
|
+
pubkey: t.pubkey.toString(),
|
|
88
|
+
isSigner: t.isSigner,
|
|
89
|
+
isWritable: t.isWritable
|
|
90
|
+
})),
|
|
91
|
+
addressLookupTableAccount: x
|
|
92
|
+
}, $ = {
|
|
93
|
+
encryptedOutputs: T,
|
|
94
|
+
proofAArr: H,
|
|
95
|
+
proofBArr: M,
|
|
96
|
+
proofCArr: q,
|
|
97
|
+
publicInputsArr: X,
|
|
98
|
+
relayerFee: s.flatFee.toString(),
|
|
99
|
+
variableRate: L,
|
|
100
|
+
dimensions: w,
|
|
101
|
+
hinkalInstructions: b.map((t) => ({
|
|
102
|
+
accountIndexes: [...t.accountIndexes],
|
|
103
|
+
data: [...t.data],
|
|
104
|
+
programIndex: t.programIndex
|
|
105
|
+
}))
|
|
106
|
+
};
|
|
107
|
+
return St(i, {
|
|
108
|
+
relayAddress: g,
|
|
109
|
+
functionName: "swap",
|
|
110
|
+
args: $,
|
|
111
|
+
accounts: Q,
|
|
112
|
+
solanaAccessTokenData: !U && O ? {
|
|
113
|
+
ethereumAddress: await e.getEthereumAddress(),
|
|
114
|
+
accessKey: S.getAccessKey()
|
|
115
|
+
} : void 0
|
|
116
|
+
});
|
|
117
|
+
};
|
|
118
|
+
export {
|
|
119
|
+
qt as hinkalSolanaSwap
|
|
120
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../../types/circom-data.types.cjs");const z=require("../../types/external-action.types.cjs"),c=require("../../constants/protocol.constants.cjs");require("../../types/transactions.types.cjs");require("../../types/activities.types.cjs");const D=require("../../functions/web3/events/getShieldedBalance.cjs"),M=require("../../functions/pre-transaction/outputUtxoProcessing.cjs"),j=require("../../functions/utils/time.utils.cjs"),u=require("../../error-handling/error-codes.constants.cjs"),H=require("../../functions/pre-transaction/getFeeStructure.cjs");require("../../node_modules/ethers/lib/utils.cjs");const Z=require("../../functions/snarkjs/common.snarkjs.cjs"),Y=require("../../functions/snarkjs/constructSolanaZkProof.cjs"),q=require("../utxo/Utxo.cjs"),G=require("../../functions/web3/etherFunctions.cjs"),J=require("../../functions/web3/functionCalls/transactCallRelayer.cjs"),Q=require("../../functions/utils/addresses.cjs"),W=require("../../constants/chains.constants.cjs"),X=require("../../_virtual/utils.cjs"),$=async(e,I,t,d,R,S,l=!1)=>{if(l)throw new Error("onlyGasEstimate is not supported for Solana transfer");if(!Q.isValidPrivateAddress(d))throw Error(u.transactionErrorCodes.RECIPIENT_FORMAT_INCORRECT);const n=e.getCurrentChainId(),{originalDeployer:p,hinkalIdl:A}=W.networkRegistry[n].contractData;if(!p||!A)throw new Error("missing data");const{userKeys:_,merkleTreeAccessToken:w,merkleTreeHinkal:x}=e,r=I.map(i=>i.erc20TokenAddress);if(r.length>1)throw new Error("Solana Transfer: Only one mint address is supported");const N=S??await H.getFeeStructure(n,R,r,z.ExternalActionId.Transact),a=-t[0]*(10000n-c.HINKAL_PRIVATE_SEND_VARIABLE_RATE)/10000n;if(t[0]-=N.flatFee,a<=0n)throw Error(u.transactionErrorCodes.RECIPIENT_AMOUNT_INVALID);const m=-t[0]-a,o=(await D.addPaddingToUtxos(e,r,t,6))[0],y=j.getCurrentTimeInSeconds().toString(),{outputUtxos:P}=M.outputUtxoProcessing(e.userKeys,o,t[0],y,void 0,!1),f=P[0],[C,O,U]=d.split(","),g=new q.Utxo({amount:a,erc20TokenAddress:o[0].erc20TokenAddress,mintAddress:o[0].mintAddress,timeStamp:y,randomization:BigInt(C),stealthAddress:O,encryptionKey:U}),s=await e.getRandomRelay(!l);if(!s)throw Error(u.transactionErrorCodes.RELAYER_NOT_AVAILABLE);const h=q.Utxo.findCorrectRandomization(G.randomBigInt(31),e.userKeys.getShieldedPrivateKey()),E={tokenNumber:r.length,nullifierAmount:o.length,outputAmount:2},k=e.getSolanaProgram(A),T=Z.calcEncryptedOutputs([[f,g]],!1)[0].map(i=>Array.from(X.__exports.arrayify(i))),{proofAArr:v,proofBArr:B,proofCArr:F,publicInputsArr:K}=await Y.constructSolanaZkProof(e.generateProofRemotely,p,x,w,_,k,[r[0]],[o],[[f,g]],h,m,0n,c.solanaNativeAddress,s,E,T,n),L=r[0]===c.solanaNativeAddress,V={recipient:s,mint:L?void 0:r[0]},b={proofAArr:v,proofBArr:B,proofCArr:F,publicInputsArr:K,encryptedOutputs:T,relayerFee:m.toString(),dimensions:E};return J.solanaTransactCallRelayer(n,{relayAddress:s,functionName:"transfer",args:b,accounts:V})};exports.hinkalSolanaTransfer=$;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ERC20Token, FeeStructure } from '../../types';
|
|
2
|
+
import { IHinkal } from './IHinkal';
|
|
3
|
+
export declare const hinkalSolanaTransfer: (hinkal: IHinkal, erc20Tokens: ERC20Token[], amountChanges: bigint[], recipientAddress: string, feeToken?: string, feeStructureOverride?: FeeStructure, onlyGasEstimate?: boolean) => Promise<import('../../types/relayer.types').RelayerTransaction>;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import "../../types/circom-data.types.mjs";
|
|
2
|
+
import { ExternalActionId as b } from "../../types/external-action.types.mjs";
|
|
3
|
+
import { solanaNativeAddress as g, HINKAL_PRIVATE_SEND_VARIABLE_RATE as H } from "../../constants/protocol.constants.mjs";
|
|
4
|
+
import "../../types/transactions.types.mjs";
|
|
5
|
+
import "../../types/activities.types.mjs";
|
|
6
|
+
import { addPaddingToUtxos as M } from "../../functions/web3/events/getShieldedBalance.mjs";
|
|
7
|
+
import { outputUtxoProcessing as Y } from "../../functions/pre-transaction/outputUtxoProcessing.mjs";
|
|
8
|
+
import { getCurrentTimeInSeconds as Z } from "../../functions/utils/time.utils.mjs";
|
|
9
|
+
import { transactionErrorCodes as m } from "../../error-handling/error-codes.constants.mjs";
|
|
10
|
+
import { getFeeStructure as j } from "../../functions/pre-transaction/getFeeStructure.mjs";
|
|
11
|
+
import "../../node_modules/ethers/lib/utils.mjs";
|
|
12
|
+
import { calcEncryptedOutputs as q } from "../../functions/snarkjs/common.snarkjs.mjs";
|
|
13
|
+
import { constructSolanaZkProof as G } from "../../functions/snarkjs/constructSolanaZkProof.mjs";
|
|
14
|
+
import { Utxo as I } from "../utxo/Utxo.mjs";
|
|
15
|
+
import { randomBigInt as J } from "../../functions/web3/etherFunctions.mjs";
|
|
16
|
+
import { solanaTransactCallRelayer as Q } from "../../functions/web3/functionCalls/transactCallRelayer.mjs";
|
|
17
|
+
import { isValidPrivateAddress as W } from "../../functions/utils/addresses.mjs";
|
|
18
|
+
import { networkRegistry as X } from "../../constants/chains.constants.mjs";
|
|
19
|
+
import { __exports as $ } from "../../_virtual/utils.mjs";
|
|
20
|
+
const Rr = async (r, R, o, c, w, S, d = !1) => {
|
|
21
|
+
if (d)
|
|
22
|
+
throw new Error("onlyGasEstimate is not supported for Solana transfer");
|
|
23
|
+
if (!W(c))
|
|
24
|
+
throw Error(m.RECIPIENT_FORMAT_INCORRECT);
|
|
25
|
+
const n = r.getCurrentChainId(), { originalDeployer: p, hinkalIdl: f } = X[n].contractData;
|
|
26
|
+
if (!p || !f)
|
|
27
|
+
throw new Error("missing data");
|
|
28
|
+
const { userKeys: x, merkleTreeAccessToken: N, merkleTreeHinkal: _ } = r, t = R.map((a) => a.erc20TokenAddress);
|
|
29
|
+
if (t.length > 1)
|
|
30
|
+
throw new Error("Solana Transfer: Only one mint address is supported");
|
|
31
|
+
const O = S ?? await j(n, w, t, b.Transact), i = -o[0] * (10000n - H) / 10000n;
|
|
32
|
+
if (o[0] -= O.flatFee, i <= 0n)
|
|
33
|
+
throw Error(m.RECIPIENT_AMOUNT_INVALID);
|
|
34
|
+
const u = -o[0] - i, e = (await M(r, t, o, 6))[0], l = Z().toString(), { outputUtxos: P } = Y(
|
|
35
|
+
r.userKeys,
|
|
36
|
+
e,
|
|
37
|
+
o[0],
|
|
38
|
+
l,
|
|
39
|
+
void 0,
|
|
40
|
+
!1
|
|
41
|
+
), A = P[0], [U, C, v] = c.split(","), y = new I({
|
|
42
|
+
amount: i,
|
|
43
|
+
erc20TokenAddress: e[0].erc20TokenAddress,
|
|
44
|
+
mintAddress: e[0].mintAddress,
|
|
45
|
+
timeStamp: l,
|
|
46
|
+
randomization: BigInt(U),
|
|
47
|
+
stealthAddress: C,
|
|
48
|
+
encryptionKey: v
|
|
49
|
+
}), s = await r.getRandomRelay(!d);
|
|
50
|
+
if (!s)
|
|
51
|
+
throw Error(m.RELAYER_NOT_AVAILABLE);
|
|
52
|
+
const B = I.findCorrectRandomization(J(31), r.userKeys.getShieldedPrivateKey()), E = {
|
|
53
|
+
tokenNumber: t.length,
|
|
54
|
+
nullifierAmount: e.length,
|
|
55
|
+
outputAmount: 2
|
|
56
|
+
}, K = r.getSolanaProgram(f), T = q([[A, y]], !1)[0].map((a) => Array.from($.arrayify(a))), { proofAArr: L, proofBArr: h, proofCArr: k, publicInputsArr: F } = await G(
|
|
57
|
+
r.generateProofRemotely,
|
|
58
|
+
p,
|
|
59
|
+
_,
|
|
60
|
+
N,
|
|
61
|
+
x,
|
|
62
|
+
K,
|
|
63
|
+
[t[0]],
|
|
64
|
+
[e],
|
|
65
|
+
[[A, y]],
|
|
66
|
+
B,
|
|
67
|
+
u,
|
|
68
|
+
0n,
|
|
69
|
+
g,
|
|
70
|
+
s,
|
|
71
|
+
E,
|
|
72
|
+
T,
|
|
73
|
+
n
|
|
74
|
+
), V = t[0] === g, z = {
|
|
75
|
+
recipient: s,
|
|
76
|
+
mint: V ? void 0 : t[0]
|
|
77
|
+
}, D = {
|
|
78
|
+
proofAArr: L,
|
|
79
|
+
proofBArr: h,
|
|
80
|
+
proofCArr: k,
|
|
81
|
+
publicInputsArr: F,
|
|
82
|
+
encryptedOutputs: T,
|
|
83
|
+
relayerFee: u.toString(),
|
|
84
|
+
dimensions: E
|
|
85
|
+
};
|
|
86
|
+
return Q(n, { relayAddress: s, functionName: "transfer", args: D, accounts: z });
|
|
87
|
+
};
|
|
88
|
+
export {
|
|
89
|
+
Rr as hinkalSolanaTransfer
|
|
90
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../../types/circom-data.types.cjs");const C=require("../../types/external-action.types.cjs"),K=require("../../constants/protocol.constants.cjs");require("../../types/transactions.types.cjs");require("../../types/activities.types.cjs");const b=require("../../functions/web3/events/getShieldedBalance.cjs"),B=require("../../functions/pre-transaction/outputUtxoProcessing.cjs"),N=require("../../functions/utils/time.utils.cjs"),M=require("../../error-handling/error-codes.constants.cjs"),D=require("../../functions/pre-transaction/getFeeStructure.cjs");require("../../node_modules/ethers/lib/utils.cjs");const L=require("../../functions/snarkjs/common.snarkjs.cjs"),W=require("../../functions/snarkjs/constructSolanaZkProof.cjs"),j=require("../utxo/Utxo.cjs"),z=require("../../functions/web3/etherFunctions.cjs"),Z=require("../../functions/web3/functionCalls/transactCallRelayer.cjs");require("../../constants/token-data/index.cjs");const H=require("../../constants/chains.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 V=require("../../functions/pre-transaction/shouldPatchAccessTokenMerkleTree.cjs"),Y=require("../../_virtual/utils.cjs"),G=async(e,r,t,i,g,f,u=!1)=>{if(u)throw new Error("onlyGasEstimate is not supported for Solana withdraw");const o=e.getCurrentChainId(),w=await e.getEthereumAddress(),{originalDeployer:l,hinkalIdl:d}=H.networkRegistry[o].contractData;if(!l||!d)throw new Error("missing data");const{userKeys:q,merkleTreeAccessToken:S,merkleTreeHinkal:h}=e,n=f??await D.getFeeStructure(o,g,r,C.ExternalActionId.Transact);t[0]-=n.flatFee;const{patchAccessTokenMerkleTree:m,kycRequired:A,hasAccessToken:T}=await V.shouldPatchAccessTokenMerkleTree(e,r,t);if(r.length>1)throw new Error("Solana Withdraw: Only one mint address is supported");const a=[...await b.addPaddingToUtxos(e,r,t,6)][0],k=N.getCurrentTimeInSeconds().toString(),{outputUtxos:s}=B.outputUtxoProcessing(e.userKeys,a,t[0],k,void 0,!1),c=await e.getRandomRelay(!u);if(!c)throw Error(M.transactionErrorCodes.RELAYER_NOT_AVAILABLE);const R=j.Utxo.findCorrectRandomization(z.randomBigInt(31),e.userKeys.getShieldedPrivateKey()),p={tokenNumber:r.length,nullifierAmount:a.length,outputAmount:s.length},x=e.getSolanaProgram(d),E=L.calcEncryptedOutputs([s],!1)[0][0],y=Array.from(Y.__exports.arrayify(E)),{proofAArr:P,proofBArr:_,proofCArr:v,publicInputsArr:I}=await W.constructSolanaZkProof(e.generateProofRemotely,l,h,S,q,x,[r[0]],[a],[s],R,n.flatFee,n.variableRate,i,c,p,[y],o,m),F=r[0]===K.solanaNativeAddress,O={recipient:i,mint:F?void 0:r[0]},U={proofAArr:P,proofBArr:_,proofCArr:v,publicInputsArr:I,encryptedOutputs:[y],relayerFee:n.flatFee.toString(),dimensions:p};return Z.solanaTransactCallRelayer(o,{relayAddress:c,functionName:"transact",args:U,accounts:O,solanaAccessTokenData:!T&&A?{ethereumAddress:w,accessKey:q.getAccessKey()}:void 0})};exports.hinkalSolanaWithdraw=G;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { FeeStructure } from '../../types';
|
|
2
|
+
import { IHinkal } from './IHinkal';
|
|
3
|
+
export declare const hinkalSolanaWithdraw: (hinkal: IHinkal, mintAddresses: string[], amountChanges: bigint[], recipientAddress: string, feeToken?: string, feeStructureOverride?: FeeStructure, onlyGasEstimate?: boolean) => Promise<import('../../types/relayer.types').RelayerTransaction>;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import "../../types/circom-data.types.mjs";
|
|
2
|
+
import { ExternalActionId as B } from "../../types/external-action.types.mjs";
|
|
3
|
+
import { solanaNativeAddress as C } from "../../constants/protocol.constants.mjs";
|
|
4
|
+
import "../../types/transactions.types.mjs";
|
|
5
|
+
import "../../types/activities.types.mjs";
|
|
6
|
+
import { addPaddingToUtxos as _ } from "../../functions/web3/events/getShieldedBalance.mjs";
|
|
7
|
+
import { outputUtxoProcessing as b } from "../../functions/pre-transaction/outputUtxoProcessing.mjs";
|
|
8
|
+
import { getCurrentTimeInSeconds as D } from "../../functions/utils/time.utils.mjs";
|
|
9
|
+
import { transactionErrorCodes as L } from "../../error-handling/error-codes.constants.mjs";
|
|
10
|
+
import { getFeeStructure as z } from "../../functions/pre-transaction/getFeeStructure.mjs";
|
|
11
|
+
import "../../node_modules/ethers/lib/utils.mjs";
|
|
12
|
+
import { calcEncryptedOutputs as M } from "../../functions/snarkjs/common.snarkjs.mjs";
|
|
13
|
+
import { constructSolanaZkProof as W } from "../../functions/snarkjs/constructSolanaZkProof.mjs";
|
|
14
|
+
import { Utxo as q } from "../utxo/Utxo.mjs";
|
|
15
|
+
import { randomBigInt as H } from "../../functions/web3/etherFunctions.mjs";
|
|
16
|
+
import { solanaTransactCallRelayer as V } from "../../functions/web3/functionCalls/transactCallRelayer.mjs";
|
|
17
|
+
import "../../constants/token-data/index.mjs";
|
|
18
|
+
import { networkRegistry as Y } from "../../constants/chains.constants.mjs";
|
|
19
|
+
import "../../constants/contracts.constants.mjs";
|
|
20
|
+
import "../../constants/kyc.constants.mjs";
|
|
21
|
+
import "../../constants/server.constants.mjs";
|
|
22
|
+
import "../../constants/vite.constants.mjs";
|
|
23
|
+
import "../../constants/coingecko.constants.mjs";
|
|
24
|
+
import "../../constants/reorg-depths.constants.mjs";
|
|
25
|
+
import "../../constants/addresses.constants.mjs";
|
|
26
|
+
import "../../constants/token.limits.constants.mjs";
|
|
27
|
+
import "../../constants/presale.constants.mjs";
|
|
28
|
+
import "../../constants/activity.constants.mjs";
|
|
29
|
+
import "../../constants/tasks.constants.mjs";
|
|
30
|
+
import "../../constants/events.constants.mjs";
|
|
31
|
+
import { shouldPatchAccessTokenMerkleTree as Z } from "../../functions/pre-transaction/shouldPatchAccessTokenMerkleTree.mjs";
|
|
32
|
+
import { __exports as j } from "../../_virtual/utils.mjs";
|
|
33
|
+
const vt = async (t, r, o, c, y, g, m = !1) => {
|
|
34
|
+
if (m)
|
|
35
|
+
throw new Error("onlyGasEstimate is not supported for Solana withdraw");
|
|
36
|
+
const e = t.getCurrentChainId(), w = await t.getEthereumAddress(), { originalDeployer: p, hinkalIdl: u } = Y[e].contractData;
|
|
37
|
+
if (!p || !u)
|
|
38
|
+
throw new Error("missing data");
|
|
39
|
+
const { userKeys: f, merkleTreeAccessToken: A, merkleTreeHinkal: T } = t, a = g ?? await z(e, y, r, B.Transact);
|
|
40
|
+
o[0] -= a.flatFee;
|
|
41
|
+
const { patchAccessTokenMerkleTree: S, kycRequired: E, hasAccessToken: R } = await Z(
|
|
42
|
+
t,
|
|
43
|
+
r,
|
|
44
|
+
o
|
|
45
|
+
);
|
|
46
|
+
if (r.length > 1)
|
|
47
|
+
throw new Error("Solana Withdraw: Only one mint address is supported");
|
|
48
|
+
const i = [...await _(t, r, o, 6)][0], h = D().toString(), { outputUtxos: n } = b(
|
|
49
|
+
t.userKeys,
|
|
50
|
+
i,
|
|
51
|
+
o[0],
|
|
52
|
+
h,
|
|
53
|
+
void 0,
|
|
54
|
+
!1
|
|
55
|
+
), s = await t.getRandomRelay(!m);
|
|
56
|
+
if (!s)
|
|
57
|
+
throw Error(L.RELAYER_NOT_AVAILABLE);
|
|
58
|
+
const x = q.findCorrectRandomization(H(31), t.userKeys.getShieldedPrivateKey()), l = {
|
|
59
|
+
tokenNumber: r.length,
|
|
60
|
+
nullifierAmount: i.length,
|
|
61
|
+
outputAmount: n.length
|
|
62
|
+
}, I = t.getSolanaProgram(u), k = M([n], !1)[0][0], d = Array.from(j.arrayify(k)), { proofAArr: v, proofBArr: P, proofCArr: K, publicInputsArr: O } = await W(
|
|
63
|
+
t.generateProofRemotely,
|
|
64
|
+
p,
|
|
65
|
+
T,
|
|
66
|
+
A,
|
|
67
|
+
f,
|
|
68
|
+
I,
|
|
69
|
+
[r[0]],
|
|
70
|
+
[i],
|
|
71
|
+
[n],
|
|
72
|
+
x,
|
|
73
|
+
a.flatFee,
|
|
74
|
+
a.variableRate,
|
|
75
|
+
c,
|
|
76
|
+
s,
|
|
77
|
+
l,
|
|
78
|
+
[d],
|
|
79
|
+
e,
|
|
80
|
+
S
|
|
81
|
+
), F = r[0] === C, N = {
|
|
82
|
+
recipient: c,
|
|
83
|
+
mint: F ? void 0 : r[0]
|
|
84
|
+
}, U = {
|
|
85
|
+
proofAArr: v,
|
|
86
|
+
proofBArr: P,
|
|
87
|
+
proofCArr: K,
|
|
88
|
+
publicInputsArr: O,
|
|
89
|
+
encryptedOutputs: [d],
|
|
90
|
+
relayerFee: a.flatFee.toString(),
|
|
91
|
+
dimensions: l
|
|
92
|
+
};
|
|
93
|
+
return V(e, {
|
|
94
|
+
relayAddress: s,
|
|
95
|
+
functionName: "transact",
|
|
96
|
+
args: U,
|
|
97
|
+
accounts: N,
|
|
98
|
+
solanaAccessTokenData: !R && E ? {
|
|
99
|
+
ethereumAddress: w,
|
|
100
|
+
accessKey: f.getAccessKey()
|
|
101
|
+
} : void 0
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
export {
|
|
105
|
+
vt as hinkalSolanaWithdraw
|
|
106
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const F=require("../../error-handling/error-codes.constants.cjs"),L=require("../../functions/pre-transaction/outputUtxoProcessing.cjs"),M=require("../../functions/snarkjs/constructGeneralZkProof.cjs"),H=require("../../functions/web3/events/getShieldedBalance.cjs"),K=require("../../functions/web3/functionCalls/estimateGasRelayer.cjs"),N=require("../../functions/web3/functionCalls/transactCallRelayer.cjs"),W=require("../../functions/pre-transaction/getFeeStructure.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const F=require("../../error-handling/error-codes.constants.cjs"),L=require("../../functions/pre-transaction/outputUtxoProcessing.cjs"),M=require("../../functions/snarkjs/constructGeneralZkProof.cjs"),H=require("../../functions/web3/events/getShieldedBalance.cjs"),K=require("../../functions/web3/functionCalls/estimateGasRelayer.cjs"),N=require("../../functions/web3/functionCalls/transactCallRelayer.cjs"),W=require("../../functions/pre-transaction/getFeeStructure.cjs"),B=require("../../functions/pre-transaction/merge-with-fee-structure.cjs"),b=require("../../types/external-action.types.cjs"),k=require("../../types/hinkal.types.cjs"),G=require("../../functions/pre-transaction/outputApprovalDataProcessing.cjs"),O=require("../../types/ethereum-network.types.cjs"),V=require("../../functions/pre-transaction/shouldPatchAccessTokenMerkleTree.cjs"),Z=require("../../functions/pre-transaction/getSignatureDataForTransact.cjs"),$=require("../../functions/pre-transaction/getExternalSwapAddress.cjs"),j=require("../../functions/utils/time.utils.cjs"),z=require("../../constants/protocol.constants.cjs");require("../../types/circom-data.types.cjs");require("../../types/transactions.types.cjs");require("../../types/activities.types.cjs");require("../../constants/server.constants.cjs");require("../../constants/chains.constants.cjs");require("../../constants/vite.constants.cjs");require("../http/HttpClient.cjs");require("axios");require("ethers");require("../../constants/token-data/index.cjs");require("../../API/getServerURL.cjs");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("process");require("buffer");require("../../constants/save-depths.cjs");require("../../constants/reorg-depths.constants.cjs");require("../../functions/utils/mutexes.utils.cjs");require("@coral-xyz/anchor");require("@solana/web3.js");require("../crypto-keys/keys.cjs");const Y=require("../../functions/pre-transaction/constructAdminData.cjs");require("@solana/spl-token");const J=async(e,c,t,i,x,T,S,m,u=!1,w=!1)=>{const s=c.map(r=>r.erc20TokenAddress),d=await e.getEthereumAddress(),g=S??await W.getFeeStructure(e.getCurrentChainId(),T,s,b.ExternalActionId.Transact,void 0,z.HINKAL_SWAP_VARIABLE_RATE);B.mergeWithFeeStructure(e.getCurrentChainId(),s,t,g);const f=$.getExternalSwapAddress(e,i),o={externalActionId:i,externalAddress:f,externalActionMetadata:x},a=[...await H.addPaddingToUtxos(e,s,t)],v=`swapperM${t.length.toString()}x${a[0].length}x1`,D=[!1,!0,!1].slice(0,t.length),q=[],n=k.defaultHinkalLogicArgs(t.length,e.userKeys),R=j.getCurrentTimeInSeconds().toString();for(let r=0;r<s.length;r+=1){const{outputUtxos:U}=L.outputUtxoProcessing(e.userKeys,a[r],t[r],R,void 0,!1);q.push(U);const{useApprovalUtxoData:y}=G.outputApprovalDataProcessing(e,a[r],t[r]);y&&(n.useApprovalUtxoData[r]=y,n.doPreTxApproval=!0)}const l=await e.getRandomRelay(!u);if(!l)throw Error(F.transactionErrorCodes.RELAYER_NOT_AVAILABLE);const{patchAccessTokenMerkleTree:P,kycRequired:h,hasAccessToken:E}=await V.shouldPatchAccessTokenMerkleTree(e,s,t),I=await Z.getSignatureDataForTransact(e.getCurrentChainId(),d,e.userKeys,h,E),{zkCallData:p,circomData:A,dimData:C}=await M.constructZkProof("v1x1",e.merkleTreeHinkal,e.merkleTreeAccessToken,a,q,e.userKeys,v,o.externalActionId,o.externalAddress,o.externalActionMetadata,e.generateProofRemotely,l,e.getCurrentChainId(),D,void 0,void 0,void 0,P,n,void 0,g,e.getContractWithFetcher(O.ContractType.HinkalHelperContract),I);if(u)return await K.estimateGasRelayer(e,p,C,A);const _=Y.constructAdminData(m,e.getCurrentChainId(),s,t,d,c);return await N.transactCallRelayer(e.getCurrentChainId(),p,C,A,w,void 0,void 0,_)};exports.hinkalSwap=J;
|