veriql-eliza 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 +5 -0
- package/dist/client.js +17 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -0
- package/package.json +1 -1
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
|
-
|
|
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
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Action, Plugin } from "@elizaos/core";
|
|
2
2
|
import { type VeriqlResult } from "./client.js";
|
|
3
3
|
export { VeriqlClient, familyOf, priceCapPolicy, usdcToAtomic } from "./client.js";
|
|
4
|
+
/** Kept equal to package.json by a test. */
|
|
5
|
+
export declare const USER_AGENT = "veriql-eliza/0.1.1";
|
|
4
6
|
/** The first address in a message, in the order an EVM agent most likely means. */
|
|
5
7
|
export declare function extractAddress(text: string): string | null;
|
|
6
8
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { privateKeyToAccount } from "viem/accounts";
|
|
2
2
|
import { DESCRIPTIONS, FREE_KEY_URL, VeriqlClient, familyOf } from "./client.js";
|
|
3
3
|
export { VeriqlClient, familyOf, priceCapPolicy, usdcToAtomic } from "./client.js";
|
|
4
|
+
/** Kept equal to package.json by a test. */
|
|
5
|
+
export const USER_AGENT = "veriql-eliza/0.1.1";
|
|
4
6
|
const ADDRESS_PATTERNS = [
|
|
5
7
|
/0x[0-9a-fA-F]{40}(?![0-9a-fA-F])/,
|
|
6
8
|
/\bT[1-9A-HJ-NP-Za-km-z]{33}\b/,
|
|
@@ -57,6 +59,7 @@ function clientFor(runtime) {
|
|
|
57
59
|
apiKey: setting(runtime, "VERIQL_API_KEY"),
|
|
58
60
|
maxPaymentUsdc: Number.isFinite(cap) && cap > 0 ? cap : undefined,
|
|
59
61
|
baseUrl: setting(runtime, "VERIQL_BASE_URL"),
|
|
62
|
+
userAgent: USER_AGENT,
|
|
60
63
|
});
|
|
61
64
|
const pk = setting(runtime, "VERIQL_X402_PRIVATE_KEY");
|
|
62
65
|
let signer = null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "veriql-eliza",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Veriql plugin for ElizaOS: 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
|
"elizaos",
|