Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@ import 'package:realunit_wallet/packages/wallet/payment_uri.dart';
import 'package:realunit_wallet/screens/receive/widgets/qr_address_widget.dart';
import 'package:realunit_wallet/setup/di.dart';
import 'package:realunit_wallet/styles/colors.dart';
import 'package:web3dart/web3dart.dart';

class SettingsWalletAddressPage extends StatelessWidget {
const SettingsWalletAddressPage({super.key});

@override
Widget build(BuildContext context) {
final walletAddress = getIt<AppStore>().primaryAddress;
// Display the receive address in its EIP-55 checksummed form — the
// canonical representation that lets the user verify it by checksum.
final walletAddress = EthereumAddress.fromHex(getIt<AppStore>().primaryAddress).hexEip55;

return Scaffold(
appBar: AppBar(
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,16 @@ void main() {
findsOne,
);
});

testWidgets('displays the address in EIP-55 checksummed form', (tester) async {
await tester.pumpApp(const SettingsWalletAddressPage());

// The mocked primaryAddress is all-lowercase; the screen must render and
// encode the checksummed (EIP-55) form in both the text and the QR uri.
const checksummed = '0x938115B533a0b746428361760A6972dfd06D984a';
final qr = tester.widget<QRAddressWidget>(find.byType(QRAddressWidget));
expect(qr.subtitle, checksummed);
expect(qr.uri, contains(checksummed));
});
});
}
Loading