@sabaaa1/common 0.0.1
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/.env.example +5 -0
- package/.eslintrc.json +18 -0
- package/README.md +164 -0
- package/copyPackageJson.js +81 -0
- package/handleCDNWorkers.js +92 -0
- package/jest.config.ts +10 -0
- package/package.json +101 -0
- package/polyfillWorker.ts +15 -0
- package/project.json +32 -0
- package/src/API/API.ts +203 -0
- package/src/API/admin-calls.ts +8 -0
- package/src/API/ai-calls.ts +48 -0
- package/src/API/brotherhoodCalls.ts +184 -0
- package/src/API/callLifiAPI.ts +41 -0
- package/src/API/callMonitor.ts +9 -0
- package/src/API/callOdosAPI.ts +89 -0
- package/src/API/callOneInchAPI.ts +47 -0
- package/src/API/callRelayer.ts +23 -0
- package/src/API/checkRisk.ts +7 -0
- package/src/API/duneAPI.ts +26 -0
- package/src/API/enclaveCalls.ts +23 -0
- package/src/API/fetchCommitmentsCache.ts +63 -0
- package/src/API/generate-trading-points.ts +77 -0
- package/src/API/get-token-data.ts +12 -0
- package/src/API/getBridgeProtocols.ts +16 -0
- package/src/API/getCoingeckoPrice.ts +59 -0
- package/src/API/getGasEstimates.ts +30 -0
- package/src/API/getLifiStatus.ts +35 -0
- package/src/API/getRelayerURL.ts +27 -0
- package/src/API/getServerURL.ts +116 -0
- package/src/API/getTokenPrice.ts +39 -0
- package/src/API/getWebsiteURL.ts +58 -0
- package/src/API/index.ts +19 -0
- package/src/API/is-tx-stateless.ts +32 -0
- package/src/API/kycCalls.ts +81 -0
- package/src/API/leaderboardCalls.ts +32 -0
- package/src/API/mysteryBoxesCalls.ts +141 -0
- package/src/API/passwordCalls.ts +34 -0
- package/src/API/proxyAccountsCalls.ts +40 -0
- package/src/API/referralsCalls.ts +52 -0
- package/src/API/relayCalls.ts +14 -0
- package/src/API/restoreSnapshots.ts +7 -0
- package/src/API/rewardsUserCalls.ts +124 -0
- package/src/API/send-telegram-callback.ts +17 -0
- package/src/API/simulate-batch-tx.ts +19 -0
- package/src/API/tenderly.api.ts +96 -0
- package/src/API/token-calls.ts +19 -0
- package/src/API/weeklyAnalyticCalls.ts +43 -0
- package/src/constants/activity.constants.ts +10 -0
- package/src/constants/addresses.constants.ts +74 -0
- package/src/constants/assets.constants.ts +15 -0
- package/src/constants/backend.constants.ts +16 -0
- package/src/constants/balance.constants.ts +1 -0
- package/src/constants/bridging.constants.ts +5 -0
- package/src/constants/chains.constants.ts +194 -0
- package/src/constants/coingecko.constants.ts +67 -0
- package/src/constants/contracts.constants.ts +106 -0
- package/src/constants/conversion.constants.ts +1 -0
- package/src/constants/deploy-data/deploy-data-arbMainnet.json +5685 -0
- package/src/constants/deploy-data/deploy-data-arcTestnet.json +6157 -0
- package/src/constants/deploy-data/deploy-data-avalanche.json +5921 -0
- package/src/constants/deploy-data/deploy-data-base.json +5695 -0
- package/src/constants/deploy-data/deploy-data-bnbMainnet.json +5921 -0
- package/src/constants/deploy-data/deploy-data-ethMainnet.json +5922 -0
- package/src/constants/deploy-data/deploy-data-localhost.json +5921 -0
- package/src/constants/deploy-data/deploy-data-optimism.json +5687 -0
- package/src/constants/deploy-data/deploy-data-polygon.json +5695 -0
- package/src/constants/deploy-data/index.ts +21 -0
- package/src/constants/events.constants.ts +10 -0
- package/src/constants/fees.constants.ts +4 -0
- package/src/constants/function-signatures.constants.ts +6 -0
- package/src/constants/index.ts +30 -0
- package/src/constants/kyc.constants.ts +202 -0
- package/src/constants/lifi.constants.ts +1 -0
- package/src/constants/mediaUrls.constants.ts +25 -0
- package/src/constants/mystery-boxes.constants.ts +402 -0
- package/src/constants/oauthUrls.constants.ts +7 -0
- package/src/constants/permit2.constants.ts +28 -0
- package/src/constants/presale.constants.ts +503 -0
- package/src/constants/protocol.constants.ts +65 -0
- package/src/constants/reorg-depths.constants.ts +13 -0
- package/src/constants/rewards.constants.ts +27 -0
- package/src/constants/save-depths.ts +13 -0
- package/src/constants/server.constants.ts +233 -0
- package/src/constants/tasks.constants.ts +205 -0
- package/src/constants/token-data/ERC20Registry.ts +90 -0
- package/src/constants/token-data/arbMainnetRegistry.json +1841 -0
- package/src/constants/token-data/arbMainnetRegistryFixed.json +1841 -0
- package/src/constants/token-data/arcTestnetRegistry.json +436 -0
- package/src/constants/token-data/avalancheRegistry.json +729 -0
- package/src/constants/token-data/avalancheRegistryFixed.json +729 -0
- package/src/constants/token-data/baseRegistry.json +1134 -0
- package/src/constants/token-data/baseRegistryFixed.json +1134 -0
- package/src/constants/token-data/bnbMainnetRegistry.json +900 -0
- package/src/constants/token-data/bnbMainnetRegistryFixed.json +900 -0
- package/src/constants/token-data/ethMainnetRegistry.json +4298 -0
- package/src/constants/token-data/ethMainnetRegistryFixed.json +4298 -0
- package/src/constants/token-data/index.ts +60 -0
- package/src/constants/token-data/localhostRegistry.json +2784 -0
- package/src/constants/token-data/optimismRegistry.json +701 -0
- package/src/constants/token-data/optimismRegistryFixed.json +701 -0
- package/src/constants/token-data/polygonRegistry.json +2309 -0
- package/src/constants/token-data/polygonRegistryFixed.json +2309 -0
- package/src/constants/token-data/popularTokens.constants.ts +11 -0
- package/src/constants/token-data/tokenPricing.consts.ts +2 -0
- package/src/constants/token.limits.constants.ts +31 -0
- package/src/constants/vite.constants.ts +74 -0
- package/src/constants/wallet.constants.ts +9 -0
- package/src/crypto/babyJub.ts +31 -0
- package/src/crypto/index.ts +3 -0
- package/src/crypto/poseidon.ts +36 -0
- package/src/crypto/preProcessing.ts +20 -0
- package/src/data-structures/ApprovalDBs/EventsPublicApprovalsDB.ts +288 -0
- package/src/data-structures/ApprovalDBs/index.ts +1 -0
- package/src/data-structures/Hinkal/Hinkal.ts +746 -0
- package/src/data-structures/Hinkal/IHinkal.ts +315 -0
- package/src/data-structures/Hinkal/handleAutoDepositBack.ts +138 -0
- package/src/data-structures/Hinkal/hinkalActionFundApproveAndTransact.ts +64 -0
- package/src/data-structures/Hinkal/hinkalActionReceive.ts +65 -0
- package/src/data-structures/Hinkal/hinkalActionStake.ts +152 -0
- package/src/data-structures/Hinkal/hinkalApprove.ts +170 -0
- package/src/data-structures/Hinkal/hinkalCheckTokenRegistry.ts +26 -0
- package/src/data-structures/Hinkal/hinkalDeposit.ts +199 -0
- package/src/data-structures/Hinkal/hinkalGetRecipientInfo.ts +12 -0
- package/src/data-structures/Hinkal/hinkalGetZkMeProvider.ts +31 -0
- package/src/data-structures/Hinkal/hinkalInsideTransact.ts +190 -0
- package/src/data-structures/Hinkal/hinkalMultiSend.ts +26 -0
- package/src/data-structures/Hinkal/hinkalPrivateWallet.ts +198 -0
- package/src/data-structures/Hinkal/hinkalProoflessDeposit.ts +91 -0
- package/src/data-structures/Hinkal/hinkalProxySwap.ts +91 -0
- package/src/data-structures/Hinkal/hinkalSignSubAccount.ts +28 -0
- package/src/data-structures/Hinkal/hinkalSwap.ts +157 -0
- package/src/data-structures/Hinkal/hinkalTransfer.ts +171 -0
- package/src/data-structures/Hinkal/hinkalWithdraw.ts +161 -0
- package/src/data-structures/Hinkal/index.ts +9 -0
- package/src/data-structures/Hinkal/resetMerkleTrees.ts +64 -0
- package/src/data-structures/IndexedDB/activity-db.ts +204 -0
- package/src/data-structures/IndexedDB/balances-db.ts +97 -0
- package/src/data-structures/IndexedDB/contact-db.ts +81 -0
- package/src/data-structures/IndexedDB/index.ts +6 -0
- package/src/data-structures/IndexedDB/prices-db.ts +89 -0
- package/src/data-structures/IndexedDB/private-balances-db.ts +31 -0
- package/src/data-structures/IndexedDB/signatures-db.ts +62 -0
- package/src/data-structures/MultiThreadedUtxoUtils/MultiThreadedUtxoUtils.ts +152 -0
- package/src/data-structures/TokenDBs/AlchemyPublicTokensDB.ts +224 -0
- package/src/data-structures/TokenDBs/ArcPublicTokensDB.ts +198 -0
- package/src/data-structures/TokenDBs/EventsPublicTokensDB.ts +216 -0
- package/src/data-structures/TokenDBs/IPublicTokensDB.ts +7 -0
- package/src/data-structures/TokenDBs/PrivateTokensDB.ts +96 -0
- package/src/data-structures/TokenDBs/PublicTokensDB.ts +49 -0
- package/src/data-structures/TokenDBs/index.ts +4 -0
- package/src/data-structures/TokenDBs/token-visibility-db.ts +154 -0
- package/src/data-structures/ValueCache/ValueCache.ts +29 -0
- package/src/data-structures/ValueCache/index.ts +1 -0
- package/src/data-structures/cacheDevices/AttachableMemoryCacheDevice.ts +33 -0
- package/src/data-structures/cacheDevices/BaseCacheDevice.ts +30 -0
- package/src/data-structures/cacheDevices/FileCacheDevice.ts +59 -0
- package/src/data-structures/cacheDevices/LocalStorageCacheDevice.ts +36 -0
- package/src/data-structures/cacheDevices/index.ts +2 -0
- package/src/data-structures/crypto-keys/decodeUTXO.ts +60 -0
- package/src/data-structures/crypto-keys/encryptDecryptUtxo.ts +74 -0
- package/src/data-structures/crypto-keys/index.ts +4 -0
- package/src/data-structures/crypto-keys/keyUtils.ts +8 -0
- package/src/data-structures/crypto-keys/keys.ts +203 -0
- package/src/data-structures/custom-token-registry/CustomTokenRegistry.ts +49 -0
- package/src/data-structures/event-service/AbstractAccessTokenSnapshotService.ts +142 -0
- package/src/data-structures/event-service/AbstractApprovalsSnapshotService.ts +152 -0
- package/src/data-structures/event-service/AbstractCommitmentsSnapshotService.ts +116 -0
- package/src/data-structures/event-service/AbstractEventService.ts +44 -0
- package/src/data-structures/event-service/AbstractNullifierSnapshotService.ts +76 -0
- package/src/data-structures/event-service/AbstractSnapshotService.ts +63 -0
- package/src/data-structures/event-service/BlockchainEventEmitter.ts +132 -0
- package/src/data-structures/event-service/index.ts +7 -0
- package/src/data-structures/index.ts +18 -0
- package/src/data-structures/merkle-tree/MerkleTree.test.ts +77 -0
- package/src/data-structures/merkle-tree/MerkleTree.ts +253 -0
- package/src/data-structures/merkle-tree/MerkleTreeIncompleteError.ts +6 -0
- package/src/data-structures/merkle-tree/getPatchedAccessTokenMerkleTree.ts +24 -0
- package/src/data-structures/merkle-tree/index.ts +3 -0
- package/src/data-structures/presale/PresaleContractWrapper.ts +80 -0
- package/src/data-structures/presale/index.ts +1 -0
- package/src/data-structures/provider-adapter/IProviderAdapter.ts +43 -0
- package/src/data-structures/snapshot/ClientAccessTokenSnapshotService.ts +41 -0
- package/src/data-structures/snapshot/ClientApprovalsSnapshotService.ts +36 -0
- package/src/data-structures/snapshot/ClientCommitmentsSnapshotService.ts +30 -0
- package/src/data-structures/snapshot/ClientNullifierSnapshotService.ts +28 -0
- package/src/data-structures/snapshot/SnapshotFetcherService.ts +68 -0
- package/src/data-structures/snapshot/index.ts +1 -0
- package/src/data-structures/token-price-fetcher/TokenChecker.ts +45 -0
- package/src/data-structures/token-price-fetcher/index.ts +1 -0
- package/src/data-structures/tor/HttpClient.ts +118 -0
- package/src/data-structures/tor/TorAdapter.ts +94 -0
- package/src/data-structures/tor/TorClient.ts +283 -0
- package/src/data-structures/tor/WebSocketDuplex.ts +32 -0
- package/src/data-structures/tor/index.ts +3 -0
- package/src/data-structures/transactions-manager/history/history.types.ts +14 -0
- package/src/data-structures/transactions-manager/index.ts +1 -0
- package/src/data-structures/utxo/Utxo.ts +189 -0
- package/src/error-handling/customErrors/ErrorWithAmount.ts +8 -0
- package/src/error-handling/customErrors/ErrorWithTx.ts +10 -0
- package/src/error-handling/customErrors/FeeOverTransactionValueError.ts +16 -0
- package/src/error-handling/customErrors/SimulationFailureError.ts +9 -0
- package/src/error-handling/customErrors/customErrors.helpers.ts +39 -0
- package/src/error-handling/customErrors/index.ts +5 -0
- package/src/error-handling/error-codes.constants.ts +214 -0
- package/src/error-handling/get-error.message.ts +149 -0
- package/src/error-handling/handleErrorRestore.ts +25 -0
- package/src/error-handling/index.ts +7 -0
- package/src/error-handling/logError.ts +8 -0
- package/src/error-handling/logger.ts +21 -0
- package/src/error-handling/types.ts +10 -0
- package/src/externalABIs/BUSD.ts +516 -0
- package/src/externalABIs/BabPassport.json +24 -0
- package/src/externalABIs/DAI.ts +331 -0
- package/src/externalABIs/ERC1155.json +316 -0
- package/src/externalABIs/ERC20.json +297 -0
- package/src/externalABIs/ERC20.ts +1 -0
- package/src/externalABIs/ERC721.json +205 -0
- package/src/externalABIs/GalxePassport.json +23 -0
- package/src/externalABIs/IQuoterV2.json +211 -0
- package/src/externalABIs/ISwapRouter.json +568 -0
- package/src/externalABIs/IUniswapV3Factory.json +207 -0
- package/src/externalABIs/IUniswapV3Pool.json +999 -0
- package/src/externalABIs/NodeInterfaceABI.json +1 -0
- package/src/externalABIs/OptimismGasPriceOracle.json +1 -0
- package/src/externalABIs/PoLidoNftAbi.json +307 -0
- package/src/externalABIs/SanctionsList.ts +86 -0
- package/src/externalABIs/USDC.ts +718 -0
- package/src/externalABIs/USDR.ts +343 -0
- package/src/externalABIs/USDR3CRV.ts +539 -0
- package/src/externalABIs/USDT.ts +390 -0
- package/src/externalABIs/UniswapV2PoolAbi.json +66 -0
- package/src/externalABIs/WETH.ts +153 -0
- package/src/externalABIs/amToken.ts +347 -0
- package/src/externalABIs/index.ts +53 -0
- package/src/externalABIs/swapAbi.ts +442 -0
- package/src/externalABIs/transactionsProver.json +45 -0
- package/src/functions/index.ts +16 -0
- package/src/functions/kyc/aiPriseHelper.ts +0 -0
- package/src/functions/kyc/authentoHelper.ts +44 -0
- package/src/functions/kyc/index.ts +3 -0
- package/src/functions/kyc/openDefaultPassportWindow.ts +9 -0
- package/src/functions/kyc/passportHelper.ts +13 -0
- package/src/functions/kyc/zkMeHelper.ts +69 -0
- package/src/functions/pre-transaction/constructAdminData.ts +21 -0
- package/src/functions/pre-transaction/getExternalSwapAddress.ts +30 -0
- package/src/functions/pre-transaction/getFeeStructure.ts +44 -0
- package/src/functions/pre-transaction/getFlatFees.ts +88 -0
- package/src/functions/pre-transaction/getSignatureDataForTransact.ts +16 -0
- package/src/functions/pre-transaction/getVolatileTransferAmount.ts +56 -0
- package/src/functions/pre-transaction/index.ts +7 -0
- package/src/functions/pre-transaction/interaction-to-action.ts +17 -0
- package/src/functions/pre-transaction/merge-with-fee-structure-emporium.ts +50 -0
- package/src/functions/pre-transaction/merge-with-fee-structure.ts +35 -0
- package/src/functions/pre-transaction/outputApprovalDataProcessing.ts +95 -0
- package/src/functions/pre-transaction/outputUtxoProcessing.ts +52 -0
- package/src/functions/pre-transaction/process-gas-estimates.ts +36 -0
- package/src/functions/pre-transaction/shouldPatchAccessTokenMerkleTree.ts +15 -0
- package/src/functions/private-wallet/emporium.helpers.ts +296 -0
- package/src/functions/private-wallet/emporium.swap.helpers.ts +284 -0
- package/src/functions/private-wallet/index.ts +3 -0
- package/src/functions/private-wallet/opProducer.ts +33 -0
- package/src/functions/snarkjs/common.snarkjs.ts +377 -0
- package/src/functions/snarkjs/constant.ts +490 -0
- package/src/functions/snarkjs/constructEmporiumProof.ts +301 -0
- package/src/functions/snarkjs/constructGeneralZkProof.ts +281 -0
- package/src/functions/snarkjs/generateCircomData.ts +81 -0
- package/src/functions/snarkjs/generateZkProof.ts +21 -0
- package/src/functions/snarkjs/generateZkProofEnclave.ts +45 -0
- package/src/functions/snarkjs/generateZkProofSelf.ts +29 -0
- package/src/functions/snarkjs/getOriginalSender.ts +4 -0
- package/src/functions/snarkjs/getZKFiles.ts +29 -0
- package/src/functions/snarkjs/index.ts +4 -0
- package/src/functions/staking/index.ts +78 -0
- package/src/functions/utils/addresses.ts +37 -0
- package/src/functions/utils/amounts.utils.test.ts +91 -0
- package/src/functions/utils/amounts.utils.ts +119 -0
- package/src/functions/utils/arraysMatch.ts +4 -0
- package/src/functions/utils/cacheDevice.utils.ts +21 -0
- package/src/functions/utils/cacheFunctions.ts +154 -0
- package/src/functions/utils/caseInsensitive.utils.ts +10 -0
- package/src/functions/utils/convertEmporiumOpToCallInfo.ts +19 -0
- package/src/functions/utils/convertIntegrationProviderToExternalActionId.ts +14 -0
- package/src/functions/utils/create-provider.ts +11 -0
- package/src/functions/utils/encodeTokenWithId.ts +4 -0
- package/src/functions/utils/encryptInputForEnclave.ts +119 -0
- package/src/functions/utils/enum.utils.ts +30 -0
- package/src/functions/utils/erc20tokenFunctions.ts +110 -0
- package/src/functions/utils/ethers-formatter.utils.ts +32 -0
- package/src/functions/utils/evmNetworkFunctions.ts +9 -0
- package/src/functions/utils/external-action.utils.ts +15 -0
- package/src/functions/utils/fees.utils.ts +26 -0
- package/src/functions/utils/get-hinkal-approvals.ts +36 -0
- package/src/functions/utils/get-signature-header.ts +5 -0
- package/src/functions/utils/getBlockExplorerUrl.ts +14 -0
- package/src/functions/utils/getDataFromTransaction.ts +79 -0
- package/src/functions/utils/getRecipientInfoFromUserKeys.ts +28 -0
- package/src/functions/utils/inLogicMetadata.ts +9 -0
- package/src/functions/utils/index.ts +43 -0
- package/src/functions/utils/involves-permit2-op.ts +17 -0
- package/src/functions/utils/ipfs.ts +74 -0
- package/src/functions/utils/is-valid-url.ts +5 -0
- package/src/functions/utils/lifi.utils.ts +3 -0
- package/src/functions/utils/memoize.utils.ts +23 -0
- package/src/functions/utils/merkleTree.utils.ts +27 -0
- package/src/functions/utils/mutexes.utils.ts +3 -0
- package/src/functions/utils/mystery-box-auction.utils.ts +61 -0
- package/src/functions/utils/networks.utils.ts +6 -0
- package/src/functions/utils/nftTokenFunctions.ts +25 -0
- package/src/functions/utils/nickname.utils.ts +4 -0
- package/src/functions/utils/postToOffscreen.ts +6 -0
- package/src/functions/utils/prepareHinkal.ts +78 -0
- package/src/functions/utils/process.utils.ts +23 -0
- package/src/functions/utils/processUseApprovalUtxoData.ts +26 -0
- package/src/functions/utils/publicBalance.utils.ts +131 -0
- package/src/functions/utils/reloadPage.ts +1 -0
- package/src/functions/utils/replaceAddressInCalldata.ts +6 -0
- package/src/functions/utils/requireEnv.ts +10 -0
- package/src/functions/utils/resolve-sync.utils.ts +40 -0
- package/src/functions/utils/rpc-int-encode.ts +7 -0
- package/src/functions/utils/serialize.utils.ts +12 -0
- package/src/functions/utils/string.utils.ts +92 -0
- package/src/functions/utils/time.utils.ts +80 -0
- package/src/functions/utils/token-check.utils.ts +12 -0
- package/src/functions/utils/trimFieldValues.ts +24 -0
- package/src/functions/utils/upToDateState.ts +12 -0
- package/src/functions/utils/userAgent.ts +26 -0
- package/src/functions/utils/walletBalances.utils.ts +117 -0
- package/src/functions/web3/EIP-712.test.ts +302 -0
- package/src/functions/web3/EIP-712.ts +243 -0
- package/src/functions/web3/etherFunctions.test.ts +129 -0
- package/src/functions/web3/etherFunctions.ts +84 -0
- package/src/functions/web3/events/balanceChangedCustomHandler.ts +13 -0
- package/src/functions/web3/events/balanceChangedHandler.ts +10 -0
- package/src/functions/web3/events/getApprovedBalance.ts +154 -0
- package/src/functions/web3/events/getInputUtxoAndBalance.ts +305 -0
- package/src/functions/web3/events/getInputUtxosEnclave.ts +40 -0
- package/src/functions/web3/events/getShieldedBalance.ts +163 -0
- package/src/functions/web3/events/getTransactionLogEvents.ts +55 -0
- package/src/functions/web3/events/index.ts +7 -0
- package/src/functions/web3/events/web3RetrieveEvents.ts +33 -0
- package/src/functions/web3/functionCalls/accessTokenCalls.ts +27 -0
- package/src/functions/web3/functionCalls/approveToken.ts +180 -0
- package/src/functions/web3/functionCalls/approveTokensToHinkal.ts +21 -0
- package/src/functions/web3/functionCalls/estimateGasRelayer.ts +40 -0
- package/src/functions/web3/functionCalls/getRootHash.ts +7 -0
- package/src/functions/web3/functionCalls/inHinkalApprovalCalls.ts +60 -0
- package/src/functions/web3/functionCalls/relayFunctions.ts +12 -0
- package/src/functions/web3/functionCalls/transactCallDirect.ts +71 -0
- package/src/functions/web3/functionCalls/transactCallRelayer.ts +57 -0
- package/src/functions/web3/getContractMetadata.ts +43 -0
- package/src/functions/web3/getPublicAddressBalance.ts +17 -0
- package/src/functions/web3/getTokenHolder.ts +53 -0
- package/src/functions/web3/index.ts +9 -0
- package/src/functions/web3/lifiAPI.ts +41 -0
- package/src/functions/web3/odosAPI.ts +50 -0
- package/src/functions/web3/oneInchAPI.ts +47 -0
- package/src/functions/web3/runContractFunction.ts +116 -0
- package/src/functions/web3/uniswapAPI.ts +156 -0
- package/src/index.ts +9 -0
- package/src/mutexes/index.ts +1 -0
- package/src/mutexes/mutex.ts +3 -0
- package/src/providers/EthersProviderAdapter.ts +230 -0
- package/src/providers/TorExternalProvider.ts +36 -0
- package/src/providers/WagmiProviderAdapter.ts +311 -0
- package/src/providers/exportProviers.ts +11 -0
- package/src/providers/prepareEthersHinkal.ts +18 -0
- package/src/providers/prepareWagmiHinkal.ts +16 -0
- package/src/types/API.types.ts +23 -0
- package/src/types/ICacheDevice.ts +5 -0
- package/src/types/IMultiThreadedUtxoUtils.ts +16 -0
- package/src/types/RewardUserEnums.ts +12 -0
- package/src/types/TransactionSimulator.types.ts +30 -0
- package/src/types/WeeklyAnalytics.types.ts +44 -0
- package/src/types/activities.types.ts +90 -0
- package/src/types/admin.types.ts +30 -0
- package/src/types/all-points.types.ts +8 -0
- package/src/types/approvals.types.ts +45 -0
- package/src/types/balances.types.ts +20 -0
- package/src/types/big-intable.types.ts +3 -0
- package/src/types/bridging.types.ts +30 -0
- package/src/types/brotherhood-user.types.ts +13 -0
- package/src/types/cache.types.ts +42 -0
- package/src/types/circom-data.types.ts +120 -0
- package/src/types/coingecko.types.ts +216 -0
- package/src/types/commitments.types.ts +39 -0
- package/src/types/confirmation-request.types.ts +10 -0
- package/src/types/contacts.types.ts +6 -0
- package/src/types/crypto.types.ts +8 -0
- package/src/types/duneAPI.types.ts +9 -0
- package/src/types/eip5792.types.ts +31 -0
- package/src/types/ethereum-network.types.ts +70 -0
- package/src/types/external-action.types.ts +19 -0
- package/src/types/fee.types.ts +11 -0
- package/src/types/generatePoints.ts +14 -0
- package/src/types/hinkal.stake.types.ts +12 -0
- package/src/types/hinkal.types.ts +150 -0
- package/src/types/index.ts +50 -0
- package/src/types/kyc.types.ts +49 -0
- package/src/types/merch-order.types.ts +18 -0
- package/src/types/message.types.ts +6 -0
- package/src/types/mystery-boxes.types.ts +50 -0
- package/src/types/new-rewards.type.ts +181 -0
- package/src/types/offscreen.types.ts +8 -0
- package/src/types/presaleReferral.types.ts +4 -0
- package/src/types/proxy.types.ts +11 -0
- package/src/types/referral.types.ts +13 -0
- package/src/types/relayer.types.ts +16 -0
- package/src/types/remote-proof.types.ts +18 -0
- package/src/types/rewards.types.ts +53 -0
- package/src/types/routing.types.ts +7 -0
- package/src/types/sandbox.types.ts +246 -0
- package/src/types/session.types.ts +12 -0
- package/src/types/signature.types.ts +11 -0
- package/src/types/slippage.types.ts +3 -0
- package/src/types/snark.types.ts +43 -0
- package/src/types/tenderly.api.types.ts +200 -0
- package/src/types/token-prices.types.ts +8 -0
- package/src/types/token-with-id.types.ts +4 -0
- package/src/types/token.types.ts +86 -0
- package/src/types/transactions.types.ts +120 -0
- package/src/types/wc.types.ts +83 -0
- package/src/types/with-id.types.ts +1 -0
- package/src/webworker/performTaskWithWorker.ts +50 -0
- package/src/webworker/snarkjsWorker/snarkjs.d.ts +2 -0
- package/src/webworker/snarkjsWorker/snarkjsWorker.types.ts +18 -0
- package/src/webworker/snarkjsWorker/snarkjsWorkerLauncher.ts +19 -0
- package/src/webworker/snarkjsWorker/snarkjsWorkerLogic.ts +90 -0
- package/src/webworker/utxoWorker/utxoWorker.types.ts +41 -0
- package/src/webworker/utxoWorker/utxoWorkerLauncher.ts +19 -0
- package/src/webworker/utxoWorker/utxoWorkerLogic.ts +107 -0
- package/src/webworker/viteWorkerURL.constant.ts +25 -0
- package/src/webworker/worker.registry.ts +11 -0
- package/src/webworker/worker.types.ts +35 -0
- package/src/webworker/workerErrorHandler.ts +10 -0
- package/src/webworker/workerFactory.ts +47 -0
- package/src/webworker/workerProxy.ts +88 -0
- package/src/webworker/zkProofWorker/zkProofWorker.types.ts +52 -0
- package/src/webworker/zkProofWorker/zkProofWorkerLauncher.ts +19 -0
- package/src/webworker/zkProofWorker/zkProofWorkerLogic.ts +84 -0
- package/tsconfig.json +23 -0
- package/tsconfig.lib.json +10 -0
- package/tsconfig.spec.json +15 -0
- package/vite.config.ts +97 -0
- package/vite.config.workers.ts +51 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { APPROVED_UTXO_CONVERSION_COUNT } from '../constants/conversion.constants';
|
|
2
|
+
import { defaultFeeToken } from '../constants/fees.constants';
|
|
3
|
+
import { zeroAddress } from '../constants/protocol.constants';
|
|
4
|
+
import { UserKeys } from '../data-structures/crypto-keys/keys';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Configuration options for the Hinkal system.
|
|
8
|
+
*/
|
|
9
|
+
export type HinkalConfig = {
|
|
10
|
+
/**
|
|
11
|
+
* Path to the cache file used for storing temporary data.
|
|
12
|
+
* It should be a valid file path string.
|
|
13
|
+
*/
|
|
14
|
+
cacheFilePath?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Indicator to use caching on a file level.
|
|
17
|
+
* Node only.
|
|
18
|
+
*/
|
|
19
|
+
useFileCache?: boolean;
|
|
20
|
+
disableCaching?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Indicator controlling wether the proof should be constructed remotely in secure enclave.
|
|
23
|
+
*/
|
|
24
|
+
generateProofRemotely?: boolean;
|
|
25
|
+
disableMerkleTreeUpdates?: boolean;
|
|
26
|
+
|
|
27
|
+
serializedCache?: Record<string, string>;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export type ProverVersion = 'v1x0' | 'v1x1';
|
|
31
|
+
|
|
32
|
+
export enum EventType {
|
|
33
|
+
BalanceChange = 'BalanceChange',
|
|
34
|
+
NetworkChange = 'NetworkChange',
|
|
35
|
+
KycNeeded = 'KycNeeded',
|
|
36
|
+
AccountChanged = 'AccountChanged',
|
|
37
|
+
ShowConnect = 'ShowConnect',
|
|
38
|
+
ShowNetworkPopup = 'ShowNetworkPopup',
|
|
39
|
+
MerkleTreeUpdated = 'MerkleTreeUpdated',
|
|
40
|
+
MerkleTreeResetStarted = 'MerkleTreeResetStarted',
|
|
41
|
+
MerkleTreeResetFinished = 'MerkleTreeResetFinished',
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export enum IntegrationProvider {
|
|
45
|
+
UNISWAP = 1,
|
|
46
|
+
ODOS,
|
|
47
|
+
ONEINCH,
|
|
48
|
+
LIFI,
|
|
49
|
+
ALL,
|
|
50
|
+
NONE,
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export enum HinkalStakeAction {
|
|
54
|
+
DepositOrStake,
|
|
55
|
+
Unstake,
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export enum INTERACTION {
|
|
59
|
+
WITHDRAW = 'WITHDRAW',
|
|
60
|
+
SWAP = 'SWAP',
|
|
61
|
+
STAKING = 'STAKING',
|
|
62
|
+
UNSTAKING = 'UNSTAKING',
|
|
63
|
+
CLAIMING = 'CLAIMING',
|
|
64
|
+
EMPORIUM = 'EMPORIUM',
|
|
65
|
+
NONE = 'NONE',
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export enum HinkalLogicAction {
|
|
69
|
+
NONE, // = 0
|
|
70
|
+
APPROVE, // = 1
|
|
71
|
+
RELEASE_BUFFER, // = 2
|
|
72
|
+
EXECUTE, // = 3
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface UseApprovalUTXOData<T = bigint> {
|
|
76
|
+
approvalChanges: T[];
|
|
77
|
+
externalApprovalAddresses: string[];
|
|
78
|
+
conversionInHinkalAddress: T[];
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export type ApprovedUtxo<T = bigint> = {
|
|
82
|
+
tokenAddress: string;
|
|
83
|
+
amount: T;
|
|
84
|
+
inHinkalAddress: T;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export type ApprovedUtxoWithInteractionAddress<T = bigint> = ApprovedUtxo<T> & {
|
|
88
|
+
interactionAddress: string;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export type HinkalLogicArgs<T = bigint> = {
|
|
92
|
+
hinkalLogicAction: HinkalLogicAction;
|
|
93
|
+
executeApprovalChanges: T[];
|
|
94
|
+
doPreTxApproval: boolean;
|
|
95
|
+
inHinkalAddress: T;
|
|
96
|
+
useApprovalUtxoData: UseApprovalUTXOData<T>[];
|
|
97
|
+
interactionAddress?: string;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export const defaultUseApprovalUTXOData = <T>(dimension: number, defaultValue: T) => ({
|
|
101
|
+
approvalChanges: Array.from<T>({ length: dimension }).fill(defaultValue),
|
|
102
|
+
externalApprovalAddresses: Array.from<string>({ length: dimension }).fill(zeroAddress),
|
|
103
|
+
conversionInHinkalAddress: Array.from<T>({ length: dimension }).fill(defaultValue),
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
export const defaultHinkalLogicArgs = (dimension: number, userKeys: UserKeys): HinkalLogicArgs => ({
|
|
107
|
+
hinkalLogicAction: HinkalLogicAction.NONE,
|
|
108
|
+
inHinkalAddress: userKeys.getInHinkalAddress(zeroAddress),
|
|
109
|
+
executeApprovalChanges: Array.from<bigint>({ length: dimension }).fill(0n),
|
|
110
|
+
doPreTxApproval: false,
|
|
111
|
+
useApprovalUtxoData: Array.from({ length: dimension }).map(() =>
|
|
112
|
+
defaultUseApprovalUTXOData(APPROVED_UTXO_CONVERSION_COUNT, 0n),
|
|
113
|
+
),
|
|
114
|
+
interactionAddress: zeroAddress,
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
export type FeeStructure<T = bigint> = {
|
|
118
|
+
feeToken: string;
|
|
119
|
+
flatFee: T;
|
|
120
|
+
variableRate: T; // measured in beeps = 0.01 of 1%
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export const defaultFeeStructure: FeeStructure<bigint> = {
|
|
124
|
+
feeToken: defaultFeeToken,
|
|
125
|
+
flatFee: 0n,
|
|
126
|
+
variableRate: 0n,
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
export type AuthorizationData = {
|
|
130
|
+
v: string;
|
|
131
|
+
r: string;
|
|
132
|
+
s: string;
|
|
133
|
+
nonce: string;
|
|
134
|
+
address: string;
|
|
135
|
+
chainId: string;
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
export type ParsedInLogicMetadata = {
|
|
139
|
+
signature: string;
|
|
140
|
+
deadline: number;
|
|
141
|
+
erc20TokenAddresses: string[];
|
|
142
|
+
externalCallData: string;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
export enum UserProgress {
|
|
146
|
+
NOT_STARTED = 0,
|
|
147
|
+
CONNECTED = 1,
|
|
148
|
+
KYC = 2,
|
|
149
|
+
COMPLETED = 3,
|
|
150
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export * from './API.types';
|
|
2
|
+
export * from './approvals.types';
|
|
3
|
+
export * from './big-intable.types';
|
|
4
|
+
export * from './circom-data.types';
|
|
5
|
+
export * from './commitments.types';
|
|
6
|
+
export * from './IMultiThreadedUtxoUtils';
|
|
7
|
+
export * from './crypto.types';
|
|
8
|
+
export * from './ethereum-network.types';
|
|
9
|
+
export * from './external-action.types';
|
|
10
|
+
export * from './hinkal.types';
|
|
11
|
+
export * from './kyc.types';
|
|
12
|
+
export * from './relayer.types';
|
|
13
|
+
export * from './snark.types';
|
|
14
|
+
export * from './token.types';
|
|
15
|
+
export * from './slippage.types';
|
|
16
|
+
export * from './transactions.types';
|
|
17
|
+
export * from './rewards.types';
|
|
18
|
+
export * from './hinkal.stake.types';
|
|
19
|
+
export * from './duneAPI.types';
|
|
20
|
+
export * from './admin.types';
|
|
21
|
+
export * from './ICacheDevice';
|
|
22
|
+
export * from './activities.types';
|
|
23
|
+
export * from './wc.types';
|
|
24
|
+
export * from './sandbox.types';
|
|
25
|
+
export * from './with-id.types';
|
|
26
|
+
export * from './balances.types';
|
|
27
|
+
export * from './cache.types';
|
|
28
|
+
export * from './tenderly.api.types';
|
|
29
|
+
export * from './TransactionSimulator.types';
|
|
30
|
+
export * from './coingecko.types';
|
|
31
|
+
export * from './message.types';
|
|
32
|
+
export * from './session.types';
|
|
33
|
+
export * from './token-prices.types';
|
|
34
|
+
export * from './presaleReferral.types';
|
|
35
|
+
export * from './bridging.types';
|
|
36
|
+
export * from './brotherhood-user.types';
|
|
37
|
+
export * from './WeeklyAnalytics.types';
|
|
38
|
+
export * from './referral.types';
|
|
39
|
+
export * from './all-points.types';
|
|
40
|
+
export * from './new-rewards.type';
|
|
41
|
+
export * from './RewardUserEnums';
|
|
42
|
+
export * from './generatePoints';
|
|
43
|
+
export * from './eip5792.types';
|
|
44
|
+
export * from './proxy.types';
|
|
45
|
+
export * from './mystery-boxes.types';
|
|
46
|
+
export * from './merch-order.types';
|
|
47
|
+
export * from './routing.types';
|
|
48
|
+
export * from './confirmation-request.types';
|
|
49
|
+
export * from './signature.types';
|
|
50
|
+
export * from './offscreen.types';
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2
|
+
export enum VERIFICATION_TYPE {
|
|
3
|
+
USER = 'USER',
|
|
4
|
+
BUSINESS = 'BUSINESS',
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const VerificationTypes = [VERIFICATION_TYPE.USER, VERIFICATION_TYPE.BUSINESS];
|
|
8
|
+
|
|
9
|
+
export enum Passports {
|
|
10
|
+
AiPriseKyc,
|
|
11
|
+
AiPriseKyb,
|
|
12
|
+
BABPassport,
|
|
13
|
+
GalxePassport,
|
|
14
|
+
// QuadrataPassport,
|
|
15
|
+
ZkMePassport,
|
|
16
|
+
CoinbasePassport,
|
|
17
|
+
AuthentoPassport,
|
|
18
|
+
AuthentoPassportKyb,
|
|
19
|
+
ReclaimCoinbasePassport,
|
|
20
|
+
ReclaimBNBPassport,
|
|
21
|
+
ReclaimOKXPassport,
|
|
22
|
+
ReclaimGatePassport,
|
|
23
|
+
ReclaimMexcPassport,
|
|
24
|
+
ReclaimHtxPassport,
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// aiPrise verification result codes
|
|
28
|
+
export enum KycVerificationResult {
|
|
29
|
+
APPROVED = 'APPROVED', // The user is verified. The verification process successfully completed.
|
|
30
|
+
DECLINED = 'DECLINED', // The user is not verified. The verification process successfully completed.
|
|
31
|
+
REVIEW = 'REVIEW', // The end user or business needs to be manually looked at. The verification process successfully completed.
|
|
32
|
+
UNKNOWN = 'UNKNOWN', // Unknown status. The verification process is not started or has failed.
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export enum KycVerificationStatus {
|
|
36
|
+
COMPLETED = 'COMPLETED', // The verification process successfully completed.
|
|
37
|
+
FAILED = 'FAILED', // The verification process failed. status_reasons(explained below) should have more details.
|
|
38
|
+
PENDING = 'PENDING', // The verification process is waiting for a third-party API to complete its processing.
|
|
39
|
+
RUNNING = 'RUNNING', // The verification process is running.
|
|
40
|
+
NOT_STARTED = 'NOT_STARTED', // The verification process has not started yet. Most likely pre-conditions are being checked.
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface VerificationData {
|
|
44
|
+
verificationResult: KycVerificationResult;
|
|
45
|
+
verificationStatus: KycVerificationStatus;
|
|
46
|
+
countryCode: string | null;
|
|
47
|
+
fullName: string | null;
|
|
48
|
+
idNumber: string | null;
|
|
49
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Address } from './new-rewards.type';
|
|
2
|
+
|
|
3
|
+
export enum MerchOrderStatus {
|
|
4
|
+
Pending = 'order placed',
|
|
5
|
+
Shipped = 'shipped',
|
|
6
|
+
Delivered = 'delivered',
|
|
7
|
+
Delayed = 'delayed',
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface MerchOrder {
|
|
11
|
+
orderId: number;
|
|
12
|
+
ethereumAddress: string;
|
|
13
|
+
merchItemName: string;
|
|
14
|
+
status: MerchOrderStatus;
|
|
15
|
+
estimatedArrival?: string;
|
|
16
|
+
createdAt: string;
|
|
17
|
+
address?: Address | null;
|
|
18
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Rank } from './RewardUserEnums';
|
|
2
|
+
|
|
3
|
+
export enum MysteryBoxItemFrequency {
|
|
4
|
+
Common = 'Common',
|
|
5
|
+
Uncommon = 'Uncommon',
|
|
6
|
+
Rare = 'Rare',
|
|
7
|
+
Epic = 'Epic',
|
|
8
|
+
Legendary = 'Legendary',
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export enum MysteryBoxItemRewardType {
|
|
12
|
+
Point = 'Point',
|
|
13
|
+
Dollar = 'Dollar',
|
|
14
|
+
Merch = 'Merch',
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export enum MysteryBoxRewardStatus {
|
|
18
|
+
Pending = 'Pending',
|
|
19
|
+
Claimed = 'Claimed',
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
type MysteryBoxItemBase = {
|
|
23
|
+
frequency: MysteryBoxItemFrequency;
|
|
24
|
+
rank: Rank;
|
|
25
|
+
id: number;
|
|
26
|
+
monthlyCount: number;
|
|
27
|
+
image: string;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export type MysteryBoxNumericRewardItem = MysteryBoxItemBase & {
|
|
31
|
+
type: MysteryBoxItemRewardType.Dollar | MysteryBoxItemRewardType.Point;
|
|
32
|
+
value: number;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export type MysteryBoxMerchItem = MysteryBoxItemBase & {
|
|
36
|
+
type: MysteryBoxItemRewardType.Merch;
|
|
37
|
+
value: string;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export type MysteryBoxItem = MysteryBoxNumericRewardItem | MysteryBoxMerchItem;
|
|
41
|
+
|
|
42
|
+
export interface MysteryBoxReward {
|
|
43
|
+
mysteryBoxRewardId: number;
|
|
44
|
+
ethereumAddress: string;
|
|
45
|
+
mysteryBoxItemId: number;
|
|
46
|
+
type: MysteryBoxItemRewardType;
|
|
47
|
+
status: MysteryBoxRewardStatus;
|
|
48
|
+
createdAt: string;
|
|
49
|
+
isOld?: boolean;
|
|
50
|
+
}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { MemberStatus } from './RewardUserEnums';
|
|
2
|
+
|
|
3
|
+
export interface SocialConnection {
|
|
4
|
+
id: string;
|
|
5
|
+
username: string;
|
|
6
|
+
profileImage?: string | null;
|
|
7
|
+
token?: string;
|
|
8
|
+
refreshToken?: string;
|
|
9
|
+
expireDate?: number;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface SocialsConnections {
|
|
13
|
+
discord?: SocialConnection;
|
|
14
|
+
x?: SocialConnection;
|
|
15
|
+
telegram?: SocialConnection;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export enum TaskCategory {
|
|
19
|
+
Welcome = 'welcome',
|
|
20
|
+
Daily = 'daily',
|
|
21
|
+
Brotherhood = 'brotherhood',
|
|
22
|
+
PointsBoost = 'pointsBoost',
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface Task {
|
|
26
|
+
name: TaskTypes;
|
|
27
|
+
header: string;
|
|
28
|
+
description: string;
|
|
29
|
+
points: number;
|
|
30
|
+
category: TaskCategory;
|
|
31
|
+
progressMax: number;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export enum AchievementTiers {
|
|
35
|
+
None = 'None',
|
|
36
|
+
Bronze = 'Bronze',
|
|
37
|
+
Silver = 'Silver',
|
|
38
|
+
Gold = 'Gold',
|
|
39
|
+
Diamond = 'Diamond',
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
interface AchievementTier {
|
|
43
|
+
tier: AchievementTiers;
|
|
44
|
+
progressMax: number;
|
|
45
|
+
points: number;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface Achievement {
|
|
49
|
+
name: TaskTypes;
|
|
50
|
+
header: string;
|
|
51
|
+
description: string;
|
|
52
|
+
tiers: AchievementTier[];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface TelegramUser {
|
|
56
|
+
id: string;
|
|
57
|
+
first_name: string;
|
|
58
|
+
last_name: string;
|
|
59
|
+
auth_date: string;
|
|
60
|
+
hash: string;
|
|
61
|
+
photo_url?: string;
|
|
62
|
+
username?: string;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export enum TaskTypes {
|
|
66
|
+
x = 'x',
|
|
67
|
+
discord = 'discord',
|
|
68
|
+
telegram = 'telegram',
|
|
69
|
+
reclaim = 'reclaim',
|
|
70
|
+
firstSwap = 'firstSwap',
|
|
71
|
+
members = 'members',
|
|
72
|
+
quests = 'quests',
|
|
73
|
+
swaps = 'swaps',
|
|
74
|
+
referrals = 'referrals',
|
|
75
|
+
dApps = 'dApps',
|
|
76
|
+
chains = 'chains',
|
|
77
|
+
dailySwap = 'dailySwap',
|
|
78
|
+
dailyDappTx = 'dailyDappTx',
|
|
79
|
+
xReferral = 'xReferral',
|
|
80
|
+
achievementSwaps = 'achievementSwaps',
|
|
81
|
+
achievementReferrals = 'achievementReferrals',
|
|
82
|
+
achievementDapps = 'achievementDapps',
|
|
83
|
+
achievementChains = 'achievementChains',
|
|
84
|
+
createOrJoinBH = 'createOrJoinBH',
|
|
85
|
+
shieldUnshield = 'shieldUnshield',
|
|
86
|
+
moneyComes = 'moneyComes',
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export enum BrotherhoodTaskTypes {
|
|
90
|
+
swappedChains = 'swappedChains',
|
|
91
|
+
interactedDApps = 'interactedDApps',
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface TaskProgress {
|
|
95
|
+
name: TaskTypes;
|
|
96
|
+
progress: number;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface AchievementProgressItem extends TaskProgress {
|
|
100
|
+
currentTier: AchievementTiers;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export interface SwapStreakBase {
|
|
104
|
+
dailySwapAmount: number;
|
|
105
|
+
dailySwapHappened: boolean;
|
|
106
|
+
dailySwapMultiplier: number;
|
|
107
|
+
dailySwapStreak: number;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export interface SwapStreak extends SwapStreakBase {
|
|
111
|
+
weeklyStreak: Date[];
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export interface SwapStreakClient extends SwapStreakBase {
|
|
115
|
+
weeklyStreak: string[];
|
|
116
|
+
joinedAt?: string;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export interface Address {
|
|
120
|
+
name: string;
|
|
121
|
+
addressLine1: string;
|
|
122
|
+
addressLine2?: string;
|
|
123
|
+
country: string;
|
|
124
|
+
city: string;
|
|
125
|
+
zipCode: string;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export interface RewardsUserInfo {
|
|
129
|
+
ethereumAddress: string;
|
|
130
|
+
username: string;
|
|
131
|
+
migratedSeasonOnePoints: number;
|
|
132
|
+
spentPoints: number;
|
|
133
|
+
lastTvl: number;
|
|
134
|
+
profileImage?: string;
|
|
135
|
+
lastVerify?: string;
|
|
136
|
+
socialsConnections?: SocialsConnections;
|
|
137
|
+
address?: Address | null;
|
|
138
|
+
swappedChains: number[];
|
|
139
|
+
interactedDApps: string[];
|
|
140
|
+
shieldHappened: boolean;
|
|
141
|
+
unshieldHappened: boolean;
|
|
142
|
+
pointsToShowInCongratsPopup: number;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export interface RewardsUser extends RewardsUserInfo, SwapStreak {
|
|
146
|
+
tasksProgress: TaskProgress[];
|
|
147
|
+
achievementsProgress: AchievementProgressItem[];
|
|
148
|
+
completedTasks: string[];
|
|
149
|
+
memberStatus: MemberStatus;
|
|
150
|
+
currentMonthUsdEarnings: number;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export interface BrotherhoodInfo {
|
|
154
|
+
brotherhoodId: number;
|
|
155
|
+
name: string;
|
|
156
|
+
profileImage: string;
|
|
157
|
+
inviteButtonName: string;
|
|
158
|
+
inviteButtonLink: string;
|
|
159
|
+
invitationToken: string;
|
|
160
|
+
isPublic: boolean;
|
|
161
|
+
createdAt: string;
|
|
162
|
+
updatedAt: string;
|
|
163
|
+
members: string[];
|
|
164
|
+
description: string;
|
|
165
|
+
swappedChains: number[];
|
|
166
|
+
interactedDApps: string[];
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export interface Brotherhood extends BrotherhoodInfo {
|
|
170
|
+
tasksProgress: TaskProgress[];
|
|
171
|
+
completedTasks: string[];
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export interface PublicBrotherhoodWithStats {
|
|
175
|
+
allTimeTotalPoints: number;
|
|
176
|
+
weeklyMultiplier: number;
|
|
177
|
+
memberCount: number;
|
|
178
|
+
name: string;
|
|
179
|
+
profileImage: string;
|
|
180
|
+
brotherhoodId: number;
|
|
181
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export enum MessagesFromOffscreen {
|
|
2
|
+
EmitPassword = 'EmitPassword',
|
|
3
|
+
RefreshPublicBalance = 'RefreshPublicBalance',
|
|
4
|
+
RefreshSessions = 'RefreshSessions',
|
|
5
|
+
ChangeNetwork = 'ChangeNetwork',
|
|
6
|
+
UpdateLocationHash = 'UpdateLocationHash',
|
|
7
|
+
AutoShieldTxStatus = 'AutoShieldTxStatus',
|
|
8
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type SubAccount = {
|
|
2
|
+
index: number | null; // positive number for created accounts and null for imported accounts
|
|
3
|
+
ethAddress: string;
|
|
4
|
+
name: string;
|
|
5
|
+
createdAt: string;
|
|
6
|
+
isHidden: boolean;
|
|
7
|
+
privateKey: string;
|
|
8
|
+
isImported: boolean;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export type SubAccountLight = Omit<SubAccount, 'privateKey' | 'isImported'>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface FilledReferredUser {
|
|
2
|
+
referralEthereumAddress: string;
|
|
3
|
+
joinedAt: Date;
|
|
4
|
+
points: number;
|
|
5
|
+
username?: string;
|
|
6
|
+
profileImageUrl?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface Referral {
|
|
10
|
+
ethereumAddress: string;
|
|
11
|
+
referralCode: string;
|
|
12
|
+
referredUsers: FilledReferredUser[];
|
|
13
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface RelayerTransaction {
|
|
2
|
+
to: string;
|
|
3
|
+
from: string;
|
|
4
|
+
contractAddress: string | null;
|
|
5
|
+
gasUsed: { type: string; hex: string };
|
|
6
|
+
logsBloom: string;
|
|
7
|
+
blockHash: string;
|
|
8
|
+
transactionHash: string;
|
|
9
|
+
blockNumber: number;
|
|
10
|
+
confirmations: number;
|
|
11
|
+
cumulativeGasUsed: { type: string; hex: string };
|
|
12
|
+
effectiveGasPrice: { type: string; hex: string };
|
|
13
|
+
status: number;
|
|
14
|
+
type: number;
|
|
15
|
+
byzantium: boolean;
|
|
16
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { NewZkCallDataType } from './snark.types';
|
|
2
|
+
|
|
3
|
+
export type HandshakeResponseType = {
|
|
4
|
+
public_key: string;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export type RemoteProofType = {
|
|
8
|
+
pi_a: string[];
|
|
9
|
+
pi_b: string[][];
|
|
10
|
+
pi_c: string[];
|
|
11
|
+
protocol: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type GenerateProofResponseType = {
|
|
15
|
+
proof: RemoteProofType;
|
|
16
|
+
public_signals: string[];
|
|
17
|
+
zk_calldata: NewZkCallDataType;
|
|
18
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Rank } from './RewardUserEnums';
|
|
2
|
+
|
|
3
|
+
export enum OldPointType {
|
|
4
|
+
CertificationPoints = 'CertificationPoints',
|
|
5
|
+
TradePoints = 'TradePoints',
|
|
6
|
+
LPPoints = 'LPPoints',
|
|
7
|
+
ReferralPoints = 'ReferralPoints',
|
|
8
|
+
GalxePoints = 'GalxePoints',
|
|
9
|
+
ZealyPoints = 'ZealyPoints',
|
|
10
|
+
TaskOnPoints = 'TaskOnPoints',
|
|
11
|
+
BonusPoints = 'BonusPoints',
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export enum RafflePrizeType {
|
|
15
|
+
Gold = 'Gold',
|
|
16
|
+
Silver = 'Silver',
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type CountDown = {
|
|
20
|
+
daysLeft: number;
|
|
21
|
+
hoursLeft: number;
|
|
22
|
+
minutesLeft: number;
|
|
23
|
+
secondsLeft: number;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export interface DailyJobLock {
|
|
27
|
+
day: Date;
|
|
28
|
+
createdAt: Date;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface DailyBoxCounter {
|
|
32
|
+
date: Date;
|
|
33
|
+
rank: string;
|
|
34
|
+
count: number;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface DailyProxyProgress {
|
|
38
|
+
day: Date;
|
|
39
|
+
ethereumAddress: string;
|
|
40
|
+
chainId: number;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface AuctionIntervalLock {
|
|
44
|
+
date: Date;
|
|
45
|
+
rank: Rank;
|
|
46
|
+
intervalStart: Date;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface DailyHinkalContractProgress {
|
|
50
|
+
day: Date;
|
|
51
|
+
contractAddress: string;
|
|
52
|
+
chainId: number;
|
|
53
|
+
}
|