func (cl *OpencxRPC) GetBalance(args GetBalanceArgs, reply *GetBalanceReply) (err error) {

	// e = h(asset)
	sha3 := sha3.New256()
	sha3.Write([]byte(args.Asset))
	e := sha3.Sum(nil)

	var pubkey *koblitz.PublicKey
	if pubkey, _, err = koblitz.RecoverCompact(koblitz.S256(), args.Signature, e); err != nil {
		err = fmt.Errorf("Error verifying order, invalid signature: \n%s", err)
		return
	}

	var param *coinparam.Params
	if param, err = util.GetParamFromName(args.Asset); err != nil {
		err = fmt.Errorf("Error getting coin type from name, pass in a different asset")
		return
	}

	cl.Server.LockIngests()
	if reply.Amount, err = cl.Server.OpencxDB.GetBalance(pubkey, param); err != nil {
		cl.Server.UnlockIngests()
		err = fmt.Errorf("Error with getbalance command: \n%s", err)
		return
	}
	cl.Server.UnlockIngests()

	return
}
// GetBalance is the RPC Interface for GetBalance
GetBalance is the RPC Interface for GetBalance
// GetBalance is the RPC Interface for GetBalance
func (cl *OpencxRPC) GetBalance(args GetBalanceArgs, reply *GetBalanceReply) (err error) {
	sha3 := sha3.New256()
	sha3.Write([]byte(args.Asset))
	e := sha3.Sum(nil)
	var pubkey *koblitz.PublicKey
	if pubkey, _, err = koblitz.RecoverCompact(koblitz.S256(), args.Signature, e); err != nil {
		err = fmt.Errorf("Error verifying order, invalid signature: \n%s", err)
		return
	}
	var param *coinparam.Params
	if param, err = util.GetParamFromName(args.Asset); err != nil {
		err = fmt.Errorf("Error getting coin type from name, pass in a different asset")
		return
	}
	cl.Server.LockIngests()
	if reply.Amount, err = cl.Server.OpencxDB.GetBalance(pubkey, param); err != nil {
		cl.Server.UnlockIngests()
		err = fmt.Errorf("Error with getbalance command: \n%s", err)
		return
	}
	cl.Server.UnlockIngests()
	return
}
func ( cl * OpencxRPC ) GetBalance ( args GetBalanceArgs , reply * GetBalanceReply ) ( err error ) { sha3 := sha3 . New256 ( ) sha3 . Write ( [ ] byte ( args . Asset ) ) e := sha3 . Sum ( nil ) var pubkey * koblitz . PublicKey if pubkey , _ , err = koblitz . RecoverCompact ( koblitz . S256 ( ) , args . Signature , e ) ; err != nil { err = fmt . Errorf ( " \n " , err ) return } var param * coinparam . Params if param , err = util . GetParamFromName ( args . Asset ) ; err != nil { err = fmt . Errorf ( " " ) return } cl . Server . LockIngests ( ) if reply . Amount , err = cl . Server . OpencxDB . GetBalance ( pubkey , param ) ; err != nil { cl . Server . UnlockIngests ( ) err = fmt . Errorf ( " \n " , err ) return } cl . Server . UnlockIngests ( ) return }
GetBalance is the RPC Interface for GetBalance
GetBalance is the RPC Interface for GetBalance
// e = h(asset)