@viwoapp/sdk 0.1.8 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +581 -427
- package/dist/index.d.mts +268 -12
- package/dist/index.d.ts +268 -12
- package/dist/index.js +275 -17
- package/dist/index.mjs +275 -17
- package/package.json +82 -82
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PublicKey,
|
|
1
|
+
import { PublicKey, Commitment, Connection, Transaction, VersionedTransaction, TransactionInstruction } from '@solana/web3.js';
|
|
2
2
|
import { BN, AnchorProvider } from '@coral-xyz/anchor';
|
|
3
3
|
export { BN } from '@coral-xyz/anchor';
|
|
4
4
|
|
|
@@ -173,7 +173,20 @@ declare const GOVERNANCE_CONSTANTS: {
|
|
|
173
173
|
executionDelay: number;
|
|
174
174
|
vetoWindow: number;
|
|
175
175
|
quorumBps: number;
|
|
176
|
-
|
|
176
|
+
/** Authority transfer timelock (H-02) */
|
|
177
|
+
authorityTransferTimelock: number;
|
|
178
|
+
/** ZK private voting constants */
|
|
179
|
+
zk: {
|
|
180
|
+
/** Vote validity proof size (3 OR proofs + 1 sum proof) */
|
|
181
|
+
voteProofSize: number;
|
|
182
|
+
/** ElGamal ciphertext size (R || C) */
|
|
183
|
+
ciphertextSize: number;
|
|
184
|
+
/** Max committee members */
|
|
185
|
+
maxCommitteeSize: number;
|
|
186
|
+
/** Account sizes */
|
|
187
|
+
privateVotingConfigSize: number;
|
|
188
|
+
decryptionShareSize: number;
|
|
189
|
+
};
|
|
177
190
|
};
|
|
178
191
|
declare const SECURITY_CONSTANTS: {
|
|
179
192
|
authorityTransferTimelock: number;
|
|
@@ -189,6 +202,18 @@ declare const SECURITY_CONSTANTS: {
|
|
|
189
202
|
merkleProofMaxSize: number;
|
|
190
203
|
maxEpochBitmap: number;
|
|
191
204
|
votingPowerVerifiedOnChain: boolean;
|
|
205
|
+
/** H-AUDIT-12: Maximum concurrent sessions per user */
|
|
206
|
+
maxSessionsPerUser: number;
|
|
207
|
+
/** C-AUDIT-15: Maximum day delta for daily budget reset (clock skew protection) */
|
|
208
|
+
maxDayDelta: number;
|
|
209
|
+
/** H-AUDIT-09: Maximum daily activity score for transfer hook */
|
|
210
|
+
maxDailyActivityScore: number;
|
|
211
|
+
/** M-AUDIT-10: Wash flag decay period (7 days) */
|
|
212
|
+
washFlagDecayPeriod: number;
|
|
213
|
+
/** M-18: Maximum vouch age before expiry (1 year) */
|
|
214
|
+
maxVouchAge: number;
|
|
215
|
+
/** C-AUDIT-11: Valid content energy tiers (1-4) */
|
|
216
|
+
maxContentTier: number;
|
|
192
217
|
};
|
|
193
218
|
declare const VALID_URI_PREFIXES: readonly ["ipfs://", "https://", "ar://"];
|
|
194
219
|
declare const MAX_URI_LENGTH = 128;
|
|
@@ -394,6 +419,12 @@ interface VoteRecord {
|
|
|
394
419
|
votePower: BN;
|
|
395
420
|
support: boolean;
|
|
396
421
|
votedAt: BN;
|
|
422
|
+
/** ElGamal ciphertext for "for" vote (64 bytes: R || C) - only set for private votes */
|
|
423
|
+
ctFor?: Uint8Array;
|
|
424
|
+
/** ElGamal ciphertext for "against" vote (64 bytes: R || C) - only set for private votes */
|
|
425
|
+
ctAgainst?: Uint8Array;
|
|
426
|
+
/** ElGamal ciphertext for "abstain" vote (64 bytes: R || C) - only set for private votes */
|
|
427
|
+
ctAbstain?: Uint8Array;
|
|
397
428
|
}
|
|
398
429
|
interface CreateProposalParams {
|
|
399
430
|
title: string;
|
|
@@ -574,6 +605,8 @@ interface UserGaslessStats {
|
|
|
574
605
|
totalVcoinFees: BN;
|
|
575
606
|
sessionsCreated: number;
|
|
576
607
|
activeSession: PublicKey;
|
|
608
|
+
/** H-AUDIT-12: Number of active (non-revoked, non-expired) sessions */
|
|
609
|
+
activeSessions: number;
|
|
577
610
|
}
|
|
578
611
|
declare enum VerificationLevel {
|
|
579
612
|
None = 0,// Wallet connected only
|
|
@@ -650,26 +683,52 @@ interface GovernanceConfig extends PendingAuthorityFields {
|
|
|
650
683
|
vevcoinMint: PublicKey;
|
|
651
684
|
paused: boolean;
|
|
652
685
|
proposalCount: BN;
|
|
653
|
-
|
|
686
|
+
/** H-02: Timestamp when pending authority transfer was initiated (for 24h timelock) */
|
|
687
|
+
pendingAuthorityActivatedAt: BN;
|
|
654
688
|
}
|
|
655
|
-
/** ZK voting decryption share
|
|
689
|
+
/** ZK voting decryption share with per-category partials and DLEQ proof */
|
|
656
690
|
interface DecryptionShare {
|
|
657
691
|
proposal: PublicKey;
|
|
658
692
|
committeeIndex: number;
|
|
659
693
|
committeeMember: PublicKey;
|
|
660
|
-
|
|
694
|
+
/** Partial decryption: sk_j * R_for_sum (Ristretto255 point) */
|
|
695
|
+
partialFor: Uint8Array;
|
|
696
|
+
/** Partial decryption: sk_j * R_against_sum (Ristretto255 point) */
|
|
697
|
+
partialAgainst: Uint8Array;
|
|
698
|
+
/** Partial decryption: sk_j * R_abstain_sum (Ristretto255 point) */
|
|
699
|
+
partialAbstain: Uint8Array;
|
|
700
|
+
/** Batched DLEQ proof challenge (Scalar) */
|
|
701
|
+
dleqChallenge: Uint8Array;
|
|
702
|
+
/** Batched DLEQ proof response (Scalar) */
|
|
703
|
+
dleqResponse: Uint8Array;
|
|
661
704
|
submittedAt: BN;
|
|
705
|
+
verified: boolean;
|
|
662
706
|
}
|
|
663
|
-
/** Private voting config with
|
|
707
|
+
/** Private voting config with ZK cryptographic verification */
|
|
664
708
|
interface PrivateVotingConfig {
|
|
665
709
|
proposal: PublicKey;
|
|
666
|
-
|
|
710
|
+
/** Joint ElGamal public key (Ristretto255 point, 32 bytes) */
|
|
711
|
+
encryptionPubkey: Uint8Array;
|
|
667
712
|
decryptionThreshold: number;
|
|
668
713
|
decryptionCommittee: PublicKey[];
|
|
714
|
+
/** Committee ElGamal public keys (Ristretto255 points) */
|
|
715
|
+
committeeElgamalPubkeys: Uint8Array[];
|
|
669
716
|
sharesSubmitted: boolean[];
|
|
670
717
|
revealCompleted: boolean;
|
|
671
718
|
aggregatedFor: BN;
|
|
672
719
|
aggregatedAgainst: BN;
|
|
720
|
+
aggregatedAbstain: BN;
|
|
721
|
+
/** Verification hash for audit trail */
|
|
722
|
+
verificationHash: Uint8Array;
|
|
723
|
+
/** Homomorphically accumulated ciphertext components */
|
|
724
|
+
accumulatedCtForR: Uint8Array;
|
|
725
|
+
accumulatedCtForC: Uint8Array;
|
|
726
|
+
accumulatedCtAgainstR: Uint8Array;
|
|
727
|
+
accumulatedCtAgainstC: Uint8Array;
|
|
728
|
+
accumulatedCtAbstainR: Uint8Array;
|
|
729
|
+
accumulatedCtAbstainC: Uint8Array;
|
|
730
|
+
/** Number of private votes cast */
|
|
731
|
+
totalPrivateVotes: number;
|
|
673
732
|
}
|
|
674
733
|
/** Delegation with expiry (M-07) */
|
|
675
734
|
interface Delegation {
|
|
@@ -692,6 +751,8 @@ interface PendingScoreUpdate {
|
|
|
692
751
|
submissionCount: number;
|
|
693
752
|
createdAt: BN;
|
|
694
753
|
expiresAt: BN;
|
|
754
|
+
/** C-07: Immutable consensus count stored at creation time */
|
|
755
|
+
requiredConsensus: number;
|
|
695
756
|
}
|
|
696
757
|
interface HookConfig extends PendingAuthorityFields {
|
|
697
758
|
authority: PublicKey;
|
|
@@ -699,10 +760,82 @@ interface HookConfig extends PendingAuthorityFields {
|
|
|
699
760
|
blockWashTrading: boolean;
|
|
700
761
|
paused: boolean;
|
|
701
762
|
}
|
|
763
|
+
/** Pair tracking for wash trade detection */
|
|
764
|
+
interface PairTracking {
|
|
765
|
+
sender: PublicKey;
|
|
766
|
+
receiver: PublicKey;
|
|
767
|
+
transferCount: number;
|
|
768
|
+
lastTransferTime: BN;
|
|
769
|
+
washFlags: number;
|
|
770
|
+
/** M-AUDIT-10: Timestamp of last wash flag for decay */
|
|
771
|
+
lastFlagTime: BN;
|
|
772
|
+
}
|
|
773
|
+
interface VeVCoinConfig extends PendingAuthorityFields {
|
|
774
|
+
authority: PublicKey;
|
|
775
|
+
vcoinMint: PublicKey;
|
|
776
|
+
vevcoinMint: PublicKey;
|
|
777
|
+
stakingProtocol: PublicKey;
|
|
778
|
+
totalHolders: BN;
|
|
779
|
+
totalMinted: BN;
|
|
780
|
+
paused: boolean;
|
|
781
|
+
/** C-01: Timestamp when pending authority transfer was initiated (for 24h timelock) */
|
|
782
|
+
pendingAuthorityActivatedAt: BN;
|
|
783
|
+
}
|
|
784
|
+
/** Parameters for casting a private vote */
|
|
785
|
+
interface CastPrivateVoteParams {
|
|
786
|
+
proposalId: BN;
|
|
787
|
+
/** ElGamal ciphertext for "for" (64 bytes) */
|
|
788
|
+
ctFor: Uint8Array;
|
|
789
|
+
/** ElGamal ciphertext for "against" (64 bytes) */
|
|
790
|
+
ctAgainst: Uint8Array;
|
|
791
|
+
/** ElGamal ciphertext for "abstain" (64 bytes) */
|
|
792
|
+
ctAbstain: Uint8Array;
|
|
793
|
+
/** Vote validity proof (352 bytes) */
|
|
794
|
+
proofData: Uint8Array;
|
|
795
|
+
}
|
|
796
|
+
/** Parameters for enabling private voting on a proposal */
|
|
797
|
+
interface EnablePrivateVotingParams {
|
|
798
|
+
proposalId: BN;
|
|
799
|
+
/** Joint ElGamal public key (Ristretto255 point, 32 bytes) */
|
|
800
|
+
encryptionPubkey: Uint8Array;
|
|
801
|
+
/** Committee member Solana pubkeys */
|
|
802
|
+
decryptionCommittee: PublicKey[];
|
|
803
|
+
committeeSize: number;
|
|
804
|
+
decryptionThreshold: number;
|
|
805
|
+
/** Committee member ElGamal public keys (Ristretto255 points, 32 bytes each) */
|
|
806
|
+
committeeElgamalPubkeys: Uint8Array[];
|
|
807
|
+
}
|
|
808
|
+
/** Parameters for submitting a decryption share */
|
|
809
|
+
interface SubmitDecryptionShareParams {
|
|
810
|
+
proposalId: BN;
|
|
811
|
+
committeeIndex: number;
|
|
812
|
+
/** Partial decryption for "for" (Ristretto255 point, 32 bytes) */
|
|
813
|
+
partialFor: Uint8Array;
|
|
814
|
+
/** Partial decryption for "against" (Ristretto255 point, 32 bytes) */
|
|
815
|
+
partialAgainst: Uint8Array;
|
|
816
|
+
/** Partial decryption for "abstain" (Ristretto255 point, 32 bytes) */
|
|
817
|
+
partialAbstain: Uint8Array;
|
|
818
|
+
/** DLEQ proof challenge (Scalar, 32 bytes) */
|
|
819
|
+
dleqChallenge: Uint8Array;
|
|
820
|
+
/** DLEQ proof response (Scalar, 32 bytes) */
|
|
821
|
+
dleqResponse: Uint8Array;
|
|
822
|
+
}
|
|
823
|
+
/** Parameters for aggregating revealed votes (permissionless) */
|
|
824
|
+
interface AggregateRevealedVotesParams {
|
|
825
|
+
proposalId: BN;
|
|
826
|
+
tallyFor: BN;
|
|
827
|
+
tallyAgainst: BN;
|
|
828
|
+
tallyAbstain: BN;
|
|
829
|
+
/** Lagrange interpolation coefficients (Scalars, 32 bytes each) */
|
|
830
|
+
lagrangeCoefficients: Uint8Array[];
|
|
831
|
+
}
|
|
702
832
|
|
|
703
833
|
/**
|
|
704
834
|
* Governance Client for ViWoApp governance operations
|
|
705
835
|
*
|
|
836
|
+
* Supports both public voting and ZK private voting with Twisted ElGamal
|
|
837
|
+
* encryption on Ristretto255.
|
|
838
|
+
*
|
|
706
839
|
* @example
|
|
707
840
|
* ```typescript
|
|
708
841
|
* const govClient = client.governance;
|
|
@@ -715,8 +848,13 @@ interface HookConfig extends PendingAuthorityFields {
|
|
|
715
848
|
* durationDays: 7,
|
|
716
849
|
* });
|
|
717
850
|
*
|
|
718
|
-
* //
|
|
719
|
-
* await govClient.vote(proposalId, true);
|
|
851
|
+
* // Public vote on a proposal
|
|
852
|
+
* await govClient.vote(proposalId, true);
|
|
853
|
+
*
|
|
854
|
+
* // Private vote (using zk-voting-sdk for encryption)
|
|
855
|
+
* await govClient.buildCastPrivateVoteTransaction({
|
|
856
|
+
* proposalId, ctFor, ctAgainst, ctAbstain, proofData,
|
|
857
|
+
* });
|
|
720
858
|
* ```
|
|
721
859
|
*/
|
|
722
860
|
declare class GovernanceClient {
|
|
@@ -725,7 +863,7 @@ declare class GovernanceClient {
|
|
|
725
863
|
/**
|
|
726
864
|
* Get governance configuration
|
|
727
865
|
*/
|
|
728
|
-
getConfig(): Promise<
|
|
866
|
+
getConfig(): Promise<GovernanceConfig | null>;
|
|
729
867
|
/**
|
|
730
868
|
* Get proposal by ID
|
|
731
869
|
*/
|
|
@@ -744,6 +882,9 @@ declare class GovernanceClient {
|
|
|
744
882
|
hasVoted(proposalId: BN, user?: PublicKey): Promise<boolean>;
|
|
745
883
|
/**
|
|
746
884
|
* Calculate user's voting power
|
|
885
|
+
*
|
|
886
|
+
* @note M-01 fix: 5A boost formula is now `1000 + ((five_a_score * 100) / 1000)`
|
|
887
|
+
* to fix precision loss for small scores.
|
|
747
888
|
*/
|
|
748
889
|
getVotingPower(user?: PublicKey): Promise<BN>;
|
|
749
890
|
/**
|
|
@@ -759,6 +900,9 @@ declare class GovernanceClient {
|
|
|
759
900
|
}>;
|
|
760
901
|
/**
|
|
761
902
|
* Get proposal progress
|
|
903
|
+
*
|
|
904
|
+
* @note C-03: Quorum is now calculated as votesFor + votesAgainst only.
|
|
905
|
+
* Abstains do NOT count toward quorum.
|
|
762
906
|
*/
|
|
763
907
|
getProposalProgress(proposalId: BN): Promise<{
|
|
764
908
|
votesFor: string;
|
|
@@ -774,7 +918,7 @@ declare class GovernanceClient {
|
|
|
774
918
|
*/
|
|
775
919
|
buildCreateProposalTransaction(params: CreateProposalParams): Promise<Transaction>;
|
|
776
920
|
/**
|
|
777
|
-
* Build vote transaction
|
|
921
|
+
* Build vote transaction (public)
|
|
778
922
|
*
|
|
779
923
|
* @note v2.8.0 (C-NEW-01): Voting power parameters (vevcoin_balance, five_a_score, tier)
|
|
780
924
|
* are now read from on-chain state, not passed as parameters. This prevents vote manipulation.
|
|
@@ -788,6 +932,66 @@ declare class GovernanceClient {
|
|
|
788
932
|
* Build execute proposal transaction
|
|
789
933
|
*/
|
|
790
934
|
buildExecuteTransaction(proposalId: BN): Promise<Transaction>;
|
|
935
|
+
/**
|
|
936
|
+
* Build cast private vote transaction
|
|
937
|
+
*
|
|
938
|
+
* Uses Twisted ElGamal encryption on Ristretto255 with compressed sigma proofs.
|
|
939
|
+
* The voter encrypts their choice into 3 ciphertexts (for/against/abstain) and
|
|
940
|
+
* generates a validity proof that exactly one ciphertext encrypts their weight.
|
|
941
|
+
*
|
|
942
|
+
* Use the `zk-voting-sdk` crate to generate ciphertexts and proofs off-chain:
|
|
943
|
+
* ```rust
|
|
944
|
+
* let (ct_for, ct_against, ct_abstain, proof) = encrypt_and_prove(&pubkey, choice, weight);
|
|
945
|
+
* ```
|
|
946
|
+
*
|
|
947
|
+
* @param params - Private vote parameters with ciphertexts and proof
|
|
948
|
+
*/
|
|
949
|
+
buildCastPrivateVoteTransaction(params: CastPrivateVoteParams): Promise<Transaction>;
|
|
950
|
+
/**
|
|
951
|
+
* Build enable private voting transaction
|
|
952
|
+
*
|
|
953
|
+
* Called by the governance authority to enable ZK private voting on a proposal.
|
|
954
|
+
* Requires specifying the decryption committee and their ElGamal public keys.
|
|
955
|
+
*
|
|
956
|
+
* @param params - Private voting configuration
|
|
957
|
+
*/
|
|
958
|
+
buildEnablePrivateVotingTransaction(params: EnablePrivateVotingParams): Promise<Transaction>;
|
|
959
|
+
/**
|
|
960
|
+
* Build submit decryption share transaction
|
|
961
|
+
*
|
|
962
|
+
* Called by a committee member during the reveal phase.
|
|
963
|
+
* Each member computes partial decryptions and a DLEQ proof off-chain:
|
|
964
|
+
* ```rust
|
|
965
|
+
* let partial = generate_partial_decryption(&secret_share, &pk, &r_for, &r_against, &r_abstain);
|
|
966
|
+
* ```
|
|
967
|
+
*
|
|
968
|
+
* @param params - Decryption share with DLEQ proof
|
|
969
|
+
*/
|
|
970
|
+
buildSubmitDecryptionShareTransaction(params: SubmitDecryptionShareParams): Promise<Transaction>;
|
|
971
|
+
/**
|
|
972
|
+
* Build aggregate revealed votes transaction (permissionless)
|
|
973
|
+
*
|
|
974
|
+
* Anyone can submit the aggregated tally since the on-chain program
|
|
975
|
+
* cryptographically verifies: tally * H == C_sum - D for each category.
|
|
976
|
+
* This prevents fabrication of results.
|
|
977
|
+
*
|
|
978
|
+
* Use the `zk-voting-sdk` to compute the tally off-chain:
|
|
979
|
+
* ```rust
|
|
980
|
+
* let lagrange = compute_lagrange_coefficients(&selected_indices);
|
|
981
|
+
* let d = combine_partials(&lagrange, &partials);
|
|
982
|
+
* let tally = recover_tally(&d, &accumulated_c, max_votes).unwrap();
|
|
983
|
+
* ```
|
|
984
|
+
*
|
|
985
|
+
* @param params - Tally values and Lagrange coefficients
|
|
986
|
+
*/
|
|
987
|
+
buildAggregateRevealedVotesTransaction(params: AggregateRevealedVotesParams): Promise<Transaction>;
|
|
988
|
+
/**
|
|
989
|
+
* Check if authority transfer timelock has elapsed (H-02)
|
|
990
|
+
*/
|
|
991
|
+
canAcceptAuthority(): Promise<{
|
|
992
|
+
canAccept: boolean;
|
|
993
|
+
reason?: string;
|
|
994
|
+
}>;
|
|
791
995
|
}
|
|
792
996
|
|
|
793
997
|
/**
|
|
@@ -849,6 +1053,9 @@ declare class RewardsClient {
|
|
|
849
1053
|
}>;
|
|
850
1054
|
/**
|
|
851
1055
|
* Calculate gasless fee for claim
|
|
1056
|
+
*
|
|
1057
|
+
* C-05: Uses ceiling division to prevent fee rounding to zero on small amounts.
|
|
1058
|
+
* Formula: fee = ceil(amount * feeBps / 10000)
|
|
852
1059
|
*/
|
|
853
1060
|
calculateGaslessFee(amount: BN): BN;
|
|
854
1061
|
/**
|
|
@@ -867,6 +1074,9 @@ declare class RewardsClient {
|
|
|
867
1074
|
private hashBytes;
|
|
868
1075
|
/**
|
|
869
1076
|
* Build claim rewards transaction
|
|
1077
|
+
*
|
|
1078
|
+
* H-NEW-02: Merkle proof size is limited to 32 levels (supports 4B+ users).
|
|
1079
|
+
* Proofs exceeding this limit will be rejected on-chain with MerkleProofTooLarge.
|
|
870
1080
|
*/
|
|
871
1081
|
buildClaimTransaction(params: ClaimRewardsParams): Promise<Transaction>;
|
|
872
1082
|
}
|
|
@@ -935,6 +1145,9 @@ declare class ViLinkClient {
|
|
|
935
1145
|
}>;
|
|
936
1146
|
/**
|
|
937
1147
|
* Calculate platform fee for tip
|
|
1148
|
+
*
|
|
1149
|
+
* C-06: Uses ceiling division to prevent fee rounding to zero on small amounts.
|
|
1150
|
+
* Formula: fee = ceil(amount * feeBps / 10000)
|
|
938
1151
|
*/
|
|
939
1152
|
calculateFee(amount: BN): {
|
|
940
1153
|
fee: BN;
|
|
@@ -988,6 +1201,13 @@ declare class ViLinkClient {
|
|
|
988
1201
|
* Build execute tip action transaction
|
|
989
1202
|
* @param creator - The action creator's public key
|
|
990
1203
|
* @param nonce - M-04: The action nonce (NOT timestamp)
|
|
1204
|
+
*
|
|
1205
|
+
* H-05: The on-chain handler validates that the executor's token account has
|
|
1206
|
+
* no active delegation (delegate is None or delegated_amount is 0).
|
|
1207
|
+
* This prevents delegated tokens from being spent without explicit approval.
|
|
1208
|
+
*
|
|
1209
|
+
* C-06: Platform fee uses ceiling division to prevent zero-fee exploitation on
|
|
1210
|
+
* small amounts.
|
|
991
1211
|
*/
|
|
992
1212
|
buildExecuteTipAction(creator: PublicKey, nonce: BN): Promise<Transaction>;
|
|
993
1213
|
/**
|
|
@@ -1033,6 +1253,9 @@ declare class GaslessClient {
|
|
|
1033
1253
|
getSessionKey(user: PublicKey, sessionPubkey: PublicKey): Promise<SessionKey | null>;
|
|
1034
1254
|
/**
|
|
1035
1255
|
* Get user gasless statistics
|
|
1256
|
+
*
|
|
1257
|
+
* H-AUDIT-12: Now includes active_sessions field for per-user session limit tracking.
|
|
1258
|
+
* The protocol enforces a maximum of 5 concurrent active sessions per user.
|
|
1036
1259
|
*/
|
|
1037
1260
|
getUserStats(user?: PublicKey): Promise<UserGaslessStats | null>;
|
|
1038
1261
|
/**
|
|
@@ -1080,6 +1303,9 @@ declare class GaslessClient {
|
|
|
1080
1303
|
createScope(actions: string[]): number;
|
|
1081
1304
|
/**
|
|
1082
1305
|
* Build create session key transaction
|
|
1306
|
+
*
|
|
1307
|
+
* H-AUDIT-12: The protocol enforces a maximum of 5 concurrent active sessions per user.
|
|
1308
|
+
* Creating a session when the limit is reached will fail with MaxSessionsReached error.
|
|
1083
1309
|
*/
|
|
1084
1310
|
buildCreateSessionTransaction(params: CreateSessionParams): Promise<Transaction>;
|
|
1085
1311
|
/**
|
|
@@ -1130,6 +1356,14 @@ declare class IdentityClient {
|
|
|
1130
1356
|
* Get verification level benefits
|
|
1131
1357
|
*/
|
|
1132
1358
|
getVerificationBenefits(level: VerificationLevel): string[];
|
|
1359
|
+
/**
|
|
1360
|
+
* Build subscribe transaction
|
|
1361
|
+
*
|
|
1362
|
+
* C-AUDIT-22: Non-free subscription tiers require actual USDC payment via SPL
|
|
1363
|
+
* transfer_checked. The transaction must include the user's USDC token account,
|
|
1364
|
+
* the USDC mint, and the treasury token account.
|
|
1365
|
+
*/
|
|
1366
|
+
buildSubscribeTransaction(tier: number): Promise<Transaction>;
|
|
1133
1367
|
/**
|
|
1134
1368
|
* Build create identity transaction
|
|
1135
1369
|
*/
|
|
@@ -1190,6 +1424,12 @@ declare class FiveAClient {
|
|
|
1190
1424
|
getMaxVouches(composite: number): number;
|
|
1191
1425
|
/**
|
|
1192
1426
|
* Check if user can vouch for another
|
|
1427
|
+
*
|
|
1428
|
+
* C-08: Mutual vouching is prevented — if the target has already vouched for you,
|
|
1429
|
+
* you cannot vouch for them. This is enforced on-chain via reverse_vouch_record check.
|
|
1430
|
+
*
|
|
1431
|
+
* M-18: Vouches expire after 1 year (MAX_VOUCH_AGE = 365 days). Expired vouches
|
|
1432
|
+
* cannot be evaluated and must be re-created.
|
|
1193
1433
|
*/
|
|
1194
1434
|
canVouchFor(target: PublicKey): Promise<{
|
|
1195
1435
|
canVouch: boolean;
|
|
@@ -1201,6 +1441,12 @@ declare class FiveAClient {
|
|
|
1201
1441
|
getImprovementSuggestions(score: FiveAScore): string[];
|
|
1202
1442
|
/**
|
|
1203
1443
|
* Build vouch transaction
|
|
1444
|
+
*
|
|
1445
|
+
* C-08: On-chain handler requires a reverse_vouch_record account to verify
|
|
1446
|
+
* mutual vouching is not occurring. The transaction must include this PDA.
|
|
1447
|
+
*
|
|
1448
|
+
* M-18: Vouches have a maximum age of 1 year. After that, evaluate_vouch
|
|
1449
|
+
* will reject with VouchExpired error.
|
|
1204
1450
|
*/
|
|
1205
1451
|
buildVouchTransaction(target: PublicKey): Promise<Transaction>;
|
|
1206
1452
|
}
|
|
@@ -1265,6 +1511,9 @@ declare class ContentClient {
|
|
|
1265
1511
|
}>;
|
|
1266
1512
|
/**
|
|
1267
1513
|
* Get content stats
|
|
1514
|
+
*
|
|
1515
|
+
* C-AUDIT-10: Engagement scores can only increase — the on-chain update_engagement
|
|
1516
|
+
* instruction enforces monotonic increase to prevent manipulation.
|
|
1268
1517
|
*/
|
|
1269
1518
|
getContentStats(contentId: Uint8Array): Promise<{
|
|
1270
1519
|
tips: string;
|
|
@@ -1275,6 +1524,9 @@ declare class ContentClient {
|
|
|
1275
1524
|
}>;
|
|
1276
1525
|
/**
|
|
1277
1526
|
* Build create content transaction
|
|
1527
|
+
*
|
|
1528
|
+
* C-AUDIT-11: Energy tiers are validated on-chain (valid range: 1-4).
|
|
1529
|
+
* Tier determines max energy and regen rate.
|
|
1278
1530
|
*/
|
|
1279
1531
|
buildCreateContentTransaction(contentHash: Uint8Array): Promise<Transaction>;
|
|
1280
1532
|
/**
|
|
@@ -1411,6 +1663,10 @@ declare class StakingClient {
|
|
|
1411
1663
|
calculateVeVCoin(amount: BN, lockDuration: number): BN;
|
|
1412
1664
|
/**
|
|
1413
1665
|
* Get tier name
|
|
1666
|
+
*
|
|
1667
|
+
* M-05: The on-chain update_tier instruction will reject no-op tier updates
|
|
1668
|
+
* with TierUnchanged error. Only call updateTier when the user's stake amount
|
|
1669
|
+
* actually qualifies for a different tier.
|
|
1414
1670
|
*/
|
|
1415
1671
|
getTierName(tier: StakingTier): string;
|
|
1416
1672
|
/**
|
|
@@ -1453,4 +1709,4 @@ declare class StakingClient {
|
|
|
1453
1709
|
buildExtendLockTransaction(newDuration: number): Promise<Transaction>;
|
|
1454
1710
|
}
|
|
1455
1711
|
|
|
1456
|
-
export { ACTION_SCOPES, ActionType, CONTENT_CONSTANTS, type ClaimRewardsParams, type ConnectionConfig, ContentClient, type ContentRecord, ContentState, type CreateActionParams, type CreateProposalParams, type CreateSessionParams, type DecryptionShare, type Delegation, type EpochDistribution, FIVE_A_CONSTANTS, FeeMethod, FiveAClient, type FiveAConfig, type FiveAScore, GASLESS_CONSTANTS, GOVERNANCE_CONSTANTS, GaslessClient, type GaslessConfig, GovernanceClient, type GovernanceConfig, type HookConfig, type Identity, IdentityClient, type IdentityConfig, LEGACY_SLASH_DEPRECATED, LOCK_DURATIONS, MAX_EPOCH_BITMAP, MAX_URI_LENGTH, MERKLE_CONSTANTS, MERKLE_PROOF_MAX_SIZE, PDAs, PROGRAM_IDS, type PendingAuthorityFields, type PendingScoreUpdate, type PrivateVotingConfig, type Proposal, ProposalStatus, type RegistryConfig, RewardsClient, type RewardsPoolConfig, SECURITY_CONSTANTS, SEEDS, SSCRE_CONSTANTS, STAKING_TIERS, type SessionKey, type SlashRequest, SlashStatus, type StakeParams, StakingClient, type StakingPool, StakingTier, TransactionBuilder, type UserActionStatsExtended, type UserClaim, type UserEnergy, type UserGaslessStats, type UserStake, VALID_URI_PREFIXES, VCOIN_DECIMALS, VCOIN_INITIAL_CIRCULATING, VCOIN_TOTAL_SUPPLY, type VCoinConfig, VEVCOIN_DECIMALS, VILINK_CONSTANTS, VerificationLevel, type ViLinkAction, ViLinkClient, type ViLinkConfig, ViWoClient, ViWoConnection, VoteChoice, type VoteRecord, type VouchRecord, type WalletAdapter, dateToTimestamp, formatVCoin, getCurrentTimestamp, parseVCoin, timestampToDate };
|
|
1712
|
+
export { ACTION_SCOPES, ActionType, type AggregateRevealedVotesParams, CONTENT_CONSTANTS, type CastPrivateVoteParams, type ClaimRewardsParams, type ConnectionConfig, ContentClient, type ContentRecord, ContentState, type CreateActionParams, type CreateProposalParams, type CreateSessionParams, type DecryptionShare, type Delegation, type EnablePrivateVotingParams, type EpochDistribution, FIVE_A_CONSTANTS, FeeMethod, FiveAClient, type FiveAConfig, type FiveAScore, GASLESS_CONSTANTS, GOVERNANCE_CONSTANTS, GaslessClient, type GaslessConfig, GovernanceClient, type GovernanceConfig, type HookConfig, type Identity, IdentityClient, type IdentityConfig, LEGACY_SLASH_DEPRECATED, LOCK_DURATIONS, MAX_EPOCH_BITMAP, MAX_URI_LENGTH, MERKLE_CONSTANTS, MERKLE_PROOF_MAX_SIZE, PDAs, PROGRAM_IDS, type PairTracking, type PendingAuthorityFields, type PendingScoreUpdate, type PrivateVotingConfig, type Proposal, ProposalStatus, type RegistryConfig, RewardsClient, type RewardsPoolConfig, SECURITY_CONSTANTS, SEEDS, SSCRE_CONSTANTS, STAKING_TIERS, type SessionKey, type SlashRequest, SlashStatus, type StakeParams, StakingClient, type StakingPool, StakingTier, type SubmitDecryptionShareParams, TransactionBuilder, type UserActionStatsExtended, type UserClaim, type UserEnergy, type UserGaslessStats, type UserStake, VALID_URI_PREFIXES, VCOIN_DECIMALS, VCOIN_INITIAL_CIRCULATING, VCOIN_TOTAL_SUPPLY, type VCoinConfig, VEVCOIN_DECIMALS, VILINK_CONSTANTS, type VeVCoinConfig, VerificationLevel, type ViLinkAction, ViLinkClient, type ViLinkConfig, ViWoClient, ViWoConnection, VoteChoice, type VoteRecord, type VouchRecord, type WalletAdapter, dateToTimestamp, formatVCoin, getCurrentTimestamp, parseVCoin, timestampToDate };
|