@xyo-network/react-price-forecast-plugin 2.75.0 → 2.75.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,271 @@
1
- "use strict";var c=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var k=(o,e)=>{for(var t in e)c(o,t,{get:e[t],enumerable:!0})},L=(o,e,t,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of O(e))!T.call(o,r)&&r!==t&&c(o,r,{get:()=>e[r],enumerable:!(a=v(e,r))||a.enumerable});return o};var R=o=>L(c({},"__esModule",{value:!0}),o);var H={};k(H,{PriceForecastDetailsBox:()=>u,PriceForecastRenderPlugin:()=>G});module.exports=R(H);var $=require("chartjs-adapter-luxon"),f=require("@mui/material"),g=require("@xylabs/react-async-effect"),_=require("@xylabs/react-flexbox"),s=require("chart.js"),m=require("react"),C=require("react-chartjs-2");var y=require("@mui/material"),d=o=>({backgroundColor:o?(0,y.alpha)(o,.5):void 0,borderColor:o});var p=o=>({pointHitRadius:20,pointHoverBackgroundColor:o,pointHoverRadius:10,pointRadius:5,pointStyle:"circle"});var P=()=>[{baseFee:38.90155387825,feePerGas:{high:47.9945864396,low:39.006868093,medium:39.306868093,veryHigh:44.45384380525},priorityFeePerGas:{high:1.0266666666666666,low:-.41000000000000003,medium:.38,veryHigh:1.3900000000000001},schema:"network.xyo.blockchain.ethereum.gas",timestamp:Date.now()-6e5},{baseFee:38.90155387825,feePerGas:{high:47.9945864396,low:39.006868093,medium:100,veryHigh:44.45384380525},priorityFeePerGas:{high:1.0266666666666666,low:-.41000000000000003,medium:.38,veryHigh:1.3900000000000001},schema:"network.xyo.blockchain.ethereum.gas",timestamp:Date.now()}];var n=class{constructor(e){this.sourcePayloads=e}sourcePrices=[];get payloads(){return this.sourcePayloads}static async build(e){let t=await this.fetchSourcePayloads(),a=new this(t),r=e.split(".");return a.sourcePrices=t.map(i=>({x:i.timestamp,y:a.jsonPathTraverser(i,r)})),a}static async fetchSourcePayloads(){return await Promise.resolve(P())}jsonPathTraverser(e,t){let a=e;for(let r of t)if(r in a)a=a[r];else{a=void 0;break}return a}};var B=()=>({plugins:{legend:{position:"top"}},responsive:!0}),l=class o{constructor(e,t){this.payload=t;this.themeColors=this.parseTheme(e)}data={datasets:[]};options=B();themeColors;get forecastPayload(){if(this.payload)return this.payload;throw new Error("ForecastPayload was not defined")}static async create(e,t,a){let r=new o(e,t);return await r.build(a?.fetch),r.refreshValues(),r}async build(e){return this.buildOptions(),await this.buildData(e),this}async buildData(e){let t=this.generateDataSetForecastData(),a=[t];if(e){let r=await this.generateDataSetSourcePayloads();a.unshift(r);let i=r.data.at(-1);t.data.unshift(i)}return this.data={datasets:a},this}buildOptions(){return this.options.plugins&&(this.options.plugins.title=this.generateTitle(),this.options.plugins.legend=this.generateLegend()),this.options.scales=this.generateScales(),this}refreshValues(){this.data={...this.data},this.options={...this.options}}generateLegend(){return{labels:{pointStyle:"circle",usePointStyle:!0}}}generateScales(){return{x:{grid:{color:this.themeColors?.gridColor},time:{unit:"minute"},type:"time"},y:{grid:{color:this.themeColors?.gridColor}}}}generateTitle(){return{display:!0,text:`Gas Price Forecaster (GWEI over time from ${this.forecastPayload?.values[0].timestamp?new Date(this.forecastPayload.values[0].timestamp).toLocaleDateString():""})`}}parseTheme(e){let t=e.palette.mode==="dark";return{dataSetColorPrimary:e.palette.primary.light,dataSetColorSecondary:e.palette.secondary.light,gridColor:t?e.palette.grey[800]:e.palette.grey[300]}}generateDataSetForecastData(){return{borderDash:[5],borderDashOffset:.5,data:this.forecastPayload.values.map(e=>({x:e.timestamp??0,y:e.value})),label:"Forecast Price",...p(this.themeColors?.dataSetColorPrimary),...d(this.themeColors?.dataSetColorPrimary)}}async generateDataSetSourcePayloads(){let{sourcePrices:e}=await n.build("feePerGas.medium");return{data:e,label:"Source Prices",...d(this.themeColors?.dataSetColorSecondary),...p(this.themeColors?.dataSetColorSecondary)}}};var h=require("react/jsx-runtime");s.Chart.register(s.CategoryScale,s.TimeScale,s.PointElement,s.LineElement,s.LinearScale,s.Title,s.Tooltip,s.Legend);var u=({payload:o,...e})=>{let t=o,a=(0,f.useTheme)(),[r,i]=(0,m.useState)({datasets:[]}),[D,b]=(0,m.useState)({});return(0,g.useAsyncEffect)(async x=>{let{data:F,options:w}=await l.create(a,t,{fetch:!0});x()&&(i(F),b(w))},[t,a]),(0,h.jsx)(_.FlexCol,{...e,busy:t===void 0,minHeight:"25vh",children:t?(0,h.jsx)(C.Line,{options:D,data:r}):null})};var S=require("@xyo-network/react-payload-plugin");var G={...(0,S.createPayloadRenderPlugin)({canRender:()=>!0,components:{box:{detailsBox:u}},name:"PriceForecast"})};
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var src_exports = {};
22
+ __export(src_exports, {
23
+ PriceForecastDetailsBox: () => PriceForecastDetailsBox,
24
+ PriceForecastRenderPlugin: () => PriceForecastRenderPlugin
25
+ });
26
+ module.exports = __toCommonJS(src_exports);
27
+
28
+ // src/components/DetailsBox.tsx
29
+ var import_chartjs_adapter_luxon = require("chartjs-adapter-luxon");
30
+ var import_material2 = require("@mui/material");
31
+ var import_react_async_effect = require("@xylabs/react-async-effect");
32
+ var import_react_flexbox = require("@xylabs/react-flexbox");
33
+ var import_chart = require("chart.js");
34
+ var import_react = require("react");
35
+ var import_react_chartjs_2 = require("react-chartjs-2");
36
+
37
+ // src/lib/DataLineStyles.ts
38
+ var import_material = require("@mui/material");
39
+ var DataLineStyles = (color) => ({
40
+ backgroundColor: color ? (0, import_material.alpha)(color, 0.5) : void 0,
41
+ borderColor: color
42
+ });
43
+
44
+ // src/lib/DataPointStyles.ts
45
+ var DataPointStyles = (pointHoverBackgroundColor) => ({
46
+ pointHitRadius: 20,
47
+ pointHoverBackgroundColor,
48
+ pointHoverRadius: 10,
49
+ pointRadius: 5,
50
+ pointStyle: "circle"
51
+ });
52
+
53
+ // src/lib/MockSourcePayloads.ts
54
+ var MockSourcePayloads = () => {
55
+ const tenMin = 6e5;
56
+ return [
57
+ {
58
+ baseFee: 38.90155387825,
59
+ feePerGas: { high: 47.9945864396, low: 39.006868093, medium: 39.306868093, veryHigh: 44.45384380525 },
60
+ priorityFeePerGas: { high: 1.0266666666666666, low: -0.41000000000000003, medium: 0.38, veryHigh: 1.3900000000000001 },
61
+ schema: "network.xyo.blockchain.ethereum.gas",
62
+ timestamp: Date.now() - tenMin
63
+ },
64
+ {
65
+ baseFee: 38.90155387825,
66
+ feePerGas: { high: 47.9945864396, low: 39.006868093, medium: 100, veryHigh: 44.45384380525 },
67
+ priorityFeePerGas: { high: 1.0266666666666666, low: -0.41000000000000003, medium: 0.38, veryHigh: 1.3900000000000001 },
68
+ schema: "network.xyo.blockchain.ethereum.gas",
69
+ timestamp: Date.now()
70
+ }
71
+ ];
72
+ };
73
+
74
+ // src/lib/SourcePayloads.ts
75
+ var SourcePayloads = class {
76
+ constructor(sourcePayloads) {
77
+ this.sourcePayloads = sourcePayloads;
78
+ }
79
+ sourcePrices = [];
80
+ get payloads() {
81
+ return this.sourcePayloads;
82
+ }
83
+ static async build(jsonPath) {
84
+ const sourcePayloads = await this.fetchSourcePayloads();
85
+ const instance = new this(sourcePayloads);
86
+ const paths = jsonPath.split(".");
87
+ instance.sourcePrices = sourcePayloads.map((payload) => {
88
+ return { x: payload.timestamp, y: instance.jsonPathTraverser(payload, paths) };
89
+ });
90
+ return instance;
91
+ }
92
+ // TODO - fetch from archivist
93
+ static async fetchSourcePayloads() {
94
+ const payloads = await Promise.resolve(MockSourcePayloads());
95
+ return payloads;
96
+ }
97
+ jsonPathTraverser(obj, path) {
98
+ let result = obj;
99
+ for (const key of path) {
100
+ if (key in result) {
101
+ const foundKey = key;
102
+ result = result[foundKey];
103
+ } else {
104
+ result = void 0;
105
+ break;
106
+ }
107
+ }
108
+ return result;
109
+ }
110
+ };
111
+
112
+ // src/lib/ForecastLineChartConfigBuilder.ts
113
+ var defaultOptions = () => ({
114
+ plugins: {
115
+ legend: {
116
+ position: "top"
117
+ }
118
+ },
119
+ responsive: true
120
+ });
121
+ var ForecastLineChartConfigBuilder = class _ForecastLineChartConfigBuilder {
122
+ constructor(theme, payload) {
123
+ this.payload = payload;
124
+ this.themeColors = this.parseTheme(theme);
125
+ }
126
+ data = {
127
+ datasets: []
128
+ };
129
+ options = defaultOptions();
130
+ themeColors;
131
+ get forecastPayload() {
132
+ if (this.payload) {
133
+ return this.payload;
134
+ } else {
135
+ throw new Error("ForecastPayload was not defined");
136
+ }
137
+ }
138
+ static async create(theme, payload, sourcePayloadConfig) {
139
+ const instance = new _ForecastLineChartConfigBuilder(theme, payload);
140
+ await instance.build(sourcePayloadConfig?.fetch);
141
+ instance.refreshValues();
142
+ return instance;
143
+ }
144
+ async build(includeSources) {
145
+ this.buildOptions();
146
+ await this.buildData(includeSources);
147
+ return this;
148
+ }
149
+ async buildData(includeSources) {
150
+ const forecastData = this.generateDataSetForecastData();
151
+ const datasets = [forecastData];
152
+ if (includeSources) {
153
+ const sourceData = await this.generateDataSetSourcePayloads();
154
+ datasets.unshift(sourceData);
155
+ const lastSourceDataItem = sourceData.data.at(-1);
156
+ forecastData.data.unshift(lastSourceDataItem);
157
+ }
158
+ this.data = {
159
+ datasets
160
+ };
161
+ return this;
162
+ }
163
+ buildOptions() {
164
+ if (this.options.plugins) {
165
+ this.options.plugins.title = this.generateTitle();
166
+ this.options.plugins.legend = this.generateLegend();
167
+ }
168
+ this.options.scales = this.generateScales();
169
+ return this;
170
+ }
171
+ refreshValues() {
172
+ this.data = { ...this.data };
173
+ this.options = { ...this.options };
174
+ }
175
+ generateLegend() {
176
+ return {
177
+ labels: {
178
+ pointStyle: "circle",
179
+ usePointStyle: true
180
+ }
181
+ };
182
+ }
183
+ generateScales() {
184
+ return {
185
+ x: {
186
+ grid: {
187
+ color: this.themeColors?.gridColor
188
+ },
189
+ time: {
190
+ unit: "minute"
191
+ },
192
+ type: "time"
193
+ },
194
+ y: {
195
+ grid: {
196
+ color: this.themeColors?.gridColor
197
+ }
198
+ }
199
+ };
200
+ }
201
+ generateTitle() {
202
+ return {
203
+ display: true,
204
+ text: `Gas Price Forecaster (GWEI over time from ${this.forecastPayload?.values[0].timestamp ? new Date(this.forecastPayload.values[0].timestamp).toLocaleDateString() : ""})`
205
+ };
206
+ }
207
+ parseTheme(theme) {
208
+ const dark = theme.palette.mode === "dark";
209
+ return {
210
+ dataSetColorPrimary: theme.palette.primary.light,
211
+ dataSetColorSecondary: theme.palette.secondary.light,
212
+ gridColor: dark ? theme.palette.grey[800] : theme.palette.grey[300]
213
+ };
214
+ }
215
+ generateDataSetForecastData() {
216
+ return {
217
+ borderDash: [5],
218
+ borderDashOffset: 0.5,
219
+ data: this.forecastPayload.values.map((price) => ({ x: price.timestamp ?? 0, y: price.value })),
220
+ label: "Forecast Price",
221
+ ...DataPointStyles(this.themeColors?.dataSetColorPrimary),
222
+ ...DataLineStyles(this.themeColors?.dataSetColorPrimary)
223
+ };
224
+ }
225
+ async generateDataSetSourcePayloads() {
226
+ const { sourcePrices } = await SourcePayloads.build("feePerGas.medium");
227
+ return {
228
+ data: sourcePrices,
229
+ label: "Source Prices",
230
+ ...DataLineStyles(this.themeColors?.dataSetColorSecondary),
231
+ ...DataPointStyles(this.themeColors?.dataSetColorSecondary)
232
+ };
233
+ }
234
+ };
235
+
236
+ // src/components/DetailsBox.tsx
237
+ var import_jsx_runtime = require("react/jsx-runtime");
238
+ import_chart.Chart.register(import_chart.CategoryScale, import_chart.TimeScale, import_chart.PointElement, import_chart.LineElement, import_chart.LinearScale, import_chart.Title, import_chart.Tooltip, import_chart.Legend);
239
+ var PriceForecastDetailsBox = ({ payload, ...props }) => {
240
+ const priceForecastPayload = payload;
241
+ const theme = (0, import_material2.useTheme)();
242
+ const [data, setData] = (0, import_react.useState)({ datasets: [] });
243
+ const [options, setOptions] = (0, import_react.useState)({});
244
+ (0, import_react_async_effect.useAsyncEffect)(
245
+ // eslint-disable-next-line react-hooks/exhaustive-deps
246
+ async (mounted) => {
247
+ const { data: data2, options: options2 } = await ForecastLineChartConfigBuilder.create(theme, priceForecastPayload, { fetch: true });
248
+ if (mounted()) {
249
+ setData(data2);
250
+ setOptions(options2);
251
+ }
252
+ },
253
+ [priceForecastPayload, theme]
254
+ );
255
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_flexbox.FlexCol, { ...props, busy: priceForecastPayload === void 0, minHeight: "25vh", children: priceForecastPayload ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_chartjs_2.Line, { options, data }) : null });
256
+ };
257
+
258
+ // src/Plugin.ts
259
+ var import_react_payload_plugin = require("@xyo-network/react-payload-plugin");
260
+ var PriceForecastRenderPlugin = {
261
+ ...(0, import_react_payload_plugin.createPayloadRenderPlugin)({
262
+ canRender: () => true,
263
+ components: {
264
+ box: {
265
+ detailsBox: PriceForecastDetailsBox
266
+ }
267
+ },
268
+ name: "PriceForecast"
269
+ })
270
+ };
2
271
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts","../../src/components/DetailsBox.tsx","../../src/lib/DataLineStyles.ts","../../src/lib/DataPointStyles.ts","../../src/lib/MockSourcePayloads.ts","../../src/lib/SourcePayloads.ts","../../src/lib/ForecastLineChartConfigBuilder.ts","../../src/Plugin.ts"],"sourcesContent":["export * from './components'\nexport * from './Plugin'\n","import 'chartjs-adapter-luxon'\n\nimport { useTheme } from '@mui/material'\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { FlexBoxProps, FlexCol } from '@xylabs/react-flexbox'\nimport { ForecastPayload } from '@xyo-network/diviner-forecasting-model'\nimport { Payload } from '@xyo-network/payload-model'\nimport {\n CategoryScale,\n Chart as ChartJS,\n ChartData,\n ChartOptions,\n Legend,\n LinearScale,\n LineElement,\n PointElement,\n TimeScale,\n Title,\n Tooltip,\n} from 'chart.js'\nimport { useState } from 'react'\nimport { Line } from 'react-chartjs-2'\n\nimport { ForecastLineChartConfigBuilder } from '../lib'\n\nChartJS.register(CategoryScale, TimeScale, PointElement, LineElement, LinearScale, Title, Tooltip, Legend)\n\nexport interface PriceForecastDetailsBoxProps extends FlexBoxProps {\n payload?: Payload\n}\n\nexport const PriceForecastDetailsBox: React.FC<PriceForecastDetailsBoxProps> = ({ payload, ...props }) => {\n const priceForecastPayload = payload as ForecastPayload | undefined\n const theme = useTheme()\n const [data, setData] = useState<ChartData<'line'>>({ datasets: [] })\n const [options, setOptions] = useState<ChartOptions<'line'>>({})\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n const { data, options } = await ForecastLineChartConfigBuilder.create(theme, priceForecastPayload, { fetch: true })\n if (mounted()) {\n setData(data)\n setOptions(options)\n }\n },\n [priceForecastPayload, theme],\n )\n\n return (\n <FlexCol {...props} busy={priceForecastPayload === undefined} minHeight=\"25vh\">\n {priceForecastPayload ?\n <Line options={options} data={data} />\n : null}\n </FlexCol>\n )\n}\n","import { alpha } from '@mui/material'\n\nexport const DataLineStyles = (color?: string) => ({\n backgroundColor: color ? alpha(color, 0.5) : undefined,\n borderColor: color,\n})\n","export const DataPointStyles = (pointHoverBackgroundColor?: string) => ({\n pointHitRadius: 20,\n pointHoverBackgroundColor,\n pointHoverRadius: 10,\n pointRadius: 5,\n pointStyle: 'circle',\n})\n","export const MockSourcePayloads = () => {\n const tenMin = 600_000\n return [\n {\n baseFee: 38.901_553_878_25,\n feePerGas: { high: 47.994_586_439_6, low: 39.006_868_093, medium: 39.306_868_093, veryHigh: 44.453_843_805_25 },\n priorityFeePerGas: { high: 1.026_666_666_666_666_6, low: -0.410_000_000_000_000_03, medium: 0.38, veryHigh: 1.390_000_000_000_000_1 },\n schema: 'network.xyo.blockchain.ethereum.gas',\n timestamp: Date.now() - tenMin,\n },\n {\n baseFee: 38.901_553_878_25,\n feePerGas: { high: 47.994_586_439_6, low: 39.006_868_093, medium: 100, veryHigh: 44.453_843_805_25 },\n priorityFeePerGas: { high: 1.026_666_666_666_666_6, low: -0.410_000_000_000_000_03, medium: 0.38, veryHigh: 1.390_000_000_000_000_1 },\n schema: 'network.xyo.blockchain.ethereum.gas',\n timestamp: Date.now(),\n },\n ]\n}\n","import { Payload } from '@xyo-network/payload-model'\nimport { Point } from 'chart.js'\n\nimport { MockSourcePayloads } from './MockSourcePayloads'\n\nexport class SourcePayloads {\n sourcePrices: Point[] = []\n\n constructor(public sourcePayloads: Payload[]) {}\n\n get payloads() {\n return this.sourcePayloads\n }\n\n static async build(jsonPath: string) {\n const sourcePayloads = await this.fetchSourcePayloads()\n const instance = new this(sourcePayloads)\n\n const paths = jsonPath.split('.')\n instance.sourcePrices = sourcePayloads.map((payload) => {\n return { x: payload.timestamp, y: instance.jsonPathTraverser(payload, paths) }\n })\n return instance\n }\n\n // TODO - fetch from archivist\n static async fetchSourcePayloads() {\n const payloads = await Promise.resolve(MockSourcePayloads())\n return payloads\n }\n\n jsonPathTraverser(obj: Payload, path: string[]) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let result: any = obj\n for (const key of path) {\n if (key in result) {\n const foundKey = key as keyof typeof result\n result = result[foundKey]\n } else {\n result = undefined\n break\n }\n }\n\n return result\n }\n}\n","import { Theme } from '@mui/material'\nimport { ForecastPayload } from '@xyo-network/diviner-forecasting-model'\nimport { ChartData, ChartDataset, ChartOptions, LegendOptions, Point, ScaleChartOptions } from 'chart.js'\n// eslint-disable-next-line import/no-unresolved\nimport { _DeepPartialObject } from 'chart.js/dist/types/utils'\n\nimport { DataLineStyles } from './DataLineStyles'\nimport { DataPointStyles } from './DataPointStyles'\nimport { SourcePayloads } from './SourcePayloads'\n\ninterface SourcePayloadConfig {\n fetch: boolean\n sampleSize?: number\n}\n\ninterface ThemeColors {\n dataSetColorPrimary: string\n dataSetColorSecondary: string\n gridColor: string\n}\n\nconst defaultOptions: () => ChartOptions<'line'> = () => ({\n plugins: {\n legend: {\n position: 'top' as const,\n },\n },\n responsive: true,\n})\n\nexport class ForecastLineChartConfigBuilder {\n data: ChartData<'line'> = {\n datasets: [],\n }\n options: ChartOptions<'line'> = defaultOptions()\n themeColors: ThemeColors | undefined\n\n constructor(\n theme: Theme,\n private payload?: ForecastPayload,\n ) {\n this.themeColors = this.parseTheme(theme)\n }\n\n get forecastPayload() {\n if (this.payload) {\n return this.payload\n } else {\n throw new Error('ForecastPayload was not defined')\n }\n }\n\n static async create(theme: Theme, payload?: ForecastPayload, sourcePayloadConfig?: SourcePayloadConfig) {\n const instance = new ForecastLineChartConfigBuilder(theme, payload)\n\n await instance.build(sourcePayloadConfig?.fetch)\n\n instance.refreshValues()\n\n return instance\n }\n\n async build(includeSources?: boolean) {\n this.buildOptions()\n await this.buildData(includeSources)\n return this\n }\n\n async buildData(includeSources?: boolean) {\n const forecastData = this.generateDataSetForecastData()\n\n const datasets: ChartDataset<'line'>[] = [forecastData]\n\n if (includeSources) {\n // build data from sources in forecastPayload\n const sourceData = await this.generateDataSetSourcePayloads()\n datasets.unshift(sourceData)\n\n // add last source point as first item in prediction to connect the lines\n const lastSourceDataItem = sourceData.data.at(-1) as Point\n forecastData.data.unshift(lastSourceDataItem)\n }\n\n this.data = {\n datasets,\n }\n\n return this\n }\n\n buildOptions() {\n if (this.options.plugins) {\n this.options.plugins.title = this.generateTitle()\n this.options.plugins.legend = this.generateLegend()\n }\n this.options.scales = this.generateScales()\n\n return this\n }\n\n refreshValues() {\n this.data = { ...this.data }\n this.options = { ...this.options }\n }\n\n protected generateLegend(): _DeepPartialObject<LegendOptions<'line'>> {\n return {\n labels: {\n pointStyle: 'circle',\n usePointStyle: true,\n },\n }\n }\n\n protected generateScales(): _DeepPartialObject<ScaleChartOptions<'line'>['scales']> {\n return {\n x: {\n grid: {\n color: this.themeColors?.gridColor,\n },\n time: {\n unit: 'minute',\n },\n type: 'time',\n },\n y: {\n grid: {\n color: this.themeColors?.gridColor,\n },\n },\n }\n }\n\n protected generateTitle() {\n return {\n display: true,\n text: `Gas Price Forecaster (GWEI over time from ${\n this.forecastPayload?.values[0].timestamp ? new Date(this.forecastPayload.values[0].timestamp).toLocaleDateString() : ''\n })`,\n }\n }\n\n protected parseTheme(theme: Theme) {\n const dark = theme.palette.mode === 'dark'\n return {\n dataSetColorPrimary: theme.palette.primary.light,\n dataSetColorSecondary: theme.palette.secondary.light,\n gridColor: dark ? theme.palette.grey[800] : theme.palette.grey[300],\n }\n }\n\n private generateDataSetForecastData(): ChartDataset<'line'> {\n return {\n borderDash: [5],\n borderDashOffset: 0.5,\n data: this.forecastPayload.values.map((price) => ({ x: price.timestamp ?? 0, y: price.value })),\n label: 'Forecast Price',\n ...DataPointStyles(this.themeColors?.dataSetColorPrimary),\n ...DataLineStyles(this.themeColors?.dataSetColorPrimary),\n }\n }\n\n private async generateDataSetSourcePayloads(): Promise<ChartDataset<'line'>> {\n const { sourcePrices } = await SourcePayloads.build('feePerGas.medium')\n return {\n data: sourcePrices,\n label: 'Source Prices',\n ...DataLineStyles(this.themeColors?.dataSetColorSecondary),\n ...DataPointStyles(this.themeColors?.dataSetColorSecondary),\n }\n }\n}\n","import { createPayloadRenderPlugin, PayloadRenderPlugin } from '@xyo-network/react-payload-plugin'\n\nimport { PriceForecastDetailsBox } from './components'\n\nexport const PriceForecastRenderPlugin: PayloadRenderPlugin = {\n ...createPayloadRenderPlugin({\n canRender: () => true,\n components: {\n box: {\n detailsBox: PriceForecastDetailsBox,\n },\n },\n name: 'PriceForecast',\n }),\n}\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,EAAA,8BAAAC,IAAA,eAAAC,EAAAJ,GCAA,IAAAK,EAAO,iCAEPC,EAAyB,yBACzBC,EAA+B,sCAC/BC,EAAsC,iCAGtCC,EAYO,oBACPC,EAAyB,iBACzBC,EAAqB,2BCrBrB,IAAAC,EAAsB,yBAETC,EAAkBC,IAAoB,CACjD,gBAAiBA,KAAQ,SAAMA,EAAO,EAAG,EAAI,OAC7C,YAAaA,CACf,GCLO,IAAMC,EAAmBC,IAAwC,CACtE,eAAgB,GAChB,0BAAAA,EACA,iBAAkB,GAClB,YAAa,EACb,WAAY,QACd,GCNO,IAAMC,EAAqB,IAEzB,CACL,CACE,QAAS,eACT,UAAW,CAAE,KAAM,cAAkB,IAAK,aAAgB,OAAQ,aAAgB,SAAU,cAAkB,EAC9G,kBAAmB,CAAE,KAAM,mBAAyB,IAAK,oBAA2B,OAAQ,IAAM,SAAU,kBAAwB,EACpI,OAAQ,sCACR,UAAW,KAAK,IAAI,EAAI,GAC1B,EACA,CACE,QAAS,eACT,UAAW,CAAE,KAAM,cAAkB,IAAK,aAAgB,OAAQ,IAAK,SAAU,cAAkB,EACnG,kBAAmB,CAAE,KAAM,mBAAyB,IAAK,oBAA2B,OAAQ,IAAM,SAAU,kBAAwB,EACpI,OAAQ,sCACR,UAAW,KAAK,IAAI,CACtB,CACF,ECZK,IAAMC,EAAN,KAAqB,CAG1B,YAAmBC,EAA2B,CAA3B,oBAAAA,CAA4B,CAF/C,aAAwB,CAAC,EAIzB,IAAI,UAAW,CACb,OAAO,KAAK,cACd,CAEA,aAAa,MAAMC,EAAkB,CACnC,IAAMD,EAAiB,MAAM,KA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ecastRenderPlugin","__toCommonJS","import_chartjs_adapter_luxon","import_material","import_react_async_effect","import_react_flexbox","import_chart","import_react","import_react_chartjs_2","import_material","DataLineStyles","color","DataPointStyles","pointHoverBackgroundColor","MockSourcePayloads","SourcePayloads","sourcePayloads","jsonPath","instance","paths","payload","MockSourcePayloads","obj","path","result","key","defaultOptions","ForecastLineChartConfigBuilder","_ForecastLineChartConfigBuilder","theme","payload","sourcePayloadConfig","instance","includeSources","forecastData","datasets","sourceData","lastSourceDataItem","dark","price","DataPointStyles","DataLineStyles","sourcePrices","SourcePayloads","import_jsx_runtime","ChartJS","PriceForecastDetailsBox","payload","props","priceForecastPayload","theme","data","setData","options","setOptions","mounted","ForecastLineChartConfigBuilder","import_react_payload_plugin","PriceForecastRenderPlugin","PriceForecastDetailsBox"]}
1
+ {"version":3,"sources":["../../src/index.ts","../../src/components/DetailsBox.tsx","../../src/lib/DataLineStyles.ts","../../src/lib/DataPointStyles.ts","../../src/lib/MockSourcePayloads.ts","../../src/lib/SourcePayloads.ts","../../src/lib/ForecastLineChartConfigBuilder.ts","../../src/Plugin.ts"],"sourcesContent":["export * from './components'\nexport * from './Plugin'\n","import 'chartjs-adapter-luxon'\n\nimport { useTheme } from '@mui/material'\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { FlexBoxProps, FlexCol } from '@xylabs/react-flexbox'\nimport { ForecastPayload } from '@xyo-network/diviner-forecasting-model'\nimport { Payload } from '@xyo-network/payload-model'\nimport {\n CategoryScale,\n Chart as ChartJS,\n ChartData,\n ChartOptions,\n Legend,\n LinearScale,\n LineElement,\n PointElement,\n TimeScale,\n Title,\n Tooltip,\n} from 'chart.js'\nimport { useState } from 'react'\nimport { Line } from 'react-chartjs-2'\n\nimport { ForecastLineChartConfigBuilder } from '../lib'\n\nChartJS.register(CategoryScale, TimeScale, PointElement, LineElement, LinearScale, Title, Tooltip, Legend)\n\nexport interface PriceForecastDetailsBoxProps extends FlexBoxProps {\n payload?: Payload\n}\n\nexport const PriceForecastDetailsBox: React.FC<PriceForecastDetailsBoxProps> = ({ payload, ...props }) => {\n const priceForecastPayload = payload as ForecastPayload | undefined\n const theme = useTheme()\n const [data, setData] = useState<ChartData<'line'>>({ datasets: [] })\n const [options, setOptions] = useState<ChartOptions<'line'>>({})\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n const { data, options } = await ForecastLineChartConfigBuilder.create(theme, priceForecastPayload, { fetch: true })\n if (mounted()) {\n setData(data)\n setOptions(options)\n }\n },\n [priceForecastPayload, theme],\n )\n\n return (\n <FlexCol {...props} busy={priceForecastPayload === undefined} minHeight=\"25vh\">\n {priceForecastPayload ?\n <Line options={options} data={data} />\n : null}\n </FlexCol>\n )\n}\n","import { alpha } from '@mui/material'\n\nexport const DataLineStyles = (color?: string) => ({\n backgroundColor: color ? alpha(color, 0.5) : undefined,\n borderColor: color,\n})\n","export const DataPointStyles = (pointHoverBackgroundColor?: string) => ({\n pointHitRadius: 20,\n pointHoverBackgroundColor,\n pointHoverRadius: 10,\n pointRadius: 5,\n pointStyle: 'circle',\n})\n","export const MockSourcePayloads = () => {\n const tenMin = 600_000\n return [\n {\n baseFee: 38.901_553_878_25,\n feePerGas: { high: 47.994_586_439_6, low: 39.006_868_093, medium: 39.306_868_093, veryHigh: 44.453_843_805_25 },\n priorityFeePerGas: { high: 1.026_666_666_666_666_6, low: -0.410_000_000_000_000_03, medium: 0.38, veryHigh: 1.390_000_000_000_000_1 },\n schema: 'network.xyo.blockchain.ethereum.gas',\n timestamp: Date.now() - tenMin,\n },\n {\n baseFee: 38.901_553_878_25,\n feePerGas: { high: 47.994_586_439_6, low: 39.006_868_093, medium: 100, veryHigh: 44.453_843_805_25 },\n priorityFeePerGas: { high: 1.026_666_666_666_666_6, low: -0.410_000_000_000_000_03, medium: 0.38, veryHigh: 1.390_000_000_000_000_1 },\n schema: 'network.xyo.blockchain.ethereum.gas',\n timestamp: Date.now(),\n },\n ]\n}\n","import { Payload } from '@xyo-network/payload-model'\nimport { Point } from 'chart.js'\n\nimport { MockSourcePayloads } from './MockSourcePayloads'\n\nexport class SourcePayloads {\n sourcePrices: Point[] = []\n\n constructor(public sourcePayloads: Payload[]) {}\n\n get payloads() {\n return this.sourcePayloads\n }\n\n static async build(jsonPath: string) {\n const sourcePayloads = await this.fetchSourcePayloads()\n const instance = new this(sourcePayloads)\n\n const paths = jsonPath.split('.')\n instance.sourcePrices = sourcePayloads.map((payload) => {\n return { x: payload.timestamp, y: instance.jsonPathTraverser(payload, paths) }\n })\n return instance\n }\n\n // TODO - fetch from archivist\n static async fetchSourcePayloads() {\n const payloads = await Promise.resolve(MockSourcePayloads())\n return payloads\n }\n\n jsonPathTraverser(obj: Payload, path: string[]) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let result: any = obj\n for (const key of path) {\n if (key in result) {\n const foundKey = key as keyof typeof result\n result = result[foundKey]\n } else {\n result = undefined\n break\n }\n }\n\n return result\n }\n}\n","import { Theme } from '@mui/material'\nimport { ForecastPayload } from '@xyo-network/diviner-forecasting-model'\nimport { ChartData, ChartDataset, ChartOptions, LegendOptions, Point, ScaleChartOptions } from 'chart.js'\n// eslint-disable-next-line import/no-unresolved\nimport { _DeepPartialObject } from 'chart.js/dist/types/utils'\n\nimport { DataLineStyles } from './DataLineStyles'\nimport { DataPointStyles } from './DataPointStyles'\nimport { SourcePayloads } from './SourcePayloads'\n\ninterface SourcePayloadConfig {\n fetch: boolean\n sampleSize?: number\n}\n\ninterface ThemeColors {\n dataSetColorPrimary: string\n dataSetColorSecondary: string\n gridColor: string\n}\n\nconst defaultOptions: () => ChartOptions<'line'> = () => ({\n plugins: {\n legend: {\n position: 'top' as const,\n },\n },\n responsive: true,\n})\n\nexport class ForecastLineChartConfigBuilder {\n data: ChartData<'line'> = {\n datasets: [],\n }\n options: ChartOptions<'line'> = defaultOptions()\n themeColors: ThemeColors | undefined\n\n constructor(\n theme: Theme,\n private payload?: ForecastPayload,\n ) {\n this.themeColors = this.parseTheme(theme)\n }\n\n get forecastPayload() {\n if (this.payload) {\n return this.payload\n } else {\n throw new Error('ForecastPayload was not defined')\n }\n }\n\n static async create(theme: Theme, payload?: ForecastPayload, sourcePayloadConfig?: SourcePayloadConfig) {\n const instance = new ForecastLineChartConfigBuilder(theme, payload)\n\n await instance.build(sourcePayloadConfig?.fetch)\n\n instance.refreshValues()\n\n return instance\n }\n\n async build(includeSources?: boolean) {\n this.buildOptions()\n await this.buildData(includeSources)\n return this\n }\n\n async buildData(includeSources?: boolean) {\n const forecastData = this.generateDataSetForecastData()\n\n const datasets: ChartDataset<'line'>[] = [forecastData]\n\n if (includeSources) {\n // build data from sources in forecastPayload\n const sourceData = await this.generateDataSetSourcePayloads()\n datasets.unshift(sourceData)\n\n // add last source point as first item in prediction to connect the lines\n const lastSourceDataItem = sourceData.data.at(-1) as Point\n forecastData.data.unshift(lastSourceDataItem)\n }\n\n this.data = {\n datasets,\n }\n\n return this\n }\n\n buildOptions() {\n if (this.options.plugins) {\n this.options.plugins.title = this.generateTitle()\n this.options.plugins.legend = this.generateLegend()\n }\n this.options.scales = this.generateScales()\n\n return this\n }\n\n refreshValues() {\n this.data = { ...this.data }\n this.options = { ...this.options }\n }\n\n protected generateLegend(): _DeepPartialObject<LegendOptions<'line'>> {\n return {\n labels: {\n pointStyle: 'circle',\n usePointStyle: true,\n },\n }\n }\n\n protected generateScales(): _DeepPartialObject<ScaleChartOptions<'line'>['scales']> {\n return {\n x: {\n grid: {\n color: this.themeColors?.gridColor,\n },\n time: {\n unit: 'minute',\n },\n type: 'time',\n },\n y: {\n grid: {\n color: this.themeColors?.gridColor,\n },\n },\n }\n }\n\n protected generateTitle() {\n return {\n display: true,\n text: `Gas Price Forecaster (GWEI over time from ${\n this.forecastPayload?.values[0].timestamp ? new Date(this.forecastPayload.values[0].timestamp).toLocaleDateString() : ''\n })`,\n }\n }\n\n protected parseTheme(theme: Theme) {\n const dark = theme.palette.mode === 'dark'\n return {\n dataSetColorPrimary: theme.palette.primary.light,\n dataSetColorSecondary: theme.palette.secondary.light,\n gridColor: dark ? theme.palette.grey[800] : theme.palette.grey[300],\n }\n }\n\n private generateDataSetForecastData(): ChartDataset<'line'> {\n return {\n borderDash: [5],\n borderDashOffset: 0.5,\n data: this.forecastPayload.values.map((price) => ({ x: price.timestamp ?? 0, y: price.value })),\n label: 'Forecast Price',\n ...DataPointStyles(this.themeColors?.dataSetColorPrimary),\n ...DataLineStyles(this.themeColors?.dataSetColorPrimary),\n }\n }\n\n private async generateDataSetSourcePayloads(): Promise<ChartDataset<'line'>> {\n const { sourcePrices } = await SourcePayloads.build('feePerGas.medium')\n return {\n data: sourcePrices,\n label: 'Source Prices',\n ...DataLineStyles(this.themeColors?.dataSetColorSecondary),\n ...DataPointStyles(this.themeColors?.dataSetColorSecondary),\n }\n }\n}\n","import { createPayloadRenderPlugin, PayloadRenderPlugin } from '@xyo-network/react-payload-plugin'\n\nimport { PriceForecastDetailsBox } from './components'\n\nexport const PriceForecastRenderPlugin: PayloadRenderPlugin = {\n ...createPayloadRenderPlugin({\n canRender: () => true,\n components: {\n box: {\n detailsBox: PriceForecastDetailsBox,\n },\n },\n name: 'PriceForecast',\n }),\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mCAAO;AAEP,IAAAA,mBAAyB;AACzB,gCAA+B;AAC/B,2BAAsC;AAGtC,mBAYO;AACP,mBAAyB;AACzB,6BAAqB;;;ACrBrB,sBAAsB;AAEf,IAAM,iBAAiB,CAAC,WAAoB;AAAA,EACjD,iBAAiB,YAAQ,uBAAM,OAAO,GAAG,IAAI;AAAA,EAC7C,aAAa;AACf;;;ACLO,IAAM,kBAAkB,CAAC,+BAAwC;AAAA,EACtE,gBAAgB;AAAA,EAChB;AAAA,EACA,kBAAkB;AAAA,EAClB,aAAa;AAAA,EACb,YAAY;AACd;;;ACNO,IAAM,qBAAqB,MAAM;AACtC,QAAM,SAAS;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C,MACJ;AAEJ;;;AMxDA,kCAA+D;AAIxD,IAAM,4BAAiD;AAAA,EAC5D,OAAG,uDAA0B;AAAA,IAC3B,WAAW,MAAM;AAAA,IACjB,YAAY;AAAA,MACV,KAAK;AAAA,QACH,YAAY;AAAA,MACd;AAAA,IACF;AAAA,IACA,MAAM;AAAA,EACR,CAAC;AACH;","names":["import_material","ChartJS","data","options"]}
@@ -1,2 +1,258 @@
1
- import"chartjs-adapter-luxon";import{useTheme as S}from"@mui/material";import{useAsyncEffect as D}from"@xylabs/react-async-effect";import{FlexCol as b}from"@xylabs/react-flexbox";import{CategoryScale as x,Chart as F,Legend as w,LinearScale as v,LineElement as O,PointElement as T,TimeScale as k,Title as L,Tooltip as R}from"chart.js";import{useState as p}from"react";import{Line as B}from"react-chartjs-2";import{alpha as _}from"@mui/material";var l=r=>({backgroundColor:r?_(r,.5):void 0,borderColor:r});var c=r=>({pointHitRadius:20,pointHoverBackgroundColor:r,pointHoverRadius:10,pointRadius:5,pointStyle:"circle"});var d=()=>[{baseFee:38.90155387825,feePerGas:{high:47.9945864396,low:39.006868093,medium:39.306868093,veryHigh:44.45384380525},priorityFeePerGas:{high:1.0266666666666666,low:-.41000000000000003,medium:.38,veryHigh:1.3900000000000001},schema:"network.xyo.blockchain.ethereum.gas",timestamp:Date.now()-6e5},{baseFee:38.90155387825,feePerGas:{high:47.9945864396,low:39.006868093,medium:100,veryHigh:44.45384380525},priorityFeePerGas:{high:1.0266666666666666,low:-.41000000000000003,medium:.38,veryHigh:1.3900000000000001},schema:"network.xyo.blockchain.ethereum.gas",timestamp:Date.now()}];var i=class{constructor(e){this.sourcePayloads=e}sourcePrices=[];get payloads(){return this.sourcePayloads}static async build(e){let t=await this.fetchSourcePayloads(),a=new this(t),o=e.split(".");return a.sourcePrices=t.map(s=>({x:s.timestamp,y:a.jsonPathTraverser(s,o)})),a}static async fetchSourcePayloads(){return await Promise.resolve(d())}jsonPathTraverser(e,t){let a=e;for(let o of t)if(o in a)a=a[o];else{a=void 0;break}return a}};var C=()=>({plugins:{legend:{position:"top"}},responsive:!0}),n=class r{constructor(e,t){this.payload=t;this.themeColors=this.parseTheme(e)}data={datasets:[]};options=C();themeColors;get forecastPayload(){if(this.payload)return this.payload;throw new Error("ForecastPayload was not defined")}static async create(e,t,a){let o=new r(e,t);return await o.build(a?.fetch),o.refreshValues(),o}async build(e){return this.buildOptions(),await this.buildData(e),this}async buildData(e){let t=this.generateDataSetForecastData(),a=[t];if(e){let o=await this.generateDataSetSourcePayloads();a.unshift(o);let s=o.data.at(-1);t.data.unshift(s)}return this.data={datasets:a},this}buildOptions(){return this.options.plugins&&(this.options.plugins.title=this.generateTitle(),this.options.plugins.legend=this.generateLegend()),this.options.scales=this.generateScales(),this}refreshValues(){this.data={...this.data},this.options={...this.options}}generateLegend(){return{labels:{pointStyle:"circle",usePointStyle:!0}}}generateScales(){return{x:{grid:{color:this.themeColors?.gridColor},time:{unit:"minute"},type:"time"},y:{grid:{color:this.themeColors?.gridColor}}}}generateTitle(){return{display:!0,text:`Gas Price Forecaster (GWEI over time from ${this.forecastPayload?.values[0].timestamp?new Date(this.forecastPayload.values[0].timestamp).toLocaleDateString():""})`}}parseTheme(e){let t=e.palette.mode==="dark";return{dataSetColorPrimary:e.palette.primary.light,dataSetColorSecondary:e.palette.secondary.light,gridColor:t?e.palette.grey[800]:e.palette.grey[300]}}generateDataSetForecastData(){return{borderDash:[5],borderDashOffset:.5,data:this.forecastPayload.values.map(e=>({x:e.timestamp??0,y:e.value})),label:"Forecast Price",...c(this.themeColors?.dataSetColorPrimary),...l(this.themeColors?.dataSetColorPrimary)}}async generateDataSetSourcePayloads(){let{sourcePrices:e}=await i.build("feePerGas.medium");return{data:e,label:"Source Prices",...l(this.themeColors?.dataSetColorSecondary),...c(this.themeColors?.dataSetColorSecondary)}}};import{jsx as m}from"react/jsx-runtime";F.register(x,k,T,O,v,L,R,w);var h=({payload:r,...e})=>{let t=r,a=S(),[o,s]=p({datasets:[]}),[u,y]=p({});return D(async P=>{let{data:f,options:g}=await n.create(a,t,{fetch:!0});P()&&(s(f),y(g))},[t,a]),m(b,{...e,busy:t===void 0,minHeight:"25vh",children:t?m(B,{options:u,data:o}):null})};import{createPayloadRenderPlugin as G}from"@xyo-network/react-payload-plugin";var ne={...G({canRender:()=>!0,components:{box:{detailsBox:h}},name:"PriceForecast"})};export{h as PriceForecastDetailsBox,ne as PriceForecastRenderPlugin};
1
+ // src/components/DetailsBox.tsx
2
+ import "chartjs-adapter-luxon";
3
+ import { useTheme } from "@mui/material";
4
+ import { useAsyncEffect } from "@xylabs/react-async-effect";
5
+ import { FlexCol } from "@xylabs/react-flexbox";
6
+ import {
7
+ CategoryScale,
8
+ Chart as ChartJS,
9
+ Legend,
10
+ LinearScale,
11
+ LineElement,
12
+ PointElement,
13
+ TimeScale,
14
+ Title,
15
+ Tooltip
16
+ } from "chart.js";
17
+ import { useState } from "react";
18
+ import { Line } from "react-chartjs-2";
19
+
20
+ // src/lib/DataLineStyles.ts
21
+ import { alpha } from "@mui/material";
22
+ var DataLineStyles = (color) => ({
23
+ backgroundColor: color ? alpha(color, 0.5) : void 0,
24
+ borderColor: color
25
+ });
26
+
27
+ // src/lib/DataPointStyles.ts
28
+ var DataPointStyles = (pointHoverBackgroundColor) => ({
29
+ pointHitRadius: 20,
30
+ pointHoverBackgroundColor,
31
+ pointHoverRadius: 10,
32
+ pointRadius: 5,
33
+ pointStyle: "circle"
34
+ });
35
+
36
+ // src/lib/MockSourcePayloads.ts
37
+ var MockSourcePayloads = () => {
38
+ const tenMin = 6e5;
39
+ return [
40
+ {
41
+ baseFee: 38.90155387825,
42
+ feePerGas: { high: 47.9945864396, low: 39.006868093, medium: 39.306868093, veryHigh: 44.45384380525 },
43
+ priorityFeePerGas: { high: 1.0266666666666666, low: -0.41000000000000003, medium: 0.38, veryHigh: 1.3900000000000001 },
44
+ schema: "network.xyo.blockchain.ethereum.gas",
45
+ timestamp: Date.now() - tenMin
46
+ },
47
+ {
48
+ baseFee: 38.90155387825,
49
+ feePerGas: { high: 47.9945864396, low: 39.006868093, medium: 100, veryHigh: 44.45384380525 },
50
+ priorityFeePerGas: { high: 1.0266666666666666, low: -0.41000000000000003, medium: 0.38, veryHigh: 1.3900000000000001 },
51
+ schema: "network.xyo.blockchain.ethereum.gas",
52
+ timestamp: Date.now()
53
+ }
54
+ ];
55
+ };
56
+
57
+ // src/lib/SourcePayloads.ts
58
+ var SourcePayloads = class {
59
+ constructor(sourcePayloads) {
60
+ this.sourcePayloads = sourcePayloads;
61
+ }
62
+ sourcePrices = [];
63
+ get payloads() {
64
+ return this.sourcePayloads;
65
+ }
66
+ static async build(jsonPath) {
67
+ const sourcePayloads = await this.fetchSourcePayloads();
68
+ const instance = new this(sourcePayloads);
69
+ const paths = jsonPath.split(".");
70
+ instance.sourcePrices = sourcePayloads.map((payload) => {
71
+ return { x: payload.timestamp, y: instance.jsonPathTraverser(payload, paths) };
72
+ });
73
+ return instance;
74
+ }
75
+ // TODO - fetch from archivist
76
+ static async fetchSourcePayloads() {
77
+ const payloads = await Promise.resolve(MockSourcePayloads());
78
+ return payloads;
79
+ }
80
+ jsonPathTraverser(obj, path) {
81
+ let result = obj;
82
+ for (const key of path) {
83
+ if (key in result) {
84
+ const foundKey = key;
85
+ result = result[foundKey];
86
+ } else {
87
+ result = void 0;
88
+ break;
89
+ }
90
+ }
91
+ return result;
92
+ }
93
+ };
94
+
95
+ // src/lib/ForecastLineChartConfigBuilder.ts
96
+ var defaultOptions = () => ({
97
+ plugins: {
98
+ legend: {
99
+ position: "top"
100
+ }
101
+ },
102
+ responsive: true
103
+ });
104
+ var ForecastLineChartConfigBuilder = class _ForecastLineChartConfigBuilder {
105
+ constructor(theme, payload) {
106
+ this.payload = payload;
107
+ this.themeColors = this.parseTheme(theme);
108
+ }
109
+ data = {
110
+ datasets: []
111
+ };
112
+ options = defaultOptions();
113
+ themeColors;
114
+ get forecastPayload() {
115
+ if (this.payload) {
116
+ return this.payload;
117
+ } else {
118
+ throw new Error("ForecastPayload was not defined");
119
+ }
120
+ }
121
+ static async create(theme, payload, sourcePayloadConfig) {
122
+ const instance = new _ForecastLineChartConfigBuilder(theme, payload);
123
+ await instance.build(sourcePayloadConfig?.fetch);
124
+ instance.refreshValues();
125
+ return instance;
126
+ }
127
+ async build(includeSources) {
128
+ this.buildOptions();
129
+ await this.buildData(includeSources);
130
+ return this;
131
+ }
132
+ async buildData(includeSources) {
133
+ const forecastData = this.generateDataSetForecastData();
134
+ const datasets = [forecastData];
135
+ if (includeSources) {
136
+ const sourceData = await this.generateDataSetSourcePayloads();
137
+ datasets.unshift(sourceData);
138
+ const lastSourceDataItem = sourceData.data.at(-1);
139
+ forecastData.data.unshift(lastSourceDataItem);
140
+ }
141
+ this.data = {
142
+ datasets
143
+ };
144
+ return this;
145
+ }
146
+ buildOptions() {
147
+ if (this.options.plugins) {
148
+ this.options.plugins.title = this.generateTitle();
149
+ this.options.plugins.legend = this.generateLegend();
150
+ }
151
+ this.options.scales = this.generateScales();
152
+ return this;
153
+ }
154
+ refreshValues() {
155
+ this.data = { ...this.data };
156
+ this.options = { ...this.options };
157
+ }
158
+ generateLegend() {
159
+ return {
160
+ labels: {
161
+ pointStyle: "circle",
162
+ usePointStyle: true
163
+ }
164
+ };
165
+ }
166
+ generateScales() {
167
+ return {
168
+ x: {
169
+ grid: {
170
+ color: this.themeColors?.gridColor
171
+ },
172
+ time: {
173
+ unit: "minute"
174
+ },
175
+ type: "time"
176
+ },
177
+ y: {
178
+ grid: {
179
+ color: this.themeColors?.gridColor
180
+ }
181
+ }
182
+ };
183
+ }
184
+ generateTitle() {
185
+ return {
186
+ display: true,
187
+ text: `Gas Price Forecaster (GWEI over time from ${this.forecastPayload?.values[0].timestamp ? new Date(this.forecastPayload.values[0].timestamp).toLocaleDateString() : ""})`
188
+ };
189
+ }
190
+ parseTheme(theme) {
191
+ const dark = theme.palette.mode === "dark";
192
+ return {
193
+ dataSetColorPrimary: theme.palette.primary.light,
194
+ dataSetColorSecondary: theme.palette.secondary.light,
195
+ gridColor: dark ? theme.palette.grey[800] : theme.palette.grey[300]
196
+ };
197
+ }
198
+ generateDataSetForecastData() {
199
+ return {
200
+ borderDash: [5],
201
+ borderDashOffset: 0.5,
202
+ data: this.forecastPayload.values.map((price) => ({ x: price.timestamp ?? 0, y: price.value })),
203
+ label: "Forecast Price",
204
+ ...DataPointStyles(this.themeColors?.dataSetColorPrimary),
205
+ ...DataLineStyles(this.themeColors?.dataSetColorPrimary)
206
+ };
207
+ }
208
+ async generateDataSetSourcePayloads() {
209
+ const { sourcePrices } = await SourcePayloads.build("feePerGas.medium");
210
+ return {
211
+ data: sourcePrices,
212
+ label: "Source Prices",
213
+ ...DataLineStyles(this.themeColors?.dataSetColorSecondary),
214
+ ...DataPointStyles(this.themeColors?.dataSetColorSecondary)
215
+ };
216
+ }
217
+ };
218
+
219
+ // src/components/DetailsBox.tsx
220
+ import { jsx } from "react/jsx-runtime";
221
+ ChartJS.register(CategoryScale, TimeScale, PointElement, LineElement, LinearScale, Title, Tooltip, Legend);
222
+ var PriceForecastDetailsBox = ({ payload, ...props }) => {
223
+ const priceForecastPayload = payload;
224
+ const theme = useTheme();
225
+ const [data, setData] = useState({ datasets: [] });
226
+ const [options, setOptions] = useState({});
227
+ useAsyncEffect(
228
+ // eslint-disable-next-line react-hooks/exhaustive-deps
229
+ async (mounted) => {
230
+ const { data: data2, options: options2 } = await ForecastLineChartConfigBuilder.create(theme, priceForecastPayload, { fetch: true });
231
+ if (mounted()) {
232
+ setData(data2);
233
+ setOptions(options2);
234
+ }
235
+ },
236
+ [priceForecastPayload, theme]
237
+ );
238
+ return /* @__PURE__ */ jsx(FlexCol, { ...props, busy: priceForecastPayload === void 0, minHeight: "25vh", children: priceForecastPayload ? /* @__PURE__ */ jsx(Line, { options, data }) : null });
239
+ };
240
+
241
+ // src/Plugin.ts
242
+ import { createPayloadRenderPlugin } from "@xyo-network/react-payload-plugin";
243
+ var PriceForecastRenderPlugin = {
244
+ ...createPayloadRenderPlugin({
245
+ canRender: () => true,
246
+ components: {
247
+ box: {
248
+ detailsBox: PriceForecastDetailsBox
249
+ }
250
+ },
251
+ name: "PriceForecast"
252
+ })
253
+ };
254
+ export {
255
+ PriceForecastDetailsBox,
256
+ PriceForecastRenderPlugin
257
+ };
2
258
  //# sourceMappingURL=index.js.map