Skip to content

Commit

Permalink
feat: show persisted vtxos
Browse files Browse the repository at this point in the history
  • Loading branch information
aekasitt committed Aug 21, 2024
1 parent 65d2d33 commit ac22b29
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions src/stores/stateChain.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ export const useStateChain = defineStore('stateChain', () => {
storePublicKey(publicKey.value)
loadState()
userId.value = makeUser()
vtxos.value = Object.values(state[userId.value]['vtxos'])
toast('Disposable statechain created', {
description: `Statechain created under nprofile:${nprofile.value.substring(0, 20)}…`,
})
Expand Down Expand Up @@ -186,17 +187,19 @@ export const useStateChain = defineStore('stateChain', () => {
let receiverPublicKey = derivePublicKey(receiverPrivateKey).substring(2)
let receiver = Address.fromScriptPubKey([1, receiverPublicKey], network)
// update state
state[stateId] = {
address: receiver,
receiverPrivateKey,
receiverPublicKey,
relay,
role: 'user',
trustedOperators: [],
utxos: {},
vtxos: {},
if (!state[stateId]) {
state[stateId] = {
address: receiver,
receiverPrivateKey,
receiverPublicKey,
relay,
role: 'user',
trustedOperators: [],
utxos: {},
vtxos: {},
}
persistState()
}
persistState()
return stateId
}

Expand Down Expand Up @@ -325,9 +328,9 @@ export const useStateChain = defineStore('stateChain', () => {
vout: coin.vout,
withdrawSignatures,
}
persistState()
vtxos.value.push(state[coin.stateId]['vtxos'][coinId])
}
persistState()
}

let storeNProfile = value => {
Expand Down

0 comments on commit ac22b29

Please sign in to comment.