mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-04 21:15:47 +00:00
Merge pull request #399 from clark800/rename
Rename getAccountTransactions to getTransactions
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||
"title": "acct-tx-options",
|
||||
"description": "Options for getAccountTransactions",
|
||||
"description": "Options for getTransactions",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"start": {"$ref": "hash256"},
|
||||
|
||||
@@ -52,7 +52,7 @@ module.exports = {
|
||||
trustline: _.partial(schemaValidate, 'trustline'),
|
||||
txJSON: _.partial(schemaValidate, 'tx'),
|
||||
blob: _.partial(schemaValidate, 'blob'),
|
||||
getAccountTransactionsOptions: _.partial(validateOptions, 'acct-tx-options'),
|
||||
getTransactionsOptions: _.partial(validateOptions, 'acct-tx-options'),
|
||||
options: _.partial(validateOptions, 'options'),
|
||||
instructions: _.partial(schemaValidate, 'instructions')
|
||||
};
|
||||
|
||||
@@ -7,7 +7,7 @@ const getServerInfo = server.getServerInfo;
|
||||
const getFee = server.getFee;
|
||||
const isConnected = server.isConnected;
|
||||
const getTransaction = require('./ledger/transaction');
|
||||
const getAccountTransactions = require('./ledger/transactions');
|
||||
const getTransactions = require('./ledger/transactions');
|
||||
const getTrustlines = require('./ledger/trustlines');
|
||||
const getBalances = require('./ledger/balances');
|
||||
const getPathFind = require('./ledger/pathfind');
|
||||
@@ -36,7 +36,7 @@ RippleAPI.prototype = {
|
||||
getFee,
|
||||
|
||||
getTransaction,
|
||||
getAccountTransactions,
|
||||
getTransactions,
|
||||
getTrustlines,
|
||||
getBalances,
|
||||
getPathFind,
|
||||
|
||||
@@ -59,7 +59,7 @@ function getAccountTx(remote, address, options, marker, limit, callback) {
|
||||
});
|
||||
}
|
||||
|
||||
function getAccountTransactionsInternal(remote, address, options, callback) {
|
||||
function getTransactionsInternal(remote, address, options, callback) {
|
||||
const limit = options.limit || DEFAULT_LIMIT;
|
||||
const compare = options.earliestFirst ? utils.compareTransactions :
|
||||
_.rearg(utils.compareTransactions, 1, 0);
|
||||
@@ -68,9 +68,9 @@ function getAccountTransactionsInternal(remote, address, options, callback) {
|
||||
composeAsync((txs) => txs.sort(compare), callback));
|
||||
}
|
||||
|
||||
function getAccountTransactions(address, options, callback) {
|
||||
function getTransactions(address, options, callback) {
|
||||
validate.address(address);
|
||||
validate.getAccountTransactionsOptions(options);
|
||||
validate.getTransactionsOptions(options);
|
||||
|
||||
const remote = this.remote;
|
||||
if (options.start) {
|
||||
@@ -83,11 +83,11 @@ function getAccountTransactions(address, options, callback) {
|
||||
const ledgerOption = options.earliestFirst ?
|
||||
{minLedgerVersion: ledgerVersion} : {maxLedgerVersion: ledgerVersion};
|
||||
const newOptions = _.assign({}, options, {startTx: tx}, ledgerOption);
|
||||
getAccountTransactionsInternal(remote, address, newOptions, callback);
|
||||
getTransactionsInternal(remote, address, newOptions, callback);
|
||||
});
|
||||
} else {
|
||||
getAccountTransactionsInternal(remote, address, options, callback);
|
||||
getTransactionsInternal(remote, address, options, callback);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = utils.wrapCatch(getAccountTransactions);
|
||||
module.exports = utils.wrapCatch(getTransactions);
|
||||
|
||||
@@ -103,20 +103,20 @@ describe('RippleAPI', function() {
|
||||
_.partial(checkResult, transactionResponse, done));
|
||||
});
|
||||
|
||||
it('getAccountTransactions', function(done) {
|
||||
it('getTransactions', function(done) {
|
||||
const options = {types: ['payment', 'order'], outgoing: true, limit: 2};
|
||||
this.api.getAccountTransactions(address, options,
|
||||
this.api.getTransactions(address, options,
|
||||
_.partial(checkResult, accountTransactionsResponse, done));
|
||||
});
|
||||
|
||||
// TODO: this doesn't test much, just that it doesn't crash
|
||||
it('getAccountTransactions with start option', function(done) {
|
||||
it('getTransactions with start option', function(done) {
|
||||
const options = {
|
||||
start: hashes.VALID_TRANSACTION_HASH,
|
||||
earliestFirst: false,
|
||||
limit: 2
|
||||
};
|
||||
this.api.getAccountTransactions(address, options,
|
||||
this.api.getTransactions(address, options,
|
||||
_.partial(checkResult, accountTransactionsResponse, done));
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user