@@ -145,7 +145,7 @@ h5 span {
145
145
<v-card class =" card p-4 mt-1" >
146
146
<div class =" row" >
147
147
<div class =" col-8" >
148
- <p ><b >Total Credits</b ></p >
148
+ <p ><b >Total Credits Used </b ></p >
149
149
<p >
150
150
<span style =" font-size :xx-large ;" >
151
151
{{ numberFormat(parsedAllowanceLimit) }}
@@ -171,10 +171,10 @@ h5 span {
171
171
<v-card class =" p-4 mt-2" >
172
172
<div >
173
173
<p ><b >Scope(s)</b ></p >
174
- <p v-if =" grants .length > 0" >
175
- <span class =" badge badge-info mx-1" v-for =" eachRow in grants "
176
- v-bind:key =" eachRow.authorization.msg " >{{
177
- eachRow.authorization.msg.replace('/hypersign.ssi.v1.Msg', '') }}</span >
174
+ <p v-if =" allowance.scope .length > 0" >
175
+ <span class =" badge badge-info mx-1" v-for =" eachRow in allowance.scope "
176
+ v-bind:key =" eachRow" >{{
177
+ eachRow }}</span >
178
178
</p >
179
179
<p v-else >
180
180
No scope granted!
@@ -378,26 +378,36 @@ export default {
378
378
},
379
379
async mounted () {
380
380
try {
381
+
381
382
this .isLoading = true
382
- const payload = {
383
- // wallet: "hid1a4zqvlmp3w9ggctvc873f08k3evh3mmj2vx939",
384
- groupBy: ' daily'
385
- }
386
383
387
- // get allowance
388
- const t = await this .ssiDashboardAllowanceStats (payload)
389
- if (t .allowance ) {
390
- this .allowance = t .allowance
391
- this .allowance .total = 5000000
392
- this .dougnNutData = [this .parsedAllowanceLimit , this .allowance .total - this .parsedAllowanceLimit ]
384
+ const credits = await this .ssiCredits ()
385
+
386
+
387
+ const credit = credits .filter (each => {
388
+ if (each .status == ' Active' ) {
389
+ return each
390
+ }
391
+ })
392
+
393
+
394
+ // get allowanc
395
+
396
+ if (credit[0 ]? .credit ) {
397
+
398
+ // this.allowance = credits[0].credit.amount
399
+ this .allowance .spend_limit [0 ].amount = credit[0 ].used
400
+ this .allowance .total = credit[0 ].totalCredits
401
+ this .dougnNutData = [this .allowance .total - this .parsedAllowanceLimit , this .parsedAllowanceLimit ]
402
+
403
+ this .allowance .scope = credit[0 ].creditScope
404
+ this .allowance .expiration = credit[0 ].expiresAt
405
+
393
406
this .redrawChart = true
394
407
}
395
408
396
409
// get grants
397
- this .grants = await this .ssiDashboardGrantsStats (payload)
398
410
399
- // get tx stats
400
- this .ssiDashboardStats = await this .ssiDashboardTxStats (payload)
401
411
402
412
this .isLoading = false
403
413
} catch (e) {
@@ -484,7 +494,8 @@ export default {
484
494
}
485
495
],
486
496
" expiration" : null ,
487
- " total" : 5000000
497
+ " total" : 5000000 ,
498
+ scope: []
488
499
},
489
500
initialBalance: 1000 ,
490
501
leftBalance: 1000 ,
@@ -509,7 +520,7 @@ export default {
509
520
}
510
521
},
511
522
methods: {
512
- ... mapActions (' mainStore' , [' ssiDashboardTxStats' , ' ssiDashboardAllowanceStats' , ' ssiDashboardGrantsStats' ]),
523
+ ... mapActions (' mainStore' , [' ssiDashboardTxStats' , ' ssiDashboardAllowanceStats' , ' ssiCredits ' , ' ssiDashboardGrantsStats' ]),
513
524
514
525
renderChart () {
515
526
const ctx = document .getElementById (' doughNutChat' );
0 commit comments