@xyo-network/react-ethereum-gas-price-blocknative-plugin 3.0.0 → 3.0.1

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.
@@ -7,7 +7,6 @@ import React3, { forwardRef as forwardRef3 } from "react";
7
7
 
8
8
  // src/components/Card/CardContent.tsx
9
9
  import { CardContent, Grid } from "@mui/material";
10
- import { isEmpty } from "@xylabs/lodash";
11
10
  import { GasFeeCard, ToggleRawPayloadBox } from "@xyo-network/react-gas-price";
12
11
  import { PayloadDataMissing } from "@xyo-network/react-shared";
13
12
  import React, { forwardRef } from "react";
@@ -44,10 +43,11 @@ var useBlocknativeTransformer = /* @__PURE__ */ __name((payload) => {
44
43
  }, "useBlocknativeTransformer");
45
44
 
46
45
  // src/components/Card/CardContent.tsx
46
+ var isEmpty = /* @__PURE__ */ __name((obj) => Object.keys(obj ?? {}).length === 0, "isEmpty");
47
47
  var BlocknativeGasPriceCardContent = /* @__PURE__ */ forwardRef(({ payload, ...props }, ref) => {
48
48
  const gasPricePayload = payload ? payload : void 0;
49
49
  const parsedPayload = useBlocknativeTransformer(gasPricePayload);
50
- if (isEmpty(gasPricePayload) || !gasPricePayload.blockPrices?.length) {
50
+ if (isEmpty(gasPricePayload) || !gasPricePayload?.blockPrices?.length) {
51
51
  return /* @__PURE__ */ React.createElement(PayloadDataMissing, {
52
52
  alertBody: "Payload is missing valid gas fee data.",
53
53
  sx: {
@@ -125,17 +125,17 @@ BlocknativeGasPriceCard.displayName = "BlocknativeGasPriceCard";
125
125
 
126
126
  // src/components/Details/Box/BlocknativeGasPriceDetailsBox.tsx
127
127
  import { Grid as Grid2 } from "@mui/material";
128
- import { isEmpty as isEmpty2 } from "@xylabs/lodash";
129
128
  import { FlexCol } from "@xylabs/react-flexbox";
130
129
  import { GasFeeCard as GasFeeCard2, GasPriceWitnessHeaderBox, ToggleRawPayloadBox as ToggleRawPayloadBox2 } from "@xyo-network/react-gas-price";
131
130
  import { PayloadDataMissing as PayloadDataMissing2 } from "@xyo-network/react-shared";
132
131
  import React4, { forwardRef as forwardRef4 } from "react";
132
+ var isEmpty2 = /* @__PURE__ */ __name((obj) => Object.keys(obj ?? {}).length === 0, "isEmpty");
133
133
  var BlocknativeGasPriceDetailsBox = /* @__PURE__ */ forwardRef4(
134
134
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
135
135
  ({ payload, listMode, ...props }, ref) => {
136
136
  const gasPricePayload = payload ? payload : void 0;
137
137
  const parsedPayload = useBlocknativeTransformer(gasPricePayload);
138
- return /* @__PURE__ */ React4.createElement(React4.Fragment, null, isEmpty2(gasPricePayload) || !gasPricePayload.blockPrices?.length ? /* @__PURE__ */ React4.createElement(PayloadDataMissing2, {
138
+ return /* @__PURE__ */ React4.createElement(React4.Fragment, null, isEmpty2(gasPricePayload) || !gasPricePayload?.blockPrices?.length ? /* @__PURE__ */ React4.createElement(PayloadDataMissing2, {
139
139
  alertBody: "Payload is missing valid gas fee data."
140
140
  }) : /* @__PURE__ */ React4.createElement(FlexCol, {
141
141
  alignItems: "start",
@@ -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 { isEmpty } from '@xylabs/lodash'\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\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 { isEmpty } from '@xylabs/lodash'\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\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;AACpD,SAASC,eAAe;AAExB,SAASC,YAAYC,2BAA2B;AAEhD,SAASC,0BAA0B;AACnC,OAAOC,SAASC,kBAAkB;;;ACH3B,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;;;ADOlC,IAAMC,iCAAiCC,2BAC5C,CAAC,EAAEC,SAAS,GAAGC,MAAAA,GAASC,QAAAA;AACtB,QAAMC,kBAAkBH,UAAWA,UAA4CI;AAC/E,QAAMC,gBAAgBC,0BAA0BH,eAAAA;AAEhD,MAAII,QAAQJ,eAAAA,KAAoB,CAACA,gBAAg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AAzB,OAAA,cAAC+B,sBAAAA;MAAoBnC;MAAkCW,YAAW;;EAKhF;AAAA;AAGFjB,8BAA8B0C,cAAc;;;AC/C5C,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","isEmpty","GasFeeCard","ToggleRawPayloadBox","PayloadDataMissing","React","forwardRef","useBlocknativeTransformer","payload","blockPrices","estimatedPrices","length","gasPrice","map","price","label","confidence","value","priorityFee","maxPriorityFeePerGas","baseFee","baseFeePerGas","blockNumber","timestamp","website","BlocknativeGasPriceCardContent","forwardRef","payload","props","ref","gasPricePayload","undefined","parsedPayload","useBlocknativeTransformer","isEmpty","blockPrices","length","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","isEmpty","FlexCol","GasFeeCard","GasPriceWitnessHeaderBox","ToggleRawPayloadBox","PayloadDataMissing","React","forwardRef","BlocknativeGasPriceDetailsBox","forwardRef","payload","listMode","props","ref","gasPricePayload","undefined","parsedPayload","useBlocknativeTransformer","React","isEmpty","blockPrices","length","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 { 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,GAApD;AAET,IAAMC,iCAAiCC,2BAC5C,CAAC,EAAEC,SAAS,GAAGC,MAAAA,GAASC,QAAAA;AACtB,QAAMC,kBAAkBH,UAAWA,UAA4CI;AAC/E,QAAMC,gBAAgBC,0BAA0BH,eAAAA;AAEhD,MAAIV,QAAQU,eAAAA,KAAoB,CAACA,iBAAiBI,aAAaV,QAAQ;AACrE,WAAO,sBAAA,cAACW,oBAAAA;MAAmBC,WAAU;MAAyCC,IAAI;QAAEC,GAAG;MAAE;;EAC3F;AAEA,SACE,sBAAA,cAACC,aAAAA;IAAYV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;;;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"]}
package/package.json CHANGED
@@ -10,19 +10,18 @@
10
10
  "url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/issues"
11
11
  },
12
12
  "dependencies": {
13
- "@xylabs/lodash": "^4.0.0",
14
- "@xylabs/react-flexbox": "^4.0.0",
13
+ "@xylabs/react-flexbox": "^4.0.1",
15
14
  "@xyo-network/blocknative-ethereum-gas-payload-plugin": "^3.0.0",
16
- "@xyo-network/payload-model": "^3.0.1",
17
- "@xyo-network/react-gas-price": "^3.0.0",
18
- "@xyo-network/react-payload-plugin": "^3.0.0",
19
- "@xyo-network/react-shared": "^3.0.0"
15
+ "@xyo-network/payload-model": "^3.0.2",
16
+ "@xyo-network/react-gas-price": "^3.0.1",
17
+ "@xyo-network/react-payload-plugin": "^3.0.1",
18
+ "@xyo-network/react-shared": "^3.0.1"
20
19
  },
21
20
  "devDependencies": {
22
21
  "@storybook/react": "^8.2.9",
23
22
  "@xylabs/ts-scripts-yarn3": "^4.0.0-rc.15",
24
23
  "@xylabs/tsconfig-react": "^4.0.0-rc.15",
25
- "@xyo-network/react-storybook": "^3.0.0",
24
+ "@xyo-network/react-storybook": "^3.0.1",
26
25
  "typescript": "^5.5.4"
27
26
  },
28
27
  "peerDependencies": {
@@ -69,6 +68,6 @@
69
68
  },
70
69
  "sideEffects": false,
71
70
  "types": "dist/browser/index.d.ts",
72
- "version": "3.0.0",
71
+ "version": "3.0.1",
73
72
  "type": "module"
74
73
  }
@@ -1,5 +1,4 @@
1
1
  import { CardContent, CardContentProps, Grid } from '@mui/material'
2
- import { isEmpty } from '@xylabs/lodash'
3
2
  import { EthereumGasBlocknativePayload } from '@xyo-network/blocknative-ethereum-gas-payload-plugin'
4
3
  import { GasFeeCard, ToggleRawPayloadBox } from '@xyo-network/react-gas-price'
5
4
  import { PayloadRenderProps } from '@xyo-network/react-payload-plugin'
@@ -8,12 +7,14 @@ import React, { forwardRef } from 'react'
8
7
 
9
8
  import { useBlocknativeTransformer } from '../hooks/index.ts'
10
9
 
10
+ const isEmpty = (obj?: object) => Object.keys(obj ?? {}).length === 0
11
+
11
12
  export const BlocknativeGasPriceCardContent = forwardRef<HTMLDivElement, Omit<PayloadRenderProps & CardContentProps, 'ref'>>(
12
13
  ({ payload, ...props }, ref) => {
13
14
  const gasPricePayload = payload ? (payload as EthereumGasBlocknativePayload) : undefined
14
15
  const parsedPayload = useBlocknativeTransformer(gasPricePayload)
15
16
 
16
- if (isEmpty(gasPricePayload) || !gasPricePayload.blockPrices?.length) {
17
+ if (isEmpty(gasPricePayload) || !gasPricePayload?.blockPrices?.length) {
17
18
  return <PayloadDataMissing alertBody="Payload is missing valid gas fee data." sx={{ m: 1 }} />
18
19
  }
19
20
 
@@ -1,5 +1,4 @@
1
1
  import { Grid } from '@mui/material'
2
- import { isEmpty } from '@xylabs/lodash'
3
2
  import { FlexBoxProps, FlexCol } from '@xylabs/react-flexbox'
4
3
  import { EthereumGasBlocknativePayload } from '@xyo-network/blocknative-ethereum-gas-payload-plugin'
5
4
  import { GasFeeCard, GasPriceWitnessHeaderBox, ToggleRawPayloadBox } from '@xyo-network/react-gas-price'
@@ -10,6 +9,8 @@ import React, { forwardRef } from 'react'
10
9
  import { useBlocknativeTransformer } from '../../hooks/index.ts'
11
10
  import { RenderTitle } from '../../lib/index.ts'
12
11
 
12
+ const isEmpty = (obj?: object) => Object.keys(obj ?? {}).length === 0
13
+
13
14
  export const BlocknativeGasPriceDetailsBox = forwardRef<HTMLDivElement, PayloadDetailsRenderProps & FlexBoxProps>(
14
15
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
15
16
  ({ payload, listMode, ...props }, ref) => {
@@ -18,7 +19,7 @@ export const BlocknativeGasPriceDetailsBox = forwardRef<HTMLDivElement, PayloadD
18
19
 
19
20
  return (
20
21
  <>
21
- {isEmpty(gasPricePayload) || !gasPricePayload.blockPrices?.length
22
+ {isEmpty(gasPricePayload) || !gasPricePayload?.blockPrices?.length
22
23
  ? <PayloadDataMissing alertBody="Payload is missing valid gas fee data." />
23
24
  : (
24
25
  <FlexCol alignItems="start" rowGap={4} {...props} ref={ref}>