refactor: moved programs and clients under examples

This commit is contained in:
Conner Gallagher 2022-07-22 12:11:29 -06:00
parent 10a98f32b1
commit aa7e4fe2d2
123 changed files with 151 additions and 107 deletions

View File

@ -1,9 +1,9 @@
[workspace]
members = [
"programs/anchor-feed-parser",
"programs/anchor-vrf-parser",
"programs/anchor-buffer-parser",
"programs/native-feed-parser"
"examples/programs/anchor-feed-parser",
"examples/programs/anchor-vrf-parser",
"examples/programs/anchor-buffer-parser",
"examples/programs/native-feed-parser"
]
[provider]
@ -21,7 +21,7 @@ anchor_buffer_parser = "96punQGZDShZGkzsBa3SsfTxfUnwu4XGpzXbhF7NTgcP"
url = "https://anchor.projectserum.com"
[scripts]
test = "yarn run ts-mocha -p ./tsconfig.testing.json -t 1000000 ./programs/*/tests/*.test.ts"
test = "yarn run ts-mocha -p ./tsconfig.testing.json -t 1000000 ./examples/programs/*/tests/*.test.ts"
[test.validator]

View File

@ -1,6 +1,6 @@
[workspace]
members = [
"programs/*",
"examples/programs/*",
]
exclude = [
"libraries/rs"

View File

@ -18,20 +18,20 @@ A monorepo containing APIs, Utils, and examples for Switchboard V2.
### Program Examples
| Package | Description |
| ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| [anchor-feed-parser](./programs/anchor-feed-parser) | Anchor example program demonstrating how to deserialize and read an onchain aggregator account. |
| [native-feed-parser](./programs/native-feed-parser) | Solana Program Library example demonstrating how to deserialize and read an onchain aggregator account. |
| [anchor-vrf-parser](./programs/anchor-vrf-parser) | Anchor example program demonstrating how to deserialize and read an onchain verifiable randomness function (VRF) account. |
| [anchor-buffer-parser](./programs/anchor-buffer-parser) | Anchor example program demonstrating how to deserialize and read an onchain buffer relayer account. |
| Package | Description |
| ---------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| [anchor-feed-parser](./examples/programs/anchor-feed-parser) | Anchor example program demonstrating how to deserialize and read an onchain aggregator account. |
| [native-feed-parser](./examples/programs/native-feed-parser) | Solana Program Library example demonstrating how to deserialize and read an onchain aggregator account. |
| [anchor-vrf-parser](./examples/programs/anchor-vrf-parser) | Anchor example program demonstrating how to deserialize and read an onchain verifiable randomness function (VRF) account. |
| [anchor-buffer-parser](./examples/programs/anchor-buffer-parser) | Anchor example program demonstrating how to deserialize and read an onchain buffer relayer account. |
### Client Examples
| Package | Description |
| ----------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
| [feed-parser](./packages/feed-parser) | Typescript example demonstrating how to read an aggregator account. |
| [feed-walkthrough](./packages/feed-walkthrough) | Typescript example demonstrating how to create and manage your own oracle queue. |
| [lease-observer](./packages/lease-observer) | Typescript example demonstrating how to send PagerDuty alerts when your aggregator lease is low on funds. |
| Package | Description |
| ------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
| [feed-parser](./examples/clients/feed-parser) | Typescript example demonstrating how to read an aggregator account. |
| [feed-walkthrough](./examples/clients/feed-walkthrough) | Typescript example demonstrating how to create and manage your own oracle queue. |
| [lease-observer](./examples/clients/lease-observer) | Typescript example demonstrating how to send PagerDuty alerts when your aggregator lease is low on funds. |
## Dependencies

7
examples/README.md Normal file
View File

@ -0,0 +1,7 @@
# Examples
This directory contains some examples to get started with Switchboard V2.
- **Programs** - On-chain examples for reading and checking Sbv2 data feeds, VRF, and buffer relayers.
- **Clients** - Off-chain examples to read and update Sbv2 accounts.
- **Job Definitions** - Some example job definitions to fetch and publish data on-chain.

View File

@ -1,14 +1,14 @@
{
"extends": "../../tsconfig.json",
"extends": "../../../tsconfig.json",
"compilerOptions": {
"outDir": "dist",
"rootDir": "src",
"paths": {
"@switchboard-xyz/switchboard-v2": ["../../libraries/ts"]
"@switchboard-xyz/switchboard-v2": ["../../../libraries/ts"]
}
},
"include": ["src/**/*"],
"exclude": ["esbuild.js", "dist"],
"references": [{ "path": "../../libraries/ts" }],
"references": [{ "path": "../../../libraries/ts" }],
"files": ["src/main.ts"]
}

View File

@ -1,18 +1,18 @@
{
"extends": "../../tsconfig.json",
"extends": "../../../tsconfig.json",
"compilerOptions": {
"outDir": "dist",
"rootDir": "src",
"paths": {
"@switchboard-xyz/switchboard-v2": ["../../libraries/ts"],
"@switchboard-xyz/switchboard-v2": ["../../../libraries/ts"],
"@solana/spl-token": [
"../../node_modules/@solana/spl-token",
"../../../node_modules/@solana/spl-token",
"./node_modules/@solana/spl-token"
]
}
},
"include": ["src/**/*"],
"exclude": ["esbuild.js", "dist"],
"references": [{ "path": "../../libraries/ts" }],
"references": [{ "path": "../../../libraries/ts" }],
"files": ["src/main.ts"]
}

View File

@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../../tsconfig.json",
"ts-node": {
"compilerOptions": {
"module": "commonjs",
@ -19,10 +19,10 @@
"rootDir": "src",
"strict": false,
"paths": {
"@switchboard-xyz/switchboard-v2": ["../../libraries/ts"],
"@switchboard-xyz/sbv2-utils": ["../../libraries/sbv2-utils"],
"@switchboard-xyz/switchboard-v2": ["../../../libraries/ts"],
"@switchboard-xyz/sbv2-utils": ["../../../libraries/sbv2-utils"],
"@solana/spl-token": [
"../../node_modules/@solana/spl-token",
"../../../node_modules/@solana/spl-token",
"./node_modules/@solana/spl-token"
]
}
@ -30,8 +30,8 @@
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"],
"references": [
{ "path": "../../libraries/ts" },
{ "path": "../../libraries/sbv2-utils" }
{ "path": "../../../libraries/ts" },
{ "path": "../../../libraries/sbv2-utils" }
],
"files": ["src/main.ts"]
}

View File

@ -15,7 +15,7 @@ import fetch from "node-fetch";
import {
AnchorBufferParser,
IDL,
} from "../../../target/types/anchor_buffer_parser";
} from "../../../../target/types/anchor_buffer_parser";
import { PROGRAM_ID } from "../client/programId";
describe("anchor-buffer-parser test", () => {

View File

@ -0,0 +1,23 @@
{
"extends": "../../../tsconfig.json",
"compilerOptions": {
"types": ["mocha", "chai"],
"typeRoots": ["./node_modules/@types"],
"module": "CommonJS",
"noEmit": true,
"esModuleInterop": true,
"paths": {
"@switchboard-xyz/switchboard-v2": ["../../../libraries/ts"],
"@switchboard-xyz/sbv2-utils": ["../../../libraries/sbv2-utils"]
}
},
"include": [
"tests/**/*",
"client/**/*",
"../../../target/types/anchor_feed_parser"
],
"references": [
{ "path": "../../../libraries/ts" },
{ "path": "../../../libraries/sbv2-utils" }
]
}

View File

@ -7,7 +7,7 @@ import chai from "chai";
import {
AnchorFeedParser,
IDL,
} from "../../../target/types/anchor_feed_parser";
} from "../../../../target/types/anchor_feed_parser";
import { PROGRAM_ID } from "../client/programId";
const expect = chai.expect;

View File

@ -0,0 +1,23 @@
{
"extends": "../../../tsconfig.json",
"compilerOptions": {
"types": ["mocha", "chai"],
"typeRoots": ["./node_modules/@types"],
"module": "CommonJS",
"noEmit": true,
"esModuleInterop": true,
"paths": {
"@switchboard-xyz/switchboard-v2": ["../../../libraries/ts"],
"@switchboard-xyz/sbv2-utils": ["../../../libraries/sbv2-utils"]
}
},
"include": [
"tests/**/*",
"client/**/*",
"../../../target/types/anchor_feed_parser"
],
"references": [
{ "path": "../../../libraries/ts" },
{ "path": "../../../libraries/sbv2-utils" }
]
}

Some files were not shown because too many files have changed in this diff Show More