@pyxisjs/chains 0.2.6 → 0.3.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.mjs CHANGED
@@ -8685,7 +8685,7 @@ var AptosChainAdapter = class extends BaseChainAdapter {
8685
8685
  "atomicQueue",
8686
8686
  "get_minimum_request_age"
8687
8687
  );
8688
- const result = await this.viewContract({
8688
+ const [result] = await this.viewContract({
8689
8689
  address: this.getContractAddress("atomicQueue"),
8690
8690
  function: functionSignature,
8691
8691
  arguments: [args.vault],
@@ -8704,7 +8704,7 @@ var AptosChainAdapter = class extends BaseChainAdapter {
8704
8704
  "atomicQueue",
8705
8705
  "get_user_atomic_requests"
8706
8706
  );
8707
- const withdrawalRequests = await this.viewContract({
8707
+ const [withdrawalRequests] = await this.viewContract({
8708
8708
  address: this.getContractAddress("atomicQueue"),
8709
8709
  function: getUserRequestsFn,
8710
8710
  arguments: [vault, userAddress, requestFlag, matchAll],
@@ -8715,8 +8715,8 @@ var AptosChainAdapter = class extends BaseChainAdapter {
8715
8715
  "get_request_updated_at"
8716
8716
  );
8717
8717
  const updatedAtResults = await Promise.allSettled(
8718
- withdrawalRequests.map(
8719
- (request) => this.viewContract({
8718
+ withdrawalRequests.map(async (request) => {
8719
+ const [updatedAtResult] = await this.viewContract({
8720
8720
  address: this.getContractAddress("atomicQueue"),
8721
8721
  function: getUpdatedAtFn,
8722
8722
  arguments: [
@@ -8726,8 +8726,9 @@ var AptosChainAdapter = class extends BaseChainAdapter {
8726
8726
  request.want_token.inner
8727
8727
  ],
8728
8728
  abi: this.getContractABI("atomicQueue")
8729
- })
8730
- )
8729
+ });
8730
+ return updatedAtResult;
8731
+ })
8731
8732
  );
8732
8733
  return withdrawalRequests.map(
8733
8734
  (request, index) => {
@@ -8873,6 +8874,39 @@ function getFunctionSignature2(contractName, functionName, contractAddress) {
8873
8874
  return signature.replace("{address}", contractAddress);
8874
8875
  }
8875
8876
 
8877
+ // src/common/stats-client.ts
8878
+ var PyxisStatsClient = class {
8879
+ constructor(baseUrl = "https://stats.pyxisfinance.xyz/v1") {
8880
+ this.baseUrl = baseUrl;
8881
+ }
8882
+ async getManageOperations({
8883
+ vaultId,
8884
+ startTime,
8885
+ endTime,
8886
+ limit = 100
8887
+ }) {
8888
+ const params = new URLSearchParams({
8889
+ start_time: startTime.toString(),
8890
+ end_time: endTime.toString(),
8891
+ limit: limit.toString()
8892
+ });
8893
+ const url = `${this.baseUrl}/vaults/${vaultId}/manage-operations?${params}`;
8894
+ const response = await fetch(url);
8895
+ if (!response.ok) {
8896
+ throw new Error(
8897
+ `Failed to fetch manage operations: ${response.status} ${response.statusText}`
8898
+ );
8899
+ }
8900
+ const data = await response.json();
8901
+ if (data.code !== 0) {
8902
+ throw new Error(
8903
+ `Manage operations API error: ${data.message} (code: ${data.code})`
8904
+ );
8905
+ }
8906
+ return data.data.items;
8907
+ }
8908
+ };
8909
+
8876
8910
  // src/aptos/analytics-client.ts
8877
8911
  import_dayjs.default.extend(import_utc.default);
8878
8912
  var MIN_APY_DATA_POINTS = 2;
@@ -8883,6 +8917,7 @@ var AptosAnalyticsClient = class {
8883
8917
  constructor(chainAdapter, analyticsAdapter) {
8884
8918
  this.chainAdapter = chainAdapter;
8885
8919
  this.analyticsAdapter = analyticsAdapter;
8920
+ this.statsClient = new PyxisStatsClient();
8886
8921
  const config = getChainConfig2(chainAdapter.chain.id);
8887
8922
  invariant(
8888
8923
  config.type === ChainType2.MoveVM,
@@ -9029,6 +9064,9 @@ var AptosAnalyticsClient = class {
9029
9064
  }).filter((item) => item !== null);
9030
9065
  return historicalApyData;
9031
9066
  }
9067
+ async getManageOperations(args) {
9068
+ return this.statsClient.getManageOperations(args);
9069
+ }
9032
9070
  };
9033
9071
 
9034
9072
  // src/evm/adapter.ts
@@ -9525,6 +9563,7 @@ export {
9525
9563
  CONTRACTS,
9526
9564
  EthereumChainAdapter,
9527
9565
  MultiChainLayerZeroTellerAptosABI,
9566
+ PyxisStatsClient,
9528
9567
  TellerAptosABI,
9529
9568
  TellerWithMultiAssetSupportABI,
9530
9569
  VaultAptosABI,