Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/integration/blockchain/icp/icp-wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ export class InternetComputerWallet {
}

getAgent(host: string): HttpAgent {
return HttpAgent.createSync({ identity: this.identity, host });
return HttpAgent.createSync({ identity: this.identity, host, shouldSyncTime: true });
}
}
8 changes: 7 additions & 1 deletion src/subdomains/core/history/services/history.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,13 @@ export class HistoryService {
query.limit,
query.offset,
)
: await this.transactionService.getTransactionsForUsers([user.id], query.from, query.to, query.limit);
: await this.transactionService.getTransactionsForUsers(
[user.id],
query.from,
query.to,
query.limit,
query.offset,
);

const all =
query.buy == null && query.sell == null && query.staking == null && query.ref == null && query.lm == null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,13 +298,18 @@ export abstract class CcxtExchangeAdapter extends LiquidityActionAdapter {
const token = asset ?? targetAsset.dexName;

const withdrawal = await this.exchangeService.getWithdraw(correlationId, token);
if (!withdrawal?.txid) {
this.logger.verbose(
`No withdrawal id for id ${correlationId} and asset ${token} at ${this.exchangeService.name} found`,
);
if (!withdrawal) {
this.logger.verbose(`No withdrawal for id ${correlationId} and asset ${token} at ${this.exchangeService.name}`);
return false;
}

if (withdrawal.status === 'failed') {
throw new OrderFailedException(`Withdrawal ${correlationId} has failed`);
}

if (!withdrawal.txid) {
this.logger.verbose(`No txid yet for withdrawal ${correlationId} at ${this.exchangeService.name}`);
return false;
} else if (withdrawal.status === 'failed') {
throw new OrderFailedException(`Withdrawal TX ${withdrawal.txid} has failed`);
}

order.outputAmount = withdrawal.amount;
Expand Down Expand Up @@ -409,13 +414,20 @@ export abstract class CcxtExchangeAdapter extends LiquidityActionAdapter {
const { target } = this.parseTransferParams(paramMap);

const withdrawal = await this.exchangeService.getWithdraw(correlationId, targetAsset.dexName);
if (!withdrawal?.txid) {
if (!withdrawal) {
this.logger.verbose(
`No withdrawal id for id ${correlationId} and asset ${targetAsset.dexName} at ${this.exchangeService.name} found`,
`No withdrawal for id ${correlationId} and asset ${targetAsset.dexName} at ${this.exchangeService.name}`,
);
return false;
} else if (withdrawal.status === 'failed') {
throw new OrderFailedException(`Withdrawal TX ${withdrawal.txid} has failed`);
}

if (withdrawal.status === 'failed') {
throw new OrderFailedException(`Withdrawal ${correlationId} has failed`);
}

if (!withdrawal.txid) {
this.logger.verbose(`No txid yet for withdrawal ${correlationId} at ${this.exchangeService.name}`);
return false;
}

order.outputAmount = withdrawal.amount;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ export class TransactionService {
return this.repo.find({
where: { userData: { id: userDataId }, type: Not(IsNull()), created: Between(from, to) },
relations: {
userData: { country: true },
buyCrypto: {
buy: true,
cryptoRoute: true,
Expand All @@ -206,13 +207,15 @@ export class TransactionService {
from = new Date(0),
to = new Date(),
limit?: number,
offset?: number,
): Promise<Transaction[]> {
return Util.doInBatchesWithLimit(
userIds,
(batch, remaining) =>
this.repo.find({
where: { user: { id: In(batch) }, type: Not(IsNull()), created: Between(from, to) },
relations: {
userData: { country: true },
buyCrypto: {
buy: true,
cryptoRoute: true,
Expand All @@ -224,7 +227,9 @@ export class TransactionService {
buyFiat: { sell: true, cryptoInput: true, bankTx: true, fiatOutput: true },
refReward: true,
},
order: { created: 'DESC' },
take: remaining,
skip: offset,
}),
100,
limit,
Expand Down
Loading