@meddleware/walrus-ui 0.1.23 → 0.1.24

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meddleware/walrus-ui",
3
- "version": "0.1.23",
3
+ "version": "0.1.24",
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",
@@ -45,7 +45,7 @@
45
45
  "@meddleware/ui": "^0.1.10",
46
46
  "@meddleware/wallet-adapter": "^0.0.5",
47
47
  "@meddleware/walrus-client": "^0.0.9",
48
- "@meddleware/walrus-relay": "^0.1.8",
48
+ "@meddleware/walrus-relay": "^0.1.9",
49
49
  "@mysten/sui": "^2.30.0",
50
50
  "@mysten/wallet-standard": "^0.20.0",
51
51
  "@mysten/walrus": "~1.2.24",
@@ -10,7 +10,7 @@ import {
10
10
  useAccessGate,
11
11
  MAX_SINGLE_RESERVATION_EPOCHS,
12
12
  } from '@meddleware/walrus-relay'
13
- import type { UploadResult } from '@meddleware/walrus-relay'
13
+ import type { UploadResult, UploadProgress } from '@meddleware/walrus-relay'
14
14
  import { CopyableAddress, ExplorerLink, UiNotice, suiExplorerUrl } from '@meddleware/ui'
15
15
  // Lightweight URL import — just the wasm asset URL (does not pull the walrus client).
16
16
  import walrusWasmUrl from '@mysten/walrus-wasm/web/walrus_wasm_bg.wasm?url'
@@ -67,7 +67,7 @@ async function onPurchase(): Promise<void> {
67
67
  // upload-flow.ts). Reusing a prior registration is what produced "the received transaction is too old".
68
68
  async function performUpload(
69
69
  bytes: Uint8Array,
70
- opts: { relayHost: string; onStatus: (s: string) => void },
70
+ opts: { relayHost: string; onStatus: (s: string | UploadProgress) => void },
71
71
  ): Promise<UploadResult> {
72
72
  if (!account.value) throw new Error('Connect your wallet first.')
73
73
  const executor = await buildExecutor()
@@ -77,6 +77,10 @@ async function performUpload(
77
77
  const gated = !!(gate && gateState.hasAccess.value === true && gateState.nftId.value)
78
78
  const consumeKey = gate ? consumeStorageKey(NETWORK, gate.gateId, address) : null
79
79
 
80
+ // Gated uploads spend one NFT use on-chain before the core flow — surface it as the leading
81
+ // "Access" step so the stepper reflects the extra wallet approval (a reused consume is instant).
82
+ if (gated) opts.onStatus({ step: 'access', detail: 'Confirming access…' })
83
+
80
84
  // Resolve this attempt's relay token (gated only); reuses a stored consume, fresh challenge each time.
81
85
  const token = (forceFresh: boolean): Promise<string | undefined> =>
82
86
  !gated
@@ -11,7 +11,7 @@
11
11
  // can't be reused across attempts — reusing a prior/discovered registration (localStorage or on-chain
12
12
  // discovery) hands the relay an old tx with a non-matching nonce. Each attempt re-encodes (free) and
13
13
  // registers fresh so the tip+nonce the relay verifies is always recent.
14
- import type { UploadResult } from '@meddleware/walrus-relay'
14
+ import type { UploadResult, UploadProgress } from '@meddleware/walrus-relay'
15
15
 
16
16
  /** Minimal transaction executor — the structural subset App.vue's wallet executor already provides. */
17
17
  export interface UploadExecutor {
@@ -62,7 +62,8 @@ export interface RunBlobUploadDeps {
62
62
  * upload presents a fresh challenge signature (see `@meddleware/walrus-client`).
63
63
  */
64
64
  authToken?: string | (() => string | undefined)
65
- onStatus: (s: string) => void
65
+ /** Structured step progress; drives the stepped indicator in the WalrusUpload widget. */
66
+ onStatus: (p: UploadProgress) => void
66
67
  /** Lazy loader for the Walrus client module (keeps wasm out of the eager bundle). */
67
68
  loadWalrusClient?: () => Promise<WalrusClientModule>
68
69
  }
@@ -90,20 +91,20 @@ export async function runBlobUpload(deps: RunBlobUploadDeps): Promise<UploadResu
90
91
  })
91
92
  const flow = createBlobUploadFlow(client, deps.bytes)
92
93
 
93
- deps.onStatus('Encoding…')
94
+ deps.onStatus({ step: 'encode', detail: 'Encoding…' })
94
95
  await flow.encode()
95
96
 
96
- deps.onStatus('Registering blob (approve in wallet)…')
97
+ deps.onStatus({ step: 'register', detail: 'Registering blob (approve in wallet)…' })
97
98
  const regTx = flow.register({ owner: deps.address, epochs: deps.epochs, deletable: false })
98
99
  regTx.setSenderIfNotSet(deps.address)
99
100
  await regTx.build({ client: deps.suiClient })
100
101
  const reg = await deps.executor.signAndExecute(regTx)
101
102
  await deps.executor.waitForTransaction(reg.digest)
102
103
 
103
- deps.onStatus('Uploading to the relay…')
104
+ deps.onStatus({ step: 'upload', detail: 'Uploading to the relay…' })
104
105
  await flow.upload({ digest: reg.digest, deletable: false })
105
106
 
106
- deps.onStatus('Certifying (approve in wallet)…')
107
+ deps.onStatus({ step: 'certify', detail: 'Certifying (approve in wallet)…' })
107
108
  const certTx = flow.certify()
108
109
  certTx.setSenderIfNotSet(deps.address)
109
110
  await certTx.build({ client: deps.suiClient })