@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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sage-protocol/sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.18",
|
|
4
4
|
"description": "Backend-agnostic SDK for interacting with the Sage Protocol (governance, SubDAOs, tokens).",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -56,11 +56,11 @@
|
|
|
56
56
|
"release": "yarn build && npm publish --workspace @sage-protocol/sdk"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"content-hash": "^2.5.2",
|
|
60
59
|
"@merit-systems/echo-typescript-sdk": "^1.0.17",
|
|
61
60
|
"@whetstone-research/doppler-sdk": "^0.0.1-alpha.40",
|
|
62
61
|
"ai": "^3.2.3",
|
|
63
62
|
"axios": "^1.11.0",
|
|
63
|
+
"content-hash": "^2.5.2",
|
|
64
64
|
"ethers": "^6.15.0",
|
|
65
65
|
"viem": "^2.33.2"
|
|
66
66
|
},
|
package/types/index.d.ts
CHANGED
|
@@ -540,6 +540,224 @@ export interface PersonalModule {
|
|
|
540
540
|
}): Promise<bigint>;
|
|
541
541
|
}
|
|
542
542
|
|
|
543
|
+
// ============ Voting Multiplier System Types ============
|
|
544
|
+
|
|
545
|
+
export interface MultiplierTier {
|
|
546
|
+
name: string;
|
|
547
|
+
multiplier: bigint;
|
|
548
|
+
maxSupply: bigint;
|
|
549
|
+
minted: bigint;
|
|
550
|
+
price: bigint;
|
|
551
|
+
dao: AddressLike;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
export interface MultiplierTokenInfo {
|
|
555
|
+
owner: AddressLike;
|
|
556
|
+
tierId: bigint;
|
|
557
|
+
multiplier: bigint;
|
|
558
|
+
uri: string;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
export interface VotingBreakdown {
|
|
562
|
+
baseVotes: bigint;
|
|
563
|
+
multiplier: bigint;
|
|
564
|
+
effectiveVotes: bigint;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
export interface VotingMultiplierModule {
|
|
568
|
+
// Tier Management
|
|
569
|
+
getTier(args: { provider: ProviderLike; nft: AddressLike; tierId: bigint | number }): Promise<MultiplierTier>;
|
|
570
|
+
getTierCount(args: { provider: ProviderLike; nft: AddressLike }): Promise<bigint>;
|
|
571
|
+
buildCreateTierTx(args: {
|
|
572
|
+
nft: AddressLike;
|
|
573
|
+
dao: AddressLike;
|
|
574
|
+
name: string;
|
|
575
|
+
multiplier: BigNumberish;
|
|
576
|
+
maxSupply: BigNumberish;
|
|
577
|
+
price: BigNumberish;
|
|
578
|
+
}): TransactionPayload;
|
|
579
|
+
// Minting
|
|
580
|
+
buildMintTx(args: {
|
|
581
|
+
nft: AddressLike;
|
|
582
|
+
to: AddressLike;
|
|
583
|
+
tierId: BigNumberish;
|
|
584
|
+
uri: string;
|
|
585
|
+
}): TransactionPayload;
|
|
586
|
+
buildPublicMintTx(args: {
|
|
587
|
+
nft: AddressLike;
|
|
588
|
+
tierId: BigNumberish;
|
|
589
|
+
uri: string;
|
|
590
|
+
value: BigNumberish;
|
|
591
|
+
}): TransactionPayload;
|
|
592
|
+
// Multiplier Queries
|
|
593
|
+
getMultiplier(args: { provider: ProviderLike; nft: AddressLike; account: AddressLike; dao: AddressLike }): Promise<bigint>;
|
|
594
|
+
getPastMultiplier(args: { provider: ProviderLike; nft: AddressLike; account: AddressLike; dao: AddressLike; timepoint: BigNumberish }): Promise<bigint>;
|
|
595
|
+
getTokenMultiplier(args: { provider: ProviderLike; nft: AddressLike; tokenId: BigNumberish }): Promise<bigint>;
|
|
596
|
+
getTokenDAO(args: { provider: ProviderLike; nft: AddressLike; tokenId: BigNumberish }): Promise<AddressLike>;
|
|
597
|
+
getTokenInfo(args: { provider: ProviderLike; nft: AddressLike; tokenId: BigNumberish }): Promise<MultiplierTokenInfo>;
|
|
598
|
+
// MultipliedVotes Wrapper
|
|
599
|
+
getVotes(args: { provider: ProviderLike; wrapper: AddressLike; account: AddressLike }): Promise<bigint>;
|
|
600
|
+
getPastVotes(args: { provider: ProviderLike; wrapper: AddressLike; account: AddressLike; timepoint: BigNumberish }): Promise<bigint>;
|
|
601
|
+
getVotingBreakdown(args: { provider: ProviderLike; wrapper: AddressLike; account: AddressLike }): Promise<VotingBreakdown>;
|
|
602
|
+
getPastVotingBreakdown(args: { provider: ProviderLike; wrapper: AddressLike; account: AddressLike; timepoint: BigNumberish }): Promise<VotingBreakdown>;
|
|
603
|
+
hasMultiplierBonus(args: { provider: ProviderLike; wrapper: AddressLike; account: AddressLike }): Promise<boolean>;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
// ============ Auction House Types ============
|
|
607
|
+
|
|
608
|
+
export interface AuctionState {
|
|
609
|
+
nftId: bigint;
|
|
610
|
+
amount: bigint;
|
|
611
|
+
startTime: bigint;
|
|
612
|
+
endTime: bigint;
|
|
613
|
+
bidder: AddressLike;
|
|
614
|
+
settled: boolean;
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
export interface AuctionConfig {
|
|
618
|
+
nft: AddressLike;
|
|
619
|
+
treasury: AddressLike;
|
|
620
|
+
weth: AddressLike;
|
|
621
|
+
timeBuffer: bigint;
|
|
622
|
+
reservePrice: bigint;
|
|
623
|
+
minBidIncrementPercentage: bigint;
|
|
624
|
+
duration: bigint;
|
|
625
|
+
mintTierId: bigint;
|
|
626
|
+
defaultTokenURI: string;
|
|
627
|
+
paused: boolean;
|
|
628
|
+
owner: AddressLike;
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
export interface AuctionModule {
|
|
632
|
+
// Auction State
|
|
633
|
+
getAuction(args: { provider: ProviderLike; auctionHouse: AddressLike }): Promise<AuctionState>;
|
|
634
|
+
getConfig(args: { provider: ProviderLike; auctionHouse: AddressLike }): Promise<AuctionConfig>;
|
|
635
|
+
// Bidding
|
|
636
|
+
buildCreateBidTx(args: { auctionHouse: AddressLike; nftId: BigNumberish; value: BigNumberish }): TransactionPayload;
|
|
637
|
+
// Settlement
|
|
638
|
+
buildSettleAndCreateTx(args: { auctionHouse: AddressLike }): TransactionPayload;
|
|
639
|
+
buildSettleTx(args: { auctionHouse: AddressLike }): TransactionPayload;
|
|
640
|
+
buildCreateAuctionTx(args: { auctionHouse: AddressLike }): TransactionPayload;
|
|
641
|
+
// Admin
|
|
642
|
+
buildPauseTx(args: { auctionHouse: AddressLike }): TransactionPayload;
|
|
643
|
+
buildUnpauseTx(args: { auctionHouse: AddressLike }): TransactionPayload;
|
|
644
|
+
buildSetTimeBufferTx(args: { auctionHouse: AddressLike; timeBuffer: BigNumberish }): TransactionPayload;
|
|
645
|
+
buildSetReservePriceTx(args: { auctionHouse: AddressLike; reservePrice: BigNumberish }): TransactionPayload;
|
|
646
|
+
buildSetMinBidIncrementTx(args: { auctionHouse: AddressLike; percentage: BigNumberish }): TransactionPayload;
|
|
647
|
+
buildSetDurationTx(args: { auctionHouse: AddressLike; duration: BigNumberish }): TransactionPayload;
|
|
648
|
+
buildSetMintTierIdTx(args: { auctionHouse: AddressLike; tierId: BigNumberish }): TransactionPayload;
|
|
649
|
+
buildSetDefaultTokenURITx(args: { auctionHouse: AddressLike; uri: string }): TransactionPayload;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
// ============ Bounty System Types ============
|
|
653
|
+
|
|
654
|
+
export type BountyMode = 'OPEN' | 'DIRECT' | 'COMPETITIVE';
|
|
655
|
+
export type BountyStatus = 'ACTIVE' | 'CLAIMED' | 'UNDER_REVIEW' | 'VOTING' | 'COMPLETED' | 'CANCELLED' | 'EXPIRED';
|
|
656
|
+
export type LibraryAction = 'PAYMENT_ONLY' | 'ADD_TO_LIBRARY' | 'PAYMENT_AND_ADD';
|
|
657
|
+
|
|
658
|
+
export interface Bounty {
|
|
659
|
+
creator: AddressLike;
|
|
660
|
+
id: bigint;
|
|
661
|
+
title: string;
|
|
662
|
+
description: string;
|
|
663
|
+
ipfsCID: string;
|
|
664
|
+
reward: bigint;
|
|
665
|
+
creatorDeposit: bigint;
|
|
666
|
+
minContributorLevel: bigint;
|
|
667
|
+
minTokenBalance: bigint;
|
|
668
|
+
requiredBadgeId: bigint;
|
|
669
|
+
deadline: bigint;
|
|
670
|
+
votingEndTime: bigint;
|
|
671
|
+
snapshotBlock: bigint;
|
|
672
|
+
mode: number;
|
|
673
|
+
status: number;
|
|
674
|
+
libraryAction: number;
|
|
675
|
+
assignee: AddressLike;
|
|
676
|
+
winner: AddressLike;
|
|
677
|
+
winningSubmissionId: bigint;
|
|
678
|
+
libraryKey: string;
|
|
679
|
+
governanceProposalId: bigint;
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
export interface BountySubmission {
|
|
683
|
+
id: bigint;
|
|
684
|
+
bountyId: bigint;
|
|
685
|
+
submitter: AddressLike;
|
|
686
|
+
promptIPFS: string;
|
|
687
|
+
deliverableIPFS: string;
|
|
688
|
+
timestamp: bigint;
|
|
689
|
+
voteCount: bigint;
|
|
690
|
+
exists: boolean;
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
export interface BountyModule {
|
|
694
|
+
// Constants
|
|
695
|
+
getMaxSubmissionsPerBounty(args: { provider: ProviderLike; bountySystem: AddressLike }): Promise<bigint>;
|
|
696
|
+
// Bounty Queries
|
|
697
|
+
getBounty(args: { provider: ProviderLike; bountySystem: AddressLike; bountyId: BigNumberish }): Promise<Bounty>;
|
|
698
|
+
getSubmission(args: { provider: ProviderLike; bountySystem: AddressLike; bountyId: BigNumberish; submissionId: BigNumberish }): Promise<BountySubmission>;
|
|
699
|
+
getSubmissionCount(args: { provider: ProviderLike; bountySystem: AddressLike; bountyId: BigNumberish }): Promise<bigint>;
|
|
700
|
+
getLeadingSubmission(args: { provider: ProviderLike; bountySystem: AddressLike; bountyId: BigNumberish }): Promise<{ submissionId: bigint; votes: bigint }>;
|
|
701
|
+
calculateStake(args: { provider: ProviderLike; bountySystem: AddressLike; reward: BigNumberish }): Promise<bigint>;
|
|
702
|
+
canSubmit(args: { provider: ProviderLike; bountySystem: AddressLike; bountyId: BigNumberish; submitter: AddressLike }): Promise<boolean>;
|
|
703
|
+
hasVotedInBounty(args: { provider: ProviderLike; bountySystem: AddressLike; bountyId: BigNumberish; voter: AddressLike }): Promise<boolean>;
|
|
704
|
+
// Bounty Creation
|
|
705
|
+
buildCreateBountyTx(args: {
|
|
706
|
+
bountySystem: AddressLike;
|
|
707
|
+
title: string;
|
|
708
|
+
description: string;
|
|
709
|
+
ipfsCID: string;
|
|
710
|
+
reward: BigNumberish;
|
|
711
|
+
deadline: BigNumberish;
|
|
712
|
+
}): TransactionPayload;
|
|
713
|
+
buildCreateBountyAdvancedTx(args: {
|
|
714
|
+
bountySystem: AddressLike;
|
|
715
|
+
title: string;
|
|
716
|
+
description: string;
|
|
717
|
+
ipfsCID: string;
|
|
718
|
+
reward: BigNumberish;
|
|
719
|
+
deadline: BigNumberish;
|
|
720
|
+
votingDuration: BigNumberish;
|
|
721
|
+
mode: number;
|
|
722
|
+
libraryAction: number;
|
|
723
|
+
assignee: AddressLike;
|
|
724
|
+
libraryKey: string;
|
|
725
|
+
}): TransactionPayload;
|
|
726
|
+
// Claiming & Submission
|
|
727
|
+
buildClaimBountyTx(args: { bountySystem: AddressLike; bountyId: BigNumberish }): TransactionPayload;
|
|
728
|
+
buildSubmitEntryTx(args: {
|
|
729
|
+
bountySystem: AddressLike;
|
|
730
|
+
bountyId: BigNumberish;
|
|
731
|
+
promptIPFS: string;
|
|
732
|
+
deliverableIPFS: string;
|
|
733
|
+
}): TransactionPayload;
|
|
734
|
+
buildCompleteBountyTx(args: {
|
|
735
|
+
bountySystem: AddressLike;
|
|
736
|
+
bountyId: BigNumberish;
|
|
737
|
+
deliverableIPFS: string;
|
|
738
|
+
}): TransactionPayload;
|
|
739
|
+
// Voting (COMPETITIVE mode)
|
|
740
|
+
buildStartVotingTx(args: { bountySystem: AddressLike; bountyId: BigNumberish }): TransactionPayload;
|
|
741
|
+
buildVoteTx(args: { bountySystem: AddressLike; bountyId: BigNumberish; submissionId: BigNumberish }): TransactionPayload;
|
|
742
|
+
buildFinalizeCompetitiveTx(args: { bountySystem: AddressLike; bountyId: BigNumberish }): TransactionPayload;
|
|
743
|
+
// Approval
|
|
744
|
+
buildApproveSubmissionTx(args: { bountySystem: AddressLike; bountyId: BigNumberish; submissionId: BigNumberish }): TransactionPayload;
|
|
745
|
+
// Cancellation & Expiry
|
|
746
|
+
buildCancelBountyTx(args: { bountySystem: AddressLike; bountyId: BigNumberish }): TransactionPayload;
|
|
747
|
+
buildExpireBountyTx(args: { bountySystem: AddressLike; bountyId: BigNumberish }): TransactionPayload;
|
|
748
|
+
// Reward Management
|
|
749
|
+
buildIncreaseRewardTx(args: { bountySystem: AddressLike; bountyId: BigNumberish; additionalReward: BigNumberish }): TransactionPayload;
|
|
750
|
+
// Gate Management
|
|
751
|
+
buildSetGatesTx(args: {
|
|
752
|
+
bountySystem: AddressLike;
|
|
753
|
+
bountyId: BigNumberish;
|
|
754
|
+
minTokenBalance: BigNumberish;
|
|
755
|
+
requiredBadgeId: BigNumberish;
|
|
756
|
+
}): TransactionPayload;
|
|
757
|
+
buildAddToWhitelistTx(args: { bountySystem: AddressLike; bountyId: BigNumberish; addresses: AddressLike[] }): TransactionPayload;
|
|
758
|
+
buildRemoveFromWhitelistTx(args: { bountySystem: AddressLike; bountyId: BigNumberish; addresses: AddressLike[] }): TransactionPayload;
|
|
759
|
+
}
|
|
760
|
+
|
|
543
761
|
export interface SageSDK {
|
|
544
762
|
version: string;
|
|
545
763
|
getProvider: (rpcUrl: string) => any;
|
|
@@ -569,6 +787,10 @@ export interface SageSDK {
|
|
|
569
787
|
treasury: TreasuryModule;
|
|
570
788
|
boost: BoostModule;
|
|
571
789
|
personal: PersonalModule;
|
|
790
|
+
// New modules for voting multiplier, auction, and bounty systems
|
|
791
|
+
votingMultiplier: VotingMultiplierModule;
|
|
792
|
+
auction: AuctionModule;
|
|
793
|
+
bounty: BountyModule;
|
|
572
794
|
subgraph: Record<string, any>;
|
|
573
795
|
errors: Record<string, any>;
|
|
574
796
|
resolveGovernanceContext: (args: any) => Promise<any>;
|