@bulletxyz/bullet-sdk 0.19.1-rc.0 → 0.20.0-rc.1

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.
@@ -6797,27 +6797,30 @@ var Schemas = {
6797
6797
  var ResponseSchemas = {
6798
6798
  DummyValue: StateResponseSchemas.StateValue(Schemas.DummyValue),
6799
6799
  Order: StateResponseSchemas.StateMapElement(OrderId, Schemas.Order),
6800
- UserAccount: createBaseResponse(
6801
- z.object({ user_accounts: z.array(Schemas.UserAccount) })
6802
- ),
6803
6800
  Pricing: StateResponseSchemas.StateValue(Schemas.Pricing),
6804
6801
  UsdcPnlPool: StateResponseSchemas.StateValue(Schemas.UsdcPnlPool),
6805
6802
  UsdcInsuranceFund: StateResponseSchemas.StateValue(Schemas.UsdcInsuranceFund),
6806
- // BorrowLendMarket: StateResponseSchemas.StateMapElement(
6807
- // AssetId,
6808
- // Schemas.BorrowLendMarket,
6809
- // ),
6810
6803
  PerpMarket: StateResponseSchemas.StateMapElement(AssetId, Schemas.PerpMarket),
6811
6804
  OrderbookL2: createBaseResponse(
6812
6805
  z.object({
6813
6806
  orderbook_l2: Schemas.OrderbookL2
6814
6807
  })
6815
6808
  ),
6809
+ UserAccounts: createBaseResponse(
6810
+ z.object({
6811
+ user_accounts: createJsonMap(
6812
+ Base58Address,
6813
+ Schemas.UserAccount.nullable()
6814
+ )
6815
+ })
6816
+ ),
6816
6817
  BorrowLendMarkets: createBaseResponse(
6817
- z.object({ markets: z.array(Schemas.BorrowLendMarket) })
6818
+ z.object({
6819
+ markets: createJsonMap(AssetId, Schemas.BorrowLendMarket.nullable())
6820
+ })
6818
6821
  ),
6819
6822
  PerpMarkets: createBaseResponse(
6820
- z.object({ markets: z.array(Schemas.PerpMarket) })
6823
+ z.object({ markets: createJsonMap(AssetId, Schemas.PerpMarket.nullable()) })
6821
6824
  ),
6822
6825
  MarginConfig: StateResponseSchemas.StateValue(Schemas.MarginConfig),
6823
6826
  AccountAddresses: createBaseResponse(
@@ -7245,7 +7248,7 @@ var ExchangeConnection = class extends BaseConnection {
7245
7248
  const response = await this.fetchApiResource(path, {
7246
7249
  addresses: addresses.join(",")
7247
7250
  });
7248
- const parsed = ResponseSchemas.UserAccount.parse(response);
7251
+ const parsed = ResponseSchemas.UserAccounts.parse(response);
7249
7252
  return parsed.data.user_accounts;
7250
7253
  }
7251
7254
  async getPricing() {
@@ -7272,7 +7275,7 @@ var ExchangeConnection = class extends BaseConnection {
7272
7275
  )}`;
7273
7276
  const response = await this.fetchApiResource(path);
7274
7277
  const parsed = ResponseSchemas.BorrowLendMarkets.parse(response);
7275
- return new Map(asset_ids.map((id, i) => [id, parsed.data.markets[i]]));
7278
+ return parsed.data.markets;
7276
7279
  }
7277
7280
  async getPerpMarkets(asset_ids) {
7278
7281
  const path = `/modules/exchange/perp-markets?asset_ids=${asset_ids.join(
@@ -7280,7 +7283,7 @@ var ExchangeConnection = class extends BaseConnection {
7280
7283
  )}`;
7281
7284
  const response = await this.fetchApiResource(path);
7282
7285
  const parsed = ResponseSchemas.PerpMarkets.parse(response);
7283
- return new Map(asset_ids.map((id, i) => [id, parsed.data.markets[i]]));
7286
+ return parsed.data.markets;
7284
7287
  }
7285
7288
  async getMarginConfig() {
7286
7289
  const path = "/modules/exchange/state/margin";
@@ -8953,8 +8956,8 @@ var Client = class _Client {
8953
8956
  return await this.connection.getTokenBalance(this.wallet.address, tokenId);
8954
8957
  }
8955
8958
  async getUserAccount() {
8956
- const ua = await this.exchange.getUserAccounts([this.wallet.address]);
8957
- return ua[0];
8959
+ const userAccounts = await this.exchange.getUserAccounts([this.wallet.address]);
8960
+ return userAccounts.get(this.wallet.address);
8958
8961
  }
8959
8962
  async submitTransaction(runtimeCall) {
8960
8963
  const result = await this.queue.add(async () => {