enableNearSwap method

  1. @override
Future<void> enableNearSwap({
  1. required SwapProviderConfig config,
  2. required bool swapEnabled,
  3. SwapKill? declaredKill,
})
override

Turn the swap on-ramp ON — construct the NEAR provider over the wallet's OWN transport (the same host-provided dialer + Tor policy sync uses; internal Tor is OPTIONAL — the host may bring its own) and apply the §3.5 kill state. A ONE-TIME setup, called after the wallet is open (set-once, first-wins). On a build compiled WITHOUT the adapter it degrades honestly to a typed SwapDisabled (the method is always present so the surface is stable). Throws a typed SwapApiError (watchOnly on a watch-only wallet — STRUCTURAL, never retryable, checked first (#397 §3.7 D3): render view-only framing, not a retry; providerUnavailable when the transport can't be resolved — retryable; swapStateUnavailable on a torn-down handle).

Implementation

@override
Future<void> enableNearSwap({
  required SwapProviderConfig config,
  required bool swapEnabled,
  SwapKill? declaredKill,
}) async {
  enableNearSwapCount++;
  lastEnableConfig = config;
  lastEnableSwapEnabled = swapEnabled;
  lastEnableDeclaredKill = declaredKill;
  if (enableNearSwapThrows != null) throw enableNearSwapThrows!;
}