Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to send max amount BNB? #79

Closed
elvis-hp opened this issue Aug 13, 2019 · 1 comment
Closed

how to send max amount BNB? #79

elvis-hp opened this issue Aug 13, 2019 · 1 comment

Comments

@elvis-hp
Copy link

elvis-hp commented Aug 13, 2019

Hi everyone, I need send max amount, so how to send maximum amount? I don't know how to get a fee for the transaction.
I'm using go-sdk.
thanks!

send, err := client.SendToken([]msg.Transfer{{toAccAddress, []types.Coin{{nativeSymbol, amount}}}}, true)

@elvis-hp
Copy link
Author

I got the function, thanks all!

func (bs *BinanceService) GetFees() ([]interface{}, error) {

	c := basic.NewClient(bs.conf.BinanceConfig.API_URL)

	qp := map[string]string{}
	resp, code, err := c.Get("/fees", qp)

	var fees []interface{}

	if err != nil {
		if code == http.StatusNotFound {
			return fees, nil
		}
		return nil, err
	}

	if err := json.Unmarshal(resp, &fees); err != nil {
		return nil, err
	}

	return fees, err

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants