@peddles/sdk 0.2.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.
- package/CLAUDE_PROMPT.md +159 -0
- package/LICENSE +21 -0
- package/README.md +186 -0
- package/dist/abis.d.ts +19 -0
- package/dist/abis.d.ts.map +1 -0
- package/dist/abis.generated.d.ts +2029 -0
- package/dist/abis.generated.d.ts.map +1 -0
- package/dist/abis.generated.js +2723 -0
- package/dist/abis.generated.js.map +1 -0
- package/dist/abis.js +19 -0
- package/dist/abis.js.map +1 -0
- package/dist/artDex.d.ts +937 -0
- package/dist/artDex.d.ts.map +1 -0
- package/dist/artDex.js +155 -0
- package/dist/artDex.js.map +1 -0
- package/dist/client.d.ts +10 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +2 -0
- package/dist/client.js.map +1 -0
- package/dist/clog.d.ts +75 -0
- package/dist/clog.d.ts.map +1 -0
- package/dist/clog.js +91 -0
- package/dist/clog.js.map +1 -0
- package/dist/clogInflow.d.ts +136 -0
- package/dist/clogInflow.d.ts.map +1 -0
- package/dist/clogInflow.js +177 -0
- package/dist/clogInflow.js.map +1 -0
- package/dist/deployments.d.ts +30 -0
- package/dist/deployments.d.ts.map +1 -0
- package/dist/deployments.generated.d.ts +92 -0
- package/dist/deployments.generated.d.ts.map +1 -0
- package/dist/deployments.generated.js +93 -0
- package/dist/deployments.generated.js.map +1 -0
- package/dist/deployments.js +52 -0
- package/dist/deployments.js.map +1 -0
- package/dist/feeSplit.d.ts +54 -0
- package/dist/feeSplit.d.ts.map +1 -0
- package/dist/feeSplit.js +69 -0
- package/dist/feeSplit.js.map +1 -0
- package/dist/feeTerms.d.ts +46 -0
- package/dist/feeTerms.d.ts.map +1 -0
- package/dist/feeTerms.js +80 -0
- package/dist/feeTerms.js.map +1 -0
- package/dist/index.d.ts +102 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +108 -0
- package/dist/index.js.map +1 -0
- package/dist/launch/abi.generated.d.ts +2667 -0
- package/dist/launch/abi.generated.d.ts.map +1 -0
- package/dist/launch/abi.generated.js +2472 -0
- package/dist/launch/abi.generated.js.map +1 -0
- package/dist/launch/addresses.d.ts +24 -0
- package/dist/launch/addresses.d.ts.map +1 -0
- package/dist/launch/addresses.js +35 -0
- package/dist/launch/addresses.js.map +1 -0
- package/dist/launch/feeTerms.d.ts +52 -0
- package/dist/launch/feeTerms.d.ts.map +1 -0
- package/dist/launch/feeTerms.js +72 -0
- package/dist/launch/feeTerms.js.map +1 -0
- package/dist/launch/index.d.ts +33 -0
- package/dist/launch/index.d.ts.map +1 -0
- package/dist/launch/index.js +24 -0
- package/dist/launch/index.js.map +1 -0
- package/dist/launch/revert.d.ts +23 -0
- package/dist/launch/revert.d.ts.map +1 -0
- package/dist/launch/revert.js +169 -0
- package/dist/launch/revert.js.map +1 -0
- package/dist/launch/salt.d.ts +90 -0
- package/dist/launch/salt.d.ts.map +1 -0
- package/dist/launch/salt.js +153 -0
- package/dist/launch/salt.js.map +1 -0
- package/dist/launch/stockCall.d.ts +122 -0
- package/dist/launch/stockCall.d.ts.map +1 -0
- package/dist/launch/stockCall.js +144 -0
- package/dist/launch/stockCall.js.map +1 -0
- package/dist/launch/tickMath.d.ts +39 -0
- package/dist/launch/tickMath.d.ts.map +1 -0
- package/dist/launch/tickMath.js +109 -0
- package/dist/launch/tickMath.js.map +1 -0
- package/dist/launch/variants.d.ts +64 -0
- package/dist/launch/variants.d.ts.map +1 -0
- package/dist/launch/variants.js +131 -0
- package/dist/launch/variants.js.map +1 -0
- package/dist/launch/wethCall.d.ts +133 -0
- package/dist/launch/wethCall.d.ts.map +1 -0
- package/dist/launch/wethCall.js +173 -0
- package/dist/launch/wethCall.js.map +1 -0
- package/dist/launch/wethPlan.d.ts +71 -0
- package/dist/launch/wethPlan.d.ts.map +1 -0
- package/dist/launch/wethPlan.js +146 -0
- package/dist/launch/wethPlan.js.map +1 -0
- package/dist/perps/abi.generated.d.ts +794 -0
- package/dist/perps/abi.generated.d.ts.map +1 -0
- package/dist/perps/abi.generated.js +738 -0
- package/dist/perps/abi.generated.js.map +1 -0
- package/dist/perps/index.d.ts +160 -0
- package/dist/perps/index.d.ts.map +1 -0
- package/dist/perps/index.js +147 -0
- package/dist/perps/index.js.map +1 -0
- package/package.json +105 -0
- package/src/abis.generated.ts +2738 -0
- package/src/abis.ts +35 -0
- package/src/artDex.ts +254 -0
- package/src/client.ts +10 -0
- package/src/clog.ts +171 -0
- package/src/clogInflow.ts +217 -0
- package/src/deployments.generated.ts +98 -0
- package/src/deployments.ts +60 -0
- package/src/feeSplit.ts +76 -0
- package/src/feeTerms.ts +137 -0
- package/src/index.ts +233 -0
- package/src/launch/abi.generated.ts +2481 -0
- package/src/launch/addresses.ts +58 -0
- package/src/launch/feeTerms.ts +93 -0
- package/src/launch/index.ts +93 -0
- package/src/launch/revert.ts +188 -0
- package/src/launch/salt.ts +216 -0
- package/src/launch/stockCall.ts +223 -0
- package/src/launch/tickMath.ts +139 -0
- package/src/launch/variants.ts +183 -0
- package/src/launch/wethCall.ts +240 -0
- package/src/launch/wethPlan.ts +257 -0
- package/src/perps/abi.generated.ts +741 -0
- package/src/perps/index.ts +263 -0
package/CLAUDE_PROMPT.md
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
# Integrate Peddles into your app — a prompt for Claude (or any coding agent)
|
|
2
|
+
|
|
3
|
+
Copy everything between the lines below into Claude Code, Cursor, or any coding agent working in
|
|
4
|
+
your repository. It gives the agent the SDK's surface and the rules a correct Peddles integration
|
|
5
|
+
has to follow, so it can wire Peddles in without guessing.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
You are integrating **Peddles** into this codebase using the `@peddles/sdk` TypeScript package
|
|
10
|
+
(`npm i @peddles/sdk`, peer dependency `viem@^2`; source at github.com/peddles-markets/peddles-sdk). Peddles is a multi-chain
|
|
11
|
+
launchpad for memecoins paired against **tokenised stocks** or ETH, on **Uniswap v4**, where every
|
|
12
|
+
launch pool runs through one fee hook with terms fixed forever at launch. It also runs a **perp
|
|
13
|
+
launchpad**: a coin whose v4 pool carries leveraged longs and shorts (Base and Robinhood Chain). Website: https://peddles.xyz ·
|
|
14
|
+
docs: https://docs.peddles.xyz.
|
|
15
|
+
|
|
16
|
+
## What to build
|
|
17
|
+
|
|
18
|
+
Ask me which of these I want before writing code, then build only those:
|
|
19
|
+
|
|
20
|
+
1. **Read** — show a launched token: name, symbol, decimals, supply, pool terms (tax, holder split),
|
|
21
|
+
holder rewards, clog state.
|
|
22
|
+
2. **Launch** — let a user create a coin (ETH-paired, stock-paired, or Clog) and sign it in their own
|
|
23
|
+
wallet.
|
|
24
|
+
3. **Trade links / discovery** — link tokens to their chain explorer and to https://peddleswap.xyz or
|
|
25
|
+
https://terminal.peddles.xyz.
|
|
26
|
+
4. **NFT graduation** — Art→DEX / NFT→stock graduation requests and NFT-holder fee claims.
|
|
27
|
+
5. **Perp market launch** — let a user create a perp market (`PeddlesPerpFactory.create`) and sign it.
|
|
28
|
+
|
|
29
|
+
## Install
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm i @peddles/sdk viem
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## The SDK surface you will use
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
// Root export: address book, reads, fee maths, ABIs, clog + NFT helpers
|
|
39
|
+
import {
|
|
40
|
+
supportedChains, isKnownChain, addressOf, deploymentFor, DEPLOYMENTS,
|
|
41
|
+
UnknownChainError, UnknownContractError,
|
|
42
|
+
getTokenInfo, isVariantSupported, getPoolTerms, PoolTermsUnavailableError,
|
|
43
|
+
feeSplit, PLATFORM_FEE_BPS, CREATOR_FEE_BPS, MIN_CREATOR_TAX_BPS, MAX_CREATOR_TAX_BPS,
|
|
44
|
+
getVariantAllocation, getClogVault, getClogState, isReleaseReady, clogShareOfInflows,
|
|
45
|
+
relayParamsHash, stockGraduationOptInRequest, graduateToStockWithTermsRequest, graduateAndBuyRequest,
|
|
46
|
+
getHolderCommitment, getDistributorState, holderClaimable,
|
|
47
|
+
factoryAbi, feeHookAbi, stockLaunchpadAbi, erc20Abi, tokenV20Abi, holderRewardsAbi, /* … */
|
|
48
|
+
} from '@peddles/sdk';
|
|
49
|
+
|
|
50
|
+
// Launch builders: everything needed to produce an UNSIGNED launch tx { to, data, value }
|
|
51
|
+
import {
|
|
52
|
+
launchAddressesFor, buildWethLaunchPlan, buildWethLaunchCall, encodeWethLaunchCall,
|
|
53
|
+
readOrchestratorLaunchFee, buildStockLaunchCall, encodeStockLaunchCall, encodeStockApproval,
|
|
54
|
+
readStockAllowance, readStockLaunchFee, readStockQuotes, isQuoteAllowed, predictStockCoin,
|
|
55
|
+
randomSalt, mineSalt, validateFeeTerms, feeSplitRate, parseTaxPercent, formatTaxPercent,
|
|
56
|
+
readLaunchVariants, variantForType, decodeLaunchRevert, explainLaunchRevert,
|
|
57
|
+
} from '@peddles/sdk/launch';
|
|
58
|
+
|
|
59
|
+
// Perps: the perp launchpad (PeddlesPerpFactory) — addresses, live base reads, create calldata
|
|
60
|
+
import {
|
|
61
|
+
perpChains, hasPerps, perpContracts, PerpsUnavailableError, readPerpBase,
|
|
62
|
+
isValidPerpHookAddress, predictPerpHook, predictPerpToken, buildPerpCreate,
|
|
63
|
+
perpFactoryAbi, perpErrorsAbi, PERP_HOOK_FLAGS,
|
|
64
|
+
} from '@peddles/sdk/perps';
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Read the package's `README.md` and the `.d.ts` files in `node_modules/@peddles/sdk/dist` for exact
|
|
68
|
+
signatures before calling anything; do not invent parameters.
|
|
69
|
+
|
|
70
|
+
## Chains — resolve everything from the active chain, never hardcode one
|
|
71
|
+
|
|
72
|
+
- Live today: **Base 8453 (mainnet)** and **Robinhood Chain 4663 (mainnet)**. Coming soon: Arc 5042, BNB Smart Chain 56. `supportedChains()` is the source of truth — call it, don't copy
|
|
73
|
+
this list.
|
|
74
|
+
- Take the chain from the user's wallet / app config. If `isKnownChain(chainId)` is false, **disable the
|
|
75
|
+
Peddles feature and say so**; never fall back to another chain's addresses. The same contract name has
|
|
76
|
+
a different address on every chain, and a router or token address from one chain used on another is a
|
|
77
|
+
real-money bug.
|
|
78
|
+
- External addresses (WETH, Uniswap PoolManager, stock tokens) differ per chain too — read them from the
|
|
79
|
+
chain (the launch plan does this: `buildWethLaunchPlan` reads the pool manager, WETH and hook from the
|
|
80
|
+
liquidity executor) rather than pasting constants.
|
|
81
|
+
- Block times differ (Base ~2 s, Robinhood Chain counts Ethereum L1 blocks inside the EVM). Never convert
|
|
82
|
+
"blocks" to time with another chain's number.
|
|
83
|
+
|
|
84
|
+
## Money rules — these are not optional
|
|
85
|
+
|
|
86
|
+
1. **Never use a JS `number` for token amounts, prices or balances.** Use `bigint` in base units
|
|
87
|
+
everywhere; the SDK returns `bigint`. Convert with `viem`'s `parseUnits` / `formatUnits` only at the
|
|
88
|
+
input and render edges.
|
|
89
|
+
2. **Every amount travels with its `decimals`.** Never assume 18: Coinbase B20 stock tokens on Base are
|
|
90
|
+
**8 decimals**, Robinhood stock tokens 18, USDG 6. `getTokenInfo()` returns decimals with the supply.
|
|
91
|
+
3. **A tokenised stock is priced by its multiplier**, never one-to-one with the share
|
|
92
|
+
(`uiMultiplier()` on Robinhood/bStocks, `toScaledBalance()` on B20). Unknown price = show nothing.
|
|
93
|
+
4. **Never invent a price or fall back to a stale one.** If a price source fails, render "unavailable".
|
|
94
|
+
|
|
95
|
+
## Read order — chain first, API second
|
|
96
|
+
|
|
97
|
+
- Read name, symbol, decimals, total supply, pool terms and lock status **from the chain** (the SDK's
|
|
98
|
+
read helpers do). A token page must work the moment the launch transaction confirms.
|
|
99
|
+
- Use an off-chain API only for what the chain can't answer (logo, description, 24h volume, candles),
|
|
100
|
+
and when both answer, the chain wins.
|
|
101
|
+
- Batch reads (`client.multicall`) and cache per block; don't hammer the RPC on every render.
|
|
102
|
+
|
|
103
|
+
## Launching — the user signs, your code never holds keys
|
|
104
|
+
|
|
105
|
+
- Build an **unsigned** tx with the SDK (`encodeWethLaunchCall` / `encodeStockLaunchCall` return
|
|
106
|
+
`{ to, data, value }`) and hand it to the user's wallet. Never ask for or store a private key.
|
|
107
|
+
- **Read the launch fee from the chain** (`readOrchestratorLaunchFee`, `readStockLaunchFee`) — it is
|
|
108
|
+
owner-set per chain and changes; never hardcode it. Show it to the user before they sign.
|
|
109
|
+
- **Fee terms are permanent.** `taxBps` (100–1000 = 1–10% all-in) and `excessToCreatorBps` are fixed in
|
|
110
|
+
the launch transaction and nobody can change them afterwards. Validate with `validateFeeTerms()` and
|
|
111
|
+
show the user the split from `feeSplitRate()` before they commit; say plainly that it is permanent.
|
|
112
|
+
- Stock-paired launches: offer only quotes from `readStockQuotes()` / `isQuoteAllowed()`, and handle the
|
|
113
|
+
ERC-20 approval (`readStockAllowance` → `encodeStockApproval`) before the launch tx.
|
|
114
|
+
- Check `isVariantSupported(client, chainId, variant)` before offering a launch type; a type that is not
|
|
115
|
+
registered on the chain must not be offered.
|
|
116
|
+
- On failure, show `decodeLaunchRevert(error)` / `explainLaunchRevert(...)` — a reason in words, not a hex
|
|
117
|
+
blob. Never report success until the receipt says `status: success`.
|
|
118
|
+
|
|
119
|
+
## Perps — launching a perp market
|
|
120
|
+
|
|
121
|
+
- Perps exist only where `hasPerps(chainId)` is true (Base 8453, Robinhood Chain 4663).
|
|
122
|
+
`perpContracts(chainId)` throws on any other chain: disable the feature, never borrow another chain's
|
|
123
|
+
factory.
|
|
124
|
+
- **Read the base live.** `readPerpBase(client, chainId, base)` returns `{ allowed, v, tickWidth }` as
|
|
125
|
+
bigints. Offer a base only while `allowed` is true; the creator has no curve choice, every market on a
|
|
126
|
+
base uses the factory's `v`/`tickWidth`. `baseCandidates` in `perpContracts()` is a list to ask about,
|
|
127
|
+
not an answer.
|
|
128
|
+
- **You mine the hook salt.** Read `tokenInitCodeHash(name, symbol, tokenUri)` and then
|
|
129
|
+
`hookInitCodeHash(token)` from the factory, loop `predictPerpHook(hookDeployer, salt, hash)` from a
|
|
130
|
+
random 32-byte salt until `isValidPerpHookAddress(address)` (≈16k attempts — do it in a Web Worker),
|
|
131
|
+
then confirm both addresses with the factory's `predictToken` / `predictHook` before building.
|
|
132
|
+
- `buildPerpCreate({...})` returns `{ to, data, value: 0n }`. `create` is not payable. An optional
|
|
133
|
+
`seedBuyBase` (bigint, base units) is pulled with `transferFrom`: approve exactly that amount to the
|
|
134
|
+
factory first, never an unlimited approval. Simulate before asking the user to sign; decode failures
|
|
135
|
+
with `perpErrorsAbi`.
|
|
136
|
+
- Name, symbol and token URI are permanent. Perp contracts have no external audit — say so where a user
|
|
137
|
+
commits money.
|
|
138
|
+
|
|
139
|
+
## UI rules
|
|
140
|
+
|
|
141
|
+
- Token metadata (name, symbol, description, links, images) is **user-supplied and hostile**: escape it,
|
|
142
|
+
never use `dangerouslySetInnerHTML`, and label it "creator-supplied" where a user might trust it.
|
|
143
|
+
- Show what costs money and what is permanent (launch fee, fee terms, dev buy). Don't show internal
|
|
144
|
+
contract names or mechanism to end users.
|
|
145
|
+
- The first ~3 minutes of every pool carry a decaying **anti-sniper tax (20% → the pool's normal tax)**;
|
|
146
|
+
if your UI quotes a trade in that window, include it.
|
|
147
|
+
|
|
148
|
+
## Done means
|
|
149
|
+
|
|
150
|
+
- Type-checks with `strict`, no `any` on SDK values, no `number` for amounts.
|
|
151
|
+
- A test or script that **reads live chain state** through your integration (e.g. `getTokenInfo` on a real
|
|
152
|
+
Base token) — a check that passes with the network unplugged hasn't tested anything.
|
|
153
|
+
- Unknown chain, unknown token and RPC failure each render an honest, specific state instead of a
|
|
154
|
+
default.
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
*Maintained with the SDK at https://github.com/peddles-markets/peddles-sdk. Found a mismatch between this
|
|
159
|
+
prompt and the SDK? The SDK's types win — please open an issue.*
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Peddles
|
|
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,186 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/peddles-markets/peddles-sdk/main/.github/og.png" alt="Peddles — Multi Chain Stock Pairs Launchpad" width="100%" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
# Peddles SDK
|
|
6
|
+
|
|
7
|
+
TypeScript SDK for **[Peddles](https://peddles.xyz)** — the multi-chain launchpad for memecoins
|
|
8
|
+
**paired against tokenised stocks** (and ETH), with a fixed-at-launch fee model, a built-in
|
|
9
|
+
anti-sniper tax and holder rewards paid in the pool's own quote asset.
|
|
10
|
+
|
|
11
|
+
Read launches from the chain, build launch transactions for your users to sign, and decode what
|
|
12
|
+
went wrong when one reverts — with the same code the Peddles app runs.
|
|
13
|
+
|
|
14
|
+
- 🌐 **Website:** [peddles.xyz](https://peddles.xyz) · **App:** [pro.peddles.xyz](https://pro.peddles.xyz) · **Swap:** [peddleswap.xyz](https://peddleswap.xyz) · **Terminal:** [terminal.peddles.xyz](https://terminal.peddles.xyz)
|
|
15
|
+
- 📚 **Docs:** [docs.peddles.xyz](https://docs.peddles.xyz) · **Developers:** [dev.peddles.xyz](https://dev.peddles.xyz)
|
|
16
|
+
- 🤖 **Integrating with an AI coding agent?** Paste [`CLAUDE_PROMPT.md`](./CLAUDE_PROMPT.md) into Claude (or any agent).
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Chains
|
|
21
|
+
|
|
22
|
+
| Chain | Chain id | Status | Explorer |
|
|
23
|
+
| --- | --- | --- | --- |
|
|
24
|
+
| **Base** | 8453 | ✅ Live — mainnet | [base.blockscout.com](https://base.blockscout.com) · [basescan.org](https://basescan.org) |
|
|
25
|
+
| **Robinhood Chain** | 4663 | ✅ Live — mainnet | [robin.etherscan.io](https://robin.etherscan.io) |
|
|
26
|
+
| Arc | 5042 | 🔜 Coming soon | — |
|
|
27
|
+
| BNB Smart Chain | 56 | 🔜 Coming soon | [bscscan.com](https://bscscan.com) |
|
|
28
|
+
|
|
29
|
+
The SDK ships an address book **only for chains with a live deployment**. `supportedChains()` is the
|
|
30
|
+
source of truth; a chain that is not in it throws `UnknownChainError` rather than falling back to
|
|
31
|
+
another chain's addresses. Every address in `DEPLOYMENTS` was confirmed to have code on its chain
|
|
32
|
+
before it was published (`npm run smoke` re-checks them live).
|
|
33
|
+
|
|
34
|
+
## What Peddles does (what you can build on)
|
|
35
|
+
|
|
36
|
+
| Feature | What it is |
|
|
37
|
+
| --- | --- |
|
|
38
|
+
| **Stock-paired launches** | A coin whose pool is paired against a tokenised stock (Coinbase B20 on Base, Robinhood tokens on 4663, bStocks on BSC). Holders are rewarded in that stock. |
|
|
39
|
+
| **ETH-paired launches** | The classic shape — a coin paired against WETH on Uniswap v4. |
|
|
40
|
+
| **Clog launches** | A launch type that holds back a slice of supply and releases it into the pool in small, time-spaced slices (≤ 3 hours for the whole clog). |
|
|
41
|
+
| **Handle launches** | Launches whose creator fees accrue to an X (Twitter) account's pot, claimable by that account. |
|
|
42
|
+
| **NFT bonding → DEX** | NFT collections sold on a bonding curve that graduate automatically into a DEX pool when they sell out. |
|
|
43
|
+
| **Art → DEX / NFT → stock graduation** | Collections graduating into a stock-paired coin, with an optional share of fees committed to NFT holders. |
|
|
44
|
+
| **One fee model, fixed at launch** | Every launch pool runs through `PeddlesFeeHook`: the creator picks an all-in tax (1–10%) and the split of the excess between themselves and holders **in the launch transaction**, and nobody can change either afterwards. |
|
|
45
|
+
| **Anti-sniper opening tax** | 20% on the first block, decaying to the pool's normal tax over ~3 minutes. The creator's own buy in the launch transaction pays the normal rate. |
|
|
46
|
+
| **Holder rewards** | Paid in the pool's quote asset (a TSLA-paired coin pays TSLA), deployed and bound inside the launch transaction. |
|
|
47
|
+
| **Uniswap v4 venue** | Pools are native Uniswap v4 pools, identified by the Peddles fee hook address. |
|
|
48
|
+
| **Perps** | A perp launchpad (`PeddlesPerpFactory`) on **Base** and **Robinhood Chain**: one transaction launches a coin whose v4 pool carries leveraged longs and shorts against its own liquidity. See [Perps](#perps). |
|
|
49
|
+
|
|
50
|
+
Fee legs (constants in the contract, exposed by the SDK): **0.50% platform + 0.50% creator** are fixed
|
|
51
|
+
inside every pool's tax; everything above them is split between the creator and holders at the
|
|
52
|
+
creator's chosen ratio. `feeSplit()` computes it exactly.
|
|
53
|
+
|
|
54
|
+
## Install
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
npm i @peddles/sdk viem
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
`viem` (v2) is a peer dependency. The package is ESM and ships its TypeScript types.
|
|
61
|
+
|
|
62
|
+
## Quick start
|
|
63
|
+
|
|
64
|
+
```ts
|
|
65
|
+
import { createPublicClient, http } from 'viem';
|
|
66
|
+
import { base } from 'viem/chains';
|
|
67
|
+
import { supportedChains, addressOf, getTokenInfo, getPoolTerms, feeSplit } from '@peddles/sdk';
|
|
68
|
+
|
|
69
|
+
const client = createPublicClient({ chain: base, transport: http() });
|
|
70
|
+
|
|
71
|
+
supportedChains(); // [4663, 8453]
|
|
72
|
+
addressOf(8453, 'PeddlesFactoryV20'); // 0x90bD4d38F621529b4aD6480c221075B7317b1978
|
|
73
|
+
|
|
74
|
+
// Identity and supply, read from the token itself — never assume 18 decimals.
|
|
75
|
+
const info = await getTokenInfo(client, token);
|
|
76
|
+
|
|
77
|
+
// The pool's permanent terms (tax, holder split, rewards distributor), read from the fee hook.
|
|
78
|
+
const terms = await getPoolTerms(client, 8453, token);
|
|
79
|
+
|
|
80
|
+
// Exactly where a fee goes. bigint in, bigint out — no floating point anywhere.
|
|
81
|
+
const split = feeSplit(terms.creatorTaxBps, terms.excessToCreatorBps, 1_000_000n);
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Build a launch for a user to sign (ETH-paired)
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
import {
|
|
88
|
+
launchAddressesFor, buildWethLaunchPlan, buildWethLaunchCall, encodeWethLaunchCall,
|
|
89
|
+
readOrchestratorLaunchFee, randomSalt, validateFeeTerms, decodeLaunchRevert,
|
|
90
|
+
} from '@peddles/sdk/launch';
|
|
91
|
+
|
|
92
|
+
const addresses = launchAddressesFor(8453);
|
|
93
|
+
const salt = randomSalt(); // or mineSalt({...}) for a vanity `…1978` token address, like the Peddles app
|
|
94
|
+
const plan = await buildWethLaunchPlan(client, addresses, { salt, variant: 0 }); // 0 = plain launch
|
|
95
|
+
const { launchFee: launchFeeWei } = await readOrchestratorLaunchFee(client, addresses.orchestrator); // read, never assumed
|
|
96
|
+
|
|
97
|
+
const feeTerms = { taxBps: 300n, excessToCreatorBps: 5000n }; // 3%, half the excess to holders
|
|
98
|
+
const issue = validateFeeTerms(feeTerms); // null when valid
|
|
99
|
+
if (issue) throw new Error(`${issue.field}: ${issue.code}`);
|
|
100
|
+
|
|
101
|
+
const call = buildWethLaunchCall(
|
|
102
|
+
{ name: 'My Coin', symbol: 'MINE', salt, creator: user, feeTerms,
|
|
103
|
+
metadata: { contractUri: '', image: 'ipfs://…', website: '', x: '', telegram: '' },
|
|
104
|
+
plan, devBuyWei: 0n, minTokensOut: 0n, launchFeeWei },
|
|
105
|
+
addresses.orchestrator,
|
|
106
|
+
);
|
|
107
|
+
const tx = encodeWethLaunchCall(call, addresses.orchestrator); // { to, data, value } — hand to the wallet
|
|
108
|
+
|
|
109
|
+
// If it reverts, say why in words:
|
|
110
|
+
try { /* send tx */ } catch (e) { console.log(decodeLaunchRevert(e)); }
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Stock-paired launches use `buildStockLaunchCall` / `encodeStockLaunchCall` with `readStockQuotes()`
|
|
114
|
+
(the whitelisted stock legs) and `readStockLaunchFee()`. Clog and NFT helpers live in the root export
|
|
115
|
+
(`getClogState`, `clogShareOfInflows`, `graduateAndBuyRequest`, …).
|
|
116
|
+
|
|
117
|
+
## Perps
|
|
118
|
+
|
|
119
|
+
```ts
|
|
120
|
+
import {
|
|
121
|
+
perpContracts, readPerpBase, predictPerpToken, predictPerpHook,
|
|
122
|
+
isValidPerpHookAddress, buildPerpCreate, perpFactoryAbi,
|
|
123
|
+
} from '@peddles/sdk/perps';
|
|
124
|
+
|
|
125
|
+
const { factory, hookDeployer, baseCandidates } = perpContracts(8453); // or 4663; throws elsewhere
|
|
126
|
+
|
|
127
|
+
// Is the base open for launches, and on what curve? Read live — never from a file.
|
|
128
|
+
const weth = await readPerpBase(client, 8453, baseCandidates.WETH);
|
|
129
|
+
if (!weth.allowed) throw new Error('perp launches on WETH are closed on this chain');
|
|
130
|
+
|
|
131
|
+
// 1. The token address (any salt works).
|
|
132
|
+
const tokenSalt = randomBytes32();
|
|
133
|
+
const tokenHash = await client.readContract({ address: factory, abi: perpFactoryAbi,
|
|
134
|
+
functionName: 'tokenInitCodeHash', args: [name, symbol, tokenUri] });
|
|
135
|
+
const token = predictPerpToken(factory, tokenSalt, tokenHash);
|
|
136
|
+
|
|
137
|
+
// 2. MINE the hook salt: v4 reads a hook's permissions from the low 14 bits of its address.
|
|
138
|
+
const hookHash = await client.readContract({ address: factory, abi: perpFactoryAbi,
|
|
139
|
+
functionName: 'hookInitCodeHash', args: [token] });
|
|
140
|
+
let hookSalt = randomBytes32(), hook = predictPerpHook(hookDeployer, hookSalt, hookHash);
|
|
141
|
+
while (!isValidPerpHookAddress(hook)) { // ~16k attempts on average — run it in a Web Worker
|
|
142
|
+
hookSalt = increment(hookSalt);
|
|
143
|
+
hook = predictPerpHook(hookDeployer, hookSalt, hookHash);
|
|
144
|
+
}
|
|
145
|
+
// Confirm both with the factory's own predictToken / predictHook before building.
|
|
146
|
+
|
|
147
|
+
// 3. The call. Not payable; a seed buy (bigint, base units) needs an exact approval to `factory` first.
|
|
148
|
+
const tx = buildPerpCreate({ chainId: 8453, name, symbol, tokenUri, base: weth.base,
|
|
149
|
+
tokenSalt, hookSalt, seedBuyBase: 0n, hookAddress: hook }); // { to, data, value: 0n }
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
The Peddles app mines in a Web Worker over a preallocated `0xff ‖ deployer ‖ salt ‖ initCodeHash`
|
|
153
|
+
buffer, bumping only the salt bytes — one keccak per attempt. Mining is left to the caller so you
|
|
154
|
+
choose where it runs. Neither salt is bound to the sender: a copied pending `create` that lands first
|
|
155
|
+
takes the addresses, and the original reverts having paid only gas.
|
|
156
|
+
|
|
157
|
+
| Chain | Perps |
|
|
158
|
+
| --- | --- |
|
|
159
|
+
| Base 8453 | ✅ Live |
|
|
160
|
+
| Robinhood Chain 4663 | ✅ Live |
|
|
161
|
+
|
|
162
|
+
The perp contracts have **no external audit**.
|
|
163
|
+
|
|
164
|
+
## Rules the SDK follows — and your integration should too
|
|
165
|
+
|
|
166
|
+
1. **Money is `bigint` in base units, always.** Never route an amount through a JS `number`. Every
|
|
167
|
+
amount travels with its `decimals`; format only at the render edge. B20 stock legs on Base are
|
|
168
|
+
**8 decimals**, Robinhood's 18, USDG 6.
|
|
169
|
+
2. **The chain is the source of truth.** Read a token's name, supply, decimals, pool terms and lock
|
|
170
|
+
status from the chain; use an API only for what the chain can't answer (logos, 24h volume, candles).
|
|
171
|
+
3. **No silent defaults.** An unknown chain, token or venue throws. Never fall back to another chain.
|
|
172
|
+
4. **A stock token is priced by its multiplier, never one-to-one with the share.**
|
|
173
|
+
5. **Metadata is user-supplied and hostile.** Escape it; never render it as HTML.
|
|
174
|
+
|
|
175
|
+
## Scripts
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
npm run build # dist/
|
|
179
|
+
npm test # unit tests, including constants pinned against the contract sources
|
|
180
|
+
npm run typecheck
|
|
181
|
+
npm run smoke # LIVE: every address in the book has code on its chain (read-only, no key)
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## License
|
|
185
|
+
|
|
186
|
+
MIT © Peddles
|
package/dist/abis.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ABI fragments the SDK's public surface needs — and nothing else.
|
|
3
|
+
*
|
|
4
|
+
* DELIBERATELY PARTIAL. These are narrowed to the functions this package
|
|
5
|
+
* exposes, not dumps of the full artifacts. A published ABI is API: every
|
|
6
|
+
* fragment shipped here is one this package promises to keep working, so the
|
|
7
|
+
* ones an integrator has no business calling (owner setters, one-shot bootstrap
|
|
8
|
+
* calls, indexer hooks) are absent rather than available-but-undocumented.
|
|
9
|
+
*
|
|
10
|
+
* NARROWED, NOT HAND-TYPED. Which names ship is decided in
|
|
11
|
+
* `script/generate-abis.mjs`; every fragment's shape is copied from the
|
|
12
|
+
* compiler's own output (`contracts/out`) into `abis.generated.ts`.
|
|
13
|
+
*
|
|
14
|
+
* `PeddlesCreatorFeeHook` is intentionally absent: it is not part of the
|
|
15
|
+
* fixed-terms fee model. Every launch pool's terms are read from
|
|
16
|
+
* `PeddlesFeeHook` (`feeHookAbi`).
|
|
17
|
+
*/
|
|
18
|
+
export { factoryAbi, clogVaultAbi, clogVaultFactoryAbi, erc20Abi, tokenV20Abi, feeHookAbi, stockLaunchpadAbi, holderRewardsAbi, nftFactoryAbi, nftCollectionAbi, nftFeeDistributorFactoryAbi, nftFeeDistributorAbi, nftBondingGraduationOrchestratorAbi, nftStockGraduationOrchestratorAbi, liquidityExecutorAbi, routeSwapRouterAbi, } from './abis.generated.js';
|
|
19
|
+
//# sourceMappingURL=abis.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abis.d.ts","sourceRoot":"","sources":["../src/abis.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EACL,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,QAAQ,EACR,WAAW,EACX,UAAU,EACV,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,2BAA2B,EAC3B,oBAAoB,EACpB,mCAAmC,EACnC,iCAAiC,EACjC,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,qBAAqB,CAAC"}
|