To use your ShardeumAPI class, create an index.js (or similar) file in your project:
import shardeumAPI from './ShardeumAPI.js';

async function runExample() {
  // ... (see full example in the guide)
}

How to Run This Example (Browser-based)

  1. Save the ShardeumAPI class code as ShardeumAPI.js.
  2. Save the example usage code as index.js.
  3. Create an index.html file in the same directory (see the guide for a template).
  4. Open index.html in your web browser with MetaMask installed.
  5. Open your browser’s developer console (F12).
  6. Click the “Run Shardeum Example” button on the webpage.
You will see MetaMask pop up to request connection and then to confirm transactions. All output will be in your browser’s console.