createPaymentAccount method
Creates a new payment account using the provided PaymentAccountForm
.
form
- The payment account form containing details for the new account.
Returns the created PaymentAccount
if the operation is successful.
Throws a DaemonNotConnectedException if the client is not connected.
Returns null
if the account creation fails.
Implementation
Future<PaymentAccount?> createPaymentAccount(PaymentAccountForm form) async {
if (!havenoChannel.isConnected) {
throw DaemonNotConnectedException();
}
PaymentAccount? paymentAccount;
try {
final createdPaymentAccount = await havenoChannel.paymentAccountsClient!
.createPaymentAccount(
CreatePaymentAccountRequest(paymentAccountForm: form));
paymentAccount = createdPaymentAccount.paymentAccount;
return paymentAccount;
} on GrpcError catch (e) {
handleGrpcError(e);
return paymentAccount;
}
}