accounts creation
All checks were successful
ci/woodpecker/push/billing_fees Pipeline was successful
ci/woodpecker/push/db Pipeline was successful
ci/woodpecker/push/bff Pipeline was successful
ci/woodpecker/push/discovery Pipeline was successful
ci/woodpecker/push/fx_ingestor Pipeline was successful
ci/woodpecker/push/fx_oracle Pipeline was successful
ci/woodpecker/push/frontend Pipeline was successful
ci/woodpecker/push/gateway_mntx Pipeline was successful
ci/woodpecker/push/gateway_chain Pipeline was successful
ci/woodpecker/push/gateway_tgsettle Pipeline was successful
ci/woodpecker/push/nats Pipeline was successful
ci/woodpecker/push/ledger Pipeline was successful
ci/woodpecker/push/notification Pipeline was successful
ci/woodpecker/push/payments_orchestrator Pipeline was successful
All checks were successful
ci/woodpecker/push/billing_fees Pipeline was successful
ci/woodpecker/push/db Pipeline was successful
ci/woodpecker/push/bff Pipeline was successful
ci/woodpecker/push/discovery Pipeline was successful
ci/woodpecker/push/fx_ingestor Pipeline was successful
ci/woodpecker/push/fx_oracle Pipeline was successful
ci/woodpecker/push/frontend Pipeline was successful
ci/woodpecker/push/gateway_mntx Pipeline was successful
ci/woodpecker/push/gateway_chain Pipeline was successful
ci/woodpecker/push/gateway_tgsettle Pipeline was successful
ci/woodpecker/push/nats Pipeline was successful
ci/woodpecker/push/ledger Pipeline was successful
ci/woodpecker/push/notification Pipeline was successful
ci/woodpecker/push/payments_orchestrator Pipeline was successful
This commit is contained in:
@@ -5,7 +5,9 @@ import 'package:flutter/foundation.dart';
|
||||
|
||||
import 'package:collection/collection.dart';
|
||||
|
||||
import 'package:pshared/models/describable.dart';
|
||||
import 'package:pshared/models/payment/wallet.dart';
|
||||
import 'package:pshared/models/wallet/chain_asset.dart';
|
||||
import 'package:pshared/provider/organizations.dart';
|
||||
import 'package:pshared/provider/resource.dart';
|
||||
import 'package:pshared/service/payment/wallets.dart';
|
||||
@@ -159,6 +161,30 @@ class WalletsProvider with ChangeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> create({
|
||||
required Describable describable,
|
||||
required ChainAsset asset,
|
||||
required String? ownerRef,
|
||||
}) async {
|
||||
final org = _organizations;
|
||||
if (org == null || !org.isOrganizationSet) return;
|
||||
|
||||
_applyResource(_resource.copyWith(isLoading: true, error: null), notify: true);
|
||||
|
||||
try {
|
||||
await _service.create(
|
||||
organizationRef: org.current.id,
|
||||
describable: describable,
|
||||
asset: asset,
|
||||
ownerRef: ownerRef,
|
||||
);
|
||||
await loadWalletsWithBalances();
|
||||
} catch (e) {
|
||||
_applyResource(_resource.copyWith(isLoading: false, error: toException(e)), notify: true);
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
// ---------- internals ----------
|
||||
|
||||
void _applyResource(Resource<List<Wallet>> newResource, {required bool notify}) {
|
||||
|
||||
Reference in New Issue
Block a user