Skip to content

Commit

Permalink
https://github.com/mimblewimble/grin-wallet/issues/470
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaojay committed Jul 21, 2020
1 parent a51f994 commit efe856e
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/renderer/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,11 @@
this.getHeight()
messageBus.$emit('update', true)
})
messageBus.$on('update', (showloading=true)=>{
messageBus.$on('update', (showloading=false)=>{
if(showloading){
this.isloading=true
}else{
this.isloading=false
}
this.getHeight()
this.updateIsLocalGnode()
Expand Down
38 changes: 36 additions & 2 deletions src/renderer/components/Finalize.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<br/>
<div class="field is-grouped">
<div class="control">
<button v-if="slatepack" class="button is-link is-small" @click="send">{{ $t("msg.finalize.send") }}</button>
<button v-if="slatepack" class="button is-link is-small" @click="send2">{{ $t("msg.finalize.send") }}</button>
<button v-else class="button is-link is-small" disabled>{{ $t("msg.finalize.send") }}</button>
</div>
<div class="control">
Expand Down Expand Up @@ -186,7 +186,41 @@ export default {
finalize.call(this)
},
send2(){
let tx_id
this.status = 'sending'
let finalize = async function(){
try{
let res = await this.$walletServiceV3.getSlateFromSlatepackMessage(this.slatepack, [0])
this.$log.debug('getSlateFromSlatepackMessage return:', JSON.stringify(res))
let slate = res.result.Ok
res = await this.$walletServiceV3.finalizeTransaction(slate)
this.$log.debug('finalizeTransaction return res: ' + JSON.stringify(res))
let slate2 = res.result.Ok
res = await this.$walletServiceV3.postTransaction(slate2, true)
this.$log.debug('postTransaction return res: ' + JSON.stringify(res))
this.status = 'sent'
tx_id = slate2.id
if(tx_id)this.$dbService.addPostedUnconfirmedTx(tx_id)
this.$log.debug(`finalize tx ${tx_id} ok; return:${res}`)
}catch(error){
this.$log.error('finalize or post error:' + error)
this.errors.push(this.$t('msg.finalize.TxFailed'))
await new Promise(r => setTimeout(r, 4000))
this.status = 'toSend'
}finally{
messageBus.$emit('update')
}
}
finalize.call(this)
},
clearup(){
this.errors = []
Expand Down

0 comments on commit efe856e

Please sign in to comment.