Getting the Namespace information
Get the ownership and duration for a given namespace identifier.
Prerequisites
- XPX-Chain-SDK or XPX-Chain-CLI.
- A text editor or IDE.
- Have one namespace registered.
- Have a namespace with name
foo
.
Getting into some code
Call getNamespace
function, passing the namespace identifier you want to check as a parameter.
conf, err := sdk.NewConfig(context.Background(), []string{"http://bctestnet1.brimstone.xpxsirius.io:3000"})
if err != nil {
panic(err)
}
// Use the default http client
client := sdk.NewClient(nil, conf)
// Generate Id from namespaceName
namespaceId, _ := sdk.NewNamespaceIdFromName("foo")
namespace, err := client.Namespace.GetNamespaceInfo(context.Background(), namespaceId)
if err != nil {
panic(err)
}
fmt.Printf("%s\n", namespace.String())
const namespaceHttp = new NamespaceHttp('http://bctestnet1.brimstone.xpxsirius.io:3000');
const namespaceId = new NamespaceId('foo');
namespaceHttp
.getNamespace(namespaceId)
.subscribe(namespaceInfo => console.log(namespaceInfo), err => console.error(err));
const namespaceHttp = new NamespaceHttp('http://bctestnet1.brimstone.xpxsirius.io:3000');
const namespaceId = new NamespaceId('foo');
namespaceHttp
.getNamespace(namespaceId)
.subscribe(namespaceInfo => console.log(namespaceInfo), err => console.error(err));
xpx2-cli namespace info --name foo
You can search a subnamespace with the same way, by passing the subnamespace such as foo.bar
.