@pyxisjs/core 0.2.3 → 0.2.4
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 +61 -1
- package/dist/index.d.ts +61 -1
- package/dist/index.js +85 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +78 -20
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -49,6 +49,18 @@ interface ChainConfig {
|
|
|
49
49
|
isTestnet: boolean;
|
|
50
50
|
}
|
|
51
51
|
declare const CHAIN_CONFIGS: Record<ChainId, ChainConfig>;
|
|
52
|
+
/** LayerZero V2 Endpoint IDs for supported chains */
|
|
53
|
+
declare const LAYERZERO_ENDPOINT_IDS: Record<ChainId, number>;
|
|
54
|
+
/** Helper to get LayerZero endpoint ID from chain ID */
|
|
55
|
+
declare function getLayerZeroEndpointId(chainId: ChainId): number;
|
|
56
|
+
/** Estimated bridge time in minutes for supported chain pairs */
|
|
57
|
+
declare const ESTIMATED_BRIDGE_TIME: Record<string, number>;
|
|
58
|
+
/** Helper to get estimated bridge time between two chains */
|
|
59
|
+
declare function getEstimatedBridgeTime(srcChainId: ChainId, dstChainId: ChainId): string;
|
|
60
|
+
declare function getLayerZeroGasLimit(srcChainId: ChainId, dstChainId: ChainId): bigint;
|
|
61
|
+
declare const BridgeMethod: {
|
|
62
|
+
readonly LayerZero: "LayerZero";
|
|
63
|
+
};
|
|
52
64
|
declare function getChainConfig(chainId: ChainId): ChainConfig;
|
|
53
65
|
interface VaultContractAddressConfig {
|
|
54
66
|
/** Address of the accountant contract responsible for managing vault accounting */
|
|
@@ -57,6 +69,8 @@ interface VaultContractAddressConfig {
|
|
|
57
69
|
teller: string;
|
|
58
70
|
/** Address of the atomic queue contract for managing transaction ordering */
|
|
59
71
|
atomicQueue: string;
|
|
72
|
+
/** Optional address of the LayerZero teller for cross-chain bridging */
|
|
73
|
+
multiChainLzTeller?: string;
|
|
60
74
|
}
|
|
61
75
|
|
|
62
76
|
/**
|
|
@@ -72,6 +86,7 @@ interface EthereumContractCall {
|
|
|
72
86
|
}
|
|
73
87
|
interface EthereumTransactionMetadata {
|
|
74
88
|
approvalTokens?: EthereumTokenApprove[];
|
|
89
|
+
value?: bigint;
|
|
75
90
|
}
|
|
76
91
|
interface EthereumTokenApprove {
|
|
77
92
|
tokenAddress: Address;
|
|
@@ -302,6 +317,42 @@ interface QuoteWithdrawArgs {
|
|
|
302
317
|
amount: string;
|
|
303
318
|
wantAsset: string;
|
|
304
319
|
}
|
|
320
|
+
interface QuoteBridgeArgs {
|
|
321
|
+
/** The vault address (optional - validated by implementation) */
|
|
322
|
+
vault?: string;
|
|
323
|
+
/** Share amount to bridge (in local decimals) */
|
|
324
|
+
amount: string;
|
|
325
|
+
/** Destination chain identifier */
|
|
326
|
+
destinationChain: ChainId;
|
|
327
|
+
/** Recipient address on destination chain */
|
|
328
|
+
recipient: string;
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Bridge quote response containing fee and fee token information
|
|
332
|
+
*/
|
|
333
|
+
interface BridgeQuoteResponse {
|
|
334
|
+
/** Fee amount in smallest unit (wei/octas) */
|
|
335
|
+
fee: string;
|
|
336
|
+
/** Token address used for fee payment */
|
|
337
|
+
feeTokenAddress: string;
|
|
338
|
+
/** Bridging method (e.g., 'LayerZero') */
|
|
339
|
+
method: string;
|
|
340
|
+
/** Estimated time for bridge completion */
|
|
341
|
+
estimatedTime: string;
|
|
342
|
+
/** LayerZero v2 extra options as bytes array (executor lz receive options) */
|
|
343
|
+
extraOptions: Uint8Array;
|
|
344
|
+
/** ZRO fee amount (0 if not using ZRO token) */
|
|
345
|
+
zroFee: string;
|
|
346
|
+
}
|
|
347
|
+
interface BuildBridgeTxArgs {
|
|
348
|
+
vault: string;
|
|
349
|
+
amount: string;
|
|
350
|
+
destinationChain: ChainId;
|
|
351
|
+
recipient: string;
|
|
352
|
+
fee: string;
|
|
353
|
+
extraOptions: Uint8Array;
|
|
354
|
+
zroFee: string;
|
|
355
|
+
}
|
|
305
356
|
interface GetDepositRateInQuoteSafeArgs {
|
|
306
357
|
vault: string;
|
|
307
358
|
quoteAsset: string;
|
|
@@ -436,6 +487,8 @@ interface ApyDataPoint {
|
|
|
436
487
|
interface MultiChainVaultAPI {
|
|
437
488
|
quoteDeposit(args: QuoteDepositArgs): Promise<string>;
|
|
438
489
|
quoteWithdraw(args: QuoteWithdrawArgs): Promise<string>;
|
|
490
|
+
quoteBridge(args: QuoteBridgeArgs): Promise<BridgeQuoteResponse>;
|
|
491
|
+
buildBridgeTx(args: BuildBridgeTxArgs): Promise<TransactionPayload>;
|
|
439
492
|
getDepositRateInQuoteSafe(args: GetDepositRateInQuoteSafeArgs): Promise<string>;
|
|
440
493
|
getWithdrawRateInQuoteSafe(args: GetWithdrawRateInQuoteSafeArgs): Promise<string>;
|
|
441
494
|
buildDepositTx(args: BuildDepositTxArgs): Promise<TransactionPayload>;
|
|
@@ -444,6 +497,7 @@ interface MultiChainVaultAPI {
|
|
|
444
497
|
buildCancelWithdrawalRequestTx(args: BuildCancelWithdrawalRequestTxArgs): Promise<TransactionPayload>;
|
|
445
498
|
getMinimumRequestAge(args: GetMinimumRequestAgeArgs): Promise<number>;
|
|
446
499
|
getUserWithdrawalRequests(args: GetWithdrawalRequestsOfUserArgs): Promise<PyxisWithdrawalRequest[]>;
|
|
500
|
+
getMultichainLzTellerAddress(): string;
|
|
447
501
|
}
|
|
448
502
|
|
|
449
503
|
/**
|
|
@@ -607,8 +661,14 @@ declare abstract class BaseChainAdapter<TClient> {
|
|
|
607
661
|
getContractAddresses(): VaultContractAddressConfig;
|
|
608
662
|
/**
|
|
609
663
|
* Get a specific contract address
|
|
664
|
+
* @throws Error if the contract address is not configured
|
|
610
665
|
*/
|
|
611
666
|
getContractAddress(contract: keyof VaultContractAddressConfig): string;
|
|
667
|
+
/**
|
|
668
|
+
* Get the multi-chain LayerZero teller address for cross-chain bridging
|
|
669
|
+
* @throws Error if multiChainLzTeller is not configured
|
|
670
|
+
*/
|
|
671
|
+
getMultichainLzTellerAddress(): string;
|
|
612
672
|
/**
|
|
613
673
|
* Build a transaction payload
|
|
614
674
|
*/
|
|
@@ -855,4 +915,4 @@ declare namespace index {
|
|
|
855
915
|
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 };
|
|
856
916
|
}
|
|
857
917
|
|
|
858
|
-
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 };
|
|
918
|
+
export { type AnyTransaction, type AptosTransaction, type AptosTransactionPayload, type ApyDataPoint, type ApyWindow, type BaseAPI, type BaseAnalyticsClient, BaseChainAdapter, type BaseTransaction, BridgeMethod, type BridgeQuoteResponse, type BuildBridgeTxArgs, type BuildCancelWithdrawalRequestTxArgs, type BuildDepositTxArgs, type BuildReclaimWithdrawalRequestTxArgs, type BuildWithdrawTxArgs, CHAIN_CONFIGS, type Chain, type ChainConfig, ChainId, ChainType, ConfigError, ContractError, type Currency, ESTIMATED_BRIDGE_TIME, 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, LAYERZERO_ENDPOINT_IDS, type MultiChainVaultAPI, NetworkError, NetworkType, PyxisError, type PyxisOnchainWithdrawalRequest, type PyxisRequestFlagState, type PyxisToken, index as PyxisUtils, type PyxisWithdrawalRequest, type QueryIndexerParams, type QuoteBridgeArgs, 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, getEstimatedBridgeTime, getLayerZeroEndpointId, getLayerZeroGasLimit };
|
package/dist/index.d.ts
CHANGED
|
@@ -49,6 +49,18 @@ interface ChainConfig {
|
|
|
49
49
|
isTestnet: boolean;
|
|
50
50
|
}
|
|
51
51
|
declare const CHAIN_CONFIGS: Record<ChainId, ChainConfig>;
|
|
52
|
+
/** LayerZero V2 Endpoint IDs for supported chains */
|
|
53
|
+
declare const LAYERZERO_ENDPOINT_IDS: Record<ChainId, number>;
|
|
54
|
+
/** Helper to get LayerZero endpoint ID from chain ID */
|
|
55
|
+
declare function getLayerZeroEndpointId(chainId: ChainId): number;
|
|
56
|
+
/** Estimated bridge time in minutes for supported chain pairs */
|
|
57
|
+
declare const ESTIMATED_BRIDGE_TIME: Record<string, number>;
|
|
58
|
+
/** Helper to get estimated bridge time between two chains */
|
|
59
|
+
declare function getEstimatedBridgeTime(srcChainId: ChainId, dstChainId: ChainId): string;
|
|
60
|
+
declare function getLayerZeroGasLimit(srcChainId: ChainId, dstChainId: ChainId): bigint;
|
|
61
|
+
declare const BridgeMethod: {
|
|
62
|
+
readonly LayerZero: "LayerZero";
|
|
63
|
+
};
|
|
52
64
|
declare function getChainConfig(chainId: ChainId): ChainConfig;
|
|
53
65
|
interface VaultContractAddressConfig {
|
|
54
66
|
/** Address of the accountant contract responsible for managing vault accounting */
|
|
@@ -57,6 +69,8 @@ interface VaultContractAddressConfig {
|
|
|
57
69
|
teller: string;
|
|
58
70
|
/** Address of the atomic queue contract for managing transaction ordering */
|
|
59
71
|
atomicQueue: string;
|
|
72
|
+
/** Optional address of the LayerZero teller for cross-chain bridging */
|
|
73
|
+
multiChainLzTeller?: string;
|
|
60
74
|
}
|
|
61
75
|
|
|
62
76
|
/**
|
|
@@ -72,6 +86,7 @@ interface EthereumContractCall {
|
|
|
72
86
|
}
|
|
73
87
|
interface EthereumTransactionMetadata {
|
|
74
88
|
approvalTokens?: EthereumTokenApprove[];
|
|
89
|
+
value?: bigint;
|
|
75
90
|
}
|
|
76
91
|
interface EthereumTokenApprove {
|
|
77
92
|
tokenAddress: Address;
|
|
@@ -302,6 +317,42 @@ interface QuoteWithdrawArgs {
|
|
|
302
317
|
amount: string;
|
|
303
318
|
wantAsset: string;
|
|
304
319
|
}
|
|
320
|
+
interface QuoteBridgeArgs {
|
|
321
|
+
/** The vault address (optional - validated by implementation) */
|
|
322
|
+
vault?: string;
|
|
323
|
+
/** Share amount to bridge (in local decimals) */
|
|
324
|
+
amount: string;
|
|
325
|
+
/** Destination chain identifier */
|
|
326
|
+
destinationChain: ChainId;
|
|
327
|
+
/** Recipient address on destination chain */
|
|
328
|
+
recipient: string;
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Bridge quote response containing fee and fee token information
|
|
332
|
+
*/
|
|
333
|
+
interface BridgeQuoteResponse {
|
|
334
|
+
/** Fee amount in smallest unit (wei/octas) */
|
|
335
|
+
fee: string;
|
|
336
|
+
/** Token address used for fee payment */
|
|
337
|
+
feeTokenAddress: string;
|
|
338
|
+
/** Bridging method (e.g., 'LayerZero') */
|
|
339
|
+
method: string;
|
|
340
|
+
/** Estimated time for bridge completion */
|
|
341
|
+
estimatedTime: string;
|
|
342
|
+
/** LayerZero v2 extra options as bytes array (executor lz receive options) */
|
|
343
|
+
extraOptions: Uint8Array;
|
|
344
|
+
/** ZRO fee amount (0 if not using ZRO token) */
|
|
345
|
+
zroFee: string;
|
|
346
|
+
}
|
|
347
|
+
interface BuildBridgeTxArgs {
|
|
348
|
+
vault: string;
|
|
349
|
+
amount: string;
|
|
350
|
+
destinationChain: ChainId;
|
|
351
|
+
recipient: string;
|
|
352
|
+
fee: string;
|
|
353
|
+
extraOptions: Uint8Array;
|
|
354
|
+
zroFee: string;
|
|
355
|
+
}
|
|
305
356
|
interface GetDepositRateInQuoteSafeArgs {
|
|
306
357
|
vault: string;
|
|
307
358
|
quoteAsset: string;
|
|
@@ -436,6 +487,8 @@ interface ApyDataPoint {
|
|
|
436
487
|
interface MultiChainVaultAPI {
|
|
437
488
|
quoteDeposit(args: QuoteDepositArgs): Promise<string>;
|
|
438
489
|
quoteWithdraw(args: QuoteWithdrawArgs): Promise<string>;
|
|
490
|
+
quoteBridge(args: QuoteBridgeArgs): Promise<BridgeQuoteResponse>;
|
|
491
|
+
buildBridgeTx(args: BuildBridgeTxArgs): Promise<TransactionPayload>;
|
|
439
492
|
getDepositRateInQuoteSafe(args: GetDepositRateInQuoteSafeArgs): Promise<string>;
|
|
440
493
|
getWithdrawRateInQuoteSafe(args: GetWithdrawRateInQuoteSafeArgs): Promise<string>;
|
|
441
494
|
buildDepositTx(args: BuildDepositTxArgs): Promise<TransactionPayload>;
|
|
@@ -444,6 +497,7 @@ interface MultiChainVaultAPI {
|
|
|
444
497
|
buildCancelWithdrawalRequestTx(args: BuildCancelWithdrawalRequestTxArgs): Promise<TransactionPayload>;
|
|
445
498
|
getMinimumRequestAge(args: GetMinimumRequestAgeArgs): Promise<number>;
|
|
446
499
|
getUserWithdrawalRequests(args: GetWithdrawalRequestsOfUserArgs): Promise<PyxisWithdrawalRequest[]>;
|
|
500
|
+
getMultichainLzTellerAddress(): string;
|
|
447
501
|
}
|
|
448
502
|
|
|
449
503
|
/**
|
|
@@ -607,8 +661,14 @@ declare abstract class BaseChainAdapter<TClient> {
|
|
|
607
661
|
getContractAddresses(): VaultContractAddressConfig;
|
|
608
662
|
/**
|
|
609
663
|
* Get a specific contract address
|
|
664
|
+
* @throws Error if the contract address is not configured
|
|
610
665
|
*/
|
|
611
666
|
getContractAddress(contract: keyof VaultContractAddressConfig): string;
|
|
667
|
+
/**
|
|
668
|
+
* Get the multi-chain LayerZero teller address for cross-chain bridging
|
|
669
|
+
* @throws Error if multiChainLzTeller is not configured
|
|
670
|
+
*/
|
|
671
|
+
getMultichainLzTellerAddress(): string;
|
|
612
672
|
/**
|
|
613
673
|
* Build a transaction payload
|
|
614
674
|
*/
|
|
@@ -855,4 +915,4 @@ declare namespace index {
|
|
|
855
915
|
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 };
|
|
856
916
|
}
|
|
857
917
|
|
|
858
|
-
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 };
|
|
918
|
+
export { type AnyTransaction, type AptosTransaction, type AptosTransactionPayload, type ApyDataPoint, type ApyWindow, type BaseAPI, type BaseAnalyticsClient, BaseChainAdapter, type BaseTransaction, BridgeMethod, type BridgeQuoteResponse, type BuildBridgeTxArgs, type BuildCancelWithdrawalRequestTxArgs, type BuildDepositTxArgs, type BuildReclaimWithdrawalRequestTxArgs, type BuildWithdrawTxArgs, CHAIN_CONFIGS, type Chain, type ChainConfig, ChainId, ChainType, ConfigError, ContractError, type Currency, ESTIMATED_BRIDGE_TIME, 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, LAYERZERO_ENDPOINT_IDS, type MultiChainVaultAPI, NetworkError, NetworkType, PyxisError, type PyxisOnchainWithdrawalRequest, type PyxisRequestFlagState, type PyxisToken, index as PyxisUtils, type PyxisWithdrawalRequest, type QueryIndexerParams, type QuoteBridgeArgs, 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, getEstimatedBridgeTime, getLayerZeroEndpointId, getLayerZeroGasLimit };
|
package/dist/index.js
CHANGED
|
@@ -393,13 +393,16 @@ var require_utc = __commonJS({
|
|
|
393
393
|
var index_exports = {};
|
|
394
394
|
__export(index_exports, {
|
|
395
395
|
BaseChainAdapter: () => BaseChainAdapter,
|
|
396
|
+
BridgeMethod: () => BridgeMethod,
|
|
396
397
|
CHAIN_CONFIGS: () => CHAIN_CONFIGS,
|
|
397
398
|
ChainId: () => ChainId,
|
|
398
399
|
ChainType: () => ChainType,
|
|
399
400
|
ConfigError: () => ConfigError,
|
|
400
401
|
ContractError: () => ContractError,
|
|
402
|
+
ESTIMATED_BRIDGE_TIME: () => ESTIMATED_BRIDGE_TIME,
|
|
401
403
|
ErrorCodes: () => ErrorCodes,
|
|
402
404
|
InsufficientFundsError: () => InsufficientFundsError,
|
|
405
|
+
LAYERZERO_ENDPOINT_IDS: () => LAYERZERO_ENDPOINT_IDS,
|
|
403
406
|
NetworkError: () => NetworkError,
|
|
404
407
|
NetworkType: () => NetworkType,
|
|
405
408
|
PyxisError: () => PyxisError,
|
|
@@ -411,10 +414,28 @@ __export(index_exports, {
|
|
|
411
414
|
VaultError: () => VaultError,
|
|
412
415
|
WalletError: () => WalletError,
|
|
413
416
|
createError: () => createError,
|
|
414
|
-
getChainConfig: () => getChainConfig
|
|
417
|
+
getChainConfig: () => getChainConfig,
|
|
418
|
+
getEstimatedBridgeTime: () => getEstimatedBridgeTime,
|
|
419
|
+
getLayerZeroEndpointId: () => getLayerZeroEndpointId,
|
|
420
|
+
getLayerZeroGasLimit: () => getLayerZeroGasLimit
|
|
415
421
|
});
|
|
416
422
|
module.exports = __toCommonJS(index_exports);
|
|
417
423
|
|
|
424
|
+
// ../../node_modules/.pnpm/tiny-invariant@1.3.3/node_modules/tiny-invariant/dist/esm/tiny-invariant.js
|
|
425
|
+
var isProduction = process.env.NODE_ENV === "production";
|
|
426
|
+
var prefix = "Invariant failed";
|
|
427
|
+
function invariant(condition, message) {
|
|
428
|
+
if (condition) {
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
if (isProduction) {
|
|
432
|
+
throw new Error(prefix);
|
|
433
|
+
}
|
|
434
|
+
var provided = typeof message === "function" ? message() : message;
|
|
435
|
+
var value = provided ? "".concat(prefix, ": ").concat(provided) : prefix;
|
|
436
|
+
throw new Error(value);
|
|
437
|
+
}
|
|
438
|
+
|
|
418
439
|
// src/types/chain.ts
|
|
419
440
|
var NetworkType = /* @__PURE__ */ ((NetworkType2) => {
|
|
420
441
|
NetworkType2["MAINNET"] = "mainnet";
|
|
@@ -479,11 +500,43 @@ var CHAIN_CONFIGS = {
|
|
|
479
500
|
isTestnet: false
|
|
480
501
|
}
|
|
481
502
|
};
|
|
503
|
+
var LAYERZERO_ENDPOINT_IDS = {
|
|
504
|
+
["aptos_mainnet" /* APTOS_MAINNET */]: 30108,
|
|
505
|
+
["aptos_testnet" /* APTOS_TESTNET */]: 30103,
|
|
506
|
+
["ethereum_mainnet" /* ETHEREUM_MAINNET */]: 30101,
|
|
507
|
+
["ethereum_sepolia" /* ETHEREUM_SEPOLIA */]: 30111,
|
|
508
|
+
["arbitrum_one" /* ARBITRUM_ONE */]: 30110
|
|
509
|
+
};
|
|
510
|
+
function getLayerZeroEndpointId(chainId) {
|
|
511
|
+
const eid = LAYERZERO_ENDPOINT_IDS[chainId];
|
|
512
|
+
invariant(eid, `LayerZero endpoint ID not found for chain: ${chainId}`);
|
|
513
|
+
return eid;
|
|
514
|
+
}
|
|
515
|
+
var ESTIMATED_BRIDGE_TIME = {
|
|
516
|
+
[`${"aptos_mainnet" /* APTOS_MAINNET */}-${"arbitrum_one" /* ARBITRUM_ONE */}`]: 30,
|
|
517
|
+
[`${"arbitrum_one" /* ARBITRUM_ONE */}-${"aptos_mainnet" /* APTOS_MAINNET */}`]: 30,
|
|
518
|
+
[`${"aptos_mainnet" /* APTOS_MAINNET */}-${"ethereum_mainnet" /* ETHEREUM_MAINNET */}`]: 60,
|
|
519
|
+
[`${"ethereum_mainnet" /* ETHEREUM_MAINNET */}-${"aptos_mainnet" /* APTOS_MAINNET */}`]: 60
|
|
520
|
+
};
|
|
521
|
+
function getEstimatedBridgeTime(srcChainId, dstChainId) {
|
|
522
|
+
const time = ESTIMATED_BRIDGE_TIME[`${srcChainId}-${dstChainId}`];
|
|
523
|
+
return time ? time.toString() : "-";
|
|
524
|
+
}
|
|
525
|
+
var LAYERZERO_MESSAGE_GAS_LIMITS = {
|
|
526
|
+
[`${"aptos_mainnet" /* APTOS_MAINNET */}-${"arbitrum_one" /* ARBITRUM_ONE */}`]: 50000n,
|
|
527
|
+
[`${"aptos_mainnet" /* APTOS_MAINNET */}-${"ethereum_mainnet" /* ETHEREUM_MAINNET */}`]: 80000n,
|
|
528
|
+
[`${"arbitrum_one" /* ARBITRUM_ONE */}-${"aptos_mainnet" /* APTOS_MAINNET */}`]: 100000n,
|
|
529
|
+
[`${"ethereum_mainnet" /* ETHEREUM_MAINNET */}-${"aptos_mainnet" /* APTOS_MAINNET */}`]: 100000n
|
|
530
|
+
};
|
|
531
|
+
function getLayerZeroGasLimit(srcChainId, dstChainId) {
|
|
532
|
+
return LAYERZERO_MESSAGE_GAS_LIMITS[`${srcChainId}-${dstChainId}`] || 0n;
|
|
533
|
+
}
|
|
534
|
+
var BridgeMethod = {
|
|
535
|
+
LayerZero: "LayerZero"
|
|
536
|
+
};
|
|
482
537
|
function getChainConfig(chainId) {
|
|
483
538
|
const config2 = CHAIN_CONFIGS[chainId];
|
|
484
|
-
|
|
485
|
-
throw new Error(`Chain config not found for chainId: ${chainId}`);
|
|
486
|
-
}
|
|
539
|
+
invariant(config2, `Chain config not found for chainId: ${chainId}`);
|
|
487
540
|
return config2;
|
|
488
541
|
}
|
|
489
542
|
|
|
@@ -664,9 +717,29 @@ var BaseChainAdapter = class {
|
|
|
664
717
|
}
|
|
665
718
|
/**
|
|
666
719
|
* Get a specific contract address
|
|
720
|
+
* @throws Error if the contract address is not configured
|
|
667
721
|
*/
|
|
668
722
|
getContractAddress(contract) {
|
|
669
|
-
|
|
723
|
+
const addresses = this.getContractAddresses();
|
|
724
|
+
const address = addresses[contract];
|
|
725
|
+
invariant(
|
|
726
|
+
address,
|
|
727
|
+
`Contract address for '${contract}' is not configured for chain ${this.chain.id}`
|
|
728
|
+
);
|
|
729
|
+
return address;
|
|
730
|
+
}
|
|
731
|
+
/**
|
|
732
|
+
* Get the multi-chain LayerZero teller address for cross-chain bridging
|
|
733
|
+
* @throws Error if multiChainLzTeller is not configured
|
|
734
|
+
*/
|
|
735
|
+
getMultichainLzTellerAddress() {
|
|
736
|
+
const addresses = this.getContractAddresses();
|
|
737
|
+
const address = addresses.multiChainLzTeller;
|
|
738
|
+
invariant(
|
|
739
|
+
address,
|
|
740
|
+
`Multi-chain LayerZero teller address is not configured for chain ${this.chain.id}`
|
|
741
|
+
);
|
|
742
|
+
return address;
|
|
670
743
|
}
|
|
671
744
|
/**
|
|
672
745
|
* Get the chain type
|
|
@@ -697,21 +770,6 @@ __export(utils_exports, {
|
|
|
697
770
|
sampleEventsByDay: () => sampleEventsByDay
|
|
698
771
|
});
|
|
699
772
|
|
|
700
|
-
// ../../node_modules/.pnpm/tiny-invariant@1.3.3/node_modules/tiny-invariant/dist/esm/tiny-invariant.js
|
|
701
|
-
var isProduction = process.env.NODE_ENV === "production";
|
|
702
|
-
var prefix = "Invariant failed";
|
|
703
|
-
function invariant(condition, message) {
|
|
704
|
-
if (condition) {
|
|
705
|
-
return;
|
|
706
|
-
}
|
|
707
|
-
if (isProduction) {
|
|
708
|
-
throw new Error(prefix);
|
|
709
|
-
}
|
|
710
|
-
var provided = typeof message === "function" ? message() : message;
|
|
711
|
-
var value = provided ? "".concat(prefix, ": ").concat(provided) : prefix;
|
|
712
|
-
throw new Error(value);
|
|
713
|
-
}
|
|
714
|
-
|
|
715
773
|
// src/utils/number.ts
|
|
716
774
|
var BIP_BASE = 10000n;
|
|
717
775
|
var amountWithSlippage = (rawAmount, slippageBips) => {
|
|
@@ -3099,13 +3157,16 @@ var sampleEventsByDay = (events, strategy = "start" /* START */) => {
|
|
|
3099
3157
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3100
3158
|
0 && (module.exports = {
|
|
3101
3159
|
BaseChainAdapter,
|
|
3160
|
+
BridgeMethod,
|
|
3102
3161
|
CHAIN_CONFIGS,
|
|
3103
3162
|
ChainId,
|
|
3104
3163
|
ChainType,
|
|
3105
3164
|
ConfigError,
|
|
3106
3165
|
ContractError,
|
|
3166
|
+
ESTIMATED_BRIDGE_TIME,
|
|
3107
3167
|
ErrorCodes,
|
|
3108
3168
|
InsufficientFundsError,
|
|
3169
|
+
LAYERZERO_ENDPOINT_IDS,
|
|
3109
3170
|
NetworkError,
|
|
3110
3171
|
NetworkType,
|
|
3111
3172
|
PyxisError,
|
|
@@ -3117,7 +3178,10 @@ var sampleEventsByDay = (events, strategy = "start" /* START */) => {
|
|
|
3117
3178
|
VaultError,
|
|
3118
3179
|
WalletError,
|
|
3119
3180
|
createError,
|
|
3120
|
-
getChainConfig
|
|
3181
|
+
getChainConfig,
|
|
3182
|
+
getEstimatedBridgeTime,
|
|
3183
|
+
getLayerZeroEndpointId,
|
|
3184
|
+
getLayerZeroGasLimit
|
|
3121
3185
|
});
|
|
3122
3186
|
/*! Bundled license information:
|
|
3123
3187
|
|