Private Key Wallet SDK

To integrate the DCA API, you'll need to use the Limit Order SDK, which provides functionality for creating and canceling limit orders.

How to Install the sdk in your project

npm i @openocean.finance/limitorder-sdk

How to use the sdk in your project

import { openoceanLimitOrderSdk } from '@openocean.finance/limitorder-sdk';

For DCA SDK, you would need to add a param of 'Dca' (Capitalized the D) when create the DCA orders.

Setup with Private Key Wallet

1. Configuration

const privateKey = 'YOUR_PRIVATE_KEY';
const chainId = '8453';
const providerUrl = 'https://base.llamarpc.com';
const baseUrl = 'https://open-api.openocean.finance';

const inToken = {
  address: '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913', // USDC
  decimals: 6
};

const outToken = {
  address: '0xfde4c96c8593536e31f229ea8f37b2ada2699bb2', // USDT
  decimals: 6
};

2. Web3.js Setup

3. Ethers.js Setup

Ethers v5

Ethers v6 Warning

If using Ethers v6, make sure to import correctly:

Creating Dca Order

Canceling Dca Order

Querying Orders

Demo

Last updated