Closed lazerbeam-dev closed 1 year ago
I can confirm that
$ clarinet test
with
// @ts-ignore
import { assertEquals } from "https://deno.land/std@0.90.0/testing/asserts.ts";
// @ts-ignore
import axiod from "https://deno.land/x/axiod/mod.ts";
Clarinet.test({
name: "Ensure that we can get a price from Redstone",
async fn(chain: Chain, accounts: Map<string, Account>) {
let response = await axiod.get(
"https://api.redstone.finance/prices?symbol=STX&provider=redstone&limit=1",
);
console.log(response.data);
},
});
works as expected with the develop branch.
./tests/counter_test.ts => Ensure that <...> ... ok (4ms)
⚠️ ️Deno requests net access to "api.redstone.finance". Run again with --allow-net to bypass this prompt.
Allow? [y/n (y = yes allow, n = no deny)] y
------- output -------
[
{
id: "cbcaad99-7db5-45a3-8afb-c0b005545851",
symbol: "STX",
provider: "I-5rWUehEv-MjdK9gFw09RxfSLQX9DIHxG614Wf8qo0",
value: 0.3249,
liteEvmSignature: "0xe76e12a9669a72d56940037b025408c6bc2b85d2d36bac60bb060e580cc534aa7dd7a3350bcdd2781126a3a9099d55ca12...",
permawebTx: "mock-permaweb-tx",
version: "0.4",
source: {
binance: 0.3250325,
coinbaseprime: 0.3249,
coinbasepro: 0.3249,
kucoin: "error",
okcoin: "error",
okex5: "error"
},
timestamp: 1665071246245,
minutes: 47,
providerPublicKey: "xyTvKiCST8bAT6sxrgkLh8UCX2N1eKvawODuxwq4qOHIdDAZFU_3N2m59rkZ0E7m77GsJuf1I8u0oEJEbxAdT7uD2JTwoYEHauXS..."
}
]
./tests/counter_test.ts => Ensure that we can get a price from Redstone ...----- output end -----
./tests/counter_test.ts => Ensure that we can get a price from Redstone ... ok (3s)
// deno says it requires flag "--allow-net" to make http request but do not know a way to set this flag from clarinet
// code below
// @ts-ignore import { Clarinet, Tx, Chain, Account, types } from 'https://deno.land/x/clarinet@v0.31.0/index.ts'; // @ts-ignore import { assertEquals } from 'https://deno.land/std@0.90.0/testing/asserts.ts'; // @ts-ignore import axiod from "https://deno.land/x/axiod/mod.ts";
Clarinet.test({ name: "Ensure that we can get a price from Redstone", async fn(chain: Chain, accounts: Map<string, Account>) { axiod.get("https://api.redstone.finance/prices?symbol=STX&provider=redstone&limit=1") .then(function (response) { console.log(response.data) }); }, });