@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.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Aptos, UserTransactionResponse } from '@aptos-labs/ts-sdk';
2
- import { BaseChainAdapter, MultiChainVaultAPI, Chain, TxParams, TransactionPayload, ViewParams, EventParams, TransactionResult, QueryIndexerParams, GetWithdrawRateInQuoteSafeArgs, GetDepositRateInQuoteSafeArgs, QuoteDepositArgs, QuoteWithdrawArgs, QuoteBridgeArgs, BridgeQuoteResponse, BuildBridgeTxArgs, BuildDepositTxArgs, BuildWithdrawTxArgs, BuildReclaimWithdrawalRequestTxArgs, BuildCancelWithdrawalRequestTxArgs, GetMinimumRequestAgeArgs, GetWithdrawalRequestsOfUserArgs, PyxisWithdrawalRequest, IndexerVaultActivity, VaultActivity, BaseAnalyticsClient, GetActivitiesArgs, VaultTvlArgs, HistoricalApyArgs, ExchangeRateEvent, ApyDataPoint, ChainType } from '@pyxisjs/core';
2
+ import { BaseChainAdapter, MultiChainVaultAPI, Chain, TxParams, TransactionPayload, ViewParams, EventParams, TransactionResult, QueryIndexerParams, GetWithdrawRateInQuoteSafeArgs, GetDepositRateInQuoteSafeArgs, QuoteDepositArgs, QuoteWithdrawArgs, QuoteBridgeArgs, BridgeQuoteResponse, BuildBridgeTxArgs, BuildDepositTxArgs, BuildWithdrawTxArgs, BuildReclaimWithdrawalRequestTxArgs, BuildCancelWithdrawalRequestTxArgs, GetMinimumRequestAgeArgs, GetWithdrawalRequestsOfUserArgs, PyxisWithdrawalRequest, IndexerVaultActivity, VaultActivity, BaseAnalyticsClient, GetActivitiesArgs, VaultTvlArgs, HistoricalApyArgs, ExchangeRateEvent, ApyDataPoint, GetManageOperationsArgs, ManageOperation, ChainType } from '@pyxisjs/core';
3
3
  export { EventParams, TxParams, ViewParams } from '@pyxisjs/core';
4
4
  import { Abi, PublicClient } from 'viem';
5
5
  export { Abi as EvmABI } from 'viem';
@@ -134,6 +134,7 @@ declare function mapIndexerToVaultActivity(indexerActivity: IndexerVaultActivity
134
134
  declare class AptosAnalyticsClient implements BaseAnalyticsClient {
135
135
  private chainAdapter;
136
136
  private analyticsAdapter;
137
+ private statsClient;
137
138
  constructor(chainAdapter: BaseChainAdapter<Aptos>, analyticsAdapter: BaseChainAdapter<Aptos>);
138
139
  /**
139
140
  * Get function signature using contract address from adapter
@@ -147,6 +148,7 @@ declare class AptosAnalyticsClient implements BaseAnalyticsClient {
147
148
  getUpdateExchangeRateEvents({ vault, startTime, endTime, }: HistoricalApyArgs): Promise<ExchangeRateEvent[]>;
148
149
  get30DayApy(vault: string): Promise<string>;
149
150
  getHistoricalApy({ vault, startTime, endTime, window, }: HistoricalApyArgs): Promise<ApyDataPoint[]>;
151
+ getManageOperations(args: GetManageOperationsArgs): Promise<ManageOperation[]>;
150
152
  }
151
153
 
152
154
  declare const AccountantABI: Abi;
@@ -246,4 +248,10 @@ declare function getFunctionSignature(type: ChainType, contractName: string, fun
246
248
  */
247
249
  declare function getContractABI(type: ChainType, contractName: string): AptosABI | Abi;
248
250
 
249
- export { AccountantABI, AccountantAptosABI, type AptosABI, AptosAnalyticsClient, AptosChainAdapter, type AptosFunction, type AptosGenericTypeParam, type AptosStruct, AtomicQueueABI, AtomicQueueAptosABI, BoringVaultABI, CONTRACTS, type ContractConfig, type ContractsConfig, EthereumChainAdapter, MultiChainLayerZeroTellerAptosABI, TellerAptosABI, TellerWithMultiAssetSupportABI, VaultAptosABI, getContractABI, getFunctionSignature, mapIndexerToVaultActivity };
251
+ declare class PyxisStatsClient {
252
+ private readonly baseUrl;
253
+ constructor(baseUrl?: string);
254
+ getManageOperations({ vaultId, startTime, endTime, limit, }: GetManageOperationsArgs): Promise<ManageOperation[]>;
255
+ }
256
+
257
+ export { AccountantABI, AccountantAptosABI, type AptosABI, AptosAnalyticsClient, AptosChainAdapter, type AptosFunction, type AptosGenericTypeParam, type AptosStruct, AtomicQueueABI, AtomicQueueAptosABI, BoringVaultABI, CONTRACTS, type ContractConfig, type ContractsConfig, EthereumChainAdapter, MultiChainLayerZeroTellerAptosABI, PyxisStatsClient, TellerAptosABI, TellerWithMultiAssetSupportABI, VaultAptosABI, getContractABI, getFunctionSignature, mapIndexerToVaultActivity };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Aptos, UserTransactionResponse } from '@aptos-labs/ts-sdk';
2
- import { BaseChainAdapter, MultiChainVaultAPI, Chain, TxParams, TransactionPayload, ViewParams, EventParams, TransactionResult, QueryIndexerParams, GetWithdrawRateInQuoteSafeArgs, GetDepositRateInQuoteSafeArgs, QuoteDepositArgs, QuoteWithdrawArgs, QuoteBridgeArgs, BridgeQuoteResponse, BuildBridgeTxArgs, BuildDepositTxArgs, BuildWithdrawTxArgs, BuildReclaimWithdrawalRequestTxArgs, BuildCancelWithdrawalRequestTxArgs, GetMinimumRequestAgeArgs, GetWithdrawalRequestsOfUserArgs, PyxisWithdrawalRequest, IndexerVaultActivity, VaultActivity, BaseAnalyticsClient, GetActivitiesArgs, VaultTvlArgs, HistoricalApyArgs, ExchangeRateEvent, ApyDataPoint, ChainType } from '@pyxisjs/core';
2
+ import { BaseChainAdapter, MultiChainVaultAPI, Chain, TxParams, TransactionPayload, ViewParams, EventParams, TransactionResult, QueryIndexerParams, GetWithdrawRateInQuoteSafeArgs, GetDepositRateInQuoteSafeArgs, QuoteDepositArgs, QuoteWithdrawArgs, QuoteBridgeArgs, BridgeQuoteResponse, BuildBridgeTxArgs, BuildDepositTxArgs, BuildWithdrawTxArgs, BuildReclaimWithdrawalRequestTxArgs, BuildCancelWithdrawalRequestTxArgs, GetMinimumRequestAgeArgs, GetWithdrawalRequestsOfUserArgs, PyxisWithdrawalRequest, IndexerVaultActivity, VaultActivity, BaseAnalyticsClient, GetActivitiesArgs, VaultTvlArgs, HistoricalApyArgs, ExchangeRateEvent, ApyDataPoint, GetManageOperationsArgs, ManageOperation, ChainType } from '@pyxisjs/core';
3
3
  export { EventParams, TxParams, ViewParams } from '@pyxisjs/core';
4
4
  import { Abi, PublicClient } from 'viem';
5
5
  export { Abi as EvmABI } from 'viem';
@@ -134,6 +134,7 @@ declare function mapIndexerToVaultActivity(indexerActivity: IndexerVaultActivity
134
134
  declare class AptosAnalyticsClient implements BaseAnalyticsClient {
135
135
  private chainAdapter;
136
136
  private analyticsAdapter;
137
+ private statsClient;
137
138
  constructor(chainAdapter: BaseChainAdapter<Aptos>, analyticsAdapter: BaseChainAdapter<Aptos>);
138
139
  /**
139
140
  * Get function signature using contract address from adapter
@@ -147,6 +148,7 @@ declare class AptosAnalyticsClient implements BaseAnalyticsClient {
147
148
  getUpdateExchangeRateEvents({ vault, startTime, endTime, }: HistoricalApyArgs): Promise<ExchangeRateEvent[]>;
148
149
  get30DayApy(vault: string): Promise<string>;
149
150
  getHistoricalApy({ vault, startTime, endTime, window, }: HistoricalApyArgs): Promise<ApyDataPoint[]>;
151
+ getManageOperations(args: GetManageOperationsArgs): Promise<ManageOperation[]>;
150
152
  }
151
153
 
152
154
  declare const AccountantABI: Abi;
@@ -246,4 +248,10 @@ declare function getFunctionSignature(type: ChainType, contractName: string, fun
246
248
  */
247
249
  declare function getContractABI(type: ChainType, contractName: string): AptosABI | Abi;
248
250
 
249
- export { AccountantABI, AccountantAptosABI, type AptosABI, AptosAnalyticsClient, AptosChainAdapter, type AptosFunction, type AptosGenericTypeParam, type AptosStruct, AtomicQueueABI, AtomicQueueAptosABI, BoringVaultABI, CONTRACTS, type ContractConfig, type ContractsConfig, EthereumChainAdapter, MultiChainLayerZeroTellerAptosABI, TellerAptosABI, TellerWithMultiAssetSupportABI, VaultAptosABI, getContractABI, getFunctionSignature, mapIndexerToVaultActivity };
251
+ declare class PyxisStatsClient {
252
+ private readonly baseUrl;
253
+ constructor(baseUrl?: string);
254
+ getManageOperations({ vaultId, startTime, endTime, limit, }: GetManageOperationsArgs): Promise<ManageOperation[]>;
255
+ }
256
+
257
+ export { AccountantABI, AccountantAptosABI, type AptosABI, AptosAnalyticsClient, AptosChainAdapter, type AptosFunction, type AptosGenericTypeParam, type AptosStruct, AtomicQueueABI, AtomicQueueAptosABI, BoringVaultABI, CONTRACTS, type ContractConfig, type ContractsConfig, EthereumChainAdapter, MultiChainLayerZeroTellerAptosABI, PyxisStatsClient, TellerAptosABI, TellerWithMultiAssetSupportABI, VaultAptosABI, getContractABI, getFunctionSignature, mapIndexerToVaultActivity };
package/dist/index.js CHANGED
@@ -402,6 +402,7 @@ __export(index_exports, {
402
402
  CONTRACTS: () => CONTRACTS,
403
403
  EthereumChainAdapter: () => EthereumChainAdapter,
404
404
  MultiChainLayerZeroTellerAptosABI: () => MultiChainLayerZeroTellerAptosABI,
405
+ PyxisStatsClient: () => PyxisStatsClient,
405
406
  TellerAptosABI: () => TellerAptosABI,
406
407
  TellerWithMultiAssetSupportABI: () => TellerWithMultiAssetSupportABI,
407
408
  VaultAptosABI: () => VaultAptosABI,
@@ -8699,7 +8700,7 @@ var AptosChainAdapter = class extends import_core2.BaseChainAdapter {
8699
8700
  "atomicQueue",
8700
8701
  "get_minimum_request_age"
8701
8702
  );
8702
- const result = await this.viewContract({
8703
+ const [result] = await this.viewContract({
8703
8704
  address: this.getContractAddress("atomicQueue"),
8704
8705
  function: functionSignature,
8705
8706
  arguments: [args.vault],
@@ -8718,7 +8719,7 @@ var AptosChainAdapter = class extends import_core2.BaseChainAdapter {
8718
8719
  "atomicQueue",
8719
8720
  "get_user_atomic_requests"
8720
8721
  );
8721
- const withdrawalRequests = await this.viewContract({
8722
+ const [withdrawalRequests] = await this.viewContract({
8722
8723
  address: this.getContractAddress("atomicQueue"),
8723
8724
  function: getUserRequestsFn,
8724
8725
  arguments: [vault, userAddress, requestFlag, matchAll],
@@ -8729,8 +8730,8 @@ var AptosChainAdapter = class extends import_core2.BaseChainAdapter {
8729
8730
  "get_request_updated_at"
8730
8731
  );
8731
8732
  const updatedAtResults = await Promise.allSettled(
8732
- withdrawalRequests.map(
8733
- (request) => this.viewContract({
8733
+ withdrawalRequests.map(async (request) => {
8734
+ const [updatedAtResult] = await this.viewContract({
8734
8735
  address: this.getContractAddress("atomicQueue"),
8735
8736
  function: getUpdatedAtFn,
8736
8737
  arguments: [
@@ -8740,8 +8741,9 @@ var AptosChainAdapter = class extends import_core2.BaseChainAdapter {
8740
8741
  request.want_token.inner
8741
8742
  ],
8742
8743
  abi: this.getContractABI("atomicQueue")
8743
- })
8744
- )
8744
+ });
8745
+ return updatedAtResult;
8746
+ })
8745
8747
  );
8746
8748
  return withdrawalRequests.map(
8747
8749
  (request, index) => {
@@ -8883,6 +8885,39 @@ function getFunctionSignature2(contractName, functionName, contractAddress) {
8883
8885
  return signature.replace("{address}", contractAddress);
8884
8886
  }
8885
8887
 
8888
+ // src/common/stats-client.ts
8889
+ var PyxisStatsClient = class {
8890
+ constructor(baseUrl = "https://stats.pyxisfinance.xyz/v1") {
8891
+ this.baseUrl = baseUrl;
8892
+ }
8893
+ async getManageOperations({
8894
+ vaultId,
8895
+ startTime,
8896
+ endTime,
8897
+ limit = 100
8898
+ }) {
8899
+ const params = new URLSearchParams({
8900
+ start_time: startTime.toString(),
8901
+ end_time: endTime.toString(),
8902
+ limit: limit.toString()
8903
+ });
8904
+ const url = `${this.baseUrl}/vaults/${vaultId}/manage-operations?${params}`;
8905
+ const response = await fetch(url);
8906
+ if (!response.ok) {
8907
+ throw new Error(
8908
+ `Failed to fetch manage operations: ${response.status} ${response.statusText}`
8909
+ );
8910
+ }
8911
+ const data = await response.json();
8912
+ if (data.code !== 0) {
8913
+ throw new Error(
8914
+ `Manage operations API error: ${data.message} (code: ${data.code})`
8915
+ );
8916
+ }
8917
+ return data.data.items;
8918
+ }
8919
+ };
8920
+
8886
8921
  // src/aptos/analytics-client.ts
8887
8922
  import_dayjs.default.extend(import_utc.default);
8888
8923
  var MIN_APY_DATA_POINTS = 2;
@@ -8893,6 +8928,7 @@ var AptosAnalyticsClient = class {
8893
8928
  constructor(chainAdapter, analyticsAdapter) {
8894
8929
  this.chainAdapter = chainAdapter;
8895
8930
  this.analyticsAdapter = analyticsAdapter;
8931
+ this.statsClient = new PyxisStatsClient();
8896
8932
  const config = (0, import_core3.getChainConfig)(chainAdapter.chain.id);
8897
8933
  invariant(
8898
8934
  config.type === import_core3.ChainType.MoveVM,
@@ -9039,6 +9075,9 @@ var AptosAnalyticsClient = class {
9039
9075
  }).filter((item) => item !== null);
9040
9076
  return historicalApyData;
9041
9077
  }
9078
+ async getManageOperations(args) {
9079
+ return this.statsClient.getManageOperations(args);
9080
+ }
9042
9081
  };
9043
9082
 
9044
9083
  // src/evm/adapter.ts
@@ -9521,6 +9560,7 @@ var EthereumChainAdapter = class extends import_core4.BaseChainAdapter {
9521
9560
  CONTRACTS,
9522
9561
  EthereumChainAdapter,
9523
9562
  MultiChainLayerZeroTellerAptosABI,
9563
+ PyxisStatsClient,
9524
9564
  TellerAptosABI,
9525
9565
  TellerWithMultiAssetSupportABI,
9526
9566
  VaultAptosABI,