@black-market/sdk 0.1.0

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 (48) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +111 -0
  3. package/dist/abis.d.ts +2573 -0
  4. package/dist/abis.d.ts.map +1 -0
  5. package/dist/abis.js +1875 -0
  6. package/dist/abis.js.map +1 -0
  7. package/dist/abyss.d.ts +3650 -0
  8. package/dist/abyss.d.ts.map +1 -0
  9. package/dist/abyss.js +1522 -0
  10. package/dist/abyss.js.map +1 -0
  11. package/dist/addresses.d.ts +211 -0
  12. package/dist/addresses.d.ts.map +1 -0
  13. package/dist/addresses.js +234 -0
  14. package/dist/addresses.js.map +1 -0
  15. package/dist/auction.d.ts +57 -0
  16. package/dist/auction.d.ts.map +1 -0
  17. package/dist/auction.js +88 -0
  18. package/dist/auction.js.map +1 -0
  19. package/dist/client.d.ts +12 -0
  20. package/dist/client.d.ts.map +1 -0
  21. package/dist/client.js +18 -0
  22. package/dist/client.js.map +1 -0
  23. package/dist/format.d.ts +15 -0
  24. package/dist/format.d.ts.map +1 -0
  25. package/dist/format.js +78 -0
  26. package/dist/format.js.map +1 -0
  27. package/dist/index.d.ts +9 -0
  28. package/dist/index.d.ts.map +1 -0
  29. package/dist/index.js +9 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/launch.d.ts +225 -0
  32. package/dist/launch.d.ts.map +1 -0
  33. package/dist/launch.js +511 -0
  34. package/dist/launch.js.map +1 -0
  35. package/dist/live.d.ts +185 -0
  36. package/dist/live.d.ts.map +1 -0
  37. package/dist/live.js +205 -0
  38. package/dist/live.js.map +1 -0
  39. package/package.json +51 -0
  40. package/src/abis.ts +1896 -0
  41. package/src/abyss.ts +1574 -0
  42. package/src/addresses.ts +342 -0
  43. package/src/auction.ts +107 -0
  44. package/src/client.ts +37 -0
  45. package/src/format.ts +73 -0
  46. package/src/index.ts +8 -0
  47. package/src/launch.ts +724 -0
  48. package/src/live.ts +393 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Black Market
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,111 @@
1
+ ![Abyss header](assets/abyss-header.png)
2
+
3
+ # @black-market/sdk
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.
6
+
7
+ Built on [viem](https://viem.sh). ESM-only, Node 20+.
8
+
9
+ ## Install
10
+
11
+ ```sh
12
+ npm install @black-market/sdk viem
13
+ # or
14
+ pnpm add @black-market/sdk viem
15
+ ```
16
+
17
+ ## Quick start
18
+
19
+ ```ts
20
+ import { createProtocolPublicClient, getAddresses, robinhoodMainnet } from "@black-market/sdk";
21
+
22
+ const client = createProtocolPublicClient({ chainId: 4663 });
23
+ const addresses = getAddresses(4663); // canonical Robinhood mainnet deployment
24
+ ```
25
+
26
+ ### Wallet client (signing)
27
+
28
+ ```ts
29
+ import { createProtocolWalletClient } from "@black-market/sdk";
30
+
31
+ const wallet = createProtocolWalletClient({
32
+ privateKey: process.env.PRIVATE_KEY as `0x${string}`,
33
+ chainId: 4663,
34
+ });
35
+ ```
36
+
37
+ ### Atomic launches
38
+
39
+ ```ts
40
+ import {
41
+ LAUNCH_TEMPLATES,
42
+ deriveAtomicLaunchPoolRecipe,
43
+ estimateAtomicLaunchInitialBuy,
44
+ buildAtomicLaunchCalldata,
45
+ DEFAULT_ATOMIC_LAUNCH_TARGET_MARKET_CAP_USD,
46
+ } from "@black-market/sdk";
47
+
48
+ // Derive the one-sided launch position from a target FDV.
49
+ const recipe = deriveAtomicLaunchPoolRecipe({
50
+ /* … */
51
+ });
52
+
53
+ // Encode an Atomic launch request for the AtomicLaunchFactory.
54
+ const calldata = buildAtomicLaunchCalldata(request, nativeBuyAmount);
55
+ ```
56
+
57
+ ### Networks
58
+
59
+ | Chain ID | Network |
60
+ | -------: | ----------------------------- |
61
+ | `4663` | Robinhood Chain mainnet |
62
+ | `46631` | Black Market workbench (fork) |
63
+ | `31337` | Local Anvil |
64
+
65
+ `getAddresses()` defaults to the workbench chain (`46631`); pass `4663` for the canonical mainnet deployment or `31337` for a local Anvil fork.
66
+
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`.
68
+
69
+ ## Package layout
70
+
71
+ | Module | Contents |
72
+ | -------------- | --------------------------------------------------------------------- |
73
+ | `addresses` | Chain definitions, canonical deployment addresses, env overrides |
74
+ | `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 |
78
+ | `live` | Reserve/user position normalization from lens & data-provider rows |
79
+ | `format` | RAY/WAD math, health-factor and units formatting helpers |
80
+ | `client` | viem public/wallet client factories |
81
+
82
+ ## Examples
83
+
84
+ Runnable offline scripts live in [`examples/`](examples/) — no RPC endpoint or wallet required. They import the built package output, so build first:
85
+
86
+ ```sh
87
+ pnpm examples # pnpm build && node examples/quickstart.mjs
88
+ ```
89
+
90
+ ## Development
91
+
92
+ ```sh
93
+ pnpm install
94
+ pnpm build # tsc → dist/
95
+ pnpm test # build + node:test suite
96
+ pnpm typecheck
97
+ ```
98
+
99
+ ## Releasing
100
+
101
+ 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.
102
+
103
+ 1. Bump `version` in `package.json` and merge to `main`.
104
+ 2. Cut a matching git tag (e.g. `v0.1.0`) and create a GitHub Release from it.
105
+ 3. The [`publish` workflow](.github/workflows/publish.yml) runs on the `release: published` event (or via manual `workflow_dispatch` with a `version` input): it builds, tests, verifies the release tag / input version equals `package.json`'s `version`, dry-run checks the tarball contents, then publishes with `npm publish --provenance --access public`.
106
+
107
+ The publish job declares `environment: npm` and `permissions: id-token: write`. Configure the **`npm` environment** in the repository settings (Settings → Environments) with required reviewers so every publish needs approval, and register this repository + workflow as a trusted publisher on npmjs.com for the `@black-market/sdk` package.
108
+
109
+ ## License
110
+
111
+ MIT