diff --git a/api/grpc_client/grpc_client.go b/api/grpc_client/grpc_client.go index 04c5ec4..be9102d 100644 --- a/api/grpc_client/grpc_client.go +++ b/api/grpc_client/grpc_client.go @@ -307,34 +307,34 @@ func (c *Client) EstimateCoinIDSellAll(coinToBuy, coinToSell uint64, gasPrice ui return c.grpcClient.EstimateCoinSellAll(c.ctxFunc(), &api_pb.EstimateCoinSellAllRequest{Height: optionalInt(optionalHeight), Sell: &api_pb.EstimateCoinSellAllRequest_CoinIdToSell{CoinIdToSell: coinToSell}, Buy: &api_pb.EstimateCoinSellAllRequest_CoinIdToBuy{CoinIdToBuy: coinToBuy}, ValueToSell: valueToSell, GasPrice: gasPrice}, c.opts...) } -// EstimateCoinSymbolBuyFrom returns estimate of buy coin transaction with choice of the exchange source. -func (c *Client) EstimateCoinSymbolBuyFrom(coinToSell, coinToBuy string, valueToBuy string, swapFrom string, optionalHeight ...uint64) (*api_pb.EstimateCoinBuyResponse, error) { - return c.grpcClient.EstimateCoinBuy(c.ctxFunc(), &api_pb.EstimateCoinBuyRequest{Height: optionalInt(optionalHeight), Sell: &api_pb.EstimateCoinBuyRequest_CoinToSell{CoinToSell: coinToSell}, Buy: &api_pb.EstimateCoinBuyRequest_CoinToBuy{CoinToBuy: coinToBuy}, ValueToBuy: valueToBuy, SwapFrom: api_pb.SwapFrom(api_pb.SwapFrom_value[swapFrom])}, c.opts...) +// EstimateCoinSymbolBuyExtended returns estimate of buy coin transaction with choice of the exchange source. +func (c *Client) EstimateCoinSymbolBuyExtended(coinToSell, coinToBuy string, valueToBuy string, swapFrom string, route []uint64, optionalHeight ...uint64) (*api_pb.EstimateCoinBuyResponse, error) { + return c.grpcClient.EstimateCoinBuy(c.ctxFunc(), &api_pb.EstimateCoinBuyRequest{Height: optionalInt(optionalHeight), Sell: &api_pb.EstimateCoinBuyRequest_CoinToSell{CoinToSell: coinToSell}, Buy: &api_pb.EstimateCoinBuyRequest_CoinToBuy{CoinToBuy: coinToBuy}, ValueToBuy: valueToBuy, SwapFrom: api_pb.SwapFrom(api_pb.SwapFrom_value[swapFrom]), Route: route}, c.opts...) } -// EstimateCoinSymbolSellFrom returns estimate of sell coin transaction with choice of the exchange source. -func (c *Client) EstimateCoinSymbolSellFrom(coinToBuy, coinToSell string, valueToSell string, swapFrom string, optionalHeight ...uint64) (*api_pb.EstimateCoinSellResponse, error) { - return c.grpcClient.EstimateCoinSell(c.ctxFunc(), &api_pb.EstimateCoinSellRequest{Height: optionalInt(optionalHeight), Sell: &api_pb.EstimateCoinSellRequest_CoinToSell{CoinToSell: coinToSell}, Buy: &api_pb.EstimateCoinSellRequest_CoinToBuy{CoinToBuy: coinToBuy}, ValueToSell: valueToSell, SwapFrom: api_pb.SwapFrom(api_pb.SwapFrom_value[swapFrom])}, c.opts...) +// EstimateCoinSymbolSellExtended returns estimate of sell coin transaction with choice of the exchange source. +func (c *Client) EstimateCoinSymbolSellExtended(coinToBuy, coinToSell string, valueToSell string, swapFrom string, route []uint64, optionalHeight ...uint64) (*api_pb.EstimateCoinSellResponse, error) { + return c.grpcClient.EstimateCoinSell(c.ctxFunc(), &api_pb.EstimateCoinSellRequest{Height: optionalInt(optionalHeight), Sell: &api_pb.EstimateCoinSellRequest_CoinToSell{CoinToSell: coinToSell}, Buy: &api_pb.EstimateCoinSellRequest_CoinToBuy{CoinToBuy: coinToBuy}, ValueToSell: valueToSell, SwapFrom: api_pb.SwapFrom(api_pb.SwapFrom_value[swapFrom]), Route: route}, c.opts...) } -// EstimateCoinSymbolSellAllFrom returns estimate of sell all coin transaction with choice of the exchange source. -func (c *Client) EstimateCoinSymbolSellAllFrom(coinToBuy, coinToSell string, gasPrice uint64, valueToSell string, swapFrom string, optionalHeight ...uint64) (*api_pb.EstimateCoinSellAllResponse, error) { - return c.grpcClient.EstimateCoinSellAll(c.ctxFunc(), &api_pb.EstimateCoinSellAllRequest{Height: optionalInt(optionalHeight), Sell: &api_pb.EstimateCoinSellAllRequest_CoinToSell{CoinToSell: coinToSell}, Buy: &api_pb.EstimateCoinSellAllRequest_CoinToBuy{CoinToBuy: coinToBuy}, ValueToSell: valueToSell, GasPrice: gasPrice, SwapFrom: api_pb.SwapFrom(api_pb.SwapFrom_value[swapFrom])}, c.opts...) +// EstimateCoinSymbolSellAllExtended returns estimate of sell all coin transaction with choice of the exchange source. +func (c *Client) EstimateCoinSymbolSellAllExtended(coinToBuy, coinToSell string, gasPrice uint64, valueToSell string, swapFrom string, route []uint64, optionalHeight ...uint64) (*api_pb.EstimateCoinSellAllResponse, error) { + return c.grpcClient.EstimateCoinSellAll(c.ctxFunc(), &api_pb.EstimateCoinSellAllRequest{Height: optionalInt(optionalHeight), Sell: &api_pb.EstimateCoinSellAllRequest_CoinToSell{CoinToSell: coinToSell}, Buy: &api_pb.EstimateCoinSellAllRequest_CoinToBuy{CoinToBuy: coinToBuy}, ValueToSell: valueToSell, GasPrice: gasPrice, SwapFrom: api_pb.SwapFrom(api_pb.SwapFrom_value[swapFrom]), Route: route}, c.opts...) } -// EstimateCoinIDBuyFrom returns estimate of buy coin transaction with choice of the exchange source. -func (c *Client) EstimateCoinIDBuyFrom(coinToSell, coinToBuy uint64, valueToBuy string, swapFrom string, optionalHeight ...uint64) (*api_pb.EstimateCoinBuyResponse, error) { - return c.grpcClient.EstimateCoinBuy(c.ctxFunc(), &api_pb.EstimateCoinBuyRequest{Height: optionalInt(optionalHeight), Sell: &api_pb.EstimateCoinBuyRequest_CoinIdToSell{CoinIdToSell: coinToSell}, Buy: &api_pb.EstimateCoinBuyRequest_CoinIdToBuy{CoinIdToBuy: coinToBuy}, ValueToBuy: valueToBuy, SwapFrom: api_pb.SwapFrom(api_pb.SwapFrom_value[swapFrom])}, c.opts...) +// EstimateCoinIDBuyExtended returns estimate of buy coin transaction with choice of the exchange source. +func (c *Client) EstimateCoinIDBuyExtended(coinToSell, coinToBuy uint64, valueToBuy string, swapFrom string, route []uint64, optionalHeight ...uint64) (*api_pb.EstimateCoinBuyResponse, error) { + return c.grpcClient.EstimateCoinBuy(c.ctxFunc(), &api_pb.EstimateCoinBuyRequest{Height: optionalInt(optionalHeight), Sell: &api_pb.EstimateCoinBuyRequest_CoinIdToSell{CoinIdToSell: coinToSell}, Buy: &api_pb.EstimateCoinBuyRequest_CoinIdToBuy{CoinIdToBuy: coinToBuy}, ValueToBuy: valueToBuy, SwapFrom: api_pb.SwapFrom(api_pb.SwapFrom_value[swapFrom]), Route: route}, c.opts...) } -// EstimateCoinIDSellFrom returns estimate of sell coin transaction with choice of the exchange source. -func (c *Client) EstimateCoinIDSellFrom(coinToBuy, coinToSell uint64, valueToSell string, swapFrom string, optionalHeight ...uint64) (*api_pb.EstimateCoinSellResponse, error) { - return c.grpcClient.EstimateCoinSell(c.ctxFunc(), &api_pb.EstimateCoinSellRequest{Height: optionalInt(optionalHeight), Sell: &api_pb.EstimateCoinSellRequest_CoinIdToSell{CoinIdToSell: coinToSell}, Buy: &api_pb.EstimateCoinSellRequest_CoinIdToBuy{CoinIdToBuy: coinToBuy}, ValueToSell: valueToSell, SwapFrom: api_pb.SwapFrom(api_pb.SwapFrom_value[swapFrom])}, c.opts...) +// EstimateCoinIDSellExtended returns estimate of sell coin transaction with choice of the exchange source. +func (c *Client) EstimateCoinIDSellExtended(coinToBuy, coinToSell uint64, valueToSell string, swapFrom string, route []uint64, optionalHeight ...uint64) (*api_pb.EstimateCoinSellResponse, error) { + return c.grpcClient.EstimateCoinSell(c.ctxFunc(), &api_pb.EstimateCoinSellRequest{Height: optionalInt(optionalHeight), Sell: &api_pb.EstimateCoinSellRequest_CoinIdToSell{CoinIdToSell: coinToSell}, Buy: &api_pb.EstimateCoinSellRequest_CoinIdToBuy{CoinIdToBuy: coinToBuy}, ValueToSell: valueToSell, SwapFrom: api_pb.SwapFrom(api_pb.SwapFrom_value[swapFrom]), Route: route}, c.opts...) } -// EstimateCoinIDSellAllFrom returns estimate of sell all coin transaction with choice of the exchange source. -func (c *Client) EstimateCoinIDSellAllFrom(coinToBuy, coinToSell uint64, gasPrice uint64, valueToSell string, swapFrom string, optionalHeight ...uint64) (*api_pb.EstimateCoinSellAllResponse, error) { - return c.grpcClient.EstimateCoinSellAll(c.ctxFunc(), &api_pb.EstimateCoinSellAllRequest{Height: optionalInt(optionalHeight), Sell: &api_pb.EstimateCoinSellAllRequest_CoinIdToSell{CoinIdToSell: coinToSell}, Buy: &api_pb.EstimateCoinSellAllRequest_CoinIdToBuy{CoinIdToBuy: coinToBuy}, ValueToSell: valueToSell, GasPrice: gasPrice, SwapFrom: api_pb.SwapFrom(api_pb.SwapFrom_value[swapFrom])}, c.opts...) +// EstimateCoinIDSellAllExtended returns estimate of sell all coin transaction with choice of the exchange source. +func (c *Client) EstimateCoinIDSellAllExtended(coinToBuy, coinToSell uint64, gasPrice uint64, valueToSell string, swapFrom string, route []uint64, optionalHeight ...uint64) (*api_pb.EstimateCoinSellAllResponse, error) { + return c.grpcClient.EstimateCoinSellAll(c.ctxFunc(), &api_pb.EstimateCoinSellAllRequest{Height: optionalInt(optionalHeight), Sell: &api_pb.EstimateCoinSellAllRequest_CoinIdToSell{CoinIdToSell: coinToSell}, Buy: &api_pb.EstimateCoinSellAllRequest_CoinIdToBuy{CoinIdToBuy: coinToBuy}, ValueToSell: valueToSell, GasPrice: gasPrice, SwapFrom: api_pb.SwapFrom(api_pb.SwapFrom_value[swapFrom]), Route: route}, c.opts...) } // EstimateTxCommission returns estimate of encoding transaction with choice of the exchange source. diff --git a/api/http_client/client/api_service/estimate_coin_buy_parameters.go b/api/http_client/client/api_service/estimate_coin_buy_parameters.go index 1a3b816..23f0ccf 100644 --- a/api/http_client/client/api_service/estimate_coin_buy_parameters.go +++ b/api/http_client/client/api_service/estimate_coin_buy_parameters.go @@ -87,6 +87,8 @@ type EstimateCoinBuyParams struct { CoinToSell *string /*Height*/ Height *uint64 + /*Route*/ + Route []string /*SwapFrom*/ SwapFrom *string /*ValueToBuy*/ @@ -207,6 +209,17 @@ func (o *EstimateCoinBuyParams) SetHeight(height *uint64) { o.Height = height } +// WithRoute adds the route to the estimate coin buy params +func (o *EstimateCoinBuyParams) WithRoute(route []string) *EstimateCoinBuyParams { + o.SetRoute(route) + return o +} + +// SetRoute adds the route to the estimate coin buy params +func (o *EstimateCoinBuyParams) SetRoute(route []string) { + o.Route = route +} + // WithSwapFrom adds the swapFrom to the estimate coin buy params func (o *EstimateCoinBuyParams) WithSwapFrom(swapFrom *string) *EstimateCoinBuyParams { o.SetSwapFrom(swapFrom) @@ -349,6 +362,14 @@ func (o *EstimateCoinBuyParams) WriteToRequest(r runtime.ClientRequest, reg strf } + valuesRoute := o.Route + + joinedRoute := swag.JoinByFormat(valuesRoute, "multi") + // query array param route + if err := r.SetQueryParam("route", joinedRoute...); err != nil { + return err + } + if o.SwapFrom != nil { // query param swap_from diff --git a/api/http_client/client/api_service/estimate_coin_sell_all_parameters.go b/api/http_client/client/api_service/estimate_coin_sell_all_parameters.go index 4f6e412..2d73522 100644 --- a/api/http_client/client/api_service/estimate_coin_sell_all_parameters.go +++ b/api/http_client/client/api_service/estimate_coin_sell_all_parameters.go @@ -93,6 +93,8 @@ type EstimateCoinSellAllParams struct { GasPrice *uint64 /*Height*/ Height *uint64 + /*Route*/ + Route []string /*SwapFrom*/ SwapFrom *string /*ValueToSell*/ @@ -202,6 +204,17 @@ func (o *EstimateCoinSellAllParams) SetHeight(height *uint64) { o.Height = height } +// WithRoute adds the route to the estimate coin sell all params +func (o *EstimateCoinSellAllParams) WithRoute(route []string) *EstimateCoinSellAllParams { + o.SetRoute(route) + return o +} + +// SetRoute adds the route to the estimate coin sell all params +func (o *EstimateCoinSellAllParams) SetRoute(route []string) { + o.Route = route +} + // WithSwapFrom adds the swapFrom to the estimate coin sell all params func (o *EstimateCoinSellAllParams) WithSwapFrom(swapFrom *string) *EstimateCoinSellAllParams { o.SetSwapFrom(swapFrom) @@ -328,6 +341,14 @@ func (o *EstimateCoinSellAllParams) WriteToRequest(r runtime.ClientRequest, reg } + valuesRoute := o.Route + + joinedRoute := swag.JoinByFormat(valuesRoute, "multi") + // query array param route + if err := r.SetQueryParam("route", joinedRoute...); err != nil { + return err + } + if o.SwapFrom != nil { // query param swap_from diff --git a/api/http_client/client/api_service/estimate_coin_sell_parameters.go b/api/http_client/client/api_service/estimate_coin_sell_parameters.go index 09bc8a8..4ca1005 100644 --- a/api/http_client/client/api_service/estimate_coin_sell_parameters.go +++ b/api/http_client/client/api_service/estimate_coin_sell_parameters.go @@ -87,6 +87,8 @@ type EstimateCoinSellParams struct { CoinToSell *string /*Height*/ Height *uint64 + /*Route*/ + Route []string /*SwapFrom*/ SwapFrom *string /*ValueToSell*/ @@ -207,6 +209,17 @@ func (o *EstimateCoinSellParams) SetHeight(height *uint64) { o.Height = height } +// WithRoute adds the route to the estimate coin sell params +func (o *EstimateCoinSellParams) WithRoute(route []string) *EstimateCoinSellParams { + o.SetRoute(route) + return o +} + +// SetRoute adds the route to the estimate coin sell params +func (o *EstimateCoinSellParams) SetRoute(route []string) { + o.Route = route +} + // WithSwapFrom adds the swapFrom to the estimate coin sell params func (o *EstimateCoinSellParams) WithSwapFrom(swapFrom *string) *EstimateCoinSellParams { o.SetSwapFrom(swapFrom) @@ -349,6 +362,14 @@ func (o *EstimateCoinSellParams) WriteToRequest(r runtime.ClientRequest, reg str } + valuesRoute := o.Route + + joinedRoute := swag.JoinByFormat(valuesRoute, "multi") + // query array param route + if err := r.SetQueryParam("route", joinedRoute...); err != nil { + return err + } + if o.SwapFrom != nil { // query param swap_from diff --git a/api/http_client/http_client.go b/api/http_client/http_client.go index 454d3a2..95981cb 100644 --- a/api/http_client/http_client.go +++ b/api/http_client/http_client.go @@ -414,9 +414,13 @@ func (c *Client) EstimateCoinIDSellAll(coinToBuy, coinToSell, gasPrice uint64, v return res.GetPayload(), nil } -// EstimateCoinSymbolBuyFrom return estimate of buy coin transaction with choice of the exchange source. -func (c *Client) EstimateCoinSymbolBuyFrom(coinToSell, coinToBuy, valueToBuy string, swapFrom string, optionalHeight ...uint64) (*models.EstimateCoinBuyResponse, error) { - res, err := c.ClientService.EstimateCoinBuy(api_service.NewEstimateCoinBuyParamsWithTimeout(c.timeout).WithCoinToSell(&coinToSell).WithCoinToBuy(&coinToBuy).WithValueToBuy(valueToBuy).WithHeight(optionalInt(optionalHeight)).WithContext(c.ctxFunc())) +// EstimateCoinSymbolBuyExtended return estimate of buy coin transaction with choice of the exchange source. +func (c *Client) EstimateCoinSymbolBuyExtended(coinToSell, coinToBuy, valueToBuy string, swapFrom string, route []uint64, optionalHeight ...uint64) (*models.EstimateCoinBuyResponse, error) { + var coinsRoute []string + for _, coin := range route { + coinsRoute = append(coinsRoute, strconv.Itoa(int(coin))) + } + res, err := c.ClientService.EstimateCoinBuy(api_service.NewEstimateCoinBuyParamsWithTimeout(c.timeout).WithCoinToSell(&coinToSell).WithCoinToBuy(&coinToBuy).WithValueToBuy(valueToBuy).WithHeight(optionalInt(optionalHeight)).WithSwapFrom(&swapFrom).WithRoute(coinsRoute).WithContext(c.ctxFunc())) if err != nil { return nil, err } @@ -424,9 +428,13 @@ func (c *Client) EstimateCoinSymbolBuyFrom(coinToSell, coinToBuy, valueToBuy str return res.GetPayload(), nil } -// EstimateCoinSymbolSellFrom return estimate of sell coin transaction with choice of the exchange source. -func (c *Client) EstimateCoinSymbolSellFrom(coinToBuy, coinToSell, valueToSell string, swapFrom string, optionalHeight ...uint64) (*models.EstimateCoinSellResponse, error) { - res, err := c.ClientService.EstimateCoinSell(api_service.NewEstimateCoinSellParamsWithTimeout(c.timeout).WithCoinToSell(&coinToSell).WithSwapFrom(&swapFrom).WithCoinToBuy(&coinToBuy).WithValueToSell(valueToSell).WithHeight(optionalInt(optionalHeight)).WithContext(c.ctxFunc())) +// EstimateCoinSymbolSellExtended return estimate of sell coin transaction with choice of the exchange source. +func (c *Client) EstimateCoinSymbolSellExtended(coinToBuy, coinToSell, valueToSell string, swapFrom string, route []uint64, optionalHeight ...uint64) (*models.EstimateCoinSellResponse, error) { + var coinsRoute []string + for _, coin := range route { + coinsRoute = append(coinsRoute, strconv.Itoa(int(coin))) + } + res, err := c.ClientService.EstimateCoinSell(api_service.NewEstimateCoinSellParamsWithTimeout(c.timeout).WithCoinToSell(&coinToSell).WithSwapFrom(&swapFrom).WithCoinToBuy(&coinToBuy).WithValueToSell(valueToSell).WithHeight(optionalInt(optionalHeight)).WithRoute(coinsRoute).WithContext(c.ctxFunc())) if err != nil { return nil, err } @@ -434,9 +442,13 @@ func (c *Client) EstimateCoinSymbolSellFrom(coinToBuy, coinToSell, valueToSell s return res.GetPayload(), nil } -// EstimateCoinSymbolSellAllFrom return estimate of sell all coin transaction with choice of the exchange source. -func (c *Client) EstimateCoinSymbolSellAllFrom(coinToBuy, coinToSell string, gasPrice uint64, valueToSell string, swapFrom string, optionalHeight ...uint64) (*models.EstimateCoinSellAllResponse, error) { - res, err := c.ClientService.EstimateCoinSellAll(api_service.NewEstimateCoinSellAllParamsWithTimeout(c.timeout).WithCoinToSell(&coinToSell).WithSwapFrom(&swapFrom).WithCoinToBuy(&coinToBuy).WithValueToSell(valueToSell).WithGasPrice(&gasPrice).WithHeight(optionalInt(optionalHeight)).WithContext(c.ctxFunc())) +// EstimateCoinSymbolSellAllExtended return estimate of sell all coin transaction with choice of the exchange source. +func (c *Client) EstimateCoinSymbolSellAllExtended(coinToBuy, coinToSell string, gasPrice uint64, valueToSell string, swapFrom string, route []uint64, optionalHeight ...uint64) (*models.EstimateCoinSellAllResponse, error) { + var coinsRoute []string + for _, coin := range route { + coinsRoute = append(coinsRoute, strconv.Itoa(int(coin))) + } + res, err := c.ClientService.EstimateCoinSellAll(api_service.NewEstimateCoinSellAllParamsWithTimeout(c.timeout).WithCoinToSell(&coinToSell).WithSwapFrom(&swapFrom).WithCoinToBuy(&coinToBuy).WithValueToSell(valueToSell).WithGasPrice(&gasPrice).WithHeight(optionalInt(optionalHeight)).WithRoute(coinsRoute).WithContext(c.ctxFunc())) if err != nil { return nil, err } @@ -444,9 +456,13 @@ func (c *Client) EstimateCoinSymbolSellAllFrom(coinToBuy, coinToSell string, gas return res.GetPayload(), nil } -// EstimateCoinIDBuyFrom return estimate of buy coin transaction with choice of the exchange source. -func (c *Client) EstimateCoinIDBuyFrom(coinToSell, coinToBuy uint64, valueToBuy string, swapFrom string, optionalHeight ...uint64) (*models.EstimateCoinBuyResponse, error) { - res, err := c.ClientService.EstimateCoinBuy(api_service.NewEstimateCoinBuyParamsWithTimeout(c.timeout).WithCoinIDToSell(&coinToSell).WithSwapFrom(&swapFrom).WithCoinIDToBuy(&coinToBuy).WithValueToBuy(valueToBuy).WithHeight(optionalInt(optionalHeight)).WithContext(c.ctxFunc())) +// EstimateCoinIDBuyExtended return estimate of buy coin transaction with choice of the exchange source. +func (c *Client) EstimateCoinIDBuyExtended(coinToSell, coinToBuy uint64, valueToBuy string, swapFrom string, route []uint64, optionalHeight ...uint64) (*models.EstimateCoinBuyResponse, error) { + var coinsRoute []string + for _, coin := range route { + coinsRoute = append(coinsRoute, strconv.Itoa(int(coin))) + } + res, err := c.ClientService.EstimateCoinBuy(api_service.NewEstimateCoinBuyParamsWithTimeout(c.timeout).WithCoinIDToSell(&coinToSell).WithSwapFrom(&swapFrom).WithCoinIDToBuy(&coinToBuy).WithValueToBuy(valueToBuy).WithHeight(optionalInt(optionalHeight)).WithRoute(coinsRoute).WithContext(c.ctxFunc())) if err != nil { return nil, err } @@ -454,9 +470,13 @@ func (c *Client) EstimateCoinIDBuyFrom(coinToSell, coinToBuy uint64, valueToBuy return res.GetPayload(), nil } -// EstimateCoinIDSellFrom return estimate of sell coin transaction with choice of the exchange source. -func (c *Client) EstimateCoinIDSellFrom(coinToBuy, coinToSell uint64, valueToSell string, swapFrom string, optionalHeight ...uint64) (*models.EstimateCoinSellResponse, error) { - res, err := c.ClientService.EstimateCoinSell(api_service.NewEstimateCoinSellParamsWithTimeout(c.timeout).WithCoinIDToSell(&coinToSell).WithSwapFrom(&swapFrom).WithCoinIDToBuy(&coinToBuy).WithValueToSell(valueToSell).WithHeight(optionalInt(optionalHeight)).WithContext(c.ctxFunc())) +// EstimateCoinIDSellExtended return estimate of sell coin transaction with choice of the exchange source. +func (c *Client) EstimateCoinIDSellExtended(coinToBuy, coinToSell uint64, valueToSell string, swapFrom string, route []uint64, optionalHeight ...uint64) (*models.EstimateCoinSellResponse, error) { + var coinsRoute []string + for _, coin := range route { + coinsRoute = append(coinsRoute, strconv.Itoa(int(coin))) + } + res, err := c.ClientService.EstimateCoinSell(api_service.NewEstimateCoinSellParamsWithTimeout(c.timeout).WithCoinIDToSell(&coinToSell).WithSwapFrom(&swapFrom).WithCoinIDToBuy(&coinToBuy).WithValueToSell(valueToSell).WithHeight(optionalInt(optionalHeight)).WithRoute(coinsRoute).WithContext(c.ctxFunc())) if err != nil { return nil, err } @@ -464,9 +484,13 @@ func (c *Client) EstimateCoinIDSellFrom(coinToBuy, coinToSell uint64, valueToSel return res.GetPayload(), nil } -// EstimateCoinIDSellAllFrom return estimate of sell all coin transaction with choice of the exchange source. -func (c *Client) EstimateCoinIDSellAllFrom(coinToBuy, coinToSell, gasPrice uint64, valueToSell string, swapFrom string, optionalHeight ...uint64) (*models.EstimateCoinSellAllResponse, error) { - res, err := c.ClientService.EstimateCoinSellAll(api_service.NewEstimateCoinSellAllParamsWithTimeout(c.timeout).WithCoinIDToSell(&coinToSell).WithSwapFrom(&swapFrom).WithCoinIDToBuy(&coinToBuy).WithValueToSell(valueToSell).WithGasPrice(&gasPrice).WithHeight(optionalInt(optionalHeight)).WithContext(c.ctxFunc())) +// EstimateCoinIDSellAllExtended return estimate of sell all coin transaction with choice of the exchange source. +func (c *Client) EstimateCoinIDSellAllExtended(coinToBuy, coinToSell, gasPrice uint64, valueToSell string, swapFrom string, route []uint64, optionalHeight ...uint64) (*models.EstimateCoinSellAllResponse, error) { + var coinsRoute []string + for _, coin := range route { + coinsRoute = append(coinsRoute, strconv.Itoa(int(coin))) + } + res, err := c.ClientService.EstimateCoinSellAll(api_service.NewEstimateCoinSellAllParamsWithTimeout(c.timeout).WithCoinIDToSell(&coinToSell).WithSwapFrom(&swapFrom).WithCoinIDToBuy(&coinToBuy).WithValueToSell(valueToSell).WithGasPrice(&gasPrice).WithHeight(optionalInt(optionalHeight)).WithRoute(coinsRoute).WithContext(c.ctxFunc())) if err != nil { return nil, err } diff --git a/go.mod b/go.mod index 6e4f792..b432d44 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.15 require ( github.com/FactomProject/basen v0.0.0-20150613233007-fe3947df716e // indirect github.com/FactomProject/btcutilecc v0.0.0-20130527213604-d3a63a5752ec // indirect - github.com/MinterTeam/node-grpc-gateway v1.2.2-0.20210216130203-7758778c5b98 + github.com/MinterTeam/node-grpc-gateway v1.2.2-0.20210217024423-f97221eb0f93 github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef // indirect github.com/btcsuite/btcd v0.21.0-beta // indirect github.com/cmars/basen v0.0.0-20150613233007-fe3947df716e // indirect diff --git a/go.sum b/go.sum index 13a1688..346fce2 100644 --- a/go.sum +++ b/go.sum @@ -51,8 +51,8 @@ github.com/FactomProject/basen v0.0.0-20150613233007-fe3947df716e h1:ahyvB3q25Yn github.com/FactomProject/basen v0.0.0-20150613233007-fe3947df716e/go.mod h1:kGUqhHd//musdITWjFvNTHn90WG9bMLBEPQZ17Cmlpw= github.com/FactomProject/btcutilecc v0.0.0-20130527213604-d3a63a5752ec h1:1Qb69mGp/UtRPn422BH4/Y4Q3SLUrD9KHuDkm8iodFc= github.com/FactomProject/btcutilecc v0.0.0-20130527213604-d3a63a5752ec/go.mod h1:CD8UlnlLDiqb36L110uqiP2iSflVjx9g/3U9hCI4q2U= -github.com/MinterTeam/node-grpc-gateway v1.2.2-0.20210216130203-7758778c5b98 h1:lQTUWrPwwW4h+Tt8owbAsd8PUlqzWuuj1XWW+TKTdrk= -github.com/MinterTeam/node-grpc-gateway v1.2.2-0.20210216130203-7758778c5b98/go.mod h1:d4Rw0MtsZTrFNLJJWr/jcurTYcqRVITzWuGDGo7aHxM= +github.com/MinterTeam/node-grpc-gateway v1.2.2-0.20210217024423-f97221eb0f93 h1:Mz/BOi+Q7sqtxhcet5dG0I+iO/tv1XiBIcZodaKosCw= +github.com/MinterTeam/node-grpc-gateway v1.2.2-0.20210217024423-f97221eb0f93/go.mod h1:d4Rw0MtsZTrFNLJJWr/jcurTYcqRVITzWuGDGo7aHxM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/PuerkitoBio/purell v1.1.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI=