cleaned up package.json, tsconfig.json, and misc build configs

cleaned up tsconfig


wip


wip


Publish

 - @switchboard-xyz/switchboardv2-cli@0.1.22
 - @switchboard-xyz/eslint-config@0.1.0
 - @switchboard-xyz/sbv2-lite@0.1.2
 - @switchboard-xyz/sbv2-utils@0.0.14
 - @switchboard-xyz/switchboard-v2@0.0.98
 - @switchboard-xyz/v2-feed-parser@0.1.1
 - @switchboard-xyz/v2-feed-walkthrough@0.1.1
 - @switchboard-xyz/lease-observer@0.1.1
 - anchor-feed-parser@0.1.2
 - anchor-vrf-parser@0.1.2
 - spl-feed-parser@0.1.2
 - website@0.1.1

Publish


Publish

 - @switchboard-xyz/switchboardv2-cli@0.1.22
 - @switchboard-xyz/eslint-config@0.1.0
 - @switchboard-xyz/sbv2-lite@0.1.2
 - @switchboard-xyz/sbv2-utils@0.1.13
 - @switchboard-xyz/switchboard-v2@0.0.98
 - @switchboard-xyz/v2-feed-parser@0.1.1
 - @switchboard-xyz/v2-feed-walkthrough@0.1.1
 - @switchboard-xyz/lease-observer@0.1.1
 - anchor-feed-parser@0.1.1
 - anchor-vrf-parser@0.1.1
 - spl-feed-parser@0.1.1

Publish


ww
This commit is contained in:
Conner Gallagher 2022-05-25 12:38:29 -06:00
parent 3fce2e42e7
commit 39377b0c20
57 changed files with 647 additions and 1225 deletions

1
.gitignore vendored
View File

@ -29,6 +29,7 @@ secrets
*-keypair*.json
.archive
*-error.log
*-debug.log
# Root level jsons ignored
job-directory/*.json

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022 Switchboard
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -78,6 +78,28 @@ The anchor test are configured to first fetch the account info for the Switchboa
## Website
Run live server
```
yarn workspace website start
```
Build
```
yarn docs:build
```
## Publishing
To check which packages have changed
```
lerna changed
```
To publish changes to NPM registries
```
lerna publish
```

21
cli/LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022 Switchboard
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -123,7 +123,7 @@ EXAMPLE
$ sbv2 aggregator:add:job
```
_See code: [src/commands/aggregator/add/job.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/aggregator/add/job.ts)_
_See code: [src/commands/aggregator/add/job.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/aggregator/add/job.ts)_
## `sbv2 aggregator:create QUEUEKEY`
@ -174,7 +174,7 @@ OPTIONS
volatility
```
_See code: [src/commands/aggregator/create/index.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/aggregator/create/index.ts)_
_See code: [src/commands/aggregator/create/index.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/aggregator/create/index.ts)_
## `sbv2 aggregator:create:copy AGGREGATORSOURCE`
@ -234,7 +234,7 @@ EXAMPLES
9WZ59yz95bd3XwJxDPVE2PjvVWmSy9WM1NgGD2Hqsohw --keypair ../payer-keypair.json --sourceCluster mainnet-beta
```
_See code: [src/commands/aggregator/create/copy.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/aggregator/create/copy.ts)_
_See code: [src/commands/aggregator/create/copy.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/aggregator/create/copy.ts)_
## `sbv2 aggregator:create:json DEFINITIONFILE`
@ -277,7 +277,7 @@ EXAMPLE
GhYg3R1V6DmJbwuc57qZeoYG6gUuvCotUF1zU3WCj98U --outputFile aggregator.schema.json
```
_See code: [src/commands/aggregator/create/json.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/aggregator/create/json.ts)_
_See code: [src/commands/aggregator/create/json.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/aggregator/create/json.ts)_
## `sbv2 aggregator:lock AGGREGATORKEY`
@ -308,7 +308,7 @@ OPTIONS
--programId=programId alternative Switchboard program ID to interact with
```
_See code: [src/commands/aggregator/lock.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/aggregator/lock.ts)_
_See code: [src/commands/aggregator/lock.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/aggregator/lock.ts)_
## `sbv2 aggregator:permission:create AGGREGATORKEY`
@ -338,7 +338,7 @@ OPTIONS
--programId=programId alternative Switchboard program ID to interact with
```
_See code: [src/commands/aggregator/permission/create.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/aggregator/permission/create.ts)_
_See code: [src/commands/aggregator/permission/create.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/aggregator/permission/create.ts)_
## `sbv2 aggregator:remove:job AGGREGATORKEY JOBKEY`
@ -375,7 +375,7 @@ EXAMPLE
$ sbv2 aggregator:remove:job
```
_See code: [src/commands/aggregator/remove/job.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/aggregator/remove/job.ts)_
_See code: [src/commands/aggregator/remove/job.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/aggregator/remove/job.ts)_
## `sbv2 aggregator:set AGGREGATORKEY`
@ -428,7 +428,7 @@ EXAMPLE
../payer-keypair.json
```
_See code: [src/commands/aggregator/set/index.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/aggregator/set/index.ts)_
_See code: [src/commands/aggregator/set/index.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/aggregator/set/index.ts)_
## `sbv2 aggregator:set:authority AGGREGATORKEY NEWAUTHORITY`
@ -460,7 +460,7 @@ OPTIONS
--programId=programId alternative Switchboard program ID to interact with
```
_See code: [src/commands/aggregator/set/authority.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/aggregator/set/authority.ts)_
_See code: [src/commands/aggregator/set/authority.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/aggregator/set/authority.ts)_
## `sbv2 aggregator:set:batchSize AGGREGATORKEY BATCHSIZE`
@ -492,7 +492,7 @@ OPTIONS
--programId=programId alternative Switchboard program ID to interact with
```
_See code: [src/commands/aggregator/set/batchSize.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/aggregator/set/batchSize.ts)_
_See code: [src/commands/aggregator/set/batchSize.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/aggregator/set/batchSize.ts)_
## `sbv2 aggregator:set:forceReportPeriod AGGREGATORKEY FORCEREPORTPERIOD`
@ -533,7 +533,7 @@ EXAMPLE
../payer-keypair.json
```
_See code: [src/commands/aggregator/set/forceReportPeriod.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/aggregator/set/forceReportPeriod.ts)_
_See code: [src/commands/aggregator/set/forceReportPeriod.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/aggregator/set/forceReportPeriod.ts)_
## `sbv2 aggregator:set:history AGGREGATORKEY SIZE`
@ -571,7 +571,7 @@ EXAMPLE
$ sbv2 aggregator:set:history GvDMxPzN1sCj7L26YDK2HnMRXEQmQ2aemov8YBtPS7vR 10000 --keypair ../payer-keypair.json
```
_See code: [src/commands/aggregator/set/history.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/aggregator/set/history.ts)_
_See code: [src/commands/aggregator/set/history.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/aggregator/set/history.ts)_
## `sbv2 aggregator:set:minJobs AGGREGATORKEY MINJOBRESULTS`
@ -603,7 +603,7 @@ OPTIONS
--programId=programId alternative Switchboard program ID to interact with
```
_See code: [src/commands/aggregator/set/minJobs.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/aggregator/set/minJobs.ts)_
_See code: [src/commands/aggregator/set/minJobs.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/aggregator/set/minJobs.ts)_
## `sbv2 aggregator:set:minOracles AGGREGATORKEY MINORACLERESULTS`
@ -635,7 +635,7 @@ OPTIONS
--programId=programId alternative Switchboard program ID to interact with
```
_See code: [src/commands/aggregator/set/minOracles.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/aggregator/set/minOracles.ts)_
_See code: [src/commands/aggregator/set/minOracles.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/aggregator/set/minOracles.ts)_
## `sbv2 aggregator:set:queue AGGREGATORKEY QUEUEKEY`
@ -667,7 +667,7 @@ OPTIONS
--programId=programId alternative Switchboard program ID to interact with
```
_See code: [src/commands/aggregator/set/queue.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/aggregator/set/queue.ts)_
_See code: [src/commands/aggregator/set/queue.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/aggregator/set/queue.ts)_
## `sbv2 aggregator:set:updateInterval AGGREGATORKEY UPDATEINTERVAL`
@ -702,7 +702,7 @@ EXAMPLE
$ sbv2 aggregator:set:updateInterval GvDMxPzN1sCj7L26YDK2HnMRXEQmQ2aemov8YBtPS7vR 60 --keypair ../payer-keypair.json
```
_See code: [src/commands/aggregator/set/updateInterval.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/aggregator/set/updateInterval.ts)_
_See code: [src/commands/aggregator/set/updateInterval.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/aggregator/set/updateInterval.ts)_
## `sbv2 aggregator:set:varianceThreshold AGGREGATORKEY VARIANCETHRESHOLD`
@ -743,7 +743,7 @@ EXAMPLE
../payer-keypair.json
```
_See code: [src/commands/aggregator/set/varianceThreshold.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/aggregator/set/varianceThreshold.ts)_
_See code: [src/commands/aggregator/set/varianceThreshold.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/aggregator/set/varianceThreshold.ts)_
## `sbv2 aggregator:update AGGREGATORKEY`
@ -776,7 +776,7 @@ EXAMPLE
$ sbv2 aggregator:update J7j9xX8JP2B2ErvUzuqGAKBGeggsxPyFXj5MqZcYDxfa --keypair ../payer-keypair.json
```
_See code: [src/commands/aggregator/update.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/aggregator/update.ts)_
_See code: [src/commands/aggregator/update.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/aggregator/update.ts)_
## `sbv2 config:print`
@ -806,7 +806,7 @@ EXAMPLE
$ sbv2 config:print
```
_See code: [src/commands/config/print.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/config/print.ts)_
_See code: [src/commands/config/print.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/config/print.ts)_
## `sbv2 config:set PARAM [VALUE]`
@ -839,7 +839,7 @@ OPTIONS
--programId=programId alternative Switchboard program ID to interact with
```
_See code: [src/commands/config/set.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/config/set.ts)_
_See code: [src/commands/config/set.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/config/set.ts)_
## `sbv2 crank:list CRANKKEY`
@ -872,7 +872,7 @@ OPTIONS
--programId=programId alternative Switchboard program ID to interact with
```
_See code: [src/commands/crank/list.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/crank/list.ts)_
_See code: [src/commands/crank/list.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/crank/list.ts)_
## `sbv2 crank:push CRANKKEY AGGREGATORKEY`
@ -907,7 +907,7 @@ ALIASES
$ sbv2 crank:add:aggregator
```
_See code: [src/commands/crank/push.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/crank/push.ts)_
_See code: [src/commands/crank/push.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/crank/push.ts)_
## `sbv2 crank:turn CRANKKEY`
@ -940,7 +940,7 @@ EXAMPLE
$ sbv2 crank:turn 85L2cFUvXaeGQ4HrzP8RJEVCL7WvRrXM2msvEmQ82AVr --keypair ../payer-keypair.json
```
_See code: [src/commands/crank/turn.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/crank/turn.ts)_
_See code: [src/commands/crank/turn.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/crank/turn.ts)_
## `sbv2 help [COMMAND]`
@ -993,7 +993,7 @@ EXAMPLE
$ sbv2 job:create:copy 7pdb5RVM6cVBU8XDfpGqakb1S4wX2i5QsZxT117tK4HS --keypair ../payer-keypair.json
```
_See code: [src/commands/job/create/copy.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/job/create/copy.ts)_
_See code: [src/commands/job/create/copy.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/job/create/copy.ts)_
## `sbv2 job:create:json DEFINITIONFILE`
@ -1038,7 +1038,7 @@ EXAMPLE
--aggregatorAuthority=../aggregator-keypair.json --outputFile=job.schema.json
```
_See code: [src/commands/job/create/json.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/job/create/json.ts)_
_See code: [src/commands/job/create/json.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/job/create/json.ts)_
## `sbv2 job:create:template TEMPLATE ID`
@ -1084,7 +1084,7 @@ EXAMPLES
$ sbv2 job:create:template ftxUs BTC_USD -k ../payer-keypair.json -n ftxUs_Btc -f ftx_us_btc_job.json
```
_See code: [src/commands/job/create/template.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/job/create/template.ts)_
_See code: [src/commands/job/create/template.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/job/create/template.ts)_
## `sbv2 json:add:aggregator`
@ -1117,7 +1117,7 @@ OPTIONS
--sourceAggregator=sourceAggregator public key of an existing aggregator account to copy
```
_See code: [src/commands/json/add/aggregator.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/json/add/aggregator.ts)_
_See code: [src/commands/json/add/aggregator.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/json/add/aggregator.ts)_
## `sbv2 json:add:crank SCHEMAFILE`
@ -1152,7 +1152,7 @@ OPTIONS
--programId=programId alternative Switchboard program ID to interact with
```
_See code: [src/commands/json/add/crank.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/json/add/crank.ts)_
_See code: [src/commands/json/add/crank.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/json/add/crank.ts)_
## `sbv2 json:add:oracle SCHEMAFILE`
@ -1185,7 +1185,7 @@ OPTIONS
--programId=programId alternative Switchboard program ID to interact with
```
_See code: [src/commands/json/add/oracle.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/json/add/oracle.ts)_
_See code: [src/commands/json/add/oracle.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/json/add/oracle.ts)_
## `sbv2 json:create:queue INPUTFILE OUTPUTFILE`
@ -1226,7 +1226,7 @@ EXAMPLE
$ sbv2 json:create:queue examples/queue.json queue-1.json -k ../authority-keypair.json
```
_See code: [src/commands/json/create/queue.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/json/create/queue.ts)_
_See code: [src/commands/json/create/queue.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/json/create/queue.ts)_
## `sbv2 lease:create AGGREGATORKEY`
@ -1265,7 +1265,7 @@ EXAMPLE
$ sbv2 lease:create GvDMxPzN1sCj7L26YDK2HnMRXEQmQ2aemov8YBtPS7vR --amount 1.5 --keypair ../payer-keypair.json
```
_See code: [src/commands/lease/create.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/lease/create.ts)_
_See code: [src/commands/lease/create.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/lease/create.ts)_
## `sbv2 lease:extend AGGREGATORKEY`
@ -1305,7 +1305,7 @@ EXAMPLE
../payer-keypair.json
```
_See code: [src/commands/lease/extend.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/lease/extend.ts)_
_See code: [src/commands/lease/extend.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/lease/extend.ts)_
## `sbv2 lease:withdraw AGGREGATORKEY`
@ -1349,7 +1349,7 @@ EXAMPLE
../payer-keypair.json
```
_See code: [src/commands/lease/withdraw.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/lease/withdraw.ts)_
_See code: [src/commands/lease/withdraw.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/lease/withdraw.ts)_
## `sbv2 localnet:env`
@ -1380,7 +1380,7 @@ OPTIONS
--programId=programId alternative Switchboard program ID to interact with
```
_See code: [src/commands/localnet/env.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/localnet/env.ts)_
_See code: [src/commands/localnet/env.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/localnet/env.ts)_
## `sbv2 oracle:balance ORACLEKEY`
@ -1413,7 +1413,7 @@ EXAMPLE
$ sbv2 oracle:balance 9CmLriMhykZ8xAoNTSHjHbk6SkuMhie1NCZn9P6LCuZ4
```
_See code: [src/commands/oracle/balance.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/oracle/balance.ts)_
_See code: [src/commands/oracle/balance.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/oracle/balance.ts)_
## `sbv2 oracle:create QUEUEKEY`
@ -1457,7 +1457,7 @@ EXAMPLES
../oracle-keypair.json
```
_See code: [src/commands/oracle/create.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/oracle/create.ts)_
_See code: [src/commands/oracle/create.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/oracle/create.ts)_
## `sbv2 oracle:deposit ORACLEKEY`
@ -1493,7 +1493,7 @@ EXAMPLE
$ sbv2 oracle:deposit 6kPsQoufdugtHLjM4fH7Z2fNv7jLt5pgvwKHt5JvRhQ6 2500 --keypair ../payer-keypair.json
```
_See code: [src/commands/oracle/deposit.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/oracle/deposit.ts)_
_See code: [src/commands/oracle/deposit.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/oracle/deposit.ts)_
## `sbv2 oracle:nonce ORACLEKEY`
@ -1523,7 +1523,7 @@ OPTIONS
--programId=programId alternative Switchboard program ID to interact with
```
_See code: [src/commands/oracle/nonce/index.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/oracle/nonce/index.ts)_
_See code: [src/commands/oracle/nonce/index.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/oracle/nonce/index.ts)_
## `sbv2 oracle:permission:create ORACLEKEY`
@ -1553,7 +1553,7 @@ OPTIONS
--programId=programId alternative Switchboard program ID to interact with
```
_See code: [src/commands/oracle/permission/create.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/oracle/permission/create.ts)_
_See code: [src/commands/oracle/permission/create.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/oracle/permission/create.ts)_
## `sbv2 oracle:withdraw ORACLEKEY`
@ -1596,7 +1596,7 @@ EXAMPLES
../oracle-keypair.json -w ByJs8E29jxvqf2KFLwfyiE2gUh5fivaS7aShcRMAsnzg
```
_See code: [src/commands/oracle/withdraw.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/oracle/withdraw.ts)_
_See code: [src/commands/oracle/withdraw.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/oracle/withdraw.ts)_
## `sbv2 permission:create GRANTER GRANTEE`
@ -1627,7 +1627,7 @@ OPTIONS
--programId=programId alternative Switchboard program ID to interact with
```
_See code: [src/commands/permission/create.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/permission/create.ts)_
_See code: [src/commands/permission/create.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/permission/create.ts)_
## `sbv2 permission:set PERMISSIONKEY`
@ -1660,7 +1660,7 @@ OPTIONS
--programId=programId alternative Switchboard program ID to interact with
```
_See code: [src/commands/permission/set.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/permission/set.ts)_
_See code: [src/commands/permission/set.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/permission/set.ts)_
## `sbv2 print PUBLICKEY`
@ -1681,7 +1681,7 @@ EXAMPLE
$ sbv2 print GhYg3R1V6DmJbwuc57qZeoYG6gUuvCotUF1zU3WCj98U
```
_See code: [src/commands/print/index.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/print/index.ts)_
_See code: [src/commands/print/index.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/print/index.ts)_
## `sbv2 print:aggregator AGGREGATORKEY`
@ -1721,7 +1721,7 @@ EXAMPLE
$ sbv2 aggregator:print GvDMxPzN1sCj7L26YDK2HnMRXEQmQ2aemov8YBtPS7vR
```
_See code: [src/commands/print/aggregator.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/print/aggregator.ts)_
_See code: [src/commands/print/aggregator.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/print/aggregator.ts)_
## `sbv2 print:aggregator:history AGGREGATORKEY`
@ -1758,7 +1758,7 @@ EXAMPLE
$ sbv2 aggregator:print:history 9CmLriMhykZ8xAoNTSHjHbk6SkuMhie1NCZn9P6LCuZ4
```
_See code: [src/commands/print/aggregator/history.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/print/aggregator/history.ts)_
_See code: [src/commands/print/aggregator/history.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/print/aggregator/history.ts)_
## `sbv2 print:aggregator:lease AGGREGATORKEY`
@ -1795,7 +1795,7 @@ EXAMPLE
$ sbv2 aggregator:lease:print 8SXvChNYFhRq4EZuZvnhjrB3jJRQCv4k3P4W6hesH3Ee
```
_See code: [src/commands/print/aggregator/lease.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/print/aggregator/lease.ts)_
_See code: [src/commands/print/aggregator/lease.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/print/aggregator/lease.ts)_
## `sbv2 print:aggregator:permission AGGREGATORKEY`
@ -1832,7 +1832,7 @@ EXAMPLE
$ sbv2 aggregator:permission:print 9CmLriMhykZ8xAoNTSHjHbk6SkuMhie1NCZn9P6LCuZ4
```
_See code: [src/commands/print/aggregator/permission.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/print/aggregator/permission.ts)_
_See code: [src/commands/print/aggregator/permission.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/print/aggregator/permission.ts)_
## `sbv2 print:crank CRANKKEY`
@ -1868,7 +1868,7 @@ EXAMPLE
$ sbv2 crank:print 85L2cFUvXaeGQ4HrzP8RJEVCL7WvRrXM2msvEmQ82AVr
```
_See code: [src/commands/print/crank.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/print/crank.ts)_
_See code: [src/commands/print/crank.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/print/crank.ts)_
## `sbv2 print:job JOBKEY`
@ -1904,7 +1904,7 @@ EXAMPLE
$ sbv2 job:print SzTvFZLz3hwjZFMwVWzuEnr1oUF6qyvXwXCvsqf7qeA
```
_See code: [src/commands/print/job.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/print/job.ts)_
_See code: [src/commands/print/job.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/print/job.ts)_
## `sbv2 print:job:templates`
@ -1918,7 +1918,7 @@ ALIASES
$ sbv2 job:print:templates
```
_See code: [src/commands/print/job/templates.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/print/job/templates.ts)_
_See code: [src/commands/print/job/templates.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/print/job/templates.ts)_
## `sbv2 print:json:samples OUTPUTDIRECTORY`
@ -1957,7 +1957,7 @@ EXAMPLES
$ sbv2 write:json:samples ~/switchboard_json_samples
```
_See code: [src/commands/print/json/samples.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/print/json/samples.ts)_
_See code: [src/commands/print/json/samples.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/print/json/samples.ts)_
## `sbv2 print:oracle ORACLEKEY`
@ -1993,7 +1993,7 @@ EXAMPLE
$ sbv2 oracle:print 9CmLriMhykZ8xAoNTSHjHbk6SkuMhie1NCZn9P6LCuZ4
```
_See code: [src/commands/print/oracle.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/print/oracle.ts)_
_See code: [src/commands/print/oracle.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/print/oracle.ts)_
## `sbv2 print:oracle:permission ORACLEKEY`
@ -2030,7 +2030,7 @@ EXAMPLE
$ sbv2 oracle:permission:print 9CmLriMhykZ8xAoNTSHjHbk6SkuMhie1NCZn9P6LCuZ4
```
_See code: [src/commands/print/oracle/permission.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/print/oracle/permission.ts)_
_See code: [src/commands/print/oracle/permission.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/print/oracle/permission.ts)_
## `sbv2 print:program`
@ -2063,7 +2063,7 @@ EXAMPLE
$ sbv2 program:print
```
_See code: [src/commands/print/program.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/print/program.ts)_
_See code: [src/commands/print/program.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/print/program.ts)_
## `sbv2 print:queue QUEUEKEY`
@ -2101,7 +2101,7 @@ EXAMPLE
$ sbv2 queue:print GhYg3R1V6DmJbwuc57qZeoYG6gUuvCotUF1zU3WCj98U
```
_See code: [src/commands/print/queue.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/print/queue.ts)_
_See code: [src/commands/print/queue.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/print/queue.ts)_
## `sbv2 print:vrf VRFKEY`
@ -2137,7 +2137,7 @@ EXAMPLE
$ sbv2 vrf:print SzTvFZLz3hwjZFMwVWzuEnr1oUF6qyvXwXCvsqf7qeA
```
_See code: [src/commands/print/vrf.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/print/vrf.ts)_
_See code: [src/commands/print/vrf.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/print/vrf.ts)_
## `sbv2 queue:add:crank QUEUEKEY`
@ -2174,7 +2174,7 @@ EXAMPLE
$ sbv2 queue:add:crank 5aYuxRdcB9GpWrEXVMBQp2R5uf94uoBiFdMEBwcmHuU4 -k ../authority-keypair.json -n crank-1
```
_See code: [src/commands/queue/add/crank.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/queue/add/crank.ts)_
_See code: [src/commands/queue/add/crank.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/queue/add/crank.ts)_
## `sbv2 queue:create`
@ -2227,7 +2227,7 @@ ALIASES
$ sbv2 custom:queue
```
_See code: [src/commands/queue/create.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/queue/create.ts)_
_See code: [src/commands/queue/create.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/queue/create.ts)_
## `sbv2 queue:permit:aggregator AGGREGATORKEY`
@ -2261,7 +2261,7 @@ EXAMPLE
$ sbv2 queue:permit:aggregator 9CmLriMhykZ8xAoNTSHjHbk6SkuMhie1NCZn9P6LCuZ4 --keypair ../queue-authority.json
```
_See code: [src/commands/queue/permit/aggregator.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/queue/permit/aggregator.ts)_
_See code: [src/commands/queue/permit/aggregator.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/queue/permit/aggregator.ts)_
## `sbv2 queue:permit:oracle ORACLEKEY`
@ -2295,7 +2295,7 @@ EXAMPLE
$ sbv2 queue:permit:oracle 9CmLriMhykZ8xAoNTSHjHbk6SkuMhie1NCZn9P6LCuZ4 --keypair ../queue-authority.json
```
_See code: [src/commands/queue/permit/oracle.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/queue/permit/oracle.ts)_
_See code: [src/commands/queue/permit/oracle.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/queue/permit/oracle.ts)_
## `sbv2 queue:set:rewards QUEUEKEY REWARDS`
@ -2327,7 +2327,7 @@ OPTIONS
--programId=programId alternative Switchboard program ID to interact with
```
_See code: [src/commands/queue/set/rewards.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/queue/set/rewards.ts)_
_See code: [src/commands/queue/set/rewards.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/queue/set/rewards.ts)_
## `sbv2 queue:set:vrf QUEUEKEY`
@ -2360,7 +2360,7 @@ OPTIONS
--programId=programId alternative Switchboard program ID to interact with
```
_See code: [src/commands/queue/set/vrf.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/queue/set/vrf.ts)_
_See code: [src/commands/queue/set/vrf.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/queue/set/vrf.ts)_
## `sbv2 sandbox [PLACEHOLDER]`
@ -2389,7 +2389,7 @@ OPTIONS
--programId=programId alternative Switchboard program ID to interact with
```
_See code: [src/commands/sandbox.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/sandbox.ts)_
_See code: [src/commands/sandbox.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/sandbox.ts)_
## `sbv2 test ORACLEKEY`
@ -2419,7 +2419,7 @@ OPTIONS
--programId=programId alternative Switchboard program ID to interact with
```
_See code: [src/commands/test.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/test.ts)_
_See code: [src/commands/test.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/test.ts)_
## `sbv2 update [CHANNEL]`
@ -2488,7 +2488,7 @@ EXAMPLES
false,"isWritable": false}"
```
_See code: [src/commands/vrf/create/index.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/vrf/create/index.ts)_
_See code: [src/commands/vrf/create/index.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/vrf/create/index.ts)_
## `sbv2 vrf:create:example QUEUEKEY`
@ -2533,7 +2533,7 @@ EXAMPLE
queue-authority-keypair.json
```
_See code: [src/commands/vrf/create/example.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/vrf/create/example.ts)_
_See code: [src/commands/vrf/create/example.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/vrf/create/example.ts)_
## `sbv2 vrf:request VRFKEY`
@ -2574,7 +2574,7 @@ EXAMPLE
false,"isWritable": false}"
```
_See code: [src/commands/vrf/request.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/vrf/request.ts)_
_See code: [src/commands/vrf/request.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/vrf/request.ts)_
## `sbv2 watch:aggregator AGGREGATORKEY`
@ -2610,7 +2610,7 @@ EXAMPLE
$ sbv2 watch:aggregator J7j9xX8JP2B2ErvUzuqGAKBGeggsxPyFXj5MqZcYDxfa
```
_See code: [src/commands/watch/aggregator.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/watch/aggregator.ts)_
_See code: [src/commands/watch/aggregator.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/watch/aggregator.ts)_
## `sbv2 watch:vrf VRFKEY`
@ -2646,5 +2646,5 @@ EXAMPLE
$ sbv2 vrf:aggregator J7j9xX8JP2B2ErvUzuqGAKBGeggsxPyFXj5MqZcYDxfa
```
_See code: [src/commands/watch/vrf.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.21/src/commands/watch/vrf.ts)_
_See code: [src/commands/watch/vrf.ts](https://github.com/switchboard-xyz/switchboard-v2/blob/v0.1.22/src/commands/watch/vrf.ts)_
<!-- commandsstop -->

View File

@ -98,8 +98,8 @@
"@project-serum/anchor": "^0.24.2",
"@solana/spl-token": "^0.1.8",
"@solana/web3.js": "^1.42.0",
"@switchboard-xyz/sbv2-utils": "^0.0.13",
"@switchboard-xyz/switchboard-v2": "0.0.97",
"@switchboard-xyz/sbv2-utils": "^0.1.12",
"@switchboard-xyz/switchboard-v2": "^0.0.97",
"assert": "^2.0.0",
"big.js": "^6.1.1",
"bs58": "^5.0.0",

View File

@ -11,7 +11,7 @@
"declaration": true,
"esModuleInterop": true,
"paths": {
// "@switchboard-xyz/switchboard-v2": ["../libraries/ts"],
"@switchboard-xyz/switchboard-v2": ["../libraries/ts"],
"@switchboard-xyz/sbv2-utils": ["../libraries/sbv2-utils"]
}
},
@ -19,7 +19,7 @@
"include": ["src/**/*"],
"exclude": ["node_modules", "bin", "lib", "test/**/*"],
"references": [
// { "path": "../libraries/ts" },
{ "path": "../libraries/ts" },
{ "path": "../libraries/sbv2-utils" }
]
}

21
config/eslint/LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022 Switchboard
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -4,6 +4,12 @@
"author": "",
"license": "MIT",
"description": "Switchboard eslint-config",
"repository": {
"type": "git",
"url": "https://github.com/switchboard-xyz/switchboard-v2",
"directory": "config/eslint"
},
"homepage": "https://docs.switchboard.xyz",
"main": "index.js",
"scripts": {
"build": "echo \"No build script required for workspace eslint-config\" && exit 0",
@ -14,11 +20,12 @@
"eslint-plugin-import": "^2.25.3",
"prettier": ">=2.0.0"
},
"dependencies": {},
"devDependencies": {
"eslint": "^7.32.0 || ^8.2.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-prettier": "^4.0.0"
}
},
"gitHead": "e1fba338e9177832acca6c7770e08888e21abfce"
}

View File

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2021 Switchboard
Copyright (c) 2022 Switchboard
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -2,7 +2,8 @@
name = "switchboardpy"
version = "0.0.5"
description = "Switchboard V2 API"
repository = "https://github.com/switchboard-xyz/switchboardv2-py-api"
repository = "https://github.com/switchboard-xyz/switchboard-v2/tree/main/libraries/py"
homepage = "https://docs.switchboard.xyz"
authors = ["Albert Hermida <albert@switchboard.xyz>"]
license = "MIT"

View File

@ -5,7 +5,7 @@ edition = "2021"
description = "A Rust library to interact with Switchboard V2 data feeds."
readme = "README.md"
keywords = ["switchboard", "oracle", "solana"]
homepage = "https://switchboard.xyz"
homepage = "https://docs.switchboard.xyz"
repository = "https://github.com/switchboard-xyz/switchboard-v2/tree/main/libraries/rs"
license = "MIT"
documentation = "https://docs.rs/switchboard-v2/"

21
libraries/rs/LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022 Switchboard
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022 Switchboard
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -8,6 +8,7 @@
"url": "https://github.com/switchboard-xyz/switchboard-v2",
"directory": "libraries/sbv2-lite"
},
"homepage": "https://docs.switchboard.xyz",
"files": [
"./lib",
"./src"
@ -16,13 +17,15 @@
"module": "lib/esm/index.js",
"exports": {
".": {
"import": "./lib/esm/index.js",
"require": "./lib/cjs/index.js"
"require": "./lib/cjs/index.js",
"import": "./lib/esm/index.js"
}
},
"scripts": {
"docgen": "yarn build && npx typedoc",
"build": "shx rm -rf lib && tsc -p tsconfig.json && tsc -p tsconfig-cjs.json",
"build:cjs": "shx rm -rf lib/cjs && tsc -p tsconfig.cjs.json && shx echo '{\"type\": \"commonjs\"}' > lib/cjs/package.json",
"build:esm": "shx rm -rf lib/esm && tsc -p tsconfig.esm.json && shx echo '{\"type\": \"module\"}' > lib/esm/package.json",
"build": "shx rm -rf lib && yarn build:cjs && yarn build:esm",
"test": "env TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\" }' mocha -r ts-node/register 'tests/**/*.ts'",
"prepublishOnly": "yarn build && yarn test"
},

View File

@ -11,25 +11,25 @@ describe("Switchboard V2 Lite Test", () => {
sbv2 = await SwitchboardProgram.loadMainnet();
});
it("fetches and decodes SOL/USD mainnet aggregator", async () => {
const accountInfo = await sbv2.program.provider.connection.getAccountInfo(
solAggregatorPubkey
);
if (!accountInfo) {
throw new Error(`failed to fetch account info`);
}
// it("fetches and decodes SOL/USD mainnet aggregator", async () => {
// const accountInfo = await sbv2.program.provider.connection.getAccountInfo(
// solAggregatorPubkey
// );
// if (!accountInfo) {
// throw new Error(`failed to fetch account info`);
// }
// Get latest value if its been updated in the last 300 seconds
const latestResult = sbv2.decodeLatestAggregatorValue(accountInfo, 300);
if (latestResult === null) {
throw new Error(`failed to fetch latest result for aggregator`);
}
assert(latestResult instanceof Big, "latest result is not a big.js object");
assert(
latestResult.toNumber() >= 0,
"latest result is less than or equal to 0"
);
});
// // Get latest value if its been updated in the last 300 seconds
// const latestResult = sbv2.decodeLatestAggregatorValue(accountInfo, 300);
// if (latestResult === null) {
// throw new Error(`failed to fetch latest result for aggregator`);
// }
// assert(latestResult instanceof Big, "latest result is not a big.js object");
// assert(
// latestResult.toNumber() >= 0,
// "latest result is less than or equal to 0"
// );
// });
it("decodes SOL/USD aggregator", async () => {
const aggregator = sbv2.decodeAggregator(solAggregatorAccountInfo);

View File

@ -3,6 +3,6 @@
"compilerOptions": {
"module": "commonjs",
"outDir": "lib/cjs",
"target": "es2015"
"target": "es2019"
}
}

View File

@ -1,12 +1,6 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"target": "ES2015",
"module": "ES2020",
"outDir": "lib/esm",
"rootDir": "src",
"skipLibCheck": true,
"esModuleInterop": true,
"noEmit": false,
"strict": true
},

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022 Switchboard
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,6 +1,6 @@
{
"name": "@switchboard-xyz/sbv2-utils",
"version": "0.0.13",
"version": "0.1.12",
"description": "some basic utility functions when working with switchboard-v2",
"author": "",
"license": "ISC",
@ -9,25 +9,26 @@
"url": "https://github.com/switchboard-xyz/switchboard-v2",
"directory": "libraries/sbv2-utils"
},
"homepage": "https://docs.switchboard.xyz",
"files": [
"./lib",
"./src"
],
"main": "lib/cjs/index.js",
"types": "./lib/cjs/index.d.ts",
"module": "lib/esm/index.js",
"exports": {
".": {
"import": "./lib/esm/index.js",
"types": "./lib/cjs/index.d.ts",
"require": "./lib/cjs/index.js"
"require": "./lib/cjs/index.js",
"import": "./lib/esm/index.js"
}
},
"scripts": {
"docgen": "yarn build && npx typedoc",
"test": "echo \"No test script for @switchboard-xyz/sbv2-utils\" && exit 0",
"build": "shx rm -rf lib && tsc -p tsconfig.json && tsc -p tsconfig-cjs.json && tsc -p tsconfig-types.json && npx shx echo '{\"type\": \"commonjs\"}' > lib/cjs/package.json && npx shx echo '{\"type\": \"module\"}' > lib/esm/package.json",
"prepublishOnly": "yarn build && npm version patch --force"
"build:cjs": "shx rm -rf lib/cjs && tsc -p tsconfig.cjs.json && shx echo '{\"type\": \"commonjs\"}' > lib/cjs/package.json",
"build:esm": "shx rm -rf lib/esm && tsc -p tsconfig.esm.json && shx echo '{\"type\": \"module\"}' > lib/esm/package.json",
"build": "shx rm -rf lib && yarn build:cjs && yarn build:esm",
"prepublishOnly": "yarn build"
},
"dependencies": {
"@orca-so/sdk": "^1.2.24",

View File

@ -35,19 +35,17 @@ export async function awaitOpenRound(
let accountWs: number;
const awaitUpdatePromise = new Promise((resolve: (value: Big) => void) => {
accountWs = aggregatorAccount.program.provider.connection.onAccountChange(
aggregatorAccount.publicKey,
aggregatorAccount?.publicKey ?? PublicKey.default,
async (accountInfo) => {
const aggregator = accountsCoder.decode(
"AggregatorAccountData",
accountInfo.data
);
const latestResult = await aggregatorAccount.getLatestValue(aggregator);
if (expectedValue === undefined) {
if (!expectedValue) {
resolve(new Big(0));
} else if (latestResult?.eq(expectedValue)) {
resolve(latestResult);
} else {
if (latestResult.eq(expectedValue)) {
resolve(latestResult);
}
}
}
);
@ -97,7 +95,7 @@ export async function createAggregator(
// Aggregator params
const aggregatorKeypair = params.keypair ?? anchor.web3.Keypair.generate();
const authority = params.authority ?? payerKeypair.publicKey;
const size = program.account.aggregatorAccountData.size;
const size = program.account.aggregatorAccountData!.size;
const [programStateAccount, stateBump] =
ProgramStateAccount.fromSeed(program);
const state = await programStateAccount.loadData();
@ -148,7 +146,7 @@ export async function createAggregator(
const createIxns: TransactionInstruction[] = [];
createIxns.push(
...[
...([
// allocate aggregator account
anchor.web3.SystemProgram.createAccount({
fromPubkey: programWallet(program).publicKey,
@ -161,21 +159,20 @@ export async function createAggregator(
programId: program.programId,
}),
// create aggregator
await program.methods
.aggregatorInit({
name: (params.name ?? Buffer.from("")).slice(0, 32),
metadata: (params.metadata ?? Buffer.from("")).slice(0, 128),
batchSize: params.batchSize,
minOracleResults: params.minRequiredOracleResults,
minJobResults: params.minRequiredJobResults,
minUpdateDelaySeconds: params.minUpdateDelaySeconds,
varianceThreshold: SwitchboardDecimal.fromBig(
new Big(params.varianceThreshold ?? 0)
),
forceReportPeriod: params.forceReportPeriod ?? new anchor.BN(0),
expiration: params.expiration ?? new anchor.BN(0),
stateBump,
})
await program.methods!.aggregatorInit!({
name: (params.name ?? Buffer.from("")).slice(0, 32),
metadata: (params.metadata ?? Buffer.from("")).slice(0, 128),
batchSize: params.batchSize,
minOracleResults: params.minRequiredOracleResults,
minJobResults: params.minRequiredJobResults,
minUpdateDelaySeconds: params.minUpdateDelaySeconds,
varianceThreshold: SwitchboardDecimal.fromBig(
new Big(params.varianceThreshold ?? 0)
),
forceReportPeriod: params.forceReportPeriod ?? new anchor.BN(0),
expiration: params.expiration ?? new anchor.BN(0),
stateBump,
})
.accounts({
aggregator: aggregatorKeypair.publicKey,
authority,
@ -184,8 +181,7 @@ export async function createAggregator(
programState: programStateAccount.publicKey,
})
.instruction(),
await program.methods
.permissionInit({})
await program.methods.permissionInit!({})
.accounts({
permission: permissionAccount.publicKey,
authority: params.authority,
@ -196,11 +192,10 @@ export async function createAggregator(
})
.instruction(),
payerKeypair.publicKey.equals(queue.authority)
? await program.methods
.permissionSet({
permission: { permitOracleQueueUsage: null },
enable: true,
})
? await program.methods.permissionSet!({
permission: { permitOracleQueueUsage: null },
enable: true,
})
.accounts({
permission: permissionAccount.publicKey,
authority: queue.authority,
@ -215,14 +210,13 @@ export async function createAggregator(
leaseAccount.publicKey,
payerKeypair.publicKey
),
await program.methods
.leaseInit({
loadAmount: new anchor.BN(0),
stateBump,
leaseBump,
withdrawAuthority: payerKeypair.publicKey,
walletBumps: Buffer.from([]),
})
await program.methods.leaseInit!({
loadAmount: new anchor.BN(0),
stateBump,
leaseBump,
withdrawAuthority: payerKeypair.publicKey,
walletBumps: Buffer.from([]),
})
.accounts({
programState: programStateAccount.publicKey,
lease: leaseAccount.publicKey,
@ -244,10 +238,9 @@ export async function createAggregator(
.instruction(),
...(await Promise.all(
jobs.map(async ([jobAccount, weight]) => {
return program.methods
.aggregatorAddJob({
weight,
})
return program.methods.aggregatorAddJob!({
weight,
})
.accounts({
aggregator: aggregatorKeypair.publicKey,
authority: payerKeypair.publicKey,
@ -256,10 +249,10 @@ export async function createAggregator(
.instruction();
})
)),
].filter((item) => item)
].filter(Boolean) as TransactionInstruction[])
);
const createSig = await program.provider.sendAndConfirm(
const createSig = await program.provider.sendAndConfirm!(
new Transaction().add(...createIxns),
[payerKeypair, aggregatorKeypair]
);

View File

@ -11,8 +11,8 @@ import assert from "assert";
import crypto from "crypto";
export interface OracleNonceAccounts {
heartbeatNonce: PublicKey;
unwrapStakeNonce: PublicKey;
heartbeatNonce?: PublicKey;
unwrapStakeNonce?: PublicKey;
queueNonces: PublicKey[];
}
@ -56,7 +56,7 @@ export async function getOracleHeartbeatNonceAccount(
await oracleAccount.program.provider.connection.getAccountInfo(
heartbeatNoncePubkey
);
if (nonceAccountExists(accountInfo)) {
if (nonceAccountExists(accountInfo ?? undefined)) {
return heartbeatNoncePubkey;
}
return null;
@ -75,7 +75,7 @@ export async function getOracleStakeUnwrapNonceAccount(
await oracleAccount.program.provider.connection.getAccountInfo(
heartbeatNoncePubkey
);
if (nonceAccountExists(accountInfo)) {
if (nonceAccountExists(accountInfo ?? undefined)) {
return heartbeatNoncePubkey;
}
return null;
@ -148,16 +148,17 @@ export async function getOracleNonceQueueAccounts(
const nonceAccountInfos: {
accountInfo: AccountInfo<Buffer>;
pubkey: PublicKey;
fullSeed: string;
baseSeed: string;
pubkey?: PublicKey;
fullSeed?: string;
baseSeed?: string;
}[] = (
await Promise.all(
pubkeyChunks.map(async (chunk, chunkIdx) => {
const accountInfos =
const accountInfos = (
await oracleAccount.program.provider.connection.getMultipleAccountsInfo(
chunk.map((i) => i.pubkey)
);
chunk.map((i) => i.pubkey).filter(Boolean) as PublicKey[]
)
).filter(Boolean) as AccountInfo<Buffer>[];
return accountInfos.map((accountInfo, idx) => {
return {
...chunk[idx],
@ -170,12 +171,11 @@ export async function getOracleNonceQueueAccounts(
const nonceQueuePubkeys = nonceAccountInfos
.map((nonce, i) => {
if (nonceAccountExists(nonce.accountInfo)) {
if (nonceAccountExists(nonce.accountInfo ?? undefined)) {
return nonce.pubkey;
}
return null;
})
.filter((n) => n);
.filter(Boolean) as PublicKey[];
return nonceQueuePubkeys;
}
@ -197,8 +197,8 @@ export async function getOracleNonceAccounts(
);
return {
heartbeatNonce,
unwrapStakeNonce,
heartbeatNonce: heartbeatNonce ?? undefined,
unwrapStakeNonce: unwrapStakeNonce ?? undefined,
queueNonces,
};
}

View File

@ -393,7 +393,7 @@ export async function prettyPrintAggregator(
let outputString = "";
outputString += chalk.underline(
chalkString("## Aggregator", aggregatorAccount.publicKey, SPACING) + "\r\n"
chalkString("## Aggregator", aggregatorAccount.publicKey!, SPACING) + "\r\n"
);
outputString +=
@ -454,7 +454,7 @@ export async function prettyPrintAggregator(
aggregatorAccount.program,
queue.authority,
queueAccount.publicKey,
aggregatorAccount.publicKey
aggregatorAccount.publicKey!
);
const permissionData = await permissionAccount.loadData();
outputString +=

View File

@ -46,11 +46,10 @@ export async function createQueue(
): Promise<CreateQueueResponse> {
const payerKeypair = programWallet(program);
const [programStateAccount, stateBump] = ProgramStateAccount.fromSeed(
this.program
);
const [programStateAccount, stateBump] =
ProgramStateAccount.fromSeed(program);
const tokenMint = new spl.Token(
this.program.provider.connection,
program.provider.connection,
spl.NATIVE_MINT,
spl.TOKEN_PROGRAM_ID,
payerKeypair
@ -68,7 +67,7 @@ export async function createQueue(
fromPubkey: payerKeypair.publicKey,
newAccountPubkey: vaultKeypair.publicKey,
lamports:
await this.program.provider.connection.getMinimumBalanceForRentExemption(
await program.provider.connection.getMinimumBalanceForRentExemption(
spl.AccountLayout.span
),
space: spl.AccountLayout.span,
@ -80,10 +79,9 @@ export async function createQueue(
vaultKeypair.publicKey,
payerKeypair.publicKey
),
await this.program.methods
.programInit({
stateBump,
})
await program.methods.programInit!({
stateBump,
})
.accounts({
state: programStateAccount.publicKey,
authority: payerKeypair.publicKey,
@ -104,22 +102,22 @@ export async function createQueue(
const queueBufferSize = queueSize * 32 + 8;
const queueAccount = new OracleQueueAccount({
program: this.program,
program: program,
publicKey: queueKeypair.publicKey,
});
this.logger.debug(chalkString("OracleQueue", queueKeypair.publicKey));
this.logger.debug(chalkString("OracleBuffer", queueBuffer.publicKey));
console.debug(chalkString("OracleQueue", queueKeypair.publicKey));
console.debug(chalkString("OracleBuffer", queueBuffer.publicKey));
const crankKeypair = anchor.web3.Keypair.generate();
const crankBuffer = anchor.web3.Keypair.generate();
const crankSize = params.crankSize ? params.crankSize * 40 + 8 : 0;
this.logger.debug(chalkString("CrankAccount", crankKeypair.publicKey));
this.logger.debug(chalkString("CrankBuffer", crankBuffer.publicKey));
console.debug(chalkString("CrankAccount", crankKeypair.publicKey));
console.debug(chalkString("CrankBuffer", crankBuffer.publicKey));
const crankAccount = new CrankAccount({
program: this.program,
program: program,
publicKey: crankKeypair.publicKey,
});
@ -129,31 +127,30 @@ export async function createQueue(
newAccountPubkey: queueBuffer.publicKey,
space: queueBufferSize,
lamports:
await this.program.provider.connection.getMinimumBalanceForRentExemption(
await program.provider.connection.getMinimumBalanceForRentExemption(
queueBufferSize
),
programId: this.program.programId,
programId: program.programId,
}),
await this.program.methods
.oracleQueueInit({
name: Buffer.from(params.name).slice(0, 32),
metadata: Buffer.from("").slice(0, 64),
reward: params.reward ? new anchor.BN(params.reward) : new anchor.BN(0),
minStake: params.minStake
? new anchor.BN(params.minStake)
: new anchor.BN(0),
// feedProbationPeriod: 0,
oracleTimeout: params.oracleTimeout,
slashingEnabled: false,
varianceToleranceMultiplier: SwitchboardDecimal.fromBig(new Big(2)),
authority: authorityKeypair.publicKey,
// consecutiveFeedFailureLimit: new anchor.BN(1000),
// consecutiveOracleFailureLimit: new anchor.BN(1000),
minimumDelaySeconds: 5,
queueSize: queueSize,
unpermissionedFeeds: params.unpermissionedFeeds ?? false,
unpermissionedVrf: params.unpermissionedVrf ?? false,
})
await program.methods.oracleQueueInit!({
name: Buffer.from(params.name ?? "").slice(0, 32),
metadata: Buffer.from("").slice(0, 64),
reward: params.reward ? new anchor.BN(params.reward) : new anchor.BN(0),
minStake: params.minStake
? new anchor.BN(params.minStake)
: new anchor.BN(0),
// feedProbationPeriod: 0,
oracleTimeout: params.oracleTimeout,
slashingEnabled: false,
varianceToleranceMultiplier: SwitchboardDecimal.fromBig(new Big(2)),
authority: authorityKeypair.publicKey,
// consecutiveFeedFailureLimit: new anchor.BN(1000),
// consecutiveOracleFailureLimit: new anchor.BN(1000),
minimumDelaySeconds: 5,
queueSize: queueSize,
unpermissionedFeeds: params.unpermissionedFeeds ?? false,
unpermissionedVrf: params.unpermissionedVrf ?? false,
})
.accounts({
oracleQueue: queueKeypair.publicKey,
authority: authorityKeypair.publicKey,
@ -168,17 +165,16 @@ export async function createQueue(
newAccountPubkey: crankBuffer.publicKey,
space: crankSize,
lamports:
await this.program.provider.connection.getMinimumBalanceForRentExemption(
await program.provider.connection.getMinimumBalanceForRentExemption(
crankSize
),
programId: this.program.programId,
programId: program.programId,
}),
await this.program.methods
.crankInit({
name: Buffer.from("Crank").slice(0, 32),
metadata: Buffer.from("").slice(0, 64),
crankSize: params.crankSize,
})
await program.methods.crankInit!({
name: Buffer.from("Crank").slice(0, 32),
metadata: Buffer.from("").slice(0, 64),
crankSize: params.crankSize,
})
.accounts({
crank: crankKeypair.publicKey,
queue: queueKeypair.publicKey,
@ -200,20 +196,20 @@ export async function createQueue(
const name = `Oracle-${n + 1}`;
const tokenWalletKeypair = anchor.web3.Keypair.generate();
const [oracleAccount, oracleBump] = OracleAccount.fromSeed(
this.program,
program,
queueAccount,
tokenWalletKeypair.publicKey
);
this.logger.debug(chalkString(name, oracleAccount.publicKey));
console.debug(chalkString(name, oracleAccount.publicKey));
const [permissionAccount, permissionBump] = PermissionAccount.fromSeed(
this.program,
program,
authorityKeypair.publicKey,
queueAccount.publicKey,
oracleAccount.publicKey
);
this.logger.debug(
console.debug(
chalkString(`Permission-${n + 1}`, permissionAccount.publicKey)
);
@ -222,7 +218,7 @@ export async function createQueue(
fromPubkey: payerKeypair.publicKey,
newAccountPubkey: tokenWalletKeypair.publicKey,
lamports:
await this.program.provider.connection.getMinimumBalanceForRentExemption(
await program.provider.connection.getMinimumBalanceForRentExemption(
spl.AccountLayout.span
),
space: spl.AccountLayout.span,
@ -234,13 +230,12 @@ export async function createQueue(
tokenWalletKeypair.publicKey,
programStateAccount.publicKey
),
await this.program.methods
.oracleInit({
name: Buffer.from(name).slice(0, 32),
metadata: Buffer.from("").slice(0, 128),
stateBump,
oracleBump,
})
await program.methods.oracleInit!({
name: Buffer.from(name).slice(0, 32),
metadata: Buffer.from("").slice(0, 128),
stateBump,
oracleBump,
})
.accounts({
oracle: oracleAccount.publicKey,
oracleAuthority: authorityKeypair.publicKey,
@ -251,8 +246,7 @@ export async function createQueue(
payer: payerKeypair.publicKey,
})
.instruction(),
await this.program.methods
.permissionInit({})
await program.methods.permissionInit!({})
.accounts({
permission: permissionAccount.publicKey,
authority: authorityKeypair.publicKey,
@ -262,11 +256,10 @@ export async function createQueue(
systemProgram: SystemProgram.programId,
})
.instruction(),
await this.program.methods
.permissionSet({
permission: { permitOracleHeartbeat: null },
enable: true,
})
await program.methods.permissionSet!({
permission: { permitOracleHeartbeat: null },
enable: true,
})
.accounts({
permission: permissionAccount.publicKey,
authority: authorityKeypair.publicKey,
@ -284,7 +277,7 @@ export async function createQueue(
);
const createAccountSignatures = packAndSend(
this.program,
program,
[ixns, finalTransactions],
signers,
payerKeypair.publicKey

View File

@ -64,7 +64,7 @@ export class SwitchboardTestContext implements ISwitchboardTestContext {
provider.connection,
payerKeypair
);
} catch (error) {
} catch (error: any) {
throw new Error(
`Failed to load the SBV2 program for the given cluster, ${error.message}`
);
@ -80,7 +80,7 @@ export class SwitchboardTestContext implements ISwitchboardTestContext {
if (queueData.queue.length < 1) {
throw new Error(`OracleQueue has no active oracles heartbeating`);
}
} catch (error) {
} catch (error: any) {
throw new Error(
`Failed to load the SBV2 queue for the given cluster, ${error.message}`
);
@ -88,7 +88,7 @@ export class SwitchboardTestContext implements ISwitchboardTestContext {
let mint: spl.Token;
try {
mint = await queue.loadMint();
} catch (error) {
} catch (error: any) {
throw new Error(
`Failed to load the SBV2 mint for the given cluster, ${error.message}`
);
@ -98,7 +98,7 @@ export class SwitchboardTestContext implements ISwitchboardTestContext {
payerTokenWallet = (
await mint.getOrCreateAssociatedAccountInfo(payerKeypair.publicKey)
).address;
} catch (error) {
} catch (error: any) {
throw new Error(
`Failed to load the SBV2 mint for the given cluster, ${error.message}`
);
@ -205,14 +205,12 @@ export class SwitchboardTestContext implements ISwitchboardTestContext {
throw new Error(`OracleQueue has no active oracles heartbeating`);
}
let oracle: sbv2.OracleAccount;
if (process.env.ORACLE) {
const SWITCHBOARD_ORACLE = new PublicKey(process.env.ORACLE);
oracle = new sbv2.OracleAccount({
program: switchboardProgram,
publicKey: SWITCHBOARD_ORACLE,
});
}
const oracle = process.env.ORACLE
? new sbv2.OracleAccount({
program: switchboardProgram,
publicKey: new PublicKey(process.env.ORACLE),
})
: undefined;
const [switchboardProgramState] =
sbv2.ProgramStateAccount.fromSeed(switchboardProgram);
@ -307,9 +305,11 @@ export class SwitchboardTestContext implements ISwitchboardTestContext {
if (!jobKey.equals(PublicKey.default)) {
return jobKey;
}
return undefined;
})
.filter((item: PublicKey | undefined) => item !== undefined)
.map(
(jobKey) =>
(jobKey: PublicKey) =>
new sbv2.JobAccount({
program: this.program,
publicKey: jobKey,

View File

@ -69,7 +69,7 @@ export class SwitchboardTestEnvironment implements ISwitchboardTestEnvironment {
payerKeypairPath: string;
additionalClonedAccounts?: Record<string, PublicKey>;
additionalClonedAccounts: Record<string, PublicKey>;
constructor(ctx: ISwitchboardTestEnvironment) {
this.programId = ctx.programId;
@ -89,11 +89,11 @@ export class SwitchboardTestEnvironment implements ISwitchboardTestEnvironment {
this.oracleEscrow = ctx.oracleEscrow;
this.oraclePermissions = ctx.oraclePermissions;
this.payerKeypairPath = ctx.payerKeypairPath;
this.additionalClonedAccounts = ctx.additionalClonedAccounts;
this.additionalClonedAccounts = ctx.additionalClonedAccounts ?? {};
}
private getAccountCloneString(): string {
const accounts: string[] = Object.keys(this).map((key) => {
const accounts = Object.keys(this).map((key) => {
// iterate over additionalClonedAccounts and collect pubkeys
if (typeof this[key] === "string") {
return;
@ -109,7 +109,7 @@ export class SwitchboardTestEnvironment implements ISwitchboardTestEnvironment {
return `--clone ${(this[key] as PublicKey).toBase58()} \`# ${key}\` `;
});
return accounts.filter((i) => i).join(`\\\n`);
return accounts.filter(Boolean).join(`\\\n`);
}
public toJSON(): ISwitchboardTestEnvironment {

View File

@ -32,7 +32,7 @@ export async function packAndSend(
for (let k = 0; k < packedTransactions.length; k += 1) {
const tx = signedTxs[k];
const rawTx = tx.serialize();
const rawTx = tx!.serialize();
signatures.push(
sendAndConfirmRawTransaction(program.provider.connection, rawTx, {
maxRetries: 10,

View File

@ -1,9 +0,0 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"declaration": true,
"emitDeclarationOnly": true,
"declarationMap": true,
"declarationDir": "./lib/types"
}
}

View File

@ -2,6 +2,7 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "commonjs",
"outDir": "lib/cjs"
"outDir": "lib/cjs",
"target": "es2019"
}
}

View File

@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "esnext",
"outDir": "lib/esm",
"target": "esnext"
}
}

View File

@ -2,8 +2,6 @@
"extends": "../../tsconfig.json",
"compilerOptions": {
"composite": true,
"target": "ES2015",
"module": "ES2020",
"rootDir": "src",
"noImplicitAny": false,
"outDir": "lib/esm",
@ -11,15 +9,28 @@
"esModuleInterop": true,
"noImplicitReturns": false,
"importsNotUsedAsValues": "preserve",
"strict": false,
"noEmit": false,
"emitDeclarationOnly": false,
"strict": true,
// "strictNullChecks": false,
"inlineSources": true,
"lib": ["esnext"],
"listEmittedFiles": false,
"listFiles": false,
"noFallthroughCasesInSwitch": true,
"pretty": true,
"resolveJsonModule": true,
"traceResolution": false,
"downlevelIteration": true,
"sourceMap": true,
"paths": {
"@switchboard-xyz/switchboard-v2": ["../ts"]
}
},
"include": ["src/**/*"],
"exclude": ["esbuild.js", "../ts"],
"exclude": ["esbuild.js", "lib"],
"references": [{ "path": "../ts" }],
"files": ["src/index.ts"]
}

View File

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2021 Switchboard
Copyright (c) 2022 Switchboard
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -1,7 +1,8 @@
{
"name": "@switchboard-xyz/switchboard-v2",
"version": "0.0.98",
"private": true,
"version": "0.0.97",
"license": "MIT",
"author": "mitch@switchboard.xyz",
"description": "API wrapper for intergating with the Switchboardv2 program",
"keywords": [
"oracle",
@ -13,30 +14,37 @@
"url": "https://github.com/switchboard-xyz/switchboard-v2",
"directory": "libraries/ts"
},
"license": "MIT",
"author": "mitch@switchboard.xyz",
"homepage": "https://docs.switchboard.xyz",
"files": [
"./lib",
"./src"
],
"main": "lib/cjs/index.js",
"types": "lib/cjs/index.d.ts",
"module": "lib/esm/index.js",
"exports": {
".": {
"require": "./lib/cjs/index.js",
"import": "./lib/esm/index.js"
}
},
"scripts": {
"docgen": "yarn build && npx typedoc",
"build": "shx rm -rf lib tsconfig.tsbuildinfo && tsc -p tsconfig-esm.json && tsc -p tsconfig-cjs.json && shx echo '{\"type\": \"commonjs\"}' > lib/cjs/package.json && shx echo '{\"type\": \"module\"}' > lib/esm/package.json",
"build:cjs": "shx rm -rf lib/cjs && tsc -p tsconfig.cjs.json && shx echo '{\"type\": \"commonjs\"}' > lib/cjs/package.json",
"build:esm": "shx rm -rf lib/esm && tsc -p tsconfig.esm.json && shx echo '{\"type\": \"module\"}' > lib/esm/package.json",
"build": "shx rm -rf lib && yarn build:cjs && yarn build:esm",
"test": "mocha --extension ts --require ts-node/register -t 1000000 tests/",
"prepublishOnly": "npm run build && npm version patch --force"
"prepublishOnly": "yarn build"
},
"peerDependencies": {
"@solana/spl-governance": "^0.0.34",
"@solana/spl-token": "^0.1.8",
"@solana/web3.js": "1.37.1",
"@switchboard-xyz/switchboard-api": "^0.2.199"
"@switchboard-xyz/switchboard-api": "^0.2.200"
},
"dependencies": {
"@project-serum/anchor": "^0.24.2",
"@solana/spl-governance": "^0.0.34",
"@switchboard-xyz/switchboard-api": "^0.2.199",
"@switchboard-xyz/switchboard-api": "^0.2.200",
"assert": "^2.0.0",
"big.js": "^6.1.1",
"bs58": "^4.0.1",

View File

@ -24,8 +24,7 @@ import Big from "big.js";
import * as crypto from "crypto";
var assert = require("assert");
export { OracleJob } from "@switchboard-xyz/switchboard-api";
export * from "./test";
export { IOracleJob, OracleJob } from "@switchboard-xyz/switchboard-api";
/**
* Switchboard Devnet Program ID

View File

@ -1,351 +0,0 @@
/* eslint-disable @typescript-eslint/no-shadow */
/* eslint-disable @typescript-eslint/no-var-requires */
import * as anchor from "@project-serum/anchor";
import * as spl from "@solana/spl-token";
import { Keypair, PublicKey } from "@solana/web3.js";
import { OracleJob } from "@switchboard-xyz/switchboard-api";
import Big from "big.js";
import fs from "fs";
import path from "path";
import * as sbv2 from "../";
import { DEFAULT_PUBKEY, promiseWithTimeout } from "./utils";
export interface ISwitchboardTestContext {
program: anchor.Program;
mint: spl.Token;
tokenWallet: PublicKey;
queue: sbv2.OracleQueueAccount;
oracle: sbv2.OracleAccount;
}
export class SwitchboardTestContext implements ISwitchboardTestContext {
program: anchor.Program;
mint: spl.Token;
tokenWallet: PublicKey;
queue: sbv2.OracleQueueAccount;
oracle: sbv2.OracleAccount;
constructor(ctx: ISwitchboardTestContext) {
this.program = ctx.program;
this.mint = ctx.mint;
this.tokenWallet = ctx.tokenWallet;
this.queue = ctx.queue;
this.oracle = ctx.oracle;
}
// Switchboard currently uses wrapped SOL for mint
private static async createSwitchboardWallet(
program: anchor.Program,
amount = 1_000_000
): Promise<PublicKey> {
const payerKeypair = sbv2.programWallet(program);
return spl.Token.createWrappedNativeAccount(
program.provider.connection,
spl.TOKEN_PROGRAM_ID,
payerKeypair.publicKey,
payerKeypair,
amount
);
}
// public static async depositSwitchboardWallet(
// program: anchor.Program,
// wallet: PublicKey,
// amount: number
// ) {
// const payerKeypair = sbv2.programWallet(program);
// const requestTxn = await program.provider.connection.requestAirdrop(
// wallet,
// amount
// );
// // TODO: Figure out how to wrap from spl.Token
// }
/** Recursively loop through directories and return the filepath of switchboard.env
* @param envFileName alternative filename to search for. defaults to switchboard.env
* @returns the filepath for a switchboard env file to load
*/
public static findSwitchboardEnv(envFileName = "switchboard.env"): string {
const NotFoundError = new Error(
"failed to find switchboard.env file in current directory recursively"
);
let retryCount = 5;
let currentDirectory = process.cwd();
while (retryCount > 0) {
// look for .switchboard directory
try {
const localSbvPath = path.join(currentDirectory, ".switchboard");
if (fs.existsSync(localSbvPath)) {
const localSbvEnvPath = path.join(localSbvPath, envFileName);
if (fs.existsSync(localSbvEnvPath)) {
return localSbvEnvPath;
}
}
} catch {}
// look for switchboard.env
try {
const currentPath = path.join(currentDirectory, envFileName);
if (fs.existsSync(currentPath)) {
return currentPath;
}
currentDirectory = path.join(currentDirectory, "../");
} catch {
throw NotFoundError;
}
retryCount--;
}
throw NotFoundError;
}
/** Load SwitchboardTestContext from an env file containing $SWITCHBOARD_PROGRAM_ID, $ORACLE_QUEUE, $AGGREGATOR
* @param provider anchor Provider containing connection and payer Keypair
* @param filePath filesystem path to env file
*/
public static async loadFromEnv(
provider: anchor.AnchorProvider,
filePath = SwitchboardTestContext.findSwitchboardEnv()
): Promise<SwitchboardTestContext> {
require("dotenv").config({ path: filePath });
if (!process.env.SWITCHBOARD_PROGRAM_ID) {
throw new Error(`your env file must have $SWITCHBOARD_PROGRAM_ID set`);
}
const SWITCHBOARD_PID = new PublicKey(process.env.SWITCHBOARD_PROGRAM_ID);
const switchboardIdl = await anchor.Program.fetchIdl(
SWITCHBOARD_PID,
provider
);
if (!switchboardIdl) {
throw new Error(`failed to load Switchboard IDL`);
}
const switchboardProgram = new anchor.Program(
switchboardIdl,
SWITCHBOARD_PID,
provider
);
if (!process.env.ORACLE_QUEUE) {
throw new Error(`your env file must have $ORACLE_QUEUE set`);
}
const SWITCHBOARD_QUEUE = new PublicKey(process.env.ORACLE_QUEUE);
const queue = new sbv2.OracleQueueAccount({
program: switchboardProgram,
publicKey: SWITCHBOARD_QUEUE,
});
// TODO: Check oracle is heartbeating when context starts
let oracle: sbv2.OracleAccount;
if (process.env.ORACLE) {
const SWITCHBOARD_ORACLE = new PublicKey(process.env.ORACLE);
oracle = new sbv2.OracleAccount({
program: switchboardProgram,
publicKey: SWITCHBOARD_ORACLE,
});
}
const [switchboardProgramState] =
sbv2.ProgramStateAccount.fromSeed(switchboardProgram);
const switchboardMint = await switchboardProgramState.getTokenMint();
const tokenWallet = await SwitchboardTestContext.createSwitchboardWallet(
switchboardProgram
);
const context: ISwitchboardTestContext = {
program: switchboardProgram,
mint: switchboardMint,
tokenWallet,
queue,
oracle,
};
return new SwitchboardTestContext(context);
}
/** Create a static data feed that resolves to an expected value */
public async createStaticFeed(
value: number
): Promise<sbv2.AggregatorAccount> {
const queue = await this.queue.loadData();
const payerKeypair = sbv2.programWallet(this.program);
// create aggregator
const aggregatorAccount = await sbv2.AggregatorAccount.create(
this.program,
{
batchSize: 1,
minRequiredJobResults: 1,
minRequiredOracleResults: 1,
minUpdateDelaySeconds: 5,
queueAccount: this.queue,
authorWallet: this.tokenWallet,
}
);
// create permission account and approve if necessary
const permissionAccount = await sbv2.PermissionAccount.create(
this.program,
{
authority: queue.authority,
granter: this.queue.publicKey,
grantee: aggregatorAccount.publicKey,
}
);
if (!queue.unpermissionedFeedsEnabled) {
if (queue.authority.equals(payerKeypair.publicKey)) {
await permissionAccount.set({
authority: payerKeypair,
enable: true,
permission: sbv2.SwitchboardPermission.PERMIT_ORACLE_QUEUE_USAGE,
});
}
throw new Error(
`must provide queue authority to permit data feeds to join`
);
}
// create lease contract
const leaseAccount = await sbv2.LeaseAccount.create(this.program, {
aggregatorAccount,
funder: this.tokenWallet,
funderAuthority: payerKeypair,
loadAmount: new anchor.BN(0),
oracleQueueAccount: this.queue,
});
// create and add job account
const staticJob = await sbv2.JobAccount.create(this.program, {
name: Buffer.from(`Value ${value}`),
authority: this.tokenWallet,
data: Buffer.from(
OracleJob.encodeDelimited(
OracleJob.create({
tasks: [
OracleJob.Task.create({
valueTask: OracleJob.ValueTask.create({
value,
}),
}),
],
})
).finish()
),
});
await aggregatorAccount.addJob(staticJob);
// open new round and request new result
await aggregatorAccount.openRound({
oracleQueueAccount: this.queue,
payoutWallet: this.tokenWallet,
});
return aggregatorAccount;
}
/** Update a feed to a single job that resolves to a new expected value
* @param aggregatorAccount the aggregator to change a job definition for
* @param value the new expected value
* @param timeout how long to wait for the oracle to update the aggregator's latestRound result
*/
public async updateStaticFeed(
aggregatorAccount: sbv2.AggregatorAccount,
value: number,
timeout = 30
): Promise<void> {
const aggregator = await aggregatorAccount.loadData();
const expectedValue = new Big(value);
const queue = await this.queue.loadData();
// remove all existing jobs
const existingJobs: sbv2.JobAccount[] = aggregator.jobPubkeysData
// eslint-disable-next-line array-callback-return
.filter((jobKey: PublicKey) => {
if (!jobKey.equals(DEFAULT_PUBKEY)) {
return jobKey;
}
})
.map(
(jobKey) =>
new sbv2.JobAccount({
program: this.program,
publicKey: jobKey,
})
);
await Promise.all(
existingJobs.map((job) => aggregatorAccount.removeJob(job))
);
// add new static job
const staticJob = await sbv2.JobAccount.create(this.program, {
name: Buffer.from(`Value ${value}`),
authority: Keypair.generate().publicKey,
data: Buffer.from(
OracleJob.encodeDelimited(
OracleJob.create({
tasks: [
OracleJob.Task.create({
valueTask: OracleJob.ValueTask.create({
value,
}),
}),
],
})
).finish()
),
});
await aggregatorAccount.addJob(staticJob);
// call open round and wait for new value
const accountsCoder = new anchor.BorshAccountsCoder(this.program.idl);
let accountWs: number;
const awaitUpdatePromise = new Promise((resolve: (value: Big) => void) => {
accountWs = this.program.provider.connection.onAccountChange(
aggregatorAccount.publicKey,
async (accountInfo) => {
const aggregator = accountsCoder.decode(
"AggregatorAccountData",
accountInfo.data
);
const latestResult = await aggregatorAccount.getLatestValue(
aggregator
);
if (latestResult.eq(expectedValue)) {
resolve(latestResult);
}
}
);
});
const updatedValuePromise = promiseWithTimeout(
timeout * 1000,
awaitUpdatePromise,
new Error(`aggregator failed to update in ${timeout} seconds`)
).finally(() => {
if (accountWs) {
this.program.provider.connection.removeAccountChangeListener(accountWs);
}
});
await aggregatorAccount.openRound({
oracleQueueAccount: this.queue,
payoutWallet: this.tokenWallet,
});
await updatedValuePromise;
if (!updatedValuePromise) {
throw new Error(`failed to update aggregator`);
}
}
}

View File

@ -1,380 +0,0 @@
import * as anchor from "@project-serum/anchor";
import NodeWallet from "@project-serum/anchor/dist/cjs/nodewallet";
import * as spl from "@solana/spl-token";
import { clusterApiUrl, Connection, Keypair, PublicKey } from "@solana/web3.js";
import chalk from "chalk";
import fs from "fs";
import path from "path";
import * as sbv2 from "../";
import { getIdlAddress, getProgramDataAddress } from "./utils";
const LATEST_DOCKER_VERSION = "dev-v2-5-3-22";
export interface ISwitchboardTestEnvironment {
programId: PublicKey;
programDataAddress: PublicKey;
idlAddress: PublicKey;
programState: PublicKey;
switchboardVault: PublicKey;
switchboardMint: PublicKey;
tokenWallet: PublicKey;
queue: PublicKey;
queueAuthority: PublicKey;
queueBuffer: PublicKey;
crank: PublicKey;
crankBuffer: PublicKey;
oracle: PublicKey;
oracleAuthority: PublicKey;
oracleEscrow: PublicKey;
oraclePermissions: PublicKey;
// allow a map of public keys to include in clone script
additionalClonedAccounts?: Record<string, PublicKey>;
}
/** Contains all of the necessary devnet Switchboard accounts to clone to localnet */
export class SwitchboardTestEnvironment implements ISwitchboardTestEnvironment {
programId: PublicKey;
programDataAddress: PublicKey;
idlAddress: PublicKey;
programState: PublicKey;
switchboardVault: PublicKey;
switchboardMint: PublicKey;
tokenWallet: PublicKey;
queue: PublicKey;
queueAuthority: PublicKey;
queueBuffer: PublicKey;
crank: PublicKey;
crankBuffer: PublicKey;
oracle: PublicKey;
oracleAuthority: PublicKey;
oracleEscrow: PublicKey;
oraclePermissions: PublicKey;
additionalClonedAccounts?: Record<string, PublicKey>;
constructor(ctx: ISwitchboardTestEnvironment) {
this.programId = ctx.programId;
this.programDataAddress = ctx.programDataAddress;
this.idlAddress = ctx.idlAddress;
this.programState = ctx.programState;
this.switchboardVault = ctx.switchboardVault;
this.switchboardMint = ctx.switchboardMint;
this.tokenWallet = ctx.tokenWallet;
this.queue = ctx.queue;
this.queueAuthority = ctx.queueAuthority;
this.queueBuffer = ctx.queueBuffer;
this.crank = ctx.crank;
this.crankBuffer = ctx.crankBuffer;
this.oracle = ctx.oracle;
this.oracleAuthority = ctx.oracleAuthority;
this.oracleEscrow = ctx.oracleEscrow;
this.oraclePermissions = ctx.oraclePermissions;
this.additionalClonedAccounts = ctx.additionalClonedAccounts;
}
private getAccountCloneString(): string {
const accounts: string[] = Object.keys(this).map((key) => {
// iterate over additionalClonedAccounts and collect pubkeys
if (key === "additionalClonedAccounts" && this[key]) {
const additionalPubkeys = Object.values(this.additionalClonedAccounts);
const cloneStrings = additionalPubkeys.map(
(pubkey) => `--clone ${pubkey.toBase58()}`
);
return cloneStrings.join(" ");
}
return `--clone ${(this[key] as PublicKey).toBase58()}`;
});
return accounts.join(" ");
}
public toJSON(): ISwitchboardTestEnvironment {
return {
programId: this.programId,
programDataAddress: this.programDataAddress,
idlAddress: this.idlAddress,
programState: this.programState,
switchboardVault: this.switchboardVault,
switchboardMint: this.switchboardMint,
tokenWallet: this.tokenWallet,
queue: this.queue,
queueAuthority: this.queueAuthority,
queueBuffer: this.queueBuffer,
crank: this.crank,
crankBuffer: this.crankBuffer,
oracle: this.oracle,
oracleAuthority: this.oracleAuthority,
oracleEscrow: this.oracleEscrow,
oraclePermissions: this.oraclePermissions,
additionalClonedAccounts: this.additionalClonedAccounts,
};
}
/** Write switchboard test environment to filesystem */
public writeAll(payerKeypairPath: string, filePath: string): void {
this.writeEnv(filePath);
this.writeJSON(filePath);
this.writeScripts(payerKeypairPath, filePath);
this.writeDockerCompose(this.oracle, payerKeypairPath, filePath);
}
/** Write the env file to filesystem */
public writeEnv(filePath: string): void {
const ENV_FILE_PATH = path.join(filePath, "switchboard.env");
let fileStr = "";
fileStr += `SWITCHBOARD_PROGRAM_ID="${this.programId.toBase58()}"\n`;
fileStr += `SWITCHBOARD_PROGRAM_DATA_ADDRESS="${this.programDataAddress.toBase58()}"\n`;
fileStr += `SWITCHBOARD_IDL_ADDRESS="${this.idlAddress.toBase58()}"\n`;
fileStr += `SWITCHBOARD_PROGRAM_STATE="${this.programState.toBase58()}"\n`;
fileStr += `SWITCHBOARD_VAULT="${this.switchboardVault.toBase58()}"\n`;
fileStr += `SWITCHBOARD_MINT="${this.switchboardMint.toBase58()}"\n`;
fileStr += `TOKEN_WALLET="${this.tokenWallet.toBase58()}"\n`;
fileStr += `ORACLE_QUEUE="${this.queue.toBase58()}"\n`;
fileStr += `ORACLE_QUEUE_AUTHORITY="${this.queueAuthority.toBase58()}"\n`;
fileStr += `ORACLE_QUEUE_BUFFER="${this.queueBuffer.toBase58()}"\n`;
fileStr += `CRANK="${this.crank.toBase58()}"\n`;
fileStr += `CRANK_BUFFER="${this.crankBuffer.toBase58()}"\n`;
fileStr += `ORACLE="${this.oracle.toBase58()}"\n`;
fileStr += `ORACLE_AUTHORITY="${this.oracleAuthority.toBase58()}"\n`;
fileStr += `ORACLE_ESCROW="${this.oracleEscrow.toBase58()}"\n`;
fileStr += `ORACLE_PERMISSIONS="${this.oraclePermissions.toBase58()}"\n`;
fileStr += `SWITCHBOARD_ACCOUNTS="${this.getAccountCloneString()}"\n`;
// TODO: Write additionalClonedAccounts to env file
fs.writeFileSync(ENV_FILE_PATH, fileStr);
console.log(
`${chalk.green("Env File saved to:")} ${ENV_FILE_PATH.replace(
process.cwd(),
"."
)}`
);
}
public writeJSON(filePath: string): void {
const JSON_FILE_PATH = path.join(filePath, "switchboard.json");
fs.writeFileSync(
JSON_FILE_PATH,
JSON.stringify(
this.toJSON(),
(key, value) => {
if (value instanceof PublicKey) {
return value.toBase58();
}
return value;
},
2
)
);
}
public writeScripts(payerKeypairPath: string, filePath: string): void {
const LOCAL_VALIDATOR_SCRIPT = path.join(
filePath,
"start-local-validator.sh"
);
// create bash script to startup local validator with appropriate accounts cloned
const baseValidatorCommand = `solana-test-validator -r --ledger .anchor/test-ledger --mint ${this.oracleAuthority.toBase58()} --deactivate-feature 5ekBxc8itEnPv4NzGJtr8BVVQLNMQuLMNQQj7pHoLNZ9 --bind-address 0.0.0.0 --url ${clusterApiUrl(
"devnet"
)} --rpc-port 8899 `;
const cloneAccountsString = this.getAccountCloneString();
const startValidatorCommand = `${baseValidatorCommand} ${cloneAccountsString}`;
fs.writeFileSync(
LOCAL_VALIDATOR_SCRIPT,
`#!/bin/bash\n\nmkdir -p .anchor/test-ledger\n\n${startValidatorCommand}`
);
console.log(
`${chalk.green("Bash script saved to:")} ${LOCAL_VALIDATOR_SCRIPT.replace(
process.cwd(),
"."
)}`
);
// create bash script to start local oracle
const ORACLE_SCRIPT = path.join(filePath, "start-oracle.sh");
const startOracleCommand = `docker-compose -f docker-compose.switchboard.yml up`;
fs.writeFileSync(ORACLE_SCRIPT, `#!/bin/bash\n\n${startOracleCommand}`);
console.log(
`${chalk.green("Bash script saved to:")} ${ORACLE_SCRIPT.replace(
process.cwd(),
"."
)}`
);
}
public writeDockerCompose(
oracleKey: PublicKey,
payerKeypairPath: string,
filePath: string
): void {
const DOCKER_COMPOSE_FILEPATH = path.join(
filePath,
"docker-compose.switchboard.yml"
);
const dockerComposeString = `version: "3.3"
services:
oracle:
image: "switchboardlabs/node:\${SBV2_ORACLE_VERSION:-${LATEST_DOCKER_VERSION}}" # https://hub.docker.com/r/switchboardlabs/node/tags
network_mode: host
restart: always
secrets:
- PAYER_SECRETS
environment:
- VERBOSE=1
- LIVE=1
- CLUSTER=\${CLUSTER:-localnet}
- HEARTBEAT_INTERVAL=30 # Seconds
- ORACLE_KEY=${oracleKey.toBase58()}
# - RPC_URL=\${RPC_URL}
secrets:
PAYER_SECRETS:
file: ${payerKeypairPath}
`;
fs.writeFileSync(DOCKER_COMPOSE_FILEPATH, dockerComposeString);
console.log(
`${chalk.green(
"Docker-Compose saved to:"
)} ${DOCKER_COMPOSE_FILEPATH.replace(process.cwd(), ".")}`
);
}
/** Build a devnet environment to later clone to localnet */
static async create(
payerKeypair: Keypair,
additionalClonedAccounts?: Record<string, PublicKey>,
alternateProgramId?: PublicKey
): Promise<SwitchboardTestEnvironment> {
const connection = new Connection(clusterApiUrl("devnet"), {
commitment: "confirmed",
});
const programId = alternateProgramId ?? sbv2.getSwitchboardPid("devnet");
const wallet = new NodeWallet(payerKeypair);
const provider = new anchor.AnchorProvider(connection, wallet, {});
const anchorIdl = await anchor.Program.fetchIdl(programId, provider);
if (!anchorIdl) {
throw new Error(`failed to read idl for ${programId}`);
}
const switchboardProgram = new anchor.Program(
anchorIdl,
programId,
provider
);
const programDataAddress = getProgramDataAddress(
switchboardProgram.programId
);
const idlAddress = await getIdlAddress(switchboardProgram.programId);
const [switchboardProgramState] =
sbv2.ProgramStateAccount.fromSeed(switchboardProgram);
let programState: any;
try {
programState = await switchboardProgramState.loadData();
} catch {
await sbv2.ProgramStateAccount.create(switchboardProgram, {
mint: spl.NATIVE_MINT,
daoMint: spl.NATIVE_MINT,
});
programState = await switchboardProgramState.loadData();
}
const switchboardMint = await switchboardProgramState.getTokenMint();
const payerSwitchboardWallet = (
await switchboardMint.getOrCreateAssociatedAccountInfo(
payerKeypair.publicKey
)
).address;
// create queue with unpermissioned VRF accounts enabled
const queueAccount = await sbv2.OracleQueueAccount.create(
switchboardProgram,
{
name: Buffer.from("My Test Queue"),
mint: spl.NATIVE_MINT,
authority: payerKeypair.publicKey, // Approve new participants
minStake: new anchor.BN(0), // Oracle minStake to heartbeat
reward: new anchor.BN(0), // Oracle rewards per request (non-VRF)
queueSize: 10, // Number of active oracles a queue can support
unpermissionedFeeds: true, // Whether feeds need PERMIT_ORACLE_QUEUE_USAGE permissions
unpermissionedVrf: true, // Whether VRF accounts need PERMIT_VRF_REQUESTS permissions
}
);
await queueAccount.setVrfSettings({
authority: payerKeypair,
unpermissionedVrf: true,
});
const queue = await queueAccount.loadData();
// create a crank for the queue
const crankAccount = await sbv2.CrankAccount.create(switchboardProgram, {
name: Buffer.from("My Crank"),
maxRows: 100,
queueAccount,
});
const crank = await crankAccount.loadData();
// create oracle to run locally
const oracleAccount = await sbv2.OracleAccount.create(switchboardProgram, {
name: Buffer.from("My Oracle"),
oracleAuthority: payerKeypair,
queueAccount,
});
const oracle = await oracleAccount.loadData();
// grant oracle heartbeat permissions
const oraclePermissionAccount = await sbv2.PermissionAccount.create(
switchboardProgram,
{
authority: queue.authority,
granter: queueAccount.publicKey,
grantee: oracleAccount.publicKey,
}
);
await oraclePermissionAccount.set({
authority: payerKeypair,
enable: true,
permission: sbv2.SwitchboardPermission.PERMIT_ORACLE_HEARTBEAT,
});
const ctx: ISwitchboardTestEnvironment = {
programId: switchboardProgram.programId,
programDataAddress,
idlAddress,
programState: switchboardProgramState.publicKey,
switchboardVault: programState.tokenVault,
switchboardMint: switchboardMint.publicKey,
tokenWallet: payerSwitchboardWallet,
queue: queueAccount.publicKey,
queueAuthority: queue.authority,
queueBuffer: queue.dataBuffer,
crank: crankAccount.publicKey,
crankBuffer: crank.dataBuffer,
oracle: oracleAccount.publicKey,
oracleAuthority: oracle.oracleAuthority,
oracleEscrow: oracle.tokenAccount,
oraclePermissions: oraclePermissionAccount.publicKey,
additionalClonedAccounts,
};
return new SwitchboardTestEnvironment(ctx);
}
}

View File

@ -1,2 +0,0 @@
export * from "./context";
export * from "./env";

View File

@ -1,36 +0,0 @@
import { findProgramAddressSync } from "@project-serum/anchor/dist/cjs/utils/pubkey";
import { PublicKey } from "@solana/web3.js";
export const DEFAULT_PUBKEY = new PublicKey("11111111111111111111111111111111");
export const sleep = (ms: number): Promise<any> =>
new Promise((s) => setTimeout(s, ms));
export async function promiseWithTimeout<T>(
ms: number,
promise: Promise<T>,
timeoutError = new Error("timeoutError")
): Promise<T> {
// create a promise that rejects in milliseconds
const timeout = new Promise<never>((_, reject) => {
setTimeout(() => {
reject(timeoutError);
}, ms);
});
return Promise.race<T>([promise, timeout]);
}
export const getProgramDataAddress = (programId: PublicKey): PublicKey => {
return findProgramAddressSync(
[programId.toBytes()],
new PublicKey("BPFLoaderUpgradeab1e11111111111111111111111")
)[0];
};
export const getIdlAddress = async (
programId: PublicKey
): Promise<PublicKey> => {
const base = (await PublicKey.findProgramAddress([], programId))[0];
return PublicKey.createWithSeed(base, "anchor:idl", programId);
};

View File

@ -2,6 +2,7 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "commonjs",
"outDir": "lib/cjs"
"outDir": "lib/cjs",
"target": "es2019"
}
}

View File

@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "esnext",
"outDir": "lib/esm",
"target": "esnext"
}
}

View File

@ -1,5 +1,5 @@
{
// "extends": "../../tsconfig.json",
"extends": "../../tsconfig.json",
"ts-node": {
"compilerOptions": {
"module": "commonjs",
@ -10,24 +10,19 @@
}
},
"compilerOptions": {
// from initial repo
"declaration": true,
"moduleResolution": "node",
"module": "commonjs",
"target": "ES2019",
"composite": true,
"rootDir": "src",
"noImplicitAny": false,
"outDir": "lib/esm",
"skipLibCheck": true,
"esModuleInterop": true,
"allowJs": true,
"checkJs": false,
"noImplicitReturns": false,
"importsNotUsedAsValues": "preserve",
"strict": false,
"noEmit": false,
"emitDeclarationOnly": false,
"types": ["mocha", "node", "long"],
"sourceMap": true,
// new
"composite": true,
"baseUrl": "src",
"outDir": "lib",
"rootDir": "src",
"skipLibCheck": true,
"allowSyntheticDefaultImports": true,
"inlineSources": true,
"lib": ["esnext"],
"listEmittedFiles": false,
@ -36,11 +31,7 @@
"pretty": true,
"resolveJsonModule": true,
"traceResolution": false,
"downlevelIteration": true,
/* TODO: Fix undefined errors */
"strict": false,
"noImplicitReturns": false,
"strictNullChecks": false
"downlevelIteration": true
},
"include": ["src/**/*"],
"exclude": ["tests/**/*", "lib", "node_modules"],

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022 Switchboard
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,6 +1,6 @@
{
"name": "@switchboard-xyz/v2-feed-parser",
"version": "1.0.0",
"version": "0.1.0",
"description": "switchboard v2 example demonstrating how to parse a data feed",
"private": true,
"repository": {
@ -8,7 +8,8 @@
"url": "https://github.com/switchboard-xyz/switchboard-v2",
"directory": "packages/feed-parser"
},
"main": "index.js",
"homepage": "https://docs.switchboard.xyz",
"main": "dist/index.js",
"scripts": {
"start": "ts-node src/main",
"build": "rimraf dist && ./esbuild.js",
@ -27,7 +28,7 @@
"dependencies": {
"@project-serum/anchor": "^0.24.2",
"@solana/web3.js": "^1.33.0",
"@switchboard-xyz/switchboard-v2": "^0.0.95",
"@switchboard-xyz/switchboard-v2": "^0.0.97",
"big.js": "^6.1.1"
}
}

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022 Switchboard
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -8,7 +8,8 @@
"url": "https://github.com/switchboard-xyz/switchboard-v2",
"directory": "packages/feed-walkthrough"
},
"main": "index.js",
"homepage": "https://docs.switchboard.xyz",
"main": "dist/main.js",
"scripts": {
"start": "ts-node src/main",
"build": "rimraf dist && ./esbuild.js -inline-sourcemap",
@ -18,9 +19,9 @@
"license": "ISC",
"dependencies": {
"@project-serum/anchor": "^0.24.2",
"@solana/web3.js": "^1.37.1",
"@solana/spl-token": "^0.2.0",
"@switchboard-xyz/switchboard-v2": "^0.0.95",
"@solana/web3.js": "^1.37.1",
"@switchboard-xyz/switchboard-v2": "^0.0.97",
"@switchboard-xyz/v2-task-library": "^0.1.1",
"chalk": "^4.1.2",
"dotenv": "^16.0.0",

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022 Switchboard
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,6 +1,6 @@
{
"name": "@switchboard-xyz/lease-observer",
"version": "0.1.0",
"version": "0.1.1",
"description": "receive pager duty alerts when a switchboard v2 lease crosses a provided threshold",
"private": true,
"repository": {
@ -16,8 +16,8 @@
"dependencies": {
"@project-serum/anchor": "^0.24.2",
"@solana/web3.js": "1.33.0",
"@switchboard-xyz/sbv2-utils": "^0.1.12",
"@switchboard-xyz/switchboard-v2": "^0.0.97",
"@switchboard-xyz/sbv2-utils": "^0.0.13",
"dotenv": "^16.0.0",
"node-pagerduty": "^1.3.6"
},

View File

@ -1,6 +1,6 @@
{
"name": "anchor-feed-parser",
"version": "0.1.1",
"version": "0.1.0",
"private": true,
"repository": {
"type": "git",
@ -14,7 +14,7 @@
"dependencies": {
"@project-serum/anchor": "^0.24.2",
"@solana/web3.js": "^1.42.0",
"@switchboard-xyz/sbv2-utils": "^0.0.13",
"@switchboard-xyz/sbv2-utils": "^0.1.12",
"@switchboard-xyz/switchboard-v2": "^0.0.97"
},
"devDependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "anchor-vrf-parser",
"version": "0.1.1",
"version": "0.1.0",
"private": true,
"repository": {
"type": "git",
@ -15,14 +15,14 @@
"@project-serum/anchor": "^0.24.2",
"@solana/spl-token": "^0.1.8",
"@solana/web3.js": "^1.42.0",
"@switchboard-xyz/sbv2-utils": "^0.0.13",
"@switchboard-xyz/sbv2-utils": "^0.1.12",
"@switchboard-xyz/switchboard-v2": "^0.0.97",
"chalk": "^4.1.2",
"child_process": "^1.0.2",
"dotenv": "^16.0.0"
},
"devDependencies": {
"@switchboard-xyz/switchboardv2-cli": "^0.1.21",
"@switchboard-xyz/switchboardv2-cli": "^0.1.22",
"@types/chai": "^4.3.0",
"@types/mocha": "^9.0.0",
"@types/node": "^17.0.35",

View File

@ -1,6 +1,6 @@
{
"name": "spl-feed-parser",
"version": "0.1.1",
"version": "0.1.0",
"private": true,
"repository": {
"type": "git",
@ -16,7 +16,7 @@
"dependencies": {
"@project-serum/anchor": "^0.24.2",
"@solana/web3.js": "^1.42.0",
"@switchboard-xyz/sbv2-utils": "^0.0.13",
"@switchboard-xyz/sbv2-utils": "^0.1.12",
"@switchboard-xyz/switchboard-v2": "^0.0.97"
},
"devDependencies": {

View File

@ -7,12 +7,8 @@
"strict": false,
"skipLibCheck": true,
"noImplicitReturns": false
// "paths": {
// "@switchboard-xyz/v2-task-runner": ["tasks/v2-task-runner"]
// }
}
},
// "references": [{ "path": "tasks/v2-task-runner" }],
"exclude": ["scripts/**/*.ts", "node_modules"],
"compilerOptions": {
/* Visit https://aka.ms/tsconfig.json to read more about this file */
@ -79,7 +75,7 @@
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
"inlineSources": true /* Include source code in the sourcemaps inside the emitted JavaScript. */,
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
// "newLine": "crlf", /* Set the newline character for emitting files. */
// "stripInternal": true, /* Disable emitting declarations that have `@internal` in their JSDoc comments. */

21
website/LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022 Switchboard
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -8,6 +8,7 @@ title: Requirements
A Switchboard oracle is a Node.js container that sits between the Solana blockchain and the internet and waits for update requests from its assigned oracle queue.
You can find the latest Switchboard oracle image on [DockerHub](https://hub.docker.com/r/switchboardlabs/node/tags).
## Hardware Requirements

View File

@ -10,7 +10,7 @@ import SwitchboardPermission from "/idl/types/SwitchboardPermission.md";
# Oracle Queue Architecture
An oracle queue is an independent realm of oracles, responsible for allocating oracle resources for update requests from data feeds, randomness, or buffer relayers. Oracle queue's act as a broker for on-chain consumers looking to publish data on-chain by specifying an upfront reward a requester is required to pay when a new update is requested by an oracle. Oracles act as an off-chain compute resource that can be utilized by on-chain programs needing a decentralized way to source data.
An oracle queue is an independent realm of oracles, responsible for allocating oracle resources for update requests from data feeds, randomness, or buffer relayers. Oracle queue's act as an aggregator for on-chain consumers looking to publish data on-chain by specifying an upfront reward a requester is required to pay when a new update is requested by an oracle. Oracles act as an off-chain compute resource that can be utilized by on-chain programs needing a decentralized way to source data.
Each oracle queue is independent and maintain their own configurations, which dictates its degree of security. Queue's can require update requesters to be pre-approved to use a queues resources or allow any requester access to a queue. Queue's also specify a minimum stake oracles must maintain in their escrow wallet before joining a queue, which acts as a deposit to incentivize honest oracle behavior.

View File

@ -1,12 +1,14 @@
{
"name": "website",
"version": "0.1.0",
"version": "0.1.1",
"private": true,
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/switchboard-xyz/switchboard-v2",
"directory": "website"
},
"homepage": "https://docs.switchboard.xyz",
"main": "src/pages/index.tsx",
"scripts": {
"docusaurus": "docusaurus",

205
yarn.lock
View File

@ -2493,6 +2493,21 @@
minimatch "^3.0.4"
strip-json-comments "^3.1.1"
"@eslint/eslintrc@^1.3.0":
version "1.3.0"
resolved "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.0.tgz#29f92c30bb3e771e4a2048c95fa6855392dfac4f"
integrity sha512-UWW0TMTmk2d7hLcWD1/e2g5HDM/HQ3csaLSqXCfqwh4uNDuNqlaKWXmEsL4Cs41Z0KnILNvwbHAah3C2yt06kw==
dependencies:
ajv "^6.12.4"
debug "^4.3.2"
espree "^9.3.2"
globals "^13.15.0"
ignore "^5.2.0"
import-fresh "^3.2.1"
js-yaml "^4.1.0"
minimatch "^3.1.2"
strip-json-comments "^3.1.1"
"@ethersproject/bytes@^5.6.0":
version "5.6.1"
resolved "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.6.1.tgz"
@ -4434,28 +4449,6 @@
superstruct "^0.14.2"
tweetnacl "^1.0.0"
"@solana/web3.js@^1.39.1":
version "1.41.9"
resolved "https://registry.npmjs.org/@solana/web3.js/-/web3.js-1.41.9.tgz#166973ed0cd600997c0976f717c66b95094fa438"
integrity sha512-tW6tT07+DyTb8jOT+3zdhdsdUbzRib+bhf1KXR6x9A7AnXZB9o+jBf+4IZRC17SuOeRKInIwsN4dKATXkqSulQ==
dependencies:
"@babel/runtime" "^7.12.5"
"@ethersproject/sha2" "^5.5.0"
"@solana/buffer-layout" "^4.0.0"
"@solana/buffer-layout-utils" "^0.2.0"
bn.js "^5.0.0"
borsh "^0.7.0"
bs58 "^4.0.1"
buffer "6.0.1"
cross-fetch "^3.1.4"
fast-stable-stringify "^1.0.0"
jayson "^3.4.4"
js-sha3 "^0.8.0"
rpc-websockets "^7.4.2"
secp256k1 "^4.0.2"
superstruct "^0.14.2"
tweetnacl "^1.0.0"
"@solana/web3.js@^1.42.0":
version "1.42.0"
resolved "https://registry.npmjs.org/@solana/web3.js/-/web3.js-1.42.0.tgz#296e4bbab1fbfc198b3e9c3d94016c3876eb6a2c"
@ -4685,7 +4678,7 @@
"@svgr/plugin-jsx" "^6.2.1"
"@svgr/plugin-svgo" "^6.2.0"
"@switchboard-xyz/switchboard-api@^0.2.193":
"@switchboard-xyz/switchboard-api@^0.2.200":
version "0.2.200"
resolved "https://registry.npmjs.org/@switchboard-xyz/switchboard-api/-/switchboard-api-0.2.200.tgz#16c7d95390693e5992a7f96287143361b4d38cc9"
integrity sha512-JvH1HMB809GauOVdD4AhriFSVAq5yAlDtnyqEQhmr0r5WgcVinEZdY56c3fpUFN2DcFH4Gl3/PH3N73ektcmKQ==
@ -4697,66 +4690,6 @@
typedoc "^0.22.15"
ws "^7.4.6"
"@switchboard-xyz/switchboard-api@^0.2.199":
version "0.2.199"
resolved "https://registry.npmjs.org/@switchboard-xyz/switchboard-api/-/switchboard-api-0.2.199.tgz#3eb73ed9fe6c2cb161c240b1828df9b2b606bdc7"
integrity sha512-VBGsdNGqVwBD2FSx44GODSsqDhCHalDSToN914b2czM2vJN0UCr4UijerJ2wdoZAZLEeG/dQnusqGTK8BPtL/g==
dependencies:
"@solana/web3.js" "^1.17.0"
form-data "^4.0.0"
protobufjs "^6.10.2"
rpc-websockets "^7.4.12"
typedoc "^0.22.15"
ws "^7.4.6"
"@switchboard-xyz/switchboard-v2@0.0.97", "@switchboard-xyz/switchboard-v2@^0.0.97":
version "0.0.97"
resolved "https://registry.npmjs.org/@switchboard-xyz/switchboard-v2/-/switchboard-v2-0.0.97.tgz#72a963baf3423287d47ee3dbb347325f5b2dc0ec"
integrity sha512-3tqjj29+4T/71DBggiUhAV4uVSEgIWhBqRR16fwL7PdjX7kWcMLkOwlcqz78KqfXhU/UA7HkoWtDdsOj/HoaGQ==
dependencies:
"@project-serum/anchor" "^0.24.2"
"@solana/spl-governance" "^0.0.34"
"@solana/spl-token" "^0.1.8"
"@solana/web3.js" "^1.39.1"
"@switchboard-xyz/switchboard-api" "^0.2.199"
assert "^2.0.0"
big.js "^6.1.1"
bs58 "^4.0.1"
buffer-layout "^1.2.0"
chalk "^4.1.2"
chan "^0.6.1"
crypto-js "^4.0.0"
dotenv "^16.0.0"
long "^4.0.0"
node-fetch "^3.2.3"
protobufjs "^6.10.2"
ts-proto "^1.79.0"
typescript "^4.6.3"
"@switchboard-xyz/switchboard-v2@^0.0.95":
version "0.0.95"
resolved "https://registry.npmjs.org/@switchboard-xyz/switchboard-v2/-/switchboard-v2-0.0.95.tgz#e39215785a8f65ac8c2215f835b19189975e263b"
integrity sha512-t4992Aw3flc+uZ1p2XIA26HmDkRoT2Dc0iP5V8CE8YfPbU5mQmx8is9rtJrMQvrOnRNQmYfFNfKGVnSdscZFLA==
dependencies:
"@project-serum/anchor" "^0.24.2"
"@solana/spl-governance" "^0.0.34"
"@solana/spl-token" "^0.1.8"
"@solana/web3.js" "^1.39.1"
"@switchboard-xyz/switchboard-api" "^0.2.193"
assert "^2.0.0"
big.js "^6.1.1"
bs58 "^4.0.1"
buffer-layout "^1.2.0"
chalk "^4.1.2"
chan "^0.6.1"
crypto-js "^4.0.0"
dotenv "^16.0.0"
long "^4.0.0"
node-fetch "^3.2.3"
protobufjs "^6.10.2"
ts-proto "^1.79.0"
typescript "^4.6.3"
"@switchboard-xyz/v2-task-library@^0.1.1":
version "0.1.5"
resolved "https://registry.npmjs.org/@switchboard-xyz/v2-task-library/-/v2-task-library-0.1.5.tgz"
@ -5022,11 +4955,6 @@
resolved "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.1.tgz"
integrity sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==
"@types/object-hash@^1.3.0":
version "1.3.4"
resolved "https://registry.npmjs.org/@types/object-hash/-/object-hash-1.3.4.tgz#079ba142be65833293673254831b5e3e847fe58b"
integrity sha512-xFdpkAkikBgqBdG9vIlsqffDV8GpvnPEzs0IUtr1v3BEB97ijsFQ4RXVbUZwjFThhB4MDSTUfvmxUD5PGx0wXA==
"@types/parse-json@^4.0.0":
version "4.0.0"
resolved "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz"
@ -5523,7 +5451,7 @@ acorn-import-assertions@^1.7.6:
resolved "https://registry.npmjs.org/acorn-import-assertions/-/acorn-import-assertions-1.8.0.tgz"
integrity sha512-m7VZ3jwz4eK6A4Vtt8Ew1/mNbP24u0FhdyfA7fSvnJR6LMdfOYnmuIrrJAgrYfYJ10F/otaHTtrtrtmHdMNzEw==
acorn-jsx@^5.3.1:
acorn-jsx@^5.3.1, acorn-jsx@^5.3.2:
version "5.3.2"
resolved "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz"
integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==
@ -5538,7 +5466,7 @@ acorn@^7.4.0:
resolved "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz"
integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==
acorn@^8.0.4, acorn@^8.4.1, acorn@^8.5.0, acorn@^8.7.0:
acorn@^8.0.4, acorn@^8.4.1, acorn@^8.5.0, acorn@^8.7.0, acorn@^8.7.1:
version "8.7.1"
resolved "https://registry.npmjs.org/acorn/-/acorn-8.7.1.tgz"
integrity sha512-Xx54uLJQZ19lKygFXOWsscKUbsBZW0CPykPhVQdhIeIwrbPmJzqeASDInc8nKBnp/JT6igTs82qPXz069H8I/A==
@ -7696,11 +7624,6 @@ data-uri-to-buffer@^4.0.0:
resolved "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.0.tgz"
integrity sha512-Vr3mLBA8qWmcuschSLAOogKgQ/Jwxulv3RNE4FXnYWRGujzrRWQI4m12fQqRkwX06C0KanhLr4hK+GydchZsaA==
dataloader@^1.4.0:
version "1.4.0"
resolved "https://registry.npmjs.org/dataloader/-/dataloader-1.4.0.tgz#bca11d867f5d3f1b9ed9f737bd15970c65dff5c8"
integrity sha512-68s5jYdlvasItOJnCuI2Q9s4q98g0pCyL3HrcKJu8KNugUl8ahgmZYg38ysLTgQjjXX3H8CJLkAvWrclWfcalw==
dateformat@^3.0.0:
version "3.0.3"
resolved "https://registry.npmjs.org/dateformat/-/dateformat-3.0.3.tgz"
@ -8722,6 +8645,47 @@ eslint@^7.28.0, eslint@^7.32.0:
text-table "^0.2.0"
v8-compile-cache "^2.0.3"
"eslint@^7.32.0 || ^8.2.0":
version "8.16.0"
resolved "https://registry.npmjs.org/eslint/-/eslint-8.16.0.tgz#6d936e2d524599f2a86c708483b4c372c5d3bbae"
integrity sha512-MBndsoXY/PeVTDJeWsYj7kLZ5hQpJOfMYLsF6LicLHQWbRDG19lK5jOix4DPl8yY4SUFcE3txy86OzFLWT+yoA==
dependencies:
"@eslint/eslintrc" "^1.3.0"
"@humanwhocodes/config-array" "^0.9.2"
ajv "^6.10.0"
chalk "^4.0.0"
cross-spawn "^7.0.2"
debug "^4.3.2"
doctrine "^3.0.0"
escape-string-regexp "^4.0.0"
eslint-scope "^7.1.1"
eslint-utils "^3.0.0"
eslint-visitor-keys "^3.3.0"
espree "^9.3.2"
esquery "^1.4.0"
esutils "^2.0.2"
fast-deep-equal "^3.1.3"
file-entry-cache "^6.0.1"
functional-red-black-tree "^1.0.1"
glob-parent "^6.0.1"
globals "^13.15.0"
ignore "^5.2.0"
import-fresh "^3.0.0"
imurmurhash "^0.1.4"
is-glob "^4.0.0"
js-yaml "^4.1.0"
json-stable-stringify-without-jsonify "^1.0.1"
levn "^0.4.1"
lodash.merge "^4.6.2"
minimatch "^3.1.2"
natural-compare "^1.4.0"
optionator "^0.9.1"
regexpp "^3.2.0"
strip-ansi "^6.0.1"
strip-json-comments "^3.1.0"
text-table "^0.2.0"
v8-compile-cache "^2.0.3"
eslint@^8.3.0:
version "8.14.0"
resolved "https://registry.npmjs.org/eslint/-/eslint-8.14.0.tgz"
@ -8781,6 +8745,15 @@ espree@^9.3.1:
acorn-jsx "^5.3.1"
eslint-visitor-keys "^3.3.0"
espree@^9.3.2:
version "9.3.2"
resolved "https://registry.npmjs.org/espree/-/espree-9.3.2.tgz#f58f77bd334731182801ced3380a8cc859091596"
integrity sha512-D211tC7ZwouTIuY5x9XnS0E9sWNChB7IYKX/Xp5eQj3nFXhqmiUDB9q27y76oFl8jTg3pXcQx/bpxMfs3CIZbA==
dependencies:
acorn "^8.7.1"
acorn-jsx "^5.3.2"
eslint-visitor-keys "^3.3.0"
esprima@^4.0.0, esprima@^4.0.1, esprima@~4.0.0:
version "4.0.1"
resolved "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz"
@ -9718,6 +9691,13 @@ globals@^11.1.0:
resolved "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz"
integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==
globals@^13.15.0:
version "13.15.0"
resolved "https://registry.npmjs.org/globals/-/globals-13.15.0.tgz#38113218c907d2f7e98658af246cef8b77e90bac"
integrity sha512-bpzcOlgDhMG070Av0Vy5Owklpv1I6+j96GhUI7Rh7IzDCKLzboflLrrfqMu8NquDbiR4EOQk7XzJwqVJxicxog==
dependencies:
type-fest "^0.20.2"
globals@^13.6.0, globals@^13.9.0:
version "13.13.0"
resolved "https://registry.npmjs.org/globals/-/globals-13.13.0.tgz"
@ -12755,11 +12735,6 @@ object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1:
resolved "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz"
integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=
object-hash@^1.3.1:
version "1.3.1"
resolved "https://registry.npmjs.org/object-hash/-/object-hash-1.3.1.tgz#fde452098a951cb145f039bb7d455449ddc126df"
integrity sha512-OSuu/pU4ENM9kmREg0BdNrUDIl1heYa4mBZacJc+vVWz4GtAwu7jO8s4AIt2aGRUTqxykpWzI3Oqnsm13tTMDA==
object-hash@^3.0.0:
version "3.0.0"
resolved "https://registry.npmjs.org/object-hash/-/object-hash-3.0.0.tgz"
@ -13822,7 +13797,7 @@ proto3-json-serializer@^0.1.8:
dependencies:
protobufjs "^6.11.2"
protobufjs@6.11.2, protobufjs@^6.10.0, protobufjs@^6.10.2, protobufjs@^6.11.2, protobufjs@^6.8.8:
protobufjs@6.11.2, protobufjs@^6.10.0, protobufjs@^6.10.2, protobufjs@^6.11.2:
version "6.11.2"
resolved "https://registry.npmjs.org/protobufjs/-/protobufjs-6.11.2.tgz"
integrity sha512-4BQJoPooKJl2G9j3XftkIXjoC9C0Av2NOrWmbLWT1vH32GcSUHjM0Arra6UfTsVyfMAuFzaLucXn1sadxJydAw==
@ -16122,34 +16097,6 @@ ts-node@^10.4.0, ts-node@^10.7.0:
v8-compile-cache-lib "^3.0.0"
yn "3.1.1"
ts-poet@^4.11.0:
version "4.11.0"
resolved "https://registry.npmjs.org/ts-poet/-/ts-poet-4.11.0.tgz#5566f499ec767920cc18b977624f084c52e8734a"
integrity sha512-OaXnCKsRs0yrc0O7LFhnq/US2DB4Wd313cS+qjG2XMksZ74pF/jvMHkJdURXJiAo4kSahL2N4e8JOdwUjOMNdw==
dependencies:
lodash "^4.17.15"
prettier "^2.5.1"
ts-proto-descriptors@1.6.0:
version "1.6.0"
resolved "https://registry.npmjs.org/ts-proto-descriptors/-/ts-proto-descriptors-1.6.0.tgz#ca6eafc882495a2e920da5b981d7b181b4e49c38"
integrity sha512-Vrhue2Ti99us/o76mGy28nF3W/Uanl1/8detyJw2yyRwiBC5yxy+hEZqQ/ZX2PbZ1vyCpJ51A9L4PnCCnkBMTQ==
dependencies:
long "^4.0.0"
protobufjs "^6.8.8"
ts-proto@^1.79.0:
version "1.112.1"
resolved "https://registry.npmjs.org/ts-proto/-/ts-proto-1.112.1.tgz#255a10c3d92af5f8202ae8bf310c3ea35a3227f8"
integrity sha512-pMqPsgehCR5lNHYrSCfaC7Vx5RXLxTk0MQFvC69+9E4x6yvAed3orCLAWZ1VvPug02bBK5J5vV8JJLS3+FnnUA==
dependencies:
"@types/object-hash" "^1.3.0"
dataloader "^1.4.0"
object-hash "^1.3.1"
protobufjs "^6.8.8"
ts-poet "^4.11.0"
ts-proto-descriptors "1.6.0"
tsconfig-paths@^3.14.1, tsconfig-paths@^3.5.0:
version "3.14.1"
resolved "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.1.tgz"