More WIP firo spark electrumx

This commit is contained in:
julian 2023-11-16 14:49:35 -06:00
parent 9addf101a9
commit e8972024dc
3 changed files with 40 additions and 7 deletions

View file

@ -912,16 +912,32 @@ class ElectrumXClient {
/// Takes [sparkCoinHashes] and returns the set id and block height
/// for each coin
///
/// {
/// "mints": [
/// {
/// "denom":5000000,
/// "pubcoin":"b476ed2b374bb081ea51d111f68f0136252521214e213d119b8dc67b92f5a390"
/// }
/// ]
/// }
Future<Map<String, dynamic>> getSparkMintMetaData({
String? requestID,
required List<String> sparkCoinHashes,
required List<({int denom, String pubCoin})> sparkCoinHashes,
}) async {
try {
final response = await request(
requestID: requestID,
command: 'spark.getsparkmintmetadata',
args: [
sparkCoinHashes,
{
"mints": sparkCoinHashes
.map((e) => {
"denom": e.denom,
"pubcoin": e.pubCoin,
})
.toList(),
},
],
);
return Map<String, dynamic>.from(response["result"] as Map);
@ -940,7 +956,7 @@ class ElectrumXClient {
try {
final response = await request(
requestID: requestID,
command: 'getsparklatestcoinid',
command: 'spark.getsparklatestcoinid',
);
return response["result"] as int;
} catch (e) {

View file

@ -421,7 +421,7 @@ class HiddenSettings extends StatelessWidget {
return GestureDetector(
onTap: () async {
try {
final n = DefaultNodes.firo;
final n = DefaultNodes.firoTestnet;
final e = ElectrumXClient.from(
node: ElectrumXNode(
@ -487,7 +487,11 @@ class HiddenSettings extends StatelessWidget {
final mintMetaData =
await e.getSparkMintMetaData(
sparkCoinHashes: [
"lol",
(
denom: 5000000,
pubCoin:
"b476ed2b374bb081ea51d111f68f0136252521214e213d119b8dc67b92f5a390",
)
],
);

View file

@ -239,9 +239,22 @@ abstract class DefaultNodes {
isDown: false,
);
// static NodeModel get firoTestnet => NodeModel(
// host: "firo-testnet.stackwallet.com",
// port: 50002,
// name: defaultName,
// id: _nodeId(Coin.firoTestNet),
// useSSL: true,
// enabled: true,
// coinName: Coin.firoTestNet.name,
// isFailover: true,
// isDown: false,
// );
// TODO revert to above eventually
static NodeModel get firoTestnet => NodeModel(
host: "firo-testnet.stackwallet.com",
port: 50002,
host: "95.179.164.13",
port: 51002,
name: defaultName,
id: _nodeId(Coin.firoTestNet),
useSSL: true,