Commit 1305207
authored
add pinocchio cross-program-invocation example (#584)
Ports the hand+lever CPI example from anchor/native to Pinocchio.
- Two-program workspace: hand (caller) and lever (callee).
- Lever exposes initialize and switch_power instructions via a 1-byte
discriminator; uses pinocchio-system::CreateAccount for account
allocation under its own program id.
- Hand forwards switch_power(name) over CPI to lever, building the
cross-program Instruction on the stack (no_std, no allocator).
- Bankrun TS test exercises the full init -> pull -> pull-again flow
plus an invalid-discriminator rejection case.1 parent 63c36fe commit 1305207
11 files changed
Lines changed: 1655 additions & 0 deletions
File tree
- basics/cross-program-invocation/pinocchio
- programs
- hand
- src
- lever
- src
- tests
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
0 commit comments