Add secondary currency picker to explorer

This commit is contained in:
Martin Boehm 2022-12-10 00:22:08 +01:00 committed by Martin
parent ea0391e03f
commit aebc1c3495
34 changed files with 212 additions and 151 deletions

View File

@ -677,29 +677,30 @@ func computeFeeStats(stopCompute chan os.Signal, blockFrom, blockTo int, db *db.
return err
}
func initDownloaders(db *db.RocksDB, chain bchain.BlockChain, configfile string) {
data, err := ioutil.ReadFile(configfile)
func initDownloaders(db *db.RocksDB, chain bchain.BlockChain, configFile string) {
data, err := ioutil.ReadFile(configFile)
if err != nil {
glog.Errorf("Error reading file %v, %v", configfile, err)
glog.Errorf("Error reading file %v, %v", configFile, err)
return
}
var config struct {
FiatRates string `json:"fiat_rates"`
FiatRatesParams string `json:"fiat_rates_params"`
FourByteSignatures string `json:"fourByteSignatures"`
FiatRates string `json:"fiat_rates"`
FiatRatesParams string `json:"fiat_rates_params"`
FiatRatesVsCurrencies string `json:"fiat_rates_vs_currencies"`
FourByteSignatures string `json:"fourByteSignatures"`
}
err = json.Unmarshal(data, &config)
if err != nil {
glog.Errorf("Error parsing config file %v, %v", configfile, err)
glog.Errorf("Error parsing config file %v, %v", configFile, err)
return
}
if config.FiatRates == "" || config.FiatRatesParams == "" {
glog.Infof("FiatRates config (%v) is empty, not downloading fiat rates", configfile)
glog.Infof("FiatRates config (%v) is empty, not downloading fiat rates", configFile)
} else {
fiatRates, err := fiat.NewFiatRatesDownloader(db, config.FiatRates, config.FiatRatesParams, onNewFiatRatesTicker)
fiatRates, err := fiat.NewFiatRatesDownloader(db, config.FiatRates, config.FiatRatesParams, config.FiatRatesVsCurrencies, onNewFiatRatesTicker)
if err != nil {
glog.Errorf("NewFiatRatesDownloader Init error: %v", err)
} else {

View File

@ -56,6 +56,7 @@
"slip44": 145,
"additional_params": {
"fiat_rates": "coingecko",
"fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH",
"fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"bitcoin-cash\", \"periodSeconds\": 900}"
}
}

View File

@ -252,6 +252,7 @@
"slip44": 156,
"additional_params": {
"fiat_rates": "coingecko",
"fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH",
"fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"bitcoin-gold\", \"periodSeconds\": 900}"
}
}

View File

@ -66,6 +66,7 @@
"alternative_estimate_fee": "whatthefee-disabled",
"alternative_estimate_fee_params": "{\"url\": \"https://whatthefee.io/data.json\", \"periodSeconds\": 60}",
"fiat_rates": "coingecko",
"fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH",
"fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"bitcoin\", \"periodSeconds\": 900}"
}
}

View File

@ -60,6 +60,7 @@
"block_addresses_to_keep": 300,
"additional_params": {
"fiat_rates": "coingecko",
"fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH",
"fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"bitcore\", \"periodSeconds\": 900}"
}
}

View File

@ -58,6 +58,7 @@
"slip44": 5,
"additional_params": {
"fiat_rates": "coingecko",
"fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH",
"fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"dash\", \"periodSeconds\": 900}"
}
}

View File

@ -59,6 +59,7 @@
"slip44": 20,
"additional_params": {
"fiat_rates": "coingecko",
"fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH",
"fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"digibyte\", \"periodSeconds\": 900}"
}
}

View File

@ -67,6 +67,7 @@
"slip44": 3,
"additional_params": {
"fiat_rates": "coingecko",
"fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH",
"fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"dogecoin\", \"periodSeconds\": 900}"
}
}

View File

@ -60,6 +60,7 @@
"slip44": 899,
"additional_params": {
"fiat_rates": "coingecko",
"fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH",
"fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"ecash\", \"periodSeconds\": 900}"
}
}

View File

@ -54,6 +54,7 @@
"mempoolTxTimeoutHours": 48,
"queryBackendOnMempoolResync": true,
"fiat_rates": "coingecko",
"fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH",
"fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"ethereum-classic\", \"periodSeconds\": 900}",
"fourByteSignatures": "https://www.4byte.directory/api/v1/signatures/"
}

View File

@ -61,6 +61,7 @@
"mempoolTxTimeoutHours": 48,
"queryBackendOnMempoolResync": false,
"fiat_rates": "coingecko",
"fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH",
"fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"ethereum\",\"platformIdentifier\": \"ethereum\",\"platformVsCurrency\": \"eth\",\"periodSeconds\": 900}"
}
}

View File

@ -63,6 +63,7 @@
"processInternalTransactions": true,
"queryBackendOnMempoolResync": false,
"fiat_rates": "coingecko",
"fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH",
"fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"ethereum\",\"platformIdentifier\": \"ethereum\",\"platformVsCurrency\": \"eth\",\"periodSeconds\": 900}",
"fourByteSignatures": "https://www.4byte.directory/api/v1/signatures/"
}

View File

@ -27,9 +27,7 @@
"verification_type": "sha256",
"verification_source": "8aa699f3fbd6681391b90f744a25155d21a94f5ca63d6cc3b85172f3aca6e2a0",
"extract_command": "tar -C backend --strip 1 -xf",
"exclude_files": [
"bin/fujicoin-qt"
],
"exclude_files": ["bin/fujicoin-qt"],
"exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/fujicoind -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid",
"logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/*.log",
"postinst_script_template": "",
@ -61,6 +59,7 @@
"slip44": 75,
"additional_params": {
"fiat_rates": "coingecko",
"fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH",
"fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"fujicoin\", \"periodSeconds\": 600}"
}
}
@ -69,4 +68,4 @@
"package_maintainer": "Motty",
"package_maintainer_email": "fujicoin@gmail.com"
}
}
}

View File

@ -60,6 +60,7 @@
"slip44": 17,
"additional_params": {
"fiat_rates": "coingecko",
"fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH",
"fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"groestlcoin\", \"periodSeconds\": 900}"
}
}

View File

@ -27,9 +27,7 @@
"verification_type": "sha256",
"verification_source": "4b69743190e2697d7b7772bf6f63cde595d590ff6664abf15a7201dab2a6098b",
"extract_command": "tar -C backend --strip 1 -xf",
"exclude_files": [
"bin/groestlcoin-qt"
],
"exclude_files": ["bin/groestlcoin-qt"],
"exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/groestlcoind -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid",
"logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/regtest/*.log",
"postinst_script_template": "",
@ -65,11 +63,7 @@
"xpub_magic": 70617039,
"xpub_magic_segwit_p2sh": 71979618,
"xpub_magic_segwit_native": 73342198,
"slip44": 1,
"additional_params": {
"fiat_rates": "coingecko",
"fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"groestlcoin\", \"periodSeconds\": 60}"
}
"slip44": 1
}
},
"meta": {

View File

@ -27,9 +27,7 @@
"verification_type": "sha256",
"verification_source": "4b69743190e2697d7b7772bf6f63cde595d590ff6664abf15a7201dab2a6098b",
"extract_command": "tar -C backend --strip 1 -xf",
"exclude_files": [
"bin/groestlcoin-qt"
],
"exclude_files": ["bin/groestlcoin-qt"],
"exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/groestlcoind -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid",
"logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/signet/*.log",
"postinst_script_template": "",
@ -59,11 +57,7 @@
"xpub_magic": 70617039,
"xpub_magic_segwit_p2sh": 71979618,
"xpub_magic_segwit_native": 73342198,
"slip44": 1,
"additional_params": {
"fiat_rates": "coingecko",
"fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"groestlcoin\", \"periodSeconds\": 60}"
}
"slip44": 1
}
},
"meta": {

View File

@ -27,9 +27,7 @@
"verification_type": "sha256",
"verification_source": "4b69743190e2697d7b7772bf6f63cde595d590ff6664abf15a7201dab2a6098b",
"extract_command": "tar -C backend --strip 1 -xf",
"exclude_files": [
"bin/groestlcoin-qt"
],
"exclude_files": ["bin/groestlcoin-qt"],
"exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/groestlcoind -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid",
"logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/testnet3/*.log",
"postinst_script_template": "",
@ -59,11 +57,7 @@
"xpub_magic": 70617039,
"xpub_magic_segwit_p2sh": 71979618,
"xpub_magic_segwit_native": 73342198,
"slip44": 1,
"additional_params": {
"fiat_rates": "coingecko",
"fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"groestlcoin\", \"periodSeconds\": 60}"
}
"slip44": 1
}
},
"meta": {

View File

@ -65,6 +65,7 @@
"slip44": 2,
"additional_params": {
"fiat_rates": "coingecko",
"fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH",
"fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"litecoin\", \"periodSeconds\": 900}"
}
}

View File

@ -59,6 +59,7 @@
"slip44": 22,
"additional_params": {
"fiat_rates": "coingecko",
"fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH",
"fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"monacoin\", \"periodSeconds\": 900}"
}
}

View File

@ -62,6 +62,7 @@
"slip44": 7,
"additional_params": {
"fiat_rates": "coingecko",
"fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH",
"fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"namecoin\", \"periodSeconds\": 900}"
}
}

View File

@ -57,6 +57,7 @@
"slip44": 341,
"additional_params": {
"fiat_rates": "coingecko",
"fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH",
"fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"omotenashicoin\", \"periodSeconds\": 900}"
}
}

View File

@ -1,70 +1,64 @@
{
"coin": {
"name": "Omotenashicoin Testnet",
"shortcut": "tMTNS",
"label": "Omotenashicoin Testnet",
"alias": "omotenashicoin_testnet"
},
"ports": {
"blockbook_internal": 19089,
"blockbook_public": 19189,
"backend_rpc": 18089,
"backend_message_queue": 48389
},
"ipc": {
"rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}",
"rpc_user": "rpc",
"rpc_pass": "mtnsrpc",
"rpc_timeout": 25,
"message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}"
},
"backend": {
"package_name": "backend-mtns-testnet",
"package_revision": "satoshilabs-1",
"system_user": "mtns",
"version": "1.7.3",
"binary_url": "https://github.com/omotenashicoin-project/OmotenashiCoin-HDwalletbinaries/raw/master/stable/omotenashicoin-x86_64-linux-gnu.tar.gz",
"verification_type": "",
"verification_source": "",
"extract_command": "tar -C backend --strip 1 -xf",
"exclude_files": [
"bin/omotenashicoin-qt"
],
"exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/omotenashicoind -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid",
"logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/testnet4/*.log",
"postinst_script_template": "",
"service_type": "forking",
"service_additional_params_template": "",
"protect_memory": true,
"mainnet": false,
"server_config_file": "bitcoin_like.conf",
"client_config_file": "bitcoin_like_client.conf",
"additional_params": {
"whitelist": "127.0.0.1"
}
},
"blockbook": {
"package_name": "blockbook-mtns-testnet",
"system_user": "blockbook-mtns",
"internal_binding_template": ":{{.Ports.BlockbookInternal}}",
"public_binding_template": ":{{.Ports.BlockbookPublic}}",
"explorer_url": "",
"additional_params": "",
"block_chain": {
"parse": true,
"mempool_workers": 8,
"mempool_sub_workers": 2,
"block_addresses_to_keep": 300,
"xpub_magic": 70544129,
"slip44": 1,
"additional_params": {
"fiat_rates": "coingecko",
"fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"omotenashicoin\", \"periodSeconds\": 60}"
}
}
},
"meta": {
"package_maintainer": "omotenashicoin dev",
"package_maintainer_email": "git@omotenashicoin.site"
}
"coin": {
"name": "Omotenashicoin Testnet",
"shortcut": "tMTNS",
"label": "Omotenashicoin Testnet",
"alias": "omotenashicoin_testnet"
},
"ports": {
"blockbook_internal": 19089,
"blockbook_public": 19189,
"backend_rpc": 18089,
"backend_message_queue": 48389
},
"ipc": {
"rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}",
"rpc_user": "rpc",
"rpc_pass": "mtnsrpc",
"rpc_timeout": 25,
"message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}"
},
"backend": {
"package_name": "backend-mtns-testnet",
"package_revision": "satoshilabs-1",
"system_user": "mtns",
"version": "1.7.3",
"binary_url": "https://github.com/omotenashicoin-project/OmotenashiCoin-HDwalletbinaries/raw/master/stable/omotenashicoin-x86_64-linux-gnu.tar.gz",
"verification_type": "",
"verification_source": "",
"extract_command": "tar -C backend --strip 1 -xf",
"exclude_files": ["bin/omotenashicoin-qt"],
"exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/omotenashicoind -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid",
"logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/testnet4/*.log",
"postinst_script_template": "",
"service_type": "forking",
"service_additional_params_template": "",
"protect_memory": true,
"mainnet": false,
"server_config_file": "bitcoin_like.conf",
"client_config_file": "bitcoin_like_client.conf",
"additional_params": {
"whitelist": "127.0.0.1"
}
},
"blockbook": {
"package_name": "blockbook-mtns-testnet",
"system_user": "blockbook-mtns",
"internal_binding_template": ":{{.Ports.BlockbookInternal}}",
"public_binding_template": ":{{.Ports.BlockbookPublic}}",
"explorer_url": "",
"additional_params": "",
"block_chain": {
"parse": true,
"mempool_workers": 8,
"mempool_sub_workers": 2,
"block_addresses_to_keep": 300,
"xpub_magic": 70544129,
"slip44": 1
}
},
"meta": {
"package_maintainer": "omotenashicoin dev",
"package_maintainer_email": "git@omotenashicoin.site"
}
}

View File

@ -57,6 +57,7 @@
"slip44": 232,
"additional_params": {
"fiat_rates": "coingecko",
"fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH",
"fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"trezarcoin\", \"periodSeconds\": 900}"
}
}

View File

@ -59,6 +59,7 @@
"slip44": 28,
"additional_params": {
"fiat_rates": "coingecko",
"fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH",
"fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"vertcoin\", \"periodSeconds\": 900}"
}
}

View File

@ -57,6 +57,7 @@
"slip44": 133,
"additional_params": {
"fiat_rates": "coingecko",
"fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH",
"fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"zcash\", \"periodSeconds\": 900}"
}
}

View File

@ -18,17 +18,18 @@ import (
// Coingecko is a structure that implements RatesDownloaderInterface
type Coingecko struct {
url string
coin string
platformIdentifier string
platformVsCurrency string
httpTimeoutSeconds time.Duration
throttlingDelay time.Duration
timeFormat string
httpClient *http.Client
db *db.RocksDB
updatingCurrent bool
updatingTokens bool
url string
coin string
platformIdentifier string
platformVsCurrency string
allowedVsCurrencies map[string]struct{}
httpTimeout time.Duration
throttlingDelay time.Duration
timeFormat string
httpClient *http.Client
db *db.RocksDB
updatingCurrent bool
updatingTokens bool
}
// simpleSupportedVSCurrencies https://api.coingecko.com/api/v3/simple/supported_vs_currencies
@ -50,21 +51,28 @@ type marketChartPrices struct {
}
// NewCoinGeckoDownloader creates a coingecko structure that implements the RatesDownloaderInterface
func NewCoinGeckoDownloader(db *db.RocksDB, url string, coin string, platformIdentifier string, platformVsCurrency string, timeFormat string, throttleDown bool) RatesDownloaderInterface {
func NewCoinGeckoDownloader(db *db.RocksDB, url string, coin string, platformIdentifier string, platformVsCurrency string, allowedVsCurrencies string, timeFormat string, throttleDown bool) RatesDownloaderInterface {
var throttlingDelayMs int
if throttleDown {
throttlingDelayMs = 100
}
httpTimeoutSeconds := 15 * time.Second
httpTimeout := 15 * time.Second
allowedVsCurrenciesMap := make(map[string]struct{})
if len(allowedVsCurrencies) > 0 {
for _, c := range strings.Split(strings.ToLower(allowedVsCurrencies), ",") {
allowedVsCurrenciesMap[c] = struct{}{}
}
}
return &Coingecko{
url: url,
coin: coin,
platformIdentifier: platformIdentifier,
platformVsCurrency: platformVsCurrency,
httpTimeoutSeconds: httpTimeoutSeconds,
timeFormat: timeFormat,
url: url,
coin: coin,
platformIdentifier: platformIdentifier,
platformVsCurrency: platformVsCurrency,
allowedVsCurrencies: allowedVsCurrenciesMap,
httpTimeout: httpTimeout,
timeFormat: timeFormat,
httpClient: &http.Client{
Timeout: httpTimeoutSeconds,
Timeout: httpTimeout,
},
db: db,
throttlingDelay: time.Duration(throttlingDelayMs) * time.Millisecond,
@ -123,7 +131,16 @@ func (cg *Coingecko) simpleSupportedVSCurrencies() (simpleSupportedVSCurrencies,
if err != nil {
return nil, err
}
return data, nil
if len(cg.allowedVsCurrencies) == 0 {
return data, nil
}
filtered := make([]string, 0, len(cg.allowedVsCurrencies))
for _, c := range data {
if _, found := cg.allowedVsCurrencies[c]; found {
filtered = append(filtered, c)
}
}
return filtered, nil
}
// SimplePrice /simple/price Multiple ID and Currency (ids, vs_currencies)

View File

@ -33,7 +33,7 @@ type RatesDownloader struct {
}
// NewFiatRatesDownloader initializes the downloader for FiatRates API.
func NewFiatRatesDownloader(db *db.RocksDB, apiType string, params string, callback OnNewFiatRatesTicker) (*RatesDownloader, error) {
func NewFiatRatesDownloader(db *db.RocksDB, apiType string, params string, allowedVsCurrencies string, callback OnNewFiatRatesTicker) (*RatesDownloader, error) {
var rd = &RatesDownloader{}
type fiatRatesParams struct {
URL string `json:"url"`
@ -65,7 +65,7 @@ func NewFiatRatesDownloader(db *db.RocksDB, apiType string, params string, callb
// a small hack - in tests the callback is not used, therefore there is no delay slowing the test
throttle = false
}
rd.downloader = NewCoinGeckoDownloader(db, rdParams.URL, rdParams.Coin, rdParams.PlatformIdentifier, rdParams.PlatformVsCurrency, rd.timeFormat, throttle)
rd.downloader = NewCoinGeckoDownloader(db, rdParams.URL, rdParams.Coin, rdParams.PlatformIdentifier, rdParams.PlatformVsCurrency, allowedVsCurrencies, rd.timeFormat, throttle)
if is != nil {
is.HasFiatRates = true
is.HasTokenFiatRates = rd.downloadTokens

View File

@ -148,7 +148,7 @@ func TestFiatRates(t *testing.T) {
t.Fatalf("Error parsing FiatRates config - empty parameter")
return
}
fiatRates, err := NewFiatRatesDownloader(d, config.FiatRates, config.FiatRatesParams, nil)
fiatRates, err := NewFiatRatesDownloader(d, config.FiatRates, config.FiatRatesParams, "", nil)
if err != nil {
t.Fatalf("FiatRates init error: %v", err)
}

View File

@ -15,6 +15,7 @@ import (
"regexp"
"runtime"
"runtime/debug"
"sort"
"strconv"
"strings"
"time"
@ -373,6 +374,11 @@ func (s *PublicServer) newTemplateData(r *http.Request) *TemplateData {
t.SecondaryCoin = strings.ToUpper(secondary)
t.CurrentSecondaryCoinRate = float64(ticker.Rates[secondary])
t.CurrentTicker = ticker
t.SecondaryCurrencies = make([]string, 0, len(ticker.Rates))
for k := range ticker.Rates {
t.SecondaryCurrencies = append(t.SecondaryCurrencies, strings.ToUpper(k))
}
sort.Strings(t.SecondaryCurrencies) // sort to get deterministic results
t.UseSecondaryCoin, _ = strconv.ParseBool(r.URL.Query().Get("use_secondary"))
if !t.UseSecondaryCoin {
t.UseSecondaryCoin = cookieUseSecondary
@ -501,6 +507,7 @@ type TemplateData struct {
UseSecondaryCoin bool
CurrentSecondaryCoinRate float64
CurrentTicker *common.CurrencyRatesTicker
SecondaryCurrencies []string
TxDate string
TxSecondaryCoinRate float64
TxTicker *common.CurrencyRatesTicker
@ -724,6 +731,13 @@ func appendAmountWrapperSpan(rv *strings.Builder, primary, symbol, classes strin
rv.WriteString(`">`)
}
func formatSecondaryAmount(a float64, td *TemplateData) string {
if td.SecondaryCoin == "BTC" || td.SecondaryCoin == "ETH" {
return strconv.FormatFloat(a, 'f', 6, 64)
}
return strconv.FormatFloat(a, 'f', 2, 64)
}
func (s *PublicServer) amountSpan(a *api.Amount, td *TemplateData, classes string) template.HTML {
primary := s.formatAmount(a)
var rv strings.Builder
@ -732,7 +746,7 @@ func (s *PublicServer) amountSpan(a *api.Amount, td *TemplateData, classes strin
if td.SecondaryCoin != "" {
p, err := strconv.ParseFloat(primary, 64)
if err == nil {
currentSecondary := strconv.FormatFloat(p*td.CurrentSecondaryCoinRate, 'f', 2, 64)
currentSecondary := formatSecondaryAmount(p*td.CurrentSecondaryCoinRate, td)
txSecondary := ""
// if tx is specified, compute secondary amount is at the time of tx and amount with current rate is returned with class "csec-amt"
if td.Tx != nil {
@ -748,7 +762,7 @@ func (s *PublicServer) amountSpan(a *api.Amount, td *TemplateData, classes strin
}
}
if td.TxSecondaryCoinRate != 0 {
txSecondary = strconv.FormatFloat(p*td.TxSecondaryCoinRate, 'f', 2, 64)
txSecondary = formatSecondaryAmount(p*td.TxSecondaryCoinRate, td)
}
}
if txSecondary != "" {
@ -798,13 +812,13 @@ func (s *PublicServer) tokenAmountSpan(t *api.TokenTransfer, td *TemplateData, c
if found {
base := p * baseRate
currentBase = strconv.FormatFloat(base, 'f', 6, 64)
currentSecondary = strconv.FormatFloat(base*td.CurrentSecondaryCoinRate, 'f', 2, 64)
currentSecondary = formatSecondaryAmount(base*td.CurrentSecondaryCoinRate, td)
}
baseRate, found = s.api.GetContractBaseRate(td.TxTicker, t.Contract, td.Tx.Blocktime)
if found {
base := p * baseRate
txBase = strconv.FormatFloat(base, 'f', 6, 64)
txSecondary = strconv.FormatFloat(base*td.TxSecondaryCoinRate, 'f', 2, 64)
txSecondary = formatSecondaryAmount(base*td.TxSecondaryCoinRate, td)
}
}
if txBase != "" {
@ -843,7 +857,7 @@ func (s *PublicServer) formattedAmountSpan(a *api.Amount, d int, symbol string,
func (s *PublicServer) summaryValuesSpan(baseValue float64, secondaryValue float64, td *TemplateData) template.HTML {
var rv strings.Builder
if secondaryValue > 0 {
appendAmountSpan(&rv, "", strconv.FormatFloat(secondaryValue, 'f', 2, 64), td.SecondaryCoin, "")
appendAmountSpan(&rv, "", formatSecondaryAmount(secondaryValue, td), td.SecondaryCoin, "")
if baseValue > 0 && s.chainParser.GetChainType() == bchain.ChainEthereumType {
rv.WriteString(`<span class="base-value">(`)
appendAmountSpan(&rv, "", strconv.FormatFloat(baseValue, 'f', 6, 64), td.CoinShortcut, "")

File diff suppressed because one or more lines are too long

View File

@ -38,7 +38,7 @@ select {
}
#header {
position: absolute;
position: fixed;
top: 0;
left: 0;
width: 100%;
@ -46,10 +46,18 @@ select {
padding-bottom: 0;
padding-top: 0;
background-color: white;
border: 0;
border-bottom: 1px solid #f6f6f6;
z-index: 10;
}
#header a {
color: var(--bs-navbar-brand-color);
}
#header a:hover {
color: var(--bs-navbar-brand-hover-color);
}
#header .navbar {
--bs-navbar-padding-y: 0.7rem;
}
@ -63,6 +71,23 @@ select {
min-height: 50px;
}
#header .btn.dropdown-toggle {
padding-right: 0;
}
#header .dropdown-menu {
--bs-dropdown-min-width: 13rem;
}
#header .dropdown-menu[data-bs-popper] {
left: initial;
right: 0;
}
#header .dropdown-menu.show {
display: flex;
}
.form-control:focus {
outline: 0;
box-shadow: none;
@ -77,7 +102,6 @@ select {
.badge {
vertical-align: middle;
filter: drop-shadow(0px 4px 4px rgba(0, 0, 0, 0.15));
text-transform: uppercase;
letter-spacing: 0.15em;
--bs-badge-padding-x: 0.8rem;
@ -478,19 +502,18 @@ span.btn-paging:hover {
}
.txerror {
background-color: #c51f13a0;
color: white !important;
color: #c51f13;
}
.txerror a,
.txerror .txvalue {
color: white;
color: #c51f13;
}
.txerror .copyable::before,
.txerror .copied::before {
/* turn svg stroke to white */
filter: hue-rotate(180deg) brightness(1000%) contrast(100%);
/* turn svg stroke to red */
filter: invert(86%) sepia(43%) saturate(732%) hue-rotate(367deg) brightness(84%);
}
.tx-amt .amt:hover,
@ -619,6 +642,11 @@ span.btn-paging:hover {
min-height: 40px;
}
#header .dropdown-menu[data-bs-popper] {
left: 0;
right: initial;
}
.trezor-logo {
top: 10px;
}

View File

@ -48,6 +48,12 @@
<label class="btn" for="primary-coin">{{.CoinShortcut}}</label>
<input type="radio" class="btn-check" name="btnradio" id="secondary-coin" autocomplete="off"{{if .UseSecondaryCoin}} checked{{end}}>
<label class="btn" for="secondary-coin">{{.SecondaryCoin}}</label>
<button type="button" class="btn dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false"></button>
<div class="dropdown-menu row">
{{range $c := .SecondaryCurrencies}}
<div class="col-3"><a href="?secondary={{$c}}&use_secondary=true">{{$c}}</a></div>
{{end}}
</div>
</div>
{{end}}
</div>

View File

@ -143,4 +143,5 @@
</div>
</div>
<span class="text-muted">{{$bb.About}}</span>
{{if .SecondaryCoin}}<span class="text-muted">Exchange rates provided by Coingecko.</span>{{end}}
{{end}}

View File

@ -1,17 +1,17 @@
{{define "txdetail"}}{{$cs := .CoinShortcut}}{{$addr := .AddrStr}}{{$tx := .Tx}}{{$data := .}}
<div class="tx-detail">
<div class="row head{{if eq $tx.EthereumSpecific.Status 0}} txerror{{end}}">
<div class="col-xs-7 col-md-8">
<div class="row head">
<div class="col-xs-7 col-md-8{{if eq $tx.EthereumSpecific.Status 0}} txerror{{end}}">
<a href="/tx/{{$tx.Txid}}" class="ellipsis copyable txid">{{$tx.Txid}}</a>
{{if $tx.Rbf}}<span class="ps-1" tt="Replace-by-Fee (RBF) transaction, could be overridden"> RBF</span>{{end}}
</div>
{{if $tx.Blocktime}}<div class="col-xs-5 col-md-4 text-end">{{if $tx.Confirmations}}mined{{else}}first seen{{end}} <span class="txvalue ms-1">{{unixTimeSpan $tx.Blocktime}}</span></div>{{end}}
{{if eq $tx.EthereumSpecific.Status 0}}<div class="col-12 txerror pb-1"><span class="badge bg-danger">Failed</span>{{if $tx.EthereumSpecific.Error}}<span class="small ms-1">{{$tx.EthereumSpecific.Error}}</span>{{end}}</div>{{end}}
{{if $tx.EthereumSpecific.ParsedData}}
{{if $tx.EthereumSpecific.ParsedData.Name}}<div class="col-12 small"><span class="txvalue">{{$tx.EthereumSpecific.ParsedData.Name}}</span>{{if $tx.EthereumSpecific.ParsedData.MethodId}}<span class="ms-1" tt="4-byte signature"> ({{$tx.EthereumSpecific.ParsedData.MethodId}})</span>{{end}}</div>{{else}}
{{if $tx.EthereumSpecific.ParsedData.MethodId}}<div class="col-12 small txvalue"><span tt="4-byte signature">{{$tx.EthereumSpecific.ParsedData.MethodId}}</span></div>{{end}}
{{end}}
{{end}}
{{if eq $tx.EthereumSpecific.Status 0}}<div col-12><span class="badge bg-danger">Failed</span>{{if $tx.EthereumSpecific.Error}}<span class="small ms-1">{{$tx.EthereumSpecific.Error}}</span>{{end}}</div>{{end}}
</div>
<div class="row body">
<div class="col-md-4">
@ -184,12 +184,12 @@
{{end}}
<div class="row footer">
<div class="col-sm-12 col-md-4">
<div class="col-sm-12 col-md-6">
{{if $tx.FeesSat}}
Fee {{amountSpan $tx.FeesSat $data "txvalue copyable ms-3"}}
Fee {{amountSpan $tx.FeesSat $data "txvalue copyable ms-3"}} <span class="fw-normal small">({{amountSatsSpan $tx.EthereumSpecific.GasPrice $data ""}} Gwei/gas)</span>
{{end}}
</div>
<div class="col-sm-12 col-md-8 text-end">
<div class="col-sm-12 col-md-6 text-end">
<span class="me-4">
{{if $tx.Confirmations}}
<span class="txvalue">{{formatUint32 $tx.Confirmations}}</span> confirmations