Skip to content

Commit

Permalink
fix merge conflict issue in jupyter integration (#319)
Browse files Browse the repository at this point in the history
Fixed 2 issues that were raised by merge conflicts and incorrectly solved
- The config object was introduced in 6c45246, but commit 517e7df missed this
- The functions loadSigner and sendTransaction were deleted in 9307ce9 but then mistakenly reintroduced in the merge commit bbd1a6
  • Loading branch information
DanielSchiavini authored Sep 30, 2024
1 parent 761c800 commit f7b4fa8
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions boa/integrations/jupyter/jupyter.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,6 @@
return response.text();
}

const loadSigner = async (address) => {
const accounts = await rpc('eth_requestAccounts');
return accounts.includes(address) ? address : accounts[0];
};

/** Sign a transaction via ethers */
const sendTransaction = async transaction => ({"hash": await rpc('eth_sendTransaction', [transaction])});

/** Wait until the transaction is mined */
const waitForTransactionReceipt = async (tx_hash, timeout, poll_latency) => {
while (true) {
Expand Down Expand Up @@ -81,7 +73,7 @@
const handleCallback = func => async (token, ...args) => {
if (!colab) {
// Check backend and whether cell was executed. In Colab, eval_js() doesn't replay.
const response = await fetch(`${base}/titanoboa_jupyterlab/callback/${token}`);
const response = await fetch(`${config.base}/titanoboa_jupyterlab/callback/${token}`);
if (response.status === 404 && response.headers.get('Content-Type') === 'application/json') {
return; // the cell has already been executed
}
Expand All @@ -108,8 +100,6 @@

// expose functions to window, so they can be called from the BrowserSigner
window._titanoboa = {
loadSigner: handleCallback(loadSigner),
sendTransaction: handleCallback(sendTransaction),
waitForTransactionReceipt: handleCallback(waitForTransactionReceipt),
rpc: handleCallback(rpc),
multiRpc: handleCallback(multiRpc),
Expand Down

0 comments on commit f7b4fa8

Please sign in to comment.