import {CICRegistry} from "../src";
import {FsFileGetter} from "../src/file";
const Web3 = require("web3");
const fs = require('fs');
const path = require('path');

const paths = [__dirname + '/testdata/solidity'];
const getter = new FsFileGetter();
const provider = 'http://localhost:63545';
const w3 = new Web3(provider);
const registry = new CICRegistry(w3, '0xea6225212005e86a4490018ded4bf37f3e772161', 'CICRegistry', getter, paths);
registry.load();
registry.onload = async (address: string): Promise<void> => {
    console.log(address);
    console.log(await registry.getContractAddressByName('TokenRegistry'));
    const tokenContract = await registry.getContractByName('TokenRegistry', 'TokenUniqueSymbolIndex');
    console.log(await tokenContract.methods.entryCount().call());
    console.log(await tokenContract.methods.entry(0).call());
}
