Exemple #1
0
    def test_settings(self):
        settings = SettingsHolder()
        settings.setup_mainnet()

        client = RPCClient(config=settings)

        self.assertIsNotNone(client.endpoints)
Exemple #2
0
def main():
    s = SettingsHolder()
    s.setup(["http://0.0.0.0:8082"])
    client = RPCClient(config=s)
    # blockchain_block = client.get_block(1274378)
    # print(blockchain_block)
    to = client.get_transaction(
        "5c614786554f19a3fe04fbf7473f3dda5d89f8b1fcad9ef19c2e1fff3466589d")
    print(to)
    def test_call_endpoint_exception(self):
        settings = SettingsHolder()

        settings.setup_privnet()
        client = RPCClient(config=settings)

        # Assumes no privnet is running (which always holds true on Travis-CI)
        with self.assertRaises(NEORPCException) as context:
            client.get_height()
        self.assertTrue("Could not call method" in str(context.exception))
    def __init__(self, use_privnet=True):

        settings = SettingsHolder()

        if use_privnet:

            addr_list = ["http://private_net:20332"]

            settings.setup(addr_list)

        else:
            settings.setup_mainnet()

        self.neo_rpc_client = RPCClient(settings)
        self.rds = Redis(host='redis', port=6379, db=0)
        self.nm_auth_token = os.environ.get('NM_AUTH_TOKEN', None)
if __name__ == "__main__":
    conn = psycopg2.connect(connection_str)

    cursor = conn.cursor()

    dict_address_port, address_dict = getAddressId(cursor)

    protocol_dict = getProtocol(cursor)

    list_of_address = [
        protocol_dict[dict_address_port[key][0]] + "://" + key + ":" +
        str(dict_address_port[key][2]) for key in dict_address_port
    ]

    settings = SettingsHolder()

    settings.setup(list_of_address)

    client = RPCClient(config=settings)

    ip_dict = getIpId(cursor)

    resolver = dns.resolver.Resolver(configure=False)
    resolver.nameservers = [
        "208.67.222.222", "208.67.220.220", '8.8.8.8', '2001:4860:4860::8888',
        '8.8.4.4', '2001:4860:4860::8844'
    ]

    def update(endpoints, client, dict_address_port):
        # Avoid synchronisation
        if result and result.get('stack', [{}])[0].get('value'):
            hex_value = result.get('stack')[0].get('value')
            string_value = bytes.fromhex(hex_value).decode('utf-8')
            print(string_value)
            return string_value
        print("No value!")

    except Exception as e:
        print("Error: {}".format(e))


from neorpc.Client import RPCClient, RPCEndpoint
from neorpc.Settings import SettingsHolder
from binascii import hexlify, unhexlify

settings = SettingsHolder()
settings.setup_privnet()

client = RPCClient(config=settings)
endpoint = "http://neo-privnet.what.digital:30333"

WALLETS = {
    "main_wallet": {
        'address': "AK2nJJpJr6o664CWJKi1QRXjqeic2zRp8y",
        'wif': "KxDgvEKzgSBPPfuVfw67oPQBSjidEiqTHURKSDL1R7yGaGYAeYnr",
    },
    "wallet_chris": {
        'address': "ALA1eYePMiNVfiHvQGVnupDFmjoPFwSoUc",
        'wif': "L3QGJ5FMg7LQWYkVekkwRDyYL3HXTw3ntYrTupjp3EViru7kTGN7",
    },
    "wallet_mario": {