@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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sabaaa1/common",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.14",
|
|
4
4
|
"homepage": "hinkal.pro",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Hinkal Protocol"
|
|
@@ -49,38 +49,34 @@
|
|
|
49
49
|
"nx": "18.2.1",
|
|
50
50
|
"vite": "5.1.6",
|
|
51
51
|
"vite-plugin-dts": "3.7.3",
|
|
52
|
-
"vite-tsconfig-paths": "^4.3.2"
|
|
52
|
+
"vite-tsconfig-paths": "^4.3.2",
|
|
53
|
+
"@types/crypto-js": "^4.2.2"
|
|
53
54
|
},
|
|
54
55
|
"dependencies": {
|
|
55
|
-
"@
|
|
56
|
-
"@
|
|
57
|
-
"@ethersproject/providers": "^5.4.7",
|
|
58
|
-
"@hazae41/base64url": "1.0.17",
|
|
59
|
-
"@hazae41/binary": "1.3.5",
|
|
60
|
-
"@hazae41/bitwise.wasm": "1.0.6",
|
|
61
|
-
"@hazae41/cascade": "2.2.2",
|
|
62
|
-
"@hazae41/chacha20poly1305": "1.0.8",
|
|
63
|
-
"@hazae41/ed25519": "2.1.22",
|
|
64
|
-
"@hazae41/fleche": "1.4.5",
|
|
65
|
-
"@hazae41/sha1": "1.1.14",
|
|
66
|
-
"@hazae41/x25519": "2.2.9",
|
|
56
|
+
"@coral-xyz/anchor": "^0.31.0",
|
|
57
|
+
"@solana/spl-token": "^0.4.14",
|
|
67
58
|
"axios": "^1.6.8",
|
|
59
|
+
"axios-retry": "^4.5.0",
|
|
68
60
|
"async-mutex": "^0.4.0",
|
|
61
|
+
"bs58": "^6.0.0",
|
|
69
62
|
"buffer": "6.0.3",
|
|
70
63
|
"circomlibjs-hinkal-fork": "^0.0.3",
|
|
64
|
+
"crypto-js": "^4.2.0",
|
|
71
65
|
"dotenv": "^16.4.5",
|
|
72
66
|
"ethers-v6h": "npm:ethers@^6.15.0",
|
|
73
67
|
"idb-keyval": "6.2.1",
|
|
74
68
|
"multiformats": "^9.4.2",
|
|
75
69
|
"snarkjs": "0.7.5",
|
|
76
70
|
"libsodium-wrappers": "^0.7.10",
|
|
71
|
+
"tweetnacl": "^1.0.3",
|
|
77
72
|
"process": "0.11.10",
|
|
78
73
|
"ua-parser-js": "^1.0.37",
|
|
79
74
|
"uuid": "^9.0.1",
|
|
80
75
|
"node-forge": "^1.3.1",
|
|
81
76
|
"vite-plugin-virtual": "^0.3.0",
|
|
82
77
|
"@zkmelabs/widget": "^0.1.2",
|
|
83
|
-
"@openzeppelin/contracts": "^4.8.0"
|
|
78
|
+
"@openzeppelin/contracts": "^4.8.0",
|
|
79
|
+
"@solana/web3.js": "^1.98.4"
|
|
84
80
|
},
|
|
85
81
|
"peerDependencies": {
|
|
86
82
|
"wagmi": "2.13.3",
|
|
@@ -95,4 +91,4 @@
|
|
|
95
91
|
"optional": true
|
|
96
92
|
}
|
|
97
93
|
}
|
|
98
|
-
}
|
|
94
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../data-structures/http/HttpClient.cjs"),s=require("../error-handling/logger.cjs");class i{rpcUrl;nextId=1;constructor(t){this.rpcUrl=t}async request(t){const e={jsonrpc:"2.0",id:this.nextId,method:t.method,params:t.params||[]};this.nextId+=1;try{const r=await o.httpClient.post(this.rpcUrl,e);if(r.error)throw new Error(r.error.message||"RPC Error");return r.result}catch(r){throw s.Logger.error("CustomEthersProvider RPC error:",r),r}}}exports.CustomEthersProvider=i;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare class
|
|
1
|
+
import { ethers } from 'ethers';
|
|
2
|
+
export declare class CustomEthersProvider implements ethers.providers.ExternalProvider {
|
|
3
3
|
private rpcUrl;
|
|
4
4
|
private nextId;
|
|
5
5
|
constructor(rpcUrl: string);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { httpClient as e } from "../data-structures/http/HttpClient.mjs";
|
|
2
|
+
import { Logger as s } from "../error-handling/logger.mjs";
|
|
3
|
+
class h {
|
|
4
|
+
rpcUrl;
|
|
5
|
+
nextId = 1;
|
|
6
|
+
constructor(t) {
|
|
7
|
+
this.rpcUrl = t;
|
|
8
|
+
}
|
|
9
|
+
async request(t) {
|
|
10
|
+
const o = {
|
|
11
|
+
jsonrpc: "2.0",
|
|
12
|
+
id: this.nextId,
|
|
13
|
+
method: t.method,
|
|
14
|
+
params: t.params || []
|
|
15
|
+
};
|
|
16
|
+
this.nextId += 1;
|
|
17
|
+
try {
|
|
18
|
+
const r = await e.post(this.rpcUrl, o);
|
|
19
|
+
if (r.error)
|
|
20
|
+
throw new Error(r.error.message || "RPC Error");
|
|
21
|
+
return r.result;
|
|
22
|
+
} catch (r) {
|
|
23
|
+
throw s.error("CustomEthersProvider RPC error:", r), r;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
h as CustomEthersProvider
|
|
29
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("@solana/web3.js"),u=require("../data-structures/http/HttpClient.cjs"),y=require("../error-handling/logger.cjs");class g extends i.Connection{constructor(a,r="confirmed"){const l={...typeof r=="object"?r:{},fetch:async(o,s)=>{let t;typeof o=="string"?t=o:o instanceof URL?t=o.toString():t=o.url;const n=typeof s?.body=="string"?s.body:null,c=n?JSON.parse(n):{};try{const e=await u.httpClient.post(t,c);if(e.error)throw new Error(e.error.message||"RPC Error");return new Response(JSON.stringify(e),{status:200,statusText:"OK",headers:{"Content-Type":"application/json"}})}catch(e){throw y.Logger.error(`Solana RPC Error [${c.method}]:`,e),e}}};super(a,l)}}exports.CustomSolanaConnection=g;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Connection as i } from "@solana/web3.js";
|
|
2
|
+
import { httpClient as l } from "../data-structures/http/HttpClient.mjs";
|
|
3
|
+
import { Logger as p } from "../error-handling/logger.mjs";
|
|
4
|
+
class u extends i {
|
|
5
|
+
constructor(a, e = "confirmed") {
|
|
6
|
+
const f = {
|
|
7
|
+
...typeof e == "object" ? e : {},
|
|
8
|
+
fetch: async (r, s) => {
|
|
9
|
+
let t;
|
|
10
|
+
typeof r == "string" ? t = r : r instanceof URL ? t = r.toString() : t = r.url;
|
|
11
|
+
const n = typeof s?.body == "string" ? s.body : null, c = n ? JSON.parse(n) : {};
|
|
12
|
+
try {
|
|
13
|
+
const o = await l.post(t, c);
|
|
14
|
+
if (o.error)
|
|
15
|
+
throw new Error(o.error.message || "RPC Error");
|
|
16
|
+
return new Response(JSON.stringify(o), {
|
|
17
|
+
status: 200,
|
|
18
|
+
statusText: "OK",
|
|
19
|
+
headers: {
|
|
20
|
+
"Content-Type": "application/json"
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
} catch (o) {
|
|
24
|
+
throw p.error(`Solana RPC Error [${c.method}]:`, o), o;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
super(a, f);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
u as CustomSolanaConnection
|
|
33
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("../constants/chains.constants.cjs"),n=require("../error-handling/error-codes.constants.cjs"),c=require("ethers"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("../constants/chains.constants.cjs"),n=require("../error-handling/error-codes.constants.cjs"),c=require("ethers"),s=require("../functions/web3/getContractMetadata.cjs"),h=require("../functions/utils/create-provider.cjs");class o{signer;chainId;originalProvider;fetchProvider;chainEventListener;initConnector(){}initSigner(r){this.signer=r}requireSigner(){if(!this.signer)throw Error("No Connector In Provider Adapter")}async init(r){this.requireSigner(),r&&(this.chainId=r);const e=this.signer.provider,t=this.createFetchProvider();t?(this.originalProvider=t,this.fetchProvider=t):(this.originalProvider=e,this.fetchProvider=t??e),this.fetchProvider===e&&console.warn("fetchProvider not available, falling back to signer provider")}async disconnectFromConnector(){}async connectToConnector(){return 0}async waitForTransaction(r,e){if((await this.fetchProvider?.waitForTransaction(r,e))?.status)return!0;throw Error(n.transactionErrorCodes.TRANSACTION_NOT_CONFIRMED)}async signMessage(r){this.requireSigner();const e=await this.signer.signMessage(r);if(!e)throw new Error(n.transactionErrorCodes.SIGNING_FAILED);if(e.includes("error"))throw new Error(n.transactionErrorCodes.SIGNATURE_UNSUPPORTED_PERSONAL_SIGN);return e}async signTypedData(r,e,t){return this.signer._signTypedData(r,e,t)}getSelectedNetwork=()=>{if(!this.chainId)throw new Error("Illegal state: no chaindId");return i.networkRegistry[this.chainId]};async switchNetwork(r){if(this.originalProvider=this.createFetchProvider(r)??this.originalProvider,!this.originalProvider)throw new Error("switchNetwork illegal state: no provider");this.signer=this.signer?.connect(this.originalProvider),this.chainEventListener?.onChainChanged(r.chainId)}async switchAccount(r){const e=this.createFetchProvider();if(!e)throw new Error("can't create new fetch provider");this.signer=r.connect(e),await this.onAccountChanged(),this.chainEventListener?.onAccountChanged()}createFetchProvider(r){try{const t=(r??i.networkRegistry[this.chainId])?.fetchRpcUrl;return t?h.createCustomRpcProvider(t):void 0}catch(e){console.log("create Fetch Provider error",e);return}}async getAddress(){this.requireSigner();const r=await this.signer.getAddress();if(!r)throw new Error("IllegalState");return c.utils.getAddress(r)}setChainEventListener(r){this.chainEventListener=r}onAccountChanged(){return this.init()}onChainChanged(r){return this.init(r)}release(){this.removeListeners()}removeListeners(){this.chainEventListener=void 0}parseChainIdParam(r){const e=r??this.chainId;if(!e)throw new Error("No chainId provided in context");return e}getContractMetadata(r,e){const t=this.parseChainIdParam(e);return s.getContractMetadata(r,t)}getContract(r,e=void 0,t){const a=this.parseChainIdParam(t);return s.getContract(r,a,e)}getContractWithSigner(r,e=void 0){if(!this.signer)throw new Error("IllegalState: no signer");return this.getContract(r,e).connect(this.signer)}getContractWithFetcher(r,e=void 0){if(!this.fetchProvider)throw new Error("fetchProvider not initialized");return this.getContract(r,e).connect(this.fetchProvider)}getContractWithFetcherForEthereum(r,e=void 0){const t=this.chainId===i.chainIds.localhost&&i.localhostNetwork===i.chainIds.ethMainnet?i.chainIds.localhost:i.chainIds.ethMainnet;return s.getContractWithFetcherByChainId(t,r,e)}async sendTransaction(r){if(!this.signer)throw new Error("IllegalState: no signer");return await this.signer.sendTransaction(r)}async connectAndPatchProvider(){return this.requireSigner(),await this.signer.getChainId()}isPermitterAvailable(){return!1}async getGasPrice(){const r=await this.fetchProvider?.getGasPrice();if(!r)throw Error("Could not fetch gas price in getGasPrice");return r.toBigInt()}}const d=new o,g=()=>new o;exports.EthersProviderAdapter=o;exports.default=g;exports.ethersProvierAdapter=d;
|
|
@@ -6,10 +6,9 @@ export declare class EthersProviderAdapter implements IProviderAdapter<Signer> {
|
|
|
6
6
|
chainId: number | undefined;
|
|
7
7
|
private originalProvider;
|
|
8
8
|
private fetchProvider;
|
|
9
|
-
|
|
9
|
+
protected chainEventListener?: ChainEventListener;
|
|
10
10
|
initConnector(): void;
|
|
11
11
|
initSigner(signer: Signer): void;
|
|
12
|
-
getSigner(): Signer;
|
|
13
12
|
requireSigner(): void;
|
|
14
13
|
init(chainId?: number): Promise<void>;
|
|
15
14
|
disconnectFromConnector(): Promise<void>;
|
|
@@ -1,43 +1,8 @@
|
|
|
1
1
|
import { networkRegistry as o, chainIds as i, localhostNetwork as c } from "../constants/chains.constants.mjs";
|
|
2
2
|
import { transactionErrorCodes as n } from "../error-handling/error-codes.constants.mjs";
|
|
3
3
|
import { utils as h } from "ethers";
|
|
4
|
-
import { getContractMetadata as d, getContract as g, getContractWithFetcherByChainId as
|
|
5
|
-
import "../
|
|
6
|
-
import "../types/transactions.types.mjs";
|
|
7
|
-
import "../types/activities.types.mjs";
|
|
8
|
-
import "../constants/kyc.constants.mjs";
|
|
9
|
-
import "idb-keyval";
|
|
10
|
-
import { createTorRpcProvider as m } from "../functions/utils/create-provider.mjs";
|
|
11
|
-
import "../constants/token-data/index.mjs";
|
|
12
|
-
import "../functions/utils/convertIntegrationProviderToExternalActionId.mjs";
|
|
13
|
-
import "circomlibjs-hinkal-fork";
|
|
14
|
-
import "../data-structures/crypto-keys/keys.mjs";
|
|
15
|
-
import "../constants/server.constants.mjs";
|
|
16
|
-
import "../constants/vite.constants.mjs";
|
|
17
|
-
import "axios";
|
|
18
|
-
import "../API/getServerURL.mjs";
|
|
19
|
-
import "../constants/reorg-depths.constants.mjs";
|
|
20
|
-
import "../functions/utils/mutexes.utils.mjs";
|
|
21
|
-
import "libsodium-wrappers";
|
|
22
|
-
import "process";
|
|
23
|
-
import "buffer";
|
|
24
|
-
import "../constants/save-depths.mjs";
|
|
25
|
-
import "../constants/contracts.constants.mjs";
|
|
26
|
-
import "../constants/coingecko.constants.mjs";
|
|
27
|
-
import "../constants/addresses.constants.mjs";
|
|
28
|
-
import "../constants/token.limits.constants.mjs";
|
|
29
|
-
import "../constants/presale.constants.mjs";
|
|
30
|
-
import "../constants/mystery-boxes.constants.mjs";
|
|
31
|
-
import "../constants/activity.constants.mjs";
|
|
32
|
-
import "../constants/tasks.constants.mjs";
|
|
33
|
-
import "../constants/events.constants.mjs";
|
|
34
|
-
import "../functions/utils/userAgent.mjs";
|
|
35
|
-
import "multiformats";
|
|
36
|
-
import "../API/tenderly.api.mjs";
|
|
37
|
-
import "node-forge";
|
|
38
|
-
import "../functions/web3/events/getApprovedBalance.mjs";
|
|
39
|
-
import "../functions/web3/getTokenHolder.mjs";
|
|
40
|
-
import "ethers-v6h";
|
|
4
|
+
import { getContractMetadata as d, getContract as g, getContractWithFetcherByChainId as l } from "../functions/web3/getContractMetadata.mjs";
|
|
5
|
+
import { createCustomRpcProvider as v } from "../functions/utils/create-provider.mjs";
|
|
41
6
|
class s {
|
|
42
7
|
signer;
|
|
43
8
|
chainId;
|
|
@@ -49,11 +14,6 @@ class s {
|
|
|
49
14
|
initSigner(r) {
|
|
50
15
|
this.signer = r;
|
|
51
16
|
}
|
|
52
|
-
getSigner() {
|
|
53
|
-
if (!this.signer)
|
|
54
|
-
throw new Error("No Signer In Provider Adapter");
|
|
55
|
-
return this.signer;
|
|
56
|
-
}
|
|
57
17
|
requireSigner() {
|
|
58
18
|
if (!this.signer)
|
|
59
19
|
throw Error("No Connector In Provider Adapter");
|
|
@@ -61,7 +21,7 @@ class s {
|
|
|
61
21
|
async init(r) {
|
|
62
22
|
this.requireSigner(), r && (this.chainId = r);
|
|
63
23
|
const t = this.signer.provider, e = this.createFetchProvider();
|
|
64
|
-
this.originalProvider = t, this.fetchProvider = e ?? t, this.fetchProvider === t && console.warn("fetchProvider not available, falling back to signer provider");
|
|
24
|
+
e ? (this.originalProvider = e, this.fetchProvider = e) : (this.originalProvider = t, this.fetchProvider = e ?? t), this.fetchProvider === t && console.warn("fetchProvider not available, falling back to signer provider");
|
|
65
25
|
}
|
|
66
26
|
async disconnectFromConnector() {
|
|
67
27
|
}
|
|
@@ -104,7 +64,7 @@ class s {
|
|
|
104
64
|
createFetchProvider(r) {
|
|
105
65
|
try {
|
|
106
66
|
const e = (r ?? o[this.chainId])?.fetchRpcUrl;
|
|
107
|
-
return e ?
|
|
67
|
+
return e ? v(e) : void 0;
|
|
108
68
|
} catch (t) {
|
|
109
69
|
console.log("create Fetch Provider error", t);
|
|
110
70
|
return;
|
|
@@ -158,7 +118,7 @@ class s {
|
|
|
158
118
|
}
|
|
159
119
|
getContractWithFetcherForEthereum(r, t = void 0) {
|
|
160
120
|
const e = this.chainId === i.localhost && c === i.ethMainnet ? i.localhost : i.ethMainnet;
|
|
161
|
-
return
|
|
121
|
+
return l(e, r, t);
|
|
162
122
|
}
|
|
163
123
|
async sendTransaction(r) {
|
|
164
124
|
if (!this.signer)
|
|
@@ -178,9 +138,9 @@ class s {
|
|
|
178
138
|
return r.toBigInt();
|
|
179
139
|
}
|
|
180
140
|
}
|
|
181
|
-
const
|
|
141
|
+
const p = new s(), E = () => new s();
|
|
182
142
|
export {
|
|
183
143
|
s as EthersProviderAdapter,
|
|
184
|
-
|
|
185
|
-
|
|
144
|
+
E as default,
|
|
145
|
+
p as ethersProvierAdapter
|
|
186
146
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../constants/chains.constants.cjs"),n=require("../error-handling/error-codes.constants.cjs"),o=require("@coral-xyz/anchor");class c{chainId;connection;wallet;ethereumAddress;chainEventListener;anchorProvider;constructor(r,t,e,i){this.connection=r,this.chainId=t,this.wallet=e,this.ethereumAddress=i,this.initializeAnchorProvider()}initConnector(r){this.wallet=r}async init(r){r&&(this.chainId=r)}async connectToConnector(){return 0}async disconnectFromConnector(){}async connectAndPatchProvider(){if(!this.chainId)throw new Error("No Chain Id In Provider Adapter");return this.chainId}async waitForTransaction(r,t){try{return(await this.connection.confirmTransaction(r,"confirmed")).value.err===null}catch{throw Error(n.transactionErrorCodes.TRANSACTION_NOT_CONFIRMED)}}async signMessage(r){if(!this.wallet?.signMessage)throw new Error(n.transactionErrorCodes.SIGNING_FAILED);const t=typeof r=="string"?new TextEncoder().encode(r):r,{signature:e}=await this.wallet.signMessage(t,"utf8");if(!e)throw new Error(n.transactionErrorCodes.SIGNING_FAILED);return`0x${Buffer.from(e).toString("hex")}`}async getAddress(){const r=this.ethereumAddress??this.wallet?.publicKey.toString();if(!r)throw new Error("IllegalState");return r}getSelectedNetwork(){if(!this.chainId)throw new Error("Illegal state: no chainId");return a.networkRegistry[this.chainId]}setChainEventListener(r){this.chainEventListener=r}async switchNetwork(r){this.chainEventListener?.onChainChanged(r.chainId)}async switchAccount(){await this.onAccountChanged(),this.chainEventListener?.onAccountChanged()}async signTypedData(r,t,e){throw new Error("Typed data signing not supported on Solana")}async onAccountChanged(){return this.init()}async onChainChanged(r){return this.init(r)}release(){this.chainEventListener=void 0}getContractMetadata(r,t){throw new Error("Not implemented from SolanaProviderAdapter")}getContract(r,t,e){throw new Error("Not implemented from SolanaProviderAdapter")}getContractWithSigner(r,t){throw new Error("Not implemented from SolanaProviderAdapter")}getContractWithFetcher(r,t){throw new Error("Not implemented from SolanaProviderAdapter")}getContractWithFetcherForEthereum(r,t){throw new Error("Not implemented from SolanaProviderAdapter")}async sendTransaction(r){throw new Error("Not implemented from SolanaProviderAdapter")}async getGasPrice(){throw new Error("Not implemented from SolanaProviderAdapter")}isPermitterAvailable(){return!1}getConnection(){return this.connection}initializeAnchorProvider(){if(!this.wallet)throw new Error("No wallet provided");return this.anchorProvider=new o.AnchorProvider(this.connection,this.wallet,{}),this.anchorProvider}getAnchorProvider(){return this.anchorProvider??this.initializeAnchorProvider()}getSolanaProgram(r){return new o.Program(r,this.getAnchorProvider())}getSolanaPublicKey(){if(!this.wallet)throw new Error("No wallet provided");return this.wallet.publicKey}}exports.SolanaProviderAdapter=c;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Connection, PublicKey } from '@solana/web3.js';
|
|
2
|
+
import { ChainEventListener, IProviderAdapter } from '../data-structures/provider-adapter/IProviderAdapter';
|
|
3
|
+
import { ContractMetadata, ContractType, EthereumNetwork } from '../types/ethereum-network.types';
|
|
4
|
+
import { ethers } from 'ethers';
|
|
5
|
+
import { AnchorProvider, Idl, Program } from '@coral-xyz/anchor';
|
|
6
|
+
import { SolanaWallet } from '../types/solana.types';
|
|
7
|
+
export declare class SolanaProviderAdapter implements IProviderAdapter<SolanaWallet> {
|
|
8
|
+
chainId: number | undefined;
|
|
9
|
+
private connection;
|
|
10
|
+
private wallet;
|
|
11
|
+
private ethereumAddress;
|
|
12
|
+
private chainEventListener?;
|
|
13
|
+
private anchorProvider?;
|
|
14
|
+
constructor(connection: Connection, chainId: number, wallet: SolanaWallet, ethereumAddress?: string);
|
|
15
|
+
initConnector(connector: SolanaWallet): void;
|
|
16
|
+
init(chainId?: number): Promise<void>;
|
|
17
|
+
connectToConnector(): Promise<number>;
|
|
18
|
+
disconnectFromConnector(): Promise<void>;
|
|
19
|
+
connectAndPatchProvider(): Promise<number>;
|
|
20
|
+
waitForTransaction(transactionHash: string, _confirmations: number): Promise<boolean>;
|
|
21
|
+
signMessage(message: string | Uint8Array): Promise<string>;
|
|
22
|
+
getAddress(): Promise<string>;
|
|
23
|
+
getSelectedNetwork(): EthereumNetwork | undefined;
|
|
24
|
+
setChainEventListener(chainEventListener: ChainEventListener): void;
|
|
25
|
+
switchNetwork(network: EthereumNetwork): Promise<void>;
|
|
26
|
+
switchAccount(): Promise<void>;
|
|
27
|
+
signTypedData(_domain: ethers.TypedDataDomain, _types: Record<string, ethers.TypedDataField[]>, _value: Record<string, unknown>): Promise<string>;
|
|
28
|
+
onAccountChanged(): Promise<unknown>;
|
|
29
|
+
onChainChanged(chainId?: number): Promise<unknown>;
|
|
30
|
+
release(): void;
|
|
31
|
+
getContractMetadata(_contractType: ContractType, _chainId?: number): ContractMetadata;
|
|
32
|
+
getContract(_contractType: ContractType, _contractAddress?: string, _chainId?: number): ethers.Contract;
|
|
33
|
+
getContractWithSigner(_contractType: ContractType, _contractAddress?: string): ethers.Contract;
|
|
34
|
+
getContractWithFetcher(_contractType: ContractType, _contractAddress?: string): ethers.Contract;
|
|
35
|
+
getContractWithFetcherForEthereum(_contractType: ContractType, _contractAddress?: string): ethers.Contract;
|
|
36
|
+
sendTransaction(_tx: ethers.providers.TransactionRequest): Promise<ethers.providers.TransactionResponse>;
|
|
37
|
+
getGasPrice(): Promise<bigint>;
|
|
38
|
+
isPermitterAvailable(): boolean;
|
|
39
|
+
getConnection(): Connection;
|
|
40
|
+
private initializeAnchorProvider;
|
|
41
|
+
getAnchorProvider(): AnchorProvider;
|
|
42
|
+
getSolanaProgram(idl: Idl): Program;
|
|
43
|
+
getSolanaPublicKey(): PublicKey;
|
|
44
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { networkRegistry as i } from "../constants/chains.constants.mjs";
|
|
2
|
+
import { transactionErrorCodes as n } from "../error-handling/error-codes.constants.mjs";
|
|
3
|
+
import { AnchorProvider as a, Program as c } from "@coral-xyz/anchor";
|
|
4
|
+
class w {
|
|
5
|
+
chainId;
|
|
6
|
+
connection;
|
|
7
|
+
wallet;
|
|
8
|
+
ethereumAddress;
|
|
9
|
+
// it is necessary because we are storing everything with ethereum address in db
|
|
10
|
+
chainEventListener;
|
|
11
|
+
anchorProvider;
|
|
12
|
+
constructor(r, t, e, o) {
|
|
13
|
+
this.connection = r, this.chainId = t, this.wallet = e, this.ethereumAddress = o, this.initializeAnchorProvider();
|
|
14
|
+
}
|
|
15
|
+
initConnector(r) {
|
|
16
|
+
this.wallet = r;
|
|
17
|
+
}
|
|
18
|
+
async init(r) {
|
|
19
|
+
r && (this.chainId = r);
|
|
20
|
+
}
|
|
21
|
+
async connectToConnector() {
|
|
22
|
+
return 0;
|
|
23
|
+
}
|
|
24
|
+
async disconnectFromConnector() {
|
|
25
|
+
}
|
|
26
|
+
async connectAndPatchProvider() {
|
|
27
|
+
if (!this.chainId)
|
|
28
|
+
throw new Error("No Chain Id In Provider Adapter");
|
|
29
|
+
return this.chainId;
|
|
30
|
+
}
|
|
31
|
+
async waitForTransaction(r, t) {
|
|
32
|
+
try {
|
|
33
|
+
return (await this.connection.confirmTransaction(r, "confirmed")).value.err === null;
|
|
34
|
+
} catch {
|
|
35
|
+
throw Error(n.TRANSACTION_NOT_CONFIRMED);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
async signMessage(r) {
|
|
39
|
+
if (!this.wallet?.signMessage)
|
|
40
|
+
throw new Error(n.SIGNING_FAILED);
|
|
41
|
+
const t = typeof r == "string" ? new TextEncoder().encode(r) : r, { signature: e } = await this.wallet.signMessage(t, "utf8");
|
|
42
|
+
if (!e)
|
|
43
|
+
throw new Error(n.SIGNING_FAILED);
|
|
44
|
+
return `0x${Buffer.from(e).toString("hex")}`;
|
|
45
|
+
}
|
|
46
|
+
async getAddress() {
|
|
47
|
+
const r = this.ethereumAddress ?? this.wallet?.publicKey.toString();
|
|
48
|
+
if (!r)
|
|
49
|
+
throw new Error("IllegalState");
|
|
50
|
+
return r;
|
|
51
|
+
}
|
|
52
|
+
getSelectedNetwork() {
|
|
53
|
+
if (!this.chainId)
|
|
54
|
+
throw new Error("Illegal state: no chainId");
|
|
55
|
+
return i[this.chainId];
|
|
56
|
+
}
|
|
57
|
+
setChainEventListener(r) {
|
|
58
|
+
this.chainEventListener = r;
|
|
59
|
+
}
|
|
60
|
+
async switchNetwork(r) {
|
|
61
|
+
this.chainEventListener?.onChainChanged(r.chainId);
|
|
62
|
+
}
|
|
63
|
+
async switchAccount() {
|
|
64
|
+
await this.onAccountChanged(), this.chainEventListener?.onAccountChanged();
|
|
65
|
+
}
|
|
66
|
+
async signTypedData(r, t, e) {
|
|
67
|
+
throw new Error("Typed data signing not supported on Solana");
|
|
68
|
+
}
|
|
69
|
+
async onAccountChanged() {
|
|
70
|
+
return this.init();
|
|
71
|
+
}
|
|
72
|
+
async onChainChanged(r) {
|
|
73
|
+
return this.init(r);
|
|
74
|
+
}
|
|
75
|
+
release() {
|
|
76
|
+
this.chainEventListener = void 0;
|
|
77
|
+
}
|
|
78
|
+
getContractMetadata(r, t) {
|
|
79
|
+
throw new Error("Not implemented from SolanaProviderAdapter");
|
|
80
|
+
}
|
|
81
|
+
getContract(r, t, e) {
|
|
82
|
+
throw new Error("Not implemented from SolanaProviderAdapter");
|
|
83
|
+
}
|
|
84
|
+
getContractWithSigner(r, t) {
|
|
85
|
+
throw new Error("Not implemented from SolanaProviderAdapter");
|
|
86
|
+
}
|
|
87
|
+
getContractWithFetcher(r, t) {
|
|
88
|
+
throw new Error("Not implemented from SolanaProviderAdapter");
|
|
89
|
+
}
|
|
90
|
+
getContractWithFetcherForEthereum(r, t) {
|
|
91
|
+
throw new Error("Not implemented from SolanaProviderAdapter");
|
|
92
|
+
}
|
|
93
|
+
async sendTransaction(r) {
|
|
94
|
+
throw new Error("Not implemented from SolanaProviderAdapter");
|
|
95
|
+
}
|
|
96
|
+
async getGasPrice() {
|
|
97
|
+
throw new Error("Not implemented from SolanaProviderAdapter");
|
|
98
|
+
}
|
|
99
|
+
isPermitterAvailable() {
|
|
100
|
+
return !1;
|
|
101
|
+
}
|
|
102
|
+
// Solana-specific methods
|
|
103
|
+
getConnection() {
|
|
104
|
+
return this.connection;
|
|
105
|
+
}
|
|
106
|
+
initializeAnchorProvider() {
|
|
107
|
+
if (!this.wallet)
|
|
108
|
+
throw new Error("No wallet provided");
|
|
109
|
+
return this.anchorProvider = new a(this.connection, this.wallet, {}), this.anchorProvider;
|
|
110
|
+
}
|
|
111
|
+
getAnchorProvider() {
|
|
112
|
+
return this.anchorProvider ?? this.initializeAnchorProvider();
|
|
113
|
+
}
|
|
114
|
+
getSolanaProgram(r) {
|
|
115
|
+
return new c(r, this.getAnchorProvider());
|
|
116
|
+
}
|
|
117
|
+
getSolanaPublicKey() {
|
|
118
|
+
if (!this.wallet)
|
|
119
|
+
throw new Error("No wallet provided");
|
|
120
|
+
return this.wallet.publicKey;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
export {
|
|
124
|
+
w as SolanaProviderAdapter
|
|
125
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("../constants/chains.constants.cjs"),i=require("../error-handling/error-codes.constants.cjs"),o=require("ethers"),g=require("wagmi"),c=require("../functions/web3/getContractMetadata.cjs"),h=require("../node_modules/@wagmi/core/dist/esm/actions/disconnect.cjs"),u=require("../node_modules/@wagmi/core/dist/esm/actions/reconnect.cjs"),w=require("../node_modules/@wagmi/core/dist/esm/actions/connect.cjs"),l=require("../node_modules/@wagmi/core/dist/esm/actions/signMessage.cjs"),f=require("../node_modules/@wagmi/core/dist/esm/actions/switchChain.cjs"),C=require("../node_modules/@wagmi/core/dist/esm/actions/getAccount.cjs"),v=require("../node_modules/@wagmi/core/dist/esm/actions/watchAccount.cjs"),I=require("../node_modules/@wagmi/core/dist/esm/actions/watchChainId.cjs");class a{connector;chainId;originalProvider;fetchProvider;signer;chainEventListener;config;unsubscribeFns=[];initConnector(t){this.connector=t}requireConnector(){if(!this.connector)throw Error("No Connector In Provider Adapter")}initConfig(t){this.config=t}async init(t){this.requireConnector(),t&&(this.chainId=t),this.originalProvider=await this.connector.getProvider(),this.fetchProvider=this.createFetchProvider()??this.originalProvider,this.fetchProvider===this.originalProvider&&console.warn("fetchProvider not available");const r=await this.connector.getProvider(),e=await this.connector.getAccounts();this.signer=await this.walletClientToSigner({transport:r,account:e[0]},this.chainId)}async disconnectFromConnector(){if(!this.config)throw new Error("No Config In Provider Adapter");this.release(),await h.disconnect(this.config)}async connectToConnector(t){if(!this.config)throw new Error("No Config In Provider Adapter");if(t.id==="walletConnect")try{await u.reconnect(this.config,{connectors:[t]}),await h.disconnect(this.config)}catch{}try{return(await w.connect(this.config,{connector:t})).chainId}catch(r){if(r instanceof g.ConnectorAlreadyConnectedError)return t.getChainId();let e=i.transactionErrorCodes.CONNECTION_FAILED;throw r?.code===4001&&(e=i.UserFriendlyErrorCodes.YOU_CANCELED_REQUEST),new Error(e)}}async waitForTransaction(t,r){if((await this.fetchProvider?.waitForTransaction(t,r))?.status)return!0;throw Error(i.transactionErrorCodes.TRANSACTION_NOT_CONFIRMED)}async signMessage(t){if(!this.config)throw new Error("No Config In Provider Adapter");const r=await l.signMessage(this.config,{message:t});if(!r)throw new Error(i.transactionErrorCodes.SIGNING_FAILED);if(r.includes("error"))throw new Error(i.transactionErrorCodes.SIGNATURE_UNSUPPORTED_PERSONAL_SIGN);return r}async signTypedData(t,r,e){return this.signer._signTypedData(t,r,e)}getSelectedNetwork=()=>{if(!this.chainId)throw new Error("Illegal state: no chaindId");return n.networkRegistry[this.chainId]};async switchNetwork(t){if(!this.config)throw new Error("No Config In Provider Adapter");return f.switchChain(this.config,{chainId:t.chainId})}createFetchProvider(){try{const r=n.networkRegistry[this.chainId]?.fetchRpcUrl;return r?r.includes("wss")?new o.providers.WebSocketProvider(r):new o.providers.StaticJsonRpcProvider(r):void 0}catch(t){console.log("create Fetch Provider error",t);return}}async getAddress(){if(!this.config)throw new Error("No Config In Provider Adapter");const{address:t}=C.getAccount(this.config);if(!t)throw new Error("IllegalState");return o.utils.getAddress(t)}setChainEventListener(t){if(!this.config)throw new Error("No Config In Provider Adapter");this.chainEventListener=t,this.chainEventListener&&(this.unsubscribeFns.push(v.watchAccount(this.config,{onChange:({address:r},{address:e})=>{if(!this.chainEventListener){console.warn("chainEventListener is not set");return}console.log("Account changed"),r!==e&&(console.log("Account changed"),this.chainEventListener.onAccountChanged())}})),this.unsubscribeFns.push(I.watchChainId(this.config,{onChange:r=>{if(!this.chainEventListener){console.warn("chainEventListener is not set");return}console.log("Chain ID changed!",r),this.chainEventListener.onChainChanged(r)}})))}onAccountChanged(){return this.init()}onChainChanged(t){return this.init(t)}release(){this.removeListeners()}removeListeners(){this.unsubscribeFns.forEach(t=>t()),this.unsubscribeFns=[]}parseChainIdParam(t){const r=t??this.chainId;if(!r)throw new Error("No chainId provided in context");return r}getContractMetadata(t,r){const e=this.parseChainIdParam(r);return c.getContractMetadata(t,e)}getContract(t,r=void 0,e){const s=this.parseChainIdParam(e);return c.getContract(t,s,r)}getContractWithSigner(t,r=void 0){if(!this.signer)throw new Error("IllegalState: no signer");return this.getContract(t,r).connect(this.signer)}getContractWithFetcher(t,r=void 0){if(!this.fetchProvider)throw new Error("fetchProvider not initialized");return this.getContract(t,r).connect(this.fetchProvider)}getContractWithFetcherForEthereum(t,r=void 0){const e=this.chainId===n.chainIds.localhost&&n.localhostNetwork===n.chainIds.ethMainnet?n.chainIds.localhost:n.chainIds.ethMainnet;return c.getContractWithFetcherByChainId(e,t,r)}async sendTransaction(t){if(!this.signer)throw new Error("IllegalState: no signer");return await this.signer.sendTransaction(t)}async connectAndPatchProvider(t){return await this.connectToConnector(t)}isPermitterAvailable(){return!!this.getSelectedNetwork()?.contractData?.permitterAddress}async getGasPrice(){const t=await this.fetchProvider?.getGasPrice();if(!t)throw Error("Could not fetch gas price in getGasPrice");return t.toBigInt()}async walletClientToSigner(t,r){const{account:e,transport:s}=t,d={chainId:r,name:""};return new o.providers.Web3Provider(s,d).getSigner(e)}switchAccount(){throw new Error("Method not implemented.")}}const E=new a,P=()=>new a;exports.WagmiProviderAdapter=a;exports.default=P;exports.wagmiProviderAdapter=E;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ChainEventListener, IProviderAdapter } from '../data-structures/provider-adapter/IProviderAdapter';
|
|
2
2
|
import { ContractMetadata, ContractType, EthereumNetwork } from '../types/ethereum-network.types';
|
|
3
|
-
import { ethers
|
|
3
|
+
import { ethers } from 'ethers';
|
|
4
4
|
import { type Connector } from 'wagmi';
|
|
5
5
|
export declare class WagmiProviderAdapter implements IProviderAdapter<Connector> {
|
|
6
6
|
private connector;
|
|
@@ -12,7 +12,6 @@ export declare class WagmiProviderAdapter implements IProviderAdapter<Connector>
|
|
|
12
12
|
private config?;
|
|
13
13
|
private unsubscribeFns;
|
|
14
14
|
initConnector(connector: Connector): void;
|
|
15
|
-
getSigner(): Signer;
|
|
16
15
|
requireConnector(): void;
|
|
17
16
|
initConfig(config: any): void;
|
|
18
17
|
init(chainId?: number): Promise<void>;
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import { networkRegistry as c, chainIds as n, localhostNetwork as g } from "../constants/chains.constants.mjs";
|
|
2
|
-
import { transactionErrorCodes as i, UserFriendlyErrorCodes as
|
|
3
|
-
import { providers as s, utils as
|
|
2
|
+
import { transactionErrorCodes as i, UserFriendlyErrorCodes as f } from "../error-handling/error-codes.constants.mjs";
|
|
3
|
+
import { providers as s, utils as w } from "ethers";
|
|
4
4
|
import { ConnectorAlreadyConnectedError as l } from "wagmi";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { getContractMetadata as u, getContract as C, getContractWithFetcherByChainId as v } from "../functions/web3/getContractMetadata.mjs";
|
|
6
|
+
import { disconnect as a } from "../node_modules/@wagmi/core/dist/esm/actions/disconnect.mjs";
|
|
7
|
+
import { reconnect as p } from "../node_modules/@wagmi/core/dist/esm/actions/reconnect.mjs";
|
|
8
|
+
import { connect as I } from "../node_modules/@wagmi/core/dist/esm/actions/connect.mjs";
|
|
9
|
+
import { signMessage as E } from "../node_modules/@wagmi/core/dist/esm/actions/signMessage.mjs";
|
|
10
|
+
import { switchChain as P } from "../node_modules/@wagmi/core/dist/esm/actions/switchChain.mjs";
|
|
11
|
+
import { getAccount as m } from "../node_modules/@wagmi/core/dist/esm/actions/getAccount.mjs";
|
|
12
|
+
import { watchAccount as A } from "../node_modules/@wagmi/core/dist/esm/actions/watchAccount.mjs";
|
|
13
|
+
import { watchChainId as N } from "../node_modules/@wagmi/core/dist/esm/actions/watchChainId.mjs";
|
|
7
14
|
class h {
|
|
8
15
|
connector;
|
|
9
16
|
chainId;
|
|
@@ -16,11 +23,6 @@ class h {
|
|
|
16
23
|
initConnector(t) {
|
|
17
24
|
this.connector = t;
|
|
18
25
|
}
|
|
19
|
-
getSigner() {
|
|
20
|
-
if (!this.signer)
|
|
21
|
-
throw new Error("No Signer In Provider Adapter");
|
|
22
|
-
return this.signer;
|
|
23
|
-
}
|
|
24
26
|
requireConnector() {
|
|
25
27
|
if (!this.connector)
|
|
26
28
|
throw Error("No Connector In Provider Adapter");
|
|
@@ -43,16 +45,16 @@ class h {
|
|
|
43
45
|
throw new Error("No Config In Provider Adapter");
|
|
44
46
|
if (t.id === "walletConnect")
|
|
45
47
|
try {
|
|
46
|
-
await
|
|
48
|
+
await p(this.config, { connectors: [t] }), await a(this.config);
|
|
47
49
|
} catch {
|
|
48
50
|
}
|
|
49
51
|
try {
|
|
50
|
-
return (await
|
|
52
|
+
return (await I(this.config, { connector: t })).chainId;
|
|
51
53
|
} catch (r) {
|
|
52
54
|
if (r instanceof l)
|
|
53
55
|
return t.getChainId();
|
|
54
56
|
let e = i.CONNECTION_FAILED;
|
|
55
|
-
throw r?.code === 4001 && (e =
|
|
57
|
+
throw r?.code === 4001 && (e = f.YOU_CANCELED_REQUEST), new Error(e);
|
|
56
58
|
}
|
|
57
59
|
}
|
|
58
60
|
async waitForTransaction(t, r) {
|
|
@@ -63,7 +65,7 @@ class h {
|
|
|
63
65
|
async signMessage(t) {
|
|
64
66
|
if (!this.config)
|
|
65
67
|
throw new Error("No Config In Provider Adapter");
|
|
66
|
-
const r = await
|
|
68
|
+
const r = await E(this.config, { message: t });
|
|
67
69
|
if (!r)
|
|
68
70
|
throw new Error(i.SIGNING_FAILED);
|
|
69
71
|
if (r.includes("error"))
|
|
@@ -81,7 +83,7 @@ class h {
|
|
|
81
83
|
async switchNetwork(t) {
|
|
82
84
|
if (!this.config)
|
|
83
85
|
throw new Error("No Config In Provider Adapter");
|
|
84
|
-
return
|
|
86
|
+
return P(this.config, {
|
|
85
87
|
chainId: t.chainId
|
|
86
88
|
});
|
|
87
89
|
}
|
|
@@ -97,16 +99,16 @@ class h {
|
|
|
97
99
|
async getAddress() {
|
|
98
100
|
if (!this.config)
|
|
99
101
|
throw new Error("No Config In Provider Adapter");
|
|
100
|
-
const { address: t } =
|
|
102
|
+
const { address: t } = m(this.config);
|
|
101
103
|
if (!t)
|
|
102
104
|
throw new Error("IllegalState");
|
|
103
|
-
return
|
|
105
|
+
return w.getAddress(t);
|
|
104
106
|
}
|
|
105
107
|
setChainEventListener(t) {
|
|
106
108
|
if (!this.config)
|
|
107
109
|
throw new Error("No Config In Provider Adapter");
|
|
108
110
|
this.chainEventListener = t, this.chainEventListener && (this.unsubscribeFns.push(
|
|
109
|
-
|
|
111
|
+
A(this.config, {
|
|
110
112
|
onChange: ({ address: r }, { address: e }) => {
|
|
111
113
|
if (!this.chainEventListener) {
|
|
112
114
|
console.warn("chainEventListener is not set");
|
|
@@ -116,7 +118,7 @@ class h {
|
|
|
116
118
|
}
|
|
117
119
|
})
|
|
118
120
|
), this.unsubscribeFns.push(
|
|
119
|
-
|
|
121
|
+
N(this.config, {
|
|
120
122
|
onChange: (r) => {
|
|
121
123
|
if (!this.chainEventListener) {
|
|
122
124
|
console.warn("chainEventListener is not set");
|
|
@@ -147,11 +149,11 @@ class h {
|
|
|
147
149
|
}
|
|
148
150
|
getContractMetadata(t, r) {
|
|
149
151
|
const e = this.parseChainIdParam(r);
|
|
150
|
-
return
|
|
152
|
+
return u(t, e);
|
|
151
153
|
}
|
|
152
154
|
getContract(t, r = void 0, e) {
|
|
153
155
|
const o = this.parseChainIdParam(e);
|
|
154
|
-
return
|
|
156
|
+
return C(t, o, r);
|
|
155
157
|
}
|
|
156
158
|
getContractWithSigner(t, r = void 0) {
|
|
157
159
|
if (!this.signer)
|
|
@@ -165,7 +167,7 @@ class h {
|
|
|
165
167
|
}
|
|
166
168
|
getContractWithFetcherForEthereum(t, r = void 0) {
|
|
167
169
|
const e = this.chainId === n.localhost && g === n.ethMainnet ? n.localhost : n.ethMainnet;
|
|
168
|
-
return
|
|
170
|
+
return v(e, t, r);
|
|
169
171
|
}
|
|
170
172
|
async sendTransaction(t) {
|
|
171
173
|
if (!this.signer)
|
|
@@ -195,9 +197,9 @@ class h {
|
|
|
195
197
|
throw new Error("Method not implemented.");
|
|
196
198
|
}
|
|
197
199
|
}
|
|
198
|
-
const
|
|
200
|
+
const q = new h(), B = () => new h();
|
|
199
201
|
export {
|
|
200
202
|
h as WagmiProviderAdapter,
|
|
201
|
-
|
|
202
|
-
|
|
203
|
+
B as default,
|
|
204
|
+
q as wagmiProviderAdapter
|
|
203
205
|
};
|