@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/index.mjs
CHANGED
|
@@ -39591,7 +39591,7 @@ class VortexAPI {
|
|
|
39591
39591
|
if (args.excludeHidden !== undefined) {
|
|
39592
39592
|
params.set('exclude_hidden', args.excludeHidden.toString());
|
|
39593
39593
|
}
|
|
39594
|
-
const response = await __classPrivateFieldGet(this, _VortexAPI_instances, "m", _VortexAPI_get).call(this, `/api/v1/accounts?${params.toString()}
|
|
39594
|
+
const response = await __classPrivateFieldGet(this, _VortexAPI_instances, "m", _VortexAPI_get).call(this, `/api/v1/accounts?${params.toString()}`, args.apiKey);
|
|
39595
39595
|
__classPrivateFieldGet(this, _VortexAPI_instances, "m", _VortexAPI_assertSuccess).call(this, response);
|
|
39596
39596
|
return response;
|
|
39597
39597
|
}
|
|
@@ -39599,7 +39599,7 @@ class VortexAPI {
|
|
|
39599
39599
|
const response = await __classPrivateFieldGet(this, _VortexAPI_instances, "m", _VortexAPI_post).call(this, '/api/v1/accounts', {
|
|
39600
39600
|
owner: args.owner,
|
|
39601
39601
|
hashedSecret: args.hashedSecret,
|
|
39602
|
-
});
|
|
39602
|
+
}, args.apiKey);
|
|
39603
39603
|
__classPrivateFieldGet(this, _VortexAPI_instances, "m", _VortexAPI_assertSuccess).call(this, response);
|
|
39604
39604
|
return response;
|
|
39605
39605
|
}
|
|
@@ -39628,7 +39628,7 @@ class VortexAPI {
|
|
|
39628
39628
|
}
|
|
39629
39629
|
const query = params.toString();
|
|
39630
39630
|
const path = query ? `/api/v1/pools?${query}` : '/api/v1/pools';
|
|
39631
|
-
const response = await __classPrivateFieldGet(this, _VortexAPI_instances, "m", _VortexAPI_get).call(this, path);
|
|
39631
|
+
const response = await __classPrivateFieldGet(this, _VortexAPI_instances, "m", _VortexAPI_get).call(this, path, args.apiKey);
|
|
39632
39632
|
__classPrivateFieldGet(this, _VortexAPI_instances, "m", _VortexAPI_assertSuccess).call(this, response);
|
|
39633
39633
|
return response;
|
|
39634
39634
|
}
|
|
@@ -39646,19 +39646,23 @@ class VortexAPI {
|
|
|
39646
39646
|
if (args.limit) {
|
|
39647
39647
|
params.set('limit', args.limit.toString());
|
|
39648
39648
|
}
|
|
39649
|
-
const response = await __classPrivateFieldGet(this, _VortexAPI_instances, "m", _VortexAPI_get).call(this, `/api/v1/commitments?${params.toString()}
|
|
39649
|
+
const response = await __classPrivateFieldGet(this, _VortexAPI_instances, "m", _VortexAPI_get).call(this, `/api/v1/commitments?${params.toString()}`, args.apiKey);
|
|
39650
39650
|
__classPrivateFieldGet(this, _VortexAPI_instances, "m", _VortexAPI_assertSuccess).call(this, response);
|
|
39651
39651
|
return response;
|
|
39652
39652
|
}
|
|
39653
39653
|
async getAllCommitments(args) {
|
|
39654
|
+
const sleepMs = Math.max(args.sleepMs ?? 200, 200);
|
|
39654
39655
|
const allCommitments = [];
|
|
39655
39656
|
let page = 1;
|
|
39656
39657
|
let hasNext = true;
|
|
39657
39658
|
while (hasNext) {
|
|
39658
|
-
const response = await this.getCommitments({ ...args, page });
|
|
39659
|
+
const response = await this.getCommitments({ ...args, page, apiKey: args.apiKey });
|
|
39659
39660
|
allCommitments.push(...response.data.items);
|
|
39660
39661
|
hasNext = response.data.pagination.hasNext;
|
|
39661
39662
|
page++;
|
|
39663
|
+
if (hasNext) {
|
|
39664
|
+
await new Promise((resolve) => setTimeout(resolve, sleepMs));
|
|
39665
|
+
}
|
|
39662
39666
|
}
|
|
39663
39667
|
return allCommitments;
|
|
39664
39668
|
}
|
|
@@ -39670,7 +39674,7 @@ class VortexAPI {
|
|
|
39670
39674
|
public_key: args.publicKey,
|
|
39671
39675
|
blinding: args.blinding,
|
|
39672
39676
|
vortex_pool: args.vortexPool,
|
|
39673
|
-
});
|
|
39677
|
+
}, args.apiKey);
|
|
39674
39678
|
__classPrivateFieldGet(this, _VortexAPI_instances, "m", _VortexAPI_assertSuccess).call(this, response);
|
|
39675
39679
|
return response;
|
|
39676
39680
|
}
|
|
@@ -39687,21 +39691,28 @@ class VortexAPI {
|
|
|
39687
39691
|
return response;
|
|
39688
39692
|
}
|
|
39689
39693
|
}
|
|
39690
|
-
_VortexAPI_apiUrl = new WeakMap(), _VortexAPI_instances = new WeakSet(), _VortexAPI_get = async function _VortexAPI_get(path) {
|
|
39694
|
+
_VortexAPI_apiUrl = new WeakMap(), _VortexAPI_instances = new WeakSet(), _VortexAPI_get = async function _VortexAPI_get(path, apiKey) {
|
|
39695
|
+
const headers = {
|
|
39696
|
+
'Content-Type': 'application/json',
|
|
39697
|
+
};
|
|
39698
|
+
if (apiKey) {
|
|
39699
|
+
headers['x-api-key'] = apiKey;
|
|
39700
|
+
}
|
|
39691
39701
|
const response = await fetch(`${__classPrivateFieldGet(this, _VortexAPI_apiUrl, "f")}${path}`, {
|
|
39692
39702
|
method: 'GET',
|
|
39693
|
-
headers
|
|
39694
|
-
'Content-Type': 'application/json',
|
|
39695
|
-
},
|
|
39703
|
+
headers,
|
|
39696
39704
|
});
|
|
39697
39705
|
return response.json();
|
|
39698
39706
|
}, _VortexAPI_post = async function _VortexAPI_post(path, body, apiKey) {
|
|
39707
|
+
const headers = {
|
|
39708
|
+
'Content-Type': 'application/json',
|
|
39709
|
+
};
|
|
39710
|
+
if (apiKey) {
|
|
39711
|
+
headers['x-api-key'] = apiKey;
|
|
39712
|
+
}
|
|
39699
39713
|
const response = await fetch(`${__classPrivateFieldGet(this, _VortexAPI_apiUrl, "f")}${path}`, {
|
|
39700
39714
|
method: 'POST',
|
|
39701
|
-
headers
|
|
39702
|
-
'Content-Type': 'application/json',
|
|
39703
|
-
'x-api-key': apiKey ?? '',
|
|
39704
|
-
},
|
|
39715
|
+
headers,
|
|
39705
39716
|
body: JSON.stringify(body),
|
|
39706
39717
|
});
|
|
39707
39718
|
return response.json();
|