@xyo-network/react-ethereum-gas-price-blocknative-plugin 3.0.1 → 3.0.3
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.
- package/dist/browser/Plugin.d.ts +3 -0
- package/dist/browser/Plugin.d.ts.map +1 -0
- package/dist/browser/components/Card/Card.d.ts +10 -0
- package/dist/browser/components/Card/Card.d.ts.map +1 -0
- package/dist/browser/components/Card/CardContent.d.ts +10 -0
- package/dist/browser/components/Card/CardContent.d.ts.map +1 -0
- package/dist/browser/components/Card/CardHeader.d.ts +8 -0
- package/dist/browser/components/Card/CardHeader.d.ts.map +1 -0
- package/dist/browser/components/Card/index.d.ts +4 -0
- package/dist/browser/components/Card/index.d.ts.map +1 -0
- package/dist/browser/components/Details/Box/BlocknativeGasPriceDetailsBox.d.ts +4 -0
- package/dist/browser/components/Details/Box/BlocknativeGasPriceDetailsBox.d.ts.map +1 -0
- package/dist/browser/components/Details/Box/index.d.ts +2 -0
- package/dist/browser/components/Details/Box/index.d.ts.map +1 -0
- package/dist/browser/components/Details/index.d.ts +2 -0
- package/dist/browser/components/Details/index.d.ts.map +1 -0
- package/dist/browser/components/hooks/index.d.ts +2 -0
- package/dist/browser/components/hooks/index.d.ts.map +1 -0
- package/dist/browser/components/hooks/useBlocknativeTransformer.d.ts +4 -0
- package/dist/browser/components/hooks/useBlocknativeTransformer.d.ts.map +1 -0
- package/dist/browser/components/index.d.ts +3 -0
- package/dist/browser/components/index.d.ts.map +1 -0
- package/dist/browser/components/lib/constants.d.ts +2 -0
- package/dist/browser/components/lib/constants.d.ts.map +1 -0
- package/dist/browser/components/lib/index.d.ts +2 -0
- package/dist/browser/components/lib/index.d.ts.map +1 -0
- package/dist/browser/index.d.ts +4 -34
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.mjs +44 -42
- package/dist/browser/index.mjs.map +1 -1
- package/package.json +55 -47
- package/src/Plugin.ts +8 -9
- package/src/components/Card/Card.stories.tsx +5 -7
- package/src/components/Card/Card.tsx +3 -2
- package/src/components/Card/CardContent.tsx +18 -5
- package/src/components/Card/CardHeader.tsx +3 -3
- package/src/components/Details/Box/BlocknativeGasPriceDetailsBox.stories.tsx +5 -7
- package/src/components/Details/Box/BlocknativeGasPriceDetailsBox.tsx +19 -7
- package/src/components/hooks/useBlocknativeTransformer.tsx +3 -2
- package/xy.config.ts +2 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../src/Plugin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAA;AAO5E,eAAO,MAAM,iCAAiC,EAAE,mBAa/C,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PayloadRenderProps } from '@xyo-network/react-payload-plugin';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export declare const BlocknativeGasPriceCard: React.ForwardRefExoticComponent<Omit<PayloadRenderProps<{
|
|
4
|
+
schema: string;
|
|
5
|
+
} & import("@xyo-network/payload-model").PayloadFields> & import("@mui/material").CardOwnProps & import("@mui/material/OverridableComponent.js").CommonProps & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
6
|
+
ref?: ((instance: HTMLDivElement | null) => void | React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | React.RefObject<HTMLDivElement> | null | undefined;
|
|
7
|
+
}, "className" | "style" | "classes" | "children" | "sx" | "elevation" | "square" | "variant" | "raised"> & {
|
|
8
|
+
component?: React.ElementType;
|
|
9
|
+
}, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
10
|
+
//# sourceMappingURL=Card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../../../src/components/Card/Card.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAA;AAC3E,OAAO,KAAqB,MAAM,OAAO,CAAA;AAKzC,eAAO,MAAM,uBAAuB;;;;;;gDAOlC,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PayloadRenderProps } from '@xyo-network/react-payload-plugin';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export declare const BlocknativeGasPriceCardContent: React.ForwardRefExoticComponent<Omit<PayloadRenderProps<{
|
|
4
|
+
schema: string;
|
|
5
|
+
} & import("@xyo-network/payload-model").PayloadFields> & import("@mui/material").CardContentOwnProps & import("@mui/material/OverridableComponent.js").CommonProps & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
6
|
+
ref?: ((instance: HTMLDivElement | null) => void | React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | React.RefObject<HTMLDivElement> | null | undefined;
|
|
7
|
+
}, "className" | "style" | "classes" | "children" | "sx"> & {
|
|
8
|
+
component?: React.ElementType;
|
|
9
|
+
}, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
10
|
+
//# sourceMappingURL=CardContent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CardContent.d.ts","sourceRoot":"","sources":["../../../../src/components/Card/CardContent.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAA;AAE3E,OAAO,KAAqB,MAAM,OAAO,CAAA;AAMzC,eAAO,MAAM,8BAA8B;;;;;;gDAmC1C,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PayloadRenderProps } from '@xyo-network/react-payload-plugin';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export declare const BlocknativeGasPriceCardHeader: React.ForwardRefExoticComponent<Omit<PayloadRenderProps<{
|
|
4
|
+
schema: string;
|
|
5
|
+
} & import("@xyo-network/payload-model").PayloadFields> & import("@mui/material").CardHeaderOwnProps<"span", "span"> & import("@mui/material/OverridableComponent.js").CommonProps & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
6
|
+
ref?: ((instance: HTMLDivElement | null) => void | React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | React.RefObject<HTMLDivElement> | null | undefined;
|
|
7
|
+
}, "className" | "style" | "classes" | "sx" | "title" | "action" | "avatar" | "disableTypography" | "subheader" | "subheaderTypographyProps" | "titleTypographyProps">, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
//# sourceMappingURL=CardHeader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CardHeader.d.ts","sourceRoot":"","sources":["../../../../src/components/Card/CardHeader.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAA;AAC3E,OAAO,KAAqB,MAAM,OAAO,CAAA;AAKzC,eAAO,MAAM,6BAA6B;;;;qNAIxC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Card/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,mBAAmB,CAAA;AACjC,cAAc,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { PayloadDetailsRenderProps } from '@xyo-network/react-payload-plugin';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export declare const BlocknativeGasPriceDetailsBox: React.ForwardRefExoticComponent<PayloadDetailsRenderProps & import("@xylabs/react-flexbox").BusyBoxProps & React.RefAttributes<HTMLDivElement>>;
|
|
4
|
+
//# sourceMappingURL=BlocknativeGasPriceDetailsBox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BlocknativeGasPriceDetailsBox.d.ts","sourceRoot":"","sources":["../../../../../src/components/Details/Box/BlocknativeGasPriceDetailsBox.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAA;AAElF,OAAO,KAAqB,MAAM,OAAO,CAAA;AAOzC,eAAO,MAAM,6BAA6B,iJA0CzC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/Details/Box/index.ts"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Details/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { EthereumGasBlocknativePayload } from '@xyo-network/blocknative-ethereum-gas-payload-plugin';
|
|
2
|
+
import type { GasPriceWitnessUIBasePayload } from '@xyo-network/react-gas-price';
|
|
3
|
+
export declare const useBlocknativeTransformer: (payload?: EthereumGasBlocknativePayload) => GasPriceWitnessUIBasePayload | undefined;
|
|
4
|
+
//# sourceMappingURL=useBlocknativeTransformer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBlocknativeTransformer.d.ts","sourceRoot":"","sources":["../../../../src/components/hooks/useBlocknativeTransformer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,sDAAsD,CAAA;AACzG,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,8BAA8B,CAAA;AAGhF,eAAO,MAAM,yBAAyB,aAAc,6BAA6B,KAAG,4BAA4B,GAAG,SA6BlH,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/components/lib/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,4BAA4B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA"}
|
package/dist/browser/index.d.ts
CHANGED
|
@@ -1,34 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import * as _xylabs_react_flexbox from '@xylabs/react-flexbox';
|
|
7
|
-
|
|
8
|
-
declare const BlocknativeGasPriceCard: React.ForwardRefExoticComponent<Omit<PayloadRenderProps<{
|
|
9
|
-
schema: string;
|
|
10
|
-
} & _xyo_network_payload_model.PayloadFields> & _mui_material.CardOwnProps & _mui_material_OverridableComponent_js.CommonProps & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
11
|
-
ref?: ((instance: HTMLDivElement | null) => void | React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | React.RefObject<HTMLDivElement> | null | undefined;
|
|
12
|
-
}, "className" | "style" | "classes" | "children" | "sx" | "elevation" | "square" | "variant" | "raised"> & {
|
|
13
|
-
component?: React.ElementType;
|
|
14
|
-
}, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
15
|
-
|
|
16
|
-
declare const BlocknativeGasPriceCardContent: React.ForwardRefExoticComponent<Omit<PayloadRenderProps<{
|
|
17
|
-
schema: string;
|
|
18
|
-
} & _xyo_network_payload_model.PayloadFields> & _mui_material.CardContentOwnProps & _mui_material_OverridableComponent_js.CommonProps & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
19
|
-
ref?: ((instance: HTMLDivElement | null) => void | React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | React.RefObject<HTMLDivElement> | null | undefined;
|
|
20
|
-
}, "className" | "style" | "classes" | "children" | "sx"> & {
|
|
21
|
-
component?: React.ElementType;
|
|
22
|
-
}, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
23
|
-
|
|
24
|
-
declare const BlocknativeGasPriceCardHeader: React.ForwardRefExoticComponent<Omit<PayloadRenderProps<{
|
|
25
|
-
schema: string;
|
|
26
|
-
} & _xyo_network_payload_model.PayloadFields> & _mui_material.CardHeaderOwnProps<"span", "span"> & _mui_material_OverridableComponent_js.CommonProps & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
27
|
-
ref?: ((instance: HTMLDivElement | null) => void | React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | React.RefObject<HTMLDivElement> | null | undefined;
|
|
28
|
-
}, "className" | "style" | "classes" | "sx" | "title" | "action" | "avatar" | "disableTypography" | "subheader" | "subheaderTypographyProps" | "titleTypographyProps">, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
29
|
-
|
|
30
|
-
declare const BlocknativeGasPriceDetailsBox: React.ForwardRefExoticComponent<PayloadDetailsRenderProps & _xylabs_react_flexbox.BusyBoxProps & React.RefAttributes<HTMLDivElement>>;
|
|
31
|
-
|
|
32
|
-
declare const EthereumGasPriceBlocknativePlugin: PayloadRenderPlugin;
|
|
33
|
-
|
|
34
|
-
export { BlocknativeGasPriceCard, BlocknativeGasPriceCardContent, BlocknativeGasPriceCardHeader, BlocknativeGasPriceDetailsBox, EthereumGasPriceBlocknativePlugin, EthereumGasPriceBlocknativePlugin as default };
|
|
1
|
+
export * from './components/index.ts';
|
|
2
|
+
export * from './Plugin.ts';
|
|
3
|
+
export { EthereumGasPriceBlocknativePlugin as default } from './Plugin.ts';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA;AACrC,cAAc,aAAa,CAAA;AAC3B,OAAO,EAAE,iCAAiC,IAAI,OAAO,EAAE,MAAM,aAAa,CAAA"}
|
package/dist/browser/index.mjs
CHANGED
|
@@ -130,49 +130,51 @@ import { GasFeeCard as GasFeeCard2, GasPriceWitnessHeaderBox, ToggleRawPayloadBo
|
|
|
130
130
|
import { PayloadDataMissing as PayloadDataMissing2 } from "@xyo-network/react-shared";
|
|
131
131
|
import React4, { forwardRef as forwardRef4 } from "react";
|
|
132
132
|
var isEmpty2 = /* @__PURE__ */ __name((obj) => Object.keys(obj ?? {}).length === 0, "isEmpty");
|
|
133
|
-
var BlocknativeGasPriceDetailsBox = /* @__PURE__ */ forwardRef4(
|
|
133
|
+
var BlocknativeGasPriceDetailsBox = /* @__PURE__ */ forwardRef4(({
|
|
134
134
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
135
|
+
payload,
|
|
136
|
+
listMode,
|
|
137
|
+
...props
|
|
138
|
+
}, ref) => {
|
|
139
|
+
const gasPricePayload = payload ? payload : void 0;
|
|
140
|
+
const parsedPayload = useBlocknativeTransformer(gasPricePayload);
|
|
141
|
+
return /* @__PURE__ */ React4.createElement(React4.Fragment, null, isEmpty2(gasPricePayload) || !gasPricePayload?.blockPrices?.length ? /* @__PURE__ */ React4.createElement(PayloadDataMissing2, {
|
|
142
|
+
alertBody: "Payload is missing valid gas fee data."
|
|
143
|
+
}) : /* @__PURE__ */ React4.createElement(FlexCol, {
|
|
144
|
+
alignItems: "start",
|
|
145
|
+
rowGap: 4,
|
|
146
|
+
...props,
|
|
147
|
+
ref
|
|
148
|
+
}, /* @__PURE__ */ React4.createElement(GasPriceWitnessHeaderBox, {
|
|
149
|
+
heading: RenderTitle,
|
|
150
|
+
parsedPayload
|
|
151
|
+
}), /* @__PURE__ */ React4.createElement(Grid2, {
|
|
152
|
+
container: true,
|
|
153
|
+
spacing: 3,
|
|
154
|
+
columns: {
|
|
155
|
+
lg: 15,
|
|
156
|
+
md: 15,
|
|
157
|
+
sm: 12,
|
|
158
|
+
xs: 12
|
|
159
|
+
}
|
|
160
|
+
}, parsedPayload && parsedPayload?.gasPrice?.map(({ price, priorityFee }) => /* @__PURE__ */ React4.createElement(Grid2, {
|
|
161
|
+
key: price?.label,
|
|
162
|
+
item: true,
|
|
163
|
+
xs: 12,
|
|
164
|
+
sm: 6,
|
|
165
|
+
md: 5,
|
|
166
|
+
lg: 3
|
|
167
|
+
}, /* @__PURE__ */ React4.createElement(GasFeeCard2, {
|
|
168
|
+
key: price?.label,
|
|
169
|
+
gasPrice: price?.value,
|
|
170
|
+
speed: price?.label,
|
|
171
|
+
priorityFee: priorityFee?.value,
|
|
172
|
+
priorityFeeLabel: priorityFee?.label
|
|
173
|
+
})))), /* @__PURE__ */ React4.createElement(ToggleRawPayloadBox2, {
|
|
174
|
+
gasPricePayload,
|
|
175
|
+
alignItems: "start"
|
|
176
|
+
})));
|
|
177
|
+
});
|
|
176
178
|
BlocknativeGasPriceDetailsBox.displayName = "BlocknativeGasPriceDetailsBox";
|
|
177
179
|
|
|
178
180
|
// src/Plugin.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/Card/Card.tsx","../../src/components/Card/CardContent.tsx","../../src/components/hooks/useBlocknativeTransformer.tsx","../../src/components/Card/CardHeader.tsx","../../src/components/lib/constants.ts","../../src/components/Details/Box/BlocknativeGasPriceDetailsBox.tsx","../../src/Plugin.ts"],"sourcesContent":["import { Card, CardProps } from '@mui/material'\nimport { PayloadRenderProps } from '@xyo-network/react-payload-plugin'\nimport React, { forwardRef } from 'react'\n\nimport { BlocknativeGasPriceCardContent } from './CardContent.tsx'\nimport { BlocknativeGasPriceCardHeader } from './CardHeader.tsx'\n\nexport const BlocknativeGasPriceCard = forwardRef<HTMLDivElement, PayloadRenderProps & CardProps>(({ payload, ...props }, ref) => {\n return (\n <Card ref={ref} {...props}>\n <BlocknativeGasPriceCardHeader payload={payload} />\n <BlocknativeGasPriceCardContent payload={payload} />\n </Card>\n )\n})\n\nBlocknativeGasPriceCard.displayName = 'BlocknativeGasPriceCard'\n","import { CardContent, CardContentProps, Grid } from '@mui/material'\nimport { EthereumGasBlocknativePayload } from '@xyo-network/blocknative-ethereum-gas-payload-plugin'\nimport { GasFeeCard, ToggleRawPayloadBox } from '@xyo-network/react-gas-price'\nimport { PayloadRenderProps } from '@xyo-network/react-payload-plugin'\nimport { PayloadDataMissing } from '@xyo-network/react-shared'\nimport React, { forwardRef } from 'react'\n\nimport { useBlocknativeTransformer } from '../hooks/index.ts'\n\nconst isEmpty = (obj?: object) => Object.keys(obj ?? {}).length === 0\n\nexport const BlocknativeGasPriceCardContent = forwardRef<HTMLDivElement, Omit<PayloadRenderProps & CardContentProps, 'ref'>>(\n ({ payload, ...props }, ref) => {\n const gasPricePayload = payload ? (payload as EthereumGasBlocknativePayload) : undefined\n const parsedPayload = useBlocknativeTransformer(gasPricePayload)\n\n if (isEmpty(gasPricePayload) || !gasPricePayload?.blockPrices?.length) {\n return <PayloadDataMissing alertBody=\"Payload is missing valid gas fee data.\" sx={{ m: 1 }} />\n }\n\n return (\n <CardContent ref={ref} sx={{ display: 'flex', flexDirection: 'column', rowGap: 4 }} {...props}>\n <Grid container spacing={3} columns={{ lg: 15, md: 15, sm: 12, xs: 12 }}>\n {parsedPayload\n && parsedPayload?.gasPrice?.map(({ price }) => (\n <Grid key={price?.label} item xs={12} sm={6} md={5} lg={3}>\n <GasFeeCard gasPrice={price?.value} speed={price?.label} speedPaperElevation={4} />\n </Grid>\n ))}\n </Grid>\n <ToggleRawPayloadBox gasPricePayload={gasPricePayload} alignItems=\"start\" pr={1} />\n </CardContent>\n )\n },\n)\n\nBlocknativeGasPriceCardContent.displayName = 'BlocknativeGasPriceCardContent'\n","import { EthereumGasBlocknativePayload } from '@xyo-network/blocknative-ethereum-gas-payload-plugin'\nimport { GasPriceWitnessUIBasePayload } from '@xyo-network/react-gas-price'\n\nexport const useBlocknativeTransformer = (payload?: EthereumGasBlocknativePayload): GasPriceWitnessUIBasePayload | undefined => {\n const blockPrices = payload?.blockPrices?.[0]\n if (blockPrices && blockPrices.estimatedPrices?.length) {\n const estimatedPrices = blockPrices?.estimatedPrices\n const gasPrice = estimatedPrices.map(price => ({\n price: {\n label: `Confidence - ${price.confidence}`,\n value: price.price,\n },\n priorityFee: {\n label: 'maxPriorityFeePerGas',\n value: price.maxPriorityFeePerGas,\n },\n }))\n\n return {\n baseFee: {\n label: 'baseFeePerGas',\n value: blockPrices.baseFeePerGas,\n },\n blockNumber: {\n label: 'blockNumber',\n value: blockPrices.blockNumber,\n },\n gasPrice,\n timestamp: payload.timestamp,\n website: 'https://docs.Blocknative.io/v5/api/providers/provider/#Provider-getFeeData',\n }\n }\n}\n","import { CardHeaderProps } from '@mui/material'\nimport { EthereumGasBlocknativePayload } from '@xyo-network/blocknative-ethereum-gas-payload-plugin'\nimport { GasPriceWitnessCardHeader } from '@xyo-network/react-gas-price'\nimport { PayloadRenderProps } from '@xyo-network/react-payload-plugin'\nimport React, { forwardRef } from 'react'\n\nimport { useBlocknativeTransformer } from '../hooks/index.ts'\nimport { RenderTitle } from '../lib/index.ts'\n\nexport const BlocknativeGasPriceCardHeader = forwardRef<HTMLDivElement, PayloadRenderProps & CardHeaderProps>(({ payload }, ref) => {\n const gasPricePayload = payload ? (payload as EthereumGasBlocknativePayload) : undefined\n const parsedPayload = useBlocknativeTransformer(gasPricePayload)\n return <GasPriceWitnessCardHeader title={RenderTitle} parsedPayload={parsedPayload} ref={ref} />\n})\n\nBlocknativeGasPriceCardHeader.displayName = 'BlocknativeGasPriceCardHeader'\n","export const RenderTitle = 'Blocknative Gas Tracker'\n","import { Grid } from '@mui/material'\nimport { FlexBoxProps, FlexCol } from '@xylabs/react-flexbox'\nimport { EthereumGasBlocknativePayload } from '@xyo-network/blocknative-ethereum-gas-payload-plugin'\nimport { GasFeeCard, GasPriceWitnessHeaderBox, ToggleRawPayloadBox } from '@xyo-network/react-gas-price'\nimport { PayloadDetailsRenderProps } from '@xyo-network/react-payload-plugin'\nimport { PayloadDataMissing } from '@xyo-network/react-shared'\nimport React, { forwardRef } from 'react'\n\nimport { useBlocknativeTransformer } from '../../hooks/index.ts'\nimport { RenderTitle } from '../../lib/index.ts'\n\nconst isEmpty = (obj?: object) => Object.keys(obj ?? {}).length === 0\n\nexport const BlocknativeGasPriceDetailsBox = forwardRef<HTMLDivElement, PayloadDetailsRenderProps & FlexBoxProps>(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n ({ payload, listMode, ...props }, ref) => {\n const gasPricePayload: EthereumGasBlocknativePayload | undefined = payload ? (payload as EthereumGasBlocknativePayload) : undefined\n const parsedPayload = useBlocknativeTransformer(gasPricePayload)\n\n return (\n <>\n {isEmpty(gasPricePayload) || !gasPricePayload?.blockPrices?.length\n ? <PayloadDataMissing alertBody=\"Payload is missing valid gas fee data.\" />\n : (\n <FlexCol alignItems=\"start\" rowGap={4} {...props} ref={ref}>\n <GasPriceWitnessHeaderBox heading={RenderTitle} parsedPayload={parsedPayload} />\n <Grid container spacing={3} columns={{ lg: 15, md: 15, sm: 12, xs: 12 }}>\n {parsedPayload\n && parsedPayload?.gasPrice?.map(({ price, priorityFee }) => (\n <Grid key={price?.label} item xs={12} sm={6} md={5} lg={3}>\n <GasFeeCard\n key={price?.label}\n gasPrice={price?.value}\n speed={price?.label}\n priorityFee={priorityFee?.value}\n priorityFeeLabel={priorityFee?.label}\n />\n </Grid>\n ))}\n </Grid>\n <ToggleRawPayloadBox gasPricePayload={gasPricePayload} alignItems=\"start\" />\n </FlexCol>\n )}\n </>\n )\n },\n)\n\nBlocknativeGasPriceDetailsBox.displayName = 'BlocknativeGasPriceDetailsBox'\n","import { EthereumGasBlocknativeSchema } from '@xyo-network/blocknative-ethereum-gas-payload-plugin'\nimport { Payload } from '@xyo-network/payload-model'\nimport { EthereumGasPriceAvatar } from '@xyo-network/react-gas-price'\nimport { createPayloadRenderPlugin, PayloadRenderPlugin } from '@xyo-network/react-payload-plugin'\n\nimport { BlocknativeGasPriceCardContent, BlocknativeGasPriceCardHeader, BlocknativeGasPriceDetailsBox } from './components/index.ts'\n\nexport const EthereumGasPriceBlocknativePlugin: PayloadRenderPlugin = {\n ...createPayloadRenderPlugin({\n canRender: (payload?: Payload) => payload?.schema === EthereumGasBlocknativeSchema,\n components: {\n avatar: {\n image: EthereumGasPriceAvatar,\n },\n box: {\n detailsBox: BlocknativeGasPriceDetailsBox,\n },\n card: {\n content: BlocknativeGasPriceCardContent,\n header: BlocknativeGasPriceCardHeader,\n },\n },\n name: 'Ethereum Gas Price Blocknative',\n }),\n}\n"],"mappings":";;;;AAAA,SAASA,YAAuB;AAEhC,OAAOC,UAASC,cAAAA,mBAAkB;;;ACFlC,SAASC,aAA+BC,YAAY;AAEpD,SAASC,YAAYC,2BAA2B;AAEhD,SAASC,0BAA0B;AACnC,OAAOC,SAASC,kBAAkB;;;ACF3B,IAAMC,4BAA4B,wBAACC,YAAAA;AACxC,QAAMC,cAAcD,SAASC,cAAc,CAAA;AAC3C,MAAIA,eAAeA,YAAYC,iBAAiBC,QAAQ;AACtD,UAAMD,kBAAkBD,aAAaC;AACrC,UAAME,WAAWF,gBAAgBG,IAAIC,CAAAA,WAAU;MAC7CA,OAAO;QACLC,OAAO,gBAAgBD,MAAME,UAAU;QACvCC,OAAOH,MAAMA;MACf;MACAI,aAAa;QACXH,OAAO;QACPE,OAAOH,MAAMK;MACf;IACF,EAAA;AAEA,WAAO;MACLC,SAAS;QACPL,OAAO;QACPE,OAAOR,YAAYY;MACrB;MACAC,aAAa;QACXP,OAAO;QACPE,OAAOR,YAAYa;MACrB;MACAV;MACAW,WAAWf,QAAQe;MACnBC,SAAS;IACX;EACF;AACF,GA7ByC;;;ADMzC,IAAMC,UAAU,wBAACC,QAAiBC,OAAOC,KAAKF,OAAO,CAAC,CAAA,EAAGG,WAAW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AAArB,OAAA,cAACU,OAAAA;MAAKY,KAAKF,OAAOG;MAAOC,MAAAA;MAAKP,IAAI;MAAID,IAAI;MAAGD,IAAI;MAAGD,IAAI;OACtD,gBAAAd,OAAA,cAACyB,aAAAA;MACCH,KAAKF,OAAOG;MACZL,UAAUE,OAAOM;MACjBC,OAAOP,OAAOG;MACdF,aAAaA,aAAaK;MAC1BE,kBAAkBP,aAAaE;WAKvC,gBAAAvB,OAAA,cAAC6B,sBAAAA;MAAoBjC;MAAkCS,YAAW;;EAKhF;AAAA;AAGFf,8BAA8BwC,cAAc;;;AChD5C,SAASC,oCAAoC;AAE7C,SAASC,8BAA8B;AACvC,SAASC,iCAAsD;AAIxD,IAAMC,oCAAyD;EACpE,GAAGC,0BAA0B;IAC3BC,WAAW,wBAACC,YAAsBA,SAASC,WAAWC,8BAA3C;IACXC,YAAY;MACVC,QAAQ;QACNC,OAAOC;MACT;MACAC,KAAK;QACHC,YAAYC;MACd;MACAC,MAAM;QACJC,SAASC;QACTC,QAAQC;MACV;IACF;IACAC,MAAM;EACR,CAAA;AACF;","names":["Card","React","forwardRef","CardContent","Grid","GasFeeCard","ToggleRawPayloadBox","PayloadDataMissing","React","forwardRef","useBlocknativeTransformer","payload","blockPrices","estimatedPrices","length","gasPrice","map","price","label","confidence","value","priorityFee","maxPriorityFeePerGas","baseFee","baseFeePerGas","blockNumber","timestamp","website","isEmpty","obj","Object","keys","length","BlocknativeGasPriceCardContent","forwardRef","payload","props","ref","gasPricePayload","undefined","parsedPayload","useBlocknativeTransformer","blockPrices","PayloadDataMissing","alertBody","sx","m","CardContent","display","flexDirection","rowGap","Grid","container","spacing","columns","lg","md","sm","xs","gasPrice","map","price","key","label","item","GasFeeCard","value","speed","speedPaperElevation","ToggleRawPayloadBox","alignItems","pr","displayName","GasPriceWitnessCardHeader","React","forwardRef","RenderTitle","BlocknativeGasPriceCardHeader","forwardRef","payload","ref","gasPricePayload","undefined","parsedPayload","useBlocknativeTransformer","React","GasPriceWitnessCardHeader","title","RenderTitle","displayName","BlocknativeGasPriceCard","forwardRef","payload","props","ref","React","Card","BlocknativeGasPriceCardHeader","BlocknativeGasPriceCardContent","displayName","Grid","FlexCol","GasFeeCard","GasPriceWitnessHeaderBox","ToggleRawPayloadBox","PayloadDataMissing","React","forwardRef","isEmpty","obj","Object","keys","length","BlocknativeGasPriceDetailsBox","forwardRef","payload","listMode","props","ref","gasPricePayload","undefined","parsedPayload","useBlocknativeTransformer","React","blockPrices","PayloadDataMissing","alertBody","FlexCol","alignItems","rowGap","GasPriceWitnessHeaderBox","heading","RenderTitle","Grid","container","spacing","columns","lg","md","sm","xs","gasPrice","map","price","priorityFee","key","label","item","GasFeeCard","value","speed","priorityFeeLabel","ToggleRawPayloadBox","displayName","EthereumGasBlocknativeSchema","EthereumGasPriceAvatar","createPayloadRenderPlugin","EthereumGasPriceBlocknativePlugin","createPayloadRenderPlugin","canRender","payload","schema","EthereumGasBlocknativeSchema","components","avatar","image","EthereumGasPriceAvatar","box","detailsBox","BlocknativeGasPriceDetailsBox","card","content","BlocknativeGasPriceCardContent","header","BlocknativeGasPriceCardHeader","name"]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/Card/Card.tsx","../../src/components/Card/CardContent.tsx","../../src/components/hooks/useBlocknativeTransformer.tsx","../../src/components/Card/CardHeader.tsx","../../src/components/lib/constants.ts","../../src/components/Details/Box/BlocknativeGasPriceDetailsBox.tsx","../../src/Plugin.ts"],"sourcesContent":["import type { CardProps } from '@mui/material'\nimport { Card } from '@mui/material'\nimport type { PayloadRenderProps } from '@xyo-network/react-payload-plugin'\nimport React, { forwardRef } from 'react'\n\nimport { BlocknativeGasPriceCardContent } from './CardContent.tsx'\nimport { BlocknativeGasPriceCardHeader } from './CardHeader.tsx'\n\nexport const BlocknativeGasPriceCard = forwardRef<HTMLDivElement, PayloadRenderProps & CardProps>(({ payload, ...props }, ref) => {\n return (\n <Card ref={ref} {...props}>\n <BlocknativeGasPriceCardHeader payload={payload} />\n <BlocknativeGasPriceCardContent payload={payload} />\n </Card>\n )\n})\n\nBlocknativeGasPriceCard.displayName = 'BlocknativeGasPriceCard'\n","import type { CardContentProps } from '@mui/material'\nimport { CardContent, Grid } from '@mui/material'\nimport type { EthereumGasBlocknativePayload } from '@xyo-network/blocknative-ethereum-gas-payload-plugin'\nimport { GasFeeCard, ToggleRawPayloadBox } from '@xyo-network/react-gas-price'\nimport type { PayloadRenderProps } from '@xyo-network/react-payload-plugin'\nimport { PayloadDataMissing } from '@xyo-network/react-shared'\nimport React, { forwardRef } from 'react'\n\nimport { useBlocknativeTransformer } from '../hooks/index.ts'\n\nconst isEmpty = (obj?: object) => Object.keys(obj ?? {}).length === 0\n\nexport const BlocknativeGasPriceCardContent = forwardRef<HTMLDivElement, Omit<PayloadRenderProps & CardContentProps, 'ref'>>(\n ({ payload, ...props }, ref) => {\n const gasPricePayload = payload ? (payload as EthereumGasBlocknativePayload) : undefined\n const parsedPayload = useBlocknativeTransformer(gasPricePayload)\n\n if (isEmpty(gasPricePayload) || !gasPricePayload?.blockPrices?.length) {\n return <PayloadDataMissing alertBody=\"Payload is missing valid gas fee data.\" sx={{ m: 1 }} />\n }\n\n return (\n <CardContent\n ref={ref}\n sx={{\n display: 'flex', flexDirection: 'column', rowGap: 4,\n }}\n {...props}\n >\n <Grid\n container\n spacing={3}\n columns={{\n lg: 15, md: 15, sm: 12, xs: 12,\n }}\n >\n {parsedPayload\n && parsedPayload?.gasPrice?.map(({ price }) => (\n <Grid key={price?.label} item xs={12} sm={6} md={5} lg={3}>\n <GasFeeCard gasPrice={price?.value} speed={price?.label} speedPaperElevation={4} />\n </Grid>\n ))}\n </Grid>\n <ToggleRawPayloadBox gasPricePayload={gasPricePayload} alignItems=\"start\" pr={1} />\n </CardContent>\n )\n },\n)\n\nBlocknativeGasPriceCardContent.displayName = 'BlocknativeGasPriceCardContent'\n","import type { EthereumGasBlocknativePayload } from '@xyo-network/blocknative-ethereum-gas-payload-plugin'\nimport type { GasPriceWitnessUIBasePayload } from '@xyo-network/react-gas-price'\n\n// eslint-disable-next-line @eslint-react/hooks-extra/ensure-custom-hooks-using-other-hooks\nexport const useBlocknativeTransformer = (payload?: EthereumGasBlocknativePayload): GasPriceWitnessUIBasePayload | undefined => {\n const blockPrices = payload?.blockPrices?.[0]\n if (blockPrices && blockPrices.estimatedPrices?.length) {\n const estimatedPrices = blockPrices?.estimatedPrices\n const gasPrice = estimatedPrices.map(price => ({\n price: {\n label: `Confidence - ${price.confidence}`,\n value: price.price,\n },\n priorityFee: {\n label: 'maxPriorityFeePerGas',\n value: price.maxPriorityFeePerGas,\n },\n }))\n\n return {\n baseFee: {\n label: 'baseFeePerGas',\n value: blockPrices.baseFeePerGas,\n },\n blockNumber: {\n label: 'blockNumber',\n value: blockPrices.blockNumber,\n },\n gasPrice,\n timestamp: payload.timestamp,\n website: 'https://docs.Blocknative.io/v5/api/providers/provider/#Provider-getFeeData',\n }\n }\n}\n","import type { CardHeaderProps } from '@mui/material'\nimport type { EthereumGasBlocknativePayload } from '@xyo-network/blocknative-ethereum-gas-payload-plugin'\nimport { GasPriceWitnessCardHeader } from '@xyo-network/react-gas-price'\nimport type { PayloadRenderProps } from '@xyo-network/react-payload-plugin'\nimport React, { forwardRef } from 'react'\n\nimport { useBlocknativeTransformer } from '../hooks/index.ts'\nimport { RenderTitle } from '../lib/index.ts'\n\nexport const BlocknativeGasPriceCardHeader = forwardRef<HTMLDivElement, PayloadRenderProps & CardHeaderProps>(({ payload }, ref) => {\n const gasPricePayload = payload ? (payload as EthereumGasBlocknativePayload) : undefined\n const parsedPayload = useBlocknativeTransformer(gasPricePayload)\n return <GasPriceWitnessCardHeader title={RenderTitle} parsedPayload={parsedPayload} ref={ref} />\n})\n\nBlocknativeGasPriceCardHeader.displayName = 'BlocknativeGasPriceCardHeader'\n","export const RenderTitle = 'Blocknative Gas Tracker'\n","import { Grid } from '@mui/material'\nimport type { FlexBoxProps } from '@xylabs/react-flexbox'\nimport { FlexCol } from '@xylabs/react-flexbox'\nimport type { EthereumGasBlocknativePayload } from '@xyo-network/blocknative-ethereum-gas-payload-plugin'\nimport {\n GasFeeCard, GasPriceWitnessHeaderBox, ToggleRawPayloadBox,\n} from '@xyo-network/react-gas-price'\nimport type { PayloadDetailsRenderProps } from '@xyo-network/react-payload-plugin'\nimport { PayloadDataMissing } from '@xyo-network/react-shared'\nimport React, { forwardRef } from 'react'\n\nimport { useBlocknativeTransformer } from '../../hooks/index.ts'\nimport { RenderTitle } from '../../lib/index.ts'\n\nconst isEmpty = (obj?: object) => Object.keys(obj ?? {}).length === 0\n\nexport const BlocknativeGasPriceDetailsBox = forwardRef<HTMLDivElement, PayloadDetailsRenderProps & FlexBoxProps>(\n\n ({\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n payload, listMode, ...props\n }, ref) => {\n const gasPricePayload: EthereumGasBlocknativePayload | undefined = payload ? (payload as EthereumGasBlocknativePayload) : undefined\n const parsedPayload = useBlocknativeTransformer(gasPricePayload)\n\n return (\n <>\n {isEmpty(gasPricePayload) || !gasPricePayload?.blockPrices?.length\n ? <PayloadDataMissing alertBody=\"Payload is missing valid gas fee data.\" />\n : (\n <FlexCol alignItems=\"start\" rowGap={4} {...props} ref={ref}>\n <GasPriceWitnessHeaderBox heading={RenderTitle} parsedPayload={parsedPayload} />\n <Grid\n container\n spacing={3}\n columns={{\n lg: 15, md: 15, sm: 12, xs: 12,\n }}\n >\n {parsedPayload\n && parsedPayload?.gasPrice?.map(({ price, priorityFee }) => (\n <Grid key={price?.label} item xs={12} sm={6} md={5} lg={3}>\n <GasFeeCard\n key={price?.label}\n gasPrice={price?.value}\n speed={price?.label}\n priorityFee={priorityFee?.value}\n priorityFeeLabel={priorityFee?.label}\n />\n </Grid>\n ))}\n </Grid>\n <ToggleRawPayloadBox gasPricePayload={gasPricePayload} alignItems=\"start\" />\n </FlexCol>\n )}\n </>\n )\n },\n)\n\nBlocknativeGasPriceDetailsBox.displayName = 'BlocknativeGasPriceDetailsBox'\n","import { EthereumGasBlocknativeSchema } from '@xyo-network/blocknative-ethereum-gas-payload-plugin'\nimport type { Payload } from '@xyo-network/payload-model'\nimport { EthereumGasPriceAvatar } from '@xyo-network/react-gas-price'\nimport type { PayloadRenderPlugin } from '@xyo-network/react-payload-plugin'\nimport { createPayloadRenderPlugin } from '@xyo-network/react-payload-plugin'\n\nimport {\n BlocknativeGasPriceCardContent, BlocknativeGasPriceCardHeader, BlocknativeGasPriceDetailsBox,\n} from './components/index.ts'\n\nexport const EthereumGasPriceBlocknativePlugin: PayloadRenderPlugin = {\n ...createPayloadRenderPlugin({\n canRender: (payload?: Payload) => payload?.schema === EthereumGasBlocknativeSchema,\n components: {\n avatar: { image: EthereumGasPriceAvatar },\n box: { detailsBox: BlocknativeGasPriceDetailsBox },\n card: {\n content: BlocknativeGasPriceCardContent,\n header: BlocknativeGasPriceCardHeader,\n },\n },\n name: 'Ethereum Gas Price Blocknative',\n }),\n}\n"],"mappings":";;;;AACA,SAASA,YAAY;AAErB,OAAOC,UAASC,cAAAA,mBAAkB;;;ACFlC,SAASC,aAAaC,YAAY;AAElC,SAASC,YAAYC,2BAA2B;AAEhD,SAASC,0BAA0B;AACnC,OAAOC,SAASC,kBAAkB;;;ACF3B,IAAMC,4BAA4B,wBAACC,YAAAA;AACxC,QAAMC,cAAcD,SAASC,cAAc,CAAA;AAC3C,MAAIA,eAAeA,YAAYC,iBAAiBC,QAAQ;AACtD,UAAMD,kBAAkBD,aAAaC;AACrC,UAAME,WAAWF,gBAAgBG,IAAIC,CAAAA,WAAU;MAC7CA,OAAO;QACLC,OAAO,gBAAgBD,MAAME,UAAU;QACvCC,OAAOH,MAAMA;MACf;MACAI,aAAa;QACXH,OAAO;QACPE,OAAOH,MAAMK;MACf;IACF,EAAA;AAEA,WAAO;MACLC,SAAS;QACPL,OAAO;QACPE,OAAOR,YAAYY;MACrB;MACAC,aAAa;QACXP,OAAO;QACPE,OAAOR,YAAYa;MACrB;MACAV;MACAW,WAAWf,QAAQe;MAC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,IAAI;MAAIC,IAAI;IAC9B;KAECnB,iBACEA,eAAeoB,UAAUC,IAAI,CAAC,EAAEC,OAAOC,YAAW,MACnD,gBAAArB,OAAA,cAACU,OAAAA;IAAKY,KAAKF,OAAOG;IAAOC,MAAAA;IAAKP,IAAI;IAAID,IAAI;IAAGD,IAAI;IAAGD,IAAI;KACtD,gBAAAd,OAAA,cAACyB,aAAAA;IACCH,KAAKF,OAAOG;IACZL,UAAUE,OAAOM;IACjBC,OAAOP,OAAOG;IACdF,aAAaA,aAAaK;IAC1BE,kBAAkBP,aAAaE;SAKvC,gBAAAvB,OAAA,cAAC6B,sBAAAA;IAAoBjC;IAAkCS,YAAW;;AAKhF,CAAA;AAGFf,8BAA8BwC,cAAc;;;AC5D5C,SAASC,oCAAoC;AAE7C,SAASC,8BAA8B;AAEvC,SAASC,iCAAiC;AAMnC,IAAMC,oCAAyD;EACpE,GAAGC,0BAA0B;IAC3BC,WAAW,wBAACC,YAAsBA,SAASC,WAAWC,8BAA3C;IACXC,YAAY;MACVC,QAAQ;QAAEC,OAAOC;MAAuB;MACxCC,KAAK;QAAEC,YAAYC;MAA8B;MACjDC,MAAM;QACJC,SAASC;QACTC,QAAQC;MACV;IACF;IACAC,MAAM;EACR,CAAA;AACF;","names":["Card","React","forwardRef","CardContent","Grid","GasFeeCard","ToggleRawPayloadBox","PayloadDataMissing","React","forwardRef","useBlocknativeTransformer","payload","blockPrices","estimatedPrices","length","gasPrice","map","price","label","confidence","value","priorityFee","maxPriorityFeePerGas","baseFee","baseFeePerGas","blockNumber","timestamp","website","isEmpty","obj","Object","keys","length","BlocknativeGasPriceCardContent","forwardRef","payload","props","ref","gasPricePayload","undefined","parsedPayload","useBlocknativeTransformer","blockPrices","PayloadDataMissing","alertBody","sx","m","CardContent","display","flexDirection","rowGap","Grid","container","spacing","columns","lg","md","sm","xs","gasPrice","map","price","key","label","item","GasFeeCard","value","speed","speedPaperElevation","ToggleRawPayloadBox","alignItems","pr","displayName","GasPriceWitnessCardHeader","React","forwardRef","RenderTitle","BlocknativeGasPriceCardHeader","forwardRef","payload","ref","gasPricePayload","undefined","parsedPayload","useBlocknativeTransformer","React","GasPriceWitnessCardHeader","title","RenderTitle","displayName","BlocknativeGasPriceCard","forwardRef","payload","props","ref","React","Card","BlocknativeGasPriceCardHeader","BlocknativeGasPriceCardContent","displayName","Grid","FlexCol","GasFeeCard","GasPriceWitnessHeaderBox","ToggleRawPayloadBox","PayloadDataMissing","React","forwardRef","isEmpty","obj","Object","keys","length","BlocknativeGasPriceDetailsBox","forwardRef","payload","listMode","props","ref","gasPricePayload","undefined","parsedPayload","useBlocknativeTransformer","React","blockPrices","PayloadDataMissing","alertBody","FlexCol","alignItems","rowGap","GasPriceWitnessHeaderBox","heading","RenderTitle","Grid","container","spacing","columns","lg","md","sm","xs","gasPrice","map","price","priorityFee","key","label","item","GasFeeCard","value","speed","priorityFeeLabel","ToggleRawPayloadBox","displayName","EthereumGasBlocknativeSchema","EthereumGasPriceAvatar","createPayloadRenderPlugin","EthereumGasPriceBlocknativePlugin","createPayloadRenderPlugin","canRender","payload","schema","EthereumGasBlocknativeSchema","components","avatar","image","EthereumGasPriceAvatar","box","detailsBox","BlocknativeGasPriceDetailsBox","card","content","BlocknativeGasPriceCardContent","header","BlocknativeGasPriceCardHeader","name"]}
|
package/package.json
CHANGED
|
@@ -1,27 +1,68 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/react-ethereum-gas-price-blocknative-plugin",
|
|
3
|
+
"version": "3.0.3",
|
|
4
|
+
"description": "Common React library for all XYO projects that use React",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"xyo",
|
|
7
|
+
"utility",
|
|
8
|
+
"typescript",
|
|
9
|
+
"react"
|
|
10
|
+
],
|
|
11
|
+
"homepage": "https://xyo.network",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "git+https://github.com/XYOracleNetwork/sdk-xyo-react-js/issues",
|
|
14
|
+
"email": "support@xyo.network"
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/XYOracleNetwork/sdk-xyo-react-js.git"
|
|
19
|
+
},
|
|
20
|
+
"license": "LGPL-3.0-only",
|
|
3
21
|
"author": {
|
|
4
|
-
"email": "support@xyo.network",
|
|
5
22
|
"name": "XYO Development Team",
|
|
23
|
+
"email": "support@xyo.network",
|
|
6
24
|
"url": "https://xyo.network"
|
|
7
25
|
},
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
26
|
+
"sideEffects": false,
|
|
27
|
+
"type": "module",
|
|
28
|
+
"exports": {
|
|
29
|
+
".": {
|
|
30
|
+
"import": {
|
|
31
|
+
"types": "./dist/browser/index.d.ts",
|
|
32
|
+
"default": "./dist/browser/index.mjs"
|
|
33
|
+
},
|
|
34
|
+
"types": "./dist/browser/index.d.ts",
|
|
35
|
+
"default": "./dist/browser/index.mjs"
|
|
36
|
+
},
|
|
37
|
+
"./package.json": "./package.json"
|
|
38
|
+
},
|
|
39
|
+
"module": "dist/browser/index.mjs",
|
|
40
|
+
"types": "dist/browser/index.d.ts",
|
|
41
|
+
"scripts": {
|
|
42
|
+
"license": "yarn license-checker --exclude \"MIT, ISC, Apache-2.0, BSD, BSD-2-Clause, CC-BY-4.0, Unlicense, CC-BY-3.0, CC0-1.0\"",
|
|
43
|
+
"lint-pkg": "npmPkgJsonLint ."
|
|
11
44
|
},
|
|
12
45
|
"dependencies": {
|
|
13
|
-
"@xylabs/react-flexbox": "^4.0.
|
|
14
|
-
"@xyo-network/blocknative-ethereum-gas-payload-plugin": "^3.0.
|
|
15
|
-
"@xyo-network/payload-model": "^3.0.
|
|
16
|
-
"@xyo-network/react-gas-price": "^3.0.
|
|
17
|
-
"@xyo-network/react-payload-plugin": "^3.0.
|
|
18
|
-
"@xyo-network/react-shared": "^3.0.
|
|
46
|
+
"@xylabs/react-flexbox": "^4.0.3",
|
|
47
|
+
"@xyo-network/blocknative-ethereum-gas-payload-plugin": "^3.0.7",
|
|
48
|
+
"@xyo-network/payload-model": "^3.0.15",
|
|
49
|
+
"@xyo-network/react-gas-price": "^3.0.3",
|
|
50
|
+
"@xyo-network/react-payload-plugin": "^3.0.3",
|
|
51
|
+
"@xyo-network/react-shared": "^3.0.3"
|
|
19
52
|
},
|
|
20
53
|
"devDependencies": {
|
|
54
|
+
"@emotion/react": "^11.13.3",
|
|
55
|
+
"@emotion/styled": "^11.13.0",
|
|
56
|
+
"@mui/icons-material": "^5.16.7",
|
|
57
|
+
"@mui/material": "^5.16.7",
|
|
58
|
+
"@mui/styles": "^5.16.7",
|
|
21
59
|
"@storybook/react": "^8.2.9",
|
|
22
|
-
"@xylabs/ts-scripts-yarn3": "^4.0.
|
|
23
|
-
"@xylabs/tsconfig-react": "^4.0.
|
|
24
|
-
"@xyo-network/react-storybook": "^3.0.
|
|
60
|
+
"@xylabs/ts-scripts-yarn3": "^4.0.7",
|
|
61
|
+
"@xylabs/tsconfig-react": "^4.0.7",
|
|
62
|
+
"@xyo-network/react-storybook": "^3.0.3",
|
|
63
|
+
"react": "^18.3.1",
|
|
64
|
+
"react-dom": "^18.3.1",
|
|
65
|
+
"storybook": "^8.2.9",
|
|
25
66
|
"typescript": "^5.5.4"
|
|
26
67
|
},
|
|
27
68
|
"peerDependencies": {
|
|
@@ -33,41 +74,8 @@
|
|
|
33
74
|
"react": "^18",
|
|
34
75
|
"react-dom": "^18"
|
|
35
76
|
},
|
|
36
|
-
"description": "Common React library for all XYO projects that use React",
|
|
37
|
-
"docs": "dist/docs.json",
|
|
38
|
-
"exports": {
|
|
39
|
-
".": {
|
|
40
|
-
"import": {
|
|
41
|
-
"types": "./dist/browser/index.d.ts",
|
|
42
|
-
"default": "./dist/browser/index.mjs"
|
|
43
|
-
},
|
|
44
|
-
"types": "./dist/browser/index.d.ts",
|
|
45
|
-
"default": "./dist/browser/index.mjs"
|
|
46
|
-
},
|
|
47
|
-
"./package.json": "./package.json"
|
|
48
|
-
},
|
|
49
|
-
"module": "dist/browser/index.mjs",
|
|
50
|
-
"homepage": "https://xyo.network",
|
|
51
|
-
"keywords": [
|
|
52
|
-
"xyo",
|
|
53
|
-
"utility",
|
|
54
|
-
"typescript",
|
|
55
|
-
"react"
|
|
56
|
-
],
|
|
57
|
-
"license": "LGPL-3.0-only",
|
|
58
77
|
"publishConfig": {
|
|
59
78
|
"access": "public"
|
|
60
79
|
},
|
|
61
|
-
"
|
|
62
|
-
"type": "git",
|
|
63
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js.git"
|
|
64
|
-
},
|
|
65
|
-
"scripts": {
|
|
66
|
-
"lint-pkg": "npmPkgJsonLint .",
|
|
67
|
-
"license": "yarn license-checker --exclude \"MIT, ISC, Apache-2.0, BSD, BSD-2-Clause, CC-BY-4.0, Unlicense, CC-BY-3.0, CC0-1.0\""
|
|
68
|
-
},
|
|
69
|
-
"sideEffects": false,
|
|
70
|
-
"types": "dist/browser/index.d.ts",
|
|
71
|
-
"version": "3.0.1",
|
|
72
|
-
"type": "module"
|
|
80
|
+
"docs": "dist/docs.json"
|
|
73
81
|
}
|
package/src/Plugin.ts
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
import { EthereumGasBlocknativeSchema } from '@xyo-network/blocknative-ethereum-gas-payload-plugin'
|
|
2
|
-
import { Payload } from '@xyo-network/payload-model'
|
|
2
|
+
import type { Payload } from '@xyo-network/payload-model'
|
|
3
3
|
import { EthereumGasPriceAvatar } from '@xyo-network/react-gas-price'
|
|
4
|
-
import {
|
|
4
|
+
import type { PayloadRenderPlugin } from '@xyo-network/react-payload-plugin'
|
|
5
|
+
import { createPayloadRenderPlugin } from '@xyo-network/react-payload-plugin'
|
|
5
6
|
|
|
6
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
BlocknativeGasPriceCardContent, BlocknativeGasPriceCardHeader, BlocknativeGasPriceDetailsBox,
|
|
9
|
+
} from './components/index.ts'
|
|
7
10
|
|
|
8
11
|
export const EthereumGasPriceBlocknativePlugin: PayloadRenderPlugin = {
|
|
9
12
|
...createPayloadRenderPlugin({
|
|
10
13
|
canRender: (payload?: Payload) => payload?.schema === EthereumGasBlocknativeSchema,
|
|
11
14
|
components: {
|
|
12
|
-
avatar: {
|
|
13
|
-
|
|
14
|
-
},
|
|
15
|
-
box: {
|
|
16
|
-
detailsBox: BlocknativeGasPriceDetailsBox,
|
|
17
|
-
},
|
|
15
|
+
avatar: { image: EthereumGasPriceAvatar },
|
|
16
|
+
box: { detailsBox: BlocknativeGasPriceDetailsBox },
|
|
18
17
|
card: {
|
|
19
18
|
content: BlocknativeGasPriceCardContent,
|
|
20
19
|
header: BlocknativeGasPriceCardHeader,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Meta, StoryFn } from '@storybook/react'
|
|
1
|
+
import type { Meta, StoryFn } from '@storybook/react'
|
|
2
2
|
import { EthereumGasBlocknativeSchema } from '@xyo-network/blocknative-ethereum-gas-payload-plugin'
|
|
3
3
|
import { sampleBlocknativeGasPricePayload } from '@xyo-network/react-storybook'
|
|
4
4
|
import React from 'react'
|
|
@@ -8,11 +8,7 @@ import { BlocknativeGasPriceCard } from './Card.tsx'
|
|
|
8
8
|
const StorybookEntry = {
|
|
9
9
|
argTypes: {},
|
|
10
10
|
component: BlocknativeGasPriceCard,
|
|
11
|
-
parameters: {
|
|
12
|
-
docs: {
|
|
13
|
-
page: null,
|
|
14
|
-
},
|
|
15
|
-
},
|
|
11
|
+
parameters: { docs: { page: null } },
|
|
16
12
|
title: 'plugin/blockchain/BlocknativeGasPrice/Card',
|
|
17
13
|
} as Meta<typeof BlocknativeGasPriceCard>
|
|
18
14
|
|
|
@@ -27,6 +23,8 @@ WithData.args = { payload: sampleBlocknativeGasPricePayload }
|
|
|
27
23
|
const WithMissingData = Template.bind({})
|
|
28
24
|
WithMissingData.args = { payload: { schema: EthereumGasBlocknativeSchema } }
|
|
29
25
|
|
|
30
|
-
export {
|
|
26
|
+
export {
|
|
27
|
+
Default, WithData, WithMissingData,
|
|
28
|
+
}
|
|
31
29
|
|
|
32
30
|
export default StorybookEntry
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { CardProps } from '@mui/material'
|
|
2
|
+
import { Card } from '@mui/material'
|
|
3
|
+
import type { PayloadRenderProps } from '@xyo-network/react-payload-plugin'
|
|
3
4
|
import React, { forwardRef } from 'react'
|
|
4
5
|
|
|
5
6
|
import { BlocknativeGasPriceCardContent } from './CardContent.tsx'
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { CardContentProps } from '@mui/material'
|
|
2
|
+
import { CardContent, Grid } from '@mui/material'
|
|
3
|
+
import type { EthereumGasBlocknativePayload } from '@xyo-network/blocknative-ethereum-gas-payload-plugin'
|
|
3
4
|
import { GasFeeCard, ToggleRawPayloadBox } from '@xyo-network/react-gas-price'
|
|
4
|
-
import { PayloadRenderProps } from '@xyo-network/react-payload-plugin'
|
|
5
|
+
import type { PayloadRenderProps } from '@xyo-network/react-payload-plugin'
|
|
5
6
|
import { PayloadDataMissing } from '@xyo-network/react-shared'
|
|
6
7
|
import React, { forwardRef } from 'react'
|
|
7
8
|
|
|
@@ -19,8 +20,20 @@ export const BlocknativeGasPriceCardContent = forwardRef<HTMLDivElement, Omit<Pa
|
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
return (
|
|
22
|
-
<CardContent
|
|
23
|
-
|
|
23
|
+
<CardContent
|
|
24
|
+
ref={ref}
|
|
25
|
+
sx={{
|
|
26
|
+
display: 'flex', flexDirection: 'column', rowGap: 4,
|
|
27
|
+
}}
|
|
28
|
+
{...props}
|
|
29
|
+
>
|
|
30
|
+
<Grid
|
|
31
|
+
container
|
|
32
|
+
spacing={3}
|
|
33
|
+
columns={{
|
|
34
|
+
lg: 15, md: 15, sm: 12, xs: 12,
|
|
35
|
+
}}
|
|
36
|
+
>
|
|
24
37
|
{parsedPayload
|
|
25
38
|
&& parsedPayload?.gasPrice?.map(({ price }) => (
|
|
26
39
|
<Grid key={price?.label} item xs={12} sm={6} md={5} lg={3}>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { CardHeaderProps } from '@mui/material'
|
|
2
|
-
import { EthereumGasBlocknativePayload } from '@xyo-network/blocknative-ethereum-gas-payload-plugin'
|
|
1
|
+
import type { CardHeaderProps } from '@mui/material'
|
|
2
|
+
import type { EthereumGasBlocknativePayload } from '@xyo-network/blocknative-ethereum-gas-payload-plugin'
|
|
3
3
|
import { GasPriceWitnessCardHeader } from '@xyo-network/react-gas-price'
|
|
4
|
-
import { PayloadRenderProps } from '@xyo-network/react-payload-plugin'
|
|
4
|
+
import type { PayloadRenderProps } from '@xyo-network/react-payload-plugin'
|
|
5
5
|
import React, { forwardRef } from 'react'
|
|
6
6
|
|
|
7
7
|
import { useBlocknativeTransformer } from '../hooks/index.ts'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Meta, StoryFn } from '@storybook/react'
|
|
1
|
+
import type { Meta, StoryFn } from '@storybook/react'
|
|
2
2
|
import { EthereumGasBlocknativeSchema } from '@xyo-network/blocknative-ethereum-gas-payload-plugin'
|
|
3
3
|
import { sampleBlocknativeGasPricePayload } from '@xyo-network/react-storybook'
|
|
4
4
|
import React from 'react'
|
|
@@ -8,11 +8,7 @@ import { BlocknativeGasPriceDetailsBox } from './BlocknativeGasPriceDetailsBox.t
|
|
|
8
8
|
const StorybookEntry = {
|
|
9
9
|
argTypes: {},
|
|
10
10
|
component: BlocknativeGasPriceDetailsBox,
|
|
11
|
-
parameters: {
|
|
12
|
-
docs: {
|
|
13
|
-
page: null,
|
|
14
|
-
},
|
|
15
|
-
},
|
|
11
|
+
parameters: { docs: { page: null } },
|
|
16
12
|
title: 'plugin/blockchain/BlocknativeGasPrice/DetailsBox',
|
|
17
13
|
} as Meta<typeof BlocknativeGasPriceDetailsBox>
|
|
18
14
|
|
|
@@ -27,6 +23,8 @@ WithData.args = { payload: sampleBlocknativeGasPricePayload }
|
|
|
27
23
|
const WithMissingData = Template.bind({})
|
|
28
24
|
WithMissingData.args = { payload: { schema: EthereumGasBlocknativeSchema } }
|
|
29
25
|
|
|
30
|
-
export {
|
|
26
|
+
export {
|
|
27
|
+
Default, WithData, WithMissingData,
|
|
28
|
+
}
|
|
31
29
|
|
|
32
30
|
export default StorybookEntry
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { Grid } from '@mui/material'
|
|
2
|
-
import { FlexBoxProps
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import type { FlexBoxProps } from '@xylabs/react-flexbox'
|
|
3
|
+
import { FlexCol } from '@xylabs/react-flexbox'
|
|
4
|
+
import type { EthereumGasBlocknativePayload } from '@xyo-network/blocknative-ethereum-gas-payload-plugin'
|
|
5
|
+
import {
|
|
6
|
+
GasFeeCard, GasPriceWitnessHeaderBox, ToggleRawPayloadBox,
|
|
7
|
+
} from '@xyo-network/react-gas-price'
|
|
8
|
+
import type { PayloadDetailsRenderProps } from '@xyo-network/react-payload-plugin'
|
|
6
9
|
import { PayloadDataMissing } from '@xyo-network/react-shared'
|
|
7
10
|
import React, { forwardRef } from 'react'
|
|
8
11
|
|
|
@@ -12,8 +15,11 @@ import { RenderTitle } from '../../lib/index.ts'
|
|
|
12
15
|
const isEmpty = (obj?: object) => Object.keys(obj ?? {}).length === 0
|
|
13
16
|
|
|
14
17
|
export const BlocknativeGasPriceDetailsBox = forwardRef<HTMLDivElement, PayloadDetailsRenderProps & FlexBoxProps>(
|
|
15
|
-
|
|
16
|
-
({
|
|
18
|
+
|
|
19
|
+
({
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
21
|
+
payload, listMode, ...props
|
|
22
|
+
}, ref) => {
|
|
17
23
|
const gasPricePayload: EthereumGasBlocknativePayload | undefined = payload ? (payload as EthereumGasBlocknativePayload) : undefined
|
|
18
24
|
const parsedPayload = useBlocknativeTransformer(gasPricePayload)
|
|
19
25
|
|
|
@@ -24,7 +30,13 @@ export const BlocknativeGasPriceDetailsBox = forwardRef<HTMLDivElement, PayloadD
|
|
|
24
30
|
: (
|
|
25
31
|
<FlexCol alignItems="start" rowGap={4} {...props} ref={ref}>
|
|
26
32
|
<GasPriceWitnessHeaderBox heading={RenderTitle} parsedPayload={parsedPayload} />
|
|
27
|
-
<Grid
|
|
33
|
+
<Grid
|
|
34
|
+
container
|
|
35
|
+
spacing={3}
|
|
36
|
+
columns={{
|
|
37
|
+
lg: 15, md: 15, sm: 12, xs: 12,
|
|
38
|
+
}}
|
|
39
|
+
>
|
|
28
40
|
{parsedPayload
|
|
29
41
|
&& parsedPayload?.gasPrice?.map(({ price, priorityFee }) => (
|
|
30
42
|
<Grid key={price?.label} item xs={12} sm={6} md={5} lg={3}>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { EthereumGasBlocknativePayload } from '@xyo-network/blocknative-ethereum-gas-payload-plugin'
|
|
2
|
-
import { GasPriceWitnessUIBasePayload } from '@xyo-network/react-gas-price'
|
|
1
|
+
import type { EthereumGasBlocknativePayload } from '@xyo-network/blocknative-ethereum-gas-payload-plugin'
|
|
2
|
+
import type { GasPriceWitnessUIBasePayload } from '@xyo-network/react-gas-price'
|
|
3
3
|
|
|
4
|
+
// eslint-disable-next-line @eslint-react/hooks-extra/ensure-custom-hooks-using-other-hooks
|
|
4
5
|
export const useBlocknativeTransformer = (payload?: EthereumGasBlocknativePayload): GasPriceWitnessUIBasePayload | undefined => {
|
|
5
6
|
const blockPrices = payload?.blockPrices?.[0]
|
|
6
7
|
if (blockPrices && blockPrices.estimatedPrices?.length) {
|
package/xy.config.ts
CHANGED