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>

Last updated