@bananapus/nana-sdk-core 1.5.0 → 1.6.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.
@@ -108,4 +108,191 @@ export declare function getCashOutQuote(client: PublicClient, { chainId, project
108
108
  decimals?: bigint;
109
109
  currency?: bigint;
110
110
  }): Promise<CashOutQuote>;
111
+ /**
112
+ * The default cash-out slippage tolerance, in basis points (1%).
113
+ *
114
+ * Quotes from {@link getHookAwareCashOutQuote} are exact against current state;
115
+ * this tolerance only absorbs quote-to-inclusion drift (payments, other cash
116
+ * outs, sucker snapshot syncs, or pool moves that land first).
117
+ */
118
+ export declare const DEFAULT_CASH_OUT_SLIPPAGE_BPS = 100n;
119
+ /**
120
+ * Apply a slippage tolerance to a quoted output, flooring toward zero but
121
+ * never below 1 for a positive quote (a zero minimum disables protection).
122
+ *
123
+ * @param quoted The quoted output amount.
124
+ * @param slippageBps The tolerance in basis points. Defaults to
125
+ * {@link DEFAULT_CASH_OUT_SLIPPAGE_BPS}.
126
+ * @returns The minimum acceptable output.
127
+ */
128
+ export declare function slippageFloor(quoted: bigint, slippageBps?: bigint): bigint;
129
+ /**
130
+ * The exact protocol fee `JBMultiTerminal` deducts from a cash-out reclaim:
131
+ * `reclaimAmount / 40` (2.5%, floor division — NOT `× 975 / 1000`, which can
132
+ * differ by 1 wei and break an exact minimum).
133
+ *
134
+ * With a non-zero cash-out tax rate the fee applies to the full reclaim. With
135
+ * a zero tax rate it applies only up to the project's fee-free surplus
136
+ * (round-trip prevention). Feeless beneficiaries pay no fee.
137
+ *
138
+ * @param args.reclaimAmount The gross reclaim amount, before the terminal fee.
139
+ * @param args.cashOutTaxRate The ruleset's cash-out tax rate.
140
+ * @param args.beneficiaryIsFeeless Whether the beneficiary is feeless.
141
+ * @param args.feeFreeSurplus The project's `feeFreeSurplusOf` counter for the
142
+ * reclaimed token. Only consulted when the tax rate is zero.
143
+ * @returns The fee amount the terminal will deduct.
144
+ */
145
+ export declare function cashOutProtocolFee({ reclaimAmount, cashOutTaxRate, beneficiaryIsFeeless, feeFreeSurplus, }: {
146
+ reclaimAmount: bigint;
147
+ cashOutTaxRate: bigint;
148
+ beneficiaryIsFeeless?: boolean;
149
+ feeFreeSurplus?: bigint;
150
+ }): bigint;
151
+ /**
152
+ * The diagnostic payload the buyback hook packs into its cash-out hook
153
+ * specification — the protocol's public preview API for the sell-side routing
154
+ * decision (returned by `previewCashOutFrom` whether or not the pool route
155
+ * wins).
156
+ */
157
+ export interface BuybackCashOutSpec {
158
+ minimumSwapAmountOut: bigint;
159
+ cashOutCountToSell: bigint;
160
+ netDirectCashOutAmount: bigint;
161
+ twapTick: number;
162
+ twapLiquidity: bigint;
163
+ poolId: Hex;
164
+ rawSwapQuote: bigint;
165
+ hasUserSpecifiedMinimumSwapAmountOut: boolean;
166
+ }
167
+ /**
168
+ * Decode the buyback hook's cash-out specification metadata (see
169
+ * {@link BuybackCashOutSpec}).
170
+ */
171
+ export declare function decodeBuybackCashOutSpec(metadata: Hex): BuybackCashOutSpec;
172
+ /**
173
+ * Build the buyback hook's `cashOut` metadata entry:
174
+ * `(uint256 minimumSwapAmountOut, bool skip)`.
175
+ *
176
+ * `minimumSwapAmountOut` is a hard floor on the net terminal-token output,
177
+ * enforced by the hook on BOTH the pool route and the direct bonding-curve
178
+ * fallback. Note an explicit non-zero minimum skips the hook's TWAP lookup:
179
+ * a minimum at or below the direct net keeps execution on the terminal path,
180
+ * a minimum above it routes through the pool. `skip: true` forces the
181
+ * terminal path outright (the floor still applies).
182
+ *
183
+ * @param args.hook The hook address the terminal consults (from the preview's
184
+ * hook specification).
185
+ * @param args.minimumSwapAmountOut The net-output floor.
186
+ * @param args.skip Force the direct terminal path. Defaults to false.
187
+ * @returns The metadata to pass as `cashOutTokensOf`'s `metadata` argument.
188
+ */
189
+ export declare function buildBuybackCashOutMetadata({ hook, minimumSwapAmountOut, skip, }: {
190
+ hook: Address;
191
+ minimumSwapAmountOut: bigint;
192
+ skip?: boolean;
193
+ }): Hex;
194
+ /** A hook specification tuple as returned by the terminal preview functions. */
195
+ export interface CashOutHookSpecification {
196
+ hook: Address;
197
+ noop: boolean;
198
+ amount: bigint;
199
+ metadata: Hex;
200
+ }
201
+ /**
202
+ * A slippage-protected cash-out route: which venue the transaction should
203
+ * expect, and the exact `minTokensReclaimed`/`metadata` pair to submit.
204
+ */
205
+ export interface CashOutRoute {
206
+ /** "treasury" = direct bonding-curve reclaim; "amm" = buyback pool sell. */
207
+ route: "treasury" | "amm";
208
+ /** The quoted net output on the chosen route. */
209
+ expectedReturn: bigint;
210
+ /** The slippage-floored minimum net output. */
211
+ minimumReturn: bigint;
212
+ /**
213
+ * The `minTokensReclaimed` to pass to `cashOutTokensOf`. Non-zero only on
214
+ * the treasury route — on the pool route the terminal itself reclaims
215
+ * nothing (the hook pays the beneficiary), so the floor lives in
216
+ * {@link CashOutRoute.metadata} instead.
217
+ */
218
+ terminalMinimum: bigint;
219
+ /** The `metadata` to pass to `cashOutTokensOf`. */
220
+ metadata: Hex;
221
+ /** The gross direct reclaim, before the terminal fee. */
222
+ treasuryGross: bigint;
223
+ /** The terminal fee on the direct reclaim. */
224
+ treasuryProtocolFee: bigint;
225
+ /** The net direct reclaim after the terminal fee. */
226
+ treasuryNet: bigint;
227
+ /** The decoded buyback diagnostics, when the hook was consulted. */
228
+ buyback: (BuybackCashOutSpec & {
229
+ hook: Address;
230
+ }) | null;
231
+ }
232
+ /**
233
+ * Interpret a hook-aware `previewCashOutFrom` result and prepare a
234
+ * slippage-protected route.
235
+ *
236
+ * On the treasury route the floor is enforced via `minTokensReclaimed`; if the
237
+ * routing flips to the pool between quote and inclusion, the transaction
238
+ * reverts rather than executing a stale path — re-quote and retry. On the pool
239
+ * route the floor is moved into the hook's `cashOut` metadata (the terminal
240
+ * minimum must be zero there), and if the floored pool quote no longer beats
241
+ * the direct net, the route falls back to the treasury path.
242
+ *
243
+ * @param args.reclaimAmount `previewCashOutFrom`'s gross reclaim amount.
244
+ * @param args.cashOutTaxRate `previewCashOutFrom`'s cash-out tax rate.
245
+ * @param args.hookSpecifications `previewCashOutFrom`'s hook specifications.
246
+ * @param args.beneficiaryIsFeeless Whether the beneficiary is feeless.
247
+ * Defaults to false (conservative: assumes the fee applies).
248
+ * @param args.feeFreeSurplus The terminal's `feeFreeSurplusOf` for the token.
249
+ * Only consulted when the tax rate is zero. Defaults to 0.
250
+ * @param args.slippageBps Tolerance for quote-to-inclusion drift. Defaults to
251
+ * {@link DEFAULT_CASH_OUT_SLIPPAGE_BPS}.
252
+ * @returns The protected route.
253
+ */
254
+ export declare function resolveCashOutRoute({ reclaimAmount, cashOutTaxRate, hookSpecifications, beneficiaryIsFeeless, feeFreeSurplus, slippageBps, }: {
255
+ reclaimAmount: bigint;
256
+ cashOutTaxRate: bigint;
257
+ hookSpecifications: readonly CashOutHookSpecification[];
258
+ beneficiaryIsFeeless?: boolean;
259
+ feeFreeSurplus?: bigint;
260
+ slippageBps?: bigint;
261
+ }): CashOutRoute;
262
+ /**
263
+ * Quote a cash out through `JBMultiTerminal.previewCashOutFrom` — the
264
+ * hook-aware simulation of the REAL cash-out path (data hook, buyback
265
+ * routing, cross-chain terms) — and prepare a slippage-protected route.
266
+ *
267
+ * Prefer this over {@link getCashOutQuote} for building transactions:
268
+ * `currentReclaimableSurplusOf` skips the data hook entirely, so its result
269
+ * can diverge from what `cashOutTokensOf` pays and is unsafe to use as a
270
+ * minimum.
271
+ *
272
+ * @param client A viem public client on the given chain.
273
+ * @param args.chainId The chain to quote on.
274
+ * @param args.projectId The project's id.
275
+ * @param args.holder The address whose tokens would be cashed out.
276
+ * @param args.cashOutCount The number of project tokens to cash out.
277
+ * @param args.tokenToReclaim The terminal token to reclaim.
278
+ * @param args.beneficiary The reclaim beneficiary. Defaults to the holder.
279
+ * @param args.terminal The terminal to quote against. Defaults to the chain's
280
+ * canonical `JBMultiTerminal`.
281
+ * @param args.beneficiaryIsFeeless Whether the beneficiary is feeless.
282
+ * Defaults to false.
283
+ * @param args.slippageBps Tolerance for quote-to-inclusion drift. Defaults to
284
+ * {@link DEFAULT_CASH_OUT_SLIPPAGE_BPS}.
285
+ * @returns The protected route (see {@link CashOutRoute}).
286
+ */
287
+ export declare function getHookAwareCashOutQuote(client: PublicClient, { chainId, projectId, holder, cashOutCount, tokenToReclaim, beneficiary, terminal, beneficiaryIsFeeless, slippageBps, }: {
288
+ chainId: JBChainId;
289
+ projectId: bigint;
290
+ holder: Address;
291
+ cashOutCount: bigint;
292
+ tokenToReclaim: Address;
293
+ beneficiary?: Address;
294
+ terminal?: Address;
295
+ beneficiaryIsFeeless?: boolean;
296
+ slippageBps?: bigint;
297
+ }): Promise<CashOutRoute>;
111
298
  //# sourceMappingURL=cashOut.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cashOut.d.ts","sourceRoot":"","sources":["../../../src/v6/cashOut.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,YAAY,EAAuB,MAAM,MAAM,CAAC;AACvE,OAAO,EACL,kBAAkB,EAEnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAMxC;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,SAAS,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,EAAE,OAAO,kBAAkB,CAAC;IAC/B,YAAY,EAAE,iBAAiB,CAAC;IAChC,IAAI,EAAE,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;CACzE;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,QAAQ,EACR,MAAM,EACN,SAAS,EACT,YAAY,EACZ,cAAc,EACd,kBAAuB,EACvB,WAAW,EACX,QAAe,GAChB,EAAE;IACD,OAAO,EAAE,SA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C5C,MAAM,EAAE,YAAY,EACpB,EACE,OAAO,EACP,SAAS,EACT,MAAM,EACN,YAAY,EACZ,cAAc,EACd,WAAW,EACX,QAAQ,EACR,oBAA4B,EAC5B,WAA2C,GAC5C,EAAE;IACD,OAAO,EAAE,SAAS,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,OAAO,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GACA,OAAO,CAAC,YAAY,CAAC,CAoCvB"}
@@ -1,8 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_CASH_OUT_SLIPPAGE_BPS = void 0;
3
4
  exports.buildCashOutTx = buildCashOutTx;
4
5
  exports.build721CashOutMetadata = build721CashOutMetadata;
5
6
  exports.getCashOutQuote = getCashOutQuote;
7
+ exports.slippageFloor = slippageFloor;
8
+ exports.cashOutProtocolFee = cashOutProtocolFee;
9
+ exports.decodeBuybackCashOutSpec = decodeBuybackCashOutSpec;
10
+ exports.buildBuybackCashOutMetadata = buildBuybackCashOutMetadata;
11
+ exports.resolveCashOutRoute = resolveCashOutRoute;
12
+ exports.getHookAwareCashOutQuote = getHookAwareCashOutQuote;
6
13
  const viem_1 = require("viem");
7
14
  const juicebox_js_1 = require("../generated/juicebox.js");
8
15
  const fee_js_1 = require("../utils/fee.js");
@@ -109,4 +116,248 @@ async function getCashOutQuote(client, { chainId, projectId, cashOutCount, decim
109
116
  reclaimAmountAfterFee: (0, fee_js_1.applyJbDaoCashOutFee)(reclaimAmount),
110
117
  };
111
118
  }
119
+ /**
120
+ * The default cash-out slippage tolerance, in basis points (1%).
121
+ *
122
+ * Quotes from {@link getHookAwareCashOutQuote} are exact against current state;
123
+ * this tolerance only absorbs quote-to-inclusion drift (payments, other cash
124
+ * outs, sucker snapshot syncs, or pool moves that land first).
125
+ */
126
+ exports.DEFAULT_CASH_OUT_SLIPPAGE_BPS = 100n;
127
+ const MAX_BPS = 10000n;
128
+ function requireBps(slippageBps) {
129
+ if (slippageBps < 0n || slippageBps >= MAX_BPS) {
130
+ throw new Error("Slippage basis points must be in [0, 10000)");
131
+ }
132
+ return slippageBps;
133
+ }
134
+ /**
135
+ * Apply a slippage tolerance to a quoted output, flooring toward zero but
136
+ * never below 1 for a positive quote (a zero minimum disables protection).
137
+ *
138
+ * @param quoted The quoted output amount.
139
+ * @param slippageBps The tolerance in basis points. Defaults to
140
+ * {@link DEFAULT_CASH_OUT_SLIPPAGE_BPS}.
141
+ * @returns The minimum acceptable output.
142
+ */
143
+ function slippageFloor(quoted, slippageBps = exports.DEFAULT_CASH_OUT_SLIPPAGE_BPS) {
144
+ requireBps(slippageBps);
145
+ if (quoted <= 0n)
146
+ return 0n;
147
+ const floor = (quoted * (MAX_BPS - slippageBps)) / MAX_BPS;
148
+ return floor > 0n ? floor : 1n;
149
+ }
150
+ /**
151
+ * The exact protocol fee `JBMultiTerminal` deducts from a cash-out reclaim:
152
+ * `reclaimAmount / 40` (2.5%, floor division — NOT `× 975 / 1000`, which can
153
+ * differ by 1 wei and break an exact minimum).
154
+ *
155
+ * With a non-zero cash-out tax rate the fee applies to the full reclaim. With
156
+ * a zero tax rate it applies only up to the project's fee-free surplus
157
+ * (round-trip prevention). Feeless beneficiaries pay no fee.
158
+ *
159
+ * @param args.reclaimAmount The gross reclaim amount, before the terminal fee.
160
+ * @param args.cashOutTaxRate The ruleset's cash-out tax rate.
161
+ * @param args.beneficiaryIsFeeless Whether the beneficiary is feeless.
162
+ * @param args.feeFreeSurplus The project's `feeFreeSurplusOf` counter for the
163
+ * reclaimed token. Only consulted when the tax rate is zero.
164
+ * @returns The fee amount the terminal will deduct.
165
+ */
166
+ function cashOutProtocolFee({ reclaimAmount, cashOutTaxRate, beneficiaryIsFeeless = false, feeFreeSurplus = 0n, }) {
167
+ if (reclaimAmount <= 0n || beneficiaryIsFeeless)
168
+ return 0n;
169
+ if (cashOutTaxRate > 0n)
170
+ return reclaimAmount / 40n;
171
+ const feeable = reclaimAmount < feeFreeSurplus ? reclaimAmount : feeFreeSurplus;
172
+ return feeable / 40n;
173
+ }
174
+ const BUYBACK_CASH_OUT_SPEC_ABI = [
175
+ { name: "minimumSwapAmountOut", type: "uint256" },
176
+ { name: "cashOutCountToSell", type: "uint256" },
177
+ { name: "netDirectCashOutAmount", type: "uint256" },
178
+ { name: "twapTick", type: "int24" },
179
+ { name: "twapLiquidity", type: "uint128" },
180
+ { name: "poolId", type: "bytes32" },
181
+ { name: "rawSwapQuote", type: "uint256" },
182
+ { name: "hasUserSpecifiedMinimumSwapAmountOut", type: "bool" },
183
+ ];
184
+ /**
185
+ * Decode the buyback hook's cash-out specification metadata (see
186
+ * {@link BuybackCashOutSpec}).
187
+ */
188
+ function decodeBuybackCashOutSpec(metadata) {
189
+ const [minimumSwapAmountOut, cashOutCountToSell, netDirectCashOutAmount, twapTick, twapLiquidity, poolId, rawSwapQuote, hasUserSpecifiedMinimumSwapAmountOut,] = (0, viem_1.decodeAbiParameters)(BUYBACK_CASH_OUT_SPEC_ABI, metadata);
190
+ return {
191
+ minimumSwapAmountOut,
192
+ cashOutCountToSell,
193
+ netDirectCashOutAmount,
194
+ twapTick,
195
+ twapLiquidity,
196
+ poolId,
197
+ rawSwapQuote,
198
+ hasUserSpecifiedMinimumSwapAmountOut,
199
+ };
200
+ }
201
+ /**
202
+ * Build the buyback hook's `cashOut` metadata entry:
203
+ * `(uint256 minimumSwapAmountOut, bool skip)`.
204
+ *
205
+ * `minimumSwapAmountOut` is a hard floor on the net terminal-token output,
206
+ * enforced by the hook on BOTH the pool route and the direct bonding-curve
207
+ * fallback. Note an explicit non-zero minimum skips the hook's TWAP lookup:
208
+ * a minimum at or below the direct net keeps execution on the terminal path,
209
+ * a minimum above it routes through the pool. `skip: true` forces the
210
+ * terminal path outright (the floor still applies).
211
+ *
212
+ * @param args.hook The hook address the terminal consults (from the preview's
213
+ * hook specification).
214
+ * @param args.minimumSwapAmountOut The net-output floor.
215
+ * @param args.skip Force the direct terminal path. Defaults to false.
216
+ * @returns The metadata to pass as `cashOutTokensOf`'s `metadata` argument.
217
+ */
218
+ function buildBuybackCashOutMetadata({ hook, minimumSwapAmountOut, skip = false, }) {
219
+ if (minimumSwapAmountOut < 0n) {
220
+ throw new Error("Cash out minimum cannot be negative");
221
+ }
222
+ const payload = (0, viem_1.encodeAbiParameters)([{ type: "uint256" }, { type: "bool" }], [minimumSwapAmountOut, skip]);
223
+ return (0, hook_js_1.createHookMetadata)([(0, hook_js_1.hookMetadataId)(hook, "cashOut")], [payload]);
224
+ }
225
+ /**
226
+ * Interpret a hook-aware `previewCashOutFrom` result and prepare a
227
+ * slippage-protected route.
228
+ *
229
+ * On the treasury route the floor is enforced via `minTokensReclaimed`; if the
230
+ * routing flips to the pool between quote and inclusion, the transaction
231
+ * reverts rather than executing a stale path — re-quote and retry. On the pool
232
+ * route the floor is moved into the hook's `cashOut` metadata (the terminal
233
+ * minimum must be zero there), and if the floored pool quote no longer beats
234
+ * the direct net, the route falls back to the treasury path.
235
+ *
236
+ * @param args.reclaimAmount `previewCashOutFrom`'s gross reclaim amount.
237
+ * @param args.cashOutTaxRate `previewCashOutFrom`'s cash-out tax rate.
238
+ * @param args.hookSpecifications `previewCashOutFrom`'s hook specifications.
239
+ * @param args.beneficiaryIsFeeless Whether the beneficiary is feeless.
240
+ * Defaults to false (conservative: assumes the fee applies).
241
+ * @param args.feeFreeSurplus The terminal's `feeFreeSurplusOf` for the token.
242
+ * Only consulted when the tax rate is zero. Defaults to 0.
243
+ * @param args.slippageBps Tolerance for quote-to-inclusion drift. Defaults to
244
+ * {@link DEFAULT_CASH_OUT_SLIPPAGE_BPS}.
245
+ * @returns The protected route.
246
+ */
247
+ function resolveCashOutRoute({ reclaimAmount, cashOutTaxRate, hookSpecifications, beneficiaryIsFeeless = false, feeFreeSurplus = 0n, slippageBps = exports.DEFAULT_CASH_OUT_SLIPPAGE_BPS, }) {
248
+ requireBps(slippageBps);
249
+ const treasuryProtocolFee = cashOutProtocolFee({
250
+ reclaimAmount,
251
+ cashOutTaxRate,
252
+ beneficiaryIsFeeless,
253
+ feeFreeSurplus,
254
+ });
255
+ const treasuryNet = reclaimAmount - treasuryProtocolFee;
256
+ const specification = hookSpecifications.find((spec) => spec.metadata !== "0x") ?? null;
257
+ const buyback = specification
258
+ ? {
259
+ hook: specification.hook,
260
+ ...decodeBuybackCashOutSpec(specification.metadata),
261
+ }
262
+ : null;
263
+ const treasuryRoute = {
264
+ route: "treasury",
265
+ expectedReturn: treasuryNet,
266
+ minimumReturn: slippageFloor(treasuryNet, slippageBps),
267
+ terminalMinimum: slippageFloor(treasuryNet, slippageBps),
268
+ metadata: "0x",
269
+ treasuryGross: reclaimAmount,
270
+ treasuryProtocolFee,
271
+ treasuryNet,
272
+ buyback,
273
+ };
274
+ if (!specification || specification.noop || !buyback)
275
+ return treasuryRoute;
276
+ // The pool route won the preview. Re-previews with an explicit metadata
277
+ // minimum report that already-protected floor and no raw quote — preserve
278
+ // it instead of discounting a second time.
279
+ const quote = buyback.rawSwapQuote > 0n
280
+ ? buyback.rawSwapQuote
281
+ : buyback.minimumSwapAmountOut;
282
+ const minimumReturn = buyback.rawSwapQuote > 0n && !buyback.hasUserSpecifiedMinimumSwapAmountOut
283
+ ? slippageFloor(quote, slippageBps)
284
+ : buyback.minimumSwapAmountOut;
285
+ // An explicit metadata minimum at or below the direct net routes execution
286
+ // back to the terminal path anyway; take the deterministic treasury route.
287
+ if (quote <= 0n || minimumReturn <= buyback.netDirectCashOutAmount) {
288
+ return treasuryRoute;
289
+ }
290
+ return {
291
+ route: "amm",
292
+ expectedReturn: quote,
293
+ minimumReturn,
294
+ terminalMinimum: 0n,
295
+ metadata: buildBuybackCashOutMetadata({
296
+ hook: specification.hook,
297
+ minimumSwapAmountOut: minimumReturn,
298
+ }),
299
+ treasuryGross: reclaimAmount,
300
+ treasuryProtocolFee,
301
+ treasuryNet,
302
+ buyback,
303
+ };
304
+ }
305
+ /**
306
+ * Quote a cash out through `JBMultiTerminal.previewCashOutFrom` — the
307
+ * hook-aware simulation of the REAL cash-out path (data hook, buyback
308
+ * routing, cross-chain terms) — and prepare a slippage-protected route.
309
+ *
310
+ * Prefer this over {@link getCashOutQuote} for building transactions:
311
+ * `currentReclaimableSurplusOf` skips the data hook entirely, so its result
312
+ * can diverge from what `cashOutTokensOf` pays and is unsafe to use as a
313
+ * minimum.
314
+ *
315
+ * @param client A viem public client on the given chain.
316
+ * @param args.chainId The chain to quote on.
317
+ * @param args.projectId The project's id.
318
+ * @param args.holder The address whose tokens would be cashed out.
319
+ * @param args.cashOutCount The number of project tokens to cash out.
320
+ * @param args.tokenToReclaim The terminal token to reclaim.
321
+ * @param args.beneficiary The reclaim beneficiary. Defaults to the holder.
322
+ * @param args.terminal The terminal to quote against. Defaults to the chain's
323
+ * canonical `JBMultiTerminal`.
324
+ * @param args.beneficiaryIsFeeless Whether the beneficiary is feeless.
325
+ * Defaults to false.
326
+ * @param args.slippageBps Tolerance for quote-to-inclusion drift. Defaults to
327
+ * {@link DEFAULT_CASH_OUT_SLIPPAGE_BPS}.
328
+ * @returns The protected route (see {@link CashOutRoute}).
329
+ */
330
+ async function getHookAwareCashOutQuote(client, { chainId, projectId, holder, cashOutCount, tokenToReclaim, beneficiary, terminal, beneficiaryIsFeeless = false, slippageBps = exports.DEFAULT_CASH_OUT_SLIPPAGE_BPS, }) {
331
+ const terminalAddress = terminal ?? (0, types_js_1.v6Address)("JBMultiTerminal", chainId);
332
+ const [, reclaimAmount, cashOutTaxRate, hookSpecifications] = await client.readContract({
333
+ address: terminalAddress,
334
+ abi: juicebox_js_1.jbMultiTerminalAbi,
335
+ functionName: "previewCashOutFrom",
336
+ args: [
337
+ holder,
338
+ projectId,
339
+ cashOutCount,
340
+ tokenToReclaim,
341
+ beneficiary ?? holder,
342
+ "0x",
343
+ ],
344
+ });
345
+ // The fee-free surplus counter only matters on zero-tax rulesets.
346
+ const feeFreeSurplus = cashOutTaxRate === 0n
347
+ ? await client.readContract({
348
+ address: terminalAddress,
349
+ abi: juicebox_js_1.jbMultiTerminalAbi,
350
+ functionName: "feeFreeSurplusOf",
351
+ args: [projectId, tokenToReclaim],
352
+ })
353
+ : 0n;
354
+ return resolveCashOutRoute({
355
+ reclaimAmount,
356
+ cashOutTaxRate,
357
+ hookSpecifications,
358
+ beneficiaryIsFeeless,
359
+ feeFreeSurplus,
360
+ slippageBps,
361
+ });
362
+ }
112
363
  //# sourceMappingURL=cashOut.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cashOut.js","sourceRoot":"","sources":["../../../src/v6/cashOut.ts"],"names":[],"mappings":";;AAwCA,wCAoCC;AAqBD,0DAuBC;AAyCD,0CA2BC;AA5LD,+BAAuE;AACvE,0DAGkC;AAElC,4CAAuD;AACvD,8CAAsE;AACtE,+CAAyD;AACzD,yCAAuC;AAcvC;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,QAAQ,EACR,MAAM,EACN,SAAS,EACT,YAAY,EACZ,cAAc,EACd,kBAAkB,GAAG,EAAE,EACvB,WAAW,EACX,QAAQ,GAAG,IAAI,GAWhB;IACC,OAAO;QACL,OAAO;QACP,OAAO,EAAE,QAAQ;QACjB,GAAG,EAAE,gCAAkB;QACvB,YAAY,EAAE,iBAAiB;QAC/B,IAAI,EAAE;YACJ,MAAM;YACN,SAAS;YACT,YAAY;YACZ,cAAc;YACd,kBAAkB;YAClB,WAAW;YACX,QAAQ;SACT;KACF,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,uBAAuB,CAAC,EACtC,gBAAgB,EAChB,QAAQ,GAIT;IACC,IAAI,Q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C;QACJ,CAAC,CAAC,EAAE,CAAC;IAET,OAAO,mBAAmB,CAAC;QACzB,aAAa;QACb,cAAc;QACd,kBAAkB;QAClB,oBAAoB;QACpB,cAAc;QACd,WAAW;KACZ,CAAC,CAAC;AACL,CAAC"}
@@ -2,12 +2,10 @@ import { Address } from "viem";
2
2
  /**
3
3
  * The v6 base currency id for ETH (JBCurrencyIds.ETH).
4
4
  *
5
- * Base currencies are the small standard ids (ETH = 1, USD = 2) used to denominate a
6
- * ruleset's `baseCurrency` and fund access limits. They are NOT the same as
7
- * accounting-context currencies, which are derived from a token's address via
8
- * {@link tokenCurrencyId}. Never use an accounting-context currency (e.g. 61166 for the
9
- * native token) as a ruleset `baseCurrency` to "skip the price feed" — base currency
10
- * must be 1 or 2.
5
+ * ETH = 1 and USD = 2 are well-known shared denominations used by protocol price
6
+ * feeds. A ruleset's `baseCurrency` may instead be a token-keyed currency from
7
+ * {@link tokenCurrencyId} when its issuance weight is denominated directly in that
8
+ * token.
11
9
  *
12
10
  * @link https://github.com/Bananapus/nana-core-v6/blob/main/src/libraries/JBCurrencyIds.sol
13
11
  */
@@ -32,9 +30,11 @@ export declare const NATIVE_TOKEN_CURRENCY_ID = 61166;
32
30
  * The v6 accounting-context currency id for a token: `uint32(uint160(tokenAddress))`,
33
31
  * i.e. the lowest 4 bytes of the token's address.
34
32
  *
35
- * Use this for terminal accounting contexts (`{ token, decimals, currency }`) — NOT for
36
- * a ruleset's `baseCurrency`, which must be a base currency id
37
- * ({@link BASE_CURRENCY_ETH} or {@link BASE_CURRENCY_USD}).
33
+ * Use this for terminal accounting contexts (`{ token, decimals, currency }`). It may
34
+ * also be used as a ruleset's `baseCurrency` when issuance is denominated directly in
35
+ * that token. Use a shared denomination such as {@link BASE_CURRENCY_ETH} or
36
+ * {@link BASE_CURRENCY_USD} when multiple accepted tokens must be converted through
37
+ * price feeds.
38
38
  *
39
39
  * @param token The token address to derive a currency id from.
40
40
  * @returns The token's accounting-context currency id (fits in a uint32).
@@ -1 +1 @@
1
- {"version":3,"file":"currency.d.ts","sourceRoot":"","sources":["../../../src/v6/currency.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iBAAiB,IAAI,CAAC;AAEnC;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,IAAI,CAAC;AAEnC;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,QAAQ,CAAC;AAE9C;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEtD"}
1
+ {"version":3,"file":"currency.d.ts","sourceRoot":"","sources":["../../../src/v6/currency.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,IAAI,CAAC;AAEnC;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,IAAI,CAAC;AAEnC;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,QAAQ,CAAC;AAE9C;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEtD"}
@@ -5,12 +5,10 @@ exports.tokenCurrencyId = tokenCurrencyId;
5
5
  /**
6
6
  * The v6 base currency id for ETH (JBCurrencyIds.ETH).
7
7
  *
8
- * Base currencies are the small standard ids (ETH = 1, USD = 2) used to denominate a
9
- * ruleset's `baseCurrency` and fund access limits. They are NOT the same as
10
- * accounting-context currencies, which are derived from a token's address via
11
- * {@link tokenCurrencyId}. Never use an accounting-context currency (e.g. 61166 for the
12
- * native token) as a ruleset `baseCurrency` to "skip the price feed" — base currency
13
- * must be 1 or 2.
8
+ * ETH = 1 and USD = 2 are well-known shared denominations used by protocol price
9
+ * feeds. A ruleset's `baseCurrency` may instead be a token-keyed currency from
10
+ * {@link tokenCurrencyId} when its issuance weight is denominated directly in that
11
+ * token.
14
12
  *
15
13
  * @link https://github.com/Bananapus/nana-core-v6/blob/main/src/libraries/JBCurrencyIds.sol
16
14
  */
@@ -35,9 +33,11 @@ exports.NATIVE_TOKEN_CURRENCY_ID = 61166;
35
33
  * The v6 accounting-context currency id for a token: `uint32(uint160(tokenAddress))`,
36
34
  * i.e. the lowest 4 bytes of the token's address.
37
35
  *
38
- * Use this for terminal accounting contexts (`{ token, decimals, currency }`) — NOT for
39
- * a ruleset's `baseCurrency`, which must be a base currency id
40
- * ({@link BASE_CURRENCY_ETH} or {@link BASE_CURRENCY_USD}).
36
+ * Use this for terminal accounting contexts (`{ token, decimals, currency }`). It may
37
+ * also be used as a ruleset's `baseCurrency` when issuance is denominated directly in
38
+ * that token. Use a shared denomination such as {@link BASE_CURRENCY_ETH} or
39
+ * {@link BASE_CURRENCY_USD} when multiple accepted tokens must be converted through
40
+ * price feeds.
41
41
  *
42
42
  * @param token The token address to derive a currency id from.
43
43
  * @returns The token's accounting-context currency id (fits in a uint32).
@@ -1 +1 @@
1
- {"version":3,"file":"currency.js","sourceRoot":"","sources":["../../../src/v6/currency.ts"],"names":[],"mappings":";;;AA6CA,0CAEC;AA7CD;;;;;;;;;;;GAWG;AACU,QAAA,iBAAiB,GAAG,CAAC,CAAC;AAEnC;;;;;;;GAOG;AACU,QAAA,iBAAiB,GAAG,CAAC,CAAC;AAEnC;;;;;GAKG;AACU,QAAA,wBAAwB,GAAG,KAAK,CAAC;AAE9C;;;;;;;;;;GAUG;AACH,SAAgB,eAAe,CAAC,KAAc;IAC5C,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,WAAW,CAAC,CAAC;AAC7C,CAAC"}
1
+ {"version":3,"file":"currency.js","sourceRoot":"","sources":["../../../src/v6/currency.ts"],"names":[],"mappings":";;;AA6CA,0CAEC;AA7CD;;;;;;;;;GASG;AACU,QAAA,iBAAiB,GAAG,CAAC,CAAC;AAEnC;;;;;;;GAOG;AACU,QAAA,iBAAiB,GAAG,CAAC,CAAC;AAEnC;;;;;GAKG;AACU,QAAA,wBAAwB,GAAG,KAAK,CAAC;AAE9C;;;;;;;;;;;;GAYG;AACH,SAAgB,eAAe,CAAC,KAAc;IAC5C,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,WAAW,CAAC,CAAC;AAC7C,CAAC"}
@@ -25,17 +25,19 @@ export declare function getProjectCreationFee(client: PublicClient, chainId: JBC
25
25
  /**
26
26
  * Build a `JBAccountingContext` for a token.
27
27
  *
28
- * The context currency is ALWAYS token-keyed: `uint32(uint160(token))`
29
- * (native token → 61166). This is distinct from a ruleset's `baseCurrency`,
30
- * which must be a standard currency id (ETH=1, USD=2) — never use a
31
- * token-keyed currency as a base currency to "skip the price feed".
28
+ * By default the context currency is token-keyed: `uint32(uint160(token))`
29
+ * (native token → 61166). Pass an explicit shared currency such as ETH=1 or
30
+ * USD=2 when the terminal should convert this token through a protocol price
31
+ * feed. A ruleset's `baseCurrency` is the denomination used to interpret its
32
+ * issuance weight.
32
33
  *
33
34
  * @param token The token address. Defaults to the native token sentinel
34
35
  * (`0x…EEEe`).
35
36
  * @param decimals The token's decimals. Defaults to 18 for the native token;
36
37
  * REQUIRED for any other token (there is no safe default).
38
+ * @param currency The context's currency id. Defaults to the token-keyed id.
37
39
  */
38
- export declare function buildAccountingContext(token?: Address, decimals?: number): JBAccountingContext;
40
+ export declare function buildAccountingContext(token?: Address, decimals?: number, currency?: number): JBAccountingContext;
39
41
  /**
40
42
  * Build the standard terminal configurations for a launch:
41
43
  *
@@ -1 +1 @@
1
- {"version":3,"file":"launch.d.ts","sourceRoot":"","sources":["../../../src/v6/launch.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,oBAAoB,EACpB,GAAG,EACH,YAAY,EAIb,MAAM,MAAM,CAAC;AAEd,OAAO,EAAE,eAAe,EAAiB,MAAM,0BAA0B,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,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