Skip to content

Commit

Permalink
app: Fixes for UI issue and PAC purchase.
Browse files Browse the repository at this point in the history
  • Loading branch information
patniemeyer committed Oct 25, 2023
1 parent a9cd509 commit d0b5165
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion gui-orchid/lib/api/orchid_eth/eth_transaction.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class EthereumTransaction /*extends EthereumTransactionParams*/ {
Map<String, dynamic> toJson() {
// Export flat json
var json = params.toJson();
json.addAll({'data': data});
json.addAll(<String, dynamic>{'data': data});
// Exclude nonce if null
if (nonce != null) {
json.addAll({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ class OrchidAccountImport {
if (funder != null) {
final version = config.evalIntDefault('account.version', 1);
final chainid = config.evalIntDefault('account.chainid', 1);
final account = Account.fromSignerKeyRef(
signerKey: signer.ref(),
final account = Account.fromSignerKey(
signerKey: signer,
funder: EthereumAddress.from(funder),
version: version,
chainId: chainid,
Expand Down
5 changes: 3 additions & 2 deletions gui-orchid/lib/orchid/account/account_selector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,14 @@ class _AccountSelectorState extends State<AccountSelector> {
}

Widget _buildAccountCard(AccountViewModel accountModel, int index) {
bool single = widget.accounts.length == 1;
// bool single = widget.accounts.length == 1;
return FittedBox(
fit: BoxFit.scaleDown,
child: AccountCard(
key: Key(accountModel.toString()),
accountDetail: accountModel.detail,
selected: single ? null : accountModel.active,
// selected: single ? null : accountModel.active,
selected: accountModel.active,
onSelected: () {
_toggleSelected(accountModel);
},
Expand Down
3 changes: 2 additions & 1 deletion gui-orchid/lib/pages/circuit/orchid_hop_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ class _OrchidHopPageState extends State<OrchidHopPage> {
}
return AccountSelectorDialog(
accounts: accounts!.toList(),
// accounts: [accounts!.first], // TEST single selection
singleSelection: true,
selectedAccounts: _selectedAccount != null
? Set.from([_selectedAccount])
Expand Down Expand Up @@ -586,7 +587,7 @@ class _OrchidHopPageState extends State<OrchidHopPage> {
}

OrchidHop? get _hop {
return widget.editableHop.value?.hop as OrchidHop;
return widget.editableHop.value?.hop as OrchidHop?;
}

Account? get _account {
Expand Down
4 changes: 2 additions & 2 deletions gui-orchid/lib/util/shared_preferences_extensions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import 'package:orchid/api/orchid_log.dart';
import 'package:shared_preferences/shared_preferences.dart';

extension SharedPreferencesUtil on SharedPreferences {
static Future<Map<String, Object>> dump() async {
static Future<Map<String, dynamic>> dump() async {
var prefs = await SharedPreferences.getInstance();
var keys = prefs.getKeys();
Map<String, Object> map = {};
Map<String, dynamic> map = {};
for (var key in keys) {
var value = prefs.get(key);
log("XXX: key = $key, type = ${value.runtimeType}, value = $value");
Expand Down
6 changes: 3 additions & 3 deletions gui-orchid/lib/vpn/purchase/orchid_pac_server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ class OrchidPACServer {
required EthereumAddress signer,
PacApiConfig? apiConfig, // optional override
}) async {
var params = {'account_id': signer.toString(prefix: true)};
Map<String, dynamic> params = {'account_id': signer.toString(prefix: true)};
var result = await _postJson(
method: 'get_account', paramsIn: params, apiConfig: apiConfig);
return PacAccount.fromJson(result);
Expand All @@ -276,7 +276,7 @@ class OrchidPACServer {
if (receipt == null || receiptType == null) {
throw Exception('iap: null receipt');
}
var params = {
Map<String, dynamic> params = {
'account_id': signer.toString(prefix: true),
'product_id': productId,
'receipt': receipt,
Expand Down Expand Up @@ -334,7 +334,7 @@ class OrchidPACServer {
hex.decode(AbiEncode.uint256(txStringSig.s)) +
intToBytes(BigInt.from(txStringSig.v));

var params = {
Map<String, dynamic> params = {
'account_id': signerKey.address.toString(prefix: true),
'chainId': chainId,
// txn is encoded as an escaped json string
Expand Down

0 comments on commit d0b5165

Please sign in to comment.