@tuwaio/nova-connect 0.10.5 → 0.10.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/chunk-3M5KO5JH.cjs +1 -0
- package/dist/chunk-K2PZJCFY.cjs +2 -0
- package/dist/chunk-X5SXUZJR.js +1 -0
- package/dist/chunk-Y4JUUZX7.js +2 -0
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.cts +89 -32
- package/dist/components/index.d.ts +89 -32
- package/dist/components/index.js +1 -1
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.d.cts +44 -3
- package/dist/hooks/index.d.ts +44 -3
- package/dist/hooks/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.css +3 -0
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +17 -17
- package/dist/chunk-DRTK4IQH.js +0 -2
- package/dist/chunk-H3DXFMRX.cjs +0 -2
- package/dist/chunk-U6UN2I7D.cjs +0 -1
- package/dist/chunk-XB2YJOYJ.js +0 -1
|
@@ -4234,7 +4234,7 @@ type ConnectedModalCustomization = {
|
|
|
4234
4234
|
MainContent?: ComponentType<ConnectedModalMainContentSlotProps>;
|
|
4235
4235
|
/** Custom footer component */
|
|
4236
4236
|
Footer?: ComponentType<ConnectedModalFooterProps>;
|
|
4237
|
-
/** Custom
|
|
4237
|
+
/** Custom container of the opening animation (default: `motion.div`) */
|
|
4238
4238
|
MotionContainer?: ComponentType<ComponentPropsWithoutRef<typeof motion.div>>;
|
|
4239
4239
|
};
|
|
4240
4240
|
/** Custom class name generators */
|
|
@@ -4252,7 +4252,7 @@ type ConnectedModalCustomization = {
|
|
|
4252
4252
|
hasActiveWallet: boolean;
|
|
4253
4253
|
}) => string;
|
|
4254
4254
|
/**
|
|
4255
|
-
* Returns the classes of the
|
|
4255
|
+
* Returns the classes of the container of the opening animation.
|
|
4256
4256
|
*
|
|
4257
4257
|
* @returns The classes.
|
|
4258
4258
|
*/
|
|
@@ -4326,11 +4326,25 @@ type ConnectedModalCustomization = {
|
|
|
4326
4326
|
/** Animation delay in seconds */
|
|
4327
4327
|
delay?: number;
|
|
4328
4328
|
};
|
|
4329
|
-
/**
|
|
4329
|
+
/**
|
|
4330
|
+
* The former layout animation between screens.
|
|
4331
|
+
*
|
|
4332
|
+
* @deprecated No longer applied: a layout animation stretched the window for a frame after a size change, and
|
|
4333
|
+
* `DialogContent` of `@tuwaio/nova-core` follows the height of the content. It will be removed in the next major
|
|
4334
|
+
* version.
|
|
4335
|
+
*/
|
|
4330
4336
|
layout?: {
|
|
4331
|
-
/**
|
|
4337
|
+
/**
|
|
4338
|
+
* Animation duration in seconds.
|
|
4339
|
+
*
|
|
4340
|
+
* @deprecated No longer applied.
|
|
4341
|
+
*/
|
|
4332
4342
|
duration?: number;
|
|
4333
|
-
/**
|
|
4343
|
+
/**
|
|
4344
|
+
* Animation easing curve.
|
|
4345
|
+
*
|
|
4346
|
+
* @deprecated No longer applied.
|
|
4347
|
+
*/
|
|
4334
4348
|
ease?: Easing | Easing[];
|
|
4335
4349
|
};
|
|
4336
4350
|
};
|
|
@@ -4369,7 +4383,7 @@ type ConnectedModalCustomization = {
|
|
|
4369
4383
|
};
|
|
4370
4384
|
/** Configuration options */
|
|
4371
4385
|
config?: {
|
|
4372
|
-
/** Disables the
|
|
4386
|
+
/** Disables the opening animation of the modal (default: `false`) */
|
|
4373
4387
|
disableAnimation?: boolean;
|
|
4374
4388
|
/** Same as `disableAnimation` (default: `false`) */
|
|
4375
4389
|
reduceMotion?: boolean;
|
|
@@ -6036,13 +6050,12 @@ interface ConnectorsBlockProps extends Pick<ConnectorsSelectionsProps, 'setIsOpe
|
|
|
6036
6050
|
* ```tsx
|
|
6037
6051
|
* import { getFilteredConnectors } from '@tuwaio/nova-connect';
|
|
6038
6052
|
* import { ConnectorsBlock } from '@tuwaio/nova-connect/components';
|
|
6039
|
-
* import { useNovaConnect } from '@tuwaio/nova-connect/hooks';
|
|
6040
|
-
* import { useSatelliteConnectStore } from '@tuwaio/nova-connect/satellite';
|
|
6053
|
+
* import { useNovaConnect, useWalletConnectors } from '@tuwaio/nova-connect/hooks';
|
|
6041
6054
|
* import { OrbitAdapter } from '@tuwaio/orbit-core';
|
|
6042
6055
|
* import { mainnet } from 'viem/chains';
|
|
6043
6056
|
*
|
|
6044
6057
|
* export function InstalledWallets() {
|
|
6045
|
-
* const
|
|
6058
|
+
* const connectors = useWalletConnectors() ?? {};
|
|
6046
6059
|
* const { setIsConnected, setIsConnectModalOpen } = useNovaConnect();
|
|
6047
6060
|
*
|
|
6048
6061
|
* return (
|
|
@@ -6050,7 +6063,7 @@ interface ConnectorsBlockProps extends Pick<ConnectorsSelectionsProps, 'setIsOpe
|
|
|
6050
6063
|
* title="Installed"
|
|
6051
6064
|
* isTitleBold
|
|
6052
6065
|
* selectedAdapter={OrbitAdapter.EVM}
|
|
6053
|
-
* connectors={getFilteredConnectors({ connectors
|
|
6066
|
+
* connectors={getFilteredConnectors({ connectors, selectedAdapter: OrbitAdapter.EVM })}
|
|
6054
6067
|
* onClick={(connector) => console.log('selected', connector.name)}
|
|
6055
6068
|
* setIsConnected={setIsConnected}
|
|
6056
6069
|
* setIsOpen={setIsConnectModalOpen}
|
|
@@ -6752,19 +6765,18 @@ interface ConnectorsSelectionsProps extends InitialChains {
|
|
|
6752
6765
|
* ```tsx
|
|
6753
6766
|
* import { getFilteredConnectors } from '@tuwaio/nova-connect';
|
|
6754
6767
|
* import { ConnectorsSelections } from '@tuwaio/nova-connect/components';
|
|
6755
|
-
* import { useNovaConnect } from '@tuwaio/nova-connect/hooks';
|
|
6756
|
-
* import { useSatelliteConnectStore } from '@tuwaio/nova-connect/satellite';
|
|
6768
|
+
* import { useNovaConnect, useWalletConnectors } from '@tuwaio/nova-connect/hooks';
|
|
6757
6769
|
* import { OrbitAdapter } from '@tuwaio/orbit-core';
|
|
6758
6770
|
* import { mainnet } from 'viem/chains';
|
|
6759
6771
|
*
|
|
6760
6772
|
* export function EvmWallets() {
|
|
6761
|
-
* const
|
|
6773
|
+
* const connectors = useWalletConnectors() ?? {};
|
|
6762
6774
|
* const { setIsConnected, setIsConnectModalOpen, setConnectModalContentType } = useNovaConnect();
|
|
6763
6775
|
*
|
|
6764
6776
|
* return (
|
|
6765
6777
|
* <ConnectorsSelections
|
|
6766
6778
|
* selectedAdapter={OrbitAdapter.EVM}
|
|
6767
|
-
* connectors={getFilteredConnectors({ connectors
|
|
6779
|
+
* connectors={getFilteredConnectors({ connectors, selectedAdapter: OrbitAdapter.EVM })}
|
|
6768
6780
|
* onClick={(connector) => console.log('selected', connector.name)}
|
|
6769
6781
|
* setIsConnected={setIsConnected}
|
|
6770
6782
|
* setIsOpen={setIsConnectModalOpen}
|
|
@@ -8067,17 +8079,18 @@ interface NetworkSelectionsProps {
|
|
|
8067
8079
|
* ```tsx
|
|
8068
8080
|
* import { getFilteredConnectors } from '@tuwaio/nova-connect';
|
|
8069
8081
|
* import { NetworkSelections } from '@tuwaio/nova-connect/components';
|
|
8082
|
+
* import { useWalletConnectors } from '@tuwaio/nova-connect/hooks';
|
|
8070
8083
|
* import { useSatelliteConnectStore } from '@tuwaio/nova-connect/satellite';
|
|
8071
8084
|
* import { OrbitAdapter } from '@tuwaio/orbit-core';
|
|
8072
8085
|
*
|
|
8073
8086
|
* export function MetaMaskNetworks() {
|
|
8074
|
-
* const
|
|
8087
|
+
* const connectors = useWalletConnectors() ?? {};
|
|
8075
8088
|
* const connect = useSatelliteConnectStore((store) => store.connect);
|
|
8076
8089
|
*
|
|
8077
8090
|
* return (
|
|
8078
8091
|
* <NetworkSelections
|
|
8079
8092
|
* activeConnector="metamask"
|
|
8080
|
-
* connectors={getFilteredConnectors({ connectors
|
|
8093
|
+
* connectors={getFilteredConnectors({ connectors })}
|
|
8081
8094
|
* onClick={(adapter, connectorType) =>
|
|
8082
8095
|
* connect({ connectorType, chainId: adapter === OrbitAdapter.EVM ? 1 : 'solana:devnet' })
|
|
8083
8096
|
* }
|
|
@@ -8567,7 +8580,10 @@ interface ConnectModalData {
|
|
|
8567
8580
|
isOpen: boolean;
|
|
8568
8581
|
/** `connectionError` of the Satellite store, or `null` */
|
|
8569
8582
|
error: Error | TuwaErrorState | null | undefined;
|
|
8570
|
-
/**
|
|
8583
|
+
/**
|
|
8584
|
+
* Connectors of the Satellite store by adapter (`useWalletConnectors`: updated while the modal is open when wallets are
|
|
8585
|
+
* added or removed; `undefined` while the modal is closed)
|
|
8586
|
+
*/
|
|
8571
8587
|
connectors: Record<string, Connector[]>;
|
|
8572
8588
|
/** Filtered connectors for current adapter */
|
|
8573
8589
|
filteredConnectors: GroupedConnector[];
|
|
@@ -8588,11 +8604,23 @@ interface BottomButtonConfig {
|
|
|
8588
8604
|
loading?: boolean;
|
|
8589
8605
|
}
|
|
8590
8606
|
/**
|
|
8591
|
-
* Props for a custom container of the modal content.
|
|
8607
|
+
* Props for a custom container of the modal content (`customization.components.ModalContainer`). To keep the height of
|
|
8608
|
+
* the wallet list on the network and connecting screens, a custom container forwards `ref` to its element (the modal
|
|
8609
|
+
* measures it on the wallet list), passes `className` and `style` to it and is a flex column; a custom `MainContent` is a
|
|
8610
|
+
* flex container. Without `ref`, these screens take the height of their content.
|
|
8592
8611
|
*/
|
|
8593
8612
|
type ConnectModalContainerProps = {
|
|
8594
|
-
/**
|
|
8613
|
+
/**
|
|
8614
|
+
* Classes from `classNames.modalContainer`; on the `network` and `connecting` screens, preceded by
|
|
8615
|
+
* `novacon:min-h-[min(var(--novacon-connect-list-height),calc(100dvh_-_2rem))]`, which keeps the height of the wallet
|
|
8616
|
+
* list (at most the height of the window less 2rem)
|
|
8617
|
+
*/
|
|
8595
8618
|
className?: string;
|
|
8619
|
+
/**
|
|
8620
|
+
* On the `network` and `connecting` screens, the `--novacon-connect-list-height` variable: the height of the wallet
|
|
8621
|
+
* list shown before them, in pixels
|
|
8622
|
+
*/
|
|
8623
|
+
style?: React__default.CSSProperties;
|
|
8596
8624
|
/** The header, main content and footer */
|
|
8597
8625
|
children: React__default.ReactNode;
|
|
8598
8626
|
/** State of the modal */
|
|
@@ -8758,7 +8786,10 @@ type ConnectModalCustomization = {
|
|
|
8758
8786
|
Dialog?: ComponentType<ComponentPropsWithoutRef<typeof Dialog>>;
|
|
8759
8787
|
/** Custom dialog content (default: `DialogContent` from `@tuwaio/nova-core`) */
|
|
8760
8788
|
DialogContent?: ComponentType<ComponentPropsWithoutRef<typeof DialogContent>>;
|
|
8761
|
-
/**
|
|
8789
|
+
/**
|
|
8790
|
+
* Custom wrapper of the screens (default: `motion.div`). It receives `layoutRoot`: the layout animations inside it
|
|
8791
|
+
* (the network tabs) are measured relative to it, so they do not follow the window when it moves to stay centered.
|
|
8792
|
+
*/
|
|
8762
8793
|
MotionDiv?: ComponentType<ComponentPropsWithoutRef<typeof motion.div>>;
|
|
8763
8794
|
/** Custom empty state */
|
|
8764
8795
|
EmptyState?: ComponentType<ConnectModalEmptyProps>;
|
|
@@ -8968,11 +8999,24 @@ type ConnectModalCustomization = {
|
|
|
8968
8999
|
*/
|
|
8969
9000
|
backButton?: (modalData: ConnectModalData) => string;
|
|
8970
9001
|
};
|
|
8971
|
-
/**
|
|
9002
|
+
/**
|
|
9003
|
+
* Animation configuration.
|
|
9004
|
+
*
|
|
9005
|
+
* @deprecated No longer applied: the screens have no layout transition, and `DialogContent` of
|
|
9006
|
+
* `@tuwaio/nova-core` follows the height of the content. It will be removed in the next major version.
|
|
9007
|
+
*/
|
|
8972
9008
|
animation?: {
|
|
8973
|
-
/**
|
|
9009
|
+
/**
|
|
9010
|
+
* Duration of the former layout transition between screens, in seconds.
|
|
9011
|
+
*
|
|
9012
|
+
* @deprecated No longer applied (a layout transition stretched the window for a frame after a size change).
|
|
9013
|
+
*/
|
|
8974
9014
|
layoutDuration?: number;
|
|
8975
|
-
/**
|
|
9015
|
+
/**
|
|
9016
|
+
* Set the duration of the former layout transition to `0`.
|
|
9017
|
+
*
|
|
9018
|
+
* @deprecated No longer applied.
|
|
9019
|
+
*/
|
|
8976
9020
|
disabled?: boolean;
|
|
8977
9021
|
};
|
|
8978
9022
|
};
|
|
@@ -9012,8 +9056,11 @@ interface ConnectModalProps extends InitialChains {
|
|
|
9012
9056
|
*
|
|
9013
9057
|
* Opening the modal resets it to the wallet list. A wallet connects through `connect` of the Satellite store to the
|
|
9014
9058
|
* first chain of `appChains` (EVM) or the first cluster of `solanaRPCUrls` (Solana), and the modal closes 400 ms after
|
|
9015
|
-
* the wallet reports the connection (it waits up to 10 seconds).
|
|
9016
|
-
*
|
|
9059
|
+
* the wallet reports the connection (it waits up to 10 seconds). The network and connecting screens keep the height of
|
|
9060
|
+
* the wallet list (measured with a `ResizeObserver` while the list is shown and forgotten when the modal closes; at most
|
|
9061
|
+
* the height of the window less 2rem), with the footer at the bottom and the connection status in the middle, so
|
|
9062
|
+
* choosing a wallet, its network and going back do not resize the modal. Texts
|
|
9063
|
+
* come from the Nova Connect labels, except a few English accessibility texts.
|
|
9017
9064
|
*
|
|
9018
9065
|
* Props: {@link ConnectModalProps}.
|
|
9019
9066
|
*
|
|
@@ -9053,7 +9100,10 @@ type ConnectionState = 'connecting' | 'success' | 'error';
|
|
|
9053
9100
|
interface ConnectingStatusData {
|
|
9054
9101
|
/** Connection state */
|
|
9055
9102
|
state: ConnectionState;
|
|
9056
|
-
/**
|
|
9103
|
+
/**
|
|
9104
|
+
* The heading: `customErrorMessage` or the `connectionError` label, `connectedSuccessfully`, or `connectingTo`
|
|
9105
|
+
* followed by the name of the wallet (the `name` of `currentConnector`, such as `MetaMask`)
|
|
9106
|
+
*/
|
|
9057
9107
|
message: string;
|
|
9058
9108
|
/**
|
|
9059
9109
|
* Text under the heading in the `error` state (`customErrorMessage` with `showDetailedError`, or the
|
|
@@ -9064,7 +9114,10 @@ interface ConnectingStatusData {
|
|
|
9064
9114
|
activeConnector: string | undefined;
|
|
9065
9115
|
/** The `selectedAdapter` prop */
|
|
9066
9116
|
selectedAdapter: OrbitAdapter | undefined;
|
|
9067
|
-
/**
|
|
9117
|
+
/**
|
|
9118
|
+
* The wallet of `connectors` whose connector type (`formatConnectorName` of its name) is `activeConnector`, or, when
|
|
9119
|
+
* none is, the first one whose connector type contains it
|
|
9120
|
+
*/
|
|
9068
9121
|
currentConnector: GroupedConnector | null;
|
|
9069
9122
|
/** The `showDetailedError` prop */
|
|
9070
9123
|
showDetailedError: boolean;
|
|
@@ -9397,12 +9450,14 @@ type ConnectingCustomization = {
|
|
|
9397
9450
|
*/
|
|
9398
9451
|
interface ConnectingProps {
|
|
9399
9452
|
/**
|
|
9400
|
-
* The wallet being connected, as `formatConnectorName` of `@tuwaio/orbit-core` returns it (for example `metamask`)
|
|
9453
|
+
* The wallet being connected, as `formatConnectorName` of `@tuwaio/orbit-core` returns it (for example `metamask`).
|
|
9454
|
+
* The texts name the wallet of `connectors` with exactly this connector type (`MetaMask`), or, when none has it, the
|
|
9455
|
+
* first one whose connector type contains it, or this value when none does.
|
|
9401
9456
|
*/
|
|
9402
9457
|
activeConnector: string | undefined;
|
|
9403
9458
|
/** Selected orbit adapter for the connection */
|
|
9404
9459
|
selectedAdapter: OrbitAdapter | undefined;
|
|
9405
|
-
/** Wallets with their connectors (the icon
|
|
9460
|
+
/** Wallets with their connectors (the icon and the name come from the wallet matching `activeConnector`) */
|
|
9406
9461
|
connectors: GroupedConnector[];
|
|
9407
9462
|
/** Whether the wallet connection is successfully established */
|
|
9408
9463
|
isConnected: boolean;
|
|
@@ -9425,12 +9480,14 @@ interface ConnectingProps {
|
|
|
9425
9480
|
* ```tsx
|
|
9426
9481
|
* import { getFilteredConnectors } from '@tuwaio/nova-connect';
|
|
9427
9482
|
* import { Connecting } from '@tuwaio/nova-connect/components';
|
|
9428
|
-
* import {
|
|
9483
|
+
* import { useWalletConnectors } from '@tuwaio/nova-connect/hooks';
|
|
9429
9484
|
* import { OrbitAdapter } from '@tuwaio/orbit-core';
|
|
9430
9485
|
*
|
|
9431
9486
|
* export function MetaMaskStatus({ isConnected }: { isConnected: boolean }) {
|
|
9432
|
-
* const
|
|
9433
|
-
*
|
|
9487
|
+
* const connectors = getFilteredConnectors({
|
|
9488
|
+
* connectors: useWalletConnectors() ?? {},
|
|
9489
|
+
* selectedAdapter: OrbitAdapter.EVM,
|
|
9490
|
+
* });
|
|
9434
9491
|
*
|
|
9435
9492
|
* return (
|
|
9436
9493
|
* <Connecting
|
|
@@ -4234,7 +4234,7 @@ type ConnectedModalCustomization = {
|
|
|
4234
4234
|
MainContent?: ComponentType<ConnectedModalMainContentSlotProps>;
|
|
4235
4235
|
/** Custom footer component */
|
|
4236
4236
|
Footer?: ComponentType<ConnectedModalFooterProps>;
|
|
4237
|
-
/** Custom
|
|
4237
|
+
/** Custom container of the opening animation (default: `motion.div`) */
|
|
4238
4238
|
MotionContainer?: ComponentType<ComponentPropsWithoutRef<typeof motion.div>>;
|
|
4239
4239
|
};
|
|
4240
4240
|
/** Custom class name generators */
|
|
@@ -4252,7 +4252,7 @@ type ConnectedModalCustomization = {
|
|
|
4252
4252
|
hasActiveWallet: boolean;
|
|
4253
4253
|
}) => string;
|
|
4254
4254
|
/**
|
|
4255
|
-
* Returns the classes of the
|
|
4255
|
+
* Returns the classes of the container of the opening animation.
|
|
4256
4256
|
*
|
|
4257
4257
|
* @returns The classes.
|
|
4258
4258
|
*/
|
|
@@ -4326,11 +4326,25 @@ type ConnectedModalCustomization = {
|
|
|
4326
4326
|
/** Animation delay in seconds */
|
|
4327
4327
|
delay?: number;
|
|
4328
4328
|
};
|
|
4329
|
-
/**
|
|
4329
|
+
/**
|
|
4330
|
+
* The former layout animation between screens.
|
|
4331
|
+
*
|
|
4332
|
+
* @deprecated No longer applied: a layout animation stretched the window for a frame after a size change, and
|
|
4333
|
+
* `DialogContent` of `@tuwaio/nova-core` follows the height of the content. It will be removed in the next major
|
|
4334
|
+
* version.
|
|
4335
|
+
*/
|
|
4330
4336
|
layout?: {
|
|
4331
|
-
/**
|
|
4337
|
+
/**
|
|
4338
|
+
* Animation duration in seconds.
|
|
4339
|
+
*
|
|
4340
|
+
* @deprecated No longer applied.
|
|
4341
|
+
*/
|
|
4332
4342
|
duration?: number;
|
|
4333
|
-
/**
|
|
4343
|
+
/**
|
|
4344
|
+
* Animation easing curve.
|
|
4345
|
+
*
|
|
4346
|
+
* @deprecated No longer applied.
|
|
4347
|
+
*/
|
|
4334
4348
|
ease?: Easing | Easing[];
|
|
4335
4349
|
};
|
|
4336
4350
|
};
|
|
@@ -4369,7 +4383,7 @@ type ConnectedModalCustomization = {
|
|
|
4369
4383
|
};
|
|
4370
4384
|
/** Configuration options */
|
|
4371
4385
|
config?: {
|
|
4372
|
-
/** Disables the
|
|
4386
|
+
/** Disables the opening animation of the modal (default: `false`) */
|
|
4373
4387
|
disableAnimation?: boolean;
|
|
4374
4388
|
/** Same as `disableAnimation` (default: `false`) */
|
|
4375
4389
|
reduceMotion?: boolean;
|
|
@@ -6036,13 +6050,12 @@ interface ConnectorsBlockProps extends Pick<ConnectorsSelectionsProps, 'setIsOpe
|
|
|
6036
6050
|
* ```tsx
|
|
6037
6051
|
* import { getFilteredConnectors } from '@tuwaio/nova-connect';
|
|
6038
6052
|
* import { ConnectorsBlock } from '@tuwaio/nova-connect/components';
|
|
6039
|
-
* import { useNovaConnect } from '@tuwaio/nova-connect/hooks';
|
|
6040
|
-
* import { useSatelliteConnectStore } from '@tuwaio/nova-connect/satellite';
|
|
6053
|
+
* import { useNovaConnect, useWalletConnectors } from '@tuwaio/nova-connect/hooks';
|
|
6041
6054
|
* import { OrbitAdapter } from '@tuwaio/orbit-core';
|
|
6042
6055
|
* import { mainnet } from 'viem/chains';
|
|
6043
6056
|
*
|
|
6044
6057
|
* export function InstalledWallets() {
|
|
6045
|
-
* const
|
|
6058
|
+
* const connectors = useWalletConnectors() ?? {};
|
|
6046
6059
|
* const { setIsConnected, setIsConnectModalOpen } = useNovaConnect();
|
|
6047
6060
|
*
|
|
6048
6061
|
* return (
|
|
@@ -6050,7 +6063,7 @@ interface ConnectorsBlockProps extends Pick<ConnectorsSelectionsProps, 'setIsOpe
|
|
|
6050
6063
|
* title="Installed"
|
|
6051
6064
|
* isTitleBold
|
|
6052
6065
|
* selectedAdapter={OrbitAdapter.EVM}
|
|
6053
|
-
* connectors={getFilteredConnectors({ connectors
|
|
6066
|
+
* connectors={getFilteredConnectors({ connectors, selectedAdapter: OrbitAdapter.EVM })}
|
|
6054
6067
|
* onClick={(connector) => console.log('selected', connector.name)}
|
|
6055
6068
|
* setIsConnected={setIsConnected}
|
|
6056
6069
|
* setIsOpen={setIsConnectModalOpen}
|
|
@@ -6752,19 +6765,18 @@ interface ConnectorsSelectionsProps extends InitialChains {
|
|
|
6752
6765
|
* ```tsx
|
|
6753
6766
|
* import { getFilteredConnectors } from '@tuwaio/nova-connect';
|
|
6754
6767
|
* import { ConnectorsSelections } from '@tuwaio/nova-connect/components';
|
|
6755
|
-
* import { useNovaConnect } from '@tuwaio/nova-connect/hooks';
|
|
6756
|
-
* import { useSatelliteConnectStore } from '@tuwaio/nova-connect/satellite';
|
|
6768
|
+
* import { useNovaConnect, useWalletConnectors } from '@tuwaio/nova-connect/hooks';
|
|
6757
6769
|
* import { OrbitAdapter } from '@tuwaio/orbit-core';
|
|
6758
6770
|
* import { mainnet } from 'viem/chains';
|
|
6759
6771
|
*
|
|
6760
6772
|
* export function EvmWallets() {
|
|
6761
|
-
* const
|
|
6773
|
+
* const connectors = useWalletConnectors() ?? {};
|
|
6762
6774
|
* const { setIsConnected, setIsConnectModalOpen, setConnectModalContentType } = useNovaConnect();
|
|
6763
6775
|
*
|
|
6764
6776
|
* return (
|
|
6765
6777
|
* <ConnectorsSelections
|
|
6766
6778
|
* selectedAdapter={OrbitAdapter.EVM}
|
|
6767
|
-
* connectors={getFilteredConnectors({ connectors
|
|
6779
|
+
* connectors={getFilteredConnectors({ connectors, selectedAdapter: OrbitAdapter.EVM })}
|
|
6768
6780
|
* onClick={(connector) => console.log('selected', connector.name)}
|
|
6769
6781
|
* setIsConnected={setIsConnected}
|
|
6770
6782
|
* setIsOpen={setIsConnectModalOpen}
|
|
@@ -8067,17 +8079,18 @@ interface NetworkSelectionsProps {
|
|
|
8067
8079
|
* ```tsx
|
|
8068
8080
|
* import { getFilteredConnectors } from '@tuwaio/nova-connect';
|
|
8069
8081
|
* import { NetworkSelections } from '@tuwaio/nova-connect/components';
|
|
8082
|
+
* import { useWalletConnectors } from '@tuwaio/nova-connect/hooks';
|
|
8070
8083
|
* import { useSatelliteConnectStore } from '@tuwaio/nova-connect/satellite';
|
|
8071
8084
|
* import { OrbitAdapter } from '@tuwaio/orbit-core';
|
|
8072
8085
|
*
|
|
8073
8086
|
* export function MetaMaskNetworks() {
|
|
8074
|
-
* const
|
|
8087
|
+
* const connectors = useWalletConnectors() ?? {};
|
|
8075
8088
|
* const connect = useSatelliteConnectStore((store) => store.connect);
|
|
8076
8089
|
*
|
|
8077
8090
|
* return (
|
|
8078
8091
|
* <NetworkSelections
|
|
8079
8092
|
* activeConnector="metamask"
|
|
8080
|
-
* connectors={getFilteredConnectors({ connectors
|
|
8093
|
+
* connectors={getFilteredConnectors({ connectors })}
|
|
8081
8094
|
* onClick={(adapter, connectorType) =>
|
|
8082
8095
|
* connect({ connectorType, chainId: adapter === OrbitAdapter.EVM ? 1 : 'solana:devnet' })
|
|
8083
8096
|
* }
|
|
@@ -8567,7 +8580,10 @@ interface ConnectModalData {
|
|
|
8567
8580
|
isOpen: boolean;
|
|
8568
8581
|
/** `connectionError` of the Satellite store, or `null` */
|
|
8569
8582
|
error: Error | TuwaErrorState | null | undefined;
|
|
8570
|
-
/**
|
|
8583
|
+
/**
|
|
8584
|
+
* Connectors of the Satellite store by adapter (`useWalletConnectors`: updated while the modal is open when wallets are
|
|
8585
|
+
* added or removed; `undefined` while the modal is closed)
|
|
8586
|
+
*/
|
|
8571
8587
|
connectors: Record<string, Connector[]>;
|
|
8572
8588
|
/** Filtered connectors for current adapter */
|
|
8573
8589
|
filteredConnectors: GroupedConnector[];
|
|
@@ -8588,11 +8604,23 @@ interface BottomButtonConfig {
|
|
|
8588
8604
|
loading?: boolean;
|
|
8589
8605
|
}
|
|
8590
8606
|
/**
|
|
8591
|
-
* Props for a custom container of the modal content.
|
|
8607
|
+
* Props for a custom container of the modal content (`customization.components.ModalContainer`). To keep the height of
|
|
8608
|
+
* the wallet list on the network and connecting screens, a custom container forwards `ref` to its element (the modal
|
|
8609
|
+
* measures it on the wallet list), passes `className` and `style` to it and is a flex column; a custom `MainContent` is a
|
|
8610
|
+
* flex container. Without `ref`, these screens take the height of their content.
|
|
8592
8611
|
*/
|
|
8593
8612
|
type ConnectModalContainerProps = {
|
|
8594
|
-
/**
|
|
8613
|
+
/**
|
|
8614
|
+
* Classes from `classNames.modalContainer`; on the `network` and `connecting` screens, preceded by
|
|
8615
|
+
* `novacon:min-h-[min(var(--novacon-connect-list-height),calc(100dvh_-_2rem))]`, which keeps the height of the wallet
|
|
8616
|
+
* list (at most the height of the window less 2rem)
|
|
8617
|
+
*/
|
|
8595
8618
|
className?: string;
|
|
8619
|
+
/**
|
|
8620
|
+
* On the `network` and `connecting` screens, the `--novacon-connect-list-height` variable: the height of the wallet
|
|
8621
|
+
* list shown before them, in pixels
|
|
8622
|
+
*/
|
|
8623
|
+
style?: React__default.CSSProperties;
|
|
8596
8624
|
/** The header, main content and footer */
|
|
8597
8625
|
children: React__default.ReactNode;
|
|
8598
8626
|
/** State of the modal */
|
|
@@ -8758,7 +8786,10 @@ type ConnectModalCustomization = {
|
|
|
8758
8786
|
Dialog?: ComponentType<ComponentPropsWithoutRef<typeof Dialog>>;
|
|
8759
8787
|
/** Custom dialog content (default: `DialogContent` from `@tuwaio/nova-core`) */
|
|
8760
8788
|
DialogContent?: ComponentType<ComponentPropsWithoutRef<typeof DialogContent>>;
|
|
8761
|
-
/**
|
|
8789
|
+
/**
|
|
8790
|
+
* Custom wrapper of the screens (default: `motion.div`). It receives `layoutRoot`: the layout animations inside it
|
|
8791
|
+
* (the network tabs) are measured relative to it, so they do not follow the window when it moves to stay centered.
|
|
8792
|
+
*/
|
|
8762
8793
|
MotionDiv?: ComponentType<ComponentPropsWithoutRef<typeof motion.div>>;
|
|
8763
8794
|
/** Custom empty state */
|
|
8764
8795
|
EmptyState?: ComponentType<ConnectModalEmptyProps>;
|
|
@@ -8968,11 +8999,24 @@ type ConnectModalCustomization = {
|
|
|
8968
8999
|
*/
|
|
8969
9000
|
backButton?: (modalData: ConnectModalData) => string;
|
|
8970
9001
|
};
|
|
8971
|
-
/**
|
|
9002
|
+
/**
|
|
9003
|
+
* Animation configuration.
|
|
9004
|
+
*
|
|
9005
|
+
* @deprecated No longer applied: the screens have no layout transition, and `DialogContent` of
|
|
9006
|
+
* `@tuwaio/nova-core` follows the height of the content. It will be removed in the next major version.
|
|
9007
|
+
*/
|
|
8972
9008
|
animation?: {
|
|
8973
|
-
/**
|
|
9009
|
+
/**
|
|
9010
|
+
* Duration of the former layout transition between screens, in seconds.
|
|
9011
|
+
*
|
|
9012
|
+
* @deprecated No longer applied (a layout transition stretched the window for a frame after a size change).
|
|
9013
|
+
*/
|
|
8974
9014
|
layoutDuration?: number;
|
|
8975
|
-
/**
|
|
9015
|
+
/**
|
|
9016
|
+
* Set the duration of the former layout transition to `0`.
|
|
9017
|
+
*
|
|
9018
|
+
* @deprecated No longer applied.
|
|
9019
|
+
*/
|
|
8976
9020
|
disabled?: boolean;
|
|
8977
9021
|
};
|
|
8978
9022
|
};
|
|
@@ -9012,8 +9056,11 @@ interface ConnectModalProps extends InitialChains {
|
|
|
9012
9056
|
*
|
|
9013
9057
|
* Opening the modal resets it to the wallet list. A wallet connects through `connect` of the Satellite store to the
|
|
9014
9058
|
* first chain of `appChains` (EVM) or the first cluster of `solanaRPCUrls` (Solana), and the modal closes 400 ms after
|
|
9015
|
-
* the wallet reports the connection (it waits up to 10 seconds).
|
|
9016
|
-
*
|
|
9059
|
+
* the wallet reports the connection (it waits up to 10 seconds). The network and connecting screens keep the height of
|
|
9060
|
+
* the wallet list (measured with a `ResizeObserver` while the list is shown and forgotten when the modal closes; at most
|
|
9061
|
+
* the height of the window less 2rem), with the footer at the bottom and the connection status in the middle, so
|
|
9062
|
+
* choosing a wallet, its network and going back do not resize the modal. Texts
|
|
9063
|
+
* come from the Nova Connect labels, except a few English accessibility texts.
|
|
9017
9064
|
*
|
|
9018
9065
|
* Props: {@link ConnectModalProps}.
|
|
9019
9066
|
*
|
|
@@ -9053,7 +9100,10 @@ type ConnectionState = 'connecting' | 'success' | 'error';
|
|
|
9053
9100
|
interface ConnectingStatusData {
|
|
9054
9101
|
/** Connection state */
|
|
9055
9102
|
state: ConnectionState;
|
|
9056
|
-
/**
|
|
9103
|
+
/**
|
|
9104
|
+
* The heading: `customErrorMessage` or the `connectionError` label, `connectedSuccessfully`, or `connectingTo`
|
|
9105
|
+
* followed by the name of the wallet (the `name` of `currentConnector`, such as `MetaMask`)
|
|
9106
|
+
*/
|
|
9057
9107
|
message: string;
|
|
9058
9108
|
/**
|
|
9059
9109
|
* Text under the heading in the `error` state (`customErrorMessage` with `showDetailedError`, or the
|
|
@@ -9064,7 +9114,10 @@ interface ConnectingStatusData {
|
|
|
9064
9114
|
activeConnector: string | undefined;
|
|
9065
9115
|
/** The `selectedAdapter` prop */
|
|
9066
9116
|
selectedAdapter: OrbitAdapter | undefined;
|
|
9067
|
-
/**
|
|
9117
|
+
/**
|
|
9118
|
+
* The wallet of `connectors` whose connector type (`formatConnectorName` of its name) is `activeConnector`, or, when
|
|
9119
|
+
* none is, the first one whose connector type contains it
|
|
9120
|
+
*/
|
|
9068
9121
|
currentConnector: GroupedConnector | null;
|
|
9069
9122
|
/** The `showDetailedError` prop */
|
|
9070
9123
|
showDetailedError: boolean;
|
|
@@ -9397,12 +9450,14 @@ type ConnectingCustomization = {
|
|
|
9397
9450
|
*/
|
|
9398
9451
|
interface ConnectingProps {
|
|
9399
9452
|
/**
|
|
9400
|
-
* The wallet being connected, as `formatConnectorName` of `@tuwaio/orbit-core` returns it (for example `metamask`)
|
|
9453
|
+
* The wallet being connected, as `formatConnectorName` of `@tuwaio/orbit-core` returns it (for example `metamask`).
|
|
9454
|
+
* The texts name the wallet of `connectors` with exactly this connector type (`MetaMask`), or, when none has it, the
|
|
9455
|
+
* first one whose connector type contains it, or this value when none does.
|
|
9401
9456
|
*/
|
|
9402
9457
|
activeConnector: string | undefined;
|
|
9403
9458
|
/** Selected orbit adapter for the connection */
|
|
9404
9459
|
selectedAdapter: OrbitAdapter | undefined;
|
|
9405
|
-
/** Wallets with their connectors (the icon
|
|
9460
|
+
/** Wallets with their connectors (the icon and the name come from the wallet matching `activeConnector`) */
|
|
9406
9461
|
connectors: GroupedConnector[];
|
|
9407
9462
|
/** Whether the wallet connection is successfully established */
|
|
9408
9463
|
isConnected: boolean;
|
|
@@ -9425,12 +9480,14 @@ interface ConnectingProps {
|
|
|
9425
9480
|
* ```tsx
|
|
9426
9481
|
* import { getFilteredConnectors } from '@tuwaio/nova-connect';
|
|
9427
9482
|
* import { Connecting } from '@tuwaio/nova-connect/components';
|
|
9428
|
-
* import {
|
|
9483
|
+
* import { useWalletConnectors } from '@tuwaio/nova-connect/hooks';
|
|
9429
9484
|
* import { OrbitAdapter } from '@tuwaio/orbit-core';
|
|
9430
9485
|
*
|
|
9431
9486
|
* export function MetaMaskStatus({ isConnected }: { isConnected: boolean }) {
|
|
9432
|
-
* const
|
|
9433
|
-
*
|
|
9487
|
+
* const connectors = getFilteredConnectors({
|
|
9488
|
+
* connectors: useWalletConnectors() ?? {},
|
|
9489
|
+
* selectedAdapter: OrbitAdapter.EVM,
|
|
9490
|
+
* });
|
|
9434
9491
|
*
|
|
9435
9492
|
* return (
|
|
9436
9493
|
* <Connecting
|
package/dist/components/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{u as AboutWallets,a as BalanceDisplay,b as ChainListRenderer,g as ChainSelector,l as ConnectButton,w as ConnectCard,H as ConnectModal,j as ConnectedContent,t as ConnectedModal,m as ConnectedModalFooter,q as ConnectedModalMainContent,n as ConnectedModalNameAndBalance,r as ConnectedModalTxHistory,x as Connecting,s as ConnectionsContent,y as ConnectorsBlock,A as ConnectorsSelections,z as Disclaimer,B as GetWallet,p as IconButton,C as ImpersonateForm,D as LegalDisclaimer,E as NetworkSelections,F as NetworkTabs,v as RecentBadge,G as RememberWallet,f as ScrollableChainList,e as SelectContentAnimated,i as StatusIcon,c as ToBottomButton,d as ToTopButton,I as ToastError,k as WaitForConnectionContent,h as WalletAvatar,o as WalletIcon}from'../chunk-
|
|
1
|
+
export{u as AboutWallets,a as BalanceDisplay,b as ChainListRenderer,g as ChainSelector,l as ConnectButton,w as ConnectCard,H as ConnectModal,j as ConnectedContent,t as ConnectedModal,m as ConnectedModalFooter,q as ConnectedModalMainContent,n as ConnectedModalNameAndBalance,r as ConnectedModalTxHistory,x as Connecting,s as ConnectionsContent,y as ConnectorsBlock,A as ConnectorsSelections,z as Disclaimer,B as GetWallet,p as IconButton,C as ImpersonateForm,D as LegalDisclaimer,E as NetworkSelections,F as NetworkTabs,v as RecentBadge,G as RememberWallet,f as ScrollableChainList,e as SelectContentAnimated,i as StatusIcon,c as ToBottomButton,d as ToTopButton,I as ToastError,k as WaitForConnectionContent,h as WalletAvatar,o as WalletIcon}from'../chunk-Y4JUUZX7.js';import'../chunk-X5SXUZJR.js';import'../chunk-AVCOIAAU.js';import'../chunk-ZVADGOGQ.js';import'../chunk-3LWAAUG4.js';
|
package/dist/hooks/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunk3M5KO5JH_cjs=require('../chunk-3M5KO5JH.cjs');require('../chunk-WAFPT2CO.cjs'),require('../chunk-EGATOYHY.cjs'),require('../chunk-YJRNNNR6.cjs');Object.defineProperty(exports,"NovaConnectLabelsContext",{enumerable:true,get:function(){return chunk3M5KO5JH_cjs.g}});Object.defineProperty(exports,"NovaConnectProviderContext",{enumerable:true,get:function(){return chunk3M5KO5JH_cjs.c}});Object.defineProperty(exports,"NovaConnectProviderError",{enumerable:true,get:function(){return chunk3M5KO5JH_cjs.b}});Object.defineProperty(exports,"createLabelsSubset",{enumerable:true,get:function(){return chunk3M5KO5JH_cjs.o}});Object.defineProperty(exports,"getLabelWithFallback",{enumerable:true,get:function(){return chunk3M5KO5JH_cjs.n}});Object.defineProperty(exports,"hasLabel",{enumerable:true,get:function(){return chunk3M5KO5JH_cjs.k}});Object.defineProperty(exports,"isDefaultLabels",{enumerable:true,get:function(){return chunk3M5KO5JH_cjs.m}});Object.defineProperty(exports,"useGetWalletNameAndAvatar",{enumerable:true,get:function(){return chunk3M5KO5JH_cjs.a}});Object.defineProperty(exports,"useHasNovaConnectContext",{enumerable:true,get:function(){return chunk3M5KO5JH_cjs.e}});Object.defineProperty(exports,"useLabelsByCategory",{enumerable:true,get:function(){return chunk3M5KO5JH_cjs.l}});Object.defineProperty(exports,"useNovaConnect",{enumerable:true,get:function(){return chunk3M5KO5JH_cjs.d}});Object.defineProperty(exports,"useNovaConnectLabel",{enumerable:true,get:function(){return chunk3M5KO5JH_cjs.i}});Object.defineProperty(exports,"useNovaConnectLabels",{enumerable:true,get:function(){return chunk3M5KO5JH_cjs.h}});Object.defineProperty(exports,"useNovaConnectLabelsSubset",{enumerable:true,get:function(){return chunk3M5KO5JH_cjs.j}});Object.defineProperty(exports,"useNovaConnectOptional",{enumerable:true,get:function(){return chunk3M5KO5JH_cjs.f}});Object.defineProperty(exports,"useNovaSiwx",{enumerable:true,get:function(){return chunk3M5KO5JH_cjs.p}});Object.defineProperty(exports,"useWalletChainsList",{enumerable:true,get:function(){return chunk3M5KO5JH_cjs.A}});Object.defineProperty(exports,"useWalletConnectors",{enumerable:true,get:function(){return chunk3M5KO5JH_cjs.B}});Object.defineProperty(exports,"useWalletNativeBalance",{enumerable:true,get:function(){return chunk3M5KO5JH_cjs.C}});
|
package/dist/hooks/index.d.cts
CHANGED
|
@@ -3,10 +3,11 @@ export { B as ButtonTxStatus, C as ConnectContentType, a as ConnectedContentType
|
|
|
3
3
|
import * as _tuwaio_satellite_core from '@tuwaio/satellite-core';
|
|
4
4
|
import { BaseConnector } from '@tuwaio/satellite-core';
|
|
5
5
|
import { SatelliteSiwxFieldOptions, UseSiwxSignInOptions } from '@tuwaio/siwx-react';
|
|
6
|
+
import { OrbitAdapter } from '@tuwaio/orbit-core';
|
|
7
|
+
import { Connector } from '@tuwaio/satellite-react';
|
|
6
8
|
import 'react';
|
|
7
9
|
import '../types-DyqzrPMH.cjs';
|
|
8
10
|
import 'framer-motion';
|
|
9
|
-
import '@tuwaio/orbit-core';
|
|
10
11
|
import '@tuwaio/pulsar-core';
|
|
11
12
|
|
|
12
13
|
/**
|
|
@@ -146,5 +147,45 @@ declare function useWalletChainsList({ activeConnection, appChains, solanaRPCUrl
|
|
|
146
147
|
chainsList: (string | number)[];
|
|
147
148
|
};
|
|
148
149
|
|
|
149
|
-
|
|
150
|
-
|
|
150
|
+
/**
|
|
151
|
+
* Options of {@link useWalletConnectors}.
|
|
152
|
+
*/
|
|
153
|
+
interface UseWalletConnectorsParams {
|
|
154
|
+
/** Whether to read and follow the wallets (default `true`); `false` returns `undefined` and subscribes to nothing */
|
|
155
|
+
enabled?: boolean;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* The wallets of the Satellite Connect store by adapter (`getConnectors()` of the store), read again whenever the store
|
|
159
|
+
* reports that the wallets of an adapter changed (`watchConnectors` of `@tuwaio/satellite-core`). A list shown before
|
|
160
|
+
* wagmi added the installed EIP-6963 wallets, or before a Wallet Standard wallet registered, fills in by itself. The
|
|
161
|
+
* connect modal and the connected modal list their wallets with it.
|
|
162
|
+
*
|
|
163
|
+
* The list is also read again on every render of the component: the wallets of an adapter that reports no changes (an
|
|
164
|
+
* adapter without `watchConnectors`, such as an older `@tuwaio/satellite-solana` or a custom adapter, or a
|
|
165
|
+
* `@tuwaio/satellite-core` without `watchConnectors`) appear at the next render.
|
|
166
|
+
*
|
|
167
|
+
* Side effects: while `enabled`, a subscription to the wallet list of the store (`watchConnectors`, which follows wagmi's
|
|
168
|
+
* connectors and the Wallet Standard registry), from the commit until `enabled` turns `false` or the component unmounts.
|
|
169
|
+
* Nothing is read or subscribed on the server.
|
|
170
|
+
*
|
|
171
|
+
* @param params - Options. See {@link UseWalletConnectorsParams}.
|
|
172
|
+
* @param params.enabled - Whether to read and follow the wallets (default `true`).
|
|
173
|
+
* @returns The wallets by adapter key, or `undefined` while disabled and on the server. The record stays the same object
|
|
174
|
+
* while the store returns the same wallet objects, so it can be a dependency of memos and effects.
|
|
175
|
+
* @throws {Error} `useSatelliteConnectStore must be used within a SatelliteConnectProvider` outside the provider.
|
|
176
|
+
*
|
|
177
|
+
* @example
|
|
178
|
+
* ```tsx
|
|
179
|
+
* import { OrbitAdapter } from '@tuwaio/orbit-core';
|
|
180
|
+
* import { useWalletConnectors } from '@tuwaio/nova-connect/hooks';
|
|
181
|
+
*
|
|
182
|
+
* export function EvmWalletCount() {
|
|
183
|
+
* const connectors = useWalletConnectors();
|
|
184
|
+
* return <span>{connectors?.[OrbitAdapter.EVM]?.length ?? 0} EVM wallets</span>;
|
|
185
|
+
* }
|
|
186
|
+
* ```
|
|
187
|
+
*/
|
|
188
|
+
declare function useWalletConnectors({ enabled }?: UseWalletConnectorsParams): Partial<Record<OrbitAdapter, Connector[]>> | undefined;
|
|
189
|
+
|
|
190
|
+
export { useGetWalletNameAndAvatar, useNovaSiwx, useWalletChainsList, useWalletConnectors };
|
|
191
|
+
export type { UseGetWalletNameAndAvatarOptions, UseNovaSiwxOptions, UseWalletChainsListProps, UseWalletConnectorsParams, WalletNameAndAvatarData };
|