forked from sebs/etherscan-api
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcontract.js
More file actions
26 lines (24 loc) · 730 Bytes
/
contract.js
File metadata and controls
26 lines (24 loc) · 730 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
const querystring = require('querystring');
module.exports = function(getRequest, apiKey) {
return {
/**
* Returns the ABI/Interface of a given contract
* @param {string} address - Contract address
* @example
* api.contract
* .getabi('0xfb6916095ca1df60bb79ce92ce3ea74c37c5d359')
* .at('0xfb6916095ca1df60bb79ce92ce3ea74c37c5d359')
* .memberId('0xfb6916095ca1df60bb79ce92ce3ea74c37c5d359')
* .then(console.log)
* @returns {Promise.<object>}
*/
getabi(address) {
const module = 'contract';
const action = 'getabi';
var query = querystring.stringify({
module, action, address, apiKey
});
return getRequest(query);
}
};
};