@sage-protocol/sdk 0.2.8 → 0.2.9

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/dist/index.cjs CHANGED
@@ -14,7 +14,7 @@ var require_package = __commonJS({
14
14
  "package.json"(exports2, module2) {
15
15
  module2.exports = {
16
16
  name: "@sage-protocol/sdk",
17
- version: "0.2.8",
17
+ version: "0.2.9",
18
18
  description: "Backend-agnostic SDK for interacting with the Sage Protocol (governance, SubDAOs, tokens).",
19
19
  main: "dist/index.cjs",
20
20
  module: "dist/index.mjs",
@@ -72,7 +72,6 @@ var require_package = __commonJS({
72
72
  },
73
73
  dependencies: {
74
74
  "@merit-systems/echo-typescript-sdk": "^1.0.17",
75
- "@whetstone-research/doppler-sdk": "^0.0.1-alpha.40",
76
75
  ai: "^5.0.52",
77
76
  axios: "^1.11.0",
78
77
  ethers: "^6.15.0",
@@ -164,8 +163,14 @@ var require_abi = __commonJS({
164
163
  "function createSubDAOOperatorWithStableAdvanced(string name, string description, uint8 accessModel, uint256 minStakeAmount, address operatorExecutor, address operatorAdmin, bool anyoneExec, bool governorProposer, (uint256 value,uint256 deadline,uint8 v,bytes32 r,bytes32 s) permit) returns (address subDAO, address registry)",
165
164
  "function createSubDAOOperator(string name, string description, uint8 accessModel, uint256 minStakeAmount, uint256 burnAmount, address operatorExecutor, address operatorAdmin) returns (address subDAO, address registry)",
166
165
  "function createSubDAOOperatorAdvanced(string name, string description, uint8 accessModel, uint256 minStakeAmount, uint256 burnAmount, address operatorExecutor, address operatorAdmin, bool anyoneExec, bool governorProposer) returns (address subDAO, address registry)",
166
+ // Forking (legacy overloads forward with maxForkFee=type(uint256).max)
167
167
  "function createForkedSubDAO(string newName, string newDescription, string originalName, address originalSubDAO, address forker, bool copyLibrary) returns (address subDAO, address registry)",
168
- "function createForkedSubDAOWithStable(string newName, string newDescription, string originalName, address originalSubDAO, address forker, uint64 authorizationNonce, (uint256 value,uint256 deadline,uint8 v,bytes32 r,bytes32 s) permit, bool copyLibrary) returns (address subDAO, address registry)"
168
+ // Forking (preferred: explicit maxForkFee slippage cap)
169
+ "function createForkedSubDAO(string newName, string newDescription, string originalName, address originalSubDAO, address forker, uint256 maxForkFee, bool copyLibrary) returns (address subDAO, address registry)",
170
+ // Stable-fee forking (legacy overloads forward with maxForkFee=type(uint256).max)
171
+ "function createForkedSubDAOWithStable(string newName, string newDescription, string originalName, address originalSubDAO, address forker, uint64 authorizationNonce, (uint256 value,uint256 deadline,uint8 v,bytes32 r,bytes32 s) permit, bool copyLibrary) returns (address subDAO, address registry)",
172
+ // Stable-fee forking (preferred: explicit maxForkFee slippage cap)
173
+ "function createForkedSubDAOWithStable(string newName, string newDescription, string originalName, address originalSubDAO, address forker, uint64 authorizationNonce, (uint256 value,uint256 deadline,uint8 v,bytes32 r,bytes32 s) permit, uint256 maxForkFee, bool copyLibrary) returns (address subDAO, address registry)"
169
174
  ];
170
175
  var TemplateModule = [
171
176
  "function getActiveTemplates() view returns (uint256[])",
@@ -176,13 +181,11 @@ var require_abi = __commonJS({
176
181
  "function maxCreationBurn() view returns (uint256)"
177
182
  ];
178
183
  var LibraryRegistry = [
179
- "function libraryByDAO(address) view returns (string manifestCID, address lastUpdater, uint256 lastUpdated, string version, address forkedFromDAO, uint256 sxxxForkFee, uint256 nonce)",
184
+ "function libraryByDAO(address) view returns (string manifestCID, address lastUpdater, uint256 lastUpdated, string version, uint256 nonce)",
180
185
  "function daoTimelock(address) view returns (address)",
181
- "function getLibrary(address) view returns (tuple(string manifestCID, address lastUpdater, uint256 lastUpdated, string version, address forkedFromDAO, uint256 sxxxForkFee, uint256 nonce))",
186
+ "function getLibrary(address) view returns (tuple(string manifestCID, address lastUpdater, uint256 lastUpdated, string version, uint256 nonce))",
182
187
  "function getLibraryIds(address dao) view returns (bytes32[] memory)",
183
- "function getLibraryStream(address dao, string libraryId) view returns (tuple(string manifestCID, address lastUpdater, uint256 lastUpdated, string version, address forkedFromDAO, uint256 sxxxForkFee, uint256 nonce))",
184
- "function getLibraryForkFee(address dao) view returns (uint256)",
185
- "function setLibraryForkFee(address dao, uint256 fee)",
188
+ "function getLibraryStream(address dao, string libraryId) view returns (tuple(string manifestCID, address lastUpdater, uint256 lastUpdated, string version, uint256 nonce))",
186
189
  "function updateLibrary(address dao, string manifestCID, string version)",
187
190
  "function updateLibraryCAS(address dao, string manifestCID, string version, uint256 expectedNonce)",
188
191
  "function updateLibraryStream(address dao, string libraryId, string manifestCID, string version)",
@@ -301,9 +304,6 @@ var require_abi = __commonJS({
301
304
  "function getForkBurnDiscount(address) view returns (uint256)",
302
305
  "function totalBurned() view returns (uint256)"
303
306
  ];
304
- var PersonalLibraryFacet = [
305
- "function createPersonalRegistry(uint8 policy) returns (address)"
306
- ];
307
307
  var PersonalMarketplace = [
308
308
  "function setPrice(bytes32 key, uint256 price)",
309
309
  "function purchase(address creator, bytes32 key, uint256 expectedPrice, uint256 deadline)"
@@ -330,7 +330,7 @@ var require_abi = __commonJS({
330
330
  "function setMerkleRoot(uint256 proposalId, bytes32 root)",
331
331
  "function finalize(uint256 proposalId)",
332
332
  "function claim(uint256 proposalId, address account, uint256 amount, bytes32[] proof)",
333
- "function getBoost(uint256 proposalId) view returns (uint256 totalPool, uint256 totalClaimed, bytes32 merkleRoot, bool active, bool finalized, address creator)",
333
+ "function getBoost(uint256 proposalId) view returns (uint256 totalPool, uint256 totalClaimed, bytes32 merkleRoot, uint256 expiresAt, bool active, bool finalized, address creator)",
334
334
  "function claimed(uint256 proposalId, address account) view returns (bool)",
335
335
  "event BoostCreated(uint256 indexed proposalId, address indexed creator, uint256 totalPool)",
336
336
  "event MerkleRootSet(uint256 indexed proposalId, bytes32 merkleRoot)",
@@ -428,7 +428,7 @@ var require_abi = __commonJS({
428
428
  "function weth() view returns (address)",
429
429
  "function timeBuffer() view returns (uint256)",
430
430
  "function reservePrice() view returns (uint256)",
431
- "function minBidIncrementPercentage() view returns (uint256)",
431
+ "function minBidIncrementBps() view returns (uint256)",
432
432
  "function duration() view returns (uint256)",
433
433
  "function mintTierId() view returns (uint256)",
434
434
  "function defaultTokenURI() view returns (string)",
@@ -438,7 +438,7 @@ var require_abi = __commonJS({
438
438
  "function paused() view returns (bool)",
439
439
  "function setTimeBuffer(uint256 _timeBuffer)",
440
440
  "function setReservePrice(uint256 _reservePrice)",
441
- "function setMinBidIncrementPercentage(uint256 _minBidIncrementPercentage)",
441
+ "function setMinBidIncrementBps(uint256 _minBidIncrementBps)",
442
442
  "function setDuration(uint256 _duration)",
443
443
  "function setMintTierId(uint256 _tierId)",
444
444
  "function setDefaultTokenURI(string _uri)",
@@ -451,7 +451,7 @@ var require_abi = __commonJS({
451
451
  "event AuctionSettled(uint256 indexed nftId, address winner, uint256 amount)",
452
452
  "event AuctionTimeBufferUpdated(uint256 timeBuffer)",
453
453
  "event AuctionReservePriceUpdated(uint256 reservePrice)",
454
- "event AuctionMinBidIncrementPercentageUpdated(uint256 minBidIncrementPercentage)",
454
+ "event AuctionMinBidIncrementBpsUpdated(uint256 minBidIncrementBps)",
455
455
  "event AuctionDurationUpdated(uint256 duration)"
456
456
  ];
457
457
  var SimpleBountySystem = [
@@ -461,10 +461,8 @@ var require_abi = __commonJS({
461
461
  // Bounty Creation
462
462
  "function createBounty(string title, string description, string ipfsCID, uint256 reward, uint256 deadline) returns (uint256)",
463
463
  "function createBountyAdvanced(string title, string description, string ipfsCID, uint256 reward, uint256 deadline, uint256 votingDuration, uint8 mode, uint8 libraryAction, address assignee, string libraryKey) returns (uint256)",
464
- // Submission & Claiming
465
- "function claimBounty(uint256 bountyId)",
464
+ // Submission
466
465
  "function submitEntry(uint256 bountyId, string promptIPFS, string deliverableIPFS) returns (uint256)",
467
- "function completeBounty(uint256 bountyId, string deliverableIPFS)",
468
466
  // Voting (COMPETITIVE mode)
469
467
  "function startVoting(uint256 bountyId)",
470
468
  "function vote(uint256 bountyId, uint256 submissionId)",
@@ -543,7 +541,6 @@ var require_abi = __commonJS({
543
541
  Timelock,
544
542
  ERC20Votes,
545
543
  SXXX,
546
- PersonalLibraryFacet,
547
544
  PersonalMarketplace,
548
545
  PersonalLicenseReceipt,
549
546
  TreasuryWrapper,
@@ -3878,15 +3875,17 @@ var require_library = __commonJS({
3878
3875
  return {
3879
3876
  manifestCID: info.manifestCID,
3880
3877
  previousCID: "",
3881
- // Not tracked on-chain in V4 (history is in events/subgraph)
3878
+ // Not tracked on-chain (history is in events/subgraph)
3882
3879
  timestamp: BigInt(info.lastUpdated.toString()),
3883
3880
  proposer: getAddress(info.lastUpdater),
3884
3881
  promptCount: 0,
3885
- // Not tracked on-chain in V4
3882
+ // Not tracked on-chain
3886
3883
  version: info.version,
3887
3884
  nonce: BigInt(info.nonce.toString()),
3888
- forkedFromDAO: info.forkedFromDAO && info.forkedFromDAO !== "0x0000000000000000000000000000000000000000" ? getAddress(info.forkedFromDAO) : null,
3889
- sxxxForkFee: BigInt(info.sxxxForkFee.toString())
3885
+ forkedFromDAO: null,
3886
+ // Removed from on-chain struct; use events/subgraph
3887
+ sxxxForkFee: 0n
3888
+ // Removed from on-chain struct
3890
3889
  };
3891
3890
  }
3892
3891
  async function getLibraryStreamInfo({ provider, registry, subdao: subdao2, libraryId = "default" }) {
@@ -3906,8 +3905,10 @@ var require_library = __commonJS({
3906
3905
  promptCount: 0,
3907
3906
  version: info.version,
3908
3907
  nonce: BigInt(info.nonce.toString()),
3909
- forkedFromDAO: info.forkedFromDAO && info.forkedFromDAO !== "0x0000000000000000000000000000000000000000" ? getAddress(info.forkedFromDAO) : null,
3910
- sxxxForkFee: BigInt(info.sxxxForkFee.toString())
3908
+ forkedFromDAO: null,
3909
+ // Removed from on-chain struct; use events/subgraph
3910
+ sxxxForkFee: 0n
3911
+ // Removed from on-chain struct
3911
3912
  };
3912
3913
  }
3913
3914
  async function getLibraryIds({ provider, registry, subdao: subdao2 }) {
@@ -4563,8 +4564,8 @@ var require_governance = __commonJS({
4563
4564
  const reg = new Contract(
4564
4565
  targets[i],
4565
4566
  [
4566
- "function libraryByDAO(address) view returns (tuple(string manifestCID,address lastUpdater,uint256 lastUpdated,string version,address forkedFromDAO,uint256 sxxxForkFee))",
4567
- "function getLibraryStream(address,string) view returns (tuple(string manifestCID,address lastUpdater,uint256 lastUpdated,string version,address forkedFromDAO,uint256 sxxxForkFee,uint256 nonce))"
4567
+ "function libraryByDAO(address) view returns (tuple(string manifestCID,address lastUpdater,uint256 lastUpdated,string version,uint256 nonce))",
4568
+ "function getLibraryStream(address,string) view returns (tuple(string manifestCID,address lastUpdater,uint256 lastUpdated,string version,uint256 nonce))"
4568
4569
  ],
4569
4570
  provider
4570
4571
  );
@@ -4598,8 +4599,8 @@ var require_governance = __commonJS({
4598
4599
  const reg = new Contract(
4599
4600
  targets[i],
4600
4601
  [
4601
- "function libraryByDAO(address) view returns (tuple(string manifestCID,address lastUpdater,uint256 lastUpdated,string version,address forkedFromDAO,uint256 sxxxForkFee))",
4602
- "function getLibraryStream(address,string) view returns (tuple(string manifestCID,address lastUpdater,uint256 lastUpdated,string version,address forkedFromDAO,uint256 sxxxForkFee,uint256 nonce))"
4602
+ "function libraryByDAO(address) view returns (tuple(string manifestCID,address lastUpdater,uint256 lastUpdated,string version,uint256 nonce))",
4603
+ "function getLibraryStream(address,string) view returns (tuple(string manifestCID,address lastUpdater,uint256 lastUpdated,string version,uint256 nonce))"
4603
4604
  ],
4604
4605
  provider
4605
4606
  );
@@ -4633,8 +4634,8 @@ var require_governance = __commonJS({
4633
4634
  const reg = new Contract(
4634
4635
  targets[i],
4635
4636
  [
4636
- "function getLibraryStream(address,string) view returns (tuple(string manifestCID,address lastUpdater,uint256 lastUpdated,string version,address forkedFromDAO,uint256 sxxxForkFee,uint256 nonce))",
4637
- "function libraryByDAO(address) view returns (tuple(string manifestCID,address lastUpdater,uint256 lastUpdated,string version,address forkedFromDAO,uint256 sxxxForkFee))"
4637
+ "function getLibraryStream(address,string) view returns (tuple(string manifestCID,address lastUpdater,uint256 lastUpdated,string version,uint256 nonce))",
4638
+ "function libraryByDAO(address) view returns (tuple(string manifestCID,address lastUpdater,uint256 lastUpdated,string version,uint256 nonce))"
4638
4639
  ],
4639
4640
  provider
4640
4641
  );
@@ -4675,8 +4676,8 @@ var require_governance = __commonJS({
4675
4676
  const reg = new Contract(
4676
4677
  targets[i],
4677
4678
  [
4678
- "function getLibraryStream(address,string) view returns (tuple(string manifestCID,address lastUpdater,uint256 lastUpdated,string version,address forkedFromDAO,uint256 sxxxForkFee,uint256 nonce))",
4679
- "function libraryByDAO(address) view returns (tuple(string manifestCID,address lastUpdater,uint256 lastUpdated,string version,address forkedFromDAO,uint256 sxxxForkFee))"
4679
+ "function getLibraryStream(address,string) view returns (tuple(string manifestCID,address lastUpdater,uint256 lastUpdated,string version,uint256 nonce))",
4680
+ "function libraryByDAO(address) view returns (tuple(string manifestCID,address lastUpdater,uint256 lastUpdated,string version,uint256 nonce))"
4680
4681
  ],
4681
4682
  provider
4682
4683
  );
@@ -7122,18 +7123,45 @@ var require_factory = __commonJS({
7122
7123
  ]);
7123
7124
  return { to: addr, data: payload, value: 0n };
7124
7125
  }
7125
- function buildCreateForkedSubDAOTx({ factory: factory2, newName, newDescription, originalName, originalSubDAO, forker }) {
7126
+ function buildCreateForkedSubDAOTx({
7127
+ factory: factory2,
7128
+ newName,
7129
+ newDescription,
7130
+ originalName,
7131
+ originalSubDAO,
7132
+ forker,
7133
+ copyLibrary = false,
7134
+ maxForkFee
7135
+ }) {
7126
7136
  const addr = normalise(factory2, "factory");
7127
- const payload = FactoryWriteInterface.encodeFunctionData("createForkedSubDAO", [
7137
+ const argsBase = [
7128
7138
  String(newName),
7129
7139
  String(newDescription),
7130
7140
  String(originalName),
7131
7141
  normalise(originalSubDAO, "originalSubDAO"),
7132
7142
  normalise(forker, "forker")
7133
- ]);
7143
+ ];
7144
+ const payload = maxForkFee === void 0 || maxForkFee === null ? FactoryWriteInterface.encodeFunctionData(
7145
+ "createForkedSubDAO(string,string,string,address,address,bool)",
7146
+ [...argsBase, Boolean(copyLibrary)]
7147
+ ) : FactoryWriteInterface.encodeFunctionData(
7148
+ "createForkedSubDAO(string,string,string,address,address,uint256,bool)",
7149
+ [...argsBase, BigInt(maxForkFee), Boolean(copyLibrary)]
7150
+ );
7134
7151
  return { to: addr, data: payload, value: 0n };
7135
7152
  }
7136
- function buildCreateForkedSubDAOWithStableTx({ factory: factory2, newName, newDescription, originalName, originalSubDAO, forker, authorizationNonce, permit }) {
7153
+ function buildCreateForkedSubDAOWithStableTx({
7154
+ factory: factory2,
7155
+ newName,
7156
+ newDescription,
7157
+ originalName,
7158
+ originalSubDAO,
7159
+ forker,
7160
+ authorizationNonce,
7161
+ permit,
7162
+ copyLibrary = false,
7163
+ maxForkFee
7164
+ }) {
7137
7165
  const addr = normalise(factory2, "factory");
7138
7166
  if (!permit) throw new SageSDKError(CODES.INVALID_ARGS, "permit required for stable fork");
7139
7167
  const tuple = [
@@ -7143,7 +7171,7 @@ var require_factory = __commonJS({
7143
7171
  permit.r ?? "0x0000000000000000000000000000000000000000000000000000000000000000",
7144
7172
  permit.s ?? "0x0000000000000000000000000000000000000000000000000000000000000000"
7145
7173
  ];
7146
- const payload = FactoryWriteInterface.encodeFunctionData("createForkedSubDAOWithStable", [
7174
+ const argsBase = [
7147
7175
  String(newName),
7148
7176
  String(newDescription),
7149
7177
  String(originalName),
@@ -7151,7 +7179,14 @@ var require_factory = __commonJS({
7151
7179
  normalise(forker, "forker"),
7152
7180
  Number(authorizationNonce ?? 0),
7153
7181
  tuple
7154
- ]);
7182
+ ];
7183
+ const payload = maxForkFee === void 0 || maxForkFee === null ? FactoryWriteInterface.encodeFunctionData(
7184
+ "createForkedSubDAOWithStable(string,string,string,address,address,uint64,(uint256,uint256,uint8,bytes32,bytes32),bool)",
7185
+ [...argsBase, Boolean(copyLibrary)]
7186
+ ) : FactoryWriteInterface.encodeFunctionData(
7187
+ "createForkedSubDAOWithStable(string,string,string,address,address,uint64,(uint256,uint256,uint8,bytes32,bytes32),uint256,bool)",
7188
+ [...argsBase, BigInt(maxForkFee), Boolean(copyLibrary)]
7189
+ );
7155
7190
  return { to: addr, data: payload, value: 0n };
7156
7191
  }
7157
7192
  function buildCreateSubDAOWithParamsTx({
@@ -7352,10 +7387,8 @@ var require_lineage = __commonJS({
7352
7387
  var { Contract, getAddress } = require("ethers");
7353
7388
  var { SageSDKError, CODES } = require_errors();
7354
7389
  var LINEAGE_ABI = [
7355
- "function libraryByDAO(address) view returns (string manifestCID, address lastUpdater, uint256 lastUpdated, string version, address forkedFromDAO, uint256 sxxxForkFee)",
7356
- "function getLibraryForkFee(address) view returns (uint256)"
7390
+ "function libraryByDAO(address) view returns (string manifestCID, address lastUpdater, uint256 lastUpdated, string version, uint256 nonce)"
7357
7391
  ];
7358
- var ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
7359
7392
  function normalise(address, label) {
7360
7393
  if (!address) throw new SageSDKError(CODES.INVALID_ARGS, `${label} required`);
7361
7394
  try {
@@ -7369,13 +7402,7 @@ var require_lineage = __commonJS({
7369
7402
  if (!registry) throw new SageSDKError(CODES.INVALID_ARGS, "registry required");
7370
7403
  if (!subdao2) throw new SageSDKError(CODES.INVALID_ARGS, "subdao required");
7371
7404
  try {
7372
- const contract = new Contract(normalise(registry, "registry"), LINEAGE_ABI, provider);
7373
- const info = await contract.libraryByDAO(normalise(subdao2, "subdao"));
7374
- const parent = info.forkedFromDAO;
7375
- if (!parent || parent === ZERO_ADDRESS) {
7376
- return null;
7377
- }
7378
- return getAddress(parent).toLowerCase();
7405
+ return null;
7379
7406
  } catch (err) {
7380
7407
  throw new SageSDKError(CODES.CONTRACT_ERROR, "Failed to fetch parent library", { cause: err });
7381
7408
  }
@@ -7385,25 +7412,11 @@ var require_lineage = __commonJS({
7385
7412
  if (!registry) throw new SageSDKError(CODES.INVALID_ARGS, "registry required");
7386
7413
  if (!subdao2) throw new SageSDKError(CODES.INVALID_ARGS, "subdao required");
7387
7414
  try {
7388
- const contract = new Contract(normalise(registry, "registry"), LINEAGE_ABI, provider);
7389
- const chain = [];
7390
- let current = normalise(subdao2, "subdao");
7391
- const MAX_DEPTH = 100;
7392
- let iterations = 0;
7393
- while (current && iterations < MAX_DEPTH) {
7394
- chain.unshift(getAddress(current).toLowerCase());
7395
- const info = await contract.libraryByDAO(current);
7396
- const parent = info.forkedFromDAO;
7397
- if (!parent || parent === ZERO_ADDRESS) {
7398
- break;
7399
- }
7400
- current = parent;
7401
- iterations++;
7402
- }
7415
+ const addr = getAddress(normalise(subdao2, "subdao")).toLowerCase();
7403
7416
  return {
7404
- chain,
7405
- depth: chain.length - 1,
7406
- root: chain[0]
7417
+ chain: [addr],
7418
+ depth: 0,
7419
+ root: addr
7407
7420
  };
7408
7421
  } catch (err) {
7409
7422
  throw new SageSDKError(CODES.CONTRACT_ERROR, "Failed to fetch lineage chain", { cause: err });
@@ -7414,16 +7427,7 @@ var require_lineage = __commonJS({
7414
7427
  return parent !== null;
7415
7428
  }
7416
7429
  async function getLibraryForkFee({ provider, registry, subdao: subdao2 }) {
7417
- if (!provider) throw new SageSDKError(CODES.INVALID_ARGS, "provider required");
7418
- if (!registry) throw new SageSDKError(CODES.INVALID_ARGS, "registry required");
7419
- if (!subdao2) throw new SageSDKError(CODES.INVALID_ARGS, "subdao required");
7420
- try {
7421
- const contract = new Contract(normalise(registry, "registry"), LINEAGE_ABI, provider);
7422
- const fee = await contract.getLibraryForkFee(normalise(subdao2, "subdao"));
7423
- return BigInt(fee.toString());
7424
- } catch (err) {
7425
- throw new SageSDKError(CODES.CONTRACT_ERROR, "Failed to fetch library fork fee", { cause: err });
7426
- }
7430
+ return 0n;
7427
7431
  }
7428
7432
  async function getLibraryInfo({ provider, registry, subdao: subdao2 }) {
7429
7433
  if (!provider) throw new SageSDKError(CODES.INVALID_ARGS, "provider required");
@@ -7432,10 +7436,11 @@ var require_lineage = __commonJS({
7432
7436
  try {
7433
7437
  const contract = new Contract(normalise(registry, "registry"), LINEAGE_ABI, provider);
7434
7438
  const info = await contract.libraryByDAO(normalise(subdao2, "subdao"));
7435
- const parent = info.forkedFromDAO;
7436
7439
  return {
7437
- parentDAO: !parent || parent === ZERO_ADDRESS ? null : getAddress(parent).toLowerCase(),
7438
- forkFee: BigInt(info.sxxxForkFee.toString()),
7440
+ parentDAO: null,
7441
+ // Fork lineage removed from on-chain struct
7442
+ forkFee: 0n,
7443
+ // Fork fees removed from on-chain struct
7439
7444
  manifestCID: info.manifestCID,
7440
7445
  version: info.version
7441
7446
  };
@@ -8631,12 +8636,6 @@ var require_personal = __commonJS({
8631
8636
  var { Interface } = require("ethers");
8632
8637
  var ABI = require_abi();
8633
8638
  var { normaliseAddress, toBytes32Key } = require_helpers();
8634
- function buildCreatePersonalRegistryTx({ factory: factory2, policy }) {
8635
- const to = normaliseAddress(factory2, "factory");
8636
- const iface = new Interface(ABI.PersonalLibraryFacet);
8637
- const data = iface.encodeFunctionData("createPersonalRegistry", [policy >>> 0]);
8638
- return { to, data, value: 0n };
8639
- }
8640
8639
  function buildSetPriceTx({ marketplace, key, price }) {
8641
8640
  const to = normaliseAddress(marketplace, "marketplace");
8642
8641
  const k = toBytes32Key(key);
@@ -8656,7 +8655,6 @@ var require_personal = __commonJS({
8656
8655
  return { to, data, value: 0n };
8657
8656
  }
8658
8657
  module2.exports = {
8659
- buildCreatePersonalRegistryTx,
8660
8658
  buildSetPriceTx,
8661
8659
  buildBuyTx,
8662
8660
  ...require_receipt(),
@@ -8665,300 +8663,6 @@ var require_personal = __commonJS({
8665
8663
  }
8666
8664
  });
8667
8665
 
8668
- // src/premium/index.js
8669
- var require_premium = __commonJS({
8670
- "src/premium/index.js"(exports2, module2) {
8671
- var axios = require("axios");
8672
- var { getAddress } = require("ethers");
8673
- function safeGetAddress(value) {
8674
- try {
8675
- return getAddress(value);
8676
- } catch {
8677
- return null;
8678
- }
8679
- }
8680
- function mapSafe(list, mapper) {
8681
- const out = [];
8682
- for (const item of list || []) {
8683
- try {
8684
- const v = mapper(item);
8685
- if (v != null) out.push(v);
8686
- } catch {
8687
- }
8688
- }
8689
- return out;
8690
- }
8691
- async function query(url, document, variables) {
8692
- if (!url) throw new Error("subgraph url required");
8693
- const resp = await axios.post(url, { query: document, variables }, { timeout: 1e4 });
8694
- if (resp.data && resp.data.errors) {
8695
- throw new Error(resp.data.errors.map((e) => e.message).join("; "));
8696
- }
8697
- return resp.data.data;
8698
- }
8699
- async function listPremiumPrompts({ url, subdao: subdao2 = null, first = 50, skip = 0, orderBy = "blockTimestamp", orderDirection = "desc" }) {
8700
- const safeOrderBy = ["blockTimestamp", "price"].includes(orderBy) ? orderBy : "blockTimestamp";
8701
- const safeOrderDirection = orderDirection === "asc" ? "asc" : "desc";
8702
- let doc;
8703
- const variables = {
8704
- first: Math.min(Math.max(1, Number(first || 50)), 200),
8705
- skip: Number(skip || 0)
8706
- };
8707
- if (subdao2) {
8708
- const addr = safeGetAddress(subdao2);
8709
- if (!addr) throw new Error("invalid subdao address");
8710
- variables.subdao = addr.toLowerCase();
8711
- doc = `
8712
- query($subdao: Bytes!, $first: Int!, $skip: Int!) {
8713
- premiumPrompts(
8714
- where: { subdao: $subdao }
8715
- first: $first
8716
- skip: $skip
8717
- orderBy: ${safeOrderBy}
8718
- orderDirection: ${safeOrderDirection}
8719
- ) {
8720
- id
8721
- cidHash
8722
- subdao
8723
- price
8724
- manifestCID
8725
- blockNumber
8726
- blockTimestamp
8727
- transactionHash
8728
- }
8729
- }
8730
- `;
8731
- } else {
8732
- doc = `
8733
- query($first: Int!, $skip: Int!) {
8734
- premiumPrompts(
8735
- first: $first
8736
- skip: $skip
8737
- orderBy: ${safeOrderBy}
8738
- orderDirection: ${safeOrderDirection}
8739
- ) {
8740
- id
8741
- cidHash
8742
- subdao
8743
- price
8744
- manifestCID
8745
- blockNumber
8746
- blockTimestamp
8747
- transactionHash
8748
- }
8749
- }
8750
- `;
8751
- }
8752
- const data = await query(url, doc, variables);
8753
- return mapSafe(data?.premiumPrompts, (p) => {
8754
- const sub = safeGetAddress(p.subdao);
8755
- if (!sub) return null;
8756
- return {
8757
- id: String(p.id),
8758
- cidHash: String(p.cidHash),
8759
- subdao: sub,
8760
- price: BigInt(String(p.price || "0")),
8761
- manifestCID: p.manifestCID || null,
8762
- blockNumber: Number(p.blockNumber || 0),
8763
- blockTimestamp: Number(p.blockTimestamp || 0),
8764
- transactionHash: p.transactionHash || null
8765
- };
8766
- });
8767
- }
8768
- async function getPremiumPrompt({ url, cidHash }) {
8769
- const id2 = cidHash.toLowerCase().startsWith("0x") ? cidHash.toLowerCase() : `0x${cidHash.toLowerCase()}`;
8770
- const doc = `
8771
- query($id: ID!) {
8772
- premiumPrompt(id: $id) {
8773
- id
8774
- cidHash
8775
- subdao
8776
- price
8777
- manifestCID
8778
- blockNumber
8779
- blockTimestamp
8780
- transactionHash
8781
- }
8782
- premiumPromptStats(id: $id) {
8783
- totalRevenue
8784
- purchaseCount
8785
- uniqueBuyers
8786
- currentHolders
8787
- }
8788
- }
8789
- `;
8790
- const data = await query(url, doc, { id: id2 });
8791
- const p = data?.premiumPrompt;
8792
- if (!p) return null;
8793
- const sub = safeGetAddress(p.subdao);
8794
- if (!sub) return null;
8795
- const stats = data?.premiumPromptStats || {};
8796
- return {
8797
- id: String(p.id),
8798
- cidHash: String(p.cidHash),
8799
- subdao: sub,
8800
- price: BigInt(String(p.price || "0")),
8801
- manifestCID: p.manifestCID || null,
8802
- blockNumber: Number(p.blockNumber || 0),
8803
- blockTimestamp: Number(p.blockTimestamp || 0),
8804
- transactionHash: p.transactionHash || null,
8805
- // Stats
8806
- totalRevenue: stats.totalRevenue ? BigInt(String(stats.totalRevenue)) : null,
8807
- purchaseCount: stats.purchaseCount ? BigInt(String(stats.purchaseCount)) : null,
8808
- uniqueBuyers: stats.uniqueBuyers ? BigInt(String(stats.uniqueBuyers)) : null,
8809
- currentHolders: stats.currentHolders ? BigInt(String(stats.currentHolders)) : null
8810
- };
8811
- }
8812
- async function listPremiumPurchases({ url, cidHash, first = 50, skip = 0 }) {
8813
- const normalizedCidHash = cidHash.toLowerCase().startsWith("0x") ? cidHash.toLowerCase() : `0x${cidHash.toLowerCase()}`;
8814
- const doc = `
8815
- query($cidHash: Bytes!, $first: Int!, $skip: Int!) {
8816
- premiumPurchases(
8817
- where: { cidHash: $cidHash }
8818
- first: $first
8819
- skip: $skip
8820
- orderBy: blockTimestamp
8821
- orderDirection: desc
8822
- ) {
8823
- id
8824
- cidHash
8825
- buyer
8826
- price
8827
- treasury
8828
- blockNumber
8829
- blockTimestamp
8830
- transactionHash
8831
- }
8832
- }
8833
- `;
8834
- const data = await query(url, doc, {
8835
- cidHash: normalizedCidHash,
8836
- first: Math.min(Math.max(1, Number(first || 50)), 200),
8837
- skip: Number(skip || 0)
8838
- });
8839
- return mapSafe(data?.premiumPurchases, (p) => {
8840
- const buyer = safeGetAddress(p.buyer);
8841
- const treasury2 = safeGetAddress(p.treasury);
8842
- if (!buyer || !treasury2) return null;
8843
- return {
8844
- id: String(p.id),
8845
- cidHash: String(p.cidHash),
8846
- buyer,
8847
- price: BigInt(String(p.price || "0")),
8848
- treasury: treasury2,
8849
- blockNumber: Number(p.blockNumber || 0),
8850
- blockTimestamp: Number(p.blockTimestamp || 0),
8851
- transactionHash: p.transactionHash || null
8852
- };
8853
- });
8854
- }
8855
- async function hasPurchased({ url, cidHash, holder }) {
8856
- const normalizedCidHash = cidHash.toLowerCase().startsWith("0x") ? cidHash.toLowerCase() : `0x${cidHash.toLowerCase()}`;
8857
- const normalizedHolder = holder.toLowerCase();
8858
- const id2 = `${normalizedCidHash}-${normalizedHolder}`;
8859
- const doc = `
8860
- query($id: ID!) {
8861
- premiumHolderBalance(id: $id) {
8862
- balance
8863
- }
8864
- }
8865
- `;
8866
- const data = await query(url, doc, { id: id2 });
8867
- const balance = data?.premiumHolderBalance?.balance;
8868
- return balance ? BigInt(String(balance)) > 0n : false;
8869
- }
8870
- async function getHolderBalance({ url, cidHash, holder }) {
8871
- const normalizedCidHash = cidHash.toLowerCase().startsWith("0x") ? cidHash.toLowerCase() : `0x${cidHash.toLowerCase()}`;
8872
- const normalizedHolder = holder.toLowerCase();
8873
- const id2 = `${normalizedCidHash}-${normalizedHolder}`;
8874
- const doc = `
8875
- query($id: ID!) {
8876
- premiumHolderBalance(id: $id) {
8877
- balance
8878
- updatedAt
8879
- }
8880
- }
8881
- `;
8882
- const data = await query(url, doc, { id: id2 });
8883
- const row = data?.premiumHolderBalance;
8884
- if (!row) return 0n;
8885
- return BigInt(String(row.balance || "0"));
8886
- }
8887
- async function listHolders({ url, cidHash, first = 100, skip = 0 }) {
8888
- const normalizedCidHash = cidHash.toLowerCase().startsWith("0x") ? cidHash.toLowerCase() : `0x${cidHash.toLowerCase()}`;
8889
- const doc = `
8890
- query($cidHash: Bytes!, $first: Int!, $skip: Int!) {
8891
- premiumHolderBalances(
8892
- where: { cidHash: $cidHash, balance_gt: "0" }
8893
- first: $first
8894
- skip: $skip
8895
- orderBy: balance
8896
- orderDirection: desc
8897
- ) {
8898
- id
8899
- cidHash
8900
- holder
8901
- balance
8902
- updatedAt
8903
- }
8904
- }
8905
- `;
8906
- const data = await query(url, doc, {
8907
- cidHash: normalizedCidHash,
8908
- first: Math.min(Math.max(1, Number(first || 100)), 500),
8909
- skip: Number(skip || 0)
8910
- });
8911
- return mapSafe(data?.premiumHolderBalances, (h) => {
8912
- const holder = safeGetAddress(h.holder);
8913
- if (!holder) return null;
8914
- return {
8915
- id: String(h.id),
8916
- cidHash: String(h.cidHash),
8917
- holder,
8918
- balance: BigInt(String(h.balance || "0")),
8919
- updatedAt: Number(h.updatedAt || 0)
8920
- };
8921
- });
8922
- }
8923
- async function getRevSplit({ url, subdao: subdao2 }) {
8924
- const addr = safeGetAddress(subdao2);
8925
- if (!addr) throw new Error("invalid subdao address");
8926
- const doc = `
8927
- query($id: ID!) {
8928
- premiumRevSplit(id: $id) {
8929
- id
8930
- subdao
8931
- treasuryBps
8932
- protocolBps
8933
- creatorBps
8934
- updatedAt
8935
- }
8936
- }
8937
- `;
8938
- const data = await query(url, doc, { id: addr.toLowerCase() });
8939
- const split = data?.premiumRevSplit;
8940
- if (!split) return null;
8941
- return {
8942
- id: String(split.id),
8943
- subdao: safeGetAddress(split.subdao) || addr,
8944
- treasuryBps: Number(split.treasuryBps || 0),
8945
- protocolBps: Number(split.protocolBps || 0),
8946
- creatorBps: Number(split.creatorBps || 0),
8947
- updatedAt: Number(split.updatedAt || 0)
8948
- };
8949
- }
8950
- module2.exports = {
8951
- listPremiumPrompts,
8952
- getPremiumPrompt,
8953
- listPremiumPurchases,
8954
- hasPurchased,
8955
- getHolderBalance,
8956
- listHolders,
8957
- getRevSplit
8958
- };
8959
- }
8960
- });
8961
-
8962
8666
  // src/utils/privateTx.js
8963
8667
  var require_privateTx = __commonJS({
8964
8668
  "src/utils/privateTx.js"(exports2, module2) {
@@ -9478,7 +9182,7 @@ var require_boost = __commonJS({
9478
9182
  const contract = new Contract(addr, ABI.GovernanceBoostMerkle, provider);
9479
9183
  const result = await contract.getBoost(proposalId).catch(() => null);
9480
9184
  if (!result) return null;
9481
- const [totalPool, totalClaimed, merkleRoot, active, finalized, creator] = result;
9185
+ const [totalPool, totalClaimed, merkleRoot, expiresAt, active, finalized, creator] = result;
9482
9186
  const creatorAddr = creator ? getAddress(creator) : ZERO_ADDRESS;
9483
9187
  const pool = toBigInt(totalPool);
9484
9188
  if (!active && !finalized && pool === 0n && creatorAddr === ZERO_ADDRESS) return null;
@@ -9488,6 +9192,7 @@ var require_boost = __commonJS({
9488
9192
  totalPool: pool,
9489
9193
  totalClaimed: toBigInt(totalClaimed),
9490
9194
  merkleRoot,
9195
+ expiresAt: toBigInt(expiresAt),
9491
9196
  active: Boolean(active),
9492
9197
  finalized: Boolean(finalized),
9493
9198
  creator: creatorAddr
@@ -10756,13 +10461,13 @@ var require_auction = __commonJS({
10756
10461
  }
10757
10462
  async function getConfig({ provider, auctionHouse }) {
10758
10463
  const c = getAuctionContract(provider, auctionHouse);
10759
- const [nft, treasury2, weth, timeBuffer, reservePrice, minBidIncrementPercentage, duration, mintTierId, defaultTokenURI, paused, owner] = await Promise.all([
10464
+ const [nft, treasury2, weth, timeBuffer, reservePrice, minBidIncrementBps, duration, mintTierId, defaultTokenURI, paused, owner] = await Promise.all([
10760
10465
  c.nft(),
10761
10466
  c.treasury(),
10762
10467
  c.weth(),
10763
10468
  c.timeBuffer(),
10764
10469
  c.reservePrice(),
10765
- c.minBidIncrementPercentage(),
10470
+ c.minBidIncrementBps(),
10766
10471
  c.duration(),
10767
10472
  c.mintTierId(),
10768
10473
  c.defaultTokenURI(),
@@ -10775,7 +10480,7 @@ var require_auction = __commonJS({
10775
10480
  weth: getAddress(weth),
10776
10481
  timeBuffer: BigInt(timeBuffer.toString()),
10777
10482
  reservePrice: BigInt(reservePrice.toString()),
10778
- minBidIncrementPercentage: BigInt(minBidIncrementPercentage.toString()),
10483
+ minBidIncrementBps: BigInt(minBidIncrementBps.toString()),
10779
10484
  duration: BigInt(duration.toString()),
10780
10485
  mintTierId: BigInt(mintTierId.toString()),
10781
10486
  defaultTokenURI: String(defaultTokenURI),
@@ -10831,10 +10536,10 @@ var require_auction = __commonJS({
10831
10536
  const data = iface.encodeFunctionData("setReservePrice", [toBigInt(reservePrice, "reservePrice")]);
10832
10537
  return { to: addr, data, value: 0n };
10833
10538
  }
10834
- function buildSetMinBidIncrementTx({ auctionHouse, percentage }) {
10539
+ function buildSetMinBidIncrementTx({ auctionHouse, bps }) {
10835
10540
  const addr = normaliseAddress(auctionHouse, "auctionHouse");
10836
10541
  const iface = new Interface(ABI.SageAuctionHouse);
10837
- const data = iface.encodeFunctionData("setMinBidIncrementPercentage", [toBigInt(percentage, "percentage")]);
10542
+ const data = iface.encodeFunctionData("setMinBidIncrementBps", [toBigInt(bps, "bps")]);
10838
10543
  return { to: addr, data, value: 0n };
10839
10544
  }
10840
10545
  function buildSetDurationTx({ auctionHouse, duration }) {
@@ -12030,6 +11735,24 @@ ${error}` : ""}`;
12030
11735
  } else if (data.startsWith(require("ethers").id("authorizeBurner(address)").slice(0, 10))) {
12031
11736
  const burner = this.extractAddressFromData(data, 0);
12032
11737
  return { signature: "authorizeBurner(address)", args: [burner] };
11738
+ } else if (data.startsWith(require("ethers").id("createBoost((address,uint256,uint256,uint256,uint8,address,uint96,uint8,uint8,uint256,uint256))").slice(0, 10))) {
11739
+ const { ethers: ethers2 } = require("ethers");
11740
+ const sig = "createBoost((address,uint256,uint256,uint256,uint8,address,uint96,uint8,uint8,uint256,uint256))";
11741
+ const iface = new ethers2.Interface([`function ${sig}`]);
11742
+ const d = iface.decodeFunctionData("createBoost", data);
11743
+ const params = d?.[0] ?? d;
11744
+ const governor = String(params?.governor ?? params?.[0]);
11745
+ const proposalId = (params?.proposalId ?? params?.[1])?.toString();
11746
+ const perVoter = (params?.perVoter ?? params?.[2])?.toString();
11747
+ const maxVoters = (params?.maxVoters ?? params?.[3])?.toString();
11748
+ const kind = (params?.kind ?? params?.[4])?.toString();
11749
+ const policy = String(params?.policy ?? params?.[5]);
11750
+ const minVotes = (params?.minVotes ?? params?.[6])?.toString();
11751
+ const payoutMode = (params?.payoutMode ?? params?.[7])?.toString();
11752
+ const support = (params?.support ?? params?.[8])?.toString();
11753
+ const startAt = (params?.startAt ?? params?.[9])?.toString();
11754
+ const expiresAt = (params?.expiresAt ?? params?.[10])?.toString();
11755
+ return { signature: sig, args: [governor, proposalId, perVoter, maxVoters, kind, policy, minVotes, payoutMode, support, startAt, expiresAt] };
12033
11756
  } else if (data.startsWith(require("ethers").id("createBoost(address,uint256,uint256,uint256,uint8,address,uint96,uint8,uint8,uint256,uint256)").slice(0, 10))) {
12034
11757
  const { ethers: ethers2 } = require("ethers");
12035
11758
  const sig = "createBoost(address,uint256,uint256,uint256,uint8,address,uint96,uint8,uint8,uint256,uint256)";
@@ -12100,25 +11823,6 @@ ${error}` : ""}`;
12100
11823
  const d = iface.decodeFunctionData("forkPromptWithStable", data);
12101
11824
  const args = [`"${String(d[0])}"`, `"${String(d[1])}"`, `"${String(d[2])}"`, `"${String(d[3])}"`, "[permit]"];
12102
11825
  return { signature: sig, args };
12103
- } else if (data.startsWith(require("ethers").id("createPremiumPrompt(bytes32,address,uint256)").slice(0, 10))) {
12104
- const { ethers: ethers2 } = require("ethers");
12105
- const sig = "createPremiumPrompt(bytes32,address,uint256)";
12106
- const iface = new ethers2.Interface([`function ${sig}`]);
12107
- const d = iface.decodeFunctionData("createPremiumPrompt", data);
12108
- const hash = d[0];
12109
- const subdao2 = d[1];
12110
- const price = d[2].toString();
12111
- return { signature: sig, args: [hash, subdao2, price] };
12112
- } else if (data.startsWith(require("ethers").id("createPremiumPromptWithManifest(bytes32,address,uint256,string)").slice(0, 10))) {
12113
- const { ethers: ethers2 } = require("ethers");
12114
- const sig = "createPremiumPromptWithManifest(bytes32,address,uint256,string)";
12115
- const iface = new ethers2.Interface([`function ${sig}`]);
12116
- const d = iface.decodeFunctionData("createPremiumPromptWithManifest", data);
12117
- const hash = d[0];
12118
- const subdao2 = d[1];
12119
- const price = d[2].toString();
12120
- const manifest = d[3];
12121
- return { signature: sig, args: [hash, subdao2, price, `"${manifest}"`] };
12122
11826
  } else if (data.startsWith(require("ethers").id("claim(uint256,address,uint256,bytes32[])").slice(0, 10))) {
12123
11827
  const { ethers: ethers2 } = require("ethers");
12124
11828
  const sig = "claim(uint256,address,uint256,bytes32[])";
@@ -12130,18 +11834,6 @@ ${error}` : ""}`;
12130
11834
  const proofArray = (d[3] || []).map((x) => String(x));
12131
11835
  const formattedProof = `[${proofArray.join(",")}]`;
12132
11836
  return { signature: sig, args: [proposalId, account, amount, formattedProof] };
12133
- } else if (data.startsWith(require("ethers").id("purchaseAccess(bytes32)").slice(0, 10))) {
12134
- const { ethers: ethers2 } = require("ethers");
12135
- const iface = new ethers2.Interface(["function purchaseAccess(bytes32)"]);
12136
- const d = iface.decodeFunctionData("purchaseAccess", data);
12137
- return { signature: "purchaseAccess(bytes32)", args: [d[0]] };
12138
- } else if (data.startsWith(require("ethers").id("setProtocolRake(uint96,address)").slice(0, 10))) {
12139
- const { ethers: ethers2 } = require("ethers");
12140
- const iface = new ethers2.Interface(["function setProtocolRake(uint96,address)"]);
12141
- const decoded = iface.decodeFunctionData("setProtocolRake", data);
12142
- const bps = decoded[0].toString();
12143
- const treas = decoded[1];
12144
- return { signature: "setProtocolRake(uint96,address)", args: [bps, treas] };
12145
11837
  } else if (data.startsWith(require("ethers").id("revokeBurner(address)").slice(0, 10))) {
12146
11838
  const burner = this.extractAddressFromData(data, 0);
12147
11839
  return { signature: "revokeBurner(address)", args: [burner] };
@@ -12591,276 +12283,6 @@ var require_typed = __commonJS({
12591
12283
  }
12592
12284
  });
12593
12285
 
12594
- // src/doppler/index.js
12595
- var require_doppler = __commonJS({
12596
- "src/doppler/index.js"(exports2, module2) {
12597
- var { createPublicClient, createWalletClient, http } = require("viem");
12598
- var { privateKeyToAccount } = require("viem/accounts");
12599
- var { erc20Abi } = require("viem");
12600
- var { base, baseSepolia } = require("viem/chains");
12601
- var dopplerLib = require("@whetstone-research/doppler-sdk");
12602
- function getChainById(chainId) {
12603
- if (Number(chainId) === baseSepolia.id) return baseSepolia;
12604
- if (Number(chainId) === base.id) return base;
12605
- return { id: Number(chainId), name: `chain-${chainId}` };
12606
- }
12607
- function initDoppler(opts) {
12608
- const chain = getChainById(opts.chainId);
12609
- const publicClient = createPublicClient({ chain, transport: http(opts.rpcUrl) });
12610
- let walletClient;
12611
- if (opts.privateKey) {
12612
- const pk = opts.privateKey.startsWith("0x") ? opts.privateKey : `0x${opts.privateKey}`;
12613
- const account = privateKeyToAccount(pk);
12614
- walletClient = createWalletClient({ chain, transport: http(opts.rpcUrl), account });
12615
- } else if (opts.account) {
12616
- walletClient = createWalletClient({ chain, transport: http(opts.rpcUrl), account: opts.account });
12617
- }
12618
- const DopplerSDK = dopplerLib.DopplerSDK || dopplerLib.default?.DopplerSDK || dopplerLib;
12619
- const sdk = new DopplerSDK({ publicClient, walletClient, chainId: chain.id });
12620
- return sdk;
12621
- }
12622
- async function deployDynamicAuction(sdk, user, p) {
12623
- const DynamicAuctionBuilder = dopplerLib.DynamicAuctionBuilder || dopplerLib.default?.DynamicAuctionBuilder;
12624
- if (!DynamicAuctionBuilder) throw new Error("DynamicAuctionBuilder missing from doppler-sdk");
12625
- const builder = new DynamicAuctionBuilder().tokenConfig({ name: p.token.name, symbol: p.token.symbol, tokenURI: p.token.tokenURI }).saleConfig({ initialSupply: p.sale.initialSupply, numTokensToSell: p.sale.numTokensToSell, numeraire: p.sale.numeraire }).poolConfig({ fee: p.pool.fee, tickSpacing: p.pool.tickSpacing }).withUserAddress(user);
12626
- if (p.auction && p.auction.startPrice && p.auction.endPrice && typeof builder.auctionByPriceRange === "function") {
12627
- builder.auctionByPriceRange({
12628
- priceRange: { startPrice: p.auction.startPrice, endPrice: p.auction.endPrice },
12629
- minProceeds: p.auction.minProceeds || 0n,
12630
- maxProceeds: p.auction.maxProceeds || 0n,
12631
- durationDays: p.auction.durationDays,
12632
- epochLength: p.auction.epochLength,
12633
- numPdSlugs: p.auction.numPdSlugs || 5
12634
- });
12635
- } else if (typeof builder.auctionByTicks === "function") {
12636
- throw new Error("auctionByPriceRange not supported by current doppler-sdk version; please provide tick params instead");
12637
- } else {
12638
- throw new Error("No supported auction configuration method on doppler-sdk builder");
12639
- }
12640
- builder.withMigration({
12641
- type: p.migration.type || "uniswapV4",
12642
- fee: p.migration.fee,
12643
- tickSpacing: p.migration.tickSpacing,
12644
- lpRecipient: p.migration.lpRecipient
12645
- });
12646
- if (p.governance && typeof builder.withGovernance === "function") {
12647
- builder.withGovernance(p.governance);
12648
- }
12649
- if (p.overrides?.airlock && typeof builder.withAirlock === "function") builder.withAirlock(p.overrides.airlock);
12650
- if (p.overrides?.dopplerDeployer && typeof builder.withDopplerDeployer === "function") builder.withDopplerDeployer(p.overrides.dopplerDeployer);
12651
- if (p.overrides?.governanceFactory && typeof builder.withGovernanceFactory === "function") builder.withGovernanceFactory(p.overrides.governanceFactory);
12652
- if (p.overrides?.v4Initializer && typeof builder.withV4Initializer === "function") builder.withV4Initializer(p.overrides.v4Initializer);
12653
- const params = builder.build();
12654
- const result = await sdk.factory.createDynamicAuction(params);
12655
- return result;
12656
- }
12657
- async function getAuctionStatus(sdk, auctionAddress) {
12658
- const lens = sdk.lens;
12659
- if (lens && typeof lens.getAuctionStatus === "function") {
12660
- return await lens.getAuctionStatus({ auctionAddress });
12661
- }
12662
- return { auctionAddress, note: "Lens API not available in this doppler-sdk version" };
12663
- }
12664
- async function listAuctions(sdk, { limit = 10, cursor } = {}) {
12665
- const lens = sdk.lens;
12666
- if (lens) {
12667
- if (typeof lens.listAuctions === "function") {
12668
- try {
12669
- return await lens.listAuctions({ limit, cursor });
12670
- } catch (e) {
12671
- }
12672
- }
12673
- if (typeof lens.getAuctions === "function") {
12674
- try {
12675
- return await lens.getAuctions({ limit, cursor });
12676
- } catch (e) {
12677
- }
12678
- }
12679
- }
12680
- const fac = sdk.factory;
12681
- if (fac && typeof fac.listAuctions === "function") {
12682
- try {
12683
- return await fac.listAuctions({ limit, cursor });
12684
- } catch (e) {
12685
- }
12686
- }
12687
- return { ok: false, error: "LIST_UNSUPPORTED", message: "Listing auctions not supported by this doppler-sdk version" };
12688
- }
12689
- async function buyTokens(sdk, { auctionAddress, numeraireAmount }) {
12690
- const trade = sdk.trade || sdk.swap || sdk.auction;
12691
- if (trade && typeof trade.buy === "function") {
12692
- try {
12693
- return await trade.buy({ auctionAddress, numeraireAmount });
12694
- } catch (e) {
12695
- }
12696
- }
12697
- return { ok: false, error: "BUY_UNSUPPORTED", message: "Buy not supported by this doppler-sdk version. Use executeV3BuyExactIn/urExecute helpers or upgrade doppler-sdk." };
12698
- }
12699
- async function migrate(sdk, asset) {
12700
- if (sdk.airlock && typeof sdk.airlock.migrate === "function") {
12701
- return await sdk.airlock.migrate({ asset });
12702
- }
12703
- throw new Error("Migrate is not supported by the current doppler-sdk version");
12704
- }
12705
- module2.exports = {
12706
- initDoppler,
12707
- deployDynamicAuction,
12708
- getAuctionStatus,
12709
- listAuctions,
12710
- buyTokens,
12711
- migrate
12712
- };
12713
- module2.exports.deployStaticAuction = async function deployStaticAuction(sdk, user, p) {
12714
- const StaticAuctionBuilder = dopplerLib.StaticAuctionBuilder || dopplerLib.default?.StaticAuctionBuilder;
12715
- if (!StaticAuctionBuilder) throw new Error("StaticAuctionBuilder missing from doppler-sdk");
12716
- const builder = new StaticAuctionBuilder().tokenConfig({ name: p.token.name, symbol: p.token.symbol, tokenURI: p.token.tokenURI }).saleConfig({ initialSupply: p.sale.initialSupply, numTokensToSell: p.sale.numTokensToSell, numeraire: p.sale.numeraire }).poolByTicks({ startTick: p.pool.startTick, endTick: p.pool.endTick, fee: p.pool.fee, numPositions: p.pool.numPositions || 15 }).withUserAddress(user);
12717
- if (p.governance?.noOp) builder.withGovernance({ noOp: true });
12718
- if (p.migration) builder.withMigration(p.migration);
12719
- if (p.modules?.airlock && typeof builder.withAirlock === "function") builder.withAirlock(p.modules.airlock);
12720
- if (p.modules?.v3Initializer && typeof builder.withV3Initializer === "function") builder.withV3Initializer(p.modules.v3Initializer);
12721
- const params = builder.build();
12722
- const res = await sdk.factory.createStaticAuction(params);
12723
- return res;
12724
- };
12725
- module2.exports.getStaticPoolInfo = async function getStaticPoolInfo(sdk, poolAddress) {
12726
- const auction2 = await sdk.getStaticAuction(poolAddress);
12727
- return auction2.getPoolInfo();
12728
- };
12729
- module2.exports.quoteV3ExactIn = async function quoteV3ExactIn(sdk, { tokenIn, tokenOut, amountIn, fee, sqrtPriceLimitX96 = 0n }) {
12730
- return sdk.quoter.quoteExactInputV3({ tokenIn, tokenOut, amountIn, fee, sqrtPriceLimitX96 });
12731
- };
12732
- var WETH_ABI = [
12733
- { type: "function", name: "deposit", stateMutability: "payable", inputs: [], outputs: [] },
12734
- { type: "function", name: "withdraw", stateMutability: "nonpayable", inputs: [{ name: "wad", type: "uint256" }], outputs: [] },
12735
- { type: "function", name: "balanceOf", stateMutability: "view", inputs: [{ name: "a", type: "address" }], outputs: [{ type: "uint256" }] }
12736
- ];
12737
- module2.exports.wrapEthToWethIfNeeded = async function wrapEthToWethIfNeeded({ rpcUrl, chainId, privateKey, weth, owner, minAmount }) {
12738
- const chain = getChainById(chainId);
12739
- const accountObj = privateKeyToAccount(privateKey.startsWith("0x") ? privateKey : `0x${privateKey}`);
12740
- const publicClient = createPublicClient({ chain, transport: http(rpcUrl) });
12741
- const walletClient = createWalletClient({ chain, transport: http(rpcUrl), account: accountObj });
12742
- const bal = await publicClient.readContract({ address: weth, abi: WETH_ABI, functionName: "balanceOf", args: [owner] });
12743
- if (bal >= minAmount) return { deposited: 0n };
12744
- const needed = minAmount - bal;
12745
- const hash = await walletClient.writeContract({ address: weth, abi: WETH_ABI, functionName: "deposit", args: [], value: needed });
12746
- await publicClient.waitForTransactionReceipt({ hash });
12747
- return { deposited: needed, hash };
12748
- };
12749
- module2.exports.getDynamicHookInfo = async function getDynamicHookInfo(sdk, hookAddress) {
12750
- const auction2 = await sdk.getDynamicAuction(hookAddress);
12751
- return auction2.getHookInfo();
12752
- };
12753
- module2.exports.quoteV4ExactIn = async function quoteV4ExactIn(sdk, { poolKey, zeroForOne, exactAmount, hookData }) {
12754
- return sdk.quoter.quoteExactInputV4({ poolKey, zeroForOne, exactAmount, hookData });
12755
- };
12756
- var UR_ABI = [
12757
- { name: "execute", type: "function", stateMutability: "payable", inputs: [{ name: "commands", type: "bytes" }, { name: "inputs", type: "bytes[]" }], outputs: [] }
12758
- ];
12759
- module2.exports.urExecute = async function urExecute({ rpcUrl, chainId, privateKey, universalRouter, commands, inputs, value }) {
12760
- const chain = getChainById(chainId);
12761
- const accountObj = privateKeyToAccount(privateKey.startsWith("0x") ? privateKey : `0x${privateKey}`);
12762
- const publicClient = createPublicClient({ chain, transport: http(rpcUrl) });
12763
- const walletClient = createWalletClient({ chain, transport: http(rpcUrl), account: accountObj });
12764
- const hash = await walletClient.writeContract({ address: universalRouter, abi: UR_ABI, functionName: "execute", args: [commands, inputs], value: value || 0n });
12765
- const receipt = await publicClient.waitForTransactionReceipt({ hash });
12766
- return { hash, receipt };
12767
- };
12768
- module2.exports.simulateCreateStaticAuction = async function simulateCreateStaticAuction(sdk, builderParams) {
12769
- const StaticAuctionBuilder = dopplerLib.StaticAuctionBuilder || dopplerLib.default?.StaticAuctionBuilder;
12770
- if (!StaticAuctionBuilder) throw new Error("StaticAuctionBuilder missing from doppler-sdk");
12771
- const builder = new StaticAuctionBuilder().tokenConfig(builderParams.token).saleConfig(builderParams.sale).poolByTicks(builderParams.pool).withUserAddress(builderParams.userAddress);
12772
- if (builderParams.governance) builder.withGovernance(builderParams.governance);
12773
- if (builderParams.migration) builder.withMigration(builderParams.migration);
12774
- if (builderParams.modules?.v3Initializer && typeof builder.withV3Initializer === "function") builder.withV3Initializer(builderParams.modules.v3Initializer);
12775
- if (builderParams.modules?.airlock && typeof builder.withAirlock === "function") builder.withAirlock(builderParams.modules.airlock);
12776
- const params = builder.build();
12777
- return sdk.factory.simulateCreateStaticAuction(params);
12778
- };
12779
- module2.exports.simulateBundleExactOut = async function simulateBundleExactOut(sdk, createParams, { tokenIn, tokenOut, amount, fee, sqrtPriceLimitX96 = 0n }) {
12780
- return sdk.factory.simulateBundleExactOutput(createParams, { tokenIn, tokenOut, amount, fee, sqrtPriceLimitX96 });
12781
- };
12782
- module2.exports.factoryBundle = async function factoryBundle(sdk, createParams, { commands, inputs, value }) {
12783
- return sdk.factory.bundle(createParams, commands, inputs, { value });
12784
- };
12785
- var V3_SWAP_ROUTER_ABI = [
12786
- {
12787
- name: "exactInputSingle",
12788
- type: "function",
12789
- stateMutability: "payable",
12790
- inputs: [
12791
- {
12792
- name: "params",
12793
- type: "tuple",
12794
- components: [
12795
- { name: "tokenIn", type: "address" },
12796
- { name: "tokenOut", type: "address" },
12797
- { name: "fee", type: "uint24" },
12798
- { name: "recipient", type: "address" },
12799
- { name: "deadline", type: "uint256" },
12800
- { name: "amountIn", type: "uint256" },
12801
- { name: "amountOutMinimum", type: "uint256" },
12802
- { name: "sqrtPriceLimitX96", type: "uint160" }
12803
- ]
12804
- }
12805
- ],
12806
- outputs: [{ name: "amountOut", type: "uint256" }]
12807
- }
12808
- ];
12809
- module2.exports.executeV3BuyExactIn = async function executeV3BuyExactIn({
12810
- rpcUrl,
12811
- chainId,
12812
- privateKey,
12813
- router,
12814
- tokenIn,
12815
- tokenOut,
12816
- fee,
12817
- amountIn,
12818
- amountOutMinimum,
12819
- recipient,
12820
- deadline
12821
- }) {
12822
- const chain = getChainById(chainId);
12823
- const accountObj = privateKeyToAccount(privateKey.startsWith("0x") ? privateKey : `0x${privateKey}`);
12824
- const publicClient = createPublicClient({ chain, transport: http(rpcUrl) });
12825
- const walletClient = createWalletClient({ chain, transport: http(rpcUrl), account: accountObj });
12826
- const allowance = await publicClient.readContract({
12827
- address: tokenIn,
12828
- abi: erc20Abi,
12829
- functionName: "allowance",
12830
- args: [accountObj.address, router]
12831
- });
12832
- if (allowance < amountIn) {
12833
- await walletClient.writeContract({
12834
- address: tokenIn,
12835
- abi: erc20Abi,
12836
- functionName: "approve",
12837
- args: [router, amountIn]
12838
- });
12839
- }
12840
- const hash = await walletClient.writeContract({
12841
- address: router,
12842
- abi: V3_SWAP_ROUTER_ABI,
12843
- functionName: "exactInputSingle",
12844
- args: [
12845
- {
12846
- tokenIn,
12847
- tokenOut,
12848
- fee,
12849
- recipient,
12850
- deadline,
12851
- amountIn,
12852
- amountOutMinimum,
12853
- sqrtPriceLimitX96: 0n
12854
- }
12855
- ],
12856
- value: 0n
12857
- });
12858
- const receipt = await publicClient.waitForTransactionReceipt({ hash });
12859
- return { hash, receipt };
12860
- };
12861
- }
12862
- });
12863
-
12864
12286
  // src/points.js
12865
12287
  var require_points = __commonJS({
12866
12288
  "src/points.js"(exports2, module2) {
@@ -14931,7 +14353,6 @@ var ipfs = require_ipfs();
14931
14353
  var ipns = require_ipns();
14932
14354
  var token = require_token();
14933
14355
  var personal = require_personal();
14934
- var premium = require_premium();
14935
14356
  var subgraph = require_subgraph();
14936
14357
  var privateTx = require_privateTx();
14937
14358
  var safe = require_safe();
@@ -14950,7 +14371,6 @@ var walletCdpManager = require_cdp_manager();
14950
14371
  var walletTyped = require_typed();
14951
14372
  var utils = require_provider();
14952
14373
  var errors = require_errors();
14953
- var doppler = require_doppler();
14954
14374
  var adapters = {
14955
14375
  transports: require_transports(),
14956
14376
  governance: {
@@ -14986,7 +14406,7 @@ module.exports = {
14986
14406
  SageEchoExecutor,
14987
14407
  token,
14988
14408
  personal,
14989
- premium,
14409
+ // premium: removed — PremiumPrompts deprecated
14990
14410
  treasury,
14991
14411
  boost,
14992
14412
  // bond module removed; bonds deprecated in CLI/SDK
@@ -15003,7 +14423,6 @@ module.exports = {
15003
14423
  }),
15004
14424
  walletTyped,
15005
14425
  errors,
15006
- doppler,
15007
14426
  adapters,
15008
14427
  // Season points helpers (airdrops/testnet)
15009
14428
  points,