@fluent.xyz/connect 0.1.3 → 0.1.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/README.md +1 -1
- package/dist/fluent-connect.css +1 -1
- package/dist/index.d.ts +108 -157
- package/dist/index.js +477 -279
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -15,18 +15,20 @@ import { WagmiAdapter } from '@reown/appkit-adapter-wagmi';
|
|
|
15
15
|
import { createAppKit, useAppKit } from '@reown/appkit/react';
|
|
16
16
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
17
17
|
import { WagmiProvider, useAccount, useDisconnect, useWalletClient, useSwitchChain } from 'wagmi';
|
|
18
|
+
import { coinbaseWallet, baseAccount } from 'wagmi/connectors';
|
|
18
19
|
import { Button as Button$1 } from '@base-ui/react/button';
|
|
19
20
|
import { cva } from 'class-variance-authority';
|
|
20
21
|
import { clsx } from 'clsx';
|
|
21
22
|
import { twMerge } from 'tailwind-merge';
|
|
22
23
|
import { Dialog as Dialog$1 } from '@base-ui/react/dialog';
|
|
23
|
-
import { XIcon, Loader2, ExternalLink, Copy, LogOut, ChevronDownIcon, CheckIcon, ChevronUpIcon, CircleCheckIcon, InfoIcon, TriangleAlertIcon, OctagonXIcon
|
|
24
|
+
import { XIcon, Loader2, ChevronLeft, ExternalLink, Copy, Settings, LogOut, ChevronDownIcon, CheckIcon, Loader2Icon, ChevronUpIcon, CircleCheckIcon, InfoIcon, TriangleAlertIcon, OctagonXIcon } from 'lucide-react';
|
|
24
25
|
import { openSwapperModal } from '@swapper-finance/deposit-sdk';
|
|
25
26
|
import { Separator as Separator$1 } from '@base-ui/react/separator';
|
|
26
27
|
import { Select as Select$1 } from '@base-ui/react/select';
|
|
27
28
|
import { Switch as Switch$1 } from '@base-ui/react/switch';
|
|
28
29
|
import { Tabs as Tabs$1 } from '@base-ui/react/tabs';
|
|
29
30
|
import { Toast as Toast$1 } from '@base-ui/react/toast';
|
|
31
|
+
import { Tooltip as Tooltip$1 } from '@base-ui/react/tooltip';
|
|
30
32
|
import { Drawer as Drawer$1 } from '@base-ui/react/drawer';
|
|
31
33
|
|
|
32
34
|
var __defProp = Object.defineProperty;
|
|
@@ -46,33 +48,6 @@ var fluentBridgeAbi = [
|
|
|
46
48
|
}
|
|
47
49
|
];
|
|
48
50
|
|
|
49
|
-
// ../registry/data/chains/fluent-devnet.json
|
|
50
|
-
var fluent_devnet_default = {
|
|
51
|
-
id: "fluent-devnet",
|
|
52
|
-
name: "Fluent Developer Preview",
|
|
53
|
-
chainId: 20993,
|
|
54
|
-
testnet: true,
|
|
55
|
-
nativeCurrency: {
|
|
56
|
-
name: "Ether",
|
|
57
|
-
symbol: "ETH",
|
|
58
|
-
decimals: 18
|
|
59
|
-
},
|
|
60
|
-
rpcUrls: {
|
|
61
|
-
default: {
|
|
62
|
-
http: ["https://rpc.devnet.fluent.xyz/"],
|
|
63
|
-
webSocket: ["wss://rpc.dev.gblend.xyz/ws"]
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
blockExplorers: {
|
|
67
|
-
default: {
|
|
68
|
-
name: "Fluentscan Devnet",
|
|
69
|
-
url: "https://devnet.fluentscan.xyz"
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
infoURL: "https://docs.fluent.xyz/",
|
|
73
|
-
faucets: ["https://testnet.fluent.xyz/dev-portal"]
|
|
74
|
-
};
|
|
75
|
-
|
|
76
51
|
// ../registry/data/chains/fluent-mainnet.json
|
|
77
52
|
var fluent_mainnet_default = {
|
|
78
53
|
id: "fluent-mainnet",
|
|
@@ -4384,7 +4359,6 @@ function parse(schema, value) {
|
|
|
4384
4359
|
return schema.parse(value);
|
|
4385
4360
|
}
|
|
4386
4361
|
var fluentChains = {
|
|
4387
|
-
devnet: parse(fluentChainSchema, fluent_devnet_default),
|
|
4388
4362
|
testnet: parse(fluentChainSchema, fluent_testnet_default),
|
|
4389
4363
|
mainnet: parse(fluentChainSchema, fluent_mainnet_default)
|
|
4390
4364
|
};
|
|
@@ -4499,12 +4473,10 @@ function l1DefinitionToViemChain(definition) {
|
|
|
4499
4473
|
}
|
|
4500
4474
|
|
|
4501
4475
|
// ../connect-sdk/src/chains.ts
|
|
4502
|
-
var fluentDevnet = fluentDefinitionToViemChain(fluentChains.devnet);
|
|
4503
4476
|
var fluentTestnet = fluentDefinitionToViemChain(fluentChains.testnet);
|
|
4504
4477
|
var fluentMainnet = fluentDefinitionToViemChain(fluentChains.mainnet);
|
|
4505
4478
|
l1DefinitionToViemChain(l1Chains.sepolia);
|
|
4506
4479
|
var fluent = {
|
|
4507
|
-
devnet: fluentDevnet,
|
|
4508
4480
|
testnet: fluentTestnet,
|
|
4509
4481
|
mainnet: fluentMainnet
|
|
4510
4482
|
};
|
|
@@ -4704,25 +4676,10 @@ var fluentMainnetWidgetTokens = [
|
|
|
4704
4676
|
fluentMainnetTokenDefaults.USDnr,
|
|
4705
4677
|
fluentMainnetTokenDefaults.BLEND
|
|
4706
4678
|
];
|
|
4707
|
-
function withChainId(defaults, chainId) {
|
|
4708
|
-
return Object.fromEntries(
|
|
4709
|
-
Object.entries(defaults).map(([key, token]) => [key, { ...token, chainId }])
|
|
4710
|
-
);
|
|
4711
|
-
}
|
|
4712
|
-
var fluentDevnetTokenDefaults = withChainId(fluentTestnetTokenDefaults, 20993);
|
|
4713
|
-
var fluentDevnetWidgetTokens = [
|
|
4714
|
-
fluentDevnetTokenDefaults.ETH,
|
|
4715
|
-
fluentDevnetTokenDefaults.USDnr,
|
|
4716
|
-
fluentDevnetTokenDefaults.BLEND,
|
|
4717
|
-
fluentDevnetTokenDefaults.USDC,
|
|
4718
|
-
fluentDevnetTokenDefaults.USDT
|
|
4719
|
-
];
|
|
4720
4679
|
function getFluentTokenDefaultsForNetwork(network) {
|
|
4721
4680
|
switch (network) {
|
|
4722
4681
|
case "mainnet":
|
|
4723
4682
|
return fluentMainnetTokenDefaults;
|
|
4724
|
-
case "devnet":
|
|
4725
|
-
return fluentDevnetTokenDefaults;
|
|
4726
4683
|
default:
|
|
4727
4684
|
return fluentTestnetTokenDefaults;
|
|
4728
4685
|
}
|
|
@@ -4971,7 +4928,6 @@ var FLUENT_NETWORK_ENV_KEYS = [
|
|
|
4971
4928
|
"FLUENT_NETWORK"
|
|
4972
4929
|
];
|
|
4973
4930
|
var FLUENT_NETWORK_ALIASES = {
|
|
4974
|
-
devnet: "devnet",
|
|
4975
4931
|
testnet: "testnet",
|
|
4976
4932
|
mainnet: "mainnet",
|
|
4977
4933
|
development: "testnet",
|
|
@@ -5014,7 +4970,7 @@ var FLUENT_WIDGET_DEFAULT_SCOPES = [
|
|
|
5014
4970
|
];
|
|
5015
4971
|
var FLUENT_WIDGET_MAINNET_SCOPES = ["openid", "profile", "wallet", "families:read"];
|
|
5016
4972
|
function isFaucetNetwork(network) {
|
|
5017
|
-
return network === "
|
|
4973
|
+
return network === "testnet";
|
|
5018
4974
|
}
|
|
5019
4975
|
function getFluentWidgetDefaultScopes(network) {
|
|
5020
4976
|
return isFaucetNetwork(network) ? FLUENT_WIDGET_DEFAULT_SCOPES : FLUENT_WIDGET_MAINNET_SCOPES;
|
|
@@ -5023,8 +4979,6 @@ function getFluentChainForNetwork(network) {
|
|
|
5023
4979
|
switch (network) {
|
|
5024
4980
|
case "mainnet":
|
|
5025
4981
|
return fluentMainnet;
|
|
5026
|
-
case "devnet":
|
|
5027
|
-
return fluentDevnet;
|
|
5028
4982
|
default:
|
|
5029
4983
|
return fluentTestnet;
|
|
5030
4984
|
}
|
|
@@ -5054,8 +5008,6 @@ var FLUENT_CONNECT_PRIVY_APP_ID = "cmi7li7v901yojv0dmtfuf0v4";
|
|
|
5054
5008
|
var FLUENT_CONNECT_REOWN_PROJECT_ID = "fbf7578f67b4a34e5101051131829ac0";
|
|
5055
5009
|
var FLUENT_CONNECT_ZERODEV_PROJECT_ID = "893acc63-da39-4b57-8789-5784ed7f1969";
|
|
5056
5010
|
var FLUENT_CONNECT_POSTHOG_TOKEN = "phc_xr3QqFLEnKbDvmD5qsKvXuyaAdSkSKvcFGUH5VeDTLGD";
|
|
5057
|
-
var FLUENT_TESTNET_BLEND_TOKEN_ADDRESS = "0x83Fed707A8dDDC2535aE591CF19fB6C91D542D8E";
|
|
5058
|
-
var FLUENT_TESTNET_USDNR_TOKEN_ADDRESS = "0x092AE7564C6611a114C20C6df766B5B35A52334A";
|
|
5059
5011
|
var FLUENT_CONNECT_TESTNET_PUBLIC_API_URL = "https://api.fluent-connect.dev.gblend.xyz/api/v1";
|
|
5060
5012
|
var FLUENT_CONNECT_MAINNET_PUBLIC_API_URL = "https://fluent-connect.api.fluent.xyz/api/v1";
|
|
5061
5013
|
var FLUENT_CONNECT_TESTNET_ANALYTICS_HOST = "https://api.fluent-connect.dev.gblend.xyz/ingest";
|
|
@@ -5081,15 +5033,6 @@ var FLUENT_CONNECT_NETWORK_ENDPOINTS = {
|
|
|
5081
5033
|
bridgeUrl: FLUENT_CONNECT_DEFAULT_PORTAL_BRIDGE_URL,
|
|
5082
5034
|
analyticsHost: FLUENT_CONNECT_TESTNET_ANALYTICS_HOST
|
|
5083
5035
|
},
|
|
5084
|
-
// devnet mirrors testnet infrastructure.
|
|
5085
|
-
devnet: {
|
|
5086
|
-
authorizeUrl: FLUENT_CONNECT_TESTNET_AUTHORIZE_URL,
|
|
5087
|
-
publicApiUrl: FLUENT_CONNECT_TESTNET_PUBLIC_API_URL,
|
|
5088
|
-
reputationSignupUrl: FLUENT_CONNECT_TESTNET_REPUTATION_SIGNUP_URL,
|
|
5089
|
-
faucetEndpoint: FLUENT_CONNECT_TESTNET_FAUCET_ENDPOINT,
|
|
5090
|
-
bridgeUrl: FLUENT_CONNECT_DEFAULT_PORTAL_BRIDGE_URL,
|
|
5091
|
-
analyticsHost: FLUENT_CONNECT_TESTNET_ANALYTICS_HOST
|
|
5092
|
-
},
|
|
5093
5036
|
mainnet: {
|
|
5094
5037
|
authorizeUrl: FLUENT_CONNECT_MAINNET_AUTHORIZE_URL,
|
|
5095
5038
|
publicApiUrl: FLUENT_CONNECT_MAINNET_PUBLIC_API_URL,
|
|
@@ -5315,10 +5258,7 @@ function createFluentBatchOp(input, executor) {
|
|
|
5315
5258
|
if (!activeExecutor) {
|
|
5316
5259
|
throw new Error("A Fluent batch operation requires a Fluent execution executor");
|
|
5317
5260
|
}
|
|
5318
|
-
const fallbackGasPayment = activeExecutor.defaultGasPayment?.token ? {
|
|
5319
|
-
token: activeExecutor.defaultGasPayment.token,
|
|
5320
|
-
symbol: activeExecutor.defaultGasPayment.symbol
|
|
5321
|
-
} : void 0;
|
|
5261
|
+
const fallbackGasPayment = activeExecutor.defaultGasPayment?.token ? { symbol: activeExecutor.defaultGasPayment.symbol } : void 0;
|
|
5322
5262
|
const executionOptions = {
|
|
5323
5263
|
...options,
|
|
5324
5264
|
confirmation: options?.confirmation ?? activeExecutor.defaultConfirmation ?? "always",
|
|
@@ -5373,6 +5313,11 @@ function encodeBatchCall(call) {
|
|
|
5373
5313
|
};
|
|
5374
5314
|
}
|
|
5375
5315
|
var FLUENT_GAS_PAYMENT_PRIORITY = ["USDnr", "BLEND", "ETH"];
|
|
5316
|
+
function getFluentGasTokenAddress(symbol, network) {
|
|
5317
|
+
if (symbol === "ETH") return void 0;
|
|
5318
|
+
const addresses = getFluentErc20PaymasterTokenAddresses(network);
|
|
5319
|
+
return symbol === "BLEND" ? addresses.BLEND : addresses.USDnr;
|
|
5320
|
+
}
|
|
5376
5321
|
var FLUENT_GAS_PAYMENT_DEFAULT_ETH_RATES = {
|
|
5377
5322
|
ETH: "1"
|
|
5378
5323
|
};
|
|
@@ -5438,18 +5383,30 @@ function getFluentGasPaymentValueTier(ethValueWei) {
|
|
|
5438
5383
|
if (ethValueWei > 0n) return "neutral";
|
|
5439
5384
|
return "neutral";
|
|
5440
5385
|
}
|
|
5386
|
+
var GAS_BALANCE_MAX_FRACTION_DIGITS = 6;
|
|
5387
|
+
function roundToFractionDigits(raw, decimals, digits) {
|
|
5388
|
+
const discardedScale = 10n ** BigInt(decimals - digits);
|
|
5389
|
+
return (raw + discardedScale / 2n) / discardedScale;
|
|
5390
|
+
}
|
|
5441
5391
|
function formatFluentGasTokenBalance(balance, maximumFractionDigits = 1) {
|
|
5442
5392
|
if (balance.raw === null || balance.formatted === null) return null;
|
|
5443
5393
|
if (maximumFractionDigits < 0 || !Number.isInteger(maximumFractionDigits)) {
|
|
5444
5394
|
throw new Error("maximumFractionDigits must be a non-negative integer");
|
|
5445
5395
|
}
|
|
5446
|
-
|
|
5447
|
-
|
|
5448
|
-
|
|
5449
|
-
|
|
5450
|
-
|
|
5396
|
+
if (balance.decimals <= maximumFractionDigits) {
|
|
5397
|
+
return formatFluentLocaleAmount(balance.formatted, maximumFractionDigits);
|
|
5398
|
+
}
|
|
5399
|
+
const maxDigits = Math.max(
|
|
5400
|
+
maximumFractionDigits,
|
|
5401
|
+
Math.min(balance.decimals, GAS_BALANCE_MAX_FRACTION_DIGITS)
|
|
5402
|
+
);
|
|
5403
|
+
for (let digits = maximumFractionDigits; digits <= maxDigits; digits += 1) {
|
|
5404
|
+
const rounded = roundToFractionDigits(balance.raw, balance.decimals, digits);
|
|
5405
|
+
if (rounded > 0n || balance.raw === 0n) {
|
|
5406
|
+
return formatFluentLocaleAmount(formatUnits(rounded, digits), digits);
|
|
5407
|
+
}
|
|
5451
5408
|
}
|
|
5452
|
-
return formatFluentLocaleAmount(
|
|
5409
|
+
return formatFluentLocaleAmount(0, maximumFractionDigits);
|
|
5453
5410
|
}
|
|
5454
5411
|
function formatFluentLocaleAmount(value, maximumFractionDigits = 2) {
|
|
5455
5412
|
const amount = typeof value === "number" ? value : Number(value);
|
|
@@ -5612,29 +5569,17 @@ function getFluentZeroDevErc20PaymasterTokens(network = "testnet") {
|
|
|
5612
5569
|
const addresses = getFluentErc20PaymasterTokenAddresses(network);
|
|
5613
5570
|
return {
|
|
5614
5571
|
BLEND: {
|
|
5615
|
-
address: addresses.BLEND
|
|
5572
|
+
address: addresses.BLEND,
|
|
5616
5573
|
decimals: 18,
|
|
5617
5574
|
symbol: "BLEND"
|
|
5618
5575
|
},
|
|
5619
5576
|
USDNR: {
|
|
5620
|
-
address: addresses.USDnr
|
|
5577
|
+
address: addresses.USDnr,
|
|
5621
5578
|
decimals: 18,
|
|
5622
5579
|
symbol: "USDnr"
|
|
5623
5580
|
}
|
|
5624
5581
|
};
|
|
5625
5582
|
}
|
|
5626
|
-
var FLUENT_ZERODEV_ERC20_PAYMASTER_TOKENS = {
|
|
5627
|
-
BLEND: {
|
|
5628
|
-
address: FLUENT_TESTNET_BLEND_TOKEN_ADDRESS,
|
|
5629
|
-
decimals: 18,
|
|
5630
|
-
symbol: "BLEND"
|
|
5631
|
-
},
|
|
5632
|
-
USDNR: {
|
|
5633
|
-
address: FLUENT_TESTNET_USDNR_TOKEN_ADDRESS,
|
|
5634
|
-
decimals: 18,
|
|
5635
|
-
symbol: "USDnr"
|
|
5636
|
-
}
|
|
5637
|
-
};
|
|
5638
5583
|
function createFluentZeroDevRpcUrl(params = {}) {
|
|
5639
5584
|
const chainId = params.chainId ?? fluentTestnet.id;
|
|
5640
5585
|
const projectId = params.projectId ?? FLUENT_CONNECT_ZERODEV_PROJECT_ID;
|
|
@@ -5801,7 +5746,7 @@ function createFluentBundlerTransport(url) {
|
|
|
5801
5746
|
|
|
5802
5747
|
// src/widget/zerodevSession.ts
|
|
5803
5748
|
function useFluentZeroDevAccount(hookOptions = {}) {
|
|
5804
|
-
const { chain } = useFluentWidgetNetwork();
|
|
5749
|
+
const { chain, network } = useFluentWidgetNetwork();
|
|
5805
5750
|
const { authenticated, login: privyLogin, ready } = usePrivy();
|
|
5806
5751
|
const login = hookOptions.login ?? privyLogin;
|
|
5807
5752
|
const { signMessage: promptSignMessage } = useSignMessage();
|
|
@@ -5993,7 +5938,7 @@ function useFluentZeroDevAccount(hookOptions = {}) {
|
|
|
5993
5938
|
}
|
|
5994
5939
|
const executionKernel = cachedKernel ?? await initialize2({ signerMode, throwOnError: true });
|
|
5995
5940
|
if (!executionKernel) throw new Error(error?.message ?? "ZeroDev smart account is not ready");
|
|
5996
|
-
const gasToken = options?.gasPayment?.
|
|
5941
|
+
const gasToken = options?.gasPayment?.symbol ? getFluentGasTokenAddress(options.gasPayment.symbol, network) : void 0;
|
|
5997
5942
|
const preparedCalls = [...calls];
|
|
5998
5943
|
if (gasToken && options?.gasPayment?.includeApproval) {
|
|
5999
5944
|
preparedCalls.unshift(await createFluentZeroDevErc20PaymasterApprovalCall({
|
|
@@ -6015,7 +5960,7 @@ function useFluentZeroDevAccount(hookOptions = {}) {
|
|
|
6015
5960
|
}))
|
|
6016
5961
|
});
|
|
6017
5962
|
setPromptSigningContext({
|
|
6018
|
-
gasTokenSymbol:
|
|
5963
|
+
gasTokenSymbol: options?.gasPayment?.symbol
|
|
6019
5964
|
});
|
|
6020
5965
|
try {
|
|
6021
5966
|
const executionClient = gasToken ? createFluentZeroDevErc20ExecutionClient(executionKernel, gasToken) : executionKernel.client;
|
|
@@ -6056,6 +6001,7 @@ function useFluentZeroDevAccount(hookOptions = {}) {
|
|
|
6056
6001
|
hookOptions.authorizationSession,
|
|
6057
6002
|
initialize2,
|
|
6058
6003
|
kernels,
|
|
6004
|
+
network,
|
|
6059
6005
|
ready
|
|
6060
6006
|
]
|
|
6061
6007
|
);
|
|
@@ -6274,14 +6220,6 @@ function setPromptSigningContext(context) {
|
|
|
6274
6220
|
function clearPromptSigningContext() {
|
|
6275
6221
|
promptSigningContext = {};
|
|
6276
6222
|
}
|
|
6277
|
-
function resolvePromptGasTokenSymbol(gasPayment) {
|
|
6278
|
-
if (gasPayment?.symbol) return gasPayment.symbol;
|
|
6279
|
-
if (!gasPayment?.token) return void 0;
|
|
6280
|
-
const known = Object.values(FLUENT_ZERODEV_ERC20_PAYMASTER_TOKENS).find(
|
|
6281
|
-
(token) => token.address.toLowerCase() === gasPayment.token.toLowerCase()
|
|
6282
|
-
);
|
|
6283
|
-
return known?.symbol;
|
|
6284
|
-
}
|
|
6285
6223
|
function buildPromptSigningUiOptions() {
|
|
6286
6224
|
const gasTokenSymbol = promptSigningContext.gasTokenSymbol;
|
|
6287
6225
|
return {
|
|
@@ -6556,7 +6494,7 @@ function toUnixSeconds(value) {
|
|
|
6556
6494
|
}
|
|
6557
6495
|
|
|
6558
6496
|
// package.json
|
|
6559
|
-
var version = "0.1.
|
|
6497
|
+
var version = "0.1.5";
|
|
6560
6498
|
|
|
6561
6499
|
// src/core/analytics.ts
|
|
6562
6500
|
var INSTANCE_NAME = "fluent";
|
|
@@ -6670,16 +6608,23 @@ function hasStoredWidgetSession(storage = globalThis.window?.localStorage) {
|
|
|
6670
6608
|
}
|
|
6671
6609
|
var REOWN_PROJECT_ID = FLUENT_CONNECT_REOWN_PROJECT_ID;
|
|
6672
6610
|
var queryClient = new QueryClient();
|
|
6673
|
-
var
|
|
6611
|
+
var appKitByKey = /* @__PURE__ */ new Map();
|
|
6674
6612
|
var reownConfigured = Boolean(REOWN_PROJECT_ID);
|
|
6675
|
-
function getReownWagmiAdapter(chain) {
|
|
6676
|
-
const
|
|
6613
|
+
function getReownWagmiAdapter(chain, disableAnalytics) {
|
|
6614
|
+
const key = `${chain.id}:${disableAnalytics ? "no-analytics" : "analytics"}`;
|
|
6615
|
+
const existing = appKitByKey.get(key);
|
|
6677
6616
|
if (existing) return existing;
|
|
6678
6617
|
const adapter = new WagmiAdapter({
|
|
6679
6618
|
networks: [chain],
|
|
6680
|
-
projectId: REOWN_PROJECT_ID
|
|
6619
|
+
projectId: REOWN_PROJECT_ID,
|
|
6620
|
+
...disableAnalytics ? {
|
|
6621
|
+
connectors: [
|
|
6622
|
+
coinbaseWallet({ preference: { options: "all", telemetry: false } }),
|
|
6623
|
+
baseAccount({ preference: { telemetry: false } })
|
|
6624
|
+
]
|
|
6625
|
+
} : {}
|
|
6681
6626
|
});
|
|
6682
|
-
|
|
6627
|
+
appKitByKey.set(key, adapter);
|
|
6683
6628
|
if (typeof window !== "undefined") {
|
|
6684
6629
|
createAppKit({
|
|
6685
6630
|
adapters: [adapter],
|
|
@@ -6702,8 +6647,9 @@ function getReownWagmiAdapter(chain) {
|
|
|
6702
6647
|
}
|
|
6703
6648
|
],
|
|
6704
6649
|
enableEIP6963: true,
|
|
6705
|
-
enableCoinbase:
|
|
6650
|
+
enableCoinbase: !disableAnalytics,
|
|
6706
6651
|
enableWalletConnect: true,
|
|
6652
|
+
features: { analytics: !disableAnalytics },
|
|
6707
6653
|
themeMode: "dark",
|
|
6708
6654
|
themeVariables: {
|
|
6709
6655
|
"--w3m-accent": "#49EDED",
|
|
@@ -6715,16 +6661,20 @@ function getReownWagmiAdapter(chain) {
|
|
|
6715
6661
|
}
|
|
6716
6662
|
function ReownProvider({
|
|
6717
6663
|
children,
|
|
6718
|
-
network = "testnet"
|
|
6664
|
+
network = "testnet",
|
|
6665
|
+
disableAnalytics = false
|
|
6719
6666
|
}) {
|
|
6720
6667
|
const chain = useMemo(() => getFluentChainForNetwork(network), [network]);
|
|
6721
|
-
const wagmiAdapter = useMemo(
|
|
6668
|
+
const wagmiAdapter = useMemo(
|
|
6669
|
+
() => getReownWagmiAdapter(chain, disableAnalytics),
|
|
6670
|
+
[chain, disableAnalytics]
|
|
6671
|
+
);
|
|
6722
6672
|
if (!wagmiAdapter) return /* @__PURE__ */ jsx(Fragment, { children });
|
|
6723
6673
|
return /* @__PURE__ */ jsx(WagmiProvider, { config: wagmiAdapter.wagmiConfig, children: /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient, children }) });
|
|
6724
6674
|
}
|
|
6725
6675
|
function useReownWallet() {
|
|
6726
6676
|
const { open } = useAppKit();
|
|
6727
|
-
const { address, chainId, isConnected } = useAccount();
|
|
6677
|
+
const { address, chainId, isConnected, status } = useAccount();
|
|
6728
6678
|
const { disconnect } = useDisconnect();
|
|
6729
6679
|
const { data: walletClient } = useWalletClient();
|
|
6730
6680
|
const { switchChainAsync } = useSwitchChain();
|
|
@@ -6742,11 +6692,12 @@ function useReownWallet() {
|
|
|
6742
6692
|
address,
|
|
6743
6693
|
chainId,
|
|
6744
6694
|
walletClient,
|
|
6695
|
+
reconnecting: status === "reconnecting",
|
|
6745
6696
|
open: openWallet,
|
|
6746
6697
|
disconnect,
|
|
6747
6698
|
switchChain
|
|
6748
6699
|
}),
|
|
6749
|
-
[isConnected, address, chainId, walletClient, openWallet, disconnect, switchChain]
|
|
6700
|
+
[isConnected, address, chainId, walletClient, status, openWallet, disconnect, switchChain]
|
|
6750
6701
|
);
|
|
6751
6702
|
}
|
|
6752
6703
|
function cn(...inputs) {
|
|
@@ -6795,14 +6746,42 @@ var Button = forwardRef(function Button2({ className, variant = "default", size
|
|
|
6795
6746
|
}
|
|
6796
6747
|
);
|
|
6797
6748
|
});
|
|
6749
|
+
var WIDGET_STYLE_SCOPE = "fluent-root dark contents text-white";
|
|
6750
|
+
var FluentPortalContainerContext = createContext(null);
|
|
6751
|
+
function FluentPortalContainerProvider({ children }) {
|
|
6752
|
+
const [container, setContainer] = useState(null);
|
|
6753
|
+
useLayoutEffect(() => {
|
|
6754
|
+
const element = document.createElement("div");
|
|
6755
|
+
element.setAttribute("data-fluent-portal-root", "");
|
|
6756
|
+
element.className = WIDGET_STYLE_SCOPE;
|
|
6757
|
+
document.body.appendChild(element);
|
|
6758
|
+
setContainer(element);
|
|
6759
|
+
return () => {
|
|
6760
|
+
element.remove();
|
|
6761
|
+
setContainer(null);
|
|
6762
|
+
};
|
|
6763
|
+
}, []);
|
|
6764
|
+
return /* @__PURE__ */ jsx(FluentPortalContainerContext.Provider, { value: container, children });
|
|
6765
|
+
}
|
|
6766
|
+
function useFluentPortalContainer(override) {
|
|
6767
|
+
const container = useContext(FluentPortalContainerContext);
|
|
6768
|
+
return override ?? container ?? void 0;
|
|
6769
|
+
}
|
|
6798
6770
|
function Dialog({ ...props }) {
|
|
6799
6771
|
return /* @__PURE__ */ jsx(Dialog$1.Root, { "data-slot": "dialog", ...props });
|
|
6800
6772
|
}
|
|
6801
6773
|
function DialogTrigger({ ...props }) {
|
|
6802
6774
|
return /* @__PURE__ */ jsx(Dialog$1.Trigger, { "data-slot": "dialog-trigger", ...props });
|
|
6803
6775
|
}
|
|
6804
|
-
function DialogPortal({ ...props }) {
|
|
6805
|
-
return /* @__PURE__ */ jsx(
|
|
6776
|
+
function DialogPortal({ container, ...props }) {
|
|
6777
|
+
return /* @__PURE__ */ jsx(
|
|
6778
|
+
Dialog$1.Portal,
|
|
6779
|
+
{
|
|
6780
|
+
"data-slot": "dialog-portal",
|
|
6781
|
+
container: useFluentPortalContainer(container),
|
|
6782
|
+
...props
|
|
6783
|
+
}
|
|
6784
|
+
);
|
|
6806
6785
|
}
|
|
6807
6786
|
function DialogClose({ ...props }) {
|
|
6808
6787
|
return /* @__PURE__ */ jsx(Dialog$1.Close, { "data-slot": "dialog-close", ...props });
|
|
@@ -7342,7 +7321,7 @@ function SelectContent({
|
|
|
7342
7321
|
alignItemWithTrigger = true,
|
|
7343
7322
|
...props
|
|
7344
7323
|
}) {
|
|
7345
|
-
return /* @__PURE__ */ jsx(Select$1.Portal, { children: /* @__PURE__ */ jsx(
|
|
7324
|
+
return /* @__PURE__ */ jsx(Select$1.Portal, { container: useFluentPortalContainer(), children: /* @__PURE__ */ jsx(
|
|
7346
7325
|
Select$1.Positioner,
|
|
7347
7326
|
{
|
|
7348
7327
|
side,
|
|
@@ -7395,6 +7374,19 @@ function SelectItem({
|
|
|
7395
7374
|
}
|
|
7396
7375
|
);
|
|
7397
7376
|
}
|
|
7377
|
+
function SelectSeparator({
|
|
7378
|
+
className,
|
|
7379
|
+
...props
|
|
7380
|
+
}) {
|
|
7381
|
+
return /* @__PURE__ */ jsx(
|
|
7382
|
+
Select$1.Separator,
|
|
7383
|
+
{
|
|
7384
|
+
"data-slot": "select-separator",
|
|
7385
|
+
className: cn("pointer-events-none -mx-1 my-1 h-px bg-border", className),
|
|
7386
|
+
...props
|
|
7387
|
+
}
|
|
7388
|
+
);
|
|
7389
|
+
}
|
|
7398
7390
|
function SelectScrollUpButton({
|
|
7399
7391
|
className,
|
|
7400
7392
|
...props
|
|
@@ -7435,6 +7427,18 @@ function SelectScrollDownButton({
|
|
|
7435
7427
|
}
|
|
7436
7428
|
);
|
|
7437
7429
|
}
|
|
7430
|
+
function Spinner({ className, ...props }) {
|
|
7431
|
+
return /* @__PURE__ */ jsx(
|
|
7432
|
+
Loader2Icon,
|
|
7433
|
+
{
|
|
7434
|
+
"data-slot": "spinner",
|
|
7435
|
+
role: "status",
|
|
7436
|
+
"aria-label": "Loading",
|
|
7437
|
+
className: cn("size-4 animate-spin", className),
|
|
7438
|
+
...props
|
|
7439
|
+
}
|
|
7440
|
+
);
|
|
7441
|
+
}
|
|
7438
7442
|
function Switch({
|
|
7439
7443
|
className,
|
|
7440
7444
|
size = "default",
|
|
@@ -7791,8 +7795,15 @@ var toast = Toast$1.createToastManager();
|
|
|
7791
7795
|
function ToastProvider({ ...props }) {
|
|
7792
7796
|
return /* @__PURE__ */ jsx(Toast$1.Provider, { ...props });
|
|
7793
7797
|
}
|
|
7794
|
-
function ToastPortal({ ...props }) {
|
|
7795
|
-
return /* @__PURE__ */ jsx(
|
|
7798
|
+
function ToastPortal({ container, ...props }) {
|
|
7799
|
+
return /* @__PURE__ */ jsx(
|
|
7800
|
+
Toast$1.Portal,
|
|
7801
|
+
{
|
|
7802
|
+
"data-slot": "toast-portal",
|
|
7803
|
+
container: useFluentPortalContainer(container),
|
|
7804
|
+
...props
|
|
7805
|
+
}
|
|
7806
|
+
);
|
|
7796
7807
|
}
|
|
7797
7808
|
function ToastViewport({ className, ...props }) {
|
|
7798
7809
|
return /* @__PURE__ */ jsx(
|
|
@@ -7986,6 +7997,50 @@ async function copyAddressToClipboard(address) {
|
|
|
7986
7997
|
});
|
|
7987
7998
|
}
|
|
7988
7999
|
}
|
|
8000
|
+
var TooltipProvider = Tooltip$1.Provider;
|
|
8001
|
+
var Tooltip = Tooltip$1.Root;
|
|
8002
|
+
function TooltipTrigger({ className, ...props }) {
|
|
8003
|
+
return /* @__PURE__ */ jsx(
|
|
8004
|
+
Tooltip$1.Trigger,
|
|
8005
|
+
{
|
|
8006
|
+
"data-slot": "tooltip-trigger",
|
|
8007
|
+
className: cn("outline-none focus-visible:ring-3 focus-visible:ring-ring/50", className),
|
|
8008
|
+
...props
|
|
8009
|
+
}
|
|
8010
|
+
);
|
|
8011
|
+
}
|
|
8012
|
+
function TooltipContent({
|
|
8013
|
+
className,
|
|
8014
|
+
children,
|
|
8015
|
+
side = "top",
|
|
8016
|
+
sideOffset = 6,
|
|
8017
|
+
align = "center",
|
|
8018
|
+
alignOffset = 0,
|
|
8019
|
+
...props
|
|
8020
|
+
}) {
|
|
8021
|
+
return /* @__PURE__ */ jsx(Tooltip$1.Portal, { children: /* @__PURE__ */ jsx(
|
|
8022
|
+
Tooltip$1.Positioner,
|
|
8023
|
+
{
|
|
8024
|
+
side,
|
|
8025
|
+
sideOffset,
|
|
8026
|
+
align,
|
|
8027
|
+
alignOffset,
|
|
8028
|
+
className: "isolate z-50",
|
|
8029
|
+
children: /* @__PURE__ */ jsx(
|
|
8030
|
+
Tooltip$1.Popup,
|
|
8031
|
+
{
|
|
8032
|
+
"data-slot": "tooltip-content",
|
|
8033
|
+
className: cn(
|
|
8034
|
+
"dark relative isolate z-50 max-w-64 origin-(--transform-origin) rounded-lg border border-white/15 bg-popover px-2 py-1 text-xs text-popover-foreground shadow-xl duration-100 data-[side=bottom]:slide-in-from-top-1 data-[side=left]:slide-in-from-right-1 data-[side=right]:slide-in-from-left-1 data-[side=top]:slide-in-from-bottom-1 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
|
|
8035
|
+
className
|
|
8036
|
+
),
|
|
8037
|
+
...props,
|
|
8038
|
+
children
|
|
8039
|
+
}
|
|
8040
|
+
)
|
|
8041
|
+
}
|
|
8042
|
+
) });
|
|
8043
|
+
}
|
|
7989
8044
|
var tokenIcons = {
|
|
7990
8045
|
ETH: "eth",
|
|
7991
8046
|
USDnr: "usdnr",
|
|
@@ -8025,7 +8080,7 @@ function WalletMenuGasPayment({
|
|
|
8025
8080
|
}),
|
|
8026
8081
|
[balances, gasTokens]
|
|
8027
8082
|
);
|
|
8028
|
-
return /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-3", children: /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-4", "aria-label": "Gas payment tokens", children: sortedRows.map(({ token, balance }) => {
|
|
8083
|
+
return /* @__PURE__ */ jsx(TooltipProvider, { delay: 200, children: /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-3", children: /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-4", "aria-label": "Gas payment tokens", children: sortedRows.map(({ token, balance }) => {
|
|
8029
8084
|
const symbol = token.symbol;
|
|
8030
8085
|
const unavailable = balance?.status === "not-configured";
|
|
8031
8086
|
const failed = balance?.status === "error";
|
|
@@ -8033,6 +8088,7 @@ function WalletMenuGasPayment({
|
|
|
8033
8088
|
const active = selectedSymbol === symbol;
|
|
8034
8089
|
const formatted = balance?.status === "ready" ? formatFluentGasTokenBalance(balance, 0) ?? (balance.formatted ? formatFluentLocaleAmount(balance.formatted, 0) : null) : null;
|
|
8035
8090
|
const usdValueLabel = formatTokenUsdValue(balance, usdPrices[symbol]);
|
|
8091
|
+
const exactBalance = balance?.status === "ready" && balance.formatted?.includes(".") ? balance.formatted : null;
|
|
8036
8092
|
return /* @__PURE__ */ jsxs(
|
|
8037
8093
|
"div",
|
|
8038
8094
|
{
|
|
@@ -8083,7 +8139,28 @@ function WalletMenuGasPayment({
|
|
|
8083
8139
|
) : /* @__PURE__ */ jsx("span", { className: "shrink-0 text-xs leading-4 text-muted-foreground", children: symbol === "ETH" ? "Native" : "No address" })
|
|
8084
8140
|
] }),
|
|
8085
8141
|
/* @__PURE__ */ jsxs("span", { className: "flex flex-col items-end gap-0.5 tabular-nums", children: [
|
|
8086
|
-
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium leading-4", children:
|
|
8142
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium leading-4", children: exactBalance ? /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
8143
|
+
/* @__PURE__ */ jsx(
|
|
8144
|
+
TooltipTrigger,
|
|
8145
|
+
{
|
|
8146
|
+
tabIndex: 0,
|
|
8147
|
+
"aria-label": `${symbol} balance: ${exactBalance}`,
|
|
8148
|
+
render: /* @__PURE__ */ jsx("span", { className: "cursor-default rounded-sm" }),
|
|
8149
|
+
children: renderBalanceLabel({
|
|
8150
|
+
formatted,
|
|
8151
|
+
unavailable,
|
|
8152
|
+
failed,
|
|
8153
|
+
isLoading: busy,
|
|
8154
|
+
hasAccount: Boolean(accountAddress)
|
|
8155
|
+
})
|
|
8156
|
+
}
|
|
8157
|
+
),
|
|
8158
|
+
/* @__PURE__ */ jsxs(TooltipContent, { className: "tabular-nums break-all", children: [
|
|
8159
|
+
exactBalance,
|
|
8160
|
+
" ",
|
|
8161
|
+
symbol
|
|
8162
|
+
] })
|
|
8163
|
+
] }) : renderBalanceLabel({
|
|
8087
8164
|
formatted,
|
|
8088
8165
|
unavailable,
|
|
8089
8166
|
failed,
|
|
@@ -8096,7 +8173,7 @@ function WalletMenuGasPayment({
|
|
|
8096
8173
|
},
|
|
8097
8174
|
symbol
|
|
8098
8175
|
);
|
|
8099
|
-
}) }) });
|
|
8176
|
+
}) }) }) });
|
|
8100
8177
|
}
|
|
8101
8178
|
function formatTokenUsdValue(balance, usdPrice) {
|
|
8102
8179
|
if (!balance || balance.status !== "ready" || balance.formatted === null) return null;
|
|
@@ -8356,27 +8433,114 @@ function WalletMenuActionCard({
|
|
|
8356
8433
|
(balance) => balance.status === "ready" && balance.raw !== null && balance.raw > 0n
|
|
8357
8434
|
);
|
|
8358
8435
|
const portfolioUnavailable = Boolean(accountAddress) && !portfolioLoading && hasReadyBalances && portfolioTotal === null;
|
|
8436
|
+
if (tab === "settings") {
|
|
8437
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col gap-6", children: [
|
|
8438
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
8439
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium opacity-50 uppercase", children: "Preferences" }),
|
|
8440
|
+
/* @__PURE__ */ jsxs(FieldGroup, { className: "w-full gap-2", children: [
|
|
8441
|
+
/* @__PURE__ */ jsx(FieldLabel, { htmlFor: "silent-signing", children: /* @__PURE__ */ jsxs(Field, { orientation: "horizontal", children: [
|
|
8442
|
+
/* @__PURE__ */ jsxs(FieldContent, { children: [
|
|
8443
|
+
/* @__PURE__ */ jsx(FieldTitle, { children: "Quick sign" }),
|
|
8444
|
+
/* @__PURE__ */ jsx(FieldDescription, { children: "Sign transactions without a confirmation popup." })
|
|
8445
|
+
] }),
|
|
8446
|
+
/* @__PURE__ */ jsx(
|
|
8447
|
+
Switch,
|
|
8448
|
+
{
|
|
8449
|
+
id: "silent-signing",
|
|
8450
|
+
checked: silentSigningEnabled,
|
|
8451
|
+
onCheckedChange: (enabled) => {
|
|
8452
|
+
track("wallet_silent_signing_toggled", { enabled });
|
|
8453
|
+
onSilentSigningChange(enabled);
|
|
8454
|
+
}
|
|
8455
|
+
}
|
|
8456
|
+
)
|
|
8457
|
+
] }) }),
|
|
8458
|
+
/* @__PURE__ */ jsx(FieldLabel, { htmlFor: "gas-payment", children: /* @__PURE__ */ jsxs(Field, { orientation: "horizontal", children: [
|
|
8459
|
+
/* @__PURE__ */ jsxs(FieldContent, { children: [
|
|
8460
|
+
/* @__PURE__ */ jsx(FieldTitle, { children: "Gas payment" }),
|
|
8461
|
+
/* @__PURE__ */ jsx(FieldDescription, { children: "Token used to pay transaction fees." })
|
|
8462
|
+
] }),
|
|
8463
|
+
/* @__PURE__ */ jsxs(
|
|
8464
|
+
Select,
|
|
8465
|
+
{
|
|
8466
|
+
value: gasPaymentToken,
|
|
8467
|
+
onValueChange: (value) => {
|
|
8468
|
+
if (value) {
|
|
8469
|
+
track("wallet_gas_token_selected", { symbol: value });
|
|
8470
|
+
onGasPaymentTokenChange(value);
|
|
8471
|
+
}
|
|
8472
|
+
},
|
|
8473
|
+
children: [
|
|
8474
|
+
/* @__PURE__ */ jsx(
|
|
8475
|
+
SelectTrigger,
|
|
8476
|
+
{
|
|
8477
|
+
id: "gas-payment",
|
|
8478
|
+
size: "sm",
|
|
8479
|
+
className: "shrink-0 border-0 bg-transparent p-0 !h-auto shadow-none dark:bg-transparent dark:hover:bg-transparent",
|
|
8480
|
+
children: /* @__PURE__ */ jsx(SelectValue, {})
|
|
8481
|
+
}
|
|
8482
|
+
),
|
|
8483
|
+
/* @__PURE__ */ jsx(SelectContent, { align: "end", alignItemWithTrigger: false, children: FLUENT_GAS_PAYMENT_PRIORITY.map((symbol) => /* @__PURE__ */ jsx(SelectItem, { value: symbol, children: symbol }, symbol)) })
|
|
8484
|
+
]
|
|
8485
|
+
}
|
|
8486
|
+
)
|
|
8487
|
+
] }) })
|
|
8488
|
+
] })
|
|
8489
|
+
] }),
|
|
8490
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
8491
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium opacity-50 uppercase", children: "Developer" }),
|
|
8492
|
+
/* @__PURE__ */ jsxs(FieldGroup, { className: "w-full gap-2", children: [
|
|
8493
|
+
faucetAvailable ? /* @__PURE__ */ jsx(
|
|
8494
|
+
SettingsActionField,
|
|
8495
|
+
{
|
|
8496
|
+
title: faucetBusy ? "Requesting faucet" : "Faucet",
|
|
8497
|
+
description: session ? "Claim testnet BLEND" : "Connect Fluent ID first",
|
|
8498
|
+
disabled: faucetBusy || !session,
|
|
8499
|
+
onClick: onFaucet
|
|
8500
|
+
}
|
|
8501
|
+
) : null,
|
|
8502
|
+
/* @__PURE__ */ jsx(
|
|
8503
|
+
SettingsActionField,
|
|
8504
|
+
{
|
|
8505
|
+
title: "Explorer",
|
|
8506
|
+
description: "View Kernel smart wallet",
|
|
8507
|
+
disabled: !actionAddress,
|
|
8508
|
+
onClick: handleExplorer
|
|
8509
|
+
}
|
|
8510
|
+
)
|
|
8511
|
+
] })
|
|
8512
|
+
] })
|
|
8513
|
+
] });
|
|
8514
|
+
}
|
|
8359
8515
|
return /* @__PURE__ */ jsxs(Tabs, { value: tab, onValueChange: onTabChange, className: "w-full flex flex-col", children: [
|
|
8360
8516
|
/* @__PURE__ */ jsxs(TabsList, { className: "w-full", children: [
|
|
8361
8517
|
/* @__PURE__ */ jsx(TabsTrigger, { value: "home", children: "Home" }),
|
|
8362
|
-
/* @__PURE__ */ jsx(TabsTrigger, { value: "reputation", children: "Reputation" })
|
|
8363
|
-
/* @__PURE__ */ jsx(TabsTrigger, { value: "settings", children: "Settings" })
|
|
8518
|
+
/* @__PURE__ */ jsx(TabsTrigger, { value: "reputation", children: "Reputation" })
|
|
8364
8519
|
] }),
|
|
8365
8520
|
/* @__PURE__ */ jsxs(TabsContent, { value: "home", className: "flex flex-col gap-4 pt-2", children: [
|
|
8366
8521
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
8367
8522
|
/* @__PURE__ */ jsx("div", { className: "relative overflow-hidden rounded-xl px-4 py-8 bg-white/5", children: /* @__PURE__ */ jsxs("div", { className: "relative z-10 flex flex-col items-center gap-1", children: [
|
|
8368
|
-
/* @__PURE__ */ jsx("div", { className: "tracking-[.05em]", children: portfolioDisplay ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8523
|
+
/* @__PURE__ */ jsx("div", { className: "tracking-[.05em] leading-none", children: portfolioDisplay ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8369
8524
|
/* @__PURE__ */ jsx("span", { className: "mr-1 text-3xl font-semibold", children: "$" }),
|
|
8370
8525
|
/* @__PURE__ */ jsx("span", { className: "text-3xl font-semibold", children: portfolioDisplay.whole }),
|
|
8371
8526
|
/* @__PURE__ */ jsxs("span", { className: "text-lg font-semibold opacity-50", children: [
|
|
8372
8527
|
",",
|
|
8373
8528
|
portfolioDisplay.fraction
|
|
8374
8529
|
] })
|
|
8375
|
-
] }) : portfolioLoading ? /* @__PURE__ */
|
|
8530
|
+
] }) : portfolioLoading ? /* @__PURE__ */ jsxs(
|
|
8376
8531
|
"span",
|
|
8377
8532
|
{
|
|
8378
|
-
className: "inline-
|
|
8379
|
-
"aria-
|
|
8533
|
+
className: "relative inline-flex items-baseline",
|
|
8534
|
+
"aria-busy": "true",
|
|
8535
|
+
"aria-label": "Loading portfolio total",
|
|
8536
|
+
children: [
|
|
8537
|
+
/* @__PURE__ */ jsxs("span", { className: "invisible", "aria-hidden": "true", children: [
|
|
8538
|
+
/* @__PURE__ */ jsx("span", { className: "mr-1 text-3xl font-semibold", children: "$" }),
|
|
8539
|
+
/* @__PURE__ */ jsx("span", { className: "text-3xl font-semibold", children: "0" }),
|
|
8540
|
+
/* @__PURE__ */ jsx("span", { className: "text-lg font-semibold", children: ",00" })
|
|
8541
|
+
] }),
|
|
8542
|
+
/* @__PURE__ */ jsx("span", { className: "absolute inset-0 animate-pulse rounded-md bg-white/10" })
|
|
8543
|
+
]
|
|
8380
8544
|
}
|
|
8381
8545
|
) : portfolioUnavailable ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8382
8546
|
/* @__PURE__ */ jsx("span", { className: "mr-1 text-3xl font-semibold", children: "$" }),
|
|
@@ -8386,7 +8550,7 @@ function WalletMenuActionCard({
|
|
|
8386
8550
|
/* @__PURE__ */ jsx("span", { className: "text-3xl font-semibold", children: "0" }),
|
|
8387
8551
|
/* @__PURE__ */ jsx("span", { className: "text-lg font-semibold opacity-50", children: ",00" })
|
|
8388
8552
|
] }) }),
|
|
8389
|
-
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-1.5 text-xs font-medium", children: portfolioPnl ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8553
|
+
/* @__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: [
|
|
8390
8554
|
/* @__PURE__ */ jsx("span", { className: "inline-flex items-center gap-0.5", children: formatFluentPortfolioPnlAbsolute(portfolioPnl.delta) }),
|
|
8391
8555
|
portfolioPnl.percent !== null ? /* @__PURE__ */ jsxs(
|
|
8392
8556
|
"span",
|
|
@@ -8404,11 +8568,22 @@ function WalletMenuActionCard({
|
|
|
8404
8568
|
]
|
|
8405
8569
|
}
|
|
8406
8570
|
) : null
|
|
8407
|
-
] }) : portfolioLoading ? /* @__PURE__ */
|
|
8571
|
+
] }) : portfolioLoading ? /* @__PURE__ */ jsxs(
|
|
8408
8572
|
"span",
|
|
8409
8573
|
{
|
|
8410
|
-
className: "inline-
|
|
8411
|
-
"aria-
|
|
8574
|
+
className: "relative inline-flex items-center gap-1.5",
|
|
8575
|
+
"aria-busy": "true",
|
|
8576
|
+
"aria-label": "Loading portfolio pnl",
|
|
8577
|
+
children: [
|
|
8578
|
+
/* @__PURE__ */ jsxs("span", { className: "invisible inline-flex items-center gap-1.5", "aria-hidden": "true", children: [
|
|
8579
|
+
/* @__PURE__ */ jsx("span", { className: "inline-flex items-center gap-0.5", children: "$ +0,00" }),
|
|
8580
|
+
/* @__PURE__ */ jsxs("span", { className: "inline-flex items-center", children: [
|
|
8581
|
+
/* @__PURE__ */ jsx(Icon, { name: "arrow-up-s-fill", className: "size-3.5" }),
|
|
8582
|
+
/* @__PURE__ */ jsx("span", { children: "0,00%" })
|
|
8583
|
+
] })
|
|
8584
|
+
] }),
|
|
8585
|
+
/* @__PURE__ */ jsx("span", { className: "absolute inset-0 animate-pulse rounded-md bg-white/10" })
|
|
8586
|
+
]
|
|
8412
8587
|
}
|
|
8413
8588
|
) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8414
8589
|
/* @__PURE__ */ jsx("span", { className: "inline-flex items-center gap-0.5", children: "$ +0,00" }),
|
|
@@ -8461,7 +8636,15 @@ function WalletMenuActionCard({
|
|
|
8461
8636
|
},
|
|
8462
8637
|
name
|
|
8463
8638
|
)) }) : null,
|
|
8464
|
-
reputation.phase === "loading" ? /* @__PURE__ */ jsx(
|
|
8639
|
+
reputation.phase === "loading" ? /* @__PURE__ */ jsx(
|
|
8640
|
+
"div",
|
|
8641
|
+
{
|
|
8642
|
+
className: "flex items-center justify-center rounded-xl bg-white/5 px-4 py-8",
|
|
8643
|
+
"aria-busy": "true",
|
|
8644
|
+
"aria-label": "Loading reputation",
|
|
8645
|
+
children: /* @__PURE__ */ jsx(Spinner, { className: "size-5 text-white/70" })
|
|
8646
|
+
}
|
|
8647
|
+
) : null,
|
|
8465
8648
|
reputation.phase === "disconnected" ? /* @__PURE__ */ jsx(
|
|
8466
8649
|
ReputationNotice,
|
|
8467
8650
|
{
|
|
@@ -8482,87 +8665,6 @@ function WalletMenuActionCard({
|
|
|
8482
8665
|
}
|
|
8483
8666
|
) : null,
|
|
8484
8667
|
reputation.phase === "error" ? /* @__PURE__ */ jsx(ReputationNotice, { title: "Could not load reputation", description: reputation.message }) : null
|
|
8485
|
-
] }),
|
|
8486
|
-
/* @__PURE__ */ jsxs(TabsContent, { value: "settings", className: "flex flex-col gap-6 pt-2", children: [
|
|
8487
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
8488
|
-
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium opacity-50 uppercase", children: "Preferences" }),
|
|
8489
|
-
/* @__PURE__ */ jsxs(FieldGroup, { className: "w-full gap-2", children: [
|
|
8490
|
-
/* @__PURE__ */ jsx(FieldLabel, { htmlFor: "silent-signing", children: /* @__PURE__ */ jsxs(Field, { orientation: "horizontal", children: [
|
|
8491
|
-
/* @__PURE__ */ jsxs(FieldContent, { children: [
|
|
8492
|
-
/* @__PURE__ */ jsx(FieldTitle, { children: "Quick sign" }),
|
|
8493
|
-
/* @__PURE__ */ jsx(FieldDescription, { children: "Sign transactions without a confirmation popup." })
|
|
8494
|
-
] }),
|
|
8495
|
-
/* @__PURE__ */ jsx(
|
|
8496
|
-
Switch,
|
|
8497
|
-
{
|
|
8498
|
-
id: "silent-signing",
|
|
8499
|
-
checked: silentSigningEnabled,
|
|
8500
|
-
onCheckedChange: (enabled) => {
|
|
8501
|
-
track("wallet_silent_signing_toggled", { enabled });
|
|
8502
|
-
onSilentSigningChange(enabled);
|
|
8503
|
-
}
|
|
8504
|
-
}
|
|
8505
|
-
)
|
|
8506
|
-
] }) }),
|
|
8507
|
-
/* @__PURE__ */ jsx(FieldLabel, { htmlFor: "gas-payment", children: /* @__PURE__ */ jsxs(Field, { orientation: "horizontal", children: [
|
|
8508
|
-
/* @__PURE__ */ jsxs(FieldContent, { children: [
|
|
8509
|
-
/* @__PURE__ */ jsx(FieldTitle, { children: "Gas payment" }),
|
|
8510
|
-
/* @__PURE__ */ jsx(FieldDescription, { children: "Token used to pay transaction fees." })
|
|
8511
|
-
] }),
|
|
8512
|
-
/* @__PURE__ */ jsxs(
|
|
8513
|
-
Select,
|
|
8514
|
-
{
|
|
8515
|
-
value: gasPaymentToken,
|
|
8516
|
-
onValueChange: (value) => {
|
|
8517
|
-
if (value) {
|
|
8518
|
-
track("wallet_gas_token_selected", { symbol: value });
|
|
8519
|
-
onGasPaymentTokenChange(value);
|
|
8520
|
-
}
|
|
8521
|
-
},
|
|
8522
|
-
children: [
|
|
8523
|
-
/* @__PURE__ */ jsx(
|
|
8524
|
-
SelectTrigger,
|
|
8525
|
-
{
|
|
8526
|
-
id: "gas-payment",
|
|
8527
|
-
size: "sm",
|
|
8528
|
-
className: "shrink-0 border-0 bg-transparent p-0 !h-auto shadow-none dark:bg-transparent dark:hover:bg-transparent",
|
|
8529
|
-
children: /* @__PURE__ */ jsx(SelectValue, {})
|
|
8530
|
-
}
|
|
8531
|
-
),
|
|
8532
|
-
/* @__PURE__ */ jsx(SelectContent, { align: "end", alignItemWithTrigger: false, children: FLUENT_GAS_PAYMENT_PRIORITY.map((symbol) => /* @__PURE__ */ jsx(SelectItem, { value: symbol, children: symbol }, symbol)) })
|
|
8533
|
-
]
|
|
8534
|
-
}
|
|
8535
|
-
)
|
|
8536
|
-
] }) })
|
|
8537
|
-
] })
|
|
8538
|
-
] }),
|
|
8539
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
8540
|
-
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium opacity-50 uppercase", children: "Developer" }),
|
|
8541
|
-
/* @__PURE__ */ jsxs(FieldGroup, { className: "w-full gap-2", children: [
|
|
8542
|
-
faucetAvailable ? /* @__PURE__ */ jsx(
|
|
8543
|
-
SettingsActionField,
|
|
8544
|
-
{
|
|
8545
|
-
title: faucetBusy ? "Requesting faucet" : "Faucet",
|
|
8546
|
-
description: session ? "Claim testnet BLEND" : "Connect Fluent ID first",
|
|
8547
|
-
disabled: faucetBusy || !session,
|
|
8548
|
-
onClick: onFaucet
|
|
8549
|
-
}
|
|
8550
|
-
) : null,
|
|
8551
|
-
/* @__PURE__ */ jsx(
|
|
8552
|
-
SettingsActionField,
|
|
8553
|
-
{
|
|
8554
|
-
title: "Explorer",
|
|
8555
|
-
description: "View Kernel smart wallet",
|
|
8556
|
-
disabled: !actionAddress,
|
|
8557
|
-
onClick: handleExplorer
|
|
8558
|
-
}
|
|
8559
|
-
)
|
|
8560
|
-
] })
|
|
8561
|
-
] }),
|
|
8562
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
8563
|
-
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium opacity-50 uppercase", children: "Account" }),
|
|
8564
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ jsx(Button, { variant: "secondary", className: "justify-between", onClick: onDisconnect, children: "Disconnect" }) })
|
|
8565
|
-
] })
|
|
8566
8668
|
] })
|
|
8567
8669
|
] });
|
|
8568
8670
|
}
|
|
@@ -8712,6 +8814,10 @@ function deriveWidgetAccount(input) {
|
|
|
8712
8814
|
const connecting = Boolean(
|
|
8713
8815
|
!hasConnectedAccount && directAuth && smartAccount.privyAuthenticated && !smartAccount.error
|
|
8714
8816
|
);
|
|
8817
|
+
const restoring = Boolean(
|
|
8818
|
+
!hasConnectedAccount && !connecting && !smartAccount.error && (directAuth && !smartAccount.privyReady || wallet?.reconnecting)
|
|
8819
|
+
);
|
|
8820
|
+
const status = hasConnectedAccount ? "connected" : connecting ? "connecting" : restoring ? "restoring" : "disconnected";
|
|
8715
8821
|
const externalReady = Boolean(wallet?.connected && wallet.hasWalletClient);
|
|
8716
8822
|
const type = fluentAccountReady ? "smart" : wallet?.connected ? "eoa" : void 0;
|
|
8717
8823
|
const executionReady = fluentAccountReady || externalReady;
|
|
@@ -8736,7 +8842,8 @@ function deriveWidgetAccount(input) {
|
|
|
8736
8842
|
accountMenuAddress,
|
|
8737
8843
|
fluentAccountReady,
|
|
8738
8844
|
hasConnectedAccount,
|
|
8739
|
-
connecting
|
|
8845
|
+
connecting,
|
|
8846
|
+
status
|
|
8740
8847
|
};
|
|
8741
8848
|
}
|
|
8742
8849
|
function useWidgetAccount(input) {
|
|
@@ -8760,6 +8867,7 @@ function useWidgetAccount(input) {
|
|
|
8760
8867
|
wallet?.connected,
|
|
8761
8868
|
wallet?.address,
|
|
8762
8869
|
wallet?.hasWalletClient,
|
|
8870
|
+
wallet?.reconnecting,
|
|
8763
8871
|
sessionUserId,
|
|
8764
8872
|
sessionSmartAccountAddress,
|
|
8765
8873
|
directAuth
|
|
@@ -9374,7 +9482,15 @@ function useHostedConnect(params) {
|
|
|
9374
9482
|
return { hostedAuthorizeUrl, beginHostedConnect };
|
|
9375
9483
|
}
|
|
9376
9484
|
function useAccountMenu(params) {
|
|
9377
|
-
const {
|
|
9485
|
+
const {
|
|
9486
|
+
accountMenuAddress,
|
|
9487
|
+
network,
|
|
9488
|
+
hasConnectedAccount,
|
|
9489
|
+
setAccountOpen,
|
|
9490
|
+
requestDisconnect,
|
|
9491
|
+
onOpenSettings,
|
|
9492
|
+
track
|
|
9493
|
+
} = params;
|
|
9378
9494
|
const openAccountMenu = useCallback(() => setAccountOpen(true), [setAccountOpen]);
|
|
9379
9495
|
const handleAccountMenuAction = useCallback(
|
|
9380
9496
|
(value) => {
|
|
@@ -9394,11 +9510,15 @@ function useAccountMenu(params) {
|
|
|
9394
9510
|
copyAddressToClipboard(accountMenuAddress);
|
|
9395
9511
|
return;
|
|
9396
9512
|
}
|
|
9513
|
+
if (value === "settings") {
|
|
9514
|
+
onOpenSettings?.();
|
|
9515
|
+
return;
|
|
9516
|
+
}
|
|
9397
9517
|
if (value === "disconnect") {
|
|
9398
9518
|
requestDisconnect();
|
|
9399
9519
|
}
|
|
9400
9520
|
},
|
|
9401
|
-
[accountMenuAddress, network, requestDisconnect, track]
|
|
9521
|
+
[accountMenuAddress, network, onOpenSettings, requestDisconnect, track]
|
|
9402
9522
|
);
|
|
9403
9523
|
const wasConnected = useRef(hasConnectedAccount);
|
|
9404
9524
|
useEffect(() => {
|
|
@@ -9439,8 +9559,15 @@ function Drawer({
|
|
|
9439
9559
|
}
|
|
9440
9560
|
) });
|
|
9441
9561
|
}
|
|
9442
|
-
function DrawerPortal({ ...props }) {
|
|
9443
|
-
return /* @__PURE__ */ jsx(
|
|
9562
|
+
function DrawerPortal({ container, ...props }) {
|
|
9563
|
+
return /* @__PURE__ */ jsx(
|
|
9564
|
+
Drawer$1.Portal,
|
|
9565
|
+
{
|
|
9566
|
+
"data-slot": "drawer-portal",
|
|
9567
|
+
container: useFluentPortalContainer(container),
|
|
9568
|
+
...props
|
|
9569
|
+
}
|
|
9570
|
+
);
|
|
9444
9571
|
}
|
|
9445
9572
|
function DrawerOverlay({
|
|
9446
9573
|
className,
|
|
@@ -9556,6 +9683,19 @@ function DrawerHeader({ className, ...props }) {
|
|
|
9556
9683
|
}
|
|
9557
9684
|
);
|
|
9558
9685
|
}
|
|
9686
|
+
function DrawerTitle({ className, ...props }) {
|
|
9687
|
+
return /* @__PURE__ */ jsx(
|
|
9688
|
+
Drawer$1.Title,
|
|
9689
|
+
{
|
|
9690
|
+
"data-slot": "drawer-title",
|
|
9691
|
+
className: cn(
|
|
9692
|
+
"text-base font-medium text-foreground",
|
|
9693
|
+
className
|
|
9694
|
+
),
|
|
9695
|
+
...props
|
|
9696
|
+
}
|
|
9697
|
+
);
|
|
9698
|
+
}
|
|
9559
9699
|
function FluentAccountDrawer(props) {
|
|
9560
9700
|
const {
|
|
9561
9701
|
accountOpen,
|
|
@@ -9565,6 +9705,8 @@ function FluentAccountDrawer(props) {
|
|
|
9565
9705
|
connectButton,
|
|
9566
9706
|
accountMenuAddress,
|
|
9567
9707
|
onAccountMenuAction,
|
|
9708
|
+
settingsOpen = false,
|
|
9709
|
+
onCloseSettings,
|
|
9568
9710
|
children
|
|
9569
9711
|
} = props;
|
|
9570
9712
|
return /* @__PURE__ */ jsxs(
|
|
@@ -9576,7 +9718,19 @@ function FluentAccountDrawer(props) {
|
|
|
9576
9718
|
children: [
|
|
9577
9719
|
connectButton,
|
|
9578
9720
|
hasConnectedAccount ? /* @__PURE__ */ jsxs(DrawerContent, { "aria-label": "Connected account", className: "dark text-white antialiased sm:w-96", children: [
|
|
9579
|
-
/* @__PURE__ */ jsx(DrawerHeader, { className: "items-stretch p-4 pb-0", children:
|
|
9721
|
+
/* @__PURE__ */ jsx(DrawerHeader, { className: "items-stretch p-4 pb-0", children: settingsOpen ? /* @__PURE__ */ jsxs("div", { className: "relative flex h-11 items-center justify-center", children: [
|
|
9722
|
+
/* @__PURE__ */ jsx(
|
|
9723
|
+
"button",
|
|
9724
|
+
{
|
|
9725
|
+
type: "button",
|
|
9726
|
+
"aria-label": "Back",
|
|
9727
|
+
className: "absolute left-0 inline-flex size-8 items-center justify-center rounded-lg text-white/70 transition-colors hover:bg-white/5 hover:text-white",
|
|
9728
|
+
onClick: onCloseSettings,
|
|
9729
|
+
children: /* @__PURE__ */ jsx(ChevronLeft, { className: "size-5" })
|
|
9730
|
+
}
|
|
9731
|
+
),
|
|
9732
|
+
/* @__PURE__ */ jsx(DrawerTitle, { className: "text-sm font-medium leading-none text-white", children: "Settings" })
|
|
9733
|
+
] }) : accountMenuAddress ? /* @__PURE__ */ jsxs(Select, { value: null, onValueChange: onAccountMenuAction, children: [
|
|
9580
9734
|
/* @__PURE__ */ jsxs(
|
|
9581
9735
|
SelectTrigger,
|
|
9582
9736
|
{
|
|
@@ -9597,6 +9751,12 @@ function FluentAccountDrawer(props) {
|
|
|
9597
9751
|
/* @__PURE__ */ jsx(Copy, { className: "size-4" }),
|
|
9598
9752
|
"Copy address"
|
|
9599
9753
|
] }),
|
|
9754
|
+
/* @__PURE__ */ jsx(SelectSeparator, { className: "mx-2" }),
|
|
9755
|
+
/* @__PURE__ */ jsxs(SelectItem, { value: "settings", children: [
|
|
9756
|
+
/* @__PURE__ */ jsx(Settings, { className: "size-4" }),
|
|
9757
|
+
"Settings"
|
|
9758
|
+
] }),
|
|
9759
|
+
/* @__PURE__ */ jsx(SelectSeparator, { className: "mx-2" }),
|
|
9600
9760
|
/* @__PURE__ */ jsxs(SelectItem, { value: "disconnect", children: [
|
|
9601
9761
|
/* @__PURE__ */ jsx(LogOut, { className: "size-4" }),
|
|
9602
9762
|
"Disconnect"
|
|
@@ -9811,7 +9971,8 @@ function FluentWidgetContent({
|
|
|
9811
9971
|
accountMenuAddress,
|
|
9812
9972
|
fluentAccountReady,
|
|
9813
9973
|
hasConnectedAccount,
|
|
9814
|
-
connecting
|
|
9974
|
+
connecting,
|
|
9975
|
+
status
|
|
9815
9976
|
} = useWidgetAccount({
|
|
9816
9977
|
smartAccount: {
|
|
9817
9978
|
smartAccountReady: smartAccount.smartAccountReady,
|
|
@@ -9825,7 +9986,8 @@ function FluentWidgetContent({
|
|
|
9825
9986
|
wallet: activeWallet ? {
|
|
9826
9987
|
connected: activeWallet.connected,
|
|
9827
9988
|
address: activeWallet.address,
|
|
9828
|
-
hasWalletClient: Boolean(activeWallet.walletClient)
|
|
9989
|
+
hasWalletClient: Boolean(activeWallet.walletClient),
|
|
9990
|
+
reconnecting: activeWallet.reconnecting
|
|
9829
9991
|
} : null,
|
|
9830
9992
|
sessionUserId: session?.user?.id,
|
|
9831
9993
|
sessionSmartAccountAddress: session?.wallet?.smartAccountAddress,
|
|
@@ -9919,7 +10081,7 @@ function FluentWidgetContent({
|
|
|
9919
10081
|
}, [activeWallet, authenticated, commitSilentSigningEnabled, directAuth, fluentConnect, logout, setDirectAuthRequested, setSession]);
|
|
9920
10082
|
const requestDisconnect = useCallback(() => {
|
|
9921
10083
|
track("wallet_disconnected");
|
|
9922
|
-
handleDisconnect();
|
|
10084
|
+
return handleDisconnect();
|
|
9923
10085
|
}, [handleDisconnect, track]);
|
|
9924
10086
|
const { openAccountMenu, handleAccountMenuAction } = useAccountMenu({
|
|
9925
10087
|
accountMenuAddress,
|
|
@@ -9927,8 +10089,21 @@ function FluentWidgetContent({
|
|
|
9927
10089
|
hasConnectedAccount,
|
|
9928
10090
|
setAccountOpen,
|
|
9929
10091
|
requestDisconnect,
|
|
10092
|
+
onOpenSettings: () => setWalletMenuTab("settings"),
|
|
9930
10093
|
track
|
|
9931
10094
|
});
|
|
10095
|
+
const lastMenuTabRef = useRef(walletMenuTab === "settings" ? "home" : walletMenuTab);
|
|
10096
|
+
useEffect(() => {
|
|
10097
|
+
if (walletMenuTab !== "settings") lastMenuTabRef.current = walletMenuTab;
|
|
10098
|
+
}, [walletMenuTab]);
|
|
10099
|
+
useEffect(() => {
|
|
10100
|
+
if (!accountOpen && walletMenuTab === "settings") {
|
|
10101
|
+
setWalletMenuTab(lastMenuTabRef.current);
|
|
10102
|
+
}
|
|
10103
|
+
}, [accountOpen, setWalletMenuTab, walletMenuTab]);
|
|
10104
|
+
const closeSettings = useCallback(() => {
|
|
10105
|
+
setWalletMenuTab(lastMenuTabRef.current);
|
|
10106
|
+
}, [setWalletMenuTab]);
|
|
9932
10107
|
const { faucetBusy, claimFaucet } = useFaucet({
|
|
9933
10108
|
session,
|
|
9934
10109
|
identityToken,
|
|
@@ -10064,7 +10239,9 @@ function FluentWidgetContent({
|
|
|
10064
10239
|
widget: widgetApi,
|
|
10065
10240
|
openConnect,
|
|
10066
10241
|
openAccount: openAccountMenu,
|
|
10242
|
+
disconnect: requestDisconnect,
|
|
10067
10243
|
hasConnectedAccount,
|
|
10244
|
+
status,
|
|
10068
10245
|
connecting,
|
|
10069
10246
|
refreshBalances
|
|
10070
10247
|
}),
|
|
@@ -10075,13 +10252,15 @@ function FluentWidgetContent({
|
|
|
10075
10252
|
widgetApi,
|
|
10076
10253
|
openConnect,
|
|
10077
10254
|
openAccountMenu,
|
|
10255
|
+
requestDisconnect,
|
|
10078
10256
|
hasConnectedAccount,
|
|
10257
|
+
status,
|
|
10079
10258
|
connecting,
|
|
10080
10259
|
refreshBalances
|
|
10081
10260
|
]
|
|
10082
10261
|
);
|
|
10083
|
-
const widget = /* @__PURE__ */ jsx(
|
|
10084
|
-
/* @__PURE__ */ jsx(
|
|
10262
|
+
const widget = /* @__PURE__ */ jsx(FluentPortalContainerProvider, { children: /* @__PURE__ */ jsxs(Toaster, { children: [
|
|
10263
|
+
/* @__PURE__ */ jsx("div", { className: WIDGET_STYLE_SCOPE, children: /* @__PURE__ */ jsx(
|
|
10085
10264
|
FluentAccountDrawer,
|
|
10086
10265
|
{
|
|
10087
10266
|
accountOpen,
|
|
@@ -10090,6 +10269,8 @@ function FluentWidgetContent({
|
|
|
10090
10269
|
isMobile,
|
|
10091
10270
|
accountMenuAddress,
|
|
10092
10271
|
onAccountMenuAction: handleAccountMenuAction,
|
|
10272
|
+
settingsOpen: walletMenuTab === "settings",
|
|
10273
|
+
onCloseSettings: closeSettings,
|
|
10093
10274
|
connectButton: /* @__PURE__ */ jsx(
|
|
10094
10275
|
FluentConnectButtonSlot,
|
|
10095
10276
|
{
|
|
@@ -10128,50 +10309,52 @@ function FluentWidgetContent({
|
|
|
10128
10309
|
}
|
|
10129
10310
|
)
|
|
10130
10311
|
}
|
|
10131
|
-
),
|
|
10312
|
+
) }),
|
|
10132
10313
|
/* @__PURE__ */ jsx(FluentWidgetProvider, { value: context, children: mode === "page" ? renderPage?.(context) : renderHome?.(context) }),
|
|
10133
|
-
|
|
10134
|
-
|
|
10135
|
-
|
|
10136
|
-
|
|
10137
|
-
|
|
10138
|
-
|
|
10139
|
-
|
|
10140
|
-
|
|
10141
|
-
|
|
10142
|
-
|
|
10143
|
-
|
|
10144
|
-
|
|
10145
|
-
|
|
10146
|
-
|
|
10147
|
-
|
|
10148
|
-
|
|
10149
|
-
|
|
10150
|
-
|
|
10151
|
-
|
|
10152
|
-
|
|
10153
|
-
|
|
10154
|
-
|
|
10155
|
-
|
|
10156
|
-
|
|
10157
|
-
|
|
10158
|
-
|
|
10159
|
-
|
|
10160
|
-
|
|
10161
|
-
|
|
10314
|
+
/* @__PURE__ */ jsxs("div", { className: WIDGET_STYLE_SCOPE, children: [
|
|
10315
|
+
showDebugPayload && mode === "home" ? /* @__PURE__ */ jsx(
|
|
10316
|
+
DebugPanel,
|
|
10317
|
+
{
|
|
10318
|
+
session,
|
|
10319
|
+
wallet: activeWallet,
|
|
10320
|
+
walletStatus,
|
|
10321
|
+
hostedError
|
|
10322
|
+
}
|
|
10323
|
+
) : null,
|
|
10324
|
+
/* @__PURE__ */ jsx(
|
|
10325
|
+
ConnectChoiceModal,
|
|
10326
|
+
{
|
|
10327
|
+
open: connectOpen,
|
|
10328
|
+
onClose: () => setConnectOpen(false),
|
|
10329
|
+
wallet: activeWallet,
|
|
10330
|
+
fluentReady: directAuth ? privyReady : true,
|
|
10331
|
+
authMode: resolvedConfig.authMode,
|
|
10332
|
+
config,
|
|
10333
|
+
fluentAuthorizeUrl: directAuth ? void 0 : hostedAuthorizeUrl,
|
|
10334
|
+
hostedError,
|
|
10335
|
+
track,
|
|
10336
|
+
onExternalWalletSelected: () => {
|
|
10337
|
+
externalWalletAnalytics.current.intent = true;
|
|
10338
|
+
},
|
|
10339
|
+
onFluentLogin: () => {
|
|
10340
|
+
track("connect_login_started");
|
|
10341
|
+
if (directAuth) {
|
|
10342
|
+
startDirectFluentLogin();
|
|
10343
|
+
return;
|
|
10344
|
+
}
|
|
10345
|
+
setWalletStatus("Opening hosted Fluent Connect ID");
|
|
10162
10346
|
}
|
|
10163
|
-
setWalletStatus("Opening hosted Fluent Connect ID");
|
|
10164
10347
|
}
|
|
10165
|
-
|
|
10166
|
-
|
|
10167
|
-
|
|
10168
|
-
|
|
10169
|
-
|
|
10170
|
-
|
|
10171
|
-
|
|
10172
|
-
|
|
10173
|
-
|
|
10174
|
-
)
|
|
10348
|
+
),
|
|
10349
|
+
/* @__PURE__ */ jsx(
|
|
10350
|
+
BatchOperationReviewModal,
|
|
10351
|
+
{
|
|
10352
|
+
operation: batchReview,
|
|
10353
|
+
onConfirm: acceptBatchReview,
|
|
10354
|
+
onCancel: rejectBatchReview
|
|
10355
|
+
}
|
|
10356
|
+
)
|
|
10357
|
+
] })
|
|
10175
10358
|
] }) });
|
|
10176
10359
|
return widget;
|
|
10177
10360
|
}
|
|
@@ -10191,6 +10374,13 @@ function FluentWidget(props) {
|
|
|
10191
10374
|
[props.config]
|
|
10192
10375
|
);
|
|
10193
10376
|
const resolvedNetwork = resolvedConfig.network;
|
|
10377
|
+
const privyClientId = resolvedConfig.clientId.startsWith("client-") ? resolvedConfig.clientId : void 0;
|
|
10378
|
+
useEffect(() => {
|
|
10379
|
+
if (resolvedConfig.authMode !== "direct" || privyClientId) return;
|
|
10380
|
+
console.warn(
|
|
10381
|
+
`[fluent widget] clientId "${resolvedConfig.clientId}" is not a Privy app client. authMode: "direct" will fail with invalid_origin outside Fluent origins \u2014 use the client id issued by Fluent, or authMode: "hosted".`
|
|
10382
|
+
);
|
|
10383
|
+
}, [privyClientId, resolvedConfig.authMode, resolvedConfig.clientId]);
|
|
10194
10384
|
const analyticsContext = useRef({});
|
|
10195
10385
|
const externalWallet = useRef({ intent: false, connected: false });
|
|
10196
10386
|
const track = useMemo(
|
|
@@ -10324,33 +10514,41 @@ function FluentWidget(props) {
|
|
|
10324
10514
|
PrivyProvider,
|
|
10325
10515
|
{
|
|
10326
10516
|
appId: FLUENT_CONNECT_PRIVY_APP_ID,
|
|
10517
|
+
clientId: privyClientId,
|
|
10327
10518
|
config: privyConfig,
|
|
10328
|
-
children: /* @__PURE__ */ jsx(
|
|
10329
|
-
|
|
10519
|
+
children: /* @__PURE__ */ jsx(
|
|
10520
|
+
ReownProvider,
|
|
10330
10521
|
{
|
|
10331
|
-
|
|
10332
|
-
|
|
10333
|
-
|
|
10334
|
-
|
|
10335
|
-
|
|
10336
|
-
|
|
10337
|
-
|
|
10338
|
-
|
|
10339
|
-
|
|
10340
|
-
|
|
10341
|
-
|
|
10342
|
-
|
|
10343
|
-
|
|
10344
|
-
|
|
10345
|
-
|
|
10346
|
-
|
|
10522
|
+
network: resolvedNetwork,
|
|
10523
|
+
disableAnalytics: resolvedConfig.disableAnalytics,
|
|
10524
|
+
children: /* @__PURE__ */ jsx(
|
|
10525
|
+
FluentWidgetContent,
|
|
10526
|
+
{
|
|
10527
|
+
...props,
|
|
10528
|
+
track,
|
|
10529
|
+
reportAnalyticsSession,
|
|
10530
|
+
externalWalletAnalytics: externalWallet,
|
|
10531
|
+
accountOpen,
|
|
10532
|
+
setAccountOpen,
|
|
10533
|
+
walletMenuTab,
|
|
10534
|
+
setWalletMenuTab: handleTabChange,
|
|
10535
|
+
gasPaymentToken,
|
|
10536
|
+
setGasPaymentToken,
|
|
10537
|
+
silentSigningEnabled,
|
|
10538
|
+
silentSigningChecked,
|
|
10539
|
+
onSilentSigningChange: handleSilentSigningChange,
|
|
10540
|
+
commitSilentSigningEnabled,
|
|
10541
|
+
requestPrivyLogin,
|
|
10542
|
+
pendingPrivyLoginRef
|
|
10543
|
+
}
|
|
10544
|
+
)
|
|
10347
10545
|
}
|
|
10348
|
-
)
|
|
10546
|
+
)
|
|
10349
10547
|
},
|
|
10350
10548
|
`${resolvedNetwork}:${silentSigningEnabled ? "silent-signing" : "prompt-signing"}-${privyEpoch}`
|
|
10351
10549
|
) });
|
|
10352
10550
|
}
|
|
10353
10551
|
|
|
10354
|
-
export { Button, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, FLUENT_CONNECT_DEFAULT_ASSETS, FLUENT_GAS_PAYMENT_DEFAULT_ETH_RATES, FLUENT_GAS_PAYMENT_PRIORITY, FLUENT_WIDGET_SESSION_STORAGE_KEY, FLUENT_ZERODEV_ERC20_PAYMASTER_QUERY,
|
|
10552
|
+
export { Button, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, FLUENT_CONNECT_DEFAULT_ASSETS, FLUENT_GAS_PAYMENT_DEFAULT_ETH_RATES, FLUENT_GAS_PAYMENT_PRIORITY, FLUENT_WIDGET_SESSION_STORAGE_KEY, FLUENT_ZERODEV_ERC20_PAYMASTER_QUERY, FLUENT_ZERODEV_PAYMASTER_DEMO_RECIPIENT, FluentWidget, FluentWidgetConnectButton, FluentWidgetNetworkProvider, Icon, Separator, buttonVariants, clearPrivyRecentLoginMethod, createFluentBatchOp, createFluentClient, createFluentFamiliesClient, createFluentPermissionApi, createFluentPermissionClient, createFluentPermissionPolicyBuilders, createFluentPermissionSession, createFluentZeroDevErc20Paymaster, createFluentZeroDevErc20PaymasterApprovalCall, createFluentZeroDevErc20PaymasterClient, createFluentZeroDevErc20PaymasterRpcUrl, createFluentZeroDevPermissionSession, createFluentZeroDevRpcUrl, fluent2 as fluent, apps as fluentApps, fluentBridgeAbi, fluent as fluentChain, fluentChains, fluentDefinitionToViemChain, integrations as fluentIntegrations, l1Chains as fluentL1Chains, fluentMainnet, fluentMainnetTokenDefaults, fluentMainnetWidgetTokens, fluentTestnet, fluentTestnetTokenDefaults, fluentTestnetWidgetTokens, fluentZeroDevChainIds, formatFluentGasTokenBalance, formatFluentLocaleAmount, getApp, getContractAddressFromChain, getFluentChain, getFluentChainByChainId, getFluentChainForNetwork, getFluentDefaultGasTokens, getFluentDefaultWidgetGasTokens, getFluentExplorerBaseUrl, getFluentGasPaymentEthValue, getFluentGasPaymentTokens, getFluentGasPaymentValueTier, getFluentGasTokenAddress, getFluentTokenDefaults, getFluentTokenDefaultsForNetwork, getFluentZeroDevErc20PaymasterTokens, getL1Chain, getL1ForFluentChain, getZeroDevRpcUrl, getZerodevIntegration, isFaucetNetwork, isFluentZeroDevChain, l1DefinitionToViemChain, normalizeFluentWidgetNetwork, readFluentTokenBalances, registryVersion, resolveBridgeAddresses, resolveFluentWidgetNetworkFromEnv, resolveFluentZeroDevErc20PaymasterToken, resolveL1Definition, selectFluentGasPaymentToken, sendFluentZeroDevErc20PaymasterDemo, useFluentWidget, useFluentWidgetNetwork, useFluentZeroDevAccount, useWidget };
|
|
10355
10553
|
//# sourceMappingURL=index.js.map
|
|
10356
10554
|
//# sourceMappingURL=index.js.map
|