diff --git a/node/get_status_node.go b/node/get_status_node.go index b4f594deb..055942254 100644 --- a/node/get_status_node.go +++ b/node/get_status_node.go @@ -32,6 +32,7 @@ import ( "github.com/status-im/status-go/rpc" "github.com/status-im/status-go/server" accountssvc "github.com/status-im/status-go/services/accounts" + appgeneral "github.com/status-im/status-go/services/app-general" appmetricsservice "github.com/status-im/status-go/services/appmetrics" "github.com/status-im/status-go/services/browsers" "github.com/status-im/status-go/services/chat" @@ -130,6 +131,7 @@ type StatusNode struct { updatesSrvc *updates.Service pendingTracker *transactions.PendingTxTracker connectorSrvc *connector.Service + appGeneralSrvc *appgeneral.Service walletFeed event.Feed } @@ -493,6 +495,7 @@ func (n *StatusNode) stop() error { n.connectorSrvc = nil n.publicMethods = make(map[string]bool) n.pendingTracker = nil + n.appGeneralSrvc = nil n.log.Debug("status node stopped") return nil } diff --git a/node/status_node_services.go b/node/status_node_services.go index 7fe1476dd..e207525ed 100644 --- a/node/status_node_services.go +++ b/node/status_node_services.go @@ -33,6 +33,7 @@ import ( "github.com/status-im/status-go/rpc" accountssvc "github.com/status-im/status-go/services/accounts" "github.com/status-im/status-go/services/accounts/settingsevent" + appgeneral "github.com/status-im/status-go/services/app-general" appmetricsservice "github.com/status-im/status-go/services/appmetrics" "github.com/status-im/status-go/services/browsers" "github.com/status-im/status-go/services/chat" @@ -87,6 +88,7 @@ func (b *StatusNode) initServices(config *params.NodeConfig, mediaServer *server services = append(services, b.subscriptionService()) services = append(services, b.rpcStatsService()) services = append(services, b.appmetricsService()) + services = append(services, b.appgeneralService()) services = append(services, b.peerService()) services = append(services, b.personalService()) services = append(services, b.statusPublicService()) @@ -562,6 +564,13 @@ func (b *StatusNode) appmetricsService() common.StatusService { return b.appMetricsSrvc } +func (b *StatusNode) appgeneralService() *appgeneral.Service { + if b.appGeneralSrvc == nil { + b.appGeneralSrvc = appgeneral.New() + } + return b.appGeneralSrvc +} + func (b *StatusNode) WalletService() *wallet.Service { return b.walletSrvc } diff --git a/services/app-general/api.go b/services/app-general/api.go new file mode 100644 index 000000000..005519298 --- /dev/null +++ b/services/app-general/api.go @@ -0,0 +1,18 @@ +package appgeneral + +import ( + "context" +) + +type API struct { + s *Service +} + +func NewAPI(s *Service) *API { + return &API{s: s} +} + +// Returns a list of currencies for user's selection +func (api *API) GetCurrencies(context context.Context) []*Currency { + return GetCurrencies() +} diff --git a/services/app-general/currency_store.go b/services/app-general/currency_store.go new file mode 100644 index 000000000..20e035b14 --- /dev/null +++ b/services/app-general/currency_store.go @@ -0,0 +1,852 @@ +package appgeneral + +type Currency struct { + Id string `json:"id"` + ShortName string `json:"shortName"` + Name string `json:"name"` + Symbol string `json:"symbol"` + Emoji string `json:"emoji"` + Unicode string `json:"unicode"` + IsToken bool `json:"isToken"` + IsPopular bool `json:"isPopular"` // to help the UI to show popular currencies in separate section +} + +// This list serves as a common currencies data which can be used across platforms +// This data is moved from status-desktop +// https://github.com/status-im/status-desktop/blob/2b415bdc5359f424fbfcabf1b5319bc3a8595921/ui/imports/shared/stores/CurrenciesStore.qml#L30 +var currencyList = []*Currency{ + { + Id: "usd", + ShortName: "USD", + Name: "United States Dollar", + Symbol: "$", + Emoji: "๐Ÿ‡บ๐Ÿ‡ธ", + Unicode: "1f1fa-1f1f8", + IsPopular: true, + IsToken: false, + }, + { + Id: "gbp", + ShortName: "GBP", + Name: "Great Britain Pound", + Symbol: "ยฃ", + Emoji: "๐Ÿ‡ฌ๐Ÿ‡ง", + Unicode: "1f1ec-1f1e7", + IsPopular: true, + IsToken: false, + }, + { + Id: "eur", + ShortName: "EUR", + Name: "Euro", + Symbol: "โ‚ฌ", + Emoji: "๐Ÿ‡ช๐Ÿ‡บ", + Unicode: "1f1ea-1f1fa", + IsPopular: true, + IsToken: false, + }, + { + Id: "rub", + ShortName: "RUB", + Name: "Russian Ruble", + Symbol: "โ‚ฝ", + Emoji: "๐Ÿ‡ท๐Ÿ‡บ", + Unicode: "1f1f7-1f1fa", + IsPopular: true, + IsToken: false, + }, + { + Id: "krw", + ShortName: "KRW", + Name: "South Korean Won", + Symbol: "โ‚ฉ", + Emoji: "๐Ÿ‡ฐ๐Ÿ‡ท", + Unicode: "1f1f0-1f1f7", + IsPopular: true, + IsToken: false, + }, + { + Id: "eth", + ShortName: "ETH", + Name: "Ethereum", + Symbol: "", + Emoji: "", + Unicode: "", + IsPopular: false, + IsToken: true, + }, + { + Id: "btc", + ShortName: "BTC", + Name: "Bitcoin", + Symbol: "", + Emoji: "", + Unicode: "", + IsPopular: false, + IsToken: true, + }, + { + Id: "snt", + ShortName: "SNT", + Name: "Status Network Token", + Symbol: "", + Emoji: "", + Unicode: "", + IsPopular: false, + IsToken: true, + }, + { + Id: "dai", + ShortName: "DAI", + Name: "DAI", + Symbol: "", + Emoji: "", + Unicode: "", + IsPopular: false, + IsToken: true, + }, + { + Id: "aed", + ShortName: "AED", + Name: "United Arab Emirates Dirham", + Symbol: "ุฏ.ุฅ", + Emoji: "๐Ÿ‡ฆ๐Ÿ‡ช", + Unicode: "1f1e6-1f1ea", + IsPopular: false, + IsToken: false, + }, + { + Id: "afn", + ShortName: "AFN", + Name: "Afghan Afghani", + Symbol: "ุ‹", + Emoji: "๐Ÿ‡ฆ๐Ÿ‡ซ", + Unicode: "1f1e6-1f1eb", + IsPopular: false, + IsToken: false, + }, + { + Id: "ars", + ShortName: "ARS", + Name: "Argentine Peso", + Symbol: "$", + Emoji: "๐Ÿ‡ฆ๐Ÿ‡ท", + Unicode: "1f1e6-1f1f7", + IsPopular: false, + IsToken: false, + }, + { + Id: "aud", + ShortName: "AUD", + Name: "Australian Dollar", + Symbol: "$", + Emoji: "๐Ÿ‡ฆ๐Ÿ‡บ", + Unicode: "1f1e6-1f1fa", + IsPopular: false, + IsToken: false, + }, + { + Id: "bbd", + ShortName: "BBD", + Name: "Barbadian Dollar", + Symbol: "$", + Emoji: "๐Ÿ‡ง๐Ÿ‡ง", + Unicode: "1f1e7-1f1e7", + IsPopular: false, + IsToken: false, + }, + { + Id: "bdt", + ShortName: "BDT", + Name: "Bangladeshi Taka", + Symbol: "Tk", + Emoji: "๐Ÿ‡ง๐Ÿ‡ฉ", + Unicode: "1f1e7-1f1e9", + IsPopular: false, + IsToken: false, + }, + { + Id: "bgn", + ShortName: "BGN", + Name: "Bulgarian Lev", + Symbol: "ะปะฒ", + Emoji: "๐Ÿ‡ง๐Ÿ‡ฌ", + Unicode: "1f1e7-1f1ec", + IsPopular: false, + IsToken: false, + }, + { + Id: "bhd", + ShortName: "BHD", + Name: "Bahraini Dinar", + Symbol: "BD", + Emoji: "๐Ÿ‡ง๐Ÿ‡ญ", + Unicode: "1f1e7-1f1ed", + IsPopular: false, + IsToken: false, + }, + { + Id: "bnd", + ShortName: "BND", + Name: "Brunei Dollar", + Symbol: "$", + Emoji: "๐Ÿ‡ง๐Ÿ‡ณ", + Unicode: "1f1e7-1f1f3", + IsPopular: false, + IsToken: false, + }, + { + Id: "bob", + ShortName: "BOB", + Name: "Bolivian Boliviano", + Symbol: "$b", + Emoji: "๐Ÿ‡ง๐Ÿ‡ด", + Unicode: "1f1e7-1f1f4", + IsPopular: false, + IsToken: false, + }, + { + Id: "brl", + ShortName: "BRL", + Name: "Brazilian Real", + Symbol: "R$", + Emoji: "๐Ÿ‡ง๐Ÿ‡ท", + Unicode: "1f1e7-1f1f7", + IsPopular: false, + IsToken: false, + }, + { + Id: "btn", + ShortName: "BTN", + Name: "Bhutanese Ngultrum", + Symbol: "Nu.", + Emoji: "๐Ÿ‡ง๐Ÿ‡น", + Unicode: "1f1e7-1f1f9", + IsPopular: false, + IsToken: false, + }, + { + Id: "cad", + ShortName: "CAD", + Name: "Canadian Dollar", + Symbol: "$", + Emoji: "๐Ÿ‡จ๐Ÿ‡ฆ", + Unicode: "1f1e8-1f1e6", + IsPopular: false, + IsToken: false, + }, + { + Id: "chf", + ShortName: "CHF", + Name: "Swiss Franc", + Symbol: "CHF", + Emoji: "๐Ÿ‡จ๐Ÿ‡ญ", + Unicode: "1f1e8-1f1ed", + IsPopular: false, + IsToken: false, + }, + { + Id: "clp", + ShortName: "CLP", + Name: "Chilean Peso", + Symbol: "$", + Emoji: "๐Ÿ‡จ๐Ÿ‡ฑ", + Unicode: "1f1e8-1f1f1", + IsPopular: false, + IsToken: false, + }, + { + Id: "cny", + ShortName: "CNY", + Name: "Chinese Yuan", + Symbol: "ยฅ", + Emoji: "๐Ÿ‡จ๐Ÿ‡ณ", + Unicode: "1f1e8-1f1f3", + IsPopular: false, + IsToken: false, + }, + { + Id: "cop", + ShortName: "COP", + Name: "Colombian Peso", + Symbol: "$", + Emoji: "๐Ÿ‡จ๐Ÿ‡ด", + Unicode: "1f1e8-1f1f4", + IsPopular: false, + IsToken: false, + }, + { + Id: "crc", + ShortName: "CRC", + Name: "Costa Rican Colรณn", + Symbol: "โ‚ก", + Emoji: "๐Ÿ‡จ๐Ÿ‡ท", + Unicode: "1f1e8-1f1f7", + IsPopular: false, + IsToken: false, + }, + { + Id: "czk", + ShortName: "CZK", + Name: "Czech Koruna", + Symbol: "Kฤ", + Emoji: "๐Ÿ‡จ๐Ÿ‡ฟ", + Unicode: "1f1e8-1f1ff", + IsPopular: false, + IsToken: false, + }, + { + Id: "dkk", + ShortName: "DKK", + Name: "Danish Krone", + Symbol: "kr", + Emoji: "๐Ÿ‡ฉ๐Ÿ‡ฐ", + Unicode: "1f1e9-1f1f0", + IsPopular: false, + IsToken: false, + }, + { + Id: "dop", + ShortName: "DOP", + Name: "Dominican Peso", + Symbol: "RD$", + Emoji: "๐Ÿ‡ฉ๐Ÿ‡ด", + Unicode: "1f1e9-1f1f4", + IsPopular: false, + IsToken: false, + }, + { + Id: "egp", + ShortName: "EGP", + Name: "Egyptian Pound", + Symbol: "ยฃ", + Emoji: "๐Ÿ‡ช๐Ÿ‡ฌ", + Unicode: "1f1ea-1f1ec", + IsPopular: false, + IsToken: false, + }, + { + Id: "etb", + ShortName: "ETB", + Name: "Ethiopian Birr", + Symbol: "Br", + Emoji: "๐Ÿ‡ช๐Ÿ‡น", + Unicode: "1f1ea-1f1f9", + IsPopular: false, + IsToken: false, + }, + { + Id: "gel", + ShortName: "GEL", + Name: "Georgian Lari", + Symbol: "โ‚พ", + Emoji: "๐Ÿ‡ฌ๐Ÿ‡ช", + Unicode: "1f1ec-1f1ea", + IsPopular: false, + IsToken: false, + }, + { + Id: "ghs", + ShortName: "GHS", + Name: "Ghanaian Cedi", + Symbol: "ยข", + Emoji: "๐Ÿ‡ฌ๐Ÿ‡ญ", + Unicode: "1f1ec-1f1ed", + IsPopular: false, + IsToken: false, + }, + { + Id: "hkd", + ShortName: "HKD", + Name: "Hong Kong Dollar", + Symbol: "$", + Emoji: "๐Ÿ‡ญ๐Ÿ‡ฐ", + Unicode: "1f1ed-1f1f0", + IsPopular: false, + IsToken: false, + }, + { + Id: "hrk", + ShortName: "HRK", + Name: "Croatian Kuna", + Symbol: "kn", + Emoji: "๐Ÿ‡ญ๐Ÿ‡ท", + Unicode: "1f1ed-1f1f7", + IsPopular: false, + IsToken: false, + }, + { + Id: "huf", + ShortName: "HUF", + Name: "Hungarian Forint", + Symbol: "Ft", + Emoji: "๐Ÿ‡ญ๐Ÿ‡บ", + Unicode: "1f1ed-1f1fa", + IsPopular: false, + IsToken: false, + }, + { + Id: "idr", + ShortName: "IDR", + Name: "Indonesian Rupiah", + Symbol: "Rp", + Emoji: "๐Ÿ‡ฎ๐Ÿ‡ฉ", + Unicode: "1f1ee-1f1e9", + IsPopular: false, + IsToken: false, + }, + { + Id: "ils", + ShortName: "ILS", + Name: "Israeli New Shekel", + Symbol: "โ‚ช", + Emoji: "๐Ÿ‡ฎ๐Ÿ‡ฑ", + Unicode: "1f1ee-1f1f1", + IsPopular: false, + IsToken: false, + }, + { + Id: "inr", + ShortName: "INR", + Name: "Indian Rupee", + Symbol: "โ‚น", + Emoji: "๐Ÿ‡ฎ๐Ÿ‡ณ", + Unicode: "1f1ee-1f1f3", + IsPopular: false, + IsToken: false, + }, + { + Id: "isk", + ShortName: "ISK", + Name: "Icelandic Krรณna", + Symbol: "kr", + Emoji: "๐Ÿ‡ฎ๐Ÿ‡ธ", + Unicode: "1f1ee-1f1f8", + IsPopular: false, + IsToken: false, + }, + { + Id: "jmd", + ShortName: "JMD", + Name: "Jamaican Dollar", + Symbol: "J$", + Emoji: "๐Ÿ‡ฏ๐Ÿ‡ฒ", + Unicode: "1f1ef-1f1f2", + IsPopular: false, + IsToken: false, + }, + { + Id: "jpy", + ShortName: "JPY", + Name: "Japanese Yen", + Symbol: "ยฅ", + Emoji: "๐Ÿ‡ฏ๐Ÿ‡ต", + Unicode: "1f1ef-1f1f5", + IsPopular: false, + IsToken: false, + }, + { + Id: "kes", + ShortName: "KES", + Name: "Kenyan Shilling", + Symbol: "KSh", + Emoji: "๐Ÿ‡ฐ๐Ÿ‡ช", + Unicode: "1f1f0-1f1ea", + IsPopular: false, + IsToken: false, + }, + { + Id: "kwd", + ShortName: "KWD", + Name: "Kuwaiti Dinar", + Symbol: "ุฏ.ูƒ", + Emoji: "๐Ÿ‡ฐ๐Ÿ‡ผ", + Unicode: "1f1f0-1f1fc", + IsPopular: false, + IsToken: false, + }, + { + Id: "kzt", + ShortName: "KZT", + Name: "Kazakhstani Tenge", + Symbol: "ะปะฒ", + Emoji: "๐Ÿ‡ฐ๐Ÿ‡ฟ", + Unicode: "1f1f0-1f1ff", + IsPopular: false, + IsToken: false, + }, + { + Id: "lkr", + ShortName: "LKR", + Name: "Sri Lankan Rupee", + Symbol: "โ‚จ", + Emoji: "๐Ÿ‡ฑ๐Ÿ‡ฐ", + Unicode: "1f1f1-1f1f0", + IsPopular: false, + IsToken: false, + }, + { + Id: "mad", + ShortName: "MAD", + Name: "Moroccan Dirham", + Symbol: "MAD", + Emoji: "๐Ÿ‡ฒ๐Ÿ‡ฆ", + Unicode: "1f1f2-1f1e6", + IsPopular: false, + IsToken: false, + }, + { + Id: "mdl", + ShortName: "MDL", + Name: "Moldovan Leu", + Symbol: "MDL", + Emoji: "๐Ÿ‡ฒ๐Ÿ‡ฉ", + Unicode: "1f1f2-1f1e9", + IsPopular: false, + IsToken: false, + }, + { + Id: "mur", + ShortName: "MUR", + Name: "Mauritian Rupee", + Symbol: "โ‚จ", + Emoji: "๐Ÿ‡ฒ๐Ÿ‡บ", + Unicode: "1f1f2-1f1f7", + IsPopular: false, + IsToken: false, + }, + { + Id: "mwk", + ShortName: "MWK", + Name: "Malawian Kwacha", + Symbol: "MK", + Emoji: "๐Ÿ‡ฒ๐Ÿ‡ผ", + Unicode: "1f1f2-1f1fc", + IsPopular: false, + IsToken: false, + }, + { + Id: "mxn", + ShortName: "MXN", + Name: "Mexican Peso", + Symbol: "$", + Emoji: "๐Ÿ‡ฒ๐Ÿ‡ฝ", + Unicode: "1f1f2-1f1fd", + IsPopular: false, + IsToken: false, + }, + { + Id: "myr", + ShortName: "MYR", + Name: "Malaysian Ringgit", + Symbol: "RM", + Emoji: "๐Ÿ‡ฒ๐Ÿ‡พ", + Unicode: "1f1f2-1f1fe", + IsPopular: false, + IsToken: false, + }, + { + Id: "mzn", + ShortName: "MZN", + Name: "Mozambican metical", + Symbol: "MT", + Emoji: "๐Ÿ‡ฒ๐Ÿ‡ฟ", + Unicode: "1f1f2-1f1ff", + IsPopular: false, + IsToken: false, + }, + { + Id: "nad", + ShortName: "NAD", + Name: "Namibian Dollar", + Symbol: "$", + Emoji: "๐Ÿ‡ณ๐Ÿ‡ฆ", + Unicode: "1f1f3-1f1e6", + IsPopular: false, + IsToken: false, + }, + { + Id: "ngn", + ShortName: "NGN", + Name: "Nigerian Naira", + Symbol: "โ‚ฆ", + Emoji: "๐Ÿ‡ณ๐Ÿ‡ฌ", + Unicode: "1f1f3-1f1ec", + IsPopular: false, + IsToken: false, + }, + { + Id: "nok", + ShortName: "NOK", + Name: "Norwegian Krone", + Symbol: "kr", + Emoji: "๐Ÿ‡ณ๐Ÿ‡ด", + Unicode: "1f1f3-1f1f4", + IsPopular: false, + IsToken: false, + }, + { + Id: "npr", + ShortName: "NPR", + Name: "Nepalese Rupee", + Symbol: "โ‚จ", + Emoji: "๐Ÿ‡ณ๐Ÿ‡ต", + Unicode: "1f1f3-1f1f5", + IsPopular: false, + IsToken: false, + }, + { + Id: "nzd", + ShortName: "NZD", + Name: "New Zealand Dollar", + Symbol: "$", + Emoji: "๐Ÿ‡ณ๐Ÿ‡ฟ", + Unicode: "1f1f3-1f1ff", + IsPopular: false, + IsToken: false, + }, + { + Id: "omr", + ShortName: "OMR", + Name: "Omani Rial", + Symbol: "๏ทผ", + Emoji: "๐Ÿ‡ด๐Ÿ‡ฒ", + Unicode: "1f1f4-1f1f2", + IsPopular: false, + IsToken: false, + }, + { + Id: "pen", + ShortName: "PEN", + Name: "Peruvian Sol", + Symbol: "S/.", + Emoji: "๐Ÿ‡ต๐Ÿ‡ช", + Unicode: "1f1f5-1f1ea", + IsPopular: false, + IsToken: false, + }, + { + Id: "pgk", + ShortName: "PGK", + Name: "Papua New Guinean Kina", + Symbol: "K", + Emoji: "๐Ÿ‡ต๐Ÿ‡ฌ", + Unicode: "1f1f5-1f1ec", + IsPopular: false, + IsToken: false, + }, + { + Id: "php", + ShortName: "PHP", + Name: "Philippine peso", + Symbol: "โ‚ฑ", + Emoji: "๐Ÿ‡ต๐Ÿ‡ญ", + Unicode: "1f1f5-1f1ed", + IsPopular: false, + IsToken: false, + }, + { + Id: "pkr", + ShortName: "PKR", + Name: "Pakistani Rupee", + Symbol: "โ‚จ", + Emoji: "๐Ÿ‡ต๐Ÿ‡ฐ", + Unicode: "1f1f5-1f1f0", + IsPopular: false, + IsToken: false, + }, + { + Id: "pln", + ShortName: "PLN", + Name: "Polish zล‚oty", + Symbol: "zล‚", + Emoji: "๐Ÿ‡ต๐Ÿ‡ฑ", + Unicode: "1f1f5-1f1f1", + IsPopular: false, + IsToken: false, + }, + { + Id: "pyg", + ShortName: "PYG", + Name: "Paraguayan Guarani", + Symbol: "Gs", + Emoji: "๐Ÿ‡ต๐Ÿ‡พ", + Unicode: "1f1f5-1f1fe", + IsPopular: false, + IsToken: false, + }, + { + Id: "qar", + ShortName: "QAR", + Name: "Qatari Riyal", + Symbol: "๏ทผ", + Emoji: "๐Ÿ‡ถ๐Ÿ‡ฆ", + Unicode: "1f1f6-1f1e6", + IsPopular: false, + IsToken: false, + }, + { + Id: "ron", + ShortName: "RON", + Name: "Romanian Leu", + Symbol: "lei", + Emoji: "๐Ÿ‡ท๐Ÿ‡ด", + Unicode: "1f1f7-1f1f4", + IsPopular: false, + IsToken: false, + }, + { + Id: "rsd", + ShortName: "RSD", + Name: "Serbian Dinar", + Symbol: "ะ”ะธะฝ.", + Emoji: "๐Ÿ‡ท๐Ÿ‡ธ", + Unicode: "1f1f7-1f1f8", + IsPopular: false, + IsToken: false, + }, + { + Id: "sar", + ShortName: "SAR", + Name: "Saudi Riyal", + Symbol: "๏ทผ", + Emoji: "๐Ÿ‡ธ๐Ÿ‡ฆ", + Unicode: "1f1f8-1f1e6", + IsPopular: false, + IsToken: false, + }, + { + Id: "sek", + ShortName: "SEK", + Name: "Swedish Krona", + Symbol: "kr", + Emoji: "๐Ÿ‡ธ๐Ÿ‡ช", + Unicode: "1f1f8-1f1ea", + IsPopular: false, + IsToken: false, + }, + { + Id: "sgd", + ShortName: "SGD", + Name: "Singapore Dollar", + Symbol: "$", + Emoji: "๐Ÿ‡ธ๐Ÿ‡ฌ", + Unicode: "1f1f8-1f1ec", + IsPopular: false, + IsToken: false, + }, + { + Id: "thb", + ShortName: "THB", + Name: "Thai Baht", + Symbol: "เธฟ", + Emoji: "๐Ÿ‡น๐Ÿ‡ญ", + Unicode: "1f1f9-1f1ed", + IsPopular: false, + IsToken: false, + }, + { + Id: "ttd", + ShortName: "TTD", + Name: "Trinidad and Tobago Dollar", + Symbol: "TT$", + Emoji: "๐Ÿ‡น๐Ÿ‡น", + Unicode: "1f1f9-1f1f9", + IsPopular: false, + IsToken: false, + }, + { + Id: "twd", + ShortName: "TWD", + Name: "New Taiwan dollar", + Symbol: "NT$", + Emoji: "๐Ÿ‡น๐Ÿ‡ผ", + Unicode: "1f1f9-1f1fc", + IsPopular: false, + IsToken: false, + }, + { + Id: "tzs", + ShortName: "TZS", + Name: "Tanzanian Shilling", + Symbol: "TSh", + Emoji: "๐Ÿ‡น๐Ÿ‡ฟ", + Unicode: "1f1f9-1f1ff", + IsPopular: false, + IsToken: false, + }, + { + Id: "try", + ShortName: "TRY", + Name: "Turkish lira", + Symbol: "โ‚บ", + Emoji: "๐Ÿ‡น๐Ÿ‡ท", + Unicode: "1f1f9-1f1f7", + IsPopular: false, + IsToken: false, + }, + { + Id: "uah", + ShortName: "UAH", + Name: "Ukrainian hryvnia", + Symbol: "โ‚ด", + Emoji: "๐Ÿ‡บ๐Ÿ‡ฆ", + Unicode: "1f1fa-1f1e6", + IsPopular: false, + IsToken: false, + }, + { + Id: "ugx", + ShortName: "UGX", + Name: "Ugandan Shilling", + Symbol: "USh", + Emoji: "๐Ÿ‡บ๐Ÿ‡ฌ", + Unicode: "1f1fa-1f1ec", + IsPopular: false, + IsToken: false, + }, + { + Id: "uyu", + ShortName: "UYU", + Name: "Uruguayan peso", + Symbol: "$U", + Emoji: "๐Ÿ‡บ๐Ÿ‡พ", + Unicode: "1f1fa-1f1fe", + IsPopular: false, + IsToken: false, + }, + { + Id: "vef", + ShortName: "VEF", + Name: "Venezuelan Bolรญvar", + Symbol: "Bs", + Emoji: "๐Ÿ‡ป๐Ÿ‡ช", + Unicode: "1f1fb-1f1ea", + IsPopular: false, + IsToken: false, + }, + { + Id: "vnd", + ShortName: "VND", + Name: "Vietnamese ฤ‘แป“ng", + Symbol: "โ‚ซ", + Emoji: "๐Ÿ‡ป๐Ÿ‡ณ", + Unicode: "1f1fb-1f1f3", + IsPopular: false, + IsToken: false, + }, + { + Id: "zar", + ShortName: "ZAR", + Name: "South African Rand", + Symbol: "R", + Emoji: "๐Ÿ‡ฟ๐Ÿ‡ฆ", + Unicode: "1f1ff-1f1e6", + IsPopular: false, + IsToken: false, + }, +} + +func GetCurrencies() []*Currency { + return currencyList +} diff --git a/services/app-general/currency_store_test.go b/services/app-general/currency_store_test.go new file mode 100644 index 000000000..7564839e7 --- /dev/null +++ b/services/app-general/currency_store_test.go @@ -0,0 +1,32 @@ +package appgeneral + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestCurrencyList(t *testing.T) { + currencies := GetCurrencies() + require.NotNil(t, currencies) + require.Equal(t, 83, len(currencies)) + + popularCurrencies := make([]*Currency, 0) + cryptoCurrencies := make([]*Currency, 0) + otherFiatCurrencies := make([]*Currency, 0) + for _, c := range currencies { + if c.IsPopular { + popularCurrencies = append(popularCurrencies, c) + } + if c.IsToken { + cryptoCurrencies = append(cryptoCurrencies, c) + } + if !c.IsToken && !c.IsPopular { + otherFiatCurrencies = append(otherFiatCurrencies, c) + } + } + + require.Equal(t, 5, len(popularCurrencies)) + require.Equal(t, 4, len(cryptoCurrencies)) + require.Equal(t, 74, len(otherFiatCurrencies)) +} diff --git a/services/app-general/service.go b/services/app-general/service.go new file mode 100644 index 000000000..072ed99ac --- /dev/null +++ b/services/app-general/service.go @@ -0,0 +1,38 @@ +package appgeneral + +import ( + "github.com/ethereum/go-ethereum/p2p" + "github.com/ethereum/go-ethereum/rpc" +) + +type Service struct{} + +func New() *Service { + return &Service{} +} + +func NewService() *Service { + return &Service{} +} + +func (s *Service) APIs() []rpc.API { + return []rpc.API{ + { + Namespace: "appgeneral", + Version: "0.1.0", + Service: NewAPI(s), + }, + } +} + +func (s *Service) Protocols() []p2p.Protocol { + return nil +} + +func (s *Service) Start() error { + return nil +} + +func (s *Service) Stop() error { + return nil +}