-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement stake unstake UI flow #552
Conversation
devtools_options.yaml
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd add this file to .gitignore
@@ -44,24 +51,34 @@ Future<bool> _sendTransaction(Transaction transaction) async { | |||
} | |||
} | |||
|
|||
class VTTCreateBloc extends Bloc<VTTCreateEvent, VTTCreateState> { | |||
/// Create new [VTTCreateBloc]. | |||
class TransactionBloc extends Bloc<TransactionEvent, TransactionState> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the changes introduced in this PR, we are adding staking business logic in addition to VTT's. Could we move this class to a file in lib/bloc/transactions/TransactionBlock.dart or similar?
int valueOwedNanoWit = 0; | ||
int valueChangeNanoWit = 0; | ||
WalletType walletType = wallet.walletType; | ||
// Reset tx value paid | ||
valuePaidNanoWit = 0; | ||
valueOwedNanoWit = getTransactionOutputValue( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
int valueOwedNanoWit = 0; | |
int valueChangeNanoWit = 0; | |
WalletType walletType = wallet.walletType; | |
// Reset tx value paid | |
valuePaidNanoWit = 0; | |
valueOwedNanoWit = getTransactionOutputValue( | |
int valueChangeNanoWit = 0; | |
WalletType walletType = wallet.walletType; | |
// Reset tx value paid | |
valuePaidNanoWit = 0; | |
int valueOwedNanoWit = getTransactionOutputValue( |
switch (txType) { | ||
case layout.TransactionType.Vtt: | ||
outputs.add(ValueTransferOutput.fromJson({ | ||
'pkh': address, | ||
'value': outputValue, | ||
'time_lock': 0, | ||
})); | ||
case layout.TransactionType.Stake: | ||
change = ValueTransferOutput.fromJson({ | ||
'pkh': address, | ||
'value': outputValue, | ||
'time_lock': 0, | ||
}); | ||
case layout.TransactionType.Unstake: | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
switch (txType) { | |
case layout.TransactionType.Vtt: | |
outputs.add(ValueTransferOutput.fromJson({ | |
'pkh': address, | |
'value': outputValue, | |
'time_lock': 0, | |
})); | |
case layout.TransactionType.Stake: | |
change = ValueTransferOutput.fromJson({ | |
'pkh': address, | |
'value': outputValue, | |
'time_lock': 0, | |
}); | |
case layout.TransactionType.Unstake: | |
return; | |
} | |
final outputData = { | |
'pkh': address, | |
'value': outputValue, | |
'time_lock': 0, | |
}; | |
switch (txType) { | |
case layout.TransactionType.Vtt: | |
outputs.add(ValueTransferOutput.fromJson(outputData)); | |
case layout.TransactionType.Stake: | |
change = ValueTransferOutput.fromJson(outputData); | |
case layout.TransactionType.Unstake: | |
return; | |
} | |
@@ -163,7 +163,9 @@ class ApiExplorer { | |||
|
|||
/// Send a Generic Transaction | |||
Future<dynamic> sendTransaction(Transaction transaction) async { | |||
print('...........Sending transaction..........'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
print('...........Sending transaction..........'); |
// TODO(#542): use StakeInfo instead of BlockInfo | ||
// TODO(#542): use StakeDetails instead of BlockDetails |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use only one comment?
return stakeEntry; | ||
} | ||
|
||
// TODO(#542): use UnstakeInfo instead of BlockInfo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use only one comment?
@@ -1,6 +1,6 @@ | |||
part of 'vtt_create_bloc.dart'; | |||
|
|||
enum VTTCreateStatus { | |||
enum TransactionStatus { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here. This shouldn't be in a value_transfer
folder
merged in branch 2.0 |
This PR cannot be merge until the explorer and witnet.dart witnet/witnet.dart#38 is updated. Also, all todos:
// TODO(#542)
must be resolved before merging the PR.close Implement input with range bar #546
close Implement balance details shown in a panel slider #545
close Add panel slider to show send and receive actions #544
close Change layout to include navigation bar at the bottom #543
close Implement unstaking form and validations #548
close Implement staking form and validations #547
BlocInfo
withinStakeEntry
factory byStakeInfo
type that should be implemented in witnet.dart taking into account the explorerStakeData
andUnstakeData
inGeneralTransaction
for showing details in the transaction list