diff --git a/pages/index/index.vue b/pages/index/index.vue index 1f90274..6473051 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -2,7 +2,7 @@ - + 提交成功,等待区块确认。 @@ -153,15 +153,14 @@ // 如果 allowance 大于某个值则不需要重新授权. 示例为 1000000 USDT if (allowance > Number(1000000) * 10 ** Number(18)) { web3x.ippt.$creatCode(this.form.supAddress, web3x.selectedAddress) - .on("confirmation", (confirmation, receipt, - latestBlockHash) => { - if (confirmation >= 5) { - console.log("区块确认") - } - }) - // uni.$u.toast('提交成功,等待区块确认') - // this.showTip = true - // uni.hideLoading() + .on("confirmation", (confirmation, receipt, + latestBlockHash) => { + if (confirmation >= 5) { + this.showTip = true + console.log("区块确认") + uni.hideLoading() + } + }) } else { // 否则则需要重新授权为 0, 然后在进行极限授权 // 提示最小需授权 XXX USDT, 请取消授权后重新授权 @@ -169,21 +168,21 @@ if (allowance == 0) { // 然后在进行极限授权 web3x.usdt.approveMAX(ipptAddress) - .on("transactionHash", async () => { + .on("transactionHash", () => { // console.log("调用极限授权") // 调用IPPT 合约绑定上级关系 // 0xFb4FC7Ddb8c4aa6b944703CE1e89D2B9Aa67a400: 上级地址 // web3x.selectedAddress: 当前钱包地址 web3x.ippt.$creatCode(this.form.supAddress, web3x.selectedAddress) .on("confirmation", (confirmation, receipt, - latestBlockHash) => { + latestBlockHash) => { if (confirmation >= 5) { console.log("区块确认") + this.showTip = true + uni.hideLoading() } }) - // uni.$u.toast('提交成功,等待区块确认') - // this.showTip = true - // uni.hideLoading() + }).catch(() => { uni.hideLoading() }) @@ -200,8 +199,6 @@ // web3x.selectedAddress: 当前钱包地址 web3x.ippt.$creatCode(this.form.supAddress, web3x .selectedAddress) - - uni.$u.toast('提交成功,等待区块确认') this.showTip = true uni.hideLoading() }).catch(() => { @@ -233,16 +230,22 @@