Quickstart
Install the library
# Install via NPM
npm install --save kaddex-sdkMake your first request
import { KaddexSdk, retrieveVerifiedAccount, TOKENS } from 'kaddex-sdk';
const PUBLIC_KEY = '<YOUR PUBLIC KEY>'
const SECRET_KEY = '<YOUR SECRET KEY>'
// if your account name is different from your PUBLIC_KEY, use the correct value here
const account = await retrieveVerifiedAccount({ accountName: PUBLIC_KEY });
const kaddex = new KaddexSdk({ account, secretKey: SECRET_KEY });
try {
(async () => {
const swapResponse = await kaddex.swapExactIn({
token0: {
token: TOKENS.KDA,
amount: 0.02
},
token1: {
token: TOKENS.ABC,
amount: 0.1
},
slippage: '0.05'
});
console.log(swapResponse);
})();
} catch (err) {
console.error(err);
}
Last updated

