Skip to content

Commit 70ec52b

Browse files
committed
linting
1 parent b01a3b4 commit 70ec52b

2 files changed

Lines changed: 30 additions & 19 deletions

File tree

lib/validation.ts

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ export class ValidatorType1 {
6060
if (!this.cachedValidations.has(id)) {
6161
this.cachedValidations.set(id,
6262
{
63-
validity: true,
63+
validity: true,
6464
parents: [],
6565
details: null,
6666
invalidReason: null,
67-
waiting: false
67+
waiting: false
6868
});
6969
}
7070
if (!this.cachedRawTransactions.has(id)) {
@@ -75,7 +75,7 @@ export class ValidatorType1 {
7575
public addValidTxidFromStore(txidHex: string) {
7676
if (!this.cachedValidations.has(txidHex)) {
7777
this.cachedValidations.set(txidHex,
78-
{
78+
{
7979
validity: true,
8080
parents: [],
8181
details: null,
@@ -222,10 +222,18 @@ export class ValidatorType1 {
222222
this.logger.log("[slp-validate] Invalid Reason: " + this.cachedValidations.get(txid)!.invalidReason);
223223
} else if (!valid) {
224224
this.logger.log("[slp-validate] Invalid Reason: unknown (result is user supplied)");
225-
}
225+
}
226226
return valid;
227227
}
228228

229+
public async validateSlpTransactions(txids: string[]): Promise<string[]> {
230+
const res = [];
231+
for (const txid of txids) {
232+
res.push((await this.isValidSlpTxid({ txid })) ? txid : "");
233+
}
234+
return res.filter((id: string) => id.length > 0);
235+
}
236+
229237
/**
230238
* _isValidSlpTxid
231239
*
@@ -247,7 +255,7 @@ export class ValidatorType1 {
247255
* @param tokenTypeFilter: (optional) token type of the token that should be considered valid
248256
*
249257
*/
250-
async _isValidSlpTxid(txid: string, tokenIdFilter?: string, tokenTypeFilter?: number): Promise<boolean> {
258+
private async _isValidSlpTxid(txid: string, tokenIdFilter?: string, tokenTypeFilter?: number): Promise<boolean> {
251259
// Check to see if this txn has been processed by looking at shared cache, if doesn't exist then download txn.
252260
if (!this.cachedValidations.has(txid)) {
253261
this.cachedValidations.set(txid, {
@@ -367,7 +375,11 @@ export class ValidatorType1 {
367375
return validation.validity!;
368376
}
369377
// Continue to check the NFT1 parent DAG
370-
let nft_parent_dag_validity = await this.isValidSlpTxid({ txid: inputTxid, tokenIdFilter: undefined, tokenTypeFilter: 0x81 });
378+
const nft_parent_dag_validity = await this.isValidSlpTxid({
379+
txid: inputTxid,
380+
tokenIdFilter: undefined,
381+
tokenTypeFilter: 0x81
382+
});
371383
validation.validity = nft_parent_dag_validity;
372384
validation.waiting = false;
373385
if (!nft_parent_dag_validity) {
@@ -506,12 +518,4 @@ export class ValidatorType1 {
506518
validation.waiting = false;
507519
return validation.validity!;
508520
}
509-
510-
public async validateSlpTransactions(txids: string[]): Promise<string[]> {
511-
const res = [];
512-
for (const txid of txids) {
513-
res.push((await this.isValidSlpTxid({ txid })) ? txid : "");
514-
}
515-
return res.filter((id: string) => id.length > 0);
516-
}
517521
}

tslint.json

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1-
// You can modify the configuration here with your own.
2-
// Make sure that your json is valid, and if you run into
3-
// other issues, try checking the console for errors.
4-
51
{
62
"extends": ["tslint:recommended"],
7-
"rules": {} // add additional rules and their configuration
3+
"rules": {
4+
"interface-name": false,
5+
"no-console": false,
6+
"variable-name": false,
7+
"no-var-requires": false,
8+
"class-name": false,
9+
"object-literal-sort-keys": false,
10+
"no-empty": false,
11+
"trailing-comma": false,
12+
"prefer-for-of": false,
13+
"arrow-parens": false
14+
}
815
}

0 commit comments

Comments
 (0)