@wireio/stake 0.5.2 → 0.7.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 +284 -283
- package/lib/stake.browser.js.map +1 -1
- package/lib/stake.d.ts +37 -36
- package/lib/stake.js +287 -286
- package/lib/stake.js.map +1 -1
- package/lib/stake.m.js +284 -283
- package/lib/stake.m.js.map +1 -1
- package/package.json +1 -1
- package/src/assets/ethereum/ABI/liqEth/liqEth.sol/LiqEthToken.dbg.json +1 -1
- package/src/assets/ethereum/ABI/liqEth/liqEth.sol/LiqEthToken.json +33 -2
- package/src/assets/ethereum/ABI/outpost/BAR.sol/BAR.dbg.json +1 -1
- package/src/assets/ethereum/ABI/outpost/BAR.sol/BAR.json +2 -18
- package/src/assets/ethereum/ABI/outpost/Depositor.sol/Depositor.dbg.json +1 -1
- package/src/assets/ethereum/ABI/outpost/Depositor.sol/Depositor.json +26 -42
- package/src/assets/ethereum/ABI/outpost/EthUsdPriceConsumer.sol/AggregatorV3Interface.dbg.json +1 -1
- package/src/assets/ethereum/ABI/outpost/EthUsdPriceConsumer.sol/EthUsdPriceConsumer.dbg.json +1 -1
- package/src/assets/ethereum/ABI/outpost/EthUsdPriceConsumer.sol/EthUsdPriceConsumer.json +2 -31
- package/src/assets/ethereum/ABI/outpost/OutpostErrors.sol/OutpostErrors.dbg.json +1 -1
- package/src/assets/ethereum/ABI/outpost/OutpostErrors.sol/OutpostErrors.json +2 -18
- package/src/assets/ethereum/ABI/outpost/Pool.sol/Pool.dbg.json +1 -1
- package/src/assets/ethereum/ABI/outpost/Pool.sol/Pool.json +2 -18
- package/src/assets/ethereum/ABI/outpost/Pretoken.sol/Pretoken.dbg.json +1 -1
- package/src/assets/ethereum/ABI/outpost/Pretoken.sol/Pretoken.json +2 -18
- package/src/assets/ethereum/ABI/outpost/ReceiptNFT.sol/ReceiptNFT.dbg.json +1 -1
- package/src/assets/ethereum/ABI/outpost/ReceiptNFT.sol/ReceiptNFT.json +2 -18
- package/src/assets/ethereum/ABI/token/ERC1155Token.sol/ERC1155Token.dbg.json +1 -1
- package/src/assets/ethereum/ABI/token/ERC1155Token.sol/ERC1155Token.json +2 -2
- package/src/assets/ethereum/ABI/token/ERC20Token.sol/ERC20Token.dbg.json +1 -1
- package/src/assets/ethereum/ABI/token/ERC20Token.sol/ERC20Token.json +2 -2
- package/src/assets/ethereum/ABI/token/ERC721Token.sol/ERC721Token.dbg.json +1 -1
- package/src/assets/ethereum/ABI/token/ERC721Token.sol/ERC721Token.json +2 -2
- package/src/networks/ethereum/contract.ts +24 -24
- package/src/networks/ethereum/ethereum.ts +14 -8
- package/src/networks/ethereum/utils.ts +103 -71
- package/src/networks/solana/solana.ts +160 -97
- package/src/networks/solana/utils.ts +58 -30
- package/src/staker.ts +2 -0
- package/src/types.ts +12 -11
package/lib/stake.d.ts
CHANGED
|
@@ -25,12 +25,6 @@ interface IStakingClient {
|
|
|
25
25
|
/** Fetch the complete user portfolio */
|
|
26
26
|
getPortfolio(): Promise<Portfolio | null>;
|
|
27
27
|
getSystemAPY(): Promise<number>;
|
|
28
|
-
/**
|
|
29
|
-
* Protocol fee charged for deposit from Native to LIQ
|
|
30
|
-
* in Solana: amount in lamports
|
|
31
|
-
* in Ethereum: amount in wei
|
|
32
|
-
*/
|
|
33
|
-
getDepositFee(amount: bigint): Promise<bigint>;
|
|
34
28
|
/**
|
|
35
29
|
* Program-level prelaunch WIRE/tranche snapshot for this chain.
|
|
36
30
|
*
|
|
@@ -43,15 +37,22 @@ interface IStakingClient {
|
|
|
43
37
|
windowBefore?: number;
|
|
44
38
|
windowAfter?: number;
|
|
45
39
|
}): Promise<TrancheSnapshot | null>;
|
|
40
|
+
/**
|
|
41
|
+
* Protocol fee charged for deposit from Native to LIQ
|
|
42
|
+
* in Solana: amount in lamports
|
|
43
|
+
* in Ethereum: amount in wei
|
|
44
|
+
*/
|
|
45
|
+
getDepositFee(amount: bigint): Promise<bigint>;
|
|
46
46
|
/**
|
|
47
47
|
* Estimate a conservative ETH(wei) / SOL(lamports) buffer to leave in the wallet
|
|
48
48
|
* so the user can pay fees for the current deposit and at least one
|
|
49
49
|
* more transaction, plus a bit extra for future interactions.
|
|
50
50
|
*/
|
|
51
|
-
|
|
51
|
+
getDepositBuffer(options?: {
|
|
52
52
|
txCount?: number;
|
|
53
53
|
safetyMultiplier?: number;
|
|
54
|
-
|
|
54
|
+
minBufferLamports?: bigint;
|
|
55
|
+
balanceOverrideLamports?: bigint;
|
|
55
56
|
}): Promise<bigint>;
|
|
56
57
|
}
|
|
57
58
|
/**
|
|
@@ -455,10 +456,11 @@ declare class EthereumStakingClient implements IStakingClient {
|
|
|
455
456
|
* @param options.safetyMultiplier Additional safety multiplier on top of txCount (default 1.5x)
|
|
456
457
|
* @param options.minBufferWei Optional override minimum buffer (defaults ~0.002 ETH)
|
|
457
458
|
*/
|
|
458
|
-
|
|
459
|
+
getDepositBuffer(options?: {
|
|
459
460
|
txCount?: number;
|
|
460
461
|
safetyMultiplier?: number;
|
|
461
462
|
minBufferWei?: bigint;
|
|
463
|
+
balanceOverrideLamports?: bigint;
|
|
462
464
|
}): Promise<bigint>;
|
|
463
465
|
private updateMockAggregatorPrice;
|
|
464
466
|
}
|
|
@@ -9107,6 +9109,21 @@ declare class SolanaStakingClient implements IStakingClient {
|
|
|
9107
9109
|
* Used by balance-correction flows and debugging.
|
|
9108
9110
|
*/
|
|
9109
9111
|
getUserRecord(): Promise<DistributionUserRecord | null>;
|
|
9112
|
+
/**
|
|
9113
|
+
* Unified, chain-agnostic tranche snapshot for Solana.
|
|
9114
|
+
*
|
|
9115
|
+
* Uses:
|
|
9116
|
+
* - liqsol_core.globalState (currentIndex, totalShares, etc.)
|
|
9117
|
+
* - liqsol_core.trancheState (price, supply, total sold, etc.)
|
|
9118
|
+
* - PriceHistory/Chainlink SOL/USD via TokenClient.getSolPriceUsdSafe()
|
|
9119
|
+
*
|
|
9120
|
+
* This is READ-ONLY and works even with no connected wallet.
|
|
9121
|
+
*/
|
|
9122
|
+
getTrancheSnapshot(options?: {
|
|
9123
|
+
chainID?: ChainID;
|
|
9124
|
+
windowBefore?: number;
|
|
9125
|
+
windowAfter?: number;
|
|
9126
|
+
}): Promise<TrancheSnapshot>;
|
|
9110
9127
|
/**
|
|
9111
9128
|
* Returns the system APY (percent) for Solana,
|
|
9112
9129
|
* using compound interest per epoch and a
|
|
@@ -9141,39 +9158,23 @@ declare class SolanaStakingClient implements IStakingClient {
|
|
|
9141
9158
|
*/
|
|
9142
9159
|
getDepositFee(amountLamports: bigint, windowSize?: number): Promise<bigint>;
|
|
9143
9160
|
/**
|
|
9144
|
-
*
|
|
9145
|
-
*
|
|
9146
|
-
* Uses:
|
|
9147
|
-
* - liqsol_core.globalState (currentIndex, totalShares, etc.)
|
|
9148
|
-
* - liqsol_core.trancheState (price, supply, total sold, etc.)
|
|
9149
|
-
* - PriceHistory/Chainlink SOL/USD via TokenClient.getSolPriceUsdSafe()
|
|
9150
|
-
*
|
|
9151
|
-
* This is READ-ONLY and works even with no connected wallet.
|
|
9152
|
-
*/
|
|
9153
|
-
getTrancheSnapshot(options?: {
|
|
9154
|
-
chainID?: ChainID;
|
|
9155
|
-
windowBefore?: number;
|
|
9156
|
-
windowAfter?: number;
|
|
9157
|
-
}): Promise<TrancheSnapshot>;
|
|
9158
|
-
/**
|
|
9159
|
-
* Estimate a conservative SOL buffer (lamports) to leave in the wallet
|
|
9160
|
-
* so the user can pay fees for the current deposit and at least one
|
|
9161
|
-
* more transaction, plus a bit extra for future interactions.
|
|
9161
|
+
* Compute a conservative "deposit buffer" in lamports that should be left
|
|
9162
|
+
* in the wallet so that a MAX deposit (balance - buffer) will succeed.
|
|
9162
9163
|
*
|
|
9163
|
-
*
|
|
9164
|
-
*
|
|
9165
|
-
*
|
|
9166
|
-
* ? balanceLamports - bufferLamports
|
|
9167
|
-
* : 0n;
|
|
9164
|
+
* It accounts for:
|
|
9165
|
+
* - Runtime tx fees (via a dummy self-transfer)
|
|
9166
|
+
* - Protocol deposit fee (via getDepositFee(amount))
|
|
9168
9167
|
*
|
|
9169
|
-
*
|
|
9170
|
-
*
|
|
9171
|
-
*
|
|
9168
|
+
* Intended UI usage:
|
|
9169
|
+
* const buffer = await client.getDepositBuffer();
|
|
9170
|
+
* const balance = portfolio.native.amount;
|
|
9171
|
+
* const maxDeposit = balance > buffer ? balance - buffer : BigInt(0);
|
|
9172
9172
|
*/
|
|
9173
|
-
|
|
9173
|
+
getDepositBuffer(options?: {
|
|
9174
9174
|
txCount?: number;
|
|
9175
9175
|
safetyMultiplier?: number;
|
|
9176
9176
|
minBufferLamports?: bigint;
|
|
9177
|
+
balanceOverrideLamports?: bigint;
|
|
9177
9178
|
}): Promise<bigint>;
|
|
9178
9179
|
/**
|
|
9179
9180
|
* Send a signed transaction over HTTP RPC and wait for confirmation.
|