github.com/mysteriumnetwork/node@v0.0.0-20240516044423-365054f76801/cmd/commands/account/util.go (about) 1 /* 2 * Copyright (C) 2020 The "MysteriumNetwork/node" Authors. 3 * 4 * This program is free software: you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation, either version 3 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program. If not, see <http://www.gnu.org/licenses/>. 16 */ 17 18 package account 19 20 import ( 21 "fmt" 22 23 "github.com/mysteriumnetwork/node/cmd/commands/cli/clio" 24 "github.com/mysteriumnetwork/node/tequilapi/contract" 25 ) 26 27 func findGateway(name string, gws []contract.GatewaysResponse) (*contract.GatewaysResponse, bool) { 28 for _, gw := range gws { 29 if gw.Name == name { 30 return &gw, true 31 } 32 } 33 return nil, false 34 } 35 36 func contains(needle string, stack []string) bool { 37 for _, s := range stack { 38 if needle == s { 39 return true 40 } 41 } 42 return false 43 } 44 45 func printOrder(o contract.PaymentOrderResponse) { 46 clio.Info(fmt.Sprintf("Order ID '%s' is in state: '%s'", o.ID, o.Status)) 47 clio.Info(fmt.Sprintf("Pay: %s %s", o.PayAmount, o.PayCurrency)) 48 clio.Info(fmt.Sprintf("Receive MYST: %s", o.ReceiveMYST)) 49 clio.Info("Data:", string(o.PublicGatewayData)) 50 }