Skip to content
This repository was archived by the owner on Oct 8, 2024. It is now read-only.

Commit 927c8ae

Browse files
fix: add api key to every socket api call (#9)
* fix: add api key to every socket api call * v1.23.3 --------- Co-authored-by: salil-naik <[email protected]>
1 parent eb6ad4d commit 927c8ae

File tree

8 files changed

+46
-55
lines changed

8 files changed

+46
-55
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ lib/
66
.DS_Store
77
coverage
88
.env
9+
*.tgz

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@socket.tech/socket-v2-sdk",
3-
"version": "1.23.2",
3+
"version": "1.23.3",
44
"module": "lib/src/index.js",
55
"main": "lib/src/index.js",
66
"types": "lib/src/index.d.ts",

spec.json

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,6 @@
11
{
22
"openapi": "3.0.0",
33
"paths": {
4-
"/v2/health": {
5-
"get": {
6-
"operationId": "AppController_getHealth",
7-
"parameters": [],
8-
"responses": {
9-
"200": {
10-
"description": "Health Check for Fund Movr API",
11-
"content": {
12-
"application/json": {
13-
"schema": {
14-
"$ref": "#/components/schemas/HealthResponseDTO"
15-
}
16-
}
17-
}
18-
}
19-
},
20-
"tags": ["Health"]
21-
}
22-
},
23-
"/v2/health-rpc": {
24-
"get": {
25-
"operationId": "AppController_getHealthRPC",
26-
"parameters": [],
27-
"responses": {
28-
"200": {
29-
"description": "Health Check for Fund Movr API RPCS"
30-
}
31-
},
32-
"tags": ["Health"]
33-
}
34-
},
354
"/v2/gas-price": {
365
"get": {
376
"operationId": "AppController_getGasPrice",
@@ -1540,7 +1509,7 @@
15401509
"servers": [],
15411510
"components": {
15421511
"schemas": {
1543-
"HealthResponseDTO": {
1512+
"ResponseDTO": {
15441513
"type": "object",
15451514
"properties": {
15461515
"ok": {

src/baseSocket.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,36 @@ export abstract class BaseSocket {
102102
return chain;
103103
}
104104

105+
/**
106+
* get Balances for a user address
107+
* @param userAddress The user address
108+
*/
109+
async getBalances({userAddress}) {
110+
return await Balances.getBalances({userAddress})
111+
}
112+
113+
114+
/**
115+
* get Balance for a user address
116+
* @param tokenAddress The token address
117+
* @param chainId The chain id
118+
* @param userAddress The user address
119+
* @returns The balance
120+
*/
121+
122+
async getBalance({
123+
tokenAddress,
124+
chainId,
125+
userAddress,
126+
}) {
127+
return await Balances.getBalance({
128+
tokenAddress,
129+
chainId,
130+
userAddress,
131+
})
132+
}
133+
134+
105135
/**
106136
* Get the list of tokens available for each chain for a given path
107137
* @param options

src/client/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ export type { ChainDetails } from "./models/ChainDetails";
1717
export type { ChainGasBalances } from "./models/ChainGasBalances";
1818
export type { GasPriceResponseDTO } from "./models/GasPriceResponseDTO";
1919
export type { GasTokenDetails } from "./models/GasTokenDetails";
20-
export type { HealthResponseDTO } from "./models/HealthResponseDTO";
2120
export type { MinGasBalances } from "./models/MinGasBalances";
2221
export type { NextTxOutputDTO } from "./models/NextTxOutputDTO";
2322
export { NextTxResponse } from "./models/NextTxResponse";

src/client/services/Balances.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ export class Balances {
4343
return __request(OpenAPI, {
4444
method: "GET",
4545
url: "/v2/balances/token-balance",
46+
headers: {
47+
"API-KEY": OpenAPI.API_KEY,
48+
},
4649
query: {
4750
tokenAddress: tokenAddress,
4851
chainId: chainId,

src/client/services/Server.ts

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import type { BridgeStatusResponseDTO } from "../models/BridgeStatusResponseDTO";
22
import type { GasPriceResponseDTO } from "../models/GasPriceResponseDTO";
3-
import type { HealthResponseDTO } from "../models/HealthResponseDTO";
43
import type { SingleTxDTO } from "../models/SingleTxDTO";
54
import type { SingleTxOutputDTO } from "../models/SingleTxOutputDTO";
65
import type { TokenPriceResponseDTO } from "../models/TokenPriceResponseDTO";
@@ -13,27 +12,8 @@ import { BridgeName } from "../models/BridgeDetails";
1312
import { ChainId } from "../models/ChainId";
1413

1514
export class Server {
16-
/**
17-
* @returns HealthResponseDTO Health Check for Fund Movr API
18-
* @throws ApiError
19-
*/
20-
public static getHealth(): CancelablePromise<HealthResponseDTO> {
21-
return __request(OpenAPI, {
22-
method: "GET",
23-
url: "/v2/health",
24-
});
25-
}
2615

27-
/**
28-
* @returns any Health Check for Fund Movr API RPCS
29-
* @throws ApiError
30-
*/
31-
public static getHealthRpc(): CancelablePromise<any> {
32-
return __request(OpenAPI, {
33-
method: "GET",
34-
url: "/v2/health-rpc",
35-
});
36-
}
16+
3717

3818
/**
3919
* @returns GasPriceResponseDTO Current gas prices for a chain
@@ -51,6 +31,9 @@ export class Server {
5131
query: {
5232
chainId: chainId,
5333
},
34+
headers: {
35+
"API-KEY": OpenAPI.API_KEY,
36+
}
5437
});
5538
}
5639

@@ -70,6 +53,9 @@ export class Server {
7053
return __request(OpenAPI, {
7154
method: "GET",
7255
url: "/v2/token-price",
56+
headers: {
57+
"API-KEY": OpenAPI.API_KEY,
58+
},
7359
query: {
7460
tokenAddress: tokenAddress,
7561
chainId: chainId,

src/client/services/Supported.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ export class Supported {
1515
return __request(OpenAPI, {
1616
method: "GET",
1717
url: "/v2/supported/bridges",
18+
headers: {
19+
"API-KEY": OpenAPI.API_KEY,
20+
},
1821
});
1922
}
2023

0 commit comments

Comments
 (0)