@moonpay/cli 0.6.2 → 0.6.4
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/dist/{chunk-P764SORF.js → chunk-VJ2ZYZ2W.js} +359 -75
- package/dist/chunk-VJ2ZYZ2W.js.map +1 -0
- package/dist/index.js +21 -5
- package/dist/index.js.map +1 -1
- package/dist/{mcp-PNM25UVD.js → mcp-PKNRZ4PX.js} +4 -2
- package/dist/mcp-PKNRZ4PX.js.map +1 -0
- package/package.json +3 -2
- package/dist/chunk-P764SORF.js.map +0 -1
- package/dist/mcp-PNM25UVD.js.map +0 -1
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
getEncryptionKey,
|
|
15
15
|
keyChainSchema,
|
|
16
16
|
loadWallets,
|
|
17
|
+
mutateWallets,
|
|
17
18
|
removeWallet,
|
|
18
19
|
resolveSigningKey,
|
|
19
20
|
walletInfoSchema
|
|
@@ -329,6 +330,229 @@ var schemas_default = [
|
|
|
329
330
|
$schema: "http://json-schema.org/draft-07/schema#"
|
|
330
331
|
}
|
|
331
332
|
},
|
|
333
|
+
{
|
|
334
|
+
name: "deposit_create",
|
|
335
|
+
description: "Create crypto deposit addresses to fund a wallet. Returns addresses on multiple chains (Solana, EVM, Bitcoin, Tron). Send any token from any chain and it auto-settles to USDC.",
|
|
336
|
+
inputSchema: {
|
|
337
|
+
$ref: "#/definitions/deposit_create_input",
|
|
338
|
+
definitions: {
|
|
339
|
+
deposit_create_input: {
|
|
340
|
+
type: "object",
|
|
341
|
+
properties: {
|
|
342
|
+
wallet: {
|
|
343
|
+
type: "string",
|
|
344
|
+
description: "Solana wallet address to receive USDC"
|
|
345
|
+
}
|
|
346
|
+
},
|
|
347
|
+
required: [
|
|
348
|
+
"wallet"
|
|
349
|
+
],
|
|
350
|
+
additionalProperties: false
|
|
351
|
+
}
|
|
352
|
+
},
|
|
353
|
+
$schema: "http://json-schema.org/draft-07/schema#"
|
|
354
|
+
},
|
|
355
|
+
outputSchema: {
|
|
356
|
+
$ref: "#/definitions/deposit_create_output",
|
|
357
|
+
definitions: {
|
|
358
|
+
deposit_create_output: {
|
|
359
|
+
type: "object",
|
|
360
|
+
properties: {
|
|
361
|
+
id: {
|
|
362
|
+
type: "string",
|
|
363
|
+
description: "Helio deposit ID"
|
|
364
|
+
},
|
|
365
|
+
customerToken: {
|
|
366
|
+
type: "string",
|
|
367
|
+
description: "Customer token for tracking"
|
|
368
|
+
},
|
|
369
|
+
destinationWallet: {
|
|
370
|
+
type: "string",
|
|
371
|
+
description: "Wallet that will receive USDC"
|
|
372
|
+
},
|
|
373
|
+
depositUrl: {
|
|
374
|
+
type: "string",
|
|
375
|
+
description: "URL to open in browser for depositing"
|
|
376
|
+
},
|
|
377
|
+
wallets: {
|
|
378
|
+
type: "array",
|
|
379
|
+
items: {
|
|
380
|
+
type: "object",
|
|
381
|
+
properties: {
|
|
382
|
+
address: {
|
|
383
|
+
type: "string",
|
|
384
|
+
description: "Deposit address"
|
|
385
|
+
},
|
|
386
|
+
chain: {
|
|
387
|
+
type: "string",
|
|
388
|
+
description: "Chain (solana, ethereum, bitcoin, tron)"
|
|
389
|
+
}
|
|
390
|
+
},
|
|
391
|
+
required: [
|
|
392
|
+
"address",
|
|
393
|
+
"chain"
|
|
394
|
+
],
|
|
395
|
+
additionalProperties: false
|
|
396
|
+
},
|
|
397
|
+
description: "Deposit addresses on each supported chain"
|
|
398
|
+
}
|
|
399
|
+
},
|
|
400
|
+
required: [
|
|
401
|
+
"id",
|
|
402
|
+
"customerToken",
|
|
403
|
+
"destinationWallet",
|
|
404
|
+
"depositUrl",
|
|
405
|
+
"wallets"
|
|
406
|
+
],
|
|
407
|
+
additionalProperties: false
|
|
408
|
+
}
|
|
409
|
+
},
|
|
410
|
+
$schema: "http://json-schema.org/draft-07/schema#"
|
|
411
|
+
}
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
name: "deposit_list",
|
|
415
|
+
description: "List all deposit configurations created via the Helio API.",
|
|
416
|
+
inputSchema: {
|
|
417
|
+
$ref: "#/definitions/deposit_list_input",
|
|
418
|
+
definitions: {
|
|
419
|
+
deposit_list_input: {
|
|
420
|
+
type: "object",
|
|
421
|
+
properties: {},
|
|
422
|
+
additionalProperties: false
|
|
423
|
+
}
|
|
424
|
+
},
|
|
425
|
+
$schema: "http://json-schema.org/draft-07/schema#"
|
|
426
|
+
},
|
|
427
|
+
outputSchema: {
|
|
428
|
+
$ref: "#/definitions/deposit_list_output",
|
|
429
|
+
definitions: {
|
|
430
|
+
deposit_list_output: {
|
|
431
|
+
type: "object",
|
|
432
|
+
properties: {
|
|
433
|
+
items: {
|
|
434
|
+
type: "array",
|
|
435
|
+
items: {
|
|
436
|
+
type: "object",
|
|
437
|
+
properties: {
|
|
438
|
+
id: {
|
|
439
|
+
type: "string",
|
|
440
|
+
description: "Helio deposit ID"
|
|
441
|
+
},
|
|
442
|
+
name: {
|
|
443
|
+
type: "string",
|
|
444
|
+
description: "Deposit name"
|
|
445
|
+
},
|
|
446
|
+
createdAt: {
|
|
447
|
+
type: "string",
|
|
448
|
+
description: "ISO timestamp"
|
|
449
|
+
}
|
|
450
|
+
},
|
|
451
|
+
required: [
|
|
452
|
+
"id",
|
|
453
|
+
"name",
|
|
454
|
+
"createdAt"
|
|
455
|
+
],
|
|
456
|
+
additionalProperties: false
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
},
|
|
460
|
+
required: [
|
|
461
|
+
"items"
|
|
462
|
+
],
|
|
463
|
+
additionalProperties: false
|
|
464
|
+
}
|
|
465
|
+
},
|
|
466
|
+
$schema: "http://json-schema.org/draft-07/schema#"
|
|
467
|
+
}
|
|
468
|
+
},
|
|
469
|
+
{
|
|
470
|
+
name: "deposit_transaction_list",
|
|
471
|
+
description: "List incoming transactions for a deposit address. Shows amount received, token, sender, and settlement status.",
|
|
472
|
+
inputSchema: {
|
|
473
|
+
$ref: "#/definitions/deposit_transaction_list_input",
|
|
474
|
+
definitions: {
|
|
475
|
+
deposit_transaction_list_input: {
|
|
476
|
+
type: "object",
|
|
477
|
+
properties: {
|
|
478
|
+
customerToken: {
|
|
479
|
+
type: "string",
|
|
480
|
+
description: "Customer token returned from deposit_create"
|
|
481
|
+
}
|
|
482
|
+
},
|
|
483
|
+
required: [
|
|
484
|
+
"customerToken"
|
|
485
|
+
],
|
|
486
|
+
additionalProperties: false
|
|
487
|
+
}
|
|
488
|
+
},
|
|
489
|
+
$schema: "http://json-schema.org/draft-07/schema#"
|
|
490
|
+
},
|
|
491
|
+
outputSchema: {
|
|
492
|
+
$ref: "#/definitions/deposit_transaction_list_output",
|
|
493
|
+
definitions: {
|
|
494
|
+
deposit_transaction_list_output: {
|
|
495
|
+
type: "object",
|
|
496
|
+
properties: {
|
|
497
|
+
items: {
|
|
498
|
+
type: "array",
|
|
499
|
+
items: {
|
|
500
|
+
type: "object",
|
|
501
|
+
properties: {
|
|
502
|
+
id: {
|
|
503
|
+
type: "string"
|
|
504
|
+
},
|
|
505
|
+
amount: {
|
|
506
|
+
type: "number"
|
|
507
|
+
},
|
|
508
|
+
token: {
|
|
509
|
+
type: "string"
|
|
510
|
+
},
|
|
511
|
+
from: {
|
|
512
|
+
type: "string"
|
|
513
|
+
},
|
|
514
|
+
status: {
|
|
515
|
+
type: "string"
|
|
516
|
+
},
|
|
517
|
+
settledAmount: {
|
|
518
|
+
type: [
|
|
519
|
+
"number",
|
|
520
|
+
"null"
|
|
521
|
+
]
|
|
522
|
+
},
|
|
523
|
+
settledCurrency: {
|
|
524
|
+
type: [
|
|
525
|
+
"string",
|
|
526
|
+
"null"
|
|
527
|
+
]
|
|
528
|
+
},
|
|
529
|
+
timestamp: {
|
|
530
|
+
type: "string"
|
|
531
|
+
}
|
|
532
|
+
},
|
|
533
|
+
required: [
|
|
534
|
+
"id",
|
|
535
|
+
"amount",
|
|
536
|
+
"token",
|
|
537
|
+
"from",
|
|
538
|
+
"status",
|
|
539
|
+
"settledAmount",
|
|
540
|
+
"settledCurrency",
|
|
541
|
+
"timestamp"
|
|
542
|
+
],
|
|
543
|
+
additionalProperties: false
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
},
|
|
547
|
+
required: [
|
|
548
|
+
"items"
|
|
549
|
+
],
|
|
550
|
+
additionalProperties: false
|
|
551
|
+
}
|
|
552
|
+
},
|
|
553
|
+
$schema: "http://json-schema.org/draft-07/schema#"
|
|
554
|
+
}
|
|
555
|
+
},
|
|
332
556
|
{
|
|
333
557
|
name: "login",
|
|
334
558
|
description: "Send a verification code to the provided email to sign in or create an account.",
|
|
@@ -6045,6 +6269,40 @@ var walletDelete = createTool(walletDeleteSchema, async (params) => {
|
|
|
6045
6269
|
return { name: wallet.name, deleted: true };
|
|
6046
6270
|
});
|
|
6047
6271
|
|
|
6272
|
+
// src/tools/wallet/rename/schema.ts
|
|
6273
|
+
import { z as z6 } from "zod";
|
|
6274
|
+
var walletRenameSchema = defineToolSchema({
|
|
6275
|
+
name: "wallet_rename",
|
|
6276
|
+
description: "Rename a local wallet.",
|
|
6277
|
+
input: z6.object({
|
|
6278
|
+
wallet: z6.string().describe("Current name or address of the wallet"),
|
|
6279
|
+
name: z6.string().describe("New name for the wallet")
|
|
6280
|
+
}),
|
|
6281
|
+
output: z6.object({
|
|
6282
|
+
oldName: z6.string(),
|
|
6283
|
+
newName: z6.string()
|
|
6284
|
+
})
|
|
6285
|
+
});
|
|
6286
|
+
|
|
6287
|
+
// src/tools/wallet/rename/tool.ts
|
|
6288
|
+
var walletRename = createTool(walletRenameSchema, async (params) => {
|
|
6289
|
+
const wallet = findWalletOrThrow(params.wallet);
|
|
6290
|
+
const oldName = wallet.name;
|
|
6291
|
+
if (oldName === params.name) {
|
|
6292
|
+
throw new Error(`Wallet is already named "${params.name}"`);
|
|
6293
|
+
}
|
|
6294
|
+
const existing = loadWallets();
|
|
6295
|
+
if (existing.some((w) => w.name === params.name)) {
|
|
6296
|
+
throw new Error(`Wallet "${params.name}" already exists`);
|
|
6297
|
+
}
|
|
6298
|
+
mutateWallets((wallets) => {
|
|
6299
|
+
const w = wallets.find((w2) => w2.name === oldName);
|
|
6300
|
+
if (!w) throw new Error(`Wallet "${oldName}" not found`);
|
|
6301
|
+
w.name = params.name;
|
|
6302
|
+
});
|
|
6303
|
+
return { oldName, newName: params.name };
|
|
6304
|
+
});
|
|
6305
|
+
|
|
6048
6306
|
// src/tools/transaction/sign/tool.ts
|
|
6049
6307
|
import { createHash } from "crypto";
|
|
6050
6308
|
import { Keypair as Keypair2, VersionedTransaction } from "@solana/web3.js";
|
|
@@ -6055,19 +6313,19 @@ import * as viemChains from "viem/chains";
|
|
|
6055
6313
|
import * as ecc from "tiny-secp256k1";
|
|
6056
6314
|
|
|
6057
6315
|
// src/tools/transaction/sign/schema.ts
|
|
6058
|
-
import { z as
|
|
6316
|
+
import { z as z7 } from "zod";
|
|
6059
6317
|
var transactionSignSchema = defineToolSchema({
|
|
6060
6318
|
name: "transaction_sign",
|
|
6061
6319
|
description: "Sign a transaction with a local wallet. Supports Solana (VersionedTransaction), EVM (RLP-encoded), and Bitcoin (PSBT) transactions.",
|
|
6062
|
-
input:
|
|
6063
|
-
wallet:
|
|
6320
|
+
input: z7.object({
|
|
6321
|
+
wallet: z7.string().describe("Wallet name or address"),
|
|
6064
6322
|
chain: chainSchema.describe(
|
|
6065
6323
|
"Chain: solana, ethereum, base, arbitrum, or bitcoin"
|
|
6066
6324
|
),
|
|
6067
|
-
transaction:
|
|
6325
|
+
transaction: z7.string().describe("Base64-encoded unsigned transaction")
|
|
6068
6326
|
}),
|
|
6069
|
-
output:
|
|
6070
|
-
transaction:
|
|
6327
|
+
output: z7.object({
|
|
6328
|
+
transaction: z7.string().describe("Base64-encoded signed transaction")
|
|
6071
6329
|
})
|
|
6072
6330
|
});
|
|
6073
6331
|
|
|
@@ -6182,19 +6440,19 @@ import { keccak_256 } from "@noble/hashes/sha3";
|
|
|
6182
6440
|
import { privateKeyToAccount as privateKeyToAccount3 } from "viem/accounts";
|
|
6183
6441
|
|
|
6184
6442
|
// src/tools/message/sign/schema.ts
|
|
6185
|
-
import { z as
|
|
6443
|
+
import { z as z8 } from "zod";
|
|
6186
6444
|
var messageSignSchema = defineToolSchema({
|
|
6187
6445
|
name: "message_sign",
|
|
6188
6446
|
description: "Sign a message with a local wallet. Supports Solana (ed25519), EVM (EIP-191 personal sign), and Bitcoin (secp256k1 ECDSA).",
|
|
6189
|
-
input:
|
|
6190
|
-
wallet:
|
|
6447
|
+
input: z8.object({
|
|
6448
|
+
wallet: z8.string().describe("Wallet address or name to sign with"),
|
|
6191
6449
|
chain: chainSchema.describe(
|
|
6192
6450
|
"Chain: solana, ethereum, base, arbitrum, or bitcoin"
|
|
6193
6451
|
),
|
|
6194
|
-
message:
|
|
6452
|
+
message: z8.string().describe("Message text to sign")
|
|
6195
6453
|
}),
|
|
6196
|
-
output:
|
|
6197
|
-
signature:
|
|
6454
|
+
output: z8.object({
|
|
6455
|
+
signature: z8.string().describe(
|
|
6198
6456
|
"Signature: base58 for Solana, hex (0x-prefixed) for EVM/Bitcoin"
|
|
6199
6457
|
)
|
|
6200
6458
|
})
|
|
@@ -6254,26 +6512,26 @@ function signBitcoin2(privateKey, messageBytes) {
|
|
|
6254
6512
|
import https from "https";
|
|
6255
6513
|
|
|
6256
6514
|
// src/tools/bitcoin/balance/schema.ts
|
|
6257
|
-
import { z as
|
|
6515
|
+
import { z as z9 } from "zod";
|
|
6258
6516
|
var bitcoinBalanceRetrieveSchema = defineToolSchema({
|
|
6259
6517
|
name: "bitcoin_balance_retrieve",
|
|
6260
6518
|
description: "Get the BTC balance of a Bitcoin address. Returns confirmed and unconfirmed balances in BTC and satoshis.",
|
|
6261
|
-
input:
|
|
6262
|
-
wallet:
|
|
6519
|
+
input: z9.object({
|
|
6520
|
+
wallet: z9.string().describe("Bitcoin address (bc1...) or wallet name")
|
|
6263
6521
|
}),
|
|
6264
|
-
output:
|
|
6265
|
-
address:
|
|
6266
|
-
confirmed:
|
|
6267
|
-
btc:
|
|
6268
|
-
sats:
|
|
6522
|
+
output: z9.object({
|
|
6523
|
+
address: z9.string().describe("Bitcoin address"),
|
|
6524
|
+
confirmed: z9.object({
|
|
6525
|
+
btc: z9.string().describe("Confirmed balance in BTC"),
|
|
6526
|
+
sats: z9.number().describe("Confirmed balance in satoshis")
|
|
6269
6527
|
}),
|
|
6270
|
-
unconfirmed:
|
|
6271
|
-
btc:
|
|
6272
|
-
sats:
|
|
6528
|
+
unconfirmed: z9.object({
|
|
6529
|
+
btc: z9.string().describe("Unconfirmed (pending) balance in BTC"),
|
|
6530
|
+
sats: z9.number().describe("Unconfirmed (pending) balance in satoshis")
|
|
6273
6531
|
}),
|
|
6274
|
-
total:
|
|
6275
|
-
btc:
|
|
6276
|
-
sats:
|
|
6532
|
+
total: z9.object({
|
|
6533
|
+
btc: z9.string().describe("Total balance in BTC"),
|
|
6534
|
+
sats: z9.number().describe("Total balance in satoshis")
|
|
6277
6535
|
})
|
|
6278
6536
|
})
|
|
6279
6537
|
});
|
|
@@ -6337,24 +6595,24 @@ var bitcoinBalanceRetrieve = createTool(
|
|
|
6337
6595
|
import { encodeFunctionData } from "viem";
|
|
6338
6596
|
|
|
6339
6597
|
// src/tools/token/swap/schema.ts
|
|
6340
|
-
import { z as
|
|
6341
|
-
var swapOutputSchema =
|
|
6342
|
-
signature:
|
|
6343
|
-
message:
|
|
6598
|
+
import { z as z10 } from "zod";
|
|
6599
|
+
var swapOutputSchema = z10.object({
|
|
6600
|
+
signature: z10.string().describe("Transaction hash/signature"),
|
|
6601
|
+
message: z10.string().describe("Human-readable swap description")
|
|
6344
6602
|
});
|
|
6345
6603
|
var tokenSwapSchema = defineToolSchema({
|
|
6346
6604
|
name: "token_swap",
|
|
6347
6605
|
description: "Swap tokens on the same chain. Builds, signs locally, broadcasts, and registers.",
|
|
6348
|
-
input:
|
|
6349
|
-
wallet:
|
|
6606
|
+
input: z10.object({
|
|
6607
|
+
wallet: z10.string().describe("Local wallet name to sign with"),
|
|
6350
6608
|
chain: chainSchema.describe("Chain to swap on"),
|
|
6351
|
-
from:
|
|
6352
|
-
token:
|
|
6353
|
-
amount:
|
|
6609
|
+
from: z10.object({
|
|
6610
|
+
token: z10.string().describe("Input token address (selling)"),
|
|
6611
|
+
amount: z10.coerce.number().nullable().describe("Amount to sell (exact-in). Null for exact-out.")
|
|
6354
6612
|
}),
|
|
6355
|
-
to:
|
|
6356
|
-
token:
|
|
6357
|
-
amount:
|
|
6613
|
+
to: z10.object({
|
|
6614
|
+
token: z10.string().describe("Output token address (buying)"),
|
|
6615
|
+
amount: z10.coerce.number().nullable().describe("Amount to receive (exact-out). Null for exact-in.")
|
|
6358
6616
|
})
|
|
6359
6617
|
}),
|
|
6360
6618
|
output: swapOutputSchema
|
|
@@ -6362,18 +6620,18 @@ var tokenSwapSchema = defineToolSchema({
|
|
|
6362
6620
|
var tokenBridgeSchema = defineToolSchema({
|
|
6363
6621
|
name: "token_bridge",
|
|
6364
6622
|
description: "Bridge tokens across chains. Builds, signs locally, broadcasts, and registers.",
|
|
6365
|
-
input:
|
|
6366
|
-
from:
|
|
6367
|
-
wallet:
|
|
6623
|
+
input: z10.object({
|
|
6624
|
+
from: z10.object({
|
|
6625
|
+
wallet: z10.string().describe("Local wallet name to sign with"),
|
|
6368
6626
|
chain: chainSchema.describe("Source chain"),
|
|
6369
|
-
token:
|
|
6370
|
-
amount:
|
|
6627
|
+
token: z10.string().describe("Source token address"),
|
|
6628
|
+
amount: z10.coerce.number().nullable().describe("Amount to send (exact-in). Null for exact-out.")
|
|
6371
6629
|
}),
|
|
6372
|
-
to:
|
|
6373
|
-
wallet:
|
|
6630
|
+
to: z10.object({
|
|
6631
|
+
wallet: z10.string().nullable().describe("Destination wallet name or address (defaults to from wallet)"),
|
|
6374
6632
|
chain: chainSchema.describe("Destination chain"),
|
|
6375
|
-
token:
|
|
6376
|
-
amount:
|
|
6633
|
+
token: z10.string().describe("Destination token address"),
|
|
6634
|
+
amount: z10.coerce.number().nullable().describe("Amount to receive (exact-out). Null for exact-in.")
|
|
6377
6635
|
})
|
|
6378
6636
|
}),
|
|
6379
6637
|
output: swapOutputSchema
|
|
@@ -6484,15 +6742,20 @@ import axios from "axios";
|
|
|
6484
6742
|
import { wrapAxiosWithPayment } from "@x402/axios";
|
|
6485
6743
|
import { x402Client } from "@x402/core/client";
|
|
6486
6744
|
import { ExactSvmScheme } from "@x402/svm";
|
|
6745
|
+
import { registerExactEvmScheme } from "@x402/evm/exact/client";
|
|
6746
|
+
import { toClientEvmSigner } from "@x402/evm";
|
|
6747
|
+
import { privateKeyToAccount as privateKeyToAccount4 } from "viem/accounts";
|
|
6748
|
+
import { createPublicClient as createPublicClient2, http as http2 } from "viem";
|
|
6749
|
+
import * as viemChains2 from "viem/chains";
|
|
6487
6750
|
|
|
6488
6751
|
// src/tools/x402/request/schema.ts
|
|
6489
|
-
import { z as
|
|
6752
|
+
import { z as z11 } from "zod";
|
|
6490
6753
|
var x402RequestSchema = defineToolSchema({
|
|
6491
6754
|
name: "x402_request",
|
|
6492
6755
|
description: "Make an HTTP request to an x402-protected endpoint. Automatically handles payment when a 402 Payment Required response is received, signing the payment transaction with the local wallet.",
|
|
6493
|
-
input:
|
|
6494
|
-
method:
|
|
6495
|
-
url:
|
|
6756
|
+
input: z11.object({
|
|
6757
|
+
method: z11.enum(["GET", "POST", "PUT", "PATCH", "DELETE"]).describe("HTTP method"),
|
|
6758
|
+
url: z11.string().url().refine((u) => u.startsWith("https://"), { message: "URL must use HTTPS" }).refine(
|
|
6496
6759
|
(u) => {
|
|
6497
6760
|
try {
|
|
6498
6761
|
const host = new URL(u).hostname;
|
|
@@ -6505,20 +6768,28 @@ var x402RequestSchema = defineToolSchema({
|
|
|
6505
6768
|
).describe(
|
|
6506
6769
|
"Full HTTPS URL of the x402-protected endpoint (e.g., 'https://agents.moonpay.com/api/x402/tools/market_digest_retrieve')"
|
|
6507
6770
|
),
|
|
6508
|
-
body:
|
|
6509
|
-
params:
|
|
6510
|
-
wallet:
|
|
6771
|
+
body: z11.record(z11.any()).nullable().describe("Request body (for POST, PUT, PATCH)"),
|
|
6772
|
+
params: z11.record(z11.any()).nullable().describe("Query parameters"),
|
|
6773
|
+
wallet: z11.string().describe("Wallet name or address to pay with"),
|
|
6774
|
+
chain: z11.enum(["solana", "base", "ethereum", "arbitrum", "polygon", "optimism"]).nullable().describe("Chain to pay from (default: solana). Use an EVM chain like 'base' to pay with an EVM wallet.")
|
|
6511
6775
|
}),
|
|
6512
|
-
output:
|
|
6513
|
-
status:
|
|
6514
|
-
data:
|
|
6515
|
-
headers:
|
|
6776
|
+
output: z11.object({
|
|
6777
|
+
status: z11.number().describe("HTTP status code"),
|
|
6778
|
+
data: z11.any().describe("Response data"),
|
|
6779
|
+
headers: z11.record(z11.any()).describe("Response headers")
|
|
6516
6780
|
})
|
|
6517
6781
|
});
|
|
6518
6782
|
|
|
6519
6783
|
// src/tools/x402/request/tool.ts
|
|
6520
6784
|
var SOLANA_NETWORK = "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
|
|
6521
|
-
|
|
6785
|
+
var CHAIN_TO_VIEM = {
|
|
6786
|
+
ethereum: viemChains2.mainnet,
|
|
6787
|
+
base: viemChains2.base,
|
|
6788
|
+
polygon: viemChains2.polygon,
|
|
6789
|
+
arbitrum: viemChains2.arbitrum,
|
|
6790
|
+
optimism: viemChains2.optimism
|
|
6791
|
+
};
|
|
6792
|
+
function createSolanaX402Client(walletAddress, secretKey) {
|
|
6522
6793
|
const keypair = Keypair4.fromSecretKey(secretKey);
|
|
6523
6794
|
const signer = {
|
|
6524
6795
|
address: walletAddress,
|
|
@@ -6550,28 +6821,40 @@ function createLocalX402Client(walletAddress, secretKey) {
|
|
|
6550
6821
|
client.registerV1("solana", svmScheme);
|
|
6551
6822
|
return wrapAxiosWithPayment(axios.create(), client);
|
|
6552
6823
|
}
|
|
6824
|
+
function createEvmX402Client(privateKey, chain) {
|
|
6825
|
+
const account = privateKeyToAccount4(
|
|
6826
|
+
`0x${Buffer.from(privateKey).toString("hex")}`
|
|
6827
|
+
);
|
|
6828
|
+
const viemChain = CHAIN_TO_VIEM[chain] ?? viemChains2.base;
|
|
6829
|
+
const publicClient = createPublicClient2({ chain: viemChain, transport: http2() });
|
|
6830
|
+
const signer = toClientEvmSigner(account, publicClient);
|
|
6831
|
+
const client = new x402Client();
|
|
6832
|
+
registerExactEvmScheme(client, { signer });
|
|
6833
|
+
return wrapAxiosWithPayment(axios.create(), client);
|
|
6834
|
+
}
|
|
6553
6835
|
var x402Request = createTool(
|
|
6554
6836
|
x402RequestSchema,
|
|
6555
|
-
async ({ method, url, body, params, wallet: walletNameOrAddress }) => {
|
|
6837
|
+
async ({ method, url, body, params, wallet: walletNameOrAddress, chain }) => {
|
|
6556
6838
|
const walletMetadata = findWalletOrThrow(walletNameOrAddress);
|
|
6557
|
-
const
|
|
6558
|
-
const
|
|
6839
|
+
const resolvedChain = chain ?? "solana";
|
|
6840
|
+
const { privateKey, address } = resolveSigningKey(walletMetadata, resolvedChain);
|
|
6841
|
+
const httpClient = resolvedChain === "solana" ? createSolanaX402Client(address, privateKey) : createEvmX402Client(privateKey, resolvedChain);
|
|
6559
6842
|
let response;
|
|
6560
6843
|
switch (method) {
|
|
6561
6844
|
case "GET":
|
|
6562
|
-
response = await
|
|
6845
|
+
response = await httpClient.get(url, { params });
|
|
6563
6846
|
break;
|
|
6564
6847
|
case "POST":
|
|
6565
|
-
response = await
|
|
6848
|
+
response = await httpClient.post(url, body || {}, { params });
|
|
6566
6849
|
break;
|
|
6567
6850
|
case "PUT":
|
|
6568
|
-
response = await
|
|
6851
|
+
response = await httpClient.put(url, body || {}, { params });
|
|
6569
6852
|
break;
|
|
6570
6853
|
case "PATCH":
|
|
6571
|
-
response = await
|
|
6854
|
+
response = await httpClient.patch(url, body || {}, { params });
|
|
6572
6855
|
break;
|
|
6573
6856
|
case "DELETE":
|
|
6574
|
-
response = await
|
|
6857
|
+
response = await httpClient.delete(url, { params });
|
|
6575
6858
|
break;
|
|
6576
6859
|
default:
|
|
6577
6860
|
throw new Error(`Unsupported HTTP method: ${method}`);
|
|
@@ -6585,18 +6868,18 @@ var x402Request = createTool(
|
|
|
6585
6868
|
);
|
|
6586
6869
|
|
|
6587
6870
|
// src/tools/virtual-account/wallet/register/schema.ts
|
|
6588
|
-
import { z as
|
|
6871
|
+
import { z as z12 } from "zod";
|
|
6589
6872
|
var virtualAccountWalletRegisterSchema = defineToolSchema({
|
|
6590
6873
|
name: "virtual-account_wallet_register",
|
|
6591
6874
|
description: "Register a local wallet with your virtual account. Creates the verification message, signs it locally, and registers in one step.",
|
|
6592
|
-
input:
|
|
6593
|
-
wallet:
|
|
6875
|
+
input: z12.object({
|
|
6876
|
+
wallet: z12.string().describe("Local wallet name"),
|
|
6594
6877
|
chain: chainSchema.describe("Chain to register (solana, ethereum, etc.)")
|
|
6595
6878
|
}),
|
|
6596
|
-
output:
|
|
6597
|
-
success:
|
|
6598
|
-
address:
|
|
6599
|
-
chain:
|
|
6879
|
+
output: z12.object({
|
|
6880
|
+
success: z12.literal(true),
|
|
6881
|
+
address: z12.string().describe("Registered wallet address"),
|
|
6882
|
+
chain: z12.string().describe("Chain registered on")
|
|
6600
6883
|
})
|
|
6601
6884
|
});
|
|
6602
6885
|
|
|
@@ -6648,6 +6931,7 @@ export {
|
|
|
6648
6931
|
walletList,
|
|
6649
6932
|
walletRetrieve,
|
|
6650
6933
|
walletDelete,
|
|
6934
|
+
walletRename,
|
|
6651
6935
|
transactionSign,
|
|
6652
6936
|
messageSign,
|
|
6653
6937
|
bitcoinBalanceRetrieve,
|
|
@@ -6656,4 +6940,4 @@ export {
|
|
|
6656
6940
|
x402Request,
|
|
6657
6941
|
virtualAccountWalletRegister
|
|
6658
6942
|
};
|
|
6659
|
-
//# sourceMappingURL=chunk-
|
|
6943
|
+
//# sourceMappingURL=chunk-VJ2ZYZ2W.js.map
|