@meddleware/treasury-ui 0.0.9 → 0.0.11

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/treasury-ui",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "homepage": "https://docs.meddleware.co.uk/treasury/",
5
5
  "description": "Meddleware treasury console — organisation-level accounting across revenue streams (Sui and beyond). Read-only, desktop-console UI built on @meddleware/ui.",
6
6
  "author": "Meddleware <dev@meddleware.co.uk>",
@@ -44,9 +44,9 @@
44
44
  "access": "public"
45
45
  },
46
46
  "dependencies": {
47
- "@meddleware/access-gate-client": "^0.0.3",
48
- "@meddleware/design-tokens": "^0.1.7",
49
- "@meddleware/ui": "^0.1.28",
47
+ "@meddleware/access-gate-client": "^0.0.4",
48
+ "@meddleware/design-tokens": "^0.1.8",
49
+ "@meddleware/ui": "^0.1.30",
50
50
  "@mysten/sui": "^2.33.1",
51
51
  "vue": "^3.5.43"
52
52
  },
@@ -54,7 +54,7 @@
54
54
  "@meddleware/wallet-adapter": ">=0.0.12 <0.2.0"
55
55
  },
56
56
  "devDependencies": {
57
- "@meddleware/wallet-adapter": "^0.0.12",
57
+ "@meddleware/wallet-adapter": "^0.0.13",
58
58
  "@types/node": "~24.12.2",
59
59
  "@vitejs/plugin-vue": "^6.0.9",
60
60
  "@vue/eslint-config-typescript": "^14.9.0",
package/src/App.vue CHANGED
@@ -6,8 +6,8 @@ import { network } from './config.js'
6
6
  import TreasuryView from './TreasuryView.vue'
7
7
 
8
8
  const { mode, set } = useColorMode('dark')
9
- const DOCS_URL = import.meta.env.VITE_DOCS_URL || 'https://docs.meddleware.co.uk/treasury/'
10
- const DEV_URL = import.meta.env.VITE_DEV_URL || 'https://dev.meddleware.co.uk/treasury/'
9
+ const DOCS_URL = import.meta.env.VITE_DOCS_URL || 'https://docs.meddleware.co.uk/blockchain/sui/treasury/'
10
+ const DEV_URL = import.meta.env.VITE_DEV_URL || 'https://dev.meddleware.co.uk/sui/access-gate/'
11
11
  </script>
12
12
 
13
13
  <template>
@@ -1,15 +1,16 @@
1
1
  import { ref } from 'vue'
2
2
  import { getSuiClient } from '../wallet.js'
3
- import { onChainContext } from './chainContext.js'
3
+ import { latest, onChainContext } from './chainContext.js'
4
4
 
5
5
  export function useEpoch() {
6
6
  const epoch = ref<number | null>(null)
7
+ const begin = latest()
7
8
 
8
9
  async function load() {
10
+ const current = begin()
9
11
  try {
10
- const client = getSuiClient()
11
- const res = await client.getCurrentSystemState()
12
- epoch.value = Number(res.systemState.epoch)
12
+ const res = await getSuiClient().getCurrentSystemState()
13
+ if (current()) epoch.value = Number(res.systemState.epoch)
13
14
  } catch {
14
15
  // non-fatal — status bar shows "Epoch —"
15
16
  }
@@ -1,30 +1,44 @@
1
- // Reads the SUI balance of the treasury address. Reactive to the address getter so it
2
- // refetches when usePlatformConfig resolves; clears to null while the address is unknown.
1
+ // Reads the SUI the treasury address holds: its coin objects plus its address balance (SIP-58), so
2
+ // funds sent with `send_funds` are counted. Reactive to the address getter so it refetches when
3
+ // usePlatformConfig resolves; clears to null while the address is unknown or unreadable. A slower,
4
+ // older read never overwrites a newer one.
3
5
  import { ref, watch } from 'vue'
4
6
  import { getSuiClient } from '../wallet.js'
7
+ import { latest } from './chainContext.js'
5
8
 
6
9
  export function useTreasury(treasuryAddress: () => string | null) {
7
10
  const balance = ref<bigint | null>(null)
8
11
  const loading = ref(false)
9
12
  const error = ref<string | null>(null)
13
+ const begin = latest()
10
14
 
11
15
  async function load(address: string) {
16
+ const current = begin()
12
17
  loading.value = true
13
18
  error.value = null
14
19
  try {
15
- const client = getSuiClient()
16
- const res = await client.getBalance({ owner: address, coinType: '0x2::sui::SUI' })
17
- balance.value = BigInt(res.balance.coinBalance)
20
+ const res = await getSuiClient().core.getBalance({ owner: address, coinType: '0x2::sui::SUI' })
21
+ if (current()) balance.value = BigInt(res.balance.balance)
18
22
  } catch (e) {
23
+ if (!current()) return
24
+ balance.value = null
19
25
  error.value = e instanceof Error ? e.message : String(e)
20
26
  } finally {
21
- loading.value = false
27
+ if (current()) loading.value = false
22
28
  }
23
29
  }
24
30
 
25
31
  watch(
26
32
  treasuryAddress,
27
- (addr) => { if (addr) { void load(addr) } else { balance.value = null } },
33
+ (addr) => {
34
+ if (addr) {
35
+ void load(addr)
36
+ } else {
37
+ begin()
38
+ balance.value = null
39
+ loading.value = false
40
+ }
41
+ },
28
42
  { immediate: true },
29
43
  )
30
44