@black-market/sdk 0.1.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/README.md +78 -20
  2. package/dist/abyss.d.ts +4 -2748
  3. package/dist/abyss.d.ts.map +1 -1
  4. package/dist/abyss.js +3 -1029
  5. package/dist/abyss.js.map +1 -1
  6. package/dist/addresses.d.ts +3 -7
  7. package/dist/addresses.d.ts.map +1 -1
  8. package/dist/addresses.js +6 -21
  9. package/dist/addresses.js.map +1 -1
  10. package/dist/auction.d.ts +2 -2
  11. package/dist/auction.d.ts.map +1 -1
  12. package/dist/auction.js +2 -2
  13. package/dist/auction.js.map +1 -1
  14. package/dist/index.d.ts +2 -0
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +2 -0
  17. package/dist/index.js.map +1 -1
  18. package/dist/launch-api.d.ts +151 -0
  19. package/dist/launch-api.d.ts.map +1 -0
  20. package/dist/launch-api.js +117 -0
  21. package/dist/launch-api.js.map +1 -0
  22. package/dist/launch.d.ts +23 -185
  23. package/dist/launch.d.ts.map +1 -1
  24. package/dist/launch.js +35 -272
  25. package/dist/launch.js.map +1 -1
  26. package/dist/lifecycle/abi.d.ts +6402 -0
  27. package/dist/lifecycle/abi.d.ts.map +1 -0
  28. package/dist/lifecycle/abi.js +331 -0
  29. package/dist/lifecycle/abi.js.map +1 -0
  30. package/dist/lifecycle/authors.d.ts +133 -0
  31. package/dist/lifecycle/authors.d.ts.map +1 -0
  32. package/dist/lifecycle/authors.js +217 -0
  33. package/dist/lifecycle/authors.js.map +1 -0
  34. package/dist/lifecycle/fork.d.ts +15 -0
  35. package/dist/lifecycle/fork.d.ts.map +1 -0
  36. package/dist/lifecycle/fork.js +36 -0
  37. package/dist/lifecycle/fork.js.map +1 -0
  38. package/dist/lifecycle/index.d.ts +10 -0
  39. package/dist/lifecycle/index.d.ts.map +1 -0
  40. package/dist/lifecycle/index.js +10 -0
  41. package/dist/lifecycle/index.js.map +1 -0
  42. package/dist/lifecycle/markets.d.ts +349 -0
  43. package/dist/lifecycle/markets.d.ts.map +1 -0
  44. package/dist/lifecycle/markets.js +184 -0
  45. package/dist/lifecycle/markets.js.map +1 -0
  46. package/dist/lifecycle/planner.d.ts +20 -0
  47. package/dist/lifecycle/planner.d.ts.map +1 -0
  48. package/dist/lifecycle/planner.js +478 -0
  49. package/dist/lifecycle/planner.js.map +1 -0
  50. package/dist/lifecycle/progress.d.ts +36 -0
  51. package/dist/lifecycle/progress.d.ts.map +1 -0
  52. package/dist/lifecycle/progress.js +441 -0
  53. package/dist/lifecycle/progress.js.map +1 -0
  54. package/dist/lifecycle/rpc.d.ts +17 -0
  55. package/dist/lifecycle/rpc.d.ts.map +1 -0
  56. package/dist/lifecycle/rpc.js +100 -0
  57. package/dist/lifecycle/rpc.js.map +1 -0
  58. package/dist/lifecycle/schema.d.ts +1096 -0
  59. package/dist/lifecycle/schema.d.ts.map +1 -0
  60. package/dist/lifecycle/schema.js +337 -0
  61. package/dist/lifecycle/schema.js.map +1 -0
  62. package/dist/lifecycle/simulation.d.ts +3 -0
  63. package/dist/lifecycle/simulation.d.ts.map +1 -0
  64. package/dist/lifecycle/simulation.js +393 -0
  65. package/dist/lifecycle/simulation.js.map +1 -0
  66. package/dist/lifecycle/types.d.ts +273 -0
  67. package/dist/lifecycle/types.d.ts.map +1 -0
  68. package/dist/lifecycle/types.js +11 -0
  69. package/dist/lifecycle/types.js.map +1 -0
  70. package/docs/launch-lifecycle.md +213 -0
  71. package/package.json +12 -3
  72. package/src/abyss.ts +3 -1059
  73. package/src/addresses.ts +9 -26
  74. package/src/auction.ts +2 -2
  75. package/src/index.ts +2 -0
  76. package/src/launch-api.ts +110 -0
  77. package/src/launch.ts +43 -411
  78. package/src/lifecycle/abi.ts +339 -0
  79. package/src/lifecycle/authors.ts +203 -0
  80. package/src/lifecycle/fork.ts +36 -0
  81. package/src/lifecycle/index.ts +9 -0
  82. package/src/lifecycle/markets.ts +204 -0
  83. package/src/lifecycle/planner.ts +393 -0
  84. package/src/lifecycle/progress.ts +367 -0
  85. package/src/lifecycle/rpc.ts +88 -0
  86. package/src/lifecycle/schema.ts +390 -0
  87. package/src/lifecycle/simulation.ts +329 -0
  88. package/src/lifecycle/types.ts +132 -0
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # @black-market/sdk
4
4
 
5
- Canonical TypeScript SDK for the Black Market protocol on [Robinhood Chain](https://robinhoodchain.blockscout.com) — Abyss DEX infrastructure, Atomic token launches, and the lending market.
5
+ Canonical TypeScript SDK for Black Market on [Robinhood Chain](https://robinhoodchain.blockscout.com): reviewed multi-market launch planning and recovery, stable-author fee APIs, optional signed metadata integration, Abyss DEX infrastructure and lending.
6
6
 
7
7
  Built on [viem](https://viem.sh). ESM-only, Node 20+.
8
8
 
@@ -34,26 +34,61 @@ const wallet = createProtocolWalletClient({
34
34
  });
35
35
  ```
36
36
 
37
- ### Atomic launches
37
+ ### Reviewed multi-market launches
38
+
39
+ The root package and browser-safe `@black-market/sdk/lifecycle` entrypoint expose the same current launch API. Select profiles from the explicit reviewed registry; template IDs are not SDK allowlists. Shared V4 uses config **4**, pool-bound V4 uses config **5**, and Abyss retains its canonical schema. Both V4 configurations explicitly commit `profileId`, `termsDigest`, stable `developerBeneficiary` and creator-selected `developerFeeBps`; bound config also commits `hookSalt` immediately before `profileId`. There is no default developer rate, conversion from old configs or old launcher compatibility path.
40
+
41
+ ```ts
42
+ import {
43
+ readLifecycleProfiles, preparePoolBoundLifecyclePlan, planLaunch,
44
+ readLaunchProgress, buildNextTransaction,
45
+ } from "@black-market/sdk/lifecycle";
46
+
47
+ const profiles = await readLifecycleProfiles({ client, orchestrator: plan.orchestrator });
48
+ // Select admitted schema/topology and copy that profile's exact envelope/terms into the plan.
49
+ const finalized = await preparePoolBoundLifecyclePlan({ client, plan });
50
+ const planned = await planLaunch({
51
+ client, account: finalized.plan.creator, plan: finalized.plan,
52
+ mode: "staged", limits, fork, // execution mode is explicit; no automatic fallback
53
+ });
54
+ const progress = await readLaunchProgress({ client, planned, receipts });
55
+ const next = await buildNextTransaction({ client, planned, receipts, limits, fork });
56
+ // No SDK operation above signs or writes to the source chain.
57
+ // A separately authenticated wallet may submit only the exact admitted next envelope.
58
+ ```
59
+
60
+ Registry authority, runtime/dependency hashes, reviewed bounds, frozen author consent, canonical oracle configuration, exact code chunks/initcode/constructor and deployer-recorded runtime provenance are verified. Hook address bits alone are not proof. One V4 market per quote is enforced across templates and topologies; an Abyss market may use the same quote.
61
+
62
+ Staged execution splits **only empty infrastructure preparation**. Minting, permanent locking, every ordered buy and public opening remain one indivisible activation. The planner uses sequential `eth_simulateV1` or an explicitly supplied separate disposable loopback fork. Unknown chain/RPC/account/calldata limits or unavailable stateful execution prevent transaction admission. Recovery rereads confirmation-bound canonical state and receipt/replacement/reorg evidence, not a cached step index; pending cancellation does not require readmission of retired profiles.
63
+
64
+ Read the [lifecycle guide](docs/launch-lifecycle.md) for exact codecs, profile discovery, execution-limit provenance, salt finalization, simulation, wallet-domain checks, recovery and V3 fee accounting.
65
+
66
+ ### Stable authors and V3 fees
38
67
 
39
68
  ```ts
40
69
  import {
41
- LAUNCH_TEMPLATES,
42
- deriveAtomicLaunchPoolRecipe,
43
- estimateAtomicLaunchInitialBuy,
44
- buildAtomicLaunchCalldata,
45
- DEFAULT_ATOMIC_LAUNCH_TARGET_MARKET_CAP_USD,
70
+ readLifecycleAuthor, readAuthorHubs, readDeveloperFees,
71
+ buildSetAuthorPayoutTransaction, buildClaimDeveloperFeesTransaction,
72
+ buildClaimDeveloperFeesPageTransaction, decodeDeveloperClaimReceipt,
46
73
  } from "@black-market/sdk";
47
74
 
48
- // Derive the one-sided launch position from a target FDV.
49
- const recipe = deriveAtomicLaunchPoolRecipe({
50
- /* … */
75
+ const author = await readLifecycleAuthor({ client, registry, authorId });
76
+ const hubs = await readAuthorHubs({ client, registry, authorId, offset: 0n, limit: 100n });
77
+ const fees = await readDeveloperFees({ client, registry, authorId, hub });
78
+ const unsigned = await buildClaimDeveloperFeesPageTransaction({
79
+ client, registry, authorId, offset: 0n, limit: 10n, assets: [],
80
+ account, chainId,
51
81
  });
52
-
53
- // Encode an Atomic launch request for the AtomicLaunchFactory.
54
- const calldata = buildAtomicLaunchCalldata(request, nativeBuyAmount);
82
+ // Execution is caller-owned. After canonical confirmation:
83
+ const result = decodeDeveloperClaimReceipt({ receipt, transaction: unsigned });
84
+ // result.cursorComplete is independent from result.paymentsSucceeded.
85
+ // Preserve result.retryableResults; advancing the discovery cursor does not pay failed rows.
55
86
  ```
56
87
 
88
+ `authorId` is the immutable economic beneficiary, while `authorPayout(authorId)` is the live payout/controller. The admin or current controller may build an unsigned routing update; direct/page claims have no caller-selected recipient. Hub authentication is anchored to `registry.core -> core.feeFactory -> factory.isHub`, never attacker hub self-reports. V3 ordinary harvest uses the exported `lifecycleFeeHubAbi` and **no-argument `claimAndSplit()`**, including current source-specific developer allocations and reserved owner/developer credits.
89
+
90
+ `LaunchApiClient` remains the optional signed metadata/image-upload/transaction-publication client. It does not sign, broadcast or choose launch economics. Its browser-native `fetch` and `globalThis.setTimeout` implementation remains browser-safe.
91
+
57
92
  ### Networks
58
93
 
59
94
  | Chain ID | Network |
@@ -64,27 +99,30 @@ const calldata = buildAtomicLaunchCalldata(request, nativeBuyAmount);
64
99
 
65
100
  `getAddresses()` defaults to the workbench chain (`46631`); pass `4663` for the canonical mainnet deployment or `31337` for a local Anvil fork.
66
101
 
67
- Deployment addresses can be overridden with environment variables, evaluated once at module load. Where an override applies, the bare name wins, then `VITE_`, then `NEXT_PUBLIC_` (e.g. `ABYSS_ROUTER` > `VITE_ABYSS_ROUTER` > `NEXT_PUBLIC_ABYSS_ROUTER`). Overrides apply to the launch-application addresses on every chain, to the Abyss infrastructure addresses on `31337` and `46631` (mainnet `4663` always uses the canonical deployment), and to the lending-market addresses on `31337` (bare + `VITE_` + `NEXT_PUBLIC_`) and `46631` (`VITE_`/`NEXT_PUBLIC_` only). The workbench RPC URL reads `VITE_RPC_URL`, then `NEXT_PUBLIC_RPC_URL`, then `RPC_URL`.
102
+ Deployment addresses can be overridden with environment variables, evaluated once at module load. Bare names win, then `VITE_`, then `NEXT_PUBLIC_`. Reviewed launch addresses (`LAUNCH_ORCHESTRATOR`, `LAUNCH_IMPLEMENTATION_REGISTRY`, `LAUNCH_FEE_OWNER_REGISTRY`) are explicit on every chain and default to zero; old launcher addresses are not fallback targets. Abyss infrastructure overrides apply on `31337`/`46631` (mainnet `4663` retains its canonical DEX deployment). Lending overrides apply on `31337` (all three prefixes) and `46631` (`VITE_`/`NEXT_PUBLIC_` only). The workbench RPC URL reads `VITE_RPC_URL`, then `NEXT_PUBLIC_RPC_URL`, then `RPC_URL`.
68
103
 
69
104
  ## Package layout
70
105
 
71
106
  | Module | Contents |
72
107
  | -------------- | --------------------------------------------------------------------- |
73
- | `addresses` | Chain definitions, canonical deployment addresses, env overrides |
108
+ | `addresses` | Chain definitions, explicit reviewed launch addresses and env overrides |
74
109
  | `abis` | Lending-market ABIs (pool, data providers, lens, oracle, vesting, …) |
75
- | `abyss` | Abyss DEX ABIs and launch-module ABIs, pool profiles, fee tiers |
76
- | `auction` | Atomic launch supply constants and paired-asset (quote) catalog |
77
- | `launch` | Launch templates, Atomic launch recipe derivation, calldata building |
110
+ | `abyss` | Unchanged Abyss DEX ABIs, pool profiles, fee tiers and wrapped-native funding |
111
+ | `auction` | Display supply and paired-asset metadata catalog (not an admission list) |
112
+ | `launch` | Pure pool geometry and initial-buy estimates (not execution proof) |
113
+ | `launch-api` | Optional signed launch metadata, upload, and publication API client |
114
+ | `lifecycle` | Reviewed schemas/ABIs, registry admission, planner/simulation/recovery and author APIs |
78
115
  | `live` | Reserve/user position normalization from lens & data-provider rows |
79
116
  | `format` | RAY/WAD math, health-factor and units formatting helpers |
80
117
  | `client` | viem public/wallet client factories |
81
118
 
82
119
  ## Examples
83
120
 
84
- Runnable offline scripts live in [`examples/`](examples/) — no RPC endpoint or wallet required. They import the built package output, so build first:
121
+ Runnable scripts live in [`examples/`](examples/). `quickstart.mjs` demonstrates current config-4 commitment bytes and pure math offline. `launch.mjs` reviews an explicit saved plan without signatures or source-chain writes. The actual lifecycle smoke requires separately authorized owned loopback fixtures.
85
122
 
86
123
  ```sh
87
- pnpm examples # pnpm build && node examples/quickstart.mjs
124
+ pnpm build
125
+ node examples/quickstart.mjs
88
126
  ```
89
127
 
90
128
  ## Development
@@ -96,6 +134,26 @@ pnpm test # build + node:test suite
96
134
  pnpm typecheck
97
135
  ```
98
136
 
137
+ ## 0.3.1 migration
138
+
139
+ - Breaking cutover to explicit lifecycle plans and signed V2 registry profiles.
140
+ Historical Atomic/Unified builders, template catalogs and old-name aliases are removed.
141
+ - V4 shared config 4 and pool-bound config 5 commit author terms and an explicit developer rate.
142
+ Old configs are rejected; no automatic conversion or compatibility fallback is provided.
143
+ - Registry admission uses `registerProfile`, reads use `profileEnvelope` / `profileId`,
144
+ and the EIP-712 domain is `Black Market Launch Registry`, version `2`.
145
+ Regenerate author consent for the exact new deployment graph.
146
+ - Pool deployment exports use `FixedFeePoolHookV1`, `PoolHookDeployerV1`,
147
+ `PoolMarketAdapterV1`, `PoolFeeCollectorDeployerV1` and `PoolFeeCollectorFactoryV1`.
148
+ Profile/dependency hash preimages and current economic tuples remain unchanged.
149
+ - The root and `/lifecycle` package entrypoints support commitment codecs, explicit
150
+ planning/recovery and stable-author V3 fee operations. No production launch deployment
151
+ or author authorization is bundled with this release.
152
+
153
+ The earlier `v0.2.0` and `v0.3.0` GitHub releases are preserved; their npm uploads failed.
154
+ Version `0.3.1` adds the matching GitHub repository metadata required by npm trusted
155
+ publishing, without changing the lifecycle API.
156
+
99
157
  ## Releasing
100
158
 
101
159
  Releases are published to npm by GitHub Actions with [trusted publishing (OIDC)](https://docs.npmjs.com/trusted-publishers) — no npm tokens are stored in this repository.