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