Query
Query DID name
import {NewHashKeyDID} from "hashkeydid";
// tokenId: 1222
// overrides(optional): {"blockTag": 16513266} (search at block number 16513266)
async function QueryDidByTokenId(){
const did = await NewHashKeyDID("https://openapi2.platon.network/rpc");
const did_name = await did.TokenId2Did(1222, {blockTag: 16513266});
console.log(did_name)
}import (
"math/big"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
hashkeydid "github.com/hashkeydid/hashkeydid-go"
)
func QueryDidByTokenId(){
core, _ := hashkeydid.NewDIDCore(hashkeydid.DefaultPlatONUrl)
// opts parameter is optional, it's for search at block number 16513266
opts := &bind.CallOpts{BlockNumber: new(big.Int).SetUint64(16513266)}
did, _ := core.GetDidByTokenId(opts, big.NewInt(1222))
fmt.Println(did)
}Query DID tokenId
import {NewHashKeyDID} from "hashkeydid";
// did name: terro.key
// overrides(optional): {"blockTag": 16513266} (search at block number 16513266)
async function QueryTokenIdByDid(){
const did = await NewHashKeyDID("https://openapi2.platon.network/rpc");
const tokenId = await did.Did2TokenId("terro.key", {blockTag: 16513266})
console.log(tokenId);
}import (
"math/big"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
hashkeydid "github.com/hashkeydid/hashkeydid-go"
)
func QueryTokenIdByDid(){
core, _ := hashkeydid.NewDIDCore(hashkeydid.DefaultPlatONUrl)
// opts parameter is optional, it's for search at block number 16513266
opts := &bind.CallOpts{BlockNumber: new(big.Int).SetUint64(16513266)}
tokenId, _ := core.GetTokenIdByDid(opts, "terro.key")
fmt.Println(tokenId)
}Query DID name by address
Query DID name by address force
Query DID address by DID name
Query DID KYC information
Query DID metadata avatar image url
Query DID resolver avatar url.
Query DID address based on different blockchain
Last updated