@truecarry/mcp 0.1.4 → 0.1.5
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/cli.js +343 -84
- package/dist/factory.d.ts.map +1 -1
- package/dist/index.cjs +343 -84
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +343 -84
- package/dist/services/McpWalletService.d.ts +58 -13
- package/dist/services/McpWalletService.d.ts.map +1 -1
- package/dist/tools/index.d.ts +2 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/known-jettons-tools.d.ts +44 -0
- package/dist/tools/known-jettons-tools.d.ts.map +1 -0
- package/dist/tools/nft-tools.d.ts +85 -0
- package/dist/tools/nft-tools.d.ts.map +1 -0
- package/dist/tools/swap-tools.d.ts +0 -18
- package/dist/tools/swap-tools.d.ts.map +1 -1
- package/dist/tools/transfer-tools.d.ts +80 -0
- package/dist/tools/transfer-tools.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -88324,7 +88324,24 @@ var McpWalletService = class McpWalletService {
|
|
|
88324
88324
|
}
|
|
88325
88325
|
}
|
|
88326
88326
|
/**
|
|
88327
|
-
*
|
|
88327
|
+
* Send a raw transaction request directly
|
|
88328
|
+
*/
|
|
88329
|
+
async sendRawTransaction(request) {
|
|
88330
|
+
try {
|
|
88331
|
+
await this.wallet.sendTransaction(request);
|
|
88332
|
+
return {
|
|
88333
|
+
success: true,
|
|
88334
|
+
message: `Successfully sent transaction with ${request.messages.length} message(s)`
|
|
88335
|
+
};
|
|
88336
|
+
} catch (error) {
|
|
88337
|
+
return {
|
|
88338
|
+
success: false,
|
|
88339
|
+
message: error instanceof Error ? error.message : "Unknown error"
|
|
88340
|
+
};
|
|
88341
|
+
}
|
|
88342
|
+
}
|
|
88343
|
+
/**
|
|
88344
|
+
* Get swap quote with transaction params ready to execute
|
|
88328
88345
|
*/
|
|
88329
88346
|
async getSwapQuote(fromToken, toToken, amount, slippageBps) {
|
|
88330
88347
|
const network = this.wallet.getNetwork();
|
|
@@ -88343,32 +88360,95 @@ var McpWalletService = class McpWalletService {
|
|
|
88343
88360
|
slippageBps
|
|
88344
88361
|
};
|
|
88345
88362
|
const quote = await kit.swap.getQuote(params);
|
|
88346
|
-
|
|
88363
|
+
const swapParams = {
|
|
88347
88364
|
quote,
|
|
88365
|
+
userAddress: this.wallet.getAddress()
|
|
88366
|
+
};
|
|
88367
|
+
const tx = await kit.swap.buildSwapTransaction(swapParams);
|
|
88368
|
+
return {
|
|
88348
88369
|
fromToken: quote.fromToken.type === "ton" ? "TON" : quote.fromToken.value,
|
|
88349
88370
|
toToken: quote.toToken.type === "ton" ? "TON" : quote.toToken.value,
|
|
88350
88371
|
fromAmount: quote.fromAmount,
|
|
88351
88372
|
toAmount: quote.toAmount,
|
|
88352
88373
|
minReceived: quote.minReceived,
|
|
88353
88374
|
provider: quote.providerId,
|
|
88354
|
-
expiresAt: quote.expiresAt
|
|
88375
|
+
expiresAt: quote.expiresAt,
|
|
88376
|
+
transaction: {
|
|
88377
|
+
messages: tx.messages.map((m) => ({
|
|
88378
|
+
address: m.address,
|
|
88379
|
+
amount: m.amount.toString(),
|
|
88380
|
+
stateInit: m.stateInit,
|
|
88381
|
+
payload: m.payload
|
|
88382
|
+
})),
|
|
88383
|
+
validUntil: tx.validUntil
|
|
88384
|
+
}
|
|
88385
|
+
};
|
|
88386
|
+
}
|
|
88387
|
+
/**
|
|
88388
|
+
* Get all NFTs
|
|
88389
|
+
*/
|
|
88390
|
+
async getNfts(limit = 20, offset = 0) {
|
|
88391
|
+
return (await this.wallet.getNfts({ pagination: {
|
|
88392
|
+
limit,
|
|
88393
|
+
offset
|
|
88394
|
+
} })).nfts.map((nft) => ({
|
|
88395
|
+
address: nft.address,
|
|
88396
|
+
name: nft.info?.name,
|
|
88397
|
+
description: nft.info?.description,
|
|
88398
|
+
image: typeof nft.info?.image === "string" ? nft.info.image : nft.info?.image?.url,
|
|
88399
|
+
collection: nft.collection ? {
|
|
88400
|
+
address: nft.collection.address,
|
|
88401
|
+
name: nft.collection.name
|
|
88402
|
+
} : void 0,
|
|
88403
|
+
attributes: nft.attributes?.map((attr) => ({
|
|
88404
|
+
trait_type: attr.traitType,
|
|
88405
|
+
value: attr.value
|
|
88406
|
+
})),
|
|
88407
|
+
ownerAddress: nft.ownerAddress,
|
|
88408
|
+
isOnSale: nft.isOnSale,
|
|
88409
|
+
isSoulbound: nft.isSoulbound,
|
|
88410
|
+
saleContractAddress: nft.saleContractAddress
|
|
88411
|
+
}));
|
|
88412
|
+
}
|
|
88413
|
+
/**
|
|
88414
|
+
* Get a specific NFT by address
|
|
88415
|
+
*/
|
|
88416
|
+
async getNft(nftAddress) {
|
|
88417
|
+
const nft = await this.wallet.getNft(nftAddress);
|
|
88418
|
+
if (!nft) return null;
|
|
88419
|
+
return {
|
|
88420
|
+
address: nft.address,
|
|
88421
|
+
name: nft.info?.name,
|
|
88422
|
+
description: nft.info?.description,
|
|
88423
|
+
image: typeof nft.info?.image === "string" ? nft.info.image : nft.info?.image?.url,
|
|
88424
|
+
collection: nft.collection ? {
|
|
88425
|
+
address: nft.collection.address,
|
|
88426
|
+
name: nft.collection.name
|
|
88427
|
+
} : void 0,
|
|
88428
|
+
attributes: nft.attributes?.map((attr) => ({
|
|
88429
|
+
trait_type: attr.traitType,
|
|
88430
|
+
value: attr.value
|
|
88431
|
+
})),
|
|
88432
|
+
ownerAddress: nft.ownerAddress,
|
|
88433
|
+
isOnSale: nft.isOnSale,
|
|
88434
|
+
isSoulbound: nft.isSoulbound,
|
|
88435
|
+
saleContractAddress: nft.saleContractAddress
|
|
88355
88436
|
};
|
|
88356
88437
|
}
|
|
88357
88438
|
/**
|
|
88358
|
-
*
|
|
88439
|
+
* Send NFT
|
|
88359
88440
|
*/
|
|
88360
|
-
async
|
|
88441
|
+
async sendNft(nftAddress, toAddress, comment) {
|
|
88361
88442
|
try {
|
|
88362
|
-
const
|
|
88363
|
-
|
|
88364
|
-
|
|
88365
|
-
|
|
88366
|
-
};
|
|
88367
|
-
const tx = await kit.swap.buildSwapTransaction(params);
|
|
88443
|
+
const tx = await this.wallet.createTransferNftTransaction({
|
|
88444
|
+
nftAddress,
|
|
88445
|
+
recipientAddress: toAddress,
|
|
88446
|
+
comment
|
|
88447
|
+
});
|
|
88368
88448
|
await this.wallet.sendTransaction(tx);
|
|
88369
88449
|
return {
|
|
88370
88450
|
success: true,
|
|
88371
|
-
message: `Successfully
|
|
88451
|
+
message: `Successfully sent NFT ${nftAddress} to ${toAddress}`
|
|
88372
88452
|
};
|
|
88373
88453
|
} catch (error) {
|
|
88374
88454
|
return {
|
|
@@ -88589,6 +88669,17 @@ const sendJettonSchema = z.object({
|
|
|
88589
88669
|
amount: z.string().min(1).describe("Amount of tokens to send in human-readable format"),
|
|
88590
88670
|
comment: z.string().optional().describe("Optional comment/memo for the transaction")
|
|
88591
88671
|
});
|
|
88672
|
+
const transactionMessageSchema = z.object({
|
|
88673
|
+
address: z.string().min(1).describe("Recipient wallet address"),
|
|
88674
|
+
amount: z.string().min(1).describe("Amount to transfer in nanotons"),
|
|
88675
|
+
stateInit: z.string().optional().describe("Initial state for deploying a new contract (Base64)"),
|
|
88676
|
+
payload: z.string().optional().describe("Message payload data (Base64)")
|
|
88677
|
+
});
|
|
88678
|
+
const sendRawTransactionSchema = z.object({
|
|
88679
|
+
messages: z.array(transactionMessageSchema).min(1).describe("Array of messages to include in the transaction"),
|
|
88680
|
+
validUntil: z.number().optional().describe("Unix timestamp after which the transaction becomes invalid"),
|
|
88681
|
+
fromAddress: z.string().optional().describe("Sender wallet address")
|
|
88682
|
+
});
|
|
88592
88683
|
function createMcpTransferTools(service) {
|
|
88593
88684
|
return {
|
|
88594
88685
|
send_ton: {
|
|
@@ -88681,6 +88772,41 @@ function createMcpTransferTools(service) {
|
|
|
88681
88772
|
}, null, 2)
|
|
88682
88773
|
}] };
|
|
88683
88774
|
}
|
|
88775
|
+
},
|
|
88776
|
+
send_raw_transaction: {
|
|
88777
|
+
description: "Send a raw transaction with full control over messages. Amounts are in nanotons. Supports multiple messages in a single transaction.",
|
|
88778
|
+
inputSchema: sendRawTransactionSchema,
|
|
88779
|
+
handler: async (args) => {
|
|
88780
|
+
const result = await service.sendRawTransaction({
|
|
88781
|
+
messages: args.messages,
|
|
88782
|
+
validUntil: args.validUntil,
|
|
88783
|
+
fromAddress: args.fromAddress
|
|
88784
|
+
});
|
|
88785
|
+
if (!result.success) return {
|
|
88786
|
+
content: [{
|
|
88787
|
+
type: "text",
|
|
88788
|
+
text: JSON.stringify({
|
|
88789
|
+
success: false,
|
|
88790
|
+
error: result.message
|
|
88791
|
+
})
|
|
88792
|
+
}],
|
|
88793
|
+
isError: true
|
|
88794
|
+
};
|
|
88795
|
+
return { content: [{
|
|
88796
|
+
type: "text",
|
|
88797
|
+
text: JSON.stringify({
|
|
88798
|
+
success: true,
|
|
88799
|
+
message: result.message,
|
|
88800
|
+
details: {
|
|
88801
|
+
messageCount: args.messages.length,
|
|
88802
|
+
messages: args.messages.map((m) => ({
|
|
88803
|
+
to: m.address,
|
|
88804
|
+
amount: `${m.amount} nanoTON`
|
|
88805
|
+
}))
|
|
88806
|
+
}
|
|
88807
|
+
}, null, 2)
|
|
88808
|
+
}] };
|
|
88809
|
+
}
|
|
88684
88810
|
}
|
|
88685
88811
|
};
|
|
88686
88812
|
}
|
|
@@ -88694,49 +88820,153 @@ function createMcpTransferTools(service) {
|
|
|
88694
88820
|
* LICENSE file in the root directory of this source tree.
|
|
88695
88821
|
*
|
|
88696
88822
|
*/
|
|
88697
|
-
const quoteCache = /* @__PURE__ */ new Map();
|
|
88698
|
-
function generateQuoteId() {
|
|
88699
|
-
return `quote_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
|
|
88700
|
-
}
|
|
88701
|
-
function cleanExpiredQuotes() {
|
|
88702
|
-
const now = Date.now();
|
|
88703
|
-
for (const [id, data] of quoteCache.entries()) if (data.expiresAt < now) quoteCache.delete(id);
|
|
88704
|
-
}
|
|
88705
88823
|
const getSwapQuoteSchema = z.object({
|
|
88706
88824
|
fromToken: z.string().min(1).describe("Token to swap from (\"TON\" or jetton address)"),
|
|
88707
88825
|
toToken: z.string().min(1).describe("Token to swap to (\"TON\" or jetton address)"),
|
|
88708
88826
|
amount: z.string().min(1).describe("Amount to swap in raw units"),
|
|
88709
88827
|
slippageBps: z.number().optional().describe("Slippage tolerance in basis points (default 100 = 1%)")
|
|
88710
88828
|
});
|
|
88711
|
-
const executeSwapSchema = z.object({ quoteId: z.string().min(1).describe("Quote ID returned from get_swap_quote") });
|
|
88712
88829
|
function createMcpSwapTools(service) {
|
|
88830
|
+
return { get_swap_quote: {
|
|
88831
|
+
description: "Get a quote for swapping tokens. Returns quote details and transaction params. If user confirms, use send_raw_transaction to execute.",
|
|
88832
|
+
inputSchema: getSwapQuoteSchema,
|
|
88833
|
+
handler: async (args) => {
|
|
88834
|
+
try {
|
|
88835
|
+
const result = await service.getSwapQuote(args.fromToken, args.toToken, args.amount, args.slippageBps);
|
|
88836
|
+
return { content: [{
|
|
88837
|
+
type: "text",
|
|
88838
|
+
text: JSON.stringify({
|
|
88839
|
+
success: true,
|
|
88840
|
+
quote: {
|
|
88841
|
+
fromToken: result.fromToken,
|
|
88842
|
+
toToken: result.toToken,
|
|
88843
|
+
fromAmount: result.fromAmount,
|
|
88844
|
+
toAmount: result.toAmount,
|
|
88845
|
+
minReceived: result.minReceived,
|
|
88846
|
+
provider: result.provider,
|
|
88847
|
+
expiresAt: result.expiresAt ? (/* @__PURE__ */ new Date(result.expiresAt * 1e3)).toISOString() : null
|
|
88848
|
+
},
|
|
88849
|
+
transaction: result.transaction,
|
|
88850
|
+
note: "If user confirms, use send_raw_transaction with the transaction params to execute the swap."
|
|
88851
|
+
}, null, 2)
|
|
88852
|
+
}] };
|
|
88853
|
+
} catch (error) {
|
|
88854
|
+
return {
|
|
88855
|
+
content: [{
|
|
88856
|
+
type: "text",
|
|
88857
|
+
text: JSON.stringify({
|
|
88858
|
+
success: false,
|
|
88859
|
+
error: error instanceof Error ? error.message : "Unknown error"
|
|
88860
|
+
})
|
|
88861
|
+
}],
|
|
88862
|
+
isError: true
|
|
88863
|
+
};
|
|
88864
|
+
}
|
|
88865
|
+
}
|
|
88866
|
+
} };
|
|
88867
|
+
}
|
|
88868
|
+
|
|
88869
|
+
//#endregion
|
|
88870
|
+
//#region src/tools/known-jettons-tools.ts
|
|
88871
|
+
/**
|
|
88872
|
+
* Copyright (c) TonTech.
|
|
88873
|
+
*
|
|
88874
|
+
* This source code is licensed under the MIT license found in the
|
|
88875
|
+
* LICENSE file in the root directory of this source tree.
|
|
88876
|
+
*
|
|
88877
|
+
*/
|
|
88878
|
+
const getKnownJettonsSchema = z.object({});
|
|
88879
|
+
const KNOWN_JETTONS = [
|
|
88880
|
+
{
|
|
88881
|
+
symbol: "USD₮",
|
|
88882
|
+
name: "Tether USD",
|
|
88883
|
+
address: "EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs",
|
|
88884
|
+
decimals: 6
|
|
88885
|
+
},
|
|
88886
|
+
{
|
|
88887
|
+
symbol: "NOT",
|
|
88888
|
+
name: "Notcoin",
|
|
88889
|
+
address: "EQAvlWFDxGF2lXm67y4yzC17wYKD9A0guwPkMs1gOsM__NOT",
|
|
88890
|
+
decimals: 9
|
|
88891
|
+
},
|
|
88892
|
+
{
|
|
88893
|
+
symbol: "DOGS",
|
|
88894
|
+
name: "Dogs",
|
|
88895
|
+
address: "EQCvxJy4eG8hyHBFsZ7eePxrRsUQSFE_jpptRAYBmcG_DOGS",
|
|
88896
|
+
decimals: 9
|
|
88897
|
+
},
|
|
88898
|
+
{
|
|
88899
|
+
symbol: "DUST",
|
|
88900
|
+
name: "DeDust",
|
|
88901
|
+
address: "EQBlqsm144Dq6SjbPI4jjZvA1hqTIP3CvHovbIfW_t-SCALE",
|
|
88902
|
+
decimals: 9
|
|
88903
|
+
},
|
|
88904
|
+
{
|
|
88905
|
+
symbol: "GRAM",
|
|
88906
|
+
name: "Gram",
|
|
88907
|
+
address: "EQC47093oX5Xhb0xuk2lCr2RhS8rj-vul61u4W2UH5ORmG_O",
|
|
88908
|
+
decimals: 9
|
|
88909
|
+
}
|
|
88910
|
+
];
|
|
88911
|
+
function createMcpKnownJettonsTools() {
|
|
88912
|
+
return { get_known_jettons: {
|
|
88913
|
+
description: "Get a list of known/popular Jettons (tokens) on TON with their addresses and metadata. Useful for looking up token addresses for swaps or transfers.",
|
|
88914
|
+
inputSchema: getKnownJettonsSchema,
|
|
88915
|
+
handler: async () => {
|
|
88916
|
+
return { content: [{
|
|
88917
|
+
type: "text",
|
|
88918
|
+
text: JSON.stringify({
|
|
88919
|
+
success: true,
|
|
88920
|
+
jettons: KNOWN_JETTONS,
|
|
88921
|
+
count: KNOWN_JETTONS.length
|
|
88922
|
+
}, null, 2)
|
|
88923
|
+
}] };
|
|
88924
|
+
}
|
|
88925
|
+
} };
|
|
88926
|
+
}
|
|
88927
|
+
|
|
88928
|
+
//#endregion
|
|
88929
|
+
//#region src/tools/nft-tools.ts
|
|
88930
|
+
/**
|
|
88931
|
+
* Copyright (c) TonTech.
|
|
88932
|
+
*
|
|
88933
|
+
* This source code is licensed under the MIT license found in the
|
|
88934
|
+
* LICENSE file in the root directory of this source tree.
|
|
88935
|
+
*
|
|
88936
|
+
*/
|
|
88937
|
+
const getNftsSchema = z.object({
|
|
88938
|
+
limit: z.number().min(1).max(100).optional().describe("Maximum number of NFTs to return (default: 20, max: 100)"),
|
|
88939
|
+
offset: z.number().min(0).optional().describe("Offset for pagination (default: 0)")
|
|
88940
|
+
});
|
|
88941
|
+
const getNftSchema = z.object({ nftAddress: z.string().min(1).describe("NFT item contract address") });
|
|
88942
|
+
const sendNftSchema = z.object({
|
|
88943
|
+
nftAddress: z.string().min(1).describe("NFT item contract address to transfer"),
|
|
88944
|
+
toAddress: z.string().min(1).describe("Recipient TON address"),
|
|
88945
|
+
comment: z.string().optional().describe("Optional comment/memo for the transaction")
|
|
88946
|
+
});
|
|
88947
|
+
function createMcpNftTools(service) {
|
|
88713
88948
|
return {
|
|
88714
|
-
|
|
88715
|
-
description: "
|
|
88716
|
-
inputSchema:
|
|
88949
|
+
get_nfts: {
|
|
88950
|
+
description: "List all NFTs (non-fungible tokens) in the wallet with their metadata, collection info, and attributes.",
|
|
88951
|
+
inputSchema: getNftsSchema,
|
|
88717
88952
|
handler: async (args) => {
|
|
88718
88953
|
try {
|
|
88719
|
-
|
|
88720
|
-
const result = await service.getSwapQuote(args.fromToken, args.toToken, args.amount, args.slippageBps);
|
|
88721
|
-
const quoteId = generateQuoteId();
|
|
88722
|
-
const expiresAt = result.expiresAt ? result.expiresAt * 1e3 : Date.now() + 6e4;
|
|
88723
|
-
quoteCache.set(quoteId, {
|
|
88724
|
-
quote: result.quote,
|
|
88725
|
-
expiresAt
|
|
88726
|
-
});
|
|
88954
|
+
const nfts = await service.getNfts(args.limit ?? 20, args.offset ?? 0);
|
|
88727
88955
|
return { content: [{
|
|
88728
88956
|
type: "text",
|
|
88729
88957
|
text: JSON.stringify({
|
|
88730
88958
|
success: true,
|
|
88731
|
-
|
|
88732
|
-
|
|
88733
|
-
|
|
88734
|
-
|
|
88735
|
-
|
|
88736
|
-
|
|
88737
|
-
|
|
88738
|
-
|
|
88739
|
-
|
|
88959
|
+
nfts: nfts.map((nft) => ({
|
|
88960
|
+
address: nft.address,
|
|
88961
|
+
name: nft.name,
|
|
88962
|
+
description: nft.description,
|
|
88963
|
+
image: nft.image,
|
|
88964
|
+
collection: nft.collection,
|
|
88965
|
+
attributes: nft.attributes,
|
|
88966
|
+
isOnSale: nft.isOnSale,
|
|
88967
|
+
isSoulbound: nft.isSoulbound
|
|
88968
|
+
})),
|
|
88969
|
+
count: nfts.length
|
|
88740
88970
|
}, null, 2)
|
|
88741
88971
|
}] };
|
|
88742
88972
|
} catch (error) {
|
|
@@ -88753,61 +88983,84 @@ function createMcpSwapTools(service) {
|
|
|
88753
88983
|
}
|
|
88754
88984
|
}
|
|
88755
88985
|
},
|
|
88756
|
-
|
|
88757
|
-
description: "
|
|
88758
|
-
inputSchema:
|
|
88986
|
+
get_nft: {
|
|
88987
|
+
description: "Get detailed information about a specific NFT by its address.",
|
|
88988
|
+
inputSchema: getNftSchema,
|
|
88759
88989
|
handler: async (args) => {
|
|
88760
|
-
|
|
88761
|
-
|
|
88762
|
-
|
|
88763
|
-
|
|
88990
|
+
try {
|
|
88991
|
+
const nft = await service.getNft(args.nftAddress);
|
|
88992
|
+
if (!nft) return {
|
|
88993
|
+
content: [{
|
|
88994
|
+
type: "text",
|
|
88995
|
+
text: JSON.stringify({
|
|
88996
|
+
success: false,
|
|
88997
|
+
error: "NFT not found"
|
|
88998
|
+
})
|
|
88999
|
+
}],
|
|
89000
|
+
isError: true
|
|
89001
|
+
};
|
|
89002
|
+
return { content: [{
|
|
88764
89003
|
type: "text",
|
|
88765
89004
|
text: JSON.stringify({
|
|
88766
|
-
success:
|
|
88767
|
-
|
|
88768
|
-
|
|
88769
|
-
|
|
88770
|
-
|
|
88771
|
-
|
|
88772
|
-
|
|
88773
|
-
|
|
89005
|
+
success: true,
|
|
89006
|
+
nft: {
|
|
89007
|
+
address: nft.address,
|
|
89008
|
+
name: nft.name,
|
|
89009
|
+
description: nft.description,
|
|
89010
|
+
image: nft.image,
|
|
89011
|
+
collection: nft.collection,
|
|
89012
|
+
attributes: nft.attributes,
|
|
89013
|
+
ownerAddress: nft.ownerAddress,
|
|
89014
|
+
isOnSale: nft.isOnSale,
|
|
89015
|
+
isSoulbound: nft.isSoulbound,
|
|
89016
|
+
saleContractAddress: nft.saleContractAddress
|
|
89017
|
+
}
|
|
89018
|
+
}, null, 2)
|
|
89019
|
+
}] };
|
|
89020
|
+
} catch (error) {
|
|
88774
89021
|
return {
|
|
88775
89022
|
content: [{
|
|
88776
89023
|
type: "text",
|
|
88777
89024
|
text: JSON.stringify({
|
|
88778
89025
|
success: false,
|
|
88779
|
-
error:
|
|
89026
|
+
error: error instanceof Error ? error.message : "Unknown error"
|
|
89027
|
+
})
|
|
89028
|
+
}],
|
|
89029
|
+
isError: true
|
|
89030
|
+
};
|
|
89031
|
+
}
|
|
89032
|
+
}
|
|
89033
|
+
},
|
|
89034
|
+
send_nft: {
|
|
89035
|
+
description: "Transfer an NFT from the wallet to another address.",
|
|
89036
|
+
inputSchema: sendNftSchema,
|
|
89037
|
+
handler: async (args) => {
|
|
89038
|
+
try {
|
|
89039
|
+
const result = await service.sendNft(args.nftAddress, args.toAddress, args.comment);
|
|
89040
|
+
return {
|
|
89041
|
+
content: [{
|
|
89042
|
+
type: "text",
|
|
89043
|
+
text: JSON.stringify({
|
|
89044
|
+
success: result.success,
|
|
89045
|
+
message: result.message,
|
|
89046
|
+
nftAddress: args.nftAddress,
|
|
89047
|
+
recipient: args.toAddress
|
|
89048
|
+
}, null, 2)
|
|
89049
|
+
}],
|
|
89050
|
+
isError: !result.success
|
|
89051
|
+
};
|
|
89052
|
+
} catch (error) {
|
|
89053
|
+
return {
|
|
89054
|
+
content: [{
|
|
89055
|
+
type: "text",
|
|
89056
|
+
text: JSON.stringify({
|
|
89057
|
+
success: false,
|
|
89058
|
+
error: error instanceof Error ? error.message : "Unknown error"
|
|
88780
89059
|
})
|
|
88781
89060
|
}],
|
|
88782
89061
|
isError: true
|
|
88783
89062
|
};
|
|
88784
89063
|
}
|
|
88785
|
-
const result = await service.executeSwap(cachedQuote.quote);
|
|
88786
|
-
quoteCache.delete(args.quoteId);
|
|
88787
|
-
if (!result.success) return {
|
|
88788
|
-
content: [{
|
|
88789
|
-
type: "text",
|
|
88790
|
-
text: JSON.stringify({
|
|
88791
|
-
success: false,
|
|
88792
|
-
error: result.message
|
|
88793
|
-
})
|
|
88794
|
-
}],
|
|
88795
|
-
isError: true
|
|
88796
|
-
};
|
|
88797
|
-
return { content: [{
|
|
88798
|
-
type: "text",
|
|
88799
|
-
text: JSON.stringify({
|
|
88800
|
-
success: true,
|
|
88801
|
-
message: result.message,
|
|
88802
|
-
details: {
|
|
88803
|
-
fromToken: cachedQuote.quote.fromToken,
|
|
88804
|
-
toToken: cachedQuote.quote.toToken,
|
|
88805
|
-
fromAmount: cachedQuote.quote.fromAmount,
|
|
88806
|
-
toAmount: cachedQuote.quote.toAmount,
|
|
88807
|
-
provider: cachedQuote.quote.providerId
|
|
88808
|
-
}
|
|
88809
|
-
}, null, 2)
|
|
88810
|
-
}] };
|
|
88811
89064
|
}
|
|
88812
89065
|
}
|
|
88813
89066
|
};
|
|
@@ -88864,6 +89117,8 @@ async function createTonWalletMCP(config) {
|
|
|
88864
89117
|
const balanceTools = createMcpBalanceTools(walletService);
|
|
88865
89118
|
const transferTools = createMcpTransferTools(walletService);
|
|
88866
89119
|
const swapTools = createMcpSwapTools(walletService);
|
|
89120
|
+
const knownJettonsTools = createMcpKnownJettonsTools();
|
|
89121
|
+
const nftTools = createMcpNftTools(walletService);
|
|
88867
89122
|
const registerTool = (name, tool) => {
|
|
88868
89123
|
server.registerTool(name, {
|
|
88869
89124
|
description: tool.description,
|
|
@@ -88876,8 +89131,12 @@ async function createTonWalletMCP(config) {
|
|
|
88876
89131
|
registerTool("get_transactions", balanceTools.get_transactions);
|
|
88877
89132
|
registerTool("send_ton", transferTools.send_ton);
|
|
88878
89133
|
registerTool("send_jetton", transferTools.send_jetton);
|
|
89134
|
+
registerTool("send_raw_transaction", transferTools.send_raw_transaction);
|
|
88879
89135
|
registerTool("get_swap_quote", swapTools.get_swap_quote);
|
|
88880
|
-
registerTool("
|
|
89136
|
+
registerTool("get_known_jettons", knownJettonsTools.get_known_jettons);
|
|
89137
|
+
registerTool("get_nfts", nftTools.get_nfts);
|
|
89138
|
+
registerTool("get_nft", nftTools.get_nft);
|
|
89139
|
+
registerTool("send_nft", nftTools.send_nft);
|
|
88881
89140
|
return server;
|
|
88882
89141
|
}
|
|
88883
89142
|
|
package/dist/factory.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAOlE;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC;;;OAGG;IACH,MAAM,EAAE,aAAa,CAAC;IAEtB;;OAEG;IACH,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAE5B;;OAEG;IACH,QAAQ,CAAC,EAAE;QACP,OAAO,CAAC,EAAE,aAAa,CAAC;QACxB,OAAO,CAAC,EAAE,aAAa,CAAC;KAC3B,CAAC;CACL;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,SAAS,CAAC,CAkDxF;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,gBAAgB,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAE1F"}
|