Add sats as a native currency

This will allow you to create an invoice where its primary currency is denominated in sats
This commit is contained in:
Kukks
2019-09-18 18:26:24 +03:00
parent c68bf5220e
commit 71671b9e16
3 changed files with 21 additions and 0 deletions

View File

@@ -21,6 +21,11 @@ namespace BTCPayServer
UriScheme = "bitcoin",
CryptoImagePath = "imlegacy/bitcoin.svg",
LightningImagePath = "imlegacy/bitcoin-lightning.svg",
DefaultRateRules = new[]
{
"SATS_X = SATS_BTC * BTC_X",
"BTC_SATS = sats(BTC_SATS);",
},
DefaultSettings = BTCPayDefaultSettings.GetDefaultSettings(NetworkType),
CoinType = NetworkType == NetworkType.Mainnet ? new KeyPath("0'") : new KeyPath("1'"),
SupportRBF = true,

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;

View File

@@ -98,6 +98,12 @@ namespace BTCPayServer.Services.Rates
{
AddCurrency(_CurrencyProviders, network.CryptoCode, 8, network.CryptoCode);
}
_CurrencyProviders.TryAdd("SATS",
new NumberFormatInfo()
{
CurrencySymbol = "sats", CurrencyDecimalDigits = 0, CurrencyPositivePattern = 3
});
}
return _CurrencyProviders.TryGet(currency.ToUpperInvariant());
}
@@ -189,6 +195,15 @@ namespace BTCPayServer.Services.Rates
}
}
dico.TryAdd("SATS", new CurrencyData()
{
Code = "SATS",
Crypto = true,
Divisibility = 0,
Name = "Satoshis",
Symbol = "Sats",
});
return dico.Values.ToArray();
}