@pyxisjs/chains 0.2.7 → 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 +10 -2
- package/dist/index.d.ts +10 -2
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +38 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
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
|
-
|
|
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
|
-
|
|
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,
|
|
@@ -8884,6 +8885,39 @@ function getFunctionSignature2(contractName, functionName, contractAddress) {
|
|
|
8884
8885
|
return signature.replace("{address}", contractAddress);
|
|
8885
8886
|
}
|
|
8886
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
|
+
|
|
8887
8921
|
// src/aptos/analytics-client.ts
|
|
8888
8922
|
import_dayjs.default.extend(import_utc.default);
|
|
8889
8923
|
var MIN_APY_DATA_POINTS = 2;
|
|
@@ -8894,6 +8928,7 @@ var AptosAnalyticsClient = class {
|
|
|
8894
8928
|
constructor(chainAdapter, analyticsAdapter) {
|
|
8895
8929
|
this.chainAdapter = chainAdapter;
|
|
8896
8930
|
this.analyticsAdapter = analyticsAdapter;
|
|
8931
|
+
this.statsClient = new PyxisStatsClient();
|
|
8897
8932
|
const config = (0, import_core3.getChainConfig)(chainAdapter.chain.id);
|
|
8898
8933
|
invariant(
|
|
8899
8934
|
config.type === import_core3.ChainType.MoveVM,
|
|
@@ -9040,6 +9075,9 @@ var AptosAnalyticsClient = class {
|
|
|
9040
9075
|
}).filter((item) => item !== null);
|
|
9041
9076
|
return historicalApyData;
|
|
9042
9077
|
}
|
|
9078
|
+
async getManageOperations(args) {
|
|
9079
|
+
return this.statsClient.getManageOperations(args);
|
|
9080
|
+
}
|
|
9043
9081
|
};
|
|
9044
9082
|
|
|
9045
9083
|
// src/evm/adapter.ts
|
|
@@ -9522,6 +9560,7 @@ var EthereumChainAdapter = class extends import_core4.BaseChainAdapter {
|
|
|
9522
9560
|
CONTRACTS,
|
|
9523
9561
|
EthereumChainAdapter,
|
|
9524
9562
|
MultiChainLayerZeroTellerAptosABI,
|
|
9563
|
+
PyxisStatsClient,
|
|
9525
9564
|
TellerAptosABI,
|
|
9526
9565
|
TellerWithMultiAssetSupportABI,
|
|
9527
9566
|
VaultAptosABI,
|