@wireio/stake 0.2.4 → 0.2.5
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 +1678 -414
- package/lib/stake.browser.js.map +1 -1
- package/lib/stake.d.ts +49 -9
- package/lib/stake.js +1821 -497
- package/lib/stake.js.map +1 -1
- package/lib/stake.m.js +1678 -414
- package/lib/stake.m.js.map +1 -1
- package/package.json +1 -1
- package/src/assets/ethereum/ABI/outpost/Aggregator.sol/Aggregator.json +82 -0
- package/src/networks/ethereum/clients/deposit.client.ts +76 -2
- package/src/networks/ethereum/clients/pretoken.client.ts +130 -0
- package/src/networks/ethereum/clients/stake.client.ts +87 -24
- package/src/networks/ethereum/contract.ts +13 -0
- package/src/networks/ethereum/ethereum.ts +234 -88
- package/src/networks/ethereum/types.ts +2 -0
- package/src/networks/ethereum/utils.ts +314 -0
- package/src/staker/types.ts +62 -0
- package/src/types.ts +14 -1
package/lib/stake.d.ts
CHANGED
|
@@ -74,6 +74,18 @@ interface TrancheLadderItem {
|
|
|
74
74
|
/** Price for this tranche in USD (1e8 scale) */
|
|
75
75
|
priceUsd: bigint;
|
|
76
76
|
}
|
|
77
|
+
interface TrancheLadderItem {
|
|
78
|
+
/** On-chain tranche id, 0-based (0,1,2,...) */
|
|
79
|
+
id: number;
|
|
80
|
+
/** Total capacity for this tranche (pretokens, 1e8 scale) */
|
|
81
|
+
capacity: bigint;
|
|
82
|
+
/** Sold amount in this tranche (1e8 scale) */
|
|
83
|
+
sold: bigint;
|
|
84
|
+
/** Remaining = capacity - sold (1e8 scale) */
|
|
85
|
+
remaining: bigint;
|
|
86
|
+
/** Price for this tranche in USD (1e8 scale) */
|
|
87
|
+
priceUsd: bigint;
|
|
88
|
+
}
|
|
77
89
|
/**
|
|
78
90
|
* Unified pretoken/tranche snapshot for any chain.
|
|
79
91
|
* ETH / other chains just fill the same shape from their own contracts.
|
|
@@ -108,7 +120,6 @@ interface TrancheSnapshot {
|
|
|
108
120
|
*/
|
|
109
121
|
ladder: TrancheLadderItem[];
|
|
110
122
|
}
|
|
111
|
-
/** Purchase asset selection used by staking client(s) */
|
|
112
123
|
declare enum PurchaseAsset {
|
|
113
124
|
SOL = "SOL",
|
|
114
125
|
LIQSOL = "LIQSOL",
|
|
@@ -147,7 +158,7 @@ declare class Staker {
|
|
|
147
158
|
setChain(chainID: ChainID): boolean;
|
|
148
159
|
}
|
|
149
160
|
|
|
150
|
-
declare const CONTRACT_NAMES: readonly ["Accounting", "DepositManager", "LiqEth", "StakingModule", "WithdrawalQueue", "WithdrawalVault", "Depositor", "ReceiptNFT", "OutpostManager", "BAR", "OPP", "OPPCommon", "OPPInbound", "Warrant"];
|
|
161
|
+
declare const CONTRACT_NAMES: readonly ["Accounting", "DepositManager", "LiqEth", "StakingModule", "WithdrawalQueue", "WithdrawalVault", "Depositor", "ReceiptNFT", "OutpostManager", "BAR", "OPP", "OPPCommon", "OPPInbound", "Warrant", "Aggregator", "EthUsdPriceConsumer"];
|
|
151
162
|
type ContractName = typeof CONTRACT_NAMES[number];
|
|
152
163
|
type AddressBook = Record<ContractName, string>;
|
|
153
164
|
interface Result {
|
|
@@ -233,6 +244,7 @@ declare class EthereumStakingClient implements IStakingClient {
|
|
|
233
244
|
private readonly contractService;
|
|
234
245
|
private depositClient;
|
|
235
246
|
private stakeClient;
|
|
247
|
+
private pretokenClient;
|
|
236
248
|
get contract(): {
|
|
237
249
|
Accounting: ethers.Contract;
|
|
238
250
|
DepositManager: ethers.Contract;
|
|
@@ -248,6 +260,8 @@ declare class EthereumStakingClient implements IStakingClient {
|
|
|
248
260
|
OPPCommon: ethers.Contract;
|
|
249
261
|
OPPInbound: ethers.Contract;
|
|
250
262
|
Warrant: ethers.Contract;
|
|
263
|
+
Aggregator: ethers.Contract;
|
|
264
|
+
EthUsdPriceConsumer: ethers.Contract;
|
|
251
265
|
};
|
|
252
266
|
get network(): _wireio_core.ExternalNetwork;
|
|
253
267
|
constructor(config: StakerConfig);
|
|
@@ -258,13 +272,37 @@ declare class EthereumStakingClient implements IStakingClient {
|
|
|
258
272
|
* @returns transaction hash
|
|
259
273
|
*/
|
|
260
274
|
deposit(amount: number | string | bigint | BigNumber): Promise<string>;
|
|
261
|
-
|
|
275
|
+
/**
|
|
276
|
+
* Withdraw native ETH from the liqETH protocol via DepositManager.
|
|
277
|
+
* @param amount Amount in wei (or something convertible to BigNumber).
|
|
278
|
+
* Keep this as a bigint / string in the caller; avoid JS floats.
|
|
279
|
+
* @returns transaction hash
|
|
280
|
+
*/
|
|
281
|
+
withdraw(amount: bigint): Promise<string>;
|
|
282
|
+
/**
|
|
283
|
+
* Stake liqETH via DepositManager.
|
|
284
|
+
* @param amount Amount in wei
|
|
285
|
+
* Keep this as a bigint / string in the caller; avoid JS floats.
|
|
286
|
+
* @returns transaction hash
|
|
287
|
+
*/
|
|
262
288
|
stake(amount: bigint): Promise<string>;
|
|
263
289
|
unstake(): Promise<string>;
|
|
290
|
+
/**
|
|
291
|
+
* ETH Prelaunch function to unstake liqEth
|
|
292
|
+
* @param tokenId ReceiptNFT tokenId for the owned NFT that will be burned
|
|
293
|
+
* @param recipient Address to receive the liqEth funds linked to the burned NFT
|
|
294
|
+
* @returns the transaction hash
|
|
295
|
+
*/
|
|
264
296
|
unstakePrelaunch(tokenId: bigint, recipient: string): Promise<string>;
|
|
297
|
+
buy(amount: bigint): Promise<string>;
|
|
298
|
+
getOPPStatus(): Promise<any>;
|
|
299
|
+
/**
|
|
300
|
+
* ETH Prelaunch function to list the ReceiptNFTs owned by a specific user
|
|
301
|
+
* @param address address to query the receipts for
|
|
302
|
+
* @returns array of receipts
|
|
303
|
+
*/
|
|
265
304
|
fetchPrelaunchReceipts(address?: string): Promise<preLaunchReceipt[]>;
|
|
266
305
|
getEthStats(): Promise<any>;
|
|
267
|
-
buy(amount: bigint, purchaseAsset: PurchaseAsset): Promise<string>;
|
|
268
306
|
getBuyQuote(amount: bigint, purchaseAsset: PurchaseAsset): Promise<PurchaseQuote>;
|
|
269
307
|
/**
|
|
270
308
|
* Resolve the user's ETH + liqETH balances.
|
|
@@ -275,12 +313,14 @@ declare class EthereumStakingClient implements IStakingClient {
|
|
|
275
313
|
*/
|
|
276
314
|
getPortfolio(): Promise<Portfolio>;
|
|
277
315
|
/**
|
|
278
|
-
* Program-level prelaunch WIRE / tranche snapshot for
|
|
279
|
-
* Uses the same OutpostWireStateSnapshot primitive as getPortfolio().
|
|
280
|
-
* TODO! for eth
|
|
316
|
+
* Program-level prelaunch WIRE / tranche snapshot for Ethereum
|
|
281
317
|
*/
|
|
282
|
-
getTrancheSnapshot(
|
|
283
|
-
|
|
318
|
+
getTrancheSnapshot(options?: {
|
|
319
|
+
chainID?: ChainID;
|
|
320
|
+
windowBefore?: number;
|
|
321
|
+
windowAfter?: number;
|
|
322
|
+
}): Promise<TrancheSnapshot>;
|
|
323
|
+
private updateMockAggregatorPrice;
|
|
284
324
|
}
|
|
285
325
|
|
|
286
326
|
declare const ERC20Abi: ({
|