@dappworks/kit 0.4.181 → 0.4.183
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/dev.d.mts +3 -3
- package/dist/experimental.d.mts +3 -3
- package/dist/form.d.mts +15 -15
- package/dist/index.d.mts +3 -3
- package/dist/inspector.d.mts +2 -2
- package/dist/jsontable.d.mts +8 -8
- package/dist/metrics.d.mts +15 -15
- package/dist/plugins.d.mts +11 -11
- package/dist/ui.d.mts +7 -7
- package/dist/wallet.d.mts +8 -5
- package/dist/wallet.mjs +65 -21
- package/dist/wallet.mjs.map +1 -1
- package/package.json +1 -1
package/dist/wallet.mjs
CHANGED
|
@@ -12,7 +12,7 @@ import './chunk-K7LFG5BA.mjs';
|
|
|
12
12
|
import { __commonJS, __spreadValues, __spreadProps, __toESM } from './chunk-2EXDWOHY.mjs';
|
|
13
13
|
import { RainbowKitProvider, darkTheme, lightTheme, getDefaultConfig, useConnectModal } from '@rainbow-me/rainbowkit';
|
|
14
14
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
15
|
-
import
|
|
15
|
+
import React6, { useEffect } from 'react';
|
|
16
16
|
import { observer } from 'mobx-react-lite';
|
|
17
17
|
import { WagmiProvider, useWalletClient, useAccount, useSwitchChain, useConnect, useDisconnect } from 'wagmi';
|
|
18
18
|
import BigNumber from 'bignumber.js';
|
|
@@ -20,6 +20,7 @@ import EventEmitter from 'events';
|
|
|
20
20
|
import { encodeFunctionData, hashMessage, hashTypedData } from 'viem';
|
|
21
21
|
import { iopayWallet, metaMaskWallet, walletConnectWallet, okxWallet, binanceWallet } from '@rainbow-me/rainbowkit/wallets';
|
|
22
22
|
import { iotex, iotexTestnet as iotexTestnet$1 } from 'viem/chains';
|
|
23
|
+
import { Checkbox, Tooltip, Button, Popover, PopoverTrigger, PopoverContent, Input, Table, TableHeader, TableColumn, TableBody, TableRow, TableCell } from '@nextui-org/react';
|
|
23
24
|
|
|
24
25
|
// ../../node_modules/@safe-global/safe-gateway-typescript-sdk/dist/utils.js
|
|
25
26
|
var require_utils = __commonJS({
|
|
@@ -2292,7 +2293,7 @@ var render = (icon, props, inline, ref) => {
|
|
|
2292
2293
|
componentProps.dangerouslySetInnerHTML = {
|
|
2293
2294
|
__html: cleanUpInnerHTML(replaceIDs(item.body, id ? () => id + "ID" + localCounter++ : "iconifyReact"))
|
|
2294
2295
|
};
|
|
2295
|
-
return
|
|
2296
|
+
return React6.createElement("svg", componentProps);
|
|
2296
2297
|
}
|
|
2297
2298
|
const { body, width, height } = icon;
|
|
2298
2299
|
const useMask = mode === "mask" || (mode === "bg" ? false : body.indexOf("currentColor") !== -1);
|
|
@@ -2305,7 +2306,7 @@ var render = (icon, props, inline, ref) => {
|
|
|
2305
2306
|
"width": fixSize(renderAttribs.width),
|
|
2306
2307
|
"height": fixSize(renderAttribs.height)
|
|
2307
2308
|
}), commonProps), useMask ? monotoneProps : coloredProps), customStyle);
|
|
2308
|
-
return
|
|
2309
|
+
return React6.createElement("span", componentProps);
|
|
2309
2310
|
};
|
|
2310
2311
|
allowSimpleNames(true);
|
|
2311
2312
|
setAPIModule("", fetchAPIModule);
|
|
@@ -2352,7 +2353,7 @@ if (typeof document !== "undefined" && typeof window !== "undefined") {
|
|
|
2352
2353
|
}
|
|
2353
2354
|
}
|
|
2354
2355
|
}
|
|
2355
|
-
var IconComponent = class extends
|
|
2356
|
+
var IconComponent = class extends React6.Component {
|
|
2356
2357
|
constructor(props) {
|
|
2357
2358
|
super(props);
|
|
2358
2359
|
this.state = {
|
|
@@ -2462,7 +2463,7 @@ var IconComponent = class extends React2.Component {
|
|
|
2462
2463
|
const props = this.props;
|
|
2463
2464
|
const icon = this.state.icon;
|
|
2464
2465
|
if (icon === null) {
|
|
2465
|
-
return props.children ? props.children :
|
|
2466
|
+
return props.children ? props.children : React6.createElement("span", {});
|
|
2466
2467
|
}
|
|
2467
2468
|
let newProps = props;
|
|
2468
2469
|
if (icon.classes) {
|
|
@@ -2473,19 +2474,19 @@ var IconComponent = class extends React2.Component {
|
|
|
2473
2474
|
return render(__spreadValues(__spreadValues({}, defaultIconProps), icon.data), newProps, props._inline, props._ref);
|
|
2474
2475
|
}
|
|
2475
2476
|
};
|
|
2476
|
-
var Icon =
|
|
2477
|
+
var Icon = React6.forwardRef(function Icon2(props, ref) {
|
|
2477
2478
|
const newProps = __spreadProps(__spreadValues({}, props), {
|
|
2478
2479
|
_ref: ref,
|
|
2479
2480
|
_inline: false
|
|
2480
2481
|
});
|
|
2481
|
-
return
|
|
2482
|
+
return React6.createElement(IconComponent, newProps);
|
|
2482
2483
|
});
|
|
2483
|
-
|
|
2484
|
+
React6.forwardRef(function InlineIcon2(props, ref) {
|
|
2484
2485
|
const newProps = __spreadProps(__spreadValues({}, props), {
|
|
2485
2486
|
_ref: ref,
|
|
2486
2487
|
_inline: true
|
|
2487
2488
|
});
|
|
2488
|
-
return
|
|
2489
|
+
return React6.createElement(IconComponent, newProps);
|
|
2489
2490
|
});
|
|
2490
2491
|
|
|
2491
2492
|
// module/Wallet/walletPluginStore.tsx
|
|
@@ -2529,6 +2530,8 @@ var WalletRpcStore = class {
|
|
|
2529
2530
|
async addToMetamask(url) {
|
|
2530
2531
|
var _a;
|
|
2531
2532
|
try {
|
|
2533
|
+
if (typeof window == "undefined")
|
|
2534
|
+
return;
|
|
2532
2535
|
await ((_a = window == null ? void 0 : window.ethereum) == null ? void 0 : _a.request({
|
|
2533
2536
|
method: "wallet_addEthereumChain",
|
|
2534
2537
|
params: [{
|
|
@@ -2610,15 +2613,15 @@ var WalletRpcStore = class {
|
|
|
2610
2613
|
}
|
|
2611
2614
|
scoreIcon(score) {
|
|
2612
2615
|
if (score < 0) {
|
|
2613
|
-
return /* @__PURE__ */
|
|
2616
|
+
return /* @__PURE__ */ React6.createElement(Icon, { icon: "codicon:error", width: "18", height: "18", style: { color: "#FF0000" } });
|
|
2614
2617
|
}
|
|
2615
2618
|
if (score < 1) {
|
|
2616
|
-
return /* @__PURE__ */
|
|
2619
|
+
return /* @__PURE__ */ React6.createElement(Icon, { icon: "icon-park-solid:check-one", width: "18", height: "18", style: { color: "#289726" } });
|
|
2617
2620
|
}
|
|
2618
2621
|
if (score < 2) {
|
|
2619
|
-
return /* @__PURE__ */
|
|
2622
|
+
return /* @__PURE__ */ React6.createElement(Icon, { icon: "bxs:error", width: "18", height: "18", style: { color: "#FFA500" } });
|
|
2620
2623
|
}
|
|
2621
|
-
return /* @__PURE__ */
|
|
2624
|
+
return /* @__PURE__ */ React6.createElement(Icon, { icon: "codicon:error", width: "18", height: "18", style: { color: "#FF0000" } });
|
|
2622
2625
|
}
|
|
2623
2626
|
get wallet() {
|
|
2624
2627
|
return RootStore.Get(WalletStore);
|
|
@@ -3234,20 +3237,20 @@ var sdk_default = SafeAppsSDK;
|
|
|
3234
3237
|
// ../../node_modules/@safe-global/safe-apps-sdk/dist/esm/index.js
|
|
3235
3238
|
var esm_default = sdk_default;
|
|
3236
3239
|
var SuccessTxDialog = observer((props) => {
|
|
3237
|
-
return /* @__PURE__ */
|
|
3240
|
+
return /* @__PURE__ */ React6.createElement("div", { className: "flex-col gap-4 py-10" }, /* @__PURE__ */ React6.createElement("div", { className: "w-full flex items-center justify-center" }, /* @__PURE__ */ React6.createElement(Icon, { icon: "icon-park-solid:check-one", width: "48", height: "48", className: "text-green-500" })), /* @__PURE__ */ React6.createElement("div", { className: "text-2xl font-[900] text-center mt-4" }, props.msg), /* @__PURE__ */ React6.createElement(
|
|
3238
3241
|
"div",
|
|
3239
3242
|
{
|
|
3240
3243
|
className: "flex items-center justify-center text-green-500 text-sm mt-6 gap-2 cursor-pointer hover:text-green-600 transition",
|
|
3241
3244
|
onClick: (e) => window.open(`https://iotexscan.io/tx/${props.hash}`, "_blank")
|
|
3242
3245
|
},
|
|
3243
3246
|
"View on IoTeXScan ",
|
|
3244
|
-
/* @__PURE__ */
|
|
3247
|
+
/* @__PURE__ */ React6.createElement(Icon, { icon: "material-symbols:chip-extraction-rounded", width: "18", height: "18" })
|
|
3245
3248
|
));
|
|
3246
3249
|
});
|
|
3247
3250
|
var ShowSuccessTxDialog = ({ msg, hash }) => {
|
|
3248
3251
|
RootStore.Get(DialogStore).setData({
|
|
3249
3252
|
title: "",
|
|
3250
|
-
content: /* @__PURE__ */
|
|
3253
|
+
content: /* @__PURE__ */ React6.createElement(SuccessTxDialog, { msg, hash }),
|
|
3251
3254
|
isOpen: true
|
|
3252
3255
|
});
|
|
3253
3256
|
};
|
|
@@ -3400,8 +3403,6 @@ var WalletStore = class _WalletStore {
|
|
|
3400
3403
|
const promise = new Promise(async (res, rej) => {
|
|
3401
3404
|
var _a, _b;
|
|
3402
3405
|
try {
|
|
3403
|
-
if (!window)
|
|
3404
|
-
return;
|
|
3405
3406
|
if (this.account) {
|
|
3406
3407
|
if (Number((_a = this.chain) == null ? void 0 : _a.id) == Number(chainId)) {
|
|
3407
3408
|
res();
|
|
@@ -3641,14 +3642,57 @@ var WalletProvider = observer(({
|
|
|
3641
3642
|
}, [appName]);
|
|
3642
3643
|
return (
|
|
3643
3644
|
//@ts-ignore
|
|
3644
|
-
/* @__PURE__ */
|
|
3645
|
+
/* @__PURE__ */ React6.createElement(WagmiProvider, { config: walletConfig.rainbowKitConfig, reconnectOnMount: true }, /* @__PURE__ */ React6.createElement(QueryClientProvider, { client: queryClient }, /* @__PURE__ */ React6.createElement(RainbowKitProvider, { locale: "en", theme: theme == "dark" ? darkTheme() : lightTheme() }, children, /* @__PURE__ */ React6.createElement(WalletConnect, null))))
|
|
3645
3646
|
);
|
|
3646
3647
|
});
|
|
3647
3648
|
var WalletConnect = () => {
|
|
3648
3649
|
const wallet = RootStore.Get(WalletStore);
|
|
3649
3650
|
wallet.use();
|
|
3650
|
-
return /* @__PURE__ */
|
|
3651
|
+
return /* @__PURE__ */ React6.createElement(React6.Fragment, null);
|
|
3651
3652
|
};
|
|
3653
|
+
var RpcList = observer(() => {
|
|
3654
|
+
var _a, _b;
|
|
3655
|
+
RootStore.Get(WalletStore);
|
|
3656
|
+
const rpcStore = RootStore.Get(WalletRpcStore);
|
|
3657
|
+
useEffect(() => {
|
|
3658
|
+
rpcStore.testRpc();
|
|
3659
|
+
}, []);
|
|
3660
|
+
return /* @__PURE__ */ React6.createElement("div", { className: "mb-3 mt-2" }, /* @__PURE__ */ React6.createElement("div", { className: "w-full flex mb-2" }, /* @__PURE__ */ React6.createElement("div", { className: "flex items-center justify-center gap-2" }, /* @__PURE__ */ React6.createElement(Checkbox, { size: "sm", isSelected: rpcStore.isAutoSelectRpc.value, onValueChange: (e) => rpcStore.isAutoSelectRpc.save(e) }, "Auto select rpc"), /* @__PURE__ */ React6.createElement(Tooltip, { content: /* @__PURE__ */ React6.createElement("div", { className: "w-[300px]" }, "Once selected, if the current RPC cannot send a request, an available RPC will be automatically chosen.") }, /* @__PURE__ */ React6.createElement(Icon, { icon: "ph:question", width: "18", height: "18", className: "text-gray-500" }))), /* @__PURE__ */ React6.createElement(Button, { startContent: /* @__PURE__ */ React6.createElement(Icon, { icon: "tabler:test-pipe", width: "18", height: "18" }), className: "ml-auto", onClick: (e) => {
|
|
3661
|
+
rpcStore.testRpc();
|
|
3662
|
+
} }, "Test"), /* @__PURE__ */ React6.createElement(Popover, { placement: "bottom", offset: 20, showArrow: true, isOpen: rpcStore.showCustomRpc, onOpenChange: (open) => rpcStore.showCustomRpc = open }, /* @__PURE__ */ React6.createElement(PopoverTrigger, null, /* @__PURE__ */ React6.createElement(Button, { color: "primary", startContent: /* @__PURE__ */ React6.createElement(Icon, { icon: "basil:add-solid", width: "18", height: "18" }), className: "ml-4" }, "Add custom rpc")), /* @__PURE__ */ React6.createElement(PopoverContent, null, /* @__PURE__ */ React6.createElement("div", { className: "px-1 py-2" }, /* @__PURE__ */ React6.createElement(
|
|
3663
|
+
Input,
|
|
3664
|
+
{
|
|
3665
|
+
type: "url",
|
|
3666
|
+
className: "mb-4",
|
|
3667
|
+
placeholder: "https://rpc.com",
|
|
3668
|
+
value: rpcStore.customRpc,
|
|
3669
|
+
onValueChange: (value) => {
|
|
3670
|
+
rpcStore.customRpc = value;
|
|
3671
|
+
}
|
|
3672
|
+
}
|
|
3673
|
+
), /* @__PURE__ */ React6.createElement(Button, { color: "primary", isDisabled: !rpcStore.customRpc, onClick: (e) => rpcStore.addCustomRpc() }, "Save"))))), /* @__PURE__ */ React6.createElement(
|
|
3674
|
+
Table,
|
|
3675
|
+
{
|
|
3676
|
+
color: "success",
|
|
3677
|
+
selectionMode: "single",
|
|
3678
|
+
defaultSelectedKeys: [rpcStore.curRpc.value],
|
|
3679
|
+
"aria-label": "Example static collection table"
|
|
3680
|
+
},
|
|
3681
|
+
/* @__PURE__ */ React6.createElement(TableHeader, null, /* @__PURE__ */ React6.createElement(TableColumn, null, "RPC Server Address"), /* @__PURE__ */ React6.createElement(TableColumn, { align: "center" }, "Score"), /* @__PURE__ */ React6.createElement(TableColumn, { align: "center" }, "Height"), /* @__PURE__ */ React6.createElement(TableColumn, { align: "center" }, "Latency"), /* @__PURE__ */ React6.createElement(TableColumn, { align: "center" }, "Action")),
|
|
3682
|
+
/* @__PURE__ */ React6.createElement(TableBody, null, (_b = (_a = rpcStore.rpcList) == null ? void 0 : _a.value) == null ? void 0 : _b.map((item, index) => {
|
|
3683
|
+
return /* @__PURE__ */ React6.createElement(TableRow, { className: "cursor-pointer", key: item.name, onClick: (e) => {
|
|
3684
|
+
rpcStore.curRpc.save(item.name);
|
|
3685
|
+
RootStore.Get(ToastPlugin).success("Set rpc success");
|
|
3686
|
+
} }, /* @__PURE__ */ React6.createElement(TableCell, null, item.name), /* @__PURE__ */ React6.createElement(TableCell, null, rpcStore.scoreIcon(item.latency)), /* @__PURE__ */ React6.createElement(TableCell, null, item.height), /* @__PURE__ */ React6.createElement(TableCell, { className: rpcStore.latencyColor(item.latency) }, item.latency, "s"), /* @__PURE__ */ React6.createElement(TableCell, null, /* @__PURE__ */ React6.createElement("div", { className: "relative flex items-center gap-2" }, /* @__PURE__ */ React6.createElement(Tooltip, { content: "Add to metamask" }, /* @__PURE__ */ React6.createElement("span", { className: "text-lg text-danger cursor-pointer active:opacity-50", onClick: (e) => {
|
|
3687
|
+
e.stopPropagation();
|
|
3688
|
+
rpcStore.addToMetamask(item.name);
|
|
3689
|
+
} }, /* @__PURE__ */ React6.createElement(Icon, { icon: "logos:metamask-icon", width: "18", height: "18" }))), item.custom && /* @__PURE__ */ React6.createElement(Tooltip, { content: "Remove" }, /* @__PURE__ */ React6.createElement("span", { className: "text-lg text-danger cursor-pointer active:opacity-50", onClick: (e) => {
|
|
3690
|
+
e.stopPropagation();
|
|
3691
|
+
rpcStore.removeRpc(item.name);
|
|
3692
|
+
} }, /* @__PURE__ */ React6.createElement(Icon, { icon: "solar:trash-bin-minimalistic-broken", width: "20", height: "20" }))))));
|
|
3693
|
+
}))
|
|
3694
|
+
));
|
|
3695
|
+
});
|
|
3652
3696
|
var iotex2 = __spreadValues({
|
|
3653
3697
|
iconUrl: "https://icons.llamao.fi/icons/chains/rsz_iotex.jpg"
|
|
3654
3698
|
}, iotex);
|
|
@@ -3656,6 +3700,6 @@ var iotexTestnet = __spreadValues({
|
|
|
3656
3700
|
iconUrl: "https://icons.llamao.fi/icons/chains/rsz_iotex.jpg"
|
|
3657
3701
|
}, iotexTestnet$1);
|
|
3658
3702
|
|
|
3659
|
-
export { WalletConfigStore, WalletHistoryStore, WalletProvider, WalletRpcStore, WalletStore, iotex2 as iotex, iotexTestnet };
|
|
3703
|
+
export { RpcList, WalletConfigStore, WalletHistoryStore, WalletProvider, WalletRpcStore, WalletStore, iotex2 as iotex, iotexTestnet };
|
|
3660
3704
|
//# sourceMappingURL=out.js.map
|
|
3661
3705
|
//# sourceMappingURL=wallet.mjs.map
|