mirror of
https://github.com/alexgo-io/alex-sdk.git
synced 2026-04-30 18:52:33 +08:00
feat: update to new alex-sdk-api
This commit is contained in:
@@ -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);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user