From cc51e13ddb37f124184f9b69913ff6e39140fcc9 Mon Sep 17 00:00:00 2001 From: Mikhail Gladchenko Date: Thu, 5 Jan 2023 13:04:41 +0000 Subject: [PATCH] Added HistoryTransactionStatus package.json version 0.16.0-rc.8 was updated --- package.json | 2 +- .../OrionBlockchain/schemas/cfdHistorySchema.ts | 11 +++++++++-- src/services/OrionBlockchain/schemas/historySchema.ts | 3 ++- src/types.ts | 7 +++++++ 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index c20a865..6a09e12 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@orionprotocol/sdk", - "version": "0.16.0-rc.8", + "version": "0.16.0-rc.9", "description": "Orion Protocol SDK", "main": "./lib/esm/index.js", "module": "./lib/esm/index.js", diff --git a/src/services/OrionBlockchain/schemas/cfdHistorySchema.ts b/src/services/OrionBlockchain/schemas/cfdHistorySchema.ts index b5c1d6c..2391fe5 100644 --- a/src/services/OrionBlockchain/schemas/cfdHistorySchema.ts +++ b/src/services/OrionBlockchain/schemas/cfdHistorySchema.ts @@ -1,4 +1,10 @@ import { z } from 'zod'; +import { HistoryTransactionStatus } from '../../../types'; + +export enum historyTransactionType { + WITHDRAW = 'withdrawal', + DEPOSIT = 'deposit', +} const cfdHistoryItem = z.object({ _id: z.string(), @@ -29,13 +35,14 @@ const cfdHistorySchema = z.object({ const { createdAt, reason, transactionHash, amountNumber, } = item; + const type = historyTransactionType[reason]; return { - type: reason === 'WITHDRAW' ? 'withdrawal' : 'deposit', + type, date: createdAt, token: 'USDT', amount: amountNumber, - status: 'Done', + status: HistoryTransactionStatus.DONE, transactionHash, user: item.address, }; diff --git a/src/services/OrionBlockchain/schemas/historySchema.ts b/src/services/OrionBlockchain/schemas/historySchema.ts index 9c36e2e..9aba65a 100644 --- a/src/services/OrionBlockchain/schemas/historySchema.ts +++ b/src/services/OrionBlockchain/schemas/historySchema.ts @@ -1,4 +1,5 @@ import { z } from 'zod'; +import { HistoryTransactionStatus } from '../../../types'; const historySchema = z.array(z.object( { @@ -23,7 +24,7 @@ const historySchema = z.array(z.object( date: createdAt * 1000, token: item.asset, amount: item.amountNumber, - status: 'Done', + status: HistoryTransactionStatus.DONE, transactionHash, user, }; diff --git a/src/types.ts b/src/types.ts index 84922ec..7e29bbe 100644 --- a/src/types.ts +++ b/src/types.ts @@ -212,3 +212,10 @@ export type BalanceIssue = { } export type Exchange = typeof exchanges[number]; + +export enum HistoryTransactionStatus { + PENDING = 'Pending', + DONE = 'Done', + APPROVING = 'Approving', + CANCELLED = 'Cancelled', +}