@suilend/sui-fe-next 0.1.56 → 0.1.57

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.
@@ -46,7 +46,7 @@ export interface WalletContext {
46
46
  dryRunTransaction: (transaction: Transaction, setGasBudget?: boolean) => Promise<DevInspectResults>;
47
47
  signExecuteAndWaitForTransaction: (transaction: Transaction, options?: {
48
48
  auction?: boolean;
49
- }, onSign?: (signedTransaction: SignatureWithBytes) => void, onExecute?: (res: SuiTransactionBlockResponse) => void) => Promise<SuiTransactionBlockResponse>;
49
+ }, onSetGasBudget?: (transaction: Transaction) => void, onSign?: (signedTransaction: SignatureWithBytes) => void, onExecute?: (res: SuiTransactionBlockResponse) => void) => Promise<SuiTransactionBlockResponse>;
50
50
  isUsingLedger: boolean;
51
51
  setIsUsingLedger: (isUsingLedger: boolean) => void;
52
52
  }
@@ -59,6 +59,7 @@ import { useRouter } from "next/router";
59
59
  import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState, } from "react";
60
60
  import { WalletProvider as MystenWalletProvider, SuiClientProvider, createNetworkConfig, } from "@mysten/dapp-kit";
61
61
  import { useAccounts, useConnectWallet, useCurrentAccount, useCurrentWallet, useDisconnectWallet, useSignTransaction, useSwitchAccount, useWallets, } from "@mysten/dapp-kit";
62
+ import { Transaction } from "@mysten/sui/transactions";
62
63
  import { SUI_DECIMALS } from "@mysten/sui/utils";
63
64
  import * as Sentry from "@sentry/nextjs";
64
65
  import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
@@ -461,23 +462,24 @@ function Inner(_a) {
461
462
  args_1[_i - 1] = arguments[_i];
462
463
  }
463
464
  return __awaiter(_this, __spreadArray([transaction_1], args_1, true), void 0, function (transaction, setGasBudget) {
464
- var _address, inspectResults, err_2;
465
+ var _address, _transaction, inspectResults, err_2;
465
466
  if (setGasBudget === void 0) { setGasBudget = true; }
466
467
  return __generator(this, function (_a) {
467
468
  switch (_a.label) {
468
469
  case 0:
469
470
  _address = impersonatedAddress !== null && impersonatedAddress !== void 0 ? impersonatedAddress : account === null || account === void 0 ? void 0 : account.address;
471
+ _transaction = Transaction.from(transaction);
470
472
  _a.label = 1;
471
473
  case 1:
472
474
  _a.trys.push([1, 3, , 4]);
473
475
  // Gas budget
474
476
  if (setGasBudget && gasBudget !== "")
475
- transaction.setGasBudget(+new BigNumber(gasBudget)
477
+ _transaction.setGasBudget(+new BigNumber(gasBudget)
476
478
  .times(Math.pow(10, SUI_DECIMALS))
477
479
  .integerValue(BigNumber.ROUND_DOWN));
478
480
  return [4 /*yield*/, suiClient.devInspectTransactionBlock({
479
481
  sender: _address !== null && _address !== void 0 ? _address : "0x0000000000000000000000000000000000000000000000000000000000000000",
480
- transactionBlock: transaction,
482
+ transactionBlock: _transaction,
481
483
  })];
482
484
  case 2:
483
485
  inspectResults = _a.sent();
@@ -487,11 +489,11 @@ function Inner(_a) {
487
489
  return [2 /*return*/, inspectResults];
488
490
  case 3:
489
491
  err_2 = _a.sent();
490
- // transaction.getData().inputs.filter(input=>!!input.Object).map(input=>input.)
492
+ // _transaction.getData().inputs.filter(input=>!!input.Object).map(input=>input.)
491
493
  Sentry.captureException(err_2, {
492
494
  tags: {
493
495
  simulation: true,
494
- transactionData: JSON.stringify(transaction.getData()),
496
+ transactionData: JSON.stringify(_transaction.getData()),
495
497
  },
496
498
  });
497
499
  console.error(err_2);
@@ -501,7 +503,7 @@ function Inner(_a) {
501
503
  });
502
504
  });
503
505
  }, [impersonatedAddress, account === null || account === void 0 ? void 0 : account.address, gasBudget, suiClient]);
504
- var signExecuteAndWaitForTransaction = useCallback(function (transaction, options, onSign, onExecute) { return __awaiter(_this, void 0, void 0, function () {
506
+ var signExecuteAndWaitForTransaction = useCallback(function (transaction, options, onSetGasBudget, onSign, onExecute) { return __awaiter(_this, void 0, void 0, function () {
505
507
  var _address, signedTransaction, err_3, res1, res2, err_4;
506
508
  var _a, _b;
507
509
  return __generator(this, function (_c) {
@@ -522,6 +524,7 @@ function Inner(_a) {
522
524
  transaction.setGasBudget(+new BigNumber(gasBudget)
523
525
  .times(Math.pow(10, SUI_DECIMALS))
524
526
  .integerValue(BigNumber.ROUND_DOWN));
527
+ onSetGasBudget === null || onSetGasBudget === void 0 ? void 0 : onSetGasBudget(transaction);
525
528
  return [4 /*yield*/, signTransaction({
526
529
  transaction: transaction,
527
530
  chain: "sui:mainnet",
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@suilend/sui-fe-next","version":"0.1.56","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":"./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":{"@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","mixpanel-browser":"^2.56.0","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/mixpanel-browser":"^2.50.2","@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.16.0","@mysten/sui":"1.28.2","@mysten/wallet-standard":"0.14.7","@suilend/sui-fe":"^0.3.9"}}
1
+ {"name":"@suilend/sui-fe-next","version":"0.1.57","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":"./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":{"@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","mixpanel-browser":"^2.56.0","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/mixpanel-browser":"^2.50.2","@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.16.0","@mysten/sui":"1.28.2","@mysten/wallet-standard":"0.14.7","@suilend/sui-fe":"^0.3.10"}}