@vaultkey/sdk 1.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/.eslintrc.cjs +10 -0
- package/LICENSE +21 -0
- package/README.md +337 -0
- package/dist/index.d.mts +512 -0
- package/dist/index.d.ts +512 -0
- package/dist/index.js +486 -0
- package/dist/index.mjs +454 -0
- package/examples/usage.ts +221 -0
- package/package.json +41 -0
- package/tsup.config.ts +9 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,512 @@
|
|
|
1
|
+
type VaultKeyResponse<T> = {
|
|
2
|
+
data: T | null;
|
|
3
|
+
error: ErrorResponse | null;
|
|
4
|
+
};
|
|
5
|
+
type ErrorResponse = {
|
|
6
|
+
message: string;
|
|
7
|
+
code: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Supported EVM chain names.
|
|
11
|
+
* Pass chain_name (preferred) or chain_id when calling EVM endpoints.
|
|
12
|
+
*
|
|
13
|
+
* Mainnets: ethereum, polygon, arbitrum, base, optimism,
|
|
14
|
+
* avalanche, bsc, linea, scroll, zksync
|
|
15
|
+
*
|
|
16
|
+
* Testnets: sepolia, amoy, arbitrum-sepolia, base-sepolia,
|
|
17
|
+
* optimism-sepolia, avalanche-fuji, bsc-testnet, zksync-sepolia
|
|
18
|
+
*/
|
|
19
|
+
type ChainName = "ethereum" | "polygon" | "arbitrum" | "base" | "optimism" | "avalanche" | "bsc" | "linea" | "scroll" | "zksync" | "sepolia" | "amoy" | "arbitrum-sepolia" | "base-sepolia" | "optimism-sepolia" | "avalanche-fuji" | "bsc-testnet" | "zksync-sepolia";
|
|
20
|
+
/**
|
|
21
|
+
* Chain resolution params for EVM endpoints.
|
|
22
|
+
* Provide chainName (preferred) OR chainId — chainName takes precedence.
|
|
23
|
+
*/
|
|
24
|
+
type EVMChainParams = {
|
|
25
|
+
chainName: ChainName | string;
|
|
26
|
+
chainId?: never;
|
|
27
|
+
} | {
|
|
28
|
+
chainId: string;
|
|
29
|
+
chainName?: never;
|
|
30
|
+
};
|
|
31
|
+
type ChainType = "evm" | "solana";
|
|
32
|
+
type Chain = {
|
|
33
|
+
name: string;
|
|
34
|
+
chainId: string;
|
|
35
|
+
nativeSymbol: string;
|
|
36
|
+
legacySymbol?: string;
|
|
37
|
+
testnet: boolean;
|
|
38
|
+
};
|
|
39
|
+
type Wallet = {
|
|
40
|
+
id: string;
|
|
41
|
+
userId: string;
|
|
42
|
+
chainType: ChainType;
|
|
43
|
+
address: string;
|
|
44
|
+
label?: string;
|
|
45
|
+
createdAt: string;
|
|
46
|
+
};
|
|
47
|
+
type CreateWalletParams = {
|
|
48
|
+
userId: string;
|
|
49
|
+
chainType: ChainType;
|
|
50
|
+
/** Optional human-readable label for this wallet. */
|
|
51
|
+
label?: string;
|
|
52
|
+
};
|
|
53
|
+
type ListWalletsResult = {
|
|
54
|
+
wallets: Wallet[];
|
|
55
|
+
nextCursor: string | null;
|
|
56
|
+
hasMore: boolean;
|
|
57
|
+
};
|
|
58
|
+
type PaginationParams = {
|
|
59
|
+
/** Cursor from the previous page's nextCursor for pagination. */
|
|
60
|
+
after?: string;
|
|
61
|
+
limit?: number;
|
|
62
|
+
};
|
|
63
|
+
type SigningJob = {
|
|
64
|
+
jobId: string;
|
|
65
|
+
status: "pending" | "processing" | "completed" | "failed";
|
|
66
|
+
};
|
|
67
|
+
type SignEVMMessageParams = {
|
|
68
|
+
/** Raw message or typed data payload to sign. */
|
|
69
|
+
payload: Record<string, unknown>;
|
|
70
|
+
/** Optional deduplication key — safe to retry with the same key. */
|
|
71
|
+
idempotencyKey?: string;
|
|
72
|
+
};
|
|
73
|
+
type SignSolanaMessageParams = {
|
|
74
|
+
payload: Record<string, unknown>;
|
|
75
|
+
idempotencyKey?: string;
|
|
76
|
+
};
|
|
77
|
+
type EVMBalanceResult = {
|
|
78
|
+
address: string;
|
|
79
|
+
balance: string;
|
|
80
|
+
rawBalance: string;
|
|
81
|
+
symbol: string;
|
|
82
|
+
chainName: string;
|
|
83
|
+
chainId: string;
|
|
84
|
+
};
|
|
85
|
+
type SolanaBalanceResult = {
|
|
86
|
+
address: string;
|
|
87
|
+
balance: string;
|
|
88
|
+
rawBalance: string;
|
|
89
|
+
symbol: "SOL";
|
|
90
|
+
};
|
|
91
|
+
type BroadcastEVMResult = {
|
|
92
|
+
txHash: string;
|
|
93
|
+
chainName: string;
|
|
94
|
+
chainId: string;
|
|
95
|
+
};
|
|
96
|
+
type BroadcastSolanaResult = {
|
|
97
|
+
signature: string;
|
|
98
|
+
};
|
|
99
|
+
type SweepParams = {
|
|
100
|
+
chainType: ChainType;
|
|
101
|
+
/**
|
|
102
|
+
* EVM only — the chain to sweep from.
|
|
103
|
+
* chainName takes precedence over chainId.
|
|
104
|
+
*/
|
|
105
|
+
chainName?: string;
|
|
106
|
+
chainId?: string;
|
|
107
|
+
};
|
|
108
|
+
type StablecoinToken = "usdc" | "usdt";
|
|
109
|
+
type TransferSpeed = "slow" | "normal" | "fast";
|
|
110
|
+
type StablecoinTransferParams = {
|
|
111
|
+
token: StablecoinToken;
|
|
112
|
+
/** Recipient wallet address. */
|
|
113
|
+
to: string;
|
|
114
|
+
/** Human-readable amount, e.g. "50.00". */
|
|
115
|
+
amount: string;
|
|
116
|
+
chainType: ChainType;
|
|
117
|
+
/** EVM only — chainName (preferred) or chainId. */
|
|
118
|
+
chainName?: string;
|
|
119
|
+
chainId?: string;
|
|
120
|
+
/** If true, the relayer pays gas on behalf of the sender. */
|
|
121
|
+
gasless?: boolean;
|
|
122
|
+
/** Controls transaction priority. Defaults to "normal". */
|
|
123
|
+
speed?: TransferSpeed;
|
|
124
|
+
/** Optional deduplication key. */
|
|
125
|
+
idempotencyKey?: string;
|
|
126
|
+
};
|
|
127
|
+
type StablecoinTransferResult = {
|
|
128
|
+
jobId: string;
|
|
129
|
+
status: string;
|
|
130
|
+
};
|
|
131
|
+
type StablecoinBalanceParams = {
|
|
132
|
+
token: StablecoinToken;
|
|
133
|
+
chainType: ChainType;
|
|
134
|
+
/** EVM only — chainName (preferred) or chainId. */
|
|
135
|
+
chainName?: string;
|
|
136
|
+
chainId?: string;
|
|
137
|
+
};
|
|
138
|
+
type StablecoinBalanceResult = {
|
|
139
|
+
address: string;
|
|
140
|
+
token: string;
|
|
141
|
+
symbol: string;
|
|
142
|
+
balance: string;
|
|
143
|
+
rawBalance: string;
|
|
144
|
+
chainId?: string;
|
|
145
|
+
};
|
|
146
|
+
type Job = {
|
|
147
|
+
id: string;
|
|
148
|
+
status: "pending" | "processing" | "completed" | "failed";
|
|
149
|
+
operation: string;
|
|
150
|
+
result?: unknown;
|
|
151
|
+
error?: string;
|
|
152
|
+
createdAt: string;
|
|
153
|
+
updatedAt: string;
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Signing operations — sign EVM and Solana messages.
|
|
158
|
+
*
|
|
159
|
+
* All signing operations are asynchronous. They return a job ID
|
|
160
|
+
* which you can poll via `vaultkey.jobs.get(jobId)` until the
|
|
161
|
+
* status is "completed" or "failed".
|
|
162
|
+
*
|
|
163
|
+
* Access via: `vaultkey.wallets.signing`
|
|
164
|
+
*/
|
|
165
|
+
declare class Signing {
|
|
166
|
+
private readonly client;
|
|
167
|
+
private readonly walletId;
|
|
168
|
+
constructor(client: VaultKey, walletId: string);
|
|
169
|
+
/**
|
|
170
|
+
* Sign an EVM message or typed data (EIP-712).
|
|
171
|
+
*
|
|
172
|
+
* @example
|
|
173
|
+
* const { data } = await vaultkey.wallets.signing("wallet_id").evmMessage({
|
|
174
|
+
* payload: { message: "Hello from VaultKey" },
|
|
175
|
+
* });
|
|
176
|
+
* // Poll: await vaultkey.jobs.get(data.jobId)
|
|
177
|
+
*/
|
|
178
|
+
evmMessage(params: SignEVMMessageParams): Promise<VaultKeyResponse<SigningJob>>;
|
|
179
|
+
/**
|
|
180
|
+
* Sign a Solana message.
|
|
181
|
+
*
|
|
182
|
+
* @example
|
|
183
|
+
* const { data } = await vaultkey.wallets.signing("wallet_id").solanaMessage({
|
|
184
|
+
* payload: { message: "Hello from VaultKey" },
|
|
185
|
+
* });
|
|
186
|
+
*/
|
|
187
|
+
solanaMessage(params: SignSolanaMessageParams): Promise<VaultKeyResponse<SigningJob>>;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Wallet management — create wallets, retrieve them, sign messages,
|
|
192
|
+
* check balances, broadcast transactions, and trigger sweeps.
|
|
193
|
+
*
|
|
194
|
+
* @example
|
|
195
|
+
* const vaultkey = new VaultKey({ apiKey: "vk_live_...", apiSecret: "..." });
|
|
196
|
+
*
|
|
197
|
+
* // Create a wallet
|
|
198
|
+
* const { data } = await vaultkey.wallets.create({
|
|
199
|
+
* userId: "user_123",
|
|
200
|
+
* chainType: "evm",
|
|
201
|
+
* });
|
|
202
|
+
*
|
|
203
|
+
* // Sign a message
|
|
204
|
+
* const { data: job } = await vaultkey.wallets
|
|
205
|
+
* .signing("wallet_id")
|
|
206
|
+
* .evmMessage({ payload: { message: "Hello" } });
|
|
207
|
+
*
|
|
208
|
+
* // Poll until done
|
|
209
|
+
* const { data: result } = await vaultkey.jobs.get(job.jobId);
|
|
210
|
+
*/
|
|
211
|
+
declare class Wallets {
|
|
212
|
+
private readonly client;
|
|
213
|
+
constructor(client: VaultKey);
|
|
214
|
+
/**
|
|
215
|
+
* Create a new wallet for a user.
|
|
216
|
+
*
|
|
217
|
+
* @example
|
|
218
|
+
* const { data, error } = await vaultkey.wallets.create({
|
|
219
|
+
* userId: "user_123",
|
|
220
|
+
* chainType: "evm",
|
|
221
|
+
* label: "Primary wallet",
|
|
222
|
+
* });
|
|
223
|
+
*/
|
|
224
|
+
create(params: CreateWalletParams): Promise<VaultKeyResponse<Wallet>>;
|
|
225
|
+
/**
|
|
226
|
+
* Retrieve a wallet by its ID.
|
|
227
|
+
*
|
|
228
|
+
* @example
|
|
229
|
+
* const { data } = await vaultkey.wallets.get("wallet_abc123");
|
|
230
|
+
*/
|
|
231
|
+
get(walletId: string): Promise<VaultKeyResponse<Wallet>>;
|
|
232
|
+
/**
|
|
233
|
+
* List all wallets belonging to a user.
|
|
234
|
+
* Results are paginated — use `nextCursor` to fetch the next page.
|
|
235
|
+
*
|
|
236
|
+
* @example
|
|
237
|
+
* const { data } = await vaultkey.wallets.listByUser("user_123");
|
|
238
|
+
* // Next page:
|
|
239
|
+
* const { data: page2 } = await vaultkey.wallets.listByUser("user_123", {
|
|
240
|
+
* after: data.nextCursor,
|
|
241
|
+
* });
|
|
242
|
+
*/
|
|
243
|
+
listByUser(userId: string, pagination?: PaginationParams): Promise<VaultKeyResponse<ListWalletsResult>>;
|
|
244
|
+
/**
|
|
245
|
+
* Returns a signing interface scoped to the given wallet.
|
|
246
|
+
* Use this to sign EVM or Solana messages.
|
|
247
|
+
*
|
|
248
|
+
* @example
|
|
249
|
+
* const { data } = await vaultkey.wallets
|
|
250
|
+
* .signing("wallet_id")
|
|
251
|
+
* .evmMessage({ payload: { message: "Hello" } });
|
|
252
|
+
*/
|
|
253
|
+
signing(walletId: string): Signing;
|
|
254
|
+
/**
|
|
255
|
+
* Get the native token balance for an EVM wallet.
|
|
256
|
+
* Provide chainName (preferred) or chainId.
|
|
257
|
+
*
|
|
258
|
+
* @example
|
|
259
|
+
* const { data } = await vaultkey.wallets.evmBalance("wallet_id", {
|
|
260
|
+
* chainName: "base",
|
|
261
|
+
* });
|
|
262
|
+
* console.log(data.balance); // "0.05"
|
|
263
|
+
*/
|
|
264
|
+
evmBalance(walletId: string, chain: EVMChainParams): Promise<VaultKeyResponse<EVMBalanceResult>>;
|
|
265
|
+
/**
|
|
266
|
+
* Get the SOL balance for a Solana wallet.
|
|
267
|
+
*
|
|
268
|
+
* @example
|
|
269
|
+
* const { data } = await vaultkey.wallets.solanaBalance("wallet_id");
|
|
270
|
+
* console.log(data.balance); // "1.5"
|
|
271
|
+
*/
|
|
272
|
+
solanaBalance(walletId: string): Promise<VaultKeyResponse<SolanaBalanceResult>>;
|
|
273
|
+
/**
|
|
274
|
+
* Broadcast a pre-signed EVM transaction.
|
|
275
|
+
* Provide chainName (preferred) or chainId.
|
|
276
|
+
*
|
|
277
|
+
* @example
|
|
278
|
+
* const { data } = await vaultkey.wallets.broadcastEVM("wallet_id", {
|
|
279
|
+
* signedTx: "0x...",
|
|
280
|
+
* chainName: "base",
|
|
281
|
+
* });
|
|
282
|
+
* console.log(data.txHash);
|
|
283
|
+
*/
|
|
284
|
+
broadcastEVM(walletId: string, params: {
|
|
285
|
+
signedTx: string;
|
|
286
|
+
} & EVMChainParams): Promise<VaultKeyResponse<BroadcastEVMResult>>;
|
|
287
|
+
/**
|
|
288
|
+
* Broadcast a pre-signed Solana transaction.
|
|
289
|
+
*
|
|
290
|
+
* @example
|
|
291
|
+
* const { data } = await vaultkey.wallets.broadcastSolana("wallet_id", {
|
|
292
|
+
* signedTx: "base58encodedtx...",
|
|
293
|
+
* });
|
|
294
|
+
* console.log(data.signature);
|
|
295
|
+
*/
|
|
296
|
+
broadcastSolana(walletId: string, params: {
|
|
297
|
+
signedTx: string;
|
|
298
|
+
}): Promise<VaultKeyResponse<BroadcastSolanaResult>>;
|
|
299
|
+
/**
|
|
300
|
+
* Trigger a sweep — move all funds from this wallet to the configured
|
|
301
|
+
* master wallet. The operation is asynchronous; poll via `vaultkey.jobs.get`.
|
|
302
|
+
*
|
|
303
|
+
* @example
|
|
304
|
+
* // EVM sweep
|
|
305
|
+
* const { data } = await vaultkey.wallets.sweep("wallet_id", {
|
|
306
|
+
* chainType: "evm",
|
|
307
|
+
* chainName: "base",
|
|
308
|
+
* });
|
|
309
|
+
*
|
|
310
|
+
* // Solana sweep
|
|
311
|
+
* const { data } = await vaultkey.wallets.sweep("wallet_id", {
|
|
312
|
+
* chainType: "solana",
|
|
313
|
+
* });
|
|
314
|
+
*/
|
|
315
|
+
sweep(walletId: string, params: SweepParams): Promise<VaultKeyResponse<SigningJob>>;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Job polling — check the status of async operations like signing and sweeps.
|
|
320
|
+
*
|
|
321
|
+
* Most VaultKey operations that involve on-chain activity are asynchronous.
|
|
322
|
+
* They return a `jobId` which you poll here until `status` is
|
|
323
|
+
* "completed" or "failed".
|
|
324
|
+
*
|
|
325
|
+
* @example
|
|
326
|
+
* const { data: job } = await vaultkey.wallets
|
|
327
|
+
* .signing("wallet_id")
|
|
328
|
+
* .evmMessage({ payload: { message: "Hello" } });
|
|
329
|
+
*
|
|
330
|
+
* // Poll until done
|
|
331
|
+
* let result;
|
|
332
|
+
* do {
|
|
333
|
+
* await new Promise(r => setTimeout(r, 1000));
|
|
334
|
+
* result = await vaultkey.jobs.get(job.jobId);
|
|
335
|
+
* } while (result.data?.status === "pending" || result.data?.status === "processing");
|
|
336
|
+
*/
|
|
337
|
+
declare class Jobs {
|
|
338
|
+
private readonly client;
|
|
339
|
+
constructor(client: VaultKey);
|
|
340
|
+
/**
|
|
341
|
+
* Retrieve the current state of an async job.
|
|
342
|
+
*
|
|
343
|
+
* @example
|
|
344
|
+
* const { data, error } = await vaultkey.jobs.get("job_abc123");
|
|
345
|
+
* if (data?.status === "completed") {
|
|
346
|
+
* console.log("Done!", data.result);
|
|
347
|
+
* }
|
|
348
|
+
*/
|
|
349
|
+
get(jobId: string): Promise<VaultKeyResponse<Job>>;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* Stablecoin operations — transfer USDC/USDT and check stablecoin balances
|
|
354
|
+
* across EVM chains and Solana.
|
|
355
|
+
*
|
|
356
|
+
* @example
|
|
357
|
+
* const vaultkey = new VaultKey({ apiKey: "vk_live_...", apiSecret: "..." });
|
|
358
|
+
*
|
|
359
|
+
* // Transfer USDC on Base
|
|
360
|
+
* const { data } = await vaultkey.stablecoin.transfer("wallet_id", {
|
|
361
|
+
* token: "usdc",
|
|
362
|
+
* to: "0xRecipient",
|
|
363
|
+
* amount: "50.00",
|
|
364
|
+
* chainType: "evm",
|
|
365
|
+
* chainName: "base",
|
|
366
|
+
* gasless: true,
|
|
367
|
+
* });
|
|
368
|
+
*
|
|
369
|
+
* // Check USDC balance on Polygon
|
|
370
|
+
* const { data: bal } = await vaultkey.stablecoin.balance("wallet_id", {
|
|
371
|
+
* token: "usdc",
|
|
372
|
+
* chainType: "evm",
|
|
373
|
+
* chainName: "polygon",
|
|
374
|
+
* });
|
|
375
|
+
*/
|
|
376
|
+
declare class Stablecoin {
|
|
377
|
+
private readonly client;
|
|
378
|
+
constructor(client: VaultKey);
|
|
379
|
+
/**
|
|
380
|
+
* Transfer a stablecoin from a wallet.
|
|
381
|
+
*
|
|
382
|
+
* - For EVM: provide chainName (preferred) or chainId.
|
|
383
|
+
* - For Solana: omit chainName and chainId.
|
|
384
|
+
* - The operation is async — poll `vaultkey.jobs.get(data.jobId)`.
|
|
385
|
+
* - Use `idempotencyKey` to safely retry without double-sending.
|
|
386
|
+
*
|
|
387
|
+
* @example
|
|
388
|
+
* // EVM (gasless)
|
|
389
|
+
* const { data } = await vaultkey.stablecoin.transfer("wallet_id", {
|
|
390
|
+
* token: "usdc",
|
|
391
|
+
* to: "0xRecipient",
|
|
392
|
+
* amount: "100.00",
|
|
393
|
+
* chainType: "evm",
|
|
394
|
+
* chainName: "base",
|
|
395
|
+
* gasless: true,
|
|
396
|
+
* speed: "fast",
|
|
397
|
+
* });
|
|
398
|
+
*
|
|
399
|
+
* // Solana
|
|
400
|
+
* const { data } = await vaultkey.stablecoin.transfer("wallet_id", {
|
|
401
|
+
* token: "usdc",
|
|
402
|
+
* to: "RecipientBase58",
|
|
403
|
+
* amount: "100.00",
|
|
404
|
+
* chainType: "solana",
|
|
405
|
+
* });
|
|
406
|
+
*/
|
|
407
|
+
transfer(walletId: string, params: StablecoinTransferParams): Promise<VaultKeyResponse<StablecoinTransferResult>>;
|
|
408
|
+
/**
|
|
409
|
+
* Get the stablecoin balance for a wallet.
|
|
410
|
+
*
|
|
411
|
+
* - For EVM: provide chainName (preferred) or chainId.
|
|
412
|
+
* - For Solana: omit chainName and chainId.
|
|
413
|
+
*
|
|
414
|
+
* @example
|
|
415
|
+
* const { data } = await vaultkey.stablecoin.balance("wallet_id", {
|
|
416
|
+
* token: "usdc",
|
|
417
|
+
* chainType: "evm",
|
|
418
|
+
* chainName: "polygon",
|
|
419
|
+
* });
|
|
420
|
+
* console.log(data.balance); // "50.00"
|
|
421
|
+
*/
|
|
422
|
+
balance(walletId: string, params: StablecoinBalanceParams): Promise<VaultKeyResponse<StablecoinBalanceResult>>;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* Chain discovery — list supported chains for the current environment.
|
|
427
|
+
*
|
|
428
|
+
* Use this to build chain selectors in your UI or to validate
|
|
429
|
+
* chain names before passing them to other SDK methods.
|
|
430
|
+
*
|
|
431
|
+
* @example
|
|
432
|
+
* const { data } = await vaultkey.chains.list();
|
|
433
|
+
* // [{ name: "base", chainId: "8453", nativeSymbol: "ETH", testnet: false }, ...]
|
|
434
|
+
*/
|
|
435
|
+
declare class Chains {
|
|
436
|
+
private readonly client;
|
|
437
|
+
constructor(client: VaultKey);
|
|
438
|
+
/**
|
|
439
|
+
* List all supported EVM chains for the current environment
|
|
440
|
+
* (testnet or mainnet, determined by your API key).
|
|
441
|
+
*
|
|
442
|
+
* @example
|
|
443
|
+
* const { data, error } = await vaultkey.chains.list();
|
|
444
|
+
*/
|
|
445
|
+
list(): Promise<VaultKeyResponse<Chain[]>>;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
type RequestOptions = {
|
|
449
|
+
headers?: HeadersInit;
|
|
450
|
+
};
|
|
451
|
+
interface VaultKeyConfig {
|
|
452
|
+
/**
|
|
453
|
+
* Your VaultKey API key.
|
|
454
|
+
* Testnet keys start with `testnet_`, live keys start with `vk_live_`.
|
|
455
|
+
* Falls back to the VAULTKEY_API_KEY environment variable.
|
|
456
|
+
*
|
|
457
|
+
* The SDK automatically routes requests to the correct endpoint:
|
|
458
|
+
* - `testnet_` → https://testnet.vaultkeys.dev
|
|
459
|
+
* - `vk_live_` → https://app.vaultkeys.dev
|
|
460
|
+
*/
|
|
461
|
+
apiKey?: string;
|
|
462
|
+
/**
|
|
463
|
+
* Your VaultKey API secret.
|
|
464
|
+
* Falls back to the VAULTKEY_API_SECRET environment variable.
|
|
465
|
+
*/
|
|
466
|
+
apiSecret?: string;
|
|
467
|
+
/**
|
|
468
|
+
* Override the base URL. Useful for self-hosted deployments or proxies.
|
|
469
|
+
* When set, this takes precedence over the automatic key-based routing.
|
|
470
|
+
*/
|
|
471
|
+
baseUrl?: string;
|
|
472
|
+
}
|
|
473
|
+
declare class VaultKey {
|
|
474
|
+
private readonly apiKey;
|
|
475
|
+
private readonly apiSecret;
|
|
476
|
+
readonly baseUrl: string;
|
|
477
|
+
/** Wallet management — create, retrieve, and list wallets. */
|
|
478
|
+
readonly wallets: Wallets;
|
|
479
|
+
/** Async job polling — check the status of signing and sweep operations. */
|
|
480
|
+
readonly jobs: Jobs;
|
|
481
|
+
/** Stablecoin transfers and balance lookups (USDC, USDT). */
|
|
482
|
+
readonly stablecoin: Stablecoin;
|
|
483
|
+
/** Chain discovery — list supported EVM chains for the current environment. */
|
|
484
|
+
readonly chains: Chains;
|
|
485
|
+
constructor(config?: VaultKeyConfig);
|
|
486
|
+
fetchRequest<T>(path: string, options?: RequestInit): Promise<{
|
|
487
|
+
data: T | null;
|
|
488
|
+
error: ErrorResponse | null;
|
|
489
|
+
}>;
|
|
490
|
+
get<T>(path: string, options?: RequestOptions): Promise<{
|
|
491
|
+
data: T | null;
|
|
492
|
+
error: ErrorResponse | null;
|
|
493
|
+
}>;
|
|
494
|
+
post<T>(path: string, body: unknown, options?: RequestOptions): Promise<{
|
|
495
|
+
data: T | null;
|
|
496
|
+
error: ErrorResponse | null;
|
|
497
|
+
}>;
|
|
498
|
+
put<T>(path: string, body: unknown, options?: RequestOptions): Promise<{
|
|
499
|
+
data: T | null;
|
|
500
|
+
error: ErrorResponse | null;
|
|
501
|
+
}>;
|
|
502
|
+
patch<T>(path: string, body: unknown, options?: RequestOptions): Promise<{
|
|
503
|
+
data: T | null;
|
|
504
|
+
error: ErrorResponse | null;
|
|
505
|
+
}>;
|
|
506
|
+
delete<T>(path: string, body?: unknown, options?: RequestOptions): Promise<{
|
|
507
|
+
data: T | null;
|
|
508
|
+
error: ErrorResponse | null;
|
|
509
|
+
}>;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
export { type BroadcastEVMResult, type BroadcastSolanaResult, type Chain, type ChainName, type ChainType, Chains, type CreateWalletParams, type EVMBalanceResult, type EVMChainParams, type ErrorResponse, type Job, Jobs, type ListWalletsResult, type PaginationParams, type SignEVMMessageParams, type SignSolanaMessageParams, Signing, type SigningJob, type SolanaBalanceResult, Stablecoin, type StablecoinBalanceParams, type StablecoinBalanceResult, type StablecoinToken, type StablecoinTransferParams, type StablecoinTransferResult, type SweepParams, type TransferSpeed, VaultKey, type VaultKeyConfig, type VaultKeyResponse, type Wallet, Wallets };
|