plotlink-ows 1.0.15 → 1.0.16

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.
@@ -194,16 +194,21 @@ settings.get("/link-status", async (c) => {
194
194
  }) as bigint;
195
195
 
196
196
  if (balance > 0n) {
197
- const tokenId = await publicClient.readContract({
198
- address: ERC_8004,
199
- abi: [{ type: "function", name: "tokenOfOwnerByIndex", stateMutability: "view", inputs: [{ name: "owner", type: "address" }, { name: "index", type: "uint256" }], outputs: [{ name: "", type: "uint256" }] }] as const,
200
- functionName: "tokenOfOwnerByIndex",
201
- args: [address as `0x${string}`, 0n],
202
- }) as bigint;
203
-
204
- return c.json({ linked: true, agentId: Number(tokenId), owsWallet: address });
197
+ // Try to get token ID (ERC-721 Enumerable — may not be supported)
198
+ let agentId: number | undefined;
199
+ try {
200
+ const tokenId = await publicClient.readContract({
201
+ address: ERC_8004,
202
+ abi: [{ type: "function", name: "tokenOfOwnerByIndex", stateMutability: "view", inputs: [{ name: "owner", type: "address" }, { name: "index", type: "uint256" }], outputs: [{ name: "", type: "uint256" }] }] as const,
203
+ functionName: "tokenOfOwnerByIndex",
204
+ args: [address as `0x${string}`, 0n],
205
+ }) as bigint;
206
+ agentId = Number(tokenId);
207
+ } catch { /* ERC-721 Enumerable not supported — agent ID unknown */ }
208
+
209
+ return c.json({ linked: true, agentId, owsWallet: address });
205
210
  }
206
- } catch { /* best effort */ }
211
+ } catch { /* balanceOf failed */ }
207
212
 
208
213
  return c.json({ linked: false, owsWallet: address });
209
214
  } catch (err: unknown) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plotlink-ows",
3
- "version": "1.0.15",
3
+ "version": "1.0.16",
4
4
  "bin": {
5
5
  "plotlink-ows": "./bin/plotlink-ows.js"
6
6
  },