TradeRequest class

Represents the body of a trade request.

This class includes necessary details such as the input and output currencies, and the amount to be traded. It supports operations for both exact input and exact output trading scenarios.

Annotations
  • @freezed

Constructors

TradeRequest({required String inputToken, required String outputToken, required BigInt inputAmount, required bool exactIn})
Constructs a TradeRequest with the required parameters.
const
factory
TradeRequest.fromJson(Map<String, Object?> json)
Creates a new TradeRequest instance from the provided JSON map.
factory

Properties

copyWith → $TradeRequestCopyWith<TradeRequest>
Create a copy of TradeRequest with the given fields replaced by the non-null parameter values.
no setterinherited
exactIn bool
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
inputAmount BigInt
no setterinherited
inputToken String
no setterinherited
outputToken String
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

getParams() Map<String, dynamic>
Generates a map of parameters for making API requests based on the trade details.
getToken(String tokenAddress) String
Resolves the token address to a more human-readable form if applicable.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Serializes this TradeRequest to a JSON map.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited