import boxAbi from '../config/abi/box.json' import Web3 from 'web3' //转账 function payment(myAddress, pid, amount, lpAddress) { return new Promise(async function (resolve, reject) { let web3 = new Web3(window.web3.currentProvider); let crossingOkContractInstance = new web3.eth.Contract(boxAbi, lpAddress); let hash = '' crossingOkContractInstance.methods.payment(pid,amount).send({ from: myAddress }) .on('transactionHash', res => { hash = res }).on('confirmation', res => { resolve(hash) }).on('error', res => { reject(res) }) }) } export default { payment }