xrpl 4.2.0-batch.0 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (205) hide show
  1. package/build/xrpl-latest-min.js +1 -1
  2. package/build/xrpl-latest-min.js.map +1 -1
  3. package/build/xrpl-latest.js +35 -294
  4. package/build/xrpl-latest.js.map +1 -1
  5. package/dist/npm/Wallet/defaultFaucets.d.ts +1 -2
  6. package/dist/npm/Wallet/defaultFaucets.d.ts.map +1 -1
  7. package/dist/npm/Wallet/defaultFaucets.js +0 -5
  8. package/dist/npm/Wallet/defaultFaucets.js.map +1 -1
  9. package/dist/npm/Wallet/index.d.ts.map +1 -1
  10. package/dist/npm/Wallet/index.js +2 -8
  11. package/dist/npm/Wallet/index.js.map +1 -1
  12. package/dist/npm/client/RequestManager.d.ts.map +1 -1
  13. package/dist/npm/client/RequestManager.js +3 -3
  14. package/dist/npm/client/RequestManager.js.map +1 -1
  15. package/dist/npm/client/connection.d.ts.map +1 -1
  16. package/dist/npm/client/connection.js.map +1 -1
  17. package/dist/npm/client/index.d.ts.map +1 -1
  18. package/dist/npm/client/index.js +8 -5
  19. package/dist/npm/client/index.js.map +1 -1
  20. package/dist/npm/models/ledger/Credential.d.ts +2 -2
  21. package/dist/npm/models/ledger/Credential.d.ts.map +1 -1
  22. package/dist/npm/models/methods/baseMethod.d.ts +0 -1
  23. package/dist/npm/models/methods/baseMethod.d.ts.map +1 -1
  24. package/dist/npm/models/transactions/AMMClawback.d.ts +2 -2
  25. package/dist/npm/models/transactions/AMMClawback.d.ts.map +1 -1
  26. package/dist/npm/models/transactions/AMMDeposit.d.ts +2 -2
  27. package/dist/npm/models/transactions/AMMDeposit.d.ts.map +1 -1
  28. package/dist/npm/models/transactions/AMMWithdraw.d.ts +2 -2
  29. package/dist/npm/models/transactions/AMMWithdraw.d.ts.map +1 -1
  30. package/dist/npm/models/transactions/MPTokenAuthorize.d.ts +2 -2
  31. package/dist/npm/models/transactions/MPTokenAuthorize.d.ts.map +1 -1
  32. package/dist/npm/models/transactions/MPTokenIssuanceCreate.d.ts +2 -2
  33. package/dist/npm/models/transactions/MPTokenIssuanceCreate.d.ts.map +1 -1
  34. package/dist/npm/models/transactions/MPTokenIssuanceCreate.js.map +1 -1
  35. package/dist/npm/models/transactions/MPTokenIssuanceSet.d.ts +2 -2
  36. package/dist/npm/models/transactions/MPTokenIssuanceSet.d.ts.map +1 -1
  37. package/dist/npm/models/transactions/NFTokenCreateOffer.d.ts +2 -2
  38. package/dist/npm/models/transactions/NFTokenCreateOffer.d.ts.map +1 -1
  39. package/dist/npm/models/transactions/NFTokenMint.d.ts +2 -2
  40. package/dist/npm/models/transactions/NFTokenMint.d.ts.map +1 -1
  41. package/dist/npm/models/transactions/XChainModifyBridge.d.ts +2 -2
  42. package/dist/npm/models/transactions/XChainModifyBridge.d.ts.map +1 -1
  43. package/dist/npm/models/transactions/accountSet.d.ts +2 -2
  44. package/dist/npm/models/transactions/accountSet.d.ts.map +1 -1
  45. package/dist/npm/models/transactions/accountSet.js.map +1 -1
  46. package/dist/npm/models/transactions/common.d.ts +4 -16
  47. package/dist/npm/models/transactions/common.d.ts.map +1 -1
  48. package/dist/npm/models/transactions/common.js +10 -28
  49. package/dist/npm/models/transactions/common.js.map +1 -1
  50. package/dist/npm/models/transactions/index.d.ts +2 -3
  51. package/dist/npm/models/transactions/index.d.ts.map +1 -1
  52. package/dist/npm/models/transactions/index.js.map +1 -1
  53. package/dist/npm/models/transactions/metadata.d.ts +0 -1
  54. package/dist/npm/models/transactions/metadata.d.ts.map +1 -1
  55. package/dist/npm/models/transactions/offerCreate.d.ts +2 -2
  56. package/dist/npm/models/transactions/offerCreate.d.ts.map +1 -1
  57. package/dist/npm/models/transactions/payment.d.ts +2 -2
  58. package/dist/npm/models/transactions/payment.d.ts.map +1 -1
  59. package/dist/npm/models/transactions/paymentChannelClaim.d.ts +2 -2
  60. package/dist/npm/models/transactions/paymentChannelClaim.d.ts.map +1 -1
  61. package/dist/npm/models/transactions/paymentChannelClaim.js.map +1 -1
  62. package/dist/npm/models/transactions/transaction.d.ts +1 -2
  63. package/dist/npm/models/transactions/transaction.d.ts.map +1 -1
  64. package/dist/npm/models/transactions/transaction.js +0 -7
  65. package/dist/npm/models/transactions/transaction.js.map +1 -1
  66. package/dist/npm/models/transactions/trustSet.d.ts +2 -2
  67. package/dist/npm/models/transactions/trustSet.d.ts.map +1 -1
  68. package/dist/npm/models/utils/flags.d.ts +0 -1
  69. package/dist/npm/models/utils/flags.d.ts.map +1 -1
  70. package/dist/npm/models/utils/flags.js +2 -22
  71. package/dist/npm/models/utils/flags.js.map +1 -1
  72. package/dist/npm/snippets/tsconfig.tsbuildinfo +1 -1
  73. package/dist/npm/src/Wallet/defaultFaucets.d.ts +1 -2
  74. package/dist/npm/src/Wallet/defaultFaucets.d.ts.map +1 -1
  75. package/dist/npm/src/Wallet/defaultFaucets.js +0 -5
  76. package/dist/npm/src/Wallet/defaultFaucets.js.map +1 -1
  77. package/dist/npm/src/Wallet/index.d.ts.map +1 -1
  78. package/dist/npm/src/Wallet/index.js +2 -8
  79. package/dist/npm/src/Wallet/index.js.map +1 -1
  80. package/dist/npm/src/client/RequestManager.d.ts.map +1 -1
  81. package/dist/npm/src/client/RequestManager.js +3 -3
  82. package/dist/npm/src/client/RequestManager.js.map +1 -1
  83. package/dist/npm/src/client/connection.d.ts.map +1 -1
  84. package/dist/npm/src/client/connection.js.map +1 -1
  85. package/dist/npm/src/client/index.d.ts.map +1 -1
  86. package/dist/npm/src/client/index.js +8 -5
  87. package/dist/npm/src/client/index.js.map +1 -1
  88. package/dist/npm/src/models/ledger/Credential.d.ts +2 -2
  89. package/dist/npm/src/models/ledger/Credential.d.ts.map +1 -1
  90. package/dist/npm/src/models/methods/baseMethod.d.ts +0 -1
  91. package/dist/npm/src/models/methods/baseMethod.d.ts.map +1 -1
  92. package/dist/npm/src/models/transactions/AMMClawback.d.ts +2 -2
  93. package/dist/npm/src/models/transactions/AMMClawback.d.ts.map +1 -1
  94. package/dist/npm/src/models/transactions/AMMDeposit.d.ts +2 -2
  95. package/dist/npm/src/models/transactions/AMMDeposit.d.ts.map +1 -1
  96. package/dist/npm/src/models/transactions/AMMWithdraw.d.ts +2 -2
  97. package/dist/npm/src/models/transactions/AMMWithdraw.d.ts.map +1 -1
  98. package/dist/npm/src/models/transactions/MPTokenAuthorize.d.ts +2 -2
  99. package/dist/npm/src/models/transactions/MPTokenAuthorize.d.ts.map +1 -1
  100. package/dist/npm/src/models/transactions/MPTokenIssuanceCreate.d.ts +2 -2
  101. package/dist/npm/src/models/transactions/MPTokenIssuanceCreate.d.ts.map +1 -1
  102. package/dist/npm/src/models/transactions/MPTokenIssuanceCreate.js.map +1 -1
  103. package/dist/npm/src/models/transactions/MPTokenIssuanceSet.d.ts +2 -2
  104. package/dist/npm/src/models/transactions/MPTokenIssuanceSet.d.ts.map +1 -1
  105. package/dist/npm/src/models/transactions/NFTokenCreateOffer.d.ts +2 -2
  106. package/dist/npm/src/models/transactions/NFTokenCreateOffer.d.ts.map +1 -1
  107. package/dist/npm/src/models/transactions/NFTokenMint.d.ts +2 -2
  108. package/dist/npm/src/models/transactions/NFTokenMint.d.ts.map +1 -1
  109. package/dist/npm/src/models/transactions/XChainModifyBridge.d.ts +2 -2
  110. package/dist/npm/src/models/transactions/XChainModifyBridge.d.ts.map +1 -1
  111. package/dist/npm/src/models/transactions/accountSet.d.ts +2 -2
  112. package/dist/npm/src/models/transactions/accountSet.d.ts.map +1 -1
  113. package/dist/npm/src/models/transactions/accountSet.js.map +1 -1
  114. package/dist/npm/src/models/transactions/common.d.ts +4 -16
  115. package/dist/npm/src/models/transactions/common.d.ts.map +1 -1
  116. package/dist/npm/src/models/transactions/common.js +10 -28
  117. package/dist/npm/src/models/transactions/common.js.map +1 -1
  118. package/dist/npm/src/models/transactions/index.d.ts +2 -3
  119. package/dist/npm/src/models/transactions/index.d.ts.map +1 -1
  120. package/dist/npm/src/models/transactions/index.js.map +1 -1
  121. package/dist/npm/src/models/transactions/metadata.d.ts +0 -1
  122. package/dist/npm/src/models/transactions/metadata.d.ts.map +1 -1
  123. package/dist/npm/src/models/transactions/offerCreate.d.ts +2 -2
  124. package/dist/npm/src/models/transactions/offerCreate.d.ts.map +1 -1
  125. package/dist/npm/src/models/transactions/payment.d.ts +2 -2
  126. package/dist/npm/src/models/transactions/payment.d.ts.map +1 -1
  127. package/dist/npm/src/models/transactions/paymentChannelClaim.d.ts +2 -2
  128. package/dist/npm/src/models/transactions/paymentChannelClaim.d.ts.map +1 -1
  129. package/dist/npm/src/models/transactions/paymentChannelClaim.js.map +1 -1
  130. package/dist/npm/src/models/transactions/transaction.d.ts +1 -2
  131. package/dist/npm/src/models/transactions/transaction.d.ts.map +1 -1
  132. package/dist/npm/src/models/transactions/transaction.js +0 -7
  133. package/dist/npm/src/models/transactions/transaction.js.map +1 -1
  134. package/dist/npm/src/models/transactions/trustSet.d.ts +2 -2
  135. package/dist/npm/src/models/transactions/trustSet.d.ts.map +1 -1
  136. package/dist/npm/src/models/utils/flags.d.ts +0 -1
  137. package/dist/npm/src/models/utils/flags.d.ts.map +1 -1
  138. package/dist/npm/src/models/utils/flags.js +2 -22
  139. package/dist/npm/src/models/utils/flags.js.map +1 -1
  140. package/dist/npm/src/sugar/autofill.d.ts +1 -3
  141. package/dist/npm/src/sugar/autofill.d.ts.map +1 -1
  142. package/dist/npm/src/sugar/autofill.js +5 -100
  143. package/dist/npm/src/sugar/autofill.js.map +1 -1
  144. package/dist/npm/src/sugar/submit.d.ts.map +1 -1
  145. package/dist/npm/src/sugar/submit.js.map +1 -1
  146. package/dist/npm/src/utils/hashes/hashLedger.d.ts.map +1 -1
  147. package/dist/npm/src/utils/hashes/hashLedger.js +1 -4
  148. package/dist/npm/src/utils/hashes/hashLedger.js.map +1 -1
  149. package/dist/npm/sugar/autofill.d.ts +1 -3
  150. package/dist/npm/sugar/autofill.d.ts.map +1 -1
  151. package/dist/npm/sugar/autofill.js +5 -100
  152. package/dist/npm/sugar/autofill.js.map +1 -1
  153. package/dist/npm/sugar/submit.d.ts.map +1 -1
  154. package/dist/npm/sugar/submit.js.map +1 -1
  155. package/dist/npm/utils/hashes/hashLedger.d.ts.map +1 -1
  156. package/dist/npm/utils/hashes/hashLedger.js +1 -4
  157. package/dist/npm/utils/hashes/hashLedger.js.map +1 -1
  158. package/package.json +4 -4
  159. package/src/Wallet/defaultFaucets.ts +0 -6
  160. package/src/Wallet/index.ts +3 -9
  161. package/src/client/RequestManager.ts +1 -4
  162. package/src/client/connection.ts +1 -0
  163. package/src/client/index.ts +28 -7
  164. package/src/models/ledger/Credential.ts +2 -2
  165. package/src/models/methods/baseMethod.ts +0 -1
  166. package/src/models/transactions/AMMClawback.ts +2 -2
  167. package/src/models/transactions/AMMDeposit.ts +2 -2
  168. package/src/models/transactions/AMMWithdraw.ts +2 -2
  169. package/src/models/transactions/MPTokenAuthorize.ts +2 -2
  170. package/src/models/transactions/MPTokenIssuanceCreate.ts +2 -3
  171. package/src/models/transactions/MPTokenIssuanceSet.ts +2 -2
  172. package/src/models/transactions/NFTokenCreateOffer.ts +2 -2
  173. package/src/models/transactions/NFTokenMint.ts +2 -2
  174. package/src/models/transactions/XChainModifyBridge.ts +2 -2
  175. package/src/models/transactions/accountSet.ts +1 -2
  176. package/src/models/transactions/common.ts +22 -62
  177. package/src/models/transactions/index.ts +3 -3
  178. package/src/models/transactions/metadata.ts +0 -2
  179. package/src/models/transactions/offerCreate.ts +2 -2
  180. package/src/models/transactions/payment.ts +2 -2
  181. package/src/models/transactions/paymentChannelClaim.ts +2 -3
  182. package/src/models/transactions/transaction.ts +0 -15
  183. package/src/models/transactions/trustSet.ts +2 -2
  184. package/src/models/utils/flags.ts +1 -30
  185. package/src/sugar/autofill.ts +11 -140
  186. package/src/sugar/submit.ts +2 -1
  187. package/src/utils/hashes/hashLedger.ts +2 -5
  188. package/dist/npm/Wallet/batchSigner.d.ts +0 -8
  189. package/dist/npm/Wallet/batchSigner.d.ts.map +0 -1
  190. package/dist/npm/Wallet/batchSigner.js +0 -124
  191. package/dist/npm/Wallet/batchSigner.js.map +0 -1
  192. package/dist/npm/models/transactions/batch.d.ts +0 -39
  193. package/dist/npm/models/transactions/batch.d.ts.map +0 -1
  194. package/dist/npm/models/transactions/batch.js +0 -62
  195. package/dist/npm/models/transactions/batch.js.map +0 -1
  196. package/dist/npm/src/Wallet/batchSigner.d.ts +0 -8
  197. package/dist/npm/src/Wallet/batchSigner.d.ts.map +0 -1
  198. package/dist/npm/src/Wallet/batchSigner.js +0 -124
  199. package/dist/npm/src/Wallet/batchSigner.js.map +0 -1
  200. package/dist/npm/src/models/transactions/batch.d.ts +0 -39
  201. package/dist/npm/src/models/transactions/batch.d.ts.map +0 -1
  202. package/dist/npm/src/models/transactions/batch.js +0 -62
  203. package/dist/npm/src/models/transactions/batch.js.map +0 -1
  204. package/src/Wallet/batchSigner.ts +0 -222
  205. package/src/models/transactions/batch.ts +0 -147
@@ -24,8 +24,6 @@ import {
24
24
  import ECDSA from '../ECDSA'
25
25
  import { ValidationError } from '../errors'
26
26
  import { Transaction, validate } from '../models/transactions'
27
- import { GlobalFlags } from '../models/transactions/common'
28
- import { hasFlag } from '../models/utils/flags'
29
27
  import { ensureClassicAddress } from '../sugar/utils'
30
28
  import { omitBy } from '../utils/collections'
31
29
  import { hashSignedTx } from '../utils/hashes/hashLedger'
@@ -369,7 +367,6 @@ export class Wallet {
369
367
  * @param this - Wallet instance.
370
368
  * @param transaction - A transaction to be signed offline.
371
369
  * @param multisign - Specify true/false to use multisign or actual address (classic/x-address) to make multisign tx request.
372
- * The actual address is only needed in the case of regular key usage.
373
370
  * @returns A signed transaction.
374
371
  * @throws ValidationError if the transaction is already signed or does not encode/decode to same result.
375
372
  * @throws XrplError if the issued currency being signed is XRP ignoring case.
@@ -384,7 +381,7 @@ export class Wallet {
384
381
  hash: string
385
382
  } {
386
383
  let multisignAddress: boolean | string = false
387
- if (typeof multisign === 'string') {
384
+ if (typeof multisign === 'string' && multisign.startsWith('X')) {
388
385
  multisignAddress = multisign
389
386
  } else if (multisign) {
390
387
  multisignAddress = this.classicAddress
@@ -410,14 +407,12 @@ export class Wallet {
410
407
  */
411
408
  // eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- validate does not accept Transaction type
412
409
  validate(tx as unknown as Record<string, unknown>)
413
- if (hasFlag(tx, GlobalFlags.tfInnerBatchTxn)) {
414
- throw new ValidationError('Cannot sign a Batch inner transaction.')
415
- }
416
410
 
417
411
  const txToSignAndEncode = { ...tx }
418
412
 
413
+ txToSignAndEncode.SigningPubKey = multisignAddress ? '' : this.publicKey
414
+
419
415
  if (multisignAddress) {
420
- txToSignAndEncode.SigningPubKey = ''
421
416
  const signer = {
422
417
  Account: multisignAddress,
423
418
  SigningPubKey: this.publicKey,
@@ -429,7 +424,6 @@ export class Wallet {
429
424
  }
430
425
  txToSignAndEncode.Signers = [{ Signer: signer }]
431
426
  } else {
432
- txToSignAndEncode.SigningPubKey = this.publicKey
433
427
  txToSignAndEncode.TxnSignature = computeSignature(
434
428
  txToSignAndEncode,
435
429
  this.privateKey,
@@ -175,7 +175,6 @@ export default class RequestManager {
175
175
  * @param response - The response to handle.
176
176
  * @throws ResponseFormatError if the response format is invalid, RippledError if rippled returns an error.
177
177
  */
178
- // eslint-disable-next-line complexity -- handling a response is complex
179
178
  public handleResponse(
180
179
  response: Partial<Response<APIVersion> | ErrorResponse>,
181
180
  ): void {
@@ -196,9 +195,7 @@ export default class RequestManager {
196
195
  // eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- We know this must be true
197
196
  const errorResponse = response as Partial<ErrorResponse>
198
197
  const error = new RippledError(
199
- errorResponse.error_message ??
200
- errorResponse.error_exception ??
201
- errorResponse.error,
198
+ errorResponse.error_message ?? errorResponse.error,
202
199
  errorResponse,
203
200
  )
204
201
  this.reject(response.id, error)
@@ -349,6 +349,7 @@ export class Connection extends EventEmitter {
349
349
  try {
350
350
  this.requestManager.handleResponse(data)
351
351
  } catch (error) {
352
+ // eslint-disable-next-line max-depth -- okay here
352
353
  if (error instanceof Error) {
353
354
  this.emit('error', 'badMessage', error.message, message)
354
355
  } else {
@@ -67,8 +67,6 @@ import {
67
67
  setLatestValidatedLedgerSequence,
68
68
  checkAccountDeleteBlockers,
69
69
  txNeedsNetworkID,
70
- autofillBatchTxn,
71
- handleDeliverMax,
72
70
  } from '../sugar/autofill'
73
71
  import { formatBalances } from '../sugar/balances'
74
72
  import {
@@ -664,6 +662,7 @@ class Client extends EventEmitter<EventTypes> {
664
662
  * @throws ValidationError If Amount and DeliverMax fields are not identical in a Payment Transaction
665
663
  */
666
664
 
665
+ // eslint-disable-next-line complexity -- handling Payment transaction API v2 requires more logic
667
666
  public async autofill<T extends SubmittableTransaction>(
668
667
  transaction: T,
669
668
  signersCount?: number,
@@ -689,11 +688,33 @@ class Client extends EventEmitter<EventTypes> {
689
688
  if (tx.TransactionType === 'AccountDelete') {
690
689
  promises.push(checkAccountDeleteBlockers(this, tx))
691
690
  }
692
- if (tx.TransactionType === 'Batch') {
693
- promises.push(autofillBatchTxn(this, tx))
694
- }
695
- if (tx.TransactionType === 'Payment') {
696
- handleDeliverMax(tx)
691
+
692
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- ignore type-assertions on the DeliverMax property
693
+ // @ts-expect-error -- DeliverMax property exists only at the RPC level, not at the protocol level
694
+ if (tx.TransactionType === 'Payment' && tx.DeliverMax != null) {
695
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- This is a valid null check for Amount
696
+ if (tx.Amount == null) {
697
+ // If only DeliverMax is provided, use it to populate the Amount field
698
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- ignore type-assertions on the DeliverMax property
699
+ // @ts-expect-error -- DeliverMax property exists only at the RPC level, not at the protocol level
700
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- DeliverMax is a known RPC-level property
701
+ tx.Amount = tx.DeliverMax
702
+ }
703
+
704
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- ignore type-assertions on the DeliverMax property
705
+ // @ts-expect-error -- DeliverMax property exists only at the RPC level, not at the protocol level
706
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- This is a valid null check for Amount
707
+ if (tx.Amount != null && tx.Amount !== tx.DeliverMax) {
708
+ return Promise.reject(
709
+ new ValidationError(
710
+ 'PaymentTransaction: Amount and DeliverMax fields must be identical when both are provided',
711
+ ),
712
+ )
713
+ }
714
+
715
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- ignore type-assertions on the DeliverMax property
716
+ // @ts-expect-error -- DeliverMax property exists only at the RPC level, not at the protocol level
717
+ delete tx.DeliverMax
697
718
  }
698
719
 
699
720
  return Promise.all(promises).then(() => tx)
@@ -1,8 +1,8 @@
1
- import { GlobalFlagsInterface } from '../transactions/common'
1
+ import { GlobalFlags } from '../transactions/common'
2
2
 
3
3
  import { BaseLedgerEntry, HasPreviousTxnID } from './BaseLedgerEntry'
4
4
 
5
- export interface CredentialFlags extends GlobalFlagsInterface {
5
+ export interface CredentialFlags extends GlobalFlags {
6
6
  lsfAccepted?: boolean
7
7
  }
8
8
 
@@ -53,7 +53,6 @@ export interface ErrorResponse {
53
53
  error: string
54
54
  error_code?: string
55
55
  error_message?: string
56
- error_exception?: string
57
56
  request: Request
58
57
  api_version?: number
59
58
  }
@@ -4,7 +4,7 @@ import { Currency, IssuedCurrency, IssuedCurrencyAmount } from '../common'
4
4
  import {
5
5
  Account,
6
6
  BaseTransaction,
7
- GlobalFlagsInterface,
7
+ GlobalFlags,
8
8
  isAccount,
9
9
  isAmount,
10
10
  isCurrency,
@@ -28,7 +28,7 @@ export enum AMMClawbackFlags {
28
28
  *
29
29
  * @category Transaction Flags
30
30
  */
31
- export interface AMMClawbackFlagsInterface extends GlobalFlagsInterface {
31
+ export interface AMMClawbackFlagsInterface extends GlobalFlags {
32
32
  tfClawTwoAssets?: boolean
33
33
  }
34
34
 
@@ -3,7 +3,7 @@ import { Amount, Currency, IssuedCurrencyAmount } from '../common'
3
3
 
4
4
  import {
5
5
  BaseTransaction,
6
- GlobalFlagsInterface,
6
+ GlobalFlags,
7
7
  isAmount,
8
8
  isCurrency,
9
9
  isIssuedCurrency,
@@ -24,7 +24,7 @@ export enum AMMDepositFlags {
24
24
  tfTwoAssetIfEmpty = 0x00800000,
25
25
  }
26
26
 
27
- export interface AMMDepositFlagsInterface extends GlobalFlagsInterface {
27
+ export interface AMMDepositFlagsInterface extends GlobalFlags {
28
28
  tfLPToken?: boolean
29
29
  tfSingleAsset?: boolean
30
30
  tfTwoAsset?: boolean
@@ -3,7 +3,7 @@ import { Amount, Currency, IssuedCurrencyAmount } from '../common'
3
3
 
4
4
  import {
5
5
  BaseTransaction,
6
- GlobalFlagsInterface,
6
+ GlobalFlags,
7
7
  isAmount,
8
8
  isCurrency,
9
9
  isIssuedCurrency,
@@ -25,7 +25,7 @@ export enum AMMWithdrawFlags {
25
25
  tfLimitLPToken = 0x00400000,
26
26
  }
27
27
 
28
- export interface AMMWithdrawFlagsInterface extends GlobalFlagsInterface {
28
+ export interface AMMWithdrawFlagsInterface extends GlobalFlags {
29
29
  tfLPToken?: boolean
30
30
  tfWithdrawAll?: boolean
31
31
  tfOneAssetWithdrawAll?: boolean
@@ -6,7 +6,7 @@ import {
6
6
  Account,
7
7
  validateOptionalField,
8
8
  isAccount,
9
- GlobalFlagsInterface,
9
+ GlobalFlags,
10
10
  } from './common'
11
11
 
12
12
  /**
@@ -32,7 +32,7 @@ export enum MPTokenAuthorizeFlags {
32
32
  *
33
33
  * @category Transaction Flags
34
34
  */
35
- export interface MPTokenAuthorizeFlagsInterface extends GlobalFlagsInterface {
35
+ export interface MPTokenAuthorizeFlagsInterface extends GlobalFlags {
36
36
  tfMPTUnauthorize?: boolean
37
37
  }
38
38
 
@@ -3,7 +3,7 @@ import { isHex, INTEGER_SANITY_CHECK, isFlagEnabled } from '../utils'
3
3
 
4
4
  import {
5
5
  BaseTransaction,
6
- GlobalFlagsInterface,
6
+ GlobalFlags,
7
7
  validateBaseTransaction,
8
8
  validateOptionalField,
9
9
  isString,
@@ -58,8 +58,7 @@ export enum MPTokenIssuanceCreateFlags {
58
58
  *
59
59
  * @category Transaction Flags
60
60
  */
61
- export interface MPTokenIssuanceCreateFlagsInterface
62
- extends GlobalFlagsInterface {
61
+ export interface MPTokenIssuanceCreateFlagsInterface extends GlobalFlags {
63
62
  tfMPTCanLock?: boolean
64
63
  tfMPTRequireAuth?: boolean
65
64
  tfMPTCanEscrow?: boolean
@@ -9,7 +9,7 @@ import {
9
9
  Account,
10
10
  validateOptionalField,
11
11
  isAccount,
12
- GlobalFlagsInterface,
12
+ GlobalFlags,
13
13
  } from './common'
14
14
 
15
15
  /**
@@ -34,7 +34,7 @@ export enum MPTokenIssuanceSetFlags {
34
34
  *
35
35
  * @category Transaction Flags
36
36
  */
37
- export interface MPTokenIssuanceSetFlagsInterface extends GlobalFlagsInterface {
37
+ export interface MPTokenIssuanceSetFlagsInterface extends GlobalFlags {
38
38
  tfMPTLock?: boolean
39
39
  tfMPTUnlock?: boolean
40
40
  }
@@ -4,7 +4,7 @@ import { isFlagEnabled } from '../utils'
4
4
 
5
5
  import {
6
6
  BaseTransaction,
7
- GlobalFlagsInterface,
7
+ GlobalFlags,
8
8
  validateBaseTransaction,
9
9
  isAmount,
10
10
  parseAmountValue,
@@ -33,7 +33,7 @@ export enum NFTokenCreateOfferFlags {
33
33
  *
34
34
  * @category Transaction Flags
35
35
  */
36
- export interface NFTokenCreateOfferFlagsInterface extends GlobalFlagsInterface {
36
+ export interface NFTokenCreateOfferFlagsInterface extends GlobalFlags {
37
37
  tfSellNFToken?: boolean
38
38
  }
39
39
 
@@ -4,7 +4,7 @@ import { isHex } from '../utils'
4
4
  import {
5
5
  Account,
6
6
  BaseTransaction,
7
- GlobalFlagsInterface,
7
+ GlobalFlags,
8
8
  isAccount,
9
9
  validateBaseTransaction,
10
10
  validateOptionalField,
@@ -50,7 +50,7 @@ export enum NFTokenMintFlags {
50
50
  *
51
51
  * @category Transaction Flags
52
52
  */
53
- export interface NFTokenMintFlagsInterface extends GlobalFlagsInterface {
53
+ export interface NFTokenMintFlagsInterface extends GlobalFlags {
54
54
  tfBurnable?: boolean
55
55
  tfOnlyXRP?: boolean
56
56
  tfTrustLine?: boolean
@@ -2,7 +2,7 @@ import { Amount, XChainBridge } from '../common'
2
2
 
3
3
  import {
4
4
  BaseTransaction,
5
- GlobalFlagsInterface,
5
+ GlobalFlags,
6
6
  isAmount,
7
7
  isXChainBridge,
8
8
  validateBaseTransaction,
@@ -26,7 +26,7 @@ export enum XChainModifyBridgeFlags {
26
26
  *
27
27
  * @category Transaction Flags
28
28
  */
29
- export interface XChainModifyBridgeFlagsInterface extends GlobalFlagsInterface {
29
+ export interface XChainModifyBridgeFlagsInterface extends GlobalFlags {
30
30
  /** Clears the MinAccountCreateAmount of the bridge. */
31
31
  tfClearAccountCreateAmount?: boolean
32
32
  }
@@ -3,7 +3,6 @@ import { ValidationError } from '../../errors'
3
3
  import {
4
4
  Account,
5
5
  BaseTransaction,
6
- GlobalFlagsInterface,
7
6
  isAccount,
8
7
  validateBaseTransaction,
9
8
  validateOptionalField,
@@ -113,7 +112,7 @@ export enum AccountSetTfFlags {
113
112
  * // }
114
113
  * ```
115
114
  */
116
- export interface AccountSetFlagsInterface extends GlobalFlagsInterface {
115
+ export interface AccountSetFlagsInterface {
117
116
  tfRequireDestTag?: boolean
118
117
  tfOptionalDestTag?: boolean
119
118
  tfRequireAuth?: boolean
@@ -210,57 +210,31 @@ export function isXChainBridge(input: unknown): input is XChainBridge {
210
210
  )
211
211
  }
212
212
 
213
- /**
214
- * Verify the form and type of an Object at runtime.
215
- *
216
- * @param input - The object to check the form and type of.
217
- * @returns Whether the Object is properly formed.
218
- */
219
- export function isObject(input: unknown): input is object {
220
- return typeof input === 'object'
221
- }
222
-
223
- /**
224
- * Verify the form and type of an Array at runtime.
225
- *
226
- * @param input - The object to check the form and type of.
227
- * @returns Whether the Array is properly formed.
228
- */
229
- export function isArray(input: unknown): boolean {
230
- return Array.isArray(input)
231
- }
232
-
233
213
  /* eslint-disable @typescript-eslint/restrict-template-expressions -- tx.TransactionType is checked before any calls */
234
214
 
235
215
  /**
236
216
  * Verify the form and type of a required type for a transaction at runtime.
237
217
  *
238
- * @param tx - The object input to check the form and type of.
239
- * @param param - The object parameter.
218
+ * @param tx - The transaction input to check the form and type of.
219
+ * @param paramName - The name of the transaction parameter.
240
220
  * @param checkValidity - The function to use to check the type.
241
- * @param errorOpts - Extra values to make the error message easier to understand.
242
- * @param errorOpts.txType - The transaction type throwing the error.
243
- * @param errorOpts.paramName - The name of the parameter in the transaction with the error.
244
221
  * @throws
245
222
  */
246
- // eslint-disable-next-line max-params -- helper function
247
223
  export function validateRequiredField(
248
224
  tx: Record<string, unknown>,
249
- param: string,
225
+ paramName: string,
250
226
  checkValidity: (inp: unknown) => boolean,
251
- errorOpts: {
252
- txType?: string
253
- paramName?: string
254
- } = {},
255
227
  ): void {
256
- const paramNameStr = errorOpts.paramName ?? param
257
- const txType = errorOpts.txType ?? tx.TransactionType
258
- if (tx[param] == null) {
259
- throw new ValidationError(`${txType}: missing field ${paramNameStr}`)
228
+ if (tx[paramName] == null) {
229
+ throw new ValidationError(
230
+ `${tx.TransactionType}: missing field ${paramName}`,
231
+ )
260
232
  }
261
233
 
262
- if (!checkValidity(tx[param])) {
263
- throw new ValidationError(`${txType}: invalid field ${paramNameStr}`)
234
+ if (!checkValidity(tx[paramName])) {
235
+ throw new ValidationError(
236
+ `${tx.TransactionType}: invalid field ${paramName}`,
237
+ )
264
238
  }
265
239
  }
266
240
 
@@ -268,39 +242,26 @@ export function validateRequiredField(
268
242
  * Verify the form and type of an optional type for a transaction at runtime.
269
243
  *
270
244
  * @param tx - The transaction input to check the form and type of.
271
- * @param param - The object parameter.
245
+ * @param paramName - The name of the transaction parameter.
272
246
  * @param checkValidity - The function to use to check the type.
273
- * @param errorOpts - Extra values to make the error message easier to understand.
274
- * @param errorOpts.txType - The transaction type throwing the error.
275
- * @param errorOpts.paramName - The name of the parameter in the transaction with the error.
276
247
  * @throws
277
248
  */
278
- // eslint-disable-next-line max-params -- helper function
279
249
  export function validateOptionalField(
280
250
  tx: Record<string, unknown>,
281
- param: string,
251
+ paramName: string,
282
252
  checkValidity: (inp: unknown) => boolean,
283
- errorOpts: {
284
- txType?: string
285
- paramName?: string
286
- } = {},
287
253
  ): void {
288
- const paramNameStr = errorOpts.paramName ?? param
289
- const txType = errorOpts.txType ?? tx.TransactionType
290
- if (tx[param] !== undefined && !checkValidity(tx[param])) {
291
- throw new ValidationError(`${txType}: invalid field ${paramNameStr}`)
254
+ if (tx[paramName] !== undefined && !checkValidity(tx[paramName])) {
255
+ throw new ValidationError(
256
+ `${tx.TransactionType}: invalid field ${paramName}`,
257
+ )
292
258
  }
293
259
  }
294
260
 
295
261
  /* eslint-enable @typescript-eslint/restrict-template-expressions -- checked before */
296
262
 
297
- export enum GlobalFlags {
298
- tfInnerBatchTxn = 0x40000000,
299
- }
300
-
301
- export interface GlobalFlagsInterface {
302
- tfInnerBatchTxn?: boolean
303
- }
263
+ // eslint-disable-next-line @typescript-eslint/no-empty-interface -- no global flags right now, so this is fine
264
+ export interface GlobalFlags {}
304
265
 
305
266
  /**
306
267
  * Every transaction has the same set of common fields.
@@ -333,7 +294,7 @@ export interface BaseTransaction {
333
294
  */
334
295
  AccountTxnID?: string
335
296
  /** Set of bit-flags for this transaction. */
336
- Flags?: number | GlobalFlagsInterface
297
+ Flags?: number | GlobalFlags
337
298
  /**
338
299
  * Highest ledger index this transaction can appear in. Specifying this field
339
300
  * places a strict upper limit on how long the transaction can wait to be
@@ -396,9 +357,7 @@ export function validateBaseTransaction(common: Record<string, unknown>): void {
396
357
  }
397
358
 
398
359
  if (!TRANSACTION_TYPES.includes(common.TransactionType)) {
399
- throw new ValidationError(
400
- `BaseTransaction: Unknown TransactionType ${common.TransactionType}`,
401
- )
360
+ throw new ValidationError('BaseTransaction: Unknown TransactionType')
402
361
  }
403
362
 
404
363
  validateRequiredField(common, 'Account', isString)
@@ -575,6 +534,7 @@ export function containsDuplicates(
575
534
  if (isAuthorizeCredentialArray(objectList)) {
576
535
  for (const item of objectList) {
577
536
  const key = `${item.Credential.Issuer}-${item.Credential.CredentialType}`
537
+ // eslint-disable-next-line max-depth -- necessary to check for type-guards
578
538
  if (seen.has(key)) {
579
539
  return true
580
540
  }
@@ -33,7 +33,6 @@ export {
33
33
  AMMWithdrawFlagsInterface,
34
34
  AMMWithdraw,
35
35
  } from './AMMWithdraw'
36
- export { Batch } from './batch'
37
36
  export { CheckCancel } from './checkCancel'
38
37
  export { CheckCash } from './checkCash'
39
38
  export { CheckCreate } from './checkCreate'
@@ -100,8 +99,6 @@ export { SignerListSet } from './signerListSet'
100
99
  export { TicketCreate } from './ticketCreate'
101
100
  export { TrustSetFlagsInterface, TrustSetFlags, TrustSet } from './trustSet'
102
101
  export { UNLModify } from './UNLModify'
103
- export { PermissionedDomainSet } from './permissionedDomainSet'
104
- export { PermissionedDomainDelete } from './permissionedDomainDelete'
105
102
  export { XChainAddAccountCreateAttestation } from './XChainAddAccountCreateAttestation'
106
103
  export { XChainAddClaimAttestation } from './XChainAddClaimAttestation'
107
104
  export { XChainClaim } from './XChainClaim'
@@ -114,3 +111,6 @@ export {
114
111
  XChainModifyBridgeFlags,
115
112
  XChainModifyBridgeFlagsInterface,
116
113
  } from './XChainModifyBridge'
114
+
115
+ export { PermissionedDomainSet } from './permissionedDomainSet'
116
+ export { PermissionedDomainDelete } from './permissionedDomainDelete'
@@ -88,8 +88,6 @@ export interface TransactionMetadataBase {
88
88
  delivered_amount?: Amount | MPTAmount | 'unavailable'
89
89
  TransactionIndex: number
90
90
  TransactionResult: string
91
-
92
- ParentBatchID?: string
93
91
  }
94
92
 
95
93
  export type TransactionMetadata<T extends BaseTransaction = Transaction> =
@@ -3,7 +3,7 @@ import { Amount } from '../common'
3
3
 
4
4
  import {
5
5
  BaseTransaction,
6
- GlobalFlagsInterface,
6
+ GlobalFlags,
7
7
  validateBaseTransaction,
8
8
  isAmount,
9
9
  } from './common'
@@ -78,7 +78,7 @@ export enum OfferCreateFlags {
78
78
  * // }
79
79
  * ```
80
80
  */
81
- export interface OfferCreateFlagsInterface extends GlobalFlagsInterface {
81
+ export interface OfferCreateFlagsInterface extends GlobalFlags {
82
82
  tfPassive?: boolean
83
83
  tfImmediateOrCancel?: boolean
84
84
  tfFillOrKill?: boolean
@@ -5,7 +5,7 @@ import { isFlagEnabled } from '../utils'
5
5
  import {
6
6
  BaseTransaction,
7
7
  isAmount,
8
- GlobalFlagsInterface,
8
+ GlobalFlags,
9
9
  validateBaseTransaction,
10
10
  isAccount,
11
11
  validateRequiredField,
@@ -84,7 +84,7 @@ export enum PaymentFlags {
84
84
  * // }
85
85
  * ```
86
86
  */
87
- export interface PaymentFlagsInterface extends GlobalFlagsInterface {
87
+ export interface PaymentFlagsInterface extends GlobalFlags {
88
88
  /**
89
89
  * Do not use the default path; only use paths included in the Paths field.
90
90
  * This is intended to force the transaction to take arbitrage opportunities.
@@ -2,7 +2,7 @@ import { ValidationError } from '../../errors'
2
2
 
3
3
  import {
4
4
  BaseTransaction,
5
- GlobalFlagsInterface,
5
+ GlobalFlags,
6
6
  validateBaseTransaction,
7
7
  validateCredentialsList,
8
8
  MAX_AUTHORIZED_CREDENTIALS,
@@ -73,8 +73,7 @@ export enum PaymentChannelClaimFlags {
73
73
  * // }
74
74
  * ```
75
75
  */
76
- export interface PaymentChannelClaimFlagsInterface
77
- extends GlobalFlagsInterface {
76
+ export interface PaymentChannelClaimFlagsInterface extends GlobalFlags {
78
77
  /**
79
78
  * Clear the channel's Expiration time. (Expiration is different from the
80
79
  * channel's immutable CancelAfter time.) Only the source address of the
@@ -15,7 +15,6 @@ import { AMMDelete, validateAMMDelete } from './AMMDelete'
15
15
  import { AMMDeposit, validateAMMDeposit } from './AMMDeposit'
16
16
  import { AMMVote, validateAMMVote } from './AMMVote'
17
17
  import { AMMWithdraw, validateAMMWithdraw } from './AMMWithdraw'
18
- import { Batch, validateBatch } from './batch'
19
18
  import { CheckCancel, validateCheckCancel } from './checkCancel'
20
19
  import { CheckCash, validateCheckCash } from './checkCash'
21
20
  import { CheckCreate, validateCheckCreate } from './checkCreate'
@@ -133,7 +132,6 @@ export type SubmittableTransaction =
133
132
  | AMMWithdraw
134
133
  | AccountDelete
135
134
  | AccountSet
136
- | Batch
137
135
  | CheckCancel
138
136
  | CheckCash
139
137
  | CheckCreate
@@ -309,19 +307,6 @@ export function validate(transaction: Record<string, unknown>): void {
309
307
  validateAccountSet(tx)
310
308
  break
311
309
 
312
- case 'Batch':
313
- validateBatch(tx)
314
- // This is done here to avoid issues with dependency cycles
315
-
316
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- okay here
317
- // @ts-expect-error -- already checked
318
- // eslint-disable-next-line @typescript-eslint/no-unsafe-call -- already checked above
319
- tx.RawTransactions.forEach((innerTx: Record<string, unknown>) => {
320
- // eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- already checked above
321
- validate(innerTx.RawTransaction as Record<string, unknown>)
322
- })
323
- break
324
-
325
310
  case 'CheckCancel':
326
311
  validateCheckCancel(tx)
327
312
  break
@@ -3,7 +3,7 @@ import { IssuedCurrencyAmount } from '../common'
3
3
 
4
4
  import {
5
5
  BaseTransaction,
6
- GlobalFlagsInterface,
6
+ GlobalFlags,
7
7
  isAmount,
8
8
  validateBaseTransaction,
9
9
  } from './common'
@@ -77,7 +77,7 @@ export enum TrustSetFlags {
77
77
  * // }
78
78
  * ```
79
79
  */
80
- export interface TrustSetFlagsInterface extends GlobalFlagsInterface {
80
+ export interface TrustSetFlagsInterface extends GlobalFlags {
81
81
  /**
82
82
  * Authorize the other party to hold currency issued by this account. (No
83
83
  * effect unless using the asfRequireAuth AccountSet flag.) Cannot be unset.