@xyo-network/react-chain-blockchain 1.0.12 → 1.1.0

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.
@@ -144,7 +144,9 @@ var useChainPollingContext = /* @__PURE__ */ __name((required = false) => useCon
144
144
 
145
145
  // src/components/transactions/submit/Builder.tsx
146
146
  import { Button, FormControl, TextField } from "@mui/material";
147
+ import { toHex } from "@xylabs/hex";
147
148
  import { FlexCol } from "@xylabs/react-flexbox";
149
+ import { defaultFees } from "@xyo-network/chain-protocol";
148
150
  import React4 from "react";
149
151
  var ChainTransactionBuilder = /* @__PURE__ */ __name(({ onSubmitTx }) => {
150
152
  const handleSubmit = /* @__PURE__ */ __name(async (event) => {
@@ -152,9 +154,14 @@ var ChainTransactionBuilder = /* @__PURE__ */ __name(({ onSubmitTx }) => {
152
154
  const formData = new FormData(event.currentTarget);
153
155
  const chainTx = {
154
156
  chain: formData.get("chain"),
155
- gas: formData.get("gas"),
156
157
  nbf: Number.parseInt(formData.get("nbf")),
157
158
  exp: Number.parseInt(formData.get("exp")),
159
+ fees: {
160
+ gasLimit: toHex(defaultFees.gasLimit),
161
+ gasPrice: toHex(defaultFees.gasPrice),
162
+ base: toHex(defaultFees.base),
163
+ priority: toHex(defaultFees.priority)
164
+ },
158
165
  nonce: []
159
166
  };
160
167
  await onSubmitTx?.(chainTx);
@@ -228,7 +235,7 @@ var ChainTransactionNetwork = /* @__PURE__ */ __name(({ network, onNetworkChange
228
235
  }, "ChainTransactionNetwork");
229
236
 
230
237
  // src/components/transactions/submit/SubmitChain.tsx
231
- import { Alert, Grid2, Typography } from "@mui/material";
238
+ import { Alert, Grid, Typography } from "@mui/material";
232
239
  import { axios } from "@xylabs/axios";
233
240
  import { ErrorRender } from "@xylabs/react-error";
234
241
  import { FlexGrowCol } from "@xylabs/react-flexbox";
@@ -239,14 +246,15 @@ import { buildTransaction } from "@xyo-network/chain-protocol";
239
246
  import { PayloadBuilder } from "@xyo-network/payload-builder";
240
247
  import React6, { useState as useState5 } from "react";
241
248
  var BETA_PENDING_TRANSACTIONS_ARCHIVIST = "https://beta.api.chain.xyo.network/8050fee682a2762f504d5449d8269a6f17f0b693";
249
+ var defaultNetwork = new URL(BETA_PENDING_TRANSACTIONS_ARCHIVIST);
242
250
  var SubmitChainTransaction = /* @__PURE__ */ __name(() => {
243
- const [network, setNetwork] = useState5(new URL(BETA_PENDING_TRANSACTIONS_ARCHIVIST));
251
+ const [network, setNetwork] = useState5(defaultNetwork);
244
252
  const [result, setResult] = useState5();
245
253
  const [error, setError] = useState5();
246
254
  const onSubmitTx = /* @__PURE__ */ __name(async (chainTx) => {
247
255
  if (!network) throw new Error("Network not set");
248
256
  const randomAccount = await Account.random();
249
- const [transactionBoundWitness] = await buildTransaction(chainTx.chain, [], BigInt(`0x${chainTx.gas}`), randomAccount, chainTx.nbf, chainTx.exp, []);
257
+ const [transactionBoundWitness] = await buildTransaction(chainTx.chain, [], randomAccount, chainTx.nbf, chainTx.exp, []);
250
258
  const insertQuery = new PayloadBuilder({
251
259
  schema: ArchivistInsertQuerySchema
252
260
  }).build();
@@ -270,9 +278,9 @@ var SubmitChainTransaction = /* @__PURE__ */ __name(() => {
270
278
  const onNetworkChange = /* @__PURE__ */ __name((url) => {
271
279
  setNetwork(url);
272
280
  }, "onNetworkChange");
273
- return /* @__PURE__ */ React6.createElement(Grid2, {
281
+ return /* @__PURE__ */ React6.createElement(Grid, {
274
282
  container: true
275
- }, /* @__PURE__ */ React6.createElement(Grid2, {
283
+ }, /* @__PURE__ */ React6.createElement(Grid, {
276
284
  size: {
277
285
  xs: 12,
278
286
  sm: 6,
@@ -866,13 +874,7 @@ BlockchainTableEx.displayName = "BlockchainTableEx";
866
874
  // src/components/block/table/row/TableRow.tsx
867
875
  import { TableRow as TableRow2 } from "@mui/material";
868
876
  import React22, { useMemo as useMemo8 } from "react";
869
- var BlockChainTableRow = /* @__PURE__ */ __name(({
870
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
871
- block,
872
- defaultExpanded,
873
- linked,
874
- ...props
875
- }) => {
877
+ var BlockChainTableRow = /* @__PURE__ */ __name(({ block, defaultExpanded, linked, sx, ...props }) => {
876
878
  const linkedTableCellProps = useMemo8(() => ({
877
879
  block,
878
880
  linked
@@ -885,7 +887,13 @@ var BlockChainTableRow = /* @__PURE__ */ __name(({
885
887
  }), [
886
888
  block
887
889
  ]);
888
- return /* @__PURE__ */ React22.createElement(TableRow2, props, /* @__PURE__ */ React22.createElement(BlockHashTableCell, defaultTableCellProps), /* @__PURE__ */ React22.createElement(BlockNumberTableCell, linkedTableCellProps), /* @__PURE__ */ React22.createElement(BlockTransactionCountTableCell, linkedTableCellProps), /* @__PURE__ */ React22.createElement(BlockProducerTableCell, defaultTableCellProps), /* @__PURE__ */ React22.createElement(BlockVerificationTableCell, defaultTableCellProps), /* @__PURE__ */ React22.createElement(BlockJsonViewTableCell, defaultTableCellProps));
890
+ return /* @__PURE__ */ React22.createElement(TableRow2, {
891
+ sx: {
892
+ overflowY: "scroll",
893
+ ...sx
894
+ },
895
+ ...props
896
+ }, /* @__PURE__ */ React22.createElement(BlockHashTableCell, defaultTableCellProps), /* @__PURE__ */ React22.createElement(BlockNumberTableCell, linkedTableCellProps), /* @__PURE__ */ React22.createElement(BlockTransactionCountTableCell, linkedTableCellProps), /* @__PURE__ */ React22.createElement(BlockProducerTableCell, defaultTableCellProps), /* @__PURE__ */ React22.createElement(BlockVerificationTableCell, defaultTableCellProps), /* @__PURE__ */ React22.createElement(BlockJsonViewTableCell, defaultTableCellProps));
889
897
  }, "BlockChainTableRow");
890
898
 
891
899
  // src/components/chain/controls/PollingControlsFlexbox.tsx
@@ -1319,7 +1327,7 @@ import { usePromise as usePromise4 } from "@xylabs/react-promise";
1319
1327
  import { useEffect as useEffect3, useMemo as useMemo11, useRef as useRef3, useSyncExternalStore } from "react";
1320
1328
 
1321
1329
  // src/hooks/chain-iterator/useChainIteratorUpdatingHead.ts
1322
- import { toHex } from "@xylabs/hex";
1330
+ import { toHex as toHex2 } from "@xylabs/hex";
1323
1331
  import { findMostRecentBlock } from "@xyo-network/chain-protocol";
1324
1332
  import { useEffect as useEffect2, useState as useState12 } from "react";
1325
1333
  var useChainIteratorUpdatingHead = /* @__PURE__ */ __name(({ chainIterator, interval = 500, maxBlocks, chainArchivist }) => {
@@ -1335,10 +1343,10 @@ var useChainIteratorUpdatingHead = /* @__PURE__ */ __name(({ chainIterator, inte
1335
1343
  const currentBlockNumber = currentHead?.block ?? -1;
1336
1344
  const nextBlockNumber = mostRecentBlock.block;
1337
1345
  if (nextBlockNumber > currentBlockNumber) {
1338
- console.debug("Found more recent head:", toHex(nextBlockNumber));
1339
- console.debug("Updating head:", `${toHex(nextBlockNumber)}`);
1346
+ console.debug("Found more recent head:", toHex2(nextBlockNumber));
1347
+ console.debug("Updating head:", `${toHex2(nextBlockNumber)}`);
1340
1348
  await chainIterator.updateHead(mostRecentBlock);
1341
- console.debug("Updated head:", `${toHex(nextBlockNumber)}`);
1349
+ console.debug("Updated head:", `${toHex2(nextBlockNumber)}`);
1342
1350
  }
1343
1351
  }
1344
1352
  } catch (e) {
@@ -1854,7 +1862,7 @@ import React41, { useMemo as useMemo20, useState as useState18 } from "react";
1854
1862
  // src/components/payload/builder/transfer/builder/SingleFlexbox.tsx
1855
1863
  import { RemoveCircle } from "@mui/icons-material";
1856
1864
  import { FormControl as FormControl6, Icon as Icon3, IconButton as IconButton5 } from "@mui/material";
1857
- import { toHex as toHex2 } from "@xylabs/hex";
1865
+ import { toHex as toHex3 } from "@xylabs/hex";
1858
1866
  import { FlexRow as FlexRow7 } from "@xylabs/react-flexbox";
1859
1867
  import { BigIntInput } from "@xyo-network/react-shared";
1860
1868
  import React40, { useEffect as useEffect4, useMemo as useMemo19, useState as useState17 } from "react";
@@ -1865,7 +1873,7 @@ var SingleTransferBuilderFlexbox = /* @__PURE__ */ __name(({ onTransferUpdated,
1865
1873
  if (toAddress && amount) {
1866
1874
  return {
1867
1875
  ...singleTransfer,
1868
- amount: toHex2(amount),
1876
+ amount: toHex3(amount),
1869
1877
  to: toAddress
1870
1878
  };
1871
1879
  }
@@ -2043,7 +2051,7 @@ var ChainArchivistDecorator = /* @__PURE__ */ __name((Story, context) => {
2043
2051
  }
2044
2052
  }
2045
2053
  };
2046
- return blockChainRenderProps?.chainArchivist ? /* @__PURE__ */ React43.createElement(Story, props) : /* @__PURE__ */ React43.createElement(React43.Fragment, null, /* @__PURE__ */ React43.createElement(CircularProgress, null));
2054
+ return blockChainRenderProps?.chainArchivist ? /* @__PURE__ */ React43.createElement(Story, props) : /* @__PURE__ */ React43.createElement(CircularProgress, null);
2047
2055
  }, "ChainArchivistDecorator");
2048
2056
 
2049
2057
  // src/stories/ChainArchivistDelayedInsertDecorator.tsx