1
0
mirror of https://github.com/oceanprotocol-archive/squid-js.git synced 2024-02-02 15:31:51 +01:00
squid-js/src/keeper/contracts/DIDRegistry.ts

25 lines
886 B
TypeScript
Raw Normal View History

import {Receipt} from "web3-utils"
import Web3Provider from "../Web3Provider"
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-02-06 00:38:54 +01:00
public async registerAttribute(did: string, checksum: string, value: string, ownerAddress: string): Promise<Receipt> {
return this.send("registerAttribute", ownerAddress, ["0x" + did, Web3Provider.getWeb3().utils.fromAscii(checksum), value])
}
public async getOwner(did: string): Promise<string> {
2019-02-06 00:38:54 +01:00
return this.call("getOwner", ["0x" + did])
}
public async getUpdateAt(did: string): Promise<number> {
return +await this.call("getUpdateAt", ["0x" + did])
}
}