Skip to content
Draft
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
67 changes: 67 additions & 0 deletions .github/workflows/token-kit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
on:
push:
branches:
- main
paths:
- "js/token-sdk/**"
- "js/token-client/**"
- "js/token-idl/**"
- "pnpm-lock.yaml"
pull_request:
branches:
- "*"
paths:
- "js/token-sdk/**"
- "js/token-client/**"
- "js/token-idl/**"
- "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

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:
version: 9
run_install: false

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

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

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

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

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

- name: Lint token-sdk
run: just js lint-token-kit
Comment on lines +32 to +67

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI about 15 hours ago

In general, fix this by explicitly declaring a minimal permissions block either at the workflow root (applies to all jobs) or on the specific job. Since this workflow only checks out code and runs local build/test/lint commands, it only needs read access to repository contents. We can safely set permissions: contents: read for the job (or at the top level) without changing any existing behavior.

The single best fix here is to add a permissions block to the token-kit-tests job definition in .github/workflows/token-kit.yml, just under the job name (or runs-on) and before steps. Concretely, we will insert:

    permissions:
      contents: read

This does not require any imports or additional methods, and it keeps the change localized to the shown snippet. No other files or sections need modification.

Suggested changeset 1
.github/workflows/token-kit.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/token-kit.yml b/.github/workflows/token-kit.yml
--- a/.github/workflows/token-kit.yml
+++ b/.github/workflows/token-kit.yml
@@ -32,6 +32,8 @@
     name: token-kit-tests
     if: github.event.pull_request.draft == false
     runs-on: ubuntu-latest
+    permissions:
+      contents: read
 
     steps:
       - name: Checkout sources
EOF
@@ -32,6 +32,8 @@
name: token-kit-tests
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout sources
Copilot is powered by AI and may make mistakes. Always verify output.
7 changes: 7 additions & 0 deletions js/compressed-token/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export {
getOrCreateAtaInterface,
transferInterface,
decompressInterface,
decompressMint,
wrap,
mintTo as mintToCToken,
mintToCompressed,
Expand All @@ -90,6 +91,8 @@ export {
updateMetadataField,
updateMetadataAuthority,
removeMetadataKey,
createAssociatedCTokenAccount,
createAssociatedCTokenAccountIdempotent,
// Action types
InterfaceOptions,
// Helpers
Expand Down Expand Up @@ -120,6 +123,10 @@ export {
encodeTokenMetadata,
extractTokenMetadata,
ExtensionType,
// Derivation
getAssociatedCTokenAddress,
getAssociatedCTokenAddressAndBump,
findMintAddress,
// Metadata formatting (for use with any uploader)
toOffChainMetadataJson,
OffChainTokenMetadata,
Expand Down
26 changes: 26 additions & 0 deletions js/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ build:
cd stateless.js && pnpm build
cd compressed-token && pnpm build

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

test: test-stateless test-compressed-token

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

test-token-sdk:
cd token-sdk && pnpm test

test-token-client:
cd token-client && pnpm test

test-token-kit: test-token-sdk test-token-client

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

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

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

test-token-kit-e2e: start-validator test-token-sdk-e2e test-token-client-e2e

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

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

format:
cd stateless.js && pnpm format
cd compressed-token && pnpm format
54 changes: 54 additions & 0 deletions js/token-client/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"name": "@lightprotocol/token-client",
"version": "0.1.0",
"description": "Light Protocol indexer client for compressed tokens",
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"import": "./dist/index.js",
"types": "./dist/index.d.ts"
}
},
"files": [
"dist",
"src"
],
"scripts": {
"build": "tsc",
"clean": "rm -rf dist",
"test": "vitest run tests/unit/",
"test:e2e": "vitest run --config vitest.e2e.config.ts",
"test:watch": "vitest"
},
"peerDependencies": {
"@solana/kit": "^2.1.0"
},
"dependencies": {
"@lightprotocol/token-sdk": "workspace:*",
"@solana/addresses": "^2.1.0",
"@solana/codecs": "^2.1.0",
"@solana/instructions": "^2.1.0"
},
"devDependencies": {
"typescript": "^5.7.3",
"vitest": "^2.1.8"
},
"engines": {
"node": ">=18"
},
"keywords": [
"solana",
"light-protocol",
"compressed-token",
"indexer",
"zk-compression"
],
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "https://github.com/Lightprotocol/light-protocol.git",
"directory": "js/token-client"
}
}
Loading
Loading