OP-3268 [CFD] Deposit amount

Added CFDContracts endpoint
package.json version update
This commit is contained in:
Mikhail Gladchenko
2022-12-22 15:11:53 +00:00
parent 71af3eb5fe
commit bceda40a9a
3 changed files with 25 additions and 1 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "@orionprotocol/sdk",
"version": "0.16.0-rc.0",
"version": "0.16.0-rc.1",
"description": "Orion Protocol SDK",
"main": "./lib/esm/index.js",
"module": "./lib/esm/index.js",

View File

@@ -15,6 +15,7 @@ import redeemOrderSchema from '../OrionAggregator/schemas/redeemOrderSchema';
import { sourceAtomicHistorySchema, targetAtomicHistorySchema } from './schemas/atomicHistorySchema';
import { makePartial } from '../../utils';
import { networkCodes } from '../../constants';
import CFDContractsSchema from './schemas/CFDContractsSchema';
interface IAdminAuthHeaders {
auth: string;
@@ -90,6 +91,7 @@ class OrionBlockchain {
this.getBlockNumber = this.getBlockNumber.bind(this);
this.getRedeemOrderBySecretHash = this.getRedeemOrderBySecretHash.bind(this);
this.claimOrder = this.claimOrder.bind(this);
this.getCFDContracts = this.getCFDContracts.bind(this);
}
get orionBlockchainWsUrl() {
@@ -377,6 +379,11 @@ class OrionBlockchain {
body: JSON.stringify(secretHashes),
},
);
getCFDContracts = () => fetchWithValidation(
`${this.apiUrl}/api/cfd/contracts`,
CFDContractsSchema,
);
}
export * as schemas from './schemas';

View File

@@ -0,0 +1,17 @@
import { z } from 'zod';
const CFDContractsSchema = z.array(z.object({
name: z.string(),
alias: z.string(),
address: z.string(),
leverage: z.number(),
soLevel: z.number(),
shortFR: z.number(),
longFR: z.number(),
shortFRStored: z.number(),
longFRStored: z.number(),
lastFRPriceUpdateTime: z.number(),
priceIndex: z.number(),
}));
export default CFDContractsSchema;