mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-29 00:57:56 +03:00
Added service methods to Orion Blockchain
This commit is contained in:
@@ -5,6 +5,7 @@ import {
|
||||
IDOSchema, atomicHistorySchema,
|
||||
poolsConfigSchema, poolsInfoSchema, infoSchema, historySchema,
|
||||
addPoolSchema, adminPoolsListSchema,
|
||||
atomicSummarySchema,
|
||||
} from './schemas';
|
||||
import { OrionBlockchainSocketIO } from './ws';
|
||||
import redeemOrderSchema from '../OrionAggregator/schemas/redeemOrderSchema';
|
||||
@@ -90,6 +91,29 @@ class OrionBlockchain {
|
||||
return `https://${this.apiUrl}/`;
|
||||
}
|
||||
|
||||
private getSummaryRedeem = (brokerAddress: string) => fetchWithValidation(
|
||||
`https://${this.apiUrl}/api/atomic/summary-redeem/${brokerAddress}`,
|
||||
atomicSummarySchema,
|
||||
);
|
||||
|
||||
private getSummaryClaim = (brokerAddress: string) => fetchWithValidation(
|
||||
`https://${this.apiUrl}/api/atomic/summary-claim/${brokerAddress}`,
|
||||
atomicSummarySchema,
|
||||
);
|
||||
|
||||
private getQueueLength = () => fetchWithValidation(
|
||||
`https://${this.apiUrl}/api/queueLength`,
|
||||
z.number().int()
|
||||
);
|
||||
|
||||
get internal() {
|
||||
return {
|
||||
getSummaryRedeem: this.getSummaryRedeem.bind(this),
|
||||
getSummaryClaim: this.getSummaryClaim.bind(this),
|
||||
getQueueLength: this.getQueueLength.bind(this),
|
||||
};
|
||||
}
|
||||
|
||||
getAuthToken() {
|
||||
return fetchWithValidation(`https://${this.apiUrl}/api/auth/token`, z.object({ token: z.string() }));
|
||||
}
|
||||
@@ -196,10 +220,6 @@ class OrionBlockchain {
|
||||
return fetchWithValidation(`https://${this.apiUrl}/api/blocknumber`, z.number().int());
|
||||
}
|
||||
|
||||
getQueueLength() {
|
||||
return fetchWithValidation(`https://${this.apiUrl}/api/queueLength`, z.number().int());
|
||||
}
|
||||
|
||||
getIDOInfo() {
|
||||
return fetchWithValidation(`https://${this.apiUrl}/api/solarflare`, IDOSchema);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
export default z.object({
|
||||
amount: z.number(),
|
||||
count: z.number(),
|
||||
});
|
||||
@@ -7,3 +7,4 @@ export { default as IDOSchema } from './IDOSchema';
|
||||
export { default as infoSchema } from './infoSchema';
|
||||
export { default as poolsConfigSchema } from './poolsConfigSchema';
|
||||
export { default as poolsInfoSchema } from './poolsInfoSchema';
|
||||
export { default as atomicSummarySchema } from './atomicSummarySchema';
|
||||
|
||||
Reference in New Issue
Block a user