cli, examples, tests: Remove global JavaScript dependencies in favour of local (#990)

This commit is contained in:
Tom Linton 2021-11-12 11:38:35 +13:00 committed by GitHub
parent d027b39c56
commit 468fe79473
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
65 changed files with 2944 additions and 108 deletions

View File

@ -21,19 +21,12 @@ _defaults: &defaults
_tests: &tests _tests: &tests
before_install: before_install:
- nvm install $NODE_VERSION - nvm install $NODE_VERSION
- npm install -g mocha - cd ts && yarn && yarn build && yarn link && cd ../
- npm install -g ts-mocha - cd examples/tutorial && yarn && yarn link @project-serum/anchor && cd ../../
- npm install -g typescript - cd tests && yarn && yarn link @project-serum/anchor && cd ..
- npm install -g ts-node
- npm install -g buffer
- cd ts && yarn && yarn build && npm link && cd ../
- npm install -g @project-serum/serum
- npm install -g @project-serum/common
- npm install -g @solana/spl-token
- sudo apt-get install -y pkg-config build-essential libudev-dev - sudo apt-get install -y pkg-config build-essential libudev-dev
- sh -c "$(curl -sSfL https://release.solana.com/v${SOLANA_CLI_VERSION}/install)" - sh -c "$(curl -sSfL https://release.solana.com/v${SOLANA_CLI_VERSION}/install)"
- export PATH="/home/travis/.local/share/solana/install/active_release/bin:$PATH" - export PATH="/home/travis/.local/share/solana/install/active_release/bin:$PATH"
- export NODE_PATH="/home/travis/.nvm/versions/node/v${NODE_VERSION}/lib/node_modules/:$NODE_PATH"
- yes | solana-keygen new - yes | solana-keygen new
- cargo install --path $TRAVIS_BUILD_DIR/cli anchor-cli --locked - cargo install --path $TRAVIS_BUILD_DIR/cli anchor-cli --locked
@ -67,20 +60,16 @@ jobs:
- pushd tests/misc && anchor test && popd - pushd tests/misc && anchor test && popd
- pushd tests/events && anchor test && popd - pushd tests/events && anchor test && popd
- pushd tests/cashiers-check && anchor test && popd - pushd tests/cashiers-check && anchor test && popd
- pushd tests/typescript && yarn && anchor test && popd - pushd tests/typescript && anchor test && popd
- pushd tests/zero-copy && yarn && anchor test && popd - pushd tests/zero-copy && anchor test && popd
- pushd tests/chat && yarn && anchor test && popd - pushd tests/chat && anchor test && popd
- pushd tests/ido-pool && yarn && anchor test && popd - pushd tests/ido-pool && anchor test && popd
- pushd tests/swap/deps/serum-dex/dex && cargo build-bpf && cd ../../../ && anchor test && popd - pushd tests/swap/deps/serum-dex/dex && cargo build-bpf && cd ../../../ && anchor test && popd
- pushd tests/cfo && anchor run test-with-build && popd - pushd tests/cfo && anchor run test-with-build && popd
- <<: *tests - <<: *tests
name: Runs the e2e tests 3 name: Runs the e2e tests 3
script: script:
- pushd tests/escrow && yarn && anchor test && popd - pushd tests/escrow && anchor test && popd
- pushd tests/pyth && yarn && anchor test && popd - pushd tests/pyth && anchor test && popd
- pushd tests/system-accounts && yarn && anchor test && popd - pushd tests/system-accounts && anchor test && popd
- pushd examples/tutorial/basic-0 && anchor test && popd - pushd examples/tutorial && yarn workspaces run test
- pushd examples/tutorial/basic-1 && anchor test && popd
- pushd examples/tutorial/basic-2 && anchor test && popd
- pushd examples/tutorial/basic-3 && anchor test && popd
- pushd examples/tutorial/basic-4 && anchor test && popd

View File

@ -11,6 +11,8 @@ incremented for features.
## [Unreleased] ## [Unreleased]
* cli: Replace global JavaScript dependency installs with local.
### Features ### Features
* lang: Add `SystemAccount<'info>` account type for generic wallet addresses or accounts owned by the system program ([#954](https://github.com/project-serum/anchor/pull/954)) * lang: Add `SystemAccount<'info>` account type for generic wallet addresses or accounts owned by the system program ([#954](https://github.com/project-serum/anchor/pull/954))

View File

@ -400,9 +400,9 @@ fn init(cfg_override: &ConfigOverride, name: String, javascript: bool) -> Result
cfg.scripts.insert( cfg.scripts.insert(
"test".to_owned(), "test".to_owned(),
if javascript { if javascript {
"mocha -t 1000000 tests/" "yarn run mocha -t 1000000 tests/"
} else { } else {
"ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts" "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts"
} }
.to_owned(), .to_owned(),
); );

View File

@ -40,6 +40,7 @@ Initializes a project workspace with the following structure.
* `Anchor.toml`: Anchor configuration file. * `Anchor.toml`: Anchor configuration file.
* `Cargo.toml`: Rust workspace configuration file. * `Cargo.toml`: Rust workspace configuration file.
* `package.json`: JavaScript dependencies file.
* `programs/`: Directory for Solana program crates. * `programs/`: Directory for Solana program crates.
* `app/`: Directory for your application frontend. * `app/`: Directory for your application frontend.
* `tests/`: Directory for JavaScript integration tests. * `tests/`: Directory for JavaScript integration tests.
@ -228,4 +229,3 @@ anchor verify <program-id>
``` ```
Verifies the on-chain bytecode matches the locally compiled artifact. Verifies the on-chain bytecode matches the locally compiled artifact.

View File

@ -21,12 +21,12 @@ See the solana [docs](https://docs.solana.com/cli/install-solana-cli-tools) for
sh -c "$(curl -sSfL https://release.solana.com/v1.8.0/install)" sh -c "$(curl -sSfL https://release.solana.com/v1.8.0/install)"
``` ```
## Install Mocha ## Install Yarn
Program integration tests are run using [Mocha](https://mochajs.org/). [Yarn](https://yarnpkg.com/) is recommended for JavaScript package management.
```bash ```bash
npm install -g mocha npm install -g yarn
``` ```
## Install Anchor ## Install Anchor
@ -53,15 +53,6 @@ On Linux systems you may need to install additional dependencies if `cargo insta
sudo apt-get update && sudo apt-get upgrade && sudo apt-get install -y pkg-config build-essential libudev-dev sudo apt-get update && sudo apt-get upgrade && sudo apt-get install -y pkg-config build-essential libudev-dev
``` ```
To install the JavaScript package.
```bash
npm install -g @project-serum/anchor
```
Make sure your `NODE_PATH` is set properly so that globally installed modules
can be resolved.
Now verify the CLI is installed properly. Now verify the CLI is installed properly.
```bash ```bash

View File

@ -17,12 +17,18 @@ Next, checkout the tagged branch of the same version of the anchor cli you have
git checkout tags/<version> git checkout tags/<version>
``` ```
And change directories to the [example](https://github.com/project-serum/anchor/tree/master/examples/tutorial/basic-0). Change directories to the [example](https://github.com/project-serum/anchor/tree/master/examples/tutorial/basic-0).
```bash ```bash
cd anchor/examples/tutorial/basic-0 cd anchor/examples/tutorial/basic-0
``` ```
And install any additional JavaScript dependencies:
```bash
yarn install
```
## Starting a Localnet ## Starting a Localnet
In a separate terminal, start a local network. If you're running solana In a separate terminal, start a local network. If you're running solana

View File

@ -12,12 +12,18 @@ To get started, clone the repo.
git clone https://github.com/project-serum/anchor git clone https://github.com/project-serum/anchor
``` ```
And change directories to the [example](https://github.com/project-serum/anchor/tree/master/examples/tutorial/basic-1). Change directories to the [example](https://github.com/project-serum/anchor/tree/master/examples/tutorial/basic-1).
```bash ```bash
cd anchor/examples/tutorial/basic-1 cd anchor/examples/tutorial/basic-1
``` ```
And install any additional JavaScript dependencies:
```bash
yarn install
```
## Defining a Program ## Defining a Program
We define our program as follows We define our program as follows

View File

@ -26,12 +26,18 @@ To get started, clone the repo.
git clone https://github.com/project-serum/anchor git clone https://github.com/project-serum/anchor
``` ```
And change directories to the [example](https://github.com/project-serum/anchor/tree/master/examples/tutorial/basic-2). Change directories to the [example](https://github.com/project-serum/anchor/tree/master/examples/tutorial/basic-2).
```bash ```bash
cd anchor/examples/tutorial/basic-2 cd anchor/examples/tutorial/basic-2
``` ```
And install any additional JavaScript dependencies:
```bash
yarn install
```
## Defining a Program ## Defining a Program
Here we have a simple **Counter** program, where anyone can create a counter, but only the assigned Here we have a simple **Counter** program, where anyone can create a counter, but only the assigned

View File

@ -11,12 +11,18 @@ To get started, clone the repo.
git clone https://github.com/project-serum/anchor git clone https://github.com/project-serum/anchor
``` ```
And change directories to the [example](https://github.com/project-serum/anchor/tree/master/examples/tutorial/basic-3). Change directories to the [example](https://github.com/project-serum/anchor/tree/master/examples/tutorial/basic-3).
```bash ```bash
cd anchor/examples/tutorial/basic-3 cd anchor/examples/tutorial/basic-3
``` ```
And install any additional JavaScript dependencies:
```bash
yarn install
```
## Defining a Puppet Program ## Defining a Puppet Program
We start with the program that will be called by another program, the puppet. We start with the program that will be called by another program, the puppet.
@ -44,8 +50,8 @@ Things to notice
here `SetData` and `puppet_program`. here `SetData` and `puppet_program`.
* To invoke an instruction on another program, just use the `cpi` module on the crate, here, `puppet::cpi::set_data`. * To invoke an instruction on another program, just use the `cpi` module on the crate, here, `puppet::cpi::set_data`.
* Our `Accounts` struct contains the puppet account we are calling into via CPI. Accounts used for CPI are not specifically denoted * Our `Accounts` struct contains the puppet account we are calling into via CPI. Accounts used for CPI are not specifically denoted
as such with the `CpiAccount` label since v0.15. Accounts used for CPI are not fundamentally different from `Program` or `Signer` as such with the `CpiAccount` label since v0.15. Accounts used for CPI are not fundamentally different from `Program` or `Signer`
accounts except for their role and ownership in the specific context in which they are used. accounts except for their role and ownership in the specific context in which they are used.
::: tip ::: tip
When using another Anchor program for CPI, make sure to specify the `cpi` feature in your `Cargo.toml`. When using another Anchor program for CPI, make sure to specify the `cpi` feature in your `Cargo.toml`.

View File

@ -6,4 +6,4 @@ wallet = "~/.config/solana/id.json"
basic_0 = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS" basic_0 = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"
[scripts] [scripts]
test = "mocha -t 1000000 tests/" test = "yarn run mocha -t 1000000 tests/"

View File

@ -0,0 +1,19 @@
{
"name": "basic-0",
"version": "0.18.0",
"license": "(MIT OR Apache-2.0)",
"homepage": "https://github.com/project-serum/anchor#readme",
"bugs": {
"url": "https://github.com/project-serum/anchor/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/project-serum/anchor.git"
},
"engines": {
"node": ">=11"
},
"scripts": {
"test": "anchor test"
}
}

View File

@ -6,4 +6,4 @@ wallet = "~/.config/solana/id.json"
basic_1 = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS" basic_1 = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"
[scripts] [scripts]
test = "mocha -t 1000000 tests/" test = "yarn run mocha -t 1000000 tests/"

View File

@ -0,0 +1,19 @@
{
"name": "basic-1",
"version": "0.18.0",
"license": "(MIT OR Apache-2.0)",
"homepage": "https://github.com/project-serum/anchor#readme",
"bugs": {
"url": "https://github.com/project-serum/anchor/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/project-serum/anchor.git"
},
"engines": {
"node": ">=11"
},
"scripts": {
"test": "anchor test"
}
}

View File

@ -6,4 +6,4 @@ wallet = "~/.config/solana/id.json"
basic_2 = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS" basic_2 = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"
[scripts] [scripts]
test = "mocha -t 1000000 tests/" test = "yarn run mocha -t 1000000 tests/"

View File

@ -0,0 +1,19 @@
{
"name": "basic-2",
"version": "0.18.0",
"license": "(MIT OR Apache-2.0)",
"homepage": "https://github.com/project-serum/anchor#readme",
"bugs": {
"url": "https://github.com/project-serum/anchor/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/project-serum/anchor.git"
},
"engines": {
"node": ">=11"
},
"scripts": {
"test": "anchor test"
}
}

View File

@ -7,4 +7,4 @@ puppet = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"
puppet_master = "HmbTLCmaGvZhKnn1Zfa1JVnp7vkMV4DYVxPLWBVoN65L" puppet_master = "HmbTLCmaGvZhKnn1Zfa1JVnp7vkMV4DYVxPLWBVoN65L"
[scripts] [scripts]
test = "mocha -t 1000000 tests/" test = "yarn run mocha -t 1000000 tests/"

View File

@ -0,0 +1,19 @@
{
"name": "basic-3",
"version": "0.18.0",
"license": "(MIT OR Apache-2.0)",
"homepage": "https://github.com/project-serum/anchor#readme",
"bugs": {
"url": "https://github.com/project-serum/anchor/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/project-serum/anchor.git"
},
"engines": {
"node": ">=11"
},
"scripts": {
"test": "anchor test"
}
}

View File

@ -6,4 +6,4 @@ wallet = "~/.config/solana/id.json"
basic_4 = "CwrqeMj2U8tFr1Rhkgwc84tpAsqbt9pTt2a4taoTADPr" basic_4 = "CwrqeMj2U8tFr1Rhkgwc84tpAsqbt9pTt2a4taoTADPr"
[scripts] [scripts]
test = "mocha -t 1000000 tests/" test = "yarn run mocha -t 1000000 tests/"

View File

@ -0,0 +1,19 @@
{
"name": "basic-4",
"version": "0.18.0",
"license": "(MIT OR Apache-2.0)",
"homepage": "https://github.com/project-serum/anchor#readme",
"bugs": {
"url": "https://github.com/project-serum/anchor/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/project-serum/anchor.git"
},
"engines": {
"node": ">=11"
},
"scripts": {
"test": "anchor test"
}
}

View File

@ -0,0 +1,17 @@
{
"name": "anchor-examples",
"private": true,
"workspaces": [
"basic-0",
"basic-1",
"basic-2",
"basic-3",
"basic-4"
],
"dependencies": {
"@project-serum/anchor": "^0.18.0"
},
"devDependencies": {
"mocha": "^9.1.3"
}
}

1048
examples/tutorial/yarn.lock Normal file

File diff suppressed because it is too large Load Diff

View File

@ -6,4 +6,4 @@ wallet = "~/.config/solana/id.json"
cashiers_check = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS" cashiers_check = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"
[scripts] [scripts]
test = "mocha -t 1000000 tests/" test = "yarn run mocha -t 1000000 tests/"

View File

@ -0,0 +1,19 @@
{
"name": "cashiers-check",
"version": "0.18.0",
"license": "(MIT OR Apache-2.0)",
"homepage": "https://github.com/project-serum/anchor#readme",
"bugs": {
"url": "https://github.com/project-serum/anchor/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/project-serum/anchor.git"
},
"engines": {
"node": ">=11"
},
"scripts": {
"test": "anchor test"
}
}

View File

@ -11,7 +11,7 @@ lockup = { address = "6ebQNeTPZ1j7k3TtkCCtEPRvG7GQsucQrZ7sSEDQi9Ks", idl = "./de
# #
# Testing. # Testing.
# #
test = "mocha -t 1000000 tests/" test = "yarn run mocha -t 1000000 tests/"
test-with-build = "anchor run build && anchor test --skip-build" test-with-build = "anchor run build && anchor test --skip-build"
# #
# Build the program and all CPI dependencies. # Build the program and all CPI dependencies.

19
tests/cfo/package.json Normal file
View File

@ -0,0 +1,19 @@
{
"name": "cfo",
"version": "0.18.0",
"license": "(MIT OR Apache-2.0)",
"homepage": "https://github.com/project-serum/anchor#readme",
"bugs": {
"url": "https://github.com/project-serum/anchor/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/project-serum/anchor.git"
},
"engines": {
"node": ">=11"
},
"scripts": {
"test": "anchor run test-with-build"
}
}

View File

@ -6,4 +6,4 @@ wallet = "~/.config/solana/id.json"
chat = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS" chat = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"
[scripts] [scripts]
test = "mocha -t 1000000 tests/" test = "yarn run mocha -t 1000000 tests/"

19
tests/chat/package.json Normal file
View File

@ -0,0 +1,19 @@
{
"name": "chat",
"version": "0.18.0",
"license": "(MIT OR Apache-2.0)",
"homepage": "https://github.com/project-serum/anchor#readme",
"bugs": {
"url": "https://github.com/project-serum/anchor/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/project-serum/anchor.git"
},
"engines": {
"node": ">=11"
},
"scripts": {
"test": "anchor test"
}
}

View File

@ -6,4 +6,4 @@ wallet = "~/.config/solana/id.json"
composite = "EHthziFziNoac9LBGxEaVN47Y3uUiRoXvqAiR6oes4iU" composite = "EHthziFziNoac9LBGxEaVN47Y3uUiRoXvqAiR6oes4iU"
[scripts] [scripts]
test = "mocha -t 1000000 tests/" test = "yarn run mocha -t 1000000 tests/"

View File

@ -0,0 +1,19 @@
{
"name": "composite",
"version": "0.18.0",
"license": "(MIT OR Apache-2.0)",
"homepage": "https://github.com/project-serum/anchor#readme",
"bugs": {
"url": "https://github.com/project-serum/anchor/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/project-serum/anchor.git"
},
"engines": {
"node": ">=11"
},
"scripts": {
"test": "anchor test"
}
}

View File

@ -6,4 +6,4 @@ wallet = "~/.config/solana/id.json"
errors = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS" errors = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"
[scripts] [scripts]
test = "mocha -t 1000000 tests/" test = "yarn run mocha -t 1000000 tests/"

19
tests/errors/package.json Normal file
View File

@ -0,0 +1,19 @@
{
"name": "errors",
"version": "0.18.0",
"license": "(MIT OR Apache-2.0)",
"homepage": "https://github.com/project-serum/anchor#readme",
"bugs": {
"url": "https://github.com/project-serum/anchor/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/project-serum/anchor.git"
},
"engines": {
"node": ">=11"
},
"scripts": {
"test": "anchor test"
}
}

View File

@ -1,17 +1,19 @@
{ {
"dependencies": { "name": "escrow",
"@project-serum/anchor": "../../ts", "version": "0.18.0",
"@project-serum/serum": "latest", "license": "(MIT OR Apache-2.0)",
"@solana/spl-token": "latest", "homepage": "https://github.com/project-serum/anchor#readme",
"@solana/web3.js": "latest", "bugs": {
"@types/chai": "^4.2.22", "url": "https://github.com/project-serum/anchor/issues"
"@types/mocha": "^9.0.0", },
"@types/node": "^14.14.37", "repository": {
"bn.js": "^5.2.0", "type": "git",
"camelcase": "^6.2.0", "url": "https://github.com/project-serum/anchor.git"
"chai": "^4.3.4", },
"mocha": "^9.1.2", "engines": {
"ts-mocha": "^8.0.0", "node": ">=11"
"typescript": "^4.4.3" },
"scripts": {
"test": "anchor test"
} }
} }

View File

@ -1,10 +1,6 @@
import * as anchor from "../../../ts"; import * as anchor from "@project-serum/anchor";
import { Program, BN, IdlAccounts } from "../../../ts"; import { Program, BN, IdlAccounts } from "@project-serum/anchor";
import { import { PublicKey, Keypair, SystemProgram } from "@solana/web3.js";
PublicKey,
Keypair,
SystemProgram,
} from '@solana/web3.js';
import { TOKEN_PROGRAM_ID, Token } from "@solana/spl-token"; import { TOKEN_PROGRAM_ID, Token } from "@solana/spl-token";
import { assert } from "chai"; import { assert } from "chai";
import { Escrow } from "../target/types/escrow"; import { Escrow } from "../target/types/escrow";
@ -119,9 +115,8 @@ describe("escrow", () => {
initializerTokenAccountA initializerTokenAccountA
); );
let _escrowAccount: EscrowAccount = await program.account.escrowAccount.fetch( let _escrowAccount: EscrowAccount =
escrowAccount.publicKey await program.account.escrowAccount.fetch(escrowAccount.publicKey);
);
// Check that the new owner is the PDA. // Check that the new owner is the PDA.
assert.ok(_initializerTokenAccountA.owner.equals(pda)); assert.ok(_initializerTokenAccountA.owner.equals(pda));

View File

@ -6,4 +6,4 @@ wallet = "~/.config/solana/id.json"
events = "2dhGsWUzy5YKUsjZdLHLmkNpUDAXkNa9MYWsPc4Ziqzy" events = "2dhGsWUzy5YKUsjZdLHLmkNpUDAXkNa9MYWsPc4Ziqzy"
[scripts] [scripts]
test = "mocha -t 1000000 tests/" test = "yarn run mocha -t 1000000 tests/"

19
tests/events/package.json Normal file
View File

@ -0,0 +1,19 @@
{
"name": "events",
"version": "0.18.0",
"license": "(MIT OR Apache-2.0)",
"homepage": "https://github.com/project-serum/anchor#readme",
"bugs": {
"url": "https://github.com/project-serum/anchor/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/project-serum/anchor.git"
},
"engines": {
"node": ">=11"
},
"scripts": {
"test": "anchor test"
}
}

View File

@ -6,4 +6,4 @@ wallet = "~/.config/solana/id.json"
ido_pool = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS" ido_pool = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"
[scripts] [scripts]
test = "mocha -t 1000000 tests/" test = "yarn run mocha -t 1000000 tests/"

View File

@ -0,0 +1,19 @@
{
"name": "ido-pool",
"version": "0.18.0",
"license": "(MIT OR Apache-2.0)",
"homepage": "https://github.com/project-serum/anchor#readme",
"bugs": {
"url": "https://github.com/project-serum/anchor/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/project-serum/anchor.git"
},
"engines": {
"node": ">=11"
},
"scripts": {
"test": "anchor test"
}
}

View File

@ -7,4 +7,4 @@ counter = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"
counter_auth = "Aws2XRVHjNqCUbMmaU245ojT2DBJFYX58KVo2YySEeeP" counter_auth = "Aws2XRVHjNqCUbMmaU245ojT2DBJFYX58KVo2YySEeeP"
[scripts] [scripts]
test = "mocha -t 1000000 tests/" test = "yarn run mocha -t 1000000 tests/"

View File

@ -0,0 +1,19 @@
{
"name": "interface",
"version": "0.18.0",
"license": "(MIT OR Apache-2.0)",
"homepage": "https://github.com/project-serum/anchor#readme",
"bugs": {
"url": "https://github.com/project-serum/anchor/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/project-serum/anchor.git"
},
"engines": {
"node": ">=11"
},
"scripts": {
"test": "anchor test"
}
}

View File

@ -7,4 +7,4 @@ lockup = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"
registry = "HmbTLCmaGvZhKnn1Zfa1JVnp7vkMV4DYVxPLWBVoN65L" registry = "HmbTLCmaGvZhKnn1Zfa1JVnp7vkMV4DYVxPLWBVoN65L"
[scripts] [scripts]
test = "mocha -t 1000000 tests/" test = "yarn run mocha -t 1000000 tests/"

19
tests/lockup/package.json Normal file
View File

@ -0,0 +1,19 @@
{
"name": "lockup",
"version": "0.18.0",
"license": "(MIT OR Apache-2.0)",
"homepage": "https://github.com/project-serum/anchor#readme",
"bugs": {
"url": "https://github.com/project-serum/anchor/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/project-serum/anchor.git"
},
"engines": {
"node": ">=11"
},
"scripts": {
"test": "anchor test"
}
}

View File

@ -14,4 +14,4 @@ program = "./target/deploy/misc.so"
exclude = ["programs/shared"] exclude = ["programs/shared"]
[scripts] [scripts]
test = "mocha -t 1000000 tests/" test = "yarn run mocha -t 1000000 tests/"

View File

@ -1,7 +1,19 @@
{ {
"dependencies": { "name": "misc",
"@project-serum/anchor": "^0.11.1", "version": "0.18.0",
"@solana/spl-token": "^0.1.6", "license": "(MIT OR Apache-2.0)",
"mocha": "^9.0.3" "homepage": "https://github.com/project-serum/anchor#readme",
"bugs": {
"url": "https://github.com/project-serum/anchor/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/project-serum/anchor.git"
},
"engines": {
"node": ">=11"
},
"scripts": {
"test": "anchor test"
} }
} }

View File

@ -6,4 +6,4 @@ wallet = "~/.config/solana/id.json"
multisig = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS" multisig = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"
[scripts] [scripts]
test = "mocha -t 1000000 tests/" test = "yarn run mocha -t 1000000 tests/"

View File

@ -0,0 +1,19 @@
{
"name": "multisig",
"version": "0.18.0",
"license": "(MIT OR Apache-2.0)",
"homepage": "https://github.com/project-serum/anchor#readme",
"bugs": {
"url": "https://github.com/project-serum/anchor/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/project-serum/anchor.git"
},
"engines": {
"node": ">=11"
},
"scripts": {
"test": "anchor test"
}
}

40
tests/package.json Normal file
View File

@ -0,0 +1,40 @@
{
"name": "anchor-tests",
"private": true,
"workspaces": [
"cashiers-check",
"cfo",
"chat",
"composite",
"errors",
"escrow",
"events",
"ido-pool",
"interface",
"lockup",
"misc",
"multisig",
"permissioned-markets",
"pyth",
"spl/token-proxy",
"swap",
"system-accounts",
"sysvars",
"tictactoe",
"typescript",
"zero-copy"
],
"dependencies": {
"@project-serum/anchor": "^0.18.0",
"@project-serum/common": "^0.0.1-beta.3",
"@project-serum/serum": "^0.13.60",
"@solana/spl-token": "^0.1.8"
},
"devDependencies": {
"@types/node": "^14.14.37",
"chai": "^4.3.4",
"mocha": "^9.1.3",
"ts-mocha": "^8.0.0",
"typescript": "^4.4.4"
}
}

View File

@ -11,4 +11,4 @@ address = "9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin"
program = "./deps/serum-dex/dex/target/deploy/serum_dex.so" program = "./deps/serum-dex/dex/target/deploy/serum_dex.so"
[scripts] [scripts]
test = "mocha -t 1000000 tests/" test = "yarn run mocha -t 1000000 tests/"

View File

@ -0,0 +1,19 @@
{
"name": "permissioned-markets",
"version": "0.18.0",
"license": "(MIT OR Apache-2.0)",
"homepage": "https://github.com/project-serum/anchor#readme",
"bugs": {
"url": "https://github.com/project-serum/anchor/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/project-serum/anchor.git"
},
"engines": {
"node": ">=11"
},
"scripts": {
"test": "anchor test"
}
}

View File

@ -6,4 +6,4 @@ wallet = "~/.config/solana/id.json"
pyth = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS" pyth = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"
[scripts] [scripts]
test = "ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts" test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts"

19
tests/pyth/package.json Normal file
View File

@ -0,0 +1,19 @@
{
"name": "pyth",
"version": "0.18.0",
"license": "(MIT OR Apache-2.0)",
"homepage": "https://github.com/project-serum/anchor#readme",
"bugs": {
"url": "https://github.com/project-serum/anchor/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/project-serum/anchor.git"
},
"engines": {
"node": ">=11"
},
"scripts": {
"test": "anchor test"
}
}

View File

@ -6,4 +6,4 @@ wallet = "~/.config/solana/id.json"
token_proxy = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS" token_proxy = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"
[scripts] [scripts]
test = "mocha -t 1000000 tests/" test = "yarn run mocha -t 1000000 tests/"

View File

@ -0,0 +1,19 @@
{
"name": "token-proxy",
"version": "0.18.0",
"license": "(MIT OR Apache-2.0)",
"homepage": "https://github.com/project-serum/anchor#readme",
"bugs": {
"url": "https://github.com/project-serum/anchor/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/project-serum/anchor.git"
},
"engines": {
"node": ">=11"
},
"scripts": {
"test": "anchor test"
}
}

View File

@ -10,4 +10,4 @@ address = "9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin"
program = "./deps/serum-dex/dex/target/deploy/serum_dex.so" program = "./deps/serum-dex/dex/target/deploy/serum_dex.so"
[scripts] [scripts]
test = "mocha -t 1000000 tests/" test = "yarn run mocha -t 1000000 tests/"

19
tests/swap/package.json Normal file
View File

@ -0,0 +1,19 @@
{
"name": "swap",
"version": "0.18.0",
"license": "(MIT OR Apache-2.0)",
"homepage": "https://github.com/project-serum/anchor#readme",
"bugs": {
"url": "https://github.com/project-serum/anchor/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/project-serum/anchor.git"
},
"engines": {
"node": ">=11"
},
"scripts": {
"test": "anchor test"
}
}

View File

@ -6,4 +6,4 @@ wallet = "~/.config/solana/id.json"
system_accounts = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS" system_accounts = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"
[scripts] [scripts]
test = "mocha -t 1000000 tests/" test = "yarn run mocha -t 1000000 tests/"

View File

@ -0,0 +1,19 @@
{
"name": "system-accounts",
"version": "0.18.0",
"license": "(MIT OR Apache-2.0)",
"homepage": "https://github.com/project-serum/anchor#readme",
"bugs": {
"url": "https://github.com/project-serum/anchor/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/project-serum/anchor.git"
},
"engines": {
"node": ">=11"
},
"scripts": {
"test": "anchor test"
}
}

View File

@ -6,4 +6,4 @@ wallet = "~/.config/solana/id.json"
sysvars = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS" sysvars = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"
[scripts] [scripts]
test = "mocha -t 1000000 tests/" test = "yarn run mocha -t 1000000 tests/"

View File

@ -0,0 +1,19 @@
{
"name": "sysvars",
"version": "0.18.0",
"license": "(MIT OR Apache-2.0)",
"homepage": "https://github.com/project-serum/anchor#readme",
"bugs": {
"url": "https://github.com/project-serum/anchor/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/project-serum/anchor.git"
},
"engines": {
"node": ">=11"
},
"scripts": {
"test": "anchor test"
}
}

View File

@ -6,4 +6,4 @@ wallet = "~/.config/solana/id.json"
tictactoe = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS" tictactoe = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"
[scripts] [scripts]
test = "mocha -t 1000000 tests/" test = "yarn run mocha -t 1000000 tests/"

View File

@ -0,0 +1,19 @@
{
"name": "tictactoe",
"version": "0.18.0",
"license": "(MIT OR Apache-2.0)",
"homepage": "https://github.com/project-serum/anchor#readme",
"bugs": {
"url": "https://github.com/project-serum/anchor/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/project-serum/anchor.git"
},
"engines": {
"node": ">=11"
},
"scripts": {
"test": "anchor test"
}
}

View File

@ -9,4 +9,4 @@ typescript = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"
members = ["programs/typescript"] members = ["programs/typescript"]
[scripts] [scripts]
test = "ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts" test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts"

View File

@ -1,17 +1,19 @@
{ {
"name": "typescript", "name": "typescript-example",
"version": "1.0.0", "version": "0.18.0",
"description": "", "license": "(MIT OR Apache-2.0)",
"main": "index.js", "homepage": "https://github.com/project-serum/anchor#readme",
"directories": { "bugs": {
"test": "tests" "url": "https://github.com/project-serum/anchor/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/project-serum/anchor.git"
},
"engines": {
"node": ">=11"
}, },
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1" "test": "anchor test"
},
"author": "",
"license": "ISC",
"dependencies": {
"@types/node": "^14.14.37"
} }
} }

1277
tests/yarn.lock Normal file

File diff suppressed because it is too large Load Diff

View File

@ -6,7 +6,7 @@ wallet = "~/.config/solana/id.json"
members = ["programs/zero-copy", "programs/zero-cpi"] members = ["programs/zero-copy", "programs/zero-cpi"]
[scripts] [scripts]
test = "mocha -t 1000000 tests/" test = "yarn run mocha -t 1000000 tests/"
[programs.localnet] [programs.localnet]
zero_cpi = "ErjUjtqKE5AGWUsjseSJCVLtddM6rhaMbDqmhzraF9h6" zero_cpi = "ErjUjtqKE5AGWUsjseSJCVLtddM6rhaMbDqmhzraF9h6"

View File

@ -0,0 +1,19 @@
{
"name": "zero-copy",
"version": "0.18.0",
"license": "(MIT OR Apache-2.0)",
"homepage": "https://github.com/project-serum/anchor#readme",
"bugs": {
"url": "https://github.com/project-serum/anchor/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/project-serum/anchor.git"
},
"engines": {
"node": ">=11"
},
"scripts": {
"test": "anchor test"
}
}