Skip to content

Commit

Permalink
ts: Add SPL Anchor packages
Browse files Browse the repository at this point in the history
Add yarn workspaces for typescript packages

Add package tests

@project-serum/anchor is moved into ts/anchor, code is untouched
  • Loading branch information
acheroncrypto committed Aug 21, 2022
1 parent a59aa5f commit 436e88d
Show file tree
Hide file tree
Showing 297 changed files with 43,235 additions and 595 deletions.
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
File renamed without changes.
File renamed without changes.
87 changes: 87 additions & 0 deletions ts/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.
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.
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.
1 change: 1 addition & 0 deletions ts/build-packages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cd packages; for D in */; do cd $D && yarn init:yarn; cd ..; done
90 changes: 6 additions & 84 deletions ts/package.json
Original file line number Diff line number Diff line change
@@ -1,87 +1,9 @@
{
"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": [
"anchor",
"packages/*",
"tests"
]
}
126 changes: 126 additions & 0 deletions ts/packages/spl-associated-token-account/idl.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
{
"version": "1.1.1",
"name": "spl_associated_token_account",
"instructions": [
{
"name": "create",
"accounts": [
{
"name": "fundingAddress",
"isMut": true,
"isSigner": true
},
{
"name": "associatedAccountAddress",
"isMut": true,
"isSigner": false
},
{
"name": "walletAddress",
"isMut": false,
"isSigner": false
},
{
"name": "tokenMintAddress",
"isMut": false,
"isSigner": false
},
{
"name": "systemProgram",
"isMut": false,
"isSigner": false
},
{
"name": "tokenProgram",
"isMut": false,
"isSigner": false
}
],
"args": []
},
{
"name": "createIdempotent",
"accounts": [
{
"name": "fundingAddress",
"isMut": true,
"isSigner": true
},
{
"name": "associatedAccountAddress",
"isMut": true,
"isSigner": false
},
{
"name": "walletAddress",
"isMut": false,
"isSigner": false
},
{
"name": "tokenMintAddress",
"isMut": false,
"isSigner": false
},
{
"name": "systemProgram",
"isMut": false,
"isSigner": false
},
{
"name": "tokenProgram",
"isMut": false,
"isSigner": false
}
],
"args": []
},
{
"name": "recoverNested",
"accounts": [
{
"name": "nestedAssociatedAccountAddress",
"isMut": true,
"isSigner": false
},
{
"name": "nestedTokenMintAddress",
"isMut": false,
"isSigner": false
},
{
"name": "destinationAssociatedAccountAddress",
"isMut": true,
"isSigner": false
},
{
"name": "ownerAssociatedAccountAddress",
"isMut": false,
"isSigner": false
},
{
"name": "ownerTokenMintAddress",
"isMut": false,
"isSigner": false
},
{
"name": "walletAddress",
"isMut": true,
"isSigner": true
},
{
"name": "tokenProgram",
"isMut": false,
"isSigner": false
}
],
"args": []
}
],
"errors": [
{
"code": 0,
"name": "InvalidOwner",
"msg": "Associated token account owner does not match address derivation"
}
]
}
46 changes: 46 additions & 0 deletions ts/packages/spl-associated-token-account/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"name": "@project-serum/spl-associated-token-account",
"description": "Solana Program Library Associated Token Account",
"version": "1.1.1",
"author": "Solana Maintainers <maintainers@solana.foundation>",
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "https://github.com/solana-labs/solana-program-library.git"
},
"files": [
"dist"
],
"module": "./dist/esm/index.js",
"main": "./dist/cjs/index.js",
"browser": "./dist/browser/index.js",
"types": "./dist/cjs/index.d.ts",
"scripts": {
"init:yarn": "yarn && yarn lint:fix && yarn build:yarn",
"init:npm": "npm i && npm run lint:fix && npm run build:npm",
"build:yarn": "rimraf dist/ && yarn build:node && yarn build:browser",
"build:npm": "rimraf dist/ && npm run build:node && npm run build:browser",
"build:node": "tsc && tsc -p tsconfig.cjs.json",
"build:browser": "rollup --config",
"lint:fix": "prettier src/** -w",
"lint": "prettier src/** --check",
"watch": "tsc -p tsconfig.cjs.json --watch"
},
"dependencies": {
"@project-serum/anchor": "=0.25.0",
"@native-to-anchor/buffer-layout": "=0.1.0"
},
"devDependencies": {
"@rollup/plugin-commonjs": "=21.0.2",
"@rollup/plugin-node-resolve": "=13.1.3",
"@rollup/plugin-replace": "=3.1.0",
"@rollup/plugin-typescript": "=8.3.1",
"@types/node": "=17.0.21",
"prettier": "=2.7.1",
"rimraf": "=3.0.2",
"rollup": "=2.70.1",
"rollup-plugin-terser": "=7.0.2",
"tslib": "=2.3.1",
"typescript": "=4.6.2"
}
}

0 comments on commit 436e88d

Please sign in to comment.