func (w *Wallet) GetBalance(of address.Address) (uint64, error) {
	pkh, err := of.ToPubkeyHash()
	if err != nil {
		return 0, err
	}

	storageKey := state.GetStorageHashForPath([]byte("balance"), pkh[:])

	bal, err := w.RPCClient.GetStateKey(context.Background(), &pb.GetStateKeyRequest{
		ShardID: 0,
		Key:     storageKey[:],
	})
	if err != nil {
		return 0, err
	}

	h, err := chainhash.NewHash(bal.Value)
	if err != nil {
		return 0, err
	}

	return state.HashTo64(*h), nil
}
// GetBalance gets the balance of an address.
GetBalance gets the balance of an address.
// GetBalance gets the balance of an address .
func (w *Wallet) GetBalance(of address.Address) (uint64, error) {
	pkh, err := of.ToPubkeyHash()
	if err != nil {
		return 0, err
	}
	storageKey := state.GetStorageHashForPath([]byte("balance"), pkh[:])
	bal, err := w.RPCClient.GetStateKey(context.Background(), &pb.GetStateKeyRequest{
		ShardID: 0,
		Key:     storageKey[:],
	})
	if err != nil {
		return 0, err
	}
	h, err := chainhash.NewHash(bal.Value)
	if err != nil {
		return 0, err
	}
	return state.HashTo64(*h), nil
}
func ( w * Wallet ) GetBalance ( of address . Address ) ( uint64 , error ) { pkh , err := of . ToPubkeyHash ( ) if err != nil { return 0 , err } storageKey := state . GetStorageHashForPath ( [ ] byte ( " " ) , pkh [ : ] ) bal , err := w . RPCClient . GetStateKey ( context . Background ( ) , & pb . GetStateKeyRequest { ShardID : 0 , Key : storageKey [ : ] , } ) if err != nil { return 0 , err } h , err := chainhash . NewHash ( bal . Value ) if err != nil { return 0 , err } return state . HashTo64 ( * h ) , nil }
GetBalance gets the balance of an address.
GetBalance gets the balance of an address .