> ## Documentation Index
> Fetch the complete documentation index at: https://docs.darkpool.fun/llms.txt
> Use this file to discover all available pages before exploring further.

# parse-publish

> Detailed reference for parse-publish-output.ts.

Reads `sui client publish --json` output, extracts the new package id + all shared object ids, and writes them into `.env`. Skips already-set values unless `--force`.

## Usage

```bash theme={"system"}
# Standard
sui client publish --json --gas-budget 200000000 > /tmp/dp-publish.json
pnpm env:from-publish /tmp/dp-publish.json

# Overwrite existing keys
pnpm env:from-publish /tmp/dp-publish.json --force
```

## What it reads

* `digest`. The publish tx digest.
* `objectChanges`. Looks for `published` with `packageId`, and `created` with `objectType` matching our shared objects.

## What it writes

```text theme={"system"}
DARKPOOL_PACKAGE_ID=0x21c96c85907b9aabaf770d4b663874d6fa35175176765512cac1d77d969ec5df
MARKET_REGISTRY_ID=0xc0d61bfe9849e13e315a0c5b7c0e4934c549fee352775601278bb80c601796bd
AGENT_REGISTRY_ID=0x35fe0def0ff633979ca62c9096f8833a8ecdf5cd4b946303fb2e715e98347f22
AUTO_REDEEM_QUEUE_ID=0x226e32c6f7afc9d9279fed0b617140cf671a2fd7fcfe5222cd4b472ed1dcfe6a
OO_CONFIG_ID=0x8aad284740f88bd22e2a8708c73f0733dc61941104f52c920519ee9622857ce7
VOTE_LEDGER_ID=0xde6b92c612e1b89189693352ceafb51ab275d975007724e5482bb1d780768d96
```

## Republish recipe (for future Move-source changes)

1. **Reset `Published.toml`.** Newer Sui CLI gates re-publish on this.
2. `sui client publish --json --gas-budget 200000000 > /tmp/dp-publish.json`.
3. `pnpm env:from-publish /tmp/dp-publish.json --force`.
4. Re-register markets, re-create the AccessPolicy, re-create dark-pool vault (since the package id changed):
   ```bash theme={"system"}
   pnpm market:register … --execute
   pnpm tsx scripts/create-seal-policy.ts --execute
   pnpm tsx scripts/create-darkpool-vault.ts --market wc26_euro_champion --execute
   ```
5. Restart indexer (so its package-scoped event streams attach to the new package).

## Fallback for CLI 1.65.x

CLI 1.65.x sometimes emits gRPC-style JSON that this parser can't read. Recover ids via:

```bash theme={"system"}
sui client tx-block <digest> --json | jq '.effects'
# or
pnpm env:from-publish /tmp/dp-publish.json --force
```
