Skip to content

Commit

Permalink
pin js sdks to use [email protected]
Browse files Browse the repository at this point in the history
wip

remove anchor from stateless.js

add buffer-layout.dt.ts

add note

wip

wip

remove anchor dep in ctoken

use bs58

fmt

wip

remove custom program id test

fix dl keyss

statelessjs bundle optimization. remove idls

rm tweetnacl, minify compressed-token lib

wip. less externals

wip: try alpha

npm release script with alpha option

wip

wip

stateless.js works with web3js 1.73.5 - alpha

wip
  • Loading branch information
Swenschaeferjohann authored and SwenSchaeferjohann committed Jan 4, 2025
1 parent 103a210 commit 3ba8d96
Show file tree
Hide file tree
Showing 71 changed files with 3,971 additions and 16,111 deletions.
2 changes: 1 addition & 1 deletion cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"@oclif/plugin-not-found": "^3.1.2",
"@oclif/plugin-plugins": "^5.0.7",
"@solana-developers/helpers": "^1.5.1",
"@solana/web3.js": "1.95.3",
"@solana/web3.js": "1.95.5",
"axios": "^1.6.8",
"case-anything": "^2.1.13",
"cli-progress": "^3.12.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/browser/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@solana/wallet-adapter-react": "^0.15.35",
"@solana/wallet-adapter-react-ui": "^0.9.35",
"@solana/wallet-adapter-unsafe-burner": "^0.1.7",
"@solana/web3.js": "^1.95.3",
"@solana/web3.js": "^1.95.5",
"next": "15.0.4",
"react": "^19",
"react-dom": "^19"
Expand Down
2 changes: 1 addition & 1 deletion examples/node/esm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"dependencies": {
"@coral-xyz/anchor": "^0.30.0",
"@solana/web3.js": "^1.95.3",
"@solana/web3.js": "^1.95.5",
"@lightprotocol/stateless.js": "workspace:*"
}
}
79 changes: 41 additions & 38 deletions js/compressed-token/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lightprotocol/compressed-token",
"version": "0.17.1",
"version": "0.17.2-alpha.0",
"description": "JS client to interact with the compressed-token program",
"sideEffects": false,
"main": "dist/cjs/node/index.cjs",
Expand All @@ -21,37 +21,6 @@
"files": [
"dist"
],
"scripts": {
"test": "pnpm test:e2e:all",
"test-all": "vitest run",
"test:unit:all": "EXCLUDE_E2E=true vitest run",
"test-all:verbose": "vitest run --reporter=verbose",
"test-validator": "./../../cli/test_bin/run test-validator --prover-run-mode rpc",
"test:e2e:create-mint": "pnpm test-validator && vitest run tests/e2e/create-mint.test.ts",
"test:e2e:create-token-pool": "pnpm test-validator && vitest run tests/e2e/create-token-pool.test.ts",
"test:e2e:mint-to": "pnpm test-validator && vitest run tests/e2e/mint-to.test.ts --reporter=verbose",
"test:e2e:approve-and-mint-to": "pnpm test-validator && vitest run tests/e2e/approve-and-mint-to.test.ts --reporter=verbose",
"test:e2e:merge-token-accounts": "pnpm test-validator && vitest run tests/e2e/merge-token-accounts.test.ts --reporter=verbose",
"test:e2e:transfer": "pnpm test-validator && vitest run tests/e2e/transfer.test.ts --reporter=verbose",
"test:e2e:compress": "pnpm test-validator && vitest run tests/e2e/compress.test.ts --reporter=verbose",
"test:e2e:compress-spl-token-account": "pnpm test-validator && vitest run tests/e2e/compress-spl-token-account.test.ts --reporter=verbose",
"test:e2e:decompress": "pnpm test-validator && vitest run tests/e2e/decompress.test.ts --reporter=verbose",
"test:e2e:rpc-token-interop": "pnpm test-validator && vitest run tests/e2e/rpc-token-interop.test.ts --reporter=verbose",
"test:e2e:custom-program-id": "vitest run tests/e2e/custom-program-id.test.ts --reporter=verbose",
"test:e2e:all": "pnpm test-validator && vitest run tests/e2e/create-mint.test.ts && vitest run tests/e2e/mint-to.test.ts && vitest run tests/e2e/transfer.test.ts && vitest run tests/e2e/compress.test.ts && vitest run tests/e2e/compress-spl-token-account.test.ts && vitest run tests/e2e/decompress.test.ts && vitest run tests/e2e/create-token-pool.test.ts && vitest run tests/e2e/approve-and-mint-to.test.ts && vitest run tests/e2e/rpc-token-interop.test.ts && vitest run tests/e2e/custom-program-id.test.ts",
"pull-idl": "../../scripts/push-compressed-token-idl.sh",
"build": "rimraf dist && pnpm pull-idl && pnpm build:bundle",
"build:bundle": "rollup -c",
"format": "prettier --write .",
"lint": "eslint ."
},
"keywords": [
"zk",
"compression",
"light",
"stateless",
"solana"
],
"maintainers": [
{
"name": "Light Protocol Maintainers",
Expand All @@ -60,14 +29,14 @@
],
"license": "Apache-2.0",
"peerDependencies": {
"@lightprotocol/stateless.js": "workspace:*"
"@lightprotocol/stateless.js": "workspace:*",
"@solana/web3.js": ">=1.73.5",
"@solana/spl-token": ">=0.3.9"
},
"dependencies": {
"@coral-xyz/anchor": "0.29.0",
"@solana/web3.js": "1.95.3",
"@solana/spl-token": "0.4.8",
"buffer": "6.0.3",
"tweetnacl": "1.0.3"
"@coral-xyz/borsh": "^0.29.0",
"bn.js": "^5.2.1",
"buffer": "6.0.3"
},
"devDependencies": {
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
Expand All @@ -81,6 +50,9 @@
"@rollup/plugin-replace": "^5.0.7",
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^11.1.6",
"@solana/web3.js": "1.98.0",
"@solana/spl-token": "0.4.8",
"@types/bn.js": "^5.1.5",
"@types/node": "^22.5.5",
"@typescript-eslint/eslint-plugin": "^7.13.1",
"@typescript-eslint/parser": "^7.13.1",
Expand All @@ -103,6 +75,37 @@
"typescript": "^5.6.2",
"vitest": "^2.1.1"
},
"scripts": {
"test": "pnpm test:e2e:all",
"test-all": "vitest run",
"test:unit:all": "EXCLUDE_E2E=true vitest run",
"test-all:verbose": "vitest run --reporter=verbose",
"test-validator": "./../../cli/test_bin/run test-validator --prover-run-mode rpc",
"test:e2e:create-mint": "pnpm test-validator && NODE_OPTIONS='--trace-deprecation' vitest run tests/e2e/create-mint.test.ts --reporter=verbose",
"test:e2e:layout": "vitest run tests/e2e/layout.test.ts --reporter=verbose",
"test:e2e:create-token-pool": "pnpm test-validator && vitest run tests/e2e/create-token-pool.test.ts",
"test:e2e:mint-to": "pnpm test-validator && vitest run tests/e2e/mint-to.test.ts --reporter=verbose",
"test:e2e:approve-and-mint-to": "pnpm test-validator && vitest run tests/e2e/approve-and-mint-to.test.ts --reporter=verbose",
"test:e2e:merge-token-accounts": "pnpm test-validator && vitest run tests/e2e/merge-token-accounts.test.ts --reporter=verbose",
"test:e2e:transfer": "pnpm test-validator && vitest run tests/e2e/transfer.test.ts --reporter=verbose",
"test:e2e:compress": "pnpm test-validator && vitest run tests/e2e/compress.test.ts --reporter=verbose",
"test:e2e:compress-spl-token-account": "pnpm test-validator && vitest run tests/e2e/compress-spl-token-account.test.ts --reporter=verbose",
"test:e2e:decompress": "pnpm test-validator && vitest run tests/e2e/decompress.test.ts --reporter=verbose",
"test:e2e:rpc-token-interop": "pnpm test-validator && vitest run tests/e2e/rpc-token-interop.test.ts --reporter=verbose",
"test:e2e:all": "pnpm test-validator && vitest run tests/e2e/create-mint.test.ts && vitest run tests/e2e/mint-to.test.ts && vitest run tests/e2e/transfer.test.ts && vitest run tests/e2e/compress.test.ts && vitest run tests/e2e/compress-spl-token-account.test.ts && vitest run tests/e2e/decompress.test.ts && vitest run tests/e2e/create-token-pool.test.ts && vitest run tests/e2e/approve-and-mint-to.test.ts && vitest run tests/e2e/rpc-token-interop.test.ts",
"pull-idl": "../../scripts/push-compressed-token-idl.sh",
"build": "rimraf dist && pnpm build:bundle",
"build:bundle": "rollup -c",
"format": "prettier --write .",
"lint": "eslint ."
},
"keywords": [
"zk",
"compression",
"light",
"stateless",
"solana"
],
"nx": {
"targets": {
"build": {
Expand Down
24 changes: 22 additions & 2 deletions js/compressed-token/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import alias from '@rollup/plugin-alias';
import json from '@rollup/plugin-json';
import terser from '@rollup/plugin-terser';

const rolls = (fmt, env) => ({
input: 'src/index.ts',
Expand All @@ -16,10 +17,9 @@ const rolls = (fmt, env) => ({
},
external: [
'@solana/web3.js',
'@coral-xyz/anchor',
'@solana/spl-token',
'@coral-xyz/borsh',
'@lightprotocol/stateless.js',
'tweetnacl',
],
plugins: [
json(),
Expand All @@ -45,6 +45,26 @@ const rolls = (fmt, env) => ({
],
}),
env === 'browser' ? nodePolyfills() : undefined,
terser({
compress: {
drop_console: true,
drop_debugger: true,
passes: 3,
pure_funcs: ['console.log', 'console.error', 'console.warn'],
booleans_as_integers: true,
keep_fargs: false,
keep_fnames: false,
keep_infinity: true,
reduce_funcs: true,
reduce_vars: true,
},
mangle: {
toplevel: true,
},
output: {
comments: false,
},
}),
].filter(Boolean),
onwarn(warning, warn) {
if (warning.code !== 'CIRCULAR_DEPENDENCY') {
Expand Down
2 changes: 1 addition & 1 deletion js/compressed-token/src/actions/approve-and-mint-to.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
Signer,
TransactionSignature,
} from '@solana/web3.js';
import { BN } from '@coral-xyz/anchor';
import BN from 'bn.js';
import {
sendAndConfirmTx,
buildAndSignTx,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
dedupeSigner,
} from '@lightprotocol/stateless.js';

import { BN } from '@coral-xyz/anchor';
import BN from 'bn.js';

import { CompressedTokenProgram } from '../program';

Expand Down
2 changes: 1 addition & 1 deletion js/compressed-token/src/actions/compress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
dedupeSigner,
} from '@lightprotocol/stateless.js';

import { BN } from '@coral-xyz/anchor';
import BN from 'bn.js';

import { CompressedTokenProgram } from '../program';

Expand Down
2 changes: 1 addition & 1 deletion js/compressed-token/src/actions/decompress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
dedupeSigner,
} from '@lightprotocol/stateless.js';

import { BN } from '@coral-xyz/anchor';
import BN from 'bn.js';

import { CompressedTokenProgram } from '../program';
import { selectMinCompressedTokenAccountsForTransfer } from './transfer';
Expand Down
2 changes: 1 addition & 1 deletion js/compressed-token/src/actions/mint-to.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
Signer,
TransactionSignature,
} from '@solana/web3.js';
import { BN } from '@coral-xyz/anchor';
import BN from 'bn.js';
import {
sendAndConfirmTx,
buildAndSignTx,
Expand Down
2 changes: 1 addition & 1 deletion js/compressed-token/src/actions/transfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
dedupeSigner,
} from '@lightprotocol/stateless.js';

import { BN } from '@coral-xyz/anchor';
import BN from 'bn.js';

import { CompressedTokenProgram } from '../program';

Expand Down
1 change: 0 additions & 1 deletion js/compressed-token/src/idl/index.ts

This file was deleted.

Loading

0 comments on commit 3ba8d96

Please sign in to comment.