@wireio/stake 0.9.0 → 0.9.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.
- package/lib/stake.browser.js +341 -32
- package/lib/stake.browser.js.map +1 -1
- package/lib/stake.d.ts +93 -10
- package/lib/stake.js +386 -30
- package/lib/stake.js.map +1 -1
- package/lib/stake.m.js +341 -32
- package/lib/stake.m.js.map +1 -1
- package/package.json +4 -3
- package/src/networks/ethereum/clients/convert.client.ts +29 -1
- package/src/networks/ethereum/clients/receipt.client.ts +81 -3
- package/src/networks/ethereum/clients/stake.client.ts +1 -0
- package/src/networks/ethereum/ethereum.ts +33 -11
- package/src/networks/ethereum/types.ts +15 -0
- package/src/networks/solana/clients/deposit.client.ts +260 -9
- package/src/networks/solana/clients/distribution.client.ts +1 -1
- package/src/networks/solana/clients/outpost.client.ts +1 -1
- package/src/networks/solana/solana.ts +184 -26
- package/src/networks/solana/types.ts +4 -4
- package/src/staker.ts +2 -2
- package/src/types.ts +8 -0
package/lib/stake.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import * as _wireio_core from '@wireio/core';
|
|
|
2
2
|
import { ExternalNetwork, PublicKey, 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
|
-
import { PublicKey as PublicKey$1, Transaction, VersionedTransaction, TokenAmount, Connection,
|
|
5
|
+
import { PublicKey as PublicKey$1, Transaction, VersionedTransaction, TokenAmount, Connection, TransactionInstruction, Keypair, TransactionSignature } from '@solana/web3.js';
|
|
6
6
|
import { ethers, BigNumber, Signer, Contract } from 'ethers';
|
|
7
7
|
import { JsonFragment } from '@ethersproject/abi';
|
|
8
8
|
import { ErrorDescription } from '@ethersproject/abi/lib/interface';
|
|
@@ -12,6 +12,13 @@ type StakerConfig = {
|
|
|
12
12
|
network: ExternalNetwork;
|
|
13
13
|
provider?: BaseSignerWalletAdapter | ethers.providers.Web3Provider;
|
|
14
14
|
pubKey?: PublicKey;
|
|
15
|
+
extras?: {
|
|
16
|
+
squadsX?: SquadsXConfig;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
type SquadsXConfig = {
|
|
20
|
+
multisigPDA: string;
|
|
21
|
+
vaultIndex?: number;
|
|
15
22
|
};
|
|
16
23
|
interface IStakingClient {
|
|
17
24
|
pubKey?: PublicKey;
|
|
@@ -326,15 +333,29 @@ interface preLaunchReceipt {
|
|
|
326
333
|
timestamp: string;
|
|
327
334
|
};
|
|
328
335
|
}
|
|
336
|
+
interface ClaimedEvent {
|
|
337
|
+
sender: string;
|
|
338
|
+
ethAmount: BigNumber;
|
|
339
|
+
}
|
|
340
|
+
interface WithdrawReceipt {
|
|
341
|
+
tokenId: bigint;
|
|
342
|
+
receipt: {
|
|
343
|
+
ethAmount: BigNumber;
|
|
344
|
+
ethBalance: BalanceView;
|
|
345
|
+
readyAt: number;
|
|
346
|
+
};
|
|
347
|
+
}
|
|
329
348
|
|
|
330
349
|
type types$1_AddressBook = AddressBook;
|
|
331
350
|
declare const types$1_CONTRACT_NAMES: typeof CONTRACT_NAMES;
|
|
351
|
+
type types$1_ClaimedEvent = ClaimedEvent;
|
|
332
352
|
type types$1_ContractName = ContractName;
|
|
333
353
|
type types$1_DepositEvent = DepositEvent;
|
|
334
354
|
type types$1_DepositResult = DepositResult;
|
|
335
355
|
type types$1_SharesBurnedEvent = SharesBurnedEvent;
|
|
336
356
|
type types$1_StakedEvent = StakedEvent;
|
|
337
357
|
type types$1_StakedResult = StakedResult;
|
|
358
|
+
type types$1_WithdrawReceipt = WithdrawReceipt;
|
|
338
359
|
type types$1_WithdrawRequestedEvent = WithdrawRequestedEvent;
|
|
339
360
|
type types$1_WithdrawResult = WithdrawResult;
|
|
340
361
|
type types$1_WithdrawnStakeEvent = WithdrawnStakeEvent;
|
|
@@ -342,7 +363,7 @@ type types$1_WithdrawnStakeResult = WithdrawnStakeResult;
|
|
|
342
363
|
type types$1_preLaunchReceipt = preLaunchReceipt;
|
|
343
364
|
declare namespace types$1 {
|
|
344
365
|
export { types$1_CONTRACT_NAMES as CONTRACT_NAMES };
|
|
345
|
-
export type { types$1_AddressBook as AddressBook, types$1_ContractName as ContractName, types$1_DepositEvent as DepositEvent, types$1_DepositResult as DepositResult, types$1_SharesBurnedEvent as SharesBurnedEvent, 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 };
|
|
366
|
+
export type { types$1_AddressBook as AddressBook, types$1_ClaimedEvent as ClaimedEvent, types$1_ContractName as ContractName, types$1_DepositEvent as DepositEvent, types$1_DepositResult as DepositResult, types$1_SharesBurnedEvent as SharesBurnedEvent, types$1_StakedEvent as StakedEvent, types$1_StakedResult as StakedResult, types$1_WithdrawReceipt as WithdrawReceipt, 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 };
|
|
346
367
|
}
|
|
347
368
|
|
|
348
369
|
declare const INITIAL_TRANCHE_SUPPLY = 35000;
|
|
@@ -399,6 +420,18 @@ declare class EthereumStakingClient implements IStakingClient {
|
|
|
399
420
|
* @returns transaction hash
|
|
400
421
|
*/
|
|
401
422
|
withdraw(amount: bigint): Promise<string>;
|
|
423
|
+
/**
|
|
424
|
+
* Withdraw native ETH from the liqETH protocol via the liqeth safeBurn function, which burns the LiqETH and adds the user to the withdrawal queue.
|
|
425
|
+
* @param amount Amount in wei (or something convertible to BigNumber).
|
|
426
|
+
* @returns transaction hash
|
|
427
|
+
*/
|
|
428
|
+
loadPendingWithdraws(): Promise<WithdrawReceipt[]>;
|
|
429
|
+
/**
|
|
430
|
+
* Withdraw native ETH from the liqETH protocol via the liqeth safeBurn function, which burns the LiqETH and adds the user to the withdrawal queue.
|
|
431
|
+
* @param amount Amount in wei (or something convertible to BigNumber).
|
|
432
|
+
* @returns transaction hash
|
|
433
|
+
*/
|
|
434
|
+
claimWithdraw(tokenId: bigint): Promise<string>;
|
|
402
435
|
/**
|
|
403
436
|
* Stake liqETH via DepositManager.
|
|
404
437
|
* @param amount Amount in wei - Keep this as a bigint / string in the caller; avoid JS floats.
|
|
@@ -864,7 +897,7 @@ type GlobalState = {
|
|
|
864
897
|
*/
|
|
865
898
|
roleWarmupDuration: BN;
|
|
866
899
|
/** Wire lifecycle state (preLaunch / postLaunch / refund) */
|
|
867
|
-
wireState: WireState;
|
|
900
|
+
wireState: WireState | any;
|
|
868
901
|
/** PDA bump */
|
|
869
902
|
bump: number;
|
|
870
903
|
};
|
|
@@ -1143,7 +1176,7 @@ type LeaderboardState = {
|
|
|
1143
1176
|
* Per-validator scores (i64 on-chain).
|
|
1144
1177
|
* Index corresponds to `registryIndex` in ValidatorRecord.
|
|
1145
1178
|
*/
|
|
1146
|
-
scores:
|
|
1179
|
+
scores: number[];
|
|
1147
1180
|
/**
|
|
1148
1181
|
* Sorted indices into `scores[]` / `voteAccounts[]`,
|
|
1149
1182
|
* typically highest score first.
|
|
@@ -1154,7 +1187,9 @@ type LeaderboardState = {
|
|
|
1154
1187
|
* `voteAccounts[i]` is the vote account for validator with
|
|
1155
1188
|
* `registryIndex == i`.
|
|
1156
1189
|
*/
|
|
1157
|
-
voteAccounts:
|
|
1190
|
+
voteAccounts: {
|
|
1191
|
+
bytes: number[];
|
|
1192
|
+
}[];
|
|
1158
1193
|
/**
|
|
1159
1194
|
* Number of active validators currently tracked in the leaderboard.
|
|
1160
1195
|
* Only the first `numValidators` entries of the arrays are meaningful.
|
|
@@ -1166,7 +1201,7 @@ type LeaderboardState = {
|
|
|
1166
1201
|
* Reserved padding / future-proofing on-chain (u64[8]).
|
|
1167
1202
|
* Not used by client logic, but surfaced for completeness.
|
|
1168
1203
|
*/
|
|
1169
|
-
padding:
|
|
1204
|
+
padding: number[];
|
|
1170
1205
|
};
|
|
1171
1206
|
/**
|
|
1172
1207
|
* Per-validator record tying Solana vote account to
|
|
@@ -1269,13 +1304,36 @@ declare namespace types {
|
|
|
1269
1304
|
declare class DepositClient {
|
|
1270
1305
|
private provider;
|
|
1271
1306
|
private program;
|
|
1307
|
+
get connection(): Connection;
|
|
1272
1308
|
get wallet(): WalletLike;
|
|
1273
1309
|
constructor(provider: AnchorProvider);
|
|
1274
1310
|
/**
|
|
1275
1311
|
* Build a deposit transaction:
|
|
1276
1312
|
* SOL -> liqSOL via liqsol_core::deposit.
|
|
1277
1313
|
*/
|
|
1278
|
-
buildDepositTx(amount: bigint, user?:
|
|
1314
|
+
buildDepositTx(amount: bigint, user?: PublicKey$1): Promise<TransactionInstruction>;
|
|
1315
|
+
buildSquadsDepositProposalTx(params: {
|
|
1316
|
+
connection: Connection;
|
|
1317
|
+
multisigPda: PublicKey$1;
|
|
1318
|
+
amountLamports: bigint;
|
|
1319
|
+
wallet: WalletLikeSigner;
|
|
1320
|
+
vaultIndex?: number;
|
|
1321
|
+
}): Promise<{
|
|
1322
|
+
tx: Transaction;
|
|
1323
|
+
transactionIndex: bigint;
|
|
1324
|
+
vaultPda: PublicKey$1;
|
|
1325
|
+
}>;
|
|
1326
|
+
buildSquadsDepositProposalTx2(params: {
|
|
1327
|
+
connection: Connection;
|
|
1328
|
+
multisigPda: PublicKey$1;
|
|
1329
|
+
amountLamports: bigint;
|
|
1330
|
+
wallet: WalletLikeSigner;
|
|
1331
|
+
vaultIndex?: number;
|
|
1332
|
+
}): Promise<{
|
|
1333
|
+
tx: Transaction;
|
|
1334
|
+
transactionIndex: bigint;
|
|
1335
|
+
vaultPda: PublicKey$1;
|
|
1336
|
+
}>;
|
|
1279
1337
|
/**
|
|
1280
1338
|
* Build a withdraw-request transaction:
|
|
1281
1339
|
* liqSOL -> SOL via liqsol_core::requestWithdraw.
|
|
@@ -1285,8 +1343,18 @@ declare class DepositClient {
|
|
|
1285
1343
|
* - increments totalEncumberedFunds in global state
|
|
1286
1344
|
* - mints an NFT receipt (liqReceiptData + NFT ATA for owner)
|
|
1287
1345
|
*/
|
|
1288
|
-
buildWithdrawTx(amount: bigint, user?:
|
|
1346
|
+
buildWithdrawTx(amount: bigint, user?: PublicKey$1): Promise<Transaction>;
|
|
1347
|
+
/**
|
|
1348
|
+
* Internal helper: build the liqsol_core::deposit instruction for a specific `user`.
|
|
1349
|
+
* This is the exact same account wiring as buildDepositTx(), but returns the IX
|
|
1350
|
+
* plus useful derived addresses/seed for Squads flows.
|
|
1351
|
+
*/
|
|
1352
|
+
private buildDepositIxForUser;
|
|
1289
1353
|
}
|
|
1354
|
+
type WalletLikeSigner = {
|
|
1355
|
+
publicKey: PublicKey$1;
|
|
1356
|
+
signTransaction: (tx: Transaction) => Promise<Transaction>;
|
|
1357
|
+
};
|
|
1290
1358
|
|
|
1291
1359
|
/**
|
|
1292
1360
|
* Distribution client – wraps the distribution portion of the liqsol_core
|
|
@@ -8627,7 +8695,7 @@ declare class SolanaProgramService {
|
|
|
8627
8695
|
listProgramNames(): SolanaProgramName[];
|
|
8628
8696
|
}
|
|
8629
8697
|
|
|
8630
|
-
declare const SCALE:
|
|
8698
|
+
declare const SCALE: BN;
|
|
8631
8699
|
/**
|
|
8632
8700
|
* Solana implementation of IStakingClient.
|
|
8633
8701
|
*
|
|
@@ -8650,9 +8718,22 @@ declare class SolanaStakingClient implements IStakingClient {
|
|
|
8650
8718
|
outpostClient: OutpostClient;
|
|
8651
8719
|
tokenClient: TokenClient;
|
|
8652
8720
|
program: SolanaProgramService;
|
|
8721
|
+
private smartAccount?;
|
|
8722
|
+
private signer?;
|
|
8653
8723
|
get solPubKey(): PublicKey$1;
|
|
8654
8724
|
get network(): ExternalNetwork;
|
|
8725
|
+
get feePayer(): PublicKey$1;
|
|
8726
|
+
get squadsX(): SquadsXConfig | null;
|
|
8655
8727
|
constructor(config: StakerConfig);
|
|
8728
|
+
createVaultLiqsolAtaOneShot(params: {
|
|
8729
|
+
connection: Connection;
|
|
8730
|
+
payer: PublicKey$1;
|
|
8731
|
+
vaultPda: PublicKey$1;
|
|
8732
|
+
}): Promise<{
|
|
8733
|
+
tx: Transaction;
|
|
8734
|
+
vaultAta: PublicKey$1;
|
|
8735
|
+
} | null>;
|
|
8736
|
+
private prepSquadsIxs;
|
|
8656
8737
|
/**
|
|
8657
8738
|
* Deposit native SOL into liqSOL (liqsol_core::deposit).
|
|
8658
8739
|
* Handles tx build, sign, send, and confirmation.
|
|
@@ -8699,6 +8780,8 @@ declare class SolanaStakingClient implements IStakingClient {
|
|
|
8699
8780
|
* Used by balance-correction flows and debugging.
|
|
8700
8781
|
*/
|
|
8701
8782
|
getUserRecord(): Promise<DistributionUserRecord | null>;
|
|
8783
|
+
get squadsMultisigPDA(): PublicKey$1 | null;
|
|
8784
|
+
get squadsVaultPDA(): PublicKey$1 | null;
|
|
8702
8785
|
/**
|
|
8703
8786
|
* Unified, chain-agnostic tranche snapshot for Solana.
|
|
8704
8787
|
*
|
|
@@ -8951,4 +9034,4 @@ declare const lamportsToSol: (lamports: number | bigint) => number;
|
|
|
8951
9034
|
declare const solToLamports: (sol: number) => bigint;
|
|
8952
9035
|
|
|
8953
9036
|
export { ADDRESSES, CHAINLINK_FEED, CHAINLINK_PROGRAM, CONTRACTS, DEFAULT_AVERAGE_PAY_RATE, DEFAULT_PAY_RATE_LOOKBACK, DepositClient, DistributionClient, EPHEMERAL_RENT_EXEMPTION, ERC1155Abi, ERC20Abi, ERC721Abi, types$1 as ETH, EthereumContractService, EthereumStakingClient, INDEX_SCALE, INITIAL_TRANCHE_SUPPLY, LAMPORTS_PER_SOL, LIQSOL_CORE, LIQSOL_TOKEN, LeaderboardClient, OutpostClient, PAY_RATE_SCALE_FACTOR, PDA_SEEDS, PROGRAM_IDS, PurchaseAsset, ReceiptNFTKind, SCALE, types as SOL, SolanaStakingClient, Staker, TRANSFER_HOOK, TokenClient, VALIDATOR_LEADERBOARD, airdropSol, buildOutpostAccounts, buildSolanaTrancheLadder, buildSolanaTrancheSnapshot, calculateExpectedFee, ceilDiv, deriveBarConfigPda, deriveBondLevelPda, deriveBondedActorPda, deriveBucketAuthorityPda, deriveDepositAuthorityPda, deriveDistributionStatePda, deriveEphemeralStakeAddress, deriveExtraAccountMetaListPda, deriveGlobalConfigPda, deriveLeaderboardStatePda, deriveLiqReceiptDataPda, deriveLiqsolMintAuthorityPda, deriveLiqsolMintPda, deriveMaintenanceLedgerPda, deriveOutpostAccountPda, deriveOutpostGlobalStatePda, deriveOutpostPoolAuthorityPda, derivePayRateHistoryPda, derivePayoutStatePda, derivePriceHistoryPda, deriveReservePoolPda, deriveStakeAllocationStatePda, deriveStakeControllerStatePda, deriveStakeControllerVaultPda, deriveStakeMetricsPda, deriveTrancheStatePda, deriveUserPretokenRecordPda, deriveUserRecordPda, deriveValidatorRecordPda, deriveVaultPda, deriveWithdrawGlobalPda, deriveWithdrawMintAuthorityPda, deriveWithdrawMintMetadataPda, deriveWithdrawNftMintPda, generateRandomDepositAmount, generateTestKeypair, getAveragePayRate, getBucketLiqSolBalance, getEpochSnapshot, getErrorMessage, getLiqsolCoreProgram, getPayoutStateRaw, getReservePoolBalance, getStakeControllerStateRaw, getUserLiqSolBalance, getUserRecordRaw, lamportsToSol, msToEpochEnd, previewDepositEffects, scheduledInstruction, sleep, solToLamports, toBigint, tokensToShares, waitForConfirmation, waitUntilSafeToExecuteFunction };
|
|
8954
|
-
export type { BalanceView, ContractConfig, ContractOptions, Contracts, EpochSnapshot, IStakingClient, OPPAssertion, OutpostAccounts, Portfolio, PurchaseQuote, ScheduleConfig, StakerConfig, TrancheLadderItem, TrancheSnapshot, YieldView };
|
|
9037
|
+
export type { BalanceView, ContractConfig, ContractOptions, Contracts, EpochSnapshot, IStakingClient, OPPAssertion, OutpostAccounts, Portfolio, PurchaseQuote, ScheduleConfig, SquadsXConfig, StakerConfig, TrancheLadderItem, TrancheSnapshot, YieldView };
|