2

I would like to add a service-endpoint to my Kilt DID, using the Javascript SDK.

I have created a full DID and am trying to add the service-endpoint like so:

const extrinsic = api.createType('Extrinsic', { id: `#${id}`, type: [type], serviceEndpoint: [url] });

const authorizedTx = await Did.authorizeTx(
    didUri,
    extrinsic,
    signRequest(didUri, didAuth),
    submitterAccount.address
);

the extrinsic is not correct as I get an error

SDKError: No key relationship found for extrinsic

I was not able to find this specific actin in the Kilt documentation, so I'm asking here.

1 Answer 1

3

The KILT SDK provides a very thin level of abstraction over the api object that the Polkadot SDK provides.

Adding a service endpoint to a KILT DID can be done in the following way:

const addServiceTx = await api.tx.did.addServiceEndpoint(
  Kilt.Did.serviceToChain({
    id: `#${id}`,
    type: [type],
    serviceEndpoint: [url],
  })
)
const authorizedTx = await Did.authorizeTx(
  didUri,
  addServiceTx,
  signRequest(didUri, didAuth),
  submitterAccount.address
);
1
  • thank you, that worked like a charm
    – Micha Roon
    Commented Mar 29, 2023 at 9:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.