Skip to content

Examples: Get Network info

Eleazar Garrido edited this page Jan 13, 2019 · 7 revisions

Get the current network type of the chain.

package main

import (
	"fmt"
	"github.com/proximax-storage/nem2-sdk-go/sdk"
	"golang.org/x/net/context"
)

// Simple Network API request
func main() {

	conf, err := sdk.NewConfig("http://localhost:3000",sdk.MijinTest)
	if err != nil {
		panic(err)
	}

	// Use the default http client
	client := sdk.NewClient(nil, conf)

	getNetworkType, err := client.Network.GetNetworkType(context.Background())
	if err != nil {
		fmt.Printf("Network.GetNetworkType returned error: %s", err)
		return
	}
	fmt.Printf("%s\n\n", getNetworkType)
}