From c0106a8e5503b00c77772b83525c207adc3e7822 Mon Sep 17 00:00:00 2001 From: Aleksandr Kraiz Date: Tue, 17 May 2022 01:58:46 +0400 Subject: [PATCH] History schema change --- package.json | 2 +- src/fetchWithValidation.ts | 3 ++- src/services/OrionBlockchain/schemas/historySchema.ts | 8 +++----- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index d04a088..b901fdd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@orionprotocol/sdk", - "version": "0.5.16", + "version": "0.5.17", "description": "Orion Protocol SDK", "main": "./lib/esm/index.js", "module": "./lib/esm/index.js", diff --git a/src/fetchWithValidation.ts b/src/fetchWithValidation.ts index 93a1560..0029a13 100644 --- a/src/fetchWithValidation.ts +++ b/src/fetchWithValidation.ts @@ -141,10 +141,11 @@ export default async function fetchWithValidation issue.message).join(', '); return err({ type: 'payloadParseError' as const, url, - message: 'Can\'t recognize response payload', + message: `Can't recognize response payload: ${issuesMessages}`, error: payload.error, }); } diff --git a/src/services/OrionBlockchain/schemas/historySchema.ts b/src/services/OrionBlockchain/schemas/historySchema.ts index 086144e..aa9cdd8 100644 --- a/src/services/OrionBlockchain/schemas/historySchema.ts +++ b/src/services/OrionBlockchain/schemas/historySchema.ts @@ -6,14 +6,12 @@ const historySchema = z.array(z.object( amountNumber: z.string(), asset: z.string(), assetAddress: z.string(), - contractBalance: z.string().optional(), + contractBalance: z.string().nullable().optional(), createdAt: z.number(), transactionHash: z.string(), - type: z.string(), + type: z.enum(['deposit', 'withdrawal']), user: z.string(), - walletBalance: z.string().optional(), - __v: z.number(), - _id: z.string(), + walletBalance: z.string().nullable().optional(), }, ));