import { Dcomm } from "dcomm/dist"
import { EVMAPI, KeyChain, KeyPair } from "dcomm/dist/apis/evm"
import { CreateKeyPairResponse } from "dcomm/dist/apis/evm/interfaces"

const ip: string = "localhost"
const port: number = 9650
const protocol: string = "http"
const networkID: number = 1337
const dcomm: Dcomm = new Dcomm(ip, port, protocol, networkID)
const actchain: EVMAPI = dcomm.ACTChain()

const main = async (): Promise<any> => {
  const keychain: KeyChain = actchain.keyChain()
  const keypair: KeyPair = keychain.makeKey()
  const address: string = keypair.getAddressString()
  const publicKey: string = keypair.getPublicKeyString()
  const privateKey: string = keypair.getPrivateKeyString()
  const createKeypairResponse: CreateKeyPairResponse = {
    address: address,
    publicKey: publicKey,
    privateKey: privateKey
  }
  console.log(createKeypairResponse)
}

main()
