@fluent.xyz/connect 0.6.0 → 0.6.1
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/fluent-connect.css +1 -1
- package/dist/fonts/LICENSE-Inter.txt +93 -0
- package/dist/fonts/inter-latin-ext-wght-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-wght-normal.woff2 +0 -0
- package/dist/index.d.ts +35 -4
- package/dist/index.js +401 -324
- package/dist/index.js.map +1 -1
- package/docs/api.md +51 -4
- package/docs/configuration.md +2 -3
- package/docs/errors.md +14 -1
- package/docs/experimental.md +1 -1
- package/docs/guides/transactions.md +12 -3
- package/package.json +4 -3
package/dist/index.js
CHANGED
|
@@ -27,7 +27,7 @@ import { signerToEcdsaValidator } from '@zerodev/ecdsa-validator';
|
|
|
27
27
|
import { deserializePermissionAccount } from '@zerodev/permissions';
|
|
28
28
|
import '@zerodev/permissions/policies';
|
|
29
29
|
import { toECDSASigner } from '@zerodev/permissions/signers';
|
|
30
|
-
import { createKernelAccount, createKernelAccountClient,
|
|
30
|
+
import { createKernelAccount, createKernelAccountClient, createZeroDevPaymasterClient } from '@zerodev/sdk';
|
|
31
31
|
import { getEntryPoint, KERNEL_V3_3 } from '@zerodev/sdk/constants';
|
|
32
32
|
import { privateKeyToAccount, toAccount } from 'viem/accounts';
|
|
33
33
|
import { WaitForUserOperationReceiptTimeoutError, estimateUserOperationGas, getPaymasterData, getPaymasterStubData } from 'viem/account-abstraction';
|
|
@@ -5007,6 +5007,22 @@ function getFluentGasTokenAddress(symbol, network) {
|
|
|
5007
5007
|
if (!token || isFluentNativeToken(token)) return void 0;
|
|
5008
5008
|
return token.address;
|
|
5009
5009
|
}
|
|
5010
|
+
var FLUENT_GAS_TOKEN_APPROVALS = {
|
|
5011
|
+
USDNR: { amount: "1", refreshBelow: "0.1" },
|
|
5012
|
+
BLEND: { amount: "10", refreshBelow: "1" }
|
|
5013
|
+
};
|
|
5014
|
+
function getFluentGasTokenApproval(gasToken, network) {
|
|
5015
|
+
const wanted = gasToken.toLowerCase();
|
|
5016
|
+
const token = getFluentDefaultWidgetGasTokens(network).find(
|
|
5017
|
+
(candidate) => !isFluentNativeToken(candidate) && candidate.address?.toLowerCase() === wanted
|
|
5018
|
+
);
|
|
5019
|
+
const approval = token && FLUENT_GAS_TOKEN_APPROVALS[token.symbol.toUpperCase()];
|
|
5020
|
+
if (!token || !approval) return void 0;
|
|
5021
|
+
return {
|
|
5022
|
+
amount: parseUnits(approval.amount, token.decimals),
|
|
5023
|
+
refreshBelow: parseUnits(approval.refreshBelow, token.decimals)
|
|
5024
|
+
};
|
|
5025
|
+
}
|
|
5010
5026
|
var FLUENT_GAS_PAYMENT_DEFAULT_ETH_RATES = {
|
|
5011
5027
|
ETH: "1"
|
|
5012
5028
|
};
|
|
@@ -5596,7 +5612,7 @@ function createFluentConnectForWidget(config) {
|
|
|
5596
5612
|
}
|
|
5597
5613
|
|
|
5598
5614
|
// package.json
|
|
5599
|
-
var version = "0.6.
|
|
5615
|
+
var version = "0.6.1";
|
|
5600
5616
|
|
|
5601
5617
|
// src/core/analytics.ts
|
|
5602
5618
|
var INSTANCE_NAME = "fluent";
|
|
@@ -5729,10 +5745,21 @@ var TOP_LAYER_STYLE_SCOPE = "fluent-root dark text-foreground";
|
|
|
5729
5745
|
var FluentPortalContainerContext = createContext(null);
|
|
5730
5746
|
var FluentTopLayerContext = createContext(null);
|
|
5731
5747
|
var FluentToastLayerContext = createContext(null);
|
|
5748
|
+
var FluentOpenSurfaceContext = createContext(null);
|
|
5749
|
+
var OPEN_SURFACE_SELECTOR = '[data-slot="dialog-content"][data-open], [data-slot="drawer-popup"][data-open]';
|
|
5750
|
+
function findOpenSurface(roots) {
|
|
5751
|
+
let found = null;
|
|
5752
|
+
for (const root of roots) {
|
|
5753
|
+
const matches2 = root.querySelectorAll(OPEN_SURFACE_SELECTOR);
|
|
5754
|
+
found = matches2[matches2.length - 1] ?? found;
|
|
5755
|
+
}
|
|
5756
|
+
return found;
|
|
5757
|
+
}
|
|
5732
5758
|
function FluentPortalContainerProvider({ children }) {
|
|
5733
5759
|
const [container, setContainer] = useState(null);
|
|
5734
5760
|
const [topLayer, setTopLayer] = useState(null);
|
|
5735
5761
|
const [toastLayer, setToastLayer] = useState(null);
|
|
5762
|
+
const [openSurface, setOpenSurface] = useState(null);
|
|
5736
5763
|
const holdsRef = useRef(0);
|
|
5737
5764
|
useLayoutEffect(() => {
|
|
5738
5765
|
const element = document.createElement("div");
|
|
@@ -5750,6 +5777,13 @@ function FluentPortalContainerProvider({ children }) {
|
|
|
5750
5777
|
} catch {
|
|
5751
5778
|
}
|
|
5752
5779
|
setToastLayer(toasts);
|
|
5780
|
+
const promoteToasts = () => {
|
|
5781
|
+
try {
|
|
5782
|
+
toasts.hidePopover?.();
|
|
5783
|
+
toasts.showPopover?.();
|
|
5784
|
+
} catch {
|
|
5785
|
+
}
|
|
5786
|
+
};
|
|
5753
5787
|
const dialog = document.createElement("dialog");
|
|
5754
5788
|
dialog.setAttribute("data-fluent-top-layer", "");
|
|
5755
5789
|
dialog.className = TOP_LAYER_STYLE_SCOPE;
|
|
@@ -5758,6 +5792,7 @@ function FluentPortalContainerProvider({ children }) {
|
|
|
5758
5792
|
if (holdsRef.current > 0 && dialog.isConnected && !dialog.open) {
|
|
5759
5793
|
try {
|
|
5760
5794
|
dialog.showModal();
|
|
5795
|
+
promoteToasts();
|
|
5761
5796
|
} catch {
|
|
5762
5797
|
}
|
|
5763
5798
|
}
|
|
@@ -5778,6 +5813,7 @@ function FluentPortalContainerProvider({ children }) {
|
|
|
5778
5813
|
if (holdsRef.current === 1 && dialog.isConnected && !dialog.open) {
|
|
5779
5814
|
try {
|
|
5780
5815
|
dialog.showModal();
|
|
5816
|
+
promoteToasts();
|
|
5781
5817
|
} catch {
|
|
5782
5818
|
}
|
|
5783
5819
|
placeToasts(dialog);
|
|
@@ -5797,7 +5833,20 @@ function FluentPortalContainerProvider({ children }) {
|
|
|
5797
5833
|
};
|
|
5798
5834
|
};
|
|
5799
5835
|
setTopLayer({ element: dialog, acquire });
|
|
5836
|
+
const roots = [element, dialog];
|
|
5837
|
+
const trackOpenSurface = () => setOpenSurface(findOpenSurface(roots));
|
|
5838
|
+
const surfaceObserver = new MutationObserver(trackOpenSurface);
|
|
5839
|
+
for (const root of roots) {
|
|
5840
|
+
surfaceObserver.observe(root, {
|
|
5841
|
+
subtree: true,
|
|
5842
|
+
childList: true,
|
|
5843
|
+
attributes: true,
|
|
5844
|
+
attributeFilter: ["data-open"]
|
|
5845
|
+
});
|
|
5846
|
+
}
|
|
5800
5847
|
return () => {
|
|
5848
|
+
surfaceObserver.disconnect();
|
|
5849
|
+
setOpenSurface(null);
|
|
5801
5850
|
element.remove();
|
|
5802
5851
|
setContainer(null);
|
|
5803
5852
|
toasts.remove();
|
|
@@ -5808,7 +5857,7 @@ function FluentPortalContainerProvider({ children }) {
|
|
|
5808
5857
|
setTopLayer(null);
|
|
5809
5858
|
};
|
|
5810
5859
|
}, []);
|
|
5811
|
-
return /* @__PURE__ */ jsx(FluentPortalContainerContext.Provider, { value: container, children: /* @__PURE__ */ jsx(FluentTopLayerContext.Provider, { value: topLayer, children: /* @__PURE__ */ jsx(FluentToastLayerContext.Provider, { value: toastLayer, children }) }) });
|
|
5860
|
+
return /* @__PURE__ */ jsx(FluentPortalContainerContext.Provider, { value: container, children: /* @__PURE__ */ jsx(FluentTopLayerContext.Provider, { value: topLayer, children: /* @__PURE__ */ jsx(FluentToastLayerContext.Provider, { value: toastLayer, children: /* @__PURE__ */ jsx(FluentOpenSurfaceContext.Provider, { value: openSurface, children }) }) }) });
|
|
5812
5861
|
}
|
|
5813
5862
|
function useFluentPortalContainer(override) {
|
|
5814
5863
|
const container = useContext(FluentPortalContainerContext);
|
|
@@ -5825,10 +5874,14 @@ function useFluentTopLayer() {
|
|
|
5825
5874
|
function useFluentToastLayer() {
|
|
5826
5875
|
return useContext(FluentToastLayerContext);
|
|
5827
5876
|
}
|
|
5877
|
+
function useFluentOpenSurface() {
|
|
5878
|
+
return useContext(FluentOpenSurfaceContext);
|
|
5879
|
+
}
|
|
5828
5880
|
function useFluentToastPortalContainer(override) {
|
|
5881
|
+
const openSurface = useContext(FluentOpenSurfaceContext);
|
|
5829
5882
|
const toastLayer = useContext(FluentToastLayerContext);
|
|
5830
5883
|
const container = useContext(FluentPortalContainerContext);
|
|
5831
|
-
return override ?? toastLayer ?? container ?? void 0;
|
|
5884
|
+
return override ?? openSurface ?? toastLayer ?? container ?? void 0;
|
|
5832
5885
|
}
|
|
5833
5886
|
function FluentTopLayerSlot({
|
|
5834
5887
|
children,
|
|
@@ -5908,16 +5961,19 @@ function ToastPortal({ container, ...props }) {
|
|
|
5908
5961
|
}
|
|
5909
5962
|
);
|
|
5910
5963
|
}
|
|
5911
|
-
function ToastViewport({ className, ...props }) {
|
|
5964
|
+
function ToastViewport({ className, children, ...props }) {
|
|
5965
|
+
const inSurface = useFluentOpenSurface() !== null;
|
|
5912
5966
|
return /* @__PURE__ */ jsx(
|
|
5913
5967
|
Toast$1.Viewport,
|
|
5914
5968
|
{
|
|
5915
5969
|
"data-slot": "toast-viewport",
|
|
5916
5970
|
className: cn(
|
|
5917
|
-
"dark pointer-events-none fixed
|
|
5971
|
+
"dark pointer-events-none fixed z-[100] text-foreground outline-none",
|
|
5972
|
+
inSurface ? "inset-0 overflow-hidden rounded-[inherit]" : "inset-x-4 bottom-4 mx-auto w-[min(100%,368px)] max-w-[368px] sm:right-4 sm:left-auto sm:mx-0",
|
|
5918
5973
|
className
|
|
5919
5974
|
),
|
|
5920
|
-
...props
|
|
5975
|
+
...props,
|
|
5976
|
+
children: inSurface ? /* @__PURE__ */ jsx("div", { className: "absolute inset-x-4 bottom-4 mx-auto max-w-[368px]", children }) : children
|
|
5921
5977
|
}
|
|
5922
5978
|
);
|
|
5923
5979
|
}
|
|
@@ -6827,8 +6883,6 @@ var icons = {
|
|
|
6827
6883
|
"arrow-up-down-line": (props) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsx("path", { d: "M11.9498 7.94975L10.5356 9.36396L8.00079 6.828L8.00004 20H6.00004L6.00079 6.828L3.46451 9.36396L2.05029 7.94975L7.00004 3L11.9498 7.94975ZM21.9498 16.0503L17 21L12.0503 16.0503L13.4645 14.636L16.0008 17.172L16 4H18L18.0008 17.172L20.5356 14.636L21.9498 16.0503Z" }) }),
|
|
6828
6884
|
"arrow-right-up-line": (props) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsx("path", { d: "M16.0037 9.41421L7.39712 18.0208L5.98291 16.6066L14.5895 8H7.00373V6H18.0037V17H16.0037V9.41421Z" }) }),
|
|
6829
6885
|
"arrow-up-line": (props) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsx("path", { d: "M13 7.82843V20H11V7.82843L5.63604 13.1924L4.22183 11.7782L12 4L19.7782 11.7782L18.364 13.1924L13 7.82843Z" }) }),
|
|
6830
|
-
"arrow-up-s-fill": (props) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsx("path", { d: "M12 8L18 14H6L12 8Z" }) }),
|
|
6831
|
-
"arrow-down-s-fill": (props) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsx("path", { d: "M12 16L6 10H18L12 16Z" }) }),
|
|
6832
6886
|
plus: (props) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsx("path", { d: "M11 11V5H13V11H19V13H13V19H11V13H5V11H11Z" }) }),
|
|
6833
6887
|
eth: (props) => /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
|
|
6834
6888
|
/* @__PURE__ */ jsx("path", { d: "M11.944 1.5v7.908l6.722 3.004L11.944 1.5z", opacity: "0.6" }),
|
|
@@ -6850,10 +6904,6 @@ var icons = {
|
|
|
6850
6904
|
/* @__PURE__ */ jsx("path", { d: "M38.2,16.77c.18,.12,.36,.24,.53,.36l.34,.24L40.46,.15l-.23-.03c-.34-.04-.68-.08-1.02-.1l-.25-.02-.89,16.69,.12,.08Zm-2.73-1.55c.14,.07,.29,.14,.43,.21l.37,.19L35.41,0l-.25,.02c-.31,.03-.62,.06-.93,.1l-.23,.03,1.2,14.95,.13,.06,.14,.07Zm5.17,3.37c.16,.14,.32,.28,.48,.42l.31,.28L45.37,1.3l-.21-.07c-.35-.12-.7-.23-1.05-.33l-.25-.07-3.33,17.67,.11,.09Zm-8.46-4.67c.15,.05,.29,.09,.44,.14l.39,.13L30.44,.88l-.25,.07c-.27,.08-.54,.16-.81,.25l-.2,.07,2.72,12.56,.14,.04,.15,.05Zm-3.68-.85c.15,.02,.29,.05,.44,.07l.4,.07-3.56-10.49-.25,.13c-.22,.12-.44,.24-.66,.36l-.18,.1,3.52,9.71,.14,.02,.15,.02Zm15.82,9.4c.13,.16,.25,.33,.37,.5l.23,.31L53.91,6.35l-.14-.13c-.31-.28-.63-.55-.95-.81l-.23-.19-8.36,17.13,.09,.12ZM24.35,12.81c.18,0,.68,0,.87,0h.41s-4.02-7.36-4.02-7.36l-.22,.18c-.17,.14-.34,.28-.5,.43l-.14,.13,3.47,6.62h.15Zm21.28,11.59c.11,.17,.21,.35,.31,.52l.19,.32,11.05-15.3-.11-.14c-.26-.34-.53-.68-.81-1.02l-.21-.24-10.5,15.73,.08,.13ZM17.58,9.55l-.11,.14,2.55,3.59,.15-.03c.17-.03,.33-.06,.5-.09l.37-.06-2.9-4.24-.2,.25c-.12,.15-.24,.29-.35,.44Zm29.11,16.75c.09,.18,.18,.36,.27,.55l.15,.32,12.54-13.16-.07-.15c-.2-.4-.41-.8-.63-1.19l-.17-.3-12.16,13.79,.07,.15ZM14.99,13.65l.82,.89,.15-.06c.14-.05,.28-.11,.42-.16l.48-.19-1.23-1.63c-.08,.14-.58,1.01-.65,1.15Zm32.54,14.53c.07,.19,.15,.37,.22,.56l.12,.31,13.39-10.73-.04-.15c-.12-.44-.26-.89-.41-1.32l-.11-.34-13.23,11.51,.06,.16Zm.64,1.8c.06,.19,.11,.38,.17,.57l.09,.3,13.61-8.15v-.15c-.06-.47-.11-.93-.18-1.39l-.06-.37-13.68,9.02,.05,.17Zm.46,1.72c.04,.19,.09,.38,.13,.57l.06,.29,13.22-5.63v-.15c.05-.47,.07-.93,.08-1.4v-.39s-13.53,6.51-13.53,6.51l.04,.19Zm.33,1.67c.03,.2,.06,.39,.09,.59l.04,.27,12.3-3.35,.03-.14c.11-.45,.21-.91,.29-1.36l.07-.4-12.86,4.17,.03,.2Zm.21,1.65c.02,.21,.04,.41,.05,.62l.02,.26,10.98-1.43,.05-.13c.17-.42,.34-.85,.49-1.28l.14-.39-11.73,2.13,.02,.22Zm.04,3.95l-.02,.22,7.59,1.08,.09-.11c.27-.34,.52-.68,.76-1.03l.24-.34-8.62-.75v.25c-.02,.22-.03,.45-.05,.67Zm-.18,1.68l-.03,.21,5.79,1.65,.1-.1c.29-.29,.57-.59,.84-.89l.28-.31-6.87-1.53-.03,.27c-.03,.24-.05,.47-.09,.71Zm-.3,1.7l-.04,.19,4.07,1.78,.11-.09c.3-.24,.6-.5,.89-.75l.3-.27-5.13-1.89-.05,.28c-.04,.25-.09,.5-.15,.75Zm-.44,1.73l-.05,.18,2.49,1.53,.13-.08c.31-.2,.61-.41,.91-.63l.31-.23-3.5-1.86-.07,.3c-.07,.27-.14,.53-.22,.79Zm-.6,1.79l-.06,.16,1.11,.91,.14-.07c.31-.17,.62-.34,.93-.52l.32-.19-2.03-1.46-.1,.31c-.1,.29-.2,.57-.3,.86Zm-.38,.95c-.06,.14-.12,.29-.19,.43l-.26,.58,.58-.26c.15-.07,.29-.13,.44-.2l.32-.15-.76-.71-.13,.32Zm1.95-10.17c0,.22,0,.43,0,.65v.24l9.36,.06,.07-.12s.01-.02,.02-.03c0-.01,.02-.03,.05-.09h0c.2-.35,.39-.69,.57-1.04l.19-.37-10.28,.48v.24Zm-6.16-15.65c-.14-.16-.28-.31-.43-.47l-.1-.1L48.46,2.61l.25,.13c.35,.18,.69,.37,1.03,.57l.17,.1-6.56,17.88-.27-.3Z" }),
|
|
6851
6905
|
/* @__PURE__ */ jsx("path", { d: "M16.74,36.74c.12-.18,.24-.36,.36-.53l.24-.34L.15,34.48l-.03,.23c-.04,.34-.08,.68-.1,1.02l-.02,.25,16.67,.89,.08-.12Zm-1.54,2.74c.07-.14,.14-.29,.21-.43l.19-.37L0,39.54l.02,.25c.03,.31,.06,.62,.1,.93l.03,.23,14.92-1.2,.06-.13,.07-.14Zm3.36-5.18c.14-.16,.28-.32,.42-.49l.28-.31L1.3,29.56l-.07,.21c-.12,.35-.23,.7-.33,1.06l-.07,.25,17.64,3.33,.09-.11Zm-4.66,8.48c.05-.15,.09-.3,.14-.44l.13-.39L.88,44.52l.07,.25c.08,.27,.16,.54,.25,.81l.07,.21,12.54-2.72,.04-.14,.05-.15Zm-.85,3.69c.02-.15,.05-.29,.07-.44l.07-.4-10.47,3.56,.13,.25c.12,.22,.24,.44,.36,.66l.1,.18,9.7-3.52,.02-.14,.02-.15Zm9.39-15.85c.16-.13,.33-.25,.5-.37l.31-.23L6.34,21.01l-.13,.14c-.28,.31-.55,.63-.81,.95l-.19,.24,17.1,8.37,.12-.09Zm-9.65,19.99c0-.18,0-.68,0-.87v-.41s-7.35,4.03-7.35,4.03l.18,.22c.14,.17,.28,.34,.43,.5l.12,.14,6.61-3.47v-.15Zm11.57-21.32c.17-.11,.35-.21,.52-.31l.32-.19-15.28-11.07-.14,.11c-.34,.26-.68,.53-1.02,.82l-.24,.21,15.7,10.52,.13-.08Zm-14.83,28.1l.14,.11,3.59-2.55-.03-.15c-.03-.17-.06-.34-.09-.5l-.06-.37-4.23,2.91,.25,.2c.15,.12,.29,.24,.44,.35ZM26.26,28.24c.18-.09,.36-.18,.54-.27l.32-.15L13.98,15.26l-.15,.07c-.4,.2-.8,.41-1.19,.63l-.3,.17,13.77,12.18,.15-.07Zm-12.64,31.76l.88-.82-.06-.15c-.05-.14-.11-.28-.16-.42l-.19-.49-1.62,1.24c.14,.08,1.01,.58,1.15,.65ZM28.13,27.4c.19-.07,.37-.15,.56-.22l.31-.12-10.71-13.42-.15,.04c-.44,.12-.88,.26-1.32,.41l-.34,.12,11.49,13.25,.16-.06Zm1.79-.64c.19-.06,.38-.11,.57-.17l.3-.09-8.13-13.63h-.15c-.46,.06-.93,.11-1.39,.18l-.37,.06,9.01,13.7,.17-.05Zm1.72-.47c.19-.04,.38-.09,.57-.13l.29-.06-5.62-13.24h-.15c-.47-.05-.93-.07-1.4-.08h-.39s6.5,13.55,6.5,13.55l.19-.04Zm1.67-.33c.2-.03,.39-.06,.59-.09l.27-.04-3.34-12.32-.14-.03c-.45-.11-.9-.21-1.36-.29l-.4-.07,4.17,12.88,.2-.03Zm1.64-.21c.21-.02,.41-.04,.61-.05l.26-.02-1.43-10.99-.13-.05c-.42-.17-.85-.34-1.28-.49l-.39-.14,2.13,11.75,.22-.02Zm3.95-.04l.22,.02,1.08-7.6-.11-.09c-.34-.27-.68-.52-1.03-.77l-.34-.24-.75,8.63h.25c.22,.02,.45,.03,.67,.05Zm1.68,.18l.21,.03,1.64-5.8-.1-.1c-.29-.29-.59-.57-.89-.84l-.31-.28-1.53,6.88,.27,.03c.24,.03,.47,.05,.71,.09Zm1.69,.3l.19,.04,1.78-4.08-.09-.11c-.24-.3-.49-.6-.75-.89l-.27-.3-1.89,5.14,.28,.05c.25,.04,.5,.09,.74,.15Zm1.73,.44l.18,.05,1.53-2.49-.08-.13c-.2-.31-.41-.61-.63-.91l-.23-.31-1.86,3.51,.3,.07c.27,.07,.53,.14,.79,.22Zm1.79,.6l.16,.06,.91-1.11-.07-.14c-.17-.31-.34-.62-.52-.93l-.19-.32-1.45,2.03,.31,.1c.29,.1,.57,.2,.85,.31Zm.95,.38c.14,.06,.29,.12,.43,.19l.58,.26-.26-.58c-.07-.15-.13-.29-.2-.44l-.15-.32-.71,.76,.32,.13Zm-10.15-1.95c.22,0,.43,0,.65,0h.24l.06-9.37-.12-.07s-.02-.01-.03-.02c-.01,0-.03-.02-.09-.05h0c-.34-.2-.69-.39-1.04-.57l-.37-.19,.48,10.29h.23Zm-15.63,6.17c-.16,.14-.31,.28-.47,.43l-.1,.1L2.6,26.47l.13-.25c.18-.35,.37-.69,.57-1.04l.1-.18,17.85,6.57-.3,.27Z" })
|
|
6852
6906
|
] }),
|
|
6853
|
-
blend: (props) => /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
|
|
6854
|
-
/* @__PURE__ */ jsx("path", { d: "M12 3.5 4.5 8v8L12 20.5 19.5 16V8L12 3.5zm0 1.75 5.25 3.15v6.2L12 17.75l-5.25-3.15v-6.2L12 5.25z" }),
|
|
6855
|
-
/* @__PURE__ */ jsx("path", { d: "M12 8.25 8.5 10.3v3.4L12 15.75l3.5-2.05v-3.4L12 8.25z" })
|
|
6856
|
-
] }),
|
|
6857
6907
|
fluent: (props) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 26 24", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsx("path", { d: "M25.973 3.5405V0H0.0274556V3.5405H11.5738C9.39481 4.86942 7.44796 6.53554 5.79813 8.4595H0V12H3.2797C1.21554 15.5331 0.0274556 19.6314 0.0274556 24H3.59169C3.59169 19.5198 5.05433 15.3719 7.52284 11.9975H14.257C10.7975 14.8364 8.58862 19.1306 8.58862 23.9256H12.1529C12.1529 17.3479 17.5392 11.9975 24.1609 11.9975H25.9431V8.45702H10.815C14.4167 5.39504 19.0867 3.53802 24.1884 3.53802H25.9705L25.973 3.5405Z" }) }),
|
|
6858
6908
|
fluentLogomark: (props) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 18 16", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsx("path", { d: "M17.6591 2.36033V0H0.362054V2.36033H8.05961C6.60696 3.24628 5.30906 4.35702 4.20917 5.63967H0.34375V8H2.53022C1.15411 10.3554 0.362054 13.0876 0.362054 16H2.73821C2.73821 13.0132 3.7133 10.2479 5.35898 7.99835H9.84839C7.54212 9.89091 6.0695 12.7537 6.0695 15.9504H8.44565C8.44565 11.5653 12.0365 7.99835 16.451 7.99835H17.6391V5.63802H7.55376C9.95488 3.59669 13.0682 2.35868 16.4694 2.35868H17.6574L17.6591 2.36033Z" }) }),
|
|
6859
6909
|
fluentLogotype: (props) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 63 16", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M0.3125 4.63636V6.75207H2.1878V15.8529H4.85017V6.75207H7.89691V4.63636H4.7653V3.95868C4.7653 3.35207 4.90674 2.89752 5.19128 2.59339C5.47582 2.29091 5.89514 2.13884 6.44925 2.13884C6.71881 2.13884 6.98172 2.17851 7.23797 2.2562C7.49423 2.33388 7.72053 2.44959 7.9202 2.60496L8.64404 0.614876C8.3595 0.403306 8.00839 0.247934 7.58907 0.14876C7.16975 0.0495868 6.72713 0 6.25789 0C4.95 0 3.94663 0.357025 3.24276 1.06942C2.5389 1.78182 2.1878 2.73058 2.1878 3.9157V4.63636H0.3125ZM10.1198 0.148438V15.8526H12.7838V0.148438H10.1198ZM20.1296 15.9991C19.1628 15.9991 18.3109 15.8189 17.5721 15.4586C16.8333 15.0982 16.2575 14.5478 15.8465 13.8073C15.4339 13.0668 15.2292 12.1313 15.2292 11.0024V4.54948H17.8932V10.6454C17.8932 11.6619 18.1245 12.4206 18.5854 12.9197C19.0463 13.4206 19.7036 13.6718 20.5556 13.6718C21.1812 13.6718 21.7237 13.5445 22.1863 13.2916C22.6472 13.0371 23.0099 12.6569 23.2729 12.1478C23.5358 11.6404 23.6672 11.0123 23.6672 10.2635V4.54948H26.3312V15.852H23.7953V14.417C23.4615 14.8264 23.049 15.1596 22.559 15.4173C21.8202 15.8057 21.0098 15.9991 20.1296 15.9991ZM31.0708 15.2467C32.0143 15.7475 33.1192 15.9987 34.3838 15.9987H34.3871C35.3805 15.9987 36.2657 15.8401 37.0395 15.5227C37.8132 15.2053 38.4572 14.7491 38.968 14.1574L37.5403 12.5277C37.1427 12.9508 36.6884 13.2615 36.1775 13.4582C35.6667 13.6549 35.091 13.7541 34.452 13.7541C33.7132 13.7541 33.0593 13.6136 32.4918 13.331C31.9228 13.0483 31.4835 12.6467 31.1706 12.1244C30.9733 11.796 30.8383 11.4361 30.7654 11.045H39.6919C39.7052 10.9177 39.7168 10.7839 39.7235 10.6434C39.7301 10.5029 39.7335 10.3756 39.7335 10.2632C39.7335 9.07642 39.4855 8.04667 38.988 7.17229C38.4905 6.29791 37.8099 5.62022 36.943 5.14088C36.076 4.66154 35.1176 4.42188 33.9811 4.42188C32.8446 4.42188 31.8312 4.66816 30.9443 5.16237C30.0558 5.65659 29.3602 6.33758 28.8561 7.20535C28.3502 8.07311 28.0989 9.08634 28.0989 10.2004C28.0989 11.3144 28.3569 12.3095 28.876 13.1839C29.3952 14.0582 30.1257 14.7458 31.0708 15.2467ZM30.743 9.28799C30.8032 8.86257 30.9283 8.47873 31.1174 8.13592C31.3936 7.6351 31.7763 7.24336 32.2672 6.96072C32.7581 6.67807 33.3438 6.53758 33.9828 6.53758C34.6217 6.53758 35.1858 6.67807 35.6767 6.96072C36.1676 7.24336 36.5536 7.63014 36.8381 8.12435C37.0382 8.47383 37.1642 8.86131 37.2161 9.28799H30.743ZM48.0256 4.42188C48.9341 4.42188 49.7478 4.59873 50.465 4.9508C51.1821 5.30287 51.7462 5.84336 52.1589 6.56898C52.5716 7.29626 52.7762 8.23014 52.7762 9.37394V15.85H50.1122V9.71278C50.1122 8.71113 49.8743 7.96402 49.3984 7.46981C48.9225 6.97559 48.2585 6.72931 47.4066 6.72931C46.7809 6.72931 46.2268 6.85659 45.7443 7.10948C45.2617 7.36402 44.889 7.74088 44.6261 8.24171C44.3632 8.74254 44.2317 9.37394 44.2317 10.1359V15.85H41.5677V4.54915H44.1036V6.01502C44.4512 5.60349 44.8811 5.26694 45.3932 5.00535C46.1536 4.61692 47.0305 4.42353 48.0239 4.42353L48.0256 4.42188ZM53.875 4.63555V6.75125H55.7486V12.1893C55.7486 13.4455 56.0914 14.3926 56.772 15.0355C57.4526 15.6785 58.4193 15.9992 59.669 15.9992H59.6706C60.1532 15.9992 60.6224 15.9364 61.0767 15.8091C61.531 15.6818 61.9137 15.4917 62.2265 15.2372L61.481 13.3529C61.0833 13.6636 60.5858 13.819 59.9901 13.819C59.4926 13.819 59.1065 13.6703 58.8287 13.3744C58.5508 13.0785 58.4127 12.6636 58.4127 12.1265V6.75125H61.4594V4.63555H58.4127V2.05208H55.7486V4.63555H53.875Z" }) }),
|
|
@@ -7047,6 +7097,11 @@ function InlineConnectModal(props) {
|
|
|
7047
7097
|
const connecting = step !== "choice" && authenticated;
|
|
7048
7098
|
const screen = connecting ? "connecting" : step;
|
|
7049
7099
|
const shownError = error || captchaError || (connecting ? signInRefusal || loginError : "");
|
|
7100
|
+
React.useEffect(() => {
|
|
7101
|
+
if (!open || !shownError) return;
|
|
7102
|
+
const id = toast.add({ type: "error", title: shownError });
|
|
7103
|
+
return () => toast.close(id);
|
|
7104
|
+
}, [open, shownError]);
|
|
7050
7105
|
React.useEffect(() => {
|
|
7051
7106
|
if (!open) {
|
|
7052
7107
|
generation.current++;
|
|
@@ -7544,9 +7599,9 @@ function InlineConnectModal(props) {
|
|
|
7544
7599
|
{
|
|
7545
7600
|
"aria-describedby": void 0,
|
|
7546
7601
|
initialFocus: heading,
|
|
7547
|
-
className: "dark flex max-h-[calc(100dvh-2rem)] flex-col overflow-
|
|
7602
|
+
className: "dark flex max-h-[calc(100dvh-2rem)] flex-col overflow-visible text-white antialiased",
|
|
7548
7603
|
children: [
|
|
7549
|
-
/* @__PURE__ */ jsxs("div", { className: "relative z-20 -m-4 min-h-0 overflow-x-hidden overflow-y-auto overscroll-contain p-4", children: [
|
|
7604
|
+
/* @__PURE__ */ jsxs("div", { className: "relative z-20 -m-4 min-h-0 overflow-x-hidden overflow-y-auto overscroll-contain rounded-[inherit] p-4", children: [
|
|
7550
7605
|
/* @__PURE__ */ jsxs(
|
|
7551
7606
|
"div",
|
|
7552
7607
|
{
|
|
@@ -7570,7 +7625,6 @@ function InlineConnectModal(props) {
|
|
|
7570
7625
|
] }),
|
|
7571
7626
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2 p-2.5", children: [
|
|
7572
7627
|
content,
|
|
7573
|
-
shownError && /* @__PURE__ */ jsx("p", { className: "px-2.5 text-xs text-[#ff8fda]", role: "alert", children: shownError }),
|
|
7574
7628
|
captchaError && button(
|
|
7575
7629
|
"Retry verification",
|
|
7576
7630
|
() => {
|
|
@@ -7612,7 +7666,11 @@ function InlineConnectModal(props) {
|
|
|
7612
7666
|
backgroundRepeat: "no-repeat"
|
|
7613
7667
|
}
|
|
7614
7668
|
}
|
|
7615
|
-
)
|
|
7669
|
+
),
|
|
7670
|
+
/* @__PURE__ */ jsxs("span", { className: "pointer-events-none absolute top-full left-1/2 mt-2.5 -translate-x-1/2 rounded-full bg-white/5 px-1.5 text-[9px] font-medium leading-[14px] text-white/35 backdrop-blur-md select-none", children: [
|
|
7671
|
+
"v",
|
|
7672
|
+
version
|
|
7673
|
+
] })
|
|
7616
7674
|
]
|
|
7617
7675
|
}
|
|
7618
7676
|
)
|
|
@@ -7704,7 +7762,7 @@ function SelectItem({
|
|
|
7704
7762
|
{
|
|
7705
7763
|
"data-slot": "select-item",
|
|
7706
7764
|
className: cn(
|
|
7707
|
-
"relative flex w-full cursor-default items-center gap-2 rounded-lg py-2 pr-8 pl-2.5 text-sm outline-hidden select-none focus:bg-foreground/10 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
|
|
7765
|
+
"relative flex w-full cursor-default items-center gap-2 rounded-lg py-2 pr-8 pl-2.5 text-sm font-medium outline-hidden select-none focus:bg-foreground/10 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
|
|
7708
7766
|
className
|
|
7709
7767
|
),
|
|
7710
7768
|
...props,
|
|
@@ -9763,11 +9821,6 @@ function validateBridgeAmount({
|
|
|
9763
9821
|
}
|
|
9764
9822
|
return { wei, incomplete: false };
|
|
9765
9823
|
}
|
|
9766
|
-
var TOKEN_ICONS = {
|
|
9767
|
-
ETH: "eth",
|
|
9768
|
-
USDnr: "usdnr",
|
|
9769
|
-
USDC: "usdc"
|
|
9770
|
-
};
|
|
9771
9824
|
function TokenChainIcon({
|
|
9772
9825
|
symbol,
|
|
9773
9826
|
chain,
|
|
@@ -9777,7 +9830,7 @@ function TokenChainIcon({
|
|
|
9777
9830
|
}) {
|
|
9778
9831
|
const visual = trusted ? VISUAL_BY_DEFAULT_SYMBOL[symbol] : void 0;
|
|
9779
9832
|
const badge = chain === "source" ? CHAIN_BADGE.l1_to_l2 : CHAIN_BADGE.l2_to_l1;
|
|
9780
|
-
const icon =
|
|
9833
|
+
const icon = visual?.icon;
|
|
9781
9834
|
const onBrandTile = visual?.iconClassName.includes("text-white");
|
|
9782
9835
|
const large = size === "lg";
|
|
9783
9836
|
const glyph = large ? "size-5" : "size-4";
|
|
@@ -10848,7 +10901,8 @@ function formatFluentPortfolioPnlAbsolute(delta) {
|
|
|
10848
10901
|
return `$ ${sign}${whole}${separator}${fraction}`;
|
|
10849
10902
|
}
|
|
10850
10903
|
function formatFluentPortfolioPnlPercent(percent) {
|
|
10851
|
-
|
|
10904
|
+
const sign = percent >= 0 ? "+" : "\u2212";
|
|
10905
|
+
return `${sign}${formatFluentLocaleAmount(Math.abs(percent), 2)}%`;
|
|
10852
10906
|
}
|
|
10853
10907
|
|
|
10854
10908
|
// src/core/tokenPrices.ts
|
|
@@ -11617,7 +11671,7 @@ function ReputationFamilyCard({ family, tier }) {
|
|
|
11617
11671
|
const accent = FLUENT_FAMILY_ACCENTS[family] ?? FLUENT_FAMILY_FALLBACK_ACCENT;
|
|
11618
11672
|
const labels = FLUENT_FAMILY_LABELS[family];
|
|
11619
11673
|
const progress = FLUENT_FAMILY_TIER_PROGRESS[tier] ?? 0;
|
|
11620
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2.5 rounded-xl
|
|
11674
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2.5 rounded-xl bg-white/5 p-3", children: [
|
|
11621
11675
|
/* @__PURE__ */ jsx("span", { className: "text-[10px] font-medium uppercase tracking-[0.06em] text-foreground/60", children: FLUENT_FAMILY_DISPLAY_NAMES[family] ?? family }),
|
|
11622
11676
|
/* @__PURE__ */ jsx(
|
|
11623
11677
|
"div",
|
|
@@ -11703,7 +11757,8 @@ function WalletMenuActionCard({
|
|
|
11703
11757
|
}) {
|
|
11704
11758
|
const resolvedConfig = resolveFluentWidgetConfig(config);
|
|
11705
11759
|
const [ownPanel, setOwnPanel] = useState("tokens");
|
|
11706
|
-
const
|
|
11760
|
+
const requestedPanel = panel ?? ownPanel;
|
|
11761
|
+
const homePanel = requestedPanel === "reputation" && !resolvedConfig.reputationEnabled ? "tokens" : requestedPanel;
|
|
11707
11762
|
const setHomePanel = onPanelChange ?? setOwnPanel;
|
|
11708
11763
|
const queryClient2 = useContext(QueryClientContext);
|
|
11709
11764
|
const [historyRevision, setHistoryRevision] = useState(0);
|
|
@@ -12092,283 +12147,238 @@ function WalletMenuActionCard({
|
|
|
12092
12147
|
}
|
|
12093
12148
|
);
|
|
12094
12149
|
}
|
|
12095
|
-
return (
|
|
12096
|
-
|
|
12097
|
-
|
|
12098
|
-
|
|
12099
|
-
|
|
12100
|
-
|
|
12101
|
-
|
|
12102
|
-
|
|
12103
|
-
|
|
12104
|
-
|
|
12105
|
-
|
|
12106
|
-
|
|
12107
|
-
|
|
12108
|
-
|
|
12109
|
-
|
|
12110
|
-
|
|
12111
|
-
|
|
12112
|
-
|
|
12113
|
-
|
|
12114
|
-
|
|
12115
|
-
/* @__PURE__ */ jsxs("
|
|
12116
|
-
|
|
12117
|
-
|
|
12118
|
-
|
|
12119
|
-
|
|
12120
|
-
|
|
12121
|
-
|
|
12122
|
-
|
|
12123
|
-
|
|
12124
|
-
|
|
12125
|
-
|
|
12126
|
-
|
|
12127
|
-
|
|
12128
|
-
|
|
12129
|
-
|
|
12130
|
-
|
|
12131
|
-
|
|
12132
|
-
|
|
12133
|
-
|
|
12134
|
-
|
|
12135
|
-
|
|
12136
|
-
|
|
12137
|
-
|
|
12138
|
-
|
|
12139
|
-
|
|
12140
|
-
|
|
12141
|
-
|
|
12142
|
-
|
|
12143
|
-
|
|
12144
|
-
|
|
12145
|
-
|
|
12146
|
-
|
|
12147
|
-
|
|
12148
|
-
|
|
12149
|
-
FLUENT_DECIMAL_SEPARATOR,
|
|
12150
|
-
"00"
|
|
12151
|
-
] })
|
|
12152
|
-
] }) }),
|
|
12153
|
-
/* @__PURE__ */ jsx("div", { className: "flex min-h-4 items-center gap-1.5 text-xs font-medium leading-none", children: portfolioPnl ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
12154
|
-
/* @__PURE__ */ jsx("span", { className: "inline-flex items-center gap-0.5", children: formatFluentPortfolioPnlAbsolute(portfolioPnl.delta) }),
|
|
12155
|
-
portfolioPnl.percent !== null ? /* @__PURE__ */ jsxs(
|
|
12156
|
-
"span",
|
|
12157
|
-
{
|
|
12158
|
-
className: `inline-flex items-center ${portfolioPnl.delta >= 0 ? "text-green-400" : "text-red-400"}`,
|
|
12159
|
-
children: [
|
|
12160
|
-
/* @__PURE__ */ jsx(
|
|
12161
|
-
Icon,
|
|
12162
|
-
{
|
|
12163
|
-
name: portfolioPnl.delta >= 0 ? "arrow-up-s-fill" : "arrow-down-s-fill",
|
|
12164
|
-
className: "size-3.5"
|
|
12165
|
-
}
|
|
12166
|
-
),
|
|
12167
|
-
/* @__PURE__ */ jsx("span", { children: formatFluentPortfolioPnlPercent(portfolioPnl.percent) })
|
|
12168
|
-
]
|
|
12169
|
-
}
|
|
12170
|
-
) : null
|
|
12171
|
-
] }) : portfolioLoading ? /* @__PURE__ */ jsxs(
|
|
12172
|
-
"span",
|
|
12173
|
-
{
|
|
12174
|
-
className: "relative inline-flex items-center gap-1.5",
|
|
12175
|
-
"aria-busy": "true",
|
|
12176
|
-
"aria-label": "Loading portfolio pnl",
|
|
12177
|
-
children: [
|
|
12178
|
-
/* @__PURE__ */ jsxs("span", { className: "invisible inline-flex items-center gap-1.5", "aria-hidden": "true", children: [
|
|
12179
|
-
/* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-0.5", children: [
|
|
12180
|
-
"$ +0",
|
|
12181
|
-
FLUENT_DECIMAL_SEPARATOR,
|
|
12182
|
-
"00"
|
|
12183
|
-
] }),
|
|
12184
|
-
/* @__PURE__ */ jsxs("span", { className: "inline-flex items-center", children: [
|
|
12185
|
-
/* @__PURE__ */ jsx(Icon, { name: "arrow-up-s-fill", className: "size-3.5" }),
|
|
12186
|
-
/* @__PURE__ */ jsxs("span", { children: [
|
|
12187
|
-
"0",
|
|
12188
|
-
FLUENT_DECIMAL_SEPARATOR,
|
|
12189
|
-
"00%"
|
|
12190
|
-
] })
|
|
12191
|
-
] })
|
|
12192
|
-
] }),
|
|
12193
|
-
/* @__PURE__ */ jsx("span", { className: "absolute inset-0 animate-pulse rounded-md bg-foreground/10" })
|
|
12194
|
-
]
|
|
12195
|
-
}
|
|
12196
|
-
) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
12197
|
-
/* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-0.5", children: [
|
|
12198
|
-
"$ +0",
|
|
12199
|
-
FLUENT_DECIMAL_SEPARATOR,
|
|
12200
|
-
"00"
|
|
12201
|
-
] }),
|
|
12202
|
-
/* @__PURE__ */ jsxs("span", { className: "inline-flex items-center text-green-400", children: [
|
|
12203
|
-
/* @__PURE__ */ jsx(Icon, { name: "arrow-up-s-fill", className: "size-3.5" }),
|
|
12204
|
-
/* @__PURE__ */ jsxs("span", { children: [
|
|
12205
|
-
"0",
|
|
12206
|
-
FLUENT_DECIMAL_SEPARATOR,
|
|
12207
|
-
"00%"
|
|
12208
|
-
] })
|
|
12209
|
-
] })
|
|
12210
|
-
] }) })
|
|
12211
|
-
] }) }),
|
|
12212
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-3 gap-2", children: [
|
|
12213
|
-
/* @__PURE__ */ jsx(
|
|
12214
|
-
Button,
|
|
12215
|
-
{
|
|
12216
|
-
variant: "secondary",
|
|
12217
|
-
className: "h-16 w-full",
|
|
12218
|
-
disabled: usdnrMinter ? mintUsdnrBusy : !actionAddress || !swapperReady,
|
|
12219
|
-
title: usdnrMinter || swapperReady ? void 0 : "Not configured for this app",
|
|
12220
|
-
onClick: usdnrMinter ? () => handleMintUsdnr(usdnrMinter) : handleSwapper,
|
|
12221
|
-
children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-1", children: [
|
|
12222
|
-
/* @__PURE__ */ jsx(Icon, { name: "plus", className: "size-4" }),
|
|
12223
|
-
/* @__PURE__ */ jsx("span", { children: "Get USDnr" })
|
|
12224
|
-
] })
|
|
12225
|
-
}
|
|
12226
|
-
),
|
|
12227
|
-
/* @__PURE__ */ jsx(SwapperOnRampDialog, { config: swapperConfig, onClose: closeSwapper }),
|
|
12228
|
-
/* @__PURE__ */ jsx(
|
|
12229
|
-
Button,
|
|
12230
|
-
{
|
|
12231
|
-
variant: "secondary",
|
|
12232
|
-
className: "h-16 w-full",
|
|
12233
|
-
disabled: !accountAddress || !onSendToken,
|
|
12234
|
-
onClick: handleSend,
|
|
12235
|
-
children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-1", children: [
|
|
12236
|
-
/* @__PURE__ */ jsx(Icon, { name: "arrow-right-up-line", className: "size-4" }),
|
|
12237
|
-
/* @__PURE__ */ jsx("span", { children: "Send" })
|
|
12238
|
-
] })
|
|
12239
|
-
}
|
|
12240
|
-
),
|
|
12241
|
-
/* @__PURE__ */ jsx(
|
|
12242
|
-
Button,
|
|
12243
|
-
{
|
|
12244
|
-
variant: "secondary",
|
|
12245
|
-
className: "h-16 w-full",
|
|
12246
|
-
onClick: () => onTabChange("bridge"),
|
|
12247
|
-
children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-1", children: [
|
|
12248
|
-
/* @__PURE__ */ jsx(Icon, { name: "arrow-up-down-line", className: "size-4" }),
|
|
12249
|
-
/* @__PURE__ */ jsx("span", { children: "Swap" })
|
|
12250
|
-
] })
|
|
12251
|
-
}
|
|
12252
|
-
)
|
|
12253
|
-
] })
|
|
12150
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col gap-4", children: [
|
|
12151
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
12152
|
+
/* @__PURE__ */ jsx("div", { className: "relative overflow-hidden px-4 py-8", children: /* @__PURE__ */ jsxs("div", { className: "relative z-10 flex flex-col items-center gap-1", children: [
|
|
12153
|
+
/* @__PURE__ */ jsx("div", { className: "tracking-tight leading-none", children: portfolioDisplay ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
12154
|
+
/* @__PURE__ */ jsx("span", { className: "mr-1 text-3xl font-semibold", children: "$" }),
|
|
12155
|
+
/* @__PURE__ */ jsx("span", { className: "text-3xl font-semibold", children: portfolioDisplay.whole }),
|
|
12156
|
+
/* @__PURE__ */ jsxs("span", { className: "text-3xl font-semibold", children: [
|
|
12157
|
+
portfolioDisplay.separator,
|
|
12158
|
+
portfolioDisplay.fraction
|
|
12159
|
+
] })
|
|
12160
|
+
] }) : portfolioLoading ? /* @__PURE__ */ jsxs(
|
|
12161
|
+
"span",
|
|
12162
|
+
{
|
|
12163
|
+
className: "relative inline-flex items-baseline",
|
|
12164
|
+
"aria-busy": "true",
|
|
12165
|
+
"aria-label": "Loading portfolio total",
|
|
12166
|
+
children: [
|
|
12167
|
+
/* @__PURE__ */ jsxs("span", { className: "invisible", "aria-hidden": "true", children: [
|
|
12168
|
+
/* @__PURE__ */ jsx("span", { className: "mr-1 text-3xl font-semibold", children: "$" }),
|
|
12169
|
+
/* @__PURE__ */ jsx("span", { className: "text-3xl font-semibold", children: "0" }),
|
|
12170
|
+
/* @__PURE__ */ jsxs("span", { className: "text-3xl font-semibold", children: [
|
|
12171
|
+
FLUENT_DECIMAL_SEPARATOR,
|
|
12172
|
+
"00"
|
|
12173
|
+
] })
|
|
12174
|
+
] }),
|
|
12175
|
+
/* @__PURE__ */ jsx("span", { className: "absolute inset-0 animate-pulse rounded-md bg-foreground/10" })
|
|
12176
|
+
]
|
|
12177
|
+
}
|
|
12178
|
+
) : portfolioUnavailable ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
12179
|
+
/* @__PURE__ */ jsx("span", { className: "mr-1 text-3xl font-semibold", children: "$" }),
|
|
12180
|
+
/* @__PURE__ */ jsx("span", { className: "text-3xl font-semibold", children: "\u2014" })
|
|
12181
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
12182
|
+
/* @__PURE__ */ jsx("span", { className: "mr-1 text-3xl font-semibold", children: "$" }),
|
|
12183
|
+
/* @__PURE__ */ jsx("span", { className: "text-3xl font-semibold", children: "0" }),
|
|
12184
|
+
/* @__PURE__ */ jsxs("span", { className: "text-3xl font-semibold", children: [
|
|
12185
|
+
FLUENT_DECIMAL_SEPARATOR,
|
|
12186
|
+
"00"
|
|
12187
|
+
] })
|
|
12188
|
+
] }) }),
|
|
12189
|
+
/* @__PURE__ */ jsx("div", { className: "flex min-h-4 items-center gap-1.5 text-sm font-medium leading-none", children: portfolioPnl ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
12190
|
+
/* @__PURE__ */ jsx("span", { className: "inline-flex items-center gap-0.5", children: formatFluentPortfolioPnlAbsolute(portfolioPnl.delta) }),
|
|
12191
|
+
portfolioPnl.percent !== null ? /* @__PURE__ */ jsx("span", { className: portfolioPnl.delta >= 0 ? "text-green-400" : "text-red-400", children: formatFluentPortfolioPnlPercent(portfolioPnl.percent) }) : null
|
|
12192
|
+
] }) : portfolioLoading ? /* @__PURE__ */ jsxs(
|
|
12193
|
+
"span",
|
|
12194
|
+
{
|
|
12195
|
+
className: "relative inline-flex items-center gap-1.5",
|
|
12196
|
+
"aria-busy": "true",
|
|
12197
|
+
"aria-label": "Loading portfolio pnl",
|
|
12198
|
+
children: [
|
|
12199
|
+
/* @__PURE__ */ jsxs("span", { className: "invisible inline-flex items-center gap-1.5", "aria-hidden": "true", children: [
|
|
12200
|
+
/* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-0.5", children: [
|
|
12201
|
+
"$ +0",
|
|
12202
|
+
FLUENT_DECIMAL_SEPARATOR,
|
|
12203
|
+
"00"
|
|
12254
12204
|
] }),
|
|
12255
|
-
/* @__PURE__ */ jsxs(
|
|
12256
|
-
|
|
12257
|
-
|
|
12258
|
-
|
|
12259
|
-
/* @__PURE__ */ jsx(TabsTrigger, { value: "activity", children: "Activity" })
|
|
12260
|
-
] }),
|
|
12261
|
-
homePanel === "activity" ? /* @__PURE__ */ jsx(
|
|
12262
|
-
Button,
|
|
12263
|
-
{
|
|
12264
|
-
variant: "ghost",
|
|
12265
|
-
size: "icon-sm",
|
|
12266
|
-
"aria-label": "Refresh activity",
|
|
12267
|
-
className: "rounded-full",
|
|
12268
|
-
disabled: transactionsBusy || refreshingActivity,
|
|
12269
|
-
onClick: refreshActivity,
|
|
12270
|
-
children: /* @__PURE__ */ jsx(
|
|
12271
|
-
RefreshCw,
|
|
12272
|
-
{
|
|
12273
|
-
className: cn("size-3.5", refreshingActivity && "animate-spin"),
|
|
12274
|
-
"aria-hidden": true
|
|
12275
|
-
}
|
|
12276
|
-
)
|
|
12277
|
-
}
|
|
12278
|
-
) : null
|
|
12279
|
-
] }),
|
|
12280
|
-
/* @__PURE__ */ jsx(TabsContent, { value: "tokens", className: "pt-2", children: /* @__PURE__ */ jsx(
|
|
12281
|
-
WalletMenuTokenList,
|
|
12282
|
-
{
|
|
12283
|
-
accountAddress,
|
|
12284
|
-
balances,
|
|
12285
|
-
busy: balancesBusy,
|
|
12286
|
-
usdPrices: prices,
|
|
12287
|
-
tokens: displayTokens,
|
|
12288
|
-
selectedSymbol: gasPaymentToken,
|
|
12289
|
-
onRemoveUserToken: removeUserToken,
|
|
12290
|
-
actionsDisabled: settingsPending,
|
|
12291
|
-
error: tokenListError
|
|
12292
|
-
}
|
|
12293
|
-
) }),
|
|
12294
|
-
/* @__PURE__ */ jsx(TabsContent, { value: "activity", className: "pt-2", children: /* @__PURE__ */ jsx(
|
|
12295
|
-
WalletMenuActivity,
|
|
12296
|
-
{
|
|
12297
|
-
network: resolvedConfig.network,
|
|
12298
|
-
fluent: {
|
|
12299
|
-
address: accountAddress,
|
|
12300
|
-
entries: transactions,
|
|
12301
|
-
pending: pendingTransfers,
|
|
12302
|
-
busy: transactionsBusy,
|
|
12303
|
-
loadingMore: transactionsLoadingMore,
|
|
12304
|
-
hasMore: hasMoreTransactions,
|
|
12305
|
-
loadMore: loadMoreTransactions,
|
|
12306
|
-
error: transactionsError
|
|
12307
|
-
},
|
|
12308
|
-
externalWalletAddress,
|
|
12309
|
-
usdPrices: prices,
|
|
12310
|
-
tokens: displayTokens,
|
|
12311
|
-
depositSwap: depositSwap?.state,
|
|
12312
|
-
sentDeposits,
|
|
12313
|
-
onOpenDepositSwap: () => onTabChange(DEPOSIT_SWAP_TAB),
|
|
12314
|
-
onOpenBridgeRow: (selection) => {
|
|
12315
|
-
setActivity({ kind: "bridge", selection });
|
|
12316
|
-
onTabChange("activity");
|
|
12317
|
-
},
|
|
12318
|
-
onOpenFluentEntry: (entry) => {
|
|
12319
|
-
if (!accountAddress) return;
|
|
12320
|
-
setActivity({ kind: "fluent", selection: { entry, account: accountAddress } });
|
|
12321
|
-
onTabChange("activity");
|
|
12322
|
-
}
|
|
12323
|
-
}
|
|
12324
|
-
) })
|
|
12205
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
12206
|
+
"+0",
|
|
12207
|
+
FLUENT_DECIMAL_SEPARATOR,
|
|
12208
|
+
"00%"
|
|
12325
12209
|
] })
|
|
12326
|
-
]
|
|
12327
|
-
|
|
12328
|
-
|
|
12329
|
-
|
|
12330
|
-
|
|
12331
|
-
|
|
12332
|
-
|
|
12333
|
-
|
|
12334
|
-
|
|
12335
|
-
|
|
12336
|
-
|
|
12337
|
-
|
|
12338
|
-
|
|
12339
|
-
|
|
12340
|
-
|
|
12341
|
-
|
|
12342
|
-
|
|
12343
|
-
|
|
12344
|
-
|
|
12345
|
-
|
|
12346
|
-
|
|
12347
|
-
|
|
12348
|
-
|
|
12349
|
-
|
|
12350
|
-
|
|
12351
|
-
|
|
12352
|
-
|
|
12353
|
-
|
|
12354
|
-
|
|
12355
|
-
|
|
12210
|
+
] }),
|
|
12211
|
+
/* @__PURE__ */ jsx("span", { className: "absolute inset-0 animate-pulse rounded-md bg-foreground/10" })
|
|
12212
|
+
]
|
|
12213
|
+
}
|
|
12214
|
+
) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
12215
|
+
/* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-0.5", children: [
|
|
12216
|
+
"$ +0",
|
|
12217
|
+
FLUENT_DECIMAL_SEPARATOR,
|
|
12218
|
+
"00"
|
|
12219
|
+
] }),
|
|
12220
|
+
/* @__PURE__ */ jsxs("span", { className: "text-green-400", children: [
|
|
12221
|
+
"+0",
|
|
12222
|
+
FLUENT_DECIMAL_SEPARATOR,
|
|
12223
|
+
"00%"
|
|
12224
|
+
] })
|
|
12225
|
+
] }) })
|
|
12226
|
+
] }) }),
|
|
12227
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-3 gap-2", children: [
|
|
12228
|
+
/* @__PURE__ */ jsx(
|
|
12229
|
+
Button,
|
|
12230
|
+
{
|
|
12231
|
+
variant: "secondary",
|
|
12232
|
+
className: "h-16 w-full",
|
|
12233
|
+
disabled: usdnrMinter ? mintUsdnrBusy : !actionAddress || !swapperReady,
|
|
12234
|
+
title: usdnrMinter || swapperReady ? void 0 : "Not configured for this app",
|
|
12235
|
+
onClick: usdnrMinter ? () => handleMintUsdnr(usdnrMinter) : handleSwapper,
|
|
12236
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-1", children: [
|
|
12237
|
+
/* @__PURE__ */ jsx(Icon, { name: "plus", className: "size-4" }),
|
|
12238
|
+
/* @__PURE__ */ jsx("span", { children: "Get USDnr" })
|
|
12239
|
+
] })
|
|
12240
|
+
}
|
|
12241
|
+
),
|
|
12242
|
+
/* @__PURE__ */ jsx(SwapperOnRampDialog, { config: swapperConfig, onClose: closeSwapper }),
|
|
12243
|
+
/* @__PURE__ */ jsx(
|
|
12244
|
+
Button,
|
|
12245
|
+
{
|
|
12246
|
+
variant: "secondary",
|
|
12247
|
+
className: "h-16 w-full",
|
|
12248
|
+
disabled: !accountAddress || !onSendToken,
|
|
12249
|
+
onClick: handleSend,
|
|
12250
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-1", children: [
|
|
12251
|
+
/* @__PURE__ */ jsx(Icon, { name: "arrow-right-up-line", className: "size-4" }),
|
|
12252
|
+
/* @__PURE__ */ jsx("span", { children: "Send" })
|
|
12253
|
+
] })
|
|
12254
|
+
}
|
|
12255
|
+
),
|
|
12256
|
+
/* @__PURE__ */ jsx(
|
|
12257
|
+
Button,
|
|
12258
|
+
{
|
|
12259
|
+
variant: "secondary",
|
|
12260
|
+
className: "h-16 w-full",
|
|
12261
|
+
onClick: () => onTabChange("bridge"),
|
|
12262
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-1", children: [
|
|
12263
|
+
/* @__PURE__ */ jsx(Icon, { name: "arrow-up-down-line", className: "size-4" }),
|
|
12264
|
+
/* @__PURE__ */ jsx("span", { children: "Swap" })
|
|
12265
|
+
] })
|
|
12266
|
+
}
|
|
12267
|
+
)
|
|
12268
|
+
] })
|
|
12269
|
+
] }),
|
|
12270
|
+
/* @__PURE__ */ jsxs(Tabs, { value: homePanel, onValueChange: setHomePanel, className: "flex w-full flex-col", children: [
|
|
12271
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
12272
|
+
/* @__PURE__ */ jsxs(TabsList, { variant: "line", children: [
|
|
12273
|
+
/* @__PURE__ */ jsx(TabsTrigger, { value: "tokens", children: "Tokens" }),
|
|
12274
|
+
/* @__PURE__ */ jsx(TabsTrigger, { value: "activity", children: "Activity" }),
|
|
12275
|
+
reputationEnabled ? /* @__PURE__ */ jsx(TabsTrigger, { value: "reputation", children: "Reputation" }) : null
|
|
12276
|
+
] }),
|
|
12277
|
+
homePanel === "activity" ? /* @__PURE__ */ jsx(
|
|
12278
|
+
Button,
|
|
12279
|
+
{
|
|
12280
|
+
variant: "ghost",
|
|
12281
|
+
size: "icon-sm",
|
|
12282
|
+
"aria-label": "Refresh activity",
|
|
12283
|
+
className: "rounded-full",
|
|
12284
|
+
disabled: transactionsBusy || refreshingActivity,
|
|
12285
|
+
onClick: refreshActivity,
|
|
12286
|
+
children: /* @__PURE__ */ jsx(
|
|
12287
|
+
RefreshCw,
|
|
12356
12288
|
{
|
|
12357
|
-
|
|
12358
|
-
|
|
12359
|
-
action: {
|
|
12360
|
-
label: "Connect with X",
|
|
12361
|
-
icon: "x",
|
|
12362
|
-
onClick: onConnectWithX
|
|
12363
|
-
}
|
|
12289
|
+
className: cn("size-3.5", refreshingActivity && "animate-spin"),
|
|
12290
|
+
"aria-hidden": true
|
|
12364
12291
|
}
|
|
12365
|
-
)
|
|
12366
|
-
|
|
12367
|
-
|
|
12368
|
-
|
|
12369
|
-
|
|
12370
|
-
|
|
12371
|
-
|
|
12292
|
+
)
|
|
12293
|
+
}
|
|
12294
|
+
) : null
|
|
12295
|
+
] }),
|
|
12296
|
+
/* @__PURE__ */ jsx(TabsContent, { value: "tokens", className: "pt-2", children: /* @__PURE__ */ jsx(
|
|
12297
|
+
WalletMenuTokenList,
|
|
12298
|
+
{
|
|
12299
|
+
accountAddress,
|
|
12300
|
+
balances,
|
|
12301
|
+
busy: balancesBusy,
|
|
12302
|
+
usdPrices: prices,
|
|
12303
|
+
tokens: displayTokens,
|
|
12304
|
+
selectedSymbol: gasPaymentToken,
|
|
12305
|
+
onRemoveUserToken: removeUserToken,
|
|
12306
|
+
actionsDisabled: settingsPending,
|
|
12307
|
+
error: tokenListError
|
|
12308
|
+
}
|
|
12309
|
+
) }),
|
|
12310
|
+
/* @__PURE__ */ jsx(TabsContent, { value: "activity", className: "pt-2", children: /* @__PURE__ */ jsx(
|
|
12311
|
+
WalletMenuActivity,
|
|
12312
|
+
{
|
|
12313
|
+
network: resolvedConfig.network,
|
|
12314
|
+
fluent: {
|
|
12315
|
+
address: accountAddress,
|
|
12316
|
+
entries: transactions,
|
|
12317
|
+
pending: pendingTransfers,
|
|
12318
|
+
busy: transactionsBusy,
|
|
12319
|
+
loadingMore: transactionsLoadingMore,
|
|
12320
|
+
hasMore: hasMoreTransactions,
|
|
12321
|
+
loadMore: loadMoreTransactions,
|
|
12322
|
+
error: transactionsError
|
|
12323
|
+
},
|
|
12324
|
+
externalWalletAddress,
|
|
12325
|
+
usdPrices: prices,
|
|
12326
|
+
tokens: displayTokens,
|
|
12327
|
+
depositSwap: depositSwap?.state,
|
|
12328
|
+
sentDeposits,
|
|
12329
|
+
onOpenDepositSwap: () => onTabChange(DEPOSIT_SWAP_TAB),
|
|
12330
|
+
onOpenBridgeRow: (selection) => {
|
|
12331
|
+
setActivity({ kind: "bridge", selection });
|
|
12332
|
+
onTabChange("activity");
|
|
12333
|
+
},
|
|
12334
|
+
onOpenFluentEntry: (entry) => {
|
|
12335
|
+
if (!accountAddress) return;
|
|
12336
|
+
setActivity({ kind: "fluent", selection: { entry, account: accountAddress } });
|
|
12337
|
+
onTabChange("activity");
|
|
12338
|
+
}
|
|
12339
|
+
}
|
|
12340
|
+
) }),
|
|
12341
|
+
reputationEnabled ? /* @__PURE__ */ jsxs(TabsContent, { value: "reputation", className: "flex flex-col gap-2 pt-2", children: [
|
|
12342
|
+
reputation.phase === "ready" ? /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2", children: orderedFamilyKeys(reputation.families.families).map((name) => /* @__PURE__ */ jsx(
|
|
12343
|
+
ReputationFamilyCard,
|
|
12344
|
+
{
|
|
12345
|
+
family: name,
|
|
12346
|
+
tier: reputation.families.families[name].tier
|
|
12347
|
+
},
|
|
12348
|
+
name
|
|
12349
|
+
)) }) : null,
|
|
12350
|
+
reputation.phase === "loading" ? /* @__PURE__ */ jsx(
|
|
12351
|
+
"div",
|
|
12352
|
+
{
|
|
12353
|
+
className: "flex items-center justify-center rounded-xl bg-foreground/5 px-4 py-8",
|
|
12354
|
+
"aria-busy": "true",
|
|
12355
|
+
"aria-label": "Loading reputation",
|
|
12356
|
+
children: /* @__PURE__ */ jsx(Spinner, { className: "size-5 text-foreground/70" })
|
|
12357
|
+
}
|
|
12358
|
+
) : null,
|
|
12359
|
+
reputation.phase === "disconnected" ? /* @__PURE__ */ jsx(
|
|
12360
|
+
ReputationNotice,
|
|
12361
|
+
{
|
|
12362
|
+
title: "Not connected",
|
|
12363
|
+
description: "Connect with Fluent ID to see your reputation."
|
|
12364
|
+
}
|
|
12365
|
+
) : null,
|
|
12366
|
+
reputation.phase === "signup" ? /* @__PURE__ */ jsx(
|
|
12367
|
+
ReputationNotice,
|
|
12368
|
+
{
|
|
12369
|
+
title: "No reputation available",
|
|
12370
|
+
description: "Connect your X account to access your reputation.",
|
|
12371
|
+
action: {
|
|
12372
|
+
label: "Connect with X",
|
|
12373
|
+
icon: "x",
|
|
12374
|
+
onClick: onConnectWithX
|
|
12375
|
+
}
|
|
12376
|
+
}
|
|
12377
|
+
) : null,
|
|
12378
|
+
reputation.phase === "error" ? /* @__PURE__ */ jsx(ReputationNotice, { title: "Could not load reputation", description: reputation.message }) : null
|
|
12379
|
+
] }) : null
|
|
12380
|
+
] })
|
|
12381
|
+
] });
|
|
12372
12382
|
}
|
|
12373
12383
|
var FLUENT_MAINNET_SWAP_CONTRACTS = {
|
|
12374
12384
|
router: getAddress("0x23a82a0239F0b88De669Ac9c46222a9e62853701"),
|
|
@@ -15066,21 +15076,57 @@ function createFluentZeroDevErc20Paymaster(params) {
|
|
|
15066
15076
|
}
|
|
15067
15077
|
};
|
|
15068
15078
|
}
|
|
15069
|
-
|
|
15079
|
+
var FluentGasPaymentError = class extends Error {
|
|
15080
|
+
constructor(code, message2, options) {
|
|
15081
|
+
super(message2, options);
|
|
15082
|
+
this.code = code;
|
|
15083
|
+
this.name = "FluentGasPaymentError";
|
|
15084
|
+
}
|
|
15085
|
+
code;
|
|
15086
|
+
};
|
|
15087
|
+
var erc20PaymasterAddresses = /* @__PURE__ */ new Map();
|
|
15088
|
+
async function readFluentZeroDevErc20PaymasterAddress(params = {}) {
|
|
15070
15089
|
const chain = params.chain ?? fluentTestnet;
|
|
15071
|
-
const
|
|
15072
|
-
|
|
15073
|
-
|
|
15074
|
-
);
|
|
15075
|
-
const paymasterClient = params.paymasterClient ?? createFluentZeroDevErc20PaymasterClient({
|
|
15076
|
-
|
|
15077
|
-
|
|
15078
|
-
|
|
15079
|
-
|
|
15080
|
-
|
|
15081
|
-
|
|
15082
|
-
|
|
15083
|
-
})
|
|
15090
|
+
const paymasterRpcUrl = params.paymasterRpcUrl ?? createFluentZeroDevErc20PaymasterRpcUrl({ chainId: chain.id });
|
|
15091
|
+
const cacheKey = params.paymasterClient ? void 0 : paymasterRpcUrl;
|
|
15092
|
+
const known = cacheKey ? erc20PaymasterAddresses.get(cacheKey) : void 0;
|
|
15093
|
+
if (known) return known;
|
|
15094
|
+
const paymasterClient = params.paymasterClient ?? createFluentZeroDevErc20PaymasterClient({ chain, paymasterRpcUrl });
|
|
15095
|
+
const request = paymasterClient.request;
|
|
15096
|
+
let response;
|
|
15097
|
+
try {
|
|
15098
|
+
response = await request({
|
|
15099
|
+
method: "zd_pm_accounts",
|
|
15100
|
+
params: [{ chainId: chain.id, entryPointAddress: getEntryPoint("0.7").address }]
|
|
15101
|
+
});
|
|
15102
|
+
} catch (err) {
|
|
15103
|
+
throw new FluentGasPaymentError(
|
|
15104
|
+
"paymaster_unavailable",
|
|
15105
|
+
`ZeroDev could not name the ERC-20 paymaster for chain ${chain.id}`,
|
|
15106
|
+
{ cause: err }
|
|
15107
|
+
);
|
|
15108
|
+
}
|
|
15109
|
+
const address = Array.isArray(response) ? response[0] : void 0;
|
|
15110
|
+
if (typeof address !== "string" || !isAddress(address)) {
|
|
15111
|
+
throw new FluentGasPaymentError(
|
|
15112
|
+
"paymaster_unavailable",
|
|
15113
|
+
`ZeroDev named no ERC-20 paymaster for chain ${chain.id}`
|
|
15114
|
+
);
|
|
15115
|
+
}
|
|
15116
|
+
const paymaster = getAddress(address);
|
|
15117
|
+
if (cacheKey) erc20PaymasterAddresses.set(cacheKey, paymaster);
|
|
15118
|
+
return paymaster;
|
|
15119
|
+
}
|
|
15120
|
+
function createFluentErc20ApproveCall(params) {
|
|
15121
|
+
return {
|
|
15122
|
+
to: params.gasToken,
|
|
15123
|
+
data: encodeFunctionData({
|
|
15124
|
+
abi: erc20Abi,
|
|
15125
|
+
functionName: "approve",
|
|
15126
|
+
args: [params.spender, params.amount]
|
|
15127
|
+
}),
|
|
15128
|
+
value: 0n
|
|
15129
|
+
};
|
|
15084
15130
|
}
|
|
15085
15131
|
function getPaymasterContextToken(context) {
|
|
15086
15132
|
if (!context || typeof context !== "object") return void 0;
|
|
@@ -16052,6 +16098,38 @@ function useFluentZeroDevAccount(hookOptions = {}) {
|
|
|
16052
16098
|
refresh: () => initialize2({ throwOnError: true, signerMode: "prompt" })
|
|
16053
16099
|
};
|
|
16054
16100
|
}
|
|
16101
|
+
async function prepareFluentGasTokenApproval(params) {
|
|
16102
|
+
const { kernel, gasToken, network, gasPayment } = params;
|
|
16103
|
+
const paymaster = await readFluentZeroDevErc20PaymasterAddress({ chain: kernel.chain });
|
|
16104
|
+
if (gasPayment.includeApproval) {
|
|
16105
|
+
return createFluentErc20ApproveCall({
|
|
16106
|
+
gasToken,
|
|
16107
|
+
spender: paymaster,
|
|
16108
|
+
amount: gasPayment.approveAmount
|
|
16109
|
+
});
|
|
16110
|
+
}
|
|
16111
|
+
const automatic = getFluentGasTokenApproval(gasToken, network);
|
|
16112
|
+
if (!automatic) {
|
|
16113
|
+
debugWarn("[fluent zerodev] no automatic approval for this Gas token", { gasToken });
|
|
16114
|
+
return void 0;
|
|
16115
|
+
}
|
|
16116
|
+
let allowance = 0n;
|
|
16117
|
+
try {
|
|
16118
|
+
allowance = await kernel.publicClient.readContract({
|
|
16119
|
+
address: gasToken,
|
|
16120
|
+
abi: erc20Abi,
|
|
16121
|
+
functionName: "allowance",
|
|
16122
|
+
args: [kernel.smartAccountAddress, paymaster]
|
|
16123
|
+
});
|
|
16124
|
+
} catch (err) {
|
|
16125
|
+
debugWarn("[fluent zerodev] Gas token allowance unreadable, approving", {
|
|
16126
|
+
gasToken,
|
|
16127
|
+
error: err instanceof Error ? err.message : String(err)
|
|
16128
|
+
});
|
|
16129
|
+
}
|
|
16130
|
+
if (allowance >= automatic.refreshBelow) return void 0;
|
|
16131
|
+
return createFluentErc20ApproveCall({ gasToken, spender: paymaster, amount: automatic.amount });
|
|
16132
|
+
}
|
|
16055
16133
|
async function sendCalls(context, calls, options, readyAccount) {
|
|
16056
16134
|
const {
|
|
16057
16135
|
kernels,
|
|
@@ -16078,21 +16156,20 @@ async function sendCalls(context, calls, options, readyAccount) {
|
|
|
16078
16156
|
const executionKernel = knownKernel ?? await initialize2({ signerMode, throwOnError: true });
|
|
16079
16157
|
if (!executionKernel) throw new Error(error?.message ?? "ZeroDev smart account is not ready");
|
|
16080
16158
|
const gasToken = options?.gasPayment?.symbol ? getFluentGasTokenAddress(options.gasPayment.symbol, network) : void 0;
|
|
16081
|
-
const
|
|
16082
|
-
|
|
16083
|
-
|
|
16084
|
-
|
|
16085
|
-
|
|
16086
|
-
|
|
16087
|
-
|
|
16088
|
-
}
|
|
16159
|
+
const approval = gasToken && options?.gasPayment ? await prepareFluentGasTokenApproval({
|
|
16160
|
+
kernel: executionKernel,
|
|
16161
|
+
gasToken,
|
|
16162
|
+
network,
|
|
16163
|
+
gasPayment: options.gasPayment
|
|
16164
|
+
}) : void 0;
|
|
16165
|
+
const preparedCalls = approval ? [approval, ...calls] : [...calls];
|
|
16089
16166
|
debugLog("[fluent zerodev] sendCalls", {
|
|
16090
16167
|
signerMode,
|
|
16091
16168
|
smartAccountAddress: executionKernel.smartAccountAddress,
|
|
16092
16169
|
gasToken,
|
|
16093
16170
|
gasTokenSymbol: options?.gasPayment?.symbol,
|
|
16094
16171
|
sponsorship: options?.gasPayment?.sponsorship ?? "auto",
|
|
16095
|
-
approvalIncluded: Boolean(
|
|
16172
|
+
approvalIncluded: Boolean(approval),
|
|
16096
16173
|
calls: preparedCalls.map((call) => ({
|
|
16097
16174
|
to: call.to,
|
|
16098
16175
|
hasData: Boolean(call.data && call.data !== "0x"),
|
|
@@ -21316,6 +21393,6 @@ function useFluentIframeBridge(iframeRef, { allowedOrigin }) {
|
|
|
21316
21393
|
}, [address]);
|
|
21317
21394
|
}
|
|
21318
21395
|
|
|
21319
|
-
export { AccountAvatar, FluentAuthError, FluentReviewRejectedError, FluentSponsorshipFallbackError, FluentUserOperationGasError, FluentWidget, FluentWidgetConfigError, fluentMainnet, fluentTestnet, getFluentChainByChainId, getFluentChainForNetwork, useFluentIframeBridge, useFluentWidget, useLinkX };
|
|
21396
|
+
export { AccountAvatar, FluentAuthError, FluentGasPaymentError, FluentReviewRejectedError, FluentSponsorshipFallbackError, FluentUserOperationGasError, FluentWidget, FluentWidgetConfigError, fluentMainnet, fluentTestnet, getFluentChainByChainId, getFluentChainForNetwork, useFluentIframeBridge, useFluentWidget, useLinkX };
|
|
21320
21397
|
//# sourceMappingURL=index.js.map
|
|
21321
21398
|
//# sourceMappingURL=index.js.map
|