@pear-protocol/core-sdk
Advanced tools
| import { HttpTypes } from '@pear-protocol/types'; | ||
| import { HttpClient } from '../http.js'; | ||
| import { ClientHeaders } from '../types.js'; | ||
| declare class Admin { | ||
| private client; | ||
| constructor(client: HttpClient); | ||
| clientIds: { | ||
| list: (query?: HttpTypes.ListClientIdsParamsInput, headers?: ClientHeaders) => Promise<{ | ||
| id: string; | ||
| code: string; | ||
| label: string; | ||
| isActive: boolean; | ||
| createdAt: string; | ||
| updatedAt: string; | ||
| description?: string | undefined; | ||
| }[]>; | ||
| create: (body: HttpTypes.CreateClientIdPayloadInput, headers?: ClientHeaders) => Promise<{ | ||
| id: string; | ||
| code: string; | ||
| label: string; | ||
| isActive: boolean; | ||
| createdAt: string; | ||
| updatedAt: string; | ||
| description?: string | undefined; | ||
| }>; | ||
| update: (id: string, body: HttpTypes.UpdateClientIdPayloadInput, headers?: ClientHeaders) => Promise<{ | ||
| id: string; | ||
| code: string; | ||
| label: string; | ||
| isActive: boolean; | ||
| createdAt: string; | ||
| updatedAt: string; | ||
| description?: string | undefined; | ||
| }>; | ||
| activate: (id: string, headers?: ClientHeaders) => Promise<{ | ||
| id: string; | ||
| code: string; | ||
| label: string; | ||
| isActive: boolean; | ||
| createdAt: string; | ||
| updatedAt: string; | ||
| description?: string | undefined; | ||
| }>; | ||
| deactivate: (id: string, headers?: ClientHeaders) => Promise<{ | ||
| id: string; | ||
| code: string; | ||
| label: string; | ||
| isActive: boolean; | ||
| createdAt: string; | ||
| updatedAt: string; | ||
| description?: string | undefined; | ||
| }>; | ||
| }; | ||
| } | ||
| export { Admin }; |
| class Admin { | ||
| client; | ||
| constructor(client) { | ||
| this.client = client; | ||
| } | ||
| clientIds = { | ||
| list: async (query, headers) => { | ||
| return await this.client.fetch(`/admin/client-ids`, { | ||
| method: "GET", | ||
| headers, | ||
| query | ||
| }); | ||
| }, | ||
| create: async (body, headers) => { | ||
| return await this.client.fetch(`/admin/client-ids`, { | ||
| method: "POST", | ||
| headers, | ||
| body | ||
| }); | ||
| }, | ||
| update: async (id, body, headers) => { | ||
| return await this.client.fetch(`/admin/client-ids/${id}`, { | ||
| method: "PATCH", | ||
| headers, | ||
| body | ||
| }); | ||
| }, | ||
| activate: async (id, headers) => { | ||
| return await this.client.fetch(`/admin/client-ids/${id}/activate`, { | ||
| method: "POST", | ||
| headers | ||
| }); | ||
| }, | ||
| deactivate: async (id, headers) => { | ||
| return await this.client.fetch(`/admin/client-ids/${id}/deactivate`, { | ||
| method: "POST", | ||
| headers | ||
| }); | ||
| } | ||
| }; | ||
| } | ||
| export { Admin }; |
@@ -15,3 +15,3 @@ import { HttpTypes } from '@pear-protocol/types'; | ||
| id: string; | ||
| role: "basic" | "pro"; | ||
| role: "basic" | "pro" | "admin"; | ||
| providerId: string | null; | ||
@@ -30,3 +30,3 @@ loginMethod: "email" | "evm_wallet"; | ||
| id: string; | ||
| role: "basic" | "pro"; | ||
| role: "basic" | "pro" | "admin"; | ||
| providerId: string | null; | ||
@@ -33,0 +33,0 @@ loginMethod: "email" | "evm_wallet"; |
+54
-0
@@ -102,2 +102,18 @@ class Core { | ||
| }; | ||
| markets = { | ||
| list: async (query, headers) => { | ||
| return await this.client.fetch(`/markets`, { | ||
| method: "GET", | ||
| headers, | ||
| query | ||
| }); | ||
| }, | ||
| baskets: async (query, headers) => { | ||
| return await this.client.fetch(`/markets/baskets`, { | ||
| method: "GET", | ||
| headers, | ||
| query | ||
| }); | ||
| } | ||
| }; | ||
| positions = { | ||
@@ -118,2 +134,18 @@ list: async (query, headers) => { | ||
| }; | ||
| portfolio = { | ||
| overview: async (query, headers) => { | ||
| return await this.client.fetch(`/portfolio`, { | ||
| method: "GET", | ||
| headers, | ||
| query | ||
| }); | ||
| }, | ||
| analytics: async (query, headers) => { | ||
| return await this.client.fetch(`/portfolio/analytics`, { | ||
| method: "GET", | ||
| headers, | ||
| query | ||
| }); | ||
| } | ||
| }; | ||
| prices = { | ||
@@ -350,4 +382,26 @@ list: async (query, headers) => { | ||
| }; | ||
| tca = { | ||
| execution: async (executionId, headers) => { | ||
| return await this.client.fetch(`/tca/executions/${executionId}`, { | ||
| method: "GET", | ||
| headers | ||
| }); | ||
| }, | ||
| position: async (positionId, query, headers) => { | ||
| return await this.client.fetch(`/tca/positions/${positionId}`, { | ||
| method: "GET", | ||
| headers, | ||
| query | ||
| }); | ||
| }, | ||
| summary: async (query, headers) => { | ||
| return await this.client.fetch(`/tca/summary`, { | ||
| method: "GET", | ||
| headers, | ||
| query | ||
| }); | ||
| } | ||
| }; | ||
| } | ||
| export { Core }; |
+2
-0
@@ -0,1 +1,2 @@ | ||
| import { Admin } from './admin/index.js'; | ||
| import { Auth } from './auth/index.js'; | ||
@@ -9,2 +10,3 @@ import { Core } from './core/index.js'; | ||
| declare class PearSDK { | ||
| admin: Admin; | ||
| auth: Auth; | ||
@@ -11,0 +13,0 @@ core: Core; |
+3
-0
@@ -0,1 +1,2 @@ | ||
| import { Admin } from './admin'; | ||
| import { Auth } from './auth'; | ||
@@ -8,2 +9,3 @@ import { Core } from './core'; | ||
| class PearSDK { | ||
| admin; | ||
| auth; | ||
@@ -21,2 +23,3 @@ core; | ||
| const client = new HttpClient(config.url, authMode, config.logger, config.debug); | ||
| this.admin = new Admin(client); | ||
| this.auth = new Auth(client); | ||
@@ -23,0 +26,0 @@ this.core = new Core(client); |
+3
-3
| { | ||
| "name": "@pear-protocol/core-sdk", | ||
| "version": "0.0.24", | ||
| "version": "0.1.0", | ||
| "description": "Pear Protocol Core SDK", | ||
@@ -28,4 +28,4 @@ "private": false, | ||
| "dependencies": { | ||
| "@pear-protocol/types": "^0.0.21", | ||
| "@pear-protocol/utils": "^0.0.21", | ||
| "@pear-protocol/types": "^0.1.0", | ||
| "@pear-protocol/utils": "^0.0.22", | ||
| "qs": "^6.14.0" | ||
@@ -32,0 +32,0 @@ }, |
Sorry, the diff of this file is too big to display
137365
17.5%15
15.38%3661
17.38%76
18.75%+ Added
+ Added
- Removed
- Removed
Updated
Updated