@moonpay/cli 0.6.1 → 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-GSAFAKB7.js → chunk-AL5WDHLT.js} +15 -2
- package/dist/chunk-AL5WDHLT.js.map +1 -0
- package/dist/{chunk-DCHEUKV7.js → chunk-VJ2ZYZ2W.js} +374 -86
- package/dist/chunk-VJ2ZYZ2W.js.map +1 -0
- package/dist/index.js +22 -6
- package/dist/index.js.map +1 -1
- package/dist/{mcp-6IZ4QWFM.js → mcp-PKNRZ4PX.js} +5 -3
- package/dist/mcp-PKNRZ4PX.js.map +1 -0
- package/dist/{store-UAGR3DWU.js → store-QVVENVIP.js} +2 -2
- package/package.json +3 -2
- package/dist/chunk-DCHEUKV7.js.map +0 -1
- package/dist/chunk-GSAFAKB7.js.map +0 -1
- package/dist/mcp-6IZ4QWFM.js.map +0 -1
- /package/dist/{store-UAGR3DWU.js.map → store-QVVENVIP.js.map} +0 -0
|
@@ -9,14 +9,16 @@ import {
|
|
|
9
9
|
encrypt,
|
|
10
10
|
encryptedFileSchema,
|
|
11
11
|
ensureEncryptionKey,
|
|
12
|
+
expandAddresses,
|
|
12
13
|
findWalletOrThrow,
|
|
13
14
|
getEncryptionKey,
|
|
14
15
|
keyChainSchema,
|
|
15
16
|
loadWallets,
|
|
17
|
+
mutateWallets,
|
|
16
18
|
removeWallet,
|
|
17
19
|
resolveSigningKey,
|
|
18
20
|
walletInfoSchema
|
|
19
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-AL5WDHLT.js";
|
|
20
22
|
|
|
21
23
|
// src/auth.ts
|
|
22
24
|
import * as fs from "fs";
|
|
@@ -328,6 +330,229 @@ var schemas_default = [
|
|
|
328
330
|
$schema: "http://json-schema.org/draft-07/schema#"
|
|
329
331
|
}
|
|
330
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
|
+
},
|
|
331
556
|
{
|
|
332
557
|
name: "login",
|
|
333
558
|
description: "Send a verification code to the provided email to sign in or create an account.",
|
|
@@ -339,6 +564,7 @@ var schemas_default = [
|
|
|
339
564
|
properties: {
|
|
340
565
|
email: {
|
|
341
566
|
type: "string",
|
|
567
|
+
format: "email",
|
|
342
568
|
description: "The email of the user to login"
|
|
343
569
|
}
|
|
344
570
|
},
|
|
@@ -3206,12 +3432,14 @@ var schemas_default = [
|
|
|
3206
3432
|
description: "Blockchain to get trending tokens from (e.g. 'solana', 'ethereum', 'base')"
|
|
3207
3433
|
},
|
|
3208
3434
|
limit: {
|
|
3209
|
-
type: "
|
|
3435
|
+
type: "integer",
|
|
3436
|
+
minimum: 1,
|
|
3210
3437
|
description: "Number of results per page"
|
|
3211
3438
|
},
|
|
3212
3439
|
page: {
|
|
3213
|
-
type: "
|
|
3214
|
-
|
|
3440
|
+
type: "integer",
|
|
3441
|
+
minimum: 1,
|
|
3442
|
+
description: "Page number (starts at 1)"
|
|
3215
3443
|
}
|
|
3216
3444
|
},
|
|
3217
3445
|
required: [
|
|
@@ -4743,10 +4971,12 @@ var schemas_default = [
|
|
|
4743
4971
|
properties: {
|
|
4744
4972
|
code: {
|
|
4745
4973
|
type: "string",
|
|
4974
|
+
pattern: "^\\d{6}$",
|
|
4746
4975
|
description: "The code to verify"
|
|
4747
4976
|
},
|
|
4748
4977
|
email: {
|
|
4749
4978
|
type: "string",
|
|
4979
|
+
format: "email",
|
|
4750
4980
|
description: "The email the OTP was sent to"
|
|
4751
4981
|
}
|
|
4752
4982
|
},
|
|
@@ -5889,7 +6119,7 @@ var walletCreate = createTool(walletCreateSchema, async (params) => {
|
|
|
5889
6119
|
);
|
|
5890
6120
|
}
|
|
5891
6121
|
}
|
|
5892
|
-
return { name: params.name, addresses };
|
|
6122
|
+
return { name: params.name, addresses: expandAddresses(addresses) };
|
|
5893
6123
|
});
|
|
5894
6124
|
|
|
5895
6125
|
// src/tools/wallet/import/tool.ts
|
|
@@ -5985,7 +6215,7 @@ var walletList = createTool(walletListSchema, async () => {
|
|
|
5985
6215
|
return wallets.map((w) => ({
|
|
5986
6216
|
name: w.name,
|
|
5987
6217
|
type: w.type,
|
|
5988
|
-
addresses: w.addresses,
|
|
6218
|
+
addresses: expandAddresses(w.addresses),
|
|
5989
6219
|
createdAt: w.createdAt
|
|
5990
6220
|
}));
|
|
5991
6221
|
});
|
|
@@ -6007,7 +6237,7 @@ var walletRetrieve = createTool(walletRetrieveSchema, async (params) => {
|
|
|
6007
6237
|
return {
|
|
6008
6238
|
name: wallet.name,
|
|
6009
6239
|
type: wallet.type,
|
|
6010
|
-
addresses: wallet.addresses,
|
|
6240
|
+
addresses: expandAddresses(wallet.addresses),
|
|
6011
6241
|
createdAt: wallet.createdAt
|
|
6012
6242
|
};
|
|
6013
6243
|
});
|
|
@@ -6039,6 +6269,40 @@ var walletDelete = createTool(walletDeleteSchema, async (params) => {
|
|
|
6039
6269
|
return { name: wallet.name, deleted: true };
|
|
6040
6270
|
});
|
|
6041
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
|
+
|
|
6042
6306
|
// src/tools/transaction/sign/tool.ts
|
|
6043
6307
|
import { createHash } from "crypto";
|
|
6044
6308
|
import { Keypair as Keypair2, VersionedTransaction } from "@solana/web3.js";
|
|
@@ -6049,19 +6313,19 @@ import * as viemChains from "viem/chains";
|
|
|
6049
6313
|
import * as ecc from "tiny-secp256k1";
|
|
6050
6314
|
|
|
6051
6315
|
// src/tools/transaction/sign/schema.ts
|
|
6052
|
-
import { z as
|
|
6316
|
+
import { z as z7 } from "zod";
|
|
6053
6317
|
var transactionSignSchema = defineToolSchema({
|
|
6054
6318
|
name: "transaction_sign",
|
|
6055
6319
|
description: "Sign a transaction with a local wallet. Supports Solana (VersionedTransaction), EVM (RLP-encoded), and Bitcoin (PSBT) transactions.",
|
|
6056
|
-
input:
|
|
6057
|
-
wallet:
|
|
6320
|
+
input: z7.object({
|
|
6321
|
+
wallet: z7.string().describe("Wallet name or address"),
|
|
6058
6322
|
chain: chainSchema.describe(
|
|
6059
6323
|
"Chain: solana, ethereum, base, arbitrum, or bitcoin"
|
|
6060
6324
|
),
|
|
6061
|
-
transaction:
|
|
6325
|
+
transaction: z7.string().describe("Base64-encoded unsigned transaction")
|
|
6062
6326
|
}),
|
|
6063
|
-
output:
|
|
6064
|
-
transaction:
|
|
6327
|
+
output: z7.object({
|
|
6328
|
+
transaction: z7.string().describe("Base64-encoded signed transaction")
|
|
6065
6329
|
})
|
|
6066
6330
|
});
|
|
6067
6331
|
|
|
@@ -6176,19 +6440,19 @@ import { keccak_256 } from "@noble/hashes/sha3";
|
|
|
6176
6440
|
import { privateKeyToAccount as privateKeyToAccount3 } from "viem/accounts";
|
|
6177
6441
|
|
|
6178
6442
|
// src/tools/message/sign/schema.ts
|
|
6179
|
-
import { z as
|
|
6443
|
+
import { z as z8 } from "zod";
|
|
6180
6444
|
var messageSignSchema = defineToolSchema({
|
|
6181
6445
|
name: "message_sign",
|
|
6182
6446
|
description: "Sign a message with a local wallet. Supports Solana (ed25519), EVM (EIP-191 personal sign), and Bitcoin (secp256k1 ECDSA).",
|
|
6183
|
-
input:
|
|
6184
|
-
wallet:
|
|
6447
|
+
input: z8.object({
|
|
6448
|
+
wallet: z8.string().describe("Wallet address or name to sign with"),
|
|
6185
6449
|
chain: chainSchema.describe(
|
|
6186
6450
|
"Chain: solana, ethereum, base, arbitrum, or bitcoin"
|
|
6187
6451
|
),
|
|
6188
|
-
message:
|
|
6452
|
+
message: z8.string().describe("Message text to sign")
|
|
6189
6453
|
}),
|
|
6190
|
-
output:
|
|
6191
|
-
signature:
|
|
6454
|
+
output: z8.object({
|
|
6455
|
+
signature: z8.string().describe(
|
|
6192
6456
|
"Signature: base58 for Solana, hex (0x-prefixed) for EVM/Bitcoin"
|
|
6193
6457
|
)
|
|
6194
6458
|
})
|
|
@@ -6248,26 +6512,26 @@ function signBitcoin2(privateKey, messageBytes) {
|
|
|
6248
6512
|
import https from "https";
|
|
6249
6513
|
|
|
6250
6514
|
// src/tools/bitcoin/balance/schema.ts
|
|
6251
|
-
import { z as
|
|
6515
|
+
import { z as z9 } from "zod";
|
|
6252
6516
|
var bitcoinBalanceRetrieveSchema = defineToolSchema({
|
|
6253
6517
|
name: "bitcoin_balance_retrieve",
|
|
6254
6518
|
description: "Get the BTC balance of a Bitcoin address. Returns confirmed and unconfirmed balances in BTC and satoshis.",
|
|
6255
|
-
input:
|
|
6256
|
-
wallet:
|
|
6519
|
+
input: z9.object({
|
|
6520
|
+
wallet: z9.string().describe("Bitcoin address (bc1...) or wallet name")
|
|
6257
6521
|
}),
|
|
6258
|
-
output:
|
|
6259
|
-
address:
|
|
6260
|
-
confirmed:
|
|
6261
|
-
btc:
|
|
6262
|
-
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")
|
|
6263
6527
|
}),
|
|
6264
|
-
unconfirmed:
|
|
6265
|
-
btc:
|
|
6266
|
-
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")
|
|
6267
6531
|
}),
|
|
6268
|
-
total:
|
|
6269
|
-
btc:
|
|
6270
|
-
sats:
|
|
6532
|
+
total: z9.object({
|
|
6533
|
+
btc: z9.string().describe("Total balance in BTC"),
|
|
6534
|
+
sats: z9.number().describe("Total balance in satoshis")
|
|
6271
6535
|
})
|
|
6272
6536
|
})
|
|
6273
6537
|
});
|
|
@@ -6302,7 +6566,7 @@ var bitcoinBalanceRetrieve = createTool(
|
|
|
6302
6566
|
async (params) => {
|
|
6303
6567
|
let address = params.wallet;
|
|
6304
6568
|
if (!address.startsWith("bc1") && !address.startsWith("1") && !address.startsWith("3")) {
|
|
6305
|
-
const { findWalletOrThrow: findWalletOrThrow2 } = await import("./store-
|
|
6569
|
+
const { findWalletOrThrow: findWalletOrThrow2 } = await import("./store-QVVENVIP.js");
|
|
6306
6570
|
const wallet = findWalletOrThrow2(address);
|
|
6307
6571
|
const btcAddress = wallet.addresses.bitcoin;
|
|
6308
6572
|
if (!btcAddress) {
|
|
@@ -6331,24 +6595,24 @@ var bitcoinBalanceRetrieve = createTool(
|
|
|
6331
6595
|
import { encodeFunctionData } from "viem";
|
|
6332
6596
|
|
|
6333
6597
|
// src/tools/token/swap/schema.ts
|
|
6334
|
-
import { z as
|
|
6335
|
-
var swapOutputSchema =
|
|
6336
|
-
signature:
|
|
6337
|
-
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")
|
|
6338
6602
|
});
|
|
6339
6603
|
var tokenSwapSchema = defineToolSchema({
|
|
6340
6604
|
name: "token_swap",
|
|
6341
6605
|
description: "Swap tokens on the same chain. Builds, signs locally, broadcasts, and registers.",
|
|
6342
|
-
input:
|
|
6343
|
-
wallet:
|
|
6606
|
+
input: z10.object({
|
|
6607
|
+
wallet: z10.string().describe("Local wallet name to sign with"),
|
|
6344
6608
|
chain: chainSchema.describe("Chain to swap on"),
|
|
6345
|
-
from:
|
|
6346
|
-
token:
|
|
6347
|
-
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.")
|
|
6348
6612
|
}),
|
|
6349
|
-
to:
|
|
6350
|
-
token:
|
|
6351
|
-
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.")
|
|
6352
6616
|
})
|
|
6353
6617
|
}),
|
|
6354
6618
|
output: swapOutputSchema
|
|
@@ -6356,18 +6620,18 @@ var tokenSwapSchema = defineToolSchema({
|
|
|
6356
6620
|
var tokenBridgeSchema = defineToolSchema({
|
|
6357
6621
|
name: "token_bridge",
|
|
6358
6622
|
description: "Bridge tokens across chains. Builds, signs locally, broadcasts, and registers.",
|
|
6359
|
-
input:
|
|
6360
|
-
from:
|
|
6361
|
-
wallet:
|
|
6623
|
+
input: z10.object({
|
|
6624
|
+
from: z10.object({
|
|
6625
|
+
wallet: z10.string().describe("Local wallet name to sign with"),
|
|
6362
6626
|
chain: chainSchema.describe("Source chain"),
|
|
6363
|
-
token:
|
|
6364
|
-
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.")
|
|
6365
6629
|
}),
|
|
6366
|
-
to:
|
|
6367
|
-
wallet:
|
|
6630
|
+
to: z10.object({
|
|
6631
|
+
wallet: z10.string().nullable().describe("Destination wallet name or address (defaults to from wallet)"),
|
|
6368
6632
|
chain: chainSchema.describe("Destination chain"),
|
|
6369
|
-
token:
|
|
6370
|
-
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.")
|
|
6371
6635
|
})
|
|
6372
6636
|
}),
|
|
6373
6637
|
output: swapOutputSchema
|
|
@@ -6478,15 +6742,20 @@ import axios from "axios";
|
|
|
6478
6742
|
import { wrapAxiosWithPayment } from "@x402/axios";
|
|
6479
6743
|
import { x402Client } from "@x402/core/client";
|
|
6480
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";
|
|
6481
6750
|
|
|
6482
6751
|
// src/tools/x402/request/schema.ts
|
|
6483
|
-
import { z as
|
|
6752
|
+
import { z as z11 } from "zod";
|
|
6484
6753
|
var x402RequestSchema = defineToolSchema({
|
|
6485
6754
|
name: "x402_request",
|
|
6486
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.",
|
|
6487
|
-
input:
|
|
6488
|
-
method:
|
|
6489
|
-
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(
|
|
6490
6759
|
(u) => {
|
|
6491
6760
|
try {
|
|
6492
6761
|
const host = new URL(u).hostname;
|
|
@@ -6499,20 +6768,28 @@ var x402RequestSchema = defineToolSchema({
|
|
|
6499
6768
|
).describe(
|
|
6500
6769
|
"Full HTTPS URL of the x402-protected endpoint (e.g., 'https://agents.moonpay.com/api/x402/tools/market_digest_retrieve')"
|
|
6501
6770
|
),
|
|
6502
|
-
body:
|
|
6503
|
-
params:
|
|
6504
|
-
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.")
|
|
6505
6775
|
}),
|
|
6506
|
-
output:
|
|
6507
|
-
status:
|
|
6508
|
-
data:
|
|
6509
|
-
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")
|
|
6510
6780
|
})
|
|
6511
6781
|
});
|
|
6512
6782
|
|
|
6513
6783
|
// src/tools/x402/request/tool.ts
|
|
6514
6784
|
var SOLANA_NETWORK = "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
|
|
6515
|
-
|
|
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) {
|
|
6516
6793
|
const keypair = Keypair4.fromSecretKey(secretKey);
|
|
6517
6794
|
const signer = {
|
|
6518
6795
|
address: walletAddress,
|
|
@@ -6534,9 +6811,7 @@ function createLocalX402Client(walletAddress, secretKey) {
|
|
|
6534
6811
|
`Wallet ${walletAddress} is not a signer for this transaction`
|
|
6535
6812
|
);
|
|
6536
6813
|
}
|
|
6537
|
-
return {
|
|
6538
|
-
[walletAddress]: tx.signatures[signerIndex]
|
|
6539
|
-
};
|
|
6814
|
+
return { [walletAddress]: tx.signatures[signerIndex] };
|
|
6540
6815
|
});
|
|
6541
6816
|
}
|
|
6542
6817
|
};
|
|
@@ -6546,28 +6821,40 @@ function createLocalX402Client(walletAddress, secretKey) {
|
|
|
6546
6821
|
client.registerV1("solana", svmScheme);
|
|
6547
6822
|
return wrapAxiosWithPayment(axios.create(), client);
|
|
6548
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
|
+
}
|
|
6549
6835
|
var x402Request = createTool(
|
|
6550
6836
|
x402RequestSchema,
|
|
6551
|
-
async ({ method, url, body, params, wallet: walletNameOrAddress }) => {
|
|
6837
|
+
async ({ method, url, body, params, wallet: walletNameOrAddress, chain }) => {
|
|
6552
6838
|
const walletMetadata = findWalletOrThrow(walletNameOrAddress);
|
|
6553
|
-
const
|
|
6554
|
-
const
|
|
6839
|
+
const resolvedChain = chain ?? "solana";
|
|
6840
|
+
const { privateKey, address } = resolveSigningKey(walletMetadata, resolvedChain);
|
|
6841
|
+
const httpClient = resolvedChain === "solana" ? createSolanaX402Client(address, privateKey) : createEvmX402Client(privateKey, resolvedChain);
|
|
6555
6842
|
let response;
|
|
6556
6843
|
switch (method) {
|
|
6557
6844
|
case "GET":
|
|
6558
|
-
response = await
|
|
6845
|
+
response = await httpClient.get(url, { params });
|
|
6559
6846
|
break;
|
|
6560
6847
|
case "POST":
|
|
6561
|
-
response = await
|
|
6848
|
+
response = await httpClient.post(url, body || {}, { params });
|
|
6562
6849
|
break;
|
|
6563
6850
|
case "PUT":
|
|
6564
|
-
response = await
|
|
6851
|
+
response = await httpClient.put(url, body || {}, { params });
|
|
6565
6852
|
break;
|
|
6566
6853
|
case "PATCH":
|
|
6567
|
-
response = await
|
|
6854
|
+
response = await httpClient.patch(url, body || {}, { params });
|
|
6568
6855
|
break;
|
|
6569
6856
|
case "DELETE":
|
|
6570
|
-
response = await
|
|
6857
|
+
response = await httpClient.delete(url, { params });
|
|
6571
6858
|
break;
|
|
6572
6859
|
default:
|
|
6573
6860
|
throw new Error(`Unsupported HTTP method: ${method}`);
|
|
@@ -6581,18 +6868,18 @@ var x402Request = createTool(
|
|
|
6581
6868
|
);
|
|
6582
6869
|
|
|
6583
6870
|
// src/tools/virtual-account/wallet/register/schema.ts
|
|
6584
|
-
import { z as
|
|
6871
|
+
import { z as z12 } from "zod";
|
|
6585
6872
|
var virtualAccountWalletRegisterSchema = defineToolSchema({
|
|
6586
6873
|
name: "virtual-account_wallet_register",
|
|
6587
6874
|
description: "Register a local wallet with your virtual account. Creates the verification message, signs it locally, and registers in one step.",
|
|
6588
|
-
input:
|
|
6589
|
-
wallet:
|
|
6875
|
+
input: z12.object({
|
|
6876
|
+
wallet: z12.string().describe("Local wallet name"),
|
|
6590
6877
|
chain: chainSchema.describe("Chain to register (solana, ethereum, etc.)")
|
|
6591
6878
|
}),
|
|
6592
|
-
output:
|
|
6593
|
-
success:
|
|
6594
|
-
address:
|
|
6595
|
-
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")
|
|
6596
6883
|
})
|
|
6597
6884
|
});
|
|
6598
6885
|
|
|
@@ -6644,6 +6931,7 @@ export {
|
|
|
6644
6931
|
walletList,
|
|
6645
6932
|
walletRetrieve,
|
|
6646
6933
|
walletDelete,
|
|
6934
|
+
walletRename,
|
|
6647
6935
|
transactionSign,
|
|
6648
6936
|
messageSign,
|
|
6649
6937
|
bitcoinBalanceRetrieve,
|
|
@@ -6652,4 +6940,4 @@ export {
|
|
|
6652
6940
|
x402Request,
|
|
6653
6941
|
virtualAccountWalletRegister
|
|
6654
6942
|
};
|
|
6655
|
-
//# sourceMappingURL=chunk-
|
|
6943
|
+
//# sourceMappingURL=chunk-VJ2ZYZ2W.js.map
|