@moonpay/cli 0.5.2 → 0.6.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.
@@ -2,36 +2,32 @@ import { createRequire as __createRequire } from "module"; const require = __cre
2
2
  import {
3
3
  KEY_CHAIN_MAP,
4
4
  addWallet,
5
+ addressesSchema,
5
6
  chainSchema,
7
+ decrypt,
6
8
  deriveAllAddresses,
9
+ encrypt,
10
+ encryptedFileSchema,
11
+ ensureEncryptionKey,
7
12
  findWalletOrThrow,
13
+ getEncryptionKey,
8
14
  keyChainSchema,
9
15
  loadWallets,
10
16
  removeWallet,
11
17
  resolveSigningKey,
12
18
  walletInfoSchema
13
- } from "./chunk-V7MA7WNX.js";
19
+ } from "./chunk-GSAFAKB7.js";
14
20
 
15
21
  // src/auth.ts
16
- import { spawn } from "child_process";
17
- import * as crypto from "crypto";
18
22
  import * as fs from "fs";
19
23
  import * as os from "os";
20
24
  import * as path from "path";
21
- import { createInterface } from "readline";
22
- function generateCodeVerifier() {
23
- return crypto.randomBytes(32).toString("base64url");
24
- }
25
- function generateCodeChallenge(verifier) {
26
- return crypto.createHash("sha256").update(verifier).digest("base64url");
27
- }
28
25
  var CONFIG_DIR = path.join(os.homedir(), ".config", "moonpay");
29
26
  var CONFIG_PATH = path.join(CONFIG_DIR, "config.json");
30
27
  var CREDENTIALS_PATH = path.join(CONFIG_DIR, "credentials.json");
31
28
  var LOCK_PATH = path.join(CONFIG_DIR, ".credentials.lock");
32
29
  var DEFAULT_CONFIG = {
33
- baseUrl: "https://agents.moonpay.com",
34
- clientId: "mooniq_zin3s5jz3olzkdfxpmbeaogv"
30
+ baseUrl: "https://agents.moonpay.com"
35
31
  };
36
32
  function ensureConfigDir() {
37
33
  if (!fs.existsSync(CONFIG_DIR)) {
@@ -47,7 +43,11 @@ var LOCK_STALE_MS = 3e4;
47
43
  function acquireLock() {
48
44
  ensureConfigDir();
49
45
  try {
50
- const fd = fs.openSync(LOCK_PATH, fs.constants.O_CREAT | fs.constants.O_EXCL | fs.constants.O_WRONLY, 384);
46
+ const fd = fs.openSync(
47
+ LOCK_PATH,
48
+ fs.constants.O_CREAT | fs.constants.O_EXCL | fs.constants.O_WRONLY,
49
+ 384
50
+ );
51
51
  fs.writeSync(fd, JSON.stringify({ pid: process.pid, ts: Date.now() }));
52
52
  fs.closeSync(fd);
53
53
  } catch (err) {
@@ -64,7 +64,11 @@ function acquireLock() {
64
64
  } catch {
65
65
  }
66
66
  try {
67
- const fd = fs.openSync(LOCK_PATH, fs.constants.O_CREAT | fs.constants.O_EXCL | fs.constants.O_WRONLY, 384);
67
+ const fd = fs.openSync(
68
+ LOCK_PATH,
69
+ fs.constants.O_CREAT | fs.constants.O_EXCL | fs.constants.O_WRONLY,
70
+ 384
71
+ );
68
72
  fs.writeSync(fd, JSON.stringify({ pid: process.pid, ts: Date.now() }));
69
73
  fs.closeSync(fd);
70
74
  } catch {
@@ -82,7 +86,7 @@ function getConfig() {
82
86
  if (!fs.existsSync(CONFIG_PATH)) return null;
83
87
  try {
84
88
  const data = JSON.parse(fs.readFileSync(CONFIG_PATH, "utf-8"));
85
- if (!data.baseUrl || !data.clientId) return null;
89
+ if (!data.baseUrl) return null;
86
90
  return data;
87
91
  } catch {
88
92
  return null;
@@ -96,8 +100,13 @@ function getConfigOrDefault() {
96
100
  }
97
101
  function getCredentials() {
98
102
  if (!fs.existsSync(CREDENTIALS_PATH)) return null;
103
+ const encryptionKey = getEncryptionKey();
104
+ if (!encryptionKey) return null;
99
105
  try {
100
- const data = JSON.parse(fs.readFileSync(CREDENTIALS_PATH, "utf-8"));
106
+ const raw = JSON.parse(fs.readFileSync(CREDENTIALS_PATH, "utf-8"));
107
+ const file = encryptedFileSchema.parse(raw);
108
+ const decrypted = decrypt(file, encryptionKey);
109
+ const data = JSON.parse(decrypted);
101
110
  if (!data.accessToken || !data.baseUrl) return null;
102
111
  return data;
103
112
  } catch {
@@ -105,8 +114,10 @@ function getCredentials() {
105
114
  }
106
115
  }
107
116
  function saveCredentials(creds) {
117
+ const encryptionKey = ensureEncryptionKey();
118
+ const file = encrypt(JSON.stringify(creds), encryptionKey);
108
119
  ensureConfigDir();
109
- atomicWriteFileSync(CREDENTIALS_PATH, JSON.stringify(creds, null, 2), 384);
120
+ atomicWriteFileSync(CREDENTIALS_PATH, JSON.stringify(file, null, 2), 384);
110
121
  }
111
122
  function saveConfig(config) {
112
123
  ensureConfigDir();
@@ -122,122 +133,24 @@ function resolveBaseUrl() {
122
133
  const creds = getCredentials();
123
134
  return config?.baseUrl ?? creds?.baseUrl ?? DEFAULT_CONFIG.baseUrl;
124
135
  }
125
- function openBrowser(url) {
126
- const platform2 = process.platform;
127
- const cmd = platform2 === "darwin" ? "open" : platform2 === "win32" ? "cmd" : "xdg-open";
128
- const args = platform2 === "win32" ? ["/c", "start", "", url] : [url];
129
- try {
130
- spawn(cmd, args, { stdio: "ignore", detached: true }).unref();
131
- return true;
132
- } catch {
133
- return false;
134
- }
135
- }
136
- function promptLine(prompt) {
137
- const rl = createInterface({ input: process.stdin, output: process.stderr });
138
- return new Promise((resolve) => {
139
- rl.question(prompt, (answer) => {
140
- rl.close();
141
- resolve(answer.trim());
142
- });
143
- });
144
- }
145
- var LOGIN_STATE_PATH = path.join(CONFIG_DIR, ".login-state.json");
146
- async function login(config, options = {}) {
147
- const callbackUrl = `${config.baseUrl}/callback`;
148
- if (options.code) {
149
- const stateData = loadLoginState();
150
- if (!stateData) {
151
- throw new Error("No pending login found. Run `mp login --no-browser` first.");
136
+ async function callPublicTool(baseUrl, toolName, params) {
137
+ const res = await fetch(
138
+ `${baseUrl}/api/tools/${encodeURIComponent(toolName)}`,
139
+ {
140
+ method: "POST",
141
+ signal: AbortSignal.timeout(15e3),
142
+ headers: { "Content-Type": "application/json" },
143
+ body: JSON.stringify(params)
152
144
  }
153
- return exchangeCode(config, options.code, callbackUrl, stateData.codeVerifier);
154
- }
155
- const state = crypto.randomUUID();
156
- const usePkce = !config.clientSecret;
157
- let codeVerifier;
158
- if (usePkce) {
159
- codeVerifier = generateCodeVerifier();
160
- }
161
- const authorizeParams = new URLSearchParams({
162
- client_id: config.clientId,
163
- redirect_uri: callbackUrl,
164
- response_type: "code",
165
- scope: "profile email",
166
- state
167
- });
168
- if (usePkce && codeVerifier) {
169
- authorizeParams.set("code_challenge", generateCodeChallenge(codeVerifier));
170
- authorizeParams.set("code_challenge_method", "S256");
171
- }
172
- const authorizeUrl = `${config.baseUrl}/authorize?${authorizeParams.toString()}`;
173
- saveLoginState({ state, codeVerifier: codeVerifier ?? null });
174
- const opened = options.noBrowser ? false : openBrowser(authorizeUrl);
175
- console.log("Open this URL in your browser to log in:\n");
176
- console.log(` ${authorizeUrl}
177
- `);
178
- if (options.noBrowser) {
179
- console.log(`To open in the user's browser, run: open "<url>" (macOS) or xdg-open "<url>" (Linux)`);
180
- console.log("The user clicks Allow, then copies the code from the callback page.");
181
- console.log("Complete login with:\n");
182
- console.log(" mp login --code <paste-code-here>\n");
183
- process.exit(0);
184
- }
185
- const code = await promptLine("Paste code: ");
186
- if (!code) {
187
- throw new Error("No authorization code provided.");
188
- }
189
- return exchangeCode(config, code, callbackUrl, codeVerifier ?? null);
190
- }
191
- function saveLoginState(state) {
192
- ensureConfigDir();
193
- atomicWriteFileSync(LOGIN_STATE_PATH, JSON.stringify(state), 384);
194
- }
195
- function loadLoginState() {
196
- if (!fs.existsSync(LOGIN_STATE_PATH)) return null;
197
- try {
198
- const data = JSON.parse(fs.readFileSync(LOGIN_STATE_PATH, "utf-8"));
199
- fs.unlinkSync(LOGIN_STATE_PATH);
200
- return data;
201
- } catch {
202
- return null;
203
- }
204
- }
205
- async function exchangeCode(config, code, callbackUrl, codeVerifier) {
206
- const tokenParams = {
207
- grant_type: "authorization_code",
208
- code,
209
- client_id: config.clientId,
210
- redirect_uri: callbackUrl
211
- };
212
- if (config.clientSecret) {
213
- tokenParams.client_secret = config.clientSecret;
214
- }
215
- if (codeVerifier) {
216
- tokenParams.code_verifier = codeVerifier;
217
- }
218
- const tokenResponse = await fetch(`${config.baseUrl}/api/oauth/token`, {
219
- method: "POST",
220
- signal: AbortSignal.timeout(15e3),
221
- headers: { "Content-Type": "application/x-www-form-urlencoded" },
222
- body: new URLSearchParams(tokenParams)
223
- });
224
- if (!tokenResponse.ok) {
225
- const err = await tokenResponse.json().catch(() => ({}));
226
- const msg = err.error_description ?? err.error ?? tokenResponse.statusText;
227
- throw new Error(`Token exchange failed: ${msg}`);
145
+ );
146
+ const data = await res.json();
147
+ if (!res.ok) {
148
+ const err = data;
149
+ throw new Error(err?.error ?? `${toolName} failed (${res.status})`);
228
150
  }
229
- const tokens = await tokenResponse.json();
230
- const expiresAt = Date.now() + (tokens.expires_in ?? 3600) * 1e3;
231
- const creds = {
232
- accessToken: tokens.access_token,
233
- refreshToken: tokens.refresh_token ?? null,
234
- expiresAt,
235
- baseUrl: config.baseUrl
236
- };
237
- saveCredentials(creds);
238
- return creds;
151
+ return data;
239
152
  }
240
- async function refreshCredentials(creds, config) {
153
+ async function refreshCredentials(creds) {
241
154
  if (!creds.refreshToken) {
242
155
  throw new Error("No refresh token available");
243
156
  }
@@ -255,30 +168,14 @@ async function refreshCredentials(creds, config) {
255
168
  if (latest && latest.expiresAt > Date.now() + 6e4) {
256
169
  return latest;
257
170
  }
258
- const refreshParams = {
259
- grant_type: "refresh_token",
260
- refresh_token: creds.refreshToken,
261
- client_id: config.clientId
262
- };
263
- if (config.clientSecret) {
264
- refreshParams.client_secret = config.clientSecret;
265
- }
266
- const tokenResponse = await fetch(`${config.baseUrl}/api/oauth/token`, {
267
- method: "POST",
268
- signal: AbortSignal.timeout(15e3),
269
- headers: { "Content-Type": "application/x-www-form-urlencoded" },
270
- body: new URLSearchParams(refreshParams)
171
+ const tokens = await callPublicTool(creds.baseUrl, "refresh", {
172
+ refreshToken: creds.refreshToken
271
173
  });
272
- if (!tokenResponse.ok) {
273
- throw new Error("Token refresh failed");
274
- }
275
- const tokens = await tokenResponse.json();
276
- const expiresAt = Date.now() + (tokens.expires_in ?? 3600) * 1e3;
277
174
  const newCreds = {
278
- accessToken: tokens.access_token,
279
- refreshToken: tokens.refresh_token ?? creds.refreshToken,
280
- expiresAt,
281
- baseUrl: config.baseUrl
175
+ accessToken: tokens.accessToken,
176
+ refreshToken: tokens.refreshToken,
177
+ expiresAt: tokens.expiresAt * 1e3,
178
+ baseUrl: creds.baseUrl
282
179
  };
283
180
  saveCredentials(newCreds);
284
181
  return newCreds;
@@ -290,12 +187,10 @@ var TOKEN_EXPIRY_BUFFER_MS = 5 * 60 * 1e3;
290
187
  async function getValidToken() {
291
188
  const creds = getCredentials();
292
189
  if (!creds) return null;
293
- const config = getConfig();
294
- if (!config || config.baseUrl !== creds.baseUrl) return null;
295
190
  if (Date.now() >= creds.expiresAt - TOKEN_EXPIRY_BUFFER_MS) {
296
191
  if (creds.refreshToken) {
297
192
  try {
298
- const newCreds = await refreshCredentials(creds, config);
193
+ const newCreds = await refreshCredentials(creds);
299
194
  return newCreds.accessToken;
300
195
  } catch {
301
196
  return null;
@@ -317,17 +212,18 @@ async function callTool(baseUrl, toolName, params) {
317
212
  }
318
213
  let res = await fetch(`${baseUrl}/api/tools/${encodeURIComponent(toolName)}`, {
319
214
  method: "POST",
215
+ signal: AbortSignal.timeout(6e4),
320
216
  headers,
321
217
  body: JSON.stringify(params)
322
218
  });
323
219
  if (res.status === 401 && token) {
324
220
  const creds = getCredentials();
325
- const config = getConfig();
326
- if (creds?.refreshToken && config && config.baseUrl === creds.baseUrl) {
221
+ if (creds?.refreshToken) {
327
222
  try {
328
- const newCreds = await refreshCredentials(creds, config);
223
+ const newCreds = await refreshCredentials(creds);
329
224
  res = await fetch(`${baseUrl}/api/tools/${encodeURIComponent(toolName)}`, {
330
225
  method: "POST",
226
+ signal: AbortSignal.timeout(6e4),
331
227
  headers: {
332
228
  "Content-Type": "application/json",
333
229
  Authorization: `Bearer ${newCreds.accessToken}`
@@ -369,19 +265,21 @@ var schemas_default = [
369
265
  "btc",
370
266
  "pol_polygon",
371
267
  "sol",
268
+ "trx",
372
269
  "usdc",
373
270
  "usdc_arbitrum",
374
271
  "usdc_base",
375
272
  "usdc_optimism",
376
273
  "usdc_sol",
377
274
  "usdc_polygon",
275
+ "usdt_trx",
378
276
  "eth",
379
277
  "eth_polygon",
380
278
  "eth_optimism",
381
279
  "eth_base",
382
280
  "eth_arbitrum"
383
281
  ],
384
- description: "MoonPay currency code: sol (Solana), usdc_sol (USDC on Solana), eth (Ethereum), usdc (USDC on Ethereum), usdc_base (USDC on Base), etc."
282
+ description: "MoonPay currency code: sol (Solana), usdc_sol (USDC on Solana), eth (Ethereum), usdc (USDC on Ethereum), usdc_base (USDC on Base), trx (TRX on Tron), usdt_trx (USDT on Tron), etc."
385
283
  },
386
284
  amount: {
387
285
  type: "number",
@@ -389,7 +287,7 @@ var schemas_default = [
389
287
  },
390
288
  wallet: {
391
289
  type: "string",
392
- description: "Destination wallet address to receive the tokens"
290
+ description: "Destination wallet address to receive tokens (must match the chain for the selected token)"
393
291
  },
394
292
  email: {
395
293
  type: [
@@ -430,6 +328,97 @@ var schemas_default = [
430
328
  $schema: "http://json-schema.org/draft-07/schema#"
431
329
  }
432
330
  },
331
+ {
332
+ name: "login",
333
+ description: "Send a verification code to the provided email to sign in or create an account.",
334
+ inputSchema: {
335
+ $ref: "#/definitions/login_input",
336
+ definitions: {
337
+ login_input: {
338
+ type: "object",
339
+ properties: {
340
+ email: {
341
+ type: "string",
342
+ description: "The email of the user to login"
343
+ }
344
+ },
345
+ required: [
346
+ "email"
347
+ ],
348
+ additionalProperties: false
349
+ }
350
+ },
351
+ $schema: "http://json-schema.org/draft-07/schema#"
352
+ },
353
+ outputSchema: {
354
+ $ref: "#/definitions/login_output",
355
+ definitions: {
356
+ login_output: {
357
+ type: "object",
358
+ properties: {
359
+ email: {
360
+ type: "string",
361
+ description: "The email the OTP was sent to"
362
+ }
363
+ },
364
+ required: [
365
+ "email"
366
+ ],
367
+ additionalProperties: false
368
+ }
369
+ },
370
+ $schema: "http://json-schema.org/draft-07/schema#"
371
+ }
372
+ },
373
+ {
374
+ name: "refresh",
375
+ description: "Refresh an expired access token using a refresh token.",
376
+ inputSchema: {
377
+ $ref: "#/definitions/refresh_input",
378
+ definitions: {
379
+ refresh_input: {
380
+ type: "object",
381
+ properties: {
382
+ refreshToken: {
383
+ type: "string",
384
+ description: "The refresh token from a previous login"
385
+ }
386
+ },
387
+ required: [
388
+ "refreshToken"
389
+ ],
390
+ additionalProperties: false
391
+ }
392
+ },
393
+ $schema: "http://json-schema.org/draft-07/schema#"
394
+ },
395
+ outputSchema: {
396
+ $ref: "#/definitions/refresh_output",
397
+ definitions: {
398
+ refresh_output: {
399
+ type: "object",
400
+ properties: {
401
+ accessToken: {
402
+ type: "string"
403
+ },
404
+ refreshToken: {
405
+ type: "string"
406
+ },
407
+ expiresAt: {
408
+ type: "number"
409
+ }
410
+ },
411
+ required: [
412
+ "accessToken",
413
+ "refreshToken",
414
+ "expiresAt"
415
+ ],
416
+ additionalProperties: false
417
+ }
418
+ },
419
+ $schema: "http://json-schema.org/draft-07/schema#"
420
+ }
421
+ },
433
422
  {
434
423
  name: "swaps_transaction_build",
435
424
  description: "Build a swap or bridge transaction. Returns an unsigned transaction with a human-readable message, amounts, exchange rate, and estimated time. Supports same-chain swaps and cross-chain bridges. Accepts UI amounts (e.g. 0.1 SOL) \u2014 decimal conversion is handled automatically.",
@@ -444,7 +433,7 @@ var schemas_default = [
444
433
  properties: {
445
434
  wallet: {
446
435
  type: "string",
447
- description: "Source wallet address"
436
+ description: "Source wallet address (Solana pubkey or EVM 0x address)"
448
437
  },
449
438
  chain: {
450
439
  type: "string",
@@ -464,7 +453,7 @@ var schemas_default = [
464
453
  },
465
454
  token: {
466
455
  type: "string",
467
- description: "Source token address"
456
+ description: "Source token address (mint on Solana, contract on EVM). Use native token address for SOL/ETH."
468
457
  },
469
458
  amount: {
470
459
  type: [
@@ -488,7 +477,7 @@ var schemas_default = [
488
477
  properties: {
489
478
  wallet: {
490
479
  type: "string",
491
- description: "Destination wallet address"
480
+ description: "Destination wallet address. Same as source wallet for same-chain swaps."
492
481
  },
493
482
  chain: {
494
483
  type: "string",
@@ -508,7 +497,7 @@ var schemas_default = [
508
497
  },
509
498
  token: {
510
499
  type: "string",
511
- description: "Destination token address"
500
+ description: "Destination token address (mint on Solana, contract on EVM)"
512
501
  },
513
502
  amount: {
514
503
  type: [
@@ -611,7 +600,12 @@ var schemas_default = [
611
600
  type: "object",
612
601
  properties: {
613
602
  amount: {
614
- type: "number"
603
+ type: "number",
604
+ description: "Human-readable amount (e.g. 1.5)"
605
+ },
606
+ raw: {
607
+ type: "string",
608
+ description: "Raw amount in smallest unit (e.g. wei, lamports)"
615
609
  },
616
610
  symbol: {
617
611
  type: "string"
@@ -625,6 +619,7 @@ var schemas_default = [
625
619
  },
626
620
  required: [
627
621
  "amount",
622
+ "raw",
628
623
  "symbol",
629
624
  "usd"
630
625
  ],
@@ -634,7 +629,12 @@ var schemas_default = [
634
629
  type: "object",
635
630
  properties: {
636
631
  amount: {
637
- type: "number"
632
+ type: "number",
633
+ description: "Human-readable amount (e.g. 1.5)"
634
+ },
635
+ raw: {
636
+ type: "string",
637
+ description: "Raw amount in smallest unit (e.g. wei, lamports)"
638
638
  },
639
639
  symbol: {
640
640
  type: "string"
@@ -648,6 +648,7 @@ var schemas_default = [
648
648
  },
649
649
  required: [
650
650
  "amount",
651
+ "raw",
651
652
  "symbol",
652
653
  "usd"
653
654
  ],
@@ -3032,10 +3033,12 @@ var schemas_default = [
3032
3033
  type: "object",
3033
3034
  properties: {
3034
3035
  signature: {
3035
- type: "string"
3036
+ type: "string",
3037
+ description: "Transaction signature. Absent if execution failed."
3036
3038
  },
3037
3039
  message: {
3038
- type: "string"
3040
+ type: "string",
3041
+ description: "Result message or error description"
3039
3042
  }
3040
3043
  },
3041
3044
  required: [
@@ -3058,15 +3061,15 @@ var schemas_default = [
3058
3061
  properties: {
3059
3062
  wallet: {
3060
3063
  type: "string",
3061
- description: "Wallet address to transfer from"
3064
+ description: "Sender wallet address (Solana pubkey or EVM 0x address)"
3062
3065
  },
3063
3066
  token: {
3064
3067
  type: "string",
3065
- description: "Mint address of the token to transfer"
3068
+ description: "Token address (mint on Solana, contract on EVM). Use native token address for SOL/ETH."
3066
3069
  },
3067
3070
  to: {
3068
3071
  type: "string",
3069
- description: "Recipient wallet address"
3072
+ description: "Recipient wallet address or name"
3070
3073
  },
3071
3074
  amount: {
3072
3075
  type: "number",
@@ -3163,7 +3166,8 @@ var schemas_default = [
3163
3166
  ]
3164
3167
  },
3165
3168
  message: {
3166
- type: "string"
3169
+ type: "string",
3170
+ description: "Human-readable description of the transfer"
3167
3171
  }
3168
3172
  },
3169
3173
  required: [
@@ -4297,35 +4301,42 @@ var schemas_default = [
4297
4301
  type: "object",
4298
4302
  properties: {
4299
4303
  transactionId: {
4300
- type: "string"
4304
+ type: "string",
4305
+ description: "Transaction tracking ID"
4301
4306
  },
4302
4307
  status: {
4303
- type: "string"
4308
+ type: "string",
4309
+ description: "Current status: pending, success, or failed"
4304
4310
  },
4305
4311
  type: {
4306
4312
  type: "string",
4307
4313
  enum: [
4308
4314
  "swap",
4309
4315
  "bridge"
4310
- ]
4316
+ ],
4317
+ description: "Transaction type"
4311
4318
  },
4312
4319
  from: {
4313
4320
  type: "object",
4314
4321
  properties: {
4315
4322
  chain: {
4316
- type: "string"
4323
+ type: "string",
4324
+ description: "Source blockchain"
4317
4325
  },
4318
4326
  token: {
4319
- type: "string"
4327
+ type: "string",
4328
+ description: "Source token symbol"
4320
4329
  },
4321
4330
  amount: {
4322
4331
  type: [
4323
4332
  "number",
4324
4333
  "null"
4325
- ]
4334
+ ],
4335
+ description: "Amount sent"
4326
4336
  },
4327
4337
  txHash: {
4328
- type: "string"
4338
+ type: "string",
4339
+ description: "Source chain transaction hash"
4329
4340
  }
4330
4341
  },
4331
4342
  required: [
@@ -4340,22 +4351,26 @@ var schemas_default = [
4340
4351
  type: "object",
4341
4352
  properties: {
4342
4353
  chain: {
4343
- type: "string"
4354
+ type: "string",
4355
+ description: "Destination blockchain"
4344
4356
  },
4345
4357
  token: {
4346
- type: "string"
4358
+ type: "string",
4359
+ description: "Destination token symbol"
4347
4360
  },
4348
4361
  amount: {
4349
4362
  type: [
4350
4363
  "number",
4351
4364
  "null"
4352
- ]
4365
+ ],
4366
+ description: "Amount received"
4353
4367
  },
4354
4368
  txHash: {
4355
4369
  type: [
4356
4370
  "string",
4357
4371
  "null"
4358
- ]
4372
+ ],
4373
+ description: "Destination chain transaction hash"
4359
4374
  }
4360
4375
  },
4361
4376
  required: [
@@ -4370,13 +4385,15 @@ var schemas_default = [
4370
4385
  type: [
4371
4386
  "number",
4372
4387
  "null"
4373
- ]
4388
+ ],
4389
+ description: "USD value of the transaction"
4374
4390
  },
4375
4391
  bridgeTime: {
4376
4392
  type: [
4377
4393
  "number",
4378
4394
  "null"
4379
- ]
4395
+ ],
4396
+ description: "Bridge completion time in seconds"
4380
4397
  }
4381
4398
  },
4382
4399
  required: [
@@ -4389,7 +4406,8 @@ var schemas_default = [
4389
4406
  "bridgeTime"
4390
4407
  ],
4391
4408
  additionalProperties: false
4392
- }
4409
+ },
4410
+ description: "List of swap/bridge transactions"
4393
4411
  }
4394
4412
  },
4395
4413
  required: [
@@ -4494,35 +4512,42 @@ var schemas_default = [
4494
4512
  type: "object",
4495
4513
  properties: {
4496
4514
  transactionId: {
4497
- type: "string"
4515
+ type: "string",
4516
+ description: "Transaction tracking ID"
4498
4517
  },
4499
4518
  status: {
4500
- type: "string"
4519
+ type: "string",
4520
+ description: "Current status: pending, success, or failed"
4501
4521
  },
4502
4522
  type: {
4503
4523
  type: "string",
4504
4524
  enum: [
4505
4525
  "swap",
4506
4526
  "bridge"
4507
- ]
4527
+ ],
4528
+ description: "Transaction type"
4508
4529
  },
4509
4530
  from: {
4510
4531
  type: "object",
4511
4532
  properties: {
4512
4533
  chain: {
4513
- type: "string"
4534
+ type: "string",
4535
+ description: "Source blockchain"
4514
4536
  },
4515
4537
  token: {
4516
- type: "string"
4538
+ type: "string",
4539
+ description: "Source token symbol"
4517
4540
  },
4518
4541
  amount: {
4519
4542
  type: [
4520
4543
  "number",
4521
4544
  "null"
4522
- ]
4545
+ ],
4546
+ description: "Amount sent"
4523
4547
  },
4524
4548
  txHash: {
4525
- type: "string"
4549
+ type: "string",
4550
+ description: "Source chain transaction hash"
4526
4551
  }
4527
4552
  },
4528
4553
  required: [
@@ -4537,22 +4562,26 @@ var schemas_default = [
4537
4562
  type: "object",
4538
4563
  properties: {
4539
4564
  chain: {
4540
- type: "string"
4565
+ type: "string",
4566
+ description: "Destination blockchain"
4541
4567
  },
4542
4568
  token: {
4543
- type: "string"
4569
+ type: "string",
4570
+ description: "Destination token symbol"
4544
4571
  },
4545
4572
  amount: {
4546
4573
  type: [
4547
4574
  "number",
4548
4575
  "null"
4549
- ]
4576
+ ],
4577
+ description: "Amount received"
4550
4578
  },
4551
4579
  txHash: {
4552
4580
  type: [
4553
4581
  "string",
4554
4582
  "null"
4555
- ]
4583
+ ],
4584
+ description: "Destination chain transaction hash. Null while bridge is in progress."
4556
4585
  }
4557
4586
  },
4558
4587
  required: [
@@ -4567,13 +4596,15 @@ var schemas_default = [
4567
4596
  type: [
4568
4597
  "number",
4569
4598
  "null"
4570
- ]
4599
+ ],
4600
+ description: "USD value of the transaction"
4571
4601
  },
4572
4602
  bridgeTime: {
4573
4603
  type: [
4574
4604
  "number",
4575
4605
  "null"
4576
- ]
4606
+ ],
4607
+ description: "Bridge completion time in seconds. Null for same-chain swaps."
4577
4608
  }
4578
4609
  },
4579
4610
  required: [
@@ -4642,10 +4673,12 @@ var schemas_default = [
4642
4673
  type: "object",
4643
4674
  properties: {
4644
4675
  signature: {
4645
- type: "string"
4676
+ type: "string",
4677
+ description: "Transaction signature/hash. Absent if broadcast failed."
4646
4678
  },
4647
4679
  message: {
4648
- type: "string"
4680
+ type: "string",
4681
+ description: "Result message or error description"
4649
4682
  }
4650
4683
  },
4651
4684
  required: [
@@ -4678,13 +4711,15 @@ var schemas_default = [
4678
4711
  type: "object",
4679
4712
  properties: {
4680
4713
  id: {
4681
- type: "string"
4714
+ type: "string",
4715
+ description: "User ID"
4682
4716
  },
4683
4717
  email: {
4684
4718
  type: [
4685
4719
  "string",
4686
4720
  "null"
4687
- ]
4721
+ ],
4722
+ description: "User email address"
4688
4723
  }
4689
4724
  },
4690
4725
  required: [
@@ -4698,61 +4733,52 @@ var schemas_default = [
4698
4733
  }
4699
4734
  },
4700
4735
  {
4701
- name: "virtual-account_create",
4702
- description: "Create a virtual account and start KYC verification",
4736
+ name: "verify",
4737
+ description: "Verify a login code for the user.",
4703
4738
  inputSchema: {
4704
- $ref: "#/definitions/virtual-account_create_input",
4739
+ $ref: "#/definitions/verify_input",
4705
4740
  definitions: {
4706
- "virtual-account_create_input": {
4741
+ verify_input: {
4707
4742
  type: "object",
4708
- properties: {},
4743
+ properties: {
4744
+ code: {
4745
+ type: "string",
4746
+ description: "The code to verify"
4747
+ },
4748
+ email: {
4749
+ type: "string",
4750
+ description: "The email the OTP was sent to"
4751
+ }
4752
+ },
4753
+ required: [
4754
+ "code",
4755
+ "email"
4756
+ ],
4709
4757
  additionalProperties: false
4710
4758
  }
4711
4759
  },
4712
4760
  $schema: "http://json-schema.org/draft-07/schema#"
4713
4761
  },
4714
4762
  outputSchema: {
4715
- $ref: "#/definitions/virtual-account_create_output",
4763
+ $ref: "#/definitions/verify_output",
4716
4764
  definitions: {
4717
- "virtual-account_create_output": {
4765
+ verify_output: {
4718
4766
  type: "object",
4719
4767
  properties: {
4720
- id: {
4768
+ accessToken: {
4721
4769
  type: "string"
4722
4770
  },
4723
- email: {
4771
+ refreshToken: {
4724
4772
  type: "string"
4725
4773
  },
4726
- customerType: {
4727
- type: "string",
4728
- enum: [
4729
- "Person",
4730
- "Business"
4731
- ]
4732
- },
4733
- status: {
4734
- type: "string",
4735
- enum: [
4736
- "UserRequired",
4737
- "SigningsRequired",
4738
- "IdentificationRequired",
4739
- "Active",
4740
- "Suspended"
4741
- ]
4742
- },
4743
- nextStep: {
4744
- type: [
4745
- "string",
4746
- "null"
4747
- ]
4774
+ expiresAt: {
4775
+ type: "number"
4748
4776
  }
4749
4777
  },
4750
4778
  required: [
4751
- "id",
4752
- "email",
4753
- "customerType",
4754
- "status",
4755
- "nextStep"
4779
+ "accessToken",
4780
+ "refreshToken",
4781
+ "expiresAt"
4756
4782
  ],
4757
4783
  additionalProperties: false
4758
4784
  }
@@ -4761,32 +4787,56 @@ var schemas_default = [
4761
4787
  }
4762
4788
  },
4763
4789
  {
4764
- name: "virtual-account_delete",
4765
- description: "Delete your virtual account",
4790
+ name: "virtual-account_agreement_accept",
4791
+ description: "Accept a required legal agreement. Pass the content ID from virtual-account_agreement_list to mark the agreement as accepted.",
4766
4792
  inputSchema: {
4767
- $ref: "#/definitions/virtual-account_delete_input",
4793
+ $ref: "#/definitions/virtual-account_agreement_accept_input",
4768
4794
  definitions: {
4769
- "virtual-account_delete_input": {
4795
+ "virtual-account_agreement_accept_input": {
4770
4796
  type: "object",
4771
- properties: {},
4797
+ properties: {
4798
+ contentId: {
4799
+ type: "string",
4800
+ description: "Content ID from virtual-account_agreement_list"
4801
+ }
4802
+ },
4803
+ required: [
4804
+ "contentId"
4805
+ ],
4772
4806
  additionalProperties: false
4773
4807
  }
4774
4808
  },
4775
4809
  $schema: "http://json-schema.org/draft-07/schema#"
4776
4810
  },
4777
4811
  outputSchema: {
4778
- $ref: "#/definitions/virtual-account_delete_output",
4812
+ $ref: "#/definitions/virtual-account_agreement_accept_output",
4779
4813
  definitions: {
4780
- "virtual-account_delete_output": {
4814
+ "virtual-account_agreement_accept_output": {
4781
4815
  type: "object",
4782
4816
  properties: {
4783
- success: {
4784
- type: "boolean",
4785
- description: "Whether the operation was successful"
4817
+ id: {
4818
+ type: "string",
4819
+ description: "Signing record ID"
4820
+ },
4821
+ contentId: {
4822
+ type: [
4823
+ "string",
4824
+ "null"
4825
+ ],
4826
+ description: "Content ID of the accepted agreement"
4827
+ },
4828
+ documentId: {
4829
+ type: [
4830
+ "string",
4831
+ "null"
4832
+ ],
4833
+ description: "Document ID"
4786
4834
  }
4787
4835
  },
4788
4836
  required: [
4789
- "success"
4837
+ "id",
4838
+ "contentId",
4839
+ "documentId"
4790
4840
  ],
4791
4841
  additionalProperties: false
4792
4842
  }
@@ -4795,46 +4845,125 @@ var schemas_default = [
4795
4845
  }
4796
4846
  },
4797
4847
  {
4798
- name: "virtual-account_identification_create",
4799
- description: "Create a KYC verification link to complete identity verification",
4848
+ name: "virtual-account_agreement_list",
4849
+ description: "List legal agreements. By default shows pending agreements that must be accepted to activate the account. Use status=accepted to see previously accepted agreements.",
4800
4850
  inputSchema: {
4801
- $ref: "#/definitions/virtual-account_identification_create_input",
4802
- definitions: {
4803
- "virtual-account_identification_create_input": {
4804
- type: "object",
4805
- properties: {},
4806
- additionalProperties: false
4807
- }
4808
- },
4809
- $schema: "http://json-schema.org/draft-07/schema#"
4810
- },
4811
- outputSchema: {
4812
- $ref: "#/definitions/virtual-account_identification_create_output",
4851
+ $ref: "#/definitions/virtual-account_agreement_list_input",
4813
4852
  definitions: {
4814
- "virtual-account_identification_create_output": {
4853
+ "virtual-account_agreement_list_input": {
4854
+ type: "object",
4855
+ properties: {
4856
+ status: {
4857
+ anyOf: [
4858
+ {
4859
+ type: "string",
4860
+ enum: [
4861
+ "pending",
4862
+ "accepted"
4863
+ ]
4864
+ },
4865
+ {
4866
+ type: "null"
4867
+ }
4868
+ ],
4869
+ description: "Filter: pending (need to accept, default) or accepted (already signed)"
4870
+ }
4871
+ },
4872
+ required: [
4873
+ "status"
4874
+ ],
4875
+ additionalProperties: false
4876
+ }
4877
+ },
4878
+ $schema: "http://json-schema.org/draft-07/schema#"
4879
+ },
4880
+ outputSchema: {
4881
+ $ref: "#/definitions/virtual-account_agreement_list_output",
4882
+ definitions: {
4883
+ "virtual-account_agreement_list_output": {
4884
+ type: "object",
4885
+ properties: {
4886
+ items: {
4887
+ type: "array",
4888
+ items: {
4889
+ type: "object",
4890
+ properties: {
4891
+ id: {
4892
+ type: "string",
4893
+ description: "Content ID \u2014 pass to virtual-account_agreement_accept to accept"
4894
+ },
4895
+ name: {
4896
+ type: "string",
4897
+ description: "Document name (e.g. 'USA Terms and Conditions')"
4898
+ },
4899
+ url: {
4900
+ type: "string",
4901
+ description: "URL to view the document"
4902
+ }
4903
+ },
4904
+ required: [
4905
+ "id",
4906
+ "name",
4907
+ "url"
4908
+ ],
4909
+ additionalProperties: false
4910
+ },
4911
+ description: "List of agreements"
4912
+ }
4913
+ },
4914
+ required: [
4915
+ "items"
4916
+ ],
4917
+ additionalProperties: false
4918
+ }
4919
+ },
4920
+ $schema: "http://json-schema.org/draft-07/schema#"
4921
+ }
4922
+ },
4923
+ {
4924
+ name: "virtual-account_create",
4925
+ description: "Create a virtual account and start KYC verification",
4926
+ inputSchema: {
4927
+ $ref: "#/definitions/virtual-account_create_input",
4928
+ definitions: {
4929
+ "virtual-account_create_input": {
4930
+ type: "object",
4931
+ properties: {},
4932
+ additionalProperties: false
4933
+ }
4934
+ },
4935
+ $schema: "http://json-schema.org/draft-07/schema#"
4936
+ },
4937
+ outputSchema: {
4938
+ $ref: "#/definitions/virtual-account_create_output",
4939
+ definitions: {
4940
+ "virtual-account_create_output": {
4815
4941
  type: "object",
4816
4942
  properties: {
4817
4943
  id: {
4818
4944
  type: "string"
4819
4945
  },
4820
- status: {
4946
+ email: {
4947
+ type: "string"
4948
+ },
4949
+ customerType: {
4821
4950
  type: "string",
4822
4951
  enum: [
4823
- "Pending",
4824
- "Processed",
4825
- "PendingReview",
4826
- "Approved",
4827
- "Declined",
4828
- "Expired"
4952
+ "Person",
4953
+ "Business"
4829
4954
  ]
4830
4955
  },
4831
- url: {
4832
- type: [
4833
- "string",
4834
- "null"
4956
+ status: {
4957
+ type: "string",
4958
+ enum: [
4959
+ "UserRequired",
4960
+ "SigningsRequired",
4961
+ "IdentificationRequired",
4962
+ "Active",
4963
+ "Suspended"
4835
4964
  ]
4836
4965
  },
4837
- message: {
4966
+ nextStep: {
4838
4967
  type: [
4839
4968
  "string",
4840
4969
  "null"
@@ -4843,9 +4972,10 @@ var schemas_default = [
4843
4972
  },
4844
4973
  required: [
4845
4974
  "id",
4975
+ "email",
4976
+ "customerType",
4846
4977
  "status",
4847
- "url",
4848
- "message"
4978
+ "nextStep"
4849
4979
  ],
4850
4980
  additionalProperties: false
4851
4981
  }
@@ -4854,12 +4984,12 @@ var schemas_default = [
4854
4984
  }
4855
4985
  },
4856
4986
  {
4857
- name: "virtual-account_identification_list",
4858
- description: "List all KYC identifications",
4987
+ name: "virtual-account_kyc_continue",
4988
+ description: "Get the current KYC verification status and URL. Use this to check progress or get the verification link again.",
4859
4989
  inputSchema: {
4860
- $ref: "#/definitions/virtual-account_identification_list_input",
4990
+ $ref: "#/definitions/virtual-account_kyc_continue_input",
4861
4991
  definitions: {
4862
- "virtual-account_identification_list_input": {
4992
+ "virtual-account_kyc_continue_input": {
4863
4993
  type: "object",
4864
4994
  properties: {},
4865
4995
  additionalProperties: false
@@ -4868,48 +4998,39 @@ var schemas_default = [
4868
4998
  $schema: "http://json-schema.org/draft-07/schema#"
4869
4999
  },
4870
5000
  outputSchema: {
4871
- $ref: "#/definitions/virtual-account_identification_list_output",
5001
+ $ref: "#/definitions/virtual-account_kyc_continue_output",
4872
5002
  definitions: {
4873
- "virtual-account_identification_list_output": {
5003
+ "virtual-account_kyc_continue_output": {
4874
5004
  type: "object",
4875
5005
  properties: {
4876
- items: {
4877
- type: "array",
4878
- items: {
4879
- type: "object",
4880
- properties: {
4881
- id: {
4882
- type: "string"
4883
- },
4884
- status: {
4885
- type: "string",
4886
- enum: [
4887
- "Pending",
4888
- "Processed",
4889
- "PendingReview",
4890
- "Approved",
4891
- "Declined",
4892
- "Expired"
4893
- ]
4894
- },
4895
- url: {
4896
- type: [
4897
- "string",
4898
- "null"
4899
- ]
4900
- }
4901
- },
4902
- required: [
4903
- "id",
4904
- "status",
4905
- "url"
4906
- ],
4907
- additionalProperties: false
4908
- }
5006
+ id: {
5007
+ type: "string",
5008
+ description: "Identification record ID"
5009
+ },
5010
+ status: {
5011
+ type: "string",
5012
+ enum: [
5013
+ "Pending",
5014
+ "Processed",
5015
+ "PendingReview",
5016
+ "Approved",
5017
+ "Declined",
5018
+ "Expired"
5019
+ ],
5020
+ description: "KYC status: Pending, Processed, PendingReview, Approved, Declined, or Expired"
5021
+ },
5022
+ url: {
5023
+ type: [
5024
+ "string",
5025
+ "null"
5026
+ ],
5027
+ description: "URL to complete KYC verification. Null if already submitted."
4909
5028
  }
4910
5029
  },
4911
5030
  required: [
4912
- "items"
5031
+ "id",
5032
+ "status",
5033
+ "url"
4913
5034
  ],
4914
5035
  additionalProperties: false
4915
5036
  }
@@ -4918,12 +5039,12 @@ var schemas_default = [
4918
5039
  }
4919
5040
  },
4920
5041
  {
4921
- name: "virtual-account_identification_retrieve",
4922
- description: "Get the status of a KYC identification",
5042
+ name: "virtual-account_kyc_restart",
5043
+ description: "Restart KYC verification. Creates a fresh verification link. Only available when account status is IdentificationRequired.",
4923
5044
  inputSchema: {
4924
- $ref: "#/definitions/virtual-account_identification_retrieve_input",
5045
+ $ref: "#/definitions/virtual-account_kyc_restart_input",
4925
5046
  definitions: {
4926
- "virtual-account_identification_retrieve_input": {
5047
+ "virtual-account_kyc_restart_input": {
4927
5048
  type: "object",
4928
5049
  properties: {},
4929
5050
  additionalProperties: false
@@ -4932,13 +5053,14 @@ var schemas_default = [
4932
5053
  $schema: "http://json-schema.org/draft-07/schema#"
4933
5054
  },
4934
5055
  outputSchema: {
4935
- $ref: "#/definitions/virtual-account_identification_retrieve_output",
5056
+ $ref: "#/definitions/virtual-account_kyc_restart_output",
4936
5057
  definitions: {
4937
- "virtual-account_identification_retrieve_output": {
5058
+ "virtual-account_kyc_restart_output": {
4938
5059
  type: "object",
4939
5060
  properties: {
4940
5061
  id: {
4941
- type: "string"
5062
+ type: "string",
5063
+ description: "Identification record ID"
4942
5064
  },
4943
5065
  status: {
4944
5066
  type: "string",
@@ -4949,19 +5071,29 @@ var schemas_default = [
4949
5071
  "Approved",
4950
5072
  "Declined",
4951
5073
  "Expired"
4952
- ]
5074
+ ],
5075
+ description: "KYC status: Pending, Processed, PendingReview, Approved, Declined, or Expired"
4953
5076
  },
4954
5077
  url: {
4955
5078
  type: [
4956
5079
  "string",
4957
5080
  "null"
4958
- ]
5081
+ ],
5082
+ description: "URL to complete KYC verification. Null if already submitted."
5083
+ },
5084
+ message: {
5085
+ type: [
5086
+ "string",
5087
+ "null"
5088
+ ],
5089
+ description: "Instructions for the user"
4959
5090
  }
4960
5091
  },
4961
5092
  required: [
4962
5093
  "id",
4963
5094
  "status",
4964
- "url"
5095
+ "url",
5096
+ "message"
4965
5097
  ],
4966
5098
  additionalProperties: false
4967
5099
  }
@@ -4971,7 +5103,7 @@ var schemas_default = [
4971
5103
  },
4972
5104
  {
4973
5105
  name: "virtual-account_onramp_create",
4974
- description: "Create an onramp to convert fiat to stablecoin",
5106
+ description: "Create a fiat-to-stablecoin onramp. Returns a deposit account (bank IBAN or account number) where the user sends fiat. Incoming fiat is automatically converted to stablecoin and sent to the registered wallet.",
4975
5107
  inputSchema: {
4976
5108
  $ref: "#/definitions/virtual-account_onramp_create_input",
4977
5109
  definitions: {
@@ -4980,7 +5112,7 @@ var schemas_default = [
4980
5112
  properties: {
4981
5113
  name: {
4982
5114
  type: "string",
4983
- description: "The name of the onramp"
5115
+ description: "A label for this onramp (e.g. 'My USD onramp')"
4984
5116
  },
4985
5117
  fiat: {
4986
5118
  type: "string",
@@ -4988,7 +5120,7 @@ var schemas_default = [
4988
5120
  "USD",
4989
5121
  "EUR"
4990
5122
  ],
4991
- description: "The fiat currency to convert from"
5123
+ description: "Fiat currency: usd or eur"
4992
5124
  },
4993
5125
  stablecoin: {
4994
5126
  type: "string",
@@ -4997,11 +5129,11 @@ var schemas_default = [
4997
5129
  "USDT",
4998
5130
  "EURC"
4999
5131
  ],
5000
- description: "The stablecoin token to convert to"
5132
+ description: "Target stablecoin: usdc, usdt, or eurc"
5001
5133
  },
5002
5134
  wallet: {
5003
5135
  type: "string",
5004
- description: "Registered wallet address to receive stablecoin"
5136
+ description: "Registered wallet address (must be registered via virtual-account_wallet_register first)"
5005
5137
  }
5006
5138
  },
5007
5139
  required: [
@@ -5117,7 +5249,7 @@ var schemas_default = [
5117
5249
  },
5118
5250
  {
5119
5251
  name: "virtual-account_onramp_list",
5120
- description: "List all onramps",
5252
+ description: "List all fiat-to-stablecoin onramps. Shows each onramp's deposit account details, status, and destination wallet.",
5121
5253
  inputSchema: {
5122
5254
  $ref: "#/definitions/virtual-account_onramp_list_input",
5123
5255
  definitions: {
@@ -5183,7 +5315,8 @@ var schemas_default = [
5183
5315
  "walletAddress"
5184
5316
  ],
5185
5317
  additionalProperties: false
5186
- }
5318
+ },
5319
+ description: "List of configured onramps"
5187
5320
  }
5188
5321
  },
5189
5322
  required: [
@@ -5475,176 +5608,9 @@ var schemas_default = [
5475
5608
  $schema: "http://json-schema.org/draft-07/schema#"
5476
5609
  }
5477
5610
  },
5478
- {
5479
- name: "virtual-account_signing_create",
5480
- description: "Sign a required document for your virtual account",
5481
- inputSchema: {
5482
- $ref: "#/definitions/virtual-account_signing_create_input",
5483
- definitions: {
5484
- "virtual-account_signing_create_input": {
5485
- type: "object",
5486
- properties: {
5487
- contentId: {
5488
- type: "string",
5489
- description: "The unique ID of the content to sign"
5490
- }
5491
- },
5492
- required: [
5493
- "contentId"
5494
- ],
5495
- additionalProperties: false
5496
- }
5497
- },
5498
- $schema: "http://json-schema.org/draft-07/schema#"
5499
- },
5500
- outputSchema: {
5501
- $ref: "#/definitions/virtual-account_signing_create_output",
5502
- definitions: {
5503
- "virtual-account_signing_create_output": {
5504
- type: "object",
5505
- properties: {
5506
- id: {
5507
- type: "string"
5508
- },
5509
- contentId: {
5510
- type: [
5511
- "string",
5512
- "null"
5513
- ]
5514
- },
5515
- documentId: {
5516
- type: [
5517
- "string",
5518
- "null"
5519
- ]
5520
- }
5521
- },
5522
- required: [
5523
- "id",
5524
- "contentId",
5525
- "documentId"
5526
- ],
5527
- additionalProperties: false
5528
- }
5529
- },
5530
- $schema: "http://json-schema.org/draft-07/schema#"
5531
- }
5532
- },
5533
- {
5534
- name: "virtual-account_signing_list",
5535
- description: "List all signed documents",
5536
- inputSchema: {
5537
- $ref: "#/definitions/virtual-account_signing_list_input",
5538
- definitions: {
5539
- "virtual-account_signing_list_input": {
5540
- type: "object",
5541
- properties: {},
5542
- additionalProperties: false
5543
- }
5544
- },
5545
- $schema: "http://json-schema.org/draft-07/schema#"
5546
- },
5547
- outputSchema: {
5548
- $ref: "#/definitions/virtual-account_signing_list_output",
5549
- definitions: {
5550
- "virtual-account_signing_list_output": {
5551
- type: "object",
5552
- properties: {
5553
- items: {
5554
- type: "array",
5555
- items: {
5556
- type: "object",
5557
- properties: {
5558
- id: {
5559
- type: "string"
5560
- },
5561
- contentId: {
5562
- type: [
5563
- "string",
5564
- "null"
5565
- ]
5566
- },
5567
- documentId: {
5568
- type: [
5569
- "string",
5570
- "null"
5571
- ]
5572
- }
5573
- },
5574
- required: [
5575
- "id",
5576
- "contentId",
5577
- "documentId"
5578
- ],
5579
- additionalProperties: false
5580
- }
5581
- }
5582
- },
5583
- required: [
5584
- "items"
5585
- ],
5586
- additionalProperties: false
5587
- }
5588
- },
5589
- $schema: "http://json-schema.org/draft-07/schema#"
5590
- }
5591
- },
5592
- {
5593
- name: "virtual-account_signing_required_list",
5594
- description: "List documents that require your signature",
5595
- inputSchema: {
5596
- $ref: "#/definitions/virtual-account_signing_required_list_input",
5597
- definitions: {
5598
- "virtual-account_signing_required_list_input": {
5599
- type: "object",
5600
- properties: {},
5601
- additionalProperties: false
5602
- }
5603
- },
5604
- $schema: "http://json-schema.org/draft-07/schema#"
5605
- },
5606
- outputSchema: {
5607
- $ref: "#/definitions/virtual-account_signing_required_list_output",
5608
- definitions: {
5609
- "virtual-account_signing_required_list_output": {
5610
- type: "object",
5611
- properties: {
5612
- items: {
5613
- type: "array",
5614
- items: {
5615
- type: "object",
5616
- properties: {
5617
- id: {
5618
- type: "string"
5619
- },
5620
- displayName: {
5621
- type: "string"
5622
- },
5623
- url: {
5624
- type: "string"
5625
- }
5626
- },
5627
- required: [
5628
- "id",
5629
- "displayName",
5630
- "url"
5631
- ],
5632
- additionalProperties: false
5633
- }
5634
- }
5635
- },
5636
- required: [
5637
- "items"
5638
- ],
5639
- additionalProperties: false
5640
- }
5641
- },
5642
- $schema: "http://json-schema.org/draft-07/schema#"
5643
- }
5644
- },
5645
5611
  {
5646
5612
  name: "virtual-account_transaction_list",
5647
- description: "List virtual account transactions",
5613
+ description: "List fiat-to-stablecoin conversion transactions. Shows status, fiat amount sent, and stablecoin amount received for each conversion.",
5648
5614
  inputSchema: {
5649
5615
  $ref: "#/definitions/virtual-account_transaction_list_input",
5650
5616
  definitions: {
@@ -5668,7 +5634,8 @@ var schemas_default = [
5668
5634
  type: "object",
5669
5635
  properties: {
5670
5636
  id: {
5671
- type: "string"
5637
+ type: "string",
5638
+ description: "Transaction ID"
5672
5639
  },
5673
5640
  state: {
5674
5641
  type: "string",
@@ -5682,17 +5649,21 @@ var schemas_default = [
5682
5649
  "InAmlReview",
5683
5650
  "AmlRejected",
5684
5651
  "AmountRejected"
5685
- ]
5652
+ ],
5653
+ description: "Transaction state (e.g. pending, completed, failed)"
5686
5654
  },
5687
5655
  sourceAmount: {
5688
- type: "string"
5656
+ type: "string",
5657
+ description: "Fiat amount sent (e.g. '100.00 USD')"
5689
5658
  },
5690
5659
  destinationAmount: {
5691
- type: "string"
5660
+ type: "string",
5661
+ description: "Stablecoin amount received (e.g. '99.50 USDC')"
5692
5662
  },
5693
5663
  createdAt: {
5694
5664
  type: "string",
5695
- format: "date-time"
5665
+ format: "date-time",
5666
+ description: "Transaction creation timestamp"
5696
5667
  }
5697
5668
  },
5698
5669
  required: [
@@ -5703,7 +5674,8 @@ var schemas_default = [
5703
5674
  "createdAt"
5704
5675
  ],
5705
5676
  additionalProperties: false
5706
- }
5677
+ },
5678
+ description: "List of onramp conversion transactions"
5707
5679
  }
5708
5680
  },
5709
5681
  required: [
@@ -5717,7 +5689,7 @@ var schemas_default = [
5717
5689
  },
5718
5690
  {
5719
5691
  name: "virtual-account_wallet_list",
5720
- description: "List registered wallets",
5692
+ description: "List wallets registered for the virtual account. Only registered wallets can receive onramp payouts.",
5721
5693
  inputSchema: {
5722
5694
  $ref: "#/definitions/virtual-account_wallet_list_input",
5723
5695
  definitions: {
@@ -5756,7 +5728,8 @@ var schemas_default = [
5756
5728
  "blockchain"
5757
5729
  ],
5758
5730
  additionalProperties: false
5759
- }
5731
+ },
5732
+ description: "List of registered wallets"
5760
5733
  }
5761
5734
  },
5762
5735
  required: [
@@ -5770,7 +5743,7 @@ var schemas_default = [
5770
5743
  },
5771
5744
  {
5772
5745
  name: "virtual-account_wallet_register",
5773
- description: "Register a wallet using a signed verification message",
5746
+ description: "Register a wallet by submitting a signed proof-of-ownership message. The wallet can then be used as a destination for onramp payouts.",
5774
5747
  inputSchema: {
5775
5748
  $ref: "#/definitions/virtual-account_wallet_register_input",
5776
5749
  definitions: {
@@ -5779,15 +5752,15 @@ var schemas_default = [
5779
5752
  properties: {
5780
5753
  wallet: {
5781
5754
  type: "string",
5782
- description: "The wallet address to register"
5755
+ description: "Wallet address to register"
5783
5756
  },
5784
5757
  message: {
5785
5758
  type: "string",
5786
- description: "The verification message"
5759
+ description: "Verification message from virtual-account_wallet_registration-message_create"
5787
5760
  },
5788
5761
  signature: {
5789
5762
  type: "string",
5790
- description: "Signature of the message"
5763
+ description: "Signature of the message, signed by the wallet's private key"
5791
5764
  },
5792
5765
  chain: {
5793
5766
  anyOf: [
@@ -5940,7 +5913,7 @@ var walletImportSchema = defineToolSchema({
5940
5913
  output: z2.object({
5941
5914
  name: z2.string(),
5942
5915
  type: z2.enum(["hd", "imported"]),
5943
- addresses: z2.record(keyChainSchema, z2.string())
5916
+ addresses: addressesSchema
5944
5917
  })
5945
5918
  });
5946
5919
 
@@ -6067,11 +6040,13 @@ var walletDelete = createTool(walletDeleteSchema, async (params) => {
6067
6040
  });
6068
6041
 
6069
6042
  // src/tools/transaction/sign/tool.ts
6043
+ import { createHash } from "crypto";
6070
6044
  import { Keypair as Keypair2, VersionedTransaction } from "@solana/web3.js";
6071
6045
  import { privateKeyToAccount as privateKeyToAccount2 } from "viem/accounts";
6072
6046
  import { parseTransaction } from "viem";
6073
6047
  import { createPublicClient, http } from "viem";
6074
6048
  import * as viemChains from "viem/chains";
6049
+ import * as ecc from "tiny-secp256k1";
6075
6050
 
6076
6051
  // src/tools/transaction/sign/schema.ts
6077
6052
  import { z as z6 } from "zod";
@@ -6119,8 +6094,9 @@ var transactionSign = createTool(
6119
6094
  case "solana":
6120
6095
  return signSolana(privateKey, params.transaction.trim());
6121
6096
  case "ethereum":
6122
- case "tron":
6123
6097
  return signEvm(privateKey, params.transaction.trim());
6098
+ case "tron":
6099
+ return signTron(privateKey, params.transaction.trim());
6124
6100
  case "bitcoin":
6125
6101
  return signBitcoin(privateKey, params.transaction.trim());
6126
6102
  }
@@ -6168,11 +6144,21 @@ async function signEvm(privateKey, transaction) {
6168
6144
  const signed = await account.signTransaction(tx);
6169
6145
  return { transaction: signed };
6170
6146
  }
6147
+ function signTron(privateKey, transaction) {
6148
+ const txBytes = Buffer.from(
6149
+ transaction.startsWith("0x") ? transaction.slice(2) : transaction,
6150
+ "hex"
6151
+ );
6152
+ const txId = createHash("sha256").update(txBytes).digest();
6153
+ const sig = ecc.sign(txId, privateKey);
6154
+ if (!sig) throw new Error("Tron transaction signing failed");
6155
+ return { transaction: Buffer.from(sig).toString("hex") };
6156
+ }
6171
6157
  async function signBitcoin(privateKey, transaction) {
6172
6158
  const bitcoin = await import("bitcoinjs-lib");
6173
6159
  const ECPairFactory = (await import("ecpair")).default;
6174
- const ecc2 = await import("tiny-secp256k1");
6175
- const ECPair = ECPairFactory(ecc2);
6160
+ const ecc3 = await import("tiny-secp256k1");
6161
+ const ECPair = ECPairFactory(ecc3);
6176
6162
  const keyPair = ECPair.fromPrivateKey(Buffer.from(privateKey));
6177
6163
  const psbt = bitcoin.Psbt.fromBase64(transaction);
6178
6164
  psbt.signAllInputs(keyPair);
@@ -6185,7 +6171,8 @@ import { createHash as createHash2 } from "crypto";
6185
6171
  import { Keypair as Keypair3 } from "@solana/web3.js";
6186
6172
  import bs582 from "bs58";
6187
6173
  import nacl from "tweetnacl";
6188
- import * as ecc from "tiny-secp256k1";
6174
+ import * as ecc2 from "tiny-secp256k1";
6175
+ import { keccak_256 } from "@noble/hashes/sha3";
6189
6176
  import { privateKeyToAccount as privateKeyToAccount3 } from "viem/accounts";
6190
6177
 
6191
6178
  // src/tools/message/sign/schema.ts
@@ -6218,8 +6205,9 @@ var messageSign = createTool(messageSignSchema, async (params) => {
6218
6205
  case "solana":
6219
6206
  return signSolana2(privateKey, messageBytes);
6220
6207
  case "ethereum":
6221
- case "tron":
6222
6208
  return signEvm2(privateKey, params.message);
6209
+ case "tron":
6210
+ return signTronMessage(privateKey, params.message);
6223
6211
  case "bitcoin":
6224
6212
  return signBitcoin2(privateKey, messageBytes);
6225
6213
  }
@@ -6236,10 +6224,22 @@ async function signEvm2(privateKey, message) {
6236
6224
  const signature = await account.signMessage({ message });
6237
6225
  return { signature };
6238
6226
  }
6227
+ function signTronMessage(privateKey, message) {
6228
+ const messageBytes = Buffer.from(message, "utf8");
6229
+ const prefix = Buffer.from(
6230
+ `TRON Signed Message:
6231
+ ${messageBytes.length}`,
6232
+ "utf8"
6233
+ );
6234
+ const hash = keccak_256(Buffer.concat([prefix, messageBytes]));
6235
+ const sig = ecc2.sign(hash, privateKey);
6236
+ if (!sig) throw new Error("Tron message signing failed");
6237
+ return { signature: "0x" + Buffer.from(sig).toString("hex") };
6238
+ }
6239
6239
  function signBitcoin2(privateKey, messageBytes) {
6240
6240
  const hash1 = createHash2("sha256").update(messageBytes).digest();
6241
6241
  const hash2 = createHash2("sha256").update(hash1).digest();
6242
- const sig = ecc.sign(hash2, privateKey);
6242
+ const sig = ecc2.sign(hash2, privateKey);
6243
6243
  if (!sig) throw new Error("Bitcoin message signing failed");
6244
6244
  return { signature: "0x" + Buffer.from(sig).toString("hex") };
6245
6245
  }
@@ -6302,7 +6302,7 @@ var bitcoinBalanceRetrieve = createTool(
6302
6302
  async (params) => {
6303
6303
  let address = params.wallet;
6304
6304
  if (!address.startsWith("bc1") && !address.startsWith("1") && !address.startsWith("3")) {
6305
- const { findWalletOrThrow: findWalletOrThrow2 } = await import("./store-HCN56E6A.js");
6305
+ const { findWalletOrThrow: findWalletOrThrow2 } = await import("./store-UAGR3DWU.js");
6306
6306
  const wallet = findWalletOrThrow2(address);
6307
6307
  const btcAddress = wallet.addresses.bitcoin;
6308
6308
  if (!btcAddress) {
@@ -6328,7 +6328,7 @@ var bitcoinBalanceRetrieve = createTool(
6328
6328
  );
6329
6329
 
6330
6330
  // src/tools/token/swap/tool.ts
6331
- import { encodeFunctionData, maxUint256 } from "viem";
6331
+ import { encodeFunctionData } from "viem";
6332
6332
 
6333
6333
  // src/tools/token/swap/schema.ts
6334
6334
  import { z as z9 } from "zod";
@@ -6420,7 +6420,7 @@ var tokenBridge = createTool(tokenBridgeSchema, async (params) => {
6420
6420
  data: encodeFunctionData({
6421
6421
  abi: ERC20_APPROVE_ABI,
6422
6422
  functionName: "approve",
6423
- args: [spender, maxUint256]
6423
+ args: [spender, BigInt(buildResult.amountIn.raw)]
6424
6424
  }),
6425
6425
  value: "0",
6426
6426
  chainId
@@ -6630,9 +6630,10 @@ var virtualAccountWalletRegister = createTool(
6630
6630
 
6631
6631
  export {
6632
6632
  getConfigOrDefault,
6633
+ saveCredentials,
6633
6634
  clearCredentials,
6634
6635
  resolveBaseUrl,
6635
- login,
6636
+ callPublicTool,
6636
6637
  callTool,
6637
6638
  callRemoteTool,
6638
6639
  schemas_default,
@@ -6651,4 +6652,4 @@ export {
6651
6652
  x402Request,
6652
6653
  virtualAccountWalletRegister
6653
6654
  };
6654
- //# sourceMappingURL=chunk-PBRXVTTG.js.map
6655
+ //# sourceMappingURL=chunk-DCHEUKV7.js.map