mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-14 14:12:35 +03:00
Exchange and CFD history schemas was transformed
package.json version 0.16.0-rc.8 was updated
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user