Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(deps): bump http-cache-semantics from 4.1.0 to 4.1.1 #214

Open
wants to merge 3 commits into
base: stage
Choose a base branch
from
Open
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
41 changes: 16 additions & 25 deletions src/modules/ampli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* To update run 'ampli pull scraper'
*
* Required dependencies: @amplitude/analytics-node@^0.5.0
* Tracking Plan Version: 40
* Tracking Plan Version: 43
* Build: 1.0.0
* Runtime: node.js:typescript-ampli-v2
*
Expand Down Expand Up @@ -38,10 +38,10 @@ export const ApiKey: Record<Environment, string> = {
*/
export const DefaultConfiguration: NodeOptions = {
plan: {
version: "40",
version: "43",
branch: "main",
source: "scraper",
versionId: "cbc4a092-7d03-473a-bbba-f4fc79ef25b2",
versionId: "364c665a-00b3-4f3a-86b4-72245b71f5a0",
},
...{
ingestionMetadata: {
Expand Down Expand Up @@ -118,7 +118,7 @@ export interface IdentifyProperties {
walletType?: string;
}

export interface TransferFillConfirmedProperties {
export interface TransferFillCompletedProperties {
/**
* Capital fee percent, in decimals
*/
Expand All @@ -135,7 +135,7 @@ export interface TransferFillConfirmedProperties {
fillAmount: string;
fillAmountUsd: string;
fillCompleteTimestamp: string;
fillTime: string;
fillTimeInMs: string;
/**
* From amount in the bridge token, in decimals
*/
Expand Down Expand Up @@ -169,18 +169,9 @@ export interface TransferFillConfirmedProperties {
* Lp fee in USD
*/
lpFeeTotalUsd: string;
/**
* Gas fee in network token
*/
NetworkFeeNative: string;
/**
* Network native token
*/
NetworkFeeNativeToken: string;
/**
* Gas fee in USD
*/
NetworkFeeUsd: string;
networkFeeNative: string;
networkFeeNativeToken: string;
networkFeeUsd: string;
/**
* Recipient wallet address
*/
Expand Down Expand Up @@ -281,10 +272,10 @@ export class Identify implements BaseEvent {
}
}

export class TransferFillConfirmed implements BaseEvent {
event_type = "TransferFillConfirmed";
export class TransferFillCompleted implements BaseEvent {
event_type = "TransferFillCompleted";

constructor(public event_properties: TransferFillConfirmedProperties) {
constructor(public event_properties: TransferFillCompletedProperties) {
this.event_properties = event_properties;
}
}
Expand Down Expand Up @@ -406,22 +397,22 @@ export class Ampli {
}

/**
* TransferFillConfirmed
* TransferFillCompleted
*
* [View in Tracking Plan](https://data.amplitude.com/risklabs/Risk%20Labs/events/main/latest/TransferFillConfirmed)
* [View in Tracking Plan](https://data.amplitude.com/risklabs/Risk%20Labs/events/main/latest/TransferFillCompleted)
*
* Owner: Dong-Ha Kim
*
* @param userId The user's ID.
* @param properties The event's properties (e.g. capitalFeePct)
* @param options Amplitude event options.
*/
transferFillConfirmed(
transferFillCompleted(
userId: string | undefined,
properties: TransferFillConfirmedProperties,
properties: TransferFillCompletedProperties,
options?: EventOptions,
) {
return this.track(userId, new TransferFillConfirmed(properties), options);
return this.track(userId, new TransferFillCompleted(properties), options);
}
}

Expand Down
1 change: 1 addition & 0 deletions src/modules/deposit/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ export class DepositService {
[deposits, total] = await this.depositRepository
.createQueryBuilder("d")
.where("d.status = :status", { status })
.andWhere("d.amount > 0")
.andWhere("d.depositDate > NOW() - INTERVAL '1 days'")
.andWhere(`d.depositRelayerFeePct * :multiplier >= d.suggestedRelayerFeePct`, {
multiplier: this.appConfig.values.suggestedFees.deviationBufferMultiplier,
Expand Down
6 changes: 3 additions & 3 deletions src/modules/scraper/adapter/amplitude/track-service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { HttpService } from "@nestjs/axios";
import { Injectable } from "@nestjs/common";

import { EventOptions, TransferFillConfirmedProperties, ampli } from "../../../ampli";
import { EventOptions, TransferFillCompletedProperties, ampli } from "../../../ampli";
import { AppConfig } from "../../../configuration/configuration.service";

@Injectable()
Expand All @@ -22,9 +22,9 @@ export class TrackService {

public async trackDepositFilledEvent(
userId: string,
eventProperties: TransferFillConfirmedProperties,
eventProperties: TransferFillCompletedProperties,
eventOptions?: EventOptions,
) {
return ampli.transferFillConfirmed(userId, eventProperties, eventOptions);
return ampli.transferFillCompleted(userId, eventProperties, eventOptions);
}
}
10 changes: 6 additions & 4 deletions src/modules/scraper/adapter/messaging/TrackFillEventConsumer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ export class TrackFillEventConsumer {
fillAmount: fillAmounts.formattedAmount,
fillAmountUsd: fillAmounts.formattedAmountUsd,
fillCompleteTimestamp: String(DateTime.fromISO(fillTx.date).toMillis()),
fillTime: String(DateTime.fromISO(fillTx.date).diff(DateTime.fromJSDate(deposit.depositDate)).as("milliseconds")),
fillTimeInMs: String(
DateTime.fromISO(fillTx.date).diff(DateTime.fromJSDate(deposit.depositDate)).as("milliseconds"),
),
fromAmount: fromAmounts.formattedAmount,
fromAmountUsd: fromAmounts.formattedAmountUsd,
fromChainId: String(deposit.sourceChainId),
Expand All @@ -111,9 +113,9 @@ export class TrackFillEventConsumer {
lpFeePct: formattedLpFeeValues.pct,
lpFeeTotal: formattedLpFeeValues.total,
lpFeeTotalUsd: formattedLpFeeValues.totalUsd,
NetworkFeeNative: fee,
NetworkFeeNativeToken: destinationChainInfo.nativeSymbol.toUpperCase(),
NetworkFeeUsd: feeUsd,
networkFeeNative: fee,
networkFeeNativeToken: destinationChainInfo.nativeSymbol.toUpperCase(),
networkFeeUsd: feeUsd,
recipient: deposit.recipientAddr,
referralProgramAddress: deposit.referralAddress || "-",
relayFeePct: formattedRelayFeeValues.pct,
Expand Down
4 changes: 2 additions & 2 deletions test/deposit.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ describe("GET /deposits", () => {
// filled deposits with depositIds 10 - 19 and ascending depositDate
const FILLED_DEPOSITS = mockManyDepositEntities(10, {
depositIdStartIndex: 10,
overrides: { status: "filled", depositorAddr: depositorAddress },
overrides: { status: "filled", depositorAddr: depositorAddress, amount: "10", filled: "10" },
});
// pending deposits with depositIds 20 - 29 and ascending depositDate
const PENDING_DEPOSITS = mockManyDepositEntities(10, {
depositIdStartIndex: 20,
overrides: { status: "pending", depositorAddr: depositorAddress },
overrides: { status: "pending", depositorAddr: depositorAddress, amount: "10" },
});

beforeAll(async () => {
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9794,9 +9794,9 @@ http-basic@^8.1.1:
parse-cache-control "^1.0.1"

http-cache-semantics@^4.0.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz#49e91c5cbf36c9b94bcfcd71c23d5249ec74e390"
integrity sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==
version "4.1.1"
resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz#abe02fcb2985460bf0323be664436ec3476a6d5a"
integrity sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==

http-call@^5.2.2, http-call@^5.3.0:
version "5.3.0"
Expand Down