mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-20 12:15:51 +00:00
Convert from Flow to Typescript (#816)
* convert to typescript * add docs for custom node typing * update webpack, gulpfile
This commit is contained in:
committed by
Elliot Lee
parent
5979ff6197
commit
8204f6c648
28
src/ledger/ledger.ts
Normal file
28
src/ledger/ledger.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import {validate} from '../common'
|
||||
import parseLedger from './parse/ledger'
|
||||
import {GetLedger} from './types'
|
||||
|
||||
type LedgerOptions = {
|
||||
ledgerVersion?: number,
|
||||
includeAllData?: boolean,
|
||||
includeTransactions?: boolean,
|
||||
includeState?: boolean
|
||||
}
|
||||
|
||||
|
||||
function getLedger(options: LedgerOptions = {}): Promise<GetLedger> {
|
||||
validate.getLedger({options})
|
||||
|
||||
const request = {
|
||||
command: 'ledger',
|
||||
ledger_index: options.ledgerVersion || 'validated',
|
||||
expand: options.includeAllData,
|
||||
transactions: options.includeTransactions,
|
||||
accounts: options.includeState
|
||||
}
|
||||
|
||||
return this.connection.request(request).then(response =>
|
||||
parseLedger(response.ledger))
|
||||
}
|
||||
|
||||
export default getLedger
|
||||
Reference in New Issue
Block a user