-
Notifications
You must be signed in to change notification settings - Fork 2
Get Namespace info
Wei Hau Lim edited this page May 12, 2022
·
3 revisions
- Following parameters required:
- NamespaceID - namespace identifier to get info about
import 'package:xpx_chain_sdk/xpx_sdk.dart';
const baseUrl = 'http://bctestnet3.brimstone.xpxsirius.io:3000';
/// Creating a client instance
/// xpx_chain_sdk uses the Dart's native HttpClient.
/// Depending on the platform, you may want to use either
/// the one which comes from dart:io or the BrowserClient
/// example:
/// 1- import 'package:http/browser_client.dart';
/// 2- var client = newClient(config, BrowserClient());
final client = SiriusClient.fromUrl(baseUrl, null);
/// Simple Namespace API request
void main() async {
/// Generate Id from namespaceName
final nsId = NamespaceId.fromName('prx');
try {
final result = await client.namespace.getNamespace(nsId);
print(result);
} on Exception catch (e) {
print('Exception when calling Namespace->GetNamespace: $e\n');
}
print('\n');
}-
Following parameters required:
- Address - address of account to get namespaces from
-
Following parameters optional:
- pageSize - pagination
- nsId - TODO
final address = Address.fromPublicKey('93C3B9075649F59BD88573ADC55B8915B12390A47C76F0C45F362ED0800BE237',
NetworkType.PUBLIC_TEST);
try {
final result = await client.namespace.getNamespacesFromAccount(address);
print(result);
} on Exception catch (e) {
print('Exception when calling Namespace->GetNamespacesFromAccount: $e\n');
}- Following parameters required:
- List of Addresses - addresses of accounts to get namespaces from
final address = Address.fromPublicKey('93C3B9075649F59BD88573ADC55B8915B12390A47C76F0C45F362ED0800BE237',
NetworkType.PUBLIC_TEST);
try {
final result = await client.namespace.getNamespacesFromAccounts([address]);
print(result);
} on Exception catch (e) {
print('Exception when calling Namespace->GetNamespacesFromAccounts: $e\n');
}- Following parameters required:
- List of NamespaceIds - namespace identifiers to get info about
final nsId = NamespaceId.fromName('prx');
try {
final result = await client.namespace.getNamespacesNames([nsId]);
print(result);
} on Exception catch (e) {
print('Exception when calling Namespace->GetNamespacesNames: $e\n');
}