Skip to content

Commit

Permalink
Merge pull request #399 from docknetwork/improve-rpc-support
Browse files Browse the repository at this point in the history
Improve `RPC` support for the `Trust Registry`
  • Loading branch information
olegnn authored Feb 29, 2024
2 parents 28fa08b + 702c7c0 commit f3ef807
Show file tree
Hide file tree
Showing 16 changed files with 1,349 additions and 439 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@docknetwork/sdk",
"version": "7.5.1",
"version": "7.6.0",
"main": "index.js",
"license": "MIT",
"repository": {
Expand Down
9 changes: 6 additions & 3 deletions src/modules/WithParamsAndPublicKeys.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable camelcase */

import { u8aToHex } from '@polkadot/util';
import { createDidSig, typedHexDID, typedHexDIDFromSubstrate } from '../utils/did';
import { createDidSig, typedHexDID } from '../utils/did';
import { getDidNonce } from '../utils/misc';

/**
Expand Down Expand Up @@ -281,7 +281,10 @@ export default class WithParamsAndPublicKeys {
async getPublicKeyByHexDid(hexDid, keyId, withParams = false) {
const resp = await this.queryPublicKeyFromChain(hexDid, keyId);
if (resp) {
const pkObj = WithParamsAndPublicKeys.createPublicKeyObjFromChainResponse(this.api, resp);
const pkObj = WithParamsAndPublicKeys.createPublicKeyObjFromChainResponse(
this.api,
resp,
);
if (withParams) {
if (pkObj.paramsRef === null) {
throw new Error('No reference to parameters for the public key');
Expand Down Expand Up @@ -337,7 +340,7 @@ export default class WithParamsAndPublicKeys {
}
if (pk.paramsRef.isSome) {
const pr = pk.paramsRef.unwrap();
pkObj.paramsRef = [typedHexDIDFromSubstrate(api, pr[0]), pr[1].toNumber()];
pkObj.paramsRef = [typedHexDID(api, pr[0]), pr[1].toNumber()];
} else {
pkObj.paramsRef = null;
}
Expand Down
Loading

0 comments on commit f3ef807

Please sign in to comment.