@wireio/stake 1.0.1 → 2.0.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/lib/stake.browser.js +13027 -6773
- package/lib/stake.browser.js.map +1 -1
- package/lib/stake.d.ts +7627 -646
- package/lib/stake.js +13406 -7147
- package/lib/stake.js.map +1 -1
- package/lib/stake.m.js +13027 -6773
- package/lib/stake.m.js.map +1 -1
- package/package.json +4 -3
- package/src/assets/solana/mainnet/idl/liqsol_core.json +6166 -0
- package/src/assets/solana/mainnet/idl/liqsol_token.json +183 -0
- package/src/assets/solana/mainnet/idl/transfer_hook.json +197 -0
- package/src/assets/solana/mainnet/idl/validator_leaderboard.json +574 -0
- package/src/assets/solana/mainnet/types/liqsol_core.ts +6172 -0
- package/src/assets/solana/mainnet/types/liqsol_token.ts +189 -0
- package/src/assets/solana/mainnet/types/transfer_hook.ts +203 -0
- package/src/assets/solana/mainnet/types/validator_leaderboard.ts +580 -0
- package/src/networks/ethereum/clients/convert.client.ts +30 -1
- package/src/networks/ethereum/clients/opp.client.ts +20 -21
- package/src/networks/ethereum/clients/receipt.client.ts +89 -4
- package/src/networks/ethereum/clients/stake.client.ts +1 -0
- package/src/networks/ethereum/contract.ts +260 -222
- package/src/networks/ethereum/ethereum.ts +121 -104
- package/src/networks/ethereum/types.ts +17 -2
- package/src/networks/solana/clients/deposit.client.ts +294 -65
- package/src/networks/solana/clients/distribution.client.ts +13 -18
- package/src/networks/solana/clients/leaderboard.client.ts +9 -11
- package/src/networks/solana/clients/outpost.client.ts +11 -10
- package/src/networks/solana/clients/token.client.ts +11 -13
- package/src/networks/solana/constants.ts +44 -285
- package/src/networks/solana/program.ts +365 -26
- package/src/networks/solana/solana.ts +213 -69
- package/src/networks/solana/types.ts +4 -4
- package/src/networks/solana/utils.ts +16 -301
- package/src/staker.ts +11 -2
- package/src/types.ts +19 -6
- /package/src/assets/ethereum/{ABI → mainnet}/common/Base58.sol/Base58.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/Base58.sol/Base58.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/OpenZepArtifacts.sol/__Dummy_OZ_UUPS__.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/OpenZepArtifacts.sol/__Dummy_OZ_UUPS__.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/RestrictedCallers.sol/RestrictedCallers.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/RestrictedCallers.sol/RestrictedCallers.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/iodata.sol/iodata.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/iodata.sol/iodata.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/iodata_util.sol/iodata_util.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/iodata_util.sol/iodata_util.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_data.sol/sysio_data.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_data.sol/sysio_data.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_errors.sol/sysio_errors.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_errors.sol/sysio_errors.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_merkle.sol/sysio_merkle.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_merkle.sol/sysio_merkle.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_name.sol/sysio_name.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_name.sol/sysio_name.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_pubkey.sol/sysio_pubkey.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_pubkey.sol/sysio_pubkey.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_read.sol/sysio_read.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_read.sol/sysio_read.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_tester.sol/SysioTester.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_tester.sol/SysioTester.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_verify.sol/sysio_verify.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_verify.sol/sysio_verify.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_write.sol/sysio_write.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_write.sol/sysio_write.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/BeaconState.sol/BeaconState.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/BeaconState.sol/BeaconState.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/DepositManager.sol/DepositManager.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/DepositManager.sol/DepositManager.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthAuthority.sol/LiqEthAuthority.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthAuthority.sol/LiqEthAuthority.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/IAccounting.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/IAccounting.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/IDepositContract.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/IDepositContract.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/IDepositManager.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/IDepositManager.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/ILiqEthUpgradeable.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/ILiqEthUpgradeable.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/IRewardsERC20.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/IRewardsERC20.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/IRewardsERC20Pausable.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/IRewardsERC20Pausable.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/IStakingModule.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/IStakingModule.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/IValidatorBalanceVerifier.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/IValidatorBalanceVerifier.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/IWithdrawalRecord.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/IWithdrawalRecord.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/LiqEthCommon.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/LiqEthCommon.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthManaged.sol/LiqEthManaged.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthManaged.sol/LiqEthManaged.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/RewardsERC20.sol/RewardsERC20Upgradeable.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/RewardsERC20.sol/RewardsERC20Upgradeable.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/RewardsERC20Pausable.sol/RewardsERC20PausableUpgradeable.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/RewardsERC20Pausable.sol/RewardsERC20PausableUpgradeable.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/Yield.sol/YieldOracle.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/Yield.sol/YieldOracle.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/accounting.sol/Accounting.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/accounting.sol/Accounting.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/liqEth.sol/LiqEthToken.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/liqEth.sol/LiqEthToken.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/stakingModule.sol/StakingModule.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/stakingModule.sol/StakingModule.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/withdrawalQueue.sol/WithdrawalQueue.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/withdrawalQueue.sol/WithdrawalQueue.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/withdrawalVault.sol/Uint64BE.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/withdrawalVault.sol/Uint64BE.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/withdrawalVault.sol/WithdrawalVault.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/withdrawalVault.sol/WithdrawalVault.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/Aggregator.sol/Aggregator.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/BAR.sol/BAR.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/BAR.sol/BAR.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/Depositor.sol/Depositor.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/Depositor.sol/Depositor.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/EthUsdPriceConsumer.sol/AggregatorV3Interface.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/EthUsdPriceConsumer.sol/AggregatorV3Interface.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/EthUsdPriceConsumer.sol/EthUsdPriceConsumer.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/EthUsdPriceConsumer.sol/EthUsdPriceConsumer.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPP.sol/OPP.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPP.sol/OPP.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPCommon.sol/IOPP.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPCommon.sol/IOPP.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPCommon.sol/IOPPEndpoint.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPCommon.sol/IOPPEndpoint.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPCommon.sol/IOPPInbound.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPCommon.sol/IOPPInbound.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPCommon.sol/IOPPReceiver.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPCommon.sol/IOPPReceiver.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPCommon.sol/IOPPSender.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPCommon.sol/IOPPSender.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPCommon.sol/OPPCommon.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPCommon.sol/OPPCommon.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPEndpoint.sol/OPPEndpoint.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPEndpoint.sol/OPPEndpoint.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPEndpointManaged.sol/OPPEndpointManaged.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPEndpointManaged.sol/OPPEndpointManaged.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPEndpointOwnable.sol/OPPEndpointOwnable.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPEndpointOwnable.sol/OPPEndpointOwnable.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPErrors.sol/OPPErrors.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPErrors.sol/OPPErrors.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPInbound.sol/OPPInbound.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPInbound.sol/OPPInbound.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPReceiver.sol/OPPReceiver.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPReceiver.sol/OPPReceiver.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPSender.sol/OPPSender.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPSender.sol/OPPSender.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OutpostErrors.sol/OutpostErrors.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OutpostErrors.sol/OutpostErrors.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OutpostManaged.sol/OutpostManaged.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OutpostManaged.sol/OutpostManaged.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OutpostManager.sol/OutpostManager.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OutpostManager.sol/OutpostManager.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OutpostManagerAuthority.sol/OutpostManagerAuthority.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OutpostManagerAuthority.sol/OutpostManagerAuthority.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OutpostManagerCommon.sol/IOutpostManager.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OutpostManagerCommon.sol/IOutpostManager.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OutpostManagerCommon.sol/IOutpostUpgradeable.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OutpostManagerCommon.sol/IOutpostUpgradeable.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OutpostManagerCommon.sol/OutpostManagerCommon.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OutpostManagerCommon.sol/OutpostManagerCommon.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OutpostOwnable.sol/OutpostOwnable.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OutpostOwnable.sol/OutpostOwnable.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/Pool.sol/Pool.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/Pool.sol/Pool.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/Pretoken.sol/Pretoken.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/Pretoken.sol/Pretoken.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/ReceiptNFT.sol/ReceiptNFT.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/ReceiptNFT.sol/ReceiptNFT.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/interfaces/IPretoken.sol/IPretoken.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/interfaces/IPretoken.sol/IPretoken.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/interfaces/IWarrant.sol/IWarrant.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/interfaces/IWarrant.sol/IWarrant.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/token/ERC721EthEquivalentVotesUpgradeable.sol/ERC721EthEquivalentVotesUpgradeable.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/token/ERC721EthEquivalentVotesUpgradeable.sol/ERC721EthEquivalentVotesUpgradeable.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/token/IERC721EthEquivalent.sol/IERC721EthEquivalent.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/token/IERC721EthEquivalent.sol/IERC721EthEquivalent.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/token/ERC1155Token.sol/ERC1155Token.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/token/ERC1155Token.sol/ERC1155Token.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/token/ERC20Token.sol/ERC20Token.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/token/ERC20Token.sol/ERC20Token.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/token/ERC721Token.sol/ERC721Token.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/token/ERC721Token.sol/ERC721Token.json +0 -0
- /package/src/assets/solana/{idl → devnet/idl}/liqsol_core.json +0 -0
- /package/src/assets/solana/{idl → devnet/idl}/liqsol_token.json +0 -0
- /package/src/assets/solana/{idl → devnet/idl}/transfer_hook.json +0 -0
- /package/src/assets/solana/{idl → devnet/idl}/validator_leaderboard.json +0 -0
- /package/src/assets/solana/{types → devnet/types}/liqsol_core.ts +0 -0
- /package/src/assets/solana/{types → devnet/types}/liqsol_token.ts +0 -0
- /package/src/assets/solana/{types → devnet/types}/transfer_hook.ts +0 -0
- /package/src/assets/solana/{types → devnet/types}/validator_leaderboard.ts +0 -0
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
TrancheSnapshot
|
|
9
9
|
} from '../../types';
|
|
10
10
|
import { EthereumContractService } from './contract';
|
|
11
|
-
import { preLaunchReceipt } from './types';
|
|
11
|
+
import { preLaunchReceipt, WithdrawReceipt } from './types';
|
|
12
12
|
import { buildEthereumTrancheSnapshot } from './utils';
|
|
13
13
|
import { ConvertClient } from './clients/convert.client';
|
|
14
14
|
import { StakeClient } from './clients/stake.client';
|
|
@@ -48,6 +48,7 @@ export class EthereumStakingClient implements IStakingClient {
|
|
|
48
48
|
this.contractService = new EthereumContractService({
|
|
49
49
|
provider: this.provider,
|
|
50
50
|
signer: this.signer,
|
|
51
|
+
chainId: config.network.chainId as EvmChainID,
|
|
51
52
|
});
|
|
52
53
|
|
|
53
54
|
this.convertClient = new ConvertClient(this.contractService);
|
|
@@ -98,6 +99,31 @@ export class EthereumStakingClient implements IStakingClient {
|
|
|
98
99
|
return result.txHash;
|
|
99
100
|
}
|
|
100
101
|
|
|
102
|
+
/**
|
|
103
|
+
* Withdraw native ETH from the liqETH protocol via the liqeth safeBurn function, which burns the LiqETH and adds the user to the withdrawal queue.
|
|
104
|
+
* @param amount Amount in wei (or something convertible to BigNumber).
|
|
105
|
+
* @returns transaction hash
|
|
106
|
+
*/
|
|
107
|
+
async loadPendingWithdraws(): Promise<WithdrawReceipt[]> {
|
|
108
|
+
this.ensureUser();
|
|
109
|
+
const address = await this.signer!.getAddress();
|
|
110
|
+
|
|
111
|
+
return await this.receiptClient.fetchWithdrawReceipts(address);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Withdraw native ETH from the liqETH protocol via the liqeth safeBurn function, which burns the LiqETH and adds the user to the withdrawal queue.
|
|
116
|
+
* @param tokenId The ID of the withdrawal request NFT
|
|
117
|
+
* @returns transaction hash
|
|
118
|
+
*/
|
|
119
|
+
async claimWithdraw(tokenId: bigint): Promise<string> {
|
|
120
|
+
this.ensureUser();
|
|
121
|
+
|
|
122
|
+
const tokenIdBigNum = BigNumber.from(tokenId)
|
|
123
|
+
const result = await this.convertClient.claimWithdraw(tokenIdBigNum)
|
|
124
|
+
return result.txHash;
|
|
125
|
+
}
|
|
126
|
+
|
|
101
127
|
|
|
102
128
|
/**
|
|
103
129
|
* Stake liqETH via DepositManager.
|
|
@@ -160,100 +186,106 @@ export class EthereumStakingClient implements IStakingClient {
|
|
|
160
186
|
* tracked = liqETH tracked balance (protocol/accounting view)
|
|
161
187
|
*/
|
|
162
188
|
async getPortfolio(): Promise<Portfolio | null> {
|
|
163
|
-
if (!this.signer) return Promise.resolve(null);
|
|
164
189
|
|
|
165
|
-
|
|
190
|
+
try {
|
|
191
|
+
if (!this.signer) return Promise.resolve(null);
|
|
166
192
|
|
|
167
|
-
|
|
168
|
-
const nativeBalance = await this.provider.getBalance(walletAddress);
|
|
169
|
-
const nativeDecimals = this.network?.nativeCurrency?.decimals ?? 18;
|
|
170
|
-
const nativeSymbol = this.network?.nativeCurrency?.symbol ?? 'ETH';
|
|
193
|
+
const walletAddress = await this.signer!.getAddress();
|
|
171
194
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
195
|
+
// 1) Native ETH balance
|
|
196
|
+
const nativeBalance = await this.provider.getBalance(walletAddress);
|
|
197
|
+
const nativeDecimals = this.network?.nativeCurrency?.decimals ?? 18;
|
|
198
|
+
const nativeSymbol = this.network?.nativeCurrency?.symbol ?? 'ETH';
|
|
175
199
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
let stakeSharesBN = BigNumber.from(0);
|
|
183
|
-
for (let r of stakeReceipts) {
|
|
184
|
-
stakeSharesBN = stakeSharesBN.add(BigNumber.from(r.receipt.shares.amount));
|
|
185
|
-
}
|
|
200
|
+
// 2) liqETH ERC-20 balance (actual)
|
|
201
|
+
const liqBalance: ethers.BigNumber = await this.contract.LiqEthToken.balanceOf(walletAddress);
|
|
202
|
+
const liqSymbol = 'Liq' + (this.network?.nativeCurrency?.symbol ?? 'ETH');
|
|
203
|
+
|
|
204
|
+
// 3) staked liqEth ERC-20 balance (calculate from receipts)
|
|
205
|
+
let stakeReceipts = await this.receiptClient.stakeReceipts(walletAddress);
|
|
186
206
|
|
|
187
|
-
|
|
188
|
-
|
|
207
|
+
let stakeBalanceBN = BigNumber.from(0);
|
|
208
|
+
for (let r of stakeReceipts) {
|
|
209
|
+
stakeBalanceBN = stakeBalanceBN.add(BigNumber.from(r.receipt.principal.amount));
|
|
210
|
+
}
|
|
211
|
+
let stakeSharesBN = BigNumber.from(0);
|
|
212
|
+
for (let r of stakeReceipts) {
|
|
213
|
+
stakeSharesBN = stakeSharesBN.add(BigNumber.from(r.receipt.shares.amount));
|
|
214
|
+
}
|
|
189
215
|
|
|
216
|
+
// 4) WIRE pretoken balance
|
|
217
|
+
const wireBalance: ethers.BigNumber = await this.contract.Pretoken.balanceOf(walletAddress);
|
|
218
|
+
|
|
219
|
+
// 5) Calculate staking yield
|
|
220
|
+
let currentIndex = BigInt(0);
|
|
221
|
+
let totalShares = BigInt(0);
|
|
222
|
+
let userShares = BigInt(0);
|
|
223
|
+
const indexScale = BigInt(1e27);
|
|
224
|
+
try {
|
|
225
|
+
// These may throw if not implemented on contract
|
|
226
|
+
const [indexBn, totalSharesBn] = await Promise.all([
|
|
227
|
+
this.contract.Depositor.index().catch(() => BigNumber.from(0)),
|
|
228
|
+
this.contract.Depositor.totalShares().catch(() => BigNumber.from(0)),
|
|
229
|
+
]);
|
|
230
|
+
|
|
231
|
+
const userSharesBn = stakeSharesBN;
|
|
232
|
+
currentIndex = BigInt(indexBn.toString());
|
|
233
|
+
totalShares = BigInt(totalSharesBn.toString());
|
|
234
|
+
userShares = BigInt(userSharesBn.toString());
|
|
235
|
+
} catch (error) {
|
|
236
|
+
console.log('Error fetching staking index/shares:', error);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// sharesToTokens(userShares, currentIndex) = userShares * currentIndex / indexScale
|
|
240
|
+
let estimatedClaim = BigInt(0);
|
|
241
|
+
let estimatedYield = BigInt(0);
|
|
242
|
+
|
|
243
|
+
if (userShares > BigInt(0) && currentIndex > BigInt(0)) {
|
|
244
|
+
estimatedClaim = (userShares * currentIndex) / indexScale;
|
|
245
|
+
if (estimatedClaim > stakeBalanceBN.toBigInt()) {
|
|
246
|
+
estimatedYield = estimatedClaim - stakeBalanceBN.toBigInt();
|
|
247
|
+
}
|
|
248
|
+
}
|
|
190
249
|
|
|
191
|
-
// 5) Calculate staking yield
|
|
192
|
-
let currentIndex = BigInt(0);
|
|
193
|
-
let totalShares = BigInt(0);
|
|
194
|
-
let userShares = BigInt(0);
|
|
195
|
-
const indexScale = BigInt(1e27);
|
|
196
|
-
try {
|
|
197
|
-
// These may throw if not implemented on contract
|
|
198
|
-
const [indexBn, totalSharesBn] = await Promise.all([
|
|
199
|
-
this.contract.Depositor.index().catch(() => BigNumber.from(0)),
|
|
200
|
-
this.contract.Depositor.totalShares().catch(() => BigNumber.from(0)),
|
|
201
|
-
]);
|
|
202
250
|
|
|
203
|
-
const
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
wire: {
|
|
241
|
-
amount: wireBalance.toBigInt(),
|
|
242
|
-
decimals: 18,
|
|
243
|
-
symbol: '$WIRE',
|
|
244
|
-
},
|
|
245
|
-
|
|
246
|
-
yield: {
|
|
247
|
-
currentIndex,
|
|
248
|
-
indexScale,
|
|
249
|
-
totalShares,
|
|
250
|
-
userShares,
|
|
251
|
-
estimatedClaim,
|
|
252
|
-
estimatedYield,
|
|
253
|
-
},
|
|
254
|
-
chainID: this.network.chainId
|
|
251
|
+
const portfolio: Portfolio = {
|
|
252
|
+
native: {
|
|
253
|
+
amount: nativeBalance.toBigInt(),
|
|
254
|
+
decimals: nativeDecimals,
|
|
255
|
+
symbol: nativeSymbol,
|
|
256
|
+
},
|
|
257
|
+
liq: {
|
|
258
|
+
amount: liqBalance.toBigInt(),
|
|
259
|
+
decimals: nativeDecimals,
|
|
260
|
+
symbol: liqSymbol,
|
|
261
|
+
},
|
|
262
|
+
staked: {
|
|
263
|
+
amount: stakeBalanceBN.toBigInt(),
|
|
264
|
+
decimals: nativeDecimals,
|
|
265
|
+
symbol: liqSymbol,
|
|
266
|
+
},
|
|
267
|
+
wire: {
|
|
268
|
+
amount: wireBalance.toBigInt(),
|
|
269
|
+
decimals: 18,
|
|
270
|
+
symbol: '$WIRE',
|
|
271
|
+
},
|
|
272
|
+
|
|
273
|
+
yield: {
|
|
274
|
+
currentIndex,
|
|
275
|
+
indexScale,
|
|
276
|
+
totalShares,
|
|
277
|
+
userShares,
|
|
278
|
+
estimatedClaim,
|
|
279
|
+
estimatedYield,
|
|
280
|
+
},
|
|
281
|
+
chainID: this.network.chainId
|
|
282
|
+
}
|
|
283
|
+
return portfolio;
|
|
284
|
+
}
|
|
285
|
+
catch (error) {
|
|
286
|
+
// console.log('Error fetching Ethereum portfolio:', error);
|
|
287
|
+
throw error;
|
|
255
288
|
}
|
|
256
|
-
return portfolio;
|
|
257
289
|
}
|
|
258
290
|
|
|
259
291
|
/**
|
|
@@ -333,24 +365,14 @@ export class EthereumStakingClient implements IStakingClient {
|
|
|
333
365
|
*
|
|
334
366
|
* SUPPORTS READ-ONLY ACcESS
|
|
335
367
|
*/
|
|
336
|
-
async getTrancheSnapshot(
|
|
337
|
-
chainID?: ChainID;
|
|
338
|
-
windowBefore?: number;
|
|
339
|
-
windowAfter?: number;
|
|
340
|
-
}): Promise<TrancheSnapshot> {
|
|
341
|
-
const {
|
|
342
|
-
chainID = EvmChainID.Ethereum,
|
|
343
|
-
windowBefore,
|
|
344
|
-
windowAfter,
|
|
345
|
-
} = options ?? {};
|
|
368
|
+
async getTrancheSnapshot(chainID: ChainID): Promise<TrancheSnapshot> {
|
|
346
369
|
|
|
370
|
+
console.log('getTrancheSnapshot', chainID);
|
|
347
371
|
|
|
348
372
|
try {
|
|
349
|
-
|
|
350
373
|
const blockNumber = await this.provider.getBlockNumber();
|
|
351
374
|
const blockTag = { blockTag: blockNumber };
|
|
352
375
|
|
|
353
|
-
|
|
354
376
|
// Fetch all required contract data
|
|
355
377
|
const [totalSharesBn, indexBn, trancheNumberBn, trancheSupplyBn, tranchePriceUsdBn, totalSupplyBn, supplyGrowthBps, priceGrowthCents, minPriceUsd, maxPriceUsd] = await Promise.all([
|
|
356
378
|
this.contract.Depositor.totalShares(blockTag),
|
|
@@ -368,7 +390,6 @@ export class EthereumStakingClient implements IStakingClient {
|
|
|
368
390
|
const totalTrancheSupply = BigInt(totalSupplyBn.toString()) / BigInt(1e10);
|
|
369
391
|
const currentTrancheSupply = BigInt(trancheSupplyBn.toString()) / BigInt(1e10);
|
|
370
392
|
|
|
371
|
-
|
|
372
393
|
// fetch price and timestamp from aggregator
|
|
373
394
|
// const [roundId, answer, startedAt, updatedAt, answeredInRound] = await this.contract.MockAggregator.latestRoundData();
|
|
374
395
|
//originally fetched ethPrice from aggregator - pulling from EthUsdPriceConsumer instead - this is where the actual price gets pulled from when purchasing pretokens.
|
|
@@ -394,11 +415,7 @@ export class EthereumStakingClient implements IStakingClient {
|
|
|
394
415
|
priceGrowthCents,
|
|
395
416
|
minPriceUsd,
|
|
396
417
|
maxPriceUsd,
|
|
397
|
-
|
|
398
418
|
ethPriceUsd,
|
|
399
|
-
// nativePriceTimestamp,
|
|
400
|
-
ladderWindowBefore: windowBefore,
|
|
401
|
-
ladderWindowAfter: windowAfter,
|
|
402
419
|
});
|
|
403
420
|
}
|
|
404
421
|
catch (err: any) {
|
|
@@ -422,7 +439,7 @@ export class EthereumStakingClient implements IStakingClient {
|
|
|
422
439
|
txCount?: number;
|
|
423
440
|
safetyMultiplier?: number;
|
|
424
441
|
minBufferWei?: bigint;
|
|
425
|
-
balanceOverrideLamports?: bigint;
|
|
442
|
+
balanceOverrideLamports?: bigint;
|
|
426
443
|
}): Promise<bigint> {
|
|
427
444
|
this.ensureUser();
|
|
428
445
|
|
|
@@ -11,7 +11,7 @@ export const CONTRACT_NAMES = [
|
|
|
11
11
|
"DepositManager",
|
|
12
12
|
"WithdrawalVault",
|
|
13
13
|
"StakingModule",
|
|
14
|
-
"YieldOracle",
|
|
14
|
+
// "YieldOracle",
|
|
15
15
|
|
|
16
16
|
//Outpost contracts
|
|
17
17
|
"OutpostManagerAuthority",
|
|
@@ -29,7 +29,7 @@ export const CONTRACT_NAMES = [
|
|
|
29
29
|
"Pretoken",
|
|
30
30
|
"OPPInbound",
|
|
31
31
|
"Depositor",
|
|
32
|
-
|
|
32
|
+
"MockAggregator",
|
|
33
33
|
] as const;
|
|
34
34
|
|
|
35
35
|
export type ContractName = typeof CONTRACT_NAMES[number];
|
|
@@ -110,4 +110,19 @@ export interface preLaunchReceipt {
|
|
|
110
110
|
shares: BalanceView,
|
|
111
111
|
timestamp: string,
|
|
112
112
|
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export interface ClaimedEvent {
|
|
116
|
+
user: string;
|
|
117
|
+
amount: BigNumber;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
export interface WithdrawReceipt {
|
|
122
|
+
tokenId: bigint;
|
|
123
|
+
receipt: {
|
|
124
|
+
ethAmount: BigNumber;
|
|
125
|
+
ethBalance: BalanceView;
|
|
126
|
+
readyAt: number;
|
|
127
|
+
}
|
|
113
128
|
}
|