@morambacrypto/connect 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,11 @@
1
+ import { AuthAPI } from "./apis/auth.api";
2
+ export interface MorambaClientConfig {
3
+ baseURL: string;
4
+ apiKey: string;
5
+ partnerId: string;
6
+ }
7
+ export declare class MorambaClient {
8
+ auth: AuthAPI;
9
+ private http;
10
+ constructor(config: MorambaClientConfig);
11
+ }
@@ -0,0 +1,12 @@
1
+ import { HttpClient } from "./client/HttpClient";
2
+ import { AuthAPI } from "./apis/auth.api";
3
+ export class MorambaClient {
4
+ constructor(config) {
5
+ this.http = new HttpClient(config.baseURL, {
6
+ "Content-Type": "application/json",
7
+ "x-api-key": config.apiKey,
8
+ "x-partner-id": config.partnerId,
9
+ });
10
+ this.auth = new AuthAPI(this.http);
11
+ }
12
+ }
@@ -0,0 +1,7 @@
1
+ import { HttpClient } from "../client/HttpClient";
2
+ import { CreateJwtRequest, CreateJwtResponse } from "../types/auth.types";
3
+ export declare class AuthAPI {
4
+ private http;
5
+ constructor(http: HttpClient);
6
+ createJwtToken(payload: CreateJwtRequest): Promise<CreateJwtResponse>;
7
+ }
@@ -0,0 +1,8 @@
1
+ export class AuthAPI {
2
+ constructor(http) {
3
+ this.http = http;
4
+ }
5
+ createJwtToken(payload) {
6
+ return this.http.post("/api/v1/morambacypto/create/jwt_token", payload);
7
+ }
8
+ }
File without changes
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,6 @@
1
+ export declare class HttpClient {
2
+ private client;
3
+ constructor(baseURL: string, headers?: Record<string, string>);
4
+ post<T = any>(url: string, data: any): Promise<T>;
5
+ get<T = any>(url: string): Promise<T>;
6
+ }
@@ -0,0 +1,16 @@
1
+ import axios from "axios";
2
+ export class HttpClient {
3
+ constructor(baseURL, headers = {}) {
4
+ this.client = axios.create({
5
+ baseURL,
6
+ headers,
7
+ timeout: 10000,
8
+ });
9
+ }
10
+ post(url, data) {
11
+ return this.client.post(url, data).then(res => res.data);
12
+ }
13
+ get(url) {
14
+ return this.client.get(url).then(res => res.data);
15
+ }
16
+ }
@@ -0,0 +1 @@
1
+ export * from "./HttpClient";
@@ -0,0 +1 @@
1
+ export * from "./HttpClient";
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare function add(a: number, b: number): number;
2
- export declare const VERSION = "1.0.0";
1
+ export * from "./MorambaClient";
2
+ export * from "./types";
package/dist/index.js CHANGED
@@ -1,5 +1,2 @@
1
- // src/index.ts
2
- export function add(a, b) {
3
- return a + b;
4
- }
5
- export const VERSION = "1.0.0";
1
+ export * from "./MorambaClient";
2
+ export * from "./types";
@@ -0,0 +1,15 @@
1
+ export interface CreateJwtRequest {
2
+ userid: string;
3
+ partner_id: string;
4
+ api_key: string;
5
+ }
6
+ export interface JwtTokenData {
7
+ token: string;
8
+ iat: number;
9
+ exp: number;
10
+ }
11
+ export interface CreateJwtResponse {
12
+ success: boolean;
13
+ message: string;
14
+ data: JwtTokenData;
15
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export * from "./auth.types";
@@ -0,0 +1 @@
1
+ export * from "./auth.types";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@morambacrypto/connect",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "This library use for interact with moramba-crypto project",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
@@ -18,5 +18,8 @@
18
18
  "library"
19
19
  ],
20
20
  "author": "Moramba Crypto",
21
- "license": "MIT"
21
+ "license": "MIT",
22
+ "dependencies": {
23
+ "axios": "^1.13.2"
24
+ }
22
25
  }