@interest-protocol/vortex-sdk 11.1.0 → 11.3.0
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.js +25 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -14
- package/dist/index.mjs.map +1 -1
- package/dist/vortex-api.d.ts +3 -1
- package/dist/vortex-api.d.ts.map +1 -1
- package/dist/vortex-api.types.d.ts +7 -2
- package/dist/vortex-api.types.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/vortex-api.ts +41 -18
- package/src/vortex-api.types.ts +7 -2
package/dist/vortex-api.d.ts
CHANGED
|
@@ -8,7 +8,9 @@ export declare class VortexAPI {
|
|
|
8
8
|
hideAccounts(args: HideAccountsRequest): Promise<HideAccountsResponse>;
|
|
9
9
|
getPools(args?: GetPoolsArgs): Promise<PoolsResponse>;
|
|
10
10
|
getCommitments(args: GetCommitmentsArgs): Promise<CommitmentsResponse>;
|
|
11
|
-
getAllCommitments(args: Omit<GetCommitmentsArgs, 'page'>
|
|
11
|
+
getAllCommitments(args: Omit<GetCommitmentsArgs, 'page'> & {
|
|
12
|
+
sleepMs?: number;
|
|
13
|
+
}): Promise<Commitment[]>;
|
|
12
14
|
getMerklePath(args: MerklePathRequest): Promise<MerklePathResponse>;
|
|
13
15
|
executeTransaction(args: ExecuteTransactionRequest): Promise<TransactionResponse>;
|
|
14
16
|
getRelayer(): Promise<RelayerResponse>;
|
package/dist/vortex-api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vortex-api.d.ts","sourceRoot":"","sources":["../src/vortex-api.ts"],"names":[],"mappings":"AACA,OAAO,EACL,wBAAwB,EAExB,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,eAAe,EACf,mBAAmB,EACnB,oBAAoB,EACpB,aAAa,EACb,YAAY,EACZ,UAAU,EACV,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACj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;IAoBlB,aAAa,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAmBnE,kBAAkB,CACtB,IAAI,EAAE,yBAAyB,GAC9B,OAAO,CAAC,mBAAmB,CAAC;IAczB,UAAU,IAAI,OAAO,CAAC,eAAe,CAAC;CAuD7C;AAED,eAAO,MAAM,SAAS,WAAkB,CAAC"}
|
|
@@ -33,10 +33,12 @@ export interface AccountsResponse {
|
|
|
33
33
|
export interface GetAccountsArgs {
|
|
34
34
|
hashedSecret: string;
|
|
35
35
|
excludeHidden?: boolean;
|
|
36
|
+
apiKey?: string;
|
|
36
37
|
}
|
|
37
38
|
export interface CreateAccountRequest {
|
|
38
39
|
owner: string;
|
|
39
40
|
hashedSecret: string;
|
|
41
|
+
apiKey?: string;
|
|
40
42
|
}
|
|
41
43
|
export interface AccountResponse {
|
|
42
44
|
success: true;
|
|
@@ -45,7 +47,7 @@ export interface AccountResponse {
|
|
|
45
47
|
export interface HideAccountsRequest {
|
|
46
48
|
accountObjectIds?: string[];
|
|
47
49
|
hashedSecret?: string;
|
|
48
|
-
apiKey
|
|
50
|
+
apiKey?: string;
|
|
49
51
|
}
|
|
50
52
|
export interface HideAccountsResponse {
|
|
51
53
|
success: true;
|
|
@@ -81,6 +83,7 @@ export interface GetPoolsArgs {
|
|
|
81
83
|
page?: number;
|
|
82
84
|
limit?: number;
|
|
83
85
|
coinType?: string;
|
|
86
|
+
apiKey?: string;
|
|
84
87
|
}
|
|
85
88
|
export interface Commitment {
|
|
86
89
|
id: string;
|
|
@@ -107,6 +110,7 @@ export interface GetCommitmentsArgs {
|
|
|
107
110
|
op?: CommitmentsOperator;
|
|
108
111
|
page?: number;
|
|
109
112
|
limit?: number;
|
|
113
|
+
apiKey?: string;
|
|
110
114
|
}
|
|
111
115
|
export interface MerklePathRequest {
|
|
112
116
|
coinType: string;
|
|
@@ -115,6 +119,7 @@ export interface MerklePathRequest {
|
|
|
115
119
|
publicKey: string;
|
|
116
120
|
blinding: string;
|
|
117
121
|
vortexPool: string;
|
|
122
|
+
apiKey?: string;
|
|
118
123
|
}
|
|
119
124
|
export interface MerklePathResponse {
|
|
120
125
|
success: true;
|
|
@@ -125,7 +130,7 @@ export interface MerklePathResponse {
|
|
|
125
130
|
}
|
|
126
131
|
export interface ExecuteTransactionRequest {
|
|
127
132
|
txBytes: string;
|
|
128
|
-
apiKey
|
|
133
|
+
apiKey?: string;
|
|
129
134
|
}
|
|
130
135
|
export interface TransactionResponse {
|
|
131
136
|
success: true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vortex-api.types.d.ts","sourceRoot":"","sources":["../src/vortex-api.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,eAAO,MAAM,cAAc,6BAA6B,CAAC;AAEzD,MAAM,WAAW,wBAAwB;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,WAAW,CAAC;AAEpD,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,SAAS,GAAG,UAAU,CAAC;IAC/B,QAAQ,EAAE;QACR,OAAO,EAAE,aAAa,CAAC;QACvB,KAAK,EAAE,aAAa,CAAC;QACrB,GAAG,EAAE,aAAa,CAAC;KACpB,CAAC;IACF,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,IAAI,CAAC;IACd,IAAI,EAAE,YAAY,CAAC;CACpB;AAED,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;I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,yBAAyB;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,IAAI,CAAC;IACd,IAAI,EAAE;QACJ,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AAED,MAAM,WAAW,OAAO;IACtB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,IAAI,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,KAAK,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@interest-protocol/vortex-sdk",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.3.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"rimraf": "^6.0.1",
|
|
38
38
|
"ts-jest": "^29.1.1",
|
|
39
39
|
"tsup": "^8.3.5",
|
|
40
|
-
"@interest-protocol/
|
|
41
|
-
"@interest-protocol/
|
|
40
|
+
"@interest-protocol/prettier-config": "1.0.0",
|
|
41
|
+
"@interest-protocol/typescript-config": "1.0.0"
|
|
42
42
|
},
|
|
43
43
|
"publishConfig": {
|
|
44
44
|
"access": "public",
|
package/src/vortex-api.ts
CHANGED
|
@@ -46,7 +46,8 @@ export class VortexAPI {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
const response = await this.#get<AccountsResponse>(
|
|
49
|
-
`/api/v1/accounts?${params.toString()}
|
|
49
|
+
`/api/v1/accounts?${params.toString()}`,
|
|
50
|
+
args.apiKey
|
|
50
51
|
);
|
|
51
52
|
|
|
52
53
|
this.#assertSuccess(response);
|
|
@@ -55,10 +56,14 @@ export class VortexAPI {
|
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
async createAccount(args: CreateAccountRequest): Promise<AccountResponse> {
|
|
58
|
-
const response = await this.#post<AccountResponse>(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
const response = await this.#post<AccountResponse>(
|
|
60
|
+
'/api/v1/accounts',
|
|
61
|
+
{
|
|
62
|
+
owner: args.owner,
|
|
63
|
+
hashedSecret: args.hashedSecret,
|
|
64
|
+
},
|
|
65
|
+
args.apiKey
|
|
66
|
+
);
|
|
62
67
|
|
|
63
68
|
this.#assertSuccess(response);
|
|
64
69
|
|
|
@@ -105,7 +110,7 @@ export class VortexAPI {
|
|
|
105
110
|
const query = params.toString();
|
|
106
111
|
const path = query ? `/api/v1/pools?${query}` : '/api/v1/pools';
|
|
107
112
|
|
|
108
|
-
const response = await this.#get<PoolsResponse>(path);
|
|
113
|
+
const response = await this.#get<PoolsResponse>(path, args.apiKey);
|
|
109
114
|
|
|
110
115
|
this.#assertSuccess(response);
|
|
111
116
|
|
|
@@ -131,7 +136,8 @@ export class VortexAPI {
|
|
|
131
136
|
}
|
|
132
137
|
|
|
133
138
|
const response = await this.#get<CommitmentsResponse>(
|
|
134
|
-
`/api/v1/commitments?${params.toString()}
|
|
139
|
+
`/api/v1/commitments?${params.toString()}`,
|
|
140
|
+
args.apiKey
|
|
135
141
|
);
|
|
136
142
|
|
|
137
143
|
this.#assertSuccess(response);
|
|
@@ -140,17 +146,22 @@ export class VortexAPI {
|
|
|
140
146
|
}
|
|
141
147
|
|
|
142
148
|
async getAllCommitments(
|
|
143
|
-
args: Omit<GetCommitmentsArgs, 'page'>
|
|
149
|
+
args: Omit<GetCommitmentsArgs, 'page'> & { sleepMs?: number }
|
|
144
150
|
): Promise<Commitment[]> {
|
|
151
|
+
const sleepMs = Math.max(args.sleepMs ?? 200, 200);
|
|
145
152
|
const allCommitments: Commitment[] = [];
|
|
146
153
|
let page = 1;
|
|
147
154
|
let hasNext = true;
|
|
148
155
|
|
|
149
156
|
while (hasNext) {
|
|
150
|
-
const response = await this.getCommitments({ ...args, page });
|
|
157
|
+
const response = await this.getCommitments({ ...args, page, apiKey: args.apiKey });
|
|
151
158
|
allCommitments.push(...response.data.items);
|
|
152
159
|
hasNext = response.data.pagination.hasNext;
|
|
153
160
|
page++;
|
|
161
|
+
|
|
162
|
+
if (hasNext) {
|
|
163
|
+
await new Promise((resolve) => setTimeout(resolve, sleepMs));
|
|
164
|
+
}
|
|
154
165
|
}
|
|
155
166
|
|
|
156
167
|
return allCommitments;
|
|
@@ -166,7 +177,8 @@ export class VortexAPI {
|
|
|
166
177
|
public_key: args.publicKey,
|
|
167
178
|
blinding: args.blinding,
|
|
168
179
|
vortex_pool: args.vortexPool,
|
|
169
|
-
}
|
|
180
|
+
},
|
|
181
|
+
args.apiKey
|
|
170
182
|
);
|
|
171
183
|
|
|
172
184
|
this.#assertSuccess(response);
|
|
@@ -198,12 +210,18 @@ export class VortexAPI {
|
|
|
198
210
|
return response;
|
|
199
211
|
}
|
|
200
212
|
|
|
201
|
-
async #get<T>(path: string): Promise<ApiResponse<T>> {
|
|
213
|
+
async #get<T>(path: string, apiKey?: string): Promise<ApiResponse<T>> {
|
|
214
|
+
const headers: Record<string, string> = {
|
|
215
|
+
'Content-Type': 'application/json',
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
if (apiKey) {
|
|
219
|
+
headers['x-api-key'] = apiKey;
|
|
220
|
+
}
|
|
221
|
+
|
|
202
222
|
const response = await fetch(`${this.#apiUrl}${path}`, {
|
|
203
223
|
method: 'GET',
|
|
204
|
-
headers
|
|
205
|
-
'Content-Type': 'application/json',
|
|
206
|
-
},
|
|
224
|
+
headers,
|
|
207
225
|
});
|
|
208
226
|
|
|
209
227
|
return response.json() as Promise<ApiResponse<T>>;
|
|
@@ -214,12 +232,17 @@ export class VortexAPI {
|
|
|
214
232
|
body: Record<string, unknown>,
|
|
215
233
|
apiKey?: string
|
|
216
234
|
): Promise<ApiResponse<T>> {
|
|
235
|
+
const headers: Record<string, string> = {
|
|
236
|
+
'Content-Type': 'application/json',
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
if (apiKey) {
|
|
240
|
+
headers['x-api-key'] = apiKey;
|
|
241
|
+
}
|
|
242
|
+
|
|
217
243
|
const response = await fetch(`${this.#apiUrl}${path}`, {
|
|
218
244
|
method: 'POST',
|
|
219
|
-
headers
|
|
220
|
-
'Content-Type': 'application/json',
|
|
221
|
-
'x-api-key': apiKey ?? '',
|
|
222
|
-
},
|
|
245
|
+
headers,
|
|
223
246
|
body: JSON.stringify(body),
|
|
224
247
|
});
|
|
225
248
|
|
package/src/vortex-api.types.ts
CHANGED
|
@@ -41,11 +41,13 @@ export interface AccountsResponse {
|
|
|
41
41
|
export interface GetAccountsArgs {
|
|
42
42
|
hashedSecret: string;
|
|
43
43
|
excludeHidden?: boolean;
|
|
44
|
+
apiKey?: string;
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
export interface CreateAccountRequest {
|
|
47
48
|
owner: string;
|
|
48
49
|
hashedSecret: string;
|
|
50
|
+
apiKey?: string;
|
|
49
51
|
}
|
|
50
52
|
|
|
51
53
|
export interface AccountResponse {
|
|
@@ -56,7 +58,7 @@ export interface AccountResponse {
|
|
|
56
58
|
export interface HideAccountsRequest {
|
|
57
59
|
accountObjectIds?: string[];
|
|
58
60
|
hashedSecret?: string;
|
|
59
|
-
apiKey
|
|
61
|
+
apiKey?: string;
|
|
60
62
|
}
|
|
61
63
|
|
|
62
64
|
export interface HideAccountsResponse {
|
|
@@ -97,6 +99,7 @@ export interface GetPoolsArgs {
|
|
|
97
99
|
page?: number;
|
|
98
100
|
limit?: number;
|
|
99
101
|
coinType?: string;
|
|
102
|
+
apiKey?: string;
|
|
100
103
|
}
|
|
101
104
|
|
|
102
105
|
export interface Commitment {
|
|
@@ -127,6 +130,7 @@ export interface GetCommitmentsArgs {
|
|
|
127
130
|
op?: CommitmentsOperator;
|
|
128
131
|
page?: number;
|
|
129
132
|
limit?: number;
|
|
133
|
+
apiKey?: string;
|
|
130
134
|
}
|
|
131
135
|
|
|
132
136
|
export interface MerklePathRequest {
|
|
@@ -136,6 +140,7 @@ export interface MerklePathRequest {
|
|
|
136
140
|
publicKey: string;
|
|
137
141
|
blinding: string;
|
|
138
142
|
vortexPool: string;
|
|
143
|
+
apiKey?: string;
|
|
139
144
|
}
|
|
140
145
|
|
|
141
146
|
export interface MerklePathResponse {
|
|
@@ -148,7 +153,7 @@ export interface MerklePathResponse {
|
|
|
148
153
|
|
|
149
154
|
export interface ExecuteTransactionRequest {
|
|
150
155
|
txBytes: string;
|
|
151
|
-
apiKey
|
|
156
|
+
apiKey?: string;
|
|
152
157
|
}
|
|
153
158
|
|
|
154
159
|
export interface TransactionResponse {
|