2018-11-07 14:33:56 +01:00
|
|
|
import Web3Provider from "../Web3Provider"
|
2018-10-29 10:53:22 +01:00
|
|
|
import ContractBase from "./ContractBase"
|
|
|
|
|
|
|
|
export default class DIDRegistry extends ContractBase {
|
|
|
|
|
|
|
|
public static async getInstance(): Promise<DIDRegistry> {
|
|
|
|
const didRegistry: DIDRegistry = new DIDRegistry("DIDRegistry")
|
|
|
|
await didRegistry.init()
|
|
|
|
return didRegistry
|
|
|
|
}
|
|
|
|
|
2019-03-01 13:24:04 +01:00
|
|
|
public async registerAttribute(did: string, checksum: string, value: string, ownerAddress: string) {
|
2019-02-06 00:38:54 +01:00
|
|
|
return this.send("registerAttribute", ownerAddress, ["0x" + did, Web3Provider.getWeb3().utils.fromAscii(checksum), value])
|
2018-10-29 10:53:22 +01:00
|
|
|
}
|
|
|
|
|
2019-03-04 13:05:27 +01:00
|
|
|
public async getDIDOwner(did: string): Promise<string> {
|
|
|
|
return this.call("getDIDOwner", [did])
|
2018-10-29 10:53:22 +01:00
|
|
|
}
|
|
|
|
|
2019-03-04 13:05:27 +01:00
|
|
|
public async getBlockNumberUpdated(did: string): Promise<number> {
|
|
|
|
return +await this.call("getBlockNumberUpdated", [did])
|
2018-10-29 10:53:22 +01:00
|
|
|
}
|
|
|
|
}
|