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
3 changes: 1 addition & 2 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ inputs:
light-cli-version:
description: "Light CLI version"
required: false
default: "alpha"
default: "beta"
photon-indexer:
description: "Install Photon indexer (required for TypeScript tests)"
required: false
Expand All @@ -29,7 +29,6 @@ runs:
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ inputs.rust-toolchain }}
rustflags: ""
cache-workspaces: ${{ inputs.example || '.' }}

- name: Setup Node.js
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/rust-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ jobs:
- light-token-macro-create-mint
- light-token-macro-create-token-account
- create-and-transfer
# example programs
- escrow
- fundraiser
- light-token-minter
- swap_example
steps:
- uses: actions/checkout@v4

Expand All @@ -54,6 +59,11 @@ jobs:
solana-cli-version: ${{ env.SOLANA_CLI_VERSION }}
rust-toolchain: ${{ env.RUST_TOOLCHAIN }}

- name: Build light-token-minter
if: contains(fromJson('["escrow", "fundraiser", "swap_example"]'), matrix.package)
working-directory: programs/anchor
run: cargo build-sbf --manifest-path light-token-minter/Cargo.toml

- name: Test
working-directory: programs/anchor
run: cargo test-sbf -p ${{ matrix.package }} -- --test-threads=1
4 changes: 2 additions & 2 deletions pinocchio/swap/src/swap/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ pub fn process(
amount: params.amount_in,
authority: ctx.user,
system_program: ctx.system_program,
fee_payer: None,
fee_payer: Some(ctx.user),
}
.invoke()
.map_err(|_| SwapError::InvalidTokenOwner)?;
Expand All @@ -122,7 +122,7 @@ pub fn process(
amount: amount_out,
authority: ctx.pool_authority,
system_program: ctx.system_program,
fee_payer: None,
fee_payer: Some(ctx.user),
}
.invoke_signed(&[signer])
.map_err(|_| SwapError::InvalidTokenOwner)?;
Expand Down
20 changes: 2 additions & 18 deletions pinocchio/swap/tests/sdk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use borsh::BorshDeserialize;
use light_account::LightDiscriminator;
use light_client::interface::{
AccountInterface, AccountSpec, AccountToFetch, ColdContext, LightProgramInterface, PdaSpec,
AccountInterface, AccountSpec, AccountToFetch, LightProgramInterface, PdaSpec,
};
use light_account::token::Token;
use pinocchio_swap::{LightAccountVariant, PoolState, PoolStateSeeds, VaultSeeds};
Expand Down Expand Up @@ -165,23 +165,7 @@ impl SwapSdk {
token_data,
});

// For token vaults, convert ColdContext::Token to ColdContext::Account
// because they're decompressed as PDAs, not as token accounts
// (matches cp-swap pattern)
let interface = if account.is_cold() {
let compressed_account = match &account.cold {
Some(ColdContext::Token(ct)) => ct.account.clone(),
Some(ColdContext::Account(ca)) => ca.clone(),
None => return Err(SwapSdkError::MissingField("cold_context")),
};
AccountInterface {
key: account.key,
account: account.account.clone(),
cold: Some(ColdContext::Account(compressed_account)),
}
} else {
account.clone()
};
let interface = account.clone();

let spec = PdaSpec::new(interface, variant, PROGRAM_ID);
self.pda_specs.insert(account.key, spec);
Expand Down
12 changes: 4 additions & 8 deletions pinocchio/swap/tests/test_lifecycle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,7 @@ async fn test_full_lifecycle() {
destination: user_token_a,
amount: mint_amount_a,
authority: authority.pubkey(),
max_top_up: None,
fee_payer: Some(payer.pubkey()),
fee_payer: payer.pubkey(),
};
rpc.create_and_send_transaction(
&[mint_to_a.instruction().unwrap()],
Expand All @@ -291,8 +290,7 @@ async fn test_full_lifecycle() {
destination: user_token_b,
amount: mint_amount_b,
authority: authority.pubkey(),
max_top_up: None,
fee_payer: Some(payer.pubkey()),
fee_payer: payer.pubkey(),
};
rpc.create_and_send_transaction(
&[mint_to_b.instruction().unwrap()],
Expand All @@ -311,8 +309,7 @@ async fn test_full_lifecycle() {
destination: vault_a,
amount: vault_initial_a,
authority: authority.pubkey(),
max_top_up: None,
fee_payer: Some(payer.pubkey()),
fee_payer: payer.pubkey(),
};
rpc.create_and_send_transaction(
&[mint_to_vault_a.instruction().unwrap()],
Expand All @@ -327,8 +324,7 @@ async fn test_full_lifecycle() {
destination: vault_b,
amount: vault_initial_b,
authority: authority.pubkey(),
max_top_up: None,
fee_payer: Some(payer.pubkey()),
fee_payer: payer.pubkey(),
};
rpc.create_and_send_transaction(
&[mint_to_vault_b.instruction().unwrap()],
Expand Down
26 changes: 8 additions & 18 deletions programs/anchor/Anchor.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,18 @@ skip-lint = false

[workspace]
members = [
"basic-macros/counter",
"basic-macros/create-mint",
"basic-macros/create-associated-token-account",
"basic-macros/create-token-account",
"create-and-transfer",
"basic-instructions/approve",
"basic-instructions/burn",
"basic-instructions/close",
"basic-instructions/create-associated-token-account",
"basic-instructions/create-mint",
"basic-instructions/create-token-account",
"basic-instructions/freeze",
"basic-instructions/mint-to",
"basic-instructions/revoke",
"basic-instructions/thaw",
"basic-instructions/transfer-checked",
"basic-instructions/transfer-interface",
"escrow",
"fundraiser",
"light-token-minter",
"token-swap",
]

[programs.localnet]
escrow = "FKJs6rp6TXJtxzLiPtdYhqa9ExRuBXG2zwh4fda6WATN"
fundraiser = "Eoiuq1dXvHxh6dLx3wh9gj8kSAUpga11krTrbfF5XYsC"
light_token_minter = "3EPJBoxM8Evtv3Wk7R2mSWsrSzUD7WSKAaYugLgpCitV"
swap_example = "AsGVFxWqEn8icRBFQApxJe68x3r9zvfSbmiEzYFATGYn"
counter = "PDAm7XVHEkBvzBYDh8qF3z8NxnYQzPjGQJKcHVmMZpT"
create_and_transfer = "672fL1Nm191MbPoygNM9DRiG2psBELn97XUpGbU3jW7E"

[registry]
url = "https://api.apr.dev"
Expand Down
Loading
Loading