feat: update to new alex-sdk-api

This commit is contained in:
Kyle Fang
2024-06-18 02:45:19 +00:00
parent 716516508e
commit 18bce82f38
12 changed files with 520 additions and 100 deletions

View File

@@ -1,24 +1,24 @@
import { configs } from '../src/config';
import { AlexSDK, Currency, STXCurrency } from '../src';
import { AlexSDK, Currency } from '../src';
const tokenAlex = 'SP102V8P0F7JX67ARQ77WEA3D3CFB5XW39REDT0AM.token-alex' as Currency;
const tokenDiko = 'SP102V8P0F7JX67ARQ77WEA3D3CFB5XW39REDT0AM.token-wdiko' as Currency
const tokenAlex = 'token-alex' as Currency;
const tokenDiko = 'token-wdiko' as Currency;
describe('AlexSDK', () => {
it('Get fee', async () => {
const sdk = new AlexSDK();
const result = await sdk.getFeeRate(tokenAlex, STXCurrency);
const result = await sdk.getFeeRate(tokenAlex, Currency.STX);
console.log(result);
});
it('Get Route', async () => {
const sdk = new AlexSDK();
const result = await sdk.getRouter(STXCurrency, tokenDiko);
const result = await sdk.getRouter(Currency.STX, tokenDiko);
console.log(result);
});
it('Get Rate', async () => {
const sdk = new AlexSDK();
const result = await sdk.getAmountTo(
STXCurrency,
Currency.STX,
BigInt(2) * BigInt(1e8),
tokenDiko
);
@@ -26,13 +26,13 @@ describe('AlexSDK', () => {
});
it('Get Tx', async () => {
const sdk = new AlexSDK();
const router = await sdk.getRouter(STXCurrency, tokenDiko);
const router = await sdk.getRouter(Currency.STX, tokenDiko);
const result = await sdk.runSwap(
configs.CONTRACT_DEPLOYER,
STXCurrency,
Currency.STX,
tokenDiko,
BigInt(2) * BigInt(1e8),
BigInt(0),
BigInt(0)
);
console.log(result);
});