@meddleware/walrus-ui 0.1.7 → 0.1.8
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 +3 -3
- package/src/components/MyBlobs.vue +1 -1
- package/src/components/WalrusView.vue +5 -5
- package/src/wallet.ts +13 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meddleware/walrus-ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
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",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@meddleware/design-tokens": "^0.1.2",
|
|
44
44
|
"@meddleware/nft-gate-client": "^0.0.6",
|
|
45
|
-
"@meddleware/ui": "^0.1.
|
|
46
|
-
"@meddleware/wallet-adapter": "^0.0.
|
|
45
|
+
"@meddleware/ui": "^0.1.7",
|
|
46
|
+
"@meddleware/wallet-adapter": "^0.0.5",
|
|
47
47
|
"@meddleware/walrus-client": "^0.0.5",
|
|
48
48
|
"@meddleware/walrus-relay": "^0.1.3",
|
|
49
49
|
"@mysten/sui": "^2.28.0",
|
|
@@ -37,7 +37,7 @@ async function loadBlobs(): Promise<void> {
|
|
|
37
37
|
blobs.value = []
|
|
38
38
|
try {
|
|
39
39
|
const { createWalrusClient, fetchOwnedWalrusBlobs } = await import('@meddleware/walrus-client')
|
|
40
|
-
const suiClient = getSuiClient(
|
|
40
|
+
const suiClient = getSuiClient()
|
|
41
41
|
const walrusClient = createWalrusClient({ network: NETWORK, wasmUrl: walrusWasmUrl })
|
|
42
42
|
const [sys, fetched] = await Promise.all([
|
|
43
43
|
suiClient.getCurrentSystemState(),
|
|
@@ -25,7 +25,7 @@ const activeTab = ref<Tab>('upload')
|
|
|
25
25
|
const { account, signPersonalMessage, buildExecutor } = useWallet()
|
|
26
26
|
|
|
27
27
|
const gate = accessGate(NETWORK)
|
|
28
|
-
const gateState = useAccessGate({ gate, getClient: () => getSuiClient(
|
|
28
|
+
const gateState = useAccessGate({ gate, getClient: () => getSuiClient() })
|
|
29
29
|
const purchasing = ref(false)
|
|
30
30
|
const result = ref<UploadResult | null>(null)
|
|
31
31
|
|
|
@@ -41,7 +41,7 @@ async function onPurchase(): Promise<void> {
|
|
|
41
41
|
if (!account.value) return
|
|
42
42
|
purchasing.value = true
|
|
43
43
|
try {
|
|
44
|
-
const executor = await buildExecutor(
|
|
44
|
+
const executor = await buildExecutor()
|
|
45
45
|
await gateState.purchase(executor, account.value.address)
|
|
46
46
|
} finally {
|
|
47
47
|
purchasing.value = false
|
|
@@ -56,7 +56,7 @@ async function performUpload(
|
|
|
56
56
|
opts: { relayHost: string; onStatus: (s: string) => void },
|
|
57
57
|
): Promise<UploadResult> {
|
|
58
58
|
if (!account.value) throw new Error('Connect your wallet first.')
|
|
59
|
-
const executor = await buildExecutor(
|
|
59
|
+
const executor = await buildExecutor()
|
|
60
60
|
|
|
61
61
|
// If the relay is NFT-gated and we hold access, attach a signed proof token.
|
|
62
62
|
let authToken: string | undefined
|
|
@@ -77,7 +77,7 @@ async function performUpload(
|
|
|
77
77
|
maxTipMist: uploadRelayMaxTipMist(),
|
|
78
78
|
epochs: MAX_SINGLE_RESERVATION_EPOCHS,
|
|
79
79
|
executor,
|
|
80
|
-
suiClient: getSuiClient(
|
|
80
|
+
suiClient: getSuiClient(),
|
|
81
81
|
authToken,
|
|
82
82
|
onStatus: opts.onStatus,
|
|
83
83
|
})
|
|
@@ -143,7 +143,7 @@ function onUploaded(r: UploadResult): void {
|
|
|
143
143
|
<MyBlobs
|
|
144
144
|
v-if="activeTab === 'blobs'"
|
|
145
145
|
:address="account?.address ?? null"
|
|
146
|
-
:build-executor="() => buildExecutor(
|
|
146
|
+
:build-executor="() => buildExecutor()"
|
|
147
147
|
/>
|
|
148
148
|
</WalletGuard>
|
|
149
149
|
</div>
|
package/src/wallet.ts
CHANGED
|
@@ -1,28 +1,29 @@
|
|
|
1
1
|
// Thin walrus-ui shim over the shared @meddleware/wallet-adapter singleton.
|
|
2
2
|
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
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
7
|
import {
|
|
8
8
|
useWallet as useWalletBase,
|
|
9
9
|
getSuiClient as getSuiClientBase,
|
|
10
10
|
buildExecutor as buildExecutorBase,
|
|
11
|
+
useNetwork,
|
|
11
12
|
} from '@meddleware/wallet-adapter'
|
|
12
13
|
import type { Executor } from '@meddleware/wallet-adapter'
|
|
13
|
-
import type { WalrusNetwork } from '@meddleware/walrus-relay'
|
|
14
|
-
import { RPC_URLS } from './config.js'
|
|
15
14
|
|
|
16
15
|
export type { Executor }
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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)
|
|
21
22
|
}
|
|
22
23
|
|
|
23
|
-
/** Build a transaction executor bound to the connected wallet
|
|
24
|
-
export function buildExecutor(
|
|
25
|
-
return buildExecutorBase(network,
|
|
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)
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
/**
|