qvtx-developer-kit 1.0.0 → 1.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/.env.example +108 -0
  2. package/README.md +0 -0
  3. package/abis/QVTXBridge.json +273 -0
  4. package/abis/QVTXDirectPurchase.json +621 -0
  5. package/abis/QVTXGovernance.json +267 -0
  6. package/abis/QVTXNFT.json +370 -0
  7. package/abis/QVTXRewards.json +155 -0
  8. package/abis/QVTXToken.json +311 -0
  9. package/abis/QVTXVesting.json +216 -0
  10. package/abis/index.js +16 -0
  11. package/bin/qvtx-developer-cli.js +99 -0
  12. package/config/index.js +108 -0
  13. package/config/networks.js +247 -0
  14. package/examples/basic-usage.js +39 -0
  15. package/examples/bridge-example.js +123 -0
  16. package/examples/direct-purchase.js +300 -0
  17. package/examples/governance-example.js +140 -0
  18. package/examples/nft-example.js +141 -0
  19. package/examples/staking-example.js +96 -0
  20. package/index.js +145 -0
  21. package/languages/blockchain_ai_sdk.js +0 -0
  22. package/languages/node_sdk.js +0 -0
  23. package/languages/solana_sdk.js +383 -0
  24. package/package.json +30 -3
  25. package/purchase/index.js +567 -0
  26. package/rewards/index.js +71 -0
  27. package/smart-contracts/QVTXBridge.sol +305 -0
  28. package/smart-contracts/QVTXDirectPurchase.sol +543 -0
  29. package/smart-contracts/QVTXGovernance.sol +325 -0
  30. package/smart-contracts/QVTXNFT.sol +338 -0
  31. package/smart-contracts/QVTXRewards.sol +102 -0
  32. package/smart-contracts/QVTXToken.sol +227 -0
  33. package/smart-contracts/QVTXVesting.sol +411 -0
  34. package/smart-contracts/interfaces/IERC20.sol +14 -0
  35. package/smart-contracts/interfaces/IERC20Metadata.sol +8 -0
  36. package/smart-contracts/interfaces/IERC721.sol +18 -0
  37. package/smart-contracts/interfaces/IERC721Metadata.sol +8 -0
  38. package/smart-contracts/interfaces/IERC721Receiver.sol +11 -0
  39. package/storage/index.js +112 -0
  40. package/templates/contract/ERC20Token.sol +116 -0
  41. package/templates/dapp/index.html +93 -0
  42. package/test/index.js +182 -0
  43. package/tools/build-tool.js +63 -0
  44. package/tools/create-template.js +116 -0
  45. package/tools/deploy-tool.js +55 -0
  46. package/tools/generate-docs.js +149 -0
  47. package/tools/init-project.js +138 -0
  48. package/tools/run-tests.js +64 -0
  49. package/types/index.d.ts +386 -0
@@ -0,0 +1,386 @@
1
+ /**
2
+ * QVTX Developer Kit - TypeScript Definitions
3
+ * @author QuantVestrix Tech Team (07-Tech)
4
+ */
5
+
6
+ import { Contract, providers, Signer, BigNumber } from 'ethers';
7
+ import Web3 from 'web3';
8
+
9
+ // Network Types
10
+ export type NetworkName = 'ethereum' | 'bsc' | 'polygon' | 'arbitrum' | 'avalanche' | 'optimism' | 'solana';
11
+ export type Environment = 'mainnet' | 'testnet' | 'goerli' | 'sepolia' | 'mumbai' | 'fuji';
12
+
13
+ export interface NetworkConfig {
14
+ chainId: number;
15
+ rpc: string;
16
+ name: string;
17
+ nativeCurrency: {
18
+ name: string;
19
+ symbol: string;
20
+ decimals: number;
21
+ };
22
+ blockExplorer?: string;
23
+ }
24
+
25
+ export interface QVTXConfig {
26
+ network?: NetworkName;
27
+ environment?: Environment;
28
+ apiKey?: string;
29
+ privateKey?: string;
30
+ rpcUrl?: string;
31
+ chainId?: number;
32
+ }
33
+
34
+ // Token Types
35
+ export interface TokenInfo {
36
+ name: string;
37
+ symbol: string;
38
+ decimals: number;
39
+ totalSupply: string;
40
+ }
41
+
42
+ // Main SDK Class
43
+ export class QVTXDeveloperKit {
44
+ constructor(config?: QVTXConfig);
45
+
46
+ version: string;
47
+ validatorId: string;
48
+ config: QVTXConfig;
49
+ web3?: Web3;
50
+ provider?: providers.JsonRpcProvider;
51
+
52
+ getRpcUrl(network?: NetworkName, env?: Environment): string | null;
53
+ initWeb3(providerUrl?: string): Promise<Web3>;
54
+ initEthers(providerUrl?: string): Promise<providers.JsonRpcProvider>;
55
+ deployContract(abi: any[], bytecode: string, constructorArgs?: any[], privateKey?: string): Promise<Contract>;
56
+ getTokenInfo(): TokenInfo;
57
+ getNetworks(): Record<NetworkName, Record<Environment, string>>;
58
+ getVersion(): string;
59
+ }
60
+
61
+ // Blockchain AI SDK Types
62
+ export interface NeuralNetworkConfig {
63
+ layers?: number[];
64
+ activation?: string;
65
+ optimizer?: string;
66
+ loss?: string;
67
+ epochs?: number;
68
+ batchSize?: number;
69
+ useQuantumAcceleration?: boolean;
70
+ }
71
+
72
+ export interface InferenceOptions {
73
+ useQuantum?: boolean;
74
+ crossChainValidation?: boolean;
75
+ dnaEnhancement?: boolean;
76
+ }
77
+
78
+ export interface AIStatus {
79
+ qvtx_chain: {
80
+ chain_id: number;
81
+ connected: boolean;
82
+ ai_capable: boolean;
83
+ };
84
+ neural_engine: { active: boolean; models: number };
85
+ dna_computer: { active: boolean; algorithms: number };
86
+ quantum_processor: { active: boolean; qubits: number };
87
+ consensus_validator: { active: boolean; validations: number };
88
+ cross_chain_capabilities: {
89
+ enabled: boolean;
90
+ supported_chains: string[];
91
+ };
92
+ }
93
+
94
+ export class BlockchainAISDK {
95
+ constructor(config?: {
96
+ chainId?: number;
97
+ rpcUrl?: string;
98
+ apiKey?: string;
99
+ neuralCapacity?: number;
100
+ dnaConsensus?: boolean;
101
+ quantumComputing?: boolean;
102
+ crossChainAI?: boolean;
103
+ });
104
+
105
+ trainNeuralNetwork(networkConfig: NeuralNetworkConfig, trainingData: any): Promise<any>;
106
+ runInference(modelHash: string, inputData: any, options?: InferenceOptions): Promise<any>;
107
+ runDNAAlgorithm(algorithmType: string, parameters: any, geneticCode: string): Promise<any>;
108
+ transcribeNeuralPatterns(patterns: any, targetFormat?: string): Promise<any>;
109
+ initializeQuantumNetwork(qubits?: number): Promise<any>;
110
+ runQuantumAlgorithm(algorithm: string, data: any): Promise<any>;
111
+ orchestrateCrossChainAI(selectedChains?: string[]): Promise<any>;
112
+ deployAISmartContract(aiConfig: any, targetChains: string[]): Promise<any>;
113
+ validateQVTXConsensus(aiValidationData: any): Promise<any>;
114
+ generateAIConsensusProof(data: any, participants?: number): Promise<any>;
115
+ analyzeAIConfidenceScore(aiOutput: any, validationData: any): Promise<any>;
116
+ getAIStatus(): Promise<AIStatus>;
117
+ optimizeAISystem(optimizationType?: string): Promise<any>;
118
+ }
119
+
120
+ // Node SDK Types
121
+ export interface DeployOptions {
122
+ template?: string;
123
+ networks?: NetworkName[];
124
+ parameters?: Record<string, any>;
125
+ }
126
+
127
+ export interface RewardConfig {
128
+ yieldStrategies?: string[];
129
+ rewardToken?: string;
130
+ autoCompound?: boolean;
131
+ minReward?: number;
132
+ }
133
+
134
+ export interface StoreDataResult {
135
+ networksCount: number;
136
+ distribution: Record<string, any>;
137
+ neuralHash: string;
138
+ retrievalKey: string;
139
+ }
140
+
141
+ export interface TransactionOptions {
142
+ type?: string;
143
+ amount?: number;
144
+ recipient?: string;
145
+ networks?: NetworkName[];
146
+ metadata?: Record<string, any>;
147
+ }
148
+
149
+ export interface ThroughputStats {
150
+ current: number;
151
+ maximum: number;
152
+ efficiency: string;
153
+ quantum_consensus: boolean;
154
+ neural_validation: boolean;
155
+ }
156
+
157
+ export class NodeSDK {
158
+ constructor(config?: {
159
+ chainId?: number;
160
+ rpcUrl?: string;
161
+ apiKey?: string;
162
+ networks?: NetworkName[];
163
+ infiniteThroughput?: boolean;
164
+ crossChainRewards?: boolean;
165
+ neuralStorage?: string;
166
+ });
167
+
168
+ deploySmartContract(options?: DeployOptions): Promise<Record<string, string>>;
169
+ initializeRewards(options?: RewardConfig): Promise<void>;
170
+ harvestRewards(networks?: NetworkName[] | 'all'): Promise<any>;
171
+ storeData(data: any, schema?: string): Promise<StoreDataResult>;
172
+ retrieveData(hash: string, schema?: string): Promise<any>;
173
+ queryData(query: string, networks?: NetworkName[] | 'all'): Promise<any>;
174
+ executeQVTXTransaction(options?: TransactionOptions): Promise<any>;
175
+ enableInfiniteThroughput(options?: any): Promise<boolean>;
176
+ getThroughputStats(): Promise<ThroughputStats>;
177
+ getStatus(): Promise<Record<string, any>>;
178
+ }
179
+
180
+ // Storage Types
181
+ export interface EncryptedData {
182
+ encrypted: string;
183
+ iv: string;
184
+ authTag: string;
185
+ }
186
+
187
+ export interface IPFSUploadResult {
188
+ hash: string;
189
+ url: string;
190
+ size: number;
191
+ }
192
+
193
+ export interface NFTMetadata {
194
+ name: string;
195
+ description: string;
196
+ image: string;
197
+ attributes: Array<{
198
+ trait_type: string;
199
+ value: string | number;
200
+ }>;
201
+ }
202
+
203
+ export class QVTXStorage {
204
+ constructor(config?: {
205
+ provider?: string;
206
+ gateway?: string;
207
+ apiKey?: string;
208
+ });
209
+
210
+ hash(content: string): string;
211
+ uploadToIPFS(content: string | Buffer, options?: { filename?: string }): Promise<IPFSUploadResult>;
212
+ fetchFromIPFS(hash: string): Promise<any>;
213
+ createNFTMetadata(name: string, description: string, image: string, attributes?: Array<{ trait: string; value: string | number }>): NFTMetadata;
214
+ storeEncrypted(data: any, password: string): Promise<EncryptedData>;
215
+ retrieveEncrypted(encryptedData: EncryptedData, password: string): Promise<any>;
216
+ }
217
+
218
+ // Rewards Types
219
+ export class QVTXRewards {
220
+ constructor(web3: Web3, contractAddress: string, abi?: any[]);
221
+
222
+ init(): Promise<this>;
223
+ getStake(address: string): Promise<BigNumber>;
224
+ getEarned(address: string): Promise<BigNumber>;
225
+ getTotalStaked(): Promise<BigNumber>;
226
+ getRewardRate(): Promise<BigNumber>;
227
+ stake(amount: string | BigNumber, fromAddress: string, privateKey: string): Promise<any>;
228
+ withdraw(amount: string | BigNumber, fromAddress: string, privateKey: string): Promise<any>;
229
+ claimReward(fromAddress: string, privateKey: string): Promise<any>;
230
+ }
231
+
232
+ // Solana Types
233
+ export interface SolanaConfig {
234
+ network?: 'mainnet-beta' | 'devnet' | 'testnet';
235
+ rpcUrl?: string;
236
+ }
237
+
238
+ export class QVTXSolana {
239
+ constructor(config?: SolanaConfig);
240
+
241
+ connect(): Promise<void>;
242
+ getBalance(publicKey: string): Promise<number>;
243
+ transfer(fromKeypair: any, toPublicKey: string, amount: number): Promise<string>;
244
+ createToken(authority: any, decimals?: number): Promise<string>;
245
+ mintTokens(mint: string, destination: string, authority: any, amount: number): Promise<string>;
246
+ getTokenBalance(tokenAccount: string): Promise<number>;
247
+ }
248
+
249
+ // Direct Purchase Types
250
+ export interface PurchaseRecord {
251
+ amount: string;
252
+ pricePaid: string;
253
+ paymentToken: string;
254
+ timestamp: Date;
255
+ referrer: string;
256
+ }
257
+
258
+ export interface VestingSchedule {
259
+ index: number;
260
+ totalAmount: string;
261
+ released: string;
262
+ remaining: string;
263
+ startTime: Date;
264
+ endTime: Date;
265
+ duration: number;
266
+ percentVested: number;
267
+ }
268
+
269
+ export interface PurchaseLimits {
270
+ minPurchase: string;
271
+ maxPurchase: string;
272
+ maxWalletPurchase: string;
273
+ totalSaleCap: string;
274
+ totalSold: string;
275
+ remainingSupply: string;
276
+ }
277
+
278
+ export interface WalletInfo {
279
+ totalPurchased: string;
280
+ remainingAllocation: string;
281
+ purchaseCount: number;
282
+ purchases: PurchaseRecord[];
283
+ }
284
+
285
+ export interface ReferralInfo {
286
+ totalEarnings: string;
287
+ referralCount: number;
288
+ referredBy: string | null;
289
+ rewardPercent: number;
290
+ discountPercent: number;
291
+ }
292
+
293
+ export interface PurchaseSummary {
294
+ qvtxAmount: string;
295
+ nativeCost: string;
296
+ referrer: string;
297
+ discount: string;
298
+ remainingSupply: string;
299
+ withinLimits: boolean;
300
+ }
301
+
302
+ export interface DirectPurchaseConfig {
303
+ provider: string | providers.Provider;
304
+ contractAddress?: string;
305
+ network?: string;
306
+ privateKey?: string;
307
+ signer?: Signer;
308
+ }
309
+
310
+ export interface PurchaseOptions {
311
+ referrer?: string;
312
+ approve?: boolean;
313
+ overrides?: Record<string, any>;
314
+ }
315
+
316
+ export class QVTXDirectPurchase {
317
+ constructor(options: DirectPurchaseConfig);
318
+
319
+ contractAddress: string;
320
+ provider: providers.Provider;
321
+ signer?: Signer;
322
+ contract: Contract;
323
+
324
+ // Read functions
325
+ getPriceInNative(): Promise<string>;
326
+ getPriceInToken(tokenAddress: string): Promise<string>;
327
+ calculateNativeCost(qvtxAmount: string | number, referrer?: string): Promise<string>;
328
+ calculateTokenCost(tokenAddress: string, qvtxAmount: string | number, referrer?: string): Promise<string>;
329
+ getQVTXForNative(nativeAmount: string | number): Promise<string>;
330
+ getQVTXForToken(tokenAddress: string, tokenAmount: string | number): Promise<string>;
331
+ canPurchase(buyer: string, amount: string | number): Promise<{ valid: boolean; reason: string }>;
332
+ getPurchaseLimits(): Promise<PurchaseLimits>;
333
+ getWalletInfo(wallet: string): Promise<WalletInfo>;
334
+ getReferralInfo(wallet: string): Promise<ReferralInfo>;
335
+ getVestingSchedules(wallet: string): Promise<VestingSchedule[]>;
336
+ getSupportedTokens(): Promise<string[]>;
337
+ isPaused(): Promise<boolean>;
338
+ isWhitelistEnabled(): Promise<boolean>;
339
+ isWhitelisted(address: string): Promise<boolean>;
340
+
341
+ // Purchase functions
342
+ purchaseWithNative(qvtxAmount: string | number, options?: PurchaseOptions): Promise<any>;
343
+ purchaseWithToken(tokenAddress: string, qvtxAmount: string | number, options?: PurchaseOptions): Promise<any>;
344
+ releaseVested(scheduleIndex: number, overrides?: Record<string, any>): Promise<any>;
345
+
346
+ // Admin functions
347
+ setNativePrice(price: string | number): Promise<any>;
348
+ addPaymentToken(tokenAddress: string, price: string | number): Promise<any>;
349
+ updateTokenPrice(tokenAddress: string, price: string | number): Promise<any>;
350
+ setPurchaseLimits(limits: { min?: string; max?: string; maxWallet?: string; totalCap?: string }): Promise<any>;
351
+ updateWhitelist(addresses: string[], status: boolean): Promise<any>;
352
+ pause(): Promise<any>;
353
+ unpause(): Promise<any>;
354
+ withdrawNative(): Promise<any>;
355
+ withdrawToken(tokenAddress: string): Promise<any>;
356
+
357
+ // Utility functions
358
+ generateReferralLink(referrerAddress: string, baseUrl?: string): string;
359
+ parseReferralCode(url: string): string | null;
360
+ getPurchaseSummary(qvtxAmount: string | number, referrer?: string): Promise<PurchaseSummary>;
361
+ }
362
+
363
+ export function createDirectPurchase(options: DirectPurchaseConfig): QVTXDirectPurchase;
364
+
365
+ export const PURCHASE_CONTRACTS: Record<string, Record<string, string | null>>;
366
+ export const STABLECOINS: Record<string, Record<string, string>>;
367
+ export const DirectPurchaseABI: any[];
368
+
369
+ // Contract ABIs
370
+ export const QVTXTokenABI: any[];
371
+ export const QVTXGovernanceABI: any[];
372
+ export const QVTXBridgeABI: any[];
373
+ export const QVTXNFTABI: any[];
374
+ export const QVTXVestingABI: any[];
375
+ export const QVTXRewardsABI: any[];
376
+ export const QVTXDirectPurchaseABI: any[];
377
+
378
+ // Default export
379
+ export default QVTXDeveloperKit;
380
+ export { QVTXDeveloperKit };
381
+ export { BlockchainAISDK };
382
+ export { NodeSDK };
383
+ export { QVTXStorage };
384
+ export { QVTXRewards };
385
+ export { QVTXSolana };
386
+ export { QVTXDirectPurchase };