Skip to content

Commit

Permalink
[substrate_api/encointer_api] remove obsolete polkadart storage key hack
Browse files Browse the repository at this point in the history
  • Loading branch information
clangenb committed Nov 22, 2023
1 parent 42f9ad2 commit d442bd5
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions app/lib/service/substrate_api/encointer/encointer_api.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import 'dart:convert';
import 'dart:math';

import 'package:convert/convert.dart' show hex;

import 'package:encointer_wallet/config/consts.dart';
import 'package:encointer_wallet/mocks/mock_bazaar_data.dart';
import 'package:encointer_wallet/models/bazaar/account_business_tuple.dart';
Expand Down Expand Up @@ -33,7 +31,6 @@ import 'package:ew_substrate_fixed/substrate_fixed.dart';
// disambiguate global imports of encointer types. We can remove this
// once we got rid of our manual type definitions.
import 'package:ew_polkadart/encointer_types.dart' as et;
import 'package:flutter/foundation.dart';

/// Api to interface with the `js_encointer_service.js`
///
Expand Down Expand Up @@ -508,17 +505,13 @@ class EncointerApi {
if (cid == null) return 0;

try {
final burned = await encointerKusama.query.encointerCeremonies.burnedBootstrapperNewbieTickets(
et.CommunityIdentifier(geohash: cid.geohash, digest: cid.digest),
AddressUtils.addressToPubKey(address).toList(),
);

// Nasty hack because of https://github.com/leonardocustodio/polkadart/issues/373
final ticketsPerBootstrapperKey =
Uint8List.fromList(hex.decode('a7d291a8132b2cc65c41da45f4de76795c03954ec993845da1c7ff36c91390da'));
final ticketsPerBootstrapperBytes = await encointerKusama.rpc.state.getStorage(ticketsPerBootstrapperKey);
final ticketsPerBootstrapper =
ticketsPerBootstrapperBytes != null ? U8Codec.codec.decode(ByteInput(ticketsPerBootstrapperBytes)) : 0;
final [burned, ticketsPerBootstrapper] = await Future.wait([
encointerKusama.query.encointerCeremonies.burnedBootstrapperNewbieTickets(
et.CommunityIdentifier(geohash: cid.geohash, digest: cid.digest),
AddressUtils.addressToPubKey(address).toList(),
),
encointerKusama.query.encointerCeremonies.endorsementTicketsPerBootstrapper(),
]);

Log.p('NewbieTickets: ticketsPerBootstrapper: $ticketsPerBootstrapper, burned: $burned');

Expand Down

0 comments on commit d442bd5

Please sign in to comment.