const web3js = new Web3(global_config.link_url);
const abi = that.yx_item.abi;
let myContract = new web3js.eth.Contract(
abi,
that.yx_item.contract_address
);
const code = myContract.methods.buy_ticket(that.count).encodeABI();
const yx_value = that.yx_item.ticket_price * that.count;
const tx = {
from: that.$store.state.acount,
to: that.yx_item.contract_address,
data: code,
gas: 150000,
value: yx_value,
};
const connector = new WalletConnect({
bridge: "https://bridge.walletconnect.org", // Required
qrcodeModal: QRCodeModal,
});
connector
.sendTransaction(tx)
.then((result) => {
if (result) {
that.checkDd(that.yx_item.contract_address, result);
}
})
.catch((error) => {
that.$notify.error({
title: "Error",
message: "购买失败",
});
});