import { Dcomm } from "dcomm/dist"
import { DVMAPI, KeyChain, KeyPair } from "dcomm/dist/apis/dvm"

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 astchain: DVMAPI = dcomm.ASTChain()

const main = async (): Promise<any> => {
  const keychain: KeyChain = astchain.keyChain()
  const keypair: KeyPair = keychain.makeKey()

  const response: {
    address: string
    publicKey: string
    privateKey: string
  } = {
    address: keypair.getAddressString(),
    publicKey: keypair.getPublicKeyString(),
    privateKey: keypair.getPrivateKeyString()
  }
  console.log(response)
}

main()
