Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: merge conflict issue in jupyter integration #319

Merged
merged 1 commit into from
Sep 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading