Build browser apps that can detect, connect to, and request approvals from PhotonBolt Wallet.
PhotonBolt Wallet is a browser wallet with a dApp-facing provider injected as window.photon.
It exposes a compact JavaScript API for wallet connection, account discovery, balance reads,
asset import, transaction signing, transaction broadcast, and message signing.
This portal documents the API shape currently implemented in the PhotonBolt extension codebase.
Fast Integration
Detect the extension in a few lines, prompt the user to connect, then call the provider directly from your app.
Approval Driven
Signing and sending requests open an approval popup showing network, sender, fee, amount, total spend, and change details.
Simple Public Surface
The current public methods are connect, disconnect, getAccounts, getNetwork, getBalance, getAssets, getAssetBalance, importAsset, signTransaction, sendTransaction, sendBtcFunding, payRgbInvoice, and signMessage.
Provider Shape
PhotonBolt injects a provider into normal web pages under window.photon. Your app should never assume the provider exists.
Always detect it first and handle the not-installed case cleanly.
function getPhoton() {
if (typeof window === "undefined") return null;
if (!window.photon || !window.photon.isPhoton) return null;
return window.photon;
}
const photon = getPhoton();
if (!photon) {
console.log("PhotonBolt Wallet is not installed.");
} else {
console.log("PhotonBolt Wallet detected.");
}
API Summary
| Method | Returns | Use It For |
|---|---|---|
await photon.connect() |
{ address, network, connected } |
Prompting the user to approve the current origin. |
await photon.disconnect() |
{ success: true } |
Disconnecting the current origin and clearing local dApp session state. |
await photon.getAccounts() |
string[] |
Reading the approved wallet address list for the current origin. |
await photon.getNetwork() |
"mainnet" | "testnet3" | "testnet4" | "regtest" |
Displaying or validating the active Bitcoin network. |
await photon.getBalance() |
string |
Displaying the wallet's BTC balance. |
await photon.getAssets() |
WalletAsset[] |
Reading the currently stored asset list for the active wallet and network. |
await photon.getAssetBalance({ assetId }) |
string |
Reading the balance for one imported asset by asset id, ticker, unit, or contract id. |
await photon.importAsset({ contractId }) |
{ asset, network, imported, alreadyImported } |
Adding a regtest RGB asset from the Photon registry directly into the active wallet. |
await photon.signTransaction(tx) |
signedTxHex |
Getting a signed transaction without broadcasting it. |
await photon.sendTransaction(tx) |
txid |
Preparing, approving, signing, and broadcasting a BTC transaction. |
await photon.sendBtcFunding({ address, amountSats }) |
object |
Sending explicit BTC collateral or funding to a target address with approval. |
await photon.payRgbInvoice({ invoice }) |
object |
Approving and paying an RGB Lightning invoice through the wallet on regtest. |
await photon.signMessage(message) |
signatureHex |
Requesting a deterministic message signature from the active account. |
Events
accountsChanged
Fires when the active wallet address changes or the connection is removed for your origin.
networkChanged
Fires when the wallet network changes.
const photon = window.photon;
photon.on("accountsChanged", (accounts) => {
console.log("accountsChanged", accounts);
});
photon.on("networkChanged", (network) => {
console.log("networkChanged", network);
});