Skip to content

Commit 9fb4883

Browse files
committed
lint
1 parent 7dcea95 commit 9fb4883

40 files changed

+216
-367
lines changed

apps/dashboard/src/stories/utils.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export function BadgeContainer(props: {
2727
);
2828
}
2929

30-
export function mobileViewport(
30+
function mobileViewport(
3131
key: "iphone14" | "iphone14promax" | "ipad11p" | "ipad12p",
3232
) {
3333
return {

packages/thirdweb/knip.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"src/exports/**",
55
"scripts/**/*.{ts,mjs}",
66
"src/cli/bin.ts",
7-
"src/transaction/actions/send-batch-transaction.ts"
7+
"src/transaction/actions/send-batch-transaction.ts",
8+
"src/react/core/hooks/useBridgeRoutes.ts"
89
],
910
"project": ["src/**/*.{ts,tsx}", "scripts/**/*.mjs"],
1011
"ignore": ["src/**/__generated__/**", "**/*.bench.ts"],

packages/thirdweb/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@
235235
"@radix-ui/react-focus-scope": "1.1.7",
236236
"@radix-ui/react-icons": "1.3.2",
237237
"@radix-ui/react-tooltip": "1.2.7",
238+
"@storybook/react": "^9.0.10",
238239
"@tanstack/react-query": "5.80.7",
239240
"@thirdweb-dev/engine": "workspace:*",
240241
"@thirdweb-dev/insight": "workspace:*",

packages/thirdweb/src/react/core/hooks/pay/useBuyWithFiatQuotesForProviders.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { toUnits } from "../../../../utils/units.js";
88
/**
99
* @internal
1010
*/
11-
export type UseBuyWithFiatQuotesForProvidersParams = {
11+
type UseBuyWithFiatQuotesForProvidersParams = {
1212
/**
1313
* A client is the entry point to the thirdweb SDK.
1414
*/
@@ -38,15 +38,15 @@ export type UseBuyWithFiatQuotesForProvidersParams = {
3838
/**
3939
* @internal
4040
*/
41-
export type OnrampQuoteQueryOptions = Omit<
41+
type OnrampQuoteQueryOptions = Omit<
4242
UseQueryOptions<Awaited<ReturnType<typeof prepareOnramp>>>,
4343
"queryFn" | "queryKey" | "enabled"
4444
>;
4545

4646
/**
4747
* @internal
4848
*/
49-
export type UseBuyWithFiatQuotesForProvidersResult = {
49+
type UseBuyWithFiatQuotesForProvidersResult = {
5050
data: Awaited<ReturnType<typeof prepareOnramp>> | undefined;
5151
isLoading: boolean;
5252
error: Error | null;

packages/thirdweb/src/react/core/hooks/useBridgeError.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { isRetryable, mapBridgeError } from "../errors/mapBridgeError.js";
44
/**
55
* Parameters for the useBridgeError hook
66
*/
7-
export interface UseBridgeErrorParams {
7+
interface UseBridgeErrorParams {
88
/**
99
* The error to process. Can be an ApiError or generic Error.
1010
*/
@@ -14,7 +14,7 @@ export interface UseBridgeErrorParams {
1414
/**
1515
* Result returned by the useBridgeError hook
1616
*/
17-
export interface UseBridgeErrorResult {
17+
interface UseBridgeErrorResult {
1818
/**
1919
* The mapped/normalized error, null if no error provided
2020
*/

packages/thirdweb/src/react/core/hooks/useBridgeQuote.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,14 @@ import type { Token } from "../../../bridge/types/Token.js";
66
import type { ThirdwebClient } from "../../../client/client.js";
77
import { checksumAddress } from "../../../utils/address.js";
88

9-
export interface UseBridgeQuoteParams {
9+
interface UseBridgeQuoteParams {
1010
originToken: Token;
1111
destinationToken: Token;
1212
destinationAmount: bigint;
1313
client: ThirdwebClient;
1414
enabled?: boolean;
1515
}
1616

17-
export type BridgeQuoteResult = NonNullable<
18-
ReturnType<typeof useBridgeQuote>["data"]
19-
>;
20-
2117
export function useBridgeQuote({
2218
originToken,
2319
destinationToken,
@@ -38,7 +34,7 @@ export function useBridgeQuote({
3834
// if ssame token and chain, use transfer
3935
if (
4036
checksumAddress(originToken.address) ===
41-
checksumAddress(destinationToken.address) &&
37+
checksumAddress(destinationToken.address) &&
4238
originToken.chainId === destinationToken.chainId
4339
) {
4440
const transfer = await Transfer.prepare({
@@ -51,8 +47,6 @@ export function useBridgeQuote({
5147
});
5248
return transfer;
5349
}
54-
55-
console.log("AMOUNT", destinationAmount);
5650
const quote = await Buy.quote({
5751
originChainId: originToken.chainId,
5852
originTokenAddress: originToken.address,

packages/thirdweb/src/react/core/hooks/useBridgeRoutes.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export type UseBridgeRoutesParams = RoutesTypes.Options & {
3030
* originTokenAddress: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"
3131
* });
3232
* ```
33+
* @internal
3334
*/
3435
export function useBridgeRoutes(params: UseBridgeRoutesParams) {
3536
const { enabled = true, ...routeParams } = params;

packages/thirdweb/src/react/core/hooks/useStepExecutor.test.ts

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,10 @@ import type { Action } from "../../../bridge/types/BridgeAction.js";
33
import type { RouteStep } from "../../../bridge/types/Route.js";
44
import { defineChain } from "../../../chains/utils.js";
55
import type { ThirdwebClient } from "../../../client/client.js";
6-
import {
7-
buyWithApprovalQuote,
8-
complexBuyQuote,
9-
onrampWithSwapsQuote,
10-
simpleBuyQuote,
11-
simpleOnrampQuote,
12-
} from "../../../stories/Bridge/fixtures.js";
136
import type { Wallet } from "../../../wallets/interfaces/wallet.js";
147
import type { WindowAdapter } from "../adapters/WindowAdapter.js";
158
import type { BridgePrepareResult } from "./useBridgePrepare.js";
16-
import type { StepExecutorOptions } from "./useStepExecutor.js";
17-
import { flattenRouteSteps, useStepExecutor } from "./useStepExecutor.js";
18-
import { toWei } from "src/utils/units.js";
9+
import { flattenRouteSteps } from "./useStepExecutor.js";
1910

2011
// Mock React hooks
2112
vi.mock("react", async () => {
@@ -88,11 +79,14 @@ const mockClient: ThirdwebClient = {
8879
secretKey: undefined,
8980
} as ThirdwebClient;
9081

91-
const mockWindowAdapter: WindowAdapter = {
82+
const _mockWindowAdapter: WindowAdapter = {
9283
open: vi.fn(),
9384
};
9485

95-
const createMockWallet = (hasAccount = true, supportsBatch = false): Wallet => {
86+
const _createMockWallet = (
87+
hasAccount = true,
88+
supportsBatch = false,
89+
): Wallet => {
9690
const mockAccount = hasAccount
9791
? {
9892
address: "0x1234567890123456789012345678901234567890",
@@ -181,7 +175,7 @@ const createMockRouteSteps = (
181175
return steps;
182176
};
183177

184-
const createMockBuyQuote = (steps: RouteStep[]): BridgePrepareResult => ({
178+
const _createMockBuyQuote = (steps: RouteStep[]): BridgePrepareResult => ({
185179
type: "buy",
186180
originAmount: 1000000000000000000n,
187181
destinationAmount: 999000000000000000n,
@@ -253,6 +247,4 @@ describe("useStepExecutor", () => {
253247
expect(flattened).toHaveLength(0);
254248
});
255249
});
256-
257-
258250
});

packages/thirdweb/src/react/core/hooks/useStepExecutor.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { useQuery } from "@tanstack/react-query";
12
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
23
import type { status as OnrampStatus } from "../../../bridge/OnrampStatus.js";
34
import { ApiError } from "../../../bridge/types/Errors.js";
@@ -9,15 +10,14 @@ import type { Status } from "../../../bridge/types/Status.js";
910
import { getCachedChain } from "../../../chains/utils.js";
1011
import type { ThirdwebClient } from "../../../client/client.js";
1112
import { waitForReceipt } from "../../../transaction/actions/wait-for-tx-receipt.js";
13+
import { stringify } from "../../../utils/json.js";
1214
import type { Account, Wallet } from "../../../wallets/interfaces/wallet.js";
1315
import type { WindowAdapter } from "../adapters/WindowAdapter.js";
1416
import {
15-
useBridgePrepare,
1617
type BridgePrepareRequest,
1718
type BridgePrepareResult,
19+
useBridgePrepare,
1820
} from "./useBridgePrepare.js";
19-
import { useQuery } from "@tanstack/react-query";
20-
import { stringify } from "../../../utils/json.js";
2121

2222
/**
2323
* Type for completed status results from Bridge.status and Onramp.status
@@ -27,14 +27,14 @@ export type CompletedStatusResult =
2727
| ({ type: "sell" } & Extract<Status, { status: "COMPLETED" }>)
2828
| ({ type: "transfer" } & Extract<Status, { status: "COMPLETED" }>)
2929
| ({ type: "onramp" } & Extract<
30-
OnrampStatus.Result,
31-
{ status: "COMPLETED" }
32-
>);
30+
OnrampStatus.Result,
31+
{ status: "COMPLETED" }
32+
>);
3333

3434
/**
3535
* Options for the step executor hook
3636
*/
37-
export interface StepExecutorOptions {
37+
interface StepExecutorOptions {
3838
/** Prepared quote returned by Bridge.prepare */
3939
request: BridgePrepareRequest;
4040
/** Wallet instance providing getAccount() & sendTransaction */
@@ -52,7 +52,7 @@ export interface StepExecutorOptions {
5252
/**
5353
* Internal flattened transaction type
5454
*/
55-
export interface FlattenedTx extends RouteTransaction {
55+
interface FlattenedTx extends RouteTransaction {
5656
/** Index in flat array */
5757
_index: number;
5858
/** Parent step index */
@@ -62,7 +62,7 @@ export interface FlattenedTx extends RouteTransaction {
6262
/**
6363
* Public return type of useStepExecutor
6464
*/
65-
export interface StepExecutorResult {
65+
interface StepExecutorResult {
6666
currentStep?: RouteStep;
6767
currentTxIndex?: number;
6868
progress: number; // 0–100

packages/thirdweb/src/react/core/hooks/useTransactionDetails.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
} from "../../web/ui/ConnectWallet/screens/formatTokenBalance.js";
2121
import { useChainMetadata } from "./others/useChainQuery.js";
2222

23-
export interface TransactionDetails {
23+
interface TransactionDetails {
2424
contractMetadata: CompilerMetadata | null;
2525
functionInfo: {
2626
functionName: string;
@@ -37,7 +37,7 @@ export interface TransactionDetails {
3737
totalCostWei: bigint;
3838
}
3939

40-
export interface UseTransactionDetailsOptions {
40+
interface UseTransactionDetailsOptions {
4141
transaction: PreparedTransaction;
4242
client: ThirdwebClient;
4343
}

0 commit comments

Comments
 (0)