bsv-mcp 0.0.4 → 0.0.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/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.4",
5
+ "version": "0.0.5",
6
6
  "bin": {
7
7
  "bsv-mcp": "./index.ts"
8
8
  },
@@ -130,7 +130,6 @@ export function registerMarketListingsTool(server: McpServer): void {
130
130
  url.searchParams.append("limit", limit.toString());
131
131
  url.searchParams.append("offset", offset.toString());
132
132
  url.searchParams.append("dir", dir);
133
- url.searchParams.append("script", "true");
134
133
 
135
134
  // Add sort parameter based on token type
136
135
  if (useTokenParams) {
@@ -97,7 +97,6 @@ export function registerMarketSalesTool(server: McpServer): void {
97
97
  url.searchParams.append("limit", limit.toString());
98
98
  url.searchParams.append("offset", offset.toString());
99
99
  url.searchParams.append("dir", dir);
100
- url.searchParams.append("script", "true");
101
100
 
102
101
  // Add type parameter for bsv21 if needed
103
102
  if (tokenType === "bsv21") {
@@ -6,6 +6,7 @@ import {
6
6
  type ChangeResult,
7
7
  type ExistingListing,
8
8
  type Payment,
9
+ type Royalty,
9
10
  type TokenUtxo,
10
11
  type Utxo,
11
12
  TokenType,
@@ -23,11 +24,27 @@ import { purchaseListingArgsSchema } from "./schemas";
23
24
  import type { Wallet } from "./wallet";
24
25
 
25
26
  // Define types for 1Sat API response
26
- interface ListingResponse {
27
+ interface OrdUtxo {
27
28
  txid: string;
28
29
  vout: number;
29
30
  satoshis: number;
30
31
  script: string;
32
+ origin?: {
33
+ outpoint: string;
34
+ data?: {
35
+ map?: {
36
+ royalties?: string;
37
+ [key: string]: string | number | boolean | null | undefined;
38
+ };
39
+ insc?: {
40
+ text?: string;
41
+ file?: {
42
+ type?: string;
43
+ size?: number;
44
+ };
45
+ };
46
+ };
47
+ };
31
48
  data?: {
32
49
  list?: {
33
50
  price: number;
@@ -79,7 +96,7 @@ export function registerPurchaseListingTool(server: McpServer, wallet: Wallet) {
79
96
  );
80
97
  }
81
98
 
82
- const listingData = (await response.json()) as ListingResponse;
99
+ const listingData = (await response.json()) as OrdUtxo;
83
100
 
84
101
  // Check if the listing is valid and has a price
85
102
  if (!listingData.data?.list?.price) {
@@ -211,6 +228,16 @@ Please fund this wallet address with enough BSV to cover the purchase price
211
228
  listingUtxo,
212
229
  };
213
230
 
231
+ // Check for royalties in the NFT origin data
232
+ let royalties: Royalty[] = [];
233
+ if (listingData.origin?.data?.map?.royalties) {
234
+ try {
235
+ royalties = JSON.parse(listingData.origin.data.map.royalties);
236
+ } catch (error) {
237
+ console.warn("Failed to parse royalties:", error);
238
+ }
239
+ }
240
+
214
241
  transaction = await purchaseOrdListing({
215
242
  utxos: paymentUtxos,
216
243
  paymentPk,
@@ -218,6 +245,7 @@ Please fund this wallet address with enough BSV to cover the purchase price
218
245
  listing,
219
246
  additionalPayments,
220
247
  metaData,
248
+ royalties,
221
249
  });
222
250
  }
223
251
 
@@ -264,6 +292,8 @@ Please fund this wallet address with enough BSV to cover the purchase price
264
292
  price: listingData.data.list.price,
265
293
  marketFee,
266
294
  marketFeeAddress: MARKET_WALLET_ADDRESS,
295
+ royaltiesPaid: args.listingType === "nft" && listingData.origin?.data?.map?.royalties ?
296
+ JSON.parse(listingData.origin.data.map.royalties) : undefined,
267
297
  }),
268
298
  },
269
299
  ],