Skip to content

Commit

Permalink
APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
niklabh committed May 5, 2021
1 parent e60ac8d commit 6112d40
Show file tree
Hide file tree
Showing 15 changed files with 137 additions and 2 deletions.
9 changes: 9 additions & 0 deletions classA/getAllContractMetadata.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const { request } = require('../utils');

module.exports = (chain_id, id, query = {}) => {
const api = `/${chain_id}/tokens/tokenlists/${id}/`;

return request(api, query);
};


9 changes: 9 additions & 0 deletions classA/getBlock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const { request } = require('../utils');

module.exports = (chain_id, block_height, query = {}) => {
const api = `/${chain_id}/block_v2/${block_height}/`;

return request(api, query);
};


7 changes: 7 additions & 0 deletions classA/getBlockHeights.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const { request } = require('../utils');

module.exports = (chain_id, start_date, end_date, query = {}) => {
const api = `/${chain_id}/block_v2/${start_date}/${end_date}/`;

return request(api, query);
};
9 changes: 9 additions & 0 deletions classA/getChangesInTokenHoldersBetweenTwoBlockHeights.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const { request } = require('../utils');

module.exports = (chain_id, address, query = {}) => {
const api = `/${chain_id}/tokens/${address}/token_holders_changes/`;

return request(api, query);
};


9 changes: 9 additions & 0 deletions classA/getERC20TokenTransfers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const { request } = require('../utils');

module.exports = (chain_id, address, query = {}) => {
const api = `/${chain_id}/address/${address}/transfers_v2/`;

return request(api, query);
};


9 changes: 9 additions & 0 deletions classA/getExternalNFTMetadata.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const { request } = require('../utils');

module.exports = (chain_id, address, token_id, query = {}) => {
const api = `/${chain_id}/tokens/${address}/nft_metadata/${token_id}/`;

return request(api, query);
};


9 changes: 9 additions & 0 deletions classA/getLogEventsByContractAddress.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const { request } = require('../utils');

module.exports = (chain_id, address, query = {}) => {
const api = `/${chain_id}/events/address/${address}/`;

return request(api, query);
};


9 changes: 9 additions & 0 deletions classA/getLogEventsByTopicHashes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const { request } = require('../utils');

module.exports = (chain_id, topic, query = {}) => {
const api = `/${chain_id}/events/topics/${topic}/`;

return request(api, query);
};


9 changes: 9 additions & 0 deletions classA/getNFTTokenIDs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const { request } = require('../utils');

module.exports = (chain_id, address, query = {}) => {
const api = `/${chain_id}/tokens/${address}/nft_token_ids/`;

return request(api, query);
};


8 changes: 8 additions & 0 deletions classA/getNFTTransactions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const { request } = require('../utils');

module.exports = (chain_id, address, token_id, query = {}) => {
const api = `/${chain_id}/tokens/${address}/nft_transactions/${token_id}/`;

return request(api, query);
};

9 changes: 9 additions & 0 deletions classA/getTokenHoldersAsOfABlockHeight.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const { request } = require('../utils');

module.exports = (chain_id, address, query = {}) => {
const api = `/${chain_id}/tokens/${address}/token_holders/`;

return request(api, query);
};


9 changes: 9 additions & 0 deletions classA/getTransaction.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const { request } = require('../utils');

module.exports = (chain_id, address, query = {}) => {
const api = `/${chain_id}/transaction_v2/${tx_hash}/`;

return request(api, query);
};


26 changes: 25 additions & 1 deletion classA/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,33 @@
const getTokenBalancesForAddress = require('./getTokenBalancesForAddress');
const getHistoricalPortfolioValueOverTime = require('./getHistoricalPortfolioValueOverTime');
const getTransactions = require('./getTransactions');
const getERC20TokenTransfers = require('./getERC20TokenTransfers');
const getBlock = require('./getBlock');
const getBlockHeights = require('./getBlockHeights');
const getLogEventsByContractAddress = require('./getLogEventsByContractAddress');
const getLogEventsByTopicHashes = require('./getLogEventsByTopicHashes');
const getExternalNFTMetadata = require('./getExternalNFTMetadata');
const getNFTTokenIDs = require('./getNFTTokenIDs');
const getNFTTransactions = require('./getNFTTransactions');
const getChangesInTokenHoldersBetweenTwoBlockHeights = require('./getChangesInTokenHoldersBetweenTwoBlockHeights');
const getTokenHoldersAsOfABlockHeight = require('./getTokenHoldersAsOfABlockHeight');
const getAllContractMetadata = require('./getAllContractMetadata');
const getTransaction = require('./getTransaction');

module.exports = {
getTokenBalancesForAddress,
getHistoricalPortfolioValueOverTime,
getTransactions
getTransactions,
getERC20TokenTransfers,
getBlock,
getBlockHeights,
getLogEventsByContractAddress,
getLogEventsByTopicHashes,
getExternalNFTMetadata,
getNFTTokenIDs,
getNFTTransactions,
getChangesInTokenHoldersBetweenTwoBlockHeights,
getTokenHoldersAsOfABlockHeight,
getAllContractMetadata,
getTransaction
};
5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
const classA = require('./classA');
const classB = require('./classA');
const pricing = require('./pricing');

module.exports = {
classA,
classB
classB,
pricing
}

if (require.main === module) {
async function test() {
console.log(classA);
const result = await classA.getHistoricalPortfolioValueOverTime(1, '0x4004AFc68dd8B5483bBaB82C84b81181fCB545B1', {});

console.log(result);
Expand Down
3 changes: 3 additions & 0 deletions pricing/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

module.exports = {
};

0 comments on commit 6112d40

Please sign in to comment.