@openscan/cli 0.0.1-alpha
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/LICENSE +21 -0
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +136 -0
- package/dist/bin.js.map +1 -0
- package/dist/commands/algo/gasPrice.d.ts +5 -0
- package/dist/commands/algo/gasPrice.d.ts.map +1 -0
- package/dist/commands/algo/gasPrice.js +34 -0
- package/dist/commands/algo/gasPrice.js.map +1 -0
- package/dist/commands/algo/tokenBalance.d.ts +5 -0
- package/dist/commands/algo/tokenBalance.d.ts.map +1 -0
- package/dist/commands/algo/tokenBalance.js +41 -0
- package/dist/commands/algo/tokenBalance.js.map +1 -0
- package/dist/commands/algo/txHistory.d.ts +5 -0
- package/dist/commands/algo/txHistory.d.ts.map +1 -0
- package/dist/commands/algo/txHistory.js +34 -0
- package/dist/commands/algo/txHistory.js.map +1 -0
- package/dist/commands/util/addressType.d.ts +5 -0
- package/dist/commands/util/addressType.d.ts.map +1 -0
- package/dist/commands/util/addressType.js +42 -0
- package/dist/commands/util/addressType.js.map +1 -0
- package/dist/commands/util/balance.d.ts +5 -0
- package/dist/commands/util/balance.d.ts.map +1 -0
- package/dist/commands/util/balance.js +58 -0
- package/dist/commands/util/balance.js.map +1 -0
- package/dist/commands/util/decodeInput.d.ts +5 -0
- package/dist/commands/util/decodeInput.d.ts.map +1 -0
- package/dist/commands/util/decodeInput.js +28 -0
- package/dist/commands/util/decodeInput.js.map +1 -0
- package/dist/handlers/index.d.ts +7 -0
- package/dist/handlers/index.d.ts.map +1 -0
- package/dist/handlers/index.js +8 -0
- package/dist/handlers/index.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/output/formatters.d.ts +6 -0
- package/dist/output/formatters.d.ts.map +1 -0
- package/dist/output/formatters.js +80 -0
- package/dist/output/formatters.js.map +1 -0
- package/dist/registry.d.ts +9 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +38 -0
- package/dist/registry.js.map +1 -0
- package/dist/rpc/index.d.ts +3 -0
- package/dist/rpc/index.d.ts.map +1 -0
- package/dist/rpc/index.js +2 -0
- package/dist/rpc/index.js.map +1 -0
- package/dist/rpc/resolve.d.ts +8 -0
- package/dist/rpc/resolve.d.ts.map +1 -0
- package/dist/rpc/resolve.js +58 -0
- package/dist/rpc/resolve.js.map +1 -0
- package/dist/types.d.ts +43 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +48 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Openscan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/bin.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":""}
|
package/dist/bin.js
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { defineCommand, runMain } from "citty";
|
|
3
|
+
import { CommandRegistry } from "./registry.js";
|
|
4
|
+
import { txHistoryCommand } from "./commands/algo/txHistory.js";
|
|
5
|
+
import { gasPriceCommand } from "./commands/algo/gasPrice.js";
|
|
6
|
+
import { tokenBalanceCommand } from "./commands/algo/tokenBalance.js";
|
|
7
|
+
import { addressTypeCommand } from "./commands/util/addressType.js";
|
|
8
|
+
import { decodeInputCommand } from "./commands/util/decodeInput.js";
|
|
9
|
+
import { balanceCommand } from "./commands/util/balance.js";
|
|
10
|
+
import { formatOutput } from "./output/formatters.js";
|
|
11
|
+
import { resolveRpcUrls } from "./rpc/resolve.js";
|
|
12
|
+
// Initialize command registry
|
|
13
|
+
const registry = new CommandRegistry();
|
|
14
|
+
registry.register(txHistoryCommand);
|
|
15
|
+
registry.register(gasPriceCommand);
|
|
16
|
+
registry.register(tokenBalanceCommand);
|
|
17
|
+
registry.register(addressTypeCommand);
|
|
18
|
+
registry.register(decodeInputCommand);
|
|
19
|
+
registry.register(balanceCommand);
|
|
20
|
+
const main = defineCommand({
|
|
21
|
+
meta: {
|
|
22
|
+
name: "openscan",
|
|
23
|
+
version: "0.1.0",
|
|
24
|
+
description: "OpenScan CLI - On-chain blockchain analysis tools",
|
|
25
|
+
},
|
|
26
|
+
args: {
|
|
27
|
+
command: {
|
|
28
|
+
type: "positional",
|
|
29
|
+
description: "Command to execute (e.g., algo:tx-history, util:balance)",
|
|
30
|
+
required: true,
|
|
31
|
+
},
|
|
32
|
+
args: {
|
|
33
|
+
type: "positional",
|
|
34
|
+
description: "Command arguments",
|
|
35
|
+
required: false,
|
|
36
|
+
},
|
|
37
|
+
chain: {
|
|
38
|
+
type: "string",
|
|
39
|
+
description: "Chain ID (default: 1)",
|
|
40
|
+
default: "1",
|
|
41
|
+
},
|
|
42
|
+
rpc: {
|
|
43
|
+
type: "string",
|
|
44
|
+
description: "RPC URL(s), comma-separated (auto-resolved from public RPCs if omitted)",
|
|
45
|
+
},
|
|
46
|
+
"alchemy-key": {
|
|
47
|
+
type: "string",
|
|
48
|
+
description: "Alchemy API key (or set ALCHEMY_API_KEY env var)",
|
|
49
|
+
},
|
|
50
|
+
output: {
|
|
51
|
+
type: "string",
|
|
52
|
+
description: "Output format: json, table, stream",
|
|
53
|
+
default: "json",
|
|
54
|
+
},
|
|
55
|
+
strategy: {
|
|
56
|
+
type: "string",
|
|
57
|
+
description: "RPC strategy: fallback, parallel, race",
|
|
58
|
+
default: "fallback",
|
|
59
|
+
},
|
|
60
|
+
verbose: {
|
|
61
|
+
type: "boolean",
|
|
62
|
+
description: "Verbose output",
|
|
63
|
+
default: false,
|
|
64
|
+
},
|
|
65
|
+
// Command-specific flags
|
|
66
|
+
"from-block": { type: "string", description: "Start block" },
|
|
67
|
+
"to-block": { type: "string", description: "End block" },
|
|
68
|
+
"page-size": { type: "string", description: "Results per page" },
|
|
69
|
+
"token-address": { type: "string", alias: "t", description: "Token contract address" },
|
|
70
|
+
abi: { type: "string", description: "Path to ABI JSON file" },
|
|
71
|
+
granularity: { type: "string", description: "Data granularity" },
|
|
72
|
+
},
|
|
73
|
+
async run({ args }) {
|
|
74
|
+
const commandName = args.command;
|
|
75
|
+
const command = registry.get(commandName);
|
|
76
|
+
if (!command) {
|
|
77
|
+
console.error(`Unknown command: ${commandName}`);
|
|
78
|
+
console.error(`\nAvailable commands:`);
|
|
79
|
+
for (const cmd of registry.list()) {
|
|
80
|
+
console.error(` ${cmd.name.padEnd(25)} ${cmd.description}`);
|
|
81
|
+
}
|
|
82
|
+
process.exit(1);
|
|
83
|
+
}
|
|
84
|
+
const chainId = Number.isNaN(Number(args.chain)) ? args.chain : Number(args.chain);
|
|
85
|
+
const alchemyKey = args["alchemy-key"] || process.env.ALCHEMY_API_KEY;
|
|
86
|
+
let rpcUrls;
|
|
87
|
+
try {
|
|
88
|
+
rpcUrls = resolveRpcUrls({ chainId, rpcFlag: args.rpc, alchemyKey });
|
|
89
|
+
}
|
|
90
|
+
catch (err) {
|
|
91
|
+
console.error(`Error: ${err.message}`);
|
|
92
|
+
process.exit(1);
|
|
93
|
+
}
|
|
94
|
+
const ctx = {
|
|
95
|
+
chainId,
|
|
96
|
+
rpcUrls,
|
|
97
|
+
outputFormat: args.output,
|
|
98
|
+
strategyType: args.strategy,
|
|
99
|
+
verbose: args.verbose,
|
|
100
|
+
};
|
|
101
|
+
// Build command args from positional args and flags
|
|
102
|
+
const commandArgs = {};
|
|
103
|
+
// First positional arg after command name
|
|
104
|
+
if (args.args) {
|
|
105
|
+
const firstArg = command.args[0];
|
|
106
|
+
if (firstArg) {
|
|
107
|
+
commandArgs[firstArg.name] = args.args;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
// Copy relevant flags
|
|
111
|
+
if (args["from-block"])
|
|
112
|
+
commandArgs["from-block"] = args["from-block"];
|
|
113
|
+
if (args["to-block"])
|
|
114
|
+
commandArgs["to-block"] = args["to-block"];
|
|
115
|
+
if (args["page-size"])
|
|
116
|
+
commandArgs["page-size"] = Number(args["page-size"]);
|
|
117
|
+
if (args["token-address"])
|
|
118
|
+
commandArgs["token-address"] = args["token-address"];
|
|
119
|
+
if (args.abi)
|
|
120
|
+
commandArgs.abi = args.abi;
|
|
121
|
+
if (args.granularity)
|
|
122
|
+
commandArgs.granularity = args.granularity;
|
|
123
|
+
// For commands that take data as first arg
|
|
124
|
+
if (commandName === "util:decode-input" && args.args) {
|
|
125
|
+
commandArgs.data = args.args;
|
|
126
|
+
}
|
|
127
|
+
const result = await registry.execute(commandName, commandArgs, ctx);
|
|
128
|
+
const output = formatOutput(result, ctx.outputFormat);
|
|
129
|
+
if (output) {
|
|
130
|
+
console.log(output);
|
|
131
|
+
}
|
|
132
|
+
process.exit(result.exitCode);
|
|
133
|
+
},
|
|
134
|
+
});
|
|
135
|
+
runMain(main);
|
|
136
|
+
//# sourceMappingURL=bin.js.map
|
package/dist/bin.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,8BAA8B;AAC9B,MAAM,QAAQ,GAAG,IAAI,eAAe,EAAE,CAAC;AACvC,QAAQ,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;AACpC,QAAQ,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;AACnC,QAAQ,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC;AACvC,QAAQ,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC;AACtC,QAAQ,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC;AACtC,QAAQ,CAAC,QAAQ,CAAC,cAAc,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,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACrD,WAAW,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAC/B,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC,WAAW,EAAE,WAAW,EAAE,GAAG,CAAC,CAAC;QACrE,MAAM,MAAM,GAAG,YAAY,CAAC,MAAM,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC;QAEtD,IAAI,MAAM,EAAE,CAAC;YACX,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACtB,CAAC;QAED,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAChC,CAAC;CACF,CAAC,CAAC;AAEH,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gasPrice.d.ts","sourceRoot":"","sources":["../../../src/commands/algo/gasPrice.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAExE,QAAA,MAAM,OAAO,EAAE,cAgBd,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,iBAc7B,CAAC;AAEF,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { GasPriceHistoryAlgorithm } from "@openscan/algorithms";
|
|
2
|
+
const handler = async (args, ctx) => {
|
|
3
|
+
const algo = new GasPriceHistoryAlgorithm();
|
|
4
|
+
const result = await algo.execute({
|
|
5
|
+
chainId: ctx.chainId,
|
|
6
|
+
rpcUrls: ctx.rpcUrls,
|
|
7
|
+
strategyType: ctx.strategyType,
|
|
8
|
+
targetBlock: args["target-block"],
|
|
9
|
+
granularity: args.granularity,
|
|
10
|
+
});
|
|
11
|
+
return {
|
|
12
|
+
exitCode: result.success ? 0 : 1,
|
|
13
|
+
data: result.data,
|
|
14
|
+
error: result.error,
|
|
15
|
+
metadata: result.metadata,
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export const gasPriceCommand = {
|
|
19
|
+
name: "algo:gas-price",
|
|
20
|
+
description: "Get gas price history for a network",
|
|
21
|
+
args: [],
|
|
22
|
+
flags: [
|
|
23
|
+
{ name: "target-block", description: "Block number to sample back to", type: "number" },
|
|
24
|
+
{
|
|
25
|
+
name: "granularity",
|
|
26
|
+
description: "Data granularity: block, hour, day",
|
|
27
|
+
type: "string",
|
|
28
|
+
default: "block",
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
handler,
|
|
32
|
+
};
|
|
33
|
+
export { handler as gasPriceHandler };
|
|
34
|
+
//# sourceMappingURL=gasPrice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gasPrice.js","sourceRoot":"","sources":["../../../src/commands/algo/gasPrice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAGhE,MAAM,OAAO,GAAmB,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;IAClD,MAAM,IAAI,GAAG,IAAI,wBAAwB,EAAE,CAAC;IAC5C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC;QAChC,OAAO,EAAE,GAAG,CAAC,OAAO;QACpB,OAAO,EAAE,GAAG,CAAC,OAAO;QACpB,YAAY,EAAE,GAAG,CAAC,YAAY;QAC9B,WAAW,EAAE,IAAI,CAAC,cAAc,CAAuB;QACvD,WAAW,EAAE,IAAI,CAAC,WAAmD;KACtE,CAAC,CAAC;IAEH,OAAO;QACL,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAChC,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,QAAQ,EAAE,MAAM,CAAC,QAAQ;KAC1B,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAsB;IAChD,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,qCAAqC;IAClD,IAAI,EAAE,EAAE;IACR,KAAK,EAAE;QACL,EAAE,IAAI,EAAE,cAAc,EAAE,WAAW,EAAE,gCAAgC,EAAE,IAAI,EAAE,QAAQ,EAAE;QACvF;YACE,IAAI,EAAE,aAAa;YACnB,WAAW,EAAE,oCAAoC;YACjD,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,OAAO;SACjB;KACF;IACD,OAAO;CACR,CAAC;AAEF,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokenBalance.d.ts","sourceRoot":"","sources":["../../../src/commands/algo/tokenBalance.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAExE,QAAA,MAAM,OAAO,EAAE,cAqBd,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,iBAgBjC,CAAC;AAEF,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { TokenBalanceHistoryAlgorithm } from "@openscan/algorithms";
|
|
2
|
+
const handler = async (args, ctx) => {
|
|
3
|
+
const algo = new TokenBalanceHistoryAlgorithm();
|
|
4
|
+
const result = await algo.execute({
|
|
5
|
+
address: args.address,
|
|
6
|
+
tokenAddress: args["token-address"],
|
|
7
|
+
chainId: ctx.chainId,
|
|
8
|
+
rpcUrls: ctx.rpcUrls,
|
|
9
|
+
strategyType: ctx.strategyType,
|
|
10
|
+
pagination: {
|
|
11
|
+
fromBlock: args["from-block"],
|
|
12
|
+
toBlock: args["to-block"],
|
|
13
|
+
pageSize: args["page-size"],
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
return {
|
|
17
|
+
exitCode: result.success ? 0 : 1,
|
|
18
|
+
data: result.data,
|
|
19
|
+
error: result.error,
|
|
20
|
+
metadata: result.metadata,
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export const tokenBalanceCommand = {
|
|
24
|
+
name: "algo:token-balance",
|
|
25
|
+
description: "Track ERC-20 token balance history for an address",
|
|
26
|
+
args: [{ name: "address", description: "Target address", required: true, type: "string" }],
|
|
27
|
+
flags: [
|
|
28
|
+
{
|
|
29
|
+
name: "token-address",
|
|
30
|
+
alias: "t",
|
|
31
|
+
description: "ERC-20 token contract address (required)",
|
|
32
|
+
type: "string",
|
|
33
|
+
},
|
|
34
|
+
{ name: "from-block", description: "Start block", type: "string" },
|
|
35
|
+
{ name: "to-block", description: "End block", type: "string" },
|
|
36
|
+
{ name: "page-size", description: "Results per page", type: "number", default: 100 },
|
|
37
|
+
],
|
|
38
|
+
handler,
|
|
39
|
+
};
|
|
40
|
+
export { handler as tokenBalanceHandler };
|
|
41
|
+
//# sourceMappingURL=tokenBalance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokenBalance.js","sourceRoot":"","sources":["../../../src/commands/algo/tokenBalance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AAGpE,MAAM,OAAO,GAAmB,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;IAClD,MAAM,IAAI,GAAG,IAAI,4BAA4B,EAAE,CAAC;IAChD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC;QAChC,OAAO,EAAE,IAAI,CAAC,OAAiB;QAC/B,YAAY,EAAE,IAAI,CAAC,eAAe,CAAW;QAC7C,OAAO,EAAE,GAAG,CAAC,OAAO;QACpB,OAAO,EAAE,GAAG,CAAC,OAAO;QACpB,YAAY,EAAE,GAAG,CAAC,YAAY;QAC9B,UAAU,EAAE;YACV,SAAS,EAAE,IAAI,CAAC,YAAY,CAAuB;Y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MAAM,gBAAgB,CAAC;AAExE,QAAA,MAAM,OAAO,EAAE,cAoBd,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,iBAU9B,CAAC;AAEF,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { TransactionHistoryAlgorithm } from "@openscan/algorithms";
|
|
2
|
+
const handler = async (args, ctx) => {
|
|
3
|
+
const algo = new TransactionHistoryAlgorithm();
|
|
4
|
+
const result = await algo.execute({
|
|
5
|
+
address: args.address,
|
|
6
|
+
chainId: ctx.chainId,
|
|
7
|
+
rpcUrls: ctx.rpcUrls,
|
|
8
|
+
strategyType: ctx.strategyType,
|
|
9
|
+
pagination: {
|
|
10
|
+
fromBlock: args["from-block"],
|
|
11
|
+
toBlock: args["to-block"],
|
|
12
|
+
pageSize: args["page-size"],
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
return {
|
|
16
|
+
exitCode: result.success ? 0 : 1,
|
|
17
|
+
data: result.data,
|
|
18
|
+
error: result.error,
|
|
19
|
+
metadata: result.metadata,
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export const txHistoryCommand = {
|
|
23
|
+
name: "algo:tx-history",
|
|
24
|
+
description: "Get transaction history for an address",
|
|
25
|
+
args: [{ name: "address", description: "Target address", required: true, type: "string" }],
|
|
26
|
+
flags: [
|
|
27
|
+
{ name: "from-block", description: "Start block", type: "string" },
|
|
28
|
+
{ name: "to-block", description: "End block", type: "string" },
|
|
29
|
+
{ name: "page-size", description: "Results per page", type: "number", default: 100 },
|
|
30
|
+
],
|
|
31
|
+
handler,
|
|
32
|
+
};
|
|
33
|
+
export { handler as txHistoryHandler };
|
|
34
|
+
//# sourceMappingURL=txHistory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"txHistory.js","sourceRoot":"","sources":["../../../src/commands/algo/txHistory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE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AAE,kBAAkB,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE;KACrF;IACD,OAAO;CACR,CAAC;AAEF,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addressType.d.ts","sourceRoot":"","sources":["../../../src/commands/util/addressType.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAExE,QAAA,MAAM,OAAO,EAAE,cAgCd,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,iBAMhC,CAAC;AAEF,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { validateAddress, detectAddressType } from "@openscan/utils";
|
|
2
|
+
const handler = async (args, ctx) => {
|
|
3
|
+
const address = args.address;
|
|
4
|
+
const info = validateAddress(address);
|
|
5
|
+
if (!info.isValid) {
|
|
6
|
+
return {
|
|
7
|
+
exitCode: 1,
|
|
8
|
+
error: { code: "INVALID_ADDRESS", message: `Invalid address: ${address}` },
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
// If chain ID is provided, try to detect EOA vs contract
|
|
12
|
+
if (ctx.rpcUrls.length > 0) {
|
|
13
|
+
try {
|
|
14
|
+
const nc = await import("@openscan/network-connectors");
|
|
15
|
+
const config = {
|
|
16
|
+
type: ctx.strategyType,
|
|
17
|
+
rpcUrls: ctx.rpcUrls,
|
|
18
|
+
};
|
|
19
|
+
const client = nc.ClientFactory.createClient(ctx.chainId, config);
|
|
20
|
+
try {
|
|
21
|
+
const fullInfo = await detectAddressType(address, client);
|
|
22
|
+
return { exitCode: 0, data: fullInfo };
|
|
23
|
+
}
|
|
24
|
+
finally {
|
|
25
|
+
await client.close();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
// Fall through to return basic validation info
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return { exitCode: 0, data: info };
|
|
33
|
+
};
|
|
34
|
+
export const addressTypeCommand = {
|
|
35
|
+
name: "util:address-type",
|
|
36
|
+
description: "Detect address type (EOA/contract)",
|
|
37
|
+
args: [{ name: "address", description: "Address to check", required: true, type: "string" }],
|
|
38
|
+
flags: [],
|
|
39
|
+
handler,
|
|
40
|
+
};
|
|
41
|
+
export { handler as addressTypeHandler };
|
|
42
|
+
//# sourceMappingURL=addressType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addressType.js","sourceRoot":"","sources":["../../../src/commands/util/addressType.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAIrE,MAAM,OAAO,GAAmB,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;IAClD,MAAM,OAAO,GAAG,IAAI,CAAC,OAAiB,CAAC;IACvC,MAAM,IAAI,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;IAEtC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QAClB,OAAO;YACL,QAAQ,EAAE,CAAC;YACX,KAAK,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE,oBAAoB,OAAO,EAAE,EAAE;SAC3E,CAAC;IACJ,CAAC;IAED,yDAAyD;IACzD,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC3B,IAAI,CAAC;YACH,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,8BAA8B,CAAC,CAAC;YACxD,MAAM,MAAM,GAAG;gBACb,IAAI,EAAE,GAAG,CAAC,YAAgD;gBAC1D,OAAO,EAAE,GAAG,CAAC,OAAO;aACrB,CAAC;YACF,MAAM,MAAM,GAAG,EAAE,CAAC,aAAa,CAAC,YAAY,CAAC,GAAG,CAAC,OAA2B,EAAE,MAAM,CAAC,CAAC;YACtF,IAAI,CAAC;gBACH,MAAM,QAAQ,GAAG,MAAM,iBAAiB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;gBAC1D,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;YACzC,CAAC;oBAAS,CAAC;gBACT,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;YACvB,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,+CAA+C;QACjD,CAAC;IACH,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AACrC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAsB;IACnD,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,oCAAoC;IACjD,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,kBAAkB,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;IAC5F,KAAK,EAAE,EAAE;IACT,OAAO;CACR,CAAC;AAEF,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"balance.d.ts","sourceRoot":"","sources":["../../../src/commands/util/balance.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAExE,QAAA,MAAM,OAAO,EAAE,cAqDd,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,iBAM5B,CAAC;AAEF,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { weiToEther, validateAddress } from "@openscan/utils";
|
|
2
|
+
const handler = async (args, ctx) => {
|
|
3
|
+
const address = args.address;
|
|
4
|
+
const info = validateAddress(address);
|
|
5
|
+
if (!info.isValid) {
|
|
6
|
+
return {
|
|
7
|
+
exitCode: 1,
|
|
8
|
+
error: { code: "INVALID_ADDRESS", message: `Invalid address: ${address}` },
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
if (ctx.rpcUrls.length === 0) {
|
|
12
|
+
return {
|
|
13
|
+
exitCode: 1,
|
|
14
|
+
error: { code: "NO_RPC", message: "At least one RPC URL is required" },
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
const nc = await import("@openscan/network-connectors");
|
|
18
|
+
const config = {
|
|
19
|
+
type: ctx.strategyType,
|
|
20
|
+
rpcUrls: ctx.rpcUrls,
|
|
21
|
+
};
|
|
22
|
+
const client = nc.ClientFactory.createClient(ctx.chainId, config);
|
|
23
|
+
try {
|
|
24
|
+
const result = await client.execute("eth_getBalance", [address, "latest"]);
|
|
25
|
+
if (!result.success || !result.data) {
|
|
26
|
+
return {
|
|
27
|
+
exitCode: 1,
|
|
28
|
+
error: {
|
|
29
|
+
code: "RPC_ERROR",
|
|
30
|
+
message: result.errors?.[0]?.error ?? "Failed to get balance",
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
const balanceWei = result.data;
|
|
35
|
+
const balanceEther = weiToEther(BigInt(balanceWei));
|
|
36
|
+
return {
|
|
37
|
+
exitCode: 0,
|
|
38
|
+
data: {
|
|
39
|
+
address,
|
|
40
|
+
balanceWei,
|
|
41
|
+
balanceEther,
|
|
42
|
+
chainId: ctx.chainId,
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
finally {
|
|
47
|
+
await client.close();
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
export const balanceCommand = {
|
|
51
|
+
name: "util:balance",
|
|
52
|
+
description: "Get native token balance for an address",
|
|
53
|
+
args: [{ name: "address", description: "Address to check", required: true, type: "string" }],
|
|
54
|
+
flags: [],
|
|
55
|
+
handler,
|
|
56
|
+
};
|
|
57
|
+
export { handler as balanceHandler };
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@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { decodeTxInput } from "@openscan/utils";
|
|
2
|
+
const handler = async (args) => {
|
|
3
|
+
const data = args.data;
|
|
4
|
+
if (!data || !data.startsWith("0x")) {
|
|
5
|
+
return {
|
|
6
|
+
exitCode: 1,
|
|
7
|
+
error: { code: "INVALID_INPUT", message: "Data must be a hex string starting with 0x" },
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
const decoded = decodeTxInput(data);
|
|
11
|
+
return { exitCode: 0, data: decoded };
|
|
12
|
+
};
|
|
13
|
+
export const decodeInputCommand = {
|
|
14
|
+
name: "util:decode-input",
|
|
15
|
+
description: "Decode transaction input data",
|
|
16
|
+
args: [
|
|
17
|
+
{
|
|
18
|
+
name: "data",
|
|
19
|
+
description: "Hex-encoded transaction input data",
|
|
20
|
+
required: true,
|
|
21
|
+
type: "string",
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
flags: [{ name: "abi", description: "Path to ABI JSON file", type: "string" }],
|
|
25
|
+
handler,
|
|
26
|
+
};
|
|
27
|
+
export { handler as decodeInputHandler };
|
|
28
|
+
//# sourceMappingURL=decodeInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decodeInput.js","sourceRoot":"","sources":["../../../src/commands/util/decodeInput.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,MAAM,OAAO,GAAmB,KAAK,EAAE,IAAI,EAAE,EAAE;IAC7C,MAAM,IAAI,GAAG,IAAI,CAAC,IAAc,CAAC;IAEjC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACpC,OAAO;YACL,QAAQ,EAAE,CAAC;YACX,KAAK,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,4CAA4C,EAAE;SACxF,CAAC;IACJ,CAAC;IAED,MAAM,OAAO,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;IAEpC,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AACxC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAsB;IACnD,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,+BAA+B;IAC5C,IAAI,EAAE;QACJ;YACE,IAAI,EAAE,MAAM;YACZ,WAAW,EAAE,oCAAoC;YACjD,QAAQ,EAAE,IAAI;YACd,IAAI,EAAE,QAAQ;SACf;KACF;IACD,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,uBAAuB,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;IAC9E,OAAO;CACR,CAAC;AAEF,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { txHistoryHandler } from "../commands/algo/txHistory.js";
|
|
2
|
+
export { gasPriceHandler } from "../commands/algo/gasPrice.js";
|
|
3
|
+
export { tokenBalanceHandler } from "../commands/algo/tokenBalance.js";
|
|
4
|
+
export { addressTypeHandler } from "../commands/util/addressType.js";
|
|
5
|
+
export { decodeInputHandler } from "../commands/util/decodeInput.js";
|
|
6
|
+
export { balanceHandler } from "../commands/util/balance.js";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/handlers/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Re-export all command handlers for programmatic use
|
|
2
|
+
export { txHistoryHandler } from "../commands/algo/txHistory.js";
|
|
3
|
+
export { gasPriceHandler } from "../commands/algo/gasPrice.js";
|
|
4
|
+
export { tokenBalanceHandler } from "../commands/algo/tokenBalance.js";
|
|
5
|
+
export { addressTypeHandler } from "../commands/util/addressType.js";
|
|
6
|
+
export { decodeInputHandler } from "../commands/util/decodeInput.js";
|
|
7
|
+
export { balanceHandler } from "../commands/util/balance.js";
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/handlers/index.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { CommandRegistry } from "./registry.js";
|
|
2
|
+
export { formatOutput } from "./output/formatters.js";
|
|
3
|
+
export { txHistoryCommand } from "./commands/algo/txHistory.js";
|
|
4
|
+
export { gasPriceCommand } from "./commands/algo/gasPrice.js";
|
|
5
|
+
export { tokenBalanceCommand } from "./commands/algo/tokenBalance.js";
|
|
6
|
+
export { addressTypeCommand } from "./commands/util/addressType.js";
|
|
7
|
+
export { decodeInputCommand } from "./commands/util/decodeInput.js";
|
|
8
|
+
export { balanceCommand } from "./commands/util/balance.js";
|
|
9
|
+
export { txHistoryHandler, gasPriceHandler, tokenBalanceHandler, addressTypeHandler, decodeInputHandler, balanceHandler, } from "./handlers/index.js";
|
|
10
|
+
export { resolveRpcUrls, getAlchemyUrl } from "./rpc/index.js";
|
|
11
|
+
export type { ResolveRpcOptions } from "./rpc/index.js";
|
|
12
|
+
export type { CommandDefinition, CommandHandler, CommandContext, CommandResult, CommandRegistry as ICommandRegistry, ArgDefinition, FlagDefinition, OutputFormat, } from "./types.js";
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAGtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAG5D,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,GACf,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/D,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAGxD,YAAY,EACV,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,aAAa,EACb,eAAe,IAAI,gBAAgB,EACnC,aAAa,EACb,cAAc,EACd,YAAY,GACb,MAAM,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Programmatic entry point - exports handlers and registry
|
|
2
|
+
export { CommandRegistry } from "./registry.js";
|
|
3
|
+
export { formatOutput } from "./output/formatters.js";
|
|
4
|
+
// Command definitions
|
|
5
|
+
export { txHistoryCommand } from "./commands/algo/txHistory.js";
|
|
6
|
+
export { gasPriceCommand } from "./commands/algo/gasPrice.js";
|
|
7
|
+
export { tokenBalanceCommand } from "./commands/algo/tokenBalance.js";
|
|
8
|
+
export { addressTypeCommand } from "./commands/util/addressType.js";
|
|
9
|
+
export { decodeInputCommand } from "./commands/util/decodeInput.js";
|
|
10
|
+
export { balanceCommand } from "./commands/util/balance.js";
|
|
11
|
+
// Handlers for direct invocation
|
|
12
|
+
export { txHistoryHandler, gasPriceHandler, tokenBalanceHandler, addressTypeHandler, decodeInputHandler, balanceHandler, } from "./handlers/index.js";
|
|
13
|
+
// RPC resolution
|
|
14
|
+
export { resolveRpcUrls, getAlchemyUrl } from "./rpc/index.js";
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,sBAAsB;AACtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5D,iCAAiC;AACjC,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,GACf,MAAM,qBAAqB,CAAC;AAE7B,iBAAiB;AACjB,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatters.d.ts","sourceRoot":"","sources":["../../src/output/formatters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE/D;;GAEG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,YAAY,GAAG,MAAM,CAkBtF"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Format a CommandResult for output.
|
|
3
|
+
*/
|
|
4
|
+
export function formatOutput(result, format) {
|
|
5
|
+
if (!result.data) {
|
|
6
|
+
if (result.error) {
|
|
7
|
+
return formatError(result.error.code, result.error.message);
|
|
8
|
+
}
|
|
9
|
+
return "";
|
|
10
|
+
}
|
|
11
|
+
switch (format) {
|
|
12
|
+
case "json":
|
|
13
|
+
return JSON.stringify(result.data, null, 2);
|
|
14
|
+
case "table":
|
|
15
|
+
return formatTable(result.data);
|
|
16
|
+
case "stream":
|
|
17
|
+
return JSON.stringify(result.data);
|
|
18
|
+
default:
|
|
19
|
+
return JSON.stringify(result.data, null, 2);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function formatError(code, message) {
|
|
23
|
+
return JSON.stringify({ error: { code, message } }, null, 2);
|
|
24
|
+
}
|
|
25
|
+
function formatTable(data) {
|
|
26
|
+
if (Array.isArray(data)) {
|
|
27
|
+
return formatArrayAsTable(data);
|
|
28
|
+
}
|
|
29
|
+
if (typeof data === "object" && data !== null) {
|
|
30
|
+
// Check if it has an entries array (common pattern for algorithm results)
|
|
31
|
+
const obj = data;
|
|
32
|
+
if (Array.isArray(obj.entries)) {
|
|
33
|
+
return formatArrayAsTable(obj.entries);
|
|
34
|
+
}
|
|
35
|
+
// Format single object as key-value pairs
|
|
36
|
+
return Object.entries(obj)
|
|
37
|
+
.map(([key, value]) => `${key}: ${formatValue(value)}`)
|
|
38
|
+
.join("\n");
|
|
39
|
+
}
|
|
40
|
+
return String(data);
|
|
41
|
+
}
|
|
42
|
+
function formatArrayAsTable(rows) {
|
|
43
|
+
if (rows.length === 0)
|
|
44
|
+
return "(empty)";
|
|
45
|
+
const firstRow = rows[0];
|
|
46
|
+
if (typeof firstRow !== "object" || firstRow === null) {
|
|
47
|
+
return rows.map(String).join("\n");
|
|
48
|
+
}
|
|
49
|
+
const keys = Object.keys(firstRow);
|
|
50
|
+
const widths = keys.map((key) => {
|
|
51
|
+
const values = rows.map((row) => {
|
|
52
|
+
const val = row[key];
|
|
53
|
+
return formatValue(val).length;
|
|
54
|
+
});
|
|
55
|
+
return Math.max(key.length, ...values);
|
|
56
|
+
});
|
|
57
|
+
const header = keys.map((key, i) => key.padEnd(widths[i] ?? 0)).join(" | ");
|
|
58
|
+
const separator = widths.map((w) => "-".repeat(w)).join("-+-");
|
|
59
|
+
const body = rows.map((row) => {
|
|
60
|
+
return keys
|
|
61
|
+
.map((key, i) => {
|
|
62
|
+
const val = row[key];
|
|
63
|
+
return formatValue(val).padEnd(widths[i] ?? 0);
|
|
64
|
+
})
|
|
65
|
+
.join(" | ");
|
|
66
|
+
});
|
|
67
|
+
return [header, separator, ...body].join("\n");
|
|
68
|
+
}
|
|
69
|
+
function formatValue(value) {
|
|
70
|
+
if (value === null || value === undefined)
|
|
71
|
+
return "";
|
|
72
|
+
if (typeof value === "string")
|
|
73
|
+
return value;
|
|
74
|
+
if (typeof value === "number" || typeof value === "bigint")
|
|
75
|
+
return value.toString();
|
|
76
|
+
if (typeof value === "boolean")
|
|
77
|
+
return value ? "true" : "false";
|
|
78
|
+
return JSON.stringify(value);
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=formatters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatters.js","sourceRoot":"","sources":["../../src/output/formatters.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,UAAU,YAAY,CAAI,MAAwB,EAAE,MAAoB;IAC5E,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QACjB,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;YACjB,OAAO,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC9D,CAAC;QACD,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,MAAM;YACT,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QAC9C,KAAK,OAAO;YACV,OAAO,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAClC,KAAK,QAAQ;YACX,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACrC;YACE,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAChD,CAAC;AACH,CAAC;AAED,SAAS,WAAW,CAAC,IAAY,EAAE,OAAe;IAChD,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AAC/D,CAAC;AAED,SAAS,WAAW,CAAC,IAAa;IAChC,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACxB,OAAO,kBAAkB,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IAED,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI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E,OAAO,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;IAChE,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CommandDefinition, CommandContext, CommandResult, CommandRegistry as ICommandRegistry } from "./types.js";
|
|
2
|
+
export declare class CommandRegistry implements ICommandRegistry {
|
|
3
|
+
private commands;
|
|
4
|
+
register(command: CommandDefinition): void;
|
|
5
|
+
get(name: string): CommandDefinition | undefined;
|
|
6
|
+
list(): CommandDefinition[];
|
|
7
|
+
execute(name: string, args: Record<string, unknown>, ctx: CommandContext): Promise<CommandResult>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,eAAe,IAAI,gBAAgB,EACpC,MAAM,YAAY,CAAC;AAEpB,qBAAa,eAAgB,YAAW,gBAAgB;IACtD,OAAO,CAAC,QAAQ,CAAwC;IAExD,QAAQ,CAAC,OAAO,EAAE,iBAAiB,GAAG,IAAI;IAO1C,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS;IAIhD,IAAI,IAAI,iBAAiB,EAAE;IAIrB,OAAO,CACX,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,GAAG,EAAE,cAAc,GAClB,OAAO,CAAC,aAAa,CAAC;CAwB1B"}
|
package/dist/registry.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export class CommandRegistry {
|
|
2
|
+
commands = new Map();
|
|
3
|
+
register(command) {
|
|
4
|
+
if (this.commands.has(command.name)) {
|
|
5
|
+
throw new Error(`Command "${command.name}" is already registered`);
|
|
6
|
+
}
|
|
7
|
+
this.commands.set(command.name, command);
|
|
8
|
+
}
|
|
9
|
+
get(name) {
|
|
10
|
+
return this.commands.get(name);
|
|
11
|
+
}
|
|
12
|
+
list() {
|
|
13
|
+
return Array.from(this.commands.values());
|
|
14
|
+
}
|
|
15
|
+
async execute(name, args, ctx) {
|
|
16
|
+
const command = this.commands.get(name);
|
|
17
|
+
if (!command) {
|
|
18
|
+
return {
|
|
19
|
+
exitCode: 1,
|
|
20
|
+
error: { code: "UNKNOWN_COMMAND", message: `Unknown command: ${name}` },
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
// Validate required args
|
|
24
|
+
for (const argDef of command.args) {
|
|
25
|
+
if (argDef.required && !(argDef.name in args)) {
|
|
26
|
+
return {
|
|
27
|
+
exitCode: 1,
|
|
28
|
+
error: {
|
|
29
|
+
code: "MISSING_ARGUMENT",
|
|
30
|
+
message: `Missing required argument: ${argDef.name}`,
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return command.handler(args, ctx);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAOA,MAAM,OAAO,eAAe;IAClB,QAAQ,GAAG,IAAI,GAAG,EAA6B,CAAC;IAExD,QAAQ,CAAC,OAA0B;QACjC,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YACpC,MAAM,IAAI,KAAK,CAAC,YAAY,OAAO,CAAC,IAAI,yBAAyB,CAAC,CAAC;QACrE,CAAC;QACD,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC3C,CAAC;IAED,GAAG,CA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ot":"","sources":["../../src/rpc/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface ResolveRpcOptions {
|
|
2
|
+
chainId: number | string;
|
|
3
|
+
rpcFlag?: string;
|
|
4
|
+
alchemyKey?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function getAlchemyUrl(chainId: number, key: string): string | null;
|
|
7
|
+
export declare function resolveRpcUrls(options: ResolveRpcOptions): string[];
|
|
8
|
+
//# sourceMappingURL=resolve.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/rpc/resolve.ts"],"names":[],"mappings":"AA6BA,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAIzE;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,iBAAiB,GAAG,MAAM,EAAE,CA+BnE"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
const ALCHEMY_CHAINS = {
|
|
5
|
+
1: "eth-mainnet",
|
|
6
|
+
10: "opt-mainnet",
|
|
7
|
+
56: "bnb-mainnet",
|
|
8
|
+
97: "bnb-testnet",
|
|
9
|
+
137: "polygon-mainnet",
|
|
10
|
+
8453: "base-mainnet",
|
|
11
|
+
42161: "arb-mainnet",
|
|
12
|
+
43114: "avax-mainnet",
|
|
13
|
+
11155111: "eth-sepolia",
|
|
14
|
+
};
|
|
15
|
+
export function getAlchemyUrl(chainId, key) {
|
|
16
|
+
const subdomain = ALCHEMY_CHAINS[chainId];
|
|
17
|
+
if (!subdomain)
|
|
18
|
+
return null;
|
|
19
|
+
return `https://${subdomain}.g.alchemy.com/v2/${key}`;
|
|
20
|
+
}
|
|
21
|
+
export function resolveRpcUrls(options) {
|
|
22
|
+
const { chainId, rpcFlag, alchemyKey } = options;
|
|
23
|
+
if (rpcFlag) {
|
|
24
|
+
return rpcFlag
|
|
25
|
+
.split(",")
|
|
26
|
+
.map((u) => u.trim())
|
|
27
|
+
.filter(Boolean);
|
|
28
|
+
}
|
|
29
|
+
const urls = [];
|
|
30
|
+
const numericChainId = typeof chainId === "string" ? Number(chainId) : chainId;
|
|
31
|
+
if (alchemyKey) {
|
|
32
|
+
const alchemyUrl = getAlchemyUrl(numericChainId, alchemyKey);
|
|
33
|
+
if (alchemyUrl) {
|
|
34
|
+
urls.push(alchemyUrl);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
const metadataUrls = loadMetadataRpcs(numericChainId);
|
|
38
|
+
urls.push(...metadataUrls);
|
|
39
|
+
if (urls.length === 0) {
|
|
40
|
+
throw new Error(`No RPC endpoints available for chain ${chainId}. ` +
|
|
41
|
+
"Provide --rpc explicitly or use --alchemy-key for supported chains.");
|
|
42
|
+
}
|
|
43
|
+
return urls;
|
|
44
|
+
}
|
|
45
|
+
function loadMetadataRpcs(chainId) {
|
|
46
|
+
try {
|
|
47
|
+
const require = createRequire(import.meta.url);
|
|
48
|
+
const metadataBase = dirname(require.resolve("@openscan/metadata/package.json"));
|
|
49
|
+
const rpcFile = join(metadataBase, "dist", "rpcs", "evm", `${chainId}.json`);
|
|
50
|
+
const raw = readFileSync(rpcFile, "utf-8");
|
|
51
|
+
const data = JSON.parse(raw);
|
|
52
|
+
return data.endpoints.filter((e) => e.isPublic).map((e) => e.url);
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
return [];
|
|
56
|
+
}
|
|
57
|
+
}
|
|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ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { OpError, OpMetadata } from "@openscan/utils";
|
|
2
|
+
export interface CommandDefinition {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
args: ArgDefinition[];
|
|
6
|
+
flags: FlagDefinition[];
|
|
7
|
+
handler: CommandHandler;
|
|
8
|
+
}
|
|
9
|
+
export interface ArgDefinition {
|
|
10
|
+
name: string;
|
|
11
|
+
description: string;
|
|
12
|
+
required: boolean;
|
|
13
|
+
type: "string" | "number" | "boolean";
|
|
14
|
+
}
|
|
15
|
+
export interface FlagDefinition {
|
|
16
|
+
name: string;
|
|
17
|
+
alias?: string;
|
|
18
|
+
description: string;
|
|
19
|
+
type: "string" | "number" | "boolean";
|
|
20
|
+
default?: unknown;
|
|
21
|
+
}
|
|
22
|
+
export type OutputFormat = "json" | "table" | "stream";
|
|
23
|
+
export interface CommandContext {
|
|
24
|
+
outputFormat: OutputFormat;
|
|
25
|
+
chainId: number | string;
|
|
26
|
+
rpcUrls: string[];
|
|
27
|
+
strategyType: "fallback" | "parallel" | "race";
|
|
28
|
+
verbose: boolean;
|
|
29
|
+
}
|
|
30
|
+
export interface CommandResult<T = unknown> {
|
|
31
|
+
exitCode: number;
|
|
32
|
+
data?: T;
|
|
33
|
+
error?: OpError;
|
|
34
|
+
metadata?: OpMetadata;
|
|
35
|
+
}
|
|
36
|
+
export type CommandHandler = (args: Record<string, unknown>, ctx: CommandContext) => Promise<CommandResult>;
|
|
37
|
+
export interface CommandRegistry {
|
|
38
|
+
register(command: CommandDefinition): void;
|
|
39
|
+
get(name: string): CommandDefinition | undefined;
|
|
40
|
+
list(): CommandDefinition[];
|
|
41
|
+
execute(name: string, args: Record<string, unknown>, ctx: CommandContext): Promise<CommandResult>;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/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AE,OAAO,CAAC,EAC7B,GAAG,EAAE,cAAc,KAChB,OAAO,CAAC,aAAa,CAAC,CAAC;AAE5B,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,OAAO,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAC3C,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS,CAAC;IACjD,IAAI,IAAI,iBAAiB,EAAE,CAAC;IAC5B,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;CACnG"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@openscan/cli",
|
|
3
|
+
"repository": {
|
|
4
|
+
"type": "git",
|
|
5
|
+
"url": "https://github.com/openscan-explorer/ia.git",
|
|
6
|
+
"directory": "packages/cli"
|
|
7
|
+
},
|
|
8
|
+
"version": "0.0.1-alpha",
|
|
9
|
+
"type": "module",
|
|
10
|
+
"bin": {
|
|
11
|
+
"openscan": "dist/bin.js"
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@openscan/metadata": "1.1.2-alpha.0",
|
|
15
|
+
"citty": "^0.2.1",
|
|
16
|
+
"@openscan/algorithms": "0.0.1-alpha",
|
|
17
|
+
"@openscan/utils": "0.0.1-alpha"
|
|
18
|
+
},
|
|
19
|
+
"peerDependencies": {
|
|
20
|
+
"@openscan/network-connectors": "^1.7.0"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@openscan/network-connectors": "^1.7.0",
|
|
24
|
+
"@types/node": "^24.10.0",
|
|
25
|
+
"tsx": "^4.21.0",
|
|
26
|
+
"typescript": "^5.9.3",
|
|
27
|
+
"@openscan/tsconfig": "0.0.0"
|
|
28
|
+
},
|
|
29
|
+
"main": "dist/index.js",
|
|
30
|
+
"types": "dist/index.d.ts",
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"import": "./dist/index.js",
|
|
34
|
+
"types": "./dist/index.d.ts"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"files": [
|
|
38
|
+
"dist"
|
|
39
|
+
],
|
|
40
|
+
"publishConfig": {
|
|
41
|
+
"access": "public"
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "tsc -p tsconfig.json",
|
|
45
|
+
"test": "tsx --test tests/**/*.test.ts",
|
|
46
|
+
"typecheck": "tsc --noEmit"
|
|
47
|
+
}
|
|
48
|
+
}
|