@coffer_so/sdk 1.0.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 (228) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +283 -0
  3. package/dist/clients/AdminClient.d.ts +194 -0
  4. package/dist/clients/AdminClient.d.ts.map +1 -0
  5. package/dist/clients/AdminClient.js +482 -0
  6. package/dist/clients/AdminClient.js.map +1 -0
  7. package/dist/clients/CofferBackendClient.d.ts +877 -0
  8. package/dist/clients/CofferBackendClient.d.ts.map +1 -0
  9. package/dist/clients/CofferBackendClient.js +536 -0
  10. package/dist/clients/CofferBackendClient.js.map +1 -0
  11. package/dist/clients/CubeBackendClient.d.ts +877 -0
  12. package/dist/clients/CubeBackendClient.d.ts.map +1 -0
  13. package/dist/clients/CubeBackendClient.js +536 -0
  14. package/dist/clients/CubeBackendClient.js.map +1 -0
  15. package/dist/clients/CubicPoolClient.d.ts +120 -0
  16. package/dist/clients/CubicPoolClient.d.ts.map +1 -0
  17. package/dist/clients/CubicPoolClient.js +687 -0
  18. package/dist/clients/CubicPoolClient.js.map +1 -0
  19. package/dist/clients/PoolFactoryClient.d.ts +53 -0
  20. package/dist/clients/PoolFactoryClient.d.ts.map +1 -0
  21. package/dist/clients/PoolFactoryClient.js +91 -0
  22. package/dist/clients/PoolFactoryClient.js.map +1 -0
  23. package/dist/clients/RpcClient.d.ts +49 -0
  24. package/dist/clients/RpcClient.d.ts.map +1 -0
  25. package/dist/clients/RpcClient.js +135 -0
  26. package/dist/clients/RpcClient.js.map +1 -0
  27. package/dist/clients/SingleTokenDepositClient.d.ts +67 -0
  28. package/dist/clients/SingleTokenDepositClient.d.ts.map +1 -0
  29. package/dist/clients/SingleTokenDepositClient.js +105 -0
  30. package/dist/clients/SingleTokenDepositClient.js.map +1 -0
  31. package/dist/clients/contract-instructions.d.ts +24 -0
  32. package/dist/clients/contract-instructions.d.ts.map +1 -0
  33. package/dist/clients/contract-instructions.js +130 -0
  34. package/dist/clients/contract-instructions.js.map +1 -0
  35. package/dist/clients/index.d.ts +10 -0
  36. package/dist/clients/index.d.ts.map +1 -0
  37. package/dist/clients/index.js +26 -0
  38. package/dist/clients/index.js.map +1 -0
  39. package/dist/clients/quote-math.d.ts +15 -0
  40. package/dist/clients/quote-math.d.ts.map +1 -0
  41. package/dist/clients/quote-math.js +98 -0
  42. package/dist/clients/quote-math.js.map +1 -0
  43. package/dist/clients/tx-builders.d.ts +231 -0
  44. package/dist/clients/tx-builders.d.ts.map +1 -0
  45. package/dist/clients/tx-builders.js +861 -0
  46. package/dist/clients/tx-builders.js.map +1 -0
  47. package/dist/clients/versioned.d.ts +34 -0
  48. package/dist/clients/versioned.d.ts.map +1 -0
  49. package/dist/clients/versioned.js +55 -0
  50. package/dist/clients/versioned.js.map +1 -0
  51. package/dist/config/index.d.ts +65 -0
  52. package/dist/config/index.d.ts.map +1 -0
  53. package/dist/config/index.js +75 -0
  54. package/dist/config/index.js.map +1 -0
  55. package/dist/config/networks.d.ts +12 -0
  56. package/dist/config/networks.d.ts.map +1 -0
  57. package/dist/config/networks.js +51 -0
  58. package/dist/config/networks.js.map +1 -0
  59. package/dist/config/tokens.d.ts +19 -0
  60. package/dist/config/tokens.d.ts.map +1 -0
  61. package/dist/config/tokens.js +43 -0
  62. package/dist/config/tokens.js.map +1 -0
  63. package/dist/idl/cubic_pool.json +4203 -0
  64. package/dist/idl/index.d.ts +1769 -0
  65. package/dist/idl/index.d.ts.map +1 -0
  66. package/dist/idl/index.js +18 -0
  67. package/dist/idl/index.js.map +1 -0
  68. package/dist/idl/protocol_admin.json +2615 -0
  69. package/dist/idl/single_token_liquidity.json +1121 -0
  70. package/dist/index.d.ts +75 -0
  71. package/dist/index.d.ts.map +1 -0
  72. package/dist/index.js +206 -0
  73. package/dist/index.js.map +1 -0
  74. package/dist/math/cubicMath.d.ts +40 -0
  75. package/dist/math/cubicMath.d.ts.map +1 -0
  76. package/dist/math/cubicMath.js +82 -0
  77. package/dist/math/cubicMath.js.map +1 -0
  78. package/dist/math/fixedPoint.d.ts +19 -0
  79. package/dist/math/fixedPoint.d.ts.map +1 -0
  80. package/dist/math/fixedPoint.js +86 -0
  81. package/dist/math/fixedPoint.js.map +1 -0
  82. package/dist/math/index.d.ts +9 -0
  83. package/dist/math/index.d.ts.map +1 -0
  84. package/dist/math/index.js +30 -0
  85. package/dist/math/index.js.map +1 -0
  86. package/dist/math/logExp.d.ts +6 -0
  87. package/dist/math/logExp.d.ts.map +1 -0
  88. package/dist/math/logExp.js +68 -0
  89. package/dist/math/logExp.js.map +1 -0
  90. package/dist/math/lpLoss.d.ts +44 -0
  91. package/dist/math/lpLoss.d.ts.map +1 -0
  92. package/dist/math/lpLoss.js +103 -0
  93. package/dist/math/lpLoss.js.map +1 -0
  94. package/dist/math/maxSelloff.d.ts +164 -0
  95. package/dist/math/maxSelloff.d.ts.map +1 -0
  96. package/dist/math/maxSelloff.js +397 -0
  97. package/dist/math/maxSelloff.js.map +1 -0
  98. package/dist/math/singleToken.d.ts +54 -0
  99. package/dist/math/singleToken.d.ts.map +1 -0
  100. package/dist/math/singleToken.js +188 -0
  101. package/dist/math/singleToken.js.map +1 -0
  102. package/dist/math/slippage.d.ts +13 -0
  103. package/dist/math/slippage.d.ts.map +1 -0
  104. package/dist/math/slippage.js +44 -0
  105. package/dist/math/slippage.js.map +1 -0
  106. package/dist/math/surgeFee.d.ts +24 -0
  107. package/dist/math/surgeFee.d.ts.map +1 -0
  108. package/dist/math/surgeFee.js +85 -0
  109. package/dist/math/surgeFee.js.map +1 -0
  110. package/dist/math/weightedMath.d.ts +20 -0
  111. package/dist/math/weightedMath.d.ts.map +1 -0
  112. package/dist/math/weightedMath.js +66 -0
  113. package/dist/math/weightedMath.js.map +1 -0
  114. package/dist/parsers/borsh.d.ts +28 -0
  115. package/dist/parsers/borsh.d.ts.map +1 -0
  116. package/dist/parsers/borsh.js +104 -0
  117. package/dist/parsers/borsh.js.map +1 -0
  118. package/dist/parsers/contracts.d.ts +26 -0
  119. package/dist/parsers/contracts.d.ts.map +1 -0
  120. package/dist/parsers/contracts.js +62 -0
  121. package/dist/parsers/contracts.js.map +1 -0
  122. package/dist/parsers/events.d.ts +3 -0
  123. package/dist/parsers/events.d.ts.map +1 -0
  124. package/dist/parsers/events.js +281 -0
  125. package/dist/parsers/events.js.map +1 -0
  126. package/dist/parsers/index.d.ts +6 -0
  127. package/dist/parsers/index.d.ts.map +1 -0
  128. package/dist/parsers/index.js +22 -0
  129. package/dist/parsers/index.js.map +1 -0
  130. package/dist/parsers/mintAccount.d.ts +24 -0
  131. package/dist/parsers/mintAccount.d.ts.map +1 -0
  132. package/dist/parsers/mintAccount.js +27 -0
  133. package/dist/parsers/mintAccount.js.map +1 -0
  134. package/dist/parsers/poolAccount.d.ts +141 -0
  135. package/dist/parsers/poolAccount.d.ts.map +1 -0
  136. package/dist/parsers/poolAccount.js +224 -0
  137. package/dist/parsers/poolAccount.js.map +1 -0
  138. package/dist/types/contracts.d.ts +1340 -0
  139. package/dist/types/contracts.d.ts.map +1 -0
  140. package/dist/types/contracts.js +3 -0
  141. package/dist/types/contracts.js.map +1 -0
  142. package/dist/types/events.d.ts +172 -0
  143. package/dist/types/events.d.ts.map +1 -0
  144. package/dist/types/events.js +3 -0
  145. package/dist/types/events.js.map +1 -0
  146. package/dist/types/index.d.ts +6 -0
  147. package/dist/types/index.d.ts.map +1 -0
  148. package/dist/types/index.js +22 -0
  149. package/dist/types/index.js.map +1 -0
  150. package/dist/types/pool.d.ts +149 -0
  151. package/dist/types/pool.d.ts.map +1 -0
  152. package/dist/types/pool.js +3 -0
  153. package/dist/types/pool.js.map +1 -0
  154. package/dist/types/result.d.ts +24 -0
  155. package/dist/types/result.d.ts.map +1 -0
  156. package/dist/types/result.js +11 -0
  157. package/dist/types/result.js.map +1 -0
  158. package/dist/types/tx.d.ts +261 -0
  159. package/dist/types/tx.d.ts.map +1 -0
  160. package/dist/types/tx.js +3 -0
  161. package/dist/types/tx.js.map +1 -0
  162. package/dist/utils/errors.d.ts +44 -0
  163. package/dist/utils/errors.d.ts.map +1 -0
  164. package/dist/utils/errors.js +192 -0
  165. package/dist/utils/errors.js.map +1 -0
  166. package/dist/utils/extensions.d.ts +98 -0
  167. package/dist/utils/extensions.d.ts.map +1 -0
  168. package/dist/utils/extensions.js +187 -0
  169. package/dist/utils/extensions.js.map +1 -0
  170. package/dist/utils/index.d.ts +5 -0
  171. package/dist/utils/index.d.ts.map +1 -0
  172. package/dist/utils/index.js +21 -0
  173. package/dist/utils/index.js.map +1 -0
  174. package/dist/utils/pda.d.ts +8 -0
  175. package/dist/utils/pda.d.ts.map +1 -0
  176. package/dist/utils/pda.js +27 -0
  177. package/dist/utils/pda.js.map +1 -0
  178. package/dist/utils/retry.d.ts +22 -0
  179. package/dist/utils/retry.d.ts.map +1 -0
  180. package/dist/utils/retry.js +62 -0
  181. package/dist/utils/retry.js.map +1 -0
  182. package/package.json +54 -0
  183. package/src/clients/AdminClient.ts +608 -0
  184. package/src/clients/CofferBackendClient.ts +1413 -0
  185. package/src/clients/CubicPoolClient.ts +719 -0
  186. package/src/clients/PoolFactoryClient.ts +110 -0
  187. package/src/clients/RpcClient.ts +195 -0
  188. package/src/clients/SingleTokenDepositClient.ts +143 -0
  189. package/src/clients/contract-instructions.ts +115 -0
  190. package/src/clients/index.ts +9 -0
  191. package/src/clients/quote-math.ts +81 -0
  192. package/src/clients/tx-builders.ts +1096 -0
  193. package/src/clients/versioned.ts +80 -0
  194. package/src/config/index.ts +111 -0
  195. package/src/config/networks.ts +71 -0
  196. package/src/config/tokens.ts +52 -0
  197. package/src/idl/cubic_pool.json +4203 -0
  198. package/src/idl/index.ts +13 -0
  199. package/src/idl/protocol_admin.json +2615 -0
  200. package/src/idl/single_token_liquidity.json +1121 -0
  201. package/src/index.ts +262 -0
  202. package/src/math/cubicMath.ts +92 -0
  203. package/src/math/fixedPoint.ts +71 -0
  204. package/src/math/index.ts +13 -0
  205. package/src/math/logExp.ts +61 -0
  206. package/src/math/lpLoss.ts +160 -0
  207. package/src/math/maxSelloff.ts +564 -0
  208. package/src/math/singleToken.ts +251 -0
  209. package/src/math/slippage.ts +38 -0
  210. package/src/math/surgeFee.ts +101 -0
  211. package/src/math/weightedMath.ts +64 -0
  212. package/src/parsers/borsh.ts +106 -0
  213. package/src/parsers/contracts.ts +64 -0
  214. package/src/parsers/events.ts +275 -0
  215. package/src/parsers/index.ts +5 -0
  216. package/src/parsers/mintAccount.ts +44 -0
  217. package/src/parsers/poolAccount.ts +372 -0
  218. package/src/types/contracts.ts +238 -0
  219. package/src/types/events.ts +198 -0
  220. package/src/types/index.ts +5 -0
  221. package/src/types/pool.ts +147 -0
  222. package/src/types/result.ts +51 -0
  223. package/src/types/tx.ts +278 -0
  224. package/src/utils/errors.ts +210 -0
  225. package/src/utils/extensions.ts +196 -0
  226. package/src/utils/index.ts +4 -0
  227. package/src/utils/pda.ts +58 -0
  228. package/src/utils/retry.ts +85 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Endgame AMM DEX Foundation
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,283 @@
1
+ # @coffer_so/sdk
2
+
3
+ [![npm](https://img.shields.io/npm/v/@coffer_so/sdk.svg)](https://www.npmjs.com/package/@coffer_so/sdk)
4
+
5
+ 📦 **npm**: <https://www.npmjs.com/package/@coffer_so/sdk>
6
+
7
+ Client library for the Cubic Pool AMM on Solana. Targeted at both frontend
8
+ and backend consumers; no bundler-specific code.
9
+
10
+ ## Contract compatibility
11
+
12
+ This release targets `contracts/audit-fixes-excluded-SF` at
13
+ `96a2ee20244ff95fb9f14357bb55b17e1eb0e2c0`, deployed on mainnet on 2026-09-07.
14
+ All three IDLs match that revision. Typed `buildContractInstruction` covers all
15
+ 59 instructions, `parseContractEvents` covers all 60 events, and
16
+ `decodeContractAccount` decodes their declared accounts. See
17
+ [the compatibility notes](docs/CONTRACT_COMPATIBILITY.md) for usage and limits, and
18
+ [the exact state-field mapping](docs/STATE_FIELDS.md) for decoded account data.
19
+
20
+ ## Install
21
+
22
+ ```bash
23
+ npm install @coffer_so/sdk
24
+ # or
25
+ yarn add @coffer_so/sdk
26
+ ```
27
+
28
+ Workspace-local development (linking against the in-repo source):
29
+
30
+ ```bash
31
+ cd sdk
32
+ npm install
33
+ npm run build
34
+ ```
35
+
36
+ From sibling packages:
37
+
38
+ ```json
39
+ {
40
+ "dependencies": {
41
+ "@coffer_so/sdk": "file:../sdk"
42
+ }
43
+ }
44
+ ```
45
+
46
+ ## Quick start
47
+
48
+ ```ts
49
+ import { getConfig, CubicPoolClient, CofferBackendClient } from "@coffer_so/sdk";
50
+ import { PublicKey } from "@solana/web3.js";
51
+
52
+ const config = getConfig("mainnet", {
53
+ backendEndpoint: "https://api.coffer.so",
54
+ // Optional: put your paid RPC first; SDK falls back to the defaults below.
55
+ rpcEndpoints: [
56
+ process.env.CUBE_RPC_URL!,
57
+ "https://api.mainnet-beta.solana.com",
58
+ "https://solana-rpc.publicnode.com",
59
+ "https://solana.api.pocket.network",
60
+ ],
61
+ rpcTimeoutMs: 2_000,
62
+ slippageHundredthsBps: 30_000, // 3 %
63
+ });
64
+
65
+ const pool = new CubicPoolClient({
66
+ config,
67
+ poolAddress: new PublicKey("..."),
68
+ });
69
+
70
+ const res = await pool.sync();
71
+ if (!res.ok) {
72
+ // res.error.humanMessage is safe to render to users
73
+ console.error(res.error.humanMessage);
74
+ return;
75
+ }
76
+ const info = res.data;
77
+ // info.tokens[i].metadata contains ticker / logo / decimals
78
+ // info.tokens[i].actualBalance is a bn.js BN in native units
79
+ ```
80
+
81
+ ## Architecture
82
+
83
+ ```
84
+ config/ CofferConfig, program IDs per network, token registry
85
+ types/ Result<T> shape, PoolInfo, SwapQuote, SingleTokenDepositQuote,
86
+ CubicPoolEvent
87
+ utils/ Error mapping, retry wrapper (safeCall), PDA helpers
88
+ math/ Pure math — port of cubic-pool + stld Rust math modules
89
+ parsers/ Binary layout decoders for CubicPool / Mint / events
90
+ clients/ RpcClient, CofferBackendClient, CubicPoolClient
91
+ idl/ Anchor IDL exports generated from the current contracts
92
+ examples/ Runnable scripts demonstrating each capability
93
+ ```
94
+
95
+ `RpcClient` starts with its last successful endpoint and rotates through
96
+ `config.defaults.rpcEndpoints` after a retryable failure.
97
+ If one endpoint times out or returns a transient provider error, the SDK tries
98
+ the next endpoint instead of waiting on the same RPC. Mainnet defaults are
99
+ no-key public endpoints; production frontends should prepend their paid RPC via
100
+ `getConfig("mainnet", { rpcEndpoints: [...] })`.
101
+
102
+ Client sync and quote methods return `SdkResult<T>`: `{ ok: true, data }` or
103
+ `{ ok: false, error: { code, humanMessage, cause? } }`. Pure math, parsers and
104
+ low-level instruction builders throw on invalid input.
105
+
106
+ ## What lives in the SDK vs the frontend
107
+
108
+ **In the SDK:**
109
+ - All on-chain account parsing (pool, mint, events)
110
+ - All math (quote, allocations, slippage, price impact)
111
+ - All transaction building (swap, add/remove liquidity, single-token deposit, pool deploy)
112
+ - Current Anchor IDLs for `cubic_pool`, `single_token_liquidity`, and
113
+ `protocol_admin`
114
+ - Retry + fallback for RPC and backend calls
115
+ - Event log decoding
116
+
117
+ **In the application:** UI/state, wallet signing, transaction submission and
118
+ confirmation, native SOL wrapping, any missing token-account setup, and fresh
119
+ helper-balance reads for STLD. Use the SDK quote and ABI helpers for contract
120
+ math and encoding; direct `rpc.connection` calls bypass its fallback wrapper.
121
+
122
+ ## v0 transactions + per-pool ALT
123
+
124
+ Multi-token pools (especially 7–10 token ones) exceed Solana's 1232-byte
125
+ legacy transaction wire ceiling on `add_liquidity` /
126
+ `remove_liquidity`. The contract provisions an **Address Lookup Table
127
+ (ALT) per pool** via `initialize_pool_alt`. After init the ALT is
128
+ frozen and its address is recorded on `pool.lookup_table`.
129
+
130
+ Builders return instructions. Call `compileBuiltTx` to fetch the pool's ALT and
131
+ compile a v0 transaction. The wallet supplies signatures and the caller sends it.
132
+
133
+ ```ts
134
+ import { compileBuiltTx } from "@coffer_so/sdk";
135
+
136
+ const built = client.buildRemoveLiquidityTx({ user, bptAmount, minimumTokenAmounts });
137
+ if (!built.ok) throw new Error(built.error.humanMessage);
138
+ const compiled = await compileBuiltTx(connection, user, built.data, info);
139
+ if (!compiled.ok) throw new Error(compiled.error.humanMessage);
140
+ // Sign compiled.data.tx with the wallet, then send and confirm it.
141
+ ```
142
+
143
+ ### Provisioning an ALT for a new pool
144
+
145
+ ```ts
146
+ import { buildInitializePoolAltTx } from "@coffer_so/sdk";
147
+
148
+ const recentSlot = new BN(await connection.getSlot("finalized"));
149
+ const { instructions, lookupTable } = buildInitializePoolAltTx(config, {
150
+ pool: poolPubkey,
151
+ config: poolConfigPubkey, // from pool.config — required
152
+ authority: poolAdmin, // pool admin OR config.protocol_admin
153
+ payer: poolAdmin, // funds the table; rent depends on its size
154
+ recentSlot,
155
+ });
156
+ // Sign, send, confirm, then sync the pool. Wait for a later slot before
157
+ // using newly added ALT addresses in a dependent transaction.
158
+ ```
159
+
160
+ **Account fields:**
161
+ - `pool` — `CubicPool` account
162
+ - `config` — the `CubicPoolConfig` the pool is pinned to (read for the
163
+ alternative-authority check). Always required.
164
+ - `authority` — signs the create+extend+freeze CPIs. Either
165
+ `pool.pool_admin` or `config.protocol_admin` (Treasury PDA, only
166
+ reachable via `protocol_admin.pool_initialize_alt`). ALT pubkey is
167
+ derived from `[authority, recent_slot]`.
168
+ - `payer` — pays ALT rent. Decoupled from `authority` because
169
+ Treasury PDA can't be a `system_program::transfer` source (carries
170
+ data). For the pool-admin path, pass the same key as `authority`.
171
+
172
+ ALT rent depends on the address count and the current rent calculation.
173
+ The contract freezes the table; it cannot then be closed to reclaim that rent.
174
+
175
+ ## Token-2022 support
176
+
177
+ Pools may mix the classic SPL Token program and Token-2022. Every
178
+ `PoolTokenInfo` carries a `tokenProgram` field decoded straight from
179
+ the on-chain pool account. The transaction builders
180
+ (`buildSwapTx`, `buildAddLiquidityTx`, `buildRemoveLiquidityTx`,
181
+ `buildSingleTokenDepositTx`) thread `token.tokenProgram` through ATA
182
+ derivation and remaining-accounts assembly, so consumers do not need
183
+ to special-case Token-2022 on the call site.
184
+
185
+ The BPT mint defaults to classic SPL Token; `bptTokenProgram` can select
186
+ Token-2022. `sync()` records its actual owner and builders use that program.
187
+
188
+ The deployed contracts do not support transfer-fee or transfer-hook accounting.
189
+ SDK swap/add/remove guards reject incompatible extensions on affected transfer
190
+ legs. STLD instruction builders check **every pool mint**, including sidelined
191
+ ones, because existing helper balances can be refunded. Its quote checks live
192
+ reserve legs and any supplied nonzero helper balances, so a quote can succeed
193
+ while the stricter STLD builder rejects a sidelined incompatible mint.
194
+ `bannedMintExtensions()` separately reports the creation-policy bitmap; a bit in
195
+ that bitmap does not by itself make an existing token non-transferable.
196
+
197
+ ## Examples
198
+
199
+ See `examples/*.ts`:
200
+
201
+ - `01-init-sdk.ts` — initialisation patterns
202
+ - `02-fetch-pool.ts` — parse pool state
203
+ - `03-quote-swap.ts` — swap quote with slippage
204
+ - `06-single-token-deposit.ts` — single-token deposit quote
205
+ - `08-backend-stats.ts` — statistics via CofferBackendClient
206
+
207
+ Run: `npx ts-node examples/<name>.ts`.
208
+
209
+ ## Error handling pattern
210
+
211
+ ```ts
212
+ const res = await pool.sync();
213
+ if (!res.ok) {
214
+ toast.error(res.error.humanMessage);
215
+ logger.debug(res.error.cause);
216
+ return;
217
+ }
218
+ const poolInfo = res.data;
219
+ ```
220
+
221
+ The SDK's `safeCall` helper retries transient errors (RPC timeouts, rate
222
+ limits, connection refused) up to 3 times with configurable backoff
223
+ (default schedule: 200ms / 500ms / 1500ms). Permanent errors (parse failure, invalid input,
224
+ insufficient funds) short-circuit.
225
+
226
+ ## Public operation surface
227
+
228
+ | Client / helpers | Public operations |
229
+ | --- | --- |
230
+ | `CubicPoolClient` | `sync`, `getCached`, `helperPda`, `quoteSwap`, `quoteSeedDeposit`, `quoteAddLiquidity`, `quoteRemove`, `quoteSingleTokenDeposit`, swap/add/remove/STLD transaction builders, split STLD builder, `singleTokenDeposit` getter, `parseEventsFromLogs` |
231
+ | `SingleTokenDepositClient` | `sync`, `helperPda`, `quote`, `buildTx`, `buildTxs` |
232
+ | `PoolFactoryClient` | `buildDeployPoolTx`, `buildInitializeConfigTx`, `initializeCubicPoolIx` |
233
+ | `AdminClient` | Treasury initialization/rotation, supervisor, fee collection/withdrawals, pool configuration/activation/migration/ALT, program upgrades/authority transfer/freeze/close; all 29 protocol-admin instructions |
234
+ | Generic ABI | `buildContractInstruction` for all 59 instructions; `decodeContractAccount` for all declared accounts; `decodeContractEvent`/`parseContractEvents` for all 60 events |
235
+ | Raw builders | `build*Ix`/`build*Tx` for swaps, liquidity, STLD, pool/config/ALT initialization, fee/sell-off/range management and pool-admin rotation |
236
+ | RPC/HTTP | `RpcClient`, `CofferBackendClient`; see [backend version scope](docs/BACKEND_COMPATIBILITY.md) |
237
+
238
+ `getCached()` is the actual cache accessor; there is no `getState()`, `swap()`,
239
+ or `getSwapQuote()` method. `pool.singleTokenDeposit` is a client getter, not a
240
+ callable deposit function. Raw builders and AdminClient instruction methods
241
+ construct instructions; the caller signs and sends them.
242
+ `AdminClient.initializeTreasuryIfMissing` is the explicit exception that can
243
+ submit an initialization through the supplied Anchor provider.
244
+
245
+ ### Quotes and input floors
246
+
247
+ ```ts
248
+ // All amounts are BN in raw mint units; vector order is the pool token order.
249
+ const swap = pool.quoteSwap(inIndex, outIndex, amountIn, slippageHbps, nowSeconds);
250
+ const seed = pool.quoteSeedDeposit(user, tokenAmounts, slippageHbps);
251
+ const join = pool.quoteAddLiquidity(tokenAmounts, slippageHbps);
252
+ const exit = pool.quoteRemove(bptIn);
253
+ const zap = pool.quoteSingleTokenDeposit(inIndex, amountIn, slippageHbps, nowSeconds, helperBalances);
254
+ ```
255
+
256
+ `nowSeconds` is optional Unix seconds; omitted uses Solana Clock from `sync()`.
257
+ STLD `helperBalances` is an optional vector of **existing helper token ATA
258
+ balances before the operation**; omitted means zero and does not fetch them.
259
+ `sync()` does not read helper ATAs. There is no per-leg minimum-output argument
260
+ on the deployed STLD instruction: quote `minOuts` are informational.
261
+
262
+ - Swap `amountOut` is net of the output-token surge fee; pass `minAmountOut` to
263
+ the builder. `feeAmount` and `protocolFeeAmount` use the input token.
264
+ - Join `tokenAmounts` are spend ceilings. Display `depositAmounts` as the quoted
265
+ pool credit and `refundAmounts` as unspent funds. Seed uses exact amounts.
266
+ - Exit `effectiveBptIn` may be smaller than requested to preserve 1,000 raw BPT.
267
+ - Add/STLD builders require a **positive** `minimumBptAmount` at runtime, even
268
+ though the compatibility interfaces retain it as optional. Remove builders
269
+ require an explicit `minimumTokenAmounts` vector.
270
+
271
+ `buildDeployPoolTx` initializes the pool and BPT mint without seeding or creating
272
+ reserve vault ATAs. `buildAddLiquidityTx` creates the user's BPT ATA, but the
273
+ user's input-token accounts and pool reserve vaults must already exist. Supply
274
+ the necessary ATA setup in the application before the first deposit.
275
+ For STLD on larger pools, use `buildSingleTokenDepositTxs`, confirm its setup
276
+ transaction, then compile the deposit with the already initialized pool ALT.
277
+ Neither splitting nor compiling creates the ALT.
278
+
279
+ The complete typed event API keeps snake_case fields and full-width BN values.
280
+ The camelCase `parseCubicPoolEvents` compatibility API also recognizes all 60
281
+ current events, but uses numeric timestamps and some legacy default fields.
282
+ Malformed/truncated events become `Unknown`; it is not proof of program
283
+ provenance or transaction success.
@@ -0,0 +1,194 @@
1
+ import * as anchor from "@coral-xyz/anchor";
2
+ import { Program } from "@coral-xyz/anchor";
3
+ import { Connection, PublicKey } from "@solana/web3.js";
4
+ import BN from "bn.js";
5
+ import { CofferConfig } from "../config";
6
+ /** Upstream BPF upgradeable loader; ProgramData PDA = findPda([programId]). */
7
+ export declare const BPF_LOADER_UPGRADEABLE_PROGRAM_ID: anchor.web3.PublicKey;
8
+ /**
9
+ * AdminClient — wraps `protocol_admin` with treasury-routed admin
10
+ * operations.
11
+ *
12
+ * The cubic_pool program enforces that every admin instruction must be
13
+ * signed by the Treasury PDA (`seeds = [b"treasury"]`, owned by
14
+ * protocol_admin). This client builds the canonical flow:
15
+ *
16
+ * admin wallet
17
+ * → protocol_admin.<wrapper> (treasury.admin == signer)
18
+ * → CPI cubic_pool.<admin_ix> (signer == TREASURY_PDA)
19
+ *
20
+ * Direct calls into cubic_pool admin instructions will fail on-chain.
21
+ *
22
+ * Instruction methods return a `TransactionInstruction` (or a Promise of it). Compose into a tx
23
+ * with `@solana/web3.js` and sign with the admin wallet.
24
+ *
25
+ * The deployed audit-fixes-excluded-SF contract allows the supervisor to
26
+ * freeze AND unfreeze pools and to deactivate AND reactivate tokens. Other
27
+ * administrative operations require treasury.admin. This is not a freeze-only
28
+ * supervisor model.
29
+
30
+ */
31
+ export declare class AdminClient {
32
+ readonly program: Program;
33
+ readonly config: CofferConfig;
34
+ readonly cubicPoolProgramId: PublicKey;
35
+ readonly stldProgramId: PublicKey;
36
+ readonly treasuryPda: PublicKey;
37
+ constructor(opts: {
38
+ config: CofferConfig;
39
+ provider: anchor.AnchorProvider;
40
+ });
41
+ /**
42
+ * ProgramData PDA of the protocol-admin program itself, under the
43
+ * upgradeable BPF loader. `initialize` is gated on it (audit L-5): only
44
+ * the key that can upgrade the program may bootstrap its Treasury.
45
+ */
46
+ programDataPda(): PublicKey;
47
+ /**
48
+ * Idempotent treasury init. Returns true if a new treasury was created.
49
+ * `admin` becomes the initial `treasury.admin`.
50
+ *
51
+ * ⚠ v5.1 (audit L-5) added the `program_data` account: the signer must be
52
+ * the protocol-admin program's current upgrade authority, otherwise this
53
+ * reverts. `admin` may not be the all-zero pubkey (`InvalidAdmin`, 6009).
54
+ */
55
+ initializeTreasuryIfMissing(connection: Connection, admin: PublicKey, payer?: PublicKey): Promise<boolean>;
56
+ initiateAdminTransferIx(admin: PublicKey, newAdmin: PublicKey): any;
57
+ acceptAdminTransferIx(newAdmin: PublicKey): any;
58
+ cancelAdminTransferIx(admin: PublicKey): any;
59
+ registerTokenIx(admin: PublicKey, mint: PublicKey, tokenProgram?: anchor.web3.PublicKey): any;
60
+ /**
61
+ * Withdraw from a registered treasury vault.
62
+ *
63
+ * Treasury vaults use classic SPL Token in this deployed build. The mint
64
+ * argument derives the vault PDA; it is not an account in the instruction.
65
+ */
66
+ withdrawIx(admin: PublicKey, mint: PublicKey, recipient: PublicKey, amount: BN, tokenProgram?: anchor.web3.PublicKey): any;
67
+ /**
68
+ * Hand the upgrade authority for `program` to `newAuthority`.
69
+ *
70
+ * ⚠ v5.1 (audit M-3) removed the `new_authority` ARGUMENT and made it an
71
+ * ACCOUNT that must **co-sign**: the loader's `SetAuthorityChecked` is
72
+ * used so a mistyped destination cannot take the authority
73
+ * irrecoverably. The returned instruction therefore has two required
74
+ * signers — the current `admin` and `newAuthority`. Both must sign the
75
+ * transaction or it fails signature verification before it ever reaches
76
+ * the program.
77
+ */
78
+ transferUpgradeAuthorityIx(admin: PublicKey, program: PublicKey, newAuthority: PublicKey): any;
79
+ /**
80
+ * Make `program` permanently non-upgradeable.
81
+ *
82
+ * ⚠ v5.1 (audit M-3) dropped `new_authority_info` and added `program`:
83
+ * the account list is `[treasury, admin, program, programdata,
84
+ * bpf_loader_upgradeable]`. This is irreversible.
85
+ */
86
+ freezePoolProgramIx(admin: PublicKey, program: PublicKey): any;
87
+ poolInitializeConfigIx(admin: PublicKey, config: PublicKey, defaultProtocolFeeRate: number): any;
88
+ setProtocolFeeRateIx(admin: PublicKey, config: PublicKey, pool: PublicKey, protocolFeeRate: number): any;
89
+ setPoolEnabledIx(admin: PublicKey, config: PublicKey, pool: PublicKey, enabled: boolean): any;
90
+ setSwapsEnabledIx(admin: PublicKey, config: PublicKey, pool: PublicKey, enabled: boolean): any;
91
+ /**
92
+ * Update a config's Token-2022 extension policy.
93
+ *
94
+ * ⚠ v5.1 (audit H-5) added a second REQUIRED argument,
95
+ * `hardBannedExtensions`. Two distinct bitmaps:
96
+ *
97
+ * - `banned` — the config's default policy, inherited by new pools that
98
+ * do not pass their own override. A pool creator may override it in
99
+ * either direction.
100
+ * - `hardBanned` — the protocol floor. It is OR-ed into every pool's
101
+ * effective bitmap at creation and a creator override can never clear
102
+ * it. This is what keeps `PermanentDelegate` / `TransferHook` mints out
103
+ * of vault custody regardless of what a pool creator chooses.
104
+ *
105
+ * Loosening `hardBanned` is a protocol-wide safety decision, not a
106
+ * routine config tweak.
107
+ */
108
+ setBannedExtensionsIx(admin: PublicKey, config: PublicKey, banned: BN, hardBanned: BN): any;
109
+ /**
110
+ * Migrate a pool account from the v4 storage layout to v5.
111
+ *
112
+ * ⚠ v5.1 (audit H-7) added `reactivateTokens` and this instruction is no
113
+ * longer a no-op — it mutates pool state.
114
+ *
115
+ * @param reactivateTokens Pass `true` ONLY on the one-shot v4 → v5 pass.
116
+ * On any later call `true` silently re-opens every token that was
117
+ * deliberately disabled via `set_token_active`, undoing a circuit
118
+ * breaker. Default is `false` for that reason.
119
+ */
120
+ migratePoolToV5Ix(admin: PublicKey, config: PublicKey, pool: PublicKey, reactivateTokens?: boolean): any;
121
+ /**
122
+ * Drain lamports from a single-token-liquidity helper PDA.
123
+ *
124
+ * ⚠ v5.1 (audit L-8 / SF-12) added the `pool` and `system_program`
125
+ * accounts. `pool` is not merely a seed source: the program checks it
126
+ * belongs to `config`, closing the hole where the admin of one config
127
+ * could drain a helper governed by another.
128
+ */
129
+ stldWithdrawSolIx(admin: PublicKey, config: PublicKey, pool: PublicKey, source: PublicKey, recipient: PublicKey, amount: BN): any;
130
+ /**
131
+ * Batch-freeze pools. `pairs` are `[config, pool]` tuples passed via
132
+ * remaining_accounts.
133
+ *
134
+ * Authority: treasury.admin or treasury.supervisor. Both directions are
135
+ * permitted by the deployed audit-fixes-excluded-SF contract.
136
+ */
137
+ freezePoolsIx(authority: PublicKey, pairs: Array<{
138
+ config: PublicKey;
139
+ pool: PublicKey;
140
+ }>): any;
141
+ /**
142
+ * Batch-unfreeze pools — mirror of {@link freezePoolsIx}.
143
+ *
144
+ * The deployed contract permits either treasury.admin or treasury.supervisor.
145
+ */
146
+ unfreezePoolsIx(admin: PublicKey, pairs: Array<{
147
+ config: PublicKey;
148
+ pool: PublicKey;
149
+ }>): any;
150
+ /**
151
+ * Flip a token's input kill switch on a pool.
152
+ *
153
+ * Both admin and supervisor may set either value in the deployed build.
154
+ */
155
+ setTokenActiveIx(authority: PublicKey, config: PublicKey, pool: PublicKey, tokenIndex: number, isActive: boolean): any;
156
+ /**
157
+ * Set or revoke the supervisor pubkey. Admin only. Pass
158
+ * `PublicKey.default` to revoke.
159
+ *
160
+ * The supervisor may freeze/unfreeze pools and set token activity in either
161
+ * direction. Setting or revoking a supervisor remains admin-only.
162
+ */
163
+ setSupervisorIx(admin: PublicKey, newSupervisor: PublicKey): any;
164
+ /**
165
+ * Collects protocol fees from a pool to the supplied recipient ATAs.
166
+ *
167
+ * `vaults` / `recipients` / `tokenPrograms` must be aligned with
168
+ * `pool.token_mints` (one entry per token in pool order).
169
+ */
170
+ collectProtocolFeesIx(admin: PublicKey, config: PublicKey, pool: PublicKey, vaults: PublicKey[], recipients: PublicKey[], tokenPrograms?: PublicKey[]): any;
171
+ /**
172
+ * Emergency drain. Pool must be paused first. `amounts.length` must equal
173
+ * the pool's token_count; pass 0 to skip a token.
174
+ */
175
+ debugWithdrawLiquidityIx(admin: PublicKey, config: PublicKey, pool: PublicKey, amounts: BN[], vaults: PublicKey[], recipients: PublicKey[], tokenPrograms?: PublicKey[]): any;
176
+ /** Build Treasury initialization without sending. Payer must be the current
177
+ * protocol-admin upgrade authority; the assigned admin may be a different key.
178
+ */
179
+ initializeTreasuryIx(payer: PublicKey, admin: PublicKey): anchor.web3.TransactionInstruction;
180
+ upgradePoolProgramIx(admin: PublicKey, program: PublicKey, buffer: PublicKey, spill: PublicKey): anchor.web3.TransactionInstruction;
181
+ /** Closing a program disables it and returns its storage balance. */
182
+ closePoolProgramIx(admin: PublicKey, program: PublicKey, recipient: PublicKey): anchor.web3.TransactionInstruction;
183
+ withdrawSolIx(admin: PublicKey, recipient: PublicKey, amount: BN): anchor.web3.TransactionInstruction;
184
+ poolWithdrawSolIx(admin: PublicKey, config: PublicKey, source: PublicKey, recipient: PublicKey, amount: BN): anchor.web3.TransactionInstruction;
185
+ poolInitializeAltIx(admin: PublicKey, config: PublicKey, pool: PublicKey, recentSlot: BN): anchor.web3.TransactionInstruction;
186
+ poolInitiateProtocolAdminTransferIx(admin: PublicKey, config: PublicKey, newAdmin: PublicKey): anchor.web3.TransactionInstruction;
187
+ poolAcceptProtocolAdminTransferIx(admin: PublicKey, config: PublicKey): anchor.web3.TransactionInstruction;
188
+ poolCancelProtocolAdminTransferIx(admin: PublicKey, config: PublicKey): anchor.web3.TransactionInstruction;
189
+ private deriveProgramData;
190
+ private poolAdminAccounts;
191
+ private configPoolRemaining;
192
+ private tripleRemaining;
193
+ }
194
+ //# sourceMappingURL=AdminClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AdminClient.d.ts","sourceRoot":"","sources":["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