@suilend/sui-fe-next 0.1.74 → 0.1.76
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.
|
@@ -54,12 +54,12 @@ export interface WalletContext {
|
|
|
54
54
|
signExecuteAndWaitForTransaction: (transaction: Transaction, options?: {
|
|
55
55
|
auction?: boolean;
|
|
56
56
|
}, onSetGasBudget?: (transaction: Transaction) => void, onSign?: (signedTransaction: SignatureWithBytes) => void, onExecute?: (res: SuiTransactionBlockResponse) => void) => Promise<SuiTransactionBlockResponse>;
|
|
57
|
+
isUsingLedger: boolean;
|
|
58
|
+
setIsUsingLedger: (isUsingLedger: boolean) => void;
|
|
57
59
|
signPersonalMessage: (message: Uint8Array) => Promise<{
|
|
58
60
|
bytes: string;
|
|
59
61
|
signature: string;
|
|
60
62
|
}>;
|
|
61
|
-
isUsingLedger: boolean;
|
|
62
|
-
setIsUsingLedger: (isUsingLedger: boolean) => void;
|
|
63
63
|
}
|
|
64
64
|
export declare const useWalletContext: () => WalletContext;
|
|
65
65
|
interface WalletContextProviderProps extends PropsWithChildren {
|
|
@@ -69,8 +69,8 @@ import { executeAuction } from "shio-sdk";
|
|
|
69
69
|
import { useLocalStorage } from "usehooks-ts";
|
|
70
70
|
import { API_URL, formatAddress, isInMsafeApp } from "@suilend/sui-fe";
|
|
71
71
|
import { showErrorToast, showInfoToast } from "../lib";
|
|
72
|
-
import { useSettingsContext } from "./SettingsContext";
|
|
73
72
|
import { getUniversalConnector } from "../lib/connector";
|
|
73
|
+
import { useSettingsContext } from "./SettingsContext";
|
|
74
74
|
export var WalletType;
|
|
75
75
|
(function (WalletType) {
|
|
76
76
|
WalletType["EXTENSION"] = "extension";
|
|
@@ -170,11 +170,6 @@ export var WalletContextQueryParams;
|
|
|
170
170
|
WalletContextQueryParams["WALLET"] = "wallet";
|
|
171
171
|
})(WalletContextQueryParams || (WalletContextQueryParams = {}));
|
|
172
172
|
var WalletContext = createContext({
|
|
173
|
-
signPersonalMessage: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
174
|
-
return __generator(this, function (_a) {
|
|
175
|
-
throw new Error("WalletContextProvider not initialized");
|
|
176
|
-
});
|
|
177
|
-
}); },
|
|
178
173
|
isImpersonating: false,
|
|
179
174
|
isConnectWalletDropdownOpen: false,
|
|
180
175
|
setIsConnectWalletDropdownOpen: function () {
|
|
@@ -208,6 +203,11 @@ var WalletContext = createContext({
|
|
|
208
203
|
setIsUsingLedger: function () {
|
|
209
204
|
throw new Error("WalletContextProvider not initialized");
|
|
210
205
|
},
|
|
206
|
+
signPersonalMessage: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
207
|
+
return __generator(this, function (_a) {
|
|
208
|
+
throw new Error("WalletContextProvider not initialized");
|
|
209
|
+
});
|
|
210
|
+
}); },
|
|
211
211
|
});
|
|
212
212
|
export var useWalletContext = function () { return useContext(WalletContext); };
|
|
213
213
|
function Inner(_a) {
|
|
@@ -388,9 +388,6 @@ function Inner(_a) {
|
|
|
388
388
|
}
|
|
389
389
|
});
|
|
390
390
|
}); }, [sessionAddress, universalConnector]);
|
|
391
|
-
var signPersonalMessage = sessionAddress
|
|
392
|
-
? walletConnectSignPersonalMessage
|
|
393
|
-
: function (message) { return signPersonalMessageRaw({ message: message, account: account }); };
|
|
394
391
|
var connectWalletWrapper = useCallback(function (_wallet) {
|
|
395
392
|
try {
|
|
396
393
|
if (_wallet === null || _wallet === void 0 ? void 0 : _wallet.walletConnect) {
|
|
@@ -442,29 +439,43 @@ function Inner(_a) {
|
|
|
442
439
|
showErrorToast("Failed to disconnect wallet", err);
|
|
443
440
|
console.error(err);
|
|
444
441
|
}
|
|
445
|
-
}, [
|
|
442
|
+
}, [sessionAddress, universalConnector, disconnectWallet]);
|
|
446
443
|
// Accounts
|
|
447
444
|
var accountsRes = useAccounts();
|
|
448
445
|
var accountRes = (_f = useCurrentAccount()) !== null && _f !== void 0 ? _f : undefined;
|
|
449
446
|
var switchAccount = useSwitchAccount().mutate;
|
|
450
|
-
var account =
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
publicKey: new Uint8Array(),
|
|
454
|
-
chains: ["sui:mainnet"],
|
|
455
|
-
features: [],
|
|
456
|
-
}
|
|
457
|
-
: accountRes;
|
|
458
|
-
var accounts = sessionAddress
|
|
459
|
-
? [
|
|
460
|
-
{
|
|
447
|
+
var account = useMemo(function () {
|
|
448
|
+
return sessionAddress
|
|
449
|
+
? {
|
|
461
450
|
address: sessionAddress,
|
|
462
451
|
publicKey: new Uint8Array(),
|
|
463
452
|
chains: ["sui:mainnet"],
|
|
464
453
|
features: [],
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
|
|
454
|
+
}
|
|
455
|
+
: accountRes;
|
|
456
|
+
}, [sessionAddress, accountRes]);
|
|
457
|
+
var accounts = useMemo(function () {
|
|
458
|
+
return sessionAddress
|
|
459
|
+
? [
|
|
460
|
+
{
|
|
461
|
+
address: sessionAddress,
|
|
462
|
+
publicKey: new Uint8Array(),
|
|
463
|
+
chains: ["sui:mainnet"],
|
|
464
|
+
features: [],
|
|
465
|
+
},
|
|
466
|
+
]
|
|
467
|
+
: accountsRes;
|
|
468
|
+
}, [sessionAddress, accountsRes]);
|
|
469
|
+
var signPersonalMessage = useMemo(function () {
|
|
470
|
+
return sessionAddress
|
|
471
|
+
? walletConnectSignPersonalMessage
|
|
472
|
+
: function (message) { return signPersonalMessageRaw({ message: message, account: account }); };
|
|
473
|
+
}, [
|
|
474
|
+
sessionAddress,
|
|
475
|
+
walletConnectSignPersonalMessage,
|
|
476
|
+
signPersonalMessageRaw,
|
|
477
|
+
account,
|
|
478
|
+
]);
|
|
468
479
|
var switchAccountWrapper = useCallback(function (_account, addressNameServiceName) {
|
|
469
480
|
var _a, _b, _c;
|
|
470
481
|
var accountLabel = (_b = (_a = _account === null || _account === void 0 ? void 0 : _account.label) !== null && _a !== void 0 ? _a : addressNameServiceName) !== null && _b !== void 0 ? _b : formatAddress(_account.address);
|
|
@@ -736,7 +747,6 @@ function Inner(_a) {
|
|
|
736
747
|
signPersonalMessage: signPersonalMessage,
|
|
737
748
|
};
|
|
738
749
|
}, [
|
|
739
|
-
session,
|
|
740
750
|
impersonatedAddress,
|
|
741
751
|
isConnectWalletDropdownOpen,
|
|
742
752
|
wallets,
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@suilend/sui-fe-next","version":"0.1.
|
|
1
|
+
{"name":"@suilend/sui-fe-next","version":"0.1.76","private":false,"description":"A collection of TypeScript frontend components and hooks","author":"Suilend","license":"MIT","main":"./index.js","exports":{".":"./index.js","./contexts/SettingsContext":"./contexts/SettingsContext.jsx","./contexts/WalletContext":"./contexts/WalletContext.jsx","./contexts":"./contexts/index.js","./fetchers":"./fetchers/index.js","./fetchers/useFetchBalances":"./fetchers/useFetchBalances.js","./hooks":"./hooks/index.js","./hooks/keypair":"./hooks/keypair.js","./hooks/useCoinMetadataMap":"./hooks/useCoinMetadataMap.js","./hooks/useIsAndroid":"./hooks/useIsAndroid.jsx","./hooks/useIsTouchscreen":"./hooks/useIsTouchscreen.jsx","./hooks/useIsiOS":"./hooks/useIsiOS.jsx","./hooks/useLedgerHashDialog":"./hooks/useLedgerHashDialog.js","./hooks/useRefreshOnBalancesChange":"./hooks/useRefreshOnBalancesChange.js","./lib/connector":"./lib/connector.js","./lib":"./lib/index.js","./lib/router":"./lib/router.js","./lib/toasts":"./lib/toasts.jsx"},"types":"./index.js","scripts":{"build":"rm -rf ./dist && bun tsc","eslint":"eslint --fix \"./src/**/*.ts\"","prettier":"prettier --write \"./src/**/*\"","lint":"bun eslint && bun prettier && bun tsc --noEmit","release":"bun run build && bun ts-node ./release.ts && cd ./dist && npm publish --access public"},"repository":{"type":"git","url":"git+https://github.com/suilend/sui-fe.git"},"bugs":{"url":"https://github.com/suilend/sui-fe/issues"},"dependencies":{"@reown/appkit":"^1.8.10","@reown/appkit-common":"^1.8.10","@reown/appkit-universal-connector":"^1.8.10","@sentry/nextjs":"^8.38.0","@tanstack/react-query":"^5.60.2","bignumber.js":"^9.1.2","launchdarkly-react-client-sdk":"^3.6.0","lodash":"^4.17.21","next":"^15.0.3","react":"18.3.1","react-dom":"18.3.1","react-responsive":"^10.0.0","shio-sdk":"^1.0.8","sonner":"1.4.41","swr":"^2.2.5","tailwind-merge":"^2.5.4","usehooks-ts":"^3.1.1"},"devDependencies":{"@tsconfig/next":"^2.0.3","@types/lodash":"^4.17.13","@types/node":"^22.9.0","@types/react":"^18.3.12","@types/react-dom":"^18.3.1","@typescript-eslint/eslint-plugin":"^8.14.0","@typescript-eslint/parser":"^8.14.0","eslint":"^9.14.0","eslint-config-next":"^15.0.3","eslint-config-prettier":"^9.1.0","eslint-plugin-import":"^2.31.0","eslint-plugin-prettier":"^5.2.1","prettier":"^3.3.3","ts-node":"^10.9.2","typescript":"^5.6.3"},"peerDependencies":{"@mysten/dapp-kit":"0.19.4","@mysten/sui":"1.42.0","@mysten/wallet-standard":"0.19.2","@suilend/sui-fe":"^0.3.36"}}
|