@@ -9,12 +9,11 @@ import {
9
9
AuthorizeCredential ,
10
10
Currency ,
11
11
IssuedCurrencyAmount ,
12
+ MPTAmount ,
12
13
Memo ,
13
14
Signer ,
14
15
XChainBridge ,
15
- MPTAmount ,
16
16
} from '../common'
17
-
18
17
import { onlyHasFields } from '../utils'
19
18
20
19
const MEMO_SIZE = 3
@@ -262,7 +261,7 @@ export function validateOptionalField(
262
261
/* eslint-enable @typescript-eslint/restrict-template-expressions -- checked before */
263
262
264
263
// eslint-disable-next-line @typescript-eslint/no-empty-interface -- no global flags right now, so this is fine
265
- export interface GlobalFlags { }
264
+ export interface GlobalFlags { }
266
265
267
266
/**
268
267
* Every transaction has the same set of common fields.
@@ -462,12 +461,12 @@ export function validateCredentialType(tx: Record<string, unknown>): void {
462
461
* PermissionedDomainSet transaction uses 10, other transactions use 8.
463
462
* @throws Validation Error if the formatting is incorrect
464
463
*/
465
- // eslint-disable-next-line max-lines-per-function -- separating logic further will add unnecessary complexity
464
+ // eslint-disable-next-line max-lines-per-function, max-params -- separating logic further will add unnecessary complexity
466
465
export function validateCredentialsList (
467
466
credentials : unknown ,
468
467
transactionType : string ,
469
468
isStringID : boolean ,
470
- maxLengthCredentialsArray : number
469
+ maxLengthCredentialsArray : number ,
471
470
) : void {
472
471
if ( credentials == null ) {
473
472
return
@@ -526,15 +525,16 @@ export function containsDuplicates(
526
525
527
526
// Type guard to ensure we're working with AuthorizeCredential[]
528
527
// Note: This is not a rigorous type-guard. A more thorough solution would be to iterate over the array and check each item.
529
- const isAuthorizeCredential = (
528
+ function isAuthorizeCredentialArray (
530
529
list : AuthorizeCredential [ ] | string [ ] ,
531
- ) : list is AuthorizeCredential [ ] => {
530
+ ) : list is AuthorizeCredential [ ] {
532
531
return typeof list [ 0 ] !== 'string'
533
532
}
534
533
535
- if ( isAuthorizeCredential ( objectList ) ) {
534
+ if ( isAuthorizeCredentialArray ( objectList ) ) {
536
535
for ( const item of objectList ) {
537
536
const key = `${ item . Credential . Issuer } -${ item . Credential . CredentialType } `
537
+ // eslint-disable-next-line max-depth -- necessary to check for type-guards
538
538
if ( seen . has ( key ) ) {
539
539
return true
540
540
}
0 commit comments