bsv-mcp 0.0.3 → 0.0.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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "bsv-mcp",
3
3
  "module": "index.ts",
4
4
  "type": "module",
5
- "version": "0.0.3",
5
+ "version": "0.0.4",
6
6
  "bin": {
7
7
  "bsv-mcp": "./index.ts"
8
8
  },
@@ -37,11 +37,6 @@ export const marketListingsArgsSchema = z.object({
37
37
  .enum(["recent", "price", "num", "height", "price_per_token"])
38
38
  .default("recent")
39
39
  .describe("Sort method (recent, price, num, height, price_per_token)"),
40
- bsv20Type: z
41
- .enum(["v1", "v2", "all"])
42
- .default("all")
43
- .optional()
44
- .describe("BSV20 token type (v1, v2, or all)"),
45
40
  id: z.string().optional().describe("Token ID in outpoint format"),
46
41
  tick: z.string().optional().describe("Token ticker symbol"),
47
42
  pending: z.boolean().default(false).optional().describe("Include pending sales"),
@@ -114,7 +109,6 @@ export function registerMarketListingsTool(server: McpServer): void {
114
109
  minPrice,
115
110
  maxPrice,
116
111
  tokenType,
117
- bsv20Type,
118
112
  id,
119
113
  tick,
120
114
  pending,
@@ -124,12 +118,9 @@ export function registerMarketListingsTool(server: McpServer): void {
124
118
  let baseUrl = "https://ordinals.gorillapool.io/api";
125
119
  let useTokenParams = false;
126
120
 
127
- if (tokenType === "bsv20") {
121
+ if (tokenType === "bsv20" || tokenType === "bsv21") {
128
122
  baseUrl += "/bsv20/market";
129
123
  useTokenParams = true;
130
- } else if (tokenType === "bsv21") {
131
- baseUrl += "/bsv21/market"; // Assuming BSV21 endpoint follows similar pattern
132
- useTokenParams = true;
133
124
  } else if (tokenType === "nft" || tokenType === "all") {
134
125
  baseUrl += "/market";
135
126
  }
@@ -139,6 +130,7 @@ export function registerMarketListingsTool(server: McpServer): void {
139
130
  url.searchParams.append("limit", limit.toString());
140
131
  url.searchParams.append("offset", offset.toString());
141
132
  url.searchParams.append("dir", dir);
133
+ url.searchParams.append("script", "true");
142
134
 
143
135
  // Add sort parameter based on token type
144
136
  if (useTokenParams) {
@@ -147,8 +139,8 @@ export function registerMarketListingsTool(server: McpServer): void {
147
139
  url.searchParams.append("sort", sort);
148
140
  }
149
141
  // Add token-specific parameters
150
- if (bsv20Type && bsv20Type !== "all") {
151
- url.searchParams.append("type", bsv20Type);
142
+ if (tokenType === "bsv21") {
143
+ url.searchParams.append("type", "v2");
152
144
  }
153
145
  if (id) url.searchParams.append("id", id);
154
146
  if (tick) url.searchParams.append("tick", tick);
@@ -24,11 +24,6 @@ export const marketSalesArgsSchema = z.object({
24
24
  .enum(["bsv20", "bsv21", "all"])
25
25
  .default("bsv20")
26
26
  .describe("Type of token to search for (bsv20, bsv21, or all)"),
27
- bsv20Type: z
28
- .enum(["v1", "v2", "all"])
29
- .default("all")
30
- .optional()
31
- .describe("BSV20 token type (v1, v2, or all)"),
32
27
  id: z.string().optional().describe("Token ID in outpoint format"),
33
28
  tick: z.string().optional().describe("Token ticker symbol"),
34
29
  pending: z.boolean().default(false).optional().describe("Include pending sales"),
@@ -85,7 +80,6 @@ export function registerMarketSalesTool(server: McpServer): void {
85
80
  offset,
86
81
  dir,
87
82
  tokenType,
88
- bsv20Type,
89
83
  id,
90
84
  tick,
91
85
  pending,
@@ -94,23 +88,20 @@ export function registerMarketSalesTool(server: McpServer): void {
94
88
 
95
89
  // Determine the API endpoint based on tokenType
96
90
  let baseUrl = "https://ordinals.gorillapool.io/api";
97
-
98
- if (tokenType === "bsv21") {
99
- baseUrl += "/bsv21/market/sales";
100
- } else {
101
- // Default to BSV20 for "bsv20" or "all"
102
- baseUrl += "/bsv20/market/sales";
103
- }
91
+
92
+ // Default to BSV20 for all token types
93
+ baseUrl += "/bsv20/market/sales";
104
94
 
105
95
  // Build the URL with query parameters
106
96
  const url = new URL(baseUrl);
107
97
  url.searchParams.append("limit", limit.toString());
108
98
  url.searchParams.append("offset", offset.toString());
109
99
  url.searchParams.append("dir", dir);
100
+ url.searchParams.append("script", "true");
110
101
 
111
- // Add type parameter for bsv20 only if specified
112
- if (bsv20Type && bsv20Type !== "all") {
113
- url.searchParams.append("type", bsv20Type);
102
+ // Add type parameter for bsv21 if needed
103
+ if (tokenType === "bsv21") {
104
+ url.searchParams.append("type", "v2");
114
105
  }
115
106
 
116
107
  if (id) url.searchParams.append("id", id);
@@ -183,6 +183,7 @@ Please fund this wallet address with enough BSV to cover the purchase price
183
183
  satoshis: 1, // TokenUtxo's satoshis must be exactly 1
184
184
  amt: listingData.data.bsv20.amt,
185
185
  id: args.tokenID,
186
+ payout: listingData.data.list.payout,
186
187
  };
187
188
 
188
189
  transaction = await purchaseOrdTokenListing({
@@ -261,7 +261,7 @@ export const getAddressArgsSchema = z.object({});
261
261
  export const sendToAddressArgsSchema = z.object({
262
262
  address: z.string(),
263
263
  amount: z.number(),
264
- currency: z.enum(["BSV", "USD"]).optional(),
264
+ currency: z.enum(["BSV", "USD"]).optional().default("BSV"),
265
265
  description: z.string().optional(),
266
266
  });
267
267
 
@@ -275,22 +275,24 @@ export const purchaseListingArgsSchema = z.object({
275
275
  ordAddress: z
276
276
  .string()
277
277
  .describe("The ordinal address to receive the purchased item"),
278
- description: z
279
- .string()
280
- .optional()
281
- .describe("Optional description for the transaction"),
282
278
  listingType: z
283
279
  .enum(["nft", "token"])
284
280
  .default("nft")
285
281
  .describe("Type of listing: 'nft' for ordinal NFTs, 'token' for BSV-20 tokens"),
286
282
  tokenProtocol: z
287
283
  .enum(["bsv-20", "bsv-21"])
288
- .optional()
284
+ .optional().default("bsv-21")
289
285
  .describe("Token protocol for token listings (required when listingType is 'token')"),
290
286
  tokenID: z
291
287
  .string()
292
288
  .optional()
293
289
  .describe("Token ID for BSV-21 tokens or ticker for BSV-20 tokens (required when listingType is 'token')"),
290
+ description: z
291
+ .string()
292
+ .optional()
293
+ .describe("Optional description for the transaction"),
294
294
  });
295
295
 
296
+ // Export types
297
+ export type SendToAddressArgs = z.infer<typeof sendToAddressArgsSchema>;
296
298
  export type PurchaseListingArgs = z.infer<typeof purchaseListingArgsSchema>;