Skip to content

Commit ab63753

Browse files
update formatting and deps (#27)
* update formatting and deps * drop support for node 8
1 parent 1d995f2 commit ab63753

9 files changed

Lines changed: 272 additions & 212 deletions

File tree

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ branches:
44
- production
55
language: node_js
66
node_js:
7-
- "8"
87
- "10"
98
- "12"
109
install:

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## 4.3.4
4+
5+
- **Development:**
6+
- Drop support for node 8
7+
- Update prettier formatter to v2
8+
- Update dependencies
9+
310
## 4.3.3
411

512
- **Bug Fix:**

package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dragonchain-sdk",
3-
"version": "4.3.3",
3+
"version": "4.3.4",
44
"description": "Dragonchain SDK for Node.JS and the Browser",
55
"license": "Apache-2.0",
66
"homepage": "https://github.com/dragonchain/dragonchain-sdk-javascript#readme",
@@ -20,7 +20,7 @@
2020
"module": "dist/index.js",
2121
"types": "dist/types/index.d.ts",
2222
"engines": {
23-
"node": ">=8"
23+
"node": ">=10.13.0"
2424
},
2525
"scripts": {
2626
"build": "rm -rf dist/ && tsc",
@@ -83,22 +83,22 @@
8383
"@types/chai": "^4.2.11",
8484
"@types/ini": "^1.3.30",
8585
"@types/mocha": "^7.0.2",
86-
"@types/node": "^13.9.2",
86+
"@types/node": "^12.12.31",
8787
"@types/node-fetch": "^2.5.5",
8888
"@types/sinon": "^7.5.2",
8989
"@types/sinon-chai": "^3.2.3",
90-
"@typescript-eslint/eslint-plugin": "^2.24.0",
91-
"@typescript-eslint/parser": "^2.24.0",
90+
"@typescript-eslint/eslint-plugin": "^2.25.0",
91+
"@typescript-eslint/parser": "^2.25.0",
9292
"chai": "^4.2.0",
9393
"eslint": "^6.8.0",
94-
"eslint-config-prettier": "^6.10.0",
94+
"eslint-config-prettier": "^6.10.1",
9595
"mocha": "^7.1.1",
9696
"nyc": "^15.0.0",
97-
"prettier": "^1.19.1",
97+
"prettier": "^2.0.2",
9898
"sinon": "^9.0.1",
9999
"sinon-chai": "^3.5.0",
100-
"ts-node": "^8.7.0",
101-
"typedoc": "^0.17.1",
100+
"ts-node": "^8.8.1",
101+
"typedoc": "^0.17.3",
102102
"typescript": "^3.8.3"
103103
}
104104
}

src/services/config-service/ConfigCient.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ const getCredsFromFile = async (dragonchainId: string, injected: any = { readFil
122122
if (!auth_key || !auth_key_id) return false;
123123
return {
124124
authKey: auth_key,
125-
authKeyId: auth_key_id
125+
authKeyId: auth_key_id,
126126
};
127127
};
128128

@@ -230,5 +230,5 @@ export {
230230
getEndpointFromFile,
231231
getCredsFromFile,
232232
getEndpointFromRemote,
233-
getCredsAsSmartContract
233+
getCredsAsSmartContract,
234234
};

src/services/config-service/ConfigClient.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ describe('ConfigClient', () => {
132132
return {
133133
json: () => {
134134
return { url: 'test' };
135-
}
135+
},
136136
};
137137
};
138138
expect(await ConfigClient.getEndpointFromRemote('id', { fetch: fakeFetch })).to.equal('test');
@@ -143,7 +143,7 @@ describe('ConfigClient', () => {
143143
return {
144144
json: () => {
145145
return { notUrl: 'test' };
146-
}
146+
},
147147
};
148148
};
149149
try {

src/services/credential-service/CredentialService.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,7 @@ export class CredentialService {
7171
*/
7272
private static getHmacMessageString = (method: string, path: string, dragonchainId: string, timestamp: string, contentType: string, body: string, hmacAlgo: HmacAlgorithm) => {
7373
const binaryBody = Buffer.from(body || '', 'utf-8');
74-
const hashedBase64Content = crypto
75-
.createHash(hmacAlgo)
76-
.update(binaryBody)
77-
.digest('base64');
74+
const hashedBase64Content = crypto.createHash(hmacAlgo).update(binaryBody).digest('base64');
7875
return [method.toUpperCase(), path, dragonchainId, timestamp, contentType, hashedBase64Content].join('\n');
7976
};
8077
}

src/services/dragonchain-client/DragonchainClient.spec.ts

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ describe('DragonchainClient', () => {
6363
headers: {
6464
dragonchain: 'fakeDragonchainId',
6565
Authorization: 'fakeCreds',
66-
timestamp: fakeTime
67-
}
66+
timestamp: fakeTime,
67+
},
6868
};
6969
});
7070

@@ -154,7 +154,7 @@ describe('DragonchainClient', () => {
154154
offset: 1,
155155
idsOnly: false,
156156
sortAscending: false,
157-
sortBy: 'whatever'
157+
sortBy: 'whatever',
158158
});
159159
assert.calledWith(
160160
fetch,
@@ -166,7 +166,7 @@ describe('DragonchainClient', () => {
166166
it('defaults offset and limit', async () => {
167167
await client.queryTransactions({
168168
transactionType: 'test',
169-
redisearchQuery: 'yeah'
169+
redisearchQuery: 'yeah',
170170
});
171171
assert.calledWith(fetch, 'fakeUrl/v1/transaction?transaction_type=test&q=yeah&offset=0&limit=10', expectedFetchOptions);
172172
});
@@ -180,7 +180,7 @@ describe('DragonchainClient', () => {
180180

181181
it('defaults offset and limit', async () => {
182182
await client.queryBlocks({
183-
redisearchQuery: 'yeah'
183+
redisearchQuery: 'yeah',
184184
});
185185
assert.calledWith(fetch, 'fakeUrl/v1/block?q=yeah&offset=0&limit=10', expectedFetchOptions);
186186
});
@@ -241,9 +241,9 @@ describe('DragonchainClient', () => {
241241
headers: {
242242
dragonchain: 'fakeDragonchainId',
243243
Authorization: 'fakeCreds',
244-
timestamp: fakeTime
244+
timestamp: fakeTime,
245245
},
246-
body: undefined
246+
body: undefined,
247247
};
248248

249249
describe('.deleteSmartContract', () => {
@@ -291,8 +291,8 @@ describe('DragonchainClient', () => {
291291
'Content-Type': 'application/json',
292292
dragonchain: 'fakeDragonchainId',
293293
Authorization: 'fakeCreds',
294-
timestamp: fakeTime
295-
}
294+
timestamp: fakeTime,
295+
},
296296
};
297297

298298
describe('.createApiKey', () => {
@@ -308,13 +308,13 @@ describe('DragonchainClient', () => {
308308
const transactionCreatePayload = {
309309
transactionType: 'transaction',
310310
payload: 'hi!',
311-
tag: 'Awesome!'
311+
tag: 'Awesome!',
312312
};
313313
const expectedBody = {
314314
version: '1',
315315
txn_type: transactionCreatePayload.transactionType,
316316
payload: transactionCreatePayload.payload,
317-
tag: transactionCreatePayload.tag
317+
tag: transactionCreatePayload.tag,
318318
};
319319
await client.createTransaction(transactionCreatePayload);
320320
const obj = { ...expectedFetchOptions, body: JSON.stringify(expectedBody) };
@@ -335,14 +335,14 @@ describe('DragonchainClient', () => {
335335
options: {
336336
no_index: false,
337337
weight: 0.5,
338-
sortable: true
339-
}
340-
}
341-
]
338+
sortable: true,
339+
},
340+
},
341+
],
342342
};
343343
await client.createTransactionType({
344344
transactionType: 'testing',
345-
customIndexFields: [{ path: 'testPath', fieldName: 'someField', type: 'text', options: { noIndex: false, sortable: true, weight: 0.5 } }]
345+
customIndexFields: [{ path: 'testPath', fieldName: 'someField', type: 'text', options: { noIndex: false, sortable: true, weight: 0.5 } }],
346346
});
347347
const obj = { ...expectedFetchOptions, body: JSON.stringify(expectedBody) };
348348
assert.calledWith(fetch, 'fakeUrl/v1/transaction-type', obj);
@@ -356,7 +356,7 @@ describe('DragonchainClient', () => {
356356
image: 'ubuntu:latest',
357357
environmentVariables: { banana: 'banana', apple: 'banana' },
358358
cmd: 'banana',
359-
args: ['-m', 'cool']
359+
args: ['-m', 'cool'],
360360
};
361361
const expectedBody = {
362362
version: '3',
@@ -365,7 +365,7 @@ describe('DragonchainClient', () => {
365365
execution_order: 'parallel',
366366
cmd: contractPayload.cmd,
367367
args: contractPayload.args,
368-
env: contractPayload.environmentVariables
368+
env: contractPayload.environmentVariables,
369369
};
370370
await client.createSmartContract(contractPayload);
371371
const obj = { ...expectedFetchOptions, body: JSON.stringify(expectedBody) };
@@ -381,7 +381,7 @@ describe('DragonchainClient', () => {
381381
value: '0x0',
382382
data: '0x111',
383383
gasPrice: '0x222',
384-
gas: '0x333'
384+
gas: '0x333',
385385
};
386386
const expectedBody = {
387387
network: transactionCreatePayload.network,
@@ -390,8 +390,8 @@ describe('DragonchainClient', () => {
390390
value: transactionCreatePayload.value,
391391
data: transactionCreatePayload.data,
392392
gasPrice: transactionCreatePayload.gasPrice,
393-
gas: transactionCreatePayload.gas
394-
}
393+
gas: transactionCreatePayload.gas,
394+
},
395395
};
396396
await client.createEthereumTransaction(transactionCreatePayload);
397397
const obj = { ...expectedFetchOptions, body: JSON.stringify(expectedBody) };
@@ -408,7 +408,7 @@ describe('DragonchainClient', () => {
408408
private_key: 'abcd',
409409
rpc_address: 'some rpc',
410410
rpc_authorization: 'some auth',
411-
utxo_scan: false
411+
utxo_scan: false,
412412
};
413413
await client.createBitcoinInterchain({ name: 'banana', testnet: true, privateKey: 'abcd', rpcAddress: 'some rpc', rpcAuthorization: 'some auth', utxoScan: false });
414414
const obj = { ...expectedFetchOptions, body: JSON.stringify(fakeBody) };
@@ -423,7 +423,7 @@ describe('DragonchainClient', () => {
423423
name: 'banana',
424424
private_key: 'private key',
425425
rpc_address: 'some rpc',
426-
chain_id: 12
426+
chain_id: 12,
427427
};
428428
await client.createEthereumInterchain({ name: 'banana', privateKey: 'private key', rpcAddress: 'some rpc', chainId: 12 });
429429
const obj = { ...expectedFetchOptions, body: JSON.stringify(fakeBody) };
@@ -440,7 +440,7 @@ describe('DragonchainClient', () => {
440440
private_key: 'abcd',
441441
node_url: 'some IP',
442442
rpc_port: 1234,
443-
api_port: 5678
443+
api_port: 5678,
444444
};
445445
await client.createBinanceInterchain({ name: 'banana', testnet: true, privateKey: 'abcd', nodeURL: 'some IP', rpcPort: 1234, apiPort: 5678 });
446446
const obj = { ...expectedFetchOptions, body: JSON.stringify(fakeBody) };
@@ -455,7 +455,7 @@ describe('DragonchainClient', () => {
455455
fee: 4,
456456
data: 'someData',
457457
change: 'change address',
458-
outputs: [{ to: 'toaddr', value: 1.234 }]
458+
outputs: [{ to: 'toaddr', value: 1.234 }],
459459
};
460460
await client.signBitcoinTransaction({ name: 'banana', satoshisPerByte: 4, data: 'someData', changeAddress: 'change address', outputs: [{ to: 'toaddr', value: 1.234 }] });
461461
const obj = { ...expectedFetchOptions, body: JSON.stringify(fakeBody) };
@@ -472,7 +472,7 @@ describe('DragonchainClient', () => {
472472
data: 'someData',
473473
gasPrice: 'gas price',
474474
gas: 'gas',
475-
nonce: 'nonce'
475+
nonce: 'nonce',
476476
};
477477
await client.signEthereumTransaction({ name: 'banana', to: 'some addr', value: 'some value', data: 'someData', gasPrice: 'gas price', gas: 'gas', nonce: 'nonce' });
478478
const obj = { ...expectedFetchOptions, body: JSON.stringify(fakeBody) };
@@ -487,7 +487,7 @@ describe('DragonchainClient', () => {
487487
amount: 123,
488488
to_address: 'receiver addy',
489489
symbol: 'TOKEN',
490-
memo: 'for bananas'
490+
memo: 'for bananas',
491491
};
492492
await client.signBinanceTransaction({ name: 'banana', amount: 123, toAddress: 'receiver addy', symbol: 'TOKEN', memo: 'for bananas' });
493493
const obj = { ...expectedFetchOptions, body: JSON.stringify(fakeBody) };
@@ -500,7 +500,7 @@ describe('DragonchainClient', () => {
500500
const fakeBody: any = {
501501
version: '1',
502502
blockchain: 'bitcoin',
503-
name: 'banana'
503+
name: 'banana',
504504
};
505505
await client.setDefaultInterchainNetwork({ name: 'banana', blockchain: 'bitcoin' });
506506
const obj = { ...expectedFetchOptions, body: JSON.stringify(fakeBody) };
@@ -514,7 +514,7 @@ describe('DragonchainClient', () => {
514514
version: '1',
515515
blockchain: 'bitcoin',
516516
name: 'banana',
517-
signed_txn: 'banana'
517+
signed_txn: 'banana',
518518
};
519519
await client.publishInterchainTransaction({ name: 'banana', blockchain: 'bitcoin', signedTransaction: 'banana' });
520520
const obj = { ...expectedFetchOptions, body: JSON.stringify(fakeBody) };
@@ -539,8 +539,8 @@ describe('DragonchainClient', () => {
539539
'Content-Type': 'application/json',
540540
dragonchain: 'fakeDragonchainId',
541541
Authorization: 'fakeCreds',
542-
timestamp: fakeTime
543-
}
542+
timestamp: fakeTime,
543+
},
544544
};
545545

546546
describe('.updateApiKey', () => {
@@ -557,7 +557,7 @@ describe('DragonchainClient', () => {
557557
const status = 'active';
558558
const fakeBodyResponse: any = {
559559
version: '3',
560-
desired_state: status
560+
desired_state: status,
561561
};
562562
await client.updateSmartContract({ smartContractId, enabled: true });
563563
const obj = { ...expectedFetchOptions, body: JSON.stringify(fakeBodyResponse) };
@@ -582,8 +582,8 @@ describe('DragonchainClient', () => {
582582
'Content-Type': 'application/json',
583583
dragonchain: 'fakeDragonchainId',
584584
Authorization: 'fakeCreds',
585-
timestamp: fakeTime
586-
}
585+
timestamp: fakeTime,
586+
},
587587
};
588588

589589
describe('.updateBitcoinInterchain', () => {
@@ -594,7 +594,7 @@ describe('DragonchainClient', () => {
594594
private_key: 'abcd',
595595
rpc_address: 'some rpc',
596596
rpc_authorization: 'some auth',
597-
utxo_scan: false
597+
utxo_scan: false,
598598
};
599599
await client.updateBitcoinInterchain({ name: 'banana', testnet: true, privateKey: 'abcd', rpcAddress: 'some rpc', rpcAuthorization: 'some auth', utxoScan: false });
600600
const obj = { ...expectedFetchOptions, body: JSON.stringify(fakeBody) };
@@ -608,7 +608,7 @@ describe('DragonchainClient', () => {
608608
version: '1',
609609
private_key: 'abcd',
610610
rpc_address: 'some rpc',
611-
chain_id: 12
611+
chain_id: 12,
612612
};
613613
await client.updateEthereumInterchain({ name: 'banana', privateKey: 'abcd', rpcAddress: 'some rpc', chainId: 12 });
614614
const obj = { ...expectedFetchOptions, body: JSON.stringify(fakeBody) };
@@ -624,7 +624,7 @@ describe('DragonchainClient', () => {
624624
private_key: 'abcd',
625625
node_url: 'some IP',
626626
rpc_port: 1234,
627-
api_port: 5678
627+
api_port: 5678,
628628
};
629629
await client.updateBinanceInterchain({ name: 'banana', testnet: true, privateKey: 'abcd', nodeURL: 'some IP', rpcPort: 1234, apiPort: 5678 });
630630
const obj = { ...expectedFetchOptions, body: JSON.stringify(fakeBody) };

0 commit comments

Comments
 (0)