> ## 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.

# Utility Scripts

> parse-publish-output, return-testnet-dusdc.

## `parse-publish-output`

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`.

```bash theme={"system"}
pnpm env:from-publish /tmp/dp-publish.json
pnpm env:from-publish /tmp/dp-publish.json --force
```

Keys written:

* `DARKPOOL_PACKAGE_ID`
* `MARKET_REGISTRY_ID`
* `AGENT_REGISTRY_ID`
* `AUTO_REDEEM_QUEUE_ID`
* `OO_CONFIG_ID`
* `VOTE_LEDGER_ID`

Recovery path: when CLI 1.65.x emits gRPC-style JSON that the parser can't read, recover ids via `sui_getTransactionBlock` + `parse-publish-output --force`, or `scripts/finish-create-market.ts` for binary markets.

## `return-testnet-dusdc`

Sweeps testnet DUSDC from all project-controlled keypairs (agent, resolver) to `DUSDC_RETURN_ADDRESS`. Run on Jun 23 + Jun 28 to honor the 80% return commitment to the DeepBook team.

```bash theme={"system"}
pnpm return-dusdc --execute
```

**Flags**

| Flag        | Required | Description                     |
| ----------- | -------- | ------------------------------- |
| `--pct`     | no       | Percent to return (default: 80) |
| `--addr`    | no       | Override `DUSDC_RETURN_ADDRESS` |
| `--execute` | no       | Sign + submit                   |

For each keypair:

1. List all `Coin<DUSDC>` objects.
2. Merge into one (`mergeCoins`).
3. `splitCoins(80%)` to transfer to return address.

Logs per-key tx digests for audit.
