@wireio/stake 0.2.0 → 0.2.2

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.
Files changed (120) hide show
  1. package/lib/stake.browser.js +11779 -2023
  2. package/lib/stake.browser.js.map +1 -1
  3. package/lib/stake.d.ts +94 -40
  4. package/lib/stake.js +11906 -2088
  5. package/lib/stake.js.map +1 -1
  6. package/lib/stake.m.js +11779 -2023
  7. package/lib/stake.m.js.map +1 -1
  8. package/package.json +1 -1
  9. package/src/assets/ethereum/ABI/liqEth/DepositManager.sol/DepositManager.dbg.json +1 -1
  10. package/src/assets/ethereum/ABI/liqEth/DepositManager.sol/DepositManager.json +26 -65
  11. package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/IAccounting.dbg.json +1 -1
  12. package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/IAccounting.json +24 -20
  13. package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/IDepositContract.dbg.json +1 -1
  14. package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/IDepositManager.dbg.json +1 -1
  15. package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/IRewardsERC20.dbg.json +1 -1
  16. package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/IStakingModule.dbg.json +1 -1
  17. package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/IStakingModule.json +0 -20
  18. package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/IValidatorBalanceVerifier.dbg.json +1 -1
  19. package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/IWithdrawalRecord.dbg.json +1 -1
  20. package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/LiqEthCommon.dbg.json +1 -1
  21. package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/LiqEthCommon.json +2 -2
  22. package/src/assets/ethereum/ABI/liqEth/RewardsERC20.sol/RewardsERC20.dbg.json +1 -1
  23. package/src/assets/ethereum/ABI/liqEth/RewardsERC20Pausable.sol/RewardsERC20Pausable.dbg.json +1 -1
  24. package/src/assets/ethereum/ABI/liqEth/ValidatorBalanceVerifier.sol/BeaconRoots.dbg.json +1 -1
  25. package/src/assets/ethereum/ABI/liqEth/ValidatorBalanceVerifier.sol/SSZ.dbg.json +1 -1
  26. package/src/assets/ethereum/ABI/liqEth/ValidatorBalanceVerifier.sol/ValidatorBalanceVerifier.dbg.json +1 -1
  27. package/src/assets/ethereum/ABI/liqEth/Yield.sol/BeaconRoots.dbg.json +1 -1
  28. package/src/assets/ethereum/ABI/liqEth/Yield.sol/BeaconRoots.json +2 -2
  29. package/src/assets/ethereum/ABI/liqEth/Yield.sol/SSZ.dbg.json +1 -1
  30. package/src/assets/ethereum/ABI/liqEth/Yield.sol/SSZ.json +2 -2
  31. package/src/assets/ethereum/ABI/liqEth/Yield.sol/YieldOracle.dbg.json +1 -1
  32. package/src/assets/ethereum/ABI/liqEth/Yield.sol/YieldOracle.json +2 -2
  33. package/src/assets/ethereum/ABI/liqEth/accounting.sol/Accounting.dbg.json +1 -1
  34. package/src/assets/ethereum/ABI/liqEth/accounting.sol/Accounting.json +31 -109
  35. package/src/assets/ethereum/ABI/liqEth/liqEth.sol/LiqEthToken.dbg.json +1 -1
  36. package/src/assets/ethereum/ABI/liqEth/liqEth.sol/LiqEthToken.json +2 -25
  37. package/src/assets/ethereum/ABI/liqEth/stakingModule.sol/StakingModule.dbg.json +1 -1
  38. package/src/assets/ethereum/ABI/liqEth/stakingModule.sol/StakingModule.json +30 -72
  39. package/src/assets/ethereum/ABI/liqEth/withdrawalQueue.sol/WithdrawalQueue.dbg.json +1 -1
  40. package/src/assets/ethereum/ABI/liqEth/withdrawalQueue.sol/WithdrawalQueue.json +2 -2
  41. package/src/assets/ethereum/ABI/liqEth/withdrawalVault.sol/Uint64BE.dbg.json +1 -1
  42. package/src/assets/ethereum/ABI/liqEth/withdrawalVault.sol/Uint64BE.json +2 -2
  43. package/src/assets/ethereum/ABI/liqEth/withdrawalVault.sol/WithdrawalVault.dbg.json +1 -1
  44. package/src/assets/ethereum/ABI/liqEth/withdrawalVault.sol/WithdrawalVault.json +2 -2
  45. package/src/assets/ethereum/ABI/outpost/BAR.sol/BAR.dbg.json +4 -0
  46. package/src/assets/ethereum/ABI/outpost/BAR.sol/BAR.json +1856 -0
  47. package/src/assets/ethereum/ABI/outpost/Depositor.sol/Depositor.dbg.json +4 -0
  48. package/src/assets/ethereum/ABI/outpost/Depositor.sol/Depositor.json +1753 -0
  49. package/src/assets/ethereum/ABI/outpost/EthUsdPriceConsumer.sol/AggregatorV3Interface.dbg.json +4 -0
  50. package/src/assets/ethereum/ABI/outpost/EthUsdPriceConsumer.sol/AggregatorV3Interface.json +122 -0
  51. package/src/assets/ethereum/ABI/outpost/EthUsdPriceConsumer.sol/EthUsdPriceConsumer.dbg.json +4 -0
  52. package/src/assets/ethereum/ABI/outpost/EthUsdPriceConsumer.sol/EthUsdPriceConsumer.json +601 -0
  53. package/src/assets/ethereum/ABI/outpost/OPP.sol/OPP.dbg.json +4 -0
  54. package/src/assets/ethereum/ABI/outpost/OPP.sol/OPP.json +930 -0
  55. package/src/assets/ethereum/ABI/outpost/OPPCommon.sol/IOPP.dbg.json +4 -0
  56. package/src/assets/ethereum/ABI/outpost/OPPCommon.sol/IOPP.json +88 -0
  57. package/src/assets/ethereum/ABI/outpost/OPPCommon.sol/IOPPEndpoint.dbg.json +4 -0
  58. package/src/assets/ethereum/ABI/outpost/OPPCommon.sol/IOPPEndpoint.json +29 -0
  59. package/src/assets/ethereum/ABI/outpost/OPPCommon.sol/IOPPInbound.dbg.json +4 -0
  60. package/src/assets/ethereum/ABI/outpost/OPPCommon.sol/IOPPInbound.json +194 -0
  61. package/src/assets/ethereum/ABI/outpost/OPPCommon.sol/IOPPReceiver.dbg.json +4 -0
  62. package/src/assets/ethereum/ABI/outpost/OPPCommon.sol/IOPPReceiver.json +29 -0
  63. package/src/assets/ethereum/ABI/outpost/OPPCommon.sol/IOPPSender.dbg.json +4 -0
  64. package/src/assets/ethereum/ABI/outpost/OPPCommon.sol/IOPPSender.json +36 -0
  65. package/src/assets/ethereum/ABI/outpost/OPPCommon.sol/OPPCommon.dbg.json +4 -0
  66. package/src/assets/ethereum/ABI/outpost/OPPCommon.sol/OPPCommon.json +199 -0
  67. package/src/assets/ethereum/ABI/outpost/OPPEndpoint.sol/OPPEndpoint.dbg.json +4 -0
  68. package/src/assets/ethereum/ABI/outpost/OPPEndpoint.sol/OPPEndpoint.json +273 -0
  69. package/src/assets/ethereum/ABI/outpost/OPPEndpointManaged.sol/OPPEndpointManaged.dbg.json +4 -0
  70. package/src/assets/ethereum/ABI/outpost/OPPEndpointManaged.sol/OPPEndpointManaged.json +394 -0
  71. package/src/assets/ethereum/ABI/outpost/OPPEndpointOwnable.sol/OPPEndpointOwnable.dbg.json +4 -0
  72. package/src/assets/ethereum/ABI/outpost/OPPEndpointOwnable.sol/OPPEndpointOwnable.json +378 -0
  73. package/src/assets/ethereum/ABI/outpost/OPPErrors.sol/OPPErrors.dbg.json +4 -0
  74. package/src/assets/ethereum/ABI/outpost/OPPErrors.sol/OPPErrors.json +224 -0
  75. package/src/assets/ethereum/ABI/outpost/OPPInbound.sol/OPPInbound.dbg.json +4 -0
  76. package/src/assets/ethereum/ABI/outpost/OPPInbound.sol/OPPInbound.json +1010 -0
  77. package/src/assets/ethereum/ABI/outpost/OPPReceiver.sol/OPPReceiver.dbg.json +4 -0
  78. package/src/assets/ethereum/ABI/outpost/OPPReceiver.sol/OPPReceiver.json +291 -0
  79. package/src/assets/ethereum/ABI/outpost/OPPSender.sol/OPPSender.dbg.json +4 -0
  80. package/src/assets/ethereum/ABI/outpost/OPPSender.sol/OPPSender.json +298 -0
  81. package/src/assets/ethereum/ABI/outpost/OutpostErrors.sol/OutpostErrors.dbg.json +4 -0
  82. package/src/assets/ethereum/ABI/outpost/OutpostErrors.sol/OutpostErrors.json +473 -0
  83. package/src/assets/ethereum/ABI/outpost/OutpostManaged.sol/OutpostManaged.dbg.json +4 -0
  84. package/src/assets/ethereum/ABI/outpost/OutpostManaged.sol/OutpostManaged.json +229 -0
  85. package/src/assets/ethereum/ABI/outpost/OutpostManager.sol/OutpostManager.dbg.json +4 -0
  86. package/src/assets/ethereum/ABI/outpost/OutpostManager.sol/OutpostManager.json +730 -0
  87. package/src/assets/ethereum/ABI/outpost/OutpostManagerAuthority.sol/OutpostManagerAuthority.dbg.json +4 -0
  88. package/src/assets/ethereum/ABI/outpost/OutpostManagerAuthority.sol/OutpostManagerAuthority.json +1432 -0
  89. package/src/assets/ethereum/ABI/outpost/OutpostManagerCommon.sol/IOutpostManager.dbg.json +4 -0
  90. package/src/assets/ethereum/ABI/outpost/OutpostManagerCommon.sol/IOutpostManager.json +130 -0
  91. package/src/assets/ethereum/ABI/outpost/OutpostManagerCommon.sol/IOutpostUpgradeable.dbg.json +4 -0
  92. package/src/assets/ethereum/ABI/outpost/OutpostManagerCommon.sol/IOutpostUpgradeable.json +29 -0
  93. package/src/assets/ethereum/ABI/outpost/OutpostManagerCommon.sol/OutpostManagerCommon.dbg.json +4 -0
  94. package/src/assets/ethereum/ABI/outpost/OutpostManagerCommon.sol/OutpostManagerCommon.json +141 -0
  95. package/src/assets/ethereum/ABI/outpost/OutpostOwnable.sol/OutpostOwnable.dbg.json +4 -0
  96. package/src/assets/ethereum/ABI/outpost/OutpostOwnable.sol/OutpostOwnable.json +213 -0
  97. package/src/assets/ethereum/ABI/outpost/Pool.sol/Pool.dbg.json +4 -0
  98. package/src/assets/ethereum/ABI/outpost/Pool.sol/Pool.json +921 -0
  99. package/src/assets/ethereum/ABI/outpost/ReceiptNFT.sol/ReceiptNFT.dbg.json +4 -0
  100. package/src/assets/ethereum/ABI/outpost/ReceiptNFT.sol/ReceiptNFT.json +2020 -0
  101. package/src/assets/ethereum/ABI/outpost/Warrant.sol/Warrant.dbg.json +4 -0
  102. package/src/assets/ethereum/ABI/outpost/Warrant.sol/Warrant.json +1650 -0
  103. package/src/assets/ethereum/ABI/outpost/interfaces/IWarrant.sol/IWarrant.dbg.json +4 -0
  104. package/src/assets/ethereum/ABI/{liqEth/LiqEthCommon.sol/ILiqEthMint.json → outpost/interfaces/IWarrant.sol/IWarrant.json} +6 -12
  105. package/src/assets/ethereum/ABI/outpost/token/ERC721EthEquivalentVotesUpgradeable.sol/ERC721EthEquivalentVotesUpgradeable.dbg.json +4 -0
  106. package/src/assets/ethereum/ABI/outpost/token/ERC721EthEquivalentVotesUpgradeable.sol/ERC721EthEquivalentVotesUpgradeable.json +858 -0
  107. package/src/assets/ethereum/ABI/outpost/token/IERC721EthEquivalent.sol/IERC721EthEquivalent.dbg.json +4 -0
  108. package/src/assets/ethereum/ABI/outpost/token/IERC721EthEquivalent.sol/IERC721EthEquivalent.json +30 -0
  109. package/src/networks/ethereum/clients/deposit.client.ts +82 -0
  110. package/src/networks/ethereum/clients/stake.client.ts +215 -0
  111. package/src/networks/ethereum/contract.ts +79 -23
  112. package/src/networks/ethereum/ethereum.ts +130 -66
  113. package/src/networks/ethereum/types.ts +74 -7
  114. package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/ILiqEthBurn.dbg.json +0 -4
  115. package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/ILiqEthBurn.json +0 -24
  116. package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/ILiqEthMint.dbg.json +0 -4
  117. package/src/assets/ethereum/ABI/liqEth/liqEthBurn.sol/LiqEthBurn.dbg.json +0 -4
  118. package/src/assets/ethereum/ABI/liqEth/liqEthBurn.sol/LiqEthBurn.json +0 -391
  119. package/src/assets/ethereum/ABI/liqEth/liqEthMint.sol/LiqEthMint.dbg.json +0 -4
  120. package/src/assets/ethereum/ABI/liqEth/liqEthMint.sol/LiqEthMint.json +0 -402
package/lib/stake.d.ts CHANGED
@@ -67,21 +67,107 @@ declare class Staker {
67
67
  setChain(chainID: ChainID): boolean;
68
68
  }
69
69
 
70
+ declare const CONTRACT_NAMES: readonly ["Accounting", "DepositManager", "LiqEth", "StakingModule", "WithdrawalQueue", "WithdrawalVault", "Depositor", "ReceiptNFT", "OutpostManager", "BAR", "OPP", "OPPCommon", "OPPInbound", "Warrant"];
71
+ type ContractName = typeof CONTRACT_NAMES[number];
72
+ type AddressBook = Record<ContractName, string>;
73
+ interface Result {
74
+ /** EVM transaction hash */
75
+ txHash: string;
76
+ /** Full receipt, if you want it */
77
+ receipt: ethers.providers.TransactionReceipt;
78
+ }
79
+ interface DepositEvent {
80
+ user: string;
81
+ netEth: BigNumber;
82
+ fee: BigNumber;
83
+ shares: BigNumber;
84
+ }
85
+ interface DepositResult extends Result {
86
+ /** Parsed Deposited event, if present */
87
+ deposited?: DepositEvent;
88
+ }
89
+ interface WithdrawRequestedEvent {
90
+ user: string;
91
+ ethAmount: BigNumber;
92
+ nftId: BigNumber;
93
+ readyAt: string;
94
+ }
95
+ interface WithdrawResult extends Result {
96
+ /** Parsed WithdrawRequested event, if present */
97
+ withdrawRequested?: WithdrawRequestedEvent;
98
+ }
99
+ interface StakedEvent {
100
+ user: string;
101
+ amountLiq: BigNumber;
102
+ shares: BigNumber;
103
+ tokenId: BigNumber;
104
+ }
105
+ interface StakedResult extends Result {
106
+ /** Parsed Staked event, if present */
107
+ staked?: StakedEvent;
108
+ }
109
+ interface WithdrawnStakeEvent {
110
+ user: string;
111
+ tokenId: BigNumber;
112
+ tokenOut: BigNumber;
113
+ }
114
+ interface WithdrawnStakeResult extends Result {
115
+ /** Parsed WithdrawnStake event, if present */
116
+ withdrawnstake?: WithdrawnStakeEvent;
117
+ }
118
+ interface preLaunchReceipt {
119
+ tokenId: bigint;
120
+ receipt: {
121
+ account: string;
122
+ currency: number;
123
+ kind: number;
124
+ indexAtMint: BalanceView;
125
+ principal: BalanceView;
126
+ shares: BalanceView;
127
+ timestamp: string;
128
+ };
129
+ }
130
+
131
+ type types$1_AddressBook = AddressBook;
132
+ declare const types$1_CONTRACT_NAMES: typeof CONTRACT_NAMES;
133
+ type types$1_ContractName = ContractName;
134
+ type types$1_DepositEvent = DepositEvent;
135
+ type types$1_DepositResult = DepositResult;
136
+ type types$1_StakedEvent = StakedEvent;
137
+ type types$1_StakedResult = StakedResult;
138
+ type types$1_WithdrawRequestedEvent = WithdrawRequestedEvent;
139
+ type types$1_WithdrawResult = WithdrawResult;
140
+ type types$1_WithdrawnStakeEvent = WithdrawnStakeEvent;
141
+ type types$1_WithdrawnStakeResult = WithdrawnStakeResult;
142
+ type types$1_preLaunchReceipt = preLaunchReceipt;
143
+ declare namespace types$1 {
144
+ export { types$1_CONTRACT_NAMES as CONTRACT_NAMES };
145
+ export type { types$1_AddressBook as AddressBook, types$1_ContractName as ContractName, types$1_DepositEvent as DepositEvent, types$1_DepositResult as DepositResult, types$1_StakedEvent as StakedEvent, types$1_StakedResult as StakedResult, types$1_WithdrawRequestedEvent as WithdrawRequestedEvent, types$1_WithdrawResult as WithdrawResult, types$1_WithdrawnStakeEvent as WithdrawnStakeEvent, types$1_WithdrawnStakeResult as WithdrawnStakeResult, types$1_preLaunchReceipt as preLaunchReceipt };
146
+ }
147
+
70
148
  declare class EthereumStakingClient implements IStakingClient {
71
149
  private config;
72
150
  readonly pubKey: PublicKey;
73
151
  private readonly provider;
74
152
  private readonly signer;
75
153
  private readonly contractService;
154
+ private depositClient;
155
+ private stakeClient;
76
156
  get contract(): {
77
157
  Accounting: ethers.Contract;
78
158
  DepositManager: ethers.Contract;
79
159
  LiqEth: ethers.Contract;
80
- LiqEthBurn: ethers.Contract;
81
- LiqEthMint: ethers.Contract;
82
160
  StakingModule: ethers.Contract;
83
161
  WithdrawalQueue: ethers.Contract;
84
162
  WithdrawalVault: ethers.Contract;
163
+ Depositor: ethers.Contract;
164
+ ReceiptNFT: ethers.Contract;
165
+ OutpostManager: ethers.Contract;
166
+ BAR: ethers.Contract;
167
+ OPP: ethers.Contract;
168
+ OPPCommon: ethers.Contract;
169
+ OPPInbound: ethers.Contract;
170
+ Warrant: ethers.Contract;
85
171
  };
86
172
  get network(): _wireio_core.ExternalNetwork;
87
173
  constructor(config: StakerConfig);
@@ -92,9 +178,12 @@ declare class EthereumStakingClient implements IStakingClient {
92
178
  * @returns transaction hash
93
179
  */
94
180
  deposit(amount: number | string | bigint | BigNumber): Promise<string>;
95
- withdraw(): Promise<string>;
96
- stake(): Promise<string>;
181
+ withdraw(amount: number | string | bigint | BigNumber): Promise<string>;
182
+ stake(amount: bigint): Promise<string>;
97
183
  unstake(): Promise<string>;
184
+ unstakePrelaunch(tokenId: bigint, recipient: string): Promise<string>;
185
+ fetchPrelaunchReceipts(address?: string): Promise<preLaunchReceipt[]>;
186
+ getEthStats(): Promise<any>;
98
187
  /**
99
188
  * Resolve the user's ETH + liqETH balances.
100
189
  *
@@ -103,42 +192,7 @@ declare class EthereumStakingClient implements IStakingClient {
103
192
  * tracked = liqETH tracked balance (protocol/accounting view)
104
193
  */
105
194
  getPortfolio(): Promise<Portfolio>;
106
- /**
107
- * Simulate a deposit via callStatic.
108
- *
109
- * Useful for pre-flight checks; will throw with the same revert
110
- * reason as a real tx if it would fail.
111
- */
112
- simulateDeposit(amount: number | string | bigint | BigNumber): Promise<void>;
113
- private performDeposit;
114
- }
115
-
116
- declare const CONTRACT_NAMES: readonly ["Accounting", "DepositManager", "LiqEth", "LiqEthBurn", "LiqEthMint", "StakingModule", "WithdrawalQueue", "WithdrawalVault"];
117
- type ContractName = typeof CONTRACT_NAMES[number];
118
- type AddressBook = Record<ContractName, string>;
119
- interface DepositEvent {
120
- user: string;
121
- netEth: BigNumber;
122
- fee: BigNumber;
123
- shares: BigNumber;
124
- }
125
- interface DepositResult {
126
- /** EVM transaction hash */
127
- txHash: string;
128
- /** Full receipt, if you want it */
129
- receipt: ethers.providers.TransactionReceipt;
130
- /** Parsed Deposited event, if present */
131
- deposited?: DepositEvent;
132
- }
133
-
134
- type types$1_AddressBook = AddressBook;
135
- declare const types$1_CONTRACT_NAMES: typeof CONTRACT_NAMES;
136
- type types$1_ContractName = ContractName;
137
- type types$1_DepositEvent = DepositEvent;
138
- type types$1_DepositResult = DepositResult;
139
- declare namespace types$1 {
140
- export { types$1_CONTRACT_NAMES as CONTRACT_NAMES };
141
- export type { types$1_AddressBook as AddressBook, types$1_ContractName as ContractName, types$1_DepositEvent as DepositEvent, types$1_DepositResult as DepositResult };
195
+ private requestWithdraw;
142
196
  }
143
197
 
144
198
  declare const ERC20Abi: ({