hns-resolver
v0.1.61
Published
WebAssembly bindings for HARA Codex binary ABI decoder
Downloads
37
Readme
hns-resolver
WebAssembly bindings for HARA Codex binary ABI decoder and Handshake (HNS) Domain Resolver. This project provides seamless integration with both Go and Node.js environments.
Installation for Node.js (NPM)
The JavaScript/TypeScript bindings are published to npm and can be installed easily.
Install via npm or yarn
npm install hns-resolver
# or
yarn add hns-resolverUsage
const { resolveHns, decode_hex, namehash } = require('hns-resolver');
async function main() {
const domain = 'binwalletfactory.hara.ethnet';
const result = await resolveHns(domain);
console.log(result); // Outputs JSON containing the ABI and Address
}
main();Installation for Go
Because this module is hosted in a private GitHub repository, you will need to configure your Go environment to authenticate with GitHub before installing.
1. Configure Go Environment
Set the GOPRIVATE variable so Go bypasses the public proxy for this module:
go env -w GOPRIVATE=github.com/HARA-DID/*2. Configure Git Authentication
You must ensure your local git is authenticated. The easiest way is to instruct git to use SSH instead of HTTPS for GitHub:
git config --global url."[email protected]:".insteadOf "https://github.com/"(Alternatively, you can use a Personal Access Token with a .netrc file if you prefer HTTPS).
3. Install the module
Once authenticated, you can import and download the package using:
go get github.com/HARA-DID/hns-resolver/goUsage
package main
import (
"context"
"fmt"
hnsresolver "github.com/HARA-DID/hns-resolver/go"
)
func main() {
ctx := context.Background()
// Resolve the HNS domain
result, err := hnsresolver.ResolveHns(ctx, "binwalletfactory.hara.ethnet")
if err != nil {
panic(err)
}
fmt.Println(result) // Outputs a JSON string containing the ABI and Address
}