Skip to content

Commit

Permalink
Increase the limit of the receipt API request, trying to fetch all th…
Browse files Browse the repository at this point in the history
…e receipts in one request.
  • Loading branch information
katat committed Sep 12, 2019
1 parent bb2657a commit f860963
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions src/containers/NahmiiHoc/saga.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { utils } from 'ethers';
import { all, fork, takeEvery, takeLatest, select, put, call, take, cancel, race } from 'redux-saga/effects';
import { delay } from 'redux-saga';
import BigNumber from 'bignumber.js';
import { requestWalletAPI, requestHardwareWalletAPI } from 'utils/request';
import { requestHardwareWalletAPI } from 'utils/request';
import rpcRequest from 'utils/rpcRequest';
import { isAddressMatch } from 'utils/wallet';
import { logErrorMsg } from 'utils/friendlyErrors';
Expand Down Expand Up @@ -707,26 +707,10 @@ export function* loadSettleableChallenges({ address, currency }, network, noPoll
}
}

export function* loadReceipts({ address }, network) {
while (true) { // eslint-disable-line no-constant-condition
try {
const path = `trading/wallets/${address}/receipts?`;
let receipts = yield call((...args) => requestWalletAPI(...args), path, network);
receipts = receipts.map((r) => ({ ...r, operatorId: 0 }));
yield put(actions.loadReceiptsSuccess(address, receipts));
} catch (err) {
yield put(actions.loadReceiptsError(address));
} finally {
const TWENTY_SEC_IN_MS = 1000 * 20;
yield delay(TWENTY_SEC_IN_MS);
}
}
}

export function* loadWalletReceipts({ address }, network) {
while (true) { // eslint-disable-line no-constant-condition
try {
const receipts = yield call(network.nahmiiProvider.getWalletReceipts.bind(network.nahmiiProvider), address);
const receipts = yield call(network.nahmiiProvider.getWalletReceipts.bind(network.nahmiiProvider), address, null, 1000);
yield put(actions.loadReceiptsSuccess(address, receipts));
} catch (e) {
yield put(actions.loadReceiptsError(address, e));
Expand Down

0 comments on commit f860963

Please sign in to comment.