@portkey/did
Advanced tools
Comparing version 0.0.1-alpha.3.1 to 0.0.1-alpha.3.2
@@ -85,3 +85,4 @@ "use strict"; | ||
const info = yield this.getHolderInfo({ caHash: status.caHash, chainId }); | ||
const currentInfo = info.managerInfos.find(i => { var _a; return i.address === ((_a = this.managementAccount) === null || _a === void 0 ? void 0 : _a.address); }); | ||
const address = this.managementAccount.address; | ||
const currentInfo = info.managerInfos.find(i => i.address === address); | ||
if (currentInfo) { | ||
@@ -134,3 +135,4 @@ this.accountInfo = { | ||
const info = yield this.getHolderInfo({ caHash: status.caHash, chainId }); | ||
const currentInfo = info.managerInfos.find(i => { var _a; return i.address === ((_a = this.managementAccount) === null || _a === void 0 ? void 0 : _a.address); }); | ||
const address = this.managementAccount.address; | ||
const currentInfo = info.managerInfos.find(i => i.address === address); | ||
if (currentInfo) { | ||
@@ -151,2 +153,3 @@ this.accountInfo = { | ||
getVerifierServers(chainId) { | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -157,16 +160,15 @@ if (!this.managementAccount) | ||
const req = yield contract.callViewMethod('GetVerifierServers', ''); | ||
if (req === null || req === void 0 ? void 0 : req.error) | ||
throw req === null || req === void 0 ? void 0 : req.error; | ||
return req === null || req === void 0 ? void 0 : req.data.verifierServers; | ||
if (req.error) | ||
throw req.error; | ||
return (_a = req.data) === null || _a === void 0 ? void 0 : _a.verifierServers; | ||
}); | ||
} | ||
getContract({ contractAddress, rpcUrl }) { | ||
var _a, _b; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (!this.managementAccount) | ||
throw new Error('managerAccount does not exist'); | ||
const key = contractAddress + rpcUrl + ((_a = this.managementAccount) === null || _a === void 0 ? void 0 : _a.address); | ||
const key = contractAddress + rpcUrl + this.managementAccount.address; | ||
if (!this.contracts[key]) | ||
this.contracts[key] = yield (0, contracts_1.getContractBasic)({ | ||
account: (_b = this.managementAccount) === null || _b === void 0 ? void 0 : _b.wallet, | ||
account: this.managementAccount.wallet, | ||
rpcUrl, | ||
@@ -198,4 +200,4 @@ contractAddress, | ||
const req = yield contract.callSendMethod('AddManager', this.managementAccount.address, contractParams); | ||
if (req === null || req === void 0 ? void 0 : req.error) | ||
throw req === null || req === void 0 ? void 0 : req.error; | ||
if (req.error) | ||
throw req.error; | ||
return req.data; | ||
@@ -212,4 +214,4 @@ }); | ||
const req = yield contract.callSendMethod('RemoveManager', this.managementAccount.address, contractParams); | ||
if (req === null || req === void 0 ? void 0 : req.error) | ||
throw req === null || req === void 0 ? void 0 : req.error; | ||
if (req.error) | ||
throw req.error; | ||
if (((_a = params.managerInfo) === null || _a === void 0 ? void 0 : _a.address) === this.managementAccount.address && | ||
@@ -220,3 +222,3 @@ this.caInfo[chainId].caHash === params.caHash) { | ||
} | ||
return req === null || req === void 0 ? void 0 : req.data; | ||
return req.data; | ||
}); | ||
@@ -237,4 +239,3 @@ } | ||
if (info && _manager === ((_a = this.managementAccount) === null || _a === void 0 ? void 0 : _a.address) && info.caAddress && info.caHash) { | ||
const _chainId = chainId || info.chainId; | ||
this.caInfo[_chainId] = { caAddress: info.caAddress, caHash: info.caHash }; | ||
this.caInfo[info.chainId || chainId] = { caAddress: info.caAddress, caHash: info.caHash }; | ||
const loginAccount = (_c = (_b = info.loginGuardianInfo[0]) === null || _b === void 0 ? void 0 : _b.loginGuardian) === null || _c === void 0 ? void 0 : _c.identifierHash; | ||
@@ -260,4 +261,4 @@ if (!this.accountInfo.loginAccount && loginAccount) | ||
const req = yield contract.callViewMethod('GetHolderInfo', { caHash: params.caHash }); | ||
if (req === null || req === void 0 ? void 0 : req.error) | ||
throw req === null || req === void 0 ? void 0 : req.error; | ||
if (req.error) | ||
throw req.error; | ||
return req.data; | ||
@@ -264,0 +265,0 @@ }); |
{ | ||
"name": "@portkey/did", | ||
"version": "0.0.1-alpha.3.1", | ||
"version": "0.0.1-alpha.3.2", | ||
"description": "", | ||
@@ -33,3 +33,3 @@ "author": "", | ||
"@portkey/accounts": "^0.0.1-alpha.1.4", | ||
"@portkey/services": "^0.0.1-alpha.2.1", | ||
"@portkey/services": "^0.0.1-alpha.2.2", | ||
"@portkey/contracts": "^0.0.1-alpha.1.6", | ||
@@ -36,0 +36,0 @@ "@portkey/graphql": "^0.0.1-alpha.1.6", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
793
69254