@meddleware/walrus-ui 0.1.4 → 0.1.6
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/package.json +7 -7
- package/src/components/MyBlobs.vue +3 -3
- package/src/components/WalrusView.vue +29 -50
- package/src/config.ts +4 -4
- package/tsconfig.json +1 -1
- package/vite.config.ts +7 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meddleware/walrus-ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "Standalone Vue 3 SPA for uploading blobs to Walrus decentralised storage and managing owned blobs — wallet-connected, NFT-gated relay support.",
|
|
5
5
|
"author": "Meddleware <dev@meddleware.co.uk>",
|
|
6
6
|
"license": "0BSD",
|
|
@@ -41,13 +41,13 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@meddleware/design-tokens": "^0.1.2",
|
|
44
|
-
"@meddleware/nft-gate-client": "^0.0.
|
|
44
|
+
"@meddleware/nft-gate-client": "^0.0.6",
|
|
45
45
|
"@meddleware/ui": "^0.1.6",
|
|
46
|
-
"@meddleware/wallet-adapter": "^0.0.
|
|
47
|
-
"@meddleware/walrus-client": "^0.0.
|
|
48
|
-
"@meddleware/walrus-relay": "^0.1.
|
|
49
|
-
"@mysten/sui": "
|
|
50
|
-
"@mysten/wallet-standard": "
|
|
46
|
+
"@meddleware/wallet-adapter": "^0.0.3",
|
|
47
|
+
"@meddleware/walrus-client": "^0.0.5",
|
|
48
|
+
"@meddleware/walrus-relay": "^0.1.3",
|
|
49
|
+
"@mysten/sui": "^2.28.0",
|
|
50
|
+
"@mysten/wallet-standard": "^0.20.0",
|
|
51
51
|
"@mysten/walrus": "~1.1.7",
|
|
52
52
|
"@mysten/walrus-wasm": "~0.2.2",
|
|
53
53
|
"vue": "^3.5.40"
|
|
@@ -40,11 +40,11 @@ async function loadBlobs(): Promise<void> {
|
|
|
40
40
|
const suiClient = getSuiClient(NETWORK)
|
|
41
41
|
const walrusClient = createWalrusClient({ network: NETWORK, wasmUrl: walrusWasmUrl })
|
|
42
42
|
const [sys, fetched] = await Promise.all([
|
|
43
|
-
suiClient.
|
|
43
|
+
suiClient.getCurrentSystemState(),
|
|
44
44
|
fetchOwnedWalrusBlobs(suiClient, walrusClient, props.address),
|
|
45
45
|
])
|
|
46
|
-
currentEpoch.value = Number(sys.epoch)
|
|
47
|
-
blobs.value = fetched.sort((a, b) => a.endEpoch - b.endEpoch)
|
|
46
|
+
currentEpoch.value = Number(sys.systemState.epoch)
|
|
47
|
+
blobs.value = fetched.sort((a: OwnedBlob, b: OwnedBlob) => a.endEpoch - b.endEpoch)
|
|
48
48
|
} catch (e) {
|
|
49
49
|
error.value = e instanceof Error ? e.message : String(e)
|
|
50
50
|
} finally {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Rendered standalone by walrus-ui's App.vue and inline by the dashboard. Wallet state comes
|
|
4
4
|
// from the shared @meddleware/wallet-adapter singleton (via ./wallet.js), so connecting here or
|
|
5
5
|
// in any other inline tool view reflects everywhere.
|
|
6
|
-
import { ref } from 'vue'
|
|
6
|
+
import { ref, watch } from 'vue'
|
|
7
7
|
import {
|
|
8
8
|
WalrusUpload,
|
|
9
9
|
AccessGateCta,
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
import type { UploadResult } from '@meddleware/walrus-relay'
|
|
14
14
|
// Lightweight URL import — just the wasm asset URL (does not pull the walrus client).
|
|
15
15
|
import walrusWasmUrl from '@mysten/walrus-wasm/web/walrus_wasm_bg.wasm?url'
|
|
16
|
+
import { WalletGuard } from '@meddleware/wallet-adapter'
|
|
16
17
|
import { useWallet, getSuiClient } from '../wallet.js'
|
|
17
18
|
import { NETWORK, relayHosts, accessGate, uploadRelayMaxTipMist } from '../config.js'
|
|
18
19
|
import { runBlobUpload } from '../upload-flow.js'
|
|
@@ -21,20 +22,20 @@ import MyBlobs from './MyBlobs.vue'
|
|
|
21
22
|
type Tab = 'upload' | 'blobs'
|
|
22
23
|
const activeTab = ref<Tab>('upload')
|
|
23
24
|
|
|
24
|
-
const {
|
|
25
|
+
const { account, signPersonalMessage, buildExecutor } = useWallet()
|
|
25
26
|
|
|
26
27
|
const gate = accessGate(NETWORK)
|
|
27
28
|
const gateState = useAccessGate({ gate, getClient: () => getSuiClient(NETWORK) })
|
|
28
29
|
const purchasing = ref(false)
|
|
29
30
|
const result = ref<UploadResult | null>(null)
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
32
|
+
// Check gate ownership whenever the connected account changes (handles connect, reconnect,
|
|
33
|
+
// and disconnect without needing a manual trigger from the connect button).
|
|
34
|
+
watch(
|
|
35
|
+
() => account.value?.address ?? null,
|
|
36
|
+
(addr) => { if (addr && gate) void gateState.checkOwnership(addr) },
|
|
37
|
+
{ immediate: true },
|
|
38
|
+
)
|
|
38
39
|
|
|
39
40
|
async function onPurchase(): Promise<void> {
|
|
40
41
|
if (!account.value) return
|
|
@@ -91,36 +92,25 @@ function onUploaded(r: UploadResult): void {
|
|
|
91
92
|
<div class="page">
|
|
92
93
|
<p class="sub">Upload and manage blobs on Walrus decentralised storage ({{ NETWORK }}).</p>
|
|
93
94
|
|
|
94
|
-
<
|
|
95
|
-
<
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
<button
|
|
104
|
-
type="button"
|
|
105
|
-
class="tab"
|
|
106
|
-
:class="{ active: activeTab === 'blobs' }"
|
|
107
|
-
@click="activeTab = 'blobs'"
|
|
108
|
-
>
|
|
109
|
-
My Blobs
|
|
110
|
-
</button>
|
|
111
|
-
</nav>
|
|
112
|
-
|
|
113
|
-
<section class="wallet">
|
|
114
|
-
<template v-if="account">
|
|
115
|
-
<span class="addr">{{ account.address.slice(0, 8) }}…{{ account.address.slice(-4) }}</span>
|
|
116
|
-
<button type="button" @click="disconnect">Disconnect</button>
|
|
117
|
-
</template>
|
|
118
|
-
<template v-else>
|
|
119
|
-
<button type="button" :disabled="!wallets.length" @click="onConnectFirst">
|
|
120
|
-
{{ wallets.length ? 'Connect wallet' : 'No wallet detected' }}
|
|
95
|
+
<WalletGuard message="Connect a Sui wallet to upload and manage your blobs.">
|
|
96
|
+
<nav class="tabs" aria-label="Feature tabs">
|
|
97
|
+
<button
|
|
98
|
+
type="button"
|
|
99
|
+
class="tab"
|
|
100
|
+
:class="{ active: activeTab === 'upload' }"
|
|
101
|
+
@click="activeTab = 'upload'"
|
|
102
|
+
>
|
|
103
|
+
Upload
|
|
121
104
|
</button>
|
|
122
|
-
|
|
123
|
-
|
|
105
|
+
<button
|
|
106
|
+
type="button"
|
|
107
|
+
class="tab"
|
|
108
|
+
:class="{ active: activeTab === 'blobs' }"
|
|
109
|
+
@click="activeTab = 'blobs'"
|
|
110
|
+
>
|
|
111
|
+
My Blobs
|
|
112
|
+
</button>
|
|
113
|
+
</nav>
|
|
124
114
|
|
|
125
115
|
<template v-if="activeTab === 'upload'">
|
|
126
116
|
<AccessGateCta
|
|
@@ -155,6 +145,7 @@ function onUploaded(r: UploadResult): void {
|
|
|
155
145
|
:address="account?.address ?? null"
|
|
156
146
|
:build-executor="() => buildExecutor(NETWORK)"
|
|
157
147
|
/>
|
|
148
|
+
</WalletGuard>
|
|
158
149
|
</div>
|
|
159
150
|
</template>
|
|
160
151
|
|
|
@@ -171,18 +162,6 @@ function onUploaded(r: UploadResult): void {
|
|
|
171
162
|
margin: 0.25rem 0 0;
|
|
172
163
|
}
|
|
173
164
|
|
|
174
|
-
.wallet {
|
|
175
|
-
display: flex;
|
|
176
|
-
align-items: center;
|
|
177
|
-
gap: 0.75rem;
|
|
178
|
-
margin: 1.25rem 0;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
.addr {
|
|
182
|
-
font-family: monospace;
|
|
183
|
-
font-size: 0.9rem;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
165
|
.result {
|
|
187
166
|
margin-top: 1.5rem;
|
|
188
167
|
padding: 1rem;
|
package/src/config.ts
CHANGED
|
@@ -48,12 +48,12 @@ export function uploadRelayMaxTipMist(envSource: EnvSource = env): number {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
51
|
+
* gRPC-web endpoint used to build + execute the register/certify transactions and read owned
|
|
52
|
+
* blobs. The Sui SDK's JSON-RPC client is deprecated, so this must be a gRPC-web-capable endpoint
|
|
53
|
+
* (the Mysten public fullnodes serve gRPC-web at :443 via the browser Fetch transport).
|
|
54
54
|
*/
|
|
55
55
|
export const RPC_URLS: Record<WalrusNetwork, string> = {
|
|
56
|
-
testnet: env.VITE_RPC_TESTNET || 'https://
|
|
56
|
+
testnet: env.VITE_RPC_TESTNET || 'https://fullnode.testnet.sui.io:443',
|
|
57
57
|
mainnet: env.VITE_RPC_MAINNET || 'https://fullnode.mainnet.sui.io:443',
|
|
58
58
|
}
|
|
59
59
|
|
package/tsconfig.json
CHANGED
package/vite.config.ts
CHANGED
|
@@ -3,9 +3,16 @@ import vue from '@vitejs/plugin-vue'
|
|
|
3
3
|
|
|
4
4
|
// design-tokens and ui resolve from node_modules (published packages).
|
|
5
5
|
// @mysten/walrus is excluded from dep-optimization so its wasm `?url` import resolves.
|
|
6
|
+
// node:fs/promises is declared external so rolldown doesn't warn about the Node-only
|
|
7
|
+
// uploadLocalFile helper in @meddleware/walrus-client (never called from browser code).
|
|
6
8
|
export default defineConfig({
|
|
7
9
|
plugins: [vue()],
|
|
8
10
|
optimizeDeps: {
|
|
9
11
|
exclude: ['@mysten/walrus', '@mysten/walrus-wasm'],
|
|
10
12
|
},
|
|
13
|
+
build: {
|
|
14
|
+
rollupOptions: {
|
|
15
|
+
external: ['node:fs/promises'],
|
|
16
|
+
},
|
|
17
|
+
},
|
|
11
18
|
})
|