@bulletxyz/bullet-sdk 0.19.1-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.
@@ -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
- UserAccount: createBaseResponse(
6801
- z.object({ user_accounts: z.array(Schemas.UserAccount) })
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({ markets: z.array(Schemas.BorrowLendMarket) })
6815
+ z.object({
6816
+ markets: createJsonMap(AssetId, Schemas.BorrowLendMarket)
6817
+ })
6818
6818
  ),
6819
6819
  PerpMarkets: createBaseResponse(
6820
- z.object({ markets: z.array(Schemas.PerpMarket) })
6820
+ z.object({ markets: createJsonMap(AssetId, Schemas.PerpMarket) })
6821
6821
  ),
6822
6822
  MarginConfig: StateResponseSchemas.StateValue(Schemas.MarginConfig),
6823
6823
  AccountAddresses: createBaseResponse(
@@ -7245,7 +7245,7 @@ var ExchangeConnection = class extends BaseConnection {
7245
7245
  const response = await this.fetchApiResource(path, {
7246
7246
  addresses: addresses.join(",")
7247
7247
  });
7248
- const parsed = ResponseSchemas.UserAccount.parse(response);
7248
+ const parsed = ResponseSchemas.UserAccounts.parse(response);
7249
7249
  return parsed.data.user_accounts;
7250
7250
  }
7251
7251
  async getPricing() {
@@ -7272,7 +7272,7 @@ var ExchangeConnection = class extends BaseConnection {
7272
7272
  )}`;
7273
7273
  const response = await this.fetchApiResource(path);
7274
7274
  const parsed = ResponseSchemas.BorrowLendMarkets.parse(response);
7275
- return new Map(asset_ids.map((id, i) => [id, parsed.data.markets[i]]));
7275
+ return parsed.data.markets;
7276
7276
  }
7277
7277
  async getPerpMarkets(asset_ids) {
7278
7278
  const path = `/modules/exchange/perp-markets?asset_ids=${asset_ids.join(
@@ -7280,7 +7280,7 @@ var ExchangeConnection = class extends BaseConnection {
7280
7280
  )}`;
7281
7281
  const response = await this.fetchApiResource(path);
7282
7282
  const parsed = ResponseSchemas.PerpMarkets.parse(response);
7283
- return new Map(asset_ids.map((id, i) => [id, parsed.data.markets[i]]));
7283
+ return parsed.data.markets;
7284
7284
  }
7285
7285
  async getMarginConfig() {
7286
7286
  const path = "/modules/exchange/state/margin";
@@ -8939,8 +8939,8 @@ var Client = class _Client {
8939
8939
  return await this.connection.getTokenBalance(this.wallet.address, tokenId);
8940
8940
  }
8941
8941
  async getUserAccount() {
8942
- const ua = await this.exchange.getUserAccounts([this.wallet.address]);
8943
- return ua[0];
8942
+ const userAccounts = await this.exchange.getUserAccounts([this.wallet.address]);
8943
+ return userAccounts.get(this.wallet.address);
8944
8944
  }
8945
8945
  async submitTransaction(runtimeCall) {
8946
8946
  const result = await this.queue.add(async () => {