Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 59 additions & 49 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ spl-associated-token-account = { version = "7.0.0", features = [ "no-entrypoint"
solana-system-interface = {version = "2.0.0", features = ["bincode"]}
spl-token-interface = "2.0.0"
spl-associated-token-account-interface = "2.0.0"
spl-token-2022-interface = "2.1.0"
spl-token-2022-interface = "3.0.1"

# pinocchio
pinocchio = { version = "0.10.2", features = ["cpi"] }
Expand Down
12 changes: 9 additions & 3 deletions basics/cross-program-invocation/pinocchio/tests/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ describe("Pinocchio: CPI", async () => {
await client.processTransaction(tx);
}

async function getPowerData() {
const acct = await client.getAccount(powerAccount.publicKey);
if (acct == null) {
assert.fail("expected power account to exist");
}
return Buffer.from(acct.data);
}

it("Initialize the lever!", async () => {
const ix = new TransactionInstruction({
keys: [
Expand Down Expand Up @@ -80,9 +88,7 @@ describe("Pinocchio: CPI", async () => {
assert.deepEqual(Buffer.from(acct.data), Buffer.from([0])); // is_on = false (flipped back)
});

it("Lever rejects switch_power directly with no name", async () => {
// Sending only the discriminator (no name bytes) is fine because UTF-8 of empty is empty,
// but invoking the lever directly with an unknown discriminator should fail.
it("Lever rejects an unknown discriminator", async () => {
const ix = new TransactionInstruction({
keys: [{ pubkey: powerAccount.publicKey, isSigner: false, isWritable: true }],
programId: LEVER_PROGRAM_ID,
Expand Down
2 changes: 1 addition & 1 deletion biome.jsonc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://biomejs.dev/schemas/2.4.12/schema.json",
"$schema": "https://biomejs.dev/schemas/2.5.0/schema.json",
"files": {
"includes": ["**", "!**/Assets"]
},
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.