@wireio/stake 0.1.1 → 0.1.3
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 +6681 -115
- package/lib/stake.browser.js.map +1 -1
- package/lib/stake.d.ts +23 -40
- package/lib/stake.js +6684 -120
- package/lib/stake.js.map +1 -1
- package/lib/stake.m.js +6681 -115
- package/lib/stake.m.js.map +1 -1
- package/package.json +1 -1
- package/src/assets/ethereum/ABI/liqEth/DepositManager.sol/DepositManager.dbg.json +4 -0
- package/src/assets/ethereum/ABI/liqEth/DepositManager.sol/DepositManager.json +1153 -0
- package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/IAccounting.dbg.json +4 -0
- package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/IAccounting.json +172 -0
- package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/IDepositContract.dbg.json +4 -0
- package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/IDepositContract.json +39 -0
- package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/IDepositManager.dbg.json +4 -0
- package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/IDepositManager.json +64 -0
- package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/ILiqEthBurn.dbg.json +4 -0
- package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/ILiqEthBurn.json +24 -0
- package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/ILiqEthMint.dbg.json +4 -0
- package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/ILiqEthMint.json +35 -0
- package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/IRewardsERC20.dbg.json +4 -0
- package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/IRewardsERC20.json +213 -0
- package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/IStakingModule.dbg.json +4 -0
- package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/IStakingModule.json +138 -0
- package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/IValidatorBalanceVerifier.dbg.json +4 -0
- package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/IValidatorBalanceVerifier.json +70 -0
- package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/IWithdrawalRecord.dbg.json +4 -0
- package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/IWithdrawalRecord.json +64 -0
- package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/LiqEthCommon.dbg.json +4 -0
- package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/LiqEthCommon.json +10 -0
- package/src/assets/ethereum/ABI/liqEth/RewardsERC20.sol/RewardsERC20.dbg.json +4 -0
- package/src/assets/ethereum/ABI/liqEth/RewardsERC20.sol/RewardsERC20.json +749 -0
- package/src/assets/ethereum/ABI/liqEth/RewardsERC20Pausable.sol/RewardsERC20Pausable.dbg.json +4 -0
- package/src/assets/ethereum/ABI/liqEth/RewardsERC20Pausable.sol/RewardsERC20Pausable.json +812 -0
- package/src/assets/ethereum/ABI/liqEth/ValidatorBalanceVerifier.sol/BeaconRoots.dbg.json +4 -0
- package/src/assets/ethereum/ABI/liqEth/ValidatorBalanceVerifier.sol/BeaconRoots.json +10 -0
- package/src/assets/ethereum/ABI/liqEth/ValidatorBalanceVerifier.sol/SSZ.dbg.json +4 -0
- package/src/assets/ethereum/ABI/liqEth/ValidatorBalanceVerifier.sol/SSZ.json +10 -0
- package/src/assets/ethereum/ABI/liqEth/ValidatorBalanceVerifier.sol/ValidatorBalanceVerifier.dbg.json +4 -0
- package/src/assets/ethereum/ABI/liqEth/ValidatorBalanceVerifier.sol/ValidatorBalanceVerifier.json +225 -0
- package/src/assets/ethereum/ABI/liqEth/Yield.sol/BeaconRoots.dbg.json +4 -0
- package/src/assets/ethereum/ABI/liqEth/Yield.sol/BeaconRoots.json +10 -0
- package/src/assets/ethereum/ABI/liqEth/Yield.sol/SSZ.dbg.json +4 -0
- package/src/assets/ethereum/ABI/liqEth/Yield.sol/SSZ.json +10 -0
- package/src/assets/ethereum/ABI/liqEth/Yield.sol/YieldOracle.dbg.json +4 -0
- package/src/assets/ethereum/ABI/liqEth/Yield.sol/YieldOracle.json +813 -0
- package/src/assets/ethereum/ABI/liqEth/accounting.sol/Accounting.dbg.json +4 -0
- package/src/assets/ethereum/ABI/liqEth/accounting.sol/Accounting.json +651 -0
- package/src/assets/ethereum/ABI/liqEth/liqEth.sol/LiqEthToken.dbg.json +4 -0
- package/src/assets/ethereum/ABI/liqEth/liqEth.sol/LiqEthToken.json +1110 -0
- package/src/assets/ethereum/ABI/liqEth/liqEthBurn.sol/LiqEthBurn.dbg.json +4 -0
- package/src/assets/ethereum/ABI/liqEth/liqEthBurn.sol/LiqEthBurn.json +391 -0
- package/src/assets/ethereum/ABI/liqEth/liqEthMint.sol/LiqEthMint.dbg.json +4 -0
- package/src/assets/ethereum/ABI/liqEth/liqEthMint.sol/LiqEthMint.json +402 -0
- package/src/assets/ethereum/ABI/liqEth/stakingModule.sol/StakingModule.dbg.json +4 -0
- package/src/assets/ethereum/ABI/liqEth/stakingModule.sol/StakingModule.json +1225 -0
- package/src/assets/ethereum/ABI/liqEth/withdrawalQueue.sol/WithdrawalQueue.dbg.json +4 -0
- package/src/assets/ethereum/ABI/liqEth/withdrawalQueue.sol/WithdrawalQueue.json +927 -0
- package/src/assets/ethereum/ABI/liqEth/withdrawalVault.sol/Uint64BE.dbg.json +4 -0
- package/src/assets/ethereum/ABI/liqEth/withdrawalVault.sol/Uint64BE.json +10 -0
- package/src/assets/ethereum/ABI/liqEth/withdrawalVault.sol/WithdrawalVault.dbg.json +4 -0
- package/src/assets/ethereum/ABI/liqEth/withdrawalVault.sol/WithdrawalVault.json +447 -0
- package/src/index.ts +1 -1
- package/src/networks/ethereum/contract.ts +53 -90
- package/src/networks/ethereum/ethereum.ts +40 -65
- package/src/networks/ethereum/types.ts +6 -9
- package/src/networks/solana/solana.ts +36 -32
- package/src/staker/staker.ts +6 -3
- package/src/staker/types.ts +14 -9
package/lib/stake.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { PublicKey, ExternalNetwork, ChainID } from '@wireio/core';
|
|
|
3
3
|
import { BaseSignerWalletAdapter } from '@solana/wallet-adapter-base';
|
|
4
4
|
import * as _solana_web3_js from '@solana/web3.js';
|
|
5
5
|
import { PublicKey as PublicKey$1, Transaction, VersionedTransaction, TokenAmount, Connection, TransactionSignature, Keypair } from '@solana/web3.js';
|
|
6
|
-
import { ethers, BigNumberish,
|
|
6
|
+
import { BigNumber, ethers, BigNumberish, Signer, Contract } from 'ethers';
|
|
7
7
|
import { JsonFragment } from '@ethersproject/abi';
|
|
8
8
|
import { ErrorDescription } from '@ethersproject/abi/lib/interface';
|
|
9
9
|
import { AnchorProvider, Program, BN } from '@coral-xyz/anchor';
|
|
@@ -12,9 +12,8 @@ interface IStakingClient {
|
|
|
12
12
|
pubKey: PublicKey;
|
|
13
13
|
network: ExternalNetwork;
|
|
14
14
|
/** Amount is in the chain's smallest unit (lamports/wei, etc.) */
|
|
15
|
-
deposit(amount: number): Promise<string>;
|
|
15
|
+
deposit(amount: number | BigNumber): Promise<string>;
|
|
16
16
|
/** Register any untracked LIQ staked tokens */
|
|
17
|
-
register(): Promise<string>;
|
|
18
17
|
/** Fetch the portfolio for the LIQ stake user */
|
|
19
18
|
getPortfolio(): Promise<Portfolio>;
|
|
20
19
|
}
|
|
@@ -24,14 +23,19 @@ type StakerConfig = {
|
|
|
24
23
|
pubKey: PublicKey;
|
|
25
24
|
};
|
|
26
25
|
interface Portfolio {
|
|
27
|
-
/** Native
|
|
26
|
+
/** Native balance on chain: ETH, SOL */
|
|
28
27
|
native: BalanceView;
|
|
29
|
-
/** Actual
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
|
|
28
|
+
/** Actual Liquid balance of LiqETH, LiqSOL*/
|
|
29
|
+
liq: BalanceView;
|
|
30
|
+
/** Outpost Staked balance */
|
|
31
|
+
staked: BalanceView;
|
|
32
|
+
/** SOL ONLY!
|
|
33
|
+
* Tracked liqSOL balance from distribution program */
|
|
34
|
+
tracked?: BalanceView;
|
|
33
35
|
/** Extra PDAs and account addresses */
|
|
34
36
|
extras?: Record<string, any>;
|
|
37
|
+
/** Chain ID of the network for which this portfolio is from */
|
|
38
|
+
chainID: ChainID;
|
|
35
39
|
}
|
|
36
40
|
type BalanceView = {
|
|
37
41
|
amount: BigNumberish;
|
|
@@ -67,17 +71,11 @@ declare class EthereumStakingClient implements IStakingClient {
|
|
|
67
71
|
private readonly signer;
|
|
68
72
|
private readonly contractService;
|
|
69
73
|
get contract(): {
|
|
70
|
-
|
|
71
|
-
LiqEth: ethers.Contract;
|
|
74
|
+
Accounting: ethers.Contract;
|
|
72
75
|
DepositManager: ethers.Contract;
|
|
73
|
-
|
|
76
|
+
LiqEth: ethers.Contract;
|
|
74
77
|
LiqEthBurn: ethers.Contract;
|
|
75
|
-
|
|
76
|
-
LiqEthCommon: ethers.Contract;
|
|
77
|
-
RewardsERC20: ethers.Contract;
|
|
78
|
-
ValidatorBalanceVerifier: ethers.Contract;
|
|
79
|
-
Yield: ethers.Contract;
|
|
80
|
-
Accounting: ethers.Contract;
|
|
78
|
+
LiqEthMint: ethers.Contract;
|
|
81
79
|
StakingModule: ethers.Contract;
|
|
82
80
|
WithdrawalQueue: ethers.Contract;
|
|
83
81
|
WithdrawalVault: ethers.Contract;
|
|
@@ -99,15 +97,6 @@ declare class EthereumStakingClient implements IStakingClient {
|
|
|
99
97
|
*/
|
|
100
98
|
simulateDeposit(amount: number | string | bigint | BigNumber): Promise<void>;
|
|
101
99
|
private performDeposit;
|
|
102
|
-
/**
|
|
103
|
-
* Build, sign, and submit a single transaction that:
|
|
104
|
-
* - Corrects other users (if needed) to free available balance, then
|
|
105
|
-
* - Registers the caller’s untracked liqSOL.
|
|
106
|
-
*
|
|
107
|
-
* @param amount Optional: register a smaller amount than your full untracked balance.
|
|
108
|
-
* @returns signature string
|
|
109
|
-
*/
|
|
110
|
-
register(amount?: bigint): Promise<string>;
|
|
111
100
|
/**
|
|
112
101
|
* Resolve the user's ETH + liqETH balances.
|
|
113
102
|
*
|
|
@@ -118,7 +107,7 @@ declare class EthereumStakingClient implements IStakingClient {
|
|
|
118
107
|
getPortfolio(): Promise<Portfolio>;
|
|
119
108
|
}
|
|
120
109
|
|
|
121
|
-
declare const CONTRACT_NAMES: readonly ["
|
|
110
|
+
declare const CONTRACT_NAMES: readonly ["Accounting", "DepositManager", "LiqEth", "LiqEthBurn", "LiqEthMint", "StakingModule", "WithdrawalQueue", "WithdrawalVault"];
|
|
122
111
|
type ContractName = typeof CONTRACT_NAMES[number];
|
|
123
112
|
type AddressBook = Record<ContractName, string>;
|
|
124
113
|
interface DepositEvent {
|
|
@@ -146,12 +135,6 @@ declare namespace types$1 {
|
|
|
146
135
|
export type { types$1_AddressBook as AddressBook, types$1_ContractName as ContractName, types$1_DepositEvent as DepositEvent, types$1_DepositResult as DepositResult };
|
|
147
136
|
}
|
|
148
137
|
|
|
149
|
-
/**
|
|
150
|
-
* @module EthereumContractService
|
|
151
|
-
*
|
|
152
|
-
* Provides a unified service for interacting with Ethereum smart contracts using ethers.js.
|
|
153
|
-
*/
|
|
154
|
-
|
|
155
138
|
declare const ERC20Abi: ({
|
|
156
139
|
inputs: {
|
|
157
140
|
internalType: string;
|
|
@@ -420,6 +403,12 @@ declare class SolanaStakingClient implements IStakingClient {
|
|
|
420
403
|
*/
|
|
421
404
|
getUserRecord(): Promise<UserRecord | null>;
|
|
422
405
|
getProtocolFee(): void;
|
|
406
|
+
/**
|
|
407
|
+
* Deposit funds into the staking pool.
|
|
408
|
+
* @param lamports The amount to deposit (in lamports).
|
|
409
|
+
* @returns The transaction signature.
|
|
410
|
+
*/
|
|
411
|
+
deposit(lamports: number): Promise<string>;
|
|
423
412
|
/**
|
|
424
413
|
* Build, sign, and submit a single transaction that:
|
|
425
414
|
* - Corrects other users (if needed) to free available balance, then
|
|
@@ -428,13 +417,7 @@ declare class SolanaStakingClient implements IStakingClient {
|
|
|
428
417
|
* @param amount Optional: register a smaller amount than your full untracked balance.
|
|
429
418
|
* @returns signature string
|
|
430
419
|
*/
|
|
431
|
-
|
|
432
|
-
/**
|
|
433
|
-
* Deposit funds into the staking pool.
|
|
434
|
-
* @param lamports The amount to deposit (in lamports).
|
|
435
|
-
* @returns The transaction signature.
|
|
436
|
-
*/
|
|
437
|
-
deposit(lamports: number): Promise<string>;
|
|
420
|
+
correctBalance(amount?: bigint): Promise<string>;
|
|
438
421
|
private sendAndConfirmHttp;
|
|
439
422
|
signTransaction(tx: SolanaTransaction): Promise<SolanaTransaction>;
|
|
440
423
|
sendTransaction(signed: SolanaTransaction): Promise<TransactionSignature>;
|