@meddleware/walrus-storage-ui 0.0.0-stage → 0.1.63

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/wallet.ts ADDED
@@ -0,0 +1,47 @@
1
+ // Thin walrus-storage-ui shim over the shared @meddleware/wallet-adapter singleton.
2
+ //
3
+ // RPC URL is resolved from the runtime useNetwork() singleton so network switching
4
+ // in the dashboard propagates immediately to all tool views. Because the adapter is a
5
+ // module singleton, the wallet connection is shared with any other tool view rendered
6
+ // in the same window (e.g. the dashboard).
7
+ import {
8
+ useWallet as useWalletBase,
9
+ getSuiClient as getSuiClientBase,
10
+ buildExecutor as buildExecutorBase,
11
+ useNetwork,
12
+ } from '@meddleware/wallet-adapter'
13
+ import type { Executor } from '@meddleware/wallet-adapter'
14
+
15
+ export type { Executor }
16
+
17
+ const { network, rpcUrl } = useNetwork()
18
+
19
+ /** Memoised Sui gRPC client for the currently selected network. */
20
+ export function getSuiClient() {
21
+ return getSuiClientBase(network.value, rpcUrl.value)
22
+ }
23
+
24
+ /** Build a transaction executor bound to the connected wallet and current network RPC URL. */
25
+ export function buildExecutor(): Promise<Executor> {
26
+ return buildExecutorBase(network.value, rpcUrl.value)
27
+ }
28
+
29
+ /**
30
+ * Wallet composable bound to walrus-storage-ui's network config. Delegates to the shared adapter
31
+ * singleton; walrus needs `sui:signTransaction` (upload certify) so it's requested for discovery.
32
+ */
33
+ export function useWallet() {
34
+ const base = useWalletBase({ requiredFeatures: ['sui:signTransaction'] })
35
+ return {
36
+ wallets: base.wallets,
37
+ currentWallet: base.currentWallet,
38
+ account: base.account,
39
+ connecting: base.connecting,
40
+ error: base.error,
41
+ connect: base.connect,
42
+ disconnect: base.disconnect,
43
+ signPersonalMessage: base.signPersonalMessage,
44
+ getSuiClient,
45
+ buildExecutor,
46
+ }
47
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ESNext",
4
+ "module": "ESNext",
5
+ "moduleResolution": "Bundler",
6
+ "lib": ["ESNext", "DOM", "DOM.Iterable"],
7
+ "strict": true,
8
+ "esModuleInterop": true,
9
+ "skipLibCheck": true,
10
+ "resolveJsonModule": true,
11
+ "isolatedModules": true,
12
+ "verbatimModuleSyntax": true,
13
+ "jsx": "preserve",
14
+ "types": ["node"],
15
+ "noEmit": true
16
+ },
17
+ "include": ["src/**/*.ts", "src/**/*.vue", "src/**/*.d.ts", "vite.config.ts", "playwright.config.ts", "e2e/**/*.ts"]
18
+ }
package/vite.config.ts ADDED
@@ -0,0 +1,13 @@
1
+ import { defineConfig } from 'vite'
2
+ import vue from '@vitejs/plugin-vue'
3
+
4
+ // design-tokens and ui resolve from node_modules (published packages).
5
+ // @mysten/walrus is excluded from dep-optimization so its wasm `?url` import resolves.
6
+ export default defineConfig({
7
+ plugins: [vue()],
8
+ optimizeDeps: {
9
+ // @meddleware/wallet-adapter ships TS + .vue source and holds the shared wallet singleton; if it
10
+ // were pre-bundled, its .vue files (served raw) would load a second copy of the singleton in dev.
11
+ exclude: ['@mysten/walrus', '@mysten/walrus-wasm', '@meddleware/wallet-adapter'],
12
+ },
13
+ })