openMeld static method

Future<void> openMeld([
  1. MeldOptions? options
])

Opens Meld.io directly in a popup with customizable parameters

If no options are provided or if specific fields are null, reverts to default behavior:

  • Requires wallet connection
  • Uses India (IN) as default region
  • Uses INR as default currency
  • Uses connected wallet address
  • Uses card as default payment method

Throws an Exception if no wallet is connected and no custom walletAddress is provided.

Implementation

static Future<void> openMeld([MeldOptions? options]) async {
  // Always check wallet connection unless custom walletAddress is explicitly provided
  if (options?.walletAddress == null) {
    final account = Core.getAccount();
    if (!account.isConnected) {
      throw Exception('Wallet not connected. Please connect a wallet first.');
    }
  }

  await window.appkit.openMeld(options?._toJS()).toDart;
}