DZap Documentation
  • 🌐Overview
  • Features
    • Aggregation
      • Usecases
      • Fee Structure
      • Chains, Bridge and Liquidity
      • Different Transaction Status
      • Price Imapct Handling
      • Technical Details
    • DCA
      • Creating Positions
      • Additional Actions
      • Swap properties
      • Fees
      • Supported Tokens
    • Zapping (Coming soon)
      • Use Cases
      • Liquidity Migration
      • Supported Routes
  • Protocol
    • Contract address
    • Dzap Aggregation API
    • Uniswap Permit V2
    • Backend API
  • Terms & Security
    • Troubleshooting & Self Serve Guide
    • Terms
    • Audit Reports
    • Privacy
    • Security
  • Tutorial
    • Batch Swap via DEX Aggregator
    • Batch swap via Bridge Aggregator
    • Minting LST from Any Chain
  • Socials
    • 🌐Website
    • 🐦Twitter
    • 👾Discord
    • Ⓜ️Medium
  • DZap SDK
    • Dollar Cost Averaging (DCA)
      • Overview
      • Installation
      • Quick Start
      • Usage Guide
      • Methods
      • Data Types
Powered by GitBook
On this page
  1. DZap SDK
  2. Dollar Cost Averaging (DCA)

Methods

1. getSupportedChainIds

Returns an array of supported chain IDs.

public getSupportedChainIds(): number[]

2. setConfig

Sets custom configuration for the SDK, such as using Permit2 and specifying RPC URLs for reliability.

public setConfig(config: Config)

3. getConfig

Fetches the current configuration settings for the SDK.

public getConfig(): Config

4. getSupportedTokens

Lists the supported tokens for a given chain ID.

async getSupportedTokens(chainId: SupportedChainIds, account?: HexString): Promise<TokenList>

5. getAllowance

Checks the allowance for a specific token on a given chain.

async getAllowance({ chainId, fromToken, account }): Promise<bigint>

6. getContractAddress

Fetches the contract address for the DCA contract on a specific chain.

getContractAddress(chainId: SupportedChainIds): HexString

7. approve

Provides approval for token management under the DZap DCA contract.

async approve({ walletClient, account, fromToken, chainId, amount }): Promise<TxnResponse>

8. sign

Signs a permit for DCA transactions. Note: Signatures are valid for 5 minutes from signing.

async sign({ chainId, fromToken, walletClient, account, amount = maxUint256 }): Promise<SignatureResponse>

9. createPosition

Creates a new DCA position with specified parameters.

async createPosition({ walletClient, account, chainId, positionData }): Promise<TxnResponse>

10. claimPosition

Claims profits from a position, converting them to the target token.

async claimPosition({ walletClient, account, chainId, positionId, toToken }): Promise<TxnResponse>

11. terminatePosition

Terminates an existing DCA position.

async terminatePosition({ walletClient, account, chainId, positionId, fromToken }): Promise<TxnResponse>

12. editPosition

Edits an active DCA position.

async editPosition({ walletClient, account, chainId, positionData }): Promise<TxnResponse>

13. getPositions

Fetches all DCA positions for an account across specified chain IDs.

async getPositions(chainIds: SupportedChainIds[], account: HexString): Promise<PositionsByChainId>

14. getAllPositions

Fetches all DCA positions for an account across all supported chain IDs.

async getAllPositions(account: HexString): Promise<PositionsByChainId>
PreviousUsage GuideNextData Types

Last updated 6 months ago