func (share *Share) Balance(arguments *BalanceArguments, reply *BalanceReply) error {
	if err := ratelimit.Limit(share.Limiter); nil != err {
		return err
	}
	log := share.Log
	log.Infof("Share.Balance: %+v", arguments)
	if nil == arguments || nil == arguments.Owner {
		return fault.InvalidItem
	}
	count := arguments.Count
	if count <= 0 {
		return fault.InvalidCount
	}
	if count > owner.MaximumBitmarksCount {
		count = owner.MaximumBitmarksCount
	}
	if !share.IsNormalMode(mode.Normal) {
		return fault.NotAvailableDuringSynchronise
	}
	if arguments.Owner.IsTesting() != mode.IsTesting() {
		return fault.WrongNetworkForPublicKey
	}
	result, err := share.Rsvr.ShareBalance(arguments.Owner, arguments.ShareId, arguments.Count)
	if nil != err {
		return err
	}
	reply.Balances = result
	return nil
}
Balance - list balances for an account
package share
import (
	"golang.org/x/time/rate"
	"github.com/bitmark-inc/bitmarkd/account"
	"github.com/bitmark-inc/bitmarkd/fault"
	"github.com/bitmark-inc/bitmarkd/merkle"
	"github.com/bitmark-inc/bitmarkd/messagebus"
	"github.com/bitmark-inc/bitmarkd/mode"
	"github.com/bitmark-inc/bitmarkd/pay"
	"github.com/bitmark-inc/bitmarkd/reservoir"
	"github.com/bitmark-inc/bitmarkd/rpc/owner"
	"github.com/bitmark-inc/bitmarkd/rpc/ratelimit"
	"github.com/bitmark-inc/bitmarkd/transactionrecord"
	"github.com/bitmark-inc/logger"
)
const (
	rateLimitShare = 200
	rateBurstShare = 100
)
type Share struct {
	Log          *logger.L
	Limiter      *rate.Limiter
	IsNormalMode func(mode.Mode) bool
	Rsvr         reservoir.Reservoir
}
func New(log *logger.L, isNormalMode func(mode.Mode) bool, rsvr reservoir.Reservoir) *Share {
	return &Share{
		Log:          log,
		Limiter:      rate.NewLimiter(rateLimitShare, rateBurstShare),
		IsNormalMode: isNormalMode,
		Rsvr:         rsvr,
	}
}
type CreateReply struct {
	TxId     merkle.Digest                                   `json:"txId"`
	ShareId  merkle.Digest                                   `json:"shareId"`
	PayId    pay.PayId                                       `json:"payId"`
	Payments map[string]transactionrecord.PaymentAlternative `json:"payments"`
}
func (share *Share) Create(bmfr *transactionrecord.BitmarkShare, reply *CreateReply) error {
	if err := ratelimit.Limit(share.Limiter); nil != err {
		return err
	}
	log := share.Log
	log.Infof("Share.Create: %+v", bmfr)
	if !share.IsNormalMode(mode.Normal) {
		return fault.NotAvailableDuringSynchronise
	}
	stored, duplicate, err := share.Rsvr.StoreTransfer(bmfr)
	if nil != err {
		return err
	}
	payId := stored.Id
	txId := stored.TxId
	shareId := stored.IssueTxId
	packed := stored.Packed
	log.Debugf("id: %v", txId)
	log.Debugf("share id: %v", shareId)
	reply.TxId = txId
	reply.ShareId = shareId
	reply.PayId = payId
	reply.Payments = make(map[string]transactionrecord.PaymentAlternative)
	for _, payment := range stored.Payments {
		c := payment[0].Currency.String()
		reply.Payments[c] = payment
	}
	if !duplicate {
		messagebus.Bus.Broadcast.Send("transfer", packed)
	}
	return nil
}
type BalanceArguments struct {
	Owner   *account.Account `json:"owner"`  
	ShareId merkle.Digest    `json:"shareId"`
	Count   int              `json:"count"`  
}
type BalanceReply struct {
	Balances []reservoir.BalanceInfo `json:"balances"`
}