尝试使用连接到我的智能合约的购买按钮时,出现错误“ Uncaught TypeError:无法读取null的属性'split'”。我正在重用另一个项目和开发人员的代码。有人可以建议我下一步的方向吗?
function gPOAookie(name) {
var dc = document.cookie;
var prefix = name + "=";
var begin = dc.indexOf("; " + prefix);
console.log(prefix, begin);
if (begin == -1) {
begin = dc.indexOf(prefix);
console.log(prefix, begin);
if (begin != 0) return null;
console.log(prefix, begin);
}
else
{
begin += 2;
var end = document.cookie.indexOf(";", begin);
if (end == -1) {
end = dc.length;
console.log(begin, end);
}
}
return decodeURI(dc.substring(begin + prefix.length, end));
}
function fund (address, amount) {
console.log("funding :" + amount);
// alert(gPOAookie('masternode'));
if (walletMode === 'metamask') {
contract.buy(gPOAookie('masternode').split(';')[0], {
value: convertEthToWei(amount)
}, function (e, r) {
console.log(e, r)
})
} else if (walletMode === 'web') {
call(address, 'buy', [], convertEthToWei(amount))
}
}
您可以在此处查看控制台日志和Ui https://hypereth.net/hyperexchange.html