Browse Source

修改认证及报单信息

BF-202210271038\Administrator 3 years ago
parent
commit
013ce4395f

+ 276 - 0
common/wallet/bitkeep-wallet/bitkeep-lucky.js

@@ -0,0 +1,276 @@
+/**
+ * bitkeep钱包的tron
+ * @type {{}}
+ */
+import tools from "@/common/js/tools";
+import {ethers} from "ethers";
+import web3 from "web3";
+
+let bitkeepLucky = {}
+
+let contractArr=[
+    '0x10186d85ac0579cb141ff37261f23cf4f1d254b5'
+];
+const chainId='0x3e6'
+
+
+let provider=null
+/**
+ * 钱包初始校验
+ * @returns {*}
+ */
+bitkeepLucky.getProvider= function (){
+    console.log(window.bitkeep.ethereum)
+    if(!provider){
+        provider = window.bitkeep && window.bitkeep.ethereum;
+        if (!provider) {
+            return window.open('https://bitkeep.com/en/download?type=2');
+        }
+    }
+    if(provider.chainId==='0x73'){
+        // window.bitkeep.ethereum.rpc.rpcUrl='http://luckychain.win/rpc/'
+        provider.rpc.rpcUrl='http://luckychain.win/rpc/'
+    }else {
+        uni.$emit('noLucky',false)
+    }
+    // console.log(provider)
+    return provider;
+}
+
+
+bitkeepLucky.test=function (){
+    provider=bitkeepLucky.getProvider()
+    console.log(provider.isConnected())
+}
+
+/**
+ * 获取我登陆的地址
+ * @returns {any}
+ */
+bitkeepLucky.getMyAddress=function () {
+   return  uni.getStorageSync('luckyAddress')
+}
+
+/**
+ * 获取基本账户地址
+ * @returns {Promise<unknown>}
+ */
+bitkeepLucky.getAccounts=async function (){
+
+    return new Promise( (resolve, reject) => {
+        try {
+            bitkeepLucky.getProvider().request({ method: 'eth_requestAccounts'})
+            .then((address)=>{
+                if(address.length>0){
+                    uni.setStorageSync('luckyAddress',address[0])
+                    resolve(address[0])
+                }else {
+                    resolve(false)
+                }
+            })
+            .catch((e)=>{
+                console.log(e)
+            })
+        }catch (e) {
+            reject(e)
+        }
+    })
+}
+
+
+/**
+ * 获取我的余额
+ * @param selectedAddress
+ * @returns {Promise<unknown>}
+ */
+bitkeepLucky.getBalance=async function (selectedAddress) {
+    if(!selectedAddress){
+        selectedAddress=bitkeepLucky.getMyAddress();
+    }
+    console.log('selectedAddress:'+selectedAddress)
+    // alert('钱包地址:'+selectedAddress)
+    return new Promise( (resolve, reject) => {
+        try {
+            if(!selectedAddress){
+                resolve(0)
+            }else {
+                bitkeepLucky.getProvider().request({ method: 'eth_getBalance',params:[selectedAddress, "latest"]})
+                    .then((balance)=>{
+                        balance= ethers.utils.formatEther(balance.toString())
+                        // alert(JSON.stringify(balance))
+                        // console.log(balance)
+                        console.log('getBalance:'+balance)
+                        resolve(balance)
+                    })
+                    .catch((e)=>{
+                        resolve(0)
+                    })
+            }
+
+        }catch (e) {
+            // alert('error:'+JSON.stringify(e))
+            reject(e)
+        }
+    })
+}
+
+
+
+/**
+ * 获取合约数量
+ * @param selectedAddress
+ * @param contractType
+ * @returns {Promise<number>}
+ */
+bitkeepLucky.getTokenBalance=async function (selectedAddress,contractType) {
+    if(!contractType){
+        contractType=0
+    }
+    if(!selectedAddress){
+        selectedAddress=bitkeepLucky.getMyAddress();
+    }
+    let data='0x70a08231000000000000000000000000'+(selectedAddress.substring(2))
+    console.log(web3.utils.isHex(`0x70a08231`))
+    console.log(data)
+    return new Promise( (resolve, reject) => {
+        try {
+            let data='0x70a08231000000000000000000000000'+(selectedAddress.substring(2))
+            bitkeepLucky.getProvider().request({method: 'eth_call',params:[{'to':contractArr[contractType],'data':data}, "latest"]}).then((balance)=>{
+                console.log('hexToNumber:-----------------'+balance)
+                console.log(web3.utils.hexToNumber(balance))
+                balance= (web3.utils.hexToNumber(balance)/1000000).toString()
+                if(balance<0.000001){
+                    balance=0
+                }
+                resolve(balance)
+            }).catch((e)=>{
+                resolve(0)
+            })
+        }catch (e) {
+            // alert('error:'+JSON.stringify(e))
+            reject(e)
+        }
+    })
+}
+
+
+
+/**
+ * 获取合约信息
+ * @param contractType
+ * @returns {Promise<boolean|*>}
+ */
+bitkeepLucky.getContract=async function () {
+
+}
+
+
+/**
+ * 合约转账
+ * @param to
+ * @param money
+ * @param contractType
+ */
+bitkeepLucky.getContractData=async function (to,money,contractType){
+    // console.log(ethers.utils.getAddress(to))
+    if(!contractType){
+        contractType=0
+    }
+    let data={};
+    console.log('web3----------------------------------------')
+
+    money*=1000000
+    money=web3.utils.numberToHex(money)
+    money=tools.replenishZero(money)
+    console.log(money)
+    console.log(`transfer(${to},${money})`)
+    console.log( web3.utils.sha3(`transfer(${to.substring(2)},${money})`))
+    // console.log(ethers.utils.parseEther(money).toString())
+    data.data='0xa9059cbb'+tools.replenishZero(to)+tools.replenishZero(money);
+    // console.log(data.data)
+    // console.log('0xa9059cbb'+(to.substring(2)))
+    data.to=contractArr[contractType];
+    data.from=bitkeepLucky.getMyAddress();
+    data.gasPrice=await bitkeepLucky.getGasPrice();
+    data.gasLimit=await bitkeepLucky.getEstimateGas();
+    data.chainId=chainId;
+    data.value= '0x0'
+    return data;
+}
+
+
+/**
+ * 获取gasPrice
+ * @returns {Promise<unknown>}
+ */
+bitkeepLucky.getGasPrice= async function (){
+    let gasPrice =await    bitkeepLucky.getProvider().request({ method: 'eth_gasPrice',params:[]})
+    if(!gasPrice){
+        gasPrice='0x0'
+    }
+    return gasPrice;
+}
+
+/**
+ * 获取燃料数量
+ * @param data
+ * @returns {Promise<unknown>}
+ */
+bitkeepLucky.getEstimateGas= async function (data){
+    let estimateGas =await   bitkeepLucky.getProvider().request({ method: 'eth_estimateGas',params:[data]})
+    console.log('estimateGas:'+estimateGas)
+    if(!estimateGas){
+        estimateGas=100000
+    }
+    return estimateGas;
+}
+
+/**
+ * 转账接口
+ * @param to
+ * @param money
+ * @returns {{}}
+ */
+bitkeepLucky.getTransactionData=async function (to,money){
+    let data={};
+    data.data='0x0';
+    data.to=to;
+    data.from=bitkeepLucky.getMyAddress();
+    data.gasPrice=await bitkeepLucky.getGasPrice();
+    data.gasLimit=await bitkeepLucky.getEstimateGas();
+    data.chainId=chainId;
+    if(tools.isDevelopment()){
+        money=0.001;
+    }
+    data.value= ethers.utils.parseEther(money.toString()).toString()
+    console.log('value:'+data.value)
+    return data;
+}
+
+/**
+ * 转账
+ * @param data
+ * @returns {Promise<unknown>}
+ */
+bitkeepLucky.sendTransaction=function (data){
+    return new Promise(async (resolve, reject) => {
+        try {
+            let txHash = await  bitkeepLucky.getProvider().request({
+                method: 'eth_sendTransaction',
+                params: [data],
+            });
+            console.log('txHash:'+txHash)
+            if(txHash){
+                resolve(txHash)
+            }else {
+                reject(false)
+            }
+         }catch (e) {
+           reject(false)
+        }
+    })
+}
+
+
+
+export default bitkeepLucky

+ 462 - 3
common/wallet/bitkeep-wallet/bitkeep-tron.js

@@ -7,7 +7,424 @@ import tools from "@/common/js/tools";
 let bitkeepTron = {}
 
 let contractArr=[
-    'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t'
+    'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t',
+    'TTUzsY3UMVTwT8a7wmJ3P6ar7aj5ddjVsR',
+];
+const tronCrossAddress = "TTUzsY3UMVTwT8a7wmJ3P6ar7aj5ddjVsR";
+const tronCrossAbi = [
+    {
+        "anonymous": false,
+        "inputs": [
+            {
+                "indexed": true,
+                "internalType": "address",
+                "name": "_l1Token",
+                "type": "address"
+            },
+            {
+                "indexed": true,
+                "internalType": "address",
+                "name": "_l2Token",
+                "type": "address"
+            },
+            {
+                "indexed": true,
+                "internalType": "address",
+                "name": "_from",
+                "type": "address"
+            },
+            {
+                "indexed": false,
+                "internalType": "address",
+                "name": "_to",
+                "type": "address"
+            },
+            {
+                "indexed": false,
+                "internalType": "uint256",
+                "name": "_amount",
+                "type": "uint256"
+            },
+            {
+                "indexed": false,
+                "internalType": "bytes",
+                "name": "_data",
+                "type": "bytes"
+            }
+        ],
+        "name": "ERC20DepositInitiated",
+        "type": "event"
+    },
+    {
+        "anonymous": false,
+        "inputs": [
+            {
+                "indexed": true,
+                "internalType": "address",
+                "name": "_l1Token",
+                "type": "address"
+            },
+            {
+                "indexed": true,
+                "internalType": "address",
+                "name": "_l2Token",
+                "type": "address"
+            },
+            {
+                "indexed": true,
+                "internalType": "address",
+                "name": "_from",
+                "type": "address"
+            },
+            {
+                "indexed": false,
+                "internalType": "address",
+                "name": "_to",
+                "type": "address"
+            },
+            {
+                "indexed": false,
+                "internalType": "uint256",
+                "name": "_amount",
+                "type": "uint256"
+            },
+            {
+                "indexed": false,
+                "internalType": "bytes",
+                "name": "_data",
+                "type": "bytes"
+            }
+        ],
+        "name": "ERC20WithdrawalFinalized",
+        "type": "event"
+    },
+    {
+        "anonymous": false,
+        "inputs": [
+            {
+                "indexed": true,
+                "internalType": "address",
+                "name": "_from",
+                "type": "address"
+            },
+            {
+                "indexed": true,
+                "internalType": "address",
+                "name": "_to",
+                "type": "address"
+            },
+            {
+                "indexed": false,
+                "internalType": "uint256",
+                "name": "_amount",
+                "type": "uint256"
+            },
+            {
+                "indexed": false,
+                "internalType": "bytes",
+                "name": "_data",
+                "type": "bytes"
+            }
+        ],
+        "name": "ETHDepositInitiated",
+        "type": "event"
+    },
+    {
+        "anonymous": false,
+        "inputs": [
+            {
+                "indexed": true,
+                "internalType": "address",
+                "name": "_from",
+                "type": "address"
+            },
+            {
+                "indexed": true,
+                "internalType": "address",
+                "name": "_to",
+                "type": "address"
+            },
+            {
+                "indexed": false,
+                "internalType": "uint256",
+                "name": "_amount",
+                "type": "uint256"
+            },
+            {
+                "indexed": false,
+                "internalType": "bytes",
+                "name": "_data",
+                "type": "bytes"
+            }
+        ],
+        "name": "ETHWithdrawalFinalized",
+        "type": "event"
+    },
+    {
+        "anonymous": false,
+        "inputs": [
+            {
+                "indexed": true,
+                "internalType": "address",
+                "name": "previousOwner",
+                "type": "address"
+            },
+            {
+                "indexed": true,
+                "internalType": "address",
+                "name": "newOwner",
+                "type": "address"
+            }
+        ],
+        "name": "OwnershipTransferred",
+        "type": "event"
+    },
+    {
+        "inputs": [
+            {
+                "internalType": "address",
+                "name": "_l1Token",
+                "type": "address"
+            },
+            {
+                "internalType": "address",
+                "name": "_l2Token",
+                "type": "address"
+            },
+            {
+                "internalType": "uint256",
+                "name": "_amount",
+                "type": "uint256"
+            },
+            {
+                "internalType": "uint32",
+                "name": "_l2Gas",
+                "type": "uint32"
+            },
+            {
+                "internalType": "bytes",
+                "name": "_data",
+                "type": "bytes"
+            }
+        ],
+        "name": "depositERC20",
+        "outputs": [],
+        "stateMutability": "nonpayable",
+        "type": "function"
+    },
+    {
+        "inputs": [
+            {
+                "internalType": "address",
+                "name": "_l1Token",
+                "type": "address"
+            },
+            {
+                "internalType": "address",
+                "name": "_l2Token",
+                "type": "address"
+            },
+            {
+                "internalType": "address",
+                "name": "_to",
+                "type": "address"
+            },
+            {
+                "internalType": "uint256",
+                "name": "_amount",
+                "type": "uint256"
+            },
+            {
+                "internalType": "uint32",
+                "name": "_l2Gas",
+                "type": "uint32"
+            },
+            {
+                "internalType": "bytes",
+                "name": "_data",
+                "type": "bytes"
+            }
+        ],
+        "name": "depositERC20To",
+        "outputs": [],
+        "stateMutability": "nonpayable",
+        "type": "function"
+    },
+    {
+        "inputs": [
+            {
+                "internalType": "uint32",
+                "name": "_l2Gas",
+                "type": "uint32"
+            },
+            {
+                "internalType": "bytes",
+                "name": "_data",
+                "type": "bytes"
+            }
+        ],
+        "name": "depositETH",
+        "outputs": [],
+        "stateMutability": "payable",
+        "type": "function"
+    },
+    {
+        "inputs": [
+            {
+                "internalType": "address",
+                "name": "_to",
+                "type": "address"
+            },
+            {
+                "internalType": "uint32",
+                "name": "_l2Gas",
+                "type": "uint32"
+            },
+            {
+                "internalType": "bytes",
+                "name": "_data",
+                "type": "bytes"
+            }
+        ],
+        "name": "depositETHTo",
+        "outputs": [],
+        "stateMutability": "payable",
+        "type": "function"
+    },
+    {
+        "inputs": [
+            {
+                "internalType": "address",
+                "name": "",
+                "type": "address"
+            },
+            {
+                "internalType": "address",
+                "name": "",
+                "type": "address"
+            }
+        ],
+        "name": "deposits",
+        "outputs": [
+            {
+                "internalType": "uint256",
+                "name": "",
+                "type": "uint256"
+            }
+        ],
+        "stateMutability": "view",
+        "type": "function"
+    },
+    {
+        "inputs": [],
+        "name": "donateETH",
+        "outputs": [],
+        "stateMutability": "payable",
+        "type": "function"
+    },
+    {
+        "inputs": [
+            {
+                "internalType": "address",
+                "name": "_l1Token",
+                "type": "address"
+            },
+            {
+                "internalType": "address",
+                "name": "_l2Token",
+                "type": "address"
+            },
+            {
+                "internalType": "address",
+                "name": "_from",
+                "type": "address"
+            },
+            {
+                "internalType": "address",
+                "name": "_to",
+                "type": "address"
+            },
+            {
+                "internalType": "uint256",
+                "name": "_amount",
+                "type": "uint256"
+            },
+            {
+                "internalType": "bytes",
+                "name": "_data",
+                "type": "bytes"
+            }
+        ],
+        "name": "finalizeERC20Withdrawal",
+        "outputs": [],
+        "stateMutability": "nonpayable",
+        "type": "function"
+    },
+    {
+        "inputs": [
+            {
+                "internalType": "address",
+                "name": "_from",
+                "type": "address"
+            },
+            {
+                "internalType": "address",
+                "name": "_to",
+                "type": "address"
+            },
+            {
+                "internalType": "uint256",
+                "name": "_amount",
+                "type": "uint256"
+            },
+            {
+                "internalType": "bytes",
+                "name": "_data",
+                "type": "bytes"
+            }
+        ],
+        "name": "finalizeETHWithdrawal",
+        "outputs": [],
+        "stateMutability": "nonpayable",
+        "type": "function"
+    },
+    {
+        "inputs": [],
+        "name": "owner",
+        "outputs": [
+            {
+                "internalType": "address",
+                "name": "",
+                "type": "address"
+            }
+        ],
+        "stateMutability": "view",
+        "type": "function"
+    },
+    {
+        "inputs": [],
+        "name": "renounceOwnership",
+        "outputs": [],
+        "stateMutability": "nonpayable",
+        "type": "function"
+    },
+    {
+        "inputs": [
+            {
+                "internalType": "address",
+                "name": "newOwner",
+                "type": "address"
+            }
+        ],
+        "name": "transferOwnership",
+        "outputs": [],
+        "stateMutability": "nonpayable",
+        "type": "function"
+    },
+    {
+        "stateMutability": "payable",
+        "type": "receive"
+    }
 ];
 /**
  * 钱包初始校验
@@ -85,8 +502,9 @@ bitkeepTron.getTokenBalance=async function (selectedAddress,contractType) {
  */
 bitkeepTron.getContract=async function (contractType) {
     let contractData = await tronWeb.trx.getContract(contractArr[contractType])
+    console.log(contractData)
     if(contractData.abi){
-        return contractData.abi
+        return contractData
     }else {
         return false
     }
@@ -128,6 +546,47 @@ bitkeepTron.getTransactionData=function (to,money){
     return data;
 }
 
+
+bitkeepTron.depositUsdtTo=async function (address,amount){
+    return new Promise(async (resolve, reject) => {
+        try {
+            let _amount = tronWeb.toSun(amount)
+            let trxUsdtContract = await tronWeb.contract().at(contractArr[0])
+            let res = await trxUsdtContract.methods.approve(tronCrossAddress, _amount).send()
+            if (res) {
+                let timeNum=0;
+               let timeServe= setInterval(async () => {
+                    let hashRes = await tronWeb.trx.getTransaction(res)
+                   if(hashRes.ret.length>0){
+                       if(hashRes.ret[0].contractRet==='SUCCESS'){
+                           const cInstance = tronWeb.contract(tronCrossAbi, tronCrossAddress);
+                           let _l1Token = "0xa614f803b6fd780986a42c78ec9c7f77e6ded13c".toLowerCase()
+                           let _l2Token = "0x10186D85Ac0579Cb141Ff37261f23CF4F1D254b5".toLowerCase()
+                           let sendRes = await cInstance.methods.depositERC20To(_l1Token, _l2Token, address, _amount, 0, []).send()
+                           console.log(sendRes)
+                           resolve(sendRes)
+                           clearInterval(timeServe)
+                       }else if(hashRes.ret[0].contractRet==='REVERT'){
+                           resolve(false)
+                           clearInterval(timeServe)
+                       }else if(timeNum>5){
+                           clearInterval(timeServe)
+                           resolve(false)
+                       }
+                       ++timeNum
+                   }
+                }, 500)
+
+            }else {
+                resolve(false)
+            }
+        }catch (e) {
+            reject(false)
+        }
+    })
+
+}
+
 /**
  * trc转账
  * @param data
@@ -169,4 +628,4 @@ bitkeepTron.sendTransaction=function (data){
     })
 }
 
-export default bitkeepTron
+export default bitkeepTron

+ 25 - 77
common/wallet/tokenpocket-wallet/tokenpocket-bnb.js

@@ -3,35 +3,41 @@
  * @type {{}}
  */
 import tools from "@/common/js/tools";
-import bitkeepTron from "@/common/wallet/bitkeep-wallet/bitkeep-tron";
 import {ethers} from "ethers";
-
 let tokenpocketBnb = {}
 
 let contractArr=[
     'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t'
 ];
 const chainId='0x38'
+let provider;
 /**
  * 钱包初始校验
  * @returns {*}
  */
-tokenpocketBnb.isInstall=function (){
-    console.log('---------------------------')
-    console.log(window.ethereum)
-    if(!window.ethereum){
+tokenpocketBnb.getProvider= function (){
+    if (typeof window.ethereum.isTokenPocket !== 'undefined') {
+        uni.reLaunch({
+            'url':'pages/index/error?errorType=1'
+        })
         return false
     }
-    console.log(window.ethereum.isTokenPocket)
-    return typeof window.ethereum.isTokenPocket !== 'undefined';
-
+    if(!provider){
+        provider = window.ethereum;
+    }
+    console.log('chainId:'+provider.chainId)
+    if(provider.chainId!=='0x38'){
+        uni.$emit('noBan',false)
+    }
+    return provider;
 }
+
 /**
  * 获取我登陆的地址
  * @returns {any}
  */
 tokenpocketBnb.getMyAddress=function () {
-   return  uni.getStorageSync('myAddress')
+   return  uni.getStorageSync('babAddress')
 }
 
 /**
@@ -41,11 +47,11 @@ tokenpocketBnb.getMyAddress=function () {
 tokenpocketBnb.getAccounts=async function (){
     return new Promise( (resolve, reject) => {
         try {
-        window.ethereum.request({ method: 'eth_requestAccounts'})
+            tokenpocketBnb.getProvider().request({ method: 'eth_requestAccounts'})
             .then((address)=>{
                 console.log('address:',address)
                 if(address.length>0){
-                    uni.setStorageSync('myAddress',address[0])
+                    uni.setStorageSync('babAddress',address[0])
                     resolve(address[0])
                 }else {
                     resolve(false)
@@ -68,11 +74,11 @@ tokenpocketBnb.getAccounts=async function (){
  */
 tokenpocketBnb.getBalance=async function (selectedAddress) {
     if(!selectedAddress){
-        selectedAddress=bitkeepTron.getMyAddress();
+        selectedAddress=tokenpocketBnb.getMyAddress();
     }
     return new Promise( (resolve, reject) => {
         try {
-            window.ethereum.request({ method: 'eth_getBalance',params:[selectedAddress]})
+            tokenpocketBnb.getProvider().request({ method: 'eth_getBalance',params:[selectedAddress]})
                 .then((balance)=>{
                     balance= ethers.utils.formatEther(balance.toString())
                     resolve(balance)
@@ -86,71 +92,13 @@ tokenpocketBnb.getBalance=async function (selectedAddress) {
     })
 }
 
-/**
- * 获取合约数量
- * @param selectedAddress
- * @param contractType
- * @returns {Promise<number>}
- */
-tokenpocketBnb.getTokenBalance=async function (selectedAddress,contractType) {
-    if(!selectedAddress){
-        selectedAddress=tokenpocketBnb.getMyAddress();
-    }
-    let tokenBalance = await tronWeb.transactionBuilder.triggerConstantContract(
-        contractArr[contractType],
-        "balanceOf(address)",
-        {},
-        [{ type: 'address', value: selectedAddress }],
-        tronWeb.defaultAddress.base58,
-    );
-    let balance = tokenBalance.constant_result[0];
-    balance= parseInt(balance, 16);
-    balance=balance/1000000;
-    return balance;
-}
-
-
-
-/**
- * 获取合约信息
- * @param contractType
- * @returns {Promise<boolean|*>}
- */
-tokenpocketBnb.getContract=async function (contractType) {
-    let contractData = await tronWeb.trx.getContract(contractArr[contractType])
-    if(contractData.abi){
-        return contractData.abi
-    }else {
-        return false
-    }
-}
-
-
-/**
- * 合约转账
- * @param to
- * @param money
- * @param contractType
- */
-tokenpocketBnb.getContractData=function (to,money,contractType){
-    let data={};
-    data.contract=contractArr[contractType];
-    data.to=to;
-    data.from=tokenpocketBnb.getMyAddress();
-    if(tools.isDevelopment()){
-        money=0.001;
-    }
-    data.value=money;
-    return data;
-}
-
 
 /**
  * 获取gasPrice
  * @returns {Promise<unknown>}
  */
 tokenpocketBnb.getGasPrice= async function (){
-    let gasPrice =await   window.ethereum.request({ method: 'eth_gasPrice',params:[]})
+    let gasPrice =await   tokenpocketBnb.getProvider().request({ method: 'eth_gasPrice',params:[]})
     if(!gasPrice){
         gasPrice='0x0'
     }
@@ -163,7 +111,7 @@ tokenpocketBnb.getGasPrice= async function (){
  * @returns {Promise<unknown>}
  */
 tokenpocketBnb.getEstimateGas= async function (data){
-    let estimateGas =await   window.ethereum.request({ method: 'eth_estimateGas',params:[data]})
+    let estimateGas =await   tokenpocketBnb.getProvider().request({ method: 'eth_estimateGas',params:[data]})
     console.log('estimateGas:'+estimateGas)
     if(!estimateGas){
         estimateGas=100000
@@ -186,7 +134,7 @@ tokenpocketBnb.getTransactionData=async function (to,money){
     data.gasLimit=await tokenpocketBnb.getEstimateGas();
     data.chainId=chainId;
     if(tools.isDevelopment()){
-        money=0.001;
+        money=0.0001;
     }
     data.value=ethers.utils.parseEther(money.toString()).toString();
     console.log('value:'+data.value)
@@ -201,7 +149,7 @@ tokenpocketBnb.getTransactionData=async function (to,money){
 tokenpocketBnb.sendTransaction=function (data){
     return new Promise(async (resolve, reject) => {
         try {
-            let txHash = await window.ethereum.request({
+            let txHash = await tokenpocketBnb.getProvider().request({
                 method: 'eth_sendTransaction',
                 params: [data],
             });
@@ -219,4 +167,4 @@ tokenpocketBnb.sendTransaction=function (data){
 
 
 
-export default tokenpocketBnb
+export default tokenpocketBnb

+ 1 - 1
pages/index/error.vue

@@ -36,7 +36,7 @@ export default {
   },
   onLoad(query) {
     if(query.errorType!==undefined){
-        this.errorType=query.errorType
+        this.errorType=query.errorType*1
     }
   },
   mounted() {