diff --git a/public/assets/wallet.js b/public/assets/wallet.js index fc5b88a..890562c 100644 --- a/public/assets/wallet.js +++ b/public/assets/wallet.js @@ -49,11 +49,10 @@ window.IAPWallet = (function () { return eth().request({ method: 'eth_sendTransaction', params: [tx] }); } async function waitTx(hash) { - const c = await IAP.getConfig(); + // poll our own server (CSP-friendly); it relays the receipt from the RPC for (let i = 0; i < 60; i++) { - const r = await (await fetch(c.rpc, { method: 'POST', headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'eth_getTransactionReceipt', params: [hash] }) })).json(); - if (r.result) return r.result; + const r = await (await fetch('/api/tx/' + hash)).json(); + if (r.found) return { status: r.status, blockNumber: r.blockNumber }; await new Promise(res => setTimeout(res, 2500)); } throw new Error('Timed out waiting for the transaction. Check the explorer.'); diff --git a/public/contract.html b/public/contract.html index 0136766..e6ab88e 100644 --- a/public/contract.html +++ b/public/contract.html @@ -5,7 +5,7 @@