dequanto 0.0.1 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.circleci/config.yml +28 -0
- package/actions/contracts.act.ts +50 -0
- package/actions/logs.act.ts +7 -0
- package/actions/safe.act.ts +7 -0
- package/actions/tokens.act.ts +20 -2
- package/configs/defi.yml +24 -0
- package/configs/dequanto.yml +49 -2
- package/contracts/abi/gnosis/GnosisSafe.json +979 -0
- package/contracts/gen/base/{ERC20Base.ts → ERC20Base/ERC20Base.ts} +136 -90
- package/contracts/gen/eth/WETHBase.ts +35 -35
- package/contracts/gnosis/GnosisSafe.ts +750 -0
- package/contracts/openzeppelin/AccessControl.json +206 -0
- package/contracts/openzeppelin/AccessControl.ts +236 -0
- package/contracts/openzeppelin/AccessControlCrossChain.json +219 -0
- package/contracts/openzeppelin/AccessControlCrossChain.ts +247 -0
- package/contracts/openzeppelin/AccessControlEnumerable.json +249 -0
- package/contracts/openzeppelin/AccessControlEnumerable.ts +258 -0
- package/contracts/openzeppelin/Address.json +1 -0
- package/contracts/openzeppelin/Address.ts +83 -0
- package/contracts/openzeppelin/Arrays.json +1 -0
- package/contracts/openzeppelin/Arrays.ts +83 -0
- package/contracts/openzeppelin/Base64.json +1 -0
- package/contracts/openzeppelin/Base64.ts +83 -0
- package/contracts/openzeppelin/BeaconProxy.json +71 -0
- package/contracts/openzeppelin/BeaconProxy.ts +163 -0
- package/contracts/openzeppelin/BitMaps.json +1 -0
- package/contracts/openzeppelin/BitMaps.ts +83 -0
- package/contracts/openzeppelin/Checkpoints.json +1 -0
- package/contracts/openzeppelin/Checkpoints.ts +83 -0
- package/contracts/openzeppelin/Clones.json +1 -0
- package/contracts/openzeppelin/Clones.ts +83 -0
- package/contracts/openzeppelin/ConditionalEscrow.json +156 -0
- package/contracts/openzeppelin/ConditionalEscrow.ts +236 -0
- package/contracts/openzeppelin/Context.json +1 -0
- package/contracts/openzeppelin/Context.ts +83 -0
- package/contracts/openzeppelin/Counters.json +1 -0
- package/contracts/openzeppelin/Counters.ts +83 -0
- package/contracts/openzeppelin/Create2.json +1 -0
- package/contracts/openzeppelin/Create2.ts +83 -0
- package/contracts/openzeppelin/CrossChainEnabled.json +1 -0
- package/contracts/openzeppelin/CrossChainEnabled.ts +83 -0
- package/contracts/openzeppelin/CrossChainEnabledAMB.json +13 -0
- package/contracts/openzeppelin/CrossChainEnabledAMB.ts +83 -0
- package/contracts/openzeppelin/CrossChainEnabledArbitrumL1.json +1 -0
- package/contracts/openzeppelin/CrossChainEnabledArbitrumL1.ts +83 -0
- package/contracts/openzeppelin/CrossChainEnabledArbitrumL2.json +1 -0
- package/contracts/openzeppelin/CrossChainEnabledArbitrumL2.ts +83 -0
- package/contracts/openzeppelin/CrossChainEnabledOptimism.json +1 -0
- package/contracts/openzeppelin/CrossChainEnabledOptimism.ts +83 -0
- package/contracts/openzeppelin/CrossChainEnabledPolygonChild.json +30 -0
- package/contracts/openzeppelin/CrossChainEnabledPolygonChild.ts +90 -0
- package/contracts/openzeppelin/DoubleEndedQueue.json +12 -0
- package/contracts/openzeppelin/DoubleEndedQueue.ts +83 -0
- package/contracts/openzeppelin/ECDSA.json +1 -0
- package/contracts/openzeppelin/ECDSA.ts +83 -0
- package/contracts/openzeppelin/EIP712.json +1 -0
- package/contracts/openzeppelin/EIP712.ts +83 -0
- package/contracts/openzeppelin/ERC1155.json +325 -0
- package/contracts/openzeppelin/ERC1155.ts +276 -0
- package/contracts/openzeppelin/ERC1155Burnable.json +360 -0
- package/contracts/openzeppelin/ERC1155Burnable.ts +298 -0
- package/contracts/openzeppelin/ERC1155Holder.json +99 -0
- package/contracts/openzeppelin/ERC1155Holder.ts +112 -0
- package/contracts/openzeppelin/ERC1155Pausable.json +353 -0
- package/contracts/openzeppelin/ERC1155Pausable.ts +345 -0
- package/contracts/openzeppelin/ERC1155PresetMinterPauser.json +734 -0
- package/contracts/openzeppelin/ERC1155PresetMinterPauser.ts +608 -0
- package/contracts/openzeppelin/ERC1155Receiver.json +99 -0
- package/contracts/openzeppelin/ERC1155Receiver.ts +112 -0
- package/contracts/openzeppelin/ERC1155Supply.json +352 -0
- package/contracts/openzeppelin/ERC1155Supply.ts +298 -0
- package/contracts/openzeppelin/ERC1155URIStorage.json +314 -0
- package/contracts/openzeppelin/ERC1155URIStorage.ts +276 -0
- package/contracts/openzeppelin/ERC165.json +21 -0
- package/contracts/openzeppelin/ERC165.ts +90 -0
- package/contracts/openzeppelin/ERC165Checker.json +1 -0
- package/contracts/openzeppelin/ERC165Checker.ts +83 -0
- package/contracts/openzeppelin/ERC165Storage.json +21 -0
- package/contracts/openzeppelin/ERC165Storage.ts +90 -0
- package/contracts/openzeppelin/ERC1820Implementer.json +26 -0
- package/contracts/openzeppelin/ERC1820Implementer.ts +90 -0
- package/contracts/openzeppelin/ERC1967Proxy.json +71 -0
- package/contracts/openzeppelin/ERC1967Proxy.ts +163 -0
- package/contracts/openzeppelin/ERC1967Upgrade.json +47 -0
- package/contracts/openzeppelin/ERC1967Upgrade.ts +163 -0
- package/contracts/openzeppelin/ERC20.json +288 -0
- package/contracts/openzeppelin/ERC20.ts +251 -0
- package/contracts/openzeppelin/ERC20Burnable.json +303 -0
- package/contracts/openzeppelin/ERC20Burnable.ts +273 -0
- package/contracts/openzeppelin/ERC20Capped.json +285 -0
- package/contracts/openzeppelin/ERC20Capped.ts +262 -0
- package/contracts/openzeppelin/ERC20FlashMint.json +349 -0
- package/contracts/openzeppelin/ERC20FlashMint.ts +284 -0
- package/contracts/openzeppelin/ERC20Pausable.json +311 -0
- package/contracts/openzeppelin/ERC20Pausable.ts +320 -0
- package/contracts/openzeppelin/ERC20Permit.json +347 -0
- package/contracts/openzeppelin/ERC20Permit.ts +284 -0
- package/contracts/openzeppelin/ERC20PresetFixedSupply.json +329 -0
- package/contracts/openzeppelin/ERC20PresetFixedSupply.ts +273 -0
- package/contracts/openzeppelin/ERC20PresetMinterPauser.json +663 -0
- package/contracts/openzeppelin/ERC20PresetMinterPauser.ts +583 -0
- package/contracts/openzeppelin/ERC20Snapshot.json +328 -0
- package/contracts/openzeppelin/ERC20Snapshot.ts +302 -0
- package/contracts/openzeppelin/ERC20Votes.json +584 -0
- package/contracts/openzeppelin/ERC20Votes.ts +430 -0
- package/contracts/openzeppelin/ERC20VotesComp.json +627 -0
- package/contracts/openzeppelin/ERC20VotesComp.ts +452 -0
- package/contracts/openzeppelin/ERC20Wrapper.json +333 -0
- package/contracts/openzeppelin/ERC20Wrapper.ts +284 -0
- package/contracts/openzeppelin/ERC2771Context.json +21 -0
- package/contracts/openzeppelin/ERC2771Context.ts +90 -0
- package/contracts/openzeppelin/ERC2981.json +50 -0
- package/contracts/openzeppelin/ERC2981.ts +101 -0
- package/contracts/openzeppelin/ERC4626.json +662 -0
- package/contracts/openzeppelin/ERC4626.ts +485 -0
- package/contracts/openzeppelin/ERC721.json +348 -0
- package/contracts/openzeppelin/ERC721.ts +295 -0
- package/contracts/openzeppelin/ERC721Burnable.json +345 -0
- package/contracts/openzeppelin/ERC721Burnable.ts +306 -0
- package/contracts/openzeppelin/ERC721Enumerable.json +388 -0
- package/contracts/openzeppelin/ERC721Enumerable.ts +328 -0
- package/contracts/openzeppelin/ERC721Holder.json +36 -0
- package/contracts/openzeppelin/ERC721Holder.ts +90 -0
- package/contracts/openzeppelin/ERC721Pausable.json +371 -0
- package/contracts/openzeppelin/ERC721Pausable.ts +364 -0
- package/contracts/openzeppelin/ERC721PresetMinterPauserAutoId.json +742 -0
- package/contracts/openzeppelin/ERC721PresetMinterPauserAutoId.ts +638 -0
- package/contracts/openzeppelin/ERC721Royalty.json +361 -0
- package/contracts/openzeppelin/ERC721Royalty.ts +306 -0
- package/contracts/openzeppelin/ERC721URIStorage.json +332 -0
- package/contracts/openzeppelin/ERC721URIStorage.ts +295 -0
- package/contracts/openzeppelin/ERC721Votes.json +546 -0
- package/contracts/openzeppelin/ERC721Votes.ts +441 -0
- package/contracts/openzeppelin/ERC777.json +578 -0
- package/contracts/openzeppelin/ERC777.ts +473 -0
- package/contracts/openzeppelin/ERC777PresetFixedSupply.json +588 -0
- package/contracts/openzeppelin/ERC777PresetFixedSupply.ts +473 -0
- package/contracts/openzeppelin/EnumerableMap.json +1 -0
- package/contracts/openzeppelin/EnumerableMap.ts +83 -0
- package/contracts/openzeppelin/EnumerableSet.json +1 -0
- package/contracts/openzeppelin/EnumerableSet.ts +83 -0
- package/contracts/openzeppelin/Escrow.json +137 -0
- package/contracts/openzeppelin/Escrow.ts +225 -0
- package/contracts/openzeppelin/Governor.json +866 -0
- package/contracts/openzeppelin/Governor.ts +525 -0
- package/contracts/openzeppelin/GovernorCompatibilityBravo.json +1181 -0
- package/contracts/openzeppelin/GovernorCompatibilityBravo.ts +654 -0
- package/contracts/openzeppelin/GovernorCountingSimple.json +895 -0
- package/contracts/openzeppelin/GovernorCountingSimple.ts +536 -0
- package/contracts/openzeppelin/GovernorPreventLateQuorum.json +930 -0
- package/contracts/openzeppelin/GovernorPreventLateQuorum.ts +605 -0
- package/contracts/openzeppelin/GovernorProposalThreshold.json +866 -0
- package/contracts/openzeppelin/GovernorProposalThreshold.ts +525 -0
- package/contracts/openzeppelin/GovernorSettings.json +962 -0
- package/contracts/openzeppelin/GovernorSettings.ts +645 -0
- package/contracts/openzeppelin/GovernorTimelockCompound.json +990 -0
- package/contracts/openzeppelin/GovernorTimelockCompound.ts +638 -0
- package/contracts/openzeppelin/GovernorTimelockControl.json +983 -0
- package/contracts/openzeppelin/GovernorTimelockControl.ts +627 -0
- package/contracts/openzeppelin/GovernorVotes.json +879 -0
- package/contracts/openzeppelin/GovernorVotes.ts +536 -0
- package/contracts/openzeppelin/GovernorVotesComp.json +879 -0
- package/contracts/openzeppelin/GovernorVotesComp.ts +536 -0
- package/contracts/openzeppelin/GovernorVotesQuorumFraction.json +937 -0
- package/contracts/openzeppelin/GovernorVotesQuorumFraction.ts +598 -0
- package/contracts/openzeppelin/IAMB.json +327 -0
- package/contracts/openzeppelin/IAMB.ts +331 -0
- package/contracts/openzeppelin/IAccessControl.json +174 -0
- package/contracts/openzeppelin/IAccessControl.ts +214 -0
- package/contracts/openzeppelin/IAccessControlEnumerable.json +217 -0
- package/contracts/openzeppelin/IAccessControlEnumerable.ts +236 -0
- package/contracts/openzeppelin/IArbSys.json +270 -0
- package/contracts/openzeppelin/IArbSys.ts +233 -0
- package/contracts/openzeppelin/IBeacon.json +15 -0
- package/contracts/openzeppelin/IBeacon.ts +90 -0
- package/contracts/openzeppelin/IBridge.json +296 -0
- package/contracts/openzeppelin/IBridge.ts +287 -0
- package/contracts/openzeppelin/ICompoundTimelock.json +415 -0
- package/contracts/openzeppelin/ICompoundTimelock.ts +389 -0
- package/contracts/openzeppelin/ICrossDomainMessenger.json +101 -0
- package/contracts/openzeppelin/ICrossDomainMessenger.ts +181 -0
- package/contracts/openzeppelin/IERC1155.json +295 -0
- package/contracts/openzeppelin/IERC1155.ts +265 -0
- package/contracts/openzeppelin/IERC1155MetadataURI.json +314 -0
- package/contracts/openzeppelin/IERC1155MetadataURI.ts +276 -0
- package/contracts/openzeppelin/IERC1155Receiver.json +99 -0
- package/contracts/openzeppelin/IERC1155Receiver.ts +112 -0
- package/contracts/openzeppelin/IERC1271.json +26 -0
- package/contracts/openzeppelin/IERC1271.ts +90 -0
- package/contracts/openzeppelin/IERC1363.json +373 -0
- package/contracts/openzeppelin/IERC1363.ts +252 -0
- package/contracts/openzeppelin/IERC1363Receiver.json +36 -0
- package/contracts/openzeppelin/IERC1363Receiver.ts +90 -0
- package/contracts/openzeppelin/IERC1363Spender.json +31 -0
- package/contracts/openzeppelin/IERC1363Spender.ts +90 -0
- package/contracts/openzeppelin/IERC165.json +21 -0
- package/contracts/openzeppelin/IERC165.ts +90 -0
- package/contracts/openzeppelin/IERC1820Implementer.json +26 -0
- package/contracts/openzeppelin/IERC1820Implementer.ts +90 -0
- package/contracts/openzeppelin/IERC1820Registry.json +215 -0
- package/contracts/openzeppelin/IERC1820Registry.ts +218 -0
- package/contracts/openzeppelin/IERC1822Proxiable.json +15 -0
- package/contracts/openzeppelin/IERC1822Proxiable.ts +90 -0
- package/contracts/openzeppelin/IERC20.json +185 -0
- package/contracts/openzeppelin/IERC20.ts +196 -0
- package/contracts/openzeppelin/IERC20Metadata.json +224 -0
- package/contracts/openzeppelin/IERC20Metadata.ts +229 -0
- package/contracts/openzeppelin/IERC20Permit.json +77 -0
- package/contracts/openzeppelin/IERC20Permit.ts +112 -0
- package/contracts/openzeppelin/IERC2612.json +77 -0
- package/contracts/openzeppelin/IERC2612.ts +112 -0
- package/contracts/openzeppelin/IERC2981.json +50 -0
- package/contracts/openzeppelin/IERC2981.ts +101 -0
- package/contracts/openzeppelin/IERC3156FlashBorrower.json +41 -0
- package/contracts/openzeppelin/IERC3156FlashBorrower.ts +90 -0
- package/contracts/openzeppelin/IERC3156FlashLender.json +79 -0
- package/contracts/openzeppelin/IERC3156FlashLender.ts +112 -0
- package/contracts/openzeppelin/IERC4626.json +614 -0
- package/contracts/openzeppelin/IERC4626.ts +463 -0
- package/contracts/openzeppelin/IERC721.json +287 -0
- package/contracts/openzeppelin/IERC721.ts +262 -0
- package/contracts/openzeppelin/IERC721Enumerable.json +343 -0
- package/contracts/openzeppelin/IERC721Enumerable.ts +295 -0
- package/contracts/openzeppelin/IERC721Metadata.json +332 -0
- package/contracts/openzeppelin/IERC721Metadata.ts +295 -0
- package/contracts/openzeppelin/IERC721Receiver.json +36 -0
- package/contracts/openzeppelin/IERC721Receiver.ts +90 -0
- package/contracts/openzeppelin/IERC777.json +393 -0
- package/contracts/openzeppelin/IERC777.ts +360 -0
- package/contracts/openzeppelin/IERC777Recipient.json +40 -0
- package/contracts/openzeppelin/IERC777Recipient.ts +90 -0
- package/contracts/openzeppelin/IERC777Sender.json +40 -0
- package/contracts/openzeppelin/IERC777Sender.ts +90 -0
- package/contracts/openzeppelin/IFxMessageProcessor.json +25 -0
- package/contracts/openzeppelin/IFxMessageProcessor.ts +90 -0
- package/contracts/openzeppelin/IGovernor.json +683 -0
- package/contracts/openzeppelin/IGovernor.ts +448 -0
- package/contracts/openzeppelin/IGovernorCompatibilityBravo.json +913 -0
- package/contracts/openzeppelin/IGovernorCompatibilityBravo.ts +522 -0
- package/contracts/openzeppelin/IGovernorTimelock.json +768 -0
- package/contracts/openzeppelin/IGovernorTimelock.ts +510 -0
- package/contracts/openzeppelin/IInbox.json +377 -0
- package/contracts/openzeppelin/IInbox.ts +273 -0
- package/contracts/openzeppelin/IMessageProvider.json +34 -0
- package/contracts/openzeppelin/IMessageProvider.ts +134 -0
- package/contracts/openzeppelin/IOutbox.json +179 -0
- package/contracts/openzeppelin/IOutbox.ts +218 -0
- package/contracts/openzeppelin/IVotes.json +184 -0
- package/contracts/openzeppelin/IVotes.ts +196 -0
- package/contracts/openzeppelin/Initializable.json +15 -0
- package/contracts/openzeppelin/Initializable.ts +105 -0
- package/contracts/openzeppelin/LibAMB.json +1 -0
- package/contracts/openzeppelin/LibAMB.ts +83 -0
- package/contracts/openzeppelin/LibArbitrumL1.json +1 -0
- package/contracts/openzeppelin/LibArbitrumL1.ts +83 -0
- package/contracts/openzeppelin/LibArbitrumL2.json +15 -0
- package/contracts/openzeppelin/LibArbitrumL2.ts +90 -0
- package/contracts/openzeppelin/LibOptimism.json +1 -0
- package/contracts/openzeppelin/LibOptimism.ts +83 -0
- package/contracts/openzeppelin/Math.json +1 -0
- package/contracts/openzeppelin/Math.ts +83 -0
- package/contracts/openzeppelin/MerkleProof.json +1 -0
- package/contracts/openzeppelin/MerkleProof.ts +83 -0
- package/contracts/openzeppelin/MinimalForwarder.json +143 -0
- package/contracts/openzeppelin/MinimalForwarder.ts +112 -0
- package/contracts/openzeppelin/Multicall.json +21 -0
- package/contracts/openzeppelin/Multicall.ts +90 -0
- package/contracts/openzeppelin/Ownable.json +54 -0
- package/contracts/openzeppelin/Ownable.ts +134 -0
- package/contracts/openzeppelin/Pausable.json +41 -0
- package/contracts/openzeppelin/Pausable.ts +141 -0
- package/contracts/openzeppelin/PaymentSplitter.json +304 -0
- package/contracts/openzeppelin/PaymentSplitter.ts +281 -0
- package/contracts/openzeppelin/Proxy.json +10 -0
- package/contracts/openzeppelin/Proxy.ts +83 -0
- package/contracts/openzeppelin/ProxyAdmin.json +151 -0
- package/contracts/openzeppelin/ProxyAdmin.ts +189 -0
- package/contracts/openzeppelin/PullPayment.json +34 -0
- package/contracts/openzeppelin/PullPayment.ts +101 -0
- package/contracts/openzeppelin/ReentrancyGuard.json +1 -0
- package/contracts/openzeppelin/ReentrancyGuard.ts +83 -0
- package/contracts/openzeppelin/RefundEscrow.json +226 -0
- package/contracts/openzeppelin/RefundEscrow.ts +349 -0
- package/contracts/openzeppelin/SafeCast.json +1 -0
- package/contracts/openzeppelin/SafeCast.ts +83 -0
- package/contracts/openzeppelin/SafeERC20.json +1 -0
- package/contracts/openzeppelin/SafeERC20.ts +83 -0
- package/contracts/openzeppelin/SafeMath.json +1 -0
- package/contracts/openzeppelin/SafeMath.ts +83 -0
- package/contracts/openzeppelin/SignatureChecker.json +1 -0
- package/contracts/openzeppelin/SignatureChecker.ts +83 -0
- package/contracts/openzeppelin/SignedMath.json +1 -0
- package/contracts/openzeppelin/SignedMath.ts +83 -0
- package/contracts/openzeppelin/SignedSafeMath.json +1 -0
- package/contracts/openzeppelin/SignedSafeMath.ts +83 -0
- package/contracts/openzeppelin/StorageSlot.json +1 -0
- package/contracts/openzeppelin/StorageSlot.ts +83 -0
- package/contracts/openzeppelin/Strings.json +1 -0
- package/contracts/openzeppelin/Strings.ts +83 -0
- package/contracts/openzeppelin/TimelockController.json +867 -0
- package/contracts/openzeppelin/TimelockController.ts +583 -0
- package/contracts/openzeppelin/Timers.json +1 -0
- package/contracts/openzeppelin/Timers.ts +83 -0
- package/contracts/openzeppelin/TokenTimelock.json +69 -0
- package/contracts/openzeppelin/TokenTimelock.ts +123 -0
- package/contracts/openzeppelin/TransparentUpgradeableProxy.json +146 -0
- package/contracts/openzeppelin/TransparentUpgradeableProxy.ts +214 -0
- package/contracts/openzeppelin/UUPSUpgradeable.json +91 -0
- package/contracts/openzeppelin/UUPSUpgradeable.ts +192 -0
- package/contracts/openzeppelin/UpgradeableBeacon.json +104 -0
- package/contracts/openzeppelin/UpgradeableBeacon.ts +185 -0
- package/contracts/openzeppelin/VestingWallet.json +193 -0
- package/contracts/openzeppelin/VestingWallet.ts +208 -0
- package/contracts/openzeppelin/Votes.json +216 -0
- package/contracts/openzeppelin/Votes.ts +218 -0
- package/data/evm/eventHashes.json +19314 -0
- package/data/evm/events.json +19314 -0
- package/data/evm/functionHashes.json +121138 -0
- package/data/evm/functions.json +121140 -0
- package/data/tokens/coingecko.json +137409 -0
- package/dist/contracts/gen/base/ERC20Base/ERC20Base.js +94 -0
- package/dist/contracts/gnosis/GnosisSafe.js +357 -0
- package/dist/src/BlockchainExplorer/BlockChainExplorerFactory.js +114 -20
- package/dist/src/BlockchainExplorer/BlockChainExplorerProvider.js +8 -0
- package/dist/src/BlockchainExplorer/Bscscan.js +1 -0
- package/dist/src/BlockchainExplorer/Etherscan.js +14 -4
- package/dist/src/BlockchainExplorer/Evmscan.js +9 -0
- package/dist/src/BlockchainExplorer/Polyscan.js +1 -0
- package/dist/src/ChainAccountProvider.js +89 -0
- package/dist/src/ChainAccountsService.js +20 -2
- package/dist/src/Config.js +76 -0
- package/dist/src/blocks/BlockDateResolver.js +9 -8
- package/dist/src/bridges/hop/HopBridge.js +5 -2
- package/dist/src/chains/PlatformFactory.js +2 -2
- package/dist/src/chains/arbitrum/ArbWeb3Client.js +5 -24
- package/dist/src/chains/arbitrum/TokensServiceArbitrum.js +18 -0
- package/dist/src/chains/boba/BobaWeb3Client.js +5 -33
- package/dist/src/chains/xdai/XDaiWeb3Client.js +6 -30
- package/dist/src/class/SubjectKind.js +9 -0
- package/dist/src/class/SubjectStream.js +104 -0
- package/dist/src/class/Subscription.js +13 -0
- package/dist/src/clients/BscWeb3Client.js +5 -24
- package/dist/src/clients/ClientEventsStream.js +62 -18
- package/dist/src/clients/ClientPool.js +115 -55
- package/dist/src/clients/EthWeb3Client.js +7 -22
- package/dist/src/clients/EvmWeb3Client.js +25 -0
- package/dist/src/clients/HardhatWeb3Client.js +19 -40
- package/dist/src/clients/PolyWeb3Client.js +5 -51
- package/dist/src/clients/Web3Client.js +355 -10
- package/dist/src/clients/Web3ClientFactory.js +15 -0
- package/dist/src/clients/debug/ClientDebugMethods.js +64 -0
- package/dist/src/clients/utils/ClientEndpoints.js +6 -0
- package/dist/src/clients/utils/TxFactory.js +7 -12
- package/dist/src/contracts/Contract.js +2 -1
- package/dist/src/contracts/ContractAbiProvider.js +58 -0
- package/dist/src/contracts/ContractBase.js +161 -26
- package/dist/src/contracts/ContractReader.js +78 -2
- package/dist/src/contracts/ContractStorageReaderBase.js +15 -0
- package/dist/src/contracts/ContractStream.js +21 -8
- package/dist/src/contracts/ContractWriter.js +47 -20
- package/dist/src/contracts/TxContract.js +6 -3
- package/dist/src/contracts/common/ERC20.js +1 -1
- package/dist/src/contracts/utils/AbiDeserializer.js +15 -5
- package/dist/src/contracts/utils/InputDataUtils.js +5 -2
- package/dist/src/env/BigIntSerializer.js +2 -1
- package/dist/src/evm/EVM.js +214 -0
- package/dist/src/evm/OpcodesWalker.js +137 -0
- package/dist/src/evm/Stack.js +57 -0
- package/dist/src/evm/interfaces/IJumps.js +2 -0
- package/dist/src/evm/interfaces/IMemory.js +2 -0
- package/dist/src/evm/interfaces/IOpcode.js +2 -0
- package/dist/src/evm/interfaces/IStorage.js +2 -0
- package/dist/src/evm/opcodes/add.js +50 -0
- package/dist/src/evm/opcodes/addmod.js +19 -0
- package/dist/src/evm/opcodes/address.js +17 -0
- package/dist/src/evm/opcodes/and.js +56 -0
- package/dist/src/evm/opcodes/balance.js +22 -0
- package/dist/src/evm/opcodes/blockhash.js +22 -0
- package/dist/src/evm/opcodes/byte.js +30 -0
- package/dist/src/evm/opcodes/call.js +48 -0
- package/dist/src/evm/opcodes/callcode.js +48 -0
- package/dist/src/evm/opcodes/calldatacopy.js +27 -0
- package/dist/src/evm/opcodes/calldataload.js +33 -0
- package/dist/src/evm/opcodes/calldatasize.js +16 -0
- package/dist/src/evm/opcodes/caller.js +17 -0
- package/dist/src/evm/opcodes/callvalue.js +16 -0
- package/dist/src/evm/opcodes/codecopy.js +31 -0
- package/dist/src/evm/opcodes/codesize.js +16 -0
- package/dist/src/evm/opcodes/coinbase.js +16 -0
- package/dist/src/evm/opcodes/create.js +35 -0
- package/dist/src/evm/opcodes/create2.js +34 -0
- package/dist/src/evm/opcodes/delegatecall.js +44 -0
- package/dist/src/evm/opcodes/difficulty.js +16 -0
- package/dist/src/evm/opcodes/div.js +33 -0
- package/dist/src/evm/opcodes/dup.js +6 -0
- package/dist/src/evm/opcodes/eq.js +69 -0
- package/dist/src/evm/opcodes/exp.js +30 -0
- package/dist/src/evm/opcodes/extcodecopy.js +35 -0
- package/dist/src/evm/opcodes/extcodehash.js +22 -0
- package/dist/src/evm/opcodes/extcodesize.js +22 -0
- package/dist/src/evm/opcodes/gas.js +16 -0
- package/dist/src/evm/opcodes/gaslimit.js +16 -0
- package/dist/src/evm/opcodes/gasprice.js +16 -0
- package/dist/src/evm/opcodes/gt.js +36 -0
- package/dist/src/evm/opcodes/invalid.js +18 -0
- package/dist/src/evm/opcodes/iszero.js +51 -0
- package/dist/src/evm/opcodes/jump.js +66 -0
- package/dist/src/evm/opcodes/jumpdest.js +5 -0
- package/dist/src/evm/opcodes/jumpi.js +298 -0
- package/dist/src/evm/opcodes/log.js +74 -0
- package/dist/src/evm/opcodes/lt.js +36 -0
- package/dist/src/evm/opcodes/mload.js +28 -0
- package/dist/src/evm/opcodes/mod.js +30 -0
- package/dist/src/evm/opcodes/msize.js +16 -0
- package/dist/src/evm/opcodes/mstore.js +30 -0
- package/dist/src/evm/opcodes/mul.js +34 -0
- package/dist/src/evm/opcodes/mulmod.js +19 -0
- package/dist/src/evm/opcodes/not.js +28 -0
- package/dist/src/evm/opcodes/number.js +16 -0
- package/dist/src/evm/opcodes/or.js +30 -0
- package/dist/src/evm/opcodes/origin.js +16 -0
- package/dist/src/evm/opcodes/pc.js +5 -0
- package/dist/src/evm/opcodes/pop.js +5 -0
- package/dist/src/evm/opcodes/push.js +6 -0
- package/dist/src/evm/opcodes/return.js +70 -0
- package/dist/src/evm/opcodes/returndatacopy.js +31 -0
- package/dist/src/evm/opcodes/returndatasize.js +16 -0
- package/dist/src/evm/opcodes/revert.js +57 -0
- package/dist/src/evm/opcodes/sar.js +30 -0
- package/dist/src/evm/opcodes/selfdestruct.js +23 -0
- package/dist/src/evm/opcodes/sha3.js +56 -0
- package/dist/src/evm/opcodes/shl.js +35 -0
- package/dist/src/evm/opcodes/shr.js +30 -0
- package/dist/src/evm/opcodes/signextend.js +19 -0
- package/dist/src/evm/opcodes/sload.js +140 -0
- package/dist/src/evm/opcodes/sstore.js +189 -0
- package/dist/src/evm/opcodes/staticcall.js +44 -0
- package/dist/src/evm/opcodes/stop.js +17 -0
- package/dist/src/evm/opcodes/sub.js +30 -0
- package/dist/src/evm/opcodes/swap.js +6 -0
- package/dist/src/evm/opcodes/timestamp.js +16 -0
- package/dist/src/evm/opcodes/xor.js +30 -0
- package/dist/src/evm/opcodes.js +192 -0
- package/dist/src/evm/tx.class.js +154 -0
- package/dist/src/evm/utils/BigNumber.js +14 -0
- package/dist/src/evm/utils/hex.js +44 -0
- package/dist/src/evm/utils/opcodes.js +217 -0
- package/dist/src/evm/utils/stringify.js +14 -0
- package/dist/src/evm/utils/stringifyEvents.js +38 -0
- package/dist/src/evm/utils/stringifyFunctions.js +70 -0
- package/dist/src/evm/utils/stringifyInstructions.js +44 -0
- package/dist/src/evm/utils/stringifyMappings.js +62 -0
- package/dist/src/evm/utils/stringifyStructs.js +16 -0
- package/dist/src/evm/utils/stringifyVariables.js +33 -0
- package/dist/src/gen/ContractStorageReaderTemplate.js +11 -0
- package/dist/src/gen/Generator.js +37 -16
- package/dist/src/gen/GeneratorFromAbi.js +225 -72
- package/dist/src/gen/GeneratorStorageReader.js +89 -0
- package/dist/src/gen/utils/$gen.js +14 -0
- package/dist/src/gen/utils/Str.js +47 -0
- package/dist/src/hardhat/HardhatProvider.js +177 -0
- package/dist/src/indexer/BlocksTxIndexer.js +19 -7
- package/dist/src/indexer/handlers/BlocksWalker.js +65 -54
- package/dist/src/loggers/LoggerService.js +8 -5
- package/dist/src/models/TAccount.js +2 -0
- package/dist/src/ns/NameService.js +3 -0
- package/dist/src/ns/utils/$ns.js +6 -3
- package/dist/src/safe/$gnosis.js +23 -0
- package/dist/src/safe/GnosisSafeFactory.js +27 -0
- package/dist/src/safe/GnosisSafeHandler.js +361 -0
- package/dist/src/safe/transport/FileServiceTransport.js +92 -0
- package/dist/src/safe/transport/GnosisServiceTransport.js +78 -0
- package/dist/src/safe/transport/ISafeServiceTransport.js +2 -0
- package/dist/src/safe/transport/InMemoryServiceTransport.js +56 -0
- package/dist/src/solidity/SlotsParser.js +594 -0
- package/dist/src/solidity/SlotsStorage.js +158 -0
- package/dist/src/solidity/storage/Accessor.js +126 -0
- package/dist/src/solidity/storage/SlotDynamicArray.js +17 -0
- package/dist/src/solidity/storage/SlotFixedArray.js +28 -0
- package/dist/src/solidity/storage/SlotsStorageHandler.js +10 -0
- package/dist/src/solidity/storage/SlotsStorageTransport.js +126 -0
- package/dist/src/solidity/storage/handlers/SlotDynamicArrayHandler.js +47 -0
- package/dist/src/solidity/storage/handlers/SlotFixedArrayHandler.js +50 -0
- package/dist/src/solidity/storage/handlers/SlotMappingHandler.js +42 -0
- package/dist/src/solidity/storage/handlers/SlotStringHandler.js +109 -0
- package/dist/src/solidity/storage/handlers/SlotStructHandler.js +45 -0
- package/dist/src/solidity/storage/handlers/SlotValueHandler.js +30 -0
- package/dist/src/solidity/utils/$str.js +38 -0
- package/dist/src/solidity/utils/$types.js +22 -0
- package/dist/src/structs/PackedRanges.js +8 -1
- package/dist/src/tokens/TokenDataProvider.js +251 -0
- package/dist/src/tokens/TokenExchanges/AmmBase/V2/AmmPairV2Service.js +3 -1
- package/dist/src/tokens/TokenExchanges/AmmV2ExchangeBase.js +4 -4
- package/dist/src/tokens/TokenExchanges/PancakeswapExchange.js +4 -7
- package/dist/src/tokens/TokenExchanges/SushiswapPolygonExchange.js +4 -5
- package/dist/src/tokens/TokenExchanges/UniswapExchange.js +4 -7
- package/dist/src/tokens/TokenOracles/AmmPriceV2Oracle.js +2 -4
- package/dist/src/tokens/TokenOracles/CoingeckoOracle.js +12 -0
- package/dist/src/tokens/TokenOracles/TokenPriceStore.js +1 -1
- package/dist/src/tokens/TokenProviders/TPChain.js +14 -7
- package/dist/src/tokens/TokenProviders/TPCoingecko.js +117 -0
- package/dist/src/tokens/TokenProviders/TPConfig.js +46 -0
- package/dist/src/tokens/TokenProviders/TPExplorer.js +35 -0
- package/dist/src/tokens/TokenService.js +5 -2
- package/dist/src/tokens/TokenTransferService.js +28 -18
- package/dist/src/tokens/TokensService.js +32 -177
- package/dist/src/tokens/TokensServiceFactory.js +13 -1
- package/dist/src/txs/TxDataBuilder.js +54 -22
- package/dist/src/txs/TxLogger.js +3 -3
- package/dist/src/txs/TxWriter.js +169 -37
- package/dist/src/txs/receipt/TxLogParser.js +11 -1
- package/dist/src/txs/receipt/TxLogsTransfer.js +14 -13
- package/dist/src/txs/receipt/TxTopicProvider.js +10 -6
- package/dist/src/txs/sig-transports/SigFileTransport.js +48 -0
- package/dist/src/utils/$abiParser.js +55 -20
- package/dist/src/utils/$abiType.js +184 -3
- package/dist/src/utils/$abiUtils.js +54 -5
- package/dist/src/utils/$account.js +30 -0
- package/dist/src/utils/$address.js +8 -0
- package/dist/src/utils/$bigint.js +52 -3
- package/dist/src/utils/$block.js +16 -0
- package/dist/src/utils/$bloom.js +42 -0
- package/dist/src/utils/$buffer.js +94 -0
- package/dist/src/utils/$cli.js +20 -0
- package/dist/src/utils/$color.js +171 -0
- package/dist/src/utils/$config.js +65 -5
- package/dist/src/utils/$const.js +4 -0
- package/dist/src/utils/$contract.js +20 -2
- package/dist/src/utils/$crypto.js +25 -0
- package/dist/src/utils/$csv.js +17 -27
- package/dist/src/utils/$date.js +129 -25
- package/dist/src/utils/$gas.js +15 -0
- package/dist/src/utils/$hex.js +77 -0
- package/dist/src/utils/$is.js +24 -21
- package/dist/src/utils/$logger.js +56 -3
- package/dist/src/utils/$machine.js +77 -0
- package/dist/src/utils/$number.js +24 -1
- package/dist/src/utils/$path.js +17 -0
- package/dist/src/utils/$promise.js +81 -0
- package/dist/src/utils/$require.js +15 -1
- package/dist/src/utils/$secret.js +29 -0
- package/dist/src/utils/$sign.js +96 -14
- package/dist/src/utils/$signRaw.js +48 -0
- package/dist/src/utils/$signSerializer.js +5 -4
- package/dist/src/utils/$txData.js +19 -0
- package/hardhat.config.js +21 -1
- package/package.json +28 -14
- package/readme.md +21 -4
- package/src/BlockchainExplorer/BlockChainExplorerFactory.ts +149 -39
- package/src/BlockchainExplorer/BlockChainExplorerProvider.ts +10 -0
- package/src/BlockchainExplorer/Bscscan.ts +1 -0
- package/src/BlockchainExplorer/Etherscan.ts +17 -5
- package/src/BlockchainExplorer/Evmscan.ts +8 -0
- package/src/BlockchainExplorer/IBlockChainExplorer.ts +3 -2
- package/src/BlockchainExplorer/Polyscan.ts +1 -0
- package/src/ChainAccountProvider.ts +84 -0
- package/src/ChainAccountsService.ts +21 -2
- package/src/Config.ts +85 -0
- package/src/blocks/BlockDateResolver.ts +10 -12
- package/src/bridges/hop/HopBridge.ts +9 -2
- package/src/bridges/hop/contracts/polygon/Dai_l2AmmWrapperContract.ts +35 -35
- package/src/bridges/hop/contracts/polygon/Dai_l2BridgeContract.ts +35 -35
- package/src/bridges/hop/contracts/polygon/Dai_l2SaddleSwapContract.ts +35 -35
- package/src/bridges/hop/contracts/polygon/Eth_l2AmmWrapperContract.ts +35 -35
- package/src/bridges/hop/contracts/polygon/Eth_l2BridgeContract.ts +35 -35
- package/src/bridges/hop/contracts/polygon/Eth_l2SaddleSwapContract.ts +35 -35
- package/src/bridges/hop/contracts/polygon/Matic_l2AmmWrapperContract.ts +35 -35
- package/src/bridges/hop/contracts/polygon/Matic_l2BridgeContract.ts +35 -35
- package/src/bridges/hop/contracts/polygon/Matic_l2SaddleSwapContract.ts +35 -35
- package/src/bridges/hop/contracts/polygon/Usdc_l2AmmWrapperContract.ts +35 -35
- package/src/bridges/hop/contracts/polygon/Usdc_l2BridgeContract.ts +35 -35
- package/src/bridges/hop/contracts/polygon/Usdc_l2SaddleSwapContract.ts +35 -35
- package/src/bridges/hop/contracts/polygon/Usdt_l2AmmWrapperContract.ts +35 -35
- package/src/bridges/hop/contracts/polygon/Usdt_l2BridgeContract.ts +35 -35
- package/src/bridges/hop/contracts/polygon/Usdt_l2SaddleSwapContract.ts +35 -35
- package/src/bridges/hop/contracts/polygon/Wbtc_l2AmmWrapperContract.ts +35 -35
- package/src/bridges/hop/contracts/polygon/Wbtc_l2BridgeContract.ts +35 -35
- package/src/bridges/hop/contracts/polygon/Wbtc_l2SaddleSwapContract.ts +35 -35
- package/src/bridges/models/IBridge.ts +1 -1
- package/src/chains/PlatformFactory.ts +3 -2
- package/src/chains/arbitrum/ArbWeb3Client.ts +7 -22
- package/src/chains/arbitrum/TokensServiceArbitrum.ts +19 -0
- package/src/chains/boba/BobaWeb3Client.ts +5 -33
- package/src/chains/xdai/XDaiWeb3Client.ts +6 -32
- package/src/class/SubjectKind.ts +5 -0
- package/src/class/SubjectStream.ts +111 -0
- package/src/class/Subscription.ts +7 -0
- package/src/clients/BscWeb3Client.ts +5 -22
- package/src/clients/ClientEventsStream.ts +86 -19
- package/src/clients/ClientPool.ts +145 -61
- package/src/clients/EthWeb3Client.ts +8 -21
- package/src/clients/EvmWeb3Client.ts +26 -0
- package/src/clients/HardhatWeb3Client.ts +17 -39
- package/src/clients/PolyWeb3Client.ts +5 -54
- package/src/clients/Web3Client.ts +430 -32
- package/src/clients/Web3ClientFactory.ts +17 -1
- package/src/clients/debug/ClientDebugMethods.ts +75 -0
- package/src/clients/interfaces/IWeb3Client.ts +33 -5
- package/src/clients/interfaces/IWeb3EndpointOptions.ts +6 -0
- package/src/clients/utils/ClientEndpoints.ts +6 -0
- package/src/clients/utils/TxFactory.ts +13 -13
- package/src/contracts/Contract.ts +3 -2
- package/src/contracts/ContractAbiProvider.ts +68 -0
- package/src/contracts/ContractBase.ts +205 -36
- package/src/contracts/ContractReader.ts +116 -3
- package/src/contracts/ContractStorageReaderBase.ts +26 -0
- package/src/contracts/ContractStream.ts +24 -6
- package/src/contracts/ContractWriter.ts +58 -28
- package/src/contracts/TxContract.ts +7 -4
- package/src/contracts/common/ERC20.ts +1 -1
- package/src/contracts/utils/AbiDeserializer.ts +16 -7
- package/src/contracts/utils/InputDataUtils.ts +8 -6
- package/src/env/BigIntSerializer.ts +3 -1
- package/src/evm/EVM.ts +246 -0
- package/src/evm/OpcodesWalker.ts +149 -0
- package/src/evm/Stack.ts +58 -0
- package/src/evm/interfaces/IJumps.ts +3 -0
- package/src/evm/interfaces/IMemory.ts +3 -0
- package/src/evm/interfaces/IOpcode.ts +11 -0
- package/src/evm/interfaces/IStorage.ts +3 -0
- package/src/evm/opcodes/add.ts +49 -0
- package/src/evm/opcodes/addmod.ts +19 -0
- package/src/evm/opcodes/address.ts +22 -0
- package/src/evm/opcodes/and.ts +58 -0
- package/src/evm/opcodes/balance.ts +25 -0
- package/src/evm/opcodes/blockhash.ts +25 -0
- package/src/evm/opcodes/byte.ts +34 -0
- package/src/evm/opcodes/call.ts +69 -0
- package/src/evm/opcodes/callcode.ts +69 -0
- package/src/evm/opcodes/calldatacopy.ts +36 -0
- package/src/evm/opcodes/calldataload.ts +40 -0
- package/src/evm/opcodes/calldatasize.ts +21 -0
- package/src/evm/opcodes/caller.ts +22 -0
- package/src/evm/opcodes/callvalue.ts +21 -0
- package/src/evm/opcodes/codecopy.ts +37 -0
- package/src/evm/opcodes/codesize.ts +21 -0
- package/src/evm/opcodes/coinbase.ts +21 -0
- package/src/evm/opcodes/create.ts +42 -0
- package/src/evm/opcodes/create2.ts +41 -0
- package/src/evm/opcodes/delegatecall.ts +63 -0
- package/src/evm/opcodes/difficulty.ts +21 -0
- package/src/evm/opcodes/div.ts +35 -0
- package/src/evm/opcodes/dup.ts +7 -0
- package/src/evm/opcodes/eq.ts +92 -0
- package/src/evm/opcodes/exp.ts +34 -0
- package/src/evm/opcodes/extcodecopy.ts +42 -0
- package/src/evm/opcodes/extcodehash.ts +25 -0
- package/src/evm/opcodes/extcodesize.ts +25 -0
- package/src/evm/opcodes/gas.ts +21 -0
- package/src/evm/opcodes/gaslimit.ts +21 -0
- package/src/evm/opcodes/gasprice.ts +21 -0
- package/src/evm/opcodes/gt.ts +39 -0
- package/src/evm/opcodes/invalid.ts +24 -0
- package/src/evm/opcodes/iszero.ts +48 -0
- package/src/evm/opcodes/jump.ts +66 -0
- package/src/evm/opcodes/jumpdest.ts +6 -0
- package/src/evm/opcodes/jumpi.ts +367 -0
- package/src/evm/opcodes/log.ts +89 -0
- package/src/evm/opcodes/lt.ts +39 -0
- package/src/evm/opcodes/mload.ts +30 -0
- package/src/evm/opcodes/mod.ts +33 -0
- package/src/evm/opcodes/msize.ts +21 -0
- package/src/evm/opcodes/mstore.ts +33 -0
- package/src/evm/opcodes/mul.ts +38 -0
- package/src/evm/opcodes/mulmod.ts +19 -0
- package/src/evm/opcodes/not.ts +30 -0
- package/src/evm/opcodes/number.ts +21 -0
- package/src/evm/opcodes/or.ts +33 -0
- package/src/evm/opcodes/origin.ts +21 -0
- package/src/evm/opcodes/pc.ts +7 -0
- package/src/evm/opcodes/pop.ts +6 -0
- package/src/evm/opcodes/push.ts +8 -0
- package/src/evm/opcodes/return.ts +78 -0
- package/src/evm/opcodes/returndatacopy.ts +37 -0
- package/src/evm/opcodes/returndatasize.ts +21 -0
- package/src/evm/opcodes/revert.ts +64 -0
- package/src/evm/opcodes/sar.ts +33 -0
- package/src/evm/opcodes/selfdestruct.ts +26 -0
- package/src/evm/opcodes/sha3.ts +63 -0
- package/src/evm/opcodes/shl.ts +42 -0
- package/src/evm/opcodes/shr.ts +33 -0
- package/src/evm/opcodes/signextend.ts +25 -0
- package/src/evm/opcodes/sload.ts +190 -0
- package/src/evm/opcodes/sstore.ts +259 -0
- package/src/evm/opcodes/staticcall.ts +63 -0
- package/src/evm/opcodes/stop.ts +22 -0
- package/src/evm/opcodes/sub.ts +33 -0
- package/src/evm/opcodes/swap.ts +7 -0
- package/src/evm/opcodes/timestamp.ts +21 -0
- package/src/evm/opcodes/xor.ts +33 -0
- package/src/evm/opcodes.ts +207 -0
- package/src/evm/tx.class.ts +137 -0
- package/src/evm/utils/BigNumber.ts +9 -0
- package/src/evm/utils/hex.ts +37 -0
- package/src/evm/utils/opcodes.ts +213 -0
- package/src/evm/utils/stringify.ts +12 -0
- package/src/evm/utils/stringifyEvents.ts +37 -0
- package/src/evm/utils/stringifyFunctions.ts +41 -0
- package/src/evm/utils/stringifyInstructions.ts +38 -0
- package/src/evm/utils/stringifyMappings.ts +65 -0
- package/src/evm/utils/stringifyStructs.ts +16 -0
- package/src/evm/utils/stringifyVariables.ts +32 -0
- package/src/gen/ContractStorageReaderTemplate.ts +18 -0
- package/src/gen/ContractTemplate.ts +41 -7
- package/src/gen/Generator.ts +50 -19
- package/src/gen/GeneratorFromAbi.ts +239 -67
- package/src/gen/GeneratorStorageReader.ts +113 -0
- package/src/gen/utils/$gen.ts +11 -0
- package/src/gen/utils/Str.ts +40 -0
- package/src/handlers/TokenHandler.ts +1 -1
- package/src/hardhat/HardhatProvider.ts +207 -0
- package/src/indexer/BlocksTxIndexer.ts +36 -10
- package/src/indexer/handlers/BlocksWalker.ts +81 -62
- package/src/indexer/handlers/TxQueueLoader.ts +7 -7
- package/src/json/JsonObjectStore.ts +1 -1
- package/src/loggers/LoggerService.ts +9 -5
- package/src/loggers/TxLoggerService.ts +1 -1
- package/src/models/IToken.ts +9 -0
- package/src/models/TAccount.ts +30 -0
- package/src/models/TBufferLike.ts +2 -2
- package/src/models/TPlatform.ts +1 -1
- package/src/ns/NameService.ts +3 -0
- package/src/ns/utils/$ns.ts +3 -4
- package/src/safe/$gnosis.ts +20 -0
- package/src/safe/GnosisSafeFactory.ts +40 -0
- package/src/safe/GnosisSafeHandler.ts +432 -0
- package/src/safe/transport/FileServiceTransport.ts +115 -0
- package/src/safe/transport/GnosisServiceTransport.ts +83 -0
- package/src/safe/transport/ISafeServiceTransport.ts +26 -0
- package/src/safe/transport/InMemoryServiceTransport.ts +79 -0
- package/src/solidity/SlotsParser.ts +650 -0
- package/src/solidity/SlotsStorage.ts +177 -0
- package/src/solidity/storage/Accessor.spec.ts +45 -0
- package/src/solidity/storage/Accessor.ts +136 -0
- package/src/solidity/storage/SlotDynamicArray.ts +46 -0
- package/src/solidity/storage/SlotFixedArray.ts +31 -0
- package/src/solidity/storage/SlotsStorageHandler.ts +17 -0
- package/src/solidity/storage/SlotsStorageTransport.ts +152 -0
- package/src/solidity/storage/handlers/SlotDynamicArrayHandler.ts +52 -0
- package/src/solidity/storage/handlers/SlotFixedArrayHandler.ts +52 -0
- package/src/solidity/storage/handlers/SlotMappingHandler.ts +52 -0
- package/src/solidity/storage/handlers/SlotStringHandler.ts +130 -0
- package/src/solidity/storage/handlers/SlotStructHandler.ts +46 -0
- package/src/solidity/storage/handlers/SlotValueHandler.ts +36 -0
- package/src/solidity/utils/$str.ts +36 -0
- package/src/solidity/utils/$types.ts +16 -0
- package/src/structs/PackedRanges.ts +9 -3
- package/src/tokens/TokenDataProvider.ts +271 -0
- package/src/tokens/TokenExchanges/AmmBase/V2/AmmPairV2Service.ts +3 -1
- package/src/tokens/TokenExchanges/AmmV2ExchangeBase.ts +4 -3
- package/src/tokens/TokenExchanges/OneInchExchange.ts +1 -1
- package/src/tokens/TokenExchanges/PancakeswapExchange.ts +5 -10
- package/src/tokens/TokenExchanges/SushiswapPolygonExchange.ts +8 -5
- package/src/tokens/TokenExchanges/UniswapExchange.ts +6 -9
- package/src/tokens/TokenOracles/AmmPriceV2Oracle.ts +5 -5
- package/src/tokens/TokenOracles/CoingeckoOracle.ts +13 -0
- package/src/tokens/TokenOracles/TokenPriceStore.ts +1 -1
- package/src/tokens/TokenPriceService.ts +0 -1
- package/src/tokens/TokenProviders/ITokenProvider.ts +1 -1
- package/src/tokens/TokenProviders/TPChain.ts +20 -8
- package/src/tokens/TokenProviders/TPCoingecko.ts +121 -0
- package/src/tokens/TokenProviders/TPConfig.ts +53 -0
- package/src/tokens/TokenProviders/TPExplorer.ts +41 -0
- package/src/tokens/TokenService.ts +6 -3
- package/src/tokens/TokenSwapService.ts +1 -1
- package/src/tokens/TokenTransferService.ts +40 -24
- package/src/tokens/TokensService.ts +34 -179
- package/src/tokens/TokensServiceFactory.ts +13 -1
- package/src/tokens/defi/ISwapService.ts +1 -1
- package/src/tokens/defi/paraswap/Paraswap.ts +2 -1
- package/src/txs/ITxConfig.ts +1 -1
- package/src/txs/TxDataBuilder.ts +78 -34
- package/src/txs/TxLogger.ts +4 -4
- package/src/txs/TxWriter.ts +245 -48
- package/src/txs/conditional/GasWatcherTx.ts +0 -1
- package/src/txs/receipt/ITxLogItem.ts +8 -5
- package/src/txs/receipt/TxLogParser.ts +13 -2
- package/src/txs/receipt/TxLogsTransfer.ts +15 -15
- package/src/txs/receipt/TxTopicInMemoryProvider.ts +1 -1
- package/src/txs/receipt/TxTopicProvider.ts +7 -7
- package/src/txs/sig-transports/SigFileTransport.ts +52 -0
- package/src/utils/$abiParser.spec.ts +90 -0
- package/src/utils/$abiParser.ts +60 -25
- package/src/utils/$abiType.ts +195 -5
- package/src/utils/$abiUtils.ts +57 -6
- package/src/utils/$account.ts +30 -0
- package/src/utils/$address.ts +5 -0
- package/src/utils/$bigint.ts +56 -3
- package/src/utils/$block.ts +14 -1
- package/src/utils/$bloom.ts +43 -0
- package/src/utils/$buffer.ts +114 -0
- package/src/utils/$cli.ts +16 -0
- package/src/utils/$color.ts +211 -0
- package/src/utils/$config.ts +70 -7
- package/src/utils/$const.ts +1 -0
- package/src/utils/$contract.ts +21 -3
- package/src/utils/$crypto.ts +33 -0
- package/src/utils/$csv.ts +23 -7
- package/src/utils/$date.ts +194 -40
- package/src/utils/$gas.ts +17 -0
- package/src/utils/$hex.ts +72 -0
- package/src/utils/$is.ts +24 -22
- package/src/utils/$logger.ts +60 -2
- package/src/utils/$machine.ts +85 -0
- package/src/utils/$number.ts +24 -1
- package/src/utils/$path.ts +17 -1
- package/src/utils/$promise.ts +101 -0
- package/src/utils/$require.ts +15 -1
- package/src/utils/$secret.ts +27 -0
- package/src/utils/$sign.ts +115 -16
- package/src/utils/$signRaw.ts +50 -0
- package/src/utils/$signSerializer.ts +8 -6
- package/src/utils/$txData.ts +16 -0
- package/src/utils/$wallet.ts +1 -1
- package/test/Batch.spec.ts +89 -0
- package/test/BlockChainExplorer.spec.ts +33 -0
- package/test/ChainAccount.spec.ts +1 -1
- package/test/client.spec.ts +10 -11
- package/test/config.js +8 -0
- package/test/config.spec.ts +31 -0
- package/test/ecrecover.spec.ts +49 -0
- package/test/fixtures/contracts/Counter.sol +25 -0
- package/test/fixtures/contracts/Ecrecover.sol +33 -0
- package/test/fixtures/contracts/Foo.sol +32 -0
- package/test/fixtures/contracts/Foo.ts +78 -0
- package/test/fixtures/contracts/FreeToken.sol +263 -0
- package/test/fixtures/explorer/0xfbD2aa7efA2B46Ce3c58D7ab0D92C176c71499C0.html +2788 -0
- package/test/fixtures/gnosis/GnosisSafe.sol +422 -0
- package/test/fixtures/gnosis/GnosisSafeL2.sol +86 -0
- package/test/fixtures/gnosis/accessors/SimulateTxAccessor.sol +52 -0
- package/test/fixtures/gnosis/base/Executor.sol +27 -0
- package/test/fixtures/gnosis/base/FallbackManager.sol +53 -0
- package/test/fixtures/gnosis/base/GuardManager.sol +62 -0
- package/test/fixtures/gnosis/base/ModuleManager.sol +133 -0
- package/test/fixtures/gnosis/base/OwnerManager.sol +149 -0
- package/test/fixtures/gnosis/common/Enum.sol +8 -0
- package/test/fixtures/gnosis/common/EtherPaymentFallback.sol +13 -0
- package/test/fixtures/gnosis/common/SecuredTokenTransfer.sol +35 -0
- package/test/fixtures/gnosis/common/SelfAuthorized.sol +16 -0
- package/test/fixtures/gnosis/common/SignatureDecoder.sol +36 -0
- package/test/fixtures/gnosis/common/Singleton.sol +11 -0
- package/test/fixtures/gnosis/common/StorageAccessible.sol +47 -0
- package/test/fixtures/gnosis/external/GnosisSafeMath.sol +54 -0
- package/test/fixtures/gnosis/interfaces/ERC1155TokenReceiver.sol +49 -0
- package/test/fixtures/gnosis/interfaces/ERC721TokenReceiver.sol +24 -0
- package/test/fixtures/gnosis/interfaces/ERC777TokensRecipient.sol +13 -0
- package/test/fixtures/gnosis/interfaces/IERC165.sol +15 -0
- package/test/fixtures/gnosis/interfaces/ISignatureValidator.sol +20 -0
- package/test/fixtures/gnosis/interfaces/ViewStorageAccessible.sol +11 -0
- package/test/fixtures/gnosis/libraries/CreateCall.sol +30 -0
- package/test/fixtures/gnosis/libraries/GnosisSafeStorage.sol +21 -0
- package/test/fixtures/gnosis/libraries/MultiSend.sol +66 -0
- package/test/fixtures/gnosis/libraries/MultiSendCallOnly.sol +61 -0
- package/test/fixtures/gnosis/libraries/SignMessageLib.sol +34 -0
- package/test/fixtures/gnosis/proxies/GnosisSafeProxy.sol +44 -0
- package/test/fixtures/gnosis/proxies/GnosisSafeProxyFactory.sol +107 -0
- package/test/fixtures/gnosis/proxies/IProxyCreationCallback.sol +12 -0
- package/test/fixtures/scan/WETH.sol +1533 -0
- package/test/fixtures/slots/FooStorage.sol +8 -0
- package/test/fixtures/slots/FooStorageBase.sol +6 -0
- package/test/fixtures/slots/Vault.sol +85 -0
- package/test/generate/class.spec.ts +144 -6
- package/test/generate/evm.spec.ts +64 -0
- package/test/generate/openzeppelin.spec.ts +18 -0
- package/test/generate/slotreader.spec.ts +34 -0
- package/test/hardhat/TestNode.ts +37 -9
- package/test/hardhat/deploy.spec.ts +22 -0
- package/test/indexer/BlocksWalker.spec.ts +51 -0
- package/test/ns.spec.ts +4 -0
- package/test/receipt.spec.ts +1 -4
- package/test/safe/tx.act.ts +194 -0
- package/test/solidity/SlotsParser.spec.ts +186 -0
- package/test/solidity/SlotsReader.spec.ts +168 -0
- package/test/solidity/Storage.spec.ts +328 -0
- package/test/structs/PackedRanges.spec.ts +56 -0
- package/test/subscriptions.spec.ts +127 -0
- package/test/token.spec.ts +11 -0
- package/test/utils/abi-types.spec.ts +31 -0
- package/test/utils/abi-utils.spec.ts +23 -0
- package/test/utils/bigint.spec.ts +0 -1
- package/test/utils/date.spec.ts +3 -2
- package/test/utils/logbloom.spec.ts +17 -0
- package/test/utils/number.spec.ts +14 -3
- package/test/utils/sign.spec.ts +43 -7
- package/src/ChainAccounts.ts +0 -72
- package/src/structs/PackedRanges.spec.ts +0 -38
package/dist/src/utils/$is.js
CHANGED
|
@@ -3,31 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.$is = void 0;
|
|
4
4
|
var $is;
|
|
5
5
|
(function ($is) {
|
|
6
|
-
function Number(val
|
|
7
|
-
|
|
8
|
-
throw new Error(`Value is not a number. ${message}`);
|
|
9
|
-
}
|
|
10
|
-
if (opts?.min != null && val < opts.min) {
|
|
11
|
-
throw new Error(`Value ${val} is less than ${opts.min}. ${message}`);
|
|
12
|
-
}
|
|
13
|
-
if (opts?.max != null && val > opts.max) {
|
|
14
|
-
throw new Error(`Value ${val} is greater than ${opts.max}. ${message}`);
|
|
15
|
-
}
|
|
16
|
-
return val;
|
|
6
|
+
function Number(val) {
|
|
7
|
+
return typeof val === 'number' && isNaN(val) === false;
|
|
17
8
|
}
|
|
18
9
|
$is.Number = Number;
|
|
19
|
-
function notNull(val
|
|
20
|
-
|
|
21
|
-
throw new Error(`Value is undefined. ${message}`);
|
|
22
|
-
}
|
|
23
|
-
return val;
|
|
10
|
+
function notNull(val) {
|
|
11
|
+
return val != null;
|
|
24
12
|
}
|
|
25
13
|
$is.notNull = notNull;
|
|
26
|
-
function BigInt(val
|
|
27
|
-
|
|
28
|
-
throw new Error(`Value is undefined. ${message}`);
|
|
29
|
-
}
|
|
30
|
-
return val;
|
|
14
|
+
function BigInt(val) {
|
|
15
|
+
return typeof val === 'bigint';
|
|
31
16
|
}
|
|
32
17
|
$is.BigInt = BigInt;
|
|
33
18
|
function Address(val, message) {
|
|
@@ -37,4 +22,22 @@ var $is;
|
|
|
37
22
|
return /^0x[a-fA-F0-9]{40}$/g.test(val);
|
|
38
23
|
}
|
|
39
24
|
$is.Address = Address;
|
|
25
|
+
function TxHash(val) {
|
|
26
|
+
if (hexString(val) === false) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
// 0x115f9d0e3c5d7538eb27466cf42ac68527703a14e93c0d1243131164af2d1c6c
|
|
30
|
+
if (val.length !== 2 + 64) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
$is.TxHash = TxHash;
|
|
36
|
+
function hexString(str) {
|
|
37
|
+
if (typeof str !== 'string') {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
return /^0x[\da-f]+$/i.test(str);
|
|
41
|
+
}
|
|
42
|
+
$is.hexString = hexString;
|
|
40
43
|
})($is = exports.$is || (exports.$is = {}));
|
|
@@ -1,15 +1,68 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.$logger = void 0;
|
|
3
|
+
exports.l = exports.$logger = void 0;
|
|
4
|
+
const _color_1 = require("./$color");
|
|
4
5
|
const _date_1 = require("./$date");
|
|
5
6
|
var $logger;
|
|
6
7
|
(function ($logger) {
|
|
7
8
|
function log(...args) {
|
|
8
|
-
|
|
9
|
+
if (args.length === 1 && typeof args[0] !== 'string') {
|
|
10
|
+
console.dir(args[0], { depth: null });
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
console.log(_date_1.$date.format(new Date(), 'HH:mm:ss'), ...colored(args));
|
|
9
14
|
}
|
|
10
15
|
$logger.log = log;
|
|
11
16
|
function warn(...args) {
|
|
12
|
-
console.warn(_date_1.$date.format(new Date(), 'HH:mm:ss'), ...args);
|
|
17
|
+
console.warn(_date_1.$date.format(new Date(), 'HH:mm:ss'), ...colored(args));
|
|
13
18
|
}
|
|
14
19
|
$logger.warn = warn;
|
|
20
|
+
function error(...args) {
|
|
21
|
+
console.error(_date_1.$date.format(new Date(), 'HH:mm:ss'), ...colored(args));
|
|
22
|
+
}
|
|
23
|
+
$logger.error = error;
|
|
24
|
+
function colored(args) {
|
|
25
|
+
for (let i = 0; i < args.length; i++) {
|
|
26
|
+
let x = args[i];
|
|
27
|
+
if (typeof x !== 'string') {
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
args[i] = (0, _color_1.$color)(args[i]);
|
|
31
|
+
}
|
|
32
|
+
return args;
|
|
33
|
+
}
|
|
15
34
|
})($logger = exports.$logger || (exports.$logger = {}));
|
|
35
|
+
function l(strings, ...values) {
|
|
36
|
+
let args = [];
|
|
37
|
+
for (let i = 0; i < strings.length; i++) {
|
|
38
|
+
args.push(strings[i]);
|
|
39
|
+
if (i < values.length) {
|
|
40
|
+
args.push(values[i]);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
// join value types if should be colorized: l`Age: bold<${age}>`
|
|
44
|
+
for (let i = 1; i < args.length - 1; i++) {
|
|
45
|
+
let before = args[i - 1];
|
|
46
|
+
let value = args[i];
|
|
47
|
+
let after = args[i + 1];
|
|
48
|
+
if (typeof before !== 'string' || typeof after !== 'string') {
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
switch (typeof value) {
|
|
52
|
+
case 'number':
|
|
53
|
+
case 'string':
|
|
54
|
+
case 'boolean':
|
|
55
|
+
case 'undefined':
|
|
56
|
+
case 'bigint':
|
|
57
|
+
break;
|
|
58
|
+
default:
|
|
59
|
+
// skip all non-value types.
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
args[i - 1] = `${before}${value}${after}`;
|
|
63
|
+
args.splice(i, 2);
|
|
64
|
+
i--;
|
|
65
|
+
}
|
|
66
|
+
$logger.log(...args);
|
|
67
|
+
}
|
|
68
|
+
exports.l = l;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.$machine = void 0;
|
|
4
|
+
var $machine;
|
|
5
|
+
(function ($machine) {
|
|
6
|
+
function id(original = false) {
|
|
7
|
+
return new Promise((resolve, reject) => {
|
|
8
|
+
const { exec } = require('child_process');
|
|
9
|
+
return exec(getCommand(), {}, (err, stdout, stderr) => {
|
|
10
|
+
if (err) {
|
|
11
|
+
return reject(new Error(`Error while obtaining machine id: ${err.stack}`));
|
|
12
|
+
}
|
|
13
|
+
let id = extractId(stdout.toString());
|
|
14
|
+
return resolve(original ? id : hash(id));
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
$machine.id = id;
|
|
19
|
+
function hash(guid) {
|
|
20
|
+
const { createHash } = require('crypto');
|
|
21
|
+
return createHash('sha256').update(guid).digest('hex');
|
|
22
|
+
}
|
|
23
|
+
function getCommand() {
|
|
24
|
+
let { platform } = process;
|
|
25
|
+
let win32RegBinPath = {
|
|
26
|
+
native: '%windir%\\System32',
|
|
27
|
+
mixed: '%windir%\\sysnative\\cmd.exe /c %windir%\\System32'
|
|
28
|
+
};
|
|
29
|
+
let guid = {
|
|
30
|
+
darwin: 'ioreg -rd1 -c IOPlatformExpertDevice',
|
|
31
|
+
win32: `${win32RegBinPath[isWindowsProcessMixedOrNativeArchitecture()]}\\REG.exe ` +
|
|
32
|
+
'QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography ' +
|
|
33
|
+
'/v MachineGuid',
|
|
34
|
+
linux: '( cat /var/lib/dbus/machine-id /etc/machine-id 2> /dev/null || hostname ) | head -n 1 || :',
|
|
35
|
+
freebsd: 'kenv -q smbios.system.uuid || sysctl -n kern.hostuuid'
|
|
36
|
+
};
|
|
37
|
+
function isWindowsProcessMixedOrNativeArchitecture() {
|
|
38
|
+
// detect if the node binary is the same arch as the Windows OS.
|
|
39
|
+
// or if this is 32 bit node on 64 bit windows.
|
|
40
|
+
if (process.platform !== 'win32') {
|
|
41
|
+
return '';
|
|
42
|
+
}
|
|
43
|
+
if (process.arch === 'ia32' && process.env.hasOwnProperty('PROCESSOR_ARCHITEW6432')) {
|
|
44
|
+
return 'mixed';
|
|
45
|
+
}
|
|
46
|
+
return 'native';
|
|
47
|
+
}
|
|
48
|
+
return guid[platform];
|
|
49
|
+
}
|
|
50
|
+
function extractId(result) {
|
|
51
|
+
switch (process.platform) {
|
|
52
|
+
case 'darwin':
|
|
53
|
+
return result
|
|
54
|
+
.split('IOPlatformUUID')[1]
|
|
55
|
+
.split('\n')[0].replace(/\=|\s+|\"/ig, '')
|
|
56
|
+
.toLowerCase();
|
|
57
|
+
case 'win32':
|
|
58
|
+
return result
|
|
59
|
+
.toString()
|
|
60
|
+
.split('REG_SZ')[1]
|
|
61
|
+
.replace(/\r+|\n+|\s+/ig, '')
|
|
62
|
+
.toLowerCase();
|
|
63
|
+
case 'linux':
|
|
64
|
+
return result
|
|
65
|
+
.toString()
|
|
66
|
+
.replace(/\r+|\n+|\s+/ig, '')
|
|
67
|
+
.toLowerCase();
|
|
68
|
+
case 'freebsd':
|
|
69
|
+
return result
|
|
70
|
+
.toString()
|
|
71
|
+
.replace(/\r+|\n+|\s+/ig, '')
|
|
72
|
+
.toLowerCase();
|
|
73
|
+
default:
|
|
74
|
+
throw new Error(`Unsupported platform: ${process.platform}`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
})($machine = exports.$machine || (exports.$machine = {}));
|
|
@@ -49,7 +49,26 @@ var $number;
|
|
|
49
49
|
if (typeof mix === 'number') {
|
|
50
50
|
return mix;
|
|
51
51
|
}
|
|
52
|
-
|
|
52
|
+
let factor = null;
|
|
53
|
+
// string
|
|
54
|
+
let c = mix[mix.length - 1];
|
|
55
|
+
if (c === 'k' || c === 'K') {
|
|
56
|
+
factor = 1000;
|
|
57
|
+
mix = mix.substring(0, mix.length - 1);
|
|
58
|
+
}
|
|
59
|
+
if (c === 'm' || c === 'M') {
|
|
60
|
+
factor = 1000000;
|
|
61
|
+
mix = mix.substring(0, mix.length - 1);
|
|
62
|
+
}
|
|
63
|
+
if (c === 'b' || c === 'B') {
|
|
64
|
+
factor = 1000000000;
|
|
65
|
+
mix = mix.substring(0, mix.length - 1);
|
|
66
|
+
}
|
|
67
|
+
let value = parseFloat(mix.replace(/,+/g, '.'));
|
|
68
|
+
if (factor != null) {
|
|
69
|
+
value *= factor;
|
|
70
|
+
}
|
|
71
|
+
return value;
|
|
53
72
|
}
|
|
54
73
|
$number.parse = parse;
|
|
55
74
|
function round(mix, digits = 0, round = 'round') {
|
|
@@ -92,4 +111,8 @@ var $number;
|
|
|
92
111
|
throw new Error('Unsupported type to convert to number ' + typeof mix);
|
|
93
112
|
}
|
|
94
113
|
$number.parseOptional = parseOptional;
|
|
114
|
+
function toHex(num) {
|
|
115
|
+
return `0x` + Number(num).toString(16);
|
|
116
|
+
}
|
|
117
|
+
$number.toHex = toHex;
|
|
95
118
|
})($number = exports.$number || (exports.$number = {}));
|
package/dist/src/utils/$path.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.$path = void 0;
|
|
4
4
|
const atma_utils_1 = require("atma-utils");
|
|
5
|
+
const _config_1 = require("./$config");
|
|
5
6
|
var $path;
|
|
6
7
|
(function ($path) {
|
|
7
8
|
let root = null;
|
|
@@ -9,7 +10,23 @@ var $path;
|
|
|
9
10
|
return atma_utils_1.class_Uri.combine(root ?? (root = getRoot()), path);
|
|
10
11
|
}
|
|
11
12
|
$path.resolve = resolve;
|
|
13
|
+
function isAbsolute(path) {
|
|
14
|
+
if (path[0] === '/') {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
let hasProtocol = /^[\w]{2,5}:[\\\/]{2,}/.test(path);
|
|
18
|
+
if (hasProtocol) {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
$path.isAbsolute = isAbsolute;
|
|
12
24
|
function getRoot() {
|
|
25
|
+
let base = _config_1.$config.get('settings.base');
|
|
26
|
+
if (base != null) {
|
|
27
|
+
let cwd = process.cwd();
|
|
28
|
+
return atma_utils_1.class_Uri.combine('file://' + cwd, base);
|
|
29
|
+
}
|
|
13
30
|
let uri = new atma_utils_1.class_Uri('file://' + __dirname + '/');
|
|
14
31
|
while (true) {
|
|
15
32
|
let dir = getDirName(uri.path);
|
|
@@ -10,4 +10,85 @@ var $promise;
|
|
|
10
10
|
}
|
|
11
11
|
$promise.wait = wait;
|
|
12
12
|
;
|
|
13
|
+
function fromEvent(eventEmitter, event) {
|
|
14
|
+
return new Promise((resolve, reject) => {
|
|
15
|
+
const cb = (value) => {
|
|
16
|
+
resolve(value);
|
|
17
|
+
eventEmitter.off(event, cb);
|
|
18
|
+
};
|
|
19
|
+
eventEmitter.on(event, cb);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
$promise.fromEvent = fromEvent;
|
|
23
|
+
function timeout(promise, ms) {
|
|
24
|
+
let err = new Error(`Promise timeouted in ${ms}ms`);
|
|
25
|
+
return new Promise((resolve, reject) => {
|
|
26
|
+
let completed = false;
|
|
27
|
+
let timeout = setTimeout(() => {
|
|
28
|
+
if (completed) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
completed = true;
|
|
32
|
+
reject(err);
|
|
33
|
+
}, ms);
|
|
34
|
+
promise.then(result => {
|
|
35
|
+
completed = true;
|
|
36
|
+
clearTimeout(timeout);
|
|
37
|
+
resolve(result);
|
|
38
|
+
}, err => {
|
|
39
|
+
completed = true;
|
|
40
|
+
clearTimeout(timeout);
|
|
41
|
+
reject(err);
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
$promise.timeout = timeout;
|
|
46
|
+
function waitForTrue(check, opts) {
|
|
47
|
+
return waitForObject(async () => {
|
|
48
|
+
let result = await check();
|
|
49
|
+
return [null, result === true ? {} : null];
|
|
50
|
+
}, opts);
|
|
51
|
+
}
|
|
52
|
+
$promise.waitForTrue = waitForTrue;
|
|
53
|
+
function waitForObject(check, opts) {
|
|
54
|
+
let start = Date.now();
|
|
55
|
+
let completed = false;
|
|
56
|
+
let intervalMs = opts?.intervalMs ?? 500;
|
|
57
|
+
let timeoutMs = opts?.timeoutMs ?? null;
|
|
58
|
+
let timeoutMessage = opts?.timeoutMessage ?? `Waiting for object timeouted`;
|
|
59
|
+
return new Promise(async (resolve, reject) => {
|
|
60
|
+
async function tick() {
|
|
61
|
+
let [error, result] = (await check()) ?? [null, null];
|
|
62
|
+
if (result != null) {
|
|
63
|
+
completed = true;
|
|
64
|
+
resolve(result);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
if (error != null) {
|
|
68
|
+
completed = true;
|
|
69
|
+
reject(error);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if (timeoutMs != null && (Date.now() - start) > timeoutMs) {
|
|
73
|
+
completed = true;
|
|
74
|
+
let message = typeof timeoutMessage === 'function'
|
|
75
|
+
? timeoutMessage()
|
|
76
|
+
: timeoutMessage;
|
|
77
|
+
reject(new Error(message));
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
while (true) {
|
|
82
|
+
try {
|
|
83
|
+
await tick();
|
|
84
|
+
}
|
|
85
|
+
finally { }
|
|
86
|
+
if (completed === true) {
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
await $promise.wait(intervalMs);
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
$promise.waitForObject = waitForObject;
|
|
13
94
|
})($promise = exports.$promise || (exports.$promise = {}));
|
|
@@ -45,11 +45,18 @@ var $require;
|
|
|
45
45
|
$require.Numeric = Numeric;
|
|
46
46
|
function Function(val, message) {
|
|
47
47
|
if (typeof val !== 'function') {
|
|
48
|
-
throw new Error(`Value is not a function`);
|
|
48
|
+
throw new Error(`Value is not a function ${message}`);
|
|
49
49
|
}
|
|
50
50
|
return val;
|
|
51
51
|
}
|
|
52
52
|
$require.Function = Function;
|
|
53
|
+
function String(val, message) {
|
|
54
|
+
if (typeof val !== 'string') {
|
|
55
|
+
throw new Error(`Value ${val} is not a string ${message}`);
|
|
56
|
+
}
|
|
57
|
+
return val;
|
|
58
|
+
}
|
|
59
|
+
$require.String = String;
|
|
53
60
|
function notNull(val, message) {
|
|
54
61
|
if (val == null) {
|
|
55
62
|
throw new Error(`Value is undefined. ${message}`);
|
|
@@ -100,6 +107,13 @@ var $require;
|
|
|
100
107
|
return val;
|
|
101
108
|
}
|
|
102
109
|
$require.Address = Address;
|
|
110
|
+
function TxHash(val, message = '') {
|
|
111
|
+
if (_is_1.$is.TxHash(val) === false) {
|
|
112
|
+
throw new Error(`Value ${val} is not a valid tx hash. ${message}`);
|
|
113
|
+
}
|
|
114
|
+
return val;
|
|
115
|
+
}
|
|
116
|
+
$require.TxHash = TxHash;
|
|
103
117
|
function Token(token, message = '') {
|
|
104
118
|
if (token == null) {
|
|
105
119
|
throw new Error(`Token is undefined. ${message}`);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.$secret = void 0;
|
|
4
|
+
const _machine_1 = require("./$machine");
|
|
5
|
+
var $secret;
|
|
6
|
+
(function ($secret) {
|
|
7
|
+
async function getPin(parameters) {
|
|
8
|
+
let pin = parameters?.pin ?? getPinFromCli() ?? getPinFromEnv();
|
|
9
|
+
if (pin == null || pin.length === 0) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
let id = await _machine_1.$machine.id();
|
|
13
|
+
return `${id}:${pin}`;
|
|
14
|
+
}
|
|
15
|
+
$secret.getPin = getPin;
|
|
16
|
+
function getPinFromCli() {
|
|
17
|
+
let args = process.argv;
|
|
18
|
+
for (let i = 0; i < args.length - 1; i++) {
|
|
19
|
+
let key = args[i].replace(/^\-+/, '');
|
|
20
|
+
if (key === 'p' || key === 'pin') {
|
|
21
|
+
return args[i + 1];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
function getPinFromEnv() {
|
|
27
|
+
return process.env.PIN;
|
|
28
|
+
}
|
|
29
|
+
})($secret = exports.$secret || (exports.$secret = {}));
|
package/dist/src/utils/$sign.js
CHANGED
|
@@ -1,14 +1,85 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.$sign = void 0;
|
|
4
|
-
const
|
|
4
|
+
const _buffer_1 = require("./$buffer");
|
|
5
|
+
const _is_1 = require("./$is");
|
|
6
|
+
const ethers_1 = require("ethers");
|
|
5
7
|
var $sign;
|
|
6
8
|
(function ($sign) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
/** Adds "Ethereum Signed Message" */
|
|
10
|
+
async function signEIPHashed(client, message, account, accountPss) {
|
|
11
|
+
const web3 = await client.getWeb3();
|
|
12
|
+
//const buffer = toBuffer(message);
|
|
13
|
+
//const hash = hashPersonalMessage(buffer as Buffer);
|
|
14
|
+
const str = message;
|
|
15
|
+
const key = account.key != null
|
|
16
|
+
? account.key
|
|
17
|
+
: null;
|
|
18
|
+
if (key != null) {
|
|
19
|
+
let sig = web3.eth.accounts.sign(str, key);
|
|
20
|
+
let r = sig.r.substring(2);
|
|
21
|
+
let s = sig.s.substring(2);
|
|
22
|
+
let v = sig.v.substring(2);
|
|
23
|
+
return toSignature({ r, s, v });
|
|
24
|
+
}
|
|
25
|
+
let signature = accountPss == null
|
|
26
|
+
? await web3.eth.sign(message.toString(), account.address)
|
|
27
|
+
: await web3.eth.personal.sign(message.toString(), account.address, accountPss);
|
|
28
|
+
return toSignature(splitSignature(signature));
|
|
29
|
+
}
|
|
30
|
+
$sign.signEIPHashed = signEIPHashed;
|
|
31
|
+
async function signTx(client, tx, account, accountPss) {
|
|
32
|
+
const web3 = await client.getWeb3();
|
|
33
|
+
const key = account.key != null
|
|
34
|
+
? account.key
|
|
35
|
+
: null;
|
|
36
|
+
if (key != null) {
|
|
37
|
+
if (typeof tx.chainId === 'string') {
|
|
38
|
+
// chainIDBN in @ethereumjs supports HEX only if base is specified, otherwise 10 base is taken, and hex numbers are wrongly parsed to a number
|
|
39
|
+
tx.chainId = Number(tx.chainId);
|
|
40
|
+
}
|
|
41
|
+
let sig = await web3.eth.accounts.signTransaction(tx, key);
|
|
42
|
+
return toSignature(sig);
|
|
43
|
+
}
|
|
44
|
+
let signed = accountPss == null
|
|
45
|
+
? await web3.eth.signTransaction(tx)
|
|
46
|
+
: await web3.eth.personal.signTransaction(tx, accountPss);
|
|
47
|
+
return toSignature(signed.tx);
|
|
48
|
+
}
|
|
49
|
+
$sign.signTx = signTx;
|
|
50
|
+
async function serializeTx(tx, signature) {
|
|
51
|
+
let sig = getSignature(signature);
|
|
52
|
+
if (Number(sig.v) === 0) {
|
|
53
|
+
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md
|
|
54
|
+
sig.v = '0x25';
|
|
55
|
+
}
|
|
56
|
+
return ethers_1.ethers.utils.serializeTransaction(tx, {
|
|
57
|
+
...sig,
|
|
58
|
+
v: Number(sig.v)
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
$sign.serializeTx = serializeTx;
|
|
62
|
+
async function recoverTx(client, tx, signature) {
|
|
63
|
+
const web3 = await client.getWeb3();
|
|
64
|
+
const sig = getSignature(signature);
|
|
65
|
+
const rawTransaction = await serializeTx(tx, sig);
|
|
66
|
+
return web3.eth.accounts.recoverTransaction(rawTransaction);
|
|
67
|
+
}
|
|
68
|
+
$sign.recoverTx = recoverTx;
|
|
69
|
+
function splitSignature(signature) {
|
|
70
|
+
let r = signature.substring(2, 2 + 64);
|
|
71
|
+
let s = signature.substring(2 + 64, 2 + 64 + 64);
|
|
72
|
+
let v = signature.substring(2 + 64 + 64);
|
|
73
|
+
return { r, s, v };
|
|
74
|
+
}
|
|
75
|
+
function toSignature(sign) {
|
|
76
|
+
let { r, s, v } = sign;
|
|
77
|
+
r = remove0x(r);
|
|
78
|
+
s = remove0x(s);
|
|
79
|
+
if (typeof v === 'number') {
|
|
80
|
+
v = v.toString(16);
|
|
81
|
+
}
|
|
82
|
+
v = remove0x(v);
|
|
12
83
|
return {
|
|
13
84
|
v: `0x${v}`,
|
|
14
85
|
r: `0x${r}`,
|
|
@@ -17,19 +88,30 @@ var $sign;
|
|
|
17
88
|
signatureVRS: `0x${v}${r}${s}`
|
|
18
89
|
};
|
|
19
90
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const hash = (0, ethereumjs_util_1.hashPersonalMessage)(toBuffer(message, { encoding: 'utf8' }));
|
|
23
|
-
return signEC(hash, privateKey);
|
|
91
|
+
function remove0x(hex) {
|
|
92
|
+
return hex.startsWith('0x') ? hex.substring(2) : hex;
|
|
24
93
|
}
|
|
25
|
-
$sign.signEIPHashed = signEIPHashed;
|
|
26
94
|
function toBuffer(message, opts) {
|
|
27
95
|
if (typeof message === 'string') {
|
|
28
|
-
|
|
29
|
-
|
|
96
|
+
let encoding = opts?.encoding;
|
|
97
|
+
if (encoding == null && _is_1.$is.hexString(message)) {
|
|
98
|
+
encoding = 'hex';
|
|
99
|
+
message = message.substring(2);
|
|
30
100
|
}
|
|
31
|
-
|
|
101
|
+
if (encoding === 'hex') {
|
|
102
|
+
return _buffer_1.$buffer.fromHex(message);
|
|
103
|
+
}
|
|
104
|
+
return _buffer_1.$buffer.fromString(message, opts?.encoding ?? 'utf8');
|
|
32
105
|
}
|
|
33
106
|
return message;
|
|
34
107
|
}
|
|
108
|
+
function getSignature(signature) {
|
|
109
|
+
let sig = typeof signature === 'string'
|
|
110
|
+
? splitSignature(signature)
|
|
111
|
+
: signature;
|
|
112
|
+
if (sig?.r == null || sig?.v == null || sig?.s == null) {
|
|
113
|
+
throw new Error(`Invalid signature ${JSON.stringify(sig)}`);
|
|
114
|
+
}
|
|
115
|
+
return sig;
|
|
116
|
+
}
|
|
35
117
|
})($sign = exports.$sign || (exports.$sign = {}));
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.$signRaw = void 0;
|
|
4
|
+
const ethereumjs_util_1 = require("ethereumjs-util");
|
|
5
|
+
const _buffer_1 = require("./$buffer");
|
|
6
|
+
const _is_1 = require("./$is");
|
|
7
|
+
const ethers_1 = require("ethers");
|
|
8
|
+
var $signRaw;
|
|
9
|
+
(function ($signRaw) {
|
|
10
|
+
function signEC(message, privateKey) {
|
|
11
|
+
const sig = (0, ethereumjs_util_1.ecsign)(toBuffer(message), toBuffer(privateKey, { encoding: 'hex' }));
|
|
12
|
+
let r = sig.r.toString('hex').padStart(64, '0');
|
|
13
|
+
let s = sig.s.toString('hex').padStart(64, '0');
|
|
14
|
+
let v = sig.v.toString(16);
|
|
15
|
+
return {
|
|
16
|
+
v: `0x${v}`,
|
|
17
|
+
r: `0x${r}`,
|
|
18
|
+
s: `0x${s}`,
|
|
19
|
+
signature: `0x${r}${s}${v}`,
|
|
20
|
+
signatureVRS: `0x${v}${r}${s}`
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
$signRaw.signEC = signEC;
|
|
24
|
+
function signEIPHashed(message, privateKey) {
|
|
25
|
+
const buffer = toBuffer(message);
|
|
26
|
+
const hash = (0, ethereumjs_util_1.hashPersonalMessage)(buffer);
|
|
27
|
+
return signEC(hash, privateKey);
|
|
28
|
+
}
|
|
29
|
+
$signRaw.signEIPHashed = signEIPHashed;
|
|
30
|
+
function ecrecover(message, signature) {
|
|
31
|
+
return ethers_1.utils.recoverAddress(message, signature);
|
|
32
|
+
}
|
|
33
|
+
$signRaw.ecrecover = ecrecover;
|
|
34
|
+
function toBuffer(message, opts) {
|
|
35
|
+
if (typeof message === 'string') {
|
|
36
|
+
let encoding = opts?.encoding;
|
|
37
|
+
if (encoding == null && _is_1.$is.hexString(message)) {
|
|
38
|
+
encoding = 'hex';
|
|
39
|
+
message = message.substring(2);
|
|
40
|
+
}
|
|
41
|
+
if (encoding === 'hex') {
|
|
42
|
+
return _buffer_1.$buffer.fromHex(message);
|
|
43
|
+
}
|
|
44
|
+
return _buffer_1.$buffer.fromString(message, opts?.encoding ?? 'utf8');
|
|
45
|
+
}
|
|
46
|
+
return message;
|
|
47
|
+
}
|
|
48
|
+
})($signRaw = exports.$signRaw || (exports.$signRaw = {}));
|
|
@@ -26,6 +26,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
exports.$signSerializer = void 0;
|
|
27
27
|
const ethUtil = __importStar(require("ethereumjs-util"));
|
|
28
28
|
const ethAbi = __importStar(require("ethereumjs-abi"));
|
|
29
|
+
const _buffer_1 = require("./$buffer");
|
|
29
30
|
var $signSerializer;
|
|
30
31
|
(function ($signSerializer) {
|
|
31
32
|
const TYPED_MESSAGE_SCHEMA = {
|
|
@@ -96,7 +97,7 @@ var $signSerializer;
|
|
|
96
97
|
if (type === 'string') {
|
|
97
98
|
// convert string to buffer - prevents ethUtil from interpreting strings like '0xabcd' as hex
|
|
98
99
|
if (typeof value === 'string') {
|
|
99
|
-
value =
|
|
100
|
+
value = _buffer_1.$buffer.fromString(value);
|
|
100
101
|
}
|
|
101
102
|
return ['bytes32', ethUtil_keccak(value)];
|
|
102
103
|
}
|
|
@@ -129,7 +130,7 @@ var $signSerializer;
|
|
|
129
130
|
encodedTypes.push('bytes32');
|
|
130
131
|
// convert string to buffer - prevents ethUtil from interpreting strings like '0xabcd' as hex
|
|
131
132
|
if (typeof value === 'string') {
|
|
132
|
-
value =
|
|
133
|
+
value = _buffer_1.$buffer.fromString(value, 'utf8');
|
|
133
134
|
}
|
|
134
135
|
value = ethUtil_keccak(value);
|
|
135
136
|
encodedValues.push(value);
|
|
@@ -241,12 +242,12 @@ var $signSerializer;
|
|
|
241
242
|
*/
|
|
242
243
|
serialize(typedData, useV4 = true) {
|
|
243
244
|
const sanitizedData = this.sanitizeData(typedData);
|
|
244
|
-
const parts = [
|
|
245
|
+
const parts = [_buffer_1.$buffer.fromHex('1901')];
|
|
245
246
|
parts.push(this.hashStruct('EIP712Domain', sanitizedData.domain, sanitizedData.types, useV4));
|
|
246
247
|
if (sanitizedData.primaryType !== 'EIP712Domain') {
|
|
247
248
|
parts.push(this.hashStruct(sanitizedData.primaryType, sanitizedData.message, sanitizedData.types, useV4));
|
|
248
249
|
}
|
|
249
|
-
return ethUtil_keccak(
|
|
250
|
+
return ethUtil_keccak(_buffer_1.$buffer.concat(parts));
|
|
250
251
|
}
|
|
251
252
|
}
|
|
252
253
|
;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.$txData = void 0;
|
|
4
|
+
var $txData;
|
|
5
|
+
(function ($txData) {
|
|
6
|
+
function getJson(txData, defaults) {
|
|
7
|
+
let json = {
|
|
8
|
+
...txData,
|
|
9
|
+
type: txData.type ?? defaults?.defaultTxType,
|
|
10
|
+
chainId: txData.chainId ?? defaults?.chainId
|
|
11
|
+
};
|
|
12
|
+
if (json.type === 1) {
|
|
13
|
+
// delete `type` field in case old tx type. Some old nodes may reject type field presence
|
|
14
|
+
delete json.type;
|
|
15
|
+
}
|
|
16
|
+
return json;
|
|
17
|
+
}
|
|
18
|
+
$txData.getJson = getJson;
|
|
19
|
+
})($txData = exports.$txData || (exports.$txData = {}));
|