Skip to content
Permalink
Browse files

Add oracle example

  • Loading branch information...
DenisCarriere committed May 7, 2019
1 parent 7e3b2c0 commit 370ec915f8e1b883cc91edd43d181250b2f12f1d
Showing with 450 additions and 0 deletions.
  1. +2 −0 .example.env
  2. +17 −0 examples/test-oracle.ts
  3. +347 −0 package-lock.json
  4. +26 −0 package.json
  5. +20 −0 src/config.ts
  6. +16 −0 src/interfaces.ts
  7. +22 −0 src/utils.ts
@@ -0,0 +1,2 @@
DSP_ENDPOINT='https://dsp.eosn.io'
PRIVATE_KEY='<PRIVATE KEY>'
@@ -0,0 +1,17 @@
import { transact } from "../src/utils";
import { Action } from "../src/interfaces";

(async () => {
const action: Action = {
account: "oraclenation",
name: "testrnd",
authorization: [
{actor: "oraclenation", permission: "ops"}
],
data: {
uri: Buffer.from('https://api.bancor.network/0.1/currencies/rate?toCurrencyCode=BNT&fromCurrencyCodes=USD', 'utf8'),
}
}
await transact([action]).catch(e => console.error(e));

})().catch(e => console.error(e));

Some generated files are not rendered by default. Learn more.

@@ -0,0 +1,26 @@
{
"private": true,
"name": "dapp-oracle-examples",
"version": "0.1.0",
"description": "DAPP Oracle examples",
"main": "index.js",
"directories": {
"example": "examples"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Denis Carriere <denis@eosnation.io>",
"license": "MIT",
"dependencies": {
"dotenv": "^8.0.0",
"eosjs": "^20.0.0",
"isomorphic-fetch": "^2.2.1"
},
"devDependencies": {
"@types/isomorphic-fetch": "0.0.35",
"@types/node": "^12.0.0",
"ts-node": "^8.1.0",
"typescript": "^3.4.5"
}
}

0 comments on commit 370ec91

Please sign in to comment.
You can’t perform that action at this time.