Data Types
Common types used in the SDK include:
HexString:
0x${string}
SupportedChainIds: 137 | 42161 | 10 | 324 | 8453 | 40
PositionData, EditPositionData, PositionDetails
TxnResponse, SignatureResponse, PositionFrequency, PositionStatus
HexString
Represents a string starting with 0x
, commonly used for hexadecimal addresses.
SupportedChainIds
Enumeration of supported EVM chain IDs.
SignatureResponse
The response from a permit signature request, containing optional error messages, a status code, and permit data.
errorMsg: An optional field indicating any error that occurred during the permit signing.
code: Status code representing the result of the signing attempt.
status: A string describing the success or failure status of the operation.
permitData: The data from the signed permit, needed for DCA operations
TxnResponse
Transaction response type, providing optional error messages, a status code, and the transaction hash.
errorMsg: Optional message if an error occurred during the transaction.
code: Status code showing the result of the transaction.
status: Description of the transaction status (e.g., success, failure).
txnHash: The hash for the executed transaction, allowing tracking on-chain.
PositionData
Data required to create a new DCA position, including token addresses, swap intervals, and amounts.
EditPositionData
Details for editing an existing DCA position, with parameters for updating swap frequency, token allowances, and total swaps.
PositionDetails
Comprehensive details about a DCA position, including swap history, profit/loss metrics, token amounts, and timestamps.
PositionFrequency
Defines allowable frequencies for DCA swaps in seconds.
3600: Executes a swap every hour.
86400: Executes a swap daily.
604800: Executes a swap weekly.
PositionStatus
Enumerates the possible statuses of a DCA position.
A breakdown of each position status:
ACTIVE: The DCA position is ongoing and swaps are executing as scheduled.
TERMINATED: The position was manually ended before all swaps completed.
COMPLETED: All scheduled swaps were successfully executed, and the position has reached its end.
SWAPPED: A swap has occurred within the position, typically indicating recent activity.
MODIFIED_RATE: The swap rate for the position was changed.
MODIFIED_DURATION: The duration or interval of swaps in the position was adjusted.
MODIFIED_RATE_AND_DURATION: Both the swap rate and duration of the position were altered.
MODIFIED: A general modification was made to the position, without specifying rate or duration changes.
WITHDRAWN: Funds were withdrawn from the position, potentially impacting future swaps.
PositionsByChainId
A record type mapping chain IDs to an array of PositionDetails
.
PositionHistory
Historical record of actions taken on a position, including transaction hash, timestamp, and amounts.
PositionToken
Defines token metadata for a position, including contract address, symbol, decimal points, and balance.
Token
General token structure used in allowances and balances, containing metadata like contract address, balance, and price.
TokenList
An object where each token address is a key, mapped to a Token
object.
Last updated