Skip to content

Commit a8ff23f

Browse files
committed
💄 Lint fixes
1 parent 829f5cb commit a8ff23f

24 files changed

+733
-775
lines changed

lib/order/__tests__/GenerateTransactionTypes.js

Lines changed: 80 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const withPlaceAlgoTxns = require('../txns/buy/withPlaceAlgoTxns');
33
const withCloseAssetTxns = require('../txns/close/withCloseAssetTxns');
44
const withCloseAlgoTxns = require('../txns/close/withCloseAlgoTxns');
55
const getTakerOrders = require('../structure/getTakerOrders');
6-
const { timeout } = require('../../teal/utils');
6+
const {timeout} = require('../../teal/utils');
77

88
const compile = require('../compile/compile');
99
const AlgodexApi = require('../../AlgodexApi');
@@ -32,116 +32,113 @@ const tesnet = {
3232
const algodexApi = new AlgodexApi(tesnet);
3333

3434
const TransactionGenerator = {
35-
getPlaceASAEscrowOrderTxns: async function (order) {
35+
getPlaceASAEscrowOrderTxns: async function(order) {
3636
return await withPlaceAssetTxns(
37-
await compile({
38-
...order,
39-
appId:
40-
typeof order.appId === 'undefined'
41-
? await algodexApi.getAppId(order)
42-
: order.appId,
43-
version: 6,
44-
indexer: algodexApi.indexer,
45-
wallet: {
46-
...order.wallet,
47-
...(await algodexApi.http.indexer.fetchAccountInfo(order.wallet)),
48-
},
49-
})
37+
await compile({
38+
...order,
39+
appId:
40+
typeof order.appId === 'undefined' ?
41+
await algodexApi.getAppId(order) :
42+
order.appId,
43+
version: 6,
44+
indexer: algodexApi.indexer,
45+
wallet: {
46+
...order.wallet,
47+
...(await algodexApi.http.indexer.fetchAccountInfo(order.wallet)),
48+
},
49+
}),
5050
);
5151
},
52-
getPlaceAlgoEscrowOrderTxns: async function (order) {
52+
getPlaceAlgoEscrowOrderTxns: async function(order) {
5353
return await withPlaceAlgoTxns(
54-
await compile({
55-
...order,
56-
appId:
57-
typeof order.appId === 'undefined'
58-
? await algodexApi.getAppId(order)
59-
: order.appId,
60-
version: 6,
61-
indexer: algodexApi.indexer,
62-
wallet: {
63-
...order.wallet,
64-
...(await algodexApi.http.indexer.fetchAccountInfo(order.wallet)),
65-
},
66-
})
54+
await compile({
55+
...order,
56+
appId:
57+
typeof order.appId === 'undefined' ?
58+
await algodexApi.getAppId(order) :
59+
order.appId,
60+
version: 6,
61+
indexer: algodexApi.indexer,
62+
wallet: {
63+
...order.wallet,
64+
...(await algodexApi.http.indexer.fetchAccountInfo(order.wallet)),
65+
},
66+
}),
6767
);
6868
},
69-
getCloseASAEscrowOrderTxns: async function (order) {
69+
getCloseASAEscrowOrderTxns: async function(order) {
7070
return await withCloseAssetTxns(
71-
await compile({
72-
...order,
73-
appId:
74-
typeof order.appId === 'undefined'
75-
? await algodexApi.getAppId(order)
76-
: order.appId,
77-
version: 6,
78-
indexer: algodexApi.indexer,
79-
contract: {
80-
creator: order.address,
81-
},
82-
wallet: {
83-
...order.wallet,
84-
...(await algodexApi.http.indexer.fetchAccountInfo(order.wallet)),
85-
},
86-
})
71+
await compile({
72+
...order,
73+
appId:
74+
typeof order.appId === 'undefined' ?
75+
await algodexApi.getAppId(order) :
76+
order.appId,
77+
version: 6,
78+
indexer: algodexApi.indexer,
79+
contract: {
80+
creator: order.address,
81+
},
82+
wallet: {
83+
...order.wallet,
84+
...(await algodexApi.http.indexer.fetchAccountInfo(order.wallet)),
85+
},
86+
}),
8787
);
8888
},
89-
getCloseAlgoEscrowOrderTxns: async function (order) {
89+
getCloseAlgoEscrowOrderTxns: async function(order) {
9090
return await withCloseAlgoTxns(
91-
await compile({
92-
...order,
93-
appId:
94-
typeof order.appId === 'undefined'
95-
? await algodexApi.getAppId(order)
96-
: order.appId,
97-
version: 6,
98-
indexer: algodexApi.indexer,
99-
contract: {
100-
creator: order.address,
101-
},
102-
wallet: {
103-
...order.wallet,
104-
...(await algodexApi.http.indexer.fetchAccountInfo(order.wallet)),
105-
},
106-
})
91+
await compile({
92+
...order,
93+
appId:
94+
typeof order.appId === 'undefined' ?
95+
await algodexApi.getAppId(order) :
96+
order.appId,
97+
version: 6,
98+
indexer: algodexApi.indexer,
99+
contract: {
100+
creator: order.address,
101+
},
102+
wallet: {
103+
...order.wallet,
104+
...(await algodexApi.http.indexer.fetchAccountInfo(order.wallet)),
105+
},
106+
}),
107107
);
108108
},
109-
getTakerOrderTxns: async function (order) {
109+
getTakerOrderTxns: async function(order) {
110110
algodexApi.setWallet(order.wallet);
111111

112-
let _orderbook = await algodexApi.http.dexd.fetchAssetOrders(order.asset.id)
112+
let _orderbook = await algodexApi.http.dexd.fetchAssetOrders(order.asset.id);
113113

114-
try {
115-
while (
116-
Object.values(_orderbook).reduce((a, b) => {
117-
return a.concat(b); // need to put inside the while statement so the expression re runs every time _orderbook changes
118-
}, []).length === 0
119-
) {
120-
await timeout(4000);
121-
_orderbook = await algodexApi.http.dexd.fetchAssetOrders(
122-
order.asset.id
123-
);
124-
}
125-
} catch (e) {
126-
throw e;
114+
while (
115+
Object.values(_orderbook).reduce((a, b) => {
116+
return a.concat(b); // need to put inside the while statement so the expression re runs every time _orderbook changes
117+
}, []).length === 0
118+
) {
119+
await timeout(4000);
120+
_orderbook = await algodexApi.http.dexd.fetchAssetOrders(
121+
order.asset.id,
122+
);
127123
}
128124

129-
let orderbook = algodexApi.http.dexd.mapToAllEscrowOrders({
125+
126+
const orderbook = algodexApi.http.dexd.mapToAllEscrowOrders({
130127
buy: _orderbook.buyASAOrdersInEscrow,
131128
sell: _orderbook.sellASAOrdersInEscrow,
132129
});
133130

134131
return await getTakerOrders(algodexApi, {
135132
...order,
136133
appId:
137-
typeof order.appId === 'undefined'
138-
? await algodexApi.getAppId(order)
139-
: order.appId,
134+
typeof order.appId === 'undefined' ?
135+
await algodexApi.getAppId(order) :
136+
order.appId,
140137
version: 6,
141138
indexer: algodexApi.indexer,
142139
asset: {
143140
...order.asset,
144-
orderbook
141+
orderbook,
145142
},
146143
wallet: {
147144
...order.wallet,
Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const config = require('./TealConfig');
2-
const { timeout } = require('../../../lib/teal/utils');
2+
const {timeout} = require('../../../lib/teal/utils');
33
const placeAlgoOrderTest = require('./teal_tests/placeAlgoEscrowOrder.js');
44
const closeAlgoOrderTest = require('./teal_tests/closeAlgoEscrowOrder.js');
55
const JEST_MINUTE_TIMEOUT = 60 * 1000;
@@ -14,32 +14,31 @@ describe('ALGO ESCROW CANCEL', () => {
1414
Creator Account: ${config.creatorAccount.addr}
1515
1616
Creator Account is buying ${amount} LAMPC at price: ${price} Algo
17-
`
17+
`;
1818

1919
beforeAll(async () => {
20-
await accountSetup(config, 'buy', true, false, note);
20+
await accountSetup(config, 'buy', true, false, note);
2121
await timeout(7000); // Eliminates race condition where future indexer calls occur before setUp step fully propogates but after it succeeds
2222
}, JEST_MINUTE_TIMEOUT);
2323

2424
// Create App
2525
test(
26-
'Place Algo Escrow Order',
27-
async () => {
28-
29-
const result = await placeAlgoOrderTest.runTest(config, amount, price);
30-
expect(result).toBeTruthy();
26+
'Place Algo Escrow Order',
27+
async () => {
28+
const result = await placeAlgoOrderTest.runTest(config, amount, price);
29+
expect(result).toBeTruthy();
3130

32-
await timeout(7000);
33-
},
34-
JEST_MINUTE_TIMEOUT * 10
31+
await timeout(7000);
32+
},
33+
JEST_MINUTE_TIMEOUT * 10,
3534
);
3635

3736
test(
38-
'Close Algo escrow order',
39-
async () => {
40-
const result = await closeAlgoOrderTest.runTest(config, price, amount);
41-
expect(result).toBeTruthy();
42-
},
43-
JEST_MINUTE_TIMEOUT * 2
37+
'Close Algo escrow order',
38+
async () => {
39+
const result = await closeAlgoOrderTest.runTest(config, price, amount);
40+
expect(result).toBeTruthy();
41+
},
42+
JEST_MINUTE_TIMEOUT * 2,
4443
);
4544
});

lib/order/__tests__/TealAlgoEscrowPayCloseout.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ describe('Algo ESCROW PAY CLOSEOUT', () => {
2121
2222
Creator Account is buying ${asaAmount} LAMPC at price: ${price} Algo
2323
Executor Account is selling ${executorAmount} LAMPC
24-
`
24+
`;
2525

2626
beforeAll(async () => {
2727
await accountSetup(config, 'buy', true, true, note);

lib/order/__tests__/TealAlgoEscrowPayPartial.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ describe('Algo ESCROW PAY PARTIAL', () => {
2222
2323
Creator Account is buying ${asaAmount} LAMPC at price: ${price} Algo
2424
Executor Account is selling ${executorAmount} LAMPC
25-
`
25+
`;
2626

2727
beforeAll(async () => {
2828
await accountSetup(config, 'buy', true, true, note);

lib/order/__tests__/TealAlgoEscrowPlaceNoOptInTxn.spec.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const placeAlgoOrderTest = require('./teal_tests/placeAlgoEscrowOrder.js');
22
const accountSetup = require('./accountSetup.js');
33
const JEST_MINUTE_TIMEOUT = 60 * 1000;
44
const config = require('./TealConfig');
5-
const { timeout } = require('../../teal/utils');
5+
const {timeout} = require('../../teal/utils');
66
const closeAlgoOrderTest = require('./teal_tests/closeAlgoEscrowOrder.js');
77
const accountCleanup = require('./accountCleanup.js');
88

@@ -16,9 +16,9 @@ describe('ALGO ESCROW PLACE NO OPT IN TXN', () => {
1616
Creator Account: ${config.creatorAccount.addr}
1717
1818
Creator Account is buying ${amount} LAMPC at price: ${price} Algo
19-
`
19+
`;
2020
beforeAll(async () => {
21-
await accountSetup(config, 'buy', true, false, note); //optIn in the setUp phase to test sdk no optIn
21+
await accountSetup(config, 'buy', true, false, note); // optIn in the setUp phase to test sdk no optIn
2222
await timeout(7000); // Eliminates race condition where future indexer calls occur before setUp step fully propogates but after it succeeds
2323
}, JEST_MINUTE_TIMEOUT);
2424

@@ -28,23 +28,23 @@ describe('ALGO ESCROW PLACE NO OPT IN TXN', () => {
2828
}, JEST_MINUTE_TIMEOUT);
2929

3030
test(
31-
'Place algo escrow order',
32-
async () => {
33-
const result = await placeAlgoOrderTest.runTest(config, amount, price);
34-
expect(result).toBeTruthy();
35-
await timeout(4000);
36-
},
37-
JEST_MINUTE_TIMEOUT
31+
'Place algo escrow order',
32+
async () => {
33+
const result = await placeAlgoOrderTest.runTest(config, amount, price);
34+
expect(result).toBeTruthy();
35+
await timeout(4000);
36+
},
37+
JEST_MINUTE_TIMEOUT,
3838
);
3939

4040
test(
41-
'Close algo escrow order',
42-
async () => {
43-
await timeout(3000);
44-
const result = await closeAlgoOrderTest.runTest(config, price, amount);
45-
expect(result).toBeTruthy();
46-
},
47-
JEST_MINUTE_TIMEOUT
41+
'Close algo escrow order',
42+
async () => {
43+
await timeout(3000);
44+
const result = await closeAlgoOrderTest.runTest(config, price, amount);
45+
expect(result).toBeTruthy();
46+
},
47+
JEST_MINUTE_TIMEOUT,
4848
);
4949
});
5050
//

lib/order/__tests__/TealAlgoEscrowPlaceWithOptInTxn.spec.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const placeAlgoOrderTest = require('./teal_tests/placeAlgoEscrowOrder.js');
22
const accountSetup = require('./accountSetup.js');
33
const JEST_MINUTE_TIMEOUT = 60 * 1000;
44
const config = require('./TealConfig');
5-
const { timeout } = require('../../teal/utils');
5+
const {timeout} = require('../../teal/utils');
66
const closeAlgoOrderTest = require('./teal_tests/closeAlgoEscrowOrder.js');
77
const accountCleanup = require('./accountCleanup.js');
88

@@ -16,7 +16,7 @@ describe('ALGO ESCROW PLACE WITH OPT IN TXN', () => {
1616
Creator Account: ${config.creatorAccount.addr}
1717
1818
Creator Account is buying ${amount} LAMPC at price: ${price} Algo
19-
`
19+
`;
2020

2121
beforeAll(async () => {
2222
await accountSetup(config, 'buy', false, false, note);
@@ -29,20 +29,20 @@ describe('ALGO ESCROW PLACE WITH OPT IN TXN', () => {
2929
}, JEST_MINUTE_TIMEOUT);
3030

3131
test(
32-
'Place algo escrow order',
33-
async () => {
34-
const result = await placeAlgoOrderTest.runTest(config, amount, price);
35-
expect(result).toBeTruthy();
36-
},
37-
JEST_MINUTE_TIMEOUT
32+
'Place algo escrow order',
33+
async () => {
34+
const result = await placeAlgoOrderTest.runTest(config, amount, price);
35+
expect(result).toBeTruthy();
36+
},
37+
JEST_MINUTE_TIMEOUT,
3838
);
3939

4040
test(
41-
'Close algo escrow order',
42-
async () => {
43-
const result = await closeAlgoOrderTest.runTest(config, price, amount);
44-
expect(result).toBeTruthy();
45-
},
46-
JEST_MINUTE_TIMEOUT
41+
'Close algo escrow order',
42+
async () => {
43+
const result = await closeAlgoOrderTest.runTest(config, price, amount);
44+
expect(result).toBeTruthy();
45+
},
46+
JEST_MINUTE_TIMEOUT,
4747
);
4848
});

0 commit comments

Comments
 (0)