diff --git a/apps/docs/src/components/homepage-features/index.tsx b/apps/docs/src/components/homepage-features/index.tsx index 7f0aa527..5867660b 100644 --- a/apps/docs/src/components/homepage-features/index.tsx +++ b/apps/docs/src/components/homepage-features/index.tsx @@ -65,7 +65,7 @@ function Feature({ title, emoji, description }: FeatureItem) { ); } -export default function HomepageFeatures() { +export function HomepageFeatures() { return (
diff --git a/apps/docs/src/components/homepage-sponsors/index.tsx b/apps/docs/src/components/homepage-sponsors/index.tsx index 880d67ce..824a3728 100644 --- a/apps/docs/src/components/homepage-sponsors/index.tsx +++ b/apps/docs/src/components/homepage-sponsors/index.tsx @@ -96,7 +96,7 @@ function Sponsor({ title, image, href }: SponsorItem) { ); } -export default function HomepageSponsors() { +export function HomepageSponsors() { return (
diff --git a/apps/docs/src/pages/index.tsx b/apps/docs/src/pages/index.tsx index 8bf3e605..1e20987a 100644 --- a/apps/docs/src/pages/index.tsx +++ b/apps/docs/src/pages/index.tsx @@ -1,8 +1,8 @@ -import HomepageSponsors from "../components/homepage-sponsors"; +import { HomepageSponsors } from "../components/homepage-sponsors"; import styles from "./index.module.css"; import Link from "@docusaurus/Link"; import useDocusaurusContext from "@docusaurus/useDocusaurusContext"; -import HomepageFeatures from "@site/src/components/homepage-features"; +import { HomepageFeatures } from "@site/src/components/homepage-features"; import Heading from "@theme/Heading"; import Layout from "@theme/Layout"; import clsx from "clsx"; diff --git a/apps/example/src/app.tsx b/apps/example/src/app.tsx index 8a2ad48c..dec1285d 100644 --- a/apps/example/src/app.tsx +++ b/apps/example/src/app.tsx @@ -1,4 +1,4 @@ -import config from "./config"; +import { config } from "./config"; import { IDLE, MutationError, PENDING } from "@reactive-dot/core"; import type { Wallet } from "@reactive-dot/core/wallets.js"; import { @@ -374,7 +374,7 @@ function Example(props: ExampleProps) { ); } -export default function App() { +export function App() { return ( diff --git a/apps/example/src/config.ts b/apps/example/src/config.ts index 64425484..66aaa99f 100644 --- a/apps/example/src/config.ts +++ b/apps/example/src/config.ts @@ -13,7 +13,7 @@ const smoldotPromise = startFromWorker( }), ); -const config = { +export const config = { chains: { polkadot: { descriptor: polkadot, @@ -60,5 +60,3 @@ const config = { }), ], } as const satisfies Config; - -export default config; diff --git a/apps/example/src/index.tsx b/apps/example/src/index.tsx index b50e6d84..91deada0 100644 --- a/apps/example/src/index.tsx +++ b/apps/example/src/index.tsx @@ -1,4 +1,4 @@ -import App from "./app.js"; +import { App } from "./app.js"; import "./index.css"; import React from "react"; import ReactDOM from "react-dom/client"; diff --git a/packages/core/src/actions/connect-wallet.ts b/packages/core/src/actions/connect-wallet.ts index f51b2949..3996a272 100644 --- a/packages/core/src/actions/connect-wallet.ts +++ b/packages/core/src/actions/connect-wallet.ts @@ -1,4 +1,4 @@ -import type Wallet from "../wallets/wallet.js"; +import type { Wallet } from "../wallets/wallet.js"; export async function connectWallet(wallet: Wallet | Wallet[]) { const walletsToConnect = Array.isArray(wallet) ? wallet : [wallet]; diff --git a/packages/core/src/actions/disconnect-wallet.ts b/packages/core/src/actions/disconnect-wallet.ts index 5f0cf2f3..c2efb059 100644 --- a/packages/core/src/actions/disconnect-wallet.ts +++ b/packages/core/src/actions/disconnect-wallet.ts @@ -1,4 +1,4 @@ -import type Wallet from "../wallets/wallet.js"; +import type { Wallet } from "../wallets/wallet.js"; export async function disconnectWallet(wallet: Wallet | Wallet[]) { const walletsToDisconnect = Array.isArray(wallet) ? wallet : [wallet]; diff --git a/packages/core/src/actions/get-accounts.ts b/packages/core/src/actions/get-accounts.ts index 5835e1c9..7a54fd07 100644 --- a/packages/core/src/actions/get-accounts.ts +++ b/packages/core/src/actions/get-accounts.ts @@ -1,6 +1,6 @@ import type { MaybeAsync } from "../types.js"; import { toObservable } from "../utils.js"; -import type Wallet from "../wallets/wallet.js"; +import type { Wallet } from "../wallets/wallet.js"; import type { ChainSpecData } from "@polkadot-api/substrate-client"; import { combineLatest } from "rxjs"; import { map, switchMap } from "rxjs/operators"; diff --git a/packages/core/src/actions/get-connected-wallets.ts b/packages/core/src/actions/get-connected-wallets.ts index fe805a31..6d454afa 100644 --- a/packages/core/src/actions/get-connected-wallets.ts +++ b/packages/core/src/actions/get-connected-wallets.ts @@ -1,6 +1,6 @@ import type { MaybeAsync } from "../types.js"; import { toObservable } from "../utils.js"; -import type Wallet from "../wallets/wallet.js"; +import type { Wallet } from "../wallets/wallet.js"; import { combineLatest } from "rxjs"; import { map, switchMap } from "rxjs/operators"; diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 4f9c62a8..36966977 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -1,5 +1,5 @@ export { - default as Query, + Query, type InferQueryPayload, type InferQueryResponse, type MultiInstruction, diff --git a/packages/core/src/query-builder.ts b/packages/core/src/query-builder.ts index 698a3396..4f5d3e9a 100644 --- a/packages/core/src/query-builder.ts +++ b/packages/core/src/query-builder.ts @@ -222,7 +222,7 @@ export type InferQueryPayload = ? InferInstructionsPayload : never; -export default class Query< +export class Query< const TInstructions extends QueryInstruction[] = QueryInstruction[], TDescriptor extends ChainDefinition = CommonDescriptor, > implements Query diff --git a/packages/core/src/wallets/aggregator/aggregator.ts b/packages/core/src/wallets/aggregator/aggregator.ts index 3a284336..69b35680 100644 --- a/packages/core/src/wallets/aggregator/aggregator.ts +++ b/packages/core/src/wallets/aggregator/aggregator.ts @@ -1,7 +1,7 @@ -import type Wallet from "../wallet.js"; +import type { Wallet } from "../wallet.js"; import type { Observable } from "rxjs"; -export default abstract class WalletAggregator { +export abstract class WalletAggregator { abstract scan(): Wallet[] | Promise; abstract readonly wallets$: Observable; diff --git a/packages/core/src/wallets/aggregator/index.ts b/packages/core/src/wallets/aggregator/index.ts index 9e6520d8..33838218 100644 --- a/packages/core/src/wallets/aggregator/index.ts +++ b/packages/core/src/wallets/aggregator/index.ts @@ -1,2 +1,2 @@ -export { default as WalletAggregator } from "./aggregator.js"; -export { default as InjectedWalletAggregator } from "./injected.js"; +export { WalletAggregator } from "./aggregator.js"; +export { InjectedWalletAggregator } from "./injected.js"; diff --git a/packages/core/src/wallets/aggregator/injected.ts b/packages/core/src/wallets/aggregator/injected.ts index fb0970c7..33f8d9af 100644 --- a/packages/core/src/wallets/aggregator/injected.ts +++ b/packages/core/src/wallets/aggregator/injected.ts @@ -1,11 +1,11 @@ -import InjectedWallet from "../injected.js"; +import { InjectedWallet } from "../injected.js"; import type { WalletOptions } from "../wallet.js"; -import WalletAggregator from "./aggregator.js"; +import { WalletAggregator } from "./aggregator.js"; import { getInjectedExtensions } from "polkadot-api/pjs-signer"; import { BehaviorSubject } from "rxjs"; import { map } from "rxjs/operators"; -export default class InjectedWalletAggregator extends WalletAggregator { +export class InjectedWalletAggregator extends WalletAggregator { #walletOptions: WalletOptions | undefined; constructor(options?: WalletOptions) { diff --git a/packages/core/src/wallets/deep-link.ts b/packages/core/src/wallets/deep-link.ts index 89e22e35..8d7f6ba3 100644 --- a/packages/core/src/wallets/deep-link.ts +++ b/packages/core/src/wallets/deep-link.ts @@ -1,11 +1,11 @@ -import Wallet from "./wallet.js"; +import { Wallet } from "./wallet.js"; type ConnectionHandshake = { uri: string; settled: Promise; }; -export default abstract class DeepLinkWallet extends Wallet { +export abstract class DeepLinkWallet extends Wallet { abstract initiateConnectionHandshake(): | ConnectionHandshake | Promise; diff --git a/packages/core/src/wallets/index.ts b/packages/core/src/wallets/index.ts index ce214644..a3d2ce3e 100644 --- a/packages/core/src/wallets/index.ts +++ b/packages/core/src/wallets/index.ts @@ -1,6 +1,6 @@ export * from "./aggregator/index.js"; -export { default as DeepLinkWallet } from "./deep-link.js"; +export { DeepLinkWallet } from "./deep-link.js"; export { initializeWallets } from "./initialize-wallets.js"; -export { default as InjectedWallet } from "./injected.js"; -export { default as WalletConnect } from "./wallet-connect/index.js"; -export { default as Wallet } from "./wallet.js"; +export { InjectedWallet } from "./injected.js"; +export { WalletConnect } from "./wallet-connect/index.js"; +export { Wallet } from "./wallet.js"; diff --git a/packages/core/src/wallets/initialize-wallets.ts b/packages/core/src/wallets/initialize-wallets.ts index 1dcac8a7..f69110e8 100644 --- a/packages/core/src/wallets/initialize-wallets.ts +++ b/packages/core/src/wallets/initialize-wallets.ts @@ -1,5 +1,5 @@ import { WalletAggregator } from "./aggregator/index.js"; -import type Wallet from "./wallet.js"; +import type { Wallet } from "./wallet.js"; export async function initializeWallets( walletsOrAggregators: Array, diff --git a/packages/core/src/wallets/injected.ts b/packages/core/src/wallets/injected.ts index 34b99025..9031a15d 100644 --- a/packages/core/src/wallets/injected.ts +++ b/packages/core/src/wallets/injected.ts @@ -1,5 +1,5 @@ import { ReDotError } from "../errors.js"; -import Wallet, { type WalletOptions } from "./wallet.js"; +import { Wallet, type WalletOptions } from "./wallet.js"; import { connectInjectedExtension, type InjectedExtension, @@ -8,7 +8,7 @@ import { import { BehaviorSubject, Observable } from "rxjs"; import { map, switchMap } from "rxjs/operators"; -export default class InjectedWallet extends Wallet { +export class InjectedWallet extends Wallet { readonly #extension$ = new BehaviorSubject( undefined, ); diff --git a/packages/core/src/wallets/wallet-connect/index.ts b/packages/core/src/wallets/wallet-connect/index.ts index e01e1238..bdda9e32 100644 --- a/packages/core/src/wallets/wallet-connect/index.ts +++ b/packages/core/src/wallets/wallet-connect/index.ts @@ -1,5 +1,5 @@ import { ReDotError } from "../../errors.js"; -import DeepLinkWallet from "../deep-link.js"; +import { DeepLinkWallet } from "../deep-link.js"; import { getPolkadotSignerFromPjs } from "./from-pjs-account.js"; import type { WalletConnectModal, @@ -14,7 +14,7 @@ import type { InjectedPolkadotAccount } from "polkadot-api/pjs-signer"; import { BehaviorSubject, lastValueFrom } from "rxjs"; import { map } from "rxjs/operators"; -export default class WalletConnect extends DeepLinkWallet { +export class WalletConnect extends DeepLinkWallet { readonly #providerOptions: UniversalProviderOpts; #provider: IUniversalProvider | undefined; diff --git a/packages/core/src/wallets/wallet.ts b/packages/core/src/wallets/wallet.ts index ec6b49ff..6565e3e4 100644 --- a/packages/core/src/wallets/wallet.ts +++ b/packages/core/src/wallets/wallet.ts @@ -6,7 +6,7 @@ export type WalletOptions = { storage?: PrefixedStorage | undefined; }; -export default abstract class Wallet { +export abstract class Wallet { abstract readonly id: string; abstract readonly name: string; diff --git a/packages/react/src/hooks/use-accounts.ts b/packages/react/src/hooks/use-accounts.ts index de00b0d9..1b668c5b 100644 --- a/packages/react/src/hooks/use-accounts.ts +++ b/packages/react/src/hooks/use-accounts.ts @@ -1,6 +1,6 @@ import { accountsAtom } from "../stores/accounts.js"; import type { ChainHookOptions } from "./types.js"; -import useChainId from "./use-chain-id.js"; +import { useChainId } from "./use-chain-id.js"; import { useAtomValue } from "jotai"; /** diff --git a/packages/react/src/hooks/use-block.ts b/packages/react/src/hooks/use-block.ts index e6b3a4e2..6d9b3434 100644 --- a/packages/react/src/hooks/use-block.ts +++ b/packages/react/src/hooks/use-block.ts @@ -3,7 +3,7 @@ import { finalizedBlockAtomFamily, } from "../stores/block.js"; import type { ChainHookOptions } from "./types.js"; -import useChainId from "./use-chain-id.js"; +import { useChainId } from "./use-chain-id.js"; import { useAtomValue } from "jotai"; /** diff --git a/packages/react/src/hooks/use-chain-id.ts b/packages/react/src/hooks/use-chain-id.ts index 5e90d4e9..ed65af50 100644 --- a/packages/react/src/hooks/use-chain-id.ts +++ b/packages/react/src/hooks/use-chain-id.ts @@ -3,7 +3,7 @@ import type { ChainHookOptions } from "./types.js"; import { ReDotError } from "@reactive-dot/core"; import { useContext } from "react"; -export default function useChainId(options?: ChainHookOptions) { +export function useChainId(options?: ChainHookOptions) { const contextChainId = useContext(ChainIdContext); const chainId = options?.chainId ?? contextChainId; diff --git a/packages/react/src/hooks/use-chain-spec-data.ts b/packages/react/src/hooks/use-chain-spec-data.ts index 18440e68..8b070a17 100644 --- a/packages/react/src/hooks/use-chain-spec-data.ts +++ b/packages/react/src/hooks/use-chain-spec-data.ts @@ -1,6 +1,6 @@ import { chainSpecDataAtomFamily } from "../stores/client.js"; import type { ChainHookOptions } from "./types.js"; -import useChainId from "./use-chain-id.js"; +import { useChainId } from "./use-chain-id.js"; import { useAtomValue } from "jotai"; /** diff --git a/packages/react/src/hooks/use-client.ts b/packages/react/src/hooks/use-client.ts index c8684944..2f60e3c8 100644 --- a/packages/react/src/hooks/use-client.ts +++ b/packages/react/src/hooks/use-client.ts @@ -1,6 +1,6 @@ import { clientAtomFamily } from "../stores/client.js"; import type { ChainHookOptions } from "./types.js"; -import useChainId from "./use-chain-id.js"; +import { useChainId } from "./use-chain-id.js"; import { useAtomValue } from "jotai"; /** diff --git a/packages/react/src/hooks/use-mutation.ts b/packages/react/src/hooks/use-mutation.ts index f66177e5..6311d18a 100644 --- a/packages/react/src/hooks/use-mutation.ts +++ b/packages/react/src/hooks/use-mutation.ts @@ -6,7 +6,7 @@ import { import { typedApiAtomFamily } from "../stores/client.js"; import type { ChainHookOptions } from "./types.js"; import { useAsyncState } from "./use-async-state.js"; -import useChainId from "./use-chain-id.js"; +import { useChainId } from "./use-chain-id.js"; import type { ChainId, Chains } from "@reactive-dot/core"; import { MutationError, PENDING } from "@reactive-dot/core"; import { useAtomCallback } from "jotai/utils"; diff --git a/packages/react/src/hooks/use-query.ts b/packages/react/src/hooks/use-query.ts index e1cf3eec..f319c941 100644 --- a/packages/react/src/hooks/use-query.ts +++ b/packages/react/src/hooks/use-query.ts @@ -5,7 +5,7 @@ import { import type { Falsy, FalsyGuard, FlatHead } from "../types.js"; import { flatHead, stringify } from "../utils/vanilla.js"; import type { ChainHookOptions } from "./types.js"; -import useChainId from "./use-chain-id.js"; +import { useChainId } from "./use-chain-id.js"; import { IDLE, Query, diff --git a/packages/react/src/hooks/use-typed-api.ts b/packages/react/src/hooks/use-typed-api.ts index 45261559..64d9d3b5 100644 --- a/packages/react/src/hooks/use-typed-api.ts +++ b/packages/react/src/hooks/use-typed-api.ts @@ -1,6 +1,6 @@ import { typedApiAtomFamily } from "../stores/client.js"; import type { ChainHookOptions } from "./types.js"; -import useChainId from "./use-chain-id.js"; +import { useChainId } from "./use-chain-id.js"; import type { ChainId, Chains } from "@reactive-dot/core"; import { useAtomValue } from "jotai"; import type { TypedApi } from "polkadot-api"; diff --git a/packages/utils/src/DenominatedNumber.test.ts b/packages/utils/src/denominated-number.test.ts similarity index 99% rename from packages/utils/src/DenominatedNumber.test.ts rename to packages/utils/src/denominated-number.test.ts index ae3e8d03..cd55149f 100644 --- a/packages/utils/src/DenominatedNumber.test.ts +++ b/packages/utils/src/denominated-number.test.ts @@ -1,4 +1,4 @@ -import DenominatedNumber from "./DenominatedNumber.js"; +import { DenominatedNumber } from "./denominated-number.js"; import { describe, expect, it } from "vitest"; describe("DenominatedNumber", () => { diff --git a/packages/utils/src/DenominatedNumber.ts b/packages/utils/src/denominated-number.ts similarity index 98% rename from packages/utils/src/DenominatedNumber.ts rename to packages/utils/src/denominated-number.ts index ebd74411..3404cae6 100644 --- a/packages/utils/src/DenominatedNumber.ts +++ b/packages/utils/src/denominated-number.ts @@ -1,4 +1,4 @@ -export default class DenominatedNumber extends Number { +export class DenominatedNumber extends Number { // Large values lead to massive memory usage. Limit to something sensible. static #maxDecimal = 100; diff --git a/packages/utils/src/index.ts b/packages/utils/src/index.ts index 9af811bc..7a7cd929 100644 --- a/packages/utils/src/index.ts +++ b/packages/utils/src/index.ts @@ -1 +1 @@ -export { default as DenominatedNumber } from "./DenominatedNumber.js"; +export { DenominatedNumber } from "./denominated-number.js";