-
Notifications
You must be signed in to change notification settings - Fork 10
/
transaction_signing_failure.dart
48 lines (36 loc) · 1.33 KB
/
transaction_signing_failure.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import 'package:cosmos_utils/cosmos_utils.dart';
enum TransactionSigningFailType {
userDeclined,
invalidPassword,
noTransactionSignerFound,
accountCredentialsStorageFailure,
unknown,
}
abstract class TransactionSigningFailure {
TransactionSigningFailType get type;
}
class TransactionSignerNotFoundFailure implements TransactionSigningFailure {
const TransactionSignerNotFoundFailure();
@override
TransactionSigningFailType get type => TransactionSigningFailType.noTransactionSignerFound;
}
class UserDeclinedTransactionSignerFailure implements TransactionSigningFailure {
const UserDeclinedTransactionSignerFailure();
@override
TransactionSigningFailType get type => TransactionSigningFailType.userDeclined;
}
class InvalidPasswordTransactionSignerFailure implements TransactionSigningFailure {
const InvalidPasswordTransactionSignerFailure();
@override
TransactionSigningFailType get type => TransactionSigningFailType.invalidPassword;
}
class StorageProblemSigningFailure implements TransactionSigningFailure {
const StorageProblemSigningFailure(this.failure);
final CredentialsStorageFailure failure;
@override
TransactionSigningFailType get type => TransactionSigningFailType.accountCredentialsStorageFailure;
@override
String toString() {
return 'StorageProblemSigningFailure{fail: $failure}';
}
}