OSDN Git Service

update enable function.
[bytom/Bytom-Dapp-Demo.git] / src / components / constants.js
index 1c44bb6..758d162 100644 (file)
@@ -13,26 +13,30 @@ let banker
 let gas
 let radio
 
-const GetContractArgs = function() {
-  if(window.bytom && window.bytom.default_account && window.bytom.net){
-    let network = window.bytom.net
+const GetContractArgs = function(bytom) {
+  let network
+  if(bytom && bytom.net){
+    network = bytom.net
+  }else if(window.bytom && window.bytom.default_account && window.bytom.net){
+    network = window.bytom.net
+  }
 
-    const object = config[network]
-    if(object){
-      depositProgram = object.depositProgram
-      profitProgram = object.profitProgram
-      assetDeposited = object.assetDeposited
-      assetBill = object.assetBill
-      totalAmountBill = object.totalAmountBill
-      totalAmountCapital = object.totalAmountCapital
-      dueBlockHeight = object.dueBlockHeight
-      expireBlockHeight = object.expireBlockHeight
-      banker = object.banker
-      gas = object.gas
-      radio =BigNumber(object.totalAmountCapital).div(object.totalAmountBill).toNumber()
-    }
+  const object = config[network]
+  if(object){
+    depositProgram = object.depositProgram
+    profitProgram = object.profitProgram
+    assetDeposited = object.assetDeposited
+    assetBill = object.assetBill
+    totalAmountBill = object.totalAmountBill
+    totalAmountCapital = object.totalAmountCapital
+    dueBlockHeight = object.dueBlockHeight
+    expireBlockHeight = object.expireBlockHeight
+    banker = object.banker
+    gas = object.gas
+    radio =BigNumber(object.totalAmountCapital).div(object.totalAmountBill).toNumber()
   }
 
+
   return {
       depositProgram,
       profitProgram,