Skip to content

Commit fed49bd

Browse files
committed
Add top level transaction status to transaction response (#702)
* Add top level transaction status to transaction response update examples and docs add transaction result type * pr feedback * fix broken test * update create-dapp (#703) * update create-dapp Add codegen docs * PR feedback
1 parent 02fa92c commit fed49bd

File tree

121 files changed

+3323
-1461
lines changed

Some content is hidden

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

121 files changed

+3323
-1461
lines changed

.changeset/update-create-dapp.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
'@mysten/create-dapp': minor
3+
---
4+
5+
Update create-dapp templates:
6+
7+
- Migrate from `@mysten/dapp-kit` to `@mysten/dapp-kit-react`
8+
- Upgrade React to version 19.2.1
9+
- Remove forwardRef usage in favor of React 19 ref prop pattern
10+
- Add TypeScript code generation support using `@mysten/codegen`
11+
- Update UI components to use shadcn/ui-style card and button components
12+
- Update to Tailwind CSS v4
13+
- Update example code to use gRPC client and new SDK patterns
14+
- Fix transaction result handling to properly unwrap TransactionResult types
15+
- Add documentation and setup guides
16+
- Fix dependency injection for devDependencies

.oxlintrc.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"packages/payment-kit/src/contracts",
3131
"generated",
3232
"vite-env.d.ts",
33+
"vitest.config.*",
3334
".git",
3435
"packages/suins/examples",
3536
"packages/deepbook-v3/examples",
@@ -51,6 +52,17 @@
5152
"typescript/no-non-null-asserted-optional-chain": "off",
5253
"@typescript-eslint/no-redundant-type-constituents": "off",
5354
"@typescript-eslint/restrict-template-expressions": "off",
54-
"@typescript-eslint/unbound-method": "off"
55+
"@typescript-eslint/unbound-method": "off",
56+
"import/extensions": [
57+
"error",
58+
"always",
59+
{
60+
"ignorePackages": true,
61+
"js": "always",
62+
"ts": "always",
63+
"jsx": "always",
64+
"tsx": "always"
65+
}
66+
]
5567
}
5668
}

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ yarn-debug.log*
1111
.next/
1212
.source/
1313
.swc/
14+
.claude
1415
build/
1516
coverage/
1617
dist/

packages/create-dapp/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
"typescript": "^5.9.3"
3939
},
4040
"dependencies": {
41-
"@mysten/dapp-kit": "workspace:*",
41+
"@mysten/codegen": "workspace:*",
42+
"@mysten/dapp-kit-react": "workspace:*",
4243
"@mysten/sui": "workspace:*",
4344
"@types/node": "^24.10.1",
4445
"enquirer": "^2.4.1"

packages/create-dapp/src/index.ts

Lines changed: 58 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -14,47 +14,62 @@ const { values: args } = parseArgs({
1414
default: '',
1515
short: 't',
1616
},
17+
name: {
18+
type: 'string',
19+
default: '',
20+
short: 'n',
21+
},
1722
},
1823
});
1924

2025
async function main() {
21-
const results = await prompt<{
22-
template: string;
23-
dAppName: string;
24-
}>(
25-
[
26-
{
27-
type: 'select',
28-
name: 'template',
29-
message: 'Which starter template would you like to use?',
30-
choices: [
31-
{
32-
name: 'react-client-dapp',
33-
hint: 'React Client dApp that reads data from wallet and the blockchain',
34-
},
35-
{
36-
name: 'react-e2e-counter',
37-
hint: 'React dApp with a move smart contract that implements a distributed counter',
38-
},
39-
],
40-
},
41-
{
42-
type: 'input',
43-
44-
name: 'dAppName',
45-
message: 'What is the name of your dApp? (this will be used as the directory name)',
46-
initial: 'my-first-sui-dapp',
47-
},
48-
].filter((question) => !args[question.name as 'template']),
49-
);
50-
51-
const outDir = resolve(process.cwd(), results.dAppName);
26+
const questions = [
27+
{
28+
type: 'select',
29+
name: 'template',
30+
message: 'Which starter template would you like to use?',
31+
choices: [
32+
{
33+
name: 'react-client-dapp',
34+
hint: 'React Client dApp that reads data from wallet and the blockchain',
35+
},
36+
{
37+
name: 'react-e2e-counter',
38+
hint: 'React dApp with a move smart contract that implements a distributed counter',
39+
},
40+
],
41+
},
42+
{
43+
type: 'input',
44+
name: 'dAppName',
45+
message: 'What is the name of your dApp? (this will be used as the directory name)',
46+
initial: 'my-first-sui-dapp',
47+
},
48+
].filter((question) => {
49+
if (question.name === 'template' && args.template) return false;
50+
if (question.name === 'dAppName' && args.name) return false;
51+
return true;
52+
});
53+
54+
const results =
55+
questions.length > 0
56+
? await prompt<{ template?: string; dAppName?: string }>(questions)
57+
: { template: undefined, dAppName: undefined };
58+
59+
const template = results.template ?? args.template;
60+
const dAppName = results.dAppName ?? args.name;
61+
62+
if (!template || !dAppName) {
63+
throw new Error('Template and name are required');
64+
}
65+
66+
const outDir = resolve(process.cwd(), dAppName);
5267

5368
if (existsSync(outDir)) {
5469
throw new Error(`Directory ${outDir} already exists`);
5570
}
5671

57-
const files = await collectFiles(results.template ?? args.template, results.dAppName);
72+
const files = await collectFiles(template, dAppName);
5873
await writeFiles(files, outDir);
5974
}
6075

@@ -94,8 +109,17 @@ async function collectFiles(template: string, dAppName: string) {
94109
if (entry === 'package.json') {
95110
const json = JSON.parse(content.toString());
96111
json.name = dAppName;
97-
json.dependencies['@mysten/sui'] = dependencies['@mysten/sui'];
98-
json.dependencies['@mysten/dapp-kit'] = dependencies['@mysten/dapp-kit'];
112+
113+
if (json.dependencies?.['@mysten/sui']) {
114+
json.dependencies['@mysten/sui'] = dependencies['@mysten/sui'];
115+
}
116+
if (json.dependencies?.['@mysten/dapp-kit-react']) {
117+
json.dependencies['@mysten/dapp-kit-react'] = dependencies['@mysten/dapp-kit-react'];
118+
}
119+
120+
if (json.devDependencies?.['@mysten/codegen']) {
121+
json.devDependencies['@mysten/codegen'] = dependencies['@mysten/codegen'];
122+
}
99123

100124
content = Buffer.from(JSON.stringify(json, null, 2));
101125
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"rules": {
3+
"import/extensions": "off"
4+
}
5+
}

packages/create-dapp/templates/react-client-dapp/README.md

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,25 @@ Client dApp using the following tools:
66
- [React](https://react.dev/) as the UI framework
77
- [TypeScript](https://www.typescriptlang.org/) for type checking
88
- [Vite](https://vitejs.dev/) for build tooling
9-
- [Radix UI](https://www.radix-ui.com/) for pre-built UI components
10-
- [`@mysten/dapp-kit`](https://sdk.mystenlabs.com/dapp-kit) for connecting to
11-
wallets and loading data
9+
- [Tailwind CSS v4](https://tailwindcss.com/) for styling
10+
- [Lucide React](https://lucide.dev/) for icons
11+
- [`@mysten/dapp-kit-react`](https://sdk.mystenlabs.com/dapp-kit) for connecting
12+
to wallets and loading data
1213
- [pnpm](https://pnpm.io/) for package management
1314

15+
## Project Structure
16+
17+
```
18+
src/
19+
├── components/ui/ # Reusable UI components (Card)
20+
├── lib/utils.ts # Utility functions (cn for classnames)
21+
├── App.tsx # Main application component
22+
├── WalletStatus.tsx # Wallet connection status display
23+
├── OwnedObjects.tsx # Display objects owned by connected wallet
24+
├── dApp-kit.ts # dApp Kit configuration
25+
└── index.css # Tailwind CSS with theme variables
26+
```
27+
1428
## Starting your dApp
1529

1630
To install dependencies you can run
@@ -32,3 +46,17 @@ To build your app for deployment you can run
3246
```bash
3347
pnpm build
3448
```
49+
50+
## Customizing the UI
51+
52+
This template uses [Tailwind CSS v4](https://tailwindcss.com/docs) for styling
53+
with [shadcn/ui](https://ui.shadcn.com/)-style components. The UI components in
54+
`src/components/ui/` are based on shadcn/ui patterns and can be customized or
55+
extended.
56+
57+
To add more shadcn/ui components, you can copy them from the
58+
[shadcn/ui components](https://ui.shadcn.com/docs/components) documentation and
59+
adapt them to work with your project.
60+
61+
Theme variables are defined in `src/index.css` using Tailwind's `@theme`
62+
directive.

packages/create-dapp/templates/react-client-dapp/index.html

Lines changed: 2 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,12 @@
11
<!doctype html>
2-
<html lang="en" class="dark-theme" style="color-scheme: dark">
2+
<html lang="en">
33
<head>
44
<meta charset="UTF-8" />
55
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
66
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
77
<title>Sui dApp Starter</title>
8-
9-
<style>
10-
/*
11-
Josh's Custom CSS Reset
12-
https://www.joshwcomeau.com/css/custom-css-reset/
13-
*/
14-
*,
15-
*::before,
16-
*::after {
17-
box-sizing: border-box;
18-
}
19-
* {
20-
margin: 0;
21-
}
22-
body {
23-
line-height: 1.5;
24-
-webkit-font-smoothing: antialiased;
25-
}
26-
img,
27-
picture,
28-
video,
29-
canvas,
30-
svg {
31-
display: block;
32-
max-width: 100%;
33-
}
34-
input,
35-
button,
36-
textarea,
37-
select {
38-
font: inherit;
39-
}
40-
p,
41-
h1,
42-
h2,
43-
h3,
44-
h4,
45-
h5,
46-
h6 {
47-
overflow-wrap: break-word;
48-
}
49-
#root,
50-
#__next {
51-
isolation: isolate;
52-
}
53-
</style>
548
</head>
55-
<body>
9+
<body class="min-h-screen antialiased">
5610
<div id="root"></div>
5711
<script type="module" src="/src/main.tsx"></script>
5812
</body>

packages/create-dapp/templates/react-client-dapp/package.json

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,23 @@
99
"preview": "vite preview"
1010
},
1111
"dependencies": {
12-
"@mysten/dapp-kit": "workspace:*",
12+
"@mysten/dapp-kit-react": "workspace:*",
1313
"@mysten/sui": "workspace:*",
14-
"@radix-ui/colors": "^3.0.0",
15-
"@radix-ui/react-icons": "^1.3.0",
16-
"@radix-ui/themes": "^3.2.1",
14+
"@nanostores/react": "^1.0.0",
1715
"@tanstack/react-query": "^5.90.11",
16+
"clsx": "^2.1.1",
17+
"lucide-react": "^0.468.0",
1818
"react": "^19.2.1",
19-
"react-dom": "^19.2.1"
19+
"react-dom": "^19.2.1",
20+
"tailwind-merge": "^2.6.0"
2021
},
2122
"devDependencies": {
23+
"@tailwindcss/vite": "^4.0.0",
2224
"@types/react": "^19.2.7",
2325
"@types/react-dom": "^19.2.3",
2426
"@vitejs/plugin-react-swc": "^4.2.2",
2527
"prettier": "^3.7.3",
28+
"tailwindcss": "^4.0.0",
2629
"typescript": "^5.9.3",
2730
"vite": "^7.2.6"
2831
}

packages/create-dapp/templates/react-client-dapp/src/App.tsx

Lines changed: 12 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,20 @@
1-
import { ConnectButton } from "@mysten/dapp-kit";
2-
import { Box, Container, Flex, Heading } from "@radix-ui/themes";
1+
import { ConnectButton } from "@mysten/dapp-kit-react";
32
import { WalletStatus } from "./WalletStatus";
43

54
function App() {
65
return (
7-
<>
8-
<Flex
9-
position="sticky"
10-
px="4"
11-
py="2"
12-
justify="between"
13-
style={{
14-
borderBottom: "1px solid var(--gray-a2)",
15-
}}
16-
>
17-
<Box>
18-
<Heading>dApp Starter Template</Heading>
19-
</Box>
20-
21-
<Box>
6+
<div className="min-h-screen">
7+
<header className="sticky top-0 z-50 border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60">
8+
<div className="container mx-auto flex h-14 items-center justify-between px-4">
9+
<h1 className="text-lg font-semibold">Sui dApp Starter</h1>
2210
<ConnectButton />
23-
</Box>
24-
</Flex>
25-
<Container>
26-
<Container
27-
mt="5"
28-
pt="2"
29-
px="4"
30-
style={{ background: "var(--gray-a2)", minHeight: 500 }}
31-
>
32-
<WalletStatus />
33-
</Container>
34-
</Container>
35-
</>
11+
</div>
12+
</header>
13+
14+
<main className="container mx-auto px-4 py-8">
15+
<WalletStatus />
16+
</main>
17+
</div>
3618
);
3719
}
3820

0 commit comments

Comments
 (0)