Convert from Flow to Typescript (#816)

* convert to typescript
* add docs for custom node typing
* update webpack, gulpfile
This commit is contained in:
Fred K. Schott
2017-12-24 00:39:18 -08:00
committed by Elliot Lee
parent 5979ff6197
commit 8204f6c648
86 changed files with 1629 additions and 1532 deletions

28
src/ledger/ledger.ts Normal file
View 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