Skip to content

Commit

Permalink
refactor: rename fill event amplitude (prod) (#206)
Browse files Browse the repository at this point in the history
  • Loading branch information
dohaki authored Jan 13, 2023
1 parent e1cf4c4 commit 2317043
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
29 changes: 15 additions & 14 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: 32
* Tracking Plan Version: 40
* Build: 1.0.0
* Runtime: node.js:typescript-ampli-v2
*
Expand All @@ -25,22 +25,23 @@ export type EventOptions = amplitude.Types.EventOptions;
export type Result = amplitude.Types.Result;
export type NodeOptions = amplitude.Types.NodeOptions;

export type Environment = "production" | "development";
export type Environment = "production" | "development" | "testing";

export const ApiKey: Record<Environment, string> = {
production: "",
development: "",
testing: "",
};

/**
* Default Amplitude configuration options. Contains tracking plan information.
*/
export const DefaultConfiguration: NodeOptions = {
plan: {
version: "32",
version: "40",
branch: "main",
source: "scraper",
versionId: "e6298d8b-58e2-45e6-a09d-0f244c0489ab",
versionId: "cbc4a092-7d03-473a-bbba-f4fc79ef25b2",
},
...{
ingestionMetadata: {
Expand Down Expand Up @@ -117,7 +118,7 @@ export interface IdentifyProperties {
walletType?: string;
}

export interface FillTransactionCompletedProperties {
export interface TransferFillConfirmedProperties {
/**
* Capital fee percent, in decimals
*/
Expand Down Expand Up @@ -187,7 +188,7 @@ export interface FillTransactionCompletedProperties {
/**
* Address of referee, null if no referral used
*/
referralProgramAddress: string;
referralProgramAddress?: string;
/**
* Relay fee percent, in decimals
*/
Expand Down Expand Up @@ -280,10 +281,10 @@ export class Identify implements BaseEvent {
}
}

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

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

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

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, FillTransactionCompletedProperties, ampli } from "../../../ampli";
import { EventOptions, TransferFillConfirmedProperties, 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: FillTransactionCompletedProperties,
eventProperties: TransferFillConfirmedProperties,
eventOptions?: EventOptions,
) {
return ampli.fillTransactionCompleted(userId, eventProperties, eventOptions);
return ampli.transferFillConfirmed(userId, eventProperties, eventOptions);
}
}

0 comments on commit 2317043

Please sign in to comment.