@effectai/sdk
Version:
Effect Network Javscript/Typescript SDK (for [https://effect.network](https://effect.network))
29 lines • 1.14 kB
JavaScript
export var DefiBoxPairEnum;
(function (DefiBoxPairEnum) {
DefiBoxPairEnum[DefiBoxPairEnum["EosEfx"] = 191] = "EosEfx";
DefiBoxPairEnum[DefiBoxPairEnum["EosUsdt"] = 12] = "EosUsdt";
})(DefiBoxPairEnum || (DefiBoxPairEnum = {}));
export const getDefiBoxPair = async (pairEnum) => {
try {
// TODO: Check how resilient this is, otherwise figure out how to use FetchProvider from the SDK Client.
const useFetch = fetch ?? window.fetch;
const result = await useFetch("https://eos.greymass.com/v1/chain/get_table_rows", {
method: "POST",
body: JSON.stringify({
json: true,
code: "swap.defi",
scope: "swap.defi",
table: "pairs",
limit: 1,
lower_bound: pairEnum.valueOf(),
upper_bound: pairEnum.valueOf(),
}),
});
return result.json().then((data) => data.rows[0]);
}
catch (error) {
console.error(error);
throw new Error("Error retrieving EFX Ticker Price from DefiBox");
}
};
//# sourceMappingURL=getDefiBoxPair.js.map