@sage-protocol/sdk 0.1.16 → 0.1.18
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/browser/index.mjs +189 -2
- package/dist/index.cjs +649 -2
- package/dist/index.mjs +649 -2
- package/dist/node/index.cjs +649 -2
- package/dist/node/index.mjs +649 -2
- package/package.json +2 -2
- package/types/index.d.ts +222 -0
package/dist/browser/index.mjs
CHANGED
|
@@ -14,7 +14,7 @@ var require_package = __commonJS({
|
|
|
14
14
|
"package.json"(exports, module) {
|
|
15
15
|
module.exports = {
|
|
16
16
|
name: "@sage-protocol/sdk",
|
|
17
|
-
version: "0.1.
|
|
17
|
+
version: "0.1.18",
|
|
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",
|
|
@@ -70,11 +70,11 @@ var require_package = __commonJS({
|
|
|
70
70
|
release: "yarn build && npm publish --workspace @sage-protocol/sdk"
|
|
71
71
|
},
|
|
72
72
|
dependencies: {
|
|
73
|
-
"content-hash": "^2.5.2",
|
|
74
73
|
"@merit-systems/echo-typescript-sdk": "^1.0.17",
|
|
75
74
|
"@whetstone-research/doppler-sdk": "^0.0.1-alpha.40",
|
|
76
75
|
ai: "^3.2.3",
|
|
77
76
|
axios: "^1.11.0",
|
|
77
|
+
"content-hash": "^2.5.2",
|
|
78
78
|
ethers: "^6.15.0",
|
|
79
79
|
viem: "^2.33.2"
|
|
80
80
|
},
|
|
@@ -293,6 +293,186 @@ var require_abi = __commonJS({
|
|
|
293
293
|
"function create(uint256 proposalId, address token, uint256 perVoter, uint256 maxVoters)",
|
|
294
294
|
"function fund(uint256 proposalId, uint256 amount)"
|
|
295
295
|
];
|
|
296
|
+
var VotingMultiplierNFT = [
|
|
297
|
+
// Constants
|
|
298
|
+
"function MINTER_ROLE() view returns (bytes32)",
|
|
299
|
+
"function MAX_NFTS_PER_ACCOUNT() view returns (uint256)",
|
|
300
|
+
// Tier Management
|
|
301
|
+
"function createTier(address dao, string name, uint256 multiplier, uint256 maxSupply, uint256 price) returns (uint256 tierId)",
|
|
302
|
+
"function getTier(uint256 tierId) view returns (tuple(string name, uint256 multiplier, uint256 maxSupply, uint256 minted, uint256 price, address dao))",
|
|
303
|
+
"function tierCount() view returns (uint256)",
|
|
304
|
+
"function tiers(uint256) view returns (string name, uint256 multiplier, uint256 maxSupply, uint256 minted, uint256 price, address dao)",
|
|
305
|
+
// Minting
|
|
306
|
+
"function mint(address to, uint256 tierId, string uri) returns (uint256 tokenId)",
|
|
307
|
+
"function publicMint(uint256 tierId, string uri) payable returns (uint256 tokenId)",
|
|
308
|
+
// Multiplier Functions
|
|
309
|
+
"function getMultiplier(address account, address dao) view returns (uint256)",
|
|
310
|
+
"function getPastMultiplier(address account, address dao, uint256 timepoint) view returns (uint256)",
|
|
311
|
+
"function getTokenMultiplier(uint256 tokenId) view returns (uint256)",
|
|
312
|
+
"function getTokenDAO(uint256 tokenId) view returns (address)",
|
|
313
|
+
// Token Info
|
|
314
|
+
"function tokenMultiplier(uint256) view returns (uint256)",
|
|
315
|
+
"function tokenDAO(uint256) view returns (address)",
|
|
316
|
+
"function tokenTier(uint256) view returns (uint256)",
|
|
317
|
+
"function getTokenInfo(uint256 tokenId) view returns (address owner, uint256 tierId, uint256 multiplier, string uri)",
|
|
318
|
+
// ERC721 Standard
|
|
319
|
+
"function balanceOf(address owner) view returns (uint256)",
|
|
320
|
+
"function ownerOf(uint256 tokenId) view returns (address)",
|
|
321
|
+
"function tokenOfOwnerByIndex(address owner, uint256 index) view returns (uint256)",
|
|
322
|
+
"function tokenURI(uint256 tokenId) view returns (string)",
|
|
323
|
+
"function transferFrom(address from, address to, uint256 tokenId)",
|
|
324
|
+
"function safeTransferFrom(address from, address to, uint256 tokenId)",
|
|
325
|
+
"function approve(address to, uint256 tokenId)",
|
|
326
|
+
"function setApprovalForAll(address operator, bool approved)",
|
|
327
|
+
"function getApproved(uint256 tokenId) view returns (address)",
|
|
328
|
+
"function isApprovedForAll(address owner, address operator) view returns (bool)",
|
|
329
|
+
// Admin
|
|
330
|
+
"function withdrawFunds(address to)",
|
|
331
|
+
"function grantRole(bytes32 role, address account)",
|
|
332
|
+
"function revokeRole(bytes32 role, address account)",
|
|
333
|
+
"function hasRole(bytes32 role, address account) view returns (bool)",
|
|
334
|
+
// Events
|
|
335
|
+
"event TierCreated(uint256 indexed tierId, address indexed dao, string name, uint256 multiplier, uint256 maxSupply, uint256 price)",
|
|
336
|
+
"event NFTMinted(address indexed to, uint256 indexed tokenId, address indexed dao, uint256 tierId, uint256 multiplier)",
|
|
337
|
+
"event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)"
|
|
338
|
+
];
|
|
339
|
+
var MultipliedVotes = [
|
|
340
|
+
// Core IVotes Interface
|
|
341
|
+
"function getVotes(address account) view returns (uint256)",
|
|
342
|
+
"function getPastVotes(address account, uint256 timepoint) view returns (uint256)",
|
|
343
|
+
"function getPastTotalSupply(uint256 timepoint) view returns (uint256)",
|
|
344
|
+
"function delegates(address account) view returns (address)",
|
|
345
|
+
"function delegate(address delegatee)",
|
|
346
|
+
"function delegateBySig(address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s)",
|
|
347
|
+
// IERC6372 Clock Interface
|
|
348
|
+
"function clock() view returns (uint48)",
|
|
349
|
+
"function CLOCK_MODE() view returns (string)",
|
|
350
|
+
// View Helpers
|
|
351
|
+
"function getVotingBreakdown(address account) view returns (uint256 baseVotes, uint256 multiplier, uint256 effectiveVotes)",
|
|
352
|
+
"function getPastVotingBreakdown(address account, uint256 timepoint) view returns (uint256 baseVotes, uint256 multiplier, uint256 effectiveVotes)",
|
|
353
|
+
"function hasMultiplierBonus(address account) view returns (bool)",
|
|
354
|
+
// Immutable Config
|
|
355
|
+
"function baseToken() view returns (address)",
|
|
356
|
+
"function multiplierNFT() view returns (address)",
|
|
357
|
+
"function dao() view returns (address)",
|
|
358
|
+
"function BASIS() view returns (uint256)"
|
|
359
|
+
];
|
|
360
|
+
var SageAuctionHouse = [
|
|
361
|
+
// Core Auction Functions
|
|
362
|
+
"function createBid(uint256 nftId) payable",
|
|
363
|
+
"function settleCurrentAndCreateNewAuction()",
|
|
364
|
+
"function settleAuction()",
|
|
365
|
+
"function createAuction()",
|
|
366
|
+
// Current Auction State
|
|
367
|
+
"function auction() view returns (uint256 nftId, uint256 amount, uint256 startTime, uint256 endTime, address bidder, bool settled)",
|
|
368
|
+
// Configuration
|
|
369
|
+
"function nft() view returns (address)",
|
|
370
|
+
"function treasury() view returns (address)",
|
|
371
|
+
"function weth() view returns (address)",
|
|
372
|
+
"function timeBuffer() view returns (uint256)",
|
|
373
|
+
"function reservePrice() view returns (uint256)",
|
|
374
|
+
"function minBidIncrementPercentage() view returns (uint256)",
|
|
375
|
+
"function duration() view returns (uint256)",
|
|
376
|
+
"function mintTierId() view returns (uint256)",
|
|
377
|
+
"function defaultTokenURI() view returns (string)",
|
|
378
|
+
// Admin Functions
|
|
379
|
+
"function pause()",
|
|
380
|
+
"function unpause()",
|
|
381
|
+
"function paused() view returns (bool)",
|
|
382
|
+
"function setTimeBuffer(uint256 _timeBuffer)",
|
|
383
|
+
"function setReservePrice(uint256 _reservePrice)",
|
|
384
|
+
"function setMinBidIncrementPercentage(uint256 _minBidIncrementPercentage)",
|
|
385
|
+
"function setDuration(uint256 _duration)",
|
|
386
|
+
"function setMintTierId(uint256 _tierId)",
|
|
387
|
+
"function setDefaultTokenURI(string _uri)",
|
|
388
|
+
"function owner() view returns (address)",
|
|
389
|
+
"function transferOwnership(address newOwner)",
|
|
390
|
+
// Events
|
|
391
|
+
"event AuctionCreated(uint256 indexed nftId, uint256 startTime, uint256 endTime)",
|
|
392
|
+
"event AuctionBid(uint256 indexed nftId, address sender, uint256 value, bool extended)",
|
|
393
|
+
"event AuctionExtended(uint256 indexed nftId, uint256 endTime)",
|
|
394
|
+
"event AuctionSettled(uint256 indexed nftId, address winner, uint256 amount)",
|
|
395
|
+
"event AuctionTimeBufferUpdated(uint256 timeBuffer)",
|
|
396
|
+
"event AuctionReservePriceUpdated(uint256 reservePrice)",
|
|
397
|
+
"event AuctionMinBidIncrementPercentageUpdated(uint256 minBidIncrementPercentage)",
|
|
398
|
+
"event AuctionDurationUpdated(uint256 duration)"
|
|
399
|
+
];
|
|
400
|
+
var SimpleBountySystem = [
|
|
401
|
+
// Constants
|
|
402
|
+
"function GOVERNANCE_ROLE() view returns (bytes32)",
|
|
403
|
+
"function MAX_SUBMISSIONS_PER_BOUNTY() view returns (uint256)",
|
|
404
|
+
// Bounty Creation
|
|
405
|
+
"function createBounty(string title, string description, string ipfsCID, uint256 reward, uint256 deadline) returns (uint256)",
|
|
406
|
+
"function createBountyAdvanced(string title, string description, string ipfsCID, uint256 reward, uint256 deadline, uint256 votingDuration, uint8 mode, uint8 libraryAction, address assignee, string libraryKey) returns (uint256)",
|
|
407
|
+
// Submission & Claiming
|
|
408
|
+
"function claimBounty(uint256 bountyId)",
|
|
409
|
+
"function submitEntry(uint256 bountyId, string promptIPFS, string deliverableIPFS) returns (uint256)",
|
|
410
|
+
"function completeBounty(uint256 bountyId, string deliverableIPFS)",
|
|
411
|
+
// Voting (COMPETITIVE mode)
|
|
412
|
+
"function startVoting(uint256 bountyId)",
|
|
413
|
+
"function vote(uint256 bountyId, uint256 submissionId)",
|
|
414
|
+
"function finalizeCompetitive(uint256 bountyId)",
|
|
415
|
+
// Approval
|
|
416
|
+
"function approveSubmission(uint256 bountyId, uint256 submissionId)",
|
|
417
|
+
"function approveBountyCompletion(uint256 bountyId, string)",
|
|
418
|
+
// Cancellation & Expiry
|
|
419
|
+
"function cancelBounty(uint256 bountyId)",
|
|
420
|
+
"function expireBounty(uint256 bountyId)",
|
|
421
|
+
// Reward Management
|
|
422
|
+
"function increaseReward(uint256 bountyId, uint256 additionalReward)",
|
|
423
|
+
"function slashCreator(uint256 bountyId, uint256 amount, address to)",
|
|
424
|
+
// Gate Management
|
|
425
|
+
"function setGates(uint256 bountyId, uint256 minTokenBalance, uint256 requiredBadgeId)",
|
|
426
|
+
"function addToWhitelist(uint256 bountyId, address[] addresses)",
|
|
427
|
+
"function removeFromWhitelist(uint256 bountyId, address[] addresses)",
|
|
428
|
+
"function canSubmit(uint256 bountyId, address submitter) view returns (bool)",
|
|
429
|
+
// View Functions
|
|
430
|
+
"function getBounty(uint256 bountyId) view returns (tuple(address creator, uint256 id, string title, string description, string ipfsCID, uint256 reward, uint256 creatorDeposit, uint256 minContributorLevel, uint256 minTokenBalance, uint256 requiredBadgeId, uint256 deadline, uint256 votingEndTime, uint256 snapshotBlock, uint8 mode, uint8 status, uint8 libraryAction, address assignee, address winner, uint256 winningSubmissionId, string libraryKey, uint256 governanceProposalId))",
|
|
431
|
+
"function getSubmission(uint256 bountyId, uint256 submissionId) view returns (tuple(uint256 id, uint256 bountyId, address submitter, string promptIPFS, string deliverableIPFS, uint256 timestamp, uint256 voteCount, bool exists))",
|
|
432
|
+
"function getSubmissionCount(uint256 bountyId) view returns (uint256)",
|
|
433
|
+
"function getLeadingSubmission(uint256 bountyId) view returns (uint256 submissionId, uint256 votes)",
|
|
434
|
+
"function calculateStake(uint256 reward) view returns (uint256)",
|
|
435
|
+
// State Mappings
|
|
436
|
+
"function bounties(uint256) view returns (address creator, uint256 id, string title, string description, string ipfsCID, uint256 reward, uint256 creatorDeposit, uint256 minContributorLevel, uint256 minTokenBalance, uint256 requiredBadgeId, uint256 deadline, uint256 votingEndTime, uint256 snapshotBlock, uint8 mode, uint8 status, uint8 libraryAction, address assignee, address winner, uint256 winningSubmissionId, string libraryKey, uint256 governanceProposalId)",
|
|
437
|
+
"function nextBountyId() view returns (uint256)",
|
|
438
|
+
"function submissionCount(uint256) view returns (uint256)",
|
|
439
|
+
"function submitterToSubmission(uint256, address) view returns (uint256)",
|
|
440
|
+
"function hasVotedInBounty(uint256, address) view returns (bool)",
|
|
441
|
+
"function voterChosenSubmission(uint256, address) view returns (uint256)",
|
|
442
|
+
"function whitelist(uint256, address) view returns (bool)",
|
|
443
|
+
"function hasWhitelist(uint256) view returns (bool)",
|
|
444
|
+
// External Contracts
|
|
445
|
+
"function sxxxToken() view returns (address)",
|
|
446
|
+
"function contributorSystem() view returns (address)",
|
|
447
|
+
"function governanceConfig() view returns (address)",
|
|
448
|
+
"function communityTreasury() view returns (address)",
|
|
449
|
+
"function governanceContract() view returns (address)",
|
|
450
|
+
"function libraryRegistry() view returns (address)",
|
|
451
|
+
"function subdao() view returns (address)",
|
|
452
|
+
"function soulboundBadge() view returns (address)",
|
|
453
|
+
// Admin
|
|
454
|
+
"function setGovernanceContract(address _gov)",
|
|
455
|
+
"function setCommunityTreasury(address _treasury)",
|
|
456
|
+
"function setLibraryRegistry(address _registry)",
|
|
457
|
+
"function setSoulboundBadge(address _sbtAddress)",
|
|
458
|
+
"function grantRole(bytes32 role, address account)",
|
|
459
|
+
"function revokeRole(bytes32 role, address account)",
|
|
460
|
+
"function hasRole(bytes32 role, address account) view returns (bool)",
|
|
461
|
+
// Events
|
|
462
|
+
"event BountyCreated(uint256 indexed bountyId, address indexed creator, string title, uint256 reward, uint256 deposit, uint8 mode, address assignee)",
|
|
463
|
+
"event SubmissionReceived(uint256 indexed bountyId, uint256 indexed submissionId, address indexed submitter, string promptIPFS)",
|
|
464
|
+
"event BountyClaimed(uint256 indexed bountyId, address indexed claimant)",
|
|
465
|
+
"event BountyUnderReview(uint256 indexed bountyId, address indexed claimant, uint256 proposalId)",
|
|
466
|
+
"event VoteCast(uint256 indexed bountyId, uint256 indexed submissionId, address indexed voter, uint256 weight)",
|
|
467
|
+
"event VotingStarted(uint256 indexed bountyId, uint256 votingEndTime)",
|
|
468
|
+
"event BountyCompleted(uint256 indexed bountyId, address indexed winner, uint256 reward, string deliverable)",
|
|
469
|
+
"event BountyAutoApproved(uint256 indexed bountyId, address indexed winner)",
|
|
470
|
+
"event PromptAddedToLibrary(uint256 indexed bountyId, string libraryKey, string promptIPFS)",
|
|
471
|
+
"event BountyCancelled(uint256 indexed bountyId, address indexed creator)",
|
|
472
|
+
"event BountyExpired(uint256 indexed bountyId)",
|
|
473
|
+
"event BountyRewardIncreased(uint256 indexed bountyId, uint256 additionalReward, uint256 newTotal)",
|
|
474
|
+
"event CreatorSlashed(uint256 indexed bountyId, uint256 amount, address indexed to)"
|
|
475
|
+
];
|
|
296
476
|
var Events = {
|
|
297
477
|
ProposalCreated: "event ProposalCreated(uint256 id, address proposer, address[] targets, uint256[] values, string[] signatures, bytes[] calldatas, uint256 startBlock, uint256 endBlock, string description)"
|
|
298
478
|
};
|
|
@@ -315,6 +495,13 @@ var require_abi = __commonJS({
|
|
|
315
495
|
// Protocol treasury (replaces SageTreasury)
|
|
316
496
|
GovernanceBoostMerkle,
|
|
317
497
|
GovernanceBoostDirect,
|
|
498
|
+
// Voting Multiplier System
|
|
499
|
+
VotingMultiplierNFT,
|
|
500
|
+
MultipliedVotes,
|
|
501
|
+
// Auction House
|
|
502
|
+
SageAuctionHouse,
|
|
503
|
+
// Bounty System
|
|
504
|
+
SimpleBountySystem,
|
|
318
505
|
Events
|
|
319
506
|
};
|
|
320
507
|
}
|