mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-20 04:05:52 +00:00
Add new request interface, implement first few request typings (#843)
* Add request interface & typings - src/api: add basic implementation of request/requestAll() - src/ledgers/account_info: refactor to simplify with request() - src/ledgers/balances: refactor to simplify with request() - src/ledgers/orderbook: refactor to simplify with requestAll() - src/ledgers/orders: refactor to simplify with requestAll() - src/ledgers/trustlines: refactor to simplify with requestAll() * standardize on Formatted prefix
This commit is contained in:
committed by
Elliot Lee
parent
4a21360e37
commit
365de6d18a
@@ -1,7 +1,8 @@
|
||||
import * as utils from './utils'
|
||||
import {validate} from '../common'
|
||||
import {Connection} from '../common'
|
||||
import {TrustlinesOptions, Trustline} from './trustlines-types'
|
||||
import {GetTrustlinesOptions} from './trustlines'
|
||||
import {FormattedTrustline} from '../common/types/objects/trustlines'
|
||||
|
||||
|
||||
type Balance = {
|
||||
@@ -12,7 +13,7 @@ type Balance = {
|
||||
|
||||
type GetBalances = Array<Balance>
|
||||
|
||||
function getTrustlineBalanceAmount(trustline: Trustline) {
|
||||
function getTrustlineBalanceAmount(trustline: FormattedTrustline) {
|
||||
return {
|
||||
currency: trustline.specification.currency,
|
||||
counterparty: trustline.specification.counterparty,
|
||||
@@ -46,7 +47,7 @@ function getLedgerVersionHelper(connection: Connection, optionValue?: number
|
||||
return connection.getLedgerVersion()
|
||||
}
|
||||
|
||||
function getBalances(address: string, options: TrustlinesOptions = {}
|
||||
function getBalances(address: string, options: GetTrustlinesOptions = {}
|
||||
): Promise<GetBalances> {
|
||||
validate.getTrustlines({address, options})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user