Add getAccountObjects (#881)

Squashed commit of the following:

commit 361ead8cbbbe4fa25ecba614f8f11930ff679996
commit 5ff26d7d2defbbaaa7c50d6b3b5b74bf30be19ef
commit 97f5dfc86d4730082fd016197b0c025e499912e3
commit d48654098601f2a19484d9bbae7c65786e3c5dd4
commit 4790401123e7836f6bea8d03111bce60dcf95114
commit 57512f7fc000689bb8224f33173ba91221f27281
commit e75a7e95b11368b26c40e8e6e7b583d978475e95
This commit is contained in:
Elliot Lee
2018-04-11 14:37:37 -07:00
committed by GitHub
parent 9af3968508
commit e978ef1888
19 changed files with 1275 additions and 32 deletions

View File

@@ -20,6 +20,7 @@ import getOrders from './ledger/orders'
import getOrderbook from './ledger/orderbook'
import getSettings from './ledger/settings'
import getAccountInfo from './ledger/accountinfo'
import getAccountObjects from './ledger/accountobjects'
import getPaymentChannel from './ledger/payment-channel'
import preparePayment from './transaction/payment'
import prepareTrustline from './transaction/trustline'
@@ -45,6 +46,7 @@ import verifyPaymentChannelClaim from './offline/verify-payment-channel-claim'
import getLedger from './ledger/ledger'
import {
AccountObjectsRequest, AccountObjectsResponse,
AccountOffersRequest, AccountOffersResponse,
AccountInfoRequest, AccountInfoResponse,
AccountLinesRequest, AccountLinesResponse,
@@ -139,17 +141,20 @@ class RippleAPI extends EventEmitter {
}
}
/**
* Makes a simple request to the API with the given command and any
* additional request body parameters.
*
* NOTE: This command is under development and should not yet be relied
* on by external consumers.
*/
async _request(command: 'account_info', params: AccountInfoRequest):
Promise<AccountInfoResponse>
async _request(command: 'account_lines', params: AccountLinesRequest):
Promise<AccountLinesResponse>
/**
* Returns objects owned by an account.
* For an account's trust lines and balances,
* see `getTrustlines` and `getBalances`.
*/
async _request(command: 'account_objects', params: AccountObjectsRequest):
Promise<AccountObjectsResponse>
async _request(command: 'account_offers', params: AccountOffersRequest):
Promise<AccountOffersResponse>
async _request(command: 'book_offers', params: BookOffersRequest):
@@ -160,7 +165,14 @@ class RippleAPI extends EventEmitter {
Promise<LedgerResponse>
async _request(command: 'ledger_entry', params: LedgerEntryRequest):
Promise<LedgerEntryResponse>
async _request(command: string, params: any = {}) {
/**
* Makes a request to the API with the given command and
* additional request body parameters.
*
* NOTE: This command is under development.
*/
async _request(command: string, params: object = {}) {
return this.connection.request({
...params,
command
@@ -169,7 +181,7 @@ class RippleAPI extends EventEmitter {
/**
* Makes multiple paged requests to the API to return a given number of
* resources. __requestAll() will make multiple requests until the `limit`
* resources. _requestAll() will make multiple requests until the `limit`
* number of resources is reached (if no `limit` is provided, a single request
* will be made).
*
@@ -246,6 +258,7 @@ class RippleAPI extends EventEmitter {
getOrderbook = getOrderbook
getSettings = getSettings
getAccountInfo = getAccountInfo
getAccountObjects = getAccountObjects
getPaymentChannel = getPaymentChannel
getLedger = getLedger