Skip to content

Commit 639b542

Browse files
[SDK] docs: Add example for shouldUpdateSessionKey function (#6491)
1 parent b5fb5dd commit 639b542

File tree

11 files changed

+155
-398
lines changed

11 files changed

+155
-398
lines changed

apps/dashboard/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"input-otp": "^1.4.1",
6868
"ioredis": "^5.6.0",
6969
"ipaddr.js": "^2.2.0",
70-
"lucide-react": "0.479.0",
70+
"lucide-react": "0.482.0",
7171
"next": "15.2.2",
7272
"next-plausible": "^3.12.4",
7373
"next-themes": "^0.4.6",
@@ -105,10 +105,10 @@
105105
},
106106
"devDependencies": {
107107
"@chakra-ui/cli": "^2.4.1",
108-
"@chromatic-com/storybook": "3.2.5",
108+
"@chromatic-com/storybook": "3.2.6",
109109
"@next/bundle-analyzer": "15.2.2",
110110
"@next/eslint-plugin-next": "15.2.2",
111-
"@playwright/test": "1.51.0",
111+
"@playwright/test": "1.51.1",
112112
"@storybook/addon-essentials": "8.6.4",
113113
"@storybook/addon-interactions": "8.6.4",
114114
"@storybook/addon-links": "8.6.4",
@@ -135,7 +135,7 @@
135135
"eslint": "8.57.0",
136136
"eslint-config-biome": "1.9.4",
137137
"eslint-plugin-react-compiler": "19.0.0-beta-40c6c23-20250301",
138-
"eslint-plugin-storybook": "0.11.4",
138+
"eslint-plugin-storybook": "0.11.6",
139139
"knip": "5.46.0",
140140
"next-sitemap": "^4.2.3",
141141
"postcss": "8.5.3",

apps/dashboard/src/@/components/ui/code/getCodeHtml.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import * as parserBabel from "prettier/plugins/babel";
2-
import * as estree from "prettier/plugins/estree";
32
import { format } from "prettier/standalone";
43
import { type BundledLanguage, codeToHtml } from "shiki";
54

@@ -21,10 +20,11 @@ export async function getCodeHtml(
2120
ignoreFormattingErrors?: boolean;
2221
},
2322
) {
23+
const estreePlugin = await import("prettier/plugins/estree");
2424
const formattedCode = isPrettierSupportedLang(lang)
2525
? await format(code, {
2626
parser: "babel-ts",
27-
plugins: [parserBabel, estree],
27+
plugins: [parserBabel, estreePlugin.default],
2828
printWidth: 60,
2929
}).catch((e) => {
3030
if (!options?.ignoreFormattingErrors) {

apps/login/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"class-variance-authority": "^0.7.1",
2525
"clsx": "^2.1.1",
2626
"jose": "6.0.10",
27-
"lucide-react": "0.479.0",
27+
"lucide-react": "0.482.0",
2828
"next": "15.2.2",
2929
"next-themes": "^0.4.6",
3030
"react": "19.0.0",

apps/playground-web/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@
3636
"class-variance-authority": "^0.7.1",
3737
"clsx": "^2.1.1",
3838
"jose": "6.0.10",
39-
"lucide-react": "0.479.0",
39+
"lucide-react": "0.482.0",
4040
"next": "15.2.2",
4141
"next-themes": "^0.4.6",
4242
"nextjs-toploader": "^1.6.12",
4343
"openapi-types": "^12.1.3",
44-
"prettier": "3.3.3",
44+
"prettier": "3.5.3",
4545
"react": "19.0.0",
4646
"react-dom": "19.0.0",
4747
"react-hook-form": "7.54.2",

apps/playground-web/src/components/code/getCodeHtml.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import * as parserBabel from "prettier/plugins/babel";
2-
import * as estree from "prettier/plugins/estree";
32
import { format } from "prettier/standalone";
43
import { type BundledLanguage, codeToHtml } from "shiki";
54

@@ -15,10 +14,12 @@ function isPrettierSupportedLang(lang: BundledLanguage) {
1514
}
1615

1716
export async function getCodeHtml(code: string, lang: BundledLanguage) {
17+
const estreePlugin = await import("prettier/plugins/estree");
18+
1819
const formattedCode = isPrettierSupportedLang(lang)
1920
? await format(code, {
2021
parser: "babel-ts",
21-
plugins: [parserBabel, estree],
22+
plugins: [parserBabel, estreePlugin.default],
2223
printWidth: 60,
2324
}).catch(() => {
2425
return code;

apps/portal/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@
3535
"flexsearch": "^0.7.43",
3636
"github-slugger": "^2.0.0",
3737
"he": "^1.2.0",
38-
"lucide-react": "0.479.0",
38+
"lucide-react": "0.482.0",
3939
"next": "15.2.2",
4040
"nextjs-toploader": "^1.6.12",
4141
"node-html-markdown": "^1.3.0",
4242
"node-html-parser": "^6.1.13",
4343
"posthog-js": "1.67.1",
44-
"prettier": "3.3.3",
44+
"prettier": "3.5.3",
4545
"react": "19.0.0",
4646
"react-dom": "19.0.0",
4747
"react-html-parser": "2.0.2",

apps/portal/src/components/Document/Code.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import "server-only";
44
import { cn } from "@/lib/utils";
55
import Link from "next/link";
66
import * as parserBabel from "prettier/plugins/babel";
7-
import * as estree from "prettier/plugins/estree";
87
// prettier
98
import { format } from "prettier/standalone";
109
import {
@@ -54,9 +53,10 @@ export async function CodeBlock(props: {
5453
// format code
5554
if (jsOrTsLangs.has(lang)) {
5655
try {
56+
const estreePlugin = await import("prettier/plugins/estree");
5757
code = await format(code, {
5858
parser: "babel-ts",
59-
plugins: [parserBabel, estree],
59+
plugins: [parserBabel, estreePlugin.default],
6060
printWidth: 70,
6161
});
6262
} catch (_e) {

apps/wallet-ui/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"class-variance-authority": "^0.7.1",
2020
"clsx": "^2.1.1",
2121
"cmdk": "^1.0.4",
22-
"lucide-react": "0.479.0",
22+
"lucide-react": "0.482.0",
2323
"next": "15.2.2",
2424
"next-themes": "^0.4.6",
2525
"react": "19.0.0",

packages/thirdweb/package.json

+21-59
Original file line numberDiff line numberDiff line change
@@ -132,63 +132,25 @@
132132
},
133133
"typesVersions": {
134134
"*": {
135-
"adapters/*": [
136-
"./dist/types/exports/adapters/*.d.ts"
137-
],
138-
"auth": [
139-
"./dist/types/exports/auth.d.ts"
140-
],
141-
"chains": [
142-
"./dist/types/exports/chains.d.ts"
143-
],
144-
"contract": [
145-
"./dist/types/exports/contract.d.ts"
146-
],
147-
"deploys": [
148-
"./dist/types/exports/deploys.d.ts"
149-
],
150-
"event": [
151-
"./dist/types/exports/event.d.ts"
152-
],
153-
"extensions/*": [
154-
"./dist/types/exports/extensions/*.d.ts"
155-
],
156-
"pay": [
157-
"./dist/types/exports/pay.d.ts"
158-
],
159-
"react": [
160-
"./dist/types/exports/react.d.ts"
161-
],
162-
"react-native": [
163-
"./dist/types/exports/react-native.d.ts"
164-
],
165-
"rpc": [
166-
"./dist/types/exports/rpc.d.ts"
167-
],
168-
"storage": [
169-
"./dist/types/exports/storage.d.ts"
170-
],
171-
"transaction": [
172-
"./dist/types/exports/transaction.d.ts"
173-
],
174-
"utils": [
175-
"./dist/types/exports/utils.d.ts"
176-
],
177-
"wallets": [
178-
"./dist/types/exports/wallets.d.ts"
179-
],
180-
"wallets/*": [
181-
"./dist/types/exports/wallets/*.d.ts"
182-
],
183-
"modules": [
184-
"./dist/types/exports/modules.d.ts"
185-
],
186-
"social": [
187-
"./dist/types/exports/social.d.ts"
188-
],
189-
"ai": [
190-
"./dist/types/exports/ai.d.ts"
191-
]
135+
"adapters/*": ["./dist/types/exports/adapters/*.d.ts"],
136+
"auth": ["./dist/types/exports/auth.d.ts"],
137+
"chains": ["./dist/types/exports/chains.d.ts"],
138+
"contract": ["./dist/types/exports/contract.d.ts"],
139+
"deploys": ["./dist/types/exports/deploys.d.ts"],
140+
"event": ["./dist/types/exports/event.d.ts"],
141+
"extensions/*": ["./dist/types/exports/extensions/*.d.ts"],
142+
"pay": ["./dist/types/exports/pay.d.ts"],
143+
"react": ["./dist/types/exports/react.d.ts"],
144+
"react-native": ["./dist/types/exports/react-native.d.ts"],
145+
"rpc": ["./dist/types/exports/rpc.d.ts"],
146+
"storage": ["./dist/types/exports/storage.d.ts"],
147+
"transaction": ["./dist/types/exports/transaction.d.ts"],
148+
"utils": ["./dist/types/exports/utils.d.ts"],
149+
"wallets": ["./dist/types/exports/wallets.d.ts"],
150+
"wallets/*": ["./dist/types/exports/wallets/*.d.ts"],
151+
"modules": ["./dist/types/exports/modules.d.ts"],
152+
"social": ["./dist/types/exports/social.d.ts"],
153+
"ai": ["./dist/types/exports/ai.d.ts"]
192154
}
193155
},
194156
"browser": {
@@ -333,7 +295,7 @@
333295
"@aws-sdk/client-lambda": "3.592.0",
334296
"@aws-sdk/credential-providers": "3.592.0",
335297
"@biomejs/biome": "1.9.4",
336-
"@chromatic-com/storybook": "3.2.5",
298+
"@chromatic-com/storybook": "3.2.6",
337299
"@codspeed/vitest-plugin": "4.0.0",
338300
"@coinbase/wallet-mobile-sdk": "1.1.2",
339301
"@mobile-wallet-protocol/client": "0.1.2",
@@ -363,7 +325,7 @@
363325
"happy-dom": "17.1.8",
364326
"knip": "5.46.0",
365327
"msw": "2.7.3",
366-
"prettier": "3.3.3",
328+
"prettier": "3.5.3",
367329
"react": "19.0.0",
368330
"react-dom": "19.0.0",
369331
"react-native": "0.76.6",

packages/thirdweb/src/extensions/erc4337/account/addSessionKey.ts

+7
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,13 @@ export function isAddSessionKeySupported(availableSelectors: string[]) {
9797
* @param currentPermissions - The current permissions of the session key.
9898
* @param newPermissions - The new permissions to set for the session key.
9999
* @returns A boolean indicating if the session key should be updated.
100+
* @extension ERC4337
101+
* @example
102+
* ```ts
103+
* import { shouldUpdateSessionKey } from "thirdweb/extensions/erc4337";
104+
*
105+
* const shouldUpdate = await shouldUpdateSessionKey({ accountContract, sessionKeyAddress, newPermissions });
106+
* ```
100107
*/
101108
export async function shouldUpdateSessionKey(args: {
102109
accountContract: ThirdwebContract;

0 commit comments

Comments
 (0)