Skip to content

Commit

Permalink
Add mint call error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
rukafe0x committed Feb 20, 2025
1 parent e224b60 commit 8e47610
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions packages/starknet/lib/src/devnet/devnet.dart
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
import 'package:starknet_provider/starknet_provider.dart';
import 'model/mint_transaction.dart';

/// Extension methods for devnet-specific functionality
// Extension methods for devnet-specific functionality
class Devnet {
/// Mints tokens on the devnet
static Future<MintResponse> mintTransaction(
Uri nodeUri, MintRequest request) async {
return callRpcEndpoint(
nodeUri: nodeUri,
method: 'devnet_mint',
params: request,
).then(MintResponse.fromJson);
try {
final response = await callRpcEndpoint(
nodeUri: nodeUri,
method: 'devnet_mint',
params: request,
);
return MintResponse.fromJson(response);
} catch (e) {
throw ArgumentError('Failed to mint tokens: $e');
}
}
}

0 comments on commit 8e47610

Please sign in to comment.