Skip to content

Commit ce133e4

Browse files
committed
feat: add browser configuration options for wallet connection in NodeArweaveWallet
1 parent f2142b2 commit ce133e4

File tree

6 files changed

+272
-15
lines changed

6 files changed

+272
-15
lines changed

README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,69 @@ 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+
**Browser Options:**
85+
86+
You can specify which browser to open for wallet connection:
87+
88+
```typescript
89+
// Use a specific browser by name
90+
const wallet = new NodeArweaveWallet({ browser: 'chrome' }) // Google Chrome
91+
const wallet = new NodeArweaveWallet({ browser: 'firefox' }) // Firefox
92+
const wallet = new NodeArweaveWallet({ browser: 'safari' }) // Safari (macOS)
93+
const wallet = new NodeArweaveWallet({ browser: 'edge' }) // Microsoft Edge
94+
const wallet = new NodeArweaveWallet({ browser: 'brave' }) // Brave Browser
95+
const wallet = new NodeArweaveWallet({ browser: 'opera' }) // Opera
96+
97+
// Use a custom browser path
98+
const wallet = new NodeArweaveWallet({
99+
browser: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'
100+
})
101+
102+
// Disable auto-opening (you'll need to open the URL manually)
103+
const wallet = new NodeArweaveWallet({ browser: false })
104+
```
105+
106+
**Browser Profile Options:**
107+
108+
You can also specify a browser profile to use:
109+
110+
```typescript
111+
// Chrome/Edge/Brave - use profile directory name (NOT the display name!)
112+
const wallet = new NodeArweaveWallet({
113+
browser: 'chrome',
114+
browserProfile: 'Profile 1' // or 'Default', 'Profile 2', etc.
115+
})
116+
117+
// Firefox - use profile name
118+
const wallet = new NodeArweaveWallet({
119+
browser: 'firefox',
120+
browserProfile: 'dev-edition-default' // or your custom profile name
121+
})
122+
```
123+
124+
**Important:** The library automatically resolves display names to directory names for Chrome/Edge/Brave!
125+
126+
- **Chrome/Edge/Brave:** You can use either the display name ("Work") or directory name ("Profile 2")
127+
- **Firefox:** Use the profile name exactly as shown in the profile manager
128+
129+
**How to find your profile name:**
130+
131+
1. **Chrome/Edge/Brave:**
132+
- Open `chrome://version/` (or `edge://version/`, `brave://version/`)
133+
- Look for "Profile Path"
134+
- You can use either:
135+
- The display name shown in the browser UI: `'Work'`, `'Personal'`
136+
- The directory name (last part of path): `'Default'`, `'Profile 1'`, `'Profile 2'`
137+
138+
2. **Firefox:**
139+
- Run `firefox -P` to open the profile manager
140+
- Use the exact profile name shown (e.g., `'default-release'`, `'dev-edition-default'`)
141+
82142
#### `wallet.initialize()`
83143

84144
Starts the local server and opens the browser for wallet connection.

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)