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
61 changes: 61 additions & 0 deletions .github/workflows/token-kit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
on:
push:
branches:
- main
paths:
- "js/token-kit/**"
- "pnpm-lock.yaml"
pull_request:
branches:
- "*"
paths:
- "js/token-kit/**"
- "pnpm-lock.yaml"
types:
- opened
- synchronize
- reopened
- ready_for_review

name: token-kit

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

jobs:
token-kit-tests:
name: token-kit-tests
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout sources
uses: actions/checkout@v6

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22"

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
run_install: false

- name: Install just
uses: extractions/setup-just@v2

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build token-kit
run: cd js/token-kit && pnpm build

- name: Run token-kit unit tests
run: just js test-token-kit

- name: Lint token-kit
run: just js lint-token-kit
8 changes: 8 additions & 0 deletions js/compressed-token/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ export {
getAssociatedTokenAddressInterface,
getOrCreateAtaInterface,
transferInterface,
decompressInterface,
decompressMint,
createTransferInterfaceInstructions,
sliceLast,
wrap,
Expand All @@ -87,6 +89,8 @@ export {
updateMetadataField,
updateMetadataAuthority,
removeMetadataKey,
createAssociatedCTokenAccount,
createAssociatedCTokenAccountIdempotent,
// Action types
InterfaceOptions,
// Helpers
Expand Down Expand Up @@ -117,6 +121,10 @@ export {
encodeTokenMetadata,
extractTokenMetadata,
ExtensionType,
// Derivation
getAssociatedCTokenAddress,
getAssociatedCTokenAddressAndBump,
findMintAddress,
// Metadata formatting (for use with any uploader)
toOffChainMetadataJson,
OffChainTokenMetadata,
Expand Down
15 changes: 15 additions & 0 deletions js/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ build:
cd stateless.js && pnpm build
cd compressed-token && pnpm build

build-token-kit:
cd token-kit && pnpm build

test: test-stateless test-compressed-token

test-stateless:
Expand All @@ -18,10 +21,22 @@ test-compressed-token:
test-compressed-token-unit-v2:
cd compressed-token && pnpm test:unit:all:v2

test-token-kit:
cd token-kit && pnpm test

start-validator:
./../cli/test_bin/run test-validator

test-token-kit-e2e: start-validator
cd token-kit && LIGHT_PROTOCOL_VERSION=V2 LIGHT_PROTOCOL_BETA=true pnpm test:e2e

lint:
cd stateless.js && pnpm lint
cd compressed-token && pnpm lint

lint-token-kit:
cd token-kit && pnpm lint

format:
cd stateless.js && pnpm format
cd compressed-token && pnpm format
22 changes: 22 additions & 0 deletions js/token-kit/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.1.0] - Unreleased

Initial release. API may change before 1.0.

### Added

- Instruction builders for all CToken operations (transfer, mint-to, burn, approve, revoke, freeze, thaw, close)
- Transfer2 instruction builder for compressed account transfers with validity proofs
- MintAction instruction builder for compressed mint management
- Borsh-compatible codecs for all instruction data types
- `PhotonIndexer` client for fetching compressed accounts and validity proofs
- Account loading and selection utilities (`loadTokenAccountsForTransfer`, `selectAccountsForAmount`)
- `buildCompressedTransfer` high-level action builder
- PDA derivation utilities for ATAs, mints, and pools
- Compressible extension codecs for rent-free account creation
Loading
Loading