Skip to content

Commit

Permalink
October (#2864)
Browse files Browse the repository at this point in the history
* feat: Use correct typ for sd-disclosure #2858

* version update: 2.11.3+496

* refactor: Handle 404 error for etherlink #2853

* version update: 2.11.4+497

* feat: Solve icon problems #2859

* feat: Make ethereum default account #2862

* version update:  2.11.5+498

* feat: Etherlink naming update

* version update:  2.11.6+499

---------

Co-authored-by: Bibash Shrestha <[email protected]>
  • Loading branch information
hawkbee1 and bibash28 authored Sep 2, 2024
1 parent fa47106 commit 16393ca
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 30 deletions.
16 changes: 5 additions & 11 deletions lib/app/shared/widget/custom_listtile_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,11 @@ class CustomListTileCard extends StatelessWidget {
style: Theme.of(context).textTheme.bodyMedium,
),
minVerticalPadding: 0,
trailing: Container(
height: 65,
width: 65,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Theme.of(context).colorScheme.secondary,
),
child: Image.asset(
imageAssetPath,
color: Theme.of(context).colorScheme.onSecondary,
),
trailing: Image.asset(
imageAssetPath,
width: Sizes.icon5x,
height: Sizes.icon5x,
fit: BoxFit.fitHeight,
),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ class CreateAccountStep1View extends StatelessWidget {
);
},
),
const SizedBox(height: Sizes.spaceNormal),
],
if (BlockchainType.etherlink.isSupported(profileSetting)) ...[
CustomListTileCard(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ class ImportAccountStep1View extends StatelessWidget {
);
},
),
const SizedBox(height: Sizes.spaceNormal),
],
if (BlockchainType.etherlink.isSupported(profileSetting)) ...[
CustomListTileCard(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:altme/app/app.dart';
import 'package:altme/dashboard/dashboard.dart';
import 'package:altme/wallet/wallet.dart';
import 'package:bloc/bloc.dart';
import 'package:dio/dio.dart';
import 'package:equatable/equatable.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:json_annotation/json_annotation.dart';
Expand Down Expand Up @@ -136,10 +137,21 @@ class TokensCubit extends Cubit<TokensState> {
}
final baseUrl = ethereumNetwork.apiUrl;

final List<dynamic> tokensBalancesJsonArray = await client.get(
'$baseUrl/v2/addresses/$walletAddress/token-balances',
headers: <String, dynamic>{'Content-Type': 'application/json'},
) as List<dynamic>;
List<dynamic> tokensBalancesJsonArray = [];

try {
tokensBalancesJsonArray = await client.get(
'$baseUrl/v2/addresses/$walletAddress/token-balances',
headers: <String, dynamic>{'Content-Type': 'application/json'},
) as List<dynamic>;
} catch (e) {
if (e is NetworkException &&
e.message == NetworkError.NETWORK_ERROR_NOT_FOUND) {
tokensBalancesJsonArray = [];
} else {
rethrow;
}
}

List<TokenModel> newData = [];

Expand Down Expand Up @@ -174,7 +186,6 @@ class TokensCubit extends Cubit<TokensState> {
if (offset == 0) {
final ethereumBaseToken = await _getBaseTokenBalanceOnEtherlink(
walletAddress,

ethereumNetwork,
);

Expand All @@ -183,12 +194,10 @@ class TokensCubit extends Cubit<TokensState> {
}
data = newData;


if (data.length == 1) {
final emptyTokens = await getSomeEmptyCoins(ethereumNetwork.type);
data.addAll(emptyTokens);
}

} else {
data.addAll(newData);
}
Expand Down Expand Up @@ -527,7 +536,6 @@ class TokensCubit extends Cubit<TokensState> {

Future<TokenModel?> _getBaseTokenBalanceOnEtherlink(
String walletAddress,

EthereumNetwork ethereumNetwork,
) async {
try {
Expand All @@ -548,8 +556,21 @@ class TokensCubit extends Cubit<TokensState> {
standard: 'ERC20',
decimalsToShow: 5,
);

} catch (e, s) {
if (e is NetworkException &&
e.message == NetworkError.NETWORK_ERROR_NOT_FOUND) {
return TokenModel(
contractAddress: '',
name: 'Etherlink',
symbol: 'XTZ',
icon: ethereumNetwork.mainTokenIcon,
balance: '0',
decimals: ethereumNetwork.mainTokenDecimal,
standard: 'ERC20',
decimalsToShow: 5,
);
}

getLogger(toString()).e('error: $e, stack: $s');
return null;
}
Expand Down
8 changes: 4 additions & 4 deletions lib/l10n/arb/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -1058,9 +1058,9 @@
"toStopDisplayingThisPopupDeactivateTheDeveloperModeInTheSettings": "To stop displaying this popup, deactivate the 'developer mode' in the settings.",
"warningDialogSubtitle": "The recovery page contains sensitive information. Please, make sure to keep it private.",
"accountPrivateKeyAlert": "The recovery page contains sensitive information. Please, make sure to keep it private.",
"etherlinkNetwork": "Ethereum Network",
"etherlinkAccount": "Ethereum account",
"etherlinkAccountDescription": "Create a new Ethereum blockchain address",
"etherlinkAccountCreationCongratulations": "Your new Ethereum account has been successfully created.",
"etherlinkNetwork": "Etherlink Network",
"etherlinkAccount": "Etherlink account",
"etherlinkAccountDescription": "Create a new Etherlink blockchain address",
"etherlinkAccountCreationCongratulations": "Your new Etherlink account has been successfully created.",
"etherlinkProofMessage": ""
}
8 changes: 4 additions & 4 deletions lib/wallet/cubit/wallet_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ class WalletCubit extends Cubit<WalletState> {
BlockchainType.fantom: 0,
BlockchainType.polygon: 1,
BlockchainType.binance: 2,
BlockchainType.ethereum: 3,
BlockchainType.etherlink: 4,
BlockchainType.etherlink: 3,
BlockchainType.ethereum: 4,
};

for (final entry in accounts.entries) {
Expand All @@ -175,8 +175,8 @@ class WalletCubit extends Cubit<WalletState> {
BlockchainType.polygon: 0,
BlockchainType.binance: 1,
BlockchainType.tezos: 2,
BlockchainType.ethereum: 3,
BlockchainType.etherlink: 4,
BlockchainType.etherlink: 3,
BlockchainType.ethereum: 4, // default account as it is last
};

for (final entry in accounts.entries) {
Expand Down
4 changes: 3 additions & 1 deletion packages/oidc4vc/lib/src/oidc4vc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1331,6 +1331,7 @@ class OIDC4VC {
required Map<String, dynamic> payload,
required Map<String, dynamic> privateKey,
required String kid,
required MediaType mediaType,
}) {
final d = base64Url.decode(privateKey['d'].toString());
final x = base64Url.decode(privateKey['x'].toString());
Expand All @@ -1340,7 +1341,7 @@ class OIDC4VC {
final jwt = JWT(
payload,
header: {
'typ': 'openid4vci-proof+jwt',
'typ': mediaType.typ,
'alg': 'EdDSA',
'kid': kid,
},
Expand Down Expand Up @@ -1617,6 +1618,7 @@ class OIDC4VC {
payload: payload,
privateKey: tokenParameters.privateKey,
kid: tokenParameters.kid ?? tokenParameters.thumbprint,
mediaType: tokenParameters.mediaType,
);

return jwt;
Expand Down
1 change: 1 addition & 0 deletions packages/oidc4vc/test/src/oidc4vc_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ void main() {
payload: payload,
privateKey: privateKey,
kid: kid,
mediaType: MediaType.proofOfOwnership,
);

final value = oidc4vc.verifyTokenEdDSA(
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: altme
description: AltMe Flutter App

version: 2.11.2+495
version: 2.11.6+499

publish_to: "none" # Remove this line if you wish to publish to pub.dev
environment:
Expand Down

0 comments on commit 16393ca

Please sign in to comment.