@typesol/cli 0.41.0 → 0.42.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/CHANGELOG.md +92 -0
- package/README.md +2 -1
- package/dist/compiler/analyze.js +41 -1
- package/dist/compiler/emit/base.d.ts +40 -7
- package/dist/compiler/emit/base.js +33 -0
- package/dist/compiler/emit/borsh.d.ts +7 -0
- package/dist/compiler/emit/borsh.js +86 -1
- package/dist/compiler/emit/calls.d.ts +102 -2
- package/dist/compiler/emit/calls.js +663 -49
- package/dist/compiler/emit/cpi-core.d.ts +9 -3
- package/dist/compiler/emit/cpi-core.js +12 -7
- package/dist/compiler/emit/cpi.js +8 -14
- package/dist/compiler/emit/create.d.ts +3 -3
- package/dist/compiler/emit/create.js +33 -25
- package/dist/compiler/emit/expressions.js +51 -2
- package/dist/compiler/emit/function.js +2 -2
- package/dist/compiler/emit/outline.d.ts +24 -0
- package/dist/compiler/emit/outline.js +100 -0
- package/dist/compiler/emit/program.js +7 -2
- package/dist/compiler/emit/shared.d.ts +35 -1
- package/dist/compiler/emit/shared.js +9 -1
- package/dist/compiler/emit/statements.d.ts +31 -0
- package/dist/compiler/emit/statements.js +272 -14
- package/dist/compiler/emit/storage.d.ts +27 -1
- package/dist/compiler/emit/storage.js +124 -11
- package/dist/compiler/emit/token.d.ts +11 -8
- package/dist/compiler/emit/token.js +233 -104
- package/dist/compiler/hints.js +6 -0
- package/dist/compiler/model.d.ts +20 -1
- package/dist/compiler/model.js +5 -0
- package/dist/testing-stake.d.ts +216 -0
- package/dist/testing-stake.js +526 -0
- package/dist/testing.d.ts +1 -0
- package/dist/testing.js +1 -0
- package/docs/architecture.md +1 -1
- package/docs/case-study-spl-stake-pool.md +122 -0
- package/docs/errors.md +1 -1
- package/docs/language.md +107 -14
- package/docs/security-model.md +4 -0
- package/docs/stability.md +13 -0
- package/docs/test-your-program.md +47 -0
- package/docs/testing.md +19 -0
- package/lib/typesol.d.ts +241 -40
- package/llms-full.txt +172 -15
- package/llms.txt +1 -1
- package/package.json +1 -1
- package/runtime/typesol_rt.h +69 -0
package/dist/compiler/hints.js
CHANGED
|
@@ -60,6 +60,12 @@ export function hintForTypeScript(d, message, libPath) {
|
|
|
60
60
|
return "async is not supported: an instruction runs start to finish within one call; remove async";
|
|
61
61
|
case 2540: // Cannot assign to 'x' because it is a read-only property.
|
|
62
62
|
return "to change an account, take it as Mut<T> (Mut<Signer> for a signer whose lamports change)";
|
|
63
|
+
case 2344: // Type 'TokenAccount' does not satisfy the constraint 'StakeProgram | SystemProgram | …'.
|
|
64
|
+
if (/\bprogramAt\s*</.test(line))
|
|
65
|
+
return "programAt<P> takes a program: StakeProgram, SystemProgram, TokenProgram, Token2022Program, TokenInterface, AssociatedTokenProgram or MemoProgram (sysvarAt<StakeHistorySysvar> for the sysvar); read other accounts with loadRaw / loadAccount";
|
|
66
|
+
if (/\bsysvarAt\s*</.test(line))
|
|
67
|
+
return "sysvarAt<S> takes StakeHistorySysvar; programs go through programAt<P>";
|
|
68
|
+
return undefined;
|
|
63
69
|
default:
|
|
64
70
|
return undefined;
|
|
65
71
|
}
|
package/dist/compiler/model.d.ts
CHANGED
|
@@ -64,9 +64,13 @@ export type ValueType = ScalarType | {
|
|
|
64
64
|
| {
|
|
65
65
|
kind: "signerSeeds";
|
|
66
66
|
}
|
|
67
|
-
/**
|
|
67
|
+
/**
|
|
68
|
+
* An extra account from remainingAccounts(): `SolAccountInfo *`. `program`: what `programAt<P>(acct)` /
|
|
69
|
+
* `sysvarAt<S>(acct)` checked it is (its typed methods then apply).
|
|
70
|
+
*/
|
|
68
71
|
| {
|
|
69
72
|
kind: "account";
|
|
73
|
+
program?: ParamKind;
|
|
70
74
|
}
|
|
71
75
|
/** The remainingAccounts() list itself. */
|
|
72
76
|
| {
|
|
@@ -76,6 +80,10 @@ export type ValueType = ScalarType | {
|
|
|
76
80
|
| {
|
|
77
81
|
kind: "txIx";
|
|
78
82
|
}
|
|
83
|
+
/** The EpochRewards sysvar as epochRewards() read it: a `TsEpochRewards` copy. */
|
|
84
|
+
| {
|
|
85
|
+
kind: "epochRewards";
|
|
86
|
+
}
|
|
79
87
|
/** A struct loaded from a remaining account with loadAccount / loadAccountMut. */
|
|
80
88
|
| {
|
|
81
89
|
kind: "structRef";
|
|
@@ -125,6 +133,8 @@ export type FieldType = ScalarType | {
|
|
|
125
133
|
* `Vec<T>` (stored after the fixed-size fields, grows the account) or, with `cap`, `FixedVec<T, N>`: a u32 length and
|
|
126
134
|
* room for N elements. With `heap`, a `Vec<T>` in a `@layout borsh` struct: Anchor's Vec, held on the heap while the
|
|
127
135
|
* instruction runs (`TSH_*`: length, capacity, elements) and bounded only by the account when it is written back.
|
|
136
|
+
* With `big`, a `BigVec<T>` (the last field of a struct read with loadRaw): stored like a trailing Vec, its room set by
|
|
137
|
+
* the account's size, never resized.
|
|
128
138
|
*/
|
|
129
139
|
| {
|
|
130
140
|
kind: "vec";
|
|
@@ -132,6 +142,7 @@ export type FieldType = ScalarType | {
|
|
|
132
142
|
cap?: number;
|
|
133
143
|
heap?: true;
|
|
134
144
|
optional?: true;
|
|
145
|
+
big?: true;
|
|
135
146
|
};
|
|
136
147
|
export interface StructField {
|
|
137
148
|
name: string;
|
|
@@ -167,6 +178,12 @@ export interface StructDef {
|
|
|
167
178
|
elem: FieldType;
|
|
168
179
|
elemSize: number;
|
|
169
180
|
}[];
|
|
181
|
+
/** A `BigVec<T>` last field (also `vec` and `vecs`, so every refusal of variable-size structs applies to it). */
|
|
182
|
+
bigVec?: {
|
|
183
|
+
name: string;
|
|
184
|
+
elem: FieldType;
|
|
185
|
+
elemSize: number;
|
|
186
|
+
};
|
|
170
187
|
accountDiscriminator: number[];
|
|
171
188
|
eventDiscriminator: number[];
|
|
172
189
|
node: ts.InterfaceDeclaration;
|
|
@@ -555,6 +572,8 @@ export interface ProgramModel {
|
|
|
555
572
|
localVecs: Map<string, FieldType & {
|
|
556
573
|
kind: "vec";
|
|
557
574
|
}>;
|
|
575
|
+
/** Structs read or written with loadBorsh / storeBorsh, filled in while emitting: their ts_bdec_ / ts_benc_ codecs. */
|
|
576
|
+
borshNative: Set<string>;
|
|
558
577
|
}
|
|
559
578
|
export declare function isWritable(k: ParamKind): boolean;
|
|
560
579
|
export declare function typeName(t: ValueType | FieldType): string;
|
package/dist/compiler/model.js
CHANGED
|
@@ -61,6 +61,8 @@ export function typeName(t) {
|
|
|
61
61
|
case "vec":
|
|
62
62
|
if (t.optional)
|
|
63
63
|
return `Option<Vec<${typeName(t.elem)}>>`;
|
|
64
|
+
if (t.big)
|
|
65
|
+
return `BigVec<${typeName(t.elem)}>`;
|
|
64
66
|
return t.cap === undefined ? `Vec<${typeName(t.elem)}>` : `FixedVec<${typeName(t.elem)}, ${t.cap}>`;
|
|
65
67
|
case "vecArg":
|
|
66
68
|
return t.optional ? `Option<Vec<${typeName(t.elem)}>>` : `Vec<${typeName(t.elem)}>`;
|
|
@@ -76,6 +78,8 @@ export function typeName(t) {
|
|
|
76
78
|
return "RemainingAccounts";
|
|
77
79
|
case "txIx":
|
|
78
80
|
return "TransactionInstruction";
|
|
81
|
+
case "epochRewards":
|
|
82
|
+
return "EpochRewards";
|
|
79
83
|
case "structRef":
|
|
80
84
|
return t.struct;
|
|
81
85
|
}
|
|
@@ -104,6 +108,7 @@ export function sameType(a, b) {
|
|
|
104
108
|
return (a.cap === b.cap &&
|
|
105
109
|
!a.heap === !b.heap &&
|
|
106
110
|
!a.optional === !b.optional &&
|
|
111
|
+
!a.big === !b.big &&
|
|
107
112
|
sameType(a.elem, b.elem));
|
|
108
113
|
case "vecArg":
|
|
109
114
|
return !a.optional === !b.optional && sameType(a.elem, b.elem);
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Epochs and staking for `typesol/testing` (re-exported from there): move LiteSVM's Clock to an epoch, keep a
|
|
3
|
+
* StakeHistory sysvar that rate-limits warmup and cooldown as a cluster does, and build vote and stake accounts.
|
|
4
|
+
*
|
|
5
|
+
* LiteSVM alone does neither: `warpToSlot` leaves Clock.epoch where it was, and its StakeHistory stays empty, so the
|
|
6
|
+
* Stake program finds no history and takes every delegation as fully active one epoch after it was made.
|
|
7
|
+
*/
|
|
8
|
+
import { type Address, type KeyPairSigner } from "@solana/kit";
|
|
9
|
+
import { type LiteSVM, type TransactionMetadata } from "litesvm";
|
|
10
|
+
export declare const STAKE_PROGRAM_ADDRESS: Address;
|
|
11
|
+
export declare const VOTE_PROGRAM_ADDRESS: Address;
|
|
12
|
+
/** Size of a stake account (StakeStateV2). */
|
|
13
|
+
export declare const STAKE_ACCOUNT_SIZE = 200n;
|
|
14
|
+
/** Size of a vote account. */
|
|
15
|
+
export declare const VOTE_ACCOUNT_SIZE = 3762n;
|
|
16
|
+
/** StakeHistory keeps this many epochs, newest first. */
|
|
17
|
+
export declare const STAKE_HISTORY_MAX_ENTRIES = 512;
|
|
18
|
+
/** The EpochSchedule sysvar's fields (LiteSVM's `EpochSchedule` has them). */
|
|
19
|
+
export interface EpochScheduleLike {
|
|
20
|
+
slotsPerEpoch: bigint;
|
|
21
|
+
leaderScheduleSlotOffset: bigint;
|
|
22
|
+
warmup: boolean;
|
|
23
|
+
firstNormalEpoch: bigint;
|
|
24
|
+
firstNormalSlot: bigint;
|
|
25
|
+
}
|
|
26
|
+
/** The epoch of `slot` and the slot's index in it (EpochSchedule::get_epoch_and_slot_index). */
|
|
27
|
+
export declare function epochAndSlotIndex(schedule: EpochScheduleLike, slot: bigint): {
|
|
28
|
+
epoch: bigint;
|
|
29
|
+
slotIndex: bigint;
|
|
30
|
+
};
|
|
31
|
+
/** The first slot of `epoch` (EpochSchedule::get_first_slot_in_epoch). */
|
|
32
|
+
export declare function firstSlotInEpoch(schedule: EpochScheduleLike, epoch: bigint): bigint;
|
|
33
|
+
/** The epoch whose leader schedule is known at `slot` (EpochSchedule::get_leader_schedule_epoch). */
|
|
34
|
+
export declare function leaderScheduleEpoch(schedule: EpochScheduleLike, slot: bigint): bigint;
|
|
35
|
+
export interface WarpOptions {
|
|
36
|
+
/** Seconds the Clock's unixTimestamp advances per slot (default 0.4, millisecond precision). */
|
|
37
|
+
secondsPerSlot?: number;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Move the cluster to the first slot of `epoch`: the Clock's slot, epoch, leader schedule epoch and timestamps
|
|
41
|
+
* (unixTimestamp advances by `secondsPerSlot` per slot and the epoch starts then), by the VM's EpochSchedule, warmup
|
|
42
|
+
* epochs included. The blockhash expires, so a transaction sent again is a new one. The StakeHistory is left as it is:
|
|
43
|
+
* use a `StakeCluster` to have it filled in.
|
|
44
|
+
*/
|
|
45
|
+
export declare function warpToEpoch(svm: LiteSVM, epoch: bigint, opts?: WarpOptions): void;
|
|
46
|
+
/** `warpToEpoch` to the next epoch; returns it. */
|
|
47
|
+
export declare function nextEpoch(svm: LiteSVM, opts?: WarpOptions): bigint;
|
|
48
|
+
/** A StakeHistory entry, and what `stakeActivation` returns for one delegation: lamports. */
|
|
49
|
+
export interface StakeHistoryEntryValue {
|
|
50
|
+
effective: bigint;
|
|
51
|
+
activating: bigint;
|
|
52
|
+
deactivating: bigint;
|
|
53
|
+
}
|
|
54
|
+
export type StakeActivationStatus = StakeHistoryEntryValue;
|
|
55
|
+
/** A StakeHistory entry. */
|
|
56
|
+
export declare function stakeHistoryEntry(effective?: bigint, activating?: bigint, deactivating?: bigint): StakeHistoryEntryValue;
|
|
57
|
+
/** Sum of entries, saturating at u64::MAX per field (StakeHistoryEntry's `+`). */
|
|
58
|
+
export declare function addStakeHistoryEntries(...entries: StakeHistoryEntryValue[]): StakeHistoryEntryValue;
|
|
59
|
+
/** Stake history by epoch: a Map, LiteSVM's `StakeHistory`, or anything with `get(epoch)`. */
|
|
60
|
+
export interface StakeHistoryLookup {
|
|
61
|
+
get(epoch: bigint): StakeHistoryEntryValue | null | undefined;
|
|
62
|
+
}
|
|
63
|
+
/** The parts of a Delegation that activation depends on. */
|
|
64
|
+
export interface DelegationLike {
|
|
65
|
+
stake: bigint;
|
|
66
|
+
activationEpoch: bigint;
|
|
67
|
+
deactivationEpoch: bigint;
|
|
68
|
+
}
|
|
69
|
+
export interface StakeActivationOptions {
|
|
70
|
+
/**
|
|
71
|
+
* `"integer"` (default): solana-stake-interface 4.3.0's `stake_activating_and_deactivating_v2`, the basis-point
|
|
72
|
+
* integer math of SIMD-0391 (Stake program v5.1). `"float"`: the f64 math it replaces (the deprecated
|
|
73
|
+
* `stake_activating_and_deactivating`), which the Stake program in LiteSVM 1.6.1 runs. They differ by a few lamports
|
|
74
|
+
* once amounts pass 2^53 lamports (about 9M SOL), e.g. with a mainnet-sized cluster.
|
|
75
|
+
*/
|
|
76
|
+
math?: "integer" | "float";
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* The effective, activating and deactivating stake of a delegation at `targetEpoch`, given the cluster's stake history:
|
|
80
|
+
* an exact port of `Delegation::stake_activating_and_deactivating_v2` (solana-stake-interface 4.3.0), BigInt math with
|
|
81
|
+
* its u128 saturation. `newRateActivationEpoch` is the epoch from which warmup and cooldown are 9% per epoch rather
|
|
82
|
+
* than 25%: 0 (the default) as the Stake program has it on every cluster; `null` for 25% throughout (Rust's None).
|
|
83
|
+
*/
|
|
84
|
+
export declare function stakeActivation(delegation: DelegationLike, targetEpoch: bigint, history: StakeHistoryLookup, newRateActivationEpoch?: bigint | null, opts?: StakeActivationOptions): StakeActivationStatus;
|
|
85
|
+
/** The StakeHistory sysvar of `svm`, by epoch (read from the sysvar account: newest first, as stored). */
|
|
86
|
+
export declare function readStakeHistory(svm: LiteSVM): Map<bigint, StakeHistoryEntryValue>;
|
|
87
|
+
/** Replace the StakeHistory sysvar of each VM with these entries (the newest 512 are kept). */
|
|
88
|
+
export declare function writeStakeHistory(svms: LiteSVM | readonly LiteSVM[], history: ReadonlyMap<bigint, StakeHistoryEntryValue>): void;
|
|
89
|
+
export interface StakeAuthorized {
|
|
90
|
+
staker: Address;
|
|
91
|
+
withdrawer: Address;
|
|
92
|
+
}
|
|
93
|
+
export interface StakeLockup {
|
|
94
|
+
unixTimestamp: bigint;
|
|
95
|
+
epoch: bigint;
|
|
96
|
+
custodian: Address;
|
|
97
|
+
}
|
|
98
|
+
export interface StakeMeta {
|
|
99
|
+
/**
|
|
100
|
+
* As stored. The Stake program in LiteSVM 1.6.1 holds back the Rent sysvar's minimum for 200 bytes instead
|
|
101
|
+
* (`svm.minimumBalanceForRentExemption(200n)`), which is smaller than what its Initialize writes here.
|
|
102
|
+
*/
|
|
103
|
+
rentExemptReserve: bigint;
|
|
104
|
+
authorized: StakeAuthorized;
|
|
105
|
+
lockup: StakeLockup;
|
|
106
|
+
}
|
|
107
|
+
export interface Delegation extends DelegationLike {
|
|
108
|
+
voterPubkey: Address;
|
|
109
|
+
/** The legacy `warmup_cooldown_rate: f64` field, now reserved: its 8 bytes as stored. */
|
|
110
|
+
warmupCooldownRate: Uint8Array;
|
|
111
|
+
}
|
|
112
|
+
export interface Stake {
|
|
113
|
+
delegation: Delegation;
|
|
114
|
+
creditsObserved: bigint;
|
|
115
|
+
}
|
|
116
|
+
/** A stake account's data (StakeStateV2). */
|
|
117
|
+
export type StakeStateV2 = {
|
|
118
|
+
kind: "Uninitialized";
|
|
119
|
+
} | {
|
|
120
|
+
kind: "Initialized";
|
|
121
|
+
meta: StakeMeta;
|
|
122
|
+
} | {
|
|
123
|
+
kind: "Stake";
|
|
124
|
+
meta: StakeMeta;
|
|
125
|
+
stake: Stake;
|
|
126
|
+
stakeFlags: number;
|
|
127
|
+
} | {
|
|
128
|
+
kind: "RewardsPool";
|
|
129
|
+
};
|
|
130
|
+
/** Decode StakeStateV2 bytes. */
|
|
131
|
+
export declare function decodeStakeState(data: Uint8Array): StakeStateV2;
|
|
132
|
+
/** The stake account at `address` decoded, or null when it does not exist. */
|
|
133
|
+
export declare function readStakeAccount(svm: LiteSVM, address: Address): StakeStateV2 | null;
|
|
134
|
+
export interface StakeClusterOptions extends WarpOptions, StakeActivationOptions {
|
|
135
|
+
/**
|
|
136
|
+
* The rest of the cluster, added to every epoch's entry: a fixed entry or one per epoch. Default 400M SOL effective,
|
|
137
|
+
* nothing activating or deactivating, which lets a delegation of under 36M SOL warm up in one epoch, as on mainnet.
|
|
138
|
+
* Make `activating` / `deactivating` more than 9% of `effective` to see warmup and cooldown take several epochs.
|
|
139
|
+
*/
|
|
140
|
+
base?: StakeHistoryEntryValue | ((epoch: bigint) => StakeHistoryEntryValue);
|
|
141
|
+
/** Count every stake account of the first VM (default true); false counts only the ones passed to `track`. */
|
|
142
|
+
allStakeAccounts?: boolean;
|
|
143
|
+
/** The epoch the 9% rate starts (default 0, as the Stake program has it); null for 25%. */
|
|
144
|
+
newRateActivationEpoch?: bigint | null;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* A cluster's stake bookkeeping over one or more LiteSVMs. Each epoch advance appends the StakeHistory entry of the
|
|
148
|
+
* epoch that ends (the sum of `stakeActivation` over the cluster's delegations at that epoch, plus `base`), as a
|
|
149
|
+
* cluster does at an epoch boundary, then moves the Clock to the next epoch's first slot. Every VM gets the same Clock,
|
|
150
|
+
* EpochSchedule and StakeHistory (taken from the first VM when the cluster is made), so differential tests see
|
|
151
|
+
* identical sysvars; the delegations are read from the first VM.
|
|
152
|
+
*
|
|
153
|
+
* The default `math` is `"float"`, the Stake program's in LiteSVM 1.6.1, so the history it writes and `activation`
|
|
154
|
+
* agree to the lamport with what that program does.
|
|
155
|
+
*/
|
|
156
|
+
export declare class StakeCluster {
|
|
157
|
+
readonly svms: readonly LiteSVM[];
|
|
158
|
+
private readonly entries;
|
|
159
|
+
private readonly tracked;
|
|
160
|
+
private readonly opts;
|
|
161
|
+
constructor(svms: LiteSVM | readonly LiteSVM[], opts?: StakeClusterOptions);
|
|
162
|
+
/** Count these stake accounts (with `allStakeAccounts: false`, only tracked ones count). */
|
|
163
|
+
track(...addresses: Address[]): this;
|
|
164
|
+
/** The current epoch (the first VM's Clock). */
|
|
165
|
+
get epoch(): bigint;
|
|
166
|
+
/** The StakeHistory written so far, by epoch. */
|
|
167
|
+
get history(): ReadonlyMap<bigint, StakeHistoryEntryValue>;
|
|
168
|
+
/** The delegations the cluster counts now: every Stake-state account (or the tracked ones) of the first VM. */
|
|
169
|
+
delegations(): Delegation[];
|
|
170
|
+
/** A delegation's (or a stake account's) activation at `epoch` (default: now), by this cluster's history. */
|
|
171
|
+
activation(of: Address | DelegationLike, epoch?: bigint): StakeActivationStatus;
|
|
172
|
+
/** The entry the epoch `epoch` ends with, given the delegations now and the history so far. */
|
|
173
|
+
entryAt(epoch: bigint): StakeHistoryEntryValue;
|
|
174
|
+
/** End the current epoch: append its entry and move every VM to the next epoch. Returns the new epoch. */
|
|
175
|
+
nextEpoch(): bigint;
|
|
176
|
+
/**
|
|
177
|
+
* End epochs one by one (an entry for each, none skipped) up to `epoch`, then move every VM to its first slot. The
|
|
178
|
+
* history must still end at the epoch before the Clock's (or be empty): a Clock moved past it some other way (the
|
|
179
|
+
* plain `warpToEpoch`, `setClock`) would leave epochs without an entry, which the Stake program misreads, so that is
|
|
180
|
+
* refused. A new LiteSVM's Clock is at epoch 0 but at slot 454,464,000, so the first warp from one moves the slot back
|
|
181
|
+
* (to the first slot of `epoch` by the EpochSchedule); the timestamps still move forward.
|
|
182
|
+
*/
|
|
183
|
+
warpToEpoch(epoch: bigint): void;
|
|
184
|
+
/** The newest epoch with an entry, or -1 for an empty history. */
|
|
185
|
+
private newestEntry;
|
|
186
|
+
private rateEpoch;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* A vote account made by the Vote program (System CreateAccount of 3762 bytes, then InitializeAccount with
|
|
190
|
+
* VoteInit { node, authorized voter, authorized withdrawer, commission }). `node` signs (a new keypair by default);
|
|
191
|
+
* `voter` and `withdrawer` default to the node. Returns the vote account's address (`address` to choose it).
|
|
192
|
+
*/
|
|
193
|
+
export declare function createVoteAccount(svm: LiteSVM, payer: KeyPairSigner, opts?: {
|
|
194
|
+
node?: KeyPairSigner;
|
|
195
|
+
voter?: Address;
|
|
196
|
+
withdrawer?: Address;
|
|
197
|
+
commission?: number;
|
|
198
|
+
address?: KeyPairSigner;
|
|
199
|
+
}): Promise<Address>;
|
|
200
|
+
/**
|
|
201
|
+
* A stake account made by the Stake program (System CreateAccount of 200 bytes holding `lamports` in all, rent
|
|
202
|
+
* reserve included, then Initialize with the authorities and lockup). Returns its address (`address` to choose it).
|
|
203
|
+
*/
|
|
204
|
+
export declare function createStakeAccount(svm: LiteSVM, payer: KeyPairSigner, opts: {
|
|
205
|
+
staker: Address;
|
|
206
|
+
withdrawer: Address;
|
|
207
|
+
lamports: bigint;
|
|
208
|
+
lockup?: Partial<StakeLockup>;
|
|
209
|
+
address?: KeyPairSigner;
|
|
210
|
+
}): Promise<Address>;
|
|
211
|
+
/** Delegate a stake account to a vote account (Stake DelegateStake, signed by the staker; `staker` defaults to the payer). */
|
|
212
|
+
export declare function delegateStake(svm: LiteSVM, payer: KeyPairSigner, opts: {
|
|
213
|
+
stake: Address;
|
|
214
|
+
vote: Address;
|
|
215
|
+
staker?: KeyPairSigner;
|
|
216
|
+
}): Promise<TransactionMetadata>;
|