To enable API in the docker-compose.yml, add these lines to the envoronment section:
- LTO_API_KEY=your super secret password
- LTO_ENABLE_REST_API=true| from dataclasses import dataclass | |
| from operator import attrgetter | |
| from web3 import Web3, HTTPProvider | |
| from web3.utils.filters import construct_event_filter_params | |
| from tabulate import tabulate | |
| @dataclass | |
| class Vendor: | |
| address: str |
| import requests | |
| import click | |
| LTO_NODE_URL = 'http://127.0.0.1:6869' | |
| LTO_API_KEY = '<your api password>' | |
| s = requests.session() | |
| s.headers['X-API-Key'] = LTO_API_KEY |
| import os | |
| from operator import itemgetter | |
| from json import JSONDecodeError | |
| from time import sleep | |
| import click | |
| import requests | |
| import pendulum | |
| import requests | |
| from tqdm import trange | |
| from web3 import Web3, HTTPProvider | |
| w3 = Web3(HTTPProvider('http://127.0.0.1:8545', {'timeout': 120})) | |
| def get_contract(address): | |
| resp = requests.get( |
| from web3 import Web3, HTTPProvider | |
| from eth_utils import encode_hex, event_signature_to_log_topic | |
| from eth_abi import encode_single | |
| w3 = Web3(HTTPProvider('http://127.0.0.1:8545', {'timeout': 120})) | |
| transfer_topic = encode_hex(event_signature_to_log_topic('Transfer(address,address,uint256)')) | |
| def get_tokens(address): |
| import json | |
| from collections import Counter, defaultdict | |
| from dataclasses import dataclass, field | |
| from decimal import Decimal | |
| from itertools import chain | |
| import requests | |
| from eth_abi import encode_single | |
| from eth_utils import function_signature_to_4byte_selector, decode_hex, encode_hex | |
| from itertools import count |
| import json | |
| from collections import Counter, defaultdict | |
| from dataclasses import dataclass, field | |
| from decimal import Decimal | |
| from eth_abi import encode_single | |
| from eth_utils import function_signature_to_4byte_selector, decode_hex, encode_hex | |
| from itertools import count | |
| from web3.auto import w3 |
| """ | |
| estimates remaining time to sync tezos node. | |
| dependencies: | |
| pip3 install click requests python-dateutil | |
| """ | |
| import requests | |
| from requests.exceptions import ConnectionError | |
| from dateutil.parser import parse | |
| from datetime import datetime, timedelta, timezone |
| import click | |
| from web3 import Web3, HTTPProvider | |
| from datetime import datetime, timezone | |
| abi = [{'constant': True, | |
| 'inputs': [], | |
| 'name': 'name', | |
| 'outputs': [{'name': '', 'type': 'string'}], | |
| 'payable': False, |