xrpl 4.4.1 → 4.4.2
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.
- package/build/xrpl-latest-min.js +1 -1
- package/build/xrpl-latest-min.js.map +1 -1
- package/build/xrpl-latest.js +11827 -9248
- package/build/xrpl-latest.js.map +1 -1
- package/dist/npm/Wallet/fundWallet.js +1 -1
- package/dist/npm/Wallet/fundWallet.js.map +1 -1
- package/dist/npm/Wallet/index.d.ts.map +1 -1
- package/dist/npm/Wallet/index.js.map +1 -1
- package/dist/npm/client/index.d.ts.map +1 -1
- package/dist/npm/client/index.js +4 -4
- package/dist/npm/client/index.js.map +1 -1
- package/dist/npm/client/partialPayment.d.ts.map +1 -1
- package/dist/npm/client/partialPayment.js.map +1 -1
- package/dist/npm/models/methods/index.d.ts.map +1 -1
- package/dist/npm/models/methods/subscribe.d.ts.map +1 -1
- package/dist/npm/models/transactions/MPTokenIssuanceCreate.js +1 -1
- package/dist/npm/models/transactions/MPTokenIssuanceCreate.js.map +1 -1
- package/dist/npm/models/transactions/MPTokenIssuanceSet.js +2 -2
- package/dist/npm/models/transactions/MPTokenIssuanceSet.js.map +1 -1
- package/dist/npm/models/transactions/NFTokenCreateOffer.js +1 -1
- package/dist/npm/models/transactions/NFTokenCreateOffer.js.map +1 -1
- package/dist/npm/models/transactions/batch.d.ts +1 -8
- package/dist/npm/models/transactions/batch.d.ts.map +1 -1
- package/dist/npm/models/transactions/batch.js +33 -10
- package/dist/npm/models/transactions/batch.js.map +1 -1
- package/dist/npm/models/transactions/common.d.ts +2 -0
- package/dist/npm/models/transactions/common.d.ts.map +1 -1
- package/dist/npm/models/transactions/common.js +10 -1
- package/dist/npm/models/transactions/common.js.map +1 -1
- package/dist/npm/models/transactions/delegateSet.js +2 -2
- package/dist/npm/models/transactions/delegateSet.js.map +1 -1
- package/dist/npm/models/transactions/metadata.d.ts.map +1 -1
- package/dist/npm/models/transactions/payment.js +1 -1
- package/dist/npm/models/transactions/payment.js.map +1 -1
- package/dist/npm/models/utils/flags.js +2 -1
- package/dist/npm/models/utils/flags.js.map +1 -1
- package/dist/npm/sugar/autofill.d.ts.map +1 -1
- package/dist/npm/sugar/autofill.js +33 -54
- package/dist/npm/sugar/autofill.js.map +1 -1
- package/dist/npm/sugar/getFeeXrp.d.ts.map +1 -1
- package/dist/npm/sugar/getFeeXrp.js +2 -4
- package/dist/npm/sugar/getFeeXrp.js.map +1 -1
- package/dist/npm/sugar/getOrderbook.js +2 -2
- package/dist/npm/sugar/getOrderbook.js.map +1 -1
- package/dist/npm/utils/getBalanceChanges.js +4 -4
- package/dist/npm/utils/getBalanceChanges.js.map +1 -1
- package/dist/npm/utils/hashes/SHAMap/LeafNode.d.ts.map +1 -1
- package/dist/npm/utils/hashes/SHAMap/LeafNode.js.map +1 -1
- package/package.json +3 -4
- package/src/Wallet/fundWallet.ts +1 -1
- package/src/Wallet/index.ts +1 -0
- package/src/client/index.ts +13 -14
- package/src/client/partialPayment.ts +2 -0
- package/src/models/methods/index.ts +1 -0
- package/src/models/methods/subscribe.ts +19 -19
- package/src/models/transactions/MPTokenIssuanceCreate.ts +1 -1
- package/src/models/transactions/MPTokenIssuanceSet.ts +2 -2
- package/src/models/transactions/NFTokenCreateOffer.ts +1 -1
- package/src/models/transactions/batch.ts +46 -29
- package/src/models/transactions/common.ts +22 -0
- package/src/models/transactions/delegateSet.ts +2 -2
- package/src/models/transactions/metadata.ts +10 -10
- package/src/models/transactions/payment.ts +1 -1
- package/src/models/utils/flags.ts +1 -1
- package/src/sugar/autofill.ts +17 -20
- package/src/sugar/getFeeXrp.ts +2 -4
- package/src/sugar/getOrderbook.ts +1 -1
- package/src/utils/getBalanceChanges.ts +1 -1
- package/src/utils/hashes/SHAMap/LeafNode.ts +1 -0
@@ -506,22 +506,22 @@ export type EventTypes =
|
|
506
506
|
export type OnEventToListenerMap<T extends EventTypes> = T extends 'connected'
|
507
507
|
? () => void
|
508
508
|
: T extends 'disconnected'
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
509
|
+
? (code: number) => void
|
510
|
+
: T extends 'ledgerClosed'
|
511
|
+
? (ledger: LedgerStream) => void
|
512
|
+
: T extends 'validationReceived'
|
513
|
+
? (validation: ValidationStream) => void
|
514
|
+
: T extends 'transaction'
|
515
|
+
? (transaction: TransactionStream) => void
|
516
|
+
: T extends 'peerStatusChange'
|
517
|
+
? (peerStatus: PeerStatusStream) => void
|
518
|
+
: T extends 'consensusPhase'
|
519
|
+
? (consensus: ConsensusStream) => void
|
520
|
+
: T extends 'manifestReceived'
|
521
|
+
? (manifest: ManifestRequest) => void
|
522
|
+
: T extends 'path_find'
|
523
|
+
? (path: PathFindStream) => void
|
524
|
+
: T extends 'error'
|
525
|
+
? // eslint-disable-next-line @typescript-eslint/no-explicit-any -- needs to be any for overload
|
526
|
+
(...err: any[]) => void
|
527
|
+
: (...args: never[]) => void
|
@@ -173,7 +173,7 @@ export function validateMPTokenIssuanceCreate(
|
|
173
173
|
const isTfMPTCanTransfer =
|
174
174
|
typeof flags === 'number'
|
175
175
|
? isFlagEnabled(flags, MPTokenIssuanceCreateFlags.tfMPTCanTransfer)
|
176
|
-
: flags.tfMPTCanTransfer ?? false
|
176
|
+
: (flags.tfMPTCanTransfer ?? false)
|
177
177
|
|
178
178
|
if (tx.TransferFee < 0 || tx.TransferFee > MAX_TRANSFER_FEE) {
|
179
179
|
throw new ValidationError(
|
@@ -73,12 +73,12 @@ export function validateMPTokenIssuanceSet(tx: Record<string, unknown>): void {
|
|
73
73
|
const isTfMPTLock =
|
74
74
|
typeof flags === 'number'
|
75
75
|
? isFlagEnabled(flags, MPTokenIssuanceSetFlags.tfMPTLock)
|
76
|
-
: flags.tfMPTLock ?? false
|
76
|
+
: (flags.tfMPTLock ?? false)
|
77
77
|
|
78
78
|
const isTfMPTUnlock =
|
79
79
|
typeof flags === 'number'
|
80
80
|
? isFlagEnabled(flags, MPTokenIssuanceSetFlags.tfMPTUnlock)
|
81
|
-
: flags.tfMPTUnlock ?? false
|
81
|
+
: (flags.tfMPTUnlock ?? false)
|
82
82
|
|
83
83
|
if (isTfMPTLock && isTfMPTUnlock) {
|
84
84
|
throw new ValidationError('MPTokenIssuanceSet: flag conflict')
|
@@ -151,7 +151,7 @@ export function validateNFTokenCreateOffer(tx: Record<string, unknown>): void {
|
|
151
151
|
const isTfSellNFToken =
|
152
152
|
typeof flags === 'number'
|
153
153
|
? isFlagEnabled(flags, NFTokenCreateOfferFlags.tfSellNFToken)
|
154
|
-
: flags.tfSellNFToken ?? false
|
154
|
+
: (flags.tfSellNFToken ?? false)
|
155
155
|
|
156
156
|
if (isTfSellNFToken) {
|
157
157
|
validateNFTokenSellOfferCases(tx)
|
@@ -7,8 +7,10 @@ import {
|
|
7
7
|
GlobalFlags,
|
8
8
|
GlobalFlagsInterface,
|
9
9
|
isArray,
|
10
|
+
isNull,
|
10
11
|
isRecord,
|
11
12
|
isString,
|
13
|
+
isValue,
|
12
14
|
validateBaseTransaction,
|
13
15
|
validateOptionalField,
|
14
16
|
validateRequiredField,
|
@@ -40,18 +42,6 @@ export interface BatchFlagsInterface extends GlobalFlagsInterface {
|
|
40
42
|
tfIndependent?: boolean
|
41
43
|
}
|
42
44
|
|
43
|
-
export type BatchInnerTransaction = SubmittableTransaction & {
|
44
|
-
Fee?: '0'
|
45
|
-
|
46
|
-
SigningPubKey?: ''
|
47
|
-
|
48
|
-
TxnSignature?: never
|
49
|
-
|
50
|
-
Signers?: never
|
51
|
-
|
52
|
-
LastLedgerSequence?: never
|
53
|
-
}
|
54
|
-
|
55
45
|
export interface BatchSigner {
|
56
46
|
BatchSigner: {
|
57
47
|
Account: string
|
@@ -73,10 +63,48 @@ export interface Batch extends BaseTransaction {
|
|
73
63
|
BatchSigners?: BatchSigner[]
|
74
64
|
|
75
65
|
RawTransactions: Array<{
|
76
|
-
RawTransaction:
|
66
|
+
RawTransaction: SubmittableTransaction
|
77
67
|
}>
|
78
68
|
}
|
79
69
|
|
70
|
+
function validateBatchInnerTransaction(
|
71
|
+
tx: Record<string, unknown>,
|
72
|
+
index: number,
|
73
|
+
): void {
|
74
|
+
if (tx.TransactionType === 'Batch') {
|
75
|
+
throw new ValidationError(
|
76
|
+
`Batch: RawTransactions[${index}] is a Batch transaction. Cannot nest Batch transactions.`,
|
77
|
+
)
|
78
|
+
}
|
79
|
+
|
80
|
+
// Check for the `tfInnerBatchTxn` flag in the inner transactions
|
81
|
+
if (!hasFlag(tx, GlobalFlags.tfInnerBatchTxn, 'tfInnerBatchTxn')) {
|
82
|
+
throw new ValidationError(
|
83
|
+
`Batch: RawTransactions[${index}] must contain the \`tfInnerBatchTxn\` flag.`,
|
84
|
+
)
|
85
|
+
}
|
86
|
+
validateOptionalField(tx, 'Fee', isValue('0'), {
|
87
|
+
paramName: `RawTransactions[${index}].RawTransaction.Fee`,
|
88
|
+
txType: 'Batch',
|
89
|
+
})
|
90
|
+
validateOptionalField(tx, 'SigningPubKey', isValue(''), {
|
91
|
+
paramName: `RawTransactions[${index}].RawTransaction.SigningPubKey`,
|
92
|
+
txType: 'Batch',
|
93
|
+
})
|
94
|
+
validateOptionalField(tx, 'TxnSignature', isNull, {
|
95
|
+
paramName: `RawTransactions[${index}].RawTransaction.TxnSignature`,
|
96
|
+
txType: 'Batch',
|
97
|
+
})
|
98
|
+
validateOptionalField(tx, 'Signers', isNull, {
|
99
|
+
paramName: `RawTransactions[${index}].RawTransaction.Signers`,
|
100
|
+
txType: 'Batch',
|
101
|
+
})
|
102
|
+
validateOptionalField(tx, 'LastLedgerSequence', isNull, {
|
103
|
+
paramName: `RawTransactions[${index}].RawTransaction.LastLedgerSequence`,
|
104
|
+
txType: 'Batch',
|
105
|
+
})
|
106
|
+
}
|
107
|
+
|
80
108
|
/**
|
81
109
|
* Verify the form and type of a Batch at runtime.
|
82
110
|
*
|
@@ -101,18 +129,7 @@ export function validateBatch(tx: Record<string, unknown>): void {
|
|
101
129
|
})
|
102
130
|
|
103
131
|
const rawTx = rawTxObj.RawTransaction
|
104
|
-
|
105
|
-
throw new ValidationError(
|
106
|
-
`Batch: RawTransactions[${index}] is a Batch transaction. Cannot nest Batch transactions.`,
|
107
|
-
)
|
108
|
-
}
|
109
|
-
|
110
|
-
// Check for the `tfInnerBatchTxn` flag in the inner transactions
|
111
|
-
if (!hasFlag(rawTx, GlobalFlags.tfInnerBatchTxn, 'tfInnerBatchTxn')) {
|
112
|
-
throw new ValidationError(
|
113
|
-
`Batch: RawTransactions[${index}] must contain the \`tfInnerBatchTxn\` flag.`,
|
114
|
-
)
|
115
|
-
}
|
132
|
+
validateBatchInnerTransaction(rawTx, index)
|
116
133
|
|
117
134
|
// Full validation of each `RawTransaction` object is done in `validate` to avoid dependency cycles
|
118
135
|
})
|
@@ -132,19 +149,19 @@ export function validateBatch(tx: Record<string, unknown>): void {
|
|
132
149
|
|
133
150
|
const signer = signerRecord.BatchSigner
|
134
151
|
validateRequiredField(signer, 'Account', isString, {
|
135
|
-
paramName: `BatchSigners[${index}].Account`,
|
152
|
+
paramName: `BatchSigners[${index}].BatchSigner.Account`,
|
136
153
|
txType: 'Batch',
|
137
154
|
})
|
138
155
|
validateOptionalField(signer, 'SigningPubKey', isString, {
|
139
|
-
paramName: `BatchSigners[${index}].SigningPubKey`,
|
156
|
+
paramName: `BatchSigners[${index}].BatchSigner.SigningPubKey`,
|
140
157
|
txType: 'Batch',
|
141
158
|
})
|
142
159
|
validateOptionalField(signer, 'TxnSignature', isString, {
|
143
|
-
paramName: `BatchSigners[${index}].TxnSignature`,
|
160
|
+
paramName: `BatchSigners[${index}].BatchSigner.TxnSignature`,
|
144
161
|
txType: 'Batch',
|
145
162
|
})
|
146
163
|
validateOptionalField(signer, 'Signers', isArray, {
|
147
|
-
paramName: `BatchSigners[${index}].Signers`,
|
164
|
+
paramName: `BatchSigners[${index}].BatchSigner.Signers`,
|
148
165
|
txType: 'Batch',
|
149
166
|
})
|
150
167
|
})
|
@@ -152,6 +152,28 @@ export function isNumber(num: unknown): num is number {
|
|
152
152
|
return typeof num === 'number'
|
153
153
|
}
|
154
154
|
|
155
|
+
/**
|
156
|
+
* Verify the form and type of a null value at runtime.
|
157
|
+
*
|
158
|
+
* @param inp - The value to check the form and type of.
|
159
|
+
* @returns Whether the value is properly formed.
|
160
|
+
*/
|
161
|
+
export function isNull(inp: unknown): inp is null {
|
162
|
+
return inp == null
|
163
|
+
}
|
164
|
+
|
165
|
+
/**
|
166
|
+
* Verify that a certain field has a certain exact value at runtime.
|
167
|
+
*
|
168
|
+
* @param value The value to compare against.
|
169
|
+
* @returns Whether the number is properly formed and within the bounds.
|
170
|
+
*/
|
171
|
+
export function isValue<V>(value: V): (inp: unknown) => inp is V {
|
172
|
+
// eslint-disable-next-line func-style -- returning a function
|
173
|
+
const isValueInternal = (inp: unknown): inp is V => inp === value
|
174
|
+
return isValueInternal
|
175
|
+
}
|
176
|
+
|
155
177
|
/**
|
156
178
|
* Checks whether the given value is a valid XRPL number string.
|
157
179
|
* Accepts integer, decimal, or scientific notation strings.
|
@@ -9,7 +9,7 @@ import {
|
|
9
9
|
} from './common'
|
10
10
|
|
11
11
|
const PERMISSIONS_MAX_LENGTH = 10
|
12
|
-
const
|
12
|
+
const NON_DELEGABLE_TRANSACTIONS = new Set([
|
13
13
|
'AccountSet',
|
14
14
|
'SetRegularKey',
|
15
15
|
'SignerListSet',
|
@@ -97,7 +97,7 @@ export function validateDelegateSet(tx: Record<string, unknown>): void {
|
|
97
97
|
if (typeof permissionValue !== 'string') {
|
98
98
|
throw new ValidationError('DelegateSet: PermissionValue must be a string')
|
99
99
|
}
|
100
|
-
if (
|
100
|
+
if (NON_DELEGABLE_TRANSACTIONS.has(permissionValue)) {
|
101
101
|
throw new ValidationError(
|
102
102
|
`DelegateSet: PermissionValue contains a non-delegatable transaction ${permissionValue}`,
|
103
103
|
)
|
@@ -96,13 +96,13 @@ export type TransactionMetadata<T extends BaseTransaction = Transaction> =
|
|
96
96
|
T extends Payment
|
97
97
|
? PaymentMetadata
|
98
98
|
: T extends NFTokenMint
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
99
|
+
? NFTokenMintMetadata
|
100
|
+
: T extends NFTokenCreateOffer
|
101
|
+
? NFTokenCreateOfferMetadata
|
102
|
+
: T extends NFTokenAcceptOffer
|
103
|
+
? NFTokenAcceptOfferMetadata
|
104
|
+
: T extends NFTokenCancelOffer
|
105
|
+
? NFTokenCancelOfferMetadata
|
106
|
+
: T extends MPTokenIssuanceCreate
|
107
|
+
? MPTokenIssuanceCreateMetadata
|
108
|
+
: TransactionMetadataBase
|
@@ -241,7 +241,7 @@ function checkPartialPayment(tx: Record<string, unknown>): void {
|
|
241
241
|
const isTfPartialPayment =
|
242
242
|
typeof flags === 'number'
|
243
243
|
? isFlagEnabled(flags, PaymentFlags.tfPartialPayment)
|
244
|
-
: flags.tfPartialPayment ?? false
|
244
|
+
: (flags.tfPartialPayment ?? false)
|
245
245
|
|
246
246
|
if (!isTfPartialPayment) {
|
247
247
|
throw new ValidationError(
|
package/src/sugar/autofill.ts
CHANGED
@@ -266,7 +266,7 @@ async function fetchOwnerReserveFee(client: Client): Promise<BigNumber> {
|
|
266
266
|
* @param [signersCount=0] - The number of signers (default is 0). Only used for multisigning.
|
267
267
|
* @returns A promise that returns the fee.
|
268
268
|
*/
|
269
|
-
|
269
|
+
// eslint-disable-next-line max-lines-per-function -- necessary to check for many transaction types.
|
270
270
|
async function calculateFeePerTransactionType(
|
271
271
|
client: Client,
|
272
272
|
tx: Transaction,
|
@@ -291,14 +291,17 @@ async function calculateFeePerTransactionType(
|
|
291
291
|
} else if (isSpecialTxCost) {
|
292
292
|
baseFee = await fetchOwnerReserveFee(client)
|
293
293
|
} else if (tx.TransactionType === 'Batch') {
|
294
|
-
const rawTxFees = await tx.RawTransactions.reduce(
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
294
|
+
const rawTxFees = await tx.RawTransactions.reduce(
|
295
|
+
async (acc, rawTxn) => {
|
296
|
+
const resolvedAcc = await acc
|
297
|
+
const fee = await calculateFeePerTransactionType(
|
298
|
+
client,
|
299
|
+
rawTxn.RawTransaction,
|
300
|
+
)
|
301
|
+
return BigNumber.sum(resolvedAcc, fee)
|
302
|
+
},
|
303
|
+
Promise.resolve(new BigNumber(0)),
|
304
|
+
)
|
302
305
|
baseFee = BigNumber.sum(baseFee.times(2), rawTxFees)
|
303
306
|
}
|
304
307
|
|
@@ -403,12 +406,9 @@ export async function checkAccountDeleteBlockers(
|
|
403
406
|
*/
|
404
407
|
export function handleDeliverMax(tx: Payment): void {
|
405
408
|
if (tx.DeliverMax != null) {
|
406
|
-
//
|
407
|
-
|
408
|
-
|
409
|
-
// eslint-disable-next-line no-param-reassign -- known RPC-level property
|
410
|
-
tx.Amount = tx.DeliverMax
|
411
|
-
}
|
409
|
+
// If only DeliverMax is provided, use it to populate the Amount field
|
410
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, no-param-reassign -- needed here
|
411
|
+
tx.Amount ??= tx.DeliverMax
|
412
412
|
|
413
413
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- needed here
|
414
414
|
if (tx.Amount != null && tx.Amount !== tx.DeliverMax) {
|
@@ -436,7 +436,7 @@ export async function autofillBatchTxn(
|
|
436
436
|
): Promise<void> {
|
437
437
|
const accountSequences: Record<string, number> = {}
|
438
438
|
|
439
|
-
for
|
439
|
+
for (const rawTxn of tx.RawTransactions) {
|
440
440
|
const txn = rawTxn.RawTransaction
|
441
441
|
|
442
442
|
// Sequence processing
|
@@ -445,6 +445,7 @@ export async function autofillBatchTxn(
|
|
445
445
|
txn.Sequence = accountSequences[txn.Account]
|
446
446
|
accountSequences[txn.Account] += 1
|
447
447
|
} else {
|
448
|
+
// eslint-disable-next-line no-await-in-loop -- It has to wait
|
448
449
|
const nextSequence = await getNextValidSequenceNumber(
|
449
450
|
client,
|
450
451
|
txn.Account,
|
@@ -458,28 +459,24 @@ export async function autofillBatchTxn(
|
|
458
459
|
|
459
460
|
if (txn.Fee == null) {
|
460
461
|
txn.Fee = '0'
|
461
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- needed for JS checks
|
462
462
|
} else if (txn.Fee !== '0') {
|
463
463
|
throw new XrplError('Must have `Fee of "0" in inner Batch transaction.')
|
464
464
|
}
|
465
465
|
|
466
466
|
if (txn.SigningPubKey == null) {
|
467
467
|
txn.SigningPubKey = ''
|
468
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- needed for JS checks
|
469
468
|
} else if (txn.SigningPubKey !== '') {
|
470
469
|
throw new XrplError(
|
471
470
|
'Must have `SigningPubKey` of "" in inner Batch transaction.',
|
472
471
|
)
|
473
472
|
}
|
474
473
|
|
475
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- needed for JS checks
|
476
474
|
if (txn.TxnSignature != null) {
|
477
475
|
throw new XrplError(
|
478
476
|
'Must not have `TxnSignature` in inner Batch transaction.',
|
479
477
|
)
|
480
478
|
}
|
481
479
|
|
482
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- needed for JS checks
|
483
480
|
if (txn.Signers != null) {
|
484
481
|
throw new XrplError('Must not have `Signers` in inner Batch transaction.')
|
485
482
|
}
|
package/src/sugar/getFeeXrp.ts
CHANGED
@@ -35,10 +35,8 @@ export default async function getFeeXrp(
|
|
35
35
|
}
|
36
36
|
|
37
37
|
const baseFeeXrp = new BigNumber(baseFee)
|
38
|
-
|
39
|
-
|
40
|
-
serverInfo.load_factor = 1
|
41
|
-
}
|
38
|
+
// https://github.com/ripple/rippled/issues/3812#issuecomment-816871100
|
39
|
+
serverInfo.load_factor ??= 1
|
42
40
|
let fee = baseFeeXrp.times(serverInfo.load_factor).times(feeCushion)
|
43
41
|
|
44
42
|
// Cap fee to `client.maxFeeXRP`
|
@@ -127,7 +127,7 @@ export function createBookOffersRequest(
|
|
127
127
|
ledger_index: options.ledger_index ?? 'validated',
|
128
128
|
ledger_hash: options.ledger_hash === null ? undefined : options.ledger_hash,
|
129
129
|
limit: options.limit ?? DEFAULT_LIMIT,
|
130
|
-
taker: options.taker
|
130
|
+
taker: options.taker ?? undefined,
|
131
131
|
}
|
132
132
|
|
133
133
|
return request
|
@@ -134,7 +134,7 @@ function getTrustlineQuantity(node: NormalizedNode): BalanceChange[] | null {
|
|
134
134
|
* If an offer is placed to acquire an asset with no existing trustline,
|
135
135
|
* the trustline can be created when the offer is taken.
|
136
136
|
*/
|
137
|
-
const fields = node.NewFields
|
137
|
+
const fields = node.NewFields ?? node.FinalFields
|
138
138
|
|
139
139
|
// the balance is always from low node's perspective
|
140
140
|
const result = {
|
@@ -35,6 +35,7 @@ class LeafNode extends Node {
|
|
35
35
|
* @throws If node is of unknown type.
|
36
36
|
*/
|
37
37
|
public get hash(): string {
|
38
|
+
// eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check -- TODO: https://github.com/XRPLF/xrpl.js/issues/3060
|
38
39
|
switch (this.type) {
|
39
40
|
case NodeType.ACCOUNT_STATE: {
|
40
41
|
const leafPrefix = HashPrefix.LEAF_NODE.toString(HEX)
|