Skip to content

Commit eed6679

Browse files
committed
fix: use the passed api key for tests so we dont hit limits
1 parent 29a970d commit eed6679

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

test/methods-test.js

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ describe('api', function() {
1717
* https://etherscan.io/apis#tokens
1818
*/
1919
// it('tokenbalance by name', function (done) {
20-
// var api = init();
20+
// var api = init(process.env.API_KEY);
2121
//
2222
// var supply = api.account.tokenbalance(
2323
// '0x4366ddc115d8cf213c564da36e64c8ebaa30cdbd',
@@ -29,55 +29,55 @@ describe('api', function() {
2929
// });
3030
// });
3131
it('tokenbalance by address', function(done) {
32-
var api = init();
32+
var api = init(process.env.API_KEY);
3333
var supply = api.account.tokenbalance('0xe04f27eb70e025b78871a2ad7eabe85e61212761', false, '0x57d90b64a1a57749b0f932f1a3395792e12e7055');
3434
supply.then(function(res){
3535
assert.ok(res);
3636
done();
3737
});
3838
});
3939
it('txlist', function(done){
40-
var api = init();
40+
var api = init(process.env.API_KEY);
4141
var txlist = api.account.txlist('0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae');
4242
txlist.then(function(res){
4343
assert.ok(res);
4444
done();
4545
});
4646
});
4747
it('txlistinternal by hash', function(done){
48-
var api = init();
48+
var api = init(process.env.API_KEY);
4949
var txlist = api.account.txlistinternal('0x40eb908387324f2b575b4879cd9d7188f69c8fc9d87c901b9e2daaea4b442170');
5050
txlist.then(function(res){
5151
assert.ok(res);
5252
done();
5353
}).catch(done);
5454
});
5555
it('txlistinternal by address', function(done){
56-
var api = init();
56+
var api = init(process.env.API_KEY);
5757
var txlist = api.account.txlistinternal(null, '0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae');
5858
txlist.then(function(res) {
5959
assert.ok(res);
6060
done();
6161
});
6262
});
6363
it('balance', function(done){
64-
var api = init();
64+
var api = init(process.env.API_KEY);
6565
var balance = api.account.balance('0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae');
6666
balance.then(function(res){
6767
assert.ok(res);
6868
done();
6969
});
7070
});
7171
it('balance multi', function(done){
72-
var api = init();
72+
var api = init(process.env.API_KEY);
7373
var balance = api.account.balance(['0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae']);
7474
balance.then(function(res){
7575
assert.ok(res);
7676
done();
7777
});
7878
});
7979
it('tokentx', function(done){
80-
var api = init();
80+
var api = init(process.env.API_KEY);
8181
var txlist = api.account.tokentx(
8282
'0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae',
8383
'0x6beb418fc6e1958204ac8baddcf109b8e9694966',
@@ -89,7 +89,7 @@ describe('api', function() {
8989
});
9090
});
9191
it('tokennfttx', function(done){
92-
var api = init();
92+
var api = init(process.env.API_KEY);
9393
var txlist = api.account.tokentx(
9494
'0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae',
9595
'0x6beb418fc6e1958204ac8baddcf109b8e9694966',
@@ -103,7 +103,7 @@ describe('api', function() {
103103
});
104104
describe('stats', function(){
105105
it('ethsupply', function(done){
106-
var api = init();
106+
var api = init(process.env.API_KEY);
107107
var supply = api.stats.ethsupply();
108108
supply.then(function(res){
109109
assert.ok(res);
@@ -112,15 +112,15 @@ describe('api', function() {
112112
});
113113

114114
it('tokensupply by tokenname', function(done){
115-
var api = init();
115+
var api = init(process.env.API_KEY);
116116
var supply = api.stats.tokensupply('MKR');
117117
supply.then(function(res){
118118
assert.ok(res);
119119
done();
120120
});
121121
});
122122
it('tokensupply by address', function(done){
123-
var api = init();
123+
var api = init(process.env.API_KEY);
124124
var supply = api.stats.tokensupply(null, '0x57d90b64a1a57749b0f932f1a3395792e12e7055');
125125
supply.then(function(res){
126126
assert.ok(res);
@@ -129,7 +129,7 @@ describe('api', function() {
129129
});
130130

131131
it('ethprice', function(done){
132-
var api = init();
132+
var api = init(process.env.API_KEY);
133133
var price = api.stats.ethprice();
134134
price.then(function(res){
135135
assert.ok(res);
@@ -140,7 +140,7 @@ describe('api', function() {
140140

141141

142142
it('block.getblockreward', function(done){
143-
var api = init();
143+
var api = init(process.env.API_KEY);
144144
var blockreward = api.block.getblockreward();
145145
blockreward.then(function(res){
146146
assert.ok(res);
@@ -149,7 +149,7 @@ describe('api', function() {
149149
});
150150

151151
it('transaction.getstatus', function(done){
152-
var api = init();
152+
var api = init(process.env.API_KEY);
153153
var status = api.transaction.getstatus('0x15f8e5ea1079d9a0bb04a4c58ae5fe7654b5b2b4463375ff7ffb490aa0032f3a');
154154
status.then(function(res){
155155
assert.ok(res);
@@ -173,7 +173,7 @@ describe('api', function() {
173173

174174
describe('proxy', function() {
175175
it('proxy.eth_blockNumber', function(done){
176-
var api = init();
176+
var api = init(process.env.API_KEY);
177177
var res = api.proxy.eth_blockNumber();
178178
res.then(function(res){
179179
assert.ok(res);
@@ -183,7 +183,7 @@ describe('api', function() {
183183

184184

185185
it('proxy.eth_getBlockByNumber', function(done){
186-
var api = init();
186+
var api = init(process.env.API_KEY);
187187
var res = api.proxy.eth_getBlockByNumber('0x10d4f');
188188
res.then(function(res){
189189
assert.ok(res);
@@ -193,7 +193,7 @@ describe('api', function() {
193193

194194

195195
it('proxy.eth_getUncleByBlockNumberAndIndex', function(done){
196-
var api = init();
196+
var api = init(process.env.API_KEY);
197197
var res = api.proxy.eth_getUncleByBlockNumberAndIndex('0x210A9B', '0x0');
198198
res.then(function(res){
199199
assert.ok(res);
@@ -202,7 +202,7 @@ describe('api', function() {
202202
});
203203

204204
it('proxy.eth_getBlockTransactionCountByNumber', function(done){
205-
var api = init();
205+
var api = init(process.env.API_KEY);
206206
var res = api.proxy.eth_getBlockTransactionCountByNumber('0x10FB78');
207207
res.then(function(res){
208208
assert.ok(res);
@@ -211,7 +211,7 @@ describe('api', function() {
211211
});
212212

213213
it('proxy.eth_getTransactionByHash', function(done){
214-
var api = init();
214+
var api = init(process.env.API_KEY);
215215
var res = api.proxy.eth_getTransactionByHash('0x1e2910a262b1008d0616a0beb24c1a491d78771baa54a33e66065e03b1f46bc1');
216216
res.then(function(res){
217217
assert.ok(res);
@@ -221,7 +221,7 @@ describe('api', function() {
221221

222222

223223
it('proxy.eth_getTransactionByBlockNumberAndIndex', function(done){
224-
var api = init();
224+
var api = init(process.env.API_KEY);
225225
var res = api.proxy.eth_getTransactionByBlockNumberAndIndex('0x10d4f', '0x0');
226226
res.then(function(res){
227227
assert.ok(res);
@@ -230,7 +230,7 @@ describe('api', function() {
230230
});
231231

232232
it('proxy.eth_getTransactionCount', function(done){
233-
var api = init();
233+
var api = init(process.env.API_KEY);
234234
var res = api.proxy.eth_getTransactionCount('0x2910543af39aba0cd09dbb2d50200b3e800a63d2');
235235
res.then(function(res){
236236
assert.ok(res);
@@ -239,7 +239,7 @@ describe('api', function() {
239239
});
240240

241241
xit('proxy.eth_sendRawTransaction', function(done){
242-
var api = init();
242+
var api = init(process.env.API_KEY);
243243
var res = api.proxy.eth_sendRawTransaction('0xf904808000831cfde080');
244244
res.then(function(res){
245245
assert.ok(res);
@@ -248,7 +248,7 @@ describe('api', function() {
248248
});
249249

250250
it('proxy.eth_getTransactionReceipt', function(done){
251-
var api = init();
251+
var api = init(process.env.API_KEY);
252252
var res = api.proxy.eth_getTransactionReceipt('0x1e2910a262b1008d0616a0beb24c1a491d78771baa54a33e66065e03b1f46bc1');
253253
res.then(function(res){
254254
assert.ok(res);
@@ -257,7 +257,7 @@ describe('api', function() {
257257
});
258258

259259
it('proxy.eth_call', function(done){
260-
var api = init();
260+
var api = init(process.env.API_KEY);
261261
var res = api.proxy.eth_call(
262262
'0xAEEF46DB4855E25702F8237E8f403FddcaF931C0',
263263
'0x70a08231000000000000000000000000e16359506c028e51f16be38986ec5746251e9724',
@@ -270,7 +270,7 @@ describe('api', function() {
270270
});
271271

272272
it('proxy.eth_getCode', function(done){
273-
var api = init();
273+
var api = init(process.env.API_KEY);
274274
var res = api.proxy.eth_getCode('0xf75e354c5edc8efed9b59ee9f67a80845ade7d0c', 'latest');
275275
res.then(function(res){
276276
assert.ok(res);
@@ -279,7 +279,7 @@ describe('api', function() {
279279
});
280280

281281
it('proxy.eth_getStorageAt', function(done){
282-
var api = init();
282+
var api = init(process.env.API_KEY);
283283
var res = api.proxy.eth_getStorageAt('0x6e03d9cce9d60f3e9f2597e13cd4c54c55330cfd', '0x0', 'latest');
284284
res.then(function(res){
285285
assert.ok(res);
@@ -288,7 +288,7 @@ describe('api', function() {
288288
});
289289

290290
it('proxy.eth_gasPrice', function(done){
291-
var api = init();
291+
var api = init(process.env.API_KEY);
292292
var res = api.proxy.eth_gasPrice();
293293
res.then(function(res){
294294
assert.ok(res);
@@ -297,7 +297,7 @@ describe('api', function() {
297297
});
298298

299299
xit('proxy.eth_estimateGas', function(done){
300-
var api = init();
300+
var api = init(process.env.API_KEY);
301301
var res = api.proxy.eth_estimateGas(
302302
'0xf0160428a8552ac9bb7e050d90eeade4ddd52843',
303303
'0xff22',

0 commit comments

Comments
 (0)