Skip to content

feat: setup-accounts + setup-accounts-extension scripts - #49

Merged
AquiGorka merged 1 commit into
mainfrom
feat/setup-accounts-scripts
Apr 8, 2026
Merged

feat: setup-accounts + setup-accounts-extension scripts#49
AquiGorka merged 1 commit into
mainfrom
feat/setup-accounts-scripts

Conversation

@AquiGorka

Copy link
Copy Markdown
Contributor

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:

  1. Open each extension
  2. Find the "Fund via Friendbot" button
  3. Click it
  4. Refresh chain state

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

  • `./setup-accounts.sh G...` funds an arbitrary pubkey
  • Re-running on the same pubkey reports "already funded" without erroring
  • `./setup-accounts-extension.sh` reads both wallet seed files, derives correct Stellar pubkeys, funds both via Friendbot
  • Idempotent re-run reports both as already funded
  • `deno check setup-accounts.ts setup-accounts-extension.ts` passes

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.
@AquiGorka
AquiGorka merged commit a5451b4 into main Apr 8, 2026
1 check passed
@AquiGorka
AquiGorka deleted the feat/setup-accounts-scripts branch April 8, 2026 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant