diff --git a/package.json b/package.json index b6e19b9..c20a865 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@orionprotocol/sdk", - "version": "0.16.0-rc.7", + "version": "0.16.0-rc.8", "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 96c160d..b5c1d6c 100644 --- a/src/services/OrionBlockchain/schemas/cfdHistorySchema.ts +++ b/src/services/OrionBlockchain/schemas/cfdHistorySchema.ts @@ -24,6 +24,22 @@ const cfdHistorySchema = z.object({ total: z.number(), pagination: z.object({}), data: z.array(cfdHistoryItem), +}).transform((response) => { + return response.data.map((item) => { + const { + createdAt, reason, transactionHash, amountNumber, + } = item; + + return { + type: reason === 'WITHDRAW' ? 'withdrawal' : 'deposit', + date: createdAt, + token: 'USDT', + amount: amountNumber, + status: 'Done', + transactionHash, + user: item.address, + }; + }); }); export default cfdHistorySchema; diff --git a/src/services/OrionBlockchain/schemas/historySchema.ts b/src/services/OrionBlockchain/schemas/historySchema.ts index aa9cdd8..9c36e2e 100644 --- a/src/services/OrionBlockchain/schemas/historySchema.ts +++ b/src/services/OrionBlockchain/schemas/historySchema.ts @@ -13,6 +13,21 @@ const historySchema = z.array(z.object( user: z.string(), walletBalance: z.string().nullable().optional(), }, -)); +)).transform((response) => { + return response.map((item) => { + const { + type, createdAt, transactionHash, user, + } = item; + return { + type, + date: createdAt * 1000, + token: item.asset, + amount: item.amountNumber, + status: 'Done', + transactionHash, + user, + }; + }); +}); export default historySchema;