feat: setup-accounts + setup-accounts-extension scripts - #49
Merged
Conversation
Adds two opt-in account-funding scripts to the local-dev flow so the
manual browser-wallet test cycle doesn't require clicking "Fund via
Friendbot" inside each extension after every `down → up`.
setup-accounts.sh + lifecycle/setup-accounts.ts (generic)
Takes one or more Stellar public keys as args and fires Friendbot
funding requests in parallel. Idempotent — accounts already funded
are reported as such (matches "already funded", "already_exist",
and "op_already_exists" wordings since friendbot uses different
bodies on quickstart vs testnet).
Exports `fundAccounts` + `formatResults` so other scripts can
delegate to it instead of duplicating Friendbot logic.
setup-accounts-extension.sh + lifecycle/setup-accounts-extension.ts
Wallet-aware wrapper. Reads ../browser-wallet/.env.seed.user1 and
.env.seed.user2 (override via SEED_FILES env), parses each
SEED_MNEMONIC, derives the Stellar account at index 0 using
SLIP-0010 (matches `Keys.deriveStellarAccountFromMnemonic` in
browser-wallet/src/keys/keys.ts), then delegates to setup-accounts'
fundAccounts. Eliminates the manual copy-paste of Stellar pubkeys
from the wallet seed files.
The SLIP-0010 derivation is replicated inline (we can't import from
browser-wallet across repos with separate import maps). Verified to
match the wallet's derivation by deriving from the same mnemonics:
.env.seed.user1 → GAPMIPHUED74EX25HS6747PY4ZQCNM6PPBVAXHFDH2M66LE5PZ7LLIDU
.env.seed.user2 → GBRRMXSTA6OWPZYMSJARBSLLHQVGRMO7EGA63ASOSWKDJNEQU73JKZTP
After this lands, the typical manual test cycle becomes:
./down.sh && ./up.sh && ./setup-c.sh && ./setup-pp.sh && ./setup-accounts-extension.sh
No Stellar address copy-pasting, no manual Friendbot calls in the wallet UI.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds two opt-in account-funding scripts to the local-dev flow so the manual browser-wallet test cycle doesn't require clicking "Fund via Friendbot" inside each extension after every `down → up`.
`setup-accounts.sh` + `lifecycle/setup-accounts.ts` (generic)
Takes one or more Stellar public keys as args and fires Friendbot funding requests in parallel. Idempotent — accounts already funded are reported as such (matches "already funded", "already_exist", and "op_already_exists" wordings since friendbot uses different bodies on quickstart vs testnet).
Exports `fundAccounts` + `formatResults` so other scripts can delegate to it instead of duplicating Friendbot logic.
```
./setup-accounts.sh GABC... GDEF... GHIJ...
```
`setup-accounts-extension.sh` + `lifecycle/setup-accounts-extension.ts` (wallet-aware)
Reads `../browser-wallet/.env.seed.user1` and `.env.seed.user2` (override via `SEED_FILES` env), parses each `SEED_MNEMONIC`, derives the Stellar account at index 0 using SLIP-0010 (matches `Keys.deriveStellarAccountFromMnemonic` in `browser-wallet/src/keys/keys.ts`), then delegates to `setup-accounts`' `fundAccounts`. Eliminates the manual copy-paste of Stellar pubkeys from the wallet seed files.
The SLIP-0010 derivation is replicated inline (we can't import from browser-wallet across repos with separate import maps). Verified to match the wallet's derivation by deriving the same pubkeys from the same mnemonics:
```
.env.seed.user1 → GAPMIPHUED74EX25HS6747PY4ZQCNM6PPBVAXHFDH2M66LE5PZ7LLIDU
.env.seed.user2 → GBRRMXSTA6OWPZYMSJARBSLLHQVGRMO7EGA63ASOSWKDJNEQU73JKZTP
```
Why
Without this, after every `down → up` cycle the user has to:
With this, the typical manual test cycle (combined with #48 deterministic stack) becomes one chain:
```bash
./down.sh && ./up.sh && ./setup-c.sh && ./setup-pp.sh && ./setup-accounts-extension.sh
```
Then just click reload on both extensions and everything is ready.
Test plan