initialize method

  1. @override
Future<void> initialize(
  1. JsonRpcWebsocketClient client,
  2. Uri walletUri, {
  3. Duration? timeLimit,
})
override

Performs any setup required by the scenario prior to establishing an encrypted session (e.g. launching the mobile wallet application or waiting for a ping frame).

Throws an exception to abort the request.

Implementation

@override
Future<void> initialize(
  final JsonRpcWebsocketClient client,
  final Uri walletUri, {
  final Duration? timeLimit,
}) async {
  if (!await SolanaWalletAdapterPlatform.instance.openWallet(walletUri)) {
    throw SolanaWalletAdapterException(
      'The wallet application could not be opened.',
      code: SolanaWalletAdapterExceptionCode.walletNotFound,
    );
  }
}