Skip to content

Commit 22ce991

Browse files
Merge pull request #1 from pawanpaudel93/feat/browser-profiles
feat: browser profiles
2 parents bfa42a7 + 3e8a301 commit 22ce991

File tree

6 files changed

+293
-17
lines changed

6 files changed

+293
-17
lines changed

README.md

Lines changed: 69 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,13 @@ const wallet = new NodeArweaveWallet({
7676
port: 3737, // Optional: port number (default: 3737, use 0 for random)
7777
freePort: false, // Optional: auto-free port if in use (default: false)
7878
requestTimeout: 300000, // Optional: request timeout in ms (default: 5 minutes)
79+
browser: 'chrome', // Optional: specify browser (default: system default)
80+
browserProfile: 'Work', // Optional: specify browser profile
7981
})
8082
```
8183

84+
See [Configuration](#️-configuration) for more information.
85+
8286
#### `wallet.initialize()`
8387

8488
Starts the local server and opens the browser for wallet connection.
@@ -94,7 +98,7 @@ Connects to the wallet with specified permissions, app info and gateway.
9498
```typescript
9599
await wallet.connect(['ACCESS_ADDRESS', 'SIGN_TRANSACTION'], {
96100
name: 'My App',
97-
logo: 'https://example.com/logo.png',
101+
logo: 'https://arweave.net/azW8iYR5A6bPXyS6WpMmw-qLTXNleS-vv4LJDR9Hf-s',
98102
})
99103
```
100104

@@ -448,6 +452,70 @@ const wallet = new NodeArweaveWallet({
448452

449453
**Note:** The timeout applies to individual wallet operations (signing, encrypting, etc.). If the user doesn't respond within this time, the operation will fail with a timeout error.
450454

455+
**Browser Options:**
456+
457+
You can specify which browser to open for wallet connection:
458+
459+
```typescript
460+
// Use a specific browser by name
461+
const wallet = new NodeArweaveWallet({ browser: 'chrome' }) // Google Chrome
462+
const wallet = new NodeArweaveWallet({ browser: 'firefox' }) // Firefox
463+
const wallet = new NodeArweaveWallet({ browser: 'edge' }) // Microsoft Edge
464+
const wallet = new NodeArweaveWallet({ browser: 'brave' }) // Brave Browser
465+
const wallet = new NodeArweaveWallet({ browser: 'opera' }) // Opera
466+
467+
// Disable auto-opening (you'll need to open the URL manually)
468+
const wallet = new NodeArweaveWallet({ browser: false })
469+
```
470+
471+
**Browser Profile Options:**
472+
473+
You can also specify a browser profile to use:
474+
475+
```typescript
476+
// Chromium-based browsers (Chrome, Edge, Brave, Opera, Vivaldi)
477+
// Use profile directory name OR display name (auto-resolved)
478+
const wallet = new NodeArweaveWallet({
479+
browser: 'chrome',
480+
browserProfile: 'Profile 1' // or 'Default', 'Profile 2', 'Work', 'Personal', etc.
481+
})
482+
483+
// Firefox-based browsers (Firefox, Zen)
484+
// Use profile name exactly as shown in profile manager
485+
const wallet = new NodeArweaveWallet({
486+
browser: 'firefox',
487+
browserProfile: 'dev-edition-default' // or your custom profile name
488+
})
489+
490+
// Opera (Note: Opera doesn't support profile arguments, profile option is ignored)
491+
const wallet = new NodeArweaveWallet({
492+
browser: 'opera'
493+
// browserProfile is not supported for Opera
494+
})
495+
```
496+
497+
**Important:** The library automatically resolves display names to directory names for some Chromium-based browsers!
498+
499+
- **Chrome/Edge/Brave/Vivaldi:** You can use either the display name ("Work") or directory name ("Profile 2")
500+
- **Firefox/Zen:** Use the profile name exactly as shown in the profile manager
501+
- **Opera:** Profile selection is not supported (profile option is ignored)
502+
503+
**How to find your profile name:**
504+
505+
1. **Chrome/Edge/Brave/Vivaldi:**
506+
- Open `chrome://version/` (or `edge://version/`, `brave://version/`, `vivaldi://version/`)
507+
- Look for "Profile Path"
508+
- You can use either:
509+
- The display name shown in the browser UI: `'Work'`, `'Personal'`
510+
- The directory name (last part of path): `'Default'`, `'Profile 1'`, `'Profile 2'`
511+
512+
2. **Firefox/Zen:**
513+
- Run `firefox -P` (or `zen -P`) to open the profile manager
514+
- Use the exact profile name shown (e.g., `'default-release'`, `'dev-edition-default'`)
515+
516+
3. **Opera:**
517+
- Profile selection is not supported by Opera's command-line interface
518+
451519
## 💡 Usage Examples
452520

453521
### CLI Tool Example

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@
6060
"@dha-team/arbundles": "catalog:",
6161
"arweave": "catalog:",
6262
"kill-port": "catalog:",
63-
"nanoid": "catalog:"
63+
"nanoid": "catalog:",
64+
"open": "catalog:"
6465
},
6566
"devDependencies": {
6667
"@antfu/eslint-config": "catalog:cli",

pnpm-lock.yaml

Lines changed: 84 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ catalog:
1313
html-minifier-terser: ^7.2.0
1414
kill-port: ^2.0.1
1515
nanoid: ^5.1.6
16+
open: ^10.2.0
1617
prettier: ^3.6.2
1718
terser: ^5.44.0
1819

0 commit comments

Comments
 (0)