@ignitionfi/spl-stake-pool 1.1.8
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/LICENSE +176 -0
- package/dist/codecs.d.ts +15 -0
- package/dist/constants.d.ts +12 -0
- package/dist/index.browser.cjs.js +2570 -0
- package/dist/index.browser.cjs.js.map +1 -0
- package/dist/index.browser.esm.js +2524 -0
- package/dist/index.browser.esm.js.map +1 -0
- package/dist/index.cjs.js +2570 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +195 -0
- package/dist/index.esm.js +2524 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.iife.js +23755 -0
- package/dist/index.iife.js.map +1 -0
- package/dist/index.iife.min.js +19 -0
- package/dist/index.iife.min.js.map +1 -0
- package/dist/instructions.d.ts +329 -0
- package/dist/layouts.d.ts +318 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/instruction.d.ts +21 -0
- package/dist/utils/math.d.ts +3 -0
- package/dist/utils/program-address.d.ts +26 -0
- package/dist/utils/stake.d.ts +29 -0
- package/package.json +90 -0
- package/src/codecs.ts +159 -0
- package/src/constants.ts +29 -0
- package/src/index.ts +1522 -0
- package/src/instructions.ts +1293 -0
- package/src/layouts.ts +248 -0
- package/src/types/buffer-layout.d.ts +29 -0
- package/src/utils/index.ts +12 -0
- package/src/utils/instruction.ts +46 -0
- package/src/utils/math.ts +29 -0
- package/src/utils/program-address.ts +103 -0
- package/src/utils/stake.ts +230 -0
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
import * as BufferLayout from '@solana/buffer-layout';
|
|
2
|
+
import { PublicKey, TransactionInstruction } from '@solana/web3.js';
|
|
3
|
+
import { InstructionType } from './utils';
|
|
4
|
+
/**
|
|
5
|
+
* An enumeration of valid StakePoolInstructionType's
|
|
6
|
+
*/
|
|
7
|
+
export type StakePoolInstructionType = 'IncreaseValidatorStake' | 'DecreaseValidatorStake' | 'UpdateValidatorListBalance' | 'UpdateStakePoolBalance' | 'CleanupRemovedValidatorEntries' | 'DepositStake' | 'DepositSol' | 'WithdrawStake' | 'WithdrawSol' | 'IncreaseAdditionalValidatorStake' | 'DecreaseAdditionalValidatorStake' | 'DecreaseValidatorStakeWithReserve' | 'Redelegate' | 'AddValidatorToPool' | 'RemoveValidatorFromPool' | 'DepositWsolWithSession' | 'WithdrawWsolWithSession';
|
|
8
|
+
export declare function tokenMetadataLayout(instruction: number, nameLength: number, symbolLength: number, uriLength: number): {
|
|
9
|
+
index: number;
|
|
10
|
+
layout: BufferLayout.Structure<any>;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* An enumeration of valid stake InstructionType's
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
export declare const STAKE_POOL_INSTRUCTION_LAYOUTS: {
|
|
17
|
+
[type in StakePoolInstructionType]: InstructionType;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Cleans up validator stake account entries marked as `ReadyForRemoval`
|
|
21
|
+
*/
|
|
22
|
+
export type CleanupRemovedValidatorEntriesParams = {
|
|
23
|
+
programId?: PublicKey | undefined;
|
|
24
|
+
stakePool: PublicKey;
|
|
25
|
+
validatorList: PublicKey;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Updates balances of validator and transient stake accounts in the pool.
|
|
29
|
+
*/
|
|
30
|
+
export type UpdateValidatorListBalanceParams = {
|
|
31
|
+
programId?: PublicKey | undefined;
|
|
32
|
+
stakePool: PublicKey;
|
|
33
|
+
withdrawAuthority: PublicKey;
|
|
34
|
+
validatorList: PublicKey;
|
|
35
|
+
reserveStake: PublicKey;
|
|
36
|
+
validatorAndTransientStakePairs: PublicKey[];
|
|
37
|
+
startIndex: number;
|
|
38
|
+
noMerge: boolean;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Updates total pool balance based on balances in the reserve and validator list.
|
|
42
|
+
*/
|
|
43
|
+
export type UpdateStakePoolBalanceParams = {
|
|
44
|
+
programId?: PublicKey | undefined;
|
|
45
|
+
stakePool: PublicKey;
|
|
46
|
+
withdrawAuthority: PublicKey;
|
|
47
|
+
validatorList: PublicKey;
|
|
48
|
+
reserveStake: PublicKey;
|
|
49
|
+
managerFeeAccount: PublicKey;
|
|
50
|
+
poolMint: PublicKey;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* (Staker only) Decrease active stake on a validator, eventually moving it to the reserve
|
|
54
|
+
*/
|
|
55
|
+
export type DecreaseValidatorStakeParams = {
|
|
56
|
+
programId?: PublicKey | undefined;
|
|
57
|
+
stakePool: PublicKey;
|
|
58
|
+
staker: PublicKey;
|
|
59
|
+
withdrawAuthority: PublicKey;
|
|
60
|
+
validatorList: PublicKey;
|
|
61
|
+
validatorStake: PublicKey;
|
|
62
|
+
transientStake: PublicKey;
|
|
63
|
+
lamports: number;
|
|
64
|
+
transientStakeSeed: number;
|
|
65
|
+
};
|
|
66
|
+
export interface DecreaseValidatorStakeWithReserveParams extends DecreaseValidatorStakeParams {
|
|
67
|
+
reserveStake: PublicKey;
|
|
68
|
+
}
|
|
69
|
+
export interface DecreaseAdditionalValidatorStakeParams extends DecreaseValidatorStakeParams {
|
|
70
|
+
reserveStake: PublicKey;
|
|
71
|
+
ephemeralStake: PublicKey;
|
|
72
|
+
ephemeralStakeSeed: number;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* (Staker only) Increase stake on a validator from the reserve account.
|
|
76
|
+
*/
|
|
77
|
+
export type IncreaseValidatorStakeParams = {
|
|
78
|
+
programId?: PublicKey | undefined;
|
|
79
|
+
stakePool: PublicKey;
|
|
80
|
+
staker: PublicKey;
|
|
81
|
+
withdrawAuthority: PublicKey;
|
|
82
|
+
validatorList: PublicKey;
|
|
83
|
+
reserveStake: PublicKey;
|
|
84
|
+
transientStake: PublicKey;
|
|
85
|
+
validatorStake: PublicKey;
|
|
86
|
+
validatorVote: PublicKey;
|
|
87
|
+
lamports: number;
|
|
88
|
+
transientStakeSeed: number;
|
|
89
|
+
};
|
|
90
|
+
export interface IncreaseAdditionalValidatorStakeParams extends IncreaseValidatorStakeParams {
|
|
91
|
+
ephemeralStake: PublicKey;
|
|
92
|
+
ephemeralStakeSeed: number;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Deposits a stake account into the pool in exchange for pool tokens
|
|
96
|
+
*/
|
|
97
|
+
export type DepositStakeParams = {
|
|
98
|
+
programId?: PublicKey | undefined;
|
|
99
|
+
stakePool: PublicKey;
|
|
100
|
+
validatorList: PublicKey;
|
|
101
|
+
depositAuthority: PublicKey;
|
|
102
|
+
withdrawAuthority: PublicKey;
|
|
103
|
+
depositStake: PublicKey;
|
|
104
|
+
validatorStake: PublicKey;
|
|
105
|
+
reserveStake: PublicKey;
|
|
106
|
+
destinationPoolAccount: PublicKey;
|
|
107
|
+
managerFeeAccount: PublicKey;
|
|
108
|
+
referralPoolAccount: PublicKey;
|
|
109
|
+
poolMint: PublicKey;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Withdraws a stake account from the pool in exchange for pool tokens
|
|
113
|
+
*/
|
|
114
|
+
export type WithdrawStakeParams = {
|
|
115
|
+
programId?: PublicKey | undefined;
|
|
116
|
+
stakePool: PublicKey;
|
|
117
|
+
validatorList: PublicKey;
|
|
118
|
+
withdrawAuthority: PublicKey;
|
|
119
|
+
validatorStake: PublicKey;
|
|
120
|
+
destinationStake: PublicKey;
|
|
121
|
+
destinationStakeAuthority: PublicKey;
|
|
122
|
+
sourceTransferAuthority: PublicKey;
|
|
123
|
+
sourcePoolAccount: PublicKey;
|
|
124
|
+
managerFeeAccount: PublicKey;
|
|
125
|
+
poolMint: PublicKey;
|
|
126
|
+
poolTokens: number;
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* Withdraw sol instruction params
|
|
130
|
+
*/
|
|
131
|
+
export type WithdrawSolParams = {
|
|
132
|
+
programId?: PublicKey | undefined;
|
|
133
|
+
stakePool: PublicKey;
|
|
134
|
+
sourcePoolAccount: PublicKey;
|
|
135
|
+
withdrawAuthority: PublicKey;
|
|
136
|
+
reserveStake: PublicKey;
|
|
137
|
+
destinationSystemAccount: PublicKey;
|
|
138
|
+
sourceTransferAuthority: PublicKey;
|
|
139
|
+
solWithdrawAuthority?: PublicKey | undefined;
|
|
140
|
+
managerFeeAccount: PublicKey;
|
|
141
|
+
poolMint: PublicKey;
|
|
142
|
+
poolTokens: number;
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* Withdraw WSOL with session instruction params
|
|
146
|
+
*/
|
|
147
|
+
export type WithdrawWsolWithSessionParams = {
|
|
148
|
+
programId: PublicKey;
|
|
149
|
+
stakePool: PublicKey;
|
|
150
|
+
withdrawAuthority: PublicKey;
|
|
151
|
+
userTransferAuthority: PublicKey;
|
|
152
|
+
poolTokensFrom: PublicKey;
|
|
153
|
+
reserveStake: PublicKey;
|
|
154
|
+
userWsolAccount: PublicKey;
|
|
155
|
+
managerFeeAccount: PublicKey;
|
|
156
|
+
poolMint: PublicKey;
|
|
157
|
+
tokenProgramId: PublicKey;
|
|
158
|
+
solWithdrawAuthority?: PublicKey;
|
|
159
|
+
wsolMint: PublicKey;
|
|
160
|
+
programSigner: PublicKey;
|
|
161
|
+
poolTokens: number;
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* Deposit SOL directly into the pool's reserve account. The output is a "pool" token
|
|
165
|
+
* representing ownership into the pool. Inputs are converted to the current ratio.
|
|
166
|
+
*/
|
|
167
|
+
export type DepositSolParams = {
|
|
168
|
+
programId?: PublicKey | undefined;
|
|
169
|
+
stakePool: PublicKey;
|
|
170
|
+
depositAuthority?: PublicKey | undefined;
|
|
171
|
+
withdrawAuthority: PublicKey;
|
|
172
|
+
reserveStake: PublicKey;
|
|
173
|
+
fundingAccount: PublicKey;
|
|
174
|
+
destinationPoolAccount: PublicKey;
|
|
175
|
+
managerFeeAccount: PublicKey;
|
|
176
|
+
referralPoolAccount: PublicKey;
|
|
177
|
+
poolMint: PublicKey;
|
|
178
|
+
lamports: number;
|
|
179
|
+
};
|
|
180
|
+
export type CreateTokenMetadataParams = {
|
|
181
|
+
programId?: PublicKey | undefined;
|
|
182
|
+
stakePool: PublicKey;
|
|
183
|
+
manager: PublicKey;
|
|
184
|
+
tokenMetadata: PublicKey;
|
|
185
|
+
withdrawAuthority: PublicKey;
|
|
186
|
+
poolMint: PublicKey;
|
|
187
|
+
payer: PublicKey;
|
|
188
|
+
name: string;
|
|
189
|
+
symbol: string;
|
|
190
|
+
uri: string;
|
|
191
|
+
};
|
|
192
|
+
export type UpdateTokenMetadataParams = {
|
|
193
|
+
programId?: PublicKey | undefined;
|
|
194
|
+
stakePool: PublicKey;
|
|
195
|
+
manager: PublicKey;
|
|
196
|
+
tokenMetadata: PublicKey;
|
|
197
|
+
withdrawAuthority: PublicKey;
|
|
198
|
+
name: string;
|
|
199
|
+
symbol: string;
|
|
200
|
+
uri: string;
|
|
201
|
+
};
|
|
202
|
+
export type AddValidatorToPoolParams = {
|
|
203
|
+
programId?: PublicKey | undefined;
|
|
204
|
+
stakePool: PublicKey;
|
|
205
|
+
staker: PublicKey;
|
|
206
|
+
reserveStake: PublicKey;
|
|
207
|
+
withdrawAuthority: PublicKey;
|
|
208
|
+
validatorList: PublicKey;
|
|
209
|
+
validatorStake: PublicKey;
|
|
210
|
+
validatorVote: PublicKey;
|
|
211
|
+
seed?: number;
|
|
212
|
+
};
|
|
213
|
+
export type RemoveValidatorFromPoolParams = {
|
|
214
|
+
programId?: PublicKey | undefined;
|
|
215
|
+
stakePool: PublicKey;
|
|
216
|
+
staker: PublicKey;
|
|
217
|
+
withdrawAuthority: PublicKey;
|
|
218
|
+
validatorList: PublicKey;
|
|
219
|
+
validatorStake: PublicKey;
|
|
220
|
+
transientStake: PublicKey;
|
|
221
|
+
};
|
|
222
|
+
/**
|
|
223
|
+
* Stake Pool Instruction class
|
|
224
|
+
*/
|
|
225
|
+
export declare class StakePoolInstruction {
|
|
226
|
+
/**
|
|
227
|
+
* Creates instruction to add a validator into the stake pool.
|
|
228
|
+
*/
|
|
229
|
+
static addValidatorToPool(params: AddValidatorToPoolParams): TransactionInstruction;
|
|
230
|
+
/**
|
|
231
|
+
* Creates instruction to remove a validator from the stake pool.
|
|
232
|
+
*/
|
|
233
|
+
static removeValidatorFromPool(params: RemoveValidatorFromPoolParams): TransactionInstruction;
|
|
234
|
+
/**
|
|
235
|
+
* Creates instruction to update a set of validators in the stake pool.
|
|
236
|
+
*/
|
|
237
|
+
static updateValidatorListBalance(params: UpdateValidatorListBalanceParams): TransactionInstruction;
|
|
238
|
+
/**
|
|
239
|
+
* Creates instruction to update the overall stake pool balance.
|
|
240
|
+
*/
|
|
241
|
+
static updateStakePoolBalance(params: UpdateStakePoolBalanceParams): TransactionInstruction;
|
|
242
|
+
/**
|
|
243
|
+
* Creates instruction to cleanup removed validator entries.
|
|
244
|
+
*/
|
|
245
|
+
static cleanupRemovedValidatorEntries(params: CleanupRemovedValidatorEntriesParams): TransactionInstruction;
|
|
246
|
+
/**
|
|
247
|
+
* Creates `IncreaseValidatorStake` instruction (rebalance from reserve account to
|
|
248
|
+
* transient account)
|
|
249
|
+
*/
|
|
250
|
+
static increaseValidatorStake(params: IncreaseValidatorStakeParams): TransactionInstruction;
|
|
251
|
+
/**
|
|
252
|
+
* Creates `IncreaseAdditionalValidatorStake` instruction (rebalance from reserve account to
|
|
253
|
+
* transient account)
|
|
254
|
+
*/
|
|
255
|
+
static increaseAdditionalValidatorStake(params: IncreaseAdditionalValidatorStakeParams): TransactionInstruction;
|
|
256
|
+
/**
|
|
257
|
+
* Creates `DecreaseValidatorStake` instruction (rebalance from validator account to
|
|
258
|
+
* transient account)
|
|
259
|
+
*/
|
|
260
|
+
static decreaseValidatorStake(params: DecreaseValidatorStakeParams): TransactionInstruction;
|
|
261
|
+
/**
|
|
262
|
+
* Creates `DecreaseValidatorStakeWithReserve` instruction (rebalance from
|
|
263
|
+
* validator account to transient account)
|
|
264
|
+
*/
|
|
265
|
+
static decreaseValidatorStakeWithReserve(params: DecreaseValidatorStakeWithReserveParams): TransactionInstruction;
|
|
266
|
+
/**
|
|
267
|
+
* Creates `DecreaseAdditionalValidatorStake` instruction (rebalance from
|
|
268
|
+
* validator account to transient account)
|
|
269
|
+
*/
|
|
270
|
+
static decreaseAdditionalValidatorStake(params: DecreaseAdditionalValidatorStakeParams): TransactionInstruction;
|
|
271
|
+
/**
|
|
272
|
+
* Creates a transaction instruction to deposit a stake account into a stake pool.
|
|
273
|
+
*/
|
|
274
|
+
static depositStake(params: DepositStakeParams): TransactionInstruction;
|
|
275
|
+
/**
|
|
276
|
+
* Creates a transaction instruction to deposit SOL into a stake pool.
|
|
277
|
+
*/
|
|
278
|
+
static depositSol(params: DepositSolParams): TransactionInstruction;
|
|
279
|
+
/**
|
|
280
|
+
* Creates a transaction instruction to deposit WSOL into a stake pool.
|
|
281
|
+
*/
|
|
282
|
+
static depositWsolWithSession(params: DepositSolParams & {
|
|
283
|
+
wsolMint: PublicKey;
|
|
284
|
+
wsolTokenAccount: PublicKey;
|
|
285
|
+
wsolTransientAccount: PublicKey;
|
|
286
|
+
programSigner: PublicKey;
|
|
287
|
+
tokenProgramId: PublicKey;
|
|
288
|
+
programId: PublicKey;
|
|
289
|
+
payer?: PublicKey;
|
|
290
|
+
}): TransactionInstruction;
|
|
291
|
+
/**
|
|
292
|
+
* Creates a transaction instruction to withdraw active stake from a stake pool.
|
|
293
|
+
*/
|
|
294
|
+
static withdrawStake(params: WithdrawStakeParams): TransactionInstruction;
|
|
295
|
+
/**
|
|
296
|
+
* Creates a transaction instruction to withdraw SOL from a stake pool.
|
|
297
|
+
*/
|
|
298
|
+
static withdrawSol(params: WithdrawSolParams): TransactionInstruction;
|
|
299
|
+
/**
|
|
300
|
+
* Creates a transaction instruction to withdraw WSOL from a stake pool using a session.
|
|
301
|
+
*/
|
|
302
|
+
static withdrawWsolWithSession(params: WithdrawWsolWithSessionParams): TransactionInstruction;
|
|
303
|
+
/**
|
|
304
|
+
* Creates an instruction to create metadata
|
|
305
|
+
* using the mpl token metadata program for the pool token
|
|
306
|
+
*/
|
|
307
|
+
static createTokenMetadata(params: CreateTokenMetadataParams): TransactionInstruction;
|
|
308
|
+
/**
|
|
309
|
+
* Creates an instruction to update metadata
|
|
310
|
+
* in the mpl token metadata program account for the pool token
|
|
311
|
+
*/
|
|
312
|
+
static updateTokenMetadata(params: UpdateTokenMetadataParams): TransactionInstruction;
|
|
313
|
+
/**
|
|
314
|
+
* Decode a deposit stake pool instruction and retrieve the instruction params.
|
|
315
|
+
*/
|
|
316
|
+
static decodeDepositStake(instruction: TransactionInstruction): DepositStakeParams;
|
|
317
|
+
/**
|
|
318
|
+
* Decode a deposit sol instruction and retrieve the instruction params.
|
|
319
|
+
*/
|
|
320
|
+
static decodeDepositSol(instruction: TransactionInstruction): DepositSolParams;
|
|
321
|
+
/**
|
|
322
|
+
* @internal
|
|
323
|
+
*/
|
|
324
|
+
private static checkProgramId;
|
|
325
|
+
/**
|
|
326
|
+
* @internal
|
|
327
|
+
*/
|
|
328
|
+
private static checkKeyLength;
|
|
329
|
+
}
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
import { PublicKey } from '@solana/web3.js';
|
|
2
|
+
import BN from 'bn.js';
|
|
3
|
+
import { Layout as LayoutCls } from 'buffer-layout';
|
|
4
|
+
import { Infer } from 'superstruct';
|
|
5
|
+
import { Layout } from './codecs';
|
|
6
|
+
export interface Fee {
|
|
7
|
+
denominator: BN;
|
|
8
|
+
numerator: BN;
|
|
9
|
+
}
|
|
10
|
+
export declare enum AccountType {
|
|
11
|
+
Uninitialized = 0,
|
|
12
|
+
StakePool = 1,
|
|
13
|
+
ValidatorList = 2
|
|
14
|
+
}
|
|
15
|
+
export declare const BigNumFromString: import("superstruct").Struct<BN, null>;
|
|
16
|
+
export declare const PublicKeyFromString: import("superstruct").Struct<PublicKey, null>;
|
|
17
|
+
export declare class FutureEpochLayout<T> extends LayoutCls<T | null> {
|
|
18
|
+
layout: Layout<T>;
|
|
19
|
+
discriminator: Layout<number>;
|
|
20
|
+
constructor(layout: Layout<T>, property?: string);
|
|
21
|
+
encode(src: T | null, b: Buffer, offset?: number): number;
|
|
22
|
+
decode(b: Buffer, offset?: number): T | null;
|
|
23
|
+
getSpan(b: Buffer, offset?: number): number;
|
|
24
|
+
}
|
|
25
|
+
export declare function futureEpoch<T>(layout: Layout<T>, property?: string): LayoutCls<T | null>;
|
|
26
|
+
export type StakeAccountType = Infer<typeof StakeAccountType>;
|
|
27
|
+
export declare const StakeAccountType: import("superstruct").Struct<"uninitialized" | "initialized" | "delegated" | "rewardsPool", {
|
|
28
|
+
uninitialized: "uninitialized";
|
|
29
|
+
initialized: "initialized";
|
|
30
|
+
delegated: "delegated";
|
|
31
|
+
rewardsPool: "rewardsPool";
|
|
32
|
+
}>;
|
|
33
|
+
export type StakeMeta = Infer<typeof StakeMeta>;
|
|
34
|
+
export declare const StakeMeta: import("superstruct").Struct<{
|
|
35
|
+
rentExemptReserve: BN;
|
|
36
|
+
authorized: {
|
|
37
|
+
staker: PublicKey;
|
|
38
|
+
withdrawer: PublicKey;
|
|
39
|
+
};
|
|
40
|
+
lockup: {
|
|
41
|
+
unixTimestamp: number;
|
|
42
|
+
epoch: number;
|
|
43
|
+
custodian: PublicKey;
|
|
44
|
+
};
|
|
45
|
+
}, {
|
|
46
|
+
rentExemptReserve: import("superstruct").Struct<BN, null>;
|
|
47
|
+
authorized: import("superstruct").Struct<{
|
|
48
|
+
staker: PublicKey;
|
|
49
|
+
withdrawer: PublicKey;
|
|
50
|
+
}, {
|
|
51
|
+
staker: import("superstruct").Struct<PublicKey, null>;
|
|
52
|
+
withdrawer: import("superstruct").Struct<PublicKey, null>;
|
|
53
|
+
}>;
|
|
54
|
+
lockup: import("superstruct").Struct<{
|
|
55
|
+
unixTimestamp: number;
|
|
56
|
+
epoch: number;
|
|
57
|
+
custodian: PublicKey;
|
|
58
|
+
}, {
|
|
59
|
+
unixTimestamp: import("superstruct").Struct<number, null>;
|
|
60
|
+
epoch: import("superstruct").Struct<number, null>;
|
|
61
|
+
custodian: import("superstruct").Struct<PublicKey, null>;
|
|
62
|
+
}>;
|
|
63
|
+
}>;
|
|
64
|
+
export type StakeAccountInfo = Infer<typeof StakeAccountInfo>;
|
|
65
|
+
export declare const StakeAccountInfo: import("superstruct").Struct<{
|
|
66
|
+
meta: {
|
|
67
|
+
rentExemptReserve: BN;
|
|
68
|
+
authorized: {
|
|
69
|
+
staker: PublicKey;
|
|
70
|
+
withdrawer: PublicKey;
|
|
71
|
+
};
|
|
72
|
+
lockup: {
|
|
73
|
+
unixTimestamp: number;
|
|
74
|
+
epoch: number;
|
|
75
|
+
custodian: PublicKey;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
stake: {
|
|
79
|
+
delegation: {
|
|
80
|
+
stake: BN;
|
|
81
|
+
voter: PublicKey;
|
|
82
|
+
activationEpoch: BN;
|
|
83
|
+
deactivationEpoch: BN;
|
|
84
|
+
warmupCooldownRate: number;
|
|
85
|
+
};
|
|
86
|
+
creditsObserved: number;
|
|
87
|
+
} | null;
|
|
88
|
+
}, {
|
|
89
|
+
meta: import("superstruct").Struct<{
|
|
90
|
+
rentExemptReserve: BN;
|
|
91
|
+
authorized: {
|
|
92
|
+
staker: PublicKey;
|
|
93
|
+
withdrawer: PublicKey;
|
|
94
|
+
};
|
|
95
|
+
lockup: {
|
|
96
|
+
unixTimestamp: number;
|
|
97
|
+
epoch: number;
|
|
98
|
+
custodian: PublicKey;
|
|
99
|
+
};
|
|
100
|
+
}, {
|
|
101
|
+
rentExemptReserve: import("superstruct").Struct<BN, null>;
|
|
102
|
+
authorized: import("superstruct").Struct<{
|
|
103
|
+
staker: PublicKey;
|
|
104
|
+
withdrawer: PublicKey;
|
|
105
|
+
}, {
|
|
106
|
+
staker: import("superstruct").Struct<PublicKey, null>;
|
|
107
|
+
withdrawer: import("superstruct").Struct<PublicKey, null>;
|
|
108
|
+
}>;
|
|
109
|
+
lockup: import("superstruct").Struct<{
|
|
110
|
+
unixTimestamp: number;
|
|
111
|
+
epoch: number;
|
|
112
|
+
custodian: PublicKey;
|
|
113
|
+
}, {
|
|
114
|
+
unixTimestamp: import("superstruct").Struct<number, null>;
|
|
115
|
+
epoch: import("superstruct").Struct<number, null>;
|
|
116
|
+
custodian: import("superstruct").Struct<PublicKey, null>;
|
|
117
|
+
}>;
|
|
118
|
+
}>;
|
|
119
|
+
stake: import("superstruct").Struct<{
|
|
120
|
+
delegation: {
|
|
121
|
+
stake: BN;
|
|
122
|
+
voter: PublicKey;
|
|
123
|
+
activationEpoch: BN;
|
|
124
|
+
deactivationEpoch: BN;
|
|
125
|
+
warmupCooldownRate: number;
|
|
126
|
+
};
|
|
127
|
+
creditsObserved: number;
|
|
128
|
+
} | null, {
|
|
129
|
+
delegation: import("superstruct").Struct<{
|
|
130
|
+
stake: BN;
|
|
131
|
+
voter: PublicKey;
|
|
132
|
+
activationEpoch: BN;
|
|
133
|
+
deactivationEpoch: BN;
|
|
134
|
+
warmupCooldownRate: number;
|
|
135
|
+
}, {
|
|
136
|
+
voter: import("superstruct").Struct<PublicKey, null>;
|
|
137
|
+
stake: import("superstruct").Struct<BN, null>;
|
|
138
|
+
activationEpoch: import("superstruct").Struct<BN, null>;
|
|
139
|
+
deactivationEpoch: import("superstruct").Struct<BN, null>;
|
|
140
|
+
warmupCooldownRate: import("superstruct").Struct<number, null>;
|
|
141
|
+
}>;
|
|
142
|
+
creditsObserved: import("superstruct").Struct<number, null>;
|
|
143
|
+
}>;
|
|
144
|
+
}>;
|
|
145
|
+
export type StakeAccount = Infer<typeof StakeAccount>;
|
|
146
|
+
export declare const StakeAccount: import("superstruct").Struct<{
|
|
147
|
+
type: "uninitialized" | "initialized" | "delegated" | "rewardsPool";
|
|
148
|
+
info?: {
|
|
149
|
+
meta: {
|
|
150
|
+
rentExemptReserve: BN;
|
|
151
|
+
authorized: {
|
|
152
|
+
staker: PublicKey;
|
|
153
|
+
withdrawer: PublicKey;
|
|
154
|
+
};
|
|
155
|
+
lockup: {
|
|
156
|
+
unixTimestamp: number;
|
|
157
|
+
epoch: number;
|
|
158
|
+
custodian: PublicKey;
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
stake: {
|
|
162
|
+
delegation: {
|
|
163
|
+
stake: BN;
|
|
164
|
+
voter: PublicKey;
|
|
165
|
+
activationEpoch: BN;
|
|
166
|
+
deactivationEpoch: BN;
|
|
167
|
+
warmupCooldownRate: number;
|
|
168
|
+
};
|
|
169
|
+
creditsObserved: number;
|
|
170
|
+
} | null;
|
|
171
|
+
} | undefined;
|
|
172
|
+
}, {
|
|
173
|
+
type: import("superstruct").Struct<"uninitialized" | "initialized" | "delegated" | "rewardsPool", {
|
|
174
|
+
uninitialized: "uninitialized";
|
|
175
|
+
initialized: "initialized";
|
|
176
|
+
delegated: "delegated";
|
|
177
|
+
rewardsPool: "rewardsPool";
|
|
178
|
+
}>;
|
|
179
|
+
info: import("superstruct").Struct<{
|
|
180
|
+
meta: {
|
|
181
|
+
rentExemptReserve: BN;
|
|
182
|
+
authorized: {
|
|
183
|
+
staker: PublicKey;
|
|
184
|
+
withdrawer: PublicKey;
|
|
185
|
+
};
|
|
186
|
+
lockup: {
|
|
187
|
+
unixTimestamp: number;
|
|
188
|
+
epoch: number;
|
|
189
|
+
custodian: PublicKey;
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
stake: {
|
|
193
|
+
delegation: {
|
|
194
|
+
stake: BN;
|
|
195
|
+
voter: PublicKey;
|
|
196
|
+
activationEpoch: BN;
|
|
197
|
+
deactivationEpoch: BN;
|
|
198
|
+
warmupCooldownRate: number;
|
|
199
|
+
};
|
|
200
|
+
creditsObserved: number;
|
|
201
|
+
} | null;
|
|
202
|
+
} | undefined, {
|
|
203
|
+
meta: import("superstruct").Struct<{
|
|
204
|
+
rentExemptReserve: BN;
|
|
205
|
+
authorized: {
|
|
206
|
+
staker: PublicKey;
|
|
207
|
+
withdrawer: PublicKey;
|
|
208
|
+
};
|
|
209
|
+
lockup: {
|
|
210
|
+
unixTimestamp: number;
|
|
211
|
+
epoch: number;
|
|
212
|
+
custodian: PublicKey;
|
|
213
|
+
};
|
|
214
|
+
}, {
|
|
215
|
+
rentExemptReserve: import("superstruct").Struct<BN, null>;
|
|
216
|
+
authorized: import("superstruct").Struct<{
|
|
217
|
+
staker: PublicKey;
|
|
218
|
+
withdrawer: PublicKey;
|
|
219
|
+
}, {
|
|
220
|
+
staker: import("superstruct").Struct<PublicKey, null>;
|
|
221
|
+
withdrawer: import("superstruct").Struct<PublicKey, null>;
|
|
222
|
+
}>;
|
|
223
|
+
lockup: import("superstruct").Struct<{
|
|
224
|
+
unixTimestamp: number;
|
|
225
|
+
epoch: number;
|
|
226
|
+
custodian: PublicKey;
|
|
227
|
+
}, {
|
|
228
|
+
unixTimestamp: import("superstruct").Struct<number, null>;
|
|
229
|
+
epoch: import("superstruct").Struct<number, null>;
|
|
230
|
+
custodian: import("superstruct").Struct<PublicKey, null>;
|
|
231
|
+
}>;
|
|
232
|
+
}>;
|
|
233
|
+
stake: import("superstruct").Struct<{
|
|
234
|
+
delegation: {
|
|
235
|
+
stake: BN;
|
|
236
|
+
voter: PublicKey;
|
|
237
|
+
activationEpoch: BN;
|
|
238
|
+
deactivationEpoch: BN;
|
|
239
|
+
warmupCooldownRate: number;
|
|
240
|
+
};
|
|
241
|
+
creditsObserved: number;
|
|
242
|
+
} | null, {
|
|
243
|
+
delegation: import("superstruct").Struct<{
|
|
244
|
+
stake: BN;
|
|
245
|
+
voter: PublicKey;
|
|
246
|
+
activationEpoch: BN;
|
|
247
|
+
deactivationEpoch: BN;
|
|
248
|
+
warmupCooldownRate: number;
|
|
249
|
+
}, {
|
|
250
|
+
voter: import("superstruct").Struct<PublicKey, null>;
|
|
251
|
+
stake: import("superstruct").Struct<BN, null>;
|
|
252
|
+
activationEpoch: import("superstruct").Struct<BN, null>;
|
|
253
|
+
deactivationEpoch: import("superstruct").Struct<BN, null>;
|
|
254
|
+
warmupCooldownRate: import("superstruct").Struct<number, null>;
|
|
255
|
+
}>;
|
|
256
|
+
creditsObserved: import("superstruct").Struct<number, null>;
|
|
257
|
+
}>;
|
|
258
|
+
}>;
|
|
259
|
+
}>;
|
|
260
|
+
export interface Lockup {
|
|
261
|
+
unixTimestamp: BN;
|
|
262
|
+
epoch: BN;
|
|
263
|
+
custodian: PublicKey;
|
|
264
|
+
}
|
|
265
|
+
export interface StakePool {
|
|
266
|
+
accountType: AccountType;
|
|
267
|
+
manager: PublicKey;
|
|
268
|
+
staker: PublicKey;
|
|
269
|
+
stakeDepositAuthority: PublicKey;
|
|
270
|
+
stakeWithdrawBumpSeed: number;
|
|
271
|
+
validatorList: PublicKey;
|
|
272
|
+
reserveStake: PublicKey;
|
|
273
|
+
poolMint: PublicKey;
|
|
274
|
+
managerFeeAccount: PublicKey;
|
|
275
|
+
tokenProgramId: PublicKey;
|
|
276
|
+
totalLamports: BN;
|
|
277
|
+
poolTokenSupply: BN;
|
|
278
|
+
lastUpdateEpoch: BN;
|
|
279
|
+
lockup: Lockup;
|
|
280
|
+
epochFee: Fee;
|
|
281
|
+
nextEpochFee?: Fee | undefined;
|
|
282
|
+
preferredDepositValidatorVoteAddress?: PublicKey | undefined;
|
|
283
|
+
preferredWithdrawValidatorVoteAddress?: PublicKey | undefined;
|
|
284
|
+
stakeDepositFee: Fee;
|
|
285
|
+
stakeWithdrawalFee: Fee;
|
|
286
|
+
nextStakeWithdrawalFee?: Fee | undefined;
|
|
287
|
+
stakeReferralFee: number;
|
|
288
|
+
solDepositAuthority?: PublicKey | undefined;
|
|
289
|
+
solDepositFee: Fee;
|
|
290
|
+
solReferralFee: number;
|
|
291
|
+
solWithdrawAuthority?: PublicKey | undefined;
|
|
292
|
+
solWithdrawalFee: Fee;
|
|
293
|
+
nextSolWithdrawalFee?: Fee | undefined;
|
|
294
|
+
lastEpochPoolTokenSupply: BN;
|
|
295
|
+
lastEpochTotalLamports: BN;
|
|
296
|
+
}
|
|
297
|
+
export declare const StakePoolLayout: LayoutCls<StakePool>;
|
|
298
|
+
export declare enum ValidatorStakeInfoStatus {
|
|
299
|
+
Active = 0,
|
|
300
|
+
DeactivatingTransient = 1,
|
|
301
|
+
ReadyForRemoval = 2
|
|
302
|
+
}
|
|
303
|
+
export interface ValidatorStakeInfo {
|
|
304
|
+
status: ValidatorStakeInfoStatus;
|
|
305
|
+
voteAccountAddress: PublicKey;
|
|
306
|
+
activeStakeLamports: BN;
|
|
307
|
+
transientStakeLamports: BN;
|
|
308
|
+
transientSeedSuffixStart: BN;
|
|
309
|
+
transientSeedSuffixEnd: BN;
|
|
310
|
+
lastUpdateEpoch: BN;
|
|
311
|
+
}
|
|
312
|
+
export declare const ValidatorStakeInfoLayout: LayoutCls<ValidatorStakeInfo>;
|
|
313
|
+
export interface ValidatorList {
|
|
314
|
+
accountType: number;
|
|
315
|
+
maxValidators: number;
|
|
316
|
+
validators: ValidatorStakeInfo[];
|
|
317
|
+
}
|
|
318
|
+
export declare const ValidatorListLayout: LayoutCls<ValidatorList>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Buffer } from 'node:buffer';
|
|
2
|
+
import * as BufferLayout from '@solana/buffer-layout';
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export type InstructionType = {
|
|
7
|
+
/** The Instruction index (from solana upstream program) */
|
|
8
|
+
index: number;
|
|
9
|
+
/** The BufferLayout to use to build data */
|
|
10
|
+
layout: BufferLayout.Layout<any>;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Populate a buffer of instruction data using an InstructionType
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
export declare function encodeData(type: InstructionType, fields?: any): Buffer;
|
|
17
|
+
/**
|
|
18
|
+
* Decode instruction data buffer using an InstructionType
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
export declare function decodeData(type: InstructionType, buffer: Buffer): any;
|