From fb24b9d91438085574cf09b5bf92eadefd02a40b Mon Sep 17 00:00:00 2001 From: Matthew Russell Date: Fri, 24 Feb 2023 13:25:36 -0800 Subject: [PATCH] chore: add utils lib and move non react libs --- .../asset-balance/asset-balance.tsx | 2 +- .../governance-asset-balance.tsx | 2 +- .../app/components/assets/assets-table.tsx | 2 +- .../src/app/components/blocks/block-data.tsx | 4 +- .../src/app/components/blocks/blocks-data.tsx | 2 +- .../blocks/blocks-infinite-list.tsx | 2 +- .../app/components/blocks/blocks-refetch.tsx | 2 +- .../components/dialogs/json-viewer-dialog.tsx | 2 +- .../epoch-overview/epoch-missing.spec.tsx | 2 +- .../epoch-overview/epoch-missing.tsx | 4 +- .../app/components/epoch-overview/epoch.tsx | 2 +- .../src/app/components/footer/footer.tsx | 2 +- .../src/app/components/header/header.tsx | 2 +- .../app/components/info-panel/info-panel.tsx | 2 +- .../app/components/jump-to-block/index.tsx | 2 +- .../src/app/components/jump-to/index.tsx | 2 +- .../links/market-link/market-link.tsx | 2 +- .../links/party-link/party-link.tsx | 2 +- .../app/components/markets/market-details.tsx | 2 +- .../app/components/markets/markets-table.tsx | 2 +- .../nested-data-list/nested-data-list.tsx | 2 +- .../order-details/amend-order-details.tsx | 2 +- .../deterministic-order-details.tsx | 2 +- .../order-details/lib/order-labels.tsx | 2 +- .../price-in-market/price-in-market.tsx | 2 +- .../components/proposals/proposals-table.tsx | 2 +- .../app/components/render-fetched/index.tsx | 2 +- .../router-error-boundary/index.tsx | 2 +- .../src/app/components/search/search.tsx | 2 +- .../size-in-asset/size-in-asset.tsx | 2 +- .../size-in-market/size-in-market.tsx | 2 +- .../src/app/components/time-ago/index.tsx | 2 +- .../src/app/components/time/index.tsx | 2 +- .../src/app/components/truncate/truncate.tsx | 2 +- .../chain-events/tx-builtin-deposit.spec.tsx | 2 +- .../chain-events/tx-builtin-deposit.tsx | 2 +- .../tx-builtin-withdrawal.spec.tsx | 2 +- .../chain-events/tx-builtin-withdrawal.tsx | 2 +- .../tx-erc20-asset-delist.spec.tsx | 2 +- .../chain-events/tx-erc20-asset-delist.tsx | 2 +- .../tx-erc20-asset-limits-updated.spec.tsx | 2 +- .../tx-erc20-asset-limits-updated.tsx | 2 +- .../chain-events/tx-erc20-asset-list.spec.tsx | 2 +- .../chain-events/tx-erc20-asset-list.tsx | 2 +- .../tx-erc20-bridge-pause.spec.tsx | 2 +- .../chain-events/tx-erc20-bridge-pause.tsx | 2 +- .../chain-events/tx-erc20-deposit.spec.tsx | 2 +- .../details/chain-events/tx-erc20-deposit.tsx | 2 +- .../chain-events/tx-erc20-withdrawal.spec.tsx | 2 +- .../chain-events/tx-erc20-withdrawal.tsx | 2 +- .../chain-events/tx-multisig-signer.spec.tsx | 2 +- .../chain-events/tx-multisig-signer.tsx | 2 +- .../tx-multisig-threshold.spec.tsx | 2 +- .../chain-events/tx-multisig-threshold.tsx | 2 +- .../chain-events/tx-stake-deposit.spec.tsx | 2 +- .../details/chain-events/tx-stake-deposit.tsx | 2 +- .../chain-events/tx-stake-remove.spec.tsx | 2 +- .../details/chain-events/tx-stake-remove.tsx | 2 +- .../tx-stake-totalsupply.spec.tsx | 2 +- .../chain-events/tx-stake-totalsupply.tsx | 2 +- .../liquidity-provision-details-row.tsx | 2 +- .../components/liquidity-provision-offset.tsx | 2 +- .../liquidity-provision-details.tsx | 2 +- .../data-submission-json-oracle.tsx | 2 +- .../data-submission-open-oracle.tsx | 2 +- .../open-oracle/open-oracle-prices.tsx | 2 +- .../txs/details/shared/tx-details-shared.tsx | 2 +- .../details/state-variable/bound-factors.tsx | 2 +- .../details/state-variable/risk-factors.tsx | 2 +- .../state-variable/trading-probability.tsx | 2 +- .../transfer/blocks/transfer-participants.tsx | 2 +- .../transfer/blocks/transfer-repeat.tsx | 2 +- .../transfer/blocks/transfer-rewards.tsx | 2 +- .../app/components/txs/details/tx-batch.tsx | 2 +- .../components/txs/details/tx-chain-event.tsx | 2 +- .../txs/details/tx-data-submission.tsx | 2 +- .../components/txs/details/tx-delegation.tsx | 2 +- .../details/tx-details-protocol-upgrade.tsx | 2 +- .../txs/details/tx-details-wrapper.tsx | 2 +- .../txs/details/tx-eth-key-rotate.tsx | 2 +- .../app/components/txs/details/tx-generic.tsx | 2 +- .../components/txs/details/tx-hearbeat.tsx | 2 +- .../txs/details/tx-issue-signatures.tsx | 2 +- .../components/txs/details/tx-key-rotate.tsx | 2 +- .../txs/details/tx-liquidity-amend.tsx | 2 +- .../txs/details/tx-liquidity-cancel.tsx | 2 +- .../txs/details/tx-liquidity-submission.tsx | 2 +- .../txs/details/tx-node-announce.tsx | 2 +- .../components/txs/details/tx-node-vote.tsx | 2 +- .../components/txs/details/tx-order-amend.tsx | 2 +- .../txs/details/tx-order-cancel.tsx | 2 +- .../app/components/txs/details/tx-order.tsx | 2 +- .../txs/details/tx-proposal-vote.tsx | 2 +- .../details/tx-state-variable-proposal.tsx | 2 +- .../components/txs/details/tx-transfer.tsx | 2 +- .../txs/details/tx-undelegation.tsx | 2 +- .../txs/details/tx-withdraw-submission.tsx | 2 +- .../src/app/components/txs/tx-data-view.tsx | 2 +- .../src/app/components/txs/tx-list.tsx | 2 +- .../src/app/components/txs/tx-order-type.tsx | 2 +- .../app/components/txs/txs-infinite-list.tsx | 2 +- .../src/app/components/txs/txs-per-block.tsx | 2 +- .../withdrawal/withdrawal-progress.tsx | 2 +- apps/explorer/src/app/hooks/use-txs-data.ts | 2 +- .../src/app/routes/assets/asset-page.tsx | 2 +- .../src/app/routes/assets/assets-page.tsx | 2 +- .../src/app/routes/blocks/home/index.tsx | 2 +- .../src/app/routes/blocks/id/block.spec.tsx | 2 +- .../src/app/routes/blocks/id/block.tsx | 4 +- .../explorer/src/app/routes/genesis/index.tsx | 2 +- .../app/routes/governance/proposals-page.tsx | 2 +- .../src/app/routes/markets/market-page.tsx | 2 +- .../src/app/routes/markets/markets-page.tsx | 2 +- .../network-parameters.spec.tsx | 2 +- .../network-parameters/network-parameters.tsx | 4 +- .../routes/oracles/components/oracle-data.tsx | 2 +- .../oracles/components/oracle-filter.tsx | 2 +- .../oracles/components/oracle-markets.tsx | 2 +- .../oracles/components/oracle-signers.tsx | 2 +- .../app/routes/oracles/components/oracle.tsx | 2 +- .../src/app/routes/oracles/home/index.tsx | 2 +- .../src/app/routes/oracles/id/index.tsx | 2 +- .../src/app/routes/parties/home/index.tsx | 2 +- .../parties/id/components/party-accounts.tsx | 2 +- .../parties/id/components/party-id-error.tsx | 2 +- .../src/app/routes/parties/id/index.tsx | 2 +- .../explorer/src/app/routes/pending/index.tsx | 2 +- .../explorer/src/app/routes/router-config.tsx | 2 +- .../src/app/routes/txs/home/index.tsx | 2 +- apps/explorer/src/app/routes/txs/id/index.tsx | 2 +- .../src/app/routes/txs/id/tx-content.tsx | 2 +- .../src/app/routes/txs/id/tx-details.tsx | 2 +- .../app/routes/validators/validators-page.tsx | 2 +- .../app/components/dashboard/dashboard.tsx | 2 +- .../app/components/dashboard/intro/intro.tsx | 2 +- .../dashboard/market-list/market-list.tsx | 4 +- .../src/app/components/detail/detail.tsx | 2 +- .../app/components/detail/header/header.tsx | 2 +- .../last-24h-volume/last-24h-volume.tsx | 2 +- .../app/components/detail/market/market.tsx | 2 +- .../components/detail/providers/providers.tsx | 2 +- .../app/components/health-bar/health-bar.tsx | 2 +- .../health-dialog/health-dialog.tsx | 2 +- .../src/app/components/status/status.tsx | 2 +- .../src/app/routes/router-config.tsx | 2 +- apps/multisig-signer/src/app/app.tsx | 2 +- .../add-signer-form/add-signer-form.tsx | 2 +- .../remove-signer-form/remove-signer-form.tsx | 2 +- .../src/integration/view/wallet-vega.cy.js | 2 +- apps/token/src/app-loader.tsx | 2 +- .../components/token-input/token-input.tsx | 2 +- .../vega-wallet/download-wallet-prompt.tsx | 2 +- .../token/src/components/vega-wallet/hooks.ts | 4 +- .../components/vega-wallet/vega-wallet.tsx | 2 +- .../components/wallet-card/wallet-card.tsx | 2 +- apps/token/src/hooks/use-animate-value.ts | 2 +- .../hooks/use-get-association-breakdown.ts | 2 +- apps/token/src/hooks/use-get-user-balances.ts | 2 +- .../hooks/use-refresh-associated-balances.ts | 2 +- apps/token/src/hooks/use-refresh-balances.ts | 2 +- apps/token/src/lib/abbreviate-number.ts | 2 +- apps/token/src/lib/format-number.ts | 2 +- .../token/src/lib/tranches/tranches-store.tsx | 2 +- apps/token/src/routes/claim/claim-reducer.ts | 2 +- apps/token/src/routes/claim/hooks.ts | 2 +- apps/token/src/routes/contracts/index.tsx | 2 +- apps/token/src/routes/home/index.tsx | 5 +- .../current-proposal-status.spec.tsx | 4 +- .../proposal-header.tsx | 2 +- .../proposal-votes-table.tsx | 5 +- .../components/proposal/proposal.tsx | 2 +- .../proposals-list/proposals-list.tsx | 2 +- .../propose/proposal-form-terms.tsx | 2 +- ...posal-form-vote-and-enactment-deadline.tsx | 2 +- .../shared/proposal-min-requirements.tsx | 2 +- .../components/vote-details/use-user-vote.tsx | 2 +- .../components/vote-details/vote-buttons.tsx | 3 +- .../vote-details/vote-transaction-dialog.tsx | 2 +- .../hooks/use-proposal-network-params.ts | 2 +- .../proposals/hooks/use-vote-information.ts | 2 +- .../proposals/proposals-container.tsx | 4 +- .../freeform/propose-freeform.spec.tsx | 4 +- .../propose/freeform/propose-freeform.tsx | 2 +- .../propose-network-parameter.spec.tsx | 4 +- .../propose-network-parameter.tsx | 2 +- .../new-asset/propose-new-asset.spec.tsx | 4 +- .../propose/new-asset/propose-new-asset.tsx | 2 +- .../new-market/propose-new-market.spec.tsx | 4 +- .../propose/new-market/propose-new-market.tsx | 2 +- .../src/routes/proposals/propose/propose.tsx | 2 +- .../propose/raw/proposal-raw.spec.tsx | 4 +- .../proposals/propose/raw/propose-raw.tsx | 2 +- .../propose-update-asset.spec.tsx | 4 +- .../update-asset/propose-update-asset.tsx | 2 +- .../propose-update-market.spec.tsx | 4 +- .../update-market/propose-update-market.tsx | 2 +- .../rejected/rejected-proposals-container.tsx | 4 +- .../routes/proposals/test-helpers/mocks.ts | 4 +- apps/token/src/routes/redemption/hooks.ts | 2 +- .../epoch-individual-rewards-table.tsx | 2 +- .../epoch-individual-rewards.tsx | 2 +- .../epoch-total-rewards-table.tsx | 2 +- .../generate-epoch-total-rewards-list.ts | 2 +- .../src/routes/rewards/home/rewards-page.tsx | 2 +- .../src/routes/staking/associate/hooks.ts | 5 +- .../staking/associate/wallet-associate.tsx | 2 +- .../disassociate-page/disassociate-page.tsx | 2 +- .../src/routes/staking/disassociate/hooks.ts | 2 +- .../token/src/routes/staking/home/staking.tsx | 2 +- .../consensus-validators-table.tsx | 2 +- .../staking/home/validator-tables/shared.tsx | 2 +- .../standby-pending-validators-table.tsx | 2 +- .../validator-tables/validator-tables.tsx | 2 +- apps/token/src/routes/staking/node/node.tsx | 2 +- .../src/routes/staking/node/pending-stake.tsx | 2 +- .../src/routes/staking/node/staking-form.tsx | 2 +- .../staking/node/validator-table.spec.tsx | 2 +- .../routes/staking/node/validator-table.tsx | 6 +- apps/token/src/routes/staking/shared.ts | 2 +- apps/token/src/routes/token/index.tsx | 4 +- apps/token/src/routes/tranches/tranche.tsx | 2 +- apps/token/src/routes/withdrawals/index.tsx | 2 +- .../trading-e2e/src/integration/markets.cy.ts | 2 +- apps/trading/client-pages/home/home.tsx | 2 +- .../client-pages/liquidity/liquidity.tsx | 2 +- apps/trading/client-pages/market/constants.ts | 2 +- apps/trading/client-pages/market/market.tsx | 2 +- .../client-pages/market/trade-grid.tsx | 2 +- .../market/trade-market-header.tsx | 6 +- .../client-pages/markets/markets-page.tsx | 2 +- .../trading/client-pages/markets/proposed.tsx | 2 +- .../portfolio/account-history-container.tsx | 4 +- .../portfolio/deposits-container.tsx | 2 +- .../client-pages/portfolio/portfolio.tsx | 2 +- .../portfolio/withdrawals-container.tsx | 2 +- .../accounts-container/accounts-container.tsx | 2 +- .../components/app-loader/app-failure.tsx | 2 +- .../components/app-loader/app-loader.tsx | 2 +- .../components/app-loader/web3-provider.tsx | 2 +- apps/trading/components/constants.ts | 2 +- apps/trading/components/footer/footer.tsx | 3 +- .../last-24h-price-change.tsx | 2 +- .../last-24h-volume/last-24h-volume.tsx | 2 +- .../liquidity-supplied/liquidity-supplied.tsx | 4 +- .../market-mark-price/market-mark-price.tsx | 2 +- .../components/market-state/market-state.tsx | 2 +- .../market-trading-mode.tsx | 2 +- .../market-volume/market-volume.tsx | 2 +- apps/trading/components/navbar/navbar.tsx | 2 +- .../select-market/select-market-columns.tsx | 2 +- .../select-market/select-market.tsx | 2 +- .../vega-wallet-connect-button.spec.tsx | 2 +- .../vega-wallet-connect-button.tsx | 2 +- .../vega-wallet-container.tsx | 2 +- .../welcome-dialog/proposed-markets.tsx | 2 +- .../welcome-dialog/risk-notice-dialog.tsx | 4 +- .../welcome-dialog/welcome-dialog.tsx | 6 +- .../welcome-dialog/welcome-landing-dialog.tsx | 2 +- .../welcome-dialog/welcome-notice-dialog.tsx | 2 +- .../hooks/use-ethereum-transaction-toasts.tsx | 2 +- .../use-ethereum-withdraw-approval-toasts.tsx | 2 +- .../lib/hooks/use-vega-transaction-toasts.tsx | 2 +- apps/trading/pages/_app.page.tsx | 2 +- apps/trading/pages/client-router.tsx | 2 +- apps/trading/stores/global.ts | 2 +- libs/accounts/.storybook/preview.js | 2 +- .../src/lib/accounts-data-provider.ts | 2 +- .../src/lib/accounts-manager.spec.tsx | 2 +- libs/accounts/src/lib/accounts-manager.tsx | 2 +- libs/accounts/src/lib/accounts-table.tsx | 6 +- libs/accounts/src/lib/asset-balance.tsx | 5 +- libs/accounts/src/lib/breakdown-table.tsx | 2 +- libs/accounts/src/lib/transfer-container.tsx | 2 +- libs/accounts/src/lib/transfer-dialog.tsx | 2 +- libs/accounts/src/lib/transfer-form.spec.tsx | 2 +- libs/accounts/src/lib/transfer-form.tsx | 2 +- libs/accounts/src/lib/use-account-balance.tsx | 2 +- .../src/lib/use-market-account-balance.tsx | 2 +- libs/apollo-client/src/lib/apollo-client.ts | 2 +- libs/assets/src/lib/asset-data-provider.ts | 2 +- libs/assets/src/lib/asset-details-dialog.tsx | 2 +- libs/assets/src/lib/asset-details-table.tsx | 2 +- libs/assets/src/lib/assets-data-provider.ts | 2 +- libs/candles-chart/src/lib/candles-chart.tsx | 2 +- libs/candles-chart/src/lib/data-source.ts | 2 +- .../src/components/deal-ticket-estimates.tsx | 2 +- .../deal-ticket-validation/margin-warning.tsx | 2 +- .../zero-balance-error.tsx | 2 +- .../deal-ticket/deal-ticket-button.tsx | 2 +- .../deal-ticket/deal-ticket-container.tsx | 4 +- .../deal-ticket/deal-ticket-limit-amount.tsx | 2 +- .../deal-ticket/deal-ticket-market-amount.tsx | 2 +- .../deal-ticket/deal-ticket.spec.tsx | 4 +- .../components/deal-ticket/deal-ticket.tsx | 2 +- .../deal-ticket/expiry-selector.tsx | 4 +- .../deal-ticket/market-selector.tsx | 2 +- .../components/deal-ticket/side-selector.tsx | 2 +- .../deal-ticket/time-in-force-selector.tsx | 2 +- .../components/deal-ticket/type-selector.tsx | 2 +- .../compile-grid-data.tsx | 4 +- .../trading-mode-tooltip.tsx | 4 +- libs/deal-ticket/src/constants.ts | 2 +- .../src/hooks/use-calculate-slippage.ts | 2 +- .../src/hooks/use-fee-deal-ticket-details.tsx | 2 +- .../src/hooks/use-has-no-balance.tsx | 2 +- .../src/hooks/use-order-closeout.ts | 2 +- .../src/hooks/use-order-margin-validation.ts | 2 +- .../deal-ticket/src/hooks/use-order-margin.ts | 2 +- .../src/utils/get-default-order.ts | 2 +- libs/deal-ticket/src/utils/get-price.ts | 2 +- .../src/utils/validate-expiration.ts | 2 +- .../src/utils/validate-market-state.ts | 2 +- .../src/utils/validate-market-trading-mode.ts | 2 +- libs/deposits/src/lib/deposit-container.tsx | 2 +- libs/deposits/src/lib/deposit-dialog.tsx | 2 +- libs/deposits/src/lib/deposit-form.tsx | 2 +- libs/deposits/src/lib/deposit-limits.tsx | 2 +- libs/deposits/src/lib/deposit-manager.tsx | 4 +- libs/deposits/src/lib/deposits-provider.ts | 2 +- libs/deposits/src/lib/deposits-table.tsx | 2 +- libs/deposits/src/lib/use-deposit-balances.ts | 2 +- libs/deposits/src/lib/use-get-allowance.ts | 2 +- .../src/lib/use-get-balance-of-erc20-token.ts | 2 +- .../src/lib/use-get-deposit-maximum.ts | 2 +- .../src/lib/use-get-deposited-amount.ts | 2 +- libs/deposits/src/lib/use-submit-approval.ts | 2 +- libs/deposits/src/lib/use-submit-faucet.ts | 2 +- .../network-switcher.spec.tsx | 2 +- .../network-switcher/network-switcher.tsx | 2 +- .../components/node-switcher/layout-cell.tsx | 2 +- .../node-switcher/node-switcher.tsx | 2 +- .../src/components/node-switcher/row-data.tsx | 2 +- libs/environment/src/hooks/use-environment.ts | 2 +- libs/environment/src/hooks/use-node-health.ts | 2 +- libs/fills/.storybook/preview.js | 2 +- libs/fills/src/lib/fills-container.tsx | 2 +- libs/fills/src/lib/fills-data-provider.ts | 4 +- libs/fills/src/lib/fills-manager.tsx | 2 +- libs/fills/src/lib/fills-table.spec.tsx | 2 +- libs/fills/src/lib/fills-table.tsx | 2 +- libs/fills/src/lib/use-fills-list.ts | 2 +- .../asset-proposal-notification.tsx | 2 +- .../market-proposal-notification.tsx | 2 +- .../proposals-data-provider.tsx | 2 +- .../use-update-network-paramaters-toasts.tsx | 2 +- .../proposals-hooks/use-update-proposal.ts | 2 +- .../src/lib/proposals-list/proposals-list.tsx | 2 +- .../lib/proposals-list/use-column-defs.tsx | 2 +- .../src/utils/proposal-dialog-helpers.tsx | 2 +- libs/ledger/src/lib/ledger-container.tsx | 2 +- .../src/lib/ledger-entries-data-provider.ts | 4 +- libs/ledger/src/lib/ledger-manager.tsx | 2 +- libs/ledger/src/lib/ledger-table.tsx | 2 +- .../src/lib/liquidity-data-provider.ts | 5 +- libs/liquidity/src/lib/liquidity-table.tsx | 2 +- .../src/lib/markets-liquidity-provider.ts | 2 +- .../src/lib/utils/liquidity-utils.ts | 2 +- .../market-depth/src/lib/depth-chart-utils.ts | 2 +- libs/market-depth/src/lib/depth-chart.tsx | 2 +- .../src/lib/market-depth-provider.ts | 4 +- libs/market-depth/src/lib/orderbook-data.ts | 2 +- .../src/lib/orderbook-manager.tsx | 2 +- libs/market-depth/src/lib/orderbook-row.tsx | 2 +- libs/market-depth/src/lib/orderbook.tsx | 2 +- .../fees-breakdown/fees-breakdown.tsx | 2 +- .../market-info/info-key-value-table.tsx | 2 +- .../components/market-info/info-market.tsx | 7 +- .../market-info/market-info-data-provider.ts | 2 +- .../market-info/tooltip-mapping.tsx | 2 +- .../markets-container/market-list-table.tsx | 2 +- .../markets-container/markets-container.tsx | 4 +- .../src/lib/market-candles-provider.ts | 2 +- .../src/lib/market-data-provider.ts | 7 +- .../src/lib/markets-candles-provider.ts | 2 +- .../src/lib/markets-data-provider.ts | 2 +- libs/market-list/src/lib/markets-provider.ts | 2 +- .../market-list/src/lib/utils/market-utils.ts | 2 +- libs/network-info/src/network-info.tsx | 2 +- libs/network-stats/src/config/stats-fields.ts | 2 +- .../order-data-provider.spec.ts | 2 +- .../order-data-provider.ts | 4 +- .../lib/components/order-list-container.tsx | 2 +- .../order-list-manager.spec.tsx | 2 +- .../order-list-manager/order-list-manager.tsx | 2 +- .../use-order-list-data.spec.ts | 2 +- .../order-list-manager/use-order-list-data.ts | 2 +- .../order-list/order-edit-dialog.tsx | 2 +- .../components/order-list/order-list.spec.tsx | 2 +- .../lib/components/order-list/order-list.tsx | 12 +- .../src/lib/order-hooks/use-order-edit.tsx | 2 +- .../src/lib/order-hooks/use-order-submit.tsx | 2 +- libs/orders/src/lib/utils.ts | 2 +- libs/positions/.storybook/preview.js | 2 +- .../lib/close-position-dialog/complete.tsx | 2 +- .../lib/close-position-dialog/requested.tsx | 2 +- .../src/lib/close-position-dialog/shared.tsx | 2 +- .../positions/src/lib/margin-data-provider.ts | 5 +- .../positions/src/lib/positions-container.tsx | 2 +- .../src/lib/positions-data-providers.ts | 2 +- libs/positions/src/lib/positions-manager.tsx | 2 +- libs/positions/src/lib/positions-table.tsx | 2 +- libs/positions/src/lib/use-market-margin.tsx | 2 +- .../lib/use-market-position-open-volume.tsx | 2 +- libs/positions/src/lib/use-positions-data.tsx | 2 +- .../lib/use-request-close-position-data.ts | 2 +- .../use-local-storage.ts} | 30 +--- libs/react-helpers/src/hooks/use-logger.ts | 4 +- .../src/hooks/use-theme-switcher.ts | 2 +- libs/react-helpers/src/lib/format/index.ts | 4 - libs/react-helpers/src/lib/format/number.tsx | 144 +----------------- .../src/lib/grid/date-range-filter.tsx | 3 +- libs/react-helpers/src/lib/grid/index.ts | 1 - .../react-helpers/src/lib/grid/set-filter.tsx | 2 +- libs/react-helpers/src/lib/index.ts | 16 -- libs/react-helpers/src/lib/links/index.ts | 1 - libs/react-helpers/src/lib/market-expires.tsx | 65 +------- libs/react-helpers/src/lib/storage/index.ts | 1 - libs/react-helpers/tsconfig.lib.json | 27 +++- libs/react-helpers/tsconfig.spec.json | 5 +- libs/trades/src/lib/trades-container.tsx | 2 +- libs/trades/src/lib/trades-data-provider.ts | 4 +- libs/trades/src/lib/trades-table.spec.tsx | 2 +- libs/trades/src/lib/trades-table.tsx | 2 +- libs/ui-toolkit/.storybook/preview.js | 2 +- .../ag-grid/ag-grid-dynamic-themed.tsx | 2 +- .../ag-grid/ag-grid-lazy-themed.tsx | 2 +- .../async-renderer/async-renderer.tsx | 2 +- .../maintenance-page/maintenance-page.tsx | 2 +- .../price-change/price-change-cell.tsx | 4 +- .../theme-switcher/theme-switcher.tsx | 2 +- .../toast/toasts-container.stories.tsx | 2 +- .../src/components/toast/toasts-container.tsx | 2 +- .../src/components/vega-logo/vega-logo.tsx | 2 +- .../src/components/viewing-as-user/index.tsx | 2 +- libs/ui-toolkit/src/index.ts | 1 + .../src/utils}/cell-class-rules.ts | 0 libs/utils/.babelrc | 10 ++ libs/utils/.eslintrc.json | 18 +++ libs/utils/README.md | 11 ++ libs/utils/jest.config.ts | 15 ++ libs/utils/package.json | 5 + libs/utils/project.json | 45 ++++++ libs/utils/src/index.ts | 19 +++ .../src/lib/apollo-client.ts | 0 .../src/lib/flag-emoji.spec.ts | 0 .../src/lib/flag-emoji.ts | 0 .../src/lib/format/date.ts | 2 +- libs/utils/src/lib/format/index.ts | 4 + libs/utils/src/lib/format/number.ts | 136 +++++++++++++++++ .../src/lib/format/size.ts | 0 .../src/lib/format/strings.spec.ts | 0 .../src/lib/format/strings.ts | 0 .../src/lib/format/utils.ts | 2 - .../src/lib/generic-data-provider.spec.ts | 0 .../src/lib/generic-data-provider.ts | 0 .../src/lib/get-events.ts | 0 .../src/lib/get-nodes.ts | 0 libs/utils/src/lib/get-user-locale.ts | 1 + libs/{react-helpers => utils}/src/lib/i18n.ts | 0 .../src/lib/is-asset-erc20.ts | 0 .../src/lib/is-valid-url.ts | 0 .../src/lib/links => utils/src/lib}/links.ts | 0 .../src/lib/local-logger.spec.ts | 0 .../src/lib/local-logger.ts | 0 .../src/lib}/local-storage.spec.ts | 0 libs/utils/src/lib/local-storage.ts | 28 ++++ libs/utils/src/lib/markets.ts | 64 ++++++++ .../src/lib/pagination.ts | 0 .../src/lib/remove-0x.spec.ts | 0 .../src/lib/remove-0x.ts | 0 .../src/lib/remove-pagination-wrapper.spec.ts | 0 .../src/lib/remove-pagination-wrapper.ts | 0 .../src/lib/time.spec.ts | 0 libs/{react-helpers => utils}/src/lib/time.ts | 0 .../src/lib/validate/common.ts | 2 +- .../src/lib/validate/index.ts | 0 .../src/lib/validate/validate-amount.ts | 2 +- libs/utils/tsconfig.json | 23 +++ libs/utils/tsconfig.lib.json | 10 ++ libs/utils/tsconfig.spec.json | 9 ++ .../connect-dialog-elements.tsx | 2 +- .../connect-dialog/connect-dialog.spec.tsx | 4 +- .../src/connect-dialog/connect-dialog.tsx | 2 +- .../json-rpc-connector-form.tsx | 2 +- .../connect-dialog/rest-connector-form.tsx | 2 +- .../connect-dialog/view-connector-form.tsx | 2 +- .../src/connectors/json-rpc-connector.ts | 2 +- libs/wallet/src/connectors/rest-connector.ts | 2 +- .../src/manage-dialog/manage-dialog.spec.tsx | 2 +- .../src/manage-dialog/manage-dialog.tsx | 2 +- libs/wallet/src/provider.spec.tsx | 2 +- libs/wallet/src/provider.tsx | 2 +- libs/wallet/src/storage.ts | 2 +- libs/wallet/src/utils.ts | 2 +- .../vega-transaction-dialog.tsx | 2 +- .../dialog-rows.tsx | 2 +- .../ethereum-transaction-dialog.tsx | 2 +- libs/web3/src/lib/use-eager-connect.ts | 2 +- libs/web3/src/lib/use-ethereum-config.ts | 2 +- .../web3/src/lib/use-ethereum-transaction.tsx | 2 +- ...hereum-withdraw-approvals-manager.spec.tsx | 4 +- ...se-ethereum-withdraw-approvals-manager.tsx | 4 +- .../src/lib/use-get-withdraw-threshold.tsx | 2 +- libs/web3/src/lib/web3-connect-dialog.tsx | 2 +- .../src/lib/create-withdrawal-dialog.tsx | 2 +- .../src/lib/use-verify-withdrawal.ts | 2 +- libs/withdraws/src/lib/use-withdraw-asset.tsx | 2 +- .../src/lib/withdraw-form-container.tsx | 2 +- libs/withdraws/src/lib/withdraw-form.tsx | 2 +- libs/withdraws/src/lib/withdraw-limits.tsx | 2 +- libs/withdraws/src/lib/withdrawal-dialog.tsx | 2 +- .../withdraws/src/lib/withdrawal-feedback.tsx | 2 +- .../withdraws/src/lib/withdrawals-provider.ts | 7 +- .../src/lib/withdrawals-table.spec.tsx | 2 +- libs/withdraws/src/lib/withdrawals-table.tsx | 2 +- tools/scripts/publish.mjs | 61 ++++++++ tsconfig.base.json | 1 + workspace.json | 1 + 518 files changed, 1010 insertions(+), 810 deletions(-) rename libs/react-helpers/src/{lib/storage/local-storage.ts => hooks/use-local-storage.ts} (72%) delete mode 100644 libs/react-helpers/src/lib/links/index.ts delete mode 100644 libs/react-helpers/src/lib/storage/index.ts rename libs/{react-helpers/src/lib/grid => ui-toolkit/src/utils}/cell-class-rules.ts (100%) create mode 100644 libs/utils/.babelrc create mode 100644 libs/utils/.eslintrc.json create mode 100644 libs/utils/README.md create mode 100644 libs/utils/jest.config.ts create mode 100644 libs/utils/package.json create mode 100644 libs/utils/project.json create mode 100644 libs/utils/src/index.ts rename libs/{react-helpers => utils}/src/lib/apollo-client.ts (100%) rename libs/{react-helpers => utils}/src/lib/flag-emoji.spec.ts (100%) rename libs/{react-helpers => utils}/src/lib/flag-emoji.ts (100%) rename libs/{react-helpers => utils}/src/lib/format/date.ts (96%) create mode 100644 libs/utils/src/lib/format/index.ts create mode 100644 libs/utils/src/lib/format/number.ts rename libs/{react-helpers => utils}/src/lib/format/size.ts (100%) rename libs/{react-helpers => utils}/src/lib/format/strings.spec.ts (100%) rename libs/{react-helpers => utils}/src/lib/format/strings.ts (100%) rename libs/{react-helpers => utils}/src/lib/format/utils.ts (85%) rename libs/{react-helpers => utils}/src/lib/generic-data-provider.spec.ts (100%) rename libs/{react-helpers => utils}/src/lib/generic-data-provider.ts (100%) rename libs/{react-helpers => utils}/src/lib/get-events.ts (100%) rename libs/{react-helpers => utils}/src/lib/get-nodes.ts (100%) create mode 100644 libs/utils/src/lib/get-user-locale.ts rename libs/{react-helpers => utils}/src/lib/i18n.ts (100%) rename libs/{react-helpers => utils}/src/lib/is-asset-erc20.ts (100%) rename libs/{react-helpers => utils}/src/lib/is-valid-url.ts (100%) rename libs/{react-helpers/src/lib/links => utils/src/lib}/links.ts (100%) rename libs/{react-helpers => utils}/src/lib/local-logger.spec.ts (100%) rename libs/{react-helpers => utils}/src/lib/local-logger.ts (100%) rename libs/{react-helpers/src/lib/storage => utils/src/lib}/local-storage.spec.ts (100%) create mode 100644 libs/utils/src/lib/local-storage.ts create mode 100644 libs/utils/src/lib/markets.ts rename libs/{react-helpers => utils}/src/lib/pagination.ts (100%) rename libs/{react-helpers => utils}/src/lib/remove-0x.spec.ts (100%) rename libs/{react-helpers => utils}/src/lib/remove-0x.ts (100%) rename libs/{react-helpers => utils}/src/lib/remove-pagination-wrapper.spec.ts (100%) rename libs/{react-helpers => utils}/src/lib/remove-pagination-wrapper.ts (100%) rename libs/{react-helpers => utils}/src/lib/time.spec.ts (100%) rename libs/{react-helpers => utils}/src/lib/time.ts (100%) rename libs/{react-helpers => utils}/src/lib/validate/common.ts (96%) rename libs/{react-helpers => utils}/src/lib/validate/index.ts (100%) rename libs/{react-helpers => utils}/src/lib/validate/validate-amount.ts (90%) create mode 100644 libs/utils/tsconfig.json create mode 100644 libs/utils/tsconfig.lib.json create mode 100644 libs/utils/tsconfig.spec.json create mode 100644 tools/scripts/publish.mjs diff --git a/apps/explorer/src/app/components/asset-balance/asset-balance.tsx b/apps/explorer/src/app/components/asset-balance/asset-balance.tsx index 7f0b2896d..6a614c4b0 100644 --- a/apps/explorer/src/app/components/asset-balance/asset-balance.tsx +++ b/apps/explorer/src/app/components/asset-balance/asset-balance.tsx @@ -1,5 +1,5 @@ import { useAssetDataProvider } from '@vegaprotocol/assets'; -import { addDecimalsFormatNumber } from '@vegaprotocol/react-helpers'; +import { addDecimalsFormatNumber } from '@vegaprotocol/utils'; import { AssetLink } from '../links'; export type AssetBalanceProps = { diff --git a/apps/explorer/src/app/components/asset-balance/governance-asset-balance.tsx b/apps/explorer/src/app/components/asset-balance/governance-asset-balance.tsx index 11889990c..fe33f36fd 100644 --- a/apps/explorer/src/app/components/asset-balance/governance-asset-balance.tsx +++ b/apps/explorer/src/app/components/asset-balance/governance-asset-balance.tsx @@ -1,4 +1,4 @@ -import { addDecimalsFormatNumber } from '@vegaprotocol/react-helpers'; +import { addDecimalsFormatNumber } from '@vegaprotocol/utils'; import { useExplorerGovernanceAssetQuery } from './__generated__/Governance-asset'; import AssetBalance from './asset-balance'; diff --git a/apps/explorer/src/app/components/assets/assets-table.tsx b/apps/explorer/src/app/components/assets/assets-table.tsx index fb90dd293..4a81ad447 100644 --- a/apps/explorer/src/app/components/assets/assets-table.tsx +++ b/apps/explorer/src/app/components/assets/assets-table.tsx @@ -1,6 +1,6 @@ import type { AssetFieldsFragment } from '@vegaprotocol/assets'; import { AssetTypeMapping, AssetStatusMapping } from '@vegaprotocol/assets'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import type { VegaICellRendererParams } from '@vegaprotocol/ui-toolkit'; import { ButtonLink } from '@vegaprotocol/ui-toolkit'; import type { AgGridReact } from 'ag-grid-react'; diff --git a/apps/explorer/src/app/components/blocks/block-data.tsx b/apps/explorer/src/app/components/blocks/block-data.tsx index 42e2913f7..04d85743f 100644 --- a/apps/explorer/src/app/components/blocks/block-data.tsx +++ b/apps/explorer/src/app/components/blocks/block-data.tsx @@ -2,11 +2,11 @@ import React from 'react'; import type { BlockMeta } from '../../routes/blocks/tendermint-blockchain-response'; import { Routes } from '../../routes/route-names'; import { Link } from 'react-router-dom'; -import { getDateTimeFormat } from '@vegaprotocol/react-helpers'; +import { getDateTimeFormat } from '@vegaprotocol/utils'; import { Tooltip } from '@vegaprotocol/ui-toolkit'; import { TimeAgo } from '../time-ago'; import { TableWithTbody, TableRow, TableCell } from '../table'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; interface BlockProps { block: BlockMeta; diff --git a/apps/explorer/src/app/components/blocks/blocks-data.tsx b/apps/explorer/src/app/components/blocks/blocks-data.tsx index 708f16f75..a352f879e 100644 --- a/apps/explorer/src/app/components/blocks/blocks-data.tsx +++ b/apps/explorer/src/app/components/blocks/blocks-data.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import React from 'react'; import type { TendermintBlockchainResponse } from '../../routes/blocks/tendermint-blockchain-response'; import { BlockData } from './block-data'; diff --git a/apps/explorer/src/app/components/blocks/blocks-infinite-list.tsx b/apps/explorer/src/app/components/blocks/blocks-infinite-list.tsx index f57765c14..70ffbc67e 100644 --- a/apps/explorer/src/app/components/blocks/blocks-infinite-list.tsx +++ b/apps/explorer/src/app/components/blocks/blocks-infinite-list.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { FixedSizeList as List } from 'react-window'; import InfiniteLoader from 'react-window-infinite-loader'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import type { BlockMeta } from '../../routes/blocks/tendermint-blockchain-response'; import { BlockData } from './block-data'; import EmptyList from '../empty-list/empty-list'; diff --git a/apps/explorer/src/app/components/blocks/blocks-refetch.tsx b/apps/explorer/src/app/components/blocks/blocks-refetch.tsx index 08c5c5e00..0b2bbe14e 100644 --- a/apps/explorer/src/app/components/blocks/blocks-refetch.tsx +++ b/apps/explorer/src/app/components/blocks/blocks-refetch.tsx @@ -1,6 +1,6 @@ import { useState, useEffect } from 'react'; import { useTendermintWebsocket } from '../../hooks/use-tendermint-websocket'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { ButtonLink } from '@vegaprotocol/ui-toolkit'; interface BlocksRefetchProps { diff --git a/apps/explorer/src/app/components/dialogs/json-viewer-dialog.tsx b/apps/explorer/src/app/components/dialogs/json-viewer-dialog.tsx index a3c032f4e..80a4d9c52 100644 --- a/apps/explorer/src/app/components/dialogs/json-viewer-dialog.tsx +++ b/apps/explorer/src/app/components/dialogs/json-viewer-dialog.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { Button, Dialog, diff --git a/apps/explorer/src/app/components/epoch-overview/epoch-missing.spec.tsx b/apps/explorer/src/app/components/epoch-overview/epoch-missing.spec.tsx index 5bfa05c36..9537decb8 100644 --- a/apps/explorer/src/app/components/epoch-overview/epoch-missing.spec.tsx +++ b/apps/explorer/src/app/components/epoch-overview/epoch-missing.spec.tsx @@ -1,7 +1,7 @@ import { MockedProvider } from '@apollo/client/testing'; import { render } from '@testing-library/react'; import EpochMissingOverview, { calculateEpochData } from './epoch-missing'; -import { getSecondsFromInterval } from '@vegaprotocol/react-helpers'; +import { getSecondsFromInterval } from '@vegaprotocol/utils'; const START_DATE_PAST = 'Monday, 17 February 2022 11:44:09'; describe('getSecondsFromInterval', () => { diff --git a/apps/explorer/src/app/components/epoch-overview/epoch-missing.tsx b/apps/explorer/src/app/components/epoch-overview/epoch-missing.tsx index 099f93807..88351db2a 100644 --- a/apps/explorer/src/app/components/epoch-overview/epoch-missing.tsx +++ b/apps/explorer/src/app/components/epoch-overview/epoch-missing.tsx @@ -4,8 +4,8 @@ import addSeconds from 'date-fns/addSeconds'; import formatDistance from 'date-fns/formatDistance'; import { Icon, Tooltip } from '@vegaprotocol/ui-toolkit'; import isFuture from 'date-fns/isFuture'; -import { isValidDate } from '@vegaprotocol/react-helpers'; -import { getSecondsFromInterval } from '@vegaprotocol/react-helpers'; +import { isValidDate } from '@vegaprotocol/utils'; +import { getSecondsFromInterval } from '@vegaprotocol/utils'; export type EpochMissingOverviewProps = { missingEpochId?: string; diff --git a/apps/explorer/src/app/components/epoch-overview/epoch.tsx b/apps/explorer/src/app/components/epoch-overview/epoch.tsx index 3321045bb..18d74768c 100644 --- a/apps/explorer/src/app/components/epoch-overview/epoch.tsx +++ b/apps/explorer/src/app/components/epoch-overview/epoch.tsx @@ -1,6 +1,6 @@ import { useExplorerEpochQuery } from './__generated__/Epoch'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { BlockLink } from '../links'; import { Time } from '../time'; import { TimeAgo } from '../time-ago'; diff --git a/apps/explorer/src/app/components/footer/footer.tsx b/apps/explorer/src/app/components/footer/footer.tsx index c44a5b149..90732b9b7 100644 --- a/apps/explorer/src/app/components/footer/footer.tsx +++ b/apps/explorer/src/app/components/footer/footer.tsx @@ -1,5 +1,5 @@ import { NodeSwitcherDialog, useEnvironment } from '@vegaprotocol/environment'; -import { t, useScreenDimensions } from '@vegaprotocol/react-helpers'; +import { t, useScreenDimensions } from '@vegaprotocol/utils'; import { ExternalLink, Link } from '@vegaprotocol/ui-toolkit'; import { useMemo, useState } from 'react'; import { ENV } from '../../config/env'; diff --git a/apps/explorer/src/app/components/header/header.tsx b/apps/explorer/src/app/components/header/header.tsx index 67cc12488..af9b040ca 100644 --- a/apps/explorer/src/app/components/header/header.tsx +++ b/apps/explorer/src/app/components/header/header.tsx @@ -1,7 +1,7 @@ import classnames from 'classnames'; import { Link } from 'react-router-dom'; import { ThemeSwitcher, Icon } from '@vegaprotocol/ui-toolkit'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { Search } from '../search'; import { Routes } from '../../routes/route-names'; import { NetworkSwitcher } from '@vegaprotocol/environment'; diff --git a/apps/explorer/src/app/components/info-panel/info-panel.tsx b/apps/explorer/src/app/components/info-panel/info-panel.tsx index f5a07c811..3c25f64cb 100644 --- a/apps/explorer/src/app/components/info-panel/info-panel.tsx +++ b/apps/explorer/src/app/components/info-panel/info-panel.tsx @@ -9,7 +9,7 @@ import { Tooltip, } from '@vegaprotocol/ui-toolkit'; import { TruncateInline } from '../truncate/truncate'; -import { useScreenDimensions } from '@vegaprotocol/react-helpers'; +import { useScreenDimensions } from '@vegaprotocol/utils'; interface InfoPanelProps { children?: ReactNode | ReactNode[]; diff --git a/apps/explorer/src/app/components/jump-to-block/index.tsx b/apps/explorer/src/app/components/jump-to-block/index.tsx index 41396344d..6bc87fe5a 100644 --- a/apps/explorer/src/app/components/jump-to-block/index.tsx +++ b/apps/explorer/src/app/components/jump-to-block/index.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import React from 'react'; import { useNavigate } from 'react-router-dom'; import { Routes } from '../../routes/route-names'; diff --git a/apps/explorer/src/app/components/jump-to/index.tsx b/apps/explorer/src/app/components/jump-to/index.tsx index 2420e7586..f88e43197 100644 --- a/apps/explorer/src/app/components/jump-to/index.tsx +++ b/apps/explorer/src/app/components/jump-to/index.tsx @@ -1,6 +1,6 @@ import type { HTMLInputTypeAttribute, SyntheticEvent } from 'react'; import { Input, Button } from '@vegaprotocol/ui-toolkit'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; interface JumpToProps { label: string; diff --git a/apps/explorer/src/app/components/links/market-link/market-link.tsx b/apps/explorer/src/app/components/links/market-link/market-link.tsx index 2d02322a2..90070aa09 100644 --- a/apps/explorer/src/app/components/links/market-link/market-link.tsx +++ b/apps/explorer/src/app/components/links/market-link/market-link.tsx @@ -3,7 +3,7 @@ import { useExplorerMarketQuery } from './__generated__/Market'; import { Link } from 'react-router-dom'; import type { ComponentProps } from 'react'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import Hash from '../hash'; export type MarketLinkProps = Partial> & { diff --git a/apps/explorer/src/app/components/links/party-link/party-link.tsx b/apps/explorer/src/app/components/links/party-link/party-link.tsx index 726b323a9..7d79ac871 100644 --- a/apps/explorer/src/app/components/links/party-link/party-link.tsx +++ b/apps/explorer/src/app/components/links/party-link/party-link.tsx @@ -3,7 +3,7 @@ import { Link } from 'react-router-dom'; import type { ComponentProps } from 'react'; import Hash from '../hash'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { isValidPartyId } from '../../../routes/parties/id/components/party-id-error'; import { truncateMiddle } from '@vegaprotocol/ui-toolkit'; diff --git a/apps/explorer/src/app/components/markets/market-details.tsx b/apps/explorer/src/app/components/markets/market-details.tsx index 2b642a6d3..386f7e49f 100644 --- a/apps/explorer/src/app/components/markets/market-details.tsx +++ b/apps/explorer/src/app/components/markets/market-details.tsx @@ -3,7 +3,7 @@ import { formatNumberPercentage, getMarketExpiryDateFormatted, t, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import type { MarketInfoNoCandlesQuery } from '@vegaprotocol/market-info'; import { MarketInfoTable } from '@vegaprotocol/market-info'; import pick from 'lodash/pick'; diff --git a/apps/explorer/src/app/components/markets/markets-table.tsx b/apps/explorer/src/app/components/markets/markets-table.tsx index 680cbaa61..8372f0484 100644 --- a/apps/explorer/src/app/components/markets/markets-table.tsx +++ b/apps/explorer/src/app/components/markets/markets-table.tsx @@ -1,5 +1,5 @@ import type { MarketFieldsFragment } from '@vegaprotocol/market-list'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import type { VegaICellRendererParams, VegaValueGetterParams, diff --git a/apps/explorer/src/app/components/nested-data-list/nested-data-list.tsx b/apps/explorer/src/app/components/nested-data-list/nested-data-list.tsx index 962397053..1e81125ad 100644 --- a/apps/explorer/src/app/components/nested-data-list/nested-data-list.tsx +++ b/apps/explorer/src/app/components/nested-data-list/nested-data-list.tsx @@ -1,7 +1,7 @@ import React, { useCallback, useMemo, useState } from 'react'; import classNames from 'classnames'; import isObject from 'lodash/isObject'; -import { useThemeSwitcher } from '@vegaprotocol/react-helpers'; +import { useThemeSwitcher } from '@vegaprotocol/utils'; import { Icon } from '@vegaprotocol/ui-toolkit'; import { IconNames } from '@blueprintjs/icons'; import { VegaColours } from '@vegaprotocol/tailwindcss-config'; diff --git a/apps/explorer/src/app/components/order-details/amend-order-details.tsx b/apps/explorer/src/app/components/order-details/amend-order-details.tsx index 8d04c2d0a..b9d23ba12 100644 --- a/apps/explorer/src/app/components/order-details/amend-order-details.tsx +++ b/apps/explorer/src/app/components/order-details/amend-order-details.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { useExplorerDeterministicOrderQuery } from './__generated__/Order'; import { MarketLink } from '../links'; import PriceInMarket from '../price-in-market/price-in-market'; diff --git a/apps/explorer/src/app/components/order-details/deterministic-order-details.tsx b/apps/explorer/src/app/components/order-details/deterministic-order-details.tsx index b8f64176a..26c54a916 100644 --- a/apps/explorer/src/app/components/order-details/deterministic-order-details.tsx +++ b/apps/explorer/src/app/components/order-details/deterministic-order-details.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { useExplorerDeterministicOrderQuery } from './__generated__/Order'; import { MarketLink } from '../links'; import PriceInMarket from '../price-in-market/price-in-market'; diff --git a/apps/explorer/src/app/components/order-details/lib/order-labels.tsx b/apps/explorer/src/app/components/order-details/lib/order-labels.tsx index ebb05b41e..f8db901d6 100644 --- a/apps/explorer/src/app/components/order-details/lib/order-labels.tsx +++ b/apps/explorer/src/app/components/order-details/lib/order-labels.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import type * as Schema from '@vegaprotocol/types'; import type { components } from '../../../../types/explorer'; diff --git a/apps/explorer/src/app/components/price-in-market/price-in-market.tsx b/apps/explorer/src/app/components/price-in-market/price-in-market.tsx index a40c67333..4fee9c438 100644 --- a/apps/explorer/src/app/components/price-in-market/price-in-market.tsx +++ b/apps/explorer/src/app/components/price-in-market/price-in-market.tsx @@ -1,4 +1,4 @@ -import { addDecimalsFormatNumber, t } from '@vegaprotocol/react-helpers'; +import { addDecimalsFormatNumber, t } from '@vegaprotocol/utils'; import isUndefined from 'lodash/isUndefined'; import { useExplorerMarketQuery } from '../links/market-link/__generated__/Market'; import get from 'lodash/get'; diff --git a/apps/explorer/src/app/components/proposals/proposals-table.tsx b/apps/explorer/src/app/components/proposals/proposals-table.tsx index 6670fd3c5..1f69e153b 100644 --- a/apps/explorer/src/app/components/proposals/proposals-table.tsx +++ b/apps/explorer/src/app/components/proposals/proposals-table.tsx @@ -15,7 +15,7 @@ import { NetworkParams, t, useNetworkParams, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import { ProposalStateMapping } from '@vegaprotocol/types'; import BigNumber from 'bignumber.js'; import { DApp, TOKEN_PROPOSAL, useLinks } from '@vegaprotocol/environment'; diff --git a/apps/explorer/src/app/components/render-fetched/index.tsx b/apps/explorer/src/app/components/render-fetched/index.tsx index 49a288981..9a36cd26e 100644 --- a/apps/explorer/src/app/components/render-fetched/index.tsx +++ b/apps/explorer/src/app/components/render-fetched/index.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { StatusMessage } from '../status-message'; interface RenderFetchedProps { diff --git a/apps/explorer/src/app/components/router-error-boundary/index.tsx b/apps/explorer/src/app/components/router-error-boundary/index.tsx index 0d4445114..f13df5106 100644 --- a/apps/explorer/src/app/components/router-error-boundary/index.tsx +++ b/apps/explorer/src/app/components/router-error-boundary/index.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import React from 'react'; interface RouteErrorBoundaryProps { diff --git a/apps/explorer/src/app/components/search/search.tsx b/apps/explorer/src/app/components/search/search.tsx index b4603e0c9..7fd160160 100644 --- a/apps/explorer/src/app/components/search/search.tsx +++ b/apps/explorer/src/app/components/search/search.tsx @@ -1,5 +1,5 @@ import { useCallback, useState } from 'react'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { Button, Input, InputError } from '@vegaprotocol/ui-toolkit'; import { useForm } from 'react-hook-form'; import { useNavigate } from 'react-router-dom'; diff --git a/apps/explorer/src/app/components/size-in-asset/size-in-asset.tsx b/apps/explorer/src/app/components/size-in-asset/size-in-asset.tsx index 9f7231621..ba6b06146 100644 --- a/apps/explorer/src/app/components/size-in-asset/size-in-asset.tsx +++ b/apps/explorer/src/app/components/size-in-asset/size-in-asset.tsx @@ -1,5 +1,5 @@ import { useAssetDataProvider } from '@vegaprotocol/assets'; -import { addDecimalsFormatNumber } from '@vegaprotocol/react-helpers'; +import { addDecimalsFormatNumber } from '@vegaprotocol/utils'; import { AssetLink } from '../links'; export type DecimalSource = 'ASSET'; diff --git a/apps/explorer/src/app/components/size-in-market/size-in-market.tsx b/apps/explorer/src/app/components/size-in-market/size-in-market.tsx index 4c993f426..e74382f7b 100644 --- a/apps/explorer/src/app/components/size-in-market/size-in-market.tsx +++ b/apps/explorer/src/app/components/size-in-market/size-in-market.tsx @@ -1,4 +1,4 @@ -import { addDecimalsFormatNumber } from '@vegaprotocol/react-helpers'; +import { addDecimalsFormatNumber } from '@vegaprotocol/utils'; import { useExplorerMarketQuery } from '../links/market-link/__generated__/Market'; export type DecimalSource = 'MARKET'; diff --git a/apps/explorer/src/app/components/time-ago/index.tsx b/apps/explorer/src/app/components/time-ago/index.tsx index e1b4ce672..ceaa96bdd 100644 --- a/apps/explorer/src/app/components/time-ago/index.tsx +++ b/apps/explorer/src/app/components/time-ago/index.tsx @@ -1,5 +1,5 @@ import { formatDistanceToNowStrict } from 'date-fns'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { useEffect, useState } from 'react'; interface TimeAgoProps { diff --git a/apps/explorer/src/app/components/time/index.tsx b/apps/explorer/src/app/components/time/index.tsx index 10e9bc3af..4a8b066b9 100644 --- a/apps/explorer/src/app/components/time/index.tsx +++ b/apps/explorer/src/app/components/time/index.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; interface TimeProps { date: string | null | undefined; diff --git a/apps/explorer/src/app/components/truncate/truncate.tsx b/apps/explorer/src/app/components/truncate/truncate.tsx index 4fdf481f1..39d83022f 100644 --- a/apps/explorer/src/app/components/truncate/truncate.tsx +++ b/apps/explorer/src/app/components/truncate/truncate.tsx @@ -1,4 +1,4 @@ -import { truncateByChars } from '@vegaprotocol/react-helpers'; +import { truncateByChars } from '@vegaprotocol/utils'; import * as React from 'react'; interface TruncateInlineProps { diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-builtin-deposit.spec.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-builtin-deposit.spec.tsx index 8ba5e0fb0..31cee36b8 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-builtin-deposit.spec.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-builtin-deposit.spec.tsx @@ -1,6 +1,6 @@ import { render } from '@testing-library/react'; import { TxDetailsChainEventBuiltinDeposit } from './tx-builtin-deposit'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import type { components } from '../../../../../types/explorer'; import omit from 'lodash/omit'; diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-builtin-deposit.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-builtin-deposit.tsx index 28b97ab5f..d479c2c88 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-builtin-deposit.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-builtin-deposit.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { TableRow, TableCell } from '../../../table'; import type { components } from '../../../../../types/explorer'; import { AssetLink, PartyLink } from '../../../links'; diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-builtin-withdrawal.spec.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-builtin-withdrawal.spec.tsx index 73f572316..8333a91f1 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-builtin-withdrawal.spec.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-builtin-withdrawal.spec.tsx @@ -1,6 +1,6 @@ import { render } from '@testing-library/react'; import { TxDetailsChainEventBuiltinWithdrawal } from './tx-builtin-withdrawal'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import type { components } from '../../../../../types/explorer'; import omit from 'lodash/omit'; diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-builtin-withdrawal.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-builtin-withdrawal.tsx index 06ad25bfb..17c40d1f9 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-builtin-withdrawal.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-builtin-withdrawal.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { TableRow, TableCell } from '../../../table'; import type { components } from '../../../../../types/explorer'; import { AssetLink, PartyLink } from '../../../links'; diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-asset-delist.spec.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-asset-delist.spec.tsx index 1ffc35317..39c44ff05 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-asset-delist.spec.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-asset-delist.spec.tsx @@ -1,5 +1,5 @@ import { render } from '@testing-library/react'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import type { components } from '../../../../../types/explorer'; import omit from 'lodash/omit'; diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-asset-delist.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-asset-delist.tsx index f0143f8f8..2ac247945 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-asset-delist.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-asset-delist.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { TableRow, TableCell } from '../../../table'; import type { components } from '../../../../../types/explorer'; import { AssetLink } from '../../../links'; diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-asset-limits-updated.spec.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-asset-limits-updated.spec.tsx index bd8ee5408..0d349bbbe 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-asset-limits-updated.spec.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-asset-limits-updated.spec.tsx @@ -1,5 +1,5 @@ import { render } from '@testing-library/react'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import type { components } from '../../../../../types/explorer'; import omit from 'lodash/omit'; diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-asset-limits-updated.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-asset-limits-updated.tsx index f359cea53..30fb1b01e 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-asset-limits-updated.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-asset-limits-updated.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { TableRow, TableCell } from '../../../table'; import type { components } from '../../../../../types/explorer'; import { AssetLink } from '../../../links'; diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-asset-list.spec.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-asset-list.spec.tsx index ef6436853..d83020582 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-asset-list.spec.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-asset-list.spec.tsx @@ -1,5 +1,5 @@ import { render } from '@testing-library/react'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import type { components } from '../../../../../types/explorer'; import omit from 'lodash/omit'; diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-asset-list.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-asset-list.tsx index 537468fe2..376aac80b 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-asset-list.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-asset-list.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { TableRow, TableCell } from '../../../table'; import type { components } from '../../../../../types/explorer'; import { AssetLink } from '../../../links'; diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-bridge-pause.spec.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-bridge-pause.spec.tsx index b8db75286..b5b10a89d 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-bridge-pause.spec.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-bridge-pause.spec.tsx @@ -1,5 +1,5 @@ import { render } from '@testing-library/react'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { TxDetailsChainEventErc20BridgePause } from './tx-erc20-bridge-pause'; describe('Chain Event: ERC20 bridge pause', () => { diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-bridge-pause.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-bridge-pause.tsx index 6217fb082..5c4cb4b2f 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-bridge-pause.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-bridge-pause.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { TableRow, TableCell } from '../../../table'; export interface TxDetailsChainEventErc20BridgePauseProps { diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-deposit.spec.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-deposit.spec.tsx index 9452f615e..cf0908bf9 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-deposit.spec.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-deposit.spec.tsx @@ -1,5 +1,5 @@ import { render } from '@testing-library/react'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import type { components } from '../../../../../types/explorer'; import omit from 'lodash/omit'; diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-deposit.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-deposit.tsx index f7495a266..c7204a8d6 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-deposit.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-deposit.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { TableRow, TableCell } from '../../../table'; import type { components } from '../../../../../types/explorer'; import { AssetLink, PartyLink } from '../../../links'; diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-withdrawal.spec.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-withdrawal.spec.tsx index b44926c44..9a13947f0 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-withdrawal.spec.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-withdrawal.spec.tsx @@ -1,5 +1,5 @@ import { render } from '@testing-library/react'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import type { components } from '../../../../../types/explorer'; import omit from 'lodash/omit'; diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-withdrawal.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-withdrawal.tsx index 034d78f55..c05d62cdb 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-withdrawal.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-withdrawal.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { TableRow, TableCell } from '../../../table'; import type { components } from '../../../../../types/explorer'; import { AssetLink } from '../../../links'; diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-multisig-signer.spec.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-multisig-signer.spec.tsx index 039e11520..ef0ad80d6 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-multisig-signer.spec.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-multisig-signer.spec.tsx @@ -1,5 +1,5 @@ import { render } from '@testing-library/react'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import type { components } from '../../../../../types/explorer'; import { MockedProvider } from '@apollo/client/testing'; diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-multisig-signer.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-multisig-signer.tsx index 9a0f9a115..3a676d95a 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-multisig-signer.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-multisig-signer.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { TableRow, TableCell } from '../../../table'; import type { components } from '../../../../../types/explorer'; import { getBlockTime } from './lib/get-block-time'; diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-multisig-threshold.spec.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-multisig-threshold.spec.tsx index 1bfd31d06..f1d9aaa2e 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-multisig-threshold.spec.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-multisig-threshold.spec.tsx @@ -1,5 +1,5 @@ import { render } from '@testing-library/react'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import type { components } from '../../../../../types/explorer'; import { MockedProvider } from '@apollo/client/testing'; diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-multisig-threshold.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-multisig-threshold.tsx index c225b82b1..e69d8c213 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-multisig-threshold.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-multisig-threshold.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { TableRow, TableCell } from '../../../table'; import type { components } from '../../../../../types/explorer'; import isNumber from 'lodash/isNumber'; diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-stake-deposit.spec.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-stake-deposit.spec.tsx index 2f00e0314..43613188b 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-stake-deposit.spec.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-stake-deposit.spec.tsx @@ -1,5 +1,5 @@ import { render } from '@testing-library/react'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import type { components } from '../../../../../types/explorer'; import omit from 'lodash/omit'; diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-stake-deposit.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-stake-deposit.tsx index 8e4bbb185..b2a9a92c5 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-stake-deposit.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-stake-deposit.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { TableRow, TableCell } from '../../../table'; import type { components } from '../../../../../types/explorer'; import { PartyLink } from '../../../links'; diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-stake-remove.spec.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-stake-remove.spec.tsx index 555049abf..e5f385675 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-stake-remove.spec.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-stake-remove.spec.tsx @@ -1,5 +1,5 @@ import { render } from '@testing-library/react'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import type { components } from '../../../../../types/explorer'; import omit from 'lodash/omit'; diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-stake-remove.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-stake-remove.tsx index f3a60d424..b4a24033f 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-stake-remove.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-stake-remove.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { TableRow, TableCell } from '../../../table'; import type { components } from '../../../../../types/explorer'; import { PartyLink } from '../../../links'; diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-stake-totalsupply.spec.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-stake-totalsupply.spec.tsx index cc840655e..f7800dc7b 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-stake-totalsupply.spec.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-stake-totalsupply.spec.tsx @@ -1,5 +1,5 @@ import { render } from '@testing-library/react'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import type { components } from '../../../../../types/explorer'; import omit from 'lodash/omit'; diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-stake-totalsupply.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-stake-totalsupply.tsx index a423735ba..5859f9bd6 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-stake-totalsupply.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-stake-totalsupply.tsx @@ -1,4 +1,4 @@ -import { formatNumber, t, toBigNum } from '@vegaprotocol/react-helpers'; +import { formatNumber, t, toBigNum } from '@vegaprotocol/utils'; import { TableRow, TableCell } from '../../../table'; import type { components } from '../../../../../types/explorer'; import { diff --git a/apps/explorer/src/app/components/txs/details/liquidity-provision/components/liquidity-provision-details-row.tsx b/apps/explorer/src/app/components/txs/details/liquidity-provision/components/liquidity-provision-details-row.tsx index 3c7eb29fb..bc4f5306a 100644 --- a/apps/explorer/src/app/components/txs/details/liquidity-provision/components/liquidity-provision-details-row.tsx +++ b/apps/explorer/src/app/components/txs/details/liquidity-provision/components/liquidity-provision-details-row.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import type { components } from '../../../../../../types/explorer'; import { TableRow } from '../../../../table'; diff --git a/apps/explorer/src/app/components/txs/details/liquidity-provision/components/liquidity-provision-offset.tsx b/apps/explorer/src/app/components/txs/details/liquidity-provision/components/liquidity-provision-offset.tsx index e43a053d4..cad1e7019 100644 --- a/apps/explorer/src/app/components/txs/details/liquidity-provision/components/liquidity-provision-offset.tsx +++ b/apps/explorer/src/app/components/txs/details/liquidity-provision/components/liquidity-provision-offset.tsx @@ -1,5 +1,5 @@ import { useExplorerSettlementAssetForMarketQuery } from '../__generated__/Explorer-settlement-asset'; -import { addDecimalsFormatNumber } from '@vegaprotocol/react-helpers'; +import { addDecimalsFormatNumber } from '@vegaprotocol/utils'; import type { ExplorerSettlementAssetForMarketQuery } from '../__generated__/Explorer-settlement-asset'; import type { VegaSide } from './liquidity-provision-details-row'; diff --git a/apps/explorer/src/app/components/txs/details/liquidity-provision/liquidity-provision-details.tsx b/apps/explorer/src/app/components/txs/details/liquidity-provision/liquidity-provision-details.tsx index e9c9c4ff3..e4c80ed33 100644 --- a/apps/explorer/src/app/components/txs/details/liquidity-provision/liquidity-provision-details.tsx +++ b/apps/explorer/src/app/components/txs/details/liquidity-provision/liquidity-provision-details.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import type { components } from '../../../../../types/explorer'; import type { LiquiditySubmission } from '../tx-liquidity-submission'; diff --git a/apps/explorer/src/app/components/txs/details/oracle-data/data-submission-json-oracle.tsx b/apps/explorer/src/app/components/txs/details/oracle-data/data-submission-json-oracle.tsx index 06562c2a1..11e7a05ca 100644 --- a/apps/explorer/src/app/components/txs/details/oracle-data/data-submission-json-oracle.tsx +++ b/apps/explorer/src/app/components/txs/details/oracle-data/data-submission-json-oracle.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; interface JSONOracleDataProps { payload: string; diff --git a/apps/explorer/src/app/components/txs/details/oracle-data/data-submission-open-oracle.tsx b/apps/explorer/src/app/components/txs/details/oracle-data/data-submission-open-oracle.tsx index 4b312e341..e2b2d0488 100644 --- a/apps/explorer/src/app/components/txs/details/oracle-data/data-submission-open-oracle.tsx +++ b/apps/explorer/src/app/components/txs/details/oracle-data/data-submission-open-oracle.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { NestedDataList } from '../../../nested-data-list'; import { OpenOraclePrices } from './open-oracle/open-oracle-prices'; diff --git a/apps/explorer/src/app/components/txs/details/oracle-data/open-oracle/open-oracle-prices.tsx b/apps/explorer/src/app/components/txs/details/oracle-data/open-oracle/open-oracle-prices.tsx index 4b7199e65..57de57364 100644 --- a/apps/explorer/src/app/components/txs/details/oracle-data/open-oracle/open-oracle-prices.tsx +++ b/apps/explorer/src/app/components/txs/details/oracle-data/open-oracle/open-oracle-prices.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { CopyWithTooltip } from '@vegaprotocol/ui-toolkit'; import { TableRow } from '../../../../table'; import { TruncateInline } from '../../../../truncate/truncate'; diff --git a/apps/explorer/src/app/components/txs/details/shared/tx-details-shared.tsx b/apps/explorer/src/app/components/txs/details/shared/tx-details-shared.tsx index e7c892afc..c6e697370 100644 --- a/apps/explorer/src/app/components/txs/details/shared/tx-details-shared.tsx +++ b/apps/explorer/src/app/components/txs/details/shared/tx-details-shared.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { TableRow, TableCell } from '../../../table'; import { BlockLink, PartyLink } from '../../../links/'; import { TimeAgo } from '../../../time-ago'; diff --git a/apps/explorer/src/app/components/txs/details/state-variable/bound-factors.tsx b/apps/explorer/src/app/components/txs/details/state-variable/bound-factors.tsx index 8260ec21e..1b01dc180 100644 --- a/apps/explorer/src/app/components/txs/details/state-variable/bound-factors.tsx +++ b/apps/explorer/src/app/components/txs/details/state-variable/bound-factors.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import type { components } from '../../../../../types/explorer'; import { Table, TableRow, TableHeader, TableCell } from '../../../table'; diff --git a/apps/explorer/src/app/components/txs/details/state-variable/risk-factors.tsx b/apps/explorer/src/app/components/txs/details/state-variable/risk-factors.tsx index e211f4f71..a295cfd35 100644 --- a/apps/explorer/src/app/components/txs/details/state-variable/risk-factors.tsx +++ b/apps/explorer/src/app/components/txs/details/state-variable/risk-factors.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import zip from 'lodash/zip'; import type { components } from '../../../../../types/explorer'; import { Table, TableRow, TableHeader, TableCell } from '../../../table'; diff --git a/apps/explorer/src/app/components/txs/details/state-variable/trading-probability.tsx b/apps/explorer/src/app/components/txs/details/state-variable/trading-probability.tsx index f66a50432..e71668418 100644 --- a/apps/explorer/src/app/components/txs/details/state-variable/trading-probability.tsx +++ b/apps/explorer/src/app/components/txs/details/state-variable/trading-probability.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import type { components } from '../../../../../types/explorer'; import { Table, TableRow, TableHeader, TableCell } from '../../../table'; import { getValues } from './bound-factors'; diff --git a/apps/explorer/src/app/components/txs/details/transfer/blocks/transfer-participants.tsx b/apps/explorer/src/app/components/txs/details/transfer/blocks/transfer-participants.tsx index c49ae257b..d639b78ce 100644 --- a/apps/explorer/src/app/components/txs/details/transfer/blocks/transfer-participants.tsx +++ b/apps/explorer/src/app/components/txs/details/transfer/blocks/transfer-participants.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { Icon, Tooltip } from '@vegaprotocol/ui-toolkit'; import { PartyLink } from '../../../../links'; import { diff --git a/apps/explorer/src/app/components/txs/details/transfer/blocks/transfer-repeat.tsx b/apps/explorer/src/app/components/txs/details/transfer/blocks/transfer-repeat.tsx index e29cf25ed..6dce214fc 100644 --- a/apps/explorer/src/app/components/txs/details/transfer/blocks/transfer-repeat.tsx +++ b/apps/explorer/src/app/components/txs/details/transfer/blocks/transfer-repeat.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { Icon } from '@vegaprotocol/ui-toolkit'; import EpochOverview from '../../../../epoch-overview/epoch'; import { useExplorerFutureEpochQuery } from '../../../../epoch-overview/__generated__/Epoch'; diff --git a/apps/explorer/src/app/components/txs/details/transfer/blocks/transfer-rewards.tsx b/apps/explorer/src/app/components/txs/details/transfer/blocks/transfer-rewards.tsx index b9d9bb710..fb39f1119 100644 --- a/apps/explorer/src/app/components/txs/details/transfer/blocks/transfer-rewards.tsx +++ b/apps/explorer/src/app/components/txs/details/transfer/blocks/transfer-rewards.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { AssetLink, MarketLink } from '../../../../links'; import { headerClasses, wrapperClasses } from '../transfer-details'; import type { components } from '../../../../../../types/explorer'; diff --git a/apps/explorer/src/app/components/txs/details/tx-batch.tsx b/apps/explorer/src/app/components/txs/details/tx-batch.tsx index 6272192c0..7b93124c6 100644 --- a/apps/explorer/src/app/components/txs/details/tx-batch.tsx +++ b/apps/explorer/src/app/components/txs/details/tx-batch.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import type { BatchCancellationInstruction, BatchInstruction, diff --git a/apps/explorer/src/app/components/txs/details/tx-chain-event.tsx b/apps/explorer/src/app/components/txs/details/tx-chain-event.tsx index 5de5a5782..b02f35271 100644 --- a/apps/explorer/src/app/components/txs/details/tx-chain-event.tsx +++ b/apps/explorer/src/app/components/txs/details/tx-chain-event.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { TxDetailsShared } from './shared/tx-details-shared'; import { TableWithTbody } from '../../table'; diff --git a/apps/explorer/src/app/components/txs/details/tx-data-submission.tsx b/apps/explorer/src/app/components/txs/details/tx-data-submission.tsx index e3a994d7b..8cc6ca2cf 100644 --- a/apps/explorer/src/app/components/txs/details/tx-data-submission.tsx +++ b/apps/explorer/src/app/components/txs/details/tx-data-submission.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import type { BlockExplorerTransactionResult } from '../../../routes/types/block-explorer-response'; import type { TendermintBlocksResponse } from '../../../routes/blocks/tendermint-blocks-response'; import { TxDetailsShared } from './shared/tx-details-shared'; diff --git a/apps/explorer/src/app/components/txs/details/tx-delegation.tsx b/apps/explorer/src/app/components/txs/details/tx-delegation.tsx index 4dfe1c553..81456e3fa 100644 --- a/apps/explorer/src/app/components/txs/details/tx-delegation.tsx +++ b/apps/explorer/src/app/components/txs/details/tx-delegation.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import type { BlockExplorerTransactionResult } from '../../../routes/types/block-explorer-response'; import type { TendermintBlocksResponse } from '../../../routes/blocks/tendermint-blocks-response'; import { TxDetailsShared } from './shared/tx-details-shared'; diff --git a/apps/explorer/src/app/components/txs/details/tx-details-protocol-upgrade.tsx b/apps/explorer/src/app/components/txs/details/tx-details-protocol-upgrade.tsx index 3002e2393..d687c38ae 100644 --- a/apps/explorer/src/app/components/txs/details/tx-details-protocol-upgrade.tsx +++ b/apps/explorer/src/app/components/txs/details/tx-details-protocol-upgrade.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { TxDetailsShared } from './shared/tx-details-shared'; import { TableCell, TableRow, TableWithTbody } from '../../table'; import { BlockLink } from '../../links'; diff --git a/apps/explorer/src/app/components/txs/details/tx-details-wrapper.tsx b/apps/explorer/src/app/components/txs/details/tx-details-wrapper.tsx index 23aaf671f..0a4285885 100644 --- a/apps/explorer/src/app/components/txs/details/tx-details-wrapper.tsx +++ b/apps/explorer/src/app/components/txs/details/tx-details-wrapper.tsx @@ -1,6 +1,6 @@ import { useMemo } from 'react'; import { DATA_SOURCES } from '../../../config'; -import { t, useFetch } from '@vegaprotocol/react-helpers'; +import { t, useFetch } from '@vegaprotocol/utils'; import { TxDetailsOrder } from './tx-order'; import type { BlockExplorerTransactionResult } from '../../../routes/types/block-explorer-response'; import type { TendermintBlocksResponse } from '../../../routes/blocks/tendermint-blocks-response'; diff --git a/apps/explorer/src/app/components/txs/details/tx-eth-key-rotate.tsx b/apps/explorer/src/app/components/txs/details/tx-eth-key-rotate.tsx index a38258838..f7b0592c7 100644 --- a/apps/explorer/src/app/components/txs/details/tx-eth-key-rotate.tsx +++ b/apps/explorer/src/app/components/txs/details/tx-eth-key-rotate.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import type { BlockExplorerTransactionResult } from '../../../routes/types/block-explorer-response'; import type { TendermintBlocksResponse } from '../../../routes/blocks/tendermint-blocks-response'; import { TxDetailsShared } from './shared/tx-details-shared'; diff --git a/apps/explorer/src/app/components/txs/details/tx-generic.tsx b/apps/explorer/src/app/components/txs/details/tx-generic.tsx index 21efd825c..674262b4c 100644 --- a/apps/explorer/src/app/components/txs/details/tx-generic.tsx +++ b/apps/explorer/src/app/components/txs/details/tx-generic.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import type { BlockExplorerTransactionResult } from '../../../routes/types/block-explorer-response'; import type { TendermintBlocksResponse } from '../../../routes/blocks/tendermint-blocks-response'; import { TxDetailsShared } from './shared/tx-details-shared'; diff --git a/apps/explorer/src/app/components/txs/details/tx-hearbeat.tsx b/apps/explorer/src/app/components/txs/details/tx-hearbeat.tsx index b5204e0a5..eb2ffb797 100644 --- a/apps/explorer/src/app/components/txs/details/tx-hearbeat.tsx +++ b/apps/explorer/src/app/components/txs/details/tx-hearbeat.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import type { BlockExplorerTransactionResult } from '../../../routes/types/block-explorer-response'; import { BlockLink, NodeLink } from '../../links/'; import type { TendermintBlocksResponse } from '../../../routes/blocks/tendermint-blocks-response'; diff --git a/apps/explorer/src/app/components/txs/details/tx-issue-signatures.tsx b/apps/explorer/src/app/components/txs/details/tx-issue-signatures.tsx index a3c55929a..99d78e98f 100644 --- a/apps/explorer/src/app/components/txs/details/tx-issue-signatures.tsx +++ b/apps/explorer/src/app/components/txs/details/tx-issue-signatures.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import type { BlockExplorerTransactionResult } from '../../../routes/types/block-explorer-response'; import type { TendermintBlocksResponse } from '../../../routes/blocks/tendermint-blocks-response'; import { TxDetailsShared } from './shared/tx-details-shared'; diff --git a/apps/explorer/src/app/components/txs/details/tx-key-rotate.tsx b/apps/explorer/src/app/components/txs/details/tx-key-rotate.tsx index 35dd80725..d526cca82 100644 --- a/apps/explorer/src/app/components/txs/details/tx-key-rotate.tsx +++ b/apps/explorer/src/app/components/txs/details/tx-key-rotate.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import type { BlockExplorerTransactionResult } from '../../../routes/types/block-explorer-response'; import type { TendermintBlocksResponse } from '../../../routes/blocks/tendermint-blocks-response'; import { TxDetailsShared } from './shared/tx-details-shared'; diff --git a/apps/explorer/src/app/components/txs/details/tx-liquidity-amend.tsx b/apps/explorer/src/app/components/txs/details/tx-liquidity-amend.tsx index 7e06b47fc..ebc0166fd 100644 --- a/apps/explorer/src/app/components/txs/details/tx-liquidity-amend.tsx +++ b/apps/explorer/src/app/components/txs/details/tx-liquidity-amend.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import type { BlockExplorerTransactionResult } from '../../../routes/types/block-explorer-response'; import { MarketLink } from '../../links'; import type { TendermintBlocksResponse } from '../../../routes/blocks/tendermint-blocks-response'; diff --git a/apps/explorer/src/app/components/txs/details/tx-liquidity-cancel.tsx b/apps/explorer/src/app/components/txs/details/tx-liquidity-cancel.tsx index 4dfe1d21b..a9991f235 100644 --- a/apps/explorer/src/app/components/txs/details/tx-liquidity-cancel.tsx +++ b/apps/explorer/src/app/components/txs/details/tx-liquidity-cancel.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { MarketLink } from '../../links'; import { TxDetailsShared } from './shared/tx-details-shared'; import { TableCell, TableRow, TableWithTbody } from '../../table'; diff --git a/apps/explorer/src/app/components/txs/details/tx-liquidity-submission.tsx b/apps/explorer/src/app/components/txs/details/tx-liquidity-submission.tsx index a0d513c8b..a47ffa7d7 100644 --- a/apps/explorer/src/app/components/txs/details/tx-liquidity-submission.tsx +++ b/apps/explorer/src/app/components/txs/details/tx-liquidity-submission.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import type { BlockExplorerTransactionResult } from '../../../routes/types/block-explorer-response'; import { MarketLink } from '../../links/'; import type { TendermintBlocksResponse } from '../../../routes/blocks/tendermint-blocks-response'; diff --git a/apps/explorer/src/app/components/txs/details/tx-node-announce.tsx b/apps/explorer/src/app/components/txs/details/tx-node-announce.tsx index 7c8add106..2caf52ff4 100644 --- a/apps/explorer/src/app/components/txs/details/tx-node-announce.tsx +++ b/apps/explorer/src/app/components/txs/details/tx-node-announce.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import type { BlockExplorerTransactionResult } from '../../../routes/types/block-explorer-response'; import type { TendermintBlocksResponse } from '../../../routes/blocks/tendermint-blocks-response'; import { TxDetailsShared } from './shared/tx-details-shared'; diff --git a/apps/explorer/src/app/components/txs/details/tx-node-vote.tsx b/apps/explorer/src/app/components/txs/details/tx-node-vote.tsx index db140cb33..3628cd6ac 100644 --- a/apps/explorer/src/app/components/txs/details/tx-node-vote.tsx +++ b/apps/explorer/src/app/components/txs/details/tx-node-vote.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import type { BlockExplorerTransactionResult } from '../../../routes/types/block-explorer-response'; import type { TendermintBlocksResponse } from '../../../routes/blocks/tendermint-blocks-response'; import { TxDetailsShared } from './shared/tx-details-shared'; diff --git a/apps/explorer/src/app/components/txs/details/tx-order-amend.tsx b/apps/explorer/src/app/components/txs/details/tx-order-amend.tsx index 4dc5c95e9..f4e53d793 100644 --- a/apps/explorer/src/app/components/txs/details/tx-order-amend.tsx +++ b/apps/explorer/src/app/components/txs/details/tx-order-amend.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import type { BlockExplorerTransactionResult } from '../../../routes/types/block-explorer-response'; import { MarketLink } from '../../links'; import type { TendermintBlocksResponse } from '../../../routes/blocks/tendermint-blocks-response'; diff --git a/apps/explorer/src/app/components/txs/details/tx-order-cancel.tsx b/apps/explorer/src/app/components/txs/details/tx-order-cancel.tsx index 3d38d876c..00a1b2e8c 100644 --- a/apps/explorer/src/app/components/txs/details/tx-order-cancel.tsx +++ b/apps/explorer/src/app/components/txs/details/tx-order-cancel.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import type { BlockExplorerTransactionResult } from '../../../routes/types/block-explorer-response'; import { MarketLink } from '../../links/'; import type { TendermintBlocksResponse } from '../../../routes/blocks/tendermint-blocks-response'; diff --git a/apps/explorer/src/app/components/txs/details/tx-order.tsx b/apps/explorer/src/app/components/txs/details/tx-order.tsx index bc7e685ae..214adc557 100644 --- a/apps/explorer/src/app/components/txs/details/tx-order.tsx +++ b/apps/explorer/src/app/components/txs/details/tx-order.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import type { BlockExplorerTransactionResult } from '../../../routes/types/block-explorer-response'; import { MarketLink } from '../../links/'; import type { TendermintBlocksResponse } from '../../../routes/blocks/tendermint-blocks-response'; diff --git a/apps/explorer/src/app/components/txs/details/tx-proposal-vote.tsx b/apps/explorer/src/app/components/txs/details/tx-proposal-vote.tsx index d4c82055a..5f2cc3bca 100644 --- a/apps/explorer/src/app/components/txs/details/tx-proposal-vote.tsx +++ b/apps/explorer/src/app/components/txs/details/tx-proposal-vote.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import type { BlockExplorerTransactionResult } from '../../../routes/types/block-explorer-response'; import type { TendermintBlocksResponse } from '../../../routes/blocks/tendermint-blocks-response'; import { TxDetailsShared } from './shared/tx-details-shared'; diff --git a/apps/explorer/src/app/components/txs/details/tx-state-variable-proposal.tsx b/apps/explorer/src/app/components/txs/details/tx-state-variable-proposal.tsx index 0f131360b..779d7e01e 100644 --- a/apps/explorer/src/app/components/txs/details/tx-state-variable-proposal.tsx +++ b/apps/explorer/src/app/components/txs/details/tx-state-variable-proposal.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { TxDetailsShared } from './shared/tx-details-shared'; import { TableCell, TableRow, TableWithTbody } from '../../table'; import { MarketLink } from '../../links'; diff --git a/apps/explorer/src/app/components/txs/details/tx-transfer.tsx b/apps/explorer/src/app/components/txs/details/tx-transfer.tsx index 9329abc27..cd89db27c 100644 --- a/apps/explorer/src/app/components/txs/details/tx-transfer.tsx +++ b/apps/explorer/src/app/components/txs/details/tx-transfer.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import type { BlockExplorerTransactionResult } from '../../../routes/types/block-explorer-response'; import type { TendermintBlocksResponse } from '../../../routes/blocks/tendermint-blocks-response'; import { sharedHeaderProps, TxDetailsShared } from './shared/tx-details-shared'; diff --git a/apps/explorer/src/app/components/txs/details/tx-undelegation.tsx b/apps/explorer/src/app/components/txs/details/tx-undelegation.tsx index 4fc4875f2..f242a9100 100644 --- a/apps/explorer/src/app/components/txs/details/tx-undelegation.tsx +++ b/apps/explorer/src/app/components/txs/details/tx-undelegation.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import type { BlockExplorerTransactionResult } from '../../../routes/types/block-explorer-response'; import type { TendermintBlocksResponse } from '../../../routes/blocks/tendermint-blocks-response'; import { TxDetailsShared } from './shared/tx-details-shared'; diff --git a/apps/explorer/src/app/components/txs/details/tx-withdraw-submission.tsx b/apps/explorer/src/app/components/txs/details/tx-withdraw-submission.tsx index 7ecb5deab..e8bd91f99 100644 --- a/apps/explorer/src/app/components/txs/details/tx-withdraw-submission.tsx +++ b/apps/explorer/src/app/components/txs/details/tx-withdraw-submission.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import type { BlockExplorerTransactionResult } from '../../../routes/types/block-explorer-response'; import type { TendermintBlocksResponse } from '../../../routes/blocks/tendermint-blocks-response'; import { TxDetailsShared } from './shared/tx-details-shared'; diff --git a/apps/explorer/src/app/components/txs/tx-data-view.tsx b/apps/explorer/src/app/components/txs/tx-data-view.tsx index 5370b5aa9..39eefbdfe 100644 --- a/apps/explorer/src/app/components/txs/tx-data-view.tsx +++ b/apps/explorer/src/app/components/txs/tx-data-view.tsx @@ -1,5 +1,5 @@ import { useState } from 'react'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import get from 'lodash/get'; import { Select } from '@vegaprotocol/ui-toolkit'; diff --git a/apps/explorer/src/app/components/txs/tx-list.tsx b/apps/explorer/src/app/components/txs/tx-list.tsx index cd55be663..0e92dc3f4 100644 --- a/apps/explorer/src/app/components/txs/tx-list.tsx +++ b/apps/explorer/src/app/components/txs/tx-list.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import type { TendermintUnconfirmedTransactionsResponse } from '../../routes/txs/tendermint-unconfirmed-transactions-response.d'; interface TxsProps { diff --git a/apps/explorer/src/app/components/txs/tx-order-type.tsx b/apps/explorer/src/app/components/txs/tx-order-type.tsx index 41ef7b68e..ccaa97bc8 100644 --- a/apps/explorer/src/app/components/txs/tx-order-type.tsx +++ b/apps/explorer/src/app/components/txs/tx-order-type.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import type { components } from '../../../types/explorer'; interface TxOrderTypeProps { diff --git a/apps/explorer/src/app/components/txs/txs-infinite-list.tsx b/apps/explorer/src/app/components/txs/txs-infinite-list.tsx index 1ca72187d..ab34169d6 100644 --- a/apps/explorer/src/app/components/txs/txs-infinite-list.tsx +++ b/apps/explorer/src/app/components/txs/txs-infinite-list.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { FixedSizeList as List } from 'react-window'; import InfiniteLoader from 'react-window-infinite-loader'; -import { t, useScreenDimensions } from '@vegaprotocol/react-helpers'; +import { t, useScreenDimensions } from '@vegaprotocol/utils'; import { TxsInfiniteListItem } from './txs-infinite-list-item'; import type { BlockExplorerTransactionResult } from '../../routes/types/block-explorer-response'; import EmptyList from '../empty-list/empty-list'; diff --git a/apps/explorer/src/app/components/txs/txs-per-block.tsx b/apps/explorer/src/app/components/txs/txs-per-block.tsx index afd1e0a19..62c5da859 100644 --- a/apps/explorer/src/app/components/txs/txs-per-block.tsx +++ b/apps/explorer/src/app/components/txs/txs-per-block.tsx @@ -3,7 +3,7 @@ import { RenderFetched } from '../render-fetched'; import { TruncatedLink } from '../truncate/truncated-link'; import { TxOrderType } from './tx-order-type'; import { Table, TableRow, TableCell } from '../table'; -import { t, useFetch } from '@vegaprotocol/react-helpers'; +import { t, useFetch } from '@vegaprotocol/utils'; import type { BlockExplorerTransactions } from '../../routes/types/block-explorer-response'; import isNumber from 'lodash/isNumber'; import { ChainResponseCode } from './details/chain-response-code/chain-reponse.code'; diff --git a/apps/explorer/src/app/components/withdrawal/withdrawal-progress.tsx b/apps/explorer/src/app/components/withdrawal/withdrawal-progress.tsx index c59628310..b3895061f 100644 --- a/apps/explorer/src/app/components/withdrawal/withdrawal-progress.tsx +++ b/apps/explorer/src/app/components/withdrawal/withdrawal-progress.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import type { ReactNode } from 'react'; import { Time } from '../time'; import { useExplorerWithdrawalQuery } from './__generated__/Withdrawal'; diff --git a/apps/explorer/src/app/hooks/use-txs-data.ts b/apps/explorer/src/app/hooks/use-txs-data.ts index ebdd47c26..ae5a6061f 100644 --- a/apps/explorer/src/app/hooks/use-txs-data.ts +++ b/apps/explorer/src/app/hooks/use-txs-data.ts @@ -1,5 +1,5 @@ import { useCallback, useEffect, useState } from 'react'; -import { useFetch } from '@vegaprotocol/react-helpers'; +import { useFetch } from '@vegaprotocol/utils'; import type { BlockExplorerTransactionResult, BlockExplorerTransactions, diff --git a/apps/explorer/src/app/routes/assets/asset-page.tsx b/apps/explorer/src/app/routes/assets/asset-page.tsx index d3b3cac3b..b867c6886 100644 --- a/apps/explorer/src/app/routes/assets/asset-page.tsx +++ b/apps/explorer/src/app/routes/assets/asset-page.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { AsyncRenderer, Button } from '@vegaprotocol/ui-toolkit'; import { useScrollToLocation } from '../../hooks/scroll-to-location'; import { useDocumentTitle } from '../../hooks/use-document-title'; diff --git a/apps/explorer/src/app/routes/assets/assets-page.tsx b/apps/explorer/src/app/routes/assets/assets-page.tsx index 72f42d046..1adfbe31b 100644 --- a/apps/explorer/src/app/routes/assets/assets-page.tsx +++ b/apps/explorer/src/app/routes/assets/assets-page.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { RouteTitle } from '../../components/route-title'; import { AsyncRenderer } from '@vegaprotocol/ui-toolkit'; import { useScrollToLocation } from '../../hooks/scroll-to-location'; diff --git a/apps/explorer/src/app/routes/blocks/home/index.tsx b/apps/explorer/src/app/routes/blocks/home/index.tsx index c742cab5e..aad038590 100644 --- a/apps/explorer/src/app/routes/blocks/home/index.tsx +++ b/apps/explorer/src/app/routes/blocks/home/index.tsx @@ -8,7 +8,7 @@ import { RouteTitle } from '../../../components/route-title'; import { BlocksRefetch } from '../../../components/blocks'; import { BlocksInfiniteList } from '../../../components/blocks/blocks-infinite-list'; import { JumpToBlock } from '../../../components/jump-to-block'; -import { t, useFetch } from '@vegaprotocol/react-helpers'; +import { t, useFetch } from '@vegaprotocol/utils'; import { useDocumentTitle } from '../../../hooks/use-document-title'; // This constant should only be changed if Tendermint API changes the max blocks returned diff --git a/apps/explorer/src/app/routes/blocks/id/block.spec.tsx b/apps/explorer/src/app/routes/blocks/id/block.spec.tsx index 89e91c9c1..762ca7e3c 100644 --- a/apps/explorer/src/app/routes/blocks/id/block.spec.tsx +++ b/apps/explorer/src/app/routes/blocks/id/block.spec.tsx @@ -2,7 +2,7 @@ import { Block } from './block'; import { render, screen, waitFor } from '@testing-library/react'; import { MemoryRouter, Route, Routes } from 'react-router-dom'; import { Routes as RouteNames } from '../../route-names'; -import { useFetch } from '@vegaprotocol/react-helpers'; +import { useFetch } from '@vegaprotocol/utils'; import { MockedProvider } from '@apollo/client/testing'; jest.mock('@vegaprotocol/react-helpers', () => { diff --git a/apps/explorer/src/app/routes/blocks/id/block.tsx b/apps/explorer/src/app/routes/blocks/id/block.tsx index aa102a085..c0688dfe7 100644 --- a/apps/explorer/src/app/routes/blocks/id/block.tsx +++ b/apps/explorer/src/app/routes/blocks/id/block.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { Link, useParams } from 'react-router-dom'; import { DATA_SOURCES } from '../../../config'; -import { getDateTimeFormat } from '@vegaprotocol/react-helpers'; +import { getDateTimeFormat } from '@vegaprotocol/utils'; import type { TendermintBlocksResponse } from '../tendermint-blocks-response'; import { RouteTitle } from '../../../components/route-title'; import { TimeAgo } from '../../../components/time-ago'; @@ -15,7 +15,7 @@ import { TxsPerBlock } from '../../../components/txs/txs-per-block'; import { Button } from '@vegaprotocol/ui-toolkit'; import { Routes } from '../../route-names'; import { RenderFetched } from '../../../components/render-fetched'; -import { t, useFetch } from '@vegaprotocol/react-helpers'; +import { t, useFetch } from '@vegaprotocol/utils'; import { NodeLink } from '../../../components/links'; import { useDocumentTitle } from '../../../hooks/use-document-title'; import EmptyList from '../../../components/empty-list/empty-list'; diff --git a/apps/explorer/src/app/routes/genesis/index.tsx b/apps/explorer/src/app/routes/genesis/index.tsx index 7c5126290..8d1d0ab3a 100644 --- a/apps/explorer/src/app/routes/genesis/index.tsx +++ b/apps/explorer/src/app/routes/genesis/index.tsx @@ -1,4 +1,4 @@ -import { t, useFetch } from '@vegaprotocol/react-helpers'; +import { t, useFetch } from '@vegaprotocol/utils'; import { RouteTitle } from '../../components/route-title'; import { Loader, SyntaxHighlighter } from '@vegaprotocol/ui-toolkit'; import { DATA_SOURCES } from '../../config'; diff --git a/apps/explorer/src/app/routes/governance/proposals-page.tsx b/apps/explorer/src/app/routes/governance/proposals-page.tsx index 538f950d1..ba59da499 100644 --- a/apps/explorer/src/app/routes/governance/proposals-page.tsx +++ b/apps/explorer/src/app/routes/governance/proposals-page.tsx @@ -1,5 +1,5 @@ import { proposalsDataProvider } from '@vegaprotocol/governance'; -import { t, useDataProvider } from '@vegaprotocol/react-helpers'; +import { t, useDataProvider } from '@vegaprotocol/utils'; import { AsyncRenderer } from '@vegaprotocol/ui-toolkit'; import { ProposalsTable } from '../../components/proposals/proposals-table'; import { RouteTitle } from '../../components/route-title'; diff --git a/apps/explorer/src/app/routes/markets/market-page.tsx b/apps/explorer/src/app/routes/markets/market-page.tsx index d1483a935..df8db8add 100644 --- a/apps/explorer/src/app/routes/markets/market-page.tsx +++ b/apps/explorer/src/app/routes/markets/market-page.tsx @@ -1,4 +1,4 @@ -import { t, useDataProvider } from '@vegaprotocol/react-helpers'; +import { t, useDataProvider } from '@vegaprotocol/utils'; import { AsyncRenderer, Button } from '@vegaprotocol/ui-toolkit'; import { useMemo, useState } from 'react'; import { useParams } from 'react-router-dom'; diff --git a/apps/explorer/src/app/routes/markets/markets-page.tsx b/apps/explorer/src/app/routes/markets/markets-page.tsx index 04033c957..7726eb6e4 100644 --- a/apps/explorer/src/app/routes/markets/markets-page.tsx +++ b/apps/explorer/src/app/routes/markets/markets-page.tsx @@ -3,7 +3,7 @@ import { useDocumentTitle } from '../../hooks/use-document-title'; import { marketsProvider } from '@vegaprotocol/market-list'; import { RouteTitle } from '../../components/route-title'; import { AsyncRenderer } from '@vegaprotocol/ui-toolkit'; -import { t, useDataProvider } from '@vegaprotocol/react-helpers'; +import { t, useDataProvider } from '@vegaprotocol/utils'; import { MarketsTable } from '../../components/markets/markets-table'; export const MarketsPage = () => { diff --git a/apps/explorer/src/app/routes/network-parameters/network-parameters.spec.tsx b/apps/explorer/src/app/routes/network-parameters/network-parameters.spec.tsx index 67176d0a4..aeaf04563 100644 --- a/apps/explorer/src/app/routes/network-parameters/network-parameters.spec.tsx +++ b/apps/explorer/src/app/routes/network-parameters/network-parameters.spec.tsx @@ -1,5 +1,5 @@ import { render, screen } from '@testing-library/react'; -import type { NetworkParamsQuery } from '@vegaprotocol/react-helpers'; +import type { NetworkParamsQuery } from '@vegaprotocol/utils'; import { NetworkParametersTable } from './network-parameters'; describe('NetworkParametersTable', () => { diff --git a/apps/explorer/src/app/routes/network-parameters/network-parameters.tsx b/apps/explorer/src/app/routes/network-parameters/network-parameters.tsx index fa8684038..219b6b8aa 100644 --- a/apps/explorer/src/app/routes/network-parameters/network-parameters.tsx +++ b/apps/explorer/src/app/routes/network-parameters/network-parameters.tsx @@ -11,10 +11,10 @@ import { suitableForSyntaxHighlighter, t, useNetworkParamsQuery, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import { RouteTitle } from '../../components/route-title'; import orderBy from 'lodash/orderBy'; -import type { NetworkParamsQuery } from '@vegaprotocol/react-helpers'; +import type { NetworkParamsQuery } from '@vegaprotocol/utils'; import { useScrollToLocation } from '../../hooks/scroll-to-location'; import { useDocumentTitle } from '../../hooks/use-document-title'; diff --git a/apps/explorer/src/app/routes/oracles/components/oracle-data.tsx b/apps/explorer/src/app/routes/oracles/components/oracle-data.tsx index 5bd4b75fc..9033bc2e0 100644 --- a/apps/explorer/src/app/routes/oracles/components/oracle-data.tsx +++ b/apps/explorer/src/app/routes/oracles/components/oracle-data.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { SyntaxHighlighter } from '@vegaprotocol/ui-toolkit'; import filter from 'recursive-key-filter'; import type { ExplorerOracleDataConnectionFragment } from '../__generated__/Oracles'; diff --git a/apps/explorer/src/app/routes/oracles/components/oracle-filter.tsx b/apps/explorer/src/app/routes/oracles/components/oracle-filter.tsx index 62b373a09..807596f90 100644 --- a/apps/explorer/src/app/routes/oracles/components/oracle-filter.tsx +++ b/apps/explorer/src/app/routes/oracles/components/oracle-filter.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { SyntaxHighlighter } from '@vegaprotocol/ui-toolkit'; import filter from 'recursive-key-filter'; import type { ExplorerOracleDataSourceFragment } from '../__generated__/Oracles'; diff --git a/apps/explorer/src/app/routes/oracles/components/oracle-markets.tsx b/apps/explorer/src/app/routes/oracles/components/oracle-markets.tsx index 195847f0d..f12b6b269 100644 --- a/apps/explorer/src/app/routes/oracles/components/oracle-markets.tsx +++ b/apps/explorer/src/app/routes/oracles/components/oracle-markets.tsx @@ -1,4 +1,4 @@ -import { getNodes, t } from '@vegaprotocol/react-helpers'; +import { getNodes, t } from '@vegaprotocol/utils'; import { MarketLink } from '../../../components/links'; import { TableRow, TableCell, TableHeader } from '../../../components/table'; import type { ExplorerOracleForMarketsMarketFragment } from '../__generated__/OraclesForMarkets'; diff --git a/apps/explorer/src/app/routes/oracles/components/oracle-signers.tsx b/apps/explorer/src/app/routes/oracles/components/oracle-signers.tsx index 428e6410e..3e8bdf325 100644 --- a/apps/explorer/src/app/routes/oracles/components/oracle-signers.tsx +++ b/apps/explorer/src/app/routes/oracles/components/oracle-signers.tsx @@ -4,7 +4,7 @@ import { EthExplorerLinkTypes, } from '../../../components/links/eth-explorer-link/eth-explorer-link'; import { TableRow, TableCell, TableHeader } from '../../../components/table'; -import { remove0x } from '@vegaprotocol/react-helpers'; +import { remove0x } from '@vegaprotocol/utils'; import type { SourceType } from './oracle'; diff --git a/apps/explorer/src/app/routes/oracles/components/oracle.tsx b/apps/explorer/src/app/routes/oracles/components/oracle.tsx index efb7a2f1e..d337ab64a 100644 --- a/apps/explorer/src/app/routes/oracles/components/oracle.tsx +++ b/apps/explorer/src/app/routes/oracles/components/oracle.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { TableRow, TableCell, diff --git a/apps/explorer/src/app/routes/oracles/home/index.tsx b/apps/explorer/src/app/routes/oracles/home/index.tsx index d999b789b..d38cd75a0 100644 --- a/apps/explorer/src/app/routes/oracles/home/index.tsx +++ b/apps/explorer/src/app/routes/oracles/home/index.tsx @@ -1,6 +1,6 @@ import { Loader, SyntaxHighlighter } from '@vegaprotocol/ui-toolkit'; import { RouteTitle } from '../../../components/route-title'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { useExplorerOracleSpecsQuery } from '../__generated__/Oracles'; import { useDocumentTitle } from '../../../hooks/use-document-title'; import { OracleDetails } from '../components/oracle'; diff --git a/apps/explorer/src/app/routes/oracles/id/index.tsx b/apps/explorer/src/app/routes/oracles/id/index.tsx index ca23b6647..3335148f3 100644 --- a/apps/explorer/src/app/routes/oracles/id/index.tsx +++ b/apps/explorer/src/app/routes/oracles/id/index.tsx @@ -1,6 +1,6 @@ import { RouteTitle } from '../../../components/route-title'; import { RenderFetched } from '../../../components/render-fetched'; -import { t, truncateByChars } from '@vegaprotocol/react-helpers'; +import { t, truncateByChars } from '@vegaprotocol/utils'; import { useDocumentTitle } from '../../../hooks/use-document-title'; import { useParams } from 'react-router-dom'; import { useExplorerOracleSpecByIdQuery } from '../__generated__/Oracles'; diff --git a/apps/explorer/src/app/routes/parties/home/index.tsx b/apps/explorer/src/app/routes/parties/home/index.tsx index 99096c35a..bda947012 100644 --- a/apps/explorer/src/app/routes/parties/home/index.tsx +++ b/apps/explorer/src/app/routes/parties/home/index.tsx @@ -4,7 +4,7 @@ import { JumpTo } from '../../../components/jump-to'; import { useNavigate } from 'react-router-dom'; import { Routes } from '../../route-names'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { useDocumentTitle } from '../../../hooks/use-document-title'; export const JumpToParty = () => { diff --git a/apps/explorer/src/app/routes/parties/id/components/party-accounts.tsx b/apps/explorer/src/app/routes/parties/id/components/party-accounts.tsx index 759c3cac7..d7b85a7a0 100644 --- a/apps/explorer/src/app/routes/parties/id/components/party-accounts.tsx +++ b/apps/explorer/src/app/routes/parties/id/components/party-accounts.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import get from 'lodash/get'; import AssetBalance from '../../../../components/asset-balance/asset-balance'; import { AssetLink, MarketLink } from '../../../../components/links'; diff --git a/apps/explorer/src/app/routes/parties/id/components/party-id-error.tsx b/apps/explorer/src/app/routes/parties/id/components/party-id-error.tsx index be2799ef9..d29d4787f 100644 --- a/apps/explorer/src/app/routes/parties/id/components/party-id-error.tsx +++ b/apps/explorer/src/app/routes/parties/id/components/party-id-error.tsx @@ -1,4 +1,4 @@ -import { remove0x, t } from '@vegaprotocol/react-helpers'; +import { remove0x, t } from '@vegaprotocol/utils'; import type { ApolloError } from '@apollo/client'; export function isValidPartyId(rawId: string) { diff --git a/apps/explorer/src/app/routes/parties/id/index.tsx b/apps/explorer/src/app/routes/parties/id/index.tsx index cb5f3c662..01e24356e 100644 --- a/apps/explorer/src/app/routes/parties/id/index.tsx +++ b/apps/explorer/src/app/routes/parties/id/index.tsx @@ -1,4 +1,4 @@ -import { getNodes, t, useScreenDimensions } from '@vegaprotocol/react-helpers'; +import { getNodes, t, useScreenDimensions } from '@vegaprotocol/utils'; import { useMemo } from 'react'; import { useParams } from 'react-router-dom'; import { SubHeading } from '../../../components/sub-heading'; diff --git a/apps/explorer/src/app/routes/pending/index.tsx b/apps/explorer/src/app/routes/pending/index.tsx index 6adcf382a..41fe131ac 100644 --- a/apps/explorer/src/app/routes/pending/index.tsx +++ b/apps/explorer/src/app/routes/pending/index.tsx @@ -3,7 +3,7 @@ import { DATA_SOURCES } from '../../config'; import type { TendermintUnconfirmedTransactionsResponse } from '../txs/tendermint-unconfirmed-transactions-response.d'; import { TxList } from '../../components/txs'; import { RouteTitle } from '../../components/route-title'; -import { t, useFetch } from '@vegaprotocol/react-helpers'; +import { t, useFetch } from '@vegaprotocol/utils'; import { useDocumentTitle } from '../../hooks/use-document-title'; const PendingTxs = () => { diff --git a/apps/explorer/src/app/routes/router-config.tsx b/apps/explorer/src/app/routes/router-config.tsx index ade048209..8a50f72f8 100644 --- a/apps/explorer/src/app/routes/router-config.tsx +++ b/apps/explorer/src/app/routes/router-config.tsx @@ -17,7 +17,7 @@ import { Tx } from './txs/id'; import { TxsList } from './txs/home'; import { PendingTxs } from './pending'; import flags from '../config/flags'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { Routes } from './route-names'; import { NetworkParameters } from './network-parameters'; import type { RouteObject } from 'react-router-dom'; diff --git a/apps/explorer/src/app/routes/txs/home/index.tsx b/apps/explorer/src/app/routes/txs/home/index.tsx index a81ed928b..7cd41d7fb 100644 --- a/apps/explorer/src/app/routes/txs/home/index.tsx +++ b/apps/explorer/src/app/routes/txs/home/index.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { RouteTitle } from '../../../components/route-title'; import { BlocksRefetch } from '../../../components/blocks'; import { TxsInfiniteList } from '../../../components/txs'; diff --git a/apps/explorer/src/app/routes/txs/id/index.tsx b/apps/explorer/src/app/routes/txs/id/index.tsx index 882b9877f..bdcf36db8 100644 --- a/apps/explorer/src/app/routes/txs/id/index.tsx +++ b/apps/explorer/src/app/routes/txs/id/index.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { Link, useParams } from 'react-router-dom'; -import { remove0x, useFetch } from '@vegaprotocol/react-helpers'; +import { remove0x, useFetch } from '@vegaprotocol/utils'; import { DATA_SOURCES } from '../../../config'; import { RenderFetched } from '../../../components/render-fetched'; import { TxDetails } from './tx-details'; diff --git a/apps/explorer/src/app/routes/txs/id/tx-content.tsx b/apps/explorer/src/app/routes/txs/id/tx-content.tsx index 62d4e71d2..c14f85074 100644 --- a/apps/explorer/src/app/routes/txs/id/tx-content.tsx +++ b/apps/explorer/src/app/routes/txs/id/tx-content.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { StatusMessage } from '../../../components/status-message'; import { NestedDataList } from '../../../components/nested-data-list'; import type { UnknownObject } from '../../../components/nested-data-list'; diff --git a/apps/explorer/src/app/routes/txs/id/tx-details.tsx b/apps/explorer/src/app/routes/txs/id/tx-details.tsx index 06a0e149b..e52429702 100644 --- a/apps/explorer/src/app/routes/txs/id/tx-details.tsx +++ b/apps/explorer/src/app/routes/txs/id/tx-details.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import type { BlockExplorerTransactionResult } from '../../../routes/types/block-explorer-response'; import { TxDetailsWrapper } from '../../../components/txs/details/tx-details-wrapper'; diff --git a/apps/explorer/src/app/routes/validators/validators-page.tsx b/apps/explorer/src/app/routes/validators/validators-page.tsx index 1cbc6851f..a8936fb17 100644 --- a/apps/explorer/src/app/routes/validators/validators-page.tsx +++ b/apps/explorer/src/app/routes/validators/validators-page.tsx @@ -1,4 +1,4 @@ -import { countryCodeToFlagEmoji, t } from '@vegaprotocol/react-helpers'; +import { countryCodeToFlagEmoji, t } from '@vegaprotocol/utils'; import { AsyncRenderer, Button, diff --git a/apps/liquidity-provision-dashboard/src/app/components/dashboard/dashboard.tsx b/apps/liquidity-provision-dashboard/src/app/components/dashboard/dashboard.tsx index 55fd95cfb..44917fc7c 100644 --- a/apps/liquidity-provision-dashboard/src/app/components/dashboard/dashboard.tsx +++ b/apps/liquidity-provision-dashboard/src/app/components/dashboard/dashboard.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { Intro } from './intro'; import { MarketList } from './market-list'; diff --git a/apps/liquidity-provision-dashboard/src/app/components/dashboard/intro/intro.tsx b/apps/liquidity-provision-dashboard/src/app/components/dashboard/intro/intro.tsx index 11808ddb6..059ce58c4 100644 --- a/apps/liquidity-provision-dashboard/src/app/components/dashboard/intro/intro.tsx +++ b/apps/liquidity-provision-dashboard/src/app/components/dashboard/intro/intro.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { ExternalLink } from '@vegaprotocol/ui-toolkit'; // TODO: add mainnet links once docs have been updated diff --git a/apps/liquidity-provision-dashboard/src/app/components/dashboard/market-list/market-list.tsx b/apps/liquidity-provision-dashboard/src/app/components/dashboard/market-list/market-list.tsx index 6e81c279c..8a3a0f4d4 100644 --- a/apps/liquidity-provision-dashboard/src/app/components/dashboard/market-list/market-list.tsx +++ b/apps/liquidity-provision-dashboard/src/app/components/dashboard/market-list/market-list.tsx @@ -10,7 +10,7 @@ import { formatNumberPercentage, t, toBigNum, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import type { VegaValueFormatterParams } from '@vegaprotocol/ui-toolkit'; import type * as Schema from '@vegaprotocol/types'; import { @@ -30,7 +30,7 @@ import { HealthBar } from '../../health-bar'; import { HealthDialog } from '../../health-dialog'; import { Status } from '../../status'; import { formatDistanceToNow } from 'date-fns'; -import { getExpiryDate } from '@vegaprotocol/react-helpers'; +import { getExpiryDate } from '@vegaprotocol/utils'; export const MarketList = () => { const { data, error, loading } = useMarketsLiquidity(); diff --git a/apps/liquidity-provision-dashboard/src/app/components/detail/detail.tsx b/apps/liquidity-provision-dashboard/src/app/components/detail/detail.tsx index 1a4b0eed7..71a616413 100644 --- a/apps/liquidity-provision-dashboard/src/app/components/detail/detail.tsx +++ b/apps/liquidity-provision-dashboard/src/app/components/detail/detail.tsx @@ -4,7 +4,7 @@ import { t, useDataProvider, makeDerivedDataProvider, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import { AsyncRenderer } from '@vegaprotocol/ui-toolkit'; import { diff --git a/apps/liquidity-provision-dashboard/src/app/components/detail/header/header.tsx b/apps/liquidity-provision-dashboard/src/app/components/detail/header/header.tsx index b97e2393d..717b14bbe 100644 --- a/apps/liquidity-provision-dashboard/src/app/components/detail/header/header.tsx +++ b/apps/liquidity-provision-dashboard/src/app/components/detail/header/header.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { Link } from 'react-router-dom'; import { Icon } from '@vegaprotocol/ui-toolkit'; diff --git a/apps/liquidity-provision-dashboard/src/app/components/detail/last-24h-volume/last-24h-volume.tsx b/apps/liquidity-provision-dashboard/src/app/components/detail/last-24h-volume/last-24h-volume.tsx index 6b4a96c83..13d2b3e18 100644 --- a/apps/liquidity-provision-dashboard/src/app/components/detail/last-24h-volume/last-24h-volume.tsx +++ b/apps/liquidity-provision-dashboard/src/app/components/detail/last-24h-volume/last-24h-volume.tsx @@ -4,7 +4,7 @@ import { useYesterday, useDataProvider, addDecimalsFormatNumber, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; import { calcDayVolume, diff --git a/apps/liquidity-provision-dashboard/src/app/components/detail/market/market.tsx b/apps/liquidity-provision-dashboard/src/app/components/detail/market/market.tsx index 9f7b208c6..751d61d00 100644 --- a/apps/liquidity-provision-dashboard/src/app/components/detail/market/market.tsx +++ b/apps/liquidity-provision-dashboard/src/app/components/detail/market/market.tsx @@ -1,5 +1,5 @@ import { useState } from 'react'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { Icon } from '@vegaprotocol/ui-toolkit'; import { formatWithAsset } from '@vegaprotocol/liquidity'; diff --git a/apps/liquidity-provision-dashboard/src/app/components/detail/providers/providers.tsx b/apps/liquidity-provision-dashboard/src/app/components/detail/providers/providers.tsx index 382449ac9..145aa517c 100644 --- a/apps/liquidity-provision-dashboard/src/app/components/detail/providers/providers.tsx +++ b/apps/liquidity-provision-dashboard/src/app/components/detail/providers/providers.tsx @@ -2,7 +2,7 @@ import { useCallback } from 'react'; import { AgGridColumn } from 'ag-grid-react'; import type { GetRowIdParams } from 'ag-grid-community'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import type { LiquidityProviderFeeShareFieldsFragment, diff --git a/apps/liquidity-provision-dashboard/src/app/components/health-bar/health-bar.tsx b/apps/liquidity-provision-dashboard/src/app/components/health-bar/health-bar.tsx index 282af4368..9a1002312 100644 --- a/apps/liquidity-provision-dashboard/src/app/components/health-bar/health-bar.tsx +++ b/apps/liquidity-provision-dashboard/src/app/components/health-bar/health-bar.tsx @@ -1,6 +1,6 @@ import classNames from 'classnames'; import type * as Schema from '@vegaprotocol/types'; -import { t, addDecimalsFormatNumber } from '@vegaprotocol/react-helpers'; +import { t, addDecimalsFormatNumber } from '@vegaprotocol/utils'; import { BigNumber } from 'bignumber.js'; import type { ReactNode } from 'react'; diff --git a/apps/liquidity-provision-dashboard/src/app/components/health-dialog/health-dialog.tsx b/apps/liquidity-provision-dashboard/src/app/components/health-dialog/health-dialog.tsx index 96f439399..2135fe15c 100644 --- a/apps/liquidity-provision-dashboard/src/app/components/health-dialog/health-dialog.tsx +++ b/apps/liquidity-provision-dashboard/src/app/components/health-dialog/health-dialog.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { Dialog } from '@vegaprotocol/ui-toolkit'; import * as Schema from '@vegaprotocol/types'; import classNames from 'classnames'; diff --git a/apps/liquidity-provision-dashboard/src/app/components/status/status.tsx b/apps/liquidity-provision-dashboard/src/app/components/status/status.tsx index 6ee5f2dc0..a3a4a4841 100644 --- a/apps/liquidity-provision-dashboard/src/app/components/status/status.tsx +++ b/apps/liquidity-provision-dashboard/src/app/components/status/status.tsx @@ -2,7 +2,7 @@ import { Lozenge, Tooltip } from '@vegaprotocol/ui-toolkit'; import classNames from 'classnames'; import * as Schema from '@vegaprotocol/types'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { Indicator } from '../indicator'; diff --git a/apps/liquidity-provision-dashboard/src/app/routes/router-config.tsx b/apps/liquidity-provision-dashboard/src/app/routes/router-config.tsx index 239ca061a..427e94bf2 100644 --- a/apps/liquidity-provision-dashboard/src/app/routes/router-config.tsx +++ b/apps/liquidity-provision-dashboard/src/app/routes/router-config.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { Dashboard } from '../components/dashboard'; import { Detail } from '../components/detail'; diff --git a/apps/multisig-signer/src/app/app.tsx b/apps/multisig-signer/src/app/app.tsx index 4707f6f50..cee811316 100644 --- a/apps/multisig-signer/src/app/app.tsx +++ b/apps/multisig-signer/src/app/app.tsx @@ -10,7 +10,7 @@ import { import { AsyncRenderer, Button, Lozenge } from '@vegaprotocol/ui-toolkit'; import type { EthereumConfig } from '@vegaprotocol/web3'; import { useEthereumConfig, Web3Provider } from '@vegaprotocol/web3'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { ENV } from './config/env'; import { ContractsProvider } from './config/contracts/contracts-provider'; import { diff --git a/apps/multisig-signer/src/app/components/add-signer-form/add-signer-form.tsx b/apps/multisig-signer/src/app/components/add-signer-form/add-signer-form.tsx index 9b81d74fe..72f61f99e 100644 --- a/apps/multisig-signer/src/app/components/add-signer-form/add-signer-form.tsx +++ b/apps/multisig-signer/src/app/components/add-signer-form/add-signer-form.tsx @@ -1,7 +1,7 @@ import { useState } from 'react'; import { gql, useLazyQuery } from '@apollo/client'; import { captureException } from '@sentry/react'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { useEthereumTransaction } from '@vegaprotocol/web3'; import { FormGroup, diff --git a/apps/multisig-signer/src/app/components/remove-signer-form/remove-signer-form.tsx b/apps/multisig-signer/src/app/components/remove-signer-form/remove-signer-form.tsx index a8f0ac211..7c2d11fc2 100644 --- a/apps/multisig-signer/src/app/components/remove-signer-form/remove-signer-form.tsx +++ b/apps/multisig-signer/src/app/components/remove-signer-form/remove-signer-form.tsx @@ -1,7 +1,7 @@ import { useState } from 'react'; import { gql, useLazyQuery } from '@apollo/client'; import { captureException } from '@sentry/react'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { useEthereumTransaction } from '@vegaprotocol/web3'; import { FormGroup, diff --git a/apps/token-e2e/src/integration/view/wallet-vega.cy.js b/apps/token-e2e/src/integration/view/wallet-vega.cy.js index 1c9fcaf77..c32037a42 100644 --- a/apps/token-e2e/src/integration/view/wallet-vega.cy.js +++ b/apps/token-e2e/src/integration/view/wallet-vega.cy.js @@ -1,4 +1,4 @@ -import { truncateByChars } from '@vegaprotocol/react-helpers'; +import { truncateByChars } from '@vegaprotocol/utils'; const walletContainer = '[data-testid="vega-wallet"]'; const walletHeader = '[data-testid="wallet-header"] h1'; diff --git a/apps/token/src/app-loader.tsx b/apps/token/src/app-loader.tsx index 15e907c8b..0aaa27d84 100644 --- a/apps/token/src/app-loader.tsx +++ b/apps/token/src/app-loader.tsx @@ -1,5 +1,5 @@ import * as Sentry from '@sentry/react'; -import { toBigNum } from '@vegaprotocol/react-helpers'; +import { toBigNum } from '@vegaprotocol/utils'; import { Splash } from '@vegaprotocol/ui-toolkit'; import { useVegaWallet, useEagerConnect } from '@vegaprotocol/wallet'; import { useEnvironment } from '@vegaprotocol/environment'; diff --git a/apps/token/src/components/token-input/token-input.tsx b/apps/token/src/components/token-input/token-input.tsx index d8c8c9f31..b45018a77 100644 --- a/apps/token/src/components/token-input/token-input.tsx +++ b/apps/token/src/components/token-input/token-input.tsx @@ -7,7 +7,7 @@ import { Lozenge, ButtonLink, } from '@vegaprotocol/ui-toolkit'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import React from 'react'; import { useTranslation } from 'react-i18next'; diff --git a/apps/token/src/components/vega-wallet/download-wallet-prompt.tsx b/apps/token/src/components/vega-wallet/download-wallet-prompt.tsx index 98a6cdc3d..6dd9f567e 100644 --- a/apps/token/src/components/vega-wallet/download-wallet-prompt.tsx +++ b/apps/token/src/components/vega-wallet/download-wallet-prompt.tsx @@ -1,6 +1,6 @@ import { Link } from '@vegaprotocol/ui-toolkit'; import { useTranslation } from 'react-i18next'; -import { ExternalLinks } from '@vegaprotocol/react-helpers'; +import { ExternalLinks } from '@vegaprotocol/utils'; export const DownloadWalletPrompt = () => { const { t } = useTranslation(); diff --git a/apps/token/src/components/vega-wallet/hooks.ts b/apps/token/src/components/vega-wallet/hooks.ts index 881b6a3ca..2caab2e97 100644 --- a/apps/token/src/components/vega-wallet/hooks.ts +++ b/apps/token/src/components/vega-wallet/hooks.ts @@ -17,9 +17,9 @@ import { isAssetTypeERC20, removePaginationWrapper, toBigNum, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import { useAppState } from '../../contexts/app-state/app-state-context'; -import { addDecimal } from '@vegaprotocol/react-helpers'; +import { addDecimal } from '@vegaprotocol/utils'; import type { DelegationsQuery, DelegationsQueryVariables, diff --git a/apps/token/src/components/vega-wallet/vega-wallet.tsx b/apps/token/src/components/vega-wallet/vega-wallet.tsx index b50e29f5d..4f4ea4b45 100644 --- a/apps/token/src/components/vega-wallet/vega-wallet.tsx +++ b/apps/token/src/components/vega-wallet/vega-wallet.tsx @@ -24,7 +24,7 @@ import { DownloadWalletPrompt } from './download-wallet-prompt'; import { usePollForDelegations } from './hooks'; import { useVegaWallet, useVegaWalletDialogStore } from '@vegaprotocol/wallet'; import { Button, ButtonLink } from '@vegaprotocol/ui-toolkit'; -import { toBigNum } from '@vegaprotocol/react-helpers'; +import { toBigNum } from '@vegaprotocol/utils'; import { usePendingBalancesStore } from '../../hooks/use-pending-balances-manager'; import { StakingEventType } from '../../hooks/use-get-association-breakdown'; diff --git a/apps/token/src/components/wallet-card/wallet-card.tsx b/apps/token/src/components/wallet-card/wallet-card.tsx index aa8b06e5f..3dde2bd25 100644 --- a/apps/token/src/components/wallet-card/wallet-card.tsx +++ b/apps/token/src/components/wallet-card/wallet-card.tsx @@ -3,7 +3,7 @@ import { Link } from 'react-router-dom'; import { useAnimateValue } from '../../hooks/use-animate-value'; import type { BigNumber } from '../../lib/bignumber'; -import { useNumberParts } from '@vegaprotocol/react-helpers'; +import { useNumberParts } from '@vegaprotocol/utils'; interface WalletCardProps { children: React.ReactNode; diff --git a/apps/token/src/hooks/use-animate-value.ts b/apps/token/src/hooks/use-animate-value.ts index f18a1d051..103ccb78a 100644 --- a/apps/token/src/hooks/use-animate-value.ts +++ b/apps/token/src/hooks/use-animate-value.ts @@ -2,7 +2,7 @@ import React from 'react'; import type { BigNumber } from '../lib/bignumber'; import { theme } from '@vegaprotocol/tailwindcss-config'; import colors from 'tailwindcss/colors'; -import { usePrevious } from '@vegaprotocol/react-helpers'; +import { usePrevious } from '@vegaprotocol/utils'; const customColors = theme.colors; const FLASH_DURATION = 1200; // Duration of flash animation in milliseconds diff --git a/apps/token/src/hooks/use-get-association-breakdown.ts b/apps/token/src/hooks/use-get-association-breakdown.ts index d5fa37358..e903adc9a 100644 --- a/apps/token/src/hooks/use-get-association-breakdown.ts +++ b/apps/token/src/hooks/use-get-association-breakdown.ts @@ -1,7 +1,7 @@ import React from 'react'; import type { ethers } from 'ethers'; import * as Sentry from '@sentry/react'; -import { addDecimal } from '@vegaprotocol/react-helpers'; +import { addDecimal } from '@vegaprotocol/utils'; import type { StakingBridge, TokenVesting, diff --git a/apps/token/src/hooks/use-get-user-balances.ts b/apps/token/src/hooks/use-get-user-balances.ts index a9cef3922..d6456ab8f 100644 --- a/apps/token/src/hooks/use-get-user-balances.ts +++ b/apps/token/src/hooks/use-get-user-balances.ts @@ -1,6 +1,6 @@ import { useCallback } from 'react'; import * as Sentry from '@sentry/react'; -import { toBigNum } from '@vegaprotocol/react-helpers'; +import { toBigNum } from '@vegaprotocol/utils'; import { useContracts } from '../contexts/contracts/contracts-context'; import { useAppState } from '../contexts/app-state/app-state-context'; import { useEthereumConfig } from '@vegaprotocol/web3'; diff --git a/apps/token/src/hooks/use-refresh-associated-balances.ts b/apps/token/src/hooks/use-refresh-associated-balances.ts index 6bd65b95b..f6ca9dfaf 100644 --- a/apps/token/src/hooks/use-refresh-associated-balances.ts +++ b/apps/token/src/hooks/use-refresh-associated-balances.ts @@ -1,4 +1,4 @@ -import { toBigNum } from '@vegaprotocol/react-helpers'; +import { toBigNum } from '@vegaprotocol/utils'; import React from 'react'; import { useAppState } from '../contexts/app-state/app-state-context'; diff --git a/apps/token/src/hooks/use-refresh-balances.ts b/apps/token/src/hooks/use-refresh-balances.ts index 0c9abfab6..24cfd9e7d 100644 --- a/apps/token/src/hooks/use-refresh-balances.ts +++ b/apps/token/src/hooks/use-refresh-balances.ts @@ -1,5 +1,5 @@ import * as Sentry from '@sentry/react'; -import { toBigNum } from '@vegaprotocol/react-helpers'; +import { toBigNum } from '@vegaprotocol/utils'; import { useVegaWallet } from '@vegaprotocol/wallet'; import { useEthereumConfig } from '@vegaprotocol/web3'; import React from 'react'; diff --git a/apps/token/src/lib/abbreviate-number.ts b/apps/token/src/lib/abbreviate-number.ts index f411a3c86..2e9e4296f 100644 --- a/apps/token/src/lib/abbreviate-number.ts +++ b/apps/token/src/lib/abbreviate-number.ts @@ -1,4 +1,4 @@ -import { getUserLocale } from '@vegaprotocol/react-helpers'; +import { getUserLocale } from '@vegaprotocol/utils'; import type { BigNumber } from './bignumber'; export const getAbbreviatedNumber = (num: BigNumber) => { diff --git a/apps/token/src/lib/format-number.ts b/apps/token/src/lib/format-number.ts index b89af71dd..b26e69bf3 100644 --- a/apps/token/src/lib/format-number.ts +++ b/apps/token/src/lib/format-number.ts @@ -1,5 +1,5 @@ import type { BigNumber } from './bignumber'; -import { formatNumber as format } from '@vegaprotocol/react-helpers'; +import { formatNumber as format } from '@vegaprotocol/utils'; export const formatNumber = (value: BigNumber, decimals?: number) => { return format( diff --git a/apps/token/src/lib/tranches/tranches-store.tsx b/apps/token/src/lib/tranches/tranches-store.tsx index 11b9901aa..49c785f95 100644 --- a/apps/token/src/lib/tranches/tranches-store.tsx +++ b/apps/token/src/lib/tranches/tranches-store.tsx @@ -1,4 +1,4 @@ -import { toBigNum } from '@vegaprotocol/react-helpers'; +import { toBigNum } from '@vegaprotocol/utils'; import type { TrancheServiceResponse } from '@vegaprotocol/smart-contracts'; import type BigNumber from 'bignumber.js'; import create from 'zustand'; diff --git a/apps/token/src/routes/claim/claim-reducer.ts b/apps/token/src/routes/claim/claim-reducer.ts index 6ac740f3e..4c68e16b8 100644 --- a/apps/token/src/routes/claim/claim-reducer.ts +++ b/apps/token/src/routes/claim/claim-reducer.ts @@ -1,6 +1,6 @@ import { BigNumber } from '../../lib/bignumber'; import type { IClaimTokenParams } from '@vegaprotocol/smart-contracts'; -import { addDecimal } from '@vegaprotocol/react-helpers'; +import { addDecimal } from '@vegaprotocol/utils'; export enum ClaimStatus { Ready, diff --git a/apps/token/src/routes/claim/hooks.ts b/apps/token/src/routes/claim/hooks.ts index b446175af..802c7fcfc 100644 --- a/apps/token/src/routes/claim/hooks.ts +++ b/apps/token/src/routes/claim/hooks.ts @@ -1,7 +1,7 @@ import { useContracts } from '../../contexts/contracts/contracts-context'; import { useTransaction } from '../../hooks/use-transaction'; import type { IClaimTokenParams } from '@vegaprotocol/smart-contracts'; -import { removeDecimal } from '@vegaprotocol/react-helpers'; +import { removeDecimal } from '@vegaprotocol/utils'; import { useAppState } from '../../contexts/app-state/app-state-context'; export const useClaim = (claimData: IClaimTokenParams, address: string) => { diff --git a/apps/token/src/routes/contracts/index.tsx b/apps/token/src/routes/contracts/index.tsx index 9d5f03a99..bfb33f545 100644 --- a/apps/token/src/routes/contracts/index.tsx +++ b/apps/token/src/routes/contracts/index.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { Link, Splash } from '@vegaprotocol/ui-toolkit'; import type { EthereumConfig } from '@vegaprotocol/web3'; import { useEthereumConfig } from '@vegaprotocol/web3'; diff --git a/apps/token/src/routes/home/index.tsx b/apps/token/src/routes/home/index.tsx index cd78f00cc..e69e31712 100644 --- a/apps/token/src/routes/home/index.tsx +++ b/apps/token/src/routes/home/index.tsx @@ -11,10 +11,7 @@ import { useDocumentTitle } from '../../hooks/use-document-title'; import { useRefreshAfterEpoch } from '../../hooks/use-refresh-after-epoch'; import { ProposalsListItem } from '../proposals/components/proposals-list-item'; import Routes from '../routes'; -import { - ExternalLinks, - removePaginationWrapper, -} from '@vegaprotocol/react-helpers'; +import { ExternalLinks, removePaginationWrapper } from '@vegaprotocol/utils'; import { useNodesQuery } from '../staking/home/__generated___/Nodes'; import { useProposalsQuery } from '../proposals/proposals/__generated__/Proposals'; import { getNotRejectedProposals } from '../proposals/proposals/proposals-container'; diff --git a/apps/token/src/routes/proposals/components/current-proposal-status/current-proposal-status.spec.tsx b/apps/token/src/routes/proposals/components/current-proposal-status/current-proposal-status.spec.tsx index 3841d760d..50dc6f41a 100644 --- a/apps/token/src/routes/proposals/components/current-proposal-status/current-proposal-status.spec.tsx +++ b/apps/token/src/routes/proposals/components/current-proposal-status/current-proposal-status.spec.tsx @@ -2,8 +2,8 @@ import type { MockedResponse } from '@apollo/client/testing'; import { MockedProvider } from '@apollo/client/testing'; import { render, screen } from '@testing-library/react'; import { ProposalRejectionReason, ProposalState } from '@vegaprotocol/types'; -import type { NetworkParamsQuery } from '@vegaprotocol/react-helpers'; -import { NetworkParamsDocument } from '@vegaprotocol/react-helpers'; +import type { NetworkParamsQuery } from '@vegaprotocol/utils'; +import { NetworkParamsDocument } from '@vegaprotocol/utils'; import { AppStateProvider } from '../../../../contexts/app-state/app-state-provider'; import { generateProposal } from '../../test-helpers/generate-proposals'; import { CurrentProposalStatus } from './current-proposal-status'; diff --git a/apps/token/src/routes/proposals/components/proposal-detail-header/proposal-header.tsx b/apps/token/src/routes/proposals/components/proposal-detail-header/proposal-header.tsx index ca4292efb..327ef478c 100644 --- a/apps/token/src/routes/proposals/components/proposal-detail-header/proposal-header.tsx +++ b/apps/token/src/routes/proposals/components/proposal-detail-header/proposal-header.tsx @@ -1,6 +1,6 @@ import { useTranslation } from 'react-i18next'; import { Intent, Lozenge } from '@vegaprotocol/ui-toolkit'; -import { shorten } from '@vegaprotocol/react-helpers'; +import { shorten } from '@vegaprotocol/utils'; import { Heading, SubHeading } from '../../../../components/heading'; import type { ReactNode } from 'react'; import type { ProposalFieldsFragment } from '../../proposals/__generated__/Proposals'; diff --git a/apps/token/src/routes/proposals/components/proposal-votes-table/proposal-votes-table.tsx b/apps/token/src/routes/proposals/components/proposal-votes-table/proposal-votes-table.tsx index 09f8ec6cb..d15ce463a 100644 --- a/apps/token/src/routes/proposals/components/proposal-votes-table/proposal-votes-table.tsx +++ b/apps/token/src/routes/proposals/components/proposal-votes-table/proposal-votes-table.tsx @@ -5,10 +5,7 @@ import { Thumbs, RoundedWrapper, } from '@vegaprotocol/ui-toolkit'; -import { - formatNumber, - formatNumberPercentage, -} from '@vegaprotocol/react-helpers'; +import { formatNumber, formatNumberPercentage } from '@vegaprotocol/utils'; import { SubHeading } from '../../../../components/heading'; import { useVoteInformation } from '../../hooks'; import { useAppState } from '../../../../contexts/app-state/app-state-context'; diff --git a/apps/token/src/routes/proposals/components/proposal/proposal.tsx b/apps/token/src/routes/proposals/components/proposal/proposal.tsx index 2559ea11d..1a9c5e105 100644 --- a/apps/token/src/routes/proposals/components/proposal/proposal.tsx +++ b/apps/token/src/routes/proposals/components/proposal/proposal.tsx @@ -1,4 +1,4 @@ -import { NetworkParams, useNetworkParams } from '@vegaprotocol/react-helpers'; +import { NetworkParams, useNetworkParams } from '@vegaprotocol/utils'; import { AsyncRenderer } from '@vegaprotocol/ui-toolkit'; import { ProposalHeader } from '../proposal-detail-header/proposal-header'; import type { ProposalFieldsFragment } from '../../proposals/__generated__/Proposals'; diff --git a/apps/token/src/routes/proposals/components/proposals-list/proposals-list.tsx b/apps/token/src/routes/proposals/components/proposals-list/proposals-list.tsx index 2051ed593..ab09aef1f 100644 --- a/apps/token/src/routes/proposals/components/proposals-list/proposals-list.tsx +++ b/apps/token/src/routes/proposals/components/proposals-list/proposals-list.tsx @@ -9,7 +9,7 @@ import { Button } from '@vegaprotocol/ui-toolkit'; import { Link } from 'react-router-dom'; import type { ProposalQuery } from '../../proposal/__generated__/Proposal'; import type { ProposalFieldsFragment } from '../../proposals/__generated__/Proposals'; -import { ExternalLinks } from '@vegaprotocol/react-helpers'; +import { ExternalLinks } from '@vegaprotocol/utils'; import { ExternalLink } from '@vegaprotocol/ui-toolkit'; interface ProposalsListProps { diff --git a/apps/token/src/routes/proposals/components/propose/proposal-form-terms.tsx b/apps/token/src/routes/proposals/components/propose/proposal-form-terms.tsx index fa1552858..5eba02411 100644 --- a/apps/token/src/routes/proposals/components/propose/proposal-form-terms.tsx +++ b/apps/token/src/routes/proposals/components/propose/proposal-form-terms.tsx @@ -5,7 +5,7 @@ import { ExternalLink, TextArea, } from '@vegaprotocol/ui-toolkit'; -import { createDocsLinks } from '@vegaprotocol/react-helpers'; +import { createDocsLinks } from '@vegaprotocol/utils'; import { useEnvironment } from '@vegaprotocol/environment'; import type { UseFormRegisterReturn } from 'react-hook-form'; diff --git a/apps/token/src/routes/proposals/components/propose/proposal-form-vote-and-enactment-deadline.tsx b/apps/token/src/routes/proposals/components/propose/proposal-form-vote-and-enactment-deadline.tsx index 9f2c3125f..e6b454253 100644 --- a/apps/token/src/routes/proposals/components/propose/proposal-form-vote-and-enactment-deadline.tsx +++ b/apps/token/src/routes/proposals/components/propose/proposal-form-vote-and-enactment-deadline.tsx @@ -6,7 +6,7 @@ import { Input, InputError, } from '@vegaprotocol/ui-toolkit'; -import { getDateTimeFormat } from '@vegaprotocol/react-helpers'; +import { getDateTimeFormat } from '@vegaprotocol/utils'; import { addHours } from 'date-fns'; import { addTwoMinutes, diff --git a/apps/token/src/routes/proposals/components/shared/proposal-min-requirements.tsx b/apps/token/src/routes/proposals/components/shared/proposal-min-requirements.tsx index db958aae2..3c93c2e8f 100644 --- a/apps/token/src/routes/proposals/components/shared/proposal-min-requirements.tsx +++ b/apps/token/src/routes/proposals/components/shared/proposal-min-requirements.tsx @@ -1,6 +1,6 @@ import { useTranslation } from 'react-i18next'; import BigNumber from 'bignumber.js'; -import { addDecimal } from '@vegaprotocol/react-helpers'; +import { addDecimal } from '@vegaprotocol/utils'; export enum ProposalUserAction { CREATE = 'CREATE', diff --git a/apps/token/src/routes/proposals/components/vote-details/use-user-vote.tsx b/apps/token/src/routes/proposals/components/vote-details/use-user-vote.tsx index 610c2cd27..629a4828c 100644 --- a/apps/token/src/routes/proposals/components/vote-details/use-user-vote.tsx +++ b/apps/token/src/routes/proposals/components/vote-details/use-user-vote.tsx @@ -4,8 +4,8 @@ import { useVegaWallet } from '@vegaprotocol/wallet'; import { VoteValue } from '@vegaprotocol/types'; import { useEffect, useState } from 'react'; import { useUserVoteQuery } from './__generated__/Vote'; -import { removePaginationWrapper } from '@vegaprotocol/react-helpers'; import type { FinalizedVote } from '@vegaprotocol/governance'; +import { removePaginationWrapper } from '@vegaprotocol/utils'; export enum VoteState { NotCast = 'NotCast', diff --git a/apps/token/src/routes/proposals/components/vote-details/vote-buttons.tsx b/apps/token/src/routes/proposals/components/vote-details/vote-buttons.tsx index bf6ec86ec..6ff0d818c 100644 --- a/apps/token/src/routes/proposals/components/vote-details/vote-buttons.tsx +++ b/apps/token/src/routes/proposals/components/vote-details/vote-buttons.tsx @@ -3,7 +3,8 @@ import React, { useMemo } from 'react'; import { useTranslation } from 'react-i18next'; import { useVegaWallet, useVegaWalletDialogStore } from '@vegaprotocol/wallet'; import { AsyncRenderer, Button, ButtonLink } from '@vegaprotocol/ui-toolkit'; -import { addDecimal, toBigNum } from '@vegaprotocol/react-helpers'; +import { addDecimal, toBigNum } from '@vegaprotocol/utils'; +import { useVoteSubmit } from '@vegaprotocol/governance'; import { ProposalState, VoteValue } from '@vegaprotocol/types'; import { AppStateActionType, diff --git a/apps/token/src/routes/proposals/components/vote-details/vote-transaction-dialog.tsx b/apps/token/src/routes/proposals/components/vote-details/vote-transaction-dialog.tsx index 578dc76ef..fb1872015 100644 --- a/apps/token/src/routes/proposals/components/vote-details/vote-transaction-dialog.tsx +++ b/apps/token/src/routes/proposals/components/vote-details/vote-transaction-dialog.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { VoteState } from './use-user-vote'; import type { DialogProps } from '@vegaprotocol/wallet'; diff --git a/apps/token/src/routes/proposals/hooks/use-proposal-network-params.ts b/apps/token/src/routes/proposals/hooks/use-proposal-network-params.ts index cdeb7d78f..34e14002a 100644 --- a/apps/token/src/routes/proposals/hooks/use-proposal-network-params.ts +++ b/apps/token/src/routes/proposals/hooks/use-proposal-network-params.ts @@ -1,4 +1,4 @@ -import { NetworkParams, useNetworkParams } from '@vegaprotocol/react-helpers'; +import { NetworkParams, useNetworkParams } from '@vegaprotocol/utils'; import { BigNumber } from '../../../lib/bignumber'; import type { ProposalFieldsFragment } from '../proposals/__generated__/Proposals'; import type { ProposalQuery } from '../proposal/__generated__/Proposal'; diff --git a/apps/token/src/routes/proposals/hooks/use-vote-information.ts b/apps/token/src/routes/proposals/hooks/use-vote-information.ts index 7b475d225..741e8f6c8 100644 --- a/apps/token/src/routes/proposals/hooks/use-vote-information.ts +++ b/apps/token/src/routes/proposals/hooks/use-vote-information.ts @@ -4,7 +4,7 @@ import { BigNumber } from '../../../lib/bignumber'; import { useProposalNetworkParams } from './use-proposal-network-params'; import type { ProposalFieldsFragment } from '../proposals/__generated__/Proposals'; import type { ProposalQuery } from '../proposal/__generated__/Proposal'; -import { addDecimal } from '@vegaprotocol/react-helpers'; +import { addDecimal } from '@vegaprotocol/utils'; export const useVoteInformation = ({ proposal, diff --git a/apps/token/src/routes/proposals/proposals/proposals-container.tsx b/apps/token/src/routes/proposals/proposals/proposals-container.tsx index da03e2298..92a2ef4e9 100644 --- a/apps/token/src/routes/proposals/proposals/proposals-container.tsx +++ b/apps/token/src/routes/proposals/proposals/proposals-container.tsx @@ -6,8 +6,8 @@ import { SplashLoader } from '../../../components/splash-loader'; import { ProposalsList } from '../components/proposals-list'; import { useProposalsQuery } from './__generated__/Proposals'; import type { ProposalFieldsFragment } from './__generated__/Proposals'; -import type { NodeConnection, NodeEdge } from '@vegaprotocol/react-helpers'; -import { getNodes } from '@vegaprotocol/react-helpers'; +import type { NodeConnection, NodeEdge } from '@vegaprotocol/utils'; +import { getNodes } from '@vegaprotocol/utils'; import flow from 'lodash/flow'; import { ProposalState } from '@vegaprotocol/types'; diff --git a/apps/token/src/routes/proposals/propose/freeform/propose-freeform.spec.tsx b/apps/token/src/routes/proposals/propose/freeform/propose-freeform.spec.tsx index 530404033..fd2fcd5d4 100644 --- a/apps/token/src/routes/proposals/propose/freeform/propose-freeform.spec.tsx +++ b/apps/token/src/routes/proposals/propose/freeform/propose-freeform.spec.tsx @@ -5,9 +5,9 @@ import { mockWalletContext } from '../../test-helpers/mocks'; import { AppStateProvider } from '../../../../contexts/app-state/app-state-provider'; import { VegaWalletContext } from '@vegaprotocol/wallet'; import { MemoryRouter as Router } from 'react-router-dom'; -import type { NetworkParamsQuery } from '@vegaprotocol/react-helpers'; +import type { NetworkParamsQuery } from '@vegaprotocol/utils'; import type { MockedResponse } from '@apollo/client/testing'; -import { NetworkParamsDocument } from '@vegaprotocol/react-helpers'; +import { NetworkParamsDocument } from '@vegaprotocol/utils'; jest.mock('@vegaprotocol/environment', () => ({ useEnvironment: () => ({ diff --git a/apps/token/src/routes/proposals/propose/freeform/propose-freeform.tsx b/apps/token/src/routes/proposals/propose/freeform/propose-freeform.tsx index 3e4786551..708b9c6ac 100644 --- a/apps/token/src/routes/proposals/propose/freeform/propose-freeform.tsx +++ b/apps/token/src/routes/proposals/propose/freeform/propose-freeform.tsx @@ -22,7 +22,7 @@ import { createDocsLinks, NetworkParams, useNetworkParams, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import { ProposalUserAction } from '../../components/shared'; import { downloadJson } from '../../../../lib/download-json'; diff --git a/apps/token/src/routes/proposals/propose/network-parameter/propose-network-parameter.spec.tsx b/apps/token/src/routes/proposals/propose/network-parameter/propose-network-parameter.spec.tsx index 2afe71cd6..db1165233 100644 --- a/apps/token/src/routes/proposals/propose/network-parameter/propose-network-parameter.spec.tsx +++ b/apps/token/src/routes/proposals/propose/network-parameter/propose-network-parameter.spec.tsx @@ -5,8 +5,8 @@ import { mockWalletContext } from '../../test-helpers/mocks'; import { AppStateProvider } from '../../../../contexts/app-state/app-state-provider'; import { VegaWalletContext } from '@vegaprotocol/wallet'; import { MemoryRouter as Router } from 'react-router-dom'; -import type { NetworkParamsQuery } from '@vegaprotocol/react-helpers'; -import { NetworkParamsDocument } from '@vegaprotocol/react-helpers'; +import type { NetworkParamsQuery } from '@vegaprotocol/utils'; +import { NetworkParamsDocument } from '@vegaprotocol/utils'; import type { MockedResponse } from '@apollo/client/testing'; jest.mock('@vegaprotocol/environment', () => ({ diff --git a/apps/token/src/routes/proposals/propose/network-parameter/propose-network-parameter.tsx b/apps/token/src/routes/proposals/propose/network-parameter/propose-network-parameter.tsx index 2e0315246..00c46ac2d 100644 --- a/apps/token/src/routes/proposals/propose/network-parameter/propose-network-parameter.tsx +++ b/apps/token/src/routes/proposals/propose/network-parameter/propose-network-parameter.tsx @@ -5,7 +5,7 @@ import { createDocsLinks, suitableForSyntaxHighlighter, useNetworkParams, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import { getClosingTimestamp, getEnactmentTimestamp, diff --git a/apps/token/src/routes/proposals/propose/new-asset/propose-new-asset.spec.tsx b/apps/token/src/routes/proposals/propose/new-asset/propose-new-asset.spec.tsx index d82474862..a87595382 100644 --- a/apps/token/src/routes/proposals/propose/new-asset/propose-new-asset.spec.tsx +++ b/apps/token/src/routes/proposals/propose/new-asset/propose-new-asset.spec.tsx @@ -5,9 +5,9 @@ import { VegaWalletContext } from '@vegaprotocol/wallet'; import { AppStateProvider } from '../../../../contexts/app-state/app-state-provider'; import { mockWalletContext } from '../../test-helpers/mocks'; import { ProposeNewAsset } from './propose-new-asset'; -import type { NetworkParamsQuery } from '@vegaprotocol/react-helpers'; +import type { NetworkParamsQuery } from '@vegaprotocol/utils'; import type { MockedResponse } from '@apollo/client/testing'; -import { NetworkParamsDocument } from '@vegaprotocol/react-helpers'; +import { NetworkParamsDocument } from '@vegaprotocol/utils'; jest.mock('@vegaprotocol/environment', () => ({ useEnvironment: () => ({ diff --git a/apps/token/src/routes/proposals/propose/new-asset/propose-new-asset.tsx b/apps/token/src/routes/proposals/propose/new-asset/propose-new-asset.tsx index 86740467b..b41d38d28 100644 --- a/apps/token/src/routes/proposals/propose/new-asset/propose-new-asset.tsx +++ b/apps/token/src/routes/proposals/propose/new-asset/propose-new-asset.tsx @@ -13,7 +13,7 @@ import { NetworkParams, useNetworkParams, validateJson, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import { ProposalFormDescription, ProposalFormSubheader, diff --git a/apps/token/src/routes/proposals/propose/new-market/propose-new-market.spec.tsx b/apps/token/src/routes/proposals/propose/new-market/propose-new-market.spec.tsx index 1c0cd6f03..4fe3982db 100644 --- a/apps/token/src/routes/proposals/propose/new-market/propose-new-market.spec.tsx +++ b/apps/token/src/routes/proposals/propose/new-market/propose-new-market.spec.tsx @@ -6,8 +6,8 @@ import { AppStateProvider } from '../../../../contexts/app-state/app-state-provi import { VegaWalletContext } from '@vegaprotocol/wallet'; import { BrowserRouter as Router } from 'react-router-dom'; import type { MockedResponse } from '@apollo/client/testing'; -import type { NetworkParamsQuery } from '@vegaprotocol/react-helpers'; -import { NetworkParamsDocument } from '@vegaprotocol/react-helpers'; +import type { NetworkParamsQuery } from '@vegaprotocol/utils'; +import { NetworkParamsDocument } from '@vegaprotocol/utils'; jest.mock('@vegaprotocol/environment', () => ({ useEnvironment: () => ({ diff --git a/apps/token/src/routes/proposals/propose/new-market/propose-new-market.tsx b/apps/token/src/routes/proposals/propose/new-market/propose-new-market.tsx index 95979a3c6..6bea9e183 100644 --- a/apps/token/src/routes/proposals/propose/new-market/propose-new-market.tsx +++ b/apps/token/src/routes/proposals/propose/new-market/propose-new-market.tsx @@ -12,7 +12,7 @@ import { NetworkParams, useNetworkParams, validateJson, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import { ProposalFormDescription, ProposalFormSubheader, diff --git a/apps/token/src/routes/proposals/propose/propose.tsx b/apps/token/src/routes/proposals/propose/propose.tsx index 8a8fc951c..45a8d1cc5 100644 --- a/apps/token/src/routes/proposals/propose/propose.tsx +++ b/apps/token/src/routes/proposals/propose/propose.tsx @@ -4,7 +4,7 @@ import { Link } from 'react-router-dom'; import { ExternalLink } from '@vegaprotocol/ui-toolkit'; import { useEnvironment } from '@vegaprotocol/environment'; import { Heading } from '../../../components/heading'; -import { createDocsLinks } from '@vegaprotocol/react-helpers'; +import { createDocsLinks } from '@vegaprotocol/utils'; export const Propose = () => { const { VEGA_DOCS_URL, VEGA_EXPLORER_URL } = useEnvironment(); diff --git a/apps/token/src/routes/proposals/propose/raw/proposal-raw.spec.tsx b/apps/token/src/routes/proposals/propose/raw/proposal-raw.spec.tsx index 240065317..357ee955f 100644 --- a/apps/token/src/routes/proposals/propose/raw/proposal-raw.spec.tsx +++ b/apps/token/src/routes/proposals/propose/raw/proposal-raw.spec.tsx @@ -10,8 +10,8 @@ import { ProposeRaw } from './propose-raw'; import { ProposalEventDocument } from '@vegaprotocol/governance'; import type { ProposalEventSubscription } from '@vegaprotocol/governance'; -import type { NetworkParamsQuery } from '@vegaprotocol/react-helpers'; -import { NetworkParamsDocument } from '@vegaprotocol/react-helpers'; +import type { NetworkParamsQuery } from '@vegaprotocol/utils'; +import { NetworkParamsDocument } from '@vegaprotocol/utils'; const paramsDelay = 20; diff --git a/apps/token/src/routes/proposals/propose/raw/propose-raw.tsx b/apps/token/src/routes/proposals/propose/raw/propose-raw.tsx index 6d74f0a84..29ae11b09 100644 --- a/apps/token/src/routes/proposals/propose/raw/propose-raw.tsx +++ b/apps/token/src/routes/proposals/propose/raw/propose-raw.tsx @@ -14,7 +14,7 @@ import { NetworkParams, useNetworkParams, validateJson, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import { useProposalSubmit } from '@vegaprotocol/governance'; import { ProposalFormSubmit, diff --git a/apps/token/src/routes/proposals/propose/update-asset/propose-update-asset.spec.tsx b/apps/token/src/routes/proposals/propose/update-asset/propose-update-asset.spec.tsx index cd86a9994..b15b103f5 100644 --- a/apps/token/src/routes/proposals/propose/update-asset/propose-update-asset.spec.tsx +++ b/apps/token/src/routes/proposals/propose/update-asset/propose-update-asset.spec.tsx @@ -5,9 +5,9 @@ import { VegaWalletContext } from '@vegaprotocol/wallet'; import { AppStateProvider } from '../../../../contexts/app-state/app-state-provider'; import { mockWalletContext } from '../../test-helpers/mocks'; import { ProposeUpdateAsset } from './propose-update-asset'; -import type { NetworkParamsQuery } from '@vegaprotocol/react-helpers'; +import type { NetworkParamsQuery } from '@vegaprotocol/utils'; import type { MockedResponse } from '@apollo/client/testing'; -import { NetworkParamsDocument } from '@vegaprotocol/react-helpers'; +import { NetworkParamsDocument } from '@vegaprotocol/utils'; jest.mock('@vegaprotocol/environment', () => ({ useEnvironment: () => ({ diff --git a/apps/token/src/routes/proposals/propose/update-asset/propose-update-asset.tsx b/apps/token/src/routes/proposals/propose/update-asset/propose-update-asset.tsx index e11da2411..8b587d492 100644 --- a/apps/token/src/routes/proposals/propose/update-asset/propose-update-asset.tsx +++ b/apps/token/src/routes/proposals/propose/update-asset/propose-update-asset.tsx @@ -12,7 +12,7 @@ import { NetworkParams, useNetworkParams, validateJson, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import { ProposalFormDescription, ProposalFormSubheader, diff --git a/apps/token/src/routes/proposals/propose/update-market/propose-update-market.spec.tsx b/apps/token/src/routes/proposals/propose/update-market/propose-update-market.spec.tsx index 2b8f6776f..b11a17248 100644 --- a/apps/token/src/routes/proposals/propose/update-market/propose-update-market.spec.tsx +++ b/apps/token/src/routes/proposals/propose/update-market/propose-update-market.spec.tsx @@ -6,8 +6,8 @@ import { VegaWalletContext } from '@vegaprotocol/wallet'; import { AppStateProvider } from '../../../../contexts/app-state/app-state-provider'; import { mockWalletContext } from '../../test-helpers/mocks'; import { ProposeUpdateMarket } from './propose-update-market'; -import type { NetworkParamsQuery } from '@vegaprotocol/react-helpers'; -import { NetworkParamsDocument } from '@vegaprotocol/react-helpers'; +import type { NetworkParamsQuery } from '@vegaprotocol/utils'; +import { NetworkParamsDocument } from '@vegaprotocol/utils'; import type { ProposalMarketsQueryQuery } from './__generated___/UpdateMarket'; import { ProposalMarketsQueryDocument } from './__generated___/UpdateMarket'; diff --git a/apps/token/src/routes/proposals/propose/update-market/propose-update-market.tsx b/apps/token/src/routes/proposals/propose/update-market/propose-update-market.tsx index a2421ff03..41cae0f7d 100644 --- a/apps/token/src/routes/proposals/propose/update-market/propose-update-market.tsx +++ b/apps/token/src/routes/proposals/propose/update-market/propose-update-market.tsx @@ -13,7 +13,7 @@ import { NetworkParams, useNetworkParams, validateJson, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import { ProposalFormDescription, ProposalFormSubheader, diff --git a/apps/token/src/routes/proposals/rejected/rejected-proposals-container.tsx b/apps/token/src/routes/proposals/rejected/rejected-proposals-container.tsx index 298525c32..b65e239b9 100644 --- a/apps/token/src/routes/proposals/rejected/rejected-proposals-container.tsx +++ b/apps/token/src/routes/proposals/rejected/rejected-proposals-container.tsx @@ -6,8 +6,8 @@ import { SplashLoader } from '../../../components/splash-loader'; import { RejectedProposalsList } from '../components/proposals-list'; import type { ProposalFieldsFragment } from '../proposals/__generated__/Proposals'; import { useProposalsQuery } from '../proposals/__generated__/Proposals'; -import type { NodeConnection, NodeEdge } from '@vegaprotocol/react-helpers'; -import { getNodes } from '@vegaprotocol/react-helpers'; +import type { NodeConnection, NodeEdge } from '@vegaprotocol/utils'; +import { getNodes } from '@vegaprotocol/utils'; import flow from 'lodash/flow'; import orderBy from 'lodash/orderBy'; import { ProposalState } from '@vegaprotocol/types'; diff --git a/apps/token/src/routes/proposals/test-helpers/mocks.ts b/apps/token/src/routes/proposals/test-helpers/mocks.ts index abb233013..5671f2a0c 100644 --- a/apps/token/src/routes/proposals/test-helpers/mocks.ts +++ b/apps/token/src/routes/proposals/test-helpers/mocks.ts @@ -1,6 +1,6 @@ -import { NetworkParamsDocument } from '@vegaprotocol/react-helpers'; +import { NetworkParamsDocument } from '@vegaprotocol/utils'; import type { MockedResponse } from '@apollo/client/testing'; -import type { NetworkParamsQuery } from '@vegaprotocol/react-helpers'; +import type { NetworkParamsQuery } from '@vegaprotocol/utils'; import type { PubKey } from '@vegaprotocol/wallet'; export const mockPubkey: PubKey = { diff --git a/apps/token/src/routes/redemption/hooks.ts b/apps/token/src/routes/redemption/hooks.ts index 2afefe4eb..6d7638d7b 100644 --- a/apps/token/src/routes/redemption/hooks.ts +++ b/apps/token/src/routes/redemption/hooks.ts @@ -3,7 +3,7 @@ import { useCallback, useEffect, useState } from 'react'; import { useTranches } from '../../lib/tranches/tranches-store'; import { useContracts } from '../../contexts/contracts/contracts-context'; import BigNumber from 'bignumber.js'; -import { toBigNum } from '@vegaprotocol/react-helpers'; +import { toBigNum } from '@vegaprotocol/utils'; import { useAppState } from '../../contexts/app-state/app-state-context'; export const useUserTrancheBalances = (address: string | undefined) => { diff --git a/apps/token/src/routes/rewards/epoch-individual-rewards/epoch-individual-rewards-table.tsx b/apps/token/src/routes/rewards/epoch-individual-rewards/epoch-individual-rewards-table.tsx index 3a38e8098..eed2a8f24 100644 --- a/apps/token/src/routes/rewards/epoch-individual-rewards/epoch-individual-rewards-table.tsx +++ b/apps/token/src/routes/rewards/epoch-individual-rewards/epoch-individual-rewards-table.tsx @@ -1,4 +1,4 @@ -import { formatNumber, toBigNum } from '@vegaprotocol/react-helpers'; +import { formatNumber, toBigNum } from '@vegaprotocol/utils'; import { Tooltip } from '@vegaprotocol/ui-toolkit'; import { useAppState } from '../../../contexts/app-state/app-state-context'; import { diff --git a/apps/token/src/routes/rewards/epoch-individual-rewards/epoch-individual-rewards.tsx b/apps/token/src/routes/rewards/epoch-individual-rewards/epoch-individual-rewards.tsx index a3a3ec01d..287b94fb5 100644 --- a/apps/token/src/routes/rewards/epoch-individual-rewards/epoch-individual-rewards.tsx +++ b/apps/token/src/routes/rewards/epoch-individual-rewards/epoch-individual-rewards.tsx @@ -1,7 +1,7 @@ import { useMemo } from 'react'; import { useTranslation } from 'react-i18next'; import { AsyncRenderer } from '@vegaprotocol/ui-toolkit'; -import { removePaginationWrapper } from '@vegaprotocol/react-helpers'; +import { removePaginationWrapper } from '@vegaprotocol/utils'; import { useRewardsQuery } from '../home/__generated__/Rewards'; import { ENV } from '../../../config'; import { useVegaWallet } from '@vegaprotocol/wallet'; diff --git a/apps/token/src/routes/rewards/epoch-total-rewards/epoch-total-rewards-table.tsx b/apps/token/src/routes/rewards/epoch-total-rewards/epoch-total-rewards-table.tsx index 094afa8ac..45f5caa1f 100644 --- a/apps/token/src/routes/rewards/epoch-total-rewards/epoch-total-rewards-table.tsx +++ b/apps/token/src/routes/rewards/epoch-total-rewards/epoch-total-rewards-table.tsx @@ -1,4 +1,4 @@ -import { formatNumber, toBigNum } from '@vegaprotocol/react-helpers'; +import { formatNumber, toBigNum } from '@vegaprotocol/utils'; import { Tooltip } from '@vegaprotocol/ui-toolkit'; import { useAppState } from '../../../contexts/app-state/app-state-context'; import { diff --git a/apps/token/src/routes/rewards/epoch-total-rewards/generate-epoch-total-rewards-list.ts b/apps/token/src/routes/rewards/epoch-total-rewards/generate-epoch-total-rewards-list.ts index dc35bf97a..87c51b010 100644 --- a/apps/token/src/routes/rewards/epoch-total-rewards/generate-epoch-total-rewards-list.ts +++ b/apps/token/src/routes/rewards/epoch-total-rewards/generate-epoch-total-rewards-list.ts @@ -2,7 +2,7 @@ import type { EpochAssetsRewardsQuery, EpochRewardSummaryFieldsFragment, } from '../home/__generated__/Rewards'; -import { removePaginationWrapper } from '@vegaprotocol/react-helpers'; +import { removePaginationWrapper } from '@vegaprotocol/utils'; import { RowAccountTypes } from '../shared-rewards-table-assets/shared-rewards-table-assets'; import type { AccountType } from '@vegaprotocol/types'; import { BigNumber } from '../../../lib/bignumber'; diff --git a/apps/token/src/routes/rewards/home/rewards-page.tsx b/apps/token/src/routes/rewards/home/rewards-page.tsx index b65359786..18262162a 100644 --- a/apps/token/src/routes/rewards/home/rewards-page.tsx +++ b/apps/token/src/routes/rewards/home/rewards-page.tsx @@ -15,7 +15,7 @@ import { useNetworkParams, NetworkParams, createDocsLinks, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import { useEpochQuery } from './__generated__/Rewards'; import { EpochCountdown } from '../../../components/epoch-countdown'; diff --git a/apps/token/src/routes/staking/associate/hooks.ts b/apps/token/src/routes/staking/associate/hooks.ts index 954fab689..65d967556 100644 --- a/apps/token/src/routes/staking/associate/hooks.ts +++ b/apps/token/src/routes/staking/associate/hooks.ts @@ -9,10 +9,7 @@ import { useGetAssociationBreakdown } from '../../../hooks/use-get-association-b import { useRefreshBalances } from '../../../hooks/use-refresh-balances'; import { useTransaction } from '../../../hooks/use-transaction'; import { useAppState } from '../../../contexts/app-state/app-state-context'; -import { - removeDecimal, - removePaginationWrapper, -} from '@vegaprotocol/react-helpers'; +import { removeDecimal, removePaginationWrapper } from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; import type { LinkingsFieldsFragment, diff --git a/apps/token/src/routes/staking/associate/wallet-associate.tsx b/apps/token/src/routes/staking/associate/wallet-associate.tsx index bd099d2cf..67c815620 100644 --- a/apps/token/src/routes/staking/associate/wallet-associate.tsx +++ b/apps/token/src/routes/staking/associate/wallet-associate.tsx @@ -8,7 +8,7 @@ import { TxState } from '../../../hooks/transaction-reducer'; import { useTransaction } from '../../../hooks/use-transaction'; import { BigNumber } from '../../../lib/bignumber'; import { AssociateInfo } from './associate-info'; -import { removeDecimal, toBigNum } from '@vegaprotocol/react-helpers'; +import { removeDecimal, toBigNum } from '@vegaprotocol/utils'; import type { EthereumConfig } from '@vegaprotocol/web3'; import { useBalances } from '../../../lib/balances/balances-store'; diff --git a/apps/token/src/routes/staking/disassociate/components/disassociate-page/disassociate-page.tsx b/apps/token/src/routes/staking/disassociate/components/disassociate-page/disassociate-page.tsx index ab21eba2c..59426a955 100644 --- a/apps/token/src/routes/staking/disassociate/components/disassociate-page/disassociate-page.tsx +++ b/apps/token/src/routes/staking/disassociate/components/disassociate-page/disassociate-page.tsx @@ -1,6 +1,6 @@ import { DisassociateTransaction } from '../disassociate-transaction'; import { formatNumber } from '../../../../../lib/format-number'; -import { remove0x, toBigNum } from '@vegaprotocol/react-helpers'; +import { remove0x, toBigNum } from '@vegaprotocol/utils'; import { Select } from '@vegaprotocol/ui-toolkit'; import { StakingMethod } from '../../../../../components/staking-method-radio'; import { TokenInput } from '../../../../../components/token-input'; diff --git a/apps/token/src/routes/staking/disassociate/hooks.ts b/apps/token/src/routes/staking/disassociate/hooks.ts index 8f29a18ab..3390eae7e 100644 --- a/apps/token/src/routes/staking/disassociate/hooks.ts +++ b/apps/token/src/routes/staking/disassociate/hooks.ts @@ -1,4 +1,4 @@ -import { removeDecimal } from '@vegaprotocol/react-helpers'; +import { removeDecimal } from '@vegaprotocol/utils'; import { useAppState } from '../../../contexts/app-state/app-state-context'; import React from 'react'; diff --git a/apps/token/src/routes/staking/home/staking.tsx b/apps/token/src/routes/staking/home/staking.tsx index 1c0ee89b3..15bc597b0 100644 --- a/apps/token/src/routes/staking/home/staking.tsx +++ b/apps/token/src/routes/staking/home/staking.tsx @@ -2,7 +2,7 @@ import { useTranslation } from 'react-i18next'; import { EpochData } from './epoch-data'; import { useEnvironment } from '@vegaprotocol/environment'; import { ExternalLink } from '@vegaprotocol/ui-toolkit'; -import { createDocsLinks } from '@vegaprotocol/react-helpers'; +import { createDocsLinks } from '@vegaprotocol/utils'; import { Heading } from '../../../components/heading'; import React from 'react'; diff --git a/apps/token/src/routes/staking/home/validator-tables/consensus-validators-table.tsx b/apps/token/src/routes/staking/home/validator-tables/consensus-validators-table.tsx index d8a91e02d..5be86fc70 100644 --- a/apps/token/src/routes/staking/home/validator-tables/consensus-validators-table.tsx +++ b/apps/token/src/routes/staking/home/validator-tables/consensus-validators-table.tsx @@ -32,7 +32,7 @@ import { formatNumber, formatNumberPercentage, toBigNum, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; interface CanonisedConsensusNodeProps { id: string; diff --git a/apps/token/src/routes/staking/home/validator-tables/shared.tsx b/apps/token/src/routes/staking/home/validator-tables/shared.tsx index a86dee9b5..9cd23f2d6 100644 --- a/apps/token/src/routes/staking/home/validator-tables/shared.tsx +++ b/apps/token/src/routes/staking/home/validator-tables/shared.tsx @@ -4,7 +4,7 @@ import { formatNumber, formatNumberPercentage, toBigNum, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import { Button, Tooltip, diff --git a/apps/token/src/routes/staking/home/validator-tables/standby-pending-validators-table.tsx b/apps/token/src/routes/staking/home/validator-tables/standby-pending-validators-table.tsx index 3d2d5b07e..27a9a56a5 100644 --- a/apps/token/src/routes/staking/home/validator-tables/standby-pending-validators-table.tsx +++ b/apps/token/src/routes/staking/home/validator-tables/standby-pending-validators-table.tsx @@ -25,7 +25,7 @@ import { import type { AgGridReact } from 'ag-grid-react'; import type { ColDef } from 'ag-grid-community'; import type { ValidatorsTableProps } from './shared'; -import { formatNumber, toBigNum } from '@vegaprotocol/react-helpers'; +import { formatNumber, toBigNum } from '@vegaprotocol/utils'; interface StandbyPendingValidatorsTableProps extends ValidatorsTableProps { stakeNeededForPromotion: string | undefined; diff --git a/apps/token/src/routes/staking/home/validator-tables/validator-tables.tsx b/apps/token/src/routes/staking/home/validator-tables/validator-tables.tsx index 315873ec7..df5523311 100644 --- a/apps/token/src/routes/staking/home/validator-tables/validator-tables.tsx +++ b/apps/token/src/routes/staking/home/validator-tables/validator-tables.tsx @@ -8,7 +8,7 @@ import { createDocsLinks, removePaginationWrapper, toBigNum, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import { Link as UTLink } from '@vegaprotocol/ui-toolkit'; import { SubHeading } from '../../../../components/heading'; import { useEnvironment } from '@vegaprotocol/environment'; diff --git a/apps/token/src/routes/staking/node/node.tsx b/apps/token/src/routes/staking/node/node.tsx index 987c11150..888f9ab12 100644 --- a/apps/token/src/routes/staking/node/node.tsx +++ b/apps/token/src/routes/staking/node/node.tsx @@ -7,7 +7,7 @@ import { addDecimal, removePaginationWrapper, toBigNum, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import { Link } from 'react-router-dom'; import { Icon } from '@vegaprotocol/ui-toolkit'; import { EpochCountdown } from '../../../components/epoch-countdown'; diff --git a/apps/token/src/routes/staking/node/pending-stake.tsx b/apps/token/src/routes/staking/node/pending-stake.tsx index 8a140efe5..8007baa01 100644 --- a/apps/token/src/routes/staking/node/pending-stake.tsx +++ b/apps/token/src/routes/staking/node/pending-stake.tsx @@ -6,7 +6,7 @@ import { useAppState } from '../../../contexts/app-state/app-state-context'; import type { BigNumber } from '../../../lib/bignumber'; import type { UndelegateSubmissionBody } from '@vegaprotocol/wallet'; import { useVegaWallet } from '@vegaprotocol/wallet'; -import { removeDecimal } from '@vegaprotocol/react-helpers'; +import { removeDecimal } from '@vegaprotocol/utils'; interface PendingStakeProps { pendingAmount: BigNumber; diff --git a/apps/token/src/routes/staking/node/staking-form.tsx b/apps/token/src/routes/staking/node/staking-form.tsx index f6bfba5bf..aff8eed8a 100644 --- a/apps/token/src/routes/staking/node/staking-form.tsx +++ b/apps/token/src/routes/staking/node/staking-form.tsx @@ -22,7 +22,7 @@ import { removeDecimal, addDecimal, removePaginationWrapper, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import { useBalances } from '../../../lib/balances/balances-store'; import { useVegaWallet } from '@vegaprotocol/wallet'; import { SubHeading } from '../../../components/heading'; diff --git a/apps/token/src/routes/staking/node/validator-table.spec.tsx b/apps/token/src/routes/staking/node/validator-table.spec.tsx index b1dd90e90..9e2ea3099 100644 --- a/apps/token/src/routes/staking/node/validator-table.spec.tsx +++ b/apps/token/src/routes/staking/node/validator-table.spec.tsx @@ -3,7 +3,7 @@ import { AppStateProvider } from '../../../contexts/app-state/app-state-provider import { ValidatorTable } from './validator-table'; import { ValidatorStatus } from '@vegaprotocol/types'; import countryData from '../../../components/country-selector/country-data'; -import { formatNumber, toBigNum } from '@vegaprotocol/react-helpers'; +import { formatNumber, toBigNum } from '@vegaprotocol/utils'; const mockNode = { id: 'bb1822715aa86ce0e205aa4c78e9b71cdeaec94596ce72d366f0d50589eb1bf5', diff --git a/apps/token/src/routes/staking/node/validator-table.tsx b/apps/token/src/routes/staking/node/validator-table.tsx index 7e03dfcb9..e47deae89 100644 --- a/apps/token/src/routes/staking/node/validator-table.tsx +++ b/apps/token/src/routes/staking/node/validator-table.tsx @@ -1,11 +1,7 @@ import React, { useMemo } from 'react'; import { useTranslation } from 'react-i18next'; import { useEnvironment } from '@vegaprotocol/environment'; -import { - createDocsLinks, - ExternalLinks, - toBigNum, -} from '@vegaprotocol/react-helpers'; +import { createDocsLinks, ExternalLinks, toBigNum } from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; import { Link as UTLink, diff --git a/apps/token/src/routes/staking/shared.ts b/apps/token/src/routes/staking/shared.ts index 31e727710..520af5798 100644 --- a/apps/token/src/routes/staking/shared.ts +++ b/apps/token/src/routes/staking/shared.ts @@ -1,7 +1,7 @@ import { formatNumberPercentage, removePaginationWrapper, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import type { PreviousEpochQuery } from './__generated___/PreviousEpoch'; import { BigNumber } from '../../lib/bignumber'; diff --git a/apps/token/src/routes/token/index.tsx b/apps/token/src/routes/token/index.tsx index dd5c64982..0f332299b 100644 --- a/apps/token/src/routes/token/index.tsx +++ b/apps/token/src/routes/token/index.tsx @@ -3,14 +3,14 @@ import { Trans, useTranslation } from 'react-i18next'; import { Link } from 'react-router-dom'; import { Heading, SubHeading } from '../../components/heading'; -import { ExternalLinks } from '@vegaprotocol/react-helpers'; +import { ExternalLinks } from '@vegaprotocol/utils'; import { useAppState } from '../../contexts/app-state/app-state-context'; import { useDocumentTitle } from '../../hooks/use-document-title'; import type { RouteChildProps } from '..'; import Routes from '../routes'; import { TokenDetails } from './token-details'; import { Button } from '@vegaprotocol/ui-toolkit'; -import { toBigNum } from '@vegaprotocol/react-helpers'; +import { toBigNum } from '@vegaprotocol/utils'; import { useNodeDataQuery } from './__generated___/NodeData'; const Home = ({ name }: RouteChildProps) => { diff --git a/apps/token/src/routes/tranches/tranche.tsx b/apps/token/src/routes/tranches/tranche.tsx index 748afb1f7..eb433d6d7 100644 --- a/apps/token/src/routes/tranches/tranche.tsx +++ b/apps/token/src/routes/tranches/tranche.tsx @@ -9,7 +9,7 @@ import { useWeb3React } from '@web3-react/core'; import { useTranslation } from 'react-i18next'; import { useParams } from 'react-router'; import { Navigate } from 'react-router-dom'; -import { formatNumber } from '@vegaprotocol/react-helpers'; +import { formatNumber } from '@vegaprotocol/utils'; import { useEnvironment } from '@vegaprotocol/environment'; import { TrancheItem } from '../redemption/tranche-item'; diff --git a/apps/token/src/routes/withdrawals/index.tsx b/apps/token/src/routes/withdrawals/index.tsx index 35cee5150..668ec11a3 100644 --- a/apps/token/src/routes/withdrawals/index.tsx +++ b/apps/token/src/routes/withdrawals/index.tsx @@ -10,7 +10,7 @@ import { WithdrawalsTable, } from '@vegaprotocol/withdraws'; import { useVegaWallet } from '@vegaprotocol/wallet'; -import { useDataProvider } from '@vegaprotocol/react-helpers'; +import { useDataProvider } from '@vegaprotocol/utils'; import { useDocumentTitle } from '../../hooks/use-document-title'; import type { RouteChildProps } from '../index'; diff --git a/apps/trading-e2e/src/integration/markets.cy.ts b/apps/trading-e2e/src/integration/markets.cy.ts index 0ca5eea9a..3a9e23198 100644 --- a/apps/trading-e2e/src/integration/markets.cy.ts +++ b/apps/trading-e2e/src/integration/markets.cy.ts @@ -1,7 +1,7 @@ import * as Schema from '@vegaprotocol/types'; import { aliasGQLQuery } from '@vegaprotocol/cypress'; import { marketsQuery } from '@vegaprotocol/mock'; -import { getDateTimeFormat } from '@vegaprotocol/react-helpers'; +import { getDateTimeFormat } from '@vegaprotocol/utils'; const dialogCloseBtn = 'dialog-close'; const popoverTrigger = 'popover-trigger'; diff --git a/apps/trading/client-pages/home/home.tsx b/apps/trading/client-pages/home/home.tsx index 59b4b1556..ce99d74f8 100644 --- a/apps/trading/client-pages/home/home.tsx +++ b/apps/trading/client-pages/home/home.tsx @@ -1,7 +1,7 @@ import { useEffect } from 'react'; import { useNavigate } from 'react-router-dom'; import { marketsWithDataProvider } from '@vegaprotocol/market-list'; -import { useDataProvider } from '@vegaprotocol/react-helpers'; +import { useDataProvider } from '@vegaprotocol/utils'; import { AsyncRenderer } from '@vegaprotocol/ui-toolkit'; import { Links, Routes } from '../../pages/client-router'; import { useGlobalStore } from '../../stores'; diff --git a/apps/trading/client-pages/liquidity/liquidity.tsx b/apps/trading/client-pages/liquidity/liquidity.tsx index bcf0b231f..a96faa267 100644 --- a/apps/trading/client-pages/liquidity/liquidity.tsx +++ b/apps/trading/client-pages/liquidity/liquidity.tsx @@ -13,7 +13,7 @@ import { useDataProvider, useNetworkParams, updateGridData, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; import { AsyncRenderer, diff --git a/apps/trading/client-pages/market/constants.ts b/apps/trading/client-pages/market/constants.ts index 6cc7dbad6..56590c6ae 100644 --- a/apps/trading/client-pages/market/constants.ts +++ b/apps/trading/client-pages/market/constants.ts @@ -1,3 +1,3 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; export const NO_MARKET = t('No market'); diff --git a/apps/trading/client-pages/market/market.tsx b/apps/trading/client-pages/market/market.tsx index 72e7024a7..11008414d 100644 --- a/apps/trading/client-pages/market/market.tsx +++ b/apps/trading/client-pages/market/market.tsx @@ -6,7 +6,7 @@ import { titlefy, useDataProvider, useThrottledDataProvider, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import { AsyncRenderer, ExternalLink, Splash } from '@vegaprotocol/ui-toolkit'; import type { MarketData, diff --git a/apps/trading/client-pages/market/trade-grid.tsx b/apps/trading/client-pages/market/trade-grid.tsx index 37fd8d38b..f59684330 100644 --- a/apps/trading/client-pages/market/trade-grid.tsx +++ b/apps/trading/client-pages/market/trade-grid.tsx @@ -19,7 +19,7 @@ import { ResizableGridPanel, Splash, } from '@vegaprotocol/ui-toolkit'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { AccountsContainer } from '../../components/accounts-container'; import type { Market } from '@vegaprotocol/market-list'; import { VegaWalletContainer } from '../../components/vega-wallet-container'; diff --git a/apps/trading/client-pages/market/trade-market-header.tsx b/apps/trading/client-pages/market/trade-market-header.tsx index 19225893e..d8a05b1a1 100644 --- a/apps/trading/client-pages/market/trade-market-header.tsx +++ b/apps/trading/client-pages/market/trade-market-header.tsx @@ -3,11 +3,7 @@ import { useEnvironment } from '@vegaprotocol/environment'; import { ButtonLink, Link } from '@vegaprotocol/ui-toolkit'; import { MarketProposalNotification } from '@vegaprotocol/governance'; import type { Market } from '@vegaprotocol/market-list'; -import { - getExpiryDate, - getMarketExpiryDate, - t, -} from '@vegaprotocol/react-helpers'; +import { getExpiryDate, getMarketExpiryDate, t } from '@vegaprotocol/utils'; import { ColumnKind, SelectMarketPopover, diff --git a/apps/trading/client-pages/markets/markets-page.tsx b/apps/trading/client-pages/markets/markets-page.tsx index 01538afdf..8b507fb38 100644 --- a/apps/trading/client-pages/markets/markets-page.tsx +++ b/apps/trading/client-pages/markets/markets-page.tsx @@ -1,5 +1,5 @@ import React, { useEffect } from 'react'; -import { t, titlefy } from '@vegaprotocol/react-helpers'; +import { t, titlefy } from '@vegaprotocol/utils'; import { Tabs, Tab } from '@vegaprotocol/ui-toolkit'; import { Markets } from './markets'; import { Proposed } from './proposed'; diff --git a/apps/trading/client-pages/markets/proposed.tsx b/apps/trading/client-pages/markets/proposed.tsx index c8a543f6e..74bcb9a5f 100644 --- a/apps/trading/client-pages/markets/proposed.tsx +++ b/apps/trading/client-pages/markets/proposed.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { DApp, TOKEN_NEW_MARKET_PROPOSAL, diff --git a/apps/trading/client-pages/portfolio/account-history-container.tsx b/apps/trading/client-pages/portfolio/account-history-container.tsx index db75ceee4..8547a24dc 100644 --- a/apps/trading/client-pages/portfolio/account-history-container.tsx +++ b/apps/trading/client-pages/portfolio/account-history-container.tsx @@ -3,7 +3,7 @@ import { fromNanoSeconds, t, useThemeSwitcher, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import { useVegaWallet } from '@vegaprotocol/wallet'; import compact from 'lodash/compact'; import uniqBy from 'lodash/uniqBy'; @@ -28,7 +28,7 @@ import { PriceChart } from 'pennant'; import 'pennant/dist/style.css'; import type { Account } from '@vegaprotocol/accounts'; import { accountsDataProvider } from '@vegaprotocol/accounts'; -import { useDataProvider } from '@vegaprotocol/react-helpers'; +import { useDataProvider } from '@vegaprotocol/utils'; import type { Market } from '@vegaprotocol/market-list'; const DateRange = { diff --git a/apps/trading/client-pages/portfolio/deposits-container.tsx b/apps/trading/client-pages/portfolio/deposits-container.tsx index 23c7d2518..4a045108f 100644 --- a/apps/trading/client-pages/portfolio/deposits-container.tsx +++ b/apps/trading/client-pages/portfolio/deposits-container.tsx @@ -1,7 +1,7 @@ import { AsyncRenderer, Button } from '@vegaprotocol/ui-toolkit'; import { useDepositDialog, DepositsTable } from '@vegaprotocol/deposits'; import { depositsProvider } from '@vegaprotocol/deposits'; -import { t, useDataProvider } from '@vegaprotocol/react-helpers'; +import { t, useDataProvider } from '@vegaprotocol/utils'; import { useVegaWallet } from '@vegaprotocol/wallet'; export const DepositsContainer = () => { diff --git a/apps/trading/client-pages/portfolio/portfolio.tsx b/apps/trading/client-pages/portfolio/portfolio.tsx index c21c46472..2abb188bd 100644 --- a/apps/trading/client-pages/portfolio/portfolio.tsx +++ b/apps/trading/client-pages/portfolio/portfolio.tsx @@ -1,4 +1,4 @@ -import { t, titlefy } from '@vegaprotocol/react-helpers'; +import { t, titlefy } from '@vegaprotocol/utils'; import { PositionsContainer } from '@vegaprotocol/positions'; import { OrderListContainer } from '@vegaprotocol/orders'; import { ResizableGridPanel, Tab, Tabs } from '@vegaprotocol/ui-toolkit'; diff --git a/apps/trading/client-pages/portfolio/withdrawals-container.tsx b/apps/trading/client-pages/portfolio/withdrawals-container.tsx index 3fe597265..4c310b690 100644 --- a/apps/trading/client-pages/portfolio/withdrawals-container.tsx +++ b/apps/trading/client-pages/portfolio/withdrawals-container.tsx @@ -5,7 +5,7 @@ import { WithdrawalsTable, } from '@vegaprotocol/withdraws'; import { useVegaWallet } from '@vegaprotocol/wallet'; -import { t, useDataProvider } from '@vegaprotocol/react-helpers'; +import { t, useDataProvider } from '@vegaprotocol/utils'; import { VegaWalletContainer } from '../../components/vega-wallet-container'; export const WithdrawalsContainer = () => { diff --git a/apps/trading/components/accounts-container/accounts-container.tsx b/apps/trading/components/accounts-container/accounts-container.tsx index 8dd6d4f73..2fd219c41 100644 --- a/apps/trading/components/accounts-container/accounts-container.tsx +++ b/apps/trading/components/accounts-container/accounts-container.tsx @@ -1,6 +1,6 @@ import { useCallback } from 'react'; import { Button } from '@vegaprotocol/ui-toolkit'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { useWithdrawalDialog } from '@vegaprotocol/withdraws'; import { useAssetDetailsDialogStore } from '@vegaprotocol/assets'; import { Splash } from '@vegaprotocol/ui-toolkit'; diff --git a/apps/trading/components/app-loader/app-failure.tsx b/apps/trading/components/app-loader/app-failure.tsx index 0057955ed..daf79caa1 100644 --- a/apps/trading/components/app-loader/app-failure.tsx +++ b/apps/trading/components/app-loader/app-failure.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { Button } from '@vegaprotocol/ui-toolkit'; import { useGlobalStore } from '../../stores'; diff --git a/apps/trading/components/app-loader/app-loader.tsx b/apps/trading/components/app-loader/app-loader.tsx index caeae848f..5c16a0fe1 100644 --- a/apps/trading/components/app-loader/app-loader.tsx +++ b/apps/trading/components/app-loader/app-loader.tsx @@ -4,7 +4,7 @@ import { NodeGuard, useEnvironment, } from '@vegaprotocol/environment'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { MaintenancePage } from '@vegaprotocol/ui-toolkit'; import { VegaWalletProvider } from '@vegaprotocol/wallet'; import dynamic from 'next/dynamic'; diff --git a/apps/trading/components/app-loader/web3-provider.tsx b/apps/trading/components/app-loader/web3-provider.tsx index 290d9309c..040c1aeb9 100644 --- a/apps/trading/components/app-loader/web3-provider.tsx +++ b/apps/trading/components/app-loader/web3-provider.tsx @@ -5,7 +5,7 @@ import { useWeb3ConnectStore, } from '@vegaprotocol/web3'; import { AsyncRenderer } from '@vegaprotocol/ui-toolkit'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { useEnvironment } from '@vegaprotocol/environment'; import type { ReactNode } from 'react'; import { useEffect } from 'react'; diff --git a/apps/trading/components/constants.ts b/apps/trading/components/constants.ts index 014fa9835..bf7f86fa0 100644 --- a/apps/trading/components/constants.ts +++ b/apps/trading/components/constants.ts @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; export const THROTTLE_UPDATE_TIME = 500; export const RISK_ACCEPTED_KEY = 'vega-risk-accepted'; export const MAINNET_WELCOME_HEADER = t( diff --git a/apps/trading/components/footer/footer.tsx b/apps/trading/components/footer/footer.tsx index de0e14d2d..fd2098365 100644 --- a/apps/trading/components/footer/footer.tsx +++ b/apps/trading/components/footer/footer.tsx @@ -1,5 +1,6 @@ import { useEnvironment, useNodeHealth } from '@vegaprotocol/environment'; -import { t, useNavigatorOnline } from '@vegaprotocol/react-helpers'; +import { useNavigatorOnline } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { Indicator, Intent } from '@vegaprotocol/ui-toolkit'; import classNames from 'classnames'; import type { ButtonHTMLAttributes, ReactNode } from 'react'; diff --git a/apps/trading/components/last-24h-price-change/last-24h-price-change.tsx b/apps/trading/components/last-24h-price-change/last-24h-price-change.tsx index 31e5621ab..bcd73a0b9 100644 --- a/apps/trading/components/last-24h-price-change/last-24h-price-change.tsx +++ b/apps/trading/components/last-24h-price-change/last-24h-price-change.tsx @@ -5,7 +5,7 @@ import { isNumeric, useThrottledDataProvider, useYesterday, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import { PriceCellChange } from '@vegaprotocol/ui-toolkit'; import * as Schema from '@vegaprotocol/types'; import type { CandleClose } from '@vegaprotocol/types'; diff --git a/apps/trading/components/last-24h-volume/last-24h-volume.tsx b/apps/trading/components/last-24h-volume/last-24h-volume.tsx index d1011463f..64854e406 100644 --- a/apps/trading/components/last-24h-volume/last-24h-volume.tsx +++ b/apps/trading/components/last-24h-volume/last-24h-volume.tsx @@ -9,7 +9,7 @@ import { useThrottledDataProvider, useYesterday, isNumeric, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; import { useMemo } from 'react'; import type { Candle } from '@vegaprotocol/market-list'; diff --git a/apps/trading/components/liquidity-supplied/liquidity-supplied.tsx b/apps/trading/components/liquidity-supplied/liquidity-supplied.tsx index 3103aceab..c6a38da83 100644 --- a/apps/trading/components/liquidity-supplied/liquidity-supplied.tsx +++ b/apps/trading/components/liquidity-supplied/liquidity-supplied.tsx @@ -6,7 +6,7 @@ import { t, useDataProvider, useNetworkParams, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import type { MarketData, MarketDataUpdateFieldsFragment, @@ -16,7 +16,7 @@ import { HeaderStat } from '../header'; import { Indicator, Link } from '@vegaprotocol/ui-toolkit'; import BigNumber from 'bignumber.js'; import { useCheckLiquidityStatus } from '@vegaprotocol/liquidity'; -import { DataGrid } from '@vegaprotocol/react-helpers'; +import { DataGrid } from '@vegaprotocol/utils'; import { AuctionTrigger, MarketTradingMode } from '@vegaprotocol/types'; interface Props { diff --git a/apps/trading/components/market-mark-price/market-mark-price.tsx b/apps/trading/components/market-mark-price/market-mark-price.tsx index 423b23ed3..3b0a027a4 100644 --- a/apps/trading/components/market-mark-price/market-mark-price.tsx +++ b/apps/trading/components/market-mark-price/market-mark-price.tsx @@ -6,7 +6,7 @@ import { PriceCell, useThrottledDataProvider, isNumeric, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import type { MarketData, MarketDataUpdateFieldsFragment, diff --git a/apps/trading/components/market-state/market-state.tsx b/apps/trading/components/market-state/market-state.tsx index 4a0e88da1..2bfa3198c 100644 --- a/apps/trading/components/market-state/market-state.tsx +++ b/apps/trading/components/market-state/market-state.tsx @@ -5,7 +5,7 @@ import type { Market, } from '@vegaprotocol/market-list'; import { marketDataProvider } from '@vegaprotocol/market-list'; -import { t, useDataProvider } from '@vegaprotocol/react-helpers'; +import { t, useDataProvider } from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; import { HeaderStat } from '../header'; import { useCallback, useMemo, useRef, useState } from 'react'; diff --git a/apps/trading/components/market-trading-mode/market-trading-mode.tsx b/apps/trading/components/market-trading-mode/market-trading-mode.tsx index cea617357..eb93521d7 100644 --- a/apps/trading/components/market-trading-mode/market-trading-mode.tsx +++ b/apps/trading/components/market-trading-mode/market-trading-mode.tsx @@ -1,5 +1,5 @@ import type { RefObject } from 'react'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { TradingModeTooltip } from '@vegaprotocol/deal-ticket'; import { useInView } from 'react-intersection-observer'; import * as Schema from '@vegaprotocol/types'; diff --git a/apps/trading/components/market-volume/market-volume.tsx b/apps/trading/components/market-volume/market-volume.tsx index 1272e51eb..77f7e1e33 100644 --- a/apps/trading/components/market-volume/market-volume.tsx +++ b/apps/trading/components/market-volume/market-volume.tsx @@ -4,7 +4,7 @@ import { addDecimalsFormatNumber, t, useDataProvider, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import type { MarketData, MarketDataUpdateFieldsFragment, diff --git a/apps/trading/components/navbar/navbar.tsx b/apps/trading/components/navbar/navbar.tsx index 55d26ab20..a3bc3634e 100644 --- a/apps/trading/components/navbar/navbar.tsx +++ b/apps/trading/components/navbar/navbar.tsx @@ -7,7 +7,7 @@ import { TOKEN_GOVERNANCE, useLinks, } from '@vegaprotocol/environment'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { useGlobalStore } from '../../stores'; import { VegaWalletConnectButton } from '../vega-wallet-connect-button'; import { diff --git a/apps/trading/components/select-market/select-market-columns.tsx b/apps/trading/components/select-market/select-market-columns.tsx index e004f386b..c4271d938 100644 --- a/apps/trading/components/select-market/select-market-columns.tsx +++ b/apps/trading/components/select-market/select-market-columns.tsx @@ -10,7 +10,7 @@ import { PriceCell, signedNumberCssClass, t, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import { Link as UILink, Sparkline, Tooltip } from '@vegaprotocol/ui-toolkit'; import isNil from 'lodash/isNil'; import type { CandleClose } from '@vegaprotocol/types'; diff --git a/apps/trading/components/select-market/select-market.tsx b/apps/trading/components/select-market/select-market.tsx index cdc659d3e..872fa2127 100644 --- a/apps/trading/components/select-market/select-market.tsx +++ b/apps/trading/components/select-market/select-market.tsx @@ -2,7 +2,7 @@ import { useCallback, useEffect, useMemo, useState, useRef } from 'react'; import type { RefObject } from 'react'; import { useMarketList } from '@vegaprotocol/market-list'; import { positionsDataProvider } from '@vegaprotocol/positions'; -import { t, useDataProvider } from '@vegaprotocol/react-helpers'; +import { t, useDataProvider } from '@vegaprotocol/utils'; import { ExternalLink, Icon, Loader, Popover } from '@vegaprotocol/ui-toolkit'; import { useVegaWallet } from '@vegaprotocol/wallet'; import { diff --git a/apps/trading/components/vega-wallet-connect-button/vega-wallet-connect-button.spec.tsx b/apps/trading/components/vega-wallet-connect-button/vega-wallet-connect-button.spec.tsx index 255b5336a..c6d4a3844 100644 --- a/apps/trading/components/vega-wallet-connect-button/vega-wallet-connect-button.spec.tsx +++ b/apps/trading/components/vega-wallet-connect-button/vega-wallet-connect-button.spec.tsx @@ -2,7 +2,7 @@ import { fireEvent, render, screen } from '@testing-library/react'; import { VegaWalletContext } from '@vegaprotocol/wallet'; import type { VegaWalletContextShape } from '@vegaprotocol/wallet'; import { VegaWalletConnectButton } from './vega-wallet-connect-button'; -import { truncateByChars } from '@vegaprotocol/react-helpers'; +import { truncateByChars } from '@vegaprotocol/utils'; import userEvent from '@testing-library/user-event'; const mockUpdateDialogOpen = jest.fn(); diff --git a/apps/trading/components/vega-wallet-connect-button/vega-wallet-connect-button.tsx b/apps/trading/components/vega-wallet-connect-button/vega-wallet-connect-button.tsx index d0ccbc370..7f0891895 100644 --- a/apps/trading/components/vega-wallet-connect-button/vega-wallet-connect-button.tsx +++ b/apps/trading/components/vega-wallet-connect-button/vega-wallet-connect-button.tsx @@ -1,7 +1,7 @@ import { useCallback, useEffect, useMemo, useState } from 'react'; import CopyToClipboard from 'react-copy-to-clipboard'; import classNames from 'classnames'; -import { t, truncateByChars } from '@vegaprotocol/react-helpers'; +import { t, truncateByChars } from '@vegaprotocol/utils'; import { Button, DropdownMenu, diff --git a/apps/trading/components/vega-wallet-container/vega-wallet-container.tsx b/apps/trading/components/vega-wallet-container/vega-wallet-container.tsx index 14e1f3b59..ae937da56 100644 --- a/apps/trading/components/vega-wallet-container/vega-wallet-container.tsx +++ b/apps/trading/components/vega-wallet-container/vega-wallet-container.tsx @@ -1,5 +1,5 @@ import type { ReactNode } from 'react'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { Button, Splash } from '@vegaprotocol/ui-toolkit'; import { useVegaWallet, useVegaWalletDialogStore } from '@vegaprotocol/wallet'; diff --git a/apps/trading/components/welcome-dialog/proposed-markets.tsx b/apps/trading/components/welcome-dialog/proposed-markets.tsx index c36561363..41ccb7154 100644 --- a/apps/trading/components/welcome-dialog/proposed-markets.tsx +++ b/apps/trading/components/welcome-dialog/proposed-markets.tsx @@ -1,5 +1,5 @@ import { useMemo } from 'react'; -import { t, useDataProvider } from '@vegaprotocol/react-helpers'; +import { t, useDataProvider } from '@vegaprotocol/utils'; import { proposalsDataProvider } from '@vegaprotocol/governance'; import take from 'lodash/take'; import * as Types from '@vegaprotocol/types'; diff --git a/apps/trading/components/welcome-dialog/risk-notice-dialog.tsx b/apps/trading/components/welcome-dialog/risk-notice-dialog.tsx index 1bc65266d..79f0e272c 100644 --- a/apps/trading/components/welcome-dialog/risk-notice-dialog.tsx +++ b/apps/trading/components/welcome-dialog/risk-notice-dialog.tsx @@ -1,7 +1,7 @@ import { useCallback } from 'react'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { Button } from '@vegaprotocol/ui-toolkit'; -import { LocalStorage } from '@vegaprotocol/react-helpers'; +import { LocalStorage } from '@vegaprotocol/utils'; import { RISK_ACCEPTED_KEY } from '../constants'; interface Props { diff --git a/apps/trading/components/welcome-dialog/welcome-dialog.tsx b/apps/trading/components/welcome-dialog/welcome-dialog.tsx index bdeac4a63..ed9fbe9c3 100644 --- a/apps/trading/components/welcome-dialog/welcome-dialog.tsx +++ b/apps/trading/components/welcome-dialog/welcome-dialog.tsx @@ -1,11 +1,7 @@ import React, { useCallback } from 'react'; import { useLocation } from 'react-router-dom'; import { Dialog } from '@vegaprotocol/ui-toolkit'; -import { - t, - useDataProvider, - useLocalStorage, -} from '@vegaprotocol/react-helpers'; +import { t, useDataProvider, useLocalStorage } from '@vegaprotocol/utils'; import { activeMarketsProvider } from '@vegaprotocol/market-list'; import { useEnvironment, Networks } from '@vegaprotocol/environment'; import * as constants from '../constants'; diff --git a/apps/trading/components/welcome-dialog/welcome-landing-dialog.tsx b/apps/trading/components/welcome-dialog/welcome-landing-dialog.tsx index 241b2360d..f00d4654e 100644 --- a/apps/trading/components/welcome-dialog/welcome-landing-dialog.tsx +++ b/apps/trading/components/welcome-dialog/welcome-landing-dialog.tsx @@ -1,6 +1,6 @@ import React, { useCallback } from 'react'; import { useMarketList } from '@vegaprotocol/market-list'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { useAssetDetailsDialogStore } from '@vegaprotocol/assets'; import { Link as UILink } from '@vegaprotocol/ui-toolkit'; import type { OnCellClickHandler } from '../select-market'; diff --git a/apps/trading/components/welcome-dialog/welcome-notice-dialog.tsx b/apps/trading/components/welcome-dialog/welcome-notice-dialog.tsx index 5ad9b0a2f..d699e8a23 100644 --- a/apps/trading/components/welcome-dialog/welcome-notice-dialog.tsx +++ b/apps/trading/components/welcome-dialog/welcome-notice-dialog.tsx @@ -1,5 +1,5 @@ import { ExternalLink } from '@vegaprotocol/ui-toolkit'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { BLOG, DApp, diff --git a/apps/trading/lib/hooks/use-ethereum-transaction-toasts.tsx b/apps/trading/lib/hooks/use-ethereum-transaction-toasts.tsx index afa57846b..b5cfd17b3 100644 --- a/apps/trading/lib/hooks/use-ethereum-transaction-toasts.tsx +++ b/apps/trading/lib/hooks/use-ethereum-transaction-toasts.tsx @@ -1,7 +1,7 @@ import type { ReactNode } from 'react'; import { useAssetsDataProvider } from '@vegaprotocol/assets'; import { ETHERSCAN_TX, useEtherscanLink } from '@vegaprotocol/environment'; -import { formatNumber, t, toBigNum } from '@vegaprotocol/react-helpers'; +import { formatNumber, t, toBigNum } from '@vegaprotocol/utils'; import type { Toast, ToastContent } from '@vegaprotocol/ui-toolkit'; import { ToastHeading } from '@vegaprotocol/ui-toolkit'; import { Panel } from '@vegaprotocol/ui-toolkit'; diff --git a/apps/trading/lib/hooks/use-ethereum-withdraw-approval-toasts.tsx b/apps/trading/lib/hooks/use-ethereum-withdraw-approval-toasts.tsx index 132b34725..62daa7e4c 100644 --- a/apps/trading/lib/hooks/use-ethereum-withdraw-approval-toasts.tsx +++ b/apps/trading/lib/hooks/use-ethereum-withdraw-approval-toasts.tsx @@ -1,4 +1,4 @@ -import { formatNumber, t, toBigNum } from '@vegaprotocol/react-helpers'; +import { formatNumber, t, toBigNum } from '@vegaprotocol/utils'; import type { Toast } from '@vegaprotocol/ui-toolkit'; import { ToastHeading } from '@vegaprotocol/ui-toolkit'; import { Panel } from '@vegaprotocol/ui-toolkit'; diff --git a/apps/trading/lib/hooks/use-vega-transaction-toasts.tsx b/apps/trading/lib/hooks/use-vega-transaction-toasts.tsx index ef59d0493..e0fc4b4b6 100644 --- a/apps/trading/lib/hooks/use-vega-transaction-toasts.tsx +++ b/apps/trading/lib/hooks/use-vega-transaction-toasts.tsx @@ -36,7 +36,7 @@ import { t, toBigNum, truncateByChars, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import { useAssetsDataProvider } from '@vegaprotocol/assets'; import { useEthWithdrawApprovalsStore } from '@vegaprotocol/web3'; import { DApp, EXPLORER_TX, useLinks } from '@vegaprotocol/environment'; diff --git a/apps/trading/pages/_app.page.tsx b/apps/trading/pages/_app.page.tsx index d2a2f7c37..c883918a4 100644 --- a/apps/trading/pages/_app.page.tsx +++ b/apps/trading/pages/_app.page.tsx @@ -1,7 +1,7 @@ import Head from 'next/head'; import type { AppProps } from 'next/app'; import { Navbar } from '../components/navbar'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { useEagerConnect as useVegaEagerConnect, useVegaTransactionManager, diff --git a/apps/trading/pages/client-router.tsx b/apps/trading/pages/client-router.tsx index 7fa7c15ed..21d0481a1 100644 --- a/apps/trading/pages/client-router.tsx +++ b/apps/trading/pages/client-router.tsx @@ -2,7 +2,7 @@ import { Suspense } from 'react'; import type { RouteObject } from 'react-router-dom'; import { useRoutes } from 'react-router-dom'; import dynamic from 'next/dynamic'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { Loader, Splash } from '@vegaprotocol/ui-toolkit'; import trimEnd from 'lodash/trimEnd'; diff --git a/apps/trading/stores/global.ts b/apps/trading/stores/global.ts index 90852d776..18e11a2ac 100644 --- a/apps/trading/stores/global.ts +++ b/apps/trading/stores/global.ts @@ -1,4 +1,4 @@ -import { LocalStorage } from '@vegaprotocol/react-helpers'; +import { LocalStorage } from '@vegaprotocol/utils'; import { create } from 'zustand'; import produce from 'immer'; diff --git a/libs/accounts/.storybook/preview.js b/libs/accounts/.storybook/preview.js index c1b81a5b8..77cf7b2b5 100644 --- a/libs/accounts/.storybook/preview.js +++ b/libs/accounts/.storybook/preview.js @@ -1,5 +1,5 @@ import './styles.scss'; -import { useStorybookThemeObserver } from '@vegaprotocol/react-helpers'; +import { useStorybookThemeObserver } from '@vegaprotocol/utils'; export const parameters = { actions: { argTypesRegex: '^on[A-Z].*' }, backgrounds: { disable: true }, diff --git a/libs/accounts/src/lib/accounts-data-provider.ts b/libs/accounts/src/lib/accounts-data-provider.ts index 34d131e34..486862744 100644 --- a/libs/accounts/src/lib/accounts-data-provider.ts +++ b/libs/accounts/src/lib/accounts-data-provider.ts @@ -4,7 +4,7 @@ import { makeDataProvider, makeDerivedDataProvider, removePaginationWrapper, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; import produce from 'immer'; diff --git a/libs/accounts/src/lib/accounts-manager.spec.tsx b/libs/accounts/src/lib/accounts-manager.spec.tsx index d4c0c1e42..e88822167 100644 --- a/libs/accounts/src/lib/accounts-manager.spec.tsx +++ b/libs/accounts/src/lib/accounts-manager.spec.tsx @@ -5,7 +5,7 @@ import { screen, waitFor, } from '@testing-library/react'; -import * as helpers from '@vegaprotocol/react-helpers'; +import * as helpers from '@vegaprotocol/utils'; import { AccountManager } from './accounts-manager'; const mockedUseDataProvider = jest.fn(); diff --git a/libs/accounts/src/lib/accounts-manager.tsx b/libs/accounts/src/lib/accounts-manager.tsx index 833254047..ae867587c 100644 --- a/libs/accounts/src/lib/accounts-manager.tsx +++ b/libs/accounts/src/lib/accounts-manager.tsx @@ -1,4 +1,4 @@ -import { t, useDataProvider } from '@vegaprotocol/react-helpers'; +import { t, useDataProvider } from '@vegaprotocol/utils'; import { AsyncRenderer } from '@vegaprotocol/ui-toolkit'; import type { AgGridReact } from 'ag-grid-react'; import { useRef, useMemo, memo } from 'react'; diff --git a/libs/accounts/src/lib/accounts-table.tsx b/libs/accounts/src/lib/accounts-table.tsx index 0a68a1e2d..015442c4b 100644 --- a/libs/accounts/src/lib/accounts-table.tsx +++ b/libs/accounts/src/lib/accounts-table.tsx @@ -1,9 +1,5 @@ import { forwardRef, useMemo, useState } from 'react'; -import { - addDecimalsFormatNumber, - isNumeric, - t, -} from '@vegaprotocol/react-helpers'; +import { addDecimalsFormatNumber, isNumeric, t } from '@vegaprotocol/utils'; import type { VegaICellRendererParams } from '@vegaprotocol/ui-toolkit'; import { ButtonLink, Dialog } from '@vegaprotocol/ui-toolkit'; import { TooltipCellComponent } from '@vegaprotocol/ui-toolkit'; diff --git a/libs/accounts/src/lib/asset-balance.tsx b/libs/accounts/src/lib/asset-balance.tsx index 51bd4b9fa..40c28d401 100644 --- a/libs/accounts/src/lib/asset-balance.tsx +++ b/libs/accounts/src/lib/asset-balance.tsx @@ -1,8 +1,5 @@ import { useMemo } from 'react'; -import { - addDecimalsFormatNumber, - useDataProvider, -} from '@vegaprotocol/react-helpers'; +import { addDecimalsFormatNumber, useDataProvider } from '@vegaprotocol/utils'; import { accountsDataProvider } from './accounts-data-provider'; interface AssetBalanceProps { diff --git a/libs/accounts/src/lib/breakdown-table.tsx b/libs/accounts/src/lib/breakdown-table.tsx index caf24a9e1..cbbbe33ae 100644 --- a/libs/accounts/src/lib/breakdown-table.tsx +++ b/libs/accounts/src/lib/breakdown-table.tsx @@ -4,7 +4,7 @@ import { isNumeric, PriceCell, t, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import { AgGridDynamic as AgGrid, Intent, diff --git a/libs/accounts/src/lib/transfer-container.tsx b/libs/accounts/src/lib/transfer-container.tsx index b03e313ed..3bbac2708 100644 --- a/libs/accounts/src/lib/transfer-container.tsx +++ b/libs/accounts/src/lib/transfer-container.tsx @@ -6,7 +6,7 @@ import { truncateByChars, useDataProvider, useNetworkParam, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import type { Transfer } from '@vegaprotocol/wallet'; import { useVegaTransactionStore, useVegaWallet } from '@vegaprotocol/wallet'; import { useCallback, useMemo } from 'react'; diff --git a/libs/accounts/src/lib/transfer-dialog.tsx b/libs/accounts/src/lib/transfer-dialog.tsx index 998eaf253..5e58de06f 100644 --- a/libs/accounts/src/lib/transfer-dialog.tsx +++ b/libs/accounts/src/lib/transfer-dialog.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { Dialog } from '@vegaprotocol/ui-toolkit'; import { create } from 'zustand'; import { TransferContainer } from './transfer-container'; diff --git a/libs/accounts/src/lib/transfer-form.spec.tsx b/libs/accounts/src/lib/transfer-form.spec.tsx index eb977217a..601274c5a 100644 --- a/libs/accounts/src/lib/transfer-form.spec.tsx +++ b/libs/accounts/src/lib/transfer-form.spec.tsx @@ -2,7 +2,7 @@ import { fireEvent, render, screen, waitFor } from '@testing-library/react'; import BigNumber from 'bignumber.js'; import { AddressField, TransferFee, TransferForm } from './transfer-form'; import { AccountType } from '@vegaprotocol/types'; -import { formatNumber, removeDecimal } from '@vegaprotocol/react-helpers'; +import { formatNumber, removeDecimal } from '@vegaprotocol/utils'; describe('TransferForm', () => { const submit = () => fireEvent.submit(screen.getByTestId('transfer-form')); diff --git a/libs/accounts/src/lib/transfer-form.tsx b/libs/accounts/src/lib/transfer-form.tsx index 53d1bf020..b1ab794bd 100644 --- a/libs/accounts/src/lib/transfer-form.tsx +++ b/libs/accounts/src/lib/transfer-form.tsx @@ -6,7 +6,7 @@ import { vegaPublicKey, addDecimal, formatNumber, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import { Button, FormGroup, diff --git a/libs/accounts/src/lib/use-account-balance.tsx b/libs/accounts/src/lib/use-account-balance.tsx index d824652c6..13cb791bb 100644 --- a/libs/accounts/src/lib/use-account-balance.tsx +++ b/libs/accounts/src/lib/use-account-balance.tsx @@ -1,6 +1,6 @@ import { useCallback, useMemo, useState } from 'react'; import { useVegaWallet } from '@vegaprotocol/wallet'; -import { useDataProvider } from '@vegaprotocol/react-helpers'; +import { useDataProvider } from '@vegaprotocol/utils'; import { accountsDataProvider } from './accounts-data-provider'; import type { Account } from './accounts-data-provider'; import { getSettlementAccount } from './get-settlement-account'; diff --git a/libs/accounts/src/lib/use-market-account-balance.tsx b/libs/accounts/src/lib/use-market-account-balance.tsx index 97fef2a3d..9dbeeffc0 100644 --- a/libs/accounts/src/lib/use-market-account-balance.tsx +++ b/libs/accounts/src/lib/use-market-account-balance.tsx @@ -1,6 +1,6 @@ import { useCallback, useMemo, useState } from 'react'; import { useVegaWallet } from '@vegaprotocol/wallet'; -import { useDataProvider } from '@vegaprotocol/react-helpers'; +import { useDataProvider } from '@vegaprotocol/utils'; import { accountsDataProvider } from './accounts-data-provider'; import type { Account } from './accounts-data-provider'; import { getMarketAccount } from './get-market-account'; diff --git a/libs/apollo-client/src/lib/apollo-client.ts b/libs/apollo-client/src/lib/apollo-client.ts index a2fcb9285..94b74aaa8 100644 --- a/libs/apollo-client/src/lib/apollo-client.ts +++ b/libs/apollo-client/src/lib/apollo-client.ts @@ -13,7 +13,7 @@ import { createClient as createWSClient } from 'graphql-ws'; import { onError } from '@apollo/client/link/error'; import { RetryLink } from '@apollo/client/link/retry'; import ApolloLinkTimeout from 'apollo-link-timeout'; -import { localLoggerFactory } from '@vegaprotocol/react-helpers'; +import { localLoggerFactory } from '@vegaprotocol/utils'; import { useHeaderStore } from './header-store'; const isBrowser = typeof window !== 'undefined'; diff --git a/libs/assets/src/lib/asset-data-provider.ts b/libs/assets/src/lib/asset-data-provider.ts index 0a045ccd6..1912c7933 100644 --- a/libs/assets/src/lib/asset-data-provider.ts +++ b/libs/assets/src/lib/asset-data-provider.ts @@ -1,4 +1,4 @@ -import { makeDataProvider, useDataProvider } from '@vegaprotocol/react-helpers'; +import { makeDataProvider, useDataProvider } from '@vegaprotocol/utils'; import { useMemo } from 'react'; import type { AssetQuery, AssetFieldsFragment } from './__generated__/Asset'; diff --git a/libs/assets/src/lib/asset-details-dialog.tsx b/libs/assets/src/lib/asset-details-dialog.tsx index a45789b3a..46f38b41e 100644 --- a/libs/assets/src/lib/asset-details-dialog.tsx +++ b/libs/assets/src/lib/asset-details-dialog.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { useAssetsDataProvider } from './assets-data-provider'; import { Button, diff --git a/libs/assets/src/lib/asset-details-table.tsx b/libs/assets/src/lib/asset-details-table.tsx index f92e01484..875e9c577 100644 --- a/libs/assets/src/lib/asset-details-table.tsx +++ b/libs/assets/src/lib/asset-details-table.tsx @@ -1,5 +1,5 @@ import { ContractAddressLink } from '@vegaprotocol/environment'; -import { addDecimalsFormatNumber, t } from '@vegaprotocol/react-helpers'; +import { addDecimalsFormatNumber, t } from '@vegaprotocol/utils'; import type * as Schema from '@vegaprotocol/types'; import type { KeyValueTableRowProps } from '@vegaprotocol/ui-toolkit'; import { CopyWithTooltip, Icon } from '@vegaprotocol/ui-toolkit'; diff --git a/libs/assets/src/lib/assets-data-provider.ts b/libs/assets/src/lib/assets-data-provider.ts index 883a27436..658a9249b 100644 --- a/libs/assets/src/lib/assets-data-provider.ts +++ b/libs/assets/src/lib/assets-data-provider.ts @@ -2,7 +2,7 @@ import { makeDataProvider, makeDerivedDataProvider, useDataProvider, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import { AssetsDocument } from './__generated__/Assets'; import * as Schema from '@vegaprotocol/types'; import type { AssetsQuery } from './__generated__/Assets'; diff --git a/libs/candles-chart/src/lib/candles-chart.tsx b/libs/candles-chart/src/lib/candles-chart.tsx index 1dd9d4c87..d9db04922 100644 --- a/libs/candles-chart/src/lib/candles-chart.tsx +++ b/libs/candles-chart/src/lib/candles-chart.tsx @@ -27,7 +27,7 @@ import { } from '@vegaprotocol/ui-toolkit'; import type { IconName } from '@blueprintjs/icons'; import { IconNames } from '@blueprintjs/icons'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; const chartTypeIcon = new Map([ [ChartType.AREA, IconNames.TIMELINE_AREA_CHART], diff --git a/libs/candles-chart/src/lib/data-source.ts b/libs/candles-chart/src/lib/data-source.ts index 571114f62..237cadad2 100644 --- a/libs/candles-chart/src/lib/data-source.ts +++ b/libs/candles-chart/src/lib/data-source.ts @@ -2,7 +2,7 @@ import type { ApolloClient } from '@apollo/client'; import type { Candle, DataSource } from 'pennant'; import { Interval as PennantInterval } from 'pennant'; -import { addDecimal } from '@vegaprotocol/react-helpers'; +import { addDecimal } from '@vegaprotocol/utils'; import { ChartDocument } from './__generated__/Chart'; import type { ChartQuery, ChartQueryVariables } from './__generated__/Chart'; import { diff --git a/libs/deal-ticket/src/components/deal-ticket-estimates.tsx b/libs/deal-ticket/src/components/deal-ticket-estimates.tsx index a0cfd969c..e778f7e0d 100644 --- a/libs/deal-ticket/src/components/deal-ticket-estimates.tsx +++ b/libs/deal-ticket/src/components/deal-ticket-estimates.tsx @@ -1,6 +1,6 @@ import React from 'react'; import type { ReactNode } from 'react'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { Icon, Tooltip, TrafficLight } from '@vegaprotocol/ui-toolkit'; import { IconNames } from '@blueprintjs/icons'; import * as constants from '../constants'; diff --git a/libs/deal-ticket/src/components/deal-ticket-validation/margin-warning.tsx b/libs/deal-ticket/src/components/deal-ticket-validation/margin-warning.tsx index 260b4290a..77867955e 100644 --- a/libs/deal-ticket/src/components/deal-ticket-validation/margin-warning.tsx +++ b/libs/deal-ticket/src/components/deal-ticket-validation/margin-warning.tsx @@ -1,4 +1,4 @@ -import { formatNumber, t } from '@vegaprotocol/react-helpers'; +import { formatNumber, t } from '@vegaprotocol/utils'; import { Notification, Intent } from '@vegaprotocol/ui-toolkit'; import { DepositDialog, useDepositDialog } from '@vegaprotocol/deposits'; diff --git a/libs/deal-ticket/src/components/deal-ticket-validation/zero-balance-error.tsx b/libs/deal-ticket/src/components/deal-ticket-validation/zero-balance-error.tsx index d89e9b0fa..b8fb039b7 100644 --- a/libs/deal-ticket/src/components/deal-ticket-validation/zero-balance-error.tsx +++ b/libs/deal-ticket/src/components/deal-ticket-validation/zero-balance-error.tsx @@ -1,6 +1,6 @@ import { Intent, Notification, Link } from '@vegaprotocol/ui-toolkit'; import { useDepositDialog } from '@vegaprotocol/deposits'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; interface ZeroBalanceErrorProps { asset: { diff --git a/libs/deal-ticket/src/components/deal-ticket/deal-ticket-button.tsx b/libs/deal-ticket/src/components/deal-ticket/deal-ticket-button.tsx index 1eae3d5a6..cbd25f22c 100644 --- a/libs/deal-ticket/src/components/deal-ticket/deal-ticket-button.tsx +++ b/libs/deal-ticket/src/components/deal-ticket/deal-ticket-button.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import type { ButtonVariant } from '@vegaprotocol/ui-toolkit'; import { Button } from '@vegaprotocol/ui-toolkit'; import { useVegaWallet } from '@vegaprotocol/wallet'; diff --git a/libs/deal-ticket/src/components/deal-ticket/deal-ticket-container.tsx b/libs/deal-ticket/src/components/deal-ticket/deal-ticket-container.tsx index 5f9b384a5..963a31dc3 100644 --- a/libs/deal-ticket/src/components/deal-ticket/deal-ticket-container.tsx +++ b/libs/deal-ticket/src/components/deal-ticket/deal-ticket-container.tsx @@ -1,7 +1,7 @@ import { useMemo } from 'react'; import { AsyncRenderer, Splash } from '@vegaprotocol/ui-toolkit'; -import { t } from '@vegaprotocol/react-helpers'; -import { useThrottledDataProvider } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; +import { useThrottledDataProvider } from '@vegaprotocol/utils'; import { useVegaTransactionStore } from '@vegaprotocol/wallet'; import { useMarket, marketDataProvider } from '@vegaprotocol/market-list'; import { DealTicket } from './deal-ticket'; diff --git a/libs/deal-ticket/src/components/deal-ticket/deal-ticket-limit-amount.tsx b/libs/deal-ticket/src/components/deal-ticket/deal-ticket-limit-amount.tsx index 31136e5c2..10656bd8c 100644 --- a/libs/deal-ticket/src/components/deal-ticket/deal-ticket-limit-amount.tsx +++ b/libs/deal-ticket/src/components/deal-ticket/deal-ticket-limit-amount.tsx @@ -1,5 +1,5 @@ import { FormGroup, Input, InputError } from '@vegaprotocol/ui-toolkit'; -import { t, toDecimal, validateAmount } from '@vegaprotocol/react-helpers'; +import { t, toDecimal, validateAmount } from '@vegaprotocol/utils'; import type { DealTicketAmountProps } from './deal-ticket-amount'; export type DealTicketLimitAmountProps = Omit< diff --git a/libs/deal-ticket/src/components/deal-ticket/deal-ticket-market-amount.tsx b/libs/deal-ticket/src/components/deal-ticket/deal-ticket-market-amount.tsx index c4371d213..136d39604 100644 --- a/libs/deal-ticket/src/components/deal-ticket/deal-ticket-market-amount.tsx +++ b/libs/deal-ticket/src/components/deal-ticket/deal-ticket-market-amount.tsx @@ -3,7 +3,7 @@ import { t, toDecimal, validateAmount, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import { Input, InputError, Tooltip } from '@vegaprotocol/ui-toolkit'; import { isMarketInAuction } from '../../utils'; import type { DealTicketAmountProps } from './deal-ticket-amount'; diff --git a/libs/deal-ticket/src/components/deal-ticket/deal-ticket.spec.tsx b/libs/deal-ticket/src/components/deal-ticket/deal-ticket.spec.tsx index b0fe2483b..521250ba2 100644 --- a/libs/deal-ticket/src/components/deal-ticket/deal-ticket.spec.tsx +++ b/libs/deal-ticket/src/components/deal-ticket/deal-ticket.spec.tsx @@ -7,8 +7,8 @@ import * as Schema from '@vegaprotocol/types'; import type { OrderSubmissionBody } from '@vegaprotocol/wallet'; import type { MockedResponse } from '@apollo/client/testing'; import { MockedProvider } from '@apollo/client/testing'; -import type { ChainIdQuery } from '@vegaprotocol/react-helpers'; -import { ChainIdDocument, addDecimal } from '@vegaprotocol/react-helpers'; +import type { ChainIdQuery } from '@vegaprotocol/utils'; +import { ChainIdDocument, addDecimal } from '@vegaprotocol/utils'; const market = generateMarket(); const marketData = generateMarketData(); diff --git a/libs/deal-ticket/src/components/deal-ticket/deal-ticket.tsx b/libs/deal-ticket/src/components/deal-ticket/deal-ticket.tsx index 0b0aaefa0..ec3bee3b4 100644 --- a/libs/deal-ticket/src/components/deal-ticket/deal-ticket.tsx +++ b/libs/deal-ticket/src/components/deal-ticket/deal-ticket.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; import { memo, useCallback, useEffect } from 'react'; import { Controller, useForm } from 'react-hook-form'; diff --git a/libs/deal-ticket/src/components/deal-ticket/expiry-selector.tsx b/libs/deal-ticket/src/components/deal-ticket/expiry-selector.tsx index 921812fce..5c8cf7095 100644 --- a/libs/deal-ticket/src/components/deal-ticket/expiry-selector.tsx +++ b/libs/deal-ticket/src/components/deal-ticket/expiry-selector.tsx @@ -1,6 +1,6 @@ import { FormGroup, Input, InputError } from '@vegaprotocol/ui-toolkit'; -import { formatForInput } from '@vegaprotocol/react-helpers'; -import { t } from '@vegaprotocol/react-helpers'; +import { formatForInput } from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/utils'; import type { UseFormRegister } from 'react-hook-form'; import { validateExpiration } from '../../utils/validate-expiration'; import type { DealTicketFormFields } from '.'; diff --git a/libs/deal-ticket/src/components/deal-ticket/market-selector.tsx b/libs/deal-ticket/src/components/deal-ticket/market-selector.tsx index 74b2031e8..9657f6978 100644 --- a/libs/deal-ticket/src/components/deal-ticket/market-selector.tsx +++ b/libs/deal-ticket/src/components/deal-ticket/market-selector.tsx @@ -20,7 +20,7 @@ import { useScreenDimensions, useOutsideClick, useDataProvider, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import { IconNames } from '@blueprintjs/icons'; import * as Schema from '@vegaprotocol/types'; import type { Market } from '@vegaprotocol/market-list'; diff --git a/libs/deal-ticket/src/components/deal-ticket/side-selector.tsx b/libs/deal-ticket/src/components/deal-ticket/side-selector.tsx index 20faa544d..72cd52db2 100644 --- a/libs/deal-ticket/src/components/deal-ticket/side-selector.tsx +++ b/libs/deal-ticket/src/components/deal-ticket/side-selector.tsx @@ -1,6 +1,6 @@ import { FormGroup } from '@vegaprotocol/ui-toolkit'; import { Toggle } from '@vegaprotocol/ui-toolkit'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; interface SideSelectorProps { diff --git a/libs/deal-ticket/src/components/deal-ticket/time-in-force-selector.tsx b/libs/deal-ticket/src/components/deal-ticket/time-in-force-selector.tsx index 9eb0ef2b2..ee2e85ec2 100644 --- a/libs/deal-ticket/src/components/deal-ticket/time-in-force-selector.tsx +++ b/libs/deal-ticket/src/components/deal-ticket/time-in-force-selector.tsx @@ -6,7 +6,7 @@ import { Tooltip, } from '@vegaprotocol/ui-toolkit'; import * as Schema from '@vegaprotocol/types'; -import { DataGrid, t } from '@vegaprotocol/react-helpers'; +import { DataGrid, t } from '@vegaprotocol/utils'; import { timeInForceLabel } from '@vegaprotocol/orders'; import { compileGridData } from '../trading-mode-tooltip'; import { MarketModeValidationType } from '../../constants'; diff --git a/libs/deal-ticket/src/components/deal-ticket/type-selector.tsx b/libs/deal-ticket/src/components/deal-ticket/type-selector.tsx index f2b1cacb7..57a943854 100644 --- a/libs/deal-ticket/src/components/deal-ticket/type-selector.tsx +++ b/libs/deal-ticket/src/components/deal-ticket/type-selector.tsx @@ -1,5 +1,5 @@ import { FormGroup, InputError, Tooltip } from '@vegaprotocol/ui-toolkit'; -import { DataGrid, t } from '@vegaprotocol/react-helpers'; +import { DataGrid, t } from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; import { Toggle } from '@vegaprotocol/ui-toolkit'; import type { Market, MarketData } from '@vegaprotocol/market-list'; diff --git a/libs/deal-ticket/src/components/trading-mode-tooltip/compile-grid-data.tsx b/libs/deal-ticket/src/components/trading-mode-tooltip/compile-grid-data.tsx index 2851163fe..f457367bd 100644 --- a/libs/deal-ticket/src/components/trading-mode-tooltip/compile-grid-data.tsx +++ b/libs/deal-ticket/src/components/trading-mode-tooltip/compile-grid-data.tsx @@ -1,9 +1,9 @@ -import type { DataGridProps } from '@vegaprotocol/react-helpers'; +import type { DataGridProps } from '@vegaprotocol/utils'; import { t, getDateTimeFormat, addDecimalsFormatNumber, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; import { Link as UILink } from '@vegaprotocol/ui-toolkit'; import type { ReactNode } from 'react'; diff --git a/libs/deal-ticket/src/components/trading-mode-tooltip/trading-mode-tooltip.tsx b/libs/deal-ticket/src/components/trading-mode-tooltip/trading-mode-tooltip.tsx index 349f548e9..bcb4475cf 100644 --- a/libs/deal-ticket/src/components/trading-mode-tooltip/trading-mode-tooltip.tsx +++ b/libs/deal-ticket/src/components/trading-mode-tooltip/trading-mode-tooltip.tsx @@ -3,10 +3,10 @@ import { parseISO, isValid, isAfter } from 'date-fns'; import classNames from 'classnames'; import { useProposalOfMarketQuery } from '@vegaprotocol/governance'; import { useEnvironment } from '@vegaprotocol/environment'; -import { DataGrid, getDateTimeFormat, t } from '@vegaprotocol/react-helpers'; +import { DataGrid, getDateTimeFormat, t } from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; import { ExternalLink } from '@vegaprotocol/ui-toolkit'; -import { createDocsLinks } from '@vegaprotocol/react-helpers'; +import { createDocsLinks } from '@vegaprotocol/utils'; import { compileGridData } from './compile-grid-data'; import { useMarket, useStaticMarketData } from '@vegaprotocol/market-list'; import BigNumber from 'bignumber.js'; diff --git a/libs/deal-ticket/src/constants.ts b/libs/deal-ticket/src/constants.ts index 9af0dbd77..9ae60a53e 100644 --- a/libs/deal-ticket/src/constants.ts +++ b/libs/deal-ticket/src/constants.ts @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; export const EST_MARGIN_TOOLTIP_TEXT = (settlementAsset: string) => t( diff --git a/libs/deal-ticket/src/hooks/use-calculate-slippage.ts b/libs/deal-ticket/src/hooks/use-calculate-slippage.ts index 225ca5232..4d67d0d29 100644 --- a/libs/deal-ticket/src/hooks/use-calculate-slippage.ts +++ b/libs/deal-ticket/src/hooks/use-calculate-slippage.ts @@ -8,7 +8,7 @@ import { formatNumber, toBigNum, useThrottledDataProvider, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; interface Props { market: Market; diff --git a/libs/deal-ticket/src/hooks/use-fee-deal-ticket-details.tsx b/libs/deal-ticket/src/hooks/use-fee-deal-ticket-details.tsx index e2e561402..145334121 100644 --- a/libs/deal-ticket/src/hooks/use-fee-deal-ticket-details.tsx +++ b/libs/deal-ticket/src/hooks/use-fee-deal-ticket-details.tsx @@ -4,7 +4,7 @@ import { addDecimalsFormatNumber, formatNumber, t, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; import { useVegaWallet } from '@vegaprotocol/wallet'; import BigNumber from 'bignumber.js'; diff --git a/libs/deal-ticket/src/hooks/use-has-no-balance.tsx b/libs/deal-ticket/src/hooks/use-has-no-balance.tsx index d95bc024d..d0a81914c 100644 --- a/libs/deal-ticket/src/hooks/use-has-no-balance.tsx +++ b/libs/deal-ticket/src/hooks/use-has-no-balance.tsx @@ -1,5 +1,5 @@ import { useAccountBalance } from '@vegaprotocol/accounts'; -import { toBigNum } from '@vegaprotocol/react-helpers'; +import { toBigNum } from '@vegaprotocol/utils'; export const useHasNoBalance = (assetId: string) => { const { accountBalance, accountDecimals } = useAccountBalance(assetId); diff --git a/libs/deal-ticket/src/hooks/use-order-closeout.ts b/libs/deal-ticket/src/hooks/use-order-closeout.ts index e1469f103..e061693d0 100644 --- a/libs/deal-ticket/src/hooks/use-order-closeout.ts +++ b/libs/deal-ticket/src/hooks/use-order-closeout.ts @@ -1,6 +1,6 @@ import { BigNumber } from 'bignumber.js'; import type { OrderSubmissionBody } from '@vegaprotocol/wallet'; -import { addDecimal } from '@vegaprotocol/react-helpers'; +import { addDecimal } from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; import type { Market, MarketData } from '@vegaprotocol/market-list'; import { diff --git a/libs/deal-ticket/src/hooks/use-order-margin-validation.ts b/libs/deal-ticket/src/hooks/use-order-margin-validation.ts index f44b308c6..5138ad3c4 100644 --- a/libs/deal-ticket/src/hooks/use-order-margin-validation.ts +++ b/libs/deal-ticket/src/hooks/use-order-margin-validation.ts @@ -1,6 +1,6 @@ import { useMemo } from 'react'; import { useVegaWallet } from '@vegaprotocol/wallet'; -import { toBigNum } from '@vegaprotocol/react-helpers'; +import { toBigNum } from '@vegaprotocol/utils'; import { useAccountBalance } from '@vegaprotocol/accounts'; import type { OrderSubmissionBody } from '@vegaprotocol/wallet'; import { useOrderMargin } from './use-order-margin'; diff --git a/libs/deal-ticket/src/hooks/use-order-margin.ts b/libs/deal-ticket/src/hooks/use-order-margin.ts index c13cc8de9..7797f19c3 100644 --- a/libs/deal-ticket/src/hooks/use-order-margin.ts +++ b/libs/deal-ticket/src/hooks/use-order-margin.ts @@ -1,7 +1,7 @@ import { useMemo } from 'react'; import { BigNumber } from 'bignumber.js'; import type { OrderSubmissionBody } from '@vegaprotocol/wallet'; -import { removeDecimal } from '@vegaprotocol/react-helpers'; +import { removeDecimal } from '@vegaprotocol/utils'; import { useMarketPositions } from './use-market-positions'; import { useEstimateOrderQuery } from './__generated__/EstimateOrder'; import type { Market, MarketData } from '@vegaprotocol/market-list'; diff --git a/libs/deal-ticket/src/utils/get-default-order.ts b/libs/deal-ticket/src/utils/get-default-order.ts index aeb1b2b37..73956ba9a 100644 --- a/libs/deal-ticket/src/utils/get-default-order.ts +++ b/libs/deal-ticket/src/utils/get-default-order.ts @@ -1,4 +1,4 @@ -import { toDecimal } from '@vegaprotocol/react-helpers'; +import { toDecimal } from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; import type { OrderSubmissionBody } from '@vegaprotocol/wallet'; diff --git a/libs/deal-ticket/src/utils/get-price.ts b/libs/deal-ticket/src/utils/get-price.ts index 1e661e2a6..ea97c7d27 100644 --- a/libs/deal-ticket/src/utils/get-price.ts +++ b/libs/deal-ticket/src/utils/get-price.ts @@ -1,4 +1,4 @@ -import { removeDecimal } from '@vegaprotocol/react-helpers'; +import { removeDecimal } from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; import { isMarketInAuction } from './is-market-in-auction'; import type { MarketData, Market } from '@vegaprotocol/market-list'; diff --git a/libs/deal-ticket/src/utils/validate-expiration.ts b/libs/deal-ticket/src/utils/validate-expiration.ts index 3797792f3..1c2537b16 100644 --- a/libs/deal-ticket/src/utils/validate-expiration.ts +++ b/libs/deal-ticket/src/utils/validate-expiration.ts @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import type { Validate } from 'react-hook-form'; export const validateExpiration: Validate = ( diff --git a/libs/deal-ticket/src/utils/validate-market-state.ts b/libs/deal-ticket/src/utils/validate-market-state.ts index b5a13c6be..995f17993 100644 --- a/libs/deal-ticket/src/utils/validate-market-state.ts +++ b/libs/deal-ticket/src/utils/validate-market-state.ts @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; export const validateMarketState = (state: Schema.MarketState) => { diff --git a/libs/deal-ticket/src/utils/validate-market-trading-mode.ts b/libs/deal-ticket/src/utils/validate-market-trading-mode.ts index e0f3f3b07..5fe58a823 100644 --- a/libs/deal-ticket/src/utils/validate-market-trading-mode.ts +++ b/libs/deal-ticket/src/utils/validate-market-trading-mode.ts @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; export const validateMarketTradingMode = ( diff --git a/libs/deposits/src/lib/deposit-container.tsx b/libs/deposits/src/lib/deposit-container.tsx index 58743be2a..31b02aca0 100644 --- a/libs/deposits/src/lib/deposit-container.tsx +++ b/libs/deposits/src/lib/deposit-container.tsx @@ -1,7 +1,7 @@ import { Networks, useEnvironment } from '@vegaprotocol/environment'; import { AsyncRenderer, Splash } from '@vegaprotocol/ui-toolkit'; import { DepositManager } from './deposit-manager'; -import { t, useDataProvider } from '@vegaprotocol/react-helpers'; +import { t, useDataProvider } from '@vegaprotocol/utils'; import { enabledAssetsProvider } from '@vegaprotocol/assets'; import type { DepositDialogStylePropsSetter } from './deposit-dialog'; diff --git a/libs/deposits/src/lib/deposit-dialog.tsx b/libs/deposits/src/lib/deposit-dialog.tsx index 58e9aa4d7..6b5d1ef6c 100644 --- a/libs/deposits/src/lib/deposit-dialog.tsx +++ b/libs/deposits/src/lib/deposit-dialog.tsx @@ -1,5 +1,5 @@ import { create } from 'zustand'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import type { Intent } from '@vegaprotocol/ui-toolkit'; import { Dialog } from '@vegaprotocol/ui-toolkit'; import { useCallback, useState } from 'react'; diff --git a/libs/deposits/src/lib/deposit-form.tsx b/libs/deposits/src/lib/deposit-form.tsx index 2df087e12..bd832f0ac 100644 --- a/libs/deposits/src/lib/deposit-form.tsx +++ b/libs/deposits/src/lib/deposit-form.tsx @@ -10,7 +10,7 @@ import { addDecimal, useLocalStorage, isAssetTypeERC20, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import { Button, FormGroup, diff --git a/libs/deposits/src/lib/deposit-limits.tsx b/libs/deposits/src/lib/deposit-limits.tsx index cb2a3ea62..85eff7e82 100644 --- a/libs/deposits/src/lib/deposit-limits.tsx +++ b/libs/deposits/src/lib/deposit-limits.tsx @@ -1,5 +1,5 @@ import type { Asset } from '@vegaprotocol/assets'; -import { compactNumber, t } from '@vegaprotocol/react-helpers'; +import { compactNumber, t } from '@vegaprotocol/utils'; import { KeyValueTable, KeyValueTableRow } from '@vegaprotocol/ui-toolkit'; import type BigNumber from 'bignumber.js'; diff --git a/libs/deposits/src/lib/deposit-manager.tsx b/libs/deposits/src/lib/deposit-manager.tsx index 6a3fde583..85945600f 100644 --- a/libs/deposits/src/lib/deposit-manager.tsx +++ b/libs/deposits/src/lib/deposit-manager.tsx @@ -1,6 +1,6 @@ import { DepositForm } from './deposit-form'; import type { DepositFormProps } from './deposit-form'; -import { removeDecimal } from '@vegaprotocol/react-helpers'; +import { removeDecimal } from '@vegaprotocol/utils'; import { prepend0x } from '@vegaprotocol/smart-contracts'; import sortBy from 'lodash/sortBy'; import { useSubmitApproval } from './use-submit-approval'; @@ -18,7 +18,7 @@ import { useBridgeContract, useEthereumConfig, } from '@vegaprotocol/web3'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; interface DepositManagerProps { assetId?: string; diff --git a/libs/deposits/src/lib/deposits-provider.ts b/libs/deposits/src/lib/deposits-provider.ts index 3d9c4595c..216ac4aed 100644 --- a/libs/deposits/src/lib/deposits-provider.ts +++ b/libs/deposits/src/lib/deposits-provider.ts @@ -4,7 +4,7 @@ import { getEvents, makeDataProvider, removePaginationWrapper, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; import { DepositsDocument, diff --git a/libs/deposits/src/lib/deposits-table.tsx b/libs/deposits/src/lib/deposits-table.tsx index b50f4f427..611123593 100644 --- a/libs/deposits/src/lib/deposits-table.tsx +++ b/libs/deposits/src/lib/deposits-table.tsx @@ -6,7 +6,7 @@ import { getDateTimeFormat, truncateByChars, isNumeric, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import type { VegaICellRendererParams, VegaValueFormatterParams, diff --git a/libs/deposits/src/lib/use-deposit-balances.ts b/libs/deposits/src/lib/use-deposit-balances.ts index 4dd2c5b19..0880ace5b 100644 --- a/libs/deposits/src/lib/use-deposit-balances.ts +++ b/libs/deposits/src/lib/use-deposit-balances.ts @@ -6,7 +6,7 @@ import { useGetAllowance } from './use-get-allowance'; import { useGetBalanceOfERC20Token } from './use-get-balance-of-erc20-token'; import { useGetDepositMaximum } from './use-get-deposit-maximum'; import { useGetDepositedAmount } from './use-get-deposited-amount'; -import { isAssetTypeERC20, usePrevious } from '@vegaprotocol/react-helpers'; +import { isAssetTypeERC20, usePrevious } from '@vegaprotocol/utils'; import { useAccountBalance } from '@vegaprotocol/accounts'; import type { Asset } from '@vegaprotocol/assets'; diff --git a/libs/deposits/src/lib/use-get-allowance.ts b/libs/deposits/src/lib/use-get-allowance.ts index 5e2be32f5..7e6db2f7d 100644 --- a/libs/deposits/src/lib/use-get-allowance.ts +++ b/libs/deposits/src/lib/use-get-allowance.ts @@ -5,7 +5,7 @@ import { useCallback } from 'react'; import { useEthereumConfig } from '@vegaprotocol/web3'; import BigNumber from 'bignumber.js'; import type { Asset } from '@vegaprotocol/assets'; -import { addDecimal } from '@vegaprotocol/react-helpers'; +import { addDecimal } from '@vegaprotocol/utils'; export const useGetAllowance = ( contract: Token | null, diff --git a/libs/deposits/src/lib/use-get-balance-of-erc20-token.ts b/libs/deposits/src/lib/use-get-balance-of-erc20-token.ts index 3e87d40ea..4daf1c28b 100644 --- a/libs/deposits/src/lib/use-get-balance-of-erc20-token.ts +++ b/libs/deposits/src/lib/use-get-balance-of-erc20-token.ts @@ -4,7 +4,7 @@ import { useWeb3React } from '@web3-react/core'; import { useCallback } from 'react'; import BigNumber from 'bignumber.js'; import type { Asset } from '@vegaprotocol/assets'; -import { addDecimal } from '@vegaprotocol/react-helpers'; +import { addDecimal } from '@vegaprotocol/utils'; export const useGetBalanceOfERC20Token = ( contract: Token | null, diff --git a/libs/deposits/src/lib/use-get-deposit-maximum.ts b/libs/deposits/src/lib/use-get-deposit-maximum.ts index 8c3182e9f..2c343c5de 100644 --- a/libs/deposits/src/lib/use-get-deposit-maximum.ts +++ b/libs/deposits/src/lib/use-get-deposit-maximum.ts @@ -2,7 +2,7 @@ import { useCallback } from 'react'; import * as Sentry from '@sentry/react'; import BigNumber from 'bignumber.js'; import type { Asset } from '@vegaprotocol/assets'; -import { addDecimal } from '@vegaprotocol/react-helpers'; +import { addDecimal } from '@vegaprotocol/utils'; import type { CollateralBridge } from '@vegaprotocol/smart-contracts'; export const useGetDepositMaximum = ( diff --git a/libs/deposits/src/lib/use-get-deposited-amount.ts b/libs/deposits/src/lib/use-get-deposited-amount.ts index a268e2b96..89ed89ba3 100644 --- a/libs/deposits/src/lib/use-get-deposited-amount.ts +++ b/libs/deposits/src/lib/use-get-deposited-amount.ts @@ -4,7 +4,7 @@ import { ethers } from 'ethers'; import { useEthereumConfig } from '@vegaprotocol/web3'; import BigNumber from 'bignumber.js'; import type { Asset } from '@vegaprotocol/assets'; -import { addDecimal } from '@vegaprotocol/react-helpers'; +import { addDecimal } from '@vegaprotocol/utils'; import { useWeb3React } from '@web3-react/core'; export const useGetDepositedAmount = (asset: Asset | undefined) => { diff --git a/libs/deposits/src/lib/use-submit-approval.ts b/libs/deposits/src/lib/use-submit-approval.ts index bbaeb9624..e5904dea3 100644 --- a/libs/deposits/src/lib/use-submit-approval.ts +++ b/libs/deposits/src/lib/use-submit-approval.ts @@ -1,4 +1,4 @@ -import { isAssetTypeERC20, removeDecimal } from '@vegaprotocol/react-helpers'; +import { isAssetTypeERC20, removeDecimal } from '@vegaprotocol/utils'; import * as Sentry from '@sentry/react'; import type { Token } from '@vegaprotocol/smart-contracts'; import { diff --git a/libs/deposits/src/lib/use-submit-faucet.ts b/libs/deposits/src/lib/use-submit-faucet.ts index 0da95cb72..b16df2f7b 100644 --- a/libs/deposits/src/lib/use-submit-faucet.ts +++ b/libs/deposits/src/lib/use-submit-faucet.ts @@ -1,7 +1,7 @@ import type { TokenFaucetable } from '@vegaprotocol/smart-contracts'; import * as Sentry from '@sentry/react'; import { useEthereumTransaction, useTokenContract } from '@vegaprotocol/web3'; -import { isAssetTypeERC20 } from '@vegaprotocol/react-helpers'; +import { isAssetTypeERC20 } from '@vegaprotocol/utils'; import type { Asset } from '@vegaprotocol/assets'; export const useSubmitFaucet = (asset?: Asset) => { diff --git a/libs/environment/src/components/network-switcher/network-switcher.spec.tsx b/libs/environment/src/components/network-switcher/network-switcher.spec.tsx index 0911c8cdd..5e008d358 100644 --- a/libs/environment/src/components/network-switcher/network-switcher.spec.tsx +++ b/libs/environment/src/components/network-switcher/network-switcher.spec.tsx @@ -1,6 +1,6 @@ import { render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { useEnvironment } from '../../hooks/use-environment'; import { NetworkSwitcher, diff --git a/libs/environment/src/components/network-switcher/network-switcher.tsx b/libs/environment/src/components/network-switcher/network-switcher.tsx index ddcd4e200..9e1f3943b 100644 --- a/libs/environment/src/components/network-switcher/network-switcher.tsx +++ b/libs/environment/src/components/network-switcher/network-switcher.tsx @@ -1,5 +1,5 @@ import { useState, useCallback, useRef } from 'react'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { Link, DropdownMenu, diff --git a/libs/environment/src/components/node-switcher/layout-cell.tsx b/libs/environment/src/components/node-switcher/layout-cell.tsx index b335c77ea..03e355277 100644 --- a/libs/environment/src/components/node-switcher/layout-cell.tsx +++ b/libs/environment/src/components/node-switcher/layout-cell.tsx @@ -1,6 +1,6 @@ import type { ReactNode } from 'react'; import classnames from 'classnames'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; type LayoutCellProps = { label?: string; diff --git a/libs/environment/src/components/node-switcher/node-switcher.tsx b/libs/environment/src/components/node-switcher/node-switcher.tsx index 1ec3414d7..ec5093f07 100644 --- a/libs/environment/src/components/node-switcher/node-switcher.tsx +++ b/libs/environment/src/components/node-switcher/node-switcher.tsx @@ -1,5 +1,5 @@ import { useCallback, useState } from 'react'; -import { isValidUrl, t } from '@vegaprotocol/react-helpers'; +import { isValidUrl, t } from '@vegaprotocol/utils'; import { Button, ButtonLink, diff --git a/libs/environment/src/components/node-switcher/row-data.tsx b/libs/environment/src/components/node-switcher/row-data.tsx index c8437f37c..75e4bb1ec 100644 --- a/libs/environment/src/components/node-switcher/row-data.tsx +++ b/libs/environment/src/components/node-switcher/row-data.tsx @@ -1,6 +1,6 @@ import type { ApolloError } from '@apollo/client'; import { useHeaderStore } from '@vegaprotocol/apollo-client'; -import { isValidUrl, t } from '@vegaprotocol/react-helpers'; +import { isValidUrl, t } from '@vegaprotocol/utils'; import { Radio } from '@vegaprotocol/ui-toolkit'; import { useEffect, useState } from 'react'; import { CUSTOM_NODE_KEY } from '../../types'; diff --git a/libs/environment/src/hooks/use-environment.ts b/libs/environment/src/hooks/use-environment.ts index 968a91bc5..7e5302068 100644 --- a/libs/environment/src/hooks/use-environment.ts +++ b/libs/environment/src/hooks/use-environment.ts @@ -1,4 +1,4 @@ -import { isValidUrl, LocalStorage, t } from '@vegaprotocol/react-helpers'; +import { isValidUrl, LocalStorage, t } from '@vegaprotocol/utils'; import { useEffect } from 'react'; import { create } from 'zustand'; import { createClient } from '@vegaprotocol/apollo-client'; diff --git a/libs/environment/src/hooks/use-node-health.ts b/libs/environment/src/hooks/use-node-health.ts index f5610cead..299f8faea 100644 --- a/libs/environment/src/hooks/use-node-health.ts +++ b/libs/environment/src/hooks/use-node-health.ts @@ -2,7 +2,7 @@ import { useEffect, useMemo } from 'react'; import { useStatisticsQuery } from '../utils/__generated__/Node'; import { useHeaderStore } from '@vegaprotocol/apollo-client'; import { useEnvironment } from './use-environment'; -import { fromNanoSeconds } from '@vegaprotocol/react-helpers'; +import { fromNanoSeconds } from '@vegaprotocol/utils'; const POLL_INTERVAL = 1000; diff --git a/libs/fills/.storybook/preview.js b/libs/fills/.storybook/preview.js index 3dbf92472..3b0971710 100644 --- a/libs/fills/.storybook/preview.js +++ b/libs/fills/.storybook/preview.js @@ -1,5 +1,5 @@ import './styles.css'; -import { useStorybookThemeObserver } from '@vegaprotocol/react-helpers'; +import { useStorybookThemeObserver } from '@vegaprotocol/utils'; export const parameters = { actions: { argTypesRegex: '^on[A-Z].*' }, diff --git a/libs/fills/src/lib/fills-container.tsx b/libs/fills/src/lib/fills-container.tsx index f15e42e87..307f0cc3d 100644 --- a/libs/fills/src/lib/fills-container.tsx +++ b/libs/fills/src/lib/fills-container.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { Splash } from '@vegaprotocol/ui-toolkit'; import { useVegaWallet } from '@vegaprotocol/wallet'; import { FillsManager } from './fills-manager'; diff --git a/libs/fills/src/lib/fills-data-provider.ts b/libs/fills/src/lib/fills-data-provider.ts index f7ae3132e..ff3b72126 100644 --- a/libs/fills/src/lib/fills-data-provider.ts +++ b/libs/fills/src/lib/fills-data-provider.ts @@ -6,10 +6,10 @@ import { defaultAppend as append, paginatedCombineDelta as combineDelta, paginatedCombineInsertionData as combineInsertionData, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import type { Market } from '@vegaprotocol/market-list'; import { marketsProvider } from '@vegaprotocol/market-list'; -import type { PageInfo, Edge } from '@vegaprotocol/react-helpers'; +import type { PageInfo, Edge } from '@vegaprotocol/utils'; import { FillsDocument, FillsEventDocument } from './__generated__/Fills'; import type { FillsQuery, diff --git a/libs/fills/src/lib/fills-manager.tsx b/libs/fills/src/lib/fills-manager.tsx index 5b2b04f56..99d2b176a 100644 --- a/libs/fills/src/lib/fills-manager.tsx +++ b/libs/fills/src/lib/fills-manager.tsx @@ -1,7 +1,7 @@ import type { AgGridReact } from 'ag-grid-react'; import { useRef } from 'react'; import { AsyncRenderer } from '@vegaprotocol/ui-toolkit'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { FillsTable } from './fills-table'; import type { BodyScrollEvent, BodyScrollEndEvent } from 'ag-grid-community'; import { useFillsList } from './use-fills-list'; diff --git a/libs/fills/src/lib/fills-table.spec.tsx b/libs/fills/src/lib/fills-table.spec.tsx index 756dc3206..b7ef03bab 100644 --- a/libs/fills/src/lib/fills-table.spec.tsx +++ b/libs/fills/src/lib/fills-table.spec.tsx @@ -1,6 +1,6 @@ import { act, render, screen, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import { getDateTimeFormat } from '@vegaprotocol/react-helpers'; +import { getDateTimeFormat } from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; import type { PartialDeep } from 'type-fest'; import type { Trade } from './fills-data-provider'; diff --git a/libs/fills/src/lib/fills-table.tsx b/libs/fills/src/lib/fills-table.tsx index 445f01ba7..3b5bca297 100644 --- a/libs/fills/src/lib/fills-table.tsx +++ b/libs/fills/src/lib/fills-table.tsx @@ -13,7 +13,7 @@ import { negativeClassNames, t, isNumeric, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; import { AgGridColumn } from 'ag-grid-react'; import type { diff --git a/libs/fills/src/lib/use-fills-list.ts b/libs/fills/src/lib/use-fills-list.ts index 07a0fc1fc..661723a1d 100644 --- a/libs/fills/src/lib/use-fills-list.ts +++ b/libs/fills/src/lib/use-fills-list.ts @@ -5,7 +5,7 @@ import { makeInfiniteScrollGetRows, useDataProvider, updateGridData, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import type { Trade, TradeEdge } from './fills-data-provider'; import { fillsWithMarketProvider } from './fills-data-provider'; diff --git a/libs/governance/src/components/asset-proposal-notification.tsx b/libs/governance/src/components/asset-proposal-notification.tsx index 1ed187b21..2bdacb95a 100644 --- a/libs/governance/src/components/asset-proposal-notification.tsx +++ b/libs/governance/src/components/asset-proposal-notification.tsx @@ -1,5 +1,5 @@ import { DApp, TOKEN_PROPOSAL, useLinks } from '@vegaprotocol/environment'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; import { ExternalLink, Intent, Notification } from '@vegaprotocol/ui-toolkit'; import { useUpdateProposal } from '../lib'; diff --git a/libs/governance/src/components/market-proposal-notification.tsx b/libs/governance/src/components/market-proposal-notification.tsx index f1ebb5b43..b84a2c8fa 100644 --- a/libs/governance/src/components/market-proposal-notification.tsx +++ b/libs/governance/src/components/market-proposal-notification.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; import { ExternalLink, Intent, Notification } from '@vegaprotocol/ui-toolkit'; import { DApp, TOKEN_PROPOSAL, useLinks } from '@vegaprotocol/environment'; diff --git a/libs/governance/src/lib/proposals-data-provider/proposals-data-provider.tsx b/libs/governance/src/lib/proposals-data-provider/proposals-data-provider.tsx index 318f08821..749effbeb 100644 --- a/libs/governance/src/lib/proposals-data-provider/proposals-data-provider.tsx +++ b/libs/governance/src/lib/proposals-data-provider/proposals-data-provider.tsx @@ -1,4 +1,4 @@ -import { makeDataProvider } from '@vegaprotocol/react-helpers'; +import { makeDataProvider } from '@vegaprotocol/utils'; import type { ProposalsListQuery, ProposalListFieldsFragment, diff --git a/libs/governance/src/lib/proposals-hooks/use-update-network-paramaters-toasts.tsx b/libs/governance/src/lib/proposals-hooks/use-update-network-paramaters-toasts.tsx index 6681d52c9..f61f07875 100644 --- a/libs/governance/src/lib/proposals-hooks/use-update-network-paramaters-toasts.tsx +++ b/libs/governance/src/lib/proposals-hooks/use-update-network-paramaters-toasts.tsx @@ -1,5 +1,5 @@ import { DApp, TOKEN_PROPOSAL, useLinks } from '@vegaprotocol/environment'; -import { getDateTimeFormat, t } from '@vegaprotocol/react-helpers'; +import { getDateTimeFormat, t } from '@vegaprotocol/utils'; import type { UpdateNetworkParameter } from '@vegaprotocol/types'; import { ProposalStateMapping } from '@vegaprotocol/types'; import { ProposalState } from '@vegaprotocol/types'; diff --git a/libs/governance/src/lib/proposals-hooks/use-update-proposal.ts b/libs/governance/src/lib/proposals-hooks/use-update-proposal.ts index 0989e750d..c161f6a95 100644 --- a/libs/governance/src/lib/proposals-hooks/use-update-proposal.ts +++ b/libs/governance/src/lib/proposals-hooks/use-update-proposal.ts @@ -1,6 +1,6 @@ import { proposalsDataProvider } from '..'; import * as Schema from '@vegaprotocol/types'; -import { useDataProvider } from '@vegaprotocol/react-helpers'; +import { useDataProvider } from '@vegaprotocol/utils'; import { useMemo } from 'react'; import first from 'lodash/first'; import type { ProposalListFieldsFragment } from '..'; diff --git a/libs/governance/src/lib/proposals-list/proposals-list.tsx b/libs/governance/src/lib/proposals-list/proposals-list.tsx index 7dd90060d..599849b2e 100644 --- a/libs/governance/src/lib/proposals-list/proposals-list.tsx +++ b/libs/governance/src/lib/proposals-list/proposals-list.tsx @@ -2,7 +2,7 @@ import { AgGridDynamic as AgGrid, AsyncRenderer, } from '@vegaprotocol/ui-toolkit'; -import { useDataProvider } from '@vegaprotocol/react-helpers'; +import { useDataProvider } from '@vegaprotocol/utils'; import * as Types from '@vegaprotocol/types'; import { proposalsDataProvider } from '../proposals-data-provider'; import { useCallback, useMemo, useRef } from 'react'; diff --git a/libs/governance/src/lib/proposals-list/use-column-defs.tsx b/libs/governance/src/lib/proposals-list/use-column-defs.tsx index 27724cf58..02adfcd26 100644 --- a/libs/governance/src/lib/proposals-list/use-column-defs.tsx +++ b/libs/governance/src/lib/proposals-list/use-column-defs.tsx @@ -7,7 +7,7 @@ import { NetworkParams, useNetworkParams, getDateTimeFormat, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import type { VegaICellRendererParams, VegaValueFormatterParams, diff --git a/libs/governance/src/utils/proposal-dialog-helpers.tsx b/libs/governance/src/utils/proposal-dialog-helpers.tsx index f351d16f8..9dac6aa5f 100644 --- a/libs/governance/src/utils/proposal-dialog-helpers.tsx +++ b/libs/governance/src/utils/proposal-dialog-helpers.tsx @@ -1,5 +1,5 @@ import { ProposalState } from '@vegaprotocol/types'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { Icon, Intent } from '@vegaprotocol/ui-toolkit'; import type { ReactNode } from 'react'; diff --git a/libs/ledger/src/lib/ledger-container.tsx b/libs/ledger/src/lib/ledger-container.tsx index f158fc46c..d38f308b6 100644 --- a/libs/ledger/src/lib/ledger-container.tsx +++ b/libs/ledger/src/lib/ledger-container.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { Splash } from '@vegaprotocol/ui-toolkit'; import { useVegaWallet } from '@vegaprotocol/wallet'; import { LedgerManager } from './ledger-manager'; diff --git a/libs/ledger/src/lib/ledger-entries-data-provider.ts b/libs/ledger/src/lib/ledger-entries-data-provider.ts index 94df404db..93a23bd15 100644 --- a/libs/ledger/src/lib/ledger-entries-data-provider.ts +++ b/libs/ledger/src/lib/ledger-entries-data-provider.ts @@ -2,13 +2,13 @@ import type { Asset } from '@vegaprotocol/assets'; import { assetsProvider } from '@vegaprotocol/assets'; import type { Market } from '@vegaprotocol/market-list'; import { marketsProvider } from '@vegaprotocol/market-list'; -import { makeInfiniteScrollGetRows } from '@vegaprotocol/react-helpers'; +import { makeInfiniteScrollGetRows } from '@vegaprotocol/utils'; import { makeDataProvider, makeDerivedDataProvider, useDataProvider, updateGridData, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import type * as Schema from '@vegaprotocol/types'; import type { AgGridReact } from 'ag-grid-react'; import produce from 'immer'; diff --git a/libs/ledger/src/lib/ledger-manager.tsx b/libs/ledger/src/lib/ledger-manager.tsx index 7ad7883f2..c032edf7c 100644 --- a/libs/ledger/src/lib/ledger-manager.tsx +++ b/libs/ledger/src/lib/ledger-manager.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import type * as Schema from '@vegaprotocol/types'; import { AsyncRenderer } from '@vegaprotocol/ui-toolkit'; import type { FilterChangedEvent } from 'ag-grid-community'; diff --git a/libs/ledger/src/lib/ledger-table.tsx b/libs/ledger/src/lib/ledger-table.tsx index 564eac2d2..887785e64 100644 --- a/libs/ledger/src/lib/ledger-table.tsx +++ b/libs/ledger/src/lib/ledger-table.tsx @@ -6,7 +6,7 @@ import { SetFilter, t, truncateByChars, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import type { VegaValueFormatterParams, TypedDataAgGrid, diff --git a/libs/liquidity/src/lib/liquidity-data-provider.ts b/libs/liquidity/src/lib/liquidity-data-provider.ts index 3a7ebd99d..633bff267 100644 --- a/libs/liquidity/src/lib/liquidity-data-provider.ts +++ b/libs/liquidity/src/lib/liquidity-data-provider.ts @@ -1,8 +1,5 @@ import compact from 'lodash/compact'; -import { - makeDataProvider, - makeDerivedDataProvider, -} from '@vegaprotocol/react-helpers'; +import { makeDataProvider, makeDerivedDataProvider } from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; import BigNumber from 'bignumber.js'; import produce from 'immer'; diff --git a/libs/liquidity/src/lib/liquidity-table.tsx b/libs/liquidity/src/lib/liquidity-table.tsx index 334cbabd2..a88d94953 100644 --- a/libs/liquidity/src/lib/liquidity-table.tsx +++ b/libs/liquidity/src/lib/liquidity-table.tsx @@ -4,7 +4,7 @@ import { formatNumberPercentage, getDateTimeFormat, t, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import type { VegaValueFormatterParams, TypedDataAgGrid, diff --git a/libs/liquidity/src/lib/markets-liquidity-provider.ts b/libs/liquidity/src/lib/markets-liquidity-provider.ts index 3e2887170..8242d2074 100644 --- a/libs/liquidity/src/lib/markets-liquidity-provider.ts +++ b/libs/liquidity/src/lib/markets-liquidity-provider.ts @@ -5,7 +5,7 @@ import { makeDerivedDataProvider, useDataProvider, useYesterday, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import type { MarketCandles, diff --git a/libs/liquidity/src/lib/utils/liquidity-utils.ts b/libs/liquidity/src/lib/utils/liquidity-utils.ts index 4f36a527f..b42d45a02 100644 --- a/libs/liquidity/src/lib/utils/liquidity-utils.ts +++ b/libs/liquidity/src/lib/utils/liquidity-utils.ts @@ -1,5 +1,5 @@ import BigNumber from 'bignumber.js'; -import { addDecimalsFormatNumber } from '@vegaprotocol/react-helpers'; +import { addDecimalsFormatNumber } from '@vegaprotocol/utils'; import type { MarketNodeFragment } from './../__generated__/MarketsLiquidity'; import { Intent } from '@vegaprotocol/ui-toolkit'; diff --git a/libs/market-depth/src/lib/depth-chart-utils.ts b/libs/market-depth/src/lib/depth-chart-utils.ts index 5d4ded542..3e2a936cb 100644 --- a/libs/market-depth/src/lib/depth-chart-utils.ts +++ b/libs/market-depth/src/lib/depth-chart-utils.ts @@ -1,4 +1,4 @@ -import { addDecimal } from '@vegaprotocol/react-helpers'; +import { addDecimal } from '@vegaprotocol/utils'; interface PriceLevel { price: number; diff --git a/libs/market-depth/src/lib/depth-chart.tsx b/libs/market-depth/src/lib/depth-chart.tsx index d6ffa1876..2bec70ecc 100644 --- a/libs/market-depth/src/lib/depth-chart.tsx +++ b/libs/market-depth/src/lib/depth-chart.tsx @@ -7,7 +7,7 @@ import { getNumberFormat, useThemeSwitcher, t, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import { marketDepthProvider } from './market-depth-provider'; import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; import { marketDataProvider, marketProvider } from '@vegaprotocol/market-list'; diff --git a/libs/market-depth/src/lib/market-depth-provider.ts b/libs/market-depth/src/lib/market-depth-provider.ts index 27353c3da..a4f58b97e 100644 --- a/libs/market-depth/src/lib/market-depth-provider.ts +++ b/libs/market-depth/src/lib/market-depth-provider.ts @@ -1,6 +1,6 @@ -import { makeDataProvider } from '@vegaprotocol/react-helpers'; +import { makeDataProvider } from '@vegaprotocol/utils'; import { updateLevels } from './orderbook-data'; -import type { Update } from '@vegaprotocol/react-helpers'; +import type { Update } from '@vegaprotocol/utils'; import { captureException } from '@sentry/react'; import { diff --git a/libs/market-depth/src/lib/orderbook-data.ts b/libs/market-depth/src/lib/orderbook-data.ts index e24bed573..1acacb26a 100644 --- a/libs/market-depth/src/lib/orderbook-data.ts +++ b/libs/market-depth/src/lib/orderbook-data.ts @@ -2,7 +2,7 @@ import groupBy from 'lodash/groupBy'; import uniqBy from 'lodash/uniqBy'; import reverse from 'lodash/reverse'; import cloneDeep from 'lodash/cloneDeep'; -import { VolumeType } from '@vegaprotocol/react-helpers'; +import { VolumeType } from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; import type { MarketData } from '@vegaprotocol/market-list'; import type { PriceLevelFieldsFragment } from './__generated__/MarketDepth'; diff --git a/libs/market-depth/src/lib/orderbook-manager.tsx b/libs/market-depth/src/lib/orderbook-manager.tsx index bca813f55..5ac6ea9ab 100644 --- a/libs/market-depth/src/lib/orderbook-manager.tsx +++ b/libs/market-depth/src/lib/orderbook-manager.tsx @@ -2,7 +2,7 @@ import React from 'react'; import throttle from 'lodash/throttle'; import { AsyncRenderer } from '@vegaprotocol/ui-toolkit'; import { Orderbook } from './orderbook'; -import { addDecimal, useDataProvider } from '@vegaprotocol/react-helpers'; +import { addDecimal, useDataProvider } from '@vegaprotocol/utils'; import { marketDepthProvider } from './market-depth-provider'; import { marketDataProvider, marketProvider } from '@vegaprotocol/market-list'; import type { MarketData } from '@vegaprotocol/market-list'; diff --git a/libs/market-depth/src/lib/orderbook-row.tsx b/libs/market-depth/src/lib/orderbook-row.tsx index c82fd9f0c..4194101f2 100644 --- a/libs/market-depth/src/lib/orderbook-row.tsx +++ b/libs/market-depth/src/lib/orderbook-row.tsx @@ -1,9 +1,9 @@ import React from 'react'; +import { addDecimal, addDecimalsFormatNumber } from '@vegaprotocol/utils'; import { PriceCell, VolCell, CumulativeVol, - addDecimalsFormatNumber, VolumeType, } from '@vegaprotocol/react-helpers'; diff --git a/libs/market-depth/src/lib/orderbook.tsx b/libs/market-depth/src/lib/orderbook.tsx index 9bd393360..f7d834407 100644 --- a/libs/market-depth/src/lib/orderbook.tsx +++ b/libs/market-depth/src/lib/orderbook.tsx @@ -10,7 +10,7 @@ import { useResizeObserver, formatNumberFixed, useThemeSwitcher, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; import { OrderbookRow } from './orderbook-row'; import { createRow } from './orderbook-data'; diff --git a/libs/market-info/src/components/fees-breakdown/fees-breakdown.tsx b/libs/market-info/src/components/fees-breakdown/fees-breakdown.tsx index 747e3d1e0..a310d9aaa 100644 --- a/libs/market-info/src/components/fees-breakdown/fees-breakdown.tsx +++ b/libs/market-info/src/components/fees-breakdown/fees-breakdown.tsx @@ -3,7 +3,7 @@ import { addDecimalsFormatNumber, formatNumberPercentage, t, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import { Tooltip } from '@vegaprotocol/ui-toolkit'; import BigNumber from 'bignumber.js'; diff --git a/libs/market-info/src/components/market-info/info-key-value-table.tsx b/libs/market-info/src/components/market-info/info-key-value-table.tsx index fc41af6a5..8924de917 100644 --- a/libs/market-info/src/components/market-info/info-key-value-table.tsx +++ b/libs/market-info/src/components/market-info/info-key-value-table.tsx @@ -3,7 +3,7 @@ import { formatNumber, formatNumberPercentage, t, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import { KeyValueTable, KeyValueTableRow, diff --git a/libs/market-info/src/components/market-info/info-market.tsx b/libs/market-info/src/components/market-info/info-market.tsx index e450a58dc..aca684280 100644 --- a/libs/market-info/src/components/market-info/info-market.tsx +++ b/libs/market-info/src/components/market-info/info-market.tsx @@ -9,7 +9,7 @@ import { t, useDataProvider, useYesterday, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; import { Accordion, @@ -25,10 +25,7 @@ import { generatePath, Link } from 'react-router-dom'; import { MarketInfoTable } from './info-key-value-table'; import { marketInfoDataProvider } from './market-info-data-provider'; -import { - TokenLinks, - getMarketExpiryDateFormatted, -} from '@vegaprotocol/react-helpers'; +import { TokenLinks, getMarketExpiryDateFormatted } from '@vegaprotocol/utils'; import type { MarketInfoQuery } from './__generated__/MarketInfo'; import { MarketProposalNotification } from '@vegaprotocol/governance'; diff --git a/libs/market-info/src/components/market-info/market-info-data-provider.ts b/libs/market-info/src/components/market-info/market-info-data-provider.ts index 87cbcf7b1..dc651265a 100644 --- a/libs/market-info/src/components/market-info/market-info-data-provider.ts +++ b/libs/market-info/src/components/market-info/market-info-data-provider.ts @@ -1,4 +1,4 @@ -import { makeDataProvider } from '@vegaprotocol/react-helpers'; +import { makeDataProvider } from '@vegaprotocol/utils'; import type { MarketInfoQuery } from './__generated__/MarketInfo'; import { MarketInfoDocument } from './__generated__/MarketInfo'; import type { MarketInfoNoCandlesQuery } from './__generated__/MarketInfoNoCandles'; diff --git a/libs/market-info/src/components/market-info/tooltip-mapping.tsx b/libs/market-info/src/components/market-info/tooltip-mapping.tsx index 5b5921c09..67d92f84a 100644 --- a/libs/market-info/src/components/market-info/tooltip-mapping.tsx +++ b/libs/market-info/src/components/market-info/tooltip-mapping.tsx @@ -1,4 +1,4 @@ -import { ExternalLinks, t } from '@vegaprotocol/react-helpers'; +import { ExternalLinks, t } from '@vegaprotocol/utils'; import { ExternalLink } from '@vegaprotocol/ui-toolkit'; import type { ReactNode } from 'react'; diff --git a/libs/market-list/src/lib/components/markets-container/market-list-table.tsx b/libs/market-list/src/lib/components/markets-container/market-list-table.tsx index 667ce3a1a..f596f0af4 100644 --- a/libs/market-list/src/lib/components/markets-container/market-list-table.tsx +++ b/libs/market-list/src/lib/components/markets-container/market-list-table.tsx @@ -4,7 +4,7 @@ import { addDecimalsFormatNumber, t, toBigNum, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import type { VegaValueGetterParams, VegaValueFormatterParams, diff --git a/libs/market-list/src/lib/components/markets-container/markets-container.tsx b/libs/market-list/src/lib/components/markets-container/markets-container.tsx index 0095d9459..c2c001b01 100644 --- a/libs/market-list/src/lib/components/markets-container/markets-container.tsx +++ b/libs/market-list/src/lib/components/markets-container/markets-container.tsx @@ -1,7 +1,7 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { AsyncRenderer } from '@vegaprotocol/ui-toolkit'; import { MarketListTable } from './market-list-table'; -import { useDataProvider } from '@vegaprotocol/react-helpers'; +import { useDataProvider } from '@vegaprotocol/utils'; import type { RowClickedEvent } from 'ag-grid-community'; import { marketsWithDataProvider as dataProvider } from '../../markets-provider'; import type { MarketMaybeWithData } from '../../markets-provider'; diff --git a/libs/market-list/src/lib/market-candles-provider.ts b/libs/market-list/src/lib/market-candles-provider.ts index 5013d0a5d..40e7286c0 100644 --- a/libs/market-list/src/lib/market-candles-provider.ts +++ b/libs/market-list/src/lib/market-candles-provider.ts @@ -1,4 +1,4 @@ -import { makeDataProvider } from '@vegaprotocol/react-helpers'; +import { makeDataProvider } from '@vegaprotocol/utils'; import type { MarketCandlesQuery, MarketCandlesUpdateSubscription, diff --git a/libs/market-list/src/lib/market-data-provider.ts b/libs/market-list/src/lib/market-data-provider.ts index 06a269f19..f0d3480a3 100644 --- a/libs/market-list/src/lib/market-data-provider.ts +++ b/libs/market-list/src/lib/market-data-provider.ts @@ -1,10 +1,7 @@ import produce from 'immer'; import { useMemo } from 'react'; -import { - makeDerivedDataProvider, - useDataProvider, -} from '@vegaprotocol/react-helpers'; -import { makeDataProvider } from '@vegaprotocol/react-helpers'; +import { makeDerivedDataProvider, useDataProvider } from '@vegaprotocol/utils'; +import { makeDataProvider } from '@vegaprotocol/utils'; import { MarketDataDocument, MarketDataUpdateDocument, diff --git a/libs/market-list/src/lib/markets-candles-provider.ts b/libs/market-list/src/lib/markets-candles-provider.ts index 3f53f7a02..3220b883a 100644 --- a/libs/market-list/src/lib/markets-candles-provider.ts +++ b/libs/market-list/src/lib/markets-candles-provider.ts @@ -1,4 +1,4 @@ -import { makeDataProvider } from '@vegaprotocol/react-helpers'; +import { makeDataProvider } from '@vegaprotocol/utils'; import { MarketsCandlesDocument } from './__generated__/markets-candles'; import type { MarketsCandlesQuery } from './__generated__/markets-candles'; import type { Candle } from './market-candles-provider'; diff --git a/libs/market-list/src/lib/markets-data-provider.ts b/libs/market-list/src/lib/markets-data-provider.ts index 09f88099c..4304bd87e 100644 --- a/libs/market-list/src/lib/markets-data-provider.ts +++ b/libs/market-list/src/lib/markets-data-provider.ts @@ -1,7 +1,7 @@ import { makeDataProvider, marketDataErrorPolicyGuard, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import type { MarketsDataQuery } from './__generated__/markets-data'; import { MarketsDataDocument } from './__generated__/markets-data'; import type { MarketData } from './market-data-provider'; diff --git a/libs/market-list/src/lib/markets-provider.ts b/libs/market-list/src/lib/markets-provider.ts index 4392c0080..c9061577f 100644 --- a/libs/market-list/src/lib/markets-provider.ts +++ b/libs/market-list/src/lib/markets-provider.ts @@ -3,7 +3,7 @@ import { makeDerivedDataProvider, useDataProvider, useYesterday, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import type { MarketsQuery, MarketFieldsFragment, diff --git a/libs/market-list/src/lib/utils/market-utils.ts b/libs/market-list/src/lib/utils/market-utils.ts index 9f00b378d..e58fc86c1 100644 --- a/libs/market-list/src/lib/utils/market-utils.ts +++ b/libs/market-list/src/lib/utils/market-utils.ts @@ -1,4 +1,4 @@ -import { formatNumberPercentage } from '@vegaprotocol/react-helpers'; +import { formatNumberPercentage } from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; import BigNumber from 'bignumber.js'; import orderBy from 'lodash/orderBy'; diff --git a/libs/network-info/src/network-info.tsx b/libs/network-info/src/network-info.tsx index dbdc7610a..6d7a66b07 100644 --- a/libs/network-info/src/network-info.tsx +++ b/libs/network-info/src/network-info.tsx @@ -1,5 +1,5 @@ import { Fragment, useState } from 'react'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { Link, Lozenge } from '@vegaprotocol/ui-toolkit'; import { NodeSwitcherDialog, useEnvironment } from '@vegaprotocol/environment'; diff --git a/libs/network-stats/src/config/stats-fields.ts b/libs/network-stats/src/config/stats-fields.ts index e90efa3ad..718a616d3 100644 --- a/libs/network-stats/src/config/stats-fields.ts +++ b/libs/network-stats/src/config/stats-fields.ts @@ -4,7 +4,7 @@ import { getTimeFormat, isValidDate, t, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import type { Stats, StatFields } from './types'; // Stats fields config. Keys will correspond to graphql queries when used, and values diff --git a/libs/orders/src/lib/components/order-data-provider/order-data-provider.spec.ts b/libs/orders/src/lib/components/order-data-provider/order-data-provider.spec.ts index d5e7380f1..c630e0241 100644 --- a/libs/orders/src/lib/components/order-data-provider/order-data-provider.spec.ts +++ b/libs/orders/src/lib/components/order-data-provider/order-data-provider.spec.ts @@ -1,6 +1,6 @@ import { update } from './order-data-provider'; import type { OrderUpdateFieldsFragment, OrderFieldsFragment } from '../'; -import type { Edge } from '@vegaprotocol/react-helpers'; +import type { Edge } from '@vegaprotocol/utils'; describe('order data provider', () => { it('puts incoming data in proper place', () => { const data = [ diff --git a/libs/orders/src/lib/components/order-data-provider/order-data-provider.ts b/libs/orders/src/lib/components/order-data-provider/order-data-provider.ts index 402995f44..f1c0ccda0 100644 --- a/libs/orders/src/lib/components/order-data-provider/order-data-provider.ts +++ b/libs/orders/src/lib/components/order-data-provider/order-data-provider.ts @@ -7,10 +7,10 @@ import { defaultAppend as append, paginatedCombineDelta as combineDelta, paginatedCombineInsertionData as combineInsertionData, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import type { Market } from '@vegaprotocol/market-list'; import { marketsProvider } from '@vegaprotocol/market-list'; -import type { PageInfo, Edge } from '@vegaprotocol/react-helpers'; +import type { PageInfo, Edge } from '@vegaprotocol/utils'; import type { OrderFieldsFragment, OrderUpdateFieldsFragment, diff --git a/libs/orders/src/lib/components/order-list-container.tsx b/libs/orders/src/lib/components/order-list-container.tsx index 84ce3e4bc..f726a526e 100644 --- a/libs/orders/src/lib/components/order-list-container.tsx +++ b/libs/orders/src/lib/components/order-list-container.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { Splash } from '@vegaprotocol/ui-toolkit'; import { useVegaWallet } from '@vegaprotocol/wallet'; import { OrderListManager } from './order-list-manager'; diff --git a/libs/orders/src/lib/components/order-list-manager/order-list-manager.spec.tsx b/libs/orders/src/lib/components/order-list-manager/order-list-manager.spec.tsx index d1adb8a5e..5febcf504 100644 --- a/libs/orders/src/lib/components/order-list-manager/order-list-manager.spec.tsx +++ b/libs/orders/src/lib/components/order-list-manager/order-list-manager.spec.tsx @@ -1,6 +1,6 @@ import { render, screen, act } from '@testing-library/react'; import { OrderListManager } from './order-list-manager'; -import * as useDataProviderHook from '@vegaprotocol/react-helpers'; +import * as useDataProviderHook from '@vegaprotocol/utils'; import type { OrderFieldsFragment } from '../'; import * as orderListMock from '../order-list/order-list'; import { forwardRef } from 'react'; diff --git a/libs/orders/src/lib/components/order-list-manager/order-list-manager.tsx b/libs/orders/src/lib/components/order-list-manager/order-list-manager.tsx index a2895b635..9393eeea8 100644 --- a/libs/orders/src/lib/components/order-list-manager/order-list-manager.tsx +++ b/libs/orders/src/lib/components/order-list-manager/order-list-manager.tsx @@ -1,5 +1,5 @@ import { AsyncRenderer } from '@vegaprotocol/ui-toolkit'; -import { t, truncateByChars } from '@vegaprotocol/react-helpers'; +import { t, truncateByChars } from '@vegaprotocol/utils'; import { useRef, useState } from 'react'; import type { BodyScrollEvent, diff --git a/libs/orders/src/lib/components/order-list-manager/use-order-list-data.spec.ts b/libs/orders/src/lib/components/order-list-manager/use-order-list-data.spec.ts index ea39ab17a..370b3eabc 100644 --- a/libs/orders/src/lib/components/order-list-manager/use-order-list-data.spec.ts +++ b/libs/orders/src/lib/components/order-list-manager/use-order-list-data.spec.ts @@ -2,7 +2,7 @@ import type { AgGridReact } from 'ag-grid-react'; import { MockedProvider } from '@apollo/client/testing'; import { renderHook, waitFor } from '@testing-library/react'; import { useOrderListData } from './use-order-list-data'; -import type { Edge } from '@vegaprotocol/react-helpers'; +import type { Edge } from '@vegaprotocol/utils'; import type { OrderFieldsFragment } from '../order-data-provider/__generated__/Orders'; import type { IGetRowsParams } from 'ag-grid-community'; diff --git a/libs/orders/src/lib/components/order-list-manager/use-order-list-data.ts b/libs/orders/src/lib/components/order-list-manager/use-order-list-data.ts index ed88da89f..3332520d4 100644 --- a/libs/orders/src/lib/components/order-list-manager/use-order-list-data.ts +++ b/libs/orders/src/lib/components/order-list-manager/use-order-list-data.ts @@ -5,7 +5,7 @@ import { makeInfiniteScrollGetRows, useDataProvider, updateGridData, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import { ordersWithMarketProvider } from '../order-data-provider/order-data-provider'; import type { OrderEdge, diff --git a/libs/orders/src/lib/components/order-list/order-edit-dialog.tsx b/libs/orders/src/lib/components/order-list/order-edit-dialog.tsx index a0aa068a3..fd076834b 100644 --- a/libs/orders/src/lib/components/order-list/order-edit-dialog.tsx +++ b/libs/orders/src/lib/components/order-list/order-edit-dialog.tsx @@ -6,7 +6,7 @@ import { addDecimal, addDecimalsFormatNumber, validateAmount, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; import { FormGroup, diff --git a/libs/orders/src/lib/components/order-list/order-list.spec.tsx b/libs/orders/src/lib/components/order-list/order-list.spec.tsx index 8ffae3a80..de97833d0 100644 --- a/libs/orders/src/lib/components/order-list/order-list.spec.tsx +++ b/libs/orders/src/lib/components/order-list/order-list.spec.tsx @@ -1,6 +1,6 @@ import { act, render, screen, within } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import { getDateTimeFormat } from '@vegaprotocol/react-helpers'; +import { getDateTimeFormat } from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; import type { PartialDeep } from 'type-fest'; import type { VegaWalletContextShape } from '@vegaprotocol/wallet'; diff --git a/libs/orders/src/lib/components/order-list/order-list.tsx b/libs/orders/src/lib/components/order-list/order-list.tsx index 321af666d..3bfff8b40 100644 --- a/libs/orders/src/lib/components/order-list/order-list.tsx +++ b/libs/orders/src/lib/components/order-list/order-list.tsx @@ -2,24 +2,22 @@ import { addDecimalsFormatNumber, getDateTimeFormat, isNumeric, - negativeClassNames, - positiveClassNames, t, - SetFilter, - DateRangeFilter, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; +import { SetFilter, DateRangeFilter } from '@vegaprotocol/react-helpers'; import * as Schema from '@vegaprotocol/types'; import { AgGridDynamic as AgGrid, ButtonLink, Link, + negativeClassNames, + positiveClassNames, } from '@vegaprotocol/ui-toolkit'; import { AgGridColumn } from 'ag-grid-react'; import BigNumber from 'bignumber.js'; import { forwardRef } from 'react'; -import type { TypedDataAgGrid } from '@vegaprotocol/ui-toolkit'; - import type { + TypedDataAgGrid, VegaICellRendererParams, VegaValueFormatterParams, } from '@vegaprotocol/ui-toolkit'; diff --git a/libs/orders/src/lib/order-hooks/use-order-edit.tsx b/libs/orders/src/lib/order-hooks/use-order-edit.tsx index 6c02cb046..9069e50fa 100644 --- a/libs/orders/src/lib/order-hooks/use-order-edit.tsx +++ b/libs/orders/src/lib/order-hooks/use-order-edit.tsx @@ -1,4 +1,4 @@ -import { removeDecimal, toNanoSeconds } from '@vegaprotocol/react-helpers'; +import { removeDecimal, toNanoSeconds } from '@vegaprotocol/utils'; import { useState, useCallback } from 'react'; import { useVegaTransaction, useVegaWallet } from '@vegaprotocol/wallet'; import type { OrderSubFieldsFragment } from './'; diff --git a/libs/orders/src/lib/order-hooks/use-order-submit.tsx b/libs/orders/src/lib/order-hooks/use-order-submit.tsx index cf2f827ed..fd304b52c 100644 --- a/libs/orders/src/lib/order-hooks/use-order-submit.tsx +++ b/libs/orders/src/lib/order-hooks/use-order-submit.tsx @@ -10,7 +10,7 @@ import * as Sentry from '@sentry/react'; import { useOrderUpdate } from './use-order-update'; import * as Schema from '@vegaprotocol/types'; import { Icon, Intent } from '@vegaprotocol/ui-toolkit'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import type { OrderSubmissionBody } from '@vegaprotocol/wallet'; export const getOrderDialogTitle = ( diff --git a/libs/orders/src/lib/utils.ts b/libs/orders/src/lib/utils.ts index 790579b3d..bddb5e809 100644 --- a/libs/orders/src/lib/utils.ts +++ b/libs/orders/src/lib/utils.ts @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; import type { OrderSubFieldsFragment } from './order-hooks'; diff --git a/libs/positions/.storybook/preview.js b/libs/positions/.storybook/preview.js index c1b81a5b8..77cf7b2b5 100644 --- a/libs/positions/.storybook/preview.js +++ b/libs/positions/.storybook/preview.js @@ -1,5 +1,5 @@ import './styles.scss'; -import { useStorybookThemeObserver } from '@vegaprotocol/react-helpers'; +import { useStorybookThemeObserver } from '@vegaprotocol/utils'; export const parameters = { actions: { argTypesRegex: '^on[A-Z].*' }, backgrounds: { disable: true }, diff --git a/libs/positions/src/lib/close-position-dialog/complete.tsx b/libs/positions/src/lib/close-position-dialog/complete.tsx index 577009635..75ae4a29d 100644 --- a/libs/positions/src/lib/close-position-dialog/complete.tsx +++ b/libs/positions/src/lib/close-position-dialog/complete.tsx @@ -1,6 +1,6 @@ import { useEnvironment } from '@vegaprotocol/environment'; import type { OrderEventFieldsFragment } from '@vegaprotocol/orders'; -import { t, truncateByChars } from '@vegaprotocol/react-helpers'; +import { t, truncateByChars } from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; import { Link } from '@vegaprotocol/ui-toolkit'; import type { TransactionResult, VegaTxState } from '@vegaprotocol/wallet'; diff --git a/libs/positions/src/lib/close-position-dialog/requested.tsx b/libs/positions/src/lib/close-position-dialog/requested.tsx index 32ed31e5a..27174a4cf 100644 --- a/libs/positions/src/lib/close-position-dialog/requested.tsx +++ b/libs/positions/src/lib/close-position-dialog/requested.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import type { ClosingOrder as IClosingOrder } from '../use-close-position'; import { useRequestClosePositionData } from '../use-request-close-position-data'; import { ActiveOrders, ClosingOrder } from './shared'; diff --git a/libs/positions/src/lib/close-position-dialog/shared.tsx b/libs/positions/src/lib/close-position-dialog/shared.tsx index a950e1543..f4cb13abb 100644 --- a/libs/positions/src/lib/close-position-dialog/shared.tsx +++ b/libs/positions/src/lib/close-position-dialog/shared.tsx @@ -1,7 +1,7 @@ import type { MarketData, Market } from '@vegaprotocol/market-list'; import type { Order } from '@vegaprotocol/orders'; import { timeInForceLabel } from '@vegaprotocol/orders'; -import { addDecimalsFormatNumber, Size, t } from '@vegaprotocol/react-helpers'; +import { addDecimalsFormatNumber, Size, t } from '@vegaprotocol/utils'; import type { ReactNode } from 'react'; import type { ClosingOrder as IClosingOrder } from '../use-close-position'; diff --git a/libs/positions/src/lib/margin-data-provider.ts b/libs/positions/src/lib/margin-data-provider.ts index 0561cbc2d..bc1a65b6d 100644 --- a/libs/positions/src/lib/margin-data-provider.ts +++ b/libs/positions/src/lib/margin-data-provider.ts @@ -1,8 +1,5 @@ import produce from 'immer'; -import { - makeDataProvider, - removePaginationWrapper, -} from '@vegaprotocol/react-helpers'; +import { makeDataProvider, removePaginationWrapper } from '@vegaprotocol/utils'; import { MarginsSubscriptionDocument, MarginsDocument, diff --git a/libs/positions/src/lib/positions-container.tsx b/libs/positions/src/lib/positions-container.tsx index 9de092ec3..2a9a7d5aa 100644 --- a/libs/positions/src/lib/positions-container.tsx +++ b/libs/positions/src/lib/positions-container.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { Splash } from '@vegaprotocol/ui-toolkit'; import { useVegaWallet } from '@vegaprotocol/wallet'; import { PositionsManager } from './positions-manager'; diff --git a/libs/positions/src/lib/positions-data-providers.ts b/libs/positions/src/lib/positions-data-providers.ts index d54e6d674..902ae62cd 100644 --- a/libs/positions/src/lib/positions-data-providers.ts +++ b/libs/positions/src/lib/positions-data-providers.ts @@ -9,7 +9,7 @@ import { makeDataProvider, makeDerivedDataProvider, removePaginationWrapper, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; import type { MarketMaybeWithData } from '@vegaprotocol/market-list'; import { marketsWithDataProvider } from '@vegaprotocol/market-list'; diff --git a/libs/positions/src/lib/positions-manager.tsx b/libs/positions/src/lib/positions-manager.tsx index 130431057..0023d270d 100644 --- a/libs/positions/src/lib/positions-manager.tsx +++ b/libs/positions/src/lib/positions-manager.tsx @@ -4,7 +4,7 @@ import { usePositionsData, PositionsTable } from '../'; import type { AgGridReact } from 'ag-grid-react'; import * as Schema from '@vegaprotocol/types'; import { useVegaTransactionStore } from '@vegaprotocol/wallet'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; interface PositionsManagerProps { partyId: string; diff --git a/libs/positions/src/lib/positions-table.tsx b/libs/positions/src/lib/positions-table.tsx index 00d0ca63d..8a72a816a 100644 --- a/libs/positions/src/lib/positions-table.tsx +++ b/libs/positions/src/lib/positions-table.tsx @@ -19,7 +19,7 @@ import { signedNumberCssClassRules, DateRangeFilter, addDecimalsFormatNumber, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import { AgGridDynamic as AgGrid, Link } from '@vegaprotocol/ui-toolkit'; import { AgGridColumn } from 'ag-grid-react'; import type { AgGridReact } from 'ag-grid-react'; diff --git a/libs/positions/src/lib/use-market-margin.tsx b/libs/positions/src/lib/use-market-margin.tsx index 5fa1d951c..54454adee 100644 --- a/libs/positions/src/lib/use-market-margin.tsx +++ b/libs/positions/src/lib/use-market-margin.tsx @@ -1,6 +1,6 @@ import { useCallback, useState } from 'react'; import { useVegaWallet } from '@vegaprotocol/wallet'; -import { useDataProvider } from '@vegaprotocol/react-helpers'; +import { useDataProvider } from '@vegaprotocol/utils'; import { marginsDataProvider } from './margin-data-provider'; import type { MarginFieldsFragment } from './__generated__/Positions'; diff --git a/libs/positions/src/lib/use-market-position-open-volume.tsx b/libs/positions/src/lib/use-market-position-open-volume.tsx index b295270e4..b0398cfa9 100644 --- a/libs/positions/src/lib/use-market-position-open-volume.tsx +++ b/libs/positions/src/lib/use-market-position-open-volume.tsx @@ -1,7 +1,7 @@ import { useCallback, useState } from 'react'; import { useVegaWallet } from '@vegaprotocol/wallet'; import { positionsDataProvider } from './positions-data-providers'; -import { useDataProvider } from '@vegaprotocol/react-helpers'; +import { useDataProvider } from '@vegaprotocol/utils'; import type { PositionFieldsFragment } from './__generated__/Positions'; export const useMarketPositionOpenVolume = (marketId: string) => { diff --git a/libs/positions/src/lib/use-positions-data.tsx b/libs/positions/src/lib/use-positions-data.tsx index c58122d23..5d9e955d7 100644 --- a/libs/positions/src/lib/use-positions-data.tsx +++ b/libs/positions/src/lib/use-positions-data.tsx @@ -4,7 +4,7 @@ import type { AgGridReact } from 'ag-grid-react'; import type { Position } from './positions-data-providers'; import { positionsMetricsProvider } from './positions-data-providers'; import type { PositionsMetricsProviderVariables } from './positions-data-providers'; -import { useDataProvider, updateGridData } from '@vegaprotocol/react-helpers'; +import { useDataProvider, updateGridData } from '@vegaprotocol/utils'; import type { GetRowsParams } from '@vegaprotocol/ui-toolkit'; export const getRowId = ({ data }: { data: Position }) => data.marketId; diff --git a/libs/positions/src/lib/use-request-close-position-data.ts b/libs/positions/src/lib/use-request-close-position-data.ts index 8d4414334..fb47e5917 100644 --- a/libs/positions/src/lib/use-request-close-position-data.ts +++ b/libs/positions/src/lib/use-request-close-position-data.ts @@ -1,7 +1,7 @@ import { marketDataProvider, marketProvider } from '@vegaprotocol/market-list'; import { isOrderActive, ordersWithMarketProvider } from '@vegaprotocol/orders'; import type { OrdersQueryVariables } from '@vegaprotocol/orders'; -import { useDataProvider } from '@vegaprotocol/react-helpers'; +import { useDataProvider } from '@vegaprotocol/utils'; import { useMemo } from 'react'; export const useRequestClosePositionData = ( diff --git a/libs/react-helpers/src/lib/storage/local-storage.ts b/libs/react-helpers/src/hooks/use-local-storage.ts similarity index 72% rename from libs/react-helpers/src/lib/storage/local-storage.ts rename to libs/react-helpers/src/hooks/use-local-storage.ts index 5d0341b91..d542d08db 100644 --- a/libs/react-helpers/src/lib/storage/local-storage.ts +++ b/libs/react-helpers/src/hooks/use-local-storage.ts @@ -1,33 +1,5 @@ import { useCallback, useEffect, useMemo, useSyncExternalStore } from 'react'; - -export const LocalStorage = { - getItem: (key: string) => { - if (typeof window === 'undefined') return; - try { - const item = window.localStorage.getItem(key); - return item; - } catch (error) { - console.error(error); - return null; - } - }, - setItem: (key: string, value: string) => { - if (typeof window === 'undefined') return; - try { - window.localStorage.setItem(key, value); - } catch (error) { - console.error(error); - } - }, - removeItem: (key: string) => { - if (typeof window === 'undefined') return; - try { - window.localStorage.removeItem(key); - } catch (error) { - console.error(error); - } - }, -}; +import { LocalStorage } from '@vegaprotocol/utils'; type LocalStorageCallback = (key: string) => void; const LOCAL_STORAGE_CALLBACKS = new Set(); diff --git a/libs/react-helpers/src/hooks/use-logger.ts b/libs/react-helpers/src/hooks/use-logger.ts index fd9fc7eb8..f19227151 100644 --- a/libs/react-helpers/src/hooks/use-logger.ts +++ b/libs/react-helpers/src/hooks/use-logger.ts @@ -1,8 +1,8 @@ import { useRef } from 'react'; import { BrowserTracing } from '@sentry/tracing'; import * as Sentry from '@sentry/browser'; -import type { LocalLogger } from '../lib/local-logger'; -import { localLoggerFactory } from '../lib/local-logger'; +import type { LocalLogger } from '@vegaprotocol/utils'; +import { localLoggerFactory } from '@vegaprotocol/utils'; interface Props { dsn?: string; diff --git a/libs/react-helpers/src/hooks/use-theme-switcher.ts b/libs/react-helpers/src/hooks/use-theme-switcher.ts index 9778de0db..32882c91b 100644 --- a/libs/react-helpers/src/hooks/use-theme-switcher.ts +++ b/libs/react-helpers/src/hooks/use-theme-switcher.ts @@ -1,5 +1,5 @@ import { create } from 'zustand'; -import { LocalStorage } from '../lib/storage'; +import { LocalStorage } from '@vegaprotocol/utils'; const THEME_STORAGE_KEY = 'theme'; const Themes = { diff --git a/libs/react-helpers/src/lib/format/index.ts b/libs/react-helpers/src/lib/format/index.ts index 0aca8c478..3238b292c 100644 --- a/libs/react-helpers/src/lib/format/index.ts +++ b/libs/react-helpers/src/lib/format/index.ts @@ -1,5 +1 @@ -export * from './date'; export * from './number'; -export * from './size'; -export * from './strings'; -export * from './utils'; diff --git a/libs/react-helpers/src/lib/format/number.tsx b/libs/react-helpers/src/lib/format/number.tsx index 162a7fad6..af5bd6512 100644 --- a/libs/react-helpers/src/lib/format/number.tsx +++ b/libs/react-helpers/src/lib/format/number.tsx @@ -1,148 +1,18 @@ +import { useMemo } from 'react'; import { BigNumber } from 'bignumber.js'; -import { BigNumber as EthersBigNumber } from 'ethers'; -import isNil from 'lodash/isNil'; -import memoize from 'lodash/memoize'; -import React from 'react'; - -import { getUserLocale } from './utils'; - -const MIN_FRACTION_DIGITS = 2; -const MAX_FRACTION_DIGITS = 20; - -export function toDecimal(numberOfDecimals: number) { - return new BigNumber(1) - .dividedBy(Math.pow(10, numberOfDecimals)) - .toString(10); -} - -export function toBigNum( - rawValue: string | number | EthersBigNumber, - decimals: number -): BigNumber { - return new BigNumber( - rawValue instanceof EthersBigNumber ? rawValue.toString() : rawValue || 0 - ).dividedBy(Math.pow(10, decimals)); -} - -export function addDecimal( - value: string | number | EthersBigNumber, - decimals: number, - decimalPrecision = decimals -): string { - if (!decimals) return value.toString(); - if (!decimalPrecision || decimalPrecision < 0) { - return toBigNum(value, decimals).toFixed(0); - } - return toBigNum(value, decimals).toFixed(decimalPrecision); -} - -export function removeDecimal(value: string, decimals: number): string { - if (!decimals) return value; - return new BigNumber(value || 0).times(Math.pow(10, decimals)).toFixed(0); -} - -// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat -export const getNumberFormat = memoize((digits: number) => { - if (isNil(digits) || digits < 0) { - return new Intl.NumberFormat(getUserLocale()); - } - return new Intl.NumberFormat(getUserLocale(), { - minimumFractionDigits: Math.min(Math.max(0, digits), MIN_FRACTION_DIGITS), - maximumFractionDigits: Math.min(Math.max(0, digits), MAX_FRACTION_DIGITS), - }); -}); - -// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat -export const getFixedNumberFormat = memoize((digits: number) => { - if (isNil(digits) || digits < 0) { - return new Intl.NumberFormat(getUserLocale()); - } - return new Intl.NumberFormat(getUserLocale(), { - minimumFractionDigits: Math.min(Math.max(0, digits), MAX_FRACTION_DIGITS), - maximumFractionDigits: Math.min(Math.max(0, digits), MAX_FRACTION_DIGITS), - }); -}); - -export const getDecimalSeparator = memoize( - () => - getNumberFormat(1) - .formatToParts(1.1) - .find((part) => part.type === 'decimal')?.value -); - -/** formatNumber will format the number with fixed decimals - * @param rawValue - should be a number that is not outside the safe range fail as in https://mikemcl.github.io/bignumber.js/#toN - * @param formatDecimals - number of decimals to use - */ -export const formatNumber = ( - rawValue: string | number | BigNumber, - formatDecimals = 0 -) => { - return getNumberFormat(formatDecimals).format(Number(rawValue)); -}; - -/** formatNumberFixed will format the number with fixed decimals - * @param rawValue - should be a number that is not outside the safe range fail as in https://mikemcl.github.io/bignumber.js/#toN - * @param formatDecimals - number of decimals to use - */ -export const formatNumberFixed = ( - rawValue: string | number | BigNumber, - formatDecimals = 0 -) => { - return getFixedNumberFormat(formatDecimals).format(Number(rawValue)); -}; - -export const addDecimalsFormatNumber = ( - rawValue: string | number, - decimalPlaces: number, - formatDecimals: number = decimalPlaces -) => { - const x = addDecimal(rawValue, decimalPlaces); - - return formatNumber(x, formatDecimals); -}; - -export const addDecimalsFixedFormatNumber = ( - rawValue: string | number, - decimalPlaces: number, - formatDecimals: number = decimalPlaces -) => { - const x = addDecimal(rawValue, decimalPlaces); - - return formatNumberFixed(x, formatDecimals); -}; - -export const formatNumberPercentage = (value: BigNumber, decimals?: number) => { - const decimalPlaces = - typeof decimals === 'undefined' ? Math.max(value.dp() || 0, 2) : decimals; - return `${formatNumber(value, decimalPlaces)}%`; -}; - -export const toNumberParts = ( - value: BigNumber | null | undefined, - decimals = 18 -): [integers: string, decimalPlaces: string] => { - if (!value) { - return ['0', '0'.repeat(decimals)]; - } - const separator = getDecimalSeparator() || '.'; - const [integers, decimalsPlaces] = formatNumber(value, decimals) - .toString() - .split(separator); - return [integers, decimalsPlaces || '']; -}; +import { + getUserLocale, + toNumberParts, + formatNumber, +} from '@vegaprotocol/utils'; export const useNumberParts = ( value: BigNumber | null | undefined, decimals: number ): [integers: string, decimalPlaces: string] => { - return React.useMemo(() => toNumberParts(value, decimals), [decimals, value]); + return useMemo(() => toNumberParts(value, decimals), [decimals, value]); }; -export const isNumeric = ( - value?: string | number | BigNumber | bigint | null -): value is NonNullable => /^-?\d*\.?\d+$/.test(String(value)); - const INFINITY = '∞'; const DEFAULT_COMPACT_ABOVE = 1_000_000; const DEFAULT_COMPACT_CAP = new BigNumber(1e24); diff --git a/libs/react-helpers/src/lib/grid/date-range-filter.tsx b/libs/react-helpers/src/lib/grid/date-range-filter.tsx index 7c389f91e..3f038d56a 100644 --- a/libs/react-helpers/src/lib/grid/date-range-filter.tsx +++ b/libs/react-helpers/src/lib/grid/date-range-filter.tsx @@ -13,8 +13,7 @@ import { max, isValid, } from 'date-fns'; -import { t } from '../i18n'; -import { formatForInput } from '../format/date'; +import { t, formatForInput } from '@vegaprotocol/utils'; const defaultFilterValue: Schema.DateRange = {}; export interface DateRangeFilterProps extends IFilterParams { diff --git a/libs/react-helpers/src/lib/grid/index.ts b/libs/react-helpers/src/lib/grid/index.ts index a9aba6268..3b77813e7 100644 --- a/libs/react-helpers/src/lib/grid/index.ts +++ b/libs/react-helpers/src/lib/grid/index.ts @@ -1,4 +1,3 @@ -export * from './cell-class-rules'; export * from './cumulative-vol-cell'; export * from './flash-cell'; export * from './price-cell'; diff --git a/libs/react-helpers/src/lib/grid/set-filter.tsx b/libs/react-helpers/src/lib/grid/set-filter.tsx index a37d0dff3..75836b324 100644 --- a/libs/react-helpers/src/lib/grid/set-filter.tsx +++ b/libs/react-helpers/src/lib/grid/set-filter.tsx @@ -6,7 +6,7 @@ import React, { useState, } from 'react'; import type { IDoesFilterPassParams, IFilterParams } from 'ag-grid-community'; -import { t } from '../i18n'; +import { t } from '@vegaprotocol/utils'; export const SetFilter = forwardRef((props: IFilterParams, ref) => { const [value, setValue] = useState([]); diff --git a/libs/react-helpers/src/lib/index.ts b/libs/react-helpers/src/lib/index.ts index 4996f0bc9..a99ca8c5b 100644 --- a/libs/react-helpers/src/lib/index.ts +++ b/libs/react-helpers/src/lib/index.ts @@ -1,22 +1,6 @@ export * from './__generated__/ChainId'; export * from './ag-grid-update'; -export * from './apollo-client'; export * from './data-grid'; export * from './format'; -export * from './generic-data-provider'; -export * from './get-events'; -export * from './get-nodes'; export * from './grid'; -export * from './i18n'; -export * from './is-asset-erc20'; -export * from './is-valid-url'; -export * from './links'; -export * from './local-logger'; export * from './market-expires'; -export * from './pagination'; -export * from './remove-0x'; -export * from './remove-pagination-wrapper'; -export * from './storage'; -export * from './time'; -export * from './validate'; -export * from './flag-emoji'; diff --git a/libs/react-helpers/src/lib/links/index.ts b/libs/react-helpers/src/lib/links/index.ts deleted file mode 100644 index 26f360af9..000000000 --- a/libs/react-helpers/src/lib/links/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './links'; diff --git a/libs/react-helpers/src/lib/market-expires.tsx b/libs/react-helpers/src/lib/market-expires.tsx index c4b97b564..60f4950e1 100644 --- a/libs/react-helpers/src/lib/market-expires.tsx +++ b/libs/react-helpers/src/lib/market-expires.tsx @@ -1,67 +1,4 @@ -import { t } from './i18n'; -import { getDateTimeFormat } from './format'; -import { isValid, parseISO } from 'date-fns'; -import { MarketState } from '@vegaprotocol/types'; - -export const getMarketExpiryDate = ( - tags?: ReadonlyArray | null -): Date | null => { - if (tags) { - const dateFound = tags.reduce((agg, tag) => { - const parsed = parseISO( - (tag.match(/^settlement.*:/) && - tag - .split(':') - .filter((item, i) => i) - .join(':')) as string - ); - if (isValid(parsed)) { - agg = parsed; - } - return agg; - }, null); - return dateFound; - } - return null; -}; - -export const getMarketExpiryDateFormatted = ( - tags?: ReadonlyArray | null -): string | null => { - if (tags) { - const dateFound = getMarketExpiryDate(tags); - return dateFound ? getDateTimeFormat().format(dateFound) : null; - } - return null; -}; - -export const getExpiryDate = ( - tags: ReadonlyArray | null, - close: string | null, - state: MarketState -): string => { - const metadataExpiryDate = getMarketExpiryDate(tags); - const marketTimestampCloseDate = close && new Date(close); - let content = null; - if (!metadataExpiryDate) { - content = marketTimestampCloseDate - ? `Expired on ${getDateTimeFormat().format(marketTimestampCloseDate)}` - : t('Not time-based'); - } else { - const isExpired = - Date.now() - metadataExpiryDate.valueOf() > 0 && - (state === MarketState.STATE_TRADING_TERMINATED || - state === MarketState.STATE_SETTLED); - if (isExpired) { - content = marketTimestampCloseDate - ? `Expired on ${getDateTimeFormat().format(marketTimestampCloseDate)}` - : t('Expired'); - } else { - content = getDateTimeFormat().format(metadataExpiryDate); - } - } - return content; -}; +import { getMarketExpiryDateFormatted } from '@vegaprotocol/utils'; export const MarketExpires = ({ tags, diff --git a/libs/react-helpers/src/lib/storage/index.ts b/libs/react-helpers/src/lib/storage/index.ts deleted file mode 100644 index 72dd18f3d..000000000 --- a/libs/react-helpers/src/lib/storage/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './local-storage'; diff --git a/libs/react-helpers/tsconfig.lib.json b/libs/react-helpers/tsconfig.lib.json index b2447df1e..ce2a0250c 100644 --- a/libs/react-helpers/tsconfig.lib.json +++ b/libs/react-helpers/tsconfig.lib.json @@ -19,5 +19,30 @@ "**/*.test.jsx", "jest.config.ts" ], - "include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"] + "include": [ + "**/*.js", + "**/*.jsx", + "**/*.ts", + "**/*.tsx", + "../utils/src/lib/is-valid-url.ts", + "../utils/src/lib/i18n.ts", + "../utils/src/lib/remove-pagination-wrapper.ts", + "../utils/src/lib/is-asset-erc20.ts", + "../utils/src/lib/remove-0x.ts", + "../utils/src/lib/local-logger.ts", + "../utils/src/lib/generic-data-provider.spec.ts", + "../utils/src/lib/apollo-client.ts", + "../utils/src/lib/local-storage.ts", + "../utils/src/lib/links.ts", + "../utils/src/lib/format/date.ts", + "../utils/src/lib/format/strings.ts", + "../utils/src/lib/format/strings.spec.ts", + "../utils/src/lib/format/size.ts", + "../utils/src/lib/format/utils.ts", + "../utils/src/lib/get-nodes.ts", + "../utils/src/lib/pagination.ts", + "../utils/src/lib/time.ts", + "../ui-toolkit/src/utils/cell-class-rules.ts", + "../utils/src/lib/flag-emoji.spec.ts" + ] } diff --git a/libs/react-helpers/tsconfig.spec.json b/libs/react-helpers/tsconfig.spec.json index 3da863401..23dbaf161 100644 --- a/libs/react-helpers/tsconfig.spec.json +++ b/libs/react-helpers/tsconfig.spec.json @@ -15,6 +15,9 @@ "**/*.test.jsx", "**/*.spec.jsx", "**/*.d.ts", - "jest.config.ts" + "jest.config.ts", + "../utils/src/lib/generic-data-provider.spec.ts", + "../utils/src/lib/format/strings.spec.ts", + "../utils/src/lib/flag-emoji.spec.ts" ] } diff --git a/libs/trades/src/lib/trades-container.tsx b/libs/trades/src/lib/trades-container.tsx index 22e119d6b..8f040f4b7 100644 --- a/libs/trades/src/lib/trades-container.tsx +++ b/libs/trades/src/lib/trades-container.tsx @@ -1,7 +1,7 @@ import { useDataProvider, makeInfiniteScrollGetRows, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import { AsyncRenderer } from '@vegaprotocol/ui-toolkit'; import type { AgGridReact } from 'ag-grid-react'; import { useCallback, useMemo, useRef } from 'react'; diff --git a/libs/trades/src/lib/trades-data-provider.ts b/libs/trades/src/lib/trades-data-provider.ts index 13ae7a1a2..e66237185 100644 --- a/libs/trades/src/lib/trades-data-provider.ts +++ b/libs/trades/src/lib/trades-data-provider.ts @@ -4,8 +4,8 @@ import { defaultAppend as append, paginatedCombineDelta as combineDelta, paginatedCombineInsertionData as combineInsertionData, -} from '@vegaprotocol/react-helpers'; -import type { PageInfo, Edge } from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; +import type { PageInfo, Edge } from '@vegaprotocol/utils'; import type { Market } from '@vegaprotocol/market-list'; import { marketsProvider } from '@vegaprotocol/market-list'; import type { diff --git a/libs/trades/src/lib/trades-table.spec.tsx b/libs/trades/src/lib/trades-table.spec.tsx index b50f61271..60380db6a 100644 --- a/libs/trades/src/lib/trades-table.spec.tsx +++ b/libs/trades/src/lib/trades-table.spec.tsx @@ -1,5 +1,5 @@ import { act, render, screen } from '@testing-library/react'; -import { getDateTimeFormat } from '@vegaprotocol/react-helpers'; +import { getDateTimeFormat } from '@vegaprotocol/utils'; import { SELL_CLASS, TradesTable, BUY_CLASS } from './trades-table'; import type { Trade } from './trades-data-provider'; import { Side } from '@vegaprotocol/types'; diff --git a/libs/trades/src/lib/trades-table.tsx b/libs/trades/src/lib/trades-table.tsx index 1acdd1882..a738429dc 100644 --- a/libs/trades/src/lib/trades-table.tsx +++ b/libs/trades/src/lib/trades-table.tsx @@ -12,7 +12,7 @@ import { getDateTimeFormat, NumericCell, t, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import type { IDatasource, IGetRowsParams } from 'ag-grid-community'; import type { CellClassParams } from 'ag-grid-community'; import type { AgGridReactProps } from 'ag-grid-react'; diff --git a/libs/ui-toolkit/.storybook/preview.js b/libs/ui-toolkit/.storybook/preview.js index 59e6d1d77..c7f808a90 100644 --- a/libs/ui-toolkit/.storybook/preview.js +++ b/libs/ui-toolkit/.storybook/preview.js @@ -1,4 +1,4 @@ -import { useThemeSwitcher } from '@vegaprotocol/react-helpers'; +import { useThemeSwitcher } from '@vegaprotocol/utils'; import classNames from 'classnames'; import { useEffect } from 'react'; import '../src/styles.css'; diff --git a/libs/ui-toolkit/src/components/ag-grid/ag-grid-dynamic-themed.tsx b/libs/ui-toolkit/src/components/ag-grid/ag-grid-dynamic-themed.tsx index 621d596a7..d15d1c05c 100644 --- a/libs/ui-toolkit/src/components/ag-grid/ag-grid-dynamic-themed.tsx +++ b/libs/ui-toolkit/src/components/ag-grid/ag-grid-dynamic-themed.tsx @@ -2,7 +2,7 @@ import type { ReactNode, FunctionComponent } from 'react'; import dynamic from 'next/dynamic'; import type { AgGridReactProps, AgReactUiProps } from 'ag-grid-react'; import { AgGridReact } from 'ag-grid-react'; -import { useThemeSwitcher } from '@vegaprotocol/react-helpers'; +import { useThemeSwitcher } from '@vegaprotocol/utils'; import 'ag-grid-community/dist/styles/ag-grid.css'; interface GridProps { diff --git a/libs/ui-toolkit/src/components/ag-grid/ag-grid-lazy-themed.tsx b/libs/ui-toolkit/src/components/ag-grid/ag-grid-lazy-themed.tsx index 40b27c308..cae9c3012 100644 --- a/libs/ui-toolkit/src/components/ag-grid/ag-grid-lazy-themed.tsx +++ b/libs/ui-toolkit/src/components/ag-grid/ag-grid-lazy-themed.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import type { AgGridReactProps, AgReactUiProps } from 'ag-grid-react'; import { AgGridReact } from 'ag-grid-react'; -import { useThemeSwitcher } from '@vegaprotocol/react-helpers'; +import { useThemeSwitcher } from '@vegaprotocol/utils'; import 'ag-grid-community/dist/styles/ag-grid.css'; const AgGridLightTheme = React.lazy(() => diff --git a/libs/ui-toolkit/src/components/async-renderer/async-renderer.tsx b/libs/ui-toolkit/src/components/async-renderer/async-renderer.tsx index 75da83586..c8a7f3f1d 100644 --- a/libs/ui-toolkit/src/components/async-renderer/async-renderer.tsx +++ b/libs/ui-toolkit/src/components/async-renderer/async-renderer.tsx @@ -1,6 +1,6 @@ import { Splash } from '../splash'; import type { ReactNode } from 'react'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { Button } from '../button'; interface AsyncRendererProps { diff --git a/libs/ui-toolkit/src/components/maintenance-page/maintenance-page.tsx b/libs/ui-toolkit/src/components/maintenance-page/maintenance-page.tsx index 59e102d54..6c1f244c2 100644 --- a/libs/ui-toolkit/src/components/maintenance-page/maintenance-page.tsx +++ b/libs/ui-toolkit/src/components/maintenance-page/maintenance-page.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { ExternalLink } from '../link'; import { BackgroundVideo } from '../background-video'; diff --git a/libs/ui-toolkit/src/components/price-change/price-change-cell.tsx b/libs/ui-toolkit/src/components/price-change/price-change-cell.tsx index dbda4080b..d96d68872 100644 --- a/libs/ui-toolkit/src/components/price-change/price-change-cell.tsx +++ b/libs/ui-toolkit/src/components/price-change/price-change-cell.tsx @@ -1,10 +1,10 @@ import { addDecimalsFormatNumber, formatNumberPercentage, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import BigNumber from 'bignumber.js'; import { memo, forwardRef } from 'react'; -import { signedNumberCssClass } from '@vegaprotocol/react-helpers'; +import { signedNumberCssClass } from '@vegaprotocol/utils'; import { Arrow } from '../arrows/arrow'; export interface PriceChangeCellProps { diff --git a/libs/ui-toolkit/src/components/theme-switcher/theme-switcher.tsx b/libs/ui-toolkit/src/components/theme-switcher/theme-switcher.tsx index 6e377c046..5d892a5f0 100644 --- a/libs/ui-toolkit/src/components/theme-switcher/theme-switcher.tsx +++ b/libs/ui-toolkit/src/components/theme-switcher/theme-switcher.tsx @@ -1,4 +1,4 @@ -import { useThemeSwitcher, t } from '@vegaprotocol/react-helpers'; +import { useThemeSwitcher, t } from '@vegaprotocol/utils'; import { SunIcon, MoonIcon } from './icons'; import { Toggle } from '../toggle'; diff --git a/libs/ui-toolkit/src/components/toast/toasts-container.stories.tsx b/libs/ui-toolkit/src/components/toast/toasts-container.stories.tsx index 8ab25f0e3..1c1f704fd 100644 --- a/libs/ui-toolkit/src/components/toast/toasts-container.stories.tsx +++ b/libs/ui-toolkit/src/components/toast/toasts-container.stories.tsx @@ -10,7 +10,7 @@ import uniqueId from 'lodash/uniqueId'; import { useToasts } from './use-toasts'; import { create } from 'zustand'; import { useEffect } from '@storybook/addons'; -import { formatNumber } from '@vegaprotocol/react-helpers'; +import { formatNumber } from '@vegaprotocol/utils'; export default { title: 'ToastContainer', diff --git a/libs/ui-toolkit/src/components/toast/toasts-container.tsx b/libs/ui-toolkit/src/components/toast/toasts-container.tsx index e4a022d70..3b89fd715 100644 --- a/libs/ui-toolkit/src/components/toast/toasts-container.tsx +++ b/libs/ui-toolkit/src/components/toast/toasts-container.tsx @@ -1,4 +1,4 @@ -import { t, usePrevious } from '@vegaprotocol/react-helpers'; +import { t, usePrevious } from '@vegaprotocol/utils'; import classNames from 'classnames'; import type { Ref } from 'react'; import { useLayoutEffect, useRef } from 'react'; diff --git a/libs/ui-toolkit/src/components/vega-logo/vega-logo.tsx b/libs/ui-toolkit/src/components/vega-logo/vega-logo.tsx index 991788d99..6a12b4fd3 100644 --- a/libs/ui-toolkit/src/components/vega-logo/vega-logo.tsx +++ b/libs/ui-toolkit/src/components/vega-logo/vega-logo.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; export const VegaLogo = () => { return ( diff --git a/libs/ui-toolkit/src/components/viewing-as-user/index.tsx b/libs/ui-toolkit/src/components/viewing-as-user/index.tsx index 30878be44..d5b222ef7 100644 --- a/libs/ui-toolkit/src/components/viewing-as-user/index.tsx +++ b/libs/ui-toolkit/src/components/viewing-as-user/index.tsx @@ -1,6 +1,6 @@ import { Button } from '../button'; import React from 'react'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; export function truncateMiddle(address: string) { if (address.length < 11) return address; diff --git a/libs/ui-toolkit/src/index.ts b/libs/ui-toolkit/src/index.ts index f9734ad0c..e90e3978b 100644 --- a/libs/ui-toolkit/src/index.ts +++ b/libs/ui-toolkit/src/index.ts @@ -3,5 +3,6 @@ export * from './components'; // Utils export * from './utils/intent'; +export * from './utils/cell-class-rules'; export * from './primitives/typography.stories'; diff --git a/libs/react-helpers/src/lib/grid/cell-class-rules.ts b/libs/ui-toolkit/src/utils/cell-class-rules.ts similarity index 100% rename from libs/react-helpers/src/lib/grid/cell-class-rules.ts rename to libs/ui-toolkit/src/utils/cell-class-rules.ts diff --git a/libs/utils/.babelrc b/libs/utils/.babelrc new file mode 100644 index 000000000..e24a5465f --- /dev/null +++ b/libs/utils/.babelrc @@ -0,0 +1,10 @@ +{ + "presets": [ + [ + "@nrwl/web/babel", + { + "useBuiltIns": "usage" + } + ] + ] +} diff --git a/libs/utils/.eslintrc.json b/libs/utils/.eslintrc.json new file mode 100644 index 000000000..9d9c0db55 --- /dev/null +++ b/libs/utils/.eslintrc.json @@ -0,0 +1,18 @@ +{ + "extends": ["../../.eslintrc.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], + "rules": {} + }, + { + "files": ["*.ts", "*.tsx"], + "rules": {} + }, + { + "files": ["*.js", "*.jsx"], + "rules": {} + } + ] +} diff --git a/libs/utils/README.md b/libs/utils/README.md new file mode 100644 index 000000000..ad4ba3d0e --- /dev/null +++ b/libs/utils/README.md @@ -0,0 +1,11 @@ +# utils + +This library was generated with [Nx](https://nx.dev). + +## Building + +Run `nx build utils` to build the library. + +## Running unit tests + +Run `nx test utils` to execute the unit tests via [Jest](https://jestjs.io). diff --git a/libs/utils/jest.config.ts b/libs/utils/jest.config.ts new file mode 100644 index 000000000..69e6c23eb --- /dev/null +++ b/libs/utils/jest.config.ts @@ -0,0 +1,15 @@ +/* eslint-disable */ +export default { + displayName: 'utils', + preset: '../../jest.preset.js', + globals: { + 'ts-jest': { + tsconfig: '/tsconfig.spec.json', + }, + }, + transform: { + '^.+\\.[tj]s$': 'ts-jest', + }, + moduleFileExtensions: ['ts', 'js', 'html'], + coverageDirectory: '../../coverage/libs/utils', +}; diff --git a/libs/utils/package.json b/libs/utils/package.json new file mode 100644 index 000000000..f614fd229 --- /dev/null +++ b/libs/utils/package.json @@ -0,0 +1,5 @@ +{ + "name": "@vegaprotocol/utils", + "version": "0.0.1", + "type": "commonjs" +} diff --git a/libs/utils/project.json b/libs/utils/project.json new file mode 100644 index 000000000..cc8a09255 --- /dev/null +++ b/libs/utils/project.json @@ -0,0 +1,45 @@ +{ + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "libs/utils/src", + "projectType": "library", + "targets": { + "build": { + "executor": "@nrwl/js:tsc", + "outputs": ["{options.outputPath}"], + "options": { + "outputPath": "dist/libs/utils", + "main": "libs/utils/src/index.ts", + "tsConfig": "libs/utils/tsconfig.lib.json", + "assets": ["libs/utils/*.md"] + } + }, + "publish": { + "executor": "@nrwl/workspace:run-commands", + "options": { + "command": "node tools/scripts/publish.mjs utils {args.ver} {args.tag}" + }, + "dependsOn": [ + { + "projects": "self", + "target": "build" + } + ] + }, + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["libs/utils/**/*.ts"] + } + }, + "test": { + "executor": "@nrwl/jest:jest", + "outputs": ["coverage/libs/utils"], + "options": { + "jestConfig": "libs/utils/jest.config.ts", + "passWithNoTests": true + } + } + }, + "tags": [] +} diff --git a/libs/utils/src/index.ts b/libs/utils/src/index.ts new file mode 100644 index 000000000..e49676d57 --- /dev/null +++ b/libs/utils/src/index.ts @@ -0,0 +1,19 @@ +export * from './lib/apollo-client'; +export * from './lib/flag-emoji'; +export * from './lib/format'; +export * from './lib/generic-data-provider'; +export * from './lib/get-events'; +export * from './lib/get-nodes'; +export * from './lib/get-user-locale'; +export * from './lib/i18n'; +export * from './lib/is-asset-erc20'; +export * from './lib/is-valid-url'; +export * from './lib/links'; +export * from './lib/local-logger'; +export * from './lib/local-storage'; +export * from './lib/markets'; +export * from './lib/pagination'; +export * from './lib/remove-0x'; +export * from './lib/remove-pagination-wrapper'; +export * from './lib/time'; +export * from './lib/validate'; diff --git a/libs/react-helpers/src/lib/apollo-client.ts b/libs/utils/src/lib/apollo-client.ts similarity index 100% rename from libs/react-helpers/src/lib/apollo-client.ts rename to libs/utils/src/lib/apollo-client.ts diff --git a/libs/react-helpers/src/lib/flag-emoji.spec.ts b/libs/utils/src/lib/flag-emoji.spec.ts similarity index 100% rename from libs/react-helpers/src/lib/flag-emoji.spec.ts rename to libs/utils/src/lib/flag-emoji.spec.ts diff --git a/libs/react-helpers/src/lib/flag-emoji.ts b/libs/utils/src/lib/flag-emoji.ts similarity index 100% rename from libs/react-helpers/src/lib/flag-emoji.ts rename to libs/utils/src/lib/flag-emoji.ts diff --git a/libs/react-helpers/src/lib/format/date.ts b/libs/utils/src/lib/format/date.ts similarity index 96% rename from libs/react-helpers/src/lib/format/date.ts rename to libs/utils/src/lib/format/date.ts index 3bc6c39da..151d34410 100644 --- a/libs/react-helpers/src/lib/format/date.ts +++ b/libs/utils/src/lib/format/date.ts @@ -1,5 +1,5 @@ import once from 'lodash/once'; -import { getUserLocale } from './utils'; +import { getUserLocale } from '../get-user-locale'; export const isValidDate = (date: Date) => date instanceof Date && !isNaN(date.getTime()); diff --git a/libs/utils/src/lib/format/index.ts b/libs/utils/src/lib/format/index.ts new file mode 100644 index 000000000..fefb8320f --- /dev/null +++ b/libs/utils/src/lib/format/index.ts @@ -0,0 +1,4 @@ +export * from './date'; +export * from './number'; +export * from './size'; +export * from './strings'; diff --git a/libs/utils/src/lib/format/number.ts b/libs/utils/src/lib/format/number.ts new file mode 100644 index 000000000..ddcf0b9b8 --- /dev/null +++ b/libs/utils/src/lib/format/number.ts @@ -0,0 +1,136 @@ +import { BigNumber } from 'bignumber.js'; +import { BigNumber as EthersBigNumber } from 'ethers'; +import isNil from 'lodash/isNil'; +import memoize from 'lodash/memoize'; + +import { getUserLocale } from '../get-user-locale'; + +const MIN_FRACTION_DIGITS = 2; +const MAX_FRACTION_DIGITS = 20; + +export function toDecimal(numberOfDecimals: number) { + return new BigNumber(1) + .dividedBy(Math.pow(10, numberOfDecimals)) + .toString(10); +} + +export function toBigNum( + rawValue: string | number | EthersBigNumber, + decimals: number +): BigNumber { + return new BigNumber( + rawValue instanceof EthersBigNumber ? rawValue.toString() : rawValue || 0 + ).dividedBy(Math.pow(10, decimals)); +} + +export function addDecimal( + value: string | number | EthersBigNumber, + decimals: number, + decimalPrecision = decimals +): string { + if (!decimals) return value.toString(); + if (!decimalPrecision || decimalPrecision < 0) { + return toBigNum(value, decimals).toFixed(0); + } + return toBigNum(value, decimals).toFixed(decimalPrecision); +} + +export function removeDecimal(value: string, decimals: number): string { + if (!decimals) return value; + return new BigNumber(value || 0).times(Math.pow(10, decimals)).toFixed(0); +} + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat +export const getNumberFormat = memoize((digits: number) => { + if (isNil(digits) || digits < 0) { + return new Intl.NumberFormat(getUserLocale()); + } + return new Intl.NumberFormat(getUserLocale(), { + minimumFractionDigits: Math.min(Math.max(0, digits), MIN_FRACTION_DIGITS), + maximumFractionDigits: Math.min(Math.max(0, digits), MAX_FRACTION_DIGITS), + }); +}); + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat +export const getFixedNumberFormat = memoize((digits: number) => { + if (isNil(digits) || digits < 0) { + return new Intl.NumberFormat(getUserLocale()); + } + return new Intl.NumberFormat(getUserLocale(), { + minimumFractionDigits: Math.min(Math.max(0, digits), MAX_FRACTION_DIGITS), + maximumFractionDigits: Math.min(Math.max(0, digits), MAX_FRACTION_DIGITS), + }); +}); + +export const getDecimalSeparator = memoize( + () => + getNumberFormat(1) + .formatToParts(1.1) + .find((part) => part.type === 'decimal')?.value +); + +/** formatNumber will format the number with fixed decimals + * @param rawValue - should be a number that is not outside the safe range fail as in https://mikemcl.github.io/bignumber.js/#toN + * @param formatDecimals - number of decimals to use + */ +export const formatNumber = ( + rawValue: string | number | BigNumber, + formatDecimals = 0 +) => { + return getNumberFormat(formatDecimals).format(Number(rawValue)); +}; + +/** formatNumberFixed will format the number with fixed decimals + * @param rawValue - should be a number that is not outside the safe range fail as in https://mikemcl.github.io/bignumber.js/#toN + * @param formatDecimals - number of decimals to use + */ +export const formatNumberFixed = ( + rawValue: string | number | BigNumber, + formatDecimals = 0 +) => { + return getFixedNumberFormat(formatDecimals).format(Number(rawValue)); +}; + +export const addDecimalsFormatNumber = ( + rawValue: string | number, + decimalPlaces: number, + formatDecimals: number = decimalPlaces +) => { + const x = addDecimal(rawValue, decimalPlaces); + + return formatNumber(x, formatDecimals); +}; + +export const addDecimalsFixedFormatNumber = ( + rawValue: string | number, + decimalPlaces: number, + formatDecimals: number = decimalPlaces +) => { + const x = addDecimal(rawValue, decimalPlaces); + + return formatNumberFixed(x, formatDecimals); +}; + +export const formatNumberPercentage = (value: BigNumber, decimals?: number) => { + const decimalPlaces = + typeof decimals === 'undefined' ? Math.max(value.dp() || 0, 2) : decimals; + return `${formatNumber(value, decimalPlaces)}%`; +}; + +export const toNumberParts = ( + value: BigNumber | null | undefined, + decimals = 18 +): [integers: string, decimalPlaces: string] => { + if (!value) { + return ['0', '0'.repeat(decimals)]; + } + const separator = getDecimalSeparator() || '.'; + const [integers, decimalsPlaces] = formatNumber(value, decimals) + .toString() + .split(separator); + return [integers, decimalsPlaces || '']; +}; + +export const isNumeric = ( + value?: string | number | BigNumber | bigint | null +): value is NonNullable => /^-?\d*\.?\d+$/.test(String(value)); diff --git a/libs/react-helpers/src/lib/format/size.ts b/libs/utils/src/lib/format/size.ts similarity index 100% rename from libs/react-helpers/src/lib/format/size.ts rename to libs/utils/src/lib/format/size.ts diff --git a/libs/react-helpers/src/lib/format/strings.spec.ts b/libs/utils/src/lib/format/strings.spec.ts similarity index 100% rename from libs/react-helpers/src/lib/format/strings.spec.ts rename to libs/utils/src/lib/format/strings.spec.ts diff --git a/libs/react-helpers/src/lib/format/strings.ts b/libs/utils/src/lib/format/strings.ts similarity index 100% rename from libs/react-helpers/src/lib/format/strings.ts rename to libs/utils/src/lib/format/strings.ts diff --git a/libs/react-helpers/src/lib/format/utils.ts b/libs/utils/src/lib/format/utils.ts similarity index 85% rename from libs/react-helpers/src/lib/format/utils.ts rename to libs/utils/src/lib/format/utils.ts index f6e3a072b..1ee1ac777 100644 --- a/libs/react-helpers/src/lib/format/utils.ts +++ b/libs/utils/src/lib/format/utils.ts @@ -1,8 +1,6 @@ import capitalize from 'lodash/capitalize'; import startCase from 'lodash/startCase'; -export const getUserLocale = () => 'default'; - export const splitAt = (index: number) => (x: string) => [x.slice(0, index), x.slice(index)]; diff --git a/libs/react-helpers/src/lib/generic-data-provider.spec.ts b/libs/utils/src/lib/generic-data-provider.spec.ts similarity index 100% rename from libs/react-helpers/src/lib/generic-data-provider.spec.ts rename to libs/utils/src/lib/generic-data-provider.spec.ts diff --git a/libs/react-helpers/src/lib/generic-data-provider.ts b/libs/utils/src/lib/generic-data-provider.ts similarity index 100% rename from libs/react-helpers/src/lib/generic-data-provider.ts rename to libs/utils/src/lib/generic-data-provider.ts diff --git a/libs/react-helpers/src/lib/get-events.ts b/libs/utils/src/lib/get-events.ts similarity index 100% rename from libs/react-helpers/src/lib/get-events.ts rename to libs/utils/src/lib/get-events.ts diff --git a/libs/react-helpers/src/lib/get-nodes.ts b/libs/utils/src/lib/get-nodes.ts similarity index 100% rename from libs/react-helpers/src/lib/get-nodes.ts rename to libs/utils/src/lib/get-nodes.ts diff --git a/libs/utils/src/lib/get-user-locale.ts b/libs/utils/src/lib/get-user-locale.ts new file mode 100644 index 000000000..1aca59ecf --- /dev/null +++ b/libs/utils/src/lib/get-user-locale.ts @@ -0,0 +1 @@ +export const getUserLocale = () => 'default'; diff --git a/libs/react-helpers/src/lib/i18n.ts b/libs/utils/src/lib/i18n.ts similarity index 100% rename from libs/react-helpers/src/lib/i18n.ts rename to libs/utils/src/lib/i18n.ts diff --git a/libs/react-helpers/src/lib/is-asset-erc20.ts b/libs/utils/src/lib/is-asset-erc20.ts similarity index 100% rename from libs/react-helpers/src/lib/is-asset-erc20.ts rename to libs/utils/src/lib/is-asset-erc20.ts diff --git a/libs/react-helpers/src/lib/is-valid-url.ts b/libs/utils/src/lib/is-valid-url.ts similarity index 100% rename from libs/react-helpers/src/lib/is-valid-url.ts rename to libs/utils/src/lib/is-valid-url.ts diff --git a/libs/react-helpers/src/lib/links/links.ts b/libs/utils/src/lib/links.ts similarity index 100% rename from libs/react-helpers/src/lib/links/links.ts rename to libs/utils/src/lib/links.ts diff --git a/libs/react-helpers/src/lib/local-logger.spec.ts b/libs/utils/src/lib/local-logger.spec.ts similarity index 100% rename from libs/react-helpers/src/lib/local-logger.spec.ts rename to libs/utils/src/lib/local-logger.spec.ts diff --git a/libs/react-helpers/src/lib/local-logger.ts b/libs/utils/src/lib/local-logger.ts similarity index 100% rename from libs/react-helpers/src/lib/local-logger.ts rename to libs/utils/src/lib/local-logger.ts diff --git a/libs/react-helpers/src/lib/storage/local-storage.spec.ts b/libs/utils/src/lib/local-storage.spec.ts similarity index 100% rename from libs/react-helpers/src/lib/storage/local-storage.spec.ts rename to libs/utils/src/lib/local-storage.spec.ts diff --git a/libs/utils/src/lib/local-storage.ts b/libs/utils/src/lib/local-storage.ts new file mode 100644 index 000000000..cf547d14c --- /dev/null +++ b/libs/utils/src/lib/local-storage.ts @@ -0,0 +1,28 @@ +export const LocalStorage = { + getItem: (key: string) => { + if (typeof window === 'undefined') return; + try { + const item = window.localStorage.getItem(key); + return item; + } catch (error) { + console.error(error); + return null; + } + }, + setItem: (key: string, value: string) => { + if (typeof window === 'undefined') return; + try { + window.localStorage.setItem(key, value); + } catch (error) { + console.error(error); + } + }, + removeItem: (key: string) => { + if (typeof window === 'undefined') return; + try { + window.localStorage.removeItem(key); + } catch (error) { + console.error(error); + } + }, +}; diff --git a/libs/utils/src/lib/markets.ts b/libs/utils/src/lib/markets.ts new file mode 100644 index 000000000..dbb558428 --- /dev/null +++ b/libs/utils/src/lib/markets.ts @@ -0,0 +1,64 @@ +import { MarketState } from '@vegaprotocol/types'; +import { isValid, parseISO } from 'date-fns'; +import { getDateTimeFormat } from './format'; +import { t } from './i18n'; + +export const getMarketExpiryDate = ( + tags?: ReadonlyArray | null +): Date | null => { + if (tags) { + const dateFound = tags.reduce((agg, tag) => { + const parsed = parseISO( + (tag.match(/^settlement.*:/) && + tag + .split(':') + .filter((item, i) => i) + .join(':')) as string + ); + if (isValid(parsed)) { + agg = parsed; + } + return agg; + }, null); + return dateFound; + } + return null; +}; + +export const getMarketExpiryDateFormatted = ( + tags?: ReadonlyArray | null +): string | null => { + if (tags) { + const dateFound = getMarketExpiryDate(tags); + return dateFound ? getDateTimeFormat().format(dateFound) : null; + } + return null; +}; + +export const getExpiryDate = ( + tags: ReadonlyArray | null, + close: string | null, + state: MarketState +): string => { + const metadataExpiryDate = getMarketExpiryDate(tags); + const marketTimestampCloseDate = close && new Date(close); + let content = null; + if (!metadataExpiryDate) { + content = marketTimestampCloseDate + ? `Expired on ${getDateTimeFormat().format(marketTimestampCloseDate)}` + : t('Not time-based'); + } else { + const isExpired = + Date.now() - metadataExpiryDate.valueOf() > 0 && + (state === MarketState.STATE_TRADING_TERMINATED || + state === MarketState.STATE_SETTLED); + if (isExpired) { + content = marketTimestampCloseDate + ? `Expired on ${getDateTimeFormat().format(marketTimestampCloseDate)}` + : t('Expired'); + } else { + content = getDateTimeFormat().format(metadataExpiryDate); + } + } + return content; +}; diff --git a/libs/react-helpers/src/lib/pagination.ts b/libs/utils/src/lib/pagination.ts similarity index 100% rename from libs/react-helpers/src/lib/pagination.ts rename to libs/utils/src/lib/pagination.ts diff --git a/libs/react-helpers/src/lib/remove-0x.spec.ts b/libs/utils/src/lib/remove-0x.spec.ts similarity index 100% rename from libs/react-helpers/src/lib/remove-0x.spec.ts rename to libs/utils/src/lib/remove-0x.spec.ts diff --git a/libs/react-helpers/src/lib/remove-0x.ts b/libs/utils/src/lib/remove-0x.ts similarity index 100% rename from libs/react-helpers/src/lib/remove-0x.ts rename to libs/utils/src/lib/remove-0x.ts diff --git a/libs/react-helpers/src/lib/remove-pagination-wrapper.spec.ts b/libs/utils/src/lib/remove-pagination-wrapper.spec.ts similarity index 100% rename from libs/react-helpers/src/lib/remove-pagination-wrapper.spec.ts rename to libs/utils/src/lib/remove-pagination-wrapper.spec.ts diff --git a/libs/react-helpers/src/lib/remove-pagination-wrapper.ts b/libs/utils/src/lib/remove-pagination-wrapper.ts similarity index 100% rename from libs/react-helpers/src/lib/remove-pagination-wrapper.ts rename to libs/utils/src/lib/remove-pagination-wrapper.ts diff --git a/libs/react-helpers/src/lib/time.spec.ts b/libs/utils/src/lib/time.spec.ts similarity index 100% rename from libs/react-helpers/src/lib/time.spec.ts rename to libs/utils/src/lib/time.spec.ts diff --git a/libs/react-helpers/src/lib/time.ts b/libs/utils/src/lib/time.ts similarity index 100% rename from libs/react-helpers/src/lib/time.ts rename to libs/utils/src/lib/time.ts diff --git a/libs/react-helpers/src/lib/validate/common.ts b/libs/utils/src/lib/validate/common.ts similarity index 96% rename from libs/react-helpers/src/lib/validate/common.ts rename to libs/utils/src/lib/validate/common.ts index acbdeb957..9a87d44c9 100644 --- a/libs/react-helpers/src/lib/validate/common.ts +++ b/libs/utils/src/lib/validate/common.ts @@ -1,6 +1,6 @@ import BigNumber from 'bignumber.js'; import { ethers } from 'ethers'; -import { t } from '../i18n'; +import { t } from '../../../../utils/src/lib/i18n'; export const required = (value: string) => { if (value === null || value === undefined || value === '') { diff --git a/libs/react-helpers/src/lib/validate/index.ts b/libs/utils/src/lib/validate/index.ts similarity index 100% rename from libs/react-helpers/src/lib/validate/index.ts rename to libs/utils/src/lib/validate/index.ts diff --git a/libs/react-helpers/src/lib/validate/validate-amount.ts b/libs/utils/src/lib/validate/validate-amount.ts similarity index 90% rename from libs/react-helpers/src/lib/validate/validate-amount.ts rename to libs/utils/src/lib/validate/validate-amount.ts index 2e861e960..35e597ddd 100644 --- a/libs/react-helpers/src/lib/validate/validate-amount.ts +++ b/libs/utils/src/lib/validate/validate-amount.ts @@ -1,4 +1,4 @@ -import { t } from '../i18n'; +import { t } from '../../../../utils/src/lib/i18n'; export const validateAmount = (step: number | string, field: string) => { const [, stepDecimals = ''] = String(step).split('.'); diff --git a/libs/utils/tsconfig.json b/libs/utils/tsconfig.json new file mode 100644 index 000000000..ab0659018 --- /dev/null +++ b/libs/utils/tsconfig.json @@ -0,0 +1,23 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "module": "commonjs", + "forceConsistentCasingInFileNames": true, + "strict": true, + "noImplicitOverride": true, + "noPropertyAccessFromIndexSignature": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "esModuleInterop": true + }, + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" + } + ] +} diff --git a/libs/utils/tsconfig.lib.json b/libs/utils/tsconfig.lib.json new file mode 100644 index 000000000..bcdddcf3e --- /dev/null +++ b/libs/utils/tsconfig.lib.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "declaration": true, + "types": [] + }, + "include": ["**/*.ts", "../ui-toolkit/src/utils/cell-class-rules.ts"], + "exclude": ["jest.config.ts", "**/*.spec.ts", "**/*.test.ts"] +} diff --git a/libs/utils/tsconfig.spec.json b/libs/utils/tsconfig.spec.json new file mode 100644 index 000000000..546f12877 --- /dev/null +++ b/libs/utils/tsconfig.spec.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "module": "commonjs", + "types": ["jest", "node"] + }, + "include": ["jest.config.ts", "**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"] +} diff --git a/libs/wallet/src/connect-dialog/connect-dialog-elements.tsx b/libs/wallet/src/connect-dialog/connect-dialog-elements.tsx index 5cc04840b..27897632e 100644 --- a/libs/wallet/src/connect-dialog/connect-dialog-elements.tsx +++ b/libs/wallet/src/connect-dialog/connect-dialog-elements.tsx @@ -1,5 +1,5 @@ import { useEnvironment } from '@vegaprotocol/environment'; -import { createDocsLinks, ExternalLinks, t } from '@vegaprotocol/react-helpers'; +import { createDocsLinks, ExternalLinks, t } from '@vegaprotocol/utils'; import { Link } from '@vegaprotocol/ui-toolkit'; import type { ReactNode } from 'react'; diff --git a/libs/wallet/src/connect-dialog/connect-dialog.spec.tsx b/libs/wallet/src/connect-dialog/connect-dialog.spec.tsx index 04a34e4b9..14ed885a1 100644 --- a/libs/wallet/src/connect-dialog/connect-dialog.spec.tsx +++ b/libs/wallet/src/connect-dialog/connect-dialog.spec.tsx @@ -19,8 +19,8 @@ import { WalletError, } from '../connectors'; import { useEnvironment } from '@vegaprotocol/environment'; -import type { ChainIdQuery } from '@vegaprotocol/react-helpers'; -import { ChainIdDocument } from '@vegaprotocol/react-helpers'; +import type { ChainIdQuery } from '@vegaprotocol/utils'; +import { ChainIdDocument } from '@vegaprotocol/utils'; const mockUpdateDialogOpen = jest.fn(); const mockCloseVegaDialog = jest.fn(); diff --git a/libs/wallet/src/connect-dialog/connect-dialog.tsx b/libs/wallet/src/connect-dialog/connect-dialog.tsx index d3a6b330b..42cae27cb 100644 --- a/libs/wallet/src/connect-dialog/connect-dialog.tsx +++ b/libs/wallet/src/connect-dialog/connect-dialog.tsx @@ -10,7 +10,7 @@ import { } from '@vegaprotocol/ui-toolkit'; import { useCallback, useState } from 'react'; import type { WalletClientError } from '@vegaprotocol/wallet-client'; -import { ExternalLinks, t, useChainIdQuery } from '@vegaprotocol/react-helpers'; +import { ExternalLinks, t, useChainIdQuery } from '@vegaprotocol/utils'; import type { VegaConnector } from '../connectors'; import { ViewConnector } from '../connectors'; import { JsonRpcConnector, RestConnector } from '../connectors'; diff --git a/libs/wallet/src/connect-dialog/json-rpc-connector-form.tsx b/libs/wallet/src/connect-dialog/json-rpc-connector-form.tsx index ce038ecf1..fed5c21bc 100644 --- a/libs/wallet/src/connect-dialog/json-rpc-connector-form.tsx +++ b/libs/wallet/src/connect-dialog/json-rpc-connector-form.tsx @@ -1,5 +1,5 @@ import capitalize from 'lodash/capitalize'; -import { createDocsLinks, t } from '@vegaprotocol/react-helpers'; +import { createDocsLinks, t } from '@vegaprotocol/utils'; import { ButtonLink, Diamond, diff --git a/libs/wallet/src/connect-dialog/rest-connector-form.tsx b/libs/wallet/src/connect-dialog/rest-connector-form.tsx index 9be2acefa..db76242aa 100644 --- a/libs/wallet/src/connect-dialog/rest-connector-form.tsx +++ b/libs/wallet/src/connect-dialog/rest-connector-form.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { Button, FormGroup, Input, InputError } from '@vegaprotocol/ui-toolkit'; import { useState } from 'react'; import { useForm } from 'react-hook-form'; diff --git a/libs/wallet/src/connect-dialog/view-connector-form.tsx b/libs/wallet/src/connect-dialog/view-connector-form.tsx index 990222fb9..87aeb9a43 100644 --- a/libs/wallet/src/connect-dialog/view-connector-form.tsx +++ b/libs/wallet/src/connect-dialog/view-connector-form.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { Button, FormGroup, diff --git a/libs/wallet/src/connectors/json-rpc-connector.ts b/libs/wallet/src/connectors/json-rpc-connector.ts index a9c0dacbf..8717dd5ef 100644 --- a/libs/wallet/src/connectors/json-rpc-connector.ts +++ b/libs/wallet/src/connectors/json-rpc-connector.ts @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { WalletClient, WalletClientError } from '@vegaprotocol/wallet-client'; import { clearConfig, getConfig, setConfig } from '../storage'; import type { Transaction, VegaConnector } from './vega-connector'; diff --git a/libs/wallet/src/connectors/rest-connector.ts b/libs/wallet/src/connectors/rest-connector.ts index 0e68da3f7..fb97b8804 100644 --- a/libs/wallet/src/connectors/rest-connector.ts +++ b/libs/wallet/src/connectors/rest-connector.ts @@ -3,7 +3,7 @@ import { clearConfig, getConfig, setConfig } from '../storage'; import type { Transaction, VegaConnector } from './vega-connector'; import { WalletError } from './vega-connector'; import { z } from 'zod'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; type TransactionError = | { diff --git a/libs/wallet/src/manage-dialog/manage-dialog.spec.tsx b/libs/wallet/src/manage-dialog/manage-dialog.spec.tsx index 58e6297a5..32513e078 100644 --- a/libs/wallet/src/manage-dialog/manage-dialog.spec.tsx +++ b/libs/wallet/src/manage-dialog/manage-dialog.spec.tsx @@ -4,7 +4,7 @@ import { VegaWalletContext } from '../context'; import type { VegaWalletContextShape } from '../context'; import type { VegaManageDialogProps } from '.'; import { VegaManageDialog } from '.'; -import { truncateByChars } from '@vegaprotocol/react-helpers'; +import { truncateByChars } from '@vegaprotocol/utils'; let props: VegaManageDialogProps; let context: Partial; diff --git a/libs/wallet/src/manage-dialog/manage-dialog.tsx b/libs/wallet/src/manage-dialog/manage-dialog.tsx index 73ef6c397..9c08d5dab 100644 --- a/libs/wallet/src/manage-dialog/manage-dialog.tsx +++ b/libs/wallet/src/manage-dialog/manage-dialog.tsx @@ -1,4 +1,4 @@ -import { t, truncateByChars } from '@vegaprotocol/react-helpers'; +import { t, truncateByChars } from '@vegaprotocol/utils'; import { Button, Dialog, diff --git a/libs/wallet/src/provider.spec.tsx b/libs/wallet/src/provider.spec.tsx index 03db43057..241d5a5d0 100644 --- a/libs/wallet/src/provider.spec.tsx +++ b/libs/wallet/src/provider.spec.tsx @@ -4,7 +4,7 @@ import { ViewConnector } from './connectors'; import { RestConnector } from './connectors'; import { useVegaWallet } from './use-vega-wallet'; import { VegaWalletProvider } from './provider'; -import { LocalStorage } from '@vegaprotocol/react-helpers'; +import { LocalStorage } from '@vegaprotocol/utils'; import type { ReactNode } from 'react'; import { WALLET_KEY } from './storage'; diff --git a/libs/wallet/src/provider.tsx b/libs/wallet/src/provider.tsx index 2d2c3c4cc..67f68e3b7 100644 --- a/libs/wallet/src/provider.tsx +++ b/libs/wallet/src/provider.tsx @@ -1,4 +1,4 @@ -import { LocalStorage } from '@vegaprotocol/react-helpers'; +import { LocalStorage } from '@vegaprotocol/utils'; import type { ReactNode } from 'react'; import { useCallback, useMemo, useRef, useState } from 'react'; import { WalletClientError } from '@vegaprotocol/wallet-client'; diff --git a/libs/wallet/src/storage.ts b/libs/wallet/src/storage.ts index a3e1aa0b5..d5fa8874c 100644 --- a/libs/wallet/src/storage.ts +++ b/libs/wallet/src/storage.ts @@ -1,4 +1,4 @@ -import { LocalStorage } from '@vegaprotocol/react-helpers'; +import { LocalStorage } from '@vegaprotocol/utils'; interface ConnectorConfig { token: string | null; diff --git a/libs/wallet/src/utils.ts b/libs/wallet/src/utils.ts index af5f4fd50..ff96d1710 100644 --- a/libs/wallet/src/utils.ts +++ b/libs/wallet/src/utils.ts @@ -1,4 +1,4 @@ -import { removeDecimal, toNanoSeconds } from '@vegaprotocol/react-helpers'; +import { removeDecimal, toNanoSeconds } from '@vegaprotocol/utils'; import type { Market, Order } from '@vegaprotocol/types'; import { OrderTimeInForce, OrderType, AccountType } from '@vegaprotocol/types'; import BigNumber from 'bignumber.js'; diff --git a/libs/wallet/src/vega-transaction-dialog/vega-transaction-dialog.tsx b/libs/wallet/src/vega-transaction-dialog/vega-transaction-dialog.tsx index e71606db4..48c16ca22 100644 --- a/libs/wallet/src/vega-transaction-dialog/vega-transaction-dialog.tsx +++ b/libs/wallet/src/vega-transaction-dialog/vega-transaction-dialog.tsx @@ -1,5 +1,5 @@ import { Networks, useEnvironment } from '@vegaprotocol/environment'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { Dialog, Icon, Intent, Loader } from '@vegaprotocol/ui-toolkit'; import type { ReactNode } from 'react'; import { WalletClientError } from '@vegaprotocol/wallet-client'; diff --git a/libs/web3/src/lib/ethereum-transaction-dialog/dialog-rows.tsx b/libs/web3/src/lib/ethereum-transaction-dialog/dialog-rows.tsx index 49b2c24cf..bf89f4927 100644 --- a/libs/web3/src/lib/ethereum-transaction-dialog/dialog-rows.tsx +++ b/libs/web3/src/lib/ethereum-transaction-dialog/dialog-rows.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { Link } from '@vegaprotocol/ui-toolkit'; import { useEnvironment } from '@vegaprotocol/environment'; import { EthTxStatus } from '../use-ethereum-transaction'; diff --git a/libs/web3/src/lib/ethereum-transaction-dialog/ethereum-transaction-dialog.tsx b/libs/web3/src/lib/ethereum-transaction-dialog/ethereum-transaction-dialog.tsx index 8a0b02086..1c60a6553 100644 --- a/libs/web3/src/lib/ethereum-transaction-dialog/ethereum-transaction-dialog.tsx +++ b/libs/web3/src/lib/ethereum-transaction-dialog/ethereum-transaction-dialog.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { Button, Dialog, Icon, Intent, Loader } from '@vegaprotocol/ui-toolkit'; import { isEthereumError } from '../ethereum-error'; import type { EthTxState, TxError } from '../use-ethereum-transaction'; diff --git a/libs/web3/src/lib/use-eager-connect.ts b/libs/web3/src/lib/use-eager-connect.ts index 1edbb6441..d4185828c 100644 --- a/libs/web3/src/lib/use-eager-connect.ts +++ b/libs/web3/src/lib/use-eager-connect.ts @@ -1,4 +1,4 @@ -import { useLocalStorage } from '@vegaprotocol/react-helpers'; +import { useLocalStorage } from '@vegaprotocol/utils'; import type { Web3ReactHooks } from '@web3-react/core'; import { MetaMask } from '@web3-react/metamask'; import type { Connector } from '@web3-react/types'; diff --git a/libs/web3/src/lib/use-ethereum-config.ts b/libs/web3/src/lib/use-ethereum-config.ts index 87df9ccad..c558de583 100644 --- a/libs/web3/src/lib/use-ethereum-config.ts +++ b/libs/web3/src/lib/use-ethereum-config.ts @@ -1,7 +1,7 @@ import { removePaginationWrapper, useNetworkParamsQuery, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import { useMemo } from 'react'; export interface EthereumConfig { diff --git a/libs/web3/src/lib/use-ethereum-transaction.tsx b/libs/web3/src/lib/use-ethereum-transaction.tsx index 36c76fee3..95c7335d0 100644 --- a/libs/web3/src/lib/use-ethereum-transaction.tsx +++ b/libs/web3/src/lib/use-ethereum-transaction.tsx @@ -1,4 +1,4 @@ -import { formatLabel } from '@vegaprotocol/react-helpers'; +import { formatLabel } from '@vegaprotocol/utils'; import type { ethers } from 'ethers'; import { useCallback, useMemo, useState } from 'react'; import type { EthereumError } from './ethereum-error'; diff --git a/libs/web3/src/lib/use-ethereum-withdraw-approvals-manager.spec.tsx b/libs/web3/src/lib/use-ethereum-withdraw-approvals-manager.spec.tsx index 6d167b600..788caf719 100644 --- a/libs/web3/src/lib/use-ethereum-withdraw-approvals-manager.spec.tsx +++ b/libs/web3/src/lib/use-ethereum-withdraw-approvals-manager.spec.tsx @@ -16,8 +16,8 @@ import type { EthTransactionStore } from './use-ethereum-transaction-store'; import { WithdrawalApprovalDocument } from '@vegaprotocol/wallet'; import type { WithdrawalApprovalQuery } from '@vegaprotocol/wallet'; -import { NetworkParamsDocument } from '@vegaprotocol/react-helpers'; -import type { NetworkParamsQuery } from '@vegaprotocol/react-helpers'; +import { NetworkParamsDocument } from '@vegaprotocol/utils'; +import type { NetworkParamsQuery } from '@vegaprotocol/utils'; const mockWeb3Provider = jest.fn(); diff --git a/libs/web3/src/lib/use-ethereum-withdraw-approvals-manager.tsx b/libs/web3/src/lib/use-ethereum-withdraw-approvals-manager.tsx index 0d670a9a6..e8bc1bb97 100644 --- a/libs/web3/src/lib/use-ethereum-withdraw-approvals-manager.tsx +++ b/libs/web3/src/lib/use-ethereum-withdraw-approvals-manager.tsx @@ -1,10 +1,10 @@ import { useApolloClient } from '@apollo/client'; import BigNumber from 'bignumber.js'; import { useRef, useEffect } from 'react'; -import { addDecimal } from '@vegaprotocol/react-helpers'; +import { addDecimal } from '@vegaprotocol/utils'; import { useGetWithdrawThreshold } from './use-get-withdraw-threshold'; import { useGetWithdrawDelay } from './use-get-withdraw-delay'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { CollateralBridge } from '@vegaprotocol/smart-contracts'; diff --git a/libs/web3/src/lib/use-get-withdraw-threshold.tsx b/libs/web3/src/lib/use-get-withdraw-threshold.tsx index a6c90cabc..77f1cff78 100644 --- a/libs/web3/src/lib/use-get-withdraw-threshold.tsx +++ b/libs/web3/src/lib/use-get-withdraw-threshold.tsx @@ -1,7 +1,7 @@ import { useCallback } from 'react'; import { useBridgeContract } from './use-bridge-contract'; import BigNumber from 'bignumber.js'; -import { addDecimal } from '@vegaprotocol/react-helpers'; +import { addDecimal } from '@vegaprotocol/utils'; import type { WithdrawalBusEventFieldsFragment } from '@vegaprotocol/wallet'; /** diff --git a/libs/web3/src/lib/web3-connect-dialog.tsx b/libs/web3/src/lib/web3-connect-dialog.tsx index 67b433bca..d9ecb57ec 100644 --- a/libs/web3/src/lib/web3-connect-dialog.tsx +++ b/libs/web3/src/lib/web3-connect-dialog.tsx @@ -1,4 +1,4 @@ -import { t, useLocalStorage } from '@vegaprotocol/react-helpers'; +import { t, useLocalStorage } from '@vegaprotocol/utils'; import { Dialog, Intent } from '@vegaprotocol/ui-toolkit'; import { MetaMask } from '@web3-react/metamask'; import { WalletConnect } from '@web3-react/walletconnect'; diff --git a/libs/withdraws/src/lib/create-withdrawal-dialog.tsx b/libs/withdraws/src/lib/create-withdrawal-dialog.tsx index 3150d76d0..66be6a6fd 100644 --- a/libs/withdraws/src/lib/create-withdrawal-dialog.tsx +++ b/libs/withdraws/src/lib/create-withdrawal-dialog.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { Dialog } from '@vegaprotocol/ui-toolkit'; import { useVegaWallet } from '@vegaprotocol/wallet'; import { WithdrawFormContainer } from './withdraw-form-container'; diff --git a/libs/withdraws/src/lib/use-verify-withdrawal.ts b/libs/withdraws/src/lib/use-verify-withdrawal.ts index 85cd4e387..7b6126280 100644 --- a/libs/withdraws/src/lib/use-verify-withdrawal.ts +++ b/libs/withdraws/src/lib/use-verify-withdrawal.ts @@ -1,7 +1,7 @@ import { useCallback, useState } from 'react'; import { captureException } from '@sentry/react'; import BigNumber from 'bignumber.js'; -import { addDecimal, t } from '@vegaprotocol/react-helpers'; +import { addDecimal, t } from '@vegaprotocol/utils'; import { useGetWithdrawThreshold, useGetWithdrawDelay, diff --git a/libs/withdraws/src/lib/use-withdraw-asset.tsx b/libs/withdraws/src/lib/use-withdraw-asset.tsx index 874f3b30f..3cb6759bc 100644 --- a/libs/withdraws/src/lib/use-withdraw-asset.tsx +++ b/libs/withdraws/src/lib/use-withdraw-asset.tsx @@ -1,6 +1,6 @@ import { captureException } from '@sentry/react'; import type { Asset } from '@vegaprotocol/assets'; -import { addDecimal } from '@vegaprotocol/react-helpers'; +import { addDecimal } from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; import BigNumber from 'bignumber.js'; import { useCallback, useEffect } from 'react'; diff --git a/libs/withdraws/src/lib/withdraw-form-container.tsx b/libs/withdraws/src/lib/withdraw-form-container.tsx index 06b227d19..b8a3cfafe 100644 --- a/libs/withdraws/src/lib/withdraw-form-container.tsx +++ b/libs/withdraws/src/lib/withdraw-form-container.tsx @@ -1,5 +1,5 @@ import { useMemo } from 'react'; -import { useDataProvider, t, toBigNum } from '@vegaprotocol/react-helpers'; +import { useDataProvider, t, toBigNum } from '@vegaprotocol/utils'; import { AsyncRenderer } from '@vegaprotocol/ui-toolkit'; import { accountsDataProvider } from '@vegaprotocol/accounts'; import type { WithdrawalArgs } from './use-create-withdraw'; diff --git a/libs/withdraws/src/lib/withdraw-form.tsx b/libs/withdraws/src/lib/withdraw-form.tsx index 8c61707db..ce82b5615 100644 --- a/libs/withdraws/src/lib/withdraw-form.tsx +++ b/libs/withdraws/src/lib/withdraw-form.tsx @@ -8,7 +8,7 @@ import { required, useLocalStorage, isAssetTypeERC20, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import { Button, FormGroup, diff --git a/libs/withdraws/src/lib/withdraw-limits.tsx b/libs/withdraws/src/lib/withdraw-limits.tsx index f67a720a9..e7fbe6d36 100644 --- a/libs/withdraws/src/lib/withdraw-limits.tsx +++ b/libs/withdraws/src/lib/withdraw-limits.tsx @@ -1,5 +1,5 @@ import type { Asset } from '@vegaprotocol/assets'; -import { compactNumber, t } from '@vegaprotocol/react-helpers'; +import { compactNumber, t } from '@vegaprotocol/utils'; import { KeyValueTable, KeyValueTableRow } from '@vegaprotocol/ui-toolkit'; import BigNumber from 'bignumber.js'; import { formatDistanceToNow } from 'date-fns'; diff --git a/libs/withdraws/src/lib/withdrawal-dialog.tsx b/libs/withdraws/src/lib/withdrawal-dialog.tsx index 2ca6a45db..e17353988 100644 --- a/libs/withdraws/src/lib/withdrawal-dialog.tsx +++ b/libs/withdraws/src/lib/withdrawal-dialog.tsx @@ -1,5 +1,5 @@ import { create } from 'zustand'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/utils'; import { Dialog } from '@vegaprotocol/ui-toolkit'; import { useVegaWallet } from '@vegaprotocol/wallet'; import { useCompleteWithdraw } from './use-complete-withdraw'; diff --git a/libs/withdraws/src/lib/withdrawal-feedback.tsx b/libs/withdraws/src/lib/withdrawal-feedback.tsx index bca2abd50..7783059e1 100644 --- a/libs/withdraws/src/lib/withdrawal-feedback.tsx +++ b/libs/withdraws/src/lib/withdrawal-feedback.tsx @@ -3,7 +3,7 @@ import { addDecimalsFormatNumber, t, truncateByChars, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import { Button, KeyValueTable, diff --git a/libs/withdraws/src/lib/withdrawals-provider.ts b/libs/withdraws/src/lib/withdrawals-provider.ts index 23d0a0923..58086e609 100644 --- a/libs/withdraws/src/lib/withdrawals-provider.ts +++ b/libs/withdraws/src/lib/withdrawals-provider.ts @@ -1,5 +1,5 @@ import uniqBy from 'lodash/uniqBy'; -import { makeDataProvider } from '@vegaprotocol/react-helpers'; +import { makeDataProvider } from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; import { WithdrawalsDocument, @@ -11,10 +11,7 @@ import type { WithdrawalEventSubscription, WithdrawalEventSubscriptionVariables, } from './__generated__/Withdrawal'; -import { - removePaginationWrapper, - getEvents, -} from '@vegaprotocol/react-helpers'; +import { removePaginationWrapper, getEvents } from '@vegaprotocol/utils'; const sortWithdrawals = (data: WithdrawalFieldsFragment[]) => data.sort((a, b) => { diff --git a/libs/withdraws/src/lib/withdrawals-table.spec.tsx b/libs/withdraws/src/lib/withdrawals-table.spec.tsx index ed43874bf..dc5a45ef2 100644 --- a/libs/withdraws/src/lib/withdrawals-table.spec.tsx +++ b/libs/withdraws/src/lib/withdrawals-table.spec.tsx @@ -1,6 +1,6 @@ import { MockedProvider } from '@apollo/client/testing'; import { act, render, screen } from '@testing-library/react'; -import { getTimeFormat } from '@vegaprotocol/react-helpers'; +import { getTimeFormat } from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; import type { TypedDataAgGrid } from '@vegaprotocol/ui-toolkit'; import { generateWithdrawal } from './test-helpers'; diff --git a/libs/withdraws/src/lib/withdrawals-table.tsx b/libs/withdraws/src/lib/withdrawals-table.tsx index 653bcfd5e..7feacba9f 100644 --- a/libs/withdraws/src/lib/withdrawals-table.tsx +++ b/libs/withdraws/src/lib/withdrawals-table.tsx @@ -5,7 +5,7 @@ import { truncateByChars, addDecimalsFormatNumber, isNumeric, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import type { TypedDataAgGrid, VegaICellRendererParams, diff --git a/tools/scripts/publish.mjs b/tools/scripts/publish.mjs new file mode 100644 index 000000000..ecb8d7b05 --- /dev/null +++ b/tools/scripts/publish.mjs @@ -0,0 +1,61 @@ +/** + * This is a minimal script to publish your package to "npm". + * This is meant to be used as-is or customize as you see fit. + * + * This script is executed on "dist/path/to/library" as "cwd" by default. + * + * You might need to authenticate with NPM before running this script. + */ + +import { readCachedProjectGraph } from '@nrwl/devkit'; +import { execSync } from 'child_process'; +import { readFileSync, writeFileSync } from 'fs'; +import chalk from 'chalk'; + +function invariant(condition, message) { + if (!condition) { + console.error(chalk.bold.red(message)); + process.exit(1); + } +} + +// Executing publish script: node path/to/publish.mjs {name} --version {version} --tag {tag} +// Default "tag" to "next" so we won't publish the "latest" tag by accident. +const [, , name, version, tag = 'next'] = process.argv; + +// A simple SemVer validation to validate the version +const validVersion = /^\d+\.\d+\.\d+(-\w+\.\d+)?/; +invariant( + version && validVersion.test(version), + `No version provided or version did not match Semantic Versioning, expected: #.#.#-tag.# or #.#.#, got ${version}.` +); + +const graph = readCachedProjectGraph(); +const project = graph.nodes[name]; + +invariant( + project, + `Could not find project "${name}" in the workspace. Is the project.json configured correctly?` +); + +const outputPath = project.data?.targets?.build?.options?.outputPath; +invariant( + outputPath, + `Could not find "build.options.outputPath" of project "${name}". Is project.json configured correctly?` +); + +process.chdir(outputPath); + +// Updating the version in "package.json" before publishing +try { + const json = JSON.parse(readFileSync(`package.json`).toString()); + json.version = version; + writeFileSync(`package.json`, JSON.stringify(json, null, 2)); +} catch (e) { + console.error( + chalk.bold.red(`Error reading package.json file from library build output.`) + ); +} + +// Execute "npm publish" to publish +execSync(`npm publish --access public --tag ${tag}`); diff --git a/tsconfig.base.json b/tsconfig.base.json index 3031bbc04..2c08dbb31 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -44,6 +44,7 @@ "@vegaprotocol/trades": ["libs/trades/src/index.ts"], "@vegaprotocol/types": ["libs/types/src/index.ts"], "@vegaprotocol/ui-toolkit": ["libs/ui-toolkit/src/index.ts"], + "@vegaprotocol/utils": ["libs/utils/src/index.ts"], "@vegaprotocol/wallet": ["libs/wallet/src/index.ts"], "@vegaprotocol/web3": ["libs/web3/src/index.ts"], "@vegaprotocol/withdraws": ["libs/withdraws/src/index.ts"] diff --git a/workspace.json b/workspace.json index fcb25e693..1b7a3e1fa 100644 --- a/workspace.json +++ b/workspace.json @@ -35,6 +35,7 @@ "trading-e2e": "apps/trading-e2e", "types": "libs/types", "ui-toolkit": "libs/ui-toolkit", + "utils": "libs/utils", "wallet": "libs/wallet", "web3": "libs/web3", "withdraws": "libs/withdraws"