hypersign-protocol / hid-node

A permissionless blockchain network to manage digital identity and access rights
https://hypersign.id
Apache License 2.0
223 stars 23 forks source link

feat: added events for successful registration of did-document, schema and credential status #362

Closed arnabghose997 closed 1 year ago

arnabghose997 commented 1 year ago

This PR intends to introduce events upon successful registration of DID Document, Schema and Credential Status. The following are the description of events

Event Name Key Value
create_did tx_author <Transaction author's address >
create_schema tx_author <Transaction author's address >
create_credential_status tx_author <Transaction author's address >

After connecting to the WebSocket server of hid-node, subscribing to these events can done as follows:

{"jsonrpc": "2.0","method": "subscribe","id": 0,"params": {"query": "create_did.tx_author='hid1arpjwnd5ujt5lrgvah49nyy63qmunfeh085y4v'"}}
{"jsonrpc": "2.0","method": "subscribe","id": 0,"params": {"query": "create_schema.tx_author='hid1arpjwnd5ujt5lrgvah49nyy63qmunfeh085y4v'"}}
{"jsonrpc": "2.0","method": "subscribe","id": 0,"params": {"query": "create_credential_status.tx_author='hid1arpjwnd5ujt5lrgvah49nyy63qmunfeh085y4v'"}}

The transactions can also fetched using the following API endpoint:

<API_HOST>/cosmos/tx/v1beta1/txs?events="create_did.tx_author='hid1jx7uayq98zgwzrqchfpcpfr4508za04krwxp3a'"

The above endpoint fetches those transactions where the event create_did has the attribute tx_author value to be hid1jx7uayq98zgwzrqchfpcpfr4508za04krwxp3a