ault-sdk-ts 0.17.0 → 0.18.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 CHANGED
@@ -5,7 +5,7 @@ var __export = (target, all) => {
5
5
  };
6
6
 
7
7
  // src/core/user-agent.ts
8
- var SDK_VERSION = "0.17.0";
8
+ var SDK_VERSION = "0.18.0";
9
9
  var USER_AGENT = `ault-sdk-ts/${SDK_VERSION}`;
10
10
  function isServerRuntime() {
11
11
  if (typeof document !== "undefined") return false;
@@ -181,6 +181,16 @@ var TxConfirmationUnavailableError = class extends TxError {
181
181
  this.name = "TxConfirmationUnavailableError";
182
182
  }
183
183
  };
184
+ var SignerMismatchError = class extends Error {
185
+ constructor(params) {
186
+ super(
187
+ params.message ?? `The wallet's signature does not match ${params.signerAddress}` + (params.recoveredAddress ? `: it recovers to ${params.recoveredAddress}.` : ".") + " The wallet signed with another account or hashed the EIP-712 payload differently."
188
+ );
189
+ this.name = "SignerMismatchError";
190
+ this.signerAddress = params.signerAddress;
191
+ this.recoveredAddress = params.recoveredAddress;
192
+ }
193
+ };
184
194
  var MissingMsgResponseError = class extends Error {
185
195
  constructor(typeUrl, txHash) {
186
196
  super(
@@ -489,7 +499,7 @@ var GAS_CONSTANTS = {
489
499
  REVOKE_BUILDER: 57e3,
490
500
  SET_REFERRAL_CODE: 76e3,
491
501
  SET_REFERRAL: 8e4,
492
- // CLOB module — mirror the chain's x/clob MinGasLimit* (agent_msg.go, v3.0.0-rc.3) exactly:
502
+ // CLOB module — mirror the chain's x/clob MinGasLimit* (agent_msg.go, v3.0.0-rc.5) exactly:
493
503
  // the agent ante enforces MinGasLimit ≤ gas ≤ MinGasLimit×1.2, so any drift
494
504
  // makes the SDK over- or under-shoot that window.
495
505
  LIMIT_ORDER: 155e3,
@@ -503,10 +513,10 @@ var GAS_CONSTANTS = {
503
513
  MODIFY_ORDER_PER_ID: 155e3,
504
514
  // Conditional and group orders (v3.0.0-rc.3). Modifying conditionals prices
505
515
  // each order on top of the base; a group order is flat whatever its shape.
506
- CONDITIONAL_ORDER: 125e3,
516
+ CONDITIONAL_ORDER: 14e4,
507
517
  MODIFY_CONDITIONAL_BASE: 55e3,
508
518
  MODIFY_CONDITIONAL_PER_ORDER: 49e3,
509
- GROUP_ORDER: 222e3,
519
+ GROUP_ORDER: 254e3,
510
520
  // Accountx module
511
521
  OPEN_ACCOUNT: 96e3,
512
522
  // Perpetual module (chain v3) — since v3.0.0-rc.2 every fee-free perpetual
@@ -525,25 +535,25 @@ var GAS_CONSTANTS = {
525
535
  // is not fee-free; its builder simulates like staking.
526
536
  LENDING_SUPPLY: 122e3,
527
537
  LENDING_WITHDRAW: 115e3,
528
- LENDING_SUPPLY_COLLATERAL: 11e4,
529
- LENDING_WITHDRAW_COLLATERAL: 24e4,
530
- LENDING_BORROW: 26e4,
538
+ LENDING_SUPPLY_COLLATERAL: 115e3,
539
+ LENDING_WITHDRAW_COLLATERAL: 26e4,
540
+ LENDING_BORROW: 28e4,
531
541
  LENDING_REPAY: 1e5,
532
- LENDING_LIQUIDATE: 43e4,
542
+ LENDING_LIQUIDATE: 49e4,
533
543
  LENDING_FUND_INSURANCE_FUND: 15e4,
534
544
  // Margin module (x/margin/types/fee_free.go). Deposit and withdraw price
535
545
  // each coin on top of the base.
536
546
  MARGIN_DEPOSIT_BASE: 88e3,
537
- MARGIN_DEPOSIT_PER_COIN: 46e3,
547
+ MARGIN_DEPOSIT_PER_COIN: 53e3,
538
548
  MARGIN_WITHDRAW_BASE: 74e3,
539
- MARGIN_WITHDRAW_PER_COIN: 18e4,
540
- MARGIN_BORROW: 227e3,
549
+ MARGIN_WITHDRAW_PER_COIN: 21e4,
550
+ MARGIN_BORROW: 25e4,
541
551
  MARGIN_REPAY: 259e3,
542
552
  // Vault module (x/vault/types/fee_free.go). A trading vault's creation adds
543
553
  // a per-market cost to its base, a lending vault's a per-pool cost to its own.
544
- VAULT_CREATE_TRADING_BASE: 19e4,
554
+ VAULT_CREATE_TRADING_BASE: 22e4,
545
555
  VAULT_CREATE_PER_MARKET: 9e3,
546
- VAULT_CREATE_LENDING_BASE: 124e3,
556
+ VAULT_CREATE_LENDING_BASE: 16e4,
547
557
  VAULT_CREATE_PER_LENDING_POOL: 7e3,
548
558
  VAULT_UPDATE_MANAGER: 95e3,
549
559
  // A config update is priced like creation: per spot market or per pool.
@@ -4580,6 +4590,7 @@ var EIP712_MSG_TYPES = {
4580
4590
  { name: "manager", type: "string" },
4581
4591
  { name: "initial_deposit", type: "NESTED", jsName: "initialDeposit" },
4582
4592
  { name: "fund_window", type: "NESTED", jsName: "fundWindow" },
4593
+ { name: "description", type: "NESTED" },
4583
4594
  { name: "Terms", type: "NESTED", oneof: true },
4584
4595
  { name: "Config", type: "NESTED", oneof: true }
4585
4596
  ],
@@ -4588,6 +4599,10 @@ var EIP712_MSG_TYPES = {
4588
4599
  { name: "value", type: "NESTED" },
4589
4600
  { name: "type", type: "string" }
4590
4601
  ],
4602
+ description: [
4603
+ { name: "name", type: "string" },
4604
+ { name: "details", type: "string" }
4605
+ ],
4591
4606
  fund_window: [
4592
4607
  { name: "redemption_open_time", type: "string", jsName: "redemptionOpenTime" },
4593
4608
  { name: "deposit_open_time", type: "string", jsName: "depositOpenTime" },
@@ -9093,11 +9108,11 @@ function createBaseAsset() {
9093
9108
  maxBonus: "",
9094
9109
  kinks: [],
9095
9110
  rates: [],
9096
- supplyCap: "",
9111
+ collateralCap: "",
9097
9112
  borrowCap: "",
9098
9113
  oracleAsset: "",
9099
9114
  spotMarketId: new Uint8Array(0),
9100
- spotQuoteOracleDenom: ""
9115
+ availableAt: 0n
9101
9116
  };
9102
9117
  }
9103
9118
  var Asset = {
@@ -9123,8 +9138,8 @@ var Asset = {
9123
9138
  for (const v of message.rates) {
9124
9139
  writer.uint32(58).string(v);
9125
9140
  }
9126
- if (message.supplyCap !== "") {
9127
- writer.uint32(66).string(message.supplyCap);
9141
+ if (message.collateralCap !== "") {
9142
+ writer.uint32(66).string(message.collateralCap);
9128
9143
  }
9129
9144
  if (message.borrowCap !== "") {
9130
9145
  writer.uint32(74).string(message.borrowCap);
@@ -9135,8 +9150,13 @@ var Asset = {
9135
9150
  if (message.spotMarketId.length !== 0) {
9136
9151
  writer.uint32(90).bytes(message.spotMarketId);
9137
9152
  }
9138
- if (message.spotQuoteOracleDenom !== "") {
9139
- writer.uint32(98).string(message.spotQuoteOracleDenom);
9153
+ if (message.availableAt !== 0n) {
9154
+ if (BigInt.asIntN(64, message.availableAt) !== message.availableAt) {
9155
+ throw new globalThis.Error(
9156
+ "value provided for field message.availableAt of type int64 too large"
9157
+ );
9158
+ }
9159
+ writer.uint32(104).int64(message.availableAt);
9140
9160
  }
9141
9161
  return writer;
9142
9162
  },
@@ -9200,7 +9220,7 @@ var Asset = {
9200
9220
  if (tag !== 66) {
9201
9221
  break;
9202
9222
  }
9203
- message.supplyCap = reader.string();
9223
+ message.collateralCap = reader.string();
9204
9224
  continue;
9205
9225
  }
9206
9226
  case 9: {
@@ -9224,11 +9244,11 @@ var Asset = {
9224
9244
  message.spotMarketId = reader.bytes();
9225
9245
  continue;
9226
9246
  }
9227
- case 12: {
9228
- if (tag !== 98) {
9247
+ case 13: {
9248
+ if (tag !== 104) {
9229
9249
  break;
9230
9250
  }
9231
- message.spotQuoteOracleDenom = reader.string();
9251
+ message.availableAt = reader.int64();
9232
9252
  continue;
9233
9253
  }
9234
9254
  }
@@ -9248,11 +9268,11 @@ var Asset = {
9248
9268
  maxBonus: isSet19(object2.maxBonus) ? globalThis.String(object2.maxBonus) : isSet19(object2.max_bonus) ? globalThis.String(object2.max_bonus) : "",
9249
9269
  kinks: globalThis.Array.isArray(object2?.kinks) ? object2.kinks.map((e) => globalThis.String(e)) : [],
9250
9270
  rates: globalThis.Array.isArray(object2?.rates) ? object2.rates.map((e) => globalThis.String(e)) : [],
9251
- supplyCap: isSet19(object2.supplyCap) ? globalThis.String(object2.supplyCap) : isSet19(object2.supply_cap) ? globalThis.String(object2.supply_cap) : "",
9271
+ collateralCap: isSet19(object2.collateralCap) ? globalThis.String(object2.collateralCap) : isSet19(object2.collateral_cap) ? globalThis.String(object2.collateral_cap) : "",
9252
9272
  borrowCap: isSet19(object2.borrowCap) ? globalThis.String(object2.borrowCap) : isSet19(object2.borrow_cap) ? globalThis.String(object2.borrow_cap) : "",
9253
9273
  oracleAsset: isSet19(object2.oracleAsset) ? globalThis.String(object2.oracleAsset) : isSet19(object2.oracle_asset) ? globalThis.String(object2.oracle_asset) : "",
9254
9274
  spotMarketId: isSet19(object2.spotMarketId) ? bytesFromBase646(object2.spotMarketId) : isSet19(object2.spot_market_id) ? bytesFromBase646(object2.spot_market_id) : new Uint8Array(0),
9255
- spotQuoteOracleDenom: isSet19(object2.spotQuoteOracleDenom) ? globalThis.String(object2.spotQuoteOracleDenom) : isSet19(object2.spot_quote_oracle_denom) ? globalThis.String(object2.spot_quote_oracle_denom) : ""
9275
+ availableAt: isSet19(object2.availableAt) ? BigInt(object2.availableAt) : isSet19(object2.available_at) ? BigInt(object2.available_at) : 0n
9256
9276
  };
9257
9277
  },
9258
9278
  toJSON(message) {
@@ -9278,8 +9298,8 @@ var Asset = {
9278
9298
  if (message.rates?.length) {
9279
9299
  obj.rates = message.rates;
9280
9300
  }
9281
- if (message.supplyCap !== "") {
9282
- obj.supplyCap = message.supplyCap;
9301
+ if (message.collateralCap !== "") {
9302
+ obj.collateralCap = message.collateralCap;
9283
9303
  }
9284
9304
  if (message.borrowCap !== "") {
9285
9305
  obj.borrowCap = message.borrowCap;
@@ -9290,8 +9310,8 @@ var Asset = {
9290
9310
  if (message.spotMarketId.length !== 0) {
9291
9311
  obj.spotMarketId = base64FromBytes6(message.spotMarketId);
9292
9312
  }
9293
- if (message.spotQuoteOracleDenom !== "") {
9294
- obj.spotQuoteOracleDenom = message.spotQuoteOracleDenom;
9313
+ if (message.availableAt !== 0n) {
9314
+ obj.availableAt = message.availableAt.toString();
9295
9315
  }
9296
9316
  return obj;
9297
9317
  },
@@ -9307,22 +9327,16 @@ var Asset = {
9307
9327
  message.maxBonus = object2.maxBonus ?? "";
9308
9328
  message.kinks = object2.kinks?.map((e) => e) || [];
9309
9329
  message.rates = object2.rates?.map((e) => e) || [];
9310
- message.supplyCap = object2.supplyCap ?? "";
9330
+ message.collateralCap = object2.collateralCap ?? "";
9311
9331
  message.borrowCap = object2.borrowCap ?? "";
9312
9332
  message.oracleAsset = object2.oracleAsset ?? "";
9313
9333
  message.spotMarketId = object2.spotMarketId ?? new Uint8Array(0);
9314
- message.spotQuoteOracleDenom = object2.spotQuoteOracleDenom ?? "";
9334
+ message.availableAt = object2.availableAt ?? 0n;
9315
9335
  return message;
9316
9336
  }
9317
9337
  };
9318
9338
  function createBaseAssetRisk() {
9319
- return {
9320
- ltv: "",
9321
- lt: "",
9322
- oracleAsset: "",
9323
- spotMarketId: new Uint8Array(0),
9324
- spotQuoteOracleDenom: ""
9325
- };
9339
+ return { ltv: "", lt: "", spotMarketId: new Uint8Array(0) };
9326
9340
  }
9327
9341
  var AssetRisk = {
9328
9342
  encode(message, writer = new BinaryWriter21()) {
@@ -9332,15 +9346,9 @@ var AssetRisk = {
9332
9346
  if (message.lt !== "") {
9333
9347
  writer.uint32(18).string(message.lt);
9334
9348
  }
9335
- if (message.oracleAsset !== "") {
9336
- writer.uint32(26).string(message.oracleAsset);
9337
- }
9338
9349
  if (message.spotMarketId.length !== 0) {
9339
9350
  writer.uint32(34).bytes(message.spotMarketId);
9340
9351
  }
9341
- if (message.spotQuoteOracleDenom !== "") {
9342
- writer.uint32(42).string(message.spotQuoteOracleDenom);
9343
- }
9344
9352
  return writer;
9345
9353
  },
9346
9354
  decode(input, length) {
@@ -9364,13 +9372,6 @@ var AssetRisk = {
9364
9372
  message.lt = reader.string();
9365
9373
  continue;
9366
9374
  }
9367
- case 3: {
9368
- if (tag !== 26) {
9369
- break;
9370
- }
9371
- message.oracleAsset = reader.string();
9372
- continue;
9373
- }
9374
9375
  case 4: {
9375
9376
  if (tag !== 34) {
9376
9377
  break;
@@ -9378,13 +9379,6 @@ var AssetRisk = {
9378
9379
  message.spotMarketId = reader.bytes();
9379
9380
  continue;
9380
9381
  }
9381
- case 5: {
9382
- if (tag !== 42) {
9383
- break;
9384
- }
9385
- message.spotQuoteOracleDenom = reader.string();
9386
- continue;
9387
- }
9388
9382
  }
9389
9383
  if ((tag & 7) === 4 || tag === 0) {
9390
9384
  break;
@@ -9397,9 +9391,7 @@ var AssetRisk = {
9397
9391
  return {
9398
9392
  ltv: isSet19(object2.ltv) ? globalThis.String(object2.ltv) : "",
9399
9393
  lt: isSet19(object2.lt) ? globalThis.String(object2.lt) : "",
9400
- oracleAsset: isSet19(object2.oracleAsset) ? globalThis.String(object2.oracleAsset) : isSet19(object2.oracle_asset) ? globalThis.String(object2.oracle_asset) : "",
9401
- spotMarketId: isSet19(object2.spotMarketId) ? bytesFromBase646(object2.spotMarketId) : isSet19(object2.spot_market_id) ? bytesFromBase646(object2.spot_market_id) : new Uint8Array(0),
9402
- spotQuoteOracleDenom: isSet19(object2.spotQuoteOracleDenom) ? globalThis.String(object2.spotQuoteOracleDenom) : isSet19(object2.spot_quote_oracle_denom) ? globalThis.String(object2.spot_quote_oracle_denom) : ""
9394
+ spotMarketId: isSet19(object2.spotMarketId) ? bytesFromBase646(object2.spotMarketId) : isSet19(object2.spot_market_id) ? bytesFromBase646(object2.spot_market_id) : new Uint8Array(0)
9403
9395
  };
9404
9396
  },
9405
9397
  toJSON(message) {
@@ -9410,15 +9402,9 @@ var AssetRisk = {
9410
9402
  if (message.lt !== "") {
9411
9403
  obj.lt = message.lt;
9412
9404
  }
9413
- if (message.oracleAsset !== "") {
9414
- obj.oracleAsset = message.oracleAsset;
9415
- }
9416
9405
  if (message.spotMarketId.length !== 0) {
9417
9406
  obj.spotMarketId = base64FromBytes6(message.spotMarketId);
9418
9407
  }
9419
- if (message.spotQuoteOracleDenom !== "") {
9420
- obj.spotQuoteOracleDenom = message.spotQuoteOracleDenom;
9421
- }
9422
9408
  return obj;
9423
9409
  },
9424
9410
  create(base) {
@@ -9428,9 +9414,7 @@ var AssetRisk = {
9428
9414
  const message = createBaseAssetRisk();
9429
9415
  message.ltv = object2.ltv ?? "";
9430
9416
  message.lt = object2.lt ?? "";
9431
- message.oracleAsset = object2.oracleAsset ?? "";
9432
9417
  message.spotMarketId = object2.spotMarketId ?? new Uint8Array(0);
9433
- message.spotQuoteOracleDenom = object2.spotQuoteOracleDenom ?? "";
9434
9418
  return message;
9435
9419
  }
9436
9420
  };
@@ -9690,7 +9674,8 @@ function createBaseAssetState() {
9690
9674
  totalSupplyShares: "",
9691
9675
  totalBorrowShares: "",
9692
9676
  collectedProtocolFee: "",
9693
- deficit: ""
9677
+ deficit: "",
9678
+ totalCollateral: ""
9694
9679
  };
9695
9680
  }
9696
9681
  var AssetState = {
@@ -9713,6 +9698,9 @@ var AssetState = {
9713
9698
  if (message.deficit !== "") {
9714
9699
  writer.uint32(50).string(message.deficit);
9715
9700
  }
9701
+ if (message.totalCollateral !== "") {
9702
+ writer.uint32(58).string(message.totalCollateral);
9703
+ }
9716
9704
  return writer;
9717
9705
  },
9718
9706
  decode(input, length) {
@@ -9764,6 +9752,13 @@ var AssetState = {
9764
9752
  message.deficit = reader.string();
9765
9753
  continue;
9766
9754
  }
9755
+ case 7: {
9756
+ if (tag !== 58) {
9757
+ break;
9758
+ }
9759
+ message.totalCollateral = reader.string();
9760
+ continue;
9761
+ }
9767
9762
  }
9768
9763
  if ((tag & 7) === 4 || tag === 0) {
9769
9764
  break;
@@ -9779,7 +9774,8 @@ var AssetState = {
9779
9774
  totalSupplyShares: isSet19(object2.totalSupplyShares) ? globalThis.String(object2.totalSupplyShares) : isSet19(object2.total_supply_shares) ? globalThis.String(object2.total_supply_shares) : "",
9780
9775
  totalBorrowShares: isSet19(object2.totalBorrowShares) ? globalThis.String(object2.totalBorrowShares) : isSet19(object2.total_borrow_shares) ? globalThis.String(object2.total_borrow_shares) : "",
9781
9776
  collectedProtocolFee: isSet19(object2.collectedProtocolFee) ? globalThis.String(object2.collectedProtocolFee) : isSet19(object2.collected_protocol_fee) ? globalThis.String(object2.collected_protocol_fee) : "",
9782
- deficit: isSet19(object2.deficit) ? globalThis.String(object2.deficit) : ""
9777
+ deficit: isSet19(object2.deficit) ? globalThis.String(object2.deficit) : "",
9778
+ totalCollateral: isSet19(object2.totalCollateral) ? globalThis.String(object2.totalCollateral) : isSet19(object2.total_collateral) ? globalThis.String(object2.total_collateral) : ""
9783
9779
  };
9784
9780
  },
9785
9781
  toJSON(message) {
@@ -9802,6 +9798,9 @@ var AssetState = {
9802
9798
  if (message.deficit !== "") {
9803
9799
  obj.deficit = message.deficit;
9804
9800
  }
9801
+ if (message.totalCollateral !== "") {
9802
+ obj.totalCollateral = message.totalCollateral;
9803
+ }
9805
9804
  return obj;
9806
9805
  },
9807
9806
  create(base) {
@@ -9815,6 +9814,7 @@ var AssetState = {
9815
9814
  message.totalBorrowShares = object2.totalBorrowShares ?? "";
9816
9815
  message.collectedProtocolFee = object2.collectedProtocolFee ?? "";
9817
9816
  message.deficit = object2.deficit ?? "";
9817
+ message.totalCollateral = object2.totalCollateral ?? "";
9818
9818
  return message;
9819
9819
  }
9820
9820
  };
@@ -16390,6 +16390,74 @@ var OracleFeed = {
16390
16390
  return message;
16391
16391
  }
16392
16392
  };
16393
+ function createBaseDescription() {
16394
+ return { name: "", details: "" };
16395
+ }
16396
+ var Description = {
16397
+ encode(message, writer = new BinaryWriter37()) {
16398
+ if (message.name !== "") {
16399
+ writer.uint32(10).string(message.name);
16400
+ }
16401
+ if (message.details !== "") {
16402
+ writer.uint32(18).string(message.details);
16403
+ }
16404
+ return writer;
16405
+ },
16406
+ decode(input, length) {
16407
+ const reader = input instanceof BinaryReader37 ? input : new BinaryReader37(input);
16408
+ const end = length === void 0 ? reader.len : reader.pos + length;
16409
+ const message = createBaseDescription();
16410
+ while (reader.pos < end) {
16411
+ const tag = reader.uint32();
16412
+ switch (tag >>> 3) {
16413
+ case 1: {
16414
+ if (tag !== 10) {
16415
+ break;
16416
+ }
16417
+ message.name = reader.string();
16418
+ continue;
16419
+ }
16420
+ case 2: {
16421
+ if (tag !== 18) {
16422
+ break;
16423
+ }
16424
+ message.details = reader.string();
16425
+ continue;
16426
+ }
16427
+ }
16428
+ if ((tag & 7) === 4 || tag === 0) {
16429
+ break;
16430
+ }
16431
+ reader.skip(tag & 7);
16432
+ }
16433
+ return message;
16434
+ },
16435
+ fromJSON(object2) {
16436
+ return {
16437
+ name: isSet35(object2.name) ? globalThis.String(object2.name) : "",
16438
+ details: isSet35(object2.details) ? globalThis.String(object2.details) : ""
16439
+ };
16440
+ },
16441
+ toJSON(message) {
16442
+ const obj = {};
16443
+ if (message.name !== "") {
16444
+ obj.name = message.name;
16445
+ }
16446
+ if (message.details !== "") {
16447
+ obj.details = message.details;
16448
+ }
16449
+ return obj;
16450
+ },
16451
+ create(base) {
16452
+ return Description.fromPartial(base ?? {});
16453
+ },
16454
+ fromPartial(object2) {
16455
+ const message = createBaseDescription();
16456
+ message.name = object2.name ?? "";
16457
+ message.details = object2.details ?? "";
16458
+ return message;
16459
+ }
16460
+ };
16393
16461
  function bytesFromBase6412(b64) {
16394
16462
  if (globalThis.Buffer) {
16395
16463
  return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
@@ -16722,7 +16790,8 @@ function createBaseMsgCreateVault() {
16722
16790
  tradingTerms: void 0,
16723
16791
  lending: void 0,
16724
16792
  trading: void 0,
16725
- initialDeposit: void 0
16793
+ initialDeposit: void 0,
16794
+ description: void 0
16726
16795
  };
16727
16796
  }
16728
16797
  var MsgCreateVault = {
@@ -16757,6 +16826,9 @@ var MsgCreateVault = {
16757
16826
  if (message.initialDeposit !== void 0) {
16758
16827
  Coin.encode(message.initialDeposit, writer.uint32(82).fork()).join();
16759
16828
  }
16829
+ if (message.description !== void 0) {
16830
+ Description.encode(message.description, writer.uint32(90).fork()).join();
16831
+ }
16760
16832
  return writer;
16761
16833
  },
16762
16834
  decode(input, length) {
@@ -16836,6 +16908,13 @@ var MsgCreateVault = {
16836
16908
  message.initialDeposit = Coin.decode(reader, reader.uint32());
16837
16909
  continue;
16838
16910
  }
16911
+ case 11: {
16912
+ if (tag !== 90) {
16913
+ break;
16914
+ }
16915
+ message.description = Description.decode(reader, reader.uint32());
16916
+ continue;
16917
+ }
16839
16918
  }
16840
16919
  if ((tag & 7) === 4 || tag === 0) {
16841
16920
  break;
@@ -16855,7 +16934,8 @@ var MsgCreateVault = {
16855
16934
  tradingTerms: isSet37(object2.tradingTerms) ? TradingVaultTerms.fromJSON(object2.tradingTerms) : isSet37(object2.trading_terms) ? TradingVaultTerms.fromJSON(object2.trading_terms) : void 0,
16856
16935
  lending: isSet37(object2.lending) ? LendingVaultConfig.fromJSON(object2.lending) : void 0,
16857
16936
  trading: isSet37(object2.trading) ? TradingVaultConfig.fromJSON(object2.trading) : void 0,
16858
- initialDeposit: isSet37(object2.initialDeposit) ? Coin.fromJSON(object2.initialDeposit) : isSet37(object2.initial_deposit) ? Coin.fromJSON(object2.initial_deposit) : void 0
16937
+ initialDeposit: isSet37(object2.initialDeposit) ? Coin.fromJSON(object2.initialDeposit) : isSet37(object2.initial_deposit) ? Coin.fromJSON(object2.initial_deposit) : void 0,
16938
+ description: isSet37(object2.description) ? Description.fromJSON(object2.description) : void 0
16859
16939
  };
16860
16940
  },
16861
16941
  toJSON(message) {
@@ -16890,6 +16970,9 @@ var MsgCreateVault = {
16890
16970
  if (message.initialDeposit !== void 0) {
16891
16971
  obj.initialDeposit = Coin.toJSON(message.initialDeposit);
16892
16972
  }
16973
+ if (message.description !== void 0) {
16974
+ obj.description = Description.toJSON(message.description);
16975
+ }
16893
16976
  return obj;
16894
16977
  },
16895
16978
  create(base) {
@@ -16907,6 +16990,7 @@ var MsgCreateVault = {
16907
16990
  message.lending = object2.lending !== void 0 && object2.lending !== null ? LendingVaultConfig.fromPartial(object2.lending) : void 0;
16908
16991
  message.trading = object2.trading !== void 0 && object2.trading !== null ? TradingVaultConfig.fromPartial(object2.trading) : void 0;
16909
16992
  message.initialDeposit = object2.initialDeposit !== void 0 && object2.initialDeposit !== null ? Coin.fromPartial(object2.initialDeposit) : void 0;
16993
+ message.description = object2.description !== void 0 && object2.description !== null ? Description.fromPartial(object2.description) : void 0;
16910
16994
  return message;
16911
16995
  }
16912
16996
  };
@@ -18050,10 +18134,10 @@ var Commission = {
18050
18134
  return message;
18051
18135
  }
18052
18136
  };
18053
- function createBaseDescription() {
18137
+ function createBaseDescription2() {
18054
18138
  return { moniker: "", identity: "", website: "", securityContact: "", details: "" };
18055
18139
  }
18056
- var Description = {
18140
+ var Description2 = {
18057
18141
  encode(message, writer = new BinaryWriter42()) {
18058
18142
  if (message.moniker !== "") {
18059
18143
  writer.uint32(10).string(message.moniker);
@@ -18075,7 +18159,7 @@ var Description = {
18075
18159
  decode(input, length) {
18076
18160
  const reader = input instanceof BinaryReader42 ? input : new BinaryReader42(input);
18077
18161
  const end = length === void 0 ? reader.len : reader.pos + length;
18078
- const message = createBaseDescription();
18162
+ const message = createBaseDescription2();
18079
18163
  while (reader.pos < end) {
18080
18164
  const tag = reader.uint32();
18081
18165
  switch (tag >>> 3) {
@@ -18151,10 +18235,10 @@ var Description = {
18151
18235
  return obj;
18152
18236
  },
18153
18237
  create(base) {
18154
- return Description.fromPartial(base ?? {});
18238
+ return Description2.fromPartial(base ?? {});
18155
18239
  },
18156
18240
  fromPartial(object2) {
18157
- const message = createBaseDescription();
18241
+ const message = createBaseDescription2();
18158
18242
  message.moniker = object2.moniker ?? "";
18159
18243
  message.identity = object2.identity ?? "";
18160
18244
  message.website = object2.website ?? "";
@@ -18201,7 +18285,7 @@ var Validator = {
18201
18285
  writer.uint32(50).string(message.delegatorShares);
18202
18286
  }
18203
18287
  if (message.description !== void 0) {
18204
- Description.encode(message.description, writer.uint32(58).fork()).join();
18288
+ Description2.encode(message.description, writer.uint32(58).fork()).join();
18205
18289
  }
18206
18290
  if (message.unbondingHeight !== 0n) {
18207
18291
  if (BigInt.asIntN(64, message.unbondingHeight) !== message.unbondingHeight) {
@@ -18293,7 +18377,7 @@ var Validator = {
18293
18377
  if (tag !== 58) {
18294
18378
  break;
18295
18379
  }
18296
- message.description = Description.decode(reader, reader.uint32());
18380
+ message.description = Description2.decode(reader, reader.uint32());
18297
18381
  continue;
18298
18382
  }
18299
18383
  case 8: {
@@ -18361,7 +18445,7 @@ var Validator = {
18361
18445
  status: isSet40(object2.status) ? bondStatusFromJSON(object2.status) : 0,
18362
18446
  tokens: isSet40(object2.tokens) ? globalThis.String(object2.tokens) : "",
18363
18447
  delegatorShares: isSet40(object2.delegatorShares) ? globalThis.String(object2.delegatorShares) : isSet40(object2.delegator_shares) ? globalThis.String(object2.delegator_shares) : "",
18364
- description: isSet40(object2.description) ? Description.fromJSON(object2.description) : void 0,
18448
+ description: isSet40(object2.description) ? Description2.fromJSON(object2.description) : void 0,
18365
18449
  unbondingHeight: isSet40(object2.unbondingHeight) ? BigInt(object2.unbondingHeight) : isSet40(object2.unbonding_height) ? BigInt(object2.unbonding_height) : 0n,
18366
18450
  unbondingTime: isSet40(object2.unbondingTime) ? fromJsonTimestamp7(object2.unbondingTime) : isSet40(object2.unbonding_time) ? fromJsonTimestamp7(object2.unbonding_time) : void 0,
18367
18451
  commission: isSet40(object2.commission) ? Commission.fromJSON(object2.commission) : void 0,
@@ -18391,7 +18475,7 @@ var Validator = {
18391
18475
  obj.delegatorShares = message.delegatorShares;
18392
18476
  }
18393
18477
  if (message.description !== void 0) {
18394
- obj.description = Description.toJSON(message.description);
18478
+ obj.description = Description2.toJSON(message.description);
18395
18479
  }
18396
18480
  if (message.unbondingHeight !== 0n) {
18397
18481
  obj.unbondingHeight = message.unbondingHeight.toString();
@@ -18424,7 +18508,7 @@ var Validator = {
18424
18508
  message.status = object2.status ?? 0;
18425
18509
  message.tokens = object2.tokens ?? "";
18426
18510
  message.delegatorShares = object2.delegatorShares ?? "";
18427
- message.description = object2.description !== void 0 && object2.description !== null ? Description.fromPartial(object2.description) : void 0;
18511
+ message.description = object2.description !== void 0 && object2.description !== null ? Description2.fromPartial(object2.description) : void 0;
18428
18512
  message.unbondingHeight = object2.unbondingHeight ?? 0n;
18429
18513
  message.unbondingTime = object2.unbondingTime ?? void 0;
18430
18514
  message.commission = object2.commission !== void 0 && object2.commission !== null ? Commission.fromPartial(object2.commission) : void 0;
@@ -20087,6 +20171,14 @@ function mapAultVaultV1AllowedMarkets(input, label = "value") {
20087
20171
  lendingPoolIds: requireBigIntArray(record2["lendingPoolIds"], `${prefix}lendingPoolIds`)
20088
20172
  };
20089
20173
  }
20174
+ function mapAultVaultV1Description(input, label = "value") {
20175
+ const record2 = asRecord(input);
20176
+ const prefix = label ? `${label}.` : "";
20177
+ return {
20178
+ name: requireString(record2["name"], `${prefix}name`),
20179
+ details: requireString(record2["details"], `${prefix}details`)
20180
+ };
20181
+ }
20090
20182
  function mapAultVaultV1FundWindow(input, label = "value") {
20091
20183
  const record2 = asRecord(input);
20092
20184
  const prefix = label ? `${label}.` : "";
@@ -20179,7 +20271,8 @@ function mapAultVaultV1MsgCreateVault(input, label = "value") {
20179
20271
  initialDeposit: mapCosmosBaseV1beta1Coin(
20180
20272
  asRecord(record2["initialDeposit"]),
20181
20273
  `${prefix}initialDeposit`
20182
- )
20274
+ ),
20275
+ description: mapAultVaultV1Description(asRecord(record2["description"]), `${prefix}description`)
20183
20276
  };
20184
20277
  }
20185
20278
  function mapAultVaultV1MsgDeposit(input, label = "value") {
@@ -26897,7 +26990,7 @@ var Params14 = {
26897
26990
  }
26898
26991
  };
26899
26992
  function createBaseFeed() {
26900
- return { feedId: "", owner: "", enabled: false, marketId: "", baseDenom: "", quoteDenom: "" };
26993
+ return { feedId: "", owner: "", enabled: false, marketId: "", baseDenom: "" };
26901
26994
  }
26902
26995
  var Feed = {
26903
26996
  encode(message, writer = new BinaryWriter52()) {
@@ -26916,9 +27009,6 @@ var Feed = {
26916
27009
  if (message.baseDenom !== "") {
26917
27010
  writer.uint32(42).string(message.baseDenom);
26918
27011
  }
26919
- if (message.quoteDenom !== "") {
26920
- writer.uint32(50).string(message.quoteDenom);
26921
- }
26922
27012
  return writer;
26923
27013
  },
26924
27014
  decode(input, length) {
@@ -26963,13 +27053,6 @@ var Feed = {
26963
27053
  message.baseDenom = reader.string();
26964
27054
  continue;
26965
27055
  }
26966
- case 6: {
26967
- if (tag !== 50) {
26968
- break;
26969
- }
26970
- message.quoteDenom = reader.string();
26971
- continue;
26972
- }
26973
27056
  }
26974
27057
  if ((tag & 7) === 4 || tag === 0) {
26975
27058
  break;
@@ -26984,8 +27067,7 @@ var Feed = {
26984
27067
  owner: isSet50(object2.owner) ? globalThis.String(object2.owner) : "",
26985
27068
  enabled: isSet50(object2.enabled) ? globalThis.Boolean(object2.enabled) : false,
26986
27069
  marketId: isSet50(object2.marketId) ? globalThis.String(object2.marketId) : isSet50(object2.market_id) ? globalThis.String(object2.market_id) : "",
26987
- baseDenom: isSet50(object2.baseDenom) ? globalThis.String(object2.baseDenom) : isSet50(object2.base_denom) ? globalThis.String(object2.base_denom) : "",
26988
- quoteDenom: isSet50(object2.quoteDenom) ? globalThis.String(object2.quoteDenom) : isSet50(object2.quote_denom) ? globalThis.String(object2.quote_denom) : ""
27070
+ baseDenom: isSet50(object2.baseDenom) ? globalThis.String(object2.baseDenom) : isSet50(object2.base_denom) ? globalThis.String(object2.base_denom) : ""
26989
27071
  };
26990
27072
  },
26991
27073
  toJSON(message) {
@@ -27005,9 +27087,6 @@ var Feed = {
27005
27087
  if (message.baseDenom !== "") {
27006
27088
  obj.baseDenom = message.baseDenom;
27007
27089
  }
27008
- if (message.quoteDenom !== "") {
27009
- obj.quoteDenom = message.quoteDenom;
27010
- }
27011
27090
  return obj;
27012
27091
  },
27013
27092
  create(base) {
@@ -27020,7 +27099,6 @@ var Feed = {
27020
27099
  message.enabled = object2.enabled ?? false;
27021
27100
  message.marketId = object2.marketId ?? "";
27022
27101
  message.baseDenom = object2.baseDenom ?? "";
27023
- message.quoteDenom = object2.quoteDenom ?? "";
27024
27102
  return message;
27025
27103
  }
27026
27104
  };
@@ -27645,7 +27723,10 @@ function createBaseMarkPriceState() {
27645
27723
  localMedianWeight: "",
27646
27724
  lastLocalMedianUpdateTime: 0n,
27647
27725
  lastPriceDifferenceUpdateTime: 0n,
27648
- lastUpdateTime: 0n
27726
+ lastUpdateTime: 0n,
27727
+ clamped: false,
27728
+ previousMarkPrice: "",
27729
+ lastChangeHeight: 0n
27649
27730
  };
27650
27731
  }
27651
27732
  var MarkPriceState = {
@@ -27689,6 +27770,20 @@ var MarkPriceState = {
27689
27770
  }
27690
27771
  writer.uint32(64).int64(message.lastUpdateTime);
27691
27772
  }
27773
+ if (message.clamped !== false) {
27774
+ writer.uint32(72).bool(message.clamped);
27775
+ }
27776
+ if (message.previousMarkPrice !== "") {
27777
+ writer.uint32(82).string(message.previousMarkPrice);
27778
+ }
27779
+ if (message.lastChangeHeight !== 0n) {
27780
+ if (BigInt.asIntN(64, message.lastChangeHeight) !== message.lastChangeHeight) {
27781
+ throw new globalThis.Error(
27782
+ "value provided for field message.lastChangeHeight of type int64 too large"
27783
+ );
27784
+ }
27785
+ writer.uint32(88).int64(message.lastChangeHeight);
27786
+ }
27692
27787
  return writer;
27693
27788
  },
27694
27789
  decode(input, length) {
@@ -27754,6 +27849,27 @@ var MarkPriceState = {
27754
27849
  message.lastUpdateTime = reader.int64();
27755
27850
  continue;
27756
27851
  }
27852
+ case 9: {
27853
+ if (tag !== 72) {
27854
+ break;
27855
+ }
27856
+ message.clamped = reader.bool();
27857
+ continue;
27858
+ }
27859
+ case 10: {
27860
+ if (tag !== 82) {
27861
+ break;
27862
+ }
27863
+ message.previousMarkPrice = reader.string();
27864
+ continue;
27865
+ }
27866
+ case 11: {
27867
+ if (tag !== 88) {
27868
+ break;
27869
+ }
27870
+ message.lastChangeHeight = reader.int64();
27871
+ continue;
27872
+ }
27757
27873
  }
27758
27874
  if ((tag & 7) === 4 || tag === 0) {
27759
27875
  break;
@@ -27771,7 +27887,10 @@ var MarkPriceState = {
27771
27887
  localMedianWeight: isSet52(object2.localMedianWeight) ? globalThis.String(object2.localMedianWeight) : isSet52(object2.local_median_weight) ? globalThis.String(object2.local_median_weight) : "",
27772
27888
  lastLocalMedianUpdateTime: isSet52(object2.lastLocalMedianUpdateTime) ? BigInt(object2.lastLocalMedianUpdateTime) : isSet52(object2.last_local_median_update_time) ? BigInt(object2.last_local_median_update_time) : 0n,
27773
27889
  lastPriceDifferenceUpdateTime: isSet52(object2.lastPriceDifferenceUpdateTime) ? BigInt(object2.lastPriceDifferenceUpdateTime) : isSet52(object2.last_price_difference_update_time) ? BigInt(object2.last_price_difference_update_time) : 0n,
27774
- lastUpdateTime: isSet52(object2.lastUpdateTime) ? BigInt(object2.lastUpdateTime) : isSet52(object2.last_update_time) ? BigInt(object2.last_update_time) : 0n
27890
+ lastUpdateTime: isSet52(object2.lastUpdateTime) ? BigInt(object2.lastUpdateTime) : isSet52(object2.last_update_time) ? BigInt(object2.last_update_time) : 0n,
27891
+ clamped: isSet52(object2.clamped) ? globalThis.Boolean(object2.clamped) : false,
27892
+ previousMarkPrice: isSet52(object2.previousMarkPrice) ? globalThis.String(object2.previousMarkPrice) : isSet52(object2.previous_mark_price) ? globalThis.String(object2.previous_mark_price) : "",
27893
+ lastChangeHeight: isSet52(object2.lastChangeHeight) ? BigInt(object2.lastChangeHeight) : isSet52(object2.last_change_height) ? BigInt(object2.last_change_height) : 0n
27775
27894
  };
27776
27895
  },
27777
27896
  toJSON(message) {
@@ -27800,6 +27919,15 @@ var MarkPriceState = {
27800
27919
  if (message.lastUpdateTime !== 0n) {
27801
27920
  obj.lastUpdateTime = message.lastUpdateTime.toString();
27802
27921
  }
27922
+ if (message.clamped !== false) {
27923
+ obj.clamped = message.clamped;
27924
+ }
27925
+ if (message.previousMarkPrice !== "") {
27926
+ obj.previousMarkPrice = message.previousMarkPrice;
27927
+ }
27928
+ if (message.lastChangeHeight !== 0n) {
27929
+ obj.lastChangeHeight = message.lastChangeHeight.toString();
27930
+ }
27803
27931
  return obj;
27804
27932
  },
27805
27933
  create(base) {
@@ -27815,6 +27943,9 @@ var MarkPriceState = {
27815
27943
  message.lastLocalMedianUpdateTime = object2.lastLocalMedianUpdateTime ?? 0n;
27816
27944
  message.lastPriceDifferenceUpdateTime = object2.lastPriceDifferenceUpdateTime ?? 0n;
27817
27945
  message.lastUpdateTime = object2.lastUpdateTime ?? 0n;
27946
+ message.clamped = object2.clamped ?? false;
27947
+ message.previousMarkPrice = object2.previousMarkPrice ?? "";
27948
+ message.lastChangeHeight = object2.lastChangeHeight ?? 0n;
27818
27949
  return message;
27819
27950
  }
27820
27951
  };
@@ -33482,7 +33613,8 @@ function createBaseVaultResponse() {
33482
33613
  totalShares: "",
33483
33614
  pendingConfigUpdate: void 0,
33484
33615
  lendingTerms: void 0,
33485
- tradingTerms: void 0
33616
+ tradingTerms: void 0,
33617
+ description: void 0
33486
33618
  };
33487
33619
  }
33488
33620
  var VaultResponse = {
@@ -33526,6 +33658,9 @@ var VaultResponse = {
33526
33658
  if (message.tradingTerms !== void 0) {
33527
33659
  TradingVaultTerms.encode(message.tradingTerms, writer.uint32(106).fork()).join();
33528
33660
  }
33661
+ if (message.description !== void 0) {
33662
+ Description.encode(message.description, writer.uint32(114).fork()).join();
33663
+ }
33529
33664
  return writer;
33530
33665
  },
33531
33666
  decode(input, length) {
@@ -33626,6 +33761,13 @@ var VaultResponse = {
33626
33761
  message.tradingTerms = TradingVaultTerms.decode(reader, reader.uint32());
33627
33762
  continue;
33628
33763
  }
33764
+ case 14: {
33765
+ if (tag !== 114) {
33766
+ break;
33767
+ }
33768
+ message.description = Description.decode(reader, reader.uint32());
33769
+ continue;
33770
+ }
33629
33771
  }
33630
33772
  if ((tag & 7) === 4 || tag === 0) {
33631
33773
  break;
@@ -33648,7 +33790,8 @@ var VaultResponse = {
33648
33790
  totalShares: isSet62(object2.totalShares) ? globalThis.String(object2.totalShares) : isSet62(object2.total_shares) ? globalThis.String(object2.total_shares) : "",
33649
33791
  pendingConfigUpdate: isSet62(object2.pendingConfigUpdate) ? PendingVaultConfigUpdate.fromJSON(object2.pendingConfigUpdate) : isSet62(object2.pending_config_update) ? PendingVaultConfigUpdate.fromJSON(object2.pending_config_update) : void 0,
33650
33792
  lendingTerms: isSet62(object2.lendingTerms) ? LendingVaultTerms.fromJSON(object2.lendingTerms) : isSet62(object2.lending_terms) ? LendingVaultTerms.fromJSON(object2.lending_terms) : void 0,
33651
- tradingTerms: isSet62(object2.tradingTerms) ? TradingVaultTerms.fromJSON(object2.tradingTerms) : isSet62(object2.trading_terms) ? TradingVaultTerms.fromJSON(object2.trading_terms) : void 0
33793
+ tradingTerms: isSet62(object2.tradingTerms) ? TradingVaultTerms.fromJSON(object2.tradingTerms) : isSet62(object2.trading_terms) ? TradingVaultTerms.fromJSON(object2.trading_terms) : void 0,
33794
+ description: isSet62(object2.description) ? Description.fromJSON(object2.description) : void 0
33652
33795
  };
33653
33796
  },
33654
33797
  toJSON(message) {
@@ -33692,6 +33835,9 @@ var VaultResponse = {
33692
33835
  if (message.tradingTerms !== void 0) {
33693
33836
  obj.tradingTerms = TradingVaultTerms.toJSON(message.tradingTerms);
33694
33837
  }
33838
+ if (message.description !== void 0) {
33839
+ obj.description = Description.toJSON(message.description);
33840
+ }
33695
33841
  return obj;
33696
33842
  },
33697
33843
  create(base) {
@@ -33712,6 +33858,7 @@ var VaultResponse = {
33712
33858
  message.pendingConfigUpdate = object2.pendingConfigUpdate !== void 0 && object2.pendingConfigUpdate !== null ? PendingVaultConfigUpdate.fromPartial(object2.pendingConfigUpdate) : void 0;
33713
33859
  message.lendingTerms = object2.lendingTerms !== void 0 && object2.lendingTerms !== null ? LendingVaultTerms.fromPartial(object2.lendingTerms) : void 0;
33714
33860
  message.tradingTerms = object2.tradingTerms !== void 0 && object2.tradingTerms !== null ? TradingVaultTerms.fromPartial(object2.tradingTerms) : void 0;
33861
+ message.description = object2.description !== void 0 && object2.description !== null ? Description.fromPartial(object2.description) : void 0;
33715
33862
  return message;
33716
33863
  }
33717
33864
  };
@@ -34307,7 +34454,9 @@ function createVaultApi(context) {
34307
34454
  }
34308
34455
 
34309
34456
  // src/eip712/sign-and-broadcast.ts
34310
- import { hexToBytes, hashTypedData, recoverPublicKey, sha256 as sha2562 } from "viem";
34457
+ import { bytesToHex, hexToBytes, hashTypedData, recoverPublicKey, sha256 as sha2562 } from "viem";
34458
+ import { publicKeyToAddress } from "viem/accounts";
34459
+ import { secp256k1 } from "@noble/curves/secp256k1";
34311
34460
 
34312
34461
  // src/proto/tx-encode.ts
34313
34462
  var WIRE_VARINT = 0;
@@ -34910,22 +35059,63 @@ async function resolveDynamicFeeAmount(network, gas, feeMarketCache, fetchFn, fe
34910
35059
  const staticI = BigInt(staticFloor);
34911
35060
  return dynamicI > staticI ? dynamicI.toString() : staticFloor;
34912
35061
  }
34913
- async function recoverPubkeyFromTypedDataSignature(typedData, signature) {
35062
+ async function recoverSignerPubkey(typedData, signature, signerAddress) {
35063
+ const signerEvmAddress = isValidEvmAddress(signerAddress) ? signerAddress : aultToEvm(signerAddress);
35064
+ let sigBytes;
35065
+ try {
35066
+ sigBytes = hexToBytes(signature);
35067
+ } catch {
35068
+ sigBytes = new Uint8Array();
35069
+ }
35070
+ if (sigBytes.length !== 64 && sigBytes.length !== 65) {
35071
+ throw new SignerMismatchError({
35072
+ signerAddress: signerEvmAddress,
35073
+ message: `The wallet returned a ${sigBytes.length}-byte signature for ${signerEvmAddress}; expected 64 or 65 bytes.`
35074
+ });
35075
+ }
34914
35076
  const hash = hashTypedData({
34915
35077
  domain: typedData.domain,
34916
35078
  types: typedData.types,
34917
35079
  primaryType: typedData.primaryType,
34918
35080
  message: typedData.message
34919
35081
  });
34920
- const publicKey = await recoverPublicKey({ hash, signature });
34921
- const uncompressedBytes = hexToBytes(publicKey);
34922
- const x = uncompressedBytes.slice(1, 33);
34923
- const y = uncompressedBytes.slice(33, 65);
34924
- const prefix = y[31] % 2 === 0 ? 2 : 3;
34925
- const compressed = new Uint8Array(33);
34926
- compressed[0] = prefix;
34927
- compressed.set(x, 1);
34928
- return bytesToBase64(compressed);
35082
+ const rs = sigBytes.slice(0, 64);
35083
+ let v = sigBytes[64];
35084
+ if (v === void 0 && rs[32] & 128) {
35085
+ rs[32] &= 127;
35086
+ v = 1;
35087
+ }
35088
+ const r = bytesToHex(rs.slice(0, 32));
35089
+ const s = bytesToHex(rs.slice(32));
35090
+ const parities = v === 1 || v === 28 ? [1, 0] : [0, 1];
35091
+ let recoveredAddress;
35092
+ for (const yParity of parities) {
35093
+ let publicKey;
35094
+ try {
35095
+ publicKey = await recoverPublicKey({ hash, signature: { r, s, yParity } });
35096
+ } catch {
35097
+ continue;
35098
+ }
35099
+ const address = publicKeyToAddress(publicKey);
35100
+ recoveredAddress ?? (recoveredAddress = address);
35101
+ if (!addressEquals(address, signerEvmAddress)) continue;
35102
+ const uncompressed = hexToBytes(publicKey);
35103
+ const compressed = new Uint8Array(33);
35104
+ compressed[0] = uncompressed[64] % 2 === 0 ? 2 : 3;
35105
+ compressed.set(uncompressed.slice(1, 33), 1);
35106
+ return { pubkeyBase64: bytesToBase64(compressed), signature: rs };
35107
+ }
35108
+ throw new SignerMismatchError({ signerAddress: signerEvmAddress, recoveredAddress });
35109
+ }
35110
+ function pubkeyBelongsToSigner(pubkeyBase64, signerAddress) {
35111
+ try {
35112
+ const uncompressed = secp256k1.ProjectivePoint.fromHex(base64ToBytes(pubkeyBase64)).toRawBytes(
35113
+ false
35114
+ );
35115
+ return addressEquals(publicKeyToAddress(bytesToHex(uncompressed)), signerAddress);
35116
+ } catch {
35117
+ return false;
35118
+ }
34929
35119
  }
34930
35120
  function createAccountCache() {
34931
35121
  return { accountNumber: null, pubkeyBase64: null, nextSequence: null };
@@ -35080,6 +35270,9 @@ async function signAndBroadcastEip712({
35080
35270
  throw new Error("signer is required to sign EIP-712 typed data.");
35081
35271
  }
35082
35272
  const resolvedSignerAddress = signerAddress ? isValidEvmAddress(signerAddress) ? evmToAult(signerAddress) : signerAddress : await resolveSignerAddress(resolvedSigner);
35273
+ if (cache?.pubkeyBase64 && !pubkeyBelongsToSigner(cache.pubkeyBase64, resolvedSignerAddress)) {
35274
+ cache.pubkeyBase64 = null;
35275
+ }
35083
35276
  const cacheIsWarm = cache?.accountNumber != null && cache.nextSequence != null;
35084
35277
  const accountInfo = cacheIsWarm ? null : await queryAccount(network, resolvedSignerAddress, fetchFn, fetchOptions);
35085
35278
  if (cache && accountInfo) {
@@ -35141,13 +35334,12 @@ async function signAndBroadcastEip712({
35141
35334
  };
35142
35335
  const typedData = buildEip712TypedData(context, msgs, network.evmChainId);
35143
35336
  const signature = normalizeSignature(await resolvedSigner.signTypedData(typedData));
35144
- let pubkey = cache?.pubkeyBase64 ?? accountInfo?.pubkeyBase64 ?? null;
35145
- if (!pubkey) {
35146
- pubkey = await recoverPubkeyFromTypedDataSignature(typedData, signature);
35147
- if (cache) cache.pubkeyBase64 = pubkey;
35148
- }
35149
- const sigBytes = hexToBytes(signature);
35150
- const sigWithoutRecovery = sigBytes.slice(0, 64);
35337
+ const { pubkeyBase64: pubkey, signature: sigWithoutRecovery } = await recoverSignerPubkey(
35338
+ typedData,
35339
+ signature,
35340
+ resolvedSignerAddress
35341
+ );
35342
+ if (cache) cache.pubkeyBase64 = pubkey;
35151
35343
  const encodedMessages = msgs.map((msg2) => {
35152
35344
  const encoder = MSG_ENCODERS[msg2.typeUrl];
35153
35345
  if (!encoder) {
@@ -37352,6 +37544,21 @@ function checkTradingTerms(performanceFeeBps, exitFeeBps, relationship, fundWind
37352
37544
  throw new Error("performanceFeeBps and exitFeeBps must total less than 10000 bps");
37353
37545
  }
37354
37546
  }
37547
+ var MAX_NAME_BYTES = 70;
37548
+ var MAX_DETAILS_BYTES = 280;
37549
+ function descriptionOf(description) {
37550
+ const name = description?.name ?? "";
37551
+ const details = description?.details ?? "";
37552
+ if (name === "") throw new Error("A vault needs a description.name");
37553
+ const bytes = (text) => new TextEncoder().encode(text).length;
37554
+ if (bytes(name) > MAX_NAME_BYTES) {
37555
+ throw new Error(`description.name exceeds ${MAX_NAME_BYTES} bytes`);
37556
+ }
37557
+ if (bytes(details) > MAX_DETAILS_BYTES) {
37558
+ throw new Error(`description.details exceeds ${MAX_DETAILS_BYTES} bytes`);
37559
+ }
37560
+ return { name, details };
37561
+ }
37355
37562
  function configOf(config) {
37356
37563
  return "lending" in config ? { lending: lendingConfigOf(config.lending) } : { trading: tradingConfigOf(config.trading) };
37357
37564
  }
@@ -37402,7 +37609,8 @@ function buildCreateVaultMsg(owner, params) {
37402
37609
  relationship,
37403
37610
  ...params.fundWindow !== void 0 && { fundWindow: fundWindowOf(params.fundWindow) },
37404
37611
  // The chain treats a coin with no denom and a zero amount as "no deposit".
37405
- initialDeposit: deposit ?? { denom: "", amount: "0" }
37612
+ initialDeposit: deposit ?? { denom: "", amount: "0" },
37613
+ description: descriptionOf(params.description)
37406
37614
  };
37407
37615
  if ("lending" in params.config) {
37408
37616
  if (kind !== "normal") {
@@ -38143,12 +38351,12 @@ function createStaticResolver(optsOrNetwork, legacyManifest) {
38143
38351
  }
38144
38352
 
38145
38353
  // src/agent/attach.ts
38146
- import { secp256k1 as secp256k12 } from "@noble/curves/secp256k1";
38354
+ import { secp256k1 as secp256k13 } from "@noble/curves/secp256k1";
38147
38355
  import { keccak256 as keccak2562, hexToBytes as hexToBytes4 } from "viem";
38148
38356
  import { toHex as toHex5 } from "@cosmjs/encoding";
38149
38357
 
38150
38358
  // src/agent/sign-and-broadcast.ts
38151
- import { secp256k1 } from "@noble/curves/secp256k1";
38359
+ import { secp256k1 as secp256k12 } from "@noble/curves/secp256k1";
38152
38360
  import { keccak256, hexToBytes as hexToBytes3 } from "viem";
38153
38361
  var AGENT_DEFAULTS = {
38154
38362
  GAS_LIMIT: "186000",
@@ -38159,7 +38367,7 @@ var AGENT_DEFAULTS = {
38159
38367
  function computeAgentKeyMaterial(agentPrivateKey) {
38160
38368
  const normalized = agentPrivateKey.startsWith("0x") ? agentPrivateKey : `0x${agentPrivateKey}`;
38161
38369
  const privKeyBytes = hexToBytes3(normalized);
38162
- const compressedPubkey = secp256k1.getPublicKey(privKeyBytes, true);
38370
+ const compressedPubkey = secp256k12.getPublicKey(privKeyBytes, true);
38163
38371
  return { privKeyBytes, compressedPubkey };
38164
38372
  }
38165
38373
  function computeTimeoutTimestamp(timeoutSeconds) {
@@ -38240,7 +38448,7 @@ async function signAndBroadcastAgentTx({
38240
38448
  accountNumber: BigInt(accountNumber)
38241
38449
  });
38242
38450
  const hash = hexToBytes3(keccak256(signDocBytes));
38243
- const sig = secp256k1.sign(hash, privKeyBytes);
38451
+ const sig = secp256k12.sign(hash, privKeyBytes);
38244
38452
  const signatureBytes = sig.toCompactRawBytes();
38245
38453
  const txRawBytes = encodeTxRaw({
38246
38454
  bodyBytes,
@@ -38734,7 +38942,7 @@ function deriveAgentAddress(privateKeyHex) {
38734
38942
  const privKeyBytes = hexToBytes4(
38735
38943
  privateKeyHex.startsWith("0x") ? privateKeyHex : `0x${privateKeyHex}`
38736
38944
  );
38737
- const uncompressedPubkey = secp256k12.getPublicKey(privKeyBytes, false);
38945
+ const uncompressedPubkey = secp256k13.getPublicKey(privKeyBytes, false);
38738
38946
  const pubkeyHash = hexToBytes4(keccak2562(uncompressedPubkey.slice(1)));
38739
38947
  const evmAddressBytes = pubkeyHash.slice(12);
38740
38948
  const evmHex = `0x${toHex5(evmAddressBytes)}`;
@@ -42321,6 +42529,7 @@ export {
42321
42529
  SearchUDFSymbolsQueryParams,
42322
42530
  SearchUDFSymbolsResponse,
42323
42531
  SearchUDFSymbolsResponseItem,
42532
+ SignerMismatchError,
42324
42533
  TIMING_CONSTANTS,
42325
42534
  TX_BASE_FIELDS,
42326
42535
  TimeoutError,