@fluent.xyz/connect 0.8.3 → 0.8.5
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/dist/index.d.ts +14 -0
- package/dist/index.js +37 -10
- package/dist/index.js.map +1 -1
- package/docs/api.md +2 -0
- package/docs/concepts.md +3 -1
- package/docs/experimental.md +26 -3
- package/docs/getting-started.md +3 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -656,6 +656,20 @@ type FluentWidgetRenderContext = {
|
|
|
656
656
|
openConnect: () => void;
|
|
657
657
|
/** Opens the account drawer, as the connect button does once a Widget account is connected. */
|
|
658
658
|
openAccount: () => void;
|
|
659
|
+
/**
|
|
660
|
+
* Renders the drawer's Swap page, where a Deposit is made, as the App's own element: in a
|
|
661
|
+
* modal or a page of its own, shown when the App decides. It is the page the drawer shows, on
|
|
662
|
+
* both Networks and for either account kind, in the widget's own style scope so it draws as
|
|
663
|
+
* in the drawer inside any element, and it connects the External wallet that pays by itself.
|
|
664
|
+
* `onClose` is called by the page's own ways back to the wallet: "Back to wallet" once
|
|
665
|
+
* a Deposit has landed or while its funds are on their way, and "Back to Home" on a Two-step
|
|
666
|
+
* deposit's status screen. The form itself offers no way back, which the App's own element
|
|
667
|
+
* provides.
|
|
668
|
+
*
|
|
669
|
+
* @experimental May change or be removed in a minor release: an App that draws the Swap page
|
|
670
|
+
* itself is not a 0.8.3 commitment.
|
|
671
|
+
*/
|
|
672
|
+
renderBridge: (onClose: () => void) => ReactNode;
|
|
659
673
|
/**
|
|
660
674
|
* Disconnects the Widget account, the same teardown the account menu's "Disconnect" runs. The
|
|
661
675
|
* Widget session and the stored identity token are cleared before it resolves, so an App can
|
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import { clsx } from 'clsx';
|
|
|
11
11
|
import { twMerge } from 'tailwind-merge';
|
|
12
12
|
import { Button as Button$1 } from '@base-ui/react/button';
|
|
13
13
|
import { cva } from 'class-variance-authority';
|
|
14
|
-
import { X, ChevronLeft, ExternalLink, Copy, Settings, LogOut, Layers, Trash2, RefreshCw, ChevronDownIcon, CheckIcon, AlertTriangle, Plus, Loader2Icon, Loader2, LogIn, Send, RotateCw, KeyRound, Mail, Wallet, XIcon, Check,
|
|
14
|
+
import { X, ChevronLeft, ExternalLink, Copy, Settings, LogOut, Layers, Trash2, RefreshCw, ChevronDownIcon, CheckIcon, AlertTriangle, Plus, Loader2Icon, Loader2, LogIn, Send, RotateCw, KeyRound, Mail, Wallet, XIcon, Check, Search, ChevronDown, Info, ChevronUpIcon, CircleCheckIcon, InfoIcon, TriangleAlertIcon, OctagonXIcon } from 'lucide-react';
|
|
15
15
|
import { WagmiAdapter } from '@reown/appkit-adapter-wagmi';
|
|
16
16
|
import { createAppKit } from '@reown/appkit/react';
|
|
17
17
|
import { WagmiContext, WagmiProvider, useAccount, useDisconnect, useWalletClient, useSwitchChain, useConnect, useConfig, usePublicClient, useBalance, useReadContract, useWriteContract, useSendTransaction, useWaitForTransactionReceipt } from 'wagmi';
|
|
@@ -5626,7 +5626,7 @@ function createFluentConnectForWidget(config) {
|
|
|
5626
5626
|
}
|
|
5627
5627
|
|
|
5628
5628
|
// package.json
|
|
5629
|
-
var version = "0.8.
|
|
5629
|
+
var version = "0.8.5";
|
|
5630
5630
|
|
|
5631
5631
|
// src/core/analytics.ts
|
|
5632
5632
|
var INSTANCE_NAME = "fluent";
|
|
@@ -13035,11 +13035,12 @@ function WalletMenuActionCard({
|
|
|
13035
13035
|
const faucetAvailable = isFaucetNetwork(resolvedConfig.network);
|
|
13036
13036
|
const faucetOffered = faucetAvailable && !externalWalletAccount;
|
|
13037
13037
|
const usdnrMinter = faucetAvailable ? onMintUsdnr : void 0;
|
|
13038
|
+
const accountAddress = connectedAddress ?? actionAddress;
|
|
13038
13039
|
const swapperReady = resolvedConfig.swapper.enabled && Boolean(resolvedConfig.swapper.integratorId) && Boolean(resolvedConfig.swapper.dstChainId) && Boolean(resolvedConfig.swapper.dstTokenAddress);
|
|
13039
13040
|
const handleSwapper = () => {
|
|
13040
13041
|
setActionStatus(null);
|
|
13041
|
-
if (!
|
|
13042
|
-
setActionStatus("
|
|
13042
|
+
if (!accountAddress) {
|
|
13043
|
+
setActionStatus("Wallet address is still preparing");
|
|
13043
13044
|
return;
|
|
13044
13045
|
}
|
|
13045
13046
|
if (!swapperReady) {
|
|
@@ -13050,7 +13051,9 @@ function WalletMenuActionCard({
|
|
|
13050
13051
|
integratorId: resolvedConfig.swapper.integratorId,
|
|
13051
13052
|
dstChainId: resolvedConfig.swapper.dstChainId,
|
|
13052
13053
|
dstTokenAddr: resolvedConfig.swapper.dstTokenAddress,
|
|
13053
|
-
|
|
13054
|
+
// Not the Fluent ID's address: an External wallet has none, and USDnr bought to an
|
|
13055
|
+
// address other than the one the balances are read for never shows in this menu.
|
|
13056
|
+
depositWalletAddress: accountAddress,
|
|
13054
13057
|
styles: {
|
|
13055
13058
|
themeMode: "dark",
|
|
13056
13059
|
componentStyles: {
|
|
@@ -13061,9 +13064,9 @@ function WalletMenuActionCard({
|
|
|
13061
13064
|
}
|
|
13062
13065
|
});
|
|
13063
13066
|
};
|
|
13064
|
-
const [swapperAccount, setSwapperAccount] = useState(
|
|
13065
|
-
if (swapperAccount !==
|
|
13066
|
-
setSwapperAccount(
|
|
13067
|
+
const [swapperAccount, setSwapperAccount] = useState(accountAddress);
|
|
13068
|
+
if (swapperAccount !== accountAddress) {
|
|
13069
|
+
setSwapperAccount(accountAddress);
|
|
13067
13070
|
setSwapperConfig(null);
|
|
13068
13071
|
}
|
|
13069
13072
|
const explorerTarget = externalWalletAccount ? connectedAddress : actionAddress;
|
|
@@ -13077,7 +13080,6 @@ function WalletMenuActionCard({
|
|
|
13077
13080
|
}
|
|
13078
13081
|
openExternalUrl(explorerAddress(explorerTarget, resolvedConfig.network), "explorer", track);
|
|
13079
13082
|
};
|
|
13080
|
-
const accountAddress = connectedAddress ?? actionAddress;
|
|
13081
13083
|
const handleSend = () => {
|
|
13082
13084
|
setActionStatus(null);
|
|
13083
13085
|
if (!accountAddress) {
|
|
@@ -13468,7 +13470,7 @@ function WalletMenuActionCard({
|
|
|
13468
13470
|
{
|
|
13469
13471
|
variant: "secondary",
|
|
13470
13472
|
className: "h-16 w-full",
|
|
13471
|
-
disabled: usdnrMinter ? mintUsdnrBusy : !
|
|
13473
|
+
disabled: usdnrMinter ? mintUsdnrBusy : !accountAddress || !swapperReady,
|
|
13472
13474
|
title: usdnrMinter || swapperReady ? void 0 : "Not configured for this app",
|
|
13473
13475
|
onClick: usdnrMinter ? () => handleMintUsdnr(usdnrMinter) : handleSwapper,
|
|
13474
13476
|
children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-1", children: [
|
|
@@ -22550,6 +22552,25 @@ function FluentWidgetContent({
|
|
|
22550
22552
|
widget: appWidgetApi,
|
|
22551
22553
|
openConnect,
|
|
22552
22554
|
openAccount: openAccountMenu,
|
|
22555
|
+
// The drawer's Swap page with the drawer's own props, so a Deposit started here is the
|
|
22556
|
+
// same Deposit the drawer follows; the App's `onClose` stands where the drawer goes home.
|
|
22557
|
+
renderBridge: (onClose) => (
|
|
22558
|
+
// In the widget's own style scope, as the drawer is: the App's element sits outside it,
|
|
22559
|
+
// and the package's layout rules and theme colours hold under `.fluent-root` alone. The
|
|
22560
|
+
// scope draws no box of its own, so the page fills the element the App gives it.
|
|
22561
|
+
/* @__PURE__ */ jsx("div", { className: WIDGET_STYLE_SCOPE, children: /* @__PURE__ */ jsx(
|
|
22562
|
+
BridgeScreen,
|
|
22563
|
+
{
|
|
22564
|
+
config,
|
|
22565
|
+
recipient: fluentAccountAddress,
|
|
22566
|
+
onSignIn: signInWithFluent,
|
|
22567
|
+
track,
|
|
22568
|
+
depositSwap: bridgeDepositSwap,
|
|
22569
|
+
onDepositSent: addSentDeposit,
|
|
22570
|
+
onGoHome: onClose
|
|
22571
|
+
}
|
|
22572
|
+
) })
|
|
22573
|
+
),
|
|
22553
22574
|
disconnect: requestDisconnect,
|
|
22554
22575
|
hasConnectedAccount,
|
|
22555
22576
|
status,
|
|
@@ -22566,6 +22587,12 @@ function FluentWidgetContent({
|
|
|
22566
22587
|
appWidgetApi,
|
|
22567
22588
|
openConnect,
|
|
22568
22589
|
openAccountMenu,
|
|
22590
|
+
config,
|
|
22591
|
+
fluentAccountAddress,
|
|
22592
|
+
signInWithFluent,
|
|
22593
|
+
track,
|
|
22594
|
+
bridgeDepositSwap,
|
|
22595
|
+
addSentDeposit,
|
|
22569
22596
|
requestDisconnect,
|
|
22570
22597
|
hasConnectedAccount,
|
|
22571
22598
|
status,
|