lovewebconnection 0.0.0-stage → 0.2.0
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/.env.example +38 -0
- package/LICENSE +21 -0
- package/README.md +1915 -2
- package/dist/alert-queue.d.ts +72 -0
- package/dist/alert-queue.js +155 -0
- package/dist/alert-store.d.ts +29 -0
- package/dist/alert-store.js +75 -0
- package/dist/balances.d.ts +221 -0
- package/dist/balances.js +1232 -0
- package/dist/cache.d.ts +37 -0
- package/dist/cache.js +128 -0
- package/dist/call.d.ts +46 -0
- package/dist/call.js +377 -0
- package/dist/chain.d.ts +97 -0
- package/dist/chain.js +419 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +1011 -0
- package/dist/compare-history.d.ts +82 -0
- package/dist/compare-history.js +340 -0
- package/dist/compare.d.ts +98 -0
- package/dist/compare.js +492 -0
- package/dist/contract.d.ts +107 -0
- package/dist/contract.js +162 -0
- package/dist/default-abi.d.ts +53 -0
- package/dist/default-abi.js +85 -0
- package/dist/history.d.ts +83 -0
- package/dist/history.js +422 -0
- package/dist/index.d.ts +54 -0
- package/dist/index.js +27 -0
- package/dist/market-page.d.ts +8 -0
- package/dist/market-page.js +554 -0
- package/dist/market-server.d.ts +46 -0
- package/dist/market-server.js +473 -0
- package/dist/market.d.ts +323 -0
- package/dist/market.js +835 -0
- package/dist/metadata-cache.d.ts +72 -0
- package/dist/metadata-cache.js +197 -0
- package/dist/metrics.d.ts +64 -0
- package/dist/metrics.js +138 -0
- package/dist/plot.d.ts +60 -0
- package/dist/plot.js +317 -0
- package/dist/presets-history.d.ts +372 -0
- package/dist/presets-history.js +1243 -0
- package/dist/presets-summary.d.ts +17 -0
- package/dist/presets-summary.js +55 -0
- package/dist/presets.d.ts +59 -0
- package/dist/presets.js +181 -0
- package/dist/prices.d.ts +63 -0
- package/dist/prices.js +154 -0
- package/dist/rotate.d.ts +19 -0
- package/dist/rotate.js +34 -0
- package/dist/scan.d.ts +81 -0
- package/dist/scan.js +501 -0
- package/dist/sessions.d.ts +104 -0
- package/dist/sessions.js +515 -0
- package/dist/signatures.d.ts +13 -0
- package/dist/signatures.js +43 -0
- package/dist/tokenfile.d.ts +50 -0
- package/dist/tokenfile.js +218 -0
- package/dist/views.d.ts +63 -0
- package/dist/views.js +415 -0
- package/dist/watch.d.ts +306 -0
- package/dist/watch.js +1121 -0
- package/dist/webhook.d.ts +17 -0
- package/dist/webhook.js +35 -0
- package/examples/erc20.abi.json +57 -0
- package/examples/xlayer.tokens.json +4 -0
- package/package.json +77 -4
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface WebhookOptions {
|
|
2
|
+
/** Value for the Authorization header; null or blank sends none. */
|
|
3
|
+
authHeader?: string | null;
|
|
4
|
+
timeoutMs?: number;
|
|
5
|
+
/** Injected for tests; defaults to the global fetch. */
|
|
6
|
+
fetchImpl?: typeof fetch;
|
|
7
|
+
}
|
|
8
|
+
export interface WebhookResult {
|
|
9
|
+
ok: boolean;
|
|
10
|
+
/** Failure reason when ok is false, else null. */
|
|
11
|
+
message: string | null;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* POST an alert payload. Delivery never throws, so a receiver that rejects the
|
|
15
|
+
* call cannot end a watch run; the caller decides how to report the failure.
|
|
16
|
+
*/
|
|
17
|
+
export declare function postWebhook(url: string, payload: Record<string, unknown>, options?: WebhookOptions): Promise<WebhookResult>;
|
package/dist/webhook.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const DEFAULT_TIMEOUT_MS = 3000;
|
|
2
|
+
function describe(error) {
|
|
3
|
+
if (error instanceof Error) {
|
|
4
|
+
const short = error.shortMessage;
|
|
5
|
+
if (typeof short === "string" && short.length > 0)
|
|
6
|
+
return short;
|
|
7
|
+
return error.message;
|
|
8
|
+
}
|
|
9
|
+
return String(error);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* POST an alert payload. Delivery never throws, so a receiver that rejects the
|
|
13
|
+
* call cannot end a watch run; the caller decides how to report the failure.
|
|
14
|
+
*/
|
|
15
|
+
export async function postWebhook(url, payload, options = {}) {
|
|
16
|
+
const fetchImpl = options.fetchImpl ?? fetch;
|
|
17
|
+
const headers = { "content-type": "application/json" };
|
|
18
|
+
const auth = options.authHeader?.trim();
|
|
19
|
+
if (auth)
|
|
20
|
+
headers.authorization = auth;
|
|
21
|
+
try {
|
|
22
|
+
const response = await fetchImpl(url, {
|
|
23
|
+
method: "POST",
|
|
24
|
+
headers,
|
|
25
|
+
body: JSON.stringify(payload),
|
|
26
|
+
signal: AbortSignal.timeout(options.timeoutMs ?? DEFAULT_TIMEOUT_MS),
|
|
27
|
+
});
|
|
28
|
+
return response.ok
|
|
29
|
+
? { ok: true, message: null }
|
|
30
|
+
: { ok: false, message: `HTTP ${response.status}` };
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
return { ok: false, message: describe(error) };
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"type": "function",
|
|
4
|
+
"name": "name",
|
|
5
|
+
"stateMutability": "view",
|
|
6
|
+
"inputs": [],
|
|
7
|
+
"outputs": [{ "name": "", "type": "string" }]
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"type": "function",
|
|
11
|
+
"name": "symbol",
|
|
12
|
+
"stateMutability": "view",
|
|
13
|
+
"inputs": [],
|
|
14
|
+
"outputs": [{ "name": "", "type": "string" }]
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"type": "function",
|
|
18
|
+
"name": "decimals",
|
|
19
|
+
"stateMutability": "view",
|
|
20
|
+
"inputs": [],
|
|
21
|
+
"outputs": [{ "name": "", "type": "uint8" }]
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"type": "function",
|
|
25
|
+
"name": "totalSupply",
|
|
26
|
+
"stateMutability": "view",
|
|
27
|
+
"inputs": [],
|
|
28
|
+
"outputs": [{ "name": "", "type": "uint256" }]
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"type": "function",
|
|
32
|
+
"name": "balanceOf",
|
|
33
|
+
"stateMutability": "view",
|
|
34
|
+
"inputs": [{ "name": "account", "type": "address" }],
|
|
35
|
+
"outputs": [{ "name": "", "type": "uint256" }]
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"type": "function",
|
|
39
|
+
"name": "allowance",
|
|
40
|
+
"stateMutability": "view",
|
|
41
|
+
"inputs": [
|
|
42
|
+
{ "name": "owner", "type": "address" },
|
|
43
|
+
{ "name": "spender", "type": "address" }
|
|
44
|
+
],
|
|
45
|
+
"outputs": [{ "name": "remaining", "type": "uint256" }]
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"type": "function",
|
|
49
|
+
"name": "transfer",
|
|
50
|
+
"stateMutability": "nonpayable",
|
|
51
|
+
"inputs": [
|
|
52
|
+
{ "name": "to", "type": "address" },
|
|
53
|
+
{ "name": "amount", "type": "uint256" }
|
|
54
|
+
],
|
|
55
|
+
"outputs": [{ "name": "", "type": "bool" }]
|
|
56
|
+
}
|
|
57
|
+
]
|
package/package.json
CHANGED
|
@@ -1,6 +1,79 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lovewebconnection",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "lwc — read-only EVM chain connection kit: chain health, balances, scans, view calls, and watch-mode reliability checks",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"homepage": "https://github.com/emeraldjewels4-rgb/lovewebconnection-cli#readme",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/emeraldjewels4-rgb/lovewebconnection-cli.git"
|
|
10
|
+
},
|
|
11
|
+
"author": "emeraldjewels4-rgb (https://github.com/emeraldjewels4-rgb)",
|
|
12
|
+
"type": "module",
|
|
13
|
+
"bin": {
|
|
14
|
+
"lwc": "./dist/cli.js"
|
|
15
|
+
},
|
|
16
|
+
"main": "./dist/index.js",
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"import": "./dist/index.js"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist",
|
|
26
|
+
"examples",
|
|
27
|
+
"README.md",
|
|
28
|
+
".env.example"
|
|
29
|
+
],
|
|
30
|
+
"engines": {
|
|
31
|
+
"node": ">=24.0.0"
|
|
32
|
+
},
|
|
33
|
+
"keywords": [
|
|
34
|
+
"evm",
|
|
35
|
+
"ethereum",
|
|
36
|
+
"rpc",
|
|
37
|
+
"blockchain",
|
|
38
|
+
"viem",
|
|
39
|
+
"read-only",
|
|
40
|
+
"xlayer",
|
|
41
|
+
"base",
|
|
42
|
+
"cli"
|
|
43
|
+
],
|
|
44
|
+
"scripts": {
|
|
45
|
+
"build": "tsc -p tsconfig.build.json",
|
|
46
|
+
"prepack": "npm run build",
|
|
47
|
+
"prepare": "git config core.hooksPath .githooks || true",
|
|
48
|
+
"typecheck": "tsc --noEmit",
|
|
49
|
+
"test": "node --test src/chain.test.ts src/balances.test.ts src/contract.test.ts src/watch.test.ts src/call.test.ts src/metrics.test.ts src/scan.test.ts src/compare.test.ts src/compare-history.test.ts src/metadata-cache.test.ts src/cache.test.ts src/tokenfile.test.ts src/views.test.ts src/signatures.test.ts src/sessions.test.ts src/history.test.ts src/plot.test.ts src/prices.test.ts src/rotate.test.ts src/webhook.test.ts src/alert-queue.test.ts src/alert-store.test.ts src/market.test.ts src/market-server.test.ts src/presets-summary.test.ts src/presets-history.test.ts src/presets.test.ts src/explorer-state.test.ts src/explorer-browser.test.ts",
|
|
50
|
+
"chain": "node src/cli.ts",
|
|
51
|
+
"chain:json": "node src/cli.ts --json",
|
|
52
|
+
"balances": "node src/cli.ts balances",
|
|
53
|
+
"example": "node src/cli.ts example",
|
|
54
|
+
"watch": "node src/cli.ts watch",
|
|
55
|
+
"call": "node src/cli.ts call",
|
|
56
|
+
"tokens": "node src/cli.ts tokens",
|
|
57
|
+
"views": "node src/cli.ts views",
|
|
58
|
+
"signatures": "node src/cli.ts signatures",
|
|
59
|
+
"sessions": "node src/cli.ts sessions",
|
|
60
|
+
"history": "node src/cli.ts history",
|
|
61
|
+
"plot": "node src/cli.ts plot",
|
|
62
|
+
"scan": "node src/cli.ts scan",
|
|
63
|
+
"cache": "node src/cli.ts cache",
|
|
64
|
+
"compare": "node src/cli.ts compare",
|
|
65
|
+
"compare-history": "node src/cli.ts compare-history",
|
|
66
|
+
"market": "node src/cli.ts market",
|
|
67
|
+
"presets": "node src/cli.ts presets",
|
|
68
|
+
"presets-history": "node src/cli.ts presets-history",
|
|
69
|
+
"explorer:data": "node scripts/explorer-data.mjs",
|
|
70
|
+
"migrate": "node scripts/migrate.mjs"
|
|
71
|
+
},
|
|
72
|
+
"dependencies": {
|
|
73
|
+
"viem": "^2.21.0"
|
|
74
|
+
},
|
|
75
|
+
"devDependencies": {
|
|
76
|
+
"@types/node": "^22.7.0",
|
|
77
|
+
"typescript": "^5.6.0"
|
|
78
|
+
}
|
|
79
|
+
}
|