refactor: moved programs and clients under examples
This commit is contained in:
parent
10a98f32b1
commit
aa7e4fe2d2
10
Anchor.toml
10
Anchor.toml
|
@ -1,9 +1,9 @@
|
||||||
[workspace]
|
[workspace]
|
||||||
members = [
|
members = [
|
||||||
"programs/anchor-feed-parser",
|
"examples/programs/anchor-feed-parser",
|
||||||
"programs/anchor-vrf-parser",
|
"examples/programs/anchor-vrf-parser",
|
||||||
"programs/anchor-buffer-parser",
|
"examples/programs/anchor-buffer-parser",
|
||||||
"programs/native-feed-parser"
|
"examples/programs/native-feed-parser"
|
||||||
]
|
]
|
||||||
|
|
||||||
[provider]
|
[provider]
|
||||||
|
@ -21,7 +21,7 @@ anchor_buffer_parser = "96punQGZDShZGkzsBa3SsfTxfUnwu4XGpzXbhF7NTgcP"
|
||||||
url = "https://anchor.projectserum.com"
|
url = "https://anchor.projectserum.com"
|
||||||
|
|
||||||
[scripts]
|
[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]
|
[test.validator]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[workspace]
|
[workspace]
|
||||||
members = [
|
members = [
|
||||||
"programs/*",
|
"examples/programs/*",
|
||||||
]
|
]
|
||||||
exclude = [
|
exclude = [
|
||||||
"libraries/rs"
|
"libraries/rs"
|
||||||
|
|
22
README.md
22
README.md
|
@ -18,20 +18,20 @@ A monorepo containing APIs, Utils, and examples for Switchboard V2.
|
||||||
|
|
||||||
### Program Examples
|
### Program Examples
|
||||||
|
|
||||||
| Package | Description |
|
| Package | Description |
|
||||||
| ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
|
| ---------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| [anchor-feed-parser](./programs/anchor-feed-parser) | Anchor example program demonstrating how to deserialize and read an onchain aggregator account. |
|
| [anchor-feed-parser](./examples/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. |
|
| [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](./programs/anchor-vrf-parser) | Anchor example program demonstrating how to deserialize and read an onchain verifiable randomness function (VRF) 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](./programs/anchor-buffer-parser) | Anchor example program demonstrating how to deserialize and read an onchain buffer relayer 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
|
### Client Examples
|
||||||
|
|
||||||
| Package | Description |
|
| Package | Description |
|
||||||
| ----------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
|
| ------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
|
||||||
| [feed-parser](./packages/feed-parser) | Typescript example demonstrating how to read an aggregator account. |
|
| [feed-parser](./examples/clients/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. |
|
| [feed-walkthrough](./examples/clients/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. |
|
| [lease-observer](./examples/clients/lease-observer) | Typescript example demonstrating how to send PagerDuty alerts when your aggregator lease is low on funds. |
|
||||||
|
|
||||||
## Dependencies
|
## Dependencies
|
||||||
|
|
||||||
|
|
|
@ -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.
|
|
@ -1,14 +1,14 @@
|
||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../../tsconfig.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "dist",
|
"outDir": "dist",
|
||||||
"rootDir": "src",
|
"rootDir": "src",
|
||||||
"paths": {
|
"paths": {
|
||||||
"@switchboard-xyz/switchboard-v2": ["../../libraries/ts"]
|
"@switchboard-xyz/switchboard-v2": ["../../../libraries/ts"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"include": ["src/**/*"],
|
"include": ["src/**/*"],
|
||||||
"exclude": ["esbuild.js", "dist"],
|
"exclude": ["esbuild.js", "dist"],
|
||||||
"references": [{ "path": "../../libraries/ts" }],
|
"references": [{ "path": "../../../libraries/ts" }],
|
||||||
"files": ["src/main.ts"]
|
"files": ["src/main.ts"]
|
||||||
}
|
}
|
|
@ -1,18 +1,18 @@
|
||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../../tsconfig.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "dist",
|
"outDir": "dist",
|
||||||
"rootDir": "src",
|
"rootDir": "src",
|
||||||
"paths": {
|
"paths": {
|
||||||
"@switchboard-xyz/switchboard-v2": ["../../libraries/ts"],
|
"@switchboard-xyz/switchboard-v2": ["../../../libraries/ts"],
|
||||||
"@solana/spl-token": [
|
"@solana/spl-token": [
|
||||||
"../../node_modules/@solana/spl-token",
|
"../../../node_modules/@solana/spl-token",
|
||||||
"./node_modules/@solana/spl-token"
|
"./node_modules/@solana/spl-token"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"include": ["src/**/*"],
|
"include": ["src/**/*"],
|
||||||
"exclude": ["esbuild.js", "dist"],
|
"exclude": ["esbuild.js", "dist"],
|
||||||
"references": [{ "path": "../../libraries/ts" }],
|
"references": [{ "path": "../../../libraries/ts" }],
|
||||||
"files": ["src/main.ts"]
|
"files": ["src/main.ts"]
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../../tsconfig.json",
|
||||||
"ts-node": {
|
"ts-node": {
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
|
@ -19,10 +19,10 @@
|
||||||
"rootDir": "src",
|
"rootDir": "src",
|
||||||
"strict": false,
|
"strict": false,
|
||||||
"paths": {
|
"paths": {
|
||||||
"@switchboard-xyz/switchboard-v2": ["../../libraries/ts"],
|
"@switchboard-xyz/switchboard-v2": ["../../../libraries/ts"],
|
||||||
"@switchboard-xyz/sbv2-utils": ["../../libraries/sbv2-utils"],
|
"@switchboard-xyz/sbv2-utils": ["../../../libraries/sbv2-utils"],
|
||||||
"@solana/spl-token": [
|
"@solana/spl-token": [
|
||||||
"../../node_modules/@solana/spl-token",
|
"../../../node_modules/@solana/spl-token",
|
||||||
"./node_modules/@solana/spl-token"
|
"./node_modules/@solana/spl-token"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -30,8 +30,8 @@
|
||||||
"include": ["src/**/*"],
|
"include": ["src/**/*"],
|
||||||
"exclude": ["node_modules", "dist"],
|
"exclude": ["node_modules", "dist"],
|
||||||
"references": [
|
"references": [
|
||||||
{ "path": "../../libraries/ts" },
|
{ "path": "../../../libraries/ts" },
|
||||||
{ "path": "../../libraries/sbv2-utils" }
|
{ "path": "../../../libraries/sbv2-utils" }
|
||||||
],
|
],
|
||||||
"files": ["src/main.ts"]
|
"files": ["src/main.ts"]
|
||||||
}
|
}
|
|
@ -15,7 +15,7 @@ import fetch from "node-fetch";
|
||||||
import {
|
import {
|
||||||
AnchorBufferParser,
|
AnchorBufferParser,
|
||||||
IDL,
|
IDL,
|
||||||
} from "../../../target/types/anchor_buffer_parser";
|
} from "../../../../target/types/anchor_buffer_parser";
|
||||||
import { PROGRAM_ID } from "../client/programId";
|
import { PROGRAM_ID } from "../client/programId";
|
||||||
|
|
||||||
describe("anchor-buffer-parser test", () => {
|
describe("anchor-buffer-parser test", () => {
|
|
@ -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" }
|
||||||
|
]
|
||||||
|
}
|
|
@ -7,7 +7,7 @@ import chai from "chai";
|
||||||
import {
|
import {
|
||||||
AnchorFeedParser,
|
AnchorFeedParser,
|
||||||
IDL,
|
IDL,
|
||||||
} from "../../../target/types/anchor_feed_parser";
|
} from "../../../../target/types/anchor_feed_parser";
|
||||||
import { PROGRAM_ID } from "../client/programId";
|
import { PROGRAM_ID } from "../client/programId";
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
|
|
|
@ -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
Loading…
Reference in New Issue