-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add new DID runtime APIs to aid with DID deletion #852
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable! The enums can serve as the missing error cases to show to users via a UI to help users identify which clean up steps they need to perform. And for the transactions I would assume the client just needs logic to batch them in a DID-origin transaction, which the sdk already has. Did you try this out?
Web3NameAccount(LinkableAccountId), | ||
/// An account linked to the DID and resolvable by or to a Dotname. | ||
DotNameAccount(LinkableAccountId), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's because we have the two instances of the linking pallet?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, exactly.
Correct, as long as the batch also includes the As for testing, I modified locally the Web3name integration test const deletionCalls: [SubmittableExtrinsic] =
await api.call.did.linkedResourcesDeletionCalls(
Did.toChain(w3nCreator.uri)
)
const tx = api.tx.utility.batchAll([
// Old call
// api.tx.web3Names.releaseByOwner(),
...deletionCalls,
api.tx.did.delete(0),
])
const authorizedTx = await Did.authorizeTx(
w3nCreator.uri,
tx,
w3nCreatorKey.getSignCallback(w3nCreator),
paymentAccount.address
)
await submitTx(authorizedTx, paymentAccount) Commeting out the I modified the type definitions locally with the following: const tmpCalls = Object.assign(Object.assign({}, batchedDidApiCalls), { linked_resources: {
description: '',
params: [
{
name: 'did',
type: 'AccountId32',
},
],
type: 'Vec<LinkedDidResource>',
}, linked_resources_deletion_calls: {
description: '',
params: [
{
name: 'did',
type: 'AccountId32',
},
],
type: 'Vec<RuntimeCall>',
}}); and properly defined the EDIT: PR for the types repo: https://github.com/KILTprotocol/types-augment/pull/26. |
471c1d0
to
cbf2228
Compare
cbf2228
to
2483ab0
Compare
Fixes https://github.com/KILTprotocol/ticket/issues/3742.
The PR introduces two new runtime APIs: one that returns an
enum
of "linked resources", which some clients might find useful to understand why a DID deletion failed, and one that returns a list ofRuntimeCall
s, that could be extended with adid.delete()
call, put together into autility.batch*
, and submitted to the chain, and be sure the DID deletion will work as expected (as long as all the DID origin requirements are met).