@bulletxyz/bullet-sdk 0.19.0-rc.0 → 0.20.0-rc.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/browser/index.js +18 -14
- package/dist/browser/index.js.map +2 -2
- package/dist/node/index.js +18 -14
- package/dist/node/index.js.map +2 -2
- package/dist/types/client.d.ts +1 -1
- package/dist/types/exchange.d.ts +1 -1
- package/dist/types/zod-types/rest.d.ts +219 -31
- package/package.json +1 -1
package/dist/browser/index.js
CHANGED
|
@@ -6797,16 +6797,14 @@ var Schemas = {
|
|
|
6797
6797
|
var ResponseSchemas = {
|
|
6798
6798
|
DummyValue: StateResponseSchemas.StateValue(Schemas.DummyValue),
|
|
6799
6799
|
Order: StateResponseSchemas.StateMapElement(OrderId, Schemas.Order),
|
|
6800
|
-
|
|
6801
|
-
z.object({
|
|
6800
|
+
UserAccounts: createBaseResponse(
|
|
6801
|
+
z.object({
|
|
6802
|
+
user_accounts: createJsonMap(Base58Address, Schemas.UserAccount)
|
|
6803
|
+
})
|
|
6802
6804
|
),
|
|
6803
6805
|
Pricing: StateResponseSchemas.StateValue(Schemas.Pricing),
|
|
6804
6806
|
UsdcPnlPool: StateResponseSchemas.StateValue(Schemas.UsdcPnlPool),
|
|
6805
6807
|
UsdcInsuranceFund: StateResponseSchemas.StateValue(Schemas.UsdcInsuranceFund),
|
|
6806
|
-
// BorrowLendMarket: StateResponseSchemas.StateMapElement(
|
|
6807
|
-
// AssetId,
|
|
6808
|
-
// Schemas.BorrowLendMarket,
|
|
6809
|
-
// ),
|
|
6810
6808
|
PerpMarket: StateResponseSchemas.StateMapElement(AssetId, Schemas.PerpMarket),
|
|
6811
6809
|
OrderbookL2: createBaseResponse(
|
|
6812
6810
|
z.object({
|
|
@@ -6814,10 +6812,12 @@ var ResponseSchemas = {
|
|
|
6814
6812
|
})
|
|
6815
6813
|
),
|
|
6816
6814
|
BorrowLendMarkets: createBaseResponse(
|
|
6817
|
-
z.object({
|
|
6815
|
+
z.object({
|
|
6816
|
+
markets: createJsonMap(AssetId, Schemas.BorrowLendMarket)
|
|
6817
|
+
})
|
|
6818
6818
|
),
|
|
6819
6819
|
PerpMarkets: createBaseResponse(
|
|
6820
|
-
z.object({ markets:
|
|
6820
|
+
z.object({ markets: createJsonMap(AssetId, Schemas.PerpMarket) })
|
|
6821
6821
|
),
|
|
6822
6822
|
MarginConfig: StateResponseSchemas.StateValue(Schemas.MarginConfig),
|
|
6823
6823
|
AccountAddresses: createBaseResponse(
|
|
@@ -7063,8 +7063,12 @@ var WebSocketManager = class {
|
|
|
7063
7063
|
}
|
|
7064
7064
|
async connect() {
|
|
7065
7065
|
if (this.socket?.readyState === WebSocket.OPEN) return;
|
|
7066
|
-
|
|
7066
|
+
if (this.socket) {
|
|
7067
|
+
this.socket.close();
|
|
7068
|
+
this.socket = null;
|
|
7069
|
+
}
|
|
7067
7070
|
return new Promise((resolve, reject) => {
|
|
7071
|
+
this.socket = new WebSocket(this.url);
|
|
7068
7072
|
const timeout = setTimeout(() => {
|
|
7069
7073
|
reject(new Error("Connection timeout"));
|
|
7070
7074
|
this.socket?.close();
|
|
@@ -7241,7 +7245,7 @@ var ExchangeConnection = class extends BaseConnection {
|
|
|
7241
7245
|
const response = await this.fetchApiResource(path, {
|
|
7242
7246
|
addresses: addresses.join(",")
|
|
7243
7247
|
});
|
|
7244
|
-
const parsed = ResponseSchemas.
|
|
7248
|
+
const parsed = ResponseSchemas.UserAccounts.parse(response);
|
|
7245
7249
|
return parsed.data.user_accounts;
|
|
7246
7250
|
}
|
|
7247
7251
|
async getPricing() {
|
|
@@ -7268,7 +7272,7 @@ var ExchangeConnection = class extends BaseConnection {
|
|
|
7268
7272
|
)}`;
|
|
7269
7273
|
const response = await this.fetchApiResource(path);
|
|
7270
7274
|
const parsed = ResponseSchemas.BorrowLendMarkets.parse(response);
|
|
7271
|
-
return
|
|
7275
|
+
return parsed.data.markets;
|
|
7272
7276
|
}
|
|
7273
7277
|
async getPerpMarkets(asset_ids) {
|
|
7274
7278
|
const path = `/modules/exchange/perp-markets?asset_ids=${asset_ids.join(
|
|
@@ -7276,7 +7280,7 @@ var ExchangeConnection = class extends BaseConnection {
|
|
|
7276
7280
|
)}`;
|
|
7277
7281
|
const response = await this.fetchApiResource(path);
|
|
7278
7282
|
const parsed = ResponseSchemas.PerpMarkets.parse(response);
|
|
7279
|
-
return
|
|
7283
|
+
return parsed.data.markets;
|
|
7280
7284
|
}
|
|
7281
7285
|
async getMarginConfig() {
|
|
7282
7286
|
const path = "/modules/exchange/state/margin";
|
|
@@ -8935,8 +8939,8 @@ var Client = class _Client {
|
|
|
8935
8939
|
return await this.connection.getTokenBalance(this.wallet.address, tokenId);
|
|
8936
8940
|
}
|
|
8937
8941
|
async getUserAccount() {
|
|
8938
|
-
const
|
|
8939
|
-
return
|
|
8942
|
+
const userAccounts = await this.exchange.getUserAccounts([this.wallet.address]);
|
|
8943
|
+
return userAccounts.get(this.wallet.address);
|
|
8940
8944
|
}
|
|
8941
8945
|
async submitTransaction(runtimeCall) {
|
|
8942
8946
|
const result = await this.queue.add(async () => {
|