Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 0 additions & 47 deletions apps/tangle-cloud/src/stores/roleStore.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion apps/tangle-dapp/src/data/evm/useContractReadOnce.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import ensureError from '@tangle-network/tangle-shared-ui/utils/ensureError';
import assert from 'assert';
import { assert } from '@tangle-network/browser-utils';
import { useCallback } from 'react';
import {
Abi as ViemAbi,
Expand Down
2 changes: 1 addition & 1 deletion apps/tangle-dapp/src/utils/chainToNetwork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
TANGLE_MAINNET_NETWORK,
TANGLE_TESTNET_NATIVE_NETWORK,
} from '@tangle-network/ui-components/constants/networks';
import assert from 'assert';
import { assert } from '@tangle-network/browser-utils';

const chainToNetworkMap = {
[PresetTypedChainId.TangleLocalEVM]: TANGLE_LOCAL_DEV_NETWORK,
Expand Down
2 changes: 1 addition & 1 deletion apps/tangle-dapp/src/utils/enumValueToNumber.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import assert from 'assert';
import { assert } from '@tangle-network/browser-utils';

const enumValueToNumber = <T>(enumValue: T): number => {
assert(
Expand Down
30 changes: 13 additions & 17 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,6 @@ import reactRefresh from 'eslint-plugin-react-refresh';
import storybook from 'eslint-plugin-storybook';
import tseslint from 'typescript-eslint';

const reactCompilerReadinessRules = {
'react-hooks/config': 'warn',
'react-hooks/error-boundaries': 'warn',
'react-hooks/gating': 'warn',
'react-hooks/globals': 'warn',
'react-hooks/immutability': 'warn',
'react-hooks/preserve-manual-memoization': 'warn',
'react-hooks/purity': 'warn',
'react-hooks/refs': 'warn',
'react-hooks/set-state-in-effect': 'warn',
'react-hooks/set-state-in-render': 'warn',
'react-hooks/static-components': 'warn',
'react-hooks/unsupported-syntax': 'warn',
'react-hooks/use-memo': 'warn',
};

export default tseslint.config(
tseslint.configs.recommended,
js.configs.recommended,
Expand Down Expand Up @@ -60,7 +44,19 @@ export default tseslint.config(
// The v7 hooks plugin adds React Compiler readiness diagnostics to the
// Nx React preset. Keep them visible without making compiler adoption a
// repo-wide CI gate before the codebase is migrated.
...reactCompilerReadinessRules,
'react-hooks/config': 'warn',
'react-hooks/error-boundaries': 'warn',
'react-hooks/gating': 'warn',
'react-hooks/globals': 'warn',
'react-hooks/immutability': 'warn',
'react-hooks/preserve-manual-memoization': 'warn',
'react-hooks/purity': 'warn',
'react-hooks/refs': 'warn',
'react-hooks/set-state-in-effect': 'warn',
'react-hooks/set-state-in-render': 'warn',
'react-hooks/static-components': 'warn',
'react-hooks/unsupported-syntax': 'warn',
'react-hooks/use-memo': 'warn',
'@nx/enforce-module-boundaries': [
'error',
{
Expand Down
2 changes: 1 addition & 1 deletion libs/api-provider-environment/src/ConnectWallet/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
WebbErrorCodes,
type WalletId,
} from '@tangle-network/dapp-types';
import assert from 'assert';
import { assert } from '@tangle-network/browser-utils';
import { useObservableState } from 'observable-hooks';
import { useCallback, useEffect, useMemo } from 'react';
import { useWebContext } from '../webb-context/webb-context';
Expand Down
18 changes: 18 additions & 0 deletions libs/browser-utils/src/assert.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* Browser-safe assertion. Throws a plain `Error` (not Node's `AssertionError`)
* so callers introduce no Node-built-in dependency and stay bundle-clean for
* browser targets. Carries a TypeScript `asserts condition` signature so call
* sites retain type-narrowing, matching the ergonomics of Node's `assert`.
*
* @param condition - The condition to check.
* @param message - Optional error message used when `condition` is falsy.
* @throws {Error} when `condition` is falsy.
*/
export function assert(
condition: unknown,
message?: string,
): asserts condition {
if (!condition) {
throw new Error(message ?? 'Assertion failed');
}
}
1 change: 1 addition & 0 deletions libs/browser-utils/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export { assert } from './assert';
export { default as isBrowser } from './isBrowser';
export * from './logger';
export * from './platform';
Expand Down
73 changes: 73 additions & 0 deletions libs/tangle-shared-ui/src/abi/blueprintServiceManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,56 @@ const ABI = [
outputs: [],
stateMutability: 'payable',
},
{
type: 'function',
name: 'onBinaryVersionPublished',
inputs: [
{
name: 'blueprintId',
type: 'uint64',
internalType: 'uint64',
},
{
name: 'version',
type: 'tuple',
internalType: 'struct Types.BinaryVersion',
components: [
{
name: 'versionId',
type: 'uint64',
internalType: 'uint64',
},
{
name: 'sha256Hash',
type: 'bytes32',
internalType: 'bytes32',
},
{
name: 'binaryUri',
type: 'string',
internalType: 'string',
},
{
name: 'attestationHash',
type: 'bytes32',
internalType: 'bytes32',
},
{
name: 'publishedAt',
type: 'uint64',
internalType: 'uint64',
},
{
name: 'deprecated',
type: 'bool',
internalType: 'bool',
},
],
},
],
outputs: [],
stateMutability: 'nonpayable',
},
{
type: 'function',
name: 'onBlueprintCreated',
Expand Down Expand Up @@ -493,6 +543,29 @@ const ABI = [
outputs: [],
stateMutability: 'payable',
},
{
type: 'function',
name: 'onOperatorBinaryAcked',
inputs: [
{
name: 'serviceId',
type: 'uint64',
internalType: 'uint64',
},
{
name: 'versionId',
type: 'uint64',
internalType: 'uint64',
},
{
name: 'operator',
type: 'address',
internalType: 'address',
},
],
outputs: [],
stateMutability: 'nonpayable',
},
{
type: 'function',
name: 'onOperatorJoined',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { TANGLE_TOKEN_DECIMALS } from '@tangle-network/dapp-config';
import { isEvmAddress } from '@tangle-network/ui-components';
import { BN } from '@polkadot/util';
import assert from 'assert';
import { assert } from '@tangle-network/browser-utils';
import { useCallback, useMemo } from 'react';
import { map } from 'rxjs';
import { NATIVE_ASSET_ID } from '../../constants/staking';
Expand Down
2 changes: 1 addition & 1 deletion libs/tangle-shared-ui/src/hooks/useEvmTxRelayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
} from '../constants/evmPrecompiles';
import { EvmAddress } from '@tangle-network/ui-components/types/address';
import { assertEvmAddress } from '@tangle-network/ui-components';
import assert from 'assert';
import { assert } from '@tangle-network/browser-utils';
import useViemWalletClient, {
WalletClientTransport,
} from './useViemWalletClient';
Expand Down
2 changes: 1 addition & 1 deletion libs/tangle-shared-ui/src/hooks/useSubstrateTx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import ensureError from '../utils/ensureError';
import { getApiPromise } from '../utils/polkadot/api';
import useIsMountedRef from '@tangle-network/ui-components/hooks/useIsMountedRef';
import type { SubstrateAddress } from '@tangle-network/ui-components/types/address';
import assert from 'assert';
import { assert } from '@tangle-network/browser-utils';
import { useCallback, useEffect, useState } from 'react';
import { Hash } from 'viem';
import useTxHistoryStore, {
Expand Down
2 changes: 1 addition & 1 deletion libs/tangle-shared-ui/src/hooks/useWallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import ensureError from '../utils/ensureError';
import { EIP1193Provider } from 'viem';
import { EthereumProvider } from '@walletconnect/ethereum-provider';
import useEvmChain from './useEvmChain';
import assert from 'assert';
import { assert } from '@tangle-network/browser-utils';

const LAST_CONNECTED_ACCOUNT_KEY = 'lastConnectedAccountAddress';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import assert from 'assert';
import { assert } from '@tangle-network/browser-utils';
import { motion, useInView, useSpring, useTransform } from 'framer-motion';
import {
forwardRef,
Expand Down
2 changes: 1 addition & 1 deletion libs/ui-components/src/utils/assertAddressBy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import assert from 'assert';
import { assert } from '@tangle-network/browser-utils';
import { AnyAddress, SolanaAddress } from '../types/address';

export const assertAddressBy = <T extends AnyAddress | SolanaAddress>(
Expand Down
2 changes: 1 addition & 1 deletion libs/ui-components/src/utils/assertBytes32.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import assert from 'assert';
import { assert } from '@tangle-network/browser-utils';
import { Bytes32 } from '../types/address';
import { isHex } from 'viem';

Expand Down
2 changes: 1 addition & 1 deletion libs/ui-components/src/utils/assertEvmAddress.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import assert from 'assert';
import { assert } from '@tangle-network/browser-utils';
import { EvmAddress } from '../types/address';
import { isEvmAddress } from './isEvmAddress20';
import { checksumAddress } from 'viem';
Expand Down
2 changes: 1 addition & 1 deletion libs/ui-components/src/utils/assertSolanaAddress.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import assert from 'assert';
import { assert } from '@tangle-network/browser-utils';
import { SolanaAddress } from '../types/address';
import { isSolanaAddress } from './isSolanaAddress';

Expand Down
2 changes: 1 addition & 1 deletion libs/ui-components/src/utils/assertSubstrateAddress.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import assert from 'assert';
import { assert } from '@tangle-network/browser-utils';
import { SubstrateAddress } from '../types/address';
import { isSubstrateAddress } from './isSubstrateAddress';

Expand Down
2 changes: 1 addition & 1 deletion libs/ui-components/src/utils/calculateBnRatio.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { assert } from '@tangle-network/browser-utils';
import { BN } from '@polkadot/util';
import assert from 'assert';
import { Decimal } from 'decimal.js';

/**
Expand Down
2 changes: 1 addition & 1 deletion libs/ui-components/src/utils/toEvmAddress.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { addressToEvm } from '@polkadot/util-crypto';
import assert from 'assert';
import { assert } from '@tangle-network/browser-utils';
import { EvmAddress, SubstrateAddress } from '../types/address';
import { isEvmAddress } from './isEvmAddress20';
import { toHex } from 'viem';
Expand Down
2 changes: 1 addition & 1 deletion libs/web3-api-provider/src/webb-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
calculateTypedChainId,
} from '@tangle-network/dapp-types';
import { ApiConfig, getWagmiConfig } from '@tangle-network/dapp-config';
import assert from 'assert';
import { assert } from '@tangle-network/browser-utils';
import values from 'lodash/values';
import { BehaviorSubject } from 'rxjs';
import {
Expand Down
Loading
Loading