DZap Documentation
  • 🌐Introduction to DZap
  • Why DZap
    • Problems in DeFi Today
  • How DZap.io Fits into the DeFi & Cross-Chain Ecosysteme
  • How DZap.io Works
  • Main Components of DZap & How They Work Together
  • How DZap Abstracts Away Complexity for Developers & Users
    • For Users
    • For Developers & Protocols:
  • Products
    • Unified Liquidity in DeFi
    • AI Agents Toolkit
    • Use Cases
    • Key Features
    • Fees
  • Chains, Dex's & Bridges
  • Roadmap
  • Frequently Asked Questions (FAQs)
  • Integration, Fee & Security
    • Troubleshooting & Self Serve Guide
    • Terms
    • Contract Address
    • Audit Reports
    • Privacy
    • Security
  • APIs & Endpoints
  • DZap XP Points System
  • 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 7 months ago