Skip to content
Snippets Groups Projects
Commit 41b9db0d authored by poka's avatar poka
Browse files

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

parent 61d28e79
No related branches found
No related tags found
No related merge requests found
Pipeline #17854 waiting for manual action
[ [
"https://gdev-indexer.p2p.legal",
"https://idx.gdev.cgeek.fr", "https://idx.gdev.cgeek.fr",
"https://duniter-indexer.coinduf.eu", "https://duniter-indexer.coinduf.eu",
"http://192.168.1.72:8080" "http://192.168.1.72:8080"
......
const String getNameByAddressQ = r''' const String getNameByAddressQ = r'''
query ($address: String!) { query ($address: String!) {
account_by_pk(id: $address) { account_by_pk(pubkey: $address) {
identity { identity {
name name
} }
pubkey
} }
} }
'''; ''';
...@@ -11,7 +12,7 @@ query ($address: String!) { ...@@ -11,7 +12,7 @@ query ($address: String!) {
const String searchAddressByNameQ = r''' const String searchAddressByNameQ = r'''
query ($name: String!) { query ($name: String!) {
search_identity(args: {name: $name}) { search_identity(args: {name: $name}) {
id pubkey
name name
} }
} }
...@@ -21,8 +22,8 @@ const String getHistoryByAddressQ = r''' ...@@ -21,8 +22,8 @@ const String getHistoryByAddressQ = r'''
query ($address: String!, $number: Int!, $cursor: String) { query ($address: String!, $number: Int!, $cursor: String) {
transaction_connection(where: transaction_connection(where:
{_or: [ {_or: [
{issuer_id: {_eq: $address}}, {issuer_pubkey: {_eq: $address}},
{receiver_id: {_eq: $address}} {receiver_pubkey: {_eq: $address}}
]}, ]},
order_by: {created_at: desc}, order_by: {created_at: desc},
first: $number, first: $number,
...@@ -31,8 +32,8 @@ query ($address: String!, $number: Int!, $cursor: String) { ...@@ -31,8 +32,8 @@ query ($address: String!, $number: Int!, $cursor: String) {
node { node {
amount amount
created_at created_at
issuer_id issuer_pubkey
receiver_id receiver_pubkey
issuer { issuer {
identity { identity {
name name
......
...@@ -301,12 +301,12 @@ class DuniterIndexer with ChangeNotifier { ...@@ -301,12 +301,12 @@ class DuniterIndexer with ChangeNotifier {
Padding( Padding(
padding: const EdgeInsets.symmetric(horizontal: 5), padding: const EdgeInsets.symmetric(horizontal: 5),
child: ListTile( child: ListTile(
key: keySearchResult(profile['id']), key: keySearchResult(profile['pubkey']),
horizontalTitleGap: 40, horizontalTitleGap: 40,
contentPadding: const EdgeInsets.all(5), contentPadding: const EdgeInsets.all(5),
leading: cesiumPlusProvider.defaultAvatar(avatarSize), leading: cesiumPlusProvider.defaultAvatar(avatarSize),
title: Row(children: <Widget>[ title: Row(children: <Widget>[
Text(getShortPubkey(profile['id']), Text(getShortPubkey(profile['pubkey']),
style: const TextStyle( style: const TextStyle(
fontSize: 18, fontSize: 18,
fontFamily: 'Monospace', fontFamily: 'Monospace',
...@@ -321,7 +321,7 @@ class DuniterIndexer with ChangeNotifier { ...@@ -321,7 +321,7 @@ class DuniterIndexer with ChangeNotifier {
Column( Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
balance(context, profile['id'], 16), balance(context, profile['pubkey'], 16),
]), ]),
]), ]),
), ),
...@@ -337,14 +337,15 @@ class DuniterIndexer with ChangeNotifier { ...@@ -337,14 +337,15 @@ class DuniterIndexer with ChangeNotifier {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute(builder: (context) { MaterialPageRoute(builder: (context) {
walletsProfiles.address = profile['id']; walletsProfiles.address = profile['pubkey'];
return WalletViewScreen( return WalletViewScreen(
address: profile['id'], address: profile['pubkey'],
username: g1WalletsBox username: g1WalletsBox
.get(profile['id']) .get(profile['pubkey'])
?.id ?.id
?.username, ?.username,
avatar: g1WalletsBox.get(profile['id'])?.avatar, avatar:
g1WalletsBox.get(profile['pubkey'])?.avatar,
); );
}), }),
); );
...@@ -363,7 +364,7 @@ class DuniterIndexer with ChangeNotifier { ...@@ -363,7 +364,7 @@ class DuniterIndexer with ChangeNotifier {
for (final trans in blockchainTX) { for (final trans in blockchainTX) {
final transaction = trans['node']; final transaction = trans['node'];
final direction = final direction =
transaction['issuer_id'] != pubkey ? 'RECEIVED' : 'SENT'; transaction['issuer_pubkey'] != pubkey ? 'RECEIVED' : 'SENT';
transBC.add(i); transBC.add(i);
transBC[i] = []; transBC[i] = [];
...@@ -371,10 +372,10 @@ class DuniterIndexer with ChangeNotifier { ...@@ -371,10 +372,10 @@ class DuniterIndexer with ChangeNotifier {
final int amountBrut = transaction['amount']; final int amountBrut = transaction['amount'];
final double amount = removeDecimalZero(amountBrut / 100); final double amount = removeDecimalZero(amountBrut / 100);
if (direction == "RECEIVED") { if (direction == "RECEIVED") {
transBC[i].add(transaction['issuer_id']); transBC[i].add(transaction['issuer_pubkey']);
transBC[i].add(transaction['issuer']['identity']?['name'] ?? ''); transBC[i].add(transaction['issuer']['identity']?['name'] ?? '');
} else if (direction == "SENT") { } 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(transaction['receiver']['identity']?['name'] ?? '');
} }
transBC[i].add(amount); transBC[i].add(amount);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment