Skip to content

Commit d7e9d0e

Browse files
authored
Merge branch 'main' into crosschain-ui
2 parents c443563 + fb4d0a2 commit d7e9d0e

File tree

403 files changed

+912
-737243
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

403 files changed

+912
-737243
lines changed

.changeset/rotten-vans-sleep.md renamed to .changeset/friendly-lamps-think.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
"@thirdweb-dev/service-utils": patch
33
---
44

5-
Use a cache key that doesn't involve hashing
5+
Export usageV2 util functions

.changeset/short-carrots-smile.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@thirdweb-dev/service-utils": patch
3+
---
4+
5+
[service-utils] replace client_id with project_id in usage_v2

.vscode/settings.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,9 @@
2727
},
2828
"[css]": {
2929
"editor.defaultFormatter": "biomejs.biome"
30-
}
30+
},
31+
"eslint.workingDirectories": [
32+
{ "pattern": "./packages/*/" },
33+
{ "pattern": "./apps/*/" }
34+
]
3135
}

apps/dashboard/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
"@typescript-eslint/eslint-plugin": "7.14.1",
130130
"@typescript-eslint/parser": "7.14.1",
131131
"autoprefixer": "^10.4.19",
132-
"checkly": "^4.15.0",
132+
"checkly": "^4.18.0",
133133
"eslint": "8.57.0",
134134
"eslint-config-biome": "1.9.4",
135135
"eslint-plugin-react-compiler": "19.0.0-beta-df7b47d-20241124",

apps/dashboard/src/app/team/[team_slug]/(team)/~/projects/TeamProjectsPage.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,21 @@ export function TeamProjectsPage(props: {
9494
<div className="flex grow flex-col">
9595
{/* Filters + Add New */}
9696
<div className="flex flex-col gap-4 md:flex-row md:items-center">
97-
<SearchInput value={searchTerm} onValueChange={setSearchTerm} />
97+
<SearchInput
98+
value={searchTerm}
99+
onValueChange={(v) => {
100+
setSearchTerm(v);
101+
setPage(1);
102+
}}
103+
/>
98104
<div className="flex gap-4">
99-
<SelectBy value={sortBy} onChange={setSortBy} />
105+
<SelectBy
106+
value={sortBy}
107+
onChange={(v) => {
108+
setSortBy(v);
109+
setPage(1);
110+
}}
111+
/>
100112
<AddNewButton
101113
createProject={() => setIsCreateProjectDialogOpen(true)}
102114
teamMembersSettingsPath={`/team/${props.team.slug}/~/settings/members`}

apps/dashboard/src/components/contract-functions/interactive-abi-function.tsx

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
Input,
1515
} from "@chakra-ui/react";
1616
import { useMutation } from "@tanstack/react-query";
17-
import type { AbiFunction, AbiParameter } from "abitype";
17+
import { type AbiFunction, type AbiParameter, formatAbiItem } from "abitype";
1818
import { TransactionButton } from "components/buttons/TransactionButton";
1919
import { SolidityInput } from "contract-ui/components/solidity-inputs";
2020
import { camelToTitle } from "contract-ui/components/solidity-inputs/helpers";
@@ -28,13 +28,12 @@ import {
2828
type ThirdwebContract,
2929
prepareContractCall,
3030
readContract,
31-
resolveMethod,
3231
simulateTransaction,
3332
toSerializableTransaction,
3433
toWei,
3534
} from "thirdweb";
3635
import { useActiveAccount, useSendAndConfirmTransaction } from "thirdweb/react";
37-
import { parseAbiParams, stringify } from "thirdweb/utils";
36+
import { parseAbiParams, stringify, toFunctionSelector } from "thirdweb/utils";
3837
import {
3938
Button,
4039
Card,
@@ -135,7 +134,12 @@ interface InteractiveAbiFunctionProps {
135134
twAccount: Account | undefined;
136135
}
137136

138-
function useAsyncRead(contract: ThirdwebContract, functionName: string) {
137+
function useAsyncRead(contract: ThirdwebContract, abiFunction: AbiFunction) {
138+
const formattedAbi = formatAbiItem({
139+
...abiFunction,
140+
type: "function",
141+
// biome-ignore lint/suspicious/noExplicitAny: FIXME
142+
} as any);
139143
return useMutation({
140144
mutationFn: async ({
141145
args,
@@ -144,7 +148,8 @@ function useAsyncRead(contract: ThirdwebContract, functionName: string) {
144148
const params = parseAbiParams(types, args);
145149
return readContract({
146150
contract,
147-
method: resolveMethod(functionName),
151+
// biome-ignore lint/suspicious/noExplicitAny: dynamic typing
152+
method: formattedAbi as any,
148153
params,
149154
});
150155
},
@@ -156,21 +161,32 @@ function useSimulateTransaction() {
156161
return useMutation({
157162
mutationFn: async ({
158163
contract,
159-
functionName,
164+
abiFunction,
160165
params,
161166
value,
162167
}: {
163168
contract: ThirdwebContract;
164-
functionName: string;
169+
abiFunction: AbiFunction;
165170
params: unknown[];
166171
value?: bigint;
167172
}) => {
168173
if (!from) {
169174
return toast.error("No account connected");
170175
}
176+
const formattedAbi = formatAbiItem({
177+
...abiFunction,
178+
type: "function",
179+
// biome-ignore lint/suspicious/noExplicitAny: FIXME
180+
} as any);
181+
console.log(
182+
"formattedAbi",
183+
formattedAbi,
184+
toFunctionSelector(abiFunction),
185+
);
171186
const transaction = prepareContractCall({
172187
contract,
173-
method: resolveMethod(functionName),
188+
// biome-ignore lint/suspicious/noExplicitAny: dynamic typing
189+
method: formattedAbi as any,
174190
params,
175191
value,
176192
});
@@ -179,10 +195,16 @@ function useSimulateTransaction() {
179195
simulateTransaction({
180196
from,
181197
transaction,
198+
}).catch((e) => {
199+
console.error("Error simulating transaction", e);
200+
throw e;
182201
}),
183202
toSerializableTransaction({
184203
from,
185204
transaction,
205+
}).catch((e) => {
206+
console.error("Error serializing transaction", e);
207+
throw e;
186208
}),
187209
]);
188210
return `--- ✅ Simulation succeeded ---
@@ -257,7 +279,7 @@ export const InteractiveAbiFunction: React.FC<InteractiveAbiFunctionProps> = (
257279
data: readData,
258280
isPending: readLoading,
259281
error: readError,
260-
} = useAsyncRead(contract, abiFunction.name);
282+
} = useAsyncRead(contract, abiFunction);
261283

262284
const txSimulation = useSimulateTransaction();
263285

@@ -311,12 +333,18 @@ export const InteractiveAbiFunction: React.FC<InteractiveAbiFunctionProps> = (
311333
if (!abiFunction.name) {
312334
return toast.error("Cannot detect function name");
313335
}
336+
const formattedAbi = formatAbiItem({
337+
...abiFunction,
338+
type: "function",
339+
// biome-ignore lint/suspicious/noExplicitAny: FIXME
340+
} as any);
314341
const types = abiFunction.inputs.map((o) => o.type);
315342
const formatted = formatContractCall(d.params);
316343
const params = parseAbiParams(types, formatted);
317344
const transaction = prepareContractCall({
318345
contract,
319-
method: resolveMethod(abiFunction.name),
346+
// biome-ignore lint/suspicious/noExplicitAny: dynamic typing
347+
method: formattedAbi as any,
320348
params,
321349
value: d.value ? toWei(d.value) : undefined,
322350
});
@@ -334,7 +362,7 @@ export const InteractiveAbiFunction: React.FC<InteractiveAbiFunctionProps> = (
334362
txSimulation.mutate({
335363
contract,
336364
params,
337-
functionName: abiFunction.name,
365+
abiFunction,
338366
value: d.value ? toWei(d.value) : undefined,
339367
});
340368
});

apps/playground-web/src/components/account-abstraction/sponsored-tx-zksync.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
"use client";
2-
32
import { useState } from "react";
43
import { getContract } from "thirdweb";
54
import { zkSyncSepolia } from "thirdweb/chains";
@@ -15,6 +14,12 @@ import { shortenHex } from "thirdweb/utils";
1514
import { THIRDWEB_CLIENT } from "../../lib/client";
1615
import { WALLETS } from "../../lib/constants";
1716

17+
// const chain = abstractTestnet;
18+
// const editionDropContract = getContract({
19+
// client: THIRDWEB_CLIENT,
20+
// address: "0x8A24a7Df38fA5fCCcFD1259e90Fb6996fDdfcADa",
21+
// chain,
22+
// });
1823
const chain = zkSyncSepolia;
1924
const editionDropContract = getContract({
2025
client: THIRDWEB_CLIENT,
@@ -83,6 +88,7 @@ export function SponsoredTxZksyncPreview() {
8388
metadata: nft?.metadata,
8489
}}
8590
onError={(error) => {
91+
console.error("error", error);
8692
alert(`Error: ${error.message}`);
8793
}}
8894
onClick={() => {

apps/playground-web/src/components/sign-in/hooks.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
"use client";
2-
32
import {
43
useActiveAccount,
54
useActiveWallet,
@@ -39,7 +38,9 @@ export function HooksPreview() {
3938
</>
4039
) : (
4140
<Button variant="default" onClick={connect}>
42-
Connect with Metamask
41+
{connectMutation.isConnecting
42+
? "Connecting..."
43+
: "Connect with Metamask"}
4344
</Button>
4445
)}
4546
</div>

apps/portal/.eslintrc.json

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,20 @@
55
"eslint:recommended",
66
"plugin:@typescript-eslint/recommended",
77
"plugin:@next/next/recommended",
8-
"plugin:storybook/recommended"
8+
"plugin:mdx/recommended",
9+
"plugin:tailwindcss/recommended"
910
],
1011
"rules": {
1112
"no-unused-vars": "off",
1213
"@typescript-eslint/no-unused-vars": "error",
1314
"@typescript-eslint/no-explicit-any": "off",
14-
"svg-jsx/camel-case-dash": "error"
15-
}
15+
"svg-jsx/camel-case-dash": "error",
16+
"tailwindcss/classnames-order": "off"
17+
},
18+
"overrides": [
19+
{
20+
"files": ["*.ts", "*.js", "*.tsx", "*.jsx"],
21+
"extends": ["biome"]
22+
}
23+
]
1624
}

apps/portal/knip.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"$schema": "https://unpkg.com/knip@5/schema.json",
3+
"next": true,
4+
"project": ["src/**"],
5+
"ignoreBinaries": ["only-allow", "biome"],
6+
"ignore": ["src/components/ui/**"],
7+
"ignoreDependencies": [
8+
"@thirdweb-dev/chains",
9+
"@thirdweb-dev/wallets",
10+
"thirdweb",
11+
"@types/mdx"
12+
],
13+
"entry": [
14+
"next.config.{js,ts,cjs,mjs}",
15+
"{instrumentation,middleware}.{js,ts}",
16+
"app/global-error.{js,jsx,ts,tsx}",
17+
"app/**/{error,layout,loading,not-found,page,template,default}.{js,jsx,ts,tsx,mdx}",
18+
"app/**/route.{js,jsx,ts,tsx}",
19+
"app/{manifest,sitemap,robots}.{js,ts}",
20+
"app/**/{icon,apple-icon}.{js,jsx,ts,tsx}",
21+
"app/**/{opengraph,twitter}-image.{js,jsx,ts,tsx}",
22+
"pages/**/*.{js,jsx,ts,tsx}",
23+
"src/{instrumentation,middleware}.{js,ts}",
24+
"src/app/global-error.{js,jsx,ts,tsx}",
25+
"src/app/**/{error,layout,loading,not-found,page,template,default}.{js,jsx,ts,tsx,mdx}",
26+
"src/app/**/route.{js,jsx,ts,tsx}",
27+
"src/app/{manifest,sitemap,robots}.{js,ts}",
28+
"src/app/**/{icon,apple-icon}.{js,jsx,ts,tsx}",
29+
"src/app/**/{opengraph,twitter}-image.{js,jsx,ts,tsx}",
30+
"src/pages/**/*.{js,jsx,ts,tsx}",
31+
"scripts/*.ts"
32+
]
33+
}

0 commit comments

Comments
 (0)