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
7 changes: 7 additions & 0 deletions .github/file-filters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,31 @@ programs: &programs
client_common: &client_common
- *programs
- ".github/workflows/test-js.yml"
- ".github/workflows/test-js-kit-client.yml"
- ".github/workflows/test-rust-client.yml"
- ".github/workflows/build-rust-client.yml"
- ".github/workflows/main.yml"
- ".github/file-filters.yml"
- ".github/.env"
- "configs/shank.cjs"
- "configs/kinobi.cjs"
- "configs/codama.cjs"

js_client: &js_client
- *client_common
- "clients/js/**"

js_kit_client: &js_kit_client
- *client_common
- "clients/js-kit/**"

rust_client: &rust_client
- *client_common
- "clients/rust/**"

clients: &clients
- *js_client
- *js_kit_client
- *rust_client

# Any.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/benchmark-summary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
- name: Start validator
uses: metaplex-foundation/actions/start-validator@v1
with:
node: 18.x
node: 20.x
solana: ${{ env.SOLANA_VERSION }}
cache: ${{ env.CACHE }}
artifacts: program-builds-${{ steps.sanitize.outputs.sanitized }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- name: Start validator
uses: metaplex-foundation/actions/start-validator@v1
with:
node: 18.x
node: 20.x
solana: ${{ env.SOLANA_VERSION }}
cache: ${{ env.CACHE }}
artifacts: program-builds-${{ steps.sanitize.outputs.sanitized }}
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
programs: ${{ steps.changes.outputs.programs }}
program_matrix: ${{ steps.program_matrix.outputs.matrix }}
js_client: ${{ steps.changes.outputs.js_client }}
js_kit_client: ${{ steps.changes.outputs.js_kit_client }}
rust_client: ${{ steps.changes.outputs.rust_client }}
steps:
- name: Git checkout
Expand Down Expand Up @@ -110,7 +111,14 @@
uses: ./.github/workflows/test-js-client.yml
secrets: inherit

test_js_kit:
if: needs.changes.outputs.js_kit_client == 'true'
name: JS Kit Client
needs: generate_clients
uses: ./.github/workflows/test-js-kit-client.yml
secrets: inherit

benchmark:

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: {}
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
name: Benchmark
needs: generate_clients
Expand Down
91 changes: 91 additions & 0 deletions .github/workflows/test-js-kit-client.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Test JS Kit client

on:
workflow_call:
inputs:
git_ref:
type: string

env:
CACHE: true

jobs:
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
node: ["20.x", "22.x"]
steps:
- name: Git checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.git_ref }}

- name: Load environment variables
run: cat .github/.env >> $GITHUB_ENV

- name: Sanitize Ref
id: sanitize
shell: bash
run: |
REF="${{ inputs.git_ref }}"
if [ -z "$REF" ]; then
REF="default"
fi
SANITIZED=${REF//\//-}
echo "sanitized=$SANITIZED" >> "$GITHUB_OUTPUT"

- name: Start validator
uses: metaplex-foundation/actions/start-validator@v1
with:
node: ${{ matrix.node }}
solana: ${{ env.SOLANA_VERSION }}
cache: ${{ env.CACHE }}
artifacts: program-builds-${{ steps.sanitize.outputs.sanitized }}

- name: Install dependencies
uses: metaplex-foundation/actions/install-node-dependencies@v1
with:
folder: ./clients/js-kit
cache: ${{ env.CACHE }}
key: clients-js-kit

- name: Build
working-directory: ./clients/js-kit
run: pnpm build

- name: Test
working-directory: ./clients/js-kit
run: pnpm test

lint:
Comment on lines +14 to +62

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium test

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 2 months ago

To fix the issue, explicitly set the permissions block at the root of the workflow file. The minimum required privilege for this particular workflow—based on its contents (running tests, linting, formatting, checking out code with actions/checkout)—is contents: read. None of the jobs perform write operations (e.g., pushing code, creating issues, managing pull requests), so restricting the GITHUB_TOKEN to only read the repository contents adheres to the principle of least privilege and meets both the security recommendations and the requirements of the workflow.

To implement this, insert the following block after the name and before or after the on: block:

permissions:
  contents: read

This will apply to all jobs in the workflow, unless overridden in individual jobs (which is not necessary here).

What is needed:

  • Insert permissions: at the root level of .github/workflows/test-js-kit-client.yml, specifying contents: read as the value.

Suggested changeset 1
.github/workflows/test-js-kit-client.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/test-js-kit-client.yml b/.github/workflows/test-js-kit-client.yml
--- a/.github/workflows/test-js-kit-client.yml
+++ b/.github/workflows/test-js-kit-client.yml
@@ -1,5 +1,8 @@
 name: Test JS Kit client
 
+permissions:
+  contents: read
+
 on:
   workflow_call:
     inputs:
EOF
@@ -1,5 +1,8 @@
name: Test JS Kit client

permissions:
contents: read

on:
workflow_call:
inputs:
Copilot is powered by AI and may make mistakes. Always verify output.
name: Lint
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v4

- name: Load environment variables
run: cat .github/.env >> $GITHUB_ENV

- name: Install Node.js
uses: metaplex-foundation/actions/install-node-with-pnpm@v1
with:
version: ${{ env.NODE_VERSION }}
cache: ${{ env.CACHE }}

- name: Install dependencies
uses: metaplex-foundation/actions/install-node-dependencies@v1
with:
folder: ./clients/js-kit
cache: ${{ env.CACHE }}
key: clients-js-kit

- name: Format
working-directory: ./clients/js-kit
run: pnpm format

- name: Lint
working-directory: ./clients/js-kit
run: pnpm lint
Comment on lines +63 to +91

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium test

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 2 months ago

To fix the issue, add a permissions block explicitly specifying the minimal privilege required for this workflow. The best way is to set permissions: contents: read at the top level (applies to all jobs unless overridden). This gives the workflow read-only access to repository contents, which suffices for checking out code and running tests/lints locally. Place this immediately after the name: but before on: for proper YAML structure. No changes are needed within jobs or steps, as no write permissions are required by any visible action.

Suggested changeset 1
.github/workflows/test-js-kit-client.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/test-js-kit-client.yml b/.github/workflows/test-js-kit-client.yml
--- a/.github/workflows/test-js-kit-client.yml
+++ b/.github/workflows/test-js-kit-client.yml
@@ -1,4 +1,6 @@
 name: Test JS Kit client
+permissions:
+  contents: read
 
 on:
   workflow_call:
EOF
@@ -1,4 +1,6 @@
name: Test JS Kit client
permissions:
contents: read

on:
workflow_call:
Copilot is powered by AI and may make mistakes. Always verify output.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dmissing due to other test workflow not having this.

23 changes: 23 additions & 0 deletions clients/js-kit/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module.exports = {
extends: ['airbnb-base', 'airbnb-typescript/base', 'prettier'],
plugins: ['prettier'],
overrides: [],
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: 'tsconfig.json',
tsconfigRootDir: __dirname,
},
rules: {
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'class-methods-use-this': 'off',
'import/prefer-default-export': 'off',
'import/no-cycle': 'off',
'no-underscore-dangle': 'off',
'max-classes-per-file': 'off',
'no-param-reassign': 'off',
'func-names': 'off',
},
ignorePatterns: ['dist/**', '.eslintrc.js'],
};
2 changes: 2 additions & 0 deletions clients/js-kit/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.vercel
docs
10 changes: 10 additions & 0 deletions clients/js-kit/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"semi": true,
"singleQuote": true,
"trailingComma": "es5",
"useTabs": false,
"tabWidth": 2,
"arrowParens": "always",
"printWidth": 80,
"parser": "typescript"
}
84 changes: 84 additions & 0 deletions clients/js-kit/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
"name": "@metaplex-foundation/mpl-core-kit",
"version": "0.0.1",
"description": "JavaScript client for MPL Core using @solana/kit",
"private": true,
"main": "dist/src/index.js",
"types": "dist/src/index.d.ts",
"scripts": {
"build": "rimraf dist && tsc -p tsconfig.json",
"test": "NODE_OPTIONS='--experimental-global-webcrypto' ava",
"lint": "eslint --ext js,ts,tsx src",
"lint:fix": "eslint --fix --ext js,ts,tsx src",
"format": "prettier --check src test",
"format:fix": "prettier --write src test"
},
"files": [
"/dist/src"
],
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org"
},
"homepage": "https://metaplex.com",
"repository": "https://github.com/metaplex-foundation/mpl-core.git",
"author": "Metaplex Maintainers <contact@metaplex.com>",
"license": "Apache-2.0",
"devDependencies": {
"@ava/typescript": "^5.0.0",
"@types/node": "^24.0.3",
"@typescript-eslint/eslint-plugin": "^5.0.0",
"@typescript-eslint/parser": "^5.46.1",
"ava": "^6.1.3",
"eslint": "^8.0.1",
"eslint-config-airbnb-typescript": "^17.0.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-prettier": "^4.2.1",
"prettier": "^3.2.5",
"rimraf": "^3.0.2",
"typescript": "^5.3.3"
},
"ava": {
"concurrency": 2,
"files": [
"test/**/*.test.ts",
"!test/externalPlugins/**",
"!test/collect.test.ts",
"!test/compress.test.ts",
"!test/execute.test.ts",
"!test/helps/**",
"!test/instructions/**",
"!test/updateV2.test.ts"
],
"typescript": {
"compile": false,
"rewritePaths": {
"src/": "dist/src/",
"test/": "dist/test/"
}
},
"require": [
"./test/_ava-setup.js"
],
"timeout": "2m",
"serial": true
},
"packageManager": "pnpm@8.9.0",
"dependencies": {
"@noble/hashes": "^1.3.1",
"@solana/accounts": "^2.0.0",
"@solana/addresses": "^2.0.0",
"@solana/codecs": "^2.0.0",
"@solana/functional": "^2.0.0",
"@solana/instructions": "^2.0.0",
"@solana/keys": "^2.0.0",
"@solana/kit": "^2.0.0",
"@solana/rpc": "^2.0.0",
"@solana/rpc-subscriptions": "^2.0.0",
"@solana/rpc-types": "^2.0.0",
"@solana/signers": "^2.0.0",
"@solana/transaction-messages": "^2.0.0",
"@solana/transactions": "^2.0.0"
}
}
Loading
Loading