Join our webinar on Wednesday, June 26, at 1pm EDTHow Chia Mitigates Risk in the Crypto Industry.Register
Socket
Socket
Sign inDemoInstall

@trusource/server

Package Overview
Dependencies
195
Maintainers
2
Versions
78
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.14 to 0.1.15

9

package.json
{
"name": "@trusource/server",
"version": "0.1.14",
"version": "0.1.15",
"description": "TruSource oracle local test server",

@@ -17,3 +17,3 @@ "main": "./src/index.js",

"dependencies": {
"@trusource/fetch": "^0.1.11",
"@trusource/fetch": "^0.1.12",
"@trusource/ws": "^0.1.4",

@@ -32,3 +32,4 @@ "commander": "^5.1.0",

"oracles"
]
}
],
"gitHead": "43dd9d95c496fce0d335ede05f812a1218d78fd1"
}
# @trusource/server
Locally test smart contract calls to a TruSource provided oracle.
Locally test smart contract calls to a Trusource oracle.
## Getting started
## Install

@@ -11,37 +11,19 @@ ```shell

## Quick Start
## Usage
After running a local ganache instance and migrating your contracts
Installing the package creates `trusource-server` command line utility, which can be used as follows.
```js
const { server } = require('@trusource/server');
const model = require('./model.json');
const oracleArtifact = require('../build/contracts/Oracle.json');
server(oracleArtifact, model);
```shell
$ trusource-server --spec <path-to-oas.json>
```
## trusource.server
### options
```js
trusource.server(oracleArtifact, model);
```shell
-d, --debug output extra debugging
-p, --port [number] port number to listen on default 8545
```
Calling the server function initiates a process that listens for events emitted by a local ganache instance, fetches the requested data and makes contract calls, passing the response in the payload.
### OAS
### oracleArtifact
A build artifact generated for the `oracle.sol` smart contract after migration to a local ganache instance. From the root of truffle project, it is found at `./build/contracts/Oracle.json`.
### model.json
A model representing an api from a data source, can be found [here](http://docs.trusource.io).
## Command Line Interface
Installing the package creates `trusource-server` command line utility, which can be used as follows.
```shell
$ trusource-server <path-to-Oracle.json> <path-to-model.json>
```
[OpenAPI](https://www.openapis.org/) specification used by the @trusource/server to locally listen for contract events, fetch data and make callbacks. The oas for a given api can be found [here](https://docs.trusource.io).
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc