@sage-protocol/sdk 0.1.17 → 0.1.21

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sage-protocol/sdk",
3
- "version": "0.1.17",
3
+ "version": "0.1.21",
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",
package/types/index.d.ts CHANGED
@@ -131,8 +131,176 @@ export interface GovernanceOperationsModule {
131
131
  }): Promise<TimelockRoleCheck[]>;
132
132
  }
133
133
 
134
+ export interface VotesTokenDescription {
135
+ votingToken: AddressLike;
136
+ baseToken: AddressLike;
137
+ isWrapper: boolean;
138
+ multiplierNFT: AddressLike | null;
139
+ basis: bigint | null;
140
+ description: string;
141
+ }
142
+
143
+ export interface VotingStatus {
144
+ subdao: AddressLike | null;
145
+ governor: AddressLike;
146
+ stakeToken: AddressLike | null;
147
+ votingToken: AddressLike;
148
+ baseToken: AddressLike;
149
+ isWrapper: boolean;
150
+ multiplierNFT: AddressLike | null;
151
+ basis: bigint | null;
152
+ threshold: bigint | null;
153
+ votingPower: bigint | null;
154
+ tokenBalance: bigint | null;
155
+ delegate: AddressLike | null;
156
+ canPropose: boolean | null;
157
+ tokenMismatch: boolean;
158
+ stakeTokenVotes: bigint | null;
159
+ stakeTokenDelegate: AddressLike | null;
160
+ stakeTokenBalance: bigint | null;
161
+ description: string;
162
+ }
163
+
164
+ export interface ProposeGatesSummary {
165
+ threshold: bigint | null;
166
+ cooldown: bigint | null;
167
+ stake: bigint | null;
168
+ allowanceOk: boolean | null;
169
+ votesOk: boolean | null;
170
+ details: {
171
+ sxxxToken: AddressLike | null;
172
+ proposer: AddressLike;
173
+ governor: AddressLike;
174
+ };
175
+ }
176
+
177
+ export interface ProposeReadiness extends ProposeGatesSummary {
178
+ executionReady: boolean | null;
179
+ executionError: string | null;
180
+ }
181
+
134
182
  export interface GovernanceModule {
135
183
  operations: GovernanceOperationsModule;
184
+ getGovernorInfo(args: { provider: ProviderLike; governor: AddressLike }): Promise<{
185
+ address: AddressLike;
186
+ name: string | null;
187
+ votingDelay: bigint | null;
188
+ votingPeriod: bigint | null;
189
+ proposalThreshold: bigint | null;
190
+ timelock: AddressLike | null;
191
+ sxxxToken: AddressLike | null;
192
+ quorumNumerator: bigint | null;
193
+ stakeAmount: bigint | null;
194
+ }>;
195
+ getProposal(args: { provider: ProviderLike; governor: AddressLike; id: bigint | number | string }): Promise<{
196
+ governor: AddressLike;
197
+ id: bigint;
198
+ state: any;
199
+ snapshot: bigint;
200
+ deadline: bigint;
201
+ votes: { against: bigint; for: bigint; abstain: bigint };
202
+ }>;
203
+ listProposals(args: { provider: ProviderLike; governor: AddressLike; fromBlock?: number | bigint | string; toBlock?: number | bigint | string }): Promise<ProposalTuple[]>;
204
+ getProposalMetadata(args: { provider: ProviderLike; governor: AddressLike; id: bigint | number | string; fromBlock?: number | bigint | string; toBlock?: number | bigint | string }): Promise<ProposalTuple & {
205
+ proposer: AddressLike;
206
+ blockNumber: number | bigint | null;
207
+ transactionHash: HashLike | null;
208
+ }>;
209
+ hashDescription(description: string): HashLike;
210
+ buildProposeTx(args: {
211
+ governor: AddressLike;
212
+ targets?: AddressLike[];
213
+ values?: bigint[] | BigNumberish[];
214
+ calldatas?: string[];
215
+ descriptionOrHash?: string;
216
+ }): TransactionPayload;
217
+ buildCastVoteTx(args: { governor: AddressLike; proposalId: bigint | number | string; support: number | string; reason?: string }): TransactionPayload;
218
+ buildQueueTx(args: {
219
+ governor: AddressLike;
220
+ targets?: AddressLike[];
221
+ values?: bigint[] | BigNumberish[];
222
+ calldatas?: string[];
223
+ descriptionOrHash?: string;
224
+ }): TransactionPayload;
225
+ buildExecuteTx(args: {
226
+ governor: AddressLike;
227
+ targets?: AddressLike[];
228
+ values?: bigint[] | BigNumberish[];
229
+ calldatas?: string[];
230
+ descriptionOrHash?: string;
231
+ }): TransactionPayload;
232
+ buildQueueByIdTx(args: { governor: AddressLike; proposalId: bigint | number | string }): TransactionPayload;
233
+ buildExecuteByIdTx(args: { governor: AddressLike; proposalId: bigint | number | string }): TransactionPayload;
234
+ decodeProposalEffects(args: {
235
+ provider: ProviderLike;
236
+ governor: AddressLike;
237
+ proposalId: bigint | number | string;
238
+ fromBlock?: number | bigint | string;
239
+ toBlock?: number | bigint | string;
240
+ }): Promise<any>;
241
+ getQuorumAt(args: { provider: ProviderLike; governor: AddressLike; blockTag?: bigint | number | string }): Promise<bigint | null>;
242
+ getQuorumLatestMinusOne(args: { provider: ProviderLike; governor: AddressLike }): Promise<bigint | null>;
243
+ getVotesLatestMinusOne(args: { provider: ProviderLike; token?: AddressLike; governor?: AddressLike; account: AddressLike }): Promise<bigint>;
244
+ simulatePropose(args: {
245
+ provider: ProviderLike;
246
+ governor: AddressLike;
247
+ targets?: AddressLike[];
248
+ values?: bigint[] | BigNumberish[];
249
+ calldatas?: string[];
250
+ description?: string;
251
+ sender?: AddressLike;
252
+ }): Promise<{ ok: boolean; error?: { type: string; message: string } }>;
253
+ resolveVotesToken(args: { provider: ProviderLike; subdao?: AddressLike; governor?: AddressLike }): Promise<AddressLike>;
254
+ resolveVotesTokenChain(args: { provider: ProviderLike; subdao?: AddressLike; governor?: AddressLike }): Promise<{
255
+ votingToken: AddressLike;
256
+ baseToken: AddressLike;
257
+ isWrapper: boolean;
258
+ }>;
259
+ describeVotesToken(args: { provider: ProviderLike; subdao?: AddressLike; governor?: AddressLike }): Promise<VotesTokenDescription>;
260
+ getVotingStatus(args: { provider: ProviderLike; subdao?: AddressLike; governor?: AddressLike; account: AddressLike }): Promise<VotingStatus>;
261
+ buildDelegateTx(args: { token: AddressLike; delegatee: AddressLike }): TransactionPayload;
262
+ buildDelegateSelfTx(args: { provider: ProviderLike; governor: AddressLike; account: AddressLike }): Promise<TransactionPayload>;
263
+ buildDelegateSelfPreferred(args: { provider: ProviderLike; subdao?: AddressLike; governor?: AddressLike; account: AddressLike }): Promise<TransactionPayload>;
264
+ delegateSelfAndVerify(args: {
265
+ provider: ProviderLike;
266
+ subdao?: AddressLike;
267
+ governor?: AddressLike;
268
+ account: AddressLike;
269
+ signer?: any;
270
+ minVotes?: bigint | number | string | null;
271
+ }): Promise<{ txHash: string | null; ok: boolean; votes: bigint; payload: TransactionPayload }>;
272
+ ensureProposeGates(args: { provider: ProviderLike; governor: AddressLike; proposer: AddressLike }): Promise<ProposeGatesSummary>;
273
+ readinessToPropose(args: {
274
+ provider: ProviderLike;
275
+ governor: AddressLike;
276
+ proposer: AddressLike;
277
+ execution?: {
278
+ provider: ProviderLike;
279
+ registry: AddressLike;
280
+ timelock: AddressLike;
281
+ subdao: AddressLike;
282
+ libraryId?: string;
283
+ manifestCID?: string;
284
+ promptCount?: bigint | number | string;
285
+ } | null;
286
+ }): Promise<ProposeReadiness>;
287
+ listActiveProposals(args: { url: string; governor: AddressLike; first?: number; skip?: number }): Promise<any>;
288
+ buildProposeTxByHash(args: {
289
+ governor: AddressLike;
290
+ targets?: AddressLike[];
291
+ values?: bigint[] | BigNumberish[];
292
+ calldatas?: string[];
293
+ descriptionHash: string;
294
+ }): TransactionPayload;
295
+ detectMode(args: { provider: ProviderLike; governor?: AddressLike; timelock?: AddressLike | null; subdao?: AddressLike | null }): Promise<{
296
+ operator: boolean;
297
+ governance: string;
298
+ governor: AddressLike | null;
299
+ timelock: AddressLike | null;
300
+ subdao: AddressLike | null;
301
+ stakeRequired: bigint | null;
302
+ depositWei: bigint | null;
303
+ }>;
136
304
  [key: string]: any;
137
305
  }
138
306
 
@@ -540,11 +708,229 @@ export interface PersonalModule {
540
708
  }): Promise<bigint>;
541
709
  }
542
710
 
711
+ // ============ Voting Multiplier System Types ============
712
+
713
+ export interface MultiplierTier {
714
+ name: string;
715
+ multiplier: bigint;
716
+ maxSupply: bigint;
717
+ minted: bigint;
718
+ price: bigint;
719
+ dao: AddressLike;
720
+ }
721
+
722
+ export interface MultiplierTokenInfo {
723
+ owner: AddressLike;
724
+ tierId: bigint;
725
+ multiplier: bigint;
726
+ uri: string;
727
+ }
728
+
729
+ export interface VotingBreakdown {
730
+ baseVotes: bigint;
731
+ multiplier: bigint;
732
+ effectiveVotes: bigint;
733
+ }
734
+
735
+ export interface VotingMultiplierModule {
736
+ // Tier Management
737
+ getTier(args: { provider: ProviderLike; nft: AddressLike; tierId: bigint | number }): Promise<MultiplierTier>;
738
+ getTierCount(args: { provider: ProviderLike; nft: AddressLike }): Promise<bigint>;
739
+ buildCreateTierTx(args: {
740
+ nft: AddressLike;
741
+ dao: AddressLike;
742
+ name: string;
743
+ multiplier: BigNumberish;
744
+ maxSupply: BigNumberish;
745
+ price: BigNumberish;
746
+ }): TransactionPayload;
747
+ // Minting
748
+ buildMintTx(args: {
749
+ nft: AddressLike;
750
+ to: AddressLike;
751
+ tierId: BigNumberish;
752
+ uri: string;
753
+ }): TransactionPayload;
754
+ buildPublicMintTx(args: {
755
+ nft: AddressLike;
756
+ tierId: BigNumberish;
757
+ uri: string;
758
+ value: BigNumberish;
759
+ }): TransactionPayload;
760
+ // Multiplier Queries
761
+ getMultiplier(args: { provider: ProviderLike; nft: AddressLike; account: AddressLike; dao: AddressLike }): Promise<bigint>;
762
+ getPastMultiplier(args: { provider: ProviderLike; nft: AddressLike; account: AddressLike; dao: AddressLike; timepoint: BigNumberish }): Promise<bigint>;
763
+ getTokenMultiplier(args: { provider: ProviderLike; nft: AddressLike; tokenId: BigNumberish }): Promise<bigint>;
764
+ getTokenDAO(args: { provider: ProviderLike; nft: AddressLike; tokenId: BigNumberish }): Promise<AddressLike>;
765
+ getTokenInfo(args: { provider: ProviderLike; nft: AddressLike; tokenId: BigNumberish }): Promise<MultiplierTokenInfo>;
766
+ // MultipliedVotes Wrapper
767
+ getVotes(args: { provider: ProviderLike; wrapper: AddressLike; account: AddressLike }): Promise<bigint>;
768
+ getPastVotes(args: { provider: ProviderLike; wrapper: AddressLike; account: AddressLike; timepoint: BigNumberish }): Promise<bigint>;
769
+ getVotingBreakdown(args: { provider: ProviderLike; wrapper: AddressLike; account: AddressLike }): Promise<VotingBreakdown>;
770
+ getPastVotingBreakdown(args: { provider: ProviderLike; wrapper: AddressLike; account: AddressLike; timepoint: BigNumberish }): Promise<VotingBreakdown>;
771
+ hasMultiplierBonus(args: { provider: ProviderLike; wrapper: AddressLike; account: AddressLike }): Promise<boolean>;
772
+ }
773
+
774
+ // ============ Auction House Types ============
775
+
776
+ export interface AuctionState {
777
+ nftId: bigint;
778
+ amount: bigint;
779
+ startTime: bigint;
780
+ endTime: bigint;
781
+ bidder: AddressLike;
782
+ settled: boolean;
783
+ }
784
+
785
+ export interface AuctionConfig {
786
+ nft: AddressLike;
787
+ treasury: AddressLike;
788
+ weth: AddressLike;
789
+ timeBuffer: bigint;
790
+ reservePrice: bigint;
791
+ minBidIncrementPercentage: bigint;
792
+ duration: bigint;
793
+ mintTierId: bigint;
794
+ defaultTokenURI: string;
795
+ paused: boolean;
796
+ owner: AddressLike;
797
+ }
798
+
799
+ export interface AuctionModule {
800
+ // Auction State
801
+ getAuction(args: { provider: ProviderLike; auctionHouse: AddressLike }): Promise<AuctionState>;
802
+ getConfig(args: { provider: ProviderLike; auctionHouse: AddressLike }): Promise<AuctionConfig>;
803
+ // Bidding
804
+ buildCreateBidTx(args: { auctionHouse: AddressLike; nftId: BigNumberish; value: BigNumberish }): TransactionPayload;
805
+ // Settlement
806
+ buildSettleAndCreateTx(args: { auctionHouse: AddressLike }): TransactionPayload;
807
+ buildSettleTx(args: { auctionHouse: AddressLike }): TransactionPayload;
808
+ buildCreateAuctionTx(args: { auctionHouse: AddressLike }): TransactionPayload;
809
+ // Admin
810
+ buildPauseTx(args: { auctionHouse: AddressLike }): TransactionPayload;
811
+ buildUnpauseTx(args: { auctionHouse: AddressLike }): TransactionPayload;
812
+ buildSetTimeBufferTx(args: { auctionHouse: AddressLike; timeBuffer: BigNumberish }): TransactionPayload;
813
+ buildSetReservePriceTx(args: { auctionHouse: AddressLike; reservePrice: BigNumberish }): TransactionPayload;
814
+ buildSetMinBidIncrementTx(args: { auctionHouse: AddressLike; percentage: BigNumberish }): TransactionPayload;
815
+ buildSetDurationTx(args: { auctionHouse: AddressLike; duration: BigNumberish }): TransactionPayload;
816
+ buildSetMintTierIdTx(args: { auctionHouse: AddressLike; tierId: BigNumberish }): TransactionPayload;
817
+ buildSetDefaultTokenURITx(args: { auctionHouse: AddressLike; uri: string }): TransactionPayload;
818
+ }
819
+
820
+ // ============ Bounty System Types ============
821
+
822
+ export type BountyMode = 'OPEN' | 'DIRECT' | 'COMPETITIVE';
823
+ export type BountyStatus = 'ACTIVE' | 'CLAIMED' | 'UNDER_REVIEW' | 'VOTING' | 'COMPLETED' | 'CANCELLED' | 'EXPIRED';
824
+ export type LibraryAction = 'PAYMENT_ONLY' | 'ADD_TO_LIBRARY' | 'PAYMENT_AND_ADD';
825
+
826
+ export interface Bounty {
827
+ creator: AddressLike;
828
+ id: bigint;
829
+ title: string;
830
+ description: string;
831
+ ipfsCID: string;
832
+ reward: bigint;
833
+ creatorDeposit: bigint;
834
+ minContributorLevel: bigint;
835
+ minTokenBalance: bigint;
836
+ requiredBadgeId: bigint;
837
+ deadline: bigint;
838
+ votingEndTime: bigint;
839
+ snapshotBlock: bigint;
840
+ mode: number;
841
+ status: number;
842
+ libraryAction: number;
843
+ assignee: AddressLike;
844
+ winner: AddressLike;
845
+ winningSubmissionId: bigint;
846
+ libraryKey: string;
847
+ governanceProposalId: bigint;
848
+ }
849
+
850
+ export interface BountySubmission {
851
+ id: bigint;
852
+ bountyId: bigint;
853
+ submitter: AddressLike;
854
+ promptIPFS: string;
855
+ deliverableIPFS: string;
856
+ timestamp: bigint;
857
+ voteCount: bigint;
858
+ exists: boolean;
859
+ }
860
+
861
+ export interface BountyModule {
862
+ // Constants
863
+ getMaxSubmissionsPerBounty(args: { provider: ProviderLike; bountySystem: AddressLike }): Promise<bigint>;
864
+ // Bounty Queries
865
+ getBounty(args: { provider: ProviderLike; bountySystem: AddressLike; bountyId: BigNumberish }): Promise<Bounty>;
866
+ getSubmission(args: { provider: ProviderLike; bountySystem: AddressLike; bountyId: BigNumberish; submissionId: BigNumberish }): Promise<BountySubmission>;
867
+ getSubmissionCount(args: { provider: ProviderLike; bountySystem: AddressLike; bountyId: BigNumberish }): Promise<bigint>;
868
+ getLeadingSubmission(args: { provider: ProviderLike; bountySystem: AddressLike; bountyId: BigNumberish }): Promise<{ submissionId: bigint; votes: bigint }>;
869
+ calculateStake(args: { provider: ProviderLike; bountySystem: AddressLike; reward: BigNumberish }): Promise<bigint>;
870
+ canSubmit(args: { provider: ProviderLike; bountySystem: AddressLike; bountyId: BigNumberish; submitter: AddressLike }): Promise<boolean>;
871
+ hasVotedInBounty(args: { provider: ProviderLike; bountySystem: AddressLike; bountyId: BigNumberish; voter: AddressLike }): Promise<boolean>;
872
+ // Bounty Creation
873
+ buildCreateBountyTx(args: {
874
+ bountySystem: AddressLike;
875
+ title: string;
876
+ description: string;
877
+ ipfsCID: string;
878
+ reward: BigNumberish;
879
+ deadline: BigNumberish;
880
+ }): TransactionPayload;
881
+ buildCreateBountyAdvancedTx(args: {
882
+ bountySystem: AddressLike;
883
+ title: string;
884
+ description: string;
885
+ ipfsCID: string;
886
+ reward: BigNumberish;
887
+ deadline: BigNumberish;
888
+ votingDuration: BigNumberish;
889
+ mode: number;
890
+ libraryAction: number;
891
+ assignee: AddressLike;
892
+ libraryKey: string;
893
+ }): TransactionPayload;
894
+ // Claiming & Submission
895
+ buildClaimBountyTx(args: { bountySystem: AddressLike; bountyId: BigNumberish }): TransactionPayload;
896
+ buildSubmitEntryTx(args: {
897
+ bountySystem: AddressLike;
898
+ bountyId: BigNumberish;
899
+ promptIPFS: string;
900
+ deliverableIPFS: string;
901
+ }): TransactionPayload;
902
+ buildCompleteBountyTx(args: {
903
+ bountySystem: AddressLike;
904
+ bountyId: BigNumberish;
905
+ deliverableIPFS: string;
906
+ }): TransactionPayload;
907
+ // Voting (COMPETITIVE mode)
908
+ buildStartVotingTx(args: { bountySystem: AddressLike; bountyId: BigNumberish }): TransactionPayload;
909
+ buildVoteTx(args: { bountySystem: AddressLike; bountyId: BigNumberish; submissionId: BigNumberish }): TransactionPayload;
910
+ buildFinalizeCompetitiveTx(args: { bountySystem: AddressLike; bountyId: BigNumberish }): TransactionPayload;
911
+ // Approval
912
+ buildApproveSubmissionTx(args: { bountySystem: AddressLike; bountyId: BigNumberish; submissionId: BigNumberish }): TransactionPayload;
913
+ // Cancellation & Expiry
914
+ buildCancelBountyTx(args: { bountySystem: AddressLike; bountyId: BigNumberish }): TransactionPayload;
915
+ buildExpireBountyTx(args: { bountySystem: AddressLike; bountyId: BigNumberish }): TransactionPayload;
916
+ // Reward Management
917
+ buildIncreaseRewardTx(args: { bountySystem: AddressLike; bountyId: BigNumberish; additionalReward: BigNumberish }): TransactionPayload;
918
+ // Gate Management
919
+ buildSetGatesTx(args: {
920
+ bountySystem: AddressLike;
921
+ bountyId: BigNumberish;
922
+ minTokenBalance: BigNumberish;
923
+ requiredBadgeId: BigNumberish;
924
+ }): TransactionPayload;
925
+ buildAddToWhitelistTx(args: { bountySystem: AddressLike; bountyId: BigNumberish; addresses: AddressLike[] }): TransactionPayload;
926
+ buildRemoveFromWhitelistTx(args: { bountySystem: AddressLike; bountyId: BigNumberish; addresses: AddressLike[] }): TransactionPayload;
927
+ }
928
+
543
929
  export interface SageSDK {
544
930
  version: string;
545
931
  getProvider: (rpcUrl: string) => any;
546
932
  abi: Record<string, any>;
547
- governance: Record<string, any>;
933
+ governance: GovernanceModule;
548
934
  subdao: Record<string, any>;
549
935
  timelock: Record<string, any>;
550
936
  factory: Record<string, any>;
@@ -569,6 +955,10 @@ export interface SageSDK {
569
955
  treasury: TreasuryModule;
570
956
  boost: BoostModule;
571
957
  personal: PersonalModule;
958
+ // New modules for voting multiplier, auction, and bounty systems
959
+ votingMultiplier: VotingMultiplierModule;
960
+ auction: AuctionModule;
961
+ bounty: BountyModule;
572
962
  subgraph: Record<string, any>;
573
963
  errors: Record<string, any>;
574
964
  resolveGovernanceContext: (args: any) => Promise<any>;