signAndSendTransactions method

  1. @override
Future<SignAndSendTransactionsResult> signAndSendTransactions(
  1. SignAndSendTransactionsParams params
)

Privileged Methods

Implementation of this method by a wallet endpoint is optional.

The wallet endpoint should attempt to simulate the encoded transactions (base-64 on mobile devices and base-58 on desktop browsers) and present them to the user for approval (if applicable). If approved (or if it does not require approval), the wallet endpoint should verify the transactions, sign them with the private keys for the authorized addresses, submit them to the network, and return the transaction signatures to the dApp endpoint.

The config options allows customization of how the wallet endpoint processes the transactions it sends to the Solana network. If specified, minContextSlot specifies the minimum slot number that the transactions should be evaluated at. This allows the wallet endpoint to wait for its network RPC node to reach the same point in time as the node used by the dApp endpoint, ensuring that, e.g., the recent blockhash encoded in the transactions will be available.

Implementation

@override
Future<SignAndSendTransactionsResult> signAndSendTransactions(
  final SignAndSendTransactionsParams params,
) async {
  _checkSinglePayload(params.payloads, 'signAndSendTransactions');
  final Map<String, dynamic> response = await provider.signAndSendTransaction(
    params.payloads.first,
    minContextSlot: params.options?.minContextSlot,
  );
  return SignAndSendTransactionsResult(
    signatures: [_encodeSignature(response)],
  );
}