@typesol/cli 0.47.0 → 0.49.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.
Files changed (53) hide show
  1. package/CHANGELOG.md +299 -0
  2. package/NOTICE +17 -0
  3. package/README.md +106 -37
  4. package/SECURITY.md +5 -0
  5. package/dist/compiler/emit/base.d.ts +12 -4
  6. package/dist/compiler/emit/base.js +19 -5
  7. package/dist/compiler/emit/calls.js +59 -1
  8. package/dist/compiler/emit/cpi.js +3 -1
  9. package/dist/compiler/emit/expressions.js +3 -1
  10. package/dist/compiler/emit/function.js +7 -2
  11. package/dist/compiler/emit/program.js +9 -4
  12. package/dist/compiler/emit/statements.d.ts +29 -2
  13. package/dist/compiler/emit/statements.js +149 -6
  14. package/dist/compiler/emit/storage.js +8 -3
  15. package/dist/compiler/emit/token.js +18 -1
  16. package/dist/compiler/hints.js +3 -0
  17. package/dist/compiler/toolchain.js +1 -0
  18. package/dist/idl-coder.d.ts +21 -2
  19. package/dist/idl-coder.js +42 -4
  20. package/dist/testing.d.ts +14 -3
  21. package/dist/testing.js +87 -17
  22. package/docker/deps/0.48.0.lock.json +1206 -0
  23. package/docker/deps/0.49.0.lock.json +1206 -0
  24. package/docs/architecture.md +2 -2
  25. package/docs/audit.md +31 -15
  26. package/docs/case-study-escrow.md +7 -5
  27. package/docs/case-study-marginfi.md +15 -2
  28. package/docs/case-study-multisig.md +2 -1
  29. package/docs/case-study-raydium-amm.md +2 -1
  30. package/docs/case-study-spl-stake-pool.md +4 -3
  31. package/docs/language-accounts.md +5 -6
  32. package/docs/language-basics.md +2 -1
  33. package/docs/language-builtins.md +5 -1
  34. package/docs/language-chain.md +13 -1
  35. package/docs/language-cpi.md +26 -0
  36. package/docs/language-errors-events.md +16 -1
  37. package/docs/language-native.md +23 -3
  38. package/docs/language-statements.md +4 -2
  39. package/docs/language.md +2 -2
  40. package/docs/mainnet.md +1 -1
  41. package/docs/runtime.md +7 -0
  42. package/docs/security-model.md +11 -4
  43. package/docs/stability.md +9 -4
  44. package/docs/test-your-program.md +43 -4
  45. package/docs/testing.md +16 -4
  46. package/docs/troubleshooting.md +1 -1
  47. package/lib/typesol.d.ts +46 -1
  48. package/llms-full.txt +164 -34
  49. package/llms.txt +2 -1
  50. package/package.json +3 -3
  51. package/releases/0.47.0.json +837 -0
  52. package/releases/0.48.0.json +847 -0
  53. package/runtime/typesol_rt.h +276 -1
package/docs/stability.md CHANGED
@@ -61,14 +61,17 @@ Meant to stay as they are; a change before 1.0 would be a breaking change listed
61
61
 
62
62
  ## What builds the same bytes where
63
63
 
64
- From 0.45.0 on, the programs measured build to the same bytes on each host measured. Measured with this release's
64
+ From 0.45.0 on, the programs measured build to the same bytes on each host measured. Measured with 0.45.0's
65
65
  compiler and platform-tools v1.52 on macOS arm64 (the platform-tools `osx-aarch64` package, native), Linux arm64 and
66
66
  Linux x86_64 (the `linux-aarch64` and `linux-x86_64` packages, in containers; x86_64 is the `--docker` image; Linux
67
67
  arm64 has no Agave CLI, so there the package is set up by hand with `TYPESOL_SBF_SDK`, as in
68
68
  [troubleshooting.md](troubleshooting.md#linux-arm64-the-agave-installer-fails-with-a-404)): for
69
- SBPF v0 (the default), the 76 programs of the sources (`scripts/release-manifest.ts`, every program under `examples/`
70
- and `showcase/`); for SBPF v1 and v2, the 14 programs of `test/golden/binaries.json` (counter, vault, escrow, multisig
71
- and the 10 below).
69
+ SBPF v0 (the default), the 76 programs then in the sources (`scripts/release-manifest.ts`, every program under
70
+ `examples/` and `showcase/`); for SBPF v1 and v2, the 14 programs of `test/golden/binaries.json` (counter, vault,
71
+ escrow, multisig and the 10 below). Programs added since were not measured on the three hosts, and two of them that
72
+ divide 128-bit and wider integers, the Meteora DBC port (0.48.0; u128 and u256 division) and the Percolator port
73
+ (0.49.0; U256 and U512), are not in `test/golden/binaries.json`, so CI's cross-host check does not build them yet
74
+ (adding them needs the file regenerated in the `--docker` reference environment).
72
75
 
73
76
  | What | Same on the three hosts? |
74
77
  | --- | --- |
@@ -126,6 +129,8 @@ Useful today, but may still change before 1.0 (each change listed in the CHANGEL
126
129
  its panics in solana-program 1.14–1.17's format, `removeAt(index)` (what it gives for a node in no tree may change).
127
130
  - `panic(null, location)` (no log line) and `abort()` (Rust's abort, "SBF program panicked") (0.42.0).
128
131
  - Failures without a log line (0.43.0): `ERROR_LOG_PREFIX = null` / `PROGRAM_ERROR_LOG_PREFIX = null`.
132
+ - `EVENT_AUTHORITY_CHECK = "address"` (0.48.0): `emitCpi`'s event authority checked by address, as Anchor 1.x's
133
+ `#[event_cpi]` does, and the self-program account not checked (docs/security-model.md, guarantee 13).
129
134
  - `findProgramAddressWithBump` (0.43.0), with `const [address, bump] = …` its only array destructuring.
130
135
  - Plain type aliases (0.43.0): `type Price = u64`, replaced by the type they name.
131
136
  - File-local structs (0.43.0): `interface Pair { … }` without `export`, for helpers and locals, out of the IDL.
@@ -34,7 +34,13 @@ instruction that takes the bump as an argument (prefer a stored bump:
34
34
  constants, arguments or other accounts' keys (`t.ix("initialize", {}, { authority: alice })` derives `counter`). Pass a keypair for an account that
35
35
  signs, an address otherwise, and `null` to leave an optional account out.
36
36
  - **Arguments as plain values:** bigints or numbers for integers, address strings for Pubkeys, `null` for an empty
37
- Option, objects for structs (camelCase or snake_case fields), arrays for Vecs.
37
+ Option, objects for structs (camelCase or snake_case fields), arrays for Vecs, `{ Variant: { field: value } }` for a
38
+ data enum (a unit enum also as its index or variant name). Every argument and every field of a struct or variant
39
+ must be given, except an Option, which left out is None. A missing one is an error that names it and lists the
40
+ instruction's arguments (`set: argument "amount" is missing (it takes amount, cap, frame, shape; …)`,
41
+ `set(frame).origin.y is missing (Point has x, y; …)`), and so is a key that names no argument or field
42
+ (`set has no argument "amonut" (it takes amount, cap, frame, shape)`), so a misspelt name is never sent as zeros
43
+ or as None.
38
44
  - **Remaining accounts:** `[{ address, writable?, signer? }]`, where `signer` is the account's `KeyPairSigner` (it then
39
45
  signs as a signer account; `writable` defaults to false).
40
46
 
@@ -66,8 +72,9 @@ looks like one.
66
72
  | --- | --- |
67
73
  | `t.ok(res)` | the successful result, or throws with the error, its name (`NotAdmin`) and the program's logs |
68
74
  | `t.errorCode(res)` | the custom error code of a failed transaction: 6000 + the member's index in your error enum, or a framework code ([errors.md](errors.md)) |
69
- | `t.account(type, address)` | the account decoded by its IDL type (bigints, address strings), or `null` once closed. TypeSOL fixed layouts come back as their IDL structs: a `FixedString<N>` as `{ len, bytes }`, a `FixedVec<T, N>` as `{ len, items }` (the generated client gives strings and arrays) |
75
+ | `t.account(type, address)` | the account decoded by its IDL type (bigints, address strings), or `null` once closed. A `FixedString<N>` comes back as a string and a fixed-layout Option as its value or `null`; a `FixedVec<T, N>` as its IDL struct `{ len, items }` (the generated client gives an array) |
70
76
  | `t.returned(instruction, res)` | the instruction's return data: an integer, boolean, Pubkey or struct |
77
+ | `t.events(res)` | the events the transaction emitted, decoded, in order: `[{ name, data }]` ([events](#events)) |
71
78
  | `t.balance(address)` | lamports |
72
79
  | `t.errorName(code)` | the name of an error code: your program's, TypeSOL's or Anchor's |
73
80
  | `t.connection` | `{ rpc, rpcSubscriptions }` answered by this LiteSVM, for the generated client: `counter.sendInstructions(t.connection, alice, [ix])`, `counter.accounts.Counter.fetch(t.connection.rpc, address)`, views, `resolve`, `watch` and `watchEvents` (as on a cluster: `watch` yields when a later transaction changes the account, not at once; `watchEvents` gets transactions sent after it subscribed, failed ones included in the stream and skipped by the client) |
@@ -88,6 +95,38 @@ expect(t.errorName(t.errorCode(res))).toBe("TooMuch");
88
95
  `t.errorCode` throws when the transaction succeeded or failed without a custom code (a runtime error such as missing
89
96
  signatures), so the test fails then too.
90
97
 
98
+ ### Events
99
+
100
+ `t.events(res)` decodes the events of a successful transaction (it throws as `t.ok` does when it failed), in the
101
+ order the program emitted them: `emit`'s `Program data:` log lines and `emitCpi`'s self-CPIs alike, only this
102
+ program's. Each is `{ name, data }`, the fields as `t.account` gives them (bigints, address strings, a `FixedString`
103
+ as a string).
104
+
105
+ For a program that emits
106
+
107
+ ```ts
108
+ export interface Deposited {
109
+ owner: Pubkey;
110
+ amount: u64;
111
+ memo: string;
112
+ referrer: Option<Pubkey>;
113
+ }
114
+
115
+ export function deposit(owner: Signer, amount: u64): void {
116
+ emit<Deposited>({ owner: owner.key, amount, memo: "thanks", referrer: null });
117
+ }
118
+ ```
119
+
120
+ a test asserts
121
+
122
+ ```ts
123
+ const res = await t.send(alice, t.ix("deposit", { amount: 5n }, { owner: alice }));
124
+ expect(t.events(res)).toEqual([{ name: "Deposited", data: { owner: alice.address, amount: 5n, memo: "thanks", referrer: null } }]);
125
+ ```
126
+
127
+ Log lines past the runtime's log limit are cut off, and the events in them with them. See [events](language-errors-events.md#events) for
128
+ what a program can emit.
129
+
91
130
  ## Tokens and time
92
131
 
93
132
  | Helper | Does |
@@ -110,8 +149,8 @@ program you loaded yourself, and `svmConnection(svm)` the RPC pair alone (for an
110
149
  program loaded). Transactions sent through it run at once; `getProgramAccounts` (`fetchAll`) sees the accounts those
111
150
  transactions named, plus any you `track(...)`.
112
151
 
113
- The module needs `litesvm`, which `typesol init` adds to `devDependencies`. It encodes arguments and decodes accounts
114
- and return data from the IDL with its own Borsh coder, so Anchor's TypeScript package is not needed.
152
+ The module needs `litesvm`, which `typesol init` adds to `devDependencies`. It encodes arguments and decodes accounts,
153
+ return data and events from the IDL with its own Borsh coder, so Anchor's TypeScript package is not needed.
115
154
 
116
155
  ## Epochs and staking
117
156
 
package/docs/testing.md CHANGED
@@ -1,7 +1,10 @@
1
1
  # How TypeSOL is tested
2
2
 
3
3
  Besides unit tests, these checks run the compiled programs (LiteSVM) against an independent oracle. Every randomized
4
- run prints its seed; reproduce with `FUZZ_SEED=<n>`, widen with `FUZZ_RUNS` / `FUZZ_STEPS` (`pnpm fuzz` runs them wide).
4
+ run prints its seed or runs fixed ones; reproduce with `FUZZ_SEED=<n>`, widen with `FUZZ_RUNS` / `FUZZ_STEPS` (`pnpm
5
+ fuzz` runs them wide). Most take a new seed from the clock on every run, CI's included; the Phoenix, Percolator and
6
+ Raydium AMM v4 walks run fixed seeds unless `FUZZ_SEED` (or the Percolator variables) names another, so CI walks the
7
+ same ones every time.
5
8
 
6
9
  | Check | Oracle | What must hold |
7
10
  | --- | --- | --- |
@@ -13,8 +16,13 @@ run prints its seed; reproduce with `FUZZ_SEED=<n>`, widen with `FUZZ_RUNS` / `F
13
16
  | `showcase/test/fuzz-jito.test.ts` | Jito's tip payment, tip distribution and priority fee distribution as deployed on mainnet | random sequences of tips, receiver and builder changes, accounts opened over epochs, roots uploaded, Merkle claims (wrong amounts, proofs and signers among them), closes and config changes, with at most one injected fault per transaction: the same outcome, account bytes, events and log lines as the original after every step; keys, amounts and choices all come from the seed |
14
17
  | `showcase/test/fuzz-marginfi.test.ts` | Marginfi v2 as deployed on mainnet | random sequences of bank creation (random weights, curves and fees, most valid, some broken one way), configuration (operational states, curves, liquidation fees, the circuit breaker's switch and settings, frozen banks), accruals over balances written into both at every scale and clock jumps up to a year, limits, pauses, wrong signers: the same outcome, account bytes and events as the original after every step; inputs the original panics on (a negative fee rate) must fail in the port too |
15
18
  | the `fuzz:` case of `showcase/test/raydium-clmm.test.ts` | Raydium CLMM as deployed on mainnet | random swaps (both ways, exact in and out, price limits, thresholds), positions opened at random ranges, and liquidity added and taken out (over the position's own, under slippage limits): the same outcome, account bytes and events as the original after every step; choices and amounts come from the seed (`CLMM_FUZZ_STEPS` lengthens it), keys are fresh each run; each transaction may use 1.4M compute units, so a swap the original needs more than 200,000 for still runs to its end |
19
+ | the `fuzz:` case of `showcase/test/raydium-cp-swap.test.ts` | Raydium CP-Swap as deployed on mainnet | random swaps both ways, deposits, withdrawals and fee collections over time, in an SPL Token pool and a pool of Token-2022 fee mints, each with the creator fee on in a random mode: the same outcome, account bytes and events as the original after every step; choices and amounts come from the seed, a new one each run (`CP_FUZZ_STEPS` lengthens it, 120 by default), keys are fresh each run |
20
+ | the last case of `showcase/test/raydium-amm.test.ts` | Raydium AMM v4 as deployed on mainnet | random swaps, deposits and withdrawals on one pool: the same outcome, log lines and account bytes as the original after every step; seed 7 unless `FUZZ_SEED` names another, 60 steps (`FUZZ_STEPS`) |
21
+ | `showcase/test/meteora-dbc-fuzz.test.ts`, `showcase/test/meteora-dbc-migration-fuzz.test.ts` | Meteora DBC 0.2.2 as deployed on mainnet (and DAMM v2, the locker, DAMM v1 and the dynamic vault for the migrations) | random configs drawn around their valid values and edges (200 by default), and random graduations (10 pools by default: a random config, swaps to the threshold, the locker, the surplus and fee withdrawals and the migration into DAMM v2 or DAMM v1 in a random order): the same outcome, account bytes, inner instructions and events as the original; a new seed each run (`FUZZ_RUNS` lengthens them) |
16
22
  | `showcase/test/spl-stake-pool-fuzz.test.ts` | SPL Stake Pool as deployed on mainnet | a random walk over many epochs: validators added and removed, deposits, withdrawals, stake increased and decreased, rewards and tips at each epoch boundary, some steps wrong on purpose; every step gives the same outcome, logs and account bytes as the original, and every account the walk knows is compared after each epoch and every 25 steps; choices and amounts come from the seed (`STAKE_POOL_FUZZ_STEPS` lengthens it, `STAKE_POOL_FUZZ_SWEEP=1` compares every account after each step), keys are fresh each run |
17
23
  | `showcase/test/phoenix-fuzz.test.ts` | Phoenix v1 as deployed on mainnet, and a balance model | a random walk over two order books (512/128 and 4096/8321, each started nearly full): every kind of order, reductions and cancels, seats, evictions, fee collection, status changes, a moving clock and invalid packets; every step gives the same outcome, logs, inner instructions, return data and account bytes as the original, and after each step every trader's locked and free lots plus the uncollected fees equal what the vaults hold; choices and every key come from the seed, CI walks seeds 1, 2 and 3 (300 steps on each market) and requires minimum counts of fills, evictions, expiries and fees (`PHOENIX_FUZZ_STEPS` changes the length) |
24
+ | `showcase/test/percolator-fuzz.test.ts` | Percolator v12.20 as deployed on mainnet | three random walks (accounts; oracle and market shapes; leveraged trades with crashes, liquidations and side resets) over markets of random shape (Pyth or Hyperp, fees, margins, warm-up, caps): opens, deposits, withdrawals, trades (TradeNoCpi, and TradeCpi through a matcher run under both), price crashes and spikes, liquidations, cranks with random hints, catch-ups, conversions, config changes, clock moves past the accrual envelope; then each market's end: bounded insurance withdrawals, resolution by the admin or by anyone after the hard timeout, every account closed out in random order by the three resolved closes, WithdrawInsurance and CloseSlab. Every step gives the same outcome, logs, inner instructions, return data and account bytes as the original, the vault and every token account are compared again at the end, and the port must use fewer compute units than the original on every successful transaction; choices and every key come from the seed; fixed seeds by default (1 to 6 for the account walk and the walk of leveraged trades and liquidations, two per oracle shape), the same in CI (`PERCOLATOR_FUZZ_RUNS`, `PERCOLATOR_FUZZ_STEPS`, `PERCOLATOR_ORACLE_RUNS`, `PERCOLATOR_ORACLE_STEPS`, `PERCOLATOR_ADL_RUNS`, `PERCOLATOR_ADL_STEPS`) |
25
+ | `showcase/test/percolator-mutate-*.test.ts` | Percolator v12.20 as deployed on mainnet | mutation fuzzers over a valid transaction of each of the 27 instructions in eleven market states (empty, funded, open positions, a reset-pending side, resolved with accounts, resolved with insurance only, resolved and bare, matured-stale, Hyperp, Chainlink, inverted): the account list (accounts replaced by every other account of the test world, duplicated, dropped, appended, swapped, signer and writable flags flipped; every position replaced by the slab and by the fee payer and duplicated into every other), the instruction data (every truncation, appended bytes, each field at its boundaries and around the limits the program checks, random bytes, all 256 tags, KeeperCrank candidate lists), the environment (several instructions per transaction, a relay calling at stack height 2, compute-unit limits below the original's, Clock extremes and the Clock moved backwards, Pyth and Chainlink accounts at every extreme) and the slab (every header, config, engine, account, free-list, bitmap, risk-buffer and generation field at its boundary values, random bytes, an inconsistent free list), each transaction compared with `both()`; choices and keys from `PERCOLATOR_MUTATE_SEED` (fixed), sizes from `PERCOLATOR_MUTATE_SCALE`; a tally of outcomes per category printed |
18
26
  | `test/verification/rbtree-trace.test.ts` | lib-sokoban 0.3.0 itself (`test/verification/rbtree/oracle`, a Rust program that records traces) | the built-in RedBlackTree replays 21,650 recorded operations (capacities 1 to 4096; u64 keys, Phoenix's order ids with their comparator, Pubkey keys), one a transaction: after each the tree's bytes (root, allocator, every node, freed ones included) hash as the crate's did and the operation returns what the crate's returned; a second pass replays every `remove(key)` as `removeAt(addrOf(key))`; `RBTREE_TRACES=<file>` replays another set |
19
27
  | `test/verification/differential.test.ts` | Anchor twins in `test/anchor-twins` | identical transactions to TypeSOL and Anchor programs: same outcomes, same account contents, same wallet and token balances after every step |
20
28
  | `showcase/test/porting/ports-*.test.ts` | the Anchor programs of solana-developers/program-examples and their tests | TypeSOL rewrites under `showcase/program-examples/` run the originals' flows and failure paths with the same outcomes, error codes and balances ([showcase/program-examples/README.md](https://github.com/typesol-lang/typesol/blob/main/showcase/program-examples/README.md)) |
@@ -49,7 +57,8 @@ or later):
49
57
 
50
58
  - the compiler and toolchain versions (clang, platform-tools, Node, TypeScript, the sha256 of the runtime header and,
51
59
  from 0.45.0 on, of the runtime's compiler builtins);
52
- - the sha256 of the SBF binary, IDL and C that every program under `examples/` and `showcase/program-examples/` builds to;
60
+ - the sha256 of the SBF binary, IDL and C that every program under `examples/`, `showcase/mainnet/` and
61
+ `showcase/program-examples/` builds to (`scripts/release-manifest.ts`);
53
62
  - the sha256 of the reference binaries the differential tests run against (`test/programs/`);
54
63
  - a hash of the test corpus.
55
64
 
@@ -72,7 +81,7 @@ the same binary and IDL with both packages.
72
81
  ### Across hosts
73
82
 
74
83
  From 0.45.0 on the C, IDL and linked binary TypeSOL's builds produce are the same on the hosts measured
75
- ([stability.md](stability.md#what-builds-the-same-bytes-where) has the measurement over 76 programs on macOS arm64,
84
+ ([stability.md](stability.md#what-builds-the-same-bytes-where) has the measurement with 0.45.0 over 76 programs on macOS arm64,
76
85
  Linux arm64 and Linux x86_64, and why 0.44.1 and earlier differed for programs with 128-bit or signed division). The
77
86
  reference environment is the `--docker` build container (linux/amd64). `test/golden/binaries.json` holds what 14
78
87
  programs build to there with the checkout's compiler: counter, vault, escrow, multisig, and the 10 that call 128-bit or
@@ -110,7 +119,10 @@ From 0.43.0 on, `releases/<version>.json` in the repository describes the packag
110
119
  tarball's size, sha1 shasum and sha512 integrity (the registry's `dist.shasum` and `dist.integrity`), and the sha256
111
120
  of every file in it. `scripts/release-check.ts` writes it from a clean export of the tag (`git archive`: install with
112
121
  the lockfile, build, lint, check the version and the CHANGELOG section, `npm pack`), and the maintainer publishes the
113
- tarball it produced, by hand ([CONTRIBUTING.md](https://github.com/typesol-lang/typesol/blob/main/CONTRIBUTING.md#releasing)). To check a release yourself:
122
+ tarball it produced, by hand ([CONTRIBUTING.md](https://github.com/typesol-lang/typesol/blob/main/CONTRIBUTING.md#releasing)). Its `"tests"`
123
+ field says whether `release-check.ts` also ran the test suite on that export (`--tests`); it is `false` in the records
124
+ so far because the documented release steps run `pnpm test` before tagging and the check does not repeat it.
125
+ To check a release yourself:
114
126
 
115
127
  ```sh
116
128
  node scripts/release-check.ts 0.43.0 # pack the tag again: git diff releases/ shows what moved
@@ -93,7 +93,7 @@ an account you change is a `Mut<T>` parameter; the time is `now()`, not `Date.no
93
93
  ### A transaction fails with a custom error
94
94
 
95
95
  See [errors.md](errors.md). Failures raised by the compiler's checks log their TypeScript location, e.g. `TypeSOL:
96
- arithmetic overflow (vault.ts:42)`.
96
+ arithmetic overflow (vault.ts:44)`.
97
97
 
98
98
  ### "exceeded CUs meter" / "Computational budget exceeded"
99
99
 
package/lib/typesol.d.ts CHANGED
@@ -240,6 +240,8 @@ export interface RemainingAccount {
240
240
  readonly dataLen: u64;
241
241
  readonly isSigner: boolean;
242
242
  readonly isWritable: boolean;
243
+ /** Whether the account is an executable program (AccountInfo::executable). */
244
+ readonly executable: boolean;
243
245
  }
244
246
 
245
247
  /**
@@ -493,6 +495,18 @@ export interface TransactionInstruction {
493
495
  * program invoked it. `require(stackHeight() === 1n, …)` refuses CPI callers.
494
496
  */
495
497
  export declare function stackHeight(): u64;
498
+ /**
499
+ * How many instructions the caller of this program has already invoked at this program's stack height (its processed
500
+ * siblings), or, when the transaction calls this program directly, how many top-level instructions ran before this one
501
+ * (Rust's `get_processed_sibling_instruction(i)` until it returns None).
502
+ */
503
+ export declare function processedSiblingInstructionCount(): u64;
504
+ /**
505
+ * Processed sibling instruction `index` (0 the latest), as Rust's `get_processed_sibling_instruction(index)` reads it
506
+ * with the `sol_get_processed_sibling_instruction` syscall: its program id, accounts and data, as a
507
+ * TransactionInstruction. 5104 when there is none at that index.
508
+ */
509
+ export declare function processedSiblingInstruction(index: u64): TransactionInstruction;
496
510
 
497
511
  /**
498
512
  * Whether this transaction contains an Ed25519 precompile instruction that verified `message`
@@ -2083,6 +2097,21 @@ type MintArg = Mint | AccountInfo | RemainingAccount;
2083
2097
  interface TokenOps {
2084
2098
  transfer(from: TokenAccountArg, to: TokenAccountArg, authority: AccountMeta, amount: u64, signerSeeds?: Seed[] | SignerSeeds): void;
2085
2099
  transferChecked(from: TokenAccountArg, mint: MintArg, to: TokenAccountArg, authority: AccountMeta, amount: u64, signerSeeds?: Seed[] | SignerSeeds): void;
2100
+ /**
2101
+ * transferChecked for a Token-2022 mint with a transfer hook: the hook's extra accounts are resolved from its
2102
+ * validation account (["extra-account-metas", mint] of the hook program) among `hookAccounts` and appended, then the
2103
+ * validation account and the hook program, as spl-transfer-hook-interface's `add_extra_accounts_for_execute_cpi`
2104
+ * does (its refusals and error codes included). Without a hook program on the mint, a plain transferChecked.
2105
+ */
2106
+ transferCheckedWithHook(
2107
+ from: TokenAccountArg,
2108
+ mint: MintArg,
2109
+ to: TokenAccountArg,
2110
+ authority: AccountMeta,
2111
+ amount: u64,
2112
+ hookAccounts: RemainingAccounts | RemainingSlice,
2113
+ signerSeeds?: Seed[] | SignerSeeds,
2114
+ ): void;
2086
2115
  /** `mint`: a Mut<Mint>, or a mint this instruction created and initialized (Mut<Signer> / Mut<AccountInfo>). */
2087
2116
  /** `to`: a Mut<TokenAccount>, or a Mut<AccountInfo> token account this instruction created (e.g. with `ata.create`). */
2088
2117
  mintTo(mint: MintArg | AccountMeta, to: TokenAccountArg, authority: AccountMeta, amount: u64, signerSeeds?: Seed[] | SignerSeeds): void;
@@ -2461,7 +2490,8 @@ export declare enum ProgramError {
2461
2490
  * own: `panic(null, "src/lib.rs:105:19")` leaves only the runtime's "SBF program Panicked in src/lib.rs at 105:19".
2462
2491
  * Under `export const PANIC_STYLE = "solana-1.14"` (a program built with solana-program 1.14 to 1.17) it logs
2463
2492
  * `panicked at '<message>', <location>` and aborts, so the runtime reports "SBF program panicked", as that panic
2464
- * handler does; a message is then required.
2493
+ * handler does; under `"solana-1.18"` (rustc 1.73 and later) it logs `panicked at <location>:` with the message on the
2494
+ * next line, in one log line, and aborts. A message is then required.
2465
2495
  */
2466
2496
  export declare function panic(message?: string | null, location?: string): never;
2467
2497
  /**
@@ -2557,6 +2587,21 @@ export declare function setReturnData(bytes: IndexedList<u8>): void;
2557
2587
  */
2558
2588
  export declare function logComputeUnits(): void;
2559
2589
 
2590
+ /**
2591
+ * Log five u64 values as Rust's `sol_log_64(a, b, c, d, e)` does: the runtime writes
2592
+ * "Program log: 0x<a>, 0x<b>, 0x<c>, 0x<d>, 0x<e>" (lowercase hex, no padding). For native ports whose original logs
2593
+ * numbers this way.
2594
+ */
2595
+ export declare function log64(a: u64, b: u64, c: u64, d: u64, e: u64): void;
2596
+
2597
+ /**
2598
+ * Zero `length` bytes of an account's data from `offset`, as a native program's
2599
+ * `for b in data[offset..offset + length].iter_mut() { *b = 0; }` (a memset): the memset syscall, about constant compute
2600
+ * units whatever the length. A remaining account (or a `Mut<AccountInfo>` parameter); past the end of the data fails
2601
+ * with 3003 and writes nothing. Only this program's accounts can change: check the owner first.
2602
+ */
2603
+ export declare function zeroData(account: RemainingAccount | Mut<AccountInfo>, offset: u64, length: u64): void;
2604
+
2560
2605
  /**
2561
2606
  * Verify `account.key` is the PDA for `seeds` + `bump` under this program. Any bump that gives a PDA passes (Anchor's
2562
2607
  * `bump = expr`): use a stored bump, not one from the arguments, or the caller picks among up to 256 addresses.