Skip to content

Commit

Permalink
Merge branch 'develop' into feature/walletconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
KingGorrin committed Feb 9, 2024
2 parents b20a5ca + 781bc5f commit 41b6020
Show file tree
Hide file tree
Showing 12 changed files with 152 additions and 119 deletions.
19 changes: 15 additions & 4 deletions lib/screens/node_management_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ class _NodeManagementScreenState extends State<NodeManagementScreen> {

late String _selectedNodeConfirmed;

@override
void initState() {
super.initState();
kDefaultCommunityNodes.shuffle();
}

@override
void didChangeDependencies() {
super.didChangeDependencies();
Expand Down Expand Up @@ -231,9 +237,11 @@ class _NodeManagementScreenState extends State<NodeManagementScreen> {
InputValidators.node(_newNodeController.text) == null;

void _onAddNodePressed() async {
if ([...kDbNodes, ...kDefaultNodes].contains(_newNodeController.text)) {
if ([...kDbNodes, ...kDefaultCommunityNodes, ...kDefaultNodes]
.contains(_newNodeController.text)) {
NotificationUtils.sendNotificationError(
'Node already exists', 'Node already exists');
'Node ${_newNodeController.text} already exists',
'Node already exists');
} else {
_addNodeToDb();
}
Expand Down Expand Up @@ -261,8 +269,11 @@ class _NodeManagementScreenState extends State<NodeManagementScreen> {

Widget _getNodeTiles() {
return Column(
children:
[...kDefaultNodes, ...kDbNodes].map((e) => _getNodeTile(e)).toList(),
children: <String>{
...kDefaultNodes,
...kDefaultCommunityNodes,
...kDbNodes
}.toList().map((e) => _getNodeTile(e)).toList(),
);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/services/wallet_connect_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ class WalletConnectService {
final wasActionAccepted = await showDialogWithNoAndYesOptions(
context: _context,
isBarrierDismissible: false,
title: '${dAppMetadata.name} - Send Payment',
title: '${dAppMetadata.name} - Send',
content: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
Expand Down
9 changes: 2 additions & 7 deletions lib/utils/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ const int kAmountInputMaxCharacterLength = 21;
const int kSecondsPerMomentum = 10;
const int kMaxP2pSwapsToStore = 500;

final List<int> kNormalUsersPlasmaRequirements = [
const List<int> kNormalUsersPlasmaRequirements = [
kStakePlasmaAmountNeeded,
kDelegatePlasmaAmountNeeded,
];

final List<int> kPowerUsersPlasmaRequirements = [
const List<int> kPowerUsersPlasmaRequirements = [
kPillarPlasmaAmountNeeded,
kSentinelPlasmaAmountNeeded,
kIssueTokenPlasmaAmountNeeded,
Expand All @@ -122,11 +122,6 @@ final List<int> kPowerUsersPlasmaRequirements = [
const String kLocalhostDefaultNodeUrl = 'ws://127.0.0.1:$kDefaultPort';
const int kDefaultPort = 35998;

List<String> kDefaultNodes = [
'Embedded Node',
kLocalhostDefaultNodeUrl,
];

const List<String> kWalletActions = [
'pillar',
'sentinel',
Expand Down
11 changes: 11 additions & 0 deletions lib/utils/global.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,14 @@ final List<Tabs> kTabsWithIconTitles = [
final List<Tabs> kDisabledTabs = [
Tabs.resyncWallet,
];

List<String> kDefaultNodes = [
'Embedded Node',
kLocalhostDefaultNodeUrl,
];

// Community supplied public full nodes
List<String> kDefaultCommunityNodes = [
'wss://my.hc1node.com:35998',
'wss://node.zenonhub.io:35998'
];
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ class _PillarsListWidgetState extends State<PillarsListWidget> {
width: 5.0,
),
),
Expanded(
SizedBox(
child: pillarItem.isRevocable
? CancelTimer(
Duration(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class _PlasmaOptionsState extends State<PlasmaOptions> {
_beneficiaryAddressController.text =
_plasmaBeneficiaryAddress!.getBeneficiaryAddress()!;
// Notify internal state has changed.
setState(() { });
setState(() {});
}

Widget _getWidgetBody(AccountInfo? accountInfo) {
Expand Down Expand Up @@ -240,11 +240,13 @@ class _PlasmaOptionsState extends State<PlasmaOptions> {
PlasmaInfo.fromJson(
{
'currentPlasma': ((_qsrAmountController.text.isNotEmpty
? int.parse((zenon!.embedded.plasma.getPlasmaByQsr(
_qsrAmountController.text.extractDecimals(coinDecimals),
)).addDecimals(coinDecimals))
: 0) +
_getPlasmaForCurrentBeneficiary()),
? BigInt.parse(zenon!.embedded.plasma
.getPlasmaByQsr(_qsrAmountController.text
.extractDecimals(coinDecimals))
.addDecimals(coinDecimals))
: BigInt.zero) +
BigInt.from(_getPlasmaForCurrentBeneficiary()))
.toInt(),
'maxPlasma': 0,
'qsrAmount': '0',
},
Expand Down
19 changes: 15 additions & 4 deletions lib/widgets/modular_widgets/settings_widgets/node_management.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ class _NodeManagementState extends State<NodeManagement> {

int get _newChainId => int.parse(_newChainIdController.text);

@override
void initState() {
super.initState();
kDefaultCommunityNodes.shuffle();
}

@override
void didChangeDependencies() {
super.didChangeDependencies();
Expand Down Expand Up @@ -210,9 +216,11 @@ class _NodeManagementState extends State<NodeManagement> {
InputValidators.node(_newNodeController.text) == null;

void _onAddNodePressed() async {
if ([...kDbNodes, ...kDefaultNodes].contains(_newNodeController.text)) {
if ([...kDbNodes, ...kDefaultCommunityNodes, ...kDefaultNodes]
.contains(_newNodeController.text)) {
NotificationUtils.sendNotificationError(
'Node already exists', 'Node already exists');
'Node ${_newNodeController.text} already exists',
'Node already exists');
} else {
_addNodeToDb();
}
Expand All @@ -238,8 +246,11 @@ class _NodeManagementState extends State<NodeManagement> {

Widget _getNodeTiles() {
return Column(
children:
[...kDefaultNodes, ...kDbNodes].map((e) => _getNodeTile(e)).toList(),
children: <String>{
...kDefaultNodes,
...kDefaultCommunityNodes,
...kDbNodes
}.toList().map((e) => _getNodeTile(e)).toList(),
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ class _SendLargeCardState extends State<SendLargeCard> {
showDialogWithNoAndYesOptions(
isBarrierDismissible: false,
context: context,
title: 'Send Payment',
title: 'Send',
description: 'Are you sure you want to transfer '
'${_amountController.text} ${_selectedToken.symbol} to '
'${ZenonAddressUtils.getLabel(_recipientController.text)} ?',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ class _SendMediumCardState extends State<SendMediumCard> {
showDialogWithNoAndYesOptions(
context: context,
isBarrierDismissible: true,
title: 'Send Payment',
title: 'Send',
description: 'Are you sure you want to transfer '
'${_amountController.text} ${_selectedToken.symbol} to '
'${ZenonAddressUtils.getLabel(_recipientController.text)} ?',
Expand Down
4 changes: 2 additions & 2 deletions lib/widgets/reusable_widgets/buttons/send_payment_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ class SendPaymentButton extends LoadingButton {
const SendPaymentButton({
required VoidCallback? onPressed,
required Key key,
String text = 'Send payment',
String text = 'Send',
Color? outlineColor,
Size minimumSize = const Size(150.0, 40.0),
Size minimumSize = const Size(100.0, 40.0),
}) : super(
onPressed: onPressed,
text: text,
Expand Down
Loading

0 comments on commit 41b6020

Please sign in to comment.