@viwoapp/sdk 0.1.1 → 0.1.3
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 +24 -8
- package/dist/index.d.mts +31 -2
- package/dist/index.d.ts +31 -2
- package/dist/index.js +33 -1
- package/dist/index.mjs +29 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,11 +5,19 @@
|
|
|
5
5
|
|
|
6
6
|
TypeScript SDK for VCoin Protocol Integration on Solana.
|
|
7
7
|
|
|
8
|
-
**Version:** 0.1.
|
|
8
|
+
**Version:** 0.1.3 (Phase 5 Security Update)
|
|
9
|
+
|
|
10
|
+
## What's New in v0.1.2
|
|
11
|
+
|
|
12
|
+
- **New Constants:** `MERKLE_PROOF_MAX_SIZE`, `MAX_EPOCH_BITMAP`, `LEGACY_SLASH_DEPRECATED`
|
|
13
|
+
- **New Enum:** `VoteChoice` for typed governance voting (Against, For, Abstain)
|
|
14
|
+
- **Updated Types:** `SlashRequest` (added `requestId`), `UserClaim` (bitmap storage)
|
|
15
|
+
- **Updated Docs:** `buildVoteTransaction` - voting power now verified on-chain
|
|
16
|
+
- **SECURITY_CONSTANTS:** Added `merkleProofMaxSize`, `maxEpochBitmap`, `votingPowerVerifiedOnChain`
|
|
9
17
|
|
|
10
18
|
## What's New in v0.1.1
|
|
11
19
|
|
|
12
|
-
- Added security types for Phase 1-4
|
|
20
|
+
- Added security types for Phase 1-4 fixes
|
|
13
21
|
- New types: `SlashRequest`, `DecryptionShare`, `PendingScoreUpdate`
|
|
14
22
|
- All config types now support two-step authority transfer
|
|
15
23
|
- Added `SECURITY_CONSTANTS` for timelocks and limits
|
|
@@ -243,18 +251,25 @@ import {
|
|
|
243
251
|
FIVE_A_CONSTANTS,
|
|
244
252
|
GOVERNANCE_CONSTANTS,
|
|
245
253
|
CONTENT_CONSTANTS,
|
|
246
|
-
// Security constants
|
|
254
|
+
// Security constants
|
|
247
255
|
SECURITY_CONSTANTS,
|
|
248
256
|
VALID_URI_PREFIXES,
|
|
249
257
|
MERKLE_CONSTANTS,
|
|
258
|
+
// v0.1.2 additions
|
|
259
|
+
MERKLE_PROOF_MAX_SIZE, // 32 - prevents DoS
|
|
260
|
+
MAX_EPOCH_BITMAP, // 1023 - max epoch with bitmap
|
|
261
|
+
LEGACY_SLASH_DEPRECATED, // true - use propose_slash flow
|
|
250
262
|
} from "@viwoapp/sdk";
|
|
251
263
|
|
|
252
264
|
// Security constants
|
|
253
|
-
SECURITY_CONSTANTS.authorityTransferTimelock;
|
|
254
|
-
SECURITY_CONSTANTS.slashApprovalTimelock;
|
|
255
|
-
SECURITY_CONSTANTS.maxFeeSlippageBps;
|
|
256
|
-
SECURITY_CONSTANTS.oracleConsensusRequired;
|
|
257
|
-
SECURITY_CONSTANTS.circuitBreakerCooldown;
|
|
265
|
+
SECURITY_CONSTANTS.authorityTransferTimelock; // 24 hours
|
|
266
|
+
SECURITY_CONSTANTS.slashApprovalTimelock; // 48 hours
|
|
267
|
+
SECURITY_CONSTANTS.maxFeeSlippageBps; // 500 (5%)
|
|
268
|
+
SECURITY_CONSTANTS.oracleConsensusRequired; // 3-of-N
|
|
269
|
+
SECURITY_CONSTANTS.circuitBreakerCooldown; // 6 hours
|
|
270
|
+
SECURITY_CONSTANTS.merkleProofMaxSize; // 32 (v0.1.2)
|
|
271
|
+
SECURITY_CONSTANTS.maxEpochBitmap; // 1023 (v0.1.2)
|
|
272
|
+
SECURITY_CONSTANTS.votingPowerVerifiedOnChain; // true (v0.1.2)
|
|
258
273
|
```
|
|
259
274
|
|
|
260
275
|
## Types
|
|
@@ -271,6 +286,7 @@ import type {
|
|
|
271
286
|
Proposal,
|
|
272
287
|
VoteRecord,
|
|
273
288
|
ProposalStatus,
|
|
289
|
+
VoteChoice, // v0.1.2: Against, For, Abstain
|
|
274
290
|
GovernanceConfig,
|
|
275
291
|
Delegation,
|
|
276
292
|
PrivateVotingConfig,
|
package/dist/index.d.mts
CHANGED
|
@@ -176,12 +176,24 @@ declare const SECURITY_CONSTANTS: {
|
|
|
176
176
|
pendingScoreExpiry: number;
|
|
177
177
|
maxPlatformFeeBps: number;
|
|
178
178
|
minPlatformFeeBps: number;
|
|
179
|
+
merkleProofMaxSize: number;
|
|
180
|
+
maxEpochBitmap: number;
|
|
181
|
+
votingPowerVerifiedOnChain: boolean;
|
|
179
182
|
};
|
|
180
183
|
declare const VALID_URI_PREFIXES: readonly ["ipfs://", "https://", "ar://"];
|
|
181
184
|
declare const MAX_URI_LENGTH = 128;
|
|
182
185
|
declare const MERKLE_CONSTANTS: {
|
|
183
186
|
leafDomainPrefix: string;
|
|
184
187
|
};
|
|
188
|
+
/** Maximum Merkle proof size (H-NEW-02) - prevents DoS attacks */
|
|
189
|
+
declare const MERKLE_PROOF_MAX_SIZE = 32;
|
|
190
|
+
/** Maximum supported epoch number with bitmap storage (H-NEW-04) */
|
|
191
|
+
declare const MAX_EPOCH_BITMAP = 1023;
|
|
192
|
+
/**
|
|
193
|
+
* @deprecated The legacy slash_tokens function is disabled (C-NEW-02).
|
|
194
|
+
* Use propose_slash -> approve_slash -> execute_slash flow instead.
|
|
195
|
+
*/
|
|
196
|
+
declare const LEGACY_SLASH_DEPRECATED = true;
|
|
185
197
|
|
|
186
198
|
interface ConnectionConfig {
|
|
187
199
|
endpoint: string;
|
|
@@ -287,6 +299,7 @@ declare enum SlashStatus {
|
|
|
287
299
|
}
|
|
288
300
|
interface SlashRequest {
|
|
289
301
|
target: PublicKey;
|
|
302
|
+
requestId: BN;
|
|
290
303
|
amount: BN;
|
|
291
304
|
reason: Uint8Array;
|
|
292
305
|
proposer: PublicKey;
|
|
@@ -331,6 +344,15 @@ declare enum ProposalStatus {
|
|
|
331
344
|
Executed = 3,
|
|
332
345
|
Cancelled = 4
|
|
333
346
|
}
|
|
347
|
+
/**
|
|
348
|
+
* Vote choice for governance voting (v2.8.0 C-NEW-01)
|
|
349
|
+
* Voting power params are now read from on-chain state, not passed as parameters
|
|
350
|
+
*/
|
|
351
|
+
declare enum VoteChoice {
|
|
352
|
+
Against = 0,
|
|
353
|
+
For = 1,
|
|
354
|
+
Abstain = 2
|
|
355
|
+
}
|
|
334
356
|
interface Proposal {
|
|
335
357
|
id: BN;
|
|
336
358
|
proposer: PublicKey;
|
|
@@ -382,7 +404,7 @@ interface UserClaim {
|
|
|
382
404
|
claimsCount: number;
|
|
383
405
|
claimedEpochsBitmap?: BN[];
|
|
384
406
|
claimedEpochsBitmapExt?: BN[];
|
|
385
|
-
|
|
407
|
+
highEpochsBitmap?: BN[];
|
|
386
408
|
}
|
|
387
409
|
interface ClaimRewardsParams {
|
|
388
410
|
epoch: BN;
|
|
@@ -677,6 +699,13 @@ declare class GovernanceClient {
|
|
|
677
699
|
buildCreateProposalTransaction(params: CreateProposalParams): Promise<Transaction>;
|
|
678
700
|
/**
|
|
679
701
|
* Build vote transaction
|
|
702
|
+
*
|
|
703
|
+
* @note v2.8.0 (C-NEW-01): Voting power parameters (vevcoin_balance, five_a_score, tier)
|
|
704
|
+
* are now read from on-chain state, not passed as parameters. This prevents vote manipulation.
|
|
705
|
+
* The transaction only needs: proposal_id and choice (VoteChoice enum)
|
|
706
|
+
*
|
|
707
|
+
* @param proposalId - The proposal to vote on
|
|
708
|
+
* @param support - true = For, false = Against (use VoteChoice for more options)
|
|
680
709
|
*/
|
|
681
710
|
buildVoteTransaction(proposalId: BN, support: boolean): Promise<Transaction>;
|
|
682
711
|
/**
|
|
@@ -1323,4 +1352,4 @@ declare class StakingClient {
|
|
|
1323
1352
|
buildExtendLockTransaction(newDuration: number): Promise<Transaction>;
|
|
1324
1353
|
}
|
|
1325
1354
|
|
|
1326
|
-
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, LOCK_DURATIONS, MAX_URI_LENGTH, MERKLE_CONSTANTS, 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 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, type VoteRecord, type VouchRecord, type WalletAdapter, dateToTimestamp, formatVCoin, getCurrentTimestamp, parseVCoin, timestampToDate };
|
|
1355
|
+
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 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -176,12 +176,24 @@ declare const SECURITY_CONSTANTS: {
|
|
|
176
176
|
pendingScoreExpiry: number;
|
|
177
177
|
maxPlatformFeeBps: number;
|
|
178
178
|
minPlatformFeeBps: number;
|
|
179
|
+
merkleProofMaxSize: number;
|
|
180
|
+
maxEpochBitmap: number;
|
|
181
|
+
votingPowerVerifiedOnChain: boolean;
|
|
179
182
|
};
|
|
180
183
|
declare const VALID_URI_PREFIXES: readonly ["ipfs://", "https://", "ar://"];
|
|
181
184
|
declare const MAX_URI_LENGTH = 128;
|
|
182
185
|
declare const MERKLE_CONSTANTS: {
|
|
183
186
|
leafDomainPrefix: string;
|
|
184
187
|
};
|
|
188
|
+
/** Maximum Merkle proof size (H-NEW-02) - prevents DoS attacks */
|
|
189
|
+
declare const MERKLE_PROOF_MAX_SIZE = 32;
|
|
190
|
+
/** Maximum supported epoch number with bitmap storage (H-NEW-04) */
|
|
191
|
+
declare const MAX_EPOCH_BITMAP = 1023;
|
|
192
|
+
/**
|
|
193
|
+
* @deprecated The legacy slash_tokens function is disabled (C-NEW-02).
|
|
194
|
+
* Use propose_slash -> approve_slash -> execute_slash flow instead.
|
|
195
|
+
*/
|
|
196
|
+
declare const LEGACY_SLASH_DEPRECATED = true;
|
|
185
197
|
|
|
186
198
|
interface ConnectionConfig {
|
|
187
199
|
endpoint: string;
|
|
@@ -287,6 +299,7 @@ declare enum SlashStatus {
|
|
|
287
299
|
}
|
|
288
300
|
interface SlashRequest {
|
|
289
301
|
target: PublicKey;
|
|
302
|
+
requestId: BN;
|
|
290
303
|
amount: BN;
|
|
291
304
|
reason: Uint8Array;
|
|
292
305
|
proposer: PublicKey;
|
|
@@ -331,6 +344,15 @@ declare enum ProposalStatus {
|
|
|
331
344
|
Executed = 3,
|
|
332
345
|
Cancelled = 4
|
|
333
346
|
}
|
|
347
|
+
/**
|
|
348
|
+
* Vote choice for governance voting (v2.8.0 C-NEW-01)
|
|
349
|
+
* Voting power params are now read from on-chain state, not passed as parameters
|
|
350
|
+
*/
|
|
351
|
+
declare enum VoteChoice {
|
|
352
|
+
Against = 0,
|
|
353
|
+
For = 1,
|
|
354
|
+
Abstain = 2
|
|
355
|
+
}
|
|
334
356
|
interface Proposal {
|
|
335
357
|
id: BN;
|
|
336
358
|
proposer: PublicKey;
|
|
@@ -382,7 +404,7 @@ interface UserClaim {
|
|
|
382
404
|
claimsCount: number;
|
|
383
405
|
claimedEpochsBitmap?: BN[];
|
|
384
406
|
claimedEpochsBitmapExt?: BN[];
|
|
385
|
-
|
|
407
|
+
highEpochsBitmap?: BN[];
|
|
386
408
|
}
|
|
387
409
|
interface ClaimRewardsParams {
|
|
388
410
|
epoch: BN;
|
|
@@ -677,6 +699,13 @@ declare class GovernanceClient {
|
|
|
677
699
|
buildCreateProposalTransaction(params: CreateProposalParams): Promise<Transaction>;
|
|
678
700
|
/**
|
|
679
701
|
* Build vote transaction
|
|
702
|
+
*
|
|
703
|
+
* @note v2.8.0 (C-NEW-01): Voting power parameters (vevcoin_balance, five_a_score, tier)
|
|
704
|
+
* are now read from on-chain state, not passed as parameters. This prevents vote manipulation.
|
|
705
|
+
* The transaction only needs: proposal_id and choice (VoteChoice enum)
|
|
706
|
+
*
|
|
707
|
+
* @param proposalId - The proposal to vote on
|
|
708
|
+
* @param support - true = For, false = Against (use VoteChoice for more options)
|
|
680
709
|
*/
|
|
681
710
|
buildVoteTransaction(proposalId: BN, support: boolean): Promise<Transaction>;
|
|
682
711
|
/**
|
|
@@ -1323,4 +1352,4 @@ declare class StakingClient {
|
|
|
1323
1352
|
buildExtendLockTransaction(newDuration: number): Promise<Transaction>;
|
|
1324
1353
|
}
|
|
1325
1354
|
|
|
1326
|
-
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, LOCK_DURATIONS, MAX_URI_LENGTH, MERKLE_CONSTANTS, 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 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, type VoteRecord, type VouchRecord, type WalletAdapter, dateToTimestamp, formatVCoin, getCurrentTimestamp, parseVCoin, timestampToDate };
|
|
1355
|
+
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 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 };
|
package/dist/index.js
CHANGED
|
@@ -34,9 +34,12 @@ __export(index_exports, {
|
|
|
34
34
|
GaslessClient: () => GaslessClient,
|
|
35
35
|
GovernanceClient: () => GovernanceClient,
|
|
36
36
|
IdentityClient: () => IdentityClient,
|
|
37
|
+
LEGACY_SLASH_DEPRECATED: () => LEGACY_SLASH_DEPRECATED,
|
|
37
38
|
LOCK_DURATIONS: () => LOCK_DURATIONS,
|
|
39
|
+
MAX_EPOCH_BITMAP: () => MAX_EPOCH_BITMAP,
|
|
38
40
|
MAX_URI_LENGTH: () => MAX_URI_LENGTH,
|
|
39
41
|
MERKLE_CONSTANTS: () => MERKLE_CONSTANTS,
|
|
42
|
+
MERKLE_PROOF_MAX_SIZE: () => MERKLE_PROOF_MAX_SIZE,
|
|
40
43
|
PDAs: () => PDAs,
|
|
41
44
|
PROGRAM_IDS: () => PROGRAM_IDS,
|
|
42
45
|
ProposalStatus: () => ProposalStatus,
|
|
@@ -59,6 +62,7 @@ __export(index_exports, {
|
|
|
59
62
|
ViLinkClient: () => ViLinkClient,
|
|
60
63
|
ViWoClient: () => ViWoClient,
|
|
61
64
|
ViWoConnection: () => ViWoConnection,
|
|
65
|
+
VoteChoice: () => VoteChoice,
|
|
62
66
|
dateToTimestamp: () => dateToTimestamp,
|
|
63
67
|
formatVCoin: () => formatVCoin,
|
|
64
68
|
getCurrentTimestamp: () => getCurrentTimestamp,
|
|
@@ -288,8 +292,15 @@ var SECURITY_CONSTANTS = {
|
|
|
288
292
|
// M-02: Platform fee bounds (ViLink)
|
|
289
293
|
maxPlatformFeeBps: 1e3,
|
|
290
294
|
// 10% max
|
|
291
|
-
minPlatformFeeBps: 10
|
|
295
|
+
minPlatformFeeBps: 10,
|
|
292
296
|
// 0.1% min
|
|
297
|
+
// v2.8.0 Phase 5 additions
|
|
298
|
+
merkleProofMaxSize: 32,
|
|
299
|
+
// H-NEW-02: Max proof levels (supports 4B+ users)
|
|
300
|
+
maxEpochBitmap: 1023,
|
|
301
|
+
// H-NEW-04: Max epoch with bitmap storage (85+ years)
|
|
302
|
+
votingPowerVerifiedOnChain: true
|
|
303
|
+
// C-NEW-01: Params read from chain, not passed
|
|
293
304
|
};
|
|
294
305
|
var VALID_URI_PREFIXES = ["ipfs://", "https://", "ar://"];
|
|
295
306
|
var MAX_URI_LENGTH = 128;
|
|
@@ -297,6 +308,9 @@ var MERKLE_CONSTANTS = {
|
|
|
297
308
|
leafDomainPrefix: "SSCRE_CLAIM_V1"
|
|
298
309
|
// Domain separation for merkle leaves
|
|
299
310
|
};
|
|
311
|
+
var MERKLE_PROOF_MAX_SIZE = 32;
|
|
312
|
+
var MAX_EPOCH_BITMAP = 1023;
|
|
313
|
+
var LEGACY_SLASH_DEPRECATED = true;
|
|
300
314
|
|
|
301
315
|
// src/core/index.ts
|
|
302
316
|
var ViWoConnection = class {
|
|
@@ -588,6 +602,12 @@ var ProposalStatus = /* @__PURE__ */ ((ProposalStatus2) => {
|
|
|
588
602
|
ProposalStatus2[ProposalStatus2["Cancelled"] = 4] = "Cancelled";
|
|
589
603
|
return ProposalStatus2;
|
|
590
604
|
})(ProposalStatus || {});
|
|
605
|
+
var VoteChoice = /* @__PURE__ */ ((VoteChoice2) => {
|
|
606
|
+
VoteChoice2[VoteChoice2["Against"] = 0] = "Against";
|
|
607
|
+
VoteChoice2[VoteChoice2["For"] = 1] = "For";
|
|
608
|
+
VoteChoice2[VoteChoice2["Abstain"] = 2] = "Abstain";
|
|
609
|
+
return VoteChoice2;
|
|
610
|
+
})(VoteChoice || {});
|
|
591
611
|
var ActionType = /* @__PURE__ */ ((ActionType2) => {
|
|
592
612
|
ActionType2[ActionType2["Tip"] = 0] = "Tip";
|
|
593
613
|
ActionType2[ActionType2["Vouch"] = 1] = "Vouch";
|
|
@@ -988,6 +1008,13 @@ var GovernanceClient = class {
|
|
|
988
1008
|
}
|
|
989
1009
|
/**
|
|
990
1010
|
* Build vote transaction
|
|
1011
|
+
*
|
|
1012
|
+
* @note v2.8.0 (C-NEW-01): Voting power parameters (vevcoin_balance, five_a_score, tier)
|
|
1013
|
+
* are now read from on-chain state, not passed as parameters. This prevents vote manipulation.
|
|
1014
|
+
* The transaction only needs: proposal_id and choice (VoteChoice enum)
|
|
1015
|
+
*
|
|
1016
|
+
* @param proposalId - The proposal to vote on
|
|
1017
|
+
* @param support - true = For, false = Against (use VoteChoice for more options)
|
|
991
1018
|
*/
|
|
992
1019
|
async buildVoteTransaction(proposalId, support) {
|
|
993
1020
|
if (!this.client.publicKey) {
|
|
@@ -998,6 +1025,7 @@ var GovernanceClient = class {
|
|
|
998
1025
|
throw new Error("Already voted on this proposal");
|
|
999
1026
|
}
|
|
1000
1027
|
const tx = new import_web34.Transaction();
|
|
1028
|
+
const choice = support ? 1 /* For */ : 0 /* Against */;
|
|
1001
1029
|
return tx;
|
|
1002
1030
|
}
|
|
1003
1031
|
/**
|
|
@@ -2390,9 +2418,12 @@ var ViWoClient = class {
|
|
|
2390
2418
|
GaslessClient,
|
|
2391
2419
|
GovernanceClient,
|
|
2392
2420
|
IdentityClient,
|
|
2421
|
+
LEGACY_SLASH_DEPRECATED,
|
|
2393
2422
|
LOCK_DURATIONS,
|
|
2423
|
+
MAX_EPOCH_BITMAP,
|
|
2394
2424
|
MAX_URI_LENGTH,
|
|
2395
2425
|
MERKLE_CONSTANTS,
|
|
2426
|
+
MERKLE_PROOF_MAX_SIZE,
|
|
2396
2427
|
PDAs,
|
|
2397
2428
|
PROGRAM_IDS,
|
|
2398
2429
|
ProposalStatus,
|
|
@@ -2415,6 +2446,7 @@ var ViWoClient = class {
|
|
|
2415
2446
|
ViLinkClient,
|
|
2416
2447
|
ViWoClient,
|
|
2417
2448
|
ViWoConnection,
|
|
2449
|
+
VoteChoice,
|
|
2418
2450
|
dateToTimestamp,
|
|
2419
2451
|
formatVCoin,
|
|
2420
2452
|
getCurrentTimestamp,
|
package/dist/index.mjs
CHANGED
|
@@ -223,8 +223,15 @@ var SECURITY_CONSTANTS = {
|
|
|
223
223
|
// M-02: Platform fee bounds (ViLink)
|
|
224
224
|
maxPlatformFeeBps: 1e3,
|
|
225
225
|
// 10% max
|
|
226
|
-
minPlatformFeeBps: 10
|
|
226
|
+
minPlatformFeeBps: 10,
|
|
227
227
|
// 0.1% min
|
|
228
|
+
// v2.8.0 Phase 5 additions
|
|
229
|
+
merkleProofMaxSize: 32,
|
|
230
|
+
// H-NEW-02: Max proof levels (supports 4B+ users)
|
|
231
|
+
maxEpochBitmap: 1023,
|
|
232
|
+
// H-NEW-04: Max epoch with bitmap storage (85+ years)
|
|
233
|
+
votingPowerVerifiedOnChain: true
|
|
234
|
+
// C-NEW-01: Params read from chain, not passed
|
|
228
235
|
};
|
|
229
236
|
var VALID_URI_PREFIXES = ["ipfs://", "https://", "ar://"];
|
|
230
237
|
var MAX_URI_LENGTH = 128;
|
|
@@ -232,6 +239,9 @@ var MERKLE_CONSTANTS = {
|
|
|
232
239
|
leafDomainPrefix: "SSCRE_CLAIM_V1"
|
|
233
240
|
// Domain separation for merkle leaves
|
|
234
241
|
};
|
|
242
|
+
var MERKLE_PROOF_MAX_SIZE = 32;
|
|
243
|
+
var MAX_EPOCH_BITMAP = 1023;
|
|
244
|
+
var LEGACY_SLASH_DEPRECATED = true;
|
|
235
245
|
|
|
236
246
|
// src/core/index.ts
|
|
237
247
|
var ViWoConnection = class {
|
|
@@ -523,6 +533,12 @@ var ProposalStatus = /* @__PURE__ */ ((ProposalStatus2) => {
|
|
|
523
533
|
ProposalStatus2[ProposalStatus2["Cancelled"] = 4] = "Cancelled";
|
|
524
534
|
return ProposalStatus2;
|
|
525
535
|
})(ProposalStatus || {});
|
|
536
|
+
var VoteChoice = /* @__PURE__ */ ((VoteChoice2) => {
|
|
537
|
+
VoteChoice2[VoteChoice2["Against"] = 0] = "Against";
|
|
538
|
+
VoteChoice2[VoteChoice2["For"] = 1] = "For";
|
|
539
|
+
VoteChoice2[VoteChoice2["Abstain"] = 2] = "Abstain";
|
|
540
|
+
return VoteChoice2;
|
|
541
|
+
})(VoteChoice || {});
|
|
526
542
|
var ActionType = /* @__PURE__ */ ((ActionType2) => {
|
|
527
543
|
ActionType2[ActionType2["Tip"] = 0] = "Tip";
|
|
528
544
|
ActionType2[ActionType2["Vouch"] = 1] = "Vouch";
|
|
@@ -923,6 +939,13 @@ var GovernanceClient = class {
|
|
|
923
939
|
}
|
|
924
940
|
/**
|
|
925
941
|
* Build vote transaction
|
|
942
|
+
*
|
|
943
|
+
* @note v2.8.0 (C-NEW-01): Voting power parameters (vevcoin_balance, five_a_score, tier)
|
|
944
|
+
* are now read from on-chain state, not passed as parameters. This prevents vote manipulation.
|
|
945
|
+
* The transaction only needs: proposal_id and choice (VoteChoice enum)
|
|
946
|
+
*
|
|
947
|
+
* @param proposalId - The proposal to vote on
|
|
948
|
+
* @param support - true = For, false = Against (use VoteChoice for more options)
|
|
926
949
|
*/
|
|
927
950
|
async buildVoteTransaction(proposalId, support) {
|
|
928
951
|
if (!this.client.publicKey) {
|
|
@@ -933,6 +956,7 @@ var GovernanceClient = class {
|
|
|
933
956
|
throw new Error("Already voted on this proposal");
|
|
934
957
|
}
|
|
935
958
|
const tx = new Transaction3();
|
|
959
|
+
const choice = support ? 1 /* For */ : 0 /* Against */;
|
|
936
960
|
return tx;
|
|
937
961
|
}
|
|
938
962
|
/**
|
|
@@ -2324,9 +2348,12 @@ export {
|
|
|
2324
2348
|
GaslessClient,
|
|
2325
2349
|
GovernanceClient,
|
|
2326
2350
|
IdentityClient,
|
|
2351
|
+
LEGACY_SLASH_DEPRECATED,
|
|
2327
2352
|
LOCK_DURATIONS,
|
|
2353
|
+
MAX_EPOCH_BITMAP,
|
|
2328
2354
|
MAX_URI_LENGTH,
|
|
2329
2355
|
MERKLE_CONSTANTS,
|
|
2356
|
+
MERKLE_PROOF_MAX_SIZE,
|
|
2330
2357
|
PDAs,
|
|
2331
2358
|
PROGRAM_IDS,
|
|
2332
2359
|
ProposalStatus,
|
|
@@ -2349,6 +2376,7 @@ export {
|
|
|
2349
2376
|
ViLinkClient,
|
|
2350
2377
|
ViWoClient,
|
|
2351
2378
|
ViWoConnection,
|
|
2379
|
+
VoteChoice,
|
|
2352
2380
|
dateToTimestamp,
|
|
2353
2381
|
formatVCoin,
|
|
2354
2382
|
getCurrentTimestamp,
|