@pyxisjs/core 0.1.0 → 0.2.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,4 +1,5 @@
1
1
  import { InputEntryFunctionData, AptosSettings } from '@aptos-labs/ts-sdk';
2
+ import { Address } from 'viem';
2
3
 
3
4
  /**
4
5
  * Chain types for multi-chain support
@@ -8,11 +9,11 @@ declare enum NetworkType {
8
9
  TESTNET = "testnet"
9
10
  }
10
11
  declare enum ChainId {
11
- APTOS_MAINNET = "aptos-mainnet",
12
- APTOS_TESTNET = "aptos-testnet",
13
- ETHEREUM_MAINNET = "ethereum-mainnet",
14
- ETHEREUM_SEPOLIA = "ethereum-sepolia",
15
- ARBITRUM_ONE = "arbitrum-one"
12
+ APTOS_MAINNET = "aptos_mainnet",
13
+ APTOS_TESTNET = "aptos_testnet",
14
+ ETHEREUM_MAINNET = "ethereum_mainnet",
15
+ ETHEREUM_SEPOLIA = "ethereum_sepolia",
16
+ ARBITRUM_ONE = "arbitrum_one"
16
17
  }
17
18
  declare enum ChainType {
18
19
  EVM = "evm",
@@ -61,14 +62,21 @@ interface VaultContractAddressConfig {
61
62
  /**
62
63
  * Transaction payload types
63
64
  */
64
- interface EthereumJsonRpcRequest {
65
- method: 'eth_sendTransaction';
66
- params: Array<{
67
- to?: string;
68
- from?: string;
69
- data?: string;
70
- value?: string;
71
- }>;
65
+
66
+ interface EthereumContractCall {
67
+ address: string;
68
+ abi: any;
69
+ functionName: string;
70
+ args: any[];
71
+ value?: bigint;
72
+ }
73
+ interface EthereumTransactionMetadata {
74
+ approvalTokens?: EthereumTokenApprove[];
75
+ }
76
+ interface EthereumTokenApprove {
77
+ tokenAddress: Address;
78
+ spenderAddress: Address;
79
+ amount: bigint;
72
80
  }
73
81
  interface AptosTransactionPayload {
74
82
  function: `${string}::${string}::${string}`;
@@ -77,7 +85,8 @@ interface AptosTransactionPayload {
77
85
  }
78
86
  type TransactionPayload = {
79
87
  type: 'evm';
80
- data: EthereumJsonRpcRequest;
88
+ data: EthereumContractCall;
89
+ metadata?: EthereumTransactionMetadata;
81
90
  } | {
82
91
  type: 'aptos';
83
92
  data: AptosTransactionPayload;
@@ -408,6 +417,18 @@ interface ApyDataPoint {
408
417
  /** The timestamp in seconds */
409
418
  timestamp: string;
410
419
  }
420
+ interface MultiChainVaultAPI {
421
+ quoteDeposit(args: QuoteDepositArgs): Promise<string>;
422
+ quoteWithdraw(args: QuoteWithdrawArgs): Promise<string>;
423
+ getDepositRateInQuoteSafe(args: GetDepositRateInQuoteSafeArgs): Promise<string>;
424
+ getWithdrawRateInQuoteSafe(args: GetWithdrawRateInQuoteSafeArgs): Promise<string>;
425
+ buildDepositTx(args: BuildDepositTxArgs): Promise<TransactionPayload>;
426
+ buildWithdrawTx(args: BuildWithdrawTxArgs): Promise<TransactionPayload>;
427
+ buildReclaimWithdrawalRequestTx(args: BuildReclaimWithdrawalRequestTxArgs): Promise<TransactionPayload>;
428
+ buildCancelWithdrawalRequestTx(args: BuildCancelWithdrawalRequestTxArgs): Promise<TransactionPayload>;
429
+ getMinimumRequestAge(args: GetMinimumRequestAgeArgs): Promise<number>;
430
+ getUserWithdrawalRequests(args: GetWithdrawalRequestsOfUserArgs): Promise<PyxisWithdrawalRequest[]>;
431
+ }
411
432
 
412
433
  /**
413
434
  * Base error class for all Pyxis SDK errors
@@ -818,4 +839,4 @@ declare namespace index {
818
839
  export { index_FLAG_BITS as FLAG_BITS, type index_FlagBitKey as FlagBitKey, index_SamplingStrategy as SamplingStrategy, index_amountWithSlippage as amountWithSlippage, index_buildRequestFlags as buildRequestFlags, index_calculateApy as calculateApy, index_calculateMinimumReceiveAmount as calculateMinimumReceiveAmount, index_calculateWithdrawalAmount as calculateWithdrawalAmount, index_getActiveFlags as getActiveFlags, index_hasFlag as hasFlag, index_mapIndexerToExchangeRateEvent as mapIndexerToExchangeRateEvent, index_mapIndexerToVaultActivity as mapIndexerToVaultActivity, index_mapOnchainToWithdrawalRequest as mapOnchainToWithdrawalRequest, index_normalizeAddress as normalizeAddress, index_parseRequestFlags as parseRequestFlags, index_sampleEventsByDay as sampleEventsByDay };
819
840
  }
820
841
 
821
- export { type AnyTransaction, type AptosTransaction, type AptosTransactionPayload, type ApyDataPoint, type ApyWindow, type BaseAPI, type BaseAnalyticsClient, BaseChainAdapter, type BaseTransaction, type BuildCancelWithdrawalRequestTxArgs, type BuildDepositTxArgs, type BuildReclaimWithdrawalRequestTxArgs, type BuildWithdrawTxArgs, CHAIN_CONFIGS, type Chain, type ChainConfig, ChainId, ChainType, ConfigError, ContractError, type Currency, ErrorCodes, type EthereumJsonRpcRequest, type EthereumTransaction, type EventParams, type ExchangeRateEvent, type GetActivitiesArgs, type GetDepositRateInQuoteSafeArgs, type GetMinimumRequestAgeArgs, type GetWithdrawRateInQuoteSafeArgs, type GetWithdrawalRequestsOfUserArgs, type HistoricalApyArgs, type IndexerExchangeRateEvent, type IndexerVaultActivity, InsufficientFundsError, NetworkError, NetworkType, PyxisError, type PyxisOnchainWithdrawalRequest, type PyxisRequestFlagState, type PyxisToken, index as PyxisUtils, type PyxisWithdrawalRequest, type QueryIndexerParams, type QuoteDepositArgs, type QuoteWithdrawArgs, RateLimitError, type SDKConfig, type SignedTransaction, StrategyError, TransactionError, type TransactionPayload, type TransactionResult, type TxParams, ValidationError, type VaultActivity, type VaultContractAddressConfig, VaultError, type VaultTvlArgs, type ViewParams, type WalletAccount, type WalletAdapter, WalletError, createError, getChainConfig };
842
+ export { type AnyTransaction, type AptosTransaction, type AptosTransactionPayload, type ApyDataPoint, type ApyWindow, type BaseAPI, type BaseAnalyticsClient, BaseChainAdapter, type BaseTransaction, type BuildCancelWithdrawalRequestTxArgs, type BuildDepositTxArgs, type BuildReclaimWithdrawalRequestTxArgs, type BuildWithdrawTxArgs, CHAIN_CONFIGS, type Chain, type ChainConfig, ChainId, ChainType, ConfigError, ContractError, type Currency, ErrorCodes, type EthereumContractCall, type EthereumTokenApprove, type EthereumTransaction, type EthereumTransactionMetadata, type EventParams, type ExchangeRateEvent, type GetActivitiesArgs, type GetDepositRateInQuoteSafeArgs, type GetMinimumRequestAgeArgs, type GetWithdrawRateInQuoteSafeArgs, type GetWithdrawalRequestsOfUserArgs, type HistoricalApyArgs, type IndexerExchangeRateEvent, type IndexerVaultActivity, InsufficientFundsError, type MultiChainVaultAPI, NetworkError, NetworkType, PyxisError, type PyxisOnchainWithdrawalRequest, type PyxisRequestFlagState, type PyxisToken, index as PyxisUtils, type PyxisWithdrawalRequest, type QueryIndexerParams, type QuoteDepositArgs, type QuoteWithdrawArgs, RateLimitError, type SDKConfig, type SignedTransaction, StrategyError, TransactionError, type TransactionPayload, type TransactionResult, type TxParams, ValidationError, type VaultActivity, type VaultContractAddressConfig, VaultError, type VaultTvlArgs, type ViewParams, type WalletAccount, type WalletAdapter, WalletError, createError, getChainConfig };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { InputEntryFunctionData, AptosSettings } from '@aptos-labs/ts-sdk';
2
+ import { Address } from 'viem';
2
3
 
3
4
  /**
4
5
  * Chain types for multi-chain support
@@ -8,11 +9,11 @@ declare enum NetworkType {
8
9
  TESTNET = "testnet"
9
10
  }
10
11
  declare enum ChainId {
11
- APTOS_MAINNET = "aptos-mainnet",
12
- APTOS_TESTNET = "aptos-testnet",
13
- ETHEREUM_MAINNET = "ethereum-mainnet",
14
- ETHEREUM_SEPOLIA = "ethereum-sepolia",
15
- ARBITRUM_ONE = "arbitrum-one"
12
+ APTOS_MAINNET = "aptos_mainnet",
13
+ APTOS_TESTNET = "aptos_testnet",
14
+ ETHEREUM_MAINNET = "ethereum_mainnet",
15
+ ETHEREUM_SEPOLIA = "ethereum_sepolia",
16
+ ARBITRUM_ONE = "arbitrum_one"
16
17
  }
17
18
  declare enum ChainType {
18
19
  EVM = "evm",
@@ -61,14 +62,21 @@ interface VaultContractAddressConfig {
61
62
  /**
62
63
  * Transaction payload types
63
64
  */
64
- interface EthereumJsonRpcRequest {
65
- method: 'eth_sendTransaction';
66
- params: Array<{
67
- to?: string;
68
- from?: string;
69
- data?: string;
70
- value?: string;
71
- }>;
65
+
66
+ interface EthereumContractCall {
67
+ address: string;
68
+ abi: any;
69
+ functionName: string;
70
+ args: any[];
71
+ value?: bigint;
72
+ }
73
+ interface EthereumTransactionMetadata {
74
+ approvalTokens?: EthereumTokenApprove[];
75
+ }
76
+ interface EthereumTokenApprove {
77
+ tokenAddress: Address;
78
+ spenderAddress: Address;
79
+ amount: bigint;
72
80
  }
73
81
  interface AptosTransactionPayload {
74
82
  function: `${string}::${string}::${string}`;
@@ -77,7 +85,8 @@ interface AptosTransactionPayload {
77
85
  }
78
86
  type TransactionPayload = {
79
87
  type: 'evm';
80
- data: EthereumJsonRpcRequest;
88
+ data: EthereumContractCall;
89
+ metadata?: EthereumTransactionMetadata;
81
90
  } | {
82
91
  type: 'aptos';
83
92
  data: AptosTransactionPayload;
@@ -408,6 +417,18 @@ interface ApyDataPoint {
408
417
  /** The timestamp in seconds */
409
418
  timestamp: string;
410
419
  }
420
+ interface MultiChainVaultAPI {
421
+ quoteDeposit(args: QuoteDepositArgs): Promise<string>;
422
+ quoteWithdraw(args: QuoteWithdrawArgs): Promise<string>;
423
+ getDepositRateInQuoteSafe(args: GetDepositRateInQuoteSafeArgs): Promise<string>;
424
+ getWithdrawRateInQuoteSafe(args: GetWithdrawRateInQuoteSafeArgs): Promise<string>;
425
+ buildDepositTx(args: BuildDepositTxArgs): Promise<TransactionPayload>;
426
+ buildWithdrawTx(args: BuildWithdrawTxArgs): Promise<TransactionPayload>;
427
+ buildReclaimWithdrawalRequestTx(args: BuildReclaimWithdrawalRequestTxArgs): Promise<TransactionPayload>;
428
+ buildCancelWithdrawalRequestTx(args: BuildCancelWithdrawalRequestTxArgs): Promise<TransactionPayload>;
429
+ getMinimumRequestAge(args: GetMinimumRequestAgeArgs): Promise<number>;
430
+ getUserWithdrawalRequests(args: GetWithdrawalRequestsOfUserArgs): Promise<PyxisWithdrawalRequest[]>;
431
+ }
411
432
 
412
433
  /**
413
434
  * Base error class for all Pyxis SDK errors
@@ -818,4 +839,4 @@ declare namespace index {
818
839
  export { index_FLAG_BITS as FLAG_BITS, type index_FlagBitKey as FlagBitKey, index_SamplingStrategy as SamplingStrategy, index_amountWithSlippage as amountWithSlippage, index_buildRequestFlags as buildRequestFlags, index_calculateApy as calculateApy, index_calculateMinimumReceiveAmount as calculateMinimumReceiveAmount, index_calculateWithdrawalAmount as calculateWithdrawalAmount, index_getActiveFlags as getActiveFlags, index_hasFlag as hasFlag, index_mapIndexerToExchangeRateEvent as mapIndexerToExchangeRateEvent, index_mapIndexerToVaultActivity as mapIndexerToVaultActivity, index_mapOnchainToWithdrawalRequest as mapOnchainToWithdrawalRequest, index_normalizeAddress as normalizeAddress, index_parseRequestFlags as parseRequestFlags, index_sampleEventsByDay as sampleEventsByDay };
819
840
  }
820
841
 
821
- export { type AnyTransaction, type AptosTransaction, type AptosTransactionPayload, type ApyDataPoint, type ApyWindow, type BaseAPI, type BaseAnalyticsClient, BaseChainAdapter, type BaseTransaction, type BuildCancelWithdrawalRequestTxArgs, type BuildDepositTxArgs, type BuildReclaimWithdrawalRequestTxArgs, type BuildWithdrawTxArgs, CHAIN_CONFIGS, type Chain, type ChainConfig, ChainId, ChainType, ConfigError, ContractError, type Currency, ErrorCodes, type EthereumJsonRpcRequest, type EthereumTransaction, type EventParams, type ExchangeRateEvent, type GetActivitiesArgs, type GetDepositRateInQuoteSafeArgs, type GetMinimumRequestAgeArgs, type GetWithdrawRateInQuoteSafeArgs, type GetWithdrawalRequestsOfUserArgs, type HistoricalApyArgs, type IndexerExchangeRateEvent, type IndexerVaultActivity, InsufficientFundsError, NetworkError, NetworkType, PyxisError, type PyxisOnchainWithdrawalRequest, type PyxisRequestFlagState, type PyxisToken, index as PyxisUtils, type PyxisWithdrawalRequest, type QueryIndexerParams, type QuoteDepositArgs, type QuoteWithdrawArgs, RateLimitError, type SDKConfig, type SignedTransaction, StrategyError, TransactionError, type TransactionPayload, type TransactionResult, type TxParams, ValidationError, type VaultActivity, type VaultContractAddressConfig, VaultError, type VaultTvlArgs, type ViewParams, type WalletAccount, type WalletAdapter, WalletError, createError, getChainConfig };
842
+ export { type AnyTransaction, type AptosTransaction, type AptosTransactionPayload, type ApyDataPoint, type ApyWindow, type BaseAPI, type BaseAnalyticsClient, BaseChainAdapter, type BaseTransaction, type BuildCancelWithdrawalRequestTxArgs, type BuildDepositTxArgs, type BuildReclaimWithdrawalRequestTxArgs, type BuildWithdrawTxArgs, CHAIN_CONFIGS, type Chain, type ChainConfig, ChainId, ChainType, ConfigError, ContractError, type Currency, ErrorCodes, type EthereumContractCall, type EthereumTokenApprove, type EthereumTransaction, type EthereumTransactionMetadata, type EventParams, type ExchangeRateEvent, type GetActivitiesArgs, type GetDepositRateInQuoteSafeArgs, type GetMinimumRequestAgeArgs, type GetWithdrawRateInQuoteSafeArgs, type GetWithdrawalRequestsOfUserArgs, type HistoricalApyArgs, type IndexerExchangeRateEvent, type IndexerVaultActivity, InsufficientFundsError, type MultiChainVaultAPI, NetworkError, NetworkType, PyxisError, type PyxisOnchainWithdrawalRequest, type PyxisRequestFlagState, type PyxisToken, index as PyxisUtils, type PyxisWithdrawalRequest, type QueryIndexerParams, type QuoteDepositArgs, type QuoteWithdrawArgs, RateLimitError, type SDKConfig, type SignedTransaction, StrategyError, TransactionError, type TransactionPayload, type TransactionResult, type TxParams, ValidationError, type VaultActivity, type VaultContractAddressConfig, VaultError, type VaultTvlArgs, type ViewParams, type WalletAccount, type WalletAdapter, WalletError, createError, getChainConfig };
package/dist/index.js CHANGED
@@ -422,11 +422,11 @@ var NetworkType = /* @__PURE__ */ ((NetworkType2) => {
422
422
  return NetworkType2;
423
423
  })(NetworkType || {});
424
424
  var ChainId = /* @__PURE__ */ ((ChainId2) => {
425
- ChainId2["APTOS_MAINNET"] = "aptos-mainnet";
426
- ChainId2["APTOS_TESTNET"] = "aptos-testnet";
427
- ChainId2["ETHEREUM_MAINNET"] = "ethereum-mainnet";
428
- ChainId2["ETHEREUM_SEPOLIA"] = "ethereum-sepolia";
429
- ChainId2["ARBITRUM_ONE"] = "arbitrum-one";
425
+ ChainId2["APTOS_MAINNET"] = "aptos_mainnet";
426
+ ChainId2["APTOS_TESTNET"] = "aptos_testnet";
427
+ ChainId2["ETHEREUM_MAINNET"] = "ethereum_mainnet";
428
+ ChainId2["ETHEREUM_SEPOLIA"] = "ethereum_sepolia";
429
+ ChainId2["ARBITRUM_ONE"] = "arbitrum_one";
430
430
  return ChainId2;
431
431
  })(ChainId || {});
432
432
  var ChainType = /* @__PURE__ */ ((ChainType3) => {
@@ -435,7 +435,7 @@ var ChainType = /* @__PURE__ */ ((ChainType3) => {
435
435
  return ChainType3;
436
436
  })(ChainType || {});
437
437
  var CHAIN_CONFIGS = {
438
- ["aptos-mainnet" /* APTOS_MAINNET */]: {
438
+ ["aptos_mainnet" /* APTOS_MAINNET */]: {
439
439
  type: "move_vm" /* MoveVM */,
440
440
  networkType: "mainnet" /* MAINNET */,
441
441
  name: "Aptos Mainnet",
@@ -443,7 +443,7 @@ var CHAIN_CONFIGS = {
443
443
  blockExplorerUrls: ["https://explorer.aptoslabs.com"],
444
444
  isTestnet: false
445
445
  },
446
- ["aptos-testnet" /* APTOS_TESTNET */]: {
446
+ ["aptos_testnet" /* APTOS_TESTNET */]: {
447
447
  type: "move_vm" /* MoveVM */,
448
448
  networkType: "testnet" /* TESTNET */,
449
449
  name: "Aptos Testnet",
@@ -451,7 +451,7 @@ var CHAIN_CONFIGS = {
451
451
  blockExplorerUrls: ["https://explorer.aptoslabs.com/?network=testnet"],
452
452
  isTestnet: true
453
453
  },
454
- ["ethereum-mainnet" /* ETHEREUM_MAINNET */]: {
454
+ ["ethereum_mainnet" /* ETHEREUM_MAINNET */]: {
455
455
  type: "evm" /* EVM */,
456
456
  networkType: "mainnet" /* MAINNET */,
457
457
  name: "Ethereum Mainnet",
@@ -460,7 +460,7 @@ var CHAIN_CONFIGS = {
460
460
  blockExplorerUrls: ["https://etherscan.io"],
461
461
  isTestnet: false
462
462
  },
463
- ["ethereum-sepolia" /* ETHEREUM_SEPOLIA */]: {
463
+ ["ethereum_sepolia" /* ETHEREUM_SEPOLIA */]: {
464
464
  type: "evm" /* EVM */,
465
465
  networkType: "testnet" /* TESTNET */,
466
466
  name: "Ethereum Sepolia",
@@ -469,7 +469,7 @@ var CHAIN_CONFIGS = {
469
469
  blockExplorerUrls: ["https://sepolia.etherscan.io"],
470
470
  isTestnet: true
471
471
  },
472
- ["arbitrum-one" /* ARBITRUM_ONE */]: {
472
+ ["arbitrum_one" /* ARBITRUM_ONE */]: {
473
473
  type: "evm" /* EVM */,
474
474
  networkType: "mainnet" /* MAINNET */,
475
475
  name: "Arbitrum One",