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.cjs CHANGED
@@ -261,6 +261,7 @@ __export(index_exports, {
261
261
  SearchUDFSymbolsQueryParams: () => SearchUDFSymbolsQueryParams,
262
262
  SearchUDFSymbolsResponse: () => SearchUDFSymbolsResponse,
263
263
  SearchUDFSymbolsResponseItem: () => SearchUDFSymbolsResponseItem,
264
+ SignerMismatchError: () => SignerMismatchError,
264
265
  TIMING_CONSTANTS: () => TIMING_CONSTANTS,
265
266
  TX_BASE_FIELDS: () => TX_BASE_FIELDS,
266
267
  TimeoutError: () => TimeoutError,
@@ -636,7 +637,7 @@ __export(index_exports, {
636
637
  module.exports = __toCommonJS(index_exports);
637
638
 
638
639
  // src/core/user-agent.ts
639
- var SDK_VERSION = "0.17.0";
640
+ var SDK_VERSION = "0.18.0";
640
641
  var USER_AGENT = `ault-sdk-ts/${SDK_VERSION}`;
641
642
  function isServerRuntime() {
642
643
  if (typeof document !== "undefined") return false;
@@ -812,6 +813,16 @@ var TxConfirmationUnavailableError = class extends TxError {
812
813
  this.name = "TxConfirmationUnavailableError";
813
814
  }
814
815
  };
816
+ var SignerMismatchError = class extends Error {
817
+ constructor(params) {
818
+ super(
819
+ 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."
820
+ );
821
+ this.name = "SignerMismatchError";
822
+ this.signerAddress = params.signerAddress;
823
+ this.recoveredAddress = params.recoveredAddress;
824
+ }
825
+ };
815
826
  var MissingMsgResponseError = class extends Error {
816
827
  constructor(typeUrl, txHash) {
817
828
  super(
@@ -1120,7 +1131,7 @@ var GAS_CONSTANTS = {
1120
1131
  REVOKE_BUILDER: 57e3,
1121
1132
  SET_REFERRAL_CODE: 76e3,
1122
1133
  SET_REFERRAL: 8e4,
1123
- // CLOB module — mirror the chain's x/clob MinGasLimit* (agent_msg.go, v3.0.0-rc.3) exactly:
1134
+ // CLOB module — mirror the chain's x/clob MinGasLimit* (agent_msg.go, v3.0.0-rc.5) exactly:
1124
1135
  // the agent ante enforces MinGasLimit ≤ gas ≤ MinGasLimit×1.2, so any drift
1125
1136
  // makes the SDK over- or under-shoot that window.
1126
1137
  LIMIT_ORDER: 155e3,
@@ -1134,10 +1145,10 @@ var GAS_CONSTANTS = {
1134
1145
  MODIFY_ORDER_PER_ID: 155e3,
1135
1146
  // Conditional and group orders (v3.0.0-rc.3). Modifying conditionals prices
1136
1147
  // each order on top of the base; a group order is flat whatever its shape.
1137
- CONDITIONAL_ORDER: 125e3,
1148
+ CONDITIONAL_ORDER: 14e4,
1138
1149
  MODIFY_CONDITIONAL_BASE: 55e3,
1139
1150
  MODIFY_CONDITIONAL_PER_ORDER: 49e3,
1140
- GROUP_ORDER: 222e3,
1151
+ GROUP_ORDER: 254e3,
1141
1152
  // Accountx module
1142
1153
  OPEN_ACCOUNT: 96e3,
1143
1154
  // Perpetual module (chain v3) — since v3.0.0-rc.2 every fee-free perpetual
@@ -1156,25 +1167,25 @@ var GAS_CONSTANTS = {
1156
1167
  // is not fee-free; its builder simulates like staking.
1157
1168
  LENDING_SUPPLY: 122e3,
1158
1169
  LENDING_WITHDRAW: 115e3,
1159
- LENDING_SUPPLY_COLLATERAL: 11e4,
1160
- LENDING_WITHDRAW_COLLATERAL: 24e4,
1161
- LENDING_BORROW: 26e4,
1170
+ LENDING_SUPPLY_COLLATERAL: 115e3,
1171
+ LENDING_WITHDRAW_COLLATERAL: 26e4,
1172
+ LENDING_BORROW: 28e4,
1162
1173
  LENDING_REPAY: 1e5,
1163
- LENDING_LIQUIDATE: 43e4,
1174
+ LENDING_LIQUIDATE: 49e4,
1164
1175
  LENDING_FUND_INSURANCE_FUND: 15e4,
1165
1176
  // Margin module (x/margin/types/fee_free.go). Deposit and withdraw price
1166
1177
  // each coin on top of the base.
1167
1178
  MARGIN_DEPOSIT_BASE: 88e3,
1168
- MARGIN_DEPOSIT_PER_COIN: 46e3,
1179
+ MARGIN_DEPOSIT_PER_COIN: 53e3,
1169
1180
  MARGIN_WITHDRAW_BASE: 74e3,
1170
- MARGIN_WITHDRAW_PER_COIN: 18e4,
1171
- MARGIN_BORROW: 227e3,
1181
+ MARGIN_WITHDRAW_PER_COIN: 21e4,
1182
+ MARGIN_BORROW: 25e4,
1172
1183
  MARGIN_REPAY: 259e3,
1173
1184
  // Vault module (x/vault/types/fee_free.go). A trading vault's creation adds
1174
1185
  // a per-market cost to its base, a lending vault's a per-pool cost to its own.
1175
- VAULT_CREATE_TRADING_BASE: 19e4,
1186
+ VAULT_CREATE_TRADING_BASE: 22e4,
1176
1187
  VAULT_CREATE_PER_MARKET: 9e3,
1177
- VAULT_CREATE_LENDING_BASE: 124e3,
1188
+ VAULT_CREATE_LENDING_BASE: 16e4,
1178
1189
  VAULT_CREATE_PER_LENDING_POOL: 7e3,
1179
1190
  VAULT_UPDATE_MANAGER: 95e3,
1180
1191
  // A config update is priced like creation: per spot market or per pool.
@@ -5211,6 +5222,7 @@ var EIP712_MSG_TYPES = {
5211
5222
  { name: "manager", type: "string" },
5212
5223
  { name: "initial_deposit", type: "NESTED", jsName: "initialDeposit" },
5213
5224
  { name: "fund_window", type: "NESTED", jsName: "fundWindow" },
5225
+ { name: "description", type: "NESTED" },
5214
5226
  { name: "Terms", type: "NESTED", oneof: true },
5215
5227
  { name: "Config", type: "NESTED", oneof: true }
5216
5228
  ],
@@ -5219,6 +5231,10 @@ var EIP712_MSG_TYPES = {
5219
5231
  { name: "value", type: "NESTED" },
5220
5232
  { name: "type", type: "string" }
5221
5233
  ],
5234
+ description: [
5235
+ { name: "name", type: "string" },
5236
+ { name: "details", type: "string" }
5237
+ ],
5222
5238
  fund_window: [
5223
5239
  { name: "redemption_open_time", type: "string", jsName: "redemptionOpenTime" },
5224
5240
  { name: "deposit_open_time", type: "string", jsName: "depositOpenTime" },
@@ -9724,11 +9740,11 @@ function createBaseAsset() {
9724
9740
  maxBonus: "",
9725
9741
  kinks: [],
9726
9742
  rates: [],
9727
- supplyCap: "",
9743
+ collateralCap: "",
9728
9744
  borrowCap: "",
9729
9745
  oracleAsset: "",
9730
9746
  spotMarketId: new Uint8Array(0),
9731
- spotQuoteOracleDenom: ""
9747
+ availableAt: 0n
9732
9748
  };
9733
9749
  }
9734
9750
  var Asset = {
@@ -9754,8 +9770,8 @@ var Asset = {
9754
9770
  for (const v of message.rates) {
9755
9771
  writer.uint32(58).string(v);
9756
9772
  }
9757
- if (message.supplyCap !== "") {
9758
- writer.uint32(66).string(message.supplyCap);
9773
+ if (message.collateralCap !== "") {
9774
+ writer.uint32(66).string(message.collateralCap);
9759
9775
  }
9760
9776
  if (message.borrowCap !== "") {
9761
9777
  writer.uint32(74).string(message.borrowCap);
@@ -9766,8 +9782,13 @@ var Asset = {
9766
9782
  if (message.spotMarketId.length !== 0) {
9767
9783
  writer.uint32(90).bytes(message.spotMarketId);
9768
9784
  }
9769
- if (message.spotQuoteOracleDenom !== "") {
9770
- writer.uint32(98).string(message.spotQuoteOracleDenom);
9785
+ if (message.availableAt !== 0n) {
9786
+ if (BigInt.asIntN(64, message.availableAt) !== message.availableAt) {
9787
+ throw new globalThis.Error(
9788
+ "value provided for field message.availableAt of type int64 too large"
9789
+ );
9790
+ }
9791
+ writer.uint32(104).int64(message.availableAt);
9771
9792
  }
9772
9793
  return writer;
9773
9794
  },
@@ -9831,7 +9852,7 @@ var Asset = {
9831
9852
  if (tag !== 66) {
9832
9853
  break;
9833
9854
  }
9834
- message.supplyCap = reader.string();
9855
+ message.collateralCap = reader.string();
9835
9856
  continue;
9836
9857
  }
9837
9858
  case 9: {
@@ -9855,11 +9876,11 @@ var Asset = {
9855
9876
  message.spotMarketId = reader.bytes();
9856
9877
  continue;
9857
9878
  }
9858
- case 12: {
9859
- if (tag !== 98) {
9879
+ case 13: {
9880
+ if (tag !== 104) {
9860
9881
  break;
9861
9882
  }
9862
- message.spotQuoteOracleDenom = reader.string();
9883
+ message.availableAt = reader.int64();
9863
9884
  continue;
9864
9885
  }
9865
9886
  }
@@ -9879,11 +9900,11 @@ var Asset = {
9879
9900
  maxBonus: isSet19(object2.maxBonus) ? globalThis.String(object2.maxBonus) : isSet19(object2.max_bonus) ? globalThis.String(object2.max_bonus) : "",
9880
9901
  kinks: globalThis.Array.isArray(object2?.kinks) ? object2.kinks.map((e) => globalThis.String(e)) : [],
9881
9902
  rates: globalThis.Array.isArray(object2?.rates) ? object2.rates.map((e) => globalThis.String(e)) : [],
9882
- supplyCap: isSet19(object2.supplyCap) ? globalThis.String(object2.supplyCap) : isSet19(object2.supply_cap) ? globalThis.String(object2.supply_cap) : "",
9903
+ collateralCap: isSet19(object2.collateralCap) ? globalThis.String(object2.collateralCap) : isSet19(object2.collateral_cap) ? globalThis.String(object2.collateral_cap) : "",
9883
9904
  borrowCap: isSet19(object2.borrowCap) ? globalThis.String(object2.borrowCap) : isSet19(object2.borrow_cap) ? globalThis.String(object2.borrow_cap) : "",
9884
9905
  oracleAsset: isSet19(object2.oracleAsset) ? globalThis.String(object2.oracleAsset) : isSet19(object2.oracle_asset) ? globalThis.String(object2.oracle_asset) : "",
9885
9906
  spotMarketId: isSet19(object2.spotMarketId) ? bytesFromBase646(object2.spotMarketId) : isSet19(object2.spot_market_id) ? bytesFromBase646(object2.spot_market_id) : new Uint8Array(0),
9886
- spotQuoteOracleDenom: isSet19(object2.spotQuoteOracleDenom) ? globalThis.String(object2.spotQuoteOracleDenom) : isSet19(object2.spot_quote_oracle_denom) ? globalThis.String(object2.spot_quote_oracle_denom) : ""
9907
+ availableAt: isSet19(object2.availableAt) ? BigInt(object2.availableAt) : isSet19(object2.available_at) ? BigInt(object2.available_at) : 0n
9887
9908
  };
9888
9909
  },
9889
9910
  toJSON(message) {
@@ -9909,8 +9930,8 @@ var Asset = {
9909
9930
  if (message.rates?.length) {
9910
9931
  obj.rates = message.rates;
9911
9932
  }
9912
- if (message.supplyCap !== "") {
9913
- obj.supplyCap = message.supplyCap;
9933
+ if (message.collateralCap !== "") {
9934
+ obj.collateralCap = message.collateralCap;
9914
9935
  }
9915
9936
  if (message.borrowCap !== "") {
9916
9937
  obj.borrowCap = message.borrowCap;
@@ -9921,8 +9942,8 @@ var Asset = {
9921
9942
  if (message.spotMarketId.length !== 0) {
9922
9943
  obj.spotMarketId = base64FromBytes6(message.spotMarketId);
9923
9944
  }
9924
- if (message.spotQuoteOracleDenom !== "") {
9925
- obj.spotQuoteOracleDenom = message.spotQuoteOracleDenom;
9945
+ if (message.availableAt !== 0n) {
9946
+ obj.availableAt = message.availableAt.toString();
9926
9947
  }
9927
9948
  return obj;
9928
9949
  },
@@ -9938,22 +9959,16 @@ var Asset = {
9938
9959
  message.maxBonus = object2.maxBonus ?? "";
9939
9960
  message.kinks = object2.kinks?.map((e) => e) || [];
9940
9961
  message.rates = object2.rates?.map((e) => e) || [];
9941
- message.supplyCap = object2.supplyCap ?? "";
9962
+ message.collateralCap = object2.collateralCap ?? "";
9942
9963
  message.borrowCap = object2.borrowCap ?? "";
9943
9964
  message.oracleAsset = object2.oracleAsset ?? "";
9944
9965
  message.spotMarketId = object2.spotMarketId ?? new Uint8Array(0);
9945
- message.spotQuoteOracleDenom = object2.spotQuoteOracleDenom ?? "";
9966
+ message.availableAt = object2.availableAt ?? 0n;
9946
9967
  return message;
9947
9968
  }
9948
9969
  };
9949
9970
  function createBaseAssetRisk() {
9950
- return {
9951
- ltv: "",
9952
- lt: "",
9953
- oracleAsset: "",
9954
- spotMarketId: new Uint8Array(0),
9955
- spotQuoteOracleDenom: ""
9956
- };
9971
+ return { ltv: "", lt: "", spotMarketId: new Uint8Array(0) };
9957
9972
  }
9958
9973
  var AssetRisk = {
9959
9974
  encode(message, writer = new import_wire21.BinaryWriter()) {
@@ -9963,15 +9978,9 @@ var AssetRisk = {
9963
9978
  if (message.lt !== "") {
9964
9979
  writer.uint32(18).string(message.lt);
9965
9980
  }
9966
- if (message.oracleAsset !== "") {
9967
- writer.uint32(26).string(message.oracleAsset);
9968
- }
9969
9981
  if (message.spotMarketId.length !== 0) {
9970
9982
  writer.uint32(34).bytes(message.spotMarketId);
9971
9983
  }
9972
- if (message.spotQuoteOracleDenom !== "") {
9973
- writer.uint32(42).string(message.spotQuoteOracleDenom);
9974
- }
9975
9984
  return writer;
9976
9985
  },
9977
9986
  decode(input, length) {
@@ -9995,13 +10004,6 @@ var AssetRisk = {
9995
10004
  message.lt = reader.string();
9996
10005
  continue;
9997
10006
  }
9998
- case 3: {
9999
- if (tag !== 26) {
10000
- break;
10001
- }
10002
- message.oracleAsset = reader.string();
10003
- continue;
10004
- }
10005
10007
  case 4: {
10006
10008
  if (tag !== 34) {
10007
10009
  break;
@@ -10009,13 +10011,6 @@ var AssetRisk = {
10009
10011
  message.spotMarketId = reader.bytes();
10010
10012
  continue;
10011
10013
  }
10012
- case 5: {
10013
- if (tag !== 42) {
10014
- break;
10015
- }
10016
- message.spotQuoteOracleDenom = reader.string();
10017
- continue;
10018
- }
10019
10014
  }
10020
10015
  if ((tag & 7) === 4 || tag === 0) {
10021
10016
  break;
@@ -10028,9 +10023,7 @@ var AssetRisk = {
10028
10023
  return {
10029
10024
  ltv: isSet19(object2.ltv) ? globalThis.String(object2.ltv) : "",
10030
10025
  lt: isSet19(object2.lt) ? globalThis.String(object2.lt) : "",
10031
- oracleAsset: isSet19(object2.oracleAsset) ? globalThis.String(object2.oracleAsset) : isSet19(object2.oracle_asset) ? globalThis.String(object2.oracle_asset) : "",
10032
- spotMarketId: isSet19(object2.spotMarketId) ? bytesFromBase646(object2.spotMarketId) : isSet19(object2.spot_market_id) ? bytesFromBase646(object2.spot_market_id) : new Uint8Array(0),
10033
- spotQuoteOracleDenom: isSet19(object2.spotQuoteOracleDenom) ? globalThis.String(object2.spotQuoteOracleDenom) : isSet19(object2.spot_quote_oracle_denom) ? globalThis.String(object2.spot_quote_oracle_denom) : ""
10026
+ spotMarketId: isSet19(object2.spotMarketId) ? bytesFromBase646(object2.spotMarketId) : isSet19(object2.spot_market_id) ? bytesFromBase646(object2.spot_market_id) : new Uint8Array(0)
10034
10027
  };
10035
10028
  },
10036
10029
  toJSON(message) {
@@ -10041,15 +10034,9 @@ var AssetRisk = {
10041
10034
  if (message.lt !== "") {
10042
10035
  obj.lt = message.lt;
10043
10036
  }
10044
- if (message.oracleAsset !== "") {
10045
- obj.oracleAsset = message.oracleAsset;
10046
- }
10047
10037
  if (message.spotMarketId.length !== 0) {
10048
10038
  obj.spotMarketId = base64FromBytes6(message.spotMarketId);
10049
10039
  }
10050
- if (message.spotQuoteOracleDenom !== "") {
10051
- obj.spotQuoteOracleDenom = message.spotQuoteOracleDenom;
10052
- }
10053
10040
  return obj;
10054
10041
  },
10055
10042
  create(base) {
@@ -10059,9 +10046,7 @@ var AssetRisk = {
10059
10046
  const message = createBaseAssetRisk();
10060
10047
  message.ltv = object2.ltv ?? "";
10061
10048
  message.lt = object2.lt ?? "";
10062
- message.oracleAsset = object2.oracleAsset ?? "";
10063
10049
  message.spotMarketId = object2.spotMarketId ?? new Uint8Array(0);
10064
- message.spotQuoteOracleDenom = object2.spotQuoteOracleDenom ?? "";
10065
10050
  return message;
10066
10051
  }
10067
10052
  };
@@ -10321,7 +10306,8 @@ function createBaseAssetState() {
10321
10306
  totalSupplyShares: "",
10322
10307
  totalBorrowShares: "",
10323
10308
  collectedProtocolFee: "",
10324
- deficit: ""
10309
+ deficit: "",
10310
+ totalCollateral: ""
10325
10311
  };
10326
10312
  }
10327
10313
  var AssetState = {
@@ -10344,6 +10330,9 @@ var AssetState = {
10344
10330
  if (message.deficit !== "") {
10345
10331
  writer.uint32(50).string(message.deficit);
10346
10332
  }
10333
+ if (message.totalCollateral !== "") {
10334
+ writer.uint32(58).string(message.totalCollateral);
10335
+ }
10347
10336
  return writer;
10348
10337
  },
10349
10338
  decode(input, length) {
@@ -10395,6 +10384,13 @@ var AssetState = {
10395
10384
  message.deficit = reader.string();
10396
10385
  continue;
10397
10386
  }
10387
+ case 7: {
10388
+ if (tag !== 58) {
10389
+ break;
10390
+ }
10391
+ message.totalCollateral = reader.string();
10392
+ continue;
10393
+ }
10398
10394
  }
10399
10395
  if ((tag & 7) === 4 || tag === 0) {
10400
10396
  break;
@@ -10410,7 +10406,8 @@ var AssetState = {
10410
10406
  totalSupplyShares: isSet19(object2.totalSupplyShares) ? globalThis.String(object2.totalSupplyShares) : isSet19(object2.total_supply_shares) ? globalThis.String(object2.total_supply_shares) : "",
10411
10407
  totalBorrowShares: isSet19(object2.totalBorrowShares) ? globalThis.String(object2.totalBorrowShares) : isSet19(object2.total_borrow_shares) ? globalThis.String(object2.total_borrow_shares) : "",
10412
10408
  collectedProtocolFee: isSet19(object2.collectedProtocolFee) ? globalThis.String(object2.collectedProtocolFee) : isSet19(object2.collected_protocol_fee) ? globalThis.String(object2.collected_protocol_fee) : "",
10413
- deficit: isSet19(object2.deficit) ? globalThis.String(object2.deficit) : ""
10409
+ deficit: isSet19(object2.deficit) ? globalThis.String(object2.deficit) : "",
10410
+ totalCollateral: isSet19(object2.totalCollateral) ? globalThis.String(object2.totalCollateral) : isSet19(object2.total_collateral) ? globalThis.String(object2.total_collateral) : ""
10414
10411
  };
10415
10412
  },
10416
10413
  toJSON(message) {
@@ -10433,6 +10430,9 @@ var AssetState = {
10433
10430
  if (message.deficit !== "") {
10434
10431
  obj.deficit = message.deficit;
10435
10432
  }
10433
+ if (message.totalCollateral !== "") {
10434
+ obj.totalCollateral = message.totalCollateral;
10435
+ }
10436
10436
  return obj;
10437
10437
  },
10438
10438
  create(base) {
@@ -10446,6 +10446,7 @@ var AssetState = {
10446
10446
  message.totalBorrowShares = object2.totalBorrowShares ?? "";
10447
10447
  message.collectedProtocolFee = object2.collectedProtocolFee ?? "";
10448
10448
  message.deficit = object2.deficit ?? "";
10449
+ message.totalCollateral = object2.totalCollateral ?? "";
10449
10450
  return message;
10450
10451
  }
10451
10452
  };
@@ -17021,6 +17022,74 @@ var OracleFeed = {
17021
17022
  return message;
17022
17023
  }
17023
17024
  };
17025
+ function createBaseDescription() {
17026
+ return { name: "", details: "" };
17027
+ }
17028
+ var Description = {
17029
+ encode(message, writer = new import_wire37.BinaryWriter()) {
17030
+ if (message.name !== "") {
17031
+ writer.uint32(10).string(message.name);
17032
+ }
17033
+ if (message.details !== "") {
17034
+ writer.uint32(18).string(message.details);
17035
+ }
17036
+ return writer;
17037
+ },
17038
+ decode(input, length) {
17039
+ const reader = input instanceof import_wire37.BinaryReader ? input : new import_wire37.BinaryReader(input);
17040
+ const end = length === void 0 ? reader.len : reader.pos + length;
17041
+ const message = createBaseDescription();
17042
+ while (reader.pos < end) {
17043
+ const tag = reader.uint32();
17044
+ switch (tag >>> 3) {
17045
+ case 1: {
17046
+ if (tag !== 10) {
17047
+ break;
17048
+ }
17049
+ message.name = reader.string();
17050
+ continue;
17051
+ }
17052
+ case 2: {
17053
+ if (tag !== 18) {
17054
+ break;
17055
+ }
17056
+ message.details = reader.string();
17057
+ continue;
17058
+ }
17059
+ }
17060
+ if ((tag & 7) === 4 || tag === 0) {
17061
+ break;
17062
+ }
17063
+ reader.skip(tag & 7);
17064
+ }
17065
+ return message;
17066
+ },
17067
+ fromJSON(object2) {
17068
+ return {
17069
+ name: isSet35(object2.name) ? globalThis.String(object2.name) : "",
17070
+ details: isSet35(object2.details) ? globalThis.String(object2.details) : ""
17071
+ };
17072
+ },
17073
+ toJSON(message) {
17074
+ const obj = {};
17075
+ if (message.name !== "") {
17076
+ obj.name = message.name;
17077
+ }
17078
+ if (message.details !== "") {
17079
+ obj.details = message.details;
17080
+ }
17081
+ return obj;
17082
+ },
17083
+ create(base) {
17084
+ return Description.fromPartial(base ?? {});
17085
+ },
17086
+ fromPartial(object2) {
17087
+ const message = createBaseDescription();
17088
+ message.name = object2.name ?? "";
17089
+ message.details = object2.details ?? "";
17090
+ return message;
17091
+ }
17092
+ };
17024
17093
  function bytesFromBase6412(b64) {
17025
17094
  if (globalThis.Buffer) {
17026
17095
  return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
@@ -17353,7 +17422,8 @@ function createBaseMsgCreateVault() {
17353
17422
  tradingTerms: void 0,
17354
17423
  lending: void 0,
17355
17424
  trading: void 0,
17356
- initialDeposit: void 0
17425
+ initialDeposit: void 0,
17426
+ description: void 0
17357
17427
  };
17358
17428
  }
17359
17429
  var MsgCreateVault = {
@@ -17388,6 +17458,9 @@ var MsgCreateVault = {
17388
17458
  if (message.initialDeposit !== void 0) {
17389
17459
  Coin.encode(message.initialDeposit, writer.uint32(82).fork()).join();
17390
17460
  }
17461
+ if (message.description !== void 0) {
17462
+ Description.encode(message.description, writer.uint32(90).fork()).join();
17463
+ }
17391
17464
  return writer;
17392
17465
  },
17393
17466
  decode(input, length) {
@@ -17467,6 +17540,13 @@ var MsgCreateVault = {
17467
17540
  message.initialDeposit = Coin.decode(reader, reader.uint32());
17468
17541
  continue;
17469
17542
  }
17543
+ case 11: {
17544
+ if (tag !== 90) {
17545
+ break;
17546
+ }
17547
+ message.description = Description.decode(reader, reader.uint32());
17548
+ continue;
17549
+ }
17470
17550
  }
17471
17551
  if ((tag & 7) === 4 || tag === 0) {
17472
17552
  break;
@@ -17486,7 +17566,8 @@ var MsgCreateVault = {
17486
17566
  tradingTerms: isSet37(object2.tradingTerms) ? TradingVaultTerms.fromJSON(object2.tradingTerms) : isSet37(object2.trading_terms) ? TradingVaultTerms.fromJSON(object2.trading_terms) : void 0,
17487
17567
  lending: isSet37(object2.lending) ? LendingVaultConfig.fromJSON(object2.lending) : void 0,
17488
17568
  trading: isSet37(object2.trading) ? TradingVaultConfig.fromJSON(object2.trading) : void 0,
17489
- initialDeposit: isSet37(object2.initialDeposit) ? Coin.fromJSON(object2.initialDeposit) : isSet37(object2.initial_deposit) ? Coin.fromJSON(object2.initial_deposit) : void 0
17569
+ initialDeposit: isSet37(object2.initialDeposit) ? Coin.fromJSON(object2.initialDeposit) : isSet37(object2.initial_deposit) ? Coin.fromJSON(object2.initial_deposit) : void 0,
17570
+ description: isSet37(object2.description) ? Description.fromJSON(object2.description) : void 0
17490
17571
  };
17491
17572
  },
17492
17573
  toJSON(message) {
@@ -17521,6 +17602,9 @@ var MsgCreateVault = {
17521
17602
  if (message.initialDeposit !== void 0) {
17522
17603
  obj.initialDeposit = Coin.toJSON(message.initialDeposit);
17523
17604
  }
17605
+ if (message.description !== void 0) {
17606
+ obj.description = Description.toJSON(message.description);
17607
+ }
17524
17608
  return obj;
17525
17609
  },
17526
17610
  create(base) {
@@ -17538,6 +17622,7 @@ var MsgCreateVault = {
17538
17622
  message.lending = object2.lending !== void 0 && object2.lending !== null ? LendingVaultConfig.fromPartial(object2.lending) : void 0;
17539
17623
  message.trading = object2.trading !== void 0 && object2.trading !== null ? TradingVaultConfig.fromPartial(object2.trading) : void 0;
17540
17624
  message.initialDeposit = object2.initialDeposit !== void 0 && object2.initialDeposit !== null ? Coin.fromPartial(object2.initialDeposit) : void 0;
17625
+ message.description = object2.description !== void 0 && object2.description !== null ? Description.fromPartial(object2.description) : void 0;
17541
17626
  return message;
17542
17627
  }
17543
17628
  };
@@ -18681,10 +18766,10 @@ var Commission = {
18681
18766
  return message;
18682
18767
  }
18683
18768
  };
18684
- function createBaseDescription() {
18769
+ function createBaseDescription2() {
18685
18770
  return { moniker: "", identity: "", website: "", securityContact: "", details: "" };
18686
18771
  }
18687
- var Description = {
18772
+ var Description2 = {
18688
18773
  encode(message, writer = new import_wire42.BinaryWriter()) {
18689
18774
  if (message.moniker !== "") {
18690
18775
  writer.uint32(10).string(message.moniker);
@@ -18706,7 +18791,7 @@ var Description = {
18706
18791
  decode(input, length) {
18707
18792
  const reader = input instanceof import_wire42.BinaryReader ? input : new import_wire42.BinaryReader(input);
18708
18793
  const end = length === void 0 ? reader.len : reader.pos + length;
18709
- const message = createBaseDescription();
18794
+ const message = createBaseDescription2();
18710
18795
  while (reader.pos < end) {
18711
18796
  const tag = reader.uint32();
18712
18797
  switch (tag >>> 3) {
@@ -18782,10 +18867,10 @@ var Description = {
18782
18867
  return obj;
18783
18868
  },
18784
18869
  create(base) {
18785
- return Description.fromPartial(base ?? {});
18870
+ return Description2.fromPartial(base ?? {});
18786
18871
  },
18787
18872
  fromPartial(object2) {
18788
- const message = createBaseDescription();
18873
+ const message = createBaseDescription2();
18789
18874
  message.moniker = object2.moniker ?? "";
18790
18875
  message.identity = object2.identity ?? "";
18791
18876
  message.website = object2.website ?? "";
@@ -18832,7 +18917,7 @@ var Validator = {
18832
18917
  writer.uint32(50).string(message.delegatorShares);
18833
18918
  }
18834
18919
  if (message.description !== void 0) {
18835
- Description.encode(message.description, writer.uint32(58).fork()).join();
18920
+ Description2.encode(message.description, writer.uint32(58).fork()).join();
18836
18921
  }
18837
18922
  if (message.unbondingHeight !== 0n) {
18838
18923
  if (BigInt.asIntN(64, message.unbondingHeight) !== message.unbondingHeight) {
@@ -18924,7 +19009,7 @@ var Validator = {
18924
19009
  if (tag !== 58) {
18925
19010
  break;
18926
19011
  }
18927
- message.description = Description.decode(reader, reader.uint32());
19012
+ message.description = Description2.decode(reader, reader.uint32());
18928
19013
  continue;
18929
19014
  }
18930
19015
  case 8: {
@@ -18992,7 +19077,7 @@ var Validator = {
18992
19077
  status: isSet40(object2.status) ? bondStatusFromJSON(object2.status) : 0,
18993
19078
  tokens: isSet40(object2.tokens) ? globalThis.String(object2.tokens) : "",
18994
19079
  delegatorShares: isSet40(object2.delegatorShares) ? globalThis.String(object2.delegatorShares) : isSet40(object2.delegator_shares) ? globalThis.String(object2.delegator_shares) : "",
18995
- description: isSet40(object2.description) ? Description.fromJSON(object2.description) : void 0,
19080
+ description: isSet40(object2.description) ? Description2.fromJSON(object2.description) : void 0,
18996
19081
  unbondingHeight: isSet40(object2.unbondingHeight) ? BigInt(object2.unbondingHeight) : isSet40(object2.unbonding_height) ? BigInt(object2.unbonding_height) : 0n,
18997
19082
  unbondingTime: isSet40(object2.unbondingTime) ? fromJsonTimestamp7(object2.unbondingTime) : isSet40(object2.unbonding_time) ? fromJsonTimestamp7(object2.unbonding_time) : void 0,
18998
19083
  commission: isSet40(object2.commission) ? Commission.fromJSON(object2.commission) : void 0,
@@ -19022,7 +19107,7 @@ var Validator = {
19022
19107
  obj.delegatorShares = message.delegatorShares;
19023
19108
  }
19024
19109
  if (message.description !== void 0) {
19025
- obj.description = Description.toJSON(message.description);
19110
+ obj.description = Description2.toJSON(message.description);
19026
19111
  }
19027
19112
  if (message.unbondingHeight !== 0n) {
19028
19113
  obj.unbondingHeight = message.unbondingHeight.toString();
@@ -19055,7 +19140,7 @@ var Validator = {
19055
19140
  message.status = object2.status ?? 0;
19056
19141
  message.tokens = object2.tokens ?? "";
19057
19142
  message.delegatorShares = object2.delegatorShares ?? "";
19058
- message.description = object2.description !== void 0 && object2.description !== null ? Description.fromPartial(object2.description) : void 0;
19143
+ message.description = object2.description !== void 0 && object2.description !== null ? Description2.fromPartial(object2.description) : void 0;
19059
19144
  message.unbondingHeight = object2.unbondingHeight ?? 0n;
19060
19145
  message.unbondingTime = object2.unbondingTime ?? void 0;
19061
19146
  message.commission = object2.commission !== void 0 && object2.commission !== null ? Commission.fromPartial(object2.commission) : void 0;
@@ -20718,6 +20803,14 @@ function mapAultVaultV1AllowedMarkets(input, label = "value") {
20718
20803
  lendingPoolIds: requireBigIntArray(record2["lendingPoolIds"], `${prefix}lendingPoolIds`)
20719
20804
  };
20720
20805
  }
20806
+ function mapAultVaultV1Description(input, label = "value") {
20807
+ const record2 = asRecord(input);
20808
+ const prefix = label ? `${label}.` : "";
20809
+ return {
20810
+ name: requireString(record2["name"], `${prefix}name`),
20811
+ details: requireString(record2["details"], `${prefix}details`)
20812
+ };
20813
+ }
20721
20814
  function mapAultVaultV1FundWindow(input, label = "value") {
20722
20815
  const record2 = asRecord(input);
20723
20816
  const prefix = label ? `${label}.` : "";
@@ -20810,7 +20903,8 @@ function mapAultVaultV1MsgCreateVault(input, label = "value") {
20810
20903
  initialDeposit: mapCosmosBaseV1beta1Coin(
20811
20904
  asRecord(record2["initialDeposit"]),
20812
20905
  `${prefix}initialDeposit`
20813
- )
20906
+ ),
20907
+ description: mapAultVaultV1Description(asRecord(record2["description"]), `${prefix}description`)
20814
20908
  };
20815
20909
  }
20816
20910
  function mapAultVaultV1MsgDeposit(input, label = "value") {
@@ -27528,7 +27622,7 @@ var Params14 = {
27528
27622
  }
27529
27623
  };
27530
27624
  function createBaseFeed() {
27531
- return { feedId: "", owner: "", enabled: false, marketId: "", baseDenom: "", quoteDenom: "" };
27625
+ return { feedId: "", owner: "", enabled: false, marketId: "", baseDenom: "" };
27532
27626
  }
27533
27627
  var Feed = {
27534
27628
  encode(message, writer = new import_wire52.BinaryWriter()) {
@@ -27547,9 +27641,6 @@ var Feed = {
27547
27641
  if (message.baseDenom !== "") {
27548
27642
  writer.uint32(42).string(message.baseDenom);
27549
27643
  }
27550
- if (message.quoteDenom !== "") {
27551
- writer.uint32(50).string(message.quoteDenom);
27552
- }
27553
27644
  return writer;
27554
27645
  },
27555
27646
  decode(input, length) {
@@ -27594,13 +27685,6 @@ var Feed = {
27594
27685
  message.baseDenom = reader.string();
27595
27686
  continue;
27596
27687
  }
27597
- case 6: {
27598
- if (tag !== 50) {
27599
- break;
27600
- }
27601
- message.quoteDenom = reader.string();
27602
- continue;
27603
- }
27604
27688
  }
27605
27689
  if ((tag & 7) === 4 || tag === 0) {
27606
27690
  break;
@@ -27615,8 +27699,7 @@ var Feed = {
27615
27699
  owner: isSet50(object2.owner) ? globalThis.String(object2.owner) : "",
27616
27700
  enabled: isSet50(object2.enabled) ? globalThis.Boolean(object2.enabled) : false,
27617
27701
  marketId: isSet50(object2.marketId) ? globalThis.String(object2.marketId) : isSet50(object2.market_id) ? globalThis.String(object2.market_id) : "",
27618
- baseDenom: isSet50(object2.baseDenom) ? globalThis.String(object2.baseDenom) : isSet50(object2.base_denom) ? globalThis.String(object2.base_denom) : "",
27619
- quoteDenom: isSet50(object2.quoteDenom) ? globalThis.String(object2.quoteDenom) : isSet50(object2.quote_denom) ? globalThis.String(object2.quote_denom) : ""
27702
+ baseDenom: isSet50(object2.baseDenom) ? globalThis.String(object2.baseDenom) : isSet50(object2.base_denom) ? globalThis.String(object2.base_denom) : ""
27620
27703
  };
27621
27704
  },
27622
27705
  toJSON(message) {
@@ -27636,9 +27719,6 @@ var Feed = {
27636
27719
  if (message.baseDenom !== "") {
27637
27720
  obj.baseDenom = message.baseDenom;
27638
27721
  }
27639
- if (message.quoteDenom !== "") {
27640
- obj.quoteDenom = message.quoteDenom;
27641
- }
27642
27722
  return obj;
27643
27723
  },
27644
27724
  create(base) {
@@ -27651,7 +27731,6 @@ var Feed = {
27651
27731
  message.enabled = object2.enabled ?? false;
27652
27732
  message.marketId = object2.marketId ?? "";
27653
27733
  message.baseDenom = object2.baseDenom ?? "";
27654
- message.quoteDenom = object2.quoteDenom ?? "";
27655
27734
  return message;
27656
27735
  }
27657
27736
  };
@@ -28276,7 +28355,10 @@ function createBaseMarkPriceState() {
28276
28355
  localMedianWeight: "",
28277
28356
  lastLocalMedianUpdateTime: 0n,
28278
28357
  lastPriceDifferenceUpdateTime: 0n,
28279
- lastUpdateTime: 0n
28358
+ lastUpdateTime: 0n,
28359
+ clamped: false,
28360
+ previousMarkPrice: "",
28361
+ lastChangeHeight: 0n
28280
28362
  };
28281
28363
  }
28282
28364
  var MarkPriceState = {
@@ -28320,6 +28402,20 @@ var MarkPriceState = {
28320
28402
  }
28321
28403
  writer.uint32(64).int64(message.lastUpdateTime);
28322
28404
  }
28405
+ if (message.clamped !== false) {
28406
+ writer.uint32(72).bool(message.clamped);
28407
+ }
28408
+ if (message.previousMarkPrice !== "") {
28409
+ writer.uint32(82).string(message.previousMarkPrice);
28410
+ }
28411
+ if (message.lastChangeHeight !== 0n) {
28412
+ if (BigInt.asIntN(64, message.lastChangeHeight) !== message.lastChangeHeight) {
28413
+ throw new globalThis.Error(
28414
+ "value provided for field message.lastChangeHeight of type int64 too large"
28415
+ );
28416
+ }
28417
+ writer.uint32(88).int64(message.lastChangeHeight);
28418
+ }
28323
28419
  return writer;
28324
28420
  },
28325
28421
  decode(input, length) {
@@ -28385,6 +28481,27 @@ var MarkPriceState = {
28385
28481
  message.lastUpdateTime = reader.int64();
28386
28482
  continue;
28387
28483
  }
28484
+ case 9: {
28485
+ if (tag !== 72) {
28486
+ break;
28487
+ }
28488
+ message.clamped = reader.bool();
28489
+ continue;
28490
+ }
28491
+ case 10: {
28492
+ if (tag !== 82) {
28493
+ break;
28494
+ }
28495
+ message.previousMarkPrice = reader.string();
28496
+ continue;
28497
+ }
28498
+ case 11: {
28499
+ if (tag !== 88) {
28500
+ break;
28501
+ }
28502
+ message.lastChangeHeight = reader.int64();
28503
+ continue;
28504
+ }
28388
28505
  }
28389
28506
  if ((tag & 7) === 4 || tag === 0) {
28390
28507
  break;
@@ -28402,7 +28519,10 @@ var MarkPriceState = {
28402
28519
  localMedianWeight: isSet52(object2.localMedianWeight) ? globalThis.String(object2.localMedianWeight) : isSet52(object2.local_median_weight) ? globalThis.String(object2.local_median_weight) : "",
28403
28520
  lastLocalMedianUpdateTime: isSet52(object2.lastLocalMedianUpdateTime) ? BigInt(object2.lastLocalMedianUpdateTime) : isSet52(object2.last_local_median_update_time) ? BigInt(object2.last_local_median_update_time) : 0n,
28404
28521
  lastPriceDifferenceUpdateTime: isSet52(object2.lastPriceDifferenceUpdateTime) ? BigInt(object2.lastPriceDifferenceUpdateTime) : isSet52(object2.last_price_difference_update_time) ? BigInt(object2.last_price_difference_update_time) : 0n,
28405
- lastUpdateTime: isSet52(object2.lastUpdateTime) ? BigInt(object2.lastUpdateTime) : isSet52(object2.last_update_time) ? BigInt(object2.last_update_time) : 0n
28522
+ lastUpdateTime: isSet52(object2.lastUpdateTime) ? BigInt(object2.lastUpdateTime) : isSet52(object2.last_update_time) ? BigInt(object2.last_update_time) : 0n,
28523
+ clamped: isSet52(object2.clamped) ? globalThis.Boolean(object2.clamped) : false,
28524
+ previousMarkPrice: isSet52(object2.previousMarkPrice) ? globalThis.String(object2.previousMarkPrice) : isSet52(object2.previous_mark_price) ? globalThis.String(object2.previous_mark_price) : "",
28525
+ lastChangeHeight: isSet52(object2.lastChangeHeight) ? BigInt(object2.lastChangeHeight) : isSet52(object2.last_change_height) ? BigInt(object2.last_change_height) : 0n
28406
28526
  };
28407
28527
  },
28408
28528
  toJSON(message) {
@@ -28431,6 +28551,15 @@ var MarkPriceState = {
28431
28551
  if (message.lastUpdateTime !== 0n) {
28432
28552
  obj.lastUpdateTime = message.lastUpdateTime.toString();
28433
28553
  }
28554
+ if (message.clamped !== false) {
28555
+ obj.clamped = message.clamped;
28556
+ }
28557
+ if (message.previousMarkPrice !== "") {
28558
+ obj.previousMarkPrice = message.previousMarkPrice;
28559
+ }
28560
+ if (message.lastChangeHeight !== 0n) {
28561
+ obj.lastChangeHeight = message.lastChangeHeight.toString();
28562
+ }
28434
28563
  return obj;
28435
28564
  },
28436
28565
  create(base) {
@@ -28446,6 +28575,9 @@ var MarkPriceState = {
28446
28575
  message.lastLocalMedianUpdateTime = object2.lastLocalMedianUpdateTime ?? 0n;
28447
28576
  message.lastPriceDifferenceUpdateTime = object2.lastPriceDifferenceUpdateTime ?? 0n;
28448
28577
  message.lastUpdateTime = object2.lastUpdateTime ?? 0n;
28578
+ message.clamped = object2.clamped ?? false;
28579
+ message.previousMarkPrice = object2.previousMarkPrice ?? "";
28580
+ message.lastChangeHeight = object2.lastChangeHeight ?? 0n;
28449
28581
  return message;
28450
28582
  }
28451
28583
  };
@@ -34113,7 +34245,8 @@ function createBaseVaultResponse() {
34113
34245
  totalShares: "",
34114
34246
  pendingConfigUpdate: void 0,
34115
34247
  lendingTerms: void 0,
34116
- tradingTerms: void 0
34248
+ tradingTerms: void 0,
34249
+ description: void 0
34117
34250
  };
34118
34251
  }
34119
34252
  var VaultResponse = {
@@ -34157,6 +34290,9 @@ var VaultResponse = {
34157
34290
  if (message.tradingTerms !== void 0) {
34158
34291
  TradingVaultTerms.encode(message.tradingTerms, writer.uint32(106).fork()).join();
34159
34292
  }
34293
+ if (message.description !== void 0) {
34294
+ Description.encode(message.description, writer.uint32(114).fork()).join();
34295
+ }
34160
34296
  return writer;
34161
34297
  },
34162
34298
  decode(input, length) {
@@ -34257,6 +34393,13 @@ var VaultResponse = {
34257
34393
  message.tradingTerms = TradingVaultTerms.decode(reader, reader.uint32());
34258
34394
  continue;
34259
34395
  }
34396
+ case 14: {
34397
+ if (tag !== 114) {
34398
+ break;
34399
+ }
34400
+ message.description = Description.decode(reader, reader.uint32());
34401
+ continue;
34402
+ }
34260
34403
  }
34261
34404
  if ((tag & 7) === 4 || tag === 0) {
34262
34405
  break;
@@ -34279,7 +34422,8 @@ var VaultResponse = {
34279
34422
  totalShares: isSet62(object2.totalShares) ? globalThis.String(object2.totalShares) : isSet62(object2.total_shares) ? globalThis.String(object2.total_shares) : "",
34280
34423
  pendingConfigUpdate: isSet62(object2.pendingConfigUpdate) ? PendingVaultConfigUpdate.fromJSON(object2.pendingConfigUpdate) : isSet62(object2.pending_config_update) ? PendingVaultConfigUpdate.fromJSON(object2.pending_config_update) : void 0,
34281
34424
  lendingTerms: isSet62(object2.lendingTerms) ? LendingVaultTerms.fromJSON(object2.lendingTerms) : isSet62(object2.lending_terms) ? LendingVaultTerms.fromJSON(object2.lending_terms) : void 0,
34282
- tradingTerms: isSet62(object2.tradingTerms) ? TradingVaultTerms.fromJSON(object2.tradingTerms) : isSet62(object2.trading_terms) ? TradingVaultTerms.fromJSON(object2.trading_terms) : void 0
34425
+ tradingTerms: isSet62(object2.tradingTerms) ? TradingVaultTerms.fromJSON(object2.tradingTerms) : isSet62(object2.trading_terms) ? TradingVaultTerms.fromJSON(object2.trading_terms) : void 0,
34426
+ description: isSet62(object2.description) ? Description.fromJSON(object2.description) : void 0
34283
34427
  };
34284
34428
  },
34285
34429
  toJSON(message) {
@@ -34323,6 +34467,9 @@ var VaultResponse = {
34323
34467
  if (message.tradingTerms !== void 0) {
34324
34468
  obj.tradingTerms = TradingVaultTerms.toJSON(message.tradingTerms);
34325
34469
  }
34470
+ if (message.description !== void 0) {
34471
+ obj.description = Description.toJSON(message.description);
34472
+ }
34326
34473
  return obj;
34327
34474
  },
34328
34475
  create(base) {
@@ -34343,6 +34490,7 @@ var VaultResponse = {
34343
34490
  message.pendingConfigUpdate = object2.pendingConfigUpdate !== void 0 && object2.pendingConfigUpdate !== null ? PendingVaultConfigUpdate.fromPartial(object2.pendingConfigUpdate) : void 0;
34344
34491
  message.lendingTerms = object2.lendingTerms !== void 0 && object2.lendingTerms !== null ? LendingVaultTerms.fromPartial(object2.lendingTerms) : void 0;
34345
34492
  message.tradingTerms = object2.tradingTerms !== void 0 && object2.tradingTerms !== null ? TradingVaultTerms.fromPartial(object2.tradingTerms) : void 0;
34493
+ message.description = object2.description !== void 0 && object2.description !== null ? Description.fromPartial(object2.description) : void 0;
34346
34494
  return message;
34347
34495
  }
34348
34496
  };
@@ -34939,6 +35087,8 @@ function createVaultApi(context) {
34939
35087
 
34940
35088
  // src/eip712/sign-and-broadcast.ts
34941
35089
  var import_viem5 = require("viem");
35090
+ var import_accounts2 = require("viem/accounts");
35091
+ var import_secp256k1 = require("@noble/curves/secp256k1");
34942
35092
 
34943
35093
  // src/proto/tx-encode.ts
34944
35094
  var WIRE_VARINT = 0;
@@ -35541,22 +35691,63 @@ async function resolveDynamicFeeAmount(network, gas, feeMarketCache, fetchFn, fe
35541
35691
  const staticI = BigInt(staticFloor);
35542
35692
  return dynamicI > staticI ? dynamicI.toString() : staticFloor;
35543
35693
  }
35544
- async function recoverPubkeyFromTypedDataSignature(typedData, signature) {
35694
+ async function recoverSignerPubkey(typedData, signature, signerAddress) {
35695
+ const signerEvmAddress = isValidEvmAddress(signerAddress) ? signerAddress : aultToEvm(signerAddress);
35696
+ let sigBytes;
35697
+ try {
35698
+ sigBytes = (0, import_viem5.hexToBytes)(signature);
35699
+ } catch {
35700
+ sigBytes = new Uint8Array();
35701
+ }
35702
+ if (sigBytes.length !== 64 && sigBytes.length !== 65) {
35703
+ throw new SignerMismatchError({
35704
+ signerAddress: signerEvmAddress,
35705
+ message: `The wallet returned a ${sigBytes.length}-byte signature for ${signerEvmAddress}; expected 64 or 65 bytes.`
35706
+ });
35707
+ }
35545
35708
  const hash = (0, import_viem5.hashTypedData)({
35546
35709
  domain: typedData.domain,
35547
35710
  types: typedData.types,
35548
35711
  primaryType: typedData.primaryType,
35549
35712
  message: typedData.message
35550
35713
  });
35551
- const publicKey = await (0, import_viem5.recoverPublicKey)({ hash, signature });
35552
- const uncompressedBytes = (0, import_viem5.hexToBytes)(publicKey);
35553
- const x = uncompressedBytes.slice(1, 33);
35554
- const y = uncompressedBytes.slice(33, 65);
35555
- const prefix = y[31] % 2 === 0 ? 2 : 3;
35556
- const compressed = new Uint8Array(33);
35557
- compressed[0] = prefix;
35558
- compressed.set(x, 1);
35559
- return bytesToBase64(compressed);
35714
+ const rs = sigBytes.slice(0, 64);
35715
+ let v = sigBytes[64];
35716
+ if (v === void 0 && rs[32] & 128) {
35717
+ rs[32] &= 127;
35718
+ v = 1;
35719
+ }
35720
+ const r = (0, import_viem5.bytesToHex)(rs.slice(0, 32));
35721
+ const s = (0, import_viem5.bytesToHex)(rs.slice(32));
35722
+ const parities = v === 1 || v === 28 ? [1, 0] : [0, 1];
35723
+ let recoveredAddress;
35724
+ for (const yParity of parities) {
35725
+ let publicKey;
35726
+ try {
35727
+ publicKey = await (0, import_viem5.recoverPublicKey)({ hash, signature: { r, s, yParity } });
35728
+ } catch {
35729
+ continue;
35730
+ }
35731
+ const address = (0, import_accounts2.publicKeyToAddress)(publicKey);
35732
+ recoveredAddress ?? (recoveredAddress = address);
35733
+ if (!addressEquals(address, signerEvmAddress)) continue;
35734
+ const uncompressed = (0, import_viem5.hexToBytes)(publicKey);
35735
+ const compressed = new Uint8Array(33);
35736
+ compressed[0] = uncompressed[64] % 2 === 0 ? 2 : 3;
35737
+ compressed.set(uncompressed.slice(1, 33), 1);
35738
+ return { pubkeyBase64: bytesToBase64(compressed), signature: rs };
35739
+ }
35740
+ throw new SignerMismatchError({ signerAddress: signerEvmAddress, recoveredAddress });
35741
+ }
35742
+ function pubkeyBelongsToSigner(pubkeyBase64, signerAddress) {
35743
+ try {
35744
+ const uncompressed = import_secp256k1.secp256k1.ProjectivePoint.fromHex(base64ToBytes(pubkeyBase64)).toRawBytes(
35745
+ false
35746
+ );
35747
+ return addressEquals((0, import_accounts2.publicKeyToAddress)((0, import_viem5.bytesToHex)(uncompressed)), signerAddress);
35748
+ } catch {
35749
+ return false;
35750
+ }
35560
35751
  }
35561
35752
  function createAccountCache() {
35562
35753
  return { accountNumber: null, pubkeyBase64: null, nextSequence: null };
@@ -35711,6 +35902,9 @@ async function signAndBroadcastEip712({
35711
35902
  throw new Error("signer is required to sign EIP-712 typed data.");
35712
35903
  }
35713
35904
  const resolvedSignerAddress = signerAddress ? isValidEvmAddress(signerAddress) ? evmToAult(signerAddress) : signerAddress : await resolveSignerAddress(resolvedSigner);
35905
+ if (cache?.pubkeyBase64 && !pubkeyBelongsToSigner(cache.pubkeyBase64, resolvedSignerAddress)) {
35906
+ cache.pubkeyBase64 = null;
35907
+ }
35714
35908
  const cacheIsWarm = cache?.accountNumber != null && cache.nextSequence != null;
35715
35909
  const accountInfo = cacheIsWarm ? null : await queryAccount(network, resolvedSignerAddress, fetchFn, fetchOptions);
35716
35910
  if (cache && accountInfo) {
@@ -35772,13 +35966,12 @@ async function signAndBroadcastEip712({
35772
35966
  };
35773
35967
  const typedData = buildEip712TypedData(context, msgs, network.evmChainId);
35774
35968
  const signature = normalizeSignature(await resolvedSigner.signTypedData(typedData));
35775
- let pubkey = cache?.pubkeyBase64 ?? accountInfo?.pubkeyBase64 ?? null;
35776
- if (!pubkey) {
35777
- pubkey = await recoverPubkeyFromTypedDataSignature(typedData, signature);
35778
- if (cache) cache.pubkeyBase64 = pubkey;
35779
- }
35780
- const sigBytes = (0, import_viem5.hexToBytes)(signature);
35781
- const sigWithoutRecovery = sigBytes.slice(0, 64);
35969
+ const { pubkeyBase64: pubkey, signature: sigWithoutRecovery } = await recoverSignerPubkey(
35970
+ typedData,
35971
+ signature,
35972
+ resolvedSignerAddress
35973
+ );
35974
+ if (cache) cache.pubkeyBase64 = pubkey;
35782
35975
  const encodedMessages = msgs.map((msg2) => {
35783
35976
  const encoder = MSG_ENCODERS[msg2.typeUrl];
35784
35977
  if (!encoder) {
@@ -37983,6 +38176,21 @@ function checkTradingTerms(performanceFeeBps, exitFeeBps, relationship, fundWind
37983
38176
  throw new Error("performanceFeeBps and exitFeeBps must total less than 10000 bps");
37984
38177
  }
37985
38178
  }
38179
+ var MAX_NAME_BYTES = 70;
38180
+ var MAX_DETAILS_BYTES = 280;
38181
+ function descriptionOf(description) {
38182
+ const name = description?.name ?? "";
38183
+ const details = description?.details ?? "";
38184
+ if (name === "") throw new Error("A vault needs a description.name");
38185
+ const bytes = (text) => new TextEncoder().encode(text).length;
38186
+ if (bytes(name) > MAX_NAME_BYTES) {
38187
+ throw new Error(`description.name exceeds ${MAX_NAME_BYTES} bytes`);
38188
+ }
38189
+ if (bytes(details) > MAX_DETAILS_BYTES) {
38190
+ throw new Error(`description.details exceeds ${MAX_DETAILS_BYTES} bytes`);
38191
+ }
38192
+ return { name, details };
38193
+ }
37986
38194
  function configOf(config) {
37987
38195
  return "lending" in config ? { lending: lendingConfigOf(config.lending) } : { trading: tradingConfigOf(config.trading) };
37988
38196
  }
@@ -38033,7 +38241,8 @@ function buildCreateVaultMsg(owner, params) {
38033
38241
  relationship,
38034
38242
  ...params.fundWindow !== void 0 && { fundWindow: fundWindowOf(params.fundWindow) },
38035
38243
  // The chain treats a coin with no denom and a zero amount as "no deposit".
38036
- initialDeposit: deposit ?? { denom: "", amount: "0" }
38244
+ initialDeposit: deposit ?? { denom: "", amount: "0" },
38245
+ description: descriptionOf(params.description)
38037
38246
  };
38038
38247
  if ("lending" in params.config) {
38039
38248
  if (kind !== "normal") {
@@ -38774,12 +38983,12 @@ function createStaticResolver(optsOrNetwork, legacyManifest) {
38774
38983
  }
38775
38984
 
38776
38985
  // src/agent/attach.ts
38777
- var import_secp256k12 = require("@noble/curves/secp256k1");
38986
+ var import_secp256k13 = require("@noble/curves/secp256k1");
38778
38987
  var import_viem7 = require("viem");
38779
38988
  var import_encoding9 = require("@cosmjs/encoding");
38780
38989
 
38781
38990
  // src/agent/sign-and-broadcast.ts
38782
- var import_secp256k1 = require("@noble/curves/secp256k1");
38991
+ var import_secp256k12 = require("@noble/curves/secp256k1");
38783
38992
  var import_viem6 = require("viem");
38784
38993
  var AGENT_DEFAULTS = {
38785
38994
  GAS_LIMIT: "186000",
@@ -38790,7 +38999,7 @@ var AGENT_DEFAULTS = {
38790
38999
  function computeAgentKeyMaterial(agentPrivateKey) {
38791
39000
  const normalized = agentPrivateKey.startsWith("0x") ? agentPrivateKey : `0x${agentPrivateKey}`;
38792
39001
  const privKeyBytes = (0, import_viem6.hexToBytes)(normalized);
38793
- const compressedPubkey = import_secp256k1.secp256k1.getPublicKey(privKeyBytes, true);
39002
+ const compressedPubkey = import_secp256k12.secp256k1.getPublicKey(privKeyBytes, true);
38794
39003
  return { privKeyBytes, compressedPubkey };
38795
39004
  }
38796
39005
  function computeTimeoutTimestamp(timeoutSeconds) {
@@ -38871,7 +39080,7 @@ async function signAndBroadcastAgentTx({
38871
39080
  accountNumber: BigInt(accountNumber)
38872
39081
  });
38873
39082
  const hash = (0, import_viem6.hexToBytes)((0, import_viem6.keccak256)(signDocBytes));
38874
- const sig = import_secp256k1.secp256k1.sign(hash, privKeyBytes);
39083
+ const sig = import_secp256k12.secp256k1.sign(hash, privKeyBytes);
38875
39084
  const signatureBytes = sig.toCompactRawBytes();
38876
39085
  const txRawBytes = encodeTxRaw({
38877
39086
  bodyBytes,
@@ -39365,7 +39574,7 @@ function deriveAgentAddress(privateKeyHex) {
39365
39574
  const privKeyBytes = (0, import_viem7.hexToBytes)(
39366
39575
  privateKeyHex.startsWith("0x") ? privateKeyHex : `0x${privateKeyHex}`
39367
39576
  );
39368
- const uncompressedPubkey = import_secp256k12.secp256k1.getPublicKey(privKeyBytes, false);
39577
+ const uncompressedPubkey = import_secp256k13.secp256k1.getPublicKey(privKeyBytes, false);
39369
39578
  const pubkeyHash = (0, import_viem7.hexToBytes)((0, import_viem7.keccak256)(uncompressedPubkey.slice(1)));
39370
39579
  const evmAddressBytes = pubkeyHash.slice(12);
39371
39580
  const evmHex = `0x${(0, import_encoding9.toHex)(evmAddressBytes)}`;
@@ -42953,6 +43162,7 @@ function createDexWs(url, options) {
42953
43162
  SearchUDFSymbolsQueryParams,
42954
43163
  SearchUDFSymbolsResponse,
42955
43164
  SearchUDFSymbolsResponseItem,
43165
+ SignerMismatchError,
42956
43166
  TIMING_CONSTANTS,
42957
43167
  TX_BASE_FIELDS,
42958
43168
  TimeoutError,