pons-client 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.
package/README.md ADDED
@@ -0,0 +1,152 @@
1
+ # @robhdev/pons-client
2
+
3
+ TypeScript client for the [Pons v2](https://docs.ponsfamily.com/v2) token launch protocol on Robinhood Chain (4663).
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @robhdev/pons-client
9
+ ```
10
+
11
+ ## Setup
12
+
13
+ ```ts
14
+ import { createPonsClient } from "@robhdev/pons-client";
15
+
16
+ // Read-only client
17
+ const pons = createPonsClient({ rpcUrl: "https://rpc.robinhood.com" });
18
+
19
+ // With wallet (for swaps, launches, claims)
20
+ const pons = createPonsClient({
21
+ rpcUrl: "https://rpc.robinhood.com",
22
+ wallet: { account, writeContract: walletClient.writeContract },
23
+ });
24
+ ```
25
+
26
+ ## Modules
27
+
28
+ ### factory
29
+
30
+ List configs, read launches, create tokens.
31
+
32
+ ```ts
33
+ const configs = await pons.factory.openLaunchConfigs();
34
+ const launch = await pons.factory.getLaunchedToken(token);
35
+ const hash = await pons.factory.launchAndBuy(params, configId, pairToken, quoteIn, recipient);
36
+ ```
37
+
38
+ ### curve
39
+
40
+ Read state, quote trades, buy/sell on bonding curve.
41
+
42
+ ```ts
43
+ const state = await pons.curve.getState(curve);
44
+ const quote = await pons.curve.quoteBuy(curve, parseEther("0.01"), recipient);
45
+ await pons.curve.buy(curve, quoteIn, minTokensOut, recipient);
46
+ await pons.curve.sell(curve, tokensIn, minQuoteOut, recipient);
47
+ ```
48
+
49
+ ### pool
50
+
51
+ Build pool keys, read pending fees.
52
+
53
+ ```ts
54
+ const poolKey = pons.pool.buildPoolKey(launch);
55
+ const poolId = pons.pool.getPoolId(launch);
56
+ const fees = await pons.pool.pendingFees(poolId, currency);
57
+ ```
58
+
59
+ ### fees
60
+
61
+ Check and claim creator fees.
62
+
63
+ ```ts
64
+ const balance = await pons.fees.getBalance(creator);
65
+ const erc20 = await pons.fees.getERC20Balance(creator, quoteAsset);
66
+ await pons.fees.claim();
67
+ await pons.fees.claimToken(quoteAsset);
68
+ ```
69
+
70
+ ### buyback
71
+
72
+ Read vesting state, release vested tokens.
73
+
74
+ ```ts
75
+ const vesting = await pons.buyback.getState(token);
76
+ await pons.buyback.release(token);
77
+ ```
78
+
79
+ ### events
80
+
81
+ Index `TokenLaunched`, `CurveBuy`/`CurveSell`, fee sweeps, takeovers.
82
+
83
+ ```ts
84
+ const launches = await pons.events.getLaunches(fromBlock);
85
+ const trades = await pons.events.getTrades(curve, fromBlock);
86
+ const proposals = await pons.events.getTakeoverProposals(fromBlock);
87
+ ```
88
+
89
+ ### takeover
90
+
91
+ Check pending creator fee recipient changes.
92
+
93
+ ```ts
94
+ const pending = await pons.takeover.getPending(token);
95
+ ```
96
+
97
+ ### migration
98
+
99
+ Read migration status, deposit, claim.
100
+
101
+ ```ts
102
+ const status = await pons.migration.getStatus(migrationAddress);
103
+ await pons.migration.deposit(migrationAddress, amount);
104
+ await pons.migration.claim(migrationAddress);
105
+ ```
106
+
107
+ ## Examples
108
+
109
+ Copy `.env.example` to `.env` and fill in your values.
110
+
111
+ | # | Command | Description | Env vars |
112
+ |---|---------|-------------|----------|
113
+ | 01 | `npx tsx examples/01-read-launch-configs.ts` | List open launch configs | `RPC_URL` |
114
+ | 02 | `npx tsx examples/02-launch-token.ts` | Launch a token (atomic) | `RPC_URL`, `PRIVATE_KEY` |
115
+ | 03 | `npx tsx examples/03-buy-sell-curve.ts` | Quote trades on curve | `RPC_URL`, `CURVE_ADDRESS` |
116
+ | 04 | `npx tsx examples/04-quote-trade.ts` | Local curve math | `RPC_URL`, `CURVE_ADDRESS` |
117
+ | 05 | `npx tsx examples/05-track-graduation.ts` | Track graduation progress | `RPC_URL`, `TOKEN_ADDRESS` |
118
+ | 06 | `npx tsx examples/06-claim-fees.ts` | Claim creator fees | `RPC_URL`, `PRIVATE_KEY`, `CREATOR_ADDRESS` |
119
+ | 07 | `npx tsx examples/07-read-vesting.ts` | Read buyback vesting | `RPC_URL`, `TOKEN_ADDRESS` |
120
+ | 08 | `npx tsx examples/08-index-events.ts` | Query historical events | `RPC_URL`, `FROM_BLOCK` |
121
+ | 09 | `npx tsx examples/09-pool-swap.ts` | Read pool state | `RPC_URL`, `TOKEN_ADDRESS` |
122
+ | 10 | `npx tsx examples/10-get-curve.ts` | Get curve from token | `RPC_URL`, `TOKEN_ADDRESS` |
123
+ | 11 | `npx tsx examples/11-swap-curve-buy.ts` | Buy tokens on curve | `RPC_URL`, `PRIVATE_KEY`, `CURVE_ADDRESS`, `BUY_AMOUNT` |
124
+ | 12 | `npx tsx examples/12-swap-curve-sell.ts` | Sell tokens to curve | `RPC_URL`, `PRIVATE_KEY`, `CURVE_ADDRESS`, `TOKEN_ADDRESS`, `SELL_AMOUNT` |
125
+
126
+ ## Contract Addresses
127
+
128
+ Robinhood Chain (4663):
129
+
130
+ | Contract | Address |
131
+ |----------|---------|
132
+ | Factory | `0x7eD598BcEf8bd9Edd8C97A195C6d13f40801EC7e` |
133
+ | Meme Hook | `0xE5e702641Ea86F4ae6cC3cDaeD2B886f976Be044` |
134
+ | Fee Escrow | `0xd3AFEB2a57f70eF218Aa82451c51B2fb0416Ac9e` |
135
+ | Buyback Vault | `0x42df2a798f82289E177311362e8f5ccC45c1219c` |
136
+ | Launch Locker | `0x267444D099b10fB5Ed7c3Cc7B7c767AdcA574952` |
137
+ | Launch and Buy | `0xe33E9E479dF8802cb0866d5d05258bEc4cF62948` |
138
+ | Launch Deployer | `0x3711ceA4feaDE896C913C68F01Eda97Cb06D1A42` |
139
+ | Graduation Executor | `0xC7819B64A1dAECD7eC19856d026cb14EfBd89046` |
140
+ | Graduation Guard | `0xf5695117b99B6f6401e67d4195BD653628176C6C` |
141
+
142
+ ## Development
143
+
144
+ ```bash
145
+ npm run build # build dist/
146
+ npm test # run 49 unit tests
147
+ npm run typecheck # check for type errors
148
+ ```
149
+
150
+ ## License
151
+
152
+ MIT