@moonpay/cli 0.6.10 → 0.6.12
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-TIV6G4KD.js → chunk-2XX5YJ2D.js} +902 -182
- package/dist/chunk-2XX5YJ2D.js.map +1 -0
- package/dist/{chunk-AL5WDHLT.js → chunk-ZYYH3VNA.js} +53 -22
- package/dist/chunk-ZYYH3VNA.js.map +1 -0
- package/dist/index.js +74 -503
- package/dist/index.js.map +1 -1
- package/dist/{mcp-7OXDGMYU.js → mcp-4U5K4DCI.js} +5 -30
- package/dist/mcp-4U5K4DCI.js.map +1 -0
- package/dist/{store-QVVENVIP.js → store-6OIOBMHW.js} +2 -2
- package/package.json +1 -1
- package/skills/moonpay-deposit/SKILL.md +16 -8
- package/skills/moonpay-virtual-account/SKILL.md +6 -2
- package/dist/chunk-AL5WDHLT.js.map +0 -1
- package/dist/chunk-TIV6G4KD.js.map +0 -1
- package/dist/mcp-7OXDGMYU.js.map +0 -1
- /package/dist/{store-QVVENVIP.js.map → store-6OIOBMHW.js.map} +0 -0
|
@@ -12,13 +12,12 @@ import {
|
|
|
12
12
|
expandAddresses,
|
|
13
13
|
findWalletOrThrow,
|
|
14
14
|
getEncryptionKey,
|
|
15
|
-
keyChainSchema,
|
|
16
15
|
loadWallets,
|
|
17
16
|
mutateWallets,
|
|
18
17
|
removeWallet,
|
|
19
18
|
resolveSigningKey,
|
|
20
19
|
walletInfoSchema
|
|
21
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-ZYYH3VNA.js";
|
|
22
21
|
|
|
23
22
|
// src/auth.ts
|
|
24
23
|
import * as fs from "fs";
|
|
@@ -453,6 +452,66 @@ var schemas_default = [
|
|
|
453
452
|
$schema: "http://json-schema.org/draft-07/schema#"
|
|
454
453
|
}
|
|
455
454
|
},
|
|
455
|
+
{
|
|
456
|
+
name: "deposit_retrieve",
|
|
457
|
+
description: "Retrieve details of a deposit by ID. Returns the deposit name, status, destination wallet, and deposit addresses.",
|
|
458
|
+
inputSchema: {
|
|
459
|
+
$ref: "#/definitions/deposit_retrieve_input",
|
|
460
|
+
definitions: {
|
|
461
|
+
deposit_retrieve_input: {
|
|
462
|
+
type: "object",
|
|
463
|
+
properties: {
|
|
464
|
+
id: {
|
|
465
|
+
type: "string",
|
|
466
|
+
description: "Deposit ID returned from deposit_create"
|
|
467
|
+
}
|
|
468
|
+
},
|
|
469
|
+
required: [
|
|
470
|
+
"id"
|
|
471
|
+
],
|
|
472
|
+
additionalProperties: false
|
|
473
|
+
}
|
|
474
|
+
},
|
|
475
|
+
$schema: "http://json-schema.org/draft-07/schema#"
|
|
476
|
+
},
|
|
477
|
+
outputSchema: {
|
|
478
|
+
$ref: "#/definitions/deposit_retrieve_output",
|
|
479
|
+
definitions: {
|
|
480
|
+
deposit_retrieve_output: {
|
|
481
|
+
type: "object",
|
|
482
|
+
properties: {
|
|
483
|
+
id: {
|
|
484
|
+
type: "string"
|
|
485
|
+
},
|
|
486
|
+
name: {
|
|
487
|
+
type: "string"
|
|
488
|
+
},
|
|
489
|
+
status: {
|
|
490
|
+
type: "string"
|
|
491
|
+
},
|
|
492
|
+
destinationWallet: {
|
|
493
|
+
type: [
|
|
494
|
+
"string",
|
|
495
|
+
"null"
|
|
496
|
+
]
|
|
497
|
+
},
|
|
498
|
+
depositUrl: {
|
|
499
|
+
type: "string"
|
|
500
|
+
}
|
|
501
|
+
},
|
|
502
|
+
required: [
|
|
503
|
+
"id",
|
|
504
|
+
"name",
|
|
505
|
+
"status",
|
|
506
|
+
"destinationWallet",
|
|
507
|
+
"depositUrl"
|
|
508
|
+
],
|
|
509
|
+
additionalProperties: false
|
|
510
|
+
}
|
|
511
|
+
},
|
|
512
|
+
$schema: "http://json-schema.org/draft-07/schema#"
|
|
513
|
+
}
|
|
514
|
+
},
|
|
456
515
|
{
|
|
457
516
|
name: "deposit_transaction_list",
|
|
458
517
|
description: "List transactions for a deposit. Pass the deposit id from deposit_create to check incoming payment status.",
|
|
@@ -5416,13 +5475,111 @@ var schemas_default = [
|
|
|
5416
5475
|
type: "string"
|
|
5417
5476
|
},
|
|
5418
5477
|
depositAccount: {
|
|
5419
|
-
|
|
5420
|
-
|
|
5421
|
-
|
|
5478
|
+
anyOf: [
|
|
5479
|
+
{
|
|
5480
|
+
type: "object",
|
|
5481
|
+
properties: {
|
|
5482
|
+
type: {
|
|
5483
|
+
type: "string"
|
|
5484
|
+
},
|
|
5485
|
+
iban: {
|
|
5486
|
+
type: [
|
|
5487
|
+
"string",
|
|
5488
|
+
"null"
|
|
5489
|
+
]
|
|
5490
|
+
},
|
|
5491
|
+
bic: {
|
|
5492
|
+
type: [
|
|
5493
|
+
"string",
|
|
5494
|
+
"null"
|
|
5495
|
+
]
|
|
5496
|
+
},
|
|
5497
|
+
accountNumber: {
|
|
5498
|
+
type: [
|
|
5499
|
+
"string",
|
|
5500
|
+
"null"
|
|
5501
|
+
]
|
|
5502
|
+
},
|
|
5503
|
+
routingNumber: {
|
|
5504
|
+
type: [
|
|
5505
|
+
"string",
|
|
5506
|
+
"null"
|
|
5507
|
+
]
|
|
5508
|
+
},
|
|
5509
|
+
bankName: {
|
|
5510
|
+
type: [
|
|
5511
|
+
"string",
|
|
5512
|
+
"null"
|
|
5513
|
+
]
|
|
5514
|
+
},
|
|
5515
|
+
bankAddress: {
|
|
5516
|
+
type: [
|
|
5517
|
+
"string",
|
|
5518
|
+
"null"
|
|
5519
|
+
]
|
|
5520
|
+
},
|
|
5521
|
+
recipientName: {
|
|
5522
|
+
type: [
|
|
5523
|
+
"string",
|
|
5524
|
+
"null"
|
|
5525
|
+
]
|
|
5526
|
+
}
|
|
5527
|
+
},
|
|
5528
|
+
required: [
|
|
5529
|
+
"type",
|
|
5530
|
+
"iban",
|
|
5531
|
+
"bic",
|
|
5532
|
+
"accountNumber",
|
|
5533
|
+
"routingNumber",
|
|
5534
|
+
"bankName",
|
|
5535
|
+
"bankAddress",
|
|
5536
|
+
"recipientName"
|
|
5537
|
+
],
|
|
5538
|
+
additionalProperties: false
|
|
5539
|
+
},
|
|
5540
|
+
{
|
|
5541
|
+
type: "null"
|
|
5542
|
+
}
|
|
5422
5543
|
]
|
|
5423
5544
|
},
|
|
5424
5545
|
walletAddress: {
|
|
5425
5546
|
type: "string"
|
|
5547
|
+
},
|
|
5548
|
+
fees: {
|
|
5549
|
+
anyOf: [
|
|
5550
|
+
{
|
|
5551
|
+
type: "object",
|
|
5552
|
+
properties: {
|
|
5553
|
+
transactionFee: {
|
|
5554
|
+
type: "string",
|
|
5555
|
+
description: "e.g. '0.50%'"
|
|
5556
|
+
},
|
|
5557
|
+
bankingFee: {
|
|
5558
|
+
type: [
|
|
5559
|
+
"string",
|
|
5560
|
+
"null"
|
|
5561
|
+
],
|
|
5562
|
+
description: "e.g. '0.50 EUR (SEPA)'"
|
|
5563
|
+
},
|
|
5564
|
+
networkFee: {
|
|
5565
|
+
type: "string",
|
|
5566
|
+
description: "'subsidized' or 'charged'"
|
|
5567
|
+
}
|
|
5568
|
+
},
|
|
5569
|
+
required: [
|
|
5570
|
+
"transactionFee",
|
|
5571
|
+
"bankingFee",
|
|
5572
|
+
"networkFee"
|
|
5573
|
+
],
|
|
5574
|
+
additionalProperties: false
|
|
5575
|
+
},
|
|
5576
|
+
{
|
|
5577
|
+
type: "null"
|
|
5578
|
+
}
|
|
5579
|
+
]
|
|
5580
|
+
},
|
|
5581
|
+
legalDisclaimer: {
|
|
5582
|
+
type: "string"
|
|
5426
5583
|
}
|
|
5427
5584
|
},
|
|
5428
5585
|
required: [
|
|
@@ -5432,7 +5589,9 @@ var schemas_default = [
|
|
|
5432
5589
|
"fiat",
|
|
5433
5590
|
"stablecoin",
|
|
5434
5591
|
"depositAccount",
|
|
5435
|
-
"walletAddress"
|
|
5592
|
+
"walletAddress",
|
|
5593
|
+
"fees",
|
|
5594
|
+
"legalDisclaimer"
|
|
5436
5595
|
],
|
|
5437
5596
|
additionalProperties: false
|
|
5438
5597
|
}
|
|
@@ -5535,13 +5694,111 @@ var schemas_default = [
|
|
|
5535
5694
|
type: "string"
|
|
5536
5695
|
},
|
|
5537
5696
|
depositAccount: {
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
|
|
5697
|
+
anyOf: [
|
|
5698
|
+
{
|
|
5699
|
+
type: "object",
|
|
5700
|
+
properties: {
|
|
5701
|
+
type: {
|
|
5702
|
+
type: "string"
|
|
5703
|
+
},
|
|
5704
|
+
iban: {
|
|
5705
|
+
type: [
|
|
5706
|
+
"string",
|
|
5707
|
+
"null"
|
|
5708
|
+
]
|
|
5709
|
+
},
|
|
5710
|
+
bic: {
|
|
5711
|
+
type: [
|
|
5712
|
+
"string",
|
|
5713
|
+
"null"
|
|
5714
|
+
]
|
|
5715
|
+
},
|
|
5716
|
+
accountNumber: {
|
|
5717
|
+
type: [
|
|
5718
|
+
"string",
|
|
5719
|
+
"null"
|
|
5720
|
+
]
|
|
5721
|
+
},
|
|
5722
|
+
routingNumber: {
|
|
5723
|
+
type: [
|
|
5724
|
+
"string",
|
|
5725
|
+
"null"
|
|
5726
|
+
]
|
|
5727
|
+
},
|
|
5728
|
+
bankName: {
|
|
5729
|
+
type: [
|
|
5730
|
+
"string",
|
|
5731
|
+
"null"
|
|
5732
|
+
]
|
|
5733
|
+
},
|
|
5734
|
+
bankAddress: {
|
|
5735
|
+
type: [
|
|
5736
|
+
"string",
|
|
5737
|
+
"null"
|
|
5738
|
+
]
|
|
5739
|
+
},
|
|
5740
|
+
recipientName: {
|
|
5741
|
+
type: [
|
|
5742
|
+
"string",
|
|
5743
|
+
"null"
|
|
5744
|
+
]
|
|
5745
|
+
}
|
|
5746
|
+
},
|
|
5747
|
+
required: [
|
|
5748
|
+
"type",
|
|
5749
|
+
"iban",
|
|
5750
|
+
"bic",
|
|
5751
|
+
"accountNumber",
|
|
5752
|
+
"routingNumber",
|
|
5753
|
+
"bankName",
|
|
5754
|
+
"bankAddress",
|
|
5755
|
+
"recipientName"
|
|
5756
|
+
],
|
|
5757
|
+
additionalProperties: false
|
|
5758
|
+
},
|
|
5759
|
+
{
|
|
5760
|
+
type: "null"
|
|
5761
|
+
}
|
|
5541
5762
|
]
|
|
5542
5763
|
},
|
|
5543
5764
|
walletAddress: {
|
|
5544
5765
|
type: "string"
|
|
5766
|
+
},
|
|
5767
|
+
fees: {
|
|
5768
|
+
anyOf: [
|
|
5769
|
+
{
|
|
5770
|
+
type: "object",
|
|
5771
|
+
properties: {
|
|
5772
|
+
transactionFee: {
|
|
5773
|
+
type: "string",
|
|
5774
|
+
description: "e.g. '0.50%'"
|
|
5775
|
+
},
|
|
5776
|
+
bankingFee: {
|
|
5777
|
+
type: [
|
|
5778
|
+
"string",
|
|
5779
|
+
"null"
|
|
5780
|
+
],
|
|
5781
|
+
description: "e.g. '0.50 EUR (SEPA)'"
|
|
5782
|
+
},
|
|
5783
|
+
networkFee: {
|
|
5784
|
+
type: "string",
|
|
5785
|
+
description: "'subsidized' or 'charged'"
|
|
5786
|
+
}
|
|
5787
|
+
},
|
|
5788
|
+
required: [
|
|
5789
|
+
"transactionFee",
|
|
5790
|
+
"bankingFee",
|
|
5791
|
+
"networkFee"
|
|
5792
|
+
],
|
|
5793
|
+
additionalProperties: false
|
|
5794
|
+
},
|
|
5795
|
+
{
|
|
5796
|
+
type: "null"
|
|
5797
|
+
}
|
|
5798
|
+
]
|
|
5799
|
+
},
|
|
5800
|
+
legalDisclaimer: {
|
|
5801
|
+
type: "string"
|
|
5545
5802
|
}
|
|
5546
5803
|
},
|
|
5547
5804
|
required: [
|
|
@@ -5551,7 +5808,9 @@ var schemas_default = [
|
|
|
5551
5808
|
"fiat",
|
|
5552
5809
|
"stablecoin",
|
|
5553
5810
|
"depositAccount",
|
|
5554
|
-
"walletAddress"
|
|
5811
|
+
"walletAddress",
|
|
5812
|
+
"fees",
|
|
5813
|
+
"legalDisclaimer"
|
|
5555
5814
|
],
|
|
5556
5815
|
additionalProperties: false
|
|
5557
5816
|
},
|
|
@@ -5760,13 +6019,111 @@ var schemas_default = [
|
|
|
5760
6019
|
type: "string"
|
|
5761
6020
|
},
|
|
5762
6021
|
depositAccount: {
|
|
5763
|
-
|
|
5764
|
-
|
|
5765
|
-
|
|
6022
|
+
anyOf: [
|
|
6023
|
+
{
|
|
6024
|
+
type: "object",
|
|
6025
|
+
properties: {
|
|
6026
|
+
type: {
|
|
6027
|
+
type: "string"
|
|
6028
|
+
},
|
|
6029
|
+
iban: {
|
|
6030
|
+
type: [
|
|
6031
|
+
"string",
|
|
6032
|
+
"null"
|
|
6033
|
+
]
|
|
6034
|
+
},
|
|
6035
|
+
bic: {
|
|
6036
|
+
type: [
|
|
6037
|
+
"string",
|
|
6038
|
+
"null"
|
|
6039
|
+
]
|
|
6040
|
+
},
|
|
6041
|
+
accountNumber: {
|
|
6042
|
+
type: [
|
|
6043
|
+
"string",
|
|
6044
|
+
"null"
|
|
6045
|
+
]
|
|
6046
|
+
},
|
|
6047
|
+
routingNumber: {
|
|
6048
|
+
type: [
|
|
6049
|
+
"string",
|
|
6050
|
+
"null"
|
|
6051
|
+
]
|
|
6052
|
+
},
|
|
6053
|
+
bankName: {
|
|
6054
|
+
type: [
|
|
6055
|
+
"string",
|
|
6056
|
+
"null"
|
|
6057
|
+
]
|
|
6058
|
+
},
|
|
6059
|
+
bankAddress: {
|
|
6060
|
+
type: [
|
|
6061
|
+
"string",
|
|
6062
|
+
"null"
|
|
6063
|
+
]
|
|
6064
|
+
},
|
|
6065
|
+
recipientName: {
|
|
6066
|
+
type: [
|
|
6067
|
+
"string",
|
|
6068
|
+
"null"
|
|
6069
|
+
]
|
|
6070
|
+
}
|
|
6071
|
+
},
|
|
6072
|
+
required: [
|
|
6073
|
+
"type",
|
|
6074
|
+
"iban",
|
|
6075
|
+
"bic",
|
|
6076
|
+
"accountNumber",
|
|
6077
|
+
"routingNumber",
|
|
6078
|
+
"bankName",
|
|
6079
|
+
"bankAddress",
|
|
6080
|
+
"recipientName"
|
|
6081
|
+
],
|
|
6082
|
+
additionalProperties: false
|
|
6083
|
+
},
|
|
6084
|
+
{
|
|
6085
|
+
type: "null"
|
|
6086
|
+
}
|
|
5766
6087
|
]
|
|
5767
6088
|
},
|
|
5768
6089
|
walletAddress: {
|
|
5769
6090
|
type: "string"
|
|
6091
|
+
},
|
|
6092
|
+
fees: {
|
|
6093
|
+
anyOf: [
|
|
6094
|
+
{
|
|
6095
|
+
type: "object",
|
|
6096
|
+
properties: {
|
|
6097
|
+
transactionFee: {
|
|
6098
|
+
type: "string",
|
|
6099
|
+
description: "e.g. '0.50%'"
|
|
6100
|
+
},
|
|
6101
|
+
bankingFee: {
|
|
6102
|
+
type: [
|
|
6103
|
+
"string",
|
|
6104
|
+
"null"
|
|
6105
|
+
],
|
|
6106
|
+
description: "e.g. '0.50 EUR (SEPA)'"
|
|
6107
|
+
},
|
|
6108
|
+
networkFee: {
|
|
6109
|
+
type: "string",
|
|
6110
|
+
description: "'subsidized' or 'charged'"
|
|
6111
|
+
}
|
|
6112
|
+
},
|
|
6113
|
+
required: [
|
|
6114
|
+
"transactionFee",
|
|
6115
|
+
"bankingFee",
|
|
6116
|
+
"networkFee"
|
|
6117
|
+
],
|
|
6118
|
+
additionalProperties: false
|
|
6119
|
+
},
|
|
6120
|
+
{
|
|
6121
|
+
type: "null"
|
|
6122
|
+
}
|
|
6123
|
+
]
|
|
6124
|
+
},
|
|
6125
|
+
legalDisclaimer: {
|
|
6126
|
+
type: "string"
|
|
5770
6127
|
}
|
|
5771
6128
|
},
|
|
5772
6129
|
required: [
|
|
@@ -5776,7 +6133,9 @@ var schemas_default = [
|
|
|
5776
6133
|
"fiat",
|
|
5777
6134
|
"stablecoin",
|
|
5778
6135
|
"depositAccount",
|
|
5779
|
-
"walletAddress"
|
|
6136
|
+
"walletAddress",
|
|
6137
|
+
"fees",
|
|
6138
|
+
"legalDisclaimer"
|
|
5780
6139
|
],
|
|
5781
6140
|
additionalProperties: false
|
|
5782
6141
|
}
|
|
@@ -6002,27 +6361,20 @@ var schemas_default = [
|
|
|
6002
6361
|
description: "Signature of the message, signed by the wallet's private key"
|
|
6003
6362
|
},
|
|
6004
6363
|
chain: {
|
|
6005
|
-
|
|
6006
|
-
|
|
6007
|
-
|
|
6008
|
-
|
|
6009
|
-
|
|
6010
|
-
|
|
6011
|
-
|
|
6012
|
-
|
|
6013
|
-
|
|
6014
|
-
|
|
6015
|
-
|
|
6016
|
-
|
|
6017
|
-
"tron",
|
|
6018
|
-
"bitcoin"
|
|
6019
|
-
]
|
|
6020
|
-
},
|
|
6021
|
-
{
|
|
6022
|
-
type: "null"
|
|
6023
|
-
}
|
|
6364
|
+
type: "string",
|
|
6365
|
+
enum: [
|
|
6366
|
+
"solana",
|
|
6367
|
+
"ethereum",
|
|
6368
|
+
"base",
|
|
6369
|
+
"polygon",
|
|
6370
|
+
"arbitrum",
|
|
6371
|
+
"optimism",
|
|
6372
|
+
"bnb",
|
|
6373
|
+
"avalanche",
|
|
6374
|
+
"tron",
|
|
6375
|
+
"bitcoin"
|
|
6024
6376
|
],
|
|
6025
|
-
description: "Blockchain (
|
|
6377
|
+
description: "Blockchain for wallet registration (solana, ethereum, polygon, base, arbitrum)"
|
|
6026
6378
|
}
|
|
6027
6379
|
},
|
|
6028
6380
|
required: [
|
|
@@ -6100,11 +6452,10 @@ var schemas_default = [
|
|
|
6100
6452
|
}
|
|
6101
6453
|
];
|
|
6102
6454
|
|
|
6103
|
-
// src/tools/
|
|
6104
|
-
import
|
|
6105
|
-
import
|
|
6106
|
-
import
|
|
6107
|
-
import { platform } from "os";
|
|
6455
|
+
// src/tools/consent/check/tool.ts
|
|
6456
|
+
import * as fs2 from "fs";
|
|
6457
|
+
import * as os2 from "os";
|
|
6458
|
+
import * as path2 from "path";
|
|
6108
6459
|
|
|
6109
6460
|
// src/tools/shared.ts
|
|
6110
6461
|
var defineToolSchema = (config) => config;
|
|
@@ -6117,36 +6468,59 @@ var createTool = (schema, handler) => ({
|
|
|
6117
6468
|
}
|
|
6118
6469
|
});
|
|
6119
6470
|
|
|
6120
|
-
// src/tools/
|
|
6471
|
+
// src/tools/consent/check/schema.ts
|
|
6121
6472
|
import { z } from "zod";
|
|
6473
|
+
var consentCheckSchema = defineToolSchema({
|
|
6474
|
+
name: "consent_check",
|
|
6475
|
+
description: "Check whether the MoonPay Terms of Service and Privacy Policy have been accepted. Throws if not accepted.",
|
|
6476
|
+
input: z.object({}),
|
|
6477
|
+
output: z.object({
|
|
6478
|
+
accepted: z.literal(true),
|
|
6479
|
+
tosVersion: z.string(),
|
|
6480
|
+
acceptedAt: z.string()
|
|
6481
|
+
})
|
|
6482
|
+
});
|
|
6483
|
+
|
|
6484
|
+
// src/tools/consent/check/tool.ts
|
|
6485
|
+
var CONSENT_PATH = path2.join(os2.homedir(), ".config", "moonpay", "consent.json");
|
|
6486
|
+
var CURRENT_TOS_VERSION = "1.0";
|
|
6487
|
+
var consentCheck = createTool(consentCheckSchema, async () => {
|
|
6488
|
+
let consent = null;
|
|
6489
|
+
try {
|
|
6490
|
+
consent = JSON.parse(fs2.readFileSync(CONSENT_PATH, "utf-8"));
|
|
6491
|
+
} catch {
|
|
6492
|
+
}
|
|
6493
|
+
if (!consent || consent.tosVersion !== CURRENT_TOS_VERSION) {
|
|
6494
|
+
throw new Error(
|
|
6495
|
+
"Terms of Service not yet accepted. Run `mp consent accept` first."
|
|
6496
|
+
);
|
|
6497
|
+
}
|
|
6498
|
+
return {
|
|
6499
|
+
accepted: true,
|
|
6500
|
+
tosVersion: consent.tosVersion,
|
|
6501
|
+
acceptedAt: consent.acceptedAt
|
|
6502
|
+
};
|
|
6503
|
+
});
|
|
6504
|
+
|
|
6505
|
+
// src/tools/wallet/create/tool.ts
|
|
6506
|
+
import { generateMnemonic } from "@scure/bip39";
|
|
6507
|
+
import { wordlist as english } from "@scure/bip39/wordlists/english";
|
|
6508
|
+
|
|
6509
|
+
// src/tools/wallet/create/schema.ts
|
|
6510
|
+
import { z as z2 } from "zod";
|
|
6122
6511
|
var walletCreateSchema = defineToolSchema({
|
|
6123
6512
|
name: "wallet_create",
|
|
6124
6513
|
description: "Create a new multi-chain HD wallet. Generates a BIP39 mnemonic and derives addresses for Solana, Ethereum, Bitcoin, and Tron. The mnemonic is copied to clipboard (interactive) or omitted (headless). Keys are encrypted with a random key stored in the OS keychain.",
|
|
6125
|
-
input:
|
|
6126
|
-
name:
|
|
6514
|
+
input: z2.object({
|
|
6515
|
+
name: z2.string().describe("Wallet name")
|
|
6127
6516
|
}),
|
|
6128
|
-
output:
|
|
6129
|
-
name:
|
|
6130
|
-
addresses:
|
|
6517
|
+
output: z2.object({
|
|
6518
|
+
name: z2.string(),
|
|
6519
|
+
addresses: z2.record(chainSchema, z2.string())
|
|
6131
6520
|
})
|
|
6132
6521
|
});
|
|
6133
6522
|
|
|
6134
6523
|
// src/tools/wallet/create/tool.ts
|
|
6135
|
-
function copyToClipboard(text) {
|
|
6136
|
-
try {
|
|
6137
|
-
const os2 = platform();
|
|
6138
|
-
if (os2 === "darwin") {
|
|
6139
|
-
execSync("pbcopy", { input: text, stdio: ["pipe", "ignore", "ignore"] });
|
|
6140
|
-
return true;
|
|
6141
|
-
}
|
|
6142
|
-
if (os2 === "linux") {
|
|
6143
|
-
execSync("xclip -selection clipboard", { input: text, stdio: ["pipe", "ignore", "ignore"] });
|
|
6144
|
-
return true;
|
|
6145
|
-
}
|
|
6146
|
-
} catch {
|
|
6147
|
-
}
|
|
6148
|
-
return false;
|
|
6149
|
-
}
|
|
6150
6524
|
var walletCreate = createTool(walletCreateSchema, async (params) => {
|
|
6151
6525
|
const mnemonic = generateMnemonic(english, 256);
|
|
6152
6526
|
const addresses = deriveAllAddresses(mnemonic);
|
|
@@ -6157,19 +6531,6 @@ var walletCreate = createTool(walletCreateSchema, async (params) => {
|
|
|
6157
6531
|
addresses,
|
|
6158
6532
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
6159
6533
|
});
|
|
6160
|
-
if (process.stdout.isTTY) {
|
|
6161
|
-
const copied = copyToClipboard(mnemonic);
|
|
6162
|
-
if (copied) {
|
|
6163
|
-
process.stderr.write(
|
|
6164
|
-
"\nMnemonic copied to clipboard. Paste it into your password manager.\nClipboard will be cleared in 30 seconds.\n\n"
|
|
6165
|
-
);
|
|
6166
|
-
setTimeout(() => copyToClipboard(""), 3e4).unref();
|
|
6167
|
-
} else {
|
|
6168
|
-
process.stderr.write(
|
|
6169
|
-
"\nCould not copy to clipboard. Run `mp wallet export` to view your mnemonic.\n\n"
|
|
6170
|
-
);
|
|
6171
|
-
}
|
|
6172
|
-
}
|
|
6173
6534
|
return { name: params.name, addresses: expandAddresses(addresses) };
|
|
6174
6535
|
});
|
|
6175
6536
|
|
|
@@ -6181,19 +6542,19 @@ import bs58 from "bs58";
|
|
|
6181
6542
|
import { privateKeyToAccount } from "viem/accounts";
|
|
6182
6543
|
|
|
6183
6544
|
// src/tools/wallet/import/schema.ts
|
|
6184
|
-
import { z as
|
|
6545
|
+
import { z as z3 } from "zod";
|
|
6185
6546
|
var walletImportSchema = defineToolSchema({
|
|
6186
6547
|
name: "wallet_import",
|
|
6187
6548
|
description: "Import a wallet from a BIP39 mnemonic (HD, all chains) or a single private key (one chain). Provide either --mnemonic or --key, not both.",
|
|
6188
|
-
input:
|
|
6189
|
-
name:
|
|
6190
|
-
mnemonic:
|
|
6191
|
-
key:
|
|
6549
|
+
input: z3.object({
|
|
6550
|
+
name: z3.string().describe("Wallet name"),
|
|
6551
|
+
mnemonic: z3.string().nullable().describe("BIP39 mnemonic seed phrase (for HD wallet import)"),
|
|
6552
|
+
key: z3.string().nullable().describe("Private key: base58 for Solana, hex for EVM/Bitcoin"),
|
|
6192
6553
|
chain: chainSchema.nullable().describe("Chain for single-key import (default solana)")
|
|
6193
6554
|
}),
|
|
6194
|
-
output:
|
|
6195
|
-
name:
|
|
6196
|
-
type:
|
|
6555
|
+
output: z3.object({
|
|
6556
|
+
name: z3.string(),
|
|
6557
|
+
type: z3.enum(["hd", "imported"]),
|
|
6197
6558
|
addresses: addressesSchema
|
|
6198
6559
|
})
|
|
6199
6560
|
});
|
|
@@ -6252,12 +6613,12 @@ var walletImport = createTool(walletImportSchema, async (params) => {
|
|
|
6252
6613
|
});
|
|
6253
6614
|
|
|
6254
6615
|
// src/tools/wallet/list/schema.ts
|
|
6255
|
-
import { z as
|
|
6616
|
+
import { z as z4 } from "zod";
|
|
6256
6617
|
var walletListSchema = defineToolSchema({
|
|
6257
6618
|
name: "wallet_list",
|
|
6258
6619
|
description: "List all local wallets",
|
|
6259
|
-
input:
|
|
6260
|
-
output:
|
|
6620
|
+
input: z4.object({}),
|
|
6621
|
+
output: z4.array(walletInfoSchema)
|
|
6261
6622
|
});
|
|
6262
6623
|
|
|
6263
6624
|
// src/tools/wallet/list/tool.ts
|
|
@@ -6272,12 +6633,12 @@ var walletList = createTool(walletListSchema, async () => {
|
|
|
6272
6633
|
});
|
|
6273
6634
|
|
|
6274
6635
|
// src/tools/wallet/retrieve/schema.ts
|
|
6275
|
-
import { z as
|
|
6636
|
+
import { z as z5 } from "zod";
|
|
6276
6637
|
var walletRetrieveSchema = defineToolSchema({
|
|
6277
6638
|
name: "wallet_retrieve",
|
|
6278
6639
|
description: "Get details of a specific wallet",
|
|
6279
|
-
input:
|
|
6280
|
-
wallet:
|
|
6640
|
+
input: z5.object({
|
|
6641
|
+
wallet: z5.string().describe("Wallet name or address")
|
|
6281
6642
|
}),
|
|
6282
6643
|
output: walletInfoSchema
|
|
6283
6644
|
});
|
|
@@ -6294,17 +6655,17 @@ var walletRetrieve = createTool(walletRetrieveSchema, async (params) => {
|
|
|
6294
6655
|
});
|
|
6295
6656
|
|
|
6296
6657
|
// src/tools/wallet/delete/schema.ts
|
|
6297
|
-
import { z as
|
|
6658
|
+
import { z as z6 } from "zod";
|
|
6298
6659
|
var walletDeleteSchema = defineToolSchema({
|
|
6299
6660
|
name: "wallet_delete",
|
|
6300
6661
|
description: "Permanently delete a local wallet. This removes the private key file and cannot be undone.",
|
|
6301
|
-
input:
|
|
6302
|
-
wallet:
|
|
6303
|
-
confirm:
|
|
6662
|
+
input: z6.object({
|
|
6663
|
+
wallet: z6.string().describe("Name or address of the wallet to delete"),
|
|
6664
|
+
confirm: z6.boolean().describe("Must be true to confirm deletion")
|
|
6304
6665
|
}),
|
|
6305
|
-
output:
|
|
6306
|
-
name:
|
|
6307
|
-
deleted:
|
|
6666
|
+
output: z6.object({
|
|
6667
|
+
name: z6.string().describe("Name of the deleted wallet"),
|
|
6668
|
+
deleted: z6.literal(true)
|
|
6308
6669
|
})
|
|
6309
6670
|
});
|
|
6310
6671
|
|
|
@@ -6321,17 +6682,17 @@ var walletDelete = createTool(walletDeleteSchema, async (params) => {
|
|
|
6321
6682
|
});
|
|
6322
6683
|
|
|
6323
6684
|
// src/tools/wallet/rename/schema.ts
|
|
6324
|
-
import { z as
|
|
6685
|
+
import { z as z7 } from "zod";
|
|
6325
6686
|
var walletRenameSchema = defineToolSchema({
|
|
6326
6687
|
name: "wallet_rename",
|
|
6327
6688
|
description: "Rename a local wallet.",
|
|
6328
|
-
input:
|
|
6329
|
-
wallet:
|
|
6330
|
-
name:
|
|
6689
|
+
input: z7.object({
|
|
6690
|
+
wallet: z7.string().describe("Current name or address of the wallet"),
|
|
6691
|
+
name: z7.string().describe("New name for the wallet")
|
|
6331
6692
|
}),
|
|
6332
|
-
output:
|
|
6333
|
-
oldName:
|
|
6334
|
-
newName:
|
|
6693
|
+
output: z7.object({
|
|
6694
|
+
oldName: z7.string(),
|
|
6695
|
+
newName: z7.string()
|
|
6335
6696
|
})
|
|
6336
6697
|
});
|
|
6337
6698
|
|
|
@@ -6354,6 +6715,48 @@ var walletRename = createTool(walletRenameSchema, async (params) => {
|
|
|
6354
6715
|
return { oldName, newName: params.name };
|
|
6355
6716
|
});
|
|
6356
6717
|
|
|
6718
|
+
// src/tools/wallet/export/schema.ts
|
|
6719
|
+
import { z as z8 } from "zod";
|
|
6720
|
+
var walletExportSchema = defineToolSchema({
|
|
6721
|
+
name: "wallet_export",
|
|
6722
|
+
description: "Export wallet secret (mnemonic or private key). Interactive only \u2014 cannot be run by agents or piped.",
|
|
6723
|
+
input: z8.object({
|
|
6724
|
+
wallet: z8.string().describe("Wallet name")
|
|
6725
|
+
}),
|
|
6726
|
+
output: z8.object({
|
|
6727
|
+
exported: z8.literal(true)
|
|
6728
|
+
})
|
|
6729
|
+
});
|
|
6730
|
+
|
|
6731
|
+
// src/tools/wallet/export/tool.ts
|
|
6732
|
+
var walletExport = createTool(walletExportSchema, async (params) => {
|
|
6733
|
+
if (!process.stdout.isTTY) {
|
|
6734
|
+
throw new Error(
|
|
6735
|
+
"Wallet export requires an interactive terminal.\nRun this command directly in your terminal: mp wallet export " + params.wallet
|
|
6736
|
+
);
|
|
6737
|
+
}
|
|
6738
|
+
const wallet = findWalletOrThrow(params.wallet);
|
|
6739
|
+
if (wallet.type === "hd") {
|
|
6740
|
+
process.stderr.write(`
|
|
6741
|
+
Mnemonic for "${wallet.name}":
|
|
6742
|
+
|
|
6743
|
+
`);
|
|
6744
|
+
process.stderr.write(` ${wallet.mnemonic}
|
|
6745
|
+
|
|
6746
|
+
`);
|
|
6747
|
+
process.stderr.write("Write this down and store it securely.\n\n");
|
|
6748
|
+
} else {
|
|
6749
|
+
process.stderr.write(`
|
|
6750
|
+
Private key for "${wallet.name}" (${wallet.chain}):
|
|
6751
|
+
|
|
6752
|
+
`);
|
|
6753
|
+
process.stderr.write(` ${wallet.privateKey}
|
|
6754
|
+
|
|
6755
|
+
`);
|
|
6756
|
+
}
|
|
6757
|
+
return { exported: true };
|
|
6758
|
+
});
|
|
6759
|
+
|
|
6357
6760
|
// src/tools/transaction/sign/tool.ts
|
|
6358
6761
|
import { createHash } from "crypto";
|
|
6359
6762
|
import { Keypair as Keypair2, VersionedTransaction } from "@solana/web3.js";
|
|
@@ -6364,19 +6767,19 @@ import * as viemChains from "viem/chains";
|
|
|
6364
6767
|
import * as ecc from "tiny-secp256k1";
|
|
6365
6768
|
|
|
6366
6769
|
// src/tools/transaction/sign/schema.ts
|
|
6367
|
-
import { z as
|
|
6770
|
+
import { z as z9 } from "zod";
|
|
6368
6771
|
var transactionSignSchema = defineToolSchema({
|
|
6369
6772
|
name: "transaction_sign",
|
|
6370
6773
|
description: "Sign a transaction with a local wallet. Supports Solana (VersionedTransaction), EVM (RLP-encoded), and Bitcoin (PSBT) transactions.",
|
|
6371
|
-
input:
|
|
6372
|
-
wallet:
|
|
6774
|
+
input: z9.object({
|
|
6775
|
+
wallet: z9.string().describe("Wallet name or address"),
|
|
6373
6776
|
chain: chainSchema.describe(
|
|
6374
6777
|
"Chain: solana, ethereum, base, arbitrum, or bitcoin"
|
|
6375
6778
|
),
|
|
6376
|
-
transaction:
|
|
6779
|
+
transaction: z9.string().describe("Base64-encoded unsigned transaction")
|
|
6377
6780
|
}),
|
|
6378
|
-
output:
|
|
6379
|
-
transaction:
|
|
6781
|
+
output: z9.object({
|
|
6782
|
+
transaction: z9.string().describe("Base64-encoded signed transaction")
|
|
6380
6783
|
})
|
|
6381
6784
|
});
|
|
6382
6785
|
|
|
@@ -6491,19 +6894,19 @@ import { keccak_256 } from "@noble/hashes/sha3";
|
|
|
6491
6894
|
import { privateKeyToAccount as privateKeyToAccount3 } from "viem/accounts";
|
|
6492
6895
|
|
|
6493
6896
|
// src/tools/message/sign/schema.ts
|
|
6494
|
-
import { z as
|
|
6897
|
+
import { z as z10 } from "zod";
|
|
6495
6898
|
var messageSignSchema = defineToolSchema({
|
|
6496
6899
|
name: "message_sign",
|
|
6497
6900
|
description: "Sign a message with a local wallet. Supports Solana (ed25519), EVM (EIP-191 personal sign), and Bitcoin (secp256k1 ECDSA).",
|
|
6498
|
-
input:
|
|
6499
|
-
wallet:
|
|
6901
|
+
input: z10.object({
|
|
6902
|
+
wallet: z10.string().describe("Wallet address or name to sign with"),
|
|
6500
6903
|
chain: chainSchema.describe(
|
|
6501
6904
|
"Chain: solana, ethereum, base, arbitrum, or bitcoin"
|
|
6502
6905
|
),
|
|
6503
|
-
message:
|
|
6906
|
+
message: z10.string().describe("Message text to sign")
|
|
6504
6907
|
}),
|
|
6505
|
-
output:
|
|
6506
|
-
signature:
|
|
6908
|
+
output: z10.object({
|
|
6909
|
+
signature: z10.string().describe(
|
|
6507
6910
|
"Signature: base58 for Solana, hex (0x-prefixed) for EVM/Bitcoin"
|
|
6508
6911
|
)
|
|
6509
6912
|
})
|
|
@@ -6563,26 +6966,26 @@ function signBitcoin2(privateKey, messageBytes) {
|
|
|
6563
6966
|
import https from "https";
|
|
6564
6967
|
|
|
6565
6968
|
// src/tools/bitcoin/balance/schema.ts
|
|
6566
|
-
import { z as
|
|
6969
|
+
import { z as z11 } from "zod";
|
|
6567
6970
|
var bitcoinBalanceRetrieveSchema = defineToolSchema({
|
|
6568
6971
|
name: "bitcoin_balance_retrieve",
|
|
6569
6972
|
description: "Get the BTC balance of a Bitcoin address. Returns confirmed and unconfirmed balances in BTC and satoshis.",
|
|
6570
|
-
input:
|
|
6571
|
-
wallet:
|
|
6973
|
+
input: z11.object({
|
|
6974
|
+
wallet: z11.string().describe("Bitcoin address (bc1...) or wallet name")
|
|
6572
6975
|
}),
|
|
6573
|
-
output:
|
|
6574
|
-
address:
|
|
6575
|
-
confirmed:
|
|
6576
|
-
btc:
|
|
6577
|
-
sats:
|
|
6976
|
+
output: z11.object({
|
|
6977
|
+
address: z11.string().describe("Bitcoin address"),
|
|
6978
|
+
confirmed: z11.object({
|
|
6979
|
+
btc: z11.string().describe("Confirmed balance in BTC"),
|
|
6980
|
+
sats: z11.number().describe("Confirmed balance in satoshis")
|
|
6578
6981
|
}),
|
|
6579
|
-
unconfirmed:
|
|
6580
|
-
btc:
|
|
6581
|
-
sats:
|
|
6982
|
+
unconfirmed: z11.object({
|
|
6983
|
+
btc: z11.string().describe("Unconfirmed (pending) balance in BTC"),
|
|
6984
|
+
sats: z11.number().describe("Unconfirmed (pending) balance in satoshis")
|
|
6582
6985
|
}),
|
|
6583
|
-
total:
|
|
6584
|
-
btc:
|
|
6585
|
-
sats:
|
|
6986
|
+
total: z11.object({
|
|
6987
|
+
btc: z11.string().describe("Total balance in BTC"),
|
|
6988
|
+
sats: z11.number().describe("Total balance in satoshis")
|
|
6586
6989
|
})
|
|
6587
6990
|
})
|
|
6588
6991
|
});
|
|
@@ -6617,7 +7020,7 @@ var bitcoinBalanceRetrieve = createTool(
|
|
|
6617
7020
|
async (params) => {
|
|
6618
7021
|
let address = params.wallet;
|
|
6619
7022
|
if (!address.startsWith("bc1") && !address.startsWith("1") && !address.startsWith("3")) {
|
|
6620
|
-
const { findWalletOrThrow: findWalletOrThrow2 } = await import("./store-
|
|
7023
|
+
const { findWalletOrThrow: findWalletOrThrow2 } = await import("./store-6OIOBMHW.js");
|
|
6621
7024
|
const wallet = findWalletOrThrow2(address);
|
|
6622
7025
|
const btcAddress = wallet.addresses.bitcoin;
|
|
6623
7026
|
if (!btcAddress) {
|
|
@@ -6642,28 +7045,141 @@ var bitcoinBalanceRetrieve = createTool(
|
|
|
6642
7045
|
}
|
|
6643
7046
|
);
|
|
6644
7047
|
|
|
7048
|
+
// src/tools/skill/server.ts
|
|
7049
|
+
import { readdirSync, readFileSync as readFileSync3, existsSync as existsSync2, mkdirSync as mkdirSync2, cpSync } from "fs";
|
|
7050
|
+
import { join as join3, dirname } from "path";
|
|
7051
|
+
import { homedir as homedir3 } from "os";
|
|
7052
|
+
import { fileURLToPath } from "url";
|
|
7053
|
+
function getSkillsDir() {
|
|
7054
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
7055
|
+
const distDir = dirname(__filename);
|
|
7056
|
+
return join3(distDir, "..", "skills");
|
|
7057
|
+
}
|
|
7058
|
+
function getClaudeSkillsDir() {
|
|
7059
|
+
return join3(homedir3(), ".claude", "skills");
|
|
7060
|
+
}
|
|
7061
|
+
function listBundledSkills() {
|
|
7062
|
+
const dir = getSkillsDir();
|
|
7063
|
+
if (!existsSync2(dir)) return [];
|
|
7064
|
+
return readdirSync(dir, { withFileTypes: true }).filter((e) => e.isDirectory() && e.name.startsWith("moonpay-")).map((e) => {
|
|
7065
|
+
const md = readFileSync3(join3(dir, e.name, "SKILL.md"), "utf-8");
|
|
7066
|
+
const descMatch = md.match(/^description:\s*(.+)$/m);
|
|
7067
|
+
return {
|
|
7068
|
+
name: e.name,
|
|
7069
|
+
description: descMatch?.[1]?.replace(/^["']|["']$/g, "") ?? ""
|
|
7070
|
+
};
|
|
7071
|
+
}).sort((a, b) => a.name.localeCompare(b.name));
|
|
7072
|
+
}
|
|
7073
|
+
function readSkill(name) {
|
|
7074
|
+
if (/[/\\]|\.\./.test(name)) throw new Error(`Invalid skill name: "${name}"`);
|
|
7075
|
+
const skillPath = join3(getSkillsDir(), name, "SKILL.md");
|
|
7076
|
+
if (!existsSync2(skillPath)) {
|
|
7077
|
+
throw new Error(`Skill "${name}" not found. Run \`mp skill list\` to see available skills.`);
|
|
7078
|
+
}
|
|
7079
|
+
return readFileSync3(skillPath, "utf-8");
|
|
7080
|
+
}
|
|
7081
|
+
function installSkills(force, dir) {
|
|
7082
|
+
const srcDir = getSkillsDir();
|
|
7083
|
+
const destDir = dir ?? getClaudeSkillsDir();
|
|
7084
|
+
const skills = listBundledSkills();
|
|
7085
|
+
mkdirSync2(destDir, { recursive: true });
|
|
7086
|
+
return skills.map((s) => {
|
|
7087
|
+
const dest = join3(destDir, s.name);
|
|
7088
|
+
if (existsSync2(dest) && !force) {
|
|
7089
|
+
return { name: s.name, installed: false };
|
|
7090
|
+
}
|
|
7091
|
+
cpSync(join3(srcDir, s.name), dest, { recursive: true, force: true });
|
|
7092
|
+
return { name: s.name, installed: true };
|
|
7093
|
+
});
|
|
7094
|
+
}
|
|
7095
|
+
|
|
7096
|
+
// src/tools/skill/list/schema.ts
|
|
7097
|
+
import { z as z12 } from "zod";
|
|
7098
|
+
var skillListSchema = defineToolSchema({
|
|
7099
|
+
name: "skill_list",
|
|
7100
|
+
description: "List available AI skills for Claude Code and other agents",
|
|
7101
|
+
input: z12.object({}),
|
|
7102
|
+
output: z12.array(
|
|
7103
|
+
z12.object({
|
|
7104
|
+
name: z12.string(),
|
|
7105
|
+
description: z12.string()
|
|
7106
|
+
})
|
|
7107
|
+
)
|
|
7108
|
+
});
|
|
7109
|
+
|
|
7110
|
+
// src/tools/skill/list/tool.ts
|
|
7111
|
+
var skillList = createTool(skillListSchema, async () => {
|
|
7112
|
+
return listBundledSkills();
|
|
7113
|
+
});
|
|
7114
|
+
|
|
7115
|
+
// src/tools/skill/retrieve/schema.ts
|
|
7116
|
+
import { z as z13 } from "zod";
|
|
7117
|
+
var skillRetrieveSchema = defineToolSchema({
|
|
7118
|
+
name: "skill_retrieve",
|
|
7119
|
+
description: "Get the full instructions for a specific skill",
|
|
7120
|
+
input: z13.object({
|
|
7121
|
+
name: z13.string().describe("Skill name (e.g. moonpay-swap-tokens)")
|
|
7122
|
+
}),
|
|
7123
|
+
output: z13.object({
|
|
7124
|
+
name: z13.string(),
|
|
7125
|
+
content: z13.string()
|
|
7126
|
+
})
|
|
7127
|
+
});
|
|
7128
|
+
|
|
7129
|
+
// src/tools/skill/retrieve/tool.ts
|
|
7130
|
+
var skillRetrieve = createTool(skillRetrieveSchema, async (params) => {
|
|
7131
|
+
return {
|
|
7132
|
+
name: params.name,
|
|
7133
|
+
content: readSkill(params.name)
|
|
7134
|
+
};
|
|
7135
|
+
});
|
|
7136
|
+
|
|
7137
|
+
// src/tools/skill/install/schema.ts
|
|
7138
|
+
import { z as z14 } from "zod";
|
|
7139
|
+
var skillInstallSchema = defineToolSchema({
|
|
7140
|
+
name: "skill_install",
|
|
7141
|
+
description: "Install AI skills for Claude Code. Defaults to ~/.claude/skills/, or specify --dir for a custom location (e.g. project-local, ~/.agents/skills).",
|
|
7142
|
+
input: z14.object({
|
|
7143
|
+
force: z14.boolean().describe("Overwrite existing skills"),
|
|
7144
|
+
dir: z14.string().nullable().describe(
|
|
7145
|
+
"Target directory to install skills into (default: ~/.claude/skills/)"
|
|
7146
|
+
)
|
|
7147
|
+
}),
|
|
7148
|
+
output: z14.array(
|
|
7149
|
+
z14.object({
|
|
7150
|
+
name: z14.string(),
|
|
7151
|
+
installed: z14.boolean()
|
|
7152
|
+
})
|
|
7153
|
+
)
|
|
7154
|
+
});
|
|
7155
|
+
|
|
7156
|
+
// src/tools/skill/install/tool.ts
|
|
7157
|
+
var skillInstall = createTool(skillInstallSchema, async (params) => {
|
|
7158
|
+
return installSkills(params.force, params.dir ?? void 0);
|
|
7159
|
+
});
|
|
7160
|
+
|
|
6645
7161
|
// src/tools/token/swap/tool.ts
|
|
6646
7162
|
import { encodeFunctionData } from "viem";
|
|
6647
7163
|
|
|
6648
7164
|
// src/tools/token/swap/schema.ts
|
|
6649
|
-
import { z as
|
|
6650
|
-
var swapOutputSchema =
|
|
6651
|
-
signature:
|
|
6652
|
-
message:
|
|
7165
|
+
import { z as z15 } from "zod";
|
|
7166
|
+
var swapOutputSchema = z15.object({
|
|
7167
|
+
signature: z15.string().describe("Transaction hash/signature"),
|
|
7168
|
+
message: z15.string().describe("Human-readable swap description")
|
|
6653
7169
|
});
|
|
6654
7170
|
var tokenSwapSchema = defineToolSchema({
|
|
6655
7171
|
name: "token_swap",
|
|
6656
7172
|
description: "Swap tokens on the same chain. Builds, signs locally, broadcasts, and registers.",
|
|
6657
|
-
input:
|
|
6658
|
-
wallet:
|
|
7173
|
+
input: z15.object({
|
|
7174
|
+
wallet: z15.string().describe("Local wallet name to sign with"),
|
|
6659
7175
|
chain: chainSchema.describe("Chain to swap on"),
|
|
6660
|
-
from:
|
|
6661
|
-
token:
|
|
6662
|
-
amount:
|
|
7176
|
+
from: z15.object({
|
|
7177
|
+
token: z15.string().describe("Input token address (selling)"),
|
|
7178
|
+
amount: z15.coerce.number().nullable().describe("Amount to sell (exact-in). Null for exact-out.")
|
|
6663
7179
|
}),
|
|
6664
|
-
to:
|
|
6665
|
-
token:
|
|
6666
|
-
amount:
|
|
7180
|
+
to: z15.object({
|
|
7181
|
+
token: z15.string().describe("Output token address (buying)"),
|
|
7182
|
+
amount: z15.coerce.number().nullable().describe("Amount to receive (exact-out). Null for exact-in.")
|
|
6667
7183
|
})
|
|
6668
7184
|
}),
|
|
6669
7185
|
output: swapOutputSchema
|
|
@@ -6671,18 +7187,18 @@ var tokenSwapSchema = defineToolSchema({
|
|
|
6671
7187
|
var tokenBridgeSchema = defineToolSchema({
|
|
6672
7188
|
name: "token_bridge",
|
|
6673
7189
|
description: "Bridge tokens across chains. Builds, signs locally, broadcasts, and registers.",
|
|
6674
|
-
input:
|
|
6675
|
-
from:
|
|
6676
|
-
wallet:
|
|
7190
|
+
input: z15.object({
|
|
7191
|
+
from: z15.object({
|
|
7192
|
+
wallet: z15.string().describe("Local wallet name to sign with"),
|
|
6677
7193
|
chain: chainSchema.describe("Source chain"),
|
|
6678
|
-
token:
|
|
6679
|
-
amount:
|
|
7194
|
+
token: z15.string().describe("Source token address"),
|
|
7195
|
+
amount: z15.coerce.number().nullable().describe("Amount to send (exact-in). Null for exact-out.")
|
|
6680
7196
|
}),
|
|
6681
|
-
to:
|
|
6682
|
-
wallet:
|
|
7197
|
+
to: z15.object({
|
|
7198
|
+
wallet: z15.string().nullable().describe("Destination wallet name or address (defaults to from wallet)"),
|
|
6683
7199
|
chain: chainSchema.describe("Destination chain"),
|
|
6684
|
-
token:
|
|
6685
|
-
amount:
|
|
7200
|
+
token: z15.string().describe("Destination token address"),
|
|
7201
|
+
amount: z15.coerce.number().nullable().describe("Amount to receive (exact-out). Null for exact-in.")
|
|
6686
7202
|
})
|
|
6687
7203
|
}),
|
|
6688
7204
|
output: swapOutputSchema
|
|
@@ -6787,6 +7303,62 @@ var tokenSwap = createTool(tokenSwapSchema, async (params) => {
|
|
|
6787
7303
|
});
|
|
6788
7304
|
});
|
|
6789
7305
|
|
|
7306
|
+
// src/tools/token/transfer/schema.ts
|
|
7307
|
+
import { z as z16 } from "zod";
|
|
7308
|
+
var tokenTransferSchema = defineToolSchema({
|
|
7309
|
+
name: "token_transfer",
|
|
7310
|
+
description: "Transfer tokens to another wallet on the same chain. Builds, signs locally, and broadcasts.",
|
|
7311
|
+
input: z16.object({
|
|
7312
|
+
wallet: z16.string().describe("Local wallet name to sign with"),
|
|
7313
|
+
chain: chainSchema.describe("Chain to transfer on"),
|
|
7314
|
+
token: z16.string().describe("Token address to transfer"),
|
|
7315
|
+
amount: z16.coerce.number().describe("Amount to transfer"),
|
|
7316
|
+
to: z16.string().describe("Recipient wallet name or address")
|
|
7317
|
+
}),
|
|
7318
|
+
output: z16.object({
|
|
7319
|
+
signature: z16.string().describe("Transaction hash/signature"),
|
|
7320
|
+
message: z16.string().describe("Human-readable transfer description")
|
|
7321
|
+
})
|
|
7322
|
+
});
|
|
7323
|
+
|
|
7324
|
+
// src/tools/token/transfer/tool.ts
|
|
7325
|
+
var tokenTransfer = createTool(tokenTransferSchema, async (params) => {
|
|
7326
|
+
const baseUrl = resolveBaseUrl();
|
|
7327
|
+
const wallet = await walletRetrieve.handler({ wallet: params.wallet });
|
|
7328
|
+
const fromAddress = wallet.addresses[KEY_CHAIN_MAP[params.chain]];
|
|
7329
|
+
if (!fromAddress) {
|
|
7330
|
+
throw new Error(`Wallet "${wallet.name}" has no address on ${params.chain}.`);
|
|
7331
|
+
}
|
|
7332
|
+
let toAddress = params.to;
|
|
7333
|
+
try {
|
|
7334
|
+
const toWallet = await walletRetrieve.handler({ wallet: params.to });
|
|
7335
|
+
toAddress = toWallet.addresses[KEY_CHAIN_MAP[params.chain]] ?? params.to;
|
|
7336
|
+
} catch {
|
|
7337
|
+
}
|
|
7338
|
+
const buildResult = await callRemoteTool(baseUrl, "token_transfer", {
|
|
7339
|
+
wallet: fromAddress,
|
|
7340
|
+
token: params.token,
|
|
7341
|
+
to: toAddress,
|
|
7342
|
+
amount: params.amount,
|
|
7343
|
+
chain: params.chain
|
|
7344
|
+
});
|
|
7345
|
+
const txPayload = "base64" in buildResult.transaction ? buildResult.transaction.base64 : JSON.stringify(buildResult.transaction);
|
|
7346
|
+
const { transaction: signedTransaction } = await transactionSign.handler({
|
|
7347
|
+
wallet: wallet.name,
|
|
7348
|
+
chain: params.chain,
|
|
7349
|
+
transaction: txPayload
|
|
7350
|
+
});
|
|
7351
|
+
const sendResult = await callRemoteTool(baseUrl, "transaction_send", {
|
|
7352
|
+
transaction: signedTransaction,
|
|
7353
|
+
message: buildResult.message,
|
|
7354
|
+
chain: params.chain
|
|
7355
|
+
});
|
|
7356
|
+
if (!sendResult.signature) {
|
|
7357
|
+
throw new Error(`Transaction send failed: ${sendResult.message}`);
|
|
7358
|
+
}
|
|
7359
|
+
return { signature: sendResult.signature, message: buildResult.message };
|
|
7360
|
+
});
|
|
7361
|
+
|
|
6790
7362
|
// src/tools/x402/request/tool.ts
|
|
6791
7363
|
import { Keypair as Keypair4, VersionedTransaction as VersionedTransaction2, VersionedMessage } from "@solana/web3.js";
|
|
6792
7364
|
import axios from "axios";
|
|
@@ -6800,13 +7372,13 @@ import { createPublicClient as createPublicClient2, http as http2 } from "viem";
|
|
|
6800
7372
|
import * as viemChains2 from "viem/chains";
|
|
6801
7373
|
|
|
6802
7374
|
// src/tools/x402/request/schema.ts
|
|
6803
|
-
import { z as
|
|
7375
|
+
import { z as z17 } from "zod";
|
|
6804
7376
|
var x402RequestSchema = defineToolSchema({
|
|
6805
7377
|
name: "x402_request",
|
|
6806
7378
|
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.",
|
|
6807
|
-
input:
|
|
6808
|
-
method:
|
|
6809
|
-
url:
|
|
7379
|
+
input: z17.object({
|
|
7380
|
+
method: z17.enum(["GET", "POST", "PUT", "PATCH", "DELETE"]).describe("HTTP method"),
|
|
7381
|
+
url: z17.string().url().refine((u) => u.startsWith("https://"), { message: "URL must use HTTPS" }).refine(
|
|
6810
7382
|
(u) => {
|
|
6811
7383
|
try {
|
|
6812
7384
|
const host = new URL(u).hostname;
|
|
@@ -6819,15 +7391,15 @@ var x402RequestSchema = defineToolSchema({
|
|
|
6819
7391
|
).describe(
|
|
6820
7392
|
"Full HTTPS URL of the x402-protected endpoint (e.g., 'https://agents.moonpay.com/api/x402/tools/market_digest_retrieve')"
|
|
6821
7393
|
),
|
|
6822
|
-
body:
|
|
6823
|
-
params:
|
|
6824
|
-
wallet:
|
|
6825
|
-
chain:
|
|
7394
|
+
body: z17.record(z17.any()).nullable().describe("Request body (for POST, PUT, PATCH)"),
|
|
7395
|
+
params: z17.record(z17.any()).nullable().describe("Query parameters"),
|
|
7396
|
+
wallet: z17.string().describe("Wallet name or address to pay with"),
|
|
7397
|
+
chain: z17.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.")
|
|
6826
7398
|
}),
|
|
6827
|
-
output:
|
|
6828
|
-
status:
|
|
6829
|
-
data:
|
|
6830
|
-
headers:
|
|
7399
|
+
output: z17.object({
|
|
7400
|
+
status: z17.number().describe("HTTP status code"),
|
|
7401
|
+
data: z17.any().describe("Response data"),
|
|
7402
|
+
headers: z17.record(z17.any()).describe("Response headers")
|
|
6831
7403
|
})
|
|
6832
7404
|
});
|
|
6833
7405
|
|
|
@@ -6919,18 +7491,18 @@ var x402Request = createTool(
|
|
|
6919
7491
|
);
|
|
6920
7492
|
|
|
6921
7493
|
// src/tools/virtual-account/wallet/register/schema.ts
|
|
6922
|
-
import { z as
|
|
7494
|
+
import { z as z18 } from "zod";
|
|
6923
7495
|
var virtualAccountWalletRegisterSchema = defineToolSchema({
|
|
6924
7496
|
name: "virtual-account_wallet_register",
|
|
6925
7497
|
description: "Register a local wallet with your virtual account. Creates the verification message, signs it locally, and registers in one step.",
|
|
6926
|
-
input:
|
|
6927
|
-
wallet:
|
|
7498
|
+
input: z18.object({
|
|
7499
|
+
wallet: z18.string().describe("Local wallet name"),
|
|
6928
7500
|
chain: chainSchema.describe("Chain to register (solana, ethereum, etc.)")
|
|
6929
7501
|
}),
|
|
6930
|
-
output:
|
|
6931
|
-
success:
|
|
6932
|
-
address:
|
|
6933
|
-
chain:
|
|
7502
|
+
output: z18.object({
|
|
7503
|
+
success: z18.literal(true),
|
|
7504
|
+
address: z18.string().describe("Registered wallet address"),
|
|
7505
|
+
chain: z18.string().describe("Chain registered on")
|
|
6934
7506
|
})
|
|
6935
7507
|
});
|
|
6936
7508
|
|
|
@@ -6966,29 +7538,177 @@ var virtualAccountWalletRegister = createTool(
|
|
|
6966
7538
|
}
|
|
6967
7539
|
);
|
|
6968
7540
|
|
|
6969
|
-
|
|
6970
|
-
|
|
6971
|
-
|
|
6972
|
-
|
|
6973
|
-
|
|
6974
|
-
|
|
6975
|
-
|
|
6976
|
-
|
|
6977
|
-
|
|
6978
|
-
|
|
6979
|
-
|
|
7541
|
+
// src/tools/consent/accept/tool.ts
|
|
7542
|
+
import * as fs3 from "fs";
|
|
7543
|
+
import * as os3 from "os";
|
|
7544
|
+
import * as path3 from "path";
|
|
7545
|
+
|
|
7546
|
+
// src/tools/consent/accept/schema.ts
|
|
7547
|
+
import { z as z19 } from "zod";
|
|
7548
|
+
var consentAcceptSchema = defineToolSchema({
|
|
7549
|
+
name: "consent_accept",
|
|
7550
|
+
description: "Accept the MoonPay Terms of Service and Privacy Policy. Required before using any CLI command.",
|
|
7551
|
+
input: z19.object({}),
|
|
7552
|
+
output: z19.object({
|
|
7553
|
+
tosVersion: z19.string(),
|
|
7554
|
+
acceptedAt: z19.string()
|
|
7555
|
+
})
|
|
7556
|
+
});
|
|
7557
|
+
|
|
7558
|
+
// src/tools/consent/accept/tool.ts
|
|
7559
|
+
var CONFIG_DIR2 = path3.join(os3.homedir(), ".config", "moonpay");
|
|
7560
|
+
var CONSENT_PATH2 = path3.join(CONFIG_DIR2, "consent.json");
|
|
7561
|
+
var CURRENT_TOS_VERSION2 = "1.0";
|
|
7562
|
+
var consentAccept = createTool(consentAcceptSchema, async () => {
|
|
7563
|
+
if (!fs3.existsSync(CONFIG_DIR2)) {
|
|
7564
|
+
fs3.mkdirSync(CONFIG_DIR2, { recursive: true, mode: 448 });
|
|
7565
|
+
}
|
|
7566
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
7567
|
+
const consent = { tosVersion: CURRENT_TOS_VERSION2, acceptedAt: now };
|
|
7568
|
+
const tmp = CONSENT_PATH2 + `.tmp.${process.pid}`;
|
|
7569
|
+
fs3.writeFileSync(tmp, JSON.stringify(consent, null, 2), {
|
|
7570
|
+
encoding: "utf-8",
|
|
7571
|
+
mode: 384
|
|
7572
|
+
});
|
|
7573
|
+
fs3.renameSync(tmp, CONSENT_PATH2);
|
|
7574
|
+
return consent;
|
|
7575
|
+
});
|
|
7576
|
+
|
|
7577
|
+
// src/tools/login/schema.ts
|
|
7578
|
+
import { z as z20 } from "zod";
|
|
7579
|
+
var loginSchema = defineToolSchema({
|
|
7580
|
+
name: "login",
|
|
7581
|
+
description: "Send a login verification code to your email.",
|
|
7582
|
+
input: z20.object({
|
|
7583
|
+
email: z20.string().describe("Email address")
|
|
7584
|
+
}),
|
|
7585
|
+
output: z20.object({
|
|
7586
|
+
email: z20.string(),
|
|
7587
|
+
message: z20.string()
|
|
7588
|
+
})
|
|
7589
|
+
});
|
|
7590
|
+
|
|
7591
|
+
// src/tools/login/tool.ts
|
|
7592
|
+
var login = createTool(loginSchema, async (params) => {
|
|
7593
|
+
const { baseUrl } = getConfigOrDefault();
|
|
7594
|
+
await callPublicTool(baseUrl, "login", { email: params.email });
|
|
7595
|
+
return {
|
|
7596
|
+
email: params.email,
|
|
7597
|
+
message: `Verification code sent to ${params.email}. Run: mp verify --email ${params.email} --code <code>`
|
|
7598
|
+
};
|
|
7599
|
+
});
|
|
7600
|
+
|
|
7601
|
+
// src/tools/verify/schema.ts
|
|
7602
|
+
import { z as z21 } from "zod";
|
|
7603
|
+
var verifySchema = defineToolSchema({
|
|
7604
|
+
name: "verify",
|
|
7605
|
+
description: "Verify login code and store encrypted credentials.",
|
|
7606
|
+
input: z21.object({
|
|
7607
|
+
email: z21.string().describe("Email address"),
|
|
7608
|
+
code: z21.string().describe("Verification code")
|
|
7609
|
+
}),
|
|
7610
|
+
output: z21.object({
|
|
7611
|
+
email: z21.string(),
|
|
7612
|
+
message: z21.string()
|
|
7613
|
+
})
|
|
7614
|
+
});
|
|
7615
|
+
|
|
7616
|
+
// src/tools/verify/tool.ts
|
|
7617
|
+
var verify = createTool(verifySchema, async (params) => {
|
|
7618
|
+
const { baseUrl } = getConfigOrDefault();
|
|
7619
|
+
const tokens = await callPublicTool(baseUrl, "verify", {
|
|
7620
|
+
email: params.email,
|
|
7621
|
+
code: params.code
|
|
7622
|
+
});
|
|
7623
|
+
const creds = {
|
|
7624
|
+
accessToken: tokens.accessToken,
|
|
7625
|
+
refreshToken: tokens.refreshToken,
|
|
7626
|
+
expiresAt: tokens.expiresAt * 1e3,
|
|
7627
|
+
baseUrl
|
|
7628
|
+
};
|
|
7629
|
+
saveCredentials(creds);
|
|
7630
|
+
return { email: params.email, message: "Logged in successfully." };
|
|
7631
|
+
});
|
|
7632
|
+
|
|
7633
|
+
// src/tools/logout/schema.ts
|
|
7634
|
+
import { z as z22 } from "zod";
|
|
7635
|
+
var logoutSchema = defineToolSchema({
|
|
7636
|
+
name: "logout",
|
|
7637
|
+
description: "Log out and clear stored credentials.",
|
|
7638
|
+
input: z22.object({}),
|
|
7639
|
+
output: z22.object({
|
|
7640
|
+
success: z22.literal(true),
|
|
7641
|
+
message: z22.string()
|
|
7642
|
+
})
|
|
7643
|
+
});
|
|
7644
|
+
|
|
7645
|
+
// src/tools/logout/tool.ts
|
|
7646
|
+
var logout = createTool(logoutSchema, async () => {
|
|
7647
|
+
clearCredentials();
|
|
7648
|
+
return { success: true, message: "Logged out." };
|
|
7649
|
+
});
|
|
7650
|
+
|
|
7651
|
+
// src/tools/qr/tool.ts
|
|
7652
|
+
import { createRequire } from "module";
|
|
7653
|
+
|
|
7654
|
+
// src/tools/qr/schema.ts
|
|
7655
|
+
import { z as z23 } from "zod";
|
|
7656
|
+
var qrGenerateSchema = defineToolSchema({
|
|
7657
|
+
name: "qr_generate",
|
|
7658
|
+
description: "Display a QR code in the terminal. Pass any text \u2014 wallet address, URL, token address, etc.",
|
|
7659
|
+
input: z23.object({
|
|
7660
|
+
value: z23.string().describe("Text to encode as a QR code")
|
|
7661
|
+
}),
|
|
7662
|
+
output: z23.object({
|
|
7663
|
+
value: z23.string()
|
|
7664
|
+
})
|
|
7665
|
+
});
|
|
7666
|
+
|
|
7667
|
+
// src/tools/qr/tool.ts
|
|
7668
|
+
var require2 = createRequire(import.meta.url);
|
|
7669
|
+
var qrcode = require2("qrcode-terminal");
|
|
7670
|
+
var qrGenerate = createTool(qrGenerateSchema, async (params) => {
|
|
7671
|
+
qrcode.generate(params.value, { small: true }, (code) => {
|
|
7672
|
+
process.stderr.write(`
|
|
7673
|
+
${code}
|
|
7674
|
+
`);
|
|
7675
|
+
});
|
|
7676
|
+
return { value: params.value };
|
|
7677
|
+
});
|
|
7678
|
+
|
|
7679
|
+
// src/local-tools.ts
|
|
7680
|
+
var LOCAL_TOOLS = [
|
|
6980
7681
|
walletCreate,
|
|
6981
7682
|
walletImport,
|
|
6982
7683
|
walletList,
|
|
6983
7684
|
walletRetrieve,
|
|
6984
7685
|
walletDelete,
|
|
6985
7686
|
walletRename,
|
|
7687
|
+
walletExport,
|
|
6986
7688
|
transactionSign,
|
|
6987
7689
|
messageSign,
|
|
6988
7690
|
bitcoinBalanceRetrieve,
|
|
6989
|
-
|
|
7691
|
+
skillList,
|
|
7692
|
+
skillRetrieve,
|
|
7693
|
+
skillInstall,
|
|
6990
7694
|
tokenSwap,
|
|
7695
|
+
tokenBridge,
|
|
7696
|
+
tokenTransfer,
|
|
6991
7697
|
x402Request,
|
|
6992
|
-
virtualAccountWalletRegister
|
|
7698
|
+
virtualAccountWalletRegister,
|
|
7699
|
+
consentAccept,
|
|
7700
|
+
consentCheck,
|
|
7701
|
+
login,
|
|
7702
|
+
verify,
|
|
7703
|
+
logout,
|
|
7704
|
+
qrGenerate
|
|
7705
|
+
];
|
|
7706
|
+
|
|
7707
|
+
export {
|
|
7708
|
+
resolveBaseUrl,
|
|
7709
|
+
callTool,
|
|
7710
|
+
schemas_default,
|
|
7711
|
+
consentCheck,
|
|
7712
|
+
LOCAL_TOOLS
|
|
6993
7713
|
};
|
|
6994
|
-
//# sourceMappingURL=chunk-
|
|
7714
|
+
//# sourceMappingURL=chunk-2XX5YJ2D.js.map
|