-
Notifications
You must be signed in to change notification settings - Fork 6
Get Account properties info
Yevhen edited this page Jun 22, 2021
·
9 revisions
- Following parameters required:
- Address - address to get account properties from
package main
import (
"context"
"fmt"
"github.com/proximax-storage/go-xpx-chain-sdk/sdk"
)
const (
// Sirius api rest server
baseUrl = "http://localhost:3000"
// Types of network.
networkType = sdk.MijinTest
// Private key of some exist account
privateKey = "3B9670B5CB19C893694FC49B461CE489BF9588BE16DBE8DC29CF06338133DEE6"
)
func main() {
conf, err := sdk.NewConfig(context.Background(), []string{baseUrl})
if err != nil {
fmt.Printf("NewConfig returned error: %s", err)
return
}
// Use the default http client
client := sdk.NewClient(nil, conf)
// Create an account from a private key
account, err := sdk.NewAccountFromPrivateKey(privateKey, networkType, client.GenerationHash())
if err != nil {
fmt.Printf("NewAccountFromPrivateKey returned error: %s", err)
return
}
info, err := client.Account.GetAccountProperties(context.Background(), account.Address)
if err != nil {
fmt.Printf("Account.GetAccountProperties returned error: %s", err)
return
}
fmt.Printf("Address %s\n", info.Address)
fmt.Printf("Allowed Addresses %s\n", info.AllowedAddresses)
fmt.Printf("Allowed MosaicId %s\n", info.AllowedMosaicId)
fmt.Printf("Allowed EntityTypes %s\n", info.AllowedEntityTypes)
fmt.Printf("Blocked Addresses %s\n", info.AllowedAddresses)
fmt.Printf("Blocked MosaicId %s\n", info.AllowedMosaicId)
fmt.Printf("Blocked EntityTypes %s\n", info.AllowedEntityTypes)
}
- Home
- Installation
-
Examples
- Basic functions
- Get Accounts info
- Get Transactions info
- Get Mosaic info
- Get Mosaic Levy info
- Get Namespace info
- Get BlockChain info
- Get Network info
- Get Metadata info
- Get Nem Metadata info
- Get Account Properties info
- Get Exchange info
- Get SDA-SDA Exchange info
- Get Secret lock info
- Get Storage info
- Announces a transaction
- Websocket