Skip to content

Commit

Permalink
-fix deploy script to use ceramic daemon location in local node
Browse files Browse the repository at this point in the history
-Add button to update price
  • Loading branch information
juanobligado committed Aug 21, 2021
1 parent d965395 commit 97cbeef
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 13 deletions.
2 changes: 1 addition & 1 deletion services/configs/ceramic_adapter_cfg.unix.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ceramic_adapter",
"mountedBinaries": {
"ceramic": "/root/.nvm/versions/node/v14.17.0/bin/ceramic"
"ceramic": "/usr/bin/ceramic"
}
}
2 changes: 1 addition & 1 deletion services/deploy_service.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
fldist --node-id 12D3KooWKEprYXUXqoV5xSBeyqrWLpQLLH4PXfvVkDJtmcqmh5V3 --env "local" new_service --ms artifacts/ceramic_adapter.wasm:configs/ceramic_adapter_cfg.json artifacts/aggregator_service.wasm:configs/aggregator_service_cfg.json --name aggregator-service-0
fldist --node-id 12D3KooWCSLKALdhXgQzDBDqBx3WuA8sYRY7rATeo27bXrB1HB83 --node-addr /ip4/127.0.0.1/tcp/9999/ws/p2p/12D3KooWCSLKALdhXgQzDBDqBx3WuA8sYRY7rATeo27bXrB1HB83 --env "local" new_service --ms artifacts/ceramic_adapter.wasm:configs/ceramic_adapter_cfg.unix.json artifacts/aggregator_service.wasm:configs/aggregator_service_cfg.json --name aggregator-service-0
2 changes: 1 addition & 1 deletion web/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>Fluence price oracle</title>
<title>DxAggregator Demo</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
Expand Down
5 changes: 3 additions & 2 deletions web/src/App.scss
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ li {
}
}


.btn-hello {
width: 200px;
width: 160px;
display: inline;
float: right;
}
Expand All @@ -99,7 +100,7 @@ table {
}

.label {
width: 120px;
width: 200px;
display: inline-block;
}

Expand Down
48 changes: 40 additions & 8 deletions web/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,11 @@ const NumberInput = (props: {

function App() {
const [client, setClient] = useState<FluenceClient | null>(null);
const [streamId, setStreamId] = useState<string>("kjzl6cwe1jw14b4p64saz1980b0gl3l1c98ag1pslez0shjrhv1mr44257hv9m0");
const [streamId, setStreamId] = useState<string>("kjzl6cwe1jw147d3hz5mmf6997l8hjo6cbvwjn1t7210hjot8i371s9lzggidlz");
const [node, setNode] = useState<string>("12D3KooWCSLKALdhXgQzDBDqBx3WuA8sYRY7rATeo27bXrB1HB83");
const [priceServiceId, setPriceServiceId] = useState<string>("97020f48-ff5b-471c-8cf0-c94df082b9a8");
const [price, setPrice] = useState<number>(
0.0
);
const [priceServiceId, setPriceServiceId] = useState<string>("d4635b5a-6329-4e31-a0ee-b106441a358a");
const [ticker, setTicker] = useState<string>("ETH");
const [price, setPrice] = useState<number>(0.0);
const [result, setResult] = useState<Result | null>(null);
let failed = false;
let nodeAddr = "/ip4/127.0.0.1/tcp/9999/ws/p2p/12D3KooWCSLKALdhXgQzDBDqBx3WuA8sYRY7rATeo27bXrB1HB83";
Expand Down Expand Up @@ -88,6 +87,33 @@ function App() {
}
};


const doSendPrice = async () => {
if (client === null) {
return;
}
try {
let now = Date.prototype.getTime();
console.log('Calling Process Data : ',node,priceServiceId,streamId,ticker,price ,Date.prototype.getTime());
const res = await process_data(
client!,
node,
priceServiceId,
streamId,
ticker,
price ,
now
);
console.log("Retrieved result: ", res);

setResult(res);
failed = false;
} catch (err) {
failed = true;
console.log(err);
}
};

const doPing = async ()=>{
if (client === null) {
return;
Expand Down Expand Up @@ -122,17 +148,23 @@ function App() {
<TextInput text={"node"} value={node} setValue={setNode} />
<TextInput text={"priceServiceId"} value={priceServiceId} setValue={setPriceServiceId} />
<TextInput text={"Ceramic Stream Id"} value={streamId} setValue={setStreamId} />
<TextInput text={"Ticker"} value={ticker} setValue={setTicker} />
<NumberInput text="price" value={price} setValue={setPrice} />

<div className="row">
<button className="btn btn-hello" onClick={() => doSendPrice()}>
Update price
</button>
<button className="btn btn-hello" onClick={() => doGetPrice()}>
Read Last price
</button>
</div>
<div className="row">

<button className="btn btn-hello" onClick={() => doPing()}>
Ping
</button>
</div>

</div>

</div>
<h2>Bar price</h2>
{ result?.ticker !== "" && (
Expand Down

0 comments on commit 97cbeef

Please sign in to comment.