Skip to content

Commit

Permalink
fix lint error
Browse files Browse the repository at this point in the history
  • Loading branch information
tequdev committed Sep 6, 2024
1 parent 2900ab3 commit 4f93aa8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/xrpl/src/models/transactions/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,13 @@ export function validateTxAgainstCustomDefintions(
definitions: XrplDefinitionsBase,
): void {
// Validate just transaction type for now, leaving it open for further validations against the custom definition spec.
const txType = <string>tx.TransactionType
const txType = tx.TransactionType
if (typeof txType !== 'string') {
throw new ValidationError(
'TransactionType field is not specified or not a string',
)
}

if (!definitions.transactionType[txType]) {
throw new ValidationError(`Invalid transaction type: ${txType}`)
}
Expand Down
4 changes: 4 additions & 0 deletions packages/xrpl/test/wallet/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1211,6 +1211,8 @@ describe('Wallet', function () {
value: '1',
},
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any -- for unknown transaction
const result = wallet.sign(tx as any, false, customDefinition)
assert.deepEqual(result, {
tx_blob: RESPONSE_FIXTURES.signCustomDefinition.signedTransaction,
Expand Down Expand Up @@ -1242,6 +1244,7 @@ describe('Wallet', function () {
},
}
assert.throws(() => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- for unknown transaction
wallet.sign(tx as any, false, customDefinition)
}, /^Invalid transaction type: SomeUnknown$/u)
})
Expand All @@ -1251,6 +1254,7 @@ describe('Wallet', function () {
rippled.definitions.customDefinition,
)
const result = wallet.sign(
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- for unknown transaction
REQUEST_FIXTURES.signAsCustomDefinition as any,
true,
customDefinition,
Expand Down

0 comments on commit 4f93aa8

Please sign in to comment.