@windingtree/org.id-core
Advanced tools
Comparing version 0.3.5 to 0.3.6
@@ -1,1 +0,16 @@ | ||
export { OrgIdContract } from './contract'; | ||
import type { Web3Provider, OrgIdData, CallbackFn } from './core'; | ||
import type { Contract } from 'web3-eth-contract'; | ||
import Web3 from 'web3'; | ||
export type { OrgIdAddresses, Web3Provider, OrgIdData, OrgIdRawResult } from './core'; | ||
export declare class OrgIdContract { | ||
address: string; | ||
web3: Web3; | ||
contract: Contract; | ||
constructor(networkOrAddress: string, web3ProviderOrUri: Web3Provider | string); | ||
createOrgId(salt: string, orgJsonUri: string, orgIdOwner: string, gasPrice?: string | number, gasLimit?: string | number, transactionHashCb?: CallbackFn): Promise<OrgIdData | null>; | ||
setOrgJson(orgIdHash: string, orgJsonUri: string, orgIdOwner: string, gasPrice?: string | number, gasLimit?: string | number, transactionHashCb?: CallbackFn): Promise<OrgIdData | null>; | ||
transferOrgIdOwnership(orgIdHash: string, newOrgIdOwner: string, orgIdOwner: string, gasPrice?: string | number, gasLimit?: string | number, transactionHashCb?: CallbackFn): Promise<OrgIdData | null>; | ||
getOrgIdsCount(): Promise<number>; | ||
getOrgId(orgIdHash: string): Promise<OrgIdData | null>; | ||
getOrgIds(cursor?: number, count?: number): Promise<string[]>; | ||
} |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.OrgIdContract = void 0; | ||
var contract_1 = require("./contract"); | ||
Object.defineProperty(exports, "OrgIdContract", { enumerable: true, get: function () { return contract_1.OrgIdContract; } }); | ||
const web3_1 = __importDefault(require("web3")); | ||
const org_id_1 = require("@windingtree/org.id"); | ||
const org_id_utils_1 = require("@windingtree/org.id-utils"); | ||
// Methods | ||
const createOrgId_1 = require("./api/createOrgId"); | ||
const setOrgJson_1 = require("./api/setOrgJson"); | ||
const transferOrgIdOwnership_1 = require("./api/transferOrgIdOwnership"); | ||
const getOrgIdsCount_1 = require("./api/getOrgIdsCount"); | ||
const getOrgId_1 = require("./api/getOrgId"); | ||
const getOrgIds_1 = require("./api/getOrgIds"); | ||
class OrgIdContract { | ||
constructor(networkOrAddress, web3ProviderOrUri) { | ||
if (org_id_utils_1.regexp.ethereumAddress.exec(networkOrAddress)) { | ||
this.address = networkOrAddress; | ||
} | ||
else if (networkOrAddress) { | ||
this.address = org_id_1.addresses[networkOrAddress.replace('mainnet', 'main')]; | ||
} | ||
if (!this.address) { | ||
throw new Error(`orgIdContract: Invalid network or a smart contract address: ${networkOrAddress}`); | ||
} | ||
this.web3 = new web3_1.default(web3ProviderOrUri); | ||
if (!this.web3.currentProvider) { | ||
throw new Error('orgIdContract: Unable to initialize web3 provider'); | ||
} | ||
this.contract = new this.web3.eth.Contract(org_id_1.OrgIdContract.abi, this.address); | ||
} | ||
createOrgId(salt, orgJsonUri, orgIdOwner, gasPrice, gasLimit, transactionHashCb) { | ||
return createOrgId_1.createOrgId(this.web3, this.contract, salt, orgJsonUri, orgIdOwner, gasPrice, gasLimit, transactionHashCb); | ||
} | ||
setOrgJson(orgIdHash, orgJsonUri, orgIdOwner, gasPrice, gasLimit, transactionHashCb) { | ||
return setOrgJson_1.setOrgJson(this.web3, this.contract, orgIdHash, orgJsonUri, orgIdOwner, gasPrice, gasLimit, transactionHashCb); | ||
} | ||
transferOrgIdOwnership(orgIdHash, newOrgIdOwner, orgIdOwner, gasPrice, gasLimit, transactionHashCb) { | ||
return transferOrgIdOwnership_1.transferOrgIdOwnership(this.web3, this.contract, orgIdHash, newOrgIdOwner, orgIdOwner, gasPrice, gasLimit, transactionHashCb); | ||
} | ||
getOrgIdsCount() { | ||
return getOrgIdsCount_1.getOrgIdsCount(this.contract); | ||
} | ||
getOrgId(orgIdHash) { | ||
return getOrgId_1.getOrgId(this.web3, this.contract, orgIdHash); | ||
} | ||
getOrgIds(cursor, count) { | ||
return getOrgIds_1.getOrgIds(this.contract, cursor, count); | ||
} | ||
} | ||
exports.OrgIdContract = OrgIdContract; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@windingtree/org.id-core", | ||
"version": "0.3.5", | ||
"version": "0.3.6", | ||
"description": "Core ORGiD Javascript library", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
30745
26
329