Browser usage

@beblurt/dblurt supports browser usage through the generated bundle dist/dblurt.js.

For a complete browser file, see ../examples/browser/unpkg.html.

<script src="https://unpkg.com/@beblurt/dblurt@latest/dist/dblurt.js"></script>
<script>
const rpcList = [
'https://rpc.blurt.blog',
'https://blurt-rpc.saboin.com',
'https://rpc.beblurt.com',
'https://blurtrpc.dagobert.uk',
'https://rpc.drakernoise.com'
];

const client = new dblurt.Client(rpcList);
client.condenser.getDynamicGlobalProperties()
.then(props => console.log(props.head_block_number))
.catch(console.error);
</script>

The example uses @latest so the guide does not duplicate the package version. Pin an exact version in production, and for high-risk browser applications prefer self-hosting or add Subresource Integrity when using CDN scripts.

After installing the package, serve the bundle from your own static assets:

node_modules/@beblurt/dblurt/dist/dblurt.js
node_modules/@beblurt/dblurt/dist/dblurt.d.ts

Example:

<script src="/vendor/dblurt.js"></script>

For bundler-based applications, install the package through npm:

npm install @beblurt/dblurt

Then import from the package:

import { Client } from '@beblurt/dblurt';

const client = new Client(rpcList);

package.json contains a browser mapping that points the Node entrypoint to dist/dblurt.js for browser-oriented bundling workflows.

The browser target is defined in package.json as:

defaults and supports fetch and supports abortcontroller

The runtime must provide:

  • fetch
  • AbortController

See runtime-compatibility.md for the contract tables.

Browser applications should not hard-code private keys. Prefer user-controlled wallet flows or secure user input. If your application signs directly with PrivateKey, treat that code path as security-sensitive and protect it against XSS and supply-chain risks. See Security guide.