55
55
- [ submit] ( #submit )
56
56
- [ generateAddress] ( #generateaddress )
57
57
- [ computeLedgerHash] ( #computeledgerhash )
58
+ - [ API Events] ( #api-events )
59
+ - [ ledgerClosed] ( #ledgerclosed )
60
+ - [ error] ( #error )
58
61
59
62
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
60
63
@@ -211,7 +214,7 @@ A *transaction specification* specifies what a transaction should do. Each [Tran
211
214
212
215
## Payment
213
216
214
- See [ Transcation Types] ( #transaction-types ) for a description.
217
+ See [ Transaction Types] ( #transaction-types ) for a description.
215
218
216
219
Name | Type | Description
217
220
---- | ---- | -----------
@@ -264,7 +267,7 @@ paths | string | *Optional* The paths of trustlines and orders to use in executi
264
267
265
268
## Trustline
266
269
267
- See [ Transcation Types] ( #transaction-types ) for a description.
270
+ See [ Transaction Types] ( #transaction-types ) for a description.
268
271
269
272
Name | Type | Description
270
273
---- | ---- | -----------
@@ -295,7 +298,7 @@ ripplingDisabled | boolean | *Optional* If true, payments cannot ripple through
295
298
296
299
## Order
297
300
298
- See [ Transcation Types] ( #transaction-types ) for a description.
301
+ See [ Transaction Types] ( #transaction-types ) for a description.
299
302
300
303
Name | Type | Description
301
304
---- | ---- | -----------
@@ -329,7 +332,7 @@ passive | boolean | *Optional* If enabled, the offer will not consume offers tha
329
332
330
333
## Order Cancellation
331
334
332
- See [ Transcation Types] ( #transaction-types ) for a description.
335
+ See [ Transaction Types] ( #transaction-types ) for a description.
333
336
334
337
Name | Type | Description
335
338
---- | ---- | -----------
@@ -345,7 +348,7 @@ orderSequence | [sequence](#account-sequence-number) | The [account sequence num
345
348
346
349
## Settings
347
350
348
- See [ Transcation Types] ( #transaction-types ) for a description.
351
+ See [ Transaction Types] ( #transaction-types ) for a description.
349
352
350
353
Name | Type | Description
351
354
---- | ---- | -----------
@@ -376,7 +379,7 @@ transferRate | number,null | *Optional* The fee to charge when users transfer t
376
379
377
380
## Suspended Payment Creation
378
381
379
- See [ Transcation Types] ( #transaction-types ) for a description.
382
+ See [ Transaction Types] ( #transaction-types ) for a description.
380
383
381
384
Name | Type | Description
382
385
---- | ---- | -----------
@@ -425,7 +428,7 @@ memos[] | object | Memo objects represent arbitrary data that can be included in
425
428
426
429
## Suspended Payment Cancellation
427
430
428
- See [ Transcation Types] ( #transaction-types ) for a description.
431
+ See [ Transaction Types] ( #transaction-types ) for a description.
429
432
430
433
Name | Type | Description
431
434
---- | ---- | -----------
@@ -450,7 +453,7 @@ memos[] | object | Memo objects represent arbitrary data that can be included in
450
453
451
454
## Suspended Payment Execution
452
455
453
- See [ Transcation Types] ( #transaction-types ) for a description.
456
+ See [ Transaction Types] ( #transaction-types ) for a description.
454
457
455
458
Name | Type | Description
456
459
---- | ---- | -----------
@@ -3306,3 +3309,67 @@ return api.computeLedgerHash(ledger);
3306
3309
" F4D865D83EB88C1A1911B9E90641919A1314F36E1B099F8E95FE3B7C77BE3349"
3307
3310
```
3308
3311
3312
+ # API Events
3313
+
3314
+ ## ledgerClosed
3315
+
3316
+ This event is emitted whenever a new ledger version is validated on the connected server.
3317
+
3318
+ ### Return Value
3319
+
3320
+ Name | Type | Description
3321
+ ---- | ---- | -----------
3322
+ feeBase | integer | Base fee, in drops.
3323
+ feeReference | integer | Cost of the 'reference transaction' in 'fee units'.
3324
+ ledgerHash | string | Unique hash of the ledger that was closed, as hex.
3325
+ ledgerTimestamp | date-time string | The time at which this ledger closed.
3326
+ reserveBase | integer | The minimum reserve, in drops of XRP, that is required for an account.
3327
+ reserveIncrement | integer | The increase in account reserve that is added for each item the account owns, such as offers or trust lines.
3328
+ transactionCount | integer | Number of new transactions included in this ledger.
3329
+ ledgerVersion | integer | Ledger version of the ledger that closed.
3330
+ validatedLedgerVersions | string | Range of ledgers that the server has available. This may be discontiguous.
3331
+
3332
+ ### Example
3333
+
3334
+ ``` javascript
3335
+ api .on (' ledgerClosed' , ledger => {
3336
+ console .log (JSON .stringify (ledger, null , 2 ));
3337
+ });
3338
+ ```
3339
+
3340
+
3341
+ ``` json
3342
+ {
3343
+ "feeBase" : 10 ,
3344
+ "feeReference" : 10 ,
3345
+ "ledgerVersion" : 14804627 ,
3346
+ "ledgerHash" : " 9141FA171F2C0CE63E609466AF728FF66C12F7ACD4B4B50B0947A7F3409D593A" ,
3347
+ "ledgerTimestamp" : " 2015-07-23T05:50:40.000Z" ,
3348
+ "reserveBase" : 20000000 ,
3349
+ "reserveIncrement" : 5000000 ,
3350
+ "transactionCount" : 19 ,
3351
+ "validatedLedgerVersions" : " 13983423-14804627"
3352
+ }
3353
+ ```
3354
+
3355
+
3356
+ ## error
3357
+
3358
+ This event is emitted when there is an error on the connection to the server.
3359
+
3360
+ ### Return Value
3361
+
3362
+ The first parameter is a string indicating the error type, which may be ` badMessage ` (meaning that rippled returned a malformed message), or one of the [ rippled Universal Errors] ( https://ripple.com/build/rippled-apis/#universal-errors ) . The second parameter is a message explaining the error, or the message that caused the error in the case of ` badMessage ` .
3363
+
3364
+ ### Example
3365
+
3366
+ ``` javascript
3367
+ api .on (' error' , (errorCode , errorMessage ) => {
3368
+ console .log (errorCode + ' : ' + errorMessage);
3369
+ });
3370
+ ```
3371
+
3372
+ ```
3373
+ tooBusy: The server is too busy to help you now.
3374
+ ```
3375
+
0 commit comments