@bze/bze-ui-kit 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +24 -3
- package/dist/index.d.ts +24 -3
- package/dist/index.js +360 -195
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +206 -46
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -183,6 +183,8 @@ __export(index_exports, {
|
|
|
183
183
|
getCurrentEpoch: () => getCurrentEpoch,
|
|
184
184
|
getCurrentWeekEpochEndTime: () => getCurrentWeekEpochEndTime,
|
|
185
185
|
getDefaultTxMemo: () => getDefaultTxMemo,
|
|
186
|
+
getDelegatorDelegations: () => getDelegatorDelegations,
|
|
187
|
+
getDelegatorValidators: () => getDelegatorValidators,
|
|
186
188
|
getDenomType: () => getDenomType,
|
|
187
189
|
getDistributionParams: () => getDistributionParams,
|
|
188
190
|
getEcosystemApps: () => getEcosystemApps,
|
|
@@ -239,8 +241,10 @@ __export(index_exports, {
|
|
|
239
241
|
getStakingRewards: () => getStakingRewards,
|
|
240
242
|
getTradingViewIntervals: () => getTradingViewIntervals,
|
|
241
243
|
getUSDCDenom: () => getUSDCDenom,
|
|
244
|
+
getValidatorDelegatorRewards: () => getValidatorDelegatorRewards,
|
|
242
245
|
getValidatorPageUrl: () => getValidatorPageUrl,
|
|
243
246
|
getValidatorSupportedDenoms: () => getValidatorSupportedDenoms,
|
|
247
|
+
getValidators: () => getValidators,
|
|
244
248
|
getWalletChainsNames: () => getWalletChainsNames,
|
|
245
249
|
getWeekEpochInfo: () => getWeekEpochInfo,
|
|
246
250
|
intlDateFormat: () => intlDateFormat,
|
|
@@ -306,6 +310,7 @@ __export(index_exports, {
|
|
|
306
310
|
useSettings: () => useSettings,
|
|
307
311
|
useSigningClient: () => useSigningClient,
|
|
308
312
|
useToast: () => useToast,
|
|
313
|
+
useValidatorLogos: () => useValidatorLogos,
|
|
309
314
|
validateBZEBech32Address: () => validateBZEBech32Address,
|
|
310
315
|
validateBech32Address: () => validateBech32Address,
|
|
311
316
|
validateEndpoints: () => validateEndpoints,
|
|
@@ -2880,6 +2885,7 @@ async function mapPendingUnlock(pending) {
|
|
|
2880
2885
|
// src/query/staking.ts
|
|
2881
2886
|
var import_pagination5 = require("@bze/bzejs/cosmos/base/query/v1beta1/pagination");
|
|
2882
2887
|
var import_bignumber7 = __toESM(require("bignumber.js"));
|
|
2888
|
+
var import_staking = require("@bze/bzejs/cosmos/staking/v1beta1/staking");
|
|
2883
2889
|
var getAddressDelegations = async (address) => {
|
|
2884
2890
|
try {
|
|
2885
2891
|
const client = await getRestClient();
|
|
@@ -3046,6 +3052,65 @@ var getStakingPool = async () => {
|
|
|
3046
3052
|
};
|
|
3047
3053
|
}
|
|
3048
3054
|
};
|
|
3055
|
+
var getValidators = async (status = import_staking.BondStatus.BOND_STATUS_BONDED) => {
|
|
3056
|
+
try {
|
|
3057
|
+
const client = await getRestClient();
|
|
3058
|
+
const statusStr = status === import_staking.BondStatus.BOND_STATUS_BONDED ? "BOND_STATUS_BONDED" : status === import_staking.BondStatus.BOND_STATUS_UNBONDING ? "BOND_STATUS_UNBONDING" : status === import_staking.BondStatus.BOND_STATUS_UNBONDED ? "BOND_STATUS_UNBONDED" : "";
|
|
3059
|
+
const resp = await client.cosmos.staking.v1beta1.validators({
|
|
3060
|
+
status: statusStr,
|
|
3061
|
+
pagination: import_pagination5.PageRequest.fromPartial({
|
|
3062
|
+
limit: BigInt(500)
|
|
3063
|
+
})
|
|
3064
|
+
});
|
|
3065
|
+
return resp.validators;
|
|
3066
|
+
} catch (e) {
|
|
3067
|
+
console.error("failed to get validators", e);
|
|
3068
|
+
return [];
|
|
3069
|
+
}
|
|
3070
|
+
};
|
|
3071
|
+
var getDelegatorValidators = async (address) => {
|
|
3072
|
+
try {
|
|
3073
|
+
const client = await getRestClient();
|
|
3074
|
+
const resp = await client.cosmos.staking.v1beta1.delegatorValidators({
|
|
3075
|
+
delegatorAddr: address,
|
|
3076
|
+
pagination: import_pagination5.PageRequest.fromPartial({
|
|
3077
|
+
limit: BigInt(500)
|
|
3078
|
+
})
|
|
3079
|
+
});
|
|
3080
|
+
return resp.validators;
|
|
3081
|
+
} catch (e) {
|
|
3082
|
+
console.error("failed to get delegator validators", e);
|
|
3083
|
+
return [];
|
|
3084
|
+
}
|
|
3085
|
+
};
|
|
3086
|
+
var getDelegatorDelegations = async (address) => {
|
|
3087
|
+
try {
|
|
3088
|
+
const client = await getRestClient();
|
|
3089
|
+
const resp = await client.cosmos.staking.v1beta1.delegatorDelegations({
|
|
3090
|
+
delegatorAddr: address,
|
|
3091
|
+
pagination: import_pagination5.PageRequest.fromPartial({
|
|
3092
|
+
limit: BigInt(1e3)
|
|
3093
|
+
})
|
|
3094
|
+
});
|
|
3095
|
+
return resp.delegation_responses;
|
|
3096
|
+
} catch (e) {
|
|
3097
|
+
console.error("failed to get delegator delegations", e);
|
|
3098
|
+
return [];
|
|
3099
|
+
}
|
|
3100
|
+
};
|
|
3101
|
+
var getValidatorDelegatorRewards = async (address, validatorAddress) => {
|
|
3102
|
+
try {
|
|
3103
|
+
const client = await getRestClient();
|
|
3104
|
+
const resp = await client.cosmos.distribution.v1beta1.delegationRewards({
|
|
3105
|
+
delegatorAddress: address,
|
|
3106
|
+
validatorAddress
|
|
3107
|
+
});
|
|
3108
|
+
return resp.rewards;
|
|
3109
|
+
} catch (e) {
|
|
3110
|
+
console.error("failed to get validator delegator rewards", e);
|
|
3111
|
+
return [];
|
|
3112
|
+
}
|
|
3113
|
+
};
|
|
3049
3114
|
|
|
3050
3115
|
// src/query/aggregator.ts
|
|
3051
3116
|
var getAllTickersUrl = () => {
|
|
@@ -4120,9 +4185,104 @@ var useTx = (chainName, isCosmos, isIBC) => {
|
|
|
4120
4185
|
};
|
|
4121
4186
|
};
|
|
4122
4187
|
|
|
4188
|
+
// src/hooks/useValidatorLogos.ts
|
|
4189
|
+
var import_react17 = require("react");
|
|
4190
|
+
var KEYBASE_API_URL = "https://keybase.io/_/api/1.0/user/lookup.json";
|
|
4191
|
+
var LOGOS_STORAGE_KEY = "validator_logos";
|
|
4192
|
+
var LOGOS_TTL = 24 * 60 * 60 * 1e3;
|
|
4193
|
+
var useValidatorLogos = (validators) => {
|
|
4194
|
+
const [logos, setLogos] = (0, import_react17.useState)({});
|
|
4195
|
+
const [isLoading, setIsLoading] = (0, import_react17.useState)(false);
|
|
4196
|
+
const fetchedRef = (0, import_react17.useRef)(false);
|
|
4197
|
+
const validatorCountRef = (0, import_react17.useRef)(0);
|
|
4198
|
+
const fetchLogos = (0, import_react17.useCallback)(async (identities) => {
|
|
4199
|
+
if (identities.length === 0) return {};
|
|
4200
|
+
let cached = null;
|
|
4201
|
+
try {
|
|
4202
|
+
const raw = typeof window !== "undefined" ? localStorage.getItem(LOGOS_STORAGE_KEY) : null;
|
|
4203
|
+
if (raw) {
|
|
4204
|
+
const parsed = JSON.parse(raw);
|
|
4205
|
+
if (parsed && typeof parsed === "object" && parsed.data && (!parsed.expiry || Date.now() < parsed.expiry)) {
|
|
4206
|
+
cached = parsed.data;
|
|
4207
|
+
}
|
|
4208
|
+
}
|
|
4209
|
+
} catch (e) {
|
|
4210
|
+
}
|
|
4211
|
+
if (cached) {
|
|
4212
|
+
const allCached = identities.every(
|
|
4213
|
+
(v) => v.operatorAddress in cached
|
|
4214
|
+
);
|
|
4215
|
+
if (allCached) {
|
|
4216
|
+
return cached;
|
|
4217
|
+
}
|
|
4218
|
+
}
|
|
4219
|
+
const result = cached != null ? cached : {};
|
|
4220
|
+
const toFetch = identities.filter((v) => !(v.operatorAddress in result));
|
|
4221
|
+
if (toFetch.length === 0) return result;
|
|
4222
|
+
const chunkSize = 20;
|
|
4223
|
+
for (let i = 0; i < toFetch.length; i += chunkSize) {
|
|
4224
|
+
const chunk = toFetch.slice(i, i + chunkSize);
|
|
4225
|
+
const chunkResults = await Promise.all(
|
|
4226
|
+
chunk.map(async ({ operatorAddress, identity }) => {
|
|
4227
|
+
var _a2, _b2, _c, _d, _e;
|
|
4228
|
+
if (!identity) {
|
|
4229
|
+
return { operatorAddress, url: "" };
|
|
4230
|
+
}
|
|
4231
|
+
try {
|
|
4232
|
+
const resp = await fetch(
|
|
4233
|
+
`${KEYBASE_API_URL}?key_suffix=${encodeURIComponent(identity)}&fields=pictures`
|
|
4234
|
+
);
|
|
4235
|
+
const data = await resp.json();
|
|
4236
|
+
const url = (_e = (_d = (_c = (_b2 = (_a2 = data == null ? void 0 : data.them) == null ? void 0 : _a2[0]) == null ? void 0 : _b2.pictures) == null ? void 0 : _c.primary) == null ? void 0 : _d.url) != null ? _e : "";
|
|
4237
|
+
return { operatorAddress, url };
|
|
4238
|
+
} catch (e) {
|
|
4239
|
+
return { operatorAddress, url: "" };
|
|
4240
|
+
}
|
|
4241
|
+
})
|
|
4242
|
+
);
|
|
4243
|
+
for (const { operatorAddress, url } of chunkResults) {
|
|
4244
|
+
result[operatorAddress] = url;
|
|
4245
|
+
}
|
|
4246
|
+
if (i + chunkSize < toFetch.length) {
|
|
4247
|
+
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
4248
|
+
}
|
|
4249
|
+
}
|
|
4250
|
+
try {
|
|
4251
|
+
if (typeof window !== "undefined") {
|
|
4252
|
+
localStorage.setItem(LOGOS_STORAGE_KEY, JSON.stringify({
|
|
4253
|
+
data: result,
|
|
4254
|
+
expiry: Date.now() + LOGOS_TTL
|
|
4255
|
+
}));
|
|
4256
|
+
}
|
|
4257
|
+
} catch (e) {
|
|
4258
|
+
}
|
|
4259
|
+
return result;
|
|
4260
|
+
}, []);
|
|
4261
|
+
(0, import_react17.useEffect)(() => {
|
|
4262
|
+
if (!validators || validators.length === 0) return;
|
|
4263
|
+
if (fetchedRef.current && validatorCountRef.current === validators.length) return;
|
|
4264
|
+
const identities = validators.map((v) => {
|
|
4265
|
+
var _a2, _b2;
|
|
4266
|
+
return {
|
|
4267
|
+
operatorAddress: v.operator_address,
|
|
4268
|
+
identity: (_b2 = (_a2 = v.description) == null ? void 0 : _a2.identity) != null ? _b2 : ""
|
|
4269
|
+
};
|
|
4270
|
+
});
|
|
4271
|
+
setIsLoading(true);
|
|
4272
|
+
fetchedRef.current = true;
|
|
4273
|
+
validatorCountRef.current = validators.length;
|
|
4274
|
+
fetchLogos(identities).then((result) => {
|
|
4275
|
+
setLogos(result);
|
|
4276
|
+
}).catch(console.error).finally(() => {
|
|
4277
|
+
setIsLoading(false);
|
|
4278
|
+
});
|
|
4279
|
+
}, [validators, fetchLogos]);
|
|
4280
|
+
return { logos, isLoading };
|
|
4281
|
+
};
|
|
4282
|
+
|
|
4123
4283
|
// src/components/highlight.tsx
|
|
4124
|
-
var
|
|
4125
|
-
var
|
|
4284
|
+
var import_react18 = require("@chakra-ui/react");
|
|
4285
|
+
var import_react19 = require("react");
|
|
4126
4286
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
4127
4287
|
var HighlightText = (_a2) => {
|
|
4128
4288
|
var _b2 = _a2, {
|
|
@@ -4138,14 +4298,14 @@ var HighlightText = (_a2) => {
|
|
|
4138
4298
|
"highlightIntensity",
|
|
4139
4299
|
"children"
|
|
4140
4300
|
]);
|
|
4141
|
-
const [isHighlighted, setIsHighlighted] = (0,
|
|
4142
|
-
const isMountedRef = (0,
|
|
4143
|
-
const timeoutRef = (0,
|
|
4301
|
+
const [isHighlighted, setIsHighlighted] = (0, import_react19.useState)(false);
|
|
4302
|
+
const isMountedRef = (0, import_react19.useRef)(false);
|
|
4303
|
+
const timeoutRef = (0, import_react19.useRef)(void 0);
|
|
4144
4304
|
const childrenString = String(children);
|
|
4145
|
-
const previousValueRef = (0,
|
|
4305
|
+
const previousValueRef = (0, import_react19.useRef)(childrenString);
|
|
4146
4306
|
const highlightOpacity = highlightIntensity === "subtle" ? "15" : "50";
|
|
4147
4307
|
const boxShadowStrength = highlightIntensity === "subtle" ? "10" : "25";
|
|
4148
|
-
(0,
|
|
4308
|
+
(0, import_react19.useEffect)(() => {
|
|
4149
4309
|
if (!isMountedRef.current) {
|
|
4150
4310
|
isMountedRef.current = true;
|
|
4151
4311
|
if (highlightOnMount) {
|
|
@@ -4174,7 +4334,7 @@ var HighlightText = (_a2) => {
|
|
|
4174
4334
|
};
|
|
4175
4335
|
}, [childrenString, duration, highlightOnMount]);
|
|
4176
4336
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
4177
|
-
|
|
4337
|
+
import_react18.Text,
|
|
4178
4338
|
__spreadProps(__spreadValues({}, textProps), {
|
|
4179
4339
|
transition: `all ${duration}ms ease-out`,
|
|
4180
4340
|
bg: isHighlighted ? `${highlightColor}/${highlightOpacity}` : "transparent",
|
|
@@ -4189,12 +4349,12 @@ var HighlightText = (_a2) => {
|
|
|
4189
4349
|
};
|
|
4190
4350
|
|
|
4191
4351
|
// src/components/sidebar/sidebar.tsx
|
|
4192
|
-
var
|
|
4352
|
+
var import_react20 = require("@chakra-ui/react");
|
|
4193
4353
|
var import_lu2 = require("react-icons/lu");
|
|
4194
|
-
var
|
|
4354
|
+
var import_react21 = require("react");
|
|
4195
4355
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
4196
4356
|
var Sidebar = ({ children, trigger, ariaLabel }) => {
|
|
4197
|
-
const [isOpen, setIsOpen] = (0,
|
|
4357
|
+
const [isOpen, setIsOpen] = (0, import_react21.useState)(false);
|
|
4198
4358
|
const handleTriggerClick = () => {
|
|
4199
4359
|
setIsOpen(true);
|
|
4200
4360
|
};
|
|
@@ -4203,7 +4363,7 @@ var Sidebar = ({ children, trigger, ariaLabel }) => {
|
|
|
4203
4363
|
};
|
|
4204
4364
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
4205
4365
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { onClick: handleTriggerClick, style: { cursor: "pointer" }, children: trigger }),
|
|
4206
|
-
isOpen && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
4366
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react20.Portal, { children: [
|
|
4207
4367
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4208
4368
|
"div",
|
|
4209
4369
|
{
|
|
@@ -4271,13 +4431,13 @@ var Sidebar = ({ children, trigger, ariaLabel }) => {
|
|
|
4271
4431
|
}
|
|
4272
4432
|
),
|
|
4273
4433
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4274
|
-
|
|
4434
|
+
import_react20.IconButton,
|
|
4275
4435
|
{
|
|
4276
4436
|
"aria-label": "Close sidebar",
|
|
4277
4437
|
variant: "ghost",
|
|
4278
4438
|
size: "sm",
|
|
4279
4439
|
onClick: handleClose,
|
|
4280
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4440
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react20.Icon, { size: "md", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lu2.LuX, {}) })
|
|
4281
4441
|
}
|
|
4282
4442
|
)
|
|
4283
4443
|
]
|
|
@@ -4304,10 +4464,10 @@ var Sidebar = ({ children, trigger, ariaLabel }) => {
|
|
|
4304
4464
|
};
|
|
4305
4465
|
|
|
4306
4466
|
// src/components/sidebar/settings-sidebar.tsx
|
|
4307
|
-
var import_react21 = require("@chakra-ui/react");
|
|
4308
4467
|
var import_react22 = require("@chakra-ui/react");
|
|
4468
|
+
var import_react23 = require("@chakra-ui/react");
|
|
4309
4469
|
var import_next_themes = require("next-themes");
|
|
4310
|
-
var
|
|
4470
|
+
var import_react24 = require("react");
|
|
4311
4471
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
4312
4472
|
var SettingsSidebarContent = ({ accentColor = "blue" }) => {
|
|
4313
4473
|
const { setTheme, resolvedTheme } = (0, import_next_themes.useTheme)();
|
|
@@ -4315,19 +4475,19 @@ var SettingsSidebarContent = ({ accentColor = "blue" }) => {
|
|
|
4315
4475
|
const { settings, isLoaded, updateEndpoints, updatePreferredFeeDenom, defaultSettings } = useSettings();
|
|
4316
4476
|
const { connectionType } = useConnectionType();
|
|
4317
4477
|
const { feeTokens, isLoading: feeTokensLoading } = useFeeTokens();
|
|
4318
|
-
const [restEndpoint, setRestEndpoint] = (0,
|
|
4319
|
-
const [rpcEndpoint, setRpcEndpoint] = (0,
|
|
4320
|
-
const [isValidating, setIsValidating] = (0,
|
|
4321
|
-
const [validationResults, setValidationResults] = (0,
|
|
4322
|
-
const [preferredFeeDenom, setPreferredFeeDenom] = (0,
|
|
4323
|
-
(0,
|
|
4478
|
+
const [restEndpoint, setRestEndpoint] = (0, import_react24.useState)("");
|
|
4479
|
+
const [rpcEndpoint, setRpcEndpoint] = (0, import_react24.useState)("");
|
|
4480
|
+
const [isValidating, setIsValidating] = (0, import_react24.useState)(false);
|
|
4481
|
+
const [validationResults, setValidationResults] = (0, import_react24.useState)({});
|
|
4482
|
+
const [preferredFeeDenom, setPreferredFeeDenom] = (0, import_react24.useState)(void 0);
|
|
4483
|
+
(0, import_react24.useEffect)(() => {
|
|
4324
4484
|
if (isLoaded) {
|
|
4325
4485
|
setRestEndpoint(settings.endpoints.restEndpoint);
|
|
4326
4486
|
setRpcEndpoint(settings.endpoints.rpcEndpoint);
|
|
4327
4487
|
setPreferredFeeDenom(settings.preferredFeeDenom || getChainNativeAssetDenom());
|
|
4328
4488
|
}
|
|
4329
4489
|
}, [isLoaded, settings]);
|
|
4330
|
-
const handleValidateEndpoints = (0,
|
|
4490
|
+
const handleValidateEndpoints = (0, import_react24.useCallback)(async (rest, rpc) => {
|
|
4331
4491
|
setIsValidating(true);
|
|
4332
4492
|
setValidationResults({});
|
|
4333
4493
|
try {
|
|
@@ -4347,7 +4507,7 @@ var SettingsSidebarContent = ({ accentColor = "blue" }) => {
|
|
|
4347
4507
|
setTimeout(() => setValidationResults({}), 1e4);
|
|
4348
4508
|
}
|
|
4349
4509
|
}, []);
|
|
4350
|
-
const handleSaveSettings = (0,
|
|
4510
|
+
const handleSaveSettings = (0, import_react24.useCallback)(async (rest, rpc, feeDenom) => {
|
|
4351
4511
|
setValidationResults({});
|
|
4352
4512
|
const results = await validateEndpoints(rest, rpc);
|
|
4353
4513
|
if (!results.isValid) {
|
|
@@ -4367,13 +4527,13 @@ var SettingsSidebarContent = ({ accentColor = "blue" }) => {
|
|
|
4367
4527
|
toast.success("Success!", "Settings have been saved.");
|
|
4368
4528
|
}
|
|
4369
4529
|
}, []);
|
|
4370
|
-
const handleResetToDefaults = (0,
|
|
4530
|
+
const handleResetToDefaults = (0, import_react24.useCallback)(() => {
|
|
4371
4531
|
setRestEndpoint(defaultSettings.endpoints.restEndpoint);
|
|
4372
4532
|
setRpcEndpoint(defaultSettings.endpoints.rpcEndpoint);
|
|
4373
4533
|
setPreferredFeeDenom(defaultSettings.preferredFeeDenom);
|
|
4374
4534
|
setValidationResults({});
|
|
4375
4535
|
}, []);
|
|
4376
|
-
const connectionStatusText = (0,
|
|
4536
|
+
const connectionStatusText = (0, import_react24.useMemo)(() => {
|
|
4377
4537
|
switch (connectionType) {
|
|
4378
4538
|
case CONNECTION_TYPE_NONE:
|
|
4379
4539
|
return "Failed";
|
|
@@ -4383,7 +4543,7 @@ var SettingsSidebarContent = ({ accentColor = "blue" }) => {
|
|
|
4383
4543
|
return "Connected";
|
|
4384
4544
|
}
|
|
4385
4545
|
}, [connectionType]);
|
|
4386
|
-
const connectionStatusBadgeColor = (0,
|
|
4546
|
+
const connectionStatusBadgeColor = (0, import_react24.useMemo)(() => {
|
|
4387
4547
|
switch (connectionType) {
|
|
4388
4548
|
case CONNECTION_TYPE_NONE:
|
|
4389
4549
|
return "red";
|
|
@@ -4393,24 +4553,24 @@ var SettingsSidebarContent = ({ accentColor = "blue" }) => {
|
|
|
4393
4553
|
return "green";
|
|
4394
4554
|
}
|
|
4395
4555
|
}, [connectionType]);
|
|
4396
|
-
const feeTokensCollection = (0,
|
|
4556
|
+
const feeTokensCollection = (0, import_react24.useMemo)(() => (0, import_react22.createListCollection)({
|
|
4397
4557
|
items: feeTokens.map((token) => ({
|
|
4398
4558
|
label: token.ticker || token.name,
|
|
4399
4559
|
value: token.denom,
|
|
4400
4560
|
name: token.ticker || token.name
|
|
4401
4561
|
}))
|
|
4402
4562
|
}), [feeTokens]);
|
|
4403
|
-
const handleFeeTokenChange = (0,
|
|
4563
|
+
const handleFeeTokenChange = (0, import_react24.useCallback)((denom) => {
|
|
4404
4564
|
setPreferredFeeDenom(denom || void 0);
|
|
4405
4565
|
}, []);
|
|
4406
4566
|
const hasUnsavedChanges = restEndpoint !== settings.endpoints.restEndpoint || rpcEndpoint !== settings.endpoints.rpcEndpoint || preferredFeeDenom !== settings.preferredFeeDenom;
|
|
4407
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
4408
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
4409
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
4410
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
4411
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
4567
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react22.VStack, { gap: "6", align: "stretch", children: [
|
|
4568
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react22.Box, { children: [
|
|
4569
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react22.Text, { fontSize: "sm", fontWeight: "medium", mb: "3", children: "Appearance" }),
|
|
4570
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react22.VStack, { gap: "3", align: "stretch", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react22.HStack, { justify: "space-between", children: [
|
|
4571
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react22.Text, { fontSize: "sm", children: "Dark Mode" }),
|
|
4412
4572
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
4413
|
-
|
|
4573
|
+
import_react22.Switch.Root,
|
|
4414
4574
|
{
|
|
4415
4575
|
checked: resolvedTheme === "dark",
|
|
4416
4576
|
onCheckedChange: (details) => {
|
|
@@ -4418,19 +4578,19 @@ var SettingsSidebarContent = ({ accentColor = "blue" }) => {
|
|
|
4418
4578
|
setTheme(newTheme);
|
|
4419
4579
|
},
|
|
4420
4580
|
children: [
|
|
4421
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
4422
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
4581
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react22.Switch.HiddenInput, {}),
|
|
4582
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react22.Switch.Control, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react22.Switch.Thumb, {}) })
|
|
4423
4583
|
]
|
|
4424
4584
|
}
|
|
4425
4585
|
)
|
|
4426
4586
|
] }) })
|
|
4427
4587
|
] }),
|
|
4428
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
4429
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
4430
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
4431
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
4588
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react22.Separator, {}),
|
|
4589
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react22.Box, { children: [
|
|
4590
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react22.Text, { fontSize: "sm", fontWeight: "medium", mb: "3", children: "Fee Token Preference" }),
|
|
4591
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react22.VStack, { gap: "3", align: "stretch", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react22.Box, { children: [
|
|
4432
4592
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
4433
|
-
|
|
4593
|
+
import_react23.Select.Root,
|
|
4434
4594
|
{
|
|
4435
4595
|
collection: feeTokensCollection,
|
|
4436
4596
|
size: "sm",
|
|
@@ -4438,35 +4598,35 @@ var SettingsSidebarContent = ({ accentColor = "blue" }) => {
|
|
|
4438
4598
|
onValueChange: (details) => handleFeeTokenChange(details.value[0] || ""),
|
|
4439
4599
|
disabled: feeTokensLoading,
|
|
4440
4600
|
children: [
|
|
4441
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
4442
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
4443
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
4444
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
4445
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
4601
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react23.Select.Label, { children: "Preferred Fee Token" }),
|
|
4602
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react23.Select.HiddenSelect, {}),
|
|
4603
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react23.Select.Control, { children: [
|
|
4604
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react23.Select.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react23.Select.ValueText, { placeholder: "Native Token (default)" }) }),
|
|
4605
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react23.Select.IndicatorGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react23.Select.Indicator, {}) })
|
|
4446
4606
|
] }),
|
|
4447
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
4448
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
4449
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
4607
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react23.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react23.Select.Positioner, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react23.Select.Content, { children: feeTokensCollection.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react23.Select.Item, { item, children: [
|
|
4608
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react22.Text, { children: item.label }),
|
|
4609
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react23.Select.ItemIndicator, {})
|
|
4450
4610
|
] }, item.value)) }) }) })
|
|
4451
4611
|
]
|
|
4452
4612
|
}
|
|
4453
4613
|
),
|
|
4454
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
4614
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react22.Text, { fontSize: "xs", color: "fg.muted", mt: "2", children: "Select your preferred token for paying transaction fees. Only tokens with liquidity pools paired with the native token are available." })
|
|
4455
4615
|
] }) })
|
|
4456
4616
|
] }),
|
|
4457
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
4458
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
4459
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
4460
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
4461
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
4462
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
4463
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
4617
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react22.Separator, {}),
|
|
4618
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react22.Box, { children: [
|
|
4619
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react22.Text, { fontSize: "sm", fontWeight: "medium", mb: "3", children: "BeeZee Endpoints" }),
|
|
4620
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react22.VStack, { gap: "4", align: "stretch", children: [
|
|
4621
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react22.Box, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react22.HStack, { gap: "2", align: "center", justify: "space-between", children: [
|
|
4622
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react22.Text, { fontSize: "sm", mb: "1", children: "Status: " }),
|
|
4623
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react22.Badge, { colorPalette: connectionStatusBadgeColor, children: connectionStatusText })
|
|
4464
4624
|
] }) }),
|
|
4465
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
4466
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
4467
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
4625
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react22.Box, { children: [
|
|
4626
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react22.Text, { fontSize: "sm", mb: "1", children: "REST Endpoint" }),
|
|
4627
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react22.Text, { fontSize: "xs", color: "fg.muted", mb: "2", children: "Note: Endpoint must have CORS enabled to work in browser" }),
|
|
4468
4628
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
4469
|
-
|
|
4629
|
+
import_react22.Input,
|
|
4470
4630
|
{
|
|
4471
4631
|
size: "sm",
|
|
4472
4632
|
placeholder: "https://rest.getbze.com",
|
|
@@ -4475,7 +4635,7 @@ var SettingsSidebarContent = ({ accentColor = "blue" }) => {
|
|
|
4475
4635
|
}
|
|
4476
4636
|
),
|
|
4477
4637
|
validationResults.rest && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
4478
|
-
|
|
4638
|
+
import_react22.Box,
|
|
4479
4639
|
{
|
|
4480
4640
|
mt: "2",
|
|
4481
4641
|
p: "3",
|
|
@@ -4485,15 +4645,15 @@ var SettingsSidebarContent = ({ accentColor = "blue" }) => {
|
|
|
4485
4645
|
borderWidth: "1px",
|
|
4486
4646
|
borderColor: validationResults.rest.isValid ? "green.500/30" : "red.500/30",
|
|
4487
4647
|
borderRadius: "md",
|
|
4488
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
4648
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react22.Text, { fontSize: "sm", color: validationResults.rest.isValid ? "green.700" : "red.700", _dark: { color: validationResults.rest.isValid ? "green.300" : "red.300" }, children: validationResults.rest.error || "REST endpoint is valid" })
|
|
4489
4649
|
}
|
|
4490
4650
|
)
|
|
4491
4651
|
] }),
|
|
4492
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
4493
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
4494
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
4652
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react22.Box, { children: [
|
|
4653
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react22.Text, { fontSize: "sm", mb: "1", children: "RPC Endpoint" }),
|
|
4654
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react22.Text, { fontSize: "xs", color: "fg.muted", mb: "2", children: "Note: Must support WebSocket (WS/WSS) connections" }),
|
|
4495
4655
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
4496
|
-
|
|
4656
|
+
import_react22.Input,
|
|
4497
4657
|
{
|
|
4498
4658
|
size: "sm",
|
|
4499
4659
|
placeholder: "wss://rpc.getbze.com",
|
|
@@ -4502,7 +4662,7 @@ var SettingsSidebarContent = ({ accentColor = "blue" }) => {
|
|
|
4502
4662
|
}
|
|
4503
4663
|
),
|
|
4504
4664
|
validationResults.rpc && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
4505
|
-
|
|
4665
|
+
import_react22.Box,
|
|
4506
4666
|
{
|
|
4507
4667
|
mt: "2",
|
|
4508
4668
|
p: "3",
|
|
@@ -4512,12 +4672,12 @@ var SettingsSidebarContent = ({ accentColor = "blue" }) => {
|
|
|
4512
4672
|
borderWidth: "1px",
|
|
4513
4673
|
borderColor: validationResults.rpc.isValid ? "green.500/30" : "red.500/30",
|
|
4514
4674
|
borderRadius: "md",
|
|
4515
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
4675
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react22.Text, { fontSize: "sm", color: validationResults.rpc.isValid ? "green.700" : "red.700", _dark: { color: validationResults.rpc.isValid ? "green.300" : "red.300" }, children: validationResults.rpc.error || "RPC endpoint is valid" })
|
|
4516
4676
|
}
|
|
4517
4677
|
)
|
|
4518
4678
|
] }),
|
|
4519
4679
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
4520
|
-
|
|
4680
|
+
import_react22.Button,
|
|
4521
4681
|
{
|
|
4522
4682
|
size: "sm",
|
|
4523
4683
|
variant: "outline",
|
|
@@ -4529,9 +4689,9 @@ var SettingsSidebarContent = ({ accentColor = "blue" }) => {
|
|
|
4529
4689
|
)
|
|
4530
4690
|
] })
|
|
4531
4691
|
] }),
|
|
4532
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
4692
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react22.Box, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react22.VStack, { gap: "3", children: [
|
|
4533
4693
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
4534
|
-
|
|
4694
|
+
import_react22.Button,
|
|
4535
4695
|
{
|
|
4536
4696
|
size: "sm",
|
|
4537
4697
|
width: "full",
|
|
@@ -4542,7 +4702,7 @@ var SettingsSidebarContent = ({ accentColor = "blue" }) => {
|
|
|
4542
4702
|
}
|
|
4543
4703
|
),
|
|
4544
4704
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
4545
|
-
|
|
4705
|
+
import_react22.Button,
|
|
4546
4706
|
{
|
|
4547
4707
|
size: "sm",
|
|
4548
4708
|
width: "full",
|
|
@@ -4557,10 +4717,10 @@ var SettingsSidebarContent = ({ accentColor = "blue" }) => {
|
|
|
4557
4717
|
|
|
4558
4718
|
// src/components/sidebar/wallet-sidebar.tsx
|
|
4559
4719
|
var import_styles = require("@interchain-kit/react/styles.css");
|
|
4560
|
-
var
|
|
4561
|
-
var
|
|
4720
|
+
var import_react25 = require("@interchain-kit/react");
|
|
4721
|
+
var import_react26 = require("@chakra-ui/react");
|
|
4562
4722
|
var import_lu3 = require("react-icons/lu");
|
|
4563
|
-
var
|
|
4723
|
+
var import_react27 = require("react");
|
|
4564
4724
|
var import_core = require("@interchain-kit/core");
|
|
4565
4725
|
var import_bignumber14 = __toESM(require("bignumber.js"));
|
|
4566
4726
|
var import_bzejs5 = require("@bze/bzejs");
|
|
@@ -4581,16 +4741,16 @@ var validateAmount = (amount, coin, onError) => {
|
|
|
4581
4741
|
}
|
|
4582
4742
|
};
|
|
4583
4743
|
var BalanceItem = ({ asset, onClick, accentColor }) => {
|
|
4584
|
-
const [showSendButton, setShowSendButton] = (0,
|
|
4585
|
-
const formattedBalanceAmount = (0,
|
|
4744
|
+
const [showSendButton, setShowSendButton] = (0, import_react27.useState)(false);
|
|
4745
|
+
const formattedBalanceAmount = (0, import_react27.useMemo)(() => {
|
|
4586
4746
|
var _a2;
|
|
4587
4747
|
return prettyAmount(uAmountToBigNumberAmount(asset.amount, (_a2 = asset.decimals) != null ? _a2 : 0));
|
|
4588
4748
|
}, [asset.amount, asset.decimals]);
|
|
4589
|
-
const formattedBalanceUSDValue = (0,
|
|
4749
|
+
const formattedBalanceUSDValue = (0, import_react27.useMemo)(() => {
|
|
4590
4750
|
return shortNumberFormat(asset.USDValue);
|
|
4591
4751
|
}, [asset.USDValue]);
|
|
4592
4752
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
4593
|
-
|
|
4753
|
+
import_react26.Box,
|
|
4594
4754
|
{
|
|
4595
4755
|
p: "3",
|
|
4596
4756
|
bgGradient: "to-br",
|
|
@@ -4608,10 +4768,10 @@ var BalanceItem = ({ asset, onClick, accentColor }) => {
|
|
|
4608
4768
|
onMouseLeave: () => setShowSendButton(false),
|
|
4609
4769
|
onMouseEnter: () => setShowSendButton(true),
|
|
4610
4770
|
children: [
|
|
4611
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
4612
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
4771
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react26.HStack, { justify: "space-between", mb: "2", children: [
|
|
4772
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react26.HStack, { children: [
|
|
4613
4773
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4614
|
-
|
|
4774
|
+
import_react26.Image,
|
|
4615
4775
|
{
|
|
4616
4776
|
src: asset.logo,
|
|
4617
4777
|
alt: asset.ticker,
|
|
@@ -4620,13 +4780,13 @@ var BalanceItem = ({ asset, onClick, accentColor }) => {
|
|
|
4620
4780
|
borderRadius: "full"
|
|
4621
4781
|
}
|
|
4622
4782
|
),
|
|
4623
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4624
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4625
|
-
isIbcDenom(asset.denom) && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4783
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react26.Text, { fontSize: "sm", fontWeight: "medium", children: asset.ticker }),
|
|
4784
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react26.Text, { fontSize: "xs", color: "fg.muted", children: asset.name }),
|
|
4785
|
+
isIbcDenom(asset.denom) && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react26.Badge, { size: "xs", colorPalette: accentColor, children: "IBC" })
|
|
4626
4786
|
] }),
|
|
4627
|
-
showSendButton && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4787
|
+
showSendButton && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react26.HStack, { justify: "end", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react26.Button, { size: "2xs", variant: "outline", onClick, children: "Send" }) })
|
|
4628
4788
|
] }),
|
|
4629
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
4789
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react26.HStack, { justify: "space-between", children: [
|
|
4630
4790
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(HighlightText, { fontSize: "sm", fontFamily: "mono", children: formattedBalanceAmount }),
|
|
4631
4791
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(HighlightText, { fontSize: "sm", color: "fg.muted", children: [
|
|
4632
4792
|
"$",
|
|
@@ -4638,18 +4798,18 @@ var BalanceItem = ({ asset, onClick, accentColor }) => {
|
|
|
4638
4798
|
);
|
|
4639
4799
|
};
|
|
4640
4800
|
var SendForm = ({ balances, onClose, selectedTicker, accentColor }) => {
|
|
4641
|
-
const [isLoading, setIsLoading] = (0,
|
|
4642
|
-
const [selectedCoin, setSelectedCoin] = (0,
|
|
4643
|
-
const [sendAmount, setSendAmount] = (0,
|
|
4644
|
-
const [sendAmountError, setSendAmountError] = (0,
|
|
4645
|
-
const [recipient, setRecipient] = (0,
|
|
4646
|
-
const [recipientError, setRecipientError] = (0,
|
|
4647
|
-
const [memo, setMemo] = (0,
|
|
4648
|
-
const [memoError, setMemoError] = (0,
|
|
4801
|
+
const [isLoading, setIsLoading] = (0, import_react27.useState)(false);
|
|
4802
|
+
const [selectedCoin, setSelectedCoin] = (0, import_react27.useState)();
|
|
4803
|
+
const [sendAmount, setSendAmount] = (0, import_react27.useState)("");
|
|
4804
|
+
const [sendAmountError, setSendAmountError] = (0, import_react27.useState)("");
|
|
4805
|
+
const [recipient, setRecipient] = (0, import_react27.useState)("");
|
|
4806
|
+
const [recipientError, setRecipientError] = (0, import_react27.useState)("");
|
|
4807
|
+
const [memo, setMemo] = (0, import_react27.useState)("");
|
|
4808
|
+
const [memoError, setMemoError] = (0, import_react27.useState)("");
|
|
4649
4809
|
const { toast } = useToast();
|
|
4650
|
-
const { status, address } = (0,
|
|
4810
|
+
const { status, address } = (0, import_react25.useChain)(getChainName());
|
|
4651
4811
|
const { tx } = useSDKTx(getChainName());
|
|
4652
|
-
const coinsCollection = (0,
|
|
4812
|
+
const coinsCollection = (0, import_react26.createListCollection)({
|
|
4653
4813
|
items: balances.map((item) => {
|
|
4654
4814
|
var _a2;
|
|
4655
4815
|
return {
|
|
@@ -4659,16 +4819,16 @@ var SendForm = ({ balances, onClose, selectedTicker, accentColor }) => {
|
|
|
4659
4819
|
};
|
|
4660
4820
|
})
|
|
4661
4821
|
});
|
|
4662
|
-
const isValidForm = (0,
|
|
4822
|
+
const isValidForm = (0, import_react27.useMemo)(() => {
|
|
4663
4823
|
return selectedCoin && memoError === "" && recipientError === "" && sendAmountError === "" && sendAmount !== "" && recipient !== "";
|
|
4664
4824
|
}, [selectedCoin, memoError, recipientError, sendAmountError, sendAmount, recipient]);
|
|
4665
|
-
const resetSendForm = (0,
|
|
4825
|
+
const resetSendForm = (0, import_react27.useCallback)(() => {
|
|
4666
4826
|
setSelectedCoin(void 0);
|
|
4667
4827
|
setSendAmount("");
|
|
4668
4828
|
setRecipient("");
|
|
4669
4829
|
setMemo("");
|
|
4670
4830
|
}, []);
|
|
4671
|
-
const handleSend = (0,
|
|
4831
|
+
const handleSend = (0, import_react27.useCallback)(async () => {
|
|
4672
4832
|
var _a2, _b2;
|
|
4673
4833
|
if (!isValidForm) {
|
|
4674
4834
|
toast.error("Can not send coins!", "Please check the input data.");
|
|
@@ -4693,11 +4853,11 @@ var SendForm = ({ balances, onClose, selectedTicker, accentColor }) => {
|
|
|
4693
4853
|
setIsLoading(false);
|
|
4694
4854
|
onClose();
|
|
4695
4855
|
}, [address, memo, onClose, recipient, selectedCoin, sendAmount, status]);
|
|
4696
|
-
const handleCancel = (0,
|
|
4856
|
+
const handleCancel = (0, import_react27.useCallback)(() => {
|
|
4697
4857
|
resetSendForm();
|
|
4698
4858
|
onClose();
|
|
4699
4859
|
}, [onClose, resetSendForm]);
|
|
4700
|
-
const onRecipientChange = (0,
|
|
4860
|
+
const onRecipientChange = (0, import_react27.useCallback)((recipient2) => {
|
|
4701
4861
|
setRecipient(recipient2);
|
|
4702
4862
|
if (recipient2.length === 0) {
|
|
4703
4863
|
setRecipientError("");
|
|
@@ -4710,11 +4870,11 @@ var SendForm = ({ balances, onClose, selectedTicker, accentColor }) => {
|
|
|
4710
4870
|
setRecipientError(validate.message);
|
|
4711
4871
|
}
|
|
4712
4872
|
}, []);
|
|
4713
|
-
const onAmountChange = (0,
|
|
4873
|
+
const onAmountChange = (0, import_react27.useCallback)((amount) => {
|
|
4714
4874
|
setSendAmount(sanitizeNumberInput(amount));
|
|
4715
4875
|
setSendAmountError("");
|
|
4716
4876
|
}, []);
|
|
4717
|
-
const onCoinSelectChange = (0,
|
|
4877
|
+
const onCoinSelectChange = (0, import_react27.useCallback)((ticker) => {
|
|
4718
4878
|
if (ticker === "") return;
|
|
4719
4879
|
const selectedCoin2 = balances.find((item) => item.ticker === ticker);
|
|
4720
4880
|
if (selectedCoin2) {
|
|
@@ -4722,13 +4882,13 @@ var SendForm = ({ balances, onClose, selectedTicker, accentColor }) => {
|
|
|
4722
4882
|
validateAmount(sendAmount, selectedCoin2, setSendAmountError);
|
|
4723
4883
|
}
|
|
4724
4884
|
}, [sendAmount, balances]);
|
|
4725
|
-
const setMaxAmount = (0,
|
|
4885
|
+
const setMaxAmount = (0, import_react27.useCallback)(() => {
|
|
4726
4886
|
if (!selectedCoin) return;
|
|
4727
4887
|
const maxAmount = uAmountToBigNumberAmount(selectedCoin.amount, selectedCoin.decimals);
|
|
4728
4888
|
onAmountChange(maxAmount.toString());
|
|
4729
4889
|
validateAmount(maxAmount.toString(), selectedCoin, setSendAmountError);
|
|
4730
4890
|
}, [selectedCoin, onAmountChange]);
|
|
4731
|
-
const onMemoChange = (0,
|
|
4891
|
+
const onMemoChange = (0, import_react27.useCallback)((memo2) => {
|
|
4732
4892
|
setMemo(memo2);
|
|
4733
4893
|
if (memo2.length > 256) {
|
|
4734
4894
|
setMemoError("Memo must be less than or equal to 256 characters");
|
|
@@ -4736,16 +4896,16 @@ var SendForm = ({ balances, onClose, selectedTicker, accentColor }) => {
|
|
|
4736
4896
|
setMemoError("");
|
|
4737
4897
|
}
|
|
4738
4898
|
}, []);
|
|
4739
|
-
(0,
|
|
4899
|
+
(0, import_react27.useEffect)(() => {
|
|
4740
4900
|
if (selectedTicker !== "") {
|
|
4741
4901
|
onCoinSelectChange(selectedTicker);
|
|
4742
4902
|
}
|
|
4743
4903
|
}, [onCoinSelectChange, selectedTicker]);
|
|
4744
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
4745
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
4746
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4904
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react26.VStack, { gap: "4", align: "stretch", children: [
|
|
4905
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react26.HStack, { justify: "space-between", align: "center", children: [
|
|
4906
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react26.Text, { fontSize: "sm", fontWeight: "medium", children: "Send Coins" }),
|
|
4747
4907
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4748
|
-
|
|
4908
|
+
import_react26.Button,
|
|
4749
4909
|
{
|
|
4750
4910
|
size: "xs",
|
|
4751
4911
|
variant: "ghost",
|
|
@@ -4755,25 +4915,25 @@ var SendForm = ({ balances, onClose, selectedTicker, accentColor }) => {
|
|
|
4755
4915
|
}
|
|
4756
4916
|
)
|
|
4757
4917
|
] }),
|
|
4758
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
4918
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react26.Box, { children: [
|
|
4759
4919
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
4760
|
-
|
|
4920
|
+
import_react26.Select.Root,
|
|
4761
4921
|
{
|
|
4762
4922
|
collection: coinsCollection,
|
|
4763
4923
|
size: "sm",
|
|
4764
4924
|
value: (selectedCoin == null ? void 0 : selectedCoin.ticker) ? [selectedCoin.ticker] : [],
|
|
4765
4925
|
onValueChange: (details) => onCoinSelectChange(details.value[0] || ""),
|
|
4766
4926
|
children: [
|
|
4767
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4768
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4769
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
4770
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4771
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4927
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react26.Select.Label, { children: "Coin" }),
|
|
4928
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react26.Select.HiddenSelect, {}),
|
|
4929
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react26.Select.Control, { children: [
|
|
4930
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react26.Select.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react26.Select.ValueText, { placeholder: "Select coin" }) }),
|
|
4931
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react26.Select.IndicatorGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react26.Select.Indicator, {}) })
|
|
4772
4932
|
] }),
|
|
4773
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4774
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
4933
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react26.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react26.Select.Positioner, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react26.Select.Content, { children: coinsCollection.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react26.Select.Item, { item, children: [
|
|
4934
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react26.HStack, { gap: "2", children: [
|
|
4775
4935
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4776
|
-
|
|
4936
|
+
import_react26.Image,
|
|
4777
4937
|
{
|
|
4778
4938
|
src: item.logo,
|
|
4779
4939
|
alt: item.value,
|
|
@@ -4782,15 +4942,15 @@ var SendForm = ({ balances, onClose, selectedTicker, accentColor }) => {
|
|
|
4782
4942
|
borderRadius: "full"
|
|
4783
4943
|
}
|
|
4784
4944
|
),
|
|
4785
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4945
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react26.Text, { children: item.label })
|
|
4786
4946
|
] }),
|
|
4787
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4947
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react26.Select.ItemIndicator, {})
|
|
4788
4948
|
] }, item.value)) }) }) })
|
|
4789
4949
|
]
|
|
4790
4950
|
}
|
|
4791
4951
|
),
|
|
4792
4952
|
selectedCoin && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4793
|
-
|
|
4953
|
+
import_react26.Box,
|
|
4794
4954
|
{
|
|
4795
4955
|
mt: "2",
|
|
4796
4956
|
p: "3",
|
|
@@ -4800,15 +4960,15 @@ var SendForm = ({ balances, onClose, selectedTicker, accentColor }) => {
|
|
|
4800
4960
|
borderRadius: "md",
|
|
4801
4961
|
borderWidth: "1px",
|
|
4802
4962
|
borderColor: `${accentColor}.500/30`,
|
|
4803
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
4804
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4805
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
4806
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
4963
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react26.HStack, { justify: "space-between", children: [
|
|
4964
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react26.Text, { fontSize: "xs", color: "fg.muted", children: "Available:" }),
|
|
4965
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react26.VStack, { gap: "0", align: "end", children: [
|
|
4966
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react26.Text, { fontSize: "sm", fontWeight: "medium", children: [
|
|
4807
4967
|
uAmountToAmount(selectedCoin.amount, selectedCoin.decimals),
|
|
4808
4968
|
" ",
|
|
4809
4969
|
selectedCoin.ticker
|
|
4810
4970
|
] }),
|
|
4811
|
-
selectedCoin.USDValue.gt(0) && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
4971
|
+
selectedCoin.USDValue.gt(0) && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react26.Text, { fontSize: "xs", color: "fg.muted", children: [
|
|
4812
4972
|
"\u2248 $",
|
|
4813
4973
|
shortNumberFormat(selectedCoin.USDValue)
|
|
4814
4974
|
] })
|
|
@@ -4817,11 +4977,11 @@ var SendForm = ({ balances, onClose, selectedTicker, accentColor }) => {
|
|
|
4817
4977
|
}
|
|
4818
4978
|
)
|
|
4819
4979
|
] }),
|
|
4820
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4821
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4822
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
4980
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react26.Box, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react26.Field.Root, { invalid: sendAmountError !== "", children: [
|
|
4981
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react26.Field.Label, { children: "Amount" }),
|
|
4982
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react26.Group, { attached: true, w: "full", maxW: "sm", children: [
|
|
4823
4983
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4824
|
-
|
|
4984
|
+
import_react26.Input,
|
|
4825
4985
|
{
|
|
4826
4986
|
size: "sm",
|
|
4827
4987
|
placeholder: "Amount to send",
|
|
@@ -4830,14 +4990,14 @@ var SendForm = ({ balances, onClose, selectedTicker, accentColor }) => {
|
|
|
4830
4990
|
onBlur: () => validateAmount(sendAmount, selectedCoin, setSendAmountError)
|
|
4831
4991
|
}
|
|
4832
4992
|
),
|
|
4833
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4993
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react26.Button, { variant: "outline", size: "sm", onClick: setMaxAmount, disabled: isLoading, children: "Max" })
|
|
4834
4994
|
] }),
|
|
4835
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4995
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react26.Field.ErrorText, { children: sendAmountError })
|
|
4836
4996
|
] }) }),
|
|
4837
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4838
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4997
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react26.Box, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react26.Field.Root, { invalid: recipientError !== "", children: [
|
|
4998
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react26.Field.Label, { children: "Recipient Address" }),
|
|
4839
4999
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4840
|
-
|
|
5000
|
+
import_react26.Input,
|
|
4841
5001
|
{
|
|
4842
5002
|
size: "sm",
|
|
4843
5003
|
placeholder: "bze...2a1b",
|
|
@@ -4845,20 +5005,20 @@ var SendForm = ({ balances, onClose, selectedTicker, accentColor }) => {
|
|
|
4845
5005
|
onChange: (e) => onRecipientChange(e.target.value)
|
|
4846
5006
|
}
|
|
4847
5007
|
),
|
|
4848
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
5008
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react26.Field.ErrorText, { children: recipientError })
|
|
4849
5009
|
] }) }),
|
|
4850
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4851
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
5010
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react26.Box, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react26.Field.Root, { invalid: memoError !== "", children: [
|
|
5011
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react26.Field.Label, { children: [
|
|
4852
5012
|
"Memo",
|
|
4853
5013
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4854
|
-
|
|
5014
|
+
import_react26.Field.RequiredIndicator,
|
|
4855
5015
|
{
|
|
4856
|
-
fallback: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
5016
|
+
fallback: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react26.Badge, { size: "xs", variant: "surface", children: "Optional" })
|
|
4857
5017
|
}
|
|
4858
5018
|
)
|
|
4859
5019
|
] }),
|
|
4860
5020
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4861
|
-
|
|
5021
|
+
import_react26.Textarea,
|
|
4862
5022
|
{
|
|
4863
5023
|
size: "sm",
|
|
4864
5024
|
placeholder: "Transaction memo",
|
|
@@ -4868,11 +5028,11 @@ var SendForm = ({ balances, onClose, selectedTicker, accentColor }) => {
|
|
|
4868
5028
|
resize: "none"
|
|
4869
5029
|
}
|
|
4870
5030
|
),
|
|
4871
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
5031
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react26.Field.ErrorText, { children: memoError })
|
|
4872
5032
|
] }) }),
|
|
4873
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
5033
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react26.HStack, { gap: "2", children: [
|
|
4874
5034
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4875
|
-
|
|
5035
|
+
import_react26.Button,
|
|
4876
5036
|
{
|
|
4877
5037
|
size: "sm",
|
|
4878
5038
|
flex: "1",
|
|
@@ -4885,7 +5045,7 @@ var SendForm = ({ balances, onClose, selectedTicker, accentColor }) => {
|
|
|
4885
5045
|
}
|
|
4886
5046
|
),
|
|
4887
5047
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4888
|
-
|
|
5048
|
+
import_react26.Button,
|
|
4889
5049
|
{
|
|
4890
5050
|
size: "sm",
|
|
4891
5051
|
flex: "1",
|
|
@@ -4899,25 +5059,25 @@ var SendForm = ({ balances, onClose, selectedTicker, accentColor }) => {
|
|
|
4899
5059
|
] });
|
|
4900
5060
|
};
|
|
4901
5061
|
var WalletSidebarContent = ({ accentColor = "blue" }) => {
|
|
4902
|
-
const [viewState, setViewState] = (0,
|
|
4903
|
-
const [isDisconnecting, setIsDisconnecting] = (0,
|
|
4904
|
-
const [showCopiedTooltip, setShowCopiedTooltip] = (0,
|
|
4905
|
-
const [clickedBalance, setClickedBalance] = (0,
|
|
4906
|
-
const copyButtonRef = (0,
|
|
5062
|
+
const [viewState, setViewState] = (0, import_react27.useState)("balances");
|
|
5063
|
+
const [isDisconnecting, setIsDisconnecting] = (0, import_react27.useState)(false);
|
|
5064
|
+
const [showCopiedTooltip, setShowCopiedTooltip] = (0, import_react27.useState)(false);
|
|
5065
|
+
const [clickedBalance, setClickedBalance] = (0, import_react27.useState)("");
|
|
5066
|
+
const copyButtonRef = (0, import_react27.useRef)(null);
|
|
4907
5067
|
const {
|
|
4908
5068
|
status,
|
|
4909
5069
|
username,
|
|
4910
5070
|
address,
|
|
4911
5071
|
disconnect,
|
|
4912
5072
|
connect
|
|
4913
|
-
} = (0,
|
|
5073
|
+
} = (0, import_react25.useChain)(getChainName());
|
|
4914
5074
|
const { assetsBalances, isLoading: assetsLoading } = useBalances();
|
|
4915
|
-
const balancesWithoutLps = (0,
|
|
5075
|
+
const balancesWithoutLps = (0, import_react27.useMemo)(() => {
|
|
4916
5076
|
if (assetsLoading) return [];
|
|
4917
5077
|
return assetsBalances.filter((asset) => !isLpDenom(asset.denom));
|
|
4918
5078
|
}, [assetsLoading, assetsBalances]);
|
|
4919
5079
|
const nativeDenom = getChainNativeAssetDenom();
|
|
4920
|
-
const sortedBalances = (0,
|
|
5080
|
+
const sortedBalances = (0, import_react27.useMemo)(() => {
|
|
4921
5081
|
return balancesWithoutLps.sort((a, b) => {
|
|
4922
5082
|
if (a.denom === nativeDenom) return -1;
|
|
4923
5083
|
if (b.denom === nativeDenom) return 1;
|
|
@@ -4933,21 +5093,21 @@ var WalletSidebarContent = ({ accentColor = "blue" }) => {
|
|
|
4933
5093
|
return 0;
|
|
4934
5094
|
});
|
|
4935
5095
|
}, [balancesWithoutLps]);
|
|
4936
|
-
const walletAddress = (0,
|
|
5096
|
+
const walletAddress = (0, import_react27.useMemo)(() => stringTruncateFromCenter(address != null ? address : "", 16), [address]);
|
|
4937
5097
|
const handleCopyAddress = () => {
|
|
4938
5098
|
navigator.clipboard.writeText(address);
|
|
4939
5099
|
setShowCopiedTooltip(true);
|
|
4940
5100
|
setTimeout(() => setShowCopiedTooltip(false), 2e3);
|
|
4941
5101
|
};
|
|
4942
|
-
const handleCancel = (0,
|
|
5102
|
+
const handleCancel = (0, import_react27.useCallback)(() => {
|
|
4943
5103
|
setViewState("balances");
|
|
4944
5104
|
setClickedBalance("");
|
|
4945
5105
|
}, []);
|
|
4946
|
-
const onBalanceClick = (0,
|
|
5106
|
+
const onBalanceClick = (0, import_react27.useCallback)((ticker) => {
|
|
4947
5107
|
setClickedBalance(ticker);
|
|
4948
5108
|
setViewState("send");
|
|
4949
5109
|
}, []);
|
|
4950
|
-
const handleDisconnectAll = (0,
|
|
5110
|
+
const handleDisconnectAll = (0, import_react27.useCallback)(async () => {
|
|
4951
5111
|
setIsDisconnecting(true);
|
|
4952
5112
|
try {
|
|
4953
5113
|
console.log("Disconnected from all chains");
|
|
@@ -4958,16 +5118,16 @@ var WalletSidebarContent = ({ accentColor = "blue" }) => {
|
|
|
4958
5118
|
setIsDisconnecting(false);
|
|
4959
5119
|
}
|
|
4960
5120
|
}, [disconnect]);
|
|
4961
|
-
const renderBalancesView = () => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
4962
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
4963
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4964
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
5121
|
+
const renderBalancesView = () => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react26.VStack, { gap: "6", align: "stretch", children: [
|
|
5122
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react26.Box, { children: [
|
|
5123
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react26.Text, { fontSize: "sm", fontWeight: "medium", mb: "3", children: "Balances" }),
|
|
5124
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react26.VStack, { gap: "2", align: "stretch", children: sortedBalances.map((bal) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(BalanceItem, { asset: bal, onClick: () => onBalanceClick(bal.ticker), accentColor }, bal.denom)) })
|
|
4965
5125
|
] }),
|
|
4966
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
4967
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4968
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
5126
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react26.Box, { children: [
|
|
5127
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react26.Text, { fontSize: "sm", fontWeight: "medium", mb: "3", children: "Quick Actions" }),
|
|
5128
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react26.VStack, { gap: "2", align: "stretch", children: [
|
|
4969
5129
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4970
|
-
|
|
5130
|
+
import_react26.Button,
|
|
4971
5131
|
{
|
|
4972
5132
|
size: "sm",
|
|
4973
5133
|
variant: "outline",
|
|
@@ -4978,7 +5138,7 @@ var WalletSidebarContent = ({ accentColor = "blue" }) => {
|
|
|
4978
5138
|
}
|
|
4979
5139
|
),
|
|
4980
5140
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
4981
|
-
|
|
5141
|
+
import_react26.Button,
|
|
4982
5142
|
{
|
|
4983
5143
|
size: "sm",
|
|
4984
5144
|
variant: "outline",
|
|
@@ -4991,7 +5151,7 @@ var WalletSidebarContent = ({ accentColor = "blue" }) => {
|
|
|
4991
5151
|
}
|
|
4992
5152
|
),
|
|
4993
5153
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
4994
|
-
|
|
5154
|
+
import_react26.Button,
|
|
4995
5155
|
{
|
|
4996
5156
|
size: "sm",
|
|
4997
5157
|
variant: "outline",
|
|
@@ -5005,8 +5165,8 @@ var WalletSidebarContent = ({ accentColor = "blue" }) => {
|
|
|
5005
5165
|
)
|
|
5006
5166
|
] })
|
|
5007
5167
|
] }),
|
|
5008
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
5009
|
-
|
|
5168
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react26.Box, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
5169
|
+
import_react26.Button,
|
|
5010
5170
|
{
|
|
5011
5171
|
size: "sm",
|
|
5012
5172
|
width: "full",
|
|
@@ -5019,7 +5179,7 @@ var WalletSidebarContent = ({ accentColor = "blue" }) => {
|
|
|
5019
5179
|
}
|
|
5020
5180
|
) })
|
|
5021
5181
|
] });
|
|
5022
|
-
const statusColor = (0,
|
|
5182
|
+
const statusColor = (0, import_react27.useMemo)(() => {
|
|
5023
5183
|
switch (status) {
|
|
5024
5184
|
case import_core.WalletState.Connected:
|
|
5025
5185
|
return "green";
|
|
@@ -5031,15 +5191,15 @@ var WalletSidebarContent = ({ accentColor = "blue" }) => {
|
|
|
5031
5191
|
return "gray";
|
|
5032
5192
|
}
|
|
5033
5193
|
}, [status]);
|
|
5034
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
5035
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
5036
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
5037
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
5038
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
5039
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
5194
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react26.VStack, { gap: "6", align: "stretch", children: [
|
|
5195
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react26.Box, { children: [
|
|
5196
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react25.InterchainWalletModal, {}),
|
|
5197
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react26.HStack, { justify: "space-between", mb: "3", children: [
|
|
5198
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react26.Text, { fontSize: "sm", fontWeight: "medium", children: "Wallet Status" }),
|
|
5199
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react26.Badge, { colorPalette: statusColor, size: "sm", children: status })
|
|
5040
5200
|
] }),
|
|
5041
5201
|
status === import_core.WalletState.Connected && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
5042
|
-
|
|
5202
|
+
import_react26.Box,
|
|
5043
5203
|
{
|
|
5044
5204
|
p: "3",
|
|
5045
5205
|
bgGradient: "to-br",
|
|
@@ -5049,12 +5209,12 @@ var WalletSidebarContent = ({ accentColor = "blue" }) => {
|
|
|
5049
5209
|
borderWidth: "1px",
|
|
5050
5210
|
borderColor: `${accentColor}.500/20`,
|
|
5051
5211
|
children: [
|
|
5052
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
5053
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
5054
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
5055
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
5212
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react26.Text, { fontSize: "xs", color: "fg.muted", mb: "1", children: username != null ? username : "Address" }),
|
|
5213
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react26.HStack, { justify: "space-between", children: [
|
|
5214
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react26.Text, { fontSize: "sm", fontFamily: "mono", children: walletAddress }),
|
|
5215
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react26.Box, { position: "relative", children: [
|
|
5056
5216
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
5057
|
-
|
|
5217
|
+
import_react26.Button,
|
|
5058
5218
|
{
|
|
5059
5219
|
ref: copyButtonRef,
|
|
5060
5220
|
size: "xs",
|
|
@@ -5064,7 +5224,7 @@ var WalletSidebarContent = ({ accentColor = "blue" }) => {
|
|
|
5064
5224
|
}
|
|
5065
5225
|
),
|
|
5066
5226
|
showCopiedTooltip && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
5067
|
-
|
|
5227
|
+
import_react26.Box,
|
|
5068
5228
|
{
|
|
5069
5229
|
position: "absolute",
|
|
5070
5230
|
top: "-35px",
|
|
@@ -5090,7 +5250,7 @@ var WalletSidebarContent = ({ accentColor = "blue" }) => {
|
|
|
5090
5250
|
}
|
|
5091
5251
|
),
|
|
5092
5252
|
status !== import_core.WalletState.Connected && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
5093
|
-
|
|
5253
|
+
import_react26.Button,
|
|
5094
5254
|
{
|
|
5095
5255
|
size: "sm",
|
|
5096
5256
|
variant: "solid",
|
|
@@ -5100,14 +5260,14 @@ var WalletSidebarContent = ({ accentColor = "blue" }) => {
|
|
|
5100
5260
|
}
|
|
5101
5261
|
)
|
|
5102
5262
|
] }),
|
|
5103
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
5263
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react26.Separator, {}),
|
|
5104
5264
|
status === import_core.WalletState.Connected && viewState === "balances" && renderBalancesView(),
|
|
5105
5265
|
status === import_core.WalletState.Connected && viewState === "send" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SendForm, { balances: sortedBalances, onClose: handleCancel, selectedTicker: clickedBalance, accentColor })
|
|
5106
5266
|
] });
|
|
5107
5267
|
};
|
|
5108
5268
|
|
|
5109
5269
|
// src/components/settings-toggle.tsx
|
|
5110
|
-
var
|
|
5270
|
+
var import_react28 = require("@chakra-ui/react");
|
|
5111
5271
|
var import_lu4 = require("react-icons/lu");
|
|
5112
5272
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
5113
5273
|
function SettingsToggle({ accentColor }) {
|
|
@@ -5115,21 +5275,21 @@ function SettingsToggle({ accentColor }) {
|
|
|
5115
5275
|
Sidebar,
|
|
5116
5276
|
{
|
|
5117
5277
|
ariaLabel: "Settings",
|
|
5118
|
-
trigger: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
5278
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react28.Button, { variant: "subtle", size: { base: "sm", md: "md" }, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lu4.LuSettings, {}) }),
|
|
5119
5279
|
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SettingsSidebarContent, { accentColor })
|
|
5120
5280
|
}
|
|
5121
5281
|
);
|
|
5122
5282
|
}
|
|
5123
5283
|
|
|
5124
5284
|
// src/components/testnet-banner.tsx
|
|
5125
|
-
var
|
|
5285
|
+
var import_react29 = require("@chakra-ui/react");
|
|
5126
5286
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
5127
5287
|
var TestnetBanner = () => {
|
|
5128
5288
|
if (!isTestnetChain()) {
|
|
5129
5289
|
return null;
|
|
5130
5290
|
}
|
|
5131
5291
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
5132
|
-
|
|
5292
|
+
import_react29.Box,
|
|
5133
5293
|
{
|
|
5134
5294
|
position: "fixed",
|
|
5135
5295
|
bottom: "0",
|
|
@@ -5143,7 +5303,7 @@ var TestnetBanner = () => {
|
|
|
5143
5303
|
fontSize: "xs",
|
|
5144
5304
|
fontWeight: "bold",
|
|
5145
5305
|
letterSpacing: "wide",
|
|
5146
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
5306
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react29.Text, { children: "YOU ARE ON TESTNET" })
|
|
5147
5307
|
}
|
|
5148
5308
|
);
|
|
5149
5309
|
};
|
|
@@ -5273,6 +5433,8 @@ var TestnetBanner = () => {
|
|
|
5273
5433
|
getCurrentEpoch,
|
|
5274
5434
|
getCurrentWeekEpochEndTime,
|
|
5275
5435
|
getDefaultTxMemo,
|
|
5436
|
+
getDelegatorDelegations,
|
|
5437
|
+
getDelegatorValidators,
|
|
5276
5438
|
getDenomType,
|
|
5277
5439
|
getDistributionParams,
|
|
5278
5440
|
getEcosystemApps,
|
|
@@ -5329,8 +5491,10 @@ var TestnetBanner = () => {
|
|
|
5329
5491
|
getStakingRewards,
|
|
5330
5492
|
getTradingViewIntervals,
|
|
5331
5493
|
getUSDCDenom,
|
|
5494
|
+
getValidatorDelegatorRewards,
|
|
5332
5495
|
getValidatorPageUrl,
|
|
5333
5496
|
getValidatorSupportedDenoms,
|
|
5497
|
+
getValidators,
|
|
5334
5498
|
getWalletChainsNames,
|
|
5335
5499
|
getWeekEpochInfo,
|
|
5336
5500
|
intlDateFormat,
|
|
@@ -5396,6 +5560,7 @@ var TestnetBanner = () => {
|
|
|
5396
5560
|
useSettings,
|
|
5397
5561
|
useSigningClient,
|
|
5398
5562
|
useToast,
|
|
5563
|
+
useValidatorLogos,
|
|
5399
5564
|
validateBZEBech32Address,
|
|
5400
5565
|
validateBech32Address,
|
|
5401
5566
|
validateEndpoints,
|