func getWithdrawReqParams(c *sknet.Context, ee engine.Exchange) (*ReqParams, error) { rp := NewReqParams() req := pp.WithdrawalReq{} if err := c.BindJSON(&req); err != nil { return nil, err } // validate pubkey pubkey := req.GetPubkey() if err := validatePubkey(pubkey); err != nil { return nil, err } a, err := ee.GetAccount(pubkey) if err != nil { return nil, err } rp.Values["account"] = a rp.Values["cointype"] = req.GetCoinType() rp.Values["amt"] = req.GetCoins() rp.Values["outAddr"] = req.GetOutputAddress() return rp, nil }
func getRequest(c *sknet.Context, out interface{}) error { d := c.MustGet("rawdata").([]byte) return json.Unmarshal(d, out) }