swapQuoteFixture function

SwapQuote swapQuoteFixture({
  1. String id = 'swap-1',
  2. String depositAddress = 'tdeposit',
  3. String? depositMemo,
  4. int expiresAt = 2000000000,
  5. String amountIn = '0.5',
  6. String minAmountOut = '49.5',
  7. int zecSideZat = 50000000,
  8. String? refundTo,
  9. bool deshields = true,
  10. bool endsShielded = false,
  11. bool providerLegsTransparent = true,
  12. List<DisclosureItem> providerSees = const [DisclosureItem.amounts, DisclosureItem.destinationAddress],
  13. Uint8List? binding,
})

A neutral SwapQuote for tests — override only what a case cares about. Defaults to an OutOfZec-shaped quote (a de-shielding deposit) so the disclosure carries the privacy-critical flags a swap review must render.

Implementation

SwapQuote swapQuoteFixture({
  String id = 'swap-1',
  String depositAddress = 'tdeposit',
  String? depositMemo,
  int expiresAt = 2000000000,
  String amountIn = '0.5',
  String minAmountOut = '49.5',
  int zecSideZat = 50000000,
  String? refundTo,
  bool deshields = true,
  bool endsShielded = false,
  bool providerLegsTransparent = true,
  List<DisclosureItem> providerSees = const [
    DisclosureItem.amounts,
    DisclosureItem.destinationAddress,
  ],
  // FR-17 (#396): a quote returned by `swapQuote` always carries its
  // spend-binding nonce, so the fixture defaults to a deterministic one.
  Uint8List? binding,
}) {
  return SwapQuote(
    id: id,
    depositAddress: depositAddress,
    depositMemo: depositMemo,
    expiresAt: expiresAt,
    amountIn: amountIn,
    minAmountOut: minAmountOut,
    zecSideZat: zecSideZat,
    refundTo: refundTo,
    disclosure: SwapPrivacyDisclosure(
      endsShielded: endsShielded,
      deshields: deshields,
      providerLegsTransparent: providerLegsTransparent,
      providerSees: providerSees,
    ),
    binding: binding ?? defaultSwapQuoteBinding,
  );
}