@typesol/cli 0.45.0 → 0.46.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 +227 -0
- package/README.md +64 -17
- package/SECURITY.md +9 -7
- package/dist/bin.d.ts +2 -0
- package/dist/bin.js +9 -0
- package/dist/cli.js +33 -15
- package/dist/compiler/analyze.js +57 -6
- package/dist/compiler/diagnostics.d.ts +4 -3
- package/dist/compiler/diagnostics.js +10 -6
- package/dist/compiler/emit/base.d.ts +1 -1
- package/dist/compiler/emit/calls.js +18 -5
- package/dist/compiler/emit/cpi-core.d.ts +3 -1
- package/dist/compiler/emit/cpi-core.js +8 -4
- package/dist/compiler/emit/expressions.d.ts +14 -0
- package/dist/compiler/emit/expressions.js +52 -4
- package/dist/compiler/emit/shared.d.ts +8 -1
- package/dist/compiler/emit/shared.js +8 -1
- package/dist/compiler/emit/statements.d.ts +8 -3
- package/dist/compiler/emit/statements.js +68 -3
- package/dist/compiler/emit/storage.js +5 -1
- package/dist/compiler/hints.d.ts +7 -0
- package/dist/compiler/hints.js +58 -9
- package/dist/compiler/index.d.ts +5 -0
- package/dist/compiler/index.js +10 -1
- package/dist/compiler/model.js +3 -2
- package/dist/compiler/toolchain.d.ts +50 -2
- package/dist/compiler/toolchain.js +96 -11
- package/dist/node-version.d.ts +4 -0
- package/dist/node-version.js +12 -0
- package/dist/tools/doctor.d.ts +41 -0
- package/dist/tools/doctor.js +96 -14
- package/dist/workspace.d.ts +9 -2
- package/dist/workspace.js +13 -3
- package/docker/deps/0.46.0.lock.json +1206 -0
- package/docs/ai.md +2 -1
- package/docs/architecture.md +7 -3
- package/docs/audit.md +6 -6
- package/docs/case-study-phoenix.md +1 -1
- package/docs/case-study-raydium-amm.md +1 -1
- package/docs/case-study-spl-stake-pool.md +1 -1
- package/docs/cli.md +42 -4
- package/docs/errors.md +22 -8
- package/docs/glossary.md +210 -0
- package/docs/language-accounts.md +499 -0
- package/docs/language-basics.md +389 -0
- package/docs/language-builtins.md +411 -0
- package/docs/language-chain.md +198 -0
- package/docs/language-cpi.md +470 -0
- package/docs/language-errors-events.md +184 -0
- package/docs/language-native.md +493 -0
- package/docs/language-pdas.md +198 -0
- package/docs/language-statements.md +620 -0
- package/docs/language-types.md +601 -0
- package/docs/language.md +190 -467
- package/docs/mainnet.md +18 -3
- package/docs/migrate-from-anchor.md +7 -6
- package/docs/security-model.md +3 -3
- package/docs/stability.md +3 -1
- package/docs/test-your-program.md +52 -15
- package/docs/troubleshooting.md +222 -100
- package/lib/typesol.d.ts +67 -22
- package/llms-full.txt +4915 -634
- package/llms.txt +12 -1
- package/package.json +2 -2
- package/releases/0.45.0.json +732 -0
- package/ts-plugin/index.js +16 -5
package/lib/typesol.d.ts
CHANGED
|
@@ -14,10 +14,15 @@
|
|
|
14
14
|
* ~ flips the bits within the type's width.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
+
/** Unsigned 8-bit integer (a `bigint` to TypeScript); literals are written `1n`. */
|
|
17
18
|
export type u8 = bigint;
|
|
19
|
+
/** Unsigned 16-bit integer (a `bigint` to TypeScript); literals are written `1n`. */
|
|
18
20
|
export type u16 = bigint;
|
|
21
|
+
/** Unsigned 32-bit integer (a `bigint` to TypeScript); literals are written `1n`. */
|
|
19
22
|
export type u32 = bigint;
|
|
23
|
+
/** Unsigned 64-bit integer (a `bigint` to TypeScript); literals are written `1n`. */
|
|
20
24
|
export type u64 = bigint;
|
|
25
|
+
/** Unsigned 128-bit integer (a `bigint` to TypeScript); literals are written `1n`. */
|
|
21
26
|
export type u128 = bigint;
|
|
22
27
|
/**
|
|
23
28
|
* 256-bit unsigned integers for computation (sqrt-price and liquidity math): locals, helper parameters and results,
|
|
@@ -25,10 +30,15 @@ export type u128 = bigint;
|
|
|
25
30
|
* (the IDL has no 256-bit integer).
|
|
26
31
|
*/
|
|
27
32
|
export type u256 = bigint;
|
|
33
|
+
/** Signed 8-bit integer, two's complement (a `bigint` to TypeScript). */
|
|
28
34
|
export type i8 = bigint;
|
|
35
|
+
/** Signed 16-bit integer, two's complement (a `bigint` to TypeScript). */
|
|
29
36
|
export type i16 = bigint;
|
|
37
|
+
/** Signed 32-bit integer, two's complement (a `bigint` to TypeScript). */
|
|
30
38
|
export type i32 = bigint;
|
|
39
|
+
/** Signed 64-bit integer, two's complement (a `bigint` to TypeScript). */
|
|
31
40
|
export type i64 = bigint;
|
|
41
|
+
/** Signed 128-bit integer, two's complement (a `bigint` to TypeScript). */
|
|
32
42
|
export type i128 = bigint;
|
|
33
43
|
|
|
34
44
|
/** A 32-byte Solana address. Compare with `===`, `!==` or `.equals()`. */
|
|
@@ -103,7 +113,8 @@ export declare function byteLength(value: string): u64;
|
|
|
103
113
|
export type Option<T> = T | null;
|
|
104
114
|
|
|
105
115
|
/**
|
|
106
|
-
* A
|
|
116
|
+
* A list whose length varies: as account data the account grows with it; as an argument it is a read-only view.
|
|
117
|
+
* As an account struct field it is stored Borsh-style (u32 length + elements) and the account is
|
|
107
118
|
* resized as it grows. An account may have any number of them, declared anywhere: they are stored after the
|
|
108
119
|
* fixed-size fields, in the order declared. In a `@layout borsh` struct it is Anchor's `Vec<T>`: anywhere among the
|
|
109
120
|
* fields, held on the heap while the instruction runs, and bounded only by the account when it is written back
|
|
@@ -246,6 +257,7 @@ export interface RemainingAccounts extends Iterable<CpiAccount> {
|
|
|
246
257
|
export interface RemainingSlice extends Iterable<CpiAccount> {
|
|
247
258
|
readonly __remainingSlice: void;
|
|
248
259
|
}
|
|
260
|
+
/** The accounts passed after the declared ones, in order (see RemainingAccounts). */
|
|
249
261
|
export declare function remainingAccounts(): RemainingAccounts;
|
|
250
262
|
|
|
251
263
|
/**
|
|
@@ -275,6 +287,7 @@ export declare function sysvarAt<S extends StakeHistorySysvar>(account: Remainin
|
|
|
275
287
|
* `.lamports`), and passes to a helper that takes `Account<T>` / `Mut<T>`.
|
|
276
288
|
*/
|
|
277
289
|
export declare function loadAccount<T>(account: RemainingAccount | AccountInfo): Account<T>;
|
|
290
|
+
/** `loadAccount` for writing: also writable, and loaded mutably once per instruction (2040). */
|
|
278
291
|
export declare function loadAccountMut<T>(account: RemainingAccount | AccountInfo): Mut<T>;
|
|
279
292
|
/**
|
|
280
293
|
* A native (non-Anchor) program's own account as a fixed-layout struct, as a `#[repr(C)]` type's `load_checked` /
|
|
@@ -283,6 +296,7 @@ export declare function loadAccountMut<T>(account: RemainingAccount | AccountInf
|
|
|
283
296
|
* mutably twice in the instruction (2040). Bind it with const: `const amm = loadRawMut<AmmInfo>(ammInfo)`.
|
|
284
297
|
*/
|
|
285
298
|
export declare function loadRaw<T>(account: RemainingAccount | AccountInfo): Account<T>;
|
|
299
|
+
/** `loadRaw` for writing: also writable and loaded mutably once per instruction (2040). */
|
|
286
300
|
export declare function loadRawMut<T>(account: RemainingAccount | AccountInfo): Mut<T>;
|
|
287
301
|
/**
|
|
288
302
|
* `loadRaw` / `loadRawMut` at a byte offset known only at run time (a native account whose parts start where its header
|
|
@@ -293,6 +307,7 @@ export declare function loadRawMut<T>(account: RemainingAccount | AccountInfo):
|
|
|
293
307
|
* it may view, since its bounds were checked against the old length: take it again after (a compile error says so).
|
|
294
308
|
*/
|
|
295
309
|
export declare function loadRawAt<T>(account: RemainingAccount | AccountInfo, offset: u64): Account<T>;
|
|
310
|
+
/** `loadRawAt` for writing: writable and claimed as `loadRawMut` is. */
|
|
296
311
|
export declare function loadRawMutAt<T>(account: RemainingAccount | AccountInfo, offset: u64): Mut<T>;
|
|
297
312
|
/**
|
|
298
313
|
* `capacity` elements of a fixed-size type packed in place from a run-time byte offset, the count known only at run
|
|
@@ -312,8 +327,9 @@ export interface ReadonlyRawArray<T> extends ListMethods<T> {
|
|
|
312
327
|
get(index: bigint): Readonly<T>;
|
|
313
328
|
[Symbol.iterator](): Iterator<Readonly<T>>;
|
|
314
329
|
}
|
|
315
|
-
/** `
|
|
330
|
+
/** A read-only view of `capacity` elements of `T` at `offset` in an account (see RawArray); `rawArrayMutAt` writes. */
|
|
316
331
|
export declare function rawArrayAt<T>(account: RemainingAccount | AccountInfo, offset: u64, capacity: u64): ReadonlyRawArray<T>;
|
|
332
|
+
/** `rawArrayAt` for writing: elements set in place (see RawArray). */
|
|
317
333
|
export declare function rawArrayMutAt<T>(account: RemainingAccount | AccountInfo, offset: u64, capacity: u64): RawArray<T>;
|
|
318
334
|
|
|
319
335
|
/** A node of a RedBlackTree: its key (read-only), its value (in place) and its index in the tree's node array (1-based). */
|
|
@@ -397,6 +413,7 @@ export declare function rbTreeAt<K, V>(
|
|
|
397
413
|
capacity: u64,
|
|
398
414
|
compare?: (a: K, b: K) => bigint,
|
|
399
415
|
): ReadonlyRedBlackTree<K, V>;
|
|
416
|
+
/** `rbTreeAt` for writing: insert, remove and initialize with lib-sokoban's own writes (see RedBlackTree). */
|
|
400
417
|
export declare function rbTreeMutAt<K, V>(
|
|
401
418
|
account: RemainingAccount | AccountInfo,
|
|
402
419
|
offset: u64,
|
|
@@ -432,7 +449,8 @@ export declare function sha256(...parts: (string | Pubkey | Hash | bigint | bool
|
|
|
432
449
|
export declare function keccak256(...parts: (string | Pubkey | Hash | bigint | boolean)[]): Hash;
|
|
433
450
|
|
|
434
451
|
/**
|
|
435
|
-
*
|
|
452
|
+
* Whether `proof` places `leaf` under `root` (keccak256, sorted pairs: the OpenZeppelin convention most airdrop tools
|
|
453
|
+
* use). It does not fail by itself: write `require(merkleVerify(…), error)`; a call whose result is unused is refused.
|
|
436
454
|
* `proof` must be a `Vec<Hash>` instruction argument. Leaves and inner nodes hash alike: build the leaf in the program
|
|
437
455
|
* as OpenZeppelin does, `keccak256(keccak256(data))`, never take it from the arguments (an inner node would pass).
|
|
438
456
|
*/
|
|
@@ -477,15 +495,17 @@ export interface TransactionInstruction {
|
|
|
477
495
|
export declare function stackHeight(): u64;
|
|
478
496
|
|
|
479
497
|
/**
|
|
480
|
-
*
|
|
481
|
-
* signed by `signer` (offsets inside the precompile's own data).
|
|
498
|
+
* Whether this transaction contains an Ed25519 precompile instruction that verified `message`
|
|
499
|
+
* signed by `signer` (offsets inside the precompile's own data). It does not fail by itself: write
|
|
500
|
+
* `require(verifyEd25519(…), error)`; a call whose result is unused is refused. The client adds that instruction;
|
|
482
501
|
* the runtime rejects the transaction if the signature is wrong.
|
|
483
502
|
*/
|
|
484
503
|
export declare function verifyEd25519(instructions: InstructionsSysvar, signer: Pubkey, message: string | Hash | Pubkey): boolean;
|
|
485
504
|
|
|
486
505
|
/**
|
|
487
|
-
*
|
|
488
|
-
*
|
|
506
|
+
* Whether the secp256k1 signer of `hash`, recovered from (r, s, recoveryId), is an Ethereum address given
|
|
507
|
+
* left-padded to 32 bytes (12 zero bytes + 20 address bytes). High-s signatures are refused. It does not fail by
|
|
508
|
+
* itself: write `require(verifySecp256k1(…), error)`; a call whose result is unused is refused.
|
|
489
509
|
* `hash` must be computed in the program — `keccak256(...)` of the message or `ethMessageHash(message)` — because
|
|
490
510
|
* a signature can be made up for an arbitrary hash; the compiler rejects anything else.
|
|
491
511
|
*/
|
|
@@ -844,12 +864,12 @@ export interface TokenMetadataProgram extends AccountMeta {
|
|
|
844
864
|
}
|
|
845
865
|
/** The Metaplex master edition address of a mint (PDA ["metadata", program, mint, "edition"]). */
|
|
846
866
|
export declare function masterEditionAddress(mint: Pubkey): Pubkey;
|
|
847
|
-
/** The canonical program address of `seeds` under `program` (Rust `Pubkey::find_program_address(seeds, program).0`). */
|
|
848
867
|
/**
|
|
849
868
|
* An integer seed with its bytes most significant first (Rust's `x.to_be_bytes()`), inside a seeds list:
|
|
850
869
|
* `["tick_array", pool.key, bigEndian(startIndex)]`. In `Seeds<…>` write `"@startIndex:be"`.
|
|
851
870
|
*/
|
|
852
871
|
export declare function bigEndian(value: bigint): Seed;
|
|
872
|
+
/** The canonical program address of `seeds` under `program` (Rust `Pubkey::find_program_address(seeds, program).0`). */
|
|
853
873
|
export declare function findProgramAddress(seeds: Seed[], program: Pubkey): Pubkey;
|
|
854
874
|
/**
|
|
855
875
|
* `Pubkey::create_program_address(seeds, program)`: the address of these seeds with the bump given as the last seed,
|
|
@@ -912,9 +932,11 @@ export declare function updateExtraAccountMetas(
|
|
|
912
932
|
systemProgram: SystemProgram,
|
|
913
933
|
extraAccounts?: ExtraAccountMeta[],
|
|
914
934
|
): void;
|
|
935
|
+
/** One extra account of a transfer hook's ExtraAccountMetaList: a fixed address, or a PDA from seeds (see initExtraAccountMetas). */
|
|
915
936
|
export type ExtraAccountMeta =
|
|
916
937
|
| { address: Pubkey; isSigner?: boolean; isWritable?: boolean }
|
|
917
938
|
| { seeds: (string | ExtraAccountSeed)[]; program?: bigint; isSigner?: boolean; isWritable?: boolean };
|
|
939
|
+
/** A seed of an extra account resolved by Token-2022 at transfer time (seedAccountKey, seedAccountData, seedInstructionData). */
|
|
918
940
|
export interface ExtraAccountSeed {
|
|
919
941
|
readonly __extraSeed: void;
|
|
920
942
|
}
|
|
@@ -948,7 +970,8 @@ export declare function pubkey(base58: string): Pubkey;
|
|
|
948
970
|
export type Address<A, Base58 extends string, E = never> = A & { readonly __address?: [Base58, E] };
|
|
949
971
|
|
|
950
972
|
/**
|
|
951
|
-
*
|
|
973
|
+
* `Ata<A, "owner", "mint">`: the account must be the associated token account of those parameters (2009).
|
|
974
|
+
* It is one of the token constraints, checked before your code runs:
|
|
952
975
|
* - `HasOne<TokenAccount, "mint" | "owner">`: the token account's mint / owner is the key of the parameter with that name (2014 / 2015).
|
|
953
976
|
* - `HasOne<Mint, "mintAuthority" | "freezeAuthority">`: the mint's authority is that parameter's key (2016 / 2017).
|
|
954
977
|
* - `Ata<TokenAccount, "owner", "mint">`: the account is the associated token account of those parameters (2009).
|
|
@@ -999,8 +1022,8 @@ export declare function closeRaw(account: RemainingAccount | Mut<AccountInfo>, r
|
|
|
999
1022
|
export declare function assignOwner(account: RemainingAccount | Mut<AccountInfo>, owner: Pubkey): void;
|
|
1000
1023
|
|
|
1001
1024
|
/**
|
|
1002
|
-
*
|
|
1003
|
-
*
|
|
1025
|
+
* The fee withheld when `amount` is sent now: the mint's Token-2022 TransferFeeConfig for the current epoch, 0 without
|
|
1026
|
+
* it. Like the other extension readers it takes any account (legacy SPL Token mints have no extensions).
|
|
1004
1027
|
*/
|
|
1005
1028
|
export declare function transferFee(mint: AccountMeta | RemainingAccount, amount: u64): u64;
|
|
1006
1029
|
/**
|
|
@@ -1036,8 +1059,9 @@ export declare function hasExtension(account: AccountMeta | RemainingAccount, ex
|
|
|
1036
1059
|
|
|
1037
1060
|
/** Rent-exempt minimum balance for an account of `space` bytes. */
|
|
1038
1061
|
export declare function rentExempt(space: u64): u64;
|
|
1039
|
-
/** SPL Token account
|
|
1062
|
+
/** SPL Token's token account size, 165 bytes, for systemProgram.createAccount. */
|
|
1040
1063
|
export declare const TOKEN_ACCOUNT_SIZE: u64;
|
|
1064
|
+
/** SPL Token's mint size, 82 bytes. */
|
|
1041
1065
|
export declare const MINT_SIZE: u64;
|
|
1042
1066
|
|
|
1043
1067
|
/** The account must have signed the transaction. Wrap in `Mut<Signer>` to spend its lamports. */
|
|
@@ -1058,11 +1082,11 @@ export interface AccountInfo extends AccountMeta {
|
|
|
1058
1082
|
readonly executable: boolean;
|
|
1059
1083
|
}
|
|
1060
1084
|
|
|
1061
|
-
/**
|
|
1085
|
+
/** An account owned by this program holding struct `T`. Owner, size and discriminator are checked. */
|
|
1062
1086
|
export type Account<T> = Readonly<T> & AccountMeta;
|
|
1063
1087
|
|
|
1064
1088
|
/**
|
|
1065
|
-
*
|
|
1089
|
+
* A writable account: `Mut<T>` is `Account<T>` whose fields may be written. Also usable as `Mut<Signer>`, `Mut<AccountInfo>`, `Mut<TokenAccount>`. A second
|
|
1066
1090
|
* argument fails with one of your errors when the account is not writable (Anchor's `mut @ ErrorCode.X`; else 2000).
|
|
1067
1091
|
*/
|
|
1068
1092
|
export type Mut<T, E = never> = T & AccountMeta;
|
|
@@ -1092,6 +1116,7 @@ export type Seed = string | Pubkey | Hash | bigint | number;
|
|
|
1092
1116
|
export interface SignerSeeds {
|
|
1093
1117
|
readonly __signer_seeds: void;
|
|
1094
1118
|
}
|
|
1119
|
+
/** Name one PDA signature's seeds (with the bump) for CPIs and helpers: `const vault = signer(["vault", owner.key, bump])`. */
|
|
1095
1120
|
export declare function signer(seeds: Seed[]): SignerSeeds;
|
|
1096
1121
|
|
|
1097
1122
|
/**
|
|
@@ -1155,7 +1180,8 @@ export type InitIfNeeded<T> = T extends TokenAccount
|
|
|
1155
1180
|
};
|
|
1156
1181
|
|
|
1157
1182
|
/**
|
|
1158
|
-
*
|
|
1183
|
+
* `HasOne<A, "field">`: the struct's `field` must be the key of the parameter with that name (Anchor's `has_one`; 2001).
|
|
1184
|
+
* It is one of the declarative constraints, checked before your code runs (like Anchor's account attributes):
|
|
1159
1185
|
* - `HasOne<Mut<Vault>, "owner">`: vault.owner must be the key of the parameter named `owner` (union for several).
|
|
1160
1186
|
* - `Seeds<Mut<Vault>, ["vault", "@owner"], "bump">`: the account must be the PDA of these seeds; "@name" is an
|
|
1161
1187
|
* account parameter (its key) or an argument (its bytes), "@acct.field" a Pubkey, integer or unit enum field of a struct
|
|
@@ -1210,6 +1236,11 @@ export interface Migrate<From, To> extends AccountMeta {
|
|
|
1210
1236
|
readonly to: To;
|
|
1211
1237
|
migrate(payer: Mut<Signer>, value: To): void;
|
|
1212
1238
|
}
|
|
1239
|
+
/**
|
|
1240
|
+
* The account is this program's PDA for the seeds (Anchor's `seeds = […], bump`; 2006): `"@name"` is an account's key or
|
|
1241
|
+
* an argument's bytes, `"@acct.field"` a field, other strings literals. `Bump` names a stored bump field, `ProgramId`
|
|
1242
|
+
* another program to derive under.
|
|
1243
|
+
*/
|
|
1213
1244
|
export type Seeds<A, Names extends readonly string[], Bump extends string = never, ProgramId extends string = never> = A & {
|
|
1214
1245
|
readonly __seeds?: [Names, Bump, ProgramId];
|
|
1215
1246
|
/** The PDA's bump (Anchor `ctx.bumps.<account>`): the stored bump field when one is named, else the canonical bump found. */
|
|
@@ -1284,6 +1315,7 @@ export type CorePlugin = (
|
|
|
1284
1315
|
| { kind: "FreezeExecute"; frozen: boolean }
|
|
1285
1316
|
| { kind: "PermanentFreezeExecute"; frozen: boolean }
|
|
1286
1317
|
) & { authority?: CorePluginAuthority };
|
|
1318
|
+
/** The name of a Metaplex Core plugin, as `removePlugin` and the plugin readers take it. */
|
|
1287
1319
|
export type CorePluginKind = CorePlugin["kind"] | "Groups";
|
|
1288
1320
|
/** When a Core lifecycle event reaches an external plugin, and what the plugin may do about it. */
|
|
1289
1321
|
export interface CoreLifecycleCheck {
|
|
@@ -1869,15 +1901,19 @@ export interface CompressedLeaf {
|
|
|
1869
1901
|
index: u32;
|
|
1870
1902
|
}
|
|
1871
1903
|
|
|
1872
|
-
/** The current slot
|
|
1904
|
+
/** The current slot (Clock sysvar). */
|
|
1873
1905
|
export declare function currentSlot(): u64;
|
|
1906
|
+
/** The current epoch (Clock sysvar). */
|
|
1874
1907
|
export declare function currentEpoch(): u64;
|
|
1875
1908
|
/** The Unix time the current epoch started at (Clock.epoch_start_timestamp). */
|
|
1876
1909
|
export declare function epochStartTimestamp(): i64;
|
|
1877
|
-
/** The
|
|
1910
|
+
/** The number of slots in an epoch after warmup (EpochSchedule sysvar). */
|
|
1878
1911
|
export declare function slotsPerEpoch(): u64;
|
|
1912
|
+
/** Whether epochs warm up (EpochSchedule sysvar). */
|
|
1879
1913
|
export declare function epochWarmup(): boolean;
|
|
1914
|
+
/** The first epoch after warmup (EpochSchedule sysvar). */
|
|
1880
1915
|
export declare function firstNormalEpoch(): u64;
|
|
1916
|
+
/** The first slot after warmup (EpochSchedule sysvar). */
|
|
1881
1917
|
export declare function firstNormalSlot(): u64;
|
|
1882
1918
|
/** The LastRestartSlot sysvar: the last slot the cluster restarted at (0 if never). */
|
|
1883
1919
|
export declare function lastRestartSlot(): u64;
|
|
@@ -1903,9 +1939,10 @@ export interface EpochRewards {
|
|
|
1903
1939
|
* needed). Native programs refuse stake operations while `epochRewards().active`.
|
|
1904
1940
|
*/
|
|
1905
1941
|
export declare function epochRewards(): EpochRewards;
|
|
1942
|
+
/** Close the account into the parameter `Destination` when the instruction succeeds (Anchor's `close = destination`). */
|
|
1906
1943
|
export type CloseTo<A, Destination extends string> = A & { readonly __closeTo?: Destination };
|
|
1907
1944
|
|
|
1908
|
-
/**
|
|
1945
|
+
/** An account this instruction creates: at a PDA of this program, or, with `null` seeds, a new keypair account that signs. */
|
|
1909
1946
|
export type Init<T> = T extends TokenAccount
|
|
1910
1947
|
? T & {
|
|
1911
1948
|
/**
|
|
@@ -2222,14 +2259,18 @@ export interface CpiAccount {
|
|
|
2222
2259
|
readonly __cpi_account: void;
|
|
2223
2260
|
}
|
|
2224
2261
|
/**
|
|
2225
|
-
*
|
|
2262
|
+
* A read-only entry of `invoke`'s account list: an account, or remaining accounts spread (`...readonly(rest)`). An
|
|
2263
|
+
* optional account (`A | null`) passed as it is, without `!`, is left out of the CPI's list when it was not passed
|
|
2226
2264
|
* (Rust's `if let Some(a) = &self.a { accounts.push(a) }`, as for `with_remaining_accounts`).
|
|
2227
2265
|
*/
|
|
2228
2266
|
export declare function readonly(account: AccountMeta | RemainingAccount | null): CpiAccount;
|
|
2229
2267
|
export declare function readonly(accounts: RemainingAccounts | RemainingSlice): Iterable<CpiAccount>;
|
|
2268
|
+
/** A writable account entry for `invoke` (the parameter must be `Mut<…>`); an optional account as for `readonly`. */
|
|
2230
2269
|
export declare function writable(account: AccountMeta | RemainingAccount | null): CpiAccount;
|
|
2231
2270
|
export declare function writable(accounts: RemainingAccounts | RemainingSlice): Iterable<CpiAccount>;
|
|
2271
|
+
/** A read-only signer entry for `invoke`: the account signed, or signerSeeds sign for it. */
|
|
2232
2272
|
export declare function readonlySigner(account: AccountMeta | RemainingAccount): CpiAccount;
|
|
2273
|
+
/** A writable signer entry for `invoke`: the account signed, or signerSeeds sign for it. */
|
|
2233
2274
|
export declare function writableSigner(account: AccountMeta | RemainingAccount): CpiAccount;
|
|
2234
2275
|
|
|
2235
2276
|
/** Raw bytes for instruction data. */
|
|
@@ -2250,7 +2291,7 @@ export declare function hex(literal: string): Bytes;
|
|
|
2250
2291
|
export type CpiData = bigint | boolean | Pubkey | Hash | string | null | Bytes | object | number;
|
|
2251
2292
|
|
|
2252
2293
|
/**
|
|
2253
|
-
*
|
|
2294
|
+
* Call any program (a cross-program invocation) with an account list and instruction data. Pass `signerSeeds` (with the bump) to sign for a PDA of this program;
|
|
2254
2295
|
* that PDA can then be marked readonlySigner()/writableSigner().
|
|
2255
2296
|
*/
|
|
2256
2297
|
export declare function invoke(
|
|
@@ -2481,7 +2522,7 @@ export interface InstructionBytes extends IndexedList<u8>, ListMethods<u8> {
|
|
|
2481
2522
|
readPubkey(offset: u64): Pubkey;
|
|
2482
2523
|
}
|
|
2483
2524
|
|
|
2484
|
-
/** Write a string, integer or
|
|
2525
|
+
/** Write a string, integer, Pubkey or Hash to the program log (a Pubkey or Hash as base58). */
|
|
2485
2526
|
export declare function log(value: string | bigint | Pubkey | Hash): void;
|
|
2486
2527
|
|
|
2487
2528
|
/**
|
|
@@ -2548,7 +2589,7 @@ export declare function i128(value: bigint): i128;
|
|
|
2548
2589
|
export declare function mulDiv(a: u64, b: u64, c: u64): u64;
|
|
2549
2590
|
/** ceil(a * b / c), like mulDiv. */
|
|
2550
2591
|
export declare function mulDivCeil(a: u64, b: u64, c: u64): u64;
|
|
2551
|
-
/** floor(sqrt(x)) for unsigned integers
|
|
2592
|
+
/** floor(sqrt(x)) for unsigned integers (u8 … u256). */
|
|
2552
2593
|
export declare function isqrt<T extends bigint>(x: T): T;
|
|
2553
2594
|
|
|
2554
2595
|
/**
|
|
@@ -2557,9 +2598,13 @@ export declare function isqrt<T extends bigint>(x: T): T;
|
|
|
2557
2598
|
* Marginfi's events report I80F48 amounts, and read the bits back with `f64Bits`.
|
|
2558
2599
|
*/
|
|
2559
2600
|
export type f64 = bigint & { readonly __f64: unique symbol };
|
|
2601
|
+
/** An f64 from its IEEE 754 bits, computed with integers. */
|
|
2560
2602
|
export declare function f64FromBits(bits: u64): f64;
|
|
2603
|
+
/** An f64's IEEE 754 bits. */
|
|
2561
2604
|
export declare function f64Bits(value: f64): u64;
|
|
2605
|
+
/** The smaller of two integers of one type. */
|
|
2562
2606
|
export declare function min<T extends bigint>(a: T, b: T): T;
|
|
2607
|
+
/** The larger of two integers of one type. */
|
|
2563
2608
|
export declare function max<T extends bigint>(a: T, b: T): T;
|
|
2564
2609
|
|
|
2565
2610
|
/**
|