mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-23 21:55:48 +00:00
Maximum fee values (#902)
* Add maxFeeXRP (default 2 XRP) as an optional RippleAPI constructor parameter - No calculated or specified fee can exceed this value - If the fee exceeds 2 XRP, throw a ValidationError * sign() - throw ValidationError when Fee exceeds maxFeeXRP * Document getFee parameters * Explain new fee limits in HISTORY.md * Deprecate `maxFee`
This commit is contained in:
@@ -64,6 +64,7 @@ import {clamp} from './ledger/utils'
|
||||
export type APIOptions = {
|
||||
server?: string,
|
||||
feeCushion?: number,
|
||||
maxFeeXRP?: string,
|
||||
trace?: boolean,
|
||||
proxy?: string,
|
||||
timeout?: number
|
||||
@@ -88,6 +89,7 @@ function getCollectKeyFromCommand(command: string): string|undefined {
|
||||
|
||||
class RippleAPI extends EventEmitter {
|
||||
_feeCushion: number
|
||||
_maxFeeXRP: string
|
||||
|
||||
// New in > 0.21.0
|
||||
// non-validated ledger versions are allowed, and passed to rippled as-is.
|
||||
@@ -105,6 +107,7 @@ class RippleAPI extends EventEmitter {
|
||||
super()
|
||||
validate.apiOptions(options)
|
||||
this._feeCushion = options.feeCushion || 1.2
|
||||
this._maxFeeXRP = options.maxFeeXRP || '2'
|
||||
const serverURL = options.server
|
||||
if (serverURL !== undefined) {
|
||||
this.connection = new Connection(serverURL, options)
|
||||
|
||||
Reference in New Issue
Block a user