OSDN Git Service

fix: remove bytomjslib
authorj <coffce404@gmail.com>
Fri, 6 Aug 2021 06:06:20 +0000 (14:06 +0800)
committerj <coffce404@gmail.com>
Fri, 6 Aug 2021 06:06:20 +0000 (14:06 +0800)
src/views/prompts/bappPrompt.vue
src/views/sendTransaction/signTransaction.vue

index 2460e06..331eb5f 100644 (file)
   import account from "@/models/account";
   import add from "@/utils/address";
   import { camelize, removeFromArray } from "@/utils/utils";
-  import bytomjslib from 'bytomjs-lib'
+  // import bytomjslib from 'bytomjs-lib'
   import BigNumber from "bignumber.js"
 
   export default {
       }
     }, mounted() {
       this.prompt = window.data || apis.extension.getBackgroundPage().notification || null;
+      console.log('mounted')
       console.log(this.prompt)
 
       const params = this.prompt.data
           }
           case "signTransaction":{
             const param = data[0] || data
-
             const _tx = camelize(param)
             const rawTransaction = _tx.rawTransaction
 
-            const tx = this.netType === 'vapor'?
-              bytomjslib.vapor.Transaction.decodeRawTransaction(rawTransaction):
-              bytomjslib.bytom.Transaction.decodeRawTransaction(rawTransaction)
-
+            // const tx = this.netType === 'vapor'?
+            //   bytomjslib.vapor.Transaction.decodeRawTransaction(rawTransaction):
+            //   bytomjslib.bytom.Transaction.decodeRawTransaction(rawTransaction)
+            const tx = _tx.tx
             this.transaction.fee = tx.fee/100000000
             this.transaction.input = tx.inputs
             this.transaction.output = tx.outputs
             const asset = _.union(inputAsset, outputAsset)
             let that = this;
 
-            let types = ["transfer"]
+            let types = ["transfer", "vote"]
             const promise =
               asset
                 .map((assetId) => {
             types = removeFromArray(types, remove);
             types = types.map(ty => this.$t(`common.${ty}`)).join(', ');
 
-            this.transaction.types = types
+            // this.transaction.types = types
+            this.transaction.types = tx.types.map(ty => this.$t(`common.${ty}`)).join(', ');
 
             Promise.all(promise).then(function(output) {
               that.transaction.amounts = output
index b8bc45b..85a5155 100644 (file)
@@ -154,7 +154,7 @@ import account from "@/models/account";
 import { camelize, removeFromArray } from "@/utils/utils";
 import { decimalsMap } from "@/utils/constants"
 import BigNumber from "bignumber.js"
-import bytomjslib from 'bytomjs-lib'
+// import bytomjslib from 'bytomjs-lib'
 
 
 export default {
@@ -248,10 +248,10 @@ export default {
                   this.currentAccount.address
 
               account.setupNet(`${this.net}${this.netType}`)
-
-              const tx = this.netType === 'vapor'?
-              bytomjslib.vapor.Transaction.decodeRawTransaction(rawTransaction):
-              bytomjslib.bytom.Transaction.decodeRawTransaction(rawTransaction)
+              const tx = _tx.tx
+              // const tx = this.netType === 'vapor'?
+              // bytomjslib.vapor.Transaction.decodeRawTransaction(rawTransaction):
+              // bytomjslib.bytom.Transaction.decodeRawTransaction(rawTransaction)
               this.transaction.fee = tx.fee/100000000
               this.transaction.input = tx.inputs
               this.transaction.output = tx.outputs