veriql-goat 0.1.0 → 0.1.1

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/client.d.ts CHANGED
@@ -37,7 +37,12 @@ export interface VeriqlClientConfig {
37
37
  baseUrl?: string;
38
38
  /** Injected for tests. */
39
39
  fetch?: typeof fetch;
40
+ /** `veriql-<package>/<version>`, so the dashboard can tell which framework a
41
+ * call came through. Sent only where the runtime allows it (not browsers). */
42
+ userAgent?: string;
40
43
  }
44
+ /** Adds a user-agent to every request unless the caller already set one. */
45
+ export declare function withUserAgent(f: typeof fetch, ua: string): typeof fetch;
41
46
  /** Every answer is a plain object an agent framework can serialise. */
42
47
  export type VeriqlResult = Record<string, unknown>;
43
48
  /**
package/dist/client.js CHANGED
@@ -48,6 +48,21 @@ Drain Watch known drainer and scam addresses), refreshed daily. No payment.
48
48
  Use it for a quick screen. Before actually sending funds prefer the payee check, which also reads
49
49
  Tether and Circle freezes. An address NOT on the list means no listing was found, not that it is safe.`,
50
50
  };
51
+ /** Adds a user-agent to every request unless the caller already set one. */
52
+ export function withUserAgent(f, ua) {
53
+ return (input, init) => {
54
+ if (input instanceof Request) {
55
+ const headers = new Headers(input.headers);
56
+ if (!headers.has("user-agent"))
57
+ headers.set("user-agent", ua);
58
+ return f(new Request(input, { ...init, headers }));
59
+ }
60
+ const headers = new Headers(init?.headers);
61
+ if (!headers.has("user-agent"))
62
+ headers.set("user-agent", ua);
63
+ return f(input, { ...init, headers });
64
+ };
65
+ }
51
66
  /**
52
67
  * Which denylist family an address belongs to, by shape alone. Tron is checked
53
68
  * before Solana because a 34-character Tron address also passes a base58
@@ -100,7 +115,8 @@ export class VeriqlClient {
100
115
  const cap = config.maxPaymentUsdc;
101
116
  this.capAtomic = usdcToAtomic(typeof cap === "number" && Number.isFinite(cap) && cap > 0 ? cap : DEFAULT_MAX_PAYMENT_USDC);
102
117
  this.baseUrl = (config.baseUrl ?? VERIQL_BASE_URL).replace(/\/+$/, "");
103
- this.fetchImpl = config.fetch ?? fetch;
118
+ const base = config.fetch ?? fetch;
119
+ this.fetchImpl = config.userAgent ? withUserAgent(base, config.userAgent) : base;
104
120
  }
105
121
  /** Checks a recipient before funds are sent. Paid: API key, or x402 from `signer`. */
106
122
  async checkPayee(address, signer) {
package/dist/index.d.ts CHANGED
@@ -4,6 +4,8 @@ import { type EvmPaymentSigner, VeriqlClient, type VeriqlClientConfig } from "./
4
4
  export { VeriqlClient, familyOf, priceCapPolicy, usdcToAtomic } from "./client.js";
5
5
  export type { EvmPaymentSigner, VeriqlClientConfig, VeriqlResult } from "./client.js";
6
6
  export type VeriqlPluginOptions = VeriqlClientConfig;
7
+ /** Kept equal to package.json by a test. */
8
+ export declare const USER_AGENT = "veriql-goat/0.1.1";
7
9
  /**
8
10
  * An x402 payment signer for a GOAT EVM wallet, or null when the wallet
9
11
  * cannot sign EIP-712 (a non-EVM wallet). Duck-typed so the plugin does not
package/dist/index.js CHANGED
@@ -9,6 +9,8 @@ import { PluginBase, createTool } from "@goat-sdk/core";
9
9
  import { z } from "zod";
10
10
  import { DESCRIPTIONS, VeriqlClient } from "./client.js";
11
11
  export { VeriqlClient, familyOf, priceCapPolicy, usdcToAtomic } from "./client.js";
12
+ /** Kept equal to package.json by a test. */
13
+ export const USER_AGENT = "veriql-goat/0.1.1";
12
14
  const addressSchema = z.object({
13
15
  address: z.string().describe("The recipient address: EVM (0x...), Solana, Bitcoin or Tron"),
14
16
  });
@@ -42,6 +44,7 @@ export class VeriqlPlugin extends PluginBase {
42
44
  super("veriql", []);
43
45
  const envCap = Number(process.env.VERIQL_MAX_PAYMENT_USDC);
44
46
  this.client = new VeriqlClient({
47
+ userAgent: USER_AGENT,
45
48
  ...options,
46
49
  apiKey: options.apiKey ?? process.env.VERIQL_API_KEY,
47
50
  maxPaymentUsdc: options.maxPaymentUsdc ?? (Number.isFinite(envCap) && envCap > 0 ? envCap : undefined),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "veriql-goat",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Veriql plugin for GOAT: check a recipient (OFAC, Drain Watch, Tether/Circle freeze) before an agent pays, and decode a signing request (approvals, Permit2, EIP-7702) before it signs.",
5
5
  "keywords": [
6
6
  "goat",