Added HistoryTransactionStatus

package.json version 0.16.0-rc.8 was updated
This commit is contained in:
Mikhail Gladchenko
2023-01-05 13:04:41 +00:00
parent 95366b88e9
commit cc51e13ddb
4 changed files with 19 additions and 4 deletions

View File

@@ -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",

View File

@@ -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,
};

View File

@@ -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,
};

View File

@@ -212,3 +212,10 @@ export type BalanceIssue = {
}
export type Exchange = typeof exchanges[number];
export enum HistoryTransactionStatus {
PENDING = 'Pending',
DONE = 'Done',
APPROVING = 'Approving',
CANCELLED = 'Cancelled',
}