@manifoldxyz/dropkit 0.4.0 → 0.5.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 CHANGED
@@ -151,11 +151,15 @@ export function mintedLine(result: MintResult): string {
151
151
  | `quantity` | Initial quantity, or controlled quantity with `onQuantityChange`. Defaults to 1. |
152
152
  | `onQuantityChange` | Receives the clamped requested quantity. The parent must update `quantity`. |
153
153
  | `connect` | Optional `{ walletConnectProjectId }` forwarded to the shared connect widget. Defaults to Manifold's project id. |
154
- | `onEvent` | Optional event callback. No telemetry is sent by the package. |
154
+ | `onEvent` | Optional event callback. The package sends no analytics. It does send Manifold's mint record for Manifold claim mints (see [Manifold mint record](#manifold-mint-record)). |
155
155
  | `crossChain` | Manifold claims only. Default on. `false` turns cross-chain minting off; `{ chains: [8453] }` narrows the pay chains. |
156
156
  | `payChainId` | Forces the pay chain. The drop chain means a direct mint. Must be a pay chain. |
157
157
 
158
158
  `MintButton` additionally accepts `className`, `labels`, and `children`.
159
+
160
+ ### Manifold mint record
161
+
162
+ Every Manifold claim mint sends the same mint record the Manifold claim widget sends: once the mint transaction is sent, `POST https://apps.api.manifoldxyz.dev/public/instance/tx?appId=…&instanceId=…&hash=…`. For a Relay mint it records the drop-chain fill hash; for the cart, each line's hash. It carries no wallet address. It is fire and forget: it never delays or fails a mint. `contract` and `tl-stacks` mints send nothing; only Manifold claims are recorded, as in the widget. Sites can't turn it off.
159
163
  A function child receives the full `MintState` and replaces the default button.
160
164
 
161
165
  ```tsx
@@ -369,6 +373,96 @@ Things to know:
369
373
  - **A mint that cannot be confirmed** is never retried for you. It is listed in `cart.unconfirmed` until the collector dismisses it or adds the item back. Each entry has `wallet` (the wallet that sent it) and `message`, which names that wallet: "We couldn't confirm this. Check wallet 0x1234…abcd. If it didn't go through, add it again."
370
374
  - **Any wallet works**, smart accounts included. A wallet that returns a request id instead of a transaction hash (a Safe through WalletConnect, for example) shows "Still confirming", then settles from the collector's holdings: Collected if the mint landed, otherwise Unconfirmed. The cart never resends it.
371
375
 
376
+ ## Drop status
377
+
378
+ `@manifoldxyz/dropkit/status` tells a sale page whether each of many drops is upcoming, live, ended or sold out, how much supply is left, what the current bid is, and shows a countdown that can appear only close to a start or end time. It is read-only: no wallet, no mint. Use it for the strip of status around your mint buttons. Importing only `@manifoldxyz/dropkit` never loads it.
379
+
380
+ Read dates and status from Manifold; never ask the creator to type a date Studio already has.
381
+
382
+ ```tsx
383
+ import { DropCountdown, useDropStatus } from '@manifoldxyz/dropkit/status';
384
+ import type { StatusSource } from '@manifoldxyz/dropkit/status';
385
+
386
+ const sources: StatusSource[] = [
387
+ { type: 'manifold-claim', chainId: 1, creatorContract: '0x0000000000000000000000000000000000000001', instanceId: '1' },
388
+ { type: 'marketplace-listing', chainId: 1, listingId: '1538' },
389
+ ];
390
+
391
+ export function Strip({ rpcUrl }: { rpcUrl: string }) {
392
+ // A new array every render is fine: sources are keyed by content.
393
+ const [edition, auction] = useDropStatus(sources, { rpcUrls: { 1: rpcUrl }, refreshMs: 30_000 });
394
+ return (
395
+ <div>
396
+ <p data-phase={edition?.phase}>{edition?.remaining === null ? 'Open edition' : `${edition?.remaining ?? '…'} left`}</p>
397
+ <p data-phase={auction?.phase}>{auction?.bid ? `Current bid ${auction.bid.amount} wei` : auction?.phase}</p>
398
+ {/* Only inside the last 6 hours before the claim opens. */}
399
+ <DropCountdown to={edition?.startTime ?? null} showWithin="6h" className="countdown" />
400
+ </div>
401
+ );
402
+ }
403
+ ```
404
+
405
+ Each status is `{ phase, startTime, endTime, durationAfterFirstBid, totalMinted, maxSupply, remaining, price, paymentToken, bid, soldFor, stale, updatedAt, error, clockOffsetMs }`, aligned with the sources you pass:
406
+
407
+ - `phase` is `'upcoming' | 'live' | 'ended' | 'sold-out' | 'unknown'`. Times are unix seconds, supply and amounts are `bigint` in base units, and `maxSupply` / `remaining` are `null` for an open edition. `paymentToken` is `null` for the chain's native currency.
408
+ - `soldFor` is set when the phase is `'sold-out'`: the winning bid for an auction, the price for a fixed-price listing.
409
+ - `bid` is the highest bid of an auction listing. The marketplace API reports no bid count.
410
+ - A listing whose timer starts on the first bid or purchase has `startTime: null`, `endTime: null` and `durationAfterFirstBid` set to the seconds it will then run. Its phase is `'live'`.
411
+
412
+ **Sources.**
413
+
414
+ - `{ type: 'manifold-claim', chainId, creatorContract, instanceId, extensionAddress? }` reads the claim from its extension contract. Every claim of one chain is read with one multicall per refresh. `extensionAddress` pins the extension; without it the claim is looked up on all of Manifold's extensions on that chain, and once found, only on that one.
415
+ - `{ type: 'marketplace-listing', chainId, listingId, marketplace? }` reads a Manifold marketplace listing. All listings are read with one batch request per refresh, plus one request for each listing that is running or has just ended, because the batch answer has no bid and no units sold. At most 3 of those run at once, and a finalized listing is never read again. Mainnet, Optimism, Base, Shape and Sepolia have a default `marketplace` address; on other chains the listing cannot be read.
416
+
417
+ **A failed read never changes the page.** If a read fails, each affected status keeps its last good values with `stale: true` and `error` set, and the next good read clears both. If there has been no good read yet, `phase` is `'unknown'` and every value is `null`. A failed read never becomes `'upcoming'`, so a sale page cannot hide a live drop because an RPC call failed. Show `'unknown'` as a loading or retry state, not as "not open yet".
418
+
419
+ **Polling.** The hook reads on mount, every `refreshMs` (default 30 s) while the tab is visible, when the tab becomes visible again, and about a second after the nearest start or end time passes. Options: `rpcUrls`, `enabled` (false reads nothing), `getClient(chainId)` to bring your own viem client, and `fetch` to replace `fetch`.
420
+
421
+ **Clock.** A device clock that is wrong must not flip a phase. After each read the hook compares device time with server time (the HTTP `Date` header for listings, the block timestamp for claims) and, when they differ by more than 30 s, sets `clockOffsetMs` to the difference. Phases are computed on server time. Give the countdown the same clock with its `now` prop:
422
+
423
+ ```tsx
424
+ import { DropCountdown, useDropStatus } from '@manifoldxyz/dropkit/status';
425
+
426
+ export function OpensIn({ rpcUrl }: { rpcUrl: string }) {
427
+ const [claim] = useDropStatus(
428
+ [{ type: 'manifold-claim', chainId: 1, creatorContract: '0x0000000000000000000000000000000000000001', instanceId: '1' }],
429
+ { rpcUrls: { 1: rpcUrl } },
430
+ );
431
+ const clockOffsetMs = claim?.clockOffsetMs ?? 0;
432
+ return (
433
+ <DropCountdown to={claim?.startTime ?? null} showWithin="6h" hideAfter="1m" now={() => Date.now() + clockOffsetMs}>
434
+ {(c) => (c.visible ? <b data-state={c.state}>{c.state === 'done' ? 'Open now' : `Opens in ${c.text}`}</b> : null)}
435
+ </DropCountdown>
436
+ );
437
+ }
438
+ ```
439
+
440
+ **`<DropCountdown to showWithin? hideAfter? now? format? className? children? />`** is unstyled.
441
+
442
+ - `to` is unix seconds. `null` renders nothing.
443
+ - `showWithin` (`'6h'`, `'30m'`, `'2d'`, `'90s'`, `'1w'` or seconds) shows it only that long before `to`. Outside the window it renders nothing and does not tick.
444
+ - `hideAfter` (same units) keeps the done state on screen that long after `to`. By default it disappears when `to` passes.
445
+ - The default markup is `<span role="timer" data-state="counting" | "done">2d 03h 04m 05s</span>`. `format` picks the units (`"dhms"`, `"hms"` turns 2 days into 48 hours). A string `children` replaces the text. A function child gets `{ state, visible, secondsLeft, parts: { d, h, m, s }, text }` and replaces the markup entirely.
446
+ - It ticks once a second only while the tab is visible and `to` is inside the window. The server render and the first client render are both empty, so hydration always matches.
447
+
448
+ The logic is plain functions you can call on a server, with no React and no browser globals: `phaseOf(snapshot, nowSeconds)`, `statusOf`, `readSources(sources, deps)`, `parseDuration` and `countdownParts`.
449
+
450
+ ```ts
451
+ import { readSources, statusOf } from '@manifoldxyz/dropkit/status';
452
+
453
+ export async function phases(rpcUrl: string): Promise<string[]> {
454
+ const { outcomes } = await readSources(
455
+ [{ type: 'marketplace-listing', chainId: 1, listingId: '1538' }],
456
+ { rpcUrls: { 1: rpcUrl } },
457
+ );
458
+ const now = Math.floor(Date.now() / 1000);
459
+ const meta = { stale: false, updatedAt: Date.now(), error: null, clockOffsetMs: 0 };
460
+ return outcomes.map((o) => (o.ok ? statusOf(o.snapshot, now, meta).phase : 'unknown'));
461
+ }
462
+ ```
463
+
464
+ Out of scope: hiding a drop that is not published yet. The hook reads published state only.
465
+
372
466
  ## Local verification
373
467
 
374
468
  From the repository root, use Node 24 and pnpm 10.34.5:
package/dist/cart.cjs CHANGED
@@ -9,6 +9,7 @@
9
9
 
10
10
 
11
11
 
12
+ var _chunkYGBIJOKQcjs = require('./chunk-YGBIJOKQ.cjs');
12
13
 
13
14
 
14
15
 
@@ -18,7 +19,9 @@
18
19
 
19
20
 
20
21
 
21
- var _chunkGO4TR3HBcjs = require('./chunk-GO4TR3HB.cjs');
22
+
23
+
24
+ var _chunkXWONUCGAcjs = require('./chunk-XWONUCGA.cjs');
22
25
 
23
26
  // src/cart/react.ts
24
27
  var _react = require('react');
@@ -34,13 +37,13 @@ var CartError = class extends Error {
34
37
  };
35
38
  function cartReason(e) {
36
39
  if (e instanceof CartError) return { reason: e.reason, message: e.message };
37
- if (_chunkGO4TR3HBcjs.isMintError.call(void 0, e)) return _chunkGO4TR3HBcjs.toReason.call(void 0, e);
38
- return _chunkGO4TR3HBcjs.toReason.call(void 0, e);
40
+ if (_chunkXWONUCGAcjs.isMintError.call(void 0, e)) return _chunkXWONUCGAcjs.toReason.call(void 0, e);
41
+ return _chunkXWONUCGAcjs.toReason.call(void 0, e);
39
42
  }
40
43
 
41
44
  // src/cart/line.ts
42
45
  var _viem = require('viem');
43
- var isUnsupportedReason = (r) => _chunkGO4TR3HBcjs.UNSUPPORTED_REASONS.includes(r);
46
+ var isUnsupportedReason = (r) => _chunkXWONUCGAcjs.UNSUPPORTED_REASONS.includes(r);
44
47
  function deriveLine(args) {
45
48
  const { drop, walletRead, readError, now, pending, walletConnected } = args;
46
49
  const out = (state, reason = null, message = null) => ({ state, reason, message });
@@ -63,7 +66,7 @@ function lineMaxQuantity(drop, walletRead) {
63
66
  let max = null;
64
67
  if (drop.maxSupply !== null && drop.maxSupply > 0n) {
65
68
  const left = drop.maxSupply - drop.totalMinted;
66
- max = left > 0n ? left < BigInt(_chunkGO4TR3HBcjs.MAX_QUANTITY) ? Number(left) : _chunkGO4TR3HBcjs.MAX_QUANTITY : 0;
69
+ max = left > 0n ? left < BigInt(_chunkYGBIJOKQcjs.MAX_QUANTITY) ? Number(left) : _chunkYGBIJOKQcjs.MAX_QUANTITY : 0;
67
70
  }
68
71
  if (walletRead !== null && walletRead.maxQuantity !== null) {
69
72
  const cap = Math.max(0, Math.floor(walletRead.maxQuantity));
@@ -100,7 +103,7 @@ function sharedReadClient(raw) {
100
103
  const overrides = {
101
104
  getCode: (args) => {
102
105
  const address = args.address.toLowerCase();
103
- if (_chunkGO4TR3HBcjs.findExtension.call(void 0, chainId(), address)) return memo(forever, `code:${address}`, () => raw.getCode(args));
106
+ if (_chunkXWONUCGAcjs.findExtension.call(void 0, chainId(), address)) return memo(forever, `code:${address}`, () => raw.getCode(args));
104
107
  return raw.getCode(args);
105
108
  },
106
109
  readContract: (args) => {
@@ -185,19 +188,19 @@ function itemKey(config) {
185
188
  function canonicalConfig(config, chainId) {
186
189
  const c = _nullishCoalesce(config, () => ( {}));
187
190
  if (c.type !== "manifold-claim") {
188
- throw new (0, _chunkGO4TR3HBcjs.MintError)("INVALID_CONFIG", 'The cart takes only Manifold claims (type: "manifold-claim").', { field: "type" });
191
+ throw new (0, _chunkXWONUCGAcjs.MintError)("INVALID_CONFIG", 'The cart takes only Manifold claims (type: "manifold-claim").', { field: "type" });
189
192
  }
190
193
  if (c.chainId !== chainId) {
191
- throw new (0, _chunkGO4TR3HBcjs.MintError)("INVALID_CONFIG", `This cart is on chain ${String(chainId)}; the config is on chain ${String(c.chainId)}.`, { field: "chainId" });
194
+ throw new (0, _chunkXWONUCGAcjs.MintError)("INVALID_CONFIG", `This cart is on chain ${String(chainId)}; the config is on chain ${String(c.chainId)}.`, { field: "chainId" });
192
195
  }
193
196
  if (typeof c.creatorContract !== "string" || !_viem.isAddress.call(void 0, c.creatorContract, { strict: false })) {
194
- throw new (0, _chunkGO4TR3HBcjs.MintError)("INVALID_CONFIG", "creatorContract is not a valid address.", { field: "creatorContract" });
197
+ throw new (0, _chunkXWONUCGAcjs.MintError)("INVALID_CONFIG", "creatorContract is not a valid address.", { field: "creatorContract" });
195
198
  }
196
199
  if (typeof c.extension !== "string" || !_viem.isAddress.call(void 0, c.extension, { strict: false })) {
197
- throw new (0, _chunkGO4TR3HBcjs.MintError)("INVALID_CONFIG", "Cart configs must set extension (the claim extension address).", { field: "extension" });
200
+ throw new (0, _chunkXWONUCGAcjs.MintError)("INVALID_CONFIG", "Cart configs must set extension (the claim extension address).", { field: "extension" });
198
201
  }
199
202
  if (typeof c.instanceId !== "string" || !/^\d+$/.test(c.instanceId)) {
200
- throw new (0, _chunkGO4TR3HBcjs.MintError)("INVALID_CONFIG", "instanceId must be a non-negative integer string.", { field: "instanceId" });
203
+ throw new (0, _chunkXWONUCGAcjs.MintError)("INVALID_CONFIG", "instanceId must be a non-negative integer string.", { field: "instanceId" });
201
204
  }
202
205
  return {
203
206
  type: "manifold-claim",
@@ -207,13 +210,13 @@ function canonicalConfig(config, chainId) {
207
210
  extension: _viem.getAddress.call(void 0, c.extension)
208
211
  };
209
212
  }
210
- var clampQuantity = (q) => Math.max(1, Math.min(Math.floor(Number.isFinite(q) ? q : 1), _chunkGO4TR3HBcjs.MAX_QUANTITY));
213
+ var clampQuantity = (q) => Math.max(1, Math.min(Math.floor(Number.isFinite(q) ? q : 1), _chunkYGBIJOKQcjs.MAX_QUANTITY));
211
214
  var EMPTY_VALUE = (chainId) => ({ v: CART_VALUE_VERSION, chainId, items: [], pending: [], results: [] });
212
215
  var isRecord = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
213
216
  var isHash = (v) => typeof v === "string" && /^0x[0-9a-fA-F]{64}$/.test(v);
214
217
  var isAddr = (v) => typeof v === "string" && _viem.isAddress.call(void 0, v, { strict: false });
215
218
  var isIntStr = (v) => typeof v === "string" && /^\d+$/.test(v);
216
- var isQuantity = (v) => typeof v === "number" && Number.isInteger(v) && v >= 1 && v <= _chunkGO4TR3HBcjs.MAX_QUANTITY;
219
+ var isQuantity = (v) => typeof v === "number" && Number.isInteger(v) && v >= 1 && v <= _chunkYGBIJOKQcjs.MAX_QUANTITY;
217
220
  function restoreConfig(v, chainId) {
218
221
  try {
219
222
  return canonicalConfig(v, chainId);
@@ -552,7 +555,7 @@ var CART_TIMING = {
552
555
  merklePerMinute: 10
553
556
  };
554
557
  var nowSec = () => Math.floor(Date.now() / 1e3);
555
- var adapter = _chunkGO4TR3HBcjs.manifoldClaimAdapter;
558
+ var adapter = _chunkXWONUCGAcjs.manifoldClaimAdapter;
556
559
  var LineSkipped = class extends Error {
557
560
 
558
561
 
@@ -603,11 +606,11 @@ async function prepareLine(env, line, payer) {
603
606
  try {
604
607
  await adapter.simulate(a.ctx, a.attempt, a.plan);
605
608
  } catch (e) {
606
- if (e instanceof _chunkGO4TR3HBcjs.MintError && e.reason === "SIMULATION_REVERTED") throw new LineSkipped("ineligible", "SIMULATION_REVERTED", _chunkGO4TR3HBcjs.friendlyErrorMessage.call(void 0, e));
609
+ if (e instanceof _chunkXWONUCGAcjs.MintError && e.reason === "SIMULATION_REVERTED") throw new LineSkipped("ineligible", "SIMULATION_REVERTED", _chunkXWONUCGAcjs.friendlyErrorMessage.call(void 0, e));
607
610
  throw e;
608
611
  }
609
612
  const query = _nullishCoalesce(_optionalChain([adapter, 'access', _27 => _27.holdingsQuery, 'optionalCall', _28 => _28(a.drop)]), () => ( null));
610
- if (!query || !adapter.readHoldings) throw new (0, _chunkGO4TR3HBcjs.MintError)("RPC_ERROR", "The cart cannot count holdings for this item.");
613
+ if (!query || !adapter.readHoldings) throw new (0, _chunkXWONUCGAcjs.MintError)("RPC_ERROR", "The cart cannot count holdings for this item.");
611
614
  const before = await adapter.readHoldings(a.ctx, query, a.recipient);
612
615
  const unit = a.drop.unitPrice;
613
616
  return {
@@ -635,8 +638,8 @@ async function withRetries(fn, delaysMs, isFinal, signal) {
635
638
  }
636
639
  }
637
640
  }
638
- var sendSwitch = (chainId) => _chunkGO4TR3HBcjs.requestSwitch.call(void 0, chainId);
639
- var sendAddChain = (chainId) => _chunkGO4TR3HBcjs.requestAddChain.call(void 0, chainId);
641
+ var sendSwitch = (chainId) => _chunkYGBIJOKQcjs.requestSwitch.call(void 0, chainId);
642
+ var sendAddChain = (chainId) => _chunkYGBIJOKQcjs.requestAddChain.call(void 0, chainId);
640
643
  var openCalls = /* @__PURE__ */ new Set();
641
644
  var notSentCalls = /* @__PURE__ */ new Set();
642
645
  var markCallOpen = (id) => void openCalls.add(id);
@@ -647,15 +650,15 @@ var wasNotSent = (id) => notSentCalls.has(id);
647
650
  var SEND_METHODS = /* @__PURE__ */ new Set(["eth_sendTransaction", "wallet_sendTransaction"]);
648
651
  async function sendMint(prepared, hooks) {
649
652
  const notSent = (message, cause) => new CartError("REQUEST_NOT_SENT", message, { cause });
650
- const live = _chunkGO4TR3HBcjs.getAccount.call(void 0, );
653
+ const live = _chunkYGBIJOKQcjs.getAccount.call(void 0, );
651
654
  if (!live || live.address.toLowerCase() !== prepared.payer.toLowerCase()) {
652
655
  throw notSent("The connected wallet changed before the transaction was sent.");
653
656
  }
654
657
  let provider;
655
658
  let chain;
656
659
  try {
657
- provider = _chunkGO4TR3HBcjs.getWalletProvider.call(void 0, );
658
- chain = _chunkGO4TR3HBcjs.getChain.call(void 0, prepared.config.chainId);
660
+ provider = _chunkYGBIJOKQcjs.getWalletProvider.call(void 0, );
661
+ chain = _chunkXWONUCGAcjs.getChain.call(void 0, prepared.config.chainId);
659
662
  } catch (e) {
660
663
  throw notSent("No wallet is connected.", e);
661
664
  }
@@ -673,12 +676,13 @@ async function sendMint(prepared, hooks) {
673
676
  throw e;
674
677
  }
675
678
  hooks.onHash(hash);
679
+ void _chunkYGBIJOKQcjs.recordClaimMint.call(void 0, { instanceId: prepared.config.instanceId, hash });
676
680
  return hash;
677
681
  }
678
682
  var receiptOk = (status) => status === "success" || status === 1 || status === 1n || status === "0x1";
679
683
  function toMintReceipt(receipt, hash, tokenContract, recipient) {
680
684
  const ok = receiptOk(receipt.status);
681
- const parsed = ok ? _chunkGO4TR3HBcjs.parseMintReceipt.call(void 0, _nullishCoalesce(receipt.logs, () => ( [])), { tokenContract, recipient }) : [];
685
+ const parsed = ok ? _chunkYGBIJOKQcjs.parseMintReceipt.call(void 0, _nullishCoalesce(receipt.logs, () => ( [])), { tokenContract, recipient }) : [];
682
686
  const minted = parsed.reduce((n, t) => n + t.amount, 0n);
683
687
  const tokens = parsed.map((t) => ({ contract: t.contract, tokenId: t.tokenId.toString() }));
684
688
  return { status: ok ? "success" : "reverted", hash: _nullishCoalesce(receipt.transactionHash, () => ( hash)), minted, tokens };
@@ -811,7 +815,7 @@ function explorerTx(chainId, hash) {
811
815
  if (!hash) return null;
812
816
  let base;
813
817
  try {
814
- base = _optionalChain([_chunkGO4TR3HBcjs.getChain.call(void 0, chainId), 'access', _34 => _34.blockExplorers, 'optionalAccess', _35 => _35.default, 'access', _36 => _36.url]);
818
+ base = _optionalChain([_chunkXWONUCGAcjs.getChain.call(void 0, chainId), 'access', _34 => _34.blockExplorers, 'optionalAccess', _35 => _35.default, 'access', _36 => _36.url]);
815
819
  } catch (e11) {
816
820
  return null;
817
821
  }
@@ -845,17 +849,17 @@ var StateContext = _react.createContext.call(void 0, null);
845
849
  var InternalsContext = _react.createContext.call(void 0, null);
846
850
  function useCartInternals() {
847
851
  const v = _react.useContext.call(void 0, InternalsContext);
848
- if (!v) throw new (0, _chunkGO4TR3HBcjs.MintError)("INVALID_CONFIG", "useCheckout must be used inside <CartProvider>.");
852
+ if (!v) throw new (0, _chunkXWONUCGAcjs.MintError)("INVALID_CONFIG", "useCheckout must be used inside <CartProvider>.");
849
853
  return v;
850
854
  }
851
855
  function useCart() {
852
856
  const v = _react.useContext.call(void 0, StateContext);
853
- if (!v) throw new (0, _chunkGO4TR3HBcjs.MintError)("INVALID_CONFIG", "useCart must be used inside <CartProvider>.");
857
+ if (!v) throw new (0, _chunkXWONUCGAcjs.MintError)("INVALID_CONFIG", "useCart must be used inside <CartProvider>.");
854
858
  return v;
855
859
  }
856
860
  var isFinalRead = (e) => {
857
861
  const r = cartReason(e).reason;
858
- return _chunkGO4TR3HBcjs.UNSUPPORTED_REASONS.includes(r) || r === "INVALID_CONFIG";
862
+ return _chunkXWONUCGAcjs.UNSUPPORTED_REASONS.includes(r) || r === "INVALID_CONFIG";
859
863
  };
860
864
  var emptyValue = (chainId) => ({ v: 6, chainId, items: [], pending: [], results: [] });
861
865
  var LineBook = (_class3 = class {constructor() { _class3.prototype.__init11.call(this);_class3.prototype.__init12.call(this);_class3.prototype.__init13.call(this);_class3.prototype.__init14.call(this);_class3.prototype.__init15.call(this); }
@@ -908,9 +912,9 @@ var Core = (_class4 = class {constructor() { _class4.prototype.__init16.call(thi
908
912
  return this.lifetime;
909
913
  }
910
914
  }, _class4);
911
- var subscribeAccountChanges = (notify) => _chunkGO4TR3HBcjs.subscribeAccount.call(void 0, () => notify());
915
+ var subscribeAccountChanges = (notify) => _chunkYGBIJOKQcjs.subscribeAccount.call(void 0, () => notify());
912
916
  var accountSnapshot = () => {
913
- const a = _chunkGO4TR3HBcjs.getAccount.call(void 0, );
917
+ const a = _chunkYGBIJOKQcjs.getAccount.call(void 0, );
914
918
  return a ? `${a.address}:${String(a.chainId)}` : "";
915
919
  };
916
920
  function buildLines(value, book, payer, now, version) {
@@ -944,7 +948,7 @@ function CartProvider(props) {
944
948
  _react.useEffect.call(void 0, () => core.sync(value.items, payer), [core, value.items, payer]);
945
949
  _react.useEffect.call(void 0, () => {
946
950
  if (activeKeys.has(storageKey)) {
947
- throw new (0, _chunkGO4TR3HBcjs.MintError)("INVALID_CONFIG", "Only one CartProvider per storageKey. Wrap your app once.", { field: "storageKey" });
951
+ throw new (0, _chunkXWONUCGAcjs.MintError)("INVALID_CONFIG", "Only one CartProvider per storageKey. Wrap your app once.", { field: "storageKey" });
948
952
  }
949
953
  activeKeys.add(storageKey);
950
954
  core.setRegistered(storageKey);
@@ -963,7 +967,7 @@ function CartProvider(props) {
963
967
  }, []);
964
968
  const rpcKey = _nullishCoalesce(_optionalChain([rpcUrls, 'optionalAccess', _44 => _44[chainId]]), () => ( ""));
965
969
  const readClient = _react.useMemo.call(void 0,
966
- () => _chunkGO4TR3HBcjs.createReadClient.call(void 0, { chainId, ...rpcKey ? { rpcUrls: { [chainId]: rpcKey } } : {}, useBridge: true }),
970
+ () => _chunkXWONUCGAcjs.createReadClient.call(void 0, { chainId, ...rpcKey ? { rpcUrls: { [chainId]: rpcKey } } : {}, useBridge: true }),
967
971
  [chainId, rpcKey]
968
972
  );
969
973
  const shared = _react.useMemo.call(void 0, () => sharedReadClient(readClient), [readClient]);
@@ -986,14 +990,14 @@ function CartProvider(props) {
986
990
  [shared, chainId, merkleFetch, core]
987
991
  );
988
992
  _react.useEffect.call(void 0, () => {
989
- const loading = _chunkGO4TR3HBcjs.loadConnectWidget.call(void 0, { chainIds: [chainId], ...projectId ? { walletConnectProjectId: projectId } : {} });
993
+ const loading = _chunkYGBIJOKQcjs.loadConnectWidget.call(void 0, { chainIds: [chainId], ...projectId ? { walletConnectProjectId: projectId } : {} });
990
994
  core.setWidgetLoad(loading);
991
995
  loading.catch(() => void 0);
992
996
  }, [chainId, projectId, core]);
993
997
  const connect = _react.useCallback.call(void 0, async () => {
994
998
  try {
995
999
  await core.widgetLoad;
996
- return await _chunkGO4TR3HBcjs.openConnectModal.call(void 0, );
1000
+ return await _chunkYGBIJOKQcjs.openConnectModal.call(void 0, );
997
1001
  } catch (e13) {
998
1002
  return "dismissed";
999
1003
  }
@@ -1290,11 +1294,11 @@ function useCheckout() {
1290
1294
  };
1291
1295
  try {
1292
1296
  if (!k.store.persistenceOk()) return blocked("PERSISTENCE_UNAVAILABLE", "The cart could not save its state in this tab, so nothing was sent.");
1293
- let account = _chunkGO4TR3HBcjs.getAccount.call(void 0, );
1297
+ let account = _chunkYGBIJOKQcjs.getAccount.call(void 0, );
1294
1298
  if (!account) {
1295
1299
  const outcome = await k.connect();
1296
1300
  if (!live()) return;
1297
- account = _chunkGO4TR3HBcjs.getAccount.call(void 0, );
1301
+ account = _chunkYGBIJOKQcjs.getAccount.call(void 0, );
1298
1302
  if (outcome === "dismissed" || !account) return idle();
1299
1303
  }
1300
1304
  const payer = account.address;
@@ -1561,7 +1565,7 @@ function useCheckout() {
1561
1565
  const out2 = await k.settle(pending.id);
1562
1566
  return applyOutcome(pending.lineKey, pending.id, out2, null);
1563
1567
  }
1564
- if (_chunkGO4TR3HBcjs.isRejection.call(void 0, e)) {
1568
+ if (_chunkXWONUCGAcjs.isRejection.call(void 0, e)) {
1565
1569
  try {
1566
1570
  k.store.removePending(pending.id);
1567
1571
  } catch (e18) {