0.1.2-beta.13 • Published 5 months ago

impersonator-iframe v0.1.2-beta.13

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

@impersonator/iframe

An iframe component that allows to open dapps with any Ethereum address impersonated.

Usage

Wrap your App in the ImpersonatorIframeProvider as follows:

import { ImpersonatorIframeProvider } from "@impersonator/iframe";

ReactDOM.createRoot(document.getElementById("root")).render(
  <React.StrictMode>
    <ImpersonatorIframeProvider>
      <App />
    </ImpersonatorIframeProvider>
  </React.StrictMode>
);

Then use the ImpersonatorIframe component to open the dapp you want to impersonate:

import {
  ImpersonatorIframe,
  useImpersonatorIframe,
} from "@impersonator/iframe";

function App() {
  const { latestTransaction } = useImpersonatorIframe();

  return (
    <>
      <ImpersonatorIframe
        width={"1000px"}
        height={"500px"}
        src="https://app.uniswap.org"
        address="0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" // vitalik.eth
        rpcUrl="https://eth.llamarpc.com"
      />
      <div>
        <h1>Latest transaction</h1>
        <pre>{JSON.stringify(latestTransaction, null, 2)}</pre>
      </div>
    </>
  );
}

The latestTransaction object from useImpersonatorIframe hook will contain the latest transaction sent by the dapp.

The hook also provides the following:

const {
  // Modify address to impersonate
  setAddress,
  // The current dapp URL
  appUrl,
  // Modify the current dapp URL
  setAppUrl,
  // Modify the RPC URL
  setRpcUrl,
  iframeRef,
  // The latest transaction sent by the dapp
  latestTransaction,
  // To approve the transaction request from the dapp
  onUserTxConfirm,
  // To reject the transaction request from the dapp
  onTxReject,
} = useImpersonatorIframe();
0.1.2-beta.13

5 months ago

0.1.2-beta.12

5 months ago

0.1.2-beta.11

5 months ago

0.1.2-beta.10

5 months ago

0.1.2-beta.9

5 months ago

0.1.2-beta.8

5 months ago

0.1.2-beta.7

5 months ago

0.1.2-beta.6

5 months ago

0.1.2-beta.5

5 months ago

0.1.2-beta.4

5 months ago

0.1.2-beta.3

5 months ago

0.1.2-beta.2

5 months ago

0.1.2-beta.1

5 months ago

0.1.2-beta.0

5 months ago

0.1.1

5 months ago