diff --git a/__pycache__/teatime.cpython-311.pyc b/__pycache__/teatime.cpython-311.pyc new file mode 100644 index 00000000..ac70819d Binary files /dev/null and b/__pycache__/teatime.cpython-311.pyc differ diff --git a/flake.nix b/flake.nix index 1a4abdb4..3f8dbdb0 100644 --- a/flake.nix +++ b/flake.nix @@ -49,6 +49,10 @@ inherit self'; }; devShells.ci = import ./shells/ci.nix {pkgs = final;}; + devShells.teatime-test = import ./shells/teatime-test.nix { + inherit self'; + pkgs = final; + }; }; }; } diff --git a/packages/all-packages.nix b/packages/all-packages.nix index 81f11ce7..e25d6dde 100644 --- a/packages/all-packages.nix +++ b/packages/all-packages.nix @@ -111,7 +111,7 @@ cosmos-theta-testnet = callPackage ./cosmos-theta-testnet {inherit gaiad;}; blst = callPackage ./blst {}; bnb-beacon-node = callPackage ./bnb-beacon-node {}; - + teatime = callPackage ./teatime/default.nix {inherit python3Packages;}; circom = callPackage ./circom/default.nix {craneLib = craneLib-stable;}; circ = callPackage ./circ/default.nix {craneLib = craneLib-stable;}; diff --git a/packages/teatime/default.nix b/packages/teatime/default.nix new file mode 100644 index 00000000..53589a4d --- /dev/null +++ b/packages/teatime/default.nix @@ -0,0 +1,26 @@ +{ + python3Packages, + fetchPypi, + lib, +}: +python3Packages.buildPythonPackage { + pname = "teatime"; + version = "0.3.1"; + + src = /home/hkrasenov/code/repos/teatime; + + build-system = [ + python3Packages.setuptools + python3Packages.wheel + ]; + + propagatedBuildInputs = with python3Packages; [loguru requests]; + + doCheck = false; + + meta = with lib; { + description = "A minimal Python tea time application"; + homepage = "https://github.com/dmuhs/teatime"; + license = licenses.mit; + }; +} diff --git a/shells/teatime-test.nix b/shells/teatime-test.nix new file mode 100644 index 00000000..e578d48f --- /dev/null +++ b/shells/teatime-test.nix @@ -0,0 +1,10 @@ +{ + self', + pkgs, + ... +}: +pkgs.mkShell { + packages = with pkgs; [ + (python3.withPackages (python-pkgs: with python-pkgs; [self'.packages.teatime])) + ]; +} diff --git a/teatime-test.py b/teatime-test.py new file mode 100644 index 00000000..d745fd39 --- /dev/null +++ b/teatime-test.py @@ -0,0 +1,23 @@ +from teatime.scanner import Scanner +from teatime.plugins.context import NodeType +from teatime.plugins.eth1 import NodeSync, MiningStatus + +TARGET_IP = "127.0.0.1" +TARGET_PORT = 8545 +INFURA_URL = "Infura API Endpoint" + +def get_scanner(): + return Scanner( + ip=TARGET_IP, + port=TARGET_PORT, + node_type=NodeType.GETH, + plugins=[ + NodeSync(infura_url=INFURA_URL, block_threshold=10), + MiningStatus(should_mine=False) + ] + ) + +if __name__ == '__main__': + scanner = get_scanner() + report = scanner.run() + print(report.to_dict()) \ No newline at end of file