Skip to content

Commit

Permalink
🎨 Cleanup env hardcode to testnet
Browse files Browse the repository at this point in the history
  • Loading branch information
PhearZero committed May 30, 2022
1 parent a0b8337 commit 2b13e6b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion bin/add-views
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const chartIndex = {
}

remote.get('_design/dex').then((res)=>{
console.log('Index Found', {...chartIndex, _rev: res._rev})
console.log('Index Found')
remote.put({...chartIndex, _rev: res._rev}).catch((e)=>{
console.log('Update error', e)
throw e;
Expand Down
1 change: 0 additions & 1 deletion docker.env
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ REDIS_MQ_ADDRESS=queues
REDIS_MQ_PORT=6379
COUCHDB_URL=http://admin:dex@couchdb:5984/dex
ALGORAND_EXPLORER=https://api.algoexplorer.io
ALGODEX_EXPLORER=https://api.algoexplorer.io
6 changes: 3 additions & 3 deletions src/__tests__/explorer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ test('get a block from explorer', async () => {
await explorer.getBlock({round: 1986})
.catch((e) => expect(e).toBeInstanceOf(InvalidConfiguration));

process.env.ALGODEX_EXPLORER = 'https://api.testnet.algoexplorer.io';
process.env.ALGORAND_EXPLORER = 'https://api.testnet.algoexplorer.io';
const block = await explorer.getBlock({round: 1986});
expect(block).toEqual(require('./block-testnet-1986.json'));
});
Expand All @@ -14,7 +14,7 @@ test('wait for block from explorer', async () => {
await explorer.waitForBlock({round: 1986})
.catch((e) => expect(e).toBeInstanceOf(InvalidConfiguration));

process.env.ALGODEX_EXPLORER = 'https://api.testnet.algoexplorer.io';
process.env.ALGORAND_EXPLORER = 'https://api.testnet.algoexplorer.io';
const block = await explorer.waitForBlock({round: 1986});
expect(block['last-round']).toBeGreaterThan(0);
});
Expand All @@ -34,7 +34,7 @@ test('get applications block range', async () => {
await explorer.getAppsBlockRange(apps)
.catch((e) => expect(e).toBeInstanceOf(InvalidConfiguration));

process.env.ALGODEX_EXPLORER = 'https://testnet.algoexplorerapi.io';
process.env.ALGORAND_EXPLORER = 'https://testnet.algoexplorerapi.io';
const range = await explorer.getAppsBlockRange(apps);

expect(range.start).toEqual(15915387);
Expand Down
8 changes: 4 additions & 4 deletions src/explorer.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ let client; let indexer;
*/
function _getAlgorandURL() {
if (
typeof process.env['ALGODEX_EXPLORER'] === 'undefined'
typeof process.env['ALGORAND_EXPLORER'] === 'undefined'
) {
throw new InvalidConfiguration('Algorand API not configured!');
}

return process.env['ALGODEX_EXPLORER'];
return process.env['ALGORAND_EXPLORER'];
}

/**
Expand All @@ -25,7 +25,7 @@ async function _getAPI() {
const url = _getAlgorandURL();
if (typeof client === 'undefined') {
client = await new SwaggerClient(`${url}/v2/swagger.json`);
client.spec.host=url.replace('https://', '');
client.spec.host = 'node.testnet.algoexplorerapi.io';
}
return client.apis;
}
Expand All @@ -38,7 +38,7 @@ async function _getIndexAPI() {
const url = _getAlgorandURL();
if (typeof indexer === 'undefined') {
indexer = await new SwaggerClient(`${url}/idx2/swagger.json`);
indexer.spec.host=url.replace('https://', '');
indexer.spec.host='algoindexer.testnet.algoexplorerapi.io';
}
return indexer.apis;
}
Expand Down

0 comments on commit 2b13e6b

Please sign in to comment.