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
4 changes: 2 additions & 2 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ inputs:
solana-cli-version:
description: "Solana CLI version"
required: false
default: "2.1.21"
default: "2.3.11"
rust-toolchain:
description: "Rust toolchain version"
required: false
default: "1.85.0"
default: "1.90.0"
light-cli-version:
description: "Light CLI version"
required: false
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/rust-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Rust

on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
SOLANA_CLI_VERSION: "2.3.11"
RUST_TOOLCHAIN: "1.90.0"

jobs:
rust-client:
name: rust-client
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup environment
uses: ./.github/actions/setup
with:
solana-cli-version: ${{ env.SOLANA_CLI_VERSION }}
rust-toolchain: ${{ env.RUST_TOOLCHAIN }}

- name: Run tests
working-directory: rust-client
run: cargo test

30 changes: 24 additions & 6 deletions .github/workflows/typescript-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ concurrency:
cancel-in-progress: true

env:
SOLANA_CLI_VERSION: "2.1.21"
SOLANA_CLI_VERSION: "2.3.11"
RUST_TOOLCHAIN: "1.90.0"
NODE_VERSION: "22"
PHOTON_REV: "1a785036de52896b68d06413e3b0231122d6aa4a"

jobs:
typescript-tests:
Expand All @@ -30,6 +32,7 @@ jobs:
node-version: ${{ env.NODE_VERSION }}

- name: Cache Solana CLI tools
id: cache-solana
uses: actions/cache@v4
with:
path: |
Expand All @@ -38,32 +41,38 @@ jobs:
key: solana-cli-${{ runner.os }}-${{ env.SOLANA_CLI_VERSION }}

- name: Install Solana CLI tools
if: steps.cache-solana.outputs.cache-hit != 'true'
run: |
sh -c "$(curl -sSfL https://release.anza.xyz/v${{ env.SOLANA_CLI_VERSION }}/install)"
echo "/home/runner/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH

- name: Add Solana to PATH
run: echo "/home/runner/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH

- name: Install Light CLI
run: npm install -g @lightprotocol/zk-compression-cli@alpha

- name: Install Rust (for Photon)
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
toolchain: ${{ env.RUST_TOOLCHAIN }}
cache: false

- name: Cache Photon indexer
id: cache-photon
uses: actions/cache@v4
with:
path: ~/.cargo/bin/photon
key: photon-${{ runner.os }}-1a785036de52896b68d06413e3b0231122d6aa4a
key: photon-${{ runner.os }}-${{ env.PHOTON_REV }}

- name: Install Photon indexer
if: steps.cache-photon.outputs.cache-hit != 'true'
run: cargo install --git https://github.com/lightprotocol/photon.git --rev 1a785036de52896b68d06413e3b0231122d6aa4a --locked
run: cargo install --git https://github.com/lightprotocol/photon.git --rev ${{ env.PHOTON_REV }} --locked
env:
RUSTFLAGS: "-A dead-code"

- name: Add cargo bin to PATH
run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH

- name: Generate keypair
run: solana-keygen new --no-bip39-passphrase

Expand All @@ -74,7 +83,16 @@ jobs:
- name: Start test validator
run: |
light test-validator &
sleep 15
sleep 30
# Wait for Photon indexer to be ready
for i in {1..30}; do
if curl -s http://127.0.0.1:8784/health > /dev/null 2>&1; then
echo "Photon indexer is ready"
break
fi
echo "Waiting for Photon... ($i/30)"
sleep 2
done

- name: Run actions
working-directory: typescript-client
Expand Down
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ TypeScript examples for light-token-sdk.
- [Action](typescript-client/actions/create-mint.ts) | [Instruction](typescript-client/instructions/create-mint.ts)
- **create-ata** - Create an associated light-token account
- [Action](typescript-client/actions/create-ata.ts) | [Instruction](typescript-client/instructions/create-ata.ts)
- **load-ata** - Load cold token account to hot balance
- **load-ata** - Load token accounts from light-token, compressed tokens, SPL/T22 to one unified balance.
- [Action](typescript-client/actions/load-ata.ts) | [Instruction](typescript-client/instructions/load-ata.ts)
- **mint-to** - Mint tokens to a light-account
- [Action](typescript-client/actions/mint-to.ts) | [Instruction](typescript-client/instructions/mint-to.ts)
- **transfer-interface** - Transfer between light-token, T22, and SPL accounts
- **transfer-interface** - Unified Transfer Interface between light-token, T22, and SPL accounts. The interface detects account types and invokes the right programs.
- [Action](typescript-client/actions/transfer-interface.ts) | [Instruction](typescript-client/instructions/transfer-interface.ts)
- **wrap** - Wrap SPL/T22 to light-token
- [Action](typescript-client/actions/wrap.ts)
Expand All @@ -34,6 +34,21 @@ TypeScript examples for light-token-sdk.
- **delegate-revoke** - Revoke delegate
- [Action](typescript-client/actions/delegate-revoke.ts)

### Rust Client

- **[scenario_spl_to_light](rust-client/tests/scenario_spl_to_light.rs)** - SPL to light-token flow
- **[create_mint](rust-client/tests/create_mint.rs)** - Create a light-mint
- **[create_ata](rust-client/tests/create_ata.rs)** - Create an associated light-token account
- **[create_token_account](rust-client/tests/create_token_account.rs)** - Create a light-token account
- **[mint_to](rust-client/tests/mint_to.rs)** - Mint tokens to a light-token account
- **[transfer](rust-client/tests/transfer.rs)** - Transfer between SPL and light-token accounts
- **[burn](rust-client/tests/burn.rs)** - Burn light-tokens
- **[approve](rust-client/tests/approve.rs)** - Approve delegate
- **[revoke](rust-client/tests/revoke.rs)** - Revoke delegate
- **[freeze](rust-client/tests/freeze.rs)** - Freeze light-token account
- **[thaw](rust-client/tests/thaw.rs)** - Thaw frozen light-token account
- **[close](rust-client/tests/close.rs)** - Close light-token account

## Documentation

Learn more [about to Light-Token here](https://www.zkcompression.com/light-token/welcome).
Loading
Loading