@revealui/services 0.1.0 → 0.2.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.
Files changed (49) hide show
  1. package/dist/api/handlers/subscription-handlers.d.ts +5 -1
  2. package/dist/api/handlers/subscription-handlers.d.ts.map +1 -1
  3. package/dist/api/handlers/subscription-handlers.js +5 -1
  4. package/dist/api/handlers/subscription-handlers.js.map +1 -1
  5. package/dist/api/webhooks/index.d.ts +10 -0
  6. package/dist/api/webhooks/index.d.ts.map +1 -1
  7. package/dist/api/webhooks/index.js +10 -0
  8. package/dist/api/webhooks/index.js.map +1 -1
  9. package/dist/index.d.ts +1 -0
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +1 -0
  12. package/dist/index.js.map +1 -1
  13. package/dist/revealcoin/__tests__/client.test.d.ts +2 -0
  14. package/dist/revealcoin/__tests__/client.test.d.ts.map +1 -0
  15. package/dist/revealcoin/__tests__/client.test.js +207 -0
  16. package/dist/revealcoin/__tests__/client.test.js.map +1 -0
  17. package/dist/revealcoin/__tests__/config.test.d.ts +2 -0
  18. package/dist/revealcoin/__tests__/config.test.d.ts.map +1 -0
  19. package/dist/revealcoin/__tests__/config.test.js +91 -0
  20. package/dist/revealcoin/__tests__/config.test.js.map +1 -0
  21. package/dist/revealcoin/__tests__/oracle.test.d.ts +2 -0
  22. package/dist/revealcoin/__tests__/oracle.test.d.ts.map +1 -0
  23. package/dist/revealcoin/__tests__/oracle.test.js +238 -0
  24. package/dist/revealcoin/__tests__/oracle.test.js.map +1 -0
  25. package/dist/revealcoin/__tests__/safeguards.test.d.ts +2 -0
  26. package/dist/revealcoin/__tests__/safeguards.test.d.ts.map +1 -0
  27. package/dist/revealcoin/__tests__/safeguards.test.js +571 -0
  28. package/dist/revealcoin/__tests__/safeguards.test.js.map +1 -0
  29. package/dist/revealcoin/client.d.ts +51 -0
  30. package/dist/revealcoin/client.d.ts.map +1 -0
  31. package/dist/revealcoin/client.js +211 -0
  32. package/dist/revealcoin/client.js.map +1 -0
  33. package/dist/revealcoin/config.d.ts +32 -0
  34. package/dist/revealcoin/config.d.ts.map +1 -0
  35. package/dist/revealcoin/config.js +54 -0
  36. package/dist/revealcoin/config.js.map +1 -0
  37. package/dist/revealcoin/index.d.ts +5 -0
  38. package/dist/revealcoin/index.d.ts.map +1 -0
  39. package/dist/revealcoin/index.js +5 -0
  40. package/dist/revealcoin/index.js.map +1 -0
  41. package/dist/revealcoin/oracle.d.ts +81 -0
  42. package/dist/revealcoin/oracle.d.ts.map +1 -0
  43. package/dist/revealcoin/oracle.js +211 -0
  44. package/dist/revealcoin/oracle.js.map +1 -0
  45. package/dist/revealcoin/safeguards.d.ts +92 -0
  46. package/dist/revealcoin/safeguards.d.ts.map +1 -0
  47. package/dist/revealcoin/safeguards.js +240 -0
  48. package/dist/revealcoin/safeguards.js.map +1 -0
  49. package/package.json +9 -3
@@ -0,0 +1,92 @@
1
+ /**
2
+ * RevealCoin Anti-Manipulation Safeguards
3
+ *
4
+ * Prevents pump-and-dump schemes, arbitrage exploitation, and payment
5
+ * fraud through configurable rate limits, price circuit breakers, and
6
+ * transaction validation rules.
7
+ *
8
+ * All thresholds are parameterized per monorepo convention.
9
+ */
10
+ export interface RevealCoinSafeguardsConfig {
11
+ /** TWAP window in milliseconds. Default: 3_600_000 (1 hour) */
12
+ twapWindowMs: number;
13
+ /** Price drop threshold (0–1) to trigger circuit breaker. Default: 0.30 (30%) */
14
+ priceCircuitBreakerThreshold: number;
15
+ /** Recovery check interval after circuit breaker trips. Default: 3_600_000 (1 hour) */
16
+ priceRecoveryCheckMs: number;
17
+ /** Max RVUI payments per wallet per hour. Default: 3 */
18
+ maxPaymentsPerWalletPerHour: number;
19
+ /** Max single payment in USD equivalent. Default: 500 */
20
+ maxSinglePaymentUsd: number;
21
+ /** Minimum token hold period in milliseconds. Default: 86_400_000 (24 hours) */
22
+ minHoldPeriodMs: number;
23
+ /** Max monthly discount savings per user in USD. Default: 100 */
24
+ maxMonthlyDiscountUsd: number;
25
+ }
26
+ export declare function configureSafeguards(overrides: Partial<RevealCoinSafeguardsConfig>): void;
27
+ export declare function getSafeguardsConfig(): RevealCoinSafeguardsConfig;
28
+ export declare function resetSafeguardsConfig(): void;
29
+ /**
30
+ * Calculate the time-weighted average price of RVUI in USD over the configured window.
31
+ *
32
+ * Uses price snapshots stored in the database. Returns null if insufficient
33
+ * data is available (fewer than 2 snapshots in the window).
34
+ */
35
+ export declare function getTwapPrice(): Promise<number | null>;
36
+ /**
37
+ * Check if the price circuit breaker should block RVUI payments.
38
+ *
39
+ * Compares the latest snapshot price to the TWAP. If the latest price
40
+ * has dropped more than the threshold below the TWAP, payments are blocked.
41
+ */
42
+ export declare function isPriceCircuitBreakerOpen(): Promise<boolean>;
43
+ /**
44
+ * Check if a wallet has exceeded the per-hour payment rate limit.
45
+ */
46
+ export declare function isWalletRateLimited(walletAddress: string): Promise<boolean>;
47
+ /**
48
+ * Check if a user has exceeded their monthly discount savings cap.
49
+ */
50
+ export declare function isDiscountCapExceeded(userId: string): Promise<boolean>;
51
+ /**
52
+ * Check if a transaction signature has already been recorded.
53
+ */
54
+ export declare function isDuplicateTransaction(txSignature: string): Promise<boolean>;
55
+ /**
56
+ * Check if a payment amount exceeds the single-transaction USD cap.
57
+ */
58
+ export declare function isPaymentOverMaximum(amountUsd: number): boolean;
59
+ export interface SafeguardCheckResult {
60
+ allowed: boolean;
61
+ reason?: string;
62
+ }
63
+ /**
64
+ * Run all safeguard checks for an incoming RVUI payment.
65
+ *
66
+ * Returns `{ allowed: true }` if all checks pass, or `{ allowed: false, reason }`
67
+ * with the first failing check's reason.
68
+ */
69
+ export declare function validatePayment(params: {
70
+ walletAddress: string;
71
+ userId: string;
72
+ txSignature: string;
73
+ amountUsd: number;
74
+ }): Promise<SafeguardCheckResult>;
75
+ /**
76
+ * Record a price snapshot for TWAP calculation.
77
+ * Called periodically by a cron job or price feed listener.
78
+ */
79
+ export declare function recordPriceSnapshot(priceUsd: number, source: string): Promise<void>;
80
+ /**
81
+ * Record a verified RVUI payment in the database.
82
+ */
83
+ export declare function recordPayment(params: {
84
+ txSignature: string;
85
+ walletAddress: string;
86
+ userId: string;
87
+ amountRvui: string;
88
+ amountUsd: number;
89
+ discountUsd: number;
90
+ purpose: string;
91
+ }): Promise<void>;
92
+ //# sourceMappingURL=safeguards.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"safeguards.d.ts","sourceRoot":"","sources":["../../src/revealcoin/safeguards.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAgBH,MAAM,WAAW,0BAA0B;IACzC,+DAA+D;IAC/D,YAAY,EAAE,MAAM,CAAC;IACrB,iFAAiF;IACjF,4BAA4B,EAAE,MAAM,CAAC;IACrC,uFAAuF;IACvF,oBAAoB,EAAE,MAAM,CAAC;IAC7B,wDAAwD;IACxD,2BAA2B,EAAE,MAAM,CAAC;IACpC,yDAAyD;IACzD,mBAAmB,EAAE,MAAM,CAAC;IAC5B,gFAAgF;IAChF,eAAe,EAAE,MAAM,CAAC;IACxB,iEAAiE;IACjE,qBAAqB,EAAE,MAAM,CAAC;CAC/B;AAcD,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,OAAO,CAAC,0BAA0B,CAAC,GAAG,IAAI,CAExF;AAED,wBAAgB,mBAAmB,IAAI,0BAA0B,CAEhE;AAED,wBAAgB,qBAAqB,IAAI,IAAI,CAE5C;AAMD;;;;;GAKG;AACH,wBAAsB,YAAY,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAiC3D;AAMD;;;;;GAKG;AACH,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,OAAO,CAAC,CA4BlE;AAMD;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAgBjF;AAMD;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAkB5E;AAMD;;GAEG;AACH,wBAAsB,sBAAsB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAUlF;AAMD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAE/D;AAMD,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,MAAM,EAAE;IAC5C,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAoChC;AAMD;;;GAGG;AACH,wBAAsB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAQzF;AAMD;;GAEG;AACH,wBAAsB,aAAa,CAAC,MAAM,EAAE;IAC1C,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB,GAAG,OAAO,CAAC,IAAI,CAAC,CAchB"}
@@ -0,0 +1,240 @@
1
+ /**
2
+ * RevealCoin Anti-Manipulation Safeguards
3
+ *
4
+ * Prevents pump-and-dump schemes, arbitrage exploitation, and payment
5
+ * fraud through configurable rate limits, price circuit breakers, and
6
+ * transaction validation rules.
7
+ *
8
+ * All thresholds are parameterized per monorepo convention.
9
+ */
10
+ import { createLogger } from '@revealui/core/observability/logger';
11
+ import { getClient } from '@revealui/db';
12
+ import { revealcoinPayments, revealcoinPriceSnapshots, } from '@revealui/db/schema';
13
+ import { and, desc, eq, gte, sql } from 'drizzle-orm';
14
+ const logger = createLogger({ service: 'RevealCoin:Safeguards' });
15
+ const DEFAULT_CONFIG = {
16
+ twapWindowMs: 3_600_000,
17
+ priceCircuitBreakerThreshold: 0.30,
18
+ priceRecoveryCheckMs: 3_600_000,
19
+ maxPaymentsPerWalletPerHour: 3,
20
+ maxSinglePaymentUsd: 500,
21
+ minHoldPeriodMs: 86_400_000,
22
+ maxMonthlyDiscountUsd: 100,
23
+ };
24
+ let config = { ...DEFAULT_CONFIG };
25
+ export function configureSafeguards(overrides) {
26
+ config = { ...DEFAULT_CONFIG, ...overrides };
27
+ }
28
+ export function getSafeguardsConfig() {
29
+ return { ...config };
30
+ }
31
+ export function resetSafeguardsConfig() {
32
+ config = { ...DEFAULT_CONFIG };
33
+ }
34
+ // =============================================================================
35
+ // TWAP Price Oracle
36
+ // =============================================================================
37
+ /**
38
+ * Calculate the time-weighted average price of RVUI in USD over the configured window.
39
+ *
40
+ * Uses price snapshots stored in the database. Returns null if insufficient
41
+ * data is available (fewer than 2 snapshots in the window).
42
+ */
43
+ export async function getTwapPrice() {
44
+ const db = getClient();
45
+ const windowStart = new Date(Date.now() - config.twapWindowMs);
46
+ const snapshots = await db
47
+ .select()
48
+ .from(revealcoinPriceSnapshots)
49
+ .where(gte(revealcoinPriceSnapshots.recordedAt, windowStart))
50
+ .orderBy(revealcoinPriceSnapshots.recordedAt);
51
+ if (snapshots.length < 2) {
52
+ logger.warn('Insufficient price snapshots for TWAP calculation', {
53
+ snapshotCount: snapshots.length,
54
+ windowMs: config.twapWindowMs,
55
+ });
56
+ return null;
57
+ }
58
+ // Time-weighted average: sum(price_i * duration_i) / total_duration
59
+ let weightedSum = 0;
60
+ let totalDuration = 0;
61
+ for (let i = 0; i < snapshots.length - 1; i++) {
62
+ const current = snapshots[i];
63
+ const next = snapshots[i + 1];
64
+ const duration = next.recordedAt.getTime() - current.recordedAt.getTime();
65
+ const price = Number(current.priceUsd);
66
+ weightedSum += price * duration;
67
+ totalDuration += duration;
68
+ }
69
+ if (totalDuration === 0)
70
+ return null;
71
+ return weightedSum / totalDuration;
72
+ }
73
+ // =============================================================================
74
+ // Price Circuit Breaker
75
+ // =============================================================================
76
+ /**
77
+ * Check if the price circuit breaker should block RVUI payments.
78
+ *
79
+ * Compares the latest snapshot price to the TWAP. If the latest price
80
+ * has dropped more than the threshold below the TWAP, payments are blocked.
81
+ */
82
+ export async function isPriceCircuitBreakerOpen() {
83
+ const db = getClient();
84
+ const [latest] = await db
85
+ .select()
86
+ .from(revealcoinPriceSnapshots)
87
+ .orderBy(desc(revealcoinPriceSnapshots.recordedAt))
88
+ .limit(1);
89
+ if (!latest)
90
+ return true; // No price data — block payments
91
+ const twap = await getTwapPrice();
92
+ if (twap === null)
93
+ return true; // Insufficient data — block payments
94
+ const currentPrice = Number(latest.priceUsd);
95
+ const dropPercent = (twap - currentPrice) / twap;
96
+ if (dropPercent >= config.priceCircuitBreakerThreshold) {
97
+ logger.warn('RVUI price circuit breaker OPEN — price drop exceeds threshold', {
98
+ twap,
99
+ currentPrice,
100
+ dropPercent: `${(dropPercent * 100).toFixed(1)}%`,
101
+ threshold: `${(config.priceCircuitBreakerThreshold * 100).toFixed(0)}%`,
102
+ });
103
+ return true;
104
+ }
105
+ return false;
106
+ }
107
+ // =============================================================================
108
+ // Rate Limiting
109
+ // =============================================================================
110
+ /**
111
+ * Check if a wallet has exceeded the per-hour payment rate limit.
112
+ */
113
+ export async function isWalletRateLimited(walletAddress) {
114
+ const db = getClient();
115
+ const oneHourAgo = new Date(Date.now() - 3_600_000);
116
+ const [result] = await db
117
+ .select({ count: sql `count(*)::int` })
118
+ .from(revealcoinPayments)
119
+ .where(and(eq(revealcoinPayments.walletAddress, walletAddress), gte(revealcoinPayments.createdAt, oneHourAgo)));
120
+ const count = result?.count ?? 0;
121
+ return count >= config.maxPaymentsPerWalletPerHour;
122
+ }
123
+ // =============================================================================
124
+ // Discount Abuse Prevention
125
+ // =============================================================================
126
+ /**
127
+ * Check if a user has exceeded their monthly discount savings cap.
128
+ */
129
+ export async function isDiscountCapExceeded(userId) {
130
+ const db = getClient();
131
+ const monthStart = new Date();
132
+ monthStart.setDate(1);
133
+ monthStart.setHours(0, 0, 0, 0);
134
+ const [result] = await db
135
+ .select({ total: sql `coalesce(sum(${revealcoinPayments.discountUsd}), 0)::numeric` })
136
+ .from(revealcoinPayments)
137
+ .where(and(eq(revealcoinPayments.userId, userId), gte(revealcoinPayments.createdAt, monthStart)));
138
+ const totalDiscount = Number(result?.total ?? 0);
139
+ return totalDiscount >= config.maxMonthlyDiscountUsd;
140
+ }
141
+ // =============================================================================
142
+ // Duplicate Transaction Rejection
143
+ // =============================================================================
144
+ /**
145
+ * Check if a transaction signature has already been recorded.
146
+ */
147
+ export async function isDuplicateTransaction(txSignature) {
148
+ const db = getClient();
149
+ const [existing] = await db
150
+ .select({ id: revealcoinPayments.id })
151
+ .from(revealcoinPayments)
152
+ .where(eq(revealcoinPayments.txSignature, txSignature))
153
+ .limit(1);
154
+ return existing !== undefined;
155
+ }
156
+ // =============================================================================
157
+ // Payment Amount Validation
158
+ // =============================================================================
159
+ /**
160
+ * Check if a payment amount exceeds the single-transaction USD cap.
161
+ */
162
+ export function isPaymentOverMaximum(amountUsd) {
163
+ return amountUsd > config.maxSinglePaymentUsd;
164
+ }
165
+ /**
166
+ * Run all safeguard checks for an incoming RVUI payment.
167
+ *
168
+ * Returns `{ allowed: true }` if all checks pass, or `{ allowed: false, reason }`
169
+ * with the first failing check's reason.
170
+ */
171
+ export async function validatePayment(params) {
172
+ // 1. Duplicate transaction
173
+ if (await isDuplicateTransaction(params.txSignature)) {
174
+ return { allowed: false, reason: 'Transaction signature already used' };
175
+ }
176
+ // 2. Price circuit breaker
177
+ if (await isPriceCircuitBreakerOpen()) {
178
+ return { allowed: false, reason: 'RVUI payments temporarily disabled due to price volatility' };
179
+ }
180
+ // 3. Single payment cap
181
+ if (isPaymentOverMaximum(params.amountUsd)) {
182
+ return {
183
+ allowed: false,
184
+ reason: `Payment exceeds maximum of $${config.maxSinglePaymentUsd} USD. Use fiat for larger amounts.`,
185
+ };
186
+ }
187
+ // 4. Wallet rate limit
188
+ if (await isWalletRateLimited(params.walletAddress)) {
189
+ return {
190
+ allowed: false,
191
+ reason: `Wallet rate limit exceeded (max ${config.maxPaymentsPerWalletPerHour} payments/hour)`,
192
+ };
193
+ }
194
+ // 5. Monthly discount cap
195
+ if (await isDiscountCapExceeded(params.userId)) {
196
+ return {
197
+ allowed: false,
198
+ reason: `Monthly RVUI discount cap of $${config.maxMonthlyDiscountUsd} reached`,
199
+ };
200
+ }
201
+ return { allowed: true };
202
+ }
203
+ // =============================================================================
204
+ // Price Snapshot Recording
205
+ // =============================================================================
206
+ /**
207
+ * Record a price snapshot for TWAP calculation.
208
+ * Called periodically by a cron job or price feed listener.
209
+ */
210
+ export async function recordPriceSnapshot(priceUsd, source) {
211
+ const db = getClient();
212
+ await db.insert(revealcoinPriceSnapshots).values({
213
+ id: crypto.randomUUID(),
214
+ priceUsd: String(priceUsd),
215
+ source,
216
+ recordedAt: new Date(),
217
+ });
218
+ }
219
+ // =============================================================================
220
+ // Payment Recording
221
+ // =============================================================================
222
+ /**
223
+ * Record a verified RVUI payment in the database.
224
+ */
225
+ export async function recordPayment(params) {
226
+ const db = getClient();
227
+ await db.insert(revealcoinPayments).values({
228
+ id: crypto.randomUUID(),
229
+ txSignature: params.txSignature,
230
+ walletAddress: params.walletAddress,
231
+ userId: params.userId,
232
+ amountRvui: params.amountRvui,
233
+ amountUsd: String(params.amountUsd),
234
+ discountUsd: String(params.discountUsd),
235
+ purpose: params.purpose,
236
+ status: 'verified',
237
+ createdAt: new Date(),
238
+ });
239
+ }
240
+ //# sourceMappingURL=safeguards.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"safeguards.js","sourceRoot":"","sources":["../../src/revealcoin/safeguards.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,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AAM,CAAC,OAAO;QACvB,MAAM,EAAE,UAAU;QAClB,SAAS,EAAE,IAAI,IAAI,EAAE;KACtB,CAAC,CAAC;AACL,CAAC"}
package/package.json CHANGED
@@ -1,17 +1,19 @@
1
1
  {
2
2
  "name": "@revealui/services",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "[Pro] External service integrations for RevealUI — Stripe, Supabase, and Vercel",
5
5
  "license": "SEE LICENSE IN ../../LICENSE.commercial",
6
6
  "dependencies": {
7
7
  "@supabase/ssr": "^0.8.0",
8
8
  "@supabase/supabase-js": "^2.95.3",
9
+ "@solana/kit": "^6.5.0",
9
10
  "@vercel/node": "^5.6.3",
10
11
  "drizzle-orm": "^0.45.1",
11
12
  "stripe": "^20.3.1",
12
13
  "@revealui/config": "0.3.0",
13
- "@revealui/db": "0.3.0",
14
- "@revealui/core": "0.3.0"
14
+ "@revealui/contracts": "1.1.0",
15
+ "@revealui/core": "0.3.0",
16
+ "@revealui/db": "0.3.0"
15
17
  },
16
18
  "peerDependencies": {
17
19
  "react": "^19.0.0",
@@ -57,6 +59,10 @@
57
59
  "types": "./dist/api/handlers/payment-intent.d.ts",
58
60
  "import": "./dist/api/handlers/payment-intent.js"
59
61
  },
62
+ "./revealcoin": {
63
+ "types": "./dist/revealcoin/index.d.ts",
64
+ "import": "./dist/revealcoin/index.js"
65
+ },
60
66
  "./stripe/stripeClient": {
61
67
  "types": "./dist/stripe/stripeClient.d.ts",
62
68
  "import": "./dist/stripe/stripeClient.js"