Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ts: Add SPL Anchor packages #2143

Merged
merged 10 commits into from
Aug 23, 2022
Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/actions/setup-ts/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ runs:
path: |
./ts/dist/
key: solana-${{ runner.os }}-v0000-${{ env.NODE_VERSION }}-${{ hashFiles('./ts/**/*.ts') }}
- run: cd ts && yarn --frozen-lockfile && yarn build:node && yarn link && cd ../
- run: cd ts/packages/anchor && yarn --frozen-lockfile && yarn build:node && yarn link && cd ../../../
shell: bash
- run: cd examples/tutorial && yarn link @project-serum/anchor && yarn --frozen-lockfile && cd ../../
shell: bash
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/no-cashing-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ jobs:
- run: cargo test
# using singlethreaded testing for avm so that tests that change files do not conflict with each other
- run: cd avm && cargo fmt -- --check && cargo clippy --all-targets -- -D warnings && cargo test -- --test-threads=1
- run: cd ts && yarn --frozen-lockfile
- run: cd ts && yarn test
- run: cd ts && yarn lint
- run: cd ts/packages/anchor && yarn --frozen-lockfile
- run: cd ts/packages/anchor && yarn test
- run: cd ts/packages/anchor && yarn lint
- run: cd examples/tutorial && yarn --frozen-lockfile
- run: cd examples/tutorial && yarn lint
- run: cd tests && yarn --frozen-lockfile
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ jobs:
- run: cargo test
# using singlethreaded testing for avm so that tests that change files do not conflict with each other
- run: cd avm && cargo fmt -- --check && cargo clippy --all-targets -- -D warnings && cargo test -- --test-threads=1
- run: cd ts && yarn --frozen-lockfile
- run: cd ts && yarn test
- run: cd ts && yarn lint
- run: cd ts/packages/anchor && yarn --frozen-lockfile
- run: cd ts/packages/anchor && yarn test
- run: cd ts/packages/anchor && yarn lint
- run: cd examples/tutorial && yarn --frozen-lockfile
- run: cd examples/tutorial && yarn lint
- run: cd tests && yarn --frozen-lockfile
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ cli/npm-package/anchor
cli/npm-package/*.tgz
docker-target
.rollup.cache/
test-keypair.json
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ The minor version will be incremented upon a breaking change and the patch versi
* spl: Add `create_metadata_accounts_v3` and `set_collection_size` wrappers ([#2119](https://github.com/coral-xyz/anchor/pull/2119))
* spl: Add `MetadataAccount` account deserialization. ([#2014](https://github.com/coral-xyz/anchor/pull/2014)).
* lang: Add parsing for consts from impl blocks for IDL PDA seeds generation ([#2128](https://github.com/coral-xyz/anchor/pull/2014))
* ts: Add coders for SPL programs ([#2143](https://github.com/coral-xyz/anchor/pull/2143)).

### Fixes

Expand Down
2 changes: 1 addition & 1 deletion examples/tutorial/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"basic-4"
],
"dependencies": {
"@project-serum/anchor": "file:../../ts"
"@project-serum/anchor": "file:../../ts/packages/anchor"
},
"devDependencies": {
"mocha": "^9.1.3",
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorial/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@ethersproject/logger" "^5.5.0"
hash.js "1.1.7"

"@project-serum/anchor@file:../../ts":
"@project-serum/anchor@file:../../ts/packages/anchor":
version "0.25.0"
dependencies:
"@project-serum/borsh" "^0.2.5"
Expand Down
2 changes: 1 addition & 1 deletion tests/auction-house
2 changes: 1 addition & 1 deletion tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"bpf-upgradeable-state"
],
"dependencies": {
"@project-serum/anchor": "file:../ts",
"@project-serum/anchor": "file:../ts/packages/anchor",
"@project-serum/common": "^0.0.1-beta.3",
"@project-serum/serum": "^0.13.60",
"@solana/spl-token": "^0.1.8"
Expand Down
4 changes: 2 additions & 2 deletions tests/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
snake-case "^3.0.4"
toml "^3.0.0"

"@project-serum/anchor@file:../ts":
version "0.24.2"
"@project-serum/anchor@file:../ts/packages/anchor":
version "0.25.0"
dependencies:
"@project-serum/borsh" "^0.2.5"
"@solana/web3.js" "^1.36.0"
Expand Down
9 changes: 9 additions & 0 deletions ts/build-packages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cd packages;
for D in */;
do if [ "$D" = "anchor/" ]; then
cd $D && yarn && yarn build; cd ..;
else
cd $D && yarn init:yarn; cd ..;
fi
done

89 changes: 5 additions & 84 deletions ts/package.json
Original file line number Diff line number Diff line change
@@ -1,87 +1,8 @@
{
"name": "@project-serum/anchor",
"version": "0.25.0",
"description": "Anchor client",
"module": "./dist/esm/index.js",
"main": "./dist/cjs/index.js",
"browser": "./dist/browser/index.js",
"license": "(MIT OR Apache-2.0)",
"types": "dist/cjs/index.d.ts",
"homepage": "https://github.com/coral-xyz/anchor#readme",
"bugs": {
"url": "https://github.com/coral-xyz/anchor/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/coral-xyz/anchor.git"
},
"publishConfig": {
"access": "public"
},
"engines": {
"node": ">=11"
},
"scripts": {
"build": "rimraf dist/ && yarn build:node && yarn build:browser",
"build:node": "tsc && tsc -p tsconfig.cjs.json",
"build:browser": "rollup --config",
"lint:fix": "prettier src/** tests/** -w",
"lint": "prettier src/** tests/** --check",
"watch": "tsc -p tsconfig.cjs.json --watch",
"prepublishOnly": "yarn build",
"docs": "typedoc --excludePrivate --includeVersion --out ../docs/src/.vuepress/dist/ts/ --readme none src/index.ts",
"test": "jest tests --detectOpenHandles"
},
"dependencies": {
"@project-serum/borsh": "^0.2.5",
"@solana/web3.js": "^1.36.0",
"base64-js": "^1.5.1",
"bn.js": "^5.1.2",
"bs58": "^4.0.1",
"buffer-layout": "^1.2.2",
"camelcase": "^5.3.1",
"cross-fetch": "^3.1.5",
"crypto-hash": "^1.3.0",
"eventemitter3": "^4.0.7",
"js-sha256": "^0.9.0",
"pako": "^2.0.3",
"snake-case": "^3.0.4",
"superstruct": "^0.15.4",
"toml": "^3.0.0"
},
"devDependencies": {
"@commitlint/cli": "^11.0.0",
"@commitlint/config-conventional": "^11.0.0",
"@rollup/plugin-commonjs": "^21.0.1",
"@rollup/plugin-node-resolve": "^13.0.6",
"@rollup/plugin-replace": "^3.0.0",
"@rollup/plugin-typescript": "^8.3.0",
"@types/bn.js": "^4.11.6",
"@types/bs58": "^4.0.1",
"@types/crypto-hash": "^1.1.2",
"@types/jest": "^27.4.1",
"@types/pako": "^1.0.1",
"@typescript-eslint/eslint-plugin": "^4.6.0",
"@typescript-eslint/parser": "^4.6.0",
"eslint": "^7.12.1",
"eslint-config-prettier": "^6.15.0",
"husky": "^4.3.0",
"jest": "27.3.1",
"jest-config": "27.3.1",
"lint-staged": "^10.5.0",
"prettier": "^2.1.2",
"rimraf": "^3.0.2",
"rollup": "^2.60.2",
"rollup-plugin-terser": "^7.0.2",
"ts-jest": "^27.0.7",
"ts-jest-resolver": "^2.0.0",
"ts-node": "^9.0.0",
"tslib": "^2.3.1",
"typedoc": "^0.22.10",
"typescript": "^4.5.2"
},
"files": [
"dist",
"types"
"name": "@project-serum/monorepo",
"private": true,
"workspaces": [
"packages/*",
"tests"
]
}
File renamed without changes.
File renamed without changes.
87 changes: 87 additions & 0 deletions ts/packages/anchor/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
{
"name": "@project-serum/anchor",
"version": "0.25.0",
"description": "Anchor client",
"module": "./dist/esm/index.js",
"main": "./dist/cjs/index.js",
"browser": "./dist/browser/index.js",
"license": "(MIT OR Apache-2.0)",
"types": "dist/cjs/index.d.ts",
"homepage": "https://github.com/coral-xyz/anchor#readme",
"bugs": {
"url": "https://github.com/coral-xyz/anchor/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/coral-xyz/anchor.git"
},
"publishConfig": {
"access": "public"
},
"engines": {
"node": ">=11"
},
"scripts": {
"build": "rimraf dist/ && yarn build:node && yarn build:browser",
"build:node": "tsc && tsc -p tsconfig.cjs.json",
"build:browser": "rollup --config",
"lint:fix": "prettier src/** tests/** -w",
"lint": "prettier src/** tests/** --check",
"watch": "tsc -p tsconfig.cjs.json --watch",
"prepublishOnly": "yarn build",
"docs": "typedoc --excludePrivate --includeVersion --out ../docs/src/.vuepress/dist/ts/ --readme none src/index.ts",
"test": "jest tests --detectOpenHandles"
},
"dependencies": {
"@project-serum/borsh": "^0.2.5",
"@solana/web3.js": "^1.36.0",
"base64-js": "^1.5.1",
"bn.js": "^5.1.2",
"bs58": "^4.0.1",
"buffer-layout": "^1.2.2",
"camelcase": "^5.3.1",
"cross-fetch": "^3.1.5",
"crypto-hash": "^1.3.0",
"eventemitter3": "^4.0.7",
"js-sha256": "^0.9.0",
"pako": "^2.0.3",
"snake-case": "^3.0.4",
"superstruct": "^0.15.4",
"toml": "^3.0.0"
},
"devDependencies": {
"@commitlint/cli": "^11.0.0",
"@commitlint/config-conventional": "^11.0.0",
"@rollup/plugin-commonjs": "^21.0.1",
"@rollup/plugin-node-resolve": "^13.0.6",
"@rollup/plugin-replace": "^3.0.0",
"@rollup/plugin-typescript": "^8.3.0",
"@types/bn.js": "^4.11.6",
"@types/bs58": "^4.0.1",
"@types/crypto-hash": "^1.1.2",
"@types/jest": "^27.4.1",
"@types/pako": "^1.0.1",
"@typescript-eslint/eslint-plugin": "^4.6.0",
"@typescript-eslint/parser": "^4.6.0",
"eslint": "^7.12.1",
"eslint-config-prettier": "^6.15.0",
"husky": "^4.3.0",
"jest": "27.3.1",
"jest-config": "27.3.1",
"lint-staged": "^10.5.0",
"prettier": "^2.1.2",
"rimraf": "^3.0.2",
"rollup": "^2.60.2",
"rollup-plugin-terser": "^7.0.2",
"ts-jest": "^27.0.7",
"ts-jest-resolver": "^2.0.0",
"ts-node": "^9.0.0",
"tslib": "^2.3.1",
"typedoc": "^0.22.10",
"typescript": "^4.5.2"
},
"files": [
"dist",
"types"
]
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
"baseUrl": ".",
"typeRoots": [
"types/",
"node_modules/@types"
"../../node_modules/@types"
],
"paths": {
"@solana/web3.js": [
"./node_modules/@solana/web3.js/lib"
"../../node_modules/@solana/web3.js/lib"
]
}
}
Expand Down
File renamed without changes.
File renamed without changes.
Loading