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:
Elliot Lee
2018-06-07 23:29:24 -07:00
committed by GitHub
parent 7c92adbf45
commit e07fa11923
13 changed files with 290 additions and 26 deletions

View File

@@ -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)