@carrot-protocol/boost-http-client 0.1.1 → 0.1.2-test-api-dev-7e625dc
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.
- package/dist/index.d.ts +5 -0
- package/dist/index.js +10 -1
- package/package.json +1 -1
- package/src/index.ts +11 -1
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,11 @@ export declare class Client {
|
|
|
14
14
|
*/
|
|
15
15
|
constructor(baseUrl: string, provider?: AnchorProvider);
|
|
16
16
|
private send;
|
|
17
|
+
/**
|
|
18
|
+
* Get index details
|
|
19
|
+
* @returns Index details
|
|
20
|
+
*/
|
|
21
|
+
index(): Promise<any>;
|
|
17
22
|
/**
|
|
18
23
|
* Get obligation details for a wallet
|
|
19
24
|
* @param owner Owner wallet public key
|
package/dist/index.js
CHANGED
|
@@ -63,6 +63,15 @@ class Client {
|
|
|
63
63
|
// return txsig
|
|
64
64
|
return bs58_1.default.encode(txSig);
|
|
65
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Get index details
|
|
68
|
+
* @returns Index details
|
|
69
|
+
*/
|
|
70
|
+
async index() {
|
|
71
|
+
const response = await this.http.get(`${this.baseUrl}`);
|
|
72
|
+
handleStatusCode(response.status);
|
|
73
|
+
return JSON.stringify(response.data);
|
|
74
|
+
}
|
|
66
75
|
/**
|
|
67
76
|
* Get obligation details for a wallet
|
|
68
77
|
* @param owner Owner wallet public key
|
|
@@ -125,7 +134,7 @@ function handleStatusCode(statusCode) {
|
|
|
125
134
|
case 200:
|
|
126
135
|
break;
|
|
127
136
|
default:
|
|
128
|
-
throw new Error(`unexpected status code${statusCode}`);
|
|
137
|
+
throw new Error(`unexpected status code: ${statusCode}`);
|
|
129
138
|
}
|
|
130
139
|
}
|
|
131
140
|
// Ensures that a provider is defined
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -68,6 +68,16 @@ export class Client {
|
|
|
68
68
|
return encode.encode(txSig);
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
/**
|
|
72
|
+
* Get index details
|
|
73
|
+
* @returns Index details
|
|
74
|
+
*/
|
|
75
|
+
async index(): Promise<any> {
|
|
76
|
+
const response = await this.http.get(`${this.baseUrl}`);
|
|
77
|
+
handleStatusCode(response.status);
|
|
78
|
+
return JSON.stringify(response.data);
|
|
79
|
+
}
|
|
80
|
+
|
|
71
81
|
/**
|
|
72
82
|
* Get obligation details for a wallet
|
|
73
83
|
* @param owner Owner wallet public key
|
|
@@ -147,7 +157,7 @@ function handleStatusCode(statusCode: number): void {
|
|
|
147
157
|
case 200:
|
|
148
158
|
break;
|
|
149
159
|
default:
|
|
150
|
-
throw new Error(`unexpected status code${statusCode}`);
|
|
160
|
+
throw new Error(`unexpected status code: ${statusCode}`);
|
|
151
161
|
}
|
|
152
162
|
}
|
|
153
163
|
|