@meddleware/access-gate-ui 0.1.5 → 0.1.7

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/access-gate-ui",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "Operator console for creating and managing on-chain Sui access gates — create gates, configure settings, airdrop NFTs, and freeze gates via a wallet-connected SPA.",
5
5
  "author": "Meddleware <dev@meddleware.co.uk>",
6
6
  "license": "0BSD",
@@ -38,10 +38,10 @@
38
38
  },
39
39
  "dependencies": {
40
40
  "@meddleware/design-tokens": "^0.1.2",
41
- "@meddleware/ui": "^0.1.6",
41
+ "@meddleware/ui": "^0.1.9",
42
42
  "@meddleware/nft-gate-client": "^0.0.6",
43
- "@meddleware/wallet-adapter": "^0.0.4",
44
- "@mysten/sui": "^2.28.0",
43
+ "@meddleware/wallet-adapter": "^0.0.5",
44
+ "@mysten/sui": "^2.30.0",
45
45
  "@mysten/wallet-standard": "^0.20.0",
46
46
  "vue": "^3.5.40"
47
47
  },
package/src/App.vue CHANGED
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  // Standalone shell for the Access Gate SPA: app header + footer wrapping the core tool view.
3
3
  // The core UI lives in AccessGateView.vue (also exported for inline embedding in the dashboard).
4
- import { AppHeader, AppFooter, ColorModeControl, UiButton, useColorMode } from '@meddleware/ui'
4
+ import { AppHeader, AppFooter, ColorModeControl, UiButton, CopyableAddress, useColorMode } from '@meddleware/ui'
5
5
  import { useWallet } from './wallet.js'
6
6
  import AccessGateView from './components/AccessGateView.vue'
7
7
 
@@ -22,7 +22,7 @@ async function onConnect(): Promise<void> {
22
22
  </template>
23
23
  <template #actions>
24
24
  <template v-if="account">
25
- <span class="addr">{{ account.address.slice(0, 8) }}…{{ account.address.slice(-4) }}</span>
25
+ <CopyableAddress :address="account.address" />
26
26
  <UiButton variant="ghost" @click="disconnect">Disconnect</UiButton>
27
27
  </template>
28
28
  <template v-else>
@@ -47,8 +47,4 @@ async function onConnect(): Promise<void> {
47
47
  flex-direction: column;
48
48
  }
49
49
 
50
- .addr {
51
- font-family: monospace;
52
- font-size: 0.9rem;
53
- }
54
50
  </style>
package/src/gates.ts CHANGED
@@ -13,12 +13,12 @@ export const PACKAGE_ID = ACCESS_GATE_PACKAGE_ID[NETWORK]
13
13
 
14
14
  /** List every gate the given operator address administers (via their owned AdminCaps). */
15
15
  export async function listMyGates(owner: string): Promise<OwnedGate[]> {
16
- return fetchOwnedGates(getSuiClient(NETWORK), owner, PACKAGE_ID)
16
+ return fetchOwnedGates(getSuiClient(), owner, PACKAGE_ID)
17
17
  }
18
18
 
19
19
  /** Re-read one gate's on-chain state (after a management tx), merging back its known adminCapId. */
20
20
  export async function refreshGate(gate: OwnedGate): Promise<OwnedGate | null> {
21
- const fresh = await fetchGate(getSuiClient(NETWORK), gate.gateId)
21
+ const fresh = await fetchGate(getSuiClient(), gate.gateId)
22
22
  return fresh ? { ...fresh, adminCapId: gate.adminCapId } : null
23
23
  }
24
24
 
@@ -34,7 +34,7 @@ export function adminContext(gate: OwnedGate): GateAdminContext {
34
34
  * @throws {Error} if no wallet is connected or the wallet rejects/execution fails.
35
35
  */
36
36
  export async function executeTx(tx: Transaction): Promise<string> {
37
- const executor = await buildExecutor(NETWORK)
37
+ const executor = await buildExecutor()
38
38
  const { digest } = await executor.signAndExecute(tx)
39
39
  await executor.waitForTransaction(digest).catch(() => {})
40
40
  return digest
package/src/wallet.ts CHANGED
@@ -1,28 +1,29 @@
1
1
  // Thin access-gate-ui shim over the shared @meddleware/wallet-adapter singleton.
2
2
  //
3
- // The adapter is network-agnostic (RPC URL passed per call); this shim binds access-gate-ui's
4
- // RPC_URLS so call sites keep the one-arg ergonomics (`getSuiClient(NETWORK)` /
5
- // `buildExecutor(NETWORK)`). Because the adapter is a module singleton, the wallet connection is
6
- // shared with any other tool view rendered in the same window (e.g. the dashboard).
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 { SuiNetwork } from './config.js'
14
- import { RPC_URLS } from './config.js'
15
14
 
16
15
  export type { Executor }
17
16
 
18
- /** Memoised Sui JSON-RPC client for the network, using access-gate-ui's configured RPC URL. */
19
- export function getSuiClient(network: SuiNetwork) {
20
- return getSuiClientBase(network, RPC_URLS[network])
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 + access-gate-ui's RPC URL. */
24
- export function buildExecutor(network: SuiNetwork): Promise<Executor> {
25
- return buildExecutorBase(network, RPC_URLS[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
  /**