Skip to content

Commit bc80e68

Browse files
WIP: feat: solana devtools (#40)
* feat: debugger -> devtools * nit: clean up panel animations * feat: persistant storage, fix events * feat: add explorer program transaction parsing * nit: icons * chore: greptile nits + formatting
1 parent bf101db commit bc80e68

Some content is hidden

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

61 files changed

+4905
-9476
lines changed

README.md

Lines changed: 60 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ Production-ready Solana wallet infrastructure. A headless, framework-agnostic wa
77

88
## Packages
99

10-
| Package | Description |
11-
| ------------------------------------------------- | -------------------------------------------------------------------- |
12-
| [@solana/connector](./packages/connector) | Core wallet connector with React hooks and headless client |
13-
| [@solana/connector-debugger](./packages/debugger) | Development debug panel with transaction analysis (experimental wip) |
10+
| Package | Description |
11+
| ----------------------------------------- | ---------------------------------------------------------- |
12+
| [@solana/connector](./packages/connector) | Core wallet connector with React hooks and headless client |
13+
| [@solana/devtools](./packages/devtools) | Framework-agnostic devtools with transaction tracking |
1414

1515
## Why ConnectorKit?
1616

@@ -72,28 +72,72 @@ function WalletButton() {
7272

7373
See the [connector package docs](./packages/connector/README.md) for full API reference.
7474

75-
## Debug Panel (Development)
75+
## Devtools (Development)
76+
77+
Framework-agnostic devtools that work with any web framework via the imperative DOM API.
7678

7779
```bash
78-
npm install @solana/connector-debugger
80+
npm install @solana/devtools
7981
```
8082

8183
```typescript
82-
import { ConnectorDebugPanel } from '@solana/connector-debugger/react';
84+
import { ConnectorDevtools } from '@solana/devtools';
85+
86+
// Create devtools (auto-detects window.__connectorClient from ConnectorProvider)
87+
const devtools = new ConnectorDevtools({
88+
config: {
89+
position: 'bottom-right',
90+
theme: 'dark',
91+
},
92+
});
93+
94+
// Mount to DOM
95+
const container = document.createElement('div');
96+
document.body.appendChild(container);
97+
devtools.mount(container);
98+
99+
// Later, to cleanup
100+
devtools.unmount();
101+
```
102+
103+
### Next.js Integration
104+
105+
```tsx
106+
'use client';
107+
108+
import { useEffect } from 'react';
83109

84-
// Add to your app (development only)
85-
{process.env.NODE_ENV === 'development' && <ConnectorDebugPanel />}
110+
export function DevtoolsLoader() {
111+
useEffect(() => {
112+
if (process.env.NODE_ENV !== 'development') return;
113+
114+
let devtools: any;
115+
let container: HTMLDivElement;
116+
117+
import('@solana/devtools').then(({ ConnectorDevtools }) => {
118+
container = document.createElement('div');
119+
document.body.appendChild(container);
120+
devtools = new ConnectorDevtools();
121+
devtools.mount(container);
122+
});
123+
124+
return () => {
125+
devtools?.unmount();
126+
container?.remove();
127+
};
128+
}, []);
129+
130+
return null;
131+
}
86132
```
87133

88-
Features:
134+
### Features
89135

90-
- Live wallet state monitoring
91-
- Pre-flight transaction simulation
92-
- Transaction size analysis with optimization suggestions
93-
- Address Lookup Table recommendations
94-
- Real-time event stream
136+
- **Overview Tab** - Connection state, wallet info, cluster, health metrics
137+
- **Events Tab** - Real-time event stream with filtering and pause/resume
138+
- **Transactions Tab** - Transaction tracking with automatic status polling
95139

96-
See the [debugger package docs](./packages/debugger/README.md) for full documentation.
140+
See the [devtools package docs](./packages/devtools/README.md) for full documentation.
97141

98142
## Examples
99143

examples/next-js/app/providers.tsx

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use client';
22

33
import type { ReactNode } from 'react';
4-
import { useMemo } from 'react';
4+
import { useEffect, useMemo } from 'react';
55
import { AppProvider, getDefaultConfig, getDefaultMobileConfig } from '@solana/connector/react';
66
import { createRemoteSignerWallet } from '@solana/connector/remote';
77

@@ -84,6 +84,39 @@ export function Providers({ children }: { children: ReactNode }) {
8484
[],
8585
);
8686

87+
// Mount devtools in development mode
88+
useEffect(() => {
89+
if (process.env.NODE_ENV !== 'development') return;
90+
91+
let devtools: { mount: (el: HTMLElement) => void; unmount: () => void } | undefined;
92+
let container: HTMLDivElement | undefined;
93+
94+
// Dynamic import to avoid bundling in production
95+
import('@solana/devtools').then(({ ConnectorDevtools }) => {
96+
// Create container for devtools
97+
container = document.createElement('div');
98+
container.id = 'connector-devtools-container';
99+
document.body.appendChild(container);
100+
101+
// Create and mount devtools (auto-detects window.__connectorClient)
102+
devtools = new ConnectorDevtools({
103+
config: {
104+
position: 'bottom-right',
105+
theme: 'dark',
106+
defaultOpen: false,
107+
rpcUrl: process.env.NEXT_PUBLIC_RPC_URL,
108+
},
109+
});
110+
devtools.mount(container);
111+
});
112+
113+
// Cleanup on unmount
114+
return () => {
115+
devtools?.unmount();
116+
container?.remove();
117+
};
118+
}, []);
119+
87120
return (
88121
<AppProvider connectorConfig={connectorConfig} mobile={mobile}>
89122
{children}

examples/next-js/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"@radix-ui/react-tabs": "^1.1.12",
2121
"@solana-program/system": "^0.7.0",
2222
"@solana/connector": "workspace:*",
23-
"@solana/connector-debugger": "workspace:*",
23+
"@solana/devtools": "workspace:*",
2424
"@solana/keychain": "^0.2.1",
2525
"@solana/kit": "^5.0.0",
2626
"@solana/web3.js": "^1.98.4",

0 commit comments

Comments
 (0)