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/txs/TxWriter.js
CHANGED
|
@@ -4,30 +4,39 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.TxWriter = void 0;
|
|
7
|
+
require("../env/BigIntSerializer");
|
|
7
8
|
const a_di_1 = __importDefault(require("a-di"));
|
|
8
9
|
const atma_utils_1 = require("atma-utils");
|
|
10
|
+
const _bigint_1 = require("@dequanto/utils/$bigint");
|
|
11
|
+
const _txData_1 = require("@dequanto/utils/$txData");
|
|
12
|
+
const _sign_1 = require("@dequanto/utils/$sign");
|
|
13
|
+
const _logger_1 = require("@dequanto/utils/$logger");
|
|
14
|
+
const _promise_1 = require("@dequanto/utils/$promise");
|
|
15
|
+
const _account_1 = require("@dequanto/utils/$account");
|
|
16
|
+
const _gas_1 = require("@dequanto/utils/$gas");
|
|
9
17
|
const TxDataBuilder_1 = require("./TxDataBuilder");
|
|
10
18
|
const TxLogger_1 = require("./TxLogger");
|
|
11
|
-
require("../env/BigIntSerializer");
|
|
12
|
-
const _bigint_1 = require("@dequanto/utils/$bigint");
|
|
13
19
|
const ChainAccountsService_1 = require("@dequanto/ChainAccountsService");
|
|
14
20
|
const Web3ClientFactory_1 = require("@dequanto/clients/Web3ClientFactory");
|
|
15
|
-
const _promise_1 = require("@dequanto/utils/$promise");
|
|
16
21
|
const ClientErrorUtil_1 = require("@dequanto/clients/utils/ClientErrorUtil");
|
|
17
|
-
const _logger_1 = require("@dequanto/utils/$logger");
|
|
18
22
|
const TxLogParser_1 = require("./receipt/TxLogParser");
|
|
23
|
+
const GnosisSafeHandler_1 = require("@dequanto/safe/GnosisSafeHandler");
|
|
24
|
+
const SigFileTransport_1 = require("./sig-transports/SigFileTransport");
|
|
25
|
+
const _require_1 = require("@dequanto/utils/$require");
|
|
19
26
|
class TxWriter extends atma_utils_1.class_EventEmitter {
|
|
20
27
|
constructor(client, builder, account) {
|
|
21
28
|
super();
|
|
22
29
|
this.client = client;
|
|
23
30
|
this.builder = builder;
|
|
24
31
|
this.account = account;
|
|
32
|
+
this.isSafe = _account_1.$account.isSafe(this.account);
|
|
25
33
|
this.onSent = new atma_utils_1.class_Dfr();
|
|
26
34
|
this.onCompleted = new atma_utils_1.class_Dfr();
|
|
35
|
+
this.onSaved = new atma_utils_1.class_Dfr();
|
|
27
36
|
this.id = Math.round(Math.random() * 10 ** 10) + '';
|
|
28
37
|
this.tx = null;
|
|
29
38
|
this.txs = [];
|
|
30
|
-
this.logger = new TxLogger_1.TxLogger(this.id, this.
|
|
39
|
+
this.logger = new TxLogger_1.TxLogger(this.id, this.getSenderName(), this.builder);
|
|
31
40
|
this.confirmationAwaiters = [];
|
|
32
41
|
}
|
|
33
42
|
onConfirmed(waitForCount) {
|
|
@@ -43,6 +52,9 @@ class TxWriter extends atma_utils_1.class_EventEmitter {
|
|
|
43
52
|
}
|
|
44
53
|
return promise;
|
|
45
54
|
}
|
|
55
|
+
wait() {
|
|
56
|
+
return this.onCompleted;
|
|
57
|
+
}
|
|
46
58
|
send(options) {
|
|
47
59
|
if (this.tx == null) {
|
|
48
60
|
this.logger.logStart();
|
|
@@ -59,9 +71,51 @@ class TxWriter extends atma_utils_1.class_EventEmitter {
|
|
|
59
71
|
this.send(options);
|
|
60
72
|
}
|
|
61
73
|
}
|
|
62
|
-
sendTxInner() {
|
|
74
|
+
async sendTxInner() {
|
|
75
|
+
if (this.options?.txOutput != null) {
|
|
76
|
+
// handle none blockchain
|
|
77
|
+
await this.saveTxAndExit();
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (this.isSafe) {
|
|
81
|
+
let safeAccount = this.account;
|
|
82
|
+
let sender = await this.getSender();
|
|
83
|
+
let safe = new GnosisSafeHandler_1.GnosisSafeHandler({
|
|
84
|
+
safeAddress: safeAccount.address ?? safeAccount.safeAddress,
|
|
85
|
+
owner: sender,
|
|
86
|
+
client: this.client,
|
|
87
|
+
transport: this.options?.safeTransport
|
|
88
|
+
});
|
|
89
|
+
let innerWriter = await safe.execute(this);
|
|
90
|
+
this.pipeInnerWriter(innerWriter);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
63
93
|
let time = Date.now();
|
|
64
|
-
let
|
|
94
|
+
let sender = await this.getSender();
|
|
95
|
+
if (this.builder.data.nonce == null) {
|
|
96
|
+
await this.builder.setNonce();
|
|
97
|
+
}
|
|
98
|
+
let key = sender?.key;
|
|
99
|
+
let signedTxBuffer = key == null
|
|
100
|
+
? null
|
|
101
|
+
: await this.builder.signToString(sender.key);
|
|
102
|
+
if (signedTxBuffer == null) {
|
|
103
|
+
if (this.options?.sigTransport != null) {
|
|
104
|
+
let transport = a_di_1.default.resolve(SigFileTransport_1.SigFileTransport);
|
|
105
|
+
let shouldWait = this.options?.sigTransportWait !== false;
|
|
106
|
+
let { signed, path } = await transport.create(this.options.sigTransport, this.builder, { wait: shouldWait });
|
|
107
|
+
if (path) {
|
|
108
|
+
this.onSaved.resolve(path);
|
|
109
|
+
}
|
|
110
|
+
if (shouldWait === false) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
if (this.options?.signature) {
|
|
115
|
+
let tx = _txData_1.$txData.getJson(this.builder.data, this.client);
|
|
116
|
+
signedTxBuffer = await _sign_1.$sign.serializeTx(tx, this.options.signature);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
65
119
|
let tx = {
|
|
66
120
|
timestamp: Date.now(),
|
|
67
121
|
confirmations: 0,
|
|
@@ -72,10 +126,22 @@ class TxWriter extends atma_utils_1.class_EventEmitter {
|
|
|
72
126
|
tx.timeout = this.startTimer(tx);
|
|
73
127
|
this.tx = tx;
|
|
74
128
|
this.txs.push(tx);
|
|
75
|
-
let promiEvent
|
|
76
|
-
|
|
77
|
-
|
|
129
|
+
let promiEvent;
|
|
130
|
+
if (signedTxBuffer != null) {
|
|
131
|
+
promiEvent = this
|
|
132
|
+
.client
|
|
133
|
+
.sendSignedTransaction(signedTxBuffer);
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
promiEvent = this
|
|
137
|
+
.client
|
|
138
|
+
.sendTransaction(this.builder.getTxData(this.client));
|
|
139
|
+
}
|
|
140
|
+
promiEvent
|
|
78
141
|
.once('transactionHash', hash => {
|
|
142
|
+
if (tx.hash === hash) {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
79
145
|
if (tx.hash && tx.timeout) {
|
|
80
146
|
// network has reaccepted the tx, restart previous timeout
|
|
81
147
|
this.clearTimer(tx);
|
|
@@ -84,17 +150,7 @@ class TxWriter extends atma_utils_1.class_EventEmitter {
|
|
|
84
150
|
tx.hash = hash;
|
|
85
151
|
this.onSent.resolve(hash);
|
|
86
152
|
this.emit('transactionHash', hash);
|
|
87
|
-
this.emit('log', `Tx hash
|
|
88
|
-
})
|
|
89
|
-
.once('receipt', receipt => {
|
|
90
|
-
tx.receipt = receipt;
|
|
91
|
-
tx.hash = receipt.transactionHash ?? tx.hash;
|
|
92
|
-
this.receipt = receipt;
|
|
93
|
-
this.clearTimer(tx);
|
|
94
|
-
this.logger.logReceipt(receipt, Date.now() - time);
|
|
95
|
-
this.onSent.resolve();
|
|
96
|
-
this.emit('receipt', receipt);
|
|
97
|
-
this.emit('log', `Tx receipt received for ${receipt.transactionHash}. Status: ${receipt.status}`);
|
|
153
|
+
this.emit('log', `Tx hash: ${hash}`);
|
|
98
154
|
})
|
|
99
155
|
// .on('confirmation', (confNumber, receipt) => {
|
|
100
156
|
// tx.hash = receipt.transactionHash ?? tx.hash;
|
|
@@ -111,6 +167,8 @@ class TxWriter extends atma_utils_1.class_EventEmitter {
|
|
|
111
167
|
// }
|
|
112
168
|
// })
|
|
113
169
|
.on('error', error => {
|
|
170
|
+
this.onSent.reject(error);
|
|
171
|
+
this.onCompleted.reject(error);
|
|
114
172
|
this.clearTimer(tx);
|
|
115
173
|
this.logger.logError(error);
|
|
116
174
|
this.emit('error', error);
|
|
@@ -121,9 +179,28 @@ class TxWriter extends atma_utils_1.class_EventEmitter {
|
|
|
121
179
|
try {
|
|
122
180
|
await this.extractLogs(receipt, tx);
|
|
123
181
|
}
|
|
124
|
-
catch (error) {
|
|
125
|
-
|
|
182
|
+
catch (error) {
|
|
183
|
+
console.error('Logs error', error);
|
|
184
|
+
}
|
|
185
|
+
try {
|
|
186
|
+
tx.receipt = receipt;
|
|
187
|
+
tx.hash = receipt.transactionHash ?? tx.hash;
|
|
188
|
+
this.receipt = receipt;
|
|
189
|
+
this.logger.logReceipt(receipt, Date.now() - time);
|
|
190
|
+
this.onSent.resolve();
|
|
191
|
+
this.emit('receipt', receipt);
|
|
192
|
+
let hash = tx.hash;
|
|
193
|
+
let status = receipt.status;
|
|
194
|
+
let gasFormatted = _gas_1.$gas.formatUsed(this.builder.data, receipt);
|
|
195
|
+
this.emit('log', `Tx receipt: ${hash}.\n\tStatus: ${status}.\n\tGas used: ${gasFormatted}`);
|
|
196
|
+
this.onCompleted.resolve(receipt);
|
|
197
|
+
}
|
|
198
|
+
catch (error) {
|
|
199
|
+
console.error('FATAL ERROR', error);
|
|
200
|
+
throw error;
|
|
201
|
+
}
|
|
126
202
|
}, async (err) => {
|
|
203
|
+
this.logger.log(`Tx errored ${err.message}`);
|
|
127
204
|
this.clearTimer(tx);
|
|
128
205
|
tx.error = err;
|
|
129
206
|
const options = this.options ?? {};
|
|
@@ -131,12 +208,12 @@ class TxWriter extends atma_utils_1.class_EventEmitter {
|
|
|
131
208
|
// read reason
|
|
132
209
|
// let client = await this.client.getWeb3();
|
|
133
210
|
// let tx = await this.client.getTransaction(err.receipt.transactionHash);
|
|
134
|
-
//
|
|
211
|
+
// $logger.log('RECEIPT', err.receipt, tx);
|
|
135
212
|
// try {
|
|
136
213
|
// let result = await client.eth.call(tx, tx.blockNumber);
|
|
137
|
-
//
|
|
214
|
+
// $logger.log('RESULT', result);
|
|
138
215
|
// } catch (err) {
|
|
139
|
-
//
|
|
216
|
+
// $logger.log('CALL ERROR', err);
|
|
140
217
|
// }
|
|
141
218
|
// throw new Error('asd');
|
|
142
219
|
}
|
|
@@ -182,21 +259,41 @@ class TxWriter extends atma_utils_1.class_EventEmitter {
|
|
|
182
259
|
this.onCompleted.reject(err);
|
|
183
260
|
});
|
|
184
261
|
}
|
|
262
|
+
async getSender() {
|
|
263
|
+
let account = this.account;
|
|
264
|
+
let sender = _account_1.$account.getSender(account);
|
|
265
|
+
if (sender.key == null) {
|
|
266
|
+
/** check the encrypted storage. In case no key is found, assume the target node contains unlocked or locked account */
|
|
267
|
+
let addressOrName = sender.address ?? sender.name;
|
|
268
|
+
let service = a_di_1.default.resolve(ChainAccountsService_1.ChainAccountsService);
|
|
269
|
+
let fromStorage = await service.get(addressOrName, this.client.platform);
|
|
270
|
+
if (fromStorage) {
|
|
271
|
+
sender = fromStorage;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
return sender;
|
|
275
|
+
}
|
|
276
|
+
getSenderName() {
|
|
277
|
+
let sender = _account_1.$account.getSender(this.account);
|
|
278
|
+
return sender.name ?? sender.address;
|
|
279
|
+
}
|
|
185
280
|
async extractLogs(receipt, tx) {
|
|
186
281
|
let parser = a_di_1.default.resolve(TxLogParser_1.TxLogParser);
|
|
187
282
|
let logs = await parser.parse(receipt);
|
|
188
283
|
tx.knownLogs = logs.filter(x => x != null);
|
|
189
284
|
}
|
|
190
285
|
async fundAccountAndResend() {
|
|
191
|
-
let
|
|
286
|
+
let gasFunding = this.builder.config.gasFunding;
|
|
287
|
+
let sender = _account_1.$account.getSender(this.account);
|
|
192
288
|
await this.builder.setGas({
|
|
193
289
|
gasEstimation: true,
|
|
194
|
-
from:
|
|
290
|
+
from: sender.address
|
|
195
291
|
});
|
|
196
|
-
let {
|
|
292
|
+
let { gasLimit } = this.builder.data;
|
|
293
|
+
let gasPrice = TxDataBuilder_1.TxDataBuilder.getGasPrice(this.builder);
|
|
197
294
|
let LITTLE_BIT_MORE = 1.3;
|
|
198
|
-
let wei = _bigint_1.$bigint.multWithFloat(
|
|
199
|
-
let fundTx = await this.transferNative(
|
|
295
|
+
let wei = _bigint_1.$bigint.multWithFloat(gasPrice * BigInt(gasLimit), LITTLE_BIT_MORE);
|
|
296
|
+
let fundTx = await this.transferNative(gasFunding, sender.address, wei);
|
|
200
297
|
await fundTx.onCompleted;
|
|
201
298
|
// account was funded resubmit the tx
|
|
202
299
|
this.resubmit();
|
|
@@ -236,7 +333,13 @@ class TxWriter extends atma_utils_1.class_EventEmitter {
|
|
|
236
333
|
}
|
|
237
334
|
this.sendTxInner();
|
|
238
335
|
}
|
|
239
|
-
|
|
336
|
+
pipeInnerWriter(innerWriter) {
|
|
337
|
+
innerWriter.onCompleted.then((receipt) => this.onCompleted.resolve(receipt), (error) => this.onCompleted.reject(error));
|
|
338
|
+
innerWriter.onSent.then((hash) => this.onSent.resolve(hash), (error) => this.onSent.reject(error));
|
|
339
|
+
innerWriter.on('error', error => this.emit('error', error));
|
|
340
|
+
innerWriter.on('log', message => this.emit('log', message));
|
|
341
|
+
}
|
|
342
|
+
/** Use this transfer also in case of additional account funding */
|
|
240
343
|
async transferNative(from, to, amount) {
|
|
241
344
|
let txBuilder = new TxDataBuilder_1.TxDataBuilder(this.client, from, {
|
|
242
345
|
to: to,
|
|
@@ -250,22 +353,41 @@ class TxWriter extends atma_utils_1.class_EventEmitter {
|
|
|
250
353
|
return TxWriter.write(this.client, txBuilder, from);
|
|
251
354
|
}
|
|
252
355
|
toJSON() {
|
|
356
|
+
let account = this.account;
|
|
357
|
+
if (typeof account !== 'string') {
|
|
358
|
+
account = JSON.parse(JSON.stringify(account));
|
|
359
|
+
// Clean any KEY to prevent leaking. When resubmitted if one is required should be taken from the storage
|
|
360
|
+
if (_account_1.$account.isSafe(account)) {
|
|
361
|
+
delete account.operator?.key;
|
|
362
|
+
}
|
|
363
|
+
else {
|
|
364
|
+
delete account.key;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
253
367
|
return {
|
|
254
368
|
id: this.id,
|
|
255
369
|
platform: this.client.platform,
|
|
256
370
|
options: this.options,
|
|
257
|
-
account:
|
|
371
|
+
account: account,
|
|
258
372
|
txs: this.txs,
|
|
259
373
|
builder: this.builder.toJSON(),
|
|
260
374
|
};
|
|
261
375
|
}
|
|
262
|
-
|
|
376
|
+
//** We can save the Tx Data for later reuse/blockchain send */
|
|
377
|
+
async saveTxAndExit(additionalProperties) {
|
|
378
|
+
let path = this.options?.txOutput;
|
|
379
|
+
_require_1.$require.notNull(path, 'Save tx data to the file, but the path is undefined');
|
|
380
|
+
await this.builder.save(path, additionalProperties);
|
|
381
|
+
this.onSent.resolve(path);
|
|
382
|
+
this.onSaved.resolve(path);
|
|
383
|
+
this.onCompleted.reject(new Error(`Transaction is not submited to the blockchain. It has been saved to "${path}". Subscribe to the "onSaved" promise instead`));
|
|
384
|
+
}
|
|
385
|
+
static async fromJSON(json, client, account) {
|
|
263
386
|
client = client ?? Web3ClientFactory_1.Web3ClientFactory.get(json.platform);
|
|
264
|
-
|
|
265
|
-
let account = await service.get(json.account, json.platform);
|
|
387
|
+
account = account ?? json.account;
|
|
266
388
|
let builder = TxDataBuilder_1.TxDataBuilder.fromJSON(client, account, {
|
|
267
389
|
config: json.builder.config,
|
|
268
|
-
|
|
390
|
+
tx: json.builder.tx,
|
|
269
391
|
});
|
|
270
392
|
let writer = TxWriter.create(client, builder, account, json.options);
|
|
271
393
|
let txs = json.txs;
|
|
@@ -283,5 +405,15 @@ class TxWriter extends atma_utils_1.class_EventEmitter {
|
|
|
283
405
|
static create(client, builder, account, options) {
|
|
284
406
|
return new TxWriter(client, builder, account);
|
|
285
407
|
}
|
|
408
|
+
static async writeTxData(client, data, account, options) {
|
|
409
|
+
let txBuilder = new TxDataBuilder_1.TxDataBuilder(client, account, data);
|
|
410
|
+
await Promise.all([
|
|
411
|
+
txBuilder.setGas(),
|
|
412
|
+
txBuilder.setNonce(),
|
|
413
|
+
]);
|
|
414
|
+
let w = new TxWriter(client, txBuilder, account);
|
|
415
|
+
w.send(options);
|
|
416
|
+
return w;
|
|
417
|
+
}
|
|
286
418
|
}
|
|
287
419
|
exports.TxWriter = TxWriter;
|
|
@@ -11,7 +11,11 @@ class TxLogParser {
|
|
|
11
11
|
constructor(topics = new TxTopicProvider_1.TxTopicProvider()) {
|
|
12
12
|
this.topics = topics;
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Sparse arrays will contain NULLs for unparsed log items.
|
|
16
|
+
* Per default dense arrays - only with known logs - are returned
|
|
17
|
+
*/
|
|
18
|
+
async parse(receipt, opts) {
|
|
15
19
|
let logs = await (0, alot_1.default)(receipt.logs).mapAsync(async (log) => {
|
|
16
20
|
let topic = await this.topics.get(log.topics[0]);
|
|
17
21
|
if (topic == null) {
|
|
@@ -19,8 +23,14 @@ class TxLogParser {
|
|
|
19
23
|
}
|
|
20
24
|
let { abi, formatter } = topic;
|
|
21
25
|
let parsed = _contract_1.$contract.parseLogWithAbi(log, abi);
|
|
26
|
+
if (formatter) {
|
|
27
|
+
return await formatter.extract(parsed, opts?.platform ?? 'eth');
|
|
28
|
+
}
|
|
22
29
|
return parsed;
|
|
23
30
|
}).toArrayAsync();
|
|
31
|
+
if (opts?.sparse !== true) {
|
|
32
|
+
logs = logs.filter(x => x != null);
|
|
33
|
+
}
|
|
24
34
|
return logs;
|
|
25
35
|
}
|
|
26
36
|
}
|
|
@@ -5,8 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.TxLogsTransfer = void 0;
|
|
7
7
|
const alot_1 = __importDefault(require("alot"));
|
|
8
|
-
const
|
|
9
|
-
const TxLogParser_1 = require("./TxLogParser");
|
|
8
|
+
const TokenDataProvider_1 = require("@dequanto/tokens/TokenDataProvider");
|
|
10
9
|
class TxLogsTransfer {
|
|
11
10
|
async extractFromWriter(writer) {
|
|
12
11
|
let receipt = await writer.onCompleted;
|
|
@@ -14,13 +13,14 @@ class TxLogsTransfer {
|
|
|
14
13
|
return this.extractFromParsed(knownLogs, writer.client.platform);
|
|
15
14
|
}
|
|
16
15
|
async extractFromParsed(knownLogs, platform) {
|
|
17
|
-
let transfers = knownLogs.filter(x => x.
|
|
18
|
-
let tokenService =
|
|
16
|
+
let transfers = knownLogs.filter(x => x.event === 'Transfer');
|
|
17
|
+
let tokenService = new TokenDataProvider_1.TokenDataProvider(platform);
|
|
19
18
|
return (0, alot_1.default)(transfers).mapAsync(async (transfer) => {
|
|
20
|
-
let erc20Address = transfer.
|
|
19
|
+
let erc20Address = transfer.address;
|
|
21
20
|
let token = await tokenService.getTokenOrDefault(erc20Address);
|
|
22
21
|
let [from, to, amount] = transfer.arguments;
|
|
23
22
|
return {
|
|
23
|
+
event: transfer.event,
|
|
24
24
|
token,
|
|
25
25
|
from: from.value,
|
|
26
26
|
to: to.value,
|
|
@@ -28,18 +28,19 @@ class TxLogsTransfer {
|
|
|
28
28
|
};
|
|
29
29
|
}).toArrayAsync();
|
|
30
30
|
}
|
|
31
|
-
async extractFromReceipt(receipt, platform) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
31
|
+
// async extractFromReceipt (receipt: TransactionReceipt, platform: TPlatform): Promise<ITxLogsTransferData[]> {
|
|
32
|
+
// let parser = new TxLogParser();
|
|
33
|
+
// let logs = await parser.parse(receipt);
|
|
34
|
+
// logs = logs.filter(x => x != null);
|
|
35
|
+
// return this.extractFromParsed(logs, platform);
|
|
36
|
+
// }
|
|
37
37
|
async extract(transfer, platform) {
|
|
38
|
-
let tokenService =
|
|
39
|
-
let erc20Address = transfer.
|
|
38
|
+
let tokenService = new TokenDataProvider_1.TokenDataProvider(platform);
|
|
39
|
+
let erc20Address = transfer.address;
|
|
40
40
|
let token = await tokenService.getTokenOrDefault(erc20Address);
|
|
41
41
|
let [from, to, amount] = transfer.arguments;
|
|
42
42
|
return {
|
|
43
|
+
event: transfer.event,
|
|
43
44
|
token,
|
|
44
45
|
from: from.value,
|
|
45
46
|
to: to.value,
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.TxTopicProvider = void 0;
|
|
4
|
-
|
|
7
|
+
const a_di_1 = __importDefault(require("a-di"));
|
|
8
|
+
const TxLogsTransfer_1 = require("./TxLogsTransfer");
|
|
5
9
|
const TxTopicInMemoryProvider_1 = require("./TxTopicInMemoryProvider");
|
|
6
10
|
class TxTopicProvider {
|
|
7
11
|
constructor() {
|
|
8
12
|
this.default = new TxTopicInMemoryProvider_1.TxTopicInMemoryProvider();
|
|
9
13
|
this.register([
|
|
10
|
-
'event Transfer(address from, address to, uint256 amount)'
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
//'event Transfer(address from, address to, uint256 amount)'
|
|
15
|
+
{
|
|
16
|
+
abi: 'event Transfer(address from, address to, uint256 amount)',
|
|
17
|
+
formatter: a_di_1.default.resolve(TxLogsTransfer_1.TxLogsTransfer)
|
|
18
|
+
}
|
|
15
19
|
]);
|
|
16
20
|
}
|
|
17
21
|
async get(topicHash) {
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SigFileTransport = void 0;
|
|
4
|
+
const _logger_1 = require("@dequanto/utils/$logger");
|
|
5
|
+
const _sign_1 = require("@dequanto/utils/$sign");
|
|
6
|
+
const _txData_1 = require("@dequanto/utils/$txData");
|
|
7
|
+
const atma_io_1 = require("atma-io");
|
|
8
|
+
const ethers_1 = require("ethers");
|
|
9
|
+
class SigFileTransport {
|
|
10
|
+
async create(path, txBuilder, params) {
|
|
11
|
+
let tx = _txData_1.$txData.getJson(txBuilder.data, txBuilder.client);
|
|
12
|
+
let json = {
|
|
13
|
+
account: {
|
|
14
|
+
address: txBuilder.account?.address
|
|
15
|
+
},
|
|
16
|
+
tx,
|
|
17
|
+
config: txBuilder.config,
|
|
18
|
+
raw: ethers_1.utils.serializeTransaction(tx),
|
|
19
|
+
signature: null,
|
|
20
|
+
};
|
|
21
|
+
await atma_io_1.File.writeAsync(path, json);
|
|
22
|
+
_logger_1.$logger.log('');
|
|
23
|
+
_logger_1.$logger.log(`Tx data saved to the file "${path}".`);
|
|
24
|
+
_logger_1.$logger.log(`Sign the data, insert the signature to the "signature" field and save the file.`);
|
|
25
|
+
if (params.wait) {
|
|
26
|
+
_logger_1.$logger.log(`Waiting for the signature...`);
|
|
27
|
+
_logger_1.$logger.log(`... or you can close this process, and continue later with "0xweb tx send ${path}"`);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
_logger_1.$logger.log(`Continue later with "0xweb tx send ${path}"`);
|
|
31
|
+
return { path };
|
|
32
|
+
}
|
|
33
|
+
_logger_1.$logger.log('');
|
|
34
|
+
return new Promise((resolve) => {
|
|
35
|
+
atma_io_1.File.watch(path, async () => {
|
|
36
|
+
_logger_1.$logger.log(`File changed. Checking signature...`);
|
|
37
|
+
let json = await atma_io_1.File.readAsync(path, { cached: false });
|
|
38
|
+
if (json?.signature == null) {
|
|
39
|
+
_logger_1.$logger.log(`Signature not found. Still waiting...`);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
let signed = await _sign_1.$sign.serializeTx(tx, json.signature);
|
|
43
|
+
resolve({ path, signed });
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.SigFileTransport = SigFileTransport;
|
|
@@ -45,7 +45,7 @@ var $abiParser;
|
|
|
45
45
|
throw new Error(`Invalid method abi ${methodAbi}. Expect like 'foo(uint256):address'`);
|
|
46
46
|
}
|
|
47
47
|
let fnName = match.groups.methodName;
|
|
48
|
-
let $return = match.groups.return?.trim() ?? '
|
|
48
|
+
let $return = match.groups.return?.trim() ?? '';
|
|
49
49
|
outputs = parseArguments($return);
|
|
50
50
|
let inputs = Parse.parametersLine(match.groups.params ?? '');
|
|
51
51
|
return {
|
|
@@ -64,6 +64,7 @@ var $abiParser;
|
|
|
64
64
|
// (uint256, uint256)
|
|
65
65
|
// (uint256 foo, uint256 bar)
|
|
66
66
|
// (uint256 foo, uint256 bar)[]
|
|
67
|
+
// ((uint256 foo, uint256 bar) foo, uint256 bar)
|
|
67
68
|
function parseArguments(line) {
|
|
68
69
|
line = line?.trim();
|
|
69
70
|
if (!line || line === '()') {
|
|
@@ -78,8 +79,7 @@ var $abiParser;
|
|
|
78
79
|
let parametersLine = line.substring(1, end);
|
|
79
80
|
let isArray = line.endsWith('[]');
|
|
80
81
|
let params = Parse.parametersLine(parametersLine);
|
|
81
|
-
|
|
82
|
-
if (isTuple && isArray) {
|
|
82
|
+
if (isArray) {
|
|
83
83
|
return [
|
|
84
84
|
{
|
|
85
85
|
name: '',
|
|
@@ -88,15 +88,29 @@ var $abiParser;
|
|
|
88
88
|
}
|
|
89
89
|
];
|
|
90
90
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
let delimiter = line.indexOf(',', end);
|
|
92
|
+
if (delimiter === -1) {
|
|
93
|
+
delimiter = line.length;
|
|
94
|
+
}
|
|
95
|
+
let tupleName = line.substring(end + 1, delimiter).trim();
|
|
96
|
+
if (tupleName) {
|
|
97
|
+
return [
|
|
94
98
|
{
|
|
95
|
-
name:
|
|
96
|
-
type:
|
|
97
|
-
|
|
99
|
+
name: tupleName,
|
|
100
|
+
type: `tuple`,
|
|
101
|
+
components: params
|
|
102
|
+
}
|
|
98
103
|
];
|
|
99
104
|
}
|
|
105
|
+
// if (params.length === 1) {
|
|
106
|
+
// line = params[0].type;
|
|
107
|
+
// params = [
|
|
108
|
+
// {
|
|
109
|
+
// name: "",
|
|
110
|
+
// type: line,
|
|
111
|
+
// },
|
|
112
|
+
// ];
|
|
113
|
+
// }
|
|
100
114
|
return params;
|
|
101
115
|
}
|
|
102
116
|
// if (c === '{') {
|
|
@@ -109,10 +123,17 @@ var $abiParser;
|
|
|
109
123
|
// };
|
|
110
124
|
// });
|
|
111
125
|
// }
|
|
126
|
+
let name = '';
|
|
127
|
+
let type = line;
|
|
128
|
+
let match = /^(?<type>.+)\s+(?<name>[\w_$]+)$/.exec(line);
|
|
129
|
+
if (match) {
|
|
130
|
+
name = match.groups.name;
|
|
131
|
+
type = match.groups.type;
|
|
132
|
+
}
|
|
112
133
|
return [
|
|
113
134
|
{
|
|
114
|
-
name
|
|
115
|
-
type
|
|
135
|
+
name,
|
|
136
|
+
type,
|
|
116
137
|
},
|
|
117
138
|
];
|
|
118
139
|
}
|
|
@@ -122,19 +143,33 @@ var Parse;
|
|
|
122
143
|
(function (Parse) {
|
|
123
144
|
// uint256 foo, uint bar, address qux
|
|
124
145
|
function parametersLine(paramsStr) {
|
|
125
|
-
return paramsStr
|
|
126
|
-
.split(',')
|
|
127
|
-
.map(x => x.trim())
|
|
128
|
-
.filter(Boolean)
|
|
146
|
+
return splitByDelimiter(paramsStr, ',')
|
|
129
147
|
.map(param => {
|
|
130
|
-
let
|
|
131
|
-
return
|
|
132
|
-
name: _name ?? '',
|
|
133
|
-
type: _type.trim()
|
|
134
|
-
};
|
|
148
|
+
let params = $abiParser.parseArguments(param);
|
|
149
|
+
return params[0];
|
|
135
150
|
});
|
|
136
151
|
}
|
|
137
152
|
Parse.parametersLine = parametersLine;
|
|
153
|
+
function splitByDelimiter(line, delimiter) {
|
|
154
|
+
let parts = [];
|
|
155
|
+
let start = 0;
|
|
156
|
+
for (let i = 0; i < line.length; i++) {
|
|
157
|
+
let c = line[i];
|
|
158
|
+
if (c === delimiter) {
|
|
159
|
+
parts.push(line.substring(start, i).trim());
|
|
160
|
+
start = i + 1;
|
|
161
|
+
continue;
|
|
162
|
+
}
|
|
163
|
+
if (c === '(') {
|
|
164
|
+
i = goToClosing(line, i, c);
|
|
165
|
+
continue;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
// final part
|
|
169
|
+
parts.push(line.substring(start).trim());
|
|
170
|
+
return parts.filter(Boolean);
|
|
171
|
+
}
|
|
172
|
+
Parse.splitByDelimiter = splitByDelimiter;
|
|
138
173
|
function goToClosing(str, startI, openChar, closeChar) {
|
|
139
174
|
closeChar = closeChar ?? CLOSE_CHARS[openChar];
|
|
140
175
|
let count = 0;
|