Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/routes/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { erc8004Abi } from "../../packages/cli/src/sdk/abi";
import { listAgentWallets, getBaseAddress } from "../../lib/ows/wallet";
import { createOwsAccount } from "../lib/publish";
import { db } from "../db";

Check warning on line 7 in app/routes/settings.ts

View workflow job for this annotation

GitHub Actions / lint-and-typecheck

'db' is defined but never used
import {
signMessage as owsSignMsg,
} from "@open-wallet-standard/core";
Expand Down Expand Up @@ -56,10 +56,15 @@
const result = owsSignMsg(wallet.name, "eip155:8453", message, passphrase);
const signature = result.signature.startsWith("0x") ? result.signature : `0x${result.signature}`;

// Include agentId from config.json if available
const config = readConfig();
const agentId = config.agentId ? Number(config.agentId) : undefined;

return c.json({
message,
signature,
owsWallet,
agentId,
});
} catch (err: unknown) {
const msg = err instanceof Error ? err.message : "Failed to generate binding proof";
Expand Down
20 changes: 18 additions & 2 deletions app/web/components/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export function Settings({ token, onLogout }: { token: string; onLogout: () => v

// Link to PlotLink (binding proof for DB link)
const [humanWallet, setHumanWallet] = useState("");
const [bindingResult, setBindingResult] = useState<{ message: string; signature: string; owsWallet: string } | null>(null);
const [bindingResult, setBindingResult] = useState<{ message: string; signature: string; owsWallet: string; agentId?: number } | null>(null);
const [generating, setGenerating] = useState(false);
const [bindingError, setBindingError] = useState<string | null>(null);
const [copied, setCopied] = useState<"signature" | "wallet" | null>(null);
Expand Down Expand Up @@ -268,8 +268,24 @@ export function Settings({ token, onLogout }: { token: string; onLogout: () => v
</button>
</div>
</div>
{bindingResult.agentId && (
<div>
<label className="text-muted text-xs block mb-1">Agent ID</label>
<div className="relative">
<div className="bg-surface border-border rounded border p-2 text-xs font-mono text-foreground pr-16">
{bindingResult.agentId}
</div>
<button
onClick={() => copyToClipboard(String(bindingResult.agentId), "agentId")}
className="absolute top-1 right-1 text-xs px-2 py-1 rounded border border-border text-muted hover:text-accent hover:border-accent transition-colors"
>
{copied === "agentId" ? "Copied!" : "Copy"}
</button>
</div>
</div>
)}
<p className="text-xs text-accent">
Now go to plotlink.xyz/agents and paste both values in the &quot;Link AI Writer&quot; section.
Now go to plotlink.xyz/agents and paste the values in the &quot;Link AI Writer&quot; section.
</p>
</div>
)}
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "plotlink-ows",
"version": "1.0.18",
"version": "1.0.19",
"bin": {
"plotlink-ows": "./bin/plotlink-ows.js"
},
Expand Down
Loading