repositorypackage
2.0.0+incompatible
Repository: https://github.com/hashkeydid/hashkeydid-go.git
Documentation: pkg.go.dev
# Packages
No description provided by the author
# README
HashKey DID Go SDK
Go module to work with HashKey DID Protocol.
Installation
go get github.com/hashkeydid/hashkeydid-go
Usage
hashkeydid-go
provides simple access to the HashKey DID Contracts.
Core
hashkeydid-go.Core
is the core struct of this project to use this SDK function.
core, err := hashkeydid.NewDIDCore("rpc url")
Opts
To query the historical info of DID, SDK provides an option arg called opts
.
User can query the status with a custom block height.
// query the status on Block 40069811
opts := &bind.CallOpts{BlockNumber: big.NewInt(40069811)}
Sample1-GetName
// after user set reverse
name, err := core.GetDIDNameByAddr(opts, address)
Sample2-GetAvatar
In HashKey DID, avatarUrl
supports many forms (Detail).
chainList
is a map which includes information of chains.
SDK provides a default chainList for user to query on-chain status.
User can provide a list with custom chainIds and RPCUrls.
chainList
in args can be nil.
// query by DID name
avatar, err := core.GetAvatarByDIDName(opts, name)
// query by tokenId
avatar, err := core.GetAvatarByTokenId(opts, tokenId)