Gecko is now pluggued to indexer v0.3.0 with g1 history data

This commit is contained in:
poka 2022-11-27 01:59:58 +01:00
parent 61d28e79d6
commit 41b9db0dfb
3 changed files with 19 additions and 16 deletions

View File

@ -1,4 +1,5 @@
[
"https://gdev-indexer.p2p.legal",
"https://idx.gdev.cgeek.fr",
"https://duniter-indexer.coinduf.eu",
"http://192.168.1.72:8080"

View File

@ -1,9 +1,10 @@
const String getNameByAddressQ = r'''
query ($address: String!) {
account_by_pk(id: $address) {
account_by_pk(pubkey: $address) {
identity {
name
}
pubkey
}
}
''';
@ -11,7 +12,7 @@ query ($address: String!) {
const String searchAddressByNameQ = r'''
query ($name: String!) {
search_identity(args: {name: $name}) {
id
pubkey
name
}
}
@ -21,8 +22,8 @@ const String getHistoryByAddressQ = r'''
query ($address: String!, $number: Int!, $cursor: String) {
transaction_connection(where:
{_or: [
{issuer_id: {_eq: $address}},
{receiver_id: {_eq: $address}}
{issuer_pubkey: {_eq: $address}},
{receiver_pubkey: {_eq: $address}}
]},
order_by: {created_at: desc},
first: $number,
@ -31,8 +32,8 @@ query ($address: String!, $number: Int!, $cursor: String) {
node {
amount
created_at
issuer_id
receiver_id
issuer_pubkey
receiver_pubkey
issuer {
identity {
name

View File

@ -301,12 +301,12 @@ class DuniterIndexer with ChangeNotifier {
Padding(
padding: const EdgeInsets.symmetric(horizontal: 5),
child: ListTile(
key: keySearchResult(profile['id']),
key: keySearchResult(profile['pubkey']),
horizontalTitleGap: 40,
contentPadding: const EdgeInsets.all(5),
leading: cesiumPlusProvider.defaultAvatar(avatarSize),
title: Row(children: <Widget>[
Text(getShortPubkey(profile['id']),
Text(getShortPubkey(profile['pubkey']),
style: const TextStyle(
fontSize: 18,
fontFamily: 'Monospace',
@ -321,7 +321,7 @@ class DuniterIndexer with ChangeNotifier {
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
balance(context, profile['id'], 16),
balance(context, profile['pubkey'], 16),
]),
]),
),
@ -337,14 +337,15 @@ class DuniterIndexer with ChangeNotifier {
Navigator.push(
context,
MaterialPageRoute(builder: (context) {
walletsProfiles.address = profile['id'];
walletsProfiles.address = profile['pubkey'];
return WalletViewScreen(
address: profile['id'],
address: profile['pubkey'],
username: g1WalletsBox
.get(profile['id'])
.get(profile['pubkey'])
?.id
?.username,
avatar: g1WalletsBox.get(profile['id'])?.avatar,
avatar:
g1WalletsBox.get(profile['pubkey'])?.avatar,
);
}),
);
@ -363,7 +364,7 @@ class DuniterIndexer with ChangeNotifier {
for (final trans in blockchainTX) {
final transaction = trans['node'];
final direction =
transaction['issuer_id'] != pubkey ? 'RECEIVED' : 'SENT';
transaction['issuer_pubkey'] != pubkey ? 'RECEIVED' : 'SENT';
transBC.add(i);
transBC[i] = [];
@ -371,10 +372,10 @@ class DuniterIndexer with ChangeNotifier {
final int amountBrut = transaction['amount'];
final double amount = removeDecimalZero(amountBrut / 100);
if (direction == "RECEIVED") {
transBC[i].add(transaction['issuer_id']);
transBC[i].add(transaction['issuer_pubkey']);
transBC[i].add(transaction['issuer']['identity']?['name'] ?? '');
} else if (direction == "SENT") {
transBC[i].add(transaction['receiver_id']);
transBC[i].add(transaction['receiver_pubkey']);
transBC[i].add(transaction['receiver']['identity']?['name'] ?? '');
}
transBC[i].add(amount);