Fix for gtest

This commit is contained in:
Pascal Engélibert 2025-07-25 18:02:57 +02:00
commit e07f06d75f
4 changed files with 235 additions and 182 deletions

View file

@ -5,19 +5,22 @@ mod indexer;
mod response;
use argp::FromArgs;
use log::error;
use serde::{Deserialize, Serialize};
use sp_core::Pair as _;
use sp_core::{
Pair as _,
crypto::{Ss58AddressFormat, Ss58Codec, set_default_ss58_version},
};
use std::{
collections::{hash_map::Entry, HashMap}, io::{BufRead, Read}, str::FromStr, sync::Arc
};
use subxt::{
ext::sp_core::ed25519::Pair,
utils::AccountId32,
collections::{HashMap, hash_map::Entry},
io::{BufRead, Read},
str::FromStr,
sync::Arc,
};
use subxt::{ext::sp_core::ed25519::Pair, utils::AccountId32};
use tiny_http::{Response, ResponseBox, Server};
use tokio::sync::mpsc::{Sender, channel};
use typed_sled::Tree;
use log::error;
/// Game to Blockchain
const TREE_DEBT_G2B: &'static str = "debt_g2b";
@ -30,7 +33,11 @@ struct Opt {
db: String,
/// Duniter indexer URL
#[argp(option, short = 'i', default = "String::from(\"https://squid.gdev.gyroi.de/v1/graphql\")")]
#[argp(
option,
short = 'i',
default = "String::from(\"https://gt-squid.axiom-team.fr/v1/graphql\")"
)]
indexer: String,
/// secret key is legacy (two passwords on the two first lines)
@ -85,8 +92,11 @@ async fn main() {
.expect("Cannot read secret key file");
Pair::from_string(sk_content.trim(), None).expect("Cannot decode secret key")
};
set_default_ss58_version(Ss58AddressFormat::custom(4450));
let pk: AccountId32 = pair.public().into();
let pk_str = pk.to_string();
let pk: sp_core::crypto::AccountId32 = pk.0.into();
let pk_str = dbg!(pk.to_ss58check_with_version(Ss58AddressFormat::custom(4450)));
simplelog::SimpleLogger::init(log::LevelFilter::Debug, simplelog::Config::default()).unwrap();