11import 'package:decimal/decimal.dart' ;
2- import 'package:dio/dio.dart' ;
32import 'package:flutter/material.dart' ;
4- import 'package:mixin_bot_sdk_dart/mixin_bot_sdk_dart.dart' as sdk;
5- import 'package:uuid/uuid.dart' ;
63
74import '../../../db/mixin_database.dart' ;
8- import '../../../service/profile/pin_session.dart' ;
95import '../../../util/constants.dart' ;
106import '../../../util/extension/extension.dart' ;
117import '../../../util/pay/external_transfer_uri_parser.dart' ;
@@ -19,51 +15,23 @@ Future<bool> showTransferToAddressBottomSheet(
1915 required AssetResult feeAsset,
2016 required String amount,
2117 String ? memo,
22- }) async {
23- final traceId = const Uuid ().v4 ();
24-
25- return _showTransferBottomSheet (
26- context,
27- _TransferVerifyBottomSheetBody (
28- displayAddress: address.displayAddress (),
29- asset: asset,
30- amount: amount,
31- description: _FeeText (
32- address: address,
18+ }) async =>
19+ _showTransferBottomSheet (
20+ context,
21+ _TransferVerifyBottomSheetBody (
22+ displayAddress: address.displayAddress (),
3323 asset: asset,
34- feeAsset: feeAsset,
35- ),
36- addressLabel: address.label,
37- verification: (context, pin) async {
38- try {
39- final api = context.appServices.client.transferApi;
40- final response = await api.withdrawal (
41- sdk.WithdrawalRequest (
42- addressId: address.addressId,
43- amount: amount,
44- pin: encryptPin (context, pin)! ,
45- traceId: traceId,
46- memo: memo,
47- fee: address.fee,
48- ),
49- );
50- await context.appServices.mixinDatabase.snapshotDao
51- .insertAll ([response.data]);
52- Navigator .of (context).pop (true );
53- } on DioException catch (error) {
54- final mixinError = error.optionMixinError;
55- if (mixinError? .code == sdk.insufficientTransactionFee) {
56- final message = context.l10n
57- .errorInsufficientTransactionFeeWithAmount (
58- '${address .fee } ${feeAsset .symbol }' );
59- throw ErrorWithFormattedMessage (message);
60- } else {
61- rethrow ;
62- }
63- }
64- },
65- ));
66- }
24+ amount: amount,
25+ description: _FeeText (
26+ address: address,
27+ asset: asset,
28+ feeAsset: feeAsset,
29+ ),
30+ addressLabel: address.label,
31+ verification: (context, pin) async {
32+ throw UnimplementedError ();
33+ },
34+ ));
6735
6836Future <bool > showTransferToExternalUrlBottomSheet ({
6937 required BuildContext context,
@@ -80,34 +48,7 @@ Future<bool> showTransferToExternalUrlBottomSheet({
8048 asset: asset,
8149 showWithdrawalWithPinTip: false ,
8250 verification: (context, pin) async {
83- try {
84- final api = context.appServices.client.transferApi;
85- final response = await api.withdrawal (
86- sdk.WithdrawalRequest (
87- assetId: asset.assetId,
88- amount: transfer.amount,
89- pin: encryptPin (context, pin)! ,
90- traceId: traceId,
91- memo: transfer.memo,
92- fee: fee,
93- destination: transfer.destination,
94- tag: null ,
95- ),
96- );
97- await context.appServices.mixinDatabase.snapshotDao
98- .insertAll ([response.data]);
99- Navigator .of (context).pop (true );
100- } on DioException catch (error) {
101- final mixinError = error.optionMixinError;
102- if (mixinError? .code == sdk.insufficientTransactionFee) {
103- final message = context.l10n
104- .errorInsufficientTransactionFeeWithAmount (
105- '$fee ${asset .chainSymbol }' );
106- throw ErrorWithFormattedMessage (message);
107- } else {
108- rethrow ;
109- }
110- }
51+ throw UnimplementedError ();
11152 },
11253 description: Text ('${context .l10n .fee } $fee ${asset .chainSymbol }' ),
11354 displayAddress: transfer.destination,
0 commit comments