@velociti/sdk 0.1.0 → 0.2.1
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/CHANGELOG.md +63 -0
- package/dist/cli.d.ts +11 -0
- package/dist/cli.js +342 -0
- package/dist/client.d.ts +54 -36
- package/dist/client.js +164 -78
- package/dist/index.d.ts +3 -0
- package/dist/index.js +4 -0
- package/dist/react.d.ts +65 -0
- package/dist/react.js +235 -0
- package/dist/types.d.ts +73 -0
- package/package.json +23 -4
- package/docs/getting-started.md +0 -73
- package/examples/deploy-token.ts +0 -75
- package/src/client.ts +0 -260
- package/src/index.ts +0 -23
- package/src/types.ts +0 -126
- package/tsconfig.json +0 -34
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.2.0] - 2026-02-03
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **Retry Logic**: Automatic retry with exponential backoff for failed requests
|
|
12
|
+
- Configurable via `enableRetry`, `maxRetries`, and `retryDelay` options
|
|
13
|
+
- Handles rate limiting (429) and server errors (5xx) automatically
|
|
14
|
+
|
|
15
|
+
- **Batch Deploy**: Deploy multiple tokens in a single API call
|
|
16
|
+
- `prepareBatchDeploy()` method for batch token creation
|
|
17
|
+
- Maximum 10 tokens per batch
|
|
18
|
+
|
|
19
|
+
- **Token Analytics**: Get detailed analytics for any token
|
|
20
|
+
- `getTokenAnalytics()` for volume, holders, trades, ATH/ATL
|
|
21
|
+
- `getPriceHistory()` for historical price data
|
|
22
|
+
|
|
23
|
+
- **Webhooks**: Real-time event notifications
|
|
24
|
+
- `registerWebhook()` to subscribe to token events
|
|
25
|
+
- Events: token.created, token.graduated, token.trade, fees.claimed, fees.available
|
|
26
|
+
- `listWebhooks()`, `deleteWebhook()`, `testWebhook()` management methods
|
|
27
|
+
|
|
28
|
+
- **CLI Tool**: Deploy from command line
|
|
29
|
+
- `npx @velociti/sdk deploy --name "MyToken" --symbol "MTK"`
|
|
30
|
+
- `npx @velociti/sdk tokens` - list your tokens
|
|
31
|
+
- `npx @velociti/sdk analytics <mintAddress>` - view token analytics
|
|
32
|
+
- `npx @velociti/sdk config --api-key YOUR_KEY` - save API key
|
|
33
|
+
|
|
34
|
+
- **React Hooks**: Easy integration with React apps
|
|
35
|
+
- `useVelocitiDeploy()` - deploy tokens with wallet adapter
|
|
36
|
+
- `useVelocitiToken()` - fetch token info
|
|
37
|
+
- `useVelocitiAnalytics()` - fetch analytics
|
|
38
|
+
- `useVelocitiMyTokens()` - list user's tokens
|
|
39
|
+
- `useVelocitiFees()` - claim fees
|
|
40
|
+
|
|
41
|
+
- **Examples**:
|
|
42
|
+
- `examples/trading-bot.ts` - Automated trading bot with price monitoring
|
|
43
|
+
- Discord/Telegram notifications support
|
|
44
|
+
|
|
45
|
+
### Changed
|
|
46
|
+
- Improved error handling with more descriptive messages
|
|
47
|
+
- Better TypeScript types for all API responses
|
|
48
|
+
|
|
49
|
+
## [0.1.0] - 2026-02-03
|
|
50
|
+
|
|
51
|
+
### Added
|
|
52
|
+
- Initial release
|
|
53
|
+
- `VelocitiClient` class for API interaction
|
|
54
|
+
- `prepareTokenDeploy()` - prepare token deployment transaction
|
|
55
|
+
- `submitTransaction()` - submit signed transaction
|
|
56
|
+
- `deployToken()` - convenience method for full deployment flow
|
|
57
|
+
- `getToken()` - fetch token info by mint address
|
|
58
|
+
- `getMyTokens()` - list tokens created with API key
|
|
59
|
+
- `prepareClaimFees()` - prepare fee claim transaction
|
|
60
|
+
- `claimFees()` - claim accumulated transfer fees
|
|
61
|
+
- `getRateLimitInfo()` - check rate limit status
|
|
62
|
+
- Full TypeScript support with type definitions
|
|
63
|
+
- MIT License
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* VELOCITI CLI Tool
|
|
4
|
+
* Deploy and manage tokens from the command line
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* npx @velociti/sdk deploy --name "MyToken" --symbol "MTK"
|
|
8
|
+
* npx @velociti/sdk tokens
|
|
9
|
+
* npx @velociti/sdk analytics <mintAddress>
|
|
10
|
+
*/
|
|
11
|
+
export {};
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
/**
|
|
4
|
+
* VELOCITI CLI Tool
|
|
5
|
+
* Deploy and manage tokens from the command line
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* npx @velociti/sdk deploy --name "MyToken" --symbol "MTK"
|
|
9
|
+
* npx @velociti/sdk tokens
|
|
10
|
+
* npx @velociti/sdk analytics <mintAddress>
|
|
11
|
+
*/
|
|
12
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
15
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
16
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
17
|
+
}
|
|
18
|
+
Object.defineProperty(o, k2, desc);
|
|
19
|
+
}) : (function(o, m, k, k2) {
|
|
20
|
+
if (k2 === undefined) k2 = k;
|
|
21
|
+
o[k2] = m[k];
|
|
22
|
+
}));
|
|
23
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
24
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
25
|
+
}) : function(o, v) {
|
|
26
|
+
o["default"] = v;
|
|
27
|
+
});
|
|
28
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const client_1 = require("./client");
|
|
37
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
38
|
+
const fs = __importStar(require("fs"));
|
|
39
|
+
const path = __importStar(require("path"));
|
|
40
|
+
// ANSI colors
|
|
41
|
+
const colors = {
|
|
42
|
+
reset: '\x1b[0m',
|
|
43
|
+
bright: '\x1b[1m',
|
|
44
|
+
red: '\x1b[31m',
|
|
45
|
+
green: '\x1b[32m',
|
|
46
|
+
yellow: '\x1b[33m',
|
|
47
|
+
blue: '\x1b[34m',
|
|
48
|
+
magenta: '\x1b[35m',
|
|
49
|
+
cyan: '\x1b[36m',
|
|
50
|
+
};
|
|
51
|
+
function log(message, color = colors.reset) {
|
|
52
|
+
console.log(`${color}${message}${colors.reset}`);
|
|
53
|
+
}
|
|
54
|
+
function success(message) {
|
|
55
|
+
log(`✅ ${message}`, colors.green);
|
|
56
|
+
}
|
|
57
|
+
function error(message) {
|
|
58
|
+
log(`❌ ${message}`, colors.red);
|
|
59
|
+
}
|
|
60
|
+
function info(message) {
|
|
61
|
+
log(`ℹ️ ${message}`, colors.cyan);
|
|
62
|
+
}
|
|
63
|
+
function banner() {
|
|
64
|
+
console.log(colors.magenta + `
|
|
65
|
+
╔═══════════════════════════════════════╗
|
|
66
|
+
║ VELOCITI CLI v0.1.0 ║
|
|
67
|
+
║ Solana Tax Token Launchpad ║
|
|
68
|
+
╚═══════════════════════════════════════╝
|
|
69
|
+
` + colors.reset);
|
|
70
|
+
}
|
|
71
|
+
// Parse command line arguments
|
|
72
|
+
function parseArgs(args) {
|
|
73
|
+
const parsed = {};
|
|
74
|
+
for (let i = 0; i < args.length; i++) {
|
|
75
|
+
const arg = args[i];
|
|
76
|
+
if (arg.startsWith('--')) {
|
|
77
|
+
const key = arg.slice(2);
|
|
78
|
+
const next = args[i + 1];
|
|
79
|
+
if (next && !next.startsWith('--')) {
|
|
80
|
+
parsed[key] = next;
|
|
81
|
+
i++;
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
parsed[key] = true;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
else if (!parsed._command) {
|
|
88
|
+
parsed._command = arg;
|
|
89
|
+
}
|
|
90
|
+
else if (!parsed._arg) {
|
|
91
|
+
parsed._arg = arg;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return parsed;
|
|
95
|
+
}
|
|
96
|
+
// Load API key from env or config file
|
|
97
|
+
function loadApiKey() {
|
|
98
|
+
// Check environment variable first
|
|
99
|
+
if (process.env.VELOCITI_API_KEY) {
|
|
100
|
+
return process.env.VELOCITI_API_KEY;
|
|
101
|
+
}
|
|
102
|
+
// Check config file
|
|
103
|
+
const configPath = path.join(process.env.HOME || '', '.velociti', 'config.json');
|
|
104
|
+
if (fs.existsSync(configPath)) {
|
|
105
|
+
try {
|
|
106
|
+
const config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
|
|
107
|
+
return config.apiKey || null;
|
|
108
|
+
}
|
|
109
|
+
catch {
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
// Load wallet keypair from file
|
|
116
|
+
function loadWallet(walletPath) {
|
|
117
|
+
const keyPath = walletPath ||
|
|
118
|
+
process.env.VELOCITI_WALLET ||
|
|
119
|
+
path.join(process.env.HOME || '', '.config', 'solana', 'id.json');
|
|
120
|
+
if (!fs.existsSync(keyPath)) {
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
try {
|
|
124
|
+
const keyData = JSON.parse(fs.readFileSync(keyPath, 'utf-8'));
|
|
125
|
+
return web3_js_1.Keypair.fromSecretKey(Uint8Array.from(keyData));
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
// Save API key to config
|
|
132
|
+
function saveApiKey(apiKey) {
|
|
133
|
+
const configDir = path.join(process.env.HOME || '', '.velociti');
|
|
134
|
+
const configPath = path.join(configDir, 'config.json');
|
|
135
|
+
if (!fs.existsSync(configDir)) {
|
|
136
|
+
fs.mkdirSync(configDir, { recursive: true });
|
|
137
|
+
}
|
|
138
|
+
let config = {};
|
|
139
|
+
if (fs.existsSync(configPath)) {
|
|
140
|
+
config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
|
|
141
|
+
}
|
|
142
|
+
config.apiKey = apiKey;
|
|
143
|
+
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
144
|
+
}
|
|
145
|
+
// Commands
|
|
146
|
+
async function deploy(args) {
|
|
147
|
+
const apiKey = loadApiKey();
|
|
148
|
+
if (!apiKey) {
|
|
149
|
+
error('No API key found. Run: velociti config --api-key YOUR_KEY');
|
|
150
|
+
process.exit(1);
|
|
151
|
+
}
|
|
152
|
+
const wallet = loadWallet(args.wallet);
|
|
153
|
+
if (!wallet) {
|
|
154
|
+
error('No wallet found. Set VELOCITI_WALLET or use --wallet path/to/keypair.json');
|
|
155
|
+
process.exit(1);
|
|
156
|
+
}
|
|
157
|
+
const name = args.name;
|
|
158
|
+
const symbol = args.symbol;
|
|
159
|
+
const description = args.description || '';
|
|
160
|
+
const taxRate = parseFloat(args.tax) || 5;
|
|
161
|
+
const network = args.network === 'mainnet' ? 'mainnet' : 'devnet';
|
|
162
|
+
if (!name || !symbol) {
|
|
163
|
+
error('Missing required arguments: --name and --symbol');
|
|
164
|
+
process.exit(1);
|
|
165
|
+
}
|
|
166
|
+
info(`Deploying token: ${name} (${symbol})`);
|
|
167
|
+
info(`Network: ${network}`);
|
|
168
|
+
info(`Tax rate: ${taxRate}%`);
|
|
169
|
+
info(`Wallet: ${wallet.publicKey.toBase58()}`);
|
|
170
|
+
const client = new client_1.VelocitiClient({ apiKey, network });
|
|
171
|
+
const prepared = await client.prepareTokenDeploy({
|
|
172
|
+
name,
|
|
173
|
+
symbol,
|
|
174
|
+
description,
|
|
175
|
+
taxRate,
|
|
176
|
+
payerAddress: wallet.publicKey.toBase58(),
|
|
177
|
+
});
|
|
178
|
+
if (!prepared.success || !prepared.data) {
|
|
179
|
+
error(`Failed to prepare: ${prepared.error}`);
|
|
180
|
+
process.exit(1);
|
|
181
|
+
}
|
|
182
|
+
info(`Estimated fee: ${prepared.data.estimatedFee} SOL`);
|
|
183
|
+
info(`Mint address: ${prepared.data.mintAddress}`);
|
|
184
|
+
// Sign transaction
|
|
185
|
+
const tx = web3_js_1.Transaction.from(Buffer.from(prepared.data.transaction, 'base64'));
|
|
186
|
+
tx.sign(wallet);
|
|
187
|
+
const signedTx = tx.serialize().toString('base64');
|
|
188
|
+
// Submit
|
|
189
|
+
info('Submitting transaction...');
|
|
190
|
+
const result = await client.submitTransaction(signedTx);
|
|
191
|
+
if (result.success) {
|
|
192
|
+
success(`Token deployed successfully!`);
|
|
193
|
+
log(` Signature: ${result.data?.signature}`, colors.cyan);
|
|
194
|
+
log(` View: https://velociti.fun/token/${prepared.data.mintAddress}`, colors.cyan);
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
error(`Deployment failed: ${result.error}`);
|
|
198
|
+
process.exit(1);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
async function listTokens(args) {
|
|
202
|
+
const apiKey = loadApiKey();
|
|
203
|
+
if (!apiKey) {
|
|
204
|
+
error('No API key found. Run: velociti config --api-key YOUR_KEY');
|
|
205
|
+
process.exit(1);
|
|
206
|
+
}
|
|
207
|
+
const network = args.network === 'mainnet' ? 'mainnet' : 'devnet';
|
|
208
|
+
const client = new client_1.VelocitiClient({ apiKey, network });
|
|
209
|
+
info('Fetching your tokens...');
|
|
210
|
+
const result = await client.getMyTokens();
|
|
211
|
+
if (!result.success || !result.data) {
|
|
212
|
+
error(`Failed: ${result.error}`);
|
|
213
|
+
process.exit(1);
|
|
214
|
+
}
|
|
215
|
+
if (result.data.length === 0) {
|
|
216
|
+
info('No tokens found. Deploy one with: velociti deploy --name "MyToken" --symbol "MTK"');
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
console.log('\nYour tokens:\n');
|
|
220
|
+
for (const token of result.data) {
|
|
221
|
+
console.log(colors.bright + token.name + colors.reset + ` (${token.symbol})`);
|
|
222
|
+
console.log(` Mint: ${token.mintAddress}`);
|
|
223
|
+
console.log(` Price: ${token.priceInSol} SOL ($${token.priceInUsd.toFixed(4)})`);
|
|
224
|
+
console.log(` Progress: ${token.progress}%${token.isGraduated ? ' ✅ Graduated' : ''}`);
|
|
225
|
+
console.log('');
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
async function analytics(args) {
|
|
229
|
+
const apiKey = loadApiKey();
|
|
230
|
+
if (!apiKey) {
|
|
231
|
+
error('No API key found. Run: velociti config --api-key YOUR_KEY');
|
|
232
|
+
process.exit(1);
|
|
233
|
+
}
|
|
234
|
+
const mintAddress = args._arg;
|
|
235
|
+
if (!mintAddress) {
|
|
236
|
+
error('Usage: velociti analytics <mintAddress>');
|
|
237
|
+
process.exit(1);
|
|
238
|
+
}
|
|
239
|
+
const network = args.network === 'mainnet' ? 'mainnet' : 'devnet';
|
|
240
|
+
const client = new client_1.VelocitiClient({ apiKey, network });
|
|
241
|
+
info(`Fetching analytics for ${mintAddress}...`);
|
|
242
|
+
const result = await client.getTokenAnalytics(mintAddress);
|
|
243
|
+
if (!result.success || !result.data) {
|
|
244
|
+
error(`Failed: ${result.error}`);
|
|
245
|
+
process.exit(1);
|
|
246
|
+
}
|
|
247
|
+
const data = result.data;
|
|
248
|
+
console.log('\n' + colors.bright + 'Token Analytics' + colors.reset);
|
|
249
|
+
console.log('═'.repeat(40));
|
|
250
|
+
console.log(`24h Volume: ${data.volume24h} SOL`);
|
|
251
|
+
console.log(`24h Change: ${data.priceChange24h > 0 ? '+' : ''}${data.priceChange24h.toFixed(2)}%`);
|
|
252
|
+
console.log(`Holders: ${data.holders}`);
|
|
253
|
+
console.log(`Total Trades: ${data.trades}`);
|
|
254
|
+
console.log(`All-Time High: ${data.allTimeHigh} SOL`);
|
|
255
|
+
console.log(`All-Time Low: ${data.allTimeLow} SOL`);
|
|
256
|
+
console.log('');
|
|
257
|
+
}
|
|
258
|
+
async function configCmd(args) {
|
|
259
|
+
if (args['api-key']) {
|
|
260
|
+
saveApiKey(args['api-key']);
|
|
261
|
+
success('API key saved to ~/.velociti/config.json');
|
|
262
|
+
}
|
|
263
|
+
else {
|
|
264
|
+
const apiKey = loadApiKey();
|
|
265
|
+
if (apiKey) {
|
|
266
|
+
info(`Current API key: ${apiKey.slice(0, 12)}...`);
|
|
267
|
+
}
|
|
268
|
+
else {
|
|
269
|
+
info('No API key configured');
|
|
270
|
+
info('Set one with: velociti config --api-key YOUR_KEY');
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
function help() {
|
|
275
|
+
console.log(`
|
|
276
|
+
${colors.bright}Commands:${colors.reset}
|
|
277
|
+
|
|
278
|
+
${colors.cyan}deploy${colors.reset} Deploy a new token
|
|
279
|
+
--name "Token Name" (required)
|
|
280
|
+
--symbol "SYM" (required)
|
|
281
|
+
--description "..." (optional)
|
|
282
|
+
--tax 5 (optional, default: 5%)
|
|
283
|
+
--network devnet (optional, default: devnet)
|
|
284
|
+
--wallet path/to/key (optional)
|
|
285
|
+
|
|
286
|
+
${colors.cyan}tokens${colors.reset} List your deployed tokens
|
|
287
|
+
|
|
288
|
+
${colors.cyan}analytics${colors.reset} Get token analytics
|
|
289
|
+
velociti analytics <mintAddress>
|
|
290
|
+
|
|
291
|
+
${colors.cyan}config${colors.reset} Configure CLI
|
|
292
|
+
--api-key YOUR_KEY Save API key
|
|
293
|
+
|
|
294
|
+
${colors.cyan}help${colors.reset} Show this help message
|
|
295
|
+
|
|
296
|
+
${colors.bright}Environment:${colors.reset}
|
|
297
|
+
|
|
298
|
+
VELOCITI_API_KEY Your API key
|
|
299
|
+
VELOCITI_WALLET Path to wallet keypair file
|
|
300
|
+
|
|
301
|
+
${colors.bright}Examples:${colors.reset}
|
|
302
|
+
|
|
303
|
+
velociti config --api-key vel_abc123...
|
|
304
|
+
velociti deploy --name "Moon Token" --symbol "MOON" --tax 3
|
|
305
|
+
velociti tokens
|
|
306
|
+
velociti analytics 7xKXtg...
|
|
307
|
+
`);
|
|
308
|
+
}
|
|
309
|
+
// Main
|
|
310
|
+
async function main() {
|
|
311
|
+
const args = parseArgs(process.argv.slice(2));
|
|
312
|
+
const command = args._command;
|
|
313
|
+
if (!command || command === 'help' || args.help) {
|
|
314
|
+
banner();
|
|
315
|
+
help();
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
banner();
|
|
319
|
+
switch (command) {
|
|
320
|
+
case 'deploy':
|
|
321
|
+
await deploy(args);
|
|
322
|
+
break;
|
|
323
|
+
case 'tokens':
|
|
324
|
+
case 'list':
|
|
325
|
+
await listTokens(args);
|
|
326
|
+
break;
|
|
327
|
+
case 'analytics':
|
|
328
|
+
await analytics(args);
|
|
329
|
+
break;
|
|
330
|
+
case 'config':
|
|
331
|
+
await configCmd(args);
|
|
332
|
+
break;
|
|
333
|
+
default:
|
|
334
|
+
error(`Unknown command: ${command}`);
|
|
335
|
+
help();
|
|
336
|
+
process.exit(1);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
main().catch(err => {
|
|
340
|
+
error(err.message);
|
|
341
|
+
process.exit(1);
|
|
342
|
+
});
|
package/dist/client.d.ts
CHANGED
|
@@ -2,15 +2,22 @@
|
|
|
2
2
|
* VELOCITI SDK Client
|
|
3
3
|
* Main client class for interacting with the VELOCITI API
|
|
4
4
|
*/
|
|
5
|
-
import { VelocitiConfig, DeployTokenParams, TokenInfo, ClaimFeesResult, ApiResponse, RateLimitInfo, PreparedTransaction, SubmitResult } from './types';
|
|
5
|
+
import { VelocitiConfig, DeployTokenParams, TokenInfo, ClaimFeesResult, ApiResponse, RateLimitInfo, PreparedTransaction, SubmitResult, BatchDeployParams, BatchDeployResult, TokenAnalytics, WebhookConfig } from './types';
|
|
6
6
|
export declare class VelocitiClient {
|
|
7
7
|
private apiKey;
|
|
8
8
|
private baseUrl;
|
|
9
9
|
private network;
|
|
10
10
|
private rateLimitInfo;
|
|
11
|
+
private enableRetry;
|
|
12
|
+
private maxRetries;
|
|
13
|
+
private retryDelay;
|
|
11
14
|
constructor(config: VelocitiConfig);
|
|
12
15
|
/**
|
|
13
|
-
*
|
|
16
|
+
* Sleep helper for retry logic
|
|
17
|
+
*/
|
|
18
|
+
private sleep;
|
|
19
|
+
/**
|
|
20
|
+
* Make an authenticated request to the VELOCITI API with retry logic
|
|
14
21
|
*/
|
|
15
22
|
private request;
|
|
16
23
|
/**
|
|
@@ -18,24 +25,6 @@ export declare class VelocitiClient {
|
|
|
18
25
|
*
|
|
19
26
|
* Returns an unsigned transaction that you must sign with your wallet.
|
|
20
27
|
* After signing, call submitTransaction() to complete the deployment.
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```typescript
|
|
24
|
-
* // Step 1: Prepare the transaction
|
|
25
|
-
* const prepared = await client.prepareTokenDeploy({
|
|
26
|
-
* name: 'My Token',
|
|
27
|
-
* symbol: 'MTK',
|
|
28
|
-
* taxRate: 5,
|
|
29
|
-
* payerAddress: 'YourWalletAddress...'
|
|
30
|
-
* });
|
|
31
|
-
*
|
|
32
|
-
* // Step 2: Sign with your wallet (example using @solana/web3.js)
|
|
33
|
-
* const tx = Transaction.from(Buffer.from(prepared.data.transaction, 'base64'));
|
|
34
|
-
* const signedTx = await wallet.signTransaction(tx);
|
|
35
|
-
*
|
|
36
|
-
* // Step 3: Submit the signed transaction
|
|
37
|
-
* const result = await client.submitTransaction(signedTx.serialize().toString('base64'));
|
|
38
|
-
* ```
|
|
39
28
|
*/
|
|
40
29
|
prepareTokenDeploy(params: DeployTokenParams): Promise<ApiResponse<PreparedTransaction>>;
|
|
41
30
|
/**
|
|
@@ -46,23 +35,12 @@ export declare class VelocitiClient {
|
|
|
46
35
|
submitTransaction(signedTransaction: string): Promise<ApiResponse<SubmitResult>>;
|
|
47
36
|
/**
|
|
48
37
|
* Convenience method: Deploy token in one call (requires wallet adapter)
|
|
49
|
-
*
|
|
50
|
-
* This combines prepareTokenDeploy and submitTransaction.
|
|
51
|
-
* You must provide a signTransaction function from your wallet.
|
|
52
|
-
*
|
|
53
|
-
* @example
|
|
54
|
-
* ```typescript
|
|
55
|
-
* const result = await client.deployToken({
|
|
56
|
-
* name: 'My Token',
|
|
57
|
-
* symbol: 'MTK',
|
|
58
|
-
* taxRate: 5,
|
|
59
|
-
* payerAddress: wallet.publicKey.toBase58()
|
|
60
|
-
* }, async (tx) => {
|
|
61
|
-
* return await wallet.signTransaction(tx);
|
|
62
|
-
* });
|
|
63
|
-
* ```
|
|
64
38
|
*/
|
|
65
39
|
deployToken(params: DeployTokenParams, signTransaction: (transaction: Uint8Array) => Promise<Uint8Array>): Promise<ApiResponse<SubmitResult>>;
|
|
40
|
+
/**
|
|
41
|
+
* Prepare multiple token deployments in batch
|
|
42
|
+
*/
|
|
43
|
+
prepareBatchDeploy(params: BatchDeployParams): Promise<ApiResponse<BatchDeployResult>>;
|
|
66
44
|
/**
|
|
67
45
|
* Get token information by mint address
|
|
68
46
|
*/
|
|
@@ -71,13 +49,22 @@ export declare class VelocitiClient {
|
|
|
71
49
|
* Get all tokens created with this API key
|
|
72
50
|
*/
|
|
73
51
|
getMyTokens(): Promise<ApiResponse<TokenInfo[]>>;
|
|
52
|
+
/**
|
|
53
|
+
* Get detailed analytics for a token
|
|
54
|
+
*/
|
|
55
|
+
getTokenAnalytics(mintAddress: string): Promise<ApiResponse<TokenAnalytics>>;
|
|
56
|
+
/**
|
|
57
|
+
* Get price history for a token
|
|
58
|
+
* @param mintAddress - Token mint address
|
|
59
|
+
* @param period - Time period: '1h', '24h', '7d', '30d'
|
|
60
|
+
*/
|
|
61
|
+
getPriceHistory(mintAddress: string, period?: '1h' | '24h' | '7d' | '30d'): Promise<ApiResponse<TokenAnalytics['priceHistory']>>;
|
|
74
62
|
/**
|
|
75
63
|
* Prepare fee claim transaction
|
|
76
64
|
*/
|
|
77
65
|
prepareClaimFees(mintAddress: string, walletAddress: string): Promise<ApiResponse<PreparedTransaction>>;
|
|
78
66
|
/**
|
|
79
67
|
* Claim accumulated transfer fees for a token
|
|
80
|
-
* Combines prepare + sign + submit
|
|
81
68
|
*/
|
|
82
69
|
claimFees(mintAddress: string, walletAddress: string, signTransaction: (transaction: Uint8Array) => Promise<Uint8Array>): Promise<ApiResponse<ClaimFeesResult>>;
|
|
83
70
|
/**
|
|
@@ -87,6 +74,30 @@ export declare class VelocitiClient {
|
|
|
87
74
|
amount: string;
|
|
88
75
|
valueInSol: number;
|
|
89
76
|
}>>;
|
|
77
|
+
/**
|
|
78
|
+
* Register a webhook to receive events
|
|
79
|
+
*/
|
|
80
|
+
registerWebhook(config: WebhookConfig): Promise<ApiResponse<{
|
|
81
|
+
id: string;
|
|
82
|
+
}>>;
|
|
83
|
+
/**
|
|
84
|
+
* List all registered webhooks
|
|
85
|
+
*/
|
|
86
|
+
listWebhooks(): Promise<ApiResponse<Array<WebhookConfig & {
|
|
87
|
+
id: string;
|
|
88
|
+
}>>>;
|
|
89
|
+
/**
|
|
90
|
+
* Delete a webhook
|
|
91
|
+
*/
|
|
92
|
+
deleteWebhook(webhookId: string): Promise<ApiResponse<{
|
|
93
|
+
deleted: boolean;
|
|
94
|
+
}>>;
|
|
95
|
+
/**
|
|
96
|
+
* Test a webhook endpoint
|
|
97
|
+
*/
|
|
98
|
+
testWebhook(webhookId: string): Promise<ApiResponse<{
|
|
99
|
+
sent: boolean;
|
|
100
|
+
}>>;
|
|
90
101
|
/**
|
|
91
102
|
* Get current rate limit status
|
|
92
103
|
*/
|
|
@@ -95,4 +106,11 @@ export declare class VelocitiClient {
|
|
|
95
106
|
* Get the current network
|
|
96
107
|
*/
|
|
97
108
|
getNetwork(): 'mainnet' | 'devnet';
|
|
109
|
+
/**
|
|
110
|
+
* Check if API key is valid
|
|
111
|
+
*/
|
|
112
|
+
validateApiKey(): Promise<ApiResponse<{
|
|
113
|
+
valid: boolean;
|
|
114
|
+
tier: string;
|
|
115
|
+
}>>;
|
|
98
116
|
}
|