Skip to content

Commit

Permalink
refactor(1.7.0): remove divestments
Browse files Browse the repository at this point in the history
  • Loading branch information
jblewnormal committed Nov 18, 2024
1 parent 2da1d1b commit 33f88fb
Show file tree
Hide file tree
Showing 10 changed files with 4 additions and 204 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@normalfinance/utils",
"version": "1.6.3",
"version": "1.7.0",
"description": "A Typescript modules for frequently used types, utilities, constants, and more across Normal repositories.",
"homepage": "https://github.com/normalfinance/utils#readme",
"bugs": {
Expand Down
3 changes: 0 additions & 3 deletions src/constants/urls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ export const normalUrls = {
execute: '/v1/investments/execute',
charge: '/v1/investments/charge',
},
divestments: {
execute: '/v1/divestments/execute',
},
schedules: '/v1/schedules',
},

Expand Down
62 changes: 0 additions & 62 deletions src/database/schema/divestmentOrders.ts

This file was deleted.

77 changes: 0 additions & 77 deletions src/database/schema/divestments.ts

This file was deleted.

2 changes: 0 additions & 2 deletions src/database/schema/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
export * from './accountRecovery';
export * from './divestmentOrders';
export * from './divestments';
export * from './exchanges';
export * from './indexCriteria';
export * from './indexPerformances';
Expand Down
24 changes: 0 additions & 24 deletions src/types/analytics/email.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ export enum TransactionalEmailTemplateId {
InvestmentSucceeded = 'investment_succeeded',
InvestmentFailed = 'investment_failed',

// Divestment
DivestmentCreated = 'divestment_created',
DivestmentCancelled = 'divestment_cancelled',
DivestmentSucceeded = 'divestment_succeeded',
DivestmentFailed = 'divestment_failed',

// Referral
ReferralCreated = 'referral_created',
ReferralCodeCreated = 'referral_code_created',
Expand Down Expand Up @@ -75,24 +69,6 @@ export type TransactionalEmailArgs = {
amount: string;
};

// Divestment
[TransactionalEmailTemplateId.DivestmentCreated]: {
index: string;
portion: string;
};
[TransactionalEmailTemplateId.DivestmentCancelled]: {
index: string;
portion: string;
};
[TransactionalEmailTemplateId.DivestmentSucceeded]: {
index: string;
portion: string;
};
[TransactionalEmailTemplateId.DivestmentFailed]: {
index: string;
portion: string;
};

// Referral
[TransactionalEmailTemplateId.ReferralCreated]: {
code: string;
Expand Down
15 changes: 0 additions & 15 deletions src/types/analytics/events/divestment.ts

This file was deleted.

3 changes: 0 additions & 3 deletions src/types/analytics/events/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { AuthEventName } from './auth';
import type { BillingEventName } from './billing';
import type { DivestmentEventName } from './divestment';
import type { ExchangeEventName } from './exchange';
import type { IndexEventName } from './indexes';
import type { InvestmentEventName } from './investment';
Expand All @@ -10,7 +9,6 @@ import type { ScheduleEventName } from './schedule';

export * from './auth';
export * from './billing';
export * from './divestment';
export * from './exchange';
export * from './indexes';
export * from './investment';
Expand All @@ -26,5 +24,4 @@ export type AnalyticsEventName =
| NotificationEventName
| ReferralEventName
| InvestmentEventName
| DivestmentEventName
| ScheduleEventName;
5 changes: 2 additions & 3 deletions src/types/order.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
export type DivestmentOrderIntent = {
export type InvestmentOrderIntent = {
weight: string;
asset: string;
amount: string;
};

export type InvestmentOrderIntent = { weight: string } & DivestmentOrderIntent;

export type OrderSummary = {
asset: string;
orderId: string;
Expand Down
15 changes: 1 addition & 14 deletions src/utils/idempotency.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable import/no-nodejs-modules */
import { createHash } from 'crypto';

import type { NewDivestment, NewInvestment } from '../database';
import type { NewInvestment } from '../database';

export const IdempotencyAlgorithm = 'md5'; // or sha256

Expand Down Expand Up @@ -73,16 +73,3 @@ export const createInvestmentIdempotencyKey = (investment: NewInvestment) =>
investment.amount,
investment.currency,
]);

/**
* Creates an idempotency key for a divestment.
* @param divestment - The divestment.
* @returns The idempotency key.
*/
export const createDivestmentIdempotencyKey = (divestment: NewDivestment) =>
createIdempotencyKey([
new Date().toJSON().slice(0, 10),
divestment.indexId,
divestment.exchangeId,
divestment.portion,
]);

0 comments on commit 33f88fb

Please sign in to comment.