Semantics improvements

This commit is contained in:
Aleksandr Kraiz
2023-05-18 22:33:20 +04:00
parent dba7169828
commit ab36c0b26b
21 changed files with 71 additions and 55 deletions

View File

@@ -10,6 +10,7 @@ import {
} from 'http-terminator';
import { ethers } from 'ethers';
import { simpleFetch } from 'simple-typed-fetch';
import { SERVICE_TOKEN } from '../index.js';
jest.setTimeout(10000);
const createServer = (externalHost: string) => {
@@ -271,7 +272,7 @@ describe('Orion', () => {
}, 10000);
unitBSC.aggregator.ws.subscribe('aobus', {
payload: 'ORN-USDT',
payload: `${SERVICE_TOKEN}-USDT`,
callback: () => {
resolve(true);
unitBSC.aggregator.ws.destroy();

View File

@@ -1,6 +1,7 @@
import { Wallet } from 'ethers';
import Orion from '../Orion/index.js';
import { SupportedChainId } from '../types.js';
import { SERVICE_TOKEN } from '../index.js';
const privateKey = process.env['PRIVATE_KEY']
if (privateKey === undefined) throw new Error('Private key is required');
@@ -13,7 +14,7 @@ describe('Bridge', () => {
const wallet = new Wallet(privateKey);
await orion.bridge.swap(
'ORN',
SERVICE_TOKEN,
0.12345678,
SupportedChainId.FANTOM_TESTNET,
SupportedChainId.BSC_TESTNET,

View File

@@ -1,5 +1,6 @@
import { ethers } from 'ethers';
import Orion from '../Orion/index.js';
import { SERVICE_TOKEN } from '../index.js';
const privateKey = process.env['PRIVATE_KEY'];
if (privateKey === undefined) throw new Error('Private key is required');
@@ -7,7 +8,7 @@ if (privateKey === undefined) throw new Error('Private key is required');
jest.setTimeout(30000);
describe('Transfers', () => {
test('Deposit ORN', async () => {
test(`Deposit ${SERVICE_TOKEN}`, async () => {
const orion = new Orion('testing');
const bscUnit = orion.getUnit('bsc');
const wallet = new ethers.Wallet(
@@ -16,13 +17,13 @@ describe('Transfers', () => {
);
await bscUnit.exchange.deposit({
asset: 'ORN',
asset: SERVICE_TOKEN,
amount: 20,
signer: wallet,
});
});
test('Withdraw ORN', async () => {
test(`Withdraw ${SERVICE_TOKEN}`, async () => {
const orion = new Orion('testing');
const bscUnit = orion.getUnit('bsc');
const wallet = new ethers.Wallet(
@@ -31,7 +32,7 @@ describe('Transfers', () => {
);
await bscUnit.exchange.withdraw({
asset: 'ORN',
asset: SERVICE_TOKEN,
amount: 20,
signer: wallet,
});

View File

@@ -1,5 +1,6 @@
import { ethers } from 'ethers';
import Orion from '../Orion/index.js';
import { SERVICE_TOKEN } from '../index.js';
const privateKey = process.env['PRIVATE_KEY']
if (privateKey === undefined) throw new Error('Private key is required');
@@ -7,7 +8,7 @@ if (privateKey === undefined) throw new Error('Private key is required');
jest.setTimeout(30000);
describe('Pools', () => {
test('Add liquidity ORN', async () => {
test(`Add liquidity ${SERVICE_TOKEN}`, async () => {
const orion = new Orion('testing');
const bscUnit = orion.getUnit('bsc');
const wallet = new ethers.Wallet(
@@ -16,14 +17,14 @@ describe('Pools', () => {
);
await bscUnit.farmingManager.addLiquidity({
amountAsset: 'ORN',
poolName: 'ORN-USDT',
amountAsset: SERVICE_TOKEN,
poolName: `${SERVICE_TOKEN}-USDT`,
amount: 20,
signer: wallet,
});
});
test('Remove liquidity ORN', async () => {
test(`Remove liquidity ${SERVICE_TOKEN}`, async () => {
const orion = new Orion('testing');
const bscUnit = orion.getUnit('bsc');
const wallet = new ethers.Wallet(
@@ -32,7 +33,7 @@ describe('Pools', () => {
);
await bscUnit.farmingManager.removeAllLiquidity({
poolName: 'ORN-USDT',
poolName: `${SERVICE_TOKEN}-USDT`,
signer: wallet,
});
});

View File

@@ -1,10 +1,11 @@
import Orion from '../Orion/index.js';
import { SERVICE_TOKEN } from '../index.js';
describe('Price Feed', () => {
test('Ticker', async () => {
const { unitsArray } = new Orion('testing');
for (const unit of unitsArray) {
const ticker = 'ORN-USDT';
const ticker = `${SERVICE_TOKEN}-USDT`;
await new Promise((resolve, reject) => {
const timeout = setTimeout(() => {
reject(new Error('Timeout'));

View File

@@ -1,6 +1,7 @@
import { ethers } from 'ethers';
import Orion from '../Orion/index.js';
import swapMarket from '../Unit/Exchange/swapMarket.js';
import { SERVICE_TOKEN } from '../index.js';
const privateKey = process.env['PRIVATE_KEY']
if (privateKey === undefined) throw new Error('Private key is required');
@@ -17,7 +18,7 @@ describe('Spot trading', () => {
);
const result = await swapMarket({
assetIn: 'ORN',
assetIn: SERVICE_TOKEN,
assetOut: 'USDT',
amount: 20,
type: 'exactSpend',
@@ -42,7 +43,7 @@ describe('Spot trading', () => {
const result = await bscUnit.exchange.swapMarket({
assetIn: 'USDT',
assetOut: 'ORN',
assetOut: SERVICE_TOKEN,
amount: 20,
type: 'exactReceive',
signer: wallet,