@bulletxyz/bullet-sdk 0.21.0-rc.5 → 0.21.0-rc.7
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/browser/index.js +19 -12
- package/dist/browser/index.js.map +2 -2
- package/dist/node/index.js +19 -12
- package/dist/node/index.js.map +2 -2
- package/dist/types/connection.d.ts +1 -1
- package/dist/types/exchange.d.ts +2 -2
- package/dist/types/zod-types/rest.d.ts +29 -5
- package/package.json +9 -9
package/dist/browser/index.js
CHANGED
|
@@ -6795,6 +6795,11 @@ var Schemas = {
|
|
|
6795
6795
|
}),
|
|
6796
6796
|
Assets: z.object({
|
|
6797
6797
|
assets: createJsonMap(AssetId, z.string())
|
|
6798
|
+
}),
|
|
6799
|
+
AccountAddresses: z.object({
|
|
6800
|
+
addresses: z.array(Base58Address),
|
|
6801
|
+
total: z.number(),
|
|
6802
|
+
next_offset: z.number().nullable()
|
|
6798
6803
|
})
|
|
6799
6804
|
};
|
|
6800
6805
|
var ResponseSchemas = {
|
|
@@ -6853,11 +6858,7 @@ var ResponseSchemas = {
|
|
|
6853
6858
|
})
|
|
6854
6859
|
),
|
|
6855
6860
|
MarginConfig: StateResponseSchemas.StateValue(Schemas.MarginConfig),
|
|
6856
|
-
AccountAddresses: createBaseResponse(
|
|
6857
|
-
z.object({
|
|
6858
|
-
accounts: z.array(Base58Address)
|
|
6859
|
-
})
|
|
6860
|
-
),
|
|
6861
|
+
AccountAddresses: createBaseResponse(Schemas.AccountAddresses),
|
|
6861
6862
|
Assets: StateResponseSchemas.CustomRouteValue(Schemas.Assets)
|
|
6862
6863
|
};
|
|
6863
6864
|
|
|
@@ -6877,9 +6878,12 @@ var BaseConnection = class {
|
|
|
6877
6878
|
const url = new URL(path, this.endpoint);
|
|
6878
6879
|
if (params) {
|
|
6879
6880
|
for (const [key, value] of Object.entries(params)) {
|
|
6880
|
-
|
|
6881
|
+
if (value !== void 0) {
|
|
6882
|
+
url.searchParams.append(key, value);
|
|
6883
|
+
}
|
|
6881
6884
|
}
|
|
6882
6885
|
}
|
|
6886
|
+
console.debug("Fetching resource: ", url.toString());
|
|
6883
6887
|
const response = await fetch(url.toString());
|
|
6884
6888
|
if (!response.ok) {
|
|
6885
6889
|
throw await ApiError.fromResponse(response);
|
|
@@ -7298,11 +7302,14 @@ var ExchangeConnection = class extends BaseConnection {
|
|
|
7298
7302
|
const parsed = ResponseSchemas.OrderbookL2Bulk.parse(response);
|
|
7299
7303
|
return parsed.data.found;
|
|
7300
7304
|
}
|
|
7301
|
-
async getUserAccountAddresses(start
|
|
7302
|
-
const path = `/modules/exchange/api/v1/account/addresses
|
|
7303
|
-
const response = await this.fetchApiResource(path
|
|
7305
|
+
async getUserAccountAddresses(start, limit) {
|
|
7306
|
+
const path = `/modules/exchange/api/v1/account/addresses`;
|
|
7307
|
+
const response = await this.fetchApiResource(path, {
|
|
7308
|
+
from: start?.toString(),
|
|
7309
|
+
limit: limit?.toString()
|
|
7310
|
+
});
|
|
7304
7311
|
const parsed = ResponseSchemas.AccountAddresses.parse(response);
|
|
7305
|
-
return parsed.data
|
|
7312
|
+
return parsed.data;
|
|
7306
7313
|
}
|
|
7307
7314
|
async getUserAccount(address) {
|
|
7308
7315
|
const path = `/modules/exchange/api/v1/account/${address}`;
|
|
@@ -7378,14 +7385,14 @@ var ExchangeConnection = class extends BaseConnection {
|
|
|
7378
7385
|
}
|
|
7379
7386
|
// TODO: handle 404
|
|
7380
7387
|
async getPerpAssets() {
|
|
7381
|
-
const path = "/modules/exchange/perp-market/assets";
|
|
7388
|
+
const path = "/modules/exchange/api/v1/perp-market/assets";
|
|
7382
7389
|
const response = await this.fetchApiResource(path);
|
|
7383
7390
|
const parsed = ResponseSchemas.Assets.parse(response);
|
|
7384
7391
|
return parsed.data.assets;
|
|
7385
7392
|
}
|
|
7386
7393
|
// TODO: handle 404
|
|
7387
7394
|
async getBorrowLendAssets() {
|
|
7388
|
-
const path = "/modules/exchange/borrow-lend-market/assets";
|
|
7395
|
+
const path = "/modules/exchange/api/v1/borrow-lend-market/assets";
|
|
7389
7396
|
const response = await this.fetchApiResource(path);
|
|
7390
7397
|
const parsed = ResponseSchemas.Assets.parse(response);
|
|
7391
7398
|
return parsed.data.assets;
|