diff --git a/docs/index.html b/docs/index.html index f02fd42..c718a70 100644 --- a/docs/index.html +++ b/docs/index.html @@ -709,17 +709,18 @@
Troubleshooting
console.log(moment().format("HH:mm:ss") + " updateApproval: " + JSON.stringify(this.modalApproval)); const provider = new ethers.providers.Web3Provider(window.ethereum); const signer = provider.getSigner(); - if (this.modalApproval.item.type == 'erc20') { - const contract = new ethers.Contract(this.modalApproval.item.contract, ERC20ABI, provider); + const item = this.modalApproval.item; + if (item.type == 'erc20') { + const contract = new ethers.Contract(item.contract, ERC20ABI, provider); const contractWithSigner = contract.connect(provider.getSigner()); try { - const tx = await contractWithSigner.approve(this.modalApproval.item.spender, ethers.utils.parseUnits(this.modalApproval.tokens, this.modalApproval.item.decimals)); + const tx = await contractWithSigner.approve(item.spender, ethers.utils.parseUnits(this.modalApproval.tokens, item.decimals)); console.log("tx: " + JSON.stringify(tx)); } catch (e) { console.log("updateApproval ERC-20.approve(...) error: " + JSON.stringify(e)); } - } else if (this.modalApproval.item.type == 'erc721' && this.modalApproval.item.approvalType == 'Approval') { - const contract = new ethers.Contract(this.modalApproval.item.contract, ERC721ABI, provider); + } else if (item.type == 'erc721' && item.approvalType == 'Approval') { + const contract = new ethers.Contract(item.contract, ERC721ABI, provider); const contractWithSigner = contract.connect(provider.getSigner()); try { const tx = await contractWithSigner.approve(this.modalApproval.spender, this.modalApproval.tokenId); @@ -727,17 +728,17 @@
Troubleshooting
} catch (e) { console.log("updateApproval ERC-721 approve(...) error: " + JSON.stringify(e)); } - } else if (this.modalApproval.item.type == 'erc721' && this.modalApproval.item.approvalType == 'ApprovalForAll') { - const contract = new ethers.Contract(this.modalApproval.item.contract, ERC721ABI, provider); + } else if (item.type == 'erc721' && item.approvalType == 'ApprovalForAll') { + const contract = new ethers.Contract(item.contract, ERC721ABI, provider); const contractWithSigner = contract.connect(provider.getSigner()); try { - const tx = await contractWithSigner.setApprovalForAll(this.modalApproval.item.spender, this.modalApproval.approved); + const tx = await contractWithSigner.setApprovalForAll(item.spender, this.modalApproval.approved); console.log("tx: " + JSON.stringify(tx)); } catch (e) { console.log("updateApproval ERC-721 setApprovalForAll(...) error: " + JSON.stringify(e)); } - } else if (this.modalApproval.item.type == 'erc1155' && this.modalApproval.item.approvalType == 'ApprovalForAll') { - const contract = new ethers.Contract(this.modalApproval.item.contract, ERC1155ABI, provider); + } else if (item.type == 'erc1155' && item.approvalType == 'ApprovalForAll') { + const contract = new ethers.Contract(item.contract, ERC1155ABI, provider); const contractWithSigner = contract.connect(provider.getSigner()); try { const tx = await contractWithSigner.setApprovalForAll(this.modalApproval.item.spender, this.modalApproval.approved);